summaryrefslogtreecommitdiff
path: root/sw/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui')
-rw-r--r--sw/source/ui/app/app.src665
-rw-r--r--sw/source/ui/app/appenv.cxx545
-rw-r--r--sw/source/ui/app/apphdl.cxx976
-rw-r--r--sw/source/ui/app/applab.cxx457
-rw-r--r--sw/source/ui/app/appopt.cxx646
-rw-r--r--sw/source/ui/app/docsh.cxx1431
-rw-r--r--sw/source/ui/app/docsh2.cxx1949
-rw-r--r--sw/source/ui/app/docshdrw.cxx84
-rw-r--r--sw/source/ui/app/docshini.cxx818
-rw-r--r--sw/source/ui/app/docst.cxx1312
-rw-r--r--sw/source/ui/app/docstyle.cxx2906
-rw-r--r--sw/source/ui/app/error.src214
-rw-r--r--sw/source/ui/app/mainwn.cxx165
-rw-r--r--sw/source/ui/app/mn.src1453
-rw-r--r--sw/source/ui/app/swdll.cxx156
-rw-r--r--sw/source/ui/app/swmodul1.cxx675
-rw-r--r--sw/source/ui/app/swmodule.cxx500
-rw-r--r--sw/source/ui/app/swwait.cxx75
-rw-r--r--sw/source/ui/cctrl/actctrl.cxx138
-rw-r--r--sw/source/ui/cctrl/popbox.cxx91
-rw-r--r--sw/source/ui/cctrl/swlbox.cxx231
-rw-r--r--sw/source/ui/chrdlg/break.cxx252
-rw-r--r--sw/source/ui/chrdlg/break.hrc41
-rw-r--r--sw/source/ui/chrdlg/ccoll.cxx236
-rw-r--r--sw/source/ui/chrdlg/ccoll.hrc50
-rw-r--r--sw/source/ui/chrdlg/ccoll.src165
-rw-r--r--sw/source/ui/chrdlg/chardlg.cxx405
-rw-r--r--sw/source/ui/chrdlg/chardlg.hrc86
-rw-r--r--sw/source/ui/chrdlg/chardlg.src272
-rw-r--r--sw/source/ui/chrdlg/chrdlg.src77
-rw-r--r--sw/source/ui/chrdlg/drpcps.cxx894
-rw-r--r--sw/source/ui/chrdlg/drpcps.hrc51
-rw-r--r--sw/source/ui/chrdlg/drpcps.src233
-rw-r--r--sw/source/ui/chrdlg/numpara.cxx364
-rw-r--r--sw/source/ui/chrdlg/numpara.hrc53
-rw-r--r--sw/source/ui/chrdlg/numpara.src237
-rw-r--r--sw/source/ui/chrdlg/paradlg.hrc71
-rw-r--r--sw/source/ui/chrdlg/paradlg.src165
-rw-r--r--sw/source/ui/chrdlg/pardlg.cxx269
-rw-r--r--sw/source/ui/chrdlg/swbreak.src178
-rw-r--r--sw/source/ui/chrdlg/swuiccoll.cxx357
-rw-r--r--sw/source/ui/chrdlg/tblnumfm.cxx76
-rw-r--r--sw/source/ui/config/barcfg.cxx152
-rw-r--r--sw/source/ui/config/caption.cxx182
-rw-r--r--sw/source/ui/config/cfgitems.cxx460
-rw-r--r--sw/source/ui/config/config.hrc67
-rw-r--r--sw/source/ui/config/dbconfig.cxx143
-rw-r--r--sw/source/ui/config/fontcfg.cxx359
-rw-r--r--sw/source/ui/config/mailconfigpage.cxx622
-rw-r--r--sw/source/ui/config/mailconfigpage.hrc83
-rw-r--r--sw/source/ui/config/mailconfigpage.src443
-rw-r--r--sw/source/ui/config/modcfg.cxx1392
-rw-r--r--sw/source/ui/config/optcomp.cxx628
-rw-r--r--sw/source/ui/config/optcomp.hrc56
-rw-r--r--sw/source/ui/config/optcomp.src143
-rw-r--r--sw/source/ui/config/optdlg.hrc208
-rw-r--r--sw/source/ui/config/optdlg.src1074
-rw-r--r--sw/source/ui/config/optload.cxx977
-rw-r--r--sw/source/ui/config/optload.hrc82
-rw-r--r--sw/source/ui/config/optload.src417
-rw-r--r--sw/source/ui/config/optpage.cxx2610
-rw-r--r--sw/source/ui/config/prtopt.cxx197
-rw-r--r--sw/source/ui/config/redlopt.hrc54
-rw-r--r--sw/source/ui/config/redlopt.src287
-rw-r--r--sw/source/ui/config/uinums.cxx673
-rw-r--r--sw/source/ui/config/usrpref.cxx663
-rw-r--r--sw/source/ui/config/viewopt.cxx643
-rw-r--r--sw/source/ui/dbui/addresslistdialog.cxx752
-rw-r--r--sw/source/ui/dbui/addresslistdialog.hrc48
-rw-r--r--sw/source/ui/dbui/addresslistdialog.hxx122
-rw-r--r--sw/source/ui/dbui/addresslistdialog.src131
-rw-r--r--sw/source/ui/dbui/createaddresslistdialog.cxx835
-rw-r--r--sw/source/ui/dbui/createaddresslistdialog.hrc64
-rw-r--r--sw/source/ui/dbui/createaddresslistdialog.hxx130
-rw-r--r--sw/source/ui/dbui/createaddresslistdialog.src238
-rw-r--r--sw/source/ui/dbui/customizeaddresslistdialog.cxx274
-rw-r--r--sw/source/ui/dbui/customizeaddresslistdialog.hrc49
-rw-r--r--sw/source/ui/dbui/customizeaddresslistdialog.hxx99
-rw-r--r--sw/source/ui/dbui/customizeaddresslistdialog.src169
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx1945
-rw-r--r--sw/source/ui/dbui/dbinsdlg.hrc73
-rw-r--r--sw/source/ui/dbui/dbinsdlg.src330
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx3109
-rw-r--r--sw/source/ui/dbui/dbtablepreviewdialog.cxx144
-rw-r--r--sw/source/ui/dbui/dbtablepreviewdialog.hrc35
-rw-r--r--sw/source/ui/dbui/dbtablepreviewdialog.hxx60
-rw-r--r--sw/source/ui/dbui/dbtablepreviewdialog.src61
-rw-r--r--sw/source/ui/dbui/dbtree.cxx622
-rw-r--r--sw/source/ui/dbui/dbui.cxx151
-rw-r--r--sw/source/ui/dbui/dbui.src284
-rw-r--r--sw/source/ui/dbui/maildispatcher.cxx296
-rw-r--r--sw/source/ui/dbui/mailmergechildwindow.cxx796
-rw-r--r--sw/source/ui/dbui/mailmergechildwindow.hrc61
-rw-r--r--sw/source/ui/dbui/mailmergechildwindow.src279
-rw-r--r--sw/source/ui/dbui/mailmergehelper.cxx1047
-rw-r--r--sw/source/ui/dbui/mailmergewizard.cxx336
-rw-r--r--sw/source/ui/dbui/mailmergewizard.hrc37
-rw-r--r--sw/source/ui/dbui/mailmergewizard.src80
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx1846
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.hrc115
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.hxx332
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.src655
-rw-r--r--sw/source/ui/dbui/mmconfigitem.cxx1986
-rw-r--r--sw/source/ui/dbui/mmdocselectpage.cxx224
-rw-r--r--sw/source/ui/dbui/mmdocselectpage.hrc37
-rw-r--r--sw/source/ui/dbui/mmdocselectpage.hxx74
-rw-r--r--sw/source/ui/dbui/mmdocselectpage.src108
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.cxx619
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.hrc65
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.hxx176
-rw-r--r--sw/source/ui/dbui/mmgreetingspage.src261
-rw-r--r--sw/source/ui/dbui/mmlayoutpage.cxx816
-rw-r--r--sw/source/ui/dbui/mmlayoutpage.hrc48
-rw-r--r--sw/source/ui/dbui/mmlayoutpage.hxx114
-rw-r--r--sw/source/ui/dbui/mmlayoutpage.src165
-rw-r--r--sw/source/ui/dbui/mmmergepage.cxx123
-rw-r--r--sw/source/ui/dbui/mmmergepage.hrc43
-rw-r--r--sw/source/ui/dbui/mmmergepage.hxx73
-rw-r--r--sw/source/ui/dbui/mmmergepage.src107
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx1440
-rw-r--r--sw/source/ui/dbui/mmoutputpage.hrc103
-rw-r--r--sw/source/ui/dbui/mmoutputpage.hxx242
-rw-r--r--sw/source/ui/dbui/mmoutputpage.src490
-rw-r--r--sw/source/ui/dbui/mmoutputtypepage.cxx113
-rw-r--r--sw/source/ui/dbui/mmoutputtypepage.hrc44
-rw-r--r--sw/source/ui/dbui/mmoutputtypepage.hxx67
-rw-r--r--sw/source/ui/dbui/mmoutputtypepage.src101
-rw-r--r--sw/source/ui/dbui/mmpreparemergepage.cxx204
-rw-r--r--sw/source/ui/dbui/mmpreparemergepage.hrc46
-rw-r--r--sw/source/ui/dbui/mmpreparemergepage.hxx77
-rw-r--r--sw/source/ui/dbui/mmpreparemergepage.src132
-rw-r--r--sw/source/ui/dbui/selectdbtabledialog.cxx223
-rw-r--r--sw/source/ui/dbui/selectdbtabledialog.hrc43
-rw-r--r--sw/source/ui/dbui/selectdbtabledialog.hxx79
-rw-r--r--sw/source/ui/dbui/selectdbtabledialog.src99
-rw-r--r--sw/source/ui/dbui/swdbtoolsclient.cxx248
-rw-r--r--sw/source/ui/dialog/SwSpellDialogChildWindow.cxx934
-rw-r--r--sw/source/ui/dialog/abstract.cxx92
-rw-r--r--sw/source/ui/dialog/abstract.hrc36
-rw-r--r--sw/source/ui/dialog/abstract.src155
-rw-r--r--sw/source/ui/dialog/addrdlg.cxx69
-rw-r--r--sw/source/ui/dialog/ascfldlg.cxx462
-rw-r--r--sw/source/ui/dialog/ascfldlg.hrc44
-rw-r--r--sw/source/ui/dialog/ascfldlg.src183
-rw-r--r--sw/source/ui/dialog/dialog.src62
-rw-r--r--sw/source/ui/dialog/docstdlg.cxx197
-rw-r--r--sw/source/ui/dialog/docstdlg.hrc47
-rw-r--r--sw/source/ui/dialog/docstdlg.src184
-rw-r--r--sw/source/ui/dialog/macassgn.cxx163
-rw-r--r--sw/source/ui/dialog/regionsw.cxx264
-rw-r--r--sw/source/ui/dialog/regionsw.hrc116
-rw-r--r--sw/source/ui/dialog/regionsw.src899
-rw-r--r--sw/source/ui/dialog/swabstdlg.cxx52
-rw-r--r--sw/source/ui/dialog/swdialmgr.cxx54
-rw-r--r--sw/source/ui/dialog/swdlgfact.cxx1742
-rw-r--r--sw/source/ui/dialog/swdlgfact.hxx584
-rw-r--r--sw/source/ui/dialog/swuiexp.cxx55
-rw-r--r--sw/source/ui/dialog/swwrtshitem.cxx51
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx2457
-rw-r--r--sw/source/ui/dialog/wordcountdialog.cxx99
-rw-r--r--sw/source/ui/dialog/wordcountdialog.hrc43
-rw-r--r--sw/source/ui/dialog/wordcountdialog.src115
-rwxr-xr-xsw/source/ui/dochdl/dochdl.src76
-rwxr-xr-xsw/source/ui/dochdl/gloshdl.cxx898
-rw-r--r--sw/source/ui/dochdl/selglos.cxx77
-rw-r--r--sw/source/ui/dochdl/selglos.hrc31
-rw-r--r--sw/source/ui/dochdl/selglos.src112
-rw-r--r--sw/source/ui/dochdl/swdtflvr.cxx3866
-rw-r--r--sw/source/ui/docvw/AnchorOverlayObject.cxx467
-rw-r--r--sw/source/ui/docvw/AnchorOverlayObject.hxx143
-rw-r--r--sw/source/ui/docvw/AnnotationMenuButton.cxx215
-rw-r--r--sw/source/ui/docvw/AnnotationMenuButton.hxx63
-rw-r--r--sw/source/ui/docvw/AnnotationWin.cxx296
-rw-r--r--sw/source/ui/docvw/PostItMgr.cxx2045
-rw-r--r--sw/source/ui/docvw/ShadowOverlayObject.cxx268
-rw-r--r--sw/source/ui/docvw/ShadowOverlayObject.hxx80
-rw-r--r--sw/source/ui/docvw/SidebarTxtControl.cxx427
-rw-r--r--sw/source/ui/docvw/SidebarTxtControl.hxx87
-rw-r--r--sw/source/ui/docvw/SidebarTxtControlAcc.cxx317
-rw-r--r--sw/source/ui/docvw/SidebarTxtControlAcc.hxx56
-rw-r--r--sw/source/ui/docvw/SidebarWin.cxx1392
-rw-r--r--sw/source/ui/docvw/SidebarWinAcc.cxx162
-rw-r--r--sw/source/ui/docvw/SidebarWinAcc.hxx67
-rw-r--r--sw/source/ui/docvw/access.src102
-rw-r--r--sw/source/ui/docvw/annotation.hrc54
-rw-r--r--sw/source/ui/docvw/annotation.src68
-rw-r--r--sw/source/ui/docvw/docvw.hrc93
-rw-r--r--sw/source/ui/docvw/docvw.src296
-rw-r--r--sw/source/ui/docvw/edtdd.cxx527
-rw-r--r--sw/source/ui/docvw/edtwin.cxx5799
-rw-r--r--sw/source/ui/docvw/edtwin2.cxx592
-rw-r--r--sw/source/ui/docvw/edtwin3.cxx216
-rw-r--r--sw/source/ui/docvw/frmsidebarwincontainer.cxx216
-rw-r--r--sw/source/ui/docvw/frmsidebarwincontainer.hxx73
-rw-r--r--sw/source/ui/docvw/romenu.cxx523
-rw-r--r--sw/source/ui/docvw/romenu.hxx75
-rw-r--r--sw/source/ui/docvw/srcedtw.cxx1099
-rw-r--r--sw/source/ui/envelp/envelp.src87
-rw-r--r--sw/source/ui/envelp/envfmt.cxx635
-rw-r--r--sw/source/ui/envelp/envfmt.hrc82
-rw-r--r--sw/source/ui/envelp/envfmt.hxx112
-rw-r--r--sw/source/ui/envelp/envfmt.src324
-rw-r--r--sw/source/ui/envelp/envimg.cxx381
-rw-r--r--sw/source/ui/envelp/envlop.hrc65
-rw-r--r--sw/source/ui/envelp/envlop.src213
-rw-r--r--sw/source/ui/envelp/envlop1.cxx441
-rw-r--r--sw/source/ui/envelp/envprt.cxx259
-rw-r--r--sw/source/ui/envelp/envprt.hrc96
-rw-r--r--sw/source/ui/envelp/envprt.hxx93
-rw-r--r--sw/source/ui/envelp/envprt.src297
-rw-r--r--sw/source/ui/envelp/label.hrc128
-rw-r--r--sw/source/ui/envelp/label.src758
-rw-r--r--sw/source/ui/envelp/label1.cxx1111
-rw-r--r--sw/source/ui/envelp/labelcfg.cxx302
-rw-r--r--sw/source/ui/envelp/labelexp.cxx281
-rw-r--r--sw/source/ui/envelp/labfmt.cxx712
-rw-r--r--sw/source/ui/envelp/labfmt.hrc89
-rw-r--r--sw/source/ui/envelp/labfmt.hxx175
-rw-r--r--sw/source/ui/envelp/labfmt.src370
-rw-r--r--sw/source/ui/envelp/labimg.cxx482
-rw-r--r--sw/source/ui/envelp/labimp.hxx118
-rw-r--r--sw/source/ui/envelp/labprt.cxx242
-rw-r--r--sw/source/ui/envelp/labprt.hrc59
-rw-r--r--sw/source/ui/envelp/labprt.hxx86
-rw-r--r--sw/source/ui/envelp/labprt.src157
-rw-r--r--sw/source/ui/envelp/mailmrge.cxx938
-rw-r--r--sw/source/ui/envelp/mailmrge.hrc92
-rw-r--r--sw/source/ui/envelp/mailmrge.src455
-rw-r--r--sw/source/ui/envelp/swuilabimp.hxx254
-rw-r--r--sw/source/ui/envelp/syncbtn.cxx112
-rw-r--r--sw/source/ui/fldui/DropDownFieldDialog.cxx139
-rw-r--r--sw/source/ui/fldui/DropDownFieldDialog.hrc37
-rw-r--r--sw/source/ui/fldui/DropDownFieldDialog.src125
-rw-r--r--sw/source/ui/fldui/FldRefTreeListBox.cxx81
-rw-r--r--sw/source/ui/fldui/FldRefTreeListBox.hxx44
-rw-r--r--sw/source/ui/fldui/changedb.cxx363
-rw-r--r--sw/source/ui/fldui/changedb.hrc62
-rw-r--r--sw/source/ui/fldui/changedb.src130
-rw-r--r--sw/source/ui/fldui/flddb.cxx583
-rw-r--r--sw/source/ui/fldui/flddb.hxx106
-rw-r--r--sw/source/ui/fldui/flddb.src206
-rw-r--r--sw/source/ui/fldui/flddinf.cxx537
-rw-r--r--sw/source/ui/fldui/flddinf.hxx89
-rw-r--r--sw/source/ui/fldui/flddinf.src141
-rw-r--r--sw/source/ui/fldui/flddok.cxx731
-rw-r--r--sw/source/ui/fldui/flddok.hxx95
-rw-r--r--sw/source/ui/fldui/flddok.src203
-rw-r--r--sw/source/ui/fldui/fldedt.cxx422
-rw-r--r--sw/source/ui/fldui/fldfunc.cxx744
-rw-r--r--sw/source/ui/fldui/fldfunc.hxx113
-rw-r--r--sw/source/ui/fldui/fldfunc.src284
-rw-r--r--sw/source/ui/fldui/fldmgr.cxx1793
-rw-r--r--sw/source/ui/fldui/fldpage.cxx421
-rw-r--r--sw/source/ui/fldui/fldpage.hxx107
-rw-r--r--sw/source/ui/fldui/fldref.cxx1073
-rw-r--r--sw/source/ui/fldui/fldref.hxx114
-rw-r--r--sw/source/ui/fldui/fldref.src150
-rw-r--r--sw/source/ui/fldui/fldtdlg.cxx386
-rw-r--r--sw/source/ui/fldui/fldtdlg.hrc171
-rw-r--r--sw/source/ui/fldui/fldtdlg.src118
-rw-r--r--sw/source/ui/fldui/fldui.src684
-rw-r--r--sw/source/ui/fldui/fldvar.cxx1383
-rw-r--r--sw/source/ui/fldui/fldvar.hxx126
-rw-r--r--sw/source/ui/fldui/fldvar.src245
-rw-r--r--sw/source/ui/fldui/fldwrap.cxx212
-rw-r--r--sw/source/ui/fldui/inpdlg.cxx201
-rw-r--r--sw/source/ui/fldui/inpdlg.hrc34
-rw-r--r--sw/source/ui/fldui/inpdlg.src134
-rw-r--r--sw/source/ui/fldui/javaedit.cxx366
-rw-r--r--sw/source/ui/fldui/javaedit.hrc51
-rw-r--r--sw/source/ui/fldui/javaedit.src181
-rw-r--r--sw/source/ui/fldui/xfldui.cxx184
-rw-r--r--sw/source/ui/fmtui/tmpdlg.cxx647
-rw-r--r--sw/source/ui/fmtui/tmpdlg.src380
-rw-r--r--sw/source/ui/frmdlg/colex.cxx610
-rw-r--r--sw/source/ui/frmdlg/colmgr.cxx191
-rw-r--r--sw/source/ui/frmdlg/column.cxx1463
-rw-r--r--sw/source/ui/frmdlg/column.hrc87
-rw-r--r--sw/source/ui/frmdlg/column.src419
-rw-r--r--sw/source/ui/frmdlg/cption.cxx652
-rw-r--r--sw/source/ui/frmdlg/cption.hrc78
-rw-r--r--sw/source/ui/frmdlg/cption.src342
-rw-r--r--sw/source/ui/frmdlg/frmdlg.cxx221
-rw-r--r--sw/source/ui/frmdlg/frmmgr.cxx623
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx3277
-rw-r--r--sw/source/ui/frmdlg/frmpage.hrc146
-rw-r--r--sw/source/ui/frmdlg/frmpage.src884
-rw-r--r--sw/source/ui/frmdlg/frmui.src133
-rw-r--r--sw/source/ui/frmdlg/pattern.cxx75
-rw-r--r--sw/source/ui/frmdlg/pattern.hrc46
-rw-r--r--sw/source/ui/frmdlg/uiborder.cxx79
-rw-r--r--sw/source/ui/frmdlg/wrap.cxx785
-rw-r--r--sw/source/ui/frmdlg/wrap.hrc66
-rw-r--r--sw/source/ui/frmdlg/wrap.src271
-rw-r--r--sw/source/ui/globdoc/globdoc.cxx91
-rw-r--r--sw/source/ui/globdoc/globdoc.src45
-rw-r--r--sw/source/ui/inc/DropDownFieldDialog.hxx71
-rw-r--r--sw/source/ui/inc/SidebarWindowsConsts.hxx41
-rw-r--r--sw/source/ui/inc/SwSpellDialogChildWindow.hxx76
-rw-r--r--sw/source/ui/inc/SwXFilterOptions.hxx113
-rw-r--r--sw/source/ui/inc/abstract.hxx73
-rw-r--r--sw/source/ui/inc/actctrl.hxx98
-rw-r--r--sw/source/ui/inc/addrdlg.hxx44
-rwxr-xr-xsw/source/ui/inc/annotsh.hxx78
-rw-r--r--sw/source/ui/inc/app.hrc183
-rw-r--r--sw/source/ui/inc/ascfldlg.hxx78
-rw-r--r--sw/source/ui/inc/autoedit.hxx50
-rw-r--r--sw/source/ui/inc/barcfg.hxx47
-rw-r--r--sw/source/ui/inc/basesh.hxx127
-rw-r--r--sw/source/ui/inc/beziersh.hxx44
-rw-r--r--sw/source/ui/inc/bmpwin.hxx69
-rw-r--r--sw/source/ui/inc/bookctrl.hxx57
-rw-r--r--sw/source/ui/inc/bookmark.hxx88
-rw-r--r--sw/source/ui/inc/break.hxx92
-rw-r--r--sw/source/ui/inc/caption.hxx118
-rw-r--r--sw/source/ui/inc/cfgdesc.hxx69
-rw-r--r--sw/source/ui/inc/cfgid.h40
-rw-r--r--sw/source/ui/inc/cfgitems.hxx242
-rw-r--r--sw/source/ui/inc/changedb.hxx92
-rw-r--r--sw/source/ui/inc/chartins.hxx35
-rw-r--r--sw/source/ui/inc/chldwrap.hxx55
-rw-r--r--sw/source/ui/inc/chrdlg.hxx119
-rw-r--r--sw/source/ui/inc/cnttab.hxx90
-rw-r--r--sw/source/ui/inc/colex.hxx118
-rw-r--r--sw/source/ui/inc/colmgr.hxx131
-rw-r--r--sw/source/ui/inc/column.hxx227
-rw-r--r--sw/source/ui/inc/conarc.hxx57
-rw-r--r--sw/source/ui/inc/concustomshape.hxx72
-rw-r--r--sw/source/ui/inc/condedit.hxx72
-rw-r--r--sw/source/ui/inc/conform.hxx47
-rw-r--r--sw/source/ui/inc/conpoly.hxx55
-rw-r--r--sw/source/ui/inc/conrect.hxx60
-rw-r--r--sw/source/ui/inc/content.hxx225
-rw-r--r--sw/source/ui/inc/conttree.hxx334
-rw-r--r--sw/source/ui/inc/convert.hxx91
-rw-r--r--sw/source/ui/inc/cption.hxx137
-rw-r--r--sw/source/ui/inc/dbconfig.hxx54
-rw-r--r--sw/source/ui/inc/dbinsdlg.hxx188
-rw-r--r--sw/source/ui/inc/dbtree.hxx86
-rw-r--r--sw/source/ui/inc/dbui.hxx86
-rw-r--r--sw/source/ui/inc/dialmgr.hxx48
-rw-r--r--sw/source/ui/inc/docfnote.hxx50
-rw-r--r--sw/source/ui/inc/docstdlg.hxx85
-rw-r--r--sw/source/ui/inc/drawbase.hxx90
-rw-r--r--sw/source/ui/inc/drawsh.hxx52
-rw-r--r--sw/source/ui/inc/drformsh.hxx47
-rw-r--r--sw/source/ui/inc/drpcps.hxx125
-rw-r--r--sw/source/ui/inc/drwbassh.hxx64
-rw-r--r--sw/source/ui/inc/drwtxtsh.hxx86
-rw-r--r--sw/source/ui/inc/dselect.hxx52
-rw-r--r--sw/source/ui/inc/edtwin.hxx307
-rw-r--r--sw/source/ui/inc/envimg.hxx100
-rw-r--r--sw/source/ui/inc/envlop.hxx149
-rw-r--r--sw/source/ui/inc/fldedt.hxx66
-rw-r--r--sw/source/ui/inc/fldmgr.hxx234
-rw-r--r--sw/source/ui/inc/fldtdlg.hxx68
-rw-r--r--sw/source/ui/inc/fldwrap.hxx63
-rw-r--r--sw/source/ui/inc/fontcfg.hxx120
-rw-r--r--sw/source/ui/inc/formatclipboard.hxx69
-rw-r--r--sw/source/ui/inc/formedt.hxx108
-rw-r--r--sw/source/ui/inc/frmdlg.hxx67
-rw-r--r--sw/source/ui/inc/frmmgr.hxx193
-rw-r--r--sw/source/ui/inc/frmpage.hxx339
-rw-r--r--sw/source/ui/inc/frmsh.hxx50
-rw-r--r--sw/source/ui/inc/frmui.hrc144
-rw-r--r--sw/source/ui/inc/globals.h37
-rw-r--r--sw/source/ui/inc/globdoc.hrc64
-rw-r--r--sw/source/ui/inc/glosbib.hxx121
-rw-r--r--sw/source/ui/inc/glosdoc.hxx148
-rw-r--r--sw/source/ui/inc/gloshdl.hxx110
-rw-r--r--sw/source/ui/inc/gloslst.hxx89
-rw-r--r--sw/source/ui/inc/glossary.hxx197
-rw-r--r--sw/source/ui/inc/glshell.hxx114
-rw-r--r--sw/source/ui/inc/grfsh.hxx44
-rw-r--r--sw/source/ui/inc/hidfunc.h350
-rw-r--r--sw/source/ui/inc/hyp.hxx67
-rw-r--r--sw/source/ui/inc/idxmrk.hxx73
-rw-r--r--sw/source/ui/inc/imaildsplistener.hxx77
-rw-r--r--sw/source/ui/inc/initui.hxx79
-rw-r--r--sw/source/ui/inc/inpdlg.hxx78
-rw-r--r--sw/source/ui/inc/inputwin.hxx133
-rw-r--r--sw/source/ui/inc/insfnote.hxx97
-rw-r--r--sw/source/ui/inc/insrule.hxx66
-rw-r--r--sw/source/ui/inc/instable.hxx100
-rw-r--r--sw/source/ui/inc/javaedit.hxx118
-rw-r--r--sw/source/ui/inc/label.hxx99
-rw-r--r--sw/source/ui/inc/labelcfg.hxx59
-rw-r--r--sw/source/ui/inc/labimg.hxx131
-rwxr-xr-xsw/source/ui/inc/langhelper.hxx68
-rw-r--r--sw/source/ui/inc/linenum.hxx110
-rw-r--r--sw/source/ui/inc/listsh.hxx44
-rw-r--r--sw/source/ui/inc/macassgn.hxx54
-rw-r--r--sw/source/ui/inc/mailconfigpage.hxx110
-rw-r--r--sw/source/ui/inc/maildispatcher.hxx168
-rw-r--r--sw/source/ui/inc/mailmergechildwindow.hxx66
-rw-r--r--sw/source/ui/inc/mailmergehelper.hxx349
-rw-r--r--sw/source/ui/inc/mailmergewizard.hxx103
-rw-r--r--sw/source/ui/inc/mailmrge.hxx204
-rw-r--r--sw/source/ui/inc/mediash.hxx43
-rw-r--r--sw/source/ui/inc/mergetbl.hxx59
-rw-r--r--sw/source/ui/inc/misc.hrc106
-rw-r--r--sw/source/ui/inc/mmconfigitem.hxx279
-rw-r--r--sw/source/ui/inc/multmrk.hxx77
-rw-r--r--sw/source/ui/inc/navicfg.hxx119
-rw-r--r--sw/source/ui/inc/navicont.hxx61
-rw-r--r--sw/source/ui/inc/navipi.hxx198
-rw-r--r--sw/source/ui/inc/num.hxx205
-rw-r--r--sw/source/ui/inc/numberingtypelistbox.hxx58
-rw-r--r--sw/source/ui/inc/numfmtlb.hxx87
-rw-r--r--sw/source/ui/inc/numpara.hxx98
-rw-r--r--sw/source/ui/inc/numprevw.hxx71
-rw-r--r--sw/source/ui/inc/olesh.hxx48
-rw-r--r--sw/source/ui/inc/olmenu.hxx91
-rw-r--r--sw/source/ui/inc/optcomp.hxx87
-rw-r--r--sw/source/ui/inc/optload.hxx213
-rw-r--r--sw/source/ui/inc/optpage.hxx509
-rw-r--r--sw/source/ui/inc/outline.hxx166
-rw-r--r--sw/source/ui/inc/pardlg.hxx39
-rw-r--r--sw/source/ui/inc/pattern.hxx44
-rw-r--r--sw/source/ui/inc/pgfnote.hxx93
-rw-r--r--sw/source/ui/inc/pggrid.hxx113
-rw-r--r--sw/source/ui/inc/popbox.hxx67
-rw-r--r--sw/source/ui/inc/popup.hrc58
-rw-r--r--sw/source/ui/inc/prcntfld.hxx99
-rw-r--r--sw/source/ui/inc/pview.hxx336
-rw-r--r--sw/source/ui/inc/redlndlg.hxx189
-rw-r--r--sw/source/ui/inc/regionsw.hxx336
-rw-r--r--sw/source/ui/inc/ribbar.hrc132
-rw-r--r--sw/source/ui/inc/rowht.hxx67
-rw-r--r--sw/source/ui/inc/scroll.hxx71
-rw-r--r--sw/source/ui/inc/selglos.hxx74
-rw-r--r--sw/source/ui/inc/sharedconnection.hxx36
-rw-r--r--sw/source/ui/inc/shdwcrsr.hxx67
-rw-r--r--sw/source/ui/inc/shells.hrc112
-rw-r--r--sw/source/ui/inc/split.hxx76
-rw-r--r--sw/source/ui/inc/splittbl.hxx61
-rw-r--r--sw/source/ui/inc/srcedtw.hxx164
-rw-r--r--sw/source/ui/inc/srcview.hxx126
-rw-r--r--sw/source/ui/inc/srtdlg.hxx118
-rw-r--r--sw/source/ui/inc/stmenu.hxx85
-rw-r--r--sw/source/ui/inc/swcont.hxx113
-rw-r--r--sw/source/ui/inc/swdtflvr.hxx222
-rw-r--r--sw/source/ui/inc/swlbox.hxx124
-rw-r--r--sw/source/ui/inc/swmodalredlineacceptdlg.hxx48
-rw-r--r--sw/source/ui/inc/swrenamexnameddlg.hxx87
-rw-r--r--sw/source/ui/inc/swtablerep.hxx94
-rw-r--r--sw/source/ui/inc/swuiccoll.hxx89
-rw-r--r--sw/source/ui/inc/swuicnttab.hxx539
-rw-r--r--sw/source/ui/inc/swuiidxmrk.hxx295
-rw-r--r--sw/source/ui/inc/swuipardlg.hxx51
-rw-r--r--sw/source/ui/inc/swvset.hxx41
-rw-r--r--sw/source/ui/inc/swwrtshitem.hxx52
-rw-r--r--sw/source/ui/inc/syncbtn.hxx71
-rw-r--r--sw/source/ui/inc/table.hrc50
-rw-r--r--sw/source/ui/inc/tabledlg.hxx55
-rw-r--r--sw/source/ui/inc/tablemgr.hxx95
-rw-r--r--sw/source/ui/inc/tabsh.hxx58
-rw-r--r--sw/source/ui/inc/tautofmt.hxx118
-rw-r--r--sw/source/ui/inc/tblctrl.hxx57
-rw-r--r--sw/source/ui/inc/tblnumfm.hxx44
-rw-r--r--sw/source/ui/inc/tbxanchr.hxx49
-rw-r--r--sw/source/ui/inc/textcontrolcombo.hxx66
-rw-r--r--sw/source/ui/inc/textsh.hxx90
-rw-r--r--sw/source/ui/inc/tmpdlg.hxx66
-rw-r--r--sw/source/ui/inc/tmplctrl.hxx58
-rw-r--r--sw/source/ui/inc/toolbox.hrc563
-rw-r--r--sw/source/ui/inc/toxmgr.hxx324
-rw-r--r--sw/source/ui/inc/uiborder.hxx49
-rw-r--r--sw/source/ui/inc/uiitems.hxx116
-rw-r--r--sw/source/ui/inc/uinums.hxx136
-rw-r--r--sw/source/ui/inc/uitool.hxx92
-rw-r--r--sw/source/ui/inc/uivwimp.hxx188
-rw-r--r--sw/source/ui/inc/unodispatch.hxx134
-rw-r--r--sw/source/ui/inc/unotools.hxx135
-rw-r--r--sw/source/ui/inc/unotxvw.hxx274
-rw-r--r--sw/source/ui/inc/usrpref.hxx286
-rw-r--r--sw/source/ui/inc/utlui.hrc194
-rw-r--r--sw/source/ui/inc/view.hxx695
-rw-r--r--sw/source/ui/inc/viewlayoutctrl.hxx56
-rw-r--r--sw/source/ui/inc/web.hrc74
-rw-r--r--sw/source/ui/inc/wformsh.hxx45
-rw-r--r--sw/source/ui/inc/wfrmsh.hxx48
-rw-r--r--sw/source/ui/inc/wgrfsh.hxx45
-rw-r--r--sw/source/ui/inc/wlistsh.hxx42
-rw-r--r--sw/source/ui/inc/wolesh.hxx48
-rw-r--r--sw/source/ui/inc/wordcountdialog.hxx65
-rw-r--r--sw/source/ui/inc/workctrl.hxx225
-rw-r--r--sw/source/ui/inc/wrap.hxx151
-rw-r--r--sw/source/ui/inc/wrtsh.hxx650
-rw-r--r--sw/source/ui/inc/wtabsh.hxx42
-rw-r--r--sw/source/ui/inc/wtextsh.hxx48
-rw-r--r--sw/source/ui/inc/wview.hxx51
-rw-r--r--sw/source/ui/inc/zoomctrl.hxx52
-rw-r--r--sw/source/ui/index/cntex.cxx516
-rw-r--r--sw/source/ui/index/cnttab.cxx4525
-rw-r--r--sw/source/ui/index/cnttab.hrc284
-rw-r--r--sw/source/ui/index/cnttab.src1350
-rw-r--r--sw/source/ui/index/idxmrk.cxx153
-rw-r--r--sw/source/ui/index/idxmrk.hrc108
-rw-r--r--sw/source/ui/index/idxmrk.src636
-rw-r--r--sw/source/ui/index/multmrk.cxx98
-rw-r--r--sw/source/ui/index/multmrk.hrc34
-rw-r--r--sw/source/ui/index/multmrk.src119
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx1947
-rw-r--r--sw/source/ui/index/toxmgr.cxx529
-rw-r--r--sw/source/ui/lingu/cvdata.mac19
-rw-r--r--sw/source/ui/lingu/hhcwrp.cxx818
-rw-r--r--sw/source/ui/lingu/hyp.cxx176
-rw-r--r--sw/source/ui/lingu/olmenu.cxx937
-rw-r--r--sw/source/ui/lingu/olmenu.hrc97
-rw-r--r--sw/source/ui/lingu/olmenu.src137
-rw-r--r--sw/source/ui/lingu/sdrhhcwrap.cxx235
-rw-r--r--sw/source/ui/lingu/sdrhhcwrap.hxx69
-rw-r--r--sw/source/ui/misc/autocorr.src29
-rw-r--r--sw/source/ui/misc/bookmark.cxx304
-rw-r--r--sw/source/ui/misc/bookmark.hrc34
-rw-r--r--sw/source/ui/misc/bookmark.src118
-rw-r--r--sw/source/ui/misc/docfnote.cxx500
-rw-r--r--sw/source/ui/misc/docfnote.hrc60
-rw-r--r--sw/source/ui/misc/docfnote.src563
-rw-r--r--sw/source/ui/misc/glosbib.cxx580
-rw-r--r--sw/source/ui/misc/glosbib.hrc41
-rw-r--r--sw/source/ui/misc/glosbib.src183
-rw-r--r--sw/source/ui/misc/glosdoc.cxx806
-rw-r--r--sw/source/ui/misc/glossary.cxx1305
-rw-r--r--sw/source/ui/misc/glossary.hrc91
-rw-r--r--sw/source/ui/misc/glossary.src476
-rw-r--r--sw/source/ui/misc/glshell.cxx349
-rw-r--r--sw/source/ui/misc/impfnote.hxx120
-rw-r--r--sw/source/ui/misc/insfnote.cxx353
-rw-r--r--sw/source/ui/misc/insfnote.hrc41
-rw-r--r--sw/source/ui/misc/insfnote.src176
-rw-r--r--sw/source/ui/misc/insrule.cxx226
-rw-r--r--sw/source/ui/misc/insrule.hrc35
-rw-r--r--sw/source/ui/misc/insrule.src114
-rw-r--r--sw/source/ui/misc/linenum.cxx335
-rw-r--r--sw/source/ui/misc/linenum.hrc50
-rw-r--r--sw/source/ui/misc/linenum.src279
-rw-r--r--sw/source/ui/misc/num.cxx1173
-rw-r--r--sw/source/ui/misc/num.hrc55
-rw-r--r--sw/source/ui/misc/num.src374
-rw-r--r--sw/source/ui/misc/numberingtypelistbox.cxx177
-rw-r--r--sw/source/ui/misc/numberingtypelistbox.src98
-rw-r--r--sw/source/ui/misc/outline.cxx1343
-rw-r--r--sw/source/ui/misc/outline.hrc98
-rw-r--r--sw/source/ui/misc/outline.src383
-rw-r--r--sw/source/ui/misc/pgfnote.cxx373
-rw-r--r--sw/source/ui/misc/pgfnote.hrc44
-rw-r--r--sw/source/ui/misc/pgfnote.src200
-rw-r--r--sw/source/ui/misc/pggrid.cxx521
-rw-r--r--sw/source/ui/misc/pggrid.hrc52
-rw-r--r--sw/source/ui/misc/pggrid.src244
-rw-r--r--sw/source/ui/misc/redlndlg.cxx1405
-rw-r--r--sw/source/ui/misc/redlndlg.hrc38
-rw-r--r--sw/source/ui/misc/redlndlg.src148
-rw-r--r--sw/source/ui/misc/srtdlg.cxx492
-rw-r--r--sw/source/ui/misc/srtdlg.hrc65
-rw-r--r--sw/source/ui/misc/srtdlg.src407
-rw-r--r--sw/source/ui/misc/swmodalredlineacceptdlg.cxx147
-rw-r--r--sw/source/ui/ribbar/conarc.cxx161
-rw-r--r--sw/source/ui/ribbar/concustomshape.cxx252
-rw-r--r--sw/source/ui/ribbar/conform.cxx144
-rw-r--r--sw/source/ui/ribbar/conpoly.cxx163
-rw-r--r--sw/source/ui/ribbar/conrect.cxx229
-rw-r--r--sw/source/ui/ribbar/drawbase.cxx740
-rw-r--r--sw/source/ui/ribbar/dselect.cxx102
-rwxr-xr-xsw/source/ui/ribbar/inputwin.cxx678
-rw-r--r--sw/source/ui/ribbar/inputwin.hrc84
-rw-r--r--sw/source/ui/ribbar/inputwin.src345
-rw-r--r--sw/source/ui/ribbar/tblctrl.cxx93
-rw-r--r--sw/source/ui/ribbar/tblctrl.hrc35
-rw-r--r--sw/source/ui/ribbar/tbxanchr.cxx166
-rw-r--r--sw/source/ui/ribbar/tbxanchr.src107
-rw-r--r--sw/source/ui/ribbar/workctrl.cxx943
-rw-r--r--sw/source/ui/ribbar/workctrl.hrc88
-rw-r--r--sw/source/ui/ribbar/workctrl.src467
-rwxr-xr-xsw/source/ui/shells/annotsh.cxx1682
-rw-r--r--sw/source/ui/shells/basesh.cxx2937
-rw-r--r--sw/source/ui/shells/beziersh.cxx356
-rw-r--r--sw/source/ui/shells/drawdlg.cxx259
-rw-r--r--sw/source/ui/shells/drawsh.cxx497
-rw-r--r--sw/source/ui/shells/drformsh.cxx276
-rw-r--r--sw/source/ui/shells/drwbassh.cxx995
-rw-r--r--sw/source/ui/shells/drwtxtex.cxx1012
-rw-r--r--sw/source/ui/shells/drwtxtsh.cxx912
-rw-r--r--sw/source/ui/shells/frmsh.cxx1155
-rw-r--r--sw/source/ui/shells/grfsh.cxx707
-rw-r--r--sw/source/ui/shells/grfshex.cxx150
-rwxr-xr-xsw/source/ui/shells/langhelper.cxx610
-rw-r--r--sw/source/ui/shells/listsh.cxx295
-rw-r--r--sw/source/ui/shells/mediash.cxx222
-rw-r--r--sw/source/ui/shells/olesh.cxx80
-rw-r--r--sw/source/ui/shells/shells.src305
-rw-r--r--sw/source/ui/shells/slotadd.cxx150
-rw-r--r--sw/source/ui/shells/tabsh.cxx1598
-rw-r--r--sw/source/ui/shells/textdrw.cxx143
-rw-r--r--sw/source/ui/shells/textfld.cxx894
-rw-r--r--sw/source/ui/shells/textglos.cxx145
-rw-r--r--sw/source/ui/shells/textidx.cxx261
-rw-r--r--sw/source/ui/shells/textsh.cxx1222
-rw-r--r--sw/source/ui/shells/textsh1.cxx1790
-rw-r--r--sw/source/ui/shells/textsh2.cxx312
-rw-r--r--sw/source/ui/shells/txtattr.cxx847
-rw-r--r--sw/source/ui/shells/txtcrsr.cxx370
-rw-r--r--sw/source/ui/shells/txtnum.cxx251
-rw-r--r--sw/source/ui/smartmenu/stmenu.cxx186
-rw-r--r--sw/source/ui/smartmenu/stmenu.hrc41
-rw-r--r--sw/source/ui/smartmenu/stmenu.src44
-rw-r--r--sw/source/ui/table/chartins.cxx285
-rw-r--r--sw/source/ui/table/chartins.hrc47
-rw-r--r--sw/source/ui/table/chartins.src130
-rw-r--r--sw/source/ui/table/colwd.cxx123
-rw-r--r--sw/source/ui/table/colwd.hrc36
-rw-r--r--sw/source/ui/table/colwd.src146
-rw-r--r--sw/source/ui/table/convert.cxx279
-rw-r--r--sw/source/ui/table/convert.hrc47
-rw-r--r--sw/source/ui/table/convert.src197
-rw-r--r--sw/source/ui/table/instable.cxx253
-rw-r--r--sw/source/ui/table/instable.hrc49
-rw-r--r--sw/source/ui/table/instable.src199
-rw-r--r--sw/source/ui/table/mergetbl.cxx66
-rw-r--r--sw/source/ui/table/mergetbl.hrc32
-rw-r--r--sw/source/ui/table/mergetbl.src118
-rw-r--r--sw/source/ui/table/rowht.cxx120
-rw-r--r--sw/source/ui/table/rowht.hrc34
-rw-r--r--sw/source/ui/table/rowht.src123
-rw-r--r--sw/source/ui/table/splittbl.cxx79
-rw-r--r--sw/source/ui/table/splittbl.hrc34
-rw-r--r--sw/source/ui/table/splittbl.src129
-rw-r--r--sw/source/ui/table/swtablerep.cxx241
-rw-r--r--sw/source/ui/table/table.src59
-rw-r--r--sw/source/ui/table/tabledlg.cxx1981
-rw-r--r--sw/source/ui/table/tabledlg.hrc110
-rw-r--r--sw/source/ui/table/tabledlg.src789
-rw-r--r--sw/source/ui/table/tablemgr.cxx382
-rw-r--r--sw/source/ui/table/tablepg.hxx239
-rw-r--r--sw/source/ui/table/tautofmt.cxx1057
-rw-r--r--sw/source/ui/table/tautofmt.hrc78
-rw-r--r--sw/source/ui/table/tautofmt.src307
-rw-r--r--sw/source/ui/uiview/formatclipboard.cxx617
-rw-r--r--sw/source/ui/uiview/pview.cxx2199
-rw-r--r--sw/source/ui/uiview/pview.hrc72
-rw-r--r--sw/source/ui/uiview/pview.src111
-rw-r--r--sw/source/ui/uiview/scroll.cxx160
-rw-r--r--sw/source/ui/uiview/srcview.cxx959
-rw-r--r--sw/source/ui/uiview/swcli.cxx187
-rw-r--r--sw/source/ui/uiview/uivwimp.cxx345
-rw-r--r--sw/source/ui/uiview/view.cxx1933
-rw-r--r--sw/source/ui/uiview/view.hrc90
-rw-r--r--sw/source/ui/uiview/view.src222
-rw-r--r--sw/source/ui/uiview/view0.cxx561
-rw-r--r--sw/source/ui/uiview/view1.cxx219
-rw-r--r--sw/source/ui/uiview/view2.cxx2455
-rw-r--r--sw/source/ui/uiview/viewcoll.cxx98
-rw-r--r--sw/source/ui/uiview/viewdlg.cxx98
-rw-r--r--sw/source/ui/uiview/viewdlg2.cxx241
-rw-r--r--sw/source/ui/uiview/viewdraw.cxx849
-rw-r--r--sw/source/ui/uiview/viewfunc.hxx66
-rwxr-xr-xsw/source/ui/uiview/viewling.cxx1005
-rw-r--r--sw/source/ui/uiview/viewmdi.cxx754
-rw-r--r--sw/source/ui/uiview/viewport.cxx1384
-rw-r--r--sw/source/ui/uiview/viewprt.cxx333
-rw-r--r--sw/source/ui/uiview/viewsrch.cxx808
-rw-r--r--sw/source/ui/uiview/viewstat.cxx523
-rw-r--r--sw/source/ui/uiview/viewtab.cxx1848
-rw-r--r--sw/source/ui/uno/RefreshListenerContainer.cxx58
-rw-r--r--sw/source/ui/uno/SwXDocumentSettings.cxx1076
-rw-r--r--sw/source/ui/uno/SwXDocumentSettings.hxx109
-rw-r--r--sw/source/ui/uno/SwXFilterOptions.cxx217
-rw-r--r--sw/source/ui/uno/detreg.cxx85
-rw-r--r--sw/source/ui/uno/dlelstnr.cxx204
-rw-r--r--sw/source/ui/uno/swdet2.cxx122
-rw-r--r--sw/source/ui/uno/swdetect.cxx488
-rw-r--r--sw/source/ui/uno/swdetect.hxx95
-rw-r--r--sw/source/ui/uno/unoatxt.cxx1308
-rw-r--r--sw/source/ui/uno/unodefaults.cxx72
-rw-r--r--sw/source/ui/uno/unodefaults.hxx48
-rw-r--r--sw/source/ui/uno/unodispatch.cxx448
-rw-r--r--sw/source/ui/uno/unodoc.cxx128
-rw-r--r--sw/source/ui/uno/unofreg.cxx383
-rw-r--r--sw/source/ui/uno/unomailmerge.cxx1253
-rw-r--r--sw/source/ui/uno/unomod.cxx1043
-rw-r--r--sw/source/ui/uno/unomodule.cxx172
-rw-r--r--sw/source/ui/uno/unomodule.hxx98
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx4171
-rw-r--r--sw/source/ui/uno/unotxvw.cxx2209
-rw-r--r--sw/source/ui/utlui/attrdesc.cxx1350
-rw-r--r--sw/source/ui/utlui/attrdesc.hrc123
-rw-r--r--sw/source/ui/utlui/attrdesc.src384
-rw-r--r--sw/source/ui/utlui/bookctrl.cxx164
-rw-r--r--sw/source/ui/utlui/condedit.cxx108
-rw-r--r--sw/source/ui/utlui/content.cxx3250
-rw-r--r--sw/source/ui/utlui/glbltree.cxx1523
-rw-r--r--sw/source/ui/utlui/gloslst.cxx514
-rw-r--r--sw/source/ui/utlui/gloslst.hrc38
-rw-r--r--sw/source/ui/utlui/gloslst.src109
-rw-r--r--sw/source/ui/utlui/initui.cxx307
-rw-r--r--sw/source/ui/utlui/initui.hrc66
-rw-r--r--sw/source/ui/utlui/initui.src519
-rw-r--r--sw/source/ui/utlui/navicfg.cxx141
-rw-r--r--sw/source/ui/utlui/navipi.cxx1552
-rw-r--r--sw/source/ui/utlui/navipi.hrc91
-rw-r--r--sw/source/ui/utlui/navipi.src536
-rw-r--r--sw/source/ui/utlui/numfmtlb.cxx549
-rw-r--r--sw/source/ui/utlui/poolfmt.src745
-rw-r--r--sw/source/ui/utlui/prcntfld.cxx370
-rw-r--r--sw/source/ui/utlui/shdwcrsr.cxx135
-rw-r--r--sw/source/ui/utlui/swrenamexnameddlg.cxx143
-rw-r--r--sw/source/ui/utlui/textcontrolcombo.cxx113
-rw-r--r--sw/source/ui/utlui/tmplctrl.cxx174
-rw-r--r--sw/source/ui/utlui/uiitems.cxx324
-rw-r--r--sw/source/ui/utlui/uitool.cxx775
-rw-r--r--sw/source/ui/utlui/unotools.cxx522
-rw-r--r--sw/source/ui/utlui/unotools.hrc41
-rw-r--r--sw/source/ui/utlui/unotools.src131
-rw-r--r--sw/source/ui/utlui/utlui.src478
-rw-r--r--sw/source/ui/utlui/viewlayoutctrl.cxx209
-rw-r--r--sw/source/ui/utlui/zoomctrl.cxx99
-rw-r--r--sw/source/ui/vba/service.cxx80
-rw-r--r--sw/source/ui/vba/vbaaddin.cxx104
-rw-r--r--sw/source/ui/vba/vbaaddin.hxx59
-rw-r--r--sw/source/ui/vba/vbaaddins.cxx107
-rw-r--r--sw/source/ui/vba/vbaaddins.hxx52
-rw-r--r--sw/source/ui/vba/vbaapplication.cxx203
-rw-r--r--sw/source/ui/vba/vbaapplication.hxx74
-rw-r--r--sw/source/ui/vba/vbaautotextentry.cxx126
-rw-r--r--sw/source/ui/vba/vbaautotextentry.hxx80
-rw-r--r--sw/source/ui/vba/vbabookmark.cxx109
-rw-r--r--sw/source/ui/vba/vbabookmark.hxx65
-rw-r--r--sw/source/ui/vba/vbabookmarks.cxx236
-rw-r--r--sw/source/ui/vba/vbabookmarks.hxx75
-rw-r--r--sw/source/ui/vba/vbaborders.cxx378
-rw-r--r--sw/source/ui/vba/vbaborders.hxx63
-rw-r--r--sw/source/ui/vba/vbadialog.cxx78
-rw-r--r--sw/source/ui/vba/vbadialog.hxx50
-rw-r--r--sw/source/ui/vba/vbadialogs.cxx61
-rw-r--r--sw/source/ui/vba/vbadialogs.hxx53
-rw-r--r--sw/source/ui/vba/vbadocument.cxx381
-rw-r--r--sw/source/ui/vba/vbadocument.hxx80
-rw-r--r--sw/source/ui/vba/vbadocumentproperties.cxx764
-rw-r--r--sw/source/ui/vba/vbadocumentproperties.hxx67
-rw-r--r--sw/source/ui/vba/vbadocuments.cxx178
-rw-r--r--sw/source/ui/vba/vbadocuments.hxx61
-rwxr-xr-xsw/source/ui/vba/vbaeventshelper.cxx103
-rwxr-xr-xsw/source/ui/vba/vbaeventshelper.hxx53
-rw-r--r--sw/source/ui/vba/vbafield.cxx478
-rw-r--r--sw/source/ui/vba/vbafield.hxx77
-rw-r--r--sw/source/ui/vba/vbafind.cxx428
-rw-r--r--sw/source/ui/vba/vbafind.hxx103
-rw-r--r--sw/source/ui/vba/vbafont.cxx216
-rw-r--r--sw/source/ui/vba/vbafont.hxx31
-rw-r--r--sw/source/ui/vba/vbaglobals.cxx193
-rw-r--r--sw/source/ui/vba/vbaglobals.hxx80
-rw-r--r--sw/source/ui/vba/vbaheaderfooter.cxx111
-rw-r--r--sw/source/ui/vba/vbaheaderfooter.hxx60
-rw-r--r--sw/source/ui/vba/vbaheaderfooterhelper.cxx176
-rw-r--r--sw/source/ui/vba/vbaheaderfooterhelper.hxx51
-rw-r--r--sw/source/ui/vba/vbainformationhelper.cxx68
-rw-r--r--sw/source/ui/vba/vbainformationhelper.hxx43
-rw-r--r--sw/source/ui/vba/vbaoptions.cxx284
-rw-r--r--sw/source/ui/vba/vbaoptions.hxx87
-rw-r--r--sw/source/ui/vba/vbapagesetup.cxx272
-rw-r--r--sw/source/ui/vba/vbapagesetup.hxx67
-rw-r--r--sw/source/ui/vba/vbapalette.cxx75
-rw-r--r--sw/source/ui/vba/vbapalette.hxx15
-rw-r--r--sw/source/ui/vba/vbapane.cxx76
-rw-r--r--sw/source/ui/vba/vbapane.hxx54
-rw-r--r--sw/source/ui/vba/vbapanes.cxx124
-rw-r--r--sw/source/ui/vba/vbapanes.hxx57
-rw-r--r--sw/source/ui/vba/vbaparagraph.cxx174
-rw-r--r--sw/source/ui/vba/vbaparagraph.hxx81
-rw-r--r--sw/source/ui/vba/vbaparagraphformat.cxx573
-rw-r--r--sw/source/ui/vba/vbaparagraphformat.hxx95
-rw-r--r--sw/source/ui/vba/vbarange.cxx345
-rw-r--r--sw/source/ui/vba/vbarange.hxx92
-rw-r--r--sw/source/ui/vba/vbarangehelper.cxx171
-rw-r--r--sw/source/ui/vba/vbarangehelper.hxx43
-rw-r--r--sw/source/ui/vba/vbareplacement.cxx71
-rw-r--r--sw/source/ui/vba/vbareplacement.hxx54
-rw-r--r--sw/source/ui/vba/vbasection.cxx87
-rw-r--r--sw/source/ui/vba/vbasection.hxx59
-rw-r--r--sw/source/ui/vba/vbasections.cxx186
-rw-r--r--sw/source/ui/vba/vbasections.hxx59
-rw-r--r--sw/source/ui/vba/vbaselection.cxx679
-rw-r--r--sw/source/ui/vba/vbaselection.hxx105
-rw-r--r--sw/source/ui/vba/vbastyle.cxx149
-rw-r--r--sw/source/ui/vba/vbastyle.hxx67
-rw-r--r--sw/source/ui/vba/vbastyles.cxx377
-rw-r--r--sw/source/ui/vba/vbastyles.hxx51
-rw-r--r--sw/source/ui/vba/vbasystem.cxx187
-rw-r--r--sw/source/ui/vba/vbasystem.hxx71
-rw-r--r--sw/source/ui/vba/vbatable.cxx97
-rw-r--r--sw/source/ui/vba/vbatable.hxx28
-rw-r--r--sw/source/ui/vba/vbatables.cxx131
-rw-r--r--sw/source/ui/vba/vbatables.hxx28
-rw-r--r--sw/source/ui/vba/vbatemplate.cxx103
-rw-r--r--sw/source/ui/vba/vbatemplate.hxx52
-rw-r--r--sw/source/ui/vba/vbavariable.cxx105
-rw-r--r--sw/source/ui/vba/vbavariable.hxx59
-rw-r--r--sw/source/ui/vba/vbavariables.cxx102
-rw-r--r--sw/source/ui/vba/vbavariables.hxx61
-rw-r--r--sw/source/ui/vba/vbaview.cxx422
-rw-r--r--sw/source/ui/vba/vbaview.hxx68
-rw-r--r--sw/source/ui/vba/vbawindow.cxx108
-rw-r--r--sw/source/ui/vba/vbawindow.hxx57
-rw-r--r--sw/source/ui/vba/vbawrapformat.cxx252
-rw-r--r--sw/source/ui/vba/vbawrapformat.hxx69
-rw-r--r--sw/source/ui/vba/wordvbahelper.cxx92
-rw-r--r--sw/source/ui/vba/wordvbahelper.hxx54
-rw-r--r--sw/source/ui/web/wdocsh.cxx114
-rw-r--r--sw/source/ui/web/web.src83
-rw-r--r--sw/source/ui/web/wformsh.cxx71
-rw-r--r--sw/source/ui/web/wfrmsh.cxx95
-rw-r--r--sw/source/ui/web/wgrfsh.cxx74
-rw-r--r--sw/source/ui/web/wlistsh.cxx67
-rw-r--r--sw/source/ui/web/wolesh.cxx68
-rw-r--r--sw/source/ui/web/wtabsh.cxx76
-rw-r--r--sw/source/ui/web/wtextsh.cxx99
-rw-r--r--sw/source/ui/web/wview.cxx336
-rw-r--r--sw/source/ui/wrtsh/delete.cxx570
-rw-r--r--sw/source/ui/wrtsh/move.cxx691
-rw-r--r--sw/source/ui/wrtsh/select.cxx1072
-rw-r--r--sw/source/ui/wrtsh/wrtsh.hrc48
-rw-r--r--sw/source/ui/wrtsh/wrtsh.src52
-rw-r--r--sw/source/ui/wrtsh/wrtsh1.cxx1897
-rw-r--r--sw/source/ui/wrtsh/wrtsh2.cxx498
-rw-r--r--sw/source/ui/wrtsh/wrtsh3.cxx247
-rw-r--r--sw/source/ui/wrtsh/wrtsh4.cxx300
-rw-r--r--sw/source/ui/wrtsh/wrtundo.cxx179
829 files changed, 273318 insertions, 0 deletions
diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src
new file mode 100644
index 000000000000..e1a3d314d572
--- /dev/null
+++ b/sw/source/ui/app/app.src
@@ -0,0 +1,665 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+
+#include <svl/style.hrc>
+#include <sfx2/sfx.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/globlmn.hrc>
+#include "cmdid.h"
+#include "globals.hrc"
+#include "app.hrc"
+#include "statstr.hrc"
+#include "swstyle.h"
+#include "comcore.hrc"
+#include "shells.hrc"
+#include "helpid.h"
+
+String RID_SW_NAME
+{
+ Text = "StarWriter" ;
+};
+
+String STR_PRINT_MERGE_MACRO
+{
+ Text [ en-US ] = "Print form letters" ;
+};
+
+String STR_PAGE_COUNT_MACRO
+{
+ Text [ en-US ] = "Changing the page count" ;
+};
+
+ // Image-Liste ----------------------------------------------------------------
+ // Don't use this image list for normal toolbar images. We have now our commandimagelist
+ // folder in default_images. This list is now only used for special toolboxes that are
+ // used in floating windows.
+
+#define IMAGELIST_AND_COUNT \
+ IdList = { \
+ FN_FORMULA_CALC ;\
+ FN_FORMULA_CANCEL ;\
+ FN_FORMULA_APPLY ;\
+ }; \
+ IdCount = { \
+ 3; \
+ };
+
+ImageList RID_DEFAULTIMAGELIST_SC
+{
+ Prefix = "sc";
+ MaskColor = IMAGE_MASK_COLOR ;
+ IMAGELIST_AND_COUNT
+};
+ImageList RID_DEFAULTIMAGELIST_LC
+{
+ Prefix = "lc";
+ MaskColor = IMAGE_MASK_COLOR ;
+ IMAGELIST_AND_COUNT
+};
+
+ImageList RID_DEFAULTIMAGELIST_SCH
+{
+ Prefix = "sch";
+ MaskColor = IMAGE_MASK_COLOR ;
+ IMAGELIST_AND_COUNT
+};
+ImageList RID_DEFAULTIMAGELIST_LCH
+{
+ Prefix = "lch";
+ MaskColor = IMAGE_MASK_COLOR ;
+ IMAGELIST_AND_COUNT
+};
+
+// Vorlagen
+#define STYLE_IMAGE_LISTEF \
+ MaskColor = IMAGE_MASK_COLOR ; \
+ IdList = \
+ { \
+ 1; 2; 3; 4; 5; \
+ }; \
+ IdCount = 5;
+
+SfxStyleFamilies DLG_STYLE_DESIGNER
+{
+ StyleFamilyList =
+ {
+ SfxStyleFamilyItem
+ {
+ Text [ en-US ] = "Paragraph Styles" ;
+ StyleFamily = SFX_STYLE_FAMILY_PARA ;
+ FilterList [ en-US ] =
+ {
+ < "All Styles" ; SFXSTYLEBIT_ALL ; > ;
+ < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
+ < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
+ < "Automatic" ; SFXSTYLEBIT_AUTO ; > ;
+ < "Text Styles" ; SWSTYLEBIT_TEXT ; > ;
+ < "Chapter Styles" ; SWSTYLEBIT_CHAPTER ; > ;
+ < "List Styles" ; SWSTYLEBIT_LIST ; > ;
+ < "Index Styles" ; SWSTYLEBIT_IDX ; > ;
+ < "Special Styles" ; SWSTYLEBIT_EXTRA ; > ;
+ < "HTML Styles" ; SWSTYLEBIT_HTML ; > ;
+ < "Conditional Styles" ; SWSTYLEBIT_CONDCOLL ; > ;
+ };
+ };
+ SfxStyleFamilyItem
+ {
+ Text [ en-US ] = "Character Styles" ;
+ StyleFamily = SFX_STYLE_FAMILY_CHAR ;
+ FilterList [ en-US ] =
+ {
+ < "All" ; SFXSTYLEBIT_ALL ; > ;
+ < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
+ < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
+ };
+ };
+ SfxStyleFamilyItem
+ {
+ Text [ en-US ] = "Frame Styles" ;
+ StyleFamily = SFX_STYLE_FAMILY_FRAME ;
+ FilterList [ en-US ] =
+ {
+ < "All" ; SFXSTYLEBIT_ALL ; > ;
+ < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
+ < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
+ };
+ };
+ SfxStyleFamilyItem
+ {
+ Text [ en-US ] = "Page Styles" ;
+ StyleFamily = SFX_STYLE_FAMILY_PAGE ;
+ FilterList [ en-US ] =
+ {
+ < "All" ; SFXSTYLEBIT_ALL ; > ;
+ < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
+ < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
+ };
+ };
+ SfxStyleFamilyItem
+ {
+ StyleFamily = SFX_STYLE_FAMILY_PSEUDO ;
+ FilterList [ en-US ] =
+ {
+ < "All" ; SFXSTYLEBIT_ALL ; > ;
+ < "Applied Styles" ; SFXSTYLEBIT_USED ; > ;
+ < "Custom Styles" ; SFXSTYLEBIT_USERDEF ; > ;
+ };
+ Text [ en-US ] = "List Styles" ;
+ };
+ };
+
+ ImageList 1 // == BMP_COLOR_NORMAL + 1
+ {
+ Prefix = "sf";
+ STYLE_IMAGE_LISTEF
+ };
+ ImageList 2 // == BMP_COLOR_HIGHCONTRAST + 1
+ {
+ Prefix = "sfh";
+ STYLE_IMAGE_LISTEF
+ };
+};
+
+
+
+ // Default Bitmap fuer Toolbox
+BITMAP BMP_FEHLT { FILE = "x.bmp" ; };
+ // Bitmap fuer die NumerierungsVorlagen im Organizer
+Bitmap BMP_STYLES_FAMILY_NUM { File = "styfamnu.bmp" ; };
+Bitmap BMP_STYLES_FAMILY_NUM_HC { File = "styfamnu_h.bmp" ; };
+
+String STR_ENV_TITLE
+{
+ Text [ en-US ] = "Envelope" ;
+};
+
+String STR_LAB_TITLE
+{
+ Text [ en-US ] = "Labels" ;
+};
+
+ // ShortName!!!
+String STR_HUMAN_SWDOC_NAME
+{
+ Text [ en-US ] = "Text" ;
+};
+
+String STR_WRITER_DOCUMENT_FULLTYPE
+{
+ Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION Text Document";
+};
+
+
+String STR_CANTOPEN
+{
+ Text [ en-US ] = "Cannot open document." ;
+};
+
+String STR_CANTCREATE
+{
+ Text [ en-US ] = "Can't create document.";
+};
+String STR_DLLNOTFOUND
+{
+ Text [ en-US ] = "Filter not found." ;
+};
+
+
+String STR_UNBENANNT
+{
+ Text [ en-US ] = "Untitled" ;
+};
+
+
+String STR_LOAD_GLOBAL_DOC
+{
+ Text [ en-US ] = "Name and Path of Master Document" ;
+};
+
+String STR_LOAD_HTML_DOC
+{
+ Text [ en-US ] = "Name and Path of the HTML Document" ;
+};
+
+InfoBox MSG_ERROR_SEND_MAIL
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "Error sending mail." ;
+};
+InfoBox MSG_ERROR_PASSWD
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "Invalid password" ;
+};
+
+/*
+ * auskommentiert, da die Toolbox z. Zt. nicht aus der Resource
+ * geladen werden kann
+Window WIN_TOOLBOX {
+ "Bearbeitung von Text, Rahmen, Grafik, Tabellen oder "
+ "Numerierungen.";
+HelpText [ en-US ] = "The objectbar contains, depending on your current "
+ "working context, buttons for the editing of text, "
+ "frames, graphics, tables or numberings.";
+ OUTPUTSIZE = TRUE;
+ BORDER = TRUE;
+ Size = (28,27);
+};
+ */
+
+String STR_FMT_STD
+{
+ Text [ en-US ] = "(none)" ;
+};
+
+String STR_DOC_STAT
+{
+ Text [ en-US ] = "Statistics" ;
+};
+
+ // ----------------------------
+ // Statusleisten-Ueberschriften
+ // ----------------------------
+
+String STR_STATSTR_W4WREAD
+{
+ Text [ en-US ] = "Importing document..." ;
+};
+
+String STR_STATSTR_W4WWRITE
+{
+ Text [ en-US ] = "Exporting document..." ;
+};
+
+String STR_STATSTR_SWGREAD
+{
+ Text [ en-US ] = "Loading document..." ;
+};
+
+String STR_STATSTR_SWGWRITE
+{
+ Text [ en-US ] = "Saving document..." ;
+};
+
+String STR_STATSTR_REFORMAT
+{
+ Text [ en-US ] = "Repagination..." ;
+};
+
+String STR_STATSTR_AUTOFORMAT
+{
+ Text [ en-US ] = "Formatting document automatically..." ;
+};
+
+String STR_STATSTR_IMPGRF
+{
+ Text [ en-US ] = "Importing graphics..." ;
+};
+
+String STR_STATSTR_SEARCH
+{
+ Text [ en-US ] = "Search..." ;
+};
+
+String STR_STATSTR_FORMAT
+{
+ Text [ en-US ] = "Formatting..." ;
+};
+
+String STR_STATSTR_PRINT
+{
+ Text [ en-US ] = "Printing..." ;
+};
+
+String STR_STATSTR_LAYOUTINIT
+{
+ Text [ en-US ] = "Converting..." ;
+};
+
+String STR_STATSTR_LETTER
+{
+ Text [ en-US ] = "Letter" ;
+};
+
+String STR_STATSTR_SPELL
+{
+ Text [ en-US ] = "Spellcheck..." ;
+};
+
+String STR_STATSTR_HYPHEN
+{
+ Text [ en-US ] = "Hyphenation..." ;
+};
+
+String STR_STATSTR_TOX_INSERT
+{
+ Text [ en-US ] = "Inserting Index..." ;
+};
+
+String STR_STATSTR_TOX_UPDATE
+{
+ Text [ en-US ] = "Updating Index..." ;
+};
+
+String STR_STATSTR_SUMMARY
+{
+ Text [ en-US ] = "Creating abstract..." ;
+};
+
+String STR_STATSTR_SWGPRTOLENOTIFY
+{
+ Text [ en-US ] = "Adapt Objects...";
+};
+
+
+QueryBox MSG_COMCORE_ASKSEARCH
+{
+ Buttons = WB_YES_NO_CANCEL ;
+ DefButton = WB_DEF_YES ;
+ Message [ en-US ] = "To proceed with this action, you must first turn off the \"undo\" function. Do you want to turn off the \"undo\" function?" ;
+};
+
+Bitmap RID_GRAPHIC_REPLACEBMP
+{
+ File = "grafikei.bmp" ;
+};
+
+Bitmap RID_GRAPHIC_ERRORBMP
+{
+ File = "grafikde.bmp" ;
+};
+
+Bitmap RID_GRAPHIC_REPLACEBMP_HC
+{
+ File = "grafikei_h.bmp" ;
+};
+
+Bitmap RID_GRAPHIC_ERRORBMP_HC
+{
+ File = "grafikde_h.bmp" ;
+};
+
+String STR_TABLE_DEFNAME
+{
+ Text [ en-US ] = "Table" ;
+};
+
+String STR_GRAPHIC_DEFNAME
+{
+ Text[ en-US ] = "graphics" ;
+};
+
+String STR_OBJECT_DEFNAME
+{
+ Text [ en-US ] = "Object" ;
+};
+
+String STR_FRAME_DEFNAME
+{
+ Text [ en-US ] = "Frame" ;
+};
+String STR_REGION_DEFNAME
+{
+ Text [ en-US ] = "Section" ;
+};
+String STR_NUMRULE_DEFNAME
+{
+ Text [ en-US ] = "Numbering" ;
+};
+String STR_EMPTYPAGE
+{
+ Text [ en-US ] = "blank page" ;
+};
+
+QueryBox MSG_CLPBRD_CLEAR
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+ Message [ en-US ] = "You have a large amount of data saved in the clipboard.\nShould the clipboard contents remain available for other applications?" ;
+};
+
+QueryBox MSG_SAVE_HTML_QUERY
+{
+ BUTTONS = WB_YES_NO_CANCEL ;
+ DEFBUTTON = WB_DEF_YES ;
+ Message [ en-US ] = "Conversion into HTML format \nmay cause information loss. \nDo you want to save the document?" ;
+};
+QueryBox MSG_SAVEAS_HTML_QUERY
+{
+ BUTTONS = WB_YES_NO;
+ DEFBUTTON = WB_DEF_NO ;
+ Message [ en-US ] = "The source code can only be displayed if the document is saved in HTML format.\nWould you like to save the document as HTML?";
+};
+String STR_ABSTRACT_TITLE
+{
+ Text [ en-US ] = "Abstract: " ;
+};
+
+String STR_FDLG_TEMPLATE_BUTTON
+{
+ Text [ en-US ] = "Style" ;
+};
+
+String STR_FDLG_TEMPLATE_NAME
+{
+ //Text [ en-US ] = "Styles: " ; //#outline level,removed by zhaojianwei
+ Text [ en-US ] = "separated by: " ; //<-end,add by zhaojianwei
+};
+//#outline level,add by zhaojianwei
+String STR_FDLG_OUTLINE_LEVEL
+{
+ Text [ en-US ] = "Outline: Level ";
+};
+
+String STR_FDLG_STYLE
+{
+ Text [ en-US ] = "Style: ";
+};
+//<-end
+
+
+String STR_PAGEOFFSET
+{
+ Text [ en-US ] = "Page number: " ;
+};
+String STR_PAGEBREAK
+{
+ Text [ en-US ] = "Break before new page" ;
+};
+String STR_WESTERN_FONT
+{
+ Text [ en-US ] = "Western text: ";
+};
+String STR_CJK_FONT
+{
+ Text [ en-US ] = "Asian text: ";
+};
+String STR_REDLINE_UNKNOWN_AUTHOR
+{
+ Text [ en-US ] = "Unknown Author";
+};
+
+WarningBox MSG_DISABLE_UNDO_QUESTION
+{
+ BUTTONS = WB_YES_NO_CANCEL;
+ DEFBUTTON = WB_DEF_YES ;
+ Message [ en-US ] = "This action deletes the list of actions that can be undone. Previous changes made to the document are still valid, but cannot be undone. Do you want to continue formatting?";
+};
+/*QueryBox MSG_INS_MERGE_FIELDS
+{
+ HelpId = HID_MAIL_MERGE_INSERT_FIELDS;
+ Buttons = WB_OK_CANCEL ;
+ DefButton = WB_DEF_YES ;
+ Message [ en-US ] = "Do you want to use names and addresses from a database?";
+};
+*/
+QueryBox MSG_PRINT_AS_MERGE
+{
+ HelpId = HID_PRINT_AS_MERGE;
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_YES ;
+ Message [ en-US ] = "Your document contains address database fields. Do you want to print a form letter?";
+};
+ModalDialog DLG_MERGE_SOURCE_UNAVAILABLE
+{
+ HelpId = HID_MERGE_SOURCE_UNAVAILABLE;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 202 , 72 ) ;
+ Moveable = TRUE ;
+
+ FixedImage IMG_MERGE
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 103 , 32 ) ;
+ };
+ FixedText ST_MERGE_SOURCE_UNAVAILABLE
+ {
+ Pos = MAP_APPFONT ( 12 , 6 ) ;
+ Size = MAP_APPFONT ( 178 , 40 ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "The data source \'%1\' was not found. Thus the connection to the data source could not be established.\n\nPlease check the connections settings.";
+ };
+ OKButton PB_MERGE_OK
+ {
+ Pos = MAP_APPFONT ( 12 , 52 ) ;
+ Size = MAP_APPFONT ( 125 , 14 ) ;
+ Text [ en-US ] = "Check Connection Settings...";
+ };
+ CancelButton PB_MERGE_CANCEL
+ {
+ Pos = MAP_APPFONT ( 140 , 52 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+WarningBox MSG_DATA_SOURCES_UNAVAILABLE
+{
+ HelpId = HID_DATA_SOURCES_UNAVAILABLE;
+ Buttons = WB_OK_CANCEL;
+ Message [ en-US ] = "No data source has been set up yet. You need a data source, such as a database, to supply data (for example, names and addresses) for the fields.";
+};
+
+String RID_MODULE_TOOLBOX
+{
+ Text [ en-US ] = "Function Bar (viewing mode)" ;
+};
+String STR_DONT_ASK_AGAIN
+{
+ Text [ en-US ] = "~Do not show warning again" ;
+};
+// --> OD 2008-04-14 #outlinelevel#
+String STR_OUTLINE_NUMBERING
+{
+ Text [ en-US ] = "Outline Numbering";
+};
+ToolBox RID_MODULE_TOOLBOX
+{
+ HelpID = HID_MODULE_TOOLBOX ;
+ Border = TRUE ;
+ SVLook = TRUE ;
+ Dockable = TRUE ;
+ Moveable = TRUE ;
+ Sizeable = TRUE ;
+ Closeable = TRUE ;
+ Zoomable = TRUE ;
+ HideWhenDeactivate = TRUE ;
+ LineSpacing = TRUE ;
+ Customize = TRUE ;
+ MenuStrings = TRUE ;
+ Hide = TRUE ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = SID_SAVEASDOC ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_EDITDOC ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_MAIL_SENDDOC ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_DIRECTEXPORTDOCASPDF ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_PRINTDOCDIRECT ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_COPY ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_SEARCH_DLG ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_NAVIGATOR ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_ATTR_ZOOM ;
+ };
+ };
+ Scroll = TRUE ;
+};
+
+WarningBox MSG_DISABLE_READLINE_QUESTION
+{
+ BUTTONS = WB_YES_NO;
+ DEFBUTTON = WB_DEF_YES ;
+ Message [ en-US ] = "In the current document, changes are being recorded but not shown as such. In large documents, delays can occur when the document is edited. Do you want to show the changes to avoid delays?";
+};
diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx
new file mode 100644
index 000000000000..ee2e686a8400
--- /dev/null
+++ b/sw/source/ui/app/appenv.cxx
@@ -0,0 +1,545 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+
+#include <hintids.hxx>
+
+#include <sfx2/request.hxx>
+#include <svx/svxids.hrc>
+
+#include <svtools/svmedit.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/docfac.hxx>
+#include <sfx2/printer.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/pbinitem.hxx>
+#include <editeng/paperinf.hxx>
+#include <editeng/brkitem.hxx>
+#include <fmthdft.hxx>
+#include <swwait.hxx>
+#include <paratr.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <docsh.hxx>
+#include <frmatr.hxx>
+#include <fldbas.hxx>
+#include <swundo.hxx>
+#include <IDocumentDeviceAccess.hxx>
+#include <dbmgr.hxx>
+#include <fmtcol.hxx>
+#include <frmmgr.hxx>
+#include <fldmgr.hxx>
+#include <pagedesc.hxx>
+#include <poolfmt.hxx>
+#include <expfld.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <crsskip.hxx>
+
+#include <cmdid.h>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _APP_HRC
+#include <app.hrc>
+#endif
+#ifndef _POOLFMT_HRC
+#include <poolfmt.hrc>
+#endif
+#include "swabstdlg.hxx"
+#include "envelp.hrc"
+#include "envimg.hxx"
+
+#define ENV_NEWDOC RET_OK
+#define ENV_INSERT RET_USER
+#define ENV_CANCEL SHRT_MAX
+
+
+// --------------------------------------------------------------------------
+
+
+// Funktion wird fuer Etiketten und Briefumschlaege benutzt!
+// im applab.cxx und appenv.cxx
+String InsertLabEnvText( SwWrtShell& rSh, SwFldMgr& rFldMgr, const String& rText )
+{
+ String sRet;
+ String aText(rText);
+ aText.EraseAllChars( '\r' );
+
+
+ USHORT nTokenPos = 0;
+ while( STRING_NOTFOUND != nTokenPos )
+ {
+ String aLine = aText.GetToken( 0, '\n', nTokenPos );
+ while ( aLine.Len() )
+ {
+ String sTmpText;
+ BOOL bField = FALSE;
+
+ USHORT nPos = aLine.Search( '<' );
+ if ( nPos )
+ {
+ sTmpText = aLine.Copy( 0, nPos );
+ aLine.Erase( 0, nPos );
+// sTmpText = aLine.Cut( 0, nPos );
+ }
+ else
+ {
+ nPos = aLine.Search( '>' );
+ if ( nPos == STRING_NOTFOUND )
+ {
+ sTmpText = aLine;
+ aLine.Erase();
+// sTmpText = aLine.Cut();
+ }
+ else
+ {
+ sTmpText = aLine.Copy( 0, nPos + 1);
+ aLine.Erase( 0, nPos + 1);
+// sTmpText = aLine.Cut( 0, nPos + 1 );
+
+ // Datenbankfelder muesen mind. 3 Punkte beinhalten!
+ String sDBName( sTmpText.Copy( 1, sTmpText.Len() - 2));
+ USHORT nCnt = sDBName.GetTokenCount('.');
+ if (nCnt >= 3)
+ {
+ ::ReplacePoint(sDBName, TRUE);
+ SwInsertFld_Data aData(TYP_DBFLD, 0, sDBName, aEmptyStr, 0, &rSh );
+ rFldMgr.InsertFld( aData );
+ sRet = sDBName;
+ bField = TRUE;
+ }
+ }
+ }
+ if ( !bField )
+ rSh.Insert( sTmpText );
+ }
+ rSh.InsertLineBreak();
+ }
+ rSh.DelLeft(); // Letzten Linebreak wieder l???schen
+
+ return sRet;
+}
+
+// ----------------------------------------------------------------------------
+
+
+void lcl_CopyCollAttr(SwWrtShell* pOldSh, SwWrtShell* pNewSh, USHORT nCollId)
+{
+ USHORT nCollCnt = pOldSh->GetTxtFmtCollCount();
+ SwTxtFmtColl* pColl;
+ for( USHORT nCnt = 0; nCnt < nCollCnt; ++nCnt )
+ if(nCollId == (pColl = &pOldSh->GetTxtFmtColl(nCnt))->GetPoolFmtId())
+ pNewSh->GetTxtCollFromPool(nCollId)->SetFmtAttr(pColl->GetAttrSet());
+}
+
+// ----------------------------------------------------------------------------
+
+
+void SwModule::InsertEnv( SfxRequest& rReq )
+{
+static USHORT nTitleNo = 0;
+
+ SwDocShell *pMyDocSh;
+ SfxViewFrame *pFrame;
+ SwView *pNewView;
+ SwWrtShell *pOldSh,
+ *pSh;
+
+ //aktuelle Shell besorgen
+ pMyDocSh = (SwDocShell*) SfxObjectShell::Current();
+ pOldSh = pMyDocSh ? pMyDocSh->GetWrtShell() : 0;
+
+ // Neues Dokument erzeugen (kein Show!)
+ SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD ) );
+ xDocSh->DoInitNew( 0 );
+ pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
+ pNewView = (SwView*) pFrame->GetViewShell();
+ pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird.
+ pSh = pNewView->GetWrtShellPtr();
+
+ String aTmp( SW_RES(STR_ENV_TITLE) );
+ aTmp += String::CreateFromInt32( ++nTitleNo );
+ xDocSh->SetTitle( aTmp );
+
+ // Ggf. alte Collections "Absender" und "Empfaenger" in neues
+ // Dokument kopieren
+ if ( pOldSh )
+ {
+ ::lcl_CopyCollAttr(pOldSh, pSh, RES_POOLCOLL_JAKETADRESS);
+ ::lcl_CopyCollAttr(pOldSh, pSh, RES_POOLCOLL_SENDADRESS);
+ }
+
+ // SwEnvItem aus Config lesen
+ SwEnvCfgItem aEnvCfg;
+
+ //Haben wir schon einen Briefumschlag.
+ BOOL bEnvChange = FALSE;
+
+ SfxItemSet aSet(GetPool(), FN_ENVELOP, FN_ENVELOP, 0);
+ aSet.Put(aEnvCfg.GetItem());
+
+ SfxPrinter* pTempPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true );
+ if(pOldSh )
+ {
+ const SwPageDesc& rCurPageDesc = pOldSh->GetPageDesc(pOldSh->GetCurPageDesc());
+ String sJacket;
+ SwStyleNameMapper::FillUIName( RES_POOLPAGE_JAKET, sJacket );
+ bEnvChange = rCurPageDesc.GetName() == sJacket;
+
+ IDocumentDeviceAccess* pIDDA_old = pOldSh->getIDocumentDeviceAccess();
+ if( pIDDA_old->getPrinter( false ) )
+ {
+ IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess();
+ pIDDA->setJobsetup( *pIDDA_old->getJobsetup() );
+ //#69563# if it isn't the same printer then the pointer has been invalidated!
+ pTempPrinter = pIDDA->getPrinter( true );
+ }
+ pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue());
+
+ }
+
+ Window *pParent = pOldSh ? pOldSh->GetWin() : 0;
+ SfxAbstractTabDialog * pDlg=NULL;
+ short nMode = ENV_INSERT;
+
+ SFX_REQUEST_ARG( rReq, pItem, SwEnvItem, FN_ENVELOP, sal_False );
+ if ( !pItem )
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ pDlg = pFact->CreateSwEnvDlg( pParent, aSet, pOldSh, pTempPrinter, !bEnvChange, DLG_ENV );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ nMode = pDlg->Execute();
+ }
+ else
+ {
+ SFX_REQUEST_ARG( rReq, pBoolItem, SfxBoolItem, FN_PARAM_1, sal_False );
+ if ( pBoolItem && pBoolItem->GetValue() )
+ nMode = ENV_NEWDOC;
+ }
+
+ if (nMode == ENV_NEWDOC || nMode == ENV_INSERT)
+ {
+ SwWait aWait( (SwDocShell&)*xDocSh, TRUE );
+
+ // Dialog auslesen, Item in Config speichern
+ const SwEnvItem& rItem = pItem ? *pItem : (const SwEnvItem&) pDlg->GetOutputItemSet()->Get(FN_ENVELOP);
+ aEnvCfg.GetItem() = rItem;
+ aEnvCfg.Commit();
+
+ //Wenn wir Drucken uebernehmen wir den eingestellten Jobsetup aus
+ //dem Dialog. Die Informationen muessen hier vor dem evtl. zerstoeren
+ //der neuen Shell gesetzt werden, weil deren Drucker an den Dialog
+ //gereicht wurde.
+ if ( nMode != ENV_NEWDOC )
+ {
+ ASSERT(pOldSh, "Kein Dokument - war 'Einfuegen' nicht disabled???");
+ SvxPaperBinItem aItem( RES_PAPER_BIN );
+ aItem.SetValue((BYTE)pSh->getIDocumentDeviceAccess()->getPrinter(true)->GetPaperBin());
+ pOldSh->GetPageDescFromPool(RES_POOLPAGE_JAKET)->GetMaster().SetFmtAttr(aItem);
+ }
+
+ SwWrtShell *pTmp = nMode == ENV_INSERT ? pOldSh : pSh;
+ const SwPageDesc* pFollow = 0;
+ SwTxtFmtColl *pSend = pTmp->GetTxtCollFromPool( RES_POOLCOLL_SENDADRESS ),
+ *pAddr = pTmp->GetTxtCollFromPool( RES_POOLCOLL_JAKETADRESS);
+ const String &rSendMark = pSend->GetName();
+ const String &rAddrMark = pAddr->GetName();
+
+ if (nMode == ENV_INSERT)
+ {
+
+ SetView(&pOldSh->GetView()); // Pointer auf oberste View restaurieren
+
+ //Neues Dok wieder loeschen
+ xDocSh->DoClose();
+ pSh = pOldSh;
+ //#i4251# selected text or objects in the document should
+ //not be deleted on inserting envelopes
+ pSh->EnterStdMode();
+ // Los geht's (Einfuegen)
+ pSh->StartUndo(UNDO_UI_INSERT_ENVELOPE, NULL);
+ pSh->StartAllAction();
+ pSh->SttEndDoc(TRUE);
+
+ if (bEnvChange)
+ {
+ // Folgevorlage: Seite 2
+ pFollow = pSh->GetPageDesc(pSh->GetCurPageDesc()).GetFollow();
+
+ // Text der ersten Seite loeschen
+ if ( !pSh->SttNxtPg(TRUE) )
+ pSh->EndPg(TRUE);
+ pSh->DelRight();
+ // Rahmen der ersten Seite loeschen
+ if( pSh->GotoFly( rSendMark ) )
+ {
+ pSh->EnterSelFrmMode();
+ pSh->DelRight();
+ }
+ if ( pSh->GotoFly( rAddrMark ) )
+ {
+ pSh->EnterSelFrmMode();
+ pSh->DelRight();
+ }
+ pSh->SttEndDoc(TRUE);
+ }
+ else
+ // Folgevorlage: Seite 1
+ pFollow = &pSh->GetPageDesc(pSh->GetCurPageDesc());
+
+ // Seitenumbruch einfuegen
+ if ( pSh->IsCrsrInTbl() )
+ {
+ pSh->SplitNode();
+ pSh->Right( CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ SfxItemSet aBreakSet( pSh->GetAttrPool(), RES_BREAK, RES_BREAK, 0 );
+ aBreakSet.Put( SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK) );
+ pSh->SetTblAttr( aBreakSet );
+ }
+ else
+ pSh->InsertPageBreak(0, FALSE);
+ pSh->SttEndDoc(TRUE);
+ }
+ else
+ {
+ pFollow = &pSh->GetPageDesc(pSh->GetCurPageDesc());
+ // Los geht's (Drucken)
+ pSh->StartAllAction();
+ pSh->DoUndo(FALSE);
+
+ // Neue Collections "Absender" und "Empfaenger" wieder in neues
+ // Dokument kopieren
+ if ( pOldSh )
+ {
+ ::lcl_CopyCollAttr(pOldSh, pSh, RES_POOLCOLL_JAKETADRESS);
+ ::lcl_CopyCollAttr(pOldSh, pSh, RES_POOLCOLL_SENDADRESS);
+ }
+ }
+
+ SET_CURR_SHELL(pSh);
+ pSh->SetNewDoc(); // Performanceprobleme vermeiden
+
+ // Flys dieser Seite merken
+ SvPtrarr aFlyArr(0, 5);
+ if( ENV_NEWDOC != nMode && !bEnvChange )
+ pSh->GetPageObjs( aFlyArr );
+
+ // Page-Desc ermitteln
+ SwPageDesc* pDesc = pSh->GetPageDescFromPool(RES_POOLPAGE_JAKET);
+ SwFrmFmt& rFmt = pDesc->GetMaster();
+
+ Printer *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( true );
+
+ // Raender (setzen sich zusammen aus Shift-Offset und
+ // Ausrichtung)
+ Size aPaperSize = pPrt->PixelToLogic( pPrt->GetPaperSizePixel(),
+ MAP_TWIP);
+ if ( !aPaperSize.Width() && !aPaperSize.Height() )
+ aPaperSize = SvxPaperInfo::GetPaperSize(PAPER_A4);
+ if ( aPaperSize.Width() > aPaperSize.Height() )
+ Swap( aPaperSize );
+
+ long lLeft = rItem.lShiftRight,
+ lUpper = rItem.lShiftDown;
+
+ USHORT nPageW = (USHORT) Max(rItem.lWidth, rItem.lHeight),
+ nPageH = (USHORT) Min(rItem.lWidth, rItem.lHeight);
+
+ switch (rItem.eAlign)
+ {
+ case ENV_HOR_LEFT: break;
+ case ENV_HOR_CNTR: lLeft += Max(0L, long(aPaperSize.Width() - nPageW)) / 2;
+ break;
+ case ENV_HOR_RGHT: lLeft += Max(0L, long(aPaperSize.Width() - nPageW));
+ break;
+ case ENV_VER_LEFT: lUpper += Max(0L, long(aPaperSize.Width() - nPageH));
+ break;
+ case ENV_VER_CNTR: lUpper += Max(0L, long(aPaperSize.Width() - nPageH)) / 2;
+ break;
+ case ENV_VER_RGHT: break;
+ }
+ SvxLRSpaceItem aLRMargin( RES_LR_SPACE );
+ SvxULSpaceItem aULMargin( RES_UL_SPACE );
+ aLRMargin.SetLeft ((USHORT) lLeft );
+ aULMargin.SetUpper((USHORT) lUpper);
+ aLRMargin.SetRight(0);
+ aULMargin.SetLower(0);
+ rFmt.SetFmtAttr(aLRMargin);
+ rFmt.SetFmtAttr(aULMargin);
+
+ // Kopf-, Fusszeilen
+ rFmt.SetFmtAttr(SwFmtHeader(BOOL(FALSE)));
+ pDesc->ChgHeaderShare(FALSE);
+ rFmt.SetFmtAttr(SwFmtFooter(BOOL(FALSE)));
+ pDesc->ChgFooterShare(FALSE);
+
+ // Seitennumerierung
+ pDesc->SetUseOn(nsUseOnPage::PD_ALL);
+
+ // Einstellen der Seitengroesse
+ rFmt.SetFmtAttr(SwFmtFrmSize(ATT_FIX_SIZE,
+ nPageW + lLeft, nPageH + lUpper));
+
+ // Einstellen der Numerierungsart der Seite
+ SvxNumberType aType;
+ aType.SetNumberingType(SVX_NUM_NUMBER_NONE);
+ pDesc->SetNumType(aType);
+
+ // Folgevorlage
+ if (pFollow)
+ pDesc->SetFollow(pFollow);
+
+ // Landscape
+ pDesc->SetLandscape( rItem.eAlign >= ENV_VER_LEFT &&
+ rItem.eAlign <= ENV_VER_RGHT);
+
+ // Page-Desc anwenden
+
+ USHORT nPos;
+ pSh->FindPageDescByName( pDesc->GetName(),
+ FALSE,
+ &nPos );
+
+
+ pSh->ChgPageDesc( nPos, *pDesc);
+ pSh->ChgCurPageDesc(*pDesc);
+
+ // Rahmen einfuegen
+ SwFlyFrmAttrMgr aMgr(FALSE, pSh, FRMMGR_TYPE_ENVELP);
+ SwFldMgr aFldMgr;
+ aMgr.SetHeightSizeType(ATT_VAR_SIZE);
+
+ //Defaults ueberschreiben!
+ aMgr.GetAttrSet().Put( SvxBoxItem(RES_BOX) );
+ aMgr.SetULSpace( 0L, 0L );
+ aMgr.SetLRSpace( 0L, 0L );
+
+ // Absender
+ if (rItem.bSend)
+ {
+ pSh->SttEndDoc(TRUE);
+ aMgr.InsertFlyFrm(FLY_AT_PAGE,
+ Point(rItem.lSendFromLeft + lLeft, rItem.lSendFromTop + lUpper),
+ Size (rItem.lAddrFromLeft - rItem.lSendFromLeft, 0));
+
+ pSh->EnterSelFrmMode();
+ pSh->SetFlyName( rSendMark );
+ pSh->UnSelectFrm();
+ pSh->LeaveSelFrmMode();
+ pSh->SetTxtFmtColl( pSend );
+ InsertLabEnvText( *pSh, aFldMgr, rItem.aSendText );
+ aMgr.UpdateAttrMgr();
+ }
+
+ // Empfaenger
+ pSh->SttEndDoc(TRUE);
+
+ aMgr.InsertFlyFrm(FLY_AT_PAGE,
+ Point(rItem.lAddrFromLeft + lLeft, rItem.lAddrFromTop + lUpper),
+ Size (nPageW - rItem.lAddrFromLeft - 566, 0));
+ pSh->EnterSelFrmMode();
+ pSh->SetFlyName( rAddrMark );
+ pSh->UnSelectFrm();
+ pSh->LeaveSelFrmMode();
+ pSh->SetTxtFmtColl( pAddr );
+ InsertLabEnvText(*pSh, aFldMgr, rItem.aAddrText);
+
+ // Flys auf die "alten" Seiten verschieben
+ if (aFlyArr.Count())
+ pSh->SetPageObjsNewPage(aFlyArr, 1);
+
+ // Fertig
+ pSh->SttEndDoc(TRUE);
+
+ pSh->EndAllAction();
+
+ if (nMode == ENV_NEWDOC)
+ pSh->DoUndo(TRUE);
+ else
+ pSh->EndUndo(UNDO_UI_INSERT_ENVELOPE);
+
+ if (nMode == ENV_NEWDOC)
+ {
+ pFrame->GetFrame().Appear();
+
+ if ( rItem.aAddrText.indexOf('<') >= 0 )
+ {
+ static USHORT __READONLY_DATA aInva[] =
+ {
+ SID_SBA_BRW_UPDATE,
+ SID_SBA_BRW_INSERT,
+ SID_SBA_BRW_MERGE,
+ 0
+ };
+ pFrame->GetBindings().Invalidate( aInva );
+
+ // Datenbankbeamer oeffnen
+ ShowDBObj(*pNewView, pSh->GetDBData());
+ }
+ }
+
+ if ( !pItem )
+ {
+ rReq.AppendItem( rItem );
+ if ( nMode == ENV_NEWDOC )
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_1, TRUE ) );
+ }
+
+ rReq.Done();
+ }
+ else //Abbruch
+ {
+ rReq.Ignore();
+
+ xDocSh->DoClose();
+ --nTitleNo;
+
+ // Pointer auf oberste View restaurieren
+ if (pOldSh)
+ SetView(&pOldSh->GetView());
+ }
+ delete pDlg;
+}
+
+
diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx
new file mode 100644
index 000000000000..8e939c88fd37
--- /dev/null
+++ b/sw/source/ui/app/apphdl.cxx
@@ -0,0 +1,976 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <tools/urlobj.hxx>
+
+#include <tools/debug.hxx>
+#include <tools/link.hxx>
+
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#include <svl/urihelper.hxx>
+#include <unotools/undoopt.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svtools/accessibilityoptions.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/event.hxx>
+#include <sfx2/objitem.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#include <svl/srchitem.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svl/eitem.hxx>
+#include <svl/whiter.hxx>
+#include <svl/isethint.hxx>
+#include <svx/hyprlink.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <svl/stritem.hxx>
+#include <svl/ctloptions.hxx>
+#include <unotools/useroptions.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/wrkwin.hxx>
+#include <svx/insctrl.hxx>
+#include <svx/selctrl.hxx>
+#include <com/sun/star/document/UpdateDocMode.hpp>
+#include <sfx2/docfile.hxx>
+#include <svx/xmlsecctrl.hxx>
+#include <navicfg.hxx>
+
+#include <sfx2/objface.hxx>
+#include <sfx2/app.hxx>
+
+#include <view.hxx>
+#include <pview.hxx>
+#include <srcview.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <cmdid.h> // Funktion-Ids
+#include <initui.hxx>
+#include <uitool.hxx>
+#include <swmodule.hxx>
+#include <wdocsh.hxx>
+#include <wview.hxx>
+#include <usrpref.hxx>
+#include <gloslst.hxx> // SwGlossaryList
+#include <glosdoc.hxx> // SwGlossaryList
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <cfgitems.hxx>
+#include <prtopt.hxx>
+#include <modcfg.hxx>
+#include <globals.h> // globale Konstanten z.B.
+#include <app.hrc>
+#include <fontcfg.hxx>
+#include <barcfg.hxx>
+#include <uinums.hxx>
+#include <dbconfig.hxx>
+#include <mmconfigitem.hxx>
+#include <mailmergechildwindow.hxx>
+#include <linguistic/lngprops.hxx>
+#include <editeng/unolingu.hxx>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XPropertyStateChangeListener.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <swabstdlg.hxx>
+
+
+#include <vcl/status.hxx>
+
+#include "salhelper/simplereferenceobject.hxx"
+#include "rtl/ref.hxx"
+
+#include <unomid.h>
+
+using namespace ::com::sun::star;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Slotmaps fuer Methoden der Applikation
+ --------------------------------------------------------------------*/
+
+
+// hier werden die SlotID's included
+// siehe Idl-File
+//
+#define SwModule
+#define ViewSettings
+#define WebViewSettings
+#define PrintSettings
+#define _ExecAddress ExecOther
+#define _StateAddress StateOther
+#include <sfx2/msg.hxx>
+#include <svx/svxslots.hxx>
+#include "swslots.hxx"
+#include <cfgid.h>
+
+#include <shells.hrc>
+
+SFX_IMPL_INTERFACE( SwModule, SfxModule, SW_RES(RID_SW_NAME) )
+{
+ SFX_CHILDWINDOW_REGISTRATION(SvxHyperlinkDlgWrapper::GetChildWindowId());
+ SFX_STATUSBAR_REGISTRATION(SW_RES(CFG_STATUSBAR));
+ SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_APPLICATION |
+ SFX_VISIBILITY_DESKTOP | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_CLIENT | SFX_VISIBILITY_VIEWER,
+ SW_RES(RID_MODULE_TOOLBOX) );
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Andere States
+ --------------------------------------------------------------------*/
+
+
+void SwModule::StateOther(SfxItemSet &rSet)
+{
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ SwView* pActView = ::GetActiveView();
+ sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pActView);
+
+ while(nWhich)
+ {
+ switch(nWhich)
+ {
+ case FN_BUSINESS_CARD:
+ case FN_LABEL:
+ case FN_ENVELOP:
+ {
+ sal_Bool bDisable = sal_False;
+ SfxViewShell* pCurrView = SfxViewShell::Current();
+ if( !pCurrView || (pCurrView && !pCurrView->ISA(SwView)) )
+ bDisable = sal_True;
+ SwDocShell *pDocSh = (SwDocShell*) SfxObjectShell::Current();
+ if ( bDisable ||
+ (pDocSh && (pDocSh->IsReadOnly() ||
+ pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED)) )
+ rSet.DisableItem( nWhich );
+
+ }
+ break;
+ case FN_XFORMS_INIT:
+ // slot is always active!
+ break;
+ case FN_EDIT_FORMULA:
+ {
+ SwWrtShell* pSh = 0;
+ int nSelection = 0;
+ if( pActView )
+ pSh = &pActView->GetWrtShell();
+ if( pSh )
+ nSelection = pSh->GetSelectionType();
+
+ if( (pSh && pSh->HasSelection()) ||
+ !(nSelection & (nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL)))
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case SID_ATTR_METRIC:
+ rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, static_cast< UINT16 >(::GetDfltMetric(bWebView))));
+ break;
+ case FN_SET_MODOPT_TBLNUMFMT:
+ rSet.Put( SfxBoolItem( nWhich, pModuleConfig->
+ IsInsTblFormatNum( bWebView )));
+ break;
+ default:
+ DBG_ERROR("::StateOther: default");
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*-- 06.04.2004 15:21:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwView* lcl_LoadDoc(SwView* pView, const String& rURL)
+{
+ SwView* pNewView = 0;
+ if(rURL.Len())
+ {
+ SfxStringItem aURL(SID_FILE_NAME, rURL);
+ SfxStringItem aTargetFrameName( SID_TARGETNAME, String::CreateFromAscii("_blank") );
+ SfxBoolItem aHidden( SID_HIDDEN, TRUE );
+ SfxStringItem aReferer(SID_REFERER, pView->GetDocShell()->GetTitle());
+ SfxObjectItem* pItem = (SfxObjectItem*)pView->GetViewFrame()->GetDispatcher()->
+ Execute(SID_OPENDOC, SFX_CALLMODE_SYNCHRON,
+ &aURL, &aHidden, &aReferer, &aTargetFrameName, 0L);
+ SfxShell* pShell = pItem ? pItem->GetShell() : 0;
+
+ if(pShell)
+ {
+ SfxViewShell* pViewShell = pShell->GetViewShell();
+ if(pViewShell)
+ {
+ if( pViewShell->ISA(SwView) )
+ {
+ pNewView = PTR_CAST(SwView,pViewShell);
+ pNewView->GetViewFrame()->GetFrame().Appear();
+ }
+ else
+ {
+ pViewShell->GetViewFrame()->DoClose();
+ }
+ }
+ }
+ }
+ else
+ {
+ SfxStringItem aFactory(SID_NEWDOCDIRECT, SwDocShell::Factory().GetFilterContainer()->GetName());
+ const SfxFrameItem* pItem = (SfxFrameItem*)
+ pView->GetViewFrame()->GetDispatcher()->Execute(SID_NEWDOCDIRECT,
+ SFX_CALLMODE_SYNCHRON, &aFactory, 0L);
+ SfxFrame* pFrm = pItem ? pItem->GetFrame() : 0;
+ SfxViewFrame* pFrame = pFrm ? pFrm->GetCurrentViewFrame() : 0;
+ pNewView = pFrame ? PTR_CAST(SwView, pFrame->GetViewShell()) : 0;
+ }
+
+ return pNewView;
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Felddialog starten
+ --------------------------------------------------------------------*/
+
+void NewXForms( SfxRequest& rReq ); // implementation: below
+
+namespace
+{
+
+class SwMailMergeWizardExecutor : public salhelper::SimpleReferenceObject
+{
+ SwView* m_pView; // never owner
+ SwView* m_pView2Close; // never owner
+ SwMailMergeConfigItem* m_pMMConfig; // sometimes owner
+ AbstractMailMergeWizard* m_pWizard; // always owner
+
+ DECL_LINK( EndDialogHdl, AbstractMailMergeWizard* );
+ DECL_LINK( DestroyDialogHdl, AbstractMailMergeWizard* );
+ DECL_LINK( DestroyWizardHdl, AbstractMailMergeWizard* );
+ DECL_LINK( CancelHdl, AbstractMailMergeWizard* );
+ DECL_LINK( CloseFrameHdl, AbstractMailMergeWizard* );
+
+ void ExecutionFinished( bool bDeleteConfigItem );
+ void ExecuteWizard();
+
+public:
+ SwMailMergeWizardExecutor();
+ ~SwMailMergeWizardExecutor();
+
+ void ExecuteMailMergeWizard( const SfxItemSet * pArgs );
+};
+
+SwMailMergeWizardExecutor::SwMailMergeWizardExecutor()
+ : m_pView( 0 ),
+ m_pView2Close( NULL ),
+ m_pMMConfig( 0 ),
+ m_pWizard( 0 )
+{
+}
+
+SwMailMergeWizardExecutor::~SwMailMergeWizardExecutor()
+{
+ DBG_ASSERT( m_pWizard == 0, "SwMailMergeWizardExecutor: m_pWizard must be Null!" );
+ DBG_ASSERT( m_pMMConfig == 0, "SwMailMergeWizardExecutor: m_pMMConfig must be Null!" );
+}
+
+void SwMailMergeWizardExecutor::ExecuteMailMergeWizard( const SfxItemSet * pArgs )
+{
+ if ( m_pView )
+ {
+ DBG_ERROR( "SwMailMergeWizardExecutor::ExecuteMailMergeWizard: Already executing the wizard!" );
+ return;
+ }
+
+ m_pView = ::GetActiveView(); // not owner!
+ DBG_ASSERT(m_pView, "no current view?");
+ if(m_pView)
+ {
+ // keep self alive until done.
+ acquire();
+
+ // if called from the child window - get the config item and close the ChildWindow, then restore
+ // the wizard
+ SwMailMergeChildWindow* pChildWin =
+ static_cast<SwMailMergeChildWindow*>(m_pView->GetViewFrame()->GetChildWindow(FN_MAILMERGE_CHILDWINDOW));
+ bool bRestoreWizard = false;
+ sal_uInt16 nRestartPage = 0;
+ if(pChildWin && pChildWin->IsVisible())
+ {
+ m_pMMConfig = m_pView->GetMailMergeConfigItem();
+ nRestartPage = m_pView->GetMailMergeRestartPage();
+ if(m_pView->IsMailMergeSourceView())
+ m_pMMConfig->SetSourceView( m_pView );
+ m_pView->SetMailMergeConfigItem(0, 0, sal_True);
+ SfxViewFrame* pViewFrame = m_pView->GetViewFrame();
+ pViewFrame->ShowChildWindow(FN_MAILMERGE_CHILDWINDOW, FALSE);
+ DBG_ASSERT(m_pMMConfig, "no MailMergeConfigItem available");
+ bRestoreWizard = true;
+ }
+ // to make it bullet proof ;-)
+ if(!m_pMMConfig)
+ {
+ m_pMMConfig = new SwMailMergeConfigItem;
+ m_pMMConfig->SetSourceView(m_pView);
+
+ //set the first used database as default source on the config item
+ const SfxPoolItem* pItem = 0;
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_DATABASE_PROPERTIES, sal_False, &pItem))
+ {
+ //mailmerge has been called from the database beamer
+ uno::Sequence< beans::PropertyValue> aDBValues;
+ if(static_cast<const SfxUsrAnyItem*>(pItem)->GetValue() >>= aDBValues)
+ {
+ SwDBData aDBData;
+ svx::ODataAccessDescriptor aDescriptor(aDBValues);
+ aDescriptor[svx::daDataSource] >>= aDBData.sDataSource;
+ aDescriptor[svx::daCommand] >>= aDBData.sCommand;
+ aDescriptor[svx::daCommandType] >>= aDBData.nCommandType;
+
+ uno::Sequence< uno::Any > aSelection;
+ uno::Reference< sdbc::XConnection> xConnection;
+ uno::Reference< sdbc::XDataSource> xSource;
+ uno::Reference< sdbcx::XColumnsSupplier> xColumnsSupplier;
+ if ( aDescriptor.has(svx::daSelection) )
+ aDescriptor[svx::daSelection] >>= aSelection;
+ if ( aDescriptor.has(svx::daConnection) )
+ aDescriptor[svx::daConnection] >>= xConnection;
+ uno::Reference<container::XChild> xChild(xConnection, uno::UNO_QUERY);
+ if(xChild.is())
+ xSource = uno::Reference<sdbc::XDataSource>(
+ xChild->getParent(), uno::UNO_QUERY);
+ m_pMMConfig->SetCurrentConnection(
+ xSource, SharedConnection( xConnection, SharedConnection::NoTakeOwnership ),
+ xColumnsSupplier, aDBData);
+ }
+ }
+ else
+ {
+ SvStringsDtor aDBNameList(5, 1);
+ SvStringsDtor aAllDBNames(5, 5);
+ m_pView->GetWrtShell().GetAllUsedDB( aDBNameList, &aAllDBNames );
+ if(aDBNameList.Count())
+ {
+ String sDBName = *aDBNameList[0];
+ SwDBData aDBData;
+ aDBData.sDataSource = sDBName.GetToken(0, DB_DELIM);
+ aDBData.sCommand = sDBName.GetToken(1, DB_DELIM);
+ aDBData.nCommandType = sDBName.GetToken(2, DB_DELIM ).ToInt32();
+ //set the currently used database for the wizard
+ m_pMMConfig->SetCurrentDBData( aDBData );
+ }
+ }
+ }
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ m_pWizard = pFact->CreateMailMergeWizard(*m_pView, *m_pMMConfig);
+
+ if(bRestoreWizard)
+ {
+ m_pWizard->ShowPage( nRestartPage );
+ }
+
+ ExecuteWizard();
+ }
+}
+
+void SwMailMergeWizardExecutor::ExecutionFinished( bool bDeleteConfigItem )
+{
+ m_pMMConfig->Commit();
+ if ( bDeleteConfigItem ) // owner?
+ delete m_pMMConfig;
+
+ m_pMMConfig = 0;
+
+ // release/destroy asynchronously
+ Application::PostUserEvent( LINK( this, SwMailMergeWizardExecutor, DestroyDialogHdl ) );
+}
+
+void SwMailMergeWizardExecutor::ExecuteWizard()
+{
+ m_pWizard->StartExecuteModal(
+ LINK( this, SwMailMergeWizardExecutor, EndDialogHdl ) );
+}
+
+#if OSL_DEBUG_LEVEL > 1
+IMPL_LINK( SwMailMergeWizardExecutor, EndDialogHdl, AbstractMailMergeWizard*, pDialog )
+#else
+IMPL_LINK( SwMailMergeWizardExecutor, EndDialogHdl, AbstractMailMergeWizard*, EMPTYARG )
+#endif
+{
+#if OSL_DEBUG_LEVEL > 1
+ DBG_ASSERT( pDialog == m_pWizard, "wrong dialog passed to EndDialogHdl!" );
+ (void) pDialog;
+#endif
+
+ long nRet = m_pWizard->GetResult();
+ sal_uInt16 nRestartPage = m_pWizard->GetRestartPage();
+
+ switch ( nRet )
+ {
+ case RET_LOAD_DOC:
+ {
+ SwView* pNewView = lcl_LoadDoc(m_pView, m_pWizard->GetReloadDocument());
+
+ // destroy wizard asynchronously
+ Application::PostUserEvent(
+ LINK( this, SwMailMergeWizardExecutor, DestroyWizardHdl ), m_pWizard );
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if(pNewView)
+ {
+ m_pView = pNewView;
+ m_pMMConfig->DocumentReloaded();
+ //new source view!
+ m_pMMConfig->SetSourceView( m_pView );
+ m_pWizard = pFact->CreateMailMergeWizard(*m_pView, *m_pMMConfig);
+ m_pWizard->ShowPage( nRestartPage );
+ }
+ else
+ {
+ m_pWizard = pFact->CreateMailMergeWizard(*m_pView, *m_pMMConfig);
+ }
+
+ // execute the wizard again
+ ExecuteWizard();
+ break;
+ }
+ case RET_TARGET_CREATED:
+ {
+ SwView* pTargetView = m_pMMConfig->GetTargetView();
+ uno::Reference< frame::XFrame > xFrame =
+ m_pView->GetViewFrame()->GetFrame().GetFrameInterface();
+ xFrame->getContainerWindow()->setVisible(sal_False);
+ DBG_ASSERT(pTargetView, "No target view has been created");
+ if(pTargetView)
+ {
+ // destroy wizard asynchronously
+ Application::PostUserEvent(
+ LINK( this, SwMailMergeWizardExecutor, DestroyWizardHdl ), m_pWizard );
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ m_pWizard = pFact->CreateMailMergeWizard(*pTargetView, *m_pMMConfig);
+ m_pWizard->ShowPage( nRestartPage );
+
+ // execute the wizard again
+ ExecuteWizard();
+ }
+ else
+ {
+ //should not happen - just in case no target view has been created
+ ExecutionFinished( true );
+ }
+ break;
+ }
+ case RET_EDIT_DOC:
+ case RET_EDIT_RESULT_DOC:
+ {
+ //create a non-modal dialog that allows to return to the wizard
+ //the ConfigItem ownership moves to this dialog
+ bool bResult = nRet == RET_EDIT_RESULT_DOC && m_pMMConfig->GetTargetView();
+ SwView* pTempView = bResult ? m_pMMConfig->GetTargetView() : m_pMMConfig->GetSourceView();
+ pTempView->SetMailMergeConfigItem(m_pMMConfig, m_pWizard->GetRestartPage(), !bResult);
+ SfxViewFrame* pViewFrame = pTempView->GetViewFrame();
+ pViewFrame->GetDispatcher()->Execute(
+ FN_MAILMERGE_CHILDWINDOW, SFX_CALLMODE_SYNCHRON);
+ ExecutionFinished( false );
+ break;
+ }
+ case RET_REMOVE_TARGET:
+ {
+ SwView* pTargetView = m_pMMConfig->GetTargetView();
+ SwView* pSourceView = m_pMMConfig->GetSourceView();
+ DBG_ASSERT(pTargetView && pSourceView, "source or target view not available" );
+ if(pTargetView && pSourceView)
+ {
+ m_pView2Close = pTargetView;
+ pTargetView->GetViewFrame()->GetTopViewFrame()->GetWindow().Hide();
+ pSourceView->GetViewFrame()->GetFrame().AppearWithUpdate();
+ // the current view has be be set when the target is destroyed
+ m_pView = pSourceView;
+ m_pMMConfig->SetTargetView(0);
+
+ // destroy wizard asynchronously
+ Application::PostUserEvent(
+ LINK( this, SwMailMergeWizardExecutor, CloseFrameHdl ), m_pWizard );
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ m_pWizard = pFact->CreateMailMergeWizard(*pSourceView, *m_pMMConfig);
+ m_pWizard->ShowPage( nRestartPage );
+
+ // execute the wizard again
+ ExecuteWizard();
+ }
+ else
+ {
+ //should not happen - just in case no target view has been created
+ ExecutionFinished( true );
+ }
+ break;
+ }
+ case RET_CANCEL:
+ {
+ // close frame and destroy wizard asynchronously
+ Application::PostUserEvent(
+ LINK( this, SwMailMergeWizardExecutor, CancelHdl ), m_pWizard );
+ break;
+ }
+ default: //finish
+ {
+ SwView* pSourceView = m_pMMConfig->GetSourceView();
+ if(pSourceView)
+ {
+ SwDocShell* pDocShell = pSourceView->GetDocShell();
+ if(pDocShell->HasName() && !pDocShell->IsModified())
+ m_pMMConfig->GetSourceView()->GetViewFrame()->DoClose();
+ else
+ m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame().Appear();
+ }
+ ExecutionFinished( true );
+ break;
+ }
+
+ } // switch
+
+ return 0L;
+}
+
+IMPL_LINK( SwMailMergeWizardExecutor, DestroyDialogHdl, AbstractMailMergeWizard*, EMPTYARG )
+{
+ delete m_pWizard;
+ m_pWizard = 0;
+
+ release();
+ return 0L;
+}
+
+IMPL_LINK( SwMailMergeWizardExecutor, DestroyWizardHdl, AbstractMailMergeWizard*, pDialog )
+{
+ delete pDialog;
+ return 0L;
+}
+
+IMPL_LINK( SwMailMergeWizardExecutor, CancelHdl, AbstractMailMergeWizard*, EMPTYARG )
+{
+ if(m_pMMConfig->GetTargetView())
+ {
+ m_pMMConfig->GetTargetView()->GetViewFrame()->DoClose();
+ m_pMMConfig->SetTargetView(0);
+ }
+ if(m_pMMConfig->GetSourceView())
+ m_pMMConfig->GetSourceView()->GetViewFrame()->GetFrame().AppearWithUpdate();
+
+ m_pMMConfig->Commit();
+ delete m_pMMConfig;
+ m_pMMConfig = 0;
+ // m_pWizard already deleted by closing the target view
+ m_pWizard = 0;
+ release();
+
+ return 0L;
+}
+
+IMPL_LINK( SwMailMergeWizardExecutor, CloseFrameHdl, AbstractMailMergeWizard*, EMPTYARG )
+{
+ if ( m_pView2Close )
+ {
+ m_pView2Close->GetViewFrame()->DoClose();
+ m_pView2Close = NULL;
+ }
+
+ return 0L;
+}
+
+} // namespace
+
+void SwModule::ExecOther(SfxRequest& rReq)
+{
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+
+ sal_uInt16 nWhich = rReq.GetSlot();
+ switch (nWhich)
+ {
+ case FN_ENVELOP:
+ InsertEnv( rReq );
+ break;
+
+ case FN_BUSINESS_CARD:
+ case FN_LABEL:
+ InsertLab(rReq, nWhich == FN_LABEL);
+ break;
+
+ case FN_XFORMS_INIT:
+ NewXForms( rReq );
+ break;
+
+ case SID_ATTR_METRIC:
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(nWhich, sal_False, &pItem))
+ {
+ FieldUnit eUnit = (FieldUnit)((const SfxUInt16Item*)pItem)->GetValue();
+ switch( eUnit )
+ {
+ case FUNIT_MM:
+ case FUNIT_CM:
+ case FUNIT_INCH:
+ case FUNIT_PICA:
+ case FUNIT_POINT:
+ {
+ SwView* pActView = ::GetActiveView();
+ sal_Bool bWebView = 0 != PTR_CAST(SwWebView, pActView);
+ ::SetDfltMetric(eUnit, bWebView);
+ }
+ break;
+ default:;//prevent warning
+ }
+ }
+ break;
+
+ case FN_SET_MODOPT_TBLNUMFMT:
+ {
+ sal_Bool bWebView = 0 != PTR_CAST(SwWebView, ::GetActiveView() ),
+ bSet;
+
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(
+ nWhich, sal_False, &pItem ))
+ bSet = ((SfxBoolItem*)pItem)->GetValue();
+ else
+ bSet = !pModuleConfig->IsInsTblFormatNum( bWebView );
+
+ pModuleConfig->SetInsTblFormatNum( bWebView, bSet );
+ }
+ break;
+ case FN_MAILMERGE_WIZARD:
+ {
+ rtl::Reference< SwMailMergeWizardExecutor > xEx( new SwMailMergeWizardExecutor );
+ xEx->ExecuteMailMergeWizard( pArgs );
+ }
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Notifies abfangen
+ --------------------------------------------------------------------*/
+
+
+ // Hint abfangen fuer DocInfo
+void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+{
+ if( rHint.ISA( SfxEventHint ) )
+ {
+ SfxEventHint& rEvHint = (SfxEventHint&) rHint;
+ SwDocShell* pDocSh = PTR_CAST( SwDocShell, rEvHint.GetObjShell() );
+ if( pDocSh )
+ {
+ SwWrtShell* pWrtSh = pDocSh ? pDocSh->GetWrtShell() : 0;
+ switch( rEvHint.GetEventId() )
+ {
+/* MA 07. Mar. 96: UpdateInputFlds() nur noch bei Dokument neu.
+ (Und bei Einfuegen Textbaust.)
+ case SFX_EVENT_OPENDOC:
+ // dann am aktuellen Dokument die Input-Fedler updaten
+ if( pWrtSh )
+ pWrtSh->UpdateInputFlds();
+ break;
+*/
+ case SFX_EVENT_CREATEDOC:
+ // alle FIX-Date/Time Felder auf akt. setzen
+ if( pWrtSh )
+ {
+ SFX_ITEMSET_ARG( pDocSh->GetMedium()->GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
+ sal_Bool bUpdateFields = sal_True;
+ if( pUpdateDocItem && pUpdateDocItem->GetValue() == document::UpdateDocMode::NO_UPDATE)
+ bUpdateFields = sal_False;
+ pWrtSh->SetFixFields();
+ if(bUpdateFields)
+ {
+ pWrtSh->UpdateInputFlds();
+
+ // Sind Datenbankfelder enthalten?
+ // Erstmal alle verwendeten Datenbanken holen
+ SwDoc *pDoc = pDocSh->GetDoc();
+ SvStringsDtor aDBNameList;
+ pDoc->GetAllUsedDB( aDBNameList );
+ sal_uInt16 nCount = aDBNameList.Count();
+ if (nCount)
+ { // Datenbankbeamer oeffnen
+ ShowDBObj(pWrtSh->GetView(), pDoc->GetDBData());
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ else if(rHint.ISA(SfxItemSetHint))
+ {
+ if( SFX_ITEM_SET == ((SfxItemSetHint&)rHint).GetItemSet().GetItemState(SID_ATTR_PATHNAME))
+ {
+ ::GetGlossaries()->UpdateGlosPath( sal_False );
+ SwGlossaryList* pList = ::GetGlossaryList();
+ if(pList->IsActive())
+ pList->Update();
+ }
+ }
+ else if(rHint.ISA(SfxSimpleHint))
+ {
+ USHORT nHintId = ((SfxSimpleHint&)rHint).GetId();
+ if(SFX_HINT_DEINITIALIZING == nHintId)
+ {
+ DELETEZ(pWebUsrPref);
+ DELETEZ(pUsrPref) ;
+ DELETEZ(pModuleConfig);
+ DELETEZ(pPrtOpt) ;
+ DELETEZ(pWebPrtOpt) ;
+ DELETEZ(pChapterNumRules);
+ DELETEZ(pStdFontConfig) ;
+ DELETEZ(pNavigationConfig) ;
+ DELETEZ(pToolbarConfig) ;
+ DELETEZ(pWebToolbarConfig) ;
+ DELETEZ(pAuthorNames) ;
+ DELETEZ(pDBConfig);
+ if( pColorConfig )
+ {
+ pColorConfig->RemoveListener(this);
+ DELETEZ(pColorConfig);
+ }
+ if( pAccessibilityOptions )
+ {
+ pAccessibilityOptions->RemoveListener(this);
+ DELETEZ(pAccessibilityOptions);
+ }
+ if( pCTLOptions )
+ {
+ pCTLOptions->RemoveListener(this);
+ DELETEZ(pCTLOptions);
+ }
+ if( pUserOptions )
+ {
+ pUserOptions->RemoveListener(this);
+ DELETEZ(pUserOptions);
+ }
+ if( pUndoOptions )
+ {
+ pUndoOptions->RemoveListener(this);
+ DELETEZ(pUndoOptions);
+ }
+ }
+ }
+}
+
+void SwModule::ConfigurationChanged( utl::ConfigurationBroadcaster* pBrdCst, sal_uInt32 )
+{
+ if( pBrdCst == pUserOptions )
+ {
+ bAuthorInitialised = FALSE;
+ }
+ else if( pBrdCst == pUndoOptions )
+ {
+ sal_Int32 const nNew = GetUndoOptions().GetUndoCount();
+ bool const bUndo = (nNew != 0);
+ // switch Undo for all DocShells
+ TypeId aType(TYPE(SwDocShell));
+ SwDocShell * pDocShell =
+ static_cast<SwDocShell *>(SfxObjectShell::GetFirst(&aType));
+ while (pDocShell)
+ {
+ pDocShell->GetDoc()->GetIDocumentUndoRedo().DoUndo(bUndo);
+ pDocShell = static_cast<SwDocShell *>(
+ SfxObjectShell::GetNext(*pDocShell, &aType));
+ }
+ }
+ else if ( pBrdCst == pColorConfig || pBrdCst == pAccessibilityOptions )
+ {
+ sal_Bool bAccessibility = sal_False;
+ if( pBrdCst == pColorConfig )
+ SwViewOption::ApplyColorConfigValues(*pColorConfig);
+ else
+ bAccessibility = sal_True;
+
+ //invalidate all edit windows
+ const TypeId aSwViewTypeId = TYPE(SwView);
+ const TypeId aSwPreViewTypeId = TYPE(SwPagePreView);
+ const TypeId aSwSrcViewTypeId = TYPE(SwSrcView);
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while(pViewShell)
+ {
+ if(pViewShell->GetWindow())
+ {
+ if((pViewShell->IsA(aSwViewTypeId) ||
+ pViewShell->IsA(aSwPreViewTypeId) ||
+ pViewShell->IsA(aSwSrcViewTypeId)))
+ {
+ if(bAccessibility)
+ {
+ if(pViewShell->IsA(aSwViewTypeId))
+ ((SwView*)pViewShell)->ApplyAccessiblityOptions(*pAccessibilityOptions);
+ else if(pViewShell->IsA(aSwPreViewTypeId))
+ ((SwPagePreView*)pViewShell)->ApplyAccessiblityOptions(*pAccessibilityOptions);
+ }
+ pViewShell->GetWindow()->Invalidate();
+ }
+ }
+ pViewShell = SfxViewShell::GetNext( *pViewShell );
+ }
+ }
+ else if( pBrdCst == pCTLOptions )
+ {
+ const SfxObjectShell* pObjSh = SfxObjectShell::GetFirst();
+ while( pObjSh )
+ {
+ if( pObjSh->IsA(TYPE(SwDocShell)) )
+ {
+ const SwDoc* pDoc = ((SwDocShell*)pObjSh)->GetDoc();
+ ViewShell* pVSh = 0;
+ pDoc->GetEditShell( &pVSh );
+ if ( pVSh )
+ pVSh->ChgNumberDigits();
+ }
+ pObjSh = SfxObjectShell::GetNext(*pObjSh);
+ }
+ }
+
+}
+
+/* -----------------------------20.02.01 12:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwDBConfig* SwModule::GetDBConfig()
+{
+ if(!pDBConfig)
+ pDBConfig = new SwDBConfig;
+ return pDBConfig;
+}
+/* -----------------------------11.04.2002 15:27------------------------------
+
+ ---------------------------------------------------------------------------*/
+svtools::ColorConfig& SwModule::GetColorConfig()
+{
+ if(!pColorConfig)
+ {
+ pColorConfig = new svtools::ColorConfig;
+ SwViewOption::ApplyColorConfigValues(*pColorConfig);
+ pColorConfig->AddListener(this);
+ }
+ return *pColorConfig;
+}
+/* -----------------------------06.05.2002 09:42------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvtAccessibilityOptions& SwModule::GetAccessibilityOptions()
+{
+ if(!pAccessibilityOptions)
+ {
+ pAccessibilityOptions = new SvtAccessibilityOptions;
+ pAccessibilityOptions->AddListener(this);
+ }
+ return *pAccessibilityOptions;
+}
+/* -----------------06.05.2003 14:52-----------------
+
+ --------------------------------------------------*/
+SvtCTLOptions& SwModule::GetCTLOptions()
+{
+ if(!pCTLOptions)
+ {
+ pCTLOptions = new SvtCTLOptions;
+ pCTLOptions->AddListener(this);
+ }
+ return *pCTLOptions;
+}
+/* -----------------07.07.2003 09:31-----------------
+
+ --------------------------------------------------*/
+SvtUserOptions& SwModule::GetUserOptions()
+{
+ if(!pUserOptions)
+ {
+ pUserOptions = new SvtUserOptions;
+ pUserOptions->AddListener(this);
+ }
+ return *pUserOptions;
+}
+/* -----------------18.07.2003 13:31-----------------
+
+ --------------------------------------------------*/
+SvtUndoOptions& SwModule::GetUndoOptions()
+{
+ if(!pUndoOptions)
+ {
+ pUndoOptions = new SvtUndoOptions;
+ pUndoOptions->AddListener(this);
+ }
+ return *pUndoOptions;
+}
+/*-----------------30.01.97 08.30-------------------
+
+--------------------------------------------------*/
+const SwMasterUsrPref *SwModule::GetUsrPref(sal_Bool bWeb) const
+{
+ SwModule* pNonConstModule = (SwModule*)this;
+ if(bWeb && !pWebUsrPref)
+ {
+ // im Load der SwMasterUsrPref wird der SpellChecker gebraucht, dort darf
+ // er aber nicht angelegt werden #58256#
+ pNonConstModule->pWebUsrPref = new SwMasterUsrPref(TRUE);
+ }
+ else if(!bWeb && !pUsrPref)
+ {
+ pNonConstModule->pUsrPref = new SwMasterUsrPref(FALSE);
+ }
+ return bWeb ? pWebUsrPref : pUsrPref;
+}
+
+
+
+void NewXForms( SfxRequest& rReq )
+{
+ // copied & excerpted from SwModule::InsertLab(..)
+
+ // create new document
+ SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD) );
+ xDocSh->DoInitNew( 0 );
+
+ // initialize XForms
+ static_cast<SwDocShell*>( &xDocSh )->GetDoc()->initXForms( true );
+
+ // load document into frame
+ SfxViewFrame::DisplayNewDocument( *xDocSh, rReq );
+
+ // set return value
+ rReq.SetReturnValue( SfxVoidItem( rReq.GetSlot() ) );
+}
diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx
new file mode 100644
index 000000000000..1bbdfc71eeb4
--- /dev/null
+++ b/sw/source/ui/app/applab.cxx
@@ -0,0 +1,457 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+
+#include <hintids.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <editeng/pbinitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/paperinf.hxx>
+#include <editeng/protitem.hxx>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <fmthdft.hxx>
+#include <fmtanchr.hxx>
+#include <fmtfsize.hxx>
+#include <fmtornt.hxx>
+#include <swwait.hxx>
+#include <gloshdl.hxx>
+#include <mdiexp.hxx>
+#include <frmatr.hxx>
+#include <paratr.hxx>
+#include <swmodule.hxx>
+#include <view.hxx>
+#include <docsh.hxx>
+#include <fldbas.hxx>
+#include <swundo.hxx>
+#include <wrtsh.hxx>
+#include <cmdid.h>
+#include <dbmgr.hxx>
+#include <fmtcol.hxx>
+#include <expfld.hxx>
+#include <fldmgr.hxx>
+#include <label.hxx>
+#include <labimg.hxx>
+#include <section.hxx>
+#include <pagedesc.hxx>
+#include <poolfmt.hxx>
+
+#ifndef _APP_HRC
+#include <app.hrc>
+#endif
+#ifndef _POOLFMT_HRC
+#include <poolfmt.hrc>
+#endif
+#include "swabstdlg.hxx"
+#include "envelp.hrc"
+#include <misc.hrc>
+
+#include <IDocumentDeviceAccess.hxx>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+// steht im appenv.cxx
+extern String InsertLabEnvText( SwWrtShell& , SwFldMgr& , const String& );
+
+const char __FAR_DATA MASTER_LABEL[] = "MasterLabel";
+
+// --------------------------------------------------------------------------
+
+const SwFrmFmt *lcl_InsertBCText( SwWrtShell& rSh, const SwLabItem& rItem,
+ SwFrmFmt &rFmt,
+ sal_uInt16 nCol, sal_uInt16 nRow, sal_Bool bPage)
+{
+ SfxItemSet aSet(rSh.GetAttrPool(), RES_ANCHOR, RES_ANCHOR,
+ RES_VERT_ORIENT, RES_VERT_ORIENT, RES_HORI_ORIENT, RES_HORI_ORIENT, 0 );
+ sal_uInt16 nPhyPageNum, nVirtPageNum;
+ rSh.GetPageNum( nPhyPageNum, nVirtPageNum );
+
+ aSet.Put(SwFmtAnchor(bPage ? FLY_AS_CHAR : FLY_AT_PAGE, nPhyPageNum));
+ if (!bPage)
+ {
+ aSet.Put(SwFmtHoriOrient(rItem.lLeft + nCol * rItem.lHDist,
+ text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
+ aSet.Put(SwFmtVertOrient(rItem.lUpper + nRow * rItem.lVDist,
+ text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
+ }
+ const SwFrmFmt *pFmt = rSh.NewFlyFrm(aSet, sal_True, &rFmt ); // Fly einfuegen
+ ASSERT( pFmt, "Fly not inserted" );
+
+ rSh.UnSelectFrm(); //Rahmen wurde automatisch selektiert
+
+ rSh.SetTxtFmtColl( rSh.GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) );
+
+ //
+ if(!rItem.bSynchron || !(nCol|nRow))
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc( DLG_RENAME_GLOS );
+ if ( fnSetActGroup )
+ (*fnSetActGroup)( rItem.sGlossaryGroup );
+ SwGlossaryHdl* pGlosHdl = rSh.GetView().GetGlosHdl();
+ pGlosHdl->SetCurGroup(rItem.sGlossaryGroup, sal_True);
+ pGlosHdl->InsertGlossary( rItem.sGlossaryBlockName );
+ }
+
+ return pFmt;
+}
+
+const SwFrmFmt *lcl_InsertLabText( SwWrtShell& rSh, const SwLabItem& rItem,
+ SwFrmFmt &rFmt, SwFldMgr& rFldMgr,
+ sal_uInt16 nCol, sal_uInt16 nRow, sal_Bool bLast, sal_Bool bPage)
+{
+ SfxItemSet aSet(rSh.GetAttrPool(), RES_ANCHOR, RES_ANCHOR,
+ RES_VERT_ORIENT, RES_VERT_ORIENT, RES_HORI_ORIENT, RES_HORI_ORIENT, 0 );
+ sal_uInt16 nPhyPageNum, nVirtPageNum;
+ rSh.GetPageNum( nPhyPageNum, nVirtPageNum );
+
+ aSet.Put(SwFmtAnchor(bPage ? FLY_AS_CHAR : FLY_AT_PAGE, nPhyPageNum));
+ if (!bPage)
+ {
+ aSet.Put(SwFmtHoriOrient(rItem.lLeft + nCol * rItem.lHDist,
+ text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
+ aSet.Put(SwFmtVertOrient(rItem.lUpper + nRow * rItem.lVDist,
+ text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
+ }
+ const SwFrmFmt *pFmt = rSh.NewFlyFrm(aSet, sal_True, &rFmt ); // Fly einfuegen
+ ASSERT( pFmt, "Fly not inserted" );
+
+ rSh.UnSelectFrm(); //Rahmen wurde automatisch selektiert
+
+ rSh.SetTxtFmtColl( rSh.GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) );
+
+ // Ggf. "Naechster Datensatz"
+ String sDBName;
+ if( (!rItem.bSynchron || !(nCol|nRow)) && (sDBName = InsertLabEnvText( rSh, rFldMgr, rItem.aWriting )).Len() && !bLast )
+ {
+ sDBName.SetToken( 3, DB_DELIM, String::CreateFromAscii("True"));
+ SwInsertFld_Data aData(TYP_DBNEXTSETFLD, 0, sDBName, aEmptyStr, 0, &rSh );
+ rFldMgr.InsertFld( aData );
+ }
+
+ return pFmt;
+}
+
+// ----------------------------------------------------------------------------
+
+
+void SwModule::InsertLab(SfxRequest& rReq, sal_Bool bLabel)
+{
+static sal_uInt16 nLabelTitleNo = 0;
+static sal_uInt16 nBCTitleNo = 0;
+
+ // DB-Manager anlegen
+ SwNewDBMgr* pNewDBMgr = new SwNewDBMgr;
+
+ // SwLabItem aus Config lesen
+ SwLabCfgItem aLabCfg(bLabel);
+
+ // Dialog hochfahren
+ SfxItemSet aSet( GetPool(), FN_LABEL, FN_LABEL, 0 );
+ aSet.Put( aLabCfg.GetItem() );
+
+ SwAbstractDialogFactory* pDialogFactory = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pDialogFactory, "SwAbstractDialogFactory fail!");
+
+ AbstarctSwLabDlg* pDlg = pDialogFactory->CreateSwLabDlg( 0, aSet, pNewDBMgr, bLabel, DLG_LAB );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+
+ if ( RET_OK == pDlg->Execute() )
+ {
+ // Dialog auslesen, Item in Config speichern
+ const SwLabItem& rItem = (const SwLabItem&) pDlg->
+ GetOutputItemSet()->Get(FN_LABEL);
+ aLabCfg.GetItem() = rItem;
+ aLabCfg.Commit();
+
+ // Neues Dokument erzeugen.
+ SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD));
+ xDocSh->DoInitNew( 0 );
+
+ // Drucker
+ Printer *pPrt = pDlg->GetPrt();
+ if (pPrt)
+ {
+ SwDocShell *pDocSh = (SwDocShell*)(&*xDocSh);
+ pDocSh->getIDocumentDeviceAccess()->setJobsetup(pPrt->GetJobSetup());
+ }
+
+ SfxViewFrame* pViewFrame = SfxViewFrame::DisplayNewDocument( *xDocSh, rReq );
+
+ SwView *pNewView = (SwView*) pViewFrame->GetViewShell();
+ pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird.
+
+ // Dokumenttitel setzen
+ String aTmp;
+ if(bLabel)
+ {
+ aTmp = String(SW_RES( STR_LAB_TITLE));
+ aTmp += String::CreateFromInt32(++nLabelTitleNo );
+ }
+ else
+ {
+ aTmp = pDlg->GetBusinessCardStr();
+ aTmp += String::CreateFromInt32( ++nBCTitleNo );
+ }
+ xDocSh->SetTitle( aTmp );
+
+ pViewFrame->GetFrame().Appear();
+
+ // Shell ermitteln
+ SwWrtShell *pSh = pNewView->GetWrtShellPtr();
+ ASSERT( pSh, "missing WrtShell" );
+
+ { // block for locks the dispatcher!!
+
+ SwWait aWait( (SwDocShell&)*xDocSh, sal_True );
+
+ SET_CURR_SHELL(pSh);
+ pSh->SetLabelDoc(rItem.bSynchron);
+ pSh->DoUndo( sal_False );
+ pSh->StartAllAction();
+
+ pSh->SetNewDoc(); // Performanceprobleme vermeiden
+
+ SwPageDesc aDesc = pSh->GetPageDesc( 0 );
+ SwFrmFmt& rFmt = aDesc.GetMaster();
+
+ // Raender
+ SvxLRSpaceItem aLRMargin( RES_LR_SPACE );
+ SvxULSpaceItem aULMargin( RES_UL_SPACE );
+ aLRMargin.SetLeft ((sal_uInt16) rItem.lLeft );
+ aULMargin.SetUpper((sal_uInt16) rItem.lUpper);
+ aLRMargin.SetRight(MINLAY/2);
+ aULMargin.SetLower(MINLAY/2);
+ rFmt.SetFmtAttr(aLRMargin);
+ rFmt.SetFmtAttr(aULMargin);
+
+ // Kopf- und Fusszeilen
+ rFmt.SetFmtAttr(SwFmtHeader(sal_Bool(sal_False)));
+ aDesc.ChgHeaderShare(sal_False);
+ rFmt.SetFmtAttr(SwFmtFooter(sal_Bool(sal_False)));
+ aDesc.ChgFooterShare(sal_False);
+
+
+ aDesc.SetUseOn(nsUseOnPage::PD_ALL); // Seitennumerierung
+
+ // Einstellen der Seitengroesse
+ rFmt.SetFmtAttr(SwFmtFrmSize(ATT_FIX_SIZE,
+ rItem.lLeft + rItem.nCols * rItem.lHDist + MINLAY,
+ rItem.lUpper + rItem.nRows * rItem.lVDist + MINLAY));
+
+ // Numerierungsart
+ SvxNumberType aType;
+ aType.SetNumberingType(SVX_NUM_NUMBER_NONE);
+ aDesc.SetNumType( aType );
+
+ // Folgevorlage
+ const SwPageDesc &rFollow = pSh->GetPageDesc( pSh->GetCurPageDesc() );
+ aDesc.SetFollow( &rFollow );
+
+ pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( true );
+ SvxPaperBinItem aItem( RES_PAPER_BIN );
+ aItem.SetValue((sal_Int8)pPrt->GetPaperBin());
+ rFmt.SetFmtAttr(aItem);
+
+ //determine orientation by calculating the width and height of the resulting page
+ const int nResultWidth = rItem.lHDist * (rItem.nCols - 1) + rItem.lWidth + rItem.lLeft;
+ const int nResultHeight = rItem.lVDist * (rItem.nRows - 1) + rItem.lHeight + rItem.lUpper;
+ aDesc.SetLandscape(nResultWidth > nResultHeight);
+
+ pSh->ChgPageDesc( 0, aDesc );
+
+ // Rahmen einfuegen
+ SwFldMgr* pFldMgr = new SwFldMgr;
+ pFldMgr->SetEvalExpFlds(sal_False);
+
+ //fix(24446): Damit der Text der Ettiketten nicht im unbedruckbaren
+ //Bereich landet stellen wir entsprechende Raender ein. Um das Handling
+ //so Optimal wie moeglich zu halten stellen wir zunaechst an der
+ //aktuellen Absatzvorlage keinen Rand als hartes Attribut ein (Damit die
+ //Formatierung wg. der Zeichengeb. Rahmen passt. Dann stellen wir die
+ //Standarabsatzvorlage anhand des unbedruckbaren Bereiches ein.
+ const long nMin = pPrt->GetPageOffset().X() - rItem.lLeft;
+ if ( nMin > 0 )
+ {
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ pSh->SetAttr( aLR );
+ SwFmt *pStandard = pSh->GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
+ aLR.SetLeft ( sal_uInt16(nMin) );
+ aLR.SetRight( sal_uInt16(nMin) );
+ pStandard->SetFmtAttr( aLR );
+ }
+
+ // Rahmenvorlage vorbereiten
+ SwFrmFmt* pFmt = pSh->GetFrmFmtFromPool( RES_POOLFRM_LABEL );
+ SwFmtFrmSize aFrmSize( ATT_FIX_SIZE,
+ rItem.lHDist - (rItem.lHDist-rItem.lWidth),
+ rItem.lVDist - (rItem.lVDist-rItem.lHeight));
+ pFmt->SetFmtAttr(aFrmSize);
+
+ SvxLRSpaceItem aFrmLRSpace( 0, (sal_uInt16)(rItem.lHDist - rItem.lWidth),
+ 0, 0,
+ RES_LR_SPACE);
+ pFmt->SetFmtAttr(aFrmLRSpace);
+
+ SvxULSpaceItem aFrmULSpace( 0, (sal_uInt16)(rItem.lVDist - rItem.lHeight),
+ RES_UL_SPACE);
+ pFmt->SetFmtAttr(aFrmULSpace);
+
+ const SwFrmFmt *pFirstFlyFmt = 0;
+ if ( rItem.bPage )
+ {
+ SwFmtVertOrient aFrmVertOrient( pFmt->GetVertOrient() );
+ aFrmVertOrient.SetVertOrient( text::VertOrientation::TOP );
+ pFmt->SetFmtAttr(aFrmVertOrient);
+
+ for ( sal_uInt16 i = 0; i < rItem.nRows; ++i )
+ {
+ for ( sal_uInt16 j = 0; j < rItem.nCols; ++j )
+ {
+ pSh->Push();
+ const SwFrmFmt *pTmp =
+ bLabel ?
+ lcl_InsertLabText( *pSh, rItem, *pFmt, *pFldMgr, j, i,
+ i == rItem.nRows - 1 && j == rItem.nCols - 1,
+ sal_True ) :
+ lcl_InsertBCText(*pSh, rItem, *pFmt, j, i, sal_True);
+ if (!(i|j))
+ {
+ pFirstFlyFmt = pTmp;
+
+ if (rItem.bSynchron)
+ {
+ // if there is no content in the fly then
+ // dont leave the fly!!!
+ pSh->Push();
+ pSh->SttDoc();
+ sal_Bool bInFly = 0 != pSh->WizzardGetFly();
+ pSh->Pop( bInFly );
+
+ if( bInFly )
+ pSh->EndDoc(sal_True); // select all content
+ // in the fly
+ else
+ pSh->SetMark(); // set only the mark
+
+ SwSectionData aSect(CONTENT_SECTION,
+ String::CreateFromAscii(MASTER_LABEL));
+ pSh->InsertSection(aSect);
+ }
+ }
+ else if (rItem.bSynchron)
+ {
+ SwSectionData aSect(FILE_LINK_SECTION,
+ pSh->GetUniqueSectionName());
+ String sLinkName(sfx2::cTokenSeperator);
+ sLinkName += sfx2::cTokenSeperator;
+ sLinkName += String::CreateFromAscii(MASTER_LABEL);
+ aSect.SetLinkFileName(sLinkName);
+ aSect.SetProtectFlag(true);
+ pSh->Insert(aDotStr); // Dummytext zum Zuweisen der Section
+ pSh->SttDoc();
+ pSh->EndDoc(sal_True); // Alles im Rahmen selektieren
+ pSh->InsertSection(aSect);
+ }
+ pSh->Pop( sal_False );
+ }
+ if ( i + 1 != rItem.nRows )
+ pSh->SplitNode(); // Kleine Optimierung
+ }
+ }
+ else
+ {
+ pFirstFlyFmt = bLabel ?
+ lcl_InsertLabText( *pSh, rItem, *pFmt, *pFldMgr,
+ static_cast< sal_uInt16 >(rItem.nCol - 1),
+ static_cast< sal_uInt16 >(rItem.nRow - 1), sal_True, sal_False ) :
+ lcl_InsertBCText(*pSh, rItem, *pFmt,
+ static_cast< sal_uInt16 >(rItem.nCol - 1),
+ static_cast< sal_uInt16 >(rItem.nRow - 1), sal_False);
+ }
+
+ //fill the user fields
+ if(!bLabel)
+ {
+ uno::Reference< frame::XModel > xModel = pSh->GetView().GetDocShell()->GetBaseModel();
+ DBG_ASSERT(pDialogFactory, "SwAbstractDialogFactory fail!");
+ SwLabDlgMethod SwLabDlgUpdateFieldInformation = pDialogFactory->GetSwLabDlgStaticMethod ();
+ SwLabDlgUpdateFieldInformation(xModel, rItem);
+ }
+
+ pFldMgr->SetEvalExpFlds(sal_True);
+ pFldMgr->EvalExpFlds(pSh);
+
+ delete pFldMgr;
+
+ pSh->GotoFly(pFirstFlyFmt->GetName(), FLYCNTTYPE_ALL, sal_False);
+
+ pSh->EndAllAction();
+ pSh->DoUndo( sal_True );
+ }
+
+ if( rItem.aWriting.indexOf( '<' ) >= 0 )
+ {
+ // Datenbankbrowser mit zuletzt verwendeter Datenbank oeffnen
+ ShowDBObj( *pNewView, pSh->GetDBData() );
+ }
+
+ if( rItem.bSynchron )
+ {
+ SfxDispatcher* pDisp = pViewFrame->GetDispatcher();
+ ASSERT(pDisp, "Heute kein Dispatcher am Frame?");
+ pDisp->Execute(FN_SYNC_LABELS, SFX_CALLMODE_ASYNCHRON);
+ }
+ rReq.SetReturnValue(SfxVoidItem(bLabel ? FN_LABEL : FN_BUSINESS_CARD));
+ }
+ delete pDlg;
+
+ if( pNewDBMgr )
+ delete pNewDBMgr;
+}
+
+
diff --git a/sw/source/ui/app/appopt.cxx b/sw/source/ui/app/appopt.cxx
new file mode 100644
index 000000000000..0b6b728f18f7
--- /dev/null
+++ b/sw/source/ui/app/appopt.cxx
@@ -0,0 +1,646 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+
+#include <com/sun/star/i18n/ScriptType.hpp>
+
+#include <hintids.hxx>
+#include <cmdid.h> // Funktion-Ids
+#include <vcl/msgbox.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/printer.hxx>
+#include <svx/htmlmode.hxx>
+#include <sfx2/bindings.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <svx/optgrid.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <i18npool/mslangid.hxx>
+#include <fontcfg.hxx>
+#include <optload.hxx>
+#include <optcomp.hxx>
+#include <edtwin.hxx>
+#include <swmodule.hxx>
+#include <view.hxx>
+#include <doc.hxx>
+#include <wrtsh.hxx>
+#include <IDocumentDeviceAccess.hxx>
+#include <uitool.hxx>
+#include <initui.hxx> // fuer ::GetGlossaries()
+#include <fldbas.hxx> //fuer UpdateFields
+#include <wview.hxx>
+#include <cfgitems.hxx>
+#include <prtopt.hxx>
+#include <pview.hxx>
+#include <usrpref.hxx>
+#include <modcfg.hxx>
+#include <glosdoc.hxx>
+#include <uiitems.hxx>
+#include <editeng/langitem.hxx>
+#include <unotools/lingucfg.hxx>
+#include <editeng/unolingu.hxx>
+#include <globals.hrc>
+#include <globals.h> // globale Konstanten z.B.
+#include <svl/slstitm.hxx>
+#include "swabstdlg.hxx"
+#include <swwrtshitem.hxx>
+
+#include <unomid.h>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+/* -----------------12.02.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+
+SfxItemSet* SwModule::CreateItemSet( USHORT nId )
+{
+ BOOL bTextDialog = (nId == SID_SW_EDITOPTIONS) ? TRUE : FALSE;
+
+ // hier werden die Optionen fuer die Web- und den Textdialog zusmmengesetzt
+ SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
+ SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
+ //kein MakeUsrPref, da hier nur die Optionen von Textdoks genommen werden duerfen
+ SwView* pAppView = GetView();
+ if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
+ pAppView = 0;
+ if(pAppView)
+ {
+ // wenn Text dann nicht WebView und umgekehrt
+ BOOL bWebView = 0 != PTR_CAST(SwWebView, pAppView);
+ if( (bWebView && !bTextDialog) ||(!bWebView && bTextDialog))
+ {
+ aViewOpt = *pAppView->GetWrtShell().GetViewOptions();
+ }
+ else
+ pAppView = 0; // mit View kann hier nichts gewonnen werden
+ }
+
+ /********************************************************************/
+ /* */
+ /* Optionen/Bearbeiten */
+ /* */
+ /********************************************************************/
+ SfxItemSet* pRet = new SfxItemSet (GetPool(), FN_PARAM_DOCDISP, FN_PARAM_ELEM,
+ SID_PRINTPREVIEW, SID_PRINTPREVIEW,
+ SID_ATTR_GRID_OPTIONS, SID_ATTR_GRID_OPTIONS,
+ FN_PARAM_PRINTER, FN_PARAM_STDFONTS,
+ FN_PARAM_WRTSHELL, FN_PARAM_WRTSHELL,
+ FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
+ SID_ATTR_METRIC, SID_ATTR_METRIC,
+ SID_ATTR_DEFTABSTOP, SID_ATTR_DEFTABSTOP,
+ RES_BACKGROUND, RES_BACKGROUND,
+ SID_HTML_MODE, SID_HTML_MODE,
+ FN_PARAM_SHADOWCURSOR, FN_PARAM_SHADOWCURSOR,
+ FN_PARAM_CRSR_IN_PROTECTED, FN_PARAM_CRSR_IN_PROTECTED,
+ FN_HSCROLL_METRIC, FN_VSCROLL_METRIC,
+ SID_ATTR_LANGUAGE, SID_ATTR_LANGUAGE,
+ SID_ATTR_CHAR_CJK_LANGUAGE, SID_ATTR_CHAR_CJK_LANGUAGE,
+ SID_ATTR_CHAR_CTL_LANGUAGE, SID_ATTR_CHAR_CTL_LANGUAGE,
+#ifdef DBG_UTIL
+ FN_PARAM_SWTEST, FN_PARAM_SWTEST,
+#endif
+ 0);
+
+ pRet->Put( SwDocDisplayItem( aViewOpt, FN_PARAM_DOCDISP) );
+ pRet->Put( SwElemItem( aViewOpt, FN_PARAM_ELEM) );
+ if( bTextDialog )
+ {
+ pRet->Put( SwShadowCursorItem( aViewOpt, FN_PARAM_SHADOWCURSOR ));
+ pRet->Put( SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aViewOpt.IsCursorInProtectedArea()));
+ }
+
+ if( pAppView )
+ {
+ SwWrtShell& rWrtShell = pAppView->GetWrtShell();
+
+ SfxPrinter* pPrt = rWrtShell.getIDocumentDeviceAccess()->getPrinter( false );
+ if( pPrt )
+ pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));
+ pRet->Put(SwPtrItem(FN_PARAM_WRTSHELL, &rWrtShell));
+
+ pRet->Put((const SvxLanguageItem&)
+ rWrtShell.GetDefault(RES_CHRATR_LANGUAGE), SID_ATTR_LANGUAGE);
+
+ pRet->Put((const SvxLanguageItem&)
+ rWrtShell.GetDefault(RES_CHRATR_CJK_LANGUAGE), SID_ATTR_CHAR_CJK_LANGUAGE);
+
+ pRet->Put((const SvxLanguageItem&)
+ rWrtShell.GetDefault(RES_CHRATR_CTL_LANGUAGE), SID_ATTR_CHAR_CTL_LANGUAGE);
+ }
+ else
+ {
+/* Der Drucker wird jetzt von der TabPage erzeugt und auch geloescht
+ * SfxItemSet* pSet = new SfxItemSet( SFX_APP()->GetPool(),
+ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+ 0 );
+
+ pPrt = new SfxPrinter(pSet);
+ pRet->Put(SwPtrItem(FN_PARAM_PRINTER, pPrt));*/
+
+ SvtLinguConfig aLinguCfg;
+ Locale aLocale;
+ LanguageType nLang;
+
+ using namespace ::com::sun::star::i18n::ScriptType;
+
+ Any aLang = aLinguCfg.GetProperty(C2U("DefaultLocale"));
+ aLang >>= aLocale;
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), LATIN);
+ pRet->Put(SvxLanguageItem(nLang, SID_ATTR_LANGUAGE));
+
+ aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CJK"));
+ aLang >>= aLocale;
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), ASIAN);
+ pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CJK_LANGUAGE));
+
+ aLang = aLinguCfg.GetProperty(C2U("DefaultLocale_CTL"));
+ aLang >>= aLocale;
+ nLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aLocale), COMPLEX);
+ pRet->Put(SvxLanguageItem(nLang, SID_ATTR_CHAR_CTL_LANGUAGE));
+ }
+ if(bTextDialog)
+ pRet->Put(SwPtrItem(FN_PARAM_STDFONTS, GetStdFontConfig()));
+ if( PTR_CAST( SwPagePreView, SfxViewShell::Current())!=0)
+ {
+ SfxBoolItem aBool(SfxBoolItem(SID_PRINTPREVIEW, TRUE));
+ pRet->Put(aBool);
+ }
+
+ FieldUnit eUnit = pPref->GetHScrollMetric();
+ if(pAppView)
+ pAppView->GetHLinealMetric(eUnit);
+ pRet->Put(SfxUInt16Item( FN_HSCROLL_METRIC, static_cast< UINT16 >(eUnit)));
+
+ eUnit = pPref->GetVScrollMetric();
+ if(pAppView)
+ pAppView->GetVLinealMetric(eUnit);
+ pRet->Put(SfxUInt16Item( FN_VSCROLL_METRIC, static_cast< UINT16 >(eUnit) ));
+ pRet->Put(SfxUInt16Item( SID_ATTR_METRIC, static_cast< UINT16 >(pPref->GetMetric()) ));
+ if(bTextDialog)
+ {
+ if(pAppView)
+ {
+ const SvxTabStopItem& rDefTabs =
+ (const SvxTabStopItem&)pAppView->GetWrtShell().
+ GetDefault(RES_PARATR_TABSTOP);
+ pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP, (USHORT)::GetTabDist(rDefTabs)));
+ }
+ else
+ pRet->Put(SfxUInt16Item( SID_ATTR_DEFTABSTOP, (UINT16)pPref->GetDefTab()));
+ }
+
+ /*-----------------01.02.97 11.13-------------------
+ Optionen fuer GridTabPage
+ --------------------------------------------------*/
+
+ SvxGridItem aGridItem( SID_ATTR_GRID_OPTIONS);
+
+ aGridItem.SetUseGridSnap( aViewOpt.IsSnap());
+ aGridItem.SetSynchronize( aViewOpt.IsSynchronize());
+ aGridItem.SetGridVisible( aViewOpt.IsGridVisible());
+
+ const Size& rSnapSize = aViewOpt.GetSnapSize();
+ aGridItem.SetFldDrawX( (USHORT) (rSnapSize.Width() ));
+ aGridItem.SetFldDrawY( (USHORT) (rSnapSize.Height()));
+
+ aGridItem.SetFldDivisionX( aViewOpt.GetDivisionX());
+ aGridItem.SetFldDivisionY( aViewOpt.GetDivisionY());
+
+ pRet->Put(aGridItem);
+
+ /*-----------------01.02.97 13.02-------------------
+ Optionen fuer PrintTabPage
+ --------------------------------------------------*/
+ const SwPrintData* pOpt = pAppView ?
+ &pAppView->GetWrtShell().getIDocumentDeviceAccess()->getPrintData() :
+ 0;
+
+ if(!pOpt)
+ pOpt = GetPrtOptions(!bTextDialog);
+
+ SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, *pOpt );
+ pRet->Put(aAddPrinterItem);
+
+ /*-----------------01.02.97 13.12-------------------
+ Optionen fuer Web-Hintergrund
+ --------------------------------------------------*/
+ if(!bTextDialog)
+ {
+ pRet->Put(SvxBrushItem(aViewOpt.GetRetoucheColor(), RES_BACKGROUND));
+ }
+
+#ifdef DBG_UTIL
+ /*-----------------01.02.97 13.02-------------------
+ Test-Optionen
+ --------------------------------------------------*/
+ SwTestItem aTestItem(FN_PARAM_SWTEST);
+ aTestItem.bTest1 = aViewOpt.IsTest1();
+ aTestItem.bTest2 = aViewOpt.IsTest2();
+ aTestItem.bTest3 = aViewOpt.IsTest3();
+ aTestItem.bTest4 = aViewOpt.IsTest4();
+ aTestItem.bTest5 = aViewOpt.IsTest5();
+ aTestItem.bTest6 = aViewOpt.IsTest6();
+ aTestItem.bTest7 = aViewOpt.IsTest7();
+ aTestItem.bTest8 = aViewOpt.IsTest8();
+ aTestItem.bTest9 = SwViewOption::IsTest9();
+ aTestItem.bTest10 = aViewOpt.IsTest10();
+ pRet->Put(aTestItem);
+#endif
+ /*-----------------01.02.97 13.04-------------------
+
+ --------------------------------------------------*/
+ if(!bTextDialog)
+ pRet->Put(SfxUInt16Item(SID_HTML_MODE, HTMLMODE_ON));
+// delete pPrt;
+ return pRet;
+}
+/* -----------------12.02.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet )
+{
+ BOOL bTextDialog = nId == SID_SW_EDITOPTIONS;
+ SwView* pAppView = GetView();
+ if(pAppView && pAppView->GetViewFrame() != SfxViewFrame::Current())
+ pAppView = 0;
+ if(pAppView)
+ {
+ // the text dialog mustn't apply data to the web view and vice versa
+ BOOL bWebView = 0 != PTR_CAST(SwWebView, pAppView);
+ if( (bWebView == bTextDialog))
+ pAppView = 0; //
+ }
+
+ SwViewOption aViewOpt = *GetUsrPref(!bTextDialog);
+ SwMasterUsrPref* pPref = bTextDialog ? pUsrPref : pWebUsrPref;
+
+ const SfxPoolItem* pItem;
+ SfxBindings *pBindings = pAppView ? &pAppView->GetViewFrame()->GetBindings()
+ : NULL;
+
+ /*---------------------------------------------------------------------
+ Seite Dokumentansicht auswerten
+ -----------------------------------------------------------------------*/
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_DOCDISP, FALSE, &pItem ))
+ {
+ const SwDocDisplayItem* pDocDispItem = (const SwDocDisplayItem*)pItem;
+
+ if(!aViewOpt.IsViewMetaChars())
+ {
+ if( (!aViewOpt.IsTab( TRUE ) && pDocDispItem->bTab) ||
+ (!aViewOpt.IsBlank( TRUE ) && pDocDispItem->bSpace) ||
+ (!aViewOpt.IsParagraph( TRUE ) && pDocDispItem->bParagraphEnd) ||
+ (!aViewOpt.IsLineBreak( TRUE ) && pDocDispItem->bManualBreak) )
+ {
+ aViewOpt.SetViewMetaChars(TRUE);
+ if(pBindings)
+ pBindings->Invalidate(FN_VIEW_META_CHARS);
+ }
+
+ }
+ pDocDispItem->FillViewOptions( aViewOpt );
+ if(pBindings)
+ {
+ pBindings->Invalidate(FN_VIEW_GRAPHIC);
+ pBindings->Invalidate(FN_VIEW_HIDDEN_PARA);
+ }
+ }
+
+ /*---------------------------------------------------------------------
+ Elemente - Item auswerten
+ -----------------------------------------------------------------------*/
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ELEM, FALSE, &pItem ) )
+ {
+ const SwElemItem* pElemItem = (const SwElemItem*)pItem;
+ pElemItem->FillViewOptions( aViewOpt );
+
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_METRIC, FALSE, &pItem ) )
+ {
+ SFX_APP()->SetOptions(rSet);
+ const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
+ ::SetDfltMetric((FieldUnit)pMetricItem->GetValue(), !bTextDialog);
+ }
+ if( SFX_ITEM_SET == rSet.GetItemState(FN_HSCROLL_METRIC, FALSE, &pItem ) )
+ {
+ const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
+ FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
+ pPref->SetHScrollMetric(eUnit);
+ if(pAppView)
+ pAppView->ChangeTabMetric(eUnit);
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(FN_VSCROLL_METRIC, FALSE, &pItem ) )
+ {
+ const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem;
+ FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue();
+ pPref->SetVScrollMetric(eUnit);
+ if(pAppView)
+ pAppView->ChangeVLinealMetric(eUnit);
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP, FALSE, &pItem ) )
+ {
+ USHORT nTabDist = ((const SfxUInt16Item*)pItem)->GetValue();
+ pPref->SetDefTab(nTabDist);
+ if(pAppView)
+ {
+ SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
+ MakeDefTabs( nTabDist, aDefTabs );
+ pAppView->GetWrtShell().SetDefault( aDefTabs );
+ }
+ }
+
+
+ /*-----------------01.02.97 11.36-------------------
+ Hintergrund nur im WebDialog
+ --------------------------------------------------*/
+ if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND))
+ {
+ const SvxBrushItem& rBrushItem = (const SvxBrushItem&)rSet.Get(
+ RES_BACKGROUND);
+ aViewOpt.SetRetoucheColor( rBrushItem.GetColor() );
+ }
+
+ /*--------------------------------------------------------------------
+ Seite Rastereinstellungen auswerten
+ ----------------------------------------------------------------------*/
+
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS, FALSE, &pItem ))
+ {
+ const SvxGridItem* pGridItem = (const SvxGridItem*)pItem;
+
+ aViewOpt.SetSnap( pGridItem->GetUseGridSnap() );
+ aViewOpt.SetSynchronize(pGridItem->GetSynchronize());
+ if( aViewOpt.IsGridVisible() != pGridItem->GetGridVisible() )
+ aViewOpt.SetGridVisible( pGridItem->GetGridVisible());
+ Size aSize = Size( pGridItem->GetFldDrawX() ,
+ pGridItem->GetFldDrawY() );
+ if( aViewOpt.GetSnapSize() != aSize )
+ aViewOpt.SetSnapSize( aSize );
+ short nDiv = (short)pGridItem->GetFldDivisionX() ;
+ if( aViewOpt.GetDivisionX() != nDiv )
+ aViewOpt.SetDivisionX( nDiv );
+ nDiv = (short)pGridItem->GetFldDivisionY();
+ if( aViewOpt.GetDivisionY() != nDiv )
+ aViewOpt.SetDivisionY( nDiv );
+
+ if(pBindings)
+ {
+ pBindings->Invalidate(SID_GRID_VISIBLE);
+ pBindings->Invalidate(SID_GRID_USE);
+ }
+ }
+
+ //--------------------------------------------------------------------------
+ // Writer Drucker Zusatzeinstellungen auswerten
+ //----------------------------------------------------------------------------
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ADDPRINTER, FALSE, &pItem ))
+ {
+ SwPrintOptions* pOpt = GetPrtOptions(!bTextDialog);
+ if (pOpt)
+ {
+ const SwAddPrinterItem* pAddPrinterAttr = (const SwAddPrinterItem*)pItem;
+ *pOpt = *pAddPrinterAttr;
+
+ if(pAppView)
+ pAppView->GetWrtShell().getIDocumentDeviceAccess()->setPrintData( *pOpt );
+ }
+
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, FALSE, &pItem ))
+ {
+ ((SwShadowCursorItem*)pItem)->FillViewOptions( aViewOpt );
+ if(pBindings)
+ pBindings->Invalidate(FN_SHADOWCURSOR);
+ }
+
+ if( pAppView )
+ {
+ SwWrtShell &rWrtSh = pAppView->GetWrtShell();
+ const bool bAlignFormulas = rWrtSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT );
+ pPref->SetAlignMathObjectsToBaseline( bAlignFormulas );
+
+ // don't align formulas in documents that are currently loading
+ if (bAlignFormulas && !rWrtSh.GetDoc()->IsInReading())
+ rWrtSh.AlignAllFormulasToBaseline();
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, FALSE, &pItem ))
+ {
+ aViewOpt.SetCursorInProtectedArea(((const SfxBoolItem*)pItem)->GetValue());
+ }
+
+
+#ifdef DBG_UTIL
+ /*--------------------------------------------------------------------------
+ Writer Testseite auswerten
+ ----------------------------------------------------------------------------*/
+
+ if( SFX_ITEM_SET == rSet.GetItemState(
+ FN_PARAM_SWTEST, FALSE, &pItem ))
+ {
+ const SwTestItem* pTestItem = (const SwTestItem*)pItem;
+ aViewOpt.SetTest1((BOOL)pTestItem->bTest1);
+ aViewOpt.SetTest2((BOOL)pTestItem->bTest2);
+ aViewOpt.SetTest3((BOOL)pTestItem->bTest3);
+ aViewOpt.SetTest4((BOOL)pTestItem->bTest4);
+ aViewOpt.SetTest5((BOOL)pTestItem->bTest5);
+ aViewOpt.SetTest6((BOOL)pTestItem->bTest6);
+ aViewOpt.SetTest7((BOOL)pTestItem->bTest7);
+ aViewOpt.SetTest8((BOOL)pTestItem->bTest8);
+ SwViewOption::SetTest9((BOOL)pTestItem->bTest9);
+ aViewOpt.SetTest10((BOOL)pTestItem->bTest10);
+ }
+#endif
+ // dann an der akt. View und Shell die entsp. Elemente setzen
+ ApplyUsrPref( aViewOpt, pAppView, bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB);
+}
+/* -----------------12.02.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+SfxTabPage* SwModule::CreateTabPage( USHORT nId, Window* pParent, const SfxItemSet& rSet )
+{
+ SfxTabPage* pRet = NULL;
+ SfxAllItemSet aSet(*(rSet.GetPool()));
+ switch( nId )
+ {
+ case RID_SW_TP_CONTENT_OPT:
+ case RID_SW_TP_HTML_CONTENT_OPT:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ break;
+ }
+ case RID_SW_TP_HTML_OPTGRID_PAGE:
+ case RID_SVXPAGE_GRID:
+ pRet = SvxGridTabPage::Create(pParent, rSet);
+ break;
+
+ case RID_SW_TP_STD_FONT:
+ case RID_SW_TP_STD_FONT_CJK:
+ case RID_SW_TP_STD_FONT_CTL:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ if(RID_SW_TP_STD_FONT != nId)
+ {
+ aSet.Put (SfxUInt16Item(SID_FONTMODE_TYPE, RID_SW_TP_STD_FONT_CJK == nId ? FONT_GROUP_CJK : FONT_GROUP_CTL));
+ pRet->PageCreated(aSet);
+ }
+ }
+ break;
+ case RID_SW_TP_HTML_OPTPRINT_PAGE:
+ case RID_SW_TP_OPTPRINT_PAGE:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ aSet.Put (SfxBoolItem(SID_FAX_LIST, sal_True));
+ pRet->PageCreated(aSet);
+ }
+ break;
+ case RID_SW_TP_HTML_OPTTABLE_PAGE:
+ case RID_SW_TP_OPTTABLE_PAGE:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ SwView* pCurrView = GetView();
+ if(pCurrView)
+ {
+ // wenn Text dann nicht WebView und umgekehrt
+ BOOL bWebView = 0 != PTR_CAST(SwWebView, pCurrView);
+ if( (bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE == nId) ||
+ (!bWebView && RID_SW_TP_HTML_OPTTABLE_PAGE != nId) )
+ {
+ aSet.Put (SwWrtShellItem(SID_WRT_SHELL,pCurrView->GetWrtShellPtr()));
+ pRet->PageCreated(aSet);
+ }
+ }
+ }
+ break;
+ case RID_SW_TP_OPTSHDWCRSR:
+ case RID_SW_TP_HTML_OPTSHDWCRSR:
+ case RID_SW_TP_REDLINE_OPT:
+ case RID_SW_TP_OPTLOAD_PAGE:
+ case RID_SW_TP_OPTCOMPATIBILITY_PAGE:
+ case RID_SW_TP_MAILCONFIG:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ if (pRet && (nId == RID_SW_TP_OPTSHDWCRSR || nId == RID_SW_TP_HTML_OPTSHDWCRSR))
+ {
+ SwView* pCurrView = GetView();
+ if(pCurrView)
+ {
+ aSet.Put( SwWrtShellItem( SID_WRT_SHELL, pCurrView->GetWrtShellPtr() ) );
+ pRet->PageCreated(aSet);
+ }
+ }
+ }
+ break;
+#ifdef DBG_UTIL
+ case RID_SW_TP_OPTTEST_PAGE:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( nId );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ break;
+ }
+#endif
+ case RID_SW_TP_BACKGROUND:
+ {
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ break;
+ }
+ case TP_OPTCAPTION_PAGE:
+ case RID_SW_TP_OPTCAPTION_PAGE:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SW_TP_OPTCAPTION_PAGE );
+ if ( fnCreatePage )
+ pRet = (*fnCreatePage)( pParent, rSet );
+ }
+ }
+ break;
+ }
+
+ DBG_ASSERT( pRet, "SwModule::CreateTabPage(): Unknown tabpage id" );
+ return pRet;
+}
+
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx
new file mode 100644
index 000000000000..c1704f21d0f0
--- /dev/null
+++ b/sw/source/ui/app/docsh.cxx
@@ -0,0 +1,1431 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <rtl/logfile.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/jobset.hxx>
+#include <tools/urlobj.hxx>
+#include <svl/whiter.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/PasswordHelper.hxx>
+#include <editeng/adjitem.hxx>
+#include <basic/sbx.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <unotools/misccfg.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/passwd.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/evntconf.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <svl/srchitem.hxx>
+#include <editeng/flstitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <svtools/soerr.hxx>
+#include <sot/clsids.hxx>
+#include <basic/basmgr.hxx>
+#include <basic/sbmod.hxx>
+#include <swevent.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtfsize.hxx>
+#include <fmtfld.hxx>
+#include <node.hxx>
+#include <swwait.hxx>
+#include <printdata.hxx>
+#include <frmatr.hxx>
+#include <view.hxx> // fuer die aktuelle Sicht
+#include <edtwin.hxx>
+#include <PostItMgr.hxx>
+#include <wrtsh.hxx> // Verbindung zur Core
+#include <docsh.hxx> // Dokumenterzeugung
+#include <basesh.hxx>
+#include <viewopt.hxx>
+#include <wdocsh.hxx>
+#include <swmodule.hxx>
+#include <globdoc.hxx>
+#include <usrpref.hxx>
+#include <shellio.hxx> // I/O
+#include <docstyle.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <docstat.hxx>
+#include <pagedesc.hxx>
+#include <pview.hxx>
+#include <mdiexp.hxx>
+#include <swbaslnk.hxx>
+#include <srcview.hxx>
+#include <ndindex.hxx>
+#include <ndole.hxx>
+#include <swcli.hxx>
+#include <txtftn.hxx>
+#include <ftnidx.hxx>
+
+// --> FME 2004-08-05 #i20883# Digital Signatures and Encryption
+#include <fldbas.hxx>
+#include <docary.hxx>
+// <--
+#include <swerror.h> // Fehlermeldungen
+#include <helpid.h>
+#include <cmdid.h>
+#include <globals.hrc>
+#include <app.hrc>
+
+#include <cfgid.h>
+#include <unotools/moduleoptions.hxx>
+#include <unotools/fltrcfg.hxx>
+#include <svtools/htmlcfg.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/objface.hxx>
+#include <comphelper/storagehelper.hxx>
+
+#define SwDocShell
+#include <sfx2/msg.hxx>
+#include <swslots.hxx>
+#include <com/sun/star/document/UpdateDocMode.hpp>
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+#include <unomid.h>
+
+#include <sfx2/Metadatable.hxx>
+
+
+using rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::script;
+using namespace ::com::sun::star::container;
+
+
+SFX_IMPL_INTERFACE( SwDocShell, SfxObjectShell, SW_RES(0) )
+{
+ SFX_CHILDWINDOW_REGISTRATION( SID_HYPERLINK_INSERT );
+}
+
+TYPEINIT2(SwDocShell, SfxObjectShell, SfxListener);
+
+//-------------------------------------------------------------------------
+SFX_IMPL_OBJECTFACTORY(SwDocShell, SvGlobalName(SO3_SW_CLASSID), SFXOBJECTSHELL_STD_NORMAL|SFXOBJECTSHELL_HASMENU, "swriter" )
+
+/*--------------------------------------------------------------------
+ Beschreibung: Laden vorbereiten
+ --------------------------------------------------------------------*/
+
+
+Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr,
+ SwCrsrShell *pCrsrShell,
+ SwPaM* pPaM )
+{
+ BOOL bAPICall = FALSE;
+ const SfxPoolItem* pApiItem;
+ const SfxItemSet* pMedSet;
+ if( 0 != ( pMedSet = rMedium.GetItemSet() ) && SFX_ITEM_SET ==
+ pMedSet->GetItemState( FN_API_CALL, TRUE, &pApiItem ) )
+ bAPICall = ((const SfxBoolItem*)pApiItem)->GetValue();
+
+ const SfxFilter* pFlt = rMedium.GetFilter();
+ if( !pFlt )
+ {
+ if(!bAPICall)
+ {
+ InfoBox( 0, SW_RESSTR(STR_CANTOPEN)).Execute();
+ }
+ return 0;
+ }
+ String aFileName( rMedium.GetName() );
+ SwRead pRead = SwReaderWriter::GetReader( pFlt->GetUserData() );
+ if( !pRead )
+ return 0;
+
+ if( rMedium.IsStorage()
+ ? SW_STORAGE_READER & pRead->GetReaderType()
+ : SW_STREAM_READER & pRead->GetReaderType() )
+ {
+ *ppRdr = pPaM ? new SwReader( rMedium, aFileName, *pPaM ) :
+ pCrsrShell ?
+ new SwReader( rMedium, aFileName, *pCrsrShell->GetCrsr() )
+ : new SwReader( rMedium, aFileName, pDoc );
+ }
+ else
+ return 0;
+
+ // PassWord Checken
+ String aPasswd;
+ if ((*ppRdr)->NeedsPasswd( *pRead ))
+ {
+ if(!bAPICall)
+ {
+ SfxPasswordDialog* pPasswdDlg =
+ new SfxPasswordDialog( 0 );
+ if(RET_OK == pPasswdDlg->Execute())
+ aPasswd = pPasswdDlg->GetPassword();
+ }
+ else
+ {
+ const SfxItemSet* pSet = rMedium.GetItemSet();
+ const SfxPoolItem *pPassItem;
+ if(pSet && SFX_ITEM_SET == pSet->GetItemState(SID_PASSWORD, TRUE, &pPassItem))
+ aPasswd = ((const SfxStringItem *)pPassItem)->GetValue();
+ }
+
+ if (!(*ppRdr)->CheckPasswd( aPasswd, *pRead ))
+ {
+ InfoBox( 0, SW_RES(MSG_ERROR_PASSWD)).Execute();
+ delete *ppRdr;
+ return 0;
+ }
+ }
+
+ // #i30171# set the UpdateDocMode at the SwDocShell
+ SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
+ nUpdateDocMode = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE;
+
+ if( pFlt->GetDefaultTemplate().Len() )
+ pRead->SetTemplateName( pFlt->GetDefaultTemplate() );
+
+ if( pRead == ReadAscii && 0 != rMedium.GetInStream() &&
+ pFlt->GetUserData().EqualsAscii( FILTER_TEXT_DLG ) )
+ {
+ SwAsciiOptions aOpt;
+ const SfxItemSet* pSet;
+ const SfxPoolItem* pItem;
+ if( 0 != ( pSet = rMedium.GetItemSet() ) && SFX_ITEM_SET ==
+ pSet->GetItemState( SID_FILE_FILTEROPTIONS, TRUE, &pItem ) )
+ aOpt.ReadUserData( ((const SfxStringItem*)pItem)->GetValue() );
+
+ if( pRead )
+ pRead->GetReaderOpt().SetASCIIOpts( aOpt );
+ }
+
+ return pRead;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Laden
+ --------------------------------------------------------------------*/
+
+BOOL SwDocShell::ConvertFrom( SfxMedium& rMedium )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::ConvertFrom" );
+
+ SwReader* pRdr;
+ SwRead pRead = StartConvertFrom(rMedium, &pRdr);
+ if (!pRead)
+ return FALSE; // #129881# return if no reader is found
+ SotStorageRef pStg=pRead->getSotStorageRef(); // #i45333# save sot storage ref in case of recursive calls
+
+ SwWait aWait( *this, TRUE );
+
+ // SfxProgress unterdruecken, wenn man Embedded ist
+ SW_MOD()->SetEmbeddedLoadSave(
+ SFX_CREATE_MODE_EMBEDDED == GetCreateMode() );
+
+ pRdr->GetDoc()->set(IDocumentSettingAccess::HTML_MODE, ISA(SwWebDocShell));
+
+ /* #106748# Restore the pool default if reading a saved document. */
+ pDoc->RemoveAllFmtLanguageDependencies();
+
+ ULONG nErr = pRdr->Read( *pRead );
+
+ // Evtl. ein altes Doc weg
+ if ( pDoc != pRdr->GetDoc() )
+ {
+ if( pDoc )
+ RemoveLink();
+ pDoc = pRdr->GetDoc();
+
+ AddLink();
+
+ if ( !mxBasePool.is() )
+ mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
+ }
+
+ UpdateFontList();
+ InitDraw();
+
+ delete pRdr;
+
+ SW_MOD()->SetEmbeddedLoadSave( FALSE );
+
+ SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ BOOL bOk = !IsError( nErr );
+
+ // --> OD 2006-11-07 #i59688#
+// // StartFinishedLoading rufen. Nicht bei asynchronen Filtern!
+// // Diese muessen das selbst rufen!
+// if( bOk && !pDoc->IsInLoadAsynchron() )
+// StartLoadFinishedTimer();
+ if ( bOk && !pDoc->IsInLoadAsynchron() )
+ {
+ LoadingFinished();
+ }
+ // <--
+
+ pRead->setSotStorageRef(pStg); // #i45333# save sot storage ref in case of recursive calls
+
+ return bOk;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sichern des Default-Formats, Stg vorhanden
+ --------------------------------------------------------------------*/
+
+
+BOOL SwDocShell::Save()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::Save" );
+ //#i3370# remove quick help to prevent saving of autocorrection suggestions
+ if(pView)
+ pView->GetEditWin().StopQuickHelp();
+ SwWait aWait( *this, TRUE );
+
+ CalcLayoutForOLEObjects(); // format for OLE objets
+ // --> OD 2006-03-17 #i62875#
+ // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible
+ if ( pWrtShell && pDoc &&
+ pDoc->get(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) &&
+ docfunc::AllDrawObjsOnPage( *pDoc ) )
+ {
+ pDoc->set(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false);
+ }
+ // <--
+
+ ULONG nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE;
+ if( SfxObjectShell::Save() )
+ {
+ switch( GetCreateMode() )
+ {
+ case SFX_CREATE_MODE_INTERNAL:
+ nErr = 0;
+ break;
+
+ case SFX_CREATE_MODE_ORGANIZER:
+ {
+ WriterRef xWrt;
+ ::GetXMLWriter( aEmptyStr, GetMedium()->GetBaseURL( true ), xWrt );
+ xWrt->SetOrganizerMode( TRUE );
+ SwWriter aWrt( *GetMedium(), *pDoc );
+ nErr = aWrt.Write( xWrt );
+ xWrt->SetOrganizerMode( FALSE );
+ }
+ break;
+
+ case SFX_CREATE_MODE_EMBEDDED:
+ // SfxProgress unterdruecken, wenn man Embedded ist
+ SW_MOD()->SetEmbeddedLoadSave( TRUE );
+ // kein break;
+
+ case SFX_CREATE_MODE_STANDARD:
+ case SFX_CREATE_MODE_PREVIEW:
+ default:
+ {
+ if( pDoc->ContainsMSVBasic() )
+ {
+ //TODO/MBA: it looks as that this code can be removed!
+ //SvxImportMSVBasic aTmp( *this, pIo->GetStorage() );
+ //aTmp.SaveOrDelMSVBAStorage( FALSE, aEmptyStr );
+ if( SvtFilterOptions::Get()->IsLoadWordBasicStorage() )
+ nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) (*this) );
+ pDoc->SetContainsMSVBasic( FALSE );
+ }
+
+ // TabellenBox Edit beenden!
+ if( pWrtShell )
+ pWrtShell->EndAllTblBoxEdit();
+
+ WriterRef xWrt;
+ ::GetXMLWriter( aEmptyStr, GetMedium()->GetBaseURL( true ), xWrt );
+
+ BOOL bLockedView(FALSE);
+ if ( pWrtShell )
+ {
+ bLockedView = pWrtShell->IsViewLocked();
+ pWrtShell->LockView( TRUE ); //lock visible section
+ }
+
+ SwWriter aWrt( *GetMedium(), *pDoc );
+ nErr = aWrt.Write( xWrt );
+
+ if ( pWrtShell )
+ pWrtShell->LockView( bLockedView );
+ }
+ break;
+ }
+ SW_MOD()->SetEmbeddedLoadSave( FALSE );
+ }
+ SetError( nErr ? nErr : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+
+ SfxViewFrame* pFrm = pWrtShell ? pWrtShell->GetView().GetViewFrame() : 0;
+ if( pFrm )
+ {
+ pFrm->GetBindings().SetState( SfxStringItem( SID_DOC_MODIFIED, ' ' ));
+ }
+ return !IsError( nErr );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sichern im Defaultformat
+ --------------------------------------------------------------------*/
+
+
+sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SaveAs" );
+
+ SwWait aWait( *this, TRUE );
+ //#i3370# remove quick help to prevent saving of autocorrection suggestions
+ if(pView)
+ pView->GetEditWin().StopQuickHelp();
+
+ //#i91811# mod if we have an active margin window, write back the text
+ if ( pView &&
+ pView->GetPostItMgr() &&
+ pView->GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ pView->GetPostItMgr()->UpdateDataOnActiveSidebarWin();
+ }
+
+ if( pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) &&
+ !pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS) )
+ RemoveOLEObjects();
+
+ {
+ // Task 75666 - is the Document imported by our Microsoft-Filters?
+ const SfxFilter* pOldFilter = GetMedium()->GetFilter();
+ if( pOldFilter &&
+ ( pOldFilter->GetUserData().EqualsAscii( FILTER_WW8 ) ||
+ pOldFilter->GetUserData().EqualsAscii( "CWW6" ) ||
+ pOldFilter->GetUserData().EqualsAscii( "WW6" ) ||
+ pOldFilter->GetUserData().EqualsAscii( "WW1" ) ))
+ {
+ // when saving it in our own fileformat, then remove the template
+ // name from the docinfo.
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps
+ = xDPS->getDocumentProperties();
+ xDocProps->setTemplateName(::rtl::OUString::createFromAscii(""));
+ xDocProps->setTemplateURL(::rtl::OUString::createFromAscii(""));
+ xDocProps->setTemplateDate(::util::DateTime());
+ }
+ }
+
+ CalcLayoutForOLEObjects(); // format for OLE objets
+ // --> OD 2006-03-17 #i62875#
+ // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible
+ if ( pWrtShell && pDoc &&
+ pDoc->get(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) &&
+ docfunc::AllDrawObjsOnPage( *pDoc ) )
+ {
+ pDoc->set(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false);
+ }
+ // <--
+
+ ULONG nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE;
+ uno::Reference < embed::XStorage > xStor = rMedium.GetOutputStorage();
+ if( SfxObjectShell::SaveAs( rMedium ) )
+ {
+ if( GetDoc()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) && !ISA( SwGlobalDocShell ) )
+ {
+ // This is to set the correct class id if SaveAs is
+ // called from SwDoc::SplitDoc to save a normal doc as
+ // global doc. In this case, SaveAs is called at a
+ // normal doc shell, therefore, SfxInplaceObject::SaveAs
+ // will set the wrong class id.
+ SvGlobalName aClassName;
+ String aAppName, aLongUserName, aUserName;
+
+ // The document is closed explicitly, but using SfxObjectShellLock is still more correct here
+ SfxObjectShellLock xDocSh =
+ new SwGlobalDocShell( SFX_CREATE_MODE_INTERNAL );
+ // the global document can not be a template
+ xDocSh->SetupStorage( xStor, SotStorage::GetVersion( xStor ), sal_False );
+ xDocSh->DoClose();
+ }
+
+ if( pDoc->ContainsMSVBasic() )
+ {
+ //TODO/MBA: it looks as that this code can be removed!
+ //SvxImportMSVBasic aTmp( *this, pIo->GetStorage() );
+ //aTmp.SaveOrDelMSVBAStorage( FALSE, aEmptyStr );
+ if( SvtFilterOptions::Get()->IsLoadWordBasicStorage() )
+ nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) *this );
+ pDoc->SetContainsMSVBasic( FALSE );
+ }
+
+ // TabellenBox Edit beenden!
+ if( pWrtShell )
+ pWrtShell->EndAllTblBoxEdit();
+
+ // Modified-Flag merken und erhalten ohne den Link zu Callen
+ // (fuer OLE; nach Anweisung von MM)
+ BOOL bIsModified = pDoc->IsModified();
+ pDoc->GetIDocumentUndoRedo().LockUndoNoModifiedPosition();
+ Link aOldOLELnk( pDoc->GetOle2Link() );
+ pDoc->SetOle2Link( Link() );
+
+ // SfxProgress unterdruecken, wenn man Embedded ist
+ SW_MOD()->SetEmbeddedLoadSave(
+ SFX_CREATE_MODE_EMBEDDED == GetCreateMode() );
+
+ WriterRef xWrt;
+ ::GetXMLWriter( aEmptyStr, rMedium.GetBaseURL( true ), xWrt );
+
+ BOOL bLockedView(FALSE);
+ if ( pWrtShell )
+ {
+ bLockedView = pWrtShell->IsViewLocked();
+ pWrtShell->LockView( TRUE ); //lock visible section
+ }
+
+ SwWriter aWrt( rMedium, *pDoc );
+ nErr = aWrt.Write( xWrt );
+
+ if ( pWrtShell )
+ pWrtShell->LockView( bLockedView );
+
+ if( bIsModified )
+ {
+ pDoc->SetModified();
+ pDoc->GetIDocumentUndoRedo().UnLockUndoNoModifiedPosition();
+ }
+ pDoc->SetOle2Link( aOldOLELnk );
+
+ SW_MOD()->SetEmbeddedLoadSave( FALSE );
+ }
+ SetError( nErr ? nErr : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+
+ return !IsError( nErr );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sichern aller Formate
+ --------------------------------------------------------------------*/
+SwSrcView* lcl_GetSourceView( SwDocShell* pSh )
+{
+ // sind wir in der SourceView?
+ SfxViewFrame* pVFrame = SfxViewFrame::GetFirst( pSh );
+ SfxViewShell* pViewShell = pVFrame ? pVFrame->GetViewShell() : 0;
+ return PTR_CAST( SwSrcView, pViewShell);
+}
+
+BOOL SwDocShell::ConvertTo( SfxMedium& rMedium )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::ConvertTo" );
+ const SfxFilter* pFlt = rMedium.GetFilter();
+ if( !pFlt )
+ return FALSE;
+
+ WriterRef xWriter;
+ SwReaderWriter::GetWriter( pFlt->GetUserData(), rMedium.GetBaseURL( true ), xWriter );
+ if( !xWriter.Is() )
+ { // Der Filter ist nicht vorhanden
+ InfoBox( 0,
+ SW_RESSTR(STR_DLLNOTFOUND) ).Execute();
+ return FALSE;
+ }
+
+ //#i3370# remove quick help to prevent saving of autocorrection suggestions
+ if(pView)
+ pView->GetEditWin().StopQuickHelp();
+
+ //#i91811# mod if we have an active margin window, write back the text
+ if ( pView &&
+ pView->GetPostItMgr() &&
+ pView->GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ pView->GetPostItMgr()->UpdateDataOnActiveSidebarWin();
+ }
+
+ ULONG nVBWarning = 0;
+
+ if( pDoc->ContainsMSVBasic() )
+ {
+ BOOL bSave = pFlt->GetUserData().EqualsAscii( "CWW8" )
+ && SvtFilterOptions::Get()->IsLoadWordBasicStorage();
+
+ if ( bSave )
+ {
+ SvStorageRef xStg = new SotStorage( rMedium.GetOutStream(), FALSE );
+ DBG_ASSERT( !xStg->GetError(), "No storage available for storing VBA macros!" );
+ if ( !xStg->GetError() )
+ {
+ nVBWarning = SaveOrDelMSVBAStorage( (SfxObjectShell&) *this, *xStg, bSave, String::CreateFromAscii("Macros") );
+ xStg->Commit();
+ pDoc->SetContainsMSVBasic( TRUE );
+ }
+ }
+ }
+
+ // TabellenBox Edit beenden!
+ if( pWrtShell )
+ pWrtShell->EndAllTblBoxEdit();
+
+ if( pFlt->GetUserData().EqualsAscii( "HTML") )
+ {
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ if( !pHtmlOpt->IsStarBasic() && pHtmlOpt->IsStarBasicWarning() && HasBasic() )
+ {
+ uno::Reference< XLibraryContainer > xLibCont(GetBasicContainer(), UNO_QUERY);
+ uno::Reference< XNameAccess > xLib;
+ Sequence<rtl::OUString> aNames = xLibCont->getElementNames();
+ const rtl::OUString* pNames = aNames.getConstArray();
+ for(sal_Int32 nLib = 0; nLib < aNames.getLength(); nLib++)
+ {
+ Any aLib = xLibCont->getByName(pNames[nLib]);
+ aLib >>= xLib;
+ if(xLib.is())
+ {
+ Sequence<rtl::OUString> aModNames = xLib->getElementNames();
+ if(aModNames.getLength())
+ {
+ SetError(WARN_SWG_HTML_NO_MACROS, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ break;
+ }
+ }
+ }
+ }
+ UpdateDocInfoForSave();
+ }
+
+ // --> FME 2007-5-7 #i76360# Update document statistics
+ SwDocStat aDocStat( pDoc->GetDocStat() );;
+ pDoc->UpdateDocStat( aDocStat );
+ // <--
+ CalcLayoutForOLEObjects(); // format for OLE objets
+ // --> OD 2006-03-17 #i62875#
+ // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible
+ if ( pWrtShell && pDoc &&
+ pDoc->get(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) &&
+ docfunc::AllDrawObjsOnPage( *pDoc ) )
+ {
+ pDoc->set(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false);
+ }
+ // <--
+
+ if( xWriter->IsStgWriter() &&
+ ( /*xWriter->IsSw3Writer() ||*/
+ pFlt->GetUserData().EqualsAscii( FILTER_XML ) ||
+ pFlt->GetUserData().EqualsAscii( FILTER_XMLV ) ||
+ pFlt->GetUserData().EqualsAscii( FILTER_XMLVW ) ) )
+ {
+ // eigenen Typ ermitteln
+ BYTE nMyType = 0;
+ if( ISA( SwWebDocShell) )
+ nMyType = 1;
+ else if( ISA( SwGlobalDocShell) )
+ nMyType = 2;
+
+ // gewuenschten Typ ermitteln
+ BYTE nSaveType = 0;
+ ULONG nSaveClipId = pFlt->GetFormat();
+ if( SOT_FORMATSTR_ID_STARWRITERWEB_8 == nSaveClipId ||
+ SOT_FORMATSTR_ID_STARWRITERWEB_60 == nSaveClipId ||
+ SOT_FORMATSTR_ID_STARWRITERWEB_50 == nSaveClipId ||
+ SOT_FORMATSTR_ID_STARWRITERWEB_40 == nSaveClipId )
+ nSaveType = 1;
+ else if( SOT_FORMATSTR_ID_STARWRITERGLOB_8 == nSaveClipId ||
+ SOT_FORMATSTR_ID_STARWRITERGLOB_60 == nSaveClipId ||
+ SOT_FORMATSTR_ID_STARWRITERGLOB_50 == nSaveClipId ||
+ SOT_FORMATSTR_ID_STARWRITERGLOB_40 == nSaveClipId )
+ nSaveType = 2;
+
+ // Flags am Dokument entsprechend umsetzen
+ BOOL bIsHTMLModeSave = GetDoc()->get(IDocumentSettingAccess::HTML_MODE);
+ BOOL bIsGlobalDocSave = GetDoc()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT);
+ BOOL bIsGlblDocSaveLinksSave = GetDoc()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS);
+ if( nMyType != nSaveType )
+ {
+ GetDoc()->set(IDocumentSettingAccess::HTML_MODE, 1 == nSaveType);
+ GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, 2 == nSaveType);
+ if( 2 != nSaveType )
+ GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, false);
+ }
+
+ // if the target format is storage based, then the output storage must be already created
+ if ( rMedium.IsStorage() )
+ {
+ // set MediaType on target storage
+ // (MediaType will be queried during SaveAs)
+ try
+ {
+ // TODO/MBA: testing
+ uno::Reference < beans::XPropertySet > xSet( rMedium.GetStorage(), uno::UNO_QUERY );
+ if ( xSet.is() )
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("MediaType"), uno::makeAny( ::rtl::OUString( SotExchange::GetFormatMimeType( nSaveClipId ) ) ) );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+
+ // Jetzt das Dokument normal speichern
+ BOOL bRet = SaveAs( rMedium );
+
+ if( nMyType != nSaveType )
+ {
+ GetDoc()->set(IDocumentSettingAccess::HTML_MODE, bIsHTMLModeSave );
+ GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, bIsGlobalDocSave);
+ GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, bIsGlblDocSaveLinksSave);
+ }
+
+ return bRet;
+ }
+
+ if( pFlt->GetUserData().EqualsAscii( FILTER_TEXT_DLG ) &&
+ ( pWrtShell || !::lcl_GetSourceView( this ) ))
+ {
+ SwAsciiOptions aOpt;
+ String sItemOpt;
+ const SfxItemSet* pSet;
+ const SfxPoolItem* pItem;
+ if( 0 != ( pSet = rMedium.GetItemSet() ) )
+ {
+ if( SFX_ITEM_SET == pSet->GetItemState( SID_FILE_FILTEROPTIONS,
+ TRUE, &pItem ) )
+ sItemOpt = ((const SfxStringItem*)pItem)->GetValue();
+ }
+ if(sItemOpt.Len())
+ aOpt.ReadUserData( sItemOpt );
+
+ xWriter->SetAsciiOptions( aOpt );
+ }
+
+ // SfxProgress unterdruecken, wenn man Embedded ist
+ SW_MOD()->SetEmbeddedLoadSave(
+ SFX_CREATE_MODE_EMBEDDED == GetCreateMode());
+
+ // Kontext aufspannen, um die Anzeige der Selektion zu unterbinden
+ ULONG nErrno;
+ String aFileName( rMedium.GetName() );
+
+ //Keine View also das ganze Dokument!
+ if ( pWrtShell )
+ {
+ SwWait aWait( *this, TRUE );
+ // --> OD 2009-12-31 #i106906#
+ const sal_Bool bFormerLockView = pWrtShell->IsViewLocked();
+ pWrtShell->LockView( sal_True );
+ // <--
+ pWrtShell->StartAllAction();
+ pWrtShell->Push();
+ SwWriter aWrt( rMedium, *pWrtShell, TRUE );
+ nErrno = aWrt.Write( xWriter, &aFileName );
+ //JP 16.05.97: falls der SFX uns die View waehrend des speicherns
+ // entzieht
+ if( pWrtShell )
+ {
+ pWrtShell->Pop(FALSE);
+ pWrtShell->EndAllAction();
+ // --> OD 2009-12-31 #i106906#
+ pWrtShell->LockView( bFormerLockView );
+ // <--
+ }
+ }
+ else
+ {
+ // sind wir in der SourceView?
+ SwSrcView* pSrcView = ::lcl_GetSourceView( this );
+ if( pSrcView )
+ {
+ pSrcView->SaveContentTo(rMedium);
+ nErrno = 0;
+ }
+ else
+ {
+ SwWriter aWrt( rMedium, *pDoc );
+ nErrno = aWrt.Write( xWriter, &aFileName );
+ }
+ }
+
+ SW_MOD()->SetEmbeddedLoadSave( FALSE );
+ SetError( nErrno ? nErrno : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ if( !rMedium.IsStorage() )
+ rMedium.CloseOutStream();
+
+ return !IsError( nErrno );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Haende weg
+ --------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: ??? noch nicht zu aktivieren, muss TRUE liefern
+ --------------------------------------------------------------------*/
+
+
+sal_Bool SwDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xStor )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SaveCompleted" );
+ BOOL bRet = SfxObjectShell::SaveCompleted( xStor );
+ if( bRet )
+ {
+ // erst hier entscheiden, ob das Speichern geklappt hat oder nicht
+ if( IsModified() )
+ pDoc->SetModified();
+ else
+ pDoc->ResetModified();
+ }
+
+ if( pOLEChildList )
+ {
+ BOOL bResetModified = IsEnableSetModified();
+ if( bResetModified )
+ EnableSetModified( FALSE );
+
+ uno::Sequence < rtl::OUString > aNames = pOLEChildList->GetObjectNames();
+ for( sal_Int32 n = aNames.getLength(); n; n-- )
+ {
+ if ( !pOLEChildList->MoveEmbeddedObject( aNames[n-1], GetEmbeddedObjectContainer() ) )
+ {
+ DBG_ERROR( "Copying of objects didn't work!" );
+ }
+
+ //SvPersist* pPersist = this;
+ //SvInfoObjectRef aRef( pInfList->GetObject( --n ));
+ //pPersist->Move( &aRef, aRef->GetStorageName() );
+ }
+
+ DELETEZ( pOLEChildList );
+ if( bResetModified )
+ EnableSetModified( TRUE );
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Draw()-Overload fuer OLE2 (Sfx)
+ --------------------------------------------------------------------*/
+
+void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup,
+ USHORT nAspect )
+{
+ //fix #25341# Draw sollte das Modified nicht beeinflussen
+ BOOL bResetModified;
+ if ( TRUE == (bResetModified = IsEnableSetModified()) )
+ EnableSetModified( FALSE );
+
+ //sollte am Document ein JobSetup haengen, dann kopieren wir uns diesen,
+ //um nach dem PrtOle2 diesen wieder am Doc zu verankern.
+ //Einen leeren JobSetup setzen wir nicht ein, denn der wuerde nur zu
+ //fragwuerdigem Ergebnis nach teurer Neuformatierung fuehren (Preview!)
+ JobSetup *pOrig = 0;
+ if ( rSetup.GetPrinterName().Len() && ASPECT_THUMBNAIL != nAspect )
+ {
+ pOrig = const_cast<JobSetup*>(pDoc->getJobsetup());
+ if( pOrig ) // dann kopieren wir uns den
+ pOrig = new JobSetup( *pOrig );
+ pDoc->setJobsetup( rSetup );
+ }
+
+ Rectangle aRect( nAspect == ASPECT_THUMBNAIL ?
+ GetVisArea( nAspect ) : GetVisArea( ASPECT_CONTENT ) );
+
+ pDev->Push();
+ pDev->SetFillColor();
+ pDev->SetLineColor();
+ pDev->SetBackground();
+ BOOL bWeb = 0 != PTR_CAST(SwWebDocShell, this);
+ SwPrintData aOpts;
+ ViewShell::PrtOle2( pDoc, SW_MOD()->GetUsrPref(bWeb), aOpts, pDev, aRect );
+ pDev->Pop();
+
+ if( pOrig )
+ {
+ pDoc->setJobsetup( *pOrig );
+ delete pOrig;
+ }
+ if ( bResetModified )
+ EnableSetModified( TRUE );
+}
+
+
+void SwDocShell::SetVisArea( const Rectangle &rRect )
+{
+ Rectangle aRect( rRect );
+ if ( pView )
+ {
+ Size aSz( pView->GetDocSz() );
+ aSz.Width() += DOCUMENTBORDER; aSz.Height() += DOCUMENTBORDER;
+ long nMoveX = 0, nMoveY = 0;
+ if ( aRect.Right() > aSz.Width() )
+ nMoveX = aSz.Width() - aRect.Right();
+ if ( aRect.Bottom() > aSz.Height() )
+ nMoveY = aSz.Height() - aRect.Bottom();
+ aRect.Move( nMoveX, nMoveY );
+ nMoveX = aRect.Left() < 0 ? -aRect.Left() : 0;
+ nMoveY = aRect.Top() < 0 ? -aRect.Top() : 0;
+ aRect.Move( nMoveX, nMoveY );
+
+ //Ruft das SfxInPlaceObject::SetVisArea()!
+ pView->SetVisArea( aRect, TRUE );
+ }
+ else
+ SfxObjectShell::SetVisArea( aRect );
+}
+
+
+Rectangle SwDocShell::GetVisArea( USHORT nAspect ) const
+{
+ if ( nAspect == ASPECT_THUMBNAIL )
+ {
+ //PreView: VisArea auf die erste Seite einstellen.
+ SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 1 );
+ SwCntntNode* pNd = pDoc->GetNodes().GoNext( &aIdx );
+
+ const SwRect aPageRect = pNd->FindPageFrmRect( FALSE, 0, FALSE );
+ return aPageRect.SVRect();
+
+ // Why does this have to be that complicated? I replaced this by the
+ // call of FindPageFrmRect():
+ /*
+ //PageDesc besorgen, vom ersten Absatz oder den default.
+ const SwFmtPageDesc &rDesc = pNd->GetSwAttrSet().GetPageDesc();
+ const SwPageDesc* pDesc = rDesc.GetPageDesc();
+ if( !pDesc )
+ pDesc = &const_cast<const SwDoc *>(pDoc)->GetPageDesc( 0 );
+
+ //Das Format wird evtl. von der virtuellen Seitennummer bestimmt.
+ const USHORT nPgNum = rDesc.GetNumOffset();
+ const BOOL bOdd = nPgNum % 2 ? TRUE : FALSE;
+ const SwFrmFmt *pFmt = bOdd ? pDesc->GetRightFmt() : pDesc->GetLeftFmt();
+ if ( !pFmt ) //#40568#
+ pFmt = bOdd ? pDesc->GetLeftFmt() : pDesc->GetRightFmt();
+
+ if ( pFmt->GetFrmSize().GetWidth() == LONG_MAX )
+ //Jetzt wird es aber Zeit fuer die Initialisierung
+ pDoc->getPrinter( true );
+
+ const SwFmtFrmSize& rFrmSz = pFmt->GetFrmSize();
+ const Size aSz( rFrmSz.GetWidth(), rFrmSz.GetHeight() );
+ const Point aPt( DOCUMENTBORDER, DOCUMENTBORDER );
+ const Rectangle aRect( aPt, aSz );
+ return aRect;*/
+ }
+ return SfxObjectShell::GetVisArea( nAspect );
+}
+
+Printer *SwDocShell::GetDocumentPrinter()
+{
+ return pDoc->getPrinter( false );
+}
+
+OutputDevice* SwDocShell::GetDocumentRefDev()
+{
+ return pDoc->getReferenceDevice( false );
+}
+
+void SwDocShell::OnDocumentPrinterChanged( Printer * pNewPrinter )
+{
+ if ( pNewPrinter )
+ GetDoc()->setJobsetup( pNewPrinter->GetJobSetup() );
+ else
+ GetDoc()->setPrinter( 0, true, true );
+}
+
+ULONG SwDocShell::GetMiscStatus() const
+{
+ return SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE;
+}
+
+// --> FME 2004-08-05 #i20883# Digital Signatures and Encryption
+sal_uInt16 SwDocShell::GetHiddenInformationState( sal_uInt16 nStates )
+{
+ // get global state like HIDDENINFORMATION_DOCUMENTVERSIONS
+ sal_uInt16 nState = SfxObjectShell::GetHiddenInformationState( nStates );
+
+ if ( nStates & HIDDENINFORMATION_RECORDEDCHANGES )
+ {
+ if ( GetDoc()->GetRedlineTbl().Count() )
+ nState |= HIDDENINFORMATION_RECORDEDCHANGES;
+ }
+ if ( nStates & HIDDENINFORMATION_NOTES )
+ {
+ ASSERT( GetWrtShell(), "No SwWrtShell, no information" )
+ if ( GetWrtShell() )
+ {
+ SwFieldType* pType = GetWrtShell()->GetFldType( RES_POSTITFLD, aEmptyStr );
+ SwClientIter aIter( *pType );
+ SwClient* pFirst = aIter.GoStart();
+ while( pFirst )
+ {
+ if( static_cast<SwFmtFld*>(pFirst)->GetTxtFld() &&
+ static_cast<SwFmtFld*>(pFirst)->IsFldInDoc() )
+ {
+ nState |= HIDDENINFORMATION_NOTES;
+ break;
+ }
+ pFirst = ++aIter;
+ }
+ }
+ }
+
+ return nState;
+}
+// <--
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwDocShell::GetState(SfxItemSet& rSet)
+{
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+
+ while (nWhich)
+ {
+ switch (nWhich)
+ {
+ // MT: MakroChosser immer enablen, weil Neu moeglich
+ // case SID_BASICCHOOSER:
+ // {
+ // StarBASIC* pBasic = GetBasic();
+ // StarBASIC* pAppBasic = SFX_APP()->GetBasic();
+ // if ( !(pBasic->GetModules()->Count() ||
+ // pAppBasic->GetModules()->Count()) )
+ // rSet.DisableItem(nWhich);
+ // }
+ // break;
+ case SID_PRINTPREVIEW:
+ {
+ BOOL bDisable = IsInPlaceActive();
+ if ( !bDisable )
+ {
+ SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this);
+ while (pTmpFrm) // Preview suchen
+ {
+ if ( PTR_CAST(SwView, pTmpFrm->GetViewShell()) &&
+ ((SwView*)pTmpFrm->GetViewShell())->GetWrtShell().getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE))
+ {
+ bDisable = TRUE;
+ break;
+ }
+ pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this);
+ }
+ }
+ if ( bDisable )
+ rSet.DisableItem( SID_PRINTPREVIEW );
+ else
+ {
+ SfxBoolItem aBool( SID_PRINTPREVIEW, FALSE );
+ if( PTR_CAST( SwPagePreView, SfxViewShell::Current()) )
+ aBool.SetValue( TRUE );
+ rSet.Put( aBool );
+ }
+ }
+ break;
+ case SID_SOURCEVIEW:
+ {
+ SfxViewShell* pCurrView = GetView() ? (SfxViewShell*)GetView()
+ : SfxViewShell::Current();
+ BOOL bSourceView = 0 != PTR_CAST(SwSrcView, pCurrView);
+ rSet.Put(SfxBoolItem(SID_SOURCEVIEW, bSourceView));
+ }
+ break;
+ case SID_HTML_MODE:
+ rSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(this)));
+ break;
+
+ case FN_ABSTRACT_STARIMPRESS:
+ case FN_OUTLINE_TO_IMPRESS:
+ {
+ SvtModuleOptions aMOpt;
+ if ( !aMOpt.IsImpress() )
+ rSet.DisableItem( nWhich );
+ }
+ /* no break here */
+ case FN_ABSTRACT_NEWDOC:
+ case FN_OUTLINE_TO_CLIPBOARD:
+ {
+ if ( !GetDoc()->GetNodes().GetOutLineNds().Count() )
+ rSet.DisableItem( nWhich );
+ }
+ break;
+ case SID_BROWSER_MODE:
+ case FN_PRINT_LAYOUT:
+ {
+ sal_Bool bState = GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE);
+ if(FN_PRINT_LAYOUT == nWhich)
+ bState = !bState;
+ rSet.Put( SfxBoolItem( nWhich, bState));
+ }
+ break;
+
+ case FN_NEW_GLOBAL_DOC:
+ if ( ISA(SwGlobalDocShell) )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case FN_NEW_HTML_DOC:
+ if( ISA( SwWebDocShell ) )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case SID_ATTR_YEAR2000:
+ {
+ const SvNumberFormatter* pFmtr = pDoc->GetNumberFormatter(FALSE);
+ rSet.Put( SfxUInt16Item( nWhich,
+ static_cast< sal_uInt16 >(
+ pFmtr ? pFmtr->GetYear2000()
+ : ::utl::MiscCfg().GetYear2000() )));
+ }
+ break;
+ case SID_ATTR_CHAR_FONTLIST:
+ {
+ rSet.Put( SvxFontListItem( pFontList, SID_ATTR_CHAR_FONTLIST ) );
+ }
+ break;
+ case SID_MAIL_PREPAREEXPORT:
+ {
+ //check if linked content or possibly hidden content is available
+ //pDoc->UpdateFlds( NULL, false );
+ sfx2::LinkManager& rLnkMgr = pDoc->GetLinkManager();
+ const ::sfx2::SvBaseLinks& rLnks = rLnkMgr.GetLinks();
+ sal_Bool bRet = sal_False;
+ if( rLnks.Count() )
+ bRet = sal_True;
+ else
+ {
+ //sections with hidden flag, hidden character attribute, hidden paragraph/text or conditional text fields
+ bRet = pDoc->HasInvisibleContent();
+ }
+ rSet.Put( SfxBoolItem( nWhich, bRet ) );
+ }
+ break;
+
+ default: DBG_ASSERT(!this,"Hier darfst Du nicht hinein!");
+
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: OLE-Hdls
+ --------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwDocShell, Ole2ModifiedHdl, void *, p )
+{
+ // vom Doc wird der Status mitgegeben (siehe doc.cxx)
+ // Bit 0: -> alter Zustand
+ // Bit 1: -> neuer Zustand
+ long nStatus = (long)p;
+ if( IsEnableSetModified() )
+ SetModified( (nStatus & 2) ? TRUE : FALSE );
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Pool returnen Hier weil virtuelll
+ --------------------------------------------------------------------*/
+
+
+SfxStyleSheetBasePool* SwDocShell::GetStyleSheetPool()
+{
+ return mxBasePool.get();
+}
+
+
+void SwDocShell::SetView(SwView* pVw)
+{
+ if ( 0 != (pView = pVw) )
+ pWrtShell = &pView->GetWrtShell();
+ else
+ pWrtShell = 0;
+}
+
+
+void SwDocShell::PrepareReload()
+{
+ ::DelAllGrfCacheEntries( pDoc );
+}
+
+// --> OD 2006-11-07 #i59688#
+// linked graphics are now loaded on demand.
+// Thus, loading of linked graphics no longer needed and necessary for
+// the load of document being finished.
+void SwDocShell::LoadingFinished()
+{
+ // --> OD 2007-10-08 #i38810#
+ // Original fix fails after integration of cws xmlsec11:
+ // interface <SfxObjectShell::EnableSetModified(..)> no longer works, because
+ // <SfxObjectShell::FinishedLoading(..)> doesn't care about its status and
+ // enables the document modification again.
+ // Thus, manuell modify the document, if its modified and its links are updated
+ // before <FinishedLoading(..)> is called.
+ const bool bHasDocToStayModified( pDoc->IsModified() && pDoc->LinksUpdated() );
+// // --> OD 2005-02-11 #i38810# - disable method <SetModified(..)>, if document
+// // has stay in modified state, due to the update of its links during load.
+// bool bResetEnableSetModified(false);
+// if ( IsEnableSetModified() &&
+// pDoc->IsModified() && pDoc->LinksUpdated() )
+// {
+// EnableSetModified( FALSE );
+// bResetEnableSetModified = true;
+// }
+ // <--
+ FinishedLoading( SFX_LOADED_ALL );
+// // --> OD 2005-02-11 #i38810#
+// if ( bResetEnableSetModified )
+// {
+// EnableSetModified( TRUE );
+// }
+// // <--
+ SfxViewFrame* pVFrame = SfxViewFrame::GetFirst(this);
+ if(pVFrame)
+ {
+ SfxViewShell* pShell = pVFrame->GetViewShell();
+ if(PTR_CAST(SwSrcView, pShell))
+ ((SwSrcView*)pShell)->Load(this);
+ }
+
+ // --> OD 2007-10-08 #i38810#
+ if ( bHasDocToStayModified && !pDoc->IsModified() )
+ {
+ pDoc->SetModified();
+ }
+ // <--
+}
+
+// eine Uebertragung wird abgebrochen (wird aus dem SFX gerufen)
+void SwDocShell::CancelTransfers()
+{
+ // alle Links vom LinkManager Canceln
+ aFinishedTimer.Stop();
+ pDoc->GetLinkManager().CancelTransfers();
+ SfxObjectShell::CancelTransfers();
+}
+
+SwFEShell* SwDocShell::GetFEShell()
+{
+ return pWrtShell;
+}
+
+void SwDocShell::RemoveOLEObjects()
+{
+ SwClientIter aIter( *(SwModify*)pDoc->GetDfltGrfFmtColl() );
+ for( SwCntntNode* pNd = (SwCntntNode*)aIter.First( TYPE( SwCntntNode ) );
+ pNd; pNd = (SwCntntNode*)aIter.Next() )
+ {
+ SwOLENode* pOLENd = pNd->GetOLENode();
+ if( pOLENd && ( pOLENd->IsOLEObjectDeleted() ||
+ pOLENd->IsInGlobalDocSection() ) )
+ {
+ if( !pOLEChildList )
+ pOLEChildList = new comphelper::EmbeddedObjectContainer;
+
+ ::rtl::OUString aObjName = pOLENd->GetOLEObj().GetCurrentPersistName();
+ GetEmbeddedObjectContainer().MoveEmbeddedObject( aObjName, *pOLEChildList );
+ }
+ }
+}
+
+// When a document is loaded, SwDoc::PrtOLENotify is called to update
+// the sizes of math objects. However, for objects that do not have a
+// SwFrm at this time, only a flag is set (bIsOLESizeInvalid) and the
+// size change takes place later, while calculating the layout in the
+// idle handler. If this document is saved now, it is saved with invalid
+// sizes. For this reason, the layout has to be calculated before a document is
+// saved, but of course only id there are OLE objects with bOLESizeInvalid set.
+void SwDocShell::CalcLayoutForOLEObjects()
+{
+ if( !pWrtShell )
+ return;
+
+ SwClientIter aIter( *(SwModify*)pDoc->GetDfltGrfFmtColl() );
+ for( SwCntntNode* pNd = (SwCntntNode*)aIter.First( TYPE( SwCntntNode ) );
+ pNd; pNd = (SwCntntNode*)aIter.Next() )
+ {
+ SwOLENode* pOLENd = pNd->GetOLENode();
+ if( pOLENd && pOLENd->IsOLESizeInvalid() )
+ {
+ pWrtShell->CalcLayout();
+ break;
+ }
+ }
+}
+
+
+// --> FME 2005-02-25 #i42634# Overwrites SfxObjectShell::UpdateLinks
+// This new function is necessary to trigger update of links in docs
+// read by the binary filter:
+void SwDocShell::UpdateLinks()
+{
+ GetDoc()->UpdateLinks(TRUE);
+ // --> FME 2005-07-27 #i50703# Update footnote numbers
+ SwTxtFtn::SetUniqueSeqRefNo( *GetDoc() );
+ SwNodeIndex aTmp( GetDoc()->GetNodes() );
+ GetDoc()->GetFtnIdxs().UpdateFtn( aTmp );
+ // <--
+}
+
+uno::Reference< frame::XController >
+ SwDocShell::GetController()
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > aRet;
+ // --> FME 2007-10-15 #i82346# No view in page preview
+ if ( GetView() )
+ // <--
+ aRet = GetView()->GetController();
+ return aRet;
+}
+
+/* -----------------------------12.02.01 12:08--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static const char* pEventNames[] =
+{
+ "OnPageCountChange",
+ "OnMailMerge",
+ "OnMailMergeFinished",
+ "OnFieldMerge",
+ "OnFieldMergeFinished",
+ "OnLayoutFinished"
+};
+
+Sequence< OUString > SwDocShell::GetEventNames()
+{
+ Sequence< OUString > aRet = SfxObjectShell::GetEventNames();
+ sal_Int32 nLen = aRet.getLength();
+ aRet.realloc(nLen + 6);
+ OUString* pNames = aRet.getArray();
+ pNames[nLen++] = GetEventName(0);
+ pNames[nLen++] = GetEventName(1);
+ pNames[nLen++] = GetEventName(2);
+ pNames[nLen++] = GetEventName(3);
+ pNames[nLen++] = GetEventName(4);
+ pNames[nLen] = GetEventName(5);
+
+ return aRet;
+}
+
+static sal_Int32 nEvents=13;
+
+rtl::OUString SwDocShell::GetEventName( sal_Int32 nIndex )
+{
+ if ( nIndex<nEvents )
+ return ::rtl::OUString::createFromAscii(pEventNames[nIndex]);
+ return rtl::OUString();
+}
+
+const ::sfx2::IXmlIdRegistry* SwDocShell::GetXmlIdRegistry() const
+{
+ return pDoc ? &pDoc->GetXmlIdRegistry() : 0;
+}
+
+
+bool SwDocShell::IsChangeRecording() const
+{
+ return (pWrtShell->GetRedlineMode() & nsRedlineMode_t::REDLINE_ON) != 0;
+}
+
+
+bool SwDocShell::HasChangeRecordProtection() const
+{
+ return pWrtShell->getIDocumentRedlineAccess()->GetRedlinePassword().getLength() > 0;
+}
+
+
+void SwDocShell::SetChangeRecording( bool bActivate )
+{
+ USHORT nOn = bActivate ? nsRedlineMode_t::REDLINE_ON : 0;
+ USHORT nMode = pWrtShell->GetRedlineMode();
+ pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn);
+}
+
+
+bool SwDocShell::SetProtectionPassword( const String &rNewPassword )
+{
+ const SfxAllItemSet aSet( GetPool() );
+ const SfxItemSet* pArgs = &aSet;
+ const SfxPoolItem* pItem = NULL;
+
+ IDocumentRedlineAccess* pIDRA = pWrtShell->getIDocumentRedlineAccess();
+ Sequence< sal_Int8 > aPasswd = pIDRA->GetRedlinePassword();
+ if (pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_REDLINE_PROTECT, FALSE, &pItem )
+ && ((SfxBoolItem*)pItem)->GetValue() == (aPasswd.getLength() > 0))
+ return false;
+
+ bool bRes = false;
+
+ if (rNewPassword.Len())
+ {
+ // when password protection is applied change tracking must always be active
+ SetChangeRecording( true );
+
+ Sequence< sal_Int8 > aNewPasswd;
+ SvPasswordHelper::GetHashPassword( aNewPasswd, rNewPassword );
+ pIDRA->SetRedlinePassword( aNewPasswd );
+ bRes = true;
+ }
+ else
+ {
+ pIDRA->SetRedlinePassword( Sequence< sal_Int8 >() );
+ bRes = true;
+ }
+
+ return bRes;
+}
+
+
+bool SwDocShell::GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash )
+{
+ bool bRes = false;
+
+ const SfxAllItemSet aSet( GetPool() );
+ const SfxItemSet* pArgs = &aSet;
+ const SfxPoolItem* pItem = NULL;
+
+ IDocumentRedlineAccess* pIDRA = pWrtShell->getIDocumentRedlineAccess();
+ Sequence< sal_Int8 > aPasswdHash( pIDRA->GetRedlinePassword() );
+ if (pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_REDLINE_PROTECT, FALSE, &pItem )
+ && ((SfxBoolItem*)pItem)->GetValue() == (aPasswdHash.getLength() != 0))
+ return false;
+ rPasswordHash = aPasswdHash;
+ bRes = true;
+
+ return bRes;
+}
+
+
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
new file mode 100644
index 000000000000..263e3274972b
--- /dev/null
+++ b/sw/source/ui/app/docsh2.cxx
@@ -0,0 +1,1949 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XDispatchHelper.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+#include <hintids.hxx>
+#include <tools/urlobj.hxx>
+#include <unotools/tempfile.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/lckbitem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svtools/transfer.hxx>
+#include <sfx2/dialogs.hrc>
+#include <sfx2/dinfdlg.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/new.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/evntconf.hxx>
+#include <svtools/sfxecode.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <svx/svxids.hrc>
+#include <svx/drawitem.hxx>
+#include <editeng/svxacorr.hxx>
+#include <editeng/langitem.hxx>
+#include <svx/fmshell.hxx>
+
+#include <svtools/htmlcfg.hxx>
+#include <svx/ofaitem.hxx>
+#include <SwSmartTagMgr.hxx>
+#include <sfx2/app.hxx>
+#include <basic/sbstar.hxx>
+#include <basic/basmgr.hxx>
+#include <sot/storage.hxx>
+#include <sot/clsids.hxx>
+#include <swunodef.hxx>
+#include <fmtcol.hxx>
+#include <swevent.hxx>
+#include <view.hxx> // fuer die aktuelle Sicht
+#include <docsh.hxx> // Dokumenterzeugung
+#include <wrtsh.hxx>
+#include <fldbas.hxx>
+#include <viewopt.hxx>
+#include <globdoc.hxx>
+#include <fldwrap.hxx>
+#include <redlndlg.hxx>
+#include <docstyle.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <pagedesc.hxx>
+#include <shellio.hxx>
+#include <pview.hxx>
+#include <srcview.hxx>
+#include <poolfmt.hxx>
+#include <usrpref.hxx>
+#include <wdocsh.hxx>
+#include <unotxdoc.hxx>
+#include <acmplwrd.hxx>
+#include <swmodule.hxx>
+#include <unobaseclass.hxx>
+#include <swwait.hxx>
+#include <swcli.hxx>
+
+#include <cmdid.h>
+#include <globals.h>
+#include <helpid.h>
+#include <app.hrc>
+#include <poolfmt.hrc>
+#include <globals.hrc>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
+#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
+#include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
+#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#ifdef FUTURE_VBA
+#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
+#include <com/sun/star/script/vba/VBAEventId.hpp>
+#endif
+#include <editeng/acorrcfg.hxx>
+#include <SwStyleNameMapper.hxx>
+
+#include <sfx2/fcontnr.hxx>
+
+#include "swabstdlg.hxx"
+#include "dialog.hrc"
+#include "swabstdlg.hxx"
+
+#include <ndtxt.hxx> //#outline level,add by zhaojianwei
+
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using namespace ::sfx2;
+extern BOOL FindPhyStyle( SwDoc& , const String& , SfxStyleFamily );
+
+/*--------------------------------------------------------------------
+ Beschreibung: DocInfo kreieren (virtuell)
+ --------------------------------------------------------------------*/
+
+SfxDocumentInfoDialog* SwDocShell::CreateDocumentInfoDialog(
+ Window *pParent, const SfxItemSet &rSet)
+{
+ SfxDocumentInfoDialog* pDlg = new SfxDocumentInfoDialog(pParent, rSet);
+ //nur mit Statistik, wenn dieses Doc auch angezeigt wird, nicht
+ //aus dem Doc-Manager
+ SwDocShell* pDocSh = (SwDocShell*) SfxObjectShell::Current();
+ if( pDocSh == this )
+ {
+ //Nicht fuer SourceView.
+ SfxViewShell *pVSh = SfxViewShell::Current();
+ if ( pVSh && !pVSh->ISA(SwSrcView) )
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+ pDlg->AddTabPage(TP_DOC_STAT, SW_RESSTR(STR_DOC_STAT),pFact->GetTabPageCreatorFunc( TP_DOC_STAT ),0);
+ }
+ }
+ return pDlg;
+}
+
+
+/// update text fields on document properties changes
+void SwDocShell::DoFlushDocInfo()
+{
+ if ( !pDoc ) return;
+
+ bool bUnlockView(true);
+ if ( pWrtShell ) {
+ bUnlockView = !pWrtShell->IsViewLocked();
+ pWrtShell->LockView( TRUE ); // lock visible section
+ pWrtShell->StartAllAction();
+ }
+
+ pDoc->DocInfoChgd();
+
+ if ( pWrtShell ) {
+ pWrtShell->EndAllAction();
+ if ( bUnlockView ) {
+ pWrtShell->LockView( FALSE );
+ }
+ }
+}
+
+#ifdef FUTURE_VBA
+void lcl_processCompatibleSfxHint( const uno::Reference< script::vba::XVBAEventProcessor >& xVbaEvents, const SfxHint& rHint )
+{
+ using namespace com::sun::star::script::vba::VBAEventId;
+ if ( rHint.ISA( SfxEventHint ) )
+ {
+ uno::Sequence< uno::Any > aArgs;
+ ULONG nEventId = ((SfxEventHint&)rHint).GetEventId();
+ switch( nEventId )
+ {
+ case SFX_EVENT_CREATEDOC:
+ xVbaEvents->processVbaEvent( DOCUMENT_NEW, aArgs );
+ break;
+ case SFX_EVENT_OPENDOC:
+ xVbaEvents->processVbaEvent( DOCUMENT_OPEN, aArgs );
+ break;
+ }
+ }
+}
+#endif
+
+/*--------------------------------------------------------------------
+ Beschreibung: Benachrichtigung bei geaenderter DocInfo
+ --------------------------------------------------------------------*/
+
+void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ if( !pDoc )
+ {
+//MA: Kommt bei der OLE-Registration vor!
+// ASSERT( !this, "DocShell ist nicht richtig initialisiert!" );
+ return ;
+ }
+
+#ifdef FUTURE_VBA
+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = pDoc->GetVbaEventProcessor();
+ if( xVbaEvents.is() )
+ lcl_processCompatibleSfxHint( xVbaEvents, rHint );
+#endif
+
+ USHORT nAction = 0;
+ if( rHint.ISA(SfxSimpleHint) )
+ {
+ // swithc for more actions
+ switch( ((SfxSimpleHint&) rHint).GetId() )
+ {
+ case SFX_HINT_TITLECHANGED:
+ if( GetMedium() )
+ nAction = 2;
+ break;
+ }
+ }
+ else if( rHint.ISA(SfxEventHint) &&
+ ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_LOADFINISHED )
+ {
+ // --> OD 2004-12-03 #i38126# - own action id
+ nAction = 3;
+ // <--
+ }
+
+ if( nAction )
+ {
+ BOOL bUnlockView = sal_True; //initializing prevents warning
+ if( pWrtShell )
+ {
+ bUnlockView = !pWrtShell->IsViewLocked();
+ pWrtShell->LockView( TRUE ); //lock visible section
+ pWrtShell->StartAllAction();
+ }
+ switch( nAction )
+ {
+ case 2:
+ pDoc->GetSysFldType( RES_FILENAMEFLD )->UpdateFlds();
+ break;
+ // --> OD 2004-12-03 #i38126# - own action for event LOADFINISHED
+ // in order to avoid a modified document.
+ // --> OD 2005-02-01 #i41679# - Also for the instance of <SwDoc>
+ // it has to be assured, that it's not modified.
+ // Perform the same as for action id 1, but disable <SetModified>.
+ case 3:
+ {
+ const bool bResetModified = IsEnableSetModified();
+ if ( bResetModified )
+ EnableSetModified( FALSE );
+ // --> OD 2005-02-01 #i41679#
+ const bool bIsDocModified = pDoc->IsModified();
+ // <--
+
+ pDoc->DocInfoChgd( );
+
+ // --> OD 2005-02-01 #i41679#
+ if ( !bIsDocModified )
+ pDoc->ResetModified();
+ // <--
+ if ( bResetModified )
+ EnableSetModified( TRUE );
+ }
+ break;
+ // <--
+ }
+
+ if( pWrtShell )
+ {
+ pWrtShell->EndAllAction();
+ if( bUnlockView )
+ pWrtShell->LockView( FALSE );
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Benachrichtigung Doc schliessen
+ --------------------------------------------------------------------*/
+
+USHORT SwDocShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
+{
+ USHORT nRet = SfxObjectShell::PrepareClose( bUI, bForBrowsing );
+
+ if( TRUE == nRet ) //Unbedingt auf TRUE abfragen! (RET_NEWTASK)
+ EndListening( *this );
+
+#ifdef FUTURE_VBA
+ if( pDoc && IsInPrepareClose() )
+ {
+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = pDoc->GetVbaEventProcessor();
+ if( xVbaEvents.is() )
+ {
+ using namespace com::sun::star::script::vba::VBAEventId;
+ uno::Sequence< uno::Any > aArgs;
+ xVbaEvents->processVbaEvent( DOCUMENT_CLOSE, aArgs );
+ }
+ }
+#endif
+ return nRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Organizer
+ --------------------------------------------------------------------*/
+
+BOOL SwDocShell::Insert( SfxObjectShell &rSource,
+ USHORT nSourceIdx1, // SourcePool: oberste Inhaltsebene (Vorlagen/Makros)
+ USHORT nSourceIdx2, // Index in den Inhalt
+ USHORT nSourceIdx3, // Index in die Inhaltsebene
+ USHORT &rIdx1, // und das gleiche fuer den DestinationPool
+ USHORT &rIdx2, // ""
+ USHORT &rIdx3, // ""
+ USHORT &rRemovedIdx ) // falls doppelte geloescht werden, Pos zurueck
+{
+ // --> OD 2005-05-10 #i48949# - actions aren't undoable. Thus, allow no undo
+ // actions
+ // Note: The undo action stack is cleared at the end of this method.
+ ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
+ // <--
+
+ BOOL bRet = FALSE;
+
+ if (INDEX_IGNORE == rIdx1 && CONTENT_STYLE == nSourceIdx1)
+ rIdx1 = CONTENT_STYLE;
+
+ if (CONTENT_STYLE == nSourceIdx1 && CONTENT_STYLE == rIdx1)
+ {
+ SfxStyleSheetBasePool* pHisPool = rSource.GetStyleSheetPool();
+ SwDocStyleSheetPool* pMyPool =
+ (SwDocStyleSheetPool*)GetStyleSheetPool();
+
+ // wir koennen nicht in uns selbst hin und her moven
+ if( pHisPool == pMyPool )
+ return FALSE;
+
+ if( INDEX_IGNORE == rIdx2 )
+ rIdx2 = pMyPool->Count();
+
+ // erstmal auf die Such-Maske "positionieren"
+ pHisPool->First();
+ SfxStyleSheetBase* pHisSheet = (*pHisPool)[nSourceIdx2];
+
+ // wenn so eine Vorlage schon existiert: loeschen!
+ const String& rOldName = pHisSheet->GetName();
+ SfxStyleFamily eOldFamily( pHisSheet->GetFamily() );
+
+ // dflt. PageDesc und StandardZeichenvorlage nie loeschen !!!
+ if( ( SFX_STYLE_FAMILY_PAGE == eOldFamily &&
+ const_cast<const SwDoc *>(pDoc)->GetPageDesc(0).GetName() ==
+ rOldName ) ||
+ ( SFX_STYLE_FAMILY_CHAR == eOldFamily &&
+ rOldName == *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
+ RES_POOLCOLL_TEXT_BEGIN ] ))
+ return FALSE;
+
+ SfxStyleFamily eMyOldFamily( pMyPool->GetSearchFamily() );
+ USHORT nMySrchMask = pMyPool->GetSearchMask();
+
+ SfxStyleSheetBase* pExist;
+ if( ::FindPhyStyle( *pDoc, rOldName, eOldFamily ) )
+ {
+ // Bug 20365: nur uebernehmen, wenn das gewuenscht ist!
+ if( ERRCODE_BUTTON_OK != ErrorHandler::HandleError(
+ *new MessageInfo( ERRCODE_SFXMSG_STYLEREPLACE, rOldName )) )
+ {
+ return FALSE;
+ }
+
+ // Da Replace den aStyleSheet-Member selbst benoetigt, muss
+ // das Ergebnis vom Find kopiert werden (s.u.))
+ rtl::Reference< SwDocStyleSheet > xExist( new SwDocStyleSheet(
+ *(SwDocStyleSheet*)pMyPool->Find( rOldName, eOldFamily ) ) );
+ pMyPool->Replace( *pHisSheet, *xExist.get() );
+
+ // An der Reihenfolge der Vorlagen im Pool aendert sich nichts.
+ rIdx2 = rIdx1 = INDEX_IGNORE;
+
+ GetDoc()->SetModified();
+
+ return TRUE;
+ }
+
+ pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
+
+ // MIB 18.12.98: SwDocStyleSheetPool::Make liefert einen
+ // Pointer auf SwDocStyleSheetPool::aStyleSheet zurueck.
+ // Der gleiche Member von SwDocStyleSheetPool::Find benutzt.
+ // Deshalb muss hier mit einer Kopie gearbeitet werden.
+ // Vorsicht: SfxStyleSheetBase::SetFollow ruft seinerseits
+ // ein SwDocStyleSheetPool::Find auf, do dass es nicht genuegt
+ // die Find-Aufrufe in dieser Methode zu eleminieren.
+
+ rtl::Reference< SwDocStyleSheet > xNewSheet( new SwDocStyleSheet( (SwDocStyleSheet&)pMyPool
+ ->Make(rOldName, eOldFamily, pHisSheet->GetMask() ) ) );
+ if( SFX_STYLE_FAMILY_PAGE == eOldFamily && rSource.ISA(SwDocShell) )
+ {
+ // gesondert behandeln!!
+ SwPageDesc* pDestDsc = (SwPageDesc*)xNewSheet->GetPageDesc();
+ SwPageDesc* pCpyDsc = (SwPageDesc*)((SwDocStyleSheet*)pHisSheet)->GetPageDesc();
+ pDoc->CopyPageDesc( *pCpyDsc, *pDestDsc );
+ }
+ else
+ // die neue Vorlage mit den Attributen fuellen
+ xNewSheet->SetItemSet( pHisSheet->GetItemSet() );
+
+ pMyPool->SetSearchMask( SFX_STYLE_FAMILY_ALL, nMySrchMask );
+
+ if( xNewSheet->IsUserDefined() || xNewSheet->IsUsed() )
+ {
+ // Benutzte und Benutzer-definierte Vorlagen werden angezeigt.
+ // Dshalb muss hier der Index der neuen Vorlage im Pool
+ // ermittelt werden.
+ pExist = pMyPool->First();
+ USHORT nIdx = 0;
+ while( pExist )
+ {
+ if( pExist->GetName() == rOldName &&
+ eOldFamily == pExist->GetFamily() )
+ {
+ rIdx2 = nIdx;
+ break;
+ }
+ pExist = pMyPool->Next();
+ nIdx++;
+ }
+ }
+ else
+ {
+ // Andere Vorlagen werden nicht angezeigt.
+ rIdx1 = rIdx2 = INDEX_IGNORE;
+ }
+
+/* pMyPool->Count(); //interne Liste neu fuellen lassen!!!!!
+
+ // suchen, um die richige Insert-Position returnen zu koennen
+ pMyPool->Find( rOldName, SFX_STYLE_FAMILY_ALL, nMySrchMask );
+ rIdx2 = pMyPool->GetFindPos();*/
+
+ // wer bekommt den Neuen als Parent? wer benutzt den Neuen als Follow?
+ // (immer nur ueber die Instanziierten!!!)
+ pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
+ pMyPool->SetOrganizerMode( TRUE );
+ SfxStyleSheetBase* pTestSheet = pMyPool->First();
+ while (pTestSheet)
+ {
+ if (pTestSheet->GetFamily() == eOldFamily &&
+ pTestSheet->HasParentSupport() &&
+ pTestSheet->GetParent() == rOldName)
+ {
+ pTestSheet->SetParent(rOldName); // Verknuepfung neu aufbauen
+ }
+
+ if (pTestSheet->GetFamily() == eOldFamily &&
+ pTestSheet->HasFollowSupport() &&
+ pTestSheet->GetFollow() == rOldName)
+ {
+ pTestSheet->SetFollow(rOldName); // Verknuepfung neu aufbauen
+ }
+
+ pTestSheet = pMyPool->Next();
+ }
+ pMyPool->SetOrganizerMode( SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
+
+ // hat der Neue einen Parent? wenn ja, mit gleichem Namen bei uns suchen
+ if (pHisSheet->HasParentSupport())
+ {
+ const String& rParentName = pHisSheet->GetParent();
+ if (0 != rParentName.Len())
+ {
+ SfxStyleSheetBase* pParentOfNew = pMyPool->Find(rParentName,
+ eOldFamily);
+ if (pParentOfNew)
+ {
+ xNewSheet->SetParent(rParentName);
+ }
+ pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
+ }
+ }
+
+ // hat der Neue einen Follow? wenn ja, mit gleichem Namen bei uns suchen
+ if (pHisSheet->HasFollowSupport())
+ {
+ const String& rFollowName = pHisSheet->GetFollow();
+ if (0 != rFollowName.Len())
+ {
+ SfxStyleSheetBase* pFollowOfNew = pMyPool->Find(rFollowName,
+ eOldFamily);
+ if (pFollowOfNew)
+ {
+ xNewSheet->SetFollow(rFollowName);
+ }
+ pMyPool->SetSearchMask( eOldFamily, nMySrchMask );
+ }
+ }
+
+ // Bug 27347: alte Einstellung wieder setzen
+ pMyPool->SetSearchMask( eMyOldFamily, nMySrchMask );
+
+ // Model geaendert
+ ASSERT(pDoc, "Doc fehlt");
+ GetDoc()->SetModified();
+
+ bRet = TRUE;
+ }
+ else
+ bRet = SfxObjectShell::Insert( rSource,
+ nSourceIdx1,
+ nSourceIdx2,
+ nSourceIdx3,
+ rIdx1,
+ rIdx2,
+ rIdx3,
+ rRemovedIdx);
+
+ // --> OD 2005-05-10 #i48949# - actions aren't undoable and could have change
+ // the document node array. Thus, clear the undo action stack.
+ if (undoGuard.UndoWasEnabled())
+ {
+ GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj();
+ }
+ // <--
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Vorlagen Remove
+ --------------------------------------------------------------------*/
+
+BOOL SwDocShell::Remove(USHORT nIdx1, // siehe Insert
+ USHORT nIdx2,
+ USHORT nIdx3)
+{
+ BOOL bRet = FALSE;
+
+ if (CONTENT_STYLE == nIdx1)
+ {
+ SwDocStyleSheetPool* pMyPool = (SwDocStyleSheetPool*)GetStyleSheetPool();
+
+ pMyPool->First(); // vorm Zugriff Pool aktualisieren!!
+ SfxStyleSheetBase* pMySheet = (*pMyPool)[nIdx2];
+
+ String aName( pMySheet->GetName() );
+ SfxStyleFamily eFamily( pMySheet->GetFamily() );
+
+ // dflt. PageDesc und StandardZeichenvorlage nie loeschen !!!
+ if( ( SFX_STYLE_FAMILY_PAGE == eFamily &&
+ const_cast<const SwDoc *>(pDoc)->GetPageDesc(0).GetName()
+ == aName ) ||
+ ( SFX_STYLE_FAMILY_CHAR == eFamily &&
+ aName == *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
+ RES_POOLCOLL_TEXT_BEGIN ] ))
+ return FALSE;
+
+ // also loeschen
+ pMyPool->Remove( pMySheet );
+
+ // jetzt noch die Parents/Follows aller Instanziierten korrigieren
+ pMyPool->SetOrganizerMode( TRUE );
+ SfxStyleSheetBase* pTestSheet = pMyPool->First();
+ while (pTestSheet)
+ {
+ if (pTestSheet->GetFamily() == eFamily &&
+ pTestSheet->HasParentSupport() &&
+ pTestSheet->GetParent() == aName)
+ {
+ pTestSheet->SetParent( aEmptyStr ); // Verknuepfung aufloesen
+ }
+
+ if (pTestSheet->GetFamily() == eFamily &&
+ pTestSheet->HasFollowSupport() &&
+ pTestSheet->GetFollow() == aName)
+ {
+ pTestSheet->SetFollow( aEmptyStr ); // Verknuepfung aufloesen
+ }
+
+ pTestSheet = pMyPool->Next();
+ }
+ pMyPool->SetOrganizerMode( SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
+
+ bRet = TRUE;
+ }
+ else
+ bRet = SfxObjectShell::Remove( nIdx1,
+ nIdx2,
+ nIdx3 );
+
+
+ // Model geaendert
+ ASSERT(pDoc, "Doc fehlt");
+ GetDoc()->SetModified();
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDocShell::Execute(SfxRequest& rReq)
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+ USHORT nWhich = rReq.GetSlot();
+ BOOL bDone = FALSE;
+ switch ( nWhich )
+ {
+ case SID_AUTO_CORRECT_DLG:
+ {
+ SvxSwAutoFmtFlags* pAFlags = &SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags();
+ SwAutoCompleteWord& rACW = SwDoc::GetAutoCompleteWords();
+
+ BOOL bOldLocked = rACW.IsLockWordLstLocked(),
+ bOldAutoCmpltCollectWords = pAFlags->bAutoCmpltCollectWords;
+
+ rACW.SetLockWordLstLocked( TRUE );
+
+ SvStringsISortDtor aTmpLst;
+ aTmpLst.Insert( &rACW.GetWordList() );
+ pAFlags->pAutoCmpltList = &aTmpLst;
+
+ SfxApplication* pApp = SFX_APP();
+ SfxRequest aAppReq(SID_AUTO_CORRECT_DLG, SFX_CALLMODE_SYNCHRON, pApp->GetPool());
+ SfxBoolItem aSwOptions( SID_AUTO_CORRECT_DLG, TRUE );
+ aAppReq.AppendItem(aSwOptions);
+
+ // SMARTTAGS
+ pAFlags->pSmartTagMgr = &SwSmartTagMgr::Get();
+
+ //pApp->ExecuteSlot(aAppReq);
+
+ SfxItemSet aSet( pApp->GetPool(), SID_AUTO_CORRECT_DLG, SID_AUTO_CORRECT_DLG, SID_OPEN_SMARTTAGOPTIONS, SID_OPEN_SMARTTAGOPTIONS, 0 );
+ aSet.Put( aSwOptions );
+
+ const SfxPoolItem* pOpenSmartTagOptionsItem = 0;
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_OPEN_SMARTTAGOPTIONS, FALSE, &pOpenSmartTagOptionsItem ) )
+ aSet.Put( *static_cast<const SfxBoolItem*>(pOpenSmartTagOptionsItem) );
+
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( RID_OFA_AUTOCORR_DLG, NULL, &aSet, NULL );
+ pDlg->Execute();
+ delete pDlg;
+
+ rACW.SetLockWordLstLocked( bOldLocked );
+
+ SwEditShell::SetAutoFmtFlags( pAFlags );
+ rACW.SetMinWordLen( pAFlags->nAutoCmpltWordLen );
+ rACW.SetMaxCount( pAFlags->nAutoCmpltListLen );
+ if( pAFlags->pAutoCmpltList ) // any changes?
+ {
+ rACW.CheckChangedList( aTmpLst );
+ // clear the temp WordList pointer
+ pAFlags->pAutoCmpltList = 0;
+ }
+ // remove all pointer we never delete the strings
+ aTmpLst.Remove( (USHORT)0, aTmpLst.Count() );
+
+ if( !bOldAutoCmpltCollectWords && bOldAutoCmpltCollectWords !=
+ pAFlags->bAutoCmpltCollectWords )
+ {
+ // call on all Docs the idle formatter to start
+ // the collection of Words
+ TypeId aType = TYPE(SwDocShell);
+ for( SwDocShell *pDocSh = (SwDocShell*)SfxObjectShell::GetFirst(&aType);
+ pDocSh;
+ pDocSh = (SwDocShell*)SfxObjectShell::GetNext( *pDocSh, &aType ) )
+ {
+ SwDoc* pTmp = pDocSh->GetDoc();
+ if ( pTmp->GetRootFrm() )
+ pTmp->InvalidateAutoCompleteFlag();
+ }
+ }
+ }
+ break;
+
+ case SID_PRINTPREVIEW:
+ {
+ BOOL bSet = FALSE, bFound = FALSE, bOnly = TRUE;
+ SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this);
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ SwView* pCurrView = dynamic_cast< SwView *> ( pViewShell );
+ BOOL bCurrent = IS_TYPE( SwPagePreView, pViewShell );
+
+ while( pTmpFrm ) // search PreView
+ {
+ if( IS_TYPE( SwView, pTmpFrm->GetViewShell()) )
+ bOnly = FALSE;
+ else if( IS_TYPE( SwPagePreView, pTmpFrm->GetViewShell()))
+ {
+ pTmpFrm->GetFrame().Appear();
+ bFound = TRUE;
+ }
+ if( bFound && !bOnly )
+ break;
+ pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this);
+ }
+
+ if( pArgs && SFX_ITEM_SET ==
+ pArgs->GetItemState( SID_PRINTPREVIEW, FALSE, &pItem ))
+ bSet = ((SfxBoolItem*)pItem)->GetValue();
+ else
+ bSet = !bCurrent;
+
+ USHORT nSlotId = 0;
+ if( bSet && !bFound ) // Keine gefunden, daher neue Preview anlegen
+ {
+ //Keine neue anlegen fuer BrowseView!
+ if( !GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE) )
+ nSlotId = SID_VIEWSHELL1;
+ }
+ else if( bFound && !bSet )
+ nSlotId = bOnly ? SID_VIEWSHELL0 : SID_VIEWSHELL1;
+
+ if( nSlotId )
+ {
+ //JP 23.8.2001: Bug 91360 - PagePreView in the WebDocShell
+ // is found under Id ViewShell2.
+ if( ISA(SwWebDocShell) && SID_VIEWSHELL1 == nSlotId )
+ nSlotId = SID_VIEWSHELL2;
+
+ if( pCurrView && pCurrView->GetDocShell() == this )
+ pTmpFrm = pCurrView->GetViewFrame();
+ else
+ pTmpFrm = SfxViewFrame::GetFirst( this );
+
+ pTmpFrm->GetDispatcher()->Execute( nSlotId, 0, 0, SFX_CALLMODE_ASYNCHRON );
+ }
+
+ rReq.SetReturnValue(SfxBoolItem(SID_PRINTPREVIEW, bSet ));
+ }
+ break;
+ case SID_TEMPLATE_LOAD:
+ {
+ String aFileName;
+ static BOOL bText = TRUE;
+ static BOOL bFrame = FALSE;
+ static BOOL bPage = FALSE;
+ static BOOL bNum = FALSE;
+ static BOOL bMerge = FALSE;
+ USHORT nRet = USHRT_MAX;
+
+ USHORT nFlags = bFrame ? SFX_LOAD_FRAME_STYLES : 0;
+ if(bPage)
+ nFlags|= SFX_LOAD_PAGE_STYLES;
+ if(bNum)
+ nFlags|= SFX_LOAD_NUM_STYLES;
+ if(!nFlags || bText)
+ nFlags|= SFX_LOAD_TEXT_STYLES;
+ if(bMerge)
+ nFlags|= SFX_MERGE_STYLES;
+
+ if ( pArgs )
+ {
+ SFX_REQUEST_ARG( rReq, pTemplateItem, SfxStringItem, SID_TEMPLATE_NAME, FALSE );
+ if ( pTemplateItem )
+ {
+ aFileName = pTemplateItem->GetValue();
+ SFX_REQUEST_ARG( rReq, pFlagsItem, SfxInt32Item, SID_TEMPLATE_LOAD, FALSE );
+ if ( pFlagsItem )
+ nFlags = (USHORT) pFlagsItem->GetValue();
+ }
+ }
+
+ if ( !aFileName.Len() )
+ {
+ SvtPathOptions aPathOpt;
+ SfxNewFileDialog* pNewFileDlg =
+ new SfxNewFileDialog(&GetView()->GetViewFrame()->GetWindow(), SFXWB_LOAD_TEMPLATE);
+ pNewFileDlg->SetTemplateFlags(nFlags);
+
+ nRet = pNewFileDlg->Execute();
+ if(RET_TEMPLATE_LOAD == nRet)
+ {
+ FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 );
+ uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+
+ xFP->setDisplayDirectory( aPathOpt.GetWorkPath() );
+
+ SfxObjectFactory &rFact = GetFactory();
+ SfxFilterMatcher aMatcher( String::CreateFromAscii(rFact.GetShortName()) );
+ SfxFilterMatcherIter aIter( &aMatcher );
+ uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
+ const SfxFilter* pFlt = aIter.First();
+ while( pFlt )
+ {
+ if( pFlt && pFlt->IsAllowedAsTemplate() )
+ {
+ const String sWild = ((WildCard&)pFlt->GetWildcard()).GetWildCard();
+ xFltMgr->appendFilter( pFlt->GetUIName(), sWild );
+ }
+ pFlt = aIter.Next();
+ }
+ BOOL bWeb = 0 != dynamic_cast< SwWebDocShell *>( this );
+ const SfxFilter *pOwnFlt =
+ SwDocShell::Factory().GetFilterContainer()->
+ GetFilter4FilterName(String::CreateFromAscii("writer8"));
+
+ //#b6439685# make sure the default file format is also available
+ if(bWeb)
+ {
+ const String sWild = ((WildCard&)pOwnFlt->GetWildcard()).GetWildCard();
+ xFltMgr->appendFilter( pOwnFlt->GetUIName(), sWild );
+ }
+
+ bool bError = false;
+ //#b6439685# catch expception if wrong filter is selected - should not happen anymore
+ try
+ {
+ xFltMgr->setCurrentFilter( pOwnFlt->GetUIName() );
+ }
+ catch( const uno::Exception& )
+ {
+ bError = true;
+ }
+
+ if( !bError && ERRCODE_NONE == aDlgHelper.Execute() )
+ {
+ aFileName = xFP->getFiles().getConstArray()[0];
+ }
+ }
+ else if( RET_OK == nRet)
+ {
+ aFileName = pNewFileDlg->GetTemplateFileName();
+ }
+
+ nFlags = pNewFileDlg->GetTemplateFlags();
+ rReq.AppendItem( SfxStringItem( SID_TEMPLATE_NAME, aFileName ) );
+ rReq.AppendItem( SfxInt32Item( SID_TEMPLATE_LOAD, (long) nFlags ) );
+ delete pNewFileDlg;
+ }
+
+ if( aFileName.Len() )
+ {
+ SwgReaderOption aOpt;
+ aOpt.SetTxtFmts( bText = (0 != (nFlags&SFX_LOAD_TEXT_STYLES) ));
+ aOpt.SetFrmFmts( bFrame = (0 != (nFlags&SFX_LOAD_FRAME_STYLES)));
+ aOpt.SetPageDescs( bPage = (0 != (nFlags&SFX_LOAD_PAGE_STYLES )));
+ aOpt.SetNumRules( bNum = (0 != (nFlags&SFX_LOAD_NUM_STYLES )));
+ //different meaning between SFX_MERGE_STYLES and aOpt.SetMerge!
+ bMerge = 0 != (nFlags&SFX_MERGE_STYLES);
+ aOpt.SetMerge( !bMerge );
+
+ SetError( LoadStylesFromFile( aFileName, aOpt, FALSE ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ));
+ if ( !GetError() )
+ rReq.Done();
+ }
+ }
+ break;
+ case SID_SOURCEVIEW:
+ {
+ SfxViewShell* pViewShell = GetView()
+ ? (SfxViewShell*)GetView()
+ : SfxViewShell::Current();
+ SfxViewFrame* pViewFrm = pViewShell->GetViewFrame();
+ SwSrcView* pSrcView = dynamic_cast< SwSrcView *>( pViewShell );
+ if(!pSrcView)
+ {
+ // 3 possible state:
+ // 1 - file unsaved -> save as HTML
+ // 2 - file modified and HTML filter active -> save
+ // 3 - file saved in non-HTML -> QueryBox to save as HTML
+ const SfxFilter* pHtmlFlt =
+ SwIoSystem::GetFilterOfFormat(
+ String::CreateFromAscii("HTML"),
+ SwWebDocShell::Factory().GetFilterContainer() );
+ BOOL bLocalHasName = HasName();
+ if(bLocalHasName)
+ {
+ //check for filter type
+ const SfxFilter* pFlt = GetMedium()->GetFilter();
+ if(!pFlt || pFlt->GetUserData() != pHtmlFlt->GetUserData())
+ {
+ QueryBox aQuery(&pViewFrm->GetWindow(), SW_RES(MSG_SAVEAS_HTML_QUERY));
+ if(RET_YES == aQuery.Execute())
+ bLocalHasName = FALSE;
+ else
+ break;
+ }
+ }
+ if(!bLocalHasName)
+ {
+ FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_AUTOEXTENSION, 0 );
+ aDlgHelper.AddFilter( pHtmlFlt->GetFilterName(), pHtmlFlt->GetDefaultExtension() );
+ aDlgHelper.SetCurrentFilter( pHtmlFlt->GetFilterName() );
+ if( ERRCODE_NONE != aDlgHelper.Execute())
+ {
+ break;
+ }
+ String sPath = aDlgHelper.GetPath();
+ SfxStringItem aName(SID_FILE_NAME, sPath);
+ SfxStringItem aFilter(SID_FILTER_NAME, pHtmlFlt->GetName());
+ const SfxBoolItem* pBool = (const SfxBoolItem*)
+ pViewFrm->GetDispatcher()->Execute(
+ SID_SAVEASDOC, SFX_CALLMODE_SYNCHRON, &aName, &aFilter, 0L );
+ if(!pBool || !pBool->GetValue())
+ break;
+ }
+ }
+#ifdef DBG_UTIL
+ {
+ BOOL bWeb = 0 != dynamic_cast<SwWebDocShell*>(this);
+ DBG_ASSERT(bWeb == TRUE, "SourceView nur in der WebDocShell");
+ }
+#endif
+ // die SourceView ist fuer die SwWebDocShell die 1
+ USHORT nSlot = SID_VIEWSHELL1;
+ BOOL bSetModified = FALSE;
+ SfxPrinter* pSavePrinter = 0;
+ if( 0 != pSrcView)
+ {
+ SfxPrinter* pTemp = GetDoc()->getPrinter( false );
+ if(pTemp)
+ pSavePrinter = new SfxPrinter(*pTemp);
+ bSetModified = IsModified() || pSrcView->IsModified();
+ if(pSrcView->IsModified()||pSrcView->HasSourceSaved())
+ {
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ pSrcView->SaveContent(aTempFile.GetURL());
+ bDone = TRUE;
+ SvxMacro aMac(aEmptyStr, aEmptyStr, STARBASIC);
+ SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_OPENDOC ), aMac, this);
+ SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEDOC ), aMac, this);
+ SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ), aMac, this);
+ SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_DEACTIVATEDOC ), aMac, this);
+ ReloadFromHtml(aTempFile.GetURL(), pSrcView);
+ nSlot = 0;
+ }
+ else
+ {
+ nSlot = SID_VIEWSHELL0;
+ }
+ }
+/* OS 10.04.97 14.20: Im Web-Writer gibt es keinen Unterschied zwischen
+ Export in den SourceMode und dem Speichern des Docs
+ else if(IsModified())
+ {
+ USHORT nRet = QueryBox( SFX_APPWINDOW ,SW_RES(MSG_SAVE_HTML_QUERY)).Execute();
+ if(RET_YES == nRet)
+ {
+ S F X _DISPATCHER().Execute(SID_SAVEDOC,
+ SFX_CALLMODE_SYNCHRON);
+ // der ReturnValue von SID_SAVEDOC ist etwas schwer verstaendlich
+ if(IsModified())
+ nSlot = 0;
+ }
+ else if( RET_CANCEL == nRet )
+ {
+ nSlot = 0;
+ }
+ }*/
+ if(nSlot)
+ pViewFrm->GetDispatcher()->Execute(nSlot, SFX_CALLMODE_SYNCHRON);
+ if(bSetModified)
+ GetDoc()->SetModified();
+ if(pSavePrinter)
+ {
+ GetDoc()->setPrinter( pSavePrinter, true, true);
+ //pSavePrinter darf nicht wieder geloescht werden
+ }
+ pViewFrm->GetBindings().SetState(SfxBoolItem(SID_SOURCEVIEW, nSlot == SID_VIEWSHELL2));
+ pViewFrm->GetBindings().Invalidate( SID_BROWSER_MODE );
+ pViewFrm->GetBindings().Invalidate( FN_PRINT_LAYOUT );
+ }
+ break;
+ case SID_GET_COLORTABLE:
+ {
+ SvxColorTableItem* pColItem = (SvxColorTableItem*)GetItem(SID_COLOR_TABLE);
+ XColorTable* pTable = pColItem->GetColorTable();
+ rReq.SetReturnValue(OfaPtrItem(SID_GET_COLORTABLE, pTable));
+ }
+ break;
+ case FN_ABSTRACT_STARIMPRESS:
+ case FN_ABSTRACT_NEWDOC:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwInsertAbstractDlg* pDlg = pFact->CreateSwInsertAbstractDlg(0, DLG_INSERT_ABSTRACT );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if(RET_OK == pDlg->Execute())
+ {
+ BYTE nLevel = pDlg->GetLevel();
+ BYTE nPara = pDlg->GetPara();
+ SwDoc* pSmryDoc = new SwDoc();
+ SfxObjectShellLock xDocSh( new SwDocShell( pSmryDoc, SFX_CREATE_MODE_STANDARD));
+ xDocSh->DoInitNew( 0 );
+
+ BOOL bImpress = FN_ABSTRACT_STARIMPRESS == nWhich;
+ pDoc->Summary( pSmryDoc, nLevel, nPara, bImpress );
+ if( bImpress )
+ {
+ WriterRef xWrt;
+ // mba: looks as if relative URLs don't make sense here
+ ::GetRTFWriter( aEmptyStr, String(), xWrt );
+ SvMemoryStream *pStrm = new SvMemoryStream();
+ pStrm->SetBufferSize( 16348 );
+ SwWriter aWrt( *pStrm, *pSmryDoc );
+ ErrCode eErr = aWrt.Write( xWrt );
+ if( !ERRCODE_TOERROR( eErr ) )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
+ uno::Reference< frame::XDispatchProvider > xProv(
+ xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.drawing.ModuleDispatcher")), UNO_QUERY );
+ if ( xProv.is() )
+ {
+ ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( "SendOutlineToImpress" );
+ uno::Reference< frame::XDispatchHelper > xHelper(
+ xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.DispatchHelper")), UNO_QUERY );
+ if ( xHelper.is() )
+ {
+ pStrm->Seek( STREAM_SEEK_TO_END );
+ *pStrm << '\0';
+ pStrm->Seek( STREAM_SEEK_TO_BEGIN );
+
+ // Transfer ownership of stream to a lockbytes object
+ SvLockBytes aLockBytes( pStrm, TRUE );
+ SvLockBytesStat aStat;
+ if ( aLockBytes.Stat( &aStat, SVSTATFLAG_DEFAULT ) == ERRCODE_NONE )
+ {
+ sal_uInt32 nLen = aStat.nSize;
+ ULONG nRead = 0;
+ uno::Sequence< sal_Int8 > aSeq( nLen );
+ aLockBytes.ReadAt( 0, aSeq.getArray(), nLen, &nRead );
+
+ uno::Sequence< beans::PropertyValue > aArgs(1);
+ aArgs[0].Name = ::rtl::OUString::createFromAscii("RtfOutline");
+ aArgs[0].Value <<= aSeq;
+ xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aArgs );
+ }
+ }
+ }
+ }
+ else
+ ErrorHandler::HandleError(ErrCode( eErr ));
+ }
+ else
+ {
+ // Neues Dokument erzeugen.
+ SfxViewFrame *pFrame = SfxViewFrame::LoadDocument( *xDocSh, 0 );
+ SwView *pCurrView = (SwView*) pFrame->GetViewShell();
+
+ // Dokumenttitel setzen
+ String aTmp( SW_RES(STR_ABSTRACT_TITLE) );
+ aTmp += GetTitle();
+ xDocSh->SetTitle( aTmp );
+ pCurrView->GetWrtShell().SetNewDoc();
+ pFrame->Show();
+ pSmryDoc->SetModified();
+ }
+
+ }
+ delete pDlg;
+ }
+ break;
+ case FN_OUTLINE_TO_CLIPBOARD:
+ case FN_OUTLINE_TO_IMPRESS:
+ {
+ WriterRef xWrt;
+ // mba: looks as if relative URLs don't make sense here
+ ::GetRTFWriter( 'O', String(), xWrt );
+ SvMemoryStream *pStrm = new SvMemoryStream();
+ pStrm->SetBufferSize( 16348 );
+ SwWriter aWrt( *pStrm, *GetDoc() );
+ ErrCode eErr = aWrt.Write( xWrt );
+ if( !ERRCODE_TOERROR( eErr ) )
+ {
+ pStrm->Seek( STREAM_SEEK_TO_END );
+ *pStrm << '\0';
+ pStrm->Seek( STREAM_SEEK_TO_BEGIN );
+ if ( nWhich == FN_OUTLINE_TO_IMPRESS )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory();
+ uno::Reference< frame::XDispatchProvider > xProv(
+ xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.drawing.ModuleDispatcher")), UNO_QUERY );
+ if ( xProv.is() )
+ {
+ ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( "SendOutlineToImpress" );
+ uno::Reference< frame::XDispatchHelper > xHelper(
+ xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.DispatchHelper")), UNO_QUERY );
+ if ( xHelper.is() )
+ {
+ pStrm->Seek( STREAM_SEEK_TO_END );
+ *pStrm << '\0';
+ pStrm->Seek( STREAM_SEEK_TO_BEGIN );
+
+ // Transfer ownership of stream to a lockbytes object
+ SvLockBytes aLockBytes( pStrm, TRUE );
+ SvLockBytesStat aStat;
+ if ( aLockBytes.Stat( &aStat, SVSTATFLAG_DEFAULT ) == ERRCODE_NONE )
+ {
+ sal_uInt32 nLen = aStat.nSize;
+ ULONG nRead = 0;
+ uno::Sequence< sal_Int8 > aSeq( nLen );
+ aLockBytes.ReadAt( 0, aSeq.getArray(), nLen, &nRead );
+
+ uno::Sequence< beans::PropertyValue > aArgs(1);
+ aArgs[0].Name = ::rtl::OUString::createFromAscii("RtfOutline");
+ aArgs[0].Value <<= aSeq;
+ xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aArgs );
+ }
+ }
+ }
+ }
+ else
+ {
+ TransferDataContainer* pClipCntnr =
+ new TransferDataContainer;
+ STAR_REFERENCE( datatransfer::XTransferable )
+ xRef( pClipCntnr );
+
+ pClipCntnr->CopyAnyData( FORMAT_RTF, (sal_Char*)
+ pStrm->GetData(), pStrm->GetEndOfData() );
+ pClipCntnr->CopyToClipboard(
+ GetView()? (Window*)&GetView()->GetEditWin() : 0 );
+ delete pStrm;
+ }
+ }
+ else
+ ErrorHandler::HandleError(ErrCode( eErr ));
+ }
+ break;
+ case SID_SPELLCHECKER_CHANGED:
+ //! FALSE, TRUE, TRUE is on the save side but a probably overdone
+ SW_MOD()->CheckSpellChanges(FALSE, TRUE, TRUE, FALSE );
+ break;
+
+ case SID_BROWSER_MODE:
+ case FN_PRINT_LAYOUT: //Fuer Web, genau umgekehrt zum BrowserMode
+ {
+ int eState = STATE_TOGGLE;
+ BOOL bSet = sal_True;
+ const SfxPoolItem* pAttr=NULL;
+ if ( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nWhich , FALSE, &pAttr ))
+ {
+ bSet = ((SfxBoolItem*)pAttr)->GetValue();
+ if ( nWhich == FN_PRINT_LAYOUT )
+ bSet = !bSet;
+ eState = bSet ? STATE_ON : STATE_OFF;
+ }
+
+ if ( STATE_TOGGLE == eState )
+ bSet = !GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE);
+
+ ToggleBrowserMode(bSet, 0);
+
+ // OS: numerische Reihenfolge beachten!
+ static USHORT __READONLY_DATA aInva[] =
+ {
+ SID_NEWWINDOW,/*5620*/
+ SID_BROWSER_MODE, /*6313*/
+ SID_RULER_BORDERS, SID_RULER_PAGE_POS,
+ SID_ATTR_LONG_LRSPACE,
+ SID_HTML_MODE,
+ SID_RULER_PROTECT,
+ SID_AUTOSPELL_CHECK,
+ FN_RULER, /*20211*/
+ FN_VIEW_GRAPHIC, /*20213*/
+ FN_VIEW_BOUNDS, /**/
+ FN_VIEW_FIELDS, /*20215*/
+ FN_VLINEAL, /*20216*/
+ FN_VSCROLLBAR, /*20217*/
+ FN_HSCROLLBAR, /*20218*/
+ FN_VIEW_META_CHARS, /**/
+ FN_VIEW_MARKS, /**/
+ FN_VIEW_FIELDNAME, /**/
+ FN_VIEW_TABLEGRID, /*20227*/
+ FN_PRINT_LAYOUT, /*20237*/
+ FN_QRY_MERGE, /*20364*/
+ 0
+ };
+ // the view must not exist!
+ SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst( this );
+ if( pTmpFrm )
+ pTmpFrm->GetBindings().Invalidate( aInva );
+ if ( !pAttr )
+ rReq.AppendItem( SfxBoolItem( nWhich, bSet ) );
+ rReq.Done();
+ }
+ break;
+
+ case SID_MAIL_PREPAREEXPORT:
+ {
+ //pWrtShell is not set in page preview
+ if(pWrtShell)
+ pWrtShell->StartAllAction();
+ pDoc->UpdateFlds( NULL, false );
+ pDoc->EmbedAllLinks();
+ pDoc->RemoveInvisibleContent();
+ if(pWrtShell)
+ pWrtShell->EndAllAction();
+ }
+ break;
+ case SID_MAIL_EXPORT_FINISHED:
+ {
+ if(pWrtShell)
+ pWrtShell->StartAllAction();
+ //try to undo the removal of invisible content
+ pDoc->RestoreInvisibleContent();
+ if(pWrtShell)
+ pWrtShell->EndAllAction();
+ }
+ break;
+ case FN_NEW_HTML_DOC:
+ case FN_NEW_GLOBAL_DOC:
+ {
+ bDone = FALSE;
+ BOOL bCreateHtml = FN_NEW_HTML_DOC == nWhich;
+
+ BOOL bCreateByOutlineLevel = false; //#outline level,add by zhaojianwei
+ sal_Int32 nTemplateOutlineLevel = 0 ; //#outline level,add by zhaojianwei
+
+ String aFileName, aTemplateName;
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nWhich, FALSE, &pItem ) )
+ {
+ aFileName = ((const SfxStringItem*)pItem)->GetValue();
+ SFX_ITEMSET_ARG( pArgs, pTemplItem, SfxStringItem, SID_TEMPLATE_NAME, sal_False );
+ if ( pTemplItem )
+ aTemplateName = pTemplItem->GetValue();
+ }
+ bool bError = false;
+ if ( !aFileName.Len() )
+ {
+ FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_AUTOEXTENSION_TEMPLATE, 0 );
+
+ const sal_Int16 nControlIds[] = {
+ CommonFilePickerElementIds::PUSHBUTTON_OK,
+ CommonFilePickerElementIds::PUSHBUTTON_CANCEL,
+ CommonFilePickerElementIds::LISTBOX_FILTER,
+ CommonFilePickerElementIds::CONTROL_FILEVIEW,
+ CommonFilePickerElementIds::EDIT_FILEURL,
+ ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION,
+ ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
+ 0
+ };
+
+ const char* aHTMLHelpIds[] =
+ {
+ HID_SEND_HTML_CTRL_PUSHBUTTON_OK,
+ HID_SEND_HTML_CTRL_PUSHBUTTON_CANCEL,
+ HID_SEND_HTML_CTRL_LISTBOX_FILTER,
+ HID_SEND_HTML_CTRL_CONTROL_FILEVIEW,
+ HID_SEND_HTML_CTRL_EDIT_FILEURL,
+ HID_SEND_HTML_CTRL_CHECKBOX_AUTOEXTENSION,
+ HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE,
+ ""
+ };
+
+ const char* aMasterHelpIds[] =
+ {
+ HID_SEND_MASTER_CTRL_PUSHBUTTON_OK,
+ HID_SEND_MASTER_CTRL_PUSHBUTTON_CANCEL,
+ HID_SEND_MASTER_CTRL_LISTBOX_FILTER,
+ HID_SEND_MASTER_CTRL_CONTROL_FILEVIEW,
+ HID_SEND_MASTER_CTRL_EDIT_FILEURL,
+ HID_SEND_MASTER_CTRL_CHECKBOX_AUTOEXTENSION,
+ HID_SEND_MASTER_CTRL_LISTBOX_TEMPLATE,
+ ""
+ };
+
+ const char** pHelpIds = bCreateHtml ? aHTMLHelpIds : aMasterHelpIds;
+ aDlgHelper.SetControlHelpIds( nControlIds, pHelpIds );
+ uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+
+ const SfxFilter* pFlt;
+ USHORT nStrId;
+
+ if( bCreateHtml )
+ {
+ // fuer HTML gibts es nur einen Filter!!
+ pFlt = SwIoSystem::GetFilterOfFormat(
+ String::CreateFromAscii("HTML"),
+ SwWebDocShell::Factory().GetFilterContainer() );
+ nStrId = STR_LOAD_HTML_DOC;
+ }
+ else
+ {
+ // Fuer Global-Dokumente bieten wir jetzt auch nur
+ // noch den aktuellen an.
+ pFlt = SwGlobalDocShell::Factory().GetFilterContainer()->
+ GetFilter4Extension( String::CreateFromAscii("odm") );
+ nStrId = STR_LOAD_GLOBAL_DOC;
+ }
+
+ if( pFlt )
+ {
+ uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
+ const String sWild = ((WildCard&)pFlt->GetWildcard()).GetWildCard();
+ xFltMgr->appendFilter( pFlt->GetUIName(), sWild );
+ try
+ {
+ xFltMgr->setCurrentFilter( pFlt->GetUIName() ) ;
+ }
+ catch( const uno::Exception& )
+ {
+ bError = true;
+ }
+ }
+ if(!bError)
+ {
+ uno::Reference<XFilePickerControlAccess> xCtrlAcc(xFP, UNO_QUERY);
+
+ //#removed by zhaojianwei
+
+ // const USHORT nCount = pDoc->GetTxtFmtColls()->Count();
+ // Sequence<OUString> aListBoxEntries(nCount);
+ // OUString* pEntries = aListBoxEntries.getArray();
+ // sal_Int32 nIdx = 0;
+ // sal_Int16 nSelect = 0;
+ // OUString sStartTemplate;
+ // SwTxtFmtColl *pFnd = 0, *pAny = 0;
+ // for(USHORT i = 0; i < nCount; ++i)
+ // {
+ // SwTxtFmtColl &rTxtColl =
+ // *pDoc->GetTxtFmtColls()->GetObject( i );
+ // if( !rTxtColl.IsDefault() && rTxtColl.IsAtDocNodeSet() )
+ // {
+ // //if( MAXLEVEL >= rTxtColl.GetOutlineLevel() && ( !pFnd || //#outline level,zhaojianwei
+ //if( rTxtColl.IsAssignedToListLevelOfOutlineStyle() && ( !pFnd || //<-end,zhaojianwei
+ // pFnd->GetAssignedOutlineStyleLevel() > rTxtColl.GetAssignedOutlineStyleLevel() ))
+ // {
+ // nSelect = (sal_Int16)nIdx;
+ // pFnd = &rTxtColl;
+ // sStartTemplate = rTxtColl.GetName();
+ // }
+ // else if( !pAny )
+ // pAny = &rTxtColl;
+ // //pEntries[nIdx++] = rTxtColl.GetName(); //#outline level,remove by zhaojianwei
+ // pEntries[nIdx++] = sStyles + rTxtColl.GetName(); //#outline level,add by zhaojianwei
+ // }
+ // }
+ // if(!sStartTemplate.getLength() && pAny)
+ // sStartTemplate = pAny->GetName();
+ // aListBoxEntries.realloc(nIdx);
+ //<-end,zhaojianwei
+
+
+ //#outline level,add by zhaojianwei
+ /////////////////////////////////////////////////////////////////////
+
+ bool bOutline[MAXLEVEL] = {false};
+ const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds();
+ if( rOutlNds.Count() )
+ {
+ int nLevel;
+ for(USHORT n = 0; n < rOutlNds.Count(); ++n )
+ if( ( nLevel = rOutlNds[n]->GetTxtNode()->GetAttrOutlineLevel()) > 0 &&
+ ! bOutline[nLevel-1] )
+ {
+ bOutline[nLevel-1] = true;
+ }
+ }
+
+ const USHORT nStyleCount = pDoc->GetTxtFmtColls()->Count();
+ Sequence<OUString> aListBoxEntries( MAXLEVEL + nStyleCount);
+ OUString* pEntries = aListBoxEntries.getArray();
+ sal_Int32 nIdx = 0 ;
+
+ OUString sOutline( SW_RESSTR(STR_FDLG_OUTLINE_LEVEL) );
+ for( USHORT i = 0; i < MAXLEVEL; ++i )
+ {
+ if( bOutline[i] )
+ pEntries[nIdx++] = sOutline + String::CreateFromInt32( i+1 );
+ }
+
+ OUString sStyle( SW_RESSTR(STR_FDLG_STYLE) );
+ for(USHORT i = 0; i < nStyleCount; ++i)
+ {
+ SwTxtFmtColl &rTxtColl =
+ *pDoc->GetTxtFmtColls()->GetObject( i );
+ if( !rTxtColl.IsDefault() && rTxtColl.IsAtDocNodeSet() )
+ {
+ pEntries[nIdx++] = sStyle + rTxtColl.GetName();
+ }
+ }
+
+ aListBoxEntries.realloc(nIdx);
+ sal_Int16 nSelect = 0;
+ /////////////////////////////////////////////////////////////////////
+ //<-end,zhaojianwei
+
+ try
+ {
+ Any aTemplates(&aListBoxEntries, ::getCppuType(&aListBoxEntries));
+
+ xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
+ ListboxControlActions::ADD_ITEMS , aTemplates );
+ Any aSelectPos(&nSelect, ::getCppuType(&nSelect));
+ xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
+ ListboxControlActions::SET_SELECT_ITEM, aSelectPos );
+ xCtrlAcc->setLabel( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
+ String(SW_RES( STR_FDLG_TEMPLATE_NAME )));
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("control acces failed");
+ }
+
+ xFP->setTitle( SW_RESSTR( nStrId ));
+ SvtPathOptions aPathOpt;
+ xFP->setDisplayDirectory( aPathOpt.GetWorkPath() );
+ if( ERRCODE_NONE == aDlgHelper.Execute())
+ {
+ aFileName = xFP->getFiles().getConstArray()[0];
+ Any aTemplateValue = xCtrlAcc->getValue(
+ ExtendedFilePickerElementIds::LISTBOX_TEMPLATE,
+ ListboxControlActions::GET_SELECTED_ITEM );
+ OUString sTmpl;
+ aTemplateValue >>= sTmpl;
+ //aTemplateName = sTmpl; //#outline level,removed by zhaojianwei
+ //#outline level,add by zhaojianwei
+
+ sal_Int32 nColonPos = sTmpl.indexOf( sal_Unicode(':') );
+ OUString sPrefix = sTmpl.copy( 0L, nColonPos );
+ if( sPrefix.equalsAscii("Style"))
+ {
+ aTemplateName = sTmpl.copy( 7L ); //get string behind "Style: "
+ }
+ else if( sPrefix.equalsAscii("Outline"))
+ {
+ nTemplateOutlineLevel = ( sTmpl.copy( 15L )).toInt32(); //get string behind "Outline: Leve ";
+ bCreateByOutlineLevel = true;
+ }
+ //<-end,zhaojianwei
+
+ if ( aFileName.Len() )
+ {
+ rReq.AppendItem( SfxStringItem( nWhich, aFileName ) );
+ if( aTemplateName.Len() )
+ rReq.AppendItem( SfxStringItem( SID_TEMPLATE_NAME, aTemplateName ) );
+ }
+ }
+ }
+ }
+
+ //const SwTxtFmtColl* pSplitColl = 0; //#outline level,removed by zhaojianwei
+ // if ( aTemplateName.Len() )
+ // pSplitColl = pDoc->FindTxtFmtCollByName(aTemplateName);
+ //<-end,zhaojianwei
+ if( aFileName.Len() )
+ {
+ if( PrepareClose( FALSE ) )
+ {
+ SwWait aWait( *this, TRUE );
+
+ //bDone = bCreateHtml //#outline level,removed by zhaojianwei
+ // ? pDoc->GenerateHTMLDoc( aFileName, pSplitColl )
+ // : pDoc->GenerateGlobalDoc( aFileName, pSplitColl );
+ if ( bCreateByOutlineLevel ) //add by zhaojianwei
+ {
+ bDone = bCreateHtml //#outline level,removed by zhaojianwei
+ ? pDoc->GenerateHTMLDoc( aFileName, nTemplateOutlineLevel )
+ : pDoc->GenerateGlobalDoc( aFileName, nTemplateOutlineLevel );
+ }
+ else
+ {
+ const SwTxtFmtColl* pSplitColl = 0;
+ if ( aTemplateName.Len() )
+ pSplitColl = pDoc->FindTxtFmtCollByName(aTemplateName);
+ bDone = bCreateHtml //#outline level,removed by zhaojianwei
+ ? pDoc->GenerateHTMLDoc( aFileName, pSplitColl )
+ : pDoc->GenerateGlobalDoc( aFileName, pSplitColl );
+ }
+ //<-end,zhaojianwei
+ if( bDone )
+ {
+ SfxStringItem aName( SID_FILE_NAME, aFileName );
+ SfxStringItem aReferer( SID_REFERER, aEmptyStr );
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+ while(pViewShell)
+ {
+ //search for the view that created the call
+ if(pViewShell->GetObjectShell() == this && pViewShell->GetDispatcher())
+ {
+ SfxFrameItem* pFrameItem = new SfxFrameItem( SID_DOCFRAME,
+ pViewShell->GetViewFrame() );
+ SfxDispatcher* pDispatch = pViewShell->GetDispatcher();
+ pDispatch->Execute(
+ SID_OPENDOC,
+ SFX_CALLMODE_ASYNCHRON,
+ &aName,
+ &aReferer,
+ pFrameItem, 0L );
+
+ delete pFrameItem;
+ break;
+ }
+ pViewShell = SfxViewShell::GetNext(*pViewShell);
+ }
+ }
+ }
+ if( !bDone && !rReq.IsAPI() )
+ {
+ InfoBox( 0, SW_RESSTR( STR_CANTCREATE )).Execute();
+ }
+ }
+ }
+ rReq.SetReturnValue(SfxBoolItem( nWhich, bDone ));
+ if (bDone)
+ rReq.Done();
+ else
+ rReq.Ignore();
+ break;
+
+ case SID_ATTR_YEAR2000:
+ if ( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nWhich , FALSE, &pItem ))
+ {
+ DBG_ASSERT(pItem->ISA(SfxUInt16Item), "falsches Item");
+ USHORT nYear2K = ((SfxUInt16Item*)pItem)->GetValue();
+ //ueber Views iterieren und den State an den FormShells setzen
+
+ SfxViewFrame* pVFrame = SfxViewFrame::GetFirst( this );
+ SfxViewShell* pViewShell = pVFrame ? pVFrame->GetViewShell() : 0;
+ SwView* pCurrView = dynamic_cast< SwView* >( pViewShell );
+ while(pCurrView)
+ {
+ FmFormShell* pFormShell = pCurrView->GetFormShell();
+ if(pFormShell)
+ pFormShell->SetY2KState(nYear2K);
+ pVFrame = SfxViewFrame::GetNext( *pVFrame, this );
+ pViewShell = pVFrame ? pVFrame->GetViewShell() : 0;
+ pCurrView = dynamic_cast<SwView*>( pViewShell );
+ }
+ pDoc->GetNumberFormatter(TRUE)->SetYear2000(nYear2K);
+ }
+ break;
+
+ default: DBG_ERROR("falscher Dispatcher");
+ }
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+long SwDocShell::DdeGetData( const String& rItem, const String& rMimeType,
+ uno::Any & rValue )
+{
+ return pDoc->GetData( rItem, rMimeType, rValue );
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+long SwDocShell::DdeSetData( const String& rItem, const String& rMimeType,
+ const uno::Any & rValue )
+{
+ return pDoc->SetData( rItem, rMimeType, rValue );
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+::sfx2::SvLinkSource* SwDocShell::DdeCreateLinkSource( const String& rItem )
+{
+ return pDoc->CreateLinkSource( rItem );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDocShell::FillClass( SvGlobalName * pClassName,
+ sal_uInt32 * pClipFormat,
+ String * /*pAppName*/,
+ String * pLongUserName,
+ String * pUserName,
+ sal_Int32 nVersion,
+ sal_Bool bTemplate /* = sal_False */) const
+{
+ if (nVersion == SOFFICE_FILEFORMAT_60)
+ {
+ *pClassName = SvGlobalName( SO3_SW_CLASSID_60 );
+ *pClipFormat = SOT_FORMATSTR_ID_STARWRITER_60;
+ *pLongUserName = SW_RESSTR(STR_WRITER_DOCUMENT_FULLTYPE);
+ }
+ else if (nVersion == SOFFICE_FILEFORMAT_8)
+ {
+ *pClassName = SvGlobalName( SO3_SW_CLASSID_60 );
+ *pClipFormat = bTemplate ? SOT_FORMATSTR_ID_STARWRITER_8_TEMPLATE : SOT_FORMATSTR_ID_STARWRITER_8;
+ *pLongUserName = SW_RESSTR(STR_WRITER_DOCUMENT_FULLTYPE);
+ }
+
+ *pUserName = SW_RESSTR(STR_HUMAN_SWDOC_NAME);
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDocShell::SetModified( BOOL bSet )
+{
+ SfxObjectShell::SetModified( bSet );
+ if( IsEnableSetModified())
+ {
+ if (!pDoc->IsInCallModified() )
+ {
+ EnableSetModified( FALSE );
+ if( bSet )
+ {
+ BOOL bOld = pDoc->IsModified();
+ pDoc->SetModified();
+ if( !bOld )
+ {
+ pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified();
+ }
+ }
+ else
+ pDoc->ResetModified();
+
+ EnableSetModified( TRUE );
+ }
+
+ UpdateChildWindows();
+ Broadcast(SfxSimpleHint(SFX_HINT_DOCCHANGED));
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDocShell::UpdateChildWindows()
+{
+ // Flddlg ggf neu initialisieren (z.B. fuer TYP_SETVAR)
+ if(!GetView())
+ return;
+ SfxViewFrame* pVFrame = GetView()->GetViewFrame();
+ SwFldDlgWrapper *pWrp = (SwFldDlgWrapper*)pVFrame->
+ GetChildWindow( SwFldDlgWrapper::GetChildWindowId() );
+ if( pWrp )
+ pWrp->ReInitDlg( this );
+
+ // RedlineDlg ggf neu initialisieren
+ SwRedlineAcceptChild *pRed = (SwRedlineAcceptChild*)pVFrame->
+ GetChildWindow( SwRedlineAcceptChild::GetChildWindowId() );
+ if( pRed )
+ pRed->ReInitDlg( this );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+// --> OD 2005-08-02 #i48748#
+class SwReloadFromHtmlReader : public SwReader
+{
+ public:
+ SwReloadFromHtmlReader( SfxMedium& _rTmpMedium,
+ const String& _rFilename,
+ SwDoc* _pDoc )
+ : SwReader( _rTmpMedium, _rFilename, _pDoc )
+ {
+ SetBaseURL( _rFilename );
+ }
+};
+// <--
+void SwDocShell::ReloadFromHtml( const String& rStreamName, SwSrcView* pSrcView )
+{
+ BOOL bModified = IsModified();
+
+ // MIB 23.6.97: Die HTTP-Header-Felder muessen geloescht werden,
+ // sonst gibt es welche aus Meta-Tags hinter doppelt und dreifach.
+ ClearHeaderAttributesForSourceViewHack();
+
+ // MIB 24.07.97: Das Dokument-Basic muss auch noch d'ran glauben ...
+ SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get();
+ //#59620# HasBasic() zeigt an, dass es schon einen BasicManager an der DocShell
+ // gibt. Der wurde im HTML-Import immer angelegt, wenn Macros im Quelltext
+ // vorhanden sind.
+ if( pHtmlOptions && pHtmlOptions->IsStarBasic() && HasBasic())
+ {
+ BasicManager *pBasicMan = GetBasicManager();
+ if( pBasicMan && (pBasicMan != SFX_APP()->GetBasicManager()) )
+ {
+ USHORT nLibCount = pBasicMan->GetLibCount();
+ while( nLibCount )
+ {
+ StarBASIC *pBasic = pBasicMan->GetLib( --nLibCount );
+ if( pBasic )
+ {
+ // Die IDE benachrichtigen
+ SfxUsrAnyItem aShellItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, makeAny( GetModel() ) );
+ String aLibName( pBasic->GetName() );
+ SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName );
+ pSrcView->GetViewFrame()->GetDispatcher()->Execute(
+ SID_BASICIDE_LIBREMOVED,
+ SFX_CALLMODE_SYNCHRON,
+ &aShellItem, &aLibNameItem, 0L );
+
+ // Aus der Standard-Lib werden nur die Module geloescht
+ if( nLibCount )
+ pBasicMan->RemoveLib( nLibCount, TRUE );
+ else
+ pBasic->Clear();
+ }
+ }
+
+ ASSERT( pBasicMan->GetLibCount() <= 1,
+ "Loschen des Basics hat nicht geklappt" );
+ }
+ }
+ sal_Bool bWasBrowseMode = pDoc->get(IDocumentSettingAccess::BROWSE_MODE);
+ RemoveLink();
+
+ //jetzt muss auch das UNO-Model ueber das neue Doc informiert werden #51535#
+ uno::Reference<text::XTextDocument> xDoc(GetBaseModel(), uno::UNO_QUERY);
+ text::XTextDocument* pxDoc = xDoc.get();
+ ((SwXTextDocument*)pxDoc)->InitNewDoc();
+
+ AddLink();
+ //#116402# update font list when new document is created
+ UpdateFontList();
+ pDoc->set(IDocumentSettingAccess::BROWSE_MODE, bWasBrowseMode);
+ pSrcView->SetPool(&GetPool());
+
+
+ const String& rMedname = GetMedium()->GetName();
+
+ // fix #51032#: Die HTML-Vorlage muss noch gesetzt werden
+ SetHTMLTemplate( *GetDoc() ); //Styles aus HTML.vor
+
+ SfxViewShell* pViewShell = GetView() ? (SfxViewShell*)GetView()
+ : SfxViewShell::Current();
+ SfxViewFrame* pViewFrm = pViewShell->GetViewFrame();
+ pViewFrm->GetDispatcher()->Execute( SID_VIEWSHELL0, SFX_CALLMODE_SYNCHRON );
+
+ SubInitNew();
+
+ SfxMedium aMed( rStreamName, STREAM_READ, FALSE );
+ // --> OD 2005-08-01 #i48748# - use class <SwReloadFromHtmlReader>, because
+ // the base URL has to be set to the filename of the document <rMedname>
+ // and not to the base URL of the temporary file <aMed> in order to get
+ // the URLs of the linked graphics correctly resolved.
+ SwReloadFromHtmlReader aReader( aMed, rMedname, pDoc );
+ // <--
+ aReader.Read( *ReadHTML );
+
+ const SwView* pCurrView = GetView();
+ //in print layout the first page(s) may have been formatted as a mix of browse
+ //and print layout
+ if(!bWasBrowseMode && pCurrView)
+ {
+ SwWrtShell& rWrtSh = pCurrView->GetWrtShell();
+ if( rWrtSh.GetLayout())
+ rWrtSh.CheckBrowseView( TRUE );
+ }
+
+
+ // MIB 23.6.97: Die HTTP-Header-Attribute wieder in die DokInfo
+ // uebernehmen. Die Base-URL ist hier egal, da TLX zum absolutieren die
+ // vom Dokument nimmt.
+ SetHeaderAttributesForSourceViewHack();
+
+ if(bModified && !IsReadOnly())
+ SetModified();
+ else
+ pDoc->ResetModified();
+}
+
+/* -----------------------------14.12.99 16:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDocShell::ToggleBrowserMode(BOOL bSet, SwView* _pView )
+{
+ GetDoc()->set(IDocumentSettingAccess::BROWSE_MODE, bSet );
+ UpdateFontList();
+ SwView* pTempView = _pView ? _pView : (SwView*)GetView();
+ if( pTempView )
+ {
+ SfxBindings& rBind = pTempView->GetViewFrame()->GetBindings();
+ rBind.Invalidate(FN_SHADOWCURSOR);
+ rBind.Invalidate(SID_BROWSER_MODE);
+ rBind.Invalidate(FN_PRINT_LAYOUT);
+
+ if( !GetDoc()->getPrinter( false ) )
+ {
+ pTempView->SetPrinter( GetDoc()->getPrinter( false ),
+ SFX_PRINTER_PRINTER | SFX_PRINTER_JOBSETUP );
+ }
+
+ // --> FME 2005-03-16 #i44963# Good occasion to check if page sizes in
+ // page descriptions are still set to (LONG_MAX, LONG_MAX) (html import)
+ GetDoc()->CheckDefaultPageFmt();
+ // <--
+
+ // Currently there can be only one view (layout) if the document is viewed in Web layout
+ // So if there are more views we are in print layout and for toggling to Web layout all other views must be closed
+ SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, FALSE);
+ do {
+ if( pTmpFrm != pTempView->GetViewFrame() )
+ {
+ pTmpFrm->DoClose();
+ pTmpFrm = SfxViewFrame::GetFirst(this, FALSE);
+ }
+ else
+ pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this, FALSE);
+
+ } while ( pTmpFrm );
+
+ const SwViewOption& rViewOptions = *pTempView->GetWrtShell().GetViewOptions();
+
+ // set view columns before toggling:
+ if ( bSet )
+ {
+ const USHORT nColumns = rViewOptions.GetViewLayoutColumns();
+ const bool bBookMode = rViewOptions.IsViewLayoutBookMode();
+ if ( 1 != nColumns || bBookMode )
+ {
+ ((SwView*)GetView())->SetViewLayout( 1, false );
+ }
+ }
+
+ // Triggeres a formatting:
+ pTempView->GetWrtShell().CheckBrowseView( TRUE );
+ pTempView->CheckVisArea();
+
+ if( GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE) )
+ {
+ const SvxZoomType eType = (SvxZoomType)rViewOptions.GetZoomType();
+
+ if ( SVX_ZOOM_PERCENT != eType)
+ {
+ ((SwView*)GetView())->SetZoom( eType );
+ }
+ }
+ pTempView->InvalidateBorder();
+ pTempView->SetNewWindowAllowed(!bSet);
+ }
+}
+
+ULONG SwDocShell::LoadStylesFromFile( const String& rURL,
+ SwgReaderOption& rOpt, BOOL bUnoCall )
+{
+ ULONG nErr = 0;
+
+ // Create a URL from filename
+ INetURLObject aURLObj( rURL );
+ String sURL( aURLObj.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ SwRead pRead = 0;
+ SwReader* pReader = 0;
+ SwPaM* pPam = 0;
+
+ // Filter bestimmen:
+// const SfxFilter* pFlt = SwIoSystem::GetFileFilter( rURL, aEmptyStr );
+ String sFactory(String::CreateFromAscii(SwDocShell::Factory().GetShortName()));
+ SfxFilterMatcher aMatcher( sFactory );
+
+ //#b6445961# search for filter in WebDocShell, too
+ SfxMedium aMed( rURL, STREAM_STD_READ, FALSE );
+ const SfxFilter* pFlt = 0;
+ aMatcher.DetectFilter( aMed, &pFlt, FALSE, FALSE );
+ if(!pFlt)
+ {
+ String sWebFactory(String::CreateFromAscii(SwWebDocShell::Factory().GetShortName()));
+ SfxFilterMatcher aWebMatcher( sWebFactory );
+ aWebMatcher.DetectFilter( aMed, &pFlt, FALSE, FALSE );
+ }
+ if( aMed.IsStorage() )
+ {
+ DBG_ASSERT((pFlt ? pFlt->GetVersion() : 0) >= SOFFICE_FILEFORMAT_60, "which file version?");
+ pRead = ReadXML;
+ // the SW3IO - Reader need the pam/wrtshell, because only then he
+ // insert the styles!
+ if( bUnoCall )
+ {
+ SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfContent(), -1 );
+ pPam = new SwPaM( aIdx );
+ pReader = new SwReader( aMed, rURL, *pPam );
+ }
+ else
+ pReader = new SwReader( aMed, rURL, *pWrtShell->GetCrsr() );
+ }
+ else if( pFlt )
+ {
+// if( pFlt->GetUserData().EqualsAscii( FILTER_SWG ) ||
+// pFlt->GetUserData().EqualsAscii( FILTER_SWGV ))
+// pRead = ReadSwg;
+ pReader = new SwReader( aMed, rURL, pDoc );
+ }
+
+ ASSERT( pRead, "no reader found" );
+ if( pRead )
+ {
+ pRead->GetReaderOpt().SetTxtFmts( rOpt.IsTxtFmts() );
+ pRead->GetReaderOpt().SetFrmFmts( rOpt.IsFrmFmts() );
+ pRead->GetReaderOpt().SetPageDescs( rOpt.IsPageDescs() );
+ pRead->GetReaderOpt().SetNumRules( rOpt.IsNumRules() );
+ pRead->GetReaderOpt().SetMerge( rOpt.IsMerge() );
+
+ if( bUnoCall )
+ {
+ UnoActionContext aAction( pDoc );
+ nErr = pReader->Read( *pRead );
+ }
+ else
+ {
+ pWrtShell->StartAllAction();
+ nErr = pReader->Read( *pRead );
+ pWrtShell->EndAllAction();
+ }
+ }
+ delete pPam;
+ delete pReader;
+ return nErr;
+}
+
+/*--------------------------------------------------------------------
+ Get a client for an embedded object if possible.
+ --------------------------------------------------------------------*/
+SfxInPlaceClient* SwDocShell::GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef )
+{
+ SfxInPlaceClient* pResult = NULL;
+
+ SwWrtShell* pShell = GetWrtShell();
+ if ( pShell )
+ {
+ pResult = pShell->GetView().FindIPClient( xObjRef.GetObject(), (Window*)&pShell->GetView().GetEditWin() );
+ if ( !pResult )
+ pResult = new SwOleClient( &pShell->GetView(), &pShell->GetView().GetEditWin(), xObjRef );
+ }
+
+ return pResult;
+}
+
diff --git a/sw/source/ui/app/docshdrw.cxx b/sw/source/ui/app/docshdrw.cxx
new file mode 100644
index 000000000000..cd6d2aee296d
--- /dev/null
+++ b/sw/source/ui/app/docshdrw.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+
+#ifndef _SVX_SVXIDS_HRC //autogen
+#include <svx/svxids.hrc>
+#endif
+
+
+
+
+
+
+
+
+#include <svl/stritem.hxx>
+#include <svx/drawitem.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/xtable.hxx>
+
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <doc.hxx>
+
+using namespace ::com::sun::star;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Document laden
+ --------------------------------------------------------------------*/
+
+
+void SwDocShell::InitDraw()
+{
+ SdrModel *pDrDoc = pDoc->GetDrawModel();
+ if( pDrDoc )
+ {
+ // Listen, bzw. Tables im ItemSet der DocShell anlegen
+ PutItem( SvxGradientListItem( pDrDoc->GetGradientList(), SID_GRADIENT_LIST ) );
+ PutItem( SvxHatchListItem( pDrDoc->GetHatchList(), SID_HATCH_LIST ) );
+ PutItem( SvxBitmapListItem( pDrDoc->GetBitmapList(), SID_BITMAP_LIST ) );
+ PutItem( SvxDashListItem( pDrDoc->GetDashList(), SID_DASH_LIST ) );
+ PutItem( SvxLineEndListItem( pDrDoc->GetLineEndList(), SID_LINEEND_LIST ) );
+
+ Outliner& rOutliner = pDrDoc->GetDrawOutliner();
+ uno::Reference<linguistic2::XHyphenator> xHyphenator( ::GetHyphenator() );
+ rOutliner.SetHyphenator( xHyphenator );
+ }
+ else
+ PutItem( SvxColorTableItem( XColorTable::GetStdColorTable(), SID_COLOR_TABLE ));
+}
+
+
+
diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx
new file mode 100644
index 000000000000..d4b15b7febd0
--- /dev/null
+++ b/sw/source/ui/app/docshini.cxx
@@ -0,0 +1,818 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+
+#include <svx/dialogs.hrc>
+#include <i18npool/mslangid.hxx>
+#include <sot/storinfo.hxx>
+#include <sot/storage.hxx>
+#include <svl/zforlist.hxx>
+#include <svtools/ctrltool.hxx>
+#include <unotools/lingucfg.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/sfxmodelfactory.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/bindings.hxx>
+#include <svl/asiancfg.hxx>
+#include <editeng/unolingu.hxx>
+#include <sfx2/request.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/akrnitem.hxx>
+#include <linguistic/lngprops.hxx>
+#include <com/sun/star/document/UpdateDocMode.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <rtl/logfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <svx/xtable.hxx>
+#include <svx/drawitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/flstitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/hyznitem.hxx>
+#include <editeng/svxacorr.hxx>
+#include <vcl/svapp.hxx>
+#include <view.hxx>
+#include <prtopt.hxx>
+#include <fmtcol.hxx>
+#include <docsh.hxx>
+#include <wdocsh.hxx>
+#include <swmodule.hxx>
+#include <doc.hxx>
+#include <docfac.hxx>
+#include <docstyle.hxx>
+#include <shellio.hxx>
+#include <tox.hxx>
+#include <swdtflvr.hxx>
+#include <dbmgr.hxx>
+#include <usrpref.hxx>
+#include <fontcfg.hxx>
+#include <poolfmt.hxx>
+#include <modcfg.hxx>
+#include <globdoc.hxx>
+#include <ndole.hxx>
+#include <mdiexp.hxx>
+#include <unotxdoc.hxx>
+#include <linkenum.hxx>
+#include <swwait.hxx>
+#include <wrtsh.hxx>
+#include <swerror.h>
+#include <globals.hrc>
+
+// #i18732#
+#include <fmtfollowtextflow.hxx>
+
+#include <unochart.hxx>
+
+// text grid
+#include <tgrditem.hxx>
+
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+/*-----------------21.09.96 15.29-------------------
+
+--------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Document laden
+ --------------------------------------------------------------------*/
+
+
+sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::InitNew" );
+
+ sal_Bool bRet = SfxObjectShell::InitNew( xStor );
+ ASSERT( GetMapUnit() == MAP_TWIP, "map unit is not twip!" );
+ sal_Bool bHTMLTemplSet = sal_False;
+ if( bRet )
+ {
+ AddLink(); // pDoc / pIo ggf. anlegen
+
+ sal_Bool bWeb = ISA( SwWebDocShell );
+ if ( bWeb )
+ bHTMLTemplSet = SetHTMLTemplate( *GetDoc() );//Styles aus HTML.vor
+ else if( ISA( SwGlobalDocShell ) )
+ GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, true); // Globaldokument
+
+
+/*
+ //JP 12.07.95: so einfach waere es fuer die neu Mimik
+ pDoc->SetDefault( SvxTabStopItem( 1,
+ GetStar Writer App()->GetUsrPref()->GetDefTabDist(),
+ SVX_TAB_ADJUST_DEFAULT,
+ RES_PARATR_TABSTOP));
+*/
+ if ( GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
+ SwTransferable::InitOle( this, *pDoc );
+
+ // set forbidden characters if necessary
+ SvxAsianConfig aAsian;
+ Sequence<Locale> aLocales = aAsian.GetStartEndCharLocales();
+ if(aLocales.getLength())
+ {
+ const Locale* pLocales = aLocales.getConstArray();
+ for(sal_Int32 i = 0; i < aLocales.getLength(); i++)
+ {
+ ForbiddenCharacters aForbidden;
+ aAsian.GetStartEndChars( pLocales[i], aForbidden.beginLine, aForbidden.endLine);
+ LanguageType eLang = SvxLocaleToLanguage(pLocales[i]);
+ pDoc->setForbiddenCharacters( eLang, aForbidden);
+ }
+ }
+ pDoc->set(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION,
+ !aAsian.IsKerningWesternTextOnly());
+ pDoc->setCharacterCompressionType(static_cast<SwCharCompressType>(aAsian.GetCharDistanceCompression()));
+ pDoc->setPrintData(*SW_MOD()->GetPrtOptions(bWeb));
+
+ SubInitNew();
+
+ // fuer alle
+
+ SwStdFontConfig* pStdFont = SW_MOD()->GetStdFontConfig();
+ SfxPrinter* pPrt = pDoc->getPrinter( false );
+
+ String sEntry;
+ USHORT aFontWhich[] =
+ { RES_CHRATR_FONT,
+ RES_CHRATR_CJK_FONT,
+ RES_CHRATR_CTL_FONT
+ };
+ USHORT aFontHeightWhich[] =
+ {
+ RES_CHRATR_FONTSIZE,
+ RES_CHRATR_CJK_FONTSIZE,
+ RES_CHRATR_CTL_FONTSIZE
+ };
+ USHORT aFontIds[] =
+ {
+ FONT_STANDARD,
+ FONT_STANDARD_CJK,
+ FONT_STANDARD_CTL
+ };
+ USHORT nFontTypes[] =
+ {
+ DEFAULTFONT_LATIN_TEXT,
+ DEFAULTFONT_CJK_TEXT,
+ DEFAULTFONT_CTL_TEXT
+ };
+ USHORT aLangTypes[] =
+ {
+ RES_CHRATR_LANGUAGE,
+ RES_CHRATR_CJK_LANGUAGE,
+ RES_CHRATR_CTL_LANGUAGE
+ };
+
+ for(sal_uInt8 i = 0; i < 3; i++)
+ {
+ USHORT nFontWhich = aFontWhich[i];
+ USHORT nFontId = aFontIds[i];
+ SvxFontItem* pFontItem = 0;
+ const SvxLanguageItem& rLang = (const SvxLanguageItem&)pDoc->GetDefault( aLangTypes[i] );
+ LanguageType eLanguage = rLang.GetLanguage();
+ if(!pStdFont->IsFontDefault(nFontId))
+ {
+ sEntry = pStdFont->GetFontFor(nFontId);
+
+ Font aFont( sEntry, Size( 0, 10 ) );
+ if( pPrt )
+ {
+ aFont = pPrt->GetFontMetric( aFont );
+ }
+
+ pFontItem = new SvxFontItem(aFont.GetFamily(), aFont.GetName(),
+ aEmptyStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich);
+ }
+ else
+ {
+ // #107782# OJ use korean language if latin was used
+ if ( i == 0 )
+ {
+ LanguageType eUiLanguage = Application::GetSettings().GetUILanguage();
+ switch( eUiLanguage )
+ {
+ case LANGUAGE_KOREAN:
+ case LANGUAGE_KOREAN_JOHAB:
+ eLanguage = eUiLanguage;
+ break;
+ }
+ }
+
+ Font aLangDefFont = OutputDevice::GetDefaultFont(
+ nFontTypes[i],
+ eLanguage,
+ DEFAULTFONT_FLAGS_ONLYONE );
+ pFontItem = new SvxFontItem(aLangDefFont.GetFamily(), aLangDefFont.GetName(),
+ aEmptyStr, aLangDefFont.GetPitch(), aLangDefFont.GetCharSet(), nFontWhich);
+ }
+ pDoc->SetDefault(*pFontItem);
+ if( !bHTMLTemplSet )
+ {
+ SwTxtFmtColl *pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD);
+ pColl->ResetFmtAttr(nFontWhich);
+ }
+ delete pFontItem;
+ sal_Int32 nFontHeight = pStdFont->GetFontHeight( FONT_STANDARD, i, eLanguage );
+ if(nFontHeight <= 0)
+ nFontHeight = pStdFont->GetDefaultHeightFor( nFontId, eLanguage );
+ pDoc->SetDefault(SvxFontHeightItem( nFontHeight, 100, aFontHeightWhich[i] ));
+ if( !bHTMLTemplSet )
+ {
+ SwTxtFmtColl *pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD);
+ pColl->ResetFmtAttr(aFontHeightWhich[i]);
+ }
+
+ }
+ USHORT aFontIdPoolId[] =
+ {
+ FONT_OUTLINE, RES_POOLCOLL_HEADLINE_BASE,
+ FONT_LIST, RES_POOLCOLL_NUMBUL_BASE,
+ FONT_CAPTION, RES_POOLCOLL_LABEL,
+ FONT_INDEX, RES_POOLCOLL_REGISTER_BASE,
+ FONT_OUTLINE_CJK, RES_POOLCOLL_HEADLINE_BASE,
+ FONT_LIST_CJK, RES_POOLCOLL_NUMBUL_BASE,
+ FONT_CAPTION_CJK, RES_POOLCOLL_LABEL,
+ FONT_INDEX_CJK, RES_POOLCOLL_REGISTER_BASE,
+ FONT_OUTLINE_CTL, RES_POOLCOLL_HEADLINE_BASE,
+ FONT_LIST_CTL, RES_POOLCOLL_NUMBUL_BASE,
+ FONT_CAPTION_CTL, RES_POOLCOLL_LABEL,
+ FONT_INDEX_CTL, RES_POOLCOLL_REGISTER_BASE
+ };
+
+ USHORT nFontWhich = RES_CHRATR_FONT;
+ USHORT nFontHeightWhich = RES_CHRATR_FONTSIZE;
+ LanguageType eLanguage = static_cast<const SvxLanguageItem&>(pDoc->GetDefault( RES_CHRATR_LANGUAGE )).GetLanguage();
+ for(sal_uInt8 nIdx = 0; nIdx < 24; nIdx += 2)
+ {
+ if(nIdx == 8)
+ {
+ nFontWhich = RES_CHRATR_CJK_FONT;
+ nFontHeightWhich = RES_CHRATR_CJK_FONTSIZE;
+ eLanguage = static_cast<const SvxLanguageItem&>(pDoc->GetDefault( RES_CHRATR_CJK_LANGUAGE )).GetLanguage();
+ }
+ else if(nIdx == 16)
+ {
+ nFontWhich = RES_CHRATR_CTL_FONT;
+ nFontHeightWhich = RES_CHRATR_CTL_FONTSIZE;
+ eLanguage = static_cast<const SvxLanguageItem&>(pDoc->GetDefault( RES_CHRATR_CTL_LANGUAGE )).GetLanguage();
+ }
+ SwTxtFmtColl *pColl = 0;
+ if(!pStdFont->IsFontDefault(aFontIdPoolId[nIdx]))
+ {
+ sEntry = pStdFont->GetFontFor(aFontIdPoolId[nIdx]);
+
+ Font aFont( sEntry, Size( 0, 10 ) );
+ if( pPrt )
+ aFont = pPrt->GetFontMetric( aFont );
+
+ pColl = pDoc->GetTxtCollFromPool(aFontIdPoolId[nIdx + 1]);
+ if( !bHTMLTemplSet ||
+ SFX_ITEM_SET != pColl->GetAttrSet().GetItemState(
+ nFontWhich, sal_False ) )
+ {
+ pColl->SetFmtAttr(SvxFontItem(aFont.GetFamily(), aFont.GetName(),
+ aEmptyStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich));
+ }
+ }
+ sal_Int32 nFontHeight = pStdFont->GetFontHeight( static_cast< sal_Int8 >(aFontIdPoolId[nIdx]), 0, eLanguage );
+ if(nFontHeight <= 0)
+ nFontHeight = pStdFont->GetDefaultHeightFor( aFontIdPoolId[nIdx], eLanguage );
+ if(!pColl)
+ pColl = pDoc->GetTxtCollFromPool(aFontIdPoolId[nIdx + 1]);
+ SvxFontHeightItem aFontHeight( (const SvxFontHeightItem&)pColl->GetFmtAttr( nFontHeightWhich, sal_True ));
+ if(aFontHeight.GetHeight() != sal::static_int_cast<sal_uInt32, sal_Int32>(nFontHeight))
+ {
+ aFontHeight.SetHeight(nFontHeight);
+ pColl->SetFmtAttr( aFontHeight );
+ }
+ }
+
+ // the default for documents created via 'File/New' should be 'on'
+ // (old documents, where this property was not yet implemented, will get the
+ // value 'false' in the SwDoc c-tor)
+ pDoc->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT,
+ SW_MOD()->GetUsrPref( bWeb )->IsAlignMathObjectsToBaseline() );
+ }
+
+ /* #106748# If the default frame direction of a document is RTL
+ the default adjusment is to the right. */
+ if( !bHTMLTemplSet &&
+ FRMDIR_HORI_RIGHT_TOP == GetDefaultFrameDirection(GetAppLanguage()) )
+ pDoc->SetDefault( SvxAdjustItem(SVX_ADJUST_RIGHT, RES_PARATR_ADJUST ) );
+
+ // OD 09.10.2003 #i18732# - set dynamic pool default for
+ // item RES_FOLLOW_TEXT_FLOW to FALSE for *new document*.
+ // Thus, redo this change in method <SwDoc::RemoveAllFmtLanguageDependencies()>,
+ // which is called from <SwDocShell::ConvertFrom(..)> in order to restore
+ // the static pool default.
+ pDoc->SetDefault( SwFmtFollowTextFlow( FALSE ) );
+
+// --> collapsing borders FME 2005-05-27 #i29550#
+ pDoc->SetDefault( SfxBoolItem( RES_COLLAPSING_BORDERS, TRUE ) );
+// <-- collapsing
+
+ //#i16874# AutoKerning as default for new documents
+ pDoc->SetDefault( SvxAutoKernItem( sal_True, RES_CHRATR_AUTOKERN ) );
+
+ // --> OD 2005-02-10 #i42080# - Due to the several calls of method <SetDefault(..)>
+ // at the document instance, the document is modified. Thus, reset this
+ // status here. Note: In method <SubInitNew()> this is also done.
+ pDoc->ResetModified();
+ // <--
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ctor mit SfxCreateMode ?????
+ --------------------------------------------------------------------*/
+
+
+SwDocShell::SwDocShell( SfxObjectCreateMode eMode ) :
+ SfxObjectShell ( eMode ),
+ pDoc(0),
+ pFontList(0),
+ pView( 0 ),
+ pWrtShell( 0 ),
+ pOLEChildList( 0 ),
+ nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG),
+ bInUpdateFontList(false)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" );
+ Init_Impl();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ctor / Dtor
+ --------------------------------------------------------------------*/
+
+
+SwDocShell::SwDocShell( const sal_uInt64 i_nSfxCreationFlags ) :
+ SfxObjectShell ( i_nSfxCreationFlags ),
+ pDoc(0),
+ pFontList(0),
+ pView( 0 ),
+ pWrtShell( 0 ),
+ pOLEChildList( 0 ),
+ nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG),
+ bInUpdateFontList(false)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" );
+ Init_Impl();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ctor / Dtor
+ --------------------------------------------------------------------*/
+
+
+SwDocShell::SwDocShell( SwDoc *pD, SfxObjectCreateMode eMode ):
+ SfxObjectShell ( eMode ),
+ pDoc(pD),
+ pFontList(0),
+ pView( 0 ),
+ pWrtShell( 0 ),
+ pOLEChildList( 0 ),
+ nUpdateDocMode(document::UpdateDocMode::ACCORDING_TO_CONFIG),
+ bInUpdateFontList(false)
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SwDocShell" );
+ Init_Impl();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Dtor
+ --------------------------------------------------------------------*/
+
+
+ SwDocShell::~SwDocShell()
+{
+ // disable chart related objects now because in ~SwDoc it may be to late for this
+ if( pDoc )
+ {
+ pDoc->GetChartControllerHelper().Disconnect();
+ SwChartDataProvider *pPCD = pDoc->GetChartDataProvider();
+ if (pPCD)
+ pPCD->dispose();
+ }
+
+ RemoveLink();
+ delete pFontList;
+
+ // wir als BroadCaster werden auch unser eigener Listener
+ // (fuer DocInfo/FileNamen/....)
+ EndListening( *this );
+ SvxColorTableItem* pColItem = (SvxColorTableItem*)GetItem(SID_COLOR_TABLE);
+ // wird nur die DocInfo fuer den Explorer gelesen, ist das Item nicht da
+ if(pColItem)
+ {
+ XColorTable* pTable = pColItem->GetColorTable();
+ // wurde eine neue Table angelegt, muss sie auch geloescht werden.
+ if((void*)pTable != (void*)(XColorTable::GetStdColorTable()) )
+ delete pTable;
+ }
+
+ delete pOLEChildList;
+}
+/* -----------------------------10.09.2001 15:59------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDocShell::Init_Impl()
+{
+ SetPool(&SW_MOD()->GetPool());
+ SetBaseModel(new SwXTextDocument(this));
+ // wir als BroadCaster werden auch unser eigener Listener
+ // (fuer DocInfo/FileNamen/....)
+ StartListening( *this );
+ //position of the "Automatic" style filter for the stylist (app.src)
+ SetAutoStyleFilterIndex(3);
+
+ // set map unit to twip
+ SetMapUnit( MAP_TWIP );
+}
+/*--------------------------------------------------------------------
+ Beschreibung: AddLink
+ --------------------------------------------------------------------*/
+
+
+void SwDocShell::AddLink()
+{
+ if( !pDoc )
+ {
+ SwDocFac aFactory;
+ pDoc = aFactory.GetDoc();
+ pDoc->acquire();
+ pDoc->set(IDocumentSettingAccess::HTML_MODE, ISA(SwWebDocShell) );
+ }
+ else
+ pDoc->acquire();
+ pDoc->SetDocShell( this ); // am Doc den DocShell-Pointer setzen
+ uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY);
+ ((SwXTextDocument*)xDoc.get())->Reactivate(this);
+
+ SetPool(&pDoc->GetAttrPool());
+
+ // am besten erst wenn eine sdbcx::View erzeugt wird !!!
+ pDoc->SetOle2Link(LINK(this, SwDocShell, Ole2ModifiedHdl));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: neue FontList erzeugen Aenderung Drucker
+ --------------------------------------------------------------------*/
+
+
+void SwDocShell::UpdateFontList()
+{
+ if(!bInUpdateFontList)
+ {
+ bInUpdateFontList = true;
+ ASSERT(pDoc, "Kein Doc keine FontList");
+ if( pDoc )
+ {
+ delete pFontList;
+ pFontList = new FontList( pDoc->getReferenceDevice( true ) );
+ PutItem( SvxFontListItem( pFontList, SID_ATTR_CHAR_FONTLIST ) );
+ }
+ bInUpdateFontList = false;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: RemoveLink
+ --------------------------------------------------------------------*/
+
+
+void SwDocShell::RemoveLink()
+{
+ // Uno-Object abklemmen
+ uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY);
+ ((SwXTextDocument*)xDoc.get())->Invalidate();
+ aFinishedTimer.Stop();
+ if(pDoc)
+ {
+ if( mxBasePool.is() )
+ {
+ static_cast<SwDocStyleSheetPool*>(mxBasePool.get())->dispose();
+ mxBasePool.clear();
+ }
+ sal_Int8 nRefCt = static_cast< sal_Int8 >(pDoc->release());
+ pDoc->SetOle2Link(Link());
+ pDoc->SetDocShell( 0 );
+ if( !nRefCt )
+ delete pDoc;
+ pDoc = 0; // wir haben das Doc nicht mehr !!
+ }
+}
+void SwDocShell::InvalidateModel()
+{
+ // Uno-Object abklemmen
+ uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY);
+ ((SwXTextDocument*)xDoc.get())->Invalidate();
+}
+void SwDocShell::ReactivateModel()
+{
+ // Uno-Object abklemmen
+ uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY);
+ ((SwXTextDocument*)xDoc.get())->Reactivate(this);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Laden, Default-Format
+ --------------------------------------------------------------------*/
+
+
+sal_Bool SwDocShell::Load( SfxMedium& rMedium )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::Load" );
+ sal_Bool bRet = sal_False;
+ if( SfxObjectShell::Load( rMedium ))
+ {
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "after SfxInPlaceObject::Load" );
+ if( pDoc ) // fuer Letzte Version !!
+ RemoveLink(); // das existierende Loslassen
+
+ AddLink(); // Link setzen und Daten updaten !!
+
+ // Das Laden
+ // fuer MD
+ ASSERT( !mxBasePool.is(), "wer hat seinen Pool nicht zerstoert?" );
+ mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
+ if(GetCreateMode() != SFX_CREATE_MODE_ORGANIZER)
+ {
+ SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
+ nUpdateDocMode = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE;
+ }
+
+ SwWait aWait( *this, sal_True );
+ sal_uInt32 nErr = ERR_SWG_READ_ERROR;
+ switch( GetCreateMode() )
+ {
+// case SFX_CREATE_MODE_INTERNAL:
+// nErr = 0;
+// break;
+
+ case SFX_CREATE_MODE_ORGANIZER:
+ {
+ if( ReadXML )
+ {
+ ReadXML->SetOrganizerMode( TRUE );
+ SwReader aRdr( rMedium, aEmptyStr, pDoc );
+ nErr = aRdr.Read( *ReadXML );
+ ReadXML->SetOrganizerMode( FALSE );
+ }
+ }
+ break;
+
+ case SFX_CREATE_MODE_INTERNAL:
+ case SFX_CREATE_MODE_EMBEDDED:
+ {
+ // fuer MWERKS (Mac-Compiler): kann nicht selbststaendig casten
+ SwTransferable::InitOle( this, *pDoc );
+ }
+ // SfxProgress unterdruecken, wenn man Embedded ist
+ SW_MOD()->SetEmbeddedLoadSave( sal_True );
+ // kein break;
+
+ case SFX_CREATE_MODE_STANDARD:
+ case SFX_CREATE_MODE_PREVIEW:
+ {
+ Reader *pReader = ReadXML;
+ if( pReader )
+ {
+ // die DocInfo vom Doc am DocShell-Medium setzen
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "before ReadDocInfo" );
+ SwReader aRdr( rMedium, aEmptyStr, pDoc );
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "before Read" );
+ nErr = aRdr.Read( *pReader );
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "after Read" );
+
+ // If a XML document is loaded, the global doc/web doc
+ // flags have to be set, because they aren't loaded
+ // by this formats.
+ if( ISA( SwWebDocShell ) )
+ {
+ if( !pDoc->get(IDocumentSettingAccess::HTML_MODE) )
+ pDoc->set(IDocumentSettingAccess::HTML_MODE, true);
+ }
+ if( ISA( SwGlobalDocShell ) )
+ {
+ if( !pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
+ pDoc->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, true);
+ }
+ }
+#ifdef DBG_UTIL
+ else
+ ASSERT( !this, "ohne Sw3Reader geht nichts" );
+#endif
+ }
+ break;
+
+ default:
+ ASSERT( !this, "Load: new CreateMode?" );
+
+ }
+
+ UpdateFontList();
+ InitDraw();
+
+ SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ bRet = !IsError( nErr );
+
+ // --> OD 2006-11-07 #i59688#
+// // StartFinishedLoading rufen.
+// if( bRet && !pDoc->IsInLoadAsynchron() &&
+// GetCreateMode() == SFX_CREATE_MODE_STANDARD )
+// StartLoadFinishedTimer();
+ if ( bRet && !pDoc->IsInLoadAsynchron() &&
+ GetCreateMode() == SFX_CREATE_MODE_STANDARD )
+ {
+ LoadingFinished();
+ }
+ // <--
+
+ // SfxProgress unterdruecken, wenn man Embedded ist
+ SW_MOD()->SetEmbeddedLoadSave( sal_False );
+ }
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+sal_Bool SwDocShell::LoadFrom( SfxMedium& rMedium )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::LoadFrom" );
+ sal_Bool bRet = sal_False;
+ if( pDoc )
+ RemoveLink();
+
+ AddLink(); // Link setzen und Daten updaten !!
+
+ do { // middle check loop
+ sal_uInt32 nErr = ERR_SWG_READ_ERROR;
+ //const String& rNm = pStor->GetName();
+ String aStreamName;
+ aStreamName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("styles.xml"));
+ uno::Reference < container::XNameAccess > xAccess( rMedium.GetStorage(), uno::UNO_QUERY );
+ if ( xAccess->hasByName( aStreamName ) && rMedium.GetStorage()->isStreamElement( aStreamName ) )
+ {
+ // Das Laden
+ SwWait aWait( *this, sal_True );
+ {
+ ASSERT( !mxBasePool.is(), "wer hat seinen Pool nicht zerstoert?" );
+ mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
+ if( ReadXML )
+ {
+ ReadXML->SetOrganizerMode( TRUE );
+ SwReader aRdr( rMedium, aEmptyStr, pDoc );
+ nErr = aRdr.Read( *ReadXML );
+ ReadXML->SetOrganizerMode( FALSE );
+ }
+ }
+ }
+ else
+ {
+ DBG_ERROR("Code removed!");
+ /*
+ //TODO/LATER: looks like some binary stuff?!
+ // sollte es sich um eine 2. Vrolage handeln ??
+ if( SvStorage::IsStorageFile( rNm ) )
+ break;
+
+ const SfxFilter* pFltr = SwIoSystem::GetFileFilter( rNm, aEmptyStr );
+ if( !pFltr || !pFltr->GetUserData().EqualsAscii( FILTER_SWG ))
+ break;
+
+ SfxMedium aMed( rNm, STREAM_STD_READ, FALSE );
+ if( 0 == ( nErr = aMed.GetInStream()->GetError() ) )
+ {
+ SwWait aWait( *this, sal_True );
+ SwReader aRead( aMed, rNm, pDoc );
+ nErr = aRead.Read( *ReadSwg );
+ }
+ */
+ }
+
+ SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ bRet = !IsError( nErr );
+
+ } while( sal_False );
+
+ SfxObjectShell::LoadFrom( rMedium );
+ pDoc->ResetModified();
+ return bRet;
+}
+
+
+void SwDocShell::SubInitNew()
+{
+ ASSERT( !mxBasePool.is(), "wer hat seinen Pool nicht zerstoert?" );
+ mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
+ UpdateFontList();
+ InitDraw();
+
+ pDoc->setLinkUpdateMode( GLOBALSETTING );
+ pDoc->setFieldUpdateFlags( AUTOUPD_GLOBALSETTING );
+
+ sal_Bool bWeb = ISA(SwWebDocShell);
+
+ sal_uInt16 nRange[] = {
+ RES_PARATR_ADJUST, RES_PARATR_ADJUST,
+ RES_CHRATR_COLOR, RES_CHRATR_COLOR,
+ RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
+ RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
+ RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
+ 0, 0, 0 };
+ if(!bWeb)
+ {
+ nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 3 ] = RES_PARATR_TABSTOP;
+ nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 2 ] = RES_PARATR_HYPHENZONE;
+ }
+ SfxItemSet aDfltSet( pDoc->GetAttrPool(), nRange );
+
+ //! get lingu options without loading lingu DLL
+ SvtLinguOptions aLinguOpt;
+
+ SvtLinguConfig().GetOptions( aLinguOpt );
+
+ sal_Int16 nVal = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN),
+ eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN),
+ eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
+ aDfltSet.Put( SvxLanguageItem( nVal, RES_CHRATR_LANGUAGE ) );
+ aDfltSet.Put( SvxLanguageItem( eCJK, RES_CHRATR_CJK_LANGUAGE ) );
+ aDfltSet.Put( SvxLanguageItem( eCTL, RES_CHRATR_CTL_LANGUAGE ) );
+
+ if(!bWeb)
+ {
+ SvxHyphenZoneItem aHyp( (SvxHyphenZoneItem&) pDoc->GetDefault(
+ RES_PARATR_HYPHENZONE) );
+ aHyp.GetMinLead() = static_cast< BYTE >(aLinguOpt.nHyphMinLeading);
+ aHyp.GetMinTrail() = static_cast< BYTE >(aLinguOpt.nHyphMinTrailing);
+
+ aDfltSet.Put( aHyp );
+
+ sal_uInt16 nNewPos = static_cast< sal_uInt16 >(SW_MOD()->GetUsrPref(FALSE)->GetDefTab());
+ if( nNewPos )
+ aDfltSet.Put( SvxTabStopItem( 1, nNewPos,
+ SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP ) );
+ }
+ aDfltSet.Put( SvxColorItem( Color( COL_AUTO ), RES_CHRATR_COLOR ) );
+
+ pDoc->SetDefault( aDfltSet );
+
+ //default page mode for text grid
+ if(!bWeb)
+ {
+ sal_Bool bSquaredPageMode = SW_MOD()->GetUsrPref(FALSE)->IsSquaredPageMode();
+ pDoc->SetDefaultPageMode( bSquaredPageMode );
+ }
+
+ pDoc->ResetModified();
+}
+
+/*
+ * Document Interface Access
+ */
+IDocumentDeviceAccess* SwDocShell::getIDocumentDeviceAccess() { return pDoc; }
+const IDocumentSettingAccess* SwDocShell::getIDocumentSettingAccess() const { return pDoc; }
+IDocumentChartDataProviderAccess* SwDocShell::getIDocumentChartDataProviderAccess() { return pDoc; }
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
new file mode 100644
index 000000000000..60206f764663
--- /dev/null
+++ b/sw/source/ui/app/docst.cxx
@@ -0,0 +1,1312 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include <hintids.hxx>
+#include <sfx2/app.hxx>
+#include <svl/whiter.hxx>
+#include <sfx2/templdlg.hxx>
+#include <sfx2/tplpitem.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/newstyle.hxx>
+#include <sfx2/printer.hxx>
+#include <svl/macitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/languageoptions.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <swmodule.hxx>
+#include <wdocsh.hxx>
+#include <fmtfsize.hxx>
+#include <fchrfmt.hxx>
+#include <svtools/htmlcfg.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <SwRewriter.hxx>
+#include <numrule.hxx>
+#include <swundo.hxx>
+
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "docsh.hxx"
+#include "uitool.hxx"
+#include "cmdid.h"
+#include "globals.hrc"
+#include "viewopt.hxx"
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include "swstyle.h"
+#include "frmfmt.hxx"
+#include "charfmt.hxx"
+#include "poolfmt.hxx"
+#include "pagedesc.hxx"
+#include "docstyle.hxx"
+#include "uiitems.hxx"
+#include "fmtcol.hxx"
+#include "frmmgr.hxx" //SwFrmValid
+#include "swevent.hxx"
+#include "edtwin.hxx"
+#include "unochart.hxx"
+
+#include "app.hrc"
+#include <fmtui.hrc>
+#include "swabstdlg.hxx"
+// --> OD 2008-03-27 #refactorlists#
+#include <list.hxx>
+// <--
+
+#include <paratr.hxx> //#outline level,add by zhaojianwei
+
+using namespace ::com::sun::star;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
+{
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+ USHORT nActualFamily = USHRT_MAX;
+
+ SwWrtShell* pShell = pSh ? pSh : GetWrtShell();
+ if(!pShell)
+ {
+ while (nWhich)
+ {
+ rSet.DisableItem(nWhich);
+ nWhich = aIter.NextWhich();
+ }
+ return;
+ }
+ else
+ {
+ SfxViewFrame* pFrame = pShell->GetView().GetViewFrame();
+ const ISfxTemplateCommon* pCommon = SFX_APP()->GetCurrentTemplateCommon(pFrame->GetBindings());
+ if( pCommon )
+ nActualFamily = static_cast< USHORT >(pCommon->GetActualFamily());
+ }
+
+ while (nWhich)
+ {
+ // aktuelle Vorlage zu jeder Familie ermitteln
+ //
+ String aName;
+ switch (nWhich)
+ {
+ case SID_STYLE_APPLY:
+ {//hier wird die Vorlage und ihre Familie an die StyleBox
+ //uebergeben, damit diese Familie angezeigt wird
+ if(pShell->IsFrmSelected())
+ {
+ SwFrmFmt* pFmt = pShell->GetCurFrmFmt();
+ if( pFmt )
+ aName = pFmt->GetName();
+ }
+ else
+ {
+ SwTxtFmtColl* pColl = pShell->GetCurTxtFmtColl();
+ if(pColl)
+ aName = pColl->GetName();
+ }
+ rSet.Put(SfxTemplateItem(nWhich, aName));
+ }
+ break;
+ case SID_STYLE_FAMILY1:
+ if( !pShell->IsFrmSelected() )
+ {
+ SwCharFmt* pFmt = pShell->GetCurCharFmt();
+ if(pFmt)
+ aName = pFmt->GetName();
+ else
+ aName = *SwStyleNameMapper::GetTextUINameArray()[
+ RES_POOLCOLL_STANDARD - RES_POOLCOLL_TEXT_BEGIN ];
+ rSet.Put(SfxTemplateItem(nWhich, aName));
+ }
+ break;
+
+ case SID_STYLE_FAMILY2:
+ if(!pShell->IsFrmSelected())
+ {
+ SwTxtFmtColl* pColl = pShell->GetCurTxtFmtColl();
+ if(pColl)
+ aName = pColl->GetName();
+
+ SfxTemplateItem aItem(nWhich, aName);
+
+ USHORT nMask = 0;
+ if( pDoc->get(IDocumentSettingAccess::HTML_MODE) )
+ nMask = SWSTYLEBIT_HTML;
+ else
+ {
+ const int nSelection = pShell->GetFrmType(0,TRUE);
+ if(pShell->GetCurTOX())
+ nMask = SWSTYLEBIT_IDX ;
+ else if(nSelection & FRMTYPE_HEADER ||
+ nSelection & FRMTYPE_FOOTER ||
+ nSelection & FRMTYPE_TABLE ||
+ nSelection & FRMTYPE_FLY_ANY ||
+ nSelection & FRMTYPE_FOOTNOTE ||
+ nSelection & FRMTYPE_FTNPAGE)
+ nMask = SWSTYLEBIT_EXTRA;
+ else
+ nMask = SWSTYLEBIT_TEXT;
+ }
+
+ aItem.SetValue(nMask);
+ rSet.Put(aItem);
+ }
+
+ break;
+
+ case SID_STYLE_FAMILY3:
+
+ if( pDoc->get(IDocumentSettingAccess::HTML_MODE) )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ SwFrmFmt* pFmt = pShell->GetCurFrmFmt();
+ if(pFmt && pShell->IsFrmSelected())
+ {
+ aName = pFmt->GetName();
+ rSet.Put(SfxTemplateItem(nWhich, aName));
+ }
+ }
+ break;
+
+ case SID_STYLE_FAMILY4:
+ {
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ if( pDoc->get(IDocumentSettingAccess::HTML_MODE) && !pHtmlOpt->IsPrintLayoutExtension())
+ rSet.DisableItem( nWhich );
+ else
+ {
+ USHORT n = pShell->GetCurPageDesc( FALSE );
+ if( n < pShell->GetPageDescCnt() )
+ aName = pShell->GetPageDesc( n ).GetName();
+
+ rSet.Put(SfxTemplateItem(nWhich, aName));
+ }
+ }
+ break;
+ case SID_STYLE_FAMILY5:
+ {
+ const SwNumRule* pRule = pShell->GetCurNumRule();
+ if( pRule )
+ aName = pRule->GetName();
+
+ rSet.Put(SfxTemplateItem(nWhich, aName));
+ }
+ break;
+
+ case SID_STYLE_WATERCAN:
+ {
+ SwEditWin& rEdtWin = pShell->GetView().GetEditWin();
+ SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
+ rSet.Put(SfxBoolItem(nWhich, pApply && pApply->eType != 0));
+ }
+ break;
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ if( pShell->IsFrmSelected()
+ ? SFX_STYLE_FAMILY_FRAME != nActualFamily
+ : ( SFX_STYLE_FAMILY_FRAME == nActualFamily ||
+ SFX_STYLE_FAMILY_PAGE == nActualFamily ||
+ (SFX_STYLE_FAMILY_PSEUDO == nActualFamily && !pShell->GetCurNumRule())) )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ if( (pShell->IsFrmSelected()
+ ? SFX_STYLE_FAMILY_FRAME != nActualFamily
+ : SFX_STYLE_FAMILY_FRAME == nActualFamily) ||
+ (SFX_STYLE_FAMILY_PSEUDO == nActualFamily && !pShell->GetCurNumRule()) )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ default:
+ DBG_ERROR( "Invalid SlotId");
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: StyleSheet-Requeste auswerten
+ --------------------------------------------------------------------*/
+
+
+void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
+{
+ USHORT nSlot = rReq.GetSlot();
+ USHORT nRet = 0xffff;
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+ SwWrtShell* pActShell = 0;
+ BOOL bSetReturn = TRUE;
+ switch (nSlot)
+ {
+ case SID_STYLE_NEW:
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_FAMILY,
+ FALSE, &pItem ))
+ {
+ USHORT nFamily = ((const SfxUInt16Item*)pItem)->GetValue();
+
+ String sName;
+ USHORT nMask = 0;
+ if( SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_NEW,
+ FALSE, &pItem ))
+ sName = ((const SfxStringItem*)pItem)->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_MASK,
+ FALSE, &pItem ))
+ nMask = ((const SfxUInt16Item*)pItem)->GetValue();
+ String sParent;
+ if( SFX_ITEM_SET == pArgs->GetItemState( SID_STYLE_REFERENCE,
+ FALSE, &pItem ))
+ sParent = ((const SfxStringItem*)pItem)->GetValue();
+
+ nRet = Edit( sName, sParent, nFamily, nMask, TRUE, FALSE, 0, rReq.IsAPI() );
+ }
+ break;
+
+ case SID_STYLE_APPLY:
+ if( !pArgs )
+ {
+ GetView()->GetViewFrame()->GetDispatcher()->Execute(SID_STYLE_DESIGNER, FALSE);
+ break;
+ }
+ else
+ {
+ // convert internal StyleName to DisplayName (slot implementation uses the latter)
+ SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_APPLY_STYLE, sal_False );
+ SFX_REQUEST_ARG( rReq, pFamilyItem, SfxStringItem, SID_STYLE_FAMILYNAME, sal_False );
+ if ( pFamilyItem && pNameItem )
+ {
+ uno::Reference< style::XStyleFamiliesSupplier > xModel(GetModel(), uno::UNO_QUERY);
+ try
+ {
+ uno::Reference< container::XNameAccess > xStyles;
+ uno::Reference< container::XNameAccess > xCont = xModel->getStyleFamilies();
+ xCont->getByName(pFamilyItem->GetValue()) >>= xStyles;
+ uno::Reference< beans::XPropertySet > xInfo;
+ xStyles->getByName( pNameItem->GetValue() ) >>= xInfo;
+ ::rtl::OUString aUIName;
+ xInfo->getPropertyValue( ::rtl::OUString::createFromAscii("DisplayName") ) >>= aUIName;
+ if ( aUIName.getLength() )
+ rReq.AppendItem( SfxStringItem( SID_STYLE_APPLY, aUIName ) );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ }
+
+ // intentionally no break
+
+ case SID_STYLE_EDIT:
+ case SID_STYLE_DELETE:
+ case SID_STYLE_WATERCAN:
+ case SID_STYLE_FAMILY:
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ {
+ String aParam;
+ USHORT nFamily = SFX_STYLE_FAMILY_PARA;
+ USHORT nMask = 0;
+
+ if( !pArgs )
+ {
+ nFamily = SFX_STYLE_FAMILY_PARA;
+
+ switch (nSlot)
+ {
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ {
+ SfxNewStyleDlg *pDlg = new SfxNewStyleDlg( 0,
+ *GetStyleSheetPool());
+ if(RET_OK == pDlg->Execute())
+ {
+ aParam = pDlg->GetName();
+ rReq.AppendItem(SfxStringItem(nSlot, aParam));
+ }
+
+ delete pDlg;
+ }
+ break;
+
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ case SID_STYLE_EDIT:
+ {
+ SwTxtFmtColl* pColl = GetWrtShell()->GetCurTxtFmtColl();
+ if(pColl)
+ {
+ aParam = pColl->GetName();
+ rReq.AppendItem(SfxStringItem(nSlot, aParam));
+ }
+ }
+ break;
+ }
+ }
+ else
+ {
+ ASSERT( pArgs->Count(), "SfxBug ItemSet ist leer");
+
+ SwWrtShell* pShell = GetWrtShell();
+ if( SFX_ITEM_SET == pArgs->GetItemState(nSlot, FALSE, &pItem ))
+ aParam = ((const SfxStringItem*)pItem)->GetValue();
+
+ if( SFX_ITEM_SET == pArgs->GetItemState(SID_STYLE_FAMILY,
+ FALSE, &pItem ))
+ nFamily = ((const SfxUInt16Item*)pItem)->GetValue();
+
+ if( SFX_ITEM_SET == pArgs->GetItemState(SID_STYLE_FAMILYNAME, FALSE, &pItem ))
+ {
+ String aFamily = ((const SfxStringItem*)pItem)->GetValue();
+ if(aFamily.CompareToAscii("CharacterStyles") == COMPARE_EQUAL)
+ nFamily = SFX_STYLE_FAMILY_CHAR;
+ else
+ if(aFamily.CompareToAscii("ParagraphStyles") == COMPARE_EQUAL)
+ nFamily = SFX_STYLE_FAMILY_PARA;
+ else
+ if(aFamily.CompareToAscii("PageStyles") == COMPARE_EQUAL)
+ nFamily = SFX_STYLE_FAMILY_PAGE;
+ else
+ if(aFamily.CompareToAscii("FrameStyles") == COMPARE_EQUAL)
+ nFamily = SFX_STYLE_FAMILY_FRAME;
+ else
+ if(aFamily.CompareToAscii("NumberingStyles") == COMPARE_EQUAL)
+ nFamily = SFX_STYLE_FAMILY_PSEUDO;
+ }
+
+ if( SFX_ITEM_SET == pArgs->GetItemState(SID_STYLE_MASK,
+ FALSE, &pItem ))
+ nMask = ((const SfxUInt16Item*)pItem)->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_WRTSHELL,
+ FALSE, &pItem ))
+ pActShell = pShell = (SwWrtShell*)((SwPtrItem*)pItem)->GetValue();
+
+ if( nSlot == SID_STYLE_UPDATE_BY_EXAMPLE )
+ {
+ switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ SwTxtFmtColl* pColl = pShell->GetCurTxtFmtColl();
+ if(pColl)
+ aParam = pColl->GetName();
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ SwFrmFmt* pFrm = pWrtShell->GetCurFrmFmt();
+ if( pFrm )
+ aParam = pFrm->GetName();
+ }
+ break;
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ SwCharFmt* pChar = pWrtShell->GetCurCharFmt();
+ if( pChar )
+ aParam = pChar->GetName();
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ if(SFX_ITEM_SET == pArgs->GetItemState(SID_STYLE_UPD_BY_EX_NAME, FALSE, &pItem))
+ {
+ aParam = ((const SfxStringItem*)pItem)->GetValue();
+ }
+ break;
+ }
+ rReq.AppendItem(SfxStringItem(nSlot, aParam));
+ }
+ }
+ if (aParam.Len() || nSlot == SID_STYLE_WATERCAN )
+ {
+ switch(nSlot)
+ {
+ case SID_STYLE_EDIT:
+ nRet = Edit(aParam, aEmptyStr, nFamily, nMask, FALSE, FALSE, pActShell );
+ break;
+ case SID_STYLE_DELETE:
+ nRet = Delete(aParam, nFamily);
+ break;
+ case SID_STYLE_APPLY:
+ // Shellwechsel in ApplyStyles
+ nRet = ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() );
+ break;
+ case SID_STYLE_WATERCAN:
+ nRet = DoWaterCan(aParam, nFamily);
+ break;
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ nRet = UpdateStyle(aParam, nFamily, pActShell);
+ break;
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ {
+ nRet = MakeByExample(aParam, nFamily, nMask, pActShell );
+ SfxTemplateDialog* pDlg = SFX_APP()->GetTemplateDialog();
+
+ if(pDlg && pDlg->IsVisible())
+ pDlg->Update();
+ }
+ break;
+
+ default:
+ DBG_ERROR( "Falsche Slot-Id");
+ }
+
+ rReq.Done();
+ }
+
+ break;
+ }
+ }
+
+ if(bSetReturn)
+ {
+ if(rReq.IsAPI()) // Basic bekommt nur TRUE oder FALSE
+ rReq.SetReturnValue(SfxUInt16Item(nSlot, nRet !=0));
+ else
+ rReq.SetReturnValue(SfxUInt16Item(nSlot, nRet));
+ }
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Edit
+ --------------------------------------------------------------------*/
+
+
+USHORT SwDocShell::Edit( const String &rName, const String &rParent, USHORT nFamily, USHORT nMask,
+ BOOL bNew, BOOL bColumn, SwWrtShell* pActShell,
+ BOOL bBasic )
+{
+ ASSERT(GetWrtShell(), "Keine Shell, keine Styles");
+ SfxStyleSheetBase *pStyle = 0;
+
+ USHORT nRet = nMask;
+ BOOL bModified = pDoc->IsModified();
+
+ if( bNew )
+ {
+ if( SFXSTYLEBIT_ALL != nMask && SFXSTYLEBIT_USED != nMask )
+ nMask |= SFXSTYLEBIT_USERDEF;
+ else
+ nMask = SFXSTYLEBIT_USERDEF;
+
+ pStyle = &mxBasePool->Make( rName, (SfxStyleFamily)nFamily, nMask );
+
+ // die aktuellen als Parent setzen
+ SwDocStyleSheet* pDStyle = (SwDocStyleSheet*)pStyle;
+ switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ if(rParent.Len())
+ {
+ SwTxtFmtColl* pColl = pWrtShell->FindTxtFmtCollByName( rParent );
+ if(!pColl)
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rParent, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL);
+ if(USHRT_MAX != nId)
+ pColl = pWrtShell->GetTxtCollFromPool( nId );
+ }
+ pDStyle->GetCollection()->SetDerivedFrom( pColl );
+ pDStyle->PresetParent( rParent );
+
+ //#outline level,add by zhaojianwei
+ /*When a new paragraph style is created based on a "to outline style
+ assigned" paragraph style, the outline level attribute and the list
+ style attribute of the new paragraph style have to be set to 0
+ respectively "".*/
+ if( pColl->IsAssignedToListLevelOfOutlineStyle())
+ {
+ SwNumRuleItem aItem(aEmptyStr);
+ pDStyle->GetCollection()->SetFmtAttr( aItem );
+ pDStyle->GetCollection()->SetAttrOutlineLevel( 0 );
+ }
+ //<-end,zhaojianwei
+
+ }
+ else
+ {
+ SwTxtFmtColl* pColl = pWrtShell->GetCurTxtFmtColl();
+ pDStyle->GetCollection()->SetDerivedFrom( pColl );
+ if( pColl )
+ pDStyle->PresetParent( pColl->GetName() );
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ if(rParent.Len())
+ {
+ SwCharFmt* pCFmt = pWrtShell->FindCharFmtByName( rParent );
+ if(!pCFmt)
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rParent, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
+ if(USHRT_MAX != nId)
+ pCFmt = pWrtShell->GetCharFmtFromPool( nId );
+ }
+
+ pDStyle->GetCharFmt()->SetDerivedFrom( pCFmt );
+ pDStyle->PresetParent( rParent );
+ }
+ else
+ {
+ SwCharFmt* pCFmt = pWrtShell->GetCurCharFmt();
+ pDStyle->GetCharFmt()->SetDerivedFrom( pCFmt );
+ if( pCFmt )
+ pDStyle->PresetParent( pCFmt->GetName() );
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME :
+ {
+ if(rParent.Len())
+ {
+ SwFrmFmt* pFFmt = pWrtShell->GetDoc()->FindFrmFmtByName( rParent );
+ if(!pFFmt)
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rParent, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT);
+ if(USHRT_MAX != nId)
+ pFFmt = pWrtShell->GetFrmFmtFromPool( nId );
+ }
+ pDStyle->GetFrmFmt()->SetDerivedFrom( pFFmt );
+ pDStyle->PresetParent( rParent );
+ }
+ }
+ break;
+ }
+ }
+ else
+ {
+ pStyle = mxBasePool->Find( rName, (SfxStyleFamily)nFamily );
+ ASSERT(pStyle, "Vorlage nicht gefunden");
+ }
+
+ if(!pStyle)
+ return FALSE;
+
+ // Dialoge zusammenstoepseln
+ //
+ rtl::Reference< SwDocStyleSheet > xTmp( new SwDocStyleSheet( *(SwDocStyleSheet*)pStyle ) );
+ if( SFX_STYLE_FAMILY_PARA == nFamily )
+ {
+ SfxItemSet& rSet = xTmp->GetItemSet();
+ ::SwToSfxPageDescAttr( rSet );
+ // erstmal nur eine Null
+ rSet.Put(SwBackgroundDestinationItem(SID_PARA_BACKGRND_DESTINATION, 0));
+ // --> OD 2008-02-13 #newlistlevelattrs#
+ // merge list level indent attributes into the item set if needed
+ xTmp->MergeIndentAttrsOfListStyle( rSet );
+ // <--
+ }
+/* else if( SFX_STYLE_FAMILY_FRAME == nFamily )
+ {
+ // Auskommentiert wegen Bug #45776 (per default keine Breite&Groesse in Rahmenvorlagen)
+ SfxItemSet& rSet = aTmp.GetItemSet();
+ if( SFX_ITEM_SET != rSet.GetItemState( RES_FRM_SIZE ))
+ {
+ // dann sollten wir spaetesten hier eines anlegen
+ SwFrmValid aFrmDefValues;
+ rSet.Put( SwFmtFrmSize( ATT_VAR_SIZE, aFrmDefValues.nWidth,
+ aFrmDefValues.nHeight ));
+ }
+ }*/
+ else if( SFX_STYLE_FAMILY_CHAR == nFamily )
+ {
+ SfxItemSet& rSet = xTmp->GetItemSet();
+ const SfxPoolItem *pTmpBrush;
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_CHRATR_BACKGROUND,
+ TRUE, &pTmpBrush ) )
+ {
+ SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
+ aTmpBrush.SetWhich( RES_BACKGROUND );
+ rSet.Put( aTmpBrush );
+ }
+ }
+ if (!bBasic)
+ {
+ // vor dem Dialog wird der HtmlMode an der DocShell versenkt
+ USHORT nHtmlMode = ::GetHtmlMode(this);
+
+ // In HTML mode, we do not always have a printer. In order to show
+ // the correct page size in the Format - Page dialog, we have to
+ // get one here.
+ SwWrtShell* pCurrShell = ( pActShell ? pActShell : pWrtShell );
+ if( ( HTMLMODE_ON & nHtmlMode ) &&
+ !pCurrShell->getIDocumentDeviceAccess()->getPrinter( false ) )
+ pCurrShell->InitPrt( pCurrShell->getIDocumentDeviceAccess()->getPrinter( true ) );
+
+ PutItem(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
+ FieldUnit eMetric = ::GetDfltMetric(0 != (HTMLMODE_ON&nHtmlMode));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)));
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ SfxAbstractTabDialog* pDlg = pFact->CreateTemplateDialog( DLG_TEMPLATE_BASE,
+ 0, *(xTmp.get()), nFamily, bColumn,
+ pActShell ? pActShell : pWrtShell, bNew);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if(RET_OK == pDlg->Execute())
+ {
+ GetWrtShell()->StartAllAction();
+
+ // nur bei Absatz-Vorlagen die Maske neu setzen
+ if( bNew )
+ {
+ nRet = SFX_STYLE_FAMILY_PARA == pStyle->GetFamily()
+ ? xTmp->GetMask()
+ : SFXSTYLEBIT_USERDEF;
+ }
+ else if( pStyle->GetMask() != xTmp->GetMask() )
+ nRet = xTmp->GetMask();
+
+ if( SFX_STYLE_FAMILY_PARA == nFamily )
+ {
+ SfxItemSet aSet( *pDlg->GetOutputItemSet() );
+ ::SfxToSwPageDescAttr( *GetWrtShell(), aSet );
+ // --> OD 2008-02-12 #newlistlevelattrs#
+ // reset indent attributes at paragraph style, if a list style
+ // will be applied and no indent attributes will be applied.
+ xTmp->SetItemSet( aSet, true );
+ // <--
+ }
+ else
+ {
+ if(SFX_STYLE_FAMILY_PAGE == nFamily)
+ {
+ static const USHORT aInval[] = {
+ SID_IMAGE_ORIENTATION,
+ SID_ATTR_CHAR_FONT,
+ FN_INSERT_CTRL, FN_INSERT_OBJ_CTRL, 0};
+ pView->GetViewFrame()->GetBindings().Invalidate(aInval);
+ }
+ SfxItemSet aTmpSet( *pDlg->GetOutputItemSet() );
+ if( SFX_STYLE_FAMILY_CHAR == nFamily )
+ {
+ const SfxPoolItem *pTmpBrush;
+ if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND,
+ FALSE, &pTmpBrush ) )
+ {
+ SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
+ aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
+ aTmpSet.Put( aTmpBrush );
+ }
+ aTmpSet.ClearItem( RES_BACKGROUND );
+ }
+ xTmp->SetItemSet( aTmpSet );
+
+ if( SFX_STYLE_FAMILY_PAGE == nFamily && SvtLanguageOptions().IsCTLFontEnabled() )
+ {
+ const SfxPoolItem *pItem = NULL;
+ if( aTmpSet.GetItemState( GetPool().GetTrueWhich( SID_ATTR_FRAMEDIRECTION, FALSE ) , TRUE, &pItem ) == SFX_ITEM_SET )
+ SwChartHelper::DoUpdateAllCharts( pDoc );
+ }
+ }
+ if(SFX_STYLE_FAMILY_PAGE == nFamily)
+ pView->InvalidateRulerPos();
+
+ if( bNew )
+ mxBasePool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *xTmp.get() ) );
+
+ // JP 19.09.97:
+ // Dialog vorm EndAction zerstoeren - bei Seitenvorlagen kann
+ // muss der ItemSet zerstoert werden, damit die Cursor aus den
+ // Kopf-/Fusszeilen entfernt werden. Sonst kommts zu GPFs!!!
+ delete pDlg;
+
+ pDoc->SetModified();
+ if( !bModified ) // Bug 57028
+ {
+ pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified();
+ }
+
+ GetWrtShell()->EndAllAction();
+ }
+ else
+ {
+ if( bNew )
+ {
+ // #116530#
+ //pBasePool->Erase( &aTmp );
+ GetWrtShell()->Undo(1);
+ pDoc->GetIDocumentUndoRedo().ClearRedo();
+ }
+
+ if( !bModified )
+ pDoc->ResetModified();
+ delete pDlg;
+ }
+ }
+ else
+ {
+ // vor dem Dialog wird der HtmlMode an der DocShell versenkt
+ PutItem(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(this)));
+
+ GetWrtShell()->StartAllAction();
+
+ // nur bei Absatz-Vorlagen die Maske neu setzen
+ if( bNew )
+ {
+ nRet = SFX_STYLE_FAMILY_PARA == pStyle->GetFamily()
+ ? xTmp->GetMask()
+ : SFXSTYLEBIT_USERDEF;
+ }
+ else if( pStyle->GetMask() != xTmp->GetMask() )
+ nRet = xTmp->GetMask();
+
+ if( SFX_STYLE_FAMILY_PARA == nFamily )
+ ::SfxToSwPageDescAttr( *GetWrtShell(), xTmp->GetItemSet() );
+ else
+ {
+ SfxItemSet aTmpSet( xTmp->GetItemSet() );
+ if( SFX_STYLE_FAMILY_CHAR == nFamily )
+ {
+ const SfxPoolItem *pTmpBrush;
+ if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND,
+ FALSE, &pTmpBrush ) )
+ {
+ SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
+ aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
+ aTmpSet.Put( aTmpBrush );
+ }
+ aTmpSet.ClearItem( RES_BACKGROUND );
+ }
+ xTmp->SetItemSet( aTmpSet );
+ }
+ if(SFX_STYLE_FAMILY_PAGE == nFamily)
+ pView->InvalidateRulerPos();
+
+ if( bNew )
+ mxBasePool->Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *xTmp.get() ) );
+
+ pDoc->SetModified();
+ if( !bModified ) // Bug 57028
+ {
+ pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified();
+ }
+ GetWrtShell()->EndAllAction();
+ }
+
+ return nRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Delete
+ --------------------------------------------------------------------*/
+
+
+USHORT SwDocShell::Delete(const String &rName, USHORT nFamily)
+{
+ SfxStyleSheetBase *pStyle = mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
+
+ if(pStyle)
+ {
+ ASSERT(GetWrtShell(), "Keine Shell, keine Styles");
+
+ GetWrtShell()->StartAllAction();
+ mxBasePool->Remove(pStyle);
+ GetWrtShell()->EndAllAction();
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Vorlage anwenden
+ --------------------------------------------------------------------*/
+
+
+USHORT SwDocShell::ApplyStyles(const String &rName, USHORT nFamily,
+ SwWrtShell* pShell, USHORT nMode )
+{
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
+
+ ASSERT(pStyle, "Wo ist der StyleSheet");
+ if(!pStyle)
+ return FALSE;
+
+ SwWrtShell *pSh = pShell ? pShell : GetWrtShell();
+
+ ASSERT( pSh, "Keine Shell, keine Styles");
+
+ pSh->StartAllAction();
+
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ SwFmtCharFmt aFmt(pStyle->GetCharFmt());
+ pSh->SetAttr( aFmt, (nMode & KEY_SHIFT) ?
+ nsSetAttrMode::SETATTR_DONTREPLACE : nsSetAttrMode::SETATTR_DEFAULT );
+ break;
+ }
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ // --> OD 2007-11-06 #i62675#
+ // clear also list attributes at affected text nodes, if paragraph
+ // style has the list style attribute set.
+ pSh->SetTxtFmtColl( pStyle->GetCollection(), true );
+ // <--
+ break;
+ }
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ if ( pSh->IsFrmSelected() )
+ pSh->SetFrmFmt( pStyle->GetFrmFmt() );
+ break;
+ }
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ pSh->SetPageStyle(pStyle->GetPageDesc()->GetName());
+ break;
+ }
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ // --> OD 2008-02-08 #newlistlevelattrs#
+ // reset indent attribute on applying list style
+ // --> OD 2008-03-17 #refactorlists#
+ // continue list of list style
+ const SwNumRule* pNumRule = pStyle->GetNumRule();
+ const String sListIdForStyle =pNumRule->GetDefaultListId();
+ pSh->SetCurNumRule( *pNumRule, false, sListIdForStyle, true );
+ // <--
+ break;
+ }
+ default:
+ DBG_ERROR("Unbekannte Familie");
+ }
+ pSh->EndAllAction();
+
+ return nFamily;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Giesskanne starten
+ --------------------------------------------------------------------*/
+
+
+
+USHORT SwDocShell::DoWaterCan(const String &rName, USHORT nFamily)
+{
+ ASSERT(GetWrtShell(), "Keine Shell, keine Styles");
+
+ SwEditWin& rEdtWin = pView->GetEditWin();
+ SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
+ BOOL bWaterCan = !(pApply && pApply->eType != 0);
+ if( !rName.Len() )
+ bWaterCan = FALSE;
+ SwApplyTemplate aTemplate;
+ aTemplate.eType = nFamily;
+
+ if(bWaterCan)
+ {
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
+
+ ASSERT(pStyle, "Wo ist der StyleSheet");
+ if(!pStyle) return nFamily;
+
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ aTemplate.aColl.pCharFmt = pStyle->GetCharFmt();
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ aTemplate.aColl.pTxtColl = pStyle->GetCollection();
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ aTemplate.aColl.pFrmFmt = pStyle->GetFrmFmt();
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ aTemplate.aColl.pPageDesc = (SwPageDesc*)pStyle->GetPageDesc();
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ aTemplate.aColl.pNumRule = (SwNumRule*)pStyle->GetNumRule();
+ break;
+
+ default:
+ DBG_ERROR( "Unbekannte Familie");
+ }
+ }
+ else
+ aTemplate.eType = 0;
+
+ // Template anwenden
+ pView->GetEditWin().SetApplyTemplate(aTemplate);
+
+ return nFamily;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Vorlage Updaten
+ --------------------------------------------------------------------*/
+
+
+USHORT SwDocShell::UpdateStyle(const String &rName, USHORT nFamily, SwWrtShell* pShell)
+{
+ SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell();
+ ASSERT(GetWrtShell(), "Keine Shell, keine Styles");
+
+ SwDocStyleSheet* pStyle =
+ (SwDocStyleSheet*)mxBasePool->Find(rName, (SfxStyleFamily)nFamily);
+
+ if(!pStyle)
+ return nFamily;
+
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ SwTxtFmtColl* pColl = pStyle->GetCollection();
+ if(pColl && !pColl->IsDefault())
+ {
+ GetWrtShell()->StartAllAction();
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, pColl->GetName());
+
+ GetWrtShell()->StartUndo(UNDO_INSFMTATTR, &aRewriter);
+ GetWrtShell()->FillByEx(pColl);
+ // Vorlage auch anwenden, um harte Attributierung
+ // zu entfernen
+ GetWrtShell()->SetTxtFmtColl( pColl );
+ GetWrtShell()->EndUndo();
+ GetWrtShell()->EndAllAction();
+ }
+ break;
+ }
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ SwFrmFmt* pFrm = pStyle->GetFrmFmt();
+ if( pCurrWrtShell->IsFrmSelected() && pFrm && !pFrm->IsDefault() )
+ {
+ SfxItemSet aSet( GetPool(), aFrmFmtSetRange );
+ pCurrWrtShell->StartAllAction();
+ pCurrWrtShell->GetFlyFrmAttr( aSet );
+
+ // --> OD 2009-12-28 #i105535#
+ // no update of anchor attribute
+ aSet.ClearItem( RES_ANCHOR );
+ // <--
+
+ pFrm->SetFmtAttr( aSet );
+
+ // Vorlage auch anwenden, um harte Attributierung
+ // zu entfernen
+ pCurrWrtShell->SetFrmFmt( pFrm, TRUE );
+ pCurrWrtShell->EndAllAction();
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ SwCharFmt* pChar = pStyle->GetCharFmt();
+ if( pChar && !pChar->IsDefault() )
+ {
+ pCurrWrtShell->StartAllAction();
+ pCurrWrtShell->FillByEx(pChar);
+ // Vorlage auch anwenden, um harte Attributierung
+ // zu entfernen
+ pCurrWrtShell->EndAllAction();
+ }
+
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ const SwNumRule* pCurRule;
+ if( pStyle->GetNumRule() &&
+ 0 != ( pCurRule = pCurrWrtShell->GetCurNumRule() ))
+ {
+ SwNumRule aRule( *pCurRule );
+ // --> OD 2008-07-08 #i91400#
+ aRule.SetName( pStyle->GetNumRule()->GetName(),
+ *(pCurrWrtShell->GetDoc()) );
+ // <--
+ pCurrWrtShell->ChgNumRuleFmts( aRule );
+ }
+ }
+ break;
+ }
+ return nFamily;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: NewByExample
+ --------------------------------------------------------------------*/
+
+
+USHORT SwDocShell::MakeByExample( const String &rName, USHORT nFamily,
+ USHORT nMask, SwWrtShell* pShell )
+{
+ SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell();
+ SwDocStyleSheet* pStyle = (SwDocStyleSheet*)mxBasePool->Find(
+ rName, (SfxStyleFamily)nFamily );
+ if(!pStyle)
+ {
+ // JP 07.07.95: behalte die akt. Maske vom PI bei, dadurch werden
+ // neue sofort in den sichtbaren Bereich einsortiert
+ if( SFXSTYLEBIT_ALL == nMask || SFXSTYLEBIT_USED == nMask )
+ nMask = SFXSTYLEBIT_USERDEF;
+ else
+ nMask |= SFXSTYLEBIT_USERDEF;
+
+ pStyle = (SwDocStyleSheet*)&mxBasePool->Make(rName,
+ (SfxStyleFamily)nFamily, nMask );
+ }
+
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ SwTxtFmtColl* pColl = pStyle->GetCollection();
+ if(pColl && !pColl->IsDefault())
+ {
+ pCurrWrtShell->StartAllAction();
+ pCurrWrtShell->FillByEx(pColl);
+ // Vorlage auch anwenden, um harte Attributierung
+ // zu entfernen
+ pColl->SetDerivedFrom(pCurrWrtShell->GetCurTxtFmtColl());
+
+ // setze die Maske noch an der Collection:
+ USHORT nId = pColl->GetPoolFmtId() & 0x87ff;
+ switch( nMask & 0x0fff )
+ {
+ case SWSTYLEBIT_TEXT:
+ nId |= COLL_TEXT_BITS;
+ break;
+ case SWSTYLEBIT_CHAPTER:
+ nId |= COLL_DOC_BITS;
+ break;
+ case SWSTYLEBIT_LIST:
+ nId |= COLL_LISTS_BITS;
+ break;
+ case SWSTYLEBIT_IDX:
+ nId |= COLL_REGISTER_BITS;
+ break;
+ case SWSTYLEBIT_EXTRA:
+ nId |= COLL_EXTRA_BITS;
+ break;
+ case SWSTYLEBIT_HTML:
+ nId |= COLL_HTML_BITS;
+ break;
+ }
+ pColl->SetPoolFmtId(nId);
+
+ pCurrWrtShell->SetTxtFmtColl(pColl);
+ pCurrWrtShell->EndAllAction();
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ SwFrmFmt* pFrm = pStyle->GetFrmFmt();
+ if(pCurrWrtShell->IsFrmSelected() && pFrm && !pFrm->IsDefault())
+ {
+ pCurrWrtShell->StartAllAction();
+
+ SfxItemSet aSet(GetPool(), aFrmFmtSetRange );
+ pCurrWrtShell->GetFlyFrmAttr( aSet );
+
+ SwFrmFmt* pFFmt = pCurrWrtShell->GetCurFrmFmt();
+ pFrm->SetDerivedFrom( pFFmt );
+
+ // JP 10.06.98: nur automatische Orientierungen uebernehmen
+/* #61359# jetzt auch wieder alle Orientierungen
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == aSet.GetItemState( RES_VERT_ORIENT,
+ FALSE, &pItem ) &&
+ text::VertOrientation::NONE == ((SwFmtVertOrient*)pItem)->GetVertOrient())
+ aSet.ClearItem( RES_VERT_ORIENT );
+
+ if( SFX_ITEM_SET == aSet.GetItemState( RES_HORI_ORIENT,
+ FALSE, &pItem ) &&
+ text::HoriOrientation::NONE == ((SwFmtHoriOrient*)pItem)->GetHoriOrient())
+ aSet.ClearItem( RES_HORI_ORIENT );
+ */
+
+ pFrm->SetFmtAttr( aSet );
+ // Vorlage auch anwenden, um harte Attributierung
+ // zu entfernen
+ pCurrWrtShell->SetFrmFmt( pFrm );
+ pCurrWrtShell->EndAllAction();
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ SwCharFmt* pChar = pStyle->GetCharFmt();
+ if(pChar && !pChar->IsDefault())
+ {
+ pCurrWrtShell->StartAllAction();
+ pCurrWrtShell->FillByEx( pChar );
+ pChar->SetDerivedFrom( pCurrWrtShell->GetCurCharFmt() );
+ SwFmtCharFmt aFmt( pChar );
+ pCurrWrtShell->SetAttr( aFmt );
+ pCurrWrtShell->EndAllAction();
+ }
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ pCurrWrtShell->StartAllAction();
+ USHORT nPgDsc = pCurrWrtShell->GetCurPageDesc();
+ SwPageDesc& rSrc = (SwPageDesc&)pCurrWrtShell->GetPageDesc( nPgDsc );
+ SwPageDesc& rDest = *(SwPageDesc*)pStyle->GetPageDesc();
+
+ USHORT nPoolId = rDest.GetPoolFmtId();
+ USHORT nHId = rDest.GetPoolHelpId();
+ BYTE nHFId = rDest.GetPoolHlpFileId();
+
+ pCurrWrtShell->GetDoc()->CopyPageDesc( rSrc, rDest );
+
+ // PoolId darf NIE kopiert werden!
+ rDest.SetPoolFmtId( nPoolId );
+ rDest.SetPoolHelpId( nHId );
+ rDest.SetPoolHlpFileId( nHFId );
+
+ // werden Kopf-/Fusszeilen angelegt, so gibt es kein Undo mehr!
+ pCurrWrtShell->GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj();
+
+ pCurrWrtShell->EndAllAction();
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ pCurrWrtShell->StartAllAction();
+
+ SwNumRule aRule( *pCurrWrtShell->GetCurNumRule() );
+ String sOrigRule( aRule.GetName() );
+ // --> OD 2008-07-08 #i91400#
+ aRule.SetName( pStyle->GetNumRule()->GetName(),
+ *(pCurrWrtShell->GetDoc()) );
+ // <--
+ pCurrWrtShell->ChgNumRuleFmts( aRule );
+
+ pCurrWrtShell->ReplaceNumRule( sOrigRule, aRule.GetName() );
+
+
+ pCurrWrtShell->EndAllAction();
+ }
+ break;
+ }
+ return nFamily;
+}
+
+void SwDocShell::LoadStyles( SfxObjectShell& rSource )
+{
+ _LoadStyles(rSource, FALSE);
+}
+/* -----------------16.05.2003 15:45-----------------
+ bPreserveCurrentDocument determines whether SetFixFields() is called
+ This call modifies the source document. This mustn't happen when the source
+ is a document the user is working on.
+ Calls of ::LoadStyles() normally use files especially loaded for the purpose
+ of importing styles.
+ --------------------------------------------------*/
+void SwDocShell::_LoadStyles( SfxObjectShell& rSource, BOOL bPreserveCurrentDocument )
+{
+/* [Beschreibung]
+
+ Diese Methode wird vom SFx gerufen, wenn aus einer Dokument-Vorlage
+ Styles nachgeladen werden sollen. Bestehende Styles soll dabei
+ "uberschrieben werden. Das Dokument mu"s daher neu formatiert werden.
+ Daher werden die Applikationen in der Regel diese Methode "uberladen
+ und in ihrer Implementierung die Implementierung der Basisklasse
+ rufen.
+*/
+ // ist die Source unser Document, dann uebernehmen wir das
+ // abpruefen selbst (wesentlich schneller und laeuft nicht ueber
+ // die Kruecke SfxStylePool
+ if( rSource.ISA( SwDocShell ))
+ {
+ //JP 28.05.99: damit die Kopf-/Fusszeilen nicht den fixen Inhalt
+ // der Vorlage erhalten, einmal alle FixFelder der
+ // Source aktualisieren
+ if(!bPreserveCurrentDocument)
+ ((SwDocShell&)rSource).pDoc->SetFixFields(false, NULL);
+ if( pWrtShell )
+ {
+ pWrtShell->StartAllAction();
+ pDoc->ReplaceStyles( *((SwDocShell&)rSource).pDoc );
+ pWrtShell->EndAllAction();
+ }
+ else
+ {
+ BOOL bModified = pDoc->IsModified();
+ pDoc->ReplaceStyles( *((SwDocShell&)rSource).pDoc );
+ if( !bModified && pDoc->IsModified() && !pView )
+ {
+ // die View wird spaeter angelegt, ueberschreibt aber das
+ // Modify-Flag. Per Undo ist sowieso nichts mehr zu machen
+ pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified();
+ }
+ }
+ }
+ else
+ SfxObjectShell::LoadStyles( rSource );
+}
+
+
+void SwDocShell::FormatPage( const String& rPage, BOOL bColumn, SwWrtShell* pActShell )
+{
+ Edit( rPage, aEmptyStr, SFX_STYLE_FAMILY_PAGE, 0, FALSE, bColumn, pActShell);
+}
+
+Bitmap SwDocShell::GetStyleFamilyBitmap( SfxStyleFamily eFamily, BmpColorMode eColorMode )
+{
+ if( SFX_STYLE_FAMILY_PSEUDO == eFamily )
+ {
+ if ( eColorMode == BMP_COLOR_NORMAL )
+ return Bitmap( SW_RES( BMP_STYLES_FAMILY_NUM ));
+ else
+ return Bitmap( SW_RES( BMP_STYLES_FAMILY_NUM_HC ));
+ }
+
+ return SfxObjectShell::GetStyleFamilyBitmap( eFamily, eColorMode );
+}
+
+
+
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
new file mode 100644
index 000000000000..e3d47a82b38f
--- /dev/null
+++ b/sw/source/ui/app/docstyle.cxx
@@ -0,0 +1,2906 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#define _SVSTDARR_USHORTS
+
+#include <svl/smplhint.hxx>
+#include <hintids.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/eitem.hxx>
+#include <unotools/syslocale.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/numitem.hxx>
+// --> OD 2008-02-13 #newlistlevelattrs#
+#include <editeng/lrspitem.hxx>
+// <--
+#include <fmtcol.hxx>
+#include <uitool.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <errhdl.hxx>
+#include <frmfmt.hxx>
+#include <charfmt.hxx>
+#include <poolfmt.hxx>
+#include <pagedesc.hxx>
+#include <docstyle.hxx>
+#include <docary.hxx>
+#include <ccoll.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <cmdid.h>
+#include <swstyle.h>
+#include <app.hrc>
+#include <paratr.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <svl/cjkoptions.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/intlwrapper.hxx>
+#include <numrule.hxx>
+#include <fmthdft.hxx>
+#include <svx/svxids.hrc>
+// --> OD 2008-02-12 #newlistlevelattrs#
+#include <SwRewriter.hxx>
+// <--
+
+// MD 06.02.95: Die Formatnamen in der Liste aller Namen haben als
+// erstes Zeichen die Familie:
+
+#define cCHAR (sal_Unicode)'c'
+#define cPARA (sal_Unicode)'p'
+#define cFRAME (sal_Unicode)'f'
+#define cPAGE (sal_Unicode)'g'
+#define cNUMRULE (sal_Unicode)'n'
+
+// Dieses Zeichen wird bei der Herausgabe der Namen wieder entfernt und
+// die Familie wird neu generiert.
+
+// Ausserdem gibt es jetzt zusaetzlich das Bit bPhysical. Ist dieses Bit
+// TRUE, werden die Pool-Formatnamen NICHT mit eingetragen.
+
+class SwImplShellAction
+{
+ SwWrtShell* pSh;
+ CurrShell* pCurrSh;
+public:
+ SwImplShellAction( SwDoc& rDoc );
+ ~SwImplShellAction();
+
+ SwWrtShell* GetSh() { return pSh; }
+};
+
+SwImplShellAction::SwImplShellAction( SwDoc& rDoc )
+ : pCurrSh( 0 )
+{
+ if( rDoc.GetDocShell() )
+ pSh = rDoc.GetDocShell()->GetWrtShell();
+ else
+ pSh = 0;
+
+ if( pSh )
+ {
+ pCurrSh = new CurrShell( pSh );
+ pSh->StartAllAction();
+ }
+}
+
+SwImplShellAction::~SwImplShellAction()
+{
+ if( pCurrSh )
+ {
+ pSh->EndAllAction();
+ delete pCurrSh;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwCharFormate finden/anlegen
+ evtl. Style fuellen
+ --------------------------------------------------------------------*/
+
+SwCharFmt* lcl_FindCharFmt( SwDoc& rDoc,
+ const String& rName,
+ SwDocStyleSheet* pStyle = 0,
+ BOOL bCreate = TRUE )
+{
+ SwCharFmt* pFmt = 0;
+ if( rName.Len() )
+ {
+ pFmt = rDoc.FindCharFmtByName( rName );
+ if( !pFmt && rName == *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
+ RES_POOLCOLL_TEXT_BEGIN ] )
+ {
+ // Standard-Zeichenvorlage
+ pFmt = (SwCharFmt*)rDoc.GetDfltCharFmt();
+ }
+
+ if( !pFmt && bCreate )
+ { // Pool abklappern
+ const USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
+ if(nId != USHRT_MAX)
+ pFmt = rDoc.GetCharFmtFromPool(nId);
+ }
+ }
+ if(pStyle)
+ {
+ if(pFmt)
+ {
+ pStyle->SetPhysical(TRUE);
+ SwFmt* p = pFmt->DerivedFrom();
+ if( p && !p->IsDefault() )
+ pStyle->PresetParent( p->GetName() );
+ else
+ pStyle->PresetParent( aEmptyStr );
+ }
+ else
+ pStyle->SetPhysical(FALSE);
+ }
+ return pFmt;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: ParaFormate finden/erzeugen
+ Style fuellen
+ --------------------------------------------------------------------*/
+
+SwTxtFmtColl* lcl_FindParaFmt( SwDoc& rDoc,
+ const String& rName,
+ SwDocStyleSheet* pStyle = 0,
+ BOOL bCreate = TRUE )
+{
+ SwTxtFmtColl* pColl = 0;
+
+ if( rName.Len() )
+ {
+ pColl = rDoc.FindTxtFmtCollByName( rName );
+ if( !pColl && bCreate )
+ { // Pool abklappern
+ const USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL);
+ if(nId != USHRT_MAX)
+ pColl = rDoc.GetTxtCollFromPool(nId);
+ }
+ }
+
+ if(pStyle)
+ {
+ if(pColl)
+ {
+ pStyle->SetPhysical(TRUE);
+ if( pColl->DerivedFrom() && !pColl->DerivedFrom()->IsDefault() )
+ pStyle->PresetParent( pColl->DerivedFrom()->GetName() );
+ else
+ pStyle->PresetParent( aEmptyStr );
+
+ SwTxtFmtColl& rNext = pColl->GetNextTxtFmtColl();
+ pStyle->PresetFollow(rNext.GetName());
+ }
+ else
+ pStyle->SetPhysical(FALSE);
+ }
+ return pColl;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Rahmenformate
+ --------------------------------------------------------------------*/
+
+
+SwFrmFmt* lcl_FindFrmFmt( SwDoc& rDoc,
+ const String& rName,
+ SwDocStyleSheet* pStyle = 0,
+ BOOL bCreate = TRUE )
+{
+ SwFrmFmt* pFmt = 0;
+ if( rName.Len() )
+ {
+ pFmt = rDoc.FindFrmFmtByName( rName );
+ if( !pFmt && bCreate )
+ { // Pool abklappern
+ const USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT);
+ if(nId != USHRT_MAX)
+ pFmt = rDoc.GetFrmFmtFromPool(nId);
+ }
+ }
+
+ if(pStyle)
+ {
+ if(pFmt)
+ {
+ pStyle->SetPhysical(TRUE);
+ if( pFmt->DerivedFrom() && !pFmt->DerivedFrom()->IsDefault() )
+ pStyle->PresetParent( pFmt->DerivedFrom()->GetName() );
+ else
+ pStyle->PresetParent( aEmptyStr );
+ }
+ else
+ pStyle->SetPhysical(FALSE);
+ }
+ return pFmt;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Seitendescriptoren
+ --------------------------------------------------------------------*/
+
+
+const SwPageDesc* lcl_FindPageDesc( SwDoc& rDoc,
+ const String& rName,
+ SwDocStyleSheet* pStyle = 0,
+ BOOL bCreate = TRUE )
+{
+ const SwPageDesc* pDesc = 0;
+
+ if( rName.Len() )
+ {
+ pDesc = rDoc.FindPageDescByName( rName );
+ if( !pDesc && bCreate )
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC);
+ if(nId != USHRT_MAX)
+ pDesc = rDoc.GetPageDescFromPool(nId);
+ }
+ }
+
+ if(pStyle)
+ {
+ if(pDesc)
+ {
+ pStyle->SetPhysical(TRUE);
+ if(pDesc->GetFollow())
+ pStyle->PresetFollow(pDesc->GetFollow()->GetName());
+ else
+ pStyle->PresetParent( aEmptyStr );
+ }
+ else
+ pStyle->SetPhysical(FALSE);
+ }
+ return pDesc;
+}
+
+const SwNumRule* lcl_FindNumRule( SwDoc& rDoc,
+ const String& rName,
+ SwDocStyleSheet* pStyle = 0,
+ BOOL bCreate = TRUE )
+{
+ const SwNumRule* pRule = 0;
+
+ if( rName.Len() )
+ {
+ pRule = rDoc.FindNumRulePtr( rName );
+ if( !pRule && bCreate )
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE);
+ if(nId != USHRT_MAX)
+ pRule = rDoc.GetNumRuleFromPool(nId);
+ }
+ }
+
+ if(pStyle)
+ {
+ if(pRule)
+ {
+ pStyle->SetPhysical(TRUE);
+ pStyle->PresetParent( aEmptyStr );
+ }
+ else
+ pStyle->SetPhysical(FALSE);
+ }
+ return pRule;
+}
+
+
+USHORT lcl_FindName( const SwPoolFmtList& rLst, SfxStyleFamily eFam,
+ const String& rName )
+{
+ if( rLst.Count() )
+ {
+ // suchen
+ String sSrch( ' ' );
+ switch( eFam )
+ {
+ case SFX_STYLE_FAMILY_CHAR: sSrch = cCHAR; break;
+ case SFX_STYLE_FAMILY_PARA: sSrch = cPARA; break;
+ case SFX_STYLE_FAMILY_FRAME: sSrch = cFRAME; break;
+ case SFX_STYLE_FAMILY_PAGE: sSrch = cPAGE; break;
+ case SFX_STYLE_FAMILY_PSEUDO: sSrch = cNUMRULE; break;
+ default:; //prevent warning
+ }
+ sSrch += rName;
+ for( USHORT i=0; i < rLst.Count(); ++i )
+ if( *rLst[i] == sSrch )
+ return i;
+ }
+ return USHRT_MAX;
+}
+
+BOOL FindPhyStyle( SwDoc& rDoc, const String& rName, SfxStyleFamily eFam )
+{
+ switch( eFam )
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ return 0 != lcl_FindCharFmt( rDoc, rName, 0, FALSE );
+ case SFX_STYLE_FAMILY_PARA :
+ return 0 != lcl_FindParaFmt( rDoc, rName, 0, FALSE );
+ case SFX_STYLE_FAMILY_FRAME:
+ return 0 != lcl_FindFrmFmt( rDoc, rName, 0, FALSE );
+ case SFX_STYLE_FAMILY_PAGE :
+ return 0 != lcl_FindPageDesc( rDoc, rName, 0, FALSE );
+ case SFX_STYLE_FAMILY_PSEUDO:
+ return 0 != lcl_FindNumRule( rDoc, rName, 0, FALSE );
+ default:; //prevent warning
+ }
+ return FALSE;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Einfuegen von Strings in die Liste der Vorlagen
+ --------------------------------------------------------------------*/
+
+
+void SwPoolFmtList::Append( char cChar, const String& rStr )
+{
+ String* pStr = new String( cChar );
+ *pStr += rStr;
+ for ( USHORT i=0; i < Count(); ++i )
+ {
+ if( *operator[](i) == *pStr )
+ {
+ delete pStr;
+ return;
+ }
+ }
+ Insert( pStr, Count() );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Liste kompletti loeschen
+ --------------------------------------------------------------------*/
+
+
+void SwPoolFmtList::Erase()
+{
+ DeleteAndDestroy( 0, Count() );
+}
+
+/* */
+
+/*--------------------------------------------------------------------
+ Beschreibung: UI-seitige implementierung von StyleSheets
+ greift auf die Core-Engine zu
+ --------------------------------------------------------------------*/
+
+SwDocStyleSheet::SwDocStyleSheet( SwDoc& rDocument,
+ const String& rName,
+ SwDocStyleSheetPool& _rPool,
+ SfxStyleFamily eFam,
+ USHORT _nMask) :
+
+ SfxStyleSheetBase( rName, _rPool, eFam, _nMask ),
+ pCharFmt(0),
+ pColl(0),
+ pFrmFmt(0),
+ pDesc(0),
+ pNumRule(0),
+
+ rDoc(rDocument),
+ aCoreSet(GetPool().GetPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
+ RES_PARATR_BEGIN, RES_PARATR_END - 1,
+ // --> OD 2008-02-25 #refactorlists#
+ RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
+ // <--
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ SID_ATTR_PAGE, SID_ATTR_PAGE_EXT1,
+ SID_ATTR_PAGE_HEADERSET,SID_ATTR_PAGE_FOOTERSET,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ FN_PARAM_FTN_INFO, FN_PARAM_FTN_INFO,
+ SID_ATTR_PARA_MODEL, SID_ATTR_PARA_MODEL,
+ SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
+ SID_SWREGISTER_MODE, SID_SWREGISTER_MODE,
+ SID_SWREGISTER_COLLECTION, SID_SWREGISTER_COLLECTION,
+ FN_COND_COLL, FN_COND_COLL,
+ SID_ATTR_AUTO_STYLE_UPDATE, SID_ATTR_AUTO_STYLE_UPDATE,
+ SID_ATTR_NUMBERING_RULE, SID_ATTR_NUMBERING_RULE,
+ SID_PARA_BACKGRND_DESTINATION, SID_ATTR_BRUSH_CHAR,
+ SID_ATTR_NUMBERING_RULE, SID_ATTR_NUMBERING_RULE,
+ 0),
+ bPhysical(FALSE)
+{
+ nHelpId = UCHAR_MAX;
+}
+
+
+SwDocStyleSheet::SwDocStyleSheet( const SwDocStyleSheet& rOrg) :
+ SfxStyleSheetBase(rOrg),
+ pCharFmt(rOrg.pCharFmt),
+ pColl(rOrg.pColl),
+ pFrmFmt(rOrg.pFrmFmt),
+ pDesc(rOrg.pDesc),
+ pNumRule(rOrg.pNumRule),
+ rDoc(rOrg.rDoc),
+ aCoreSet(rOrg.aCoreSet),
+ bPhysical(rOrg.bPhysical)
+{
+}
+
+
+ SwDocStyleSheet::~SwDocStyleSheet()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zuruecksetzen
+ --------------------------------------------------------------------*/
+
+
+void SwDocStyleSheet::Reset()
+{
+ aName.Erase();
+ aFollow.Erase();
+ aParent.Erase();
+ SetPhysical(FALSE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: virtuelle Methoden
+ --------------------------------------------------------------------*/
+
+
+const String& SwDocStyleSheet::GetParent() const
+{
+ if( !bPhysical )
+ {
+ // dann pruefe, ob schon im Doc vorhanden
+ SwFmt* pFmt = 0;
+ SwGetPoolIdFromName eGetType;
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ pFmt = rDoc.FindCharFmtByName( aName );
+ eGetType = nsSwGetPoolIdFromName::GET_POOLID_CHRFMT;
+ break;
+
+ case SFX_STYLE_FAMILY_PARA:
+ pFmt = rDoc.FindTxtFmtCollByName( aName );
+ eGetType = nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL;
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ pFmt = rDoc.FindFrmFmtByName( aName );
+ eGetType = nsSwGetPoolIdFromName::GET_POOLID_FRMFMT;
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ case SFX_STYLE_FAMILY_PSEUDO:
+ default:
+ return aEmptyStr; // es gibt keinen Parent
+ }
+
+ String sTmp;
+ if( !pFmt ) // noch nicht vorhanden, also dflt. Parent
+ {
+ USHORT i = SwStyleNameMapper::GetPoolIdFromUIName( aName, eGetType );
+ i = ::GetPoolParent( i );
+ if( i && USHRT_MAX != i )
+ SwStyleNameMapper::FillUIName( i, sTmp );
+ }
+ else
+ {
+ SwFmt* p = pFmt->DerivedFrom();
+ if( p && !p->IsDefault() )
+ sTmp = p->GetName();
+ }
+ SwDocStyleSheet* pThis = (SwDocStyleSheet*)this;
+ pThis->aParent = sTmp;
+ }
+ return aParent;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nachfolger
+ --------------------------------------------------------------------*/
+
+
+const String& SwDocStyleSheet::GetFollow() const
+{
+ if( !bPhysical )
+ {
+ SwDocStyleSheet* pThis = (SwDocStyleSheet*)this;
+ pThis->FillStyleSheet( FillAllInfo );
+ }
+ return aFollow;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Welche Verkettung ist moeglich
+ --------------------------------------------------------------------*/
+
+
+BOOL SwDocStyleSheet::HasFollowSupport() const
+{
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA :
+ case SFX_STYLE_FAMILY_PAGE : return TRUE;
+ case SFX_STYLE_FAMILY_FRAME:
+ case SFX_STYLE_FAMILY_CHAR :
+ case SFX_STYLE_FAMILY_PSEUDO: return FALSE;
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Parent ?
+ --------------------------------------------------------------------*/
+
+
+BOOL SwDocStyleSheet::HasParentSupport() const
+{
+ BOOL bRet = FALSE;
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ case SFX_STYLE_FAMILY_PARA :
+ case SFX_STYLE_FAMILY_FRAME: bRet = TRUE;
+ default:; //prevent warning
+ }
+ return bRet;
+}
+
+
+BOOL SwDocStyleSheet::HasClearParentSupport() const
+{
+ BOOL bRet = FALSE;
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA :
+ case SFX_STYLE_FAMILY_CHAR :
+ case SFX_STYLE_FAMILY_FRAME: bRet = TRUE;
+ default:; //prevent warning
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: textuelle Beschreibung ermitteln
+ --------------------------------------------------------------------*/
+String SwDocStyleSheet::GetDescription(SfxMapUnit eUnit)
+{
+ IntlWrapper aIntlWrapper(
+ ::comphelper::getProcessServiceFactory(),
+ SvtSysLocale().GetLocaleData().getLocale());
+
+ String sPlus(String::CreateFromAscii(" + "));
+ if ( SFX_STYLE_FAMILY_PAGE == nFamily )
+ {
+ if( !pSet )
+ GetItemSet();
+
+ SfxItemIter aIter( *pSet );
+ String aDesc;
+ const SfxPoolItem* pItem = aIter.FirstItem();
+
+ while ( pItem )
+ {
+ if(!IsInvalidItem(pItem))
+ switch ( pItem->Which() )
+ {
+ case RES_LR_SPACE:
+ case SID_ATTR_PAGE_SIZE:
+ case SID_ATTR_PAGE_MAXSIZE:
+ case SID_ATTR_PAGE_PAPERBIN:
+ case SID_ATTR_PAGE_APP:
+ case SID_ATTR_BORDER_INNER:
+ break;
+ default:
+ {
+ String aItemPresentation;
+ if ( !IsInvalidItem( pItem ) &&
+ rPool.GetPool().GetPresentation(
+ *pItem, SFX_ITEM_PRESENTATION_COMPLETE,
+ eUnit, aItemPresentation, &aIntlWrapper ) )
+ {
+ if ( aDesc.Len() && aItemPresentation.Len() )
+ aDesc += sPlus;
+ aDesc += aItemPresentation;
+ }
+ }
+ }
+ pItem = aIter.NextItem();
+ }
+ return aDesc;
+ }
+ else if ( SFX_STYLE_FAMILY_FRAME == nFamily ||
+ SFX_STYLE_FAMILY_PARA == nFamily)
+ {
+ if( !pSet )
+ GetItemSet();
+
+ SfxItemIter aIter( *pSet );
+ String aDesc;
+ const SfxPoolItem* pItem = aIter.FirstItem();
+
+ String sPageNum, sModel, sBreak;
+ BOOL bHasWesternFontPrefix = FALSE;
+ BOOL bHasCJKFontPrefix = FALSE;
+ SvtCJKOptions aCJKOptions;
+
+ while ( pItem )
+ {
+ if(!IsInvalidItem(pItem))
+ switch ( pItem->Which() )
+ {
+ case SID_ATTR_AUTO_STYLE_UPDATE:
+ case SID_PARA_BACKGRND_DESTINATION:
+ case RES_PAGEDESC:
+ //CTL no yet supported
+ case RES_CHRATR_CTL_FONT:
+ case RES_CHRATR_CTL_FONTSIZE:
+ case RES_CHRATR_CTL_LANGUAGE:
+ case RES_CHRATR_CTL_POSTURE:
+ case RES_CHRATR_CTL_WEIGHT:
+ break;
+ default:
+ {
+ String aItemPresentation;
+ if ( !IsInvalidItem( pItem ) &&
+ rPool.GetPool().GetPresentation(
+ *pItem, SFX_ITEM_PRESENTATION_COMPLETE,
+ eUnit, aItemPresentation, &aIntlWrapper ) )
+ {
+ BOOL bIsDefault = FALSE;
+ switch ( pItem->Which() )
+ {
+ case SID_ATTR_PARA_PAGENUM:
+ sPageNum = aItemPresentation;
+ break;
+ case SID_ATTR_PARA_MODEL:
+ sModel = aItemPresentation;
+ break;
+ case RES_BREAK:
+ sBreak = aItemPresentation;
+ break;
+ case RES_CHRATR_CJK_FONT:
+ case RES_CHRATR_CJK_FONTSIZE:
+ case RES_CHRATR_CJK_LANGUAGE:
+ case RES_CHRATR_CJK_POSTURE:
+ case RES_CHRATR_CJK_WEIGHT:
+ if(aCJKOptions.IsCJKFontEnabled())
+ bIsDefault = TRUE;
+ if(!bHasCJKFontPrefix)
+ {
+ aItemPresentation.Insert(SW_RESSTR(STR_CJK_FONT), 0);
+ bHasCJKFontPrefix = TRUE;
+ }
+ break;
+ case RES_CHRATR_FONT:
+ case RES_CHRATR_FONTSIZE:
+ case RES_CHRATR_LANGUAGE:
+ case RES_CHRATR_POSTURE:
+ case RES_CHRATR_WEIGHT:
+ if(!bHasWesternFontPrefix)
+ {
+ aItemPresentation.Insert(SW_RESSTR(STR_WESTERN_FONT), 0);
+ bHasWesternFontPrefix = TRUE;
+ bIsDefault = TRUE;
+ }
+ // no break;
+ default:
+ bIsDefault = TRUE;
+ }
+ if(bIsDefault)
+ {
+ if ( aDesc.Len() && aItemPresentation.Len() )
+ aDesc += sPlus;
+ aDesc += aItemPresentation;
+ }
+ }
+ }
+ }
+ pItem = aIter.NextItem();
+ }
+ //Sonderbehandlung fuer Umburch, Seitenvorlage und Seitenoffset
+ if(sBreak.Len() && !sModel.Len()) // wemm Model. dann ist Break ungueltig
+ {
+ if(aDesc.Len())
+ aDesc += sPlus;
+ aDesc += sBreak;
+ }
+ if(sModel.Len())
+ {
+ if(aDesc.Len())
+ aDesc += sPlus;
+ aDesc += SW_RESSTR(STR_PAGEBREAK);
+ aDesc += sPlus;
+ aDesc += sModel;
+ if(sPageNum != String(UniString::CreateFromInt32(0)))
+ {
+ aDesc += sPlus;
+ aDesc += SW_RESSTR(STR_PAGEOFFSET);
+ aDesc += sPageNum;
+ }
+ }
+ return aDesc;
+ }
+ else if( SFX_STYLE_FAMILY_PSEUDO == nFamily )
+ {
+// if( pNumRule )
+// return pNumRule->GetName();
+ //os: was sollte man bei Numerierungen schon anzeigen?
+ return aEmptyStr;
+ }
+
+ return SfxStyleSheetBase::GetDescription(eUnit);
+}
+
+
+String SwDocStyleSheet::GetDescription()
+{
+ return GetDescription(SFX_MAPUNIT_CM);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Namen setzen
+ --------------------------------------------------------------------*/
+
+
+BOOL SwDocStyleSheet::SetName( const String& rStr)
+{
+ if( !rStr.Len() )
+ return FALSE;
+
+ if( aName != rStr )
+ {
+ if( !SfxStyleSheetBase::SetName( rStr ))
+ return FALSE;
+ }
+ else if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+
+ int bChg = FALSE;
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ {
+ ASSERT(pCharFmt, "SwCharFormat fehlt!");
+ if( pCharFmt && pCharFmt->GetName() != rStr )
+ {
+ pCharFmt->SetName( rStr );
+ bChg = TRUE;
+ }
+ break;
+ }
+ case SFX_STYLE_FAMILY_PARA :
+ {
+ ASSERT(pColl, "Collektion fehlt!");
+ if( pColl && pColl->GetName() != rStr )
+ {
+ if (pColl->GetName().Len() > 0)
+ rDoc.RenameFmt(*pColl, rStr);
+ else
+ pColl->SetName(rStr);
+
+ bChg = TRUE;
+ }
+ break;
+ }
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ ASSERT(pFrmFmt, "FrmFmt fehlt!");
+ if( pFrmFmt && pFrmFmt->GetName() != rStr )
+ {
+ if (pFrmFmt->GetName().Len() > 0)
+ rDoc.RenameFmt(*pFrmFmt, rStr);
+ else
+ pFrmFmt->SetName( rStr );
+
+ bChg = TRUE;
+ }
+ break;
+ }
+ case SFX_STYLE_FAMILY_PAGE :
+ ASSERT(pDesc, "PageDesc fehlt!");
+ if( pDesc && pDesc->GetName() != rStr )
+ {
+ //PageDesc setzen - mit vorherigem kopieren - ist fuer das
+ //setzen des Namens wohl nicht notwendig. Deshalb erlauben
+ //wir hier mal einen cast.
+ // -> #116530#
+ SwPageDesc aPageDesc(*((SwPageDesc*)pDesc));
+ String aOldName(aPageDesc.GetName());
+
+ aPageDesc.SetName( rStr );
+ bool const bDoesUndo = rDoc.GetIDocumentUndoRedo().DoesUndo();
+
+ rDoc.GetIDocumentUndoRedo().DoUndo(aOldName.Len() > 0);
+ rDoc.ChgPageDesc(aOldName, aPageDesc);
+ rDoc.GetIDocumentUndoRedo().DoUndo(bDoesUndo);
+ // <- #116530#
+
+ rDoc.SetModified();
+ bChg = TRUE;
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ ASSERT(pNumRule, "NumRule fehlt!");
+
+ // -> #106897#
+ if (pNumRule)
+ {
+ String aOldName = pNumRule->GetName();
+
+ if (aOldName.Len() > 0)
+ {
+ if ( aOldName != rStr &&
+ rDoc.RenameNumRule(aOldName, rStr))
+ {
+ pNumRule = rDoc.FindNumRulePtr(rStr);
+ rDoc.SetModified();
+
+ bChg = TRUE;
+ }
+ }
+ else
+ {
+ // --> OD 2008-07-08 #i91400#
+ ((SwNumRule*)pNumRule)->SetName( rStr, rDoc );
+ // <--
+ rDoc.SetModified();
+
+ bChg = TRUE;
+ }
+ }
+ // <- #106897#
+
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+
+ if( bChg )
+ {
+ rPool.First(); // interne Liste muss geupdatet werden
+ rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
+ SwEditShell* pSh = rDoc.GetEditShell();
+ if( pSh )
+ pSh->CallChgLnk();
+ }
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ableitungshirachie
+ --------------------------------------------------------------------*/
+
+
+BOOL SwDocStyleSheet::SetParent( const String& rStr)
+{
+ SwFmt* pFmt = 0, *pParent = 0;
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ ASSERT( pCharFmt, "SwCharFormat fehlt!" )
+ if( 0 != ( pFmt = pCharFmt ) && rStr.Len() )
+ pParent = lcl_FindCharFmt(rDoc, rStr);
+ break;
+
+ case SFX_STYLE_FAMILY_PARA :
+ ASSERT( pColl, "Collektion fehlt!")
+ if( 0 != ( pFmt = pColl ) && rStr.Len() )
+ pParent = lcl_FindParaFmt( rDoc, rStr );
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ ASSERT(pFrmFmt, "FrameFormat fehlt!");
+ if( 0 != ( pFmt = pFrmFmt ) && rStr.Len() )
+ pParent = lcl_FindFrmFmt( rDoc, rStr );
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ case SFX_STYLE_FAMILY_PSEUDO:
+ break;
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+
+ BOOL bRet = FALSE;
+ if( pFmt && pFmt->DerivedFrom() &&
+ pFmt->DerivedFrom()->GetName() != rStr )
+ {
+ {
+ SwImplShellAction aTmp( rDoc );
+ bRet = pFmt->SetDerivedFrom( pParent );
+ }
+
+ if( bRet )
+ {
+ aParent = rStr;
+ rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED,
+ *this ) );
+ }
+ }
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nachfolger detzen
+ --------------------------------------------------------------------*/
+
+
+BOOL SwDocStyleSheet::SetFollow( const String& rStr)
+{
+ if( rStr.Len() && !SfxStyleSheetBase::SetFollow( rStr ))
+ return FALSE;
+
+ SwImplShellAction aTmpSh( rDoc );
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_PARA :
+ {
+ ASSERT(pColl, "Collection fehlt!");
+ if( pColl )
+ {
+ SwTxtFmtColl* pFollow = pColl;
+ if( rStr.Len() && 0 == (pFollow = lcl_FindParaFmt(rDoc, rStr) ))
+ pFollow = pColl;
+
+ pColl->SetNextTxtFmtColl(*pFollow);
+ }
+ break;
+ }
+ case SFX_STYLE_FAMILY_PAGE :
+ {
+ ASSERT(pDesc, "PageDesc fehlt!");
+ if( pDesc )
+ {
+ const SwPageDesc* pFollowDesc = rStr.Len()
+ ? lcl_FindPageDesc(rDoc, rStr)
+ : 0;
+ USHORT nId;
+ if( pFollowDesc != pDesc->GetFollow() &&
+ rDoc.FindPageDescByName( pDesc->GetName(), &nId ) )
+ {
+ SwPageDesc aDesc( *pDesc );
+ aDesc.SetFollow( pFollowDesc );
+ rDoc.ChgPageDesc( nId, aDesc );
+ pDesc = &const_cast<const SwDoc &>(rDoc).GetPageDesc( nId );
+ }
+ }
+ break;
+ }
+ case SFX_STYLE_FAMILY_CHAR:
+ case SFX_STYLE_FAMILY_FRAME:
+ case SFX_STYLE_FAMILY_PSEUDO:
+ break;
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: ueber Name und Family, Mask den ItemSet rausholen
+ --------------------------------------------------------------------*/
+
+SfxItemSet& SwDocStyleSheet::GetItemSet()
+{
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ ASSERT(pCharFmt, "Wo ist das SwCharFmt");
+ aCoreSet.Put(pCharFmt->GetAttrSet());
+ if(pCharFmt->DerivedFrom())
+ aCoreSet.SetParent(&pCharFmt->DerivedFrom()->GetAttrSet());
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA :
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+ aBoxInfo.SetTable( FALSE );
+ aBoxInfo.SetDist( TRUE); // Abstandsfeld immer anzeigen
+ aBoxInfo.SetMinDist( TRUE );// Minimalgroesse in Tabellen und Absaetzen setzen
+ aBoxInfo.SetDefDist( MIN_BORDER_DIST );// Default-Abstand immer setzen
+ // Einzelne Linien koennen nur in Tabellen DontCare-Status haben
+ aBoxInfo.SetValid( VALID_DISABLE, TRUE );
+ if ( nFamily == SFX_STYLE_FAMILY_PARA )
+ {
+ ASSERT(pColl, "Wo ist die Collektion");
+ aCoreSet.Put(pColl->GetAttrSet());
+ aCoreSet.Put( aBoxInfo );
+ aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, pColl->IsAutoUpdateFmt()));
+ if(pColl->DerivedFrom())
+ aCoreSet.SetParent(&pColl->DerivedFrom()->GetAttrSet());
+ }
+ else
+ {
+ ASSERT(pFrmFmt, "Wo ist das FrmFmt");
+ aCoreSet.Put(pFrmFmt->GetAttrSet());
+ aCoreSet.Put( aBoxInfo );
+ aCoreSet.Put(SfxBoolItem(SID_ATTR_AUTO_STYLE_UPDATE, pFrmFmt->IsAutoUpdateFmt()));
+ if(pFrmFmt->DerivedFrom())
+ aCoreSet.SetParent(&pFrmFmt->DerivedFrom()->GetAttrSet());
+ }
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE :
+ {
+ ASSERT(pDesc, "Kein PageDescriptor");
+ ::PageDescToItemSet(*((SwPageDesc*)pDesc), aCoreSet);
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ ASSERT(pNumRule, "Keine NumRule");
+ SvxNumRule aRule = pNumRule->MakeSvxNumRule();
+ aCoreSet.Put(SvxNumBulletItem(aRule));
+ }
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+ // Member der Basisklasse
+ pSet = &aCoreSet;
+
+ return aCoreSet;
+}
+
+// --> OD 2008-02-13 #newlistlevelattrs#
+void SwDocStyleSheet::MergeIndentAttrsOfListStyle( SfxItemSet& rSet )
+{
+ if ( nFamily != SFX_STYLE_FAMILY_PARA )
+ {
+ return;
+ }
+
+ ASSERT( pColl, "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - missing paragraph style");
+ if ( pColl->AreListLevelIndentsApplicable() )
+ {
+ ASSERT( pColl->GetItemState( RES_PARATR_NUMRULE ) == SFX_ITEM_SET,
+ "<SwDocStyleSheet::MergeIndentAttrsOfListStyle(..)> - list level indents are applicable at paragraph style, but no list style found. Serious defect -> please inform OD." );
+ const String sNumRule = pColl->GetNumRule().GetValue();
+ if( sNumRule.Len() )
+ {
+ const SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
+ if( pRule )
+ {
+ const SwNumFmt& rFmt = pRule->Get( 0 );
+ if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ aLR.SetTxtLeft( rFmt.GetIndentAt() );
+ aLR.SetTxtFirstLineOfst( static_cast<short>(rFmt.GetFirstLineIndent()) );
+ rSet.Put( aLR );
+ }
+ }
+ }
+ }
+}
+// <--
+
+/*--------------------------------------------------------------------
+ Beschreibung: ItemSet setzen
+ --------------------------------------------------------------------*/
+
+// --> OD 2008-02-12 #newlistlevelattrs#
+// handling of parameter <bResetIndentAttrsAtParagraphStyle>
+void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet,
+ const bool bResetIndentAttrsAtParagraphStyle )
+{
+ // gegebenenfalls Format erst ermitteln
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+
+ SwImplShellAction aTmpSh( rDoc );
+
+ ASSERT( &rSet != &aCoreSet, "SetItemSet mit eigenem Set ist nicht erlaubt" );
+
+ // --> OD 2008-02-12 #newlistlevelattrs#
+ if (rDoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwRewriter aRewriter;
+ aRewriter.AddRule( UNDO_ARG1, GetName() );
+ rDoc.GetIDocumentUndoRedo().StartUndo( UNDO_INSFMTATTR, &aRewriter );
+ }
+ // <--
+
+ SwFmt* pFmt = 0;
+ SwPageDesc* pNewDsc = 0;
+ USHORT nPgDscPos = 0;
+
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ {
+ ASSERT(pCharFmt, "Wo ist das CharFormat");
+ pFmt = pCharFmt;
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PARA :
+ {
+ ASSERT(pColl, "Wo ist die Collection");
+ const SfxPoolItem* pAutoUpdate;
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,FALSE, &pAutoUpdate ))
+ {
+ pColl->SetAutoUpdateFmt(((const SfxBoolItem*)pAutoUpdate)->GetValue());
+ }
+
+ const SwCondCollItem* pCondItem;
+ if( SFX_ITEM_SET != rSet.GetItemState( FN_COND_COLL, FALSE,
+ (const SfxPoolItem**)&pCondItem ))
+ pCondItem = 0;
+
+ if( RES_CONDTXTFMTCOLL == pColl->Which() && pCondItem )
+ {
+ SwFmt* pFindFmt;
+ const CommandStruct* pCmds = SwCondCollItem::GetCmds();
+ for(USHORT i = 0; i < COND_COMMAND_COUNT; i++)
+ {
+ SwCollCondition aCond( 0, pCmds[ i ].nCnd, pCmds[ i ].nSubCond );
+ ((SwConditionTxtFmtColl*)pColl)->RemoveCondition( aCond );
+ const String& rStyle = pCondItem->GetStyle( i );
+ if( rStyle.Len() &&
+ 0 != ( pFindFmt = lcl_FindParaFmt( rDoc, rStyle, 0, TRUE )))
+ {
+ pFindFmt->Add( &aCond );
+ ((SwConditionTxtFmtColl*)pColl)->InsertCondition( aCond );
+ }
+ }
+
+ // Document auf die neue Bedingungen updaten
+ SwCondCollCondChg aMsg( pColl );
+ pColl->Modify( &aMsg, &aMsg );
+ }
+ else if( pCondItem && !pColl->GetDepends() )
+ {
+ // keine bedingte Vorlage, dann erstmal erzeugen und
+ // alle wichtigen Werte uebernehmen
+ SwConditionTxtFmtColl* pCColl = rDoc.MakeCondTxtFmtColl(
+ pColl->GetName(), (SwTxtFmtColl*)pColl->DerivedFrom() );
+ if( pColl != &pColl->GetNextTxtFmtColl() )
+ pCColl->SetNextTxtFmtColl( pColl->GetNextTxtFmtColl() );
+
+ //pCColl->SetOutlineLevel( pColl->GetOutlineLevel() );//#outline level,zhaojianwei
+ if( pColl->IsAssignedToListLevelOfOutlineStyle())
+ pCColl->AssignToListLevelOfOutlineStyle(pColl->GetAssignedOutlineStyleLevel());
+ else
+ pCColl->DeleteAssignmentToListLevelOfOutlineStyle();//<--end,zhaojianwei
+
+
+
+ SwTxtFmtColl* pFindFmt;
+ const CommandStruct* pCmds = SwCondCollItem::GetCmds();
+ for( USHORT i = 0; i < COND_COMMAND_COUNT; ++i )
+ {
+ const String& rStyle = pCondItem->GetStyle( i );
+ if( rStyle.Len() &&
+ 0 != ( pFindFmt = lcl_FindParaFmt( rDoc, rStyle, 0, TRUE )))
+ {
+ pCColl->InsertCondition( SwCollCondition( pFindFmt,
+ pCmds[ i ].nCnd, pCmds[ i ].nSubCond ) );
+ }
+ }
+
+ rDoc.DelTxtFmtColl( pColl );
+ pColl = pCColl;
+ }
+ // --> OD 2008-02-12 #newlistlevelattrs#
+ if ( bResetIndentAttrsAtParagraphStyle &&
+ rSet.GetItemState( RES_PARATR_NUMRULE, FALSE, 0 ) == SFX_ITEM_SET &&
+ rSet.GetItemState( RES_LR_SPACE, FALSE, 0 ) != SFX_ITEM_SET &&
+ pColl->GetItemState( RES_LR_SPACE, FALSE, 0 ) == SFX_ITEM_SET )
+ {
+ rDoc.ResetAttrAtFormat( RES_LR_SPACE, *pColl );
+ }
+ // <--
+
+ // #i56252: If a standard numbering style is assigned to a standard paragraph style
+ // we have to create a physical instance of the numbering style. If we do not and
+ // neither the paragraph style nor the numbering style is used in the document
+ // the numbering style will not be saved with the document and the assignment got lost.
+ const SfxPoolItem* pNumRuleItem = 0;
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_PARATR_NUMRULE, FALSE, &pNumRuleItem ) )
+ { // Setting a numbering rule?
+ String sNumRule = ((SwNumRuleItem*)pNumRuleItem)->GetValue();
+ if( sNumRule.Len() )
+ {
+ SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
+ if( !pRule )
+ { // Numbering rule not in use yet.
+ USHORT nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sNumRule, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE );
+ if( USHRT_MAX != nPoolId ) // It's a standard numbering rule
+ {
+ pRule = rDoc.GetNumRuleFromPool( nPoolId ); // Create numbering rule (physical)
+ }
+ }
+ }
+ }
+
+ pFmt = pColl;
+
+ USHORT nId = pColl->GetPoolFmtId() &
+ ~ ( COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID );
+ switch( GetMask() & ( 0x0fff & ~SWSTYLEBIT_CONDCOLL ) )
+ {
+ case SWSTYLEBIT_TEXT:
+ nId |= COLL_TEXT_BITS;
+ break;
+ case SWSTYLEBIT_CHAPTER:
+ nId |= COLL_DOC_BITS;
+ break;
+ case SWSTYLEBIT_LIST:
+ nId |= COLL_LISTS_BITS;
+ break;
+ case SWSTYLEBIT_IDX:
+ nId |= COLL_REGISTER_BITS;
+ break;
+ case SWSTYLEBIT_EXTRA:
+ nId |= COLL_EXTRA_BITS;
+ break;
+ case SWSTYLEBIT_HTML:
+ nId |= COLL_HTML_BITS;
+ break;
+ }
+ pColl->SetPoolFmtId( nId );
+ break;
+ }
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ ASSERT(pFrmFmt, "Wo ist das FrmFmt");
+ const SfxPoolItem* pAutoUpdate;
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_AUTO_STYLE_UPDATE,FALSE, &pAutoUpdate ))
+ {
+ pFrmFmt->SetAutoUpdateFmt(((const SfxBoolItem*)pAutoUpdate)->GetValue());
+ }
+ pFmt = pFrmFmt;
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE :
+ {
+ ASSERT(pDesc, "Wo ist der PageDescriptor");
+
+ if( rDoc.FindPageDescByName( pDesc->GetName(), &nPgDscPos ))
+ {
+ pNewDsc = new SwPageDesc( *pDesc );
+ // --> OD 2005-05-09 #i48949# - no undo actions for the
+ // copy of the page style
+ ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo());
+ rDoc.CopyPageDesc(*pDesc, *pNewDsc); // #i7983#
+ // <--
+
+ pFmt = &pNewDsc->GetMaster();
+ }
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ ASSERT(pNumRule, "Wo ist die NumRule");
+
+ if (!pNumRule)
+ break;
+
+ const SfxPoolItem* pItem;
+ switch( rSet.GetItemState( SID_ATTR_NUMBERING_RULE, FALSE, &pItem ))
+ {
+ case SFX_ITEM_SET:
+ {
+ SvxNumRule* pSetRule = ((SvxNumBulletItem*)pItem)->GetNumRule();
+ pSetRule->UnLinkGraphics();
+ //SwNumRule aSetRule(rDoc.GetUniqueNumRuleName());
+ SwNumRule aSetRule(*pNumRule);
+ aSetRule.SetSvxRule(*pSetRule, &rDoc);
+ rDoc.ChgNumRuleFmts( aSetRule );
+ }
+ break;
+ case SFX_ITEM_DONTCARE:
+ // NumRule auf default Werte
+ // was sind die default Werte?
+ {
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ SwNumRule aRule( pNumRule->GetName(),
+ // --> OD 2008-06-06 #i89178#
+ numfunc::GetDefaultPositionAndSpaceMode() );
+ // <--
+ // <--
+ rDoc.ChgNumRuleFmts( aRule );
+ }
+ break;
+ }
+ }
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+
+ if( pFmt && rSet.Count())
+ {
+ SfxItemIter aIter( rSet );
+ const SfxPoolItem* pItem = aIter.GetCurItem();
+ while( TRUE )
+ {
+ if( IsInvalidItem( pItem ) ) // Clearen
+ {
+ // --> OD 2008-02-12 #newlistlevelattrs#
+ // use method <SwDoc::ResetAttrAtFormat(..)> in order to
+ // create an Undo object for the attribute reset.
+// pFmt->ResetAttr( rSet.GetWhichByPos(aIter.GetCurPos()));
+ rDoc.ResetAttrAtFormat( rSet.GetWhichByPos(aIter.GetCurPos()),
+ *pFmt );
+ }
+
+ if( aIter.IsAtEnd() )
+ break;
+ pItem = aIter.NextItem();
+ }
+ SfxItemSet aSet(rSet);
+ aSet.ClearInvalidItems();
+
+ aCoreSet.ClearItem();
+
+ if( pNewDsc )
+ {
+ ::ItemSetToPageDesc( aSet, *pNewDsc );
+ rDoc.ChgPageDesc( nPgDscPos, *pNewDsc );
+ pDesc = &const_cast<const SwDoc &>(rDoc).GetPageDesc( nPgDscPos );
+ rDoc.PreDelPageDesc(pNewDsc); // #i7983#
+ delete pNewDsc;
+ }
+ else
+ rDoc.ChgFmt(*pFmt, aSet); // alles gesetzten Putten
+ }
+ else
+ {
+ aCoreSet.ClearItem();
+ if( pNewDsc ) // den muessen wir noch vernichten!!
+ {
+ rDoc.PreDelPageDesc(pNewDsc); // #i7983#
+ delete pNewDsc;
+ }
+ }
+
+ // --> OD 2008-02-12 #newlistlevelattrs#
+ if (rDoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ rDoc.GetIDocumentUndoRedo().EndUndo(UNDO_END, 0);
+ }
+ // <--
+}
+
+void lcl_SaveStyles( USHORT nFamily, SvPtrarr& rArr, SwDoc& rDoc )
+{
+ switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ const SwCharFmts& rTbl = *rDoc.GetCharFmts();
+ for( sal_uInt16 n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ rArr.Insert( p, n );
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ const SwTxtFmtColls& rTbl = *rDoc.GetTxtFmtColls();
+ for( sal_uInt16 n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ rArr.Insert( p, n );
+ }
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ const SwFrmFmts& rTbl = *rDoc.GetFrmFmts();
+ for( sal_uInt16 n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ rArr.Insert( p, n );
+ }
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ for( sal_uInt16 n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
+ {
+ void* p =
+ (void*)&const_cast<const SwDoc &>(rDoc).GetPageDesc( n );
+ rArr.Insert( p, n );
+ }
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ const SwNumRuleTbl& rTbl = rDoc.GetNumRuleTbl();
+ for( sal_uInt16 n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ rArr.Insert( p, n );
+ }
+ }
+ break;
+ }
+}
+
+void lcl_DeleteInfoStyles( USHORT nFamily, SvPtrarr& rArr, SwDoc& rDoc )
+{
+ sal_uInt16 n, nCnt;
+ switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ SvUShorts aDelArr;
+ const SwCharFmts& rTbl = *rDoc.GetCharFmts();
+ for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ if( USHRT_MAX == rArr.GetPos( p ))
+ aDelArr.Insert( n, 0 );
+ }
+ for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
+ rDoc.DelCharFmt( aDelArr[ n ] );
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PARA :
+ {
+ SvUShorts aDelArr;
+ const SwTxtFmtColls& rTbl = *rDoc.GetTxtFmtColls();
+ for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ if( USHRT_MAX == rArr.GetPos( p ))
+ aDelArr.Insert( n, 0 );
+ }
+ for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
+ rDoc.DelTxtFmtColl( aDelArr[ n ] );
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ SvPtrarr aDelArr;
+ const SwFrmFmts& rTbl = *rDoc.GetFrmFmts();
+ for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ if( USHRT_MAX == rArr.GetPos( p ))
+ aDelArr.Insert( p, 0 );
+ }
+ for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
+ rDoc.DelFrmFmt( (SwFrmFmt*)aDelArr[ n ] );
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ SvUShorts aDelArr;
+ for( n = 0, nCnt = rDoc.GetPageDescCnt(); n < nCnt; ++n )
+ {
+ void* p =
+ (void*)&const_cast<const SwDoc &>(rDoc).GetPageDesc( n );
+ if( USHRT_MAX == rArr.GetPos( p ))
+ aDelArr.Insert( n, 0 );
+ }
+ for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
+ rDoc.DelPageDesc( aDelArr[ n ] );
+ }
+ break;
+
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ SvPtrarr aDelArr;
+ const SwNumRuleTbl& rTbl = rDoc.GetNumRuleTbl();
+ for( n = 0, nCnt = rTbl.Count(); n < nCnt; ++n )
+ {
+ void* p = (void*)rTbl[ n ];
+ if( USHRT_MAX == rArr.GetPos( p ))
+ aDelArr.Insert( p, 0 );
+ }
+ for( n = 0, nCnt = aDelArr.Count(); n < nCnt; ++n )
+ rDoc.DelNumRule( ((SwNumRule*)aDelArr[ n ])->GetName() );
+ }
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Das Format ermitteln
+ --------------------------------------------------------------------*/
+
+BOOL SwDocStyleSheet::FillStyleSheet( FillStyleType eFType )
+{
+ BOOL bRet = FALSE;
+ USHORT nPoolId = USHRT_MAX;
+ SwFmt* pFmt = 0;
+
+ BOOL bCreate = FillPhysical == eFType;
+ BOOL bDeleteInfo = FALSE;
+ BOOL bFillOnlyInfo = FillAllInfo == eFType;
+ SvPtrarr aDelArr;
+
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ pCharFmt = lcl_FindCharFmt(rDoc, aName, this, bCreate );
+ bPhysical = 0 != pCharFmt;
+ if( bFillOnlyInfo && !bPhysical )
+ {
+ bDeleteInfo = TRUE;
+ ::lcl_SaveStyles( static_cast< USHORT >(nFamily), aDelArr, rDoc );
+ pCharFmt = lcl_FindCharFmt(rDoc, aName, this, TRUE );
+ }
+
+ pFmt = pCharFmt;
+ if( !bCreate && !pFmt )
+ {
+ if( aName == *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
+ RES_POOLCOLL_TEXT_BEGIN ] )
+ nPoolId = 0;
+ else
+ nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+ }
+
+ bRet = 0 != pCharFmt || USHRT_MAX != nPoolId;
+
+ if( bDeleteInfo )
+ pCharFmt = 0;
+ break;
+
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ pColl = lcl_FindParaFmt(rDoc, aName, this, bCreate);
+ bPhysical = 0 != pColl;
+ if( bFillOnlyInfo && !bPhysical )
+ {
+ bDeleteInfo = TRUE;
+ ::lcl_SaveStyles( static_cast< USHORT >(nFamily), aDelArr, rDoc );
+ pColl = lcl_FindParaFmt(rDoc, aName, this, TRUE );
+ }
+
+ pFmt = pColl;
+ if( pColl )
+ PresetFollow( pColl->GetNextTxtFmtColl().GetName() );
+ else if( !bCreate )
+ nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+
+ bRet = 0 != pColl || USHRT_MAX != nPoolId;
+
+ if( bDeleteInfo )
+ pColl = 0;
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ pFrmFmt = lcl_FindFrmFmt(rDoc, aName, this, bCreate);
+ bPhysical = 0 != pFrmFmt;
+ if( bFillOnlyInfo && bPhysical )
+ {
+ bDeleteInfo = TRUE;
+ ::lcl_SaveStyles( static_cast< USHORT >(nFamily), aDelArr, rDoc );
+ pFrmFmt = lcl_FindFrmFmt(rDoc, aName, this, TRUE );
+ }
+ pFmt = pFrmFmt;
+ if( !bCreate && !pFmt )
+ nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT );
+
+ bRet = 0 != pFrmFmt || USHRT_MAX != nPoolId;
+
+ if( bDeleteInfo )
+ pFrmFmt = 0;
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ pDesc = lcl_FindPageDesc(rDoc, aName, this, bCreate);
+ bPhysical = 0 != pDesc;
+ if( bFillOnlyInfo && !pDesc )
+ {
+ bDeleteInfo = TRUE;
+ ::lcl_SaveStyles( static_cast< USHORT >(nFamily), aDelArr, rDoc );
+ pDesc = lcl_FindPageDesc( rDoc, aName, this, TRUE );
+ }
+
+ if( pDesc )
+ {
+ nPoolId = pDesc->GetPoolFmtId();
+ nHelpId = pDesc->GetPoolHelpId();
+ if( pDesc->GetPoolHlpFileId() != UCHAR_MAX )
+ aHelpFile = *rDoc.GetDocPattern( pDesc->GetPoolHlpFileId() );
+ else
+ aHelpFile.Erase();
+ }
+ else if( !bCreate )
+ nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC );
+ SetMask( USER_FMT & nPoolId ? SFXSTYLEBIT_USERDEF : 0 );
+
+ bRet = 0 != pDesc || USHRT_MAX != nPoolId;
+ if( bDeleteInfo )
+ pDesc = 0;
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ pNumRule = lcl_FindNumRule(rDoc, aName, this, bCreate);
+ bPhysical = 0 != pNumRule;
+ if( bFillOnlyInfo && !pNumRule )
+ {
+ bDeleteInfo = TRUE;
+ ::lcl_SaveStyles( static_cast< USHORT >(nFamily), aDelArr, rDoc );
+ pNumRule = lcl_FindNumRule( rDoc, aName, this, TRUE );
+ }
+
+ if( pNumRule )
+ {
+ nPoolId = pNumRule->GetPoolFmtId();
+ nHelpId = pNumRule->GetPoolHelpId();
+ if( pNumRule->GetPoolHlpFileId() != UCHAR_MAX )
+ aHelpFile = *rDoc.GetDocPattern( pNumRule->GetPoolHlpFileId() );
+ else
+ aHelpFile.Erase();
+ }
+ else if( !bCreate )
+ nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE );
+ SetMask( USER_FMT & nPoolId ? SFXSTYLEBIT_USERDEF : 0 );
+
+ bRet = 0 != pNumRule || USHRT_MAX != nPoolId;
+
+ if( bDeleteInfo )
+ pNumRule = 0;
+ break;
+ default:; //prevent warning
+ }
+
+ if( SFX_STYLE_FAMILY_CHAR == nFamily ||
+ SFX_STYLE_FAMILY_PARA == nFamily ||
+ SFX_STYLE_FAMILY_FRAME == nFamily )
+ {
+ if( pFmt )
+ nPoolId = pFmt->GetPoolFmtId();
+
+ USHORT _nMask = 0;
+ if( pFmt == rDoc.GetDfltCharFmt() )
+ _nMask |= SFXSTYLEBIT_READONLY;
+ else if( USER_FMT & nPoolId )
+ _nMask |= SFXSTYLEBIT_USERDEF;
+
+ switch ( COLL_GET_RANGE_BITS & nPoolId )
+ {
+ case COLL_TEXT_BITS: _nMask |= SWSTYLEBIT_TEXT; break;
+ case COLL_DOC_BITS : _nMask |= SWSTYLEBIT_CHAPTER; break;
+ case COLL_LISTS_BITS: _nMask |= SWSTYLEBIT_LIST; break;
+ case COLL_REGISTER_BITS: _nMask |= SWSTYLEBIT_IDX; break;
+ case COLL_EXTRA_BITS: _nMask |= SWSTYLEBIT_EXTRA; break;
+ case COLL_HTML_BITS: _nMask |= SWSTYLEBIT_HTML; break;
+ }
+
+ if( pFmt )
+ {
+ ASSERT( bPhysical, "Format nicht gefunden" );
+
+ nHelpId = pFmt->GetPoolHelpId();
+ if( pFmt->GetPoolHlpFileId() != UCHAR_MAX )
+ aHelpFile = *rDoc.GetDocPattern( pFmt->GetPoolHlpFileId() );
+ else
+ aHelpFile.Erase();
+
+ if( RES_CONDTXTFMTCOLL == pFmt->Which() )
+ _nMask |= SWSTYLEBIT_CONDCOLL;
+ }
+
+ SetMask( _nMask );
+ }
+ if( bDeleteInfo && bFillOnlyInfo )
+ ::lcl_DeleteInfoStyles( static_cast< USHORT >(nFamily), aDelArr, rDoc );
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Neues Format in der Core anlegen
+ --------------------------------------------------------------------*/
+
+
+void SwDocStyleSheet::Create()
+{
+ switch(nFamily)
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ pCharFmt = lcl_FindCharFmt( rDoc, aName );
+ if( !pCharFmt )
+ pCharFmt = rDoc.MakeCharFmt(aName,
+ rDoc.GetDfltCharFmt());
+ pCharFmt->SetAuto( FALSE );
+ break;
+
+ case SFX_STYLE_FAMILY_PARA :
+ pColl = lcl_FindParaFmt( rDoc, aName );
+ if( !pColl )
+ {
+ SwTxtFmtColl *pPar = (*rDoc.GetTxtFmtColls())[0];
+ if( nMask & SWSTYLEBIT_CONDCOLL )
+ pColl = rDoc.MakeCondTxtFmtColl( aName, pPar );
+ else
+ pColl = rDoc.MakeTxtFmtColl( aName, pPar );
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ pFrmFmt = lcl_FindFrmFmt( rDoc, aName );
+ if( !pFrmFmt )
+ pFrmFmt = rDoc.MakeFrmFmt(aName, rDoc.GetDfltFrmFmt(), FALSE, FALSE);
+
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE :
+ pDesc = lcl_FindPageDesc( rDoc, aName );
+ if( !pDesc )
+ {
+ USHORT nId = rDoc.MakePageDesc(aName);
+ pDesc = &const_cast<const SwDoc &>(rDoc).GetPageDesc(nId);
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ pNumRule = lcl_FindNumRule( rDoc, aName );
+ if( !pNumRule )
+ {
+ //JP 05.02.99: temp Namen erzeugen, damit kein ASSERT kommt
+ String sTmpNm( aName );
+ if( !aName.Len() )
+ sTmpNm = rDoc.GetUniqueNumRuleName();
+
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ SwNumRule* pRule = rDoc.GetNumRuleTbl()[
+ rDoc.MakeNumRule( sTmpNm, 0, FALSE,
+ // --> OD 2008-06-06 #i89178#
+ numfunc::GetDefaultPositionAndSpaceMode() ) ];
+ // <--
+ // <--
+ pRule->SetAutoRule( FALSE );
+ if( !aName.Len() )
+ {
+ // --> OD 2008-07-08 #i91400#
+ pRule->SetName( aName, rDoc );
+ // <--
+ }
+ pNumRule = pRule;
+ }
+ break;
+ default:; //prevent warning
+ }
+ bPhysical = TRUE;
+ aCoreSet.ClearItem();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Konkrete Formate rausholen
+ --------------------------------------------------------------------*/
+
+
+
+SwCharFmt* SwDocStyleSheet::GetCharFmt()
+{
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+ return pCharFmt;
+}
+
+
+SwTxtFmtColl* SwDocStyleSheet::GetCollection()
+{
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+ return pColl;
+}
+
+
+const SwPageDesc* SwDocStyleSheet::GetPageDesc()
+{
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+ return pDesc;
+}
+
+const SwNumRule * SwDocStyleSheet::GetNumRule()
+{
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+ return pNumRule;
+}
+
+void SwDocStyleSheet::SetNumRule(const SwNumRule& rRule)
+{
+ DBG_ASSERT(pNumRule, "Wo ist die NumRule");
+ rDoc.ChgNumRuleFmts( rRule );
+}
+
+// Namen UND Familie aus String re-generieren
+// First() und Next() (s.u.) fuegen einen Kennbuchstaben an Pos.1 ein
+
+void SwDocStyleSheet::PresetNameAndFamily(const String& rName)
+{
+ switch( rName.GetChar(0) )
+ {
+ case cPARA: nFamily = SFX_STYLE_FAMILY_PARA; break;
+ case cFRAME: nFamily = SFX_STYLE_FAMILY_FRAME; break;
+ case cPAGE: nFamily = SFX_STYLE_FAMILY_PAGE; break;
+ case cNUMRULE: nFamily = SFX_STYLE_FAMILY_PSEUDO; break;
+ default: nFamily = SFX_STYLE_FAMILY_CHAR; break;
+ }
+ aName = rName;
+ aName.Erase( 0, 1 );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ist das Format physikalisch schon vorhanden
+ --------------------------------------------------------------------*/
+
+
+void SwDocStyleSheet::SetPhysical(BOOL bPhys)
+{
+ bPhysical = bPhys;
+
+ if(!bPhys)
+ {
+ pCharFmt = 0;
+ pColl = 0;
+ pFrmFmt = 0;
+ pDesc = 0;
+ }
+}
+
+SwFrmFmt* SwDocStyleSheet::GetFrmFmt()
+{
+ if(!bPhysical)
+ FillStyleSheet( FillPhysical );
+ return pFrmFmt;
+}
+
+
+BOOL SwDocStyleSheet::IsUsed() const
+{
+ if( !bPhysical )
+ {
+ SwDocStyleSheet* pThis = (SwDocStyleSheet*)this;
+ pThis->FillStyleSheet( FillOnlyName );
+ }
+
+ // immer noch nicht ?
+ if( !bPhysical )
+ return FALSE;
+
+ const SwModify* pMod;
+ switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR : pMod = pCharFmt; break;
+ case SFX_STYLE_FAMILY_PARA : pMod = pColl; break;
+ case SFX_STYLE_FAMILY_FRAME: pMod = pFrmFmt; break;
+ case SFX_STYLE_FAMILY_PAGE : pMod = pDesc; break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ return pNumRule ? rDoc.IsUsed( *pNumRule ) : FALSE;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ return FALSE;
+ }
+ return rDoc.IsUsed( *pMod );
+}
+
+
+ULONG SwDocStyleSheet::GetHelpId( String& rFile )
+{
+static String sTemplateHelpFile = String::CreateFromAscii("swrhlppi.hlp");
+
+ USHORT nId = 0;
+ USHORT nPoolId = 0;
+ unsigned char nFileId = UCHAR_MAX;
+
+ rFile = sTemplateHelpFile;
+
+ const SwFmt* pTmpFmt = 0;
+ switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ if( !pCharFmt &&
+ 0 == (pCharFmt = lcl_FindCharFmt( rDoc, aName, 0, FALSE )) )
+ {
+ nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+ return USHRT_MAX == nId ? 0 : nId;
+ }
+ pTmpFmt = pCharFmt;
+ break;
+
+ case SFX_STYLE_FAMILY_PARA:
+ if( !pColl &&
+ 0 == ( pColl = lcl_FindParaFmt( rDoc, aName, 0, FALSE )) )
+ {
+ nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ return USHRT_MAX == nId ? 0 : nId;
+ }
+ pTmpFmt = pColl;
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ if( !pFrmFmt &&
+ 0 == ( pFrmFmt = lcl_FindFrmFmt( rDoc, aName, 0, FALSE ) ) )
+ {
+ nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT );
+ return USHRT_MAX == nId ? 0 : nId;
+ }
+ pTmpFmt = pFrmFmt;
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ if( !pDesc &&
+ 0 == ( pDesc = lcl_FindPageDesc( rDoc, aName, 0, FALSE ) ) )
+ {
+ nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC );
+ return USHRT_MAX == nId ? 0 : nId;
+ }
+
+ nId = pDesc->GetPoolHelpId();
+ nFileId = pDesc->GetPoolHlpFileId();
+ nPoolId = pDesc->GetPoolFmtId();
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ if( !pNumRule &&
+ 0 == ( pNumRule = lcl_FindNumRule( rDoc, aName, 0, FALSE ) ) )
+ {
+ nId = SwStyleNameMapper::GetPoolIdFromUIName( aName, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE );
+ return USHRT_MAX == nId ? 0 : nId;
+ }
+
+ nId = pNumRule->GetPoolHelpId();
+ nFileId = pNumRule->GetPoolHlpFileId();
+ nPoolId = pNumRule->GetPoolFmtId();
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ return 0;
+ }
+
+ if( pTmpFmt )
+ {
+ nId = pTmpFmt->GetPoolHelpId();
+ nFileId = pTmpFmt->GetPoolHlpFileId();
+ nPoolId = pTmpFmt->GetPoolFmtId();
+ }
+
+ if( UCHAR_MAX != nFileId )
+ {
+ const String *pTemplate = rDoc.GetDocPattern( nFileId );
+ if( pTemplate )
+ {
+// const String aHelpPath(MakeHelpPath(*pTemplate));
+ rFile = *pTemplate;
+ }
+ }
+ else if( !IsPoolUserFmt( nPoolId ) )
+ {
+ nId = nPoolId;
+ }
+
+ // weil sich der SFX so anstellt mit der HilfeId:
+ if( USHRT_MAX == nId )
+ nId = 0; // entsp. keine Hilfe anzeigen
+
+ return nId;
+}
+
+
+void SwDocStyleSheet::SetHelpId( const String& r, ULONG nId )
+{
+ BYTE nFileId = static_cast< BYTE >(rDoc.SetDocPattern( r ));
+ USHORT nHId = static_cast< USHORT >(nId); //!! SFX hat eigenmaechtig auf ULONG umgestellt!
+
+ SwFmt* pTmpFmt = 0;
+ switch( nFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR : pTmpFmt = pCharFmt; break;
+ case SFX_STYLE_FAMILY_PARA : pTmpFmt = pColl; break;
+ case SFX_STYLE_FAMILY_FRAME: pTmpFmt = pFrmFmt; break;
+ case SFX_STYLE_FAMILY_PAGE :
+ ((SwPageDesc*)pDesc)->SetPoolHelpId( nHId );
+ ((SwPageDesc*)pDesc)->SetPoolHlpFileId( nFileId );
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ ((SwNumRule*)pNumRule)->SetPoolHelpId( nHId );
+ ((SwNumRule*)pNumRule)->SetPoolHlpFileId( nFileId );
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ return ;
+ }
+ if( pTmpFmt )
+ {
+ pTmpFmt->SetPoolHelpId( nHId );
+ pTmpFmt->SetPoolHlpFileId( nFileId );
+ }
+}
+
+
+/* */
+
+/*--------------------------------------------------------------------
+ Beschreibung: Methoden fuer den DocStyleSheetPool
+ --------------------------------------------------------------------*/
+
+SwDocStyleSheetPool::SwDocStyleSheetPool( SwDoc& rDocument, BOOL bOrg )
+: SfxStyleSheetBasePool( rDocument.GetAttrPool() )
+, mxStyleSheet( new SwDocStyleSheet( rDocument, aEmptyStr, *this, SFX_STYLE_FAMILY_CHAR, 0 ) )
+, rDoc( rDocument )
+{
+ bOrganizer = bOrg;
+}
+
+ SwDocStyleSheetPool::~SwDocStyleSheetPool()
+{
+}
+
+void SAL_CALL SwDocStyleSheetPool::acquire( ) throw ()
+{
+ comphelper::OWeakTypeObject::acquire();
+}
+
+void SAL_CALL SwDocStyleSheetPool::release( ) throw ()
+{
+ comphelper::OWeakTypeObject::release();
+}
+
+SfxStyleSheetBase& SwDocStyleSheetPool::Make(
+ const String& rName,
+ SfxStyleFamily eFam,
+ USHORT _nMask,
+ USHORT /*nPos*/ )
+{
+ mxStyleSheet->PresetName(rName);
+ mxStyleSheet->PresetParent(aEmptyStr);
+ mxStyleSheet->PresetFollow(aEmptyStr);
+ mxStyleSheet->SetMask(_nMask) ;
+ mxStyleSheet->SetFamily(eFam);
+ mxStyleSheet->SetPhysical(TRUE);
+ mxStyleSheet->Create();
+
+ return *mxStyleSheet.get();
+}
+
+
+SfxStyleSheetBase* SwDocStyleSheetPool::Create( const SfxStyleSheetBase& /*rOrg*/)
+{
+ ASSERT(!this , "Create im SW-Stylesheet-Pool geht nicht" );
+ return NULL;
+}
+
+
+SfxStyleSheetBase* SwDocStyleSheetPool::Create( const String &,
+ SfxStyleFamily, USHORT )
+{
+ ASSERT( !this, "Create im SW-Stylesheet-Pool geht nicht" );
+ return NULL;
+}
+
+void SwDocStyleSheetPool::Replace( SfxStyleSheetBase& rSource,
+ SfxStyleSheetBase& rTarget )
+{
+ SfxStyleFamily eFamily( rSource.GetFamily() );
+ if( rSource.HasParentSupport())
+ {
+ const String& rParentName = rSource.GetParent();
+ if( 0 != rParentName.Len() )
+ {
+ SfxStyleSheetBase* pParentOfNew = Find( rParentName, eFamily );
+ if( pParentOfNew )
+ rTarget.SetParent( rParentName );
+ }
+ }
+ if( rSource.HasFollowSupport())
+ {
+ const String& rFollowName = rSource.GetFollow();
+ if( 0 != rFollowName.Len() )
+ {
+ SfxStyleSheetBase* pFollowOfNew = Find( rFollowName, eFamily );
+ if( pFollowOfNew )
+ rTarget.SetFollow( rFollowName );
+ }
+ }
+
+ SwImplShellAction aTmpSh( rDoc );
+
+ BOOL bSwSrcPool = GetAppName() == rSource.GetPool().GetAppName();
+ if( SFX_STYLE_FAMILY_PAGE == eFamily && bSwSrcPool )
+ {
+ // gesondert behandeln!!
+ SwPageDesc* pDestDsc =
+ (SwPageDesc*)((SwDocStyleSheet&)rTarget).GetPageDesc();
+ SwPageDesc* pCpyDsc =
+ (SwPageDesc*)((SwDocStyleSheet&)rSource).GetPageDesc();
+ rDoc.CopyPageDesc( *pCpyDsc, *pDestDsc );
+ }
+ else
+ {
+ const SwFmt *pSourceFmt = 0;
+ SwFmt *pTargetFmt = 0;
+ USHORT nPgDscPos = USHRT_MAX;
+ switch( eFamily )
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ if( bSwSrcPool )
+ pSourceFmt = ((SwDocStyleSheet&)rSource).GetCharFmt();
+ pTargetFmt = ((SwDocStyleSheet&)rTarget).GetCharFmt();
+ break;
+ case SFX_STYLE_FAMILY_PARA :
+ if( bSwSrcPool )
+ pSourceFmt = ((SwDocStyleSheet&)rSource).GetCollection();
+ pTargetFmt = ((SwDocStyleSheet&)rTarget).GetCollection();
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ if( bSwSrcPool )
+ pSourceFmt = ((SwDocStyleSheet&)rSource).GetFrmFmt();
+ pTargetFmt = ((SwDocStyleSheet&)rTarget).GetFrmFmt();
+ break;
+ case SFX_STYLE_FAMILY_PAGE:
+ if( bSwSrcPool )
+ pSourceFmt = &((SwDocStyleSheet&)rSource).GetPageDesc()
+ ->GetMaster();
+ {
+ SwPageDesc *pDesc = rDoc.FindPageDescByName(
+ ((SwDocStyleSheet&)rTarget).GetPageDesc()->GetName(),
+ &nPgDscPos );
+
+ if( pDesc )
+ pTargetFmt = &pDesc->GetMaster();
+ }
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ // Eine NumRule besteht nur aus einem Item, also muss man
+ // hier nichts loeschen.
+ break;
+ default:; //prevent warning
+ }
+ if( pTargetFmt )
+ {
+ if( pSourceFmt )
+ pTargetFmt->DelDiffs( *pSourceFmt );
+ else if( USHRT_MAX != nPgDscPos )
+ pTargetFmt->ResetFmtAttr( RES_PAGEDESC, RES_FRMATR_END-1 );
+ else
+ {
+ // --> OD 2007-01-25 #i73790# - method renamed
+ pTargetFmt->ResetAllFmtAttr();
+ // <--
+ }
+
+ if( USHRT_MAX != nPgDscPos )
+ rDoc.ChgPageDesc( nPgDscPos,
+ const_cast<const SwDoc &>(rDoc).
+ GetPageDesc(nPgDscPos) );
+ }
+ ((SwDocStyleSheet&)rTarget).SetItemSet( rSource.GetItemSet() );
+ }
+}
+
+SfxStyleSheetIterator* SwDocStyleSheetPool::CreateIterator(
+ SfxStyleFamily eFam, USHORT _nMask )
+{
+ return new SwStyleSheetIterator( this, eFam, _nMask );
+}
+
+void SwDocStyleSheetPool::dispose()
+{
+ mxStyleSheet.clear();
+}
+
+void SwDocStyleSheetPool::Remove( SfxStyleSheetBase* pStyle)
+{
+ if( !pStyle )
+ return;
+
+ BOOL bBroadcast = TRUE;
+ SwImplShellAction aTmpSh( rDoc );
+ const String& rName = pStyle->GetName();
+ switch( pStyle->GetFamily() )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ SwCharFmt* pFmt = lcl_FindCharFmt(rDoc, rName, 0, FALSE );
+ if(pFmt)
+ rDoc.DelCharFmt(pFmt);
+ }
+ break;
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ SwTxtFmtColl* pColl = lcl_FindParaFmt(rDoc, rName, 0, FALSE );
+ if(pColl)
+ rDoc.DelTxtFmtColl(pColl);
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ SwFrmFmt* pFmt = lcl_FindFrmFmt(rDoc, rName, 0, FALSE );
+ if(pFmt)
+ rDoc.DelFrmFmt(pFmt);
+ }
+ break;
+ case SFX_STYLE_FAMILY_PAGE :
+ {
+ USHORT nPos;
+ if( rDoc.FindPageDescByName( rName, &nPos ))
+ rDoc.DelPageDesc( nPos );
+ }
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ if( !rDoc.DelNumRule( rName ) )
+ // Broadcast nur versenden, wenn etwas geloescht wurde
+ bBroadcast = FALSE;
+ }
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ bBroadcast = FALSE;
+ }
+
+ if( bBroadcast )
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *pStyle ) );
+}
+
+
+
+BOOL SwDocStyleSheetPool::SetParent( SfxStyleFamily eFam,
+ const String &rStyle, const String &rParent )
+{
+ SwFmt* pFmt = 0, *pParent = 0;
+ switch( eFam )
+ {
+ case SFX_STYLE_FAMILY_CHAR :
+ if( 0 != ( pFmt = lcl_FindCharFmt( rDoc, rStyle ) ) && rParent.Len() )
+ pParent = lcl_FindCharFmt(rDoc, rParent );
+ break;
+
+ case SFX_STYLE_FAMILY_PARA :
+ if( 0 != ( pFmt = lcl_FindParaFmt( rDoc, rStyle ) ) && rParent.Len() )
+ pParent = lcl_FindParaFmt( rDoc, rParent );
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ if( 0 != ( pFmt = lcl_FindFrmFmt( rDoc, rStyle ) ) && rParent.Len() )
+ pParent = lcl_FindFrmFmt( rDoc, rParent );
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ case SFX_STYLE_FAMILY_PSEUDO:
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+
+ BOOL bRet = FALSE;
+ if( pFmt && pFmt->DerivedFrom() &&
+ pFmt->DerivedFrom()->GetName() != rParent )
+ {
+ {
+ SwImplShellAction aTmpSh( rDoc );
+ bRet = pFmt->SetDerivedFrom( pParent );
+ }
+
+ if( bRet )
+ {
+ // nur fuer das Broadcasting
+ mxStyleSheet->PresetName( rStyle );
+ mxStyleSheet->PresetParent( rParent );
+ if( SFX_STYLE_FAMILY_PARA == eFam )
+ mxStyleSheet->PresetFollow( ((SwTxtFmtColl*)pFmt)->
+ GetNextTxtFmtColl().GetName() );
+ else
+ mxStyleSheet->PresetFollow( aEmptyStr );
+
+ Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED,
+ *(mxStyleSheet.get()) ) );
+ }
+ }
+
+ return bRet;
+}
+
+SfxStyleSheetBase* SwDocStyleSheetPool::Find( const String& rName,
+ SfxStyleFamily eFam, USHORT n )
+{
+ USHORT nSMask = n;
+ if( SFX_STYLE_FAMILY_PARA == eFam && rDoc.get(IDocumentSettingAccess::HTML_MODE) )
+ {
+ // dann sind nur HTML-Vorlagen von Interesse
+ if( USHRT_MAX == nSMask )
+ nSMask = SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF | SFXSTYLEBIT_USED;
+ else
+ nSMask &= SFXSTYLEBIT_USED | SFXSTYLEBIT_USERDEF |
+ SWSTYLEBIT_CONDCOLL | SWSTYLEBIT_HTML;
+ if( !nSMask )
+ nSMask = SWSTYLEBIT_HTML;
+ }
+
+ const BOOL bSearchUsed = ( n != SFXSTYLEBIT_ALL &&
+ n & SFXSTYLEBIT_USED ) ? TRUE : FALSE;
+ const SwModify* pMod = 0;
+
+ mxStyleSheet->SetPhysical( FALSE );
+ mxStyleSheet->PresetName( rName );
+ mxStyleSheet->SetFamily( eFam );
+ BOOL bFnd = mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
+
+ if( mxStyleSheet->IsPhysical() )
+ {
+ switch( eFam )
+ {
+ case SFX_STYLE_FAMILY_CHAR:
+ pMod = mxStyleSheet->GetCharFmt();
+ break;
+
+ case SFX_STYLE_FAMILY_PARA:
+ pMod = mxStyleSheet->GetCollection();
+ break;
+
+ case SFX_STYLE_FAMILY_FRAME:
+ pMod = mxStyleSheet->GetFrmFmt();
+ break;
+
+ case SFX_STYLE_FAMILY_PAGE:
+ pMod = mxStyleSheet->GetPageDesc();
+ break;
+
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ const SwNumRule* pRule = mxStyleSheet->GetNumRule();
+ if( pRule &&
+ !(bSearchUsed && (bOrganizer || rDoc.IsUsed(*pRule)) ) &&
+ (( nSMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ ? !(pRule->GetPoolFmtId() & USER_FMT)
+ // benutzte gesucht und keine gefunden
+ : bSearchUsed ))
+ bFnd = FALSE;
+ }
+ break;
+
+ default:
+ ASSERT(!this, "unbekannte Style-Familie");
+ }
+ }
+
+ // dann noch die Maske auswerten:
+ if( pMod && !(bSearchUsed && (bOrganizer || rDoc.IsUsed(*pMod)) ) )
+ {
+ const USHORT nId = SFX_STYLE_FAMILY_PAGE == eFam
+ ? ((SwPageDesc*)pMod)->GetPoolFmtId()
+ : ((SwFmt*)pMod)->GetPoolFmtId();
+
+ if( ( nSMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ ? !(nId & USER_FMT)
+ // benutzte gesucht und keine gefunden
+ : bSearchUsed )
+ bFnd = FALSE;
+ }
+ return bFnd ? mxStyleSheet.get() : 0;
+}
+
+/* */
+
+SwStyleSheetIterator::SwStyleSheetIterator( SwDocStyleSheetPool* pBase,
+ SfxStyleFamily eFam, USHORT n )
+ : SfxStyleSheetIterator( pBase, eFam, n ),
+ mxIterSheet( new SwDocStyleSheet( pBase->GetDoc(), aEmptyStr, *pBase, SFX_STYLE_FAMILY_CHAR, 0 ) ),
+ mxStyleSheet( new SwDocStyleSheet( pBase->GetDoc(), aEmptyStr, *pBase, SFX_STYLE_FAMILY_CHAR, 0 ) )
+{
+ bFirstCalled = FALSE;
+ nLastPos = 0;
+ StartListening( *pBase );
+}
+
+ SwStyleSheetIterator::~SwStyleSheetIterator()
+{
+ EndListening( mxIterSheet->GetPool() );
+}
+
+USHORT SwStyleSheetIterator::Count()
+{
+ // Liste richtig fuellen lassen !!
+ if( !bFirstCalled )
+ First();
+ return aLst.Count();
+}
+
+SfxStyleSheetBase* SwStyleSheetIterator::operator[]( USHORT nIdx )
+{
+ // gefunden
+ if( !bFirstCalled )
+ First();
+ mxStyleSheet->PresetNameAndFamily( *aLst[ nIdx ] );
+ mxStyleSheet->SetPhysical( FALSE );
+ mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
+
+ return mxStyleSheet.get();
+}
+
+SfxStyleSheetBase* SwStyleSheetIterator::First()
+{
+ // Alte Liste loeschen
+ bFirstCalled = TRUE;
+ nLastPos = 0;
+ aLst.Erase();
+
+ // aktuellen loeschen
+ mxIterSheet->Reset();
+
+ SwDoc& rDoc = ((SwDocStyleSheetPool*)pBasePool)->GetDoc();
+ const USHORT nSrchMask = nMask;
+ const BOOL bIsSearchUsed = SearchUsed();
+
+ const BOOL bOrganizer = ((SwDocStyleSheetPool*)pBasePool)->IsOrganizerMode();
+
+ if( nSearchFamily == SFX_STYLE_FAMILY_CHAR
+ || nSearchFamily == SFX_STYLE_FAMILY_ALL )
+ {
+ const USHORT nArrLen = rDoc.GetCharFmts()->Count();
+ for( USHORT i = 0; i < nArrLen; i++ )
+ {
+ SwCharFmt* pFmt = (*rDoc.GetCharFmts())[ i ];
+ if( pFmt->IsDefault() && pFmt != rDoc.GetDfltCharFmt() )
+ continue;
+
+ const BOOL bUsed = bIsSearchUsed && (bOrganizer || rDoc.IsUsed(*pFmt));
+ if( !bUsed )
+ {
+ // Standard ist keine Benutzervorlage #46181#
+ const USHORT nId = rDoc.GetDfltCharFmt() == pFmt ?
+ USHORT( RES_POOLCHR_INET_NORMAL ):
+ pFmt->GetPoolFmtId();
+ if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ ? !(nId & USER_FMT)
+ // benutzte gesucht und keine gefunden
+ : bIsSearchUsed )
+ continue;
+
+ if( rDoc.get(IDocumentSettingAccess::HTML_MODE) && !(nId & USER_FMT) &&
+ !( RES_POOLCHR_HTML_BEGIN <= nId &&
+ nId < RES_POOLCHR_HTML_END ) &&
+ RES_POOLCHR_INET_NORMAL != nId &&
+ RES_POOLCHR_INET_VISIT != nId &&
+ RES_POOLCHR_FOOTNOTE != nId &&
+ RES_POOLCHR_ENDNOTE != nId )
+ continue;
+ }
+
+ aLst.Append( cCHAR, pFmt == rDoc.GetDfltCharFmt()
+ ? (const String&) *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD -
+ RES_POOLCOLL_TEXT_BEGIN ]
+ : pFmt->GetName() );
+ }
+
+ // PoolFormate
+ //
+ if( nSrchMask == SFXSTYLEBIT_ALL )
+ {
+ if( !rDoc.get(IDocumentSettingAccess::HTML_MODE) )
+ AppendStyleList(SwStyleNameMapper::GetChrFmtUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, cCHAR);
+ else
+ {
+ aLst.Append( cCHAR, *SwStyleNameMapper::GetChrFmtUINameArray()[
+ RES_POOLCHR_INET_NORMAL - RES_POOLCHR_BEGIN ] );
+ aLst.Append( cCHAR, *SwStyleNameMapper::GetChrFmtUINameArray()[
+ RES_POOLCHR_INET_VISIT - RES_POOLCHR_BEGIN ] );
+ aLst.Append( cCHAR, *SwStyleNameMapper::GetChrFmtUINameArray()[
+ RES_POOLCHR_ENDNOTE - RES_POOLCHR_BEGIN ] );
+ aLst.Append( cCHAR, *SwStyleNameMapper::GetChrFmtUINameArray()[
+ RES_POOLCHR_FOOTNOTE - RES_POOLCHR_BEGIN ] );
+ }
+ AppendStyleList(SwStyleNameMapper::GetHTMLChrFmtUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, cCHAR);
+ }
+ }
+
+ if( nSearchFamily == SFX_STYLE_FAMILY_PARA ||
+ nSearchFamily == SFX_STYLE_FAMILY_ALL )
+ {
+ USHORT nSMask = nSrchMask;
+ if( rDoc.get(IDocumentSettingAccess::HTML_MODE) )
+ {
+ // dann sind nur HTML-Vorlagen von Interesse
+ if( USHRT_MAX == nSMask )
+ nSMask = SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF |
+ SFXSTYLEBIT_USED;
+ else
+ nSMask &= SFXSTYLEBIT_USED | SFXSTYLEBIT_USERDEF |
+ SWSTYLEBIT_CONDCOLL | SWSTYLEBIT_HTML;
+ if( !nSMask )
+ nSMask = SWSTYLEBIT_HTML;
+ }
+
+ const USHORT nArrLen = rDoc.GetTxtFmtColls()->Count();
+ for( USHORT i = 0; i < nArrLen; i++ )
+ {
+ SwTxtFmtColl* pColl = (*rDoc.GetTxtFmtColls())[ i ];
+
+ if(pColl->IsDefault())
+ continue;
+
+ const BOOL bUsed = bOrganizer || rDoc.IsUsed(*pColl);
+ if( !(bIsSearchUsed && bUsed ))
+ {
+ const USHORT nId = pColl->GetPoolFmtId();
+ switch ( (nSMask & ~SFXSTYLEBIT_USED) )
+ {
+ case SFXSTYLEBIT_USERDEF:
+ if(!IsPoolUserFmt(nId)) continue;
+ break;
+ case SWSTYLEBIT_TEXT:
+ if((nId & COLL_GET_RANGE_BITS) != COLL_TEXT_BITS) continue;
+ break;
+ case SWSTYLEBIT_CHAPTER:
+ if((nId & COLL_GET_RANGE_BITS) != COLL_DOC_BITS) continue;
+ break;
+ case SWSTYLEBIT_LIST:
+ if((nId & COLL_GET_RANGE_BITS) != COLL_LISTS_BITS) continue;
+ break;
+ case SWSTYLEBIT_IDX:
+ if((nId & COLL_GET_RANGE_BITS) != COLL_REGISTER_BITS) continue;
+ break;
+ case SWSTYLEBIT_EXTRA:
+ if((nId & COLL_GET_RANGE_BITS) != COLL_EXTRA_BITS) continue;
+ break;
+
+ case SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF:
+ if(IsPoolUserFmt(nId))
+ break;
+ // ansonten weiter
+ case SWSTYLEBIT_HTML:
+ if( (nId & COLL_GET_RANGE_BITS) != COLL_HTML_BITS)
+ {
+ // einige wollen wir aber auch in dieser Section sehen
+ BOOL bWeiter = TRUE;
+ switch( nId )
+ {
+ case RES_POOLCOLL_SENDADRESS: // --> ADDRESS
+ case RES_POOLCOLL_TABLE_HDLN: // --> TH
+ case RES_POOLCOLL_TABLE: // --> TD
+ case RES_POOLCOLL_TEXT: // --> P
+ case RES_POOLCOLL_HEADLINE_BASE:// --> H
+ case RES_POOLCOLL_HEADLINE1: // --> H1
+ case RES_POOLCOLL_HEADLINE2: // --> H2
+ case RES_POOLCOLL_HEADLINE3: // --> H3
+ case RES_POOLCOLL_HEADLINE4: // --> H4
+ case RES_POOLCOLL_HEADLINE5: // --> H5
+ case RES_POOLCOLL_HEADLINE6: // --> H6
+ case RES_POOLCOLL_STANDARD: // --> P
+ case RES_POOLCOLL_FOOTNOTE:
+ case RES_POOLCOLL_ENDNOTE:
+ bWeiter = FALSE;
+ break;
+ }
+ if( bWeiter )
+ continue;
+ }
+ break;
+ case SWSTYLEBIT_CONDCOLL:
+ if( RES_CONDTXTFMTCOLL != pColl->Which() ) continue;
+ break;
+ default:
+ // benutzte gesucht und keine gefunden
+ if( bIsSearchUsed )
+ continue;
+ }
+ }
+ aLst.Append( cPARA, pColl->GetName() );
+ }
+
+ const BOOL bAll = nSMask == SFXSTYLEBIT_ALL;
+ if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_TEXT )
+ AppendStyleList(SwStyleNameMapper::GetTextUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA );
+ if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_CHAPTER )
+ AppendStyleList(SwStyleNameMapper::GetDocUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_LIST )
+ AppendStyleList(SwStyleNameMapper::GetListsUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_IDX )
+ AppendStyleList(SwStyleNameMapper::GetRegisterUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_EXTRA )
+ AppendStyleList(SwStyleNameMapper::GetExtraUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_CONDCOLL )
+ {
+ if( !bIsSearchUsed ||
+ rDoc.IsPoolTxtCollUsed( RES_POOLCOLL_TEXT ))
+ aLst.Append( cPARA, *SwStyleNameMapper::GetTextUINameArray()[
+ RES_POOLCOLL_TEXT - RES_POOLCOLL_TEXT_BEGIN ] );
+ }
+ if ( bAll ||
+ (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_HTML ||
+ (nSMask & ~SFXSTYLEBIT_USED) ==
+ (SWSTYLEBIT_HTML | SFXSTYLEBIT_USERDEF) )
+ {
+ AppendStyleList(SwStyleNameMapper::GetHTMLUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, cPARA ) ;
+ if( !bAll )
+ {
+ // dann auch die, die wir mappen:
+ static USHORT aPoolIds[] = {
+ RES_POOLCOLL_SENDADRESS, // --> ADDRESS
+ RES_POOLCOLL_TABLE_HDLN, // --> TH
+ RES_POOLCOLL_TABLE, // --> TD
+ RES_POOLCOLL_STANDARD, // --> P
+ RES_POOLCOLL_TEXT, // --> P
+ RES_POOLCOLL_HEADLINE_BASE, // --> H
+ RES_POOLCOLL_HEADLINE1, // --> H1
+ RES_POOLCOLL_HEADLINE2, // --> H2
+ RES_POOLCOLL_HEADLINE3, // --> H3
+ RES_POOLCOLL_HEADLINE4, // --> H4
+ RES_POOLCOLL_HEADLINE5, // --> H5
+ RES_POOLCOLL_HEADLINE6, // --> H6
+ RES_POOLCOLL_FOOTNOTE,
+ RES_POOLCOLL_ENDNOTE,
+ 0
+ };
+
+ USHORT* pPoolIds = aPoolIds;
+ String s;
+ while( *pPoolIds )
+ {
+ if( !bIsSearchUsed || rDoc.IsPoolTxtCollUsed( *pPoolIds ) )
+ aLst.Append( cPARA,
+ s = SwStyleNameMapper::GetUIName( *pPoolIds, s ));
+ ++pPoolIds;
+ }
+ }
+ }
+ }
+
+ if( nSearchFamily == SFX_STYLE_FAMILY_FRAME ||
+ nSearchFamily == SFX_STYLE_FAMILY_ALL )
+ {
+ const USHORT nArrLen = rDoc.GetFrmFmts()->Count();
+ for( USHORT i = 0; i < nArrLen; i++ )
+ {
+ SwFrmFmt* pFmt = (*rDoc.GetFrmFmts())[ i ];
+
+ if(pFmt->IsDefault() || pFmt->IsAuto())
+ {
+ continue;
+ }
+
+ const USHORT nId = pFmt->GetPoolFmtId();
+ BOOL bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(*pFmt));
+ if( !bUsed )
+ {
+ if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ ? !(nId & USER_FMT)
+ // benutzte gesucht und keine gefunden
+ : bIsSearchUsed )
+ {
+ continue;
+ }
+ }
+
+ aLst.Append( cFRAME, pFmt->GetName() );
+ }
+
+ // PoolFormate
+ //
+ if ( nSrchMask == SFXSTYLEBIT_ALL )
+ AppendStyleList(SwStyleNameMapper::GetFrmFmtUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT, cFRAME);
+ }
+
+ if( nSearchFamily == SFX_STYLE_FAMILY_PAGE ||
+ nSearchFamily == SFX_STYLE_FAMILY_ALL )
+ {
+ const USHORT nCount = rDoc.GetPageDescCnt();
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ const SwPageDesc& rDesc =
+ const_cast<const SwDoc &>(rDoc).GetPageDesc(i);
+ const USHORT nId = rDesc.GetPoolFmtId();
+ BOOL bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rDesc));
+ if( !bUsed )
+ {
+ if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ ? !(nId & USER_FMT)
+ // benutzte gesucht und keine gefunden
+ : bIsSearchUsed )
+ continue;
+ }
+
+ aLst.Append( cPAGE, rDesc.GetName() );
+ }
+ if ( nSrchMask == SFXSTYLEBIT_ALL )
+ AppendStyleList(SwStyleNameMapper::GetPageDescUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, cPAGE);
+ }
+
+ if( nSearchFamily == SFX_STYLE_FAMILY_PSEUDO ||
+ nSearchFamily == SFX_STYLE_FAMILY_ALL )
+ {
+ const SwNumRuleTbl& rNumTbl = rDoc.GetNumRuleTbl();
+ for(USHORT i = 0; i < rNumTbl.Count(); ++i)
+ {
+ const SwNumRule& rRule = *rNumTbl[ i ];
+ if( !rRule.IsAutoRule() )
+ {
+ BOOL bUsed = bIsSearchUsed && ( bOrganizer || rDoc.IsUsed(rRule) );
+ if( !bUsed )
+ {
+ if( (nSrchMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
+ ? !(rRule.GetPoolFmtId() & USER_FMT)
+ // benutzte gesucht und keine gefunden
+ : bIsSearchUsed )
+ continue;
+ }
+
+ aLst.Append( cNUMRULE, rRule.GetName() );
+ }
+ }
+ if ( nSrchMask == SFXSTYLEBIT_ALL )
+ AppendStyleList(SwStyleNameMapper::GetNumRuleUINameArray(),
+ bIsSearchUsed, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE, cNUMRULE);
+ }
+
+ if(aLst.Count() > 0)
+ {
+ nLastPos = USHRT_MAX;
+ return Next();
+ }
+ return 0;
+}
+
+SfxStyleSheetBase* SwStyleSheetIterator::Next()
+{
+ nLastPos++;
+ if(aLst.Count() > 0 && nLastPos < aLst.Count())
+ {
+ mxIterSheet->PresetNameAndFamily(*aLst[nLastPos]);
+ mxIterSheet->SetPhysical( FALSE );
+ mxIterSheet->SetMask( nMask );
+ if(mxIterSheet->pSet)
+ {
+ mxIterSheet->pSet->ClearItem(0);
+ mxIterSheet->pSet= 0;
+ }
+ return mxIterSheet.get();
+ }
+ return 0;
+}
+
+SfxStyleSheetBase* SwStyleSheetIterator::Find( const UniString& rName )
+{
+ // suchen
+ if( !bFirstCalled )
+ First();
+
+ nLastPos = lcl_FindName( aLst, nSearchFamily, rName );
+ if( USHRT_MAX != nLastPos )
+ {
+ // gefunden
+ mxStyleSheet->PresetNameAndFamily(*aLst[nLastPos]);
+ // neuer Name gesetzt, also bestimme seine Daten
+ mxStyleSheet->FillStyleSheet( SwDocStyleSheet::FillOnlyName );
+ if( !mxStyleSheet->IsPhysical() )
+ mxStyleSheet->SetPhysical( FALSE );
+
+ return mxStyleSheet.get();
+ }
+ return 0;
+}
+
+void SwStyleSheetIterator::AppendStyleList(const SvStringsDtor& rList,
+ BOOL bTestUsed,
+ USHORT nSection, char cType )
+{
+ if( bTestUsed )
+ {
+ SwDoc& rDoc = ((SwDocStyleSheetPool*)pBasePool)->GetDoc();
+ for ( USHORT i=0; i < rList.Count(); ++i )
+ {
+ BOOL bUsed = FALSE;
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName(*rList[i], (SwGetPoolIdFromName)nSection);
+ switch ( nSection )
+ {
+ case nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL:
+ bUsed = rDoc.IsPoolTxtCollUsed( nId );
+ break;
+ case nsSwGetPoolIdFromName::GET_POOLID_CHRFMT:
+ bUsed = rDoc.IsPoolFmtUsed( nId );
+ break;
+ case nsSwGetPoolIdFromName::GET_POOLID_FRMFMT:
+ bUsed = rDoc.IsPoolFmtUsed( nId );
+ case nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC:
+ bUsed = rDoc.IsPoolPageDescUsed( nId );
+ break;
+ default:
+ ASSERT( !this, "unknown PoolFmt-Id" );
+ }
+ if ( bUsed )
+ aLst.Append( cType, *rList[i] );
+ }
+ }
+ else
+ for ( USHORT i=0; i < rList.Count(); ++i )
+ aLst.Append( cType, *rList[i] );
+}
+
+void SwStyleSheetIterator::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ // suchen und aus der Anzeige-Liste entfernen !!
+ if( rHint.ISA( SfxStyleSheetHint ) &&
+ SFX_STYLESHEET_ERASED == ((SfxStyleSheetHint&) rHint).GetHint() )
+ {
+ SfxStyleSheetBase* pStyle = ((SfxStyleSheetHint&)rHint).GetStyleSheet();
+
+ if (pStyle)
+ {
+ USHORT nTmpPos = lcl_FindName( aLst, pStyle->GetFamily(),
+ pStyle->GetName() );
+ if( nTmpPos < aLst.Count() )
+ aLst.DeleteAndDestroy( nTmpPos );
+ }
+ }
+}
+
+
diff --git a/sw/source/ui/app/error.src b/sw/source/ui/app/error.src
new file mode 100644
index 000000000000..30b9bc7c0e35
--- /dev/null
+++ b/sw/source/ui/app/error.src
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define __RSC
+
+
+ //#include <tools/errcode.hxx>
+#include "globals.hrc"
+#include "app.hrc"
+#include "swerror.h"
+#include "comcore.hrc" // MS: Warum gibst auf der Core-Seite
+ // jetzt Resourcen
+
+/*--------------------------------------------------------------------
+ Beschreibung: Strings
+ --------------------------------------------------------------------*/
+
+String STR_COMCORE_READERROR
+{
+ Text [ en-US ] = "Read-Error" ;
+};
+String STR_COMCORE_CANT_SHOW
+{
+ Text [ en-US ] = "Graphic cannot be displayed." ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Boxes
+ --------------------------------------------------------------------*/
+InfoBox ERR_CLPBRD_WRITE
+{
+ Message [ en-US ] = "Error while copying to the clipboard." ;
+};
+InfoBox ERR_CLPBRD_READ
+{
+ Message [ en-US ] = "Error reading from the clipboard." ;
+};
+
+
+#define ERR_CODE( class, err ) (class | (err - ERROR_SW_BASE))
+#define WARN_CODE( class, err ) (class | ( err - WARN_SW_BASE))
+
+Resource RID_SW_ERRHDL
+{
+ // Import-Errors
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SWG_FILE_FORMAT_ERROR )
+ {
+ Text [ en-US ] = "File format error found." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SWG_READ_ERROR )
+ {
+ Text [ en-US ] = "Error reading file." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SW6_INPUT_FILE )
+ {
+ Text [ en-US ] = "Input file error." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SW6_NOWRITER_FILE )
+ {
+ Text [ en-US ] = "This is not a %PRODUCTNAME Writer file." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SW6_UNEXPECTED_EOF )
+ {
+ Text [ en-US ] = "Unexpected end of file." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SW6_PASSWD )
+ {
+ Text [ en-US ] = "Password-protected files cannot be opened." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_WW6_NO_WW6_FILE_ERR )
+ {
+ Text [ en-US ] = "This is not a WinWord6 file." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_WW6_FASTSAVE_ERR )
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Diese Datei wurde mit der WinWord-Option 'Schnellspeichern' gespeichert. Bitte schalten Sie in WinWord die Option 'Schnellspeichern zulassen' aus und speichern sie die Datei erneut mit WinWord : Diese Datei wurde mit der WinWord-Option ''Schnellspeichern'' gespeichert. Bitte schalten Sie in WinWord die Option ''Schnellspeichern zulassen'' aus und speichern sie die Datei erneut mit WinWord */
+ /* ### ACHTUNG: Neuer Text in Resource? Diese Datei wurde mit der WinWord-Option 'Schnellspeichern' gespeichert. Bitte schalten Sie in WinWord die Option 'Schnellspeichern zulassen' aus und speichern sie die Datei erneut mit WinWord : Diese Datei wurde mit der WinWord-Option ''Schnellspeichern'' gespeichert. Bitte schalten Sie in WinWord die Option ''Schnellspeichern zulassen'' aus und speichern sie die Datei erneut mit WinWord */
+ /* ### ACHTUNG: Neuer Text in Resource? Diese Datei wurde mit der WinWord-Option 'Schnellspeichern' gespeichert. Bitte schalten Sie in WinWord die Option 'Schnellspeichern zulassen' aus und speichern sie die Datei erneut mit WinWord : Diese Datei wurde mit der WinWord-Option ''Schnellspeichern'' gespeichert. Bitte schalten Sie in WinWord die Option ''Schnellspeichern zulassen'' aus und speichern sie die Datei erneut mit WinWord */
+ /* ### ACHTUNG: Neuer Text in Resource? Diese Datei wurde mit der WinWord-Option 'Schnellspeichern' gespeichert. Bitte schalten Sie in WinWord die Option 'Schnellspeichern zulassen' aus und speichern sie die Datei erneut mit WinWord : Diese Datei wurde mit der WinWord-Option ''Schnellspeichern'' gespeichert. Bitte schalten Sie in WinWord die Option ''Schnellspeichern zulassen'' aus und speichern sie die Datei erneut mit WinWord */
+ Text [ en-US ] = "This file was saved with WinWord in 'Fast Save' mode. Please unmark the WinWord option 'Allow Fast Saves' and save the file again." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_FORMAT_ROWCOL )
+ {
+ Text [ en-US ] = "File format error found at $(ARG1)(row,col)." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SWG_NEW_VERSION )
+ {
+ Text [ en-US ] = "File has been written in a newer version." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_WW8_NO_WW8_FILE_ERR )
+ {
+ Text [ en-US ] = "This is not a WinWord97 file.";
+ };
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_FORMAT_FILE_ROWCOL )
+ {
+ Text [ en-US ] = "Format error discovered in the file in sub-document $(ARG1) at $(ARG2)(row,col).";
+ };
+ // Export-Errors
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , ERR_SWG_WRITE_ERROR )
+ {
+ Text [ en-US ] = "Error writing file." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , ERR_SWG_OLD_GLOSSARY )
+ {
+ Text [ en-US ] = "Wrong AutoText document version." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , ERR_WRITE_ERROR_FILE )
+ {
+ Text [ en-US ] = "Error in writing sub-document $(ARG1).";
+ };
+ // Import-/Export-Errors
+ String ERR_CODE ( ERRCODE_CLASS_READ , ERR_SWG_INTERNAL_ERROR )
+ {
+ Text [ en-US ] = "Internal error in %PRODUCTNAME Writer file format." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , ERR_SWG_INTERNAL_ERROR )
+ {
+ Text [ en-US ] = "Internal error in %PRODUCTNAME Writer file format." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_LOCKING , ERR_TXTBLOCK_NEWFILE_ERROR )
+ {
+ Text [ en-US ] = "$(ARG1) has changed." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_PATH , ERR_AUTOPATH_ERROR )
+ {
+ Text [ en-US ] = "$(ARG1) does not exist." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_NONE , ERR_TBLSPLIT_ERROR )
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Zellen können nicht mehr geteilt werden : Zellen k÷nnen nicht mehr geteilt werden */
+ Text [ en-US ] = "Cells cannot be further split." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_NONE , ERR_TBLINSCOL_ERROR )
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? weitere Spalten können nicht eingefügt werden : weitere Spalten k÷nnen nicht eingef³gt werden */
+ Text [ en-US ] = "Additional columns cannot be inserted." ;
+ };
+ String ERR_CODE ( ERRCODE_CLASS_NONE , ERR_TBLDDECHG_ERROR )
+ {
+ Text [ en-US ] = "The structure of a linked table cannot be modified." ;
+ };
+ // -------------------- Warnings -----------------------------------
+ String WARN_CODE ( ERRCODE_CLASS_READ , WARN_SWG_NO_DRAWINGS )
+ {
+ Text [ en-US ] = "No drawings could be read." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_READ , WARN_WW6_FASTSAVE_ERR )
+ {
+ Text [ en-US ] = "This file was saved with WinWord in 'Fast Save' mode. Please unmark the WinWord option 'Allow Fast Saves' and save the file again." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_READ , WARN_SWG_FEATURES_LOST )
+ {
+ Text [ en-US ] = "Not all attributes could be read." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_WRITE , WARN_SWG_FEATURES_LOST )
+ {
+ Text [ en-US ] = "Not all attributes could be recorded." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_READ , WARN_SWG_OLE )
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Einige OLE-Objekte konnten nur als Grafiken übernommen werden : Einige OLE-Objekte konnten nur als Grafiken ³bernommen werden */
+ Text [ en-US ] = "Some OLE objects could only be loaded as graphics." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_WRITE , WARN_SWG_OLE )
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Einige OLE-Objekte konnten nur als Grafiken übernommen werden : Einige OLE-Objekte konnten nur als Grafiken ³bernommen werden */
+ Text [ en-US ] = "Some OLE objects could only be saved as graphics." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_READ , WARN_SWG_POOR_LOAD )
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Dokument konnte nicht vollständig geladen werden : Dokument konnte nicht vollstõndig geladen werden */
+ Text [ en-US ] = "Document could not be completely loaded." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_WRITE , WARN_SWG_POOR_LOAD )
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Dokument konnte nicht vollständig gespeichert werden : Dokument konnte nicht vollstõndig gespeichert werden */
+ Text [ en-US ] = "Document could not be completely saved." ;
+ };
+ String WARN_CODE ( ERRCODE_CLASS_WRITE , WARN_SWG_HTML_NO_MACROS)
+ {
+ Text [ en-US ] = "This HTML document contains %PRODUCTNAME Basic macros.\nThey were not saved with the current export settings.";
+ };
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , WARN_WRITE_ERROR_FILE )
+ {
+ Text [ en-US ] = "Error in writing sub-document $(ARG1).";
+ };
+ String ERR_CODE ( ERRCODE_CLASS_WRITE , WARN_FORMAT_FILE_ROWCOL )
+ {
+ Text [ en-US ] = "Format error discovered in the file in sub-document $(ARG1) at $(ARG2)(row,col).";
+ };
+};
+
diff --git a/sw/source/ui/app/mainwn.cxx b/sw/source/ui/app/mainwn.cxx
new file mode 100644
index 000000000000..e6085a4a8662
--- /dev/null
+++ b/sw/source/ui/app/mainwn.cxx
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include <mdiexp.hxx>
+#include <tools/shl.hxx>
+#include <tools/string.hxx>
+#ifndef _SVARRAY_HXX
+#include <svl/svstdarr.hxx>
+#endif
+#include <sfx2/progress.hxx>
+#ifndef _RESID_HXX //autogen
+#include <tools/resid.hxx>
+#endif
+#include <docsh.hxx>
+#include <swmodule.hxx>
+#include "swtypes.hxx"
+
+class SwDocShell;
+
+struct SwProgress
+{
+ long nStartValue,
+ nStartCount;
+ SwDocShell *pDocShell;
+ SfxProgress *pProgress;
+};
+
+static SvPtrarr *pProgressContainer = 0;
+
+static SwProgress *lcl_SwFindProgress( SwDocShell *pDocShell )
+{
+ for ( USHORT i = 0; i < pProgressContainer->Count(); ++i )
+ {
+ SwProgress *pTmp = (SwProgress*)(*pProgressContainer)[i];
+ if ( pTmp->pDocShell == pDocShell )
+ return pTmp;
+ }
+ return 0;
+}
+
+
+void StartProgress( USHORT nMessResId, long nStartValue, long nEndValue,
+ SwDocShell *pDocShell )
+{
+ if( !SW_MOD()->IsEmbeddedLoadSave() )
+ {
+ SwProgress *pProgress = 0;
+
+ if ( !pProgressContainer )
+ pProgressContainer = new SvPtrarr( 2, 2 );
+ else
+ {
+ if ( 0 != (pProgress = lcl_SwFindProgress( pDocShell )) )
+ ++pProgress->nStartCount;
+ }
+ if ( !pProgress )
+ {
+ pProgress = new SwProgress;
+ pProgress->pProgress = new SfxProgress( pDocShell,
+ SW_RESSTR(nMessResId),
+ nEndValue - nStartValue,
+ FALSE,
+ TRUE );
+ pProgress->nStartCount = 1;
+ pProgress->pDocShell = pDocShell;
+ pProgressContainer->Insert( (void*)pProgress, 0 );
+ }
+ pProgress->nStartValue = nStartValue;
+ }
+}
+
+
+void SetProgressState( long nPosition, SwDocShell *pDocShell )
+{
+ if( pProgressContainer && !SW_MOD()->IsEmbeddedLoadSave() )
+ {
+ SwProgress *pProgress = lcl_SwFindProgress( pDocShell );
+ if ( pProgress )
+ pProgress->pProgress->SetState(nPosition - pProgress->nStartValue);
+ }
+}
+
+
+void EndProgress( SwDocShell *pDocShell )
+{
+ if( pProgressContainer && !SW_MOD()->IsEmbeddedLoadSave() )
+ {
+ SwProgress *pProgress = 0;
+ USHORT i;
+ for ( i = 0; i < pProgressContainer->Count(); ++i )
+ {
+ SwProgress *pTmp = (SwProgress*)(*pProgressContainer)[i];
+ if ( pTmp->pDocShell == pDocShell )
+ {
+ pProgress = pTmp;
+ break;
+ }
+ }
+
+ if ( pProgress && 0 == --pProgress->nStartCount )
+ {
+ pProgress->pProgress->Stop();
+ pProgressContainer->Remove( i );
+ delete pProgress->pProgress;
+ delete pProgress;
+ //#112337# it may happen that the container has been removed
+ //while rescheduling
+ if ( pProgressContainer && !pProgressContainer->Count() )
+ delete pProgressContainer, pProgressContainer = 0;
+ }
+ }
+}
+
+
+void SetProgressText( USHORT nId, SwDocShell *pDocShell )
+{
+ if( pProgressContainer && !SW_MOD()->IsEmbeddedLoadSave() )
+ {
+ SwProgress *pProgress = lcl_SwFindProgress( pDocShell );
+ if ( pProgress )
+ pProgress->pProgress->SetStateText( 0, SW_RESSTR(nId) );
+ }
+}
+
+
+void RescheduleProgress( SwDocShell *pDocShell )
+{
+ if( pProgressContainer && !SW_MOD()->IsEmbeddedLoadSave() )
+ {
+ SwProgress *pProgress = lcl_SwFindProgress( pDocShell );
+ if ( pProgress )
+ pProgress->pProgress->Reschedule();
+ }
+}
+
+
diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src
new file mode 100644
index 000000000000..b3ae93cdf6ca
--- /dev/null
+++ b/sw/source/ui/app/mn.src
@@ -0,0 +1,1453 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/dialogs.hrc>
+#include <svx/globlmn.hrc>
+#include "cmdid.h"
+#include "app.hrc"
+#include "globals.hrc"
+#include "helpid.h"
+#include "popup.hrc"
+
+/* --------------------- F O R M A T --------------------------------- */
+
+#define SEPARATOR MenuItem { Separator = TRUE; }
+
+//define for ITEM_FORMAT_NUMBERING
+#define DEFINE_SLOTID_FOR_NUMBER_BULLETS FN_NUMBER_BULLETS
+#define MN_NUMBERING ITEM_FORMAT_NUMBERING
+
+#define MN_TXT\
+ MenuItem\
+ {\
+ ITEM_FORMAT_CHAR_DLG\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_PARA_DLG\
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_FORMAT_PAGE_DLG ; \
+ HelpId = CMD_FN_FORMAT_PAGE_DLG ; \
+ Text [ en-US ] = "Pa~ge..." ; \
+ };
+
+
+#define MN_TEXT_ATTR\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_FONT\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_FONTHEIGHT\
+ };\
+ MenuItem\
+ {\
+ Identifier = MN_FORMAT_STYLE ; \
+ Command = ".uno:StyleMenu" ; \
+ Text [ en-US ] = "St~yle" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_WEIGHT\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_POSTURE\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_OVERLINE\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_UNDERLINE\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_STRIKEOUT\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_SHADOWED\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_CONTOUR\
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_SET_SUPER_SCRIPT ; \
+ HelpId = CMD_FN_SET_SUPER_SCRIPT ; \
+ Text [ en-US ] = "Superscript" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_SET_SUB_SCRIPT ; \
+ HelpId = CMD_FN_SET_SUB_SCRIPT ; \
+ Text [ en-US ] = "Subscript" ; \
+ };\
+ };\
+ };\
+ };\
+ MenuItem\
+ {\
+ Identifier = MN_FORMAT_ALGN ; \
+ Command = ".uno:AlignTextMenu" ; \
+ Text [ en-US ] = "A~lignment" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ ITEM_FORMAT_ATTR_PARA_ADJUST_LEFT\
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ ITEM_FORMAT_ATTR_PARA_ADJUST_RIGHT\
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ ITEM_FORMAT_ATTR_PARA_ADJUST_CENTER\
+ };\
+ MenuItem\
+ {\
+ Identifier = SID_ATTR_PARA_ADJUST_BLOCK ; \
+ HelpId = CMD_SID_ATTR_PARA_ADJUST_BLOCK ; \
+ RadioCheck = TRUE ; \
+ Text [ en-US ] = "Justified" ; \
+ };\
+ };\
+ };\
+ };\
+ MenuItem\
+ {\
+ Identifier = MN_FORMAT_LINESPACE ; \
+ Command = ".uno:LineSpacingMenu" ; \
+ Text [ en-US ] = "Line Spacing" ; \
+ _MenuItemFlags = MIB_RADIOCHECK ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ ITEM_FORMAT_PARA_LINESPACE_10\
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ ITEM_FORMAT_PARA_LINESPACE_15\
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ ITEM_FORMAT_PARA_LINESPACE_20\
+ };\
+ };\
+ };\
+ };
+
+/* --------------------- M E N U --------------------------------- */
+
+/*
+
+
+The application menu bar resource has become obsolete. You can now find the menu bar at the following
+location: <project>/uiconfig/[swriter|sweb|sglobal]/menubar/menubar.xml
+
+
+*/
+
+/* --------------------- D O C U M E N T -------------------------- */
+
+
+#define _MN_EDIT_FIELD \
+ MenuItem \
+ { \
+ Identifier = FN_EDIT_FIELD ; \
+ HelpId = CMD_FN_EDIT_FIELD ; \
+ Text [ en-US ] = "Fields..." ; \
+ };
+#define _MN_EDIT_FOOTNOTE \
+ MenuItem \
+ { \
+ Identifier = FN_EDIT_FOOTNOTE ; \
+ HelpId = CMD_FN_EDIT_FOOTNOTE ; \
+ Text [ en-US ] = "Footnote/Endnote~..." ; \
+ };
+ #define _MN_EDIT_IDX_ENTRY_DLG \
+ MenuItem \
+ { \
+ Identifier = FN_EDIT_IDX_ENTRY_DLG ; \
+ HelpId = CMD_FN_EDIT_IDX_ENTRY_DLG ; \
+ Text [ en-US ] = "Inde~x Entry..." ; \
+ };
+
+#define _MN_EDIT_REDLINE \
+ MenuItem \
+ { \
+ Identifier = FN_REDLINE_ACCEPT_DIRECT; \
+ HelpId = CMD_FN_REDLINE_ACCEPT_DIRECT ; \
+ Text [ en-US ] = "Accept Change" ; \
+ };\
+ MenuItem \
+ { \
+ Identifier = FN_REDLINE_REJECT_DIRECT ; \
+ HelpId = CMD_FN_REDLINE_REJECT_DIRECT ; \
+ Text [ en-US ] = "Reject Change" ; \
+ }; \
+ SEPARATOR ;
+#define _MN_EDIT_BIB_ENTRY_DLG \
+ MenuItem \
+ { \
+ Identifier = FN_EDIT_AUTH_ENTRY_DLG ; \
+ HelpId = CMD_FN_EDIT_AUTH_ENTRY_DLG ; \
+ Text [ en-US ] = "~Bibliography Entry..."; \
+ }; \
+ SEPARATOR ;
+
+#define _MN_EDIT_OPEN_HYPERLINK \
+ MenuItem \
+ { \
+ ITEM_OPEN_HYPERLINK \
+ };\
+ MenuItem \
+ { \
+ Identifier = FN_EDIT_HYPERLINK ; \
+ HelpId = CMD_FN_EDIT_HYPERLINK ; \
+ Text [ en-US ] = "Edit Hyperlink..."; \
+ }; \
+ MenuItem \
+ { \
+ Identifier = FN_COPY_HYPERLINK_LOCATION; \
+ HelpId = CMD_FN_COPY_HYPERLINK_LOCATION; \
+ Text [ en-US ] = "Copy Hyperlink ~Location"; \
+ }; \
+ MenuItem \
+ { \
+ Identifier = FN_REMOVE_HYPERLINK ; \
+ HelpId = CMD_FN_REMOVE_HYPERLINK ; \
+ Text [ en-US ] = "Remo~ve Hyperlink"; \
+ };
+
+#define _MN_EDIT_OPEN_SMARTTAGMENU \
+ MenuItem \
+ { \
+ ITEM_OPEN_SMARTTAGMENU \
+ };
+
+#define _MN_EDIT__HYPERLINK \
+ MenuItem\
+ {\
+ Identifier = FN_EDIT_HYPERLINK ; \
+ HelpId = CMD_FN_EDIT_HYPERLINK ; \
+ Text [ en-US ] = "~Edit Hyperlink" ; \
+ };
+
+#define _DEFAULT_TEXT_EDIT_ELEMENTS \
+ _MN_EDIT_FIELD \
+ _MN_EDIT_FOOTNOTE \
+ _MN_EDIT_IDX_ENTRY_DLG \
+ _MN_EDIT_BIB_ENTRY_DLG \
+ _MN_EDIT_REDLINE \
+ MenuItem \
+ { \
+ ITEM_POPUP_TEMPLATE_EDIT \
+ }; \
+ SEPARATOR ; \
+ _MN_EDIT_OPEN_HYPERLINK \
+ _MN_EDIT_OPEN_SMARTTAGMENU
+
+
+#define MN_RESET\
+ MenuItem\
+ {\
+ Identifier = FN_FORMAT_RESET ; \
+ HelpId = CMD_FN_FORMAT_RESET ; \
+ Text [ en-US ] = "~Default Formatting" ; \
+ };
+
+#define _NUMBERING_RELATED_MENU \
+ SEPARATOR ; \
+ MenuItem \
+ { \
+ Identifier = FN_NUMBER_NEWSTART; \
+ HelpId = CMD_FN_NUMBER_NEWSTART; \
+ Text[ en-US ] = "Restart Numbering"; \
+ }; \
+ MenuItem \
+ { \
+ Identifier = FN_NUM_CONTINUE; \
+ HelpId = CMD_FN_NUM_CONTINUE; \
+ Text[ en-US ] = "Continue previous numbering"; \
+ }; \
+ MenuItem \
+ { \
+ Identifier = FN_NUM_BULLET_UP; \
+ HelpId = CMD_FN_NUM_BULLET_UP; \
+ Text[ en-US ] = "Up One Level"; \
+ }; \
+ MenuItem \
+ { \
+ Identifier = FN_NUM_BULLET_DOWN; \
+ HelpId = CMD_FN_NUM_BULLET_DOWN; \
+ Text[ en-US ] = "Down One Level"; \
+ };
+
+#define BASE_TEXT_POPUPMENU_BEGIN \
+{ \
+ ItemList = \
+ { \
+ MN_RESET \
+ _NUMBERING_RELATED_MENU \
+ SEPARATOR ; \
+ MN_TEXT_ATTR \
+ SEPARATOR ; \
+ MN_TXT \
+ MN_NUMBERING \
+ ITEM_TRANSLITERATE_MENU \
+ SEPARATOR ;
+
+// not in Writer/Web
+#define BASE_TEXT_POPUPMENU_NOWEB \
+ MenuItem \
+ { \
+ Identifier = FN_UPDATE_CUR_TOX ; \
+ HelpId = CMD_FN_UPDATE_CUR_TOX ; \
+ Text [ en-US ] = "~Update Index/Table"; \
+ }; \
+ MenuItem \
+ { \
+ Identifier = FN_EDIT_CURRENT_TOX; \
+ HelpId = CMD_FN_EDIT_CURRENT_TOX; \
+ Text [ en-US ] = "~Edit Index/Table"; \
+ }; \
+ MenuItem \
+ { \
+ Identifier = FN_REMOVE_CUR_TOX; \
+ HelpId = CMD_FN_REMOVE_CUR_TOX; \
+ Text [ en-US ] = "Delete Index/Table"; \
+ }; \
+ SEPARATOR ;
+
+#define BASE_TEXT_POPUPMENU_END \
+ _DEFAULT_TEXT_EDIT_ELEMENTS \
+ }; \
+};
+
+/*------------------------------------------------------------------------
+ Beschreibung: Menu Window
+------------------------------------------------------------------------*/
+
+#define MN_FRM_CAPTION_ITEM \
+ MenuItem\
+ {\
+ Identifier = FN_INSERT_CAPTION ;\
+ HelpId = CMD_FN_INSERT_CAPTION ;\
+ Text [ en-US ] = "~Caption..." ;\
+ };
+
+#define MN_TAB1 \
+ MenuItem\
+ {\
+ Identifier = FN_FORMAT_TABLE_DLG ; \
+ HelpId = CMD_FN_FORMAT_TABLE_DLG ; \
+ Text [ en-US ] = "~Table..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_MERGE_TABLE ; \
+ HelpId = CMD_FN_TABLE_MERGE_TABLE ; \
+ Text [ en-US ] = "Merge Tables";\
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_SPLIT_TABLE ; \
+ HelpId = CMD_FN_TABLE_SPLIT_TABLE ; \
+ Text [ en-US ] = "~Split Table" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_NUM_FORMAT_TABLE_DLG ; \
+ HelpId = CMD_FN_NUM_FORMAT_TABLE_DLG ; \
+ Text [ en-US ] = "N~umber Format..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = MN_CELL ; \
+ Command = ".uno:CellMenu" ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Ze~lle : Zelle */\
+ Text [ en-US ] = "~Cell" ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Einstellungen für die Tabellenzelle : Einstellungen f³r die Tabellenzelle */\
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_MERGE_CELLS ; \
+ HelpId = CMD_FN_TABLE_MERGE_CELLS ; \
+ Text [ en-US ] = "~Merge" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_SPLIT_CELLS ; \
+ HelpId = CMD_FN_TABLE_SPLIT_CELLS ; \
+ Text [ en-US ] = "~Split..." ; \
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_VERT_NONE ; \
+ HelpId = CMD_FN_TABLE_VERT_NONE ; \
+ Text [ en-US ] = "~Top" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_VERT_CENTER ; \
+ HelpId = CMD_FN_TABLE_VERT_CENTER ; \
+ Text [ en-US ] = "C~enter" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_VERT_BOTTOM ; \
+ HelpId = CMD_FN_TABLE_VERT_BOTTOM ; \
+ Text [ en-US ] = "~Bottom" ; \
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_SET_READ_ONLY_CELLS ; \
+ HelpId = CMD_FN_TABLE_SET_READ_ONLY_CELLS ; \
+ /* ### ACHTUNG: Neuer Text in Resource? ~Schützen : ~Sch³tzen */\
+ Text [ en-US ] = "~Protect" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_UNSET_READ_ONLY_CELLS ; \
+ HelpId = CMD_FN_TABLE_UNSET_READ_ONLY_CELLS ; \
+ Text [ en-US ] = "~Unprotect" ; \
+ };\
+ };\
+ };\
+ };
+
+#define MN_TAB2 \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_TBLROW ; \
+ HelpID = HID_MN_SUB_TBLROW ; \
+ Command = ".uno:RowMenu" ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Ze~ile : Zeile */\
+ Text [ en-US ] = "~Row" ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Einstellungen für die Tabellenzeile : Einstellungen f³r die Tabellenzeile */\
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_SET_ROW_HEIGHT ; \
+ HelpId = CMD_FN_TABLE_SET_ROW_HEIGHT ; \
+ /* ### ACHTUNG: Neuer Text in Resource? ~Höhe... : ~H÷he... */\
+ Text [ en-US ] = "~Height..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_ROW_SPLIT;\
+ HelpId = CMD_FN_TABLE_ROW_SPLIT ; \
+ Text [ en-US ] = "Allow Row to Break A~cross Pages and Columns" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_OPTIMAL_HEIGHT ; \
+ HelpId = CMD_FN_TABLE_OPTIMAL_HEIGHT ; \
+ /* ### ACHTUNG: Neuer Text in Resource? ~Optimale Höhe : ~Optimale H÷he */\
+ Text [ en-US ] = "~Optimal Height" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_BALANCE_ROWS ; \
+ HelpId = CMD_FN_TABLE_BALANCE_ROWS ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Gleichmäßig ~verteilen : Gleichmõ˜ig ~verteilen */\
+ Text [ en-US ] = "Space ~Equally" ; \
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_SELECT_ROW ; \
+ HelpId = CMD_FN_TABLE_SELECT_ROW ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Ausw~ählen : Auswählen */\
+ /* ### ACHTUNG: Neuer Text in Resource? Ausw~ählen : Ausw~õhlen */\
+ Text [ en-US ] = "~Select" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_INSERT_ROW_DLG ; \
+ HelpId = CMD_FN_TABLE_INSERT_ROW_DLG ; \
+ /* ### ACHTUNG: Neuer Text in Resource? ~Einfügen... : ~Einf³gen... */\
+ Text [ en-US ] = "~Insert..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_DELETE_ROW ; \
+ HelpId = CMD_FN_TABLE_DELETE_ROW ; \
+ /* ### ACHTUNG: Neuer Text in Resource? ~Löschen : ~L÷schen */\
+ Text [ en-US ] = "~Delete" ; \
+ };\
+ };\
+ };\
+ };\
+ MenuItem\
+ {\
+ Identifier = MN_SUB_TBLCOL ; \
+ HelpID = HID_MN_SUB_TBLCOL ; \
+ Command = ".uno:ColumnMenu" ; \
+ Text [ en-US ] = "Colu~mn" ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Einstellungen für die Tabellenspalte : Einstellungen f³r die Tabellenspalte */\
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_SET_COL_WIDTH ; \
+ HelpId = CMD_FN_TABLE_SET_COL_WIDTH ; \
+ Text [ en-US ] = "~Width..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_ADJUST_CELLS ; \
+ HelpId = CMD_FN_TABLE_ADJUST_CELLS ; \
+ Text [ en-US ] = "~Optimal Width " ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_BALANCE_CELLS ; \
+ HelpId = CMD_FN_TABLE_BALANCE_CELLS ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Gleichmäßig ~verteilen : Gleichmõ˜ig ~verteilen */\
+ Text [ en-US ] = "Space ~Equally" ; \
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_SELECT_COL ; \
+ HelpId = CMD_FN_TABLE_SELECT_COL ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Ausw~ählen : Auswählen */\
+ /* ### ACHTUNG: Neuer Text in Resource? Ausw~ählen : Ausw~õhlen */\
+ Text [ en-US ] = "~Select" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_INSERT_COL_DLG ; \
+ HelpId = CMD_FN_TABLE_INSERT_COL_DLG ; \
+ /* ### ACHTUNG: Neuer Text in Resource? ~Einfügen... : ~Einf³gen... */\
+ Text [ en-US ] = "~Insert..." ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_TABLE_DELETE_COL ; \
+ HelpId = CMD_FN_TABLE_DELETE_COL ; \
+ /* ### ACHTUNG: Neuer Text in Resource? ~Löschen : ~L÷schen */\
+ Text [ en-US ] = "~Delete" ; \
+ };\
+ };\
+};\
+ };
+
+#define MN_DRWTXT \
+ MenuItem\
+ {\
+ ITEM_FORMAT_CHAR_DLG\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_PARA_DLG\
+ };\
+
+#define MN_DRWTXTATTR \
+ MenuItem\
+ {\
+ Identifier = FN_DRAWTEXT_ATTR_DLG ; \
+ HelpId = CMD_FN_DRAWTEXT_ATTR_DLG ; \
+ Text [ en-US ] = "Te~xt..." ; \
+ };
+
+#define MN_NAME_SHAPE \
+ MenuItem\
+ {\
+ Identifier = FN_NAME_SHAPE ; \
+ HelpId = CMD_FN_NAME_SHAPE ; \
+ Text [ en-US ] = "Name..." ; \
+ };
+
+// #i68101#
+#define MN_TITLE_DESCRIPTION_SHAPE\
+ MenuItem\
+ {\
+ Identifier = FN_TITLE_DESCRIPTION_SHAPE; \
+ HelpId = CMD_FN_TITLE_DESCRIPTION_SHAPE; \
+ Text [ en-US ] = "Description..." ; \
+ };
+
+#define MN_FRM \
+ MenuItem\
+ {\
+ Identifier = FN_FORMAT_FRAME_DLG ; \
+ HelpId = CMD_FN_FORMAT_FRAME_DLG ; \
+ Text [ en-US ] = "~Frame..." ; \
+ };
+
+#define MN_DRAW1 \
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTRIBUTES_LINE\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTRIBUTES_AREA\
+ };
+
+#define MN_ALIGN \
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN\
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN_LEFT\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN_CENTER\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN_RIGHT\
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN_UP\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN_MIDDLE\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_ALIGN_DOWN\
+ };\
+ };\
+ };\
+ };
+
+#define MN_ONE_STEP \
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_UP ; \
+ HelpId = CMD_FN_FRAME_UP ; \
+ Text [ en-US ] = "Bring ~Forward" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_DOWN ; \
+ HelpId = CMD_FN_FRAME_DOWN ; \
+ Text [ en-US ] = "Send Back~ward" ; \
+ };
+
+#define MN_TOP \
+ MenuItem\
+ {\
+ ITEM_FORMAT_FRAME_TO_TOP\
+ };\
+
+
+#define MN_DRAW5 \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_ARRANGE ; \
+ HelpID = HID_MN_SUB_ARRANGE ; \
+ Command = ".uno:ArrangeMenu" ; \
+ Text [ en-US ] = "~Arrange" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_TOP\
+ MN_ONE_STEP\
+ MN_BOTTOM\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_HEAVEN\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_OBJECT_HELL\
+ };\
+ };\
+ };\
+ };\
+ MN_ALIGN\
+
+#define MN_DRAW6 \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_ARRANGE ; \
+ HelpID = HID_MN_SUB_ARRANGE ; \
+ Command = ".uno:ArrangeMenu" ; \
+ Text [ en-US ] = "~Arrange" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MN_TOP\
+ MN_ONE_STEP\
+ MN_BOTTOM\
+ };\
+ };\
+ };\
+ MN_ALIGN\
+
+#define MN_DRAW3 \
+ ITEM_GROUP_MENU
+
+#define MN_FORM \
+ MenuItem\
+ {\
+ ITEM_FORM_CONTROL_PROPERTIES\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORM_PROPERTIES\
+ };\
+ MenuItem\
+ {\
+ ITEM_REPLACE_CONTROL\
+ };\
+
+
+#define MN_ANNOTATIONS \
+ MenuItem\
+ {\
+ Identifier = FN_REPLY ;\
+ HelpID = CMD_FN_REPLY ;\
+ Text [ en-US ] = "Reply" ;\
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_DELETE_COMMENT ;\
+ HelpID = CMD_FN_DELETE_COMMENT ;\
+ Text [ en-US ] = "Delete ~Comment" ;\
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_DELETE_NOTE_AUTHOR ;\
+ HelpId = CMD_FN_DELETE_NOTE_AUTHOR ;\
+ Text [ en-US ] = "Delete ~All Comments by $1" ;\
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_DELETE_ALL_NOTES ;\
+ HelpId = CMD_FN_DELETE_ALL_NOTES ;\
+ Text [ en-US ] = "~Delete All Comments" ;\
+ };\
+ /*
+ MenuItem\
+ {\
+ Identifier = FN_HIDE_NOTE ;\
+ HelpId = CMD_FN_HIDE_NOTE ;\
+ Text [ en-US ] = "~Hide comment" ;\
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_HIDE_NOTE_AUTHOR ;\
+ HelpId = CMD_FN_HIDE_NOTE_AUTHOR ;\
+ Text [ en-US ] = "Hide ~author" ;\
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_HIDE_ALL_NOTES ;\
+ HelpId = CMD_FN_HIDE_ALL_NOTES ;\
+ Text [ en-US ] = "Hide all ~comments" ;\
+ };
+ */
+
+/*--Popups---------------------------------------------------------------*/
+
+String MN_TEXT_POPUPMENU
+{
+ Text [ en-US ] = "Text" ;
+};
+
+
+String MN_TAB_POPUPMENU
+{
+ Text [ en-US ] = "Table" ;
+};
+
+Menu MN_TAB_POPUPMENU
+{
+ ItemList =
+ {
+ MN_RESET
+ _NUMBERING_RELATED_MENU
+ SEPARATOR ;
+ MN_TEXT_ATTR
+ SEPARATOR ;
+ MenuItem
+ {
+ ITEM_FORMAT_CHAR_DLG
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_PARA_DLG
+ };
+ ITEM_TRANSLITERATE_MENU
+ // MN_BB
+ SEPARATOR ;
+ MN_TAB1
+ MN_TAB2
+ MN_FRM_CAPTION_ITEM
+ // SEPARATOR;
+ MenuItem
+ {
+ Identifier = FN_VIEW_TABLEGRID ;
+ HelpId = CMD_FN_VIEW_TABLEGRID ;
+ Text [ en-US ] = "Table Boundaries" ;
+ };
+ MenuItem
+ {
+ Identifier = FN_SET_MODOPT_TBLNUMFMT ;
+ HelpId = CMD_FN_SET_MODOPT_TBLNUMFMT ;
+ Text [ en-US ] = "~Number Recognition";
+ };
+ SEPARATOR ;
+ _DEFAULT_TEXT_EDIT_ELEMENTS
+ };
+};
+
+#define MN_WRAP_CONTOUR \
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_WRAP_CONTOUR ; \
+ HelpId = CMD_FN_FRAME_WRAP_CONTOUR ; \
+ Text [ en-US ] = "~Contour" ; \
+ };
+
+#define MN_EDIT_CONTOUR \
+ MenuItem\
+ {\
+ Identifier = SID_CONTOUR_DLG ; \
+ HelpId = CMD_SID_CONTOUR_DLG ; \
+ Text [ en-US ] = "~Edit Contour..." ; \
+ };
+
+#define MN_WRAP_CONTOUR_1 MN_WRAP_CONTOUR
+#define MN_EDIT_CONTOUR_1 MN_EDIT_CONTOUR
+
+#define MN_MOUSE_FRAME_BEGIN \
+ MenuItem\
+ {\
+ Identifier = MN_WRAP ; \
+ Command = ".uno:WrapMenu" ; \
+ Text [ en-US ] = "~Wrap" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_NOWRAP ; \
+ HelpId = CMD_FN_FRAME_NOWRAP ; \
+ Text [ en-US ] = "~No Wrap" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAP ; \
+ HelpId = CMD_FN_FRAME_WRAP ; \
+ Text [ en-US ] = "~Page Wrap" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAP_IDEAL ; \
+ HelpId = CMD_FN_FRAME_WRAP_IDEAL ; \
+ Text [ en-US ] = "~Optimal Page Wrap" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAPTHRU ; \
+ HelpId = CMD_FN_FRAME_WRAPTHRU ; \
+ Text [ en-US ] = "~Wrap Through" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAPTHRU_TRANSP ; \
+ HelpId = CMD_FN_FRAME_WRAPTHRU_TRANSP ; \
+ Text [ en-US ] = "In ~Background" ; \
+ };\
+ SEPARATOR ; \
+ MN_WRAP_CONTOUR_1\
+ MN_EDIT_CONTOUR\
+ MenuItem\
+ {\
+ Checkable = TRUE ; \
+ Identifier = FN_WRAP_ANCHOR_ONLY ; \
+ HelpId = CMD_FN_WRAP_ANCHOR_ONLY ; \
+ Text [ en-US ] = "~First Paragraph" ; \
+ };\
+ };\
+ };\
+ };
+
+
+#define MN_MOUSE_FRAME_WITH_CONTOUR MN_MOUSE_FRAME_BEGIN
+
+String MN_DRAW_POPUPMENU
+{
+ Text [ en-US ] = "Graphic" ;
+};
+#define MN_WRAP_DRAW \
+ MenuItem\
+ {\
+ Identifier = MN_WRAP ; \
+ Command = ".uno:WrapMenu" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_NOWRAP ; \
+ HelpId = CMD_FN_FRAME_NOWRAP ; \
+ Text [ en-US ] = "~No Wrap" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAP ; \
+ HelpId = CMD_FN_FRAME_WRAP ; \
+ Text [ en-US ] = "~Page Wrap" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAP_IDEAL ; \
+ HelpId = CMD_FN_FRAME_WRAP_IDEAL ; \
+ Text [ en-US ] = "~Optimal Page Wrap" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAPTHRU ; \
+ HelpId = CMD_FN_FRAME_WRAPTHRU ; \
+ Text [ en-US ] = "~Wrap Through" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_FRAME_WRAPTHRU_TRANSP ; \
+ HelpId = CMD_FN_FRAME_WRAPTHRU_TRANSP ; \
+ Text [ en-US ] = "In ~Background" ; \
+ };\
+ SEPARATOR ; \
+ MN_WRAP_CONTOUR_1\
+ MenuItem\
+ {\
+ Checkable = TRUE ; \
+ Identifier = FN_WRAP_ANCHOR_ONLY ; \
+ HelpId = CMD_FN_WRAP_ANCHOR_ONLY ; \
+ Text [ en-US ] = "~First Paragraph" ; \
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_DRAW_WRAP_DLG ; \
+ HelpId = CMD_FN_DRAW_WRAP_DLG ; \
+ Text [ en-US ] = "~Edit..." ; \
+ };\
+ };\
+ };\
+ Text [ en-US ] = "~Wrap" ; \
+ };
+
+#define MN_BOTTOM \
+ MenuItem\
+ {\
+ ITEM_FORMAT_FRAME_TO_BOTTOM\
+ };\
+
+#define MN_AT_FRAME \
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_TOOL_ANKER_FRAME ; \
+ HelpId = CMD_FN_TOOL_ANKER_FRAME ; \
+ Text [ en-US ] = "To ~Frame" ; \
+ };
+
+#define MN_ANCHOR \
+ MenuItem\
+ {\
+ Identifier = FN_TOOL_ANKER ; \
+ HelpId = CMD_FN_TOOL_ANKER ; \
+ Command = ".uno:AnchorMenu" ; \
+ Text [ en-US ] = "An~chor" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_TOOL_ANKER_PAGE ; \
+ HelpId = CMD_FN_TOOL_ANKER_PAGE ; \
+ Text [ en-US ] = "To P~age" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_TOOL_ANKER_PARAGRAPH ; \
+ HelpId = CMD_FN_TOOL_ANKER_PARAGRAPH ; \
+ Text [ en-US ] = "To ~Paragraph" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_TOOL_ANKER_AT_CHAR ; \
+ HelpId = CMD_FN_TOOL_ANKER_AT_CHAR ; \
+ Text [ en-US ] = "To ~Character" ; \
+ };\
+ MenuItem\
+ {\
+ RadioCheck = TRUE ; \
+ Identifier = FN_TOOL_ANKER_CHAR ; \
+ HelpId = CMD_FN_TOOL_ANKER_CHAR ; \
+ Text [ en-US ] = "As C~haracter" ; \
+ };\
+ MN_AT_FRAME\
+ };\
+ };\
+ };
+
+Menu MN_DRAW_POPUPMENU
+{
+ ItemList =
+ {
+ MN_DRAW1
+ MN_DRWTXTATTR
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_TRANSFORM
+ };
+
+ //-#i68101#----------------------
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ MN_NAME_SHAPE
+ //-#i68101#----------------------
+
+ SEPARATOR ;
+ MN_DRAW5
+ MN_WRAP_DRAW
+ MN_ANCHOR
+ MN_FRM_CAPTION_ITEM
+ SEPARATOR ;
+ MN_DRAW3
+ };
+};
+
+String MN_DRAWFORM_POPUPMENU
+{
+ Text [ en-US ] = "Control" ;
+};
+
+Menu MN_DRAWFORM_POPUPMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_TRANSFORM
+ };
+
+ //-#i68101#----------------------
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ MN_NAME_SHAPE
+ //-#i68101#----------------------
+
+ SEPARATOR ;
+ MN_FORM
+ SEPARATOR ;
+ MN_DRAW6
+ MN_WRAP_DRAW
+ MN_ANCHOR
+ SEPARATOR ;
+ MN_DRAW3
+ };
+};
+
+String MN_DRWTXT_POPUPMENU
+{
+ Text [ en-US ] = "Draw Object text" ;
+};
+
+Menu MN_DRWTXT_POPUPMENU
+{
+ ItemList =
+ {
+ MN_RESET
+ SEPARATOR ;
+ MN_TEXT_ATTR
+ SEPARATOR ;
+ ITEM_TRANSLITERATE_MENU
+ SEPARATOR ;
+ MN_DRWTXT
+ MN_FRM_CAPTION_ITEM
+ };
+};
+
+#define MN_REDCOMMENT \
+ MenuItem\
+ {\
+ Identifier = FN_DELETE_COMMENT ;\
+ HelpId = CMD_FN_DELETE_COMMENT ;\
+ Text [ en-US ] = "Delete ~Changes Note" ;\
+ };\
+
+Menu MN_ANNOTATION_POPUPMENU
+{
+ ItemList =
+ {
+ //MN_RESET
+ //SEPARATOR ;
+ //MN_TEXT_ATTR
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_WEIGHT\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_POSTURE\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_UNDERLINE\
+ };\
+ MenuItem\
+ {\
+ ITEM_FORMAT_ATTR_CHAR_STRIKEOUT\
+ };\
+ SEPARATOR ;
+ //ITEM_TRANSLITERATE_MENU
+ //SEPARATOR ;
+ //MN_DRWTXT
+ //MN_FRM_CAPTION_ITEM
+ SEPARATOR ;
+ MN_ANNOTATIONS
+ //MN_REDCOMMENT
+ };
+};
+
+Menu MN_ANNOTATION_BUTTON
+{
+ ItemList =
+ {
+ MN_ANNOTATIONS
+ };
+};
+
+Menu MN_REDCOMMENT_BUTTON
+{
+ ItemList =
+ {
+ MN_REDCOMMENT
+ };
+};
+
+String MN_GRF_POPUPMENU
+{
+ Text [ en-US ] = "Graphic" ;
+};
+
+#define MN_ALIGN_FRAME \
+ MenuItem\
+ {\
+ Identifier = MN_SUB_ALIGN ; \
+ HelpID = HID_MN_SUB_ALIGN ; \
+ Command = ".uno:ArrangeFrameMenu" ; \
+ Text [ en-US ] = "~Arrange" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ ITEM_FORMAT_FRAME_TO_TOP\
+ };\
+ MN_ONE_STEP\
+ MenuItem\
+ {\
+ ITEM_FORMAT_FRAME_TO_BOTTOM\
+ };\
+ };\
+ };\
+ };\
+ MenuItem\
+ {\
+ Identifier = MN_FORMAT_FRM_HORZ ; \
+ Command = ".uno:AlignFrameMenu" ; \
+ SubMenu = Menu\
+ {\
+ ItemList = \
+ {\
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_HORZ_LEFT ; \
+ HelpId = CMD_FN_FRAME_ALIGN_HORZ_LEFT ; \
+ Text [ en-US ] = "~Left" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_HORZ_CENTER ; \
+ HelpId = CMD_FN_FRAME_ALIGN_HORZ_CENTER ; \
+ Text [ en-US ] = "~Centered" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_HORZ_RIGHT ; \
+ HelpId = CMD_FN_FRAME_ALIGN_HORZ_RIGHT ; \
+ Text [ en-US ] = "~Right" ; \
+ };\
+ SEPARATOR ; \
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_VERT_TOP ; \
+ HelpId = CMD_FN_FRAME_ALIGN_VERT_TOP ; \
+ Text [ en-US ] = "Base at ~Top" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_VERT_CENTER ; \
+ HelpId = CMD_FN_FRAME_ALIGN_VERT_CENTER ; \
+ Text [ en-US ] = "Base in ~Middle" ; \
+ };\
+ MenuItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_VERT_BOTTOM ; \
+ HelpId = CMD_FN_FRAME_ALIGN_VERT_BOTTOM ; \
+ Text [ en-US ] = "Base at ~Bottom" ; \
+ };\
+ };\
+ };\
+ Text [ en-US ] = "A~lignment" ; \
+ };\
+ MN_ANCHOR
+
+Menu MN_GRF_POPUPMENU
+{
+ ItemList =
+ {
+ MN_ALIGN_FRAME
+ MN_MOUSE_FRAME_WITH_CONTOUR
+ // --> OD 2009-07-14 #i73249#
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ // <--
+ SEPARATOR ;
+ MenuItem
+ {
+ Identifier = FN_FORMAT_GRAFIC_DLG ;
+ HelpId = CMD_FN_FORMAT_GRAFIC_DLG ;
+ Text [ en-US ] = "~Picture..." ;
+ };
+ MenuItem
+ {
+ Identifier = FN_SAVE_GRAPHIC;
+ HelpId = CMD_FN_SAVE_GRAPHIC;
+ Text [ en-US ] = "Save Graphics..." ;
+ };
+ MN_FRM_CAPTION_ITEM
+ MenuItem
+ {
+ ITEM_EDIT_IMAP
+ };
+ };
+};
+
+String MN_OLE_POPUPMENU
+{
+ Text [ en-US ] = "Object" ;
+};
+
+
+Menu MN_OLE_POPUPMENU
+{
+ ItemList =
+ {
+ MN_ALIGN_FRAME
+ MN_MOUSE_FRAME_WITH_CONTOUR
+ // --> OD 2009-07-14 #i73249#
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ // <--
+ SEPARATOR ;
+ MenuItem
+ {
+ Identifier = FN_FORMAT_FRAME_DLG ;
+ HelpId = CMD_FN_FORMAT_FRAME_DLG ;
+ Text [ en-US ] = "Object..." ;
+ };
+ MN_FRM_CAPTION_ITEM
+ };
+};
+
+#define MN_MOUSE_FRAME_WITHOUT_CONTOUR MN_MOUSE_FRAME_BEGIN
+
+String MN_FRM_POPUPMENU
+{
+ Text [ en-US ] = "Frame" ;
+};
+
+Menu MN_FRM_POPUPMENU
+{
+ ItemList =
+ {
+ MN_ALIGN_FRAME
+ MN_MOUSE_FRAME_WITHOUT_CONTOUR
+ // --> OD 2009-07-07 #i73249#
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ // <--
+ SEPARATOR ;
+ MN_FRM
+ MN_FRM_CAPTION_ITEM
+ };
+};
+
+String MN_PPREVIEW_POPUPMENU
+{
+ Text [ en-US ] = "Draw Object text" ;
+};
+
+Menu MN_PPREVIEW_POPUPMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = FN_PAGEUP ;
+ HelpId = CMD_FN_PAGEUP ;
+ Text [ en-US ] = "Previous Page" ;
+ };
+ MenuItem
+ {
+ Identifier = FN_PAGEDOWN ;
+ HelpId = CMD_FN_PAGEDOWN ;
+ /* ### ACHTUNG: Neuer Text in Resource? Nächste Seite : Nõchste Seite */
+ Text [ en-US ] = "Next Page" ;
+ };
+ MenuItem
+ {
+ ITEM_VIEW_ATTR_ZOOM
+ /* ### ACHTUNG: Neuer Text in Resource? Schließt die Seitenvorschau : Schlie˜t die Seitenvorschau */
+ };
+ SEPARATOR ;
+ MenuItem
+ {
+ Identifier = FN_PRINT_PAGEPREVIEW ;
+ HelpId = CMD_FN_PRINT_PAGEPREVIEW ;
+ Text [ en-US ] = "Print" ;
+ };
+ SEPARATOR ;
+ MenuItem
+ {
+ Identifier = SID_PRINTPREVIEW;
+ HelpId = CMD_SID_PRINTPREVIEW;
+ Text [ en-US ] = "Close Preview" ;
+ };
+ };
+};
+
+String MN_MEDIA_POPUPMENU
+{
+ Text [ en-US ] = "Media object" ;
+};
+
+Menu MN_MEDIA_POPUPMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_TRANSFORM
+ };
+
+ //-#i68101#----------------------
+ SEPARATOR ;
+ MN_TITLE_DESCRIPTION_SHAPE
+ MN_NAME_SHAPE
+ //-#i68101#----------------------
+
+ SEPARATOR ;
+ MN_DRAW6
+ MN_WRAP_DRAW
+ MN_ANCHOR
+ SEPARATOR ;
+ MN_DRAW3
+ };
+};
+
+Menu MN_TEXT_POPUPMENU
+ BASE_TEXT_POPUPMENU_BEGIN
+ BASE_TEXT_POPUPMENU_NOWEB
+ BASE_TEXT_POPUPMENU_END
+
diff --git a/sw/source/ui/app/swdll.cxx b/sw/source/ui/app/swdll.cxx
new file mode 100644
index 000000000000..71409e4dedf3
--- /dev/null
+++ b/sw/source/ui/app/swdll.cxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <svx/svdobj.hxx>
+#include <rtl/logfile.hxx>
+
+#ifndef _GLOBDOC_HRC
+#include "globdoc.hrc"
+#endif
+
+#ifndef _SWDLL_HXX
+#include <swdll.hxx>
+#endif
+#include <wdocsh.hxx>
+#include <globdoc.hxx>
+#include <initui.hxx>
+#include <swmodule.hxx>
+#include <swtypes.hxx>
+#include <init.hxx>
+#include <dobjfac.hxx>
+#include <cfgid.h>
+
+#include <unotools/moduleoptions.hxx>
+
+#ifndef _FM_FMOBJFAC_HXX
+#include <svx/fmobjfac.hxx>
+#endif
+#include <svx/svdfield.hxx>
+#include <svx/objfac3d.hxx>
+
+#include <unomid.h>
+
+
+/*************************************************************************
+|*
+|* Init
+|*
+\************************************************************************/
+
+void SwDLL::Init()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDLL" );
+
+ // the SdModule must be created
+ SwModule** ppShlPtr = (SwModule**) GetAppData(SHL_WRITER);
+ if ( *ppShlPtr )
+ return;
+
+ SvtModuleOptions aOpt;
+ SfxObjectFactory* pDocFact = 0;
+ SfxObjectFactory* pGlobDocFact = 0;
+ if ( aOpt.IsWriter() )
+ {
+ pDocFact = &SwDocShell::Factory();
+ pGlobDocFact = &SwGlobalDocShell::Factory();
+ }
+
+ SfxObjectFactory* pWDocFact = &SwWebDocShell::Factory();
+
+ SwModule* pModule = new SwModule( pWDocFact, pDocFact, pGlobDocFact );
+ (*ppShlPtr) = pModule;
+
+ pWDocFact->SetDocumentServiceName(C2S("com.sun.star.text.WebDocument"));
+
+ if ( aOpt.IsWriter() )
+ {
+ pGlobDocFact->SetDocumentServiceName(C2S("com.sun.star.text.GlobalDocument"));
+ pDocFact->SetDocumentServiceName(C2S("com.sun.star.text.TextDocument"));
+ }
+
+ // SvDraw-Felder registrieren
+ SdrRegisterFieldClasses();
+
+ // 3D-Objekt-Factory eintragen
+ E3dObjFactory();
+
+ // form::component::Form-Objekt-Factory eintragen
+ FmFormObjFactory();
+
+ SdrObjFactory::InsertMakeObjectHdl( LINK( &aSwObjectFactory, SwObjectFactory, MakeObject ) );
+
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "Init Core/UI/Filter" );
+
+ //Initialisierung der Statics
+ ::_InitCore();
+ ::_InitFilter();
+ ::_InitUI();
+
+ pModule->InitAttrPool();
+ //jetzt darf das SwModule seinen Pool anlegen
+
+ // register your view-factories here
+ RegisterFactories();
+
+ // register your shell-interfaces here
+ RegisterInterfaces();
+
+ // register your controllers here
+ RegisterControls();
+}
+
+
+
+/*************************************************************************
+|*
+|* Exit
+|*
+\************************************************************************/
+
+void SwDLL::Exit()
+{
+ // called directly befor unloading the DLL
+ // do whatever you want, Sw-DLL is accessible
+
+ // der Pool muss vor den statics geloescht werden
+ SW_MOD()->RemoveAttrPool();
+
+ ::_FinitUI();
+ ::_FinitFilter();
+ ::_FinitCore();
+ // Objekt-Factory austragen
+ SdrObjFactory::RemoveMakeObjectHdl(LINK(&aSwObjectFactory, SwObjectFactory, MakeObject ));
+ // the SwModule must be destroyed
+ SwModule** ppShlPtr = (SwModule**) GetAppData(SHL_WRITER);
+ delete (*ppShlPtr);
+ (*ppShlPtr) = NULL;
+}
+
diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx
new file mode 100644
index 000000000000..2b3a5df1391b
--- /dev/null
+++ b/sw/source/ui/app/swmodul1.cxx
@@ -0,0 +1,675 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/childwin.hxx>
+#include <unotools/useroptions.hxx>
+#include <cppuhelper/weak.hxx>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#include <svx/dataaccessdescriptor.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/cmapitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/brshitem.hxx>
+#include <vcl/msgbox.hxx>
+#include <swmodule.hxx>
+#include <swtypes.hxx>
+#include <usrpref.hxx>
+#include <modcfg.hxx>
+#include <view.hxx>
+#include <pview.hxx>
+#include <wview.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <dbmgr.hxx>
+#include <uinums.hxx>
+#include <prtopt.hxx> // fuer PrintOptions
+#include <navicfg.hxx>
+#include <doc.hxx>
+#include <cmdid.h>
+#include <app.hrc>
+#include "helpid.h"
+
+#include <unomid.h>
+#include <tools/color.hxx>
+#include "PostItMgr.hxx"
+
+using ::rtl::OUString;
+using namespace ::svx;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::view;
+using namespace ::com::sun::star::lang;
+
+
+/*-----------------08/28/97 08:41pm-----------------
+
+--------------------------------------------------*/
+void lcl_SetUIPrefs(const SwViewOption* pPref, SwView* pView, ViewShell* pSh )
+{
+ // in FrameSets kann die tatsaechliche Sichtbarkeit von der Einstellung der ViewOptions abweichen
+ sal_Bool bVScrollChanged = pPref->IsViewVScrollBar() != pSh->GetViewOptions()->IsViewVScrollBar();
+ sal_Bool bHScrollChanged = pPref->IsViewHScrollBar() != pSh->GetViewOptions()->IsViewHScrollBar();
+ sal_Bool bVAlignChanged = pPref->IsVRulerRight() != pSh->GetViewOptions()->IsVRulerRight();
+
+ pSh->SetUIOptions(*pPref);
+ const SwViewOption* pNewPref = pSh->GetViewOptions();
+
+ // Scrollbars an / aus
+ if(bVScrollChanged)
+ {
+ pView->ShowVScrollbar(pNewPref->IsViewVScrollBar());
+ }
+ if(bHScrollChanged)
+ {
+ pView->ShowHScrollbar( pNewPref->IsViewHScrollBar() || pSh->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE));
+ }
+ //if only the position of the vertical ruler has been changed initiate an update
+ if(bVAlignChanged && !bHScrollChanged && !bVScrollChanged)
+ pView->InvalidateBorder();
+
+ // Lineale an / aus
+ if(pNewPref->IsViewVRuler())
+ pView->CreateVLineal();
+ else
+ pView->KillVLineal();
+
+ // TabWindow an/aus
+ if(pNewPref->IsViewHRuler())
+ pView->CreateTab();
+ else
+ pView->KillTab();
+
+ pView->GetPostItMgr()->PrepareView(true);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aktuelle SwWrtShell
+ --------------------------------------------------------------------*/
+
+
+SwWrtShell* GetActiveWrtShell()
+{
+ SwView *pActive = ::GetActiveView();
+ if( pActive )
+ return &pActive->GetWrtShell();
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Pointer auf die aktuelle Sicht
+ --------------------------------------------------------------------*/
+
+
+SwView* GetActiveView()
+{
+ SfxViewShell* pView = SfxViewShell::Current();
+ return PTR_CAST( SwView, pView );
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Ueber Views iterieren - static
+ --------------------------------------------------------------------*/
+
+SwView* SwModule::GetFirstView()
+{
+ // liefert nur sichtbare SwViews
+ const TypeId aTypeId = TYPE(SwView);
+ SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId);
+ return pView;
+}
+
+
+SwView* SwModule::GetNextView(SwView* pView)
+{
+ DBG_ASSERT(PTR_CAST(SwView, pView),"keine SwView uebergeben");
+ const TypeId aTypeId = TYPE(SwView);
+ SwView* pNView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId, TRUE);
+ return pNView;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Neuer Master fuer die Einstellungen wird gesetzt;
+ dieser wirkt sich auf die aktuelle Sicht und alle
+ folgenden aus.
+------------------------------------------------------------------------*/
+
+void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView,
+ sal_uInt16 nDest )
+{
+ SwView* pCurrView = pActView;
+ ViewShell* pSh = pCurrView ? &pCurrView->GetWrtShell() : 0;
+
+ SwMasterUsrPref* pPref = (SwMasterUsrPref*)GetUsrPref( static_cast< sal_Bool >(
+ VIEWOPT_DEST_WEB == nDest ? sal_True :
+ VIEWOPT_DEST_TEXT== nDest ? sal_False :
+ pCurrView && pCurrView->ISA(SwWebView) ));
+
+ //per Uno soll nur die sdbcx::View, aber nicht das Module veraendert werden
+ sal_Bool bViewOnly = VIEWOPT_DEST_VIEW_ONLY == nDest;
+ //PreView abfruehstuecken
+ SwPagePreView* pPPView;
+ if( !pCurrView && 0 != (pPPView = PTR_CAST( SwPagePreView, SfxViewShell::Current())) )
+ {
+ if(!bViewOnly)
+ pPref->SetUIOptions( rUsrPref );
+ pPPView->ShowVScrollbar(pPref->IsViewVScrollBar());
+ pPPView->ShowHScrollbar(pPref->IsViewHScrollBar());
+ if(!bViewOnly)
+ {
+ pPref->SetPagePrevRow(rUsrPref.GetPagePrevRow());
+ pPref->SetPagePrevCol(rUsrPref.GetPagePrevCol());
+ }
+ return;
+ }
+
+ if(!bViewOnly)
+ {
+ pPref->SetUsrPref( rUsrPref );
+ pPref->SetModified();
+ }
+
+ if( !pCurrView )
+ return;
+
+ // Weitergabe an die CORE
+ const sal_Bool bReadonly = pCurrView->GetDocShell()->IsReadOnly();
+ SwViewOption* pViewOpt;
+ if(!bViewOnly)
+ pViewOpt = new SwViewOption( *pPref );
+ else
+ pViewOpt = new SwViewOption( rUsrPref );
+ pViewOpt->SetReadonly( bReadonly );
+ if( !(*pSh->GetViewOptions() == *pViewOpt) )
+ {
+ //Ist evtl. nur eine ViewShell
+ pSh->StartAction();
+ pSh->ApplyViewOptions( *pViewOpt );
+ ((SwWrtShell*)pSh)->SetReadOnlyAvailable(pViewOpt->IsCursorInProtectedArea());
+ pSh->EndAction();
+ }
+ if ( pSh->GetViewOptions()->IsReadonly() != bReadonly )
+ pSh->SetReadonlyOption(bReadonly);
+
+ lcl_SetUIPrefs(pViewOpt, pCurrView, pSh);
+
+ // zum Schluss wird das Idle-Flag wieder gesetzt
+ // #42510#
+ pPref->SetIdle(sal_True);
+}
+/* -----------------------------28.09.00 12:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwModule::ApplyUserMetric( FieldUnit eMetric, BOOL bWeb )
+{
+ SwMasterUsrPref* pPref;
+ if(bWeb)
+ {
+ if(!pWebUsrPref)
+ GetUsrPref(sal_True);
+ pPref = pWebUsrPref;
+ }
+ else
+ {
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ pPref = pUsrPref;
+ }
+ FieldUnit eOldMetric = pPref->GetMetric();
+ if(eOldMetric != eMetric)
+ pPref->SetMetric(eMetric);
+
+ FieldUnit eHScrollMetric = pPref->IsHScrollMetric() ? pPref->GetHScrollMetric() : eMetric;
+ FieldUnit eVScrollMetric = pPref->IsVScrollMetric() ? pPref->GetVScrollMetric() : eMetric;
+
+ SwView* pTmpView = SwModule::GetFirstView();
+ // fuer alle MDI-Fenster das Lineal umschalten
+ while(pTmpView)
+ {
+ if(bWeb == (0 != PTR_CAST(SwWebView, pTmpView)))
+ {
+ pTmpView->ChangeVLinealMetric(eVScrollMetric);
+ pTmpView->ChangeTabMetric(eHScrollMetric);
+ }
+
+ pTmpView = SwModule::GetNextView(pTmpView);
+ }
+}
+/*-- 12.11.2008 14:47:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwModule::ApplyRulerMetric( FieldUnit eMetric, BOOL bHorizontal, BOOL bWeb )
+{
+ SwMasterUsrPref* pPref;
+ if(bWeb)
+ {
+ if(!pWebUsrPref)
+ GetUsrPref(sal_True);
+ pPref = pWebUsrPref;
+ }
+ else
+ {
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ pPref = pUsrPref;
+ }
+ if( bHorizontal )
+ pPref->SetHScrollMetric(eMetric);
+ else
+ pPref->SetVScrollMetric(eMetric);
+
+ SwView* pTmpView = SwModule::GetFirstView();
+ // switch metric at the appropriate rulers
+ while(pTmpView)
+ {
+ if(bWeb == (0 != dynamic_cast<SwWebView *>( pTmpView )))
+ {
+ if( bHorizontal )
+ pTmpView->ChangeTabMetric(eMetric);
+ else
+ pTmpView->ChangeVLinealMetric(eMetric);
+ }
+ pTmpView = SwModule::GetNextView(pTmpView);
+ }
+}
+/*-----------------13.11.96 11.57-------------------
+
+--------------------------------------------------*/
+
+SwNavigationConfig* SwModule::GetNavigationConfig()
+{
+ if(!pNavigationConfig)
+ {
+ pNavigationConfig = new SwNavigationConfig;
+ }
+ return pNavigationConfig;
+}
+
+/*-----------------05.02.97 08.03-------------------
+
+--------------------------------------------------*/
+
+SwPrintOptions* SwModule::GetPrtOptions(sal_Bool bWeb)
+{
+ if(bWeb && !pWebPrtOpt)
+ {
+ pWebPrtOpt = new SwPrintOptions(TRUE);
+ }
+ else if(!bWeb && !pPrtOpt)
+ {
+ pPrtOpt = new SwPrintOptions(FALSE);
+ }
+
+ return bWeb ? pWebPrtOpt : pPrtOpt;
+}
+
+/*-----------------26.06.97 07.52-------------------
+
+--------------------------------------------------*/
+SwChapterNumRules* SwModule::GetChapterNumRules()
+{
+ if(!pChapterNumRules)
+ pChapterNumRules = new SwChapterNumRules;
+ return pChapterNumRules;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwModule::ShowDBObj(SwView& rView, const SwDBData& rData, BOOL /*bOnlyIfAvailable*/)
+{
+ Reference<XFrame> xFrame = rView.GetViewFrame()->GetFrame().GetFrameInterface();
+ Reference<XDispatchProvider> xDP(xFrame, uno::UNO_QUERY);
+
+ uno::Reference<frame::XFrame> xBeamerFrame = xFrame->findFrame(
+ rtl::OUString::createFromAscii("_beamer"),
+ FrameSearchFlag::CHILDREN);
+ if (xBeamerFrame.is())
+ { // the beamer has been opened by the SfxViewFrame
+ Reference<XController> xController = xBeamerFrame->getController();
+ Reference<XSelectionSupplier> xControllerSelection(xController, UNO_QUERY);
+ if (xControllerSelection.is())
+ {
+
+ ODataAccessDescriptor aSelection;
+ aSelection.setDataSource(rData.sDataSource);
+ aSelection[daCommand] <<= rData.sCommand;
+ aSelection[daCommandType] <<= rData.nCommandType;
+ xControllerSelection->select(makeAny(aSelection.createPropertyValueSequence()));
+ }
+ else {
+ DBG_ERROR("no selection supplier in the beamer!");
+ }
+ }
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Redlining
+ --------------------------------------------------------------------*/
+
+sal_uInt16 SwModule::GetRedlineAuthor()
+{
+ if (!bAuthorInitialised)
+ {
+ const SvtUserOptions& rOpt = GetUserOptions();
+ if( !(sActAuthor = rOpt.GetFullName()).Len() )
+ if( !(sActAuthor = rOpt.GetID()).Len() )
+ sActAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
+ bAuthorInitialised = sal_True;
+ }
+ return InsertRedlineAuthor( sActAuthor );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+const String& SwModule::GetRedlineAuthor(sal_uInt16 nPos)
+{
+ DBG_ASSERT(nPos<pAuthorNames->Count(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
+ while (!(nPos<pAuthorNames->Count()))
+ {
+ InsertRedlineAuthor(String(RTL_CONSTASCII_USTRINGPARAM("nn")));
+ };
+ return *pAuthorNames->GetObject(nPos);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_uInt16 SwModule::InsertRedlineAuthor(const String& rAuthor)
+{
+ sal_uInt16 nPos = 0;
+
+ while (nPos < pAuthorNames->Count() && *pAuthorNames->GetObject(nPos) != rAuthor)
+ nPos++;
+
+ if (nPos == pAuthorNames->Count())
+ pAuthorNames->Insert(new String(rAuthor), nPos);
+
+ return nPos;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet,
+ const AuthorCharAttr &rAttr )
+{
+ Color aCol( rAttr.nColor );
+
+ if( COL_TRANSPARENT == rAttr.nColor )
+ {
+ static const ColorData aColArr[] = {
+ COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK,
+ COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK,
+ COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK };
+
+ aCol.SetColor( aColArr[ nAuthor % (sizeof( aColArr ) /
+ sizeof( aColArr[0] )) ] );
+ }
+
+ sal_Bool bBackGr = COL_NONE == rAttr.nColor;
+
+ switch (rAttr.nItemId)
+ {
+ case SID_ATTR_CHAR_WEIGHT:
+ {
+ SvxWeightItem aW( (FontWeight)rAttr.nAttr, RES_CHRATR_WEIGHT );
+ rSet.Put( aW );
+ aW.SetWhich( RES_CHRATR_CJK_WEIGHT );
+ rSet.Put( aW );
+ aW.SetWhich( RES_CHRATR_CTL_WEIGHT );
+ rSet.Put( aW );
+ }
+ break;
+
+ case SID_ATTR_CHAR_POSTURE:
+ {
+ SvxPostureItem aP( (FontItalic)rAttr.nAttr, RES_CHRATR_POSTURE );
+ rSet.Put( aP );
+ aP.SetWhich( RES_CHRATR_CJK_POSTURE );
+ rSet.Put( aP );
+ aP.SetWhich( RES_CHRATR_CTL_POSTURE );
+ rSet.Put( aP );
+ }
+ break;
+
+ case SID_ATTR_CHAR_UNDERLINE:
+ rSet.Put( SvxUnderlineItem( (FontUnderline)rAttr.nAttr,
+ RES_CHRATR_UNDERLINE));
+ break;
+
+ case SID_ATTR_CHAR_STRIKEOUT:
+ rSet.Put(SvxCrossedOutItem( (FontStrikeout)rAttr.nAttr,
+ RES_CHRATR_CROSSEDOUT));
+ break;
+
+ case SID_ATTR_CHAR_CASEMAP:
+ rSet.Put( SvxCaseMapItem( (SvxCaseMap)rAttr.nAttr,
+ RES_CHRATR_CASEMAP));
+ break;
+
+ case SID_ATTR_BRUSH:
+ rSet.Put( SvxBrushItem( aCol, RES_CHRATR_BACKGROUND ));
+ bBackGr = sal_True;
+ break;
+ }
+
+ if( !bBackGr )
+ rSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwModule::GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
+{
+ lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetInsertAuthorAttr());
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwModule::GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet)
+{
+ lcl_FillAuthorAttr(nAuthor, rSet, pModuleConfig->GetDeletedAuthorAttr());
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Fuer zukuenftige Erweiterung:
+ --------------------------------------------------------------------*/
+
+void SwModule::GetFormatAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet )
+{
+ lcl_FillAuthorAttr( nAuthor, rSet, pModuleConfig->GetFormatAuthorAttr() );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_uInt16 SwModule::GetRedlineMarkPos()
+{
+ return pModuleConfig->GetMarkAlignMode();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Bool SwModule::IsInsTblFormatNum(sal_Bool bHTML) const
+{
+ return pModuleConfig->IsInsTblFormatNum(bHTML);
+}
+
+sal_Bool SwModule::IsInsTblChangeNumFormat(sal_Bool bHTML) const
+{
+ return pModuleConfig->IsInsTblChangeNumFormat(bHTML);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Bool SwModule::IsInsTblAlignNum(sal_Bool bHTML) const
+{
+ return pModuleConfig->IsInsTblAlignNum(bHTML);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+const Color &SwModule::GetRedlineMarkColor()
+{
+ return pModuleConfig->GetMarkAlignColor();
+}
+
+/*-----------------03.03.98 16:47-------------------
+
+--------------------------------------------------*/
+const SwViewOption* SwModule::GetViewOption(sal_Bool bWeb)
+{
+ return GetUsrPref( bWeb );
+}
+
+// returne den definierten DocStat - WordDelimiter
+const String& SwModule::GetDocStatWordDelim() const
+{
+ return pModuleConfig->GetWordDelimiter();
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+// Durchreichen der Metric von der ModuleConfig (fuer HTML-Export)
+sal_uInt16 SwModule::GetMetric( sal_Bool bWeb ) const
+{
+ SwMasterUsrPref* pPref;
+ if(bWeb)
+ {
+ if(!pWebUsrPref)
+ GetUsrPref(sal_True);
+ pPref = pWebUsrPref;
+ }
+ else
+ {
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ pPref = pUsrPref;
+ }
+ return static_cast< sal_uInt16 >(pPref->GetMetric());
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+// Update-Stati durchreichen
+sal_uInt16 SwModule::GetLinkUpdMode( sal_Bool ) const
+{
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ return (sal_uInt16)pUsrPref->GetUpdateLinkMode();
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwFldUpdateFlags SwModule::GetFldUpdateFlags( sal_Bool ) const
+{
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ return pUsrPref->GetFldUpdateFlags();
+}
+/* -----------------------------28.09.00 14:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwModule::ApplyFldUpdateFlags(SwFldUpdateFlags eFldFlags)
+{
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ pUsrPref->SetFldUpdateFlags(eFldFlags);
+}
+/* -----------------------------28.09.00 14:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwModule::ApplyLinkMode(sal_Int32 nNewLinkMode)
+{
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ pUsrPref->SetUpdateLinkMode(nNewLinkMode);
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwModule::CheckSpellChanges( sal_Bool bOnlineSpelling,
+ sal_Bool bIsSpellWrongAgain, sal_Bool bIsSpellAllAgain, sal_Bool bSmartTags )
+{
+ sal_Bool bOnlyWrong = bIsSpellWrongAgain && !bIsSpellAllAgain;
+ sal_Bool bInvalid = bOnlyWrong || bIsSpellAllAgain;
+ if( bOnlineSpelling || bInvalid )
+ {
+ TypeId aType = TYPE(SwDocShell);
+ for( SwDocShell *pDocSh = (SwDocShell*)SfxObjectShell::GetFirst(&aType);
+ pDocSh;
+ pDocSh = (SwDocShell*)SfxObjectShell::GetNext( *pDocSh, &aType ) )
+ {
+ SwDoc* pTmp = pDocSh->GetDoc();
+ if ( pTmp->GetRootFrm() )
+ {
+ pTmp->SpellItAgainSam( bInvalid, bOnlyWrong, bSmartTags );
+ ViewShell* pViewShell = 0;
+ pTmp->GetEditShell( &pViewShell );
+ if ( bSmartTags && pViewShell && pViewShell->GetWin() )
+ pViewShell->GetWin()->Invalidate();
+ }
+ }
+// pSpell->SetSpellWrongAgain( sal_False );
+// pSpell->SetSpellAllAgain( sal_False );
+ }
+}
+
+void SwModule::ApplyDefaultPageMode(sal_Bool bIsSquaredPageMode)
+{
+ if(!pUsrPref)
+ GetUsrPref(sal_False);
+ pUsrPref->SetDefaultPageMode(bIsSquaredPageMode);
+}
diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx
new file mode 100644
index 000000000000..3f1c4665c6e3
--- /dev/null
+++ b/sw/source/ui/app/swmodule.cxx
@@ -0,0 +1,500 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#ifndef _SWERROR_H
+#include <swerror.h>
+#endif
+#include <vcl/wrkwin.hxx>
+#include <vcl/graph.hxx>
+#include <svx/galbrws.hxx>
+#include <svx/svdobj.hxx>
+#include <svtools/ehdl.hxx>
+#include <svx/fntszctl.hxx>
+#include <svx/fntctl.hxx>
+#include <svx/SmartTagCtl.hxx>
+#include <svx/pszctrl.hxx>
+#include <svx/insctrl.hxx>
+#include <svx/selctrl.hxx>
+#include <svx/linectrl.hxx>
+#include <svx/tbxctl.hxx> //z-Zt falscher includeschutz!
+#include <svx/fillctrl.hxx>
+#include <svx/tbcontrl.hxx>
+#include <svx/verttexttbxctrl.hxx>
+#include <svx/formatpaintbrushctrl.hxx>
+#include <svx/contdlg.hxx>
+#include <svx/layctrl.hxx>
+#include <svx/fontwork.hxx>
+#include <SwSpellDialogChildWindow.hxx>
+#include <svx/tbxalign.hxx>
+#include <svx/grafctrl.hxx>
+#include <svx/tbxcolor.hxx>
+#include <svx/clipboardctl.hxx>
+#include <svx/lboxctrl.hxx>
+#include <svx/hyprlink.hxx>
+#include <svx/tbxcustomshapes.hxx>
+#include <svx/imapdlg.hxx>
+#include <svx/srchdlg.hxx>
+#include <svx/hyperdlg.hxx>
+#include <svx/extrusioncolorcontrol.hxx>
+#include <svx/fontworkgallery.hxx>
+#include <com/sun/star/scanner/XScannerManager.hpp>
+#include <com/sun/star/container/XSet.hpp>
+#include <comphelper/processfactory.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <swmodule.hxx>
+#include <swevent.hxx>
+#include <swacorr.hxx>
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <dobjfac.hxx>
+#include <init.hxx>
+#include <pview.hxx>
+#include <wview.hxx>
+#include <wdocsh.hxx>
+#include <globdoc.hxx>
+#ifndef _SRCVIEW_HXX //autogen
+#include <srcview.hxx>
+#endif
+#include <glshell.hxx>
+#include <tabsh.hxx>
+#include <listsh.hxx>
+#include <grfsh.hxx>
+#include <mediash.hxx>
+#include <olesh.hxx>
+#include <drawsh.hxx>
+#include <wformsh.hxx>
+#include <drwtxtsh.hxx>
+#include <beziersh.hxx>
+#include <wtextsh.hxx>
+#include <wfrmsh.hxx>
+#ifndef _DRFORMSH_HXX
+#include <drformsh.hxx>
+#endif
+#ifndef _WGRFSH_HXX
+#include <wgrfsh.hxx>
+#endif
+#ifndef _WOLESH_HXX
+#include <wolesh.hxx>
+#endif
+#ifndef _WLISTSH_HXX
+#include <wlistsh.hxx>
+#endif
+#ifndef _WTABSH_HXX
+#include <wtabsh.hxx>
+#endif
+#include <navipi.hxx>
+#include <chartins.hxx>
+#include <inputwin.hxx>
+#include <usrpref.hxx>
+#include <uinums.hxx>
+#include <prtopt.hxx>
+#include <bookctrl.hxx>
+#include <tmplctrl.hxx>
+#include <viewlayoutctrl.hxx>
+#include <svx/zoomsliderctrl.hxx>
+#include <tblctrl.hxx>
+#include <zoomctrl.hxx>
+#include <workctrl.hxx>
+#include <tbxanchr.hxx>
+#include <fldwrap.hxx>
+#ifndef _REDLNDLG_HXX
+#include <redlndlg.hxx>
+#endif
+#ifndef _SYNCBTN_HXX
+#include <syncbtn.hxx>
+#endif
+#include <mailmergechildwindow.hxx>
+#include <modcfg.hxx>
+#include <fontcfg.hxx>
+#include <sfx2/taskpane.hxx>
+#include <sfx2/evntconf.hxx>
+#include <sfx2/appuno.hxx>
+#include <swatrset.hxx>
+#include <idxmrk.hxx>
+#include <dlelstnr.hxx>
+#ifndef _BARCFG_HXX
+#include <barcfg.hxx>
+#endif
+#include <svx/rubydialog.hxx>
+// OD 14.02.2003 #107424#
+#include <svtools/colorcfg.hxx>
+
+#include <editeng/acorrcfg.hxx>
+#include <unotools/moduleoptions.hxx>
+
+#ifndef _AVMEDIA_MEDIAPPLAYER_HXX
+#include <avmedia/mediaplayer.hxx>
+#endif
+#include <avmedia/mediatoolbox.hxx>
+
+#include <annotsh.hxx>
+
+#include <app.hrc>
+#include <svx/xmlsecctrl.hxx>
+ResMgr *pSwResMgr = 0;
+sal_Bool bNoInterrupt = sal_False;
+
+#include <sfx2/app.hxx>
+
+#include <svx/svxerr.hxx>
+
+#include <unomid.h>
+
+using namespace com::sun::star;
+
+
+TYPEINIT1( SwModule, SfxModule );
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+//************************************************************************
+
+SwModule::SwModule( SfxObjectFactory* pWebFact,
+ SfxObjectFactory* pFact,
+ SfxObjectFactory* pGlobalFact )
+ : SfxModule( SfxApplication::CreateResManager( "sw" ), sal_False, pWebFact,
+ pFact, pGlobalFact, NULL ),
+ pModuleConfig(0),
+ pUsrPref(0),
+ pWebUsrPref(0),
+ pPrtOpt(0),
+ pWebPrtOpt(0),
+ pChapterNumRules(0),
+ pStdFontConfig(0),
+ pNavigationConfig(0),
+ pToolbarConfig(0),
+ pWebToolbarConfig(0),
+ pDBConfig(0),
+ pColorConfig(0),
+ pAccessibilityOptions(0),
+ pCTLOptions(0),
+ pUserOptions(0),
+ pUndoOptions(0),
+ pAttrPool(0),
+ pView(0),
+ bAuthorInitialised(sal_False),
+ bEmbeddedLoadSave( sal_False ),
+ pDragDrop( 0 ),
+ pXSelection( 0 )
+{
+ SetName( String::CreateFromAscii("StarWriter") );
+ pSwResMgr = GetResMgr();
+ SvxErrorHandler::Get();
+ pErrorHdl = new SfxErrorHandler( RID_SW_ERRHDL,
+ ERRCODE_AREA_SW,
+ ERRCODE_AREA_SW_END,
+ pSwResMgr );
+
+ pModuleConfig = new SwModuleOptions;
+
+ //Die brauchen wie sowieso
+ pToolbarConfig = new SwToolbarConfigItem( sal_False );
+ pWebToolbarConfig = new SwToolbarConfigItem( sal_True );
+
+ pStdFontConfig = new SwStdFontConfig;
+
+ pAuthorNames = new SvStringsDtor(5, 1); // Alle Redlining-Autoren
+
+ //JP 18.10.96: SvxAutocorrect gegen die SwAutocorrect austauschen
+ SvxAutoCorrCfg* pACfg = SvxAutoCorrCfg::Get();
+ if( pACfg )
+ {
+ const SvxAutoCorrect* pOld = pACfg->GetAutoCorrect();
+ pACfg->SetAutoCorrect(new SwAutoCorrect( *pOld ));
+ }
+
+ StartListening( *SFX_APP() );
+
+ // OD 14.02.2003 #107424# - init color configuration
+ // member <pColorConfig> is created and the color configuration is applied
+ // at the view options.
+ GetColorConfig();
+}
+
+//************************************************************************
+
+uno::Reference< scanner::XScannerManager >
+SwModule::GetScannerManager()
+{
+ if (!m_xScannerManager.is())
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr (
+ comphelper::getProcessServiceFactory() );
+ if( xMgr.is() )
+ {
+ m_xScannerManager =
+ uno::Reference< scanner::XScannerManager >(
+ xMgr->createInstance(
+ rtl::OUString::createFromAscii(
+ "com.sun.star.scanner.ScannerManager" ) ),
+ uno::UNO_QUERY );
+ }
+ }
+ return m_xScannerManager;
+}
+
+uno::Reference< linguistic2::XLanguageGuessing > SwModule::GetLanguageGuesser()
+{
+ if (!m_xLanguageGuesser.is())
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMgr ( comphelper::getProcessServiceFactory() );
+ if (xMgr.is())
+ {
+ m_xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >(
+ xMgr->createInstance(
+ rtl::OUString::createFromAscii( "com.sun.star.linguistic2.LanguageGuessing" ) ),
+ uno::UNO_QUERY );
+ }
+ }
+ return m_xLanguageGuesser;
+}
+
+//************************************************************************
+
+SwModule::~SwModule()
+{
+ SetPool(0);
+ SfxItemPool::Free(pAttrPool);
+ delete pErrorHdl;
+ EndListening( *SFX_APP() );
+}
+
+//************************************************************************
+
+void SwModule::CreateLngSvcEvtListener()
+{
+ if (!xLngSvcEvtListener.is())
+ xLngSvcEvtListener = new SwLinguServiceEventListener;
+}
+
+//************************************************************************
+
+void SwDLL::RegisterFactories()
+{
+ //Diese Id's duerfen nicht geaendert werden. Mittels der Id's wird vom
+ //Sfx die View (Dokumentansicht wiederherstellen) erzeugt.
+ if ( SvtModuleOptions().IsWriter() )
+ SwView::RegisterFactory ( 2 );
+
+ SwWebView::RegisterFactory ( 5 );
+
+ if ( SvtModuleOptions().IsWriter() )
+ {
+ SwSrcView::RegisterFactory ( 6 );
+ SwPagePreView::RegisterFactory ( 7 );
+ }
+}
+
+//************************************************************************
+
+
+void SwDLL::RegisterInterfaces()
+{
+ SwModule* pMod = SW_MOD();
+ SwModule::RegisterInterface( pMod );
+ SwDocShell::RegisterInterface( pMod );
+ SwWebDocShell::RegisterInterface( pMod );
+ SwGlosDocShell::RegisterInterface( pMod );
+ SwWebGlosDocShell::RegisterInterface( pMod );
+ SwView::RegisterInterface( pMod );
+ SwWebView::RegisterInterface( pMod );
+ SwPagePreView::RegisterInterface( pMod );
+ SwSrcView::RegisterInterface( pMod );
+
+
+ SwBaseShell::RegisterInterface(pMod);
+ SwTextShell::RegisterInterface(pMod);
+ SwTableShell::RegisterInterface(pMod);
+ SwListShell::RegisterInterface(pMod);
+ SwFrameShell::RegisterInterface(pMod);
+ SwDrawBaseShell::RegisterInterface(pMod);
+ SwDrawShell::RegisterInterface(pMod);
+ SwDrawFormShell::RegisterInterface(pMod);
+ SwDrawTextShell::RegisterInterface(pMod);
+ SwBezierShell::RegisterInterface(pMod);
+ SwGrfShell::RegisterInterface(pMod);
+ SwOleShell::RegisterInterface(pMod);
+ SwWebTextShell::RegisterInterface(pMod);
+ SwWebFrameShell::RegisterInterface(pMod);
+ SwWebGrfShell::RegisterInterface(pMod);
+ SwWebListShell::RegisterInterface(pMod);
+ SwWebTableShell::RegisterInterface(pMod);
+ SwWebDrawFormShell::RegisterInterface(pMod);
+ SwWebOleShell::RegisterInterface(pMod);
+ SwMediaShell::RegisterInterface(pMod);
+ SwAnnotationShell::RegisterInterface(pMod);
+}
+
+//************************************************************************
+
+void SwDLL::RegisterControls()
+{
+ SwModule* pMod = SW_MOD();
+ SvxTbxCtlDraw::RegisterControl(SID_INSERT_DRAW, pMod );
+ SvxTbxCtlAlign::RegisterControl(SID_OBJECT_ALIGN, pMod );
+ SwTbxAnchor::RegisterControl(FN_TOOL_ANKER, pMod );
+ SwTbxInsertCtrl::RegisterControl(FN_INSERT_CTRL, pMod );
+ SwTbxInsertCtrl::RegisterControl(FN_INSERT_OBJ_CTRL, pMod );
+ SwTbxAutoTextCtrl::RegisterControl(FN_INSERT_FIELD_CTRL, pMod );
+ SwTbxAutoTextCtrl::RegisterControl(FN_GLOSSARY_DLG, pMod );
+
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_BASIC, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_SYMBOL, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_ARROW, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_FLOWCHART, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_CALLOUT, pMod );
+ SvxTbxCtlCustomShapes::RegisterControl( SID_DRAWTBX_CS_STAR, pMod );
+
+ svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod );
+ svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod );
+
+ SvxClipBoardControl::RegisterControl(SID_PASTE, pMod );
+ SvxUndoRedoControl::RegisterControl(SID_UNDO, pMod );
+ SvxUndoRedoControl::RegisterControl(SID_REDO, pMod );
+ svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, pMod );
+
+ SvxFillToolBoxControl::RegisterControl(SID_ATTR_FILL_STYLE, pMod );
+ SvxLineStyleToolBoxControl::RegisterControl(SID_ATTR_LINE_STYLE, pMod );
+ SvxLineWidthToolBoxControl::RegisterControl(SID_ATTR_LINE_WIDTH, pMod );
+ SvxLineColorToolBoxControl::RegisterControl(SID_ATTR_LINE_COLOR, pMod );
+ SvxLineEndToolBoxControl::RegisterControl(SID_ATTR_LINEEND_STYLE, pMod );
+
+ SvxFontNameToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONT, pMod );
+// SvxFontHeightToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod );
+ SvxFontColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR, pMod );
+ SvxFontColorExtToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR2, pMod );
+ SvxFontColorExtToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR_BACKGROUND, pMod );
+ SvxStyleToolBoxControl::RegisterControl(SID_STYLE_APPLY, pMod );
+ SvxColorToolBoxControl::RegisterControl(SID_BACKGROUND_COLOR, pMod );
+ SvxFrameToolBoxControl::RegisterControl(SID_ATTR_BORDER, pMod );
+ SvxFrameLineStyleToolBoxControl::RegisterControl(SID_FRAME_LINESTYLE, pMod );
+ SvxFrameLineColorToolBoxControl::RegisterControl(SID_FRAME_LINECOLOR, pMod );
+
+ SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME_INTERACT, pMod );
+ SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_FRAME, pMod );
+ SvxColumnsToolBoxControl::RegisterControl(FN_INSERT_REGION, pMod );
+ SvxTableToolBoxControl::RegisterControl(FN_INSERT_TABLE, pMod );
+ SvxTableToolBoxControl::RegisterControl(FN_SHOW_MULTIPLE_PAGES, pMod );
+
+ SvxFontMenuControl::RegisterControl(SID_ATTR_CHAR_FONT, pMod );
+ SvxFontSizeMenuControl::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod );
+
+ SwZoomControl::RegisterControl(SID_ATTR_ZOOM, pMod );
+ SwPreviewZoomControl::RegisterControl(FN_PREVIEW_ZOOM, pMod);
+ SvxPosSizeStatusBarControl::RegisterControl(0, pMod );
+ SvxInsertStatusBarControl::RegisterControl(SID_ATTR_INSERT, pMod );
+ SvxSelectionModeControl::RegisterControl(FN_STAT_SELMODE, pMod );
+ XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE, pMod );
+
+ SwBookmarkControl::RegisterControl(FN_STAT_PAGE, pMod );
+ SwTemplateControl::RegisterControl(FN_STAT_TEMPLATE, pMod );
+ SwViewLayoutControl::RegisterControl( SID_ATTR_VIEWLAYOUT, pMod );
+ SvxZoomSliderControl::RegisterControl( SID_ATTR_ZOOMSLIDER, pMod );
+
+ SwTableOptimizeCtrl::RegisterControl(FN_OPTIMIZE_TABLE, pMod);
+
+ SvxIMapDlgChildWindow::RegisterChildWindow( sal_False, pMod );
+ SvxSearchDialogWrapper::RegisterChildWindow( sal_False, pMod );
+ SvxHlinkDlgWrapper::RegisterChildWindow( sal_False, pMod );
+ SvxHyperlinkDlgWrapper::RegisterChildWindow( sal_False, pMod, SFX_CHILDWIN_FORCEDOCK );
+ SvxFontWorkChildWindow::RegisterChildWindow( sal_False, pMod );
+ SwFldDlgWrapper::RegisterChildWindow( sal_False, pMod );
+ SwFldDataOnlyDlgWrapper::RegisterChildWindow( sal_False, pMod );
+ SvxContourDlgChildWindow::RegisterChildWindow( sal_False, pMod );
+ SwNavigationChild::RegisterChildWindowContext( pMod );
+ SwInputChild::RegisterChildWindow( sal_False, pMod, SFX_CHILDWIN_FORCEDOCK );
+ SwRedlineAcceptChild::RegisterChildWindow( sal_False, pMod );
+ SwSyncChildWin::RegisterChildWindow( sal_True, pMod );
+ SwMailMergeChildWindow::RegisterChildWindow( sal_False, pMod );
+// SwSendMailChildWindow::RegisterChildWindow( sal_False, pMod );
+ SwInsertIdxMarkWrapper::RegisterChildWindow( sal_False, pMod );
+ SwInsertAuthMarkWrapper::RegisterChildWindow( sal_False, pMod );
+ SvxRubyChildWindow::RegisterChildWindow( sal_False, pMod);
+ SwSpellDialogChildWindow::RegisterChildWindow(sal_False, pMod);
+
+ SvxGrafRedToolBoxControl::RegisterControl( SID_ATTR_GRAF_RED, pMod );
+ SvxGrafGreenToolBoxControl::RegisterControl( SID_ATTR_GRAF_GREEN, pMod );
+ SvxGrafBlueToolBoxControl::RegisterControl( SID_ATTR_GRAF_BLUE, pMod );
+ SvxGrafLuminanceToolBoxControl::RegisterControl( SID_ATTR_GRAF_LUMINANCE, pMod );
+ SvxGrafContrastToolBoxControl::RegisterControl( SID_ATTR_GRAF_CONTRAST, pMod );
+ SvxGrafGammaToolBoxControl::RegisterControl( SID_ATTR_GRAF_GAMMA, pMod );
+ SvxGrafTransparenceToolBoxControl::RegisterControl( SID_ATTR_GRAF_TRANSPARENCE, pMod );
+ SvxGrafModeToolBoxControl::RegisterControl( SID_ATTR_GRAF_MODE, pMod );
+ SvxGrafFilterToolBoxControl::RegisterControl( SID_GRFFILTER, pMod );
+ SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_LEFT_TO_RIGHT, pMod);
+ SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_TOP_TO_BOTTOM, pMod);
+ SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_CAPTION_VERTICAL, pMod);
+ SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_TEXT_VERTICAL, pMod);
+
+ SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_LEFT_TO_RIGHT, pMod);
+ SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_RIGHT_TO_LEFT, pMod);
+
+ GalleryChildWindow::RegisterChildWindow(0, pMod);
+
+ ::avmedia::MediaToolBoxControl::RegisterControl(SID_AVMEDIA_TOOLBOX, pMod);
+ ::avmedia::MediaPlayer::RegisterChildWindow(0, pMod);
+
+ SvxSmartTagsControl::RegisterControl(SID_OPEN_SMARTTAGMENU, pMod);
+ ::sfx2::TaskPaneWrapper::RegisterChildWindow( FALSE, pMod );
+}
+
+
+
+/*************************************************************************
+|*
+|* Modul laden (nur Attrappe fuer das Linken der DLL)
+|*
+\************************************************************************/
+
+/* -----------------20.04.99 10:46-------------------
+ *
+ * --------------------------------------------------*/
+void SwModule::InitAttrPool()
+{
+ DBG_ASSERT(!pAttrPool, "Pool ist schon da!");
+ pAttrPool = new SwAttrPool(0);
+ SetPool(pAttrPool);
+}
+/* -----------------20.04.99 10:46-------------------
+ *
+ * --------------------------------------------------*/
+void SwModule::RemoveAttrPool()
+{
+ SetPool(0);
+ SfxItemPool::Free(pAttrPool);
+}
+
+
diff --git a/sw/source/ui/app/swwait.cxx b/sw/source/ui/app/swwait.cxx
new file mode 100644
index 000000000000..4392bdea04ac
--- /dev/null
+++ b/sw/source/ui/app/swwait.cxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/window.hxx>
+#include <docsh.hxx>
+#include <swwait.hxx>
+
+
+void SwDocShell::EnterWait( BOOL bLockDispatcher )
+{
+ SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, FALSE );
+ while ( pFrame )
+ {
+ pFrame->GetWindow().EnterWait();
+ if ( bLockDispatcher )
+ pFrame->GetDispatcher()->Lock( TRUE );
+ pFrame = SfxViewFrame::GetNext( *pFrame, this, FALSE );
+ }
+}
+
+void SwDocShell::LeaveWait( BOOL bLockDispatcher )
+{
+ SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, FALSE );
+ while ( pFrame )
+ {
+ pFrame->GetWindow().LeaveWait();
+ if ( bLockDispatcher )
+ pFrame->GetDispatcher()->Lock( FALSE );
+ pFrame = SfxViewFrame::GetNext( *pFrame, this, FALSE );
+ }
+}
+
+SwWait::SwWait( SwDocShell &rDocShell, BOOL bLockDispatcher ) :
+ rDoc ( rDocShell ),
+ bLock( bLockDispatcher )
+{
+ rDoc.EnterWait( bLock );
+}
+
+SwWait::~SwWait()
+{
+ rDoc.LeaveWait( bLock );
+}
+
+
diff --git a/sw/source/ui/cctrl/actctrl.cxx b/sw/source/ui/cctrl/actctrl.cxx
new file mode 100644
index 000000000000..967505a5f96d
--- /dev/null
+++ b/sw/source/ui/cctrl/actctrl.cxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+
+#include <tools/list.hxx>
+#include "actctrl.hxx"
+
+
+
+void NumEditAction::Action()
+{
+ aActionLink.Call( this );
+}
+
+
+long NumEditAction::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ const KeyCode aKeyCode = pKEvt->GetKeyCode();
+ const USHORT nModifier = aKeyCode.GetModifier();
+ if( aKeyCode.GetCode() == KEY_RETURN &&
+ !nModifier)
+ {
+ Action();
+ nHandled = 1;
+ }
+
+ }
+ if(!nHandled)
+ NumericField::Notify( rNEvt );
+ return nHandled;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: KeyInput fuer ShortName - Edits ohne Spaces
+------------------------------------------------------------------------*/
+
+NoSpaceEdit::NoSpaceEdit( Window* pParent, const ResId& rResId)
+ : Edit(pParent, rResId),
+ sForbiddenChars(String::CreateFromAscii(" "))
+{
+}
+
+NoSpaceEdit::~NoSpaceEdit()
+{
+}
+
+void NoSpaceEdit::KeyInput(const KeyEvent& rEvt)
+{
+ BOOL bCallParent = TRUE;
+ if(rEvt.GetCharCode())
+ {
+ String sKey = rEvt.GetCharCode();
+ if( STRING_NOTFOUND != sForbiddenChars.Search(sKey))
+ bCallParent = FALSE;
+ }
+ if(bCallParent)
+ Edit::KeyInput(rEvt);
+}
+/* -----------------------------11.02.00 15:28--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void NoSpaceEdit::Modify()
+{
+ Selection aSel = GetSelection();
+ String sTemp = GetText();
+ for(USHORT i = 0; i < sForbiddenChars.Len(); i++)
+ {
+ sTemp.EraseAllChars( sForbiddenChars.GetChar(i) );
+ }
+ USHORT nDiff = GetText().Len() - sTemp.Len();
+ if(nDiff)
+ {
+ aSel.setMin(aSel.getMin() - nDiff);
+ aSel.setMax(aSel.getMin());
+ SetText(sTemp);
+ SetSelection(aSel);
+ }
+ if(GetModifyHdl().IsSet())
+ GetModifyHdl().Call(this);
+}
+/* -----------------25.06.2003 15:57-----------------
+
+ --------------------------------------------------*/
+ReturnActionEdit::~ReturnActionEdit()
+{
+}
+/* -----------------25.06.2003 15:58-----------------
+
+ --------------------------------------------------*/
+void ReturnActionEdit::KeyInput( const KeyEvent& rEvt)
+{
+ const KeyCode aKeyCode = rEvt.GetKeyCode();
+ const USHORT nModifier = aKeyCode.GetModifier();
+ if( aKeyCode.GetCode() == KEY_RETURN &&
+ !nModifier)
+ {
+ if(aReturnActionLink.IsSet())
+ aReturnActionLink.Call(this);
+ }
+ else
+ Edit::KeyInput(rEvt);
+}
+
+
diff --git a/sw/source/ui/cctrl/popbox.cxx b/sw/source/ui/cctrl/popbox.cxx
new file mode 100644
index 000000000000..9b99a41b3e64
--- /dev/null
+++ b/sw/source/ui/cctrl/popbox.cxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <swtypes.hxx>
+#include <popbox.hxx>
+#include <navipi.hxx>
+
+
+// --- class SwHelpToolBox ---------------------------------------------
+
+
+SwHelpToolBox::SwHelpToolBox( SwNavigationPI* pParent, const ResId& rResId )
+ : ToolBox( pParent, rResId ),
+ DropTargetHelper( this )
+{
+}
+
+
+void SwHelpToolBox::MouseButtonDown(const MouseEvent &rEvt)
+{
+ // Zuerst DoubleClick-Link auswerten
+ // Dessen Returnwert entscheidet ueber andere Verarbeitung
+ // Doppelclickhandler nur, wenn nicht auf einen Button geclickt wurde
+ if(rEvt.GetButtons() == MOUSE_RIGHT &&
+ 0 == GetItemId(rEvt.GetPosPixel()))
+ {
+ aRightClickLink.Call((MouseEvent *)&rEvt);
+ }
+ else
+ ToolBox::MouseButtonDown(rEvt);
+}
+
+
+long SwHelpToolBox::DoubleClick( ToolBox* pCaller )
+{
+ // kein Doppelklick auf einen Button
+ if( 0 == pCaller->GetCurItemId() && aDoubleClickLink.Call(0) )
+ return TRUE;
+ return FALSE;
+}
+
+/*-----------------26.02.94 00:36-------------------
+ dtor ueberladen
+--------------------------------------------------*/
+
+
+SwHelpToolBox::~SwHelpToolBox() {}
+
+sal_Int8 SwHelpToolBox::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ return ((SwNavigationPI*)GetParent())->AcceptDrop( rEvt );
+}
+
+sal_Int8 SwHelpToolBox::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ return ((SwNavigationPI*)GetParent())->ExecuteDrop( rEvt );
+}
+
+
diff --git a/sw/source/ui/cctrl/swlbox.cxx b/sw/source/ui/cctrl/swlbox.cxx
new file mode 100644
index 000000000000..a6a50a01f851
--- /dev/null
+++ b/sw/source/ui/cctrl/swlbox.cxx
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <tools/debug.hxx>
+#include <unotools/charclass.hxx>
+#include <swtypes.hxx>
+#include <swlbox.hxx>
+
+using namespace nsSwComboBoxStyle;
+
+
+SV_IMPL_PTRARR(SwEntryLst, SwBoxEntry*)
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ein ListboxElement
+ --------------------------------------------------------------------*/
+
+
+SwBoxEntry::SwBoxEntry() :
+ bModified(FALSE),
+ bNew(FALSE),
+ nId(LISTBOX_APPEND)
+{
+}
+
+
+SwBoxEntry::SwBoxEntry(const String& aNam, USHORT nIdx) :
+ bModified(FALSE),
+ bNew(FALSE),
+ aName(aNam),
+ nId(nIdx)
+{
+}
+
+
+SwBoxEntry::SwBoxEntry(const SwBoxEntry& rOld) :
+ bModified(rOld.bModified),
+ bNew(rOld.bNew),
+ aName(rOld.aName),
+ nId(rOld.nId)
+{
+
+}
+
+
+
+SwComboBox::SwComboBox(Window* pParent, const ResId& rId, USHORT nStyleBits ):
+ ComboBox(pParent, rId),
+ nStyle(nStyleBits)
+{
+ // Verwaltung fuer die Stringlist aus der Resource aufbauen
+ USHORT nSize = GetEntryCount();
+ for( USHORT i=0; i < nSize; ++i )
+ {
+ const SwBoxEntry* pTmp = new SwBoxEntry(ComboBox::GetEntry(i), i);
+ aEntryLst.Insert(pTmp, aEntryLst.Count() );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Basisklasse Dtor
+ --------------------------------------------------------------------*/
+
+
+SwComboBox::~SwComboBox()
+{
+// das erledigen die Listen doch schon selbst im DTOR!
+// aEntryLst.DeleteAndDestroy(0, aEntryLst.Count());
+// aDelEntryLst.DeleteAndDestroy(0, aDelEntryLst.Count());
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Eintrag in die ComboBox aufnehmen
+ --------------------------------------------------------------------*/
+
+
+void SwComboBox::InsertEntry(const SwBoxEntry& rEntry)
+{
+ InsertSorted(new SwBoxEntry(rEntry));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Eintrag aus der Liste loeschen
+ --------------------------------------------------------------------*/
+
+
+void SwComboBox::RemoveEntry(USHORT nPos)
+{
+ if(nPos >= aEntryLst.Count())
+ return;
+
+ // Altes Element austragen
+ SwBoxEntry* pEntry = aEntryLst[nPos];
+ aEntryLst.Remove(nPos, 1);
+ ComboBox::RemoveEntry(nPos);
+
+ // keine neuen Eintraege in die Liste mit aufnehmen
+ if(pEntry->bNew)
+ return;
+
+ // in DeleteListe eintragen
+ aDelEntryLst.C40_INSERT(SwBoxEntry, pEntry, aDelEntryLst.Count());
+}
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Position by Name
+ --------------------------------------------------------------------*/
+
+USHORT SwComboBox::GetEntryPos(const SwBoxEntry& rEntry) const
+{
+ return ComboBox::GetEntryPos(rEntry.aName);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Rund um die Entries
+ --------------------------------------------------------------------*/
+
+
+const SwBoxEntry& SwComboBox::GetEntry(USHORT nPos) const
+{
+ if(nPos < aEntryLst.Count())
+ return *aEntryLst[nPos];
+
+ return aDefault;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: geloeschte Eintraege
+ --------------------------------------------------------------------*/
+
+
+USHORT SwComboBox::GetRemovedCount() const
+{
+ return aDelEntryLst.Count();
+}
+
+
+const SwBoxEntry& SwComboBox::GetRemovedEntry(USHORT nPos) const
+{
+ if(nPos < aDelEntryLst.Count())
+ return *aDelEntryLst[nPos];
+
+ return aDefault;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sortiert einfuegen
+ --------------------------------------------------------------------*/
+
+
+void SwComboBox::InsertSorted(SwBoxEntry* pEntry)
+{
+ ComboBox::InsertEntry(pEntry->aName);
+ USHORT nPos = ComboBox::GetEntryPos(pEntry->aName);
+ aEntryLst.C40_INSERT(SwBoxEntry, pEntry, nPos);
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Je nach Option bestimmte Zeichen ausblenden
+ --------------------------------------------------------------------*/
+
+
+void SwComboBox::KeyInput( const KeyEvent& rKEvt )
+{
+ USHORT nChar = rKEvt.GetCharCode();
+
+ if(nStyle & CBS_FILENAME)
+ {
+#if defined UNX
+ if(nChar == '/' || nChar == ' ' )
+ return;
+#else
+ if(nChar == ':' || nChar == '\\' || nChar == '.' || nChar == ' ')
+ return;
+#endif
+ }
+ ComboBox::KeyInput(rKEvt);
+}
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Text nach Option konvertieren
+ --------------------------------------------------------------------*/
+
+
+String SwComboBox::GetText() const
+{
+ String aTxt( ComboBox::GetText() );
+
+ if(nStyle & CBS_LOWER)
+ GetAppCharClass().toLower( aTxt );
+ else if( nStyle & CBS_UPPER )
+ GetAppCharClass().toUpper( aTxt );
+
+ return aTxt;
+}
+
+
+
diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx
new file mode 100644
index 000000000000..63d878006f7e
--- /dev/null
+++ b/sw/source/ui/chrdlg/break.cxx
@@ -0,0 +1,252 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <sfx2/request.hxx>
+#include <svl/stritem.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <uitool.hxx>
+#include <swtypes.hxx>
+#include <wrtsh.hxx>
+#ifndef _BASESH_HXX
+#include <basesh.hxx>
+#endif
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <viewopt.hxx>
+#include <break.hxx>
+#include <pagedesc.hxx>
+#include <poolfmt.hxx>
+
+#ifndef _BREAK_HRC
+#include <break.hrc>
+#endif
+#ifndef _CHRDLG_HRC
+#include <chrdlg.hrc>
+#endif
+#include <SwStyleNameMapper.hxx>
+
+void SwBreakDlg::Apply()
+{
+ nKind = 0;
+ if(aLineBtn.IsChecked())
+ nKind = 1;
+ else if(aColumnBtn.IsChecked())
+ nKind = 2;
+ else if(aPageBtn.IsChecked())
+ {
+ nKind = 3;
+ const USHORT nPos = aPageCollBox.GetSelectEntryPos();
+ if(0 != nPos && LISTBOX_ENTRY_NOTFOUND != nPos)
+ {
+ aTemplate = aPageCollBox.GetSelectEntry();
+ nPgNum = aPageNumBox.IsChecked() ? (USHORT)aPageNumEdit.GetValue() : 0;
+ }
+ }
+}
+
+
+IMPL_LINK_INLINE_START( SwBreakDlg, ClickHdl, void *, EMPTYARG )
+{
+ CheckEnable();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwBreakDlg, ClickHdl, void *, EMPTYARG )
+
+/*------------------------------------------------------------------------
+ Beschreibung: Handler fuer Aendern Seitenummer
+------------------------------------------------------------------------*/
+
+IMPL_LINK_INLINE_START( SwBreakDlg, PageNumHdl, CheckBox *, pBox )
+{
+ if(pBox->IsChecked()) aPageNumEdit.SetValue(1);
+ else aPageNumEdit.SetText(aEmptyStr);
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwBreakDlg, PageNumHdl, CheckBox *, pBox )
+
+/*------------------------------------------------------------------------
+ Beschreibung: Durch Aendern der Seitennummer wird die Checkbox gecheckt.
+------------------------------------------------------------------------*/
+
+IMPL_LINK_INLINE_START( SwBreakDlg, PageNumModifyHdl, Edit *, EMPTYARG )
+{
+ aPageNumBox.Check();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwBreakDlg, PageNumModifyHdl, Edit *, EMPTYARG )
+
+/*------------------------------------------------------------------------
+ Beschreibung: Ok-Handler;
+ prueft, ob die Seitenummer nPage eine legale Seitennummer
+ ist (linke Seiten mit geraden Nummern etc. bei einer Seitenvorlage
+ mit wechselnden Seiten)
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwBreakDlg, OkHdl, Button *, EMPTYARG )
+{
+ if(aPageNumBox.IsChecked()) {
+ // wenn unterschiedliche Seitenvorlagen, testen auf Gueltigkeit
+ const USHORT nPos = aPageCollBox.GetSelectEntryPos();
+ // auf Position 0 steht 'Ohne'.
+ const SwPageDesc *pPageDesc;
+ if ( 0 != nPos && LISTBOX_ENTRY_NOTFOUND != nPos )
+ pPageDesc = rSh.FindPageDescByName( aPageCollBox.GetSelectEntry(),
+ TRUE );
+ else
+ pPageDesc = &rSh.GetPageDesc(rSh.GetCurPageDesc());
+
+ ASSERT(pPageDesc, Seitenvorlage nicht gefunden.);
+ const USHORT nUserPage = USHORT(aPageNumEdit.GetValue());
+ BOOL bOk = TRUE;
+ switch(pPageDesc->GetUseOn())
+ {
+ case nsUseOnPage::PD_MIRROR:
+ case nsUseOnPage::PD_ALL: break;
+ case nsUseOnPage::PD_LEFT: bOk = 0 == nUserPage % 2; break;
+ case nsUseOnPage::PD_RIGHT: bOk = static_cast< sal_Bool >(nUserPage % 2); break;
+ default:; //prevent warning
+ }
+ if(!bOk) {
+ InfoBox(this, SW_RES(MSG_ILLEGAL_PAGENUM)).Execute();
+ aPageNumEdit.GrabFocus();
+ return 0;
+ }
+ }
+ EndDialog(RET_OK);
+ return 0;
+}
+
+SwBreakDlg::SwBreakDlg( Window *pParent, SwWrtShell &rS ) :
+
+ SvxStandardDialog( pParent,SW_RES(DLG_BREAK) ),
+
+ rSh(rS),
+ aLineBtn(this,SW_RES(RB_LINE)),
+ aColumnBtn(this,SW_RES(RB_COL)),
+ aPageBtn(this,SW_RES(RB_PAGE)),
+ aPageCollText(this, SW_RES(FT_COLL)),
+ aPageCollBox(this, SW_RES(LB_COLL)),
+ aPageNumBox(this, SW_RES(CB_PAGENUM)),
+ aPageNumEdit(this, SW_RES(ED_PAGENUM)),
+ aBreakFL(this,SW_RES(FL_BREAK)),
+
+ aOkBtn(this,SW_RES(BT_OK)),
+ aCancelBtn(this,SW_RES(BT_CANCEL)),
+ aHelpBtn(this,SW_RES(BT_HELP)),
+
+ nKind(0),
+ nPgNum(0),
+
+ bHtmlMode(0 != ::GetHtmlMode(rS.GetView().GetDocShell()))
+{
+ Link aLk = LINK(this,SwBreakDlg,ClickHdl);
+ aPageBtn.SetClickHdl( aLk );
+ aLineBtn.SetClickHdl( aLk );
+ aColumnBtn.SetClickHdl( aLk );
+ aPageCollBox.SetSelectHdl( aLk );
+
+ aOkBtn.SetClickHdl(LINK(this,SwBreakDlg,OkHdl));
+ aPageNumBox.SetClickHdl(LINK(this,SwBreakDlg,PageNumHdl));
+ aPageNumEdit.SetModifyHdl(LINK(this,SwBreakDlg,PageNumModifyHdl));
+
+
+ // Einfuegen der vorhandenen Seitenvorlagen in die Listbox
+ const USHORT nCount = rSh.GetPageDescCnt();
+ USHORT i;
+
+ for( i = 0; i < nCount; ++i)
+ {
+ const SwPageDesc &rPageDesc = rSh.GetPageDesc(i);
+ ::InsertStringSorted(rPageDesc.GetName(), aPageCollBox, 1 );
+ }
+
+ String aFmtName;
+ for(i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i)
+ if(LISTBOX_ENTRY_NOTFOUND == aPageCollBox.GetEntryPos( aFmtName =
+ SwStyleNameMapper::GetUIName( i, aFmtName )))
+ ::InsertStringSorted(aFmtName, aPageCollBox, 1 );
+ //add landscape page
+ if(LISTBOX_ENTRY_NOTFOUND == aPageCollBox.GetEntryPos( aFmtName =
+ SwStyleNameMapper::GetUIName( RES_POOLPAGE_LANDSCAPE, aFmtName )))
+ ::InsertStringSorted(aFmtName, aPageCollBox, 1 );
+ CheckEnable();
+ aPageNumEdit.SetText( aEmptyStr );
+ FreeResource();
+}
+
+
+void SwBreakDlg::CheckEnable()
+{
+ BOOL bEnable = TRUE;
+ if ( bHtmlMode )
+ {
+ aColumnBtn .Enable(FALSE);
+ aPageCollBox.Enable(FALSE);
+ bEnable = FALSE;
+ }
+ else if(rSh.GetFrmType(0,TRUE)
+ & (FRMTYPE_FLY_ANY | FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE))
+ {
+ aPageBtn.Enable(FALSE);
+ if(aPageBtn.IsChecked())
+ aLineBtn.Check(TRUE);
+ bEnable = FALSE;
+ }
+ const BOOL bPage = aPageBtn.IsChecked();
+ aPageCollText.Enable( bPage );
+ aPageCollBox.Enable ( bPage );
+
+ bEnable &= bPage;
+ if ( bEnable )
+ {
+ // auf Position 0 steht 'Ohne' Seitenvorlage.
+ const USHORT nPos = aPageCollBox.GetSelectEntryPos();
+ if ( 0 == nPos || LISTBOX_ENTRY_NOTFOUND == nPos )
+ bEnable = FALSE;
+ }
+ aPageNumBox .Enable(bEnable);
+ aPageNumEdit.Enable(bEnable);
+}
+
+SwBreakDlg::~SwBreakDlg()
+{
+}
diff --git a/sw/source/ui/chrdlg/break.hrc b/sw/source/ui/chrdlg/break.hrc
new file mode 100644
index 000000000000..7667a4a9f3b6
--- /dev/null
+++ b/sw/source/ui/chrdlg/break.hrc
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define RB_PAGE 1
+#define RB_LINE 2
+#define RB_COL 3
+#define FT_COLL 4
+#define LB_COLL 5
+#define FL_BREAK 6
+#define CB_PAGENUM 7
+#define ED_PAGENUM 8
+
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_HELP 102
+
+
diff --git a/sw/source/ui/chrdlg/ccoll.cxx b/sw/source/ui/chrdlg/ccoll.cxx
new file mode 100644
index 000000000000..44b144d28f4b
--- /dev/null
+++ b/sw/source/ui/chrdlg/ccoll.cxx
@@ -0,0 +1,236 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include "cmdid.h"
+#include <tools/list.hxx>
+#include "swmodule.hxx"
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "globals.hrc"
+#include "helpid.h"
+
+
+#include <sfx2/styfitem.hxx>
+
+#include "uitool.hxx"
+#include "ccoll.hxx"
+#include "fmtcol.hxx"
+#include "hintids.hxx"
+#include "docsh.hxx"
+#include "docstyle.hxx"
+#include "hints.hxx"
+
+#include "chrdlg.hrc"
+#include "ccoll.hrc"
+#include <vcl/svapp.hxx>
+
+#include <unomid.h>
+
+// ******************************************************************
+
+//!! order of entries has to be the same as in
+//!! CommandStruct SwCondCollItem::aCmds[]
+
+const char *aCommandContext[COND_COMMAND_COUNT] =
+{
+ "TableHeader",
+ "Table",
+ "Frame",
+ "Section",
+ "Footnote",
+ "Endnote",
+ "Header",
+ "Footer",
+ "OutlineLevel1",
+ "OutlineLevel2",
+ "OutlineLevel3",
+ "OutlineLevel4",
+ "OutlineLevel5",
+ "OutlineLevel6",
+ "OutlineLevel7",
+ "OutlineLevel8",
+ "OutlineLevel9",
+ "OutlineLevel10",
+ "NumberingLevel1",
+ "NumberingLevel2",
+ "NumberingLevel3",
+ "NumberingLevel4",
+ "NumberingLevel5",
+ "NumberingLevel6",
+ "NumberingLevel7",
+ "NumberingLevel8",
+ "NumberingLevel9",
+ "NumberingLevel10"
+};
+
+sal_Int16 GetCommandContextIndex( const rtl::OUString &rContextName )
+{
+ sal_Int16 nRes = -1;
+ for (sal_Int16 i = 0; nRes == -1 && i < COND_COMMAND_COUNT; ++i)
+ {
+ if (rContextName.equalsAscii( aCommandContext[i] ))
+ nRes = i;
+ }
+ return nRes;
+}
+
+rtl::OUString GetCommandContextByIndex( sal_Int16 nIndex )
+{
+ rtl::OUString aRes;
+ if (0 <= nIndex && nIndex < COND_COMMAND_COUNT)
+ {
+ aRes = C2U( aCommandContext[ nIndex ] );
+ }
+ return aRes;
+}
+
+// Globals ******************************************************************
+
+
+CommandStruct SwCondCollItem::aCmds[] =
+{
+ { PARA_IN_TABLEHEAD, 0 },
+ { PARA_IN_TABLEBODY, 0 },
+ { PARA_IN_FRAME, 0 },
+ { PARA_IN_SECTION, 0 },
+ { PARA_IN_FOOTENOTE, 0 },
+ { PARA_IN_ENDNOTE, 0 },
+ { PARA_IN_HEADER, 0 },
+ { PARA_IN_FOOTER, 0 },
+ { PARA_IN_OUTLINE, 0 },
+ { PARA_IN_OUTLINE, 1 },
+ { PARA_IN_OUTLINE, 2 },
+ { PARA_IN_OUTLINE, 3 },
+ { PARA_IN_OUTLINE, 4 },
+ { PARA_IN_OUTLINE, 5 },
+ { PARA_IN_OUTLINE, 6 },
+ { PARA_IN_OUTLINE, 7 },
+ { PARA_IN_OUTLINE, 8 },
+ { PARA_IN_OUTLINE, 9 },
+ { PARA_IN_LIST, 0 },
+ { PARA_IN_LIST, 1 },
+ { PARA_IN_LIST, 2 },
+ { PARA_IN_LIST, 3 },
+ { PARA_IN_LIST, 4 },
+ { PARA_IN_LIST, 5 },
+ { PARA_IN_LIST, 6 },
+ { PARA_IN_LIST, 7 },
+ { PARA_IN_LIST, 8 },
+ { PARA_IN_LIST, 9 }
+};
+
+
+TYPEINIT1_AUTOFACTORY(SwCondCollItem, SfxPoolItem)
+
+/****************************************************************************
+ Item fuer den Transport der Bedingungstabelle
+****************************************************************************/
+
+
+SwCondCollItem::SwCondCollItem(USHORT _nWhich ) :
+ SfxPoolItem(_nWhich)
+{
+
+}
+/****************************************************************************
+
+****************************************************************************/
+
+
+SwCondCollItem::~SwCondCollItem()
+{
+}
+
+/****************************************************************************
+
+****************************************************************************/
+
+
+SfxPoolItem* SwCondCollItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ return new SwCondCollItem(*this);
+}
+
+/****************************************************************************
+
+****************************************************************************/
+
+
+int SwCondCollItem::operator==( const SfxPoolItem& rItem) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rItem), "unterschiedliche Typen" );
+ BOOL bReturn = TRUE;
+ for(USHORT i = 0; i < COND_COMMAND_COUNT; i++)
+ if(sStyles[i] != ((SwCondCollItem&)rItem).sStyles[i])
+ {
+ bReturn = FALSE;
+ break;
+ }
+
+ return bReturn;
+}
+
+/****************************************************************************
+
+****************************************************************************/
+
+
+const String& SwCondCollItem::GetStyle(USHORT nPos) const
+{
+ return nPos < COND_COMMAND_COUNT ? sStyles[nPos] : aEmptyStr;
+}
+
+/****************************************************************************
+
+****************************************************************************/
+
+
+void SwCondCollItem::SetStyle(const String* pStyle, USHORT nPos)
+{
+ if( nPos < COND_COMMAND_COUNT )
+ sStyles[nPos] = pStyle ? *pStyle : aEmptyStr;
+}
+
+
+/****************************************************************************
+
+****************************************************************************/
+
+
+const CommandStruct* SwCondCollItem::GetCmds()
+{
+ return aCmds;
+}
+
+
+
+
diff --git a/sw/source/ui/chrdlg/ccoll.hrc b/sw/source/ui/chrdlg/ccoll.hrc
new file mode 100644
index 000000000000..f3d21092273a
--- /dev/null
+++ b/sw/source/ui/chrdlg/ccoll.hrc
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CCOLL_HRC
+#define _CCOLL_HRC
+
+// #define ******************************************************************
+
+#define CB_CONDITION 1
+#define FL_CONDITION 2
+#define FT_CONTEXT 3
+#define FT_USED 4
+#define TB_CONDCOLLS 5
+#define FT_STYLE 6
+#define LB_STYLE 7
+#define LB_FILTER 8
+#define PB_REMOVE 9
+#define PB_ASSIGN 10
+#define STR_REGIONS 11
+#define STR_NOTEMPL 12
+
+
+// ********************************************************************** EOF
+
+#endif
+
diff --git a/sw/source/ui/chrdlg/ccoll.src b/sw/source/ui/chrdlg/ccoll.src
new file mode 100644
index 000000000000..da20e56d0afd
--- /dev/null
+++ b/sw/source/ui/chrdlg/ccoll.src
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // #pragma ******************************************************************
+
+ // #include *****************************************************************
+#include "globals.hrc"
+#include "chrdlg.hrc"
+#include "ccoll.hrc"
+#include "helpid.h"
+ // TabPage ******************************************************************
+TabPage TP_CONDCOLL
+{
+ HelpID = HID_COND_COLL ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_CONDITION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Options";
+ };
+ CheckBox CB_CONDITION
+ {
+ HelpID = "sw:CheckBox:TP_CONDCOLL:CB_CONDITION";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ Text [ en-US ] = "~Conditional Style" ;
+ };
+ FixedText FT_CONTEXT
+ {
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Disable = TRUE ;
+ Text [ en-US ] = "Conte~xt" ;
+ };
+ FixedText FT_USED
+ {
+ Pos = MAP_APPFONT ( 100 , 28 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Disable = TRUE ;
+ Text [ en-US ] = "Applied Styles" ;
+ };
+ Control TB_CONDCOLLS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 39 ) ;
+ Size = MAP_APPFONT ( 173 , 123 ) ;
+ TabStop = TRUE ;
+ ClipChildren = TRUE ;
+ Disable = TRUE ;
+ Border = TRUE ;
+ };
+ FixedText FT_STYLE
+ {
+ Pos = MAP_APPFONT ( 190 , 28 ) ;
+ Size = MAP_APPFONT ( 58 , 8 ) ;
+ Disable = TRUE ;
+ Text [ en-US ] = "~Paragraph Styles" ;
+ };
+ ListBox LB_STYLE
+ {
+ HelpID = "sw:ListBox:TP_CONDCOLL:LB_STYLE";
+ Pos = MAP_APPFONT ( 188 , 39 ) ;
+ Size = MAP_APPFONT ( 60 , 108 ) ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ Sort = TRUE ;
+ Disable = TRUE ;
+ HScroll = TRUE ;
+ };
+ ListBox LB_FILTER
+ {
+ HelpID = "sw:ListBox:TP_CONDCOLL:LB_FILTER";
+ Pos = MAP_APPFONT ( 188 , 150 ) ;
+ Size = MAP_APPFONT ( 60 , 50 ) ;
+ DropDown = TRUE ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ Disable = TRUE ;
+ HScroll = TRUE ;
+ };
+ PushButton PB_REMOVE
+ {
+ HelpID = "sw:PushButton:TP_CONDCOLL:PB_REMOVE";
+ Pos = MAP_APPFONT ( 129 , 165 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ Text [ en-US ] = "Re~move" ;
+ };
+ PushButton PB_ASSIGN
+ {
+ HelpID = "sw:PushButton:TP_CONDCOLL:PB_ASSIGN";
+ Pos = MAP_APPFONT ( 185 , 165 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ Text [ en-US ] = "~Apply" ;
+ };
+ StringArray STR_REGIONS
+ {
+ ItemList [ en-US ] =
+ {
+ < "Table Header" ; > ;
+ < "Table" ; > ;
+ < "Frame" ; > ;
+ < "Section" ; > ;
+ < "Footnote" ; > ;
+ < "Endnote" ; > ;
+ < "Header" ; > ;
+ < "Footer" ; > ;
+ < " 1st Outline Level" ; > ;
+ < " 2nd Outline Level" ; > ;
+ < " 3rd Outline Level" ; > ;
+ < " 4th Outline Level" ; > ;
+ < " 5th Outline Level" ; > ;
+ < " 6th Outline Level" ; > ;
+ < " 7th Outline Level" ; > ;
+ < " 8th Outline Level" ; > ;
+ < " 9th Outline Level" ; > ;
+ < "10th Outline Level" ; > ;
+ < " 1st Numbering Level" ; > ;
+ < " 2nd Numbering Level" ; > ;
+ < " 3rd Numbering Level" ; > ;
+ < " 4th Numbering Level" ; > ;
+ < " 5th Numbering Level" ; > ;
+ < " 6th Numbering Level" ; > ;
+ < " 7th Numbering Level" ; > ;
+ < " 8th Numbering Level" ; > ;
+ < " 9th Numbering Level" ; > ;
+ < "10th Numbering Level" ; > ;
+ };
+ };
+ String STR_NOTEMPL
+ {
+ Text [ en-US ] = "<none>" ;
+ };
+};
+ // ********************************************************************** EOF
diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx
new file mode 100644
index 000000000000..38b1ba906fdd
--- /dev/null
+++ b/sw/source/ui/chrdlg/chardlg.cxx
@@ -0,0 +1,405 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <hintids.hxx>
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <svl/urihelper.hxx>
+#include <svl/stritem.hxx>
+#include <editeng/flstitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <svl/cjkoptions.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#include <swtypes.hxx>
+#include <errhdl.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <uitool.hxx>
+#include <fmtinfmt.hxx>
+#include <macassgn.hxx>
+#ifndef _CHRDLG_HXX
+#include <chrdlg.hxx> // der Dialog
+#endif
+#include <swmodule.hxx>
+#include <poolfmt.hxx>
+
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _CHRDLG_HRC
+#include <chrdlg.hrc>
+#endif
+#ifndef _CHARDLG_HRC
+#include <chardlg.hrc>
+#endif
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <SwStyleNameMapper.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include <svx/svxdlg.hxx>
+#include <svx/svxids.hrc>
+#include <svx/flagsdef.hxx>
+#include <svx/dialogs.hrc>
+
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::sfx2;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Der Traeger des Dialoges
+ --------------------------------------------------------------------*/
+
+
+SwCharDlg::SwCharDlg(Window* pParent, SwView& rVw, const SfxItemSet& rCoreSet,
+ const String* pStr, BOOL bIsDrwTxtDlg) :
+ SfxTabDialog(pParent, SW_RES(DLG_CHAR), &rCoreSet, pStr != 0),
+ rView(rVw),
+ bIsDrwTxtMode(bIsDrwTxtDlg)
+{
+ FreeResource();
+
+ // bspFonr fuer beide Bsp-TabPages
+
+ if(pStr)
+ {
+ String aTmp( GetText() );
+ aTmp += SW_RESSTR(STR_TEXTCOLL_HEADER);
+ aTmp += *pStr;
+ aTmp += ')';
+ SetText(aTmp);
+ }
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AddTabPage(TP_CHAR_STD, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), 0 );
+ AddTabPage(TP_CHAR_EXT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), 0 );
+ AddTabPage(TP_CHAR_POS, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), 0 );
+ AddTabPage(TP_CHAR_TWOLN, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), 0 );
+ AddTabPage(TP_CHAR_URL, SwCharURLPage::Create, 0);
+ AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
+
+ SvtCJKOptions aCJKOptions;
+ if(bIsDrwTxtMode)
+ {
+ RemoveTabPage( TP_CHAR_URL );
+ RemoveTabPage( TP_BACKGROUND );
+ RemoveTabPage( TP_CHAR_TWOLN );
+ }
+ else if(!aCJKOptions.IsDoubleLinesEnabled())
+ RemoveTabPage( TP_CHAR_TWOLN );
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwCharDlg::~SwCharDlg()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: FontList setzen
+ --------------------------------------------------------------------*/
+
+
+
+void SwCharDlg::PageCreated( USHORT nId, SfxTabPage &rPage )
+{
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ switch( nId )
+ {
+ case TP_CHAR_STD:
+ {
+ SvxFontListItem aFontListItem( *( (SvxFontListItem*)
+ ( rView.GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) ) );
+ aSet.Put (SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
+ if(!bIsDrwTxtMode)
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER));
+ rPage.PageCreated(aSet);
+ }
+ break;
+ case TP_CHAR_EXT:
+ if(bIsDrwTxtMode)
+ aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
+
+ else
+ {
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER|SVX_ENABLE_FLASH));
+ }
+ rPage.PageCreated(aSet);
+ break;
+ case TP_CHAR_POS:
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER));
+ rPage.PageCreated(aSet);
+ break;
+ case TP_CHAR_TWOLN:
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER));
+ rPage.PageCreated(aSet);
+ break;
+ }
+}
+
+/*-----------------14.08.96 11.28-------------------
+
+--------------------------------------------------*/
+
+SwCharURLPage::SwCharURLPage( Window* pParent,
+ const SfxItemSet& rCoreSet ) :
+ SfxTabPage( pParent, SW_RES( TP_CHAR_URL ), rCoreSet ),
+ aURLFL ( this, SW_RES(FL_URL)),
+
+ aURLFT( this, SW_RES(FT_URL )),
+ aURLED( this, SW_RES(ED_URL )),
+ aTextFT( this, SW_RES(FT_TEXT )),
+ aTextED( this, SW_RES(ED_TEXT )),
+ aNameFT( this, SW_RES(FT_NAME )),
+ aNameED( this, SW_RES(ED_NAME)),
+ aTargetFrmFT( this, SW_RES(FT_TARGET )),
+ aTargetFrmLB( this, SW_RES(LB_TARGET )),
+ aURLPB( this, SW_RES(PB_URL )),
+ aEventPB( this, SW_RES(PB_EVENT )),
+ aStyleFL( this, SW_RES(FL_STYLE )),
+ aVisitedFT( this, SW_RES(FT_VISITED )),
+ aVisitedLB( this, SW_RES(LB_VISITED )),
+ aNotVisitedFT( this, SW_RES(FT_NOT_VISITED)),
+ aNotVisitedLB( this, SW_RES(LB_NOT_VISITED)),
+ pINetItem(0),
+ bModified(FALSE)
+
+{
+ FreeResource();
+
+ const SfxPoolItem* pItem;
+ SfxObjectShell* pShell;
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_HTML_MODE, FALSE, &pItem) ||
+ ( 0 != ( pShell = SfxObjectShell::Current()) &&
+ 0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
+ {
+ USHORT nHtmlMode = ((const SfxUInt16Item*)pItem)->GetValue();
+ if(HTMLMODE_ON & nHtmlMode)
+ {
+ aStyleFL.Hide();
+ aVisitedFT.Hide();
+ aVisitedLB.Hide();
+ aNotVisitedFT.Hide();
+ aNotVisitedLB.Hide();
+ }
+ }
+
+ aURLPB.SetClickHdl (LINK( this, SwCharURLPage, InsertFileHdl));
+ aEventPB.SetClickHdl(LINK( this, SwCharURLPage, EventHdl ));
+
+ SwView *pView = ::GetActiveView();
+ ::FillCharStyleListBox(aVisitedLB, pView->GetDocShell());
+ ::FillCharStyleListBox(aNotVisitedLB, pView->GetDocShell());
+
+ TargetList* pList = new TargetList;
+ const SfxFrame& rFrame = pView->GetViewFrame()->GetTopFrame();
+ rFrame.GetTargetList(*pList);
+ USHORT nCount = (USHORT)pList->Count();
+ if( nCount )
+ {
+ USHORT i;
+
+ for ( i = 0; i < nCount; i++ )
+ {
+ aTargetFrmLB.InsertEntry(*pList->GetObject(i));
+ }
+ for ( i = nCount; i; i-- )
+ {
+ delete pList->GetObject( i - 1 );
+ }
+ }
+ delete pList;
+
+
+}
+
+/*-----------------15.08.96 09.04-------------------
+
+--------------------------------------------------*/
+
+SwCharURLPage::~SwCharURLPage()
+{
+ delete pINetItem;
+}
+
+/*-----------------14.08.96 11.31-------------------
+
+--------------------------------------------------*/
+
+void SwCharURLPage::Reset(const SfxItemSet& rSet)
+{
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rSet.GetItemState(RES_TXTATR_INETFMT, FALSE, &pItem))
+ {
+ const SwFmtINetFmt* pINetFmt = (const SwFmtINetFmt*)pItem;
+ aURLED.SetText( INetURLObject::decode( pINetFmt->GetValue(),
+ INET_HEX_ESCAPE,
+ INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 ));
+ aURLED.SaveValue();
+ aNameED.SetText(pINetFmt->GetName());
+ String sEntry = pINetFmt->GetVisitedFmt();
+ if( !sEntry.Len() )
+ SwStyleNameMapper::FillUIName( RES_POOLCHR_INET_VISIT, sEntry );
+ aVisitedLB.SelectEntry(sEntry);
+ sEntry = pINetFmt->GetINetFmt();
+ if(!sEntry.Len())
+ SwStyleNameMapper::FillUIName( RES_POOLCHR_INET_NORMAL, sEntry );
+ aNotVisitedLB.SelectEntry(sEntry);
+
+ aTargetFrmLB.SetText(pINetFmt->GetTargetFrame());
+ aVisitedLB. SaveValue();
+ aNotVisitedLB.SaveValue();
+ aTargetFrmLB. SaveValue();
+ pINetItem = new SvxMacroItem(FN_INET_FIELD_MACRO);
+
+ if( pINetFmt->GetMacroTbl() )
+ pINetItem->SetMacroTable( *pINetFmt->GetMacroTbl() );
+ }
+ if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_SELECTION, FALSE, &pItem))
+ {
+ aTextED.SetText(((const SfxStringItem*)pItem)->GetValue());
+ aTextFT.Enable( FALSE );
+ aTextED.Enable( FALSE );
+ }
+}
+
+/*-----------------14.08.96 11.32-------------------
+
+--------------------------------------------------*/
+
+BOOL SwCharURLPage::FillItemSet(SfxItemSet& rSet)
+{
+ ::rtl::OUString sURL = aURLED.GetText();
+ if(sURL.getLength())
+ {
+ sURL = URIHelper::SmartRel2Abs(INetURLObject(), sURL, Link(), false );
+ // #i100683# file URLs should be normalized in the UI
+ static const sal_Char* pFile = "file:";
+ sal_Int32 nLength = ((sal_Int32)sizeof(pFile)-1);
+ if( sURL.copy(0, nLength ).equalsAsciiL( pFile, nLength ))
+ sURL = URIHelper::simpleNormalizedMakeRelative(::rtl::OUString(), sURL);
+ }
+
+ SwFmtINetFmt aINetFmt(sURL, aTargetFrmLB.GetText());
+ aINetFmt.SetName(aNameED.GetText());
+ bModified |= aURLED.GetText() != aURLED.GetSavedValue();
+ bModified |= aNameED.IsModified();
+ bModified |= aTargetFrmLB.GetSavedValue() != aTargetFrmLB.GetText();
+
+ //zuerst die gueltigen Einstellungen setzen
+ String sEntry = aVisitedLB.GetSelectEntry();
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName( sEntry, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
+ aINetFmt.SetVisitedFmtId(nId);
+ aINetFmt.SetVisitedFmt(nId == RES_POOLCHR_INET_VISIT ? aEmptyStr : sEntry);
+
+ sEntry = aNotVisitedLB.GetSelectEntry();
+ nId = SwStyleNameMapper::GetPoolIdFromUIName( sEntry, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
+ aINetFmt.SetINetFmtId( nId );
+ aINetFmt.SetINetFmt(nId == RES_POOLCHR_INET_NORMAL ? aEmptyStr : sEntry);
+
+ if( pINetItem && pINetItem->GetMacroTable().Count() )
+ aINetFmt.SetMacroTbl( &pINetItem->GetMacroTable() );
+
+ if(aVisitedLB.GetSavedValue() != aVisitedLB.GetSelectEntryPos())
+ bModified = TRUE;
+
+ if(aNotVisitedLB.GetSavedValue() != aNotVisitedLB.GetSelectEntryPos())
+ bModified = TRUE;
+
+ if(aTextED.IsModified())
+ {
+ bModified = TRUE;
+ rSet.Put(SfxStringItem(FN_PARAM_SELECTION, aTextED.GetText()));
+ }
+ if(bModified)
+ rSet.Put(aINetFmt);
+ return bModified;
+}
+
+
+/*-----------------14.08.96 11.30-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* SwCharURLPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwCharURLPage( pParent, rAttrSet ) );
+}
+
+/*-----------------14.08.96 15.00-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK( SwCharURLPage, InsertFileHdl, PushButton *, EMPTYARG )
+{
+ FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 );
+ if( aDlgHelper.Execute() == ERRCODE_NONE )
+ {
+ Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+ aURLED.SetText(xFP->getFiles().getConstArray()[0]);
+ }
+ return 0;
+}
+/*-----------------14.08.96 15.00-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK( SwCharURLPage, EventHdl, PushButton *, EMPTYARG )
+{
+ bModified |= SwMacroAssignDlg::INetFmtDlg( this,
+ ::GetActiveView()->GetWrtShell(), pINetItem );
+ return 0;
+}
+
+
diff --git a/sw/source/ui/chrdlg/chardlg.hrc b/sw/source/ui/chrdlg/chardlg.hrc
new file mode 100644
index 000000000000..48a661bfebec
--- /dev/null
+++ b/sw/source/ui/chrdlg/chardlg.hrc
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define FONT_FT 1
+#define FONT_CB 2
+#define FACE_FT 3
+#define FACE_LB 4
+#define SIZE_FT 5
+#define SIZE_CB 6
+#define OUTLINE_TB 7
+#define SHADOW_TB 8
+#define UNDERL_TB 9
+#define STRIKETHRU_TB 10
+#define COLOR_FT 11
+#define COLOR_LB 12
+#define LANG_FT 13
+#define LANG_LB 14
+#define EXAMPLE_WN 15
+#define EXAMPLE_FL 16
+#define CASEMAP_FL 17
+#define NONE_RB 20
+#define CAPS_RB 21
+#define LOWERCASE_RB 22
+#define SMALLCAPS_RB 23
+#define TITEL_RB 24
+#define HIGH_RB 25
+#define NORMAL_RB 26
+#define DEEP_RB 27
+#define DEEPHIGHT_FT 28
+#define DEEPHIGH_MF 29
+#define RELSIZE_FT 30
+#define RELSIZE_MF 31
+#define KERN_LB 32
+#define KERN_FT 33
+#define KERN_MF 34
+#define UNDERLINE_FT 35
+#define UNDERLINE_LB 36
+#define STRIKE_FT 37
+#define STRIKE_LB 38
+#define STRIKE_CB 39
+#define EFFECT_FL 41
+#define POS_FL 42
+#define POSEXT_FL 43
+#define KERN_FL 45
+#define FONTTYPE_FT 46
+
+#define FL_URL 50
+#define FT_URL 51
+#define ED_URL 52
+#define FL_STYLE 53
+#define FT_VISITED 55
+#define LB_VISITED 56
+#define FT_NOT_VISITED 57
+#define LB_NOT_VISITED 58
+#define PB_EVENT 59
+#define PB_URL 60
+#define LB_TARGET 61
+#define FT_TARGET 62
+#define FT_TEXT 63
+#define ED_TEXT 64
+#define FT_NAME 65
+#define ED_NAME 66
+
diff --git a/sw/source/ui/chrdlg/chardlg.src b/sw/source/ui/chrdlg/chardlg.src
new file mode 100644
index 000000000000..2117a9024a2a
--- /dev/null
+++ b/sw/source/ui/chrdlg/chardlg.src
@@ -0,0 +1,272 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "chrdlg.hrc"
+#include "chardlg.hrc"
+#include "helpid.h"
+
+TabDialog DLG_CHAR
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Character" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_CHAR_STD ;
+ Text [ en-US ] = "Font" ;
+ PageResID = TP_CHAR_STD ;
+ };
+ PageItem
+ {
+ Identifier = TP_CHAR_EXT ;
+ Text [ en-US ] = "Font Effects" ;
+ PageResID = TP_CHAR_EXT ;
+ };
+ PageItem
+ {
+ Identifier = TP_CHAR_POS ;
+ PageResID = TP_CHAR_POS ;
+ Text [ en-US ] = "Position";
+ };
+ PageItem
+ {
+ Identifier = TP_CHAR_TWOLN ;
+ PageResID = TP_CHAR_TWOLN;
+ Text [ en-US ] = "Asian Layout";
+ };
+ PageItem
+ {
+ Identifier = TP_CHAR_URL ;
+ Text [ en-US ] = "Hyperlink" ;
+ };
+ PageItem
+ {
+ Identifier = TP_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ PageResID = TP_BACKGROUND ;
+ };
+ };
+ };
+};
+TabDialog DLG_DRAWCHAR
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Font" ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_CHAR_STD ;
+ Text [ en-US ] = "Font" ;
+ PageResID = TP_CHAR_STD ;
+ };
+ };
+ };
+};
+TabPage TP_CHAR_URL
+{
+ HelpID = HID_CHAR_URL ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_URL
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Hyperlink" ;
+ };
+ FixedText FT_URL
+ {
+ Pos = MAP_APPFONT ( 12 , 17 ) ;
+ Size = MAP_APPFONT ( 73 , 8 ) ;
+ Text [ en-US ] = "~URL" ;
+ };
+ Edit ED_URL
+ {
+ HelpID = "sw:Edit:TP_CHAR_URL:ED_URL";
+ Pos = MAP_APPFONT ( 88 , 15 ) ;
+ Size = MAP_APPFONT ( 104 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_URL
+ {
+ HelpID = "sw:PushButton:TP_CHAR_URL:PB_URL";
+ Pos = MAP_APPFONT ( 198 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Browse..." ;
+ };
+ FixedText FT_TEXT
+ {
+ Pos = MAP_APPFONT ( 12 , 33 ) ;
+ Size = MAP_APPFONT ( 73 , 8 ) ;
+ Text [ en-US ] = "Te~xt";
+ };
+ Edit ED_TEXT
+ {
+ HelpID = "sw:Edit:TP_CHAR_URL:ED_TEXT";
+ Pos = MAP_APPFONT ( 88 , 31 ) ;
+ Size = MAP_APPFONT ( 104 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 49 ) ;
+ Size = MAP_APPFONT ( 73 , 8 ) ;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit ED_NAME
+ {
+ HelpID = "sw:Edit:TP_CHAR_URL:ED_NAME";
+ Pos = MAP_APPFONT ( 88 , 47 ) ;
+ Size = MAP_APPFONT ( 104 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ FixedText FT_TARGET
+ {
+ Pos = MAP_APPFONT ( 12 , 65 ) ;
+ Size = MAP_APPFONT ( 73 , 10 ) ;
+ Text [ en-US ] = "~Target frame" ;
+ };
+ ComboBox LB_TARGET
+ {
+ HelpID = "sw:ComboBox:TP_CHAR_URL:LB_TARGET";
+ Pos = MAP_APPFONT ( 88 , 63 ) ;
+ Size = MAP_APPFONT ( 104 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ Group = TRUE ;
+ };
+ PushButton PB_EVENT
+ {
+ HelpID = "sw:PushButton:TP_CHAR_URL:PB_EVENT";
+ Pos = MAP_APPFONT ( 12 , 79 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Events..." ;
+ };
+ FixedLine FL_STYLE
+ {
+ Pos = MAP_APPFONT ( 6 , 104 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Character Styles" ;
+ };
+ FixedText FT_VISITED
+ {
+ Pos = MAP_APPFONT ( 12 , 116 ) ;
+ Size = MAP_APPFONT ( 73 , 8 ) ;
+ Text [ en-US ] = "~Visited links" ;
+ };
+ ListBox LB_VISITED
+ {
+ HelpID = "sw:ListBox:TP_CHAR_URL:LB_VISITED";
+ Pos = MAP_APPFONT ( 88 , 113 ) ;
+ Size = MAP_APPFONT ( 104 , 60 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ Group = TRUE ;
+ };
+ FixedText FT_NOT_VISITED
+ {
+ Pos = MAP_APPFONT ( 12 , 131 ) ;
+ Size = MAP_APPFONT ( 73 , 10 ) ;
+ Text [ en-US ] = "Unvisited ~links" ;
+ };
+ ListBox LB_NOT_VISITED
+ {
+ HelpID = "sw:ListBox:TP_CHAR_URL:LB_NOT_VISITED";
+ Pos = MAP_APPFONT ( 88 , 129 ) ;
+ Size = MAP_APPFONT ( 104 , 60 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ Group = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/chrdlg/chrdlg.src b/sw/source/ui/chrdlg/chrdlg.src
new file mode 100644
index 000000000000..297668f6093a
--- /dev/null
+++ b/sw/source/ui/chrdlg/chrdlg.src
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "chrdlg.hrc"
+String STR_TEXTCOLL_HEADER
+{
+ Text [ en-US ] = "(Paragraph Style: " ;
+};
+String STR_PAGEFMT_HEADER
+{
+ Text [ en-US ] = "(Page Style: " ;
+};
+String SW_STR_NONE
+{
+ Text [ en-US ] = "[None]" ;
+};
+InfoBox MSG_ILLEGAL_PAGENUM
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ /* ### ACHTUNG: Neuer Text in Resource? Seitennummer kann nicht gesetzt werden. Auf linken Seiten dürfen nur gerade Seitenzahlen, auf rechten Seiten nur ungerade Seitenzahlen verwendet werden. : Seitennummer kann nicht gesetzt werden. Auf linken Seiten d³rfen nur gerade Seitenzahlen, auf rechten Seiten nur ungerade Seitenzahlen verwendet werden. */
+ Message [ en-US ] = "Page numbers cannot be applied to the current page. Even numbers can be used on left pages, odd numbers on right pages." ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx
new file mode 100644
index 000000000000..f31e5d7dc7a7
--- /dev/null
+++ b/sw/source/ui/chrdlg/drpcps.cxx
@@ -0,0 +1,894 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#include <hintids.hxx>
+#define _SVSTDARR_STRINGSDTOR
+#define _SVSTDARR_STRINGSISORTDTOR
+#include <svl/svstdarr.hxx>
+
+#include "cmdid.h"
+#include "swmodule.hxx"
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "globals.hrc"
+
+
+#ifndef _METRIC_HXX //autogen
+#include <vcl/metric.hxx>
+#endif
+#include <svl/stritem.hxx>
+#include <editeng/fontitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <sfx2/objsh.hxx>
+#include <editeng/svxfont.hxx>
+#include <vcl/print.hxx>
+#include <sfx2/printer.hxx>
+#ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_
+#include <com/sun/star/i18n/ScriptType.hdl>
+#endif
+#include <editeng/scripttypeitem.hxx>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <comphelper/processfactory.hxx>
+
+#define _SVSTDARR_XUB_STRLEN
+#define _SVSTDARR_USHORTS
+#define _SVSTDARR_ULONGS
+#include <svl/svstdarr.hxx>
+
+#include "charatr.hxx"
+#include "viewopt.hxx"
+#include "drpcps.hxx"
+#include "paratr.hxx"
+#include "uitool.hxx"
+#include "charfmt.hxx"
+
+#include "chrdlg.hrc"
+#include "drpcps.hrc"
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+//using namespace i18n; !using this namespace leads to mysterious conflicts with ScriptType::...!
+// so don't use this instead of the following defines!
+
+#define I18N ::com::sun::star::i18n
+#define I18N_SCRIPTTYPE ::com::sun::star::i18n::ScriptType
+
+// Globals ******************************************************************
+
+static USHORT __FAR_DATA aPageRg[] = {
+ RES_PARATR_DROP, RES_PARATR_DROP,
+ 0
+};
+
+
+
+// class SwDropCapsPict *****************************************************
+
+class SwDropCapsPict : public Control
+{
+ String maText;
+ String maScriptText;
+ Color maBackColor;
+ Color maTextLineColor;
+ BYTE mnLines;
+ long mnTotLineH;
+ long mnLineH;
+ long mnTextH;
+ USHORT mnDistance;
+ sal_Int32 mnLeading;
+ Printer* mpPrinter;
+ BOOL mbDelPrinter;
+ SvULongs maTextWidth;
+ SvXub_StrLens maScriptChg;
+ SvUShorts maScriptType;
+ SvxFont maFont;
+ SvxFont maCJKFont;
+ SvxFont maCTLFont;
+ Size maTextSize;
+ Reference< I18N::XBreakIterator > xBreak;
+
+ virtual void Paint(const Rectangle &rRect);
+ void CheckScript( void );
+ Size CalcTextSize( void );
+ inline void InitPrinter( void );
+ void _InitPrinter( void );
+ void GetFontSettings( const SwDropCapsPage& _rPage, Font& _rFont, USHORT _nWhich );
+public:
+
+ SwDropCapsPict(Window *pParent, const ResId &rResId) :
+ Control(pParent, rResId), mpPrinter( NULL ), mbDelPrinter( FALSE ) {}
+ ~SwDropCapsPict();
+
+ void UpdatePaintSettings( void ); // also invalidates control!
+
+ inline void SetText( const String& rT );
+ inline void SetLines( BYTE nL );
+ inline void SetDistance( USHORT nD );
+ inline void SetValues( const String& rText, BYTE nLines, USHORT nDistance );
+
+ void DrawPrev( const Point& rPt );
+};
+
+inline void SwDropCapsPict::SetText( const String& rT )
+{
+ maText = rT;
+ UpdatePaintSettings();
+}
+
+inline void SwDropCapsPict::SetLines( BYTE nL )
+{
+ mnLines = nL;
+ UpdatePaintSettings();
+}
+
+inline void SwDropCapsPict::SetDistance( USHORT nD )
+{
+ mnDistance = nD;
+ UpdatePaintSettings();
+}
+
+inline void SwDropCapsPict::SetValues( const String& rText, BYTE nLines, USHORT nDistance )
+{
+ maText = rText;
+ mnLines = nLines;
+ mnDistance = nDistance;
+
+ UpdatePaintSettings();
+}
+
+inline void SwDropCapsPict::InitPrinter( void )
+{
+ if( !mpPrinter )
+ _InitPrinter();
+}
+
+/****************************************************************************
+Default-String aus Zeichenanzahl erzeugen (A, AB, ABC, ...)
+****************************************************************************/
+
+
+String GetDefaultString(USHORT nChars)
+{
+ String aStr;
+ for (USHORT i = 0; i < nChars; i++)
+ aStr += String((char) (i + 65));
+ return aStr;
+}
+
+static void calcFontHeightAnyAscent( OutputDevice* _pWin, Font& _rFont, long& _nHeight, long& _nAscent )
+{
+ if ( !_nHeight )
+ {
+ _pWin->SetFont( _rFont );
+ FontMetric aMetric( _pWin->GetFontMetric() );
+ _nHeight = aMetric.GetLineHeight();
+ _nAscent = aMetric.GetAscent();
+ }
+}
+
+/****************************************************************************
+Pict: Dtor
+****************************************************************************/
+
+
+ SwDropCapsPict::~SwDropCapsPict()
+{
+ if( mbDelPrinter )
+ delete mpPrinter;
+}
+
+/****************************************************************************
+Pict: Update Font
+****************************************************************************/
+
+#define LINES 10
+#define BORDER 2
+
+void SwDropCapsPict::GetFontSettings( const SwDropCapsPage& _rPage, Font& _rFont, USHORT _nWhich )
+{
+ SfxItemSet aSet( _rPage.rSh.GetAttrPool(), _nWhich, _nWhich);
+ _rPage.rSh.GetCurAttr(aSet);
+ SvxFontItem aFmtFont((SvxFontItem &) aSet.Get(_nWhich));
+
+ _rFont.SetFamily (aFmtFont.GetFamily());
+ _rFont.SetName (aFmtFont.GetFamilyName());
+ _rFont.SetPitch (aFmtFont.GetPitch());
+ _rFont.SetCharSet(aFmtFont.GetCharSet());
+}
+
+void SwDropCapsPict::UpdatePaintSettings( void )
+{
+ maBackColor = GetSettings().GetStyleSettings().GetWindowColor();
+ maTextLineColor = Color( COL_LIGHTGRAY );
+
+ // gray lines
+ mnTotLineH = (GetOutputSizePixel().Height() - 2 * BORDER) / LINES;
+ mnLineH = mnTotLineH - 2;
+ mnLeading = GetFontMetric().GetIntLeading();
+
+ Font aFont;
+ {
+ SwDropCapsPage* pPage = ( SwDropCapsPage* ) GetParent();
+ if (!pPage->aTemplateBox.GetSelectEntryPos())
+ {
+ // Font an Absatzanfang erfragen
+ pPage->rSh.SttCrsrMove();
+ pPage->rSh.Push();
+ pPage->rSh.ClearMark();
+ SwWhichPara pSwuifnParaCurr = GetfnParaCurr();
+ SwPosPara pSwuifnParaStart = GetfnParaStart();
+ pPage->rSh.MovePara(pSwuifnParaCurr,pSwuifnParaStart);
+ // normal
+ GetFontSettings( *pPage, aFont, RES_CHRATR_FONT );
+
+ // CJK
+ GetFontSettings( *pPage, maCJKFont, RES_CHRATR_CJK_FONT );
+
+ // CTL
+ GetFontSettings( *pPage, maCTLFont, RES_CHRATR_CTL_FONT );
+
+ pPage->rSh.Pop(FALSE);
+ pPage->rSh.EndCrsrMove();
+ }
+ else
+ {
+ // Font an Zeichenvorlage erfragen
+ SwCharFmt *pFmt = pPage->rSh.GetCharStyle(
+ pPage->aTemplateBox.GetSelectEntry(),
+ SwWrtShell::GETSTYLE_CREATEANY );
+ ASSERT(pFmt, "Zeichenvorlage existiert nicht!");
+ const SvxFontItem &rFmtFont = pFmt->GetFont();
+
+ aFont.SetFamily (rFmtFont.GetFamily());
+ aFont.SetName (rFmtFont.GetFamilyName());
+ aFont.SetPitch (rFmtFont.GetPitch());
+ aFont.SetCharSet(rFmtFont.GetCharSet());
+ }
+ }
+
+ mnTextH = mnLines * mnTotLineH;
+ aFont.SetSize(Size(0, mnTextH));
+ maCJKFont.SetSize(Size(0, mnTextH));
+ maCTLFont.SetSize(Size(0, mnTextH));
+
+ aFont.SetTransparent(TRUE);
+ maCJKFont.SetTransparent(TRUE);
+ maCTLFont.SetTransparent(TRUE);
+
+ aFont.SetColor( SwViewOption::GetFontColor() );
+ maCJKFont.SetColor( SwViewOption::GetFontColor() );
+ maCTLFont.SetColor( SwViewOption::GetFontColor() );
+
+ aFont.SetFillColor(GetSettings().GetStyleSettings().GetWindowColor());
+ maCJKFont.SetFillColor(GetSettings().GetStyleSettings().GetWindowColor());
+ maCTLFont.SetFillColor(GetSettings().GetStyleSettings().GetWindowColor());
+
+ maCJKFont.SetSize(Size(0, maCJKFont.GetSize().Height() + mnLeading));
+ maCTLFont.SetSize(Size(0, maCTLFont.GetSize().Height() + mnLeading));
+
+ SetFont(aFont);
+ aFont.SetSize(Size(0, aFont.GetSize().Height() + mnLeading));
+ SetFont(aFont);
+ maFont = aFont;
+
+ CheckScript();
+
+ maTextSize = CalcTextSize();
+
+ Invalidate();
+}
+
+/****************************************************************************
+Pict: Paint-Overload
+****************************************************************************/
+
+void SwDropCapsPict::Paint(const Rectangle &/*rRect*/)
+{
+ if (!IsVisible())
+ return;
+
+ SetMapMode(MapMode(MAP_PIXEL));
+ SetLineColor();
+
+ SetFillColor( maBackColor );
+
+ Size aOutputSizePixel( GetOutputSizePixel() );
+
+ DrawRect(Rectangle(Point(0, 0), aOutputSizePixel ));
+ SetClipRegion(Region(Rectangle(
+ Point(BORDER, BORDER),
+ Size (aOutputSizePixel.Width () - 2 * BORDER,
+ aOutputSizePixel.Height() - 2 * BORDER))));
+
+ ASSERT(mnLineH > 0, "So klein lassen wir uns nicht machen");
+ long nY0 = (aOutputSizePixel.Height() - (LINES * mnTotLineH)) / 2;
+ SetFillColor( maTextLineColor );
+ for (USHORT i = 0; i < LINES; ++i)
+ DrawRect(Rectangle(Point(BORDER, nY0 + i * mnTotLineH), Size(aOutputSizePixel.Width() - 2 * BORDER, mnLineH)));
+
+ // Texthintergrund mit Abstand (240 twips ~ 1 Zeilenhoehe)
+ ULONG lDistance = mnDistance;
+ USHORT nDistW = (USHORT) (ULONG) (((lDistance * 100) / 240) * mnTotLineH) / 100;
+ SetFillColor( maBackColor );
+ if(((SwDropCapsPage*)GetParent())->aDropCapsBox.IsChecked())
+ {
+ Size aTextSize( maTextSize );
+ aTextSize.Width() += nDistW;
+ DrawRect( Rectangle( Point( BORDER, nY0 ), aTextSize ) );
+
+ // Text zeichnen
+ DrawPrev( Point( BORDER, nY0 - mnLeading ) );
+ }
+
+ SetClipRegion();
+}
+
+void SwDropCapsPict::DrawPrev( const Point& rPt )
+{
+ Point aPt(rPt);
+ InitPrinter();
+
+ Font aOldFont = mpPrinter->GetFont();
+ USHORT nScript;
+ size_t nIdx = 0;
+ xub_StrLen nStart = 0;
+ xub_StrLen nEnd;
+ size_t nCnt = maScriptChg.size();
+
+ if( nCnt )
+ {
+ nEnd = maScriptChg[ nIdx ];
+ nScript = maScriptType[ nIdx ];
+ }
+ else
+ {
+ nEnd = maText.Len();
+ nScript = I18N_SCRIPTTYPE::LATIN;
+ }
+ do
+ {
+ SvxFont& rFnt = (nScript==I18N_SCRIPTTYPE::ASIAN) ? maCJKFont : ((nScript==I18N_SCRIPTTYPE::COMPLEX) ? maCTLFont : maFont);
+ mpPrinter->SetFont( rFnt );
+
+ rFnt.DrawPrev( this, mpPrinter, aPt, maText, nStart, nEnd - nStart );
+
+ aPt.X() += maTextWidth[ nIdx++ ];
+ if( nEnd < maText.Len() && nIdx < nCnt )
+ {
+ nStart = nEnd;
+ nEnd = maScriptChg[ nIdx ];
+ nScript = maScriptType[ nIdx ];
+ }
+ else
+ break;
+ }
+ while( TRUE );
+ mpPrinter->SetFont( aOldFont );
+}
+
+void SwDropCapsPict::CheckScript( void )
+{
+ if( maScriptText == maText )
+ return;
+
+ maScriptText = maText;
+ size_t nCnt = maScriptChg.size();
+ if( nCnt )
+ {
+ maScriptChg.clear();
+ maScriptType.Remove( 0, nCnt );
+ maTextWidth.Remove( 0, nCnt );
+ nCnt = 0;
+ }
+ if( !xBreak.is() )
+ {
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ xBreak = Reference< I18N::XBreakIterator >(xMSF->createInstance(
+ ::rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ),UNO_QUERY);
+ }
+ if( xBreak.is() )
+ {
+ USHORT nScript = xBreak->getScriptType( maText, 0 );
+ USHORT nChg = 0;
+ if( I18N_SCRIPTTYPE::WEAK == nScript )
+ {
+ nChg = (xub_StrLen)xBreak->endOfScript( maText, nChg, nScript );
+ if( nChg < maText.Len() )
+ nScript = xBreak->getScriptType( maText, nChg );
+ else
+ nScript = I18N_SCRIPTTYPE::LATIN;
+ }
+
+ do
+ {
+ nChg = (xub_StrLen)xBreak->endOfScript( maText, nChg, nScript );
+ maScriptChg.push_back( nChg );
+ maScriptType.Insert( nScript, nCnt );
+ maTextWidth.Insert( ULONG(0), nCnt++ );
+
+ if( nChg < maText.Len() )
+ nScript = xBreak->getScriptType( maText, nChg );
+ else
+ break;
+ } while( TRUE );
+ }
+}
+
+Size SwDropCapsPict::CalcTextSize( void )
+{
+ InitPrinter();
+
+ USHORT nScript;
+ size_t nIdx = 0;
+ xub_StrLen nStart = 0;
+ xub_StrLen nEnd;
+ size_t nCnt = maScriptChg.size();
+ if( nCnt )
+ {
+ nEnd = maScriptChg[ nIdx ];
+ nScript = maScriptType[ nIdx ];
+ }
+ else
+ {
+ nEnd = maText.Len();
+ nScript = I18N_SCRIPTTYPE::LATIN;
+ }
+ long nTxtWidth = 0;
+ long nCJKHeight = 0;
+ long nCTLHeight = 0;
+ long nHeight = 0;
+ long nAscent = 0;
+ long nCJKAscent = 0;
+ long nCTLAscent = 0;
+ do
+ {
+ SvxFont& rFnt = ( nScript == I18N_SCRIPTTYPE::ASIAN )? maCJKFont :
+ ( ( nScript == I18N_SCRIPTTYPE::COMPLEX )? maCTLFont : maFont );
+ ULONG nWidth = rFnt.GetTxtSize( mpPrinter, maText, nStart, nEnd-nStart ).Width();
+
+ if( nIdx < maTextWidth.Count() )
+ maTextWidth[ nIdx++ ] = nWidth;
+ nTxtWidth += nWidth;
+ switch(nScript)
+ {
+ case I18N_SCRIPTTYPE::ASIAN:
+ calcFontHeightAnyAscent( this, maCJKFont, nCJKHeight, nCJKAscent );
+ break;
+ case I18N_SCRIPTTYPE::COMPLEX:
+ calcFontHeightAnyAscent( this, maCTLFont, nCTLHeight, nCTLAscent );
+ break;
+ default:
+ calcFontHeightAnyAscent( this, maFont, nHeight, nAscent );
+ }
+
+ if( nEnd < maText.Len() && nIdx < nCnt )
+ {
+ nStart = nEnd;
+ nEnd = maScriptChg[ nIdx ];
+ nScript = maScriptType[ nIdx ];
+ }
+ else
+ break;
+ }
+ while( TRUE );
+ nHeight -= nAscent;
+ nCJKHeight -= nCJKAscent;
+ nCTLHeight -= nCTLAscent;
+ if( nHeight < nCJKHeight )
+ nHeight = nCJKHeight;
+ if( nAscent < nCJKAscent )
+ nAscent = nCJKAscent;
+ if( nHeight < nCTLHeight )
+ nHeight = nCTLHeight;
+ if( nAscent < nCTLAscent )
+ nAscent = nCTLAscent;
+ nHeight += nAscent;
+
+ Size aTxtSize( nTxtWidth, nHeight );
+ return aTxtSize;
+}
+
+void SwDropCapsPict::_InitPrinter()
+{
+ SfxViewShell* pSh = SfxViewShell::Current();
+
+ if ( pSh )
+ mpPrinter = pSh->GetPrinter();
+
+ if ( !mpPrinter )
+ {
+ mpPrinter = new Printer;
+ mbDelPrinter = TRUE;
+ }
+}
+
+/****************************************************************************
+Dlg: Ctor
+****************************************************************************/
+
+
+SwDropCapsDlg::SwDropCapsDlg(Window *pParent, const SfxItemSet &rSet ) :
+
+ SfxSingleTabDialog(pParent, rSet, 0)
+
+{
+ SwDropCapsPage* pNewPage = (SwDropCapsPage*) SwDropCapsPage::Create(this, rSet);
+ pNewPage->SetFormat(FALSE);
+ SetTabPage(pNewPage);
+}
+
+/****************************************************************************
+Dlg: Dtor
+****************************************************************************/
+
+
+ SwDropCapsDlg::~SwDropCapsDlg()
+{
+}
+
+/****************************************************************************
+Page: Ctor
+****************************************************************************/
+
+
+SwDropCapsPage::SwDropCapsPage(Window *pParent, const SfxItemSet &rSet) :
+
+ SfxTabPage(pParent, SW_RES(TP_DROPCAPS), rSet),
+
+ aDropCapsBox (this, SW_RES(CB_SWITCH )),
+ aWholeWordCB (this, SW_RES(CB_WORD )),
+ aSwitchText (this, SW_RES(FT_DROPCAPS )),
+ aDropCapsField(this, SW_RES(FLD_DROPCAPS)),
+ aLinesText (this, SW_RES(TXT_LINES )),
+ aLinesField (this, SW_RES(FLD_LINES )),
+ aDistanceText (this, SW_RES(TXT_DISTANCE)),
+ aDistanceField(this, SW_RES(FLD_DISTANCE)),
+ aSettingsFL (this, SW_RES(FL_SETTINGS)),
+
+ aTextText (this, SW_RES(TXT_TEXT )),
+ aTextEdit (this, SW_RES(EDT_TEXT )),
+ aTemplateText (this, SW_RES(TXT_TEMPLATE)),
+ aTemplateBox (this, SW_RES(BOX_TEMPLATE)),
+ aContentFL (this, SW_RES(FL_CONTENT )),
+
+ pPict (new SwDropCapsPict(this, SW_RES(CNT_PICT))),
+
+ bModified(FALSE),
+ bFormat(TRUE),
+ rSh(::GetActiveView()->GetWrtShell())
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ USHORT nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current());
+ bHtmlMode = nHtmlMode & HTMLMODE_ON ? TRUE : FALSE;
+
+ //Im Vorlagendialog kann der Text nicht beeinflusst werden
+ aTextText.Enable( !bFormat );
+ aTextEdit.Enable( !bFormat );
+
+ // Metriken
+ SetMetric( aDistanceField, GetDfltMetric(bHtmlMode) );
+
+ pPict->SetBorderStyle( WINDOW_BORDER_MONO );
+
+ // Handler installieren
+ Link aLk = LINK(this, SwDropCapsPage, ModifyHdl);
+ aDropCapsField.SetModifyHdl( aLk );
+ aLinesField .SetModifyHdl( aLk );
+ aDistanceField.SetModifyHdl( aLk );
+ aTextEdit .SetModifyHdl( aLk );
+ aDropCapsBox .SetClickHdl (LINK(this, SwDropCapsPage, ClickHdl ));
+ aTemplateBox .SetSelectHdl(LINK(this, SwDropCapsPage, SelectHdl));
+ aWholeWordCB .SetClickHdl (LINK(this, SwDropCapsPage, WholeWordHdl ));
+}
+
+/****************************************************************************
+Page: Dtor
+****************************************************************************/
+
+
+ SwDropCapsPage::~SwDropCapsPage()
+{
+ delete pPict;
+}
+
+
+int SwDropCapsPage::DeactivatePage(SfxItemSet * _pSet)
+{
+ if ( _pSet )
+ FillSet( *_pSet );
+
+ return LEAVE_PAGE;
+}
+
+/****************************************************************************
+Page: Factory
+****************************************************************************/
+
+
+SfxTabPage* SwDropCapsPage::Create(Window *pParent,
+ const SfxItemSet &rSet)
+{
+ return new SwDropCapsPage(pParent, rSet);
+}
+
+/****************************************************************************
+Page: FillItemSet-Overload
+****************************************************************************/
+
+
+BOOL SwDropCapsPage::FillItemSet(SfxItemSet &rSet)
+{
+ if(bModified)
+ FillSet(rSet);
+ return bModified;
+}
+
+/****************************************************************************
+Page: Reset-Overload
+****************************************************************************/
+
+
+void SwDropCapsPage::Reset(const SfxItemSet &rSet)
+{
+ // Zeichen, Zeilen, Abstand und Text
+ SwFmtDrop aFmtDrop((SwFmtDrop &) rSet.Get(RES_PARATR_DROP));
+ if (aFmtDrop.GetLines() > 1)
+ {
+ aDropCapsField.SetValue(aFmtDrop.GetChars());
+ aLinesField .SetValue(aFmtDrop.GetLines());
+ aDistanceField.SetValue(aDistanceField.Normalize(aFmtDrop.GetDistance()), FUNIT_TWIP);
+ aWholeWordCB .Check (aFmtDrop.GetWholeWord());
+ }
+ else
+ {
+ aDropCapsField.SetValue(1);
+ aLinesField .SetValue(3);
+ aDistanceField.SetValue(0);
+ }
+
+ ::FillCharStyleListBox(aTemplateBox, rSh.GetView().GetDocShell(), TRUE);
+
+ aTemplateBox.InsertEntry(SW_RESSTR(SW_STR_NONE), 0);
+ // Vorlage defaulten
+ aTemplateBox.SelectEntryPos(0);
+ if (aFmtDrop.GetCharFmt())
+ aTemplateBox.SelectEntry(aFmtDrop.GetCharFmt()->GetName());
+
+ // Controls enablen
+ aDropCapsBox.Check(aFmtDrop.GetLines() > 1);
+ const USHORT nVal = USHORT(aDropCapsField.GetValue());
+ if (bFormat)
+ aTextEdit.SetText(GetDefaultString(nVal));
+ else
+ {
+ aTextEdit.SetText(rSh.GetDropTxt(nVal));
+ aTextEdit.Enable();
+ aTextText.Enable();
+ }
+
+ // Preview
+ pPict->SetValues( aTextEdit.GetText(),
+ BYTE( aLinesField.GetValue() ),
+ USHORT( aDistanceField.Denormalize( aDistanceField.GetValue( FUNIT_TWIP ) ) ) );
+
+ ClickHdl(&aDropCapsBox);
+ bModified = FALSE;
+}
+
+/****************************************************************************
+Page: Click-Handler der CheckBox
+****************************************************************************/
+
+
+IMPL_LINK( SwDropCapsPage, ClickHdl, Button *, EMPTYARG )
+{
+ BOOL bChecked = aDropCapsBox.IsChecked();
+
+ aWholeWordCB .Enable( bChecked && !bHtmlMode );
+
+ aSwitchText.Enable( bChecked && !aWholeWordCB.IsChecked() );
+ aDropCapsField.Enable( bChecked && !aWholeWordCB.IsChecked() );
+ aLinesText .Enable( bChecked );
+ aLinesField .Enable( bChecked );
+ aDistanceText.Enable( bChecked );
+ aDistanceField.Enable( bChecked );
+ aTemplateText .Enable( bChecked );
+ aTemplateBox .Enable( bChecked );
+ aTextEdit .Enable( bChecked && !bFormat );
+ aTextText .Enable( bChecked && !bFormat );
+
+ if ( bChecked )
+ {
+ ModifyHdl(&aDropCapsField);
+ aDropCapsField.GrabFocus();
+ }
+ else
+ pPict->SetText(aEmptyStr);
+
+ bModified = TRUE;
+
+ return 0;
+}
+
+/****************************************************************************
+Page: Click-Handler der CheckBox
+****************************************************************************/
+
+
+IMPL_LINK( SwDropCapsPage, WholeWordHdl, CheckBox *, EMPTYARG )
+{
+ aDropCapsField.Enable( !aWholeWordCB.IsChecked() );
+
+ ModifyHdl(&aDropCapsField);
+
+ bModified = TRUE;
+
+ return 0;
+}
+
+/****************************************************************************
+Page: Modify-Handler der SpinFields
+****************************************************************************/
+
+
+IMPL_LINK( SwDropCapsPage, ModifyHdl, Edit *, pEdit )
+{
+ String sPreview;
+
+ // Ggf. Text setzen
+ if (pEdit == &aDropCapsField)
+ {
+ USHORT nVal;
+ BOOL bSetText = FALSE;
+
+ if (!aWholeWordCB.IsChecked())
+ nVal = (USHORT)aDropCapsField.GetValue();
+ else
+ nVal = 0;
+
+ if (bFormat || !rSh.GetDropTxt(1).Len())
+ sPreview = GetDefaultString(nVal);
+ else
+ {
+ bSetText = TRUE;
+ sPreview = rSh.GetDropTxt(nVal);
+ }
+
+ String sEdit(aTextEdit.GetText());
+
+ if (sEdit.Len() && sPreview.CompareTo(sEdit, sEdit.Len()) != COMPARE_EQUAL)
+ {
+ sPreview = sEdit.Copy(0, sPreview.Len());
+ bSetText = FALSE;
+ }
+
+ if (bSetText)
+ aTextEdit.SetText(sPreview);
+ }
+ else if (pEdit == &aTextEdit) // Ggf. Anzahl setzen
+ {
+ USHORT nTmp = aTextEdit.GetText().Len();
+ aDropCapsField.SetValue(Max((USHORT)1, nTmp));
+
+ sPreview = aTextEdit.GetText().Copy(0, nTmp);
+ }
+
+ // Bild anpassen
+ if (pEdit == &aDropCapsField || pEdit == &aTextEdit)
+ pPict->SetText (sPreview);
+ else if (pEdit == &aLinesField)
+ pPict->SetLines((BYTE)aLinesField.GetValue());
+ else
+ pPict->SetDistance((USHORT)aDistanceField.Denormalize(aDistanceField.GetValue(FUNIT_TWIP)));
+
+ bModified = TRUE;
+
+ return 0;
+}
+
+/****************************************************************************
+Page: Select-Handler der Template-Box.
+*****************************************************************************/
+
+
+IMPL_LINK_INLINE_START( SwDropCapsPage, SelectHdl, ListBox *, EMPTYARG )
+{
+ pPict->UpdatePaintSettings();
+ bModified = TRUE;
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwDropCapsPage, SelectHdl, ListBox *, EMPTYARG )
+
+
+USHORT* SwDropCapsPage::GetRanges()
+{
+ return aPageRg;
+}
+
+
+void SwDropCapsPage::FillSet( SfxItemSet &rSet )
+{
+ if(bModified)
+ {
+ SwFmtDrop aFmt;
+
+ BOOL bOn = aDropCapsBox.IsChecked();
+ if(bOn)
+ {
+ // Anzahl, Zeilen, Abstand
+ aFmt.GetChars() = (BYTE) aDropCapsField.GetValue();
+ aFmt.GetLines() = (BYTE) aLinesField.GetValue();
+ aFmt.GetDistance() = (USHORT) aDistanceField.Denormalize(aDistanceField.GetValue(FUNIT_TWIP));
+ aFmt.GetWholeWord() = aWholeWordCB.IsChecked();
+
+ // Vorlage
+ if (aTemplateBox.GetSelectEntryPos())
+ aFmt.SetCharFmt(rSh.GetCharStyle(aTemplateBox.GetSelectEntry()));
+ }
+ else
+ {
+ aFmt.GetChars() = 1;
+ aFmt.GetLines() = 1;
+ aFmt.GetDistance() = 0;
+ }
+
+ // Attribute setzen
+ const SfxPoolItem* pOldItem;
+ if(0 == (pOldItem = GetOldItem( rSet, FN_FORMAT_DROPCAPS )) ||
+ aFmt != *pOldItem )
+ rSet.Put(aFmt);
+
+ // Harte Textformatierung
+ // Bug 24974: In Gestalter/Vorlagenkatoplog macht das keinen Sinn!!
+ if( !bFormat && aDropCapsBox.IsChecked() )
+ {
+ String sText(aTextEdit.GetText());
+
+ if (!aWholeWordCB.IsChecked())
+ sText.Erase( static_cast< xub_StrLen >(aDropCapsField.GetValue()));
+
+ SfxStringItem aStr(FN_PARAM_1, sText);
+ rSet.Put( aStr );
+ }
+ }
+}
+
+
+
+
diff --git a/sw/source/ui/chrdlg/drpcps.hrc b/sw/source/ui/chrdlg/drpcps.hrc
new file mode 100644
index 000000000000..d1b432edbba7
--- /dev/null
+++ b/sw/source/ui/chrdlg/drpcps.hrc
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DRPCPS_HRC
+#define _DRPCPS_HRC
+
+// #define ******************************************************************
+
+#define FT_DROPCAPS 1
+#define FLD_DROPCAPS 2
+#define TXT_LINES 3
+#define FLD_LINES 4
+#define TXT_DISTANCE 5
+#define FLD_DISTANCE 6
+#define CNT_PICT 7
+#define TXT_TEXT 8
+#define EDT_TEXT 9
+#define TXT_TEMPLATE 10
+#define BOX_TEMPLATE 11
+#define FL_SETTINGS 12
+#define CB_SWITCH 13
+#define FL_CONTENT 15
+#define CB_WORD 16
+
+#endif
+
+// ********************************************************************** EOF
diff --git a/sw/source/ui/chrdlg/drpcps.src b/sw/source/ui/chrdlg/drpcps.src
new file mode 100644
index 000000000000..458d83a5d079
--- /dev/null
+++ b/sw/source/ui/chrdlg/drpcps.src
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // #include *****************************************************************
+#include "globals.hrc"
+#include "chrdlg.hrc"
+#include "drpcps.hrc"
+#include "helpid.h"
+ // TabDialog ****************************************************************
+TabDialog DLG_DROPCAPS
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Drop Caps" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_DROPCAPS ;
+ Text [ en-US ] = "Drop Caps" ;
+ PageResID = TP_DROPCAPS ;
+ };
+ };
+ };
+};
+ // TabPage ******************************************************************
+TabPage TP_DROPCAPS
+{
+ HelpID = HID_DROPCAPS ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ CheckBox CB_SWITCH
+ {
+ HelpID = "sw:CheckBox:TP_DROPCAPS:CB_SWITCH";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Text [ en-US ] = "Display drop caps" ;
+ };
+ CheckBox CB_WORD
+ {
+ HelpID = "sw:CheckBox:TP_DROPCAPS:CB_WORD";
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Text [ en-US ] = "~Whole word" ;
+ };
+ FixedText FT_DROPCAPS
+ {
+ Pos = MAP_APPFONT ( 12 , 44 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Number of ~characters:" ;
+ };
+ NumericField FLD_DROPCAPS
+ {
+ HelpID = "sw:NumericField:TP_DROPCAPS:FLD_DROPCAPS";
+ Border = TRUE ;
+ First = 1 ;
+ Last = 9 ;
+ Left = TRUE ;
+ Maximum = 9 ;
+ Minimum = 1 ;
+ Pos = MAP_APPFONT ( 89 , 42 ) ;
+ Repeat = TRUE ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ Spin = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText TXT_LINES
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 60 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "~Lines" ;
+ };
+ NumericField FLD_LINES
+ {
+ HelpID = "sw:NumericField:TP_DROPCAPS:FLD_LINES";
+ Border = TRUE ;
+ First = 2 ;
+ Last = 9 ;
+ Left = TRUE ;
+ Maximum = 9 ;
+ Minimum = 2 ;
+ Pos = MAP_APPFONT ( 89 , 58 ) ;
+ Repeat = TRUE ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ Spin = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText TXT_DISTANCE
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 76 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Space to text" ;
+ };
+ MetricField FLD_DISTANCE
+ {
+ HelpID = "sw:MetricField:TP_DROPCAPS:FLD_DISTANCE";
+ Border = TRUE ;
+ DecimalDigits = 2 ;
+ First = 0 ;
+ Last = 200 ;
+ Left = TRUE ;
+ Maximum = 200 ;
+ Minimum = 0 ;
+ Pos = MAP_APPFONT ( 89 , 74 ) ;
+ Repeat = TRUE ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ Spin = TRUE ;
+ SpinSize = 10 ;
+ TabStop = TRUE ;
+ Unit = FUNIT_CM ;
+ };
+ FixedLine FL_SETTINGS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 125 , 8 ) ;
+ Text [ en-US ] = "Settings" ;
+ };
+ Control CNT_PICT
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 143 , 7 ) ;
+ Size = MAP_APPFONT ( 105 , 80 ) ;
+ };
+ FixedText TXT_TEXT
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 102 ) ;
+ Size = MAP_APPFONT ( 125 , 8 ) ;
+ Text [ en-US ] = "~Text" ;
+ };
+ Edit EDT_TEXT
+ {
+ HelpID = "sw:Edit:TP_DROPCAPS:EDT_TEXT";
+ Border = TRUE ;
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 143 , 100 ) ;
+ Size = MAP_APPFONT ( 105 , 12 ) ;
+ TabStop = TRUE ;
+ MaxTextLength = 9 ;
+ };
+ FixedText TXT_TEMPLATE
+ {
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 118 ) ;
+ Size = MAP_APPFONT ( 125 , 8 ) ;
+ Text [ en-US ] = "Character St~yle" ;
+ };
+ ListBox BOX_TEMPLATE
+ {
+ HelpID = "sw:ListBox:TP_DROPCAPS:BOX_TEMPLATE";
+ Border = TRUE ;
+ DropDown = TRUE ;
+ Pos = MAP_APPFONT ( 143 , 116 ) ;
+ Size = MAP_APPFONT ( 105 , 61 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_CONTENT
+ {
+ Pos = MAP_APPFONT ( 6 , 89 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Contents" ;
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx
new file mode 100644
index 000000000000..f80130f475e9
--- /dev/null
+++ b/sw/source/ui/chrdlg/numpara.cxx
@@ -0,0 +1,364 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#include "cmdid.h"
+#include "swtypes.hxx"
+#include "hintids.hxx"
+#include "globals.hrc"
+#include "helpid.h"
+#include <sfx2/objsh.hxx>
+#include <svx/htmlmode.hxx>
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <fmtline.hxx>
+#include <numpara.hxx>
+#include <numpara.hrc>
+// --> OD 2008-04-14 #outlinelevel#
+#include <app.hrc>
+// <--
+
+// Globals ******************************************************************
+
+static USHORT __FAR_DATA aPageRg[] = {
+ FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART_AT,
+ 0
+};
+/*-----------------31.01.98 08:34-------------------
+
+--------------------------------------------------*/
+SwParagraphNumTabPage::SwParagraphNumTabPage(Window* pParent,
+ const SfxItemSet& rAttr ) :
+ SfxTabPage(pParent, SW_RES(TP_NUMPARA), rAttr),
+ aOutlineStartFL ( this, SW_RES( FL_OUTLINE_START )),
+ aOutlineLvFT ( this, SW_RES( FT_OUTLINE_LEVEL )),
+ aOutlineLvLB ( this, SW_RES( LB_OUTLINE_LEVEL )),
+ aNumberStyleFT ( this, SW_RES( FT_NUMBER_STYLE ) ),
+ aNumberStyleLB ( this, SW_RES( LB_NUMBER_STYLE ) ),
+ aNewStartFL ( this, SW_RES( FL_NEW_START ) ),
+ aNewStartCB ( this, SW_RES( CB_NEW_START ) ),
+ aNewStartNumberCB ( this, SW_RES( CB_NUMBER_NEW_START ) ),
+ aNewStartNF ( this, SW_RES( NF_NEW_START ) ),
+ aCountParaFL ( this, SW_RES( FL_COUNT_PARA ) ),
+ aCountParaCB ( this, SW_RES( CB_COUNT_PARA ) ),
+ aRestartParaCountCB ( this, SW_RES( CB_RESTART_PARACOUNT ) ),
+ aRestartFT ( this, SW_RES( FT_RESTART_NO ) ),
+ aRestartNF ( this, SW_RES( NF_RESTART_PARA ) ),
+ // --> OD 2008-04-14 #outlinelevel#
+ msOutlineNumbering( SW_RES( STR_OUTLINE_NUMBERING ) ),
+ // <--
+ bModified(FALSE),
+ bCurNumrule(FALSE)
+{
+ FreeResource();
+
+ const SfxPoolItem* pItem;
+ SfxObjectShell* pObjSh;
+ if(SFX_ITEM_SET == rAttr.GetItemState(SID_HTML_MODE, FALSE, &pItem) ||
+ ( 0 != ( pObjSh = SfxObjectShell::Current()) &&
+ 0 != (pItem = pObjSh->GetItem(SID_HTML_MODE))))
+ {
+ USHORT nHtmlMode = ((const SfxUInt16Item*)pItem)->GetValue();
+ if(HTMLMODE_ON & nHtmlMode)
+ {
+ aCountParaFL .Hide();
+ aCountParaCB .Hide();
+ aRestartParaCountCB .Hide();
+ aRestartFT .Hide();
+ aRestartNF .Hide();
+ }
+ }
+ aNewStartCB.SetClickHdl(LINK(this, SwParagraphNumTabPage, NewStartHdl_Impl));
+ aNewStartNumberCB.SetClickHdl(LINK(this, SwParagraphNumTabPage, NewStartHdl_Impl));
+ aNumberStyleLB.SetSelectHdl(LINK(this, SwParagraphNumTabPage, StyleHdl_Impl));
+ aCountParaCB.SetClickHdl(LINK(this,
+ SwParagraphNumTabPage, LineCountHdl_Impl));
+ aRestartParaCountCB.SetClickHdl(
+ LINK(this, SwParagraphNumTabPage, LineCountHdl_Impl));
+}
+/*-----------------31.01.98 08:34-------------------
+
+--------------------------------------------------*/
+SwParagraphNumTabPage::~SwParagraphNumTabPage()
+{
+}
+
+/*-----------------31.01.98 08:38-------------------
+
+--------------------------------------------------*/
+SfxTabPage* SwParagraphNumTabPage::Create( Window* pParent,
+ const SfxItemSet& rSet )
+{
+ return new SwParagraphNumTabPage(pParent, rSet);
+}
+
+/*-----------------31.01.98 08:38-------------------
+
+--------------------------------------------------*/
+USHORT* SwParagraphNumTabPage::GetRanges()
+{
+ return aPageRg;
+}
+
+/*-----------------31.01.98 08:38-------------------
+
+--------------------------------------------------*/
+BOOL SwParagraphNumTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ //<-#outline level, added by zhaojianwei
+ if( aOutlineLvLB.GetSelectEntryPos() != aOutlineLvLB.GetSavedValue())
+ {
+ USHORT aOutlineLv = aOutlineLvLB.GetSelectEntryPos();
+ const SfxUInt16Item* pOldOutlineLv = (const SfxUInt16Item*)GetOldItem( rSet, SID_ATTR_PARA_OUTLINE_LEVEL);
+ SfxUInt16Item* pOutlineLv = (SfxUInt16Item*)pOldOutlineLv->Clone();
+ pOutlineLv->SetValue( aOutlineLv );
+ rSet.Put(*pOutlineLv);
+ delete pOutlineLv;
+ bModified = TRUE;
+ }
+ //<-end
+ if( aNumberStyleLB.GetSelectEntryPos() != aNumberStyleLB.GetSavedValue())
+ {
+ String aStyle;
+ if(aNumberStyleLB.GetSelectEntryPos())
+ aStyle = aNumberStyleLB.GetSelectEntry();
+ const SfxStringItem* pOldRule = (const SfxStringItem*)GetOldItem( rSet, SID_ATTR_PARA_NUMRULE);
+ SfxStringItem* pRule = (SfxStringItem*)pOldRule->Clone();
+ pRule->SetValue(aStyle);
+ rSet.Put(*pRule);
+ delete pRule;
+ bModified = TRUE;
+ }
+ if(aNewStartCB.GetState() != aNewStartCB.GetSavedValue() ||
+ aNewStartNumberCB.GetState() != aNewStartNumberCB.GetSavedValue()||
+ aNewStartNF.GetText() != aNewStartNF.GetSavedValue())
+ {
+ bModified = TRUE;
+ BOOL bNewStartChecked = STATE_CHECK == aNewStartCB.GetState();
+ BOOL bNumberNewStartChecked = STATE_CHECK == aNewStartNumberCB.GetState();
+ rSet.Put(SfxBoolItem(FN_NUMBER_NEWSTART, bNewStartChecked));
+ rSet.Put(SfxUInt16Item(FN_NUMBER_NEWSTART_AT,
+ bNumberNewStartChecked && bNewStartChecked ? (USHORT)aNewStartNF.GetValue() : USHRT_MAX));
+ }
+
+ if(aCountParaCB.GetSavedValue() != aCountParaCB.GetState() ||
+ aRestartParaCountCB.GetSavedValue() != aRestartParaCountCB.GetState() ||
+ aRestartNF.GetSavedValue() != aRestartNF.GetText() )
+ {
+ SwFmtLineNumber aFmt;
+ aFmt.SetStartValue( static_cast< ULONG >(aRestartParaCountCB.GetState() == STATE_CHECK ?
+ aRestartNF.GetValue() : 0 ));
+ aFmt.SetCountLines( aCountParaCB.IsChecked() );
+ rSet.Put(aFmt);
+ bModified = TRUE;
+ }
+ return bModified;
+}
+
+/*-----------------31.01.98 08:38-------------------
+
+--------------------------------------------------*/
+void SwParagraphNumTabPage::Reset( const SfxItemSet& rSet )
+{
+ BOOL bHasNumberStyle = FALSE;
+
+ SfxItemState eItemState = rSet.GetItemState( GetWhich(SID_ATTR_PARA_OUTLINE_LEVEL) );
+
+ sal_Int16 nOutlineLv;
+ if( eItemState >= SFX_ITEM_AVAILABLE )
+ {
+ nOutlineLv = ((const SfxUInt16Item &)rSet.Get( GetWhich(SID_ATTR_PARA_OUTLINE_LEVEL) )).GetValue();
+ aOutlineLvLB.SelectEntryPos( nOutlineLv ) ;
+ }
+ else
+ {
+ aOutlineLvLB.SetNoSelection();
+ }
+ aOutlineLvLB.SaveValue();
+
+ eItemState = rSet.GetItemState( GetWhich(SID_ATTR_PARA_NUMRULE) );
+
+ String aStyle;
+ if( eItemState >= SFX_ITEM_AVAILABLE )
+ {
+ aStyle = ((const SfxStringItem &)rSet.Get( GetWhich(SID_ATTR_PARA_NUMRULE) )).GetValue();
+ if(!aStyle.Len())
+ aStyle = aNumberStyleLB.GetEntry(0);
+
+ if( aStyle.EqualsAscii("Outline"))// == String::CreateFromAscii("Outline")) //maybe need modify,zhaojianwei
+ {
+ aNumberStyleLB.InsertEntry( msOutlineNumbering );
+ aNumberStyleLB.SelectEntry( msOutlineNumbering );
+ aNumberStyleLB.RemoveEntry(msOutlineNumbering);
+ aNumberStyleLB.SaveValue();
+ }
+ else
+ aNumberStyleLB.SelectEntry( aStyle );
+
+ bHasNumberStyle = TRUE;
+ }
+ else
+ {
+ aNumberStyleLB.SetNoSelection();
+ }
+
+ aNumberStyleLB.SaveValue();
+
+ eItemState = rSet.GetItemState( FN_NUMBER_NEWSTART );
+ if(eItemState > SFX_ITEM_AVAILABLE )
+ {
+ bCurNumrule = TRUE;
+ const SfxBoolItem& rStart = (const SfxBoolItem&)rSet.Get(FN_NUMBER_NEWSTART);
+ aNewStartCB.SetState(
+ rStart.GetValue() ?
+ STATE_CHECK : STATE_NOCHECK );
+ aNewStartCB.EnableTriState(FALSE);
+ }
+ else
+ aNewStartCB.SetState(bHasNumberStyle ? STATE_NOCHECK : STATE_DONTKNOW);
+ aNewStartCB.SaveValue();
+
+ eItemState = rSet.GetItemState( FN_NUMBER_NEWSTART_AT);
+ if( eItemState > SFX_ITEM_AVAILABLE )
+ {
+ USHORT nNewStart = ((const SfxUInt16Item&)rSet.Get(FN_NUMBER_NEWSTART_AT)).GetValue();
+ aNewStartNumberCB.Check(USHRT_MAX != nNewStart);
+ if(USHRT_MAX == nNewStart)
+ nNewStart = 1;
+
+ aNewStartNF.SetValue(nNewStart);
+ aNewStartNumberCB.EnableTriState(FALSE);
+ }
+ else
+ aNewStartCB.SetState(STATE_DONTKNOW);
+ NewStartHdl_Impl(&aNewStartCB);
+ aNewStartNF.SaveValue();
+ aNewStartNumberCB.SaveValue();
+ StyleHdl_Impl(&aNumberStyleLB);
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState(RES_LINENUMBER))
+ {
+ SwFmtLineNumber& rNum = (SwFmtLineNumber&)rSet.Get(RES_LINENUMBER);
+ ULONG nStartValue = rNum.GetStartValue();
+ BOOL bCount = rNum.IsCount();
+ aCountParaCB.SetState( bCount ? STATE_CHECK : STATE_NOCHECK );
+ aRestartParaCountCB.SetState( 0 != nStartValue ? STATE_CHECK : STATE_NOCHECK );
+ aRestartNF.SetValue(nStartValue == 0 ? 1 : nStartValue);
+ LineCountHdl_Impl(&aCountParaCB);
+ aCountParaCB.EnableTriState(FALSE);
+ aRestartParaCountCB.EnableTriState(FALSE);
+ }
+ else
+ {
+ aCountParaCB.SetState(STATE_DONTKNOW);
+ aRestartParaCountCB.SetState(STATE_DONTKNOW);
+ }
+ aCountParaCB.SaveValue();
+ aRestartParaCountCB.SaveValue();
+ aRestartNF.SaveValue();
+
+ bModified = FALSE;
+}
+
+/*-----------------31.01.98 08:38-------------------
+
+--------------------------------------------------*/
+void SwParagraphNumTabPage::DisableOutline()
+{
+ aOutlineLvFT.Disable();
+ aOutlineLvLB.Disable();
+}
+void SwParagraphNumTabPage::DisableNumbering()
+{
+ aNumberStyleFT.Disable();
+ aNumberStyleLB.Disable();
+}
+
+/*-----------------31.01.98 08:38-------------------
+
+--------------------------------------------------*/
+void SwParagraphNumTabPage::EnableNewStart()
+{
+ aNewStartCB.Show();
+ aNewStartNumberCB.Show();
+ aNewStartNF.Show();
+}
+
+/*-----------------31.01.98 08:56-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwParagraphNumTabPage, NewStartHdl_Impl, CheckBox*, EMPTYARG )
+{
+ BOOL bEnable = aNewStartCB.IsChecked();
+ aNewStartNumberCB.Enable(bEnable);
+ aNewStartNF.Enable(bEnable && aNewStartNumberCB.IsChecked());
+ return 0;
+}
+
+/*-----------------05.02.98 10:01-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwParagraphNumTabPage, LineCountHdl_Impl, CheckBox* , EMPTYARG)
+{
+ aRestartParaCountCB.Enable(aCountParaCB.IsChecked());
+
+ BOOL bEnableRestartValue = aRestartParaCountCB.IsEnabled() &&
+ aRestartParaCountCB.IsChecked();
+ aRestartFT.Enable(bEnableRestartValue);
+ aRestartNF.Enable(bEnableRestartValue);
+
+ return 0;
+}
+
+/*-----------------05.02.98 13:39-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwParagraphNumTabPage, StyleHdl_Impl, ListBox*, pBox )
+{
+// String dd=aNumberStyleLB.GetSavedValue();
+// if( msOutlineNumbering == dd)
+ {
+ }
+ BOOL bEnable = bCurNumrule || pBox->GetSelectEntryPos() > 0;
+ aNewStartCB.Enable(bEnable);
+ NewStartHdl_Impl(&aNewStartCB);
+
+ return 0;
+}
+
+
diff --git a/sw/source/ui/chrdlg/numpara.hrc b/sw/source/ui/chrdlg/numpara.hrc
new file mode 100644
index 000000000000..536dc8d935dd
--- /dev/null
+++ b/sw/source/ui/chrdlg/numpara.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _NUMPARA_HRC
+#define _NUMPARA_HRC
+
+// #define ******************************************************************
+
+#define LB_NUMBER_STYLE 1
+#define FT_NUMBER_STYLE 2
+#define CB_NEW_START 3
+#define CB_NUMBER_NEW_START 4
+#define FL_NEW_START 5
+#define NF_NEW_START 6
+#define FL_COUNT_PARA 7
+#define CB_COUNT_PARA 8
+#define CB_RESTART_PARACOUNT 9
+#define FT_RESTART_NO 10
+#define NF_RESTART_PARA 11
+#define FL_OUTLINE_START 12
+#define LB_OUTLINE_LEVEL 13
+#define FT_OUTLINE_LEVEL 14
+// **********************************************************************
+
+#endif
+
+
+
+
diff --git a/sw/source/ui/chrdlg/numpara.src b/sw/source/ui/chrdlg/numpara.src
new file mode 100644
index 000000000000..a0747655ee03
--- /dev/null
+++ b/sw/source/ui/chrdlg/numpara.src
@@ -0,0 +1,237 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // #pragma ******************************************************************
+
+ // #include *****************************************************************
+#include "globals.hrc"
+#include "chrdlg.hrc"
+#include "numpara.hrc"
+#include "helpid.h"
+ // TabPage ******************************************************************
+TabPage TP_NUMPARA
+{
+ HelpID = HID_NUMPARA ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_OUTLINE_START
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Outline" ;
+ };
+ FixedText FT_OUTLINE_LEVEL
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
+ Text [ en-US ] = "Outline level" ;
+ };
+ ListBox LB_OUTLINE_LEVEL
+ {
+ HelpID = "sw:ListBox:TP_NUMPARA:LB_OUTLINE_LEVEL";
+ Pos = MAP_APPFONT ( 130 , 14 ) ;
+ Size = MAP_APPFONT ( 118 , 65 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Body text" ; > ;
+ < "Level 1" ; >;
+ < "Level 2" ; >;
+ < "Level 3" ; >;
+ < "Level 4" ; >;
+ < "Level 5" ; >;
+ < "Level 6" ; >;
+ < "Level 7" ; >;
+ < "Level 8" ; >;
+ < "Level 9" ; >;
+ < "Level 10" ; >;
+ };
+ StringList [ x-comment ] =
+ {
+ < "Level 0" ; > ;
+ < "Level 1" ; >;
+ < "Level 2" ; >;
+ < "Level 3" ; >;
+ < "Level 4" ; >;
+ < "Level 5" ; >;
+ < "Level 6" ; >;
+ < "Level 7" ; >;
+ < "Level 8" ; >;
+ < "Level 9" ; >;
+ < "Level 10" ; >;
+ };
+ };
+ FixedLine FL_NEW_START
+ {
+ Pos = MAP_APPFONT ( 6 , 32 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Numbering" ;
+ };
+ FixedText FT_NUMBER_STYLE
+ {
+ Pos = MAP_APPFONT ( 12 , 43 ) ;
+ Size = MAP_APPFONT ( 112 , 8 ) ;
+ Text [ en-US ] = "Numbering Style" ;
+ };
+ ListBox LB_NUMBER_STYLE
+ {
+ HelpID = "sw:ListBox:TP_NUMPARA:LB_NUMBER_STYLE";
+ Pos = MAP_APPFONT ( 130 , 41 ) ;
+ Size = MAP_APPFONT ( 118 , 65 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "None" ; > ;
+ };
+ };
+ TriStateBox CB_NEW_START
+ {
+ HelpID = "sw:TriStateBox:TP_NUMPARA:CB_NEW_START";
+ Pos = MAP_APPFONT ( 12 , 58 ) ;
+ Size = MAP_APPFONT ( 160 , 10 ) ;
+ Hide = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "R~estart at this paragraph" ;
+ };
+ TriStateBox CB_NUMBER_NEW_START
+ {
+ HelpID = "sw:TriStateBox:TP_NUMPARA:CB_NUMBER_NEW_START";
+ Pos = MAP_APPFONT ( 21 , 73 ) ;
+ Size = MAP_APPFONT ( 103 , 10 ) ;
+ Hide = TRUE ;
+ Disable = TRUE ;
+ Text [ en-US ] = "S~tart with" ;
+ };
+ NumericField NF_NEW_START
+ {
+ HelpID = "sw:NumericField:TP_NUMPARA:NF_NEW_START";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 130 , 72 ) ;
+ Size = MAP_APPFONT ( 26 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ Value = 0 ;
+ First = 0 ;
+ Last = 9999 ;
+ Hide = TRUE ;
+ Disable = TRUE ;
+ };
+ FixedLine FL_COUNT_PARA
+ {
+ Pos = MAP_APPFONT ( 6 , 89 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Line numbering" ;
+ };
+ TriStateBox CB_COUNT_PARA
+ {
+ HelpID = "sw:TriStateBox:TP_NUMPARA:CB_COUNT_PARA";
+ Pos = MAP_APPFONT ( 12 , 100 ) ;
+ Size = MAP_APPFONT ( 160 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Include this paragraph in line numbering" ;
+ };
+ TriStateBox CB_RESTART_PARACOUNT
+ {
+ HelpID = "sw:TriStateBox:TP_NUMPARA:CB_RESTART_PARACOUNT";
+ Pos = MAP_APPFONT ( 12 , 116 ) ;
+ Size = MAP_APPFONT ( 160 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Rest~art at this paragraph" ;
+ };
+ FixedText FT_RESTART_NO
+ {
+ Pos = MAP_APPFONT ( 21 , 132 ) ;
+ Size = MAP_APPFONT ( 103 , 8 ) ;
+ Disable = TRUE ;
+ Text [ en-US ] = "~Start with" ;
+ };
+ NumericField NF_RESTART_PARA
+ {
+ HelpID = "sw:NumericField:TP_NUMPARA:NF_RESTART_PARA";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 130 , 130 ) ;
+ Size = MAP_APPFONT ( 26 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 65000 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 65000 ;
+ Disable = TRUE ;
+ };
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/chrdlg/paradlg.hrc b/sw/source/ui/chrdlg/paradlg.hrc
new file mode 100644
index 000000000000..e8e48dfaa956
--- /dev/null
+++ b/sw/source/ui/chrdlg/paradlg.hrc
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define TAB_CONTROL 55
+#define INDENT_FRM 1
+#define LEFT_LABEL 2
+#define FLINE_LABEL 3
+#define RIGHT_LABEL 4
+#define LEFT_INDENT 5
+#define FLINE_INDENT 6
+#define RIGHT_INDENT 7
+#define DIST_FRM 8
+#define TOP_LABEL 9
+#define TOP_DIST 10
+#define BOTTOM_LABEL 11
+#define BOTTOM_DIST 12
+#define ALG_LEFT 13
+#define ALG_RIGHT 50
+#define ALG_CENTER 51
+#define ALG_JUSTIFY 52
+#define ALG_FRM 14
+#define LINEDIST_FRM 15
+#define LINEDIST_BOX 16
+#define LINEDIST_AT_LABEL 17
+#define LINEDIST_AT_PERCENTBOX 18
+#define LINEDIST_AT_METRICBOX 19
+#define HYPHEN_FRM 21
+#define HYPHEN_BOX_AFTER 44
+#define HYPHEN_BOX_BEFORE 22
+#define EXTHYPHEN_BOX_AFTER 42
+#define EXTHYPHEN_BOX_BEFORE 23
+#define HYPHEN_LABEL_AFTER 43
+#define HYPHEN_LABEL_BEFORE 24
+#define EXTEND_FRM 25
+#define PAGEBREAK_BOX 26
+#define PAGEBREAK_DAVOR 27
+#define PAGEBREAK_DAHINTER 28
+#define KEEP_TOGETHER_BOX 29
+#define WIDOW_BOX 31
+#define WIDOW_ROW_NO 32
+#define WIDOW_ROW_LABEL 33
+#define ORPHAN_BOX 34
+#define ORPHAN_ROW_NO 35
+#define ORPHAN_ROW_LABEL 36
+#define PAGE_COLL_BTN 40
+#define PAGE_COLL_BOX 41
+#define OK_BTN 50
+#define CANCEL_BTN 51
diff --git a/sw/source/ui/chrdlg/paradlg.src b/sw/source/ui/chrdlg/paradlg.src
new file mode 100644
index 000000000000..1384e4ae8fa3
--- /dev/null
+++ b/sw/source/ui/chrdlg/paradlg.src
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "chrdlg.hrc"
+#include "paradlg.hrc"
+#define HelpText "error - hier keine HelpTexte HelpText"
+ // #define DLG_PARA 256
+TabDialog DLG_PARA
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Paragraph" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_PARA_STD ;
+ /* ### ACHTUNG: Neuer Text in Resource? Einzüge und Abstände : Einz³ge und Abstõnde */
+ Text [ en-US ] = "Indents & Spacing" ;
+ PageResID = TP_PARA_STD ;
+ };
+ PageItem
+ {
+ Identifier = TP_PARA_ALIGN ;
+ PageResID = TP_PARA_ALIGN ;
+ Text [ en-US ] = "Alignment" ;
+ };
+ PageItem
+ {
+ Identifier = TP_PARA_EXT ;
+ /* ### ACHTUNG: Neuer Text in Resource? Textflu?: Textflu?*/
+ Text [ en-US ] = "Text Flow" ;
+ PageResID = TP_PARA_EXT ;
+ };
+ PageItem
+ {
+ Identifier = TP_PARA_ASIAN;
+ Text [ en-US ] = "Asian Typography";
+ };
+ PageItem
+ {
+ Identifier = TP_NUMPARA ;
+ Text [ en-US ] = "Outline & Numbering" ;
+ };
+ PageItem
+ {
+ Identifier = TP_TABULATOR ;
+ Text [ en-US ] = "Tabs" ;
+ PageResID = TP_TABULATOR ;
+ };
+ PageItem
+ {
+ Identifier = TP_DROPCAPS ;
+ Text [ en-US ] = "Drop Caps" ;
+ PageResID = TP_DROPCAPS ;
+ };
+ PageItem
+ {
+ Identifier = TP_BORDER ;
+ Text [ en-US ] = "Borders" ;
+ PageResID = TP_BORDER ;
+ };
+ PageItem
+ {
+ Identifier = TP_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ PageResID = TP_BACKGROUND ;
+ };
+ };
+ };
+};
+TabDialog DLG_DRAWPARA
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Paragraph" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_PARA_STD ;
+ /* ### ACHTUNG: Neuer Text in Resource? Einzüge und Abstände : Einz³ge und Abstõnde */
+ Text [ en-US ] = "Indents & Spacing" ;
+ PageResID = TP_PARA_STD ;
+ };
+ PageItem
+ {
+ Identifier = TP_PARA_ALIGN ;
+ PageResID = TP_PARA_ALIGN ;
+ Text [ en-US ] = "Alignment" ;
+ };
+ PageItem
+ {
+ Identifier = TP_PARA_ASIAN;
+ Text [ en-US ] = "Asian Typography";
+ };
+ PageItem
+ {
+ Identifier = TP_TABULATOR ;
+ Text [ en-US ] = "Tabs" ;
+ PageResID = TP_TABULATOR ;
+ };
+ };
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx
new file mode 100644
index 000000000000..0976c7fbf5aa
--- /dev/null
+++ b/sw/source/ui/chrdlg/pardlg.cxx
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include "hintids.hxx"
+#include <svx/htmlmode.hxx>
+#include <svl/style.hxx>
+
+#include <svtools/htmlcfg.hxx>
+
+#ifndef _SVSTDARR_STRINGSSORTDTOR
+#define _SVSTDARR_STRINGSSORTDTOR
+#include <svl/svstdarr.hxx>
+#endif
+#include <svl/cjkoptions.hxx>
+#include "docsh.hxx"
+#include "wrtsh.hxx"
+#include "frmatr.hxx"
+#include "view.hxx"
+#include "globals.hrc"
+#include "swuipardlg.hxx"
+#include "pagedesc.hxx"
+#include "paratr.hxx"
+#include "drpcps.hxx"
+#include "uitool.hxx"
+#include "viewopt.hxx"
+#include <numpara.hxx>
+#include "chrdlg.hrc"
+#include "poolfmt.hrc"
+#include <svx/svxids.hrc>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/flagsdef.hxx>
+// STATIC DATA -----------------------------------------------------------
+
+
+SwParaDlg::SwParaDlg(Window *pParent,
+ SwView& rVw,
+ const SfxItemSet& rCoreSet,
+ BYTE nDialogMode,
+ const String *pTitle,
+ BOOL bDraw,
+ UINT16 nDefPage):
+
+ SfxTabDialog(pParent, bDraw ? SW_RES(DLG_DRAWPARA) : SW_RES(DLG_PARA),
+ &rCoreSet, 0 != pTitle),
+
+ rView(rVw),
+ nDlgMode(nDialogMode),
+ bDrawParaDlg(bDraw)
+
+{
+ FreeResource();
+
+ nHtmlMode = ::GetHtmlMode(rVw.GetDocShell());
+ BOOL bHtmlMode = static_cast< BOOL >(nHtmlMode & HTMLMODE_ON);
+ if(pTitle)
+ {
+ // Update des Titels
+ String aTmp( GetText() );
+ aTmp += SW_RESSTR(STR_TEXTCOLL_HEADER);
+ aTmp += *pTitle;
+ aTmp += ')';
+ SetText(aTmp);
+ }
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageRangesFunc fail!");
+ AddTabPage( TP_PARA_STD, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH) );
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageRangesFunc fail!");
+ AddTabPage( TP_PARA_ALIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH) );
+
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ if (!bDrawParaDlg && (!bHtmlMode || pHtmlOpt->IsPrintLayoutExtension()))
+ {
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageRangesFunc fail!");
+ AddTabPage( TP_PARA_EXT, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) );
+
+ }
+ else
+ RemoveTabPage(TP_PARA_EXT);
+
+ SvtCJKOptions aCJKOptions;
+ if(!bHtmlMode && aCJKOptions.IsAsianTypographyEnabled())
+ {
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!");
+ AddTabPage( TP_PARA_ASIAN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
+ }
+ else
+ RemoveTabPage(TP_PARA_ASIAN);
+
+ USHORT nWhich(rCoreSet.GetPool()->GetWhich(SID_ATTR_LRSPACE));
+ BOOL bLRValid = SFX_ITEM_AVAILABLE <= rCoreSet.GetItemState(nWhich);
+ if(bHtmlMode || !bLRValid)
+ RemoveTabPage(TP_TABULATOR);
+ else
+ {
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR), "GetTabPageRangesFunc fail!");
+ AddTabPage( TP_TABULATOR, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) );
+
+ }
+ if (!bDrawParaDlg)
+ {
+ if(!(nDlgMode & DLG_ENVELOP))
+ AddTabPage(TP_NUMPARA, SwParagraphNumTabPage::Create,SwParagraphNumTabPage::GetRanges);
+ else
+ RemoveTabPage(TP_NUMPARA);
+ if(!bHtmlMode || (nHtmlMode & HTMLMODE_FULL_STYLES))
+ {
+ AddTabPage(TP_DROPCAPS, SwDropCapsPage::Create, SwDropCapsPage::GetRanges);
+ }
+ else
+ {
+ RemoveTabPage(TP_DROPCAPS);
+ }
+ if(!bHtmlMode || (nHtmlMode & (HTMLMODE_SOME_STYLES|HTMLMODE_FULL_STYLES)))
+ {
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
+ }
+ else
+ {
+ RemoveTabPage(TP_BACKGROUND);
+ }
+ if(!bHtmlMode || (nHtmlMode & HTMLMODE_PARA_BORDER))
+ {
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
+ }
+ else
+ RemoveTabPage(TP_BORDER);
+ }
+
+ if (nDefPage)
+ SetCurPageId(nDefPage);
+}
+
+
+__EXPORT SwParaDlg::~SwParaDlg()
+{
+}
+
+
+void __EXPORT SwParaDlg::PageCreated(USHORT nId, SfxTabPage& rPage)
+{
+ SwWrtShell& rSh = rView.GetWrtShell();
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+
+ // Bei Tabellenumrandung kann im Writer kein Schatten eingestellt werden
+ if (nId == TP_BORDER)
+ {
+ aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
+ rPage.PageCreated(aSet);
+ }
+ else if( nId == TP_PARA_STD )
+ {
+ aSet.Put(SfxUInt16Item(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,
+ static_cast< UINT16 >(rSh.GetAnyCurRect(RECT_PAGE_PRT).Width()) ));
+
+ if (!bDrawParaDlg)
+ {
+ aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000E));
+ aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST, MM50/10));
+
+ }
+ rPage.PageCreated(aSet);
+ }
+ else if( TP_PARA_ALIGN == nId)
+ {
+ if (!bDrawParaDlg)
+ {
+ aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,TRUE));
+ rPage.PageCreated(aSet);
+ }
+ }
+ else if( TP_PARA_EXT == nId )
+ {
+ // Seitenumbruch nur, wenn der Cursor im Body-Bereich und nicht in
+ // einer Tabelle steht
+ const USHORT eType = rSh.GetFrmType(0,TRUE);
+ if( !(FRMTYPE_BODY & eType) ||
+ rSh.GetSelectionType() & nsSelectionType::SEL_TBL )
+ {
+ aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,TRUE));
+ rPage.PageCreated(aSet);
+ }
+ }
+ else if( TP_DROPCAPS == nId )
+ {
+ ((SwDropCapsPage&)rPage).SetFormat(FALSE);
+ }
+ else if( TP_BACKGROUND == nId )
+ {
+ if(!( nHtmlMode & HTMLMODE_ON ) ||
+ nHtmlMode & HTMLMODE_SOME_STYLES)
+ {
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR));
+ rPage.PageCreated(aSet);
+ }
+ }
+ else if( TP_NUMPARA == nId)
+ {
+ //-->#outline level,added by zhaojianwei
+ SwTxtFmtColl* pTmpColl = rSh.GetCurTxtFmtColl();
+ if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
+ {
+ ((SwParagraphNumTabPage&)rPage).DisableOutline() ;
+ }//<-end
+
+ ((SwParagraphNumTabPage&)rPage).EnableNewStart();
+ ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
+ SfxStyleSheetBasePool* pPool = rView.GetDocShell()->GetStyleSheetPool();
+ pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
+ const SfxStyleSheetBase* pBase = pPool->First();
+ SvStringsSortDtor aNames;
+ while(pBase)
+ {
+ aNames.Insert(new String(pBase->GetName()));
+ pBase = pPool->Next();
+ }
+ for(USHORT i = 0; i < aNames.Count(); i++)
+ rBox.InsertEntry(*aNames.GetObject(i));
+ }
+
+}
+
+
+
diff --git a/sw/source/ui/chrdlg/swbreak.src b/sw/source/ui/chrdlg/swbreak.src
new file mode 100644
index 000000000000..2646ed141fec
--- /dev/null
+++ b/sw/source/ui/chrdlg/swbreak.src
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "chrdlg.hrc"
+#include "break.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ // #define DLG_BREAK 256
+ModalDialog DLG_BREAK
+{
+ HelpID = CMD_FN_INSERT_BREAK_DLG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 161 , 114 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Umbruch einfügen : Umbruch einf³gen */
+ Text [ en-US ] = "Insert Break" ;
+ Moveable = TRUE ;
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 105 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 105 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 105 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ RadioButton RB_LINE
+ {
+ HelpID = "sw:RadioButton:DLG_BREAK:RB_LINE";
+ Pos = MAP_APPFONT ( 12 , 15 ) ;
+ Size = MAP_APPFONT ( 63 , 10 ) ;
+ Text [ en-US ] = "~Line break" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ RadioButton RB_PAGE
+ {
+ HelpID = "sw:RadioButton:DLG_BREAK:RB_PAGE";
+ Pos = MAP_APPFONT ( 12 , 39 ) ;
+ Size = MAP_APPFONT ( 63 , 10 ) ;
+ Text [ en-US ] = "~Page break" ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ };
+ RadioButton RB_COL
+ {
+ HelpID = "sw:RadioButton:DLG_BREAK:RB_COL";
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 69 , 10 ) ;
+ Text [ en-US ] = "~Column break" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_BREAK
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 93 , 8 ) ;
+ Text [ en-US ] = "Type" ;
+ };
+ FixedText FT_COLL
+ {
+ Pos = MAP_APPFONT ( 12 , 51 ) ;
+ Size = MAP_APPFONT ( 69 , 8 ) ;
+ Text [ en-US ] = "~Style" ;
+ Group = TRUE ;
+ Left = TRUE ;
+ };
+ ListBox LB_COLL
+ {
+ HelpID = "sw:ListBox:DLG_BREAK:LB_COLL";
+ Pos = MAP_APPFONT ( 12 , 62 ) ;
+ Size = MAP_APPFONT ( 75 , 50 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ StringList [ en-US ] =
+ {
+ < "[None]" ; > ;
+ };
+ };
+ CheckBox CB_PAGENUM
+ {
+ HelpID = "sw:CheckBox:DLG_BREAK:CB_PAGENUM";
+ Pos = MAP_APPFONT ( 12 , 79 ) ;
+ Size = MAP_APPFONT ( 84 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Seitennummer ~ändern : Seitennummer ~õndern */
+ Text [ en-US ] = "Change page ~number" ;
+ TabStop = TRUE ;
+ };
+ NumericField ED_PAGENUM
+ {
+ HelpID = "sw:NumericField:DLG_BREAK:ED_PAGENUM";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 94 ) ;
+ Size = MAP_APPFONT ( 31 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 9999 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 9999 ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx
new file mode 100644
index 000000000000..44006ef5cab4
--- /dev/null
+++ b/sw/source/ui/chrdlg/swuiccoll.cxx
@@ -0,0 +1,357 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#include "cmdid.h"
+#include <tools/list.hxx>
+#include "swmodule.hxx"
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "globals.hrc"
+#include "helpid.h"
+
+
+#include <sfx2/styfitem.hxx>
+
+#include "uitool.hxx"
+#include "ccoll.hxx"
+#include "fmtcol.hxx"
+#include "hintids.hxx"
+#include "docsh.hxx"
+#include "docstyle.hxx"
+#include "hints.hxx"
+
+#include "chrdlg.hrc"
+#include "ccoll.hrc"
+#include <vcl/svapp.hxx>
+
+#include "swuiccoll.hxx"
+
+static USHORT __FAR_DATA aPageRg[] = {
+ FN_COND_COLL, FN_COND_COLL,
+ 0
+};
+
+// Achtung im Code wird dieses Array direkt (0, 1, ...) indiziert
+static long nTabs[] =
+ { 2, // Number of Tabs
+ 0, 100
+ };
+
+/****************************************************************************
+Page: Ctor
+****************************************************************************/
+
+
+SwCondCollPage::SwCondCollPage(Window *pParent, const SfxItemSet &rSet)
+
+ : SfxTabPage(pParent, SW_RES(TP_CONDCOLL), rSet),
+ aConditionFL( this, SW_RES( FL_CONDITION )),
+ aConditionCB( this, SW_RES( CB_CONDITION ) ),
+ aContextFT ( this, SW_RES( FT_CONTEXT ) ),
+ aUsedFT ( this, SW_RES( FT_USED ) ),
+ aTbLinks( this, SW_RES( TB_CONDCOLLS ) ),
+ aStyleFT ( this, SW_RES( FT_STYLE ) ),
+ aStyleLB ( this, SW_RES( LB_STYLE ) ),
+ aFilterLB ( this, SW_RES( LB_FILTER ) ),
+ aRemovePB ( this, SW_RES( PB_REMOVE ) ),
+ aAssignPB ( this, SW_RES( PB_ASSIGN ) ),
+ sNoTmpl ( SW_RES( STR_NOTEMPL ) ),
+ aStrArr ( SW_RES( STR_REGIONS ) ),
+ rSh(::GetActiveView()->GetWrtShell()),
+ pCmds( SwCondCollItem::GetCmds() ),
+ pFmt(0),
+
+ bNewTemplate(FALSE)
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ // Handler installieren
+ aConditionCB.SetClickHdl( LINK(this, SwCondCollPage, OnOffHdl));
+ aTbLinks.SetDoubleClickHdl( LINK(this, SwCondCollPage, AssignRemoveHdl ));
+ aStyleLB.SetDoubleClickHdl( LINK(this, SwCondCollPage, AssignRemoveHdl ));
+ aRemovePB.SetClickHdl( LINK(this, SwCondCollPage, AssignRemoveHdl ));
+ aAssignPB.SetClickHdl( LINK(this, SwCondCollPage, AssignRemoveHdl ));
+ aTbLinks.SetSelectHdl( LINK(this, SwCondCollPage, SelectHdl));
+ aStyleLB.SetSelectHdl( LINK(this, SwCondCollPage, SelectHdl));
+ aFilterLB.SetSelectHdl( LINK(this, SwCondCollPage, SelectHdl));
+
+ aTbLinks.SetStyle(aTbLinks.GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN);
+ aTbLinks.SetSelectionMode( SINGLE_SELECTION );
+ aTbLinks.SetTabs( &nTabs[0], MAP_APPFONT );
+ aTbLinks.Resize(); // OS: Hack fuer richtige Selektion
+ aTbLinks.SetSpaceBetweenEntries( 0 );
+ aTbLinks.SetHelpId(HID_COND_COLL_TABLIST);
+
+ SfxStyleFamilies aFamilies(SW_RES(DLG_STYLE_DESIGNER));
+ const SfxStyleFamilyItem* pFamilyItem = 0;
+ USHORT nCount = aFamilies.Count();
+ USHORT i;
+
+ for( i = 0; i < nCount; ++i)
+ {
+ if(SFX_STYLE_FAMILY_PARA == (USHORT)(pFamilyItem = aFamilies.GetObject(i))->GetFamily())
+ break;
+ }
+
+ const SfxStyleFilter& rFilterList = pFamilyItem->GetFilterList();
+ for( i = 0; i < rFilterList.Count(); ++i)
+ {
+ aFilterLB.InsertEntry(rFilterList.GetObject(i)->aName);
+ USHORT* pFilter = new USHORT(rFilterList.GetObject(i)->nFlags);
+ aFilterLB.SetEntryData(i, pFilter);
+ }
+ aFilterLB.SelectEntryPos(1);
+
+ aTbLinks.Show();
+
+}
+
+/****************************************************************************
+Page: Dtor
+****************************************************************************/
+
+
+__EXPORT SwCondCollPage::~SwCondCollPage()
+{
+ for(USHORT i = 0; i < aFilterLB.GetEntryCount(); ++i)
+ delete (USHORT*)aFilterLB.GetEntryData(i);
+
+}
+
+
+int __EXPORT SwCondCollPage::DeactivatePage(SfxItemSet * _pSet)
+{
+ if( _pSet )
+ FillItemSet(*_pSet);
+
+ return LEAVE_PAGE;
+}
+
+/****************************************************************************
+Page: Factory
+****************************************************************************/
+
+
+SfxTabPage* __EXPORT SwCondCollPage::Create(Window *pParent, const SfxItemSet &rSet)
+{
+ return new SwCondCollPage(pParent, rSet);
+}
+
+/****************************************************************************
+Page: FillItemSet-Overload
+****************************************************************************/
+
+
+BOOL __EXPORT SwCondCollPage::FillItemSet(SfxItemSet &rSet)
+{
+ BOOL bModified = TRUE;
+ SwCondCollItem aCondItem;
+ for(USHORT i = 0; i < aStrArr.Count(); i++)
+ {
+ String sEntry = aTbLinks.GetEntryText(i, 1);
+ aCondItem.SetStyle( &sEntry, i);
+ }
+ rSet.Put(aCondItem);
+ return bModified;
+}
+
+/****************************************************************************
+Page: Reset-Overload
+****************************************************************************/
+
+
+void __EXPORT SwCondCollPage::Reset(const SfxItemSet &/*rSet*/)
+{
+ if(bNewTemplate)
+ aConditionCB.Enable();
+ if(RES_CONDTXTFMTCOLL == pFmt->Which())
+ aConditionCB.Check();
+ OnOffHdl(&aConditionCB);
+
+ aTbLinks.Clear();
+
+ SfxStyleSheetBasePool* pPool = rSh.GetView().GetDocShell()->GetStyleSheetPool();
+ pPool->SetSearchMask(SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL);
+ aStyleLB.Clear();
+ const SfxStyleSheetBase* pBase = pPool->First();
+ while( pBase )
+ {
+ if(!pFmt || pBase->GetName() != pFmt->GetName())
+ aStyleLB.InsertEntry(pBase->GetName());
+ pBase = pPool->Next();
+ }
+ aStyleLB.SelectEntryPos(0);
+
+ for( USHORT n = 0; n < aStrArr.Count(); n++)
+ {
+ String aEntry( aStrArr.GetString(n) );
+ aEntry += '\t';
+
+ const SwCollCondition* pCond = 0;
+ if( pFmt && RES_CONDTXTFMTCOLL == pFmt->Which() &&
+ 0 != ( pCond = ((SwConditionTxtFmtColl*)pFmt)->
+ HasCondition( SwCollCondition( 0, pCmds[n].nCnd, pCmds[n].nSubCond ) ) )
+ && pCond->GetTxtFmtColl() )
+ {
+ aEntry += pCond->GetTxtFmtColl()->GetName();
+ }
+
+ SvLBoxEntry* pE = aTbLinks.InsertEntryToColumn( aEntry, n );
+ if(0 == n)
+ aTbLinks.Select(pE);
+ }
+
+}
+
+/****************************************************************************
+
+****************************************************************************/
+
+
+USHORT* __EXPORT SwCondCollPage::GetRanges()
+{
+ return aPageRg;
+}
+
+
+/****************************************************************************
+
+****************************************************************************/
+
+
+IMPL_LINK( SwCondCollPage, OnOffHdl, CheckBox*, pBox )
+{
+ const BOOL bEnable = pBox->IsChecked();
+ aContextFT.Enable( bEnable );
+ aUsedFT .Enable( bEnable );
+ aTbLinks .EnableList( bEnable != FALSE );
+ aStyleFT .Enable( bEnable );
+ aStyleLB .Enable( bEnable );
+ aFilterLB .Enable( bEnable );
+ aRemovePB .Enable( bEnable );
+ aAssignPB .Enable( bEnable );
+ if( bEnable )
+ SelectHdl(0);
+ return 0;
+}
+
+/****************************************************************************
+
+****************************************************************************/
+
+
+IMPL_LINK( SwCondCollPage, AssignRemoveHdl, PushButton*, pBtn)
+{
+ SvLBoxEntry* pE = aTbLinks.FirstSelected();
+ ULONG nPos;
+ if( !pE || LISTBOX_ENTRY_NOTFOUND ==
+ ( nPos = aTbLinks.GetModel()->GetAbsPos( pE ) ) )
+ {
+ ASSERT( pE, "wo kommt der leere Eintrag her?" );
+ return 0;
+ }
+
+ String sSel = aStrArr.GetString( USHORT(nPos) );
+ sSel += '\t';
+
+ const BOOL bAssEnabled = pBtn != &aRemovePB && aAssignPB.IsEnabled();
+ aAssignPB.Enable( !bAssEnabled );
+ aRemovePB.Enable( bAssEnabled );
+ if ( bAssEnabled )
+ sSel += aStyleLB.GetSelectEntry();
+
+ aTbLinks.SetUpdateMode(FALSE);
+ aTbLinks.GetModel()->Remove(pE);
+ pE = aTbLinks.InsertEntryToColumn(sSel, nPos);
+ aTbLinks.Select(pE);
+ aTbLinks.MakeVisible(pE);
+ aTbLinks.SetUpdateMode(TRUE);
+ return 0;
+}
+
+/****************************************************************************
+
+****************************************************************************/
+
+
+IMPL_LINK( SwCondCollPage, SelectHdl, ListBox*, pBox)
+{
+ if(pBox == &aFilterLB)
+ {
+ aStyleLB.Clear();
+ USHORT nSearchFlags = pBox->GetSelectEntryPos();
+ nSearchFlags = *(USHORT*)aFilterLB.GetEntryData(nSearchFlags);
+ SfxStyleSheetBasePool* pPool = rSh.GetView().GetDocShell()->GetStyleSheetPool();
+ pPool->SetSearchMask(SFX_STYLE_FAMILY_PARA, nSearchFlags);
+ const SfxStyleSheetBase* pBase = pPool->First();
+ while( pBase )
+ {
+ if(!pFmt || pBase->GetName() != pFmt->GetName())
+ aStyleLB.InsertEntry(pBase->GetName());
+ pBase = pPool->Next();
+ }
+ aStyleLB.SelectEntryPos(0);
+ SelectHdl(&aStyleLB);
+
+ }
+ else
+ {
+ String sTbEntry;
+ SvLBoxEntry* pE = aTbLinks.FirstSelected();
+ if(pE)
+ sTbEntry = aTbLinks.GetEntryText(pE);
+ sTbEntry = sTbEntry.GetToken(1, '\t');
+ String sStyle = aStyleLB.GetSelectEntry();
+
+ aAssignPB.Enable( sStyle != sTbEntry && aConditionCB.IsChecked() );
+
+ if(pBox != &aStyleLB)
+ aRemovePB.Enable( aConditionCB.IsChecked() && sTbEntry.Len() );
+ }
+ return 0;
+}
+
+/****************************************************************************
+
+****************************************************************************/
+
+
+void SwCondCollPage::SetCollection( SwFmt* pFormat, BOOL bNew )
+{
+ pFmt = pFormat;
+ bNewTemplate = bNew;
+}
diff --git a/sw/source/ui/chrdlg/tblnumfm.cxx b/sw/source/ui/chrdlg/tblnumfm.cxx
new file mode 100644
index 000000000000..263cb9703ef5
--- /dev/null
+++ b/sw/source/ui/chrdlg/tblnumfm.cxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <svx/numinf.hxx>
+#include <swtypes.hxx>
+#include <tblnumfm.hxx>
+
+#ifndef _CHRDLG_HRC
+#include <chrdlg.hrc>
+#endif
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <svl/itemset.hxx>
+#include <sfx2/tabdlg.hxx>
+
+SwNumFmtDlg::SwNumFmtDlg(Window* pParent, const SfxItemSet& rSet)
+ : SfxSingleTabDialog( pParent, rSet, 0 )
+{
+ // TabPage erzeugen
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT );
+ if ( fnCreatePage )
+ {
+ SfxTabPage* pNewPage = (*fnCreatePage)( this, rSet );
+ SfxAllItemSet aSet(*(rSet.GetPool()));
+ aSet.Put ( SvxNumberInfoItem( (const SvxNumberInfoItem&)pNewPage->GetItemSet().Get( SID_ATTR_NUMBERFORMAT_INFO )));
+ pNewPage->PageCreated(aSet);
+ SetTabPage(pNewPage);
+ }
+}
+
+
+SwNumFmtDlg::~SwNumFmtDlg()
+{
+}
+
+
diff --git a/sw/source/ui/config/barcfg.cxx b/sw/source/ui/config/barcfg.cxx
new file mode 100644
index 000000000000..5fb403da58ce
--- /dev/null
+++ b/sw/source/ui/config/barcfg.cxx
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <tools/debug.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <wrtsh.hxx>
+#include "barcfg.hxx"
+
+#include <unomid.h>
+
+using namespace utl;
+using rtl::OUString;
+using namespace com::sun::star::uno;
+
+#define SEL_TYPE_TABLE_TEXT 0
+#define SEL_TYPE_LIST_TEXT 1
+#define SEL_TYPE_TABLE_LIST 2
+#define SEL_TYPE_BEZIER 3
+#define SEL_TYPE_GRAPHIC 4
+
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwToolbarConfigItem::SwToolbarConfigItem( BOOL bWeb ) :
+ ConfigItem(bWeb ? C2U("Office.WriterWeb/ObjectBar") : C2U("Office.Writer/ObjectBar"),
+ CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE)
+{
+ for(USHORT i = 0; i <= SEL_TYPE_GRAPHIC; i++ )
+ aTbxIdArray[i] = -1;
+
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aNames.getLength())
+ {
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ sal_Int32 nVal = 0;
+ pValues[nProp] >>= nVal;
+ aTbxIdArray[nProp] = nVal;
+ }
+ }
+ }
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwToolbarConfigItem::~SwToolbarConfigItem()
+{
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int32 lcl_getArrayIndex(int nSelType)
+{
+ sal_Int32 nRet = -1;
+ if(nSelType & nsSelectionType::SEL_NUM)
+ {
+ if(nSelType & nsSelectionType::SEL_TBL)
+ nRet = SEL_TYPE_TABLE_LIST;
+ else
+ nRet = SEL_TYPE_LIST_TEXT;
+ }
+ else if(nSelType & nsSelectionType::SEL_TBL)
+ nRet = SEL_TYPE_TABLE_TEXT;
+ else if(nSelType & nsSelectionType::SEL_BEZ)
+ nRet = SEL_TYPE_BEZIER;
+ else if(nSelType & nsSelectionType::SEL_GRF)
+ nRet = SEL_TYPE_GRAPHIC;
+ return nRet;
+}
+/* -----------------------------10.10.00 14:38--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwToolbarConfigItem::SetTopToolbar( sal_Int32 nSelType, sal_Int32 nBarId )
+{
+ sal_Int32 nProp = lcl_getArrayIndex(nSelType);
+ if(nProp >= 0)
+ {
+ aTbxIdArray[nProp] = nBarId;
+ SetModified();
+ }
+}
+/* -----------------------------10.10.00 13:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence<OUString> SwToolbarConfigItem::GetPropertyNames()
+{
+ static const char* aPropNames[] =
+ {
+ "Selection/Table", // SEL_TYPE_TABLE_TEXT
+ "Selection/NumberedList", // SEL_TYPE_LIST_TEXT
+ "Selection/NumberedList_InTable", // SEL_TYPE_TABLE_LIST
+ "Selection/BezierObject", // SEL_TYPE_BEZIER
+ "Selection/Graphic" //SEL_TYPE_GRAPHIC
+ };
+ const int nCount = 5;
+ Sequence<OUString> aNames(nCount);
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ pNames[i] = OUString::createFromAscii(aPropNames[i]);
+ return aNames;
+}
+/* -----------------------------10.10.00 13:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwToolbarConfigItem::Commit()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ pValues[nProp] <<= aTbxIdArray[nProp];
+ PutProperties(aNames, aValues);
+}
+
+void SwToolbarConfigItem::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
diff --git a/sw/source/ui/config/caption.cxx b/sw/source/ui/config/caption.cxx
new file mode 100644
index 000000000000..d60361e49453
--- /dev/null
+++ b/sw/source/ui/config/caption.cxx
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <tools/debug.hxx>
+
+#include "numrule.hxx"
+#include "caption.hxx"
+
+#define VERSION_01 1
+#define CAPTION_VERSION VERSION_01
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+InsCaptionOpt::InsCaptionOpt(const SwCapObjType eType, const SvGlobalName* pOleId) :
+ bUseCaption(FALSE),
+ eObjType(eType),
+ nNumType(SVX_NUM_ARABIC),
+ sNumberSeparator( ::rtl::OUString::createFromAscii(". ") ),
+ nPos(1),
+ nLevel(0),
+ sSeparator( String::CreateFromAscii( ": " ) ),
+ bIgnoreSeqOpts(FALSE),
+ bCopyAttributes(FALSE)
+{
+ if (pOleId)
+ aOleId = *pOleId;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+InsCaptionOpt::InsCaptionOpt(const InsCaptionOpt& rOpt)
+{
+ *this = rOpt;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+InsCaptionOpt::~InsCaptionOpt()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+InsCaptionOpt& InsCaptionOpt::operator=( const InsCaptionOpt& rOpt )
+{
+ bUseCaption = rOpt.bUseCaption;
+ eObjType = rOpt.eObjType;
+ aOleId = rOpt.aOleId;
+ sCategory = rOpt.sCategory;
+ nNumType = rOpt.nNumType;
+ sNumberSeparator = rOpt.sNumberSeparator;
+ sCaption = rOpt.sCaption;
+ nPos = rOpt.nPos;
+ nLevel = rOpt.nLevel;
+ sSeparator = rOpt.sSeparator;
+ bIgnoreSeqOpts = rOpt.bIgnoreSeqOpts;
+ sCharacterStyle = rOpt.sCharacterStyle;
+ bCopyAttributes = rOpt.bCopyAttributes;
+
+ return *this;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL InsCaptionOpt::operator==( const InsCaptionOpt& rOpt ) const
+{
+ return (eObjType == rOpt.eObjType &&
+ aOleId == rOpt.aOleId); // Damit gleiche Ole-IDs nicht mehrfach eingefuegt
+ // werden koennen, auf nichts weiteres vergleichen
+
+
+/* &&
+ sCategory == rOpt.sCategory &&
+ nNumType == rOpt.nNumType &&
+ sCaption == rOpt.sCaption &&
+ nPos == rOpt.nPos &&
+ nLevel == rOpt.nLevel &&
+ cSeparator == rOpt.cSeparator);*/
+}
+
+/*************************************************************************
+|*
+|* InsCaptionOpt::operator>>()
+|*
+|* Beschreibung Stream-Leseoperator
+|*
+*************************************************************************/
+
+/*SvStream& operator>>( SvStream& rIStream, InsCaptionOpt& rCapOpt )
+{
+ rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding();
+ UINT16 nVal;
+ BYTE cVal;
+ BYTE nVersion;
+
+ rIStream >> nVersion;
+ rIStream >> cVal; rCapOpt.UseCaption() = cVal != 0;
+ rIStream >> nVal; rCapOpt.eObjType = (SwCapObjType)nVal;
+ rIStream >> rCapOpt.aOleId;
+
+ rIStream.ReadByteString( rCapOpt.sCategory, eEncoding );
+ rIStream >> nVal; rCapOpt.nNumType = nVal;
+ rIStream.ReadByteString( rCapOpt.sCaption, eEncoding );
+ rIStream >> nVal; rCapOpt.nPos = nVal;
+ rIStream >> nVal; rCapOpt.nLevel = nVal;
+
+ rIStream >> cVal;
+ rCapOpt.sSeparator = UniString(
+ ByteString(static_cast< char >(cVal)) , eEncoding).GetChar(0);
+
+ return rIStream;
+}
+*/
+/*************************************************************************
+|*
+|* InsCaptionOpt::operator<<()
+|*
+|* Beschreibung Stream-Schreiboperator
+|*
+*************************************************************************/
+
+/*SvStream& operator<<( SvStream& rOStream, const InsCaptionOpt& rCapOpt )
+{
+ rtl_TextEncoding eEncoding = gsl_getSystemTextEncoding();
+ rOStream << (BYTE)CAPTION_VERSION
+ << (BYTE)rCapOpt.UseCaption()
+ << (UINT16)rCapOpt.eObjType
+ << rCapOpt.aOleId;
+
+ rOStream.WriteByteString( rCapOpt.sCategory, eEncoding );
+
+ rOStream << (UINT16)rCapOpt.nNumType;
+
+ rOStream.WriteByteString( rCapOpt.sCaption, eEncoding );
+
+ BYTE cSep = ByteString(rCapOpt.sSeparator, eEncoding).GetChar(0);
+ rOStream << (UINT16)rCapOpt.nPos
+ << (UINT16)rCapOpt.nLevel
+ << cSep;
+
+ return rOStream;
+}
+*/
+
diff --git a/sw/source/ui/config/cfgitems.cxx b/sw/source/ui/config/cfgitems.cxx
new file mode 100644
index 000000000000..8652970d588f
--- /dev/null
+++ b/sw/source/ui/config/cfgitems.cxx
@@ -0,0 +1,460 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#ifndef __SBX_SBXVARIABLE_HXX //autogen
+#include <basic/sbxvar.hxx>
+#endif
+
+#ifndef _SVX_SVXIDS_HRC //autogen
+#include <svx/svxids.hrc>
+#endif
+#include <editeng/svxenum.hxx>
+
+
+#include "viewopt.hxx"
+#include "swtypes.hxx"
+#include "cmdid.h"
+#include "prtopt.hxx"
+#include "cfgitems.hxx"
+#include "crstate.hxx"
+
+
+
+TYPEINIT1_AUTOFACTORY(SwDocDisplayItem, SfxPoolItem)
+TYPEINIT1_AUTOFACTORY(SwElemItem, SfxPoolItem)
+TYPEINIT1_AUTOFACTORY(SwAddPrinterItem, SfxPoolItem)
+TYPEINIT1_AUTOFACTORY(SwShadowCursorItem, SfxPoolItem)
+
+
+SwDocDisplayItem::SwDocDisplayItem( USHORT _nWhich ) :
+ SfxPoolItem(_nWhich),
+ aIndexBackgrndCol(COL_GRAY)
+{
+ bParagraphEnd =
+ bTab =
+ bSpace =
+ bNonbreakingSpace =
+ bSoftHyphen =
+ bFldHiddenText =
+ bCharHiddenText =
+ bManualBreak =
+ bShowHiddenPara = FALSE;
+
+};
+
+/*------------OS 12.01.95 -------------------------------------------
+ Item fuer Einstellungsdialog, Seite Dokumentansicht
+--------------------------------------------------------------------*/
+
+SwDocDisplayItem::SwDocDisplayItem( const SwDocDisplayItem& rDocDisplayItem ):
+ SfxPoolItem(rDocDisplayItem)
+{
+ *this = rDocDisplayItem;
+};
+
+/*----------------------- -------------------------------------------
+
+--------------------------------------------------------------------*/
+
+SwDocDisplayItem::SwDocDisplayItem(const SwViewOption& rVOpt, USHORT _nWhich ) :
+ SfxPoolItem( _nWhich )
+{
+ bParagraphEnd = rVOpt.IsParagraph(TRUE);
+ bTab = rVOpt.IsTab(TRUE);
+ bSpace = rVOpt.IsBlank(TRUE);
+ bNonbreakingSpace = rVOpt.IsHardBlank();
+ bSoftHyphen = rVOpt.IsSoftHyph();
+ bCharHiddenText = rVOpt.IsShowHiddenChar(TRUE);
+ bFldHiddenText = rVOpt.IsShowHiddenField();
+ bManualBreak = rVOpt.IsLineBreak(TRUE);
+ bShowHiddenPara = rVOpt.IsShowHiddenPara();
+
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxPoolItem* SwDocDisplayItem::Clone( SfxItemPool* ) const
+{
+ return new SwDocDisplayItem( *this );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+int SwDocDisplayItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" );
+
+ const SwDocDisplayItem& rItem = (SwDocDisplayItem&)rAttr;
+
+ return ( bParagraphEnd == rItem.bParagraphEnd &&
+ bTab == rItem.bTab &&
+ bSpace == rItem.bSpace &&
+ bNonbreakingSpace == rItem.bNonbreakingSpace &&
+ bSoftHyphen == rItem.bSoftHyphen &&
+ bCharHiddenText == rItem.bCharHiddenText &&
+ bFldHiddenText == rItem.bFldHiddenText &&
+ bManualBreak == rItem.bManualBreak &&
+ bShowHiddenPara == rItem.bShowHiddenPara );
+}
+
+
+/*-----------------31.08.96 14.14-------------------
+
+--------------------------------------------------*/
+
+
+void SwDocDisplayItem::operator=( const SwDocDisplayItem& rDocDisplayItem)
+{
+ bParagraphEnd = rDocDisplayItem.bParagraphEnd ;
+ bTab = rDocDisplayItem.bTab ;
+ bSpace = rDocDisplayItem.bSpace ;
+ bNonbreakingSpace = rDocDisplayItem.bNonbreakingSpace ;
+ bSoftHyphen = rDocDisplayItem.bSoftHyphen ;
+ bCharHiddenText = rDocDisplayItem.bCharHiddenText ;
+ bFldHiddenText = rDocDisplayItem.bFldHiddenText ;
+ bManualBreak = rDocDisplayItem.bManualBreak ;
+ bShowHiddenPara = rDocDisplayItem.bShowHiddenPara ;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+void SwDocDisplayItem::FillViewOptions( SwViewOption& rVOpt) const
+{
+ rVOpt.SetParagraph (bParagraphEnd );
+ rVOpt.SetTab (bTab );
+ rVOpt.SetBlank (bSpace );
+ rVOpt.SetHardBlank (bNonbreakingSpace );
+ rVOpt.SetSoftHyph (bSoftHyphen );
+ rVOpt.SetShowHiddenChar(bCharHiddenText );
+ rVOpt.SetShowHiddenField(bFldHiddenText );
+ rVOpt.SetLineBreak (bManualBreak );
+ rVOpt.SetShowHiddenPara(bShowHiddenPara );
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+SwElemItem::SwElemItem( USHORT _nWhich ) :
+ SfxPoolItem(_nWhich)
+{
+ bHorzScrollbar =
+ bVertScrollbar =
+ bAnyRuler =
+ bHorzRuler =
+ bVertRuler =
+ bVertRulerRight=
+ bCrosshair =
+ bHandles =
+ bBigHandles =
+ bSmoothScroll =
+ bTable =
+ bGraphic =
+ bDrawing =
+ bFieldName =
+ bNotes = FALSE;
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwElemItem::SwElemItem( const SwElemItem& rElemItem ):
+ SfxPoolItem(rElemItem)
+{
+ *this = rElemItem;
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwElemItem::SwElemItem(const SwViewOption& rVOpt, USHORT _nWhich) :
+ SfxPoolItem( _nWhich )
+{
+ bHorzScrollbar = rVOpt.IsViewHScrollBar();
+ bVertScrollbar = rVOpt.IsViewVScrollBar();
+ bAnyRuler = rVOpt.IsViewAnyRuler();
+ bHorzRuler = rVOpt.IsViewHRuler(TRUE);
+ bVertRuler = rVOpt.IsViewVRuler(TRUE);
+ bVertRulerRight = rVOpt.IsVRulerRight();
+ bCrosshair = rVOpt.IsCrossHair();
+ bHandles = rVOpt.IsSolidMarkHdl();
+ bBigHandles = rVOpt.IsBigMarkHdl();
+ bSmoothScroll = rVOpt.IsSmoothScroll();
+ bTable = rVOpt.IsTable();
+ bGraphic = rVOpt.IsGraphic();
+ bDrawing = rVOpt.IsDraw() && rVOpt.IsControl();
+ bFieldName = rVOpt.IsFldName();
+ bNotes = rVOpt.IsPostIts();
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxPoolItem* SwElemItem::Clone( SfxItemPool* ) const
+{
+ return new SwElemItem( *this );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+int SwElemItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" );
+
+ const SwElemItem& rItem = (SwElemItem&)rAttr;
+
+ return ( bHorzScrollbar == rItem.bHorzScrollbar &&
+ bVertScrollbar == rItem.bVertScrollbar &&
+ bAnyRuler == rItem.bAnyRuler &&
+ bHorzRuler == rItem.bHorzRuler &&
+ bVertRuler == rItem.bVertRuler &&
+ bVertRulerRight == rItem.bVertRulerRight&&
+ bCrosshair == rItem.bCrosshair &&
+ bHandles == rItem.bHandles &&
+ bBigHandles == rItem.bBigHandles &&
+ bSmoothScroll == rItem.bSmoothScroll &&
+ bTable == rItem.bTable &&
+ bGraphic == rItem.bGraphic &&
+ bDrawing == rItem.bDrawing &&
+ bFieldName == rItem.bFieldName &&
+ bNotes == rItem.bNotes );
+}
+
+/*-----------------31.08.96 14.13-------------------
+
+--------------------------------------------------*/
+
+
+void SwElemItem::operator=( const SwElemItem& rElemItem)
+{
+ bHorzScrollbar = rElemItem. bHorzScrollbar ;
+ bVertScrollbar = rElemItem. bVertScrollbar ;
+ bAnyRuler = rElemItem. bAnyRuler;
+ bHorzRuler = rElemItem. bHorzRuler ;
+ bVertRuler = rElemItem. bVertRuler ;
+ bVertRulerRight = rElemItem. bVertRulerRight ;
+ bCrosshair = rElemItem. bCrosshair ;
+ bHandles = rElemItem. bHandles ;
+ bBigHandles = rElemItem. bBigHandles ;
+ bSmoothScroll = rElemItem. bSmoothScroll ;
+ bTable = rElemItem.bTable ;
+ bGraphic = rElemItem.bGraphic ;
+ bDrawing = rElemItem.bDrawing ;
+ bFieldName = rElemItem.bFieldName ;
+ bNotes = rElemItem.bNotes ;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwElemItem::FillViewOptions( SwViewOption& rVOpt) const
+{
+ rVOpt.SetViewHScrollBar(bHorzScrollbar );
+ rVOpt.SetViewVScrollBar(bVertScrollbar );
+ rVOpt.SetViewAnyRuler(bAnyRuler);
+ rVOpt.SetViewHRuler(bHorzRuler );
+ rVOpt.SetViewVRuler(bVertRuler );
+ rVOpt.SetVRulerRight(bVertRulerRight );
+ rVOpt.SetCrossHair(bCrosshair );
+ rVOpt.SetSolidMarkHdl(bHandles );
+ rVOpt.SetBigMarkHdl(bBigHandles );
+ rVOpt.SetSmoothScroll(bSmoothScroll);
+ rVOpt.SetTable (bTable );
+ rVOpt.SetGraphic (bGraphic );
+ rVOpt.SetDraw (bDrawing );
+ rVOpt.SetControl (bDrawing );
+ rVOpt.SetFldName (bFieldName );
+ rVOpt.SetPostIts (bNotes );
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: CopyCTOR
+ --------------------------------------------------------------------*/
+
+SwAddPrinterItem::SwAddPrinterItem( const SwAddPrinterItem& rAddPrinterItem ):
+ SfxPoolItem(rAddPrinterItem),
+ SwPrintData( rAddPrinterItem )
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: CTOR fuer leeres Item
+ --------------------------------------------------------------------*/
+
+SwAddPrinterItem::SwAddPrinterItem( USHORT _nWhich):
+ SfxPoolItem(_nWhich)
+{
+}
+/*--------------------------------------------------------------------
+ Beschreibung: CTOR aus SwPrintOptions
+ --------------------------------------------------------------------*/
+
+SwAddPrinterItem::SwAddPrinterItem( USHORT _nWhich, const SwPrintData& rPrtData ) :
+ SfxPoolItem(_nWhich)
+{
+ SwPrintData::operator=(rPrtData);
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxPoolItem* SwAddPrinterItem::Clone( SfxItemPool* ) const
+{
+ return new SwAddPrinterItem( *this );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+int SwAddPrinterItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" );
+
+ const SwAddPrinterItem& rItem = (SwAddPrinterItem&)rAttr;
+
+ return SwPrintData::operator==(rItem);
+}
+/*-----------------03.11.97 10:00-------------------
+ Item fuer Einstellungsdialog, ShadowCursorSeite
+--------------------------------------------------*/
+
+SwShadowCursorItem::SwShadowCursorItem( USHORT _nWhich )
+ : SfxPoolItem( _nWhich ),
+ eMode( FILL_TAB )
+ ,bOn( FALSE )
+{
+}
+
+SwShadowCursorItem::SwShadowCursorItem( const SwShadowCursorItem& rCpy )
+ : SfxPoolItem( rCpy.Which() ),
+ eMode( rCpy.GetMode() )
+ ,bOn( rCpy.IsOn() )
+
+{
+}
+
+SwShadowCursorItem::SwShadowCursorItem( const SwViewOption& rVOpt, USHORT _nWhich )
+ : SfxPoolItem( _nWhich ),
+ eMode( rVOpt.GetShdwCrsrFillMode() )
+ ,bOn( rVOpt.IsShadowCursor() )
+
+{
+}
+
+SfxPoolItem* SwShadowCursorItem::Clone( SfxItemPool* ) const
+{
+ return new SwShadowCursorItem( *this );
+}
+
+int SwShadowCursorItem::operator==( const SfxPoolItem& rCmp ) const
+{
+ return IsOn() == ((SwShadowCursorItem&)rCmp).IsOn() &&
+ GetMode() == ((SwShadowCursorItem&)rCmp).GetMode();
+}
+
+void SwShadowCursorItem::operator=( const SwShadowCursorItem& rCpy )
+{
+ SetOn( rCpy.IsOn() );
+ SetMode( rCpy.GetMode() );
+}
+
+
+void SwShadowCursorItem::FillViewOptions( SwViewOption& rVOpt ) const
+{
+ rVOpt.SetShadowCursor( bOn );
+ rVOpt.SetShdwCrsrFillMode( eMode );
+}
+
+#ifdef DBG_UTIL
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwTestItem::SwTestItem( const SwTestItem& rTestItem ):
+ SfxPoolItem(rTestItem)
+{
+ bTest1=rTestItem.bTest1;
+ bTest2=rTestItem.bTest2;
+ bTest3=rTestItem.bTest3;
+ bTest4=rTestItem.bTest4;
+ bTest5=rTestItem.bTest5;
+ bTest6=rTestItem.bTest6;
+ bTest7=rTestItem.bTest7;
+ bTest8=rTestItem.bTest8;
+ bTest9=rTestItem.bTest9;
+ bTest10=rTestItem.bTest10;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxPoolItem* SwTestItem::Clone( SfxItemPool* ) const
+{
+ return new SwTestItem( *this );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+int SwTestItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" );
+
+ const SwTestItem& rItem = (const SwTestItem&) rAttr;
+
+ return ( bTest1==rItem.bTest1&&
+ bTest2==rItem.bTest2&&
+ bTest3==rItem.bTest3&&
+ bTest4==rItem.bTest4&&
+ bTest5==rItem.bTest5&&
+ bTest6==rItem.bTest6&&
+ bTest7==rItem.bTest7&&
+ bTest8==rItem.bTest8&&
+ bTest9==rItem.bTest9&&
+ bTest10==rItem.bTest10);
+}
+
+#endif
+
+
diff --git a/sw/source/ui/config/config.hrc b/sw/source/ui/config/config.hrc
new file mode 100644
index 000000000000..197e6482d7a1
--- /dev/null
+++ b/sw/source/ui/config/config.hrc
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONFIG_HRC
+#define _CONFIG_HRC
+
+#include "rcid.hrc"
+
+// Dialoge fuer die Konfiguration
+
+// Strings fuer die Konfiguration
+#define STR_CFG_SIGNATUR (RC_CONFIG_BEGIN + 0)
+#define DLG_CONFIG_VIEW (RC_CONFIG_BEGIN + 1)
+#define DLG_CONFIG_MISC (RC_CONFIG_BEGIN + 2)
+#define DLG_CONFIG_SAVE (RC_CONFIG_BEGIN + 3)
+#define DLG_CONFIG_PATH (RC_CONFIG_BEGIN + 4)
+#define DLG_CONFIG_MENU (RC_CONFIG_BEGIN + 5)
+#define DLG_CONFIG_KEY (RC_CONFIG_BEGIN + 6)
+#define DLG_CONFIG_TOOLBOX (RC_CONFIG_BEGIN + 7)
+#define DLG_CONFIG_COLOR (RC_CONFIG_BEGIN + 8)
+#define DLG_TBSEL (RC_CONFIG_BEGIN + 9)
+#define DLG_CFGSEL (RC_CONFIG_BEGIN + 10)
+#define DLG_CONFIG (RC_CONFIG_BEGIN + 11)
+#define DLG_MAC_ASSIGN (RC_CONFIG_BEGIN + 12)
+
+#define MSG_DOUBLE_MENU_ID (RC_CONFIG_BEGIN + 13)
+#define MSG_DOUBLE_ID (RC_CONFIG_BEGIN + 14)
+#define DLG_SYMBOL_SELECT (RC_CONFIG_BEGIN + 15)
+#define DLG_CONFIG_GRID (RC_CONFIG_BEGIN + 16)
+#define DLG_CONFIG_ADDR (RC_CONFIG_BEGIN + 17)
+
+#define DLG_MM_TESTACCOUNTSETTINGS (RC_CONFIG_BEGIN + 19)
+#define DLG_MM_SERVERAUTHENTICATION (RC_CONFIG_BEGIN + 20)
+
+#define STR_ERROR_PATH (RC_CONFIG_BEGIN + 25)
+#define STR_ARR_METRIC (RC_CONFIG_BEGIN + 26)
+#define CONFIG_ACT_END STR_ARR_METRIC
+
+#if CONFIG_ACT_END > RC_CONFIG_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+
+#endif
diff --git a/sw/source/ui/config/dbconfig.cxx b/sw/source/ui/config/dbconfig.cxx
new file mode 100644
index 000000000000..ade5163a5921
--- /dev/null
+++ b/sw/source/ui/config/dbconfig.cxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <dbconfig.hxx>
+#include <tools/debug.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <swdbdata.hxx>
+
+#include <unomid.h>
+
+using namespace utl;
+using rtl::OUString;
+using namespace com::sun::star::uno;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ctor
+ --------------------------------------------------------------------*/
+
+const Sequence<OUString>& SwDBConfig::GetPropertyNames()
+{
+ static Sequence<OUString> aNames;
+ if(!aNames.getLength())
+ {
+ static const char* aPropNames[] =
+ {
+ "AddressBook/DataSourceName", // 0
+ "AddressBook/Command", // 1
+ "AddressBook/CommandType", // 2
+ "Bibliography/CurrentDataSource/DataSourceName", // 4
+ "Bibliography/CurrentDataSource/Command", // 5
+ "Bibliography/CurrentDataSource/CommandType" // 6
+ };
+ const int nCount = sizeof(aPropNames)/sizeof(const char*);
+ aNames.realloc(nCount);
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ pNames[i] = OUString::createFromAscii(aPropNames[i]);
+ }
+ return aNames;
+}
+/* -----------------------------06.09.00 16:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwDBConfig::SwDBConfig() :
+ ConfigItem(C2U("Office.DataAccess"),
+ CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
+ pAdrImpl(0),
+ pBibImpl(0)
+{
+};
+/* -----------------------------06.09.00 16:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwDBConfig::~SwDBConfig()
+{
+ delete pAdrImpl;
+ delete pBibImpl;
+}
+/* -----------------------------20.02.01 12:32--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDBConfig::Load()
+{
+ const Sequence<OUString>& rNames = GetPropertyNames();
+ if(!pAdrImpl)
+ {
+
+ pAdrImpl = new SwDBData;
+ pAdrImpl->nCommandType = 0;
+ pBibImpl = new SwDBData;
+ pBibImpl->nCommandType = 0;
+ }
+ Sequence<Any> aValues = GetProperties(rNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == rNames.getLength())
+ {
+ for(int nProp = 0; nProp < rNames.getLength(); nProp++)
+ {
+ switch(nProp)
+ {
+ case 0: pValues[nProp] >>= pAdrImpl->sDataSource; break;
+ case 1: pValues[nProp] >>= pAdrImpl->sCommand; break;
+ case 2: pValues[nProp] >>= pAdrImpl->nCommandType; break;
+ case 3: pValues[nProp] >>= pBibImpl->sDataSource; break;
+ case 4: pValues[nProp] >>= pBibImpl->sCommand; break;
+ case 5: pValues[nProp] >>= pBibImpl->nCommandType; break;
+ }
+ }
+ }
+}
+/* -----------------------------20.02.01 12:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const SwDBData& SwDBConfig::GetAddressSource()
+{
+ if(!pAdrImpl)
+ Load();
+ return *pAdrImpl;
+}
+/* -----------------29.11.2002 11:43-----------------
+ *
+ * --------------------------------------------------*/
+const SwDBData& SwDBConfig::GetBibliographySource()
+{
+ if(!pBibImpl)
+ Load();
+ return *pBibImpl;
+}
+
+void SwDBConfig::Commit() {}
+void SwDBConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+
diff --git a/sw/source/ui/config/fontcfg.cxx b/sw/source/ui/config/fontcfg.cxx
new file mode 100644
index 000000000000..e1b951c1c879
--- /dev/null
+++ b/sw/source/ui/config/fontcfg.cxx
@@ -0,0 +1,359 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <fontcfg.hxx>
+#include <i18npool/mslangid.hxx>
+#include <vcl/outdev.hxx>
+#include <unotools/lingucfg.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <swtypes.hxx>
+
+#include <unomid.h>
+
+using namespace utl;
+using rtl::OUString;
+using namespace com::sun::star::uno;
+
+/* -----------------07.10.2002 12:15-----------------
+ *
+ * --------------------------------------------------*/
+inline LanguageType lcl_LanguageOfType(sal_Int16 nType, sal_Int16 eWestern, sal_Int16 eCJK, sal_Int16 eCTL)
+{
+ return LanguageType(
+ nType < FONT_STANDARD_CJK ? eWestern :
+ nType >= FONT_STANDARD_CTL ? eCTL : eCJK);
+}
+/* -----------------------------08.09.00 15:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence<OUString> SwStdFontConfig::GetPropertyNames()
+{
+ Sequence<OUString> aNames;
+ if(!aNames.getLength())
+ {
+ static const char* aPropNames[] =
+ {
+ "DefaultFont/Standard", // 0
+ "DefaultFont/Heading", // 1
+ "DefaultFont/List", // 2
+ "DefaultFont/Caption", // 3
+ "DefaultFont/Index", // 4
+ "DefaultFontCJK/Standard", // 5
+ "DefaultFontCJK/Heading", // 6
+ "DefaultFontCJK/List", // 7
+ "DefaultFontCJK/Caption", // 8
+ "DefaultFontCJK/Index", // 9
+ "DefaultFontCTL/Standard", // 10
+ "DefaultFontCTL/Heading", // 11
+ "DefaultFontCTL/List", // 12
+ "DefaultFontCTL/Caption", // 13
+ "DefaultFontCTL/Index", // 14
+ "DefaultFont/StandardHeight", // 15
+ "DefaultFont/HeadingHeight", // 16
+ "DefaultFont/ListHeight", // 17
+ "DefaultFont/CaptionHeight", // 18
+ "DefaultFont/IndexHeight", // 19
+ "DefaultFontCJK/StandardHeight", // 20
+ "DefaultFontCJK/HeadingHeight", // 21
+ "DefaultFontCJK/ListHeight", // 22
+ "DefaultFontCJK/CaptionHeight", // 23
+ "DefaultFontCJK/IndexHeight", // 24
+ "DefaultFontCTL/StandardHeight", // 25
+ "DefaultFontCTL/HeadingHeight", // 26
+ "DefaultFontCTL/ListHeight", // 27
+ "DefaultFontCTL/CaptionHeight", // 28
+ "DefaultFontCTL/IndexHeight" // 29
+ };
+ const int nCount = sizeof(aPropNames)/sizeof(const char*);
+ aNames.realloc(nCount);
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ {
+ pNames[i] = OUString::createFromAscii(aPropNames[i]);
+ }
+ }
+ return aNames;
+}
+/*-----------------03.09.96 15.00-------------------
+
+--------------------------------------------------*/
+
+SwStdFontConfig::SwStdFontConfig() :
+ utl::ConfigItem(C2U("Office.Writer"))
+{
+ SvtLinguOptions aLinguOpt;
+
+ SvtLinguConfig().GetOptions( aLinguOpt );
+
+ sal_Int16 eWestern = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN),
+ eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN),
+ eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
+
+ for(sal_Int16 i = 0; i < DEF_FONT_COUNT; i++)
+ {
+ sDefaultFonts[i] = GetDefaultFor(i,
+ lcl_LanguageOfType(i, eWestern, eCJK, eCTL));
+ nDefaultFontHeight[i] = -1;
+ }
+
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aNames.getLength())
+ {
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ if( nProp < DEF_FONT_COUNT)
+ {
+ OUString sVal;
+ pValues[nProp] >>= sVal;
+ sDefaultFonts[nProp] = sVal;
+ }
+ else
+ {
+ pValues[nProp] >>= nDefaultFontHeight[nProp - DEF_FONT_COUNT];
+ nDefaultFontHeight[nProp - DEF_FONT_COUNT] = MM100_TO_TWIP(nDefaultFontHeight[nProp - DEF_FONT_COUNT]);
+ }
+ }
+ }
+ }
+}
+/* -----------------------------08.09.00 15:58--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwStdFontConfig::Commit()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+ SvtLinguOptions aLinguOpt;
+
+ SvtLinguConfig().GetOptions( aLinguOpt );
+
+ sal_Int16 eWestern = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN),
+ eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN),
+ eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
+
+ for(sal_uInt16 nProp = 0;
+ nProp < sal::static_int_cast< sal_uInt16, sal_Int32 >( aNames.getLength() );
+ nProp++)
+ {
+ if( nProp < DEF_FONT_COUNT )
+ {
+ if(GetDefaultFor(nProp, lcl_LanguageOfType(nProp, eWestern, eCJK, eCTL)) != sDefaultFonts[nProp])
+ pValues[nProp] <<= OUString(sDefaultFonts[nProp]);
+ }
+ else
+ {
+ if(nDefaultFontHeight[nProp - DEF_FONT_COUNT] > 0)
+ pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(nDefaultFontHeight[nProp - DEF_FONT_COUNT]));
+ }
+ }
+ PutProperties(aNames, aValues);
+}
+/* -----------------------------08.09.00 15:56--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwStdFontConfig::~SwStdFontConfig()
+{}
+/*-----------------18.01.97 10.05-------------------
+
+--------------------------------------------------*/
+BOOL SwStdFontConfig::IsFontDefault(USHORT nFontType) const
+{
+ BOOL bSame = sal_False;
+ SvtLinguOptions aLinguOpt;
+
+ SvtLinguConfig().GetOptions( aLinguOpt );
+
+ sal_Int16 eWestern = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN),
+ eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN),
+ eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
+
+ String sDefFont(GetDefaultFor(FONT_STANDARD, eWestern));
+ String sDefFontCJK(GetDefaultFor(FONT_STANDARD_CJK, eCJK));
+ String sDefFontCTL(GetDefaultFor(FONT_STANDARD_CTL, eCTL));
+ LanguageType eLang = lcl_LanguageOfType(nFontType, eWestern, eCJK, eCTL);
+ switch( nFontType )
+ {
+ case FONT_STANDARD:
+ bSame = sDefaultFonts[nFontType] == sDefFont;
+ break;
+ case FONT_STANDARD_CJK:
+ bSame = sDefaultFonts[nFontType] == sDefFontCJK;
+ break;
+ case FONT_STANDARD_CTL:
+ bSame = sDefaultFonts[nFontType] == sDefFontCTL;
+ break;
+ case FONT_OUTLINE :
+ case FONT_OUTLINE_CJK :
+ case FONT_OUTLINE_CTL :
+ bSame = sDefaultFonts[nFontType] ==
+ GetDefaultFor(nFontType, eLang);
+ break;
+ case FONT_LIST :
+ case FONT_CAPTION :
+ case FONT_INDEX :
+ bSame = sDefaultFonts[nFontType] == sDefFont &&
+ sDefaultFonts[FONT_STANDARD] == sDefFont;
+ break;
+ case FONT_LIST_CJK :
+ case FONT_CAPTION_CJK :
+ case FONT_INDEX_CJK :
+ {
+ BOOL b1 = sDefaultFonts[FONT_STANDARD_CJK] == sDefFontCJK;
+ bSame = b1 && sDefaultFonts[nFontType] == sDefFontCJK;
+ }
+ break;
+ case FONT_LIST_CTL :
+ case FONT_CAPTION_CTL :
+ case FONT_INDEX_CTL :
+ {
+ BOOL b1 = sDefaultFonts[FONT_STANDARD_CJK] == sDefFontCTL;
+ bSame = b1 && sDefaultFonts[nFontType] == sDefFontCTL;
+ }
+ break;
+ }
+ return bSame;
+}
+
+/* -----------------11.01.99 13:16-------------------
+ * Standards auslesen
+ * --------------------------------------------------*/
+String SwStdFontConfig::GetDefaultFor(USHORT nFontType, LanguageType eLang)
+{
+ String sRet;
+ USHORT nFontId;
+ switch( nFontType )
+ {
+ case FONT_OUTLINE :
+ nFontId = DEFAULTFONT_LATIN_HEADING;
+ break;
+ case FONT_OUTLINE_CJK :
+ nFontId = DEFAULTFONT_CJK_HEADING;
+ break;
+ case FONT_OUTLINE_CTL :
+ nFontId = DEFAULTFONT_CTL_HEADING;
+ break;
+ case FONT_STANDARD_CJK:
+ case FONT_LIST_CJK :
+ case FONT_CAPTION_CJK :
+ case FONT_INDEX_CJK :
+ nFontId = DEFAULTFONT_CJK_TEXT;
+ break;
+ case FONT_STANDARD_CTL:
+ case FONT_LIST_CTL :
+ case FONT_CAPTION_CTL :
+ case FONT_INDEX_CTL :
+ nFontId = DEFAULTFONT_CTL_TEXT;
+ break;
+// case FONT_STANDARD:
+// case FONT_LIST :
+// case FONT_CAPTION :
+// case FONT_INDEX :
+ default:
+ nFontId = DEFAULTFONT_LATIN_TEXT;
+ }
+ Font aFont = OutputDevice::GetDefaultFont(nFontId, eLang, DEFAULTFONT_FLAGS_ONLYONE);
+ return aFont.GetName();
+}
+
+/*-- 11.10.2005 10:43:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwStdFontConfig::GetDefaultHeightFor(USHORT nFontType, LanguageType eLang)
+{
+ sal_Int32 nRet = FONTSIZE_DEFAULT;
+ switch( nFontType )
+ {
+ case FONT_OUTLINE:
+ case FONT_OUTLINE_CJK:
+ case FONT_OUTLINE_CTL:
+ nRet = FONTSIZE_OUTLINE;
+ break;
+ }
+ if( eLang == LANGUAGE_THAI && nFontType >= FONT_STANDARD_CTL )
+ {
+ nRet = nRet * 4 / 3;
+ }
+ return nRet;
+}
+
+/*-- 11.10.2005 10:50:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwStdFontConfig::ChangeInt( USHORT nFontType, sal_Int32 nHeight )
+{
+ DBG_ASSERT( nFontType < DEF_FONT_COUNT, "invalid index in SwStdFontConfig::ChangInt()");
+ if( nFontType < DEF_FONT_COUNT && nDefaultFontHeight[nFontType] != nHeight)
+ {
+ SvtLinguOptions aLinguOpt;
+ SvtLinguConfig().GetOptions( aLinguOpt );
+
+ sal_Int16 eWestern = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN),
+ eCJK = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN),
+ eCTL = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
+
+ // #i92090# default height value sets back to -1
+ const sal_Int32 nDefaultHeight = GetDefaultHeightFor(nFontType, lcl_LanguageOfType(nFontType, eWestern, eCJK, eCTL));
+ const bool bIsDefaultHeight = nHeight == nDefaultHeight;
+ if( bIsDefaultHeight && nDefaultFontHeight[nFontType] > 0 )
+ {
+ SetModified();
+ nDefaultFontHeight[nFontType] = -1;
+ }
+ else if( !bIsDefaultHeight && nHeight != nDefaultFontHeight[nFontType] )
+ {
+ SetModified();
+ nDefaultFontHeight[nFontType] = nHeight;
+ }
+ }
+}
+
+/*-- 08.11.2005 14:18:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwStdFontConfig::GetFontHeight( sal_uInt8 nFont, sal_uInt8 nScriptType, LanguageType eLang )
+{
+ DBG_ASSERT(nFont + FONT_PER_GROUP * nScriptType < DEF_FONT_COUNT, "wrong index in SwStdFontConfig::GetFontHeight()");
+ sal_Int32 nRet = nDefaultFontHeight[nFont + FONT_PER_GROUP * nScriptType];
+ if(nRet <= 0)
+ return GetDefaultHeightFor(nFont + FONT_PER_GROUP * nScriptType, eLang);
+ return nRet;
+}
+
+void SwStdFontConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx
new file mode 100644
index 000000000000..726d27b281d1
--- /dev/null
+++ b/sw/source/ui/config/mailconfigpage.cxx
@@ -0,0 +1,622 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <swtypes.hxx>
+#include <mailconfigpage.hxx>
+#include <svtools/svmedit.hxx>
+#include <svtools/stdctrl.hxx>
+#include <svtools/svtabbx.hxx>
+#include <svtools/headbar.hxx>
+#include <mmconfigitem.hxx>
+#include <mailmergehelper.hxx>
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <vcl/svapp.hxx>
+#include <comphelper/processfactory.hxx>
+#include "com/sun/star/mail/MailServiceType.hpp"
+#include "com/sun/star/mail/XMailService.hpp"
+#include "com/sun/star/mail/MailServiceProvider.hpp"
+#include <vcl/msgbox.hxx>
+#include <globals.hrc>
+#include <mailconfigpage.hrc>
+#include <config.hrc>
+#include <helpid.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::mail;
+using namespace ::com::sun::star::beans;
+using ::rtl::OUString;
+/*-- 06.05.2004 12:04:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwTestAccountSettingsDialog : public SfxModalDialog
+{
+ FixedInfo m_aInfoFI;
+
+ HeaderBar m_aStatusHB;
+ SvTabListBox m_aStatusLB;
+
+ FixedInfo m_aErrorFI;
+ MultiLineEdit m_eErrorsED;
+
+ FixedLine m_aSeparatorFL;
+ PushButton m_aStopPB;
+ CancelButton m_aCancelPB;
+ HelpButton m_aHelpPB;
+
+ ImageList m_aImageList;
+
+ String m_sTask ;
+ String m_sStatus ;
+ String m_sEstablish ;
+ String m_sFindServer ;
+ String m_sCompleted ;
+ String m_sFailed ;
+ String m_sErrorNetwork;
+ String m_sErrorServer ;
+
+ SwMailConfigPage* m_pParent;
+
+ bool m_bStop;
+
+ void Test();
+ DECL_LINK(StopHdl, PushButton*);
+ DECL_STATIC_LINK(SwTestAccountSettingsDialog, TestHdl, void*);
+public:
+ SwTestAccountSettingsDialog(SwMailConfigPage* pParent);
+ ~SwTestAccountSettingsDialog();
+};
+/*-- 19.08.2004 14:27:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwAuthenticationSettingsDialog : public SfxModalDialog
+{
+ CheckBox m_aAuthenticationCB;
+
+ RadioButton m_aSeparateAuthenticationRB;
+ RadioButton m_aSMTPAfterPOPRB;
+
+ FixedInfo m_aOutgoingServerFT;
+ FixedText m_aUserNameFT;
+ Edit m_aUserNameED;
+ FixedText m_aOutPasswordFT;
+ Edit m_aOutPasswordED;
+
+ FixedInfo m_aIncomingServerFT;
+ FixedText m_aServerFT;
+ Edit m_aServerED;
+ FixedText m_aPortFT;
+ NumericField m_aPortNF;
+ FixedText m_aProtocolFT;
+ RadioButton m_aPOP3RB;
+ RadioButton m_aIMAPRB;
+ FixedText m_aInUsernameFT;
+ Edit m_aInUsernameED;
+ FixedText m_aInPasswordFT;
+ Edit m_aInPasswordED;
+
+ FixedLine m_aSeparatorFL;
+
+ OKButton m_aOKPB;
+ CancelButton m_aCancelPB;
+ HelpButton m_aHelpPB;
+
+ SwMailMergeConfigItem& rConfigItem;
+
+ DECL_LINK( OKHdl_Impl, OKButton*);
+ DECL_LINK( CheckBoxHdl_Impl, CheckBox*);
+ DECL_LINK( RadioButtonHdl_Impl, RadioButton*);
+
+
+public:
+ SwAuthenticationSettingsDialog(SwMailConfigPage* pParent, SwMailMergeConfigItem& rItem);
+ ~SwAuthenticationSettingsDialog();
+};
+
+/*-- 06.05.2004 10:59:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailConfigPage::SwMailConfigPage( Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SW_RES(TP_MAILCONFIG), rSet),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aIdentityFL( this, SW_RES( FL_IDENTITY)),
+ m_aDisplayNameFT( this, SW_RES( FT_DISPLAYNAME)),
+ m_aDisplayNameED( this, SW_RES( ED_DISPLAYNAME)),
+ m_aAddressFT( this, SW_RES( FT_ADDRESS)),
+ m_aAddressED( this, SW_RES( ED_ADDRESS)),
+ m_aReplyToCB( this, SW_RES( CB_REPLYTO)),
+ m_aReplyToFT( this, SW_RES( FT_REPLYTO)),
+ m_aReplyToED( this, SW_RES( ED_REPLYTO)),
+ m_aSMTPFL( this, SW_RES( FL_SMTP)),
+ m_aServerFT( this, SW_RES( FT_SERVER)),
+ m_aServerED( this, SW_RES( ED_SERVER)),
+ m_aPortFT( this, SW_RES( FT_PORT)),
+ m_aPortNF( this, SW_RES( NF_PORT)),
+ m_aSecureCB( this, SW_RES( CB_SECURE)),
+ m_aServerAuthenticationPB( this, SW_RES( PB_AUTHENTICATION )),
+ m_aSeparatorFL( this, SW_RES( FL_SEPARATOR )),
+ m_aTestPB( this, SW_RES( PB_TEST)),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_pConfigItem( new SwMailMergeConfigItem )
+{
+ FreeResource();
+ m_aReplyToCB.SetClickHdl(LINK(this, SwMailConfigPage, ReplyToHdl));
+ m_aServerAuthenticationPB.SetClickHdl(LINK(this, SwMailConfigPage, AuthenticationHdl));
+ m_aTestPB.SetClickHdl(LINK(this, SwMailConfigPage, TestHdl));
+}
+/*-- 06.05.2004 10:59:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailConfigPage::~SwMailConfigPage()
+{
+ delete m_pConfigItem;
+}
+/*-- 06.05.2004 10:59:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxTabPage* SwMailConfigPage::Create( Window* pParent, const SfxItemSet& rAttrSet)
+{
+ return new SwMailConfigPage(pParent, rAttrSet);
+}
+/*-- 06.05.2004 10:59:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+BOOL SwMailConfigPage::FillItemSet( SfxItemSet& /*rSet*/ )
+{
+ if(m_aDisplayNameED.GetText() != m_aDisplayNameED.GetSavedValue())
+ m_pConfigItem->SetMailDisplayName(m_aDisplayNameED.GetText());
+ if(m_aAddressED.GetText() != m_aAddressED.GetSavedValue())
+ m_pConfigItem->SetMailAddress(m_aAddressED.GetText());
+ String sReplyTo;
+ if( m_aReplyToCB.GetSavedValue() != m_aReplyToCB.IsChecked())
+ m_pConfigItem->SetMailReplyTo(m_aReplyToCB.IsChecked());
+ if(m_aReplyToED.GetText() != m_aReplyToED.GetSavedValue())
+ m_pConfigItem->SetMailReplyTo(m_aReplyToED.GetText());
+ if(m_aServerED.GetText() != m_aServerED.GetSavedValue())
+ m_pConfigItem->SetMailServer(m_aServerED.GetText());
+
+ if(m_aPortNF.IsModified())
+ m_pConfigItem->SetMailPort((sal_Int16)m_aPortNF.GetValue());
+
+ m_pConfigItem->SetSecureConnection(m_aSecureCB.IsChecked());
+
+ m_pConfigItem->Commit();
+ return sal_True;
+}
+/*-- 06.05.2004 10:59:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailConfigPage::Reset( const SfxItemSet& /*rSet*/ )
+{
+ m_aDisplayNameED.SetText(m_pConfigItem->GetMailDisplayName());
+ m_aAddressED.SetText(m_pConfigItem->GetMailAddress());
+
+ m_aReplyToED.SetText(m_pConfigItem->GetMailReplyTo()) ;
+ m_aReplyToCB.Check(m_pConfigItem->IsMailReplyTo());
+ m_aReplyToCB.GetClickHdl().Call(&m_aReplyToCB);
+
+ m_aServerED.SetText(m_pConfigItem->GetMailServer());
+ m_aPortNF.SetValue(m_pConfigItem->GetMailPort());
+
+ m_aSecureCB.Check(m_pConfigItem->IsSecureConnection());
+
+ m_aDisplayNameED.SaveValue();
+ m_aAddressED .SaveValue();
+ m_aReplyToCB .SaveValue();
+ m_aReplyToED .SaveValue();
+ m_aServerED .SaveValue();
+ m_aPortNF .SaveValue();
+ m_aSecureCB .SaveValue();
+}
+/*-- 06.05.2004 10:59:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailConfigPage, ReplyToHdl, CheckBox*, pBox)
+{
+ sal_Bool bEnable = pBox->IsChecked();
+ m_aReplyToFT.Enable(bEnable);
+ m_aReplyToED.Enable(bEnable);
+ return 0;
+}
+/*-- 06.05.2004 10:59:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailConfigPage, AuthenticationHdl, PushButton*, EMPTYARG)
+{
+ SwAuthenticationSettingsDialog aDlg(this, *m_pConfigItem);
+ aDlg.Execute();
+ return 0;
+}
+/*-- 06.05.2004 10:59:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailConfigPage, TestHdl, PushButton*, EMPTYARG)
+{
+ SwTestAccountSettingsDialog(this).Execute();
+ return 0;
+}
+/*-- 06.05.2004 12:11:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwTestAccountSettingsDialog::SwTestAccountSettingsDialog(SwMailConfigPage* pParent) :
+ SfxModalDialog(pParent, SW_RES(DLG_MM_TESTACCOUNTSETTINGS)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aInfoFI( this, SW_RES( FI_INFO )),
+ m_aStatusHB( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER),
+ m_aStatusLB( this, SW_RES( LB_STATUS )),
+ m_aErrorFI( this, SW_RES( FI_ERROR )),
+ m_eErrorsED( this, SW_RES( ED_ERROR )),
+ m_aSeparatorFL( this, SW_RES( FL_SEPAPARATOR )),
+ m_aStopPB( this, SW_RES( PB_STOP )),
+ m_aCancelPB( this, SW_RES( PB_CANCEL )),
+ m_aHelpPB( this, SW_RES( PB_HELP )),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_aImageList( SW_RES( GetSettings().GetStyleSettings().GetHighContrastMode() ? ILIST_HC : ILIST) ),
+ m_sTask( SW_RES( ST_TASK )),
+ m_sStatus( SW_RES( ST_STATUS )),
+ m_sEstablish( SW_RES( ST_ESTABLISH )),
+ m_sFindServer( SW_RES( ST_FINDSERVER )),
+ m_sCompleted( SW_RES( ST_COMPLETED )),
+ m_sFailed( SW_RES( ST_FAILED )),
+ m_sErrorServer( SW_RES( ST_ERROR_SERVER )),
+ m_pParent(pParent),
+ m_bStop(false)
+{
+ FreeResource();
+ m_aStopPB.SetClickHdl(LINK(this, SwTestAccountSettingsDialog, StopHdl));
+
+ Size aLBSize(m_aStatusLB.GetOutputSizePixel());
+ m_aStatusHB.SetSizePixel(aLBSize);
+ Size aHeadSize(m_aStatusHB.CalcWindowSizePixel());
+ aHeadSize.Width() = aLBSize.Width();
+ m_aStatusHB.SetSizePixel(aHeadSize);
+ Point aLBPos(m_aStatusLB.GetPosPixel());
+ m_aStatusHB.SetPosPixel(aLBPos);
+ aLBPos.Y() += aHeadSize.Height();
+ aLBSize.Height() -= aHeadSize.Height();
+ m_aStatusLB.SetPosSizePixel(aLBPos, aLBSize);
+
+ Size aSz(m_aStatusHB.GetOutputSizePixel());
+ m_aStatusHB.InsertItem( 1, m_sTask,
+ aSz.Width()/2,
+ HIB_LEFT | HIB_VCENTER );
+ m_aStatusHB.InsertItem( 2, m_sStatus,
+ aSz.Width()/2,
+ HIB_LEFT | HIB_VCENTER );
+
+ m_aStatusHB.SetHelpId(HID_MM_TESTACCOUNTSETTINGS_HB );
+ m_aStatusHB.Show();
+
+ m_aStatusLB.SetHelpId(HID_MM_TESTACCOUNTSETTINGS_TLB);
+ static long nTabs[] = {2, 0, aSz.Width()/2 };
+ m_aStatusLB.SetStyle( m_aStatusLB.GetStyle() | WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP );
+ m_aStatusLB.SetSelectionMode( SINGLE_SELECTION );
+ m_aStatusLB.SetTabs(&nTabs[0], MAP_PIXEL);
+ short nEntryHeight = m_aStatusLB.GetEntryHeight();
+ m_aStatusLB.SetEntryHeight( nEntryHeight * 15 / 10 );
+
+ Application::PostUserEvent( STATIC_LINK( this, SwTestAccountSettingsDialog, TestHdl ), this );
+}
+/*-- 06.05.2004 12:11:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwTestAccountSettingsDialog::~SwTestAccountSettingsDialog()
+{
+}
+/*-- 06.05.2004 12:15:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwTestAccountSettingsDialog, StopHdl, PushButton*, EMPTYARG)
+{
+ m_bStop = true;
+ return 0;
+}
+/*-- 07.06.2004 12:44:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_STATIC_LINK(SwTestAccountSettingsDialog, TestHdl, void*, EMPTYARG)
+{
+ pThis->EnterWait();
+ pThis->Test();
+ pThis->LeaveWait();
+ return 0;
+}
+/*-- 07.06.2004 12:45:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwTestAccountSettingsDialog::Test()
+{
+ uno::Reference<XMultiServiceFactory> rMgr = ::comphelper::getProcessServiceFactory();
+
+ bool bIsLoggedIn = false;
+ bool bIsServer = false;
+ if (rMgr.is())
+ {
+ try
+ {
+ uno::Reference< mail::XMailService > xInMailService;
+ uno::Reference< mail::XMailServiceProvider > xMailServiceProvider =
+ mail::MailServiceProvider::create(getCurrentCmpCtx(rMgr));
+ uno::Reference< mail::XMailService > xMailService =
+ xMailServiceProvider->create(
+ mail::MailServiceType_SMTP);
+ if(m_bStop)
+ return;
+ uno::Reference<XConnectionListener> xConnectionListener(new SwConnectionListener());
+
+ if(m_pParent->m_pConfigItem->IsAuthentication() &&
+ m_pParent->m_pConfigItem->IsSMTPAfterPOP())
+ {
+ xInMailService = xMailServiceProvider->create(
+ m_pParent->m_pConfigItem->IsInServerPOP() ?
+ mail::MailServiceType_POP3 : mail::MailServiceType_IMAP);
+ if(m_bStop)
+ return;
+ //authenticate at the POP or IMAP server first
+ uno::Reference<XAuthenticator> xAuthenticator =
+ new SwAuthenticator(
+ m_pParent->m_pConfigItem->GetInServerUserName(),
+ m_pParent->m_pConfigItem->GetInServerPassword(),
+ this);
+
+ xInMailService->addConnectionListener(xConnectionListener);
+ //check connection
+ uno::Reference< uno::XCurrentContext> xConnectionContext =
+ new SwConnectionContext(
+ m_pParent->m_pConfigItem->GetInServerName(),
+ m_pParent->m_pConfigItem->GetInServerPort(),
+ ::rtl::OUString::createFromAscii( "Insecure" ));
+ xInMailService->connect(xConnectionContext, xAuthenticator);
+ }
+ if(m_bStop)
+ return;
+ uno::Reference<XAuthenticator> xAuthenticator;
+ if(m_pParent->m_pConfigItem->IsAuthentication() &&
+ !m_pParent->m_pConfigItem->IsSMTPAfterPOP() &&
+ m_pParent->m_pConfigItem->GetMailUserName().getLength())
+ xAuthenticator =
+ new SwAuthenticator(
+ m_pParent->m_pConfigItem->GetMailUserName(),
+ m_pParent->m_pConfigItem->GetMailPassword(),
+ this);
+ else
+ xAuthenticator = new SwAuthenticator();
+
+ xMailService->addConnectionListener(xConnectionListener);
+ if(m_bStop)
+ return;
+ //just to check if the server exists
+ xMailService->getSupportedConnectionTypes();
+ if(m_bStop)
+ return;
+ bIsServer = true;
+ //check connection
+ uno::Reference< uno::XCurrentContext> xConnectionContext =
+ new SwConnectionContext(
+ m_pParent->m_aServerED.GetText(),
+ sal::static_int_cast< sal_Int16, sal_Int64 >(m_pParent->m_aPortNF.GetValue()),
+ ::rtl::OUString::createFromAscii(
+ m_pParent->m_aSecureCB.IsChecked() ? "Ssl" : "Insecure"));
+ xMailService->connect(xConnectionContext, xAuthenticator);
+ bIsLoggedIn = xMailService->isConnected();
+ if( xInMailService.is() )
+ xInMailService->disconnect();
+ if( xMailService->isConnected())
+ xMailService->disconnect();
+ }
+ catch(uno::Exception&)
+ {
+ DBG_ERROR("exception caught");
+ }
+ }
+
+ Image aFailedImg = m_aImageList.GetImage( FN_FORMULA_CANCEL );
+ Image aCompletedImg = m_aImageList.GetImage( FN_FORMULA_APPLY );
+
+ String sTmp(m_sEstablish);
+ sTmp += '\t';
+ sTmp += bIsServer ? m_sCompleted : m_sFailed;
+ m_aStatusLB.InsertEntry(sTmp,
+ bIsServer ? aCompletedImg : aFailedImg,
+ bIsServer ? aCompletedImg : aFailedImg);
+
+ sTmp = m_sFindServer;
+ sTmp += '\t';
+ sTmp += bIsLoggedIn ? m_sCompleted : m_sFailed;
+ m_aStatusLB.InsertEntry(sTmp,
+ bIsLoggedIn ? aCompletedImg : aFailedImg,
+ bIsLoggedIn ? aCompletedImg : aFailedImg);
+
+ if(!bIsServer || !bIsLoggedIn )
+ {
+ m_eErrorsED.SetText( m_sErrorServer );
+ }
+}
+/*-- 18.08.2004 12:18:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailConfigDlg::SwMailConfigDlg(Window* pParent, SfxItemSet& rSet ) :
+ SfxSingleTabDialog(pParent, rSet, 0)
+{
+ // TabPage erzeugen
+ SetTabPage(SwMailConfigPage::Create( this, rSet ));
+}
+/*-- 18.08.2004 12:18:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailConfigDlg::~SwMailConfigDlg()
+{
+}
+/*-- 19.08.2004 14:33:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAuthenticationSettingsDialog::SwAuthenticationSettingsDialog(
+ SwMailConfigPage* pParent, SwMailMergeConfigItem& rItem) :
+ SfxModalDialog(pParent, SW_RES(DLG_MM_SERVERAUTHENTICATION)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aAuthenticationCB( this, SW_RES( CB_AUTHENTICATION )),
+ m_aSeparateAuthenticationRB( this, SW_RES( RB_SEP_AUTHENTICATION )),
+ m_aSMTPAfterPOPRB( this, SW_RES( RB_SMPTAFTERPOP )),
+ m_aOutgoingServerFT( this, SW_RES( FT_OUTGOINGSERVER )),
+ m_aUserNameFT( this, SW_RES( FT_USERNAME )),
+ m_aUserNameED( this, SW_RES( ED_USERNAME )),
+ m_aOutPasswordFT( this, SW_RES( FT_OUTPASSWORD )),
+ m_aOutPasswordED( this, SW_RES( ED_OUTPASSWORD )),
+ m_aIncomingServerFT( this, SW_RES( FT_INCOMINGSERVER )),
+ m_aServerFT( this, SW_RES( FT_SERVER )),
+ m_aServerED( this, SW_RES( ED_SERVER )),
+ m_aPortFT( this, SW_RES( FT_PORT )),
+ m_aPortNF( this, SW_RES( NF_PORT )),
+ m_aProtocolFT( this, SW_RES( FT_PROTOCOL )),
+ m_aPOP3RB( this, SW_RES( RB_POP3 )),
+ m_aIMAPRB( this, SW_RES( RB_IMAP )),
+ m_aInUsernameFT( this, SW_RES( FT_INUSERNAME )),
+ m_aInUsernameED( this, SW_RES( ED_INUSERNAME )),
+ m_aInPasswordFT( this, SW_RES( FT_INPASSWORD )),
+ m_aInPasswordED( this, SW_RES( ED_INPASSWORD )),
+ m_aSeparatorFL( this, SW_RES( FL_SEPARATOR )),
+ m_aOKPB( this, SW_RES( PB_OK )),
+ m_aCancelPB( this, SW_RES( PB_CANCEL )),
+ m_aHelpPB( this, SW_RES( PB_HELP )),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ rConfigItem( rItem )
+{
+ FreeResource();
+
+ m_aAuthenticationCB.SetClickHdl( LINK( this, SwAuthenticationSettingsDialog, CheckBoxHdl_Impl));
+ Link aRBLink = LINK( this, SwAuthenticationSettingsDialog, RadioButtonHdl_Impl );
+ m_aSeparateAuthenticationRB.SetClickHdl( aRBLink );
+ m_aSMTPAfterPOPRB.SetClickHdl( aRBLink );
+ m_aOKPB.SetClickHdl( LINK( this, SwAuthenticationSettingsDialog, OKHdl_Impl));
+
+ m_aAuthenticationCB.Check( rConfigItem.IsAuthentication() );
+ if(rConfigItem.IsSMTPAfterPOP())
+ m_aSMTPAfterPOPRB.Check();
+ else
+ m_aSeparateAuthenticationRB.Check();
+ m_aUserNameED.SetText( rConfigItem.GetMailUserName() );
+ m_aOutPasswordED.SetText( rConfigItem.GetMailPassword() );
+
+ m_aServerED.SetText( rConfigItem.GetInServerName() );
+ m_aPortNF.SetValue( rConfigItem.GetInServerPort() );
+ if(rConfigItem.IsInServerPOP())
+ m_aPOP3RB.Check();
+ else
+ m_aIMAPRB.Check();
+ m_aInUsernameED.SetText( rConfigItem.GetInServerUserName());
+ m_aInPasswordED.SetText( rConfigItem.GetInServerPassword() );
+
+ CheckBoxHdl_Impl( &m_aAuthenticationCB );
+}
+/*-- 19.08.2004 14:33:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAuthenticationSettingsDialog::~SwAuthenticationSettingsDialog()
+{
+}
+/*-- 19.08.2004 14:33:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwAuthenticationSettingsDialog, OKHdl_Impl, OKButton*, EMPTYARG)
+{
+ rConfigItem.SetAuthentication( m_aAuthenticationCB.IsChecked() );
+ rConfigItem.SetSMTPAfterPOP(m_aSMTPAfterPOPRB.IsChecked());
+ rConfigItem.SetMailUserName(m_aUserNameED.GetText());
+ rConfigItem.SetMailPassword(m_aOutPasswordED.GetText());
+ rConfigItem.SetInServerName(m_aServerED.GetText());
+ rConfigItem.SetInServerPort(sal::static_int_cast< sal_Int16, sal_Int64 >(m_aPortNF.GetValue( ) ));
+ rConfigItem.SetInServerPOP(m_aPOP3RB.IsChecked());
+ rConfigItem.SetInServerUserName(m_aInUsernameED.GetText());
+
+ rConfigItem.SetInServerPassword(m_aInPasswordED.GetText());
+ EndDialog(RET_OK);
+ return 0;
+}
+/*-- 19.08.2004 14:33:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwAuthenticationSettingsDialog, CheckBoxHdl_Impl, CheckBox*, pBox)
+{
+ sal_Bool bChecked = pBox->IsChecked();
+ m_aSeparateAuthenticationRB.Enable(bChecked);
+ m_aSMTPAfterPOPRB.Enable(bChecked);
+ RadioButtonHdl_Impl( 0 );
+
+ return 0;
+}
+/*-- 19.08.2004 14:33:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwAuthenticationSettingsDialog, RadioButtonHdl_Impl, RadioButton*, EMPTYARG)
+{
+ sal_Bool bSeparate = m_aSeparateAuthenticationRB.IsChecked();
+ sal_Bool bIsEnabled = m_aSeparateAuthenticationRB.IsEnabled();
+ sal_Bool bNotSeparate = !bSeparate & bIsEnabled;
+ bSeparate &= bIsEnabled;
+
+ m_aOutgoingServerFT.Enable(bSeparate);
+ m_aUserNameFT.Enable(bSeparate);
+ m_aUserNameED.Enable(bSeparate);
+ m_aOutPasswordFT.Enable(bSeparate);
+ m_aOutPasswordED.Enable(bSeparate);
+
+ m_aIncomingServerFT.Enable(bNotSeparate);
+ m_aServerFT.Enable(bNotSeparate);
+ m_aServerED.Enable(bNotSeparate);
+ m_aPortFT.Enable(bNotSeparate);
+ m_aPortNF.Enable(bNotSeparate);
+ m_aInUsernameFT.Enable(bNotSeparate);
+ m_aInUsernameED.Enable(bNotSeparate);
+ m_aProtocolFT.Enable(bNotSeparate);
+ m_aPOP3RB.Enable(bNotSeparate);
+ m_aIMAPRB.Enable(bNotSeparate);
+ m_aInPasswordFT.Enable(bNotSeparate);
+ m_aInPasswordED.Enable(bNotSeparate);
+
+ return 0;
+}
diff --git a/sw/source/ui/config/mailconfigpage.hrc b/sw/source/ui/config/mailconfigpage.hrc
new file mode 100644
index 000000000000..a7115878ccf5
--- /dev/null
+++ b/sw/source/ui/config/mailconfigpage.hrc
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILCONFIGPAGE_HRC
+#define _MAILCONFIGPAGE_HRC
+
+#define FL_IDENTITY 1
+#define FT_DISPLAYNAME 2
+#define ED_DISPLAYNAME 3
+#define FT_ADDRESS 4
+#define ED_ADDRESS 5
+#define CB_REPLYTO 6
+#define FT_REPLYTO 7
+#define ED_REPLYTO 8
+#define FL_SMTP 9
+#define FT_SERVER 10
+#define ED_SERVER 11
+#define FT_PORT 12
+#define NF_PORT 13
+#define CB_SECURE 14
+#define PB_AUTHENTICATION 16
+#define FL_SEPARATOR 17
+#define PB_TEST 21
+
+#define FI_INFO 31
+#define LB_STATUS 32
+#define FI_ERROR 33
+#define ED_ERROR 34
+#define FL_SEPAPARATOR 35
+#define PB_STOP 36
+#define PB_CANCEL 37
+#define PB_HELP 38
+#define ST_TASK 39
+#define ST_STATUS 40
+#define ST_ESTABLISH 41
+#define ST_FINDSERVER 42
+#define ST_COMPLETED 43
+#define ST_FAILED 44
+#define ST_ERROR_SERVER 46
+#define ILIST 47
+#define ILIST_HC 48
+
+#define CB_AUTHENTICATION 50
+#define RB_SEP_AUTHENTICATION 51
+#define RB_SMPTAFTERPOP 52
+#define FT_OUTGOINGSERVER 53
+#define FT_USERNAME 54
+#define ED_USERNAME 55
+#define FT_OUTPASSWORD 56
+#define ED_OUTPASSWORD 57
+#define FT_INCOMINGSERVER 58
+#define FT_INUSERNAME 59
+#define ED_INUSERNAME 60
+#define FT_INPASSWORD 63
+#define ED_INPASSWORD 64
+#define PB_OK 65
+#define FT_PROTOCOL 66
+#define RB_POP3 67
+#define RB_IMAP 68
+#endif
diff --git a/sw/source/ui/config/mailconfigpage.src b/sw/source/ui/config/mailconfigpage.src
new file mode 100644
index 000000000000..726754fa694e
--- /dev/null
+++ b/sw/source/ui/config/mailconfigpage.src
@@ -0,0 +1,443 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <mailconfigpage.hrc>
+#include <config.hrc>
+#include <helpid.h>
+#include <cmdid.h>
+#include <globals.hrc>
+
+TabPage TP_MAILCONFIG
+{
+ HelpID = HID_TP_MAILCONFIG;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+
+ Text[ en-US ] = "Mail Merge E-mail";
+
+ FixedLine FL_IDENTITY
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "User information";
+ };
+ FixedText FT_DISPLAYNAME
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 74 , 8 ) ;
+ Text[ en-US ] = "~Your name";
+ };
+ Edit ED_DISPLAYNAME
+ {
+ HelpID = "sw:Edit:TP_MAILCONFIG:ED_DISPLAYNAME";
+ Pos = MAP_APPFONT ( 88 , 14 ) ;
+ Size = MAP_APPFONT ( 160 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedText FT_ADDRESS
+ {
+ Pos = MAP_APPFONT ( 12 , 31 ) ;
+ Size = MAP_APPFONT ( 74 , 8 ) ;
+ Text[ en-US ] = "~E-Mail address";
+ };
+ Edit ED_ADDRESS
+ {
+ HelpID = "sw:Edit:TP_MAILCONFIG:ED_ADDRESS";
+ Pos = MAP_APPFONT ( 88 , 29 ) ;
+ Size = MAP_APPFONT ( 160 , 12 ) ;
+ Border = TRUE;
+ };
+ CheckBox CB_REPLYTO
+ {
+ HelpID = "sw:CheckBox:TP_MAILCONFIG:CB_REPLYTO";
+ Pos = MAP_APPFONT ( 12 , 45 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text[ en-US ] = "Send replies to ~different e-mail address";
+ };
+ FixedText FT_REPLYTO
+ {
+ Pos = MAP_APPFONT ( 18 , 60 ) ;
+ Size = MAP_APPFONT ( 68 , 8 ) ;
+ Text[ en-US ] = "~Reply address";
+ };
+ Edit ED_REPLYTO
+ {
+ HelpID = "sw:Edit:TP_MAILCONFIG:ED_REPLYTO";
+ Pos = MAP_APPFONT ( 88 , 58 ) ;
+ Size = MAP_APPFONT ( 160 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedLine FL_SMTP
+ {
+ Pos = MAP_APPFONT ( 6 , 76 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "Outgoing server (SMTP) Settings";
+ };
+ FixedText FT_SERVER
+ {
+ Pos = MAP_APPFONT ( 12 , 89 ) ;
+ Size = MAP_APPFONT ( 74 , 8 ) ;
+ Text[ en-US ] = "~Server name";
+ };
+ Edit ED_SERVER
+ {
+ HelpID = "sw:Edit:TP_MAILCONFIG:ED_SERVER";
+ Pos = MAP_APPFONT ( 88 , 87 ) ;
+ Size = MAP_APPFONT ( 105 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedText FT_PORT
+ {
+ Pos = MAP_APPFONT ( 197 , 89 ) ;
+ Size = MAP_APPFONT ( 24 , 8 ) ;
+ Right = TRUE;
+ Text[ en-US ] = "~Port";
+ };
+ NumericField NF_PORT
+ {
+ HelpID = "sw:NumericField:TP_MAILCONFIG:NF_PORT";
+ Pos = MAP_APPFONT ( 223 , 87 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ Border = TRUE;
+ Left = TRUE ;
+ First = 1 ;
+ Minimum = 1 ;
+ Maximum = 65535;
+ Repeat = TRUE ;
+ Spin = FALSE ;
+ TabStop = TRUE ;
+ };
+ CheckBox CB_SECURE
+ {
+ HelpID = "sw:CheckBox:TP_MAILCONFIG:CB_SECURE";
+ Pos = MAP_APPFONT ( 12 , 104 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text[ en-US ] = "~Use secure connection (SSL)";
+ };
+ PushButton PB_AUTHENTICATION
+ {
+ HelpID = "sw:PushButton:TP_MAILCONFIG:PB_AUTHENTICATION";
+ Pos = MAP_APPFONT ( 88 , 118 ) ;
+ Size = MAP_APPFONT ( 105 , 14 ) ;
+ Text[ en-US ] = "Server Au~thentication";
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 6 , 156 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ };
+ PushButton PB_TEST
+ {
+ HelpID = "sw:PushButton:TP_MAILCONFIG:PB_TEST";
+ Pos = MAP_APPFONT ( 88 , 164 ) ;
+ Size = MAP_APPFONT ( 105 , 14 ) ;
+ Text[ en-US ] = "Test S~ettings...";
+ };
+};
+ModalDialog DLG_MM_TESTACCOUNTSETTINGS
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_TESTACCOUNTSETTINGS;
+ Size = MAP_APPFONT ( 250 , 176 ) ;
+ Moveable = TRUE ;
+
+ Text[ en-US ] = "Test Account Settings";
+
+ FixedText FI_INFO
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 238 , 8 ) ;
+ Text[ en-US ] = "%PRODUCTNAME is testing the e-mail account settings...";
+ };
+ Control LB_STATUS
+ {
+ Pos = MAP_APPFONT ( 6, 14 ) ;
+ Size = MAP_APPFONT ( 238 , 50 ) ;
+ Border = TRUE;
+ };
+ FixedText FI_ERROR
+ {
+ Pos = MAP_APPFONT ( 6 , 68 ) ;
+ Size = MAP_APPFONT ( 238 , 8 ) ;
+ Text[ en-US ] = "Errors";
+ };
+ MultiLineEdit ED_ERROR
+ {
+ HelpID = "sw:MultiLineEdit:DLG_MM_TESTACCOUNTSETTINGS:ED_ERROR";
+ Pos = MAP_APPFONT ( 6 , 79 ) ;
+ Size = MAP_APPFONT ( 238 , 60 ) ;
+ Border = TRUE;
+ Readonly = TRUE;
+ };
+ FixedLine FL_SEPAPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 145 ) ;
+ Size = MAP_APPFONT ( 250 , 8 ) ;
+ };
+ PushButton PB_STOP
+ {
+ HelpID = "sw:PushButton:DLG_MM_TESTACCOUNTSETTINGS:PB_STOP";
+ Pos = MAP_APPFONT ( 85 , 156 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text[ en-US ] = "~Stop";
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 138 , 156 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 194 , 156 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ #define IMGLIST_IDS\
+ IdList = \
+ { \
+ FN_FORMULA_CANCEL ;\
+ FN_FORMULA_APPLY ;\
+ }; \
+ IdCount = 2
+
+ ImageList ILIST
+ {
+ Prefix = "sc";
+ MaskColor = IMAGE_MASK_COLOR;
+ IMGLIST_IDS;
+ };
+
+ ImageList ILIST_HC
+ {
+ Prefix = "sch";
+ MaskColor = IMAGE_MASK_COLOR ;
+ IMGLIST_IDS;
+ };
+ String ST_TASK
+ {
+ Text[ en-US ] = "Task";
+ };
+ String ST_STATUS
+ {
+ Text[ en-US ] = "Status";
+ };
+ String ST_ESTABLISH
+ {
+ Text[ en-US ] = "Establish network connection";
+ };
+ String ST_FINDSERVER
+ {
+ Text[ en-US ] = "Find outgoing mail server";
+ };
+ String ST_COMPLETED
+ {
+ Text[ en-US ] = "Successful";
+ };
+ String ST_FAILED
+ {
+ Text[ en-US ] = "Failed";
+ };
+ String ST_ERROR_SERVER
+ {
+ Text[ en-US ] = "%PRODUCTNAME could not connect to the outgoing mail server. Check your system's settings and the settings in %PRODUCTNAME. Check the server name, the port and the secure connections settings";
+ };
+
+};
+ModalDialog DLG_MM_SERVERAUTHENTICATION
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_SERVERAUTHENTICATION;
+ Size = MAP_APPFONT ( 250 , 211 ) ;
+ Moveable = TRUE ;
+
+ Text[ en-US ] = "Server Authentication";
+
+ CheckBox CB_AUTHENTICATION
+ {
+ HelpID = "sw:CheckBox:DLG_MM_SERVERAUTHENTICATION:CB_AUTHENTICATION";
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 238 , 10 ) ;
+ Text[ en-US ] = "The outgoing mail server (SMTP) requires au~thentication";
+ };
+ RadioButton RB_SEP_AUTHENTICATION
+ {
+ HelpID = "sw:RadioButton:DLG_MM_SERVERAUTHENTICATION:RB_SEP_AUTHENTICATION";
+ Pos = MAP_APPFONT ( 12 , 17 ) ;
+ Size = MAP_APPFONT ( 232 , 10 ) ;
+ Text[ en-US ] = "The outgoing mail server (SMTP) requires ~separate authentication";
+ };
+ FixedText FT_OUTGOINGSERVER
+ {
+ Pos = MAP_APPFONT ( 18 , 31 ) ;
+ Size = MAP_APPFONT ( 200 , 8 ) ;
+ Text[ en-US ] = "Outgoing mail server:";
+ };
+ FixedText FT_USERNAME
+ {
+ Pos = MAP_APPFONT ( 18 , 44 ) ;
+ Size = MAP_APPFONT ( 53 , 8 ) ;
+ Text[ en-US ] = "~User name";
+ };
+ Edit ED_USERNAME
+ {
+ HelpID = "sw:Edit:DLG_MM_SERVERAUTHENTICATION:ED_USERNAME";
+ Pos = MAP_APPFONT ( 78 , 42 ) ;
+ Size = MAP_APPFONT ( 115 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedText FT_OUTPASSWORD
+ {
+ Pos = MAP_APPFONT ( 18 , 59 ) ;
+ Size = MAP_APPFONT ( 53 , 8 ) ;
+ Text[ en-US ] = "~Password";
+ };
+ Edit ED_OUTPASSWORD
+ {
+ HelpID = "sw:Edit:DLG_MM_SERVERAUTHENTICATION:ED_OUTPASSWORD";
+ Pos = MAP_APPFONT ( 78 , 57 ) ;
+ Size = MAP_APPFONT ( 115 , 12 ) ;
+ Border = TRUE;
+ PassWord = TRUE;
+ };
+ RadioButton RB_SMPTAFTERPOP
+ {
+ HelpID = "sw:RadioButton:DLG_MM_SERVERAUTHENTICATION:RB_SMPTAFTERPOP";
+ Pos = MAP_APPFONT ( 12 , 73 ) ;
+ Size = MAP_APPFONT ( 232 , 20 ) ;
+ WordBreak = TRUE;
+ Text[ en-US ] = "The outgoing mail server uses the same authentication as the ~incoming mail server. Enter the settings of the incoming mail server.";
+ };
+ FixedText FT_INCOMINGSERVER
+ {
+ Pos = MAP_APPFONT ( 18 , 97 ) ;
+ Size = MAP_APPFONT ( 230 , 8 ) ;
+ Text[ en-US ] = "Incoming mail server:";
+ };
+ FixedText FT_SERVER
+ {
+ Pos = MAP_APPFONT ( 18 , 110 ) ;
+ Size = MAP_APPFONT ( 53 , 8 ) ;
+ Text[ en-US ] = "Server ~name";
+ };
+ Edit ED_SERVER
+ {
+ HelpID = "sw:Edit:DLG_MM_SERVERAUTHENTICATION:ED_SERVER";
+ Pos = MAP_APPFONT ( 78 , 108 ) ;
+ Size = MAP_APPFONT ( 115 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedText FT_PORT
+ {
+ Pos = MAP_APPFONT ( 195 , 110 ) ;
+ Size = MAP_APPFONT ( 20 , 10 ) ;
+ Right = TRUE;
+ Text[ en-US ] = "P~ort";
+ };
+ NumericField NF_PORT
+ {
+ HelpID = "sw:NumericField:DLG_MM_SERVERAUTHENTICATION:NF_PORT";
+ Pos = MAP_APPFONT ( 219 , 108 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ Border = TRUE;
+ Left = TRUE ;
+ First = 1 ;
+ Minimum = 1 ;
+ Maximum = 65535;
+ Repeat = TRUE ;
+ Spin = FALSE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_PROTOCOL
+ {
+ Pos = MAP_APPFONT ( 18 , 126 ) ;
+ Size = MAP_APPFONT ( 53 , 8 ) ;
+ Text[ en-US ] = "Type";
+ };
+ RadioButton RB_POP3
+ {
+ HelpID = "sw:RadioButton:DLG_MM_SERVERAUTHENTICATION:RB_POP3";
+ Pos = MAP_APPFONT ( 78 , 125 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ Text[ en-US ] = "~POP 3";
+ };
+ RadioButton RB_IMAP
+ {
+ HelpID = "sw:RadioButton:DLG_MM_SERVERAUTHENTICATION:RB_IMAP";
+ Pos = MAP_APPFONT ( 78 , 138 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ Text[ en-US ] = "~IMAP";
+ };
+ FixedText FT_INUSERNAME
+ {
+ Pos = MAP_APPFONT ( 18 , 152 ) ;
+ Size = MAP_APPFONT ( 53 , 8 ) ;
+ Text[ en-US ] = "Us~er name";
+ };
+ Edit ED_INUSERNAME
+ {
+ HelpID = "sw:Edit:DLG_MM_SERVERAUTHENTICATION:ED_INUSERNAME";
+ Pos = MAP_APPFONT ( 78 , 150 ) ;
+ Size = MAP_APPFONT ( 115 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedText FT_INPASSWORD
+ {
+ Pos = MAP_APPFONT ( 18 , 167 ) ;
+ Size = MAP_APPFONT ( 53 , 8 ) ;
+ Text[ en-US ] = "Pass~word";
+ };
+ Edit ED_INPASSWORD
+ {
+ HelpID = "sw:Edit:DLG_MM_SERVERAUTHENTICATION:ED_INPASSWORD";
+ Pos = MAP_APPFONT ( 78 , 165 ) ;
+ Size = MAP_APPFONT ( 115 , 12 ) ;
+ Border = TRUE;
+ PassWord = TRUE;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 183 ) ;
+ Size = MAP_APPFONT ( 250 , 8 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 85 , 191 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 138 , 191 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 194 , 191 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
diff --git a/sw/source/ui/config/modcfg.cxx b/sw/source/ui/config/modcfg.cxx
new file mode 100644
index 000000000000..ec0e47393eb2
--- /dev/null
+++ b/sw/source/ui/config/modcfg.cxx
@@ -0,0 +1,1392 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <sot/clsids.hxx>
+#include <tools/stream.hxx>
+#include <vcl/svapp.hxx>
+#include <svl/mailenum.hxx>
+#ifndef _SVX_SVXIDS_HRC //autogen
+#include <svx/svxids.hrc>
+#endif
+#include <editeng/svxenum.hxx>
+#include <tools/debug.hxx>
+
+#include <tools/globname.hxx>
+#include <swtypes.hxx>
+#include <itabenum.hxx>
+#ifndef _MODCFG_HXX
+#include <modcfg.hxx>
+#endif
+#include <fldupde.hxx>
+#include <unotools/syslocaleoptions.hxx>
+#include <caption.hxx>
+#include <com/sun/star/uno/Any.hxx>
+
+#include <unomid.h>
+
+using namespace utl;
+using rtl::OUString;
+using namespace com::sun::star::uno;
+
+#define GLOB_NAME_CALC 0
+#define GLOB_NAME_IMPRESS 1
+#define GLOB_NAME_DRAW 2
+#define GLOB_NAME_MATH 3
+#define GLOB_NAME_CHART 4
+
+SV_IMPL_PTRARR_SORT(InsCapOptArr, InsCaptionOptPtr)
+/* -----------------03.11.98 13:46-------------------
+ *
+ * --------------------------------------------------*/
+InsCaptionOpt* InsCaptionOptArr::Find(const SwCapObjType eType, const SvGlobalName *pOleId) const
+{
+ for (USHORT i = 0; i < Count(); i++ )
+ {
+ InsCaptionOpt* pObj = GetObject(i);
+ if (pObj->GetObjType() == eType &&
+ (eType != OLE_CAP ||
+ (pOleId &&
+ pObj->GetOleId() == *pOleId)))
+ return pObj;
+ }
+
+ return 0;
+}
+
+/* -----------------03.11.98 15:05-------------------
+ *
+ * --------------------------------------------------*/
+
+const InsCaptionOpt* SwModuleOptions::GetCapOption(
+ BOOL bHTML, const SwCapObjType eType, const SvGlobalName *pOleId)
+{
+ if(bHTML)
+ {
+ DBG_ERROR("no caption option in sw/web!");
+ return 0;
+ }
+ else
+ {
+ sal_Bool bFound = FALSE;
+ if(eType == OLE_CAP && pOleId)
+ {
+ for( USHORT nId = 0; nId <= GLOB_NAME_CHART && !bFound; nId++)
+ bFound = *pOleId == aInsertConfig.aGlobalNames[nId ];
+ if(!bFound)
+ return aInsertConfig.pOLEMiscOpt;
+ }
+ return aInsertConfig.pCapOptions->Find(eType, pOleId);
+ }
+}
+
+/* -----------------03.11.98 15:05-------------------
+ *
+ * --------------------------------------------------*/
+
+BOOL SwModuleOptions::SetCapOption(BOOL bHTML, const InsCaptionOpt* pOpt)
+{
+ BOOL bRet = FALSE;
+
+ if(bHTML)
+ {
+ DBG_ERROR("no caption option in sw/web!");
+ }
+ else if (pOpt)
+ {
+ sal_Bool bFound = FALSE;
+ if(pOpt->GetObjType() == OLE_CAP && &pOpt->GetOleId())
+ {
+ for( USHORT nId = 0; nId <= GLOB_NAME_CHART; nId++)
+ bFound = pOpt->GetOleId() == aInsertConfig.aGlobalNames[nId ];
+ if(!bFound)
+ {
+ if(aInsertConfig.pOLEMiscOpt)
+ *aInsertConfig.pOLEMiscOpt = *pOpt;
+ else
+ aInsertConfig.pOLEMiscOpt = new InsCaptionOpt(*pOpt);
+ }
+ }
+
+ InsCaptionOptArr& rArr = *aInsertConfig.pCapOptions;
+ InsCaptionOpt *pObj = rArr.Find(pOpt->GetObjType(), &pOpt->GetOleId());
+
+ if (pObj)
+ {
+ *pObj = *pOpt;
+ }
+ else
+ rArr.Insert(new InsCaptionOpt(*pOpt));
+
+ aInsertConfig.SetModified();
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+/*-----------------13.01.97 12.44-------------------
+
+--------------------------------------------------*/
+SwModuleOptions::SwModuleOptions() :
+ aInsertConfig(FALSE),
+ aWebInsertConfig(TRUE),
+ aTableConfig(FALSE),
+ aWebTableConfig(TRUE),
+ bHideFieldTips(FALSE)
+{
+}
+/* -----------------------------19.01.01 12:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+String SwModuleOptions::ConvertWordDelimiter(const String& rDelim, BOOL bFromUI)
+{
+ String sReturn;
+ if(bFromUI)
+ {
+ String sChar;
+
+ xub_StrLen i = 0;
+ sal_Unicode c;
+
+ while (i < rDelim.Len())
+ {
+ c = rDelim.GetChar(i++);
+
+ if (c == '\\')
+ {
+ c = rDelim.GetChar(i++);
+
+ switch (c)
+ {
+ case 'n': sReturn += '\n'; break;
+ case 't': sReturn += '\t'; break;
+ case '\\': sReturn += '\\'; break;
+
+ case 'x':
+ {
+ sal_Unicode nVal, nChar;
+ BOOL bValidData = TRUE;
+ xub_StrLen n;
+ for( n = 0, nChar = 0; n < 2 && i < rDelim.Len(); ++n, ++i )
+ {
+ if( ((nVal = rDelim.GetChar( i )) >= '0') && ( nVal <= '9') )
+ nVal -= '0';
+ else if( (nVal >= 'A') && (nVal <= 'F') )
+ nVal -= 'A' - 10;
+ else if( (nVal >= 'a') && (nVal <= 'f') )
+ nVal -= 'a' - 10;
+ else
+ {
+ DBG_ERROR( "ungueltiger Hex-Wert" );
+ bValidData = FALSE;
+ break;
+ }
+
+ (nChar <<= 4 );
+ nChar = nChar + nVal;
+ }
+ if( bValidData )
+ sReturn += nChar;
+ break;
+ }
+
+ default: // Unbekannt, daher nur Backslash einfuegen
+ sReturn += '\\';
+ i--;
+ break;
+ }
+ }
+ else
+ sReturn += c;
+ }
+ }
+ else
+ {
+ for (xub_StrLen i = 0; i < rDelim.Len(); i++)
+ {
+ sal_Unicode c = rDelim.GetChar(i);
+
+ switch (c)
+ {
+ case '\n': sReturn.AppendAscii(RTL_CONSTASCII_STRINGPARAM("\\n")); break;
+ case '\t': sReturn.AppendAscii(RTL_CONSTASCII_STRINGPARAM("\\t")); break;
+ case '\\': sReturn.AppendAscii(RTL_CONSTASCII_STRINGPARAM("\\\\")); break;
+
+ default:
+ if( c <= 0x1f || c >= 0x7f )
+ {
+ sReturn.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\\x" ))
+ += String::CreateFromInt32( c, 16 );
+ }
+ else
+ sReturn += c;
+ }
+ }
+ }
+ return sReturn;
+}
+/* -----------------------------10.10.00 16:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const Sequence<OUString>& SwRevisionConfig::GetPropertyNames()
+{
+ static Sequence<OUString> aNames;
+ if(!aNames.getLength())
+ {
+ const int nCount = 8;
+ aNames.realloc(nCount);
+ static const char* aPropNames[] =
+ {
+ "TextDisplay/Insert/Attribute", // 0
+ "TextDisplay/Insert/Color", // 1
+ "TextDisplay/Delete/Attribute", // 2
+ "TextDisplay/Delete/Color", // 3
+ "TextDisplay/ChangedAttribute/Attribute", // 4
+ "TextDisplay/ChangedAttribute/Color", // 5
+ "LinesChanged/Mark", // 6
+ "LinesChanged/Color" // 7
+ };
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ pNames[i] = OUString::createFromAscii(aPropNames[i]);
+ }
+ return aNames;
+}
+/*-- 10.10.00 16:22:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwRevisionConfig::SwRevisionConfig() :
+ ConfigItem(C2U("Office.Writer/Revision"),
+ CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE)
+{
+ aInsertAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;
+ aInsertAttr.nAttr = UNDERLINE_SINGLE;
+ aInsertAttr.nColor = COL_TRANSPARENT;
+ aDeletedAttr.nItemId = SID_ATTR_CHAR_STRIKEOUT;
+ aDeletedAttr.nAttr = STRIKEOUT_SINGLE;
+ aDeletedAttr.nColor = COL_TRANSPARENT;
+ aFormatAttr.nItemId = SID_ATTR_CHAR_WEIGHT;
+ aFormatAttr.nAttr = WEIGHT_BOLD;
+ aFormatAttr.nColor = COL_BLACK;
+
+ Load();
+}
+/*-- 10.10.00 16:22:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwRevisionConfig::~SwRevisionConfig()
+{
+}
+/*-- 10.10.00 16:22:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 lcl_ConvertAttrToCfg(const AuthorCharAttr& rAttr)
+{
+ sal_Int32 nRet = 0;
+ switch(rAttr.nItemId)
+ {
+ case SID_ATTR_CHAR_WEIGHT: nRet = 1; break;
+ case SID_ATTR_CHAR_POSTURE: nRet = 2; break;
+ case SID_ATTR_CHAR_UNDERLINE: nRet = UNDERLINE_SINGLE == rAttr.nAttr ? 3 : 4; break;
+ case SID_ATTR_CHAR_STRIKEOUT: nRet = 3; break;
+ case SID_ATTR_CHAR_CASEMAP:
+ {
+ switch(rAttr.nAttr)
+ {
+ case SVX_CASEMAP_VERSALIEN : nRet = 5;break;
+ case SVX_CASEMAP_GEMEINE : nRet = 6;break;
+ case SVX_CASEMAP_KAPITAELCHEN: nRet = 7;break;
+ case SVX_CASEMAP_TITEL : nRet = 8;break;
+ }
+ }
+ break;
+ case SID_ATTR_BRUSH : nRet = 9; break;
+ }
+ return nRet;
+}
+//-----------------------------------------------------------------------------
+void SwRevisionConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+void SwRevisionConfig::Commit()
+{
+ const Sequence<OUString>& aNames = GetPropertyNames();
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ sal_Int32 nVal = -1;
+ switch(nProp)
+ {
+ case 0 : nVal = lcl_ConvertAttrToCfg(aInsertAttr); break;
+ case 1 : nVal = aInsertAttr.nColor ; break;
+ case 2 : nVal = lcl_ConvertAttrToCfg(aDeletedAttr); break;
+ case 3 : nVal = aDeletedAttr.nColor ; break;
+ case 4 : nVal = lcl_ConvertAttrToCfg(aFormatAttr); break;
+ case 5 : nVal = aFormatAttr.nColor ; break;
+ case 6 : nVal = nMarkAlign ; break;
+ case 7 : nVal = aMarkColor.GetColor(); break;
+ }
+ pValues[nProp] <<= nVal;
+ }
+ PutProperties(aNames, aValues);
+}
+/*-- 10.10.00 16:22:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_ConvertCfgToAttr(sal_Int32 nVal, AuthorCharAttr& rAttr, sal_Bool bDelete = sal_False)
+{
+ rAttr.nItemId = rAttr.nAttr = 0;
+ switch(nVal)
+ {
+ case 1: rAttr.nItemId = SID_ATTR_CHAR_WEIGHT; rAttr.nAttr = WEIGHT_BOLD ; break;
+ case 2: rAttr.nItemId = SID_ATTR_CHAR_POSTURE; rAttr.nAttr = ITALIC_NORMAL ; break;
+ case 3: if(bDelete)
+ {
+ rAttr.nItemId = SID_ATTR_CHAR_STRIKEOUT;
+ rAttr.nAttr = STRIKEOUT_SINGLE;
+ }
+ else
+ {
+ rAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;
+ rAttr.nAttr = UNDERLINE_SINGLE;
+ }
+ break;
+ case 4: rAttr.nItemId = SID_ATTR_CHAR_UNDERLINE;rAttr.nAttr = UNDERLINE_DOUBLE ; break;
+ case 5: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_VERSALIEN ; break;
+ case 6: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_GEMEINE ; break;
+ case 7: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_KAPITAELCHEN ; break;
+ case 8: rAttr.nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.nAttr = SVX_CASEMAP_TITEL ; break;
+ case 9: rAttr.nItemId = SID_ATTR_BRUSH; break;
+ }
+}
+void SwRevisionConfig::Load()
+{
+ const Sequence<OUString>& aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aNames.getLength())
+ {
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ sal_Int32 nVal = 0;
+ pValues[nProp] >>= nVal;
+ switch(nProp)
+ {
+ case 0 : lcl_ConvertCfgToAttr(nVal, aInsertAttr); break;
+ case 1 : aInsertAttr.nColor = nVal; break;
+ case 2 : lcl_ConvertCfgToAttr(nVal, aDeletedAttr, sal_True); break;
+ case 3 : aDeletedAttr.nColor = nVal; break;
+ case 4 : lcl_ConvertCfgToAttr(nVal, aFormatAttr); break;
+ case 5 : aFormatAttr.nColor = nVal; break;
+ case 6 : nMarkAlign = sal::static_int_cast< sal_uInt16, sal_Int32>(nVal); break;
+ case 7 : aMarkColor.SetColor(nVal); break;
+ }
+ }
+ }
+ }
+}
+/* -----------------------------10.10.00 16:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+enum InsertConfigProp
+{
+ INS_PROP_TABLE_HEADER = 0,
+ INS_PROP_TABLE_REPEATHEADER, // 1
+ INS_PROP_TABLE_BORDER, // 2
+ INS_PROP_TABLE_SPLIT, // 3 from here not in writer/web
+ INS_PROP_CAP_AUTOMATIC, // 4
+ INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST, // 5
+ INS_PROP_CAP_OBJECT_TABLE_ENABLE, // 6
+ INS_PROP_CAP_OBJECT_TABLE_CATEGORY, // 7
+ INS_PROP_CAP_OBJECT_TABLE_NUMBERING, // 8
+ INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR, // 9
+ INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT, //10
+ INS_PROP_CAP_OBJECT_TABLE_DELIMITER, //11
+ INS_PROP_CAP_OBJECT_TABLE_LEVEL, //12
+ INS_PROP_CAP_OBJECT_TABLE_POSITION, //13
+ INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE, //14
+ INS_PROP_CAP_OBJECT_FRAME_ENABLE, //15
+ INS_PROP_CAP_OBJECT_FRAME_CATEGORY, //16
+ INS_PROP_CAP_OBJECT_FRAME_NUMBERING, //17
+ INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR, //18
+ INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT, //19
+ INS_PROP_CAP_OBJECT_FRAME_DELIMITER, //20
+ INS_PROP_CAP_OBJECT_FRAME_LEVEL, //21
+ INS_PROP_CAP_OBJECT_FRAME_POSITION, //22
+ INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE, //23
+ INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE, //24
+ INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY, //25
+ INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING, //26
+ INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR, //27
+ INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT, //28
+ INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER, //29
+ INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL, //30
+ INS_PROP_CAP_OBJECT_GRAPHIC_POSITION, //31
+ INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE, //32
+ INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES, //33
+ INS_PROP_CAP_OBJECT_CALC_ENABLE, //34
+ INS_PROP_CAP_OBJECT_CALC_CATEGORY, //35
+ INS_PROP_CAP_OBJECT_CALC_NUMBERING, //36
+ INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR, //37
+ INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT, //38
+ INS_PROP_CAP_OBJECT_CALC_DELIMITER, //39
+ INS_PROP_CAP_OBJECT_CALC_LEVEL, //40
+ INS_PROP_CAP_OBJECT_CALC_POSITION, //41
+ INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE, //42
+ INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES, //43
+ INS_PROP_CAP_OBJECT_IMPRESS_ENABLE, //44
+ INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY, //45
+ INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING, //46
+ INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR, //47
+ INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT, //48
+ INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER, //49
+ INS_PROP_CAP_OBJECT_IMPRESS_LEVEL, //50
+ INS_PROP_CAP_OBJECT_IMPRESS_POSITION, //51
+ INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE, //52
+ INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES, //53
+ INS_PROP_CAP_OBJECT_CHART_ENABLE, //54
+ INS_PROP_CAP_OBJECT_CHART_CATEGORY, //55
+ INS_PROP_CAP_OBJECT_CHART_NUMBERING, //56
+ INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR, //57
+ INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT, //58
+ INS_PROP_CAP_OBJECT_CHART_DELIMITER, //59
+ INS_PROP_CAP_OBJECT_CHART_LEVEL, //60
+ INS_PROP_CAP_OBJECT_CHART_POSITION, //61
+ INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE, //62
+ INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES, //63
+ INS_PROP_CAP_OBJECT_FORMULA_ENABLE, //64
+ INS_PROP_CAP_OBJECT_FORMULA_CATEGORY, //65
+ INS_PROP_CAP_OBJECT_FORMULA_NUMBERING, //66
+ INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR, //67
+ INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT, //68
+ INS_PROP_CAP_OBJECT_FORMULA_DELIMITER, //69
+ INS_PROP_CAP_OBJECT_FORMULA_LEVEL, //70
+ INS_PROP_CAP_OBJECT_FORMULA_POSITION, //71
+ INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE, //72
+ INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES, //73
+ INS_PROP_CAP_OBJECT_DRAW_ENABLE, //74
+ INS_PROP_CAP_OBJECT_DRAW_CATEGORY, //75
+ INS_PROP_CAP_OBJECT_DRAW_NUMBERING, //76
+ INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR, //77
+ INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT, //78
+ INS_PROP_CAP_OBJECT_DRAW_DELIMITER, //79
+ INS_PROP_CAP_OBJECT_DRAW_LEVEL, //80
+ INS_PROP_CAP_OBJECT_DRAW_POSITION, //81
+ INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE, //82
+ INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES, //83
+ INS_PROP_CAP_OBJECT_OLEMISC_ENABLE, //84
+ INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY, //85
+ INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING, //86
+ INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR, //87
+ INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT, //88
+ INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER, //89
+ INS_PROP_CAP_OBJECT_OLEMISC_LEVEL, //90
+ INS_PROP_CAP_OBJECT_OLEMISC_POSITION, //91
+ INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE, //92
+ INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES //93
+};
+const Sequence<OUString>& SwInsertConfig::GetPropertyNames()
+{
+ static Sequence<OUString> aNames;
+ static Sequence<OUString> aWebNames;
+ if(!aNames.getLength())
+ {
+ static const char* aPropNames[] =
+ {
+ "Table/Header", // 0
+ "Table/RepeatHeader", // 1
+ "Table/Border", // 2
+ "Table/Split", // 3 from here not in writer/web
+ "Caption/Automatic", // 4
+ "Caption/CaptionOrderNumberingFirst", // 5
+ "Caption/WriterObject/Table/Enable", // 6
+ "Caption/WriterObject/Table/Settings/Category", // 7
+ "Caption/WriterObject/Table/Settings/Numbering", // 8
+ "Caption/WriterObject/Table/Settings/NumberingSeparator", // 9
+ "Caption/WriterObject/Table/Settings/CaptionText", //10
+ "Caption/WriterObject/Table/Settings/Delimiter", //11
+ "Caption/WriterObject/Table/Settings/Level", //12
+ "Caption/WriterObject/Table/Settings/Position", //13
+ "Caption/WriterObject/Table/Settings/CharacterStyle", //14
+ "Caption/WriterObject/Frame/Enable", //15
+ "Caption/WriterObject/Frame/Settings/Category", //16
+ "Caption/WriterObject/Frame/Settings/Numbering", //17
+ "Caption/WriterObject/Frame/Settings/NumberingSeparator", //18
+ "Caption/WriterObject/Frame/Settings/CaptionText", //19
+ "Caption/WriterObject/Frame/Settings/Delimiter", //20
+ "Caption/WriterObject/Frame/Settings/Level", //21
+ "Caption/WriterObject/Frame/Settings/Position", //22
+ "Caption/WriterObject/Frame/Settings/CharacterStyle", //23
+ "Caption/WriterObject/Graphic/Enable", //24
+ "Caption/WriterObject/Graphic/Settings/Category", //25
+ "Caption/WriterObject/Graphic/Settings/Numbering", //26
+ "Caption/WriterObject/Graphic/Settings/NumberingSeparator", //27
+ "Caption/WriterObject/Graphic/Settings/CaptionText", //28
+ "Caption/WriterObject/Graphic/Settings/Delimiter", //29
+ "Caption/WriterObject/Graphic/Settings/Level", //30
+ "Caption/WriterObject/Graphic/Settings/Position", //31
+ "Caption/WriterObject/Graphic/Settings/CharacterStyle", //32
+ "Caption/WriterObject/Graphic/Settings/ApplyAttributes", //33
+ "Caption/OfficeObject/Calc/Enable", //34
+ "Caption/OfficeObject/Calc/Settings/Category", //35
+ "Caption/OfficeObject/Calc/Settings/Numbering", //36
+ "Caption/OfficeObject/Calc/Settings/NumberingSeparator", //37
+ "Caption/OfficeObject/Calc/Settings/CaptionText", //38
+ "Caption/OfficeObject/Calc/Settings/Delimiter", //39
+ "Caption/OfficeObject/Calc/Settings/Level", //40
+ "Caption/OfficeObject/Calc/Settings/Position", //41
+ "Caption/OfficeObject/Calc/Settings/CharacterStyle", //42
+ "Caption/OfficeObject/Calc/Settings/ApplyAttributes", //43
+ "Caption/OfficeObject/Impress/Enable", //44
+ "Caption/OfficeObject/Impress/Settings/Category", //45
+ "Caption/OfficeObject/Impress/Settings/Numbering", //46
+ "Caption/OfficeObject/Impress/Settings/NumberingSeparator", //47
+ "Caption/OfficeObject/Impress/Settings/CaptionText", //48
+ "Caption/OfficeObject/Impress/Settings/Delimiter", //49
+ "Caption/OfficeObject/Impress/Settings/Level", //50
+ "Caption/OfficeObject/Impress/Settings/Position", //51
+ "Caption/OfficeObject/Impress/Settings/CharacterStyle", //52
+ "Caption/OfficeObject/Impress/Settings/ApplyAttributes", //53
+ "Caption/OfficeObject/Chart/Enable", //54
+ "Caption/OfficeObject/Chart/Settings/Category", //55
+ "Caption/OfficeObject/Chart/Settings/Numbering", //56
+ "Caption/OfficeObject/Chart/Settings/NumberingSeparator", //57
+ "Caption/OfficeObject/Chart/Settings/CaptionText", //58
+ "Caption/OfficeObject/Chart/Settings/Delimiter", //59
+ "Caption/OfficeObject/Chart/Settings/Level", //60
+ "Caption/OfficeObject/Chart/Settings/Position", //61
+ "Caption/OfficeObject/Chart/Settings/CharacterStyle", //62
+ "Caption/OfficeObject/Chart/Settings/ApplyAttributes", //63
+ "Caption/OfficeObject/Formula/Enable", //64
+ "Caption/OfficeObject/Formula/Settings/Category", //65
+ "Caption/OfficeObject/Formula/Settings/Numbering", //66
+ "Caption/OfficeObject/Formula/Settings/NumberingSeparator", //67
+ "Caption/OfficeObject/Formula/Settings/CaptionText", //68
+ "Caption/OfficeObject/Formula/Settings/Delimiter", //69
+ "Caption/OfficeObject/Formula/Settings/Level", //70
+ "Caption/OfficeObject/Formula/Settings/Position", //71
+ "Caption/OfficeObject/Formula/Settings/CharacterStyle", //72
+ "Caption/OfficeObject/Formula/Settings/ApplyAttributes", //73
+ "Caption/OfficeObject/Draw/Enable", //74
+ "Caption/OfficeObject/Draw/Settings/Category", //75
+ "Caption/OfficeObject/Draw/Settings/Numbering", //76
+ "Caption/OfficeObject/Draw/Settings/NumberingSeparator", //77
+ "Caption/OfficeObject/Draw/Settings/CaptionText", //78
+ "Caption/OfficeObject/Draw/Settings/Delimiter", //79
+ "Caption/OfficeObject/Draw/Settings/Level", //80
+ "Caption/OfficeObject/Draw/Settings/Position", //81
+ "Caption/OfficeObject/Draw/Settings/CharacterStyle", //82
+ "Caption/OfficeObject/Draw/Settings/ApplyAttributes", //83
+ "Caption/OfficeObject/OLEMisc/Enable", //84
+ "Caption/OfficeObject/OLEMisc/Settings/Category", //85
+ "Caption/OfficeObject/OLEMisc/Settings/Numbering", //86
+ "Caption/OfficeObject/OLEMisc/Settings/NumberingSeparator", //87
+ "Caption/OfficeObject/OLEMisc/Settings/CaptionText", //88
+ "Caption/OfficeObject/OLEMisc/Settings/Delimiter", //89
+ "Caption/OfficeObject/OLEMisc/Settings/Level", //90
+ "Caption/OfficeObject/OLEMisc/Settings/Position", //91
+ "Caption/OfficeObject/OLEMisc/Settings/CharacterStyle", //92
+ "Caption/OfficeObject/OLEMisc/Settings/ApplyAttributes" //93
+ };
+ const int nCount = INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES + 1;
+ const int nWebCount = INS_PROP_TABLE_BORDER + 1;
+ aNames.realloc(nCount);
+ aWebNames.realloc(nWebCount);
+ OUString* pNames = aNames.getArray();
+ OUString* pWebNames = aWebNames.getArray();
+ int i;
+ for(i = 0; i < nCount; i++)
+ pNames[i] = C2U(aPropNames[i]);
+ for(i = 0; i < nWebCount; i++)
+ pWebNames[i] = C2U(aPropNames[i]);
+ }
+ return bIsWeb ? aWebNames : aNames;
+}
+/*-- 10.10.00 16:22:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwInsertConfig::SwInsertConfig(sal_Bool bWeb) :
+ ConfigItem(bWeb ? C2U("Office.WriterWeb/Insert") : C2U("Office.Writer/Insert"),
+ CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
+ pCapOptions(0),
+ pOLEMiscOpt(0),
+ bInsWithCaption( sal_False ),
+ bCaptionOrderNumberingFirst( sal_False ),
+ aInsTblOpts(0,0),
+ bIsWeb(bWeb)
+{
+ aGlobalNames[GLOB_NAME_CALC ] = SvGlobalName(SO3_SC_CLASSID);
+ aGlobalNames[GLOB_NAME_IMPRESS] = SvGlobalName(SO3_SIMPRESS_CLASSID);
+ aGlobalNames[GLOB_NAME_DRAW ] = SvGlobalName(SO3_SDRAW_CLASSID);
+ aGlobalNames[GLOB_NAME_MATH ] = SvGlobalName(SO3_SM_CLASSID);
+ aGlobalNames[GLOB_NAME_CHART ] = SvGlobalName(SO3_SCH_CLASSID);
+ if(!bIsWeb)
+ pCapOptions = new InsCaptionOptArr;
+
+ Load();
+}
+/*-- 10.10.00 16:22:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwInsertConfig::~SwInsertConfig()
+{
+ delete pCapOptions;
+ delete pOLEMiscOpt;
+}
+/*-- 10.10.00 16:22:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_WriteOpt(const InsCaptionOpt& rOpt, Any* pValues, sal_Int32 nProp, sal_Int32 nOffset)
+{
+ switch(nOffset)
+ {
+ case 0:
+ {
+ sal_Bool bTemp = rOpt.UseCaption();
+ pValues[nProp].setValue(&bTemp, ::getBooleanCppuType());
+ }
+ break;//Enable
+ case 1: pValues[nProp] <<= OUString(rOpt.GetCategory()); break;//Category
+ case 2: pValues[nProp] <<= (sal_Int32)rOpt.GetNumType(); break;//Numbering",
+ case 3: pValues[nProp] <<= rOpt.GetNumSeparator(); break;//NumberingSeparator",
+ case 4: pValues[nProp] <<= OUString(rOpt.GetCaption()); break;//CaptionText",
+ case 5: pValues[nProp] <<= OUString(rOpt.GetSeparator());break;//Delimiter",
+ case 6: pValues[nProp] <<= (sal_Int32)rOpt.GetLevel(); break;//Level",
+ case 7: pValues[nProp] <<= (sal_Int32)rOpt.GetPos(); break;//Position",
+ case 8: pValues[nProp] <<= (::rtl::OUString&)rOpt.GetCharacterStyle(); break; //CharacterStyle
+ case 9: pValues[nProp] <<= rOpt.CopyAttributes(); break; //ApplyAttributes
+ }
+}
+//-----------------------------------------------------------------------------
+void SwInsertConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+void SwInsertConfig::Commit()
+{
+ const Sequence<OUString>& aNames = GetPropertyNames();
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+
+ const Type& rType = ::getBooleanCppuType();
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ const InsCaptionOpt* pWriterTableOpt = 0;
+ const InsCaptionOpt* pWriterFrameOpt = 0;
+ const InsCaptionOpt* pWriterGraphicOpt = 0;
+ const InsCaptionOpt* pOLECalcOpt = 0;
+ const InsCaptionOpt* pOLEImpressOpt = 0;
+ const InsCaptionOpt* pOLEChartOpt = 0;
+ const InsCaptionOpt* pOLEFormulaOpt = 0;
+ const InsCaptionOpt* pOLEDrawOpt = 0;
+ if(pCapOptions)
+ {
+ pWriterTableOpt = pCapOptions->Find(TABLE_CAP, 0);
+ pWriterFrameOpt = pCapOptions->Find(FRAME_CAP, 0);
+ pWriterGraphicOpt = pCapOptions->Find(GRAPHIC_CAP, 0);
+ pOLECalcOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]);
+ pOLEImpressOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]);
+ pOLEDrawOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW ]);
+ pOLEFormulaOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH ]);
+ pOLEChartOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART ]);
+ }
+ switch(nProp)
+ {
+ case INS_PROP_TABLE_HEADER:
+ {
+ sal_Bool bVal = 0 !=(aInsTblOpts.mnInsMode & tabopts::HEADLINE); pValues[nProp].setValue(&bVal, rType);
+ }
+ break;//"Table/Header",
+ case INS_PROP_TABLE_REPEATHEADER:
+ {
+ sal_Bool bVal = (aInsTblOpts.mnRowsToRepeat>0); pValues[nProp].setValue(&bVal, rType);
+ }
+ break;//"Table/RepeatHeader",
+ case INS_PROP_TABLE_BORDER:
+ {
+ sal_Bool bVal = 0 !=(aInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER ); pValues[nProp].setValue(&bVal, rType);
+ }
+ break;//"Table/Border",
+ case INS_PROP_TABLE_SPLIT:
+ {
+ sal_Bool bVal = 0 !=(aInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT); pValues[nProp].setValue(&bVal, rType);
+ }
+ break;//"Table/Split",
+ case INS_PROP_CAP_AUTOMATIC: pValues[nProp].setValue(&bInsWithCaption, rType);break;//"Caption/Automatic",
+ case INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST:
+ pValues[nProp] <<= bCaptionOrderNumberingFirst;
+ break;//"Caption/CaptionOrderNumberingFirst"
+
+ case INS_PROP_CAP_OBJECT_TABLE_ENABLE:
+ case INS_PROP_CAP_OBJECT_TABLE_CATEGORY:
+ case INS_PROP_CAP_OBJECT_TABLE_NUMBERING:
+ case INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_TABLE_DELIMITER:
+ case INS_PROP_CAP_OBJECT_TABLE_LEVEL:
+ case INS_PROP_CAP_OBJECT_TABLE_POSITION:
+ case INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE:
+ if(pWriterTableOpt)
+ lcl_WriteOpt(*pWriterTableOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_TABLE_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_FRAME_ENABLE:
+ case INS_PROP_CAP_OBJECT_FRAME_CATEGORY:
+ case INS_PROP_CAP_OBJECT_FRAME_NUMBERING:
+ case INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_FRAME_DELIMITER:
+ case INS_PROP_CAP_OBJECT_FRAME_LEVEL:
+ case INS_PROP_CAP_OBJECT_FRAME_POSITION:
+ case INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE:
+ if(pWriterFrameOpt)
+ lcl_WriteOpt(*pWriterFrameOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FRAME_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_POSITION:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES:
+ if(pWriterGraphicOpt)
+ lcl_WriteOpt(*pWriterGraphicOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_CALC_ENABLE:
+ case INS_PROP_CAP_OBJECT_CALC_CATEGORY:
+ case INS_PROP_CAP_OBJECT_CALC_NUMBERING:
+ case INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_CALC_DELIMITER:
+ case INS_PROP_CAP_OBJECT_CALC_LEVEL:
+ case INS_PROP_CAP_OBJECT_CALC_POSITION:
+ case INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE:
+ case INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES:
+ if(pOLECalcOpt)
+ lcl_WriteOpt(*pOLECalcOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CALC_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_IMPRESS_ENABLE:
+ case INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY:
+ case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING:
+ case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER:
+ case INS_PROP_CAP_OBJECT_IMPRESS_LEVEL:
+ case INS_PROP_CAP_OBJECT_IMPRESS_POSITION:
+ case INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE:
+ case INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES:
+ if(pOLEImpressOpt)
+ lcl_WriteOpt(*pOLEImpressOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_IMPRESS_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_CHART_ENABLE:
+ case INS_PROP_CAP_OBJECT_CHART_CATEGORY:
+ case INS_PROP_CAP_OBJECT_CHART_NUMBERING:
+ case INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_CHART_DELIMITER:
+ case INS_PROP_CAP_OBJECT_CHART_LEVEL:
+ case INS_PROP_CAP_OBJECT_CHART_POSITION:
+ case INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE:
+ case INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES:
+ if(pOLEChartOpt)
+ lcl_WriteOpt(*pOLEChartOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CHART_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_FORMULA_ENABLE:
+ case INS_PROP_CAP_OBJECT_FORMULA_CATEGORY:
+ case INS_PROP_CAP_OBJECT_FORMULA_NUMBERING:
+ case INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_FORMULA_DELIMITER:
+ case INS_PROP_CAP_OBJECT_FORMULA_LEVEL:
+ case INS_PROP_CAP_OBJECT_FORMULA_POSITION:
+ case INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE:
+ case INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES:
+ if(pOLEFormulaOpt)
+ lcl_WriteOpt(*pOLEFormulaOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FORMULA_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_DRAW_ENABLE:
+ case INS_PROP_CAP_OBJECT_DRAW_CATEGORY:
+ case INS_PROP_CAP_OBJECT_DRAW_NUMBERING:
+ case INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_DRAW_DELIMITER:
+ case INS_PROP_CAP_OBJECT_DRAW_LEVEL:
+ case INS_PROP_CAP_OBJECT_DRAW_POSITION:
+ case INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE:
+ case INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES:
+ if(pOLEDrawOpt)
+ lcl_WriteOpt(*pOLEDrawOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_DRAW_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_OLEMISC_ENABLE:
+ case INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY:
+ case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING:
+ case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER:
+ case INS_PROP_CAP_OBJECT_OLEMISC_LEVEL:
+ case INS_PROP_CAP_OBJECT_OLEMISC_POSITION:
+ case INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE:
+ case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES:
+ if(pOLEMiscOpt)
+ lcl_WriteOpt(*pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE);
+ break;
+
+ }
+ }
+ PutProperties(aNames, aValues);
+}
+/*-- 10.10.00 16:22:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_ReadOpt(InsCaptionOpt& rOpt, const Any* pValues, sal_Int32 nProp, sal_Int32 nOffset)
+{
+ switch(nOffset)
+ {
+ case 0:
+ rOpt.UseCaption() = *(sal_Bool*)pValues[nProp].getValue();
+ break;//Enable
+ case 1:
+ {
+ OUString sTemp; pValues[nProp] >>= sTemp;
+ rOpt.SetCategory(sTemp);
+ }
+ break;//Category
+ case 2:
+ {
+ sal_Int32 nTemp = 0;
+ pValues[nProp] >>= nTemp;
+ rOpt.SetNumType(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
+ }
+ break;//Numbering",
+ case 3:
+ {
+ OUString sTemp; pValues[nProp] >>= sTemp;
+ rOpt.SetNumSeparator(sTemp);
+ }
+ break;//NumberingSeparator",
+ case 4:
+ {
+ OUString sTemp; pValues[nProp] >>= sTemp;
+ rOpt.SetCaption(sTemp);
+ }
+ break;//CaptionText",
+ case 5:
+ {
+ OUString sTemp;
+ if(pValues[nProp] >>= sTemp)
+ rOpt.SetSeparator(sTemp);
+ }
+ break;//Delimiter",
+ case 6:
+ {
+ sal_Int32 nTemp = 0;
+ pValues[nProp] >>= nTemp;
+ rOpt.SetLevel(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
+ }
+ break;//Level",
+ case 7:
+ {
+ sal_Int32 nTemp = 0;
+ pValues[nProp] >>= nTemp;
+ rOpt.SetPos(sal::static_int_cast< sal_uInt16, sal_Int32>(nTemp));
+ }
+ break;//Position",
+ case 8 : //CharacterStyle
+ {
+ ::rtl::OUString sTemp; pValues[nProp] >>= sTemp;
+ rOpt.SetCharacterStyle( sTemp );
+ }
+ break;
+ case 9 : //ApplyAttributes
+ {
+ pValues[nProp] >>= rOpt.CopyAttributes();
+ }
+ break;
+ }
+}
+//-----------------------------------------------------------------------------
+void SwInsertConfig::Load()
+{
+ const Sequence<OUString>& aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aNames.getLength())
+ {
+ InsCaptionOpt* pWriterTableOpt = 0;
+ InsCaptionOpt* pWriterFrameOpt = 0;
+ InsCaptionOpt* pWriterGraphicOpt = 0;
+ InsCaptionOpt* pOLECalcOpt = 0;
+ InsCaptionOpt* pOLEImpressOpt = 0;
+ InsCaptionOpt* pOLEChartOpt = 0;
+ InsCaptionOpt* pOLEFormulaOpt = 0;
+ InsCaptionOpt* pOLEDrawOpt = 0;
+ if(pCapOptions)
+ {
+ pWriterTableOpt = pCapOptions->Find(TABLE_CAP, 0);
+ pWriterFrameOpt = pCapOptions->Find(FRAME_CAP, 0);
+ pWriterGraphicOpt = pCapOptions->Find(GRAPHIC_CAP, 0);
+ pOLECalcOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]);
+ pOLEImpressOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]);
+ pOLEDrawOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW ]);
+ pOLEFormulaOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH ]);
+ pOLEChartOpt = pCapOptions->Find(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART ]);
+ }
+ else if(!bIsWeb)
+ return;
+
+ USHORT nInsTblFlags = 0;
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ sal_Bool bBool = nProp < INS_PROP_CAP_OBJECT_TABLE_ENABLE ? *(sal_Bool*)pValues[nProp].getValue() : sal_False;
+ switch(nProp)
+ {
+ case INS_PROP_TABLE_HEADER:
+ {
+ if(bBool)
+ nInsTblFlags|= tabopts::HEADLINE;
+ }
+ break;//"Table/Header",
+ case INS_PROP_TABLE_REPEATHEADER:
+ {
+ aInsTblOpts.mnRowsToRepeat = bBool? 1 : 0;
+
+ }
+ break;//"Table/RepeatHeader",
+ case INS_PROP_TABLE_BORDER:
+ {
+ if(bBool)
+ nInsTblFlags|= tabopts::DEFAULT_BORDER;
+ }
+ break;//"Table/Border",
+ case INS_PROP_TABLE_SPLIT:
+ {
+ if(bBool)
+ nInsTblFlags|= tabopts::SPLIT_LAYOUT;
+ }
+ break;//"Table/Split",
+ case INS_PROP_CAP_AUTOMATIC:
+ bInsWithCaption = bBool;
+ break;
+ case INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST: bCaptionOrderNumberingFirst = bBool; break;
+ case INS_PROP_CAP_OBJECT_TABLE_ENABLE:
+ case INS_PROP_CAP_OBJECT_TABLE_CATEGORY:
+ case INS_PROP_CAP_OBJECT_TABLE_NUMBERING:
+ case INS_PROP_CAP_OBJECT_TABLE_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_TABLE_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_TABLE_DELIMITER:
+ case INS_PROP_CAP_OBJECT_TABLE_LEVEL:
+ case INS_PROP_CAP_OBJECT_TABLE_POSITION:
+ case INS_PROP_CAP_OBJECT_TABLE_CHARACTERSTYLE:
+ if(!pWriterTableOpt)
+ {
+ pWriterTableOpt = new InsCaptionOpt(TABLE_CAP);
+ pCapOptions->Insert(pWriterTableOpt);
+ }
+ lcl_ReadOpt(*pWriterTableOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_TABLE_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_FRAME_ENABLE:
+ case INS_PROP_CAP_OBJECT_FRAME_CATEGORY:
+ case INS_PROP_CAP_OBJECT_FRAME_NUMBERING:
+ case INS_PROP_CAP_OBJECT_FRAME_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_FRAME_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_FRAME_DELIMITER:
+ case INS_PROP_CAP_OBJECT_FRAME_LEVEL:
+ case INS_PROP_CAP_OBJECT_FRAME_POSITION:
+ case INS_PROP_CAP_OBJECT_FRAME_CHARACTERSTYLE:
+ if(!pWriterFrameOpt)
+ {
+ pWriterFrameOpt = new InsCaptionOpt(FRAME_CAP);
+ pCapOptions->Insert(pWriterFrameOpt);
+ }
+ lcl_ReadOpt(*pWriterFrameOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FRAME_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_CATEGORY:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERING:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_DELIMITER:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_LEVEL:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_POSITION:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_CHARACTERSTYLE:
+ case INS_PROP_CAP_OBJECT_GRAPHIC_APPLYATTRIBUTES:
+ if(!pWriterGraphicOpt)
+ {
+ pWriterGraphicOpt = new InsCaptionOpt(GRAPHIC_CAP);
+ pCapOptions->Insert(pWriterGraphicOpt);
+ }
+ lcl_ReadOpt(*pWriterGraphicOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_GRAPHIC_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_CALC_ENABLE:
+ case INS_PROP_CAP_OBJECT_CALC_CATEGORY:
+ case INS_PROP_CAP_OBJECT_CALC_NUMBERING:
+ case INS_PROP_CAP_OBJECT_CALC_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_CALC_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_CALC_DELIMITER:
+ case INS_PROP_CAP_OBJECT_CALC_LEVEL:
+ case INS_PROP_CAP_OBJECT_CALC_POSITION:
+ case INS_PROP_CAP_OBJECT_CALC_CHARACTERSTYLE:
+ case INS_PROP_CAP_OBJECT_CALC_APPLYATTRIBUTES:
+ if(!pOLECalcOpt)
+ {
+ pOLECalcOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_CALC]);
+ pCapOptions->Insert(pOLECalcOpt);
+ }
+ lcl_ReadOpt(*pOLECalcOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CALC_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_IMPRESS_ENABLE:
+ case INS_PROP_CAP_OBJECT_IMPRESS_CATEGORY:
+ case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERING:
+ case INS_PROP_CAP_OBJECT_IMPRESS_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_IMPRESS_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_IMPRESS_DELIMITER:
+ case INS_PROP_CAP_OBJECT_IMPRESS_LEVEL:
+ case INS_PROP_CAP_OBJECT_IMPRESS_POSITION:
+ case INS_PROP_CAP_OBJECT_IMPRESS_CHARACTERSTYLE:
+ case INS_PROP_CAP_OBJECT_IMPRESS_APPLYATTRIBUTES:
+ if(!pOLEImpressOpt)
+ {
+ pOLEImpressOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_IMPRESS]);
+ pCapOptions->Insert(pOLEImpressOpt);
+ }
+ lcl_ReadOpt(*pOLEImpressOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_IMPRESS_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_CHART_ENABLE:
+ case INS_PROP_CAP_OBJECT_CHART_CATEGORY:
+ case INS_PROP_CAP_OBJECT_CHART_NUMBERING:
+ case INS_PROP_CAP_OBJECT_CHART_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_CHART_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_CHART_DELIMITER:
+ case INS_PROP_CAP_OBJECT_CHART_LEVEL:
+ case INS_PROP_CAP_OBJECT_CHART_POSITION:
+ case INS_PROP_CAP_OBJECT_CHART_CHARACTERSTYLE:
+ case INS_PROP_CAP_OBJECT_CHART_APPLYATTRIBUTES:
+ if(!pOLEChartOpt)
+ {
+ pOLEChartOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_CHART]);
+ pCapOptions->Insert(pOLEChartOpt);
+ }
+ lcl_ReadOpt(*pOLEChartOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_CHART_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_FORMULA_ENABLE:
+ case INS_PROP_CAP_OBJECT_FORMULA_CATEGORY:
+ case INS_PROP_CAP_OBJECT_FORMULA_NUMBERING:
+ case INS_PROP_CAP_OBJECT_FORMULA_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_FORMULA_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_FORMULA_DELIMITER:
+ case INS_PROP_CAP_OBJECT_FORMULA_LEVEL:
+ case INS_PROP_CAP_OBJECT_FORMULA_POSITION:
+ case INS_PROP_CAP_OBJECT_FORMULA_CHARACTERSTYLE:
+ case INS_PROP_CAP_OBJECT_FORMULA_APPLYATTRIBUTES:
+ if(!pOLEFormulaOpt)
+ {
+ pOLEFormulaOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_MATH]);
+ pCapOptions->Insert(pOLEFormulaOpt);
+ }
+ lcl_ReadOpt(*pOLEFormulaOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_FORMULA_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_DRAW_ENABLE:
+ case INS_PROP_CAP_OBJECT_DRAW_CATEGORY:
+ case INS_PROP_CAP_OBJECT_DRAW_NUMBERING:
+ case INS_PROP_CAP_OBJECT_DRAW_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_DRAW_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_DRAW_DELIMITER:
+ case INS_PROP_CAP_OBJECT_DRAW_LEVEL:
+ case INS_PROP_CAP_OBJECT_DRAW_POSITION:
+ case INS_PROP_CAP_OBJECT_DRAW_CHARACTERSTYLE:
+ case INS_PROP_CAP_OBJECT_DRAW_APPLYATTRIBUTES:
+ if(!pOLEDrawOpt)
+ {
+ pOLEDrawOpt = new InsCaptionOpt(OLE_CAP, &aGlobalNames[GLOB_NAME_DRAW]);
+ pCapOptions->Insert(pOLEDrawOpt);
+ }
+ lcl_ReadOpt(*pOLEDrawOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_DRAW_ENABLE);
+ break;
+ case INS_PROP_CAP_OBJECT_OLEMISC_ENABLE:
+ case INS_PROP_CAP_OBJECT_OLEMISC_CATEGORY:
+ case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERING:
+ case INS_PROP_CAP_OBJECT_OLEMISC_NUMBERINGSEPARATOR:
+ case INS_PROP_CAP_OBJECT_OLEMISC_CAPTIONTEXT:
+ case INS_PROP_CAP_OBJECT_OLEMISC_DELIMITER:
+ case INS_PROP_CAP_OBJECT_OLEMISC_LEVEL:
+ case INS_PROP_CAP_OBJECT_OLEMISC_POSITION:
+ case INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE:
+ case INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES:
+ if(!pOLEMiscOpt)
+ {
+ pOLEMiscOpt = new InsCaptionOpt(OLE_CAP);
+ }
+ lcl_ReadOpt(*pOLEMiscOpt, pValues, nProp, nProp - INS_PROP_CAP_OBJECT_OLEMISC_ENABLE);
+ break;
+ }
+ }
+ else if(nProp == INS_PROP_CAP_CAPTIONORDERNUMBERINGFIRST)
+ {
+ //#i61007# initialize caption order, right now only HUNGARIAN seems to need a different order
+ SvtSysLocaleOptions aSysLocaleOptions;
+ OUString sLang = aSysLocaleOptions.GetLocaleConfigString();
+ bCaptionOrderNumberingFirst = ( sLang.getLength() && sLang.matchAsciiL( "hu", 2 )) ? sal_True : sal_False;
+ }
+
+ }
+ aInsTblOpts.mnInsMode = nInsTblFlags;
+ }
+}
+/* -----------------------------10.10.00 16:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const Sequence<OUString>& SwTableConfig::GetPropertyNames()
+{
+ const int nCount = 8;
+ static Sequence<OUString> aNames(nCount);
+ static const char* aPropNames[] =
+ {
+ "Shift/Row", // 0
+ "Shift/Column", // 1
+ "Insert/Row", // 2
+ "Insert/Column", // 3
+ "Change/Effect", // 4
+ "Input/NumberRecognition", // 5
+ "Input/NumberFormatRecognition",// 6
+ "Input/Alignment" // 7
+ };
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ pNames[i] = OUString::createFromAscii(aPropNames[i]);
+ return aNames;
+}
+/*-- 10.10.00 16:22:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwTableConfig::SwTableConfig(sal_Bool bWeb) :
+ ConfigItem(bWeb ? C2U("Office.WriterWeb/Table") : C2U("Office.Writer/Table"),
+ CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE)
+{
+ Load();
+}
+/*-- 10.10.00 16:22:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwTableConfig::~SwTableConfig()
+{
+}
+/*-- 10.10.00 16:22:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwTableConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+void SwTableConfig::Commit()
+{
+ const Sequence<OUString>& aNames = GetPropertyNames();
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+
+ const Type& rType = ::getBooleanCppuType();
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ switch(nProp)
+ {
+ case 0 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblHMove); break; //"Shift/Row",
+ case 1 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblVMove); break; //"Shift/Column",
+ case 2 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblHInsert); break; //"Insert/Row",
+ case 3 : pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nTblVInsert); break; //"Insert/Column",
+ case 4 : pValues[nProp] <<= (sal_Int32)eTblChgMode; break; //"Change/Effect",
+ case 5 : pValues[nProp].setValue(&bInsTblFormatNum, rType); break; //"Input/NumberRecognition",
+ case 6 : pValues[nProp].setValue(&bInsTblChangeNumFormat, rType); break; //"Input/NumberFormatRecognition",
+ case 7 : pValues[nProp].setValue(&bInsTblAlignNum, rType); break; //"Input/Alignment"
+ }
+ }
+ PutProperties(aNames, aValues);
+}
+/*-- 10.10.00 16:22:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwTableConfig::Load()
+{
+ const Sequence<OUString>& aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aNames.getLength())
+ {
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ sal_Int32 nTemp = 0;
+ switch(nProp)
+ {
+ case 0 : pValues[nProp] >>= nTemp; nTblHMove = (USHORT)MM100_TO_TWIP(nTemp); break; //"Shift/Row",
+ case 1 : pValues[nProp] >>= nTemp; nTblVMove = (USHORT)MM100_TO_TWIP(nTemp); break; //"Shift/Column",
+ case 2 : pValues[nProp] >>= nTemp; nTblHInsert = (USHORT)MM100_TO_TWIP(nTemp); break; //"Insert/Row",
+ case 3 : pValues[nProp] >>= nTemp; nTblVInsert = (USHORT)MM100_TO_TWIP(nTemp); break; //"Insert/Column",
+ case 4 : pValues[nProp] >>= nTemp; eTblChgMode = (TblChgMode)nTemp; break; //"Change/Effect",
+ case 5 : bInsTblFormatNum = *(sal_Bool*)pValues[nProp].getValue(); break; //"Input/NumberRecognition",
+ case 6 : bInsTblChangeNumFormat = *(sal_Bool*)pValues[nProp].getValue(); break; //"Input/NumberFormatRecognition",
+ case 7 : bInsTblAlignNum = *(sal_Bool*)pValues[nProp].getValue(); break; //"Input/Alignment"
+ }
+ }
+ }
+ }
+}
+/*-- 18.01.01 17:02:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMiscConfig::SwMiscConfig() :
+ ConfigItem(C2U("Office.Writer"),
+ CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
+ bDefaultFontsInCurrDocOnly(sal_False),
+ bShowIndexPreview(sal_False),
+ bGrfToGalleryAsLnk(sal_True),
+ bNumAlignSize(sal_True),
+ bSinglePrintJob(sal_False),
+ bIsNameFromColumn(sal_True),
+ bAskForMailMergeInPrint(sal_True),
+ nMailingFormats(0)
+{
+ Load();
+}
+/*-- 18.01.01 17:02:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMiscConfig::~SwMiscConfig()
+{
+}
+/*-- 18.01.01 17:02:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const Sequence<OUString>& SwMiscConfig::GetPropertyNames()
+{
+ static Sequence<OUString> aNames;
+ if(!aNames.getLength())
+ {
+ const int nCount = 12;
+ aNames.realloc(nCount);
+ static const char* aPropNames[] =
+ {
+ "Statistics/WordNumber/Delimiter", // 0
+ "DefaultFont/Document", // 1
+ "Index/ShowPreview", // 2
+ "Misc/GraphicToGalleryAsLink", // 3
+ "Numbering/Graphic/KeepRatio", // 4
+ "FormLetter/PrintOutput/SinglePrintJobs", // 5
+ "FormLetter/MailingOutput/Format", // 6
+ "FormLetter/FileOutput/FileName/FromDatabaseField", // 7
+ "FormLetter/FileOutput/Path", // 8
+ "FormLetter/FileOutput/FileName/FromManualSetting", // 9
+ "FormLetter/FileOutput/FileName/Generation",//10
+ "FormLetter/PrintOutput/AskForMerge" //11
+ };
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ pNames[i] = C2U(aPropNames[i]);
+ }
+ return aNames;
+}
+/*-- 18.01.01 17:02:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMiscConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+void SwMiscConfig::Commit()
+{
+ const Sequence<OUString>& aNames = GetPropertyNames();
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+
+ const Type& rType = ::getBooleanCppuType();
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ switch(nProp)
+ {
+ case 0 :
+ pValues[nProp] <<= OUString(
+ SwModuleOptions::ConvertWordDelimiter(sWordDelimiter, sal_False));
+ break;
+ case 1 : pValues[nProp].setValue(&bDefaultFontsInCurrDocOnly, rType); break;
+ case 2 : pValues[nProp].setValue(&bShowIndexPreview, rType) ; break;
+ case 3 : pValues[nProp].setValue(&bGrfToGalleryAsLnk, rType); break;
+ case 4 : pValues[nProp].setValue(&bNumAlignSize, rType); break;
+ case 5 : pValues[nProp].setValue(&bSinglePrintJob, rType); break;
+ case 6 : pValues[nProp] <<= nMailingFormats; break;
+ case 7 : pValues[nProp] <<= OUString(sNameFromColumn); break;
+ case 8 : pValues[nProp] <<= OUString(sMailingPath); break;
+ case 9 : pValues[nProp] <<= OUString(sMailName); break;
+ case 10: pValues[nProp].setValue(&bIsNameFromColumn, rType);break;
+ case 11: pValues[nProp] <<= bAskForMailMergeInPrint; break;
+ }
+ }
+ PutProperties(aNames, aValues);
+}
+/*-- 18.01.01 17:02:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMiscConfig::Load()
+{
+ const Sequence<OUString>& aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aNames.getLength())
+ {
+ OUString sTmp;
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ switch(nProp)
+ {
+ case 0 : pValues[nProp] >>= sTmp;
+ sWordDelimiter = SwModuleOptions::ConvertWordDelimiter(sTmp, sal_True);
+ break;
+ case 1 : bDefaultFontsInCurrDocOnly = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 2 : bShowIndexPreview = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 3 : bGrfToGalleryAsLnk = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 4 : bNumAlignSize = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 5 : bSinglePrintJob = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 6 : pValues[nProp] >>= nMailingFormats; ; break;
+ case 7 : pValues[nProp] >>= sTmp; sNameFromColumn = sTmp; break;
+ case 8 : pValues[nProp] >>= sTmp; sMailingPath = sTmp; break;
+ case 9 : pValues[nProp] >>= sTmp; sMailName = sTmp; break;
+ case 10: bIsNameFromColumn = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 11: pValues[nProp] >>= bAskForMailMergeInPrint; break;
+ }
+ }
+ }
+ }
+}
diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx
new file mode 100644
index 000000000000..04b781982979
--- /dev/null
+++ b/sw/source/ui/config/optcomp.cxx
@@ -0,0 +1,628 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include "optcomp.hxx"
+
+#include "docsh.hxx"
+#include "swmodule.hxx"
+#include "swtypes.hxx"
+#include "uiitems.hxx"
+#include "view.hxx"
+#include "wrtsh.hxx"
+
+#include "optcomp.hrc"
+#include "globals.hrc"
+#include <tools/urlobj.hxx>
+#ifndef _UTL__HXX_
+#include <unotools/configmgr.hxx>
+#endif
+#include <vcl/msgbox.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <IDocumentSettingAccess.hxx>
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+using namespace ::std;
+
+#define ASCII_STR(s) OUString( RTL_CONSTASCII_USTRINGPARAM( s ) )
+#define DEFAULT_ENTRY COMPATIBILITY_DEFAULT_NAME
+#define USER_ENTRY ASCII_STR( "_user" )
+#define BUTTON_BORDER 2
+
+// struct CompatibilityItem ----------------------------------------------
+
+struct CompatibilityItem
+{
+ String m_sName;
+ String m_sModule;
+ bool m_bUsePrtMetrics;
+ bool m_bAddSpacing;
+ bool m_bAddSpacingAtPages;
+ bool m_bUseOurTabStops;
+ bool m_bNoExtLeading;
+ bool m_bUseLineSpacing;
+ bool m_bAddTableSpacing;
+ bool m_bUseObjPos;
+ bool m_bUseOurTextWrapping;
+ bool m_bConsiderWrappingStyle;
+ bool m_bExpandWordSpace;
+ bool m_bIsDefault;
+ bool m_bIsUser;
+
+ CompatibilityItem( const String& _rName, const String& _rModule,
+ bool _bUsePrtMetrics, bool _bAddSpacing, bool _bAddSpacingAtPages,
+ bool _bUseOurTabStops, bool _bNoExtLeading, bool _bUseLineSpacing,
+ bool _bAddTableSpacing, bool _bUseObjPos, bool _bUseOurTextWrapping,
+ bool _bConsiderWrappingStyle, bool _bExpandWordSpace,
+ bool _bIsDefault, bool _bIsUser ) :
+
+ m_sName ( _rName ),
+ m_sModule ( _rModule ),
+ m_bUsePrtMetrics ( _bUsePrtMetrics ),
+ m_bAddSpacing ( _bAddSpacing ),
+ m_bAddSpacingAtPages ( _bAddSpacingAtPages ),
+ m_bUseOurTabStops ( _bUseOurTabStops ),
+ m_bNoExtLeading ( _bNoExtLeading ),
+ m_bUseLineSpacing ( _bUseLineSpacing ),
+ m_bAddTableSpacing ( _bAddTableSpacing ),
+ m_bUseObjPos ( _bUseObjPos ),
+ m_bUseOurTextWrapping ( _bUseOurTextWrapping ),
+ m_bConsiderWrappingStyle( _bConsiderWrappingStyle ),
+ m_bExpandWordSpace ( _bExpandWordSpace ),
+ m_bIsDefault ( _bIsDefault ),
+ m_bIsUser ( _bIsUser ) {}
+};
+
+#include <vector>
+
+struct SwCompatibilityOptPage_Impl
+{
+ typedef vector< CompatibilityItem > SwCompatibilityItemList;
+
+ SwCompatibilityItemList m_aList;
+};
+
+// class SwCompatibilityOptPage ------------------------------------------
+
+SwCompatibilityOptPage::SwCompatibilityOptPage( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, SW_RES( TP_OPTCOMPATIBILITY_PAGE ), rSet ),
+
+ m_aMainFL ( this, SW_RES( FL_MAIN ) ),
+ m_aFormattingFT ( this, SW_RES( FT_FORMATTING ) ),
+ m_aFormattingLB ( this, SW_RES( LB_FORMATTING ) ),
+ m_aOptionsFT ( this, SW_RES( FT_OPTIONS ) ),
+ m_aOptionsLB ( this, SW_RES( LB_OPTIONS ) ),
+ m_aResetPB ( this, SW_RES( PB_RESET ) ),
+ m_aDefaultPB ( this, SW_RES( PB_DEFAULT ) ),
+ m_sUserEntry ( SW_RES( STR_USERENTRY ) ),
+ m_sUseAsDefaultQuery( SW_RES( STR_QRYBOX_USEASDEFAULT ) ),
+ m_pWrtShell ( NULL ),
+ m_pImpl ( new SwCompatibilityOptPage_Impl ),
+ m_nSavedOptions ( 0 )
+
+{
+ // init options strings with local resource ids -> so do it before FreeResource()
+ for ( USHORT nResId = STR_COMP_OPTIONS_START; nResId < STR_COMP_OPTIONS_END; ++nResId )
+ {
+ String sEntry = String( SW_RES( nResId ) );
+ if ( STR_TAB_ALIGNMENT == nResId ||
+ STR_LINE_SPACING == nResId ||
+ STR_USE_OBJPOSITIONING == nResId ||
+ STR_USE_OURTEXTWRAPPING == nResId )
+ ReplaceFormatName( sEntry );
+ SvLBoxEntry* pEntry = m_aOptionsLB.SvTreeListBox::InsertEntry( sEntry );
+ if ( pEntry )
+ {
+ m_aOptionsLB.SetCheckButtonState( pEntry, SV_BUTTON_UNCHECKED );
+ pEntry->SetUserData( (void*)(ULONG)nResId );
+ }
+ }
+ m_aOptionsLB.SetStyle( m_aOptionsLB.GetStyle() | WB_HSCROLL | WB_HIDESELECTION );
+ m_aOptionsLB.SetHighlightRange();
+
+ FreeResource();
+
+ InitControls( rSet );
+
+ // set handler
+ m_aFormattingLB.SetSelectHdl( LINK( this, SwCompatibilityOptPage, SelectHdl ) );
+ m_aDefaultPB.SetClickHdl( LINK( this, SwCompatibilityOptPage, UseAsDefaultHdl ) );
+
+ // hide some controls, will be implemented later!!!
+ m_aFormattingFT.Hide();
+ m_aFormattingLB.Hide();
+ m_aResetPB.Hide();
+ // so move and resize the other controls
+ Point aMovePnt = m_aFormattingFT.GetPosPixel();
+ Point aNewPnt = m_aOptionsFT.GetPosPixel();
+ aNewPnt.Y() = aMovePnt.Y();
+ m_aOptionsFT.SetPosPixel( aNewPnt );
+ aMovePnt = m_aFormattingLB.GetPosPixel();
+ aNewPnt = m_aOptionsLB.GetPosPixel();
+ long nDelta = aNewPnt.Y() - aMovePnt.Y();
+ aNewPnt.Y() = aMovePnt.Y();
+ m_aOptionsLB.SetPosPixel( aNewPnt );
+ Size aNewSz = m_aOptionsLB.GetSizePixel();
+ aNewSz.Height() += nDelta;
+ m_aOptionsLB.SetSizePixel( aNewSz );
+}
+
+// -----------------------------------------------------------------------
+
+SwCompatibilityOptPage::~SwCompatibilityOptPage()
+{
+ delete m_pImpl;
+}
+
+// -----------------------------------------------------------------------
+
+void SwCompatibilityOptPage::ReplaceFormatName( String& rEntry )
+{
+ static const String sOpenOfficeName = String::CreateFromAscii("OpenOffice.org");
+ static const String sAsianName = String::CreateFromAscii("StarSuite");
+
+ Any aAny = ::utl::ConfigManager::
+ GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME );
+ rtl::OUString sTmp;
+ if ( aAny >>= sTmp )
+ {
+ String sFormatName = sTmp;
+ String sFormatVersion;
+ bool bOpenOffice = ( sOpenOfficeName == sFormatName );
+ if ( bOpenOffice )
+ sFormatVersion = String::CreateFromAscii("1.1");
+ else
+ sFormatVersion = String::CreateFromAscii("6.0/7");
+ if ( !bOpenOffice && ( sAsianName != sFormatName ) )
+ sFormatName = String::CreateFromAscii("StarOffice");
+
+ rEntry.SearchAndReplace( String::CreateFromAscii("%FORMATNAME"), sFormatName );
+ rEntry.SearchAndReplace( String::CreateFromAscii("%FORMATVERSION"), sFormatVersion );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ULONG convertBools2Ulong_Impl
+(
+ bool _bUsePrtMetrics,
+ bool _bAddSpacing,
+ bool _bAddSpacingAtPages,
+ bool _bUseOurTabStops,
+ bool _bNoExtLeading,
+ bool _bUseLineSpacing,
+ bool _bAddTableSpacing,
+ bool _bUseObjPos,
+ bool _bUseOurTextWrapping,
+ bool _bConsiderWrappingStyle,
+ bool _bExpandWordSpace
+)
+{
+ ULONG nRet = 0;
+ ULONG nSetBit = 1;
+
+ if ( _bUsePrtMetrics )
+ nRet |= nSetBit;
+ nSetBit = nSetBit << 1;
+ if ( _bAddSpacing )
+ nRet |= nSetBit;
+ nSetBit = nSetBit << 1;
+ if ( _bAddSpacingAtPages )
+ nRet |= nSetBit;
+ nSetBit = nSetBit << 1;
+ if ( _bUseOurTabStops )
+ nRet |= nSetBit;
+ nSetBit = nSetBit << 1;
+ if ( _bNoExtLeading )
+ nRet |= nSetBit;
+ nSetBit = nSetBit << 1;
+ if ( _bUseLineSpacing )
+ nRet |= nSetBit;
+ nSetBit = nSetBit << 1;
+ if ( _bAddTableSpacing )
+ nRet |= nSetBit;
+ nSetBit = nSetBit << 1;
+ if ( _bUseObjPos )
+ nRet |= nSetBit;
+ nSetBit = nSetBit << 1;
+ if ( _bUseOurTextWrapping )
+ nRet |= nSetBit;
+ nSetBit = nSetBit << 1;
+ if ( _bConsiderWrappingStyle )
+ nRet |= nSetBit;
+ nSetBit = nSetBit << 1;
+ if ( _bExpandWordSpace )
+ nRet |= nSetBit;
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet )
+{
+ // init objectshell and detect document name
+ String sDocTitle;
+ const SfxPoolItem* pItem = NULL;
+ SfxObjectShell* pObjShell = NULL;
+ if ( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_WRTSHELL, FALSE, &pItem ) )
+ m_pWrtShell = (SwWrtShell*)( (const SwPtrItem*)pItem )->GetValue();
+ if ( m_pWrtShell )
+ {
+ pObjShell = m_pWrtShell->GetView().GetDocShell();
+ if ( pObjShell )
+ sDocTitle = pObjShell->GetTitle( SFX_TITLE_TITLE );
+ }
+ else
+ {
+ m_aMainFL.Disable();
+ m_aFormattingFT.Disable();
+ m_aFormattingLB.Disable();
+ m_aOptionsFT.Disable();
+ m_aOptionsLB.Disable();
+ m_aResetPB.Disable();
+ m_aDefaultPB.Disable();
+ }
+ String sText = m_aMainFL.GetText();
+ sText.SearchAndReplace( String::CreateFromAscii("%DOCNAME"), sDocTitle );
+ m_aMainFL.SetText( sText );
+
+ // loading file formats
+ Sequence< Sequence< PropertyValue > > aList = m_aConfigItem.GetList();
+ OUString sName;
+ OUString sModule;
+ bool bUsePrtMetrics = false;
+ bool bAddSpacing = false;
+ bool bAddSpacingAtPages = false;
+ bool bUseOurTabStops = false;
+ bool bNoExtLeading = false;
+ bool bUseLineSpacing = false;
+ bool bAddTableSpacing = false;
+ bool bUseObjPos = false;
+ bool bUseOurTextWrapping = false;
+ bool bConsiderWrappingStyle = false;
+ bool bExpandWordSpace = false;
+ int i, j, nCount = aList.getLength();
+ for ( i = 0; i < nCount; ++i )
+ {
+ String sNewEntry;
+ const Sequence< PropertyValue >& rEntry = aList[i];
+ for ( j = 0; j < rEntry.getLength(); j++ )
+ {
+ PropertyValue aValue = rEntry[j];
+ if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_NAME )
+ aValue.Value >>= sName;
+ else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_MODULE )
+ aValue.Value >>= sModule;
+ else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS )
+ aValue.Value >>= bUsePrtMetrics;
+ else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDSPACING )
+ aValue.Value >>= bAddSpacing;
+ else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES )
+ aValue.Value >>= bAddSpacingAtPages;
+ else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS )
+ aValue.Value >>= bUseOurTabStops;
+ else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_NOEXTLEADING )
+ aValue.Value >>= bNoExtLeading;
+ else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USELINESPACING )
+ aValue.Value >>= bUseLineSpacing;
+ else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING )
+ aValue.Value >>= bAddTableSpacing;
+ else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING )
+ aValue.Value >>= bUseObjPos;
+ else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING )
+ aValue.Value >>= bUseOurTextWrapping;
+ else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE )
+ aValue.Value >>= bConsiderWrappingStyle;
+ else if ( aValue.Name == COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE )
+ aValue.Value >>= bExpandWordSpace;
+ }
+
+ CompatibilityItem aItem(
+ sName, sModule, bUsePrtMetrics, bAddSpacing,
+ bAddSpacingAtPages, bUseOurTabStops, bNoExtLeading,
+ bUseLineSpacing, bAddTableSpacing, bUseObjPos,
+ bUseOurTextWrapping, bConsiderWrappingStyle, bExpandWordSpace,
+ ( sName.equals( DEFAULT_ENTRY ) != sal_False ),
+ ( sName.equals( USER_ENTRY ) != sal_False ) );
+ m_pImpl->m_aList.push_back( aItem );
+
+ if ( aItem.m_bIsDefault )
+ continue;
+
+ if ( sName.equals( USER_ENTRY ) )
+ sNewEntry = m_sUserEntry;
+ else if ( pObjShell && sName.getLength() > 0 )
+ {
+ SfxFilterContainer* pFacCont = pObjShell->GetFactory().GetFilterContainer();
+ const SfxFilter* pFilter = pFacCont->GetFilter4FilterName( sName );
+ if ( pFilter )
+ sNewEntry = pFilter->GetUIName();
+ }
+
+ if ( sNewEntry.Len() == 0 )
+ sNewEntry = sName;
+
+ USHORT nPos = m_aFormattingLB.InsertEntry( sNewEntry );
+ ULONG nOptions = convertBools2Ulong_Impl(
+ bUsePrtMetrics, bAddSpacing, bAddSpacingAtPages,
+ bUseOurTabStops, bNoExtLeading, bUseLineSpacing,
+ bAddTableSpacing, bUseObjPos, bUseOurTextWrapping,
+ bConsiderWrappingStyle, bExpandWordSpace );
+ m_aFormattingLB.SetEntryData( nPos, (void*)(long)nOptions );
+ }
+
+ m_aFormattingLB.SetDropDownLineCount( m_aFormattingLB.GetEntryCount() );
+
+ // check if the default button text is not too wide otherwise we have to stretch the button
+ // and move its position and the position of the reset button
+ long nTxtWidth = m_aDefaultPB.GetTextWidth( m_aDefaultPB.GetText() );
+ Size aBtnSz = m_aDefaultPB.GetSizePixel();
+ if ( nTxtWidth > aBtnSz.Width() )
+ {
+ long nDelta = nTxtWidth - aBtnSz.Width() + 2 * BUTTON_BORDER;
+ aBtnSz.Width() += nDelta;
+ Point aBtnPnt = m_aDefaultPB.GetPosPixel();
+ aBtnPnt.X() -= nDelta;
+ m_aDefaultPB.SetPosSizePixel( aBtnPnt, aBtnSz );
+ aBtnPnt = m_aResetPB.GetPosPixel();
+ aBtnPnt.X() -= 2 * nDelta;
+ m_aResetPB.SetPosSizePixel( aBtnPnt, aBtnSz );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SwCompatibilityOptPage, SelectHdl, ListBox*, EMPTYARG )
+{
+ USHORT nPos = m_aFormattingLB.GetSelectEntryPos();
+ ULONG nOptions = (ULONG)(void*)m_aFormattingLB.GetEntryData( nPos );
+ SetCurrentOptions( nOptions );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SwCompatibilityOptPage, UseAsDefaultHdl, PushButton*, EMPTYARG )
+{
+ QueryBox aBox( this, WinBits( WB_YES_NO | WB_DEF_YES ), m_sUseAsDefaultQuery );
+ if ( aBox.Execute() == RET_YES )
+ {
+ for ( vector< CompatibilityItem >::iterator pItem = m_pImpl->m_aList.begin();
+ pItem != m_pImpl->m_aList.end(); ++pItem )
+ {
+ if ( pItem->m_bIsDefault )
+ {
+ USHORT nCount = static_cast< USHORT >( m_aOptionsLB.GetEntryCount() );
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ bool bChecked = ( m_aOptionsLB.IsChecked(i) != FALSE );
+ CompatibilityOptions eOption = static_cast< CompatibilityOptions >(i);
+ switch ( eOption )
+ {
+ case COPT_USE_PRINTERDEVICE : pItem->m_bUsePrtMetrics = bChecked; break;
+ case COPT_ADD_SPACING : pItem->m_bAddSpacing = bChecked; break;
+ case COPT_ADD_SPACING_AT_PAGES : pItem->m_bAddSpacingAtPages = bChecked; break;
+ case COPT_USE_OUR_TABSTOPS : pItem->m_bUseOurTabStops = bChecked; break;
+ case COPT_NO_EXTLEADING : pItem->m_bNoExtLeading = bChecked; break;
+ case COPT_USE_LINESPACING : pItem->m_bUseLineSpacing = bChecked; break;
+ case COPT_ADD_TABLESPACING : pItem->m_bAddTableSpacing = bChecked; break;
+ case COPT_USE_OBJECTPOSITIONING: pItem->m_bUseObjPos = bChecked; break;
+ case COPT_USE_OUR_TEXTWRAPPING: pItem->m_bUseOurTextWrapping = bChecked; break;
+ case COPT_CONSIDER_WRAPPINGSTYLE: pItem->m_bConsiderWrappingStyle = bChecked; break;
+ case COPT_EXPAND_WORDSPACE: pItem->m_bExpandWordSpace = bChecked; break;
+ default:
+ {
+ DBG_ERRORFILE( "SwCompatibilityOptPage::UseAsDefaultHdl(): wrong option" );
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ WriteOptions();
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SwCompatibilityOptPage::SetCurrentOptions( ULONG nOptions )
+{
+ ULONG nCount = m_aOptionsLB.GetEntryCount();
+ DBG_ASSERT( nCount <= 32, "SwCompatibilityOptPage::Reset(): entry overflow" );
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ BOOL bChecked = ( ( nOptions & 0x00000001 ) == 0x00000001 );
+ m_aOptionsLB.CheckEntryPos( i, bChecked );
+ nOptions = nOptions >> 1;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+ULONG SwCompatibilityOptPage::GetDocumentOptions() const
+{
+ ULONG nRet = 0;
+ if ( m_pWrtShell )
+ {
+ const IDocumentSettingAccess& rIDocumentSettingAccess = *m_pWrtShell->getIDocumentSettingAccess();
+ nRet = convertBools2Ulong_Impl(
+ rIDocumentSettingAccess.get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) == sal_False,
+ rIDocumentSettingAccess.get(IDocumentSettingAccess::PARA_SPACE_MAX) != sal_False,
+ rIDocumentSettingAccess.get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES) != sal_False,
+ rIDocumentSettingAccess.get(IDocumentSettingAccess::TAB_COMPAT) == sal_False,
+ rIDocumentSettingAccess.get(IDocumentSettingAccess::ADD_EXT_LEADING) == sal_False,
+ rIDocumentSettingAccess.get(IDocumentSettingAccess::OLD_LINE_SPACING) != sal_False,
+ rIDocumentSettingAccess.get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS) != sal_False,
+ rIDocumentSettingAccess.get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS) != sal_False,
+ rIDocumentSettingAccess.get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING) != sal_False,
+ rIDocumentSettingAccess.get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) != sal_False,
+ rIDocumentSettingAccess.get(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK) != sal_True );
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+void SwCompatibilityOptPage::WriteOptions()
+{
+ m_aConfigItem.Clear();
+ for ( vector< CompatibilityItem >::const_iterator pItem = m_pImpl->m_aList.begin();
+ pItem != m_pImpl->m_aList.end(); ++pItem )
+ m_aConfigItem.AppendItem(
+ pItem->m_sName, pItem->m_sModule, pItem->m_bUsePrtMetrics, pItem->m_bAddSpacing,
+ pItem->m_bAddSpacingAtPages, pItem->m_bUseOurTabStops,
+ pItem->m_bNoExtLeading, pItem->m_bUseLineSpacing,
+ pItem->m_bAddTableSpacing, pItem->m_bUseObjPos,
+ pItem->m_bUseOurTextWrapping, pItem->m_bConsiderWrappingStyle,
+ pItem->m_bExpandWordSpace );
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* SwCompatibilityOptPage::Create( Window* pParent, const SfxItemSet& rAttrSet )
+{
+ return new SwCompatibilityOptPage( pParent, rAttrSet );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SwCompatibilityOptPage::FillItemSet( SfxItemSet& )
+{
+ BOOL bModified = FALSE;
+ if ( m_pWrtShell )
+ {
+ ULONG nSavedOptions = m_nSavedOptions;
+ ULONG nCount = m_aOptionsLB.GetEntryCount();
+ DBG_ASSERT( nCount <= 32, "SwCompatibilityOptPage::Reset(): entry overflow" );
+
+ bool bSetParaSpaceMax = false;
+
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ CompatibilityOptions nOption = static_cast< CompatibilityOptions >(i);
+ BOOL bChecked = m_aOptionsLB.IsChecked(i);
+ BOOL bSavedChecked = ( ( nSavedOptions & 0x00000001 ) == 0x00000001 );
+ if ( bChecked != bSavedChecked )
+ {
+ if ( COPT_USE_PRINTERDEVICE == nOption )
+ {
+ m_pWrtShell->SetUseVirDev( !bChecked );
+ bModified = TRUE;
+ }
+ else if ( ( COPT_ADD_SPACING == nOption || COPT_ADD_SPACING_AT_PAGES == nOption ) && !bSetParaSpaceMax )
+ bSetParaSpaceMax = true;
+ else if ( COPT_USE_OUR_TABSTOPS == nOption )
+ {
+ m_pWrtShell->SetTabCompat( !bChecked );
+ bModified = TRUE;
+ }
+ else if ( COPT_NO_EXTLEADING == nOption )
+ {
+ m_pWrtShell->SetAddExtLeading( !bChecked );
+ bModified = TRUE;
+ }
+ else if ( COPT_USE_LINESPACING == nOption )
+ {
+ m_pWrtShell->SetUseFormerLineSpacing( bChecked );
+ bModified = TRUE;
+ }
+ else if ( COPT_ADD_TABLESPACING == nOption )
+ {
+ m_pWrtShell->SetAddParaSpacingToTableCells( bChecked );
+ bModified = TRUE;
+ }
+ else if ( COPT_ADD_TABLESPACING == nOption )
+ {
+ m_pWrtShell->SetAddParaSpacingToTableCells( bChecked );
+ bModified = TRUE;
+ }
+ else if ( COPT_USE_OBJECTPOSITIONING == nOption )
+ {
+ m_pWrtShell->SetUseFormerObjectPositioning( bChecked );
+ bModified = TRUE;
+ }
+ else if ( COPT_USE_OUR_TEXTWRAPPING == nOption )
+ {
+ m_pWrtShell->SetUseFormerTextWrapping( bChecked );
+ bModified = TRUE;
+ }
+ else if ( COPT_CONSIDER_WRAPPINGSTYLE == nOption )
+ {
+ m_pWrtShell->SetConsiderWrapOnObjPos( bChecked );
+ bModified = TRUE;
+ }
+ else if ( COPT_EXPAND_WORDSPACE == nOption )
+ {
+ m_pWrtShell->SetDoNotJustifyLinesWithManualBreak( !bChecked );
+ bModified = TRUE;
+ }
+ }
+
+ nSavedOptions = nSavedOptions >> 1;
+ }
+
+ if ( bSetParaSpaceMax )
+ {
+ m_pWrtShell->SetParaSpaceMax( m_aOptionsLB.IsChecked( (USHORT)COPT_ADD_SPACING ) );
+ m_pWrtShell->SetParaSpaceMaxAtPages( m_aOptionsLB.IsChecked( (USHORT)COPT_ADD_SPACING_AT_PAGES ) );
+ bModified = TRUE;
+ }
+ }
+
+ if ( bModified )
+ WriteOptions();
+
+ return bModified;
+}
+
+// -----------------------------------------------------------------------
+
+void SwCompatibilityOptPage::Reset( const SfxItemSet& )
+{
+ m_aOptionsLB.SelectEntryPos( 0 );
+
+ ULONG nOptions = GetDocumentOptions();
+ SetCurrentOptions( nOptions );
+ m_nSavedOptions = nOptions;
+}
+
diff --git a/sw/source/ui/config/optcomp.hrc b/sw/source/ui/config/optcomp.hrc
new file mode 100644
index 000000000000..4219724a9106
--- /dev/null
+++ b/sw/source/ui/config/optcomp.hrc
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// the controls
+
+#define FL_MAIN 10
+#define FT_FORMATTING 11
+#define LB_FORMATTING 12
+#define FT_OPTIONS 13
+#define LB_OPTIONS 14
+#define PB_RESET 15
+#define PB_DEFAULT 16
+
+// the option strings
+
+#define STR_USERENTRY 10
+#define STR_QRYBOX_USEASDEFAULT 11
+
+#define STR_COMP_OPTIONS_START 100
+#define STR_PRINTER_METRICS (STR_COMP_OPTIONS_START + 0)
+#define STR_MERGE_PARA_DIST (STR_COMP_OPTIONS_START + 1)
+#define STR_MERGE_PARA_DIST_PAGESTART (STR_COMP_OPTIONS_START + 2)
+#define STR_TAB_ALIGNMENT (STR_COMP_OPTIONS_START + 3)
+#define STR_EXTERNAL_LEADING (STR_COMP_OPTIONS_START + 4)
+#define STR_LINE_SPACING (STR_COMP_OPTIONS_START + 5)
+#define STR_ADD_TABLESPACING (STR_COMP_OPTIONS_START + 6)
+#define STR_USE_OBJPOSITIONING (STR_COMP_OPTIONS_START + 7)
+#define STR_USE_OURTEXTWRAPPING (STR_COMP_OPTIONS_START + 8)
+#define STR_CONSIDER_WRAPPINGSTYLE (STR_COMP_OPTIONS_START + 9)
+#define STR_EXPAND_WORDSPACE (STR_COMP_OPTIONS_START + 10)
+#define STR_COMP_OPTIONS_END (STR_EXPAND_WORDSPACE + 1)
+
diff --git a/sw/source/ui/config/optcomp.src b/sw/source/ui/config/optcomp.src
new file mode 100644
index 000000000000..bdaa609b26b0
--- /dev/null
+++ b/sw/source/ui/config/optcomp.src
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "optcomp.hrc"
+#include "globals.hrc"
+#include "helpid.h"
+
+// TabPage TP_OPTCOMPATIBILITY_PAGE --------------------------------------
+
+TabPage TP_OPTCOMPATIBILITY_PAGE
+{
+ HelpID = HID_OPTCOMPATIBILITY_PAGE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_MAIN
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Compatibility options for %DOCNAME";
+ };
+ FixedText FT_FORMATTING
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 236 , 8 ) ;
+ Text [ en-US ] = "Recommended ~formatting options for";
+ };
+ ListBox LB_FORMATTING
+ {
+ HelpID = "sw:ListBox:TP_OPTCOMPATIBILITY_PAGE:LB_FORMATTING";
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 118 , 24 ) ;
+ DropDown = TRUE;
+ };
+ FixedText FT_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 236 , 8 ) ;
+ Text [ en-US ] = "~Options";
+ };
+ Control LB_OPTIONS
+ {
+ HelpId = HID_COMPATIBILITY_OPTIONS_BOX ;
+ Pos = MAP_APPFONT ( 12 , 51 ) ;
+ Size = MAP_APPFONT ( 236 , 108 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_RESET
+ {
+ HelpID = "sw:PushButton:TP_OPTCOMPATIBILITY_PAGE:PB_RESET";
+ Pos = MAP_APPFONT ( 125 , 165 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Reset";
+ };
+ PushButton PB_DEFAULT
+ {
+ HelpID = "sw:PushButton:TP_OPTCOMPATIBILITY_PAGE:PB_DEFAULT";
+ Pos = MAP_APPFONT ( 188 , 165 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "Use as ~Default";
+ };
+
+ String STR_USERENTRY
+ {
+ Text [ en-US ] = "<User settings>";
+ };
+
+ String STR_QRYBOX_USEASDEFAULT
+ {
+ Text [ en-US ] = "Do you want to change the compatibility options of the default template?\nThis will affect all new documents based on the default template.";
+ };
+
+// the option strings ----------------------------------------------------
+
+ String STR_PRINTER_METRICS
+ {
+ Text [ en-US ] = "Use printer metrics for document formatting";
+ };
+ String STR_MERGE_PARA_DIST
+ {
+ Text [ en-US ] = "Add spacing between paragraphs and tables (in current document)";
+ };
+ String STR_MERGE_PARA_DIST_PAGESTART
+ {
+ Text [ en-US ] = "Add paragraph and table spacing at tops of pages (in current document)";
+ };
+ String STR_TAB_ALIGNMENT
+ {
+ Text [ en-US ] = "Use %WRITERCOMPATIBILITYVERSIONOOO11 tabstop formatting";
+ };
+ String STR_EXTERNAL_LEADING
+ {
+ Text [ en-US ] = "Do not add leading (extra space) between lines of text";
+ };
+ String STR_LINE_SPACING
+ {
+ Text [ en-US ] = "Use %WRITERCOMPATIBILITYVERSIONOOO11 line spacing";
+ };
+ String STR_ADD_TABLESPACING
+ {
+ Text [ en-US ] = "Add paragraph and table spacing at bottom of table cells";
+ };
+ String STR_USE_OBJPOSITIONING
+ {
+ Text [ en-US ] = "Use %WRITERCOMPATIBILITYVERSIONOOO11 object positioning";
+ };
+ String STR_USE_OURTEXTWRAPPING
+ {
+ Text [ en-US ] = "Use %WRITERCOMPATIBILITYVERSIONOOO11 text wrapping around objects";
+ };
+ String STR_CONSIDER_WRAPPINGSTYLE
+ {
+ Text [ en-US ] = "Consider wrapping style when positioning objects";
+ };
+ String STR_EXPAND_WORDSPACE
+ {
+ Text [ en-US ] = "Expand word space on lines with manual line breaks in justified paragraphs";
+ };
+};
diff --git a/sw/source/ui/config/optdlg.hrc b/sw/source/ui/config/optdlg.hrc
new file mode 100644
index 000000000000..5d93219fed98
--- /dev/null
+++ b/sw/source/ui/config/optdlg.hrc
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/* TabPage Ansicht*/
+#define FL_DISP 1
+#define FL_NOPRINT 2
+#define FL_WINDOW 3
+
+#define CB_GRF 1
+#define CB_TBL 2
+#define CB_DRWFAST 3
+#define CB_FIELD 4
+#define CB_PARA 5
+#define CB_TAB 6
+#define CB_SPACE 7
+#define CB_HSPACE 8
+#define CB_SHYPH 9
+#define CB_FLD_HIDDEN 10
+#define CB_BREAK 11
+#define CB_ANY_RULER 12
+#define CB_CROSS 14
+#define CB_HSCROLL 15
+#define CB_VSCROLL 16
+#define CB_HRULER 17
+#define CB_VRULER 18
+#define FL_LINE 22
+#define CB_POSTIT 23
+#define CB_VRULER_RIGHT 24
+#define CB_BIGHANDLE 25
+
+#define FL_SETTINGS 26
+#define LB_METRIC 27
+#define FT_METRIC 28
+
+//test tab page
+#define CB_TEST1 25
+#define CB_TEST2 26
+#define CB_TEST3 27
+#define CB_TEST4 28
+#define CB_TEST5 29
+#define CB_TEST6 30
+#define CB_TEST7 31
+#define CB_TEST8 32
+#define CB_TEST9 33
+#define CB_TEST10 34
+#define FL_TEST 35
+
+#define CB_FLD_HIDDEN_PARA 36 //Mittendrin, damit die HelpIds zum FPII kompatibel bleiben
+#define CB_SMOOTH_SCROLL 37
+
+#define BT_OK 38
+#define BT_CANCEL 39
+#define BT_MORE 40
+#define BT_GRID 41
+#define MF_HFRAME 42
+#define MF_VFRAME 43
+
+#define CB_INDEX 44
+
+#define LB_COLOR 50
+#define WIN_COLOR 52
+#define ED_COLORNAME 53
+#define BT_EDIT 55
+#define BT_NEW 56
+#define BT_DELETE 57
+#define BT_DEFAULT 58
+#define CB_HANDLE 59
+#define CB_SECT_BOUNDS 60
+#define CB_CHAR_HIDDEN 61
+// Print-Extra-Page
+#define CB_PGRF 61
+//#define CB_PTAB 62 merged with CB_PGRF in printerpullpages
+//#define CB_PDRAW 63 removed in printerpullpages
+#define CB_LEFTP 64
+#define CB_RIGHTP 65
+//#define CB_REVERSE 66 removed in printerpullpages
+#define CB_PROSPECT 67
+//#define CB_SINGLEJOBS 68 removed in printerpullpages
+#define CB_CTRLFLD 69
+#define CB_PAPERFROMSETUP 70
+#define FL_1 71
+#define FL_2 72
+#define FL_3 73
+#define FL_4 74
+#define FT_FAX 76
+#define CB_BACKGROUND 79
+
+#define RB_NO 80
+#define RB_ONLY 81
+#define RB_END 82
+#define RB_PAGEEND 83
+#define ST_NONE 84
+#define LB_FAX 86
+#define CB_BLACK_FONT 87
+#define LB_HMETRIC 88
+#define LB_VMETRIC 89
+#define FL_SEP_PRT_LEFT 90
+#define FL_SEP_PRT_RIGHT 91
+#define CB_PRINTEMPTYPAGES 92
+#define CB_HIDDEN_TEXT 93
+#define CB_TEXT_PLACEHOLDER 94
+
+
+// Tabpage Grundschriften
+#define FT_STANDARD 90
+#define LB_STANDARD 91
+#define FT_TITLE 92
+#define LB_TITLE 93
+#define FT_LIST 94
+#define LB_LIST 95
+#define FT_LABEL 96
+#define LB_LABEL 97
+#define FT_IDX 98
+#define LB_IDX 99
+#define FL_STDCHR 100
+#define PB_STANDARD 101
+#define CB_DOCONLY 102
+#define ST_SCRIPT_WESTERN 103
+#define ST_SCRIPT_ASIAN 104
+#define ST_SCRIPT_CTL 105
+#define FT_TYPE 106
+#define FT_SIZE 107
+#define LB_STANDARD_SIZE 108
+#define LB_TITLE_SIZE 109
+#define LB_LIST_SIZE 110
+#define LB_LABEL_SIZE 111
+#define LB_INDEX_SIZE 112
+
+//Tabpage Tabelle
+#define CB_HEADER 101
+#define CB_REPEAT_HEADER 102
+#define CB_DONT_SPLIT 103
+#define CB_BORDER 104
+#define CB_NUMFORMATTING 105
+#define CB_NUMALIGNMENT 106
+#define FL_TABLE 107
+#define FL_TABLE_INSERT 108
+#define CB_NUMFMT_FORMATTING 109
+#define FL_MOVE 110
+#define FT_ROWMOVE 111
+#define MF_ROWMOVE 112
+#define FT_COLMOVE 113
+#define MF_COLMOVE 114
+#define FT_INSERT 115
+#define FT_ROWINSERT 116
+#define MF_ROWINSERT 117
+#define FT_COLINSERT 118
+#define MF_COLINSERT 119
+#define FT_HANDLING 120
+#define RB_FIX 121
+#define RB_FIXPROP 122
+#define RB_VAR 123
+#define FT_FIX 124
+#define FT_FIXPROP 125
+#define FT_VAR 126
+
+#define FT_MOVE 128
+#define FL_COLOR 130
+#define FT_SGML 131
+#define LB_SGML 132
+#define FT_COMMENT 133
+#define LB_COMMENT 134
+#define FT_KEYWD 135
+#define LB_KEYWD 136
+#define FT_UNKNOWN 137
+#define LB_UNKNOWN 138
+#define FL_TABLE_SEPARATOR 139
+#define CB_PROSPECT_RTL 140
+
+#define FL_SHDWCRSFLAG 1
+#define CB_SHDWCRSONOFF 2
+#define FL_SHDWCRSMODE 3
+#define FT_SHDWCRSFILLMODE 4
+#define RB_SHDWCRSFILLMARGIN 5
+#define RB_SHDWCRSFILLINDENT 6
+#define RB_SHDWCRSFILLTAB 7
+#define RB_SHDWCRSFILLSPACE 8
+#define CB_ALLOW_IN_PROT 12
+#define FL_CRSR_OPT 13
+#define FL_SEPARATOR_SHDW 14
+#define FL_LAYOUT_OPTIONS 15
+#define CB_MATH_BASELINE_ALIGNMENT 16
+
+
diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src
new file mode 100644
index 000000000000..400b3439b795
--- /dev/null
+++ b/sw/source/ui/config/optdlg.src
@@ -0,0 +1,1074 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* StarView ressource file */
+#ifndef _SFX_HRC
+#include <sfx2/sfx.hrc>
+#endif
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#include "globals.hrc"
+#include "config.hrc"
+#include "optdlg.hrc"
+#include "helpid.h"
+
+/**************************************************************************/
+/* */
+/* TabPage Ansicht/Inhalt */
+/* */
+/**************************************************************************/
+TabPage TP_CONTENT_OPT
+{
+ HelpID = HID_CONTENT_OPT ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_LINE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 118 , 8 ) ;
+ Group = TRUE ;
+ Text [ en-US ] = "Guides";
+ };
+ CheckBox CB_CROSS
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_CROSS";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "Guides ~while moving";
+ };
+ CheckBox CB_HANDLE
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_HANDLE";
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "Sim~ple handles";
+ };
+ CheckBox CB_BIGHANDLE
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_BIGHANDLE";
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "Large handles";
+ };
+ FixedLine FL_WINDOW
+ {
+ Pos = MAP_APPFONT ( 130 , 3 ) ;
+ Size = MAP_APPFONT ( 124 , 8 ) ;
+ Group = TRUE ;
+ Text [ en-US ] = "View";
+ };
+ CheckBox CB_HSCROLL
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_HSCROLL";
+ Pos = MAP_APPFONT ( 136 , 14 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "H~orizontal scrollbar" ;
+ };
+ CheckBox CB_VSCROLL
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_VSCROLL";
+ Pos = MAP_APPFONT ( 136 , 27 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "~Vertical scrollbar" ;
+ };
+ CheckBox CB_ANY_RULER
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_ANY_RULER";
+ Pos = MAP_APPFONT ( 136 , 40 ) ;
+ Size = MAP_APPFONT ( 65 , 10 ) ;
+ Text [ en-US ] = "R~uler" ;
+ };
+ CheckBox CB_HRULER
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_HRULER";
+ Pos = MAP_APPFONT ( 142 , 53 ) ;
+ Size = MAP_APPFONT ( 62 , 10 ) ;
+ Text [ en-US ] = "Hori~zontal ruler" ;
+ };
+ ListBox LB_HMETRIC
+ {
+ HelpID = "sw:ListBox:TP_CONTENT_OPT:LB_HMETRIC";
+ Pos = MAP_APPFONT ( 206 , 51 ) ;
+ Size = MAP_APPFONT ( 45 , 60 ) ;
+ DropDown = TRUE;
+ };
+ CheckBox CB_VRULER
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_VRULER";
+ Pos = MAP_APPFONT ( 142 , 66 ) ;
+ Size = MAP_APPFONT ( 62 , 10 ) ;
+ Text [ en-US ] = "Verti~cal ruler" ;
+ };
+ CheckBox CB_VRULER_RIGHT
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_VRULER_RIGHT";
+ Pos = MAP_APPFONT ( 148 , 79 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "Right-aligned";
+ };
+ ListBox LB_VMETRIC
+ {
+ HelpID = "sw:ListBox:TP_CONTENT_OPT:LB_VMETRIC";
+ Pos = MAP_APPFONT ( 206 , 64 ) ;
+ Size = MAP_APPFONT ( 45 , 60 ) ;
+ DropDown = TRUE;
+ };
+ CheckBox CB_SMOOTH_SCROLL
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_SMOOTH_SCROLL";
+ Pos = MAP_APPFONT ( 136 , 79 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "S~mooth scroll" ;
+ };
+ FixedLine FL_DISP
+ {
+ Pos = MAP_APPFONT ( 6 , 56 ) ;
+ Size = MAP_APPFONT ( 118 , 8 ) ;
+ Text [ en-US ] = "Display" ;
+ Group = TRUE ;
+ };
+ CheckBox CB_GRF
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_GRF";
+ Pos = MAP_APPFONT ( 12 , 67 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "~Graphics and objects" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ CheckBox CB_TBL
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_TBL";
+ Pos = MAP_APPFONT ( 12 , 80 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "~Tables " ;
+ };
+ CheckBox CB_DRWFAST
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_DRWFAST";
+ Pos = MAP_APPFONT ( 12 , 93 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "Dra~wings and controls" ;
+ };
+ CheckBox CB_FIELD
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_FIELD";
+ Pos = MAP_APPFONT ( 12 , 106 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "~Field codes" ;
+ };
+ CheckBox CB_POSTIT
+ {
+ HelpID = "sw:CheckBox:TP_CONTENT_OPT:CB_POSTIT";
+ Pos = MAP_APPFONT ( 12 , 119 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "~Comments" ;
+ };
+ FixedLine FL_SETTINGS
+ {
+ Pos = MAP_APPFONT ( 130 , 122 ) ;
+ Size = MAP_APPFONT ( 124 , 8 ) ;
+ Text [ en-US ] = "Settings";
+ Hide = TRUE;
+ };
+ FixedText FT_METRIC
+ {
+ Pos = MAP_APPFONT ( 136 , 135 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Measurement unit";
+ Hide = TRUE;
+ };
+ ListBox LB_METRIC
+ {
+ HelpID = "sw:ListBox:TP_CONTENT_OPT:LB_METRIC";
+ Pos = MAP_APPFONT ( 199, 133 ) ;
+ Size = MAP_APPFONT ( 50 , 50 ) ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ Hide = TRUE;
+ };
+};
+/**************************************************************************/
+/* */
+/* */
+/* */
+/**************************************************************************/
+TabPage TP_OPTPRINT_PAGE
+{
+ HelpID = HID_OPTPRINT_PAGE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_1
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 78 , 8 ) ;
+ Text [ en-US ] = "Contents" ;
+ Group = TRUE ;
+ };
+ CheckBox CB_PGRF /*functionally merged with CB_PDRAW*/
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_PGRF";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~Pictures and objects" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+/*
+ removed, tables now always get printed
+ CheckBox CB_PTAB
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_PTAB";
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~Tables" ;
+ };
+*/
+/*
+ functionally merged with CB_PGRF (pictures and graphics)
+ CheckBox CB_PDRAW
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_PDRAW";
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Dra~wings" ;
+ };
+*/
+ CheckBox CB_CTRLFLD
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_CTRLFLD";
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Form control~s" ;
+ };
+ CheckBox CB_BACKGROUND
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_BACKGROUND";
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Page ba~ckground" ;
+ };
+ CheckBox CB_BLACK_FONT
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_BLACK_FONT";
+ Pos = MAP_APPFONT ( 12 , 53 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Print text in blac~k" ;
+ };
+ CheckBox CB_HIDDEN_TEXT
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_HIDDEN_TEXT";
+ Pos = MAP_APPFONT ( 12 , 66 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Hidden te~xt" ;
+ };
+ CheckBox CB_TEXT_PLACEHOLDER
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_TEXT_PLACEHOLDER";
+ Pos = MAP_APPFONT ( 12 , 79 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Text ~placeholder" ;
+ };
+ FixedLine FL_SEP_PRT_LEFT
+ {
+ Pos = MAP_APPFONT ( 85 , 14 ) ;
+ Size = MAP_APPFONT ( 4 , 78 ) ;
+ Vert = TRUE;
+ };
+ FixedLine FL_2
+ {
+ Pos = MAP_APPFONT ( 90 , 3 ) ;
+ Size = MAP_APPFONT ( 78 , 8 ) ;
+ Text [ en-US ] = "Pages" ;
+ Group = TRUE ;
+ };
+ CheckBox CB_LEFTP
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_LEFTP";
+ Pos = MAP_APPFONT ( 96 , 14 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~Left pages" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ CheckBox CB_RIGHTP
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_RIGHTP";
+ Pos = MAP_APPFONT ( 96 , 27 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~Right pages" ;
+ };
+/*
+ removed, noe handled by the new print dialog (i.e. vcl) itself
+ CheckBox CB_REVERSE
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_REVERSE";
+ Pos = MAP_APPFONT ( 96 , 40 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Re~versed" ;
+ };
+*/
+ CheckBox CB_PROSPECT
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_PROSPECT";
+ Pos = MAP_APPFONT ( 96 , 40 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Broch~ure" ;
+ };
+ CheckBox CB_PROSPECT_RTL
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_PROSPECT_RTL";
+ Pos = MAP_APPFONT ( 103 , 53 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Right to Left" ;
+ Text [ x-comment ] = " ";
+ };
+ RadioButton RB_NO
+ {
+ HelpID = "sw:RadioButton:TP_OPTPRINT_PAGE:RB_NO";
+ Pos = MAP_APPFONT ( 180 , 14 ) ;
+ Size = MAP_APPFONT ( 74 , 10 ) ;
+ Text [ en-US ] = "~None" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ RadioButton RB_ONLY
+ {
+ HelpID = "sw:RadioButton:TP_OPTPRINT_PAGE:RB_ONLY";
+ Pos = MAP_APPFONT ( 180 , 27 ) ;
+ Size = MAP_APPFONT ( 74 , 10 ) ;
+ Text [ en-US ] = "Comments ~only" ;
+ };
+ RadioButton RB_END
+ {
+ HelpID = "sw:RadioButton:TP_OPTPRINT_PAGE:RB_END";
+ Pos = MAP_APPFONT ( 180 , 40 ) ;
+ Size = MAP_APPFONT ( 74 , 10 ) ;
+ Text [ en-US ] = "End of docu~ment" ;
+ };
+ RadioButton RB_PAGEEND
+ {
+ HelpID = "sw:RadioButton:TP_OPTPRINT_PAGE:RB_PAGEEND";
+ Pos = MAP_APPFONT ( 180 , 53 ) ;
+ Size = MAP_APPFONT ( 74 , 10 ) ;
+ Text [ en-US ] = "~End of page" ;
+ };
+ FixedLine FL_SEP_PRT_RIGHT
+ {
+ Pos = MAP_APPFONT ( 169 , 14 ) ;
+ Size = MAP_APPFONT ( 4 , 78 ) ;
+ Vert = TRUE;
+ };
+ FixedLine FL_3
+ {
+ Pos = MAP_APPFONT ( 174 , 3 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Comments" ;
+ Group = TRUE ;
+ };
+ FixedLine FL_4
+ {
+ Pos = MAP_APPFONT ( 6 , 95 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Group = TRUE ;
+ Text [ en-US ] = "Other";
+ };
+ CheckBox CB_PRINTEMPTYPAGES
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_PRINTEMPTYPAGES";
+ Pos = MAP_APPFONT ( 12 , 106 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Print ~automatically inserted blank pages";
+ };
+/*
+ CheckBox CB_SINGLEJOBS
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_SINGLEJOBS";
+ Pos = MAP_APPFONT ( 12 , 119 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Create s~ingle print jobs" ;
+ };
+*/
+ CheckBox CB_PAPERFROMSETUP
+ {
+ HelpID = "sw:CheckBox:TP_OPTPRINT_PAGE:CB_PAPERFROMSETUP";
+ Pos = MAP_APPFONT ( 12 , 119 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Paper tray from printer settings";
+ };
+ FixedText FT_FAX
+ {
+ Pos = MAP_APPFONT ( 12 , 134 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Group = TRUE ;
+ Text [ en-US ] = "~Fax";
+ };
+ ListBox LB_FAX
+ {
+ HelpID = "sw:ListBox:TP_OPTPRINT_PAGE:LB_FAX";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 70 , 132 ) ;
+ Size = MAP_APPFONT ( 184 , 70 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Group = TRUE ;
+ };
+ String ST_NONE
+ {
+ Text [ en-US ] = "<None>";
+ };
+};
+/**************************************************************************/
+/* */
+/* */
+/* */
+/**************************************************************************/
+TabPage TP_STD_FONT
+{
+ HelpID = HID_STD_FONT ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_STDCHR
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Basic fonts (%1)";
+ };
+ FixedText FT_TYPE
+ {
+ Pos = MAP_APPFONT ( 63 , 14 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Text [ en-US ] = "Font";
+ };
+ FixedText FT_SIZE
+ {
+ Pos = MAP_APPFONT ( 204 , 14 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Size";
+ };
+ MetricBox LB_STANDARD_SIZE
+ {
+ HelpID = "sw:MetricBox:TP_STD_FONT:LB_STANDARD_SIZE";
+ Pos = MAP_APPFONT ( 204 , 25 ) ;
+ Size = MAP_APPFONT ( 30 , 60 ) ;
+ Border = TRUE ;
+ DropDown = TRUE;
+ };
+ MetricBox LB_TITLE_SIZE
+ {
+ HelpID = "sw:MetricBox:TP_STD_FONT:LB_TITLE_SIZE";
+ Pos = MAP_APPFONT ( 204 , 42 ) ;
+ Size = MAP_APPFONT ( 30 , 60 ) ;
+ Border = TRUE ;
+ DropDown = TRUE;
+ };
+ MetricBox LB_LIST_SIZE
+ {
+ HelpID = "sw:MetricBox:TP_STD_FONT:LB_LIST_SIZE";
+ Pos = MAP_APPFONT ( 204 , 59 ) ;
+ Size = MAP_APPFONT ( 30 , 60 ) ;
+ Border = TRUE ;
+ DropDown = TRUE;
+ };
+ MetricBox LB_LABEL_SIZE
+ {
+ HelpID = "sw:MetricBox:TP_STD_FONT:LB_LABEL_SIZE";
+ Pos = MAP_APPFONT ( 204 , 76 ) ;
+ Size = MAP_APPFONT ( 30 , 60 ) ;
+ Border = TRUE ;
+ DropDown = TRUE;
+ };
+ MetricBox LB_INDEX_SIZE
+ {
+ HelpID = "sw:MetricBox:TP_STD_FONT:LB_INDEX_SIZE";
+ Pos = MAP_APPFONT ( 204 , 93 ) ;
+ Size = MAP_APPFONT ( 30 , 60 ) ;
+ Border = TRUE ;
+ DropDown = TRUE;
+ };
+ FixedText FT_STANDARD
+ {
+ Pos = MAP_APPFONT ( 12 , 26 ) ;
+ Size = MAP_APPFONT ( 48 , 10 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "De~fault" ;
+ };
+ FixedText FT_TITLE
+ {
+ Pos = MAP_APPFONT ( 12 , 43 ) ;
+ Size = MAP_APPFONT ( 48 , 10 ) ;
+ Text [ en-US ] = "Headin~g" ;
+ Left = TRUE ;
+ };
+ FixedText FT_LIST
+ {
+ Pos = MAP_APPFONT ( 12 , 60 ) ;
+ Size = MAP_APPFONT ( 48 , 10 ) ;
+ Text [ en-US ] = "~List" ;
+ Left = TRUE ;
+ };
+ FixedText FT_LABEL
+ {
+ Pos = MAP_APPFONT ( 12 , 77 ) ;
+ Size = MAP_APPFONT ( 48 , 10 ) ;
+ Text [ en-US ] = "C~aption" ;
+ Left = TRUE ;
+ };
+ FixedText FT_IDX
+ {
+ Pos = MAP_APPFONT ( 12 , 94 ) ;
+ Size = MAP_APPFONT ( 48 , 10 ) ;
+ Text [ en-US ] = "~Index" ;
+ Left = TRUE ;
+ };
+ ComboBox LB_STANDARD
+ {
+ HelpID = "sw:ComboBox:TP_STD_FONT:LB_STANDARD";
+ Pos = MAP_APPFONT ( 63 , 25 ) ;
+ Size = MAP_APPFONT ( 135 , 73 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ ComboBox LB_TITLE
+ {
+ HelpID = "sw:ComboBox:TP_STD_FONT:LB_TITLE";
+ Pos = MAP_APPFONT ( 63 , 42 ) ;
+ Size = MAP_APPFONT ( 135, 73 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ ComboBox LB_LIST
+ {
+ HelpID = "sw:ComboBox:TP_STD_FONT:LB_LIST";
+ Pos = MAP_APPFONT ( 63 , 59 ) ;
+ Size = MAP_APPFONT ( 135 , 73 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ ComboBox LB_LABEL
+ {
+ HelpID = "sw:ComboBox:TP_STD_FONT:LB_LABEL";
+ Pos = MAP_APPFONT ( 63 , 76 ) ;
+ Size = MAP_APPFONT ( 135 , 73 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ ComboBox LB_IDX
+ {
+ HelpID = "sw:ComboBox:TP_STD_FONT:LB_IDX";
+ Pos = MAP_APPFONT ( 63 , 94 ) ;
+ Size = MAP_APPFONT ( 135, 73 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ CheckBox CB_DOCONLY
+ {
+ HelpID = "sw:CheckBox:TP_STD_FONT:CB_DOCONLY";
+ Pos = MAP_APPFONT ( 12 , 111 ) ;
+ Size = MAP_APPFONT ( 147 , 10 ) ;
+ Text [ en-US ] = "C~urrent document only" ;
+ };
+ PushButton PB_STANDARD
+ {
+ HelpID = "sw:PushButton:TP_STD_FONT:PB_STANDARD";
+ Pos = MAP_APPFONT ( 204 , 165 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Default" ;
+ };
+ String ST_SCRIPT_ASIAN
+ {
+ Text [ en-US ] = "Asian";
+ };
+ String ST_SCRIPT_CTL
+ {
+ Text [ en-US ] = "CTL";
+ };
+ String ST_SCRIPT_WESTERN
+ {
+ Text [ en-US ] = "Western";
+ };
+};
+/**************************************************************************/
+/* */
+/* */
+/* */
+/**************************************************************************/
+TabPage TP_OPTTABLE_PAGE
+{
+ HelpID = HID_OPTTABLE_PAGE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_TABLE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 113 , 8 ) ;
+ Text [ en-US ] = "Default";
+ };
+ CheckBox CB_HEADER
+ {
+ HelpID = "sw:CheckBox:TP_OPTTABLE_PAGE:CB_HEADER";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 107 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "H~eading";
+ };
+ CheckBox CB_REPEAT_HEADER
+ {
+ HelpID = "sw:CheckBox:TP_OPTTABLE_PAGE:CB_REPEAT_HEADER";
+ Pos = MAP_APPFONT ( 21 , 27 ) ;
+ Size = MAP_APPFONT ( 99 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Re~peat on each page";
+ };
+ CheckBox CB_DONT_SPLIT
+ {
+ HelpID = "sw:CheckBox:TP_OPTTABLE_PAGE:CB_DONT_SPLIT";
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 107 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Do not split";
+ };
+ CheckBox CB_BORDER
+ {
+ HelpID = "sw:CheckBox:TP_OPTTABLE_PAGE:CB_BORDER";
+ Pos = MAP_APPFONT ( 12 , 53 ) ;
+ Size = MAP_APPFONT ( 107 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "B~order";
+ };
+ FixedLine FL_TABLE_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 120 , 14 ) ;
+ Size = MAP_APPFONT ( 4 , 52 ) ;
+ Vert = TRUE;
+ };
+ FixedLine FL_TABLE_INSERT
+ {
+ Pos = MAP_APPFONT ( 125 , 3 ) ;
+ Size = MAP_APPFONT ( 129 , 8 ) ;
+ Text [ en-US ] = "Input in tables";
+ };
+ CheckBox CB_NUMFORMATTING
+ {
+ HelpID = "sw:CheckBox:TP_OPTTABLE_PAGE:CB_NUMFORMATTING";
+ Pos = MAP_APPFONT ( 131 , 14 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Number recognition";
+ };
+ CheckBox CB_NUMFMT_FORMATTING
+ {
+ HelpID = "sw:CheckBox:TP_OPTTABLE_PAGE:CB_NUMFMT_FORMATTING";
+ Pos = MAP_APPFONT ( 140 , 27 ) ;
+ Size = MAP_APPFONT ( 114 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Number format recognition";
+ };
+ CheckBox CB_NUMALIGNMENT
+ {
+ HelpID = "sw:CheckBox:TP_OPTTABLE_PAGE:CB_NUMALIGNMENT";
+ Pos = MAP_APPFONT ( 140 , 40 ) ;
+ Size = MAP_APPFONT ( 114 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Alignment";
+ };
+ FixedLine FL_MOVE
+ {
+ Pos = MAP_APPFONT ( 6 , 69 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Keyboard handling";
+ };
+ FixedText FT_MOVE
+ {
+ Pos = MAP_APPFONT ( 12 , 80) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Text [ en-US ] = "Move cells";
+ };
+ FixedText FT_ROWMOVE
+ {
+ Pos = MAP_APPFONT ( 21 , 93 ) ;
+ Size = MAP_APPFONT ( 51 , 8 ) ;
+ Text [ en-US ] = "~Row" ;
+ };
+ MetricField MF_ROWMOVE
+ {
+ HelpID = "sw:MetricField:TP_OPTTABLE_PAGE:MF_ROWMOVE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 83 , 91 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ SpinSize = 10 ;
+ Minimum = 25 ;
+ Maximum = 999 ;
+ First = 25 ;
+ Last = 2000 ;
+ };
+ FixedText FT_COLMOVE
+ {
+ Pos = MAP_APPFONT ( 21 , 108 ) ;
+ Size = MAP_APPFONT ( 51 , 8 ) ;
+ Text [ en-US ] = "~Column" ;
+ };
+ MetricField MF_COLMOVE
+ {
+ HelpID = "sw:MetricField:TP_OPTTABLE_PAGE:MF_COLMOVE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 83 , 106 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ SpinSize = 10 ;
+ Minimum = 25 ;
+ Maximum = 999 ;
+ First = 25 ;
+ Last = 2000 ;
+ };
+ FixedText FT_INSERT
+ {
+ Pos = MAP_APPFONT ( 136 , 80 ) ;
+ Size = MAP_APPFONT ( 110 , 8 ) ;
+ Text [ en-US ] = "Insert cell";
+ };
+ FixedText FT_ROWINSERT
+ {
+ Pos = MAP_APPFONT ( 145 , 93 ) ;
+ Size = MAP_APPFONT ( 51 , 8 ) ;
+ Text [ en-US ] = "Ro~w" ;
+ };
+ MetricField MF_ROWINSERT
+ {
+ HelpID = "sw:MetricField:TP_OPTTABLE_PAGE:MF_ROWINSERT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 211 , 91 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ SpinSize = 10 ;
+ Minimum = 25 ;
+ Maximum = 999 ;
+ First = 25 ;
+ Last = 2000 ;
+ };
+ FixedText FT_COLINSERT
+ {
+ Pos = MAP_APPFONT ( 145 , 108 ) ;
+ Size = MAP_APPFONT ( 51 , 10 ) ;
+ Text [ en-US ] = "Colu~mn" ;
+ };
+ MetricField MF_COLINSERT
+ {
+ HelpID = "sw:MetricField:TP_OPTTABLE_PAGE:MF_COLINSERT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 211 , 106 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ SpinSize = 10 ;
+ Minimum = 25 ;
+ Maximum = 999 ;
+ First = 25 ;
+ Last = 2000 ;
+ };
+ FixedText FT_HANDLING
+ {
+ Pos = MAP_APPFONT ( 12 , 122 ) ;
+ Size = MAP_APPFONT ( 230 , 8 ) ;
+ Text [ en-US ] = "Behavior of rows/columns";
+ };
+ RadioButton RB_FIX
+ {
+ HelpID = "sw:RadioButton:TP_OPTTABLE_PAGE:RB_FIX";
+ Pos = MAP_APPFONT ( 21 , 133 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~Fixed" ;
+ };
+ FixedText FT_FIX
+ {
+ Pos = MAP_APPFONT ( 93 , 133 ) ;
+ Size = MAP_APPFONT ( 155 , 16 ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "Changes affect the adjacent area only";
+ };
+ RadioButton RB_FIXPROP
+ {
+ HelpID = "sw:RadioButton:TP_OPTTABLE_PAGE:RB_FIXPROP";
+ Pos = MAP_APPFONT ( 21 , 151 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Fi~xed, proportional" ;
+ };
+ FixedText FT_FIXPROP
+ {
+ Pos = MAP_APPFONT ( 93 , 151 ) ;
+ Size = MAP_APPFONT ( 155 , 16 ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "Changes affect the entire table";
+ };
+ RadioButton RB_VAR
+ {
+ HelpID = "sw:RadioButton:TP_OPTTABLE_PAGE:RB_VAR";
+ Pos = MAP_APPFONT ( 21 , 169 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~Variable" ;
+ };
+ FixedText FT_VAR
+ {
+ Pos = MAP_APPFONT ( 93 , 169 ) ;
+ Size = MAP_APPFONT ( 155 , 16 ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "Changes affect the table size";
+ };
+};
+/**************************************************************************/
+/* */
+/* TabPage ShadowCursor */
+/* */
+/**************************************************************************/
+TabPage TP_OPTSHDWCRSR
+{
+ HelpID = HID_OPTSHDWCRSR ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ //_----------------------------
+ FixedLine FL_NOPRINT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 118 , 8 ) ;
+ Group = TRUE ;
+ Text [ en-US ] = "Display of";
+ };
+ CheckBox CB_PARA
+ {
+ HelpID = "sw:CheckBox:TP_OPTSHDWCRSR:CB_PARA";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "Pa~ragraph end" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ CheckBox CB_SHYPH
+ {
+ HelpID = "sw:CheckBox:TP_OPTSHDWCRSR:CB_SHYPH";
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "Custom h~yphens" ;
+ };
+ CheckBox CB_SPACE
+ {
+ HelpID = "sw:CheckBox:TP_OPTSHDWCRSR:CB_SPACE";
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "Spac~es" ;
+ };
+ CheckBox CB_HSPACE
+ {
+ HelpID = "sw:CheckBox:TP_OPTSHDWCRSR:CB_HSPACE";
+ Pos = MAP_APPFONT ( 12 , 53 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "Non-breaking s~paces" ;
+ };
+ CheckBox CB_TAB
+ {
+ HelpID = "sw:CheckBox:TP_OPTSHDWCRSR:CB_TAB";
+ Pos = MAP_APPFONT ( 12 , 66 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "Ta~bs" ;
+ };
+ CheckBox CB_BREAK
+ {
+ HelpID = "sw:CheckBox:TP_OPTSHDWCRSR:CB_BREAK";
+ Pos = MAP_APPFONT ( 12 , 79 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "Brea~ks" ;
+ };
+ CheckBox CB_CHAR_HIDDEN
+ {
+ HelpID = "sw:CheckBox:TP_OPTSHDWCRSR:CB_CHAR_HIDDEN";
+ Pos = MAP_APPFONT ( 12 , 92 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "Hidden text" ;
+ };
+ CheckBox CB_FLD_HIDDEN
+ {
+ HelpID = "sw:CheckBox:TP_OPTSHDWCRSR:CB_FLD_HIDDEN";
+ Pos = MAP_APPFONT ( 12 , 105 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "Fields: Hidden te~xt" ;
+ };
+ CheckBox CB_FLD_HIDDEN_PARA
+ {
+ HelpID = "sw:CheckBox:TP_OPTSHDWCRSR:CB_FLD_HIDDEN_PARA";
+ Pos = MAP_APPFONT ( 12 , 118 ) ;
+ Size = MAP_APPFONT ( 108 , 10 ) ;
+ Text [ en-US ] = "Fields: Hidden p~aragraphs" ;
+ };
+ FixedLine FL_SEPARATOR_SHDW
+ {
+ Pos = MAP_APPFONT ( 125 , 14 ) ;
+ Size = MAP_APPFONT ( 4 , 79 ) ;
+ Vert = TRUE;
+ };
+ FixedLine FL_SHDWCRSFLAG
+ {
+ Pos = MAP_APPFONT ( 130 , 3 ) ;
+ Size = MAP_APPFONT ( 124 , 8 ) ;
+ Text [ en-US ] = "Direct cursor" ;
+ };
+ CheckBox CB_SHDWCRSONOFF
+ {
+ HelpID = "sw:CheckBox:TP_OPTSHDWCRSR:CB_SHDWCRSONOFF";
+ Pos = MAP_APPFONT ( 136 , 14 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ Text [ en-US ] = "~Direct cursor" ;
+ };
+ FixedText FT_SHDWCRSFILLMODE
+ {
+ Pos = MAP_APPFONT ( 136 , 27 ) ;
+ Size = MAP_APPFONT ( 48 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Insert" ;
+ };
+ RadioButton RB_SHDWCRSFILLMARGIN
+ {
+ HelpID = "sw:RadioButton:TP_OPTSHDWCRSR:RB_SHDWCRSFILLMARGIN";
+ Pos = MAP_APPFONT ( 145 , 39 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ Text [ en-US ] = "Para~graph alignment" ;
+ };
+ RadioButton RB_SHDWCRSFILLINDENT
+ {
+ HelpID = "sw:RadioButton:TP_OPTSHDWCRSR:RB_SHDWCRSFILLINDENT";
+ Pos = MAP_APPFONT ( 145 , 52 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "~Left paragraph margin" ;
+ };
+ RadioButton RB_SHDWCRSFILLTAB
+ {
+ HelpID = "sw:RadioButton:TP_OPTSHDWCRSR:RB_SHDWCRSFILLTAB";
+ Pos = MAP_APPFONT ( 145 , 66 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "~Tabs" ;
+ };
+ RadioButton RB_SHDWCRSFILLSPACE
+ {
+ HelpID = "sw:RadioButton:TP_OPTSHDWCRSR:RB_SHDWCRSFILLSPACE";
+ Pos = MAP_APPFONT ( 145 , 79 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "Tabs a~nd spaces" ;
+ };
+ FixedLine FL_CRSR_OPT
+ {
+ Pos = MAP_APPFONT ( 130 , 96 ) ;
+ Size = MAP_APPFONT ( 124 , 8 ) ;
+ Text [ en-US ] = "Cursor in protected areas";
+ };
+ CheckBox CB_ALLOW_IN_PROT
+ {
+ HelpID = "sw:CheckBox:TP_OPTSHDWCRSR:CB_ALLOW_IN_PROT";
+ Pos = MAP_APPFONT ( 136 , 107 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ Text [ en-US ] = "Enable";
+ };
+ FixedLine FL_LAYOUT_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 133 ) ;
+ Size = MAP_APPFONT ( 118 , 8 ) ;
+ Text [ en-US ] = "Layout assistance";
+ };
+ CheckBox CB_MATH_BASELINE_ALIGNMENT
+ {
+ Pos = MAP_APPFONT ( 12 , 144 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "Math baseline alignment";
+ };
+};
+
+StringArray STR_PRINTOPTUI
+{
+ ItemList [en-US] =
+ {
+ < "%PRODUCTNAME %s"; >;
+ < "Contents"; >;
+ < "Page ba~ckground"; >;
+ < "P~ictures and other graphic objects"; >;
+ < "Hidden te~xt"; >;
+ < "~Text placeholders"; >;
+ < "Form control~s"; >;
+ < "Color"; >;
+ < "Print text in blac~k"; >;
+ < "Pages"; >;
+ < "Print ~automatically inserted blank pages"; >;
+ < "~Use only paper tray from printer preferences"; >;
+ < "Print"; >;
+ < "None (document only)"; >;
+ < "Comments only"; >;
+ < "Place at end of document"; >;
+ < "Place at end of page"; >;
+ < "~Comments"; >;
+ < "Page sides";>;
+ < "All pages"; >;
+ < "Back sides / left pages"; >;
+ < "Front sides / right pages"; >;
+ < "Include"; >;
+ < "Broch~ure"; >;
+ < "Left-to-right script"; >;
+ < "Right-to-left script"; >;
+ < "Range and copies"; >;
+ < "~All pages"; >;
+ < "Pa~ges"; >;
+ < "~Selection"; >;
+ };
+};
+
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
new file mode 100644
index 000000000000..b1f3bd899018
--- /dev/null
+++ b/sw/source/ui/config/optload.cxx
@@ -0,0 +1,977 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <tools/shl.hxx>
+#include <swtypes.hxx>
+#include <helpid.h>
+#include <uiitems.hxx>
+#include <modcfg.hxx>
+#include "swmodule.hxx"
+#include "usrpref.hxx"
+#include "wrtsh.hxx"
+#include "linkenum.hxx"
+#include <uitool.hxx>
+#include <view.hxx>
+
+#include "globals.hrc"
+#include "cmdid.h"
+
+#include "optload.hrc"
+#include "optload.hxx"
+#include <svx/dlgutil.hxx>
+#include <svx/htmlmode.hxx>
+#include <fldmgr.hxx>
+#include <poolfmt.hxx>
+#include <expfld.hxx>
+#include <caption.hxx>
+#include <com/sun/star/document/PrinterIndependentLayout.hpp>
+
+#include <svtools/insdlg.hxx>
+#include <sot/clsids.hxx>
+#include <unotools/configmgr.hxx>
+#include <docsh.hxx>
+#include <config.hrc>
+#include <SwStyleNameMapper.hxx>
+#include <numrule.hxx>
+#include <SwNodeNum.hxx>
+
+#include <doc.hxx>
+#include <svl/cjkoptions.hxx>
+
+using namespace ::com::sun::star;
+
+/* -----------------22.10.98 15:12-------------------
+ *
+ * --------------------------------------------------*/
+SwLoadOptPage::SwLoadOptPage( Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxTabPage( pParent, SW_RES( TP_OPTLOAD_PAGE ), rSet ),
+
+ aUpdateFL ( this, SW_RES( FL_UPDATE ) ),
+ aLinkFT ( this, SW_RES( FT_LINK ) ),
+ aAlwaysRB ( this, SW_RES( RB_ALWAYS ) ),
+ aRequestRB ( this, SW_RES( RB_REQUEST ) ),
+ aNeverRB ( this, SW_RES( RB_NEVER ) ),
+
+ aFieldFT ( this, SW_RES( FT_FIELD ) ),
+ aAutoUpdateFields ( this, SW_RES( CB_AUTO_UPDATE_FIELDS ) ),
+ aAutoUpdateCharts ( this, SW_RES( CB_AUTO_UPDATE_CHARTS ) ),
+
+ aSettingsFL ( this, SW_RES( FL_SETTINGS ) ),
+ aMetricFT ( this, SW_RES( FT_METRIC ) ),
+ aMetricLB ( this, SW_RES( LB_METRIC ) ),
+ aTabFT ( this, SW_RES( FT_TAB ) ),
+ aTabMF ( this, SW_RES( MF_TAB ) ),
+ aUseSquaredPageMode ( this, SW_RES( CB_USE_SQUARE_PAGE_MODE ) ),
+
+ pWrtShell ( NULL ),
+ bHTMLMode ( FALSE ),
+ nLastTab ( 0 ),
+ nOldLinkMode( MANUAL )
+
+{
+ FreeResource();
+
+ SvxStringArray aMetricArr( SW_RES( STR_ARR_METRIC ) );
+ for ( USHORT i = 0; i < aMetricArr.Count(); ++i )
+ {
+ String sMetric = aMetricArr.GetStringByPos( i );
+ FieldUnit eFUnit = (FieldUnit)aMetricArr.GetValue( i );
+
+ switch ( eFUnit )
+ {
+ case FUNIT_MM:
+ case FUNIT_CM:
+ case FUNIT_POINT:
+ case FUNIT_PICA:
+ case FUNIT_INCH:
+ {
+ // nur diese Metriken benutzen
+ USHORT nPos = aMetricLB.InsertEntry( sMetric );
+ aMetricLB.SetEntryData( nPos, (void*)(long)eFUnit );
+ }
+ default:; //prevent warning
+ }
+ }
+ aMetricLB.SetSelectHdl(LINK(this, SwLoadOptPage, MetricHdl));
+
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem )
+ && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON)
+ {
+ aTabFT.Hide();
+ aTabMF.Hide();
+ }
+
+ SvtCJKOptions aCJKOptions;
+ if(!aCJKOptions.IsAsianTypographyEnabled())
+ aUseSquaredPageMode.Hide();
+}
+
+/*-----------------18.01.97 12.43-------------------
+
+--------------------------------------------------*/
+
+SwLoadOptPage::~SwLoadOptPage()
+{
+}
+
+/*-----------------18.01.97 12.43-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* __EXPORT SwLoadOptPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return new SwLoadOptPage(pParent, rAttrSet );
+}
+
+/*-----------------18.01.97 12.42-------------------
+
+--------------------------------------------------*/
+
+BOOL __EXPORT SwLoadOptPage::FillItemSet( SfxItemSet& rSet )
+{
+ BOOL bRet = FALSE;
+ SwModule* pMod = SW_MOD();
+
+ USHORT nNewLinkMode = AUTOMATIC;
+ if (aNeverRB.IsChecked())
+ nNewLinkMode = NEVER;
+ else if (aRequestRB.IsChecked())
+ nNewLinkMode = MANUAL;
+
+ SwFldUpdateFlags eFldFlags = aAutoUpdateFields.IsChecked() ?
+ aAutoUpdateCharts.IsChecked() ? AUTOUPD_FIELD_AND_CHARTS : AUTOUPD_FIELD_ONLY : AUTOUPD_OFF;
+
+ if(aAutoUpdateFields.IsChecked() != aAutoUpdateFields.GetSavedValue() ||
+ aAutoUpdateCharts.IsChecked() != aAutoUpdateCharts.GetSavedValue())
+ {
+ pMod->ApplyFldUpdateFlags(eFldFlags);
+ if(pWrtShell)
+ {
+ pWrtShell->SetFldUpdateFlags(eFldFlags);
+ pWrtShell->SetModified();
+ }
+ }
+
+ if (nNewLinkMode != nOldLinkMode)
+ {
+ pMod->ApplyLinkMode(nNewLinkMode);
+ if (pWrtShell)
+ {
+ pWrtShell->SetLinkUpdMode( nNewLinkMode );
+ pWrtShell->SetModified();
+ }
+
+ bRet = TRUE;
+ }
+
+ const USHORT nMPos = aMetricLB.GetSelectEntryPos();
+ if ( nMPos != aMetricLB.GetSavedValue() )
+ {
+ // Doppel-Cast fuer VA3.0
+ USHORT nFieldUnit = (USHORT)(long)aMetricLB.GetEntryData( nMPos );
+ rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, (UINT16)nFieldUnit ) );
+ bRet = TRUE;
+ }
+
+ if(aTabMF.IsVisible() && aTabMF.GetText() != aTabMF.GetSavedValue())
+ {
+ rSet.Put(SfxUInt16Item(SID_ATTR_DEFTABSTOP,
+ (USHORT)aTabMF.Denormalize(aTabMF.GetValue(FUNIT_TWIP))));
+ bRet = TRUE;
+ }
+
+ sal_Bool bIsSquaredPageModeFlag = aUseSquaredPageMode.IsChecked();
+ if ( bIsSquaredPageModeFlag != aUseSquaredPageMode.GetSavedValue() )
+ {
+ pMod->ApplyDefaultPageMode( bIsSquaredPageModeFlag );
+ if ( pWrtShell )
+ {
+ SwDoc* pDoc = pWrtShell->GetDoc();
+ pDoc->SetDefaultPageMode( bIsSquaredPageModeFlag );
+ pWrtShell->SetModified();
+ }
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+/*-----------------18.01.97 12.42-------------------
+
+--------------------------------------------------*/
+void __EXPORT SwLoadOptPage::Reset( const SfxItemSet& rSet)
+{
+ const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref(FALSE);
+ const SfxPoolItem* pItem;
+
+ if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_WRTSHELL, FALSE, &pItem))
+ pWrtShell = (SwWrtShell*)((const SwPtrItem*)pItem)->GetValue();
+
+ SwFldUpdateFlags eFldFlags = AUTOUPD_GLOBALSETTING;
+ nOldLinkMode = GLOBALSETTING;
+ if (pWrtShell)
+ {
+ eFldFlags = pWrtShell->GetFldUpdateFlags(TRUE);
+ nOldLinkMode = pWrtShell->GetLinkUpdMode(TRUE);
+ }
+ if(GLOBALSETTING == nOldLinkMode)
+ nOldLinkMode = pUsrPref->GetUpdateLinkMode();
+ if(AUTOUPD_GLOBALSETTING == eFldFlags)
+ eFldFlags = pUsrPref->GetFldUpdateFlags();
+
+ aAutoUpdateFields.Check(eFldFlags != AUTOUPD_OFF);
+ aAutoUpdateCharts.Check(eFldFlags == AUTOUPD_FIELD_AND_CHARTS);
+
+ switch (nOldLinkMode)
+ {
+ case NEVER: aNeverRB.Check(); break;
+ case MANUAL: aRequestRB.Check(); break;
+ case AUTOMATIC: aAlwaysRB.Check(); break;
+ }
+
+ aAutoUpdateFields.SaveValue();
+ aAutoUpdateCharts.SaveValue();
+ aMetricLB.SetNoSelection();
+ if ( rSet.GetItemState( SID_ATTR_METRIC ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SfxUInt16Item& rItem = (SfxUInt16Item&)rSet.Get( SID_ATTR_METRIC );
+ FieldUnit eFieldUnit = (FieldUnit)rItem.GetValue();
+
+ for ( USHORT i = 0; i < aMetricLB.GetEntryCount(); ++i )
+ {
+ if ( (int)(sal_IntPtr)aMetricLB.GetEntryData( i ) == (int)eFieldUnit )
+ {
+ aMetricLB.SelectEntryPos( i );
+ break;
+ }
+ }
+ ::SetFieldUnit(aTabMF, eFieldUnit);
+ }
+ aMetricLB.SaveValue();
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP, FALSE, &pItem))
+ {
+ nLastTab = ((SfxUInt16Item*)pItem)->GetValue();
+ aTabMF.SetValue(aTabMF.Normalize(nLastTab), FUNIT_TWIP);
+ }
+ aTabMF.SaveValue();
+
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem))
+ {
+ bHTMLMode = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON);
+ }
+
+ //default page mode loading
+ if(pWrtShell)
+ {
+ sal_Bool bSquaredPageMode = pWrtShell->GetDoc()->IsSquaredPageMode();
+ aUseSquaredPageMode.Check( bSquaredPageMode );
+ aUseSquaredPageMode.SaveValue();
+ }
+}
+/*-----------------13.01.97 14.44-------------------
+ Metric des Deftabstops umschalten
+--------------------------------------------------*/
+
+IMPL_LINK(SwLoadOptPage, MetricHdl, ListBox*, EMPTYARG)
+{
+ const USHORT nMPos = aMetricLB.GetSelectEntryPos();
+ if(nMPos != USHRT_MAX)
+ {
+ // Doppel-Cast fuer VA3.0
+ FieldUnit eFieldUnit = (FieldUnit)(long)aMetricLB.GetEntryData( nMPos );
+ BOOL bModified = aTabMF.IsModified();
+ long nVal = bModified ?
+ sal::static_int_cast<sal_Int32, sal_Int64 >( aTabMF.Denormalize( aTabMF.GetValue( FUNIT_TWIP ) )) :
+ nLastTab;
+ ::SetFieldUnit( aTabMF, eFieldUnit );
+ aTabMF.SetValue( aTabMF.Normalize( nVal ), FUNIT_TWIP );
+ if(!bModified)
+ aTabMF.ClearModifyFlag();
+ }
+
+ return 0;
+}
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+IMPL_LINK(SwLoadOptPage, CaptionHdl, PushButton*, EMPTYARG)
+{
+ SwCaptionOptDlg aDlg(this, GetItemSet());
+ aDlg.Execute();
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwCaptionOptDlg::SwCaptionOptDlg(Window* pParent, const SfxItemSet& rSet) :
+ SfxSingleTabDialog(pParent, rSet, 0)
+{
+ // TabPage erzeugen
+ SetTabPage((SwCaptionOptPage*) SwCaptionOptPage::Create(this, rSet));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwCaptionOptDlg::~SwCaptionOptDlg()
+{
+}
+
+/* -----------------22.10.98 15:12-------------------
+ *
+ * --------------------------------------------------*/
+
+SwCaptionPreview::SwCaptionPreview( Window* pParent, const ResId& rResId )
+ : Window( pParent, rResId )
+{
+ maDrawPos = Point( 4, 6 );
+
+ Wallpaper aBack( GetSettings().GetStyleSettings().GetWindowColor() );
+ SetBackground( aBack );
+ SetFillColor( aBack.GetColor() );
+ SetLineColor( aBack.GetColor() );
+ SetBorderStyle( WINDOW_BORDER_MONO );
+ Font aFont(GetFont());
+ aFont.SetHeight(aFont.GetHeight() * 120 / 100 );
+ SetFont(aFont);
+}
+
+void SwCaptionPreview::SetPreviewText( const String& rText )
+{
+ if( rText != maText )
+ {
+ maText = rText;
+ Invalidate();
+ }
+}
+
+void SwCaptionPreview::Paint( const Rectangle& rRect )
+{
+ Window::Paint( rRect );
+
+ DrawRect( Rectangle( Point( 0, 0 ), GetSizePixel() ) );
+ DrawText( Point( 4, 6 ), maText );
+}
+
+
+SwCaptionOptPage::SwCaptionOptPage( Window* pParent, const SfxItemSet& rSet )
+ : SfxTabPage(pParent, SW_RES(TP_OPTCAPTION_PAGE), rSet),
+ aCheckFT (this, SW_RES(FT_OBJECTS )),
+ aCheckLB (this, SW_RES(CLB_OBJECTS )),
+ aFtCaptionOrder(this, SW_RES( FT_ORDER )),
+ aLbCaptionOrder(this, SW_RES( LB_ORDER )),
+ aPreview (this, SW_RES(WIN_PREVIEW )),
+ aSettingsGroupFL(this, SW_RES(FL_SETTINGS_2 )),
+ aCategoryText (this, SW_RES(TXT_CATEGORY )),
+ aCategoryBox (this, SW_RES(BOX_CATEGORY )),
+ aFormatText (this, SW_RES(TXT_FORMAT )),
+ aFormatBox (this, SW_RES(BOX_FORMAT )),
+ aNumberingSeparatorFT(this, SW_RES(FT_NUM_SEP )),
+ aNumberingSeparatorED(this, SW_RES(ED_NUM_SEP )),
+ aTextText (this, SW_RES(TXT_TEXT )),
+ aTextEdit (this, SW_RES(EDT_TEXT )),
+ aPosText (this, SW_RES(TXT_POS )),
+ aPosBox (this, SW_RES(BOX_POS )),
+ aNumCaptFL (this, SW_RES(FL_NUMCAPT )),
+ aFtLevel (this, SW_RES(FT_LEVEL )),
+ aLbLevel (this, SW_RES(LB_LEVEL )),
+ aFtDelim (this, SW_RES(FT_SEPARATOR )),
+ aEdDelim (this, SW_RES(ED_SEPARATOR )),
+ aCategoryFL (this, SW_RES(FL_CATEGORY )),
+ aCharStyleFT (this, SW_RES(FT_CHARSTYLE )),
+ aCharStyleLB (this, SW_RES(LB_CHARSTYLE )),
+ aApplyBorderCB (this, SW_RES(CB_APPLYBORDER)),
+
+ sSWTable (SW_RES(STR_TABLE )),
+ sSWFrame (SW_RES(STR_FRAME )),
+ sSWGraphic (SW_RES(STR_GRAPHIC )),
+ sOLE (SW_RES(STR_OLE )),
+
+ sBegin (SW_RESSTR(STR_BEGINNING )),
+ sEnd (SW_RESSTR(STR_END )),
+ sAbove (SW_RESSTR(STR_ABOVE )),
+ sBelow (SW_RESSTR(STR_CP_BELOW )),
+ sNone (SW_RESSTR( STR_CATEGORY_NONE )),
+
+ pMgr (new SwFldMgr()),
+ bHTMLMode(FALSE)
+{
+ Wallpaper aBack( GetSettings().GetStyleSettings().GetWindowColor() );
+ aPreview.SetBackground( aBack );
+
+ SwStyleNameMapper::FillUIName( RES_POOLCOLL_LABEL_ABB, sIllustration );
+ SwStyleNameMapper::FillUIName( RES_POOLCOLL_LABEL_TABLE, sTable );
+ SwStyleNameMapper::FillUIName( RES_POOLCOLL_LABEL_FRAME, sText );
+ SwStyleNameMapper::FillUIName( RES_POOLCOLL_LABEL_DRAWING, sDrawing );
+
+ USHORT i, nCount;
+ SwWrtShell *pSh = ::GetActiveWrtShell();
+
+ // aFormatBox
+ USHORT nSelFmt = SVX_NUM_ARABIC;
+ if (pSh)
+ {
+ nCount = pMgr->GetFldTypeCount();
+ SwFieldType* pFldType;
+ for ( i = nCount; i; )
+ if( ( pFldType = pMgr->GetFldType(USHRT_MAX, --i))->GetName() ==
+ aCategoryBox.GetText() )
+ {
+ nSelFmt = (USHORT)((SwSetExpFieldType*)pFldType)->GetSeqFormat();
+ break;
+ }
+
+ ::FillCharStyleListBox( aCharStyleLB, pSh->GetView().GetDocShell(), TRUE, TRUE );
+ }
+
+
+ nCount = pMgr->GetFormatCount(TYP_SEQFLD, FALSE);
+ for ( i = 0; i < nCount; ++i )
+ {
+ aFormatBox.InsertEntry( pMgr->GetFormatStr(TYP_SEQFLD, i) );
+ USHORT nFmtId = pMgr->GetFormatId(TYP_SEQFLD, i);
+ aFormatBox.SetEntryData( i, reinterpret_cast<void*>(nFmtId) );
+ if( nFmtId == nSelFmt )
+ aFormatBox.SelectEntryPos( i );
+ }
+
+ for (i = 0; i < MAXLEVEL; i++)
+ aLbLevel.InsertEntry(String::CreateFromInt32(i + 1));
+
+ sal_Unicode nLvl = MAXLEVEL;
+ String sDelim( String::CreateFromAscii( ": " ) );
+
+ if (pSh)
+ {
+ SwSetExpFieldType* pFldType = (SwSetExpFieldType*)pMgr->GetFldType(
+ RES_SETEXPFLD, aCategoryBox.GetText() );
+ if( pFldType )
+ {
+ sDelim = pFldType->GetDelimiter();
+ nLvl = pFldType->GetOutlineLvl();
+ }
+ }
+
+ aLbLevel.SelectEntryPos( nLvl < MAXLEVEL ? nLvl + 1 : 0 );
+ aEdDelim.SetText( sDelim );
+
+ aCheckLB.SetHelpId(HID_OPTCAPTION_CLB);
+
+ FreeResource();
+
+ Link aLk = LINK( this, SwCaptionOptPage, ModifyHdl );
+ aCategoryBox.SetModifyHdl( aLk );
+ aNumberingSeparatorED.SetModifyHdl( aLk );
+ aTextEdit .SetModifyHdl( aLk );
+
+ aLk = LINK(this, SwCaptionOptPage, SelectHdl);
+ aCategoryBox.SetSelectHdl( aLk );
+ aFormatBox .SetSelectHdl( aLk );
+
+ aLbCaptionOrder.SetSelectHdl( LINK(this, SwCaptionOptPage, OrderHdl));
+
+ aCheckLB.SetSelectHdl( LINK(this, SwCaptionOptPage, ShowEntryHdl) );
+ aCheckLB.SetCheckButtonHdl( LINK(this, SwCaptionOptPage, ShowEntryHdl) );
+ aCheckLB.SetDeselectHdl( LINK(this, SwCaptionOptPage, SaveEntryHdl) );
+}
+
+/*-----------------18.01.97 12.43-------------------
+
+--------------------------------------------------*/
+
+SwCaptionOptPage::~SwCaptionOptPage()
+{
+ DelUserData();
+ delete pMgr;
+}
+
+/*-----------------18.01.97 12.43-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* SwCaptionOptPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return new SwCaptionOptPage(pParent, rAttrSet );
+}
+
+/*-----------------18.01.97 12.42-------------------
+
+--------------------------------------------------*/
+
+BOOL SwCaptionOptPage::FillItemSet( SfxItemSet& )
+{
+ BOOL bRet = FALSE;
+ SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+
+ SaveEntry(aCheckLB.FirstSelected()); // Aktuellen Eintrag uebernehmen
+
+ SvLBoxEntry* pEntry = aCheckLB.First();
+
+ while (pEntry)
+ {
+ InsCaptionOpt* pData = (InsCaptionOpt*)pEntry->GetUserData();
+ bRet |= pModOpt->SetCapOption(bHTMLMode, pData);
+ pEntry = aCheckLB.Next(pEntry);
+ }
+
+ USHORT nCheckCount = aCheckLB.GetCheckedEntryCount();
+ pModOpt->SetInsWithCaption( bHTMLMode, nCheckCount > 0 );
+
+ sal_Int32 nPos = aLbCaptionOrder.GetSelectEntryPos();
+ pModOpt->SetCaptionOrderNumberingFirst(nPos == 1 ? sal_True : sal_False );
+
+ return bRet;
+}
+
+/*-----------------18.01.97 12.42-------------------
+
+--------------------------------------------------*/
+
+void SwCaptionOptPage::Reset( const SfxItemSet& rSet)
+{
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem))
+ {
+ bHTMLMode = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON);
+ }
+
+ DelUserData();
+ aCheckLB.GetModel()->Clear(); // remove all entries
+
+ // Writer objects
+ USHORT nPos = 0;
+ aCheckLB.InsertEntry(sSWTable);
+ SetOptions(nPos++, TABLE_CAP);
+ aCheckLB.InsertEntry(sSWFrame);
+ SetOptions(nPos++, FRAME_CAP);
+ aCheckLB.InsertEntry(sSWGraphic);
+ SetOptions(nPos++, GRAPHIC_CAP);
+
+ // get Productname and -version
+ String sComplete, sWithoutVersion;
+ ::rtl::OUString sTemp;
+ uno::Any aAny =
+ ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME );
+ if ( aAny >>= sTemp )
+ {
+ sComplete = sTemp;
+ sWithoutVersion = sTemp;
+ aAny = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTVERSION );
+ if ( !( aAny >>= sTemp ) )
+ {
+ DBG_ERRORFILE( "Couldn't get PRODUCTVERSION variable" );
+ }
+ else
+ {
+ sComplete += ' ';
+ sComplete += String( sTemp );
+ }
+ }
+ else
+ {
+ DBG_ERRORFILE( "Couldn't get PRODUCTNAME variable" );
+ }
+
+ SvObjectServerList aObjS;
+ aObjS.FillInsertObjects();
+ aObjS.Remove( SvGlobalName( SO3_SW_CLASSID ) ); // remove Writer-ID
+
+ for ( ULONG i = 0; i < aObjS.Count(); ++i )
+ {
+ const SvGlobalName &rOleId = aObjS[i].GetClassName();
+ const String* pClassName = &aObjS[i].GetHumanName();
+ if ( rOleId == SvGlobalName( SO3_OUT_CLASSID ) )
+ pClassName = &sOLE;
+ String sClass( *pClassName );
+ // don't show product version
+ sClass.SearchAndReplace( sComplete, sWithoutVersion );
+ aCheckLB.InsertEntry( sClass );
+ SetOptions( nPos++, OLE_CAP, &rOleId );
+ }
+ aLbCaptionOrder.SelectEntryPos(
+ SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst() ? 1 : 0);
+ ModifyHdl();
+}
+
+/*-----------------18.01.97 12.42-------------------
+
+--------------------------------------------------*/
+
+void SwCaptionOptPage::SetOptions(const USHORT nPos,
+ const SwCapObjType eObjType, const SvGlobalName *pOleId)
+{
+ SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+ const InsCaptionOpt* pOpt = pModOpt->GetCapOption(bHTMLMode, eObjType, pOleId);
+
+ if (pOpt)
+ {
+ aCheckLB.SetEntryData(nPos, new InsCaptionOpt(*pOpt));
+ aCheckLB.CheckEntryPos(nPos, pOpt->UseCaption());
+ }
+ else
+ aCheckLB.SetEntryData(nPos, new InsCaptionOpt(eObjType, pOleId));
+}
+
+/*-----------------18.01.97 12.42-------------------
+
+--------------------------------------------------*/
+
+void SwCaptionOptPage::DelUserData()
+{
+ SvLBoxEntry* pEntry = aCheckLB.First();
+
+ while (pEntry)
+ {
+ delete (InsCaptionOpt*)pEntry->GetUserData();
+ pEntry->SetUserData(0);
+ pEntry = aCheckLB.Next(pEntry);
+ }
+}
+
+/* -----------------26.10.98 11:06-------------------
+ *
+ * --------------------------------------------------*/
+
+IMPL_LINK( SwCaptionOptPage, ShowEntryHdl, SvxCheckListBox *, EMPTYARG )
+{
+ SvLBoxEntry* pSelEntry = aCheckLB.FirstSelected();
+
+ if (pSelEntry)
+ {
+ sal_Bool bChecked = aCheckLB.IsChecked((USHORT)aCheckLB.GetModel()->GetAbsPos(pSelEntry));
+
+ aSettingsGroupFL.Enable( bChecked );
+ aCategoryText.Enable( bChecked );
+ aCategoryBox.Enable( bChecked );
+ aFormatText.Enable( bChecked );
+ aFormatBox.Enable( bChecked );
+ sal_Bool bNumSep = bChecked && aLbCaptionOrder.GetSelectEntryPos() == 1;
+ aNumberingSeparatorED.Enable( bNumSep );
+ aNumberingSeparatorFT.Enable( bNumSep );
+ aTextText.Enable( bChecked );
+ aTextEdit.Enable( bChecked );
+ aPosText.Enable( bChecked );
+ aPosBox.Enable( bChecked );
+ aNumCaptFL.Enable( bChecked );
+ aFtLevel.Enable( bChecked );
+ aLbLevel.Enable( bChecked );
+ aFtDelim.Enable( bChecked );
+ aEdDelim.Enable( bChecked );
+ aCategoryFL.Enable( bChecked );
+ aCharStyleFT.Enable( bChecked );
+ aCharStyleLB.Enable( bChecked );
+ aApplyBorderCB.Enable( bChecked );
+ aPreview.Enable( bChecked );
+
+ SwWrtShell *pSh = ::GetActiveWrtShell();
+
+ InsCaptionOpt* pOpt = (InsCaptionOpt*)pSelEntry->GetUserData();
+
+ aCategoryBox.Clear();
+ aCategoryBox.InsertEntry( sNone );
+ if (pSh)
+ {
+ USHORT nCount = pMgr->GetFldTypeCount();
+
+ for (USHORT i = 0; i < nCount; i++)
+ {
+ SwFieldType *pType = pMgr->GetFldType( USHRT_MAX, i );
+ if( pType->Which() == RES_SETEXPFLD &&
+ ((SwSetExpFieldType *) pType)->GetType() & nsSwGetSetExpType::GSE_SEQ )
+ aCategoryBox.InsertEntry(SwBoxEntry(pType->GetName()));
+ }
+ }
+ else
+ {
+ aCategoryBox.InsertEntry(SwBoxEntry(sIllustration));
+ aCategoryBox.InsertEntry(SwBoxEntry(sTable));
+ aCategoryBox.InsertEntry(SwBoxEntry(sText));
+ aCategoryBox.InsertEntry(SwBoxEntry(sDrawing));
+ }
+
+ if(pOpt->GetCategory().Len())
+ aCategoryBox.SetText(pOpt->GetCategory());
+ else
+ aCategoryBox.SetText( sNone );
+ if (pOpt->GetCategory().Len() &&
+ aCategoryBox.GetEntryPos(pOpt->GetCategory()) == COMBOBOX_ENTRY_NOTFOUND)
+ aCategoryBox.InsertEntry(pOpt->GetCategory());
+ if (!aCategoryBox.GetText().Len())
+ {
+ USHORT nPos = 0;
+ switch(pOpt->GetObjType())
+ {
+ case OLE_CAP:
+ case GRAPHIC_CAP: nPos = 1; break;
+ case TABLE_CAP: nPos = 2; break;
+ case FRAME_CAP: nPos = 3; break;
+ }
+ aCategoryBox.SetText(aCategoryBox.GetEntry(nPos).GetName());
+ }
+
+ for (USHORT i = 0; i < aFormatBox.GetEntryCount(); i++)
+ {
+ if (pOpt->GetNumType() == (USHORT)(ULONG)aFormatBox.GetEntryData(i))
+ {
+ aFormatBox.SelectEntryPos(i);
+ break;
+ }
+ }
+ aTextEdit.SetText(pOpt->GetCaption());
+
+ aPosBox.Clear();
+ switch (pOpt->GetObjType())
+ {
+ case GRAPHIC_CAP:
+ case TABLE_CAP:
+ case OLE_CAP:
+ aPosBox.InsertEntry(sAbove);
+ aPosBox.InsertEntry(sBelow);
+ break;
+ case FRAME_CAP:
+ aPosBox.InsertEntry(sBegin);
+ aPosBox.InsertEntry(sEnd);
+ break;
+ }
+ aPosBox.SelectEntryPos(pOpt->GetPos());
+ aPosBox.Enable( pOpt->GetObjType() != GRAPHIC_CAP &&
+ pOpt->GetObjType() != OLE_CAP &&
+ aPosText.IsEnabled() );
+ aPosBox.SelectEntryPos(pOpt->GetPos());
+
+ USHORT nLevelPos = ( pOpt->GetLevel() < MAXLEVEL ) ? pOpt->GetLevel() + 1 : 0;
+ aLbLevel.SelectEntryPos( nLevelPos );
+ aEdDelim.SetText(pOpt->GetSeparator());
+ aNumberingSeparatorED.SetText( pOpt->GetNumSeparator() );
+ if(pOpt->GetCharacterStyle().Len())
+ aCharStyleLB.SelectEntry( pOpt->GetCharacterStyle() );
+ else
+ aCharStyleLB.SelectEntryPos( 0 );
+ aApplyBorderCB.Enable( aCategoryBox.IsEnabled() &&
+ pOpt->GetObjType() != TABLE_CAP && pOpt->GetObjType() != FRAME_CAP );
+ aApplyBorderCB.Check( pOpt->CopyAttributes() );
+ }
+
+ ModifyHdl();
+
+ return 0;
+}
+
+/* -----------------26.10.98 11:06-------------------
+ *
+ * --------------------------------------------------*/
+
+IMPL_LINK( SwCaptionOptPage, SaveEntryHdl, SvxCheckListBox *, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = aCheckLB.GetHdlEntry();
+
+ if (pEntry) // Alles speichern
+ SaveEntry(pEntry);
+
+ return 0;
+}
+
+/* -----------------05.11.98 16:23-------------------
+ *
+ * --------------------------------------------------*/
+
+void SwCaptionOptPage::SaveEntry(SvLBoxEntry* pEntry)
+{
+ if (pEntry)
+ {
+ InsCaptionOpt* pOpt = (InsCaptionOpt*)pEntry->GetUserData();
+
+ pOpt->UseCaption() = aCheckLB.IsChecked((USHORT)aCheckLB.GetModel()->GetAbsPos(pEntry));
+ String aName( aCategoryBox.GetText() );
+ if(aName == sNone)
+ pOpt->SetCategory(aEmptyStr);
+ else
+ {
+ aName.EraseLeadingChars (' ');
+ aName.EraseTrailingChars(' ');
+ pOpt->SetCategory(aName);
+ }
+ pOpt->SetNumType((USHORT)(ULONG)aFormatBox.GetEntryData(aFormatBox.GetSelectEntryPos()));
+ pOpt->SetCaption(aTextEdit.IsEnabled() ? aTextEdit.GetText() : aEmptyStr );
+ pOpt->SetPos(aPosBox.GetSelectEntryPos());
+ USHORT nPos = aLbLevel.GetSelectEntryPos();
+ USHORT nLevel = ( nPos > 0 && nPos != LISTBOX_ENTRY_NOTFOUND ) ? nPos - 1 : MAXLEVEL;
+ pOpt->SetLevel(nLevel);
+ pOpt->SetSeparator(aEdDelim.GetText());
+ pOpt->SetNumSeparator( aNumberingSeparatorED.GetText());
+ if(!aCharStyleLB.GetSelectEntryPos())
+ pOpt->SetCharacterStyle(aEmptyStr);
+ else
+ pOpt->SetCharacterStyle(aCharStyleLB.GetSelectEntry());
+ pOpt->CopyAttributes() = aApplyBorderCB.IsChecked();
+ }
+}
+
+/* -----------------26.10.98 11:06-------------------
+ *
+ * --------------------------------------------------*/
+
+IMPL_LINK( SwCaptionOptPage, ModifyHdl, Edit *, EMPTYARG )
+{
+ String sFldTypeName = aCategoryBox.GetText();
+/*
+ SwFieldType* pType = sFldTypeName.Len() ? pMgr->GetFldType(RES_SETEXPFLD, sFldTypeName) : 0;
+
+ ((SfxSingleTabDialog*)GetParent())->GetOKButton()->Enable( (!pType || ((SwSetExpFieldType*)pType)->GetType() == GSE_SEQ)
+ && sFldTypeName.Len() != 0 );
+*/
+ SfxSingleTabDialog *pDlg = (SfxSingleTabDialog *)GetParent();
+ PushButton *pBtn = pDlg->GetOKButton();
+ if (pBtn)
+ pBtn->Enable(sFldTypeName.Len() != 0);
+ sal_Bool bEnable = aCategoryBox.IsEnabled() && sFldTypeName != sNone;
+
+ aFormatText.Enable(bEnable);
+ aFormatBox.Enable(bEnable);
+ aTextText.Enable(bEnable);
+ aTextEdit.Enable(bEnable);
+
+ DrawSample();
+ return 0;
+}
+
+/* -----------------26.10.98 10:58-------------------
+ *
+ * --------------------------------------------------*/
+
+IMPL_LINK_INLINE_START( SwCaptionOptPage, SelectHdl, ListBox *, EMPTYARG )
+{
+ DrawSample();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwCaptionOptPage, SelectHdl, ListBox *, EMPTYARG )
+/*-- 02.11.2007 10:00:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwCaptionOptPage, OrderHdl, ListBox*, pBox )
+{
+ DrawSample();
+ sal_Int32 nPos = pBox->GetSelectEntryPos();
+ aNumberingSeparatorFT.Enable( nPos == 1 );
+ aNumberingSeparatorED.Enable( nPos == 1 );
+ return 0;
+}
+/* -----------------26.10.98 10:58-------------------
+ *
+ * --------------------------------------------------*/
+
+void SwCaptionOptPage::DrawSample()
+{
+ String aStr;
+
+ if( aCategoryBox.GetText() != sNone)
+ {
+ //#i61007# order of captions
+ bool bOrderNumberingFirst = aLbCaptionOrder.GetSelectEntryPos() == 1;
+ // Nummer
+ USHORT nNumFmt = (USHORT)(ULONG)aFormatBox.GetEntryData(
+ aFormatBox.GetSelectEntryPos() );
+ if( SVX_NUM_NUMBER_NONE != nNumFmt )
+ {
+ //#i61007# order of captions
+ if( !bOrderNumberingFirst )
+ {
+ // Kategorie
+ aStr += aCategoryBox.GetText();
+ aStr += ' ';
+ }
+
+ SwWrtShell *pSh = ::GetActiveWrtShell();
+ String sFldTypeName( aCategoryBox.GetText() );
+ if (pSh)
+ {
+ SwSetExpFieldType* pFldType = (SwSetExpFieldType*)pMgr->GetFldType(
+ RES_SETEXPFLD, sFldTypeName );
+ if( pFldType && pFldType->GetOutlineLvl() < MAXLEVEL )
+ {
+ BYTE nLvl = pFldType->GetOutlineLvl();
+ SwNumberTree::tNumberVector aNumVector;
+ for( BYTE i = 0; i <= nLvl; ++i )
+ aNumVector.push_back(1);
+
+ String sNumber( pSh->GetOutlineNumRule()->MakeNumString(
+ aNumVector, FALSE ));
+ if( sNumber.Len() )
+ (aStr += sNumber) += pFldType->GetDelimiter();
+ }
+ }
+
+ switch( nNumFmt )
+ {
+ case SVX_NUM_CHARS_UPPER_LETTER: aStr += 'A'; break;
+ case SVX_NUM_CHARS_UPPER_LETTER_N: aStr += 'A'; break;
+ case SVX_NUM_CHARS_LOWER_LETTER: aStr += 'a'; break;
+ case SVX_NUM_CHARS_LOWER_LETTER_N: aStr += 'a'; break;
+ case SVX_NUM_ROMAN_UPPER: aStr += 'I'; break;
+ case SVX_NUM_ROMAN_LOWER: aStr += 'i'; break;
+ //case ARABIC:
+ default: aStr += '1'; break;
+ }
+ }
+ //#i61007# order of captions
+ if( bOrderNumberingFirst )
+ {
+ aStr += aNumberingSeparatorED.GetText();
+ aStr += aCategoryBox.GetText();
+ }
+ aStr += aTextEdit.GetText();
+ }
+ aPreview.SetPreviewText( aStr );
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: ComboBox ohne Spaces
+------------------------------------------------------------------------*/
+
+void CaptionComboBox::KeyInput(const KeyEvent& rEvt)
+{
+ if( rEvt.GetKeyCode().GetCode() != KEY_SPACE )
+ SwComboBox::KeyInput(rEvt);
+}
+
+
+
diff --git a/sw/source/ui/config/optload.hrc b/sw/source/ui/config/optload.hrc
new file mode 100644
index 000000000000..b396b2d9f9f0
--- /dev/null
+++ b/sw/source/ui/config/optload.hrc
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// SwLoadOptPage --------------------------------
+
+#define FL_UPDATE 10
+#define FT_LINK 11
+#define RB_ALWAYS 12
+#define RB_REQUEST 13
+#define RB_NEVER 14
+#define FT_FIELD 15
+#define CB_AUTO_UPDATE_FIELDS 16
+#define CB_AUTO_UPDATE_CHARTS 17
+#define FL_SETTINGS 18
+#define LB_METRIC 19
+#define FT_METRIC 20
+#define FT_TAB 21
+#define MF_TAB 22
+#define CB_USE_SQUARE_PAGE_MODE 23
+
+// SwCaptionOptPage -----------------------------
+
+#define FT_OBJECTS 10
+#define CLB_OBJECTS 11
+#define FL_SETTINGS_2 12
+#define TXT_CATEGORY 13
+#define BOX_CATEGORY 14
+#define TXT_FORMAT 15
+#define BOX_FORMAT 16
+#define TXT_TEXT 17
+#define EDT_TEXT 18
+#define TXT_POS 19
+#define BOX_POS 20
+#define FL_NUMCAPT 21
+#define FT_LEVEL 22
+#define LB_LEVEL 23
+#define FT_SEPARATOR 24
+#define ED_SEPARATOR 25
+#define FL_CATEGORY 26
+#define FT_CHARSTYLE 27
+#define LB_CHARSTYLE 28
+#define CB_APPLYBORDER 29
+#define WIN_PREVIEW 30
+#define STR_CATEGORY_NONE 31
+#define LB_ORDER 32
+#define FT_ORDER 33
+#define FT_NUM_SEP 34
+#define ED_NUM_SEP 35
+
+#define STR_TABLE 10
+#define STR_FRAME 11
+#define STR_GRAPHIC 12
+#define STR_OLE 13
+#define STR_BEGINNING 14
+#define STR_END 15
+#define STR_ABOVE 16
+#define STR_CP_BELOW 17
+
diff --git a/sw/source/ui/config/optload.src b/sw/source/ui/config/optload.src
new file mode 100644
index 000000000000..be6473632b56
--- /dev/null
+++ b/sw/source/ui/config/optload.src
@@ -0,0 +1,417 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "optload.hrc"
+#include "helpid.h"
+#include "config.hrc"
+
+/**************************************************************************/
+/* */
+/**************************************************************************/
+
+TabPage TP_OPTLOAD_PAGE
+{
+ HelpID = HID_OPTLOAD_PAGE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_UPDATE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Update";
+ };
+ FixedText FT_LINK
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 115 , 8 ) ;
+ Text [ en-US ] = "Update links when loading";
+ };
+ RadioButton RB_ALWAYS
+ {
+ HelpID = "sw:RadioButton:TP_OPTLOAD_PAGE:RB_ALWAYS";
+ Pos = MAP_APPFONT ( 18 , 26 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Always";
+ };
+ RadioButton RB_REQUEST
+ {
+ HelpID = "sw:RadioButton:TP_OPTLOAD_PAGE:RB_REQUEST";
+ Pos = MAP_APPFONT ( 18 , 39 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~On request";
+ };
+ RadioButton RB_NEVER
+ {
+ HelpID = "sw:RadioButton:TP_OPTLOAD_PAGE:RB_NEVER";
+ Pos = MAP_APPFONT ( 18 , 52 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Never";
+ };
+ FixedText FT_FIELD
+ {
+ Pos = MAP_APPFONT ( 130 , 14 ) ;
+ Size = MAP_APPFONT ( 124 , 8 ) ;
+ Text [ en-US ] = "Automatically";
+ };
+ CheckBox CB_AUTO_UPDATE_FIELDS
+ {
+ HelpID = "sw:CheckBox:TP_OPTLOAD_PAGE:CB_AUTO_UPDATE_FIELDS";
+ Pos = MAP_APPFONT ( 136 , 26) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "~Fields";
+ };
+ CheckBox CB_AUTO_UPDATE_CHARTS
+ {
+ HelpID = "sw:CheckBox:TP_OPTLOAD_PAGE:CB_AUTO_UPDATE_CHARTS";
+ Pos = MAP_APPFONT ( 136 , 39) ;
+ Size = MAP_APPFONT ( 109 , 10 ) ;
+ Text [ en-US ] = "~Charts";
+ };
+ FixedLine FL_SETTINGS
+ {
+ Pos = MAP_APPFONT ( 6 , 66 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Settings";
+ };
+ FixedText FT_METRIC
+ {
+ Pos = MAP_APPFONT ( 12 , 79 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Measurement unit";
+ };
+ ListBox LB_METRIC
+ {
+ HelpID = "sw:ListBox:TP_OPTLOAD_PAGE:LB_METRIC";
+ Pos = MAP_APPFONT ( 130, 77 ) ;
+ Size = MAP_APPFONT ( 50 , 50 ) ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_TAB
+ {
+ Pos = MAP_APPFONT ( 12 , 95 ) ;
+ Size = MAP_APPFONT ( 73 , 8 ) ;
+ Text [ en-US ] = "Tab stops";
+ Group = TRUE ;
+ };
+ MetricField MF_TAB
+ {
+ HelpID = "sw:MetricField:TP_OPTLOAD_PAGE:MF_TAB";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 130 , 93 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ SpinSize = 10 ;
+ Minimum = 50 ;
+ Maximum = 9999 ;
+ First = 50 ;
+ Last = 9999 ;
+ };
+ CheckBox CB_USE_SQUARE_PAGE_MODE
+ {
+ HelpID = "sw:CheckBox:TP_OPTLOAD_PAGE:CB_USE_SQUARE_PAGE_MODE";
+ Pos = MAP_APPFONT ( 12 , 111) ;
+ Size = MAP_APPFONT ( 248 , 10 ) ;
+ Text [ en-US ] = "Use square page mode for text grid";
+ Text [ zh-CN ] = "使用稿纸模å¼";
+ };
+};
+/**************************************************************************/
+/* */
+/**************************************************************************/
+
+TabPage TP_OPTCAPTION_PAGE
+{
+ HelpID = HID_OPTCAPTION_PAGE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Caption" ;
+
+ FixedText FT_OBJECTS
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 106 , 20 ) ;
+ WordBreak = TRUE ;
+ Text [ en-US ] = "Add captions automatically\nwhen inserting:" ;
+ };
+ Control CLB_OBJECTS
+ {
+ Pos = MAP_APPFONT ( 6 , 29 ) ;
+ Size = MAP_APPFONT ( 106 , 97 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_ORDER
+ {
+ Pos = MAP_APPFONT ( 6 , 130 ) ;
+ Size = MAP_APPFONT ( 106 , 8 ) ;
+ Text [ en-US ] = "Caption order" ;
+ };
+ ListBox LB_ORDER
+ {
+ HelpID = "sw:ListBox:TP_OPTCAPTION_PAGE:LB_ORDER";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 141 ) ;
+ Size = MAP_APPFONT ( 106 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Category first" ; > ;
+ < "Numbering first" ; > ;
+ };
+ };
+ Window WIN_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 6 , 159 ) ;
+ Size = MAP_APPFONT ( 106 , 20 ) ;
+ Border = TRUE;
+ };
+ String STR_TABLE
+ {
+ Text [ en-US ] = "%PRODUCTNAME Writer Table";
+ };
+ String STR_FRAME
+ {
+ Text [ en-US ] = "%PRODUCTNAME Writer Frame";
+ };
+ String STR_GRAPHIC
+ {
+ Text [ en-US ] = "%PRODUCTNAME Writer Picture";
+ };
+ String STR_OLE
+ {
+ Text [ en-US ] = "Other OLE Objects";
+ };
+
+ FixedLine FL_SETTINGS_2
+ {
+ Pos = MAP_APPFONT ( 118 , 3 ) ;
+ Size = MAP_APPFONT ( 136 , 8 ) ;
+ Text [ en-US ] = "Caption" ;
+ };
+ FixedText TXT_CATEGORY
+ {
+ Pos = MAP_APPFONT ( 125 , 16 ) ;
+ Size = MAP_APPFONT ( 59 , 10 ) ;
+ Text [ en-US ] = "Category" ;
+ Left = TRUE ;
+ };
+ ComboBox BOX_CATEGORY
+ {
+ HelpID = "sw:ComboBox:TP_OPTCAPTION_PAGE:BOX_CATEGORY";
+ Pos = MAP_APPFONT ( 189 , 14 ) ;
+ Size = MAP_APPFONT ( 59 , 61 ) ;
+ DropDown = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText TXT_FORMAT
+ {
+ Pos = MAP_APPFONT ( 125 , 31 ) ;
+ Size = MAP_APPFONT ( 59 , 10 ) ;
+ Text [ en-US ] = "~Numbering" ;
+ Left = TRUE ;
+ };
+ ListBox BOX_FORMAT
+ {
+ HelpID = "sw:ListBox:TP_OPTCAPTION_PAGE:BOX_FORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 189 , 29 ) ;
+ Size = MAP_APPFONT ( 59 , 61 ) ;
+ DropDown = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_NUM_SEP
+ {
+ Pos = MAP_APPFONT ( 125 , 46 ) ;
+ Size = MAP_APPFONT ( 61 , 8 ) ;
+ Text [ en-US ] = "Numbering separator" ;
+ Left = TRUE ;
+ };
+ Edit ED_NUM_SEP
+ {
+ HelpID = "sw:Edit:TP_OPTCAPTION_PAGE:ED_NUM_SEP";
+ Pos = MAP_APPFONT ( 189 , 44 ) ;
+ Size = MAP_APPFONT ( 59 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Text = ". " ;
+ };
+ FixedText TXT_TEXT
+ {
+ Pos = MAP_APPFONT ( 125 , 60 ) ;
+ Size = MAP_APPFONT ( 59 , 10 ) ;
+ Text [ en-US ] = "Separator" ;
+ Left = TRUE ;
+ };
+ Edit EDT_TEXT
+ {
+ HelpID = "sw:Edit:TP_OPTCAPTION_PAGE:EDT_TEXT";
+ Pos = MAP_APPFONT ( 189 , 59 ) ;
+ Size = MAP_APPFONT ( 59 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText TXT_POS
+ {
+ Pos = MAP_APPFONT ( 125 , 75 ) ;
+ Size = MAP_APPFONT ( 59 , 10 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Position" ;
+ };
+ ListBox BOX_POS
+ {
+ HelpID = "sw:ListBox:TP_OPTCAPTION_PAGE:BOX_POS";
+ Pos = MAP_APPFONT ( 189 , 74 ) ;
+ Size = MAP_APPFONT ( 59 , 61 ) ;
+ DropDown = TRUE ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+
+ FixedLine FL_NUMCAPT
+ {
+ Pos = MAP_APPFONT ( 118 , 89 ) ;
+ Size = MAP_APPFONT ( 136 , 8 ) ;
+ Text [ en-US ] = "Numbering captions by chapter" ;
+ };
+ FixedText FT_LEVEL
+ {
+ Pos = MAP_APPFONT ( 125 , 102 ) ;
+ Size = MAP_APPFONT ( 59 , 10 ) ;
+ Text [ en-US ] = "Level" ;
+ };
+ ListBox LB_LEVEL
+ {
+ HelpID = "sw:ListBox:TP_OPTCAPTION_PAGE:LB_LEVEL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 189 , 100 ) ;
+ Size = MAP_APPFONT ( 59 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "None" ; > ;
+ };
+ };
+ FixedText FT_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 125 , 117 ) ;
+ Size = MAP_APPFONT ( 59 , 10 ) ;
+ Text [ en-US ] = "Separator" ;
+ };
+ Edit ED_SEPARATOR
+ {
+ HelpID = "sw:Edit:TP_OPTCAPTION_PAGE:ED_SEPARATOR";
+ Pos = MAP_APPFONT ( 189 , 115 ) ;
+ Size = MAP_APPFONT ( 59 , 12 ) ;
+ Border = TRUE ;
+ MaxTextLength = 1 ;
+ TEXT = "." ;
+ };
+ FixedLine FL_CATEGORY
+ {
+ Pos = MAP_APPFONT ( 118 , 130 ) ;
+ Size = MAP_APPFONT ( 136 , 8 ) ;
+ Text [ en-US ] = "Category and frame format" ;
+ };
+ FixedText FT_CHARSTYLE
+ {
+ Pos = MAP_APPFONT ( 125 , 143 ) ;
+ Size = MAP_APPFONT ( 59 , 10 ) ;
+ Text [ en-US ] = "Character style" ;
+ };
+ ListBox LB_CHARSTYLE
+ {
+ HelpID = "sw:ListBox:TP_OPTCAPTION_PAGE:LB_CHARSTYLE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 189 , 141 ) ;
+ Size = MAP_APPFONT ( 59 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "None" ; > ;
+ };
+ };
+ CheckBox CB_APPLYBORDER
+ {
+ HelpID = "sw:CheckBox:TP_OPTCAPTION_PAGE:CB_APPLYBORDER";
+ Pos = MAP_APPFONT ( 125 , 158 ) ;
+ Size = MAP_APPFONT ( 124 , 10 ) ;
+ Text [ en-US ] = "Apply border and shadow" ;
+ };
+
+ String STR_BEGINNING
+ {
+ Text [ en-US ] = "At the beginning" ;
+ };
+ String STR_END
+ {
+ Text [ en-US ] = "At the end" ;
+ };
+ String STR_ABOVE
+ {
+ Text [ en-US ] = "Above" ;
+ };
+ String STR_CP_BELOW
+ {
+ Text [ en-US ] = "Below" ;
+ };
+ String STR_CATEGORY_NONE
+ {
+ Text [ en-US ] = "<None>" ;
+ };
+};
+
+StringArray STR_ARR_METRIC
+{
+ ItemList [ en-US ] =
+ {
+ < "Millimeter" ; FUNIT_MM ; > ;
+ < "Centimeter" ; FUNIT_CM ; > ;
+ < "Meter" ; FUNIT_M ; > ;
+ < "Kilometer" ; FUNIT_KM ; > ;
+ < "Inch" ; FUNIT_INCH ; > ;
+ < "Foot" ; FUNIT_FOOT ; > ;
+ < "Miles" ; FUNIT_MILE ; > ;
+ < "Pica" ; FUNIT_PICA ; > ;
+ < "Point" ; FUNIT_POINT ; > ;
+ };
+};
+
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
new file mode 100644
index 000000000000..01ef0a4f7500
--- /dev/null
+++ b/sw/source/ui/config/optpage.cxx
@@ -0,0 +1,2610 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#endif
+
+#include <optpage.hxx>
+#include <doc.hxx>
+#include <hintids.hxx>
+#include <cmdid.h>
+#include <fmtcol.hxx>
+#include <charatr.hxx>
+#include <swtypes.hxx>
+#include <view.hxx>
+#include <docsh.hxx>
+#include <IDocumentDeviceAccess.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <uitool.hxx>
+#include <cfgitems.hxx>
+#include <poolfmt.hxx>
+#include <uiitems.hxx>
+#include <initui.hxx>
+#include <printdata.hxx>
+#include <modcfg.hxx>
+#include <srcview.hxx>
+#include <crstate.hxx>
+#include <viewopt.hxx>
+#include <globals.hrc>
+#include <config.hrc>
+#include <redlopt.hrc>
+#include <optdlg.hrc>
+#include <swwrtshitem.hxx>
+#include <unomid.h>
+
+#include <editeng/fhgtitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/langitem.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/bindings.hxx>
+#include <svl/slstitm.hxx>
+#include <svl/ctloptions.hxx>
+#include <svl/eitem.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svtools/ctrltool.hxx>
+#include <svx/htmlmode.hxx>
+#include <svx/xtable.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/strarray.hxx>
+#include <vcl/svapp.hxx>
+
+
+
+using namespace ::com::sun::star;
+
+
+/*******************************************************
+ ******************************************************/
+
+/*-----------------31.08.96 10.16-------------------
+ TabPage Anzeige/Inhalt
+--------------------------------------------------*/
+
+SwContentOptPage::SwContentOptPage( Window* pParent,
+ const SfxItemSet& rCoreSet ) :
+ SfxTabPage( pParent, SW_RES( TP_CONTENT_OPT ), rCoreSet ),
+ aLineFL ( this, SW_RES( FL_LINE ) ),
+ aCrossCB ( this, SW_RES( CB_CROSS ) ),
+ aSolidHandleCB( this, SW_RES( CB_HANDLE ) ),
+ aBigHandleCB ( this, SW_RES( CB_BIGHANDLE) ),
+
+ aWindowFL ( this, SW_RES( FL_WINDOW ) ),
+ aHScrollBox ( this, SW_RES( CB_HSCROLL ) ),
+ aVScrollBox ( this, SW_RES( CB_VSCROLL ) ),
+ aAnyRulerCB ( this, SW_RES( CB_ANY_RULER ) ),
+ aHRulerCBox ( this, SW_RES( CB_HRULER ) ),
+ aHMetric ( this, SW_RES( LB_HMETRIC ) ),
+ aVRulerCBox ( this, SW_RES( CB_VRULER ) ),
+ aVRulerRightCBox( this, SW_RES( CB_VRULER_RIGHT ) ),
+ aVMetric ( this, SW_RES( LB_VMETRIC ) ),
+ aSmoothCBox ( this, SW_RES( CB_SMOOTH_SCROLL ) ),
+
+ aDispFL ( this, SW_RES( FL_DISP ) ),
+ aGrfCB ( this, SW_RES( CB_GRF ) ),
+ aTblCB ( this, SW_RES( CB_TBL ) ),
+ aDrwCB ( this, SW_RES( CB_DRWFAST ) ),
+ aFldNameCB ( this, SW_RES( CB_FIELD ) ),
+ aPostItCB ( this, SW_RES( CB_POSTIT ) ),
+
+ aSettingsFL ( this, SW_RES( FL_SETTINGS ) ),
+ aMetricFT ( this, SW_RES( FT_METRIC ) ),
+ aMetricLB ( this, SW_RES( LB_METRIC ) )
+{
+ FreeResource();
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_HTML_MODE, FALSE, &pItem )
+ && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON)
+ {
+ aMetricLB.Show();
+ aSettingsFL.Show();
+ aMetricFT.Show();
+ }
+ SvtCJKOptions aCJKOptions;
+ if(aCJKOptions.IsVerticalTextEnabled() )
+ {
+ Point aSmoothPos(aSmoothCBox.GetPosPixel());
+ aSmoothPos.Y() += aSmoothPos.Y() - aVRulerCBox.GetPosPixel().Y();
+ aSmoothCBox.SetPosPixel(aSmoothPos);
+ }
+ else
+ aVRulerRightCBox.Hide();
+ aVRulerCBox.SetClickHdl(LINK(this, SwContentOptPage, VertRulerHdl ));
+ aAnyRulerCB.SetClickHdl(LINK(this, SwContentOptPage, AnyRulerHdl));
+
+ SvxStringArray aMetricArr( SW_RES( STR_ARR_METRIC ) );
+ for ( USHORT i = 0; i < aMetricArr.Count(); ++i )
+ {
+ String sMetric = aMetricArr.GetStringByPos( i );
+ FieldUnit eFUnit = (FieldUnit)aMetricArr.GetValue( i );
+
+ switch ( eFUnit )
+ {
+ case FUNIT_MM:
+ case FUNIT_CM:
+ case FUNIT_POINT:
+ case FUNIT_PICA:
+ case FUNIT_INCH:
+ {
+ // nur diese Metriken benutzen
+ USHORT nPos = aMetricLB.InsertEntry( sMetric );
+ aMetricLB.SetEntryData( nPos, (void*)(long)eFUnit );
+ aVMetric.InsertEntry( sMetric );
+ aVMetric.SetEntryData( nPos, (void*)(long)eFUnit );
+ aHMetric.InsertEntry( sMetric );
+ aHMetric.SetEntryData( nPos, (void*)(long)eFUnit );
+ }
+ default:;//prevent warning
+ }
+ }
+}
+
+/*-----------------31.08.96 13.58-------------------
+
+--------------------------------------------------*/
+SwContentOptPage::~SwContentOptPage()
+{
+}
+
+/*-----------------31.08.96 13.58-------------------
+
+--------------------------------------------------*/
+SfxTabPage* SwContentOptPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SwContentOptPage(pParent, rAttrSet);
+}
+/* -----------------------------07.04.01 16:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static void lcl_SelectMetricLB(ListBox& rMetric, USHORT nSID, const SfxItemSet& rSet)
+{
+ const SfxPoolItem* pItem;
+ if( rSet.GetItemState( nSID, FALSE, &pItem ) >= SFX_ITEM_AVAILABLE )
+ {
+ FieldUnit eFieldUnit = (FieldUnit)((SfxUInt16Item*)pItem)->GetValue();
+ for ( USHORT i = 0; i < rMetric.GetEntryCount(); ++i )
+ {
+ if ( (int)(sal_IntPtr)rMetric.GetEntryData( i ) == (int)eFieldUnit )
+ {
+ rMetric.SelectEntryPos( i );
+ break;
+ }
+ }
+ }
+ rMetric.SaveValue();
+}
+/*-----------------31.08.96 13.58-------------------
+
+--------------------------------------------------*/
+void SwContentOptPage::Reset(const SfxItemSet& rSet)
+{
+ const SwElemItem* pElemAttr = 0;
+
+ rSet.GetItemState( FN_PARAM_ELEM , FALSE,
+ (const SfxPoolItem**)&pElemAttr );
+ if(pElemAttr)
+ {
+ aTblCB .Check (pElemAttr->bTable );
+ aGrfCB .Check (pElemAttr->bGraphic );
+ aDrwCB .Check (pElemAttr->bDrawing );
+ aFldNameCB .Check (pElemAttr->bFieldName );
+ aPostItCB .Check (pElemAttr->bNotes );
+ aCrossCB .Check( pElemAttr->bCrosshair );
+ aSolidHandleCB.Check( !pElemAttr->bHandles );
+ aBigHandleCB.Check(pElemAttr->bBigHandles );
+ aHScrollBox.Check( pElemAttr->bHorzScrollbar );
+ aVScrollBox.Check( pElemAttr->bVertScrollbar );
+ aAnyRulerCB.Check( pElemAttr->bAnyRuler );
+ aHRulerCBox.Check( pElemAttr->bHorzRuler );
+ aVRulerCBox.Check( pElemAttr->bVertRuler );
+ aVRulerRightCBox.Check(pElemAttr->bVertRulerRight);
+ aSmoothCBox.Check( pElemAttr->bSmoothScroll );
+ }
+ aMetricLB.SetNoSelection();
+ lcl_SelectMetricLB(aMetricLB, SID_ATTR_METRIC, rSet);
+ lcl_SelectMetricLB(aHMetric, FN_HSCROLL_METRIC, rSet);
+ lcl_SelectMetricLB(aVMetric, FN_VSCROLL_METRIC, rSet);
+ AnyRulerHdl(&aAnyRulerCB);
+}
+
+/*-----------------31.08.96 13.58-------------------
+
+--------------------------------------------------*/
+BOOL SwContentOptPage::FillItemSet(SfxItemSet& rSet)
+{
+ const SwElemItem* pOldAttr = (const SwElemItem*)
+ GetOldItem(GetItemSet(), FN_PARAM_ELEM);
+
+ SwElemItem aElem;
+ if(pOldAttr)
+ aElem = *pOldAttr;
+ aElem.bTable = aTblCB .IsChecked();
+ aElem.bGraphic = aGrfCB .IsChecked();
+ aElem.bDrawing = aDrwCB .IsChecked();
+ aElem.bFieldName = aFldNameCB .IsChecked();
+ aElem.bNotes = aPostItCB .IsChecked();
+ aElem.bCrosshair = aCrossCB .IsChecked();
+ aElem.bHandles = !aSolidHandleCB.IsChecked();
+ aElem.bBigHandles = aBigHandleCB.IsChecked();
+ aElem.bHorzScrollbar = aHScrollBox.IsChecked();
+ aElem.bVertScrollbar = aVScrollBox.IsChecked();
+ aElem.bAnyRuler = aAnyRulerCB.IsChecked();
+ aElem.bHorzRuler = aHRulerCBox.IsChecked();
+ aElem.bVertRuler = aVRulerCBox.IsChecked();
+ aElem.bVertRulerRight= aVRulerRightCBox.IsChecked();
+ aElem.bSmoothScroll = aSmoothCBox.IsChecked();
+
+
+ BOOL bRet = !pOldAttr || aElem != *pOldAttr;
+ if(bRet)
+ bRet = 0 != rSet.Put(aElem);
+ USHORT nMPos = aMetricLB.GetSelectEntryPos();
+ USHORT nGlobalMetricPos = nMPos;
+ if ( nMPos != aMetricLB.GetSavedValue() )
+ {
+ // Doppel-Cast fuer VA3.0
+ USHORT nFieldUnit = (USHORT)(long)aMetricLB.GetEntryData( nMPos );
+ rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, (UINT16)nFieldUnit ) );
+ bRet = TRUE;
+ }
+
+ nMPos = aHMetric.GetSelectEntryPos();
+ if ( nMPos != aHMetric.GetSavedValue() || nMPos != nGlobalMetricPos )
+ {
+ // Doppel-Cast fuer VA3.0
+ USHORT nFieldUnit = (USHORT)(long)aHMetric.GetEntryData( nMPos );
+ rSet.Put( SfxUInt16Item( FN_HSCROLL_METRIC, (UINT16)nFieldUnit ) );
+ bRet = TRUE;
+ }
+ nMPos = aVMetric.GetSelectEntryPos();
+ if ( nMPos != aVMetric.GetSavedValue() || nMPos != nGlobalMetricPos )
+ {
+ // Doppel-Cast fuer VA3.0
+ USHORT nFieldUnit = (USHORT)(long)aVMetric.GetEntryData( nMPos );
+ rSet.Put( SfxUInt16Item( FN_VSCROLL_METRIC, (UINT16)nFieldUnit ) );
+ bRet = TRUE;
+ }
+ return bRet;
+}
+/* -----------------------------05.03.2002 15:07------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwContentOptPage, VertRulerHdl, CheckBox*, pBox)
+{
+ aVRulerRightCBox.Enable(pBox->IsEnabled() && pBox->IsChecked());
+ return 0;
+}
+/* -----------------20.09.2002 11:30-----------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwContentOptPage, AnyRulerHdl, CheckBox*, pBox)
+{
+ BOOL bChecked = pBox->IsChecked();
+ aHRulerCBox .Enable(bChecked);
+ aHMetric .Enable(bChecked);
+ aVRulerCBox .Enable(bChecked);
+ aVMetric .Enable(bChecked);
+ VertRulerHdl(&aVRulerCBox);
+ return 0;
+}
+/*----------------- OS 27.01.95 -----------------------
+ TabPage Drucker Zusatzeinstellungen
+-------------------------------------------------------*/
+SwAddPrinterTabPage::SwAddPrinterTabPage( Window* pParent,
+ const SfxItemSet& rCoreSet) :
+ SfxTabPage( pParent, SW_RES( TP_OPTPRINT_PAGE ), rCoreSet),
+ aFL1 (this, SW_RES(FL_1)),
+ aGrfCB (this, SW_RES(CB_PGRF)),
+// aTabCB (this, SW_RES(CB_PTAB)),
+// aDrawCB (this, SW_RES(CB_PDRAW)),
+ aCtrlFldCB (this, SW_RES(CB_CTRLFLD)),
+ aBackgroundCB (this, SW_RES(CB_BACKGROUND)),
+ aBlackFontCB (this, SW_RES(CB_BLACK_FONT)),
+ aPrintHiddenTextCB(this, SW_RES(CB_HIDDEN_TEXT)),
+ aPrintTextPlaceholderCB(this, SW_RES(CB_TEXT_PLACEHOLDER)),
+ aSeparatorLFL (this, SW_RES(FL_SEP_PRT_LEFT )),
+ aFL2 (this, SW_RES(FL_2)),
+ aLeftPageCB (this, SW_RES(CB_LEFTP)),
+ aRightPageCB (this, SW_RES(CB_RIGHTP)),
+// aReverseCB (this, SW_RES(CB_REVERSE)),
+ aProspectCB (this, SW_RES(CB_PROSPECT)),
+ aProspectCB_RTL (this, SW_RES(CB_PROSPECT_RTL)),
+ aSeparatorRFL (this, SW_RES(FL_SEP_PRT_RIGHT)),
+ aNoRB (this, SW_RES(RB_NO)),
+ aOnlyRB (this, SW_RES(RB_ONLY)),
+ aEndRB (this, SW_RES(RB_END)),
+ aEndPageRB (this, SW_RES(RB_PAGEEND)),
+ aFL3 (this, SW_RES(FL_3)),
+ aFL4 (this, SW_RES(FL_4)),
+ aPrintEmptyPagesCB(this, SW_RES(CB_PRINTEMPTYPAGES)),
+// aSingleJobsCB (this, SW_RES(CB_SINGLEJOBS)),
+ aPaperFromSetupCB(this, SW_RES(CB_PAPERFROMSETUP)),
+ aFaxFT (this, SW_RES(FT_FAX)),
+ aFaxLB (this, SW_RES(LB_FAX)),
+ sNone(SW_RES(ST_NONE)),
+ bAttrModified( FALSE ),
+ bPreview ( FALSE )
+{
+ Init();
+ FreeResource();
+ Link aLk = LINK( this, SwAddPrinterTabPage, AutoClickHdl);
+ aGrfCB.SetClickHdl( aLk );
+ aRightPageCB.SetClickHdl( aLk );
+ aLeftPageCB.SetClickHdl( aLk );
+// aTabCB.SetClickHdl( aLk );
+// aDrawCB.SetClickHdl( aLk );
+ aCtrlFldCB.SetClickHdl( aLk );
+ aBackgroundCB.SetClickHdl( aLk );
+ aBlackFontCB.SetClickHdl( aLk );
+ aPrintHiddenTextCB.SetClickHdl( aLk );
+ aPrintTextPlaceholderCB.SetClickHdl( aLk );
+// aReverseCB.SetClickHdl( aLk );
+ aProspectCB.SetClickHdl( aLk );
+ aProspectCB_RTL.SetClickHdl( aLk );
+ aPaperFromSetupCB.SetClickHdl( aLk );
+ aPrintEmptyPagesCB.SetClickHdl( aLk );
+ aEndPageRB.SetClickHdl( aLk );
+ aEndRB.SetClickHdl( aLk );
+ aOnlyRB.SetClickHdl( aLk );
+ aNoRB.SetClickHdl( aLk );
+// aSingleJobsCB.SetClickHdl( aLk );
+ aFaxLB.SetSelectHdl( LINK( this, SwAddPrinterTabPage, SelectHdl ) );
+
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_HTML_MODE, FALSE, &pItem )
+ && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON)
+ {
+// aDrawCB .Hide();
+ aLeftPageCB .Hide();
+ aRightPageCB .Hide();
+ aPrintHiddenTextCB.Hide();
+ aPrintTextPlaceholderCB.Hide();
+// aReverseCB.SetPosPixel(aLeftPageCB.GetPosPixel());
+ aProspectCB.SetPosPixel(aLeftPageCB.GetPosPixel());
+ Point aPt( aRightPageCB.GetPosPixel() );
+ aPt.setX(aPt.getX() + 15); // indent
+ aProspectCB_RTL.SetPosPixel(aPt);
+// aBlackFontCB.SetPosPixel(aBackgroundCB.GetPosPixel());
+// aPrintHiddenTextCB.SetPosPixel(aBlackFontCB.GetPosPixel());
+// aBackgroundCB.SetPosPixel(aCtrlFldCB.GetPosPixel());
+// aCtrlFldCB.SetPosPixel(aDrawCB.GetPosPixel());
+
+ // hide aPrintEmptyPagesCB and move everything below up accordingly
+ long nDeltaY = aPaperFromSetupCB.GetPosPixel().getY() - aPrintEmptyPagesCB.GetPosPixel().getY();
+ aPrintEmptyPagesCB.Hide();
+ aPt = aPaperFromSetupCB.GetPosPixel();
+ aPt.setY( aPt.getY() - nDeltaY );
+ aPaperFromSetupCB.SetPosPixel( aPt );
+ aPt = aFaxFT.GetPosPixel();
+ aPt.setY( aPt.getY() - nDeltaY );
+ aFaxFT.SetPosPixel( aPt );
+ aPt = aFaxLB.GetPosPixel();
+ aPt.setY( aPt.getY() - nDeltaY );
+ aFaxLB.SetPosPixel( aPt );
+ }
+ aProspectCB_RTL.Disable();
+ SvtCTLOptions aCTLOptions;
+ aProspectCB_RTL.Show(aCTLOptions.IsCTLFontEnabled());
+}
+
+//------------------------------------------------------------------------
+
+void SwAddPrinterTabPage::SetPreview(BOOL bPrev)
+{
+ bPreview = bPrev;
+
+ if (bPreview)
+ {
+ aLeftPageCB.Disable();
+ aRightPageCB.Disable();
+ aProspectCB.Disable();
+ aProspectCB_RTL.Disable();
+ aFL3.Disable();
+ aNoRB.Disable();
+ aOnlyRB.Disable();
+ aEndRB.Disable();
+ aEndPageRB.Disable();
+ }
+}
+
+//------------------------------------------------------------------------
+
+SfxTabPage* SwAddPrinterTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwAddPrinterTabPage( pParent, rAttrSet ) );
+}
+//------------------------------------------------------------------------
+
+
+BOOL SwAddPrinterTabPage::FillItemSet( SfxItemSet& rCoreSet )
+{
+ if ( bAttrModified )
+ {
+ SwAddPrinterItem aAddPrinterAttr (FN_PARAM_ADDPRINTER);
+ aAddPrinterAttr.bPrintGraphic = aGrfCB.IsChecked();
+ aAddPrinterAttr.bPrintTable = TRUE; // always enabled since CWS printerpullgpages /*aTabCB.IsChecked();*/
+ aAddPrinterAttr.bPrintDraw = aGrfCB.IsChecked(); // UI merged with aGrfCB in CWS printerpullgpages /*aDrawCB.IsChecked()*/;
+ aAddPrinterAttr.bPrintControl = aCtrlFldCB.IsChecked();
+ aAddPrinterAttr.bPrintPageBackground = aBackgroundCB.IsChecked();
+ aAddPrinterAttr.bPrintBlackFont = aBlackFontCB.IsChecked();
+ aAddPrinterAttr.bPrintHiddenText = aPrintHiddenTextCB.IsChecked();
+ aAddPrinterAttr.bPrintTextPlaceholder = aPrintTextPlaceholderCB.IsChecked();
+
+ aAddPrinterAttr.bPrintLeftPages = aLeftPageCB.IsChecked();
+ aAddPrinterAttr.bPrintRightPages = aRightPageCB.IsChecked();
+ aAddPrinterAttr.bPrintReverse = FALSE; // handled by vcl itself since CWS printerpullpages /*aReverseCB.IsChecked()*/;
+ aAddPrinterAttr.bPrintProspect = aProspectCB.IsChecked();
+ aAddPrinterAttr.bPrintProspectRTL = aProspectCB_RTL.IsChecked();
+ aAddPrinterAttr.bPaperFromSetup = aPaperFromSetupCB.IsChecked();
+ aAddPrinterAttr.bPrintEmptyPages = aPrintEmptyPagesCB.IsChecked();
+ aAddPrinterAttr.bPrintSingleJobs = TRUE; // handled by vcl in new print dialog since CWS printerpullpages /*aSingleJobsCB.IsChecked()*/;
+
+ if (aNoRB.IsChecked()) aAddPrinterAttr.nPrintPostIts =
+ POSTITS_NONE;
+ if (aOnlyRB.IsChecked()) aAddPrinterAttr.nPrintPostIts =
+ POSTITS_ONLY;
+ if (aEndRB.IsChecked()) aAddPrinterAttr.nPrintPostIts =
+ POSTITS_ENDDOC;
+ if (aEndPageRB.IsChecked()) aAddPrinterAttr.nPrintPostIts =
+ POSTITS_ENDPAGE;
+
+ String sFax = aFaxLB.GetSelectEntry();
+ aAddPrinterAttr.sFaxName = sNone == sFax ? aEmptyStr : sFax;
+ rCoreSet.Put(aAddPrinterAttr);
+ }
+ return bAttrModified;
+}
+//------------------------------------------------------------------------
+
+
+void SwAddPrinterTabPage::Reset( const SfxItemSet& )
+{
+ const SfxItemSet& rSet = GetItemSet();
+ const SwAddPrinterItem* pAddPrinterAttr = 0;
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ADDPRINTER , FALSE,
+ (const SfxPoolItem**)&pAddPrinterAttr ))
+ {
+ aGrfCB.Check( pAddPrinterAttr->bPrintGraphic || pAddPrinterAttr->bPrintDraw );
+// aTabCB.Check( pAddPrinterAttr->bPrintTable);
+// aDrawCB.Check( pAddPrinterAttr->bPrintDraw);
+ aCtrlFldCB.Check( pAddPrinterAttr->bPrintControl);
+ aBackgroundCB.Check( pAddPrinterAttr->bPrintPageBackground);
+ aBlackFontCB.Check( pAddPrinterAttr->bPrintBlackFont);
+ aPrintHiddenTextCB.Check( pAddPrinterAttr->bPrintHiddenText);
+ aPrintTextPlaceholderCB.Check(pAddPrinterAttr->bPrintTextPlaceholder);
+ aLeftPageCB.Check( pAddPrinterAttr->bPrintLeftPages);
+ aRightPageCB.Check( pAddPrinterAttr->bPrintRightPages);
+// aReverseCB.Check( pAddPrinterAttr->bPrintReverse);
+ aPaperFromSetupCB.Check(pAddPrinterAttr->bPaperFromSetup);
+ aPrintEmptyPagesCB.Check(pAddPrinterAttr->bPrintEmptyPages);
+ aProspectCB.Check( pAddPrinterAttr->bPrintProspect);
+ aProspectCB_RTL.Check( pAddPrinterAttr->bPrintProspectRTL);
+// aSingleJobsCB.Check( pAddPrinterAttr->bPrintSingleJobs);
+
+ aNoRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_NONE ) ;
+ aOnlyRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ONLY ) ;
+ aEndRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ENDDOC ) ;
+ aEndPageRB.Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ENDPAGE ) ;
+ aFaxLB.SelectEntry( pAddPrinterAttr->sFaxName );
+ }
+ if (aProspectCB.IsChecked())
+ {
+ aProspectCB_RTL.Enable(TRUE);
+ aNoRB.Enable( FALSE );
+ aOnlyRB.Enable( FALSE );
+ aEndRB.Enable( FALSE );
+ aEndPageRB.Enable( FALSE );
+ }
+ else
+ aProspectCB_RTL.Enable( FALSE );
+}
+//-----------------------------------------------------------------------
+
+
+void SwAddPrinterTabPage::Init()
+{
+
+}
+//------------------------------------------------------------------------
+
+
+IMPL_LINK_INLINE_START( SwAddPrinterTabPage, AutoClickHdl, CheckBox *, EMPTYARG )
+{
+ bAttrModified = TRUE;
+ bool bIsProspect = aProspectCB.IsChecked();
+ if (!bIsProspect)
+ aProspectCB_RTL.Check( FALSE );
+ aProspectCB_RTL.Enable( bIsProspect );
+ aNoRB.Enable( !bIsProspect );
+ aOnlyRB.Enable( !bIsProspect );
+ aEndRB.Enable( !bIsProspect );
+ aEndPageRB.Enable( !bIsProspect );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwAddPrinterTabPage, AutoClickHdl, CheckBox *, EMPTYARG )
+
+//------------------------------------------------------------------------
+
+
+void SwAddPrinterTabPage::SetFax( const SvStringsDtor& rFaxLst )
+{
+ aFaxLB.InsertEntry(sNone);
+ for ( USHORT i = 0; i < rFaxLst.Count(); ++i )
+ aFaxLB.InsertEntry( *rFaxLst.GetObject(i) );
+ aFaxLB.SelectEntryPos(0);
+}
+
+//------------------------------------------------------------------------
+
+
+IMPL_LINK_INLINE_START( SwAddPrinterTabPage, SelectHdl, ListBox *, EMPTYARG )
+{
+ bAttrModified=TRUE;
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwAddPrinterTabPage, SelectHdl, ListBox *, EMPTYARG )
+
+void SwAddPrinterTabPage::PageCreated (SfxAllItemSet aSet)
+{
+ //SFX_ITEMSET_ARG (&aSet,pListItem,SfxStringListItem,SID_FAX_LIST,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pListItem,SfxBoolItem,SID_FAX_LIST,sal_False);
+ SFX_ITEMSET_ARG (&aSet,pPreviewItem,SfxBoolItem,SID_PREVIEWFLAG_TYPE,sal_False);
+ if (pPreviewItem)
+ {
+ SetPreview(pPreviewItem->GetValue());
+ Reset(aSet);
+ }
+ if (pListItem && pListItem->GetValue())
+ {
+ SvStringsDtor aFaxList;
+ const std::vector<rtl::OUString>& rPrinters = Printer::GetPrinterQueues();
+ for (unsigned int i = 0; i < rPrinters.size(); ++i)
+ {
+ String* pString = new String( rPrinters[i] );
+ String* &rpString = pString;
+ aFaxList.Insert(rpString, 0);
+ }
+ SetFax( aFaxList );
+/* SvStringsDtor aFaxList;
+ const List *pList = (pListItem)->GetList();
+ sal_uInt32 nCount = pList->Count();
+ for(sal_uInt32 i = 0; i < nCount ; i++)
+ {
+ String* pString = (String*)(pList->GetObject(i));
+ String* &rpString = pString;
+ aFaxList.Insert(rpString, 0 );
+ }
+ SetFax(aFaxList);
+*/
+ }
+}
+/*-----------------03.09.96 11.53-------------------
+ Tabpage Standardfonts
+--------------------------------------------------*/
+
+
+SwStdFontTabPage::SwStdFontTabPage( Window* pParent,
+ const SfxItemSet& rSet ) :
+ SfxTabPage( pParent, SW_RES( TP_STD_FONT ), rSet),
+ aStdChrFL (this, SW_RES(FL_STDCHR )),
+ aTypeFT( this, SW_RES( FT_TYPE )),
+
+ aStandardLbl(this, SW_RES(FT_STANDARD)),
+ aStandardBox(this, SW_RES(LB_STANDARD)),
+
+ aHeightFT( this, SW_RES( FT_SIZE )),
+ aStandardHeightLB(this, SW_RES( LB_STANDARD_SIZE )),
+
+ aTitleLbl (this, SW_RES(FT_TITLE )),
+ aTitleBox (this, SW_RES(LB_TITLE )),
+ aTitleHeightLB( this, SW_RES( LB_TITLE_SIZE )),
+
+ aListLbl (this, SW_RES(FT_LIST )),
+ aListBox (this, SW_RES(LB_LIST )),
+ aListHeightLB( this, SW_RES( LB_LIST_SIZE )),
+
+ aLabelLbl (this, SW_RES(FT_LABEL )),
+ aLabelBox (this, SW_RES(LB_LABEL )),
+ aLabelHeightLB( this, SW_RES( LB_LABEL_SIZE )),
+
+ aIdxLbl (this, SW_RES(FT_IDX )),
+ aIdxBox (this, SW_RES(LB_IDX )),
+ aIndexHeightLB( this, SW_RES( LB_INDEX_SIZE )),
+
+ aDocOnlyCB (this, SW_RES(CB_DOCONLY )),
+ aStandardPB (this, SW_RES(PB_STANDARD)),
+ pPrt(0),
+ pFontList(0),
+ pFontConfig(0),
+ pWrtShell(0),
+ eLanguage( GetAppLanguage() ),
+
+ bListDefault(FALSE),
+ bSetListDefault(TRUE),
+ bLabelDefault(FALSE),
+ bSetLabelDefault(TRUE),
+ bIdxDefault(FALSE),
+ bSetIdxDefault(TRUE),
+ bDeletePrinter(FALSE),
+
+ bListHeightDefault (FALSE),
+ bSetListHeightDefault (FALSE),
+ bLabelHeightDefault (FALSE),
+ bSetLabelHeightDefault(FALSE),
+ bIndexHeightDefault (FALSE),
+ bSetIndexHeightDefault (FALSE),
+
+ nFontGroup(FONT_GROUP_DEFAULT),
+
+ sScriptWestern(SW_RES(ST_SCRIPT_WESTERN)),
+ sScriptAsian(SW_RES(ST_SCRIPT_ASIAN)),
+ sScriptComplex(SW_RES(ST_SCRIPT_CTL))
+{
+ FreeResource();
+ aStandardPB.SetClickHdl(LINK(this, SwStdFontTabPage, StandardHdl));
+ aStandardBox.SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl));
+ aListBox .SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl));
+ aLabelBox .SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl));
+ aIdxBox .SetModifyHdl( LINK(this, SwStdFontTabPage, ModifyHdl));
+ Link aFocusLink = LINK( this, SwStdFontTabPage, LoseFocusHdl);
+ aStandardBox.SetLoseFocusHdl( aFocusLink );
+ aTitleBox .SetLoseFocusHdl( aFocusLink );
+ aListBox .SetLoseFocusHdl( aFocusLink );
+ aLabelBox .SetLoseFocusHdl( aFocusLink );
+ aIdxBox .SetLoseFocusHdl( aFocusLink );
+
+ Link aModifyHeightLink( LINK( this, SwStdFontTabPage, ModifyHeightHdl));
+ aStandardHeightLB.SetModifyHdl( aModifyHeightLink );
+ aTitleHeightLB. SetModifyHdl( aModifyHeightLink );
+ aListHeightLB. SetModifyHdl( aModifyHeightLink );
+ aLabelHeightLB. SetModifyHdl( aModifyHeightLink );
+ aIndexHeightLB. SetModifyHdl( aModifyHeightLink );
+
+ aDocOnlyCB.Check(SW_MOD()->GetModuleConfig()->IsDefaultFontInCurrDocOnly());
+}
+
+/*-----------------03.09.96 11.53-------------------
+
+--------------------------------------------------*/
+
+SwStdFontTabPage::~SwStdFontTabPage()
+{
+ if(bDeletePrinter)
+ delete pPrt;
+}
+
+/*-----------------03.09.96 11.53-------------------
+
+--------------------------------------------------*/
+SfxTabPage* SwStdFontTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return new SwStdFontTabPage(pParent, rAttrSet);
+}
+
+/*-----------------03.09.96 11.53-------------------
+
+--------------------------------------------------*/
+void lcl_SetColl(SwWrtShell* pWrtShell, USHORT nType,
+ SfxPrinter* pPrt, const String& rStyle,
+ USHORT nFontWhich)
+{
+ Font aFont( rStyle, Size( 0, 10 ) );
+ if( pPrt )
+ aFont = pPrt->GetFontMetric( aFont );
+ SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(nType);
+ pColl->SetFmtAttr(SvxFontItem(aFont.GetFamily(), aFont.GetName(),
+ aEmptyStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich));
+}
+/*-- 11.10.2005 15:47:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_SetColl(SwWrtShell* pWrtShell, USHORT nType,
+ sal_Int32 nHeight, USHORT nFontHeightWhich)
+{
+ float fSize = (float)nHeight / 10;
+ nHeight = CalcToUnit( fSize, SFX_MAPUNIT_TWIP );
+ SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(nType);
+ pColl->SetFmtAttr(SvxFontHeightItem(nHeight, 100, nFontHeightWhich));
+}
+/*-----------------03.09.96 11.53-------------------
+
+--------------------------------------------------*/
+BOOL SwStdFontTabPage::FillItemSet( SfxItemSet& )
+{
+ BOOL bNotDocOnly = !aDocOnlyCB.IsChecked();
+ SW_MOD()->GetModuleConfig()->SetDefaultFontInCurrDocOnly(!bNotDocOnly);
+
+ String sStandard = aStandardBox.GetText();
+ String sTitle = aTitleBox .GetText();
+ String sList = aListBox .GetText();
+ String sLabel = aLabelBox .GetText();
+ String sIdx = aIdxBox .GetText();
+ String sStandardBak = aStandardBox.GetSavedValue();
+ String sTitleBak = aTitleBox .GetSavedValue();
+ String sListBak = aListBox .GetSavedValue();
+ String sLabelBak = aLabelBox .GetSavedValue();
+ String sIdxBak = aIdxBox .GetSavedValue();
+
+ bool bStandardHeightChanged = aStandardHeightLB.GetSavedValue() != aStandardHeightLB.GetText();
+ bool bTitleHeightChanged = aTitleHeightLB.GetSavedValue() != aTitleHeightLB.GetText();
+ bool bListHeightChanged = aListHeightLB.GetSavedValue() != aListHeightLB.GetText() && (!bListHeightDefault || !bSetListHeightDefault );
+ bool bLabelHeightChanged = aLabelHeightLB.GetSavedValue() != aLabelHeightLB.GetText() && (!bLabelHeightDefault || !bSetLabelHeightDefault );
+ bool bIndexHeightChanged = aIndexHeightLB.GetSavedValue() != aIndexHeightLB.GetText() && (!bIndexHeightDefault || !bSetIndexHeightDefault );
+ if(bNotDocOnly)
+ {
+ pFontConfig->SetFontStandard(sStandard, nFontGroup);
+ pFontConfig->SetFontOutline(sTitle, nFontGroup);
+ pFontConfig->SetFontList(sList, nFontGroup);
+ pFontConfig->SetFontCaption(sLabel, nFontGroup);
+ pFontConfig->SetFontIndex(sIdx, nFontGroup);
+ if(bStandardHeightChanged)
+ {
+ float fSize = (float)aStandardHeightLB.GetValue() / 10;
+ pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_STANDARD, nFontGroup );
+ }
+ if(bTitleHeightChanged)
+ {
+ float fSize = (float)aTitleHeightLB.GetValue() / 10;
+ pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_OUTLINE, nFontGroup );
+ }
+ if(bListHeightChanged)
+ {
+ float fSize = (float)aListHeightLB.GetValue() / 10;
+ pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_LIST, nFontGroup );
+ }
+ if(bLabelHeightChanged)
+ {
+ float fSize = (float)aLabelHeightLB.GetValue() / 10;
+ pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_CAPTION, nFontGroup );
+ }
+ if(bIndexHeightChanged)
+ {
+ float fSize = (float)aIndexHeightLB.GetValue() / 10;
+ pFontConfig->SetFontHeight( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), FONT_INDEX, nFontGroup );
+ }
+ }
+ if(pWrtShell)
+ {
+ pWrtShell->StartAllAction();
+ SfxPrinter* pPrinter = pWrtShell->getIDocumentDeviceAccess()->getPrinter( false );
+ BOOL bMod = FALSE;
+ USHORT nFontWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >(
+ nFontGroup == FONT_GROUP_DEFAULT ? RES_CHRATR_FONT :
+ FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONT : RES_CHRATR_CTL_FONT);
+ USHORT nFontHeightWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >(
+ nFontGroup == FONT_GROUP_DEFAULT ? RES_CHRATR_FONTSIZE :
+ FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONTSIZE : RES_CHRATR_CTL_FONTSIZE);
+ if(sStandard != sShellStd)
+ {
+ Font aFont( sStandard, Size( 0, 10 ) );
+ if( pPrinter )
+ aFont = pPrinter->GetFontMetric( aFont );
+ pWrtShell->SetDefault(SvxFontItem(aFont.GetFamily(), aFont.GetName(),
+ aEmptyStr, aFont.GetPitch(), aFont.GetCharSet(), nFontWhich));
+ SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_STANDARD);
+ pColl->ResetFmtAttr(nFontWhich);
+// lcl_SetColl(pWrtShell, RES_POOLCOLL_STANDARD, pPrinter, sStandard);
+ bMod = TRUE;
+ }
+ if(bStandardHeightChanged)
+ {
+ float fSize = (float)aStandardHeightLB.GetValue() / 10;
+ pWrtShell->SetDefault(SvxFontHeightItem( CalcToUnit( fSize, SFX_MAPUNIT_TWIP ), 100, nFontHeightWhich ) );
+ SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_STANDARD);
+ pColl->ResetFmtAttr(nFontHeightWhich);
+ bMod = TRUE;
+ }
+
+ if(sTitle != sShellTitle )
+ {
+ lcl_SetColl(pWrtShell, RES_POOLCOLL_HEADLINE_BASE, pPrinter, sTitle, nFontWhich);
+ bMod = TRUE;
+ }
+ if(bTitleHeightChanged)
+ {
+ lcl_SetColl(pWrtShell, RES_POOLCOLL_HEADLINE_BASE,
+ sal::static_int_cast< sal_uInt16, sal_Int64 >(aTitleHeightLB.GetValue()), nFontHeightWhich);
+ bMod = TRUE;
+ }
+ if(sList != sShellList && (!bListDefault || !bSetListDefault ))
+ {
+ lcl_SetColl(pWrtShell, RES_POOLCOLL_NUMBUL_BASE, pPrinter, sList, nFontWhich);
+ bMod = TRUE;
+ }
+ if(bListHeightChanged)
+ {
+ lcl_SetColl(pWrtShell, RES_POOLCOLL_NUMBUL_BASE,
+ sal::static_int_cast< sal_uInt16, sal_Int64 >(aListHeightLB.GetValue()), nFontHeightWhich);
+ bMod = TRUE;
+ }
+ if(sLabel != sShellLabel && (!bLabelDefault || !bSetLabelDefault))
+ {
+ lcl_SetColl(pWrtShell, RES_POOLCOLL_LABEL, pPrinter, sLabel, nFontWhich);
+ bMod = TRUE;
+ }
+ if(bLabelHeightChanged)
+ {
+ lcl_SetColl(pWrtShell, RES_POOLCOLL_LABEL,
+ sal::static_int_cast< sal_uInt16, sal_Int64 >(aLabelHeightLB.GetValue()), nFontHeightWhich);
+ bMod = TRUE;
+ }
+ if(sIdx != sShellIndex && (!bIdxDefault || !bSetIdxDefault))
+ {
+ lcl_SetColl(pWrtShell, RES_POOLCOLL_REGISTER_BASE, pPrinter, sIdx, nFontWhich);
+ bMod = TRUE;
+ }
+ if(bIndexHeightChanged)
+ {
+ lcl_SetColl(pWrtShell, RES_POOLCOLL_REGISTER_BASE,
+ sal::static_int_cast< sal_uInt16, sal_Int64 >(aIndexHeightLB.GetValue()), nFontHeightWhich);
+ bMod = TRUE;
+ }
+ if ( bMod )
+ pWrtShell->SetModified();
+ pWrtShell->EndAllAction();
+ }
+
+ return FALSE;
+}
+
+/*-----------------03.09.96 11.53-------------------
+
+--------------------------------------------------*/
+void SwStdFontTabPage::Reset( const SfxItemSet& rSet)
+{
+ const SfxPoolItem* pLang;
+ USHORT nLangSlot = nFontGroup == FONT_GROUP_DEFAULT ? SID_ATTR_LANGUAGE :
+ FONT_GROUP_CJK == nFontGroup ? SID_ATTR_CHAR_CJK_LANGUAGE : SID_ATTR_CHAR_CTL_LANGUAGE;
+
+
+ if( SFX_ITEM_SET == rSet.GetItemState(nLangSlot, FALSE, &pLang))
+ eLanguage = ((const SvxLanguageItem*)pLang)->GetValue();
+
+ String sTmp(aStdChrFL.GetText());
+ String sToReplace = sScriptWestern;
+ if(FONT_GROUP_CJK == nFontGroup )
+ sToReplace = sScriptAsian;
+ else if(FONT_GROUP_CTL == nFontGroup )
+ sToReplace = sScriptComplex;
+
+ sTmp.SearchAndReplaceAscii("%1", sToReplace);
+ aStdChrFL.SetText(sTmp);
+ const SfxPoolItem* pItem;
+
+ if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_PRINTER, FALSE, &pItem))
+ {
+ pPrt = (SfxPrinter*)((const SwPtrItem*)pItem)->GetValue();
+ }
+ else
+ {
+ SfxItemSet* pPrinterSet = new SfxItemSet( *rSet.GetPool(),
+ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+ 0 );
+ pPrt = new SfxPrinter(pPrinterSet);
+ bDeletePrinter = TRUE;
+ }
+ pFontList = new FontList( pPrt );
+ // #i94536# prevent duplication of font entries when 'reset' button is pressed
+ if( !aStandardBox.GetEntryCount() )
+ {
+ // get the set of disctinct available family names
+ std::set< String > aFontNames;
+ int nFontNames = pPrt->GetDevFontCount();
+ for( int i = 0; i < nFontNames; i++ )
+ {
+ FontInfo aInf( pPrt->GetDevFont( i ) );
+ aFontNames.insert( aInf.GetName() );
+ }
+
+ // insert to listboxes
+ for( std::set< String >::const_iterator it = aFontNames.begin();
+ it != aFontNames.end(); ++it )
+ {
+ aStandardBox.InsertEntry( *it );
+ aTitleBox .InsertEntry( *it );
+ aListBox .InsertEntry( *it );
+ aLabelBox .InsertEntry( *it );
+ aIdxBox .InsertEntry( *it );
+ }
+ }
+ if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_STDFONTS, FALSE, &pItem))
+ {
+ pFontConfig = (SwStdFontConfig*)((const SwPtrItem*)pItem)->GetValue();
+ }
+
+ if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_WRTSHELL, FALSE, &pItem))
+ {
+ pWrtShell = (SwWrtShell*)((const SwPtrItem*)pItem)->GetValue();
+ }
+ String sStdBackup;
+ String sOutBackup;
+ String sListBackup;
+ String sCapBackup;
+ String sIdxBackup;
+ sal_Int32 nStandardHeight = -1;
+ sal_Int32 nTitleHeight = -1;
+ sal_Int32 nListHeight = -1;
+ sal_Int32 nLabelHeight = -1;
+ sal_Int32 nIndexHeight = -1;
+
+ if(!pWrtShell)
+ {
+ sStdBackup = pFontConfig->GetFontStandard(nFontGroup);
+ sOutBackup = pFontConfig->GetFontOutline(nFontGroup);
+ sListBackup= pFontConfig->GetFontList(nFontGroup);
+ sCapBackup = pFontConfig->GetFontCaption(nFontGroup);
+ sIdxBackup = pFontConfig->GetFontIndex(nFontGroup);
+ nStandardHeight = pFontConfig->GetFontHeight( FONT_STANDARD, nFontGroup, eLanguage );
+ nTitleHeight = pFontConfig->GetFontHeight( FONT_OUTLINE , nFontGroup, eLanguage );
+ nListHeight = pFontConfig->GetFontHeight( FONT_LIST , nFontGroup, eLanguage );
+ nLabelHeight = pFontConfig->GetFontHeight( FONT_CAPTION , nFontGroup, eLanguage );
+ nIndexHeight = pFontConfig->GetFontHeight( FONT_INDEX , nFontGroup, eLanguage );
+ if( nStandardHeight <= 0)
+ nStandardHeight = pFontConfig->GetDefaultHeightFor( FONT_STANDARD + nFontGroup * FONT_PER_GROUP, eLanguage);
+ if( nTitleHeight <= 0)
+ nTitleHeight = pFontConfig->GetDefaultHeightFor( FONT_OUTLINE + nFontGroup * FONT_PER_GROUP, eLanguage);
+ if( nListHeight <= 0)
+ nListHeight = pFontConfig->GetDefaultHeightFor( FONT_LIST + nFontGroup * FONT_PER_GROUP, eLanguage);
+ if( nLabelHeight <= 0)
+ nLabelHeight = pFontConfig->GetDefaultHeightFor( FONT_CAPTION + nFontGroup * FONT_PER_GROUP, eLanguage);
+ if( nIndexHeight <= 0)
+ nIndexHeight = pFontConfig->GetDefaultHeightFor( FONT_INDEX + nFontGroup * FONT_PER_GROUP, eLanguage);
+
+ aDocOnlyCB.Enable(FALSE);
+ }
+ else
+ {
+ SwTxtFmtColl *pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_STANDARD);
+ const SvxFontItem& rFont = !nFontGroup ? pColl->GetFont() :
+ FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
+ sShellStd = sStdBackup = rFont.GetFamilyName();
+
+ USHORT nFontHeightWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >(
+ nFontGroup == FONT_GROUP_DEFAULT ? RES_CHRATR_FONTSIZE :
+ FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONTSIZE : RES_CHRATR_CTL_FONTSIZE );
+ const SvxFontHeightItem& rFontHeightStandard = (const SvxFontHeightItem& )pColl->GetFmtAttr(nFontHeightWhich);
+ nStandardHeight = (sal_Int32)rFontHeightStandard.GetHeight();
+
+ pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_HEADLINE_BASE);
+ const SvxFontItem& rFontHL = !nFontGroup ? pColl->GetFont() :
+ FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
+ sShellTitle = sOutBackup = rFontHL.GetFamilyName();
+
+ const SvxFontHeightItem& rFontHeightTitle = (const SvxFontHeightItem&)pColl->GetFmtAttr( nFontHeightWhich, sal_True );
+ nTitleHeight = (sal_Int32)rFontHeightTitle.GetHeight();
+
+ USHORT nFontWhich = sal::static_int_cast< sal_uInt16, RES_CHRATR >(
+ nFontGroup == FONT_GROUP_DEFAULT ? RES_CHRATR_FONT :
+ FONT_GROUP_CJK == nFontGroup ? RES_CHRATR_CJK_FONT : RES_CHRATR_CTL_FONT);
+ pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_NUMBUL_BASE);
+ const SvxFontItem& rFontLS = !nFontGroup ? pColl->GetFont() :
+ FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
+ bListDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, FALSE);
+ sShellList = sListBackup = rFontLS.GetFamilyName();
+
+ const SvxFontHeightItem& rFontHeightList = (const SvxFontHeightItem&)pColl->GetFmtAttr(nFontHeightWhich, sal_True);
+ nListHeight = (sal_Int32)rFontHeightList.GetHeight();
+ bListHeightDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, FALSE);
+
+
+ pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_LABEL);
+ bLabelDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, FALSE);
+ const SvxFontItem& rFontCP = !nFontGroup ? pColl->GetFont() :
+ FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
+ sShellLabel = sCapBackup = rFontCP.GetFamilyName();
+ const SvxFontHeightItem& rFontHeightLabel = (const SvxFontHeightItem&)pColl->GetFmtAttr(nFontHeightWhich, sal_True);
+ nLabelHeight = (sal_Int32)rFontHeightLabel.GetHeight();
+ bLabelHeightDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, FALSE);
+
+ pColl = pWrtShell->GetTxtCollFromPool(RES_POOLCOLL_REGISTER_BASE);
+ bIdxDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, FALSE);
+ const SvxFontItem& rFontIDX = !nFontGroup ? pColl->GetFont() :
+ FONT_GROUP_CJK == nFontGroup ? pColl->GetCJKFont() : pColl->GetCTLFont();
+ sShellIndex = sIdxBackup = rFontIDX.GetFamilyName();
+ const SvxFontHeightItem& rFontHeightIndex = (const SvxFontHeightItem&)pColl->GetFmtAttr(nFontHeightWhich, sal_True);
+ nIndexHeight = (sal_Int32)rFontHeightIndex.GetHeight();
+ bIndexHeightDefault = SFX_ITEM_DEFAULT == pColl->GetAttrSet().GetItemState(nFontWhich, FALSE);
+ }
+ aStandardBox.SetText(sStdBackup );
+ aTitleBox .SetText(sOutBackup );
+ aListBox .SetText(sListBackup);
+ aLabelBox .SetText(sCapBackup );
+ aIdxBox .SetText(sIdxBackup );
+
+ FontInfo aFontInfo( pFontList->Get(sStdBackup, sStdBackup) );
+ aStandardHeightLB.Fill( &aFontInfo, pFontList );
+ aFontInfo = pFontList->Get(sOutBackup, sOutBackup );
+ aTitleHeightLB.Fill( &aFontInfo, pFontList );
+ aFontInfo = pFontList->Get(sListBackup,sListBackup);
+ aListHeightLB.Fill( &aFontInfo, pFontList );
+ aFontInfo = pFontList->Get(sCapBackup, sCapBackup );
+ aLabelHeightLB.Fill( &aFontInfo, pFontList );
+ aFontInfo = pFontList->Get(sIdxBackup, sIdxBackup );
+ aIndexHeightLB.Fill( &aFontInfo, pFontList );
+
+ aStandardHeightLB.SetValue( CalcToPoint( nStandardHeight, SFX_MAPUNIT_TWIP, 10 ) );
+ aTitleHeightLB. SetValue( CalcToPoint( nTitleHeight , SFX_MAPUNIT_TWIP, 10 ) );
+ aListHeightLB. SetValue( CalcToPoint( nListHeight , SFX_MAPUNIT_TWIP, 10 ) );
+ aLabelHeightLB. SetValue( CalcToPoint( nLabelHeight , SFX_MAPUNIT_TWIP, 10 ));
+ aIndexHeightLB. SetValue( CalcToPoint( nIndexHeight , SFX_MAPUNIT_TWIP, 10 ));
+
+ aStandardBox.SaveValue();
+ aTitleBox .SaveValue();
+ aListBox .SaveValue();
+ aLabelBox .SaveValue();
+ aIdxBox .SaveValue();
+
+ aStandardHeightLB.SaveValue();
+ aTitleHeightLB. SaveValue();
+ aListHeightLB. SaveValue();
+ aLabelHeightLB. SaveValue();
+ aIndexHeightLB. SaveValue();
+}
+
+/*-----------------07.09.96 12.28-------------------
+
+--------------------------------------------------*/
+
+
+IMPL_LINK( SwStdFontTabPage, StandardHdl, PushButton *, EMPTYARG )
+{
+ sal_uInt8 nFontOffset = nFontGroup * FONT_PER_GROUP;
+ aStandardBox.SetText(SwStdFontConfig::GetDefaultFor(FONT_STANDARD + nFontOffset, eLanguage));
+ aTitleBox .SetText(SwStdFontConfig::GetDefaultFor(FONT_OUTLINE + nFontOffset, eLanguage));
+ aListBox .SetText(SwStdFontConfig::GetDefaultFor(FONT_LIST + nFontOffset, eLanguage));
+ aLabelBox .SetText(SwStdFontConfig::GetDefaultFor(FONT_CAPTION + nFontOffset, eLanguage));
+ aIdxBox .SetText(SwStdFontConfig::GetDefaultFor(FONT_INDEX + nFontOffset, eLanguage));
+
+ aStandardBox.SaveValue();
+ aTitleBox .SaveValue();
+ aListBox .SaveValue();
+ aLabelBox .SaveValue();
+ aIdxBox .SaveValue();
+
+ aStandardHeightLB.SetValue( CalcToPoint(
+ SwStdFontConfig::GetDefaultHeightFor(FONT_STANDARD + nFontOffset, eLanguage),
+ SFX_MAPUNIT_TWIP, 10 ) );
+ aTitleHeightLB .SetValue(CalcToPoint(
+ SwStdFontConfig::GetDefaultHeightFor(FONT_OUTLINE +
+ nFontOffset, eLanguage), SFX_MAPUNIT_TWIP, 10 ));
+ aListHeightLB .SetValue(CalcToPoint(
+ SwStdFontConfig::GetDefaultHeightFor(FONT_LIST + nFontOffset, eLanguage),
+ SFX_MAPUNIT_TWIP, 10 ));
+ aLabelHeightLB .SetValue(CalcToPoint(
+ SwStdFontConfig::GetDefaultHeightFor(FONT_CAPTION + nFontOffset, eLanguage),
+ SFX_MAPUNIT_TWIP, 10 ));
+ aIndexHeightLB .SetValue(CalcToPoint(
+ SwStdFontConfig::GetDefaultHeightFor(FONT_INDEX + nFontOffset, eLanguage),
+ SFX_MAPUNIT_TWIP, 10 ));
+
+ return 0;
+}
+/*-----------------17.01.97 15.43-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK( SwStdFontTabPage, ModifyHdl, ComboBox*, pBox )
+{
+ if(pBox == &aStandardBox)
+ {
+ String sEntry = pBox->GetText();
+ if(bSetListDefault && bListDefault)
+ aListBox.SetText(sEntry);
+ if(bSetLabelDefault && bLabelDefault)
+ aLabelBox.SetText(sEntry);
+ if(bSetIdxDefault && bIdxDefault)
+ aIdxBox.SetText(sEntry);
+ }
+ else if(pBox == &aListBox)
+ {
+ bSetListDefault = FALSE;
+ }
+ else if(pBox == &aLabelBox)
+ {
+ bSetLabelDefault = FALSE;
+ }
+ else if(pBox == &aIdxBox)
+ {
+ bSetIdxDefault = FALSE;
+ }
+ return 0;
+}
+
+/*-- 11.10.2005 15:11:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwStdFontTabPage, ModifyHeightHdl, FontSizeBox*, pBox )
+{
+ if(pBox == &aStandardHeightLB)
+ {
+ sal_Int64 nValue = pBox->GetValue(FUNIT_TWIP);
+ if(bSetListHeightDefault && bListHeightDefault)
+ aListHeightLB.SetValue(nValue, FUNIT_TWIP);
+ if(bSetLabelHeightDefault && bLabelHeightDefault)
+ aLabelHeightLB.SetValue(nValue, FUNIT_TWIP);
+ if(bSetIndexHeightDefault && bIndexHeightDefault)
+ aIndexHeightLB.SetValue(nValue, FUNIT_TWIP);
+ }
+ else if(pBox == &aListHeightLB)
+ {
+ bSetListHeightDefault = FALSE;
+ }
+ else if(pBox == &aLabelHeightLB)
+ {
+ bSetLabelHeightDefault = FALSE;
+ }
+ else if(pBox == &aIndexHeightLB)
+ {
+ bSetIndexHeightDefault = FALSE;
+ }
+ return 0;
+}
+
+/*-- 28.09.2005 13:22:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwStdFontTabPage, LoseFocusHdl, ComboBox*, pBox )
+{
+ FontSizeBox* pHeightLB = 0;
+ String sEntry = pBox->GetText();
+ if(pBox == &aStandardBox)
+ {
+ pHeightLB = &aStandardHeightLB;
+ }
+ else if(pBox == &aTitleBox)
+ {
+ pHeightLB = &aTitleHeightLB;
+ }
+ else if(pBox == &aListBox)
+ {
+ pHeightLB = &aListHeightLB;
+ }
+ else if(pBox == &aLabelBox)
+ {
+ pHeightLB = &aLabelHeightLB;
+ }
+ else /*if(pBox == &aIdxBox)*/
+ {
+ pHeightLB = &aIndexHeightLB;
+ }
+ FontInfo aFontInfo( pFontList->Get(sEntry, sEntry) );
+ pHeightLB->Fill( &aFontInfo, pFontList );
+
+ return 0;
+}
+
+
+void SwStdFontTabPage::PageCreated (SfxAllItemSet aSet)
+{
+ SFX_ITEMSET_ARG (&aSet,pFlagItem,SfxUInt16Item, SID_FONTMODE_TYPE, sal_False);
+ if (pFlagItem)
+ SetFontMode(sal::static_int_cast< sal_uInt8, sal_uInt16>( pFlagItem->GetValue()));
+}
+/*-----------------18.01.97 12.14-------------------
+ Optionen Tabelle
+--------------------------------------------------*/
+
+SwTableOptionsTabPage::SwTableOptionsTabPage( Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SW_RES(TP_OPTTABLE_PAGE), rSet),
+ aTableFL (this, SW_RES(FL_TABLE )),
+ aHeaderCB (this, SW_RES(CB_HEADER )),
+ aRepeatHeaderCB (this, SW_RES(CB_REPEAT_HEADER )),
+ aDontSplitCB (this, SW_RES(CB_DONT_SPLIT )),
+ aBorderCB (this, SW_RES(CB_BORDER )),
+
+ aSeparatorFL (this, SW_RES(FL_TABLE_SEPARATOR)),
+
+ aTableInsertFL (this, SW_RES(FL_TABLE_INSERT )),
+ aNumFormattingCB(this, SW_RES(CB_NUMFORMATTING )),
+ aNumFmtFormattingCB(this, SW_RES(CB_NUMFMT_FORMATTING )),
+ aNumAlignmentCB (this, SW_RES(CB_NUMALIGNMENT )),
+
+ aMoveFL( this, SW_RES(FL_MOVE )),
+ aMoveFT( this, SW_RES(FT_MOVE )),
+ aRowMoveFT( this, SW_RES(FT_ROWMOVE )),
+ aRowMoveMF( this, SW_RES(MF_ROWMOVE )),
+ aColMoveFT( this, SW_RES(FT_COLMOVE )),
+ aColMoveMF( this, SW_RES(MF_COLMOVE )),
+
+ aInsertFT( this, SW_RES(FT_INSERT )),
+ aRowInsertFT( this, SW_RES(FT_ROWINSERT)),
+ aRowInsertMF( this, SW_RES(MF_ROWINSERT)),
+ aColInsertFT( this, SW_RES(FT_COLINSERT)),
+ aColInsertMF( this, SW_RES(MF_COLINSERT)),
+
+ aHandlingFT( this, SW_RES(FT_HANDLING )),
+ aFixRB( this, SW_RES(RB_FIX )),
+ aFixPropRB( this, SW_RES(RB_FIXPROP )),
+ aVarRB( this, SW_RES(RB_VAR )),
+ aFixFT( this, SW_RES(FT_FIX )),
+ aFixPropFT( this, SW_RES(FT_FIXPROP )),
+ aVarFT( this, SW_RES(FT_VAR )),
+ pWrtShell(0),
+ bHTMLMode(FALSE)
+{
+ FreeResource();
+
+ Link aLnk(LINK(this, SwTableOptionsTabPage, CheckBoxHdl));
+ aNumFormattingCB.SetClickHdl(aLnk);
+ aNumFmtFormattingCB.SetClickHdl(aLnk);
+ aHeaderCB.SetClickHdl(aLnk);
+}
+
+/*-----------------18.01.97 12.43-------------------
+
+--------------------------------------------------*/
+
+SwTableOptionsTabPage::~SwTableOptionsTabPage()
+{
+}
+
+/*-----------------18.01.97 12.43-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* SwTableOptionsTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return new SwTableOptionsTabPage(pParent, rAttrSet );
+}
+
+/*-----------------18.01.97 12.42-------------------
+
+--------------------------------------------------*/
+
+BOOL SwTableOptionsTabPage::FillItemSet( SfxItemSet& )
+{
+ BOOL bRet = FALSE;
+ SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+
+ if(aRowMoveMF.IsModified())
+ pModOpt->SetTblHMove( (USHORT)aRowMoveMF.Denormalize( aRowMoveMF.GetValue(FUNIT_TWIP)));
+
+ if(aColMoveMF.IsModified())
+ pModOpt->SetTblVMove( (USHORT)aColMoveMF.Denormalize( aColMoveMF.GetValue(FUNIT_TWIP)));
+
+ if(aRowInsertMF.IsModified())
+ pModOpt->SetTblHInsert((USHORT)aRowInsertMF.Denormalize( aRowInsertMF.GetValue(FUNIT_TWIP)));
+
+ if(aColInsertMF.IsModified())
+ pModOpt->SetTblVInsert((USHORT)aColInsertMF.Denormalize( aColInsertMF.GetValue(FUNIT_TWIP)));
+
+ TblChgMode eMode;
+ if(aFixRB.IsChecked())
+ eMode = TBLFIX_CHGABS;
+ else if(aFixPropRB.IsChecked())
+ eMode = TBLFIX_CHGPROP;
+ else
+ eMode = TBLVAR_CHGABS;
+ if(eMode != pModOpt->GetTblMode())
+ {
+ pModOpt->SetTblMode(eMode);
+ // der Tabellen-Tastatur-Modus hat sich geaendert, das soll
+ // jetzt auch die aktuelle Tabelle erfahren
+ if(pWrtShell && nsSelectionType::SEL_TBL & pWrtShell->GetSelectionType())
+ {
+ pWrtShell->SetTblChgMode(eMode);
+ static USHORT __READONLY_DATA aInva[] =
+ { FN_TABLE_MODE_FIX,
+ FN_TABLE_MODE_FIX_PROP,
+ FN_TABLE_MODE_VARIABLE,
+ 0
+ };
+ pWrtShell->GetView().GetViewFrame()->GetBindings().Invalidate( aInva );
+ }
+
+ bRet = TRUE;
+ }
+
+ SwInsertTableOptions aInsOpts( 0, 0 );
+
+ if (aHeaderCB.IsChecked())
+ aInsOpts.mnInsMode |= tabopts::HEADLINE;
+
+ if (aRepeatHeaderCB.IsEnabled() )
+ aInsOpts.mnRowsToRepeat = aRepeatHeaderCB.IsChecked()? 1 : 0;
+
+ if (!aDontSplitCB.IsChecked())
+ aInsOpts.mnInsMode |= tabopts::SPLIT_LAYOUT;
+
+ if (aBorderCB.IsChecked())
+ aInsOpts.mnInsMode |= tabopts::DEFAULT_BORDER;
+
+ if (aHeaderCB.GetSavedValue() != aHeaderCB.GetState() ||
+ aRepeatHeaderCB.GetSavedValue() != aRepeatHeaderCB.GetState() ||
+ aDontSplitCB.GetSavedValue() != aDontSplitCB.GetState() ||
+ aBorderCB.GetSavedValue() != aBorderCB.GetState())
+ {
+ pModOpt->SetInsTblFlags(bHTMLMode, aInsOpts);
+ }
+
+ if (aNumFormattingCB.GetSavedValue() != aNumFormattingCB.GetState())
+ {
+ pModOpt->SetInsTblFormatNum(bHTMLMode, aNumFormattingCB.IsChecked());
+ bRet = TRUE;
+ }
+
+ if (aNumFmtFormattingCB.GetSavedValue() != aNumFmtFormattingCB.GetState())
+ {
+ pModOpt->SetInsTblChangeNumFormat(bHTMLMode, aNumFmtFormattingCB.IsChecked());
+ bRet = TRUE;
+ }
+
+ if (aNumAlignmentCB.GetSavedValue() != aNumAlignmentCB.GetState())
+ {
+ pModOpt->SetInsTblAlignNum(bHTMLMode, aNumAlignmentCB.IsChecked());
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+/*-----------------18.01.97 12.42-------------------
+
+--------------------------------------------------*/
+void SwTableOptionsTabPage::Reset( const SfxItemSet& rSet)
+{
+ const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+ if ( rSet.GetItemState( SID_ATTR_METRIC ) >= SFX_ITEM_AVAILABLE )
+ {
+ const SfxUInt16Item& rItem = (SfxUInt16Item&)rSet.Get( SID_ATTR_METRIC );
+ FieldUnit eFieldUnit = (FieldUnit)rItem.GetValue();
+ ::SetFieldUnit( aRowMoveMF, eFieldUnit );
+ ::SetFieldUnit( aColMoveMF, eFieldUnit );
+ ::SetFieldUnit( aRowInsertMF, eFieldUnit );
+ ::SetFieldUnit( aColInsertMF, eFieldUnit );
+ }
+
+ aRowMoveMF .SetValue(aRowMoveMF.Normalize(pModOpt->GetTblHMove()), FUNIT_TWIP);
+ aColMoveMF .SetValue(aColMoveMF.Normalize(pModOpt->GetTblVMove()), FUNIT_TWIP);
+ aRowInsertMF.SetValue(aRowInsertMF.Normalize(pModOpt->GetTblHInsert()), FUNIT_TWIP);
+ aColInsertMF.SetValue(aColInsertMF.Normalize(pModOpt->GetTblVInsert()), FUNIT_TWIP);
+
+ switch(pModOpt->GetTblMode())
+ {
+ case TBLFIX_CHGABS: aFixRB.Check(); break;
+ case TBLFIX_CHGPROP: aFixPropRB.Check(); break;
+ case TBLVAR_CHGABS: aVarRB.Check(); break;
+ }
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem))
+ {
+ bHTMLMode = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON);
+ }
+
+ //bestimmte Controls fuer HTML verstecken
+ if(bHTMLMode)
+ {
+/* Point aPos(aCaptionFL.GetPosPixel());
+ long nYDiff = aTableFL.GetPosPixel().Y() - aPos.Y();
+ aTableFL.SetPosPixel(aPos);
+
+ aPos = aHeaderCB.GetPosPixel();
+ aPos.Y() -= nYDiff;
+ aHeaderCB.SetPosPixel(aPos);
+
+ aPos = aRepeatHeaderCB.GetPosPixel();
+ aPos.Y() -= nYDiff;
+ aRepeatHeaderCB.SetPosPixel(aPos);
+
+ aPos = aDontSplitCB.GetPosPixel(); // hier muss eine Luecke geschlossen werden
+ aPos.Y() -= nYDiff;
+ aBorderCB.SetPosPixel(aPos);
+
+ aPos = aTableInsertFL.GetPosPixel();
+ aPos.Y() -= nYDiff;
+ aTableInsertFL.SetPosPixel(aPos);
+
+ aPos = aNumFormattingCB.GetPosPixel();
+ aPos.Y() -= nYDiff;
+ aNumFormattingCB.SetPosPixel(aPos);
+
+ aPos = aNumFmtFormattingCB.GetPosPixel();
+ aPos.Y() -= nYDiff;
+ aNumFmtFormattingCB.SetPosPixel(aPos);
+
+ aPos = aNumAlignmentCB.GetPosPixel();
+ aPos.Y() -= nYDiff;
+ aNumAlignmentCB.SetPosPixel(aPos);
+
+ aCaptionFL.Hide();
+ aCaptionCB.Hide();
+ aCaptionFT.Hide();
+ aCaptionPB.Hide();
+*/
+ aDontSplitCB.Hide();
+ }
+
+ SwInsertTableOptions aInsOpts = pModOpt->GetInsTblFlags(bHTMLMode);
+ USHORT nInsTblFlags = aInsOpts.mnInsMode;
+
+ aHeaderCB.Check(0 != (nInsTblFlags & tabopts::HEADLINE));
+ aRepeatHeaderCB.Check(aInsOpts.mnRowsToRepeat > 0);
+ aDontSplitCB.Check(!(nInsTblFlags & tabopts::SPLIT_LAYOUT));
+ aBorderCB.Check(0 != (nInsTblFlags & tabopts::DEFAULT_BORDER));
+
+ aNumFormattingCB.Check(pModOpt->IsInsTblFormatNum(bHTMLMode));
+ aNumFmtFormattingCB.Check(pModOpt->IsInsTblChangeNumFormat(bHTMLMode));
+ aNumAlignmentCB.Check(pModOpt->IsInsTblAlignNum(bHTMLMode));
+
+ aHeaderCB.SaveValue();
+ aRepeatHeaderCB.SaveValue();
+ aDontSplitCB.SaveValue();
+ aBorderCB.SaveValue();
+ aNumFormattingCB.SaveValue();
+ aNumFmtFormattingCB.SaveValue();
+ aNumAlignmentCB.SaveValue();
+
+ CheckBoxHdl(0);
+}
+/*-----------------18.01.97 12.42-------------------
+
+--------------------------------------------------*/
+IMPL_LINK(SwTableOptionsTabPage, CheckBoxHdl, CheckBox*, EMPTYARG)
+{
+ aNumFmtFormattingCB.Enable(aNumFormattingCB.IsChecked());
+ aNumAlignmentCB.Enable(aNumFormattingCB.IsChecked());
+ aRepeatHeaderCB.Enable(aHeaderCB.IsChecked());
+ return 0;
+}
+
+void SwTableOptionsTabPage::PageCreated (SfxAllItemSet aSet)
+{
+ SFX_ITEMSET_ARG (&aSet,pWrtSh,SwWrtShellItem,SID_WRT_SHELL,sal_False);
+ if (pWrtSh)
+ SetWrtShell(pWrtSh->GetValue());
+}
+/* */
+
+/*-----------------31.10.97 17:55-------------------
+ TabPage fuer ShadowCrsr
+--------------------------------------------------*/
+
+SwShdwCrsrOptionsTabPage::SwShdwCrsrOptionsTabPage( Window* pParent,
+ const SfxItemSet& rSet )
+ : SfxTabPage(pParent, SW_RES(TP_OPTSHDWCRSR), rSet),
+ aUnprintFL ( this, SW_RES( FL_NOPRINT ) ),
+ aParaCB ( this, SW_RES( CB_PARA ) ),
+ aSHyphCB ( this, SW_RES( CB_SHYPH ) ),
+ aSpacesCB ( this, SW_RES( CB_SPACE ) ),
+ aHSpacesCB ( this, SW_RES( CB_HSPACE ) ),
+ aTabCB ( this, SW_RES( CB_TAB ) ),
+ aBreakCB ( this, SW_RES( CB_BREAK ) ),
+ aCharHiddenCB ( this, SW_RES( CB_CHAR_HIDDEN ) ),
+ aFldHiddenCB ( this, SW_RES( CB_FLD_HIDDEN ) ),
+ aFldHiddenParaCB ( this, SW_RES( CB_FLD_HIDDEN_PARA ) ),
+
+ aSeparatorFL( this, SW_RES( FL_SEPARATOR_SHDW)),
+
+ aFlagFL( this, SW_RES( FL_SHDWCRSFLAG )),
+ aOnOffCB( this, SW_RES( CB_SHDWCRSONOFF )),
+
+ aFillModeFT( this, SW_RES( FT_SHDWCRSFILLMODE )),
+ aFillMarginRB( this, SW_RES( RB_SHDWCRSFILLMARGIN )),
+ aFillIndentRB( this, SW_RES( RB_SHDWCRSFILLINDENT )),
+ aFillTabRB( this, SW_RES( RB_SHDWCRSFILLTAB )),
+ aFillSpaceRB( this, SW_RES( RB_SHDWCRSFILLSPACE )),
+ aCrsrOptFL ( this, SW_RES( FL_CRSR_OPT)),
+ aCrsrInProtCB( this, SW_RES( CB_ALLOW_IN_PROT )),
+ m_aLayoutOptionsFL( this, SW_RES( FL_LAYOUT_OPTIONS ) ),
+ m_aMathBaselineAlignmentCB( this, SW_RES( CB_MATH_BASELINE_ALIGNMENT ) ),
+ m_pWrtShell( NULL )
+{
+ FreeResource();
+ const SfxPoolItem* pItem = 0;
+
+ SwShadowCursorItem aOpt;
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, FALSE, &pItem ))
+ aOpt = *(SwShadowCursorItem*)pItem;
+ aOnOffCB.Check( aOpt.IsOn() );
+
+ BYTE eMode = aOpt.GetMode();
+ aFillIndentRB.Check( FILL_INDENT == eMode );
+ aFillMarginRB.Check( FILL_MARGIN == eMode );
+ aFillTabRB.Check( FILL_TAB == eMode );
+ aFillSpaceRB.Check( FILL_SPACE == eMode );
+
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem )
+ && ((SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON)
+ {
+ aTabCB .Hide();
+ aCharHiddenCB.Hide();
+ aFldHiddenCB .Hide();
+ aFldHiddenParaCB.Hide();
+ aBreakCB.SetPosPixel(aTabCB.GetPosPixel());
+ aFlagFL .Hide();
+ aOnOffCB .Hide();
+ aFillModeFT .Hide();
+ aFillMarginRB .Hide();
+ aFillIndentRB .Hide();
+ aFillTabRB .Hide();
+ aFillSpaceRB .Hide();
+ aCrsrOptFL .Hide();
+ aCrsrInProtCB .Hide();
+ aSeparatorFL.Hide();
+ long nWidth = aFlagFL.GetSizePixel().Width() + aFlagFL.GetPosPixel().X()
+ - aUnprintFL.GetPosPixel().X();
+ Size aSize(aUnprintFL.GetSizePixel());
+ aSize.Width() = nWidth;
+ aUnprintFL.SetSizePixel(aSize);
+ }
+}
+
+SwShdwCrsrOptionsTabPage::~SwShdwCrsrOptionsTabPage()
+{
+}
+
+
+SfxTabPage* SwShdwCrsrOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SwShdwCrsrOptionsTabPage( pParent, rSet );
+}
+
+
+void SwShdwCrsrOptionsTabPage::PageCreated( SfxAllItemSet aSet )
+{
+ SFX_ITEMSET_ARG (&aSet,pWrtSh,SwWrtShellItem,SID_WRT_SHELL,sal_False);
+ if (pWrtSh)
+ SetWrtShell(pWrtSh->GetValue());
+}
+
+
+BOOL SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ SwShadowCursorItem aOpt;
+ aOpt.SetOn( aOnOffCB.IsChecked() );
+
+ BYTE eMode;
+ if( aFillIndentRB.IsChecked() )
+ eMode= FILL_INDENT;
+ else if( aFillMarginRB.IsChecked() )
+ eMode = FILL_MARGIN;
+ else if( aFillTabRB.IsChecked() )
+ eMode = FILL_TAB;
+ else
+ eMode = FILL_SPACE;
+ aOpt.SetMode( eMode );
+
+ BOOL bRet = FALSE;
+ const SfxPoolItem* pItem = 0;
+ if( SFX_ITEM_SET != rSet.GetItemState( FN_PARAM_SHADOWCURSOR, FALSE, &pItem )
+ || ((SwShadowCursorItem&)*pItem) != aOpt )
+ {
+ rSet.Put( aOpt );
+ bRet = TRUE;
+ }
+
+ m_pWrtShell->GetDoc()->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT,
+ m_aMathBaselineAlignmentCB.IsChecked() );
+ bRet |= m_aMathBaselineAlignmentCB.IsChecked() != m_aMathBaselineAlignmentCB.GetSavedValue();
+
+ if( aCrsrInProtCB.IsChecked() != aCrsrInProtCB.GetSavedValue())
+ {
+ rSet.Put(SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aCrsrInProtCB.IsChecked()));
+ bRet |= TRUE;
+ }
+
+ const SwDocDisplayItem* pOldAttr = (const SwDocDisplayItem*)
+ GetOldItem(GetItemSet(), FN_PARAM_DOCDISP);
+
+ SwDocDisplayItem aDisp;
+ if(pOldAttr)
+ aDisp = *pOldAttr;
+ //
+ aDisp.bParagraphEnd = aParaCB .IsChecked();
+ aDisp.bTab = aTabCB .IsChecked();
+ aDisp.bSpace = aSpacesCB .IsChecked();
+ aDisp.bNonbreakingSpace = aHSpacesCB .IsChecked();
+ aDisp.bSoftHyphen = aSHyphCB .IsChecked();
+ aDisp.bFldHiddenText = aFldHiddenCB .IsChecked();
+ aDisp.bCharHiddenText = aCharHiddenCB.IsChecked();
+ aDisp.bShowHiddenPara = aFldHiddenParaCB .IsChecked();
+ aDisp.bManualBreak = aBreakCB .IsChecked();
+
+ bRet |= (!pOldAttr || aDisp != *pOldAttr);
+ if(bRet)
+ bRet = 0 != rSet.Put(aDisp);
+
+ return bRet;
+}
+
+void SwShdwCrsrOptionsTabPage::Reset( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem = 0;
+
+ SwShadowCursorItem aOpt;
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, FALSE, &pItem ))
+ aOpt = *(SwShadowCursorItem*)pItem;
+ aOnOffCB.Check( aOpt.IsOn() );
+
+ BYTE eMode = aOpt.GetMode();
+ aFillIndentRB.Check( FILL_INDENT == eMode );
+ aFillMarginRB.Check( FILL_MARGIN == eMode );
+ aFillTabRB.Check( FILL_TAB == eMode );
+ aFillSpaceRB.Check( FILL_SPACE == eMode );
+
+ m_aMathBaselineAlignmentCB.Check( m_pWrtShell->GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) );
+ m_aMathBaselineAlignmentCB.SaveValue();
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, FALSE, &pItem ))
+ aCrsrInProtCB.Check(((const SfxBoolItem*)pItem)->GetValue());
+ aCrsrInProtCB.SaveValue();
+
+ const SwDocDisplayItem* pDocDisplayAttr = 0;
+
+ rSet.GetItemState( FN_PARAM_DOCDISP, FALSE,
+ (const SfxPoolItem**)&pDocDisplayAttr );
+ if(pDocDisplayAttr)
+ {
+ aParaCB .Check (pDocDisplayAttr->bParagraphEnd );
+ aTabCB .Check (pDocDisplayAttr->bTab );
+ aSpacesCB .Check (pDocDisplayAttr->bSpace );
+ aHSpacesCB .Check (pDocDisplayAttr->bNonbreakingSpace );
+ aSHyphCB .Check (pDocDisplayAttr->bSoftHyphen );
+ aCharHiddenCB.Check (pDocDisplayAttr->bCharHiddenText );
+ aFldHiddenCB .Check (pDocDisplayAttr->bFldHiddenText );
+ aFldHiddenParaCB.Check (pDocDisplayAttr->bShowHiddenPara );
+ aBreakCB .Check (pDocDisplayAttr->bManualBreak );
+ }
+}
+
+/*-----------------31.10.97 17:55-------------------
+ TabPage fuer Redlining
+--------------------------------------------------*/
+
+struct CharAttr
+{
+ USHORT nItemId;
+ USHORT nAttr;
+};
+
+// Editieren entspricht Einfuegen-Attributen
+static CharAttr __FAR_DATA aRedlineAttr[] =
+{
+ { SID_ATTR_CHAR_CASEMAP, SVX_CASEMAP_NOT_MAPPED },
+ { SID_ATTR_CHAR_WEIGHT, WEIGHT_BOLD },
+ { SID_ATTR_CHAR_POSTURE, ITALIC_NORMAL },
+ { SID_ATTR_CHAR_UNDERLINE, UNDERLINE_SINGLE },
+ { SID_ATTR_CHAR_UNDERLINE, UNDERLINE_DOUBLE },
+ { SID_ATTR_CHAR_STRIKEOUT, STRIKEOUT_SINGLE },
+ { SID_ATTR_CHAR_CASEMAP, SVX_CASEMAP_VERSALIEN },
+ { SID_ATTR_CHAR_CASEMAP, SVX_CASEMAP_GEMEINE },
+ { SID_ATTR_CHAR_CASEMAP, SVX_CASEMAP_KAPITAELCHEN },
+ { SID_ATTR_CHAR_CASEMAP, SVX_CASEMAP_TITEL },
+ { SID_ATTR_BRUSH, 0 }
+};
+// Items from aRedlineAttr relevant for InsertAttr: strikethrough is
+// not used
+static USHORT aInsertAttrMap[] = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 };
+
+// Items from aRedlineAttr relevant for DeleteAttr: underline and
+// double underline is not used
+static USHORT aDeletedAttrMap[] = { 0, 1, 2, 5, 6, 7, 8, 9, 10 };
+
+// Items from aRedlineAttr relevant for ChangeAttr: strikethrough is
+// not used
+static USHORT aChangedAttrMap[] = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10 };
+
+/*-----------------------------------------------------------------------
+ Beschreibung: Markierungsvorschau
+ -----------------------------------------------------------------------*/
+
+SwMarkPreview::SwMarkPreview( Window *pParent, const ResId& rResID ) :
+
+ Window(pParent, rResID),
+ m_aTransCol( COL_TRANSPARENT ),
+ m_aMarkCol( COL_LIGHTRED ),
+ nMarkPos(0)
+
+{
+ InitColors();
+ SetMapMode(MAP_PIXEL);
+
+ const Size aSz(GetOutputSizePixel());
+
+ // Seite
+ aPage.SetSize(Size(aSz.Width() - 3, aSz.Height() - 3));
+
+ ULONG nOutWPix = aPage.GetWidth();
+ ULONG nOutHPix = aPage.GetHeight();
+
+ // PrintArea
+ ULONG nLBorder = 8;
+ ULONG nRBorder = 8;
+ ULONG nTBorder = 4;
+ ULONG nBBorder = 4;
+
+ aLeftPagePrtArea = Rectangle(Point(nLBorder, nTBorder), Point((nOutWPix - 1) - nRBorder, (nOutHPix - 1) - nBBorder));
+ USHORT nWidth = (USHORT)aLeftPagePrtArea.GetWidth();
+ USHORT nKorr = (nWidth & 1) != 0 ? 0 : 1;
+ aLeftPagePrtArea.SetSize(Size(nWidth / 2 - (nLBorder + nRBorder) / 2 + nKorr, aLeftPagePrtArea.GetHeight()));
+
+ aRightPagePrtArea = aLeftPagePrtArea;
+ aRightPagePrtArea.Move(aLeftPagePrtArea.GetWidth() + nLBorder + nRBorder + 1, 0);
+}
+
+SwMarkPreview::~SwMarkPreview()
+{
+}
+
+void SwMarkPreview::InitColors( void )
+{
+ // m_aTransCol and m_aMarkCol are _not_ changed because they are set from outside!
+
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+ m_aBgCol = Color( rSettings.GetWindowColor() );
+
+ BOOL bHC = rSettings.GetHighContrastMode();
+ m_aLineCol = bHC? SwViewOption::GetFontColor() : Color( COL_BLACK );
+ m_aShadowCol = bHC? m_aBgCol : rSettings.GetShadowColor();
+ m_aTxtCol = bHC? SwViewOption::GetFontColor() : Color( COL_GRAY );
+ m_aPrintAreaCol = m_aTxtCol;
+}
+
+void SwMarkPreview::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ if( rDCEvt.GetType() == DATACHANGED_SETTINGS && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
+ InitColors();
+}
+
+void SwMarkPreview::Paint(const Rectangle &/*rRect*/)
+{
+ // Schatten zeichnen
+ Rectangle aShadow(aPage);
+ aShadow += Point(3, 3);
+ DrawRect( aShadow, m_aShadowCol, m_aTransCol );
+
+ // Seite zeichnen
+ DrawRect( aPage, m_aBgCol, m_aLineCol );
+
+ // Separator zeichnen
+ Rectangle aPageSeparator(aPage);
+ aPageSeparator.SetSize(Size(2, aPageSeparator.GetHeight()));
+ aPageSeparator.Move(aPage.GetWidth() / 2 - 1, 0);
+ DrawRect( aPageSeparator, m_aLineCol, m_aTransCol );
+
+ PaintPage(aLeftPagePrtArea);
+ PaintPage(aRightPagePrtArea);
+
+ Rectangle aLeftMark(Point(aPage.Left() + 2, aLeftPagePrtArea.Top() + 4), Size(aLeftPagePrtArea.Left() - 4, 2));
+ Rectangle aRightMark(Point(aRightPagePrtArea.Right() + 2, aRightPagePrtArea.Bottom() - 6), Size(aLeftPagePrtArea.Left() - 4, 2));
+
+ switch (nMarkPos)
+ {
+ case 1: // Links
+ aRightMark.SetPos(Point(aRightPagePrtArea.Left() - 2 - aRightMark.GetWidth(), aRightMark.Top()));
+ break;
+
+ case 2: // Rechts
+ aLeftMark.SetPos(Point(aLeftPagePrtArea.Right() + 2, aLeftMark.Top()));
+ break;
+
+ case 3: // Aussen
+ break;
+
+ case 4: // Innen
+ aLeftMark.SetPos(Point(aLeftPagePrtArea.Right() + 2, aLeftMark.Top()));
+ aRightMark.SetPos(Point(aRightPagePrtArea.Left() - 2 - aRightMark.GetWidth(), aRightMark.Top()));
+ break;
+
+ case 0: // Keine
+ default:
+ return;
+ }
+ DrawRect( aLeftMark, m_aMarkCol, m_aTransCol );
+ DrawRect( aRightMark, m_aMarkCol, m_aTransCol );
+}
+
+void SwMarkPreview::PaintPage(const Rectangle &rRect)
+{
+ // PrintArea zeichnen
+ DrawRect(rRect, m_aTransCol, m_aPrintAreaCol );
+
+ // Testabsatz zeichnen
+ ULONG nLTxtBorder = 4;
+ ULONG nRTxtBorder = 4;
+ ULONG nTTxtBorder = 4;
+
+ Rectangle aTextLine = rRect;
+ aTextLine.SetSize(Size(aTextLine.GetWidth(), 2));
+ aTextLine.Left() += nLTxtBorder;
+ aTextLine.Right() -= nRTxtBorder;
+ aTextLine.Move(0, nTTxtBorder);
+
+ sal_Int32 nStep;
+ USHORT nLines;
+
+ nStep = aTextLine.GetHeight() + 2;
+ nLines = (USHORT)(rRect.GetHeight() / (aTextLine.GetHeight() + 2)) - 1;
+
+ // Text simulieren
+ //
+ for (USHORT i = 0; i < nLines; ++i)
+ {
+ if (i == (nLines - 1))
+ aTextLine.SetSize(Size(aTextLine.GetWidth() / 2, aTextLine.GetHeight()));
+
+ if (aPage.IsInside(aTextLine))
+ DrawRect(aTextLine, m_aTxtCol, m_aTransCol );
+
+ aTextLine.Move(0, nStep);
+ }
+ aTextLine.Move(0, -nStep);
+}
+
+void SwMarkPreview::DrawRect(const Rectangle &rRect, const Color &rFillColor, const Color &rLineColor)
+{
+ SetFillColor(rFillColor);
+ SetLineColor(rLineColor);
+ Window::DrawRect(rRect);
+}
+
+namespace
+{
+ void lcl_FillRedlineAttrListBox(
+ ListBox& rLB, const AuthorCharAttr& rAttrToSelect,
+ const USHORT* pAttrMap, const USHORT nAttrMapSize)
+ {
+ for (USHORT i = 0; i != nAttrMapSize; ++i)
+ {
+ CharAttr& rAttr(aRedlineAttr[pAttrMap[i]]);
+ rLB.SetEntryData(i, &rAttr);
+ if (rAttr.nItemId == rAttrToSelect.nItemId &&
+ rAttr.nAttr == rAttrToSelect.nAttr)
+ rLB.SelectEntryPos(i);
+ }
+ }
+}
+
+SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( Window* pParent,
+ const SfxItemSet& rSet )
+ : SfxTabPage(pParent, SW_RES(TP_REDLINE_OPT), rSet),
+
+ aInsertFL( this, SW_RES( FL_TE )),
+
+ aInsertFT( this, SW_RES( FT_CHG_INSERT )),
+ aInsertAttrFT( this, SW_RES( FT_INS_ATTR )),
+ aInsertLB( this, SW_RES( LB_INS_ATTR )),
+ aInsertColorFT( this, SW_RES( FT_INS_COL )),
+ aInsertColorLB( this, SW_RES( LB_INS_COL )),
+ aInsertedPreviewWN( this, SW_RES( WIN_INS )),
+
+ aDeletedFT( this, SW_RES( FT_CHG_DELETE )),
+ aDeletedAttrFT( this, SW_RES( FT_DEL_ATTR )),
+ aDeletedLB( this, SW_RES( LB_DEL_ATTR )),
+ aDeletedColorFT( this, SW_RES( FT_DEL_COL )),
+ aDeletedColorLB( this, SW_RES( LB_DEL_COL )),
+ aDeletedPreviewWN( this, SW_RES( WIN_DEL )),
+
+ aChangedFT( this, SW_RES( FT_CHG_CHANGE )),
+ aChangedAttrFT( this, SW_RES( FT_CHG_ATTR )),
+ aChangedLB( this, SW_RES( LB_CHG_ATTR )),
+ aChangedColorFT( this, SW_RES( FT_CHG_COL )),
+ aChangedColorLB( this, SW_RES( LB_CHG_COL )),
+ aChangedPreviewWN( this, SW_RES( WIN_CHG )),
+
+ aChangedFL ( this, SW_RES( FL_LC )),
+
+ aMarkPosFT ( this, SW_RES( FT_MARKPOS )),
+ aMarkPosLB ( this, SW_RES( LB_MARKPOS )),
+ aMarkColorFT ( this, SW_RES( FT_LC_COL )),
+ aMarkColorLB ( this, SW_RES( LB_LC_COL )),
+ aMarkPreviewWN ( this, SW_RES( WIN_MARK )),
+
+ sAuthor ( SW_RES( STR_AUTHOR )),
+ sNone ( SW_RES( STR_NOTHING ))
+
+{
+ FreeResource();
+
+ for(USHORT i = 0; i < aInsertLB.GetEntryCount(); i++)
+ {
+ String sEntry(aInsertLB.GetEntry(i));
+ aDeletedLB.InsertEntry(sEntry);
+ aChangedLB.InsertEntry(sEntry);
+ };
+
+ // remove strikethrough from insert and change and underline + double
+ // underline from delete
+ aInsertLB.RemoveEntry(5);
+ aChangedLB.RemoveEntry(5);
+ aDeletedLB.RemoveEntry(4);
+ aDeletedLB.RemoveEntry(3);
+
+ Link aLk = LINK(this, SwRedlineOptionsTabPage, AttribHdl);
+ aInsertLB.SetSelectHdl( aLk );
+ aDeletedLB.SetSelectHdl( aLk );
+ aChangedLB.SetSelectHdl( aLk );
+
+ aLk = LINK(this, SwRedlineOptionsTabPage, ColorHdl);
+ aInsertColorLB.SetSelectHdl( aLk );
+ aDeletedColorLB.SetSelectHdl( aLk );
+ aChangedColorLB.SetSelectHdl( aLk );
+
+ aLk = LINK(this, SwRedlineOptionsTabPage, ChangedMaskPrevHdl);
+ aMarkPosLB.SetSelectHdl( aLk );
+ aMarkColorLB.SetSelectHdl( aLk );
+}
+
+SwRedlineOptionsTabPage::~SwRedlineOptionsTabPage()
+{
+}
+
+SfxTabPage* SwRedlineOptionsTabPage::Create( Window* pParent, const SfxItemSet& rSet)
+{
+ return new SwRedlineOptionsTabPage( pParent, rSet );
+}
+
+BOOL SwRedlineOptionsTabPage::FillItemSet( SfxItemSet& )
+{
+ CharAttr *pAttr;
+ SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig();
+
+ AuthorCharAttr aInsertedAttr;
+ AuthorCharAttr aDeletedAttr;
+ AuthorCharAttr aChangedAttr;
+
+ AuthorCharAttr aOldInsertAttr(pOpt->GetInsertAuthorAttr());
+ AuthorCharAttr aOldDeletedAttr(pOpt->GetDeletedAuthorAttr());
+ AuthorCharAttr aOldChangedAttr(pOpt->GetFormatAuthorAttr());
+
+ ColorData nOldMarkColor = pOpt->GetMarkAlignColor().GetColor();
+ USHORT nOldMarkMode = pOpt->GetMarkAlignMode();
+
+ USHORT nPos = aInsertLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ pAttr = (CharAttr *)aInsertLB.GetEntryData(nPos);
+ aInsertedAttr.nItemId = pAttr->nItemId;
+ aInsertedAttr.nAttr = pAttr->nAttr;
+
+ nPos = aInsertColorLB.GetSelectEntryPos();
+
+ switch (nPos)
+ {
+ case 0:
+ aInsertedAttr.nColor = COL_NONE;
+ break;
+ case 1:
+ case LISTBOX_ENTRY_NOTFOUND:
+ aInsertedAttr.nColor = COL_TRANSPARENT;
+ break;
+ default:
+ aInsertedAttr.nColor = aInsertColorLB.GetEntryColor(nPos).GetColor();
+ break;
+ }
+
+ pOpt->SetInsertAuthorAttr(aInsertedAttr);
+ }
+
+ nPos = aDeletedLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ pAttr = (CharAttr *)aDeletedLB.GetEntryData(nPos);
+ aDeletedAttr.nItemId = pAttr->nItemId;
+ aDeletedAttr.nAttr = pAttr->nAttr;
+
+ nPos = aDeletedColorLB.GetSelectEntryPos();
+
+ switch (nPos)
+ {
+ case 0:
+ aDeletedAttr.nColor = COL_NONE;
+ break;
+ case 1:
+ case LISTBOX_ENTRY_NOTFOUND:
+ aDeletedAttr.nColor = COL_TRANSPARENT;
+ break;
+ default:
+ aDeletedAttr.nColor = aDeletedColorLB.GetEntryColor(nPos).GetColor();
+ break;
+ }
+
+ pOpt->SetDeletedAuthorAttr(aDeletedAttr);
+ }
+
+ nPos = aChangedLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ pAttr = (CharAttr *)aChangedLB.GetEntryData(nPos);
+ aChangedAttr.nItemId = pAttr->nItemId;
+ aChangedAttr.nAttr = pAttr->nAttr;
+
+ nPos = aChangedColorLB.GetSelectEntryPos();
+
+ switch (nPos)
+ {
+ case 0:
+ aChangedAttr.nColor = COL_NONE;
+ break;
+ case 1:
+ case LISTBOX_ENTRY_NOTFOUND:
+ aChangedAttr.nColor = COL_TRANSPARENT;
+ break;
+ default:
+ aChangedAttr.nColor = aChangedColorLB.GetEntryColor(nPos).GetColor();
+ break;
+ }
+
+ pOpt->SetFormatAuthorAttr(aChangedAttr);
+ }
+
+ nPos = 0;
+ switch (aMarkPosLB.GetSelectEntryPos())
+ {
+ case 0: nPos = text::HoriOrientation::NONE; break;
+ case 1: nPos = text::HoriOrientation::LEFT; break;
+ case 2: nPos = text::HoriOrientation::RIGHT; break;
+ case 3: nPos = text::HoriOrientation::OUTSIDE; break;
+ case 4: nPos = text::HoriOrientation::INSIDE; break;
+ }
+ pOpt->SetMarkAlignMode(nPos);
+
+ pOpt->SetMarkAlignColor(aMarkColorLB.GetSelectEntryColor());
+
+ if (!(aInsertedAttr == aOldInsertAttr) ||
+ !(aDeletedAttr == aOldDeletedAttr) ||
+ !(aChangedAttr == aOldChangedAttr) ||
+ nOldMarkColor != pOpt->GetMarkAlignColor().GetColor() ||
+ nOldMarkMode != pOpt->GetMarkAlignMode())
+ {
+ // Alle Dokumente aktualisieren
+ TypeId aType(TYPE(SwDocShell));
+ SwDocShell* pDocShell = (SwDocShell*)SfxObjectShell::GetFirst(&aType);
+
+ while( pDocShell )
+ {
+ pDocShell->GetWrtShell()->UpdateRedlineAttr();
+ pDocShell = (SwDocShell*)SfxObjectShell::GetNext(*pDocShell, &aType);
+ }
+ }
+
+ return FALSE;
+}
+
+void SwRedlineOptionsTabPage::Reset( const SfxItemSet& )
+{
+ const SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig();
+
+ const AuthorCharAttr &rInsertAttr = pOpt->GetInsertAuthorAttr();
+ const AuthorCharAttr &rDeletedAttr = pOpt->GetDeletedAuthorAttr();
+ const AuthorCharAttr &rChangedAttr = pOpt->GetFormatAuthorAttr();
+
+ // Preview initialisieren
+ InitFontStyle(aInsertedPreviewWN);
+ InitFontStyle(aDeletedPreviewWN);
+ InitFontStyle(aChangedPreviewWN);
+
+ // Farblistboxen initialisieren
+ String sColor;
+ aInsertColorLB.SetUpdateMode(FALSE);
+ aDeletedColorLB.SetUpdateMode(FALSE);
+ aChangedColorLB.SetUpdateMode(FALSE);
+ aMarkColorLB.SetUpdateMode(FALSE);
+
+ aInsertColorLB.InsertEntry(sNone);
+ aDeletedColorLB.InsertEntry(sNone);
+ aChangedColorLB.InsertEntry(sNone);
+
+ aInsertColorLB.InsertEntry(sAuthor);
+ aDeletedColorLB.InsertEntry(sAuthor);
+ aChangedColorLB.InsertEntry(sAuthor);
+
+ XColorTable* pColorTbl = XColorTable::GetStdColorTable();
+ USHORT i;
+ for( i = 0; i < pColorTbl->Count(); ++i )
+ {
+ XColorEntry* pEntry = pColorTbl->GetColor( i );
+ Color aColor = pEntry->GetColor();
+ String sName = pEntry->GetName();
+
+ aInsertColorLB.InsertEntry( aColor, sName );
+ aDeletedColorLB.InsertEntry( aColor, sName );
+ aChangedColorLB.InsertEntry( aColor, sName );
+ aMarkColorLB.InsertEntry( aColor, sName );
+ }
+ aInsertColorLB.SetUpdateMode( TRUE );
+ aDeletedColorLB.SetUpdateMode( TRUE );
+ aChangedColorLB.SetUpdateMode( TRUE );
+ aMarkColorLB.SetUpdateMode( TRUE );
+
+ ColorData nColor = rInsertAttr.nColor;
+
+ switch (nColor)
+ {
+ case COL_TRANSPARENT:
+ aInsertColorLB.SelectEntryPos(1);
+ break;
+ case COL_NONE:
+ aInsertColorLB.SelectEntryPos(0);
+ break;
+ default:
+ aInsertColorLB.SelectEntry(Color(nColor));
+ }
+
+ nColor = rDeletedAttr.nColor;
+
+ switch (nColor)
+ {
+ case COL_TRANSPARENT:
+ aDeletedColorLB.SelectEntryPos(1);
+ break;
+ case COL_NONE:
+ aDeletedColorLB.SelectEntryPos(0);
+ break;
+ default:
+ aDeletedColorLB.SelectEntry(Color(nColor));
+ }
+
+ nColor = rChangedAttr.nColor;
+
+ switch (nColor)
+ {
+ case COL_TRANSPARENT:
+ aChangedColorLB.SelectEntryPos(1);
+ break;
+ case COL_NONE:
+ aChangedColorLB.SelectEntryPos(0);
+ break;
+ default:
+ aChangedColorLB.SelectEntry(Color(nColor));
+ }
+
+ aMarkColorLB.SelectEntry(pOpt->GetMarkAlignColor());
+
+ aInsertLB.SelectEntryPos(0);
+ aDeletedLB.SelectEntryPos(0);
+ aChangedLB.SelectEntryPos(0);
+
+ lcl_FillRedlineAttrListBox(aInsertLB, rInsertAttr, aInsertAttrMap,
+ sizeof(aInsertAttrMap) / sizeof(USHORT));
+ lcl_FillRedlineAttrListBox(aDeletedLB, rDeletedAttr, aDeletedAttrMap,
+ sizeof(aDeletedAttrMap) / sizeof(USHORT));
+ lcl_FillRedlineAttrListBox(aChangedLB, rChangedAttr, aChangedAttrMap,
+ sizeof(aChangedAttrMap) / sizeof(USHORT));
+
+ USHORT nPos = 0;
+ switch (pOpt->GetMarkAlignMode())
+ {
+ case text::HoriOrientation::NONE: nPos = 0; break;
+ case text::HoriOrientation::LEFT: nPos = 1; break;
+ case text::HoriOrientation::RIGHT: nPos = 2; break;
+ case text::HoriOrientation::OUTSIDE: nPos = 3; break;
+ case text::HoriOrientation::INSIDE: nPos = 4; break;
+ }
+ aMarkPosLB.SelectEntryPos(nPos);
+
+ // Einstellungen in Preview anzeigen
+ AttribHdl(&aInsertLB);
+ ColorHdl(&aInsertColorLB);
+ AttribHdl(&aDeletedLB);
+ ColorHdl(&aInsertColorLB);
+ AttribHdl(&aChangedLB);
+ ColorHdl(&aChangedColorLB);
+
+ ChangedMaskPrevHdl();
+}
+
+IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox *, pLB )
+{
+ SvxFontPrevWindow *pPrev = 0;
+ ColorListBox *pColorLB;
+
+ if (pLB == &aInsertLB)
+ {
+ pColorLB = &aInsertColorLB;
+ pPrev = &aInsertedPreviewWN;
+ }
+ else if (pLB == &aDeletedLB)
+ {
+ pColorLB = &aDeletedColorLB;
+ pPrev = &aDeletedPreviewWN;
+ }
+ else
+ {
+ pColorLB = &aChangedColorLB;
+ pPrev = &aChangedPreviewWN;
+ }
+
+ SvxFont& rFont = pPrev->GetFont();
+ SvxFont& rCJKFont = pPrev->GetCJKFont();
+
+ rFont.SetWeight(WEIGHT_NORMAL);
+ rCJKFont.SetWeight(WEIGHT_NORMAL);
+ rFont.SetItalic(ITALIC_NONE);
+ rCJKFont.SetItalic(ITALIC_NONE);
+ rFont.SetUnderline(UNDERLINE_NONE);
+ rCJKFont.SetUnderline(UNDERLINE_NONE);
+ rFont.SetStrikeout(STRIKEOUT_NONE);
+ rCJKFont.SetStrikeout(STRIKEOUT_NONE);
+ rFont.SetCaseMap(SVX_CASEMAP_NOT_MAPPED);
+ rCJKFont.SetCaseMap(SVX_CASEMAP_NOT_MAPPED);
+
+ USHORT nPos = pColorLB->GetSelectEntryPos();
+
+ switch( nPos )
+ {
+ case 0:
+ rFont.SetColor( Color( COL_BLACK ) );
+ rCJKFont.SetColor( Color( COL_BLACK ) );
+ break;
+ case 1:
+ case LISTBOX_ENTRY_NOTFOUND:
+ rFont.SetColor( Color( COL_RED ) );
+ rCJKFont.SetColor( Color( COL_RED ) );
+ break;
+ default:
+ rFont.SetColor( pColorLB->GetEntryColor( nPos ) );
+ rCJKFont.SetColor( pColorLB->GetEntryColor( nPos ) );
+ break;
+ }
+
+ nPos = pLB->GetSelectEntryPos();
+ if( nPos == LISTBOX_ENTRY_NOTFOUND )
+ nPos = 0;
+
+ CharAttr* pAttr = ( CharAttr* ) pLB->GetEntryData( nPos );
+ //switch off preview background color
+ pPrev->ResetColor();
+ switch (pAttr->nItemId)
+ {
+ case SID_ATTR_CHAR_WEIGHT:
+ rFont.SetWeight( ( FontWeight ) pAttr->nAttr );
+ rCJKFont.SetWeight( ( FontWeight ) pAttr->nAttr );
+ break;
+
+ case SID_ATTR_CHAR_POSTURE:
+ rFont.SetItalic( ( FontItalic ) pAttr->nAttr );
+ rCJKFont.SetItalic( ( FontItalic ) pAttr->nAttr );
+ break;
+
+ case SID_ATTR_CHAR_UNDERLINE:
+ rFont.SetUnderline( ( FontUnderline ) pAttr->nAttr );
+ rCJKFont.SetUnderline( ( FontUnderline ) pAttr->nAttr );
+ break;
+
+ case SID_ATTR_CHAR_STRIKEOUT:
+ rFont.SetStrikeout( ( FontStrikeout ) pAttr->nAttr );
+ rCJKFont.SetStrikeout( ( FontStrikeout ) pAttr->nAttr );
+ break;
+
+ case SID_ATTR_CHAR_CASEMAP:
+ rFont.SetCaseMap( ( SvxCaseMap ) pAttr->nAttr );
+ rCJKFont.SetCaseMap( ( SvxCaseMap ) pAttr->nAttr );
+ break;
+
+ case SID_ATTR_BRUSH:
+ {
+ nPos = pColorLB->GetSelectEntryPos();
+ if( nPos )
+ pPrev->SetColor( pColorLB->GetSelectEntryColor() );
+ else
+ pPrev->SetColor( Color( COL_LIGHTGRAY ) );
+
+ rFont.SetColor( Color( COL_BLACK ) );
+ rCJKFont.SetColor( Color( COL_BLACK ) );
+ }
+ break;
+ }
+
+ pPrev->Invalidate();
+
+ return 0;
+}
+
+IMPL_LINK( SwRedlineOptionsTabPage, ColorHdl, ColorListBox *, pColorLB )
+{
+ SvxFontPrevWindow *pPrev = 0;
+ ListBox* pLB;
+
+ if (pColorLB == &aInsertColorLB)
+ {
+ pLB = &aInsertLB;
+ pPrev = &aInsertedPreviewWN;
+ }
+ else if (pColorLB == &aDeletedColorLB)
+ {
+ pLB = &aDeletedLB;
+ pPrev = &aDeletedPreviewWN;
+ }
+ else
+ {
+ pLB = &aChangedLB;
+ pPrev = &aChangedPreviewWN;
+ }
+
+ SvxFont& rFont = pPrev->GetFont();
+ SvxFont& rCJKFont = pPrev->GetCJKFont();
+ USHORT nPos = pLB->GetSelectEntryPos();
+ if( nPos == LISTBOX_ENTRY_NOTFOUND )
+ nPos = 0;
+
+ CharAttr* pAttr = ( CharAttr* ) pLB->GetEntryData( nPos );
+
+ if( pAttr->nItemId == SID_ATTR_BRUSH )
+ {
+ rFont.SetColor( Color( COL_BLACK ) );
+ rCJKFont.SetColor( Color( COL_BLACK ) );
+ nPos = pColorLB->GetSelectEntryPos();
+ if( nPos && nPos != LISTBOX_ENTRY_NOTFOUND )
+ pPrev->SetColor( pColorLB->GetSelectEntryColor() );
+ else
+ pPrev->SetColor( Color( COL_LIGHTGRAY ) );
+ }
+ else
+ {
+ nPos = pColorLB->GetSelectEntryPos();
+
+ switch( nPos )
+ {
+ case 0:
+ rFont.SetColor( Color( COL_BLACK ) );
+ rCJKFont.SetColor( Color( COL_BLACK ) );
+ break;
+ case 1:
+ case LISTBOX_ENTRY_NOTFOUND:
+ rFont.SetColor( Color( COL_RED ) );
+ rCJKFont.SetColor( Color( COL_RED ) );
+ break;
+ default:
+ rFont.SetColor( pColorLB->GetEntryColor( nPos ) );
+ rCJKFont.SetColor( pColorLB->GetEntryColor( nPos ) );
+ break;
+ }
+ }
+
+ pPrev->Invalidate();
+
+ return 0;
+}
+
+IMPL_LINK( SwRedlineOptionsTabPage, ChangedMaskPrevHdl, ListBox *, EMPTYARG )
+{
+ aMarkPreviewWN.SetMarkPos(aMarkPosLB.GetSelectEntryPos());
+ aMarkPreviewWN.SetColor(aMarkColorLB.GetSelectEntryColor().GetColor());
+
+ aMarkPreviewWN.Invalidate();
+
+ return 0;
+}
+
+void SwRedlineOptionsTabPage::InitFontStyle(SvxFontPrevWindow& rExampleWin)
+{
+ const AllSettings& rAllSettings = Application::GetSettings();
+ LanguageType eLangType = rAllSettings.GetUILanguage();
+ Color aBackCol( rAllSettings.GetStyleSettings().GetWindowColor() );
+ SvxFont& rFont = rExampleWin.GetFont();
+ SvxFont& rCJKFont = rExampleWin.GetCJKFont();
+ SvxFont& rCTLFont = rExampleWin.GetCTLFont();
+
+ Font aFont( OutputDevice::GetDefaultFont( DEFAULTFONT_SERIF, eLangType,
+ DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) );
+ Font aCJKFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_TEXT, eLangType,
+ DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) );
+ Font aCTLFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_TEXT, eLangType,
+ DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) );
+ const Size aDefSize( 0, 12 );
+ aFont.SetSize( aDefSize );
+ aCJKFont.SetSize( aDefSize );
+ aCTLFont.SetSize( aDefSize );
+
+ aFont.SetFillColor( aBackCol );
+ aCJKFont.SetFillColor( aBackCol );
+ aCTLFont.SetFillColor( aBackCol );
+
+ aFont.SetWeight( WEIGHT_NORMAL );
+ aCJKFont.SetWeight( WEIGHT_NORMAL );
+ aCTLFont.SetWeight( WEIGHT_NORMAL );
+
+ rFont = aFont;
+ rCJKFont = aCJKFont;
+ rCTLFont = aCTLFont;
+
+ const Size aNewSize( 0, rExampleWin.GetOutputSize().Height() * 2 / 3 );
+ rFont.SetSize( aNewSize );
+ rCJKFont.SetSize( aNewSize );
+
+ rExampleWin.SetFont( rFont, rCJKFont,rCTLFont );
+
+ rExampleWin.UseResourceText();
+
+ Wallpaper aWall( aBackCol );
+ rExampleWin.SetBackground( aWall );
+ rExampleWin.Invalidate();
+}
+
+
+#ifdef DBG_UTIL
+/*******************************************************
+ ******************************************************/
+/*----------------- OS 11.01.95 -----------------------
+ TabPage Testeinstellungen
+-------------------------------------------------------*/
+
+void lcl_SetPosSize(Window& rWin, Point aPos, Size aSize)
+{
+ aPos = rWin.LogicToPixel(aPos, MAP_APPFONT);
+ aSize = rWin.OutputDevice::LogicToPixel(aSize, MAP_APPFONT);
+ rWin.SetPosSizePixel(aPos, aSize);
+}
+
+SwTestTabPage::SwTestTabPage( Window* pParent,
+ const SfxItemSet& rCoreSet) :
+ SfxTabPage( pParent, WB_HIDE, rCoreSet),
+ aTestFL ( this, WB_GROUP ),
+ aTest1CBox ( this, 0 ),
+ aTest2CBox ( this, 0 ),
+ aTest3CBox ( this, 0 ),
+ aTest4CBox ( this, 0 ),
+ aTest5CBox ( this, 0 ),
+ aTest6CBox ( this, 0 ),
+ aTest7CBox ( this, 0 ),
+ aTest8CBox ( this, 0 ),
+ aTest9CBox ( this, 0 ),
+ aTest10CBox ( this, 0 ),
+ bAttrModified( FALSE )
+{
+ lcl_SetPosSize(*this, Point(0,0), Size(260 , 135));
+ lcl_SetPosSize(aTestFL, Point(6,2), Size(209,8));
+ lcl_SetPosSize(aTest1CBox , Point(12 , 14), Size(74 , 10));
+ lcl_SetPosSize(aTest2CBox , Point(12 , 27), Size(74 , 10));
+ lcl_SetPosSize(aTest3CBox , Point(12 , 40), Size(74 , 10));
+ lcl_SetPosSize(aTest4CBox , Point(12 , 53), Size(74 , 10));
+ lcl_SetPosSize(aTest5CBox , Point(12 , 66), Size(74 , 10));
+ lcl_SetPosSize(aTest6CBox , Point(116, 14), Size(74 , 10));
+ lcl_SetPosSize(aTest7CBox , Point(116, 27), Size(74 , 10));
+ lcl_SetPosSize(aTest8CBox , Point(116, 40), Size(74 , 10));
+ lcl_SetPosSize(aTest9CBox , Point(116, 53), Size(74 , 10));
+ lcl_SetPosSize(aTest10CBox , Point(116, 66), Size(74 , 10));
+
+ aTestFL.SetText( String(ByteString("Einstellungen nur f\xFCr Testzwecke" ), RTL_TEXTENCODING_MS_1252));
+ aTest1CBox .SetText( C2S("unused"));
+ aTest2CBox .SetText( C2S("dynamic"));
+ aTest3CBox .SetText( C2S("No calm" ));
+ aTest4CBox .SetText( C2S("WYSIWYG debug" ));
+ aTest5CBox .SetText( C2S("No idle format" ));
+ aTest6CBox .SetText( C2S("No screen adj" ));
+ aTest7CBox .SetText( C2S("win format" ));
+ aTest8CBox .SetText( C2S("No Scroll" ));
+ aTest9CBox .SetText( C2S("DrawingLayerNotLoading"));
+ aTest10CBox.SetText( C2S("AutoFormat by Input" ));
+ aTestFL.Show();
+ aTest1CBox .Show();
+ aTest2CBox .Show();
+ aTest3CBox .Show();
+ aTest4CBox .Show();
+ aTest5CBox .Show();
+ aTest6CBox .Show();
+ aTest7CBox .Show();
+ aTest8CBox .Show();
+ aTest9CBox .Show();
+ aTest10CBox.Show();
+ Init();
+
+}
+
+
+//------------------------------------------------------------------------
+
+
+SfxTabPage* SwTestTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwTestTabPage( pParent, rAttrSet ) );
+}
+//------------------------------------------------------------------------
+
+
+BOOL SwTestTabPage::FillItemSet( SfxItemSet& rCoreSet )
+{
+
+ if ( bAttrModified )
+ {
+ SwTestItem aTestItem(FN_PARAM_SWTEST);
+ aTestItem.bTest1=aTest1CBox.IsChecked();
+ aTestItem.bTest2=aTest2CBox.IsChecked();
+ aTestItem.bTest3=aTest3CBox.IsChecked();
+ aTestItem.bTest4=aTest4CBox.IsChecked();
+ aTestItem.bTest5=aTest5CBox.IsChecked();
+ aTestItem.bTest6=aTest6CBox.IsChecked();
+ aTestItem.bTest7=aTest7CBox.IsChecked();
+ aTestItem.bTest8=aTest8CBox.IsChecked();
+ aTestItem.bTest9=aTest9CBox.IsChecked();
+ aTestItem.bTest10=aTest10CBox.IsChecked();
+ rCoreSet.Put(aTestItem);
+ }
+ return bAttrModified;
+}
+//------------------------------------------------------------------------
+
+
+void SwTestTabPage::Reset( const SfxItemSet& )
+{
+ const SfxItemSet& rSet = GetItemSet();
+ const SwTestItem* pTestAttr = 0;
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SWTEST , FALSE,
+ (const SfxPoolItem**)&pTestAttr ))
+ {
+ aTest1CBox.Check(pTestAttr->bTest1);
+ aTest2CBox.Check(pTestAttr->bTest2);
+ aTest3CBox.Check(pTestAttr->bTest3);
+ aTest4CBox.Check(pTestAttr->bTest4);
+ aTest5CBox.Check(pTestAttr->bTest5);
+ aTest6CBox.Check(pTestAttr->bTest6);
+ aTest7CBox.Check(pTestAttr->bTest7);
+ aTest8CBox.Check(pTestAttr->bTest8);
+ aTest9CBox.Check(pTestAttr->bTest9);
+ aTest10CBox.Check(pTestAttr->bTest10);
+ }
+}
+//------------------------------------------------------------------------
+
+
+void SwTestTabPage::Init()
+{
+ // handler
+ Link aLk = LINK( this, SwTestTabPage, AutoClickHdl );
+ aTest1CBox.SetClickHdl( aLk );
+ aTest2CBox.SetClickHdl( aLk );
+ aTest3CBox.SetClickHdl( aLk );
+ aTest4CBox.SetClickHdl( aLk );
+ aTest5CBox.SetClickHdl( aLk );
+ aTest6CBox.SetClickHdl( aLk );
+ aTest7CBox.SetClickHdl( aLk );
+ aTest8CBox.SetClickHdl( aLk );
+ aTest9CBox.SetClickHdl( aLk );
+ aTest10CBox.SetClickHdl( aLk );
+}
+//------------------------------------------------------------------------
+
+
+IMPL_LINK_INLINE_START( SwTestTabPage, AutoClickHdl, CheckBox *, EMPTYARG )
+{
+ bAttrModified = TRUE;
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwTestTabPage, AutoClickHdl, CheckBox *, EMPTYARG )
+#endif
+
+
diff --git a/sw/source/ui/config/prtopt.cxx b/sw/source/ui/config/prtopt.cxx
new file mode 100644
index 000000000000..d81c743604db
--- /dev/null
+++ b/sw/source/ui/config/prtopt.cxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <unotools/configmgr.hxx>
+#include <prtopt.hxx>
+#include <tools/debug.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <unomid.h>
+
+
+using namespace utl;
+using rtl::OUString;
+using namespace com::sun::star::uno;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ctor
+ --------------------------------------------------------------------*/
+
+Sequence<OUString> SwPrintOptions::GetPropertyNames()
+{
+ static const char* aPropNames[] =
+ {
+ "Content/Graphic", // 0
+ "Content/Table", // 1
+ "Content/Control", // 2
+ "Content/Background", // 3
+ "Content/PrintBlack", // 4
+ "Content/Note", // 5
+ "Page/Reversed", // 6
+ "Page/Brochure", // 7
+ "Page/BrochureRightToLeft", // 8
+ "Output/SinglePrintJob", // 9
+ "Output/Fax", // 10
+ "Papertray/FromPrinterSetup", // 11
+ "Content/Drawing", // 12 not in SW/Web
+ "Page/LeftPage", // 13 not in SW/Web
+ "Page/RightPage", // 14 not in SW/Web
+ "EmptyPages", // 15 not in SW/Web
+ "Content/PrintPlaceholders", // 16 not in Sw/Web
+ "Content/PrintHiddenText" // 17 not in Sw/Web
+ };
+ const int nCount = bIsWeb ? 12 : 18;
+ Sequence<OUString> aNames(nCount);
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ {
+ pNames[i] = OUString::createFromAscii(aPropNames[i]);
+ }
+ return aNames;
+}
+/* -----------------------------06.09.00 16:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwPrintOptions::SwPrintOptions(sal_Bool bWeb) :
+ ConfigItem(bWeb ? C2U("Office.WriterWeb/Print") : C2U("Office.Writer/Print"),
+ CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
+ bIsWeb(bWeb)
+{
+ bPrintPageBackground = !bWeb;
+ bPrintBlackFont = bWeb;
+ bPrintTextPlaceholder = bPrintHiddenText = sal_False;
+ if (bWeb)
+ bPrintEmptyPages = sal_False;
+
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aNames.getLength())
+ {
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ switch(nProp)
+ {
+ case 0: bPrintGraphic = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 1: bPrintTable = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 2: bPrintControl = *(sal_Bool*)pValues[nProp].getValue() ; break;
+ case 3: bPrintPageBackground= *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 4: bPrintBlackFont = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 5:
+ {
+ sal_Int32 nTmp = 0;
+ pValues[nProp] >>= nTmp;
+ nPrintPostIts = (sal_Int16)nTmp;
+ }
+ break;
+ case 6: bPrintReverse = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 7: bPrintProspect = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 8: bPrintProspectRTL = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 9: bPrintSingleJobs = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 10: pValues[nProp] >>= sFaxName; break;
+ case 11: bPaperFromSetup = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 12: bPrintDraw = *(sal_Bool*)pValues[nProp].getValue() ; break;
+ case 13: bPrintLeftPages = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 14: bPrintRightPages = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 15: bPrintEmptyPages = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 16: bPrintTextPlaceholder = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 17: bPrintHiddenText = *(sal_Bool*)pValues[nProp].getValue(); break;
+ }
+ }
+ }
+ }
+
+ // currently there is just one checkbox for print drawings and print graphics
+ // In the UI. (File/Print dialog and Tools/Options/.../Print)
+ // And since print graphics is the only available in Writer and WrtierWeb ...
+
+ bPrintDraw = bPrintGraphic;
+}
+/* -----------------------------06.09.00 16:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwPrintOptions::~SwPrintOptions()
+{
+}
+/* -----------------------------06.09.00 16:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+void SwPrintOptions::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+void SwPrintOptions::Commit()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+
+ const Type& rType = ::getBooleanCppuType();
+ BOOL bVal;
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ switch(nProp)
+ {
+ case 0: bVal = bPrintGraphic; pValues[nProp].setValue(&bVal, rType);break;
+ case 1: bVal = bPrintTable ;pValues[nProp].setValue(&bVal, rType); break;
+ case 2: bVal = bPrintControl ; pValues[nProp].setValue(&bVal, rType); break;
+ case 3: bVal = bPrintPageBackground; pValues[nProp].setValue(&bVal, rType); break;
+ case 4: bVal = bPrintBlackFont ; pValues[nProp].setValue(&bVal, rType); break;
+ case 5: pValues[nProp] <<= (sal_Int32)nPrintPostIts ; break;
+ case 6: bVal = bPrintReverse ; pValues[nProp].setValue(&bVal, rType); break;
+ case 7: bVal = bPrintProspect ; pValues[nProp].setValue(&bVal, rType); break;
+ case 8: bVal = bPrintProspectRTL ; pValues[nProp].setValue(&bVal, rType); break;
+ case 9: bVal = bPrintSingleJobs ; pValues[nProp].setValue(&bVal, rType); break;
+ case 10: pValues[nProp] <<= sFaxName; break;
+ case 11: bVal = bPaperFromSetup ; pValues[nProp].setValue(&bVal, rType); break;
+ case 12: bVal = bPrintDraw ; pValues[nProp].setValue(&bVal, rType); break;
+ case 13: bVal = bPrintLeftPages ; pValues[nProp].setValue(&bVal, rType); break;
+ case 14: bVal = bPrintRightPages ; pValues[nProp].setValue(&bVal, rType); break;
+ case 15: bVal = bPrintEmptyPages ; pValues[nProp].setValue(&bVal, rType); break;
+ case 16: bVal = bPrintTextPlaceholder; pValues[nProp].setValue(&bVal, rType); break;
+ case 17: bVal = bPrintHiddenText; pValues[nProp].setValue(&bVal, rType); break;
+ }
+ }
+
+ // currently there is just one checkbox for print drawings and print graphics
+ // In the UI. (File/Print dialog and Tools/Options/.../Print)
+ // And since print graphics is the only available in Writer and WrtierWeb ...
+ bPrintDraw = bPrintGraphic;
+
+ PutProperties(aNames, aValues);
+}
+
+
+
+
diff --git a/sw/source/ui/config/redlopt.hrc b/sw/source/ui/config/redlopt.hrc
new file mode 100644
index 000000000000..877f23d75c4c
--- /dev/null
+++ b/sw/source/ui/config/redlopt.hrc
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define FT_INS_ATTR 1
+#define LB_INS_ATTR 2
+#define FT_INS_COL 3
+#define LB_INS_COL 4
+#define WIN_INS 5
+#define FT_DEL_ATTR 6
+#define LB_DEL_ATTR 7
+#define FT_DEL_COL 8
+#define LB_DEL_COL 9
+#define WIN_DEL 10
+#define FT_CHG_ATTR 11
+#define LB_CHG_ATTR 12
+#define FT_CHG_COL 13
+#define LB_CHG_COL 14
+#define WIN_CHG 15
+#define FL_TE 16
+
+#define FT_MARKPOS 17
+#define LB_MARKPOS 18
+#define FT_LC_COL 19
+#define LB_LC_COL 20
+#define WIN_MARK 21
+#define FL_LC 22
+#define STR_AUTHOR 23
+#define STR_NOTHING 24
+#define FT_CHG_CHANGE 25
+#define FT_CHG_DELETE 26
+#define FT_CHG_INSERT 27
diff --git a/sw/source/ui/config/redlopt.src b/sw/source/ui/config/redlopt.src
new file mode 100644
index 000000000000..b7ec8c42686d
--- /dev/null
+++ b/sw/source/ui/config/redlopt.src
@@ -0,0 +1,287 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* StarView ressource file */
+
+#ifndef _SFX_HRC
+#include <sfx2/sfx.hrc>
+#endif
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#include "globals.hrc"
+#include "config.hrc"
+#include "redlopt.hrc"
+#include "helpid.h"
+/**************************************************************************/
+/* */
+/**************************************************************************/
+TabPage TP_REDLINE_OPT
+{
+ HelpID = HID_REDLINE_OPT ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_TE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Text display" ;
+ };
+ FixedText FT_CHG_INSERT
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Insertions";
+ };
+ FixedText FT_INS_ATTR
+ {
+ Pos = MAP_APPFONT ( 18 , 25 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Attributes";
+ };
+ ListBox LB_INS_ATTR
+ {
+ HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_INS_ATTR";
+ Pos = MAP_APPFONT ( 90 , 25 ) ;
+ Size = MAP_APPFONT ( 80 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "[None]" ; > ;
+ < "Bold" ; > ;
+ < "Italic" ; > ;
+ < "Underlined" ; > ;
+ < "Underlined: double" ; > ;
+ < "Strikethrough" ; > ;
+ < "Uppercase" ; > ;
+ < "Lowercase" ; > ;
+ < "Small caps" ; > ;
+ < "Title font" ; > ;
+ < "Background color" ; > ;
+ };
+ };
+ FixedText FT_INS_COL
+ {
+ Pos = MAP_APPFONT ( 18 , 42 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Color" ;
+ };
+ ListBox LB_INS_COL
+ {
+ HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_INS_COL";
+ Pos = MAP_APPFONT ( 90 , 40 ) ;
+ Size = MAP_APPFONT ( 80 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ Window WIN_INS
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 178 , 25 ) ;
+ Size = MAP_APPFONT ( 70 , 27 ) ;
+ Text [ en-US ] = "Insert";
+ };
+ FixedText FT_CHG_DELETE
+ {
+ Pos = MAP_APPFONT ( 12 , 58 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Deletions";
+ };
+ FixedText FT_DEL_ATTR
+ {
+ Pos = MAP_APPFONT ( 18 , 69 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Attributes";
+ };
+ ListBox LB_DEL_ATTR
+ {
+ HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_DEL_ATTR";
+ Pos = MAP_APPFONT ( 90 , 67 ) ;
+ Size = MAP_APPFONT ( 80 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_DEL_COL
+ {
+ Pos = MAP_APPFONT ( 18 , 84 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Color";
+ };
+ ListBox LB_DEL_COL
+ {
+ HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_DEL_COL";
+ Pos = MAP_APPFONT ( 90 , 82 ) ;
+ Size = MAP_APPFONT ( 80 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ Window WIN_DEL
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 178 , 67 ) ;
+ Size = MAP_APPFONT ( 70 , 27 ) ;
+ Text [ en-US ] = "Delete";
+ };
+ FixedText FT_CHG_CHANGE
+ {
+ Pos = MAP_APPFONT ( 12 , 100 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Changed attributes";
+ };
+ FixedText FT_CHG_ATTR
+ {
+ Pos = MAP_APPFONT ( 18 , 113 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Attributes";
+ };
+ ListBox LB_CHG_ATTR
+ {
+ HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_CHG_ATTR";
+ Pos = MAP_APPFONT ( 90 , 111 ) ;
+ Size = MAP_APPFONT ( 80 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_CHG_COL
+ {
+ Pos = MAP_APPFONT ( 18 , 128 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Color";
+ };
+ ListBox LB_CHG_COL
+ {
+ HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_CHG_COL";
+ Pos = MAP_APPFONT ( 90 , 126 ) ;
+ Size = MAP_APPFONT ( 80 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ Window WIN_CHG
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 178 , 111 ) ;
+ Size = MAP_APPFONT ( 70 , 27 ) ;
+ Text [ en-US ] = "Attributes";
+ };
+ FixedLine FL_LC
+ {
+ Pos = MAP_APPFONT ( 6 , 144 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Lines changed" ;
+ };
+ FixedText FT_MARKPOS
+ {
+ Pos = MAP_APPFONT ( 12 , 157 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "Mar~k" ;
+ };
+ ListBox LB_MARKPOS
+ {
+ HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_MARKPOS";
+ Pos = MAP_APPFONT ( 90 , 155 ) ;
+ Size = MAP_APPFONT ( 80 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "[None]" ; > ;
+ < "Left margin" ; > ;
+ < "Right margin" ; > ;
+ < "Outer margin" ; > ;
+ < "Inner margin" ; > ;
+ };
+ };
+ FixedText FT_LC_COL
+ {
+ Pos = MAP_APPFONT ( 12 , 172 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ Text [ en-US ] = "~Color" ;
+ };
+ ListBox LB_LC_COL
+ {
+ HelpID = "sw:ListBox:TP_REDLINE_OPT:LB_LC_COL";
+ Pos = MAP_APPFONT ( 90 , 170 ) ;
+ Size = MAP_APPFONT ( 80 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ Window WIN_MARK
+ {
+ Pos = MAP_APPFONT ( 178 , 155 ) ;
+ Size = MAP_APPFONT ( 70 , 27 ) ;
+ };
+ String STR_AUTHOR
+ {
+ Text [ en-US ] = "By author" ;
+ };
+ String STR_NOTHING
+ {
+ Text [ en-US ] = "[None]" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/config/uinums.cxx b/sw/source/ui/config/uinums.cxx
new file mode 100644
index 000000000000..40d56b3b6507
--- /dev/null
+++ b/sw/source/ui/config/uinums.cxx
@@ -0,0 +1,673 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+
+#include <hintids.hxx>
+#include <svl/urihelper.hxx>
+#include <unotools/pathoptions.hxx>
+#include <tools/stream.hxx>
+#ifndef _SFX_INIMGR_HXX
+#endif
+#include <sfx2/docfile.hxx>
+#include <svl/itemiter.hxx>
+#include <editeng/brshitem.hxx>
+
+
+#include <tools/resid.hxx>
+#include <fmtornt.hxx>
+#include <swtypes.hxx> // Leerstring
+#include <wrtsh.hxx>
+#include <uinums.hxx>
+#include <poolfmt.hxx>
+#include <charfmt.hxx>
+#include <frmatr.hxx>
+
+#include <unomid.h>
+
+using namespace ::com::sun::star;
+
+
+#define VERSION_30B ((USHORT)250)
+#define VERSION_31B ((USHORT)326)
+#define VERSION_40A ((USHORT)364)
+#define VERSION_50A ((USHORT)373)
+#define VERSION_53A ((USHORT)596)
+#define ACT_NUM_VERSION VERSION_53A
+
+#define NUMRULE_FILENAME "numrule.cfg"
+#define CHAPTER_FILENAME "chapter.cfg"
+
+/*------------------------------------------------------------------------
+ Beschreibung: Ops. zum Laden / Speichern
+------------------------------------------------------------------------*/
+
+
+SV_IMPL_PTRARR( _SwNumFmtsAttrs, SfxPoolItem* )
+
+
+// SwNumRulesWithName ----------------------------------------------------
+// PUBLIC METHODES -------------------------------------------------------
+/*------------------------------------------------------------------------
+ Beschreibung: Speichern einer Regel
+ Parameter: rCopy -- die zu speichernde Regel
+ nIdx -- Position, an der die Regel zu speichern ist.
+ Eine alte Regel an dieser Position wird ueberschrieben.
+------------------------------------------------------------------------*/
+
+SwBaseNumRules::SwBaseNumRules( const String& rFileName )
+ :
+ sFileName( rFileName ),
+ nVersion(0),
+ bModified( FALSE )
+{
+ Init();
+}
+
+/*-----------------26.06.97 08.30-------------------
+
+--------------------------------------------------*/
+SwBaseNumRules::~SwBaseNumRules()
+{
+ if( bModified )
+ {
+ SvtPathOptions aPathOpt;
+ String sNm( aPathOpt.GetUserConfigPath() );
+ sNm += INET_PATH_TOKEN;
+ sNm += sFileName;
+ INetURLObject aTempObj(sNm);
+ sNm = aTempObj.GetFull();
+ SfxMedium aStrm( sNm, STREAM_WRITE | STREAM_TRUNC |
+ STREAM_SHARE_DENYALL, TRUE );
+ Store( *aStrm.GetOutStream() );
+ }
+
+ for( USHORT i = 0; i < nMaxRules; ++i )
+ delete pNumRules[i];
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+void SwBaseNumRules::Init()
+{
+ for(USHORT i = 0; i < nMaxRules; ++i )
+ pNumRules[i] = 0;
+
+ String sNm( sFileName );
+ SvtPathOptions aOpt;
+ if( aOpt.SearchFile( sNm, SvtPathOptions::PATH_USERCONFIG ))
+ {
+ SfxMedium aStrm( sNm, STREAM_STD_READ, TRUE );
+ Load( *aStrm.GetInStream() );
+ }
+}
+
+/*-----------------26.06.97 08.30-------------------
+
+--------------------------------------------------*/
+
+void SwBaseNumRules::ApplyNumRules(const SwNumRulesWithName &rCopy, USHORT nIdx)
+{
+ ASSERT(nIdx < nMaxRules, Array der NumRules ueberindiziert.);
+ if( !pNumRules[nIdx] )
+ pNumRules[nIdx] = new SwNumRulesWithName( rCopy );
+ else
+ *pNumRules[nIdx] = rCopy;
+}
+
+// PROTECTED METHODES ----------------------------------------------------
+/*------------------------------------------------------------------------
+ Beschreibung: Speichern
+------------------------------------------------------------------------*/
+
+BOOL /**/ SwBaseNumRules::Store(SvStream &rStream)
+{
+ rStream << ACT_NUM_VERSION;
+ // Schreiben, welche Positionen durch eine Regel belegt sind
+ // Anschliessend Schreiben der einzelnen Rules
+ for(USHORT i = 0; i < nMaxRules; ++i)
+ {
+ if(pNumRules[i])
+ {
+ rStream << (unsigned char) TRUE;
+ pNumRules[i]->Store( rStream );
+ }
+ else
+ rStream << (unsigned char) FALSE;
+ }
+ return TRUE;
+}
+
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: Speichern / Laden
+------------------------------------------------------------------------*/
+
+
+int SwBaseNumRules::Load(SvStream &rStream)
+{
+ int rc = 0;
+
+ rStream >> nVersion;
+
+ // wegen eines kleinen aber schweren Fehlers schreibt die PreFinal die
+ // gleiche VERSION_40A wie das SP2 #55402#
+ if(VERSION_40A == nVersion)
+ {
+ DBG_ERROR("Version 364 ist nicht eindeutig #55402#");
+ }
+ else if( VERSION_30B == nVersion || VERSION_31B == nVersion ||
+ ACT_NUM_VERSION >= nVersion )
+ {
+ unsigned char bRule = FALSE;
+ for(USHORT i = 0; i < nMaxRules; ++i)
+ {
+ rStream >> bRule;
+ if(bRule)
+ pNumRules[i] = new SwNumRulesWithName( rStream, nVersion );
+ }
+ }
+ else
+ {
+ rc = 1;
+ }
+
+ return rc;
+}
+
+/*-----------------26.06.97 08.34-------------------
+
+--------------------------------------------------*/
+
+/*------------------------------------------------------------------------*/
+
+
+SwChapterNumRules::SwChapterNumRules() :
+ SwBaseNumRules(C2S(CHAPTER_FILENAME))
+{
+}
+
+/*------------------------------------------------------------------------*/
+
+ SwChapterNumRules::~SwChapterNumRules()
+{
+}
+
+/*-----------------26.06.97 08.23-------------------
+
+--------------------------------------------------*/
+void SwChapterNumRules::ApplyNumRules(const SwNumRulesWithName &rCopy, USHORT nIdx)
+{
+ bModified = TRUE;
+ SwBaseNumRules::ApplyNumRules(rCopy, nIdx);
+}
+
+/*------------------------------------------------------------------------*/
+
+SwNumRulesWithName::SwNumRulesWithName( const SwNumRule &rCopy,
+ const String &rName )
+ : aName(rName)
+{
+ for( USHORT n = 0; n < MAXLEVEL; ++n )
+ {
+ const SwNumFmt* pFmt = rCopy.GetNumFmt( n );
+ if( pFmt )
+ aFmts[ n ] = new _SwNumFmtGlobal( *pFmt );
+ else
+ aFmts[ n ] = 0;
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+SwNumRulesWithName::SwNumRulesWithName( const SwNumRulesWithName& rCopy )
+{
+ memset( aFmts, 0, sizeof( aFmts ));
+ *this = rCopy;
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+SwNumRulesWithName::~SwNumRulesWithName()
+{
+ for( int n = 0; n < MAXLEVEL; ++n )
+ delete aFmts[ n ];
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+const SwNumRulesWithName& SwNumRulesWithName::operator=(const SwNumRulesWithName &rCopy)
+{
+ if( this != &rCopy )
+ {
+ aName = rCopy.aName;
+ for( int n = 0; n < MAXLEVEL; ++n )
+ {
+ delete aFmts[ n ];
+
+ _SwNumFmtGlobal* pFmt = rCopy.aFmts[ n ];
+ if( pFmt )
+ aFmts[ n ] = new _SwNumFmtGlobal( *pFmt );
+ else
+ aFmts[ n ] = 0;
+ }
+ }
+ return *this;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+SwNumRulesWithName::SwNumRulesWithName( SvStream &rStream, USHORT nVersion )
+{
+ CharSet eEncoding = gsl_getSystemTextEncoding();
+ rStream.ReadByteString(aName, eEncoding);
+
+ char c;
+ for(USHORT n = 0; n < MAXLEVEL; ++n )
+ {
+ if( VERSION_30B == nVersion )
+ c = 1;
+ // wegen eines kleinen aber schweren Fehlers schreibt die PreFinal die
+ // gleiche VERSION_40A wie das SP2 #55402#
+ else if(nVersion < VERSION_40A && n > 5)
+// else if(nVersion < VERSION_50A && n > 5)
+ c = 0;
+ else
+ rStream >> c;
+
+ if( c )
+ aFmts[ n ] = new _SwNumFmtGlobal( rStream, nVersion );
+ else
+ aFmts[ n ] = 0;
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwNumRulesWithName::MakeNumRule( SwWrtShell& rSh, SwNumRule& rChg ) const
+{
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ // --> OD 2008-06-06 #i89178#
+ rChg = SwNumRule( aName, numfunc::GetDefaultPositionAndSpaceMode() );
+ // <--
+ rChg.SetAutoRule( FALSE );
+ _SwNumFmtGlobal* pFmt;
+ for( USHORT n = 0; n < MAXLEVEL; ++n )
+ if( 0 != ( pFmt = aFmts[ n ] ) )
+ {
+ SwNumFmt aNew;
+ pFmt->ChgNumFmt( rSh, aNew );
+ rChg.Set( n, aNew );
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+void SwNumRulesWithName::Store( SvStream &rStream )
+{
+ CharSet eEncoding = gsl_getSystemTextEncoding();
+ rStream.WriteByteString(aName, eEncoding);
+
+ for( USHORT n = 0; n < MAXLEVEL; ++n )
+ {
+ _SwNumFmtGlobal* pFmt = aFmts[ n ];
+ if( pFmt )
+ {
+ rStream << (char)1;
+ pFmt->Store( rStream );
+ }
+ else
+ rStream << (char)0;
+ }
+}
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( const SwNumFmt& rFmt )
+ : aFmt( rFmt ), nCharPoolId( USHRT_MAX )
+{
+ // relative Abstaende ?????
+
+ SwCharFmt* pFmt = rFmt.GetCharFmt();
+ if( pFmt )
+ {
+ sCharFmtName = pFmt->GetName();
+ nCharPoolId = pFmt->GetPoolFmtId();
+ if( pFmt->GetAttrSet().Count() )
+ {
+ SfxItemIter aIter( pFmt->GetAttrSet() );
+ const SfxPoolItem *pCurr = aIter.GetCurItem();
+ while( TRUE )
+ {
+ aItems.Insert( pCurr->Clone(), aItems.Count() );
+ if( aIter.IsAtEnd() )
+ break;
+ pCurr = aIter.NextItem();
+ }
+ }
+
+ aFmt.SetCharFmt( 0 );
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( const _SwNumFmtGlobal& rFmt )
+ :
+ aFmt( rFmt.aFmt ),
+ sCharFmtName( rFmt.sCharFmtName ),
+ nCharPoolId( rFmt.nCharPoolId )
+{
+ for( USHORT n = rFmt.aItems.Count(); n; )
+ aItems.Insert( rFmt.aItems[ --n ]->Clone(), aItems.Count() );
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( SvStream& rStream,
+ USHORT nVersion )
+ : nCharPoolId( USHRT_MAX )
+{
+ CharSet eEncoding = gsl_getSystemTextEncoding();
+ {
+ USHORT nUS;
+ sal_Char cChar;
+ short nShort;
+ BOOL bFlag;
+ String sStr;
+
+ rStream >> nUS; aFmt.SetNumberingType((sal_Int16)nUS );
+ if( VERSION_53A > nVersion )
+ {
+ rStream >> cChar; aFmt.SetBulletChar( cChar );
+ }
+ else
+ {
+ rStream >> nUS; aFmt.SetBulletChar( nUS );
+ }
+
+ rStream >> bFlag; aFmt.SetIncludeUpperLevels( bFlag );
+
+ if( VERSION_30B == nVersion )
+ {
+ long nL;
+ rStream >> cChar; aFmt.SetStart( (USHORT)cChar );
+
+ rStream.ReadByteString(sStr, eEncoding);
+ aFmt.SetPrefix( sStr );
+ rStream.ReadByteString(sStr, eEncoding);
+ aFmt.SetSuffix( sStr );
+ rStream >> nUS; aFmt.SetNumAdjust( SvxAdjust( nUS ) );
+ rStream >> nL; aFmt.SetLSpace( lNumIndent );
+ rStream >> nL; aFmt.SetFirstLineOffset( (short)nL );
+ }
+ else // alter StartWert war ein Byte
+ {
+ rStream >> nUS; aFmt.SetStart( nUS );
+ rStream.ReadByteString(sStr, eEncoding);
+ aFmt.SetPrefix( sStr );
+ rStream.ReadByteString(sStr, eEncoding);
+ aFmt.SetSuffix( sStr );
+ rStream >> nUS; aFmt.SetNumAdjust( SvxAdjust( nUS ) );
+ rStream >> nUS; aFmt.SetAbsLSpace( nUS );
+ rStream >> nShort; aFmt.SetFirstLineOffset( nShort );
+ rStream >> nUS; aFmt.SetCharTextDistance( nUS );
+ rStream >> nShort; aFmt.SetLSpace( nShort );
+ rStream >> bFlag;
+ }
+
+ USHORT nFamily;
+ USHORT nCharSet;
+ short nWidth;
+ short nHeight;
+ USHORT nPitch;
+ String aName;
+
+ rStream.ReadByteString(aName, eEncoding);
+ rStream >> nFamily >> nCharSet >> nWidth >> nHeight >> nPitch;
+
+ if( aName.Len() )
+ {
+ Font aFont( nFamily, Size( nWidth, nHeight ) );
+ aFont.SetName( aName );
+ aFont.SetCharSet( (CharSet)nCharSet );
+ aFont.SetPitch( (FontPitch)nPitch );
+
+ aFmt.SetBulletFont( &aFont );
+ }
+ else
+ nCharSet = RTL_TEXTENCODING_SYMBOL;
+
+ if( VERSION_53A > nVersion )
+ aFmt.SetBulletChar( ByteString::ConvertToUnicode(
+ sal_Char(aFmt.GetBulletChar()), nCharSet ));
+ }
+
+ if( VERSION_30B != nVersion )
+ {
+ USHORT nItemCount;
+ rStream >> nCharPoolId;
+ rStream.ReadByteString(sCharFmtName, eEncoding);
+ rStream >> nItemCount;
+
+ while( nItemCount-- )
+ {
+ USHORT nWhich, nVers;
+ rStream >> nWhich >> nVers;
+ aItems.Insert( GetDfltAttr( nWhich )->Create( rStream, nVers ),
+ aItems.Count() );
+ }
+ }
+
+ if( VERSION_40A == nVersion && SVX_NUM_BITMAP == aFmt.GetNumberingType() )
+ {
+ BYTE cF;
+ Size aSz;
+
+ rStream >> aSz.Width() >> aSz.Height();
+
+ rStream >> cF;
+ if( cF )
+ {
+ SvxBrushItem* pBrush = 0;
+ SwFmtVertOrient* pVOrient = 0;
+ USHORT nVer;
+
+ if( cF & 1 )
+ {
+ rStream >> nVer;
+ pBrush = (SvxBrushItem*)GetDfltAttr( RES_BACKGROUND )
+ ->Create( rStream, nVer );
+ }
+
+ if( cF & 2 )
+ {
+ rStream >> nVer;
+ pVOrient = (SwFmtVertOrient*)GetDfltAttr( RES_VERT_ORIENT )
+ ->Create( rStream, nVer );
+ }
+ sal_Int16 eOrient = text::VertOrientation::NONE;
+ if(pVOrient)
+ eOrient = (sal_Int16)pVOrient->GetVertOrient();
+ aFmt.SetGraphicBrush( pBrush, &aSz, pVOrient ? &eOrient : 0 );
+ }
+ }
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwNumRulesWithName::_SwNumFmtGlobal::~_SwNumFmtGlobal()
+{
+}
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+void SwNumRulesWithName::_SwNumFmtGlobal::Store( SvStream& rStream )
+{
+ CharSet eEncoding = gsl_getSystemTextEncoding();
+ {
+ String aName;
+ USHORT nFamily = FAMILY_DONTKNOW, nCharSet = 0, nPitch = 0;
+ short nWidth = 0, nHeight = 0;
+
+ const Font* pFnt = aFmt.GetBulletFont();
+ if( pFnt )
+ {
+ aName = pFnt->GetName();
+ nFamily = (USHORT)pFnt->GetFamily();
+ nCharSet = (USHORT)pFnt->GetCharSet();
+ nWidth = (short)pFnt->GetSize().Width();
+ nHeight = (short)pFnt->GetSize().Height();
+ nPitch = (USHORT)pFnt->GetPitch();
+ }
+
+ rStream << USHORT(aFmt.GetNumberingType())
+ << aFmt.GetBulletChar()
+ << (aFmt.GetIncludeUpperLevels() > 0)
+ << aFmt.GetStart();
+ rStream.WriteByteString( aFmt.GetPrefix(), eEncoding );
+ rStream.WriteByteString( aFmt.GetSuffix(), eEncoding );
+ rStream << USHORT( aFmt.GetNumAdjust() )
+ << aFmt.GetAbsLSpace()
+ << aFmt.GetFirstLineOffset()
+ << aFmt.GetCharTextDistance()
+ << aFmt.GetLSpace()
+ << FALSE;//aFmt.IsRelLSpace();
+ rStream.WriteByteString( aName, eEncoding );
+ rStream << nFamily
+ << nCharSet
+ << nWidth
+ << nHeight
+ << nPitch;
+ }
+ rStream << nCharPoolId;
+ rStream.WriteByteString( sCharFmtName, eEncoding );
+ rStream << aItems.Count();
+
+ for( USHORT n = aItems.Count(); n; )
+ {
+ SfxPoolItem* pItem = aItems[ --n ];
+ USHORT nIVers = pItem->GetVersion( SOFFICE_FILEFORMAT_50 );
+ ASSERT( nIVers != USHRT_MAX,
+ "Was'n das: Item-Version USHRT_MAX in der aktuellen Version" );
+ rStream << pItem->Which()
+ << nIVers;
+ pItem->Store( rStream, nIVers );
+ }
+
+ // Erweiterungen fuer Version 40A
+
+ if( SVX_NUM_BITMAP == aFmt.GetNumberingType() )
+ {
+ rStream << (INT32)aFmt.GetGraphicSize().Width()
+ << (INT32)aFmt.GetGraphicSize().Height();
+ BYTE cFlg = ( 0 != aFmt.GetBrush() ? 1 : 0 ) +
+ ( 0 != aFmt.GetGraphicOrientation() ? 2 : 0 );
+ rStream << cFlg;
+
+ if( aFmt.GetBrush() )
+ {
+ USHORT nVersion = aFmt.GetBrush()->GetVersion( SOFFICE_FILEFORMAT_50 );
+ rStream << nVersion;
+ aFmt.GetBrush()->Store( rStream, nVersion );
+ }
+ if( aFmt.GetGraphicOrientation() )
+ {
+ USHORT nVersion = aFmt.GetGraphicOrientation()->GetVersion( SOFFICE_FILEFORMAT_50 );
+ rStream << nVersion;
+ aFmt.GetGraphicOrientation()->Store( rStream, nVersion );
+ }
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwNumRulesWithName::_SwNumFmtGlobal::ChgNumFmt( SwWrtShell& rSh,
+ SwNumFmt& rNew ) const
+{
+ SwCharFmt* pFmt = 0;
+ if( sCharFmtName.Len() )
+ {
+ // suche erstmal ueber den Namen
+ USHORT nArrLen = rSh.GetCharFmtCount();
+ for( USHORT i = 1; i < nArrLen; ++i )
+ {
+ pFmt = &rSh.GetCharFmt( i );
+ if( COMPARE_EQUAL == pFmt->GetName().CompareTo( sCharFmtName ))
+ // ist vorhanden, also belasse die Attribute wie sie sind!
+ break;
+ pFmt = 0;
+ }
+
+ if( !pFmt )
+ {
+ if( IsPoolUserFmt( nCharPoolId ) )
+ {
+ pFmt = rSh.MakeCharFmt( sCharFmtName );
+ pFmt->SetAuto( FALSE );
+ }
+ else
+ pFmt = rSh.GetCharFmtFromPool( nCharPoolId );
+
+ if( !pFmt->GetDepends() ) // Attribute setzen
+ for( USHORT n = aItems.Count(); n; )
+ pFmt->SetFmtAttr( *aItems[ --n ] );
+ }
+ }
+ ((SwNumFmt&)aFmt).SetCharFmt( pFmt );
+ rNew = aFmt;
+ if( pFmt )
+ ((SwNumFmt&)aFmt).SetCharFmt( 0 );
+}
+
diff --git a/sw/source/ui/config/usrpref.cxx b/sw/source/ui/config/usrpref.cxx
new file mode 100644
index 000000000000..8d79abfb6244
--- /dev/null
+++ b/sw/source/ui/config/usrpref.cxx
@@ -0,0 +1,663 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <tools/stream.hxx>
+#include <unotools/syslocale.hxx>
+
+#include "swtypes.hxx"
+#include "hintids.hxx"
+#include "uitool.hxx"
+#include "usrpref.hxx"
+#include "crstate.hxx"
+#include <linguistic/lngprops.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <unotools/localedatawrapper.hxx>
+
+#include <unomid.h>
+
+using namespace utl;
+using namespace rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+void SwMasterUsrPref::SetUsrPref(const SwViewOption &rCopy)
+{
+ *((SwViewOption*)this) = rCopy;
+}
+
+SwMasterUsrPref::SwMasterUsrPref(BOOL bWeb) :
+ eFldUpdateFlags(AUTOUPD_OFF),
+ nLinkUpdateMode(0),
+ bIsHScrollMetricSet(sal_False),
+ bIsVScrollMetricSet(sal_False),
+ nDefTab( MM50 * 4 ),
+ bIsSquaredPageMode(sal_False),
+ aContentConfig(bWeb, *this),
+ aLayoutConfig(bWeb, *this),
+ aGridConfig(bWeb, *this),
+ aCursorConfig(*this),
+ pWebColorConfig(bWeb ? new SwWebColorConfig(*this) : 0)
+{
+ MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
+ eUserMetric = MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH;
+ eHScrollMetric = eUserMetric;
+ eVScrollMetric = eUserMetric;
+
+ aContentConfig.Load();
+ aLayoutConfig.Load();
+ aGridConfig.Load();
+ aCursorConfig.Load();
+ if(pWebColorConfig)
+ pWebColorConfig->Load();
+}
+/* -----------------------------13.02.01 09:48--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwMasterUsrPref::~SwMasterUsrPref()
+{
+ delete pWebColorConfig;
+}
+/*-- 28.09.00 09:55:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence<OUString> SwContentViewConfig::GetPropertyNames()
+{
+ static const char* aPropNames[] =
+ {
+ "Display/GraphicObject", // 0
+ "Display/Table", // 1
+ "Display/DrawingControl", // 2
+ "Display/FieldCode", // 3
+ "Display/Note", // 4
+ "Display/PreventTips", // 5
+ "NonprintingCharacter/MetaCharacters", // 6
+ "NonprintingCharacter/ParagraphEnd", // 7
+ "NonprintingCharacter/OptionalHyphen", // 8
+ "NonprintingCharacter/Space", // 9
+ "NonprintingCharacter/Break", // 10
+ "NonprintingCharacter/ProtectedSpace", // 11
+ "NonprintingCharacter/Tab", // 12 //not in Writer/Web
+ "NonprintingCharacter/HiddenText", // 13
+ "NonprintingCharacter/HiddenParagraph", // 14
+ "NonprintingCharacter/HiddenCharacter", // 15
+ "Update/Link", // 16
+ "Update/Field", // 17
+ "Update/Chart" // 18
+
+
+ };
+ const int nCount = bWeb ? 12 : 19;
+ Sequence<OUString> aNames(nCount);
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ {
+ pNames[i] = OUString::createFromAscii(aPropNames[i]);
+ }
+ return aNames;
+}
+/*-- 28.09.00 09:55:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwContentViewConfig::SwContentViewConfig(BOOL bIsWeb, SwMasterUsrPref& rPar) :
+ ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Content") : C2U("Office.Writer/Content")),
+ rParent(rPar),
+ bWeb(bIsWeb)
+{
+ Load();
+ EnableNotification( GetPropertyNames() );
+}
+/*-- 28.09.00 09:55:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwContentViewConfig::~SwContentViewConfig()
+{
+}
+/*-- 09.02.07 09:55:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwContentViewConfig::Notify( const Sequence< OUString > & /*rPropertyNames*/ )
+{
+ Load();
+}
+/*-- 28.09.00 09:55:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwContentViewConfig::Commit()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ sal_Bool bVal = FALSE;
+ switch(nProp)
+ {
+ case 0: bVal = rParent.IsGraphic(); break;// "Display/GraphicObject",
+ case 1: bVal = rParent.IsTable(); break;// "Display/Table",
+ case 2: bVal = rParent.IsDraw(); break;// "Display/DrawingControl",
+ case 3: bVal = rParent.IsFldName(); break;// "Display/FieldCode",
+ case 4: bVal = rParent.IsPostIts(); break;// "Display/Note",
+ case 5: bVal = rParent.IsPreventTips(); break; // "Display/PreventTips"
+ case 6: bVal = rParent.IsViewMetaChars(); break; //"NonprintingCharacter/MetaCharacters"
+ case 7: bVal = rParent.IsParagraph(sal_True); break;// "NonprintingCharacter/ParagraphEnd",
+ case 8: bVal = rParent.IsSoftHyph(); break;// "NonprintingCharacter/OptionalHyphen",
+ case 9: bVal = rParent.IsBlank(sal_True); break;// "NonprintingCharacter/Space",
+ case 10: bVal = rParent.IsLineBreak(sal_True);break;// "NonprintingCharacter/Break",
+ case 11: bVal = rParent.IsHardBlank(); break;// "NonprintingCharacter/ProtectedSpace",
+ case 12: bVal = rParent.IsTab(sal_True); break;// "NonprintingCharacter/Tab",
+ case 13: bVal = rParent.IsShowHiddenField(); break;// "NonprintingCharacter/Fields: HiddenText",
+ case 14: bVal = rParent.IsShowHiddenPara(); break;// "NonprintingCharacter/Fields: HiddenParagraph",
+ case 15: bVal = rParent.IsShowHiddenChar(sal_True); break;// "NonprintingCharacter/HiddenCharacter",
+ case 16: pValues[nProp] <<= rParent.GetUpdateLinkMode(); break;// "Update/Link",
+ case 17: bVal = rParent.IsUpdateFields(); break;// "Update/Field",
+ case 18: bVal = rParent.IsUpdateCharts(); break;// "Update/Chart"
+ }
+ if(nProp != 16)
+ pValues[nProp].setValue(&bVal, ::getBooleanCppuType());
+ }
+ PutProperties(aNames, aValues);
+}
+/*-- 28.09.00 09:55:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwContentViewConfig::Load()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aNames.getLength())
+ {
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ sal_Bool bSet = nProp != 16 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False;
+ switch(nProp)
+ {
+ case 0: rParent.SetGraphic(bSet); break;// "Display/GraphicObject",
+ case 1: rParent.SetTable(bSet); break;// "Display/Table",
+ case 2: rParent.SetDraw(bSet); break;// "Display/DrawingControl",
+ case 3: rParent.SetFldName(bSet); break;// "Display/FieldCode",
+ case 4: rParent.SetPostIts(bSet); break;// "Display/Note",
+ case 5: rParent.SetPreventTips(bSet); break;// "Display/PreventTips",
+ case 6: rParent.SetViewMetaChars(bSet); break; //"NonprintingCharacter/MetaCharacters"
+ case 7: rParent.SetParagraph(bSet); break;// "NonprintingCharacter/ParagraphEnd",
+ case 8: rParent.SetSoftHyph(bSet); break;// "NonprintingCharacter/OptionalHyphen",
+ case 9: rParent.SetBlank(bSet); break;// "NonprintingCharacter/Space",
+ case 10: rParent.SetLineBreak(bSet);break;// "NonprintingCharacter/Break",
+ case 11: rParent.SetHardBlank(bSet); break;// "NonprintingCharacter/ProtectedSpace",
+ case 12: rParent.SetTab(bSet); break;// "NonprintingCharacter/Tab",
+ case 13: rParent.SetShowHiddenField(bSet); break;// "NonprintingCharacter/Fields: HiddenText",
+ case 14: rParent.SetShowHiddenPara(bSet); break;// "NonprintingCharacter/Fields: HiddenParagraph",
+ case 15: rParent.SetShowHiddenChar(bSet); break;// "NonprintingCharacter/HiddenCharacter",
+ case 16:
+ {
+ sal_Int32 nSet = 0;
+ pValues[nProp] >>= nSet;
+ rParent.SetUpdateLinkMode(nSet, TRUE);
+ }
+ break;// "Update/Link",
+ case 17: rParent.SetUpdateFields(bSet, TRUE); break;// "Update/Field",
+ case 18: rParent.SetUpdateCharts(bSet, TRUE); break;// "Update/Chart"
+ }
+ }
+ }
+ }
+}
+/*-- 28.09.00 09:55:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence<OUString> SwLayoutViewConfig::GetPropertyNames()
+{
+ static const char* aPropNames[] =
+ {
+ "Line/Guide", // 0
+ "Line/SimpleControlPoint", // 1
+ "Line/LargeControlPoint", // 2
+ "Window/HorizontalScroll", // 3
+ "Window/VerticalScroll", // 4
+ "Window/ShowRulers", // 5
+ "Window/HorizontalRuler", // 6
+ "Window/VerticalRuler", // 7
+ "Window/HorizontalRulerUnit", // 8
+ "Window/VerticalRulerUnit", // 9
+ "Window/SmoothScroll", //10
+ "Zoom/Value", //11
+ "Zoom/Type", //12
+ "Other/IsAlignMathObjectsToBaseline", //13
+ "Other/MeasureUnit", //14
+ // below properties are not available in WriterWeb
+ "Other/TabStop", //15
+ "Window/IsVerticalRulerRight", //16
+ "ViewLayout/Columns", //17
+ "ViewLayout/BookMode", //18
+ "Other/IsSquaredPageMode" //19
+ };
+ const int nCount = bWeb ? 15 : 20;
+ Sequence<OUString> aNames(nCount);
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ {
+ pNames[i] = OUString::createFromAscii(aPropNames[i]);
+ }
+ return aNames;
+}
+/*-- 28.09.00 09:55:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwLayoutViewConfig::SwLayoutViewConfig(BOOL bIsWeb, SwMasterUsrPref& rPar) :
+ ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Layout") : C2U("Office.Writer/Layout"),
+ CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
+ rParent(rPar),
+ bWeb(bIsWeb)
+{
+}
+/*-- 28.09.00 09:55:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwLayoutViewConfig::~SwLayoutViewConfig()
+{
+}
+/*-- 28.09.00 09:55:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwLayoutViewConfig::Commit()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ Any &rVal = pValues[nProp];
+ switch(nProp)
+ {
+ case 0: rVal <<= (sal_Bool) rParent.IsCrossHair(); break; // "Line/Guide",
+ case 1: rVal <<= (sal_Bool) rParent.IsSolidMarkHdl(); break; // "Line/SimpleControlPoint",
+ case 2: rVal <<= (sal_Bool) rParent.IsBigMarkHdl(); break; // "Line/LargeControlPoint",
+ case 3: rVal <<= (sal_Bool) rParent.IsViewHScrollBar(); break; // "Window/HorizontalScroll",
+ case 4: rVal <<= (sal_Bool) rParent.IsViewVScrollBar(); break; // "Window/VerticalScroll",
+ case 5: rVal <<= (sal_Bool) rParent.IsViewAnyRuler(); break; // "Window/ShowRulers"
+ // #i14593# use IsView*Ruler(TRUE) instead of IsView*Ruler()
+ // this preserves the single ruler states even if "Window/ShowRulers" is off
+ case 6: rVal <<= (sal_Bool) rParent.IsViewHRuler(TRUE); break; // "Window/HorizontalRuler",
+ case 7: rVal <<= (sal_Bool) rParent.IsViewVRuler(TRUE); break; // "Window/VerticalRuler",
+ case 8:
+ if(rParent.bIsHScrollMetricSet)
+ rVal <<= (sal_Int32)rParent.eHScrollMetric; // "Window/HorizontalRulerUnit"
+ break;
+ case 9:
+ if(rParent.bIsVScrollMetricSet)
+ rVal <<= (sal_Int32)rParent.eVScrollMetric; // "Window/VerticalRulerUnit"
+ break;
+ case 10: rVal <<= (sal_Bool) rParent.IsSmoothScroll(); break; // "Window/SmoothScroll",
+ case 11: rVal <<= (sal_Int32)rParent.GetZoom(); break; // "Zoom/Value",
+ case 12: rVal <<= (sal_Int32)rParent.GetZoomType(); break; // "Zoom/Type",
+ case 13: rVal <<= (sal_Bool) rParent.IsAlignMathObjectsToBaseline(); break; // "Other/IsAlignMathObjectsToBaseline"
+ case 14: rVal <<= (sal_Int32)rParent.GetMetric(); break; // "Other/MeasureUnit",
+ case 15: rVal <<= static_cast<sal_Int32>(TWIP_TO_MM100(rParent.GetDefTab())); break;// "Other/TabStop",
+ case 16: rVal <<= (sal_Bool) rParent.IsVRulerRight(); break; // "Window/IsVerticalRulerRight",
+ case 17: rVal <<= (sal_Int32)rParent.GetViewLayoutColumns(); break; // "ViewLayout/Columns",
+ case 18: rVal <<= (sal_Bool) rParent.IsViewLayoutBookMode(); break; // "ViewLayout/BookMode",
+ case 19: rVal <<= (sal_Bool) rParent.IsSquaredPageMode(); break; // "Other/IsSquaredPageMode",
+ }
+ }
+ PutProperties(aNames, aValues);
+}
+/*-- 28.09.00 09:55:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwLayoutViewConfig::Load()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aNames.getLength())
+ {
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ sal_Int32 nInt32Val = 0;
+ sal_Bool bSet = sal_False;
+ pValues[nProp] >>= nInt32Val;
+ pValues[nProp] >>= bSet;
+
+ switch(nProp)
+ {
+ case 0: rParent.SetCrossHair(bSet); break;// "Line/Guide",
+ case 1: rParent.SetSolidMarkHdl(bSet); break;// "Line/SimpleControlPoint",
+ case 2: rParent.SetBigMarkHdl(bSet); break;// "Line/LargeControlPoint",
+ case 3: rParent.SetViewHScrollBar(bSet); break;// "Window/HorizontalScroll",
+ case 4: rParent.SetViewVScrollBar(bSet); break;// "Window/VerticalScroll",
+ case 5: rParent.SetViewAnyRuler(bSet);break; // "Window/ShowRulers"
+ case 6: rParent.SetViewHRuler(bSet); break;// "Window/HorizontalRuler",
+ case 7: rParent.SetViewVRuler(bSet); break;// "Window/VerticalRuler",
+ case 8:
+ {
+ rParent.bIsHScrollMetricSet = sal_True;
+ rParent.eHScrollMetric = ((FieldUnit)nInt32Val); // "Window/HorizontalRulerUnit"
+ }
+ break;
+ case 9:
+ {
+ rParent.bIsVScrollMetricSet = sal_True;
+ rParent.eVScrollMetric = ((FieldUnit)nInt32Val); // "Window/VerticalRulerUnit"
+ }
+ break;
+ case 10: rParent.SetSmoothScroll(bSet); break;// "Window/SmoothScroll",
+ case 11: rParent.SetZoom( static_cast< USHORT >(nInt32Val) ); break;// "Zoom/Value",
+ case 12: rParent.SetZoomType( static_cast< SvxZoomType >(nInt32Val) ); break;// "Zoom/Type",
+ case 13: rParent.SetAlignMathObjectsToBaseline(bSet); break;// "Other/IsAlignMathObjectsToBaseline"
+ case 14: rParent.SetMetric((FieldUnit)nInt32Val, TRUE); break;// "Other/MeasureUnit",
+ case 15: rParent.SetDefTab(MM100_TO_TWIP(nInt32Val), TRUE); break;// "Other/TabStop",
+ case 16: rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight",
+ case 17: rParent.SetViewLayoutColumns( static_cast<USHORT>(nInt32Val) ); break;// "ViewLayout/Columns",
+ case 18: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode",
+ case 19: rParent.SetDefaultPageMode(bSet,TRUE); break;// "Other/IsSquaredPageMode",
+ }
+ }
+ }
+ }
+}
+
+void SwLayoutViewConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+/* -----------------------------19.01.01 13:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence<OUString> SwGridConfig::GetPropertyNames()
+{
+ static const char* aPropNames[] =
+ {
+ "Option/SnapToGrid", // 0
+ "Option/VisibleGrid", // 1
+ "Option/Synchronize", // 2
+ "Resolution/XAxis", // 3
+ "Resolution/YAxis", // 4
+ "Subdivision/XAxis", // 5
+ "Subdivision/YAxis" // 6
+ };
+ const int nCount = 7;
+ Sequence<OUString> aNames(nCount);
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ {
+ pNames[i] = OUString::createFromAscii(aPropNames[i]);
+ }
+ return aNames;
+}
+/* -----------------------------19.01.01 13:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwGridConfig::SwGridConfig(BOOL bIsWeb, SwMasterUsrPref& rPar) :
+ ConfigItem(bIsWeb ? C2U("Office.WriterWeb/Grid") : C2U("Office.Writer/Grid"),
+ CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
+ rParent(rPar),
+ bWeb(bIsWeb)
+{
+}
+/* -----------------------------19.01.01 13:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwGridConfig::~SwGridConfig()
+{
+}
+/* -----------------------------19.01.01 13:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwGridConfig::Commit()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ sal_Bool bSet;
+ switch(nProp)
+ {
+ case 0: bSet = rParent.IsSnap(); break;// "Option/SnapToGrid",
+ case 1: bSet = rParent.IsGridVisible(); break;//"Option/VisibleGrid",
+ case 2: bSet = rParent.IsSynchronize(); break;// "Option/Synchronize",
+ case 3: pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100(rParent.GetSnapSize().Width()); break;// "Resolution/XAxis",
+ case 4: pValues[nProp] <<= (sal_Int32)TWIP_TO_MM100(rParent.GetSnapSize().Height()); break;// "Resolution/YAxis",
+ case 5: pValues[nProp] <<= (sal_Int16)rParent.GetDivisionX(); break;// "Subdivision/XAxis",
+ case 6: pValues[nProp] <<= (sal_Int16)rParent.GetDivisionY(); break;// "Subdivision/YAxis"
+ }
+ if(nProp < 3)
+ pValues[nProp].setValue(&bSet, ::getBooleanCppuType());
+ }
+ PutProperties(aNames, aValues);
+}
+/* -----------------------------19.01.01 13:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwGridConfig::Load()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aNames.getLength())
+ {
+ Size aSnap(rParent.GetSnapSize());
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ sal_Bool bSet = nProp < 3 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False;
+ sal_Int32 nSet = 0;
+ if(nProp >= 3)
+ pValues[nProp] >>= nSet;
+ switch(nProp)
+ {
+ case 0: rParent.SetSnap(bSet); break;// "Option/SnapToGrid",
+ case 1: rParent.SetGridVisible(bSet); break;//"Option/VisibleGrid",
+ case 2: rParent.SetSynchronize(bSet); break;// "Option/Synchronize",
+ case 3: aSnap.Width() = MM100_TO_TWIP(nSet); break;// "Resolution/XAxis",
+ case 4: aSnap.Height() = MM100_TO_TWIP(nSet); break;// "Resolution/YAxis",
+ case 5: rParent.SetDivisionX((short)nSet); break;// "Subdivision/XAxis",
+ case 6: rParent.SetDivisionY((short)nSet); break;// "Subdivision/YAxis"
+ }
+ }
+ }
+ rParent.SetSnapSize(aSnap);
+ }
+}
+
+void SwGridConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+/* -----------------------------19.01.01 13:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence<OUString> SwCursorConfig::GetPropertyNames()
+{
+ static const char* aPropNames[] =
+ {
+ "DirectCursor/UseDirectCursor", // 0
+ "DirectCursor/Insert", // 1
+ "Option/ProtectedArea" // 2
+ };
+ const int nCount = 3;
+ Sequence<OUString> aNames(nCount);
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ pNames[i] = C2U(aPropNames[i]);
+ return aNames;
+}
+/* -----------------------------19.01.01 13:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwCursorConfig::SwCursorConfig(SwMasterUsrPref& rPar) :
+ ConfigItem(C2U("Office.Writer/Cursor"),
+ CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
+ rParent(rPar)
+{
+}
+/* -----------------------------19.01.01 13:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwCursorConfig::~SwCursorConfig()
+{
+}
+/* -----------------------------19.01.01 13:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwCursorConfig::Commit()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ sal_Bool bSet;
+ switch(nProp)
+ {
+ case 0: bSet = rParent.IsShadowCursor(); break;// "DirectCursor/UseDirectCursor",
+ case 1: pValues[nProp] <<= (sal_Int32)rParent.GetShdwCrsrFillMode(); break;// "DirectCursor/Insert",
+ case 2: bSet = rParent.IsCursorInProtectedArea(); break;// "Option/ProtectedArea"
+ }
+ if(nProp != 1 )
+ pValues[nProp].setValue(&bSet, ::getBooleanCppuType());
+ }
+ PutProperties(aNames, aValues);
+}
+/* -----------------------------19.01.01 13:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwCursorConfig::Load()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aNames.getLength())
+ {
+
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ sal_Bool bSet = sal_False;
+ sal_Int32 nSet = 0;
+ if(nProp != 1 )
+ bSet = *(sal_Bool*)pValues[nProp].getValue();
+ else
+ pValues[nProp] >>= nSet;
+ switch(nProp)
+ {
+ case 0: rParent.SetShadowCursor(bSet); break;// "DirectCursor/UseDirectCursor",
+ case 1: rParent.SetShdwCrsrFillMode((BYTE)nSet); break;// "DirectCursor/Insert",
+ case 2: rParent.SetCursorInProtectedArea(bSet); break;// "Option/ProtectedArea"
+ }
+ }
+ }
+
+ }
+}
+
+void SwCursorConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+/*-- 28.09.00 09:55:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwWebColorConfig::SwWebColorConfig(SwMasterUsrPref& rPar) :
+ ConfigItem(C2U("Office.WriterWeb/Background"),
+ CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE),
+ rParent(rPar),
+ aPropNames(1)
+{
+ aPropNames.getArray()[0] = C2U("Color");
+}
+/*-- 28.09.00 09:55:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwWebColorConfig::~SwWebColorConfig()
+{
+}
+/*-- 28.09.00 09:55:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwWebColorConfig::Commit()
+{
+ Sequence<Any> aValues(aPropNames.getLength());
+ Any* pValues = aValues.getArray();
+ for(int nProp = 0; nProp < aPropNames.getLength(); nProp++)
+ {
+ switch(nProp)
+ {
+ case 0: pValues[nProp] <<= (sal_Int32)rParent.GetRetoucheColor().GetColor(); break;// "Color",
+ }
+ }
+ PutProperties(aPropNames, aValues);
+}
+
+void SwWebColorConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+/*-- 28.09.00 09:55:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwWebColorConfig::Load()
+{
+ Sequence<Any> aValues = GetProperties(aPropNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aPropNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aPropNames.getLength())
+ {
+ for(int nProp = 0; nProp < aPropNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ switch(nProp)
+ {
+ case 0:
+ sal_Int32 nSet = 0;
+ pValues[nProp] >>= nSet; rParent.SetRetoucheColor(nSet);
+ break;// "Color",
+ }
+ }
+ }
+ }
+}
+
+
diff --git a/sw/source/ui/config/viewopt.cxx b/sw/source/ui/config/viewopt.cxx
new file mode 100644
index 000000000000..13cec2b93bb5
--- /dev/null
+++ b/sw/source/ui/config/viewopt.cxx
@@ -0,0 +1,643 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <svx/htmlmode.hxx>
+#include <svtools/htmlcfg.hxx>
+
+#ifndef _SVX_SVXIDS_HRC //autogen
+#include <svx/svxids.hrc>
+#endif
+#include <editeng/svxenum.hxx>
+#include <editeng/svxacorr.hxx>
+#include <unotools/localedatawrapper.hxx>
+#ifndef _REGION_HXX //autogen
+#include <vcl/region.hxx>
+#endif
+#ifndef _OUTDEV_HXX //autogen
+#include <vcl/outdev.hxx>
+#endif
+#include <vcl/window.hxx>
+#include <swmodule.hxx>
+#include <swtypes.hxx>
+#include <viewopt.hxx>
+#ifndef _WDOCSH_HXX
+#include <wdocsh.hxx>
+#endif
+#include <swrect.hxx>
+#include <crstate.hxx>
+#include <svtools/colorcfg.hxx>
+#include <svtools/accessibilityoptions.hxx>
+#include <unotools/syslocale.hxx>
+
+#include <editeng/acorrcfg.hxx>
+
+#ifdef DBG_UTIL
+BOOL SwViewOption::bTest9 = FALSE; //DrawingLayerNotLoading
+#endif
+Color SwViewOption::aDocBoundColor(COL_LIGHTGRAY);
+Color SwViewOption::aObjectBoundColor(COL_LIGHTGRAY);
+Color SwViewOption::aDocColor(COL_LIGHTGRAY);
+Color SwViewOption::aAppBackgroundColor(COL_LIGHTGRAY);
+Color SwViewOption::aTableBoundColor(COL_LIGHTGRAY);
+Color SwViewOption::aIndexShadingsColor(COL_LIGHTGRAY);
+Color SwViewOption::aLinksColor(COL_BLUE);
+Color SwViewOption::aVisitedLinksColor(COL_RED);
+Color SwViewOption::aDirectCursorColor(COL_BLUE);
+Color SwViewOption::aTextGridColor(COL_LIGHTGRAY);
+Color SwViewOption::aSpellColor(COL_LIGHTRED);
+Color SwViewOption::aSmarttagColor(COL_LIGHTMAGENTA);
+Color SwViewOption::aFontColor(COL_BLACK);
+Color SwViewOption::aFieldShadingsColor(COL_LIGHTGRAY);
+Color SwViewOption::aSectionBoundColor(COL_LIGHTGRAY);
+Color SwViewOption::aPageBreakColor(COL_BLUE);
+Color SwViewOption::aScriptIndicatorColor(COL_GREEN);
+
+sal_Int32 SwViewOption::nAppearanceFlags = VIEWOPT_DOC_BOUNDARIES|VIEWOPT_OBJECT_BOUNDARIES;
+USHORT SwViewOption::nPixelTwips = 0; //ein Pixel auf dem Bildschirm
+
+
+#define LINEBREAK_SIZE 12, 8
+#define TAB_SIZE 12, 6
+
+#define MIN_BLANKWIDTH 40
+#define MIN_BLANKHEIGHT 40
+#define MIN_TABWIDTH 120
+#define MIN_TABHEIGHT 200
+
+static const char __FAR_DATA aPostItStr[] = " ";
+
+/*************************************************************************
+ * SwViewOption::IsEqualFlags()
+ *************************************************************************/
+
+BOOL SwViewOption::IsEqualFlags( const SwViewOption &rOpt ) const
+{
+ return nCoreOptions == rOpt.nCoreOptions
+ && nCore2Options == rOpt.nCore2Options
+ && aSnapSize == rOpt.aSnapSize
+ && mnViewLayoutColumns == rOpt.mnViewLayoutColumns
+ && nDivisionX == rOpt.GetDivisionX()
+ && nDivisionY == rOpt.GetDivisionY()
+ && nPagePrevRow == rOpt.GetPagePrevRow()
+ && nPagePrevCol == rOpt.GetPagePrevCol()
+ && aRetoucheColor == rOpt.GetRetoucheColor()
+ && bFormView == rOpt.IsFormView()
+ && mbViewLayoutBookMode == rOpt.mbViewLayoutBookMode
+ && bShowPlaceHolderFields == rOpt.bShowPlaceHolderFields
+ && bIdle == rOpt.bIdle
+#ifdef DBG_UTIL
+ // korrespondieren zu den Angaben in ui/config/cfgvw.src
+ && bTest1 == rOpt.IsTest1()
+ && bTest2 == rOpt.IsTest2()
+ && bTest3 == rOpt.IsTest3()
+ && bTest4 == rOpt.IsTest4()
+ && bTest5 == rOpt.IsTest5()
+ && bTest6 == rOpt.IsTest6()
+ && bTest7 == rOpt.IsTest7()
+ && bTest8 == rOpt.IsTest8()
+ && bTest10 == rOpt.IsTest10()
+#endif
+ ;
+}
+
+/*************************************************************************
+ * SwViewOption::DrawRect()
+ *************************************************************************/
+
+void SwViewOption::DrawRect( OutputDevice *pOut,
+ const SwRect &rRect, long nCol ) const
+{
+ if ( pOut->GetOutDevType() != OUTDEV_PRINTER )
+ {
+ const Color aCol( nCol );
+ const Color aOldColor( pOut->GetFillColor() );
+ pOut->SetFillColor( aCol );
+ pOut->DrawRect( rRect.SVRect() );
+ pOut->SetFillColor( aOldColor );
+ }
+ else
+ DrawRectPrinter( pOut, rRect );
+}
+
+/*************************************************************************
+ * SwViewOption::DrawRectPrinter()
+ *************************************************************************/
+
+void SwViewOption::DrawRectPrinter( OutputDevice *pOut,
+ const SwRect &rRect ) const
+{
+ Color aOldColor(pOut->GetLineColor());
+ Color aOldFillColor( pOut->GetFillColor() );
+ pOut->SetLineColor( Color(COL_BLACK) );
+ pOut->SetFillColor( Color(COL_TRANSPARENT ));
+ pOut->DrawRect( rRect.SVRect() );
+ pOut->SetFillColor( aOldFillColor );
+ pOut->SetLineColor( aOldColor );
+}
+
+/*************************************************************************
+ * SwViewOption::GetPostItsWidth()
+ *************************************************************************/
+
+USHORT SwViewOption::GetPostItsWidth( const OutputDevice *pOut ) const
+{
+ ASSERT( pOut, "no Outdev" );
+ return USHORT(pOut->GetTextWidth( String::CreateFromAscii(aPostItStr )));
+}
+
+/*************************************************************************
+ * SwViewOption::PaintPostIts()
+ *************************************************************************/
+
+void SwViewOption::PaintPostIts( OutputDevice *pOut, const SwRect &rRect, sal_Bool bIsScript ) const
+{
+ if( pOut && bIsScript )
+ {
+ Color aOldLineColor( pOut->GetLineColor() );
+ pOut->SetLineColor( Color(COL_GRAY ) );
+ // Wir ziehen ueberall zwei Pixel ab, damit es schick aussieht
+ USHORT nPix = GetPixelTwips() * 2;
+ if( rRect.Width() <= 2 * nPix || rRect.Height() <= 2 * nPix )
+ nPix = 0;
+ const Point aTopLeft( rRect.Left() + nPix, rRect.Top() + nPix );
+ const Point aBotRight( rRect.Right() - nPix, rRect.Bottom() - nPix );
+ const SwRect aRect( aTopLeft, aBotRight );
+ DrawRect( pOut, aRect, aScriptIndicatorColor.GetColor() );
+ pOut->SetLineColor( aOldLineColor );
+ }
+}
+
+
+/*************************************************************************
+|*
+|* ViewOption::ViewOption()
+|*
+|* Letzte Aenderung MA 04. Aug. 93
+|*
+|*************************************************************************/
+
+SwViewOption::SwViewOption() :
+ aRetoucheColor( COL_TRANSPARENT ),
+ mnViewLayoutColumns( 0 ),
+ nPagePrevRow( 1 ),
+ nPagePrevCol( 2 ),
+ nShdwCrsrFillMode( FILL_TAB ),
+ bReadonly(FALSE),
+ bStarOneSetting(FALSE),
+ bIsPagePreview(FALSE),
+ bSelectionInReadonly(FALSE),
+ // --> FME 2004-06-29 #114856# Formular view
+ bFormView(FALSE),
+ // <--
+ bBookview(FALSE),
+ mbViewLayoutBookMode(FALSE),
+ bShowPlaceHolderFields( sal_True ),
+
+ nZoom( 100 ),
+ eZoom( SVX_ZOOM_PERCENT ),
+ nTblDest(TBL_DEST_CELL)
+{
+ // Initialisierung ist jetzt etwas einfacher
+ // alle Bits auf 0
+ nCoreOptions = VIEWOPT_1_HARDBLANK | VIEWOPT_1_SOFTHYPH |
+ VIEWOPT_1_REF |
+ VIEWOPT_1_GRAPHIC |
+ VIEWOPT_1_TABLE | VIEWOPT_1_DRAW | VIEWOPT_1_CONTROL |
+ VIEWOPT_1_PAGEBACK |
+ VIEWOPT_1_SOLIDMARKHDL | VIEWOPT_1_POSTITS;
+ nCore2Options = VIEWOPT_CORE2_BLACKFONT | VIEWOPT_CORE2_HIDDENPARA;
+ nUIOptions = VIEWOPT_2_MODIFIED | VIEWOPT_2_GRFKEEPZOOM |VIEWOPT_2_ANY_RULER;
+
+ if(MEASURE_METRIC != SvtSysLocale().GetLocaleData().getMeasurementSystemEnum())
+ aSnapSize.Width() = aSnapSize.Height() = 720; // 1/2"
+ else
+ aSnapSize.Width() = aSnapSize.Height() = 567; // 1 cm
+ nDivisionX = nDivisionY = 1;
+
+ bSelectionInReadonly = SW_MOD()->GetAccessibilityOptions().IsSelectionInReadonly();
+
+ bIdle = true;
+
+#ifdef DBG_UTIL
+ // korrespondieren zu den Angaben in ui/config/cfgvw.src
+ bTest1 = bTest2 = bTest3 = bTest4 =
+ bTest5 = bTest6 = bTest7 = bTest8 = bTest10 = FALSE;
+#endif
+}
+
+SwViewOption::SwViewOption(const SwViewOption& rVOpt)
+{
+ bReadonly = FALSE;
+ bSelectionInReadonly = FALSE;
+ // --> FME 2004-06-29 #114856# Formular view
+ bFormView = rVOpt.bFormView;
+ // <--
+ nZoom = rVOpt.nZoom ;
+ aSnapSize = rVOpt.aSnapSize ;
+ mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ;
+ nDivisionX = rVOpt.nDivisionX ;
+ nDivisionY = rVOpt.nDivisionY ;
+ nPagePrevRow = rVOpt.nPagePrevRow;
+ nPagePrevCol = rVOpt.nPagePrevCol;
+ bIsPagePreview = rVOpt.bIsPagePreview;
+ eZoom = rVOpt.eZoom ;
+ nTblDest = rVOpt.nTblDest ;
+ nUIOptions = rVOpt.nUIOptions ;
+ nCoreOptions = rVOpt.nCoreOptions ;
+ nCore2Options = rVOpt.nCore2Options ;
+ aRetoucheColor = rVOpt.GetRetoucheColor();
+ sSymbolFont = rVOpt.sSymbolFont;
+ nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
+ bStarOneSetting = rVOpt.bStarOneSetting;
+ bBookview = rVOpt.bBookview;
+ mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode;
+ bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields;
+ bIdle = rVOpt.bIdle;
+
+#ifdef DBG_UTIL
+ bTest1 = rVOpt.bTest1 ;
+ bTest2 = rVOpt.bTest2 ;
+ bTest3 = rVOpt.bTest3 ;
+ bTest4 = rVOpt.bTest4 ;
+ bTest5 = rVOpt.bTest5 ;
+ bTest6 = rVOpt.bTest6 ;
+ bTest7 = rVOpt.bTest7 ;
+ bTest8 = rVOpt.bTest8 ;
+ bTest10 = rVOpt.bTest10 ;
+#endif
+}
+
+
+SwViewOption& SwViewOption::operator=( const SwViewOption &rVOpt )
+{
+ // --> DVO FME 2004-06-29 #114856# Formular view
+ bFormView = rVOpt.bFormView ;
+ // <--
+ nZoom = rVOpt.nZoom ;
+ aSnapSize = rVOpt.aSnapSize ;
+ mnViewLayoutColumns = rVOpt.mnViewLayoutColumns ;
+ nDivisionX = rVOpt.nDivisionX ;
+ nDivisionY = rVOpt.nDivisionY ;
+ nPagePrevRow = rVOpt.nPagePrevRow;
+ nPagePrevCol = rVOpt.nPagePrevCol;
+ bIsPagePreview = rVOpt.bIsPagePreview;
+ eZoom = rVOpt.eZoom ;
+ nTblDest = rVOpt.nTblDest ;
+ nUIOptions = rVOpt.nUIOptions ;
+ nCoreOptions = rVOpt.nCoreOptions;
+ nCore2Options = rVOpt.nCore2Options;
+ aRetoucheColor = rVOpt.GetRetoucheColor();
+ sSymbolFont = rVOpt.sSymbolFont;
+ nShdwCrsrFillMode = rVOpt.nShdwCrsrFillMode;
+ bStarOneSetting = rVOpt.bStarOneSetting;
+ bBookview = rVOpt.bBookview;
+ mbViewLayoutBookMode = rVOpt.mbViewLayoutBookMode;
+ bShowPlaceHolderFields = rVOpt.bShowPlaceHolderFields;
+ bIdle = rVOpt.bIdle;
+
+#ifdef DBG_UTIL
+ bTest1 = rVOpt.bTest1 ;
+ bTest2 = rVOpt.bTest2 ;
+ bTest3 = rVOpt.bTest3 ;
+ bTest4 = rVOpt.bTest4 ;
+ bTest5 = rVOpt.bTest5 ;
+ bTest6 = rVOpt.bTest6 ;
+ bTest7 = rVOpt.bTest7 ;
+ bTest8 = rVOpt.bTest8 ;
+ bTest10 = rVOpt.bTest10 ;
+#endif
+ return *this;
+}
+
+
+SwViewOption::~SwViewOption()
+{
+}
+
+/*************************************************************************
+|*
+|* ViewOption::Init()
+|*
+|* Letzte Aenderung MA 04. Aug. 93
+|*
+|*************************************************************************/
+
+void SwViewOption::Init( Window *pWin )
+{
+ if( !nPixelTwips && pWin )
+ {
+ nPixelTwips = (USHORT)pWin->PixelToLogic( Size(1,1) ).Height();
+ }
+}
+
+BOOL SwViewOption::IsAutoCompleteWords() const
+{
+ const SvxSwAutoFmtFlags& rFlags = SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags();
+ return /*rFlags.bAutoCompleteWords &&*/ rFlags.bAutoCmpltCollectWords;
+}
+
+/*************************************************************************/
+/* */
+/*************************************************************************/
+
+AuthorCharAttr::AuthorCharAttr() :
+ nItemId (SID_ATTR_CHAR_UNDERLINE),
+ nAttr (UNDERLINE_SINGLE),
+ nColor (COL_TRANSPARENT)
+{
+}
+
+/*-----------------07.01.97 13.50-------------------
+
+--------------------------------------------------*/
+
+USHORT GetHtmlMode(const SwDocShell* pShell)
+{
+ USHORT nRet = 0;
+ if(!pShell || PTR_CAST(SwWebDocShell, pShell))
+ {
+ nRet = HTMLMODE_ON;
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ switch ( pHtmlOpt->GetExportMode() )
+ {
+ case HTML_CFG_MSIE_40:
+ nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SMALL_CAPS|
+ HTMLMODE_SOME_STYLES|
+ HTMLMODE_FULL_STYLES|HTMLMODE_GRAPH_POS|
+ HTMLMODE_FULL_ABS_POS|HTMLMODE_SOME_ABS_POS;
+ break;
+ case HTML_CFG_NS40:
+ nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SOME_STYLES|
+ HTMLMODE_FRM_COLUMNS|HTMLMODE_BLINK|HTMLMODE_GRAPH_POS|
+ HTMLMODE_SOME_ABS_POS;
+ break;
+ case HTML_CFG_WRITER:
+ nRet |= HTMLMODE_PARA_BORDER|HTMLMODE_SMALL_CAPS|
+ HTMLMODE_SOME_STYLES|
+ HTMLMODE_FRM_COLUMNS|HTMLMODE_FULL_STYLES|
+ HTMLMODE_BLINK|HTMLMODE_DROPCAPS|HTMLMODE_GRAPH_POS|
+ HTMLMODE_FULL_ABS_POS|HTMLMODE_SOME_ABS_POS;
+ break;
+ case HTML_CFG_HTML32:
+ break;
+ }
+ }
+ return nRet;
+}
+/* -----------------------------24.04.2002 10:20------------------------------
+
+ ---------------------------------------------------------------------------*/
+Color& SwViewOption::GetDocColor()
+{
+ return aDocColor;
+}
+/* -----------------------------23.04.2002 17:18------------------------------
+
+ ---------------------------------------------------------------------------*/
+Color& SwViewOption::GetDocBoundariesColor()
+{
+ return aDocBoundColor;
+}
+/* -----------------------------23.04.2002 17:53------------------------------
+
+ ---------------------------------------------------------------------------*/
+Color& SwViewOption::GetObjectBoundariesColor()
+{
+ return aObjectBoundColor;
+}
+/* -----------------------------24.04.2002 10:41------------------------------
+
+ ---------------------------------------------------------------------------*/
+Color& SwViewOption::GetAppBackgroundColor()
+{
+ return aAppBackgroundColor;
+}
+/*-- 24.04.2002 10:50:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Color& SwViewOption::GetTableBoundariesColor()
+{
+ return aTableBoundColor;
+}
+/*-- 24.04.2002 10:50:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Color& SwViewOption::GetIndexShadingsColor()
+{
+ return aIndexShadingsColor;
+}
+/*-- 24.04.2002 10:50:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Color& SwViewOption::GetLinksColor()
+{
+ return aLinksColor;
+}
+/*-- 24.04.2002 10:50:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Color& SwViewOption::GetVisitedLinksColor()
+{
+ return aVisitedLinksColor;
+}
+/*-- 24.04.2002 10:50:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Color& SwViewOption::GetDirectCursorColor()
+{
+ return aDirectCursorColor;
+}
+/*-- 24.04.2002 10:50:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Color& SwViewOption::GetTextGridColor()
+{
+ return aTextGridColor;
+}
+/*-- 24.04.2002 10:50:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Color& SwViewOption::GetSpellColor()
+{
+ return aSpellColor;
+}
+/*-- 24.04.2007 10:50:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Color& SwViewOption::GetSmarttagColor()
+{
+ return aSmarttagColor;
+}
+/*-- 06.12.2002 10:50:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Color& SwViewOption::GetFontColor()
+{
+ return aFontColor;
+}
+/*-- 24.04.2002 10:50:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Color& SwViewOption::GetFieldShadingsColor()
+{
+ return aFieldShadingsColor;
+}
+/*-- 24.04.2002 10:50:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Color& SwViewOption::GetSectionBoundColor()
+{
+ return aSectionBoundColor;
+}
+/* -----------------------------2002/07/31 14:00------------------------------
+
+ ---------------------------------------------------------------------------*/
+Color& SwViewOption::GetPageBreakColor()
+{
+ return aPageBreakColor;
+}
+
+/* -----------------------------23.04.2002 17:41------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwViewOption::ApplyColorConfigValues(const svtools::ColorConfig& rConfig )
+{
+ aDocColor.SetColor(rConfig.GetColorValue(svtools::DOCCOLOR).nColor);
+
+ svtools::ColorConfigValue aValue = rConfig.GetColorValue(svtools::DOCBOUNDARIES);
+ aDocBoundColor.SetColor(aValue.nColor);
+ nAppearanceFlags = 0;
+ if(aValue.bIsVisible)
+ nAppearanceFlags |= VIEWOPT_DOC_BOUNDARIES;
+
+ aAppBackgroundColor.SetColor(rConfig.GetColorValue(svtools::APPBACKGROUND).nColor);
+
+ aValue = rConfig.GetColorValue(svtools::OBJECTBOUNDARIES);
+ aObjectBoundColor.SetColor(aValue.nColor);
+ if(aValue.bIsVisible)
+ nAppearanceFlags |= VIEWOPT_OBJECT_BOUNDARIES;
+
+ aValue = rConfig.GetColorValue(svtools::TABLEBOUNDARIES);
+ aTableBoundColor.SetColor(aValue.nColor);
+ if(aValue.bIsVisible)
+ nAppearanceFlags |= VIEWOPT_TABLE_BOUNDARIES;
+
+ aValue = rConfig.GetColorValue(svtools::WRITERIDXSHADINGS);
+ aIndexShadingsColor.SetColor(aValue.nColor);
+ if(aValue.bIsVisible)
+ nAppearanceFlags |= VIEWOPT_INDEX_SHADINGS;
+
+ aValue = rConfig.GetColorValue(svtools::LINKS);
+ aLinksColor.SetColor(aValue.nColor);
+ if(aValue.bIsVisible)
+ nAppearanceFlags |= VIEWOPT_LINKS;
+
+ aValue = rConfig.GetColorValue(svtools::LINKSVISITED);
+ aVisitedLinksColor.SetColor(aValue.nColor);
+ if(aValue.bIsVisible)
+ nAppearanceFlags |= VIEWOPT_VISITED_LINKS;
+
+ aDirectCursorColor.SetColor(rConfig.GetColorValue(svtools::WRITERDIRECTCURSOR).nColor);
+
+ aTextGridColor.SetColor(rConfig.GetColorValue(svtools::WRITERTEXTGRID).nColor);
+
+ aSpellColor.SetColor(rConfig.GetColorValue(svtools::SPELL).nColor);
+
+ aSmarttagColor.SetColor(rConfig.GetColorValue(svtools::SMARTTAGS).nColor);
+
+ aFontColor.SetColor(rConfig.GetColorValue(svtools::FONTCOLOR).nColor);
+
+ aValue = rConfig.GetColorValue(svtools::WRITERFIELDSHADINGS);
+ aFieldShadingsColor.SetColor(aValue.nColor);
+ if(aValue.bIsVisible)
+ nAppearanceFlags |= VIEWOPT_FIELD_SHADINGS;
+
+ aValue = rConfig.GetColorValue(svtools::WRITERSECTIONBOUNDARIES);
+ aSectionBoundColor.SetColor(aValue.nColor);
+ if(aValue.bIsVisible)
+ nAppearanceFlags |= VIEWOPT_SECTION_BOUNDARIES;
+
+ aValue = rConfig.GetColorValue(svtools::WRITERPAGEBREAKS);
+ aPageBreakColor.SetColor(aValue.nColor);
+
+ aScriptIndicatorColor.SetColor(rConfig.GetColorValue(svtools::WRITERSCRIPTINDICATOR).nColor);
+}
+/* -----------------------------23.04.2002 17:48------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwViewOption::SetAppearanceFlag(sal_Int32 nFlag, BOOL bSet, BOOL bSaveInConfig )
+{
+ if(bSet)
+ nAppearanceFlags |= nFlag;
+ else
+ nAppearanceFlags &= ~nFlag;
+ if(bSaveInConfig)
+ {
+ //create an editable svtools::ColorConfig and store the change
+ svtools::EditableColorConfig aEditableConfig;
+ struct FlagToConfig_Impl
+ {
+ sal_Int32 nFlag;
+ svtools::ColorConfigEntry eEntry;
+ };
+ static const FlagToConfig_Impl aFlags[] =
+ {
+ { VIEWOPT_DOC_BOUNDARIES , svtools::DOCBOUNDARIES },
+ { VIEWOPT_OBJECT_BOUNDARIES , svtools::OBJECTBOUNDARIES },
+ { VIEWOPT_TABLE_BOUNDARIES , svtools::TABLEBOUNDARIES },
+ { VIEWOPT_INDEX_SHADINGS , svtools::WRITERIDXSHADINGS },
+ { VIEWOPT_LINKS , svtools::LINKS },
+ { VIEWOPT_VISITED_LINKS , svtools::LINKSVISITED },
+ { VIEWOPT_FIELD_SHADINGS , svtools::WRITERFIELDSHADINGS },
+ { VIEWOPT_SECTION_BOUNDARIES , svtools::WRITERSECTIONBOUNDARIES },
+ { 0 , svtools::ColorConfigEntryCount }
+ };
+ sal_uInt16 nPos = 0;
+ while(aFlags[nPos].nFlag)
+ {
+ if(0 != (nFlag&aFlags[nPos].nFlag))
+ {
+ svtools::ColorConfigValue aValue = aEditableConfig.GetColorValue(aFlags[nPos].eEntry);
+ aValue.bIsVisible = bSet;
+ aEditableConfig.SetColorValue(aFlags[nPos].eEntry, aValue);
+ }
+ nPos++;
+ }
+ }
+}
+/* -----------------------------24.04.2002 10:42------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwViewOption::IsAppearanceFlag(sal_Int32 nFlag)
+{
+ return 0 != (nAppearanceFlags & nFlag);
+}
+
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
new file mode 100644
index 000000000000..331d7035dc56
--- /dev/null
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -0,0 +1,752 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <swtypes.hxx>
+#include <addresslistdialog.hxx>
+#include <selectdbtabledialog.hxx>
+#include <createaddresslistdialog.hxx>
+#include <mailmergewizard.hxx>
+#include <mmconfigitem.hxx>
+#include <mmaddressblockpage.hxx>
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+#include <dbconfig.hxx>
+#include <unotools/tempfile.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <tools/urlobj.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/types.hxx>
+#include <com/sun/star/sdbc/XCloseable.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/uno/XNamingService.hpp>
+#include <com/sun/star/sdb/XCompletedConnection.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/XDocumentDataSource.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#ifndef _COM_SUN_STAR_SDB_XSINGLESELECTQUERYCOMPOSERFACTORY_HPP_
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+#endif
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <swunohelper.hxx>
+#include <vcl/waitobj.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svl/urihelper.hxx>
+#include <addresslistdialog.hrc>
+#include <dbui.hrc>
+
+#include <helpid.h>
+#include <unomid.h>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::rtl;
+
+#define ITEMID_NAME 1
+#define ITEMID_TABLE 2
+
+//typedef SharedUNOComponent< XConnection > SharedConnection;
+
+static const char* cUTF8 = "UTF-8";
+/*-- 07.05.2004 14:11:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+struct AddressUserData_Impl
+{
+ uno::Reference<XDataSource> xSource;
+ SharedConnection xConnection;
+ uno::Reference< XColumnsSupplier> xColumnsSupplier;
+ uno::Reference< sdbc::XResultSet> xResultSet;
+ ::rtl::OUString sFilter;
+ ::rtl::OUString sURL; // data is editable
+ sal_Int32 nCommandType;
+ sal_Int32 nTableAndQueryCount;
+ AddressUserData_Impl() :
+ nCommandType(0),
+ nTableAndQueryCount(-1)
+ {}
+};
+::rtl::OUString lcl_getFlatURL( uno::Reference<beans::XPropertySet>& xSourceProperties )
+{
+ ::rtl::OUString sURL;
+ if(xSourceProperties.is())
+ {
+ rtl::OUString sDBURL;
+ xSourceProperties->getPropertyValue(C2U("URL")) >>= sDBURL;
+ if(String(sDBURL).SearchAscii("sdbc:flat:") == 0)
+ {
+ uno::Sequence<OUString> aFilters;
+ xSourceProperties->getPropertyValue(C2U("TableFilter")) >>= aFilters;
+ uno::Sequence<PropertyValue> aInfo;
+ xSourceProperties->getPropertyValue(C2U("Info")) >>= aInfo;
+ if(aFilters.getLength() == 1 && aInfo.getLength() )
+ {
+ ::rtl::OUString sFieldDelim;
+ ::rtl::OUString sStringDelim;
+ ::rtl::OUString sExtension;
+ ::rtl::OUString sCharSet;
+ for(sal_Int32 nInfo = 0; nInfo < aInfo.getLength(); ++nInfo)
+ {
+ if(aInfo[nInfo].Name == C2U("FieldDelimiter"))
+ aInfo[nInfo].Value >>= sFieldDelim;
+ else if(aInfo[nInfo].Name == C2U("StringDelimiter"))
+ aInfo[nInfo].Value >>= sStringDelim;
+ else if(aInfo[nInfo].Name == C2U("Extension"))
+ aInfo[nInfo].Value >>= sExtension;
+ else if(aInfo[nInfo].Name == C2U("CharSet"))
+ aInfo[nInfo].Value >>= sCharSet;
+ }
+ if(!sCharSet.compareToAscii( cUTF8 ))
+ {
+ sURL = String(sDBURL).Copy( 10 );
+ //#i97577# at this point the 'URL' can also be a file name!
+ sURL = URIHelper::SmartRel2Abs( INetURLObject(), sURL );
+ sURL += C2U("/");
+ sURL += aFilters[0];
+ sURL += C2U(".");
+ sURL += sExtension;
+ }
+ }
+ }
+ }
+ return sURL;
+}
+/*-- 07.04.2004 16:35:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) :
+ SfxModalDialog(pParent, SW_RES(DLG_MM_ADDRESSLISTDIALOG)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aDescriptionFI( this, SW_RES( FI_DESCRIPTION )),
+ m_aListFT( this, SW_RES( FT_LIST )),
+ m_aListHB( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER),
+ m_aListLB( this, SW_RES( LB_LIST )),
+ m_aLoadListPB( this, SW_RES( PB_LOADLIST )),
+ m_aCreateListPB(this, SW_RES( PB_CREATELIST )),
+ m_aFilterPB( this, SW_RES( PB_FILTER )),
+ m_aEditPB(this, SW_RES( PB_EDIT )),
+ m_aTablePB(this, SW_RES( PB_TABLE )),
+ m_aSeparatorFL(this, SW_RES( FL_SEPARATOR )),
+ m_aOK( this, SW_RES( PB_OK )),
+ m_aCancel( this, SW_RES( PB_CANCEL )),
+ m_aHelp( this, SW_RES( PB_HELP )),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_sName( SW_RES( ST_NAME )),
+ m_sTable( SW_RES( ST_TABLE )),
+ m_sConnecting( SW_RES( ST_CONNECTING )),
+ m_pCreatedDataSource(0),
+ m_bInSelectHdl(false),
+ m_pAddressPage(pParent)
+{
+ FreeResource();
+ String sTemp(m_aDescriptionFI.GetText());
+ sTemp.SearchAndReplaceAscii("%1", m_aLoadListPB.GetText());
+ sTemp.SearchAndReplaceAscii("%2", m_aCreateListPB.GetText());
+ m_aDescriptionFI.SetText(sTemp);
+ m_aFilterPB.SetClickHdl( LINK( this, SwAddressListDialog, FilterHdl_Impl ));
+ m_aLoadListPB.SetClickHdl( LINK( this, SwAddressListDialog, LoadHdl_Impl ));
+ m_aCreateListPB.SetClickHdl( LINK( this, SwAddressListDialog,CreateHdl_Impl ));
+ m_aEditPB.SetClickHdl(LINK( this, SwAddressListDialog, EditHdl_Impl));
+ m_aTablePB.SetClickHdl(LINK( this, SwAddressListDialog, TableSelectHdl_Impl));
+
+ Size aLBSize(m_aListLB.GetSizePixel());
+ m_aListHB.SetSizePixel(aLBSize);
+ Size aHeadSize(m_aListHB.CalcWindowSizePixel());
+ aHeadSize.Width() = aLBSize.Width();
+ m_aListHB.SetSizePixel(aHeadSize);
+ Point aLBPos(m_aListLB.GetPosPixel());
+ m_aListHB.SetPosPixel(aLBPos);
+ aLBPos.Y() += aHeadSize.Height();
+ aLBSize.Height() -= aHeadSize.Height();
+ m_aListLB.SetPosSizePixel(aLBPos, aLBSize);
+
+ Size aSz(m_aListHB.GetOutputSizePixel());
+ m_aListHB.InsertItem( ITEMID_NAME, m_sName,
+ aSz.Width()/2,
+ HIB_LEFT | HIB_VCENTER | HIB_FIXED | HIB_FIXEDPOS/*| HIB_CLICKABLE | HIB_UPARROW */);
+ m_aListHB.InsertItem( ITEMID_TABLE, m_sTable,
+ aSz.Width()/2,
+ HIB_LEFT | HIB_VCENTER | HIB_FIXED | HIB_FIXEDPOS /*| HIB_CLICKABLE | HIB_UPARROW */);
+ m_aListHB.SetHelpId(HID_MM_ADDRESSLIST_HB );
+ m_aListHB.Show();
+
+ m_aListLB.SetHelpId(HID_MM_ADDRESSLIST_TLB);
+ static long nTabs[] = {2, 0, aSz.Width()/2 };
+ m_aListLB.SetStyle( m_aListLB.GetStyle() | WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP );
+ m_aListLB.SetSelectionMode( SINGLE_SELECTION );
+ m_aListLB.SetTabs(&nTabs[0], MAP_PIXEL);
+ m_aOK.SetClickHdl( LINK( this, SwAddressListDialog, OKHdl_Impl));
+
+ uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ if( xMgr.is() )
+ {
+ uno::Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.sdb.DatabaseContext" ));
+ m_xDBContext = uno::Reference<XNameAccess>(xInstance, UNO_QUERY) ;
+ }
+ SwMailMergeConfigItem& rConfigItem = m_pAddressPage->GetWizard()->GetConfigItem();
+ const SwDBData& rCurrentData = rConfigItem.GetCurrentDBData();
+
+ DBG_ASSERT(m_xDBContext.is(), "service 'com.sun.star.sdb.DatabaseContext' not found!");
+ sal_Bool bEnableEdit = sal_False;
+ sal_Bool bEnableOK = sal_True;
+ m_aListLB.SelectAll( FALSE );
+
+ if(m_xDBContext.is())
+ {
+ SwDBConfig aDb;
+ ::rtl::OUString sBibliography = aDb.GetBibliographySource().sDataSource;
+ uno::Sequence< ::rtl::OUString> aNames = m_xDBContext->getElementNames();
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+ for(sal_Int32 nName = 0; nName < aNames.getLength(); ++nName)
+ {
+ if ( pNames[nName] == sBibliography )
+ continue;
+ SvLBoxEntry* pEntry = m_aListLB.InsertEntry(pNames[nName]);
+ AddressUserData_Impl* pUserData = new AddressUserData_Impl();
+ pEntry->SetUserData(pUserData);
+ if(pNames[nName] == rCurrentData.sDataSource)
+ {
+ m_aListLB.Select(pEntry);
+ m_aListLB.SetEntryText(rCurrentData.sCommand, pEntry, ITEMID_TABLE - 1);
+ pUserData->nCommandType = rCurrentData.nCommandType;
+ pUserData->xSource = rConfigItem.GetSource();
+ pUserData->xConnection = rConfigItem.GetConnection();
+ pUserData->xColumnsSupplier = rConfigItem.GetColumnsSupplier();
+ pUserData->xResultSet = rConfigItem.GetResultSet();
+ pUserData->sFilter = rConfigItem.GetFilter();
+ //is the data source editable (csv, Unicode, single table)
+ uno::Reference<beans::XPropertySet> xSourceProperties;
+ try
+ {
+ m_xDBContext->getByName(pNames[nName]) >>= xSourceProperties;
+ pUserData->sURL = lcl_getFlatURL( xSourceProperties );
+ bEnableEdit = pUserData->sURL.getLength() > 0 &&
+ SWUnoHelper::UCB_IsFile( pUserData->sURL ) && //#i97577#
+ !SWUnoHelper::UCB_IsReadOnlyFileName( pUserData->sURL );
+ }
+ catch(const uno::Exception& )
+ {
+ bEnableOK = sal_False;
+ }
+ m_aDBData = rCurrentData;
+ }
+ }
+ }
+ m_aOK.Enable(m_aListLB.GetEntryCount()>0 && bEnableOK);
+ m_aEditPB.Enable(bEnableEdit);
+ m_aListLB.SetSelectHdl(LINK(this, SwAddressListDialog, ListBoxSelectHdl_Impl));
+ TableSelectHdl_Impl(NULL);
+}
+/*-- 07.04.2004 16:35:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAddressListDialog::~SwAddressListDialog()
+{
+ SvLBoxEntry* pEntry = m_aListLB.First();
+ while(pEntry)
+ {
+ AddressUserData_Impl* pUserData = static_cast<AddressUserData_Impl*>(pEntry->GetUserData());
+ delete pUserData;
+ pEntry = m_aListLB.Next( pEntry );
+ }
+}
+/*-- 07.04.2004 16:35:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAddressListDialog, FilterHdl_Impl, PushButton*, EMPTYARG)
+{
+ SvLBoxEntry* pSelect = m_aListLB.FirstSelected();
+ uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ if(pSelect && xMgr.is())
+ {
+ String sCommand = m_aListLB.GetEntryText(pSelect, ITEMID_TABLE - 1);
+ if ( !sCommand.Len() )
+ return 0;
+
+ AddressUserData_Impl* pUserData = static_cast<AddressUserData_Impl*>(pSelect->GetUserData());
+ if(pUserData->xConnection.is() )
+ {
+ try
+ {
+ uno::Reference<lang::XMultiServiceFactory> xConnectFactory(pUserData->xConnection, UNO_QUERY_THROW);
+ uno::Reference<XSingleSelectQueryComposer> xComposer(
+ xConnectFactory->createInstance(C2U("com.sun.star.sdb.SingleSelectQueryComposer")), UNO_QUERY_THROW);
+
+ PropertyValue aSecond;
+ aSecond.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowSet" ) );
+ uno::Reference<XRowSet> xRowSet(
+ xMgr->createInstance(C2U("com.sun.star.sdb.RowSet")), UNO_QUERY);
+ uno::Reference<XPropertySet> xRowProperties(xRowSet, UNO_QUERY);
+ xRowProperties->setPropertyValue(C2U("DataSourceName"),
+ makeAny(OUString(m_aListLB.GetEntryText(pSelect, ITEMID_NAME - 1))));
+ xRowProperties->setPropertyValue(C2U("Command"), makeAny(
+ OUString(sCommand)));
+ xRowProperties->setPropertyValue(C2U("CommandType"), makeAny(pUserData->nCommandType));
+ xRowProperties->setPropertyValue(C2U("ActiveConnection"), makeAny(pUserData->xConnection.getTyped()));
+ xRowSet->execute();
+ aSecond.Value <<= xRowSet;
+
+ PropertyValue aFirst;
+ aFirst.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "QueryComposer" ) );
+ ::rtl::OUString sQuery;
+ xRowProperties->getPropertyValue(C2U("ActiveCommand"))>>= sQuery;
+ xComposer->setQuery(sQuery);
+ if(pUserData->sFilter.getLength())
+ xComposer->setFilter(pUserData->sFilter);
+ aFirst.Value <<= xComposer;
+
+ uno::Sequence<Any> aInit(2);
+ aInit[0] <<= aFirst;
+ aInit[1] <<= aSecond;
+
+ ::rtl::OUString sDialogServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.FilterDialog" ) );
+ uno::Reference< XExecutableDialog> xDialog(
+ xMgr->createInstanceWithArguments( sDialogServiceName, aInit ), UNO_QUERY);
+
+ if ( RET_OK == xDialog->execute() )
+ {
+ WaitObject aWO( NULL );
+ pUserData->sFilter = xComposer->getFilter();
+ }
+ ::comphelper::disposeComponent(xRowSet);
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("exception caught in SwAddressListDialog::FilterHdl_Impl");
+ }
+ }
+ }
+ return 0;
+}
+/*-- 07.04.2004 16:35:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAddressListDialog, LoadHdl_Impl, PushButton*, EMPTYARG)
+{
+ String sNewSource = SwNewDBMgr::LoadAndRegisterDataSource();
+ if(sNewSource.Len())
+ {
+ SvLBoxEntry* pNewSource = m_aListLB.InsertEntry(sNewSource);
+ pNewSource->SetUserData(new AddressUserData_Impl());
+ m_aListLB.Select(pNewSource);
+ }
+ return 0;
+}
+/*-- 07.04.2004 16:35:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAddressListDialog, CreateHdl_Impl, PushButton*, pButton)
+{
+ String sInputURL;
+ SwCreateAddressListDialog* pDlg =
+ new SwCreateAddressListDialog(
+ pButton,
+ sInputURL,
+ m_pAddressPage->GetWizard()->GetConfigItem());
+ if(RET_OK == pDlg->Execute())
+ {
+ //register the URL a new datasource
+ OUString sURL = pDlg->GetURL();
+ try
+ {
+ uno::Reference<XSingleServiceFactory> xFact( m_xDBContext, UNO_QUERY);
+ uno::Reference<XInterface> xNewInstance = xFact->createInstance();
+ INetURLObject aURL( sURL );
+ OUString sNewName = aURL.getBase();
+ //find a unique name if sNewName already exists
+ OUString sFind(sNewName);
+ sal_Int32 nIndex = 0;
+ while(m_xDBContext->hasByName(sFind))
+ {
+ sFind = sNewName;
+ sFind += OUString::valueOf(++nIndex);
+ }
+ uno::Reference<XPropertySet> xDataProperties(xNewInstance, UNO_QUERY);
+
+ OUString sDBURL(C2U("sdbc:flat:"));
+ //only the 'path' has to be added
+ INetURLObject aTempURL(aURL);
+ aTempURL.removeSegment();
+ aTempURL.removeFinalSlash();
+ sDBURL += aTempURL.GetMainURL(INetURLObject::NO_DECODE);
+ Any aAny(&sDBURL, ::getCppuType(&sDBURL));
+ xDataProperties->setPropertyValue(C2U("URL"), aAny);
+ //set the filter to the file name without extension
+ uno::Sequence<OUString> aFilters(1);
+ aFilters[0] = sNewName;
+ aAny <<= aFilters;
+ xDataProperties->setPropertyValue(C2U("TableFilter"), aAny);
+
+ uno::Sequence<PropertyValue> aInfo(4);
+ PropertyValue* pInfo = aInfo.getArray();
+ pInfo[0].Name = C2U("FieldDelimiter");
+ pInfo[0].Value <<= OUString(String('\t'));
+ pInfo[1].Name = C2U("StringDelimiter");
+ pInfo[1].Value <<= OUString('"');
+ pInfo[2].Name = C2U("Extension");
+ pInfo[2].Value <<= ::rtl::OUString(aURL.getExtension());//C2U("csv");
+ pInfo[3].Name = C2U("CharSet");
+ pInfo[3].Value <<= C2U(cUTF8);
+ aAny <<= aInfo;
+ xDataProperties->setPropertyValue(C2U("Info"), aAny);
+
+ uno::Reference<sdb::XDocumentDataSource> xDS(xNewInstance, UNO_QUERY_THROW);
+ uno::Reference<frame::XStorable> xStore(xDS->getDatabaseDocument(), UNO_QUERY_THROW);
+ String sExt = String::CreateFromAscii(".odb");
+ String sTmpName;
+ {
+ String sHomePath(SvtPathOptions().GetWorkPath());
+ utl::TempFile aTempFile(sFind , &sExt, &sHomePath);
+ aTempFile.EnableKillingFile(sal_True);
+ sTmpName = aTempFile.GetURL();
+ }
+ xStore->storeAsURL(sTmpName, Sequence< PropertyValue >());
+
+
+ uno::Reference<XNamingService> xNaming(m_xDBContext, UNO_QUERY);
+ xNaming->registerObject( sFind, xNewInstance );
+ //now insert the new source into the ListBox
+ String sEntry(sFind);
+ sEntry += '\t';
+ sEntry += String(aFilters[0]);
+ m_pCreatedDataSource = m_aListLB.InsertEntry(sEntry);
+ AddressUserData_Impl* pUserData = new AddressUserData_Impl();
+ pUserData->sURL = sURL;
+ m_pCreatedDataSource->SetUserData(pUserData);
+ m_aListLB.Select(m_pCreatedDataSource);
+ m_aCreateListPB.Enable(FALSE);
+
+ }
+ catch(Exception& )
+ {
+ }
+ }
+ delete pDlg;
+ return 0;
+}
+/*-- 22.04.2004 10:30:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAddressListDialog, EditHdl_Impl, PushButton*, pButton)
+{
+ SvLBoxEntry* pEntry = m_aListLB.FirstSelected();
+ AddressUserData_Impl* pUserData = pEntry ? static_cast<AddressUserData_Impl*>(pEntry->GetUserData()) : 0;
+ if(pUserData && pUserData->sURL.getLength())
+ {
+ if(pUserData->xResultSet.is())
+ {
+ SwMailMergeConfigItem& rConfigItem = m_pAddressPage->GetWizard()->GetConfigItem();
+ if(rConfigItem.GetResultSet() != pUserData->xResultSet)
+ ::comphelper::disposeComponent( pUserData->xResultSet );
+ pUserData->xResultSet = 0;
+
+ rConfigItem.DisposeResultSet();
+ }
+ pUserData->xSource.clear();
+ pUserData->xColumnsSupplier.clear();
+ pUserData->xConnection.clear();
+ // will automatically close if it was the las reference
+ SwCreateAddressListDialog* pDlg =
+ new SwCreateAddressListDialog(
+ pButton,
+ pUserData->sURL,
+ m_pAddressPage->GetWizard()->GetConfigItem());
+ if(RET_OK == pDlg->Execute())
+ {
+ }
+ delete pDlg;
+ }
+ return 0;
+};
+/*-- 19.04.2004 09:41:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAddressListDialog, ListBoxSelectHdl_Impl, SvTabListBox*, EMPTYARG)
+{
+ SvLBoxEntry* pSelect = m_aListLB.FirstSelected();
+ Application::PostUserEvent( STATIC_LINK( this, SwAddressListDialog,
+ StaticListBoxSelectHdl_Impl ), pSelect );
+ return 0;
+}
+IMPL_STATIC_LINK(SwAddressListDialog, StaticListBoxSelectHdl_Impl, SvLBoxEntry*, pSelect)
+{
+ //prevent nested calls of the select handler
+ if(pThis->m_bInSelectHdl)
+ return 0;
+ pThis->EnterWait();
+ pThis->m_bInSelectHdl = true;
+ AddressUserData_Impl* pUserData = 0;
+ if(pSelect)
+ {
+ String sTable = pThis->m_aListLB.GetEntryText(pSelect, ITEMID_TABLE - 1);
+ if(!sTable.Len())
+ {
+ pThis->m_aListLB.SetEntryText(pThis->m_sConnecting, pSelect, ITEMID_TABLE - 1);
+ // allow painting of the new entry
+ pThis->m_aListLB.Window::Invalidate(INVALIDATE_UPDATE);
+ for (USHORT i = 0; i < 10; i++)
+ Application::Reschedule();
+ }
+
+ pUserData = static_cast<AddressUserData_Impl*>(pSelect->GetUserData());
+ if(pUserData->nTableAndQueryCount > 1 || pUserData->nTableAndQueryCount == -1)
+ {
+ pThis->DetectTablesAndQueries(pSelect, !sTable.Len());
+ }
+ else
+ {
+ //otherwise set the selected db-data
+ pThis->m_aDBData.sDataSource = pThis->m_aListLB.GetEntryText(pSelect, ITEMID_NAME - 1);
+ pThis->m_aDBData.sCommand = pThis->m_aListLB.GetEntryText(pSelect, ITEMID_TABLE - 1);
+ pThis->m_aDBData.nCommandType = pUserData->nCommandType;
+ pThis->m_aOK.Enable(sal_True);
+ }
+ sTable = pThis->m_aListLB.GetEntryText(pSelect, ITEMID_TABLE - 1);
+ if(sTable == pThis->m_sConnecting)
+ pThis->m_aListLB.SetEntryText(String(), pSelect, ITEMID_TABLE - 1);
+ }
+ pThis->m_aEditPB.Enable(pUserData && pUserData->sURL.getLength() &&
+ SWUnoHelper::UCB_IsFile( pUserData->sURL ) && //#i97577#
+ !SWUnoHelper::UCB_IsReadOnlyFileName( pUserData->sURL ) );
+ pThis->m_bInSelectHdl = false;
+ pThis->LeaveWait();
+ return 0;
+}
+
+/*-- 13.05.2004 14:59:25---------------------------------------------------
+ detect the number of tables for a data source
+ if only one is available then set it at the entry
+ -----------------------------------------------------------------------*/
+void SwAddressListDialog::DetectTablesAndQueries(
+ SvLBoxEntry* pSelect,
+ bool bWidthDialog)
+{
+ try
+ {
+ AddressUserData_Impl* pUserData = static_cast<AddressUserData_Impl*>(pSelect->GetUserData());
+ uno::Reference<XCompletedConnection> xComplConnection;
+ if(!pUserData->xConnection.is())
+ {
+ m_aDBData.sDataSource = m_aListLB.GetEntryText(pSelect, ITEMID_NAME - 1);
+ m_xDBContext->getByName(m_aDBData.sDataSource) >>= xComplConnection;
+ pUserData->xSource = uno::Reference<XDataSource>(xComplConnection, UNO_QUERY);
+
+ uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ uno::Reference< XInteractionHandler > xHandler(
+ xMgr->createInstance( C2U( "com.sun.star.task.InteractionHandler" )), UNO_QUERY);
+ pUserData->xConnection = SharedConnection( xComplConnection->connectWithCompletion( xHandler ) );
+ }
+ if(pUserData->xConnection.is())
+ {
+ sal_Int32 nTables = 0;
+ uno::Sequence<rtl::OUString> aTables;
+ uno::Sequence<rtl::OUString> aQueries;
+ uno::Reference<XTablesSupplier> xTSupplier(pUserData->xConnection, UNO_QUERY);
+ if(xTSupplier.is())
+ {
+ uno::Reference<XNameAccess> xTbls = xTSupplier->getTables();
+ aTables = xTbls->getElementNames();
+ nTables += aTables.getLength();
+ }
+ uno::Reference<XQueriesSupplier> xQSupplier(pUserData->xConnection, UNO_QUERY);
+ if(xQSupplier.is())
+ {
+ uno::Reference<XNameAccess> xQueries = xQSupplier->getQueries();
+ aQueries = xQueries->getElementNames();
+ nTables += aQueries.getLength();
+ }
+ pUserData->nTableAndQueryCount = nTables;
+ if(nTables > 1 && bWidthDialog)
+ {
+ //now call the table select dialog - if more than one table exists
+ SwSelectDBTableDialog* pDlg = new SwSelectDBTableDialog(this, pUserData->xConnection);
+ String sTable = m_aListLB.GetEntryText(pSelect, ITEMID_TABLE - 1);
+ if(sTable.Len())
+ pDlg->SetSelectedTable(sTable, pUserData->nCommandType == CommandType::TABLE);
+ if(RET_OK == pDlg->Execute())
+ {
+ bool bIsTable;
+ m_aDBData.sCommand = pDlg->GetSelectedTable(bIsTable);
+ m_aDBData.nCommandType = bIsTable ? CommandType::TABLE : CommandType::QUERY;
+ pUserData->nCommandType = m_aDBData.nCommandType;
+ }
+ delete pDlg;
+ }
+ else if(nTables == 1)
+ {
+ if(aTables.getLength())
+ {
+ m_aDBData.sCommand = aTables[0];
+ m_aDBData.nCommandType = CommandType::TABLE;
+ }
+ else
+ {
+ m_aDBData.sCommand = aQueries[0];
+ m_aDBData.nCommandType = CommandType::QUERY;
+ }
+ }
+ }
+ if ( m_aDBData.sCommand.getLength() )
+ {
+ uno::Reference<beans::XPropertySet> xSourceProperties;
+ m_xDBContext->getByName(m_aDBData.sDataSource) >>= xSourceProperties;
+ pUserData->sURL = lcl_getFlatURL( xSourceProperties );
+
+ pUserData->xColumnsSupplier = SwNewDBMgr::GetColumnSupplier(pUserData->xConnection,
+ m_aDBData.sCommand,
+ m_aDBData.nCommandType == CommandType::TABLE ?
+ SW_DB_SELECT_TABLE : SW_DB_SELECT_QUERY );
+ //#i97577#
+ if( pUserData->xColumnsSupplier.is() )
+ m_aListLB.SetEntryText(m_aDBData.sCommand, pSelect, ITEMID_TABLE - 1);
+ else
+ m_aListLB.SetEntryText(String(), pSelect, ITEMID_TABLE - 1);
+ }
+ String sCommand = m_aListLB.GetEntryText(pSelect, ITEMID_TABLE - 1);
+ m_aOK.Enable(pSelect && sCommand.Len());
+ m_aFilterPB.Enable( pUserData->xConnection.is() && sCommand.Len() );
+ m_aTablePB.Enable( pUserData->nTableAndQueryCount > 1 );
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("exception caught in SwAddressListDialog::DetectTablesAndQueries");
+ m_aOK.Enable( sal_False );
+ }
+}
+
+/*-- 13.05.2004 12:55:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAddressListDialog, TableSelectHdl_Impl, PushButton*, pButton)
+{
+ EnterWait();
+ SvLBoxEntry* pSelect = m_aListLB.FirstSelected();
+ if(pSelect)
+ {
+ AddressUserData_Impl* pUserData = static_cast<AddressUserData_Impl*>(pSelect->GetUserData());
+ //only call the table select dialog if tables have not been searched for or there
+ //are more than 1
+ String sTable = m_aListLB.GetEntryText(pSelect, ITEMID_TABLE - 1);
+ if( pUserData->nTableAndQueryCount > 1 || pUserData->nTableAndQueryCount == -1)
+ {
+ DetectTablesAndQueries(pSelect, (pButton != 0) || (!sTable.Len()));
+ }
+ }
+
+ LeaveWait();
+ return 0;
+}
+
+/*-- 08.04.2004 14:52:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAddressListDialog, OKHdl_Impl, PushButton*, EMPTYARG)
+{
+ EndDialog(TRUE);
+ return 0;
+}
+
+/*-- 07.05.2004 14:17:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XDataSource> SwAddressListDialog::GetSource()
+{
+ uno::Reference< XDataSource> xRet;
+ SvLBoxEntry* pSelect = m_aListLB.FirstSelected();
+ if(pSelect)
+ {
+ AddressUserData_Impl* pUserData = static_cast<AddressUserData_Impl*>(pSelect->GetUserData());
+ xRet = pUserData->xSource;
+ }
+ return xRet;
+
+}
+/*-- 07.05.2004 14:17:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SharedConnection SwAddressListDialog::GetConnection()
+{
+ SharedConnection xRet;
+ SvLBoxEntry* pSelect = m_aListLB.FirstSelected();
+ if(pSelect)
+ {
+ AddressUserData_Impl* pUserData = static_cast<AddressUserData_Impl*>(pSelect->GetUserData());
+ xRet = pUserData->xConnection;
+ }
+ return xRet;
+}
+/*-- 07.05.2004 14:17:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XColumnsSupplier> SwAddressListDialog::GetColumnsSupplier()
+{
+ uno::Reference< XColumnsSupplier> xRet;
+ SvLBoxEntry* pSelect = m_aListLB.FirstSelected();
+ if(pSelect)
+ {
+ AddressUserData_Impl* pUserData = static_cast<AddressUserData_Impl*>(pSelect->GetUserData());
+ xRet = pUserData->xColumnsSupplier;
+ }
+ return xRet;
+}
+/*-- 14.05.2004 15:04:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwAddressListDialog::GetFilter()
+{
+ ::rtl::OUString sRet;
+ SvLBoxEntry* pSelect = m_aListLB.FirstSelected();
+ if(pSelect)
+ {
+ AddressUserData_Impl* pUserData = static_cast<AddressUserData_Impl*>(pSelect->GetUserData());
+ sRet = pUserData->sFilter;
+ }
+ return sRet;
+}
diff --git a/sw/source/ui/dbui/addresslistdialog.hrc b/sw/source/ui/dbui/addresslistdialog.hrc
new file mode 100644
index 000000000000..821ddd81b4f0
--- /dev/null
+++ b/sw/source/ui/dbui/addresslistdialog.hrc
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ADDRESSLISTDIALOG_HRC
+#define _ADDRESSLISTDIALOG_HRC
+
+#define FI_DESCRIPTION 1
+#define FT_LIST 2
+
+#define PB_EDIT 4
+#define LB_LIST 5
+#define PB_FILTER 6
+#define PB_LOADLIST 7
+#define PB_CREATELIST 8
+#define FL_SEPARATOR 9
+#define PB_OK 12
+#define PB_CANCEL 13
+#define PB_HELP 14
+#define ST_NAME 15
+#define ST_TABLE 16
+#define PB_TABLE 17
+#define ST_CONNECTING 18
+
+#endif
+
diff --git a/sw/source/ui/dbui/addresslistdialog.hxx b/sw/source/ui/dbui/addresslistdialog.hxx
new file mode 100644
index 000000000000..0623df315d39
--- /dev/null
+++ b/sw/source/ui/dbui/addresslistdialog.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ADDRESSLISTDIALOG_HXX
+#define _ADDRESSLISTDIALOG_HXX
+
+#include <sfx2/basedlgs.hxx>
+#include <svtools/stdctrl.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <svtools/svtabbx.hxx>
+#include <svtools/headbar.hxx>
+#include <swdbdata.hxx>
+#include "sharedconnection.hxx"
+
+
+namespace com{namespace sun{namespace star{
+ namespace container{
+ class XNameAccess;
+ }
+ namespace sdbc{
+ class XDataSource;
+ class XConnection;
+ }
+ namespace sdbcx{
+ class XColumnsSupplier;
+ }
+}}}
+class SwMailMergeAddressBlockPage;
+/*-- 08.04.2004 14:04:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwAddressListDialog : public SfxModalDialog
+{
+ FixedInfo m_aDescriptionFI;
+
+ FixedInfo m_aListFT;
+ HeaderBar m_aListHB;
+ SvTabListBox m_aListLB;
+
+ PushButton m_aLoadListPB;
+ PushButton m_aCreateListPB;
+ PushButton m_aFilterPB;
+ PushButton m_aEditPB;
+ PushButton m_aTablePB;
+
+ FixedLine m_aSeparatorFL;
+
+ OKButton m_aOK;
+ CancelButton m_aCancel;
+ HelpButton m_aHelp;
+
+ String m_sName;
+ String m_sTable;
+ String m_sConnecting;
+
+ String m_sCreatedURL;
+ SvLBoxEntry* m_pCreatedDataSource;
+
+ bool m_bInSelectHdl;
+
+ SwMailMergeAddressBlockPage* m_pAddressPage;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xDBContext;
+// ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> m_xSource;
+// ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection;
+// ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> m_xColumnsSupplier;
+ SwDBData m_aDBData;
+
+ void DetectTablesAndQueries(SvLBoxEntry* pSelect, bool bWidthDialog);
+
+ DECL_LINK(FilterHdl_Impl, PushButton*);
+ DECL_LINK(LoadHdl_Impl, PushButton*);
+ DECL_LINK(CreateHdl_Impl, PushButton*);
+ DECL_LINK(ListBoxSelectHdl_Impl, SvTabListBox*);
+ DECL_LINK(EditHdl_Impl, PushButton*);
+ DECL_LINK(TableSelectHdl_Impl, PushButton*);
+ DECL_LINK(OKHdl_Impl, PushButton*);
+
+ DECL_STATIC_LINK(SwAddressListDialog, StaticListBoxSelectHdl_Impl, SvLBoxEntry*);
+
+public:
+ SwAddressListDialog(SwMailMergeAddressBlockPage* pParent);
+ ~SwAddressListDialog();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>
+ GetSource();
+
+ SharedConnection GetConnection();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier>
+ GetColumnsSupplier();
+
+ const SwDBData& GetDBData() const {return m_aDBData;}
+ ::rtl::OUString GetFilter();
+};
+#endif
+
diff --git a/sw/source/ui/dbui/addresslistdialog.src b/sw/source/ui/dbui/addresslistdialog.src
new file mode 100644
index 000000000000..aa815866cf48
--- /dev/null
+++ b/sw/source/ui/dbui/addresslistdialog.src
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <addresslistdialog.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+
+ModalDialog DLG_MM_ADDRESSLISTDIALOG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_ADDRESSLISTDIALOG;
+ Size = MAP_APPFONT ( 260 , 182 ) ;
+ Moveable = TRUE ;
+
+ Text [ en-US ] = "Select Address List";
+
+ FixedText FI_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 24 ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "Select an address list. Click '%1' to select recipients from a different list. If you do not have an address list you can create one by clicking '%2'.";
+ };
+ FixedText FT_LIST
+ {
+ Pos = MAP_APPFONT ( 6 , 30 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Your recipients are currently selected from:";
+ };
+ Control LB_LIST
+ {
+ Pos = MAP_APPFONT ( 6 , 43 ) ;
+ Size = MAP_APPFONT ( 182 , 102 ) ;
+ Border = TRUE;
+ TabStop = TRUE ;
+ };
+ PushButton PB_LOADLIST
+ {
+ HelpID = "sw:PushButton:DLG_MM_ADDRESSLISTDIALOG:PB_LOADLIST";
+ Pos = MAP_APPFONT ( 194 , 43 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Add...";
+ };
+ PushButton PB_CREATELIST
+ {
+ HelpID = "sw:PushButton:DLG_MM_ADDRESSLISTDIALOG:PB_CREATELIST";
+ Pos = MAP_APPFONT ( 194 , 60 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Create...";
+ };
+ PushButton PB_FILTER
+ {
+ HelpID = "sw:PushButton:DLG_MM_ADDRESSLISTDIALOG:PB_FILTER";
+ Pos = MAP_APPFONT ( 194 , 77 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Filter...";
+ };
+ PushButton PB_EDIT
+ {
+ HelpID = "sw:PushButton:DLG_MM_ADDRESSLISTDIALOG:PB_EDIT";
+ Pos = MAP_APPFONT ( 194 , 94 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "~Edit...";
+ };
+ PushButton PB_TABLE
+ {
+ HelpID = "sw:PushButton:DLG_MM_ADDRESSLISTDIALOG:PB_TABLE";
+ Pos = MAP_APPFONT ( 194 , 111 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text [ en-US ] = "Change ~Table...";
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 151 ) ;
+ Size = MAP_APPFONT ( 260 , 8 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 95 , 162 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 148 , 162 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 204 , 162 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ String ST_NAME
+ {
+ Text [ en-US ] = "Name";
+ };
+ String ST_TABLE
+ {
+ Text [ en-US ] = "Table";
+ };
+ String ST_CONNECTING
+ {
+ Text [ en-US ] = "Connecting to data source...";
+ };
+};
+
diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx
new file mode 100644
index 000000000000..6c13fee26b9c
--- /dev/null
+++ b/sw/source/ui/dbui/createaddresslistdialog.cxx
@@ -0,0 +1,835 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <swtypes.hxx>
+#include <createaddresslistdialog.hxx>
+#include <customizeaddresslistdialog.hxx>
+#include <mmconfigitem.hxx>
+#include <vcl/scrbar.hxx>
+#include <vcl/msgbox.hxx>
+#ifndef _SVT_CONTROLDIMS_HRC_
+#include <svtools/controldims.hrc>
+#endif
+#include <unotools/pathoptions.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/docfac.hxx>
+#include <sfx2/docfile.hxx>
+#include <rtl/textenc.h>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <tools/urlobj.hxx>
+#include <createaddresslistdialog.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+#include <unomid.h>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::ui::dialogs;
+using ::rtl::OUString;
+
+/*-- 19.04.2004 12:19:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwAddressControl_Impl : public Control
+{
+ ScrollBar m_aScrollBar;
+ Window m_aWindow;
+
+ ::std::vector<FixedText*> m_aFixedTexts;
+ ::std::vector<Edit*> m_aEdits;
+
+ SwCSVData* m_pData;
+ Size m_aWinOutputSize;
+ sal_Int32 m_nLineHeight;
+ sal_uInt32 m_nCurrentDataSet;
+
+ bool m_bNoDataSet;
+
+ DECL_LINK(ScrollHdl_Impl, ScrollBar*);
+ DECL_LINK(GotFocusHdl_Impl, Edit*);
+ DECL_LINK(EditModifyHdl_Impl, Edit*);
+
+ void MakeVisible(const Rectangle& aRect);
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+
+ using Window::SetData;
+
+public:
+ SwAddressControl_Impl(Window* pParent, const ResId& rResId );
+ ~SwAddressControl_Impl();
+
+ void SetData(SwCSVData& rDBData);
+
+ void SetCurrentDataSet(sal_uInt32 nSet);
+ sal_uInt32 GetCurrentDataSet() const { return m_nCurrentDataSet;}
+ void SetCursorTo(sal_uInt32 nElement);
+};
+
+/*-- 13.04.2004 10:09:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAddressControl_Impl::SwAddressControl_Impl(Window* pParent, const ResId& rResId ) :
+ Control(pParent, rResId),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aScrollBar(this, ResId(SCR_1,*rResId.GetResMgr())),
+ m_aWindow(this, ResId(WIN_DATA,*rResId.GetResMgr())),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_pData(0),
+ m_aWinOutputSize( m_aWindow.GetOutputSizePixel() ),
+ m_nLineHeight(0),
+ m_nCurrentDataSet(0),
+ m_bNoDataSet(true)
+{
+ FreeResource();
+ Link aScrollLink = LINK(this, SwAddressControl_Impl, ScrollHdl_Impl);
+ m_aScrollBar.SetScrollHdl(aScrollLink);
+ m_aScrollBar.SetEndScrollHdl(aScrollLink);
+ m_aScrollBar.EnableDrag();
+
+}
+/*-- 13.04.2004 10:09:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAddressControl_Impl::~SwAddressControl_Impl()
+{
+ ::std::vector<FixedText*>::iterator aTextIter;
+ for(aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter)
+ delete *aTextIter;
+ ::std::vector<Edit*>::iterator aEditIter;
+ for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter)
+ delete *aEditIter;
+}
+/*-- 19.04.2004 12:22:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressControl_Impl::SetData(SwCSVData& rDBData)
+{
+ m_pData = &rDBData;
+ //when the address data is updated then remove the controls an build again
+ if(m_aFixedTexts.size())
+ {
+ ::std::vector<FixedText*>::iterator aTextIter;
+ for(aTextIter = m_aFixedTexts.begin(); aTextIter != m_aFixedTexts.end(); ++aTextIter)
+ delete *aTextIter;
+ ::std::vector<Edit*>::iterator aEditIter;
+ for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter)
+ delete *aEditIter;
+ m_aFixedTexts.clear();
+ m_aEdits.clear();
+ m_bNoDataSet = true;
+ }
+ //now create appropriate controls
+
+ ::std::vector< OUString >::iterator aHeaderIter;
+
+ long nFTXPos = m_aWindow.LogicToPixel(Point(RSC_SP_CTRL_X, RSC_SP_CTRL_X), MAP_APPFONT).X();
+ long nFTHeight = m_aWindow.LogicToPixel(Size(RSC_BS_CHARHEIGHT, RSC_BS_CHARHEIGHT), MAP_APPFONT).Height();
+ long nFTWidth = 0;
+
+ //determine the width of the FixedTexts
+ for(aHeaderIter = m_pData->aDBColumnHeaders.begin();
+ aHeaderIter != m_pData->aDBColumnHeaders.end();
+ ++aHeaderIter)
+ {
+ sal_Int32 nTemp = m_aWindow.GetTextWidth(*aHeaderIter);
+ if(nTemp > nFTWidth)
+ nFTWidth = nTemp;
+ }
+ //add some pixels
+ nFTWidth += 2;
+ long nEDXPos = nFTWidth + nFTXPos +
+ m_aWindow.LogicToPixel(Size(RSC_SP_CTRL_DESC_X, RSC_SP_CTRL_DESC_X), MAP_APPFONT).Width();
+ long nEDHeight = m_aWindow.LogicToPixel(Size(RSC_CD_TEXTBOX_HEIGHT, RSC_CD_TEXTBOX_HEIGHT), MAP_APPFONT).Height();
+ long nEDWidth = m_aWinOutputSize.Width() - nEDXPos - nFTXPos;
+ m_nLineHeight = nEDHeight + m_aWindow.LogicToPixel(Size(RSC_SP_CTRL_GROUP_Y, RSC_SP_CTRL_GROUP_Y), MAP_APPFONT).Height();
+
+ long nEDYPos = m_aWindow.LogicToPixel(Size(RSC_SP_CTRL_DESC_Y, RSC_SP_CTRL_DESC_Y), MAP_APPFONT).Height();
+ long nFTYPos = nEDYPos + nEDHeight - nFTHeight;
+
+ Link aFocusLink = LINK(this, SwAddressControl_Impl, GotFocusHdl_Impl);
+ Link aEditModifyLink = LINK(this, SwAddressControl_Impl, EditModifyHdl_Impl);
+ Edit* pLastEdit = 0;
+ sal_Int32 nVisibleLines = 0;
+ sal_Int32 nLines = 0;
+ for(aHeaderIter = m_pData->aDBColumnHeaders.begin();
+ aHeaderIter != m_pData->aDBColumnHeaders.end();
+ ++aHeaderIter, nEDYPos += m_nLineHeight, nFTYPos += m_nLineHeight, nLines++)
+ {
+ FixedText* pNewFT = new FixedText(&m_aWindow, WB_RIGHT);
+ Edit* pNewED = new Edit(&m_aWindow, WB_BORDER);
+ //set nLines a position identifier - used in the ModifyHdl
+ pNewED->SetData((void*)nLines);
+ pNewED->SetGetFocusHdl(aFocusLink);
+ pNewED->SetModifyHdl(aEditModifyLink);
+
+ pNewFT->SetPosSizePixel(Point(nFTXPos, nFTYPos), Size(nFTWidth, nFTHeight));
+ pNewED->SetPosSizePixel(Point(nEDXPos, nEDYPos), Size(nEDWidth, nEDHeight));
+ if(nEDYPos + nEDHeight < m_aWinOutputSize.Height())
+ ++nVisibleLines;
+
+ pNewFT->SetText(*aHeaderIter);
+
+ pNewFT->Show();
+ pNewED->Show();
+ m_aFixedTexts.push_back(pNewFT);
+ m_aEdits.push_back(pNewED);
+ pLastEdit = pNewED;
+ }
+ //scrollbar adjustment
+ if(pLastEdit)
+ {
+ //the m_aWindow has to be at least as high as the ScrollBar and it must include the last Edit
+ sal_Int32 nContentHeight = pLastEdit->GetPosPixel().Y() + nEDHeight +
+ m_aWindow.LogicToPixel(Size(RSC_SP_CTRL_GROUP_Y, RSC_SP_CTRL_GROUP_Y), MAP_APPFONT).Height();
+ if(nContentHeight < m_aScrollBar.GetSizePixel().Height())
+ {
+ nContentHeight = m_aScrollBar.GetSizePixel().Height();
+ m_aScrollBar.Enable(FALSE);
+ }
+ else
+ {
+ m_aScrollBar.Enable(TRUE);
+ m_aScrollBar.SetRange(Range(0, nLines));
+ m_aScrollBar.SetThumbPos(0);
+ m_aScrollBar.SetVisibleSize(nVisibleLines);
+ }
+ Size aWinOutputSize(m_aWinOutputSize);
+ aWinOutputSize.Height() = nContentHeight;
+ m_aWindow.SetOutputSizePixel(aWinOutputSize);
+
+ }
+}
+/*-- 21.04.2004 11:37:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressControl_Impl::SetCurrentDataSet(sal_uInt32 nSet)
+{
+ if(m_bNoDataSet || m_nCurrentDataSet != nSet)
+ {
+ m_bNoDataSet = false;
+ m_nCurrentDataSet = nSet;
+ DBG_ASSERT(m_pData->aDBData.size() > m_nCurrentDataSet, "wrong data set index");
+ if(m_pData->aDBData.size() > m_nCurrentDataSet)
+ {
+ ::std::vector<Edit*>::iterator aEditIter;
+ sal_uInt32 nIndex = 0;
+ for(aEditIter = m_aEdits.begin(); aEditIter != m_aEdits.end(); ++aEditIter, ++nIndex)
+ {
+ DBG_ASSERT(nIndex < m_pData->aDBData[m_nCurrentDataSet].size(),
+ "number of colums doesn't match number of Edits");
+ (*aEditIter)->SetText(m_pData->aDBData[m_nCurrentDataSet][nIndex]);
+ }
+ }
+ }
+}
+
+/*-- 19.04.2004 14:17:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAddressControl_Impl, ScrollHdl_Impl, ScrollBar*, pScroll)
+{
+ long nThumb = pScroll->GetThumbPos();
+ m_aWindow.SetPosPixel(Point(0, - (m_nLineHeight * nThumb)));
+
+ return 0;
+}
+/*-- 19.04.2004 16:16:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAddressControl_Impl, GotFocusHdl_Impl, Edit*, pEdit)
+{
+ if(0 != (GETFOCUS_TAB & pEdit->GetGetFocusFlags()))
+ {
+ Rectangle aRect(pEdit->GetPosPixel(), pEdit->GetSizePixel());
+ MakeVisible(aRect);
+ }
+ return 0;
+}
+/*-- 21.04.2004 14:56:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressControl_Impl::MakeVisible(const Rectangle & rRect)
+{
+ long nThumb = m_aScrollBar.GetThumbPos();
+ //determine range of visible positions
+ long nMinVisiblePos = - m_aWindow.GetPosPixel().Y();
+ long nMaxVisiblePos = m_aScrollBar.GetSizePixel().Height() + nMinVisiblePos;
+ if( rRect.TopLeft().Y() < nMinVisiblePos)
+ {
+ nThumb -= 1 + ((nMinVisiblePos - rRect.TopLeft().Y()) / m_nLineHeight);
+ }
+ else if(rRect.BottomLeft().Y() > nMaxVisiblePos)
+ {
+ nThumb += 1 + ((nMaxVisiblePos - rRect.BottomLeft().Y()) / m_nLineHeight);
+ }
+ if(nThumb != m_aScrollBar.GetThumbPos())
+ {
+ m_aScrollBar.SetThumbPos(nThumb);
+ ScrollHdl_Impl(&m_aScrollBar);
+ }
+}
+/*-- 19.04.2004 16:16:25---------------------------------------------------
+ copy data changes into database
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAddressControl_Impl, EditModifyHdl_Impl, Edit*, pEdit)
+{
+ //get the data element number of the current set
+ sal_Int32 nIndex = (sal_Int32)(sal_IntPtr)pEdit->GetData();
+ //get the index of the set
+ DBG_ASSERT(m_pData->aDBData.size() > m_nCurrentDataSet, "wrong data set index" );
+ if(m_pData->aDBData.size() > m_nCurrentDataSet)
+ {
+ m_pData->aDBData[m_nCurrentDataSet][nIndex] = pEdit->GetText();
+ }
+ return 0;
+}
+/*-- 21.04.2004 14:51:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressControl_Impl::SetCursorTo(sal_uInt32 nElement)
+{
+ if(nElement < m_aEdits.size())
+ {
+ Edit* pEdit = m_aEdits[nElement];
+ pEdit->GrabFocus();
+ Rectangle aRect(pEdit->GetPosPixel(), pEdit->GetSizePixel());
+ MakeVisible(aRect);
+ }
+
+}
+/*-- 19.04.2004 16:16:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressControl_Impl::Command( const CommandEvent& rCEvt )
+{
+ switch ( rCEvt.GetCommand() )
+ {
+ case COMMAND_WHEEL:
+ case COMMAND_STARTAUTOSCROLL:
+ case COMMAND_AUTOSCROLL:
+ {
+ const CommandWheelData* pWheelData = rCEvt.GetWheelData();
+ if(pWheelData && !pWheelData->IsHorz() && COMMAND_WHEEL_ZOOM != pWheelData->GetMode())
+ {
+ HandleScrollCommand( rCEvt, 0, &m_aScrollBar );
+ }
+ }
+ break;
+ default:
+ Control::Command(rCEvt);
+ }
+}
+/*-- 19.04.2004 16:16:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+long SwAddressControl_Impl::PreNotify( NotifyEvent& rNEvt )
+{
+ if(rNEvt.GetType() == EVENT_COMMAND)
+ {
+ const CommandEvent* pCEvt = rNEvt.GetCommandEvent();
+ USHORT nCmd = pCEvt->GetCommand();
+ if( COMMAND_WHEEL == nCmd )
+ {
+ Command(*pCEvt);
+ return 1;
+ }
+ }
+ return Control::PreNotify(rNEvt);
+}
+/*-- 13.04.2004 10:08:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwCreateAddressListDialog::SwCreateAddressListDialog(
+ Window* pParent, const String& rURL, SwMailMergeConfigItem& rConfig) :
+ SfxModalDialog(pParent, SW_RES(DLG_MM_CREATEADDRESSLIST)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aAddressInformation( this, SW_RES( FI_ADDRESSINFORMATION)),
+ m_pAddressControl(new SwAddressControl_Impl(this, SW_RES(CT_ADDRESS))),
+ m_aNewPB( this, SW_RES( PB_NEW)),
+ m_aDeletePB( this, SW_RES( PB_DELETE)),
+ m_aFindPB( this, SW_RES( PB_FIND)),
+ m_aCustomizePB( this, SW_RES( PB_CUSTOMIZE)),
+
+ m_aViewEntriesFI( this, SW_RES( FI_VIEWENTRIES)),
+ m_aStartPB( this, SW_RES( PB_START)),
+ m_aPrevPB( this, SW_RES( PB_PREV)),
+ m_aSetNoNF( this, SW_RES( NF_SETNO)),
+ m_aNextPB( this, SW_RES( PB_NEXT )),
+ m_aEndPB( this, SW_RES( PB_END)),
+
+ m_aSeparatorFL( this, SW_RES( FL_SEPARATOR)),
+
+ m_aOK( this, SW_RES( PB_OK)),
+ m_aCancel( this, SW_RES( PB_CANCEL)),
+ m_aHelp( this, SW_RES( PB_HELP)),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_sAddressListFilterName( SW_RES( ST_FILTERNAME)),
+ m_sURL(rURL),
+ m_pCSVData( new SwCSVData ),
+ m_pFindDlg(0)
+{
+ FreeResource();
+ m_aNewPB.SetClickHdl(LINK(this, SwCreateAddressListDialog, NewHdl_Impl));
+ m_aDeletePB.SetClickHdl(LINK(this, SwCreateAddressListDialog, DeleteHdl_Impl));
+ m_aFindPB.SetClickHdl(LINK(this, SwCreateAddressListDialog, FindHdl_Impl));
+ m_aCustomizePB.SetClickHdl(LINK(this, SwCreateAddressListDialog, CustomizeHdl_Impl));
+ m_aOK.SetClickHdl(LINK(this, SwCreateAddressListDialog, OkHdl_Impl));
+
+ Link aLk = LINK(this, SwCreateAddressListDialog, DBCursorHdl_Impl);
+ m_aStartPB.SetClickHdl(aLk);
+ m_aPrevPB.SetClickHdl(aLk);
+ m_aSetNoNF.SetModifyHdl(LINK(this, SwCreateAddressListDialog, DBNumCursorHdl_Impl));
+ m_aNextPB.SetClickHdl(aLk);
+ m_aEndPB.SetClickHdl(aLk);
+
+ if(m_sURL.Len())
+ {
+ //file exists, has to be loaded here
+ SfxMedium aMedium( m_sURL, STREAM_READ, TRUE );
+ SvStream* pStream = aMedium.GetInStream();
+ if(pStream)
+ {
+ pStream->SetLineDelimiter( LINEEND_LF );
+ pStream->SetStreamCharSet(RTL_TEXTENCODING_UTF8);
+
+ OUString sSemi(';');
+ OUString sQuote('"');
+ String sTempMiddle(sQuote);
+ sTempMiddle += sal_Unicode(9);
+ OUString sMiddle(sTempMiddle);
+
+ String sLine;
+ BOOL bRead = pStream->ReadUniOrByteStringLine( sLine, RTL_TEXTENCODING_UTF8 );
+
+ if(bRead)
+ {
+ //header line
+ xub_StrLen nHeaders = sLine.GetTokenCount('\t');
+ xub_StrLen nIndex = 0;
+ for( xub_StrLen nToken = 0; nToken < nHeaders; ++nToken)
+ {
+ String sHeader = sLine.GetToken( 0, '\t', nIndex );
+ DBG_ASSERT(sHeader.Len() > 2 &&
+ sHeader.GetChar(0) == '\"' && sHeader.GetChar(sHeader.Len() - 1) == '\"',
+ "Wrong format of header");
+ if(sHeader.Len() > 2)
+ {
+ m_pCSVData->aDBColumnHeaders.push_back( sHeader.Copy(1, sHeader.Len() -2));
+ }
+ }
+ }
+ while(pStream->ReadUniOrByteStringLine( sLine, RTL_TEXTENCODING_UTF8 ))
+ {
+ ::std::vector<OUString> aNewData;
+ //analyze data line
+ xub_StrLen nDataCount = sLine.GetTokenCount('\t');
+ xub_StrLen nIndex = 0;
+ for( xub_StrLen nToken = 0; nToken < nDataCount; ++nToken)
+ {
+ String sData = sLine.GetToken( 0, '\t', nIndex );
+ DBG_ASSERT(sData.Len() >= 2 &&
+ sData.GetChar(0) == '\"' && sData.GetChar(sData.Len() - 1) == '\"',
+ "Wrong format of line");
+ if(sData.Len() >= 2)
+ aNewData.push_back(sData.Copy(1, sData.Len() - 2));
+ else
+ aNewData.push_back(sData);
+ }
+ m_pCSVData->aDBData.push_back( aNewData );
+ }
+ }
+ }
+ else
+ {
+ //database has to be created
+ const ResStringArray& rAddressHeader = rConfig.GetDefaultAddressHeaders();
+ sal_uInt32 nCount = rAddressHeader.Count();
+ for(USHORT nHeader = 0; nHeader < nCount; ++nHeader)
+ m_pCSVData->aDBColumnHeaders.push_back( rAddressHeader.GetString(nHeader));
+ ::std::vector<OUString> aNewData;
+ String sTemp;
+ aNewData.insert(aNewData.begin(), nCount, sTemp);
+ m_pCSVData->aDBData.push_back(aNewData);
+ }
+ //now fill the address control
+ m_pAddressControl->SetData(*m_pCSVData);
+ m_pAddressControl->SetCurrentDataSet(0);
+ m_aSetNoNF.SetMax(m_pCSVData->aDBData.size());
+ UpdateButtons();
+}
+/*-- 13.04.2004 10:08:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwCreateAddressListDialog::~SwCreateAddressListDialog()
+{
+ delete m_pAddressControl;
+ delete m_pCSVData;
+ delete m_pFindDlg;
+}
+/*-- 13.04.2004 10:08:59---------------------------------------------------
+ add a new data set of empty strings and set the address input control
+ to that new set
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCreateAddressListDialog, NewHdl_Impl, PushButton*, EMPTYARG)
+{
+ sal_uInt32 nCurrent = m_pAddressControl->GetCurrentDataSet();
+ ::std::vector<OUString> aNewData;
+ String sTemp;
+ aNewData.insert(aNewData.begin(), m_pCSVData->aDBColumnHeaders.size(), sTemp);
+ m_pCSVData->aDBData.insert(m_pCSVData->aDBData.begin() + ++nCurrent, aNewData);
+ m_aSetNoNF.SetMax(m_pCSVData->aDBData.size());
+ //the NumericField start at 1
+ m_aSetNoNF.SetValue(nCurrent + 1);
+ //the address control starts at 0
+ m_pAddressControl->SetCurrentDataSet(nCurrent);
+ UpdateButtons();
+ return 0;
+}
+/*-- 13.04.2004 10:09:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCreateAddressListDialog, DeleteHdl_Impl, PushButton*, EMPTYARG)
+{
+ sal_uInt32 nCurrent = m_pAddressControl->GetCurrentDataSet();
+ if(m_pCSVData->aDBData.size() > 1)
+ {
+ m_pCSVData->aDBData.erase(m_pCSVData->aDBData.begin() + nCurrent);
+ if(nCurrent)
+ --nCurrent;
+ }
+ else
+ {
+ // if only one set is available then clear the data
+ String sTemp;
+ m_pCSVData->aDBData[0].assign(m_pCSVData->aDBData[0].size(), sTemp);
+ m_aDeletePB.Enable(FALSE);
+ }
+ m_pAddressControl->SetCurrentDataSet(nCurrent);
+ m_aSetNoNF.SetMax(m_pCSVData->aDBData.size());
+ UpdateButtons();
+ return 0;
+}
+/*-- 13.04.2004 10:09:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCreateAddressListDialog, FindHdl_Impl, PushButton*, EMPTYARG)
+{
+ if(!m_pFindDlg)
+ {
+ m_pFindDlg = new SwFindEntryDialog(this);
+ ListBox& rColumnBox = m_pFindDlg->GetFieldsListBox();
+ ::std::vector< OUString >::iterator aHeaderIter;
+ for(aHeaderIter = m_pCSVData->aDBColumnHeaders.begin();
+ aHeaderIter != m_pCSVData->aDBColumnHeaders.end();
+ ++aHeaderIter)
+ rColumnBox.InsertEntry(*aHeaderIter);
+ rColumnBox.SelectEntryPos( 0 );
+ }
+ else
+ m_pFindDlg->Show(!m_pFindDlg->IsVisible());
+ return 0;
+}
+/*-- 13.04.2004 10:09:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCreateAddressListDialog, CustomizeHdl_Impl, PushButton*, pButton)
+{
+ SwCustomizeAddressListDialog* pDlg = new SwCustomizeAddressListDialog(pButton, *m_pCSVData);
+ if(RET_OK == pDlg->Execute())
+ {
+ delete m_pCSVData;
+ m_pCSVData = pDlg->GetNewData();
+ m_pAddressControl->SetData(*m_pCSVData);
+ m_pAddressControl->SetCurrentDataSet(m_pAddressControl->GetCurrentDataSet());
+ }
+ delete pDlg;
+
+ //update find dialog
+ if(m_pFindDlg)
+ {
+ ListBox& rColumnBox = m_pFindDlg->GetFieldsListBox();
+ rColumnBox.Clear();
+ ::std::vector< OUString >::iterator aHeaderIter;
+ for(aHeaderIter = m_pCSVData->aDBColumnHeaders.begin();
+ aHeaderIter != m_pCSVData->aDBColumnHeaders.end();
+ ++aHeaderIter)
+ rColumnBox.InsertEntry(*aHeaderIter);
+ }
+ return 0;
+}
+/*-- 23.04.2004 09:02:51---------------------------------------------------
+ writes the data into a .csv file
+ encoding is UTF8, separator is tab, strings are enclosed into "
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCreateAddressListDialog, OkHdl_Impl, PushButton*, EMPTYARG)
+{
+ if(!m_sURL.Len())
+ {
+ sfx2::FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_SIMPLE, 0 );
+ uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+
+ String sPath( SvtPathOptions().SubstituteVariable(
+ String::CreateFromAscii("$(userurl)/database") ));
+ aDlgHelper.SetDisplayDirectory( sPath );
+ uno::Reference< XFilterManager > xFltMgr(xFP, uno::UNO_QUERY);
+ ::rtl::OUString sCSV(C2U("*.csv"));
+ xFltMgr->appendFilter( m_sAddressListFilterName, sCSV );
+ xFltMgr->setCurrentFilter( m_sAddressListFilterName ) ;
+
+ if( ERRCODE_NONE == aDlgHelper.Execute() )
+ {
+ m_sURL = xFP->getFiles().getConstArray()[0];
+ INetURLObject aResult( m_sURL );
+ aResult.setExtension(String::CreateFromAscii("csv"));
+ m_sURL = aResult.GetMainURL(INetURLObject::NO_DECODE);
+ }
+ }
+ if(m_sURL.Len())
+ {
+ SfxMedium aMedium( m_sURL, STREAM_READWRITE|STREAM_TRUNC, TRUE );
+ SvStream* pStream = aMedium.GetOutStream();
+ pStream->SetLineDelimiter( LINEEND_LF );
+ pStream->SetStreamCharSet(RTL_TEXTENCODING_UTF8);
+
+ OUString sSemi(';');
+ OUString sQuote('"');
+ String sTempMiddle(sQuote);
+ sTempMiddle += sal_Unicode(9);
+ OUString sMiddle(sTempMiddle);
+ sMiddle += sQuote;
+
+ //create a string for the header line
+ OUString sLine(sQuote);
+ ::std::vector< OUString >::iterator aHeaderIter;
+ for(aHeaderIter = m_pCSVData->aDBColumnHeaders.begin();
+ aHeaderIter != m_pCSVData->aDBColumnHeaders.end();
+ ++aHeaderIter)
+ {
+ sLine += *aHeaderIter;
+ sLine += sMiddle;
+ }
+ //remove tab and quote
+ sLine = sLine.copy( 0, sLine.getLength() - 2 );
+ pStream->WriteUnicodeOrByteText( sLine, RTL_TEXTENCODING_UTF8 );
+ endl(*pStream);
+
+ ::std::vector< ::std::vector< OUString > >::iterator aDataIter;
+ for( aDataIter = m_pCSVData->aDBData.begin(); aDataIter != m_pCSVData->aDBData.end(); ++aDataIter)
+ {
+ sLine = sQuote;
+ ::std::vector< OUString >::iterator aColumnIter;
+ for(aColumnIter = aDataIter->begin(); aColumnIter != aDataIter->end(); ++aColumnIter)
+ {
+ sLine += *aColumnIter;
+ sLine += sMiddle;
+ }
+ //remove tab and quote
+ sLine = sLine.copy( 0, sLine.getLength() - 2 );
+ pStream->WriteUnicodeOrByteText( sLine, RTL_TEXTENCODING_UTF8 );
+ endl(*pStream);
+ }
+ aMedium.Commit();
+ EndDialog(RET_OK);
+ }
+
+ return 0;
+}
+/*-- 13.04.2004 10:09:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCreateAddressListDialog, DBCursorHdl_Impl, PushButton*, pButton)
+{
+ sal_uInt32 nValue = static_cast< sal_uInt32 >(m_aSetNoNF.GetValue());
+
+ if(pButton == &m_aStartPB)
+ nValue = 1;
+ else if(pButton == &m_aPrevPB)
+ {
+ if(nValue > 1)
+ --nValue;
+ }
+ else if(pButton == &m_aNextPB)
+ {
+ if(nValue < (sal_uInt32)m_aSetNoNF.GetMax())
+ ++nValue;
+ }
+ else //m_aEndPB
+ nValue = static_cast< sal_uInt32 >(m_aSetNoNF.GetMax());
+ if(nValue != m_aSetNoNF.GetValue())
+ {
+ m_aSetNoNF.SetValue(nValue);
+ DBNumCursorHdl_Impl(&m_aSetNoNF);
+ }
+ return 0;
+}
+/*-- 21.04.2004 12:06:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCreateAddressListDialog, DBNumCursorHdl_Impl, NumericField*, EMPTYARG)
+{
+ m_pAddressControl->SetCurrentDataSet( static_cast< sal_uInt32 >(m_aSetNoNF.GetValue() - 1) );
+ UpdateButtons();
+ return 0;
+}
+/*-- 21.04.2004 13:22:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwCreateAddressListDialog::UpdateButtons()
+{
+ sal_uInt32 nCurrent = static_cast< sal_uInt32 >(m_aSetNoNF.GetValue() );
+ sal_uInt32 nSize = (sal_uInt32 )m_pCSVData->aDBData.size();
+ m_aStartPB.Enable(nCurrent != 1);
+ m_aPrevPB.Enable(nCurrent != 1);
+ m_aNextPB.Enable(nCurrent != nSize);
+ m_aEndPB.Enable(nCurrent != nSize);
+ m_aDeletePB.Enable(nSize > 0);
+}
+/*-- 21.04.2004 13:22:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwCreateAddressListDialog::Find(const String& rSearch, sal_Int32 nColumn)
+{
+ OUString sSearch = rSearch;
+ sSearch.toAsciiLowerCase();
+ sal_uInt32 nCurrent = m_pAddressControl->GetCurrentDataSet();
+ //search forward
+ bool bFound = false;
+ sal_uInt32 nStart = nCurrent + 1;
+ sal_uInt32 nEnd = m_pCSVData->aDBData.size();
+ sal_uInt32 nElement = 0;
+ sal_uInt32 nPos = 0;
+ for(short nTemp = 0; nTemp < 2 && !bFound; nTemp++)
+ {
+ for(nPos = nStart; nPos < nEnd; ++nPos)
+ {
+ ::std::vector< OUString> aData = m_pCSVData->aDBData[nPos];
+ if(nColumn >=0)
+ bFound = -1 != aData[(sal_uInt32)nColumn].toAsciiLowerCase().indexOf(sSearch);
+ else
+ {
+ for( nElement = 0; nElement < aData.size(); ++nElement)
+ {
+ bFound = -1 != aData[nElement].toAsciiLowerCase().indexOf(sSearch);
+ if(bFound)
+ {
+ nColumn = nElement;
+ break;
+ }
+ }
+ }
+ if(bFound)
+ break;
+ }
+ nStart = 0;
+ nEnd = nCurrent + 1;
+ }
+ if(bFound)
+ {
+ m_pAddressControl->SetCurrentDataSet(nPos);
+ m_aSetNoNF.SetValue( nPos + 1 );
+ UpdateButtons();
+ m_pAddressControl->SetCursorTo(nElement);
+ }
+}
+/*-- 13.04.2004 13:48:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwFindEntryDialog::SwFindEntryDialog(SwCreateAddressListDialog* pParent) :
+ ModelessDialog(pParent, SW_RES(DLG_MM_FIND_ENTRY)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aFindFT( this, SW_RES( FT_FIND )),
+ m_aFindED( this, SW_RES( ED_FIND )),
+ m_aFindOnlyCB( this, SW_RES( CB_FINDONLY )),
+ m_aFindOnlyLB( this, SW_RES( LB_FINDONLY )),
+ m_aFindPB( this, SW_RES( PB_FIND)),
+ m_aCancel( this, SW_RES( PB_CANCEL)),
+ m_aHelp( this, SW_RES( PB_HELP)),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_pParent(pParent)
+{
+ FreeResource();
+ m_aFindPB.SetClickHdl(LINK(this, SwFindEntryDialog, FindHdl_Impl));
+ m_aFindED.SetModifyHdl(LINK(this, SwFindEntryDialog, FindEnableHdl_Impl));
+ m_aCancel.SetClickHdl(LINK(this, SwFindEntryDialog, CloseHdl_Impl));
+}
+/*-- 13.04.2004 13:48:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwFindEntryDialog::~SwFindEntryDialog()
+{
+}
+/*-- 21.04.2004 13:37:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwFindEntryDialog, FindHdl_Impl, PushButton*, EMPTYARG)
+{
+ sal_Int32 nColumn = -1;
+ if(m_aFindOnlyCB.IsChecked())
+ nColumn = m_aFindOnlyLB.GetSelectEntryPos();
+ if(nColumn != LISTBOX_ENTRY_NOTFOUND)
+ m_pParent->Find(m_aFindED.GetText(), nColumn);
+ return 0;
+}
+/*-- 21.04.2004 13:37:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwFindEntryDialog, FindEnableHdl_Impl, Edit*, EMPTYARG)
+{
+ m_aFindPB.Enable(m_aFindED.GetText().Len() > 0);
+ return 0;
+}
+/*-- 21.04.2004 15:36:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwFindEntryDialog, CloseHdl_Impl, PushButton*, EMPTYARG)
+{
+ Show(FALSE);
+ return 0;
+}
diff --git a/sw/source/ui/dbui/createaddresslistdialog.hrc b/sw/source/ui/dbui/createaddresslistdialog.hrc
new file mode 100644
index 000000000000..d843acbcf63f
--- /dev/null
+++ b/sw/source/ui/dbui/createaddresslistdialog.hrc
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CREATEADDRESSLISTDIALOG_HRC
+#define _CREATEADDRESSLISTDIALOG_HRC
+
+#define FI_ADDRESSINFORMATION 1
+#define CT_ADDRESS 2
+#define PB_NEW 3
+#define PB_DELETE 4
+#define PB_FIND 5
+#define PB_CUSTOMIZE 6
+#define FI_VIEWENTRIES 7
+#define PB_START 8
+#define PB_PREV 9
+#define NF_SETNO 10
+#define PB_NEXT 11
+#define PB_END 12
+#define FL_SEPARATOR 13
+#define PB_OK 14
+#define PB_CANCEL 15
+#define PB_HELP 16
+
+#define ST_FILTERNAME 18
+
+#define SCR_1 1
+#define WIN_DATA 2
+
+#define FT_FIND 1
+#define ED_FIND 2
+#define CB_FINDONLY 3
+#define LB_FINDONLY 4
+
+#define FT_FIELDNAME 1
+#define ED_FIELDNAME 2
+#define ST_RENAME_TITLE 3
+#define ST_ADD_BUTTON 4
+#define PB_FIND 5
+
+
+#endif
diff --git a/sw/source/ui/dbui/createaddresslistdialog.hxx b/sw/source/ui/dbui/createaddresslistdialog.hxx
new file mode 100644
index 000000000000..b900d7d21ff6
--- /dev/null
+++ b/sw/source/ui/dbui/createaddresslistdialog.hxx
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CREATEADDRESSLISTDIALOG_HXX
+#define _CREATEADDRESSLISTDIALOG_HXX
+
+#include <sfx2/basedlgs.hxx>
+
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+#include <vcl/field.hxx>
+#include <vcl/lstbox.hxx>
+#include <vector>
+
+class SwAddressControl_Impl;
+class SwMailMergeConfigItem;
+/*-- 19.04.2004 12:09:46---------------------------------------------------
+ container of the created database
+ -----------------------------------------------------------------------*/
+struct SwCSVData
+{
+ ::std::vector< ::rtl::OUString > aDBColumnHeaders;
+ ::std::vector< ::std::vector< ::rtl::OUString> > aDBData;
+};
+/*-- 08.04.2004 14:04:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwFindEntryDialog;
+class SwCreateAddressListDialog : public SfxModalDialog
+{
+ FixedInfo m_aAddressInformation;
+ SwAddressControl_Impl* m_pAddressControl;
+
+ PushButton m_aNewPB;
+ PushButton m_aDeletePB;
+ PushButton m_aFindPB;
+ PushButton m_aCustomizePB;
+
+ FixedInfo m_aViewEntriesFI;
+ PushButton m_aStartPB;
+ PushButton m_aPrevPB;
+ NumericField m_aSetNoNF;
+ PushButton m_aNextPB;
+ PushButton m_aEndPB;
+
+ FixedLine m_aSeparatorFL;
+
+ OKButton m_aOK;
+ CancelButton m_aCancel;
+ HelpButton m_aHelp;
+
+ String m_sAddressListFilterName;
+ String m_sURL;
+
+ SwCSVData* m_pCSVData;
+ SwFindEntryDialog* m_pFindDlg;
+
+ DECL_LINK(NewHdl_Impl, PushButton*);
+ DECL_LINK(DeleteHdl_Impl, PushButton*);
+ DECL_LINK(FindHdl_Impl, PushButton*);
+ DECL_LINK(CustomizeHdl_Impl, PushButton*);
+ DECL_LINK(OkHdl_Impl, PushButton*);
+ DECL_LINK(DBCursorHdl_Impl, PushButton*);
+ DECL_LINK(DBNumCursorHdl_Impl, NumericField*);
+
+ void UpdateButtons();
+
+public:
+ SwCreateAddressListDialog(
+ Window* pParent, const String& rURL, SwMailMergeConfigItem& rConfig);
+ ~SwCreateAddressListDialog();
+
+ const String& GetURL() const { return m_sURL; }
+ void Find( const String& rSearch, sal_Int32 nColumn);
+};
+/*-- 13.04.2004 13:30:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwFindEntryDialog : public ModelessDialog
+{
+ FixedText m_aFindFT;
+ Edit m_aFindED;
+ CheckBox m_aFindOnlyCB;
+ ListBox m_aFindOnlyLB;
+
+ PushButton m_aFindPB;
+ CancelButton m_aCancel;
+ HelpButton m_aHelp;
+
+ SwCreateAddressListDialog* m_pParent;
+
+ DECL_LINK(FindHdl_Impl, PushButton*);
+ DECL_LINK(FindEnableHdl_Impl, Edit*);
+ DECL_LINK(CloseHdl_Impl, PushButton*);
+
+public:
+ SwFindEntryDialog(SwCreateAddressListDialog* pParent);
+ ~SwFindEntryDialog();
+
+ ListBox& GetFieldsListBox(){return m_aFindOnlyLB;}
+ String GetFindString() const {return m_aFindED.GetText();}
+};
+
+#endif
+
diff --git a/sw/source/ui/dbui/createaddresslistdialog.src b/sw/source/ui/dbui/createaddresslistdialog.src
new file mode 100644
index 000000000000..5f51d6a300fb
--- /dev/null
+++ b/sw/source/ui/dbui/createaddresslistdialog.src
@@ -0,0 +1,238 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <createaddresslistdialog.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+/*-- 13.04.2004 13:58:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+ModalDialog DLG_MM_CREATEADDRESSLIST
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_CREATEADDRESSLIST;
+ Size = MAP_APPFONT ( 318 , 231 ) ;
+ Moveable = TRUE ;
+
+ Text [ en-US ] = "New Address List";
+
+ FixedText FI_ADDRESSINFORMATION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 150 , 8 ) ;
+ Text [ en-US ] = "Address Information";
+ };
+ Control CT_ADDRESS
+ {
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 250 , 160 ) ;
+ Border = TRUE;
+ DialogControl = TRUE;
+ OutputSize = TRUE ;
+
+ ScrollBar SCR_1
+ {
+ Pos = MAP_APPFONT ( 240 , 0 ) ;
+ Size = MAP_APPFONT ( 10 , 160 ) ;
+ };
+ Window WIN_DATA
+ {
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 240 , 160 ) ;
+ DialogControl = TRUE;
+ };
+ };
+ PushButton PB_NEW
+ {
+ HelpID = "sw:PushButton:DLG_MM_CREATEADDRESSLIST:PB_NEW";
+ Pos = MAP_APPFONT ( 262 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~New";
+ };
+ PushButton PB_DELETE
+ {
+ HelpID = "sw:PushButton:DLG_MM_CREATEADDRESSLIST:PB_DELETE";
+ Pos = MAP_APPFONT ( 262 , 32 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete";
+ };
+ PushButton PB_FIND
+ {
+ HelpID = "sw:PushButton:DLG_MM_CREATEADDRESSLIST:PB_FIND";
+ Pos = MAP_APPFONT ( 262 , 50 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Find...";
+ };
+ PushButton PB_CUSTOMIZE
+ {
+ HelpID = "sw:PushButton:DLG_MM_CREATEADDRESSLIST:PB_CUSTOMIZE";
+ Pos = MAP_APPFONT ( 262 , 68 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "C~ustomize...";
+ };
+ FixedText FI_VIEWENTRIES
+ {
+ Pos = MAP_APPFONT ( 6 , 183 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ Text [ en-US ] = "Sho~w entry number";
+ };
+ PushButton PB_START
+ {
+ HelpID = "sw:PushButton:DLG_MM_CREATEADDRESSLIST:PB_START";
+ Pos = MAP_APPFONT ( 100 , 180 ) ;
+ Size = MAP_APPFONT ( 20 , 14 ) ;
+ Text = "|<";
+ };
+ PushButton PB_PREV
+ {
+ HelpID = "sw:PushButton:DLG_MM_CREATEADDRESSLIST:PB_PREV";
+ Pos = MAP_APPFONT ( 123 , 180 ) ;
+ Size = MAP_APPFONT ( 20 , 14 ) ;
+ Text = "<";
+ };
+ NumericField NF_SETNO
+ {
+ HelpID = "sw:NumericField:DLG_MM_CREATEADDRESSLIST:NF_SETNO";
+ Pos = MAP_APPFONT ( 146 , 180 ) ;
+ Size = MAP_APPFONT ( 20 , 14 ) ;
+ Border = TRUE;
+ Left = TRUE ;
+ First = 1 ;
+ Minimum = 1 ;
+ Value = 1;
+ Repeat = TRUE ;
+ Spin = FALSE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_NEXT
+ {
+ HelpID = "sw:PushButton:DLG_MM_CREATEADDRESSLIST:PB_NEXT";
+ Pos = MAP_APPFONT ( 169 , 180 ) ;
+ Size = MAP_APPFONT ( 20 , 14 ) ;
+ Text = ">";
+ };
+ PushButton PB_END
+ {
+ HelpID = "sw:PushButton:DLG_MM_CREATEADDRESSLIST:PB_END";
+ Pos = MAP_APPFONT ( 192 , 180 ) ;
+ Size = MAP_APPFONT ( 20 , 14 ) ;
+ Text = ">|";
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 200 ) ;
+ Size = MAP_APPFONT ( 318 , 8 ) ;
+ };
+
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 153 , 211 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 206 , 211 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 262 , 211 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+
+ String ST_FILTERNAME
+ {
+ Text [ en-US ] = "%PRODUCTNAME Address List (.csv)";
+ };
+};
+
+/*-- 13.04.2004 13:58:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+ModelessDialog DLG_MM_FIND_ENTRY
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_FIND_ENTRY;
+ Size = MAP_APPFONT ( 188 , 63 ) ;
+ Moveable = TRUE ;
+
+ Text [ en-US ] = "Find Entry";
+
+ FixedText FT_FIND
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "F~ind";
+ };
+ Edit ED_FIND
+ {
+ HelpID = "sw:Edit:DLG_MM_FIND_ENTRY:ED_FIND";
+ Pos = MAP_APPFONT ( 6 , 14) ;
+ Size = MAP_APPFONT ( 120 , 12 ) ;
+ Border = TRUE;
+ };
+ CheckBox CB_FINDONLY
+ {
+ HelpID = "sw:CheckBox:DLG_MM_FIND_ENTRY:CB_FINDONLY";
+ Pos = MAP_APPFONT ( 6 , 32 ) ;
+ Size = MAP_APPFONT ( 120 , 10 ) ;
+ Text [ en-US ] = "Find ~only in";
+ };
+ ListBox LB_FINDONLY
+ {
+ HelpID = "sw:ListBox:DLG_MM_FIND_ENTRY:LB_FINDONLY";
+ Pos = MAP_APPFONT ( 12 , 45 ) ;
+ Size = MAP_APPFONT ( 114 , 50 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ };
+ PushButton PB_FIND
+ {
+ HelpID = "sw:PushButton:DLG_MM_FIND_ENTRY:PB_FIND";
+ Pos = MAP_APPFONT ( 132 , 3 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE;
+ Text [ en-US ] = "~Find";
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 132 , 20 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Close";
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 132 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+
diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.cxx b/sw/source/ui/dbui/customizeaddresslistdialog.cxx
new file mode 100644
index 000000000000..f5191fe0fe55
--- /dev/null
+++ b/sw/source/ui/dbui/customizeaddresslistdialog.cxx
@@ -0,0 +1,274 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <swtypes.hxx>
+#include <customizeaddresslistdialog.hxx>
+#include <createaddresslistdialog.hxx>
+#include <vcl/scrbar.hxx>
+#include <vcl/msgbox.hxx>
+#include <customizeaddresslistdialog.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+
+
+/*-- 13.04.2004 14:27:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwCustomizeAddressListDialog::SwCustomizeAddressListDialog(
+ Window* pParent, const SwCSVData& rOldData) :
+ SfxModalDialog(pParent, SW_RES(DLG_MM_CUSTOMIZE_ADDRESS_LIST)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aFieldsFT( this, SW_RES( FT_FIELDS)),
+ m_aFieldsLB( this, SW_RES( LB_FIELDS)),
+ m_aAddPB( this, SW_RES( PB_ADD)),
+ m_aDeletePB( this, SW_RES( PB_DELETE)),
+ m_aRenamePB( this, SW_RES( PB_RENAME)),
+ m_aUpPB( this, SW_RES( PB_UP)),
+ m_aDownPB( this, SW_RES( PB_DOWN)),
+ m_aSeparatorFL( this, SW_RES( FL_SEPARATOR)),
+ m_aOK( this, SW_RES( PB_OK)),
+ m_aCancel( this, SW_RES( PB_CANCEL)),
+ m_aHelp( this, SW_RES( PB_HELP)),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_pNewData( new SwCSVData(rOldData))
+{
+ FreeResource();
+ m_aFieldsLB.SetSelectHdl(LINK(this, SwCustomizeAddressListDialog, ListBoxSelectHdl_Impl));
+ Link aAddRenameLk = LINK(this, SwCustomizeAddressListDialog, AddRenameHdl_Impl );
+ m_aAddPB.SetClickHdl(aAddRenameLk);
+ m_aRenamePB.SetClickHdl(aAddRenameLk);
+ m_aDeletePB.SetClickHdl(LINK(this, SwCustomizeAddressListDialog, DeleteHdl_Impl ));
+ Link aUpDownLk = LINK(this, SwCustomizeAddressListDialog, UpDownHdl_Impl);
+ m_aUpPB.SetClickHdl(aUpDownLk);
+ m_aDownPB.SetClickHdl(aUpDownLk);
+
+ ::std::vector< ::rtl::OUString >::iterator aHeaderIter;
+
+ for(aHeaderIter = m_pNewData->aDBColumnHeaders.begin();
+ aHeaderIter != m_pNewData->aDBColumnHeaders.end(); ++aHeaderIter)
+ m_aFieldsLB.InsertEntry(*aHeaderIter);
+
+ m_aFieldsLB.SelectEntryPos(0);
+ UpdateButtons();
+}
+/*-- 13.04.2004 14:34:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwCustomizeAddressListDialog::~SwCustomizeAddressListDialog()
+{
+}
+
+/*-- 12.08.2004 12:58:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCustomizeAddressListDialog, ListBoxSelectHdl_Impl, ListBox*, EMPTYARG)
+{
+ UpdateButtons();
+ return 0;
+}
+/*-- 13.04.2004 15:02:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCustomizeAddressListDialog, AddRenameHdl_Impl, PushButton*, pButton)
+{
+ bool bRename = pButton == &m_aRenamePB;
+ USHORT nPos = m_aFieldsLB.GetSelectEntryPos();
+ if(nPos == LISTBOX_ENTRY_NOTFOUND)
+ nPos = 0;
+
+ SwAddRenameEntryDialog* pDlg =
+ new SwAddRenameEntryDialog(pButton, bRename, m_pNewData->aDBColumnHeaders);
+ if(bRename)
+ {
+ String aTemp = m_aFieldsLB.GetEntry(nPos);
+ pDlg->SetFieldName(aTemp);
+ }
+ if(RET_OK == pDlg->Execute())
+ {
+ String sNew = pDlg->GetFieldName();
+ if(bRename)
+ {
+ m_pNewData->aDBColumnHeaders[nPos] = sNew;
+ m_aFieldsLB.RemoveEntry(nPos);
+ }
+ else
+ {
+ if ( m_aFieldsLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ ++nPos; // append the new entry behind the selected
+ //add the new column
+ m_pNewData->aDBColumnHeaders.insert(m_pNewData->aDBColumnHeaders.begin() + nPos, sNew);
+ //add a new entry into all data arrays
+ String sTemp;
+ ::std::vector< ::std::vector< ::rtl::OUString > >::iterator aDataIter;
+ for( aDataIter = m_pNewData->aDBData.begin(); aDataIter != m_pNewData->aDBData.end(); ++aDataIter)
+ aDataIter->insert(aDataIter->begin() + nPos, sTemp);
+
+ }
+
+ m_aFieldsLB.InsertEntry(sNew, nPos);
+ m_aFieldsLB.SelectEntryPos(nPos);
+ }
+ delete pDlg;
+ UpdateButtons();
+ return 0;
+}
+/*-- 13.04.2004 15:02:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCustomizeAddressListDialog, DeleteHdl_Impl, PushButton*, EMPTYARG)
+{
+ USHORT nPos = m_aFieldsLB.GetSelectEntryPos();
+ m_aFieldsLB.RemoveEntry(m_aFieldsLB.GetSelectEntryPos());
+ m_aFieldsLB.SelectEntryPos(nPos > m_aFieldsLB.GetEntryCount() - 1 ? nPos - 1 : nPos);
+
+ //remove the column
+ m_pNewData->aDBColumnHeaders.erase(m_pNewData->aDBColumnHeaders.begin() + nPos);
+ //remove the data
+ ::std::vector< ::std::vector< ::rtl::OUString > >::iterator aDataIter;
+ for( aDataIter = m_pNewData->aDBData.begin(); aDataIter != m_pNewData->aDBData.end(); ++aDataIter)
+ aDataIter->erase(aDataIter->begin() + nPos);
+
+ UpdateButtons();
+ return 0;
+}
+/*-- 13.04.2004 15:02:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCustomizeAddressListDialog, UpDownHdl_Impl, PushButton*, pButton)
+{
+ USHORT nPos;
+ USHORT nOldPos = nPos = m_aFieldsLB.GetSelectEntryPos();
+ String aTemp = m_aFieldsLB.GetEntry(nPos);
+ m_aFieldsLB.RemoveEntry( nPos );
+ if(pButton == &m_aUpPB)
+ --nPos;
+ else
+ ++nPos;
+ m_aFieldsLB.InsertEntry(aTemp, nPos);
+ m_aFieldsLB.SelectEntryPos(nPos);
+ //align m_pNewData
+ ::rtl::OUString sHeader = m_pNewData->aDBColumnHeaders[nOldPos];
+ m_pNewData->aDBColumnHeaders.erase(m_pNewData->aDBColumnHeaders.begin() + nOldPos);
+ m_pNewData->aDBColumnHeaders.insert(m_pNewData->aDBColumnHeaders.begin() + nPos, sHeader);
+ ::std::vector< ::std::vector< ::rtl::OUString > >::iterator aDataIter;
+ for( aDataIter = m_pNewData->aDBData.begin(); aDataIter != m_pNewData->aDBData.end(); ++aDataIter)
+ {
+ ::rtl::OUString sData = (*aDataIter)[nOldPos];
+ aDataIter->erase(aDataIter->begin() + nOldPos);
+ aDataIter->insert(aDataIter->begin() + nPos, sData);
+ }
+
+ UpdateButtons();
+ return 0;
+}
+/*-- 19.04.2004 14:51:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwCustomizeAddressListDialog::UpdateButtons()
+{
+ USHORT nPos = m_aFieldsLB.GetSelectEntryPos();
+ USHORT nEntries = m_aFieldsLB.GetEntryCount();
+ m_aUpPB.Enable(nPos > 0 && nEntries > 0);
+ m_aDownPB.Enable(nPos < nEntries -1);
+ m_aDeletePB.Enable(nEntries > 0);
+ m_aRenamePB.Enable(nEntries > 0);
+}
+/*-- 19.04.2004 14:51:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwCSVData* SwCustomizeAddressListDialog::GetNewData()
+{
+ return m_pNewData;
+}
+
+/*-- 13.04.2004 13:48:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAddRenameEntryDialog::SwAddRenameEntryDialog(
+ Window* pParent, bool bRename, const ::std::vector< ::rtl::OUString >& rCSVHeader) :
+ SfxModalDialog(pParent, SW_RES(DLG_MM_ADD_RENAME_ENTRY)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aFieldNameFT( this, SW_RES( FT_FIELDNAME)),
+ m_aFieldNameED( this, SW_RES( ED_FIELDNAME)),
+ m_aOK( this, SW_RES( PB_OK)),
+ m_aCancel( this, SW_RES( PB_CANCEL)),
+ m_aHelp( this, SW_RES( PB_HELP)),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_rCSVHeader(rCSVHeader)
+{
+ if(bRename)
+ SetText(String(SW_RES(ST_RENAME_TITLE)));
+ else
+ m_aOK.SetText(String(SW_RES(ST_ADD_BUTTON)));
+ FreeResource();
+ m_aFieldNameED.SetModifyHdl(LINK(this, SwAddRenameEntryDialog, ModifyHdl_Impl));
+ ModifyHdl_Impl( &m_aFieldNameED );
+}
+/*-- 13.04.2004 13:48:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAddRenameEntryDialog::~SwAddRenameEntryDialog()
+{
+}
+/*-- 19.04.2004 15:31:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAddRenameEntryDialog, ModifyHdl_Impl, Edit*, pEdit)
+{
+ ::rtl::OUString sEntry = pEdit->GetText();
+ BOOL bFound = sEntry.getLength() ? FALSE : TRUE;
+
+ if(!bFound)
+ {
+ ::std::vector< ::rtl::OUString >::const_iterator aHeaderIter;
+ for(aHeaderIter = m_rCSVHeader.begin();
+ aHeaderIter != m_rCSVHeader.end();
+ ++aHeaderIter)
+ if(*aHeaderIter == sEntry)
+ {
+ bFound = TRUE;
+ break;
+ }
+ }
+ m_aOK.Enable(!bFound);
+ return 0;
+}
diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.hrc b/sw/source/ui/dbui/customizeaddresslistdialog.hrc
new file mode 100644
index 000000000000..8e04f81a07b3
--- /dev/null
+++ b/sw/source/ui/dbui/customizeaddresslistdialog.hrc
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CUSTOMIZEADDRESSLISTDIALOG_HRC
+#define _CUSTOMIZEADDRESSLISTDIALOG_HRC
+
+#define FT_FIELDS 1
+#define LB_FIELDS 2
+#define PB_ADD 3
+#define PB_DELETE 4
+#define PB_RENAME 5
+#define PB_UP 6
+#define PB_DOWN 7
+#define FL_SEPARATOR 8
+
+#define PB_OK 14
+#define PB_CANCEL 15
+#define PB_HELP 16
+
+#define FT_FIELDNAME 1
+#define ED_FIELDNAME 2
+#define ST_RENAME_TITLE 3
+#define ST_ADD_BUTTON 4
+
+
+#endif
diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.hxx b/sw/source/ui/dbui/customizeaddresslistdialog.hxx
new file mode 100644
index 000000000000..42298a463cbf
--- /dev/null
+++ b/sw/source/ui/dbui/customizeaddresslistdialog.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CUSTOMIZEADDRESSLISTDIALOG_HXX
+#define _CUSTOMIZEADDRESSLISTDIALOG_HXX
+#include <sfx2/basedlgs.hxx>
+
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+#include <vcl/field.hxx>
+#include <vcl/lstbox.hxx>
+
+struct SwCSVData;
+/*-- 08.04.2004 14:04:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwCustomizeAddressListDialog : public SfxModalDialog
+{
+ FixedText m_aFieldsFT;
+ ListBox m_aFieldsLB;
+
+ PushButton m_aAddPB;
+ PushButton m_aDeletePB;
+ PushButton m_aRenamePB;
+
+ ImageButton m_aUpPB;
+ ImageButton m_aDownPB;
+
+ FixedLine m_aSeparatorFL;
+
+ OKButton m_aOK;
+ CancelButton m_aCancel;
+ HelpButton m_aHelp;
+
+ SwCSVData* m_pNewData;
+
+ DECL_LINK(AddRenameHdl_Impl, PushButton*);
+ DECL_LINK(DeleteHdl_Impl, PushButton*);
+ DECL_LINK(UpDownHdl_Impl, PushButton*);
+ DECL_LINK(ListBoxSelectHdl_Impl, ListBox*);
+
+ void UpdateButtons();
+public:
+ SwCustomizeAddressListDialog(Window* pParent, const SwCSVData& rOldData);
+ ~SwCustomizeAddressListDialog();
+
+ SwCSVData* GetNewData();
+};
+/*-- 13.04.2004 13:30:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwAddRenameEntryDialog : public SfxModalDialog
+{
+ FixedText m_aFieldNameFT;
+ Edit m_aFieldNameED;
+
+ OKButton m_aOK;
+ CancelButton m_aCancel;
+ HelpButton m_aHelp;
+
+ const ::std::vector< ::rtl::OUString >& m_rCSVHeader;
+
+ DECL_LINK(ModifyHdl_Impl, Edit*);
+public:
+ SwAddRenameEntryDialog(Window* pParent, bool bRename, const ::std::vector< ::rtl::OUString >& aCSVHeader);
+ ~SwAddRenameEntryDialog();
+
+ void SetFieldName(const String& rName) {m_aFieldNameED.SetText(rName);}
+ String GetFieldName() const {return m_aFieldNameED.GetText();};
+
+};
+
+#endif
+
diff --git a/sw/source/ui/dbui/customizeaddresslistdialog.src b/sw/source/ui/dbui/customizeaddresslistdialog.src
new file mode 100644
index 000000000000..29de352b4cf3
--- /dev/null
+++ b/sw/source/ui/dbui/customizeaddresslistdialog.src
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <customizeaddresslistdialog.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+/*-- 13.04.2004 13:58:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+ModalDialog DLG_MM_CUSTOMIZE_ADDRESS_LIST
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_CUSTOMIZE_ADDRESS_LIST;
+ Size = MAP_APPFONT ( 200 , 171 ) ;
+ Moveable = TRUE ;
+
+ Text [ en-US ] = "Customize Address List";
+
+ FixedText FT_FIELDS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Text [ en-US ] = "A~ddress list elements";
+ };
+ ListBox LB_FIELDS
+ {
+ HelpID = "sw:ListBox:DLG_MM_CUSTOMIZE_ADDRESS_LIST:LB_FIELDS";
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 112 , 120 ) ;
+ Border = TRUE;
+ };
+ PushButton PB_ADD
+ {
+ HelpID = "sw:PushButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_ADD";
+ Pos = MAP_APPFONT ( 144 , 3 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add...";
+ };
+ PushButton PB_DELETE
+ {
+ HelpID = "sw:PushButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_DELETE";
+ Pos = MAP_APPFONT ( 144 , 20 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete";
+ };
+ PushButton PB_RENAME
+ {
+ HelpID = "sw:PushButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_RENAME";
+ Pos = MAP_APPFONT ( 144 , 37 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Rename...";
+ };
+ ImageButton PB_UP
+ {
+ HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_UP";
+ Pos = MAP_APPFONT ( 124 , 58 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ SYMBOL = IMAGEBUTTON_ARROW_UP;
+ QuickHelpText[ en-US ] = "Move up";
+ };
+ ImageButton PB_DOWN
+ {
+ HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZE_ADDRESS_LIST:PB_DOWN";
+ Pos = MAP_APPFONT ( 124 , 75 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ SYMBOL = IMAGEBUTTON_ARROW_DOWN;
+ QuickHelpText[ en-US ] = "Move down";
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 140 ) ;
+ Size = MAP_APPFONT ( 200 , 8 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 35 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 88 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 144 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+/*-- 13.04.2004 13:58:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+ModalDialog DLG_MM_ADD_RENAME_ENTRY
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_ADD_RENAME_ENTRY;
+ Size = MAP_APPFONT ( 188 , 60 ) ;
+ Moveable = TRUE ;
+
+ Text [ en-US ] = "Add Element";
+
+ FixedText FT_FIELDNAME
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Element ~name";
+ };
+ Edit ED_FIELDNAME
+ {
+ HelpID = "sw:Edit:DLG_MM_ADD_RENAME_ENTRY:ED_FIELDNAME";
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 120 , 12 ) ;
+ Border = TRUE;
+ };
+
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 132 , 3 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 132 , 20 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 132 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ String ST_RENAME_TITLE
+ {
+ Text [ en-US ] = "Rename Element";
+ };
+ String ST_ADD_BUTTON
+ {
+ Text [ en-US ] = "Add";
+ };
+};
+
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
new file mode 100644
index 000000000000..9e62f7a4de36
--- /dev/null
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -0,0 +1,1945 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include "dbinsdlg.hxx"
+
+#include <memory>
+
+#include <float.h>
+
+#include <hintids.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+#include <com/sun/star/sdb/XDatabaseAccess.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/util/XNumberFormatTypes.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <comphelper/processfactory.hxx>
+#include <editeng/langitem.hxx>
+#include <svl/numuno.hxx>
+#include <svl/stritem.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/mnemonic.hxx>
+#include <svl/style.hxx>
+#include <svl/zformat.hxx>
+#include <svx/htmlmode.hxx>
+#include <editeng/unolingu.hxx>
+#include <sfx2/app.hxx>
+#include <svl/itemset.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <svx/rulritem.hxx>
+#include <swdbtoolsclient.hxx>
+#include <tabledlg.hxx>
+#include <fmtclds.hxx>
+#include <tabcol.hxx>
+#include <uiitems.hxx>
+#include <viewopt.hxx>
+#include <uitool.hxx>
+#include <wrtsh.hxx>
+#include <wview.hxx>
+#include <docsh.hxx>
+#include <dbmgr.hxx>
+#include <tblafmt.hxx>
+#include <cellatr.hxx>
+#include <swtable.hxx>
+#include <dbfld.hxx>
+#include <fmtcol.hxx>
+#include <section.hxx>
+#include <swwait.hxx>
+#include <modcfg.hxx>
+#include <swmodule.hxx>
+#include <poolfmt.hxx>
+#include <crsskip.hxx>
+
+#include <dbinsdlg.hrc>
+#include <dbui.hrc>
+
+#include <cmdid.h>
+#include <helpid.h>
+#include <cfgid.h>
+#include <SwStyleNameMapper.hxx>
+#include <comphelper/uno3.hxx>
+#include "tabsh.hxx"
+#include "swabstdlg.hxx"
+#include "table.hrc"
+#include <unomid.h>
+#include <IDocumentMarkAccess.hxx>
+
+
+namespace swui
+{
+ SwAbstractDialogFactory * GetFactory();
+}
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::beans;
+
+// tblafmt.hxx
+SV_IMPL_PTRARR( _SwTableAutoFmtTbl, SwTableAutoFmt* )
+
+const char cDBFldStart = '<';
+const char cDBFldEnd = '>';
+
+// Hilfsstruktur fuers einfuegen von Datenbankspalten als Felder oder Text
+struct _DB_Column
+{
+ enum ColType { DB_FILLTEXT, DB_COL_FIELD, DB_COL_TEXT, DB_SPLITPARA } eColType;
+
+ union {
+ String* pText;
+ SwField* pField;
+ ULONG nFormat;
+ } DB_ColumnData;
+ const SwInsDBColumn* pColInfo;
+
+ _DB_Column()
+ {
+ pColInfo = 0;
+ DB_ColumnData.pText = 0;
+ eColType = DB_SPLITPARA;
+ }
+
+ _DB_Column( const String& rTxt )
+ {
+ pColInfo = 0;
+ DB_ColumnData.pText = new String( rTxt );
+ eColType = DB_FILLTEXT;
+ }
+
+ _DB_Column( const SwInsDBColumn& rInfo, ULONG nFormat )
+ {
+ pColInfo = &rInfo;
+ DB_ColumnData.nFormat = nFormat;
+ eColType = DB_COL_TEXT;
+ }
+
+ _DB_Column( const SwInsDBColumn& rInfo, SwDBField& rFld )
+ {
+ pColInfo = &rInfo;
+ DB_ColumnData.pField = &rFld;
+ eColType = DB_COL_FIELD;
+ }
+
+ ~_DB_Column()
+ {
+ if( DB_COL_FIELD == eColType )
+ delete DB_ColumnData.pField;
+ else if( DB_FILLTEXT == eColType )
+ delete DB_ColumnData.pText;
+ }
+};
+
+typedef _DB_Column* _DB_ColumnPtr;
+SV_DECL_PTRARR_DEL( _DB_Columns, _DB_ColumnPtr, 32, 32 )
+SV_IMPL_PTRARR( _DB_Columns, _DB_ColumnPtr )
+
+SV_IMPL_OP_PTRARR_SORT( SwInsDBColumns, SwInsDBColumnPtr )
+
+/* */
+
+#define DBCOLUMN_CONFIG_VERSION1 1
+#define DBCOLUMN_CONFIG_VERSION DBCOLUMN_CONFIG_VERSION1
+#define DBCOLUMN_MAXDATA 5
+
+struct _DB_ColumnConfigData
+{
+ SwInsDBColumns aDBColumns;
+ rtl::OUString sSource, sTable, sEdit, sTblList, sTmplNm, sTAutoFmtNm;
+ BOOL bIsTable : 1,
+ bIsField : 1,
+ bIsHeadlineOn : 1,
+ bIsEmptyHeadln : 1;
+
+ _DB_ColumnConfigData()
+ {
+ bIsTable = bIsHeadlineOn = TRUE;
+ bIsField = bIsEmptyHeadln = FALSE;
+ }
+
+ ~_DB_ColumnConfigData();
+private:
+ _DB_ColumnConfigData( const _DB_ColumnConfigData& );
+ _DB_ColumnConfigData& operator =( const _DB_ColumnConfigData& );
+};
+
+/* */
+
+int SwInsDBColumn::operator<( const SwInsDBColumn& rCmp ) const
+{
+ return 0 > GetAppCollator().compareString( sColumn, rCmp.sColumn );
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView,
+ Reference<XDataSource> xDataSource,
+ Reference<sdbcx::XColumnsSupplier> xColSupp,
+ const SwDBData& rData )
+ : SfxModalDialog( rView.GetWindow(), SW_RES( DLG_AP_INSERT_DB_SEL )),
+ ConfigItem(C2U("Office.Writer/InsertData/DataSet"), CONFIG_MODE_DELAYED_UPDATE),
+ aFtInsertData( this, SW_RES( FT_INSERT_DATA )),
+ aRbAsTable( this, SW_RES( RB_AS_TABLE )),
+ aRbAsField( this, SW_RES( RB_AS_FIELD )),
+ aRbAsText( this, SW_RES( RB_AS_TEXT )),
+
+ aFlHead( this, SW_RES( FL_HEAD )),
+ aFtDbColumn( this, SW_RES( FT_DB_COLUMN )),
+
+ aLbTblDbColumn( this, SW_RES( LB_TBL_DB_COLUMN )),
+ aLbTxtDbColumn( this, SW_RES( LB_TXT_DB_COLUMN )),
+
+ aFlFormat( this, SW_RES( FL_FORMAT )),
+ aRbDbFmtFromDb( this, SW_RES( RB_DBFMT_FROM_DB )),
+ aRbDbFmtFromUsr( this, SW_RES( RB_DBFMT_FROM_USR )),
+ aLbDbFmtFromUsr( this, &rView, SW_RES( LB_DBFMT_FROM_USR )),
+
+ aIbDbcolToEdit( this, SW_RES( IB_DBCOL_TOEDIT )),
+ aEdDbText( this, SW_RES( ED_DB_TEXT )),
+ aFtDbParaColl( this, SW_RES( FT_DB_PARA_COLL )),
+ aLbDbParaColl( this, SW_RES( LB_DB_PARA_COLL )),
+
+ aIbDbcolAllTo( this, SW_RES( IB_DBCOL_ALL_TO )),
+ aIbDbcolOneTo( this, SW_RES( IB_DBCOL_ONE_TO )),
+ aIbDbcolOneFrom( this, SW_RES( IB_DBCOL_ONE_FROM )),
+ aIbDbcolAllFrom( this, SW_RES( IB_DBCOL_ALL_FROM )),
+ aFtTableCol( this, SW_RES( FT_TABLE_COL )),
+ aLbTableCol( this, SW_RES( LB_TABLE_COL )),
+ aCbTableHeadon( this, SW_RES( CB_TABLE_HEADON )),
+ aRbHeadlColnms( this, SW_RES( RB_HEADL_COLNMS )),
+ aRbHeadlEmpty( this, SW_RES( RB_HEADL_EMPTY )),
+ aPbTblFormat( this, SW_RES( PB_TBL_FORMAT )),
+ aPbTblAutofmt( this, SW_RES( PB_TBL_AUTOFMT )),
+
+ aBtOk( this, SW_RES( BT_OK )),
+ aBtCancel( this, SW_RES( BT_CANCEL )),
+ aBtHelp( this, SW_RES( BT_HELP )),
+
+ aFlBottom( this, SW_RES( FL_BOTTOM )),
+
+ aDBData(rData),
+
+ aOldNumFmtLnk( aLbDbFmtFromUsr.GetSelectHdl() ),
+ sNoTmpl( SW_RES( STR_NOTEMPL )),
+ pView( &rView ),
+ pTAutoFmt( 0 ),
+ pTblSet( 0 ),
+ pRep( 0 )
+{
+ FreeResource();
+
+ nGBFmtLen = aFlFormat.GetText().Len();
+
+ if(xColSupp.is())
+ {
+ SwWrtShell& rSh = pView->GetWrtShell();
+ Locale aDocLocale( SvxCreateLocale( rSh.GetCurLang() ));
+ SvNumberFormatter* pNumFmtr = rSh.GetNumberFormatter();
+ SvNumberFormatsSupplierObj* pNumFmt = new SvNumberFormatsSupplierObj( pNumFmtr );
+ Reference< util::XNumberFormatsSupplier > xDocNumFmtsSupplier = pNumFmt;
+ Reference< util::XNumberFormats > xDocNumberFormats = xDocNumFmtsSupplier->getNumberFormats();
+ Reference< util::XNumberFormatTypes > xDocNumberFormatTypes(xDocNumberFormats, UNO_QUERY);
+
+ Reference<XPropertySet> xSourceProps(xDataSource, UNO_QUERY);
+ Reference< util::XNumberFormats > xNumberFormats;
+ if(xSourceProps.is())
+ {
+ Any aFormats = xSourceProps->getPropertyValue(C2U("NumberFormatsSupplier"));
+ if(aFormats.hasValue())
+ {
+ Reference< util::XNumberFormatsSupplier> xSuppl;
+ aFormats >>= xSuppl;
+ if(xSuppl.is())
+ {
+ xNumberFormats = xSuppl->getNumberFormats( );
+ }
+ }
+ }
+ Reference <XNameAccess> xCols = xColSupp->getColumns();
+ Sequence<rtl::OUString> aColNames = xCols->getElementNames();
+ const rtl::OUString* pColNames = aColNames.getConstArray();
+ long nCount = aColNames.getLength();
+ for (long n = 0; n < nCount; n++)
+ {
+ SwInsDBColumn* pNew = new SwInsDBColumn( pColNames[n], (USHORT)n );
+ Any aCol = xCols->getByName(pColNames[n]);
+ Reference <XPropertySet> xCol;
+ aCol >>= xCol;
+ Any aType = xCol->getPropertyValue(C2S("Type"));
+ sal_Int32 eDataType = 0;
+ aType >>= eDataType;
+ switch(eDataType)
+ {
+ case DataType::BIT:
+ case DataType::BOOLEAN:
+ case DataType::TINYINT:
+ case DataType::SMALLINT:
+ case DataType::INTEGER:
+ case DataType::BIGINT:
+ case DataType::FLOAT:
+ case DataType::REAL:
+ case DataType::DOUBLE:
+ case DataType::NUMERIC:
+ case DataType::DECIMAL:
+ case DataType::DATE:
+ case DataType::TIME:
+ case DataType::TIMESTAMP:
+ {
+ pNew->bHasFmt = TRUE;
+ Any aFormat = xCol->getPropertyValue(C2U("FormatKey"));
+ if(aFormat.hasValue())
+ {
+ sal_Int32 nFmt = 0;
+ aFormat >>= nFmt;
+ if(xNumberFormats.is())
+ {
+ try
+ {
+ Reference<XPropertySet> xNumProps = xNumberFormats->getByKey( nFmt );
+ Any aFormatVal = xNumProps->getPropertyValue(C2U("FormatString"));
+ Any aLocale = xNumProps->getPropertyValue(C2U("Locale"));
+ rtl::OUString sFormat;
+ aFormatVal >>= sFormat;
+ lang::Locale aLoc;
+ aLocale >>= aLoc;
+ long nKey = xDocNumberFormats->queryKey( sFormat, aLoc, sal_True);
+ if(nKey < 0)
+ {
+ nKey = xDocNumberFormats->addNew( sFormat, aLoc );
+ }
+ pNew->nDBNumFmt = nKey;
+ }
+ catch(const Exception& )
+ {
+ DBG_ERROR("illegal number format key");
+ }
+ }
+ }
+ else
+ {
+ pNew->nDBNumFmt = SwNewDBMgr::GetDbtoolsClient().getDefaultNumberFormat(xCol,
+ xDocNumberFormatTypes, aDocLocale);
+ }
+
+ }
+ break;
+ }
+ if( !aDBColumns.Insert( pNew ))
+ {
+ ASSERT( !this, "Spaltenname mehrfach vergeben?" );
+ delete pNew;
+ }
+ }
+ }
+
+ // Absatzvorlagen-ListBox fuellen
+ {
+ SfxStyleSheetBasePool* pPool = pView->GetDocShell()->GetStyleSheetPool();
+ pPool->SetSearchMask( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL );
+ aLbDbParaColl.InsertEntry( sNoTmpl );
+
+ const SfxStyleSheetBase* pBase = pPool->First();
+ while( pBase )
+ {
+ aLbDbParaColl.InsertEntry( pBase->GetName() );
+ pBase = pPool->Next();
+ }
+ aLbDbParaColl.SelectEntryPos( 0 );
+ }
+
+ // steht der Cursor in einer Tabelle, darf NIE Tabelle auswaehlbar sein
+ if( pView->GetWrtShell().GetTableFmt() )
+ {
+ aRbAsTable.Enable( FALSE );
+ aRbAsField.Check( TRUE );
+ aRbDbFmtFromDb.Check( TRUE );
+ }
+ else
+ {
+ aRbAsTable.Check( TRUE );
+ aRbDbFmtFromDb.Check( TRUE );
+ aIbDbcolOneFrom.Enable( FALSE );
+ aIbDbcolAllFrom.Enable( FALSE );
+ }
+
+ aRbAsTable.SetClickHdl( LINK(this, SwInsertDBColAutoPilot, PageHdl ));
+ aRbAsField.SetClickHdl( LINK(this, SwInsertDBColAutoPilot, PageHdl ));
+ aRbAsText.SetClickHdl( LINK(this, SwInsertDBColAutoPilot, PageHdl ));
+
+ aRbDbFmtFromDb.SetClickHdl( LINK(this, SwInsertDBColAutoPilot, DBFormatHdl ));
+ aRbDbFmtFromUsr.SetClickHdl( LINK(this, SwInsertDBColAutoPilot, DBFormatHdl ));
+
+ aPbTblFormat.SetClickHdl(LINK(this, SwInsertDBColAutoPilot, TblFmtHdl ));
+ aPbTblAutofmt.SetClickHdl(LINK(this, SwInsertDBColAutoPilot, AutoFmtHdl ));
+
+ aIbDbcolAllTo.SetClickHdl( LINK(this, SwInsertDBColAutoPilot, TblToFromHdl ));
+ aIbDbcolOneTo.SetClickHdl( LINK(this, SwInsertDBColAutoPilot, TblToFromHdl ));
+ aIbDbcolOneFrom.SetClickHdl( LINK(this, SwInsertDBColAutoPilot, TblToFromHdl ));
+ aIbDbcolAllFrom.SetClickHdl( LINK(this, SwInsertDBColAutoPilot, TblToFromHdl ));
+ aIbDbcolToEdit.SetClickHdl( LINK(this, SwInsertDBColAutoPilot, TblToFromHdl ));
+
+ aCbTableHeadon.SetClickHdl( LINK(this, SwInsertDBColAutoPilot, HeaderHdl ));
+ aRbHeadlColnms.SetClickHdl( LINK(this, SwInsertDBColAutoPilot, HeaderHdl ));
+ aRbHeadlEmpty.SetClickHdl( LINK(this, SwInsertDBColAutoPilot, HeaderHdl ));
+
+ aLbTxtDbColumn.SetSelectHdl( LINK( this, SwInsertDBColAutoPilot, SelectHdl ));
+ aLbTblDbColumn.SetSelectHdl( LINK( this, SwInsertDBColAutoPilot, SelectHdl ));
+ aLbDbFmtFromUsr.SetSelectHdl( LINK( this, SwInsertDBColAutoPilot, SelectHdl ));
+ aLbTableCol.SetSelectHdl( LINK( this, SwInsertDBColAutoPilot, SelectHdl ));
+
+ aLbTxtDbColumn.SetDoubleClickHdl( LINK( this, SwInsertDBColAutoPilot, DblClickHdl ));
+ aLbTblDbColumn.SetDoubleClickHdl( LINK( this, SwInsertDBColAutoPilot, DblClickHdl ));
+ aLbTableCol.SetDoubleClickHdl( LINK( this, SwInsertDBColAutoPilot, DblClickHdl ));
+
+ for( USHORT n = 0; n < aDBColumns.Count(); ++n )
+ {
+ const String& rS = aDBColumns[ n ]->sColumn;
+ aLbTblDbColumn.InsertEntry( rS, n );
+ aLbTxtDbColumn.InsertEntry( rS, n );
+ }
+ aLbTxtDbColumn.SelectEntryPos( 0 );
+ aLbTblDbColumn.SelectEntryPos( 0 );
+
+ // read configuration
+ Load();
+
+ // Controls initialisieren:
+ PageHdl( aRbAsTable.IsChecked() ? &aRbAsTable : &aRbAsField );
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwInsertDBColAutoPilot::~SwInsertDBColAutoPilot()
+{
+ delete pTblSet;
+ delete pRep;
+
+// delete pConfig;
+ delete pTAutoFmt;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SwInsertDBColAutoPilot, PageHdl, Button*, pButton )
+{
+ BOOL bShowTbl = pButton == &aRbAsTable;
+
+ String sTxt( pButton->GetText() );
+ aFlHead.SetText( MnemonicGenerator::EraseAllMnemonicChars( sTxt ) );
+
+ aLbTxtDbColumn.Show( !bShowTbl );
+ aIbDbcolToEdit.Show( !bShowTbl );
+ aEdDbText.Show( !bShowTbl );
+ aFtDbParaColl.Show( !bShowTbl );
+ aLbDbParaColl.Show( !bShowTbl );
+
+ aLbTblDbColumn.Show( bShowTbl );
+ aIbDbcolAllTo.Show( bShowTbl );
+ aIbDbcolOneTo.Show( bShowTbl );
+ aIbDbcolOneFrom.Show( bShowTbl );
+ aIbDbcolAllFrom.Show( bShowTbl );
+ aFtTableCol.Show( bShowTbl );
+ aLbTableCol.Show( bShowTbl );
+ aCbTableHeadon.Show( bShowTbl );
+ aRbHeadlColnms.Show( bShowTbl );
+ aRbHeadlEmpty.Show( bShowTbl );
+ aPbTblFormat.Show( bShowTbl );
+ aPbTblAutofmt.Show( bShowTbl );
+
+ if( bShowTbl )
+ aPbTblFormat.Enable( 0 != aLbTableCol.GetEntryCount() );
+
+ SelectHdl( bShowTbl ? &aLbTblDbColumn : &aLbTxtDbColumn );
+
+ return 0;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SwInsertDBColAutoPilot, DBFormatHdl, Button*, pButton )
+{
+ USHORT nFndPos;
+ ListBox& rBox = aRbAsTable.IsChecked()
+ ? ( 0 == aLbTableCol.GetEntryData( 0 )
+ ? aLbTblDbColumn
+ : aLbTableCol )
+ : aLbTxtDbColumn;
+
+ SwInsDBColumn aSrch( rBox.GetSelectEntry(), 0 );
+ aDBColumns.Seek_Entry( &aSrch, &nFndPos );
+
+ BOOL bFromDB = &aRbDbFmtFromDb == pButton;
+ aDBColumns[ nFndPos ]->bIsDBFmt = bFromDB;
+ aLbDbFmtFromUsr.Enable( !bFromDB );
+
+ return 0;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SwInsertDBColAutoPilot, TblToFromHdl, Button*, pButton )
+{
+ BOOL bChgEnable = TRUE, bEnableTo = TRUE, bEnableFrom = TRUE;
+ aLbTblDbColumn.SetUpdateMode( FALSE );
+ aLbTableCol.SetUpdateMode( FALSE );
+
+ if( pButton == &aIbDbcolAllTo )
+ {
+ bEnableTo = FALSE;
+
+ USHORT n, nInsPos = aLbTableCol.GetSelectEntryPos(),
+ nCnt = aLbTblDbColumn.GetEntryCount();
+ if( LISTBOX_APPEND == nInsPos )
+ for( n = 0; n < nCnt; ++n )
+ aLbTableCol.InsertEntry( aLbTblDbColumn.GetEntry( n ),
+ LISTBOX_APPEND );
+ else
+ for( n = 0; n < nCnt; ++n, ++nInsPos )
+ aLbTableCol.InsertEntry( aLbTblDbColumn.GetEntry( n ), nInsPos );
+ aLbTblDbColumn.Clear();
+ aLbTableCol.SelectEntryPos( nInsPos );
+ aLbTblDbColumn.SelectEntryPos( LISTBOX_APPEND );
+ }
+ else if( pButton == &aIbDbcolOneTo &&
+ LISTBOX_ENTRY_NOTFOUND != aLbTblDbColumn.GetSelectEntryPos() )
+ {
+ USHORT nInsPos = aLbTableCol.GetSelectEntryPos(),
+ nDelPos = aLbTblDbColumn.GetSelectEntryPos(),
+ nTopPos = aLbTblDbColumn.GetTopEntry();
+ aLbTableCol.InsertEntry( aLbTblDbColumn.GetEntry( nDelPos ), nInsPos );
+ aLbTblDbColumn.RemoveEntry( nDelPos );
+
+ aLbTableCol.SelectEntryPos( nInsPos );
+ if( nDelPos >= aLbTblDbColumn.GetEntryCount() )
+ nDelPos = aLbTblDbColumn.GetEntryCount() - 1;
+ aLbTblDbColumn.SelectEntryPos( nDelPos );
+ aLbTblDbColumn.SetTopEntry( nTopPos );
+
+ bEnableTo = 0 != aLbTblDbColumn.GetEntryCount();
+ }
+ else if( pButton == &aIbDbcolOneFrom )
+ {
+ if( LISTBOX_ENTRY_NOTFOUND != aLbTableCol.GetSelectEntryPos() )
+ {
+ USHORT nFndPos, nInsPos,
+ nDelPos = aLbTableCol.GetSelectEntryPos(),
+ nTopPos = aLbTableCol.GetTopEntry();
+
+ // die richtige InsertPos suchen!!
+ SwInsDBColumn aSrch( aLbTableCol.GetEntry( nDelPos ), 0 );
+ aDBColumns.Seek_Entry( &aSrch, &nFndPos );
+ if( !nFndPos || nFndPos == aDBColumns.Count()-1 )
+ nInsPos = nFndPos;
+ else
+ {
+ nInsPos = LISTBOX_ENTRY_NOTFOUND;
+ while( ++nFndPos < aDBColumns.Count() &&
+ LISTBOX_ENTRY_NOTFOUND == (nInsPos = aLbTblDbColumn.
+ GetEntryPos( String(aDBColumns[ nFndPos ]->sColumn ))) )
+ ;
+ }
+
+ aLbTblDbColumn.InsertEntry( aSrch.sColumn, nInsPos );
+ aLbTableCol.RemoveEntry( nDelPos );
+
+ if( nInsPos >= aLbTblDbColumn.GetEntryCount() )
+ nInsPos = aLbTblDbColumn.GetEntryCount() - 1;
+ aLbTblDbColumn.SelectEntryPos( nInsPos );
+
+ if( nDelPos >= aLbTableCol.GetEntryCount() )
+ nDelPos = aLbTableCol.GetEntryCount() - 1;
+ aLbTableCol.SelectEntryPos( nDelPos );
+ aLbTableCol.SetTopEntry( nTopPos );
+ }
+ else
+ bEnableTo = 0 != aLbTblDbColumn.GetEntryCount();
+
+ bEnableFrom = 0 != aLbTableCol.GetEntryCount();
+ }
+ else if( pButton == &aIbDbcolAllFrom )
+ {
+ bEnableFrom = FALSE;
+
+ aLbTblDbColumn.Clear();
+ aLbTableCol.Clear();
+ for( USHORT n = 0; n < aDBColumns.Count(); ++n )
+ aLbTblDbColumn.InsertEntry( aDBColumns[ n ]->sColumn, n );
+ aLbTblDbColumn.SelectEntryPos( 0 );
+ }
+ else if( pButton == &aIbDbcolToEdit )
+ {
+ bChgEnable = FALSE;
+ // Daten ins Edit moven:
+ String aFld( aLbTxtDbColumn.GetSelectEntry() );
+ if( aFld.Len() )
+ {
+ String aStr( aEdDbText.GetText() );
+ USHORT nPos = (USHORT)aEdDbText.GetSelection().Min();
+ USHORT nSel = USHORT(aEdDbText.GetSelection().Max()) - nPos;
+ if( nSel )
+ // dann loesche erstmal die bestehende Selektion
+ aStr.Erase( nPos, nSel );
+
+ aFld.Insert( cDBFldStart, 0 );
+ aFld += cDBFldEnd;
+ if( aStr.Len() )
+ {
+ if( nPos ) // ein Space davor
+ {
+ sal_Unicode c = aStr.GetChar( nPos-1 );
+ if( '\n' != c && '\r' != c )
+ aFld.Insert( ' ', 0 );
+ }
+ if( nPos < aStr.Len() ) // ein Space dahinter
+ {
+ sal_Unicode c = aStr.GetChar( nPos );
+ if( '\n' != c && '\r' != c )
+ aFld += ' ';
+ }
+ }
+
+ aStr.Insert( aFld, nPos );
+ aEdDbText.SetText( aStr );
+ nPos = nPos + aFld.Len();
+ aEdDbText.SetSelection( Selection( nPos ));
+ }
+ }
+
+ if( bChgEnable )
+ {
+ aIbDbcolOneTo.Enable( bEnableTo );
+ aIbDbcolAllTo.Enable( bEnableTo );
+ aIbDbcolOneFrom.Enable( bEnableFrom );
+ aIbDbcolAllFrom.Enable( bEnableFrom );
+
+ aRbDbFmtFromDb.Enable( FALSE );
+ aRbDbFmtFromUsr.Enable( FALSE );
+ aLbDbFmtFromUsr.Enable( FALSE );
+
+ aPbTblFormat.Enable( bEnableFrom );
+ }
+ aLbTblDbColumn.SetUpdateMode( TRUE );
+ aLbTableCol.SetUpdateMode( TRUE );
+
+ return 0;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SwInsertDBColAutoPilot, DblClickHdl, ListBox*, pBox )
+{
+ Button* pButton = 0;
+ if( pBox == &aLbTxtDbColumn )
+ pButton = &aIbDbcolToEdit;
+ else if( pBox == &aLbTblDbColumn && aIbDbcolOneTo.IsEnabled() )
+ pButton = &aIbDbcolOneTo;
+ else if( pBox == &aLbTableCol && aIbDbcolOneFrom.IsEnabled() )
+ pButton = &aIbDbcolOneFrom;
+
+ if( pButton )
+ TblToFromHdl( pButton );
+
+ return 0;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SwInsertDBColAutoPilot, TblFmtHdl, PushButton*, pButton )
+{
+ SwWrtShell& rSh = pView->GetWrtShell();
+ BOOL bNewSet = FALSE;
+ if( !pTblSet )
+ {
+ bNewSet = TRUE;
+ pTblSet = new SfxItemSet( rSh.GetAttrPool(), SwuiGetUITableAttrRange() );
+
+ //Ersteinmal die einfachen Attribute besorgen.
+ pTblSet->Put( SfxStringItem( FN_PARAM_TABLE_NAME, rSh.GetUniqueTblName() ));
+ pTblSet->Put( SfxUInt16Item( FN_PARAM_TABLE_HEADLINE, 1 ) );
+
+ pTblSet->Put( SfxUInt16Item( SID_BACKGRND_DESTINATION,
+ rSh.GetViewOptions()->GetTblDest() ));
+
+ SvxBrushItem aBrush( RES_BACKGROUND );
+ pTblSet->Put( aBrush );
+ pTblSet->Put( aBrush, SID_ATTR_BRUSH_ROW );
+ pTblSet->Put( aBrush, SID_ATTR_BRUSH_TABLE );
+
+ SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+ // Tabellenvariante, wenn mehrere Tabellenzellen selektiert
+ aBoxInfo.SetTable( TRUE );
+ // Abstandsfeld immer anzeigen
+ aBoxInfo.SetDist( TRUE);
+ // Minimalgroesse in Tabellen und Absaetzen setzen
+ aBoxInfo.SetMinDist( FALSE );
+ // Default-Abstand immer setzen
+ aBoxInfo.SetDefDist( MIN_BORDER_DIST );
+ // Einzelne Linien koennen nur in Tabellen DontCare-Status haben
+ aBoxInfo.SetValid( VALID_DISABLE, TRUE );
+ pTblSet->Put( aBoxInfo );
+
+ SwGetCurColNumPara aPara;
+ const USHORT nNum = rSh.GetCurColNum( &aPara );
+ long nWidth;
+
+ if( nNum )
+ {
+ nWidth = aPara.pPrtRect->Width();
+ const SwFmtCol& rCol = aPara.pFrmFmt->GetCol();
+ const SwColumns& rCols = rCol.GetColumns();
+
+ //nStart und nEnd initialisieren fuer nNum == 0
+ long nWidth1 = 0,
+ nStart1 = 0,
+ nEnd1 = nWidth;
+ for( USHORT i = 0; i < nNum; ++i )
+ {
+ SwColumn* pCol = rCols[i];
+ nStart1 = pCol->GetLeft() + nWidth1;
+ nWidth1 += (long)rCol.CalcColWidth( i, (USHORT)nWidth );
+ nEnd1 = nWidth1 - pCol->GetRight();
+ }
+ if(nStart1 || nEnd1 != nWidth)
+ nWidth = nEnd1 - nStart1;
+ }
+ else
+ nWidth = rSh.GetAnyCurRect(
+ FRMTYPE_FLY_ANY & rSh.GetFrmType( 0, TRUE )
+ ? RECT_FLY_PRT_EMBEDDED
+ : RECT_PAGE_PRT ).Width();
+
+ SwTabCols aTabCols;
+ aTabCols.SetRight( nWidth );
+ aTabCols.SetRightMax( nWidth );
+ pRep = new SwTableRep( aTabCols, FALSE );
+ pRep->SetAlign( text::HoriOrientation::NONE );
+ pRep->SetSpace( nWidth );
+ pRep->SetWidth( nWidth );
+ pRep->SetWidthPercent( 100 );
+ pTblSet->Put( SwPtrItem( FN_TABLE_REP, pRep ));
+
+ pTblSet->Put( SfxUInt16Item( SID_HTML_MODE,
+ ::GetHtmlMode( pView->GetDocShell() )));
+ }
+
+ if( aLbTableCol.GetEntryCount() != pRep->GetAllColCount() )
+ {
+ // Anzahl der Spalten hat sich geaendert: dann muessen die
+ // TabCols angepasst werden
+ long nWidth = pRep->GetWidth();
+ USHORT nCols = aLbTableCol.GetEntryCount() - 1;
+ SwTabCols aTabCols( nCols );
+ aTabCols.SetRight( nWidth );
+ aTabCols.SetRightMax( nWidth );
+ if( nCols )
+ for( USHORT n = 0, nStep = (USHORT)(nWidth / (nCols+1)), nW = nStep;
+ n < nCols; ++n, nW = nW + nStep )
+ {
+ aTabCols.Insert( nW, FALSE, n );
+ }
+ delete pRep;
+ pRep = new SwTableRep( aTabCols, FALSE );
+ pRep->SetAlign( text::HoriOrientation::NONE );
+ pRep->SetSpace( nWidth );
+ pRep->SetWidth( nWidth );
+ pRep->SetWidthPercent( 100 );
+ pTblSet->Put( SwPtrItem( FN_TABLE_REP, pRep ));
+ }
+
+ SwAbstractDialogFactory* pFact = swui::GetFactory();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ SfxAbstractTabDialog* pDlg = pFact->CreateSwTableTabDlg( pButton, rSh.GetAttrPool(),pTblSet, &rSh, DLG_FORMAT_TABLE );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if( RET_OK == pDlg->Execute() )
+ pTblSet->Put( *pDlg->GetOutputItemSet() );
+ else if( bNewSet )
+ {
+ delete pTblSet, pTblSet = 0;
+ delete pRep, pRep = 0;
+ }
+ delete pDlg;
+
+ return 0;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SwInsertDBColAutoPilot, AutoFmtHdl, PushButton*, pButton )
+{
+ SwAbstractDialogFactory* pFact = swui::GetFactory();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton, pView->GetWrtShellPtr(),DLG_AUTOFMT_TABLE, FALSE, pTAutoFmt);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if( RET_OK == pDlg->Execute())
+ pDlg->FillAutoFmtOfIndex( pTAutoFmt );
+ delete pDlg;
+ return 0;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SwInsertDBColAutoPilot, SelectHdl, ListBox*, pBox )
+{
+ ListBox* pGetBox = pBox == &aLbDbFmtFromUsr
+ ? ( aRbAsTable.IsChecked()
+ ? ( 0 == aLbTableCol.GetEntryData( 0 )
+ ? &aLbTblDbColumn
+ : &aLbTableCol )
+ : &aLbTxtDbColumn )
+ : pBox;
+
+ USHORT nFndPos;
+ SwInsDBColumn aSrch( pGetBox->GetSelectEntry(), 0 );
+ aDBColumns.Seek_Entry( &aSrch, &nFndPos );
+
+ if( pBox == &aLbDbFmtFromUsr )
+ {
+ if( aSrch.sColumn.getLength() )
+ {
+ aOldNumFmtLnk.Call( pBox );
+ aDBColumns[ nFndPos ]->nUsrNumFmt = aLbDbFmtFromUsr.GetFormat();
+ }
+ }
+ else
+ {
+ // an der FormatGroupBox den ausgewaehlten FeldNamen setzen, damit
+ // klar ist, welches Feld ueber das Format eingestellt wird!
+ String sTxt( aFlFormat.GetText().Copy( 0, nGBFmtLen ));
+ if( !aSrch.sColumn.getLength() )
+ {
+ aRbDbFmtFromDb.Enable( FALSE );
+ aRbDbFmtFromUsr.Enable( FALSE );
+ aLbDbFmtFromUsr.Enable( FALSE );
+ }
+ else
+ {
+ BOOL bEnableFmt = aDBColumns[ nFndPos ]->bHasFmt;
+ aRbDbFmtFromDb.Enable( bEnableFmt );
+ aRbDbFmtFromUsr.Enable( bEnableFmt );
+
+ if( bEnableFmt )
+ {
+ (( sTxt += C2S(" (" )) += String(aSrch.sColumn) ) += (sal_Unicode)')';
+ }
+
+ BOOL bIsDBFmt = aDBColumns[ nFndPos ]->bIsDBFmt;
+ aRbDbFmtFromDb.Check( bIsDBFmt );
+ aRbDbFmtFromUsr.Check( !bIsDBFmt );
+ aLbDbFmtFromUsr.Enable( !bIsDBFmt );
+ if( !bIsDBFmt )
+ aLbDbFmtFromUsr.SetDefFormat( aDBColumns[ nFndPos ]->nUsrNumFmt );
+ }
+
+ aFlFormat.SetText( sTxt );
+
+ // um spaeter zu wissen, welche ListBox die "aktive" war, wird sich
+ // im 1. Eintrag ein Flag gemerkt,
+ void* pPtr = pBox == &aLbTableCol ? &aLbTableCol : 0;
+ aLbTableCol.SetEntryData( 0, pPtr );
+ }
+ return 0;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SwInsertDBColAutoPilot, HeaderHdl, Button*, pButton )
+{
+ if( pButton == &aCbTableHeadon )
+ {
+ BOOL bEnable = aCbTableHeadon.IsChecked();
+
+ aRbHeadlColnms.Enable( bEnable );
+ aRbHeadlEmpty.Enable( bEnable );
+ }
+ return 0;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+static void lcl_InsTextInArr( const String& rTxt, _DB_Columns& rColArr )
+{
+ _DB_Column* pNew;
+ USHORT nSttPos = 0, nFndPos;
+ while( STRING_NOTFOUND != ( nFndPos = rTxt.Search( '\x0A', nSttPos )) )
+ {
+ if( 1 < nFndPos )
+ {
+ pNew = new _DB_Column( rTxt.Copy( nSttPos, nFndPos -1 ) );
+ rColArr.Insert( pNew, rColArr.Count() );
+ }
+ pNew = new _DB_Column;
+ rColArr.Insert( pNew, rColArr.Count() );
+ nSttPos = nFndPos + 1;
+ }
+ if( nSttPos < rTxt.Len() )
+ {
+ pNew = new _DB_Column( rTxt.Copy( nSttPos ) );
+ rColArr.Insert( pNew, rColArr.Count() );
+ }
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwInsertDBColAutoPilot::SplitTextToColArr( const String& rTxt,
+ _DB_Columns& rColArr,
+ BOOL bInsField )
+{
+ // aus dem Text wieder die einzelnen Datenbank - Spalten erzeugen
+ // und dann in einem Array speichern
+ // Die Datenbankspalten stehen in <> und muessen im Array der Spalten
+ // vorhanden sein:
+ String sTxt( rTxt );
+ USHORT nFndPos, nEndPos, nSttPos = 0;
+
+ while( STRING_NOTFOUND != ( nFndPos = sTxt.Search( cDBFldStart, nSttPos )))
+ {
+ nSttPos = nFndPos + 1;
+ if( STRING_NOTFOUND != ( nEndPos = sTxt.Search( cDBFldEnd, nSttPos+1 )))
+ {
+ // Text in <> geklammert gefunden: was ist es denn:
+ SwInsDBColumn aSrch( sTxt.Copy( nSttPos, nEndPos - nSttPos ), 0);
+ if( aDBColumns.Seek_Entry( &aSrch, &nFndPos ) )
+ {
+ // das ist ein gueltiges Feld
+ // also sicher den Text "davor":
+ const SwInsDBColumn& rFndCol = *aDBColumns[ nFndPos ];
+
+ _DB_Column* pNew;
+
+ if( 1 < nSttPos )
+ {
+ ::lcl_InsTextInArr( sTxt.Copy( 0, nSttPos-1 ), rColArr );
+ sTxt.Erase( 0, nSttPos-1 );
+ }
+
+ sTxt.Erase( 0, (xub_StrLen)(rFndCol.sColumn.getLength() + 2) );
+ nSttPos = 0;
+
+ USHORT nSubType = 0;
+ ULONG nFormat;
+ if( rFndCol.bHasFmt )
+ {
+ if( rFndCol.bIsDBFmt )
+ nFormat = rFndCol.nDBNumFmt;
+ else
+ {
+ nFormat = rFndCol.nUsrNumFmt;
+ nSubType = nsSwExtendedSubType::SUB_OWN_FMT;
+ }
+ }
+ else
+ nFormat = 0;
+
+ if( bInsField )
+ {
+ SwWrtShell& rSh = pView->GetWrtShell();
+ SwDBFieldType aFldType( rSh.GetDoc(), aSrch.sColumn,
+ aDBData );
+ pNew = new _DB_Column( rFndCol, *new SwDBField(
+ (SwDBFieldType*)rSh.InsertFldType( aFldType ),
+ nFormat ) );
+ if( nSubType )
+ pNew->DB_ColumnData.pField->SetSubType( nSubType );
+ }
+ else
+ pNew = new _DB_Column( rFndCol, nFormat );
+
+ rColArr.Insert( pNew, rColArr.Count() );
+ }
+ }
+ }
+
+ // den letzten Text nicht vergessen
+ if( sTxt.Len() )
+ ::lcl_InsTextInArr( sTxt, rColArr );
+
+ return 0 != rColArr.Count();
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection,
+ Reference< XDataSource> xSource,
+ Reference< XConnection> xConnection,
+ Reference< sdbc::XResultSet > xResultSet )
+{
+ const Any* pSelection = rSelection.getLength() ? rSelection.getConstArray() : 0;
+ SwWrtShell& rSh = pView->GetWrtShell();
+
+ //with the drag and drop interface no result set is initially available
+ BOOL bDisposeResultSet = FALSE;
+ // we don't have a cursor, so we have to create our own RowSet
+ if ( !xResultSet.is() )
+ {
+ xResultSet = SwNewDBMgr::createCursor(aDBData.sDataSource,aDBData.sCommand,aDBData.nCommandType,xConnection);
+ bDisposeResultSet = xResultSet.is();
+ }
+
+ Reference< sdbc::XRow > xRow(xResultSet, UNO_QUERY);
+ if ( !xRow.is() )
+ return;
+
+ rSh.StartAllAction();
+ BOOL bUndo = rSh.DoesUndo();
+ if( bUndo )
+ rSh.StartUndo( UNDO_EMPTY );
+
+ BOOL bAsTable = aRbAsTable.IsChecked();
+ SvNumberFormatter& rNumFmtr = *rSh.GetNumberFormatter();
+
+ if( rSh.HasSelection() )
+ rSh.DelRight();
+
+ ::std::auto_ptr<SwWait> pWait;
+
+ Reference< XColumnsSupplier > xColsSupp( xResultSet, UNO_QUERY );
+ Reference <XNameAccess> xCols = xColsSupp->getColumns();
+
+ do{ // middle checked loop!!
+ if( bAsTable ) // Daten als Tabelle einfuegen
+ {
+ rSh.DoUndo( FALSE );
+
+ USHORT n, nRows = 0, nCols = aLbTableCol.GetEntryCount();
+ if( aCbTableHeadon.IsChecked() )
+ nRows++;
+
+ if( pSelection )
+ nRows = nRows + (USHORT)rSelection.getLength();
+ else
+ ++nRows;
+
+ // bereite das Array fuer die ausgewaehlten Spalten auf
+ SwInsDBColumns_SAR aColFlds( 255 >= nCols ? (BYTE)nCols : 255, 5 );
+ for( n = 0; n < nCols; ++n )
+ {
+ USHORT nFndPos;
+ SwInsDBColumn aSrch( aLbTableCol.GetEntry( n ), 0 );
+ if( aDBColumns.Seek_Entry( &aSrch, &nFndPos ) )
+ aColFlds.Insert( aDBColumns[ nFndPos ], n );
+ else {
+ ASSERT( !this, "Datenbankspalte nicht mehr gefunden" );
+ }
+ }
+
+ if( nCols != aColFlds.Count() )
+ {
+ ASSERT( !this, "nicht alle Datenbankspalten gefunden" );
+ nCols = aColFlds.Count();
+ }
+
+ if(!nRows || !nCols)
+ {
+ ASSERT( !this, "wrong parameters" );
+ break;
+ }
+
+ const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+
+ BOOL bHTML = 0 != (::GetHtmlMode( pView->GetDocShell() ) & HTMLMODE_ON);
+ rSh.InsertTable(
+ pModOpt->GetInsTblFlags(bHTML),
+ nRows, nCols, text::HoriOrientation::FULL, (pSelection ? pTAutoFmt : 0) );
+ rSh.MoveTable( GetfnTablePrev(), GetfnTableStart() );
+
+ if( pSelection && pTblSet )
+ SetTabSet();
+
+ SfxItemSet aTblSet( rSh.GetAttrPool(), RES_BOXATR_FORMAT,
+ RES_BOXATR_VALUE );
+ BOOL bIsAutoUpdateCells = rSh.IsAutoUpdateCells();
+ rSh.SetAutoUpdateCells( FALSE );
+
+
+ if( aCbTableHeadon.IsChecked() )
+ {
+ for( n = 0; n < nCols; ++n )
+ {
+ if( aRbHeadlColnms.IsChecked() )
+ {
+ rSh.SwEditShell::Insert2( aColFlds[ n ]->sColumn );
+ }
+ rSh.GoNextCell();
+ }
+ }
+ else
+ rSh.SetRowsToRepeat( 0 );
+
+ for( sal_Int32 i = 0 ; ; ++i )
+ {
+ BOOL bBreak = FALSE;
+ try
+ {
+ if(pSelection)
+ {
+ sal_Int32 nPos = 0;
+ pSelection[i] >>= nPos;
+ bBreak = !xResultSet->absolute(nPos);
+ }
+ else if(!i)
+ bBreak = !xResultSet->first();
+ }
+ catch(const Exception& )
+ {
+ bBreak = TRUE;
+ }
+ if(bBreak)
+ break;
+
+ for( n = 0; n < nCols; ++n )
+ {
+ // beim aller erstenmal KEIN GoNextCell, weil wir schon
+ // drin stehen. Auch nicht nach dem Insert das GoNextCell,
+ // weil am Ende eine leere Zeile einfuegt wird.
+ if( i || n )
+ rSh.GoNextCell();
+
+ const SwInsDBColumn* pEntry = aColFlds[ n ];
+
+ Reference< XColumn > xColumn;
+ xCols->getByName(pEntry->sColumn) >>= xColumn;
+ Reference< XPropertySet > xColumnProps( xColumn, UNO_QUERY );
+ sal_Int32 eDataType = 0;
+ if( xColumnProps.is() )
+ {
+ Any aType = xColumnProps->getPropertyValue(C2U("Type"));
+ aType >>= eDataType;
+ }
+ try
+ {
+ if( pEntry->bHasFmt )
+ {
+ SwTblBoxNumFormat aNumFmt(
+ pEntry->bIsDBFmt ? pEntry->nDBNumFmt
+ : pEntry->nUsrNumFmt );
+ aTblSet.Put(aNumFmt);
+ if( xColumn.is() )
+ {
+ double fVal = xColumn->getDouble();
+ if( xColumn->wasNull() )
+ aTblSet.ClearItem( RES_BOXATR_VALUE );
+ else
+ {
+ if(rNumFmtr.GetType(aNumFmt.GetValue()) & NUMBERFORMAT_DATE)
+ {
+ ::Date aStandard(1,1,1900);
+ if (*rNumFmtr.GetNullDate() != aStandard)
+ fVal += (aStandard - *rNumFmtr.GetNullDate());
+ }
+ aTblSet.Put( SwTblBoxValue( fVal ));
+ }
+ }
+ else
+ aTblSet.ClearItem( RES_BOXATR_VALUE );
+ rSh.SetTblBoxFormulaAttrs( aTblSet );
+ }
+ //#i60207# don't insert binary data as string - creates a loop
+ else if( DataType::BINARY == eDataType ||
+ DataType::VARBINARY == eDataType ||
+ DataType::LONGVARBINARY== eDataType ||
+ DataType::SQLNULL == eDataType ||
+ DataType::OTHER == eDataType ||
+ DataType::OBJECT == eDataType ||
+ DataType::DISTINCT == eDataType ||
+ DataType::STRUCT == eDataType ||
+ DataType::ARRAY == eDataType ||
+ DataType::BLOB == eDataType ||
+ DataType::CLOB == eDataType ||
+ DataType::REF == eDataType
+ )
+ {
+ // do nothing
+ }
+ else
+ {
+ rtl::OUString sVal = xColumn->getString();
+ if(!xColumn->wasNull())
+ {
+ rSh.SwEditShell::Insert2( sVal );
+ }
+ }
+ }
+ catch(Exception&
+#ifdef DBG_UTIL
+ aExcept
+#endif
+ )
+ {
+ DBG_ERROR(ByteString(String(aExcept.Message), gsl_getSystemTextEncoding()).GetBuffer());
+ }
+ }
+
+ if( !pSelection )
+ {
+ if ( !xResultSet->next() )
+ break;
+ }
+ else if( i+1 >= rSelection.getLength() )
+ break;
+
+ if( 10 == i )
+ pWait = ::std::auto_ptr<SwWait>(new SwWait( *pView->GetDocShell(), TRUE ));
+ }
+
+ rSh.MoveTable( GetfnTableCurr(), GetfnTableStart() );
+ if( !pSelection && ( pTblSet || pTAutoFmt ))
+ {
+ if( pTblSet )
+ SetTabSet();
+
+ if( pTAutoFmt )
+ rSh.SetTableAutoFmt( *pTAutoFmt );
+ }
+ rSh.SetAutoUpdateCells( bIsAutoUpdateCells );
+ }
+ else // Daten als Felder/Text einfuegen
+ {
+ _DB_Columns aColArr;
+ if( SplitTextToColArr( aEdDbText.GetText(), aColArr, aRbAsField.IsChecked() ) )
+ {
+ // jetzt kann bei jedem Datensatz einfach ueber das Array iteriert
+ // und die Daten eingefuegt werden
+
+ if( !rSh.IsSttPara() )
+ rSh.SwEditShell::SplitNode();
+ if( !rSh.IsEndPara() )
+ {
+ rSh.SwEditShell::SplitNode();
+ rSh.SwCrsrShell::Left(1,CRSR_SKIP_CHARS);
+ }
+
+ rSh.DoUndo( FALSE );
+
+ SwTxtFmtColl* pColl = 0;
+ {
+ String sTmplNm( aLbDbParaColl.GetSelectEntry() );
+ if( sNoTmpl != sTmplNm )
+ {
+ pColl = rSh.FindTxtFmtCollByName( sTmplNm );
+ if( !pColl )
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName( sTmplNm, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if( USHRT_MAX != nId )
+ pColl = rSh.GetTxtCollFromPool( nId );
+ else
+ pColl = rSh.MakeTxtFmtColl( sTmplNm );
+ }
+ rSh.SetTxtFmtColl( pColl );
+ }
+ }
+
+ // fuers Einfuegen als Felder -> nach jedem Datensatz ein
+ // "NextField" einfuegen
+ SwDBFormatData aDBFormatData;
+ Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ if( xMgr.is() )
+ {
+ Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.util.NumberFormatter" ));
+ aDBFormatData.xFormatter = Reference<util::XNumberFormatter>(xInstance, UNO_QUERY) ;
+ }
+
+ Reference<XPropertySet> xSourceProps(xSource, UNO_QUERY);
+ if(xSourceProps.is())
+ {
+ Any aFormats = xSourceProps->getPropertyValue(C2U("NumberFormatsSupplier"));
+ if(aFormats.hasValue())
+ {
+ Reference< util::XNumberFormatsSupplier> xSuppl;
+ aFormats >>= xSuppl;
+ if(xSuppl.is())
+ {
+ Reference< XPropertySet > xSettings = xSuppl->getNumberFormatSettings();
+ Any aNull = xSettings->getPropertyValue(C2U("NullDate"));
+ aNull >>= aDBFormatData.aNullDate;
+ if(aDBFormatData.xFormatter.is())
+ aDBFormatData.xFormatter->attachNumberFormatsSupplier(xSuppl);
+ }
+ }
+ }
+ aDBFormatData.aLocale = SvxCreateLocale( rSh.GetCurLang() );
+ SwDBNextSetField aNxtDBFld( (SwDBNextSetFieldType*)rSh.
+ GetFldType( 0, RES_DBNEXTSETFLD ),
+ C2S("1"), aEmptyStr, aDBData );
+
+
+ BOOL bSetCrsr = TRUE;
+ USHORT n = 0, nCols = aColArr.Count();
+ ::sw::mark::IMark* pMark = NULL;
+ for( sal_Int32 i = 0 ; ; ++i )
+ {
+ BOOL bBreak = FALSE;
+ try
+ {
+ if(pSelection)
+ {
+ sal_Int32 nPos = 0;
+ pSelection[i] >>= nPos;
+ bBreak = !xResultSet->absolute(nPos);
+ }
+ else if(!i)
+ bBreak = !xResultSet->first();
+ }
+ catch(Exception&)
+ {
+ bBreak = TRUE;
+ }
+
+ if(bBreak)
+ break;
+
+
+ for( n = 0; n < nCols; ++n )
+ {
+ _DB_Column* pDBCol = aColArr[ n ];
+ String sIns;
+ switch( pDBCol->eColType )
+ {
+ case _DB_Column::DB_FILLTEXT:
+ sIns = *pDBCol->DB_ColumnData.pText;
+ break;
+
+ case _DB_Column::DB_SPLITPARA:
+ rSh.SplitNode();
+ // wenn nicht die gleiche Vorlage die Follow Vorlage
+ // ist, dann muss die ausgewaehlte neu gesetzt werden
+ if( pColl && &pColl->GetNextTxtFmtColl() != pColl )
+ rSh.SetTxtFmtColl( pColl );
+ break;
+
+ case _DB_Column::DB_COL_FIELD:
+ {
+ SwDBField *const pFld = static_cast<SwDBField *>(
+ pDBCol->DB_ColumnData.pField->CopyField());
+ double nValue = DBL_MAX;
+
+ Reference< XPropertySet > xColumnProps;
+ xCols->getByName(pDBCol->pColInfo->sColumn) >>= xColumnProps;
+
+ pFld->SetExpansion( SwNewDBMgr::GetDBField(
+ xColumnProps,
+ aDBFormatData,
+ &nValue ) );
+ if( DBL_MAX != nValue )
+ {
+ Any aType = xColumnProps->getPropertyValue(C2U("Type"));
+ sal_Int32 eDataType = 0;
+ aType >>= eDataType;
+ if( DataType::DATE == eDataType || DataType::TIME == eDataType ||
+ DataType::TIMESTAMP == eDataType)
+
+ {
+ ::Date aStandard(1,1,1900);
+ ::Date aCompare(aDBFormatData.aNullDate.Day ,
+ aDBFormatData.aNullDate.Month,
+ aDBFormatData.aNullDate.Year);
+ if(aStandard != aCompare)
+ nValue += (aStandard - aCompare);
+ }
+ pFld->ChgValue( nValue, TRUE );
+ }
+ pFld->SetInitialized();
+
+ rSh.Insert( *pFld );
+ delete pFld;
+ }
+ break;
+
+ case _DB_Column::DB_COL_TEXT:
+ {
+ double nValue = DBL_MAX;
+ Reference< XPropertySet > xColumnProps;
+ xCols->getByName(pDBCol->pColInfo->sColumn) >>= xColumnProps;
+ sIns = SwNewDBMgr::GetDBField(
+ xColumnProps,
+ aDBFormatData,
+ &nValue );
+ if( pDBCol->DB_ColumnData.nFormat &&
+ DBL_MAX != nValue )
+ {
+ Color* pCol;
+ if(rNumFmtr.GetType(pDBCol->DB_ColumnData.nFormat) & NUMBERFORMAT_DATE)
+ {
+ ::Date aStandard(1,1,1900);
+ if (*rNumFmtr.GetNullDate() != aStandard)
+ nValue += (aStandard - *rNumFmtr.GetNullDate());
+ }
+ rNumFmtr.GetOutputString( nValue,
+ pDBCol->DB_ColumnData.nFormat,
+ sIns, &pCol );
+ }
+ }
+ break;
+ }
+
+ if( sIns.Len() )
+ rSh.Insert( sIns );
+
+ if( bSetCrsr && sIns.Len() )
+ {
+ // zum Anfang und eine Mark setzen, damit der
+ // Cursor am Ende wieder auf Anfangsposition
+ // gesetzt werden kann.
+
+ // rSh.SwCrsrShell::MovePara( fnParaCurr, fnParaStart );
+ rSh.SwCrsrShell::MovePara(
+ GetfnParaCurr(), GetfnParaStart() );
+ pMark = rSh.SetBookmark(
+ KeyCode(),
+ ::rtl::OUString(),
+ ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK );
+ // rSh.SwCrsrShell::MovePara( fnParaCurr, fnParaEnd );
+ rSh.SwCrsrShell::MovePara(
+ GetfnParaCurr(), GetfnParaEnd() );
+ bSetCrsr = FALSE;
+ }
+ }
+
+ if( !pSelection )
+ {
+ BOOL bNext = xResultSet->next();
+ if(!bNext)
+ break;
+ }
+ else if( i+1 >= rSelection.getLength() )
+ break;
+
+ if( aRbAsField.IsChecked() )
+ rSh.Insert( aNxtDBFld );
+
+ if( !rSh.IsSttPara() )
+ rSh.SwEditShell::SplitNode();
+
+ if( 10 == i )
+ pWait = ::std::auto_ptr<SwWait>(new SwWait( *pView->GetDocShell(), TRUE ));
+ }
+
+ if( !bSetCrsr && pMark != NULL)
+ {
+ rSh.SetMark();
+ rSh.GotoMark( pMark );
+ rSh.getIDocumentMarkAccess()->deleteMark( pMark );
+ break;
+ }
+ }
+ }
+ // write configuration
+ Commit();
+ }while( FALSE ); // middle checked loop
+
+ if( bUndo )
+ {
+ rSh.DoUndo( TRUE );
+ rSh.AppendUndoForInsertFromDB( bAsTable );
+ rSh.EndUndo( UNDO_EMPTY );
+ }
+ rSh.ClearMark();
+ rSh.EndAllAction();
+
+ if ( bDisposeResultSet )
+ ::comphelper::disposeComponent(xResultSet);
+}
+void SwInsertDBColAutoPilot::SetTabSet()
+{
+ SwWrtShell& rSh = pView->GetWrtShell();
+ const SfxPoolItem* pItem;
+
+ if( pTAutoFmt )
+ {
+ if( pTAutoFmt->IsFrame() )
+ {
+ // Umrandung kommt vom AutoFormat
+ pTblSet->ClearItem( RES_BOX );
+ pTblSet->ClearItem( SID_ATTR_BORDER_INNER );
+ }
+ if( pTAutoFmt->IsBackground() )
+ {
+ pTblSet->ClearItem( RES_BACKGROUND );
+ pTblSet->ClearItem( SID_ATTR_BRUSH_ROW );
+ pTblSet->ClearItem( SID_ATTR_BRUSH_TABLE );
+ }
+ }
+ else
+ {
+ // die Defaults wieder entfernen, es macht keinen Sinn sie zu setzen
+ SvxBrushItem aBrush( RES_BACKGROUND );
+ static USHORT __READONLY_DATA aIds[3] =
+ { RES_BACKGROUND, SID_ATTR_BRUSH_ROW, SID_ATTR_BRUSH_TABLE };
+ for( int i = 0; i < 3; ++i )
+ if( SFX_ITEM_SET == pTblSet->GetItemState( aIds[ i ],
+ FALSE, &pItem ) && *pItem == aBrush )
+ pTblSet->ClearItem( aIds[ i ] );
+ }
+
+ if( SFX_ITEM_SET == pTblSet->GetItemState( FN_PARAM_TABLE_NAME, FALSE,
+ &pItem ) && ((const SfxStringItem*)pItem)->GetValue() ==
+ rSh.GetTableFmt()->GetName() )
+ pTblSet->ClearItem( FN_PARAM_TABLE_NAME );
+
+ rSh.MoveTable( GetfnTableCurr(), GetfnTableStart() );
+ rSh.SetMark();
+ rSh.MoveTable( GetfnTableCurr(), GetfnTableEnd() );
+
+ ItemSetToTableParam( *pTblSet, rSh );
+
+ rSh.ClearMark();
+ rSh.MoveTable( GetfnTableCurr(), GetfnTableStart() );
+}
+
+/* */
+
+
+_DB_ColumnConfigData::~_DB_ColumnConfigData() {}
+
+/* -----------------------------05.12.00 16:15--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static Sequence<rtl::OUString> lcl_createSourceNames(const String& rNodeName)
+{
+ Sequence<rtl::OUString> aSourceNames(11);
+ rtl::OUString* pNames = aSourceNames.getArray();
+
+ String sTmp( rNodeName );
+ const xub_StrLen nPos = sTmp.Len();
+ pNames[0] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/DataSource" ));
+ pNames[1] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/Command" ));
+ pNames[2] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/CommandType" ));
+ pNames[3] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/ColumnsToText" ));
+ pNames[4] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/ColumnsToTable" ));
+ pNames[5] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/ParaStyle" ));
+ pNames[6] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/TableAutoFormat" ));
+ pNames[7] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/IsTable" ));
+ pNames[8] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/IsField" ));
+ pNames[9] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/IsHeadlineOn" ));
+ pNames[10] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/IsEmptyHeadline" ));
+ return aSourceNames;
+}
+/* -----------------------------05.12.00 16:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static Sequence<rtl::OUString> lcl_CreateSubNames( const String& rSubNodeName )
+{
+ Sequence<rtl::OUString> aSubSourceNames(6);
+ rtl::OUString* pNames = aSubSourceNames.getArray();
+ String sTmp( rSubNodeName );
+ const xub_StrLen nPos = sTmp.Len();
+ pNames[0] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/ColumnName" ));
+ pNames[1] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/ColumnIndex" ));
+ pNames[2] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/IsNumberFormat" ));
+ pNames[3] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/IsNumberFormatFromDataBase" ));
+ pNames[4] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/NumberFormat" ));
+ pNames[5] = sTmp.ReplaceAscii( nPos, STRING_MAXLEN,
+ RTL_CONSTASCII_STRINGPARAM( "/NumberFormatLocale" ));
+ return aSubSourceNames;
+}
+/* -----------------------------06.12.00 13:03--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static rtl::OUString lcl_CreateUniqueName(const Sequence<rtl::OUString>& aNames)
+{
+ sal_Int32 nIdx = aNames.getLength();
+ const rtl::OUString* pNames = aNames.getConstArray();
+ rtl::OUString sTest(C2U("_"));
+ rtl::OUString sRet;
+ while(sal_True)
+ {
+ sRet = sTest; sRet += rtl::OUString::valueOf(nIdx++);
+ sal_Bool bFound = sal_False;
+ for(sal_Int32 i = 0; i < aNames.getLength(); i++)
+ {
+ if(pNames[i] == sRet)
+ {
+ bFound = sal_True;
+ break;
+ }
+ }
+ if(!bFound)
+ break;
+ }
+ return sRet;
+}
+/* -----------------------------05.12.00 15:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwInsertDBColAutoPilot::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+void SwInsertDBColAutoPilot::Commit()
+{
+ Sequence <rtl::OUString> aNames = GetNodeNames(rtl::OUString());
+ const rtl::OUString* pNames = aNames.getArray();
+ //remove entries that contain this data source + table at first
+ for(sal_Int32 nNode = 0; nNode < aNames.getLength(); nNode++)
+ {
+ Sequence<rtl::OUString> aSourceNames(2);
+ rtl::OUString* pSourceNames = aSourceNames.getArray();
+ pSourceNames[0] = pNames[nNode];
+ pSourceNames[0] += C2U("/DataSource");
+ pSourceNames[1] = pNames[nNode];
+ pSourceNames[1] += C2U("/Command");
+ Sequence<Any> aSourceProperties = GetProperties(aSourceNames);
+ const Any* pSourceProps = aSourceProperties.getArray();
+ rtl::OUString sSource, sCommand;
+ pSourceProps[0] >>= sSource;
+ pSourceProps[1] >>= sCommand;
+ if(sSource.equals(aDBData.sDataSource) && sCommand.equals(aDBData.sCommand))
+ {
+ Sequence<rtl::OUString> aElements(1);
+ aElements.getArray()[0] = pNames[nNode];
+ ClearNodeElements(rtl::OUString(), aElements);
+ }
+ }
+
+ aNames = GetNodeNames(rtl::OUString());
+ rtl::OUString sNewNode = lcl_CreateUniqueName(aNames);
+ Sequence<rtl::OUString> aNodeNames = lcl_createSourceNames(sNewNode);
+ Sequence<PropertyValue> aValues(aNodeNames.getLength());
+ PropertyValue* pValues = aValues.getArray();
+ const rtl::OUString* pNodeNames = aNodeNames.getConstArray();
+ rtl::OUString sSlash(C2U("/"));
+ for(sal_Int32 i = 0; i < aNodeNames.getLength(); i++)
+ {
+ pValues[i].Name = sSlash;
+ pValues[i].Name += pNodeNames[i];
+ }
+
+ pValues[0].Value <<= rtl::OUString(aDBData.sDataSource);
+ pValues[1].Value <<= rtl::OUString(aDBData.sCommand);
+ pValues[2].Value <<= aDBData.nCommandType;
+ pValues[3].Value <<= rtl::OUString(aEdDbText.GetText());
+
+ String sTmp;
+ for( USHORT n = 0, nCnt = aLbTableCol.GetEntryCount(); n < nCnt; ++n )
+ ( sTmp += aLbTableCol.GetEntry( n ) ) += '\x0a';
+
+ if( sTmp.Len() )
+ pValues[4].Value <<= rtl::OUString(sTmp);
+
+ if( sNoTmpl != (sTmp = aLbDbParaColl.GetSelectEntry()) )
+ pValues[5].Value <<= rtl::OUString(sTmp);
+
+ if( pTAutoFmt )
+ pValues[6].Value <<= rtl::OUString(pTAutoFmt->GetName());
+
+ const Type& rBoolType = ::getBooleanCppuType();
+ sal_Bool bTmp = aRbAsTable.IsChecked();
+ pValues[7].Value.setValue(&bTmp, rBoolType);
+
+ bTmp = aRbAsField.IsChecked();
+ pValues[8].Value.setValue(&bTmp, rBoolType);
+
+ bTmp = aCbTableHeadon.IsChecked();
+ pValues[9].Value.setValue(&bTmp, rBoolType);
+
+ bTmp = aRbHeadlEmpty.IsChecked();
+ pValues[10].Value.setValue(&bTmp, rBoolType);
+
+ SetSetProperties(rtl::OUString(), aValues);
+
+ sNewNode += C2U("/ColumnSet");
+ String sDelim( String::CreateFromAscii( "/__" ));
+
+ LanguageType ePrevLang = (LanguageType)-1;
+ rtl::OUString sPrevLang;
+
+ SvNumberFormatter& rNFmtr = *pView->GetWrtShell().GetNumberFormatter();
+ for(USHORT nCol = 0; nCol < aDBColumns.Count(); nCol++)
+ {
+ rtl::OUString sColumnNode = sNewNode;
+ SwInsDBColumn* pColumn = aDBColumns[nCol];
+ String sColumnInsertNode(sColumnNode);
+ sColumnInsertNode += sDelim;
+ if( nCol < 100 )
+ sColumnInsertNode += '0';
+ if( nCol < 10 )
+ sColumnInsertNode += '0';
+ sColumnInsertNode += String::CreateFromInt32( nCol );
+
+ Sequence <rtl::OUString> aSubNodeNames = lcl_CreateSubNames(sColumnInsertNode);
+ Sequence<PropertyValue> aSubValues(aSubNodeNames.getLength());
+ PropertyValue* pSubValues = aSubValues.getArray();
+ const rtl::OUString* pSubNodeNames = aSubNodeNames.getConstArray();
+ sal_Int32 i;
+
+ for( i = 0; i < aSubNodeNames.getLength(); i++)
+ pSubValues[i].Name = pSubNodeNames[i];
+ pSubValues[0].Value <<= pColumn->sColumn;
+ pSubValues[1].Value <<= i;
+
+ sal_Bool bVal = pColumn->bHasFmt;
+ pSubValues[2].Value.setValue(&bVal, rBoolType);
+ bVal = pColumn->bIsDBFmt;
+ pSubValues[3].Value.setValue(&bVal, rBoolType);
+
+ SwStyleNameMapper::FillUIName( RES_POOLCOLL_STANDARD, sTmp );
+ const SvNumberformat* pNF = rNFmtr.GetEntry( pColumn->nUsrNumFmt );
+ LanguageType eLang;
+ if( pNF )
+ {
+ pSubValues[4].Value <<= rtl::OUString(pNF->GetFormatstring());
+ eLang = pNF->GetLanguage();
+ }
+ else
+ {
+ pSubValues[4].Value <<= rtl::OUString(sTmp);
+ eLang = (LanguageType)GetAppLanguage();
+ }
+
+ if( eLang != ePrevLang )
+ {
+ Locale aLocale;
+ aLocale = SvxLanguageToLocale( aLocale, eLang );
+ (( sPrevLang = aLocale.Country ) += rtl::OUString( '-' )) += aLocale.Language;
+ ePrevLang = eLang;
+ }
+
+ pSubValues[5].Value <<= sPrevLang;
+ SetSetProperties(sColumnNode, aSubValues);
+ }
+}
+/* -----------------------------05.12.00 15:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwInsertDBColAutoPilot::Load()
+{
+ Sequence <rtl::OUString> aNames = GetNodeNames(rtl::OUString());
+ const rtl::OUString* pNames = aNames.getArray();
+ SvNumberFormatter& rNFmtr = *pView->GetWrtShell().GetNumberFormatter();
+ for(sal_Int32 nNode = 0; nNode < aNames.getLength(); nNode++)
+ {
+ //search for entries with the appropriate data source and table
+ Sequence<rtl::OUString> aSourceNames = lcl_createSourceNames(pNames[nNode]);
+
+ Sequence< Any> aDataSourceProps = GetProperties(aSourceNames);
+ const Any* pDataSourceProps = aDataSourceProps.getConstArray();
+ rtl::OUString sSource, sCommand;
+ sal_Int16 nCommandType;
+ pDataSourceProps[0] >>= sSource;
+ pDataSourceProps[1] >>= sCommand;
+ pDataSourceProps[2] >>= nCommandType;
+ if(sSource.equals(aDBData.sDataSource) && sCommand.equals(aDBData.sCommand))
+ {
+ _DB_ColumnConfigData* pNewData = new _DB_ColumnConfigData;
+ pNewData->sSource = sSource;
+ pNewData->sTable = sCommand;
+
+ pDataSourceProps[3] >>= pNewData->sEdit;
+ pDataSourceProps[4] >>= pNewData->sTblList;
+ pDataSourceProps[5] >>= pNewData->sTmplNm;
+ pDataSourceProps[6] >>= pNewData->sTAutoFmtNm;
+ if(pDataSourceProps[7].hasValue())
+ pNewData->bIsTable = *(sal_Bool*)pDataSourceProps[7].getValue();
+ if(pDataSourceProps[8].hasValue())
+ pNewData->bIsField = *(sal_Bool*)pDataSourceProps[8].getValue();
+ if(pDataSourceProps[9].hasValue())
+ pNewData->bIsHeadlineOn = *(sal_Bool*)pDataSourceProps[9].getValue();
+ if(pDataSourceProps[10].hasValue())
+ pNewData->bIsEmptyHeadln = *(sal_Bool*)pDataSourceProps[10].getValue();
+
+ rtl::OUString sSubNodeName(pNames[nNode]);
+ sSubNodeName += C2U("/ColumnSet/");
+ Sequence <rtl::OUString> aSubNames = GetNodeNames(sSubNodeName);
+ const rtl::OUString* pSubNames = aSubNames.getConstArray();
+ for(sal_Int32 nSub = 0; nSub < aSubNames.getLength(); nSub++)
+ {
+ rtl::OUString sSubSubNodeName(sSubNodeName);
+ sSubSubNodeName += pSubNames[nSub];
+ Sequence <rtl::OUString> aSubNodeNames = lcl_CreateSubNames(sSubSubNodeName);
+ Sequence< Any> aSubProps = GetProperties(aSubNodeNames);
+ const Any* pSubProps = aSubProps.getConstArray();
+
+ rtl::OUString sColumn;
+ pSubProps[0] >>= sColumn;
+ //check for existance of the loaded column name
+ sal_Bool bFound = sal_False;
+ for(sal_Int32 nRealColumn = 0; nRealColumn < aDBColumns.Count(); nRealColumn++)
+ {
+ if(aDBColumns[(USHORT)nRealColumn]->sColumn == sColumn)
+ {
+ bFound = sal_True;
+ break;
+ }
+ }
+ if(!bFound)
+ continue;
+ sal_Int16 nIndex = 0;
+ pSubProps[1] >>= nIndex;
+ SwInsDBColumnPtr pInsDBColumn = new SwInsDBColumn(sColumn, nIndex);
+ if(pSubProps[2].hasValue())
+ pInsDBColumn->bHasFmt = *(sal_Bool*)pSubProps[2].getValue();
+ if(pSubProps[3].hasValue())
+ pInsDBColumn->bIsDBFmt = *(sal_Bool*)pSubProps[3].getValue();
+
+ pSubProps[4] >>= pInsDBColumn->sUsrNumFmt;
+ rtl::OUString sNumberFormatLocale;
+ pSubProps[5] >>= sNumberFormatLocale;
+
+ Locale aLocale;
+ aLocale.Language = sNumberFormatLocale.copy(0, 2);
+ aLocale.Country = sNumberFormatLocale.copy(3, 2);
+ pInsDBColumn->eUsrNumFmtLng = SvxLocaleToLanguage( aLocale );
+
+ pInsDBColumn->nUsrNumFmt = rNFmtr.GetEntryKey( pInsDBColumn->sUsrNumFmt,
+ pInsDBColumn->eUsrNumFmtLng );
+
+// pInsDBColumn->nDBNumFmt
+
+ pNewData->aDBColumns.Insert(pInsDBColumn);
+ }
+ USHORT n = 0;
+ String sTmp( pNewData->sTblList );
+ if( sTmp.Len() )
+ {
+ do {
+ String sEntry( sTmp.GetToken( 0, '\x0a', n ) );
+ //preselect column - if they still exist!
+ if(aLbTblDbColumn.GetEntryPos(sEntry) != LISTBOX_ENTRY_NOTFOUND)
+ {
+ aLbTableCol.InsertEntry( sEntry );
+ aLbTblDbColumn.RemoveEntry( sEntry );
+ }
+ } while( n < sTmp.Len() );
+
+ if( !aLbTblDbColumn.GetEntryCount() )
+ {
+ aIbDbcolAllTo.Enable( FALSE );
+ aIbDbcolOneTo.Enable( FALSE );
+ }
+ aIbDbcolOneFrom.Enable( TRUE );
+ aIbDbcolAllFrom.Enable( TRUE );
+ }
+ aEdDbText.SetText( pNewData->sEdit );
+
+ sTmp = pNewData->sTmplNm;
+ if( sTmp.Len() )
+ aLbDbParaColl.SelectEntry( sTmp );
+ else
+ aLbDbParaColl.SelectEntryPos( 0 );
+
+ if( pTAutoFmt )
+ delete pTAutoFmt, pTAutoFmt = 0;
+ sTmp = pNewData->sTAutoFmtNm;
+ if( sTmp.Len() )
+ {
+ // dann erstmal die AutoFmt-Datei laden und das Autoformat suchen
+ SwTableAutoFmtTbl aAutoFmtTbl;
+ aAutoFmtTbl.Load();
+ for( USHORT nAutoFmt = aAutoFmtTbl.Count(); nAutoFmt; )
+ if( sTmp == aAutoFmtTbl[ --nAutoFmt ]->GetName() )
+ {
+ pTAutoFmt = new SwTableAutoFmt( *aAutoFmtTbl[ nAutoFmt ] );
+ break;
+ }
+ }
+
+ aRbAsTable.Check( pNewData->bIsTable );
+ aRbAsField.Check( pNewData->bIsField );
+ aRbAsText.Check( !pNewData->bIsTable && !pNewData->bIsField );
+
+ aCbTableHeadon.Check( pNewData->bIsHeadlineOn );
+ aRbHeadlColnms.Check( !pNewData->bIsEmptyHeadln );
+ aRbHeadlEmpty.Check( pNewData->bIsEmptyHeadln );
+ HeaderHdl(&aCbTableHeadon);
+
+ // jetzt noch die benutzerdefinierten Numberformat Strings in die
+ // Shell kopieren. Nur diese sind dann als ID verfuegbar
+ for( n = 0; n < aDBColumns.Count() ; ++n )
+ {
+ SwInsDBColumn& rSet = *aDBColumns[ n ];
+ for( USHORT m = 0; m < pNewData->aDBColumns.Count() ; ++m )
+ {
+ SwInsDBColumn& rGet = *pNewData->aDBColumns[ m ];
+ if(rGet.sColumn == rSet.sColumn)
+ {
+ if( rGet.bHasFmt && !rGet.bIsDBFmt )
+ {
+ rSet.bIsDBFmt = FALSE;
+ rSet.nUsrNumFmt = rNFmtr.GetEntryKey( rGet.sUsrNumFmt,
+ rGet.eUsrNumFmtLng );
+ if( NUMBERFORMAT_ENTRY_NOT_FOUND == rSet.nUsrNumFmt )
+ {
+ xub_StrLen nCheckPos;
+ short nType;
+ String sTmpFmt = rGet.sUsrNumFmt;
+ rNFmtr.PutEntry( sTmpFmt, nCheckPos, nType,
+ rSet.nUsrNumFmt, rGet.eUsrNumFmtLng );
+ rGet.sUsrNumFmt = sTmpFmt;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ // steht der Cursor in einer Tabelle, darf NIE Tabelle auswaehlbar sein
+ if( !aRbAsTable.IsEnabled() && aRbAsTable.IsChecked() )
+ aRbAsField.Check( TRUE );
+ delete pNewData;
+ break;
+ }
+ }
+}
+
diff --git a/sw/source/ui/dbui/dbinsdlg.hrc b/sw/source/ui/dbui/dbinsdlg.hrc
new file mode 100644
index 000000000000..fd2bdcf3d776
--- /dev/null
+++ b/sw/source/ui/dbui/dbinsdlg.hrc
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DBINSDLG_HRC
+#define _DBINSDLG_HRC
+
+
+#define FT_INSERT_DATA 1
+#define RB_AS_TABLE 2
+#define RB_AS_FIELD 3
+#define RB_AS_TEXT 4
+#define BT_OK 5
+#define BT_CANCEL 6
+#define BT_HELP 7
+#define FL_HEAD 8
+#define FT_DB_COLUMN 10
+#define FL_FORMAT 11
+#define RB_DBFMT_FROM_DB 12
+#define RB_DBFMT_FROM_USR 13
+#define LB_DBFMT_FROM_USR 14
+
+/* ------------- Page Text/Field ------------------ */
+#define LB_TXT_DB_COLUMN 15
+
+#define IB_DBCOL_TOEDIT 16
+#define ED_DB_TEXT 17
+#define FT_DB_PARA_COLL 18
+#define LB_DB_PARA_COLL 19
+
+/* ------------- Page Table -------------------- */
+#define LB_TBL_DB_COLUMN 20
+
+#define IB_DBCOL_ALL_TO 21
+#define IB_DBCOL_ONE_TO 22
+#define IB_DBCOL_ONE_FROM 23
+#define IB_DBCOL_ALL_FROM 24
+#define FT_TABLE_COL 25
+#define LB_TABLE_COL 26
+#define FL_BOTTOM 27
+#define CB_TABLE_HEADON 28
+#define RB_HEADL_COLNMS 29
+#define RB_HEADL_EMPTY 30
+#define PB_TBL_FORMAT 31
+#define PB_TBL_AUTOFMT 32
+
+#define STR_NOTEMPL 33
+
+
+#endif
diff --git a/sw/source/ui/dbui/dbinsdlg.src b/sw/source/ui/dbui/dbinsdlg.src
new file mode 100644
index 000000000000..fbbf6785527c
--- /dev/null
+++ b/sw/source/ui/dbui/dbinsdlg.src
@@ -0,0 +1,330 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "dbinsdlg.hrc"
+#include "dbui.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ModalDialog DLG_AP_INSERT_DB_SEL
+{
+ HelpID = HID_AP_INSERT_DB_SEL ;
+ OUTPUTSIZE = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 291 , 189 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ SVLOOK = TRUE ;
+ FixedText FT_INSERT_DATA
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 66 , 8 ) ;
+ Text [ en-US ] = "Insert data as:" ;
+ };
+ RadioButton RB_AS_TABLE
+ {
+ HelpID = "sw:RadioButton:DLG_AP_INSERT_DB_SEL:RB_AS_TABLE";
+ Pos = MAP_APPFONT ( 80 , 6 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ Text [ en-US ] = "T~able" ;
+ };
+ RadioButton RB_AS_FIELD
+ {
+ HelpID = "sw:RadioButton:DLG_AP_INSERT_DB_SEL:RB_AS_FIELD";
+ Pos = MAP_APPFONT ( 145 , 6 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Fields" ;
+ };
+ RadioButton RB_AS_TEXT
+ {
+ HelpID = "sw:RadioButton:DLG_AP_INSERT_DB_SEL:RB_AS_TEXT";
+ Pos = MAP_APPFONT ( 210 , 6 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Text" ;
+ };
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 123 , 172 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 179 , 172 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 235 , 172 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_HEAD
+ {
+ Pos = MAP_APPFONT ( 6 , 19 ) ;
+ Size = MAP_APPFONT ( 279 , 8 ) ;
+ /* wird dynamisch gesetzt! */
+ Text = "" ;
+ };
+ FixedText FT_DB_COLUMN
+ {
+ Pos = MAP_APPFONT ( 12 , 31 ) ;
+ Size = MAP_APPFONT ( 72 , 8 ) ;
+ Text [ en-US ] = "Database ~columns" ;
+ };
+ FixedLine FL_FORMAT
+ {
+ Pos = MAP_APPFONT ( 6 , 117 ) ;
+ Size = MAP_APPFONT ( 279 , 8 ) ;
+ Text [ en-US ] = "For~mat" ;
+ };
+ RadioButton RB_DBFMT_FROM_DB
+ {
+ HelpID = "sw:RadioButton:DLG_AP_INSERT_DB_SEL:RB_DBFMT_FROM_DB";
+ Pos = MAP_APPFONT ( 15 , 128 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ Text [ en-US ] = "From ~database" ;
+ };
+ RadioButton RB_DBFMT_FROM_USR
+ {
+ HelpID = "sw:RadioButton:DLG_AP_INSERT_DB_SEL:RB_DBFMT_FROM_USR";
+ Pos = MAP_APPFONT ( 15 , 143 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ };
+ ListBox LB_DBFMT_FROM_USR
+ {
+ HelpID = "sw:ListBox:DLG_AP_INSERT_DB_SEL:LB_DBFMT_FROM_USR";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 30 , 142 ) ;
+ Size = MAP_APPFONT ( 75 , 44 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ /* -------------- Page Text / Fields -------------------------------- */
+ ListBox LB_TXT_DB_COLUMN
+ {
+ HelpID = "sw:ListBox:DLG_AP_INSERT_DB_SEL:LB_TXT_DB_COLUMN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 41 ) ;
+ Size = MAP_APPFONT ( 93 , 70 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ };
+ ImageButton IB_DBCOL_TOEDIT
+ {
+ HelpID = "sw:ImageButton:DLG_AP_INSERT_DB_SEL:IB_DBCOL_TOEDIT";
+ Pos = MAP_APPFONT ( 111 , 41 ) ;
+ Size = MAP_APPFONT ( 20 , 12 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "one_right.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ };
+ MultiLineEdit ED_DB_TEXT
+ {
+ HelpID = "sw:MultiLineEdit:DLG_AP_INSERT_DB_SEL:ED_DB_TEXT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 137 , 41 ) ;
+ Size = MAP_APPFONT ( 142 , 70 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ VScroll = TRUE ;
+ HScroll = TRUE ;
+ Hide = TRUE ;
+ IgnoreTab = TRUE;
+ };
+ FixedText FT_DB_PARA_COLL
+ {
+ Pos = MAP_APPFONT ( 118 , 129 ) ;
+ Size = MAP_APPFONT ( 58 , 8 ) ;
+ Text [ en-US ] = "Paragraph ~Style:" ;
+ Hide = TRUE ;
+ };
+ ListBox LB_DB_PARA_COLL
+ {
+ HelpID = "sw:ListBox:DLG_AP_INSERT_DB_SEL:LB_DB_PARA_COLL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 182 , 127 ) ;
+ Size = MAP_APPFONT ( 97 , 59 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ Sort = TRUE ;
+ };
+ /* -------------- Page Table ---------------------------------------- */
+ ListBox LB_TBL_DB_COLUMN
+ {
+ HelpID = "sw:ListBox:DLG_AP_INSERT_DB_SEL:LB_TBL_DB_COLUMN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 41 ) ;
+ Size = MAP_APPFONT ( 93 , 70 ) ;
+ TabStop = TRUE ;
+ };
+ ImageButton IB_DBCOL_ALL_TO
+ {
+ HelpID = "sw:ImageButton:DLG_AP_INSERT_DB_SEL:IB_DBCOL_ALL_TO";
+ Pos = MAP_APPFONT ( 111 , 41 ) ;
+ Size = MAP_APPFONT ( 20 , 12 ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "all_right.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ };
+ ImageButton IB_DBCOL_ONE_TO
+ {
+ HelpID = "sw:ImageButton:DLG_AP_INSERT_DB_SEL:IB_DBCOL_ONE_TO";
+ Pos = MAP_APPFONT ( 111 , 56 ) ;
+ Size = MAP_APPFONT ( 20 , 12 ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "one_right.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ };
+ ImageButton IB_DBCOL_ONE_FROM
+ {
+ HelpID = "sw:ImageButton:DLG_AP_INSERT_DB_SEL:IB_DBCOL_ONE_FROM";
+ Pos = MAP_APPFONT ( 111 , 84 ) ;
+ Size = MAP_APPFONT ( 20 , 12 ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "one_left.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ };
+ ImageButton IB_DBCOL_ALL_FROM
+ {
+ HelpID = "sw:ImageButton:DLG_AP_INSERT_DB_SEL:IB_DBCOL_ALL_FROM";
+ Pos = MAP_APPFONT ( 111 , 99 ) ;
+ Size = MAP_APPFONT ( 20 , 12 ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "all_left.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ };
+ FixedText FT_TABLE_COL
+ {
+ Pos = MAP_APPFONT ( 137 , 31 ) ;
+ Size = MAP_APPFONT ( 75 , 8 ) ;
+
+ Text [ en-US ] = "Tab~le column(s)" ;
+ };
+ ListBox LB_TABLE_COL
+ {
+ HelpID = "sw:ListBox:DLG_AP_INSERT_DB_SEL:LB_TABLE_COL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 137 , 41 ) ;
+ Size = MAP_APPFONT ( 75 , 70 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_BOTTOM
+ {
+ Pos = MAP_APPFONT ( 0 , 164 ) ;
+ Size = MAP_APPFONT ( 291, 8 ) ;
+ };
+ CheckBox CB_TABLE_HEADON
+ {
+ HelpID = "sw:CheckBox:DLG_AP_INSERT_DB_SEL:CB_TABLE_HEADON";
+ Pos = MAP_APPFONT ( 111 , 128 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ Text [ en-US ] = "Insert table heading";
+ };
+ RadioButton RB_HEADL_COLNMS
+ {
+ HelpID = "sw:RadioButton:DLG_AP_INSERT_DB_SEL:RB_HEADL_COLNMS";
+ Pos = MAP_APPFONT ( 120 , 142 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ Text [ en-US ] = "Apply column ~name";
+ };
+ RadioButton RB_HEADL_EMPTY
+ {
+ HelpID = "sw:RadioButton:DLG_AP_INSERT_DB_SEL:RB_HEADL_EMPTY";
+ Pos = MAP_APPFONT ( 120 , 155 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Create row only";
+ };
+ PushButton PB_TBL_FORMAT
+ {
+ HelpID = "sw:PushButton:DLG_AP_INSERT_DB_SEL:PB_TBL_FORMAT";
+ Pos = MAP_APPFONT ( 214 , 128 ) ;
+ Size = MAP_APPFONT ( 65 , 12 ) ;
+ Text [ en-US ] = "Pr~operties..." ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_TBL_AUTOFMT
+ {
+ HelpID = "sw:PushButton:DLG_AP_INSERT_DB_SEL:PB_TBL_AUTOFMT";
+ Pos = MAP_APPFONT ( 214 , 144 ) ;
+ Size = MAP_APPFONT ( 65 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Aut~oFormat..." ;
+ };
+ String STR_NOTEMPL
+ {
+ Text [ en-US ] = "<none>" ;
+ };
+ Text [ en-US ] = "Insert Database Columns" ;
+};
+
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
new file mode 100644
index 000000000000..c3119dc14876
--- /dev/null
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -0,0 +1,3109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <stdio.h>
+#include <unotxdoc.hxx>
+#include <com/sun/star/text/NotePrintMode.hpp>
+#include <sfx2/app.hxx>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/XDocumentDataSource.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/sdb/XCompletedConnection.hpp>
+#include <com/sun/star/sdb/XCompletedExecution.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/text/MailMergeEvent.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/uno/XNamingService.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <dbconfig.hxx>
+#include <swdbtoolsclient.hxx>
+#include <pagedesc.hxx>
+#include <vcl/lstbox.hxx>
+#include <unotools/tempfile.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svl/urihelper.hxx>
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
+#include <svl/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <vcl/oldprintadaptor.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/progress.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/mailenum.hxx>
+#include <cmdid.h>
+#include <swmodule.hxx>
+#include <view.hxx>
+#include <docsh.hxx>
+#include <edtwin.hxx>
+#include <wrtsh.hxx>
+#include <fldbas.hxx>
+#include <initui.hxx>
+#include <swundo.hxx>
+#include <flddat.hxx>
+#include <modcfg.hxx>
+#include <shellio.hxx>
+#include <dbui.hxx>
+#include <dbmgr.hxx>
+#include <doc.hxx>
+#include <swwait.hxx>
+#include <swunohelper.hxx>
+#include <dbui.hrc>
+#include <globals.hrc>
+#include <statstr.hrc>
+#include <mmconfigitem.hxx>
+#include <sfx2/request.hxx>
+#include <hintids.hxx>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/ResultSetType.hpp>
+#include <com/sun/star/mail/MailAttachment.hpp>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/types.hxx>
+#include <comphelper/property.hxx>
+#include <mailmergehelper.hxx>
+#include <maildispatcher.hxx>
+#include <svtools/htmlcfg.hxx>
+#include <i18npool/mslangid.hxx>
+#include <com/sun/star/util/XNumberFormatTypes.hpp>
+#include <editeng/langitem.hxx>
+#include <svl/numuno.hxx>
+
+#include <unomailmerge.hxx>
+#include <sfx2/event.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#include <vos/mutex.hxx>
+#include <rtl/textenc.h>
+#include <ndindex.hxx>
+#include <pam.hxx>
+#include <swcrsr.hxx>
+#include <swevent.hxx>
+#include <osl/file.hxx>
+#include <swabstdlg.hxx>
+#include <fmthdft.hxx>
+#include <dbui.hrc>
+#include <envelp.hrc>
+#include <memory>
+#include <vector>
+#include <unomid.h>
+#include <section.hxx>
+
+using namespace ::osl;
+using namespace ::svx;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::ui::dialogs;
+
+#define DB_SEP_SPACE 0
+#define DB_SEP_TAB 1
+#define DB_SEP_RETURN 2
+#define DB_SEP_NEWLINE 3
+
+SV_IMPL_PTRARR(SwDSParamArr, SwDSParamPtr);
+const sal_Char cCursor[] = "Cursor";
+const sal_Char cCommand[] = "Command";
+const sal_Char cCommandType[] = "CommandType";
+const sal_Char cDataSourceName[] = "DataSourceName";
+const sal_Char cSelection[] = "Selection";
+const sal_Char cActiveConnection[] = "ActiveConnection";
+
+// -----------------------------------------------------------------------------
+// Use nameless namespace to avoid to rubbish the global namespace
+// -----------------------------------------------------------------------------
+namespace
+{
+
+bool lcl_getCountFromResultSet( sal_Int32& rCount, const uno::Reference<XResultSet>& xResultSet )
+{
+ uno::Reference<XPropertySet> xPrSet(xResultSet, UNO_QUERY);
+ if(xPrSet.is())
+ {
+ try
+ {
+ sal_Bool bFinal = sal_False;
+ Any aFinal = xPrSet->getPropertyValue(C2U("IsRowCountFinal"));
+ aFinal >>= bFinal;
+ if(!bFinal)
+ {
+ xResultSet->last();
+ xResultSet->first();
+ }
+ Any aCount = xPrSet->getPropertyValue(C2U("RowCount"));
+ if( aCount >>= rCount )
+ return true;
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ return false;
+}
+// #122799# copy compatibility options
+void lcl_CopyCompatibilityOptions( SwWrtShell& rSourceShell, SwWrtShell& rTargetShell)
+{
+ IDocumentSettingAccess* pIDsa = rSourceShell.getIDocumentSettingAccess();
+
+ rTargetShell.SetParaSpaceMax( pIDsa->get(IDocumentSettingAccess::PARA_SPACE_MAX));
+ rTargetShell.SetParaSpaceMaxAtPages(pIDsa->get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES));
+ rTargetShell.SetTabCompat( pIDsa->get(IDocumentSettingAccess::TAB_COMPAT));
+ rTargetShell.SetAddExtLeading( pIDsa->get(IDocumentSettingAccess::ADD_EXT_LEADING));
+ rTargetShell.SetUseVirDev( pIDsa->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE));
+ rTargetShell.SetAddParaSpacingToTableCells( pIDsa->get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS));
+ rTargetShell.SetUseFormerLineSpacing( pIDsa->get(IDocumentSettingAccess::OLD_LINE_SPACING));
+ rTargetShell.SetUseFormerObjectPositioning( pIDsa->get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS));
+ rTargetShell.SetConsiderWrapOnObjPos( pIDsa->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION));
+ rTargetShell.SetUseFormerTextWrapping( pIDsa->get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING));
+}
+}
+/* -----------------09.12.2002 12:35-----------------
+ *
+ * --------------------------------------------------*/
+
+class SwConnectionDisposedListener_Impl : public cppu::WeakImplHelper1
+< lang::XEventListener >
+{
+ SwNewDBMgr& rDBMgr;
+
+ virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
+public:
+ SwConnectionDisposedListener_Impl(SwNewDBMgr& rMgr);
+ ~SwConnectionDisposedListener_Impl();
+
+};
+// -----------------------------------------------------------------------------
+struct SwNewDBMgr_Impl
+{
+ SwDSParam* pMergeData;
+ AbstractMailMergeDlg* pMergeDialog;
+ uno::Reference<lang::XEventListener> xDisposeListener;
+
+ SwNewDBMgr_Impl(SwNewDBMgr& rDBMgr)
+ :pMergeData(0)
+ ,pMergeDialog(0)
+ ,xDisposeListener(new SwConnectionDisposedListener_Impl(rDBMgr))
+ {}
+};
+/*-- 24.10.2003 15:54:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_InitNumberFormatter(SwDSParam& rParam, uno::Reference<XDataSource> xSource)
+{
+ uno::Reference<XMultiServiceFactory> xMgr = ::comphelper::getProcessServiceFactory();
+ if( xMgr.is() )
+ {
+ uno::Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.util.NumberFormatter" ));
+ rParam.xFormatter = uno::Reference<util::XNumberFormatter>(xInstance, UNO_QUERY) ;
+ }
+ if(!xSource.is())
+ xSource = SwNewDBMgr::getDataSourceAsParent(rParam.xConnection, rParam.sDataSource);
+
+ uno::Reference<XPropertySet> xSourceProps(xSource, UNO_QUERY);
+ if(xSourceProps.is())
+ {
+ Any aFormats = xSourceProps->getPropertyValue(C2U("NumberFormatsSupplier"));
+ if(aFormats.hasValue())
+ {
+ uno::Reference<XNumberFormatsSupplier> xSuppl;
+ aFormats >>= xSuppl;
+ if(xSuppl.is())
+ {
+ uno::Reference< XPropertySet > xSettings = xSuppl->getNumberFormatSettings();
+ Any aNull = xSettings->getPropertyValue(C2U("NullDate"));
+ aNull >>= rParam.aNullDate;
+ if(rParam.xFormatter.is())
+ rParam.xFormatter->attachNumberFormatsSupplier(xSuppl);
+ }
+ }
+ }
+}
+/* -----------------------------17.07.00 17:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL lcl_MoveAbsolute(SwDSParam* pParam, long nAbsPos)
+{
+ BOOL bRet = FALSE;
+ try
+ {
+ if(pParam->bScrollable)
+ {
+ bRet = pParam->xResultSet->absolute( nAbsPos );
+ }
+ else
+ {
+ DBG_ERROR("no absolute positioning available");
+ }
+ }
+ catch(Exception aExcept)
+ {
+ }
+ return bRet;
+}
+/* -----------------------------17.07.00 17:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL lcl_GetColumnCnt(SwDSParam* pParam,
+ const String& rColumnName, long nLanguage, String& rResult, double* pNumber)
+{
+ uno::Reference< XColumnsSupplier > xColsSupp( pParam->xResultSet, UNO_QUERY );
+ uno::Reference<XNameAccess> xCols;
+ try
+ {
+ xCols = xColsSupp->getColumns();
+ }
+ catch( lang::DisposedException& )
+ {
+ }
+ if(!xCols.is() || !xCols->hasByName(rColumnName))
+ return FALSE;
+ Any aCol = xCols->getByName(rColumnName);
+ uno::Reference< XPropertySet > xColumnProps;
+ aCol >>= xColumnProps;
+
+ SwDBFormatData aFormatData;
+ if(!pParam->xFormatter.is())
+ {
+ uno::Reference<XDataSource> xSource = SwNewDBMgr::getDataSourceAsParent(
+ pParam->xConnection,pParam->sDataSource);
+ lcl_InitNumberFormatter(*pParam, xSource );
+ }
+ aFormatData.aNullDate = pParam->aNullDate;
+ aFormatData.xFormatter = pParam->xFormatter;
+
+ MsLangId::convertLanguageToLocale( (LanguageType)nLanguage, aFormatData.aLocale );
+
+ rResult = SwNewDBMgr::GetDBField( xColumnProps, aFormatData, pNumber);
+ return TRUE;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Daten importieren
+ --------------------------------------------------------------------*/
+BOOL SwNewDBMgr::MergeNew(const SwMergeDescriptor& rMergeDesc )
+{
+ SetMergeType( rMergeDesc.nMergeType );
+
+ DBG_ASSERT(!bInMerge && !pImpl->pMergeData, "merge already activated!");
+
+ SwDBData aData;
+ aData.nCommandType = CommandType::TABLE;
+ uno::Reference<XResultSet> xResSet;
+ Sequence<Any> aSelection;
+ uno::Reference< XConnection> xConnection;
+
+ aData.sDataSource = rMergeDesc.rDescriptor.getDataSource();
+ rMergeDesc.rDescriptor[daCommand] >>= aData.sCommand;
+ rMergeDesc.rDescriptor[daCommandType] >>= aData.nCommandType;
+
+ if ( rMergeDesc.rDescriptor.has(daCursor) )
+ rMergeDesc.rDescriptor[daCursor] >>= xResSet;
+ if ( rMergeDesc.rDescriptor.has(daSelection) )
+ rMergeDesc.rDescriptor[daSelection] >>= aSelection;
+ if ( rMergeDesc.rDescriptor.has(daConnection) )
+ rMergeDesc.rDescriptor[daConnection] >>= xConnection;
+
+ if(!aData.sDataSource.getLength() || !aData.sCommand.getLength() || !xResSet.is())
+ {
+ return FALSE;
+ }
+
+ pImpl->pMergeData = new SwDSParam(aData, xResSet, aSelection);
+ SwDSParam* pTemp = FindDSData(aData, FALSE);
+ if(pTemp)
+ *pTemp = *pImpl->pMergeData;
+ else
+ {
+ //#94779# calls from the calculator may have added a connection with an invalid commandtype
+ //"real" data base connections added here have to re-use the already available
+ //DSData and set the correct CommandType
+ SwDBData aTempData(aData);
+ aData.nCommandType = -1;
+ pTemp = FindDSData(aData, FALSE);
+ if(pTemp)
+ *pTemp = *pImpl->pMergeData;
+ else
+ {
+ SwDSParam* pInsert = new SwDSParam(*pImpl->pMergeData);
+ aDataSourceParams.Insert(pInsert, aDataSourceParams.Count());
+ try
+ {
+ uno::Reference<XComponent> xComponent(pInsert->xConnection, UNO_QUERY);
+ if(xComponent.is())
+ xComponent->addEventListener(pImpl->xDisposeListener);
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ }
+ if(!pImpl->pMergeData->xConnection.is())
+ pImpl->pMergeData->xConnection = xConnection;
+ // add an XEventListener
+
+ try{
+ //set to start position
+ if(pImpl->pMergeData->aSelection.getLength())
+ {
+ sal_Int32 nPos = 0;
+ pImpl->pMergeData->aSelection.getConstArray()[ pImpl->pMergeData->nSelectionIndex++ ] >>= nPos;
+ pImpl->pMergeData->bEndOfDB = !pImpl->pMergeData->xResultSet->absolute( nPos );
+ pImpl->pMergeData->CheckEndOfDB();
+ if(pImpl->pMergeData->nSelectionIndex >= pImpl->pMergeData->aSelection.getLength())
+ pImpl->pMergeData->bEndOfDB = TRUE;
+ }
+ else
+ {
+ pImpl->pMergeData->bEndOfDB = !pImpl->pMergeData->xResultSet->first();
+ pImpl->pMergeData->CheckEndOfDB();
+ }
+ }
+ catch(Exception&)
+ {
+ pImpl->pMergeData->bEndOfDB = TRUE;
+ pImpl->pMergeData->CheckEndOfDB();
+ DBG_ERROR("exception in MergeNew()");
+ }
+
+ uno::Reference<XDataSource> xSource = SwNewDBMgr::getDataSourceAsParent(xConnection,aData.sDataSource);
+
+ lcl_InitNumberFormatter(*pImpl->pMergeData, xSource);
+
+ rMergeDesc.rSh.ChgDBData(aData);
+ bInMerge = TRUE;
+
+ if (IsInitDBFields())
+ {
+ // Bei Datenbankfeldern ohne DB-Name DB-Name von Dok einsetzen
+ SvStringsDtor aDBNames(1, 1);
+ aDBNames.Insert( new String(), 0);
+ SwDBData aInsertData = rMergeDesc.rSh.GetDBData();
+ String sDBName = aInsertData.sDataSource;
+ sDBName += DB_DELIM;
+ sDBName += (String)aInsertData.sCommand;
+ sDBName += DB_DELIM;
+ sDBName += String::CreateFromInt32(aInsertData.nCommandType);
+ rMergeDesc.rSh.ChangeDBFields( aDBNames, sDBName);
+ SetInitDBFields(FALSE);
+ }
+
+ BOOL bRet = TRUE;
+ switch(rMergeDesc.nMergeType)
+ {
+ case DBMGR_MERGE:
+ bRet = Merge(&rMergeDesc.rSh); // Mischen
+ break;
+
+ case DBMGR_MERGE_MAILMERGE: // printing merge from 'old' merge dialog or from UNO-component
+ case DBMGR_MERGE_MAILING:
+ case DBMGR_MERGE_MAILFILES:
+ case DBMGR_MERGE_SINGLE_FILE:
+ // save files and send them as e-Mail if required
+ bRet = MergeMailFiles(&rMergeDesc.rSh,
+ rMergeDesc);
+ break;
+
+ default: // Einfuegen der selektierten Eintraege
+ // (war: InsertRecord)
+ ImportFromConnection(&rMergeDesc.rSh);
+ break;
+ }
+
+ EndMerge();
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Daten importieren
+ --------------------------------------------------------------------*/
+
+
+BOOL SwNewDBMgr::Merge(SwWrtShell* pSh)
+{
+ pSh->StartAllAction();
+
+ pSh->ViewShell::UpdateFlds(TRUE);
+ pSh->SetModified();
+
+ pSh->EndAllAction();
+
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+void SwNewDBMgr::ImportFromConnection( SwWrtShell* pSh )
+{
+ if(pImpl->pMergeData && !pImpl->pMergeData->bEndOfDB)
+ {
+ {
+ pSh->StartAllAction();
+ pSh->StartUndo(UNDO_EMPTY);
+ BOOL bGroupUndo(pSh->DoesGroupUndo());
+ pSh->DoGroupUndo(FALSE);
+
+ if( pSh->HasSelection() )
+ pSh->DelRight();
+
+ SwWait *pWait = 0;
+
+ {
+ ULONG i = 0;
+ do {
+
+ ImportDBEntry(pSh);
+ if( 10 == ++i )
+ pWait = new SwWait( *pSh->GetView().GetDocShell(), TRUE);
+
+ } while(ToNextMergeRecord());
+ }
+
+ pSh->DoGroupUndo(bGroupUndo);
+ pSh->EndUndo(UNDO_EMPTY);
+ pSh->EndAllAction();
+ delete pWait;
+ }
+ }
+}
+/*-----------------24.02.97 10.30-------------------
+
+--------------------------------------------------*/
+
+String lcl_FindColumn(const String& sFormatStr,USHORT &nUsedPos, BYTE &nSeparator)
+{
+ String sReturn;
+ USHORT nLen = sFormatStr.Len();
+ nSeparator = 0xff;
+ while(nUsedPos < nLen && nSeparator == 0xff)
+ {
+ sal_Unicode cAkt = sFormatStr.GetChar(nUsedPos);
+ switch(cAkt)
+ {
+ case ',':
+ nSeparator = DB_SEP_SPACE;
+ break;
+ case ';':
+ nSeparator = DB_SEP_RETURN;
+ break;
+ case ':':
+ nSeparator = DB_SEP_TAB;
+ break;
+ case '#':
+ nSeparator = DB_SEP_NEWLINE;
+ break;
+ default:
+ sReturn += cAkt;
+ }
+ nUsedPos++;
+
+ }
+ return sReturn;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+void SwNewDBMgr::ImportDBEntry(SwWrtShell* pSh)
+{
+ if(pImpl->pMergeData && !pImpl->pMergeData->bEndOfDB)
+ {
+ uno::Reference< XColumnsSupplier > xColsSupp( pImpl->pMergeData->xResultSet, UNO_QUERY );
+ uno::Reference<XNameAccess> xCols = xColsSupp->getColumns();
+ String sFormatStr;
+ USHORT nFmtLen = sFormatStr.Len();
+ if( nFmtLen )
+ {
+ const char cSpace = ' ';
+ const char cTab = '\t';
+ USHORT nUsedPos = 0;
+ BYTE nSeparator;
+ String sColumn = lcl_FindColumn(sFormatStr, nUsedPos, nSeparator);
+ while( sColumn.Len() )
+ {
+ if(!xCols->hasByName(sColumn))
+ return;
+ Any aCol = xCols->getByName(sColumn);
+ uno::Reference< XPropertySet > xColumnProp;
+ aCol >>= xColumnProp;
+ if(xColumnProp.is())
+ {
+ SwDBFormatData aDBFormat;
+ String sInsert = GetDBField( xColumnProp, aDBFormat);
+ if( DB_SEP_SPACE == nSeparator )
+ sInsert += cSpace;
+ else if( DB_SEP_TAB == nSeparator)
+ sInsert += cTab;
+ pSh->Insert(sInsert);
+ if( DB_SEP_RETURN == nSeparator)
+ pSh->SplitNode();
+ else if(DB_SEP_NEWLINE == nSeparator)
+ pSh->InsertLineBreak();
+ }
+ else
+ {
+ // Spalte nicht gefunden -> Fehler anzeigen
+ String sInsert = '?';
+ sInsert += sColumn;
+ sInsert += '?';
+ pSh->Insert(sInsert);
+ }
+ sColumn = lcl_FindColumn(sFormatStr, nUsedPos, nSeparator);
+ }
+ pSh->SplitNode();
+ }
+ else
+ {
+ String sStr;
+ Sequence<rtl::OUString> aColNames = xCols->getElementNames();
+ const rtl::OUString* pColNames = aColNames.getConstArray();
+ long nLength = aColNames.getLength();
+ for(long i = 0; i < nLength; i++)
+ {
+ Any aCol = xCols->getByName(pColNames[i]);
+ uno::Reference< XPropertySet > xColumnProp;
+ aCol >>= xColumnProp;
+ SwDBFormatData aDBFormat;
+ sStr += GetDBField( xColumnProp, aDBFormat);
+ if (i < nLength - 1)
+ sStr += '\t';
+ }
+ pSh->SwEditShell::Insert2(sStr);
+ pSh->SwFEShell::SplitNode(); // Zeilenvorschub
+ }
+ }
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Listbox mit Tabellenliste fuellen
+ --------------------------------------------------------------------*/
+BOOL SwNewDBMgr::GetTableNames(ListBox* pListBox, const String& rDBName)
+{
+ BOOL bRet = FALSE;
+ String sOldTableName(pListBox->GetSelectEntry());
+ pListBox->Clear();
+ SwDSParam* pParam = FindDSConnection(rDBName, FALSE);
+ uno::Reference< XConnection> xConnection;
+ if(pParam && pParam->xConnection.is())
+ xConnection = pParam->xConnection;
+ else
+ {
+ rtl::OUString sDBName(rDBName);
+ if ( sDBName.getLength() )
+ xConnection = RegisterConnection( sDBName );
+ }
+ if(xConnection.is())
+ {
+ uno::Reference<XTablesSupplier> xTSupplier = uno::Reference<XTablesSupplier>(xConnection, UNO_QUERY);
+ if(xTSupplier.is())
+ {
+ uno::Reference<XNameAccess> xTbls = xTSupplier->getTables();
+ Sequence<rtl::OUString> aTbls = xTbls->getElementNames();
+ const rtl::OUString* pTbls = aTbls.getConstArray();
+ for(long i = 0; i < aTbls.getLength(); i++)
+ {
+ USHORT nEntry = pListBox->InsertEntry(pTbls[i]);
+ pListBox->SetEntryData(nEntry, (void*)0);
+ }
+ }
+ uno::Reference<XQueriesSupplier> xQSupplier = uno::Reference<XQueriesSupplier>(xConnection, UNO_QUERY);
+ if(xQSupplier.is())
+ {
+ uno::Reference<XNameAccess> xQueries = xQSupplier->getQueries();
+ Sequence<rtl::OUString> aQueries = xQueries->getElementNames();
+ const rtl::OUString* pQueries = aQueries.getConstArray();
+ for(long i = 0; i < aQueries.getLength(); i++)
+ {
+ USHORT nEntry = pListBox->InsertEntry(pQueries[i]);
+ pListBox->SetEntryData(nEntry, (void*)1);
+ }
+ }
+ if (sOldTableName.Len())
+ pListBox->SelectEntry(sOldTableName);
+ bRet = TRUE;
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Listbox mit Spaltennamen einer Datenbank fuellen
+ --------------------------------------------------------------------*/
+BOOL SwNewDBMgr::GetColumnNames(ListBox* pListBox,
+ const String& rDBName, const String& rTableName, BOOL bAppend)
+{
+ if (!bAppend)
+ pListBox->Clear();
+ SwDBData aData;
+ aData.sDataSource = rDBName;
+ aData.sCommand = rTableName;
+ aData.nCommandType = -1;
+ SwDSParam* pParam = FindDSData(aData, FALSE);
+ uno::Reference< XConnection> xConnection;
+ if(pParam && pParam->xConnection.is())
+ xConnection = pParam->xConnection;
+ else
+ {
+ rtl::OUString sDBName(rDBName);
+ xConnection = RegisterConnection( sDBName );
+ }
+ uno::Reference< XColumnsSupplier> xColsSupp = SwNewDBMgr::GetColumnSupplier(xConnection, rTableName);
+ if(xColsSupp.is())
+ {
+ uno::Reference<XNameAccess> xCols = xColsSupp->getColumns();
+ const Sequence<rtl::OUString> aColNames = xCols->getElementNames();
+ const rtl::OUString* pColNames = aColNames.getConstArray();
+ for(int nCol = 0; nCol < aColNames.getLength(); nCol++)
+ {
+ pListBox->InsertEntry(pColNames[nCol]);
+ }
+ ::comphelper::disposeComponent( xColsSupp );
+ }
+ return(TRUE);
+}
+/* -----------------------------08.06.01 15:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwNewDBMgr::GetColumnNames(ListBox* pListBox,
+ uno::Reference< XConnection> xConnection,
+ const String& rTableName, BOOL bAppend)
+{
+ if (!bAppend)
+ pListBox->Clear();
+ uno::Reference< XColumnsSupplier> xColsSupp = SwNewDBMgr::GetColumnSupplier(xConnection, rTableName);
+ if(xColsSupp.is())
+ {
+ uno::Reference<XNameAccess> xCols = xColsSupp->getColumns();
+ const Sequence<rtl::OUString> aColNames = xCols->getElementNames();
+ const rtl::OUString* pColNames = aColNames.getConstArray();
+ for(int nCol = 0; nCol < aColNames.getLength(); nCol++)
+ {
+ pListBox->InsertEntry(pColNames[nCol]);
+ }
+ ::comphelper::disposeComponent( xColsSupp );
+ }
+ return(TRUE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: CTOR
+ --------------------------------------------------------------------*/
+
+SwNewDBMgr::SwNewDBMgr() :
+ nMergeType(DBMGR_INSERT),
+ bInitDBFields(FALSE),
+ bInMerge(FALSE),
+ bMergeSilent(FALSE),
+ bMergeLock(FALSE),
+ pImpl(new SwNewDBMgr_Impl(*this)),
+ pMergeEvtSrc(NULL)
+{
+}
+/* -----------------------------18.07.00 08:56--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwNewDBMgr::~SwNewDBMgr()
+{
+ for(USHORT nPos = 0; nPos < aDataSourceParams.Count(); nPos++)
+ {
+ SwDSParam* pParam = aDataSourceParams[nPos];
+ if(pParam->xConnection.is())
+ {
+ try
+ {
+ uno::Reference<XComponent> xComp(pParam->xConnection, UNO_QUERY);
+ if(xComp.is())
+ xComp->dispose();
+ }
+ catch(const RuntimeException& )
+ {
+ //may be disposed already since multiple entries may have used the same connection
+ }
+ }
+ }
+ delete pImpl;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Serienbriefe als einzelne Dokumente speichern
+ --------------------------------------------------------------------*/
+String lcl_FindUniqueName(SwWrtShell* pTargetShell, const String& rStartingPageDesc, ULONG nDocNo )
+{
+ do
+ {
+ String sTest = rStartingPageDesc;
+ sTest += String::CreateFromInt32( nDocNo );
+ if( !pTargetShell->FindPageDescByName( sTest ) )
+ return sTest;
+ ++nDocNo;
+ }while(true);
+}
+void lcl_CopyDynamicDefaults( const SwDoc& rSource, SwDoc& rTarget )
+{
+ USHORT __FAR_DATA aRangeOfDefaults[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_PARATR_BEGIN, RES_PARATR_END-1,
+ // --> OD 2008-02-25 #refactorlists##
+ RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
+ // <--
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+ };
+
+ SfxItemSet aNewDefaults( rTarget.GetAttrPool(), aRangeOfDefaults );
+
+ USHORT nWhich;
+ USHORT nRange = 0;
+ while( aRangeOfDefaults[nRange] != 0)
+ {
+ for( nWhich = aRangeOfDefaults[nRange]; nWhich < aRangeOfDefaults[nRange + 1]; ++nWhich )
+ {
+ const SfxPoolItem& rSourceAttr = rSource.GetDefault( nWhich );
+ if( rSourceAttr != rTarget.GetDefault( nWhich ) )
+ aNewDefaults.Put( rSourceAttr );
+ }
+ nRange += 2;
+ }
+ if( aNewDefaults.Count() )
+ rTarget.SetDefault( aNewDefaults );
+}
+void lcl_CopyFollowPageDesc(
+ SwWrtShell& rTargetShell,
+ const SwPageDesc& rSourcePageDesc,
+ const SwPageDesc& rTargetPageDesc,
+ const ULONG nDocNo )
+{
+ //now copy the follow page desc, too
+ const SwPageDesc* pFollowPageDesc = rSourcePageDesc.GetFollow();
+ String sFollowPageDesc = pFollowPageDesc->GetName();
+ if( sFollowPageDesc != rSourcePageDesc.GetName() )
+ {
+ SwDoc* pTargetDoc = rTargetShell.GetDoc();
+ String sNewFollowPageDesc = lcl_FindUniqueName(&rTargetShell, sFollowPageDesc, nDocNo );
+ sal_uInt16 nNewDesc = pTargetDoc->MakePageDesc( sNewFollowPageDesc );
+ SwPageDesc& rTargetFollowPageDesc = pTargetDoc->_GetPageDesc( nNewDesc );
+
+ pTargetDoc->CopyPageDesc( *pFollowPageDesc, rTargetFollowPageDesc, sal_False );
+ SwPageDesc aDesc( rTargetPageDesc );
+ aDesc.SetFollow( &rTargetFollowPageDesc );
+ pTargetDoc->ChgPageDesc( rTargetPageDesc.GetName(), aDesc );
+ }
+}
+
+void lcl_RemoveSectionLinks( SwWrtShell& rWorkShell )
+{
+ //reset all links of the sections of synchronized labels
+ USHORT nSections = rWorkShell.GetSectionFmtCount();
+ for( USHORT nSection = 0; nSection < nSections; ++nSection )
+ {
+ SwSectionData aSectionData( *rWorkShell.GetSectionFmt( nSection ).GetSection() );
+ if( aSectionData.GetType() == FILE_LINK_SECTION )
+ {
+ aSectionData.SetType( CONTENT_SECTION );
+ aSectionData.SetLinkFileName( String() );
+ rWorkShell.UpdateSection( nSection, aSectionData );
+ }
+ }
+ rWorkShell.SetLabelDoc( sal_False );
+}
+
+BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
+ const SwMergeDescriptor& rMergeDescriptor)
+{
+ //check if the doc is synchronized and contains at least one linked section
+ BOOL bSynchronizedDoc = pSourceShell->IsLabelDoc() && pSourceShell->GetSectionFmtCount() > 1;
+ BOOL bLoop = TRUE;
+ BOOL bEMail = rMergeDescriptor.nMergeType == DBMGR_MERGE_MAILING;
+ const bool bAsSingleFile = rMergeDescriptor.nMergeType == DBMGR_MERGE_SINGLE_FILE;
+
+ ::rtl::Reference< MailDispatcher > xMailDispatcher;
+ ::rtl::OUString sBodyMimeType;
+ rtl_TextEncoding eEncoding = ::gsl_getSystemTextEncoding();
+
+ if(bEMail)
+ {
+ xMailDispatcher.set( new MailDispatcher(rMergeDescriptor.xSmtpServer));
+ if(!rMergeDescriptor.bSendAsAttachment && rMergeDescriptor.bSendAsHTML)
+ {
+ sBodyMimeType = ::rtl::OUString::createFromAscii("text/html; charset=");
+ sBodyMimeType += ::rtl::OUString::createFromAscii(
+ rtl_getBestMimeCharsetFromTextEncoding( eEncoding ));
+ SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get();
+ eEncoding = pHtmlOptions->GetTextEncoding();
+ }
+ else
+ sBodyMimeType =
+ ::rtl::OUString::createFromAscii("text/plain; charset=UTF-8; format=flowed");
+ }
+
+ uno::Reference< XPropertySet > xColumnProp;
+ {
+ BOOL bColumnName = sEMailAddrFld.Len() > 0;
+
+ if (bColumnName)
+ {
+ uno::Reference< XColumnsSupplier > xColsSupp( pImpl->pMergeData->xResultSet, UNO_QUERY );
+ uno::Reference<XNameAccess> xCols = xColsSupp->getColumns();
+ if(!xCols->hasByName(sEMailAddrFld))
+ return FALSE;
+ Any aCol = xCols->getByName(sEMailAddrFld);
+ aCol >>= xColumnProp;
+ }
+
+ SfxDispatcher* pSfxDispatcher = pSourceShell->GetView().GetViewFrame()->GetDispatcher();
+ SwDocShell* pSourrceDocSh = pSourceShell->GetView().GetDocShell();
+ pSfxDispatcher->Execute( pSourrceDocSh->HasName() ? SID_SAVEDOC : SID_SAVEASDOC, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD);
+ // has document been saved successfully?
+ if( !pSourrceDocSh->IsModified() )
+ {
+ SfxMedium* pOrig = pSourceShell->GetView().GetDocShell()->GetMedium();
+ String sSourceDocumentURL(pOrig->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ));
+ const SfxFilter* pSfxFlt = SwIoSystem::GetFileFilter(
+ sSourceDocumentURL, ::aEmptyStr );
+ const SfxFilter* pStoreToFilter = pSfxFlt;
+ SfxFilterContainer* pFilterContainer = SwDocShell::Factory().GetFilterContainer();
+ const String* pStoreToFilterOptions = 0;
+ // if a save_to filter is set then use it - otherwise use the default
+ if( bEMail && !rMergeDescriptor.bSendAsAttachment )
+ {
+ String sExtension( String::CreateFromAscii(
+ rMergeDescriptor.bSendAsHTML ? "html" : "txt" ));
+ pStoreToFilter = pFilterContainer->GetFilter4Extension(sExtension, SFX_FILTER_EXPORT);
+ }
+ else if( rMergeDescriptor.sSaveToFilter.Len())
+ {
+ const SfxFilter* pFilter =
+ pFilterContainer->GetFilter4FilterName( rMergeDescriptor.sSaveToFilter );
+ if(pFilter)
+ {
+ pStoreToFilter = pFilter;
+ if(rMergeDescriptor.sSaveToFilterOptions.Len())
+ pStoreToFilterOptions = &rMergeDescriptor.sSaveToFilterOptions;
+ }
+ }
+ bCancel = FALSE;
+
+ // in case of creating a single resulting file this has to be created here
+ SwWrtShell* pTargetShell = 0;
+
+ // the shell will be explicitly closed at the end of the method, but it is
+ // still more safe to use SfxObjectShellLock here
+ SfxObjectShellLock xTargetDocShell;
+
+ SwView* pTargetView = 0;
+ std::auto_ptr< utl::TempFile > aTempFile;
+ String sModifiedStartingPageDesc;
+ String sStartingPageDesc;
+ USHORT nStartingPageNo = 0;
+ bool bPageStylesWithHeaderFooter = false;
+ if(bAsSingleFile || rMergeDescriptor.bCreateSingleFile)
+ {
+ // create a target docshell to put the merged document into
+ xTargetDocShell = new SwDocShell( SFX_CREATE_MODE_STANDARD );
+ xTargetDocShell->DoInitNew( 0 );
+ SfxViewFrame* pTargetFrame = SfxViewFrame::LoadHiddenDocument( *xTargetDocShell, 0 );
+
+ pTargetView = static_cast<SwView*>( pTargetFrame->GetViewShell() );
+
+ //initiate SelectShell() to create sub shells
+ pTargetView->AttrChangedNotify( &pTargetView->GetWrtShell() );
+ pTargetShell = pTargetView->GetWrtShellPtr();
+ //copy the styles from the source to the target document
+ SwgReaderOption aOpt;
+ aOpt.SetTxtFmts( sal_True );
+ aOpt.SetFrmFmts( sal_True );
+ aOpt.SetPageDescs( sal_True );
+ aOpt.SetNumRules( sal_True );
+ aOpt.SetMerge( sal_False );
+ pTargetView->GetDocShell()->LoadStylesFromFile(
+ sSourceDocumentURL, aOpt, sal_True );
+ //determine the page style and number used at the start of the source document
+ pSourceShell->SttEndDoc(TRUE);
+ nStartingPageNo = pSourceShell->GetVirtPageNum();
+ sStartingPageDesc = sModifiedStartingPageDesc = pSourceShell->GetPageDesc(
+ pSourceShell->GetCurPageDesc()).GetName();
+ // #122799# copy compatibility options
+ lcl_CopyCompatibilityOptions( *pSourceShell, *pTargetShell);
+ // #72821# copy dynamic defaults
+ lcl_CopyDynamicDefaults( *pSourceShell->GetDoc(), *pTargetShell->GetDoc() );
+ // #i72517#
+ const SwPageDesc* pSourcePageDesc = pSourceShell->FindPageDescByName( sStartingPageDesc );
+ const SwFrmFmt& rMaster = pSourcePageDesc->GetMaster();
+ bPageStylesWithHeaderFooter = rMaster.GetHeader().IsActive() ||
+ rMaster.GetFooter().IsActive();
+
+ }
+
+ PrintMonitor aPrtMonDlg(&pSourceShell->GetView().GetEditWin(), PrintMonitor::MONITOR_TYPE_PRINT);
+ aPrtMonDlg.aDocName.SetText(pSourceShell->GetView().GetDocShell()->GetTitle(22));
+
+ aPrtMonDlg.aCancel.SetClickHdl(LINK(this, SwNewDBMgr, PrtCancelHdl));
+ if (!IsMergeSilent())
+ aPrtMonDlg.Show();
+
+ // Progress, um KeyInputs zu unterbinden
+ SfxProgress aProgress(pSourrceDocSh, ::aEmptyStr, 1);
+
+ // Alle Dispatcher sperren
+ SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst(pSourrceDocSh);
+ while (pViewFrm)
+ {
+ pViewFrm->GetDispatcher()->Lock(TRUE);
+ pViewFrm = SfxViewFrame::GetNext(*pViewFrm, pSourrceDocSh);
+ }
+ ULONG nDocNo = 1;
+
+ long nStartRow, nEndRow;
+ // collect temporary files
+ ::std::vector< String> aFilesToRemove;
+ do
+ {
+ nStartRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0;
+ {
+ String sPath(sSubject);
+
+ String sAddress;
+ if( !bEMail && bColumnName )
+ {
+ SwDBFormatData aDBFormat;
+ aDBFormat.xFormatter = pImpl->pMergeData->xFormatter;
+ aDBFormat.aNullDate = pImpl->pMergeData->aNullDate;
+ sAddress = GetDBField( xColumnProp, aDBFormat);
+ if (!sAddress.Len())
+ sAddress = '_';
+ sPath += sAddress;
+ }
+
+ // create a new temporary file name - only done once in case of bCreateSingleFile
+ if( 1 == nDocNo || (!rMergeDescriptor.bCreateSingleFile && !bAsSingleFile) )
+ {
+ INetURLObject aEntry(sPath);
+ String sLeading;
+ //#i97667# if the name is from a database field then it will be used _as is_
+ if( sAddress.Len() )
+ sLeading = sAddress;
+ else
+ sLeading = aEntry.GetBase();
+ aEntry.removeSegment();
+ sPath = aEntry.GetMainURL( INetURLObject::NO_DECODE );
+ String sExt( pStoreToFilter->GetDefaultExtension() );
+ sExt.EraseLeadingChars('*');
+ aTempFile = std::auto_ptr< utl::TempFile >(
+ new utl::TempFile(sLeading,&sExt,&sPath ));
+ if( bAsSingleFile )
+ aTempFile->EnableKillingFile();
+ }
+
+ if( !aTempFile->IsValid() )
+ {
+ ErrorHandler::HandleError( ERRCODE_IO_NOTSUPPORTED );
+ bLoop = FALSE;
+ bCancel = TRUE;
+ }
+ else
+ {
+ INetURLObject aTempFileURL(aTempFile->GetURL());
+ aPrtMonDlg.aPrinter.SetText( aTempFileURL.GetBase() );
+ String sStat(SW_RES(STR_STATSTR_LETTER)); // Brief
+ sStat += ' ';
+ sStat += String::CreateFromInt32( nDocNo );
+ aPrtMonDlg.aPrintInfo.SetText(sStat);
+
+ // Rechenzeit fuer Save-Monitor:
+ for (USHORT i = 0; i < 10; i++)
+ Application::Reschedule();
+
+ // Create and save new document
+ // The SfxObjectShell will be closed explicitly later but it is more safe to use SfxObjectShellLock here
+ SfxObjectShellLock xWorkDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL ));
+ SfxMedium* pWorkMed = new SfxMedium( sSourceDocumentURL, STREAM_STD_READ, TRUE );
+ pWorkMed->SetFilter( pSfxFlt );
+
+ if (xWorkDocSh->DoLoad(pWorkMed))
+ {
+ //create a view frame for the document
+ SfxViewFrame* pWorkFrame = SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 );
+ //request the layout calculation
+ SwWrtShell& rWorkShell =
+ static_cast< SwView* >(pWorkFrame->GetViewShell())->GetWrtShell();
+ rWorkShell.CalcLayout();
+ SwDoc* pWorkDoc = ((SwDocShell*)(&xWorkDocSh))->GetDoc();
+ SwNewDBMgr* pOldDBMgr = pWorkDoc->GetNewDBMgr();
+ pWorkDoc->SetNewDBMgr( this );
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE), xWorkDocSh));
+ pWorkDoc->UpdateFlds(NULL, false);
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE_FINISHED), xWorkDocSh));
+
+ // alle versteckten Felder/Bereiche entfernen
+ pWorkDoc->RemoveInvisibleContent();
+
+ // launch MailMergeEvent if required
+ const SwXMailMerge *pEvtSrc = GetMailMergeEvtSrc();
+ if(pEvtSrc)
+ {
+ uno::Reference< XInterface > xRef( (XMailMergeBroadcaster *) pEvtSrc );
+ text::MailMergeEvent aEvt( xRef, xWorkDocSh->GetModel() );
+ pEvtSrc->LaunchMailMergeEvent( aEvt );
+ }
+
+ if(rMergeDescriptor.bCreateSingleFile || bAsSingleFile )
+ {
+ DBG_ASSERT( pTargetShell, "no target shell available!" );
+ // copy created file into the target document
+ rWorkShell.ConvertFieldsToText();
+ rWorkShell.SetNumberingRestart();
+ if( bSynchronizedDoc )
+ {
+ lcl_RemoveSectionLinks( rWorkShell );
+ }
+
+ // insert the document into the target document
+ rWorkShell.SttEndDoc(FALSE);
+ rWorkShell.SttEndDoc(TRUE);
+ rWorkShell.SelAll();
+ pTargetShell->SwCrsrShell::SttEndDoc( FALSE );
+ //#i72517# the headers and footers are still those from the source - update in case of fields inside header/footer
+ if( !nDocNo && bPageStylesWithHeaderFooter )
+ pTargetShell->GetView().GetDocShell()->_LoadStyles( *rWorkShell.GetView().GetDocShell(), sal_True );
+ //#i72517# put the styles to the target document
+ //if the source uses headers or footers each new copy need to copy a new page styles
+ if(bPageStylesWithHeaderFooter)
+ {
+ //create a new pagestyle
+ //copy the pagedesc from the current document to the new document and change the name of the to-be-applied style
+
+ SwDoc* pTargetDoc = pTargetShell->GetDoc();
+ SwPageDesc* pSourcePageDesc = rWorkShell.FindPageDescByName( sStartingPageDesc );
+ String sNewPageDescName = lcl_FindUniqueName(pTargetShell, sStartingPageDesc, nDocNo );
+ pTargetDoc->MakePageDesc( sNewPageDescName );
+ SwPageDesc* pTargetPageDesc = pTargetShell->FindPageDescByName( sNewPageDescName );
+ if(pSourcePageDesc && pTargetPageDesc)
+ {
+ pTargetDoc->CopyPageDesc( *pSourcePageDesc, *pTargetPageDesc, sal_False );
+ sModifiedStartingPageDesc = sNewPageDescName;
+ lcl_CopyFollowPageDesc( *pTargetShell, *pSourcePageDesc, *pTargetPageDesc, nDocNo );
+ }
+ }
+
+ if(nDocNo > 1)
+ pTargetShell->InsertPageBreak( &sModifiedStartingPageDesc, nStartingPageNo );
+ else
+ pTargetShell->SetPageStyle(sModifiedStartingPageDesc);
+ DBG_ASSERT(!pTargetShell->GetTableFmt(),"target document ends with a table - paragraph should be appended");
+ //#i51359# add a second paragraph in case there's only one
+ {
+ SwNodeIndex aIdx( pWorkDoc->GetNodes().GetEndOfExtras(), 2 );
+ SwPosition aTestPos( aIdx );
+ SwCursor aTestCrsr(aTestPos,0,false);
+ if(!aTestCrsr.MovePara(fnParaNext, fnParaStart))
+ {
+ //append a paragraph
+ pWorkDoc->AppendTxtNode( aTestPos );
+ }
+ }
+ pTargetShell->Paste( rWorkShell.GetDoc(), sal_True );
+
+ //convert fields in page styles (header/footer - has to be done after the first document has been pasted
+ if(1 == nDocNo)
+ {
+ pTargetShell->CalcLayout();
+ pTargetShell->ConvertFieldsToText();
+ }
+ }
+ else
+ {
+ String sFileURL = aTempFileURL.GetMainURL( INetURLObject::NO_DECODE );
+ SfxMedium* pDstMed = new SfxMedium(
+ sFileURL,
+ STREAM_STD_READWRITE, TRUE );
+ pDstMed->SetFilter( pStoreToFilter );
+ if(pDstMed->GetItemSet())
+ {
+ if(pStoreToFilterOptions )
+ pDstMed->GetItemSet()->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, *pStoreToFilterOptions));
+ if(rMergeDescriptor.aSaveToFilterData.getLength())
+ pDstMed->GetItemSet()->Put(SfxUsrAnyItem(SID_FILTER_DATA, makeAny(rMergeDescriptor.aSaveToFilterData)));
+ }
+
+ //convert fields to text if we are exporting to PDF
+ //this prevents a second merge while updating the fields in SwXTextDocument::getRendererCount()
+ if( pStoreToFilter && pStoreToFilter->GetFilterName().EqualsAscii("writer_pdf_Export"))
+ rWorkShell.ConvertFieldsToText();
+ xWorkDocSh->DoSaveAs(*pDstMed);
+ xWorkDocSh->DoSaveCompleted(pDstMed);
+ if( xWorkDocSh->GetError() )
+ {
+ // error message ??
+ ErrorHandler::HandleError( xWorkDocSh->GetError() );
+ bCancel = TRUE;
+ bLoop = FALSE;
+ }
+ if( bEMail )
+ {
+ SwDBFormatData aDBFormat;
+ aDBFormat.xFormatter = pImpl->pMergeData->xFormatter;
+ aDBFormat.aNullDate = pImpl->pMergeData->aNullDate;
+ String sMailAddress = GetDBField( xColumnProp, aDBFormat);
+ if(!SwMailMergeHelper::CheckMailAddress( sMailAddress ))
+ {
+ DBG_ERROR("invalid e-Mail address in database column");
+ }
+ else
+ {
+ SwMailMessage* pMessage = 0;
+ uno::Reference< mail::XMailMessage > xMessage =
+ pMessage = new SwMailMessage;
+ if(rMergeDescriptor.pMailMergeConfigItem->IsMailReplyTo())
+ pMessage->setReplyToAddress(rMergeDescriptor.pMailMergeConfigItem->GetMailReplyTo());
+ pMessage->addRecipient( sMailAddress );
+ pMessage->SetSenderAddress( rMergeDescriptor.pMailMergeConfigItem->GetMailAddress() );
+ ::rtl::OUString sBody;
+ if(rMergeDescriptor.bSendAsAttachment)
+ {
+ sBody = rMergeDescriptor.sMailBody;
+ mail::MailAttachment aAttach;
+ aAttach.Data = new SwMailTransferable(
+ sFileURL,
+ rMergeDescriptor.sAttachmentName,
+ pStoreToFilter->GetMimeType());
+ aAttach.ReadableName = rMergeDescriptor.sAttachmentName;
+ pMessage->addAttachment( aAttach );
+ }
+ else
+ {
+ {
+ //read in the temporary file and use it as mail body
+ SfxMedium aMedium( sFileURL, STREAM_READ, TRUE);
+ SvStream* pInStream = aMedium.GetInStream();
+ DBG_ASSERT(pInStream, "no output file created?");
+ if(pInStream)
+ {
+ pInStream->SetStreamCharSet( eEncoding );
+ ByteString sLine;
+ sal_Bool bDone = pInStream->ReadLine( sLine );
+ while ( bDone )
+ {
+ sBody += String(sLine, eEncoding);
+ sBody += ::rtl::OUString('\n');
+ bDone = pInStream->ReadLine( sLine );
+ }
+ }
+ }
+ }
+ pMessage->setSubject( rMergeDescriptor.sSubject );
+ uno::Reference< datatransfer::XTransferable> xBody =
+ new SwMailTransferable(
+ sBody,
+ sBodyMimeType);
+ pMessage->setBody( xBody );
+
+ if(rMergeDescriptor.aCopiesTo.getLength())
+ {
+ const ::rtl::OUString* pCopies = rMergeDescriptor.aCopiesTo.getConstArray();
+ for( sal_Int32 nToken = 0; nToken < rMergeDescriptor.aCopiesTo.getLength(); ++nToken)
+ pMessage->addCcRecipient( pCopies[nToken] );
+ }
+ if(rMergeDescriptor.aBlindCopiesTo.getLength())
+ {
+ const ::rtl::OUString* pCopies = rMergeDescriptor.aBlindCopiesTo.getConstArray();
+ for( sal_Int32 nToken = 0; nToken < rMergeDescriptor.aBlindCopiesTo.getLength(); ++nToken)
+ pMessage->addBccRecipient( pCopies[nToken] );
+ }
+ xMailDispatcher->enqueueMailMessage( xMessage );
+ if(!xMailDispatcher->isStarted())
+ xMailDispatcher->start();
+ //schedule for removal
+ aFilesToRemove.push_back(sFileURL);
+ }
+ }
+ }
+ pWorkDoc->SetNewDBMgr( pOldDBMgr );
+ }
+ xWorkDocSh->DoClose();
+ }
+ }
+ nDocNo++;
+ nEndRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0;
+ } while( !bCancel &&
+ (bSynchronizedDoc && (nStartRow != nEndRow)? ExistsNextRecord() : ToNextMergeRecord()));
+
+ aPrtMonDlg.Show( FALSE );
+
+ // save the single output document
+ if(rMergeDescriptor.bCreateSingleFile || bAsSingleFile)
+ {
+ if( rMergeDescriptor.nMergeType != DBMGR_MERGE_MAILMERGE )
+ {
+ DBG_ASSERT( aTempFile.get(), "Temporary file not available" );
+ INetURLObject aTempFileURL(bAsSingleFile ? sSubject : aTempFile->GetURL());
+ SfxMedium* pDstMed = new SfxMedium(
+ aTempFileURL.GetMainURL( INetURLObject::NO_DECODE ),
+ STREAM_STD_READWRITE, TRUE );
+ pDstMed->SetFilter( pStoreToFilter );
+ if(pDstMed->GetItemSet())
+ {
+ if(pStoreToFilterOptions )
+ pDstMed->GetItemSet()->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, *pStoreToFilterOptions));
+ if(rMergeDescriptor.aSaveToFilterData.getLength())
+ pDstMed->GetItemSet()->Put(SfxUsrAnyItem(SID_FILTER_DATA, makeAny(rMergeDescriptor.aSaveToFilterData)));
+ }
+
+ xTargetDocShell->DoSaveAs(*pDstMed);
+ xTargetDocShell->DoSaveCompleted(pDstMed);
+ if( xTargetDocShell->GetError() )
+ {
+ // error message ??
+ ErrorHandler::HandleError( xTargetDocShell->GetError() );
+ bLoop = FALSE;
+ }
+ }
+ else if( pTargetView ) // must be available!
+ {
+ //print the target document
+ #if OSL_DEBUG_LEVEL > 1
+ sal_Bool _bVal;
+ sal_Int16 _nVal;
+ rtl::OUString _sVal;
+ const beans::PropertyValue* pDbgPrintOptions = rMergeDescriptor.aPrintOptions.getConstArray();
+ for( sal_Int32 nOption = 0; nOption < rMergeDescriptor.aPrintOptions.getLength(); ++nOption)
+ {
+ rtl::OUString aName( pDbgPrintOptions[nOption].Name );
+ uno::Any aVal( pDbgPrintOptions[nOption].Value );
+ aVal >>= _bVal;
+ aVal >>= _nVal;
+ aVal >>= _sVal;
+ }
+ #endif
+ // printing should be done synchronously otherwise the document
+ // might already become invalid during the process
+ uno::Sequence< beans::PropertyValue > aOptions( rMergeDescriptor.aPrintOptions );
+ const sal_Int32 nOpts = aOptions.getLength();
+ aOptions.realloc( nOpts + 1 );
+ aOptions[ nOpts ].Name = rtl::OUString::createFromAscii( "Wait" );
+ aOptions[ nOpts ].Value <<= sal_True ;
+// aPrintArgs.Put(SfxBoolItem(FN_QRY_MERGE, TRUE) );
+// // #i52629# aynchronous printing should only be done in silent mode - otherwise
+// // the printer dialog does not come up
+// aPrintArgs.Put( SfxBoolItem( SID_ASYNCHRON, rMergeDescriptor.bPrintAsync ));
+ // move print options
+ const beans::PropertyValue* pPrintOptions = rMergeDescriptor.aPrintOptions.getConstArray();
+ for( sal_Int32 nOption = 0; nOption < rMergeDescriptor.aPrintOptions.getLength(); ++nOption)
+ {
+ if( pPrintOptions[nOption].Name.equalsAscii( "CopyCount" )
+ ||( pPrintOptions[nOption].Name.equalsAscii( "FileName" ))
+ ||( pPrintOptions[nOption].Name.equalsAscii( "Collate" ))
+ ||( pPrintOptions[nOption].Name.equalsAscii( "Pages" ))
+ ||( pPrintOptions[nOption].Name.equalsAscii( "Wait" )))
+ {
+ aOptions.realloc( nOpts + 1 );
+ aOptions[ nOpts ].Name = pPrintOptions[nOption].Name;
+ aOptions[ nOpts ].Value = pPrintOptions[nOption].Value ;
+ }
+ }
+
+// const SwModuleOptions * pModOpt = SW_MOD()->GetModuleConfig();
+// if (pModOpt->IsSinglePrintJob())
+// {
+// }
+// else
+// {
+ pTargetView->ExecPrint( aOptions, IsMergeSilent(), rMergeDescriptor.bPrintAsync );
+// }
+ }
+ xTargetDocShell->DoClose();
+ }
+
+ //remove the temporary files
+ ::std::vector<String>::iterator aFileIter;
+ for(aFileIter = aFilesToRemove.begin();
+ aFileIter != aFilesToRemove.end(); aFileIter++)
+ SWUnoHelper::UCB_DeleteFile( *aFileIter );
+
+ // Alle Dispatcher freigeben
+ pViewFrm = SfxViewFrame::GetFirst(pSourrceDocSh);
+ while (pViewFrm)
+ {
+ pViewFrm->GetDispatcher()->Lock(FALSE);
+ pViewFrm = SfxViewFrame::GetNext(*pViewFrm, pSourrceDocSh);
+ }
+
+ SW_MOD()->SetView(&pSourceShell->GetView());
+ }
+
+ nMergeType = DBMGR_INSERT;
+ }
+
+ if(bEMail)
+ {
+ xMailDispatcher->stop();
+ xMailDispatcher->shutdown();
+
+ }
+
+ return bLoop;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK_INLINE_START( SwNewDBMgr, PrtCancelHdl, Button *, pButton )
+{
+ pButton->GetParent()->Hide();
+ bCancel = TRUE;
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwNewDBMgr, PrtCancelHdl, Button *, pButton )
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Numberformat der Spalte ermitteln und ggfs. in
+ den uebergebenen Formatter uebertragen
+ --------------------------------------------------------------------*/
+
+ULONG SwNewDBMgr::GetColumnFmt( const String& rDBName,
+ const String& rTableName,
+ const String& rColNm,
+ SvNumberFormatter* pNFmtr,
+ long nLanguage )
+{
+ ULONG nRet = 0;
+ if(pNFmtr)
+ {
+ uno::Reference< XDataSource> xSource;
+ uno::Reference< XConnection> xConnection;
+ sal_Bool bUseMergeData = sal_False;
+ uno::Reference< XColumnsSupplier> xColsSupp;
+ bool bDisposeConnection = false;
+ if(pImpl->pMergeData &&
+ pImpl->pMergeData->sDataSource.equals(rDBName) && pImpl->pMergeData->sCommand.equals(rTableName))
+ {
+ xConnection = pImpl->pMergeData->xConnection;
+ xSource = SwNewDBMgr::getDataSourceAsParent(xConnection,rDBName);
+ bUseMergeData = sal_True;
+ xColsSupp = xColsSupp.query( pImpl->pMergeData->xResultSet );
+ }
+ if(!xConnection.is())
+ {
+ SwDBData aData;
+ aData.sDataSource = rDBName;
+ aData.sCommand = rTableName;
+ aData.nCommandType = -1;
+ SwDSParam* pParam = FindDSData(aData, FALSE);
+ if(pParam && pParam->xConnection.is())
+ {
+ xConnection = pParam->xConnection;
+ xColsSupp = xColsSupp.query( pParam->xResultSet );
+ }
+ else
+ {
+ rtl::OUString sDBName(rDBName);
+ xConnection = RegisterConnection( sDBName );
+ bDisposeConnection = true;
+ }
+ if(bUseMergeData)
+ pImpl->pMergeData->xConnection = xConnection;
+ }
+ bool bDispose = !xColsSupp.is();
+ if(bDispose)
+ {
+ xColsSupp = SwNewDBMgr::GetColumnSupplier(xConnection, rTableName);
+ }
+ if(xColsSupp.is())
+ {
+ uno::Reference<XNameAccess> xCols;
+ try
+ {
+ xCols = xColsSupp->getColumns();
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("Exception in getColumns()");
+ }
+ if(!xCols.is() || !xCols->hasByName(rColNm))
+ return nRet;
+ Any aCol = xCols->getByName(rColNm);
+ uno::Reference< XPropertySet > xColumn;
+ aCol >>= xColumn;
+ nRet = GetColumnFmt(xSource, xConnection, xColumn, pNFmtr, nLanguage);
+ if(bDispose)
+ {
+ ::comphelper::disposeComponent( xColsSupp );
+ }
+ if(bDisposeConnection)
+ {
+ ::comphelper::disposeComponent( xConnection );
+ }
+ }
+ else
+ nRet = pNFmtr->GetFormatIndex( NF_NUMBER_STANDARD, LANGUAGE_SYSTEM );
+ }
+ return nRet;
+}
+/* -----------------------------07.06.01 15:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+ULONG SwNewDBMgr::GetColumnFmt( uno::Reference< XDataSource> xSource,
+ uno::Reference< XConnection> xConnection,
+ uno::Reference< XPropertySet> xColumn,
+ SvNumberFormatter* pNFmtr,
+ long nLanguage )
+{
+ //JP 12.01.99: ggfs. das NumberFormat im Doc setzen
+ ULONG nRet = 0;
+
+ if(!xSource.is())
+ {
+ uno::Reference<XChild> xChild(xConnection, UNO_QUERY);
+ if ( xChild.is() )
+ xSource = uno::Reference<XDataSource>(xChild->getParent(), UNO_QUERY);
+ }
+ if(xSource.is() && xConnection.is() && xColumn.is() && pNFmtr)
+ {
+ SvNumberFormatsSupplierObj* pNumFmt = new SvNumberFormatsSupplierObj( pNFmtr );
+ uno::Reference< util::XNumberFormatsSupplier > xDocNumFmtsSupplier = pNumFmt;
+ uno::Reference< XNumberFormats > xDocNumberFormats = xDocNumFmtsSupplier->getNumberFormats();
+ uno::Reference< XNumberFormatTypes > xDocNumberFormatTypes(xDocNumberFormats, UNO_QUERY);
+
+ Locale aLocale( MsLangId::convertLanguageToLocale( (LanguageType)nLanguage ));
+
+ //get the number formatter of the data source
+ uno::Reference<XPropertySet> xSourceProps(xSource, UNO_QUERY);
+ uno::Reference< XNumberFormats > xNumberFormats;
+ if(xSourceProps.is())
+ {
+ Any aFormats = xSourceProps->getPropertyValue(C2U("NumberFormatsSupplier"));
+ if(aFormats.hasValue())
+ {
+ uno::Reference<XNumberFormatsSupplier> xSuppl;
+ aFormats >>= xSuppl;
+ if(xSuppl.is())
+ {
+ xNumberFormats = xSuppl->getNumberFormats();
+ }
+ }
+ }
+ bool bUseDefault = true;
+ try
+ {
+ Any aFormatKey = xColumn->getPropertyValue(C2U("FormatKey"));
+ if(aFormatKey.hasValue())
+ {
+ sal_Int32 nFmt = 0;
+ aFormatKey >>= nFmt;
+ if(xNumberFormats.is())
+ {
+ try
+ {
+ uno::Reference<XPropertySet> xNumProps = xNumberFormats->getByKey( nFmt );
+ Any aFormatString = xNumProps->getPropertyValue(C2U("FormatString"));
+ Any aLocaleVal = xNumProps->getPropertyValue(C2U("Locale"));
+ rtl::OUString sFormat;
+ aFormatString >>= sFormat;
+ lang::Locale aLoc;
+ aLocaleVal >>= aLoc;
+ nFmt = xDocNumberFormats->queryKey( sFormat, aLoc, sal_False );
+ if(NUMBERFORMAT_ENTRY_NOT_FOUND == sal::static_int_cast< sal_uInt32, sal_Int32>(nFmt))
+ nFmt = xDocNumberFormats->addNew( sFormat, aLoc );
+ nRet = nFmt;
+ bUseDefault = false;
+ }
+ catch(const Exception&)
+ {
+ DBG_ERROR("illegal number format key");
+ }
+ }
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR("no FormatKey property found");
+ }
+ if(bUseDefault)
+ nRet = SwNewDBMgr::GetDbtoolsClient().getDefaultNumberFormat(xColumn, xDocNumberFormatTypes, aLocale);
+ }
+ return nRet;
+}
+
+/* -----------------------------17.07.00 09:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int32 SwNewDBMgr::GetColumnType( const String& rDBName,
+ const String& rTableName,
+ const String& rColNm )
+{
+ sal_Int32 nRet = DataType::SQLNULL;
+ SwDBData aData;
+ aData.sDataSource = rDBName;
+ aData.sCommand = rTableName;
+ aData.nCommandType = -1;
+ SwDSParam* pParam = FindDSData(aData, FALSE);
+ uno::Reference< XConnection> xConnection;
+ uno::Reference< XColumnsSupplier > xColsSupp;
+ bool bDispose = false;
+ if(pParam && pParam->xConnection.is())
+ {
+ xConnection = pParam->xConnection;
+ xColsSupp = uno::Reference< XColumnsSupplier >( pParam->xResultSet, UNO_QUERY );
+ }
+ else
+ {
+ rtl::OUString sDBName(rDBName);
+ xConnection = RegisterConnection( sDBName );
+ }
+ if( !xColsSupp.is() )
+ {
+ xColsSupp = SwNewDBMgr::GetColumnSupplier(xConnection, rTableName);
+ bDispose = true;
+ }
+ if(xColsSupp.is())
+ {
+ uno::Reference<XNameAccess> xCols = xColsSupp->getColumns();
+ if(xCols->hasByName(rColNm))
+ {
+ Any aCol = xCols->getByName(rColNm);
+ uno::Reference<XPropertySet> xCol;
+ aCol >>= xCol;
+ Any aType = xCol->getPropertyValue(C2S("Type"));
+ aType >>= nRet;
+ }
+ if(bDispose)
+ ::comphelper::disposeComponent( xColsSupp );
+ }
+ return nRet;
+}
+
+/* -----------------------------03.07.00 17:12--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference< sdbc::XConnection> SwNewDBMgr::GetConnection(const String& rDataSource,
+ uno::Reference<XDataSource>& rxSource)
+{
+ Reference< sdbc::XConnection> xConnection;
+ Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ try
+ {
+ Reference<XCompletedConnection> xComplConnection(SwNewDBMgr::GetDbtoolsClient().getDataSource(rDataSource, xMgr),UNO_QUERY);
+ if ( xComplConnection.is() )
+ {
+ rxSource.set(xComplConnection,UNO_QUERY);
+ Reference< XInteractionHandler > xHandler(
+ xMgr->createInstance( C2U( "com.sun.star.task.InteractionHandler" )), UNO_QUERY);
+ xConnection = xComplConnection->connectWithCompletion( xHandler );
+ }
+ }
+ catch(Exception&) {}
+
+ return xConnection;
+}
+/* -----------------------------03.07.00 17:12--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference< sdbcx::XColumnsSupplier> SwNewDBMgr::GetColumnSupplier(uno::Reference<sdbc::XConnection> xConnection,
+ const String& rTableOrQuery,
+ BYTE eTableOrQuery)
+{
+ Reference< sdbcx::XColumnsSupplier> xRet;
+ try
+ {
+ if(eTableOrQuery == SW_DB_SELECT_UNKNOWN)
+ {
+ //search for a table with the given command name
+ Reference<XTablesSupplier> xTSupplier = Reference<XTablesSupplier>(xConnection, UNO_QUERY);
+ if(xTSupplier.is())
+ {
+ Reference<XNameAccess> xTbls = xTSupplier->getTables();
+ eTableOrQuery = xTbls->hasByName(rTableOrQuery) ?
+ SW_DB_SELECT_TABLE : SW_DB_SELECT_QUERY;
+ }
+ }
+ sal_Int32 nCommandType = SW_DB_SELECT_TABLE == eTableOrQuery ?
+ CommandType::TABLE : CommandType::QUERY;
+ Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ Reference<XRowSet> xRowSet(
+ xMgr->createInstance(C2U("com.sun.star.sdb.RowSet")), UNO_QUERY);
+
+ ::rtl::OUString sDataSource;
+ Reference<XDataSource> xSource = SwNewDBMgr::getDataSourceAsParent(xConnection, sDataSource);
+ Reference<XPropertySet> xSourceProperties(xSource, UNO_QUERY);
+ if(xSourceProperties.is())
+ {
+ xSourceProperties->getPropertyValue(C2U("Name")) >>= sDataSource;
+ }
+
+ Reference<XPropertySet> xRowProperties(xRowSet, UNO_QUERY);
+ xRowProperties->setPropertyValue(C2U("DataSourceName"), makeAny(sDataSource));
+ xRowProperties->setPropertyValue(C2U("Command"), makeAny(::rtl::OUString(rTableOrQuery)));
+ xRowProperties->setPropertyValue(C2U("CommandType"), makeAny(nCommandType));
+ xRowProperties->setPropertyValue(C2U("FetchSize"), makeAny((sal_Int32)10));
+ xRowProperties->setPropertyValue(C2U("ActiveConnection"), makeAny(xConnection));
+ xRowSet->execute();
+ xRet = Reference<XColumnsSupplier>( xRowSet, UNO_QUERY );
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_ERROR("Exception in SwDBMgr::GetColumnSupplier");
+ }
+
+ return xRet;
+}
+/* -----------------------------05.07.00 13:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+String SwNewDBMgr::GetDBField(uno::Reference<XPropertySet> xColumnProps,
+ const SwDBFormatData& rDBFormatData,
+ double* pNumber)
+{
+ uno::Reference< XColumn > xColumn(xColumnProps, UNO_QUERY);
+ String sRet;
+ DBG_ASSERT(xColumn.is(), "SwNewDBMgr::::ImportDBField: illegal arguments");
+ if(!xColumn.is())
+ return sRet;
+
+ Any aType = xColumnProps->getPropertyValue(C2U("Type"));
+ sal_Int32 eDataType = 0;
+ aType >>= eDataType;
+ switch(eDataType)
+ {
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
+ try
+ {
+ sRet = xColumn->getString();
+ }
+ catch( SQLException& )
+ {
+ }
+ break;
+ case DataType::BIT:
+ case DataType::BOOLEAN:
+ case DataType::TINYINT:
+ case DataType::SMALLINT:
+ case DataType::INTEGER:
+ case DataType::BIGINT:
+ case DataType::FLOAT:
+ case DataType::REAL:
+ case DataType::DOUBLE:
+ case DataType::NUMERIC:
+ case DataType::DECIMAL:
+ case DataType::DATE:
+ case DataType::TIME:
+ case DataType::TIMESTAMP:
+ {
+// ::Date aTempDate(rDBFormatData.aNullDate.Day,
+// rDBFormatData.aNullDate.Month, rDBFormatData.aNullDate.Year);
+
+ try
+ {
+ SwDbtoolsClient& aClient = SwNewDBMgr::GetDbtoolsClient();
+ sRet = aClient.getFormattedValue(
+ xColumnProps,
+ rDBFormatData.xFormatter,
+ rDBFormatData.aLocale,
+ rDBFormatData.aNullDate);
+ if (pNumber)
+ {
+ double fVal = xColumn->getDouble();
+ if(!xColumn->wasNull())
+ {
+ *pNumber = fVal;
+ }
+ }
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("exception caught");
+ }
+
+ }
+ break;
+
+// case DataType::BINARY:
+// case DataType::VARBINARY:
+// case DataType::LONGVARBINARY:
+// case DataType::SQLNULL:
+// case DataType::OTHER:
+// case DataType::OBJECT:
+// case DataType::DISTINCT:
+// case DataType::STRUCT:
+// case DataType::ARRAY:
+// case DataType::BLOB:
+// case DataType::CLOB:
+// case DataType::REF:
+// default:
+ }
+// if (pFormat)
+// {
+// SFX_ITEMSET_GET(*pCol, pFormatItem, SfxUInt32Item, SBA_DEF_FMTVALUE, sal_True);
+// *pFormat = pFormatItem->GetValue();
+// }
+
+ return sRet;
+}
+/* -----------------------------06.07.00 14:28--------------------------------
+ releases the merge data source table or query after merge is completed
+ ---------------------------------------------------------------------------*/
+void SwNewDBMgr::EndMerge()
+{
+ DBG_ASSERT(bInMerge, "merge is not active");
+ bInMerge = FALSE;
+ delete pImpl->pMergeData;
+ pImpl->pMergeData = 0;
+}
+/* -----------------------------06.07.00 14:28--------------------------------
+ checks if a desired data source table or query is open
+ ---------------------------------------------------------------------------*/
+BOOL SwNewDBMgr::IsDataSourceOpen(const String& rDataSource,
+ const String& rTableOrQuery, sal_Bool bMergeOnly)
+{
+ if(pImpl->pMergeData)
+ {
+ return !bMergeLock &&
+ ((rDataSource == (String)pImpl->pMergeData->sDataSource &&
+ rTableOrQuery == (String)pImpl->pMergeData->sCommand)
+ ||(!rDataSource.Len() && !rTableOrQuery.Len()))
+ &&
+ pImpl->pMergeData->xResultSet.is();
+ }
+ else if(!bMergeOnly)
+ {
+ SwDBData aData;
+ aData.sDataSource = rDataSource;
+ aData.sCommand = rTableOrQuery;
+ aData.nCommandType = -1;
+ SwDSParam* pFound = FindDSData(aData, FALSE);
+ return (pFound && pFound->xResultSet.is());
+ }
+ return sal_False;
+}
+/* -----------------------------17.07.00 16:44--------------------------------
+ read column data a a specified position
+ ---------------------------------------------------------------------------*/
+BOOL SwNewDBMgr::GetColumnCnt(const String& rSourceName, const String& rTableName,
+ const String& rColumnName, sal_uInt32 nAbsRecordId,
+ long nLanguage,
+ String& rResult, double* pNumber)
+{
+ BOOL bRet = FALSE;
+ SwDSParam* pFound = 0;
+ //check if it's the merge data source
+ if(pImpl->pMergeData &&
+ rSourceName == (String)pImpl->pMergeData->sDataSource &&
+ rTableName == (String)pImpl->pMergeData->sCommand)
+ {
+ pFound = pImpl->pMergeData;
+ }
+ else
+ {
+ SwDBData aData;
+ aData.sDataSource = rSourceName;
+ aData.sCommand = rTableName;
+ aData.nCommandType = -1;
+ pFound = FindDSData(aData, FALSE);
+ }
+ //check validity of supplied record Id
+ if(pFound->aSelection.getLength())
+ {
+ //the destination has to be an element of the selection
+ const Any* pSelection = pFound->aSelection.getConstArray();
+ sal_Bool bFound = sal_False;
+ for(sal_Int32 nPos = 0; !bFound && nPos < pFound->aSelection.getLength(); nPos++)
+ {
+ sal_Int32 nSelection = 0;
+ pSelection[nPos] >>= nSelection;
+ if(nSelection == static_cast<sal_Int32>(nAbsRecordId))
+ bFound = sal_True;
+ }
+ if(!bFound)
+ return FALSE;
+ }
+ if(pFound && pFound->xResultSet.is() && !pFound->bAfterSelection)
+ {
+ sal_Int32 nOldRow = 0;
+ try
+ {
+ nOldRow = pFound->xResultSet->getRow();
+ }
+ catch(const Exception& )
+ {
+ return FALSE;
+ }
+ //position to the desired index
+ BOOL bMove = TRUE;
+ if ( nOldRow != static_cast<sal_Int32>(nAbsRecordId) )
+ bMove = lcl_MoveAbsolute(pFound, nAbsRecordId);
+ if(bMove)
+ {
+ bRet = lcl_GetColumnCnt(pFound, rColumnName, nLanguage, rResult, pNumber);
+ }
+ if ( nOldRow != static_cast<sal_Int32>(nAbsRecordId) )
+ bMove = lcl_MoveAbsolute(pFound, nOldRow);
+ }
+ return bRet;
+}
+/* -----------------------------06.07.00 16:47--------------------------------
+ reads the column data at the current position
+ ---------------------------------------------------------------------------*/
+BOOL SwNewDBMgr::GetMergeColumnCnt(const String& rColumnName, USHORT nLanguage,
+ String &rResult, double *pNumber, sal_uInt32 * /*pFormat*/)
+{
+ if(!pImpl->pMergeData || !pImpl->pMergeData->xResultSet.is() || pImpl->pMergeData->bAfterSelection )
+ {
+ rResult.Erase();
+ return FALSE;
+ }
+
+ BOOL bRet = lcl_GetColumnCnt(pImpl->pMergeData, rColumnName, nLanguage, rResult, pNumber);
+ return bRet;
+}
+/* -----------------------------07.07.00 14:28--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwNewDBMgr::ToNextMergeRecord()
+{
+ DBG_ASSERT(pImpl->pMergeData && pImpl->pMergeData->xResultSet.is(), "no data source in merge");
+ return ToNextRecord(pImpl->pMergeData);
+}
+/* -----------------------------10.07.01 14:28--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwNewDBMgr::ToNextRecord(
+ const String& rDataSource, const String& rCommand, sal_Int32 /*nCommandType*/)
+{
+ SwDSParam* pFound = 0;
+ if(pImpl->pMergeData &&
+ rDataSource == (String)pImpl->pMergeData->sDataSource &&
+ rCommand == (String)pImpl->pMergeData->sCommand)
+ pFound = pImpl->pMergeData;
+ else
+ {
+ SwDBData aData;
+ aData.sDataSource = rDataSource;
+ aData.sCommand = rCommand;
+ aData.nCommandType = -1;
+ pFound = FindDSData(aData, FALSE);
+ }
+ return ToNextRecord(pFound);
+}
+/* -----------------------------10.07.01 14:38--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwNewDBMgr::ToNextRecord(SwDSParam* pParam)
+{
+ BOOL bRet = TRUE;
+ if(!pParam || !pParam->xResultSet.is() || pParam->bEndOfDB ||
+ (pParam->aSelection.getLength() && pParam->aSelection.getLength() <= pParam->nSelectionIndex))
+ {
+ if(pParam)
+ pParam->CheckEndOfDB();
+ return FALSE;
+ }
+ try
+ {
+ if(pParam->aSelection.getLength())
+ {
+ sal_Int32 nPos = 0;
+ pParam->aSelection.getConstArray()[ pParam->nSelectionIndex++ ] >>= nPos;
+ pParam->bEndOfDB = !pParam->xResultSet->absolute( nPos );
+ pParam->CheckEndOfDB();
+ bRet = !pParam->bEndOfDB;
+ if(pParam->nSelectionIndex >= pParam->aSelection.getLength())
+ pParam->bEndOfDB = TRUE;
+ }
+ else
+ {
+ sal_Int32 nBefore = pParam->xResultSet->getRow();
+ pParam->bEndOfDB = !pParam->xResultSet->next();
+ if( !pParam->bEndOfDB && nBefore == pParam->xResultSet->getRow())
+ {
+ //next returned true but it didn't move
+ pParam->bEndOfDB = sal_True;
+ }
+
+ pParam->CheckEndOfDB();
+ bRet = !pParam->bEndOfDB;
+ ++pParam->nSelectionIndex;
+ }
+ }
+ catch(Exception&)
+ {
+ }
+ return bRet;
+}
+
+/* -----------------------------13.07.00 17:23--------------------------------
+ synchronized labels contain a next record field at their end
+ to assure that the next page can be created in mail merge
+ the cursor position must be validated
+ ---------------------------------------------------------------------------*/
+BOOL SwNewDBMgr::ExistsNextRecord() const
+{
+ return pImpl->pMergeData && !pImpl->pMergeData->bEndOfDB;
+}
+/* -----------------------------13.07.00 10:41--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_uInt32 SwNewDBMgr::GetSelectedRecordId()
+{
+ sal_uInt32 nRet = 0;
+ DBG_ASSERT(pImpl->pMergeData && pImpl->pMergeData->xResultSet.is(), "no data source in merge");
+ if(!pImpl->pMergeData || !pImpl->pMergeData->xResultSet.is())
+ return FALSE;
+ try
+ {
+ nRet = pImpl->pMergeData->xResultSet->getRow();
+ }
+ catch(Exception& )
+ {
+ }
+ return nRet;
+}
+/* -----------------------------13.07.00 10:58--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwNewDBMgr::ToRecordId(sal_Int32 nSet)
+{
+ DBG_ASSERT(pImpl->pMergeData && pImpl->pMergeData->xResultSet.is(), "no data source in merge");
+ if(!pImpl->pMergeData || !pImpl->pMergeData->xResultSet.is()|| nSet < 0)
+ return FALSE;
+ sal_Bool bRet = FALSE;
+ sal_Int32 nAbsPos = nSet;
+
+ if(nAbsPos >= 0)
+ {
+ bRet = lcl_MoveAbsolute(pImpl->pMergeData, nAbsPos);
+ pImpl->pMergeData->bEndOfDB = !bRet;
+ pImpl->pMergeData->CheckEndOfDB();
+ }
+ return bRet;
+}
+
+/* -----------------------------17.07.00 14:17--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwNewDBMgr::OpenDataSource(const String& rDataSource, const String& rTableOrQuery,
+ sal_Int32 nCommandType, bool bCreate)
+{
+ SwDBData aData;
+ aData.sDataSource = rDataSource;
+ aData.sCommand = rTableOrQuery;
+ aData.nCommandType = nCommandType;
+
+ SwDSParam* pFound = FindDSData(aData, TRUE);
+ uno::Reference< XDataSource> xSource;
+ if(pFound->xResultSet.is())
+ return TRUE;
+ SwDSParam* pParam = FindDSConnection(rDataSource, FALSE);
+ uno::Reference< XConnection> xConnection;
+ if(pParam && pParam->xConnection.is())
+ pFound->xConnection = pParam->xConnection;
+ else if(bCreate)
+ {
+ rtl::OUString sDataSource(rDataSource);
+ pFound->xConnection = RegisterConnection( sDataSource );
+ }
+ if(pFound->xConnection.is())
+ {
+ try
+ {
+ uno::Reference< sdbc::XDatabaseMetaData > xMetaData = pFound->xConnection->getMetaData();
+ try
+ {
+ pFound->bScrollable = xMetaData
+ ->supportsResultSetType((sal_Int32)ResultSetType::SCROLL_INSENSITIVE);
+ }
+ catch(Exception&)
+ {
+ //#98373# DB driver may not be ODBC 3.0 compliant
+ pFound->bScrollable = TRUE;
+ }
+ pFound->xStatement = pFound->xConnection->createStatement();
+ rtl::OUString aQuoteChar = xMetaData->getIdentifierQuoteString();
+ rtl::OUString sStatement(C2U("SELECT * FROM "));
+ sStatement = C2U("SELECT * FROM ");
+ sStatement += aQuoteChar;
+ sStatement += rTableOrQuery;
+ sStatement += aQuoteChar;
+ pFound->xResultSet = pFound->xStatement->executeQuery( sStatement );
+
+ //after executeQuery the cursor must be positioned
+ pFound->bEndOfDB = !pFound->xResultSet->next();
+ pFound->bAfterSelection = sal_False;
+ pFound->CheckEndOfDB();
+ ++pFound->nSelectionIndex;
+ }
+ catch (Exception&)
+ {
+ pFound->xResultSet = 0;
+ pFound->xStatement = 0;
+ pFound->xConnection = 0;
+ }
+ }
+ return pFound->xResultSet.is();
+}
+/* -----------------------------14.08.2001 10:26------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference< XConnection> SwNewDBMgr::RegisterConnection(rtl::OUString& rDataSource)
+{
+ SwDSParam* pFound = SwNewDBMgr::FindDSConnection(rDataSource, TRUE);
+ uno::Reference< XDataSource> xSource;
+ if(!pFound->xConnection.is())
+ {
+ pFound->xConnection = SwNewDBMgr::GetConnection(rDataSource, xSource );
+ try
+ {
+ uno::Reference<XComponent> xComponent(pFound->xConnection, UNO_QUERY);
+ if(xComponent.is())
+ xComponent->addEventListener(pImpl->xDisposeListener);
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ return pFound->xConnection;
+}
+/* -----------------------------17.07.00 15:55--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_uInt32 SwNewDBMgr::GetSelectedRecordId(
+ const String& rDataSource, const String& rTableOrQuery, sal_Int32 nCommandType)
+{
+ sal_uInt32 nRet = 0xffffffff;
+ //check for merge data source first
+ if(pImpl->pMergeData && rDataSource == (String)pImpl->pMergeData->sDataSource &&
+ rTableOrQuery == (String)pImpl->pMergeData->sCommand &&
+ (nCommandType == -1 || nCommandType == pImpl->pMergeData->nCommandType) &&
+ pImpl->pMergeData->xResultSet.is())
+ nRet = GetSelectedRecordId();
+ else
+ {
+ SwDBData aData;
+ aData.sDataSource = rDataSource;
+ aData.sCommand = rTableOrQuery;
+ aData.nCommandType = nCommandType;
+ SwDSParam* pFound = FindDSData(aData, FALSE);
+ if(pFound && pFound->xResultSet.is())
+ {
+ try
+ { //if a selection array is set the current row at the result set may not be set yet
+ if(pFound->aSelection.getLength())
+ {
+ sal_Int32 nSelIndex = pFound->nSelectionIndex;
+ if(nSelIndex >= pFound->aSelection.getLength())
+ nSelIndex = pFound->aSelection.getLength() -1;
+ pFound->aSelection.getConstArray()[nSelIndex] >>= nRet;
+
+ }
+ else
+ nRet = pFound->xResultSet->getRow();
+ }
+ catch(Exception&){}
+ }
+ }
+ return nRet;
+}
+
+/* -----------------------------17.07.00 14:18--------------------------------
+ close all data sources - after fields were updated
+ ---------------------------------------------------------------------------*/
+void SwNewDBMgr::CloseAll(BOOL bIncludingMerge)
+{
+ //the only thing done here is to reset the selection index
+ //all connections stay open
+ for(USHORT nPos = 0; nPos < aDataSourceParams.Count(); nPos++)
+ {
+ SwDSParam* pParam = aDataSourceParams[nPos];
+ if(bIncludingMerge || pParam != pImpl->pMergeData)
+ {
+ pParam->nSelectionIndex = 0;
+ pParam->bAfterSelection = sal_False;
+ pParam->bEndOfDB = sal_False;
+ try
+ {
+ if(!bInMerge && pParam->xResultSet.is())
+ pParam->xResultSet->first();
+ }
+ catch(Exception& )
+ {}
+ }
+ }
+}
+/* -----------------------------17.07.00 14:54--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwDSParam* SwNewDBMgr::FindDSData(const SwDBData& rData, BOOL bCreate)
+{
+ //prefer merge data if available
+ if(pImpl->pMergeData && rData.sDataSource == pImpl->pMergeData->sDataSource &&
+ rData.sCommand == pImpl->pMergeData->sCommand &&
+ (rData.nCommandType == -1 || rData.nCommandType == pImpl->pMergeData->nCommandType ||
+ (bCreate && pImpl->pMergeData->nCommandType == -1)))
+ {
+ return pImpl->pMergeData;
+ }
+
+ SwDSParam* pFound = 0;
+ for(USHORT nPos = aDataSourceParams.Count(); nPos; nPos--)
+ {
+ SwDSParam* pParam = aDataSourceParams[nPos - 1];
+ if(rData.sDataSource == pParam->sDataSource &&
+ rData.sCommand == pParam->sCommand &&
+ (rData.nCommandType == -1 || rData.nCommandType == pParam->nCommandType ||
+ (bCreate && pParam->nCommandType == -1)))
+ {
+ //#94779# calls from the calculator may add a connection with an invalid commandtype
+ //later added "real" data base connections have to re-use the already available
+ //DSData and set the correct CommandType
+ if(bCreate && pParam->nCommandType == -1)
+ pParam->nCommandType = rData.nCommandType;
+ pFound = pParam;
+ break;
+ }
+ }
+ if(bCreate)
+ {
+ if(!pFound)
+ {
+ pFound = new SwDSParam(rData);
+ aDataSourceParams.Insert(pFound, aDataSourceParams.Count());
+ try
+ {
+ uno::Reference<XComponent> xComponent(pFound->xConnection, UNO_QUERY);
+ if(xComponent.is())
+ xComponent->addEventListener(pImpl->xDisposeListener);
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ }
+ return pFound;
+}
+/* -----------------------------14.08.2001 10:27------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+SwDSParam* SwNewDBMgr::FindDSConnection(const rtl::OUString& rDataSource, BOOL bCreate)
+{
+ //prefer merge data if available
+ if(pImpl->pMergeData && rDataSource == pImpl->pMergeData->sDataSource )
+ {
+ return pImpl->pMergeData;
+ }
+ SwDSParam* pFound = 0;
+ for(USHORT nPos = 0; nPos < aDataSourceParams.Count(); nPos++)
+ {
+ SwDSParam* pParam = aDataSourceParams[nPos];
+ if(rDataSource == pParam->sDataSource)
+ {
+ pFound = pParam;
+ break;
+ }
+ }
+ if(bCreate && !pFound)
+ {
+ SwDBData aData;
+ aData.sDataSource = rDataSource;
+ pFound = new SwDSParam(aData);
+ aDataSourceParams.Insert(pFound, aDataSourceParams.Count());
+ try
+ {
+ uno::Reference<XComponent> xComponent(pFound->xConnection, UNO_QUERY);
+ if(xComponent.is())
+ xComponent->addEventListener(pImpl->xDisposeListener);
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ return pFound;
+}
+
+/* -----------------------------17.07.00 14:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const SwDBData& SwNewDBMgr::GetAddressDBName()
+{
+ return SW_MOD()->GetDBConfig()->GetAddressSource();
+}
+/* -----------------------------18.07.00 13:13--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence<rtl::OUString> SwNewDBMgr::GetExistingDatabaseNames()
+{
+ uno::Reference<XNameAccess> xDBContext;
+ uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ if( xMgr.is() )
+ {
+ uno::Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.sdb.DatabaseContext" ));
+ xDBContext = uno::Reference<XNameAccess>(xInstance, UNO_QUERY) ;
+ }
+ if(xDBContext.is())
+ {
+ return xDBContext->getElementNames();
+ }
+ return Sequence<rtl::OUString>();
+}
+/*-- 26.05.2004 14:33:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+String SwNewDBMgr::LoadAndRegisterDataSource()
+{
+ sfx2::FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 );
+ Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+
+ String sHomePath(SvtPathOptions().GetWorkPath());
+ aDlgHelper.SetDisplayDirectory( sHomePath );
+
+ Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
+
+ String sFilterAll(SW_RES(STR_FILTER_ALL));
+ String sFilterAllData(SW_RES(STR_FILTER_ALL_DATA));
+ String sFilterSXB(SW_RES(STR_FILTER_SXB));
+ String sFilterSXC(SW_RES(STR_FILTER_SXC));
+ String sFilterDBF(SW_RES(STR_FILTER_DBF));
+ String sFilterXLS(SW_RES(STR_FILTER_XLS));
+ String sFilterTXT(SW_RES(STR_FILTER_TXT));
+ String sFilterCSV(SW_RES(STR_FILTER_CSV));
+#ifdef WNT
+ String sFilterMDB(SW_RES(STR_FILTER_MDB));
+ String sFilterACCDB(SW_RES(STR_FILTER_ACCDB));
+#endif
+ xFltMgr->appendFilter( sFilterAll, C2U("*") );
+ xFltMgr->appendFilter( sFilterAllData, C2U("*.ods;*.sxc;*.dbf;*.xls;*.txt;*.csv"));
+
+ xFltMgr->appendFilter( sFilterSXB, C2U("*.odb") );
+ xFltMgr->appendFilter( sFilterSXC, C2U("*.ods;*.sxc") );
+ xFltMgr->appendFilter( sFilterDBF, C2U("*.dbf") );
+ xFltMgr->appendFilter( sFilterXLS, C2U("*.xls") );
+ xFltMgr->appendFilter( sFilterTXT, C2U("*.txt") );
+ xFltMgr->appendFilter( sFilterCSV, C2U("*.csv") );
+#ifdef WNT
+ xFltMgr->appendFilter( sFilterMDB, C2U("*.mdb") );
+ xFltMgr->appendFilter( sFilterACCDB, C2U("*.accdb") );
+#endif
+
+ xFltMgr->setCurrentFilter( sFilterAll ) ;
+ String sFind;
+ bool bTextConnection = false;
+ if( ERRCODE_NONE == aDlgHelper.Execute() )
+ {
+ String sURL = xFP->getFiles().getConstArray()[0];
+ //data sources have to be registered depending on their extensions
+ INetURLObject aURL( sURL );
+ String sExt( aURL.GetExtension() );
+ Any aURLAny;
+ Any aTableFilterAny;
+ Any aSuppressVersionsAny;
+ Any aInfoAny;
+ INetURLObject aTempURL(aURL);
+ bool bStore = true;
+ if(sExt.EqualsAscii("odb"))
+ {
+ bStore = false;
+ }
+ else if(sExt.EqualsIgnoreCaseAscii("sxc")
+ || sExt.EqualsIgnoreCaseAscii("ods")
+ || sExt.EqualsIgnoreCaseAscii("xls"))
+ {
+ rtl::OUString sDBURL(C2U("sdbc:calc:"));
+ sDBURL += aTempURL.GetMainURL(INetURLObject::NO_DECODE);
+ aURLAny <<= sDBURL;
+ }
+ else if(sExt.EqualsIgnoreCaseAscii("dbf"))
+ {
+ aTempURL.removeSegment();
+ aTempURL.removeFinalSlash();
+ rtl::OUString sDBURL(C2U("sdbc:dbase:"));
+ sDBURL += aTempURL.GetMainURL(INetURLObject::NO_DECODE);
+ aURLAny <<= sDBURL;
+ //set the filter to the file name without extension
+ Sequence<rtl::OUString> aFilters(1);
+ rtl::OUString sTmp(aURL.getBase());
+ aFilters[0] = aURL.getBase();
+ aTableFilterAny <<= aFilters;
+ }
+ else if(sExt.EqualsIgnoreCaseAscii("csv") || sExt.EqualsIgnoreCaseAscii("txt"))
+ {
+ aTempURL.removeSegment();
+ aTempURL.removeFinalSlash();
+ rtl::OUString sDBURL(C2U("sdbc:flat:"));
+ //only the 'path' has to be added
+ sDBURL += aTempURL.GetMainURL(INetURLObject::NO_DECODE);
+ aURLAny <<= sDBURL;
+
+ bTextConnection = true;
+ //set the filter to the file name without extension
+ Sequence<rtl::OUString> aFilters(1);
+ rtl::OUString sTmp(aURL.getBase());
+ aFilters[0] = aURL.getBase();
+ aTableFilterAny <<= aFilters;
+ }
+#ifdef WNT
+ else if(sExt.EqualsIgnoreCaseAscii("mdb"))
+ {
+ rtl::OUString sDBURL(C2U("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="));
+ sDBURL += aTempURL.PathToFileName();
+ aURLAny <<= sDBURL;
+ aSuppressVersionsAny <<= makeAny(true);
+ }
+ else if(sExt.EqualsIgnoreCaseAscii("accdb"))
+ {
+ rtl::OUString sDBURL(C2U("sdbc:ado:PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE="));
+ sDBURL += aTempURL.PathToFileName();
+ aURLAny <<= sDBURL;
+ aSuppressVersionsAny <<= makeAny(true);
+ }
+#endif
+ try
+ {
+ Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.sdb.DatabaseContext" ));
+ Reference<XNameAccess> xDBContext(xInstance, UNO_QUERY_THROW);
+ Reference<XSingleServiceFactory> xFact( xDBContext, UNO_QUERY);
+
+ String sNewName = INetURLObject::decode( aURL.getName(),
+ INET_HEX_ESCAPE,
+ INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 );
+ xub_StrLen nExtLen = static_cast< xub_StrLen >(aURL.GetExtension().getLength());
+ sNewName.Erase( sNewName.Len() - nExtLen - 1, nExtLen + 1 );
+
+ //find a unique name if sNewName already exists
+ sFind = sNewName;
+ sal_Int32 nIndex = 0;
+ while(xDBContext->hasByName(sFind))
+ {
+ sFind = sNewName;
+ sFind += String::CreateFromInt32(++nIndex);
+ }
+
+ Reference<XInterface> xNewInstance;
+ if(!bStore)
+ {
+ //odb-file
+ Any aDataSource = xDBContext->getByName(aTempURL.GetMainURL(INetURLObject::NO_DECODE));
+ aDataSource >>= xNewInstance;
+ }
+ else
+ {
+ xNewInstance = xFact->createInstance();
+ Reference<XPropertySet> xDataProperties(xNewInstance, UNO_QUERY);
+
+ if(aURLAny.hasValue())
+ xDataProperties->setPropertyValue(C2U("URL"), aURLAny);
+ if(aTableFilterAny.hasValue())
+ xDataProperties->setPropertyValue(C2U("TableFilter"), aTableFilterAny);
+ if(aSuppressVersionsAny.hasValue())
+ xDataProperties->setPropertyValue(C2U("SuppressVersionColumns"), aSuppressVersionsAny);
+ if(aInfoAny.hasValue())
+ xDataProperties->setPropertyValue(C2U("Info"), aInfoAny);
+
+ if( bTextConnection )
+ {
+ uno::Reference < ui::dialogs::XExecutableDialog > xSettingsDlg(
+ xMgr->createInstance( C2U( "com.sun.star.sdb.TextConnectionSettings" ) ), uno::UNO_QUERY);
+ if( xSettingsDlg->execute() )
+ {
+ uno::Any aSettings = xDataProperties->getPropertyValue( C2U( "Settings" ) );
+ uno::Reference < beans::XPropertySet > xDSSettings;
+ aSettings >>= xDSSettings;
+ ::comphelper::copyProperties(
+ uno::Reference < beans::XPropertySet >( xSettingsDlg, uno::UNO_QUERY ),
+ xDSSettings );
+ xDSSettings->setPropertyValue( C2U("Extension"), uno::makeAny( ::rtl::OUString( sExt )));
+ }
+ }
+
+ Reference<XDocumentDataSource> xDS(xNewInstance, UNO_QUERY_THROW);
+ Reference<XStorable> xStore(xDS->getDatabaseDocument(), UNO_QUERY_THROW);
+ String sOutputExt = String::CreateFromAscii(".odb");
+ String sTmpName;
+ {
+ utl::TempFile aTempFile(sNewName , &sOutputExt, &sHomePath);
+ aTempFile.EnableKillingFile(sal_True);
+ sTmpName = aTempFile.GetURL();
+ }
+ xStore->storeAsURL(sTmpName, Sequence< PropertyValue >());
+ }
+ Reference<XNamingService> xNaming(xDBContext, UNO_QUERY);
+ xNaming->registerObject( sFind, xNewInstance );
+
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ return sFind;
+
+}
+/* -----------------------------10.11.00 17:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNewDBMgr::ExecuteFormLetter( SwWrtShell& rSh,
+ const Sequence<PropertyValue>& rProperties,
+ BOOL bWithDataSourceBrowser)
+{
+ //prevent second call
+ if(pImpl->pMergeDialog)
+ return ;
+ rtl::OUString sDataSource, sDataTableOrQuery;
+ Sequence<Any> aSelection;
+
+ sal_Int16 nCmdType = CommandType::TABLE;
+ uno::Reference< XConnection> xConnection;
+
+ ODataAccessDescriptor aDescriptor(rProperties);
+ sDataSource = aDescriptor.getDataSource();
+ aDescriptor[daCommand] >>= sDataTableOrQuery;
+ aDescriptor[daCommandType] >>= nCmdType;
+
+ if ( aDescriptor.has(daSelection) )
+ aDescriptor[daSelection] >>= aSelection;
+ if ( aDescriptor.has(daConnection) )
+ aDescriptor[daConnection] >>= xConnection;
+
+ if(!sDataSource.getLength() || !sDataTableOrQuery.getLength())
+ {
+ DBG_ERROR("PropertyValues missing or unset");
+ return;
+ }
+
+ //always create a connection for the dialog and dispose it after the dialog has been closed
+ SwDSParam* pFound = 0;
+ if(!xConnection.is())
+ {
+ xConnection = SwNewDBMgr::RegisterConnection(sDataSource);
+ pFound = FindDSConnection(sDataSource, TRUE);
+ }
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ pImpl->pMergeDialog = pFact->CreateMailMergeDlg( DLG_MAILMERGE,
+ &rSh.GetView().GetViewFrame()->GetWindow(), rSh,
+ sDataSource,
+ sDataTableOrQuery,
+ nCmdType,
+ xConnection,
+ bWithDataSourceBrowser ? 0 : &aSelection);
+ DBG_ASSERT(pImpl->pMergeDialog, "Dialogdiet fail!");
+ if(pImpl->pMergeDialog->Execute() == RET_OK)
+ {
+ aDescriptor[daSelection] <<= pImpl->pMergeDialog->GetSelection();
+
+ uno::Reference<XResultSet> xResSet = pImpl->pMergeDialog->GetResultSet();
+ if(xResSet.is())
+ aDescriptor[daCursor] <<= xResSet;
+
+ // SfxObjectShellRef is ok, since there should be no control over the document lifetime here
+ SfxObjectShellRef xDocShell = rSh.GetView().GetViewFrame()->GetObjectShell();
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xDocShell));
+ {
+ //copy rSh to aTempFile
+ ::rtl::OUString sTempURL;
+ const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat(
+ String::CreateFromAscii( FILTER_XML ),
+ SwDocShell::Factory().GetFilterContainer() );
+ try
+ {
+
+ uno::Sequence< beans::PropertyValue > aValues(1);
+ beans::PropertyValue* pValues = aValues.getArray();
+ pValues[0].Name = C2U("FilterName");
+ pValues[0].Value <<= ::rtl::OUString(pSfxFlt->GetFilterName());
+ uno::Reference< frame::XStorable > xStore( xDocShell->GetModel(), uno::UNO_QUERY);
+ sTempURL = URIHelper::SmartRel2Abs( INetURLObject(), utl::TempFile::CreateTempName() );
+ xStore->storeToURL( sTempURL, aValues );
+ }
+ catch( const uno::Exception& rEx )
+ {
+ (void) rEx;
+ }
+ if( xDocShell->GetError() )
+ {
+ // error message ??
+ ErrorHandler::HandleError( xDocShell->GetError() );
+ }
+ else
+ {
+ // the shell will be explicitly closed, but it is more safe to use SfxObjectShellLock here
+ // especially for the case that the loading has failed
+ SfxObjectShellLock xWorkDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL ));
+ SfxMedium* pWorkMed = new SfxMedium( sTempURL, STREAM_STD_READ, TRUE );
+ pWorkMed->SetFilter( pSfxFlt );
+ if( xWorkDocSh->DoLoad(pWorkMed) )
+ {
+ SfxViewFrame *pFrame = SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 );
+ SwView *pView = (SwView*) pFrame->GetViewShell();
+ pView->AttrChangedNotify( &pView->GetWrtShell() );//Damit SelectShell gerufen wird.
+ //set the current DBMgr
+ SwDoc* pWorkDoc = pView->GetWrtShell().GetDoc();
+ SwNewDBMgr* pWorkDBMgr = pWorkDoc->GetNewDBMgr();
+ pWorkDoc->SetNewDBMgr( this );
+
+ SwMergeDescriptor aMergeDesc( pImpl->pMergeDialog->GetMergeType(), pView->GetWrtShell(), aDescriptor );
+ aMergeDesc.sSaveToFilter = pImpl->pMergeDialog->GetSaveFilter();
+ aMergeDesc.bCreateSingleFile= true;
+ MergeNew(aMergeDesc);
+
+ pWorkDoc->SetNewDBMgr( pWorkDBMgr );
+ //close the temporary file
+ uno::Reference< util::XCloseable > xClose( xWorkDocSh->GetModel(), uno::UNO_QUERY );
+ if (xClose.is())
+ {
+ try
+ {
+ //! 'sal_True' -> transfer ownership to vetoing object if vetoed!
+ //! I.e. now that object is responsible for closing the model and doc shell.
+ xClose->close( sal_True );
+ }
+ catch ( const uno::Exception& )
+ {
+ }
+ }
+ }
+ }
+ //remove the temporary file
+ SWUnoHelper::UCB_DeleteFile( sTempURL );
+ }
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), rSh.GetView().GetViewFrame()->GetObjectShell()));
+
+ // reset the cursor inside
+ xResSet = NULL;
+ aDescriptor[daCursor] <<= xResSet;
+ }
+ if(pFound)
+ {
+ for(USHORT nPos = 0; nPos < aDataSourceParams.Count(); nPos++)
+ {
+ SwDSParam* pParam = aDataSourceParams[nPos];
+ if(pParam == pFound)
+ {
+ try
+ {
+ uno::Reference<XComponent> xComp(pParam->xConnection, UNO_QUERY);
+ if(xComp.is())
+ xComp->dispose();
+ }
+ catch(const RuntimeException& )
+ {
+ //may be disposed already since multiple entries may have used the same connection
+ }
+ break;
+ }
+ //pFound doesn't need to be removed/deleted -
+ //this has been done by the SwConnectionDisposedListener_Impl already
+ }
+ }
+ DELETEZ(pImpl->pMergeDialog);
+}
+/* -----------------------------13.11.00 08:20--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNewDBMgr::InsertText(SwWrtShell& rSh,
+ const Sequence< PropertyValue>& rProperties)
+{
+ rtl::OUString sDataSource, sDataTableOrQuery;
+ uno::Reference<XResultSet> xResSet;
+ Sequence<Any> aSelection;
+ BOOL bHasSelectionProperty = FALSE;
+ sal_Int32 nSelectionPos = 0;
+ sal_Int16 nCmdType = CommandType::TABLE;
+ const PropertyValue* pValues = rProperties.getConstArray();
+ uno::Reference< XConnection> xConnection;
+ for(sal_Int32 nPos = 0; nPos < rProperties.getLength(); nPos++)
+ {
+ if(pValues[nPos].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cDataSourceName)))
+ pValues[nPos].Value >>= sDataSource;
+ else if(pValues[nPos].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cCommand)))
+ pValues[nPos].Value >>= sDataTableOrQuery;
+ else if(pValues[nPos].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cCursor)))
+ pValues[nPos].Value >>= xResSet;
+ else if(pValues[nPos].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cSelection)))
+ {
+ bHasSelectionProperty = TRUE;
+ nSelectionPos = nPos;
+ pValues[nPos].Value >>= aSelection;
+ }
+ else if(pValues[nPos].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cCommandType)))
+ pValues[nPos].Value >>= nCmdType;
+ else if(pValues[nPos].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(cActiveConnection)))
+ pValues[nPos].Value >>= xConnection;
+ }
+ if(!sDataSource.getLength() || !sDataTableOrQuery.getLength() || !xResSet.is())
+ {
+ DBG_ERROR("PropertyValues missing or unset");
+ return;
+ }
+ uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ uno::Reference<XDataSource> xSource;
+ uno::Reference<XChild> xChild(xConnection, UNO_QUERY);
+ if(xChild.is())
+ xSource = uno::Reference<XDataSource>(xChild->getParent(), UNO_QUERY);
+ if(!xSource.is())
+ xSource = SwNewDBMgr::GetDbtoolsClient().getDataSource(sDataSource, xMgr);
+ uno::Reference< XColumnsSupplier > xColSupp( xResSet, UNO_QUERY );
+ SwDBData aDBData;
+ aDBData.sDataSource = sDataSource;
+ aDBData.sCommand = sDataTableOrQuery;
+ aDBData.nCommandType = nCmdType;
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwInsertDBColAutoPilot* pDlg = pFact->CreateSwInsertDBColAutoPilot( rSh.GetView(),
+ xSource,
+ xColSupp,
+ aDBData,
+ DLG_AP_INSERT_DB_SEL );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if( RET_OK == pDlg->Execute() )
+ {
+ rtl::OUString sDummy;
+ if(!xConnection.is())
+ xConnection = xSource->getConnection(sDummy, sDummy);
+ try
+ {
+ pDlg->DataToDoc( aSelection , xSource, xConnection, xResSet);
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("exception caught");
+ }
+ }
+ delete pDlg;
+
+}
+/* -----------------------------30.08.2001 12:00------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwDbtoolsClient* SwNewDBMgr::pDbtoolsClient = NULL;
+
+SwDbtoolsClient& SwNewDBMgr::GetDbtoolsClient()
+{
+ if ( !pDbtoolsClient )
+ pDbtoolsClient = new SwDbtoolsClient;
+ return *pDbtoolsClient;
+}
+/* -----------------13.05.2003 15:34-----------------
+
+ --------------------------------------------------*/
+void SwNewDBMgr::RemoveDbtoolsClient()
+{
+ delete pDbtoolsClient;
+ pDbtoolsClient = 0;
+}
+/* -----------------------------20.08.2002 12:00------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference<XDataSource> SwNewDBMgr::getDataSourceAsParent(const uno::Reference< XConnection>& _xConnection,const ::rtl::OUString& _sDataSourceName)
+{
+ uno::Reference<XDataSource> xSource;
+ try
+ {
+ uno::Reference<XChild> xChild(_xConnection, UNO_QUERY);
+ if ( xChild.is() )
+ xSource = uno::Reference<XDataSource>(xChild->getParent(), UNO_QUERY);
+ if ( !xSource.is() )
+ xSource = SwNewDBMgr::GetDbtoolsClient().getDataSource(_sDataSourceName, ::comphelper::getProcessServiceFactory());
+ }
+ catch(const Exception&)
+ {
+ DBG_ERROR("exception in getDataSourceAsParent caught");
+ }
+ return xSource;
+}
+/* -----------------------------20.08.2002 12:00------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference<XResultSet> SwNewDBMgr::createCursor(const ::rtl::OUString& _sDataSourceName,
+ const ::rtl::OUString& _sCommand,
+ sal_Int32 _nCommandType,
+ const uno::Reference<XConnection>& _xConnection
+ )
+{
+ uno::Reference<XResultSet> xResultSet;
+ try
+ {
+ uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ if( xMgr.is() )
+ {
+ uno::Reference<XInterface> xInstance = xMgr->createInstance(
+ C2U( "com.sun.star.sdb.RowSet" ));
+ uno::Reference<XPropertySet> xRowSetPropSet(xInstance, UNO_QUERY);
+ if(xRowSetPropSet.is())
+ {
+ xRowSetPropSet->setPropertyValue(C2U("DataSourceName"), makeAny(_sDataSourceName));
+ xRowSetPropSet->setPropertyValue(C2U("ActiveConnection"), makeAny(_xConnection));
+ xRowSetPropSet->setPropertyValue(C2U("Command"), makeAny(_sCommand));
+ xRowSetPropSet->setPropertyValue(C2U("CommandType"), makeAny(_nCommandType));
+
+ uno::Reference< XCompletedExecution > xRowSet(xInstance, UNO_QUERY);
+
+ if ( xRowSet.is() )
+ {
+ uno::Reference< XInteractionHandler > xHandler(xMgr->createInstance(C2U("com.sun.star.task.InteractionHandler")), UNO_QUERY);
+ xRowSet->executeWithCompletion(xHandler);
+ }
+ xResultSet = uno::Reference<XResultSet>(xRowSet, UNO_QUERY);
+ }
+ }
+ }
+ catch(const Exception&)
+ {
+ DBG_ASSERT(0,"Caught exception while creating a new RowSet!");
+ }
+ return xResultSet;
+}
+/*-- 13.05.2004 16:14:15---------------------------------------------------
+ merge all data into one resulting document and return the number of
+ merged documents
+ -----------------------------------------------------------------------*/
+
+sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig,
+ SwView& rSourceView )
+{
+ // check the availability of all data in the config item
+ uno::Reference< XResultSet> xResultSet = rMMConfig.GetResultSet();
+ if(!xResultSet.is())
+ return false;
+ bInMerge = TRUE;
+ sal_Int32 nRet = 0;
+ pImpl->pMergeData = new SwDSParam(
+ rMMConfig.GetCurrentDBData(), xResultSet, rMMConfig.GetSelection());
+
+ try{
+ //set to start position
+ if(pImpl->pMergeData->aSelection.getLength())
+ {
+ sal_Int32 nPos = 0;
+ pImpl->pMergeData->aSelection.getConstArray()[ pImpl->pMergeData->nSelectionIndex++ ] >>= nPos;
+ pImpl->pMergeData->bEndOfDB = !pImpl->pMergeData->xResultSet->absolute( nPos );
+ pImpl->pMergeData->CheckEndOfDB();
+ if(pImpl->pMergeData->nSelectionIndex >= pImpl->pMergeData->aSelection.getLength())
+ pImpl->pMergeData->bEndOfDB = TRUE;
+ }
+ else
+ {
+ pImpl->pMergeData->bEndOfDB = !pImpl->pMergeData->xResultSet->first();
+ pImpl->pMergeData->CheckEndOfDB();
+ }
+ }
+ catch(Exception&)
+ {
+ pImpl->pMergeData->bEndOfDB = TRUE;
+ pImpl->pMergeData->CheckEndOfDB();
+ DBG_ERROR("exception in MergeNew()");
+ }
+
+ //bCancel is set from the PrintMonitor
+ bCancel = FALSE;
+
+ CreateMonitor aMonitorDlg(&rSourceView.GetEditWin());
+ aMonitorDlg.SetCancelHdl(LINK(this, SwNewDBMgr, PrtCancelHdl));
+ if (!IsMergeSilent())
+ {
+ aMonitorDlg.Show();
+ aMonitorDlg.Invalidate();
+ aMonitorDlg.Update();
+ // the print monitor needs some time to act
+ for( USHORT i = 0; i < 25; i++)
+ Application::Reschedule();
+ }
+
+ SwWrtShell& rSourceShell = rSourceView.GetWrtShell();
+ BOOL bSynchronizedDoc = rSourceShell.IsLabelDoc() && rSourceShell.GetSectionFmtCount() > 1;
+ //save the settings of the first
+ rSourceShell.SttEndDoc(TRUE);
+ USHORT nStartingPageNo = rSourceShell.GetVirtPageNum();
+ String sModifiedStartingPageDesc;
+ String sStartingPageDesc = sModifiedStartingPageDesc = rSourceShell.GetPageDesc(
+ rSourceShell.GetCurPageDesc()).GetName();
+
+ try
+ {
+ // create a target docshell to put the merged document into
+ SfxObjectShellRef xTargetDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) );
+ xTargetDocShell->DoInitNew( 0 );
+ SfxViewFrame* pTargetFrame = SfxViewFrame::LoadHiddenDocument( *xTargetDocShell, 0 );
+
+ //the created window has to be located at the same position as the source window
+ Window& rTargetWindow = pTargetFrame->GetFrame().GetWindow();
+ Window& rSourceWindow = rSourceView.GetViewFrame()->GetFrame().GetWindow();
+ rTargetWindow.SetPosPixel(rSourceWindow.GetPosPixel());
+
+// pTargetFrame->GetFrame().Appear();
+ SwView* pTargetView = static_cast<SwView*>( pTargetFrame->GetViewShell() );
+ rMMConfig.SetTargetView(pTargetView);
+ //initiate SelectShell() to create sub shells
+ pTargetView->AttrChangedNotify( &pTargetView->GetWrtShell() );
+ SwWrtShell* pTargetShell = pTargetView->GetWrtShellPtr();
+ // #i63806#
+ const SwPageDesc* pSourcePageDesc = rSourceShell.FindPageDescByName( sStartingPageDesc );
+ const SwFrmFmt& rMaster = pSourcePageDesc->GetMaster();
+ bool bPageStylesWithHeaderFooter = rMaster.GetHeader().IsActive() ||
+ rMaster.GetFooter().IsActive();
+
+
+ // #122799# copy compatibility options
+ lcl_CopyCompatibilityOptions( rSourceShell, *pTargetShell);
+ // #72821# copy dynamic defaults
+ lcl_CopyDynamicDefaults( *rSourceShell.GetDoc(), *pTargetShell->GetDoc() );
+
+
+ long nStartRow, nEndRow;
+ ULONG nDocNo = 1;
+ sal_Int32 nDocCount = 0;
+ if( !IsMergeSilent() && lcl_getCountFromResultSet( nDocCount, pImpl->pMergeData->xResultSet ) )
+ aMonitorDlg.SetTotalCount( nDocCount );
+
+ do
+ {
+ nStartRow = pImpl->pMergeData->xResultSet->getRow();
+ if (!IsMergeSilent())
+ {
+ aMonitorDlg.SetCurrentPosition( nDocNo );
+ aMonitorDlg.Invalidate();
+ aMonitorDlg.Update();
+ // the print monitor needs some time to act
+ for( USHORT i = 0; i < 25; i++)
+ Application::Reschedule();
+ }
+
+ // copy the source document
+ // the copy will be closed later, but it is more safe to use SfxObjectShellLock here
+ SfxObjectShellLock xWorkDocSh;
+ if(nDocNo == 1 )
+ {
+ uno::Reference< util::XCloneable > xClone( rSourceView.GetDocShell()->GetModel(), uno::UNO_QUERY);
+ uno::Reference< lang::XUnoTunnel > xWorkDocShell( xClone->createClone(), uno::UNO_QUERY);
+ SwXTextDocument* pWorkModel = reinterpret_cast<SwXTextDocument*>(xWorkDocShell->getSomething(SwXTextDocument::getUnoTunnelId()));
+ xWorkDocSh = pWorkModel->GetDocShell();
+ }
+ else
+ {
+ xWorkDocSh = rSourceView.GetDocShell()->GetDoc()->CreateCopy(true);
+ }
+ //create a ViewFrame
+ SwView* pWorkView = static_cast< SwView* >( SfxViewFrame::LoadHiddenDocument( *xWorkDocSh, 0 )->GetViewShell() );
+ SwWrtShell& rWorkShell = pWorkView->GetWrtShell();
+ pWorkView->AttrChangedNotify( &rWorkShell );//Damit SelectShell gerufen wird.
+
+ // merge the data
+ SwDoc* pWorkDoc = rWorkShell.GetDoc();
+ SwNewDBMgr* pWorkDBMgr = pWorkDoc->GetNewDBMgr();
+ pWorkDoc->SetNewDBMgr( this );
+ pWorkDoc->EmbedAllLinks();
+ SwUndoId nLastUndoId(UNDO_EMPTY);
+ if (rWorkShell.GetLastUndoInfo(0, & nLastUndoId))
+ {
+ if (UNDO_UI_DELETE_INVISIBLECNTNT == nLastUndoId)
+ {
+ rWorkShell.Undo();
+ }
+ }
+ // #i69485# lock fields to prevent access to the result set while calculating layout
+ rWorkShell.LockExpFlds();
+ // create a layout
+ rWorkShell.CalcLayout();
+ rWorkShell.UnlockExpFlds();
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE), rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
+ rWorkShell.ViewShell::UpdateFlds();
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_FIELD_MERGE_FINISHED, SwDocShell::GetEventName(STR_SW_EVENT_FIELD_MERGE_FINISHED), rWorkShell.GetView().GetViewFrame()->GetObjectShell()));
+
+ // strip invisible content and convert fields to text
+ rWorkShell.RemoveInvisibleContent();
+ rWorkShell.ConvertFieldsToText();
+ rWorkShell.SetNumberingRestart();
+ if( bSynchronizedDoc )
+ {
+ lcl_RemoveSectionLinks( rWorkShell );
+ }
+
+ // insert the document into the target document
+ rWorkShell.SttEndDoc(FALSE);
+ rWorkShell.SttEndDoc(TRUE);
+ rWorkShell.SelAll();
+ pTargetShell->SttEndDoc(FALSE);
+
+ //#i63806# put the styles to the target document
+ //if the source uses headers or footers each new copy need to copy a new page styles
+ if(bPageStylesWithHeaderFooter)
+ {
+ //create a new pagestyle
+ //copy the pagedesc from the current document to the new document and change the name of the to-be-applied style
+
+ SwDoc* pTargetDoc = pTargetShell->GetDoc();
+ String sNewPageDescName = lcl_FindUniqueName(pTargetShell, sStartingPageDesc, nDocNo );
+ pTargetShell->GetDoc()->MakePageDesc( sNewPageDescName );
+ SwPageDesc* pTargetPageDesc = pTargetShell->FindPageDescByName( sNewPageDescName );
+ const SwPageDesc* pWorkPageDesc = rWorkShell.FindPageDescByName( sStartingPageDesc );
+
+ if(pWorkPageDesc && pTargetPageDesc)
+ {
+ pTargetDoc->CopyPageDesc( *pWorkPageDesc, *pTargetPageDesc, sal_False );
+ sModifiedStartingPageDesc = sNewPageDescName;
+ lcl_CopyFollowPageDesc( *pTargetShell, *pWorkPageDesc, *pTargetPageDesc, nDocNo );
+ }
+ }
+ if(nDocNo == 1 || bPageStylesWithHeaderFooter)
+ {
+ pTargetView->GetDocShell()->_LoadStyles( *rSourceView.GetDocShell(), sal_True );
+ }
+ if(nDocNo > 1)
+ {
+ pTargetShell->InsertPageBreak( &sModifiedStartingPageDesc, nStartingPageNo );
+ }
+ else
+ {
+ pTargetShell->SetPageStyle(sModifiedStartingPageDesc);
+ }
+ USHORT nPageCountBefore = pTargetShell->GetPageCnt();
+ DBG_ASSERT(!pTargetShell->GetTableFmt(),"target document ends with a table - paragraph should be appended");
+ //#i51359# add a second paragraph in case there's only one
+ {
+ SwNodeIndex aIdx( pWorkDoc->GetNodes().GetEndOfExtras(), 2 );
+ SwPosition aTestPos( aIdx );
+ SwCursor aTestCrsr(aTestPos,0,false);
+ if(!aTestCrsr.MovePara(fnParaNext, fnParaStart))
+ {
+ //append a paragraph
+ pWorkDoc->AppendTxtNode( aTestPos );
+ }
+ }
+ pTargetShell->Paste( rWorkShell.GetDoc(), sal_True );
+ //convert fields in page styles (header/footer - has to be done after the first document has been pasted
+ if(1 == nDocNo)
+ {
+ pTargetShell->CalcLayout();
+ pTargetShell->ConvertFieldsToText();
+ }
+ //add the document info to the config item
+ SwDocMergeInfo aMergeInfo;
+ aMergeInfo.nStartPageInTarget = nPageCountBefore;
+ //#i72820# calculate layout to be able to find the correct page index
+ pTargetShell->CalcLayout();
+ aMergeInfo.nEndPageInTarget = pTargetShell->GetPageCnt();
+ aMergeInfo.nDBRow = nStartRow;
+ rMMConfig.AddMergedDocument( aMergeInfo );
+ ++nRet;
+
+ // the print monitor needs some time to act
+ for( USHORT i = 0; i < 25; i++)
+ Application::Reschedule();
+
+ //restore the ole DBMgr
+ pWorkDoc->SetNewDBMgr( pWorkDBMgr );
+ //now the temporary document should be closed
+ SfxObjectShellRef xDocSh(pWorkView->GetDocShell());
+ xDocSh->DoClose();
+ nEndRow = pImpl->pMergeData->xResultSet->getRow();
+ ++nDocNo;
+ } while( !bCancel &&
+ (bSynchronizedDoc && (nStartRow != nEndRow)? ExistsNextRecord() : ToNextMergeRecord()));
+
+ //deselect all, go out of the frame and go to the beginning of the document
+ Point aPt(LONG_MIN, LONG_MIN);
+ pTargetShell->SelectObj(aPt, SW_LEAVE_FRAME);
+ if (pTargetShell->IsSelFrmMode())
+ {
+ pTargetShell->UnSelectFrm();
+ pTargetShell->LeaveSelFrmMode();
+ }
+ pTargetShell->EnterStdMode();
+ pTargetShell->SttDoc();
+ //
+ }
+ catch( Exception& rEx)
+ {
+ (void)rEx;
+ DBG_ERROR("exception caught in SwNewDBMgr::MergeDocuments");
+ }
+ DELETEZ(pImpl->pMergeData);
+ bInMerge = FALSE;
+ return nRet;
+}
+/* -----------------09.12.2002 12:38-----------------
+ *
+ * --------------------------------------------------*/
+SwConnectionDisposedListener_Impl::SwConnectionDisposedListener_Impl(SwNewDBMgr& rMgr) :
+ rDBMgr(rMgr)
+{};
+/* -----------------09.12.2002 12:39-----------------
+ *
+ * --------------------------------------------------*/
+SwConnectionDisposedListener_Impl::~SwConnectionDisposedListener_Impl()
+{};
+/* -----------------09.12.2002 12:39-----------------
+ *
+ * --------------------------------------------------*/
+void SwConnectionDisposedListener_Impl::disposing( const EventObject& rSource )
+ throw (RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference<XConnection> xSource(rSource.Source, UNO_QUERY);
+ for(USHORT nPos = rDBMgr.aDataSourceParams.Count(); nPos; nPos--)
+ {
+ SwDSParam* pParam = rDBMgr.aDataSourceParams[nPos - 1];
+ if(pParam->xConnection.is() &&
+ (xSource == pParam->xConnection))
+ {
+ rDBMgr.aDataSourceParams.DeleteAndDestroy(nPos - 1);
+ }
+ }
+}
diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.cxx b/sw/source/ui/dbui/dbtablepreviewdialog.cxx
new file mode 100644
index 000000000000..463e64279e08
--- /dev/null
+++ b/sw/source/ui/dbui/dbtablepreviewdialog.cxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <swtypes.hxx>
+#include <dbtablepreviewdialog.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#include <toolkit/unohlp.hxx>
+#endif
+
+#include <dbui.hrc>
+#include <dbtablepreviewdialog.hrc>
+#include <unomid.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+using namespace ::rtl;
+
+/*-- 08.04.2004 15:12:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwDBTablePreviewDialog::SwDBTablePreviewDialog(Window* pParent, uno::Sequence< beans::PropertyValue>& rValues ) :
+ SfxModalDialog(pParent, SW_RES(DLG_MM_DBTABLEPREVIEWDIALOG)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aDescriptionFI( this, SW_RES( FI_DESCRIPTION)),
+ m_pBeamerWIN( new Window(this, SW_RES( WIN_BEAMER ))),
+ m_aOK( this, SW_RES( PB_OK ))
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+{
+ FreeResource();
+ const beans::PropertyValue* pValues = rValues.getConstArray();
+ for(sal_Int32 nValue = 0; nValue < rValues.getLength(); ++nValue )
+ {
+ if(pValues[nValue].Name.equalsAscii("Command"))
+ {
+ String sDescription = m_aDescriptionFI.GetText();
+ OUString sTemp;
+ pValues[nValue].Value >>= sTemp;
+ sDescription.SearchAndReplaceAscii("%1", sTemp);
+ m_aDescriptionFI.SetText(sDescription);
+ break;
+ }
+ }
+
+ try
+ {
+ // create a frame wrapper for myself
+ uno::Reference< lang::XMultiServiceFactory >
+ xMgr = comphelper::getProcessServiceFactory();
+ m_xFrame = uno::Reference< frame::XFrame >(xMgr->createInstance(C2U("com.sun.star.frame.Frame")), uno::UNO_QUERY);
+ if(m_xFrame.is())
+ {
+ m_xFrame->initialize( VCLUnoHelper::GetInterface ( m_pBeamerWIN ) );
+ }
+ }
+ catch (uno::Exception const &)
+ {
+ m_xFrame.clear();
+ }
+ if(m_xFrame.is())
+ {
+ uno::Reference<frame::XDispatchProvider> xDP(m_xFrame, uno::UNO_QUERY);
+ util::URL aURL;
+ aURL.Complete = C2U(".component:DB/DataSourceBrowser");
+ uno::Reference<frame::XDispatch> xD = xDP->queryDispatch(aURL,
+ C2U(""),
+ 0x0C);
+ if(xD.is())
+ {
+ xD->dispatch(aURL, rValues);
+ m_pBeamerWIN->Show();
+ }
+/* uno::Reference<???::XController> xController = m_xFrame->getController();
+ pImpl->xFController = uno::Reference<???::XFormController>(xController, uno::UNO_QUERY);
+ if(pImpl->xFController.is())
+ {
+ uno::Reference< awt::XControl > xCtrl = pImpl->xFController->getCurrentControl( );
+ pImpl->xSelSupp = uno::Reference<???::XSelectionSupplier>(xCtrl, uno::UNO_QUERY);
+ if(pImpl->xSelSupp.is())
+ {
+ pImpl->xChgLstnr = new SwXSelChgLstnr_Impl(*this);
+ pImpl->xSelSupp->addSelectionChangeListener( pImpl->xChgLstnr );
+ }
+ }
+*/ }
+
+
+}
+/*-- 08.04.2004 15:12:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwDBTablePreviewDialog::~SwDBTablePreviewDialog()
+{
+ if(m_xFrame.is())
+ {
+ m_xFrame->setComponent(NULL, NULL);
+ m_xFrame->dispose();
+ }
+ else
+ delete m_pBeamerWIN;
+}
diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.hrc b/sw/source/ui/dbui/dbtablepreviewdialog.hrc
new file mode 100644
index 000000000000..645cbe92ab74
--- /dev/null
+++ b/sw/source/ui/dbui/dbtablepreviewdialog.hrc
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _DBTABLEPREVIEWDIALOG_HRC
+#define _DBTABLEPREVIEWDIALOG_HRC
+
+#define FI_DESCRIPTION 1
+#define WIN_BEAMER 2
+#define PB_OK 3
+
+#endif
+
diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.hxx b/sw/source/ui/dbui/dbtablepreviewdialog.hxx
new file mode 100644
index 000000000000..212bb873ca4b
--- /dev/null
+++ b/sw/source/ui/dbui/dbtablepreviewdialog.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _DBTABLEPREVIEWDIALOG_HXX
+#define _DBTABLEPREVIEWDIALOG_HXX
+
+#include <sfx2/basedlgs.hxx>
+#include <svtools/stdctrl.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <com/sun/star/uno/Sequence.h>
+
+namespace com{ namespace sun{ namespace star{
+ namespace beans{ struct PropertyValue; }
+ namespace frame{ class XFrame; }
+ }}}
+
+
+/*-- 08.04.2004 14:04:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwDBTablePreviewDialog : public SfxModalDialog
+{
+ FixedInfo m_aDescriptionFI;
+ Window* m_pBeamerWIN;
+ OKButton m_aOK;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+public:
+ SwDBTablePreviewDialog(Window* pParent,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rValues );
+ ~SwDBTablePreviewDialog();
+
+};
+#endif
+
diff --git a/sw/source/ui/dbui/dbtablepreviewdialog.src b/sw/source/ui/dbui/dbtablepreviewdialog.src
new file mode 100644
index 000000000000..a52290db80fb
--- /dev/null
+++ b/sw/source/ui/dbui/dbtablepreviewdialog.src
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <dbtablepreviewdialog.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+ModalDialog DLG_MM_DBTABLEPREVIEWDIALOG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_DBTABLEPREVIEWDIALOG;
+ Size = MAP_APPFONT ( 350 , 200 ) ;
+ Moveable = TRUE ;
+
+ Text [ en-US ] = "Mail Merge Recipients";
+
+ FixedText FI_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 338 , 8 ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "The list below shows the contents of: %1";
+ };
+ Window WIN_BEAMER
+ {
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 338 , 150 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 150 , 180 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ Text [ en-US ] = "~Close";
+ };
+};
+
diff --git a/sw/source/ui/dbui/dbtree.cxx b/sw/source/ui/dbui/dbtree.cxx
new file mode 100644
index 000000000000..83259add5238
--- /dev/null
+++ b/sw/source/ui/dbui/dbtree.cxx
@@ -0,0 +1,622 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+// INCLUDE ---------------------------------------------------------------
+
+
+#include <sot/formats.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/sdb/XDatabaseAccess.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/sdb/XCompletedConnection.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <svx/dbaexchange.hxx>
+
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+#include <swmodule.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <dbtree.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#ifndef _UTLUI_HRC
+#include <utlui.hrc>
+#endif
+
+#include <unomid.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::beans;
+
+/* -----------------------------17.07.01 13:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+struct SwConnectionData
+{
+ ::rtl::OUString sSourceName;
+ Reference<XConnection> xConnection;
+};
+
+typedef SwConnectionData* SwConnectionDataPtr;
+SV_DECL_PTRARR_DEL( SwConnectionArr, SwConnectionDataPtr, 32, 32 )
+SV_IMPL_PTRARR( SwConnectionArr, SwConnectionDataPtr )
+/* -----------------------------17.07.01 13:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwDBTreeList_Impl : public cppu::WeakImplHelper1 < XContainerListener >
+{
+ Reference< XNameAccess > xDBContext;
+ SwConnectionArr aConnections;
+ SwWrtShell* pWrtSh;
+
+ public:
+ SwDBTreeList_Impl(SwWrtShell* pShell) :
+ pWrtSh(pShell) {}
+ ~SwDBTreeList_Impl();
+
+ virtual void SAL_CALL elementInserted( const ContainerEvent& Event ) throw (RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ContainerEvent& Event ) throw (RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ContainerEvent& Event ) throw (RuntimeException);
+ virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
+
+ BOOL HasContext();
+ SwWrtShell* GetWrtShell() { return pWrtSh;}
+ void SetWrtShell(SwWrtShell& rSh) { pWrtSh = &rSh;}
+ Reference< XNameAccess > GetContext() {return xDBContext;}
+ Reference<XConnection> GetConnection(const rtl::OUString& rSourceName);
+};
+/* -----------------------------17.07.01 13:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwDBTreeList_Impl::~SwDBTreeList_Impl()
+{
+ Reference<XContainer> xContainer(xDBContext, UNO_QUERY);
+ if(xContainer.is())
+ {
+ m_refCount++;
+ //block necessary due to solaris' compiler behaviour to
+ //remove temporaries at the block's end
+ {
+ xContainer->removeContainerListener( this );
+ }
+ m_refCount--;
+ }
+}
+/* -----------------------------17.07.01 13:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDBTreeList_Impl::elementInserted( const ContainerEvent& ) throw (RuntimeException)
+{
+ // information not needed
+}
+/* -----------------------------17.07.01 13:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDBTreeList_Impl::elementRemoved( const ContainerEvent& rEvent ) throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ ::rtl::OUString sSource;
+ rEvent.Accessor >>= sSource;
+ for(USHORT i = 0; i < aConnections.Count(); i++)
+ {
+ SwConnectionDataPtr pPtr = aConnections[i];
+ if(pPtr->sSourceName == sSource)
+ {
+// SwConnectionDataPtr pPtr = aConnections[i];
+// Reference<XComponent> xComp(pPtr->xConnection, UNO_QUERY);
+// if(xComp.is())
+// xComp->dispose();
+ aConnections.DeleteAndDestroy(i);
+ break;
+ }
+ }
+}
+/* -----------------------------17.07.01 13:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDBTreeList_Impl::disposing( const EventObject& ) throw (RuntimeException)
+{
+ xDBContext = 0;
+}
+/* -----------------------------17.07.01 13:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDBTreeList_Impl::elementReplaced( const ContainerEvent& rEvent ) throw (RuntimeException)
+{
+ elementRemoved(rEvent);
+}
+/* -----------------------------17.07.01 13:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwDBTreeList_Impl::HasContext()
+{
+ if(!xDBContext.is())
+ {
+ Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ if( xMgr.is() )
+ {
+ Reference<XInterface> xInstance = xMgr->createInstance(
+ C2U( "com.sun.star.sdb.DatabaseContext" ));
+ xDBContext = Reference<XNameAccess>(xInstance, UNO_QUERY) ;
+ Reference<XContainer> xContainer(xDBContext, UNO_QUERY);
+ if(xContainer.is())
+ xContainer->addContainerListener( this );
+ }
+ DBG_ASSERT(xDBContext.is(), "com.sun.star.sdb.DataBaseContext: service not available");
+ }
+ return xDBContext.is();
+}
+/* -----------------------------17.07.01 13:24--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference<XConnection> SwDBTreeList_Impl::GetConnection(const rtl::OUString& rSourceName)
+{
+ Reference<XConnection> xRet;
+ for(USHORT i = 0; i < aConnections.Count(); i++)
+ {
+ SwConnectionDataPtr pPtr = aConnections[i];
+ if(pPtr->sSourceName == rSourceName)
+ {
+ xRet = pPtr->xConnection;
+ break;
+ }
+ }
+ if(!xRet.is() && xDBContext.is() && pWrtSh)
+ {
+ SwConnectionDataPtr pPtr = new SwConnectionData();
+ pPtr->sSourceName = rSourceName;
+ xRet = pWrtSh->GetNewDBMgr()->RegisterConnection(pPtr->sSourceName);
+ aConnections.Insert(pPtr, aConnections.Count());
+ }
+ return xRet;
+}
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+SwDBTreeList::SwDBTreeList(Window *pParent, const ResId& rResId,
+ SwWrtShell* pSh,
+ const String& rDefDBName, const BOOL bShowCol):
+
+ SvTreeListBox (pParent, rResId),
+ aImageList (SW_RES(ILIST_DB_DLG )),
+ aImageListHC (SW_RES(ILIST_DB_DLG_HC )),
+ sDefDBName (rDefDBName),
+ bInitialized (FALSE),
+ bShowColumns (bShowCol),
+ pImpl(new SwDBTreeList_Impl(pSh))
+{
+ SetHelpId(HID_DB_SELECTION_TLB);
+
+ if (IsVisible())
+ InitTreeList();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+SwDBTreeList::~SwDBTreeList()
+{
+ delete pImpl;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+void SwDBTreeList::InitTreeList()
+{
+ if(!pImpl->HasContext() && pImpl->GetWrtShell())
+ return;
+ SetSelectionMode(SINGLE_SELECTION);
+ SetStyle(GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL);
+ // Font nicht setzen, damit der Font des Controls uebernommen wird!
+ SetSpaceBetweenEntries(0);
+ SetNodeBitmaps( aImageList.GetImage(IMG_COLLAPSE),
+ aImageList.GetImage(IMG_EXPAND ), BMP_COLOR_NORMAL );
+ SetNodeBitmaps( aImageListHC.GetImage(IMG_COLLAPSE),
+ aImageListHC.GetImage(IMG_EXPAND ), BMP_COLOR_HIGHCONTRAST );
+
+ SetDragDropMode(SV_DRAGDROP_APP_COPY);
+
+ GetModel()->SetCompareHdl(LINK(this, SwDBTreeList, DBCompare));
+
+ Sequence< ::rtl::OUString > aDBNames = pImpl->GetContext()->getElementNames();
+ const ::rtl::OUString* pDBNames = aDBNames.getConstArray();
+ long nCount = aDBNames.getLength();
+
+ Image aImg = aImageList.GetImage(IMG_DB);
+ Image aHCImg = aImageListHC.GetImage(IMG_DB);
+ for(long i = 0; i < nCount; i++)
+ {
+ String sDBName(pDBNames[i]);
+ SvLBoxEntry* pEntry = InsertEntry(sDBName, aImg, aImg, NULL, TRUE);
+ SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ }
+ String sDBName(sDefDBName.GetToken(0, DB_DELIM));
+ String sTableName(sDefDBName.GetToken(1, DB_DELIM));
+ String sColumnName(sDefDBName.GetToken(2, DB_DELIM));
+ Select(sDBName, sTableName, sColumnName);
+
+
+ bInitialized = TRUE;
+}
+/*-- 27.05.2004 09:19:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwDBTreeList::AddDataSource(const String& rSource)
+{
+ Image aImg = aImageList.GetImage(IMG_DB);
+ Image aHCImg = aImageListHC.GetImage(IMG_DB);
+ SvLBoxEntry* pEntry = InsertEntry(rSource, aImg, aImg, NULL, TRUE);
+ SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ SvTreeListBox::Select(pEntry);
+}
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwDBTreeList::ShowColumns(BOOL bShowCol)
+{
+ if (bShowCol != bShowColumns)
+ {
+ bShowColumns = bShowCol;
+ String sTableName, sColumnName;
+ String sDBName(GetDBName(sTableName, sColumnName));
+
+ SetUpdateMode(FALSE);
+
+ SvLBoxEntry* pEntry = First();
+
+ while (pEntry)
+ {
+ pEntry = (SvLBoxEntry*)GetRootLevelParent( pEntry );
+ Collapse(pEntry); // zuklappen
+
+ SvLBoxEntry* pChild;
+ while ((pChild = FirstChild(pEntry)) != 0L)
+ GetModel()->Remove(pChild);
+
+ pEntry = Next(pEntry);
+ }
+
+ if (sDBName.Len())
+ {
+ Select(sDBName, sTableName, sColumnName); // force RequestingChilds
+ }
+ SetUpdateMode(TRUE);
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwDBTreeList::RequestingChilds(SvLBoxEntry* pParent)
+{
+ if (!pParent->HasChilds())
+ {
+ if (GetParent(pParent)) // column names
+ {
+ try
+ {
+
+ String sSourceName = GetEntryText(GetParent(pParent));
+ String sTableName = GetEntryText(pParent);
+
+ if(!pImpl->GetContext()->hasByName(sSourceName))
+ return;
+ Reference<XConnection> xConnection = pImpl->GetConnection(sSourceName);
+ BOOL bTable = pParent->GetUserData() == 0;
+ Reference<XColumnsSupplier> xColsSupplier;
+ if(bTable)
+ {
+ Reference<XTablesSupplier> xTSupplier = Reference<XTablesSupplier>(xConnection, UNO_QUERY);
+ if(xTSupplier.is())
+ {
+ Reference<XNameAccess> xTbls = xTSupplier->getTables();
+ DBG_ASSERT(xTbls->hasByName(sTableName), "table not available anymore?");
+ try
+ {
+ Any aTable = xTbls->getByName(sTableName);
+ Reference<XPropertySet> xPropSet;
+ aTable >>= xPropSet;
+ xColsSupplier = Reference<XColumnsSupplier>(xPropSet, UNO_QUERY);
+ }
+ catch(Exception&)
+ {}
+ }
+ }
+ else
+ {
+ Reference<XQueriesSupplier> xQSupplier = Reference<XQueriesSupplier>(xConnection, UNO_QUERY);
+ if(xQSupplier.is())
+ {
+ Reference<XNameAccess> xQueries = xQSupplier->getQueries();
+ DBG_ASSERT(xQueries->hasByName(sTableName), "table not available anymore?");
+ try
+ {
+ Any aQuery = xQueries->getByName(sTableName);
+ Reference<XPropertySet> xPropSet;
+ aQuery >>= xPropSet;
+ xColsSupplier = Reference<XColumnsSupplier>(xPropSet, UNO_QUERY);
+ }
+ catch(Exception&)
+ {}
+ }
+ }
+
+ if(xColsSupplier.is())
+ {
+ Reference <XNameAccess> xCols = xColsSupplier->getColumns();
+ Sequence< ::rtl::OUString> aColNames = xCols->getElementNames();
+ const ::rtl::OUString* pColNames = aColNames.getConstArray();
+ long nCount = aColNames.getLength();
+ for (long i = 0; i < nCount; i++)
+ {
+ String sName = pColNames[i];
+ if(bTable)
+ InsertEntry(sName, pParent);
+ else
+ InsertEntry(sName, pParent);
+ }
+ }
+ }
+ catch(const Exception&)
+ {
+ }
+ }
+ else // Tabellennamen
+ {
+ try
+ {
+ String sSourceName = GetEntryText(pParent);
+ if(!pImpl->GetContext()->hasByName(sSourceName))
+ return;
+ Reference<XConnection> xConnection = pImpl->GetConnection(sSourceName);
+ if (xConnection.is())
+ {
+ Reference<XTablesSupplier> xTSupplier = Reference<XTablesSupplier>(xConnection, UNO_QUERY);
+ if(xTSupplier.is())
+ {
+ Reference<XNameAccess> xTbls = xTSupplier->getTables();
+ Sequence< ::rtl::OUString> aTblNames = xTbls->getElementNames();
+ String sTableName;
+ long nCount = aTblNames.getLength();
+ const ::rtl::OUString* pTblNames = aTblNames.getConstArray();
+ Image aImg = aImageList.GetImage(IMG_DBTABLE);
+ Image aHCImg = aImageListHC.GetImage(IMG_DBTABLE);
+ for (long i = 0; i < nCount; i++)
+ {
+ sTableName = pTblNames[i];
+ SvLBoxEntry* pTableEntry = InsertEntry(sTableName, aImg, aImg, pParent, bShowColumns);
+ //to discriminate between queries and tables the user data of table entries is set
+ pTableEntry->SetUserData((void*)0);
+ SetExpandedEntryBmp(pTableEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ SetCollapsedEntryBmp(pTableEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ }
+ }
+
+ Reference<XQueriesSupplier> xQSupplier = Reference<XQueriesSupplier>(xConnection, UNO_QUERY);
+ if(xQSupplier.is())
+ {
+ Reference<XNameAccess> xQueries = xQSupplier->getQueries();
+ Sequence< ::rtl::OUString> aQueryNames = xQueries->getElementNames();
+ String sQueryName;
+ long nCount = aQueryNames.getLength();
+ const ::rtl::OUString* pQueryNames = aQueryNames.getConstArray();
+ Image aImg = aImageList.GetImage(IMG_DBQUERY);
+ Image aHCImg = aImageListHC.GetImage(IMG_DBQUERY);
+ for (long i = 0; i < nCount; i++)
+ {
+ sQueryName = pQueryNames[i];
+ SvLBoxEntry* pQueryEntry = InsertEntry(sQueryName, aImg, aImg, pParent, bShowColumns);
+ pQueryEntry->SetUserData((void*)1);
+ SetExpandedEntryBmp(pQueryEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ SetCollapsedEntryBmp( pQueryEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ }
+ }
+ }
+ }
+ catch(const Exception&)
+ {
+ }
+ }
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwDBTreeList, DBCompare, SvSortData*, pData )
+{
+ SvLBoxEntry* pRight = (SvLBoxEntry*)(pData->pRight );
+
+ if (GetParent(pRight) && GetParent(GetParent(pRight)))
+ return COMPARE_GREATER; // Spaltennamen nicht sortieren
+
+ return DefaultCompare(pData); // Sonst Basisklasse rufen
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+String SwDBTreeList::GetDBName(String& rTableName, String& rColumnName, BOOL* pbIsTable)
+{
+ String sDBName;
+ SvLBoxEntry* pEntry = FirstSelected();
+
+ if (pEntry && GetParent(pEntry))
+ {
+ if (GetParent(GetParent(pEntry)))
+ {
+ rColumnName = GetEntryText(pEntry);
+ pEntry = GetParent(pEntry); // Spaltenname war selektiert
+ }
+ sDBName = GetEntryText(GetParent(pEntry));
+ if(pbIsTable)
+ {
+ *pbIsTable = pEntry->GetUserData() == 0;
+ }
+ rTableName = GetEntryText(pEntry);
+ }
+ return sDBName;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Format: Datenbank.Tabelle
+------------------------------------------------------------------------*/
+
+
+void SwDBTreeList::Select(const String& rDBName, const String& rTableName, const String& rColumnName)
+{
+ SvLBoxEntry* pParent;
+ SvLBoxEntry* pChild;
+ USHORT nParent = 0;
+ USHORT nChild = 0;
+
+ while ((pParent = GetEntry(nParent++)) != NULL)
+ {
+ if (rDBName == GetEntryText(pParent))
+ {
+ if (!pParent->HasChilds())
+ RequestingChilds(pParent);
+ while ((pChild = GetEntry(pParent, nChild++)) != NULL)
+ {
+ if (rTableName == GetEntryText(pChild))
+ {
+ pParent = pChild;
+
+ if (bShowColumns && rColumnName.Len())
+ {
+ nChild = 0;
+
+ if (!pParent->HasChilds())
+ RequestingChilds(pParent);
+
+ while ((pChild = GetEntry(pParent, nChild++)) != NULL)
+ if (rColumnName == GetEntryText(pChild))
+ break;
+ }
+ if (!pChild)
+ pChild = pParent;
+
+ MakeVisible(pChild);
+ SvTreeListBox::Select(pChild);
+ return;
+ }
+ }
+ }
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwDBTreeList::StartDrag( sal_Int8 /*nAction*/, const Point& /*rPosPixel*/ )
+{
+ String sTableName, sColumnName;
+ String sDBName( GetDBName( sTableName, sColumnName ));
+ if( sDBName.Len() )
+ {
+ TransferDataContainer* pContainer = new TransferDataContainer;
+ STAR_REFERENCE( datatransfer::XTransferable ) xRef( pContainer );
+ if( sColumnName.Len() )
+ {
+ // Datenbankfeld draggen
+ svx::OColumnTransferable aColTransfer(
+ sDBName
+ ,::rtl::OUString()
+ , sdb::CommandType::TABLE
+ ,sTableName
+ , sColumnName
+ ,(CTF_FIELD_DESCRIPTOR |CTF_COLUMN_DESCRIPTOR ));
+ aColTransfer.addDataToContainer( pContainer );
+ }
+
+ sDBName += '.';
+ sDBName += sTableName;
+ if( sColumnName.Len() )
+ {
+ sDBName += '.';
+ sDBName += sColumnName;
+ }
+
+ pContainer->CopyString( FORMAT_STRING, sDBName );
+ pContainer->StartDrag( this, DND_ACTION_COPY | DND_ACTION_LINK,
+ Link() );
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+sal_Int8 SwDBTreeList::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
+{
+ return DND_ACTION_NONE;
+}
+/*-- 07.10.2003 13:28:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwDBTreeList::SetWrtShell(SwWrtShell& rSh)
+{
+ pImpl->SetWrtShell(rSh);
+ if (IsVisible() && !bInitialized)
+ InitTreeList();
+}
diff --git a/sw/source/ui/dbui/dbui.cxx b/sw/source/ui/dbui/dbui.cxx
new file mode 100644
index 000000000000..9dc0c899f574
--- /dev/null
+++ b/sw/source/ui/dbui/dbui.cxx
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+// INCLUDE ---------------------------------------------------------------
+
+
+#include <tools/list.hxx>
+#include "wrtsh.hxx"
+
+
+#include "dbui.hrc"
+#include "dbui.hxx"
+
+/*---------------------------------------------------------------------
+ Beschreibung:
+---------------------------------------------------------------------*/
+
+PrintMonitor::PrintMonitor( Window *pParent, PrintMonitorType eType )
+: ModelessDialog( pParent, SW_RES(DLG_PRINTMONITOR) ),
+ aDocName (this, SW_RES( FT_DOCNAME )),
+ aPrinting (this, SW_RES(
+ eType == MONITOR_TYPE_MAIL ?
+ FT_SENDING : eType == MONITOR_TYPE_SAVE ? FT_SAVING : FT_PRINTING )),
+ aPrinter (this, SW_RES( FT_PRINTER )),
+ aPrintInfo (this, SW_RES( FT_PRINTINFO )),
+ aCancel (this, SW_RES( PB_CANCELPRNMON ))
+{
+ switch (eType)
+ {
+ case MONITOR_TYPE_SAVE: SetText(SW_RES(STR_SAVEMON)); break;
+ case MONITOR_TYPE_MAIL: SetText(SW_RES(STR_EMAILMON)); break;
+ case MONITOR_TYPE_PRINT: break;
+ }
+ FreeResource();
+}
+/*---------------------------------------------------------------------
+
+---------------------------------------------------------------------*/
+void lcl_ResizeControl( Window* pWin, long nDiff )
+{
+ Size aSize( pWin->GetSizePixel() );
+ aSize.Width() += nDiff;
+ pWin->SetSizePixel( aSize );
+}
+void lcl_RePosControl( Window* pWin, long nDiff )
+{
+ Point aPos( pWin->GetPosPixel() );
+ aPos.X() += nDiff;
+ pWin->SetPosPixel( aPos );
+}
+
+void PrintMonitor::ResizeControls()
+{
+ Size aDlgSize( GetSizePixel() );
+ Size aPrinterSize( aPrinter.GetSizePixel() );
+ long nPrinterTextWidth = aPrinter.GetTextWidth( aPrinter.GetText() );
+ if( nPrinterTextWidth > aPrinterSize.Width() )
+ {
+ //increase control and dialog width if printer text is too long
+ //do not increase dialog width more than three times
+ long nDiff = nPrinterTextWidth - aPrinterSize.Width();
+ if( nDiff > 2 * aDlgSize.Width() )
+ {
+ aPrinter.SetStyle( WB_RIGHT | aPrinter.GetStyle() );
+ nDiff = 2 * aDlgSize.Width();
+ }
+ aDlgSize.Width() += nDiff;
+ SetSizePixel(aDlgSize);
+ lcl_ResizeControl( &aPrinter, nDiff );
+
+ nDiff /= 2;
+ lcl_RePosControl( &aDocName, nDiff );
+ lcl_RePosControl( &aPrinting, nDiff );
+ lcl_RePosControl( &aPrintInfo, nDiff );
+ lcl_RePosControl( &aCancel, nDiff );
+ }
+}
+/*---------------------------------------------------------------------
+ Progress Indicator for Creation of personalized Mail Merge documents:
+---------------------------------------------------------------------*/
+
+CreateMonitor::CreateMonitor( Window *pParent )
+: ModelessDialog( pParent, SW_RES(DLG_MM_CREATIONMONITOR) ),
+ m_aStatus (this, SW_RES( FT_STATUS )),
+ m_aProgress (this, SW_RES( FT_PROGRESS )),
+ m_aCreateDocuments (this, SW_RES( FT_CREATEDOCUMENTS )),
+ m_aCounting (this, SW_RES( FT_COUNTING )),
+ m_aCancelButton (this, SW_RES( PB_CANCELPRNMON )),
+ m_sCountingPattern(),
+ m_sVariable_Total( String::CreateFromAscii("%Y") ),
+ m_sVariable_Position( String::CreateFromAscii("%X") ),
+ m_nTotalCount(0),
+ m_nCurrentPosition(0)
+{
+ FreeResource();
+
+ m_sCountingPattern = m_aCounting.GetText();
+ m_aCounting.SetText(String::CreateFromAscii("..."));
+}
+
+void CreateMonitor::UpdateCountingText()
+{
+ String sText(m_sCountingPattern);
+ sText.SearchAndReplaceAll( m_sVariable_Total, String::CreateFromInt32( m_nTotalCount ) );
+ sText.SearchAndReplaceAll( m_sVariable_Position, String::CreateFromInt32( m_nCurrentPosition ) );
+ m_aCounting.SetText(sText);
+}
+
+void CreateMonitor::SetTotalCount( sal_Int32 nTotal )
+{
+ m_nTotalCount = nTotal;
+ UpdateCountingText();
+}
+
+void CreateMonitor::SetCurrentPosition( sal_Int32 nCurrent )
+{
+ m_nCurrentPosition = nCurrent;
+ UpdateCountingText();
+}
+
+void CreateMonitor::SetCancelHdl( const Link& rLink )
+{
+ m_aCancelButton.SetClickHdl( rLink );
+}
diff --git a/sw/source/ui/dbui/dbui.src b/sw/source/ui/dbui/dbui.src
new file mode 100644
index 000000000000..12c67d2644df
--- /dev/null
+++ b/sw/source/ui/dbui/dbui.src
@@ -0,0 +1,284 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // #pragma ******************************************************************
+
+ // #include *****************************************************************
+#include "dbui.hrc"
+#include "helpid.h"
+ModalDialog DLG_DBSELECTION
+{
+ HelpID = "sw:ModalDialog:DLG_DBSELECTION";
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 168 , 132 ) ;
+ Moveable = TRUE ;
+ Control TLB_DBLIST
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 100 , 120 ) ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 112 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 112 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 112 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ Text [ en-US ] = "Database Selection" ;
+};
+ // DLG_PRINTMONITOR ------------------------------------------------------
+ModelessDialog DLG_PRINTMONITOR
+{
+ HelpID = HID_MERGE_PRINTMONITOR ;
+ SVLOOK = TRUE ;
+ HIDE = TRUE ;
+ OUTPUTSIZE = TRUE ;
+ Size = MAP_APPFONT ( 118, 72 ) ;
+ MOVEABLE = TRUE ;
+ APP = FALSE ;
+ FixedText FT_DOCNAME
+ {
+ Pos = MAP_APPFONT ( 6,6 ) ;
+ Size = MAP_APPFONT ( 100, 8 ) ;
+ CENTER = TRUE ;
+ };
+ FixedText FT_PRINTING
+ {
+ Pos = MAP_APPFONT ( 6, 17 ) ;
+ Size = MAP_APPFONT ( 100, 8 ) ;
+ CENTER = TRUE ;
+ Text [ en-US ] = "is being prepared for printing on" ;
+ };
+ FixedText FT_SENDING
+ {
+ Pos = MAP_APPFONT ( 6, 17 ) ;
+ Size = MAP_APPFONT ( 100, 8 ) ;
+ CENTER = TRUE ;
+ Text [ en-US ] = "is being sent to";
+ };
+ FixedText FT_SAVING
+ {
+ Pos = MAP_APPFONT ( 6, 17 ) ;
+ Size = MAP_APPFONT ( 100, 8 ) ;
+ CENTER = TRUE ;
+ Text [ en-US ] = "is being saved to" ;
+ };
+ FixedText FT_PRINTER
+ {
+ Pos = MAP_APPFONT ( 6, 28 ) ;
+ Size = MAP_APPFONT ( 100, 8 ) ;
+ CENTER = TRUE ;
+ };
+ FixedText FT_PRINTINFO
+ {
+ Pos = MAP_APPFONT ( 6, 39 ) ;
+ Size = MAP_APPFONT ( 100, 8 ) ;
+ CENTER = TRUE ;
+ };
+ CancelButton PB_CANCELPRNMON
+ {
+ Pos = MAP_APPFONT ( 31, 52 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ TABSTOP = TRUE ;
+ };
+ String STR_EMAILMON
+ {
+ Text [ en-US ] = "Send-Monitor";
+ };
+ String STR_SAVEMON
+ {
+ Text [ en-US ] = "Save-Monitor";
+ };
+ Text [ en-US ] = "Print monitor" ;
+};
+
+String STR_DB_EMAIL
+{
+ Text [ en-US ] = "E-mail" ;
+};
+
+StringArray SA_ADDRESS_HEADER
+{
+ ItemList [en-US]=
+ {
+ < "Title" ; MM_PART_TITLE ;> ;
+ < "First Name" ; MM_PART_FIRSTNAME ;> ;
+ < "Last Name" ; MM_PART_LASTNAME ;> ;
+ < "Company Name" ; MM_PART_COMPANY ;> ;
+ < "Address Line 1" ; MM_PART_ADDRESS_1 ;> ;
+ < "Address Line 2" ; MM_PART_ADDRESS_2 ;> ;
+ < "City" ; MM_PART_CITY ;> ;
+ < "State" ; MM_PART_REGION ;> ;
+ < "ZIP" ; MM_PART_ZIP ;> ;
+ < "Country" ; MM_PART_COUNTRY ;> ;
+ < "Telephone private" ; MM_PART_PHONE_PRIVATE ;> ;
+ < "Telephone business" ; MM_PART_PHONE_BUSINESS ;> ;
+ < "E-mail Address" ; MM_PART_E_MAIL ;> ;
+ < "Gender"; MM_PART_GENDER ;> ;
+ };
+};
+String STR_NOTASSIGNED
+{
+ Text[ en-US ] = " not yet matched ";
+};
+String STR_FILTER_ALL
+{
+ Text [ en-US ] = "All files (*.*)" ;
+};
+String STR_FILTER_ALL_DATA
+{
+ Text [ en-US ] = "Address lists(*.*)" ;
+};
+String STR_FILTER_SXB
+{
+ Text [ en-US ] = "%PRODUCTNAME Base (*.odb)" ;
+};
+String STR_FILTER_SXC
+{
+ Text [ en-US ] = "%PRODUCTNAME Calc (*.ods;*.sxc)" ;
+};
+String STR_FILTER_DBF
+{
+ Text [ en-US ] = "dBase (*.dbf)" ;
+};
+String STR_FILTER_XLS
+{
+ Text [ en-US ] = "Microsoft Excel (*.xls)" ;
+};
+String STR_FILTER_TXT
+{
+ Text [ en-US ] = "Plain text (*.txt)" ;
+};
+String STR_FILTER_CSV
+{
+ Text [ en-US ] = "Text Comma Separated (*.csv)" ;
+};
+String STR_FILTER_MDB
+{
+ Text [ en-US ] = "Microsoft Access (*.mdb)" ;
+};
+String STR_FILTER_ACCDB
+{
+ Text [ en-US ] = "Microsoft Access 2007 (*.accdb)" ;
+};
+
+ // DLG_MM_CREATIONMONITOR ------------------------------------------------------
+ModelessDialog DLG_MM_CREATIONMONITOR
+{
+ HelpID = HID_MERGE_PRINTMONITOR ;
+ SVLOOK = TRUE ;
+ HIDE = TRUE ;
+ OUTPUTSIZE = TRUE ;
+ _WHMAPMODE = MAP_APPFONT ;
+ _WIDTH = 140 ;
+ _HEIGHT = 52 ;
+ MOVEABLE = TRUE ;
+ APP = FALSE ;
+
+ Text [ en-US ] = "Mail Merge" ;
+
+ FixedText FT_STATUS
+ {
+ HIDE = FALSE ;
+ _XYMAPMODE = MAP_APPFONT ;
+ _X = 6 ;
+ _Y = 6 ;
+ _WHMAPMODE = MAP_APPFONT ;
+ _WIDTH = 35 ;
+ _HEIGHT = 8 ;
+ Text [ en-US ] = "Status:" ;
+ LEFT = FALSE ;
+ CENTER = FALSE ;
+ RIGHT = TRUE ;
+ };
+ FixedText FT_PROGRESS
+ {
+ HIDE = FALSE ;
+ _XYMAPMODE = MAP_APPFONT ;
+ _X = 6 ;
+ _Y = 17 ;
+ _WHMAPMODE = MAP_APPFONT ;
+ _WIDTH = 35 ;
+ _HEIGHT = 8 ;
+ Text [ en-US ] = "Progress:" ;
+ LEFT = FALSE ;
+ CENTER = FALSE ;
+ RIGHT = TRUE ;
+ };
+ FixedText FT_CREATEDOCUMENTS
+ {
+ HIDE = FALSE ;
+ _XYMAPMODE = MAP_APPFONT ;
+ _X = 45 ;
+ _Y = 6 ;
+ _WHMAPMODE = MAP_APPFONT ;
+ _WIDTH = 91 ;
+ _HEIGHT = 8 ;
+ Text [ en-US ] = "Creating documents...";
+ LEFT = TRUE ;
+ CENTER = FALSE ;
+ RIGHT = FALSE ;
+ };
+ FixedText FT_COUNTING
+ {
+ HIDE = FALSE ;
+ _XYMAPMODE = MAP_APPFONT ;
+ _X = 45 ;
+ _Y = 17 ;
+ _WHMAPMODE = MAP_APPFONT ;
+ _WIDTH = 91 ;
+ _HEIGHT = 8 ;
+ Text [ en-US ] = "%X of %Y";
+ LEFT = TRUE ;
+ CENTER = FALSE ;
+ RIGHT = FALSE ;
+ };
+ CancelButton PB_CANCELPRNMON
+ {
+ HIDE = FALSE ;
+ _XYMAPMODE = MAP_APPFONT ;
+ _X = 74 ;
+ _Y = 32 ;
+ _WHMAPMODE = MAP_APPFONT ;
+ _WIDTH = 50 ;
+ _HEIGHT = 14 ;
+ TABSTOP = TRUE ;
+ };
+};
diff --git a/sw/source/ui/dbui/maildispatcher.cxx b/sw/source/ui/dbui/maildispatcher.cxx
new file mode 100644
index 000000000000..2203f70c3404
--- /dev/null
+++ b/sw/source/ui/dbui/maildispatcher.cxx
@@ -0,0 +1,296 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include "maildispatcher.hxx"
+#include "imaildsplistener.hxx"
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+typedef std::list< uno::Reference<mail::XMailMessage> > MailMessageContainer_t;
+typedef std::list< ::rtl::Reference<IMailDispatcherListener> > MailDispatcherListenerContainer_t;
+
+namespace /* private */
+{
+ /* Generic event notifier for started,
+ stopped, and idle events which are
+ very similary */
+ class GenericEventNotifier
+ {
+ public:
+ // pointer to virtual function typedef
+ typedef void (IMailDispatcherListener::*GenericNotificationFunc_t)(::rtl::Reference<MailDispatcher>);
+
+ GenericEventNotifier(
+ GenericNotificationFunc_t notification_function,
+ ::rtl::Reference<MailDispatcher> mail_dispatcher) :
+ notification_function_(notification_function),
+ mail_dispatcher_(mail_dispatcher)
+ {}
+
+ void operator() (::rtl::Reference<IMailDispatcherListener> listener) const
+ { (listener.get()->*notification_function_)(mail_dispatcher_); }
+
+ private:
+ GenericNotificationFunc_t notification_function_;
+ ::rtl::Reference<MailDispatcher> mail_dispatcher_;
+ };
+
+ class MailDeliveryNotifier
+ {
+ public:
+ MailDeliveryNotifier(::rtl::Reference<MailDispatcher> xMailDispatcher, uno::Reference<mail::XMailMessage> message) :
+ mail_dispatcher_(xMailDispatcher),
+ message_(message)
+ {}
+
+ void operator() (::rtl::Reference<IMailDispatcherListener> listener) const
+ { listener->mailDelivered(mail_dispatcher_, message_); }
+
+ private:
+ ::rtl::Reference<MailDispatcher> mail_dispatcher_;
+ uno::Reference<mail::XMailMessage> message_;
+ };
+
+ class MailDeliveryErrorNotifier
+ {
+ public:
+ MailDeliveryErrorNotifier(
+ ::rtl::Reference<MailDispatcher> xMailDispatcher,
+ uno::Reference<mail::XMailMessage> message,
+ const ::rtl::OUString& error_message) :
+ mail_dispatcher_(xMailDispatcher),
+ message_(message),
+ error_message_(error_message)
+ {}
+
+ void operator() (::rtl::Reference<IMailDispatcherListener> listener) const
+ { listener->mailDeliveryError(mail_dispatcher_, message_, error_message_); }
+
+ private:
+ ::rtl::Reference<MailDispatcher> mail_dispatcher_;
+ uno::Reference<mail::XMailMessage> message_;
+ ::rtl::OUString error_message_;
+ };
+
+} // namespace private
+
+
+MailDispatcher::MailDispatcher(uno::Reference<mail::XSmtpService> mailserver) :
+ mailserver_ (mailserver),
+ run_(false),
+ shutdown_requested_(false)
+{
+ wakening_call_.reset();
+ mail_dispatcher_active_.reset();
+
+ if (!create())
+ throw uno::RuntimeException();
+
+ // wait until the mail dispatcher thread is really alive
+ // and has aquired a reference to this instance of the
+ // class
+ mail_dispatcher_active_.wait();
+}
+
+MailDispatcher::~MailDispatcher()
+{
+}
+
+void MailDispatcher::enqueueMailMessage(uno::Reference<mail::XMailMessage> message)
+{
+ ::osl::MutexGuard thread_status_guard(thread_status_mutex_);
+ ::osl::MutexGuard message_container_guard(message_container_mutex_);
+
+ OSL_PRECOND(!shutdown_requested_, "MailDispatcher thread is shuting down already");
+
+ messages_.push_back(message);
+ if (run_)
+ wakening_call_.set();
+}
+
+uno::Reference<mail::XMailMessage> MailDispatcher::dequeueMailMessage()
+{
+ ::osl::MutexGuard guard(message_container_mutex_);
+ uno::Reference<mail::XMailMessage> message;
+ if(!messages_.empty())
+ {
+ message = messages_.front();
+ messages_.pop_front();
+ }
+ return message;
+}
+
+void MailDispatcher::start()
+{
+ OSL_PRECOND(!isStarted(), "MailDispatcher is already started!");
+
+ ::osl::ClearableMutexGuard thread_status_guard(thread_status_mutex_);
+
+ OSL_PRECOND(!shutdown_requested_, "MailDispatcher thread is shuting down already");
+
+ if (!shutdown_requested_)
+ {
+ run_ = true;
+ wakening_call_.set();
+ thread_status_guard.clear();
+
+ MailDispatcherListenerContainer_t listeners_cloned(cloneListener());
+ std::for_each(listeners_cloned.begin(), listeners_cloned.end(), GenericEventNotifier(&IMailDispatcherListener::started, this));
+ }
+}
+
+void MailDispatcher::stop()
+{
+ OSL_PRECOND(isStarted(), "MailDispatcher not started!");
+
+ ::osl::ClearableMutexGuard thread_status_guard(thread_status_mutex_);
+
+ OSL_PRECOND(!shutdown_requested_, "MailDispatcher thread is shuting down already");
+
+ if (!shutdown_requested_)
+ {
+ run_ = false;
+ wakening_call_.reset();
+ thread_status_guard.clear();
+
+ MailDispatcherListenerContainer_t listeners_cloned(cloneListener());
+ std::for_each(listeners_cloned.begin(), listeners_cloned.end(), GenericEventNotifier(&IMailDispatcherListener::stopped, this));
+ }
+}
+
+void MailDispatcher::shutdown()
+{
+ ::osl::MutexGuard thread_status_guard(thread_status_mutex_);
+
+ OSL_PRECOND(!shutdown_requested_, "MailDispatcher thread is shuting down already");
+
+ shutdown_requested_ = true;
+ wakening_call_.set();
+}
+
+bool MailDispatcher::isStarted() const
+{
+ return run_;
+}
+
+void MailDispatcher::addListener(::rtl::Reference<IMailDispatcherListener> listener)
+{
+ OSL_PRECOND(!shutdown_requested_, "MailDispatcher thread is shuting down already");
+
+ ::osl::MutexGuard guard(listener_container_mutex_);
+ listeners_.push_back(listener);
+}
+
+void MailDispatcher::removeListener(::rtl::Reference<IMailDispatcherListener> listener)
+{
+ OSL_PRECOND(!shutdown_requested_, "MailDispatcher thread is shuting down already");
+
+ ::osl::MutexGuard guard(listener_container_mutex_);
+ listeners_.remove(listener);
+}
+
+std::list< ::rtl::Reference<IMailDispatcherListener> > MailDispatcher::cloneListener()
+{
+ ::osl::MutexGuard guard(listener_container_mutex_);
+ return listeners_;
+}
+
+void MailDispatcher::sendMailMessageNotifyListener(uno::Reference<mail::XMailMessage> message)
+{
+ try
+ {
+ mailserver_->sendMailMessage(message);
+ MailDispatcherListenerContainer_t listeners_cloned(cloneListener());
+ std::for_each(listeners_cloned.begin(), listeners_cloned.end(), MailDeliveryNotifier(this, message));
+ }
+ catch (mail::MailException& ex)
+ {
+ MailDispatcherListenerContainer_t listeners_cloned(cloneListener());
+ std::for_each(listeners_cloned.begin(), listeners_cloned.end(), MailDeliveryErrorNotifier(this, message, ex.Message));
+ }
+ catch (uno::RuntimeException& ex)
+ {
+ MailDispatcherListenerContainer_t listeners_cloned(cloneListener());
+ std::for_each(listeners_cloned.begin(), listeners_cloned.end(), MailDeliveryErrorNotifier(this, message, ex.Message));
+ }
+}
+
+void MailDispatcher::run()
+{
+ // aquire a self reference in order to avoid race
+ // conditions. The last client of this class must
+ // call shutdown before releasing his last reference
+ // to this class in order to shutdown this thread
+ // which will release his (the very last reference
+ // to the class and so force their destruction
+ m_xSelfReference = this;
+
+ // signal that the mail dispatcher thread is now alive
+ mail_dispatcher_active_.set();
+
+ for(;;)
+ {
+ wakening_call_.wait();
+
+ ::osl::ClearableMutexGuard thread_status_guard(thread_status_mutex_);
+ if (shutdown_requested_)
+ break;
+
+ ::osl::ClearableMutexGuard message_container_guard(message_container_mutex_);
+
+ if (messages_.size())
+ {
+ thread_status_guard.clear();
+ uno::Reference<mail::XMailMessage> message = messages_.front();
+ messages_.pop_front();
+ message_container_guard.clear();
+ sendMailMessageNotifyListener(message);
+ }
+ else // idle - put ourself to sleep
+ {
+ wakening_call_.reset();
+ message_container_guard.clear();
+ thread_status_guard.clear();
+ MailDispatcherListenerContainer_t listeners_cloned(cloneListener());
+ std::for_each(listeners_cloned.begin(), listeners_cloned.end(), GenericEventNotifier(&IMailDispatcherListener::idle, this));
+ }
+ } // end for SSH ALI
+}
+/*-- 27.08.2004 12:04:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void MailDispatcher::onTerminated()
+{
+ //keep the reference until the end of onTerminated() because of the call order in the
+ //_threadFunc() from osl/thread.hxx
+ m_xSelfReference = 0;
+}
diff --git a/sw/source/ui/dbui/mailmergechildwindow.cxx b/sw/source/ui/dbui/mailmergechildwindow.cxx
new file mode 100644
index 000000000000..06d7dffab0ed
--- /dev/null
+++ b/sw/source/ui/dbui/mailmergechildwindow.cxx
@@ -0,0 +1,796 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <cmdid.h>
+#include <swmodule.hxx>
+#include <view.hxx>
+#include <edtwin.hxx>
+#include <vcl/svapp.hxx>
+#include <mailmergechildwindow.hxx>
+#include <mmoutputpage.hxx>
+#include <mmconfigitem.hxx>
+#include <comphelper/processfactory.hxx>
+#include "com/sun/star/mail/XSmtpService.hpp"
+#include "com/sun/star/mail/MailServiceType.hpp"
+#include <rtl/ref.hxx>
+#include <maildispatcher.hxx>
+#include <imaildsplistener.hxx>
+#include <swunohelper.hxx>
+#include <svtools/svmedit.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/image.hxx>
+#include <mailmergechildwindow.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+using namespace ::com::sun::star;
+
+SFX_IMPL_FLOATINGWINDOW( SwMailMergeChildWindow, FN_MAILMERGE_CHILDWINDOW )
+//SFX_IMPL_FLOATINGWINDOW( SwSendMailChildWindow, FN_MAILMERGE_SENDMAIL_CHILDWINDOW )
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwMailMergeChildWindow::SwMailMergeChildWindow( Window* _pParent,
+ USHORT nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo ) :
+ SfxChildWindow( _pParent, nId )
+{
+ pWindow = new SwMailMergeChildWin( pBindings, this, _pParent);
+
+ if (!pInfo->aSize.Width() || !pInfo->aSize.Height())
+ {
+ SwView* pActiveView = ::GetActiveView();
+ if(pActiveView)
+ {
+ const SwEditWin &rEditWin = pActiveView->GetEditWin();
+ pWindow->SetPosPixel(rEditWin.OutputToScreenPixel(Point(0, 0)));
+ }
+ else
+ pWindow->SetPosPixel(_pParent->OutputToScreenPixel(Point(0, 0)));
+ pInfo->aPos = pWindow->GetPosPixel();
+ pInfo->aSize = pWindow->GetSizePixel();
+ }
+
+ ((SwMailMergeChildWin *)pWindow)->Initialize(pInfo);
+ pWindow->Show();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwMailMergeChildWin::SwMailMergeChildWin( SfxBindings* _pBindings,
+ SfxChildWindow* pChild,
+ Window *pParent) :
+ SfxFloatingWindow(_pBindings, pChild, pParent, SW_RES(DLG_MAILMERGECHILD)),
+ m_aBackTB(this, SW_RES( TB_BACK ))
+{
+ m_aBackTB.SetSelectHdl(LINK(this, SwMailMergeChildWin, BackHdl));
+ sal_uInt16 nIResId = GetSettings().GetStyleSettings().GetHighContrastMode() ?
+ ILIST_TBX_HC : ILIST_TBX;
+ ResId aResId( nIResId, *pSwResMgr );
+ ImageList aIList(aResId);
+ FreeResource();
+
+ m_aBackTB.SetItemImage( 1, aIList.GetImage(FN_SHOW_ROOT) );
+ m_aBackTB.SetButtonType( BUTTON_SYMBOLTEXT );
+ Size aSz = m_aBackTB.CalcWindowSizePixel(1);
+ m_aBackTB.SetPosSizePixel( Point(), aSz );
+ SetOutputSizePixel(aSz);
+ m_aBackTB.Show();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwMailMergeChildWin::~SwMailMergeChildWin()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwMailMergeChildWin, BackHdl, ToolBox *, EMPTYARG )
+{
+ GetBindings().GetDispatcher()->Execute(FN_MAILMERGE_WIZARD, SFX_CALLMODE_ASYNCHRON);
+ return 0;
+}
+
+/*-- 26.05.2004 10:12:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeChildWin::FillInfo(SfxChildWinInfo& rInfo) const
+{
+ SfxFloatingWindow::FillInfo(rInfo);
+ rInfo.aWinState.Erase();
+ rInfo.bVisible = sal_False;
+}
+/*-- 21.05.2004 14:07:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+struct SwSendMailDialog_Impl
+{
+ friend class SwSendMailDialog;
+ ::osl::Mutex aDescriptorMutex;
+
+ ::std::vector< SwMailDescriptor > aDescriptors;
+ sal_uInt32 nCurrentDescriptor;
+ sal_uInt32 nDocumentCount;
+ ::rtl::Reference< MailDispatcher > xMailDispatcher;
+ ::rtl::Reference< IMailDispatcherListener> xMailListener;
+ uno::Reference< mail::XMailService > xConnectedMailService;
+ uno::Reference< mail::XMailService > xConnectedInMailService;
+ Timer aRemoveTimer;
+
+
+ SwSendMailDialog_Impl() :
+ nCurrentDescriptor(0),
+ nDocumentCount(0)
+ {
+ aRemoveTimer.SetTimeout(500);
+ }
+
+ ~SwSendMailDialog_Impl()
+ {
+ // Shutdown must be called when the last reference to the
+ // mail dispatcher will be released in order to force a
+ // shutdown of the mail dispatcher thread.
+ // 'join' with the mail dispatcher thread leads to a
+ // deadlock (SolarMutex).
+ if( xMailDispatcher.is() && !xMailDispatcher->isShutdownRequested() )
+ xMailDispatcher->shutdown();
+ }
+ const SwMailDescriptor* GetNextDescriptor();
+};
+
+const SwMailDescriptor* SwSendMailDialog_Impl::GetNextDescriptor()
+{
+ ::osl::MutexGuard aGuard(aDescriptorMutex);
+ if(nCurrentDescriptor < aDescriptors.size())
+ {
+ ++nCurrentDescriptor;
+ return &aDescriptors[nCurrentDescriptor - 1];
+ }
+ return 0;
+}
+
+/*-- 23.06.2004 10:19:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailDispatcherListener_Impl : public IMailDispatcherListener
+{
+ SwSendMailDialog* m_pSendMailDialog;
+
+public:
+ SwMailDispatcherListener_Impl(SwSendMailDialog& rParentDlg);
+ ~SwMailDispatcherListener_Impl();
+
+ virtual void started(::rtl::Reference<MailDispatcher> xMailDispatcher);
+ virtual void stopped(::rtl::Reference<MailDispatcher> xMailDispatcher);
+ virtual void idle(::rtl::Reference<MailDispatcher> xMailDispatcher);
+ virtual void mailDelivered(::rtl::Reference<MailDispatcher> xMailDispatcher,
+ uno::Reference< mail::XMailMessage> xMailMessage);
+ virtual void mailDeliveryError(::rtl::Reference<MailDispatcher> xMailDispatcher,
+ uno::Reference< mail::XMailMessage> xMailMessage, const rtl::OUString& sErrorMessage);
+
+ static void DeleteAttachments( uno::Reference< mail::XMailMessage >& xMessage );
+};
+
+/*-- 23.06.2004 10:04:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailDispatcherListener_Impl::SwMailDispatcherListener_Impl(SwSendMailDialog& rParentDlg) :
+ m_pSendMailDialog(&rParentDlg)
+{
+}
+/*-- 23.06.2004 10:04:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailDispatcherListener_Impl::~SwMailDispatcherListener_Impl()
+{
+}
+/*-- 23.06.2004 10:04:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailDispatcherListener_Impl::started(::rtl::Reference<MailDispatcher> /*xMailDispatcher*/)
+{
+}
+/*-- 23.06.2004 10:04:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailDispatcherListener_Impl::stopped(
+ ::rtl::Reference<MailDispatcher> /*xMailDispatcher*/)
+{
+}
+/*-- 23.06.2004 10:04:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailDispatcherListener_Impl::idle(::rtl::Reference<MailDispatcher> /*xMailDispatcher*/)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ m_pSendMailDialog->AllMailsSent();
+}
+/*-- 23.06.2004 10:04:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailDispatcherListener_Impl::mailDelivered(
+ ::rtl::Reference<MailDispatcher> /*xMailDispatcher*/,
+ uno::Reference< mail::XMailMessage> xMailMessage)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ m_pSendMailDialog->DocumentSent( xMailMessage, true, 0 );
+ DeleteAttachments( xMailMessage );
+}
+/*-- 23.06.2004 10:04:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailDispatcherListener_Impl::mailDeliveryError(
+ ::rtl::Reference<MailDispatcher> /*xMailDispatcher*/,
+ uno::Reference< mail::XMailMessage> xMailMessage,
+ const rtl::OUString& sErrorMessage)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ m_pSendMailDialog->DocumentSent( xMailMessage, false, &sErrorMessage );
+ DeleteAttachments( xMailMessage );
+}
+/*-- 23.06.2004 12:30:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailDispatcherListener_Impl::DeleteAttachments( uno::Reference< mail::XMailMessage >& xMessage )
+{
+ uno::Sequence< mail::MailAttachment > aAttachments = xMessage->getAttachments();
+
+ for(sal_Int32 nFile = 0; nFile < aAttachments.getLength(); ++nFile)
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xTransferableProperties( aAttachments[nFile].Data, uno::UNO_QUERY_THROW);
+ if( xTransferableProperties.is() )
+ {
+ ::rtl::OUString sURL;
+ xTransferableProperties->getPropertyValue( ::rtl::OUString::createFromAscii("URL") ) >>= sURL;
+ if(sURL.getLength())
+ SWUnoHelper::UCB_DeleteFile( sURL );
+ }
+ }
+ catch( const uno::Exception& rEx )
+ {
+ (void)rEx;
+ }
+ }
+}
+/*-- 07.07.2004 13:45:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwSendWarningBox_Impl : public ModalDialog
+{
+ FixedImage aWarningImageIM;
+ FixedInfo aWarningFI;
+ FixedText aDetailFT;
+ MultiLineEdit aDetailED;
+ FixedLine aSeparatorFL;
+ OKButton aOKPB;
+
+public:
+ SwSendWarningBox_Impl(Window* pParent, const String& rDetails);
+ ~SwSendWarningBox_Impl();
+};
+/*-- 07.07.2004 13:52:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSendWarningBox_Impl::SwSendWarningBox_Impl(Window* pParent, const String& rDetails) :
+ ModalDialog(pParent, SW_RES( DLG_MM_SENDWARNING )),
+ aWarningImageIM(this, SW_RES( IM_WARNING )),
+ aWarningFI( this, SW_RES( FI_WARNING )),
+ aDetailFT( this, SW_RES( FT_DETAILS )),
+ aDetailED( this, SW_RES( ED_DETAILS )),
+ aSeparatorFL( this, SW_RES( FL_SEPARATOR )),
+ aOKPB( this, SW_RES(PB_OK))
+{
+ FreeResource();
+ aWarningImageIM.SetImage(WarningBox::GetStandardImage());
+ aDetailED.SetText(rDetails);
+}
+/*-- 07.07.2004 13:52:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSendWarningBox_Impl::~SwSendWarningBox_Impl()
+{
+}
+
+/*-- 21.05.2004 14:10:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+#define ITEMID_TASK 1
+#define ITEMID_STATUS 2
+
+SwSendMailDialog::SwSendMailDialog(Window *pParent, SwMailMergeConfigItem& rConfigItem) :
+ ModelessDialog /*SfxModalDialog*/(pParent, SW_RES(DLG_MM_SENDMAILS)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aStatusFL( this, SW_RES( FL_STATUS )),
+ m_aStatusFT( this, SW_RES( FT_STATUS1 )),
+ m_aTransferStatusFL( this, SW_RES( FL_TRANSFERSTATUS )),
+ m_aTransferStatusFT( this, SW_RES( FT_TRANSFERSTATUS )),
+ m_PausedFI(this, SW_RES( FI_PAUSED )),
+ m_aProgressBar( this, SW_RES( PB_PROGRESS )),
+ m_aErrorStatusFT( this, SW_RES( FT_ERRORSTATUS )),
+ m_aDetailsPB( this, SW_RES( PB_DETAILS )),
+ m_aStatusHB( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER ),
+ m_aStatusLB( this, SW_RES( LB_STATUS )),
+ m_aSeparatorFL( this, SW_RES( FL_SEPARATOR )),
+ m_aStopPB( this, SW_RES( PB_STOP )),
+ m_aClosePB( this, SW_RES( PB_CLOSE )),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_sMore(m_aDetailsPB.GetText()),
+ m_sLess(SW_RES(ST_LESS)),
+ m_sContinue(SW_RES( ST_CONTINUE )),
+ m_sStop(m_aStopPB.GetText()),
+ m_sSend(SW_RES(ST_SEND)),
+ m_sTransferStatus(m_aTransferStatusFT.GetText()),
+ m_sErrorStatus( m_aErrorStatusFT.GetText()),
+ m_sSendingTo( SW_RES(ST_SENDINGTO )),
+ m_sCompleted( SW_RES(ST_COMPLETED )),
+ m_sFailed( SW_RES(ST_FAILED )),
+ m_sTerminateQuery( SW_RES( ST_TERMINATEQUERY )),
+ m_bCancel(false),
+ m_bDesctructionEnabled(false),
+ m_aImageList( SW_RES( ILIST ) ),
+ m_aImageListHC( SW_RES( ILIST_HC ) ),
+ m_pImpl(new SwSendMailDialog_Impl),
+ m_pConfigItem(&rConfigItem),
+ m_nSendCount(0),
+ m_nErrorCount(0)
+{
+ m_nStatusHeight = m_aSeparatorFL.GetPosPixel().Y() - m_aStatusLB.GetPosPixel().Y();
+ String sTask(SW_RES(ST_TASK));
+ String sStatus(SW_RES(ST_STATUS));
+ m_aStatusLB.SetHelpId(HID_MM_SENDMAILS_STATUSLB);
+
+ FreeResource();
+
+ m_aDetailsPB.SetClickHdl(LINK( this, SwSendMailDialog, DetailsHdl_Impl));
+ m_aStopPB.SetClickHdl(LINK( this, SwSendMailDialog, StopHdl_Impl));
+ m_aClosePB.SetClickHdl(LINK( this, SwSendMailDialog, CloseHdl_Impl));
+
+
+ Size aLBSize(m_aStatusLB.GetSizePixel());
+ m_aStatusHB.SetSizePixel(aLBSize);
+ Size aHeadSize(m_aStatusHB.CalcWindowSizePixel());
+ aHeadSize.Width() = aLBSize.Width();
+ m_aStatusHB.SetSizePixel(aHeadSize);
+ Point aLBPos(m_aStatusLB.GetPosPixel());
+ m_aStatusHB.SetPosPixel(aLBPos);
+ aLBPos.Y() += aHeadSize.Height();
+ aLBSize.Height() -= aHeadSize.Height();
+ m_aStatusLB.SetPosSizePixel(aLBPos, aLBSize);
+
+ Size aSz(m_aStatusHB.GetOutputSizePixel());
+ long nPos1 = aSz.Width()/3 * 2;
+ long nPos2 = aSz.Width()/3;
+ m_aStatusHB.InsertItem( ITEMID_TASK, sTask,
+ nPos1,
+ HIB_LEFT | HIB_VCENTER );
+ m_aStatusHB.InsertItem( ITEMID_STATUS, sStatus,
+ nPos2,
+ HIB_LEFT | HIB_VCENTER );
+ m_aStatusHB.SetHelpId(HID_MM_ADDRESSLIST_HB );
+ m_aStatusHB.Show();
+
+ m_aStatusLB.SetHelpId(HID_MM_MAILSTATUS_TLB);
+ static long nTabs[] = {3, 0, nPos1, aSz.Width() };
+ m_aStatusLB.SetStyle( m_aStatusLB.GetStyle() | WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP );
+ m_aStatusLB.SetSelectionMode( SINGLE_SELECTION );
+ m_aStatusLB.SetTabs(&nTabs[0], MAP_PIXEL);
+ m_aStatusLB.SetSpaceBetweenEntries(3);
+
+ DetailsHdl_Impl( &m_aDetailsPB );
+ UpdateTransferStatus();
+}
+/*-- 21.05.2004 14:10:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSendMailDialog::~SwSendMailDialog()
+{
+ if(m_pImpl->xMailDispatcher.is())
+ {
+ try
+ {
+ if(m_pImpl->xMailDispatcher->isStarted())
+ m_pImpl->xMailDispatcher->stop();
+ if(m_pImpl->xConnectedMailService.is() && m_pImpl->xConnectedMailService->isConnected())
+ m_pImpl->xConnectedMailService->disconnect();
+ if(m_pImpl->xConnectedInMailService.is() && m_pImpl->xConnectedInMailService->isConnected())
+ m_pImpl->xConnectedInMailService->disconnect();
+
+ uno::Reference<mail::XMailMessage> xMessage =
+ m_pImpl->xMailDispatcher->dequeueMailMessage();
+ while(xMessage.is())
+ {
+ SwMailDispatcherListener_Impl::DeleteAttachments( xMessage );
+ xMessage = m_pImpl->xMailDispatcher->dequeueMailMessage();
+ }
+ }
+ catch(const uno::Exception&)
+ {
+ }
+ }
+ delete m_pImpl;
+}
+/*-- 21.05.2004 14:10:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSendMailDialog::AddDocument( SwMailDescriptor& rDesc )
+{
+ ::osl::MutexGuard aGuard(m_pImpl->aDescriptorMutex);
+ m_pImpl->aDescriptors.push_back(rDesc);
+ // if the dialog is already running then continue sending of documents
+ if(m_pImpl->xMailDispatcher.is())
+ {
+ IterateMails();
+ }
+
+}
+/*-- 31.01.2005 08:59:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSendMailDialog::SetDocumentCount( sal_Int32 nAllDocuments )
+{
+ m_pImpl->nDocumentCount = nAllDocuments;
+ UpdateTransferStatus();
+}
+/*-- 21.05.2004 14:10:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_Move(Control& rCtrl, long nYOffset)
+{
+ Point aPos(rCtrl.GetPosPixel());
+ aPos.Y() += nYOffset;
+ rCtrl.SetPosPixel(aPos);
+}
+/*-- 21.05.2004 14:10:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwSendMailDialog, DetailsHdl_Impl, PushButton*, EMPTYARG )
+{
+ long nMove = 0;
+ if(m_aStatusLB.IsVisible())
+ {
+ m_aStatusLB.Hide();
+ m_aStatusHB.Hide();
+ nMove = - m_nStatusHeight;
+ m_aDetailsPB.SetText(m_sMore);
+ }
+ else
+ {
+ m_aStatusLB.Show();
+ m_aStatusHB.Show();
+ nMove = m_nStatusHeight;
+ m_aDetailsPB.SetText(m_sLess);
+ }
+ lcl_Move(m_aSeparatorFL, nMove);
+ lcl_Move(m_aStopPB, nMove);
+ lcl_Move(m_aClosePB, nMove);
+ Size aDlgSize = GetSizePixel(); aDlgSize.Height() += nMove; SetSizePixel(aDlgSize);
+
+ return 0;
+}
+/*-- 21.05.2004 14:10:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwSendMailDialog, StopHdl_Impl, PushButton*, pButton )
+{
+ m_bCancel = true;
+ if(m_pImpl->xMailDispatcher.is())
+ {
+ if(m_pImpl->xMailDispatcher->isStarted())
+ {
+ m_pImpl->xMailDispatcher->stop();
+ pButton->SetText(m_sContinue);
+ m_PausedFI.Show();
+ }
+ else
+ {
+ m_pImpl->xMailDispatcher->start();
+ pButton->SetText(m_sStop);
+ m_PausedFI.Show(sal_False);
+ }
+ }
+ return 0;
+}
+/*-- 21.05.2004 14:10:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwSendMailDialog, CloseHdl_Impl, PushButton*, EMPTYARG )
+{
+ ModelessDialog::Show( sal_False );
+ return 0;
+}
+/*-- 14.06.2004 09:48:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_STATIC_LINK_NOINSTANCE( SwSendMailDialog, StartSendMails, SwSendMailDialog*, pDialog )
+{
+ pDialog->SendMails();
+ return 0;
+}
+/*-- 14.06.2004 09:48:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_STATIC_LINK( SwSendMailDialog, RemoveThis, Timer*, pTimer )
+{
+ if( pThis->m_pImpl->xMailDispatcher.is() )
+ {
+ if(pThis->m_pImpl->xMailDispatcher->isStarted())
+ pThis->m_pImpl->xMailDispatcher->stop();
+ if(!pThis->m_pImpl->xMailDispatcher->isShutdownRequested())
+ pThis->m_pImpl->xMailDispatcher->shutdown();
+ }
+
+ if( pThis->m_bDesctructionEnabled &&
+ (!pThis->m_pImpl->xMailDispatcher.is() ||
+ !pThis->m_pImpl->xMailDispatcher->isRunning()))
+ {
+ delete pThis;
+ }
+ else
+ {
+ pTimer->Start();
+ }
+ return 0;
+}
+/*-- 07.07.2004 14:34:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_STATIC_LINK_NOINSTANCE( SwSendMailDialog, StopSendMails, SwSendMailDialog*, pDialog )
+{
+ if(pDialog->m_pImpl->xMailDispatcher.is() &&
+ pDialog->m_pImpl->xMailDispatcher->isStarted())
+ {
+ pDialog->m_pImpl->xMailDispatcher->stop();
+ pDialog->m_aStopPB.SetText(pDialog->m_sContinue);
+ pDialog->m_PausedFI.Show();
+ }
+ return 0;
+}
+/*-- 14.06.2004 10:38:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSendMailDialog::SendMails()
+{
+ if(!m_pConfigItem)
+ {
+ DBG_ERROR("config item not set");
+ return;
+ }
+ String sErrorMessage;
+ bool bIsLoggedIn = false;
+ EnterWait();
+ //get a mail server connection
+ uno::Reference< mail::XSmtpService > xSmtpServer =
+ SwMailMergeHelper::ConnectToSmtpServer( *m_pConfigItem,
+ m_pImpl->xConnectedInMailService,
+ aEmptyStr, aEmptyStr, this );
+ bIsLoggedIn = xSmtpServer.is() && xSmtpServer->isConnected();
+ LeaveWait();
+ if(!bIsLoggedIn)
+ {
+ DBG_ERROR("create error message");
+ return;
+ }
+ m_pImpl->xMailDispatcher.set( new MailDispatcher(xSmtpServer));
+ IterateMails();
+ m_pImpl->xMailListener = new SwMailDispatcherListener_Impl(*this);
+ m_pImpl->xMailDispatcher->addListener(m_pImpl->xMailListener);
+ if(!m_bCancel)
+ {
+ m_pImpl->xMailDispatcher->start();
+ }
+}
+/* -----------------28.01.2005 10:17-----------------
+
+ --------------------------------------------------*/
+void SwSendMailDialog::IterateMails()
+{
+ const SwMailDescriptor* pCurrentMailDescriptor = m_pImpl->GetNextDescriptor();
+ while( pCurrentMailDescriptor )
+ {
+ if(!SwMailMergeHelper::CheckMailAddress( pCurrentMailDescriptor->sEMail ))
+ {
+ ImageList& rImgLst = GetSettings().GetStyleSettings().GetHighContrastMode() ?
+ m_aImageListHC : m_aImageList;
+ Image aInsertImg = rImgLst.GetImage( FN_FORMULA_CANCEL );
+
+ String sMessage = m_sSendingTo;
+ String sTmp(pCurrentMailDescriptor->sEMail);
+ sTmp += '\t';
+ sTmp += m_sFailed;
+ sMessage.SearchAndReplaceAscii("%1", sTmp);
+ m_aStatusLB.InsertEntry( sMessage, aInsertImg, aInsertImg);
+ ++m_nSendCount;
+ ++m_nErrorCount;
+ UpdateTransferStatus( );
+ pCurrentMailDescriptor = m_pImpl->GetNextDescriptor();
+ continue;
+ }
+ SwMailMessage* pMessage = 0;
+ uno::Reference< mail::XMailMessage > xMessage = pMessage = new SwMailMessage;
+ if(m_pConfigItem->IsMailReplyTo())
+ pMessage->setReplyToAddress(m_pConfigItem->GetMailReplyTo());
+ pMessage->addRecipient( pCurrentMailDescriptor->sEMail );
+ pMessage->SetSenderName( m_pConfigItem->GetMailDisplayName() );
+ pMessage->SetSenderAddress( m_pConfigItem->GetMailAddress() );
+ if(pCurrentMailDescriptor->sAttachmentURL.getLength())
+ {
+ mail::MailAttachment aAttach;
+ aAttach.Data =
+ new SwMailTransferable(
+ pCurrentMailDescriptor->sAttachmentURL,
+ pCurrentMailDescriptor->sAttachmentName,
+ pCurrentMailDescriptor->sMimeType );
+ aAttach.ReadableName = pCurrentMailDescriptor->sAttachmentName;
+ pMessage->addAttachment( aAttach );
+ }
+ pMessage->setSubject( pCurrentMailDescriptor->sSubject );
+ uno::Reference< datatransfer::XTransferable> xBody =
+ new SwMailTransferable(
+ pCurrentMailDescriptor->sBodyContent,
+ pCurrentMailDescriptor->sBodyMimeType);
+ pMessage->setBody( xBody );
+
+ //CC and BCC are tokenized by ';'
+ if(pCurrentMailDescriptor->sCC.getLength())
+ {
+ String sTokens( pCurrentMailDescriptor->sCC );
+ sal_uInt16 nTokens = sTokens.GetTokenCount( ';' );
+ xub_StrLen nPos = 0;
+ for( sal_uInt16 nToken = 0; nToken < nTokens; ++nToken)
+ {
+ String sTmp = sTokens.GetToken( 0, ';', nPos);
+ if( sTmp.Len() )
+ pMessage->addCcRecipient( sTmp );
+ }
+ }
+ if(pCurrentMailDescriptor->sBCC.getLength())
+ {
+ String sTokens( pCurrentMailDescriptor->sBCC );
+ sal_uInt16 nTokens = sTokens.GetTokenCount( ';' );
+ xub_StrLen nPos = 0;
+ for( sal_uInt16 nToken = 0; nToken < nTokens; ++nToken)
+ {
+ String sTmp = sTokens.GetToken( 0, ';', nPos);
+ if( sTmp.Len() )
+ pMessage->addBccRecipient( sTmp );
+ }
+ }
+ m_pImpl->xMailDispatcher->enqueueMailMessage( xMessage );
+ pCurrentMailDescriptor = m_pImpl->GetNextDescriptor();
+ }
+ UpdateTransferStatus();
+}
+/*-- 27.08.2004 10:50:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSendMailDialog::ShowDialog()
+{
+ Application::PostUserEvent( STATIC_LINK( this, SwSendMailDialog,
+ StartSendMails ), this );
+ ModelessDialog::Show();
+}
+/*-- 27.08.2004 10:50:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSendMailDialog::StateChanged( StateChangedType nStateChange )
+{
+ ModelessDialog::StateChanged( nStateChange );
+ if(STATE_CHANGE_VISIBLE == nStateChange && !IsVisible())
+ {
+ m_pImpl->aRemoveTimer.SetTimeoutHdl( STATIC_LINK( this, SwSendMailDialog,
+ RemoveThis ) );
+ m_pImpl->aRemoveTimer.Start();
+ }
+}
+
+/*-- 23.06.2004 10:14:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSendMailDialog::DocumentSent( uno::Reference< mail::XMailMessage> xMessage,
+ bool bResult,
+ const ::rtl::OUString* pError )
+{
+ //sending should stop on send errors
+ if(pError &&
+ m_pImpl->xMailDispatcher.is() && m_pImpl->xMailDispatcher->isStarted())
+ {
+ Application::PostUserEvent( STATIC_LINK( this, SwSendMailDialog,
+ StopSendMails ), this );
+ }
+ ImageList& rImgLst = GetSettings().GetStyleSettings().GetHighContrastMode() ?
+ m_aImageListHC : m_aImageList;
+ Image aInsertImg = rImgLst.GetImage( bResult ? FN_FORMULA_APPLY : FN_FORMULA_CANCEL );
+
+ String sMessage = m_sSendingTo;
+ String sTmp(xMessage->getRecipients()[0]);
+ sTmp += '\t';
+ sTmp += bResult ? m_sCompleted : m_sFailed;
+ sMessage.SearchAndReplaceAscii("%1", sTmp);
+ m_aStatusLB.InsertEntry( sMessage, aInsertImg, aInsertImg);
+ ++m_nSendCount;
+ if(!bResult)
+ ++m_nErrorCount;
+
+ UpdateTransferStatus( );
+ if(pError)
+ {
+ SwSendWarningBox_Impl* pDlg = new SwSendWarningBox_Impl(0, *pError);
+ pDlg->Execute();
+ delete pDlg;
+ }
+}
+/*-- 23.06.2004 11:25:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSendMailDialog::UpdateTransferStatus()
+{
+ String sStatus( m_sTransferStatus );
+ sStatus.SearchAndReplaceAscii("%1", String::CreateFromInt32(m_nSendCount) );
+ sStatus.SearchAndReplaceAscii("%2", String::CreateFromInt32(m_pImpl->nDocumentCount));
+ m_aTransferStatusFT.SetText(sStatus);
+
+ sStatus = m_sErrorStatus;
+ sStatus.SearchAndReplaceAscii("%1", String::CreateFromInt32(m_nErrorCount) );
+ m_aErrorStatusFT.SetText(sStatus);
+
+ if(m_pImpl->aDescriptors.size())
+ m_aProgressBar.SetValue((USHORT)(m_nSendCount * 100 / m_pImpl->aDescriptors.size()));
+ else
+ m_aProgressBar.SetValue(0);
+}
+/*-- 23.06.2004 11:18:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSendMailDialog::AllMailsSent()
+{
+ m_aStopPB.Enable(sal_False);
+}
+
+
diff --git a/sw/source/ui/dbui/mailmergechildwindow.hrc b/sw/source/ui/dbui/mailmergechildwindow.hrc
new file mode 100644
index 000000000000..9b5931522975
--- /dev/null
+++ b/sw/source/ui/dbui/mailmergechildwindow.hrc
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define TB_BACK 1
+#define ILIST_TBX 90
+#define ILIST_TBX_HC 91
+
+#define FL_SEPARATOR 7
+
+#define FL_STATUS 60
+#define FT_STATUS1 61
+#define FL_TRANSFERSTATUS 62
+#define FT_TRANSFERSTATUS 63
+#define PB_PROGRESS 64
+#define FT_ERRORSTATUS 65
+#define PB_DETAILS 66
+#define LB_STATUS 67
+#define FI_PAUSED 68
+#define PB_STOP 69
+#define PB_CLOSE 70
+#define ST_CONTINUE 71
+#define ST_LESS 72
+#define ST_TASK 73
+#define ST_STATUS 74
+#define ILIST 75
+#define ILIST_HC 76
+#define ST_SEND 77
+#define ST_SENDINGTO 78
+#define ST_COMPLETED 79
+#define ST_FAILED 80
+#define ST_TERMINATEQUERY 81
+
+#define IM_WARNING 10
+#define FI_WARNING 11
+#define FT_DETAILS 12
+#define ED_DETAILS 13
+#define PB_OK 14
diff --git a/sw/source/ui/dbui/mailmergechildwindow.src b/sw/source/ui/dbui/mailmergechildwindow.src
new file mode 100644
index 000000000000..5b5b32a7cc8d
--- /dev/null
+++ b/sw/source/ui/dbui/mailmergechildwindow.src
@@ -0,0 +1,279 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "mailmergechildwindow.hrc"
+#include "dbui.hrc"
+#include "helpid.h"
+#include <cmdid.h>
+
+#define WIDTH 100
+#define HEIGHT 16
+
+#define WORKAROUND \
+ Text [ en-US ] = "Return to Mail Merge Wizard" ; \
+
+
+FloatingWindow DLG_MAILMERGECHILD\
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( WIDTH , HEIGHT ) ;
+ Moveable = TRUE ;
+ Closeable = FALSE ;
+ Sizeable = FALSE ;
+ Zoomable = TRUE ;
+ HelpID = HID_MAILMERGECHILD ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Mail Merge Wizard";\
+ ToolBox TB_BACK\
+ {
+ MenuStrings = TRUE ;
+ SVLook = TRUE ;
+ ItemList =
+ {
+ ToolBoxItem\
+ {
+ Identifier = 1;
+ HelpID = HID_RETURN_TO_MAILMERGE ;
+ Left = TRUE;
+ WORKAROUND
+ };
+ };
+ };
+ #define IMGLIST1_IDS\
+ IdList = \
+ { \
+ FN_SHOW_ROOT; \
+ }; \
+ IdCount = 1
+
+ ImageList ILIST_TBX
+ {
+ Prefix = "sc";
+ MaskColor = IMAGE_MASK_COLOR;
+ IMGLIST1_IDS;
+ };
+
+ ImageList ILIST_TBX_HC
+ {
+ Prefix = "sch";
+ MaskColor = IMAGE_MASK_COLOR ;
+ IMGLIST1_IDS;
+ };
+};
+
+//FloatingWindow DLG_MM_SENDMAILS
+ModelessDialog /*ModalDialog*/ DLG_MM_SENDMAILS
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_SENDMAILS;
+ Size = MAP_APPFONT ( 250 , 221 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE;
+
+ Text [ en-US ] = "Sending E-mail messages";
+
+ FixedLine FL_STATUS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 238 , 8 ) ;
+ Text[ en-US ] = "Connection status";
+ };
+ FixedText FT_STATUS1
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 226 , 8 ) ;
+ Text[ en-US ] = "The connection to the outgoing mail server has been established";
+ };
+ String ST_SEND
+ {
+ Text[ en-US ] = "Sending e-mails...";
+ };
+ FixedLine FL_TRANSFERSTATUS
+ {
+ Pos = MAP_APPFONT ( 6 , 28 ) ;
+ Size = MAP_APPFONT ( 238 , 8 ) ;
+ Text[ en-US ] = "Transfer status";
+ };
+ FixedText FT_TRANSFERSTATUS
+ {
+ Pos = MAP_APPFONT ( 12, 39 ) ;
+ Size = MAP_APPFONT ( 110 , 8 ) ;
+ Text[ en-US ] = "%1 of %2 e-mails sent";
+ };
+ FixedText FI_PAUSED
+ {
+ Pos = MAP_APPFONT ( 125, 39 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Hide = TRUE;
+ Text[ en-US ] = "Sending paused";
+ };
+ Window PB_PROGRESS
+ {
+ Pos = MAP_APPFONT ( 12 , 50 ) ;
+ Size = MAP_APPFONT ( 226 , 14 ) ;
+ Border = TRUE;
+ };
+ FixedText FT_ERRORSTATUS
+ {
+ Pos = MAP_APPFONT ( 12 , 67 ) ;
+ Size = MAP_APPFONT ( 226 , 8 ) ;
+ Text[ en-US ] = "E-mails not sent: %1";
+ };
+ PushButton PB_DETAILS
+ {
+ Pos = MAP_APPFONT ( 188 , 81 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text[ en-US ] = "More >>";
+ };
+ String ST_LESS
+ {
+ Text[ en-US ] = "<< Less";
+ };
+
+ Control LB_STATUS
+ {
+ Pos = MAP_APPFONT ( 12 , 101 ) ;
+ Size = MAP_APPFONT ( 226 , 80 ) ;
+ Border = TRUE;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 187 ) ;
+ Size = MAP_APPFONT ( 250 , 8 ) ;
+ };
+ PushButton PB_STOP
+ {
+ Pos = MAP_APPFONT ( 141 , 201 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text[ en-US ] = "~Stop";
+ };
+ PushButton PB_CLOSE
+ {
+ Pos = MAP_APPFONT ( 194 , 201 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text[ en-US ] = "C~lose";
+ };
+ String ST_CONTINUE
+ {
+ Text[ en-US ] = "~Continue";
+ };
+ #define IMGLIST2_IDS\
+ IdList = \
+ { \
+ FN_FORMULA_CANCEL ;\
+ FN_FORMULA_APPLY ;\
+ }; \
+ IdCount = 2
+
+ ImageList ILIST
+ {
+ Prefix = "sc";
+ MaskColor = IMAGE_MASK_COLOR;
+ IMGLIST2_IDS;
+ };
+
+ ImageList ILIST_HC
+ {
+ Prefix = "sch";
+ MaskColor = IMAGE_MASK_COLOR ;
+ IMGLIST2_IDS;
+ };
+ String ST_TASK
+ {
+ Text[ en-US ] = "Task";
+ };
+ String ST_STATUS
+ {
+ Text[ en-US ] = "Status";
+ };
+ String ST_SENDINGTO
+ {
+ Text[ en-US ] = "Sending to: %1";
+ };
+ String ST_COMPLETED
+ {
+ Text[ en-US ] = "Successfully sent";
+ };
+ String ST_FAILED
+ {
+ Text[ en-US ] = "Sending failed (invalid address)";
+ };
+ String ST_TERMINATEQUERY
+ {
+ Text[ en-US ] = "There are still e-mail messages in your %PRODUCTNAME Outbox.\nWould you like to exit anyway?";
+ };
+};
+
+ModalDialog DLG_MM_SENDWARNING
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_SENDWARNING;
+ Size = MAP_APPFONT ( 240 , 137 ) ;
+ Moveable = TRUE ;
+
+ Text[en-US] = "E-Mails could not be sent";
+ FixedImage IM_WARNING
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 30 , 30 ) ;
+ };
+ FixedText FI_WARNING
+ {
+ Pos = MAP_APPFONT ( 40 , 6 ) ;
+ Size = MAP_APPFONT ( 170 , 30 ) ;
+ WordBreak = TRUE;
+ Text[ en-US ] = "The following error occurred:";
+ };
+ FixedText FT_DETAILS
+ {
+ Pos = MAP_APPFONT ( 40, 39 ) ;
+ Size = MAP_APPFONT ( 174, 8 ) ;
+ Text[ en-US ] = "Detailed information";
+ };
+ MultiLineEdit ED_DETAILS
+ {
+ HelpID = "sw:MultiLineEdit:DLG_MM_SENDWARNING:ED_DETAILS";
+ Pos = MAP_APPFONT ( 40 , 50 ) ;
+ Size = MAP_APPFONT ( 194 , 50 ) ;
+ Border = TRUE;
+ Readonly = TRUE;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 106 ) ;
+ Size = MAP_APPFONT ( 240 , 8 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 95 , 117) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE;
+ };
+};
+
diff --git a/sw/source/ui/dbui/mailmergehelper.cxx b/sw/source/ui/dbui/mailmergehelper.cxx
new file mode 100644
index 000000000000..7cc5d4070891
--- /dev/null
+++ b/sw/source/ui/dbui/mailmergehelper.cxx
@@ -0,0 +1,1047 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <swtypes.hxx>
+#include <mailmergehelper.hxx>
+#include <svtools/stdctrl.hxx>
+#include <mmconfigitem.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include "com/sun/star/mail/MailServiceProvider.hpp"
+#include "com/sun/star/mail/XSmtpService.hpp"
+#include <comphelper/processfactory.hxx>
+#include <vcl/msgbox.hxx>
+#ifndef _PASSWD_HXX
+#include <sfx2/passwd.hxx>
+#endif
+
+#include <dbui.hrc>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+
+using rtl::OUString;
+
+//using ::rtl::OUString;
+
+namespace SwMailMergeHelper
+{
+
+/*-- 14.06.2004 12:29:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+String CallSaveAsDialog(String& rFilter)
+{
+ ErrCode nRet;
+ String sFactory(String::CreateFromAscii(SwDocShell::Factory().GetShortName()));
+ ::sfx2::FileDialogHelper aDialog( ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION,
+ 0,
+ sFactory );
+
+ String sRet;
+ nRet = aDialog.Execute();
+ if(ERRCODE_NONE == nRet)
+ {
+ uno::Reference < ui::dialogs::XFilePicker > xFP = aDialog.GetFilePicker();
+ sRet = xFP->getFiles().getConstArray()[0];
+ rFilter = aDialog.GetRealFilter();
+ }
+ return sRet;
+}
+/*-- 20.08.2004 09:39:18---------------------------------------------------
+ simple address check: check for '@'
+ for at least one '.' after the '@'
+ and for at least to characters before and after the dot
+ -----------------------------------------------------------------------*/
+bool CheckMailAddress( const ::rtl::OUString& rMailAddress )
+{
+ String sAddress(rMailAddress);
+ if(!(sAddress.GetTokenCount('@') == 2))
+ return false;
+ sAddress = sAddress.GetToken(1, '@');
+ if(sAddress.GetTokenCount('.') < 2)
+ return false;
+ if(sAddress.GetToken( 0, '.').Len() < 2 || sAddress.GetToken( 1, '.').Len() < 2)
+ return false;
+ return true;
+}
+
+/*-- 28.12.2004 10:16:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< mail::XSmtpService > ConnectToSmtpServer(
+ SwMailMergeConfigItem& rConfigItem,
+ uno::Reference< mail::XMailService >& rxInMailService,
+ const String& rInMailServerPassword,
+ const String& rOutMailServerPassword,
+ Window* pDialogParentWindow )
+{
+ uno::Reference< mail::XSmtpService > xSmtpServer;
+ uno::Reference< lang::XMultiServiceFactory> rMgr = ::comphelper::getProcessServiceFactory();
+ if (rMgr.is())
+ try
+ {
+ uno::Reference< mail::XMailServiceProvider > xMailServiceProvider =
+ mail::MailServiceProvider::create(getCurrentCmpCtx(rMgr));
+ xSmtpServer = uno::Reference< mail::XSmtpService > (
+ xMailServiceProvider->create(
+ mail::MailServiceType_SMTP
+ ), uno::UNO_QUERY);
+
+ uno::Reference< mail::XConnectionListener> xConnectionListener(new SwConnectionListener());
+
+ if(rConfigItem.IsAuthentication() && rConfigItem.IsSMTPAfterPOP())
+ {
+ uno::Reference< mail::XMailService > xInMailService =
+ xMailServiceProvider->create(
+ rConfigItem.IsInServerPOP() ?
+ mail::MailServiceType_POP3 : mail::MailServiceType_IMAP);
+ //authenticate at the POP or IMAP server first
+ String sPasswd = rConfigItem.GetInServerPassword();
+ if(rInMailServerPassword.Len())
+ sPasswd = rInMailServerPassword;
+ uno::Reference<mail::XAuthenticator> xAuthenticator =
+ new SwAuthenticator(
+ rConfigItem.GetInServerUserName(),
+ sPasswd,
+ pDialogParentWindow);
+
+ xInMailService->addConnectionListener(xConnectionListener);
+ //check connection
+ uno::Reference< uno::XCurrentContext> xConnectionContext =
+ new SwConnectionContext(
+ rConfigItem.GetInServerName(),
+ rConfigItem.GetInServerPort(),
+ ::rtl::OUString::createFromAscii( "Insecure" ));
+ xInMailService->connect(xConnectionContext, xAuthenticator);
+ rxInMailService = xInMailService;
+ }
+ uno::Reference< mail::XAuthenticator> xAuthenticator;
+ if(rConfigItem.IsAuthentication() &&
+ !rConfigItem.IsSMTPAfterPOP() &&
+ rConfigItem.GetMailUserName().getLength())
+ {
+ String sPasswd = rConfigItem.GetMailPassword();
+ if(rOutMailServerPassword.Len())
+ sPasswd = rOutMailServerPassword;
+ xAuthenticator =
+ new SwAuthenticator(rConfigItem.GetMailUserName(),
+ sPasswd,
+ pDialogParentWindow);
+ }
+ else
+ xAuthenticator = new SwAuthenticator();
+ //just to check if the server exists
+ xSmtpServer->getSupportedConnectionTypes();
+ //check connection
+
+ uno::Reference< uno::XCurrentContext> xConnectionContext =
+ new SwConnectionContext(
+ rConfigItem.GetMailServer(),
+ rConfigItem.GetMailPort(),
+ ::rtl::OUString::createFromAscii( rConfigItem.IsSecureConnection() ? "Ssl" : "Insecure"));
+ xSmtpServer->connect(xConnectionContext, xAuthenticator);
+ rxInMailService = uno::Reference< mail::XMailService >( xSmtpServer, uno::UNO_QUERY );
+ }
+ catch(uno::Exception& )
+ {
+ DBG_ERROR("exception caught");
+ }
+ return xSmtpServer;
+}
+
+
+} //namespace
+
+/*-- 06.04.2004 10:31:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwBoldFixedInfo::SwBoldFixedInfo(Window* pParent, const ResId& rResId) :
+ FixedInfo(pParent, rResId)
+{
+ Font aFont = GetFont();
+ aFont.SetWeight( WEIGHT_BOLD );
+ SetFont( aFont );
+}
+/*-- 06.04.2004 10:31:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwBoldFixedInfo::~SwBoldFixedInfo()
+{
+}
+struct SwAddressPreview_Impl
+{
+ ::std::vector< ::rtl::OUString > aAdresses;
+ sal_uInt16 nRows;
+ sal_uInt16 nColumns;
+ sal_uInt16 nSelectedAddress;
+ bool bEnableScrollBar;
+
+ SwAddressPreview_Impl() :
+ nRows(1),
+ nColumns(1),
+ nSelectedAddress(0),
+ bEnableScrollBar(false)
+ {
+ }
+};
+/*-- 27.04.2004 14:01:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAddressPreview::SwAddressPreview(Window* pParent, const ResId rResId) :
+ Window( pParent, rResId ),
+ aVScrollBar(this, WB_VSCROLL),
+ pImpl(new SwAddressPreview_Impl())
+{
+ aVScrollBar.SetScrollHdl(LINK(this, SwAddressPreview, ScrollHdl));
+ Size aSize(GetOutputSizePixel());
+ Size aScrollSize(aVScrollBar.GetSizePixel());
+ aScrollSize.Height() = aSize.Height();
+ aVScrollBar.SetSizePixel(aScrollSize);
+ Point aSrollPos(aSize.Width() - aScrollSize.Width(), 0);
+ aVScrollBar.SetPosPixel(aSrollPos);
+ Show();
+}
+/*-- 27.04.2004 14:01:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAddressPreview::~SwAddressPreview()
+{
+}
+/*-- 25.06.2004 11:50:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAddressPreview, ScrollHdl, ScrollBar*, EMPTYARG)
+{
+ Invalidate();
+ return 0;
+}
+/*-- 27.04.2004 14:01:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressPreview::AddAddress(const ::rtl::OUString& rAddress)
+{
+ pImpl->aAdresses.push_back(rAddress);
+ UpdateScrollBar();
+}
+/*-- 27.04.2004 14:01:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressPreview::SetAddress(const ::rtl::OUString& rAddress)
+{
+ pImpl->aAdresses.clear();
+ pImpl->aAdresses.push_back(rAddress);
+ aVScrollBar.Show(FALSE);
+ Invalidate();
+}
+/*-- 27.04.2004 14:01:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_uInt16 SwAddressPreview::GetSelectedAddress()const
+{
+ DBG_ASSERT(pImpl->nSelectedAddress < pImpl->aAdresses.size(), "selection invalid");
+ return pImpl->nSelectedAddress;
+}
+/*-- 25.06.2004 10:32:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressPreview::SelectAddress(sal_uInt16 nSelect)
+{
+ DBG_ASSERT(pImpl->nSelectedAddress < pImpl->aAdresses.size(), "selection invalid");
+ pImpl->nSelectedAddress = nSelect;
+ // now make it visible..
+ sal_uInt16 nSelectRow = nSelect / pImpl->nColumns;
+ sal_uInt16 nStartRow = (sal_uInt16)aVScrollBar.GetThumbPos();
+ if( (nSelectRow < nStartRow) || (nSelectRow >= (nStartRow + pImpl->nRows) ))
+ aVScrollBar.SetThumbPos( nSelectRow );
+}
+/*-- 25.06.2004 11:00:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressPreview::Clear()
+{
+ pImpl->aAdresses.clear();
+ pImpl->nSelectedAddress = 0;
+ UpdateScrollBar();
+}
+/*-- 28.04.2004 12:05:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressPreview::ReplaceSelectedAddress(const ::rtl::OUString& rNew)
+{
+ pImpl->aAdresses[pImpl->nSelectedAddress] = rNew;
+ Invalidate();
+}
+/*-- 25.06.2004 11:30:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressPreview::RemoveSelectedAddress()
+{
+ pImpl->aAdresses.erase(pImpl->aAdresses.begin() + pImpl->nSelectedAddress);
+ if(pImpl->nSelectedAddress)
+ --pImpl->nSelectedAddress;
+ UpdateScrollBar();
+ Invalidate();
+}
+/*-- 27.04.2004 14:01:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressPreview::SetLayout(sal_uInt16 nRows, sal_uInt16 nColumns)
+{
+ pImpl->nRows = nRows;
+ pImpl->nColumns = nColumns;
+ UpdateScrollBar();
+}
+/*-- 25.06.2004 13:54:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressPreview::EnableScrollBar(bool bEnable)
+{
+ pImpl->bEnableScrollBar = bEnable;
+}
+/*-- 25.06.2004 11:55:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressPreview::UpdateScrollBar()
+{
+ if(pImpl->nColumns)
+ {
+ aVScrollBar.SetVisibleSize(pImpl->nRows);
+ sal_uInt16 nResultingRows = (sal_uInt16)(pImpl->aAdresses.size() + pImpl->nColumns - 1) / pImpl->nColumns;
+ ++nResultingRows;
+ aVScrollBar.Show(pImpl->bEnableScrollBar && nResultingRows > pImpl->nRows);
+ aVScrollBar.SetRange(Range(0, nResultingRows));
+ if(aVScrollBar.GetThumbPos() > nResultingRows)
+ aVScrollBar.SetThumbPos(nResultingRows);
+ }
+}
+/*-- 27.04.2004 14:01:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressPreview::Paint(const Rectangle&)
+{
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+ SetFillColor(rSettings.GetWindowColor());
+ SetLineColor( Color(COL_TRANSPARENT) );
+ DrawRect( Rectangle(Point(0, 0), GetOutputSizePixel()) );
+ Color aPaintColor(IsEnabled() ? rSettings.GetWindowTextColor() : rSettings.GetDisableColor());
+ SetLineColor(aPaintColor);
+ Font aFont(GetFont());
+ aFont.SetColor(aPaintColor);
+ SetFont(aFont);
+
+ Size aSize = GetOutputSizePixel();
+ sal_uInt16 nStartRow = 0;
+ if(aVScrollBar.IsVisible())
+ {
+ aSize.Width() -= aVScrollBar.GetSizePixel().Width();
+ nStartRow = (sal_uInt16)aVScrollBar.GetThumbPos();
+ }
+ Size aPartSize( aSize.Width()/pImpl->nColumns, aSize.Height()/pImpl->nRows );
+ aPartSize.Width() -= 2;
+ aPartSize.Height() -= 2;
+
+ sal_uInt16 nAddress = nStartRow * pImpl->nColumns;
+ const sal_uInt16 nNumAddresses = static_cast< sal_uInt16 >(pImpl->aAdresses.size());
+ for(sal_uInt16 nRow = 0; nRow < pImpl->nRows ; ++nRow)
+ {
+ for(sal_uInt16 nCol = 0; nCol < pImpl->nColumns; ++nCol)
+ {
+ if(nAddress >= nNumAddresses)
+ break;
+ Point aPos(nCol * aPartSize.Width(), (nRow) * aPartSize.Height());
+ aPos.Move(1,1);
+ bool bIsSelected = nAddress == pImpl->nSelectedAddress;
+ if((pImpl->nColumns * pImpl->nRows) == 1)
+ bIsSelected = false;
+ ::rtl::OUString adr(pImpl->aAdresses[nAddress]);
+ DrawText_Impl(adr,aPos,aPartSize,bIsSelected);
+ ++nAddress;
+ }
+ }
+ SetClipRegion();
+}
+
+/*-- 07.06.2004 15:44:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressPreview::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ Window::MouseButtonDown(rMEvt);
+ if(rMEvt.IsLeft() && ( pImpl->nRows || pImpl->nColumns))
+ {
+ //determine the selected address
+ const Point& rMousePos = rMEvt.GetPosPixel();
+ Size aSize(GetOutputSizePixel());
+ Size aPartSize( aSize.Width()/pImpl->nColumns, aSize.Height()/pImpl->nRows );
+ sal_uInt32 nRow = rMousePos.Y() / aPartSize.Height() ;
+ if(aVScrollBar.IsVisible())
+ {
+ nRow += (sal_uInt16)aVScrollBar.GetThumbPos();
+ }
+ sal_uInt32 nCol = rMousePos.X() / aPartSize.Width();
+ sal_uInt32 nSelect = nRow * pImpl->nColumns + nCol;
+
+ if( nSelect < pImpl->aAdresses.size() &&
+ pImpl->nSelectedAddress != (sal_uInt16)nSelect)
+ {
+ pImpl->nSelectedAddress = (sal_uInt16)nSelect;
+ m_aSelectHdl.Call(this);
+ }
+ Invalidate();
+ }
+}
+/*-- 01.07.2004 12:33:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressPreview::KeyInput( const KeyEvent& rKEvt )
+{
+ USHORT nKey = rKEvt.GetKeyCode().GetCode();
+ if(pImpl->nRows || pImpl->nColumns)
+ {
+ sal_uInt32 nSelectedRow = (pImpl->nSelectedAddress + 1)/ pImpl->nColumns;
+ sal_uInt32 nSelectedColumn = pImpl->nSelectedAddress % nSelectedRow;
+ switch(nKey)
+ {
+ case KEY_UP:
+ if(nSelectedRow)
+ --nSelectedRow;
+ break;
+ case KEY_DOWN:
+ if(pImpl->aAdresses.size() > sal_uInt32(pImpl->nSelectedAddress + pImpl->nColumns))
+ ++nSelectedRow;
+ break;
+ case KEY_LEFT:
+ if(nSelectedColumn)
+ --nSelectedColumn;
+ break;
+ case KEY_RIGHT:
+ if(nSelectedColumn < sal_uInt32(pImpl->nColumns - 1) &&
+ pImpl->aAdresses.size() - 1 > pImpl->nSelectedAddress )
+ ++nSelectedColumn;
+ break;
+ }
+ sal_uInt32 nSelect = nSelectedRow * pImpl->nColumns + nSelectedColumn;
+ if( nSelect < pImpl->aAdresses.size() &&
+ pImpl->nSelectedAddress != (sal_uInt16)nSelect)
+ {
+ pImpl->nSelectedAddress = (sal_uInt16)nSelect;
+ m_aSelectHdl.Call(this);
+ Invalidate();
+ }
+ }
+ else
+ Window::KeyInput(rKEvt);
+}
+/*-- 05.07.2004 12:02:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressPreview::StateChanged( StateChangedType nStateChange )
+{
+ if(nStateChange == STATE_CHANGE_ENABLE)
+ Invalidate();
+ Window::StateChanged(nStateChange);
+}
+/*-- 27.04.2004 14:01:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAddressPreview::DrawText_Impl(
+ const ::rtl::OUString& rAddress, const Point& rTopLeft, const Size& rSize, bool bIsSelected)
+{
+ SetClipRegion( Region( Rectangle(rTopLeft, rSize)) );
+ if(bIsSelected)
+ {
+ //selection rectangle
+ SetFillColor(Color(COL_TRANSPARENT));
+ DrawRect(Rectangle(rTopLeft, rSize));
+ }
+ sal_Int32 nHeight = GetTextHeight();
+ String sAddress(rAddress);
+ sal_uInt16 nTokens = sAddress.GetTokenCount('\n');
+ Point aStart = rTopLeft;
+ //put it away from the border
+ aStart.Move( 2, 2);
+ for(sal_uInt16 nToken = 0; nToken < nTokens; nToken++)
+ {
+ DrawText( aStart, sAddress.GetToken(nToken, '\n') );
+ aStart.Y() += nHeight;
+ }
+}
+/*-- 29.04.2004 11:24:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+String SwAddressPreview::FillData(
+ const ::rtl::OUString& rAddress,
+ SwMailMergeConfigItem& rConfigItem,
+ const Sequence< ::rtl::OUString>* pAssignments)
+{
+ //find the column names in the address string (with name assignment!) and
+ //exchange the placeholder (like <Firstname>) with the database content
+ //unassigned columns are expanded to <not assigned>
+ Reference< XColumnsSupplier > xColsSupp( rConfigItem.GetResultSet(), UNO_QUERY);
+ Reference <XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : 0;
+ Sequence< ::rtl::OUString> aAssignment = pAssignments ?
+ *pAssignments :
+ rConfigItem.GetColumnAssignment(
+ rConfigItem.GetCurrentDBData() );
+ const ::rtl::OUString* pAssignment = aAssignment.getConstArray();
+ const ResStringArray& rDefHeaders = rConfigItem.GetDefaultAddressHeaders();
+ String sAddress(rAddress);
+ String sNotAssigned(SW_RES(STR_NOTASSIGNED));
+ sNotAssigned.Insert('<', 0);
+ sNotAssigned += '>';
+
+ sal_Bool bIncludeCountry = rConfigItem.IsIncludeCountry();
+ const ::rtl::OUString rExcludeCountry = rConfigItem.GetExcludeCountry();
+ bool bSpecialReplacementForCountry = (!bIncludeCountry || rExcludeCountry.getLength());
+ String sCountryColumn;
+ if( bSpecialReplacementForCountry )
+ {
+ sCountryColumn = rDefHeaders.GetString(MM_PART_COUNTRY);
+ Sequence< ::rtl::OUString> aSpecialAssignment =
+ rConfigItem.GetColumnAssignment( rConfigItem.GetCurrentDBData() );
+ if(aSpecialAssignment.getLength() > MM_PART_COUNTRY && aSpecialAssignment[MM_PART_COUNTRY].getLength())
+ sCountryColumn = aSpecialAssignment[MM_PART_COUNTRY];
+ }
+
+ SwAddressIterator aIter(sAddress);
+ sAddress.Erase();
+ while(aIter.HasMore())
+ {
+ SwMergeAddressItem aItem = aIter.Next();
+ if(aItem.bIsColumn)
+ {
+ //get the default column name
+
+ //find the appropriate assignment
+ String sConvertedColumn = aItem.sText;
+ for(USHORT nColumn = 0;
+ nColumn < rDefHeaders.Count() && nColumn < aAssignment.getLength();
+ ++nColumn)
+ {
+ if(rDefHeaders.GetString(nColumn) == aItem.sText &&
+ pAssignment[nColumn].getLength())
+ {
+ sConvertedColumn = pAssignment[nColumn];
+ break;
+ }
+ }
+ if(sConvertedColumn.Len() &&
+ xColAccess.is() &&
+ xColAccess->hasByName(sConvertedColumn))
+ {
+ //get the content and exchange it in the address string
+ Any aCol = xColAccess->getByName(sConvertedColumn);
+ Reference< XColumn > xColumn;
+ aCol >>= xColumn;
+ if(xColumn.is())
+ {
+ try
+ {
+ ::rtl::OUString sReplace = xColumn->getString();
+
+ if( bSpecialReplacementForCountry && sCountryColumn == sConvertedColumn )
+ {
+ if( rExcludeCountry.getLength() && sReplace != rExcludeCountry )
+ aItem.sText = sReplace;
+ else
+ aItem.sText.Erase();
+ }
+ else
+ {
+ aItem.sText = sReplace;
+ }
+ }
+ catch( sdbc::SQLException& )
+ {
+ DBG_ERROR("SQLException caught");
+ }
+ }
+ }
+ else
+ {
+ aItem.sText = sNotAssigned;
+ }
+
+ }
+ sAddress += aItem.sText;
+ }
+ return sAddress;
+}
+
+/*-- 11.05.2004 15:42:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMergeAddressItem SwAddressIterator::Next()
+{
+ //currently the string may either start with a '<' then it's a column
+ //otherwise it's simple text maybe containing a return
+ SwMergeAddressItem aRet;
+ if(sAddress.Len())
+ {
+ if(sAddress.GetChar(0) == '<')
+ {
+ aRet.bIsColumn = true;
+ xub_StrLen nClose = sAddress.Search('>');
+ DBG_ASSERT(nClose != STRING_NOTFOUND, "closing '>' not found");
+ if( nClose != STRING_NOTFOUND )
+ {
+ aRet.sText = sAddress.Copy(1, nClose - 1);
+ sAddress.Erase(0, nClose + 1);
+ }
+ else
+ {
+ aRet.sText = sAddress.Copy(1, 1);
+ sAddress.Erase(0, 1);
+ }
+ }
+ else
+ {
+ xub_StrLen nOpen = sAddress.Search('<');
+ xub_StrLen nReturn = sAddress.Search('\n');
+ if(nReturn == 0)
+ {
+ aRet.bIsReturn = true;
+ aRet.sText = '\n';
+ sAddress.Erase(0, 1);
+ }
+ else if(STRING_NOTFOUND == nOpen && STRING_NOTFOUND == nReturn)
+ {
+ nOpen = sAddress.Len();
+ aRet.sText = sAddress;
+ sAddress.Erase();
+ }
+ else
+ {
+ xub_StrLen nTarget = ::std::min(nOpen, nReturn);
+ aRet.sText = sAddress.Copy(0, nTarget);
+ sAddress.Erase(0, nTarget);
+ }
+ }
+ }
+ return aRet;
+
+}
+/*-- 21.05.2004 10:36:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAuthenticator::~SwAuthenticator()
+{
+}
+/*-- 21.05.2004 10:36:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwAuthenticator::getUserName( ) throw (RuntimeException)
+{
+ return m_aUserName;
+}
+/*-- 21.05.2004 10:36:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwAuthenticator::getPassword( ) throw (RuntimeException)
+{
+ if(m_aUserName.getLength() && !m_aPassword.getLength() && m_pParentWindow)
+ {
+ SfxPasswordDialog* pPasswdDlg =
+ new SfxPasswordDialog( m_pParentWindow );
+ pPasswdDlg->SetMinLen( 0 );
+ if(RET_OK == pPasswdDlg->Execute())
+ m_aPassword = pPasswdDlg->GetPassword();
+ }
+ return m_aPassword;
+}
+/*-- 25.08.2004 12:53:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwConnectionContext::SwConnectionContext(
+ const ::rtl::OUString& rMailServer, sal_Int16 nPort,
+ const ::rtl::OUString& rConnectionType) :
+ m_sMailServer(rMailServer),
+ m_nPort(nPort),
+ m_sConnectionType(rConnectionType)
+{
+}
+/*-- 25.08.2004 12:53:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwConnectionContext::~SwConnectionContext()
+{
+}
+/*-- 25.08.2004 12:53:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwConnectionContext::getValueByName( const ::rtl::OUString& rName )
+ throw (uno::RuntimeException)
+{
+ uno::Any aRet;
+ if( !rName.compareToAscii( "ServerName" ))
+ aRet <<= m_sMailServer;
+ else if( !rName.compareToAscii( "Port" ))
+ aRet <<= (sal_Int32) m_nPort;
+ else if( !rName.compareToAscii( "ConnectionType" ))
+ aRet <<= m_sConnectionType;
+ return aRet;
+}
+/*-- 21.05.2004 10:45:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwConnectionListener::~SwConnectionListener()
+{
+}
+/*-- 21.05.2004 10:45:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwConnectionListener::connected(const lang::EventObject& /*aEvent*/)
+ throw (uno::RuntimeException)
+{
+ //OSL_ENSURE(false, "Connection opened");
+}
+/*-- 21.05.2004 10:45:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwConnectionListener::disconnected(const lang::EventObject& /*aEvent*/)
+ throw (uno::RuntimeException)
+{
+ //OSL_ENSURE(false, "Connection closed");
+}
+/*-- 21.05.2004 10:45:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwConnectionListener::disposing(const lang::EventObject& /*aEvent*/)
+ throw(uno::RuntimeException)
+{
+}
+/*-- 21.05.2004 10:17:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< uno::XComponentContext> getCurrentCmpCtx(
+ uno::Reference<lang::XMultiServiceFactory> rSrvMgr)
+{
+ uno::Reference< beans::XPropertySet > xPropSet =
+ uno::Reference< beans::XPropertySet>(rSrvMgr, uno::UNO_QUERY);
+ Any aAny = xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii("DefaultContext"));
+ uno::Reference< uno::XComponentContext> rCmpCtx;
+ aAny >>= rCmpCtx;
+ return rCmpCtx;
+}
+/*-- 13.07.2004 09:07:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailTransferable::SwMailTransferable(const rtl::OUString& rBody, const rtl::OUString& rMimeType) :
+ cppu::WeakComponentImplHelper2< datatransfer::XTransferable, beans::XPropertySet >(m_aMutex),
+ m_aMimeType( rMimeType ),
+ m_sBody( rBody ),
+ m_bIsBody( true )
+{
+}
+/*-- 13.07.2004 09:07:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailTransferable::SwMailTransferable(const rtl::OUString& rURL,
+ const rtl::OUString& rName, const rtl::OUString& rMimeType) :
+ cppu::WeakComponentImplHelper2< datatransfer::XTransferable, beans::XPropertySet >(m_aMutex),
+ m_aMimeType( rMimeType ),
+ m_aURL(rURL),
+ m_aName( rName ),
+ m_bIsBody( false )
+{
+}
+/*-- 13.07.2004 09:07:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailTransferable::~SwMailTransferable()
+{
+}
+/*-- 13.07.2004 09:07:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwMailTransferable::getTransferData( const datatransfer::DataFlavor& /*aFlavor*/ )
+ throw (datatransfer::UnsupportedFlavorException,
+ io::IOException, uno::RuntimeException)
+{
+ uno::Any aRet;
+ if( m_bIsBody )
+ aRet <<= ::rtl::OUString(m_sBody);
+ else
+ {
+ Sequence<sal_Int8> aData;
+ SfxMedium aMedium( m_aURL, STREAM_STD_READ, FALSE );
+ SvStream* pStream = aMedium.GetInStream();
+ if ( aMedium.GetErrorCode() == ERRCODE_NONE && pStream)
+ {
+ pStream->Seek(STREAM_SEEK_TO_END);
+ aData.realloc(pStream->Tell());
+ pStream->Seek(0);
+ sal_Int8 * pData = aData.getArray();
+ pStream->Read( pData, aData.getLength() );
+ }
+ aRet <<= aData;
+ }
+ return aRet;
+}
+/*-- 13.07.2004 09:07:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< datatransfer::DataFlavor > SwMailTransferable::getTransferDataFlavors( )
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< datatransfer::DataFlavor > aRet(1);
+ aRet[0].MimeType = m_aMimeType;
+ if( m_bIsBody )
+ {
+ aRet[0].DataType = getCppuType((::rtl::OUString*)0);
+ }
+ else
+ {
+ aRet[0].HumanPresentableName = m_aName;
+ aRet[0].DataType = getCppuType((uno::Sequence<sal_Int8>*)0);
+ }
+ return aRet;
+}
+/*-- 13.07.2004 09:07:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailTransferable::isDataFlavorSupported(
+ const datatransfer::DataFlavor& aFlavor )
+ throw (uno::RuntimeException)
+{
+ return (aFlavor.MimeType == ::rtl::OUString(m_aMimeType));
+}
+/*-- 28.04.2004 09:52:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwMailTransferable::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ return uno::Reference< beans::XPropertySetInfo >();
+}
+/*-- 28.04.2004 09:52:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailTransferable::setPropertyValue( const ::rtl::OUString& , const uno::Any& )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
+ lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+/*-- 28.04.2004 09:52:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwMailTransferable::getPropertyValue( const ::rtl::OUString& rPropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ uno::Any aRet;
+ if( rPropertyName.equalsAscii( "URL" ) )
+ aRet <<= m_aURL;
+ return aRet;
+}
+/*-- 28.04.2004 09:52:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailTransferable::addPropertyChangeListener(
+ const ::rtl::OUString&, const uno::Reference< beans::XPropertyChangeListener >& )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+/*-- 28.04.2004 09:52:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailTransferable::removePropertyChangeListener(
+ const ::rtl::OUString&,
+ const uno::Reference< beans::XPropertyChangeListener >& )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+/*-- 28.04.2004 09:52:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailTransferable::addVetoableChangeListener(
+ const ::rtl::OUString&,
+ const uno::Reference< beans::XVetoableChangeListener >& )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+/*-- 28.04.2004 09:52:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailTransferable::removeVetoableChangeListener(
+ const ::rtl::OUString& ,
+ const uno::Reference< beans::XVetoableChangeListener >& )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+
+/*-- 22.06.2004 16:46:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMessage::SwMailMessage() :
+ cppu::WeakComponentImplHelper1< mail::XMailMessage>(m_aMutex)
+{
+}
+/*-- 22.06.2004 16:46:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMessage::~SwMailMessage()
+{
+}
+/*-- 02.07.2007 16:00:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwMailMessage::getSenderName() throw (uno::RuntimeException)
+{
+ return m_sSenderName;
+}
+/*-- 22.06.2004 16:46:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwMailMessage::getSenderAddress() throw (uno::RuntimeException)
+{
+ return m_sSenderAddress;
+}
+/*-- 22.06.2004 16:46:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwMailMessage::getReplyToAddress() throw (uno::RuntimeException)
+{
+ return m_sReplyToAddress;
+}
+/*-- 22.06.2004 16:46:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMessage::setReplyToAddress( const ::rtl::OUString& _replytoaddress ) throw (uno::RuntimeException)
+{
+ m_sReplyToAddress = _replytoaddress;
+}
+/*-- 22.06.2004 16:46:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwMailMessage::getSubject() throw (uno::RuntimeException)
+{
+ return m_sSubject;
+}
+/*-- 22.06.2004 16:46:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMessage::setSubject( const ::rtl::OUString& _subject ) throw (uno::RuntimeException)
+{
+ m_sSubject = _subject;
+}
+/*-- 13.07.2004 09:57:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< datatransfer::XTransferable > SwMailMessage::getBody() throw (uno::RuntimeException)
+{
+ return m_xBody;
+}
+/*-- 13.07.2004 09:57:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMessage::setBody(
+ const uno::Reference< datatransfer::XTransferable >& rBody )
+ throw (uno::RuntimeException)
+{
+ m_xBody = rBody;
+}
+/*-- 22.06.2004 16:46:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMessage::addRecipient( const ::rtl::OUString& rRecipientAddress )
+ throw (uno::RuntimeException)
+{
+ m_aRecipients.realloc(m_aRecipients.getLength() + 1);
+ m_aRecipients[m_aRecipients.getLength() - 1] = rRecipientAddress;
+}
+/*-- 22.06.2004 16:46:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMessage::addCcRecipient( const ::rtl::OUString& rRecipientAddress )
+ throw (uno::RuntimeException)
+{
+ m_aCcRecipients.realloc(m_aCcRecipients.getLength() + 1);
+ m_aCcRecipients[m_aCcRecipients.getLength() - 1] = rRecipientAddress;
+
+}
+/*-- 22.06.2004 16:46:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMessage::addBccRecipient( const ::rtl::OUString& rRecipientAddress ) throw (uno::RuntimeException)
+{
+ m_aBccRecipients.realloc(m_aBccRecipients.getLength() + 1);
+ m_aBccRecipients[m_aBccRecipients.getLength() - 1] = rRecipientAddress;
+}
+/*-- 22.06.2004 16:46:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< ::rtl::OUString > SwMailMessage::getRecipients( ) throw (uno::RuntimeException)
+{
+ return m_aRecipients;
+}
+/*-- 22.06.2004 16:46:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< ::rtl::OUString > SwMailMessage::getCcRecipients( ) throw (uno::RuntimeException)
+{
+ return m_aCcRecipients;
+}
+/*-- 22.06.2004 16:46:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< ::rtl::OUString > SwMailMessage::getBccRecipients( ) throw (uno::RuntimeException)
+{
+ return m_aBccRecipients;
+}
+/*-- 13.07.2004 09:59:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMessage::addAttachment( const mail::MailAttachment& rMailAttachment )
+ throw (uno::RuntimeException)
+{
+ m_aAttachments.realloc(m_aAttachments.getLength() + 1);
+ m_aAttachments[m_aAttachments.getLength() - 1] = rMailAttachment;
+}
+/*-- 13.07.2004 09:59:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< mail::MailAttachment > SwMailMessage::getAttachments( )
+ throw (uno::RuntimeException)
+{
+ return m_aAttachments;
+}
diff --git a/sw/source/ui/dbui/mailmergewizard.cxx b/sw/source/ui/dbui/mailmergewizard.cxx
new file mode 100644
index 000000000000..365c56b4c0ea
--- /dev/null
+++ b/sw/source/ui/dbui/mailmergewizard.cxx
@@ -0,0 +1,336 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <mailmergewizard.hxx>
+#include <mmdocselectpage.hxx>
+#include <mmoutputtypepage.hxx>
+#include <mmaddressblockpage.hxx>
+#include <mmpreparemergepage.hxx>
+#include <mmmergepage.hxx>
+#include <mmgreetingspage.hxx>
+#include <mmoutputpage.hxx>
+#include <mmlayoutpage.hxx>
+#include <mmconfigitem.hxx>
+#include <swabstdlg.hxx>
+#ifndef _DBUI_HRC
+#include <dbui.hrc>
+#endif
+#include <view.hxx>
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+#include <sfx2/viewfrm.hxx>
+#include <wrtsh.hxx>
+#include <sfx2/viewfrm.hxx>
+#include "vcl/msgbox.hxx" // RET_CANCEL
+
+#include <helpid.h>
+#include <dbui.hrc>
+#include <mailmergewizard.hrc>
+
+using namespace svt;
+using namespace ::com::sun::star;
+/*-- 01.04.2004 16:52:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeWizard::SwMailMergeWizard(SwView& rView, SwMailMergeConfigItem& rItem) :
+ RoadmapWizard(&rView.GetViewFrame()->GetWindow(),
+ SW_RES(DLG_MAILMERGEWIZARD),
+ WZB_NEXT|WZB_PREVIOUS|WZB_FINISH|WZB_CANCEL|WZB_HELP),
+ m_pSwView(&rView),
+ m_bDocumentLoad( false ),
+ m_rConfigItem(rItem),
+ m_sStarting( SW_RES( ST_STARTING )),
+ m_sDocumentType( SW_RES( ST_DOCUMETNTYPE )),
+ m_sAddressBlock( SW_RES( ST_ADDRESSBLOCK )),
+ m_sAddressList( SW_RES( ST_ADDRESSLIST )),
+ m_sGreetingsLine( SW_RES( ST_GREETINGSLINE )),
+ m_sLayout( SW_RES( ST_LAYOUT )),
+ m_sPrepareMerge( SW_RES( ST_PREPAREMERGE )),
+ m_sMerge( SW_RES( ST_MERGE )),
+ m_sOutput( SW_RES( ST_OUTPUT )),
+ m_sFinish( SW_RES( ST_FINISH )),
+ m_nRestartPage( MM_DOCUMENTSELECTPAGE )
+{
+ FreeResource();
+ ShowButtonFixedLine(sal_True);
+ defaultButton(WZB_NEXT);
+ enableButtons(WZB_FINISH, sal_False);
+
+ m_pFinish->SetText(m_sFinish);
+ m_pNextPage->SetHelpId(HID_MM_NEXT_PAGE);
+ m_pPrevPage->SetHelpId(HID_MM_PREV_PAGE);
+
+ //#i51949# no output type page visible if e-Mail is not supported
+ if(rItem.IsMailAvailable())
+ declarePath(
+ 0,
+ MM_DOCUMENTSELECTPAGE,
+ MM_OUTPUTTYPETPAGE,
+ MM_ADDRESSBLOCKPAGE,
+ MM_GREETINGSPAGE,
+ MM_LAYOUTPAGE,
+ MM_PREPAREMERGEPAGE,
+ MM_MERGEPAGE,
+ MM_OUTPUTPAGE,
+ WZS_INVALID_STATE
+ );
+ else
+ declarePath(
+ 0,
+ MM_DOCUMENTSELECTPAGE,
+ MM_ADDRESSBLOCKPAGE,
+ MM_GREETINGSPAGE,
+ MM_LAYOUTPAGE,
+ MM_PREPAREMERGEPAGE,
+ MM_MERGEPAGE,
+ MM_OUTPUTPAGE,
+ WZS_INVALID_STATE
+ );
+
+ ActivatePage();
+ UpdateRoadmap();
+}
+/*-- 01.04.2004 16:52:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeWizard::~SwMailMergeWizard()
+{
+}
+/*-- 01.04.2004 16:52:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OWizardPage* SwMailMergeWizard::createPage(WizardState _nState)
+{
+ OWizardPage* pRet = 0;
+ switch(_nState)
+ {
+ case MM_DOCUMENTSELECTPAGE : pRet = new SwMailMergeDocSelectPage(this); break;
+ case MM_OUTPUTTYPETPAGE : pRet = new SwMailMergeOutputTypePage(this); break;
+ case MM_ADDRESSBLOCKPAGE : pRet = new SwMailMergeAddressBlockPage(this); break;
+ case MM_GREETINGSPAGE : pRet = new SwMailMergeGreetingsPage(this); break;
+ case MM_LAYOUTPAGE : pRet = new SwMailMergeLayoutPage(this); break;
+ case MM_PREPAREMERGEPAGE : pRet = new SwMailMergePrepareMergePage(this); break;
+ case MM_MERGEPAGE : pRet = new SwMailMergeMergePage(this); break;
+ case MM_OUTPUTPAGE : pRet = new SwMailMergeOutputPage(this); break;
+ }
+ DBG_ASSERT(pRet, "no page created in ::createPage");
+ return pRet;
+}
+/*-- 04.06.2004 13:18:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeWizard::enterState( WizardState _nState )
+{
+ ::svt::RoadmapWizard::enterState( _nState );
+/*
+ entering a page after the layoutpage requires the insertion
+ of greeting and address block - if not yet done
+ entering the merge or output page requires to create the output document
+*/
+ if(_nState > MM_LAYOUTPAGE && m_rConfigItem.GetSourceView() &&
+ ((m_rConfigItem.IsAddressBlock() && !m_rConfigItem.IsAddressInserted()) ||
+ (m_rConfigItem.IsGreetingLine(sal_False) && !m_rConfigItem.IsGreetingInserted() )))
+ {
+ SwMailMergeLayoutPage::InsertAddressAndGreeting(m_rConfigItem.GetSourceView(),
+ m_rConfigItem, Point(-1, -1), true);
+ }
+ if(_nState >= MM_MERGEPAGE && !m_rConfigItem.GetTargetView())
+ {
+ CreateTargetDocument();
+ m_nRestartPage = _nState;
+ EndDialog(RET_TARGET_CREATED);
+ return;
+ }
+ else if(_nState < MM_MERGEPAGE && m_rConfigItem.GetTargetView())
+ {
+ //close the dialog, remove the target view, show the source view
+ m_nRestartPage = _nState;
+ //set ResultSet back to start
+ m_rConfigItem.MoveResultSet(1);
+ EndDialog(RET_REMOVE_TARGET);
+ return;
+ }
+ bool bEnablePrev = true;
+ bool bEnableNext = true;
+ switch(_nState)
+ {
+ case MM_DOCUMENTSELECTPAGE :
+ bEnablePrev = false;
+ break;
+ case MM_ADDRESSBLOCKPAGE :
+ bEnableNext = m_rConfigItem.GetResultSet().is();
+ break;
+ case MM_OUTPUTPAGE :
+ bEnableNext = false;
+ break;
+ }
+ enableButtons( WZB_PREVIOUS, bEnablePrev);
+ enableButtons( WZB_NEXT, bEnableNext);
+
+ UpdateRoadmap();
+}
+/*-- 04.06.2004 12:54:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+String SwMailMergeWizard::getStateDisplayName( WizardState _nState ) const
+{
+ String sRet;
+ switch(_nState)
+ {
+ case MM_DOCUMENTSELECTPAGE :sRet = m_sStarting; break;
+ case MM_OUTPUTTYPETPAGE : sRet = m_sDocumentType; break;
+ case MM_ADDRESSBLOCKPAGE :
+ sRet = m_rConfigItem.IsOutputToLetter() ?
+ m_sAddressBlock : m_sAddressList;
+
+ break;
+ case MM_GREETINGSPAGE : sRet = m_sGreetingsLine; break;
+ case MM_LAYOUTPAGE : sRet = m_sLayout; break;
+ case MM_PREPAREMERGEPAGE : sRet = m_sPrepareMerge; break;
+ case MM_MERGEPAGE : sRet = m_sMerge; break;
+ case MM_OUTPUTPAGE : sRet = m_sOutput; break;
+ }
+ return sRet;
+}
+/*-- 24.06.2004 09:24:45---------------------------------------------------
+ enables/disables pages in the roadmap depending on the current
+ page and state
+ -----------------------------------------------------------------------*/
+void SwMailMergeWizard::UpdateRoadmap()
+{
+/*
+ MM_DOCUMENTSELECTPAGE > inactive after the layoutpage
+ MM_OUTPUTTYPETPAGE : > inactive after the layoutpage
+ MM_ADDRESSBLOCKPAGE > inactive after the layoutpage
+ MM_GREETINGSPAGE > inactive after the layoutpage
+ MM_LAYOUTPAGE > inactive after the layoutpage
+ inactive if address block and greeting are switched off
+ or are already inserted into the source document
+ MM_PREPAREMERGEPAGE > only active if address data has been selected
+ inactive after preparemerge page
+ MM_MERGEPAGE > only active if address data has been selected
+
+ MM_OUTPUTPAGE > only active if address data has been selected
+*/
+
+ // enableState( <page id>, false );
+ const sal_uInt16 nCurPage = GetCurLevel();
+ TabPage* pCurPage = GetPage( nCurPage );
+ if(!pCurPage)
+ return;
+ bool bEnable = false;
+ bool bAddressFieldsConfigured = !m_rConfigItem.IsOutputToLetter() ||
+ !m_rConfigItem.IsAddressBlock() ||
+ m_rConfigItem.IsAddressFieldsAssigned();
+ bool bGreetingFieldsConfigured = !m_rConfigItem.IsGreetingLine(sal_False) ||
+ !m_rConfigItem.IsIndividualGreeting(sal_False)||
+ m_rConfigItem.IsGreetingFieldsAssigned();
+ //#i97436# if a document has to be loaded then enable output type page only
+ m_bDocumentLoad = false;
+ bool bEnableOutputTypePage = (nCurPage != MM_DOCUMENTSELECTPAGE) ||
+ static_cast<svt::OWizardPage*>(pCurPage)->commitPage( ::svt::WizardTypes::eValidate );
+
+ for(sal_uInt16 nPage = MM_DOCUMENTSELECTPAGE; nPage <= MM_OUTPUTPAGE; ++nPage)
+ {
+ switch(nPage)
+ {
+ case MM_DOCUMENTSELECTPAGE :
+ bEnable = sal_True;
+ break;
+ case MM_OUTPUTTYPETPAGE :
+ bEnable = bEnableOutputTypePage;
+ break;
+ case MM_ADDRESSBLOCKPAGE :
+ bEnable = !m_bDocumentLoad && bEnableOutputTypePage;
+ break;
+ case MM_GREETINGSPAGE :
+ bEnable = !m_bDocumentLoad && bEnableOutputTypePage &&
+ m_rConfigItem.GetResultSet().is() &&
+ bAddressFieldsConfigured;
+ break;
+ case MM_PREPAREMERGEPAGE :
+ case MM_MERGEPAGE :
+ case MM_OUTPUTPAGE :
+ case MM_LAYOUTPAGE :
+ bEnable = !m_bDocumentLoad && bEnableOutputTypePage &&
+ m_rConfigItem.GetResultSet().is() &&
+ bAddressFieldsConfigured &&
+ bGreetingFieldsConfigured;
+ if(MM_LAYOUTPAGE == nPage)
+ bEnable &=
+ ((m_rConfigItem.IsAddressBlock() && !m_rConfigItem.IsAddressInserted()) ||
+ (m_rConfigItem.IsGreetingLine(sal_False) && !m_rConfigItem.IsGreetingInserted() ));
+ break;
+ }
+ enableState( nPage, bEnable );
+ }
+}
+/*-- 24.06.2004 09:24:45---------------------------------------------------
+ enables/disables pages in the roadmap depending on the current
+ page and state
+ -----------------------------------------------------------------------*/
+void SwMailMergeWizard::CreateTargetDocument()
+{
+ GetSwView()->GetWrtShell().GetNewDBMgr()->
+ MergeDocuments( m_rConfigItem, *GetSwView() );
+ m_rConfigItem.SetMergeDone();
+ if( m_rConfigItem.GetTargetView() )
+ m_rConfigItem.GetTargetView()->GetViewFrame()->GetFrame().Appear();
+}
+/*-- 23.08.2004 08:51:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeWizard::updateRoadmapItemLabel( WizardState _nState )
+{
+ svt::RoadmapWizard::updateRoadmapItemLabel( _nState );
+}
+
+// ------------------------------------------------------------------------
+
+short SwMailMergeWizard::Execute()
+{
+ DBG_ERROR( "SwMailMergeWizard cannot be executed via Dialog::Execute!\n"
+ "It creates a thread (MailDispatcher instance) that will call"
+ "back to VCL apartment => deadlock!\n"
+ "Use Dialog::StartExecuteModal to execute the dialog!" );
+ return RET_CANCEL;
+}
+
+// ------------------------------------------------------------------------
+
+void SwMailMergeWizard::StartExecuteModal( const Link& rEndDialogHdl )
+{
+ ::svt::RoadmapWizard::StartExecuteModal( rEndDialogHdl );
+}
diff --git a/sw/source/ui/dbui/mailmergewizard.hrc b/sw/source/ui/dbui/mailmergewizard.hrc
new file mode 100644
index 000000000000..f6b00013b2fe
--- /dev/null
+++ b/sw/source/ui/dbui/mailmergewizard.hrc
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define ST_STARTING 1
+#define ST_DOCUMETNTYPE 2
+#define ST_ADDRESSBLOCK 3
+#define ST_GREETINGSLINE 4
+#define ST_LAYOUT 5
+#define ST_PREPAREMERGE 6
+#define ST_MERGE 7
+#define ST_OUTPUT 8
+#define ST_FINISH 9
+#define ST_ADDRESSLIST 10
diff --git a/sw/source/ui/dbui/mailmergewizard.src b/sw/source/ui/dbui/mailmergewizard.src
new file mode 100644
index 000000000000..fc19ee422f8a
--- /dev/null
+++ b/sw/source/ui/dbui/mailmergewizard.src
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <mailmergewizard.hrc>
+#include <dbui.hrc>
+
+ModalDialog DLG_MAILMERGEWIZARD
+{
+ HelpID = "sw:ModalDialog:DLG_MAILMERGEWIZARD";
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Mail Merge Wizard" ;
+ Moveable = TRUE ;
+
+ String ST_STARTING
+ {
+ Text [ en-US ] = "Select starting document";
+ };
+ String ST_DOCUMETNTYPE
+ {
+ Text [ en-US ] = "Select document type";
+ };
+ String ST_ADDRESSBLOCK
+ {
+ Text [ en-US ] = "Insert address block";
+ };
+ String ST_ADDRESSLIST
+ {
+ Text [ en-US ] = "Select address list";
+ };
+ String ST_GREETINGSLINE
+ {
+ Text [ en-US ] = "Create salutation";
+ };
+ String ST_LAYOUT
+ {
+ Text [ en-US ] = "Adjust layout";
+ };
+ String ST_PREPAREMERGE
+ {
+ Text [ en-US ] = "Edit document";
+ };
+ String ST_MERGE
+ {
+ Text [ en-US ] = "Personalize document";
+ };
+ String ST_OUTPUT
+ {
+ Text [ en-US ] = "Save, print or send";
+ };
+ String ST_FINISH
+ {
+ Text [ en-US ] = "~Finish";
+ };
+
+};
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
new file mode 100644
index 000000000000..1c45831e97e2
--- /dev/null
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -0,0 +1,1846 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <mmaddressblockpage.hxx>
+#include <mailmergewizard.hxx>
+#include <swtypes.hxx>
+#include <addresslistdialog.hxx>
+#include <svtools/xtextedt.hxx>
+#include <svtools/txtattr.hxx>
+#include <vcl/msgbox.hxx>
+#include <mmconfigitem.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+
+#include <vector>
+#include <mmaddressblockpage.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+using namespace svt;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+
+//-------------------------------------------------------------------------
+void lcl_Move(Control* pCtrl, long nYOffset)
+{
+ Point aPos(pCtrl->GetPosPixel());
+ aPos.Y() += nYOffset;
+ pCtrl->SetPosPixel(aPos);
+}
+/*-- 02.04.2004 12:46:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeAddressBlockPage::SwMailMergeAddressBlockPage( SwMailMergeWizard* _pParent) :
+ svt::OWizardPage(_pParent, SW_RES(DLG_MM_ADDRESSBLOCK_PAGE)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aHeaderFI( this, SW_RES( FI_HEADER ) ),
+ m_aFirstFI( this, SW_RES( FI_FIRST ) ),
+ m_aAddressListFI( this, SW_RES( FI_ADDRESSLIST ) ),
+ m_aAddressListPB( this, SW_RES( PB_ADDRESSLIST ) ),
+ m_aCurrentAddressFI( this, SW_RES( FI_CURRENTADDRESS ) ),
+ m_aFirstFL( this, SW_RES( FL_FIRST ) ),
+ m_aSecondFI( this, SW_RES( FI_SECOND )),
+ m_aSettingsFI( this, SW_RES( FI_SECOND ) ),
+ m_aAddressCB( this, SW_RES( CB_ADDRESS ) ),
+ m_aSettingsWIN( this, SW_RES( WIN_SETTINGS ) ),
+ m_aSettingsPB( this, SW_RES( PB_SETTINGS ) ),
+ m_aHideEmptyParagraphsCB( this, SW_RES( CB_HIDE_EMPTY_PARA ) ),
+ m_aSecondFL( this, SW_RES( FL_SECOND )),
+ m_aThirdFI( this, SW_RES( FI_THIRD ) ),
+ m_aMatchFieldsFI( this, SW_RES( FI_MATCH_FIELDS ) ),
+ m_aAssignPB( this, SW_RES( PB_ASSIGN ) ),
+ m_aThirdFL( this, SW_RES( FL_THIRD ) ),
+ m_aFourthFI( this, SW_RES( FI_FOURTH ) ),
+ m_aPreviewFI( this, SW_RES( FI_PREVIEW ) ),
+ m_aPreviewWIN( this, SW_RES( WIN_PREVIEW ) ),
+ m_aDocumentIndexFI( this, SW_RES( FI_DOCINDEX ) ),
+ m_aPrevSetIB( this, SW_RES( IB_PREVSET ) ),
+ m_aNextSetIB( this, SW_RES( IB_NEXTSET ) ),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_sDocument( SW_RES( STR_DOCUMENT ) ),
+ m_sChangeAddress( SW_RES( STR_CHANGEADDRESS )),
+ m_pWizard(_pParent)
+{
+ FreeResource();
+ m_sCurrentAddress = m_aCurrentAddressFI.GetText();
+ m_aAddressListPB.SetClickHdl(LINK(this, SwMailMergeAddressBlockPage, AddressListHdl_Impl));
+ m_aSettingsPB.SetClickHdl(LINK(this, SwMailMergeAddressBlockPage, SettingsHdl_Impl));
+ m_aAssignPB.SetClickHdl(LINK(this, SwMailMergeAddressBlockPage, AssignHdl_Impl ));
+ m_aAddressCB.SetClickHdl(LINK(this, SwMailMergeAddressBlockPage, AddressBlockHdl_Impl));
+ m_aSettingsWIN.SetSelectHdl(LINK(this, SwMailMergeAddressBlockPage, AddressBlockSelectHdl_Impl));
+ m_aHideEmptyParagraphsCB.SetClickHdl(LINK(this, SwMailMergeAddressBlockPage, HideParagraphsHdl_Impl));
+
+ Link aLink = LINK(this, SwMailMergeAddressBlockPage, InsertDataHdl_Impl);
+ m_aPrevSetIB.SetClickHdl(aLink);
+ m_aNextSetIB.SetClickHdl(aLink);
+}
+/*-- 02.04.2004 12:46:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeAddressBlockPage::~SwMailMergeAddressBlockPage()
+{
+}
+/*-- 05.07.2004 13:55:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwMailMergeAddressBlockPage::canAdvance() const
+{
+ return m_pWizard->GetConfigItem().GetResultSet().is();
+}
+/*-- 16.06.2004 12:34:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeAddressBlockPage::ActivatePage()
+{
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ bool bIsLetter = rConfigItem.IsOutputToLetter();
+
+ //no address block is created for e-Mail
+ m_aSettingsFI.Show( bIsLetter );
+ m_aAddressCB.Show( bIsLetter );
+ m_aSettingsWIN.Show( bIsLetter );
+ m_aSettingsPB.Show( bIsLetter );
+ m_aPreviewFI.Show( bIsLetter );
+ m_aPreviewWIN.Show( bIsLetter );
+ m_aAssignPB.Show( bIsLetter );
+ m_aDocumentIndexFI.Show( bIsLetter );
+ m_aPrevSetIB.Show( bIsLetter );
+ m_aNextSetIB.Show( bIsLetter );
+ m_aHideEmptyParagraphsCB.Show( bIsLetter );
+ m_aSecondFL.Show( bIsLetter );
+ m_aSecondFI.Show( bIsLetter );
+ m_aSettingsFI.Show( bIsLetter );
+ m_aMatchFieldsFI.Show( bIsLetter );
+ m_aThirdFI.Show( bIsLetter );
+ m_aThirdFL.Show( bIsLetter );
+ m_aFourthFI.Show( bIsLetter );
+
+ if(bIsLetter)
+ {
+ m_aHideEmptyParagraphsCB.Check( rConfigItem.IsHideEmptyParagraphs() );
+ String sTemp(m_sDocument);
+ sTemp.SearchAndReplaceAscii("%1", String::CreateFromInt32(1));
+ m_aDocumentIndexFI.SetText(sTemp);
+
+ m_aSettingsWIN.Clear();
+ const uno::Sequence< ::rtl::OUString> aBlocks =
+ m_pWizard->GetConfigItem().GetAddressBlocks();
+ for(sal_Int32 nAddress = 0; nAddress < aBlocks.getLength(); ++nAddress)
+ m_aSettingsWIN.AddAddress(aBlocks[nAddress]);
+ m_aSettingsWIN.SelectAddress((sal_uInt16)rConfigItem.GetCurrentAddressBlockIndex());
+ m_aAddressCB.Check(rConfigItem.IsAddressBlock());
+ AddressBlockHdl_Impl(&m_aAddressCB);
+ m_aSettingsWIN.SetLayout(1, 2);
+ InsertDataHdl_Impl(0);
+ }
+}
+/*-- 27.05.2004 13:59:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeAddressBlockPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason )
+{
+ if ( ::svt::WizardTypes::eTravelForward == _eReason && !m_pWizard->GetConfigItem().GetResultSet().is() )
+ return sal_False;
+ return sal_True;
+}
+/*-- 07.04.2004 16:19:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeAddressBlockPage, AddressListHdl_Impl, PushButton*, EMPTYARG)
+{
+ SwAddressListDialog* pAddrDialog = new SwAddressListDialog(this);
+ if(RET_OK == pAddrDialog->Execute())
+ {
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ rConfigItem.SetCurrentConnection(
+ pAddrDialog->GetSource(),
+ pAddrDialog->GetConnection(),
+ pAddrDialog->GetColumnsSupplier(),
+ pAddrDialog->GetDBData());
+ ::rtl::OUString sFilter = pAddrDialog->GetFilter();
+ rConfigItem.SetFilter( sFilter );
+ InsertDataHdl_Impl(0);
+ GetWizard()->UpdateRoadmap();
+ GetWizard()->enableButtons(WZB_NEXT, GetWizard()->isStateEnabled(MM_GREETINGSPAGE));
+ }
+ delete pAddrDialog;
+ return 0;
+}
+/*-- 07.04.2004 16:19:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeAddressBlockPage, SettingsHdl_Impl, PushButton*, pButton)
+{
+ SwSelectAddressBlockDialog* pDlg =
+ new SwSelectAddressBlockDialog(pButton, m_pWizard->GetConfigItem());
+ SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem();
+ pDlg->SetAddressBlocks(rConfig.GetAddressBlocks(), m_aSettingsWIN.GetSelectedAddress());
+ pDlg->SetSettings(rConfig.IsIncludeCountry(), rConfig.GetExcludeCountry());
+ if(RET_OK == pDlg->Execute())
+ {
+ //the dialog provides the selected address at the first position!
+ const uno::Sequence< ::rtl::OUString> aBlocks =
+ pDlg->GetAddressBlocks();
+ rConfig.SetAddressBlocks(aBlocks);
+ m_aSettingsWIN.Clear();
+ for(sal_Int32 nAddress = 0; nAddress < aBlocks.getLength(); ++nAddress)
+ m_aSettingsWIN.AddAddress(aBlocks[nAddress]);
+ m_aSettingsWIN.SelectAddress(0);
+ m_aSettingsWIN.Invalidate(); // #i40408
+ rConfig.SetCountrySettings(pDlg->IsIncludeCountry(), pDlg->GetCountry());
+ InsertDataHdl_Impl(0);
+ }
+ delete pDlg;
+ GetWizard()->UpdateRoadmap();
+ GetWizard()->enableButtons(WZB_NEXT, GetWizard()->isStateEnabled(MM_GREETINGSPAGE));
+ return 0;
+}
+/*-- 07.04.2004 16:19:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeAddressBlockPage, AssignHdl_Impl, PushButton*, pButton)
+{
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ sal_uInt16 nSel = m_aSettingsWIN.GetSelectedAddress();
+ const uno::Sequence< ::rtl::OUString> aBlocks = rConfigItem.GetAddressBlocks();
+ SwAssignFieldsDialog* pDlg =
+ new SwAssignFieldsDialog(pButton, m_pWizard->GetConfigItem(), aBlocks[nSel], true);
+ if(RET_OK == pDlg->Execute())
+ {
+ //preview update
+ InsertDataHdl_Impl(0);
+ GetWizard()->UpdateRoadmap();
+ GetWizard()->enableButtons(WZB_NEXT, GetWizard()->isStateEnabled(MM_GREETINGSPAGE));
+ }
+ delete pDlg;
+ return 0;
+}
+/*-- 11.06.2004 13:37:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeAddressBlockPage::EnableAddressBlock(sal_Bool bAll, sal_Bool bSelective)
+{
+ m_aSettingsFI.Enable(bAll);
+ m_aAddressCB.Enable(bAll);
+ bSelective &= bAll;
+ m_aHideEmptyParagraphsCB.Enable(bSelective);
+ m_aSettingsWIN.Enable(bSelective);
+ m_aSettingsPB.Enable(bSelective);
+ m_aPreviewFI.Enable(bSelective);
+ m_aPreviewWIN.Enable(bSelective);
+ m_aThirdFI.Enable(bSelective);
+ m_aMatchFieldsFI.Enable(bSelective);
+ m_aAssignPB.Enable(bSelective);
+ m_aDocumentIndexFI.Enable(bSelective);
+ m_aPrevSetIB.Enable(bSelective);
+ m_aNextSetIB.Enable(bSelective);
+}
+/*-- 28.04.2004 12:45:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeAddressBlockPage, AddressBlockHdl_Impl, CheckBox*, pBox)
+{
+ EnableAddressBlock(pBox->IsEnabled(), pBox->IsChecked());
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ rConfigItem.SetAddressBlock(m_aAddressCB.IsChecked());
+ m_pWizard->UpdateRoadmap();
+ return 0;
+}
+/*-- 08.06.2004 13:00:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeAddressBlockPage, AddressBlockSelectHdl_Impl, SwAddressPreview*, EMPTYARG)
+{
+ sal_uInt16 nSel = m_aSettingsWIN.GetSelectedAddress();
+ const uno::Sequence< ::rtl::OUString> aBlocks =
+ m_pWizard->GetConfigItem().GetAddressBlocks();
+ String sPreview = SwAddressPreview::FillData(aBlocks[nSel], m_pWizard->GetConfigItem());
+ m_aPreviewWIN.SetAddress(sPreview);
+ m_pWizard->GetConfigItem().SetCurrentAddressBlockIndex( nSel );
+ GetWizard()->UpdateRoadmap();
+ GetWizard()->enableButtons(WZB_NEXT, GetWizard()->isStateEnabled(MM_GREETINGSPAGE));
+ return 0;
+}
+/*-- 31.08.2005 15:34:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeAddressBlockPage, HideParagraphsHdl_Impl, CheckBox*, pBox)
+{
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ rConfigItem.SetHideEmptyParagraphs( pBox->IsChecked() );
+ return 0;
+}
+
+// ------------------------------------------------------------------------------
+IMPL_LINK(SwMailMergeAddressBlockPage, InsertDataHdl_Impl, ImageButton*, pButton)
+{
+ //if no pButton is given, the first set has to be pre-set
+ SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem();
+ m_pWizard->EnterWait();
+ if(!pButton)
+ {
+ rConfig.GetResultSet();
+ }
+ else
+ {
+ BOOL bNext = pButton == &m_aNextSetIB;
+ sal_Int32 nPos = rConfig.GetResultSetPosition();
+ rConfig.MoveResultSet( bNext ? ++nPos : --nPos);
+ }
+ m_pWizard->LeaveWait();
+ sal_Int32 nPos = rConfig.GetResultSetPosition();
+ BOOL bEnable = TRUE;
+ if(nPos < 1)
+ {
+ bEnable = FALSE;
+ nPos = 1;
+ }
+ else
+ {
+ //if output type is letter
+ if(m_aSettingsWIN.IsVisible())
+ {
+ //Fill data into preview
+ sal_uInt16 nSel = m_aSettingsWIN.GetSelectedAddress();
+ const uno::Sequence< ::rtl::OUString> aBlocks =
+ m_pWizard->GetConfigItem().GetAddressBlocks();
+ String sPreview = SwAddressPreview::FillData(aBlocks[nSel], rConfig);
+ m_aPreviewWIN.SetAddress(sPreview);
+ }
+ }
+ m_aPrevSetIB.Enable(bEnable);
+ //m_aNextSetIB.Enable(bEnable);
+ //m_aDocumentIndexFI.Enable(bEnable);
+ String sTemp(m_sDocument);
+ sTemp.SearchAndReplaceAscii("%1", String::CreateFromInt32(nPos));
+ m_aDocumentIndexFI.SetText(sTemp);
+
+ GetWizard()->enableButtons(WZB_NEXT, GetWizard()->isStateEnabled(MM_GREETINGSPAGE));
+ sal_Bool bHasResultSet = rConfig.GetResultSet().is();
+ m_aCurrentAddressFI.Show(bHasResultSet);
+ if(bHasResultSet)
+ {
+ String sTmp = m_sCurrentAddress;
+ sTmp.SearchAndReplaceAscii("%1", rConfig.GetCurrentDBData().sDataSource );
+ m_aCurrentAddressFI.SetText(sTmp);
+ m_aAddressListPB.SetText(m_sChangeAddress);
+ }
+ EnableAddressBlock(bHasResultSet, m_aAddressCB.IsChecked());
+ return 0;
+}
+/*-- 13.04.2004 16:01:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSelectAddressBlockDialog::SwSelectAddressBlockDialog(
+ Window* pParent, SwMailMergeConfigItem& rConfig) :
+ SfxModalDialog(pParent, SW_RES(DLG_MM_SELECTADDRESSBLOCK)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aSelectFT( this, SW_RES( FT_SELECT)),
+ m_aPreview( this, SW_RES( WIN_PREVIEW)),
+ m_aNewPB( this, SW_RES( PB_NEW)),
+ m_aCustomizePB( this, SW_RES( PB_CUSTOMIZE)),
+ m_aDeletePB( this, SW_RES( PB_DELETE)),
+ m_aSettingsFI( this, SW_RES( FI_SETTINGS)),
+ m_aNeverRB( this, SW_RES( RB_NEVER)),
+ m_aAlwaysRB( this, SW_RES( RB_ALWAYS)),
+ m_aDependentRB( this, SW_RES( RB_DEPENDENT)),
+ m_aCountryED( this, SW_RES( ED_COUNTRY)),
+ m_aSeparatorFL( this, SW_RES( FL_SEPARATOR)),
+ m_aOK( this, SW_RES( PB_OK)),
+ m_aCancel( this, SW_RES( PB_CANCEL)),
+ m_aHelp( this, SW_RES( PB_HELP)),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_rConfig(rConfig)
+{
+ FreeResource();
+
+ Link aCustomizeHdl = LINK(this, SwSelectAddressBlockDialog, NewCustomizeHdl_Impl);
+ m_aNewPB.SetClickHdl(aCustomizeHdl);
+ m_aCustomizePB.SetClickHdl(aCustomizeHdl);
+
+ m_aDeletePB.SetClickHdl(LINK(this, SwSelectAddressBlockDialog, DeleteHdl_Impl));
+
+ Link aLk = LINK(this, SwSelectAddressBlockDialog, IncludeHdl_Impl);
+ m_aNeverRB.SetClickHdl(aLk);
+ m_aAlwaysRB.SetClickHdl(aLk);
+ m_aDependentRB.SetClickHdl(aLk);
+ m_aPreview.SetLayout(2, 2);
+ m_aPreview.EnableScrollBar();
+}
+/*-- 13.04.2004 16:01:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSelectAddressBlockDialog::~SwSelectAddressBlockDialog()
+{
+}
+/*-- 28.04.2004 11:48:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSelectAddressBlockDialog::SetAddressBlocks(const uno::Sequence< ::rtl::OUString>& rBlocks,
+ sal_uInt16 nSelectedAddress)
+{
+ m_aAddressBlocks = rBlocks;
+ for(sal_Int32 nAddress = 0; nAddress < m_aAddressBlocks.getLength(); ++nAddress)
+ m_aPreview.AddAddress(m_aAddressBlocks[nAddress]);
+ m_aPreview.SelectAddress(nSelectedAddress);
+}
+/*-- 25.06.2004 10:51:36---------------------------------------------------
+ return the address blocks and put the selected one to the first position
+ -----------------------------------------------------------------------*/
+const uno::Sequence< ::rtl::OUString >& SwSelectAddressBlockDialog::GetAddressBlocks()
+{
+ //put the selected block to the first position
+ sal_uInt16 nSelect = m_aPreview.GetSelectedAddress();
+ if(nSelect)
+ {
+ uno::Sequence< ::rtl::OUString >aTemp = m_aAddressBlocks;
+ ::rtl::OUString* pTemp = aTemp.getArray();
+ pTemp[0] = m_aAddressBlocks[nSelect];
+ sal_uInt32 nIndex = 0;
+ const sal_uInt32 nNumBlocks = m_aAddressBlocks.getLength();
+ for(sal_uInt32 nAddress = 1; nAddress < nNumBlocks; ++nAddress)
+ {
+ if(nIndex == nSelect)
+ ++nIndex;
+ pTemp[nAddress] = m_aAddressBlocks[nIndex];
+ nIndex++;
+ }
+ m_aAddressBlocks = aTemp;
+ }
+ return m_aAddressBlocks;
+}
+/*-- 28.04.2004 11:48:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSelectAddressBlockDialog::SetSettings(
+ sal_Bool bIsCountry, ::rtl::OUString rCountry)
+{
+ if(bIsCountry)
+ {
+ rCountry.getLength() ? m_aDependentRB.Check() : m_aAlwaysRB.Check();
+ m_aCountryED.SetText(rCountry);
+ }
+ else
+ m_aNeverRB.Check();
+ m_aDeletePB.Enable(m_aAddressBlocks.getLength() > 1);
+}
+/*-- 10.05.2004 11:17:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwSelectAddressBlockDialog::GetCountry() const
+{
+ ::rtl::OUString sRet;
+ if(m_aDependentRB.IsChecked())
+ sRet = m_aCountryED.GetText();
+ return sRet;
+}
+
+/*-- 13.04.2004 16:02:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwSelectAddressBlockDialog, DeleteHdl_Impl, PushButton*, pButton)
+{
+ if(m_aAddressBlocks.getLength())
+ {
+ sal_uInt16 nSelected = m_aPreview.GetSelectedAddress();
+ ::rtl::OUString* pAddressBlocks = m_aAddressBlocks.getArray();
+ sal_Int32 nSource = 0;
+ for(sal_Int32 nTarget = 0; nTarget < m_aAddressBlocks.getLength() - 1; nTarget++)
+ {
+ if(nSource == nSelected)
+ ++nSource;
+ pAddressBlocks[nTarget] = pAddressBlocks[nSource++];
+ }
+ m_aAddressBlocks.realloc(m_aAddressBlocks.getLength() - 1);
+ if(m_aAddressBlocks.getLength() <= 1)
+ pButton->Enable(sal_False);
+ m_aPreview.RemoveSelectedAddress();
+ }
+ return 0;
+}
+/*-- 13.04.2004 16:02:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwSelectAddressBlockDialog, NewCustomizeHdl_Impl, PushButton*, pButton)
+{
+ bool bCustomize = pButton == &m_aCustomizePB;
+ SwCustomizeAddressBlockDialog::DialogType nType = bCustomize ?
+ SwCustomizeAddressBlockDialog::ADDRESSBLOCK_EDIT :
+ SwCustomizeAddressBlockDialog::ADDRESSBLOCK_NEW;
+ SwCustomizeAddressBlockDialog *pDlg =
+ new SwCustomizeAddressBlockDialog(pButton,m_rConfig,nType);
+ if(bCustomize)
+ {
+ pDlg->SetAddress(m_aAddressBlocks[m_aPreview.GetSelectedAddress()]);
+ }
+ if(RET_OK == pDlg->Execute())
+ {
+ if(bCustomize)
+ {
+ ::rtl::OUString sNew = pDlg->GetAddress();
+ m_aPreview.ReplaceSelectedAddress(sNew);
+ m_aAddressBlocks[m_aPreview.GetSelectedAddress()] = sNew;
+ }
+ else
+ {
+ ::rtl::OUString sNew = pDlg->GetAddress();
+ m_aPreview.AddAddress(sNew);
+ m_aAddressBlocks.realloc(m_aAddressBlocks.getLength() + 1);
+ sal_uInt16 nSelect = (sal_uInt16)m_aAddressBlocks.getLength() - 1;
+ m_aAddressBlocks[nSelect] = sNew;
+ m_aPreview.SelectAddress(nSelect);
+ }
+ m_aDeletePB.Enable( m_aAddressBlocks.getLength() > 1);
+ }
+ delete pDlg;
+ return 0;
+}
+/*-- 13.04.2004 16:02:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwSelectAddressBlockDialog, IncludeHdl_Impl, RadioButton*, pButton)
+{
+ m_aCountryED.Enable(&m_aDependentRB == pButton);
+ return 0;
+}
+
+/* -----------------------------28.02.05 09:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwRestrictedComboBox::~SwRestrictedComboBox()
+{
+}
+/* -----------------------------28.02.05 09:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwRestrictedComboBox::KeyInput(const KeyEvent& rEvt)
+{
+ BOOL bCallParent = TRUE;
+ if(rEvt.GetCharCode())
+ {
+ String sKey = rEvt.GetCharCode();
+ if( STRING_NOTFOUND != sForbiddenChars.Search(sKey))
+ bCallParent = FALSE;
+ }
+ if(bCallParent)
+ ComboBox::KeyInput(rEvt);
+}
+/* -----------------------------28.02.05 09:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwRestrictedComboBox::Modify()
+{
+ Selection aSel = GetSelection();
+ String sTemp = GetText();
+ for(USHORT i = 0; i < sForbiddenChars.Len(); i++)
+ {
+ sTemp.EraseAllChars( sForbiddenChars.GetChar(i) );
+ }
+ USHORT nDiff = GetText().Len() - sTemp.Len();
+ if(nDiff)
+ {
+ aSel.setMin(aSel.getMin() - nDiff);
+ aSel.setMax(aSel.getMin());
+ SetText(sTemp);
+ SetSelection(aSel);
+ }
+ if(GetModifyHdl().IsSet())
+ GetModifyHdl().Call(this);
+}
+
+/*-- 13.04.2004 16:01:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+#define USER_DATA_SALUTATION -1
+#define USER_DATA_PUNCTUATION -2
+#define USER_DATA_TEXT -3
+#define USER_DATA_NONE -4
+
+SwCustomizeAddressBlockDialog::SwCustomizeAddressBlockDialog(
+ Window* pParent, SwMailMergeConfigItem& rConfig, DialogType eType) :
+ SfxModalDialog(pParent, SW_RES(DLG_MM_CUSTOMIZEADDRESSBLOCK)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aAddressElementsFT( this, SW_RES( FT_ADDRESSELEMENTS )),
+ m_aAddressElementsLB( this, SW_RES( LB_ADDRESSELEMENTS )),
+ m_aInsertFieldIB( this, SW_RES( IB_INSERTFIELD )),
+ m_aRemoveFieldIB( this, SW_RES( IB_REMOVEFIELD )),
+ m_aDragFT( this, SW_RES( FT_DRAG )),
+ m_aDragED( this, SW_RES( ED_DRAG )),
+ m_aUpIB( this, SW_RES( IB_UP )),
+ m_aLeftIB( this, SW_RES( IB_LEFT )),
+ m_aRightIB( this, SW_RES( IB_RIGHT )),
+ m_aDownIB( this, SW_RES( IB_DOWN )),
+ m_aFieldFT( this, SW_RES( FT_FIELD )),
+ m_aFieldCB( this, SW_RES( CB_FIELD )),
+ m_aPreviewFI( this, SW_RES( FI_PREVIEW )),
+ m_aPreviewWIN( this, SW_RES( WIN_PREVIEW )),
+ m_aSeparatorFL( this, SW_RES( FL_SEPARATOR )),
+ m_aOK( this, SW_RES( PB_OK )),
+ m_aCancel( this, SW_RES( PB_CANCEL )),
+ m_aHelp( this, SW_RES( PB_HELP )),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_rConfigItem(rConfig),
+ m_eType(eType)
+{
+ m_aFieldCB.SetForbiddenChars( String::CreateFromAscii("<>"));
+ m_aDragED.SetStyle(m_aDragED.GetStyle() |WB_NOHIDESELECTION);
+ if( eType >= GREETING_FEMALE )
+ {
+ m_aFieldFT.Show();
+ m_aFieldCB.Show();
+ SvLBoxEntry* pEntry = m_aAddressElementsLB.InsertEntry(String(SW_RES(ST_SALUTATION )));
+ pEntry->SetUserData((void*)(sal_Int32)USER_DATA_SALUTATION );
+ pEntry = m_aAddressElementsLB.InsertEntry(String(SW_RES(ST_PUNCTUATION)));
+ pEntry->SetUserData((void*)(sal_Int32)USER_DATA_PUNCTUATION );
+ pEntry = m_aAddressElementsLB.InsertEntry(String(SW_RES(ST_TEXT )));
+ pEntry->SetUserData((void*)(sal_Int32)USER_DATA_TEXT );
+ ResStringArray aSalutArr(SW_RES(
+ eType == GREETING_MALE ? RA_SALUTATION_MALE : RA_SALUTATION_FEMALE));
+ sal_uInt16 i;
+ for(i = 0; i < aSalutArr.Count(); ++i)
+ m_aSalutations.push_back(aSalutArr.GetString(i));
+ ResStringArray aPunctArr(SW_RES(RA_PUNCTUATION));
+ for(i = 0; i < aPunctArr.Count(); ++i)
+ m_aPunctuations.push_back(aPunctArr.GetString(i));
+ m_aDragED.SetText(String::CreateFromAscii(" "));
+ SetText( String( SW_RES( eType == GREETING_MALE ? ST_TITLE_MALE : ST_TITLE_FEMALE)));
+ m_aAddressElementsFT.SetText(String(SW_RES(ST_SALUTATIONELEMENTS)));
+ m_aInsertFieldIB.SetQuickHelpText(String(SW_RES(ST_INSERTSALUTATIONFIELD)));
+ m_aRemoveFieldIB.SetQuickHelpText(String(SW_RES(ST_REMOVESALUTATIONFIELD)));
+ m_aDragFT.SetText(String(SW_RES(ST_DRAGSALUTATION)));
+ }
+ else
+ {
+ if(eType == ADDRESSBLOCK_EDIT)
+ SetText(String(SW_RES(ST_TITLE_EDIT)));
+
+ //resize the preview
+ Point aFieldPos(m_aFieldFT.GetPosPixel());
+ long nDiff = m_aPreviewFI.GetPosPixel().Y() - aFieldPos.Y();
+ m_aPreviewFI.SetPosPixel(aFieldPos);
+ Size aPreviewSize = m_aPreviewWIN.GetSizePixel();
+ aPreviewSize.Height() += nDiff;
+ m_aPreviewWIN.SetSizePixel(aPreviewSize);
+ m_aPreviewWIN.SetPosPixel(m_aFieldCB.GetPosPixel());
+ m_aDragED.SetText(String::CreateFromAscii("\n\n\n\n\n"));
+ }
+ FreeResource();
+ const ResStringArray& rHeaders = m_rConfigItem.GetDefaultAddressHeaders();
+ for(USHORT i = 0; i < rHeaders.Count(); ++i)
+ {
+ const XubString& rHeader = rHeaders.GetString( i );
+ SvLBoxEntry* pEntry = m_aAddressElementsLB.InsertEntry(rHeader);
+ pEntry->SetUserData((void*)(sal_Int32)i);
+ }
+ m_aOK.SetClickHdl(LINK(this, SwCustomizeAddressBlockDialog, OKHdl_Impl));
+ m_aAddressElementsLB.SetSelectHdl(LINK(this, SwCustomizeAddressBlockDialog, ListBoxSelectHdl_Impl ));
+ m_aDragED.SetModifyHdl(LINK(this, SwCustomizeAddressBlockDialog, EditModifyHdl_Impl));
+ m_aDragED.SetSelectionChangedHdl( LINK( this, SwCustomizeAddressBlockDialog, SelectionChangedHdl_Impl));
+ Link aFieldsLink = LINK(this, SwCustomizeAddressBlockDialog, FieldChangeHdl_Impl);
+ m_aFieldCB.SetModifyHdl(aFieldsLink);
+ m_aFieldCB.SetSelectHdl(aFieldsLink);
+ Link aImgButtonHdl = LINK(this, SwCustomizeAddressBlockDialog, ImageButtonHdl_Impl);
+ m_aInsertFieldIB.SetClickHdl(aImgButtonHdl);
+ m_aRemoveFieldIB.SetClickHdl(aImgButtonHdl);
+ m_aUpIB.SetClickHdl(aImgButtonHdl);
+ m_aLeftIB.SetClickHdl(aImgButtonHdl);
+ m_aRightIB.SetClickHdl(aImgButtonHdl);
+ m_aDownIB.SetClickHdl(aImgButtonHdl);
+ UpdateImageButtons_Impl();
+}
+/*-- 13.04.2004 16:01:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwCustomizeAddressBlockDialog::~SwCustomizeAddressBlockDialog()
+{
+}
+/*-- 07.06.2004 13:51:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCustomizeAddressBlockDialog, OKHdl_Impl, OKButton*, EMPTYARG)
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+/*-- 24.06.2004 11:36:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCustomizeAddressBlockDialog, ListBoxSelectHdl_Impl, DDListBox*, pBox)
+{
+ sal_Int32 nUserData = (sal_Int32)(sal_IntPtr)pBox->FirstSelected()->GetUserData();
+ // Check if the selected entry is already in the address and then forbid inserting
+ m_aInsertFieldIB.Enable(nUserData >= 0 || !HasItem_Impl(nUserData));
+ return 0;
+}
+/*-- 25.06.2004 11:21:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCustomizeAddressBlockDialog, EditModifyHdl_Impl, AddressMultiLineEdit*, EMPTYARG)
+{
+ String sAddress = SwAddressPreview::FillData(
+ GetAddress(),
+ m_rConfigItem);
+ m_aPreviewWIN.SetAddress(sAddress);
+ UpdateImageButtons_Impl();
+ return 0;
+}
+/*-- 25.06.2004 12:14:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCustomizeAddressBlockDialog, ImageButtonHdl_Impl, ImageButton*, pButton)
+{
+ if(&m_aInsertFieldIB == pButton)
+ {
+ SvLBoxEntry* pEntry = m_aAddressElementsLB.GetCurEntry();
+ if(pEntry)
+ {
+ String sEntry = m_aAddressElementsLB.GetEntryText(pEntry);
+ sEntry.Insert('<', 0);
+ sEntry += '>';
+ m_aDragED.InsertNewEntry(sEntry);
+ }
+ }
+ else if(&m_aRemoveFieldIB == pButton)
+ {
+ m_aDragED.RemoveCurrentEntry();
+ }
+ else
+ {
+ sal_uInt16 nMove = MOVE_ITEM_DOWN;
+ if(&m_aUpIB == pButton)
+ nMove = MOVE_ITEM_UP;
+ else if(&m_aLeftIB == pButton)
+ nMove = MOVE_ITEM_LEFT;
+ else if(&m_aRightIB == pButton)
+ nMove = MOVE_ITEM_RIGHT;
+ m_aDragED.MoveCurrentItem(nMove);
+ }
+ UpdateImageButtons_Impl();
+ return 0;
+}
+/*-- 01.07.2004 09:27:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwCustomizeAddressBlockDialog::GetSelectedItem_Impl()
+{
+ sal_Int32 nRet = USER_DATA_NONE;
+ String sSelected = m_aDragED.GetCurrentItem();
+ if(sSelected.Len())
+ for(ULONG i = 0; i < m_aAddressElementsLB.GetEntryCount(); ++i)
+ {
+ SvLBoxEntry* pEntry = m_aAddressElementsLB.GetEntry(i);
+ String sEntry = m_aAddressElementsLB.GetEntryText(pEntry);
+ if( sSelected.Equals( sEntry, 1, sSelected.Len() - 2 ) )
+ {
+ nRet = (sal_Int32)(sal_IntPtr)pEntry->GetUserData();
+ break;
+ }
+ }
+ return nRet;
+}
+/*-- 01.07.2004 10:01:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwCustomizeAddressBlockDialog::HasItem_Impl(sal_Int32 nUserData)
+{
+ //get the entry from the ListBox
+ String sEntry;
+ for(ULONG i = 0; i < m_aAddressElementsLB.GetEntryCount(); ++i)
+ {
+ SvLBoxEntry* pEntry = m_aAddressElementsLB.GetEntry(i);
+ if((sal_Int32)(sal_IntPtr)pEntry->GetUserData() == nUserData)
+ {
+ sEntry = m_aAddressElementsLB.GetEntryText(pEntry);
+ break;
+ }
+ }
+ //put it into '<>'
+ sEntry += '>';
+ sEntry.Insert( '<', 0);
+ //search for this entry in the content
+ String sText = m_aDragED.GetText();
+ bool bRet = sText.Search(sEntry) != STRING_NOTFOUND;
+ return bRet;
+}
+/*-- 25.06.2004 13:10:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCustomizeAddressBlockDialog, SelectionChangedHdl_Impl, AddressMultiLineEdit*, pEdit)
+{
+ // called in case the selection of the edit field changes.
+ // determine selection - if it's one of the editable fields then
+ // enable the related ComboBox and fill it
+ static bool bOnEntry = false;
+ if(bOnEntry)
+ return 0;
+
+ bOnEntry = true;
+ sal_Int32 nSelected = GetSelectedItem_Impl();
+ if(USER_DATA_NONE != nSelected)
+ pEdit->SelectCurrentItem();
+
+ if(m_aFieldCB.IsVisible() && (USER_DATA_NONE != nSelected) && (nSelected < 0))
+ {
+ //search in ListBox if it's one of the first entries
+ String sSelect;
+ ::std::vector<String>* pVector = 0;
+ switch(nSelected) {
+ case USER_DATA_SALUTATION:
+ sSelect = m_sCurrentSalutation;
+ pVector = &m_aSalutations;
+ break;
+ case USER_DATA_PUNCTUATION:
+ sSelect = m_sCurrentPunctuation;
+ pVector = &m_aPunctuations;
+ break;
+ case USER_DATA_TEXT:
+ sSelect = m_sCurrentText;
+ break;
+ }
+ m_aFieldCB.Clear();
+ if(pVector) {
+ ::std::vector<String>::iterator aIterator;
+ for( aIterator = pVector->begin(); aIterator != pVector->end(); ++aIterator)
+ m_aFieldCB.InsertEntry(*aIterator);
+ }
+ m_aFieldCB.SetText(sSelect);
+ m_aFieldCB.Enable(sal_True);
+ m_aFieldFT.Enable(sal_True);
+ }
+ else
+ {
+ m_aFieldCB.Enable(sal_False);
+ m_aFieldFT.Enable(sal_False);
+ }
+
+ UpdateImageButtons_Impl();
+ bOnEntry = false;
+ return 0;
+}
+/*-- 25.06.2004 13:36:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwCustomizeAddressBlockDialog, FieldChangeHdl_Impl, ComboBox*, EMPTYARG)
+{
+ //changing the field content changes the related members, too
+ sal_Int32 nSelected = GetSelectedItem_Impl();
+ String sContent = m_aFieldCB.GetText();
+ switch(nSelected) {
+ case USER_DATA_SALUTATION:
+ m_sCurrentSalutation = sContent;
+ break;
+ case USER_DATA_PUNCTUATION:
+ m_sCurrentPunctuation = sContent;
+ break;
+ case USER_DATA_TEXT:
+ m_sCurrentText = sContent;
+ break;
+ }
+ UpdateImageButtons_Impl();
+ m_aPreviewWIN.SetAddress(GetAddress());
+ m_aDragED.Modify();
+ return 0;
+}
+
+/*-- 25.06.2004 12:35:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwCustomizeAddressBlockDialog::UpdateImageButtons_Impl()
+{
+ sal_uInt16 nMove = m_aDragED.IsCurrentItemMoveable();
+ m_aUpIB.Enable(nMove & MOVE_ITEM_UP );
+ m_aLeftIB.Enable(nMove & MOVE_ITEM_LEFT );
+ m_aRightIB.Enable(nMove & MOVE_ITEM_RIGHT );
+ m_aDownIB.Enable(nMove & MOVE_ITEM_DOWN);
+ m_aRemoveFieldIB.Enable(m_aDragED.HasCurrentItem() ? sal_True : sal_False);
+ SvLBoxEntry* pEntry = m_aAddressElementsLB.GetCurEntry();
+ m_aInsertFieldIB.Enable( pEntry &&
+ (0 < (sal_Int32)(sal_IntPtr)pEntry->GetUserData() || m_aFieldCB.GetText().Len()));
+}
+/*-- 28.04.2004 12:04:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwCustomizeAddressBlockDialog::SetAddress(const ::rtl::OUString& rAddress)
+{
+ m_aDragED.SetText( rAddress );
+ UpdateImageButtons_Impl();
+ m_aDragED.Modify();
+}
+/*-- 28.04.2004 12:04:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwCustomizeAddressBlockDialog::GetAddress()
+{
+ String sAddress(m_aDragED.GetAddress());
+ //remove placeholders by the actual content
+ if(m_aFieldFT.IsVisible())
+ {
+ for(ULONG i = 0; i < m_aAddressElementsLB.GetEntryCount(); ++i)
+ {
+ SvLBoxEntry* pEntry = m_aAddressElementsLB.GetEntry(i);
+ String sEntry = m_aAddressElementsLB.GetEntryText(pEntry);
+ sEntry += '>';
+ sEntry.Insert('<', 0);
+ sal_Int32 nUserData = (sal_Int32)(sal_IntPtr)pEntry->GetUserData();
+ switch(nUserData)
+ {
+ case USER_DATA_SALUTATION : sAddress.SearchAndReplace(sEntry, m_sCurrentSalutation); break;
+ case USER_DATA_PUNCTUATION: sAddress.SearchAndReplace(sEntry, m_sCurrentPunctuation); break;
+ case USER_DATA_TEXT : sAddress.SearchAndReplace(sEntry, m_sCurrentText); break;
+ }
+ }
+ }
+ return sAddress;
+}
+/*-- 28.02.2005 11:03:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwCustomizeAddressBlockDialog::MoveFocus( Window* pMember, bool bNext )
+{
+ ::std::vector< Window* > aControls;
+
+ aControls.push_back(&m_aAddressElementsLB);
+ aControls.push_back(&m_aInsertFieldIB);
+ aControls.push_back(&m_aRemoveFieldIB);
+ aControls.push_back(&m_aDragED);
+ aControls.push_back(&m_aUpIB);
+ aControls.push_back(&m_aLeftIB);
+ aControls.push_back(&m_aRightIB);
+ aControls.push_back(&m_aDownIB);
+ aControls.push_back(&m_aFieldCB);
+ aControls.push_back(&m_aOK);
+ aControls.push_back(&m_aCancel);
+ aControls.push_back(&m_aHelp);
+
+ ::std::vector< Window* >::iterator aMemberIter = aControls.begin();
+ for( ; aMemberIter != aControls.end(); ++aMemberIter)
+ {
+ if(*aMemberIter == pMember)
+ break;
+ }
+ if( aMemberIter == aControls.end() )
+ {
+ DBG_ERROR( "Window not found?" );
+ return;
+ }
+
+ if( bNext )
+ {
+ ::std::vector< Window* >::iterator aSearch = aMemberIter;
+ ++aSearch;
+ while( true )
+ {
+ if( aSearch == aControls.end())
+ aSearch = aControls.begin();
+ else if( (*aSearch)->IsEnabled() )
+ {
+ (*aSearch)->GrabFocus();
+ break;
+ }
+ else
+ ++aSearch;
+ }
+ }
+ else
+ {
+ ::std::vector< Window* >::iterator aSearch = aMemberIter;
+ if(aSearch == aControls.begin())
+ aSearch = aControls.end();
+ while( true )
+ {
+ if(aSearch == aControls.begin())
+ aSearch = aControls.end();
+ else
+ --aSearch;
+ if( (*aSearch)->IsEnabled() )
+ {
+ (*aSearch)->GrabFocus();
+ break;
+ }
+ }
+ }
+
+}
+/*-- 13.04.2004 17:49:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwAssignFieldsControl : public Control
+{
+ friend class SwAssignFieldsDialog;
+ ScrollBar m_aVScroll;
+ HeaderBar m_aHeaderHB;
+ Window m_aWindow;
+
+ ::std::vector<FixedInfo*> m_aFieldNames;
+ ::std::vector<ListBox*> m_aMatches;
+ ::std::vector<FixedInfo*> m_aPreviews;
+
+ SwMailMergeConfigItem& m_rConfigItem;
+
+ Link m_aModifyHdl;
+
+ long m_nLBStartTopPos;
+ long m_nYOffset;
+ long m_nFirstYPos;
+
+ DECL_LINK(ScrollHdl_Impl, ScrollBar*);
+ DECL_LINK(MatchHdl_Impl, ListBox*);
+ DECL_LINK(GotFocusHdl_Impl, ListBox*);
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+
+ void MakeVisible( sal_Int32 nIndex );
+public:
+ SwAssignFieldsControl(Window* pParent, const ResId& rResId,
+ SwMailMergeConfigItem& rConfigItem);
+ ~SwAssignFieldsControl();
+
+ void SetModifyHdl(const Link& rModifyHdl)
+ {
+ m_aModifyHdl = rModifyHdl;
+ m_aModifyHdl.Call(this);
+ }
+};
+/*-- 13.04.2004 17:51:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+//-------------------------------------------------------------------------
+SwAssignFieldsControl::SwAssignFieldsControl(
+ Window* pParent, const ResId& rResId, SwMailMergeConfigItem& rConfigItem) :
+ Control(pParent, rResId),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aVScroll(this, ResId(SCR_1, *rResId.GetResMgr() )),
+ m_aHeaderHB(this, WB_BUTTONSTYLE | WB_BOTTOMBORDER),
+ m_aWindow(this, ResId(WIN_DATA, *rResId.GetResMgr())),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_rConfigItem(rConfigItem),
+ m_nLBStartTopPos(0),
+ m_nYOffset(0),
+ m_nFirstYPos(0)
+{
+ SetStyle(GetStyle()|WB_TABSTOP|WB_DIALOGCONTROL);
+ SetHelpId(HID_MM_ASSIGN_FIELDS);
+ long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height();
+ Size aOutputSize(GetOutputSize());
+ m_aHeaderHB.SetSizePixel(
+ Size(aOutputSize.Width(), nHBHeight));
+ m_aHeaderHB.Show();
+ m_aWindow.SetPosPixel(Point( 0, nHBHeight) );
+ m_aWindow.SetSizePixel(Size(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight));
+ m_aWindow.Show();
+
+ //get the name of the default headers
+ const ResStringArray& rHeaders = rConfigItem.GetDefaultAddressHeaders();
+ //get the actual data
+ uno::Reference< XColumnsSupplier > xColsSupp( rConfigItem.GetResultSet(), uno::UNO_QUERY);
+ //get the name of the actual columns
+ uno::Reference <XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : 0;
+ uno::Sequence< ::rtl::OUString > aFields;
+ if(xColAccess.is())
+ aFields = xColAccess->getElementNames();
+ const ::rtl::OUString* pFields = aFields.getConstArray();
+
+ //get the current assignment list
+ //each position in this sequence matches the position in the header array rHeaders
+ //if no assignment is available an empty sequence will be returned
+ uno::Sequence< ::rtl::OUString> aAssignments = rConfigItem.GetColumnAssignment( rConfigItem.GetCurrentDBData() );
+ Link aMatchHdl = LINK(this, SwAssignFieldsControl, MatchHdl_Impl);
+ Link aFocusHdl = LINK(this, SwAssignFieldsControl, GotFocusHdl_Impl);
+
+ static const char* aHIDs[] =
+ {
+ HID_MM_HEADER_0,
+ HID_MM_HEADER_1,
+ HID_MM_HEADER_2,
+ HID_MM_HEADER_3,
+ HID_MM_HEADER_4,
+ HID_MM_HEADER_5,
+ HID_MM_HEADER_6,
+ HID_MM_HEADER_7,
+ HID_MM_HEADER_8,
+ HID_MM_HEADER_9,
+ HID_MM_HEADER_10,
+ HID_MM_HEADER_11,
+ HID_MM_HEADER_12,
+ HID_MM_HEADER_13
+ };
+
+ //fill the controls
+ for(USHORT i = 0; i < rHeaders.Count(); ++i)
+ {
+ const XubString& rHeader = rHeaders.GetString( i );
+ FixedInfo* pNewText = new FixedInfo(&m_aWindow, ResId( FT_FIELDS, *rResId.GetResMgr()));
+ String sLabel(String::CreateFromAscii("<>"));
+ sLabel.Insert(rHeader, 1);
+ pNewText->SetText(sLabel);
+ ListBox* pNewLB = new ListBox(&m_aWindow, ResId(LB_FIELDS, *rResId.GetResMgr()));
+ pNewLB->SetHelpId( aHIDs[i] );
+ pNewLB->SelectEntryPos(0);
+ for(sal_Int32 nField = 0; nField < aFields.getLength(); ++nField)
+ pNewLB->InsertEntry(pFields[nField]);
+ FixedInfo* pNewPreview = new FixedInfo(&m_aWindow, ResId( FT_PREVIEW, *rResId.GetResMgr() ));
+ //select the ListBox
+ //if there is an assignment
+ if(aAssignments.getLength() > i && aAssignments[i].getLength())
+ pNewLB->SelectEntry(aAssignments[i]);
+ else //otherwise the current column name may match one of the db columns
+ pNewLB->SelectEntry(rHeader);
+ //then the preview can be filled accordingly
+ if(xColAccess.is() && pNewLB->GetSelectEntryPos() > 0 &&
+ xColAccess->hasByName(pNewLB->GetSelectEntry()))
+ {
+ uno::Any aCol = xColAccess->getByName(pNewLB->GetSelectEntry());
+ uno::Reference< XColumn > xColumn;
+ aCol >>= xColumn;
+ if(xColumn.is())
+ try
+ {
+ pNewPreview->SetText(xColumn->getString());
+ }
+ catch(SQLException& )
+ {
+ }
+ }
+ if(!i)
+ {
+ //determine the vertical offset, use the bottom position of the ListBox
+ m_nFirstYPos = m_nYOffset = pNewLB->GetPosPixel().Y();
+ m_nLBStartTopPos = m_nYOffset;
+ m_nYOffset += pNewLB->GetSizePixel().Height();
+ }
+
+ long nMove = m_nYOffset * i;
+ lcl_Move(pNewText, nMove);
+ lcl_Move(pNewLB, nMove);
+ lcl_Move(pNewPreview, nMove);
+ //set the select handler
+ pNewLB->SetSelectHdl(aMatchHdl);
+ pNewLB->SetGetFocusHdl(aFocusHdl);
+
+ m_aFieldNames.push_back(pNewText);
+ m_aMatches.push_back(pNewLB);
+ m_aPreviews.push_back(pNewPreview);
+ }
+ ListBox* pBottomBox = m_aMatches[rHeaders.Count() -1];
+ long nYBottom = pBottomBox->GetPosPixel().Y();
+ nYBottom += pBottomBox->GetDropDownPosSizePixel().GetHeight();
+ m_aVScroll.SetRange(Range(0, rHeaders.Count()));
+ m_aVScroll.SetPageSize((aOutputSize.Height() - nHBHeight - m_nLBStartTopPos)/ m_nYOffset);
+ m_aVScroll.EnableDrag();
+ m_aVScroll.SetVisibleSize(m_aVScroll.GetPageSize());
+ m_aVScroll.SetScrollHdl(LINK(this, SwAssignFieldsControl, ScrollHdl_Impl));
+
+ FreeResource();
+ m_aVScroll.SetPosPixel(Point(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), nHBHeight));
+ m_aVScroll.SetSizePixel(Size(m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight));
+
+}
+/*-- 13.04.2004 17:51:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAssignFieldsControl::~SwAssignFieldsControl()
+{
+ ::std::vector<FixedInfo*>::iterator aFIIter;
+ for(aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter)
+ delete *aFIIter;
+ ::std::vector<ListBox*>::iterator aLBIter;
+ for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter)
+ delete *aLBIter;
+ for(aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter)
+ delete *aFIIter;
+}
+
+/*-- 07.05.2004 13:11:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAssignFieldsControl::Command( const CommandEvent& rCEvt )
+{
+ switch ( rCEvt.GetCommand() )
+ {
+ case COMMAND_WHEEL:
+ case COMMAND_STARTAUTOSCROLL:
+ case COMMAND_AUTOSCROLL:
+ {
+ const CommandWheelData* pWheelData = rCEvt.GetWheelData();
+ if(pWheelData && !pWheelData->IsHorz() && COMMAND_WHEEL_ZOOM != pWheelData->GetMode())
+ {
+ HandleScrollCommand( rCEvt, 0, &m_aVScroll );
+ }
+ }
+ break;
+ default:
+ Control::Command(rCEvt);
+ }
+}
+/*-- 07.05.2004 13:11:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+long SwAssignFieldsControl::PreNotify( NotifyEvent& rNEvt )
+{
+ if(rNEvt.GetType() == EVENT_COMMAND)
+ {
+ const CommandEvent* pCEvt = rNEvt.GetCommandEvent();
+ USHORT nCmd = pCEvt->GetCommand();
+ if( COMMAND_WHEEL == nCmd )
+ {
+ Command(*pCEvt);
+ return 1;
+ }
+ }
+ return Control::PreNotify(rNEvt);
+}
+/*-- 03.09.2004 13:19:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAssignFieldsControl::MakeVisible( sal_Int32 nIndex )
+{
+ long nThumb = m_aVScroll.GetThumbPos();
+ long nPage = m_aVScroll.GetPageSize();
+ if(nThumb > nIndex)
+ m_aVScroll.SetThumbPos( nIndex );
+ else if( (nThumb + nPage) < nIndex)
+ m_aVScroll.SetThumbPos( nIndex - nPage );
+ else
+ return;
+ ScrollHdl_Impl( &m_aVScroll );
+}
+/*-- 30.04.2004 16:10:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAssignFieldsControl, ScrollHdl_Impl, ScrollBar*, pScroll)
+{
+ long nThumb = pScroll->GetThumbPos();
+ // the scrollbar moves on a per line basis
+ // the height of a line is stored in m_nYOffset
+ // nThumb determines which line has to be set at the top (m_nYOffset)
+ // The first line has to be -(nThumb * m_nYOffset) in the negative
+ long nMove = m_nFirstYPos - (*m_aMatches.begin())->GetPosPixel().Y() - (nThumb * m_nYOffset);
+
+ SetUpdateMode(FALSE);
+ long nIndex;
+ ::std::vector<FixedInfo*>::iterator aFIIter;
+ for(nIndex = 0, aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter, ++nIndex)
+ lcl_Move(*aFIIter, nMove);
+ ::std::vector<ListBox*>::iterator aLBIter;
+ for(nIndex = 0, aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex)
+ lcl_Move(*aLBIter, nMove);
+ for(nIndex = 0, aFIIter = m_aPreviews.begin(); aFIIter != m_aPreviews.end(); ++aFIIter, ++nIndex)
+ lcl_Move(*aFIIter, nMove);
+ SetUpdateMode(TRUE);
+
+ return 0;
+}
+
+/*-- 03.05.2004 15:37:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAssignFieldsControl, MatchHdl_Impl, ListBox*, pBox)
+{
+ String sColumn = pBox->GetSelectEntry();
+ uno::Reference< XColumnsSupplier > xColsSupp( m_rConfigItem.GetResultSet(), uno::UNO_QUERY);
+ uno::Reference <XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : 0;
+ ::rtl::OUString sPreview;
+ if(xColAccess.is() && xColAccess->hasByName(sColumn))
+ {
+ uno::Any aCol = xColAccess->getByName(sColumn);
+ uno::Reference< XColumn > xColumn;
+ aCol >>= xColumn;
+ if(xColumn.is())
+ {
+ try
+ {
+ sPreview = xColumn->getString();
+ }
+ catch( sdbc::SQLException& )
+ {
+ }
+ }
+ }
+ ::std::vector<ListBox*>::iterator aLBIter;
+ sal_Int32 nIndex = 0;
+ for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex)
+ {
+ if(*aLBIter == pBox)
+ {
+ m_aPreviews[nIndex]->SetText(sPreview);
+ break;
+ }
+ }
+ m_aModifyHdl.Call(0);
+ return 0;
+}
+/*-- 03.09.2004 13:16:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAssignFieldsControl, GotFocusHdl_Impl, ListBox*, pBox)
+{
+ if(0 != (GETFOCUS_TAB & pBox->GetGetFocusFlags()))
+ {
+ sal_Int32 nIndex = 0;
+ ::std::vector<ListBox*>::iterator aLBIter;
+ for(aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex)
+ {
+ if(*aLBIter == pBox)
+ {
+ MakeVisible(nIndex);
+ break;
+ }
+ }
+ }
+ return 0;
+}
+/*-- 13.04.2004 17:44:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAssignFieldsDialog::SwAssignFieldsDialog(
+ Window* pParent, SwMailMergeConfigItem& rConfigItem,
+ const ::rtl::OUString& rPreview,
+ bool bIsAddressBlock) :
+ SfxModalDialog(pParent, SW_RES(DLG_MM_ASSIGNFIELDS)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aMatchingFI( this, SW_RES( FI_MATCHING)),
+ m_pFieldsControl( new SwAssignFieldsControl(this, SW_RES( CT_FIELDS ), rConfigItem)),
+ m_aPreviewFI( this, SW_RES( FI_PREVIEW )),
+ m_aPreviewWIN( this, SW_RES( WIN_PREVIEW )),
+ m_aSeparatorFL( this, SW_RES( FL_SEPARATOR)),
+ m_aOK( this, SW_RES( PB_OK )),
+ m_aCancel( this, SW_RES( PB_CANCEL )),
+ m_aHelp( this, SW_RES( PB_HELP )),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_sNone(SW_RES(ST_NONE)),
+ m_rPreviewString(rPreview),
+ m_rConfigItem(rConfigItem)
+{
+ //resize the HeaderBar
+ String sAddressElement( SW_RES(ST_ADDRESSELEMENT ));
+ String sMatchesTo( SW_RES(ST_MATCHESTO ));
+ String sPreview( SW_RES(ST_PREVIEW ));
+ if(!bIsAddressBlock)
+ {
+ m_aPreviewFI.SetText(String(SW_RES(ST_SALUTATIONPREVIEW)));
+ m_aMatchingFI.SetText(String(SW_RES(ST_SALUTATIONMATCHING)));
+ sAddressElement = String(SW_RES(ST_SALUTATIONELEMENT));
+ }
+ FreeResource();
+ Size aOutputSize(m_pFieldsControl->m_aHeaderHB.GetSizePixel());
+ sal_Int32 nFirstWidth;
+ sal_Int32 nSecondWidth = nFirstWidth = aOutputSize.Width() / 3;
+ const WinBits nHeadBits = HIB_VCENTER | HIB_FIXED| HIB_FIXEDPOS;
+ m_pFieldsControl->m_aHeaderHB.InsertItem( 1, sAddressElement, nFirstWidth, nHeadBits|HIB_LEFT);
+ m_pFieldsControl->m_aHeaderHB.InsertItem( 2, sMatchesTo, nSecondWidth, nHeadBits|HIB_LEFT);
+ m_pFieldsControl->m_aHeaderHB.InsertItem( 3, sPreview,
+ aOutputSize.Width() - nFirstWidth - nSecondWidth, nHeadBits|HIB_LEFT);
+
+ m_pFieldsControl->SetModifyHdl(LINK(this, SwAssignFieldsDialog, AssignmentModifyHdl_Impl ));
+
+ String sMatching = m_aMatchingFI.GetText();
+ sMatching.SearchAndReplaceAscii("%1", sMatchesTo);
+ m_aMatchingFI.SetText(sMatching);
+
+ m_aOK.SetClickHdl(LINK(this, SwAssignFieldsDialog, OkHdl_Impl));
+}
+/*-- 13.04.2004 17:44:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAssignFieldsDialog::~SwAssignFieldsDialog()
+{
+ delete m_pFieldsControl;
+}
+/*-- 05.05.2004 14:39:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< ::rtl::OUString > SwAssignFieldsDialog::CreateAssignments()
+{
+ uno::Sequence< ::rtl::OUString > aAssignments(
+ m_rConfigItem.GetDefaultAddressHeaders().Count());
+ ::rtl::OUString* pAssignments = aAssignments.getArray();
+ ::std::vector<ListBox*>::iterator aLBIter;
+ sal_Int32 nIndex = 0;
+ for(aLBIter = m_pFieldsControl->m_aMatches.begin();
+ aLBIter != m_pFieldsControl->m_aMatches.end();
+ ++aLBIter, ++nIndex)
+ {
+ String sSelect = (*aLBIter)->GetSelectEntry();
+ if(m_sNone != sSelect)
+ pAssignments[nIndex] = sSelect;
+ else
+ pAssignments[nIndex] = ::rtl::OUString();
+ }
+ return aAssignments;
+}
+/*-- 03.05.2004 18:04:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAssignFieldsDialog, OkHdl_Impl, PushButton*, EMPTYARG)
+{
+ m_rConfigItem.SetColumnAssignment(
+ m_rConfigItem.GetCurrentDBData(),
+ CreateAssignments() );
+ EndDialog(RET_OK);
+ return 0;
+}
+/*-- 05.05.2004 14:37:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwAssignFieldsDialog, AssignmentModifyHdl_Impl, void*, EMPTYARG)
+{
+ uno::Sequence< ::rtl::OUString > aAssignments = CreateAssignments();
+ String sPreview = SwAddressPreview::FillData(
+ m_rPreviewString, m_rConfigItem, &aAssignments);
+ m_aPreviewWIN.SetAddress(sPreview);
+ return 0;
+}
+
+/*-- 26.05.2004 11:20:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+DDListBox::DDListBox(SwCustomizeAddressBlockDialog* pParent, const ResId rResId) :
+ SvTreeListBox(pParent, rResId),
+ m_pParentDialog(pParent)
+{
+ SetStyle( GetStyle() | /*WB_HASBUTTONS|WB_HASBUTTONSATROOT|*/
+ WB_CLIPCHILDREN );
+// SetSpaceBetweenEntries(3);
+ SetSelectionMode( SINGLE_SELECTION );
+ SetDragDropMode( SV_DRAGDROP_CTRL_COPY );
+ EnableAsyncDrag(TRUE);
+ SetHelpId(HID_MM_CUSTOMFIELDS);
+ // expand selection to the complete width of the ListBox
+ SetHighlightRange();
+ Show();
+
+}
+/*-- 26.05.2004 11:20:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+DDListBox::~DDListBox()
+{
+}
+/*-- 26.05.2004 11:20:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void DDListBox::StartDrag( sal_Int8 /*nAction*/, const Point& /*rPosPixel*/ )
+{
+ SvLBoxEntry* pEntry = GetCurEntry();
+ if(pEntry)
+ {
+ ReleaseMouse();
+
+ TransferDataContainer* pContainer = new TransferDataContainer;
+ uno::Reference<
+ datatransfer::XTransferable > xRef( pContainer );
+
+ sal_Int32 nUserData = (sal_Int32)(sal_IntPtr)pEntry->GetUserData();
+ //special entries can only be once in the address / greeting
+ if(nUserData >= 0 || !m_pParentDialog->HasItem_Impl(nUserData))
+ {
+ String sEntry;
+ sEntry = GetEntryText(pEntry);
+ sEntry.Insert('<', 0);
+ sEntry += '>';
+ if(sEntry.Len())
+ {
+ pContainer->CopyString( sEntry );
+ pContainer->StartDrag( this, DND_ACTION_COPY, GetDragFinishedHdl() );
+ }
+ }
+ }
+}
+/*-- 26.05.2004 13:14:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+AddressMultiLineEdit::AddressMultiLineEdit(SwCustomizeAddressBlockDialog* pParent, const ResId& rResId) :
+ MultiLineEdit(pParent, rResId),
+ m_pParentDialog(pParent)
+
+{
+ GetTextView()->SupportProtectAttribute(sal_True);
+ StartListening(*GetTextEngine());
+ //DisableSelectionOnFocus();
+ EnableFocusSelectionHide(FALSE);
+}
+/*-- 26.05.2004 13:14:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+AddressMultiLineEdit::~AddressMultiLineEdit()
+{
+ EndListening(*GetTextEngine());
+}
+/*-- 25.06.2004 13:02:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void AddressMultiLineEdit::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+{
+ if(rHint.ISA(TextHint) &&
+ static_cast<const TextHint&>(rHint).GetId() == TEXT_HINT_VIEWSELECTIONCHANGED &&
+ m_aSelectionLink.IsSet())
+ {
+ m_aSelectionLink.Call(this);
+ }
+}
+/*-- 26.05.2004 13:45:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+long AddressMultiLineEdit::PreNotify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+ if( EVENT_KEYINPUT == rNEvt.GetType() &&
+ rNEvt.GetKeyEvent()->GetCharCode())
+ {
+ const KeyEvent* pKEvent = rNEvt.GetKeyEvent();
+ if('\t' == pKEvent->GetCharCode() &&
+ 0 == (pKEvent->GetKeyCode().GetModifier() & (KEY_MOD1|KEY_MOD2)))
+ {
+ m_pParentDialog->MoveFocus(this, !pKEvent->GetKeyCode().IsShift());
+ }
+ nHandled = 1;
+ }
+ else if(EVENT_MOUSEBUTTONDOWN == rNEvt.GetType()) {
+ const MouseEvent *pMEvt = rNEvt.GetMouseEvent();
+ if(pMEvt->GetClicks() >= 2)
+ nHandled = 1;
+ }
+ if(!nHandled)
+ nHandled = MultiLineEdit::PreNotify( rNEvt );
+ return nHandled;
+
+}
+/*-- 25.06.2004 08:20:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void AddressMultiLineEdit::SetText( const String& rStr )
+{
+ MultiLineEdit::SetText(rStr);
+ //set attributes to all address tokens
+
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ TextAttribProtect aProtectAttr;
+ ULONG nParaCount = pTextEngine->GetParagraphCount();
+ for(ULONG nPara = 0; nPara < nParaCount; ++nPara)
+ {
+ xub_StrLen nIndex = 0;
+ String sPara = pTextEngine->GetText( nPara );
+ if(sPara.Len() && sPara.GetChar(sPara.Len() - 1) != ' ')
+ {
+ TextPaM aPaM(nPara, sPara.Len());
+ pTextEngine->ReplaceText(TextSelection( aPaM ), String(' '));
+ }
+ while(true)
+ {
+ USHORT nStart = sPara.Search( '<', nIndex );
+ USHORT nEnd = sPara.Search( '>', nStart );
+ nIndex = nEnd;
+ if(nStart != STRING_NOTFOUND && nEnd != STRING_NOTFOUND)
+ pTextEngine->SetAttrib( aProtectAttr, nPara, nStart, nEnd + 1, FALSE );
+ else
+ break;
+ }
+
+ }
+ // add two empty paragraphs at the end
+ if(m_pParentDialog->m_eType == SwCustomizeAddressBlockDialog::ADDRESSBLOCK_NEW ||
+ m_pParentDialog->m_eType == SwCustomizeAddressBlockDialog::ADDRESSBLOCK_EDIT)
+ {
+ xub_StrLen nLastLen = pTextEngine->GetText(nParaCount - 1).Len();
+ if(nLastLen)
+ {
+ TextPaM aPaM(nParaCount ? nParaCount - 1 : 0, nLastLen);
+ pTextEngine->ReplaceText( TextSelection( aPaM ), String::CreateFromAscii("\n \n "));
+ }
+ }
+}
+
+/*-- 25.06.2004 12:32:41---------------------------------------------------
+ Insert the new entry in front of the entry at the beginning of the selection
+
+ -----------------------------------------------------------------------*/
+void AddressMultiLineEdit::InsertNewEntry( const String& rStr )
+{
+ // insert new entry after current selected one.
+ ExtTextView* pTextView = GetTextView();
+ const TextSelection& rSelection = pTextView->GetSelection();
+ ULONG nPara = rSelection.GetStart().GetPara();
+ USHORT nIndex = rSelection.GetEnd().GetIndex();
+ ExtTextEngine *pTextEngine = GetTextEngine();
+ const TextCharAttrib *pAttrib;
+ if(0 != (pAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED )))
+ nIndex = pAttrib->GetEnd();
+ InsertNewEntryAtPosition( rStr, nPara, nIndex );
+
+ // select the new entry
+ pAttrib = pTextEngine->FindCharAttrib(TextPaM(nPara, nIndex),TEXTATTR_PROTECTED);
+ TextSelection aEntrySel(TextPaM(nPara, nIndex), TextPaM(nPara, pAttrib->GetEnd()));
+ pTextView->SetSelection(aEntrySel);
+ Invalidate();
+ Modify();
+}
+
+void AddressMultiLineEdit::InsertNewEntryAtPosition( const String& rStr, ULONG nPara, USHORT nIndex )
+{
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ TextPaM aInsertPos( nPara, nIndex );
+
+ pTextEngine->ReplaceText( aInsertPos, rStr );
+
+ //restore the attributes
+ SetText( GetAddress() );
+ //select the newly inserted/moved element
+ TextSelection aEntrySel(aInsertPos);
+ ExtTextView* pTextView = GetTextView();
+ pTextView->SetSelection(aEntrySel);
+ m_aSelectionLink.Call(this);
+}
+/*-- 25.06.2004 12:32:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void AddressMultiLineEdit::RemoveCurrentEntry()
+{
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ ExtTextView* pTextView = GetTextView();
+ const TextSelection& rSelection = pTextView->GetSelection();
+ const TextCharAttrib* pBeginAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
+// const TextCharAttrib* pEndAttrib = pTextEngine->FindCharAttrib( rSelection.GetEnd(), TEXTATTR_PROTECTED );
+ if(pBeginAttrib &&
+ (pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex()
+ && pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex()))
+ {
+ ULONG nPara = rSelection.GetStart().GetPara();
+ TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd()));
+ pTextEngine->ReplaceText(aEntrySel, String());
+ //restore the attributes
+ SetText( GetAddress() );
+ Modify();
+ }
+}
+/*-- 25.06.2004 12:32:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void AddressMultiLineEdit::MoveCurrentItem(sal_uInt16 nMove)
+{
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ ExtTextView* pTextView = GetTextView();
+ const TextSelection& rSelection = pTextView->GetSelection();
+ const TextCharAttrib* pBeginAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
+ if(pBeginAttrib &&
+ (pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex()
+ && pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex()))
+ {
+ //current item has been found
+ ULONG nPara = rSelection.GetStart().GetPara();
+ USHORT nIndex = pBeginAttrib->GetStart();
+ TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd()));
+ String sCurrentItem = pTextEngine->GetText(aEntrySel);
+ pTextEngine->RemoveAttrib( nPara, *pBeginAttrib );
+ pTextEngine->ReplaceText(aEntrySel, String());
+ switch(nMove)
+ {
+ case MOVE_ITEM_LEFT :
+ if(nIndex)
+ {
+ //go left to find a predecessor or simple text
+ --nIndex;
+ String sPara = pTextEngine->GetText( nPara );
+ xub_StrLen nSearchIndex = sPara.SearchBackward( '>', nIndex+1 );
+ if( nSearchIndex != STRING_NOTFOUND && nSearchIndex == nIndex )
+ {
+ nSearchIndex = sPara.SearchBackward( '<', nIndex );
+ if( nSearchIndex != STRING_NOTFOUND )
+ nIndex = nSearchIndex;
+ }
+ }
+ break;
+ case MOVE_ITEM_RIGHT:
+ {
+ //go right to find a successor or simple text
+ ++nIndex;
+ const TextCharAttrib* pEndAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
+ if(pEndAttrib && pEndAttrib->GetEnd() >= nIndex)
+ {
+ nIndex = pEndAttrib->GetEnd();
+ }
+ }
+ break;
+ case MOVE_ITEM_UP :
+ --nPara;
+ nIndex = 0;
+ break;
+ case MOVE_ITEM_DOWN :
+ ++nPara;
+ nIndex = 0;
+ break;
+ }
+ //add a new paragraph if there is none yet
+ if(nPara >= pTextEngine->GetParagraphCount())
+ {
+
+ TextPaM aTemp(nPara - 1, pTextEngine->GetTextLen( nPara - 1 ));
+ pTextEngine->ReplaceText( aTemp, String('\n'));
+ }
+ InsertNewEntryAtPosition( sCurrentItem, nPara, nIndex );
+
+ // select the new entry [#i40817]
+ const TextCharAttrib *pAttrib;
+ pAttrib = pTextEngine->FindCharAttrib(TextPaM(nPara, nIndex),TEXTATTR_PROTECTED);
+ aEntrySel = TextSelection(TextPaM(nPara, nIndex), TextPaM(nPara, pAttrib->GetEnd()));
+ pTextView->SetSelection(aEntrySel);
+ Invalidate();
+ Modify();
+ }
+}
+/*-- 25.06.2004 12:32:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_uInt16 AddressMultiLineEdit::IsCurrentItemMoveable()
+{
+ sal_uInt16 nRet = 0;
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ ExtTextView* pTextView = GetTextView();
+ const TextSelection& rSelection = pTextView->GetSelection();
+ const TextCharAttrib* pBeginAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
+// const TextCharAttrib* pEndAttrib = pTextEngine->FindCharAttrib( rSelection.GetEnd(), TEXTATTR_PROTECTED );
+ if(pBeginAttrib &&
+ (pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex()
+ && pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex()))
+ {
+ if(pBeginAttrib->GetStart())
+ nRet |= MOVE_ITEM_LEFT;
+ //if there is an entry it can always be move to the right and down
+ nRet |= MOVE_ITEM_RIGHT|MOVE_ITEM_DOWN;
+ if(rSelection.GetStart().GetPara() > 0)
+ nRet |= MOVE_ITEM_UP;
+ }
+ return nRet;
+}
+/*-- 25.06.2004 12:32:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool AddressMultiLineEdit::HasCurrentItem()
+{
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ ExtTextView* pTextView = GetTextView();
+ const TextSelection& rSelection = pTextView->GetSelection();
+ const TextCharAttrib* pBeginAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
+ return (pBeginAttrib &&
+ (pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex()
+ && pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex()));
+}
+/*-- 01.07.2004 09:07:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+String AddressMultiLineEdit::GetCurrentItem()
+{
+ String sRet;
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ ExtTextView* pTextView = GetTextView();
+ const TextSelection& rSelection = pTextView->GetSelection();
+ const TextCharAttrib* pBeginAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
+ if(pBeginAttrib &&
+ (pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex()
+ && pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex()))
+ {
+ ULONG nPara = rSelection.GetStart().GetPara();
+ TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd()));
+ sRet = pTextEngine->GetText( aEntrySel );
+ }
+ return sRet;
+}
+/*-- 05.07.2004 14:29:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void AddressMultiLineEdit::SelectCurrentItem()
+{
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ ExtTextView* pTextView = GetTextView();
+ const TextSelection& rSelection = pTextView->GetSelection();
+ const TextCharAttrib* pBeginAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
+ if(pBeginAttrib &&
+ (pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex()
+ && pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex()))
+ {
+ ULONG nPara = rSelection.GetStart().GetPara();
+ TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd()));
+ pTextView->SetSelection(aEntrySel);
+ Invalidate();
+ }
+}
+/*-- 25.06.2004 09:10:43---------------------------------------------------
+ returns the address
+ remove trailing spaces
+ and trailing empty paragraphs
+ -----------------------------------------------------------------------*/
+String AddressMultiLineEdit::GetAddress()
+{
+ String sRet;
+ ExtTextEngine* pTextEngine = GetTextEngine();
+ ULONG nParaCount = pTextEngine->GetParagraphCount();
+ for(ULONG nPara = nParaCount; nPara; --nPara)
+ {
+ String sPara = pTextEngine->GetText( nPara - 1);
+ sPara.EraseTrailingChars(' ');
+ //don't add empty trailing paragraphs
+ if(sRet.Len() || sPara.Len())
+ {
+ sRet.Insert(sPara, 0);
+ //insert the para break
+ if(nPara > 1)
+ sRet.Insert( '\n', 0);
+ }
+ }
+ return sRet;
+}
+
diff --git a/sw/source/ui/dbui/mmaddressblockpage.hrc b/sw/source/ui/dbui/mmaddressblockpage.hrc
new file mode 100644
index 000000000000..8dbae66b94e6
--- /dev/null
+++ b/sw/source/ui/dbui/mmaddressblockpage.hrc
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEADDRESSBLOCKPAGE_HRC
+#define _MAILMERGEADDRESSBLOCKPAGE_HRC
+
+#define FI_ADDRESSLIST 1
+#define PB_ADDRESSLIST 2
+#define FI_SETTINGS 3
+#define WIN_SETTINGS 4
+#define PB_SETTINGS 5
+#define CB_ADDRESS 6
+#define FI_PREVIEW 7
+#define WIN_PREVIEW 8
+#define PB_ASSIGN 9
+#define FI_DOCINDEX 10
+#define IB_PREVSET 11
+#define IB_NEXTSET 12
+#define STR_DOCUMENT 13
+#define FI_HEADER 14
+#define FI_CURRENTADDRESS 15
+#define STR_CHANGEADDRESS 16
+#define FI_SECOND 17
+#define FI_THIRD 18
+#define FI_MATCH_FIELDS 19
+
+#define FT_SELECT 20
+#define PB_NEW 21
+#define PB_DELETE 22
+#define PB_CUSTOMIZE 23
+
+#define RB_NEVER 25
+#define RB_ALWAYS 26
+#define RB_DEPENDENT 27
+#define ED_COUNTRY 28
+#define FL_SEPARATOR 29
+#define PB_OK 30
+#define PB_CANCEL 31
+#define PB_HELP 32
+
+#define FT_ADDRESSELEMENTS 40
+#define LB_ADDRESSELEMENTS 41
+#define IB_INSERTFIELD 42
+#define IB_REMOVEFIELD 43
+#define FT_DRAG 48
+#define ED_DRAG 49
+#define IB_UP 50
+#define IB_LEFT 51
+#define IB_RIGHT 52
+#define IB_DOWN 53
+#define FT_FIELD 54
+#define CB_FIELD 55
+#define ST_SALUTATION 56
+#define ST_PUNCTUATION 57
+#define ST_TEXT 58
+#define RA_SALUTATION_MALE 59
+#define RA_SALUTATION_FEMALE 60
+#define RA_PUNCTUATION 61
+#define ST_TITLE_MALE 62
+#define ST_TITLE_FEMALE 63
+#define ST_SALUTATIONELEMENTS 64
+#define ST_INSERTSALUTATIONFIELD 65
+#define ST_REMOVESALUTATIONFIELD 66
+#define ST_DRAGSALUTATION 67
+#define ST_TITLE_EDIT 68
+
+
+#define FI_MATCHING 70
+#define CT_FIELDS 71
+#define ST_SALUTATIONPREVIEW 72
+#define ST_SALUTATIONMATCHING 73
+#define ST_SALUTATIONELEMENT 74
+#define CB_HIDE_EMPTY_PARA 75
+#define FI_FIRST 76
+#define FL_FIRST 77
+#define FL_SECOND 78
+#define FL_THIRD 79
+#define FI_FOURTH 80
+
+#define SCR_1 1
+#define ST_ADDRESSELEMENT 2
+#define ST_MATCHESTO 3
+#define ST_PREVIEW 4
+#define FT_FIELDS 5
+#define LB_FIELDS 6
+#define FT_PREVIEW 7
+#define ST_NONE 8
+#define WIN_DATA 9
+
+#endif
+
+
diff --git a/sw/source/ui/dbui/mmaddressblockpage.hxx b/sw/source/ui/dbui/mmaddressblockpage.hxx
new file mode 100644
index 000000000000..eddaca225e9b
--- /dev/null
+++ b/sw/source/ui/dbui/mmaddressblockpage.hxx
@@ -0,0 +1,332 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEADDRESSBLOCKPAGE_HXX
+#define _MAILMERGEADDRESSBLOCKPAGE_HXX
+
+#include <svtools/wizardmachine.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+#include <mailmergehelper.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/lstbox.hxx>
+#include <svtools/svmedit.hxx>
+#include <svtools/headbar.hxx>
+#include <svtools/svtreebx.hxx>
+#include <vcl/combobox.hxx>
+#include <svl/lstner.hxx>
+class SwMailMergeWizard;
+class SwMailMergeConfigItem;
+/*-- 13.04.2004 15:50:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailMergeAddressBlockPage : public svt::OWizardPage
+{
+ SwBoldFixedInfo m_aHeaderFI;
+ FixedInfo m_aFirstFI;
+ FixedInfo m_aAddressListFI;
+ PushButton m_aAddressListPB;
+ FixedInfo m_aCurrentAddressFI;
+
+ FixedLine m_aFirstFL;
+
+ FixedInfo m_aSecondFI;
+ FixedInfo m_aSettingsFI;
+ CheckBox m_aAddressCB;
+ SwAddressPreview m_aSettingsWIN;
+ PushButton m_aSettingsPB;
+
+ CheckBox m_aHideEmptyParagraphsCB;
+
+ FixedLine m_aSecondFL;
+
+ FixedInfo m_aThirdFI;
+ FixedInfo m_aMatchFieldsFI;
+
+ PushButton m_aAssignPB;
+
+ FixedLine m_aThirdFL;
+
+ FixedInfo m_aFourthFI;
+ FixedInfo m_aPreviewFI;
+
+ SwAddressPreview m_aPreviewWIN;
+ FixedInfo m_aDocumentIndexFI;
+ ImageButton m_aPrevSetIB;
+ ImageButton m_aNextSetIB;
+
+ String m_sDocument;
+ String m_sCurrentAddress;
+ String m_sChangeAddress;
+
+ SwMailMergeWizard* m_pWizard;
+
+ DECL_LINK(AddressListHdl_Impl, PushButton*);
+ DECL_LINK(SettingsHdl_Impl, PushButton*);
+ DECL_LINK(AssignHdl_Impl, PushButton*);
+ DECL_LINK(AddressBlockHdl_Impl, CheckBox*);
+ DECL_LINK(InsertDataHdl_Impl, ImageButton*);
+ DECL_LINK(AddressBlockSelectHdl_Impl, SwAddressPreview*);
+ DECL_LINK(HideParagraphsHdl_Impl, CheckBox*);
+
+ void EnableAddressBlock(sal_Bool bAll, sal_Bool bSelective);
+
+ virtual void ActivatePage();
+ virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
+ virtual bool canAdvance() const;
+
+public:
+ SwMailMergeAddressBlockPage( SwMailMergeWizard* _pParent);
+ ~SwMailMergeAddressBlockPage();
+
+ SwMailMergeWizard* GetWizard() { return m_pWizard;}
+};
+/*-- 13.04.2004 15:45:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwSelectAddressBlockDialog : public SfxModalDialog
+{
+ FixedText m_aSelectFT;
+ SwAddressPreview m_aPreview;
+ PushButton m_aNewPB;
+ PushButton m_aCustomizePB;
+ PushButton m_aDeletePB;
+
+ FixedInfo m_aSettingsFI;
+ RadioButton m_aNeverRB;
+ RadioButton m_aAlwaysRB;
+ RadioButton m_aDependentRB;
+ Edit m_aCountryED;
+
+ FixedLine m_aSeparatorFL;
+
+ OKButton m_aOK;
+ CancelButton m_aCancel;
+ HelpButton m_aHelp;
+
+ com::sun::star::uno::Sequence< ::rtl::OUString> m_aAddressBlocks;
+ SwMailMergeConfigItem& m_rConfig;
+
+ DECL_LINK(NewCustomizeHdl_Impl, PushButton*);
+ DECL_LINK(DeleteHdl_Impl, PushButton*);
+ DECL_LINK(IncludeHdl_Impl, RadioButton*);
+
+ using Window::SetSettings;
+
+public:
+ SwSelectAddressBlockDialog(Window* pParent, SwMailMergeConfigItem& rConfig);
+ ~SwSelectAddressBlockDialog();
+
+ void SetAddressBlocks(const com::sun::star::uno::Sequence< ::rtl::OUString>& rBlocks,
+ sal_uInt16 nSelected);
+ const com::sun::star::uno::Sequence< ::rtl::OUString>& GetAddressBlocks();
+
+ void SetSettings(sal_Bool bIsCountry, ::rtl::OUString sCountry);
+ sal_Bool IsIncludeCountry() const {return !m_aNeverRB.IsChecked();}
+ ::rtl::OUString GetCountry() const;
+};
+
+
+/*-- 26.05.2004 11:16:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwCustomizeAddressBlockDialog;
+class DDListBox : public SvTreeListBox
+{
+ SwCustomizeAddressBlockDialog* m_pParentDialog;
+public:
+ DDListBox(SwCustomizeAddressBlockDialog* pParent, const ResId rResId);
+ ~DDListBox();
+
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+};
+/*-- 26.05.2004 11:16:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+#define MOVE_ITEM_LEFT 1
+#define MOVE_ITEM_RIGHT 2
+#define MOVE_ITEM_UP 4
+#define MOVE_ITEM_DOWN 8
+
+class AddressMultiLineEdit : public MultiLineEdit, public SfxListener
+{
+ Link m_aSelectionLink;
+ SwCustomizeAddressBlockDialog* m_pParentDialog;
+
+ using Window::Notify;
+
+ using MultiLineEdit::SetText;
+
+protected:
+ long PreNotify( NotifyEvent& rNEvt );
+public:
+ AddressMultiLineEdit(SwCustomizeAddressBlockDialog* pParent, const ResId& rResId);
+ ~AddressMultiLineEdit();
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ void SetSelectionChangedHdl( const Link& rLink ) {m_aSelectionLink = rLink;}
+
+ void SetText( const String& rStr );
+ String GetAddress();
+
+ void InsertNewEntry( const String& rStr );
+ void InsertNewEntryAtPosition( const String& rStr, ULONG nPara, USHORT nIndex );
+ void RemoveCurrentEntry();
+
+ void MoveCurrentItem(sal_uInt16 nMove);
+ sal_uInt16 IsCurrentItemMoveable();
+ bool HasCurrentItem();
+ String GetCurrentItem();
+ void SelectCurrentItem();
+};
+/*-- 13.04.2004 15:45:31---------------------------------------------------
+ Dialog is used to create custom address blocks as well as
+ custom greeting lines
+ -----------------------------------------------------------------------*/
+class SwRestrictedComboBox : public ComboBox
+{
+ String sForbiddenChars;
+
+protected:
+ virtual void KeyInput( const KeyEvent& );
+ virtual void Modify();
+public:
+ SwRestrictedComboBox(Window* pParent, const ResId& rResId):
+ ComboBox( pParent, rResId ){}
+
+ ~SwRestrictedComboBox();
+
+ void SetForbiddenChars(const String& rSet){sForbiddenChars = rSet;}
+
+};
+class SwCustomizeAddressBlockDialog : public SfxModalDialog
+{
+ friend class DDListBox;
+ friend class AddressMultiLineEdit;
+public:
+ enum DialogType
+ {
+ ADDRESSBLOCK_NEW,
+ ADDRESSBLOCK_EDIT,
+ GREETING_FEMALE,
+ GREETING_MALE
+ };
+private:
+ FixedText m_aAddressElementsFT;
+ DDListBox m_aAddressElementsLB;
+
+ ImageButton m_aInsertFieldIB;
+ ImageButton m_aRemoveFieldIB;
+
+ FixedText m_aDragFT;
+ AddressMultiLineEdit m_aDragED;
+ ImageButton m_aUpIB;
+ ImageButton m_aLeftIB;
+ ImageButton m_aRightIB;
+ ImageButton m_aDownIB;
+
+ FixedText m_aFieldFT;
+ SwRestrictedComboBox m_aFieldCB;
+
+ FixedInfo m_aPreviewFI;
+ SwAddressPreview m_aPreviewWIN;
+
+ FixedLine m_aSeparatorFL;
+
+ OKButton m_aOK;
+ CancelButton m_aCancel;
+ HelpButton m_aHelp;
+
+ ::std::vector<String> m_aSalutations;
+ ::std::vector<String> m_aPunctuations;
+
+ String m_sCurrentSalutation;
+ String m_sCurrentPunctuation;
+ String m_sCurrentText;
+
+ SwMailMergeConfigItem& m_rConfigItem;
+ DialogType m_eType;
+
+ DECL_LINK(OKHdl_Impl, OKButton*);
+ DECL_LINK(ListBoxSelectHdl_Impl, DDListBox*);
+ DECL_LINK(EditModifyHdl_Impl, AddressMultiLineEdit*);
+ DECL_LINK(ImageButtonHdl_Impl, ImageButton*);
+ DECL_LINK(SelectionChangedHdl_Impl, AddressMultiLineEdit*);
+ DECL_LINK(FieldChangeHdl_Impl, ComboBox*);
+
+ bool HasItem_Impl(sal_Int32 nUserData);
+ sal_Int32 GetSelectedItem_Impl();
+ void UpdateImageButtons_Impl();
+ void MoveFocus( Window* pMember, bool bNext );
+
+public:
+ SwCustomizeAddressBlockDialog(Window* pParent, SwMailMergeConfigItem& rConfig, DialogType);
+ ~SwCustomizeAddressBlockDialog();
+
+ void SetAddress(const ::rtl::OUString& rAddress);
+ ::rtl::OUString GetAddress();
+};
+/*-- 13.04.2004 17:41:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwAssignFieldsControl;
+class SwAssignFieldsDialog : public SfxModalDialog
+{
+ FixedInfo m_aMatchingFI;
+ SwAssignFieldsControl* m_pFieldsControl;
+
+ FixedInfo m_aPreviewFI;
+ SwAddressPreview m_aPreviewWIN;
+
+ FixedLine m_aSeparatorFL;
+
+ OKButton m_aOK;
+ CancelButton m_aCancel;
+ HelpButton m_aHelp;
+
+ String m_sNone;
+ ::rtl::OUString m_rPreviewString;
+
+ SwMailMergeConfigItem& m_rConfigItem;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > CreateAssignments();
+ DECL_LINK(OkHdl_Impl, PushButton*);
+ DECL_LINK(AssignmentModifyHdl_Impl, void*);
+
+public:
+ SwAssignFieldsDialog(Window* pParent,
+ SwMailMergeConfigItem& rConfigItem,
+ const ::rtl::OUString& rPreview,
+ bool bIsAddressBlock);
+ ~SwAssignFieldsDialog();
+};
+#endif
+
+
diff --git a/sw/source/ui/dbui/mmaddressblockpage.src b/sw/source/ui/dbui/mmaddressblockpage.src
new file mode 100644
index 000000000000..43d5b9126eb4
--- /dev/null
+++ b/sw/source/ui/dbui/mmaddressblockpage.src
@@ -0,0 +1,655 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <mmaddressblockpage.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+#define _ST_NONE_LIST \
+ StringList [en-US]= \
+ { \
+ < "< none >" ; > ; \
+ };
+
+
+TabPage DLG_MM_ADDRESSBLOCK_PAGE
+{
+ HelpID = HID_MM_ADDRESSBLOCKPAGE;
+ Size = MAP_APPFONT ( 260 , 250 ) ;
+ Hide = TRUE ;
+
+ FixedText FI_HEADER
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Insert address block";
+ };
+
+ FixedText FI_FIRST
+ {
+ Pos = MAP_APPFONT ( 6 , 27 ) ;
+ Size = MAP_APPFONT ( 10 , 8 ) ;
+ Text[ en-US ] = "1.";
+ };
+ FixedText FI_ADDRESSLIST
+ {
+ Pos = MAP_APPFONT ( 16 , 27 ) ;
+ Size = MAP_APPFONT ( 135 , 25 ) ;
+ WordBreak = TRUE;
+ Text[ en-US ] = "Select the address list containing the address data you want to use. This data is needed to create the address block.";
+ };
+ PushButton PB_ADDRESSLIST
+ {
+ HelpID = "sw:PushButton:DLG_MM_ADDRESSBLOCK_PAGE:PB_ADDRESSLIST";
+ Pos = MAP_APPFONT ( 154 , 27 ) ;
+ Size = MAP_APPFONT ( 100 , 14 ) ;
+ Text[ en-US ] = "Select A~ddress List...";
+ };
+ String STR_CHANGEADDRESS
+ {
+ Text[ en-US ] = "Select Different A~ddress List...";
+ };
+ FixedText FI_CURRENTADDRESS
+ {
+ Pos = MAP_APPFONT ( 154 , 44 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Hide = TRUE;
+ Text[ en-US ] = "Current address list: %1";
+ };
+ FixedLine FL_FIRST
+ {
+ Pos = MAP_APPFONT ( 6 , 55 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ };
+ FixedText FI_SECOND
+ {
+ Pos = MAP_APPFONT ( 6 , 66 ) ;
+ Size = MAP_APPFONT ( 10 , 8 ) ;
+ Text[ en-US ] = "2.";
+ };
+ CheckBox CB_ADDRESS
+ {
+ HelpID = "sw:CheckBox:DLG_MM_ADDRESSBLOCK_PAGE:CB_ADDRESS";
+ Pos = MAP_APPFONT ( 16 , 66 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text[ en-US ] = "~This document shall contain an address block";
+ };
+ Window WIN_SETTINGS
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 24 , 79 ) ;
+ Size = MAP_APPFONT ( 164 , 45 ) ;
+ };
+ PushButton PB_SETTINGS
+ {
+ HelpID = "sw:PushButton:DLG_MM_ADDRESSBLOCK_PAGE:PB_SETTINGS";
+ Pos = MAP_APPFONT ( 194 , 110 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Group = FALSE;
+ Text[ en-US ] = "~More...";
+ };
+ CheckBox CB_HIDE_EMPTY_PARA
+ {
+ HelpID = "sw:CheckBox:DLG_MM_ADDRESSBLOCK_PAGE:CB_HIDE_EMPTY_PARA";
+ Pos = MAP_APPFONT ( 24 , 127 ) ;
+ Size = MAP_APPFONT ( 230 , 10 ) ;
+ Text[ en-US ] = "~Suppress lines with just empty fields";
+ };
+ FixedLine FL_SECOND
+ {
+ Pos = MAP_APPFONT ( 6 , 140 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ };
+ FixedText FI_THIRD
+ {
+ Pos = MAP_APPFONT ( 6 , 151 ) ;
+ Size = MAP_APPFONT ( 10 , 8 ) ;
+ Text[ en-US ] = "3.";
+ };
+ FixedText FI_MATCH_FIELDS
+ {
+ Pos = MAP_APPFONT ( 16 , 151 ) ;
+ Size = MAP_APPFONT ( 175 , 16 ) ;
+ WordBreak = TRUE;
+ Text[ en-US ] = "Match the field name used in the mail merge to the column headers in your data source.";
+ };
+ PushButton PB_ASSIGN
+ {
+ HelpID = "sw:PushButton:DLG_MM_ADDRESSBLOCK_PAGE:PB_ASSIGN";
+ Pos = MAP_APPFONT ( 194 , 151 ) ;
+ Size = MAP_APPFONT ( 60 , 14 ) ;
+ Text[ en-US ] = "Match ~Fields...";
+ };
+ FixedLine FL_THIRD
+ {
+ Pos = MAP_APPFONT ( 6 , 169 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ };
+ FixedText FI_FOURTH
+ {
+ Pos = MAP_APPFONT ( 6 , 180 ) ;
+ Size = MAP_APPFONT ( 10 , 8 ) ;
+ Text[ en-US ] = "4.";
+ };
+ FixedText FI_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 16 , 180 ) ;
+ Size = MAP_APPFONT ( 228 , 8 ) ;
+ Text[ en-US ] = "Check if the address data matches correctly.";
+ };
+ Window WIN_PREVIEW
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 12 , 191 ) ;
+ Size = MAP_APPFONT ( 176 , 46 ) ;
+ };
+ FixedText FI_DOCINDEX
+ {
+ Pos = MAP_APPFONT ( 111 , 239 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Right = TRUE;
+ };
+ ImageButton IB_PREVSET
+ {
+ HelpID = "sw:ImageButton:DLG_MM_ADDRESSBLOCK_PAGE:IB_PREVSET";
+ Pos = MAP_APPFONT ( 167 , 238 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ SYMBOL = IMAGEBUTTON_PREV;
+ QuickHelpText[ en-US ] = "Preview Previous Address Block";
+ };
+ ImageButton IB_NEXTSET
+ {
+ HelpID = "sw:ImageButton:DLG_MM_ADDRESSBLOCK_PAGE:IB_NEXTSET";
+ Pos = MAP_APPFONT ( 178 , 238 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ SYMBOL = IMAGEBUTTON_NEXT ;
+ QuickHelpText[ en-US ] = "Preview Next Address Block";
+ };
+ String STR_DOCUMENT
+ {
+ Text[ en-US ] = "Document: %1";
+ };
+};
+
+/*-- 13.04.2004 16:07:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+ModalDialog DLG_MM_SELECTADDRESSBLOCK
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_SELECTADDRESSBLOCK;
+ Size = MAP_APPFONT ( 260 , 219 ) ;
+ Moveable = TRUE ;
+
+ Text [ en-US ] = "Select Address Block";
+
+ FixedText FT_SELECT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 150 , 8 ) ;
+ Text[ en-US ] = "~Select your preferred address block";
+ };
+ Window WIN_PREVIEW
+ {
+ Border = TRUE;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 192 , 100 ) ;
+ DialogControl = TRUE;
+ };
+ PushButton PB_NEW
+ {
+ HelpID = "sw:PushButton:DLG_MM_SELECTADDRESSBLOCK:PB_NEW";
+ Pos = MAP_APPFONT ( 204 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text[ en-US ] = "~New...";
+ };
+ PushButton PB_CUSTOMIZE
+ {
+ HelpID = "sw:PushButton:DLG_MM_SELECTADDRESSBLOCK:PB_CUSTOMIZE";
+ Pos = MAP_APPFONT ( 204 , 31 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text[ en-US ] = "~Edit...";
+ };
+ PushButton PB_DELETE
+ {
+ HelpID = "sw:PushButton:DLG_MM_SELECTADDRESSBLOCK:PB_DELETE";
+ Pos = MAP_APPFONT ( 204 , 48 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Group = FALSE;
+ Text[ en-US ] = "~Delete";
+ };
+
+ FixedText FI_SETTINGS
+ {
+ Pos = MAP_APPFONT ( 6 , 120 ) ;
+ Size = MAP_APPFONT ( 150 , 8 ) ;
+ Text[ en-US ] = "Address block settings";
+ };
+ RadioButton RB_NEVER
+ {
+ HelpID = "sw:RadioButton:DLG_MM_SELECTADDRESSBLOCK:RB_NEVER";
+ Pos = MAP_APPFONT ( 12 , 131 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text[ en-US ] = "N~ever include the country/region";
+ };
+ RadioButton RB_ALWAYS
+ {
+ HelpID = "sw:RadioButton:DLG_MM_SELECTADDRESSBLOCK:RB_ALWAYS";
+ Pos = MAP_APPFONT ( 12 , 145 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text[ en-US ] = "~Always include the country/region";
+ };
+ RadioButton RB_DEPENDENT
+ {
+ HelpID = "sw:RadioButton:DLG_MM_SELECTADDRESSBLOCK:RB_DEPENDENT";
+ Pos = MAP_APPFONT ( 12 , 159 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text[ en-US ] = "Only ~include the country/region if it is not:";
+ };
+ Edit ED_COUNTRY
+ {
+ HelpID = "sw:Edit:DLG_MM_SELECTADDRESSBLOCK:ED_COUNTRY";
+ Pos = MAP_APPFONT ( 18 , 172 ) ;
+ Size = MAP_APPFONT ( 180 , 12 ) ;
+ Border = TRUE;
+ };
+
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 188 ) ;
+ Size = MAP_APPFONT ( 260 , 8 ) ;
+ };
+
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 95 , 199 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 148 , 199 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 204 , 199 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+/*-- 13.04.2004 16:07:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+#define WORKAROUND\
+ Text [ en-US ] = "New Address Block";
+
+
+ModalDialog DLG_MM_CUSTOMIZEADDRESSBLOCK
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_CUSTOMIZEADDRESSBLOCK;
+ Size = MAP_APPFONT ( 320 , 176 ) ;
+ Moveable = TRUE ;
+
+ WORKAROUND
+
+ String ST_TITLE_EDIT
+ {
+ Text [ en-US ] = "Edit Address Block";
+ };
+
+ String ST_TITLE_MALE
+ {
+ Text [ en-US ] = "Custom Salutation (Male Recipients)";
+ };
+ String ST_TITLE_FEMALE
+ {
+ Text [ en-US ] = "Custom Salutation (Female Recipients)";
+ };
+ FixedText FT_ADDRESSELEMENTS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text[ en-US ] = "Address ~elements" ;
+ };
+ String ST_SALUTATIONELEMENTS
+ {
+ Text[ en-US ] = "Salutation e~lements" ;
+ };
+ Control LB_ADDRESSELEMENTS
+ {
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 68 , 121 ) ;
+ TabStop = TRUE;
+ Border = TRUE;
+ };
+ ImageButton IB_INSERTFIELD
+ {
+ HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZEADDRESSBLOCK:IB_INSERTFIELD";
+ Pos = MAP_APPFONT ( 80 , 29 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Symbol = IMAGEBUTTON_ARROW_RIGHT;
+ QuickHelpText[ en-US ] = "Add to address";
+ };
+ String ST_INSERTSALUTATIONFIELD
+ {
+ Text[ en-US ] = "Add to salutation";
+ };
+ ImageButton IB_REMOVEFIELD
+ {
+ HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZEADDRESSBLOCK:IB_REMOVEFIELD";
+ Pos = MAP_APPFONT ( 80 , 46 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Symbol = IMAGEBUTTON_ARROW_LEFT;
+ QuickHelpText[ en-US ] = "Remove from address";
+ };
+ String ST_REMOVESALUTATIONFIELD
+ {
+ Text[ en-US ] = "Remove from salutation";
+ };
+ FixedText FT_DRAG
+ {
+ Pos = MAP_APPFONT ( 100 , 3 ) ;
+ Size = MAP_APPFONT ( 210 , 8 ) ;
+ Text[ en-US ] = "1. Drag address elements here" ;
+ };
+ String ST_DRAGSALUTATION
+ {
+ Text[ en-US ] = "1. ~Drag salutation elements into the box below" ;
+ };
+ MultiLineEdit ED_DRAG
+ {
+ HelpID = "sw:MultiLineEdit:DLG_MM_CUSTOMIZEADDRESSBLOCK:ED_DRAG";
+ Pos = MAP_APPFONT ( 106 , 14 ) ;
+ Size = MAP_APPFONT ( 160 , 60 ) ;
+ Border = TRUE;
+ };
+ ImageButton IB_UP
+ {
+ HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZEADDRESSBLOCK:IB_UP";
+ Pos = MAP_APPFONT ( 285 , 14 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Symbol = IMAGEBUTTON_ARROW_UP;
+ QuickHelpText[ en-US ] = "Move up";
+ };
+ ImageButton IB_LEFT
+ {
+ HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZEADDRESSBLOCK:IB_LEFT";
+ Pos = MAP_APPFONT ( 270 , 29 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Symbol = IMAGEBUTTON_ARROW_LEFT;
+ QuickHelpText[ en-US ] = "Move left";
+ };
+ ImageButton IB_RIGHT
+ {
+ HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZEADDRESSBLOCK:IB_RIGHT";
+ Pos = MAP_APPFONT ( 300 , 29 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Symbol = IMAGEBUTTON_ARROW_RIGHT;
+ QuickHelpText[ en-US ] = "Move right";
+ };
+ ImageButton IB_DOWN
+ {
+ HelpID = "sw:ImageButton:DLG_MM_CUSTOMIZEADDRESSBLOCK:IB_DOWN";
+ Pos = MAP_APPFONT ( 285 , 48 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Symbol = IMAGEBUTTON_ARROW_DOWN;
+ QuickHelpText[ en-US ] = "Move down";
+ };
+ FixedText FT_FIELD
+ {
+ Pos = MAP_APPFONT ( 100 , 78 ) ;
+ Size = MAP_APPFONT ( 160 , 8 ) ;
+ Hide = TRUE;
+ Text[ en-US ] = "2. Customi~ze salutation";
+ };
+ ComboBox CB_FIELD
+ {
+ HelpID = "sw:ComboBox:DLG_MM_CUSTOMIZEADDRESSBLOCK:CB_FIELD";
+ Pos = MAP_APPFONT ( 106 , 89 ) ;
+ Size = MAP_APPFONT ( 160 , 50 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ Hide = TRUE;
+ };
+ FixedText FI_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 106 , 105 ) ;
+ Size = MAP_APPFONT ( 160 , 8 ) ;
+ Text[ en-US ] = "Preview";
+ };
+ Window WIN_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 106 , 116 ) ;
+ Size = MAP_APPFONT ( 160 , 19 ) ;
+ Border = TRUE;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 145 ) ;
+ Size = MAP_APPFONT ( 320 , 8 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 155 , 156 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 208 , 156 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 264 , 156 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ String ST_SALUTATION
+ {
+ Text[ en-US ] = "Salutation";
+ };
+ String ST_PUNCTUATION
+ {
+ Text[ en-US ] = "Punctuation Mark";
+ };
+ String ST_TEXT
+ {
+ Text[ en-US ] = "Text";
+ };
+ StringArray RA_SALUTATION_MALE
+ {
+ ItemList =
+ {
+ < "Sehr geehrter Herr <2>," ; > ;
+ < "Lieber Herr <2>," ; > ;
+ < "Hallo Herr <2>," ; > ;
+ < "Hallo <1>," ; > ;
+ };
+ ItemList [en-US]=
+ {
+ < "Dear Mr. <2>," ; > ;
+ < "Mr. <2>," ; > ;
+ < "Dear <1>," ; > ;
+ < "Hello <1>," ; > ;
+ };
+ };
+ StringArray RA_SALUTATION_FEMALE
+ {
+ ItemList =
+ {
+ < "Sehr geehrte Frau <2>," ; > ;
+ < "Liebe Frau <2>," ; > ;
+ < "Hallo Frau <2>," ; > ;
+ < "Hallo <1>," ; > ;
+ };
+ ItemList [en-US]=
+ {
+ < "Dear Mrs. <2>," ; > ;
+ < "Ms. <2>," ; > ;
+ < "Dear <1>," ; > ;
+ < "Hello <1>," ; > ;
+ };
+ };
+ StringArray RA_PUNCTUATION
+ {
+ ItemList =
+ {
+ < "," ; > ;
+ < ":" ; > ;
+ < "!" ; > ;
+ < "(kein)" ; > ;
+ };
+ ItemList [en-US]=
+ {
+ < "," ; > ;
+ < ":" ; > ;
+ < "!" ; > ;
+ < "(none)" ; > ;
+ };
+ };
+};
+/*-- 13.04.2004 17:45:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+ModalDialog DLG_MM_ASSIGNFIELDS
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_ASSIGNFIELDS;
+ Size = MAP_APPFONT ( 260 , 245 ) ;
+ Moveable = TRUE ;
+
+ Text [ en-US ] = "Match Fields";
+
+ FixedText FI_MATCHING
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 240 , 20 ) ;
+ WordBreak = TRUE;
+ Text[ en-US ] = "Assign the fields from your data source to match the address elements." ;
+ };
+ String ST_SALUTATIONMATCHING
+ {
+ Text[ en-US ] = "Assign the fields from your data source to match the salutation elements." ;
+ };
+ Control CT_FIELDS
+ {
+ Pos = MAP_APPFONT ( 6 , 26 ) ;
+ Size = MAP_APPFONT ( 248 , 120 ) ;
+ Border = TRUE;
+ DialogControl = TRUE;
+ ScrollBar SCR_1
+ {
+ Pos = MAP_APPFONT ( 238 , 10 ) ;
+ Size = MAP_APPFONT ( 10 , 110 ) ;
+ };
+ FixedText FT_FIELDS
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ };
+ Window WIN_DATA
+ {
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 248 , 120 ) ;
+ DialogControl = TRUE;
+ };
+ ListBox LB_FIELDS
+ {
+ HelpID = "sw:ListBox:DLG_MM_ASSIGNFIELDS:LB_FIELDS";
+ Pos = MAP_APPFONT ( 83 , 4 ) ;
+ Size = MAP_APPFONT ( 74 , 50 ) ;
+ TabStop = TRUE;
+ Border = TRUE;
+ DropDown = TRUE;
+ _ST_NONE_LIST
+ };
+ FixedText FT_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 165 , 6 ) ;
+ Size = MAP_APPFONT ( 70 , 8 ) ;
+ };
+ };
+ FixedText FI_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 6 , 152 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "Address block preview";
+ };
+ String ST_SALUTATIONPREVIEW
+ {
+ Text[ en-US ] = "Salutation preview";
+ };
+ Window WIN_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 6 , 163 ) ;
+ Size = MAP_APPFONT ( 248 , 45 ) ;
+ Border = TRUE;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 214 ) ;
+ Size = MAP_APPFONT ( 260 , 8 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 95 , 225 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 148 , 225 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 204 , 225 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ String ST_ADDRESSELEMENT
+ {
+ Text[ en-US ] = "Address elements" ;
+ };
+ String ST_SALUTATIONELEMENT
+ {
+ Text[ en-US ] = "Salutation elements" ;
+ };
+ String ST_MATCHESTO
+ {
+ Text[ en-US ] = "Matches to field:" ;
+ };
+ String ST_PREVIEW
+ {
+ Text[ en-US ] = "Preview" ;
+ };
+ String ST_NONE
+ {
+ Text [en-US] = "< none >";
+ };
+};
diff --git a/sw/source/ui/dbui/mmconfigitem.cxx b/sw/source/ui/dbui/mmconfigitem.cxx
new file mode 100644
index 000000000000..be1ad7d3a43d
--- /dev/null
+++ b/sw/source/ui/dbui/mmconfigitem.cxx
@@ -0,0 +1,1986 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <mmconfigitem.hxx>
+#include <swtypes.hxx>
+#include <tools/debug.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/sdb/XCompletedConnection.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include "com/sun/star/mail/MailServiceType.hpp"
+#include "com/sun/star/mail/XMailService.hpp"
+#include "com/sun/star/mail/MailServiceProvider.hpp"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/types.hxx>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <unotools/configitem.hxx>
+#include <mailmergehelper.hxx>
+#include <swunohelper.hxx>
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <dbui.hrc>
+#include <vector>
+
+#include <unomid.h>
+
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+
+using namespace utl;
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+
+const char* cAddressDataAssignments = "AddressDataAssignments";
+const char* cDBColumnAssignments = "DBColumnAssignments";
+const char* cDataSourceName = "DataSource/DataSourceName";
+const char* cDataTableName = "DataSource/DataTableName" ;
+const char* cDataCommandType = "DataSource/DataCommandType";
+
+#define SECURE_PORT 465
+#define DEFAULT_PORT 25
+#define POP_PORT 110
+
+/*-- 16.04.2004 09:41:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+struct DBAddressDataAssignment
+{
+ SwDBData aDBData;
+ Sequence< ::rtl::OUString> aDBColumnAssignments;
+ //if loaded the name of the node has to be saved
+ ::rtl::OUString sConfigNodeName;
+ //all created or changed assignments need to be stored
+ bool bColumnAssignmentsChanged;
+
+ DBAddressDataAssignment() :
+ bColumnAssignmentsChanged(false)
+ {}
+};
+
+/*-- 16.04.2004 09:43:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailMergeConfigItem_Impl : public utl::ConfigItem
+{
+ friend class SwMailMergeConfigItem;
+ Reference< XDataSource> xSource;
+ SharedConnection xConnection;
+ Reference< XColumnsSupplier> xColumnsSupplier;
+ Reference< XStatement> xStatement;
+ Reference< XResultSet> xResultSet;
+ SwDBData aDBData;
+ ::rtl::OUString sFilter;
+ sal_Int32 nResultSetCursorPos;
+
+ ::std::vector<DBAddressDataAssignment> aAddressDataAssignments;
+ ::std::vector< ::rtl::OUString> aAddressBlocks;
+ sal_Int32 nCurrentAddressBlock;
+ sal_Bool bIsAddressBlock;
+ sal_Bool bIsHideEmptyParagraphs;
+
+ sal_Bool bIsOutputToLetter;
+ sal_Bool bIncludeCountry;
+ ::rtl::OUString sExcludeCountry;
+
+ sal_Bool bIsGreetingLine;
+ sal_Bool bIsIndividualGreetingLine;
+ ::std::vector< ::rtl::OUString> aFemaleGreetingLines;
+ sal_Int32 nCurrentFemaleGreeting;
+ ::std::vector< ::rtl::OUString> aMaleGreetingLines;
+ sal_Int32 nCurrentMaleGreeting;
+ ::std::vector< ::rtl::OUString> aNeutralGreetingLines;
+ sal_Int32 nCurrentNeutralGreeting;
+ ::rtl::OUString sFemaleGenderValue;
+ uno::Sequence< ::rtl::OUString> aSavedDocuments;
+
+ sal_Bool bIsGreetingLineInMail;
+ sal_Bool bIsIndividualGreetingLineInMail;
+
+ //mail settings
+ ::rtl::OUString sMailDisplayName;
+ ::rtl::OUString sMailAddress;
+ ::rtl::OUString sMailReplyTo;
+ ::rtl::OUString sMailServer;
+ ::rtl::OUString sMailUserName;
+ ::rtl::OUString sMailPassword;
+
+ sal_Bool bIsSMPTAfterPOP;
+ ::rtl::OUString sInServerName;
+ sal_Int16 nInServerPort;
+ sal_Bool bInServerPOP;
+ ::rtl::OUString sInServerUserName;
+ ::rtl::OUString sInServerPassword;
+
+ sal_Int16 nMailPort;
+ sal_Bool bIsMailReplyTo;
+ sal_Bool bIsDefaultPort;
+ sal_Bool bIsSecureConnection;
+ sal_Bool bIsAuthentication;
+
+ sal_Bool bIsEMailSupported;
+
+ ResStringArray m_AddressHeaderSA;
+
+ //these addresses are not stored in the configuration
+ ::std::vector< SwDocMergeInfo > aMergeInfos;
+
+ //we do overwrite the usersettings in a special case
+ //than we do remind the usersettings here
+ sal_Bool bUserSettingWereOverwritten;
+ sal_Bool bIsAddressBlock_LastUserSetting;
+ sal_Bool bIsGreetingLineInMail_LastUserSetting;
+ sal_Bool bIsGreetingLine_LastUserSetting;
+
+
+ const Sequence< ::rtl::OUString>& GetPropertyNames();
+
+public:
+ SwMailMergeConfigItem_Impl();
+ ~SwMailMergeConfigItem_Impl();
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+ const Sequence< ::rtl::OUString>
+ GetAddressBlocks(sal_Bool bConvertToConfig = sal_False) const;
+ void SetAddressBlocks(
+ const Sequence< ::rtl::OUString>& rBlocks,
+ sal_Bool bConvertFromConfig = sal_False);
+ const uno::Sequence< ::rtl::OUString>
+ GetGreetings(SwMailMergeConfigItem::Gender eType,
+ sal_Bool bConvertToConfig = sal_False) const;
+ void SetGreetings(SwMailMergeConfigItem::Gender eType,
+ const uno::Sequence< ::rtl::OUString>& rBlocks,
+ sal_Bool bConvertFromConfig = sal_False);
+
+ void SetCurrentAddressBlockIndex( sal_Int32 nSet );
+ sal_Int32 GetCurrentAddressBlockIndex() const
+ { return nCurrentAddressBlock; }
+ sal_Int32 GetCurrentGreeting(SwMailMergeConfigItem::Gender eType) const;
+ void SetCurrentGreeting(SwMailMergeConfigItem::Gender eType, sal_Int32 nIndex);
+
+};
+
+/*-- 06.05.2004 12:51:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeConfigItem_Impl::SwMailMergeConfigItem_Impl() :
+ ConfigItem(C2U("Office.Writer/MailMergeWizard"), 0),
+ nResultSetCursorPos(-1),
+ nCurrentAddressBlock(0),
+ bIsAddressBlock(sal_True),
+ bIsHideEmptyParagraphs(sal_False),
+ bIsOutputToLetter(sal_True),
+ bIncludeCountry(sal_False),
+ bIsGreetingLine(sal_True),
+ nCurrentFemaleGreeting(0),
+ nCurrentMaleGreeting(0),
+ nCurrentNeutralGreeting(0),
+
+ bIsSMPTAfterPOP(sal_False),
+ nInServerPort( POP_PORT ),
+ bInServerPOP( sal_True ),
+ nMailPort(0),
+ bIsMailReplyTo(sal_False),
+ bIsDefaultPort(sal_False),
+ bIsSecureConnection(sal_False),
+ bIsAuthentication(sal_False),
+
+ bIsEMailSupported(sal_False),
+ m_AddressHeaderSA( SW_RES( SA_ADDRESS_HEADER )),
+ bUserSettingWereOverwritten(sal_False),
+ bIsAddressBlock_LastUserSetting(sal_False),
+ bIsGreetingLineInMail_LastUserSetting(sal_False),
+ bIsGreetingLine_LastUserSetting(sal_False)
+{
+ const Sequence<OUString>& rNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(rNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == rNames.getLength())
+ {
+ for(int nProp = 0; nProp < rNames.getLength(); nProp++)
+ {
+ switch(nProp)
+ {
+ case 0: pValues[nProp] >>= bIsOutputToLetter; break;
+ case 1: pValues[nProp] >>= bIncludeCountry; break;
+ case 2: pValues[nProp] >>= sExcludeCountry; break;
+ case 3:
+ {
+ Sequence< ::rtl::OUString> aBlocks;
+ pValues[nProp] >>= aBlocks;
+ SetAddressBlocks(aBlocks, sal_True);
+ }
+ break;
+ case 4: pValues[nProp] >>= bIsAddressBlock; break;
+ case 5: pValues[nProp] >>= bIsGreetingLine; break;
+ case 6: pValues[nProp] >>= bIsIndividualGreetingLine; break;
+ case 7 :
+ case 8 :
+ case 9 :
+ {
+ Sequence< ::rtl::OUString> aGreetings;
+ pValues[nProp] >>= aGreetings;
+ SetGreetings(SwMailMergeConfigItem::Gender(
+ SwMailMergeConfigItem::FEMALE + nProp - 7), aGreetings, sal_True);
+ }
+ break;
+
+ case 10: pValues[nProp] >>= nCurrentFemaleGreeting; break;
+ case 11: pValues[nProp] >>= nCurrentMaleGreeting; break;
+ case 12: pValues[nProp] >>= nCurrentNeutralGreeting; break;
+ case 13: pValues[nProp] >>= sFemaleGenderValue; break;
+ case 14: pValues[nProp] >>= sMailDisplayName; break;
+ case 15: pValues[nProp] >>= sMailAddress; break;
+ case 16: pValues[nProp] >>= bIsMailReplyTo; break;
+ case 17: pValues[nProp] >>= sMailReplyTo; break;
+ case 18: pValues[nProp] >>= sMailServer; break;
+ case 19:
+ bIsDefaultPort =
+ (pValues[nProp] >>= nMailPort) ?
+ sal_False : sal_True;
+ break;
+ case 20: pValues[nProp] >>= bIsSecureConnection; break;
+ case 21: pValues[nProp] >>= bIsAuthentication; break;
+ case 22: pValues[nProp] >>= sMailUserName; break;
+ case 23: pValues[nProp] >>= sMailPassword; break;
+ case 24 :pValues[nProp] >>= aDBData.sDataSource; break;
+ case 25 :pValues[nProp] >>= aDBData.sCommand; break;
+ case 26 :
+ {
+ short nTemp = 0;
+ if(pValues[nProp] >>= nTemp)
+ aDBData.nCommandType = nTemp;
+ }
+ break;
+ case 27: pValues[nProp] >>= sFilter; break;
+ case 28: pValues[nProp] >>= aSavedDocuments; break;
+ case 29:
+ pValues[nProp] >>= bIsEMailSupported;
+ break;
+ case 30: pValues[nProp] >>= bIsGreetingLineInMail; break;
+ case 31: pValues[nProp] >>= bIsIndividualGreetingLineInMail; break;
+ case 32: pValues[nProp] >>= bIsSMPTAfterPOP; break;
+ case 33: pValues[nProp] >>= sInServerName; break;
+ case 34: pValues[nProp] >>= nInServerPort; break;
+ case 35: pValues[nProp] >>= bInServerPOP; break;
+ case 36: pValues[nProp] >>= sInServerUserName; break;
+ case 37: pValues[nProp] >>= sInServerPassword; break;
+ case 38: pValues[nProp] >>= bIsHideEmptyParagraphs; break;
+ case 39: pValues[nProp] >>= nCurrentAddressBlock; break;
+ }
+ }
+ }
+ //read the list of data base assignments
+ Sequence<OUString> aAssignments = GetNodeNames(C2U(cAddressDataAssignments));
+ if(aAssignments.getLength())
+ {
+ //create a list of property names to load the URLs of all data bases
+ const OUString* pAssignments = aAssignments.getConstArray();
+ Sequence< ::rtl::OUString > aAssignProperties(4 * aAssignments.getLength());
+ ::rtl::OUString* pAssignProperties = aAssignProperties.getArray();
+ sal_Int32 nAssign;
+ OUString sSlash = C2U("/");
+ for(nAssign = 0; nAssign < aAssignProperties.getLength(); nAssign += 4)
+ {
+ String sAssignPath = C2U(cAddressDataAssignments);
+ sAssignPath += '/';
+ sAssignPath += String(pAssignments[nAssign / 4]);
+ sAssignPath += '/';
+ pAssignProperties[nAssign] = sAssignPath;
+ pAssignProperties[nAssign] += C2U(cDataSourceName);
+ pAssignProperties[nAssign + 1] = sAssignPath;
+ pAssignProperties[nAssign + 1] += C2U(cDataTableName);
+ pAssignProperties[nAssign + 2] = sAssignPath;
+ pAssignProperties[nAssign + 2] += C2U(cDataCommandType);
+ pAssignProperties[nAssign + 3] = sAssignPath;
+ pAssignProperties[nAssign + 3] += C2U(cDBColumnAssignments);
+ }
+ Sequence<Any> aAssignValues = GetProperties(aAssignProperties);
+ const Any* pAssignValues = aAssignValues.getConstArray();
+ for(nAssign = 0; nAssign < aAssignValues.getLength(); nAssign += 4 )
+ {
+ DBAddressDataAssignment aAssignment;
+ pAssignValues[nAssign] >>= aAssignment.aDBData.sDataSource;
+ pAssignValues[nAssign + 1] >>= aAssignment.aDBData.sCommand;
+ pAssignValues[nAssign + 2] >>= aAssignment.aDBData.nCommandType;
+ pAssignValues[nAssign + 3] >>= aAssignment.aDBColumnAssignments;
+ aAssignment.sConfigNodeName = pAssignments[nAssign / 4];
+ aAddressDataAssignments.push_back(aAssignment);
+ }
+ }
+ //check if the saved documents still exist
+ if(aSavedDocuments.getLength())
+ {
+ uno::Sequence< ::rtl::OUString > aTempDocuments(aSavedDocuments.getLength());
+ ::rtl::OUString* pTempDocuments = aTempDocuments.getArray();
+ sal_Int32 nIndex = 0;
+ for(sal_Int32 i = 0; i < aSavedDocuments.getLength(); ++i)
+ {
+ if(SWUnoHelper::UCB_IsFile( aSavedDocuments[i] ))
+ {
+ pTempDocuments[nIndex++] = aSavedDocuments[i];
+ }
+ }
+ if(nIndex < aSavedDocuments.getLength())
+ {
+ aSavedDocuments = aTempDocuments;
+ aSavedDocuments.realloc(nIndex);
+ }
+ }
+
+}
+/*-- 06.05.2004 12:51:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeConfigItem_Impl::~SwMailMergeConfigItem_Impl()
+{
+}
+/*-- 13.03.2006 12:12:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem_Impl::SetCurrentAddressBlockIndex( sal_Int32 nSet )
+{
+ if(aAddressBlocks.size() >= sal::static_int_cast<sal_uInt32, sal_Int32>(nSet))
+ {
+ nCurrentAddressBlock = nSet;
+ SetModified();
+ }
+}
+/*-- 16.04.2004 13:06:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString lcl_CreateNodeName(Sequence<OUString>& rAssignments )
+{
+ const OUString* pNames = rAssignments.getConstArray();
+ sal_Int32 nStart = rAssignments.getLength();
+ OUString sNewName;
+ bool bFound;
+ do
+ {
+ bFound = false;
+ sNewName = C2U("_");
+ sNewName += OUString::valueOf(nStart);
+ //search if the name exists
+ for(sal_Int32 nAssign = 0; nAssign < rAssignments.getLength(); ++nAssign)
+ {
+ if(pNames[nAssign] == sNewName)
+ {
+ bFound = true;
+ ++nStart;
+ break;
+ }
+ }
+ }
+ while(bFound);
+ // add the new name to the array of existing names
+ rAssignments.realloc(rAssignments.getLength() + 1);
+ rAssignments.getArray()[rAssignments.getLength() - 1] = sNewName;
+ return sNewName;
+}
+// --------------------------------------------------------------------------------
+void lcl_ConvertToNumbers(OUString& rBlock, const ResStringArray& rHeaders )
+{
+ //convert the strings used for UI to numbers used for the configuration
+ String sBlock(rBlock);
+ sBlock.SearchAndReplaceAllAscii("\n", String::CreateFromAscii("\\n"));
+ for(USHORT i = 0; i < rHeaders.Count(); ++i)
+ {
+ String sHeader = rHeaders.GetString( i );
+ sHeader.Insert('<', 0);
+ sHeader += '>';
+ String sReplace(C2U("<>"));
+ sReplace.Insert('0' + i, 1);
+ sBlock.SearchAndReplaceAll(sHeader, sReplace);
+ }
+ rBlock = sBlock;
+}
+// --------------------------------------------------------------------------------
+void lcl_ConvertFromNumbers(OUString& rBlock, const ResStringArray& rHeaders)
+{
+ //convert the numbers used for the configuration to strings used for UI to numbers
+ //doesn't use ReplaceAll to prevent expansion of numbers inside of the headers
+ String sBlock(rBlock);
+ sBlock.SearchAndReplaceAllAscii("\\n", '\n');
+ SwAddressIterator aGreetingIter(sBlock);
+ sBlock.Erase();
+ while(aGreetingIter.HasMore())
+ {
+ SwMergeAddressItem aNext = aGreetingIter.Next();
+ if(aNext.bIsColumn)
+ {
+ //the text should be 1 characters long
+ sal_Unicode cChar = aNext.sText.GetChar(0);
+ if(cChar >= '0' && cChar <= 'c')
+ {
+ sBlock += '<';
+ sal_uInt16 nHeader = cChar - '0';
+ if(nHeader < rHeaders.Count())
+ sBlock += rHeaders.GetString( nHeader );
+ sBlock += '>';
+ }
+ else
+ {
+ DBG_ERROR("parse error in address block or greeting line");
+ }
+ }
+ else
+ sBlock += aNext.sText;
+ }
+ rBlock = sBlock;
+}
+
+/*--------------------------------------------------------------------
+
+ --------------------------------------------------------------------*/
+const Sequence<OUString>& SwMailMergeConfigItem_Impl::GetPropertyNames()
+{
+ static Sequence<OUString> aNames;
+ if(!aNames.getLength())
+ {
+ static const char* aPropNames[] =
+ {
+ "OutputToLetter", // 0
+ "IncludeCountry", // 1
+ "ExcludeCountry", // 2
+ "AddressBlockSettings", // 3
+ "IsAddressBlock", // 4
+ "IsGreetingLine", // 5
+ "IsIndividualGreetingLine", // 6
+ "FemaleGreetingLines", // 7
+ "MaleGreetingLines", // 8
+ "NeutralGreetingLines", // 9
+ "CurrentFemaleGreeting", // 10
+ "CurrentMaleGreeting", // 11
+ "CurrentNeutralGreeting", // 12
+ "FemaleGenderValue", // 13
+ "MailDisplayName", // 14
+ "MailAddress", // 15
+ "IsMailReplyTo", // 16
+ "MailReplyTo", // 17
+ "MailServer", // 18
+ "MailPort", // 19
+ "IsSecureConnection", // 20
+ "IsAuthentication", // 21
+ "MailUserName", // 22
+ "MailPassword", // 23
+ "DataSource/DataSourceName",// 24
+ "DataSource/DataTableName", // 25
+ "DataSource/DataCommandType",// 26
+ "Filter", // 27
+ "SavedDocuments", // 28
+ "EMailSupported", // 29
+ "IsEMailGreetingLine", //30
+ "IsEMailIndividualGreetingLine", //31
+ "IsSMPTAfterPOP", //32
+ "InServerName", //33
+ "InServerPort", //34
+ "InServerIsPOP", //35
+ "InServerUserName", //36
+ "InServerPassword", //37
+ "IsHideEmptyParagraphs", //38
+ "CurrentAddressBlock" //39
+
+ };
+ const int nCount = sizeof(aPropNames)/sizeof(const char*);
+ aNames.realloc(nCount);
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ pNames[i] = OUString::createFromAscii(aPropNames[i]);
+ }
+ return aNames;
+}
+/*-- 15.04.2004 08:48:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem_Impl::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+void SwMailMergeConfigItem_Impl::Commit()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ switch(nProp)
+ {
+ case 0: pValues[nProp] <<= bIsOutputToLetter; break;//
+ case 1: pValues[nProp] <<= bIncludeCountry; break;
+ case 2: pValues[nProp] <<= sExcludeCountry; break;
+ case 3: pValues[nProp] <<= GetAddressBlocks(sal_True); break;
+ case 4:
+ {
+ if( bUserSettingWereOverwritten == sal_True )
+ pValues[nProp] <<= bIsAddressBlock_LastUserSetting;
+ else
+ pValues[nProp] <<= bIsAddressBlock;
+ break;
+ }
+ case 5:
+ {
+ if( bUserSettingWereOverwritten == sal_True )
+ pValues[nProp] <<= bIsGreetingLine_LastUserSetting;
+ else
+ pValues[nProp] <<= bIsGreetingLine;
+ break;
+ }
+ case 6: pValues[nProp] <<= bIsIndividualGreetingLine; break;
+ case 7:
+ case 8:
+ case 9:
+ pValues[nProp] <<= GetGreetings(
+ SwMailMergeConfigItem::Gender(
+ SwMailMergeConfigItem::FEMALE + nProp - 7), sal_True);
+ break;
+ case 10: pValues[nProp] <<= nCurrentFemaleGreeting; break;
+ case 11: pValues[nProp] <<= nCurrentMaleGreeting; break;
+ case 12: pValues[nProp] <<= nCurrentNeutralGreeting; break;
+ case 13: pValues[nProp] <<= sFemaleGenderValue; break;
+ case 14: pValues[nProp] <<= sMailDisplayName; break;
+ case 15: pValues[nProp] <<= sMailAddress; break;
+ case 16: pValues[nProp] <<= bIsMailReplyTo; break;
+ case 17: pValues[nProp] <<= sMailReplyTo; break;
+ case 18: pValues[nProp] <<= sMailServer; break;
+ case 19: if(!bIsDefaultPort)
+ pValues[nProp] <<= nMailPort;
+ break;
+ case 20: pValues[nProp] <<= bIsSecureConnection; break;
+ case 21: pValues[nProp] <<= bIsAuthentication; break;
+ case 22: pValues[nProp] <<= sMailUserName; break;
+ case 23: pValues[nProp] <<= sMailPassword; break;
+ case 24 :pValues[nProp] <<= aDBData.sDataSource; break;
+ case 25 :pValues[nProp] <<= aDBData.sCommand; break;
+ case 26 :pValues[nProp] <<= (short)aDBData.nCommandType; break;
+ case 27 :pValues[nProp] <<= sFilter; break;
+ case 28 :pValues[nProp] <<= aSavedDocuments; break;
+ case 29: pValues[nProp] <<= bIsEMailSupported; break;
+ case 30:
+ {
+ if( bUserSettingWereOverwritten == sal_True )
+ pValues[nProp] <<= bIsGreetingLineInMail_LastUserSetting;
+ else
+ pValues[nProp] <<= bIsGreetingLineInMail;
+ break;
+ }
+ case 31: pValues[nProp] <<= bIsIndividualGreetingLineInMail; break;
+ case 32: pValues[nProp] <<= bIsSMPTAfterPOP; break;
+ case 33: pValues[nProp] <<= sInServerName; break;
+ case 34: pValues[nProp] <<= nInServerPort; break;
+ case 35: pValues[nProp] <<= bInServerPOP; break;
+ case 36: pValues[nProp] <<= sInServerUserName; break;
+ case 37: pValues[nProp] <<= sInServerPassword; break;
+ case 38: pValues[nProp] <<= bIsHideEmptyParagraphs; break;
+ case 39: pValues[nProp] <<= nCurrentAddressBlock; break;
+ }
+ }
+ PutProperties(aNames, aValues);
+ //store the changed / new assignments
+
+ //load the existing node names to find new names
+ Sequence<OUString> aAssignments = GetNodeNames(C2U(cAddressDataAssignments));
+
+ ::std::vector<DBAddressDataAssignment>::iterator aAssignIter;
+ for(aAssignIter = aAddressDataAssignments.begin();
+ aAssignIter != aAddressDataAssignments.end(); aAssignIter++)
+ {
+ if(aAssignIter->bColumnAssignmentsChanged)
+ {
+ //create a new node name
+ OUString sNewNode = aAssignIter->sConfigNodeName.getLength() ?
+ aAssignIter->sConfigNodeName :
+ lcl_CreateNodeName(aAssignments);
+ OUString sSlash = C2U("/");
+ OUString sNodePath = C2U(cAddressDataAssignments);
+ sNodePath += sSlash;
+ sNodePath += sNewNode;
+ sNodePath += sSlash;
+ //only one new entry is written
+ Sequence< PropertyValue > aNewValues(4);
+ PropertyValue* pNewValues = aNewValues.getArray();
+ pNewValues[0].Name = sNodePath;
+ pNewValues[0].Name += C2U(cDataSourceName);
+ pNewValues[0].Value <<= aAssignIter->aDBData.sDataSource;
+ pNewValues[1].Name = sNodePath;
+ pNewValues[1].Name += C2U(cDataTableName);
+ pNewValues[1].Value <<= aAssignIter->aDBData.sCommand;
+ pNewValues[2].Name = sNodePath;
+ pNewValues[2].Name += C2U(cDataCommandType);
+ pNewValues[2].Value <<= aAssignIter->aDBData.nCommandType;
+ pNewValues[3].Name = sNodePath;
+ pNewValues[3].Name += C2U(cDBColumnAssignments);
+ pNewValues[3].Value <<= aAssignIter->aDBColumnAssignments;
+
+ SetSetProperties(C2U(cAddressDataAssignments), aNewValues);
+ }
+ }
+
+ bUserSettingWereOverwritten = sal_False;
+}
+/*-- 06.05.2004 13:04:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const Sequence< ::rtl::OUString> SwMailMergeConfigItem_Impl::GetAddressBlocks(
+ sal_Bool bConvertToConfig) const
+{
+ Sequence< ::rtl::OUString> aRet(aAddressBlocks.size());
+ ::rtl::OUString* pRet = aRet.getArray();
+ for(sal_uInt32 nBlock = 0; nBlock < aAddressBlocks.size(); nBlock++)
+ {
+ pRet[nBlock] = aAddressBlocks[nBlock];
+ if(bConvertToConfig)
+ lcl_ConvertToNumbers(pRet[nBlock], m_AddressHeaderSA);
+ }
+ return aRet;
+}
+/*-- 06.05.2004 13:04:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem_Impl::SetAddressBlocks(
+ const Sequence< ::rtl::OUString>& rBlocks,
+ sal_Bool bConvertFromConfig)
+{
+ aAddressBlocks.clear();
+ for(sal_Int32 nBlock = 0; nBlock < rBlocks.getLength(); nBlock++)
+ {
+ OUString sBlock = rBlocks[nBlock];
+ if(bConvertFromConfig)
+ lcl_ConvertFromNumbers(sBlock, m_AddressHeaderSA);
+ aAddressBlocks.push_back(sBlock);
+ }
+ nCurrentAddressBlock = 0;
+ SetModified();
+}
+/*-- 30.04.2004 11:04:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const Sequence< ::rtl::OUString> SwMailMergeConfigItem_Impl::GetGreetings(
+ SwMailMergeConfigItem::Gender eType, sal_Bool bConvertToConfig) const
+{
+ const ::std::vector< ::rtl::OUString>& rGreetings =
+ eType == SwMailMergeConfigItem::FEMALE ? aFemaleGreetingLines :
+ eType == SwMailMergeConfigItem::MALE ? aMaleGreetingLines :
+ aNeutralGreetingLines;
+ Sequence< ::rtl::OUString> aRet(rGreetings.size());
+ ::rtl::OUString* pRet = aRet.getArray();
+ for(sal_uInt32 nGreeting = 0; nGreeting < rGreetings.size(); nGreeting++)
+ {
+ pRet[nGreeting] = rGreetings[nGreeting];
+ if(bConvertToConfig)
+ lcl_ConvertToNumbers(pRet[nGreeting], m_AddressHeaderSA);
+ }
+ return aRet;
+}
+/*-- 30.04.2004 11:04:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem_Impl::SetGreetings(
+ SwMailMergeConfigItem::Gender eType,
+ const Sequence< ::rtl::OUString>& rSetGreetings,
+ sal_Bool bConvertFromConfig)
+{
+ ::std::vector< ::rtl::OUString>& rGreetings =
+ eType == SwMailMergeConfigItem::FEMALE ? aFemaleGreetingLines :
+ eType == SwMailMergeConfigItem::MALE ? aMaleGreetingLines :
+ aNeutralGreetingLines;
+
+ rGreetings.clear();
+ for(sal_Int32 nGreeting = 0; nGreeting < rSetGreetings.getLength(); nGreeting++)
+ {
+ OUString sGreeting = rSetGreetings[nGreeting];
+ if(bConvertFromConfig)
+ lcl_ConvertFromNumbers(sGreeting, m_AddressHeaderSA);
+ rGreetings.push_back(sGreeting);
+ }
+ SetModified();
+}
+/*-- 11.05.2004 13:13:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwMailMergeConfigItem_Impl::GetCurrentGreeting(
+ SwMailMergeConfigItem::Gender eType) const
+{
+ sal_Int32 nRet;
+ switch(eType)
+ {
+ case SwMailMergeConfigItem::FEMALE: nRet = nCurrentFemaleGreeting ; break;
+ case SwMailMergeConfigItem::MALE: nRet = nCurrentMaleGreeting ; break;
+ default: nRet = nCurrentNeutralGreeting; break;
+ }
+ return nRet;
+}
+/*-- 11.05.2004 13:13:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem_Impl::SetCurrentGreeting(
+ SwMailMergeConfigItem::Gender eType, sal_Int32 nIndex)
+{
+ bool bChanged = false;
+ switch(eType)
+ {
+ case SwMailMergeConfigItem::FEMALE:
+ bChanged = nCurrentFemaleGreeting != nIndex;
+ nCurrentFemaleGreeting = nIndex;
+ break;
+ case SwMailMergeConfigItem::MALE:
+ bChanged = nCurrentMaleGreeting != nIndex;
+ nCurrentMaleGreeting = nIndex;
+ break;
+ default:
+ bChanged = nCurrentNeutralGreeting != nIndex;
+ nCurrentNeutralGreeting = nIndex;
+ }
+ if(bChanged)
+ SetModified();
+}
+
+static SwMailMergeConfigItem_Impl* pOptions = NULL;
+static sal_Int32 nRefCount = 0;
+static ::osl::Mutex aMutex;
+/*-- 15.04.2004 08:42:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeConfigItem::SwMailMergeConfigItem() :
+ m_bAddressInserted(false),
+ m_bMergeDone(false),
+ m_bGreetingInserted(false),
+ m_nGreetingMoves(0),
+ m_nStartPrint(0),
+ m_nEndPrint(0),
+ m_pSourceView(0),
+ m_pTargetView(0)
+{
+ // Global access, must be guarded (multithreading)
+ ::osl::MutexGuard aGuard( aMutex );
+ if ( !pOptions )
+ pOptions = new SwMailMergeConfigItem_Impl;
+ ++nRefCount;
+ m_pImpl = pOptions;
+}
+/*-- 15.04.2004 08:43:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeConfigItem::~SwMailMergeConfigItem()
+{
+ // Global access, must be guarded (multithreading)
+ ::osl::MutexGuard aGuard( aMutex );
+ if ( !--nRefCount )
+ {
+ DELETEZ( pOptions );
+ }
+}
+/*-- 06.05.2004 14:18:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::Commit()
+{
+ if(m_pImpl->IsModified())
+ m_pImpl->Commit();
+}
+/*-- 06.05.2004 12:59:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const ResStringArray& SwMailMergeConfigItem::GetDefaultAddressHeaders() const
+{
+ return m_pImpl->m_AddressHeaderSA;
+}
+/*-- 27.04.2004 14:34:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetAddressBlocks(
+ const Sequence< ::rtl::OUString>& rBlocks)
+{
+ m_pImpl->SetAddressBlocks(rBlocks);
+}
+/*-- 27.04.2004 14:34:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const Sequence< ::rtl::OUString> SwMailMergeConfigItem::GetAddressBlocks() const
+{
+ return m_pImpl->GetAddressBlocks();
+}
+/*-- 11.05.2004 17:08:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeConfigItem::IsAddressBlock()const
+{
+ return m_pImpl->bIsAddressBlock && IsOutputToLetter();
+}
+/*-- 11.05.2004 17:08:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetAddressBlock(sal_Bool bSet)
+{
+ m_pImpl->bUserSettingWereOverwritten = sal_False;
+ if(m_pImpl->bIsAddressBlock != bSet)
+ {
+ m_pImpl->bIsAddressBlock = bSet;
+ m_pImpl->SetModified();
+ }
+}
+
+/*-- 30.08.2005 15:09:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeConfigItem::IsHideEmptyParagraphs() const
+{
+ return m_pImpl->bIsHideEmptyParagraphs;
+}
+/*-- 30.08.2005 15:09:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetHideEmptyParagraphs(sal_Bool bSet)
+{
+ if(m_pImpl->bIsHideEmptyParagraphs != bSet)
+ {
+ m_pImpl->bIsHideEmptyParagraphs = bSet;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 28.04.2004 13:00:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeConfigItem::IsIncludeCountry() const
+{
+ return m_pImpl->bIncludeCountry;
+}
+/*-- 28.04.2004 13:00:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+rtl::OUString& SwMailMergeConfigItem::GetExcludeCountry() const
+{
+ return m_pImpl->sExcludeCountry;
+}
+/*-- 28.04.2004 13:00:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetCountrySettings(sal_Bool bSet, const rtl::OUString& rCountry)
+{
+ if(m_pImpl->sExcludeCountry != rCountry ||
+ m_pImpl->bIncludeCountry != bSet)
+ {
+ m_pImpl->bIncludeCountry = bSet;
+ m_pImpl->sExcludeCountry = bSet ? rCountry : OUString();
+ m_pImpl->SetModified();
+ }
+}
+
+/*-- 28.04.2004 15:35:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetCurrentConnection(
+ Reference< XDataSource> xSource,
+ SharedConnection xConnection,
+ Reference< XColumnsSupplier> xColumnsSupplier,
+ const SwDBData& rDBData)
+{
+ m_pImpl->xSource = xSource ;
+ m_pImpl->xConnection = xConnection ;
+ m_pImpl->xColumnsSupplier = xColumnsSupplier;
+ m_pImpl->aDBData = rDBData;
+ m_pImpl->xResultSet = 0;
+ m_pImpl->nResultSetCursorPos = 0;
+ m_pImpl->SetModified();
+}
+/*-- 28.04.2004 15:38:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XDataSource> SwMailMergeConfigItem::GetSource()
+{
+ return m_pImpl->xSource;
+}
+/*-- 28.04.2004 15:38:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SharedConnection SwMailMergeConfigItem::GetConnection()
+{
+ return m_pImpl->xConnection;
+}
+/*-- 28.04.2004 15:38:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XColumnsSupplier> SwMailMergeConfigItem::GetColumnsSupplier()
+{
+ if(!m_pImpl->xColumnsSupplier.is() && m_pImpl->xConnection.is())
+ {
+ m_pImpl->xColumnsSupplier = SwNewDBMgr::GetColumnSupplier(m_pImpl->xConnection,
+ m_pImpl->aDBData.sCommand,
+ m_pImpl->aDBData.nCommandType == CommandType::TABLE ?
+ SW_DB_SELECT_TABLE : SW_DB_SELECT_QUERY );
+ }
+ return m_pImpl->xColumnsSupplier;
+}
+/*-- 30.04.2004 14:30:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const SwDBData& SwMailMergeConfigItem::GetCurrentDBData() const
+{
+ return m_pImpl->aDBData;
+}
+
+/*-- 17.06.2004 13:18:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetCurrentDBData( const SwDBData& rDBData)
+{
+ if(m_pImpl->aDBData != rDBData)
+ {
+ m_pImpl->aDBData = rDBData;
+ m_pImpl->xConnection.clear();
+ m_pImpl->xSource = 0;
+ m_pImpl->xColumnsSupplier = 0;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 29.04.2004 11:34:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XResultSet> SwMailMergeConfigItem::GetResultSet() const
+{
+ if(!m_pImpl->xConnection.is() && m_pImpl->aDBData.sDataSource.getLength())
+ {
+ m_pImpl->xConnection.reset(
+ SwNewDBMgr::GetConnection( m_pImpl->aDBData.sDataSource, m_pImpl->xSource ),
+ SharedConnection::TakeOwnership
+ );
+ }
+ if(!m_pImpl->xResultSet.is() && m_pImpl->xConnection.is())
+ {
+ try
+ {
+ Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ if( xMgr.is() )
+ {
+ Reference<XRowSet> xRowSet(
+ xMgr->createInstance(C2U("com.sun.star.sdb.RowSet")), UNO_QUERY);
+ Reference<XPropertySet> xRowProperties(xRowSet, UNO_QUERY);
+ xRowProperties->setPropertyValue(C2U("DataSourceName"), makeAny(m_pImpl->aDBData.sDataSource));
+ xRowProperties->setPropertyValue(C2U("Command"), makeAny(m_pImpl->aDBData.sCommand));
+ xRowProperties->setPropertyValue(C2U("CommandType"), makeAny(m_pImpl->aDBData.nCommandType));
+ xRowProperties->setPropertyValue(C2U("FetchSize"), makeAny((sal_Int32)10));
+ xRowProperties->setPropertyValue(C2U("ActiveConnection"), makeAny(m_pImpl->xConnection.getTyped()));
+ try
+ {
+ xRowProperties->setPropertyValue(C2U("ApplyFilter"), makeAny(m_pImpl->sFilter.getLength()>0));
+ xRowProperties->setPropertyValue(C2U("Filter"), makeAny(m_pImpl->sFilter));
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("exception caught in xResultSet->SetFilter()");
+ }
+ xRowSet->execute();
+ m_pImpl->xResultSet = xRowSet.get();
+ m_pImpl->xResultSet->first();
+ m_pImpl->nResultSetCursorPos = 1;
+ }
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("exception caught in: SwMailMergeConfigItem::GetResultSet() ");
+ }
+ }
+ return m_pImpl->xResultSet;
+}
+/*-- 13.08.2004 11:49:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::DisposeResultSet()
+{
+ m_pImpl->xConnection.clear();
+ if(m_pImpl->xResultSet.is())
+ {
+ ::comphelper::disposeComponent( m_pImpl->xResultSet );
+ }
+}
+/*-- 14.05.2004 15:07:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString& SwMailMergeConfigItem::GetFilter() const
+{
+ return m_pImpl->sFilter;
+}
+/*-- 14.05.2004 15:07:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetFilter(::rtl::OUString& rFilter)
+{
+ if(m_pImpl->sFilter != rFilter)
+ {
+ m_pImpl->sFilter = rFilter;
+ m_pImpl->SetModified();
+ Reference<XPropertySet> xRowProperties(m_pImpl->xResultSet, UNO_QUERY);
+ if(xRowProperties.is())
+ {
+ try
+ {
+ xRowProperties->setPropertyValue(C2U("ApplyFilter"), makeAny(m_pImpl->sFilter.getLength()>0));
+ xRowProperties->setPropertyValue(C2U("Filter"), makeAny(m_pImpl->sFilter));
+ uno::Reference<XRowSet> xRowSet( m_pImpl->xResultSet, UNO_QUERY_THROW );
+ xRowSet->execute();
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("exception caught in SwMailMergeConfigItem::SetFilter()");
+ }
+ }
+ }
+}
+/*-- 29.04.2004 11:55:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwMailMergeConfigItem::MoveResultSet(sal_Int32 nTarget)
+{
+ if(!m_pImpl->xResultSet.is())
+ GetResultSet();
+ if(m_pImpl->xResultSet.is())
+ {
+ try
+ {
+ //no action if the resultset is already at the right position
+ if(m_pImpl->xResultSet->getRow() != nTarget)
+ {
+ if(nTarget > 0)
+ {
+ BOOL bMoved = m_pImpl->xResultSet->absolute(nTarget);
+ if(!bMoved)
+ {
+ if(nTarget > 1)
+ m_pImpl->xResultSet->last();
+ else if(nTarget == 1)
+ m_pImpl->xResultSet->first();
+ }
+ }
+ else if(nTarget == -1)
+ m_pImpl->xResultSet->last();
+ m_pImpl->nResultSetCursorPos = m_pImpl->xResultSet->getRow();
+ }
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ return m_pImpl->nResultSetCursorPos;
+}
+
+/*-- 27.05.2004 13:56:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwMailMergeConfigItem::IsResultSetFirstLast(bool& bIsFirst, bool& bIsLast)
+{
+ bool bRet = false;
+ if(!m_pImpl->xResultSet.is())
+ GetResultSet();
+ if(m_pImpl->xResultSet.is())
+ {
+ try
+ {
+ bIsFirst = m_pImpl->xResultSet->isFirst();
+ bIsLast = m_pImpl->xResultSet->isLast();
+ bRet = true;
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ return bRet;
+}
+/*-- 29.04.2004 11:55:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwMailMergeConfigItem::GetResultSetPosition() const
+{
+ return m_pImpl->nResultSetCursorPos;
+}
+/*-- 27.05.2004 14:49:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwMailMergeConfigItem::IsRecordExcluded(sal_Int32 nRecord)
+{
+ bool bRet = false;
+ if(nRecord > 0 && nRecord < m_aSelection.getLength())
+ {
+ sal_Int32 nTemp = 0;
+ m_aSelection[nRecord - 1] >>= nTemp;
+ bRet = nTemp < 1;
+ }
+ return bRet;
+}
+/*-- 27.05.2004 14:49:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::ExcludeRecord(sal_Int32 nRecord, bool bExclude)
+{
+ //nRecord is based on 1
+ //the selection array contains Anys for all records
+ //excluded records contain a '-1'
+ if(!m_aSelection.getLength() || nRecord > m_aSelection.getLength())
+ {
+ if(bExclude)
+ {
+ //if no selection array is available we need to create one containing the
+ //entries for all available records
+ if(!m_pImpl->xResultSet.is())
+ GetResultSet();
+ if(m_pImpl->xResultSet.is())
+ {
+ m_pImpl->xResultSet->last();
+ sal_Int32 nEnd = m_pImpl->xResultSet->getRow();
+ sal_Int32 nStart = m_aSelection.getLength();
+ m_aSelection.realloc(nEnd);
+ Any* pSelection = m_aSelection.getArray();
+ for(sal_Int32 nIndex = nStart; nIndex < nEnd; ++nIndex)
+ {
+ if((nRecord - 1) != nIndex)
+ pSelection[nIndex] <<= nIndex + 1;
+ else
+ pSelection[nIndex] <<= (sal_Int32) -1;
+ }
+ }
+ }
+ }
+ else
+ {
+ if(nRecord > 0 && m_aSelection.getLength() > nRecord)
+ {
+ m_aSelection[nRecord - 1] <<= bExclude ? -1 : nRecord;
+ }
+ }
+}
+/*-- 27.05.2004 15:08:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< Any > SwMailMergeConfigItem::GetSelection() const
+{
+ Sequence< Any > aRet(m_aSelection.getLength());
+ sal_Int32 nRetIndex = 0;
+ sal_Int32 nRet;
+ for(sal_Int32 nIndex = 0; nIndex < m_aSelection.getLength(); ++nIndex)
+ {
+ m_aSelection[nIndex] >>= nRet;
+ if(nRet > 0)
+ {
+ aRet[nRetIndex] <<= nRet;
+ ++nRetIndex;
+ }
+ }
+ aRet.realloc(nRetIndex);
+ return aRet;
+}
+/*-- 16.06.2004 15:15:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const uno::Sequence< ::rtl::OUString>&
+ SwMailMergeConfigItem::GetSavedDocuments() const
+{
+ return m_pImpl->aSavedDocuments;
+}
+/*-- 16.06.2004 15:15:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::AddSavedDocument(::rtl::OUString rName)
+{
+ const ::rtl::OUString* pDocs = m_pImpl->aSavedDocuments.getConstArray();
+ bool bFound = false;
+ for(sal_Int32 nDoc = 0; nDoc < m_pImpl->aSavedDocuments.getLength(); ++nDoc)
+ {
+ if(pDocs[nDoc] == rName)
+ {
+ bFound = true;
+ break;
+ }
+ }
+ if(!bFound)
+ {
+ m_pImpl->aSavedDocuments.realloc(m_pImpl->aSavedDocuments.getLength() + 1);
+ m_pImpl->aSavedDocuments[m_pImpl->aSavedDocuments.getLength() - 1] = rName;
+ }
+}
+/*-- 28.04.2004 16:15:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeConfigItem::IsOutputToLetter()const
+{
+ return m_pImpl->bIsOutputToLetter || !IsMailAvailable();
+}
+/*-- 28.04.2004 16:15:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetOutputToLetter(sal_Bool bSet)
+{
+ if(m_pImpl->bIsOutputToLetter != bSet)
+ {
+ m_pImpl->bIsOutputToLetter = bSet;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 30.04.2004 10:51:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeConfigItem::IsIndividualGreeting(sal_Bool bInEMail) const
+{
+ return bInEMail ?
+ m_pImpl->bIsIndividualGreetingLineInMail :
+ m_pImpl->bIsIndividualGreetingLine;
+}
+/*-- 30.04.2004 10:51:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetIndividualGreeting(
+ sal_Bool bSet, sal_Bool bInEMail)
+{
+ if(bInEMail)
+ {
+ if(m_pImpl->bIsIndividualGreetingLineInMail != bSet)
+ {
+ m_pImpl->bIsIndividualGreetingLineInMail = bSet;
+ m_pImpl->SetModified();
+ }
+ }
+ else
+ {
+ if(m_pImpl->bIsIndividualGreetingLine != bSet)
+ {
+ m_pImpl->bIsIndividualGreetingLine = bSet;
+ m_pImpl->SetModified();
+ }
+ }
+}
+/*-- 30.04.2004 10:51:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeConfigItem::IsGreetingLine(sal_Bool bInEMail) const
+{
+ return bInEMail ? m_pImpl->bIsGreetingLineInMail : m_pImpl->bIsGreetingLine;
+}
+/*-- 30.04.2004 10:51:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetGreetingLine(sal_Bool bSet, sal_Bool bInEMail)
+{
+ m_pImpl->bUserSettingWereOverwritten = sal_False;
+ if(bInEMail)
+ {
+ if(m_pImpl->bIsGreetingLineInMail != bSet)
+ {
+ m_pImpl->bIsGreetingLineInMail = bSet;
+ m_pImpl->SetModified();
+ }
+ }
+ else
+ {
+ if(m_pImpl->bIsGreetingLine != bSet)
+ {
+ m_pImpl->bIsGreetingLine = bSet;
+ m_pImpl->SetModified();
+ }
+ }
+}
+/*-- 30.04.2004 11:04:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const Sequence< ::rtl::OUString> SwMailMergeConfigItem::GetGreetings(
+ Gender eType ) const
+{
+ return m_pImpl->GetGreetings(eType);
+}
+/*-- 30.04.2004 11:04:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetGreetings(
+ Gender eType, const Sequence< ::rtl::OUString>& rSetGreetings)
+{
+ m_pImpl->SetGreetings( eType, rSetGreetings);
+}
+
+/*-- 11.05.2004 13:10:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwMailMergeConfigItem::GetCurrentGreeting(
+ SwMailMergeConfigItem::Gender eType) const
+{
+ return m_pImpl->GetCurrentGreeting(eType);
+}
+/*-- 11.05.2004 13:10:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetCurrentGreeting(Gender eType, sal_Int32 nIndex)
+{
+ m_pImpl->SetCurrentGreeting(eType, nIndex);
+}
+/*-- 12.05.2004 12:29:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+const ::rtl::OUString& SwMailMergeConfigItem::GetFemaleGenderValue() const
+{
+ return m_pImpl->sFemaleGenderValue;
+}
+/*-- 12.05.2004 12:29:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetFemaleGenderValue(const ::rtl::OUString rValue)
+{
+ if( m_pImpl->sFemaleGenderValue != rValue )
+ {
+ m_pImpl->sFemaleGenderValue = rValue;
+ m_pImpl->SetModified();
+ }
+}
+
+/*-- 30.04.2004 13:25:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< ::rtl::OUString> SwMailMergeConfigItem::GetColumnAssignment(
+ const SwDBData& rDBData ) const
+{
+ Sequence< ::rtl::OUString> aRet;
+ ::std::vector<DBAddressDataAssignment>::iterator aAssignIter;
+ for(aAssignIter = m_pImpl->aAddressDataAssignments.begin();
+ aAssignIter != m_pImpl->aAddressDataAssignments.end(); aAssignIter++)
+ {
+ if(aAssignIter->aDBData == rDBData)
+ {
+ aRet = aAssignIter->aDBColumnAssignments;
+ break;
+ }
+ }
+ return aRet;
+}
+/*-- 21.05.2004 12:31:31---------------------------------------------------
+ returns the name that is assigned as e-mail column of the current data base
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwMailMergeConfigItem::GetAssignedColumn(sal_uInt32 nColumn) const
+{
+ ::rtl::OUString sRet;
+ Sequence< ::rtl::OUString> aAssignment = GetColumnAssignment( m_pImpl->aDBData );
+ if(aAssignment.getLength() > sal::static_int_cast< sal_Int32, sal_uInt32>(nColumn) && aAssignment[nColumn].getLength())
+ sRet = aAssignment[nColumn];
+ else if(nColumn < m_pImpl->m_AddressHeaderSA.Count())
+ sRet = m_pImpl->m_AddressHeaderSA.GetString(nColumn);
+ return sRet;
+}
+/*-- 30.04.2004 13:25:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetColumnAssignment( const SwDBData& rDBData,
+ const Sequence< ::rtl::OUString>& rList)
+{
+ ::std::vector<DBAddressDataAssignment>::iterator aAssignIter;
+ sal_Bool bFound = sal_False;
+ for(aAssignIter = m_pImpl->aAddressDataAssignments.begin();
+ aAssignIter != m_pImpl->aAddressDataAssignments.end(); aAssignIter++)
+ {
+ if(aAssignIter->aDBData == rDBData)
+ {
+ if(aAssignIter->aDBColumnAssignments != rList)
+ {
+ aAssignIter->aDBColumnAssignments = rList;
+ aAssignIter->bColumnAssignmentsChanged = true;
+ }
+ bFound = sal_True;
+ break;
+ }
+ }
+ if(!bFound)
+ {
+ DBAddressDataAssignment aAssignment;
+ aAssignment.aDBData = rDBData;
+ aAssignment.aDBColumnAssignments = rList;
+ aAssignment.bColumnAssignmentsChanged = true;
+ m_pImpl->aAddressDataAssignments.push_back(aAssignment);
+ }
+ m_pImpl->SetModified();
+}
+
+/*-- 07.09.2005 11:50:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwMailMergeConfigItem::IsAddressFieldsAssigned() const
+{
+ bool bResult = true;
+ Reference< XResultSet> xResultSet = GetResultSet();
+ uno::Reference< XColumnsSupplier > xColsSupp( xResultSet, UNO_QUERY );
+ if(!xColsSupp.is())
+ return false;
+ uno::Reference<container::XNameAccess> xCols = xColsSupp->getColumns();
+
+ const ResStringArray& rHeaders = GetDefaultAddressHeaders();
+ Sequence< ::rtl::OUString> aAssignment =
+ GetColumnAssignment( GetCurrentDBData() );
+ const ::rtl::OUString* pAssignment = aAssignment.getConstArray();
+ const Sequence< ::rtl::OUString> aBlocks = GetAddressBlocks();
+
+ if(aBlocks.getLength() <= m_pImpl->GetCurrentAddressBlockIndex())
+ return false;
+ SwAddressIterator aIter(aBlocks[m_pImpl->GetCurrentAddressBlockIndex()]);
+ while(aIter.HasMore())
+ {
+ SwMergeAddressItem aItem = aIter.Next();
+ if(aItem.bIsColumn)
+ {
+ String sConvertedColumn = aItem.sText;
+ for(USHORT nColumn = 0;
+ nColumn < rHeaders.Count() && nColumn < aAssignment.getLength();
+ ++nColumn)
+ {
+ if(rHeaders.GetString(nColumn) == aItem.sText &&
+ pAssignment[nColumn].getLength())
+ {
+ sConvertedColumn = pAssignment[nColumn];
+ break;
+ }
+ }
+ //find out if the column exists in the data base
+ if(!xCols->hasByName(sConvertedColumn))
+ {
+ bResult = false;
+ break;
+ }
+ }
+ }
+ return bResult;
+}
+/*-- 07.09.2005 11:50:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwMailMergeConfigItem::IsGreetingFieldsAssigned() const
+{
+ bool bResult = true;
+
+ if(!IsIndividualGreeting(sal_False))
+ return true;
+
+ Reference< XResultSet> xResultSet = GetResultSet();
+ uno::Reference< XColumnsSupplier > xColsSupp( xResultSet, UNO_QUERY );
+ if(!xColsSupp.is())
+ return false;
+ const ResStringArray& rHeaders = GetDefaultAddressHeaders();
+ uno::Reference<container::XNameAccess> xCols = xColsSupp->getColumns();
+
+ Sequence< ::rtl::OUString> aAssignment =
+ GetColumnAssignment( GetCurrentDBData() );
+ const ::rtl::OUString* pAssignment = aAssignment.getConstArray();
+
+ const Sequence< ::rtl::OUString> rFemaleEntries = GetGreetings(SwMailMergeConfigItem::FEMALE);
+ sal_Int32 nCurrentFemale = GetCurrentGreeting(SwMailMergeConfigItem::FEMALE);
+ const Sequence< ::rtl::OUString> rMaleEntries = GetGreetings(SwMailMergeConfigItem::MALE);
+ sal_Int32 nCurrentMale = GetCurrentGreeting(SwMailMergeConfigItem::MALE);
+ ::rtl::OUString sMale, sFemale;
+ if(rFemaleEntries.getLength() > nCurrentFemale)
+ sFemale = rFemaleEntries[nCurrentFemale];
+ if(rMaleEntries.getLength() > nCurrentMale)
+ sMale = rMaleEntries[nCurrentMale];
+
+ ::rtl::OUString sAddress( sFemale );
+ sAddress += sMale;
+ SwAddressIterator aIter(sAddress);
+ while(aIter.HasMore())
+ {
+ SwMergeAddressItem aItem = aIter.Next();
+ if(aItem.bIsColumn)
+ {
+ String sConvertedColumn = aItem.sText;
+ for(USHORT nColumn = 0;
+ nColumn < rHeaders.Count() && nColumn < aAssignment.getLength();
+ ++nColumn)
+ {
+ if(rHeaders.GetString(nColumn) == aItem.sText &&
+ pAssignment[nColumn].getLength())
+ {
+ sConvertedColumn = pAssignment[nColumn];
+ break;
+ }
+ }
+ //find out if the column exists in the data base
+ if(!xCols->hasByName(sConvertedColumn))
+ {
+ bResult = false;
+ break;
+ }
+ }
+ }
+ return bResult;
+}
+/*-- 05.05.2004 16:10:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwMailMergeConfigItem::GetMailDisplayName() const
+{
+ return m_pImpl->sMailDisplayName;
+}
+/*-- 05.05.2004 16:10:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetMailDisplayName(const ::rtl::OUString& rName)
+{
+ if(m_pImpl->sMailDisplayName != rName)
+ {
+ m_pImpl->sMailDisplayName = rName;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 05.05.2004 16:10:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwMailMergeConfigItem::GetMailAddress() const
+{
+ return m_pImpl->sMailAddress;
+}
+/*-- 05.05.2004 16:10:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetMailAddress(const ::rtl::OUString& rAddress)
+{
+ if(m_pImpl->sMailAddress != rAddress )
+ {
+ m_pImpl->sMailAddress = rAddress;
+ m_pImpl->SetModified();
+ }
+}
+
+/*-- 07.05.2004 12:40:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeConfigItem::IsMailReplyTo() const
+{
+ return m_pImpl->bIsMailReplyTo;
+}
+/*-- 07.05.2004 12:40:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetMailReplyTo(sal_Bool bSet)
+{
+ if(m_pImpl->bIsMailReplyTo != bSet)
+ {
+ m_pImpl->bIsMailReplyTo = bSet;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 05.05.2004 16:10:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwMailMergeConfigItem::GetMailReplyTo() const
+{
+ return m_pImpl->sMailReplyTo;
+}
+/*-- 05.05.2004 16:10:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetMailReplyTo(const ::rtl::OUString& rReplyTo)
+{
+ if(m_pImpl->sMailReplyTo != rReplyTo)
+ {
+ m_pImpl->sMailReplyTo = rReplyTo;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 05.05.2004 16:10:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwMailMergeConfigItem::GetMailServer() const
+{
+ return m_pImpl->sMailServer;
+}
+/*-- 05.05.2004 16:10:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetMailServer(const ::rtl::OUString& rAddress)
+{
+ if(m_pImpl->sMailServer != rAddress)
+ {
+ m_pImpl->sMailServer = rAddress;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 05.05.2004 16:10:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int16 SwMailMergeConfigItem::GetMailPort() const
+{
+ return m_pImpl->bIsDefaultPort ?
+ (m_pImpl->bIsSecureConnection ? SECURE_PORT : DEFAULT_PORT) :
+ m_pImpl->nMailPort;
+}
+/*-- 05.05.2004 16:10:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetMailPort(sal_Int16 nSet)
+{
+ if(m_pImpl->nMailPort != nSet || m_pImpl->bIsDefaultPort)
+ {
+ m_pImpl->nMailPort = nSet;
+ m_pImpl->bIsDefaultPort = sal_False;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 05.05.2004 16:10:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeConfigItem::IsSecureConnection() const
+{
+ return m_pImpl->bIsSecureConnection;
+}
+/*-- 05.05.2004 16:10:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetSecureConnection(sal_Bool bSet)
+{
+ if(m_pImpl->bIsSecureConnection != bSet)
+ {
+ m_pImpl->bIsSecureConnection = bSet;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 05.05.2004 16:10:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeConfigItem::IsAuthentication() const
+{
+ return m_pImpl->bIsAuthentication;
+}
+/*-- 05.05.2004 16:10:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetAuthentication(sal_Bool bSet)
+{
+ if(m_pImpl->bIsAuthentication != bSet)
+ {
+ m_pImpl->bIsAuthentication = bSet;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 05.05.2004 16:10:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwMailMergeConfigItem::GetMailUserName() const
+{
+ return m_pImpl->sMailUserName;
+}
+/*-- 05.05.2004 16:10:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetMailUserName(const ::rtl::OUString& rName)
+{
+ if(m_pImpl->sMailUserName != rName)
+ {
+ m_pImpl->sMailUserName = rName;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 05.05.2004 16:10:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwMailMergeConfigItem::GetMailPassword() const
+{
+ return m_pImpl->sMailPassword;
+}
+/*-- 05.05.2004 16:10:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetMailPassword(const ::rtl::OUString& rPassword)
+{
+ if(m_pImpl->sMailPassword != rPassword)
+ {
+ m_pImpl->sMailPassword = rPassword;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 19.08.2004 14:44:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeConfigItem::IsSMTPAfterPOP() const
+{
+ return m_pImpl->bIsSMPTAfterPOP;
+}
+/*-- 19.08.2004 14:44:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetSMTPAfterPOP(sal_Bool bSet)
+{
+ if( m_pImpl->bIsSMPTAfterPOP != bSet)
+ {
+ m_pImpl->bIsSMPTAfterPOP = bSet;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 19.08.2004 14:44:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwMailMergeConfigItem::GetInServerName() const
+{
+ return m_pImpl->sInServerName;
+}
+/*-- 19.08.2004 14:44:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetInServerName(const ::rtl::OUString& rServer)
+{
+ if(m_pImpl->sInServerName != rServer)
+ {
+ m_pImpl->sInServerName = rServer;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 19.08.2004 14:44:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int16 SwMailMergeConfigItem::GetInServerPort() const
+{
+ return m_pImpl->nInServerPort;
+}
+/*-- 19.08.2004 14:44:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetInServerPort(sal_Int16 nSet)
+{
+ if( m_pImpl->nInServerPort != nSet)
+ {
+ m_pImpl->nInServerPort = nSet;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 20.08.2004 08:52:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeConfigItem::IsInServerPOP() const
+{
+ return m_pImpl->bInServerPOP;
+}
+/*-- 20.08.2004 08:52:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetInServerPOP(sal_Bool bSet)
+{
+ if( m_pImpl->bInServerPOP != bSet)
+ {
+ m_pImpl->bInServerPOP = bSet;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 19.08.2004 14:44:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwMailMergeConfigItem::GetInServerUserName() const
+{
+ return m_pImpl->sInServerUserName;
+}
+/*-- 19.08.2004 14:44:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetInServerUserName(const ::rtl::OUString& rName)
+{
+ if( m_pImpl->sInServerUserName != rName)
+ {
+ m_pImpl->sInServerUserName = rName;
+ m_pImpl->SetModified();
+ }
+}
+/*-- 19.08.2004 14:44:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwMailMergeConfigItem::GetInServerPassword() const
+{
+ return m_pImpl->sInServerPassword;
+}
+/*-- 19.08.2004 14:45:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetInServerPassword(const ::rtl::OUString& rPassword)
+{
+ if(m_pImpl->sInServerPassword != rPassword)
+ {
+ m_pImpl->sInServerPassword = rPassword;
+ m_pImpl->SetModified();
+ }
+}
+
+/*-- 02.09.2004 14:43:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::DocumentReloaded()
+{
+ m_bMergeDone = false;
+ m_bGreetingInserted = false;
+ m_bAddressInserted = false;
+ m_rAddressBlockFrame = ::rtl::OUString();
+}
+/*-- 16.06.2004 12:24:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwMailMergeConfigItem::IsMailAvailable() const
+{
+ return m_pImpl->bIsEMailSupported;
+}
+/*-- 21.05.2004 12:20:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::AddMergedDocument(SwDocMergeInfo& rInfo)
+{
+ m_pImpl->aMergeInfos.push_back(rInfo);
+}
+/*-- 21.05.2004 12:20:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwDocMergeInfo& SwMailMergeConfigItem::GetDocumentMergeInfo(sal_uInt32 nDocument)
+{
+ DBG_ASSERT(m_pImpl->aMergeInfos.size() > nDocument,"invalid document index");
+ return m_pImpl->aMergeInfos[nDocument];
+}
+/*-- 14.06.2004 11:46:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_uInt32 SwMailMergeConfigItem::GetMergedDocumentCount() const
+{
+ return m_pImpl->aMergeInfos.size();
+}
+/*-- 11.06.2004 10:38:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwView* lcl_ExistsView(SwView* pView)
+{
+ const TypeId aType(TYPE(SwView));
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst( &aType, FALSE );
+ while(pViewShell)
+ {
+ if(pViewShell == pView)
+ return pView;
+
+ pViewShell = SfxViewShell::GetNext( *pViewShell, &aType, FALSE );
+ }
+ return 0;
+}
+/*-- 16.06.2004 15:02:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwView* SwMailMergeConfigItem::GetTargetView()
+{
+ //make sure that the pointer is really valid - the document may have been closed manually
+ if(m_pTargetView)
+ {
+ m_pTargetView = lcl_ExistsView(m_pTargetView);
+ }
+ return m_pTargetView;
+}
+/*-- 02.09.2004 17:04:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetTargetView(SwView* pView)
+{
+ m_pTargetView = pView;
+ //reset the document merge counter
+ if(!m_pTargetView)
+ {
+ m_pImpl->aMergeInfos.clear();
+ }
+}
+/*-- 16.06.2004 15:02:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwView* SwMailMergeConfigItem::GetSourceView()
+{
+ m_pSourceView = lcl_ExistsView(m_pSourceView);
+ return m_pSourceView;
+}
+
+/*-- 04.11.2004 19:53 ---------------------------------------------------
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetSourceView(SwView* pView)
+{
+ m_pSourceView = pView;
+
+ if(pView)
+ {
+ SvStringsDtor aDBNameList(5, 1);
+ SvStringsDtor aAllDBNames(5, 5);
+ pView->GetWrtShell().GetAllUsedDB( aDBNameList, &aAllDBNames );
+ if(aDBNameList.Count())
+ {
+ // if fields are available there is usually no need of an addressblock and greeting
+ if(!m_pImpl->bUserSettingWereOverwritten)
+ {
+ if( m_pImpl->bIsAddressBlock == sal_True
+ || m_pImpl->bIsGreetingLineInMail == sal_True
+ || m_pImpl->bIsGreetingLine == sal_True )
+ {
+ //store user settings
+ m_pImpl->bUserSettingWereOverwritten = sal_True;
+ m_pImpl->bIsAddressBlock_LastUserSetting = m_pImpl->bIsAddressBlock;
+ m_pImpl->bIsGreetingLineInMail_LastUserSetting = m_pImpl->bIsGreetingLineInMail;
+ m_pImpl->bIsGreetingLine_LastUserSetting = m_pImpl->bIsGreetingLine;
+
+ //set all to false
+ m_pImpl->bIsAddressBlock = sal_False;
+ m_pImpl->bIsGreetingLineInMail = sal_False;
+ m_pImpl->bIsGreetingLine = sal_False;
+
+ m_pImpl->SetModified();
+ }
+ }
+ }
+ else if( m_pImpl->bUserSettingWereOverwritten )
+ {
+ //restore last user settings:
+ m_pImpl->bIsAddressBlock = m_pImpl->bIsAddressBlock_LastUserSetting;
+ m_pImpl->bIsGreetingLineInMail = m_pImpl->bIsGreetingLineInMail_LastUserSetting;
+ m_pImpl->bIsGreetingLine = m_pImpl->bIsGreetingLine_LastUserSetting;
+
+ m_pImpl->bUserSettingWereOverwritten = sal_False;
+ }
+ }
+}
+
+/*-- 13.03.2006 12:15:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeConfigItem::SetCurrentAddressBlockIndex( sal_Int32 nSet )
+{
+ m_pImpl->SetCurrentAddressBlockIndex( nSet );
+}
+/*-- 13.03.2006 12:15:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwMailMergeConfigItem::GetCurrentAddressBlockIndex() const
+{
+ return m_pImpl->GetCurrentAddressBlockIndex();
+}
diff --git a/sw/source/ui/dbui/mmdocselectpage.cxx b/sw/source/ui/dbui/mmdocselectpage.cxx
new file mode 100644
index 000000000000..e125b4f8ed2e
--- /dev/null
+++ b/sw/source/ui/dbui/mmdocselectpage.cxx
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <unotools/pathoptions.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/new.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/docfac.hxx>
+#include <vcl/msgbox.hxx>
+#include <view.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <mmdocselectpage.hxx>
+#include <mailmergewizard.hxx>
+#include <shellio.hxx>
+#include <swabstdlg.hxx>
+#include <mmconfigitem.hxx>
+
+#include <dbui.hrc>
+#include <mmdocselectpage.hrc>
+
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace svt;
+
+/*-- 02.04.2004 09:40:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeDocSelectPage::SwMailMergeDocSelectPage( SwMailMergeWizard* _pParent ) :
+ svt::OWizardPage(_pParent, SW_RES(DLG_MM_DOCSELECT_PAGE)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aHeaderFI(this, SW_RES( FI_HEADER ) ),
+ m_aHowToFT (this, SW_RES( FT_HOWTO )),
+ m_aCurrentDocRB (this, SW_RES( RB_CURRENTDOC )),
+ m_aNewDocRB (this, SW_RES( RB_NEWDOC )),
+ m_aLoadDocRB (this, SW_RES( RB_LOADDOC )),
+ m_aLoadTemplateRB (this, SW_RES( RB_LOADTEMPLATE )),
+ m_aRecentDocRB (this, SW_RES( RB_RECENTDOC )),
+ m_aBrowseDocPB (this, SW_RES( PB_LOADDOC )),
+ m_aBrowseTemplatePB (this, SW_RES( PB_BROWSETEMPLATE )),
+ m_aRecentDocLB (this, SW_RES( LB_RECENTDOC )),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_pWizard(_pParent)
+{
+ FreeResource();
+
+ m_aCurrentDocRB.Check();
+ DocSelectHdl(&m_aNewDocRB);
+
+ Link aDocSelectLink = LINK(this, SwMailMergeDocSelectPage, DocSelectHdl);
+ m_aCurrentDocRB.SetClickHdl(aDocSelectLink);
+ m_aNewDocRB.SetClickHdl(aDocSelectLink);
+ m_aLoadDocRB.SetClickHdl(aDocSelectLink);
+ m_aLoadTemplateRB.SetClickHdl(aDocSelectLink);
+ m_aRecentDocRB.SetClickHdl(aDocSelectLink);
+
+ Link aFileSelectHdl = LINK(this, SwMailMergeDocSelectPage, FileSelectHdl);
+ m_aBrowseDocPB.SetClickHdl(aFileSelectHdl);
+ m_aBrowseTemplatePB.SetClickHdl(aFileSelectHdl);
+
+ const uno::Sequence< ::rtl::OUString >& rDocs =
+ m_pWizard->GetConfigItem().GetSavedDocuments();
+ for(sal_Int32 nDoc = 0; nDoc < rDocs.getLength(); ++nDoc)
+ {
+ //insert in reverse order
+ m_aRecentDocLB.InsertEntry(rDocs[nDoc], 0);
+ }
+ m_aRecentDocLB.SelectEntryPos(0);
+ if(!rDocs.getLength())
+ {
+ m_aRecentDocRB.Enable(sal_False);
+ }
+}
+
+/*-- 02.04.2004 09:40:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeDocSelectPage::~SwMailMergeDocSelectPage()
+{
+}
+
+/*-- 05.04.2004 14:21:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeDocSelectPage, DocSelectHdl, RadioButton*, pButton)
+{
+ m_aRecentDocLB.Enable(&m_aRecentDocRB == pButton);
+
+ m_pWizard->UpdateRoadmap();
+ m_pWizard->enableButtons(WZB_NEXT, m_pWizard->isStateEnabled(MM_OUTPUTTYPETPAGE));
+
+ return 0;
+}
+/*-- 05.04.2004 14:25:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeDocSelectPage, FileSelectHdl, PushButton*, pButton)
+{
+ bool bTemplate = &m_aBrowseTemplatePB == pButton;
+
+ if(bTemplate)
+ {
+ m_aLoadTemplateRB.Check();
+ SfxNewFileDialog* pNewFileDlg = new SfxNewFileDialog(this, 0);
+ //pNewFileDlg->SetTemplateFlags(nFlags);
+ USHORT nRet = pNewFileDlg->Execute();
+ if(RET_TEMPLATE_LOAD == nRet)
+ bTemplate = false;
+ else if(RET_CANCEL != nRet)
+ m_sLoadTemplateName = pNewFileDlg->GetTemplateFileName();
+ delete pNewFileDlg;
+ }
+ else
+ m_aLoadDocRB.Check();
+
+ if(!bTemplate)
+ {
+ sfx2::FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 );
+ Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+
+ xFP->setDisplayDirectory( SvtPathOptions().GetWorkPath() );
+
+ SfxObjectFactory &rFact = m_pWizard->GetSwView()->GetDocShell()->GetFactory();
+ SfxFilterMatcher aMatcher( String::CreateFromAscii(rFact.GetShortName()) );
+ SfxFilterMatcherIter aIter( &aMatcher );
+ Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
+ const SfxFilter* pFlt = aIter.First();
+ while( pFlt )
+ {
+ if( pFlt && pFlt->IsAllowedAsTemplate() )
+ {
+ const String sWild = ((WildCard&)pFlt->GetWildcard()).GetWildCard();
+ xFltMgr->appendFilter( pFlt->GetUIName(), sWild );
+
+ // #i40125
+ if(pFlt->GetFilterFlags() & SFX_FILTER_DEFAULT)
+ xFltMgr->setCurrentFilter( pFlt->GetUIName() ) ;
+ }
+
+
+ pFlt = aIter.Next();
+ }
+
+ if( ERRCODE_NONE == aDlgHelper.Execute() )
+ {
+ m_sLoadFileName = xFP->getFiles().getConstArray()[0];
+ }
+ }
+ m_pWizard->UpdateRoadmap();
+ m_pWizard->enableButtons(WZB_NEXT, m_pWizard->isStateEnabled(MM_OUTPUTTYPETPAGE));
+
+ return 0;
+}
+
+/*-- 06.04.2004 12:52:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeDocSelectPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason )
+{
+ sal_Bool bReturn = sal_False;
+ bool bNext = _eReason == ::svt::WizardTypes::eTravelForward;
+ if(bNext || _eReason == ::svt::WizardTypes::eValidate )
+ {
+ ::rtl::OUString sReloadDocument;
+ bReturn = m_aCurrentDocRB.IsChecked() ||
+ m_aNewDocRB.IsChecked() ||
+ ((sReloadDocument = m_sLoadFileName).getLength() && m_aLoadDocRB.IsChecked() )||
+ ((sReloadDocument = m_sLoadTemplateName).getLength() && m_aLoadTemplateRB.IsChecked())||
+ (m_aRecentDocRB.IsChecked() && (sReloadDocument = m_aRecentDocLB.GetSelectEntry()).getLength());
+ if( _eReason == ::svt::WizardTypes::eValidate )
+ m_pWizard->SetDocumentLoad(!m_aCurrentDocRB.IsChecked());
+
+ if(bNext && !m_aCurrentDocRB.IsChecked())
+ {
+ if(sReloadDocument.getLength())
+ m_pWizard->SetReloadDocument( sReloadDocument );
+ m_pWizard->SetRestartPage(MM_OUTPUTTYPETPAGE);
+ m_pWizard->EndDialog(RET_LOAD_DOC);
+ }
+ }
+ return bReturn;
+}
diff --git a/sw/source/ui/dbui/mmdocselectpage.hrc b/sw/source/ui/dbui/mmdocselectpage.hrc
new file mode 100644
index 000000000000..f3c5698214ff
--- /dev/null
+++ b/sw/source/ui/dbui/mmdocselectpage.hrc
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FT_HOWTO 1
+#define RB_CURRENTDOC 2
+#define RB_NEWDOC 3
+#define RB_LOADDOC 4
+#define PB_LOADDOC 5
+#define RB_LOADTEMPLATE 6
+#define PB_BROWSETEMPLATE 7
+#define RB_RECENTDOC 8
+#define LB_RECENTDOC 9
+#define FI_HEADER 10
diff --git a/sw/source/ui/dbui/mmdocselectpage.hxx b/sw/source/ui/dbui/mmdocselectpage.hxx
new file mode 100644
index 000000000000..6483025f88ed
--- /dev/null
+++ b/sw/source/ui/dbui/mmdocselectpage.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEDOCSELECTPAGE_HXX
+#define _MAILMERGEDOCSELECTPAGE_HXX
+
+#include <svtools/wizardmachine.hxx>
+#include <mailmergehelper.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+class SwMailMergeWizard;
+/*-- 02.04.2004 09:21:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailMergeDocSelectPage : public svt::OWizardPage
+{
+ SwBoldFixedInfo m_aHeaderFI;
+ FixedInfo m_aHowToFT;
+ RadioButton m_aCurrentDocRB;
+ RadioButton m_aNewDocRB;
+ RadioButton m_aLoadDocRB;
+ RadioButton m_aLoadTemplateRB;
+ RadioButton m_aRecentDocRB;
+
+ PushButton m_aBrowseDocPB;
+ PushButton m_aBrowseTemplatePB;
+
+ ListBox m_aRecentDocLB;
+
+ String m_sLoadFileName;
+ String m_sLoadTemplateName;
+
+ SwMailMergeWizard* m_pWizard;
+
+ DECL_LINK(DocSelectHdl, RadioButton*);
+ DECL_LINK(FileSelectHdl, PushButton*);
+
+ virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
+
+public:
+ SwMailMergeDocSelectPage( SwMailMergeWizard* _pParent);
+ ~SwMailMergeDocSelectPage();
+
+};
+
+#endif
+
+
diff --git a/sw/source/ui/dbui/mmdocselectpage.src b/sw/source/ui/dbui/mmdocselectpage.src
new file mode 100644
index 000000000000..25ffe0cee67c
--- /dev/null
+++ b/sw/source/ui/dbui/mmdocselectpage.src
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <mmdocselectpage.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+TabPage DLG_MM_DOCSELECT_PAGE
+{
+ HelpID = HID_MM_DOCSELECTPAGE ;
+ Size = MAP_APPFONT ( 260 , 250 ) ;
+ Hide = TRUE ;
+
+ FixedText FI_HEADER
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Select starting document for the mail merge";
+ };
+ FixedText FT_HOWTO
+ {
+ Pos = MAP_APPFONT ( 6 , 27 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Select the document upon which to base the mail merge document";
+ };
+ RadioButton RB_CURRENTDOC
+ {
+ HelpID = "sw:RadioButton:DLG_MM_DOCSELECT_PAGE:RB_CURRENTDOC";
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 190 , 10 ) ;
+ Text[ en-US ] = "Use the current ~document";
+ };
+ RadioButton RB_NEWDOC
+ {
+ HelpID = "sw:RadioButton:DLG_MM_DOCSELECT_PAGE:RB_NEWDOC";
+ Pos = MAP_APPFONT ( 12 , 66 ) ;
+ Size = MAP_APPFONT ( 190 , 10 ) ;
+ Text[ en-US ] = "Create a ne~w document";
+ };
+ RadioButton RB_LOADDOC
+ {
+ HelpID = "sw:RadioButton:DLG_MM_DOCSELECT_PAGE:RB_LOADDOC";
+ Pos = MAP_APPFONT ( 12 , 84) ;
+ Size = MAP_APPFONT ( 190 , 10 ) ;
+ Text[ en-US ] = "Start from ~existing document";
+ };
+ PushButton PB_LOADDOC
+ {
+ HelpID = "sw:PushButton:DLG_MM_DOCSELECT_PAGE:PB_LOADDOC";
+ Pos = MAP_APPFONT ( 204 , 80) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text[ en-US ] = "B~rowse...";
+ };
+ RadioButton RB_LOADTEMPLATE
+ {
+ HelpID = "sw:RadioButton:DLG_MM_DOCSELECT_PAGE:RB_LOADTEMPLATE";
+ Pos = MAP_APPFONT ( 12 , 103 ) ;
+ Size = MAP_APPFONT ( 190 , 10 ) ;
+ Text[ en-US ] = "Start from a t~emplate";
+ };
+ PushButton PB_BROWSETEMPLATE
+ {
+ HelpID = "sw:PushButton:DLG_MM_DOCSELECT_PAGE:PB_BROWSETEMPLATE";
+ Pos = MAP_APPFONT ( 204 , 99 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text[ en-US ] = "B~rowse...";
+ };
+ RadioButton RB_RECENTDOC
+ {
+ HelpID = "sw:RadioButton:DLG_MM_DOCSELECT_PAGE:RB_RECENTDOC";
+ Pos = MAP_APPFONT ( 12 , 120) ;
+ Size = MAP_APPFONT ( 190 , 10 ) ;
+ Text[ en-US ] = "Start fro~m a recently saved starting document";
+ };
+ ListBox LB_RECENTDOC
+ {
+ HelpID = "sw:ListBox:DLG_MM_DOCSELECT_PAGE:LB_RECENTDOC";
+ Pos = MAP_APPFONT ( 20 , 134 ) ;
+ Size = MAP_APPFONT ( 180 , 50 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ };
+};
+
+
+
diff --git a/sw/source/ui/dbui/mmgreetingspage.cxx b/sw/source/ui/dbui/mmgreetingspage.cxx
new file mode 100644
index 000000000000..7281880c593d
--- /dev/null
+++ b/sw/source/ui/dbui/mmgreetingspage.cxx
@@ -0,0 +1,619 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <mmgreetingspage.hxx>
+#include <mailmergewizard.hxx>
+#include <mmconfigitem.hxx>
+#include <mmaddressblockpage.hxx>
+#include <swtypes.hxx>
+#include <vcl/msgbox.hxx>
+#include <mmgreetingspage.hrc>
+#include <dbui.hrc>
+#include <com/sun/star/sdb/XColumn.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <helpid.h>
+
+using namespace svt;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+// -----------------------------------------------------------------------
+void lcl_FillGreetingsBox(ListBox& rBox,
+ SwMailMergeConfigItem& rConfig,
+ SwMailMergeConfigItem::Gender eType)
+{
+ const Sequence< ::rtl::OUString> rEntries = rConfig.GetGreetings(eType);
+ for(sal_Int32 nEntry = 0; nEntry < rEntries.getLength(); ++nEntry)
+ rBox.InsertEntry(rEntries[nEntry]);
+ rBox.SelectEntryPos((USHORT)rConfig.GetCurrentGreeting(eType));
+}
+// -----------------------------------------------------------------------
+void lcl_FillGreetingsBox(ComboBox& rBox,
+ SwMailMergeConfigItem& rConfig,
+ SwMailMergeConfigItem::Gender eType)
+{
+ const Sequence< ::rtl::OUString> rEntries = rConfig.GetGreetings(eType);
+ for(sal_Int32 nEntry = 0; nEntry < rEntries.getLength(); ++nEntry)
+ rBox.InsertEntry(rEntries[nEntry]);
+ rBox.SelectEntryPos((USHORT)rConfig.GetCurrentGreeting(eType));
+}
+// -----------------------------------------------------------------------
+void lcl_StoreGreetingsBox(ListBox& rBox,
+ SwMailMergeConfigItem& rConfig,
+ SwMailMergeConfigItem::Gender eType)
+{
+ Sequence< ::rtl::OUString> aEntries(rBox.GetEntryCount());
+ ::rtl::OUString* pEntries = aEntries.getArray();
+ for(USHORT nEntry = 0; nEntry < rBox.GetEntryCount(); ++nEntry)
+ pEntries[nEntry] = rBox.GetEntry(nEntry);
+ rConfig.SetGreetings(eType, aEntries);
+ rConfig.SetCurrentGreeting(eType, rBox.GetSelectEntryPos());
+}
+// -----------------------------------------------------------------------
+void lcl_StoreGreetingsBox(ComboBox& rBox,
+ SwMailMergeConfigItem& rConfig,
+ SwMailMergeConfigItem::Gender eType)
+{
+ Sequence< ::rtl::OUString> aEntries(rBox.GetEntryCount());
+ ::rtl::OUString* pEntries = aEntries.getArray();
+ for(USHORT nEntry = 0; nEntry < rBox.GetEntryCount(); ++nEntry)
+ pEntries[nEntry] = rBox.GetEntry(nEntry);
+ rConfig.SetGreetings(eType, aEntries);
+ rConfig.SetCurrentGreeting(eType, rBox.GetSelectEntryPos());
+}
+/*-- 30.04.2004 10:42:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwGreetingsHandler, IndividualHdl_Impl, CheckBox*, EMPTYARG)
+{
+ BOOL bIndividual = m_pPersonalizedCB->IsEnabled() && m_pPersonalizedCB->IsChecked();
+ m_pFemaleFT->Enable(bIndividual);
+ m_pFemaleLB->Enable(bIndividual);
+ m_pFemalePB->Enable(bIndividual);
+ m_pMaleFT->Enable(bIndividual);
+ m_pMaleLB->Enable(bIndividual);
+ m_pMalePB->Enable(bIndividual);
+ m_pFemaleFI->Enable(bIndividual);
+ m_pFemaleColumnFT->Enable(bIndividual);
+ m_pFemaleColumnLB->Enable(bIndividual);
+ m_pFemaleFieldFT->Enable(bIndividual);
+ m_pFemaleFieldCB->Enable(bIndividual);
+
+ if( m_bIsTabPage )
+ {
+ m_pWizard->GetConfigItem().SetIndividualGreeting(bIndividual, sal_False);
+ m_pWizard->UpdateRoadmap();
+ m_pWizard->enableButtons(WZB_NEXT, m_pWizard->isStateEnabled(MM_PREPAREMERGEPAGE));
+ }
+ UpdatePreview();
+ return 0;
+}
+/*-- 30.04.2004 10:42:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwGreetingsHandler, GreetingHdl_Impl, PushButton*, pButton)
+{
+ SwCustomizeAddressBlockDialog* pDlg =
+ new SwCustomizeAddressBlockDialog(pButton, m_pWizard->GetConfigItem(),
+ pButton == m_pMalePB ?
+ SwCustomizeAddressBlockDialog::GREETING_MALE :
+ SwCustomizeAddressBlockDialog::GREETING_FEMALE );
+ if(RET_OK == pDlg->Execute())
+ {
+ ListBox* pToInsert = pButton == m_pMalePB ? m_pMaleLB : m_pFemaleLB;
+ pToInsert->SelectEntryPos(pToInsert->InsertEntry(pDlg->GetAddress()));
+ if(m_bIsTabPage)
+ {
+ m_pWizard->UpdateRoadmap();
+ m_pWizard->enableButtons(WZB_NEXT, m_pWizard->isStateEnabled(MM_PREPAREMERGEPAGE));
+ }
+ UpdatePreview();
+ }
+ delete pDlg;
+ return 0;
+}
+/*-- 16.06.2004 10:56:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwGreetingsHandler::UpdatePreview()
+{
+ //the base class does nothing
+}
+/*-- 30.04.2004 10:42:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeGreetingsPage, AssignHdl_Impl, PushButton*, pButton)
+{
+ String sPreview = m_aFemaleLB.GetSelectEntry();
+ sPreview += '\n';
+ sPreview += m_aMaleLB.GetSelectEntry();
+ SwAssignFieldsDialog* pDlg =
+ new SwAssignFieldsDialog(pButton, m_pWizard->GetConfigItem(), sPreview, false);
+ if(RET_OK == pDlg->Execute())
+ {
+ UpdatePreview();
+ m_pWizard->UpdateRoadmap();
+ m_pWizard->enableButtons(WZB_NEXT, m_pWizard->isStateEnabled(MM_PREPAREMERGEPAGE));
+ }
+ delete pDlg;
+ return 0;
+}
+/*-- 05.05.2004 15:25:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeGreetingsPage, GreetingSelectHdl_Impl, ListBox*, EMPTYARG)
+{
+ UpdatePreview();
+ return 0;
+}
+/*-- 05.05.2004 15:23:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeGreetingsPage::UpdatePreview()
+{
+ //find out which type of greeting should be selected:
+ bool bFemale = false;
+ bool bNoValue = !m_pFemaleColumnLB->IsEnabled();
+ if( !bNoValue )
+ {
+ ::rtl::OUString sFemaleValue = m_aFemaleFieldCB.GetText();
+ ::rtl::OUString sFemaleColumn = m_aFemaleColumnLB.GetSelectEntry();
+ Reference< sdbcx::XColumnsSupplier > xColsSupp( m_pWizard->GetConfigItem().GetResultSet(), UNO_QUERY);
+ Reference < container::XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : 0;
+ if(sFemaleValue.getLength() && sFemaleColumn.getLength() &&
+ xColAccess.is() &&
+ xColAccess->hasByName(sFemaleColumn))
+ {
+ //get the content and exchange it in the address string
+ Any aCol = xColAccess->getByName(sFemaleColumn);
+ Reference< sdb::XColumn > xColumn;
+ aCol >>= xColumn;
+ if(xColumn.is())
+ {
+ try
+ {
+ ::rtl::OUString sFemaleColumnValue = xColumn->getString();
+ bFemale = sFemaleColumnValue == sFemaleValue;
+ //bNoValue = !sFemaleColumnValue.getLength();
+ if( !bNoValue )
+ {
+ //no last name value marks the greeting also als neutral
+ SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem();
+ ::rtl::OUString sLastNameColumn = rConfig.GetAssignedColumn(MM_PART_LASTNAME);
+ if ( xColAccess->hasByName(sLastNameColumn) )
+ {
+ aCol = xColAccess->getByName(sLastNameColumn);
+ aCol >>= xColumn;
+ ::rtl::OUString sLastNameColumnValue = xColumn->getString();
+ bNoValue = !sLastNameColumnValue.getLength();
+ }
+ }
+ }
+ catch( sdbc::SQLException& )
+ {
+ DBG_ERROR("SQLException caught");
+ }
+ }
+ }
+ }
+
+ String sPreview = bFemale ? m_aFemaleLB.GetSelectEntry() :
+ bNoValue ? m_aNeutralCB.GetText() : m_aMaleLB.GetSelectEntry();
+
+ sPreview = SwAddressPreview::FillData(sPreview, m_pWizard->GetConfigItem());
+ m_aPreviewWIN.SetAddress(sPreview);
+}
+/*-- 17.05.2004 15:44:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwGreetingsHandler::Contains(sal_Bool bContainsGreeting)
+{
+ m_pPersonalizedCB->Enable(bContainsGreeting);
+ sal_Bool bEnablePersonal = bContainsGreeting && m_pPersonalizedCB->IsChecked();
+ m_pFemaleFT->Enable(bEnablePersonal);
+ m_pFemaleLB->Enable(bEnablePersonal);
+ m_pFemalePB->Enable(bEnablePersonal);
+ m_pMaleFT->Enable(bEnablePersonal);
+ m_pMaleLB->Enable(bEnablePersonal);
+ m_pMalePB->Enable(bEnablePersonal);
+ m_pFemaleFI->Enable(bEnablePersonal);
+ m_pFemaleColumnFT->Enable(bEnablePersonal);
+ m_pFemaleColumnLB->Enable(bEnablePersonal);
+ m_pFemaleFieldFT->Enable(bEnablePersonal);
+ m_pFemaleFieldCB->Enable(bEnablePersonal);
+
+ m_pNeutralFT->Enable(bContainsGreeting);
+ m_pNeutralCB->Enable(bContainsGreeting);
+}
+/*-- 02.04.2004 14:17:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeGreetingsPage::SwMailMergeGreetingsPage( SwMailMergeWizard* _pParent) :
+ svt::OWizardPage(_pParent, SW_RES(DLG_MM_GREETINGS_PAGE)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aHeaderFI(this, SW_RES( FI_HEADER ) ),
+ m_aGreetingLineCB(this, SW_RES( CB_GREETINGLINE ) ),
+ m_aPersonalizedCB(this, SW_RES( CB_PERSONALIZED ) ),
+ m_aFemaleFT(this, SW_RES( FT_FEMALE ) ),
+ m_aFemaleLB(this, SW_RES( LB_FEMALE ) ),
+ m_aFemalePB(this, SW_RES( PB_FEMALE ) ),
+ m_aMaleFT(this, SW_RES( FT_MALE ) ),
+ m_aMaleLB(this, SW_RES( LB_MALE ) ),
+ m_aMalePB(this, SW_RES( PB_MALE ) ),
+ m_aFemaleFI(this, SW_RES( FI_FEMALE ) ),
+ m_aFemaleColumnFT(this, SW_RES( FT_FEMALECOLUMN ) ),
+ m_aFemaleColumnLB(this, SW_RES( LB_FEMALECOLUMN ) ),
+ m_aFemaleFieldFT(this, SW_RES( FT_FEMALEFIELD ) ),
+ m_aFemaleFieldCB(this, SW_RES( CB_FEMALEFIELD ) ),
+ m_aNeutralFT(this, SW_RES( FT_NEUTRAL ) ),
+ m_aNeutralCB(this, SW_RES( CB_NEUTRAL ) ),
+ m_aPreviewFI( this, SW_RES( FI_PREVIEW ) ),
+ m_aPreviewWIN( this, SW_RES( WIN_PREVIEW ) ),
+ m_aAssignPB( this, SW_RES( PB_ASSIGN ) ),
+ m_aDocumentIndexFI( this, SW_RES( FI_DOCINDEX ) ),
+ m_aPrevSetIB( this, SW_RES( IB_PREVSET ) ),
+ m_aNextSetIB( this, SW_RES( IB_NEXTSET ) ),
+ m_sDocument( SW_RES( STR_DOCUMENT ) )
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+{
+ m_pWizard = _pParent;
+ m_pGreetingLineCB = &m_aGreetingLineCB;
+ m_pPersonalizedCB = &m_aPersonalizedCB;
+ m_pFemaleFT = & m_aFemaleFT;
+ m_pFemaleLB = & m_aFemaleLB;
+ m_pFemalePB = & m_aFemalePB;
+ m_pMaleFT = & m_aMaleFT;
+ m_pMaleLB = & m_aMaleLB;
+ m_pMalePB = & m_aMalePB;
+ m_pFemaleFI = & m_aFemaleFI;
+ m_pFemaleColumnFT = &m_aFemaleColumnFT;
+ m_pFemaleColumnLB = &m_aFemaleColumnLB;
+ m_pFemaleFieldFT = & m_aFemaleFieldFT;
+ m_pFemaleFieldCB = & m_aFemaleFieldCB;
+ m_pNeutralFT = & m_aNeutralFT;
+ m_pNeutralCB = &m_aNeutralCB;
+ m_bIsTabPage = true;
+
+ m_pPersonalizedCB->SetHelpId( HID_MM_GREETINGS_CB_PERSONALIZED);
+ m_pFemaleLB->SetHelpId( HID_MM_GREETINGS_LB_FEMALE );
+ m_pFemalePB->SetHelpId( HID_MM_GREETINGS_PB_FEMALE );
+ m_pMaleLB->SetHelpId( HID_MM_GREETINGS_LB_MALE );
+ m_pMalePB->SetHelpId( HID_MM_GREETINGS_PB_MALE );
+ m_pFemaleColumnLB->SetHelpId( HID_MM_GREETINGS_LB_FEMALECOLUMN);
+ m_pFemaleFieldCB->SetHelpId( HID_MM_GREETINGS_CB_FEMALEFIELD );
+ m_pNeutralCB->SetHelpId( HID_MM_GREETINGS_CB_NEUTRAL );
+
+ FreeResource();
+ m_aGreetingLineCB.SetClickHdl(LINK(this, SwMailMergeGreetingsPage, ContainsHdl_Impl));
+ Link aIndividualLink = LINK(this, SwGreetingsHandler, IndividualHdl_Impl);
+ m_aPersonalizedCB.SetClickHdl(aIndividualLink);
+ Link aGreetingLink = LINK(this, SwGreetingsHandler, GreetingHdl_Impl);
+ m_aFemalePB.SetClickHdl(aGreetingLink);
+ m_aMalePB.SetClickHdl(aGreetingLink);
+ m_aAssignPB.SetClickHdl(LINK(this, SwMailMergeGreetingsPage, AssignHdl_Impl));
+ Link aLBoxLink = LINK(this, SwMailMergeGreetingsPage, GreetingSelectHdl_Impl);
+ m_aFemaleLB.SetSelectHdl(aLBoxLink);
+ m_aMaleLB.SetSelectHdl(aLBoxLink);
+ m_aFemaleColumnLB.SetSelectHdl(aLBoxLink);
+ m_aFemaleFieldCB.SetSelectHdl(aLBoxLink);
+ m_aFemaleFieldCB.SetModifyHdl(aLBoxLink);
+ m_aNeutralCB.SetSelectHdl(aLBoxLink);
+ m_aNeutralCB.SetModifyHdl(aLBoxLink);
+
+ Link aDataLink = LINK(this, SwMailMergeGreetingsPage, InsertDataHdl_Impl);
+ m_aPrevSetIB.SetClickHdl(aDataLink);
+ m_aNextSetIB.SetClickHdl(aDataLink);
+
+
+ SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem();
+ m_aGreetingLineCB.Check(rConfig.IsGreetingLine(sal_False));
+ m_aPersonalizedCB.Check(rConfig.IsIndividualGreeting(sal_False));
+ ContainsHdl_Impl(&m_aGreetingLineCB);
+ aIndividualLink.Call(0);
+
+ lcl_FillGreetingsBox(m_aFemaleLB, rConfig, SwMailMergeConfigItem::FEMALE);
+ lcl_FillGreetingsBox(m_aMaleLB, rConfig, SwMailMergeConfigItem::MALE);
+ lcl_FillGreetingsBox(m_aNeutralCB, rConfig, SwMailMergeConfigItem::NEUTRAL);
+
+ String sTemp(m_sDocument);
+ sTemp.SearchAndReplaceAscii("%1", String::CreateFromInt32(1));
+ m_aDocumentIndexFI.SetText(sTemp);
+}
+/*-- 02.04.2004 14:17:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeGreetingsPage::~SwMailMergeGreetingsPage()
+{
+}
+/*-- 18.06.2004 12:13:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeGreetingsPage::ActivatePage()
+{
+ SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem();
+
+ //try to find the gender setting
+ m_aFemaleColumnLB.Clear();
+ Reference< sdbcx::XColumnsSupplier > xColsSupp = rConfig.GetColumnsSupplier();
+ if(xColsSupp.is())
+ {
+ Reference < container::XNameAccess> xColAccess = xColsSupp->getColumns();
+ Sequence< ::rtl::OUString > aColumns = xColAccess->getElementNames();
+ for(sal_Int32 nName = 0; nName < aColumns.getLength(); ++nName)
+ m_aFemaleColumnLB.InsertEntry(aColumns[nName]);
+ }
+
+ ::rtl::OUString sGenderColumn = rConfig.GetAssignedColumn(MM_PART_GENDER);
+ m_aFemaleColumnLB.SelectEntry(sGenderColumn);
+ m_aFemaleColumnLB.SaveValue();
+
+ m_aFemaleFieldCB.SetText(rConfig.GetFemaleGenderValue());
+ m_aFemaleFieldCB.SaveValue();
+
+ UpdatePreview();
+ m_pWizard->enableButtons(WZB_NEXT, m_pWizard->isStateEnabled(MM_PREPAREMERGEPAGE));
+}
+/*-- 11.05.2004 14:47:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeGreetingsPage::commitPage( ::svt::WizardTypes::CommitPageReason )
+{
+ SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem();
+
+ if(m_aFemaleColumnLB.GetSelectEntryPos() != m_aFemaleColumnLB.GetSavedValue())
+ {
+ const SwDBData& rDBData = rConfig.GetCurrentDBData();
+ Sequence< ::rtl::OUString> aAssignment = rConfig.GetColumnAssignment( rDBData );
+ if(aAssignment.getLength() <= MM_PART_GENDER)
+ aAssignment.realloc(MM_PART_GENDER + 1);
+ aAssignment[MM_PART_GENDER] = m_aFemaleColumnLB.GetSelectEntry();
+ rConfig.SetColumnAssignment( rDBData, aAssignment );
+ }
+ if(m_aFemaleFieldCB.GetText() != m_aFemaleFieldCB.GetSavedValue())
+ rConfig.SetFemaleGenderValue(m_aFemaleFieldCB.GetText());
+
+ lcl_StoreGreetingsBox(m_aFemaleLB, rConfig, SwMailMergeConfigItem::FEMALE);
+ lcl_StoreGreetingsBox(m_aMaleLB, rConfig, SwMailMergeConfigItem::MALE);
+
+ USHORT nCurrentTextPos = m_aNeutralCB.GetEntryPos( m_aNeutralCB.GetText() );
+ if(LISTBOX_ENTRY_NOTFOUND == nCurrentTextPos)
+ {
+ USHORT nCount = m_aNeutralCB.GetEntryCount();
+ m_aNeutralCB.InsertEntry( m_aNeutralCB.GetText(), nCount );
+ m_aNeutralCB.SelectEntryPos(nCount);
+ }
+ lcl_StoreGreetingsBox(m_aNeutralCB, rConfig, SwMailMergeConfigItem::NEUTRAL);
+ rConfig.SetGreetingLine(m_aGreetingLineCB.IsChecked(), sal_False);
+ rConfig.SetIndividualGreeting(m_aPersonalizedCB.IsChecked(), sal_False);
+ return sal_True;
+}
+/*-- 30.04.2004 10:42:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeGreetingsPage, ContainsHdl_Impl, CheckBox*, pBox)
+{
+ sal_Bool bContainsGreeting = pBox->IsChecked();
+ SwGreetingsHandler::Contains(bContainsGreeting);
+ m_aPreviewFI. Enable(bContainsGreeting);
+ m_aPreviewWIN.Enable(bContainsGreeting);
+ m_aAssignPB. Enable(bContainsGreeting);
+ m_aDocumentIndexFI. Enable(bContainsGreeting);
+ m_aPrevSetIB.Enable(bContainsGreeting);
+ m_aNextSetIB.Enable(bContainsGreeting);
+ SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem();
+ rConfig.SetGreetingLine(m_aGreetingLineCB.IsChecked(), sal_False);
+ m_pWizard->UpdateRoadmap();
+ return 0;
+}
+/*-- 07.05.2004 12:56:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeGreetingsPage, InsertDataHdl_Impl, ImageButton*, pButton)
+{
+ //if no pButton is given, the first set has to be pre-set
+ SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem();
+ if(!pButton)
+ {
+ rConfig.GetResultSet();
+ }
+ else
+ {
+ BOOL bNext = pButton == &m_aNextSetIB;
+ sal_Int32 nPos = rConfig.GetResultSetPosition();
+ rConfig.MoveResultSet( bNext ? ++nPos : --nPos);
+ }
+ sal_Int32 nPos = rConfig.GetResultSetPosition();
+ BOOL bEnable = TRUE;
+ if(nPos < 1)
+ {
+ bEnable = FALSE;
+ nPos = 1;
+ }
+ else
+ UpdatePreview();
+ m_aPrevSetIB.Enable(bEnable);
+ m_aNextSetIB.Enable(bEnable);
+ m_aDocumentIndexFI.Enable(bEnable);
+ String sTemp(m_sDocument);
+ sTemp.SearchAndReplaceAscii("%1", String::CreateFromInt32(nPos));
+ m_aDocumentIndexFI.SetText(sTemp);
+ return 0;
+}
+/*-- 17.05.2004 15:11:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailBodyDialog::SwMailBodyDialog(Window* pParent, SwMailMergeWizard* _pWizard) :
+ SfxModalDialog(pParent, SW_RES(DLG_MM_MAILBODY)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aGreetingLineCB(this, SW_RES( CB_GREETINGLINE ) ),
+ m_aPersonalizedCB(this, SW_RES( CB_PERSONALIZED ) ),
+ m_aFemaleFT(this, SW_RES( FT_FEMALE ) ),
+ m_aFemaleLB(this, SW_RES( LB_FEMALE ) ),
+ m_aFemalePB(this, SW_RES( PB_FEMALE ) ),
+ m_aMaleFT(this, SW_RES( FT_MALE ) ),
+ m_aMaleLB(this, SW_RES( LB_MALE ) ),
+ m_aMalePB(this, SW_RES( PB_MALE ) ),
+ m_aFemaleFI(this, SW_RES( FI_FEMALE ) ),
+ m_aFemaleColumnFT(this, SW_RES( FT_FEMALECOLUMN ) ),
+ m_aFemaleColumnLB(this, SW_RES( LB_FEMALECOLUMN ) ),
+ m_aFemaleFieldFT(this, SW_RES( FT_FEMALEFIELD ) ),
+ m_aFemaleFieldCB(this, SW_RES( CB_FEMALEFIELD ) ),
+ m_aNeutralFT(this, SW_RES( FT_NEUTRAL ) ),
+ m_aNeutralCB(this, SW_RES( CB_NEUTRAL ) ),
+ m_aBodyFT( this, SW_RES( FT_BODY ) ),
+ m_aBodyMLE( this, SW_RES( MLE_BODY ) ),
+ m_aSeparatorFL( this, SW_RES( FL_SEPARATOR ) ),
+ m_aOK( this, SW_RES( PB_OK ) ),
+ m_aCancel( this, SW_RES( PB_CANCEL ) ),
+ m_aHelp( this, SW_RES( PB_HELP ) )
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+{
+ m_pWizard = _pWizard;
+ m_pGreetingLineCB = &m_aGreetingLineCB;
+ m_pPersonalizedCB = &m_aPersonalizedCB;
+ m_pFemaleFT = & m_aFemaleFT;
+ m_pFemaleLB = & m_aFemaleLB;
+ m_pFemalePB = & m_aFemalePB;
+ m_pMaleFT = & m_aMaleFT;
+ m_pMaleLB = & m_aMaleLB;
+ m_pMalePB = & m_aMalePB;
+ m_pFemaleFI = & m_aFemaleFI;
+ m_pFemaleColumnFT = &m_aFemaleColumnFT;
+ m_pFemaleColumnLB = &m_aFemaleColumnLB;
+ m_pFemaleFieldFT = & m_aFemaleFieldFT;
+ m_pFemaleFieldCB = & m_aFemaleFieldCB;
+ m_pNeutralFT = & m_aNeutralFT;
+ m_pNeutralCB = &m_aNeutralCB;
+ m_bIsTabPage = false;
+
+ m_pPersonalizedCB->SetHelpId( HID_MM_BODY_CB_PERSONALIZED );
+ m_pFemaleLB->SetHelpId( HID_MM_BODY_LB_FEMALE );
+ m_pFemalePB->SetHelpId( HID_MM_BODY_PB_FEMALE );
+ m_pMaleLB->SetHelpId( HID_MM_BODY_LB_MALE );
+ m_pMalePB->SetHelpId( HID_MM_BODY_PB_MALE );
+ m_pFemaleColumnLB->SetHelpId( HID_MM_BODY_LB_FEMALECOLUMN );
+ m_pFemaleFieldCB->SetHelpId( HID_MM_BODY_CB_FEMALEFIELD );
+ m_pNeutralCB->SetHelpId( HID_MM_BODY_CB_NEUTRAL );
+
+ FreeResource();
+ m_aGreetingLineCB.SetClickHdl(LINK(this, SwMailBodyDialog, ContainsHdl_Impl));
+ Link aIndividualLink = LINK(this, SwGreetingsHandler, IndividualHdl_Impl);
+ m_aPersonalizedCB.SetClickHdl(aIndividualLink);
+ Link aGreetingLink = LINK(this, SwGreetingsHandler, GreetingHdl_Impl);
+ m_aFemalePB.SetClickHdl(aGreetingLink);
+ m_aMalePB.SetClickHdl(aGreetingLink);
+ m_aOK.SetClickHdl(LINK(this, SwMailBodyDialog, OKHdl));
+
+ SwMailMergeConfigItem& rConfig = m_pWizard->GetConfigItem();
+ m_aGreetingLineCB.Check(rConfig.IsGreetingLine(sal_True));
+ m_aPersonalizedCB.Check(rConfig.IsIndividualGreeting(sal_True));
+ ContainsHdl_Impl(&m_aGreetingLineCB);
+ aIndividualLink.Call(0);
+
+ lcl_FillGreetingsBox(m_aFemaleLB, rConfig, SwMailMergeConfigItem::FEMALE);
+ lcl_FillGreetingsBox(m_aMaleLB, rConfig, SwMailMergeConfigItem::MALE);
+ lcl_FillGreetingsBox(m_aNeutralCB, rConfig, SwMailMergeConfigItem::NEUTRAL);
+
+ //try to find the gender setting
+ m_aFemaleColumnLB.Clear();
+ Reference< sdbcx::XColumnsSupplier > xColsSupp = rConfig.GetColumnsSupplier();
+ if(xColsSupp.is())
+ {
+ Reference < container::XNameAccess> xColAccess = xColsSupp->getColumns();
+ Sequence< ::rtl::OUString > aColumns = xColAccess->getElementNames();
+ for(sal_Int32 nName = 0; nName < aColumns.getLength(); ++nName)
+ m_aFemaleColumnLB.InsertEntry(aColumns[nName]);
+ }
+
+ ::rtl::OUString sGenderColumn = rConfig.GetAssignedColumn(MM_PART_GENDER);
+ m_aFemaleColumnLB.SelectEntry(sGenderColumn);
+ m_aFemaleColumnLB.SaveValue();
+
+ m_aFemaleFieldCB.SetText(rConfig.GetFemaleGenderValue());
+ m_aFemaleFieldCB.SaveValue();
+}
+/*-- 17.05.2004 15:13:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailBodyDialog::~SwMailBodyDialog()
+{
+}
+
+/*-- 30.04.2004 10:42:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailBodyDialog, ContainsHdl_Impl, CheckBox*, pBox)
+{
+ SwGreetingsHandler::Contains(pBox->IsChecked());
+ m_pWizard->GetConfigItem().SetGreetingLine(pBox->IsChecked(), sal_True);
+ return 0;
+}
+/*-- 28.06.2004 11:22:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailBodyDialog, OKHdl, PushButton*, EMPTYARG)
+{
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ rConfigItem.SetGreetingLine(
+ m_aGreetingLineCB.IsChecked(), sal_False);
+ rConfigItem.SetIndividualGreeting(
+ m_aPersonalizedCB.IsChecked(), sal_False);
+
+ if(m_aFemaleColumnLB.GetSelectEntryPos() != m_aFemaleColumnLB.GetSavedValue())
+ {
+ const SwDBData& rDBData = rConfigItem.GetCurrentDBData();
+ Sequence< ::rtl::OUString> aAssignment = rConfigItem.GetColumnAssignment( rDBData );
+ sal_Int32 nPos = m_aFemaleColumnLB.GetSelectEntryPos();
+ if(aAssignment.getLength() < MM_PART_GENDER)
+ aAssignment.realloc(MM_PART_GENDER);
+ if( nPos > 0 )
+ aAssignment[MM_PART_GENDER] = m_aFemaleColumnLB.GetSelectEntry();
+ else
+ aAssignment[MM_PART_GENDER] = ::rtl::OUString();
+ rConfigItem.SetColumnAssignment( rDBData, aAssignment );
+ }
+ if(m_aFemaleFieldCB.GetText() != m_aFemaleFieldCB.GetSavedValue())
+ rConfigItem.SetFemaleGenderValue(m_aFemaleFieldCB.GetText());
+
+ EndDialog(RET_OK);
+ return 0;
+}
+
diff --git a/sw/source/ui/dbui/mmgreetingspage.hrc b/sw/source/ui/dbui/mmgreetingspage.hrc
new file mode 100644
index 000000000000..422d04983e49
--- /dev/null
+++ b/sw/source/ui/dbui/mmgreetingspage.hrc
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEGREETINGSPAGE_HRC
+#define _MAILMERGEGREETINGSPAGE_HRC
+
+
+#define CB_PERSONALIZED 2
+#define LB_FEMALE 3
+#define PB_FEMALE 4
+#define LB_MALE 5
+#define PB_MALE 6
+#define FI_FEMALE 7
+#define FT_FEMALECOLUMN 8
+#define LB_FEMALECOLUMN 9
+#define FT_FEMALEFIELD 10
+#define CB_FEMALEFIELD 11
+#define FT_NEUTRAL 12
+
+#define CB_NEUTRAL 14
+#define CB_GREETINGLINE 15
+#define FI_PREVIEW 16
+#define WIN_PREVIEW 17
+#define PB_ASSIGN 18
+#define FI_DOCINDEX 19
+#define IB_PREVSET 20
+#define IB_NEXTSET 21
+#define STR_DOCUMENT 22
+#define FI_HEADER 23
+#define FT_FEMALE 24
+#define FT_MALE 25
+
+#define FT_BODY 30
+#define MLE_BODY 31
+#define FL_SEPARATOR 32
+#define PB_OK 33
+#define PB_CANCEL 34
+#define PB_HELP 35
+
+#endif
+
+
diff --git a/sw/source/ui/dbui/mmgreetingspage.hxx b/sw/source/ui/dbui/mmgreetingspage.hxx
new file mode 100644
index 000000000000..3e237d797e2f
--- /dev/null
+++ b/sw/source/ui/dbui/mmgreetingspage.hxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEGREETINGSPAGE_HXX
+#define _MAILMERGEGREETINGSPAGE_HXX
+
+#include <svtools/wizardmachine.hxx>
+#include <sfx2/basedlgs.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+#include <vcl/combobox.hxx>
+#include <svtools/stdctrl.hxx>
+#include <mailmergehelper.hxx>
+#include <svtools/svmedit.hxx>
+
+class SwMailMergeWizard;
+/*-- 17.05.2004 14:51:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwGreetingsHandler
+{
+ friend class SwMailBodyDialog;
+ friend class SwMailMergeGreetingsPage;
+ CheckBox* m_pGreetingLineCB;
+
+ CheckBox* m_pPersonalizedCB;
+
+ FixedText* m_pFemaleFT;
+ ListBox* m_pFemaleLB;
+ PushButton* m_pFemalePB;
+
+ FixedText* m_pMaleFT;
+ ListBox* m_pMaleLB;
+ PushButton* m_pMalePB;
+
+ FixedInfo* m_pFemaleFI;
+ FixedText* m_pFemaleColumnFT;
+ ListBox* m_pFemaleColumnLB;
+ FixedText* m_pFemaleFieldFT;
+ ComboBox* m_pFemaleFieldCB;
+
+ FixedText* m_pNeutralFT;
+ ComboBox* m_pNeutralCB;
+
+ bool m_bIsTabPage;
+
+ SwMailMergeWizard* m_pWizard;
+
+ DECL_LINK(IndividualHdl_Impl, CheckBox*);
+ DECL_LINK(GreetingHdl_Impl, PushButton*);
+
+ void Contains(sal_Bool bContainsGreeting);
+ virtual void UpdatePreview();
+};
+/*-- 02.04.2004 09:21:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailMergeGreetingsPage : public svt::OWizardPage,
+ public SwGreetingsHandler
+{
+ SwBoldFixedInfo m_aHeaderFI;
+
+ CheckBox m_aGreetingLineCB;
+
+ CheckBox m_aPersonalizedCB;
+
+ FixedText m_aFemaleFT;
+ ListBox m_aFemaleLB;
+ PushButton m_aFemalePB;
+
+ FixedText m_aMaleFT;
+ ListBox m_aMaleLB;
+ PushButton m_aMalePB;
+
+ FixedInfo m_aFemaleFI;
+ FixedText m_aFemaleColumnFT;
+ ListBox m_aFemaleColumnLB;
+ FixedText m_aFemaleFieldFT;
+ ComboBox m_aFemaleFieldCB;
+
+ FixedText m_aNeutralFT;
+ ComboBox m_aNeutralCB;
+
+ FixedInfo m_aPreviewFI;
+ SwAddressPreview m_aPreviewWIN;
+ PushButton m_aAssignPB;
+ FixedInfo m_aDocumentIndexFI;
+ ImageButton m_aPrevSetIB;
+ ImageButton m_aNextSetIB;
+
+ String m_sDocument;
+
+ DECL_LINK(ContainsHdl_Impl, CheckBox*);
+ DECL_LINK(InsertDataHdl_Impl, ImageButton*);
+ DECL_LINK(GreetingSelectHdl_Impl, ListBox*);
+ DECL_LINK(AssignHdl_Impl, PushButton*);
+
+ virtual void UpdatePreview();
+ virtual void ActivatePage();
+ virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
+public:
+ SwMailMergeGreetingsPage( SwMailMergeWizard* _pParent);
+ ~SwMailMergeGreetingsPage();
+
+};
+/*-- 17.05.2004 14:45:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailBodyDialog : public SfxModalDialog, public SwGreetingsHandler
+{
+ CheckBox m_aGreetingLineCB;
+
+ CheckBox m_aPersonalizedCB;
+
+ FixedText m_aFemaleFT;
+ ListBox m_aFemaleLB;
+ PushButton m_aFemalePB;
+
+ FixedText m_aMaleFT;
+ ListBox m_aMaleLB;
+ PushButton m_aMalePB;
+
+ FixedInfo m_aFemaleFI;
+ FixedText m_aFemaleColumnFT;
+ ListBox m_aFemaleColumnLB;
+ FixedText m_aFemaleFieldFT;
+ ComboBox m_aFemaleFieldCB;
+
+ FixedText m_aNeutralFT;
+ ComboBox m_aNeutralCB;
+
+ FixedText m_aBodyFT;
+ MultiLineEdit m_aBodyMLE;
+ FixedLine m_aSeparatorFL;
+
+ OKButton m_aOK;
+ CancelButton m_aCancel;
+ HelpButton m_aHelp;
+
+ DECL_LINK(ContainsHdl_Impl, CheckBox*);
+ DECL_LINK(OKHdl, PushButton*);
+public:
+ SwMailBodyDialog(Window* pParent, SwMailMergeWizard* pWizard);
+ ~SwMailBodyDialog();
+
+ void SetBody(const String& rBody ) {m_aBodyMLE.SetText(rBody);}
+ String GetBody() const {return m_aBodyMLE.GetText();}
+};
+#endif
+
+
diff --git a/sw/source/ui/dbui/mmgreetingspage.src b/sw/source/ui/dbui/mmgreetingspage.src
new file mode 100644
index 000000000000..eda855dc5095
--- /dev/null
+++ b/sw/source/ui/dbui/mmgreetingspage.src
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <mmgreetingspage.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+#define _LB_FEMALECOLUMN \
+ StringList [en-US]= \
+ { \
+ < "< not available >" ; > ; \
+ };
+
+
+#define GREETINGS_BODY \
+ CheckBox CB_PERSONALIZED \
+ { \
+ Pos = MAP_APPFONT ( 12 + LEFT_OFFSET , 17 + TOP_OFFSET ) ; \
+ Size = MAP_APPFONT ( 226 , 10 ) ; \
+ Text[ en-US ] = "Insert personalized salutation"; \
+ }; \
+ FixedText FT_FEMALE \
+ { \
+ Pos = MAP_APPFONT ( 18 + LEFT_OFFSET , 32 + TOP_OFFSET ) ; \
+ Size = MAP_APPFONT ( 50 , 8 ) ; \
+ Text[ en-US ] = "~Female"; \
+ }; \
+ ListBox LB_FEMALE \
+ { \
+ Pos = MAP_APPFONT ( 71 + LEFT_OFFSET , 30 + TOP_OFFSET ) ; \
+ Size = MAP_APPFONT ( 121 , 50 ) ; \
+ DropDown = TRUE; \
+ Border = TRUE; \
+ }; \
+ PushButton PB_FEMALE \
+ { \
+ Pos = MAP_APPFONT ( 198 + LEFT_OFFSET , 29 + TOP_OFFSET ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ Text[ en-US ] = "~New..."; \
+ }; \
+ FixedText FT_MALE \
+ { \
+ Pos = MAP_APPFONT ( 18 + LEFT_OFFSET , 49 + TOP_OFFSET ) ; \
+ Size = MAP_APPFONT ( 50 , 8 ) ; \
+ Text[ en-US ] = "~Male"; \
+ }; \
+ ListBox LB_MALE \
+ { \
+ Pos = MAP_APPFONT ( 71 + LEFT_OFFSET , 47 + TOP_OFFSET ) ; \
+ Size = MAP_APPFONT ( 121 , 50 ) ; \
+ DropDown = TRUE; \
+ Border = TRUE; \
+ }; \
+ PushButton PB_MALE \
+ { \
+ Pos = MAP_APPFONT ( 198 + LEFT_OFFSET , 48 + TOP_OFFSET ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ Text[ en-US ] = "N~ew..."; \
+ }; \
+ FixedText FI_FEMALE \
+ { \
+ Pos = MAP_APPFONT ( 18 + LEFT_OFFSET , 67 + TOP_OFFSET ) ; \
+ Size = MAP_APPFONT ( 225 , 8 ) ; \
+ Text[ en-US ] = "Address list field indicating a female recipient"; \
+ }; \
+ FixedText FT_FEMALECOLUMN \
+ { \
+ Pos = MAP_APPFONT ( 18 + LEFT_OFFSET , 80 + TOP_OFFSET ) ; \
+ Size = MAP_APPFONT ( 50 , 8 ) ; \
+ Text[ en-US ] = "Field name"; \
+ }; \
+ ListBox LB_FEMALECOLUMN \
+ { \
+ Pos = MAP_APPFONT ( 71 + LEFT_OFFSET , 78 + TOP_OFFSET ) ; \
+ Size = MAP_APPFONT ( 121 , 50 ) ; \
+ DropDown = TRUE; \
+ Border = TRUE; \
+ _LB_FEMALECOLUMN \
+ }; \
+ FixedText FT_FEMALEFIELD \
+ { \
+ Pos = MAP_APPFONT ( 18 + LEFT_OFFSET , 95 + TOP_OFFSET ) ; \
+ Size = MAP_APPFONT ( 50 , 8 ) ; \
+ Text[ en-US ] = "Field value"; \
+ }; \
+ ComboBox CB_FEMALEFIELD \
+ { \
+ Pos = MAP_APPFONT ( 71 + LEFT_OFFSET , 93 + TOP_OFFSET ) ; \
+ Size = MAP_APPFONT ( 121 , 50 ) ; \
+ DropDown = TRUE; \
+ Border = TRUE; \
+ }; \
+ FixedText FT_NEUTRAL \
+ { \
+ Pos = MAP_APPFONT ( 12 + LEFT_OFFSET , 113 + TOP_OFFSET ) ; \
+ Size = MAP_APPFONT ( 180 , 8 ) ; \
+ Text[ en-US ] = "General salutation"; \
+ }; \
+ ComboBox CB_NEUTRAL \
+ { \
+ Pos = MAP_APPFONT ( 12 + LEFT_OFFSET , 124 + TOP_OFFSET ) ; \
+ Size = MAP_APPFONT ( 180 , 50 ) ; \
+ DropDown = TRUE; \
+ Border = TRUE; \
+ };
+
+#define TOP_OFFSET 24
+#define LEFT_OFFSET 6
+
+TabPage DLG_MM_GREETINGS_PAGE
+{
+ HelpID = HID_MM_GREETINGSPAGE ;
+ Size = MAP_APPFONT ( 260 , 250 ) ;
+ Hide = TRUE ;
+
+ FixedText FI_HEADER
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Create a salutation";
+ };
+ CheckBox CB_GREETINGLINE
+ {
+ HelpID = "sw:CheckBox:DLG_MM_GREETINGS_PAGE:CB_GREETINGLINE";
+ Pos = MAP_APPFONT ( 12 , 27 );
+ Size = MAP_APPFONT ( 242 , 10 );
+ Text[ en-US ] = "This document should contain a salutation";
+ };
+ GREETINGS_BODY
+ FixedText FI_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 12 , 168 ) ;
+ Size = MAP_APPFONT ( 242 , 8 ) ;
+ Text[ en-US ] = "Preview";
+ };
+ Window WIN_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 12 , 179 );
+ Size = MAP_APPFONT ( 186 , 21 ) ;
+ Border = TRUE;
+ };
+ PushButton PB_ASSIGN
+ {
+ HelpID = "sw:PushButton:DLG_MM_GREETINGS_PAGE:PB_ASSIGN";
+ Pos = MAP_APPFONT ( 204 , 179 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text[ en-US ] = "~Match fields...";
+ };
+ FixedText FI_DOCINDEX
+ {
+ Pos = MAP_APPFONT ( 121 , 206 ) ;
+ Size = MAP_APPFONT ( 50, 8 ) ;
+ Right = TRUE;
+ };
+ ImageButton IB_PREVSET
+ {
+ HelpID = "sw:ImageButton:DLG_MM_GREETINGS_PAGE:IB_PREVSET";
+ Pos = MAP_APPFONT ( 177 , 204 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ SYMBOL = IMAGEBUTTON_PREV;
+ QuickHelpText[ en-US ] = "Preview Previous Salutation";
+ };
+ ImageButton IB_NEXTSET
+ {
+ HelpID = "sw:ImageButton:DLG_MM_GREETINGS_PAGE:IB_NEXTSET";
+ Pos = MAP_APPFONT ( 188 , 204 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ SYMBOL = IMAGEBUTTON_NEXT ;
+ QuickHelpText[ en-US ] = "Preview Next Salutation";
+ };
+ String STR_DOCUMENT
+ {
+ Text[ en-US ] = "Document: %1";
+ };
+};
+
+#undef TOP_OFFSET
+#undef LEFT_OFFSET
+
+#define TOP_OFFSET 0
+#define LEFT_OFFSET 0
+ModalDialog DLG_MM_MAILBODY
+{
+ HelpID = HID_MM_MAILBODY;
+ Size = MAP_APPFONT ( 254 , 238 ) ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Text [ en-US ] = "E-Mail Message";
+ CheckBox CB_GREETINGLINE
+ {
+ HelpID = "sw:CheckBox:DLG_MM_MAILBODY:CB_GREETINGLINE";
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text[ en-US ] = "This e-mail should contain a salutation";
+ };
+ GREETINGS_BODY
+ FixedText FT_BODY
+ {
+ Pos = MAP_APPFONT ( 12 , 140 ) ;
+ Size = MAP_APPFONT ( 174 , 8 ) ;
+ Text[ en-US ] = "Write your message here";
+ };
+ MultiLineEdit MLE_BODY
+ {
+ HelpID = "sw:MultiLineEdit:DLG_MM_MAILBODY:MLE_BODY";
+ Pos = MAP_APPFONT ( 12, 151 ) ;
+ Size = MAP_APPFONT ( 180 , 50 ) ;
+ Border = TRUE;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ VScroll = TRUE ;
+ HScroll = TRUE ;
+ IgnoreTab = TRUE;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 207 ) ;
+ Size = MAP_APPFONT ( 254 , 8 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 89, 218 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 142 , 218 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 198 , 218 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+
diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx
new file mode 100644
index 000000000000..d9ae7b9c518f
--- /dev/null
+++ b/sw/source/ui/dbui/mmlayoutpage.cxx
@@ -0,0 +1,816 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <swtypes.hxx>
+#include <mmlayoutpage.hxx>
+#include <mailmergewizard.hxx>
+#include <mmconfigitem.hxx>
+#include <mailmergehelper.hxx>
+#include <unotools.hxx>
+#include <unotools/tempfile.hxx>
+#include <uitool.hxx>
+#include <svx/dlgutil.hxx>
+#include <view.hxx>
+#include <swundo.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/docfilt.hxx>
+#include <com/sun/star/text/XParagraphCursor.hpp>
+#include <com/sun/star/view/XViewSettingsSupplier.hpp>
+#include <com/sun/star/view/DocumentZoomType.hpp>
+#include <fldmgr.hxx>
+#include <fldbas.hxx>
+#include <poolfmt.hxx>
+#include <unotxdoc.hxx>
+#include <docsh.hxx>
+#include <doc.hxx>
+#include <wrtsh.hxx>
+#include <fmtsrnd.hxx>
+#include <pagedesc.hxx>
+#include <fmtanchr.hxx>
+#include <fmtornt.hxx>
+#include <fmtfsize.hxx>
+#include <editeng/boxitem.hxx>
+#include <svl/urihelper.hxx>
+#include <shellio.hxx>
+#include <osl/file.hxx>
+#include <unoprnms.hxx>
+
+#include <mmlayoutpage.hrc>
+#include <dbui.hrc>
+#include <unomid.h>
+
+using namespace osl;
+using namespace svt;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::view;
+
+#define DEFAULT_LEFT_DISTANCE (MM50*5) // 2,5 cm
+#define DEFAULT_TOP_DISTANCE (MM50*11) // 5,5 cm
+#define GREETING_TOP_DISTANCE (MM50*25) //12,5 cm
+#define DEFAULT_ADDRESS_WIDTH (MM50*15)// 7,5 cm
+#define DEFAULT_ADDRESS_HEIGHT (MM50*7) // 3,5cm
+
+/*-- 15.04.2004 08:16:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) :
+ svt::OWizardPage( _pParent, SW_RES(DLG_MM_LAYOUT_PAGE)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aHeaderFI( this, SW_RES( FI_HEADER )),
+ m_aPositionFL( this, SW_RES( FL_POSITION )),
+ m_aAlignToBodyCB( this, SW_RES( CB_ALIGN )),
+ m_aLeftFT( this, SW_RES( FT_LEFT )),
+ m_aLeftMF( this, SW_RES( MF_LEFT )),
+ m_aTopFT( this, SW_RES( FT_TOP )),
+ m_aTopMF( this, SW_RES( MF_TOP )),
+ m_aGreetingLineFL( this, SW_RES( FL_GREETINGLINE )),
+ m_aUpFT( this, SW_RES( FT_UP )),
+ m_aUpPB( this, SW_RES( MF_UP )),
+ m_aDownFT( this, SW_RES( FT_DOWN )),
+ m_aDownPB( this, SW_RES( PB_DOWN )),
+ m_aExampleContainerWIN( this, SW_RES( WIN_EXAMPLECONTAINER )),
+ m_aExampleWIN( this, 0 ),
+ m_aZoomFT( this, SW_RES( FT_ZOOM )),
+ m_aZoomLB( this, SW_RES( LB_ZOOM )),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_pExampleFrame(0),
+ m_pExampleWrtShell(0),
+ m_pAddressBlockFormat(0),
+ m_bIsGreetingInserted(false),
+ m_pWizard(_pParent)
+{
+ FreeResource();
+ m_aExampleWIN.SetPosSizePixel(m_aExampleContainerWIN.GetPosPixel(),
+ m_aExampleContainerWIN.GetSizePixel());
+
+
+ const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat(
+ String::CreateFromAscii( FILTER_XML ),
+ SwDocShell::Factory().GetFilterContainer() );
+ //save the current document into a temporary file
+ {
+ //temp file needs it's own block
+ //creating with extension is not supported by a static method :-(
+ String sLeading;
+ String sExt(pSfxFlt->GetDefaultExtension());
+ sExt.EraseLeadingChars('*');
+ utl::TempFile aTempFile( sLeading, &sExt );
+ m_sExampleURL = aTempFile.GetURL();
+ aTempFile.EnableKillingFile();
+ }
+ SwView* pView = m_pWizard->GetSwView();
+ uno::Sequence< beans::PropertyValue > aValues(1);
+ beans::PropertyValue* pValues = aValues.getArray();
+ pValues[0].Name = C2U("FilterName");
+ pValues[0].Value <<= ::rtl::OUString(pSfxFlt->GetFilterName());
+
+ uno::Reference< frame::XStorable > xStore( pView->GetDocShell()->GetModel(), uno::UNO_QUERY);
+ xStore->storeToURL( m_sExampleURL, aValues );
+
+ Link aLink(LINK(this, SwMailMergeLayoutPage, PreviewLoadedHdl_Impl));
+ m_pExampleFrame = new SwOneExampleFrame( m_aExampleWIN,
+ EX_SHOW_DEFAULT_PAGE, &aLink, &m_sExampleURL );
+
+ m_aExampleWIN.Show( FALSE );
+ m_aExampleContainerWIN.Show(TRUE);
+
+ m_aLeftMF.SetValue(m_aLeftMF.Normalize(DEFAULT_LEFT_DISTANCE), FUNIT_TWIP);
+ m_aTopMF.SetValue(m_aTopMF.Normalize(DEFAULT_TOP_DISTANCE), FUNIT_TWIP);
+
+ m_aZoomLB.InsertEntry(String::CreateFromAscii("50 %"), 1);
+ m_aZoomLB.InsertEntry(String::CreateFromAscii("75 %"), 2);
+ m_aZoomLB.InsertEntry(String::CreateFromAscii("100 %"), 3);
+ m_aZoomLB.SelectEntryPos(0); //page size
+ m_aZoomLB.SetSelectHdl(LINK(this, SwMailMergeLayoutPage, ZoomHdl_Impl));
+
+ Link aFrameHdl = LINK(this, SwMailMergeLayoutPage, ChangeAddressHdl_Impl);
+ m_aLeftMF.SetUpHdl(aFrameHdl);
+ m_aLeftMF.SetDownHdl(aFrameHdl);
+ m_aLeftMF.SetLoseFocusHdl(aFrameHdl);
+ m_aTopMF.SetUpHdl(aFrameHdl);
+ m_aTopMF.SetDownHdl(aFrameHdl);
+ m_aTopMF.SetLoseFocusHdl(aFrameHdl);
+
+ FieldUnit eFieldUnit = ::GetDfltMetric(sal_False);
+ ::SetFieldUnit( m_aLeftMF, eFieldUnit );
+ ::SetFieldUnit( m_aTopMF, eFieldUnit );
+
+ Link aUpDownHdl = LINK(this, SwMailMergeLayoutPage, GreetingsHdl_Impl );
+ m_aUpPB.SetClickHdl(aUpDownHdl);
+ m_aDownPB.SetClickHdl(aUpDownHdl);
+ m_aAlignToBodyCB.SetClickHdl(LINK(this, SwMailMergeLayoutPage, AlignToTextHdl_Impl));
+ m_aAlignToBodyCB.Check();
+}
+/*-- 15.04.2004 08:17:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeLayoutPage::~SwMailMergeLayoutPage()
+{
+ delete m_pExampleFrame;
+ File::remove( m_sExampleURL );
+
+}
+/*-- 27.05.2004 13:41:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeLayoutPage::ActivatePage()
+{
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ sal_Bool bGreetingLine = rConfigItem.IsGreetingLine(sal_False) && !rConfigItem.IsGreetingInserted();
+ sal_Bool bAddressBlock = rConfigItem.IsAddressBlock() && !rConfigItem.IsAddressInserted();
+
+ m_aPositionFL.Enable(bAddressBlock);
+ m_aLeftFT.Enable(bAddressBlock);
+ m_aTopFT.Enable(bAddressBlock);
+ m_aLeftMF.Enable(bAddressBlock);
+ m_aTopMF.Enable(bAddressBlock);
+ AlignToTextHdl_Impl( &m_aAlignToBodyCB );
+
+ m_aGreetingLineFL.Enable(bGreetingLine);
+ m_aUpPB.Enable(bGreetingLine);
+ m_aDownPB.Enable(bGreetingLine);
+ m_aUpFT.Enable(bGreetingLine);
+ m_aDownFT.Enable(bGreetingLine);
+
+ //check if greeting and/or address frame have to be inserted/removed
+ if(m_pExampleWrtShell) // initially there's nothing to check
+ {
+ if(!rConfigItem.IsGreetingInserted() &&
+ m_bIsGreetingInserted != (0 != bGreetingLine) )
+ {
+ if( m_bIsGreetingInserted )
+ {
+ m_pExampleWrtShell->DelFullPara();
+ m_bIsGreetingInserted = false;
+ }
+ else
+ {
+ InsertGreeting(*m_pExampleWrtShell, m_pWizard->GetConfigItem(), true);
+ m_bIsGreetingInserted = true;
+ }
+ }
+ if(!rConfigItem.IsAddressInserted() &&
+ rConfigItem.IsAddressBlock() != ( 0 != m_pAddressBlockFormat ))
+ {
+ if( m_pAddressBlockFormat )
+ {
+ m_pExampleWrtShell->Push();
+ m_pExampleWrtShell->GotoFly( m_pAddressBlockFormat->GetName() );
+ m_pExampleWrtShell->DelRight();
+ m_pAddressBlockFormat = 0;
+ m_pExampleWrtShell->Pop(FALSE);
+ }
+ else
+ {
+ long nLeft = static_cast< long >(m_aLeftMF.Denormalize(m_aLeftMF.GetValue(FUNIT_TWIP)));
+ long nTop = static_cast< long >(m_aTopMF.Denormalize(m_aTopMF.GetValue(FUNIT_TWIP)));
+ m_pAddressBlockFormat = InsertAddressFrame(
+ *m_pExampleWrtShell, m_pWizard->GetConfigItem(),
+ Point(nLeft, nTop),
+ m_aAlignToBodyCB.IsChecked(), true);
+ }
+ }
+
+ }
+}
+/*-- 11.05.2004 10:41:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergeLayoutPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason )
+{
+ //now insert the frame and the greeting
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ if(::svt::WizardTypes::eTravelForward == _eReason)
+ {
+ long nLeft = static_cast< long >(m_aLeftMF.Denormalize(m_aLeftMF.GetValue(FUNIT_TWIP)));
+ long nTop = static_cast< long >(m_aTopMF.Denormalize(m_aTopMF.GetValue(FUNIT_TWIP)));
+ InsertAddressAndGreeting(
+ m_pWizard->GetSwView(),
+ rConfigItem,
+ Point(nLeft, nTop),
+ m_aAlignToBodyCB.IsChecked());
+ }
+ return sal_True;
+}
+/*-- 24.06.2004 09:50:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwFrmFmt* SwMailMergeLayoutPage::InsertAddressAndGreeting(SwView* pView,
+ SwMailMergeConfigItem& rConfigItem,
+ const Point& rAddressPosition,
+ bool bAlignToBody)
+{
+ SwFrmFmt* pAddressBlockFormat = 0;
+ pView->GetWrtShell().StartUndo(UNDO_INSERT);
+ if(rConfigItem.IsAddressBlock() && !rConfigItem.IsAddressInserted())
+ {
+ //insert the frame
+ Point aAddressPosition(DEFAULT_LEFT_DISTANCE, DEFAULT_TOP_DISTANCE);
+ if(rAddressPosition.X() > 0 && rAddressPosition.Y() > 0)
+ aAddressPosition = rAddressPosition;
+ pAddressBlockFormat = InsertAddressFrame( pView->GetWrtShell(),
+ rConfigItem,
+ aAddressPosition, bAlignToBody, false);
+ rConfigItem.SetAddressInserted(pAddressBlockFormat->GetName());
+ }
+ //now the greeting
+ if(rConfigItem.IsGreetingLine(sal_False) && !rConfigItem.IsGreetingInserted())
+ {
+ InsertGreeting( pView->GetWrtShell(), rConfigItem, false);
+ rConfigItem.SetGreetingInserted();
+ }
+ pView->GetWrtShell().EndUndo(UNDO_INSERT);
+ return pAddressBlockFormat;
+}
+/*-- 11.05.2004 12:49:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwFrmFmt* SwMailMergeLayoutPage::InsertAddressFrame(
+ SwWrtShell& rShell,
+ SwMailMergeConfigItem& rConfigItem,
+ const Point& rDestination,
+ bool bAlignLeft,
+ bool bExample)
+{
+ // insert the address block and the greeting line
+ SfxItemSet aSet(rShell.GetAttrPool(), RES_ANCHOR, RES_ANCHOR,
+ RES_VERT_ORIENT, RES_VERT_ORIENT,
+ RES_HORI_ORIENT, RES_HORI_ORIENT,
+ RES_BOX, RES_BOX,
+ RES_FRM_SIZE, RES_FRM_SIZE,
+ RES_SURROUND, RES_SURROUND,
+ 0 );
+ aSet.Put(SwFmtAnchor(FLY_AT_PAGE, 1));
+ if(bAlignLeft)
+ aSet.Put(SwFmtHoriOrient( 0, text::HoriOrientation::NONE, text::RelOrientation::PAGE_PRINT_AREA ));
+ else
+ aSet.Put(SwFmtHoriOrient( rDestination.X(), text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
+ aSet.Put(SwFmtVertOrient( rDestination.Y(), text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
+ aSet.Put(SwFmtFrmSize( ATT_MIN_SIZE, DEFAULT_ADDRESS_WIDTH, DEFAULT_ADDRESS_HEIGHT ));
+ // the example gets a border around the frame, the real document doesn't get one
+ if(!bExample)
+ aSet.Put(SvxBoxItem( RES_BOX ));
+ aSet.Put(SwFmtSurround( SURROUND_NONE ));
+
+ rShell.NewFlyFrm(aSet, sal_True );
+ SwFrmFmt* pRet = rShell.GetFlyFrmFmt();
+ ASSERT( pRet, "Fly not inserted" );
+
+ rShell.UnSelectFrm();
+ const Sequence< ::rtl::OUString> aBlocks = rConfigItem.GetAddressBlocks();
+ if(bExample)
+ {
+ rShell.Insert(aBlocks[0]);
+ }
+ else
+ {
+ //the placeholders should be replaced by the appropriate fields
+ SwFldMgr aFldMgr(&rShell);
+ //create a database string source.command.commandtype.column
+ const SwDBData& rData = rConfigItem.GetCurrentDBData();
+ String sDBName(rData.sDataSource);
+ sDBName += DB_DELIM;
+ sDBName += String(rData.sCommand);
+ sDBName += DB_DELIM;
+ String sDatabaseConditionPrefix(sDBName);
+ sDatabaseConditionPrefix.SearchAndReplaceAll(DB_DELIM, '.');
+ sDBName += String::CreateFromInt32(rData.nCommandType);
+ sDBName += DB_DELIM;
+
+ // if only the country is in an address line the
+ // paragraph has to be hidden depending on the
+ // IsIncludeCountry()/GetExcludeCountry() settings
+
+ sal_Bool bIncludeCountry = rConfigItem.IsIncludeCountry();
+ sal_Bool bHideEmptyParagraphs = rConfigItem.IsHideEmptyParagraphs();
+ const ::rtl::OUString rExcludeCountry = rConfigItem.GetExcludeCountry();
+ bool bSpecialReplacementForCountry = (!bIncludeCountry || rExcludeCountry.getLength());
+
+ const ResStringArray& rHeaders = rConfigItem.GetDefaultAddressHeaders();
+ String sCountryColumn = rHeaders.GetString(MM_PART_COUNTRY);
+ Sequence< ::rtl::OUString> aAssignment =
+ rConfigItem.GetColumnAssignment( rConfigItem.GetCurrentDBData() );
+ const ::rtl::OUString* pAssignment = aAssignment.getConstArray();
+ if(aAssignment.getLength() > MM_PART_COUNTRY && aAssignment[MM_PART_COUNTRY].getLength())
+ sCountryColumn = aAssignment[MM_PART_COUNTRY];
+ //
+ String sHideParagraphsExpression;
+ SwAddressIterator aIter(aBlocks[0]);
+ while(aIter.HasMore())
+ {
+ SwMergeAddressItem aItem = aIter.Next();
+ if(aItem.bIsColumn)
+ {
+ String sConvertedColumn = aItem.sText;
+ for(USHORT nColumn = 0;
+ nColumn < rHeaders.Count() && nColumn < aAssignment.getLength();
+ ++nColumn)
+ {
+ if(rHeaders.GetString(nColumn) == aItem.sText &&
+ pAssignment[nColumn].getLength())
+ {
+ sConvertedColumn = pAssignment[nColumn];
+ break;
+ }
+ }
+ String sDB(sDBName);
+ sDB += sConvertedColumn;
+
+ if(sHideParagraphsExpression.Len())
+ sHideParagraphsExpression.AppendAscii(" AND ");
+ sHideParagraphsExpression += '!';
+ sHideParagraphsExpression += '[';
+ sHideParagraphsExpression += sDatabaseConditionPrefix;
+ sHideParagraphsExpression += sConvertedColumn;
+ sHideParagraphsExpression += ']';
+
+ if( bSpecialReplacementForCountry && sCountryColumn == sConvertedColumn )
+ {
+ // now insert a hidden paragraph field
+ String sExpression;
+ if( rExcludeCountry.getLength() )
+ {
+ sExpression = sDatabaseConditionPrefix;
+ sExpression.Insert('[', 0);
+ sExpression += sCountryColumn;
+ sExpression.AppendAscii("]");
+
+ String sCondition(sExpression);
+ sCondition.AppendAscii(" != \"");
+ sCondition += String(rExcludeCountry);
+ sCondition += '\"';
+
+ SwInsertFld_Data aData(TYP_CONDTXTFLD, 0, sCondition, sExpression, 0, &rShell );
+ aFldMgr.InsertFld( aData );
+ }
+ else
+ {
+ SwInsertFld_Data aData(TYP_HIDDENPARAFLD, 0, sExpression, aEmptyStr, 0, &rShell );
+ aFldMgr.InsertFld( aData );
+ }
+ }
+ else
+ {
+ SwInsertFld_Data aData(TYP_DBFLD, 0, sDB, aEmptyStr, 0, &rShell );
+ aFldMgr.InsertFld( aData );
+ }
+ }
+ else if(!aItem.bIsReturn)
+ {
+ rShell.Insert(aItem.sText);
+ }
+ else
+ {
+ if(bHideEmptyParagraphs)
+ {
+ SwInsertFld_Data aData(TYP_HIDDENPARAFLD, 0, sHideParagraphsExpression, aEmptyStr, 0, &rShell );
+ aFldMgr.InsertFld( aData );
+ }
+ sHideParagraphsExpression.Erase();
+ //now add a new paragraph
+ rShell.SplitNode();
+ }
+ }
+ if(bHideEmptyParagraphs && sHideParagraphsExpression.Len())
+ {
+ SwInsertFld_Data aData(TYP_HIDDENPARAFLD, 0, sHideParagraphsExpression, aEmptyStr, 0, &rShell );
+ aFldMgr.InsertFld( aData );
+ }
+ }
+ return pRet;
+}
+
+/*-- 12.05.2004 12:20:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfigItem& rConfigItem, bool bExample)
+{
+ //set the cursor to the desired position - if no text content is here then
+ //new paragraphs are inserted
+ const SwRect& rPageRect = rShell.GetAnyCurRect(RECT_PAGE);
+ const Point aGreetingPos( DEFAULT_LEFT_DISTANCE + rPageRect.Left(), GREETING_TOP_DISTANCE );
+
+ const sal_Bool bRet = rShell.SetShadowCrsrPos( aGreetingPos, FILL_SPACE );
+
+ if(!bRet)
+ {
+ //there's already text at the desired position
+ //go to start of the doc, directly!
+ rShell.SttEndDoc(TRUE);
+ //and go by paragraph until the position is reached
+ long nYPos = rShell.GetCharRect().Top();
+ while(nYPos < GREETING_TOP_DISTANCE)
+ {
+ if(!rShell.FwdPara())
+ break;
+ nYPos = rShell.GetCharRect().Top();
+ }
+ //text needs to be appended
+ while(nYPos < GREETING_TOP_DISTANCE)
+ {
+ if(!rShell.AppendTxtNode())
+ break;
+ nYPos = rShell.GetCharRect().Top();
+ }
+ }
+ else
+ {
+ //we may end up inside of a paragraph if the left margin is not at DEFAULT_LEFT_DISTANCE
+ rShell.MovePara(GetfnParaCurr(), GetfnParaStart());
+ }
+ bool bSplitNode = rShell.GetText().Len() > 0;
+// rShell.SetTxtFmtColl( rShell.GetTxtCollFromPool( RES_POOLCOLL_GREETING ) );
+ sal_Int32 nMoves = rConfigItem.GetGreetingMoves();
+ if( !bExample && 0 != nMoves )
+ {
+ if(nMoves < 0)
+ {
+ rShell.MoveParagraph( nMoves );
+ }
+ else
+ while(nMoves)
+ {
+ sal_Bool bMoved = rShell.MoveParagraph( 1 );
+ if(!bMoved)
+ {
+ //insert a new paragraph before the greeting line
+ rShell.SplitNode();
+ }
+ --nMoves;
+ }
+ }
+ //now insert the greeting text - if we have any?
+ const sal_Bool bIndividual = rConfigItem.IsIndividualGreeting(sal_False);
+ String sGreeting;
+ if(bIndividual)
+ {
+ //lock expression fields - prevents hiding of the paragraph to insert into
+ rShell.LockExpFlds();
+ if(bExample)
+ {
+ for(sal_Int8 eGender = SwMailMergeConfigItem::FEMALE;
+ eGender <= SwMailMergeConfigItem::NEUTRAL; ++eGender)
+ {
+ Sequence< ::rtl::OUString > aEntries =
+ rConfigItem.GetGreetings((SwMailMergeConfigItem::Gender)eGender);
+ sal_Int32 nCurrent = rConfigItem.GetCurrentGreeting((SwMailMergeConfigItem::Gender)eGender);
+ if( nCurrent >= 0 && nCurrent < aEntries.getLength())
+ {
+ sGreeting = aEntries[nCurrent];
+ rShell.Insert(sGreeting);
+ break;
+ }
+ }
+ }
+ else
+ {
+ SwFldMgr aFldMgr(&rShell);
+ //three paragraphs, each with an appropriate hidden paragraph field
+ //are to be inserted
+
+ //name of the gender column
+ String sGenderColumn = rConfigItem.GetAssignedColumn(MM_PART_GENDER);
+ String sNameColumn = rConfigItem.GetAssignedColumn(MM_PART_LASTNAME);
+
+ const ::rtl::OUString& rFemaleGenderValue = rConfigItem.GetFemaleGenderValue();
+ sal_Bool bHideEmptyParagraphs = rConfigItem.IsHideEmptyParagraphs();
+ const SwDBData& rData = rConfigItem.GetCurrentDBData();
+ String sConditionBase(rData.sDataSource);
+ sConditionBase += '.';
+ sConditionBase += String(rData.sCommand);
+ sConditionBase += '.';
+ //split the name column from here
+ String sNameColumnBase(sConditionBase);
+
+ sConditionBase += String(sGenderColumn);
+ sConditionBase += ']';
+ sConditionBase.Insert('[', 0);
+
+ sNameColumnBase += String(sNameColumn);
+ sNameColumnBase += ']';
+ sNameColumnBase.Insert('[', 0);
+
+ String sDBName(rData.sDataSource);
+ sDBName += DB_DELIM;
+ sDBName += String(rData.sCommand);
+ sDBName += DB_DELIM;
+ sDBName += String::CreateFromInt32(rData.nCommandType);
+ sDBName += DB_DELIM;
+
+// Female: [database.sGenderColumn] != "rFemaleGenderValue" && [database.NameColumn]
+// Male: [database.sGenderColumn] == "rFemaleGenderValue" && [database.rGenderColumn]
+// Neutral: [database.sNameColumn]
+ DBG_ASSERT(sGenderColumn.Len() && rFemaleGenderValue.getLength(),
+ "gender settings not available - how to form the condition?");
+ //column used as lastname
+ for(sal_Int8 eGender = SwMailMergeConfigItem::FEMALE;
+ eGender <= SwMailMergeConfigItem::NEUTRAL; ++eGender)
+ {
+ Sequence< ::rtl::OUString> aEntries = rConfigItem.GetGreetings((SwMailMergeConfigItem::Gender)eGender);
+ sal_Int32 nCurrent = rConfigItem.GetCurrentGreeting((SwMailMergeConfigItem::Gender)eGender);
+ if( nCurrent >= 0 && nCurrent < aEntries.getLength())
+ {
+ sGreeting = aEntries[nCurrent];
+ String sCondition(sConditionBase);
+ String sHideParagraphsExpression;
+ switch(eGender)
+ {
+ case SwMailMergeConfigItem::FEMALE:
+ sCondition.AppendAscii(" != \"");
+ sCondition += String(rFemaleGenderValue);
+ sCondition.AppendAscii("\" OR NOT ");
+ sCondition += String(sNameColumnBase);
+
+ sHideParagraphsExpression += '!';
+ sHideParagraphsExpression += sNameColumnBase;
+ break;
+ case SwMailMergeConfigItem::MALE:
+ sCondition.AppendAscii(" == \"");
+ sCondition += String(rFemaleGenderValue);
+ sCondition.AppendAscii("\" OR NOT ");
+ sCondition += String(sNameColumnBase);
+ break;
+ case SwMailMergeConfigItem::NEUTRAL:
+ sCondition = sNameColumnBase;
+ break;
+ }
+
+ if(bHideEmptyParagraphs && sHideParagraphsExpression.Len())
+ {
+ String sComplete( sCondition );
+ sComplete.Insert('(', 0);
+ sComplete.AppendAscii( ") OR (");
+ sComplete += sHideParagraphsExpression;
+ sComplete += ')';
+ SwInsertFld_Data aData(TYP_HIDDENPARAFLD, 0, sComplete, aEmptyStr, 0, &rShell );
+ aFldMgr.InsertFld( aData );
+ }
+ else
+ {
+ SwInsertFld_Data aData(TYP_HIDDENPARAFLD, 0, sCondition, aEmptyStr, 0, &rShell );
+ aFldMgr.InsertFld( aData );
+ }
+ //now the text has to be inserted
+ const ResStringArray& rHeaders = rConfigItem.GetDefaultAddressHeaders();
+ Sequence< ::rtl::OUString> aAssignment =
+ rConfigItem.GetColumnAssignment( rConfigItem.GetCurrentDBData() );
+ const ::rtl::OUString* pAssignment = aAssignment.getConstArray();
+ SwAddressIterator aIter(sGreeting);
+ while(aIter.HasMore())
+ {
+ SwMergeAddressItem aItem = aIter.Next();
+ if(aItem.bIsColumn)
+ {
+ String sDB(sDBName);
+ String sConvertedColumn = aItem.sText;
+ for(USHORT nColumn = 0;
+ nColumn < rHeaders.Count() && nColumn < aAssignment.getLength();
+ ++nColumn)
+ {
+ if(rHeaders.GetString(nColumn) == aItem.sText &&
+ pAssignment[nColumn].getLength())
+ {
+ sConvertedColumn = pAssignment[nColumn];
+ break;
+ }
+ }
+ sDB += sConvertedColumn;
+ SwInsertFld_Data aData(TYP_DBFLD, 0, sDB, aEmptyStr, 0, &rShell );
+ aFldMgr.InsertFld( aData );
+ }
+ else
+ {
+ rShell.Insert(aItem.sText);
+ }
+ }
+ //now add a new paragraph
+ rShell.SplitNode();
+ }
+ }
+
+ }
+ rShell.UnlockExpFlds();
+ }
+ else
+ {
+ Sequence< ::rtl::OUString> aEntries = rConfigItem.GetGreetings(SwMailMergeConfigItem::NEUTRAL);
+ sal_Int32 nCurrent = rConfigItem.GetCurrentGreeting(SwMailMergeConfigItem::NEUTRAL);
+ if( nCurrent >= 0 && nCurrent < aEntries.getLength())
+ sGreeting = aEntries[nCurrent];
+ rShell.Insert(sGreeting);
+ }
+ // now insert a new paragraph here if necessary
+ if(bSplitNode)
+ {
+ rShell.Push();
+ rShell.SplitNode();
+ rShell.Pop(FALSE);
+ }
+ //put the cursor to the start of the paragraph
+ rShell.SttPara();
+
+ DBG_ASSERT(0 == rShell.GetTableFmt(), "What to do with a table here?");
+}
+/*-- 10.05.2004 09:34:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeLayoutPage, PreviewLoadedHdl_Impl, void*, EMPTYARG)
+{
+ m_aExampleWIN.Show( TRUE );
+ m_aExampleContainerWIN.Show(FALSE);
+
+ Reference< XModel > & xModel = m_pExampleFrame->GetModel();
+ //now the ViewOptions should be set properly
+ Reference< XViewSettingsSupplier > xSettings(xModel->getCurrentController(), UNO_QUERY);
+ m_xViewProperties = xSettings->getViewSettings();
+ Reference< XUnoTunnel > xDocTunnel(xModel, UNO_QUERY);
+ SwXTextDocument* pXDoc = reinterpret_cast<SwXTextDocument*>(xDocTunnel->getSomething(SwXTextDocument::getUnoTunnelId()));
+ SwDocShell* pDocShell = pXDoc->GetDocShell();
+ m_pExampleWrtShell = pDocShell->GetWrtShell();
+ DBG_ASSERT(m_pExampleWrtShell, "No SwWrtShell found!");
+ if(!m_pExampleWrtShell)
+ return 0;
+
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ if(rConfigItem.IsAddressBlock())
+ {
+ m_pAddressBlockFormat = InsertAddressFrame(
+ *m_pExampleWrtShell, rConfigItem,
+ Point(DEFAULT_LEFT_DISTANCE, DEFAULT_TOP_DISTANCE),
+ m_aAlignToBodyCB.IsChecked(), true);
+ }
+ if(rConfigItem.IsGreetingLine(sal_False))
+ {
+ InsertGreeting(*m_pExampleWrtShell, rConfigItem, true);
+ m_bIsGreetingInserted = true;
+ }
+
+ Any aZoom;
+ aZoom <<= (sal_Int16)DocumentZoomType::ENTIRE_PAGE;
+ m_xViewProperties->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_TYPE)), aZoom);
+
+
+// m_pExampleWrtShell->SetTxtFmtColl( rSh.GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) );
+ const SwFmtFrmSize& rPageSize = m_pExampleWrtShell->GetPageDesc(
+ m_pExampleWrtShell->GetCurPageDesc()).GetMaster().GetFrmSize();
+ m_aLeftMF.SetMax(rPageSize.GetWidth() - DEFAULT_LEFT_DISTANCE);
+ m_aTopMF.SetMax(rPageSize.GetHeight() - DEFAULT_TOP_DISTANCE);
+ return 0;
+}
+/*-- 10.05.2004 14:05:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeLayoutPage, ZoomHdl_Impl, ListBox*, pBox)
+{
+ if(m_pExampleWrtShell)
+ {
+ sal_Int16 eType = DocumentZoomType::BY_VALUE;
+ short nZoom = 50;
+ switch(pBox->GetSelectEntryPos())
+ {
+ case 0 : eType = DocumentZoomType::ENTIRE_PAGE; break;
+ case 1 : nZoom = 50; break;
+ case 2 : nZoom = 75; break;
+ case 3 : nZoom = 100; break;
+ }
+ Any aZoom;
+ aZoom <<= eType;
+ m_xViewProperties->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_TYPE)), aZoom);
+ aZoom <<= nZoom;
+ m_xViewProperties->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_VALUE)), aZoom);
+
+ }
+ return 0;
+}
+
+
+/*-- 10.05.2004 15:56:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeLayoutPage, ChangeAddressHdl_Impl, MetricField*, EMPTYARG)
+{
+ if(m_pExampleWrtShell && m_pAddressBlockFormat)
+ {
+ long nLeft = static_cast< long >(m_aLeftMF.Denormalize(m_aLeftMF.GetValue(FUNIT_TWIP)));
+ long nTop = static_cast< long >(m_aTopMF.Denormalize(m_aTopMF.GetValue(FUNIT_TWIP)));
+
+ SfxItemSet aSet(m_pExampleWrtShell->GetAttrPool(), RES_ANCHOR, RES_ANCHOR,
+ RES_VERT_ORIENT, RES_VERT_ORIENT,
+ RES_HORI_ORIENT, RES_HORI_ORIENT,
+ 0 );
+ if(m_aAlignToBodyCB.IsChecked())
+ aSet.Put(SwFmtHoriOrient( 0, text::HoriOrientation::NONE, text::RelOrientation::PAGE_PRINT_AREA ));
+ else
+ aSet.Put(SwFmtHoriOrient( nLeft, text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
+ aSet.Put(SwFmtVertOrient( nTop, text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
+ m_pExampleWrtShell->GetDoc()->SetFlyFrmAttr( *m_pAddressBlockFormat, aSet );
+ }
+ return 0;
+}
+
+/*-- 10.05.2004 16:13:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeLayoutPage, GreetingsHdl_Impl, PushButton*, pButton)
+{
+ bool bDown = pButton == &m_aDownPB;
+ BOOL bMoved = m_pExampleWrtShell->MoveParagraph( bDown ? 1 : -1 );
+ if (bMoved || bDown)
+ m_pWizard->GetConfigItem().MoveGreeting(bDown ? 1 : -1 );
+ if(!bMoved && bDown)
+ {
+ //insert a new paragraph before the greeting line
+ m_pExampleWrtShell->SplitNode();
+ }
+
+ return 0;
+}
+/*-- 15.07.2004 16:05:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeLayoutPage, AlignToTextHdl_Impl, CheckBox*, pBox)
+{
+ sal_Bool bCheck = pBox->IsChecked() && pBox->IsEnabled();
+ m_aLeftFT.Enable(!bCheck);
+ m_aLeftMF.Enable(!bCheck);
+ ChangeAddressHdl_Impl( 0 );
+ return 0;
+}
diff --git a/sw/source/ui/dbui/mmlayoutpage.hrc b/sw/source/ui/dbui/mmlayoutpage.hrc
new file mode 100644
index 000000000000..a54ba58fa025
--- /dev/null
+++ b/sw/source/ui/dbui/mmlayoutpage.hrc
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGELAYOUTPAGE_HRC
+#define _MAILMERGELAYOUTPAGE_HRC
+
+#define FI_HEADER 1
+#define FL_POSITION 2
+#define FT_LEFT 3
+#define MF_LEFT 4
+#define FT_TOP 5
+#define MF_TOP 6
+#define FL_GREETINGLINE 7
+#define FT_UP 8
+#define MF_UP 9
+#define FT_DOWN 10
+#define PB_DOWN 11
+#define CB_ALIGN 12
+
+#define WIN_EXAMPLECONTAINER 13
+#define FT_ZOOM 14
+#define LB_ZOOM 15
+
+#endif
+
diff --git a/sw/source/ui/dbui/mmlayoutpage.hxx b/sw/source/ui/dbui/mmlayoutpage.hxx
new file mode 100644
index 000000000000..b7dd9dfab2e6
--- /dev/null
+++ b/sw/source/ui/dbui/mmlayoutpage.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGELAYOUTPAGE_HXX
+#define _MAILMERGELAYOUTPAGE_HXX
+
+#include <svtools/wizardmachine.hxx>
+#include <mailmergehelper.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+#include <vcl/field.hxx>
+#include <vcl/lstbox.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+class SwMailMergeWizard;
+class SwFrmFmt;
+class SwOneExampleFrame;
+class SwWrtShell;
+class SwView;
+
+namespace com{ namespace sun{ namespace star{ namespace beans{ class XPropertySet;}}}}
+/*-- 02.04.2004 09:21:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailMergeLayoutPage : public svt::OWizardPage
+{
+ SwBoldFixedInfo m_aHeaderFI;
+
+ FixedLine m_aPositionFL;
+
+ CheckBox m_aAlignToBodyCB;
+ FixedText m_aLeftFT;
+ MetricField m_aLeftMF;
+ FixedText m_aTopFT;
+ MetricField m_aTopMF;
+
+ FixedLine m_aGreetingLineFL;
+ FixedText m_aUpFT;
+ PushButton m_aUpPB;
+ FixedText m_aDownFT;
+ PushButton m_aDownPB;
+
+ Window m_aExampleContainerWIN;
+ Window m_aExampleWIN;
+
+ FixedText m_aZoomFT;
+ ListBox m_aZoomLB;
+
+ SwOneExampleFrame* m_pExampleFrame;
+ SwWrtShell* m_pExampleWrtShell;
+
+ String m_sExampleURL;
+ SwFrmFmt* m_pAddressBlockFormat;
+
+ bool m_bIsGreetingInserted;
+
+ SwMailMergeWizard* m_pWizard;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xViewProperties;
+
+ DECL_LINK(PreviewLoadedHdl_Impl, void*);
+ DECL_LINK(ZoomHdl_Impl, ListBox*);
+ DECL_LINK(ChangeAddressHdl_Impl, MetricField*);
+ DECL_LINK(GreetingsHdl_Impl, PushButton*);
+ DECL_LINK(AlignToTextHdl_Impl, CheckBox*);
+
+ static SwFrmFmt* InsertAddressFrame(
+ SwWrtShell& rShell,
+ SwMailMergeConfigItem& rConfigItem,
+ const Point& rDestination,
+ bool bAlignToBody,
+ bool bExample);
+ static void InsertGreeting(SwWrtShell& rShell, SwMailMergeConfigItem& rConfigItem, bool bExample);
+
+ virtual void ActivatePage();
+ virtual sal_Bool commitPage(::svt::WizardTypes::CommitPageReason _eReason);
+public:
+ SwMailMergeLayoutPage( SwMailMergeWizard* _pParent);
+ ~SwMailMergeLayoutPage();
+
+ static SwFrmFmt* InsertAddressAndGreeting(SwView* pView,
+ SwMailMergeConfigItem& rConfigItem,
+ const Point& rAddressPos,
+ bool bAlignToBody);
+};
+
+#endif
+
+
diff --git a/sw/source/ui/dbui/mmlayoutpage.src b/sw/source/ui/dbui/mmlayoutpage.src
new file mode 100644
index 000000000000..55750c2de6e4
--- /dev/null
+++ b/sw/source/ui/dbui/mmlayoutpage.src
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <mmlayoutpage.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+TabPage DLG_MM_LAYOUT_PAGE
+{
+ HelpID = HID_MM_LAYOUT_PAGE;
+ Size = MAP_APPFONT ( 260 , 250 ) ;
+ Hide = TRUE ;
+
+ FixedText FI_HEADER
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "Adjust layout of address block and salutation";
+ };
+ FixedLine FL_POSITION
+ {
+ Pos = MAP_APPFONT ( 6 , 27 ) ;
+ Size = MAP_APPFONT ( 118 , 8 ) ;
+ Text[ en-US ] = "Address block position";
+ };
+ CheckBox CB_ALIGN
+ {
+ HelpID = "sw:CheckBox:DLG_MM_LAYOUT_PAGE:CB_ALIGN";
+ Pos = MAP_APPFONT ( 6 , 40 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text[ en-US ] = "Align to text body";
+ };
+ FixedText FT_LEFT
+ {
+ Pos = MAP_APPFONT ( 15 , 54 ) ;
+ Size = MAP_APPFONT ( 63 , 8 ) ;
+ Text[ en-US ] = "From ~left";
+ };
+ MetricField MF_LEFT
+ {
+ HelpID = "sw:MetricField:DLG_MM_LAYOUT_PAGE:MF_LEFT";
+ Pos = MAP_APPFONT ( 78 , 52 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Border = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 99999 ;
+ DecimalDigits = 2 ;
+ Value = 200 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 99999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_TOP
+ {
+ Pos = MAP_APPFONT ( 15 , 69 ) ;
+ Size = MAP_APPFONT ( 62 , 8 ) ;
+ Text[ en-US ] = "~From top";
+ };
+ MetricField MF_TOP
+ {
+ HelpID = "sw:MetricField:DLG_MM_LAYOUT_PAGE:MF_TOP";
+ Pos = MAP_APPFONT ( 78 , 67 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Border = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 99999 ;
+ DecimalDigits = 2 ;
+ Value = 200 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 99999 ;
+ SpinSize = 10 ;
+ };
+ FixedLine FL_GREETINGLINE
+ {
+ Pos = MAP_APPFONT ( 6 , 85 ) ;
+ Size = MAP_APPFONT ( 118 , 8 ) ;
+ Text[ en-US ] = "Salutation position";
+ };
+ FixedText FT_UP
+ {
+ Pos = MAP_APPFONT ( 15 , 98 ) ;
+ Size = MAP_APPFONT ( 45 , 8 ) ;
+ Text[ en-US ] = "Move";
+ };
+ PushButton MF_UP
+ {
+ HelpID = "sw:PushButton:DLG_MM_LAYOUT_PAGE:MF_UP";
+ Pos = MAP_APPFONT ( 68 , 96 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text[ en-US ] = "~Up";
+ };
+ FixedText FT_DOWN
+ {
+ Pos = MAP_APPFONT ( 15 , 115 ) ;
+ Size = MAP_APPFONT ( 45 , 8 ) ;
+ Text[ en-US ] = "Move";
+ };
+ PushButton PB_DOWN
+ {
+ HelpID = "sw:PushButton:DLG_MM_LAYOUT_PAGE:PB_DOWN";
+ Pos = MAP_APPFONT ( 68 , 113 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text[ en-US ] = "~Down";
+ };
+ Window WIN_EXAMPLECONTAINER
+ {
+ Pos = MAP_APPFONT ( 130 , 20 ) ;
+ Size = MAP_APPFONT ( 124 , 159 ) ;
+ Border = TRUE;
+ };
+ FixedText FT_ZOOM
+ {
+ Pos = MAP_APPFONT ( 161 , 185 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Right = TRUE;
+ Text[ en-US ] = "~Zoom";
+ };
+ ListBox LB_ZOOM
+ {
+ HelpID = "sw:ListBox:DLG_MM_LAYOUT_PAGE:LB_ZOOM";
+ Pos = MAP_APPFONT ( 204 , 182 ) ;
+ Size = MAP_APPFONT ( 50 , 50 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ StringList [en-US]= \
+ { \
+ < "Entire page" ; > ; \
+ };
+ };
+
+};
+
+
+
diff --git a/sw/source/ui/dbui/mmmergepage.cxx b/sw/source/ui/dbui/mmmergepage.cxx
new file mode 100644
index 000000000000..bb58496effd3
--- /dev/null
+++ b/sw/source/ui/dbui/mmmergepage.cxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <mmmergepage.hxx>
+#include <mailmergewizard.hxx>
+#include <mmconfigitem.hxx>
+#include <swtypes.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <dbui.hrc>
+#include <mmmergepage.hrc>
+#include <svl/srchitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/eitem.hxx>
+#include <swabstdlg.hxx>
+
+/*-- 02.04.2004 16:38:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeMergePage::SwMailMergeMergePage( SwMailMergeWizard* _pParent) :
+ svt::OWizardPage(_pParent, SW_RES(DLG_MM_MERGE_PAGE)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aHeaderFI(this, SW_RES( FI_HEADER ) ),
+ m_aEditFI(this, SW_RES( FI_EDIT )),
+ m_aEditPB(this, SW_RES( PB_EDIT )),
+ m_aFindFL(this, SW_RES( FL_FIND )),
+ m_aFineFT(this, SW_RES( FT_FIND )),
+ m_aFindED(this, SW_RES( ED_FIND )),
+ m_aFindPB(this, SW_RES( PB_FIND )),
+ m_aWholeWordsCB(this, SW_RES( CB_WHOLEWORDS)),
+ m_aBackwardsCB(this, SW_RES( CB_BACKWARDS )),
+ m_aMatchCaseCB(this, SW_RES( CB_MATCHCASE )),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_pWizard(_pParent)
+{
+ FreeResource();
+ String sTemp(m_aEditFI.GetText());
+ sTemp.SearchAndReplace(String::CreateFromAscii("%1"), m_aEditPB.GetText());
+ m_aEditFI.SetText(sTemp);
+ m_aEditPB.SetClickHdl( LINK( this, SwMailMergeMergePage, EditDocumentHdl_Impl));
+ m_aFindPB.SetClickHdl( LINK( this, SwMailMergeMergePage, FindHdl_Impl ));
+
+ m_aFindED.SetReturnActionLink( LINK(this, SwMailMergeMergePage, EnteredFindStringHdl_Impl ));
+
+}
+/*-- 02.04.2004 16:38:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeMergePage::~SwMailMergeMergePage()
+{
+}
+/*-- 25.05.2004 16:14:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwMailMergeMergePage, EditDocumentHdl_Impl, PushButton*, EMPTYARG)
+{
+ m_pWizard->SetRestartPage(MM_MERGEPAGE);
+ m_pWizard->EndDialog(RET_EDIT_RESULT_DOC);
+ return 0;
+}
+/*-- 25.05.2004 16:14:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwMailMergeMergePage, FindHdl_Impl, PushButton*, EMPTYARG)
+{
+ SvxSearchItem aSearchItem( SID_SEARCH_ITEM );
+
+ SfxBoolItem aQuiet( SID_SEARCH_QUIET, sal_False );
+ aSearchItem.SetSearchString(m_aFindED.GetText());
+
+ aSearchItem.SetWordOnly(m_aWholeWordsCB.IsChecked());
+ aSearchItem.SetExact(m_aMatchCaseCB.IsChecked());
+ aSearchItem.SetBackward(m_aBackwardsCB.IsChecked());
+
+ SwView* pTargetView = m_pWizard->GetConfigItem().GetTargetView();
+ DBG_ASSERT(pTargetView, "no target view exists");
+ if(pTargetView)
+ {
+ pTargetView->GetViewFrame()->GetDispatcher()->Execute(
+ FID_SEARCH_NOW, SFX_CALLMODE_SYNCHRON, &aSearchItem, &aQuiet, 0L );
+ }
+
+ return 0;
+}
+IMPL_LINK( SwMailMergeMergePage, EnteredFindStringHdl_Impl, void*, EMPTYARG )
+{
+ m_aFindPB.GetClickHdl().Call( &m_aFindPB );
+ return 0;
+}
diff --git a/sw/source/ui/dbui/mmmergepage.hrc b/sw/source/ui/dbui/mmmergepage.hrc
new file mode 100644
index 000000000000..bf9c730bf743
--- /dev/null
+++ b/sw/source/ui/dbui/mmmergepage.hrc
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEMERGEPAGE_HRC
+#define _MAILMERGEMERGEPAGE_HRC
+
+#define FI_HEADER 1
+#define FI_EDIT 2
+#define PB_EDIT 3
+#define FL_FIND 4
+#define FT_FIND 5
+#define ED_FIND 6
+#define PB_FIND 7
+#define CB_WHOLEWORDS 8
+#define CB_BACKWARDS 9
+#define CB_MATCHCASE 10
+
+#endif
+
+
diff --git a/sw/source/ui/dbui/mmmergepage.hxx b/sw/source/ui/dbui/mmmergepage.hxx
new file mode 100644
index 000000000000..ad3d51260bb2
--- /dev/null
+++ b/sw/source/ui/dbui/mmmergepage.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEMERGEPAGE_HXX
+#define _MAILMERGEMERGEPAGE_HXX
+
+#include <svtools/wizardmachine.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/edit.hxx>
+#include <svtools/stdctrl.hxx>
+#include <mailmergehelper.hxx>
+#include <actctrl.hxx>
+class SwMailMergeWizard;
+/*-- 02.04.2004 09:21:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailMergeMergePage : public svt::OWizardPage
+{
+ SwBoldFixedInfo m_aHeaderFI;
+
+ FixedInfo m_aEditFI;
+ PushButton m_aEditPB;
+
+ FixedLine m_aFindFL;
+ FixedText m_aFineFT;
+ ReturnActionEdit m_aFindED;
+ PushButton m_aFindPB;
+
+ CheckBox m_aWholeWordsCB;
+ CheckBox m_aBackwardsCB;
+ CheckBox m_aMatchCaseCB;
+
+ SwMailMergeWizard* m_pWizard;
+
+ DECL_LINK(EditDocumentHdl_Impl, PushButton*);
+ DECL_LINK(FindHdl_Impl, PushButton*);
+ DECL_LINK(EnteredFindStringHdl_Impl, void*);
+
+public:
+ SwMailMergeMergePage( SwMailMergeWizard* _pParent);
+ ~SwMailMergeMergePage();
+
+};
+
+
+#endif
+
+
diff --git a/sw/source/ui/dbui/mmmergepage.src b/sw/source/ui/dbui/mmmergepage.src
new file mode 100644
index 000000000000..a66480abacce
--- /dev/null
+++ b/sw/source/ui/dbui/mmmergepage.src
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <mmmergepage.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+TabPage DLG_MM_MERGE_PAGE
+{
+ HelpID = HID_MM_MERGEPAGE ;
+ Size = MAP_APPFONT ( 260 , 250 ) ;
+ Hide = TRUE ;
+
+ FixedText FI_HEADER
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Personalize the mail merge documents";
+ };
+ FixedText FI_EDIT
+ {
+ Pos = MAP_APPFONT ( 6 , 27 ) ;
+ Size = MAP_APPFONT ( 248 , 38 ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "You can personalize particular documents. Clicking '%1' will temporarily reduce the wizard to a small window so you can edit your document. After editing the document, return to the wizard by clicking 'Return to Mail Merge Wizard' in the small window.";
+ };
+ PushButton PB_EDIT
+ {
+ HelpID = "sw:PushButton:DLG_MM_MERGE_PAGE:PB_EDIT";
+ Pos = MAP_APPFONT ( 70 , 67 ) ;
+ Size = MAP_APPFONT ( 120 , 14 ) ;
+ Text [ en-US ] = "~Edit individual document...";
+ };
+ FixedLine FL_FIND
+ {
+ Pos = MAP_APPFONT ( 6 , 102 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "~Find";
+ };
+ FixedText FT_FIND
+ {
+ Pos = MAP_APPFONT ( 16 ,116 ) ;
+ Size = MAP_APPFONT ( 45 , 8 ) ;
+ Text [ en-US ] = "~Search for:";
+ };
+ Edit ED_FIND
+ {
+ HelpID = "sw:Edit:DLG_MM_MERGE_PAGE:ED_FIND";
+ Pos = MAP_APPFONT ( 55 ,114 ) ;
+ Size = MAP_APPFONT ( 140 , 12 ) ;
+ Border = TRUE;
+ };
+ PushButton PB_FIND
+ {
+ HelpID = "sw:PushButton:DLG_MM_MERGE_PAGE:PB_FIND";
+ Pos = MAP_APPFONT ( 198 ,113 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Find...";
+ };
+ CheckBox CB_WHOLEWORDS
+ {
+ HelpID = "sw:CheckBox:DLG_MM_MERGE_PAGE:CB_WHOLEWORDS";
+ Pos = MAP_APPFONT ( 55 , 131 ) ;
+ Size = MAP_APPFONT ( 180 , 10 ) ;
+ Text [ en-US ] = "Whole wor~ds only";
+ };
+ CheckBox CB_BACKWARDS
+ {
+ HelpID = "sw:CheckBox:DLG_MM_MERGE_PAGE:CB_BACKWARDS";
+ Pos = MAP_APPFONT ( 55 , 144 ) ;
+ Size = MAP_APPFONT ( 180 , 10 ) ;
+ Text [ en-US ] = "Back~wards";
+ };
+ CheckBox CB_MATCHCASE
+ {
+ HelpID = "sw:CheckBox:DLG_MM_MERGE_PAGE:CB_MATCHCASE";
+ Pos = MAP_APPFONT ( 55 , 157 ) ;
+ Size = MAP_APPFONT ( 180 , 10 ) ;
+ Text [ en-US ] = "Ma~tch case";
+ };
+};
+
+
+
diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx
new file mode 100644
index 000000000000..943e21adee34
--- /dev/null
+++ b/sw/source/ui/dbui/mmoutputpage.cxx
@@ -0,0 +1,1440 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <mmoutputpage.hxx>
+#include <mailmergewizard.hxx>
+#include <mmconfigitem.hxx>
+#include <mailmergechildwindow.hxx>
+#include <mailconfigpage.hxx>
+#include <cmdid.h>
+#include <swtypes.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#ifndef IDOCUMENTDEVICEACCESS_HXX_INCLUDED
+#include <IDocumentDeviceAccess.hxx>
+#endif
+#include <hintids.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <editeng/langitem.hxx>
+#include <svl/itemset.hxx>
+#include <svl/stritem.hxx>
+#include <svtools/ehdl.hxx>
+#include <svtools/sfxecode.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/dinfdlg.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/docfile.hxx>
+//#ifndef _SFX_DOCFILT_HACK_HXX
+//#include <sfx2/docfilt.hxx>
+//#endif
+#include <tools/urlobj.hxx>
+#include <svl/urihelper.hxx>
+#ifndef _VCL_PRINT_HXX
+#include <vcl/print.hxx>
+#endif
+#include <unotools/tempfile.hxx>
+#include <osl/file.hxx>
+#include <mmgreetingspage.hxx>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+//#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+//#include <com/sun/star/beans/PropertyValue.hpp>
+//#endif
+//#ifndef _BASEDLGS_HXX
+//#include <sfx2/basedlgs.hxx>
+//#endif
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+#include <swunohelper.hxx>
+#include <vos/mutex.hxx>
+#include <shellio.hxx>
+#include <svtools/htmlcfg.hxx>
+#include <sfx2/event.hxx>
+#include <swevent.hxx>
+#include <mmoutputpage.hrc>
+#include <dbui.hxx>
+#include <dbui.hrc>
+#include <helpid.h>
+#include <sfx2/app.hxx>
+#include <statstr.hrc>
+#include <unomid.h>
+
+using namespace svt;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+/*-- 01.07.2004 16:47:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+String lcl_GetExtensionForDocType(ULONG nDocType)
+{
+ String sExtension;
+ switch( nDocType )
+ {
+ case MM_DOCTYPE_OOO : sExtension = String::CreateFromAscii( "odt" ); break;
+ case MM_DOCTYPE_PDF : sExtension = String::CreateFromAscii( "pdf" ); break;
+ case MM_DOCTYPE_WORD: sExtension = String::CreateFromAscii( "doc" ); break;
+ case MM_DOCTYPE_HTML: sExtension = String::CreateFromAscii( "html" ); break;
+ case MM_DOCTYPE_TEXT: sExtension = String::CreateFromAscii( "txt" ); break;
+ }
+ return sExtension;
+}
+/*-- 28.06.2004 11:49:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString lcl_GetColumnValueOf(const ::rtl::OUString& rColumn, Reference < container::XNameAccess>& rxColAccess )
+{
+ ::rtl::OUString sRet;
+ if(rxColAccess->hasByName(rColumn))
+ {
+ Any aCol = rxColAccess->getByName(rColumn);
+ Reference< sdb::XColumn > xColumn;
+ aCol >>= xColumn;
+ if(xColumn.is())
+ sRet = xColumn->getString();
+ }
+ return sRet;
+}
+/*-- 21.06.2004 14:01:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwSaveWarningBox_Impl : public ModalDialog
+{
+ FixedImage aWarningImageIM;
+ FixedInfo aWarningFI;
+
+ FixedText aFileNameFT;
+ Edit aFileNameED;
+
+ FixedLine aSeparatorFL;
+ OKButton aOKPB;
+ CancelButton aCancelPB;
+
+ DECL_LINK( ModifyHdl, Edit*);
+public:
+ SwSaveWarningBox_Impl(Window* pParent, const String& rFileName);
+ ~SwSaveWarningBox_Impl();
+
+ String GetFileName() const {return aFileNameED.GetText();}
+};
+/*-- 02.07.2004 08:54:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwSendQueryBox_Impl : public ModalDialog
+{
+ FixedImage aQueryImageIM;
+ FixedInfo aQueryFI;
+
+ Edit aTextED;
+
+ FixedLine aSeparatorFL;
+ OKButton aOKPB;
+ CancelButton aCancelPB;
+
+ bool bIsEmptyAllowed;
+ DECL_LINK( ModifyHdl, Edit*);
+public:
+ SwSendQueryBox_Impl(Window* pParent, const String& rQueryText);
+ ~SwSendQueryBox_Impl();
+
+ void SetValue(const String& rSet)
+ {
+ aTextED.SetText(rSet);
+ ModifyHdl( &aTextED );
+ }
+ String GetValue() const {return aTextED.GetText();}
+
+ void SetIsEmptyTextAllowed(bool bSet)
+ {
+ bIsEmptyAllowed = bSet;
+ ModifyHdl( &aTextED );
+ }
+};
+
+/*-- 21.06.2004 14:11:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSaveWarningBox_Impl::SwSaveWarningBox_Impl(Window* pParent, const String& rFileName) :
+ ModalDialog(pParent, SW_RES( DLG_MM_SAVEWARNING )),
+ aWarningImageIM(this, SW_RES( IM_WARNING )),
+ aWarningFI(this, SW_RES( FI_WARNING )),
+ aFileNameFT(this, SW_RES( FT_FILENAME )),
+ aFileNameED(this, SW_RES( ED_FILENAME )),
+ aSeparatorFL(this, SW_RES( FL_SEPARATOR )),
+ aOKPB(this, SW_RES( PB_OK )),
+ aCancelPB(this, SW_RES( PB_CANCEL ))
+{
+ FreeResource();
+ aWarningImageIM.SetImage(WarningBox::GetStandardImage());
+ aFileNameED.SetText(rFileName);
+ aFileNameED.SetModifyHdl(LINK(this, SwSaveWarningBox_Impl, ModifyHdl));
+ ModifyHdl( &aFileNameED );
+}
+/*-- 21.06.2004 14:11:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSaveWarningBox_Impl::~SwSaveWarningBox_Impl()
+{
+}
+/*-- 21.06.2004 14:11:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwSaveWarningBox_Impl, ModifyHdl, Edit*, pEdit)
+{
+ aOKPB.Enable(pEdit->GetText().Len() > 0);
+ return 0;
+}
+/*-- 02.07.2004 09:02:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSendQueryBox_Impl::SwSendQueryBox_Impl(Window* pParent, const String& rText) :
+ ModalDialog(pParent, SW_RES( DLG_MM_QUERY )),
+ aQueryImageIM( this, SW_RES( IM_QUERY )),
+ aQueryFI( this, SW_RES( FI_QUERY )),
+ aTextED( this, SW_RES( ED_TEXT )),
+ aSeparatorFL(this, SW_RES( FL_SEPARATOR )),
+ aOKPB(this, SW_RES( PB_OK )),
+ aCancelPB(this, SW_RES( PB_CANCEL )),
+ bIsEmptyAllowed(true)
+{
+ FreeResource();
+ aQueryFI.SetText(rText);
+ aQueryImageIM.SetImage(QueryBox::GetStandardImage());
+ aTextED.SetModifyHdl(LINK(this, SwSendQueryBox_Impl, ModifyHdl));
+ ModifyHdl( &aTextED );
+}
+/*-- 02.07.2004 08:58:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSendQueryBox_Impl::~SwSendQueryBox_Impl()
+{
+}
+/*-- 02.07.2004 08:58:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwSendQueryBox_Impl, ModifyHdl, Edit*, pEdit)
+{
+ aOKPB.Enable(bIsEmptyAllowed || (pEdit->GetText().Len() > 0));
+ return 0;
+}
+
+/*-- 16.04.2004 16:34:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwCopyToDialog : public SfxModalDialog
+{
+ FixedInfo m_aDescriptionFI;
+ FixedText m_aCCFT;
+ Edit m_aCCED;
+ FixedText m_aBCCFT;
+ Edit m_aBCCED;
+
+ FixedInfo m_aNoteFI;
+ FixedLine m_aSeparatorFL;
+
+ OKButton m_aOK;
+ CancelButton m_aCancel;
+ HelpButton m_aHelp;
+
+public:
+ SwCopyToDialog(Window* pParent);
+ ~SwCopyToDialog();
+
+ String GetCC() {return m_aCCED.GetText();}
+ void SetCC(const String& rSet) {m_aCCED.SetText(rSet);}
+
+ String GetBCC() {return m_aBCCED.GetText();}
+ void SetBCC(const String& rSet) {m_aBCCED.SetText(rSet);}
+};
+
+/*-- 16.04.2004 16:43:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwCopyToDialog::SwCopyToDialog(Window* pParent) :
+ SfxModalDialog(pParent, SW_RES(DLG_MM_COPYTO)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aDescriptionFI( this, SW_RES( FI_DESCRIPTION )),
+ m_aCCFT( this, SW_RES( FT_CC )),
+ m_aCCED( this, SW_RES( ED_CC )),
+ m_aBCCFT( this, SW_RES( FT_BCC )),
+ m_aBCCED( this, SW_RES( ED_BCC )),
+ m_aNoteFI( this, SW_RES( FI_NOTE )),
+ m_aSeparatorFL( this, SW_RES( FL_SEPARATOR )),
+ m_aOK( this, SW_RES( PB_OK )),
+ m_aCancel( this, SW_RES( PB_CANCEL )),
+ m_aHelp( this, SW_RES( PB_HELP ))
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+{
+ FreeResource();
+}
+/*-- 16.04.2004 16:43:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwCopyToDialog::~SwCopyToDialog()
+{
+}
+
+/*-- 02.04.2004 13:15:54---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeOutputPage::SwMailMergeOutputPage( SwMailMergeWizard* _pParent) :
+ svt::OWizardPage( _pParent, SW_RES(DLG_MM_OUTPUT_PAGE)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aHeaderFI(this, SW_RES( FI_HEADER ) ),
+ m_aOptionsFI(this, SW_RES( FI_OPTIONS ) ),
+ m_aSaveStartDocRB(this, SW_RES( RB_SAVESTARTDOC ) ),
+ m_aSaveMergedDocRB(this, SW_RES( RB_SAVEMERGEDDOC ) ),
+ m_aPrintRB(this, SW_RES( RB_PRINT ) ),
+ m_aSendMailRB(this, SW_RES( RB_SENDMAIL ) ),
+
+ m_aSeparatorFL(this, SW_RES( FL_SEPARATOR ) ),
+
+ m_aSaveStartDocPB(this, SW_RES( PB_SAVESTARTDOC ) ),
+
+ m_aSaveAsOneRB(this, SW_RES( RB_SAVEASONE ) ),
+ m_aSaveIndividualRB(this, SW_RES( RB_SAVEINDIVIDUAL ) ),
+ m_aPrintAllRB(this, SW_RES( RB_PRINTALL ) ),
+ m_aSendAllRB( this, SW_RES( RB_SENDALL ) ),
+
+ m_aFromRB(this, SW_RES( RB_FROM ) ),
+ m_aFromNF(this, SW_RES( NF_FROM ) ),
+ m_aToFT(this, SW_RES( FT_TO ) ),
+ m_aToNF(this, SW_RES( NF_TO ) ),
+ m_aSaveNowPB(this, SW_RES( PB_SAVENOW ) ),
+
+ m_aPrinterFT(this, SW_RES( FT_PRINT ) ),
+ m_aPrinterLB(this, SW_RES( LB_PRINT ) ),
+ m_aPrinterSettingsPB(this, SW_RES( PB_PRINTERSETTINGS ) ),
+ m_aPrintNowPB(this, SW_RES( PB_PRINTNOW ) ),
+
+ m_aMailToFT( this, SW_RES( FT_MAILTO ) ),
+ m_aMailToLB( this, SW_RES( LB_MAILTO ) ),
+ m_aCopyToPB( this, SW_RES( PB_COPYTO ) ),
+ m_aSubjectFT( this, SW_RES( FT_SUBJECT ) ),
+ m_aSubjectED( this, SW_RES( ED_SUBJECT ) ),
+ m_aSendAsFT( this, SW_RES( FT_SENDAS ) ),
+ m_aSendAsLB( this, SW_RES( LB_SENDAS ) ),
+ m_aAttachmentFT( this, SW_RES( FT_ATTACHMENT ) ),
+ m_aAttachmentED( this, SW_RES( ED_ATTACHMENT ) ),
+ m_aSendAsPB( this, SW_RES( PB_SENDAS ) ),
+ m_aSendDocumentsPB( this, SW_RES( PB_SENDDOCUMENTS ) ),
+
+ m_sSaveStartST(SW_RES( ST_SAVESTART ) ),
+ m_sSaveMergedST(SW_RES( ST_SAVEMERGED ) ),
+ m_sPrintST(SW_RES( ST_PRINT ) ),
+ m_sSendMailST(SW_RES( ST_SENDMAIL ) ),
+
+ m_sDefaultAttachmentST(SW_RES( ST_DEFAULTATTACHMENT )),
+ m_sNoSubjectQueryST(SW_RES( ST_SUBJECTQUERY )),
+ m_sNoSubjectST(SW_RES( ST_NOSUBJECT )),
+ m_sNoAttachmentNameST(SW_RES( ST_NOATTACHMENTNAME )),
+ m_sConfigureMail(SW_RES( ST_CONFIGUREMAIL)),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_bCancelSaving( false ),
+ m_pWizard(_pParent),
+ m_pTempPrinter( 0 ),
+ m_pDocumentPrinterCopy(0)
+{
+ FreeResource();
+
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ // #i51949# hide e-Mail option if e-Mail is not supported
+ if(!rConfigItem.IsMailAvailable())
+ m_aSendMailRB.Hide();
+
+ Link aLink = LINK(this, SwMailMergeOutputPage, OutputTypeHdl_Impl);
+ m_aSaveStartDocRB.SetClickHdl(aLink);
+ m_aSaveMergedDocRB.SetClickHdl(aLink);
+ m_aPrintRB.SetClickHdl(aLink);
+ m_aSendMailRB.SetClickHdl(aLink);
+ m_aSaveStartDocRB.Check();
+ m_aPrintAllRB.Check();
+ m_aSaveAsOneRB.Check();
+ m_aSendAllRB.Check();
+
+ m_aSaveStartDocPB.SetClickHdl(LINK(this, SwMailMergeOutputPage, SaveStartHdl_Impl));
+ m_aSaveNowPB.SetClickHdl(LINK(this, SwMailMergeOutputPage, SaveOutputHdl_Impl));
+ m_aPrinterLB.SetSelectHdl(LINK(this, SwMailMergeOutputPage, PrinterChangeHdl_Impl));
+ m_aPrintNowPB.SetClickHdl(LINK(this, SwMailMergeOutputPage, PrintHdl_Impl));
+ m_aPrinterSettingsPB.SetClickHdl(LINK(this, SwMailMergeOutputPage, PrinterSetupHdl_Impl));
+
+ m_aSendAsPB.SetClickHdl(LINK(this, SwMailMergeOutputPage, SendAsHdl_Impl)),
+ m_aSendDocumentsPB.SetClickHdl(LINK(this, SwMailMergeOutputPage, SendDocumentsHdl_Impl)),
+ m_aSendAsLB.SetSelectHdl(LINK(this, SwMailMergeOutputPage, SendTypeHdl_Impl));
+
+ m_nFromToRBPos = m_aFromRB.GetPosPixel().Y();
+ m_nFromToFTPos = m_aToFT.GetPosPixel().Y();
+ m_nFromToNFPos = m_aFromNF.GetPosPixel().Y();
+
+ m_nRBOffset = m_nFromToRBPos - m_aSaveIndividualRB.GetPosPixel().Y();
+
+ OutputTypeHdl_Impl(&m_aSaveStartDocRB);
+
+ m_aCopyToPB.SetClickHdl(LINK(this, SwMailMergeOutputPage, CopyToHdl_Impl));
+
+ m_aSaveAsOneRB.SetClickHdl(LINK(this, SwMailMergeOutputPage, DocumentSelectionHdl_Impl));
+ m_aSaveIndividualRB.SetClickHdl(LINK(this, SwMailMergeOutputPage, DocumentSelectionHdl_Impl));
+ m_aPrintAllRB.SetClickHdl(LINK(this, SwMailMergeOutputPage, DocumentSelectionHdl_Impl));
+ m_aSendAllRB.SetClickHdl(LINK(this, SwMailMergeOutputPage, DocumentSelectionHdl_Impl));
+
+ m_aFromRB.SetClickHdl(LINK(this, SwMailMergeOutputPage, DocumentSelectionHdl_Impl));
+ //#i63267# printing might be disabled
+ m_aPrintRB.Enable(!Application::GetSettings().GetMiscSettings().GetDisablePrinting());
+}
+
+/*-- 02.04.2004 13:15:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeOutputPage::~SwMailMergeOutputPage()
+{
+ delete m_pTempPrinter;
+ delete m_pDocumentPrinterCopy;
+}
+/*-- 31.01.2005 08:38:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergeOutputPage::ActivatePage()
+{
+ //fill printer ListBox
+ const std::vector<rtl::OUString>& rPrinters = Printer::GetPrinterQueues();
+ unsigned int nCount = rPrinters.size();
+ if ( nCount )
+ {
+ for( unsigned int i = 0; i < nCount; i++ )
+ {
+ m_aPrinterLB.InsertEntry( rPrinters[i] );
+ }
+
+ }
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+
+ SwView* pTargetView = rConfigItem.GetTargetView();
+ DBG_ASSERT(pTargetView, "no target view exists");
+ if(pTargetView)
+ {
+ SfxPrinter* pPrinter = pTargetView->GetWrtShell().getIDocumentDeviceAccess()->getPrinter( true );
+ m_aPrinterLB.SelectEntry( pPrinter->GetName() );
+ m_aToNF.SetValue( rConfigItem.GetMergedDocumentCount() );
+ m_aToNF.SetMax( rConfigItem.GetMergedDocumentCount() );
+ m_pDocumentPrinterCopy = pTargetView->GetWrtShell().getIDocumentDeviceAccess()->getPrinter( true )->Clone();
+ }
+ m_aPrinterLB.SelectEntry( rConfigItem.GetSelectedPrinter() );
+
+ SwView* pSourceView = rConfigItem.GetSourceView();
+ DBG_ASSERT(pSourceView, "no source view exists");
+ if(pSourceView)
+ {
+ SwDocShell* pDocShell = pSourceView->GetDocShell();
+ if ( pDocShell->HasName() )
+ {
+ INetURLObject aTmp( pDocShell->GetMedium()->GetName() );
+ m_aAttachmentED.SetText(aTmp.getName(
+ INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ));
+ }
+ }
+}
+/*-- 05.07.2004 13:54:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwMailMergeOutputPage::canAdvance() const
+{
+ return false;
+}
+/*-- 02.04.2004 13:15:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeOutputPage, OutputTypeHdl_Impl, RadioButton*, pButton)
+{
+ Control* aControls[] =
+ {
+ &m_aSaveStartDocPB,
+ &m_aSaveAsOneRB, &m_aSaveIndividualRB,
+ &m_aFromRB, &m_aFromNF, &m_aToFT, &m_aToNF,
+ &m_aSaveNowPB,
+ &m_aPrinterFT, &m_aPrinterLB, &m_aPrinterSettingsPB, &m_aPrintAllRB,
+ &m_aPrintNowPB,
+ &m_aMailToFT, &m_aMailToLB, &m_aCopyToPB,
+ &m_aSubjectFT, &m_aSubjectED,
+ &m_aSendAsFT, &m_aSendAsLB, &m_aSendAsPB,
+ &m_aAttachmentFT, &m_aAttachmentED,
+ &m_aSendAllRB, &m_aSendDocumentsPB,
+ 0
+ };
+ SetUpdateMode(TRUE);
+ Control** pControl = aControls;
+ do
+ {
+ (*pControl)->Show(sal_False);
+
+ } while(*(++pControl));
+
+ if(&m_aSaveStartDocRB == pButton)
+ {
+ m_aSaveStartDocPB.Show();
+ m_aSeparatorFL.SetText(m_sSaveStartST);
+
+ }
+ else if(&m_aSaveMergedDocRB == pButton)
+ {
+ Control* aSaveMergedControls[] =
+ {
+ &m_aSaveAsOneRB, &m_aSaveIndividualRB,
+ &m_aFromRB, &m_aFromNF, &m_aToFT, &m_aToNF,
+ &m_aSaveNowPB,
+ 0
+ };
+ Control** pSaveMergeControl = aSaveMergedControls;
+ do
+ {
+ (*pSaveMergeControl)->Show(sal_True);
+
+ } while(*(++pSaveMergeControl));
+ if(!m_aFromRB.IsChecked() && !m_aSaveAsOneRB.IsChecked())
+ {
+ m_aSaveIndividualRB.Check();
+ }
+ m_aSeparatorFL.SetText(m_sSaveMergedST);
+ //reposition the from/to line
+ if(m_aFromRB.GetPosPixel().Y() != m_nFromToRBPos)
+ {
+ Point aPos(m_aFromRB.GetPosPixel()); aPos.Y() = m_nFromToRBPos; m_aFromRB.SetPosPixel(aPos);
+ aPos = m_aToFT.GetPosPixel(); aPos.Y() = m_nFromToFTPos; m_aToFT.SetPosPixel(aPos);
+ aPos = m_aFromNF.GetPosPixel(); aPos.Y() = m_nFromToNFPos; m_aFromNF.SetPosPixel(aPos);
+ aPos = m_aToNF.GetPosPixel(); aPos.Y() = m_nFromToNFPos; m_aToNF.SetPosPixel(aPos);
+ }
+ }
+ else if(&m_aPrintRB == pButton)
+ {
+ Control* aPrintControls[] =
+ {
+ &m_aFromRB, &m_aFromNF, &m_aToFT, &m_aToNF,
+ &m_aPrinterFT, &m_aPrinterLB, &m_aPrinterSettingsPB, &m_aPrintAllRB,
+ &m_aPrintNowPB,
+ 0
+ };
+ Control** pPrinterControl = aPrintControls;
+ do
+ {
+ (*pPrinterControl)->Show(sal_True);
+
+ } while(*(++pPrinterControl));
+ if(!m_aFromRB.IsChecked())
+ m_aPrintAllRB.Check();
+
+ m_aSeparatorFL.SetText(m_sPrintST);
+ //reposition the from/to line
+ long nRB_FT_Offset = m_nFromToRBPos - m_nFromToFTPos;
+ long nNewRBXPos = m_aPrintAllRB.GetPosPixel().Y() + m_nRBOffset;
+
+ Point aPos(m_aFromRB.GetPosPixel());aPos.Y() = nNewRBXPos; m_aFromRB.SetPosPixel(aPos);
+ aPos = m_aToFT.GetPosPixel(); aPos.Y() = nNewRBXPos + nRB_FT_Offset; m_aToFT.SetPosPixel(aPos);
+ aPos = m_aFromNF.GetPosPixel(); aPos.Y() = nNewRBXPos + nRB_FT_Offset; m_aFromNF.SetPosPixel(aPos);
+ aPos = m_aToNF.GetPosPixel(); aPos.Y() = nNewRBXPos + nRB_FT_Offset; m_aToNF.SetPosPixel(aPos);
+ }
+ else /*if(&m_aSendMailRB == pButton)*/
+ {
+ Control* aMailControls[] =
+ {
+ &m_aFromRB, &m_aFromNF, &m_aToFT, &m_aToNF,
+ &m_aMailToFT, &m_aMailToLB, &m_aCopyToPB,
+ &m_aSubjectFT, &m_aSubjectED,
+ &m_aSendAsFT, &m_aSendAsLB, &m_aSendAsPB,
+ &m_aAttachmentFT, &m_aAttachmentED,
+ &m_aSendAllRB, &m_aSendDocumentsPB, 0
+ };
+ Control** pMailControl = aMailControls;
+ do
+ {
+ (*pMailControl)->Show(sal_True);
+
+ } while(*(++pMailControl));
+
+ if(!m_aFromRB.IsChecked())
+ m_aSendAllRB.Check();
+ if(!m_aAttachmentED.GetText().Len())
+ {
+ String sAttach( m_sDefaultAttachmentST );
+ sAttach += '.';
+ sAttach += lcl_GetExtensionForDocType(
+ (ULONG)m_aSendAsLB.GetEntryData(m_aSendAsLB.GetSelectEntryPos()));
+ m_aAttachmentED.SetText( sAttach );
+
+ }
+ m_aSeparatorFL.SetText(m_sSendMailST);
+ //fill mail address ListBox
+ if(!m_aMailToLB.GetEntryCount())
+ {
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ //select first column
+ uno::Reference< sdbcx::XColumnsSupplier > xColsSupp( rConfigItem.GetResultSet(), uno::UNO_QUERY);
+ //get the name of the actual columns
+ uno::Reference < container::XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : 0;
+ uno::Sequence< ::rtl::OUString > aFields;
+ if(xColAccess.is())
+ aFields = xColAccess->getElementNames();
+ const ::rtl::OUString* pFields = aFields.getConstArray();
+ for(sal_Int32 nField = 0; nField < aFields.getLength(); ++nField)
+ m_aMailToLB.InsertEntry(pFields[nField]);
+
+ m_aMailToLB.SelectEntryPos(0);
+ // then select the right one - may not be available
+ const ResStringArray& rHeaders = rConfigItem.GetDefaultAddressHeaders();
+ String sEMailColumn = rHeaders.GetString( MM_PART_E_MAIL );
+ Sequence< ::rtl::OUString> aAssignment =
+ rConfigItem.GetColumnAssignment( rConfigItem.GetCurrentDBData() );
+ if(aAssignment.getLength() > MM_PART_E_MAIL && aAssignment[MM_PART_E_MAIL].getLength())
+ sEMailColumn = aAssignment[MM_PART_E_MAIL];
+ m_aMailToLB.SelectEntry(sEMailColumn);
+ // HTML format pre-selected
+ m_aSendAsLB.SelectEntryPos(3);
+ SendTypeHdl_Impl(&m_aSendAsLB);
+ }
+ if(m_aSendAllRB.GetPosPixel().Y() + m_nRBOffset != m_aFromRB.GetPosPixel().Y())
+ {
+ long nRB_FT_Offset = m_nFromToRBPos - m_nFromToFTPos;
+ long nNewRBXPos = m_aSendAllRB.GetPosPixel().Y() + m_nRBOffset;
+
+ Point aPos(m_aFromRB.GetPosPixel());aPos.Y() = nNewRBXPos; m_aFromRB.SetPosPixel(aPos);
+ aPos = m_aToFT.GetPosPixel(); aPos.Y() = nNewRBXPos + nRB_FT_Offset; m_aToFT.SetPosPixel(aPos);
+ aPos = m_aFromNF.GetPosPixel(); aPos.Y() = nNewRBXPos + nRB_FT_Offset; m_aFromNF.SetPosPixel(aPos);
+ aPos = m_aToNF.GetPosPixel(); aPos.Y() = nNewRBXPos + nRB_FT_Offset; m_aToNF.SetPosPixel(aPos);
+ }
+ }
+ m_aFromRB.GetClickHdl().Call(m_aFromRB.IsChecked() ? &m_aFromRB : 0);
+
+ SetUpdateMode(FALSE);
+ return 0;
+}
+/*-- 22.08.2005 12:15:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeOutputPage, DocumentSelectionHdl_Impl, RadioButton*, pButton)
+{
+ sal_Bool bEnableFromTo = pButton == &m_aFromRB;
+ m_aFromNF.Enable(bEnableFromTo);
+ m_aToFT.Enable(bEnableFromTo);
+ m_aToNF.Enable(bEnableFromTo);
+ return 0;
+}
+
+/*-- 16.04.2004 16:45:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeOutputPage, CopyToHdl_Impl, PushButton*, pButton)
+{
+ SwCopyToDialog* pDlg = new SwCopyToDialog(pButton);
+ pDlg->SetCC(m_sCC );
+ pDlg->SetBCC(m_sBCC);
+ if(RET_OK == pDlg->Execute())
+ {
+ m_sCC = pDlg->GetCC() ;
+ m_sBCC = pDlg->GetBCC();
+ }
+ delete pDlg;
+ return 0;
+}
+/*-- 17.05.2004 13:51:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeOutputPage, SaveStartHdl_Impl, PushButton*, pButton)
+{
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ SwView* pSourceView = rConfigItem.GetSourceView();
+ DBG_ASSERT( pSourceView, "source view missing");
+ if(pSourceView)
+ {
+ SfxViewFrame* pSourceViewFrm = pSourceView->GetViewFrame();
+ uno::Reference< frame::XFrame > xFrame =
+ pSourceViewFrm->GetFrame().GetFrameInterface();
+ xFrame->getContainerWindow()->setVisible(sal_True);
+ pSourceViewFrm->GetDispatcher()->Execute(SID_SAVEDOC, SFX_CALLMODE_SYNCHRON);
+ xFrame->getContainerWindow()->setVisible(sal_False);
+ SwDocShell* pDocShell = pSourceView->GetDocShell();
+ //if the document has been saved it's URL has to be stored for
+ // later use and it can be closed now
+ if(pDocShell->HasName() && !pDocShell->IsModified())
+ {
+ INetURLObject aURL = pDocShell->GetMedium()->GetURLObject();
+ //update the attachment name
+ if(!m_aAttachmentED.GetText().Len())
+ {
+ if ( pDocShell->HasName() )
+ {
+ m_aAttachmentED.SetText(aURL.getName(
+ INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ));
+ }
+ }
+
+ rConfigItem.AddSavedDocument(
+ aURL.GetMainURL(INetURLObject::DECODE_TO_IURI));
+ pButton->Enable(FALSE);
+ m_pWizard->enableButtons(WZB_FINISH, sal_True);
+ pButton->Enable(FALSE);
+
+ }
+ }
+ return 0;
+}
+/*-- 17.07.2008 08:09:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeOutputPage, SaveCancelHdl_Impl, Button*, EMPTYARG )
+{
+ m_bCancelSaving = true;
+ return 0;
+}
+/*-- 17.05.2004 13:51:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton)
+{
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ SwView* pTargetView = rConfigItem.GetTargetView();
+ DBG_ASSERT(pTargetView, "no target view exists");
+ if(!pTargetView)
+ return 0;
+
+ if(m_aSaveAsOneRB.IsChecked())
+ {
+ String sFilter;
+ String sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter);
+ if(!sPath.Len())
+ return 0;
+ uno::Sequence< beans::PropertyValue > aValues(1);
+ beans::PropertyValue* pValues = aValues.getArray();
+ pValues[0].Name = C2U("FilterName");
+ pValues[0].Value <<= ::rtl::OUString(sFilter);
+
+ uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY);
+ sal_uInt32 nErrorCode = ERRCODE_NONE;
+ try
+ {
+ xStore->storeToURL( sPath, aValues );
+ }
+ catch( task::ErrorCodeIOException& aErrorEx )
+ {
+ nErrorCode = (sal_uInt32)aErrorEx.ErrCode;
+ }
+ catch( Exception& )
+ {
+ nErrorCode = ERRCODE_IO_GENERAL;
+ }
+ if( nErrorCode != ERRCODE_NONE )
+ {
+ SfxErrorContext aEc(ERRCTX_SFX_SAVEASDOC, pTargetView->GetDocShell()->GetTitle());
+ ErrorHandler::HandleError( nErrorCode );
+ }
+ }
+ else
+ {
+ sal_uInt32 nBegin = 0;
+ sal_uInt32 nEnd = 0;
+ if(m_aSaveIndividualRB.IsChecked())
+ {
+ nBegin = 0;
+ nEnd = rConfigItem.GetMergedDocumentCount();
+ }
+ else
+ {
+ nBegin = static_cast< sal_Int32 >(m_aFromNF.GetValue() - 1);
+ nEnd = static_cast< sal_Int32 >(m_aToNF.GetValue());
+ if(nEnd > rConfigItem.GetMergedDocumentCount())
+ nEnd = rConfigItem.GetMergedDocumentCount();
+ }
+ String sFilter;
+ String sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter);
+ if(!sPath.Len())
+ return 0;
+ String sTargetTempURL = URIHelper::SmartRel2Abs(
+ INetURLObject(), utl::TempFile::CreateTempName(),
+ URIHelper::GetMaybeFileHdl());
+ const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat(
+ String::CreateFromAscii( FILTER_XML ),
+ SwDocShell::Factory().GetFilterContainer() );
+
+ uno::Sequence< beans::PropertyValue > aValues(1);
+ beans::PropertyValue* pValues = aValues.getArray();
+ pValues[0].Name = C2U("FilterName");
+ pValues[0].Value <<= ::rtl::OUString(pSfxFlt->GetFilterName());
+
+ uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY);
+ sal_uInt32 nErrorCode = ERRCODE_NONE;
+ try
+ {
+ xStore->storeToURL( sTargetTempURL, aValues );
+ }
+ catch( task::ErrorCodeIOException& aErrorEx )
+ {
+ nErrorCode = (sal_uInt32)aErrorEx.ErrCode;
+ }
+ catch( Exception& )
+ {
+ nErrorCode = ERRCODE_IO_GENERAL;
+ }
+ if( nErrorCode != ERRCODE_NONE )
+ {
+ SfxErrorContext aEc(ERRCTX_SFX_SAVEASDOC, pTargetView->GetDocShell()->GetTitle());
+ ErrorHandler::HandleError( nErrorCode );
+ }
+
+ SwView* pSourceView = rConfigItem.GetSourceView();
+ PrintMonitor aSaveMonitor(this, PrintMonitor::MONITOR_TYPE_SAVE);
+ aSaveMonitor.aDocName.SetText(pSourceView->GetDocShell()->GetTitle(22));
+ aSaveMonitor.aCancel.SetClickHdl(LINK(this, SwMailMergeOutputPage, SaveCancelHdl_Impl));
+ aSaveMonitor.aPrinter.SetText( INetURLObject( sPath ).getFSysPath( INetURLObject::FSYS_DETECT ) );
+ aSaveMonitor.ResizeControls();
+
+ m_bCancelSaving = false;
+ aSaveMonitor.Show();
+ m_pWizard->enableButtons(WZB_CANCEL, sal_False);
+
+ for(sal_uInt32 nDoc = nBegin; nDoc < nEnd && !m_bCancelSaving; ++nDoc)
+ {
+ SwDocMergeInfo& rInfo = rConfigItem.GetDocumentMergeInfo(nDoc);
+ INetURLObject aURL(sPath);
+ String sFile = aURL.GetBase();
+ String sExtension = aURL.getExtension();
+ if(!sExtension.Len())
+ {
+ sExtension = pSfxFlt->GetWildcard()().GetToken(1, '.');
+ sPath += '.';
+ sPath += sExtension;
+ }
+ String sStat(SW_RES(STR_STATSTR_LETTER));
+ sStat += ' ';
+ sStat += String::CreateFromInt32( nDoc );
+ aSaveMonitor.aPrintInfo.SetText(sStat);
+
+ //now extract a document from the target document
+ // the shell will be closed at the end, but it is more safe to use SfxObjectShellLock here
+ SfxObjectShellLock xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) );
+ xTempDocShell->DoInitNew( 0 );
+ SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 );
+// pTempFrame->GetFrame().Appear();
+ SwView* pTempView = static_cast<SwView*>( pTempFrame->GetViewShell() );
+ pTargetView->GetWrtShell().StartAction();
+ SwgReaderOption aOpt;
+ aOpt.SetTxtFmts( sal_True );
+ aOpt.SetFrmFmts( sal_True );
+ aOpt.SetPageDescs( sal_True );
+ aOpt.SetNumRules( sal_True );
+ aOpt.SetMerge( sal_False );
+ pTempView->GetDocShell()->LoadStylesFromFile(
+ sTargetTempURL, aOpt, sal_True );
+
+ pTargetView->GetWrtShell().PastePages(pTempView->GetWrtShell(),
+ (USHORT)rInfo.nStartPageInTarget, (USHORT)rInfo.nEndPageInTarget );
+ pTargetView->GetWrtShell().EndAction();
+ //then save it
+ String sOutPath = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI);
+ String sCounter('_');
+ sCounter += String::CreateFromInt32(nDoc);
+ sOutPath.Insert(sCounter, sOutPath.Len() - sExtension.Len() - 1);
+ //SfxStringItem aName(SID_FILE_NAME, sOutPath);
+ //SfxStringItem aFilter(SID_FILTER_NAME, sFilter);
+
+ while(true)
+ {
+ //time for other slots is needed
+ for(sal_Int16 r = 0; r < 10; ++r)
+ Application::Reschedule();
+ bool bFailed = false;
+ try
+ {
+ pValues[0].Value <<= ::rtl::OUString(sFilter);
+ uno::Reference< frame::XStorable > xTempStore( xTempDocShell->GetModel(), uno::UNO_QUERY);
+ xTempStore->storeToURL( sOutPath, aValues );
+ }
+ catch( const uno::Exception& )
+ {
+ bFailed = true;
+ }
+
+ if(bFailed)
+ {
+ SwSaveWarningBox_Impl aWarning( pButton, sOutPath );
+ if(RET_OK == aWarning.Execute())
+ sOutPath = aWarning.GetFileName();
+ else
+ {
+ xTempDocShell->DoClose();
+ return 0;
+ }
+ }
+ else
+ {
+ xTempDocShell->DoClose();
+ break;
+ }
+ }
+ }
+ ::osl::File::remove( sTargetTempURL );
+ }
+ m_pWizard->enableButtons(WZB_CANCEL, sal_True);
+ m_pWizard->enableButtons(WZB_FINISH, sal_True);
+ return 0;
+}
+/*-- 22.06.2004 11:51:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeOutputPage, PrinterChangeHdl_Impl, ListBox*, pBox)
+{
+ if( m_pDocumentPrinterCopy && pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ {
+ const QueueInfo* pInfo = Printer::GetQueueInfo( pBox->GetSelectEntry(), false );
+
+ if( pInfo )
+ {
+ if ( !m_pTempPrinter )
+ {
+ if( (m_pDocumentPrinterCopy->GetName() == pInfo->GetPrinterName()) &&
+ (m_pDocumentPrinterCopy->GetDriverName() == pInfo->GetDriver()) )
+ m_pTempPrinter = new Printer( m_pDocumentPrinterCopy->GetJobSetup() );
+ else
+ m_pTempPrinter = new Printer( *pInfo );
+ }
+ else
+ {
+ if( (m_pTempPrinter->GetName() != pInfo->GetPrinterName()) ||
+ (m_pTempPrinter->GetDriverName() != pInfo->GetDriver()) )
+ {
+ delete m_pTempPrinter;
+ m_pTempPrinter = new Printer( *pInfo );
+ }
+ }
+ }
+ else if( ! m_pTempPrinter )
+ m_pTempPrinter = new Printer();
+
+ m_aPrinterSettingsPB.Enable( m_pTempPrinter->HasSupport( SUPPORT_SETUPDIALOG ) );
+ }
+ else
+ m_aPrinterSettingsPB.Disable();
+ m_pWizard->GetConfigItem().SetSelectedPrinter( pBox->GetSelectEntry() );
+
+// return m_pTempPrinter;
+ return 0;
+}
+
+/*-- 17.05.2004 13:51:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeOutputPage, PrintHdl_Impl, PushButton*, EMPTYARG)
+{
+ SwView* pTargetView = m_pWizard->GetConfigItem().GetTargetView();
+ DBG_ASSERT(pTargetView, "no target view exists");
+ if(!pTargetView)
+ return 0;
+
+ sal_uInt32 nBegin = 0;
+ sal_uInt32 nEnd = 0;
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ if(m_aPrintAllRB.IsChecked())
+ {
+ nBegin = 0;
+ nEnd = rConfigItem.GetMergedDocumentCount();
+ }
+ else
+ {
+ nBegin = static_cast< sal_Int32 >(m_aFromNF.GetValue() - 1);
+ nEnd = static_cast< sal_Int32 >(m_aToNF.GetValue());
+ if(nEnd > rConfigItem.GetMergedDocumentCount())
+ nEnd = rConfigItem.GetMergedDocumentCount();
+ }
+ rConfigItem.SetPrintRange( (USHORT)nBegin, (USHORT)nEnd );
+ SwDocMergeInfo& rStartInfo = rConfigItem.GetDocumentMergeInfo(nBegin);
+ SwDocMergeInfo& rEndInfo = rConfigItem.GetDocumentMergeInfo(nEnd - 1);
+
+ rtl::OUString sPages(rtl::OUString::valueOf( rStartInfo.nStartPageInTarget ));
+ sPages += rtl::OUString::createFromAscii( " - ");
+ sPages += rtl::OUString::valueOf( rEndInfo.nEndPageInTarget );
+
+ SwWrtShell& rSh = pTargetView->GetWrtShell();
+ pTargetView->SetMailMergeConfigItem(&rConfigItem, 0, sal_False);
+ if(m_pTempPrinter)
+ {
+ m_pDocumentPrinterCopy->SetPrinterProps(m_pTempPrinter);
+ pTargetView->SetPrinter(m_pDocumentPrinterCopy->Clone());
+ }
+
+ SfxObjectShell* pObjSh = pTargetView->GetViewFrame()->GetObjectShell();
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), pObjSh));
+ rSh.GetNewDBMgr()->SetMergeType( DBMGR_MERGE_DOCUMENTS );
+ //SfxDispatcher *pDis = pTargetView->GetViewFrame()->GetDispatcher();
+ SfxBoolItem aMergeSilent(SID_SILENT, sal_False);
+ m_pWizard->enableButtons(WZB_CANCEL, sal_False);
+
+ uno::Sequence < beans::PropertyValue > aProps( 2 );
+ aProps[0]. Name = rtl::OUString::createFromAscii("MonitorVisible");
+ aProps[0].Value <<= sal_True;
+ aProps[1]. Name = rtl::OUString::createFromAscii("Pages");
+ aProps[1]. Value <<= sPages;
+
+ pTargetView->ExecPrint( aProps, false, true );
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), pObjSh));
+
+ pTargetView->SetMailMergeConfigItem(0, 0, sal_False);
+ m_pWizard->enableButtons(WZB_CANCEL, sal_True);
+ m_pWizard->enableButtons(WZB_FINISH, sal_True);
+ return 0;
+}
+/*-- 17.05.2004 13:51:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeOutputPage, PrinterSetupHdl_Impl, PushButton*, pButton)
+{
+ if( !m_pTempPrinter )
+ PrinterChangeHdl_Impl(&m_aPrinterLB);
+ if(m_pTempPrinter)
+ m_pTempPrinter->Setup(pButton);
+ return 0;
+}
+/*-- 14.06.2004 09:34:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeOutputPage, SendTypeHdl_Impl, ListBox*, pBox)
+{
+ ULONG nDocType = (ULONG)pBox->GetEntryData(pBox->GetSelectEntryPos());
+ sal_Bool bEnable = MM_DOCTYPE_HTML != nDocType && MM_DOCTYPE_TEXT != nDocType;
+ m_aSendAsPB.Enable( bEnable );
+ m_aAttachmentFT.Enable( bEnable );
+ m_aAttachmentED.Enable( bEnable );
+ if(bEnable)
+ {
+ //add the correct extension
+ String sAttach(m_aAttachmentED.GetText());
+ //do nothing if the user has removed the name - the warning will come early enough
+ if(sAttach.Len())
+ {
+ xub_StrLen nTokenCount = sAttach.GetTokenCount( '.' );
+ if( 2 > nTokenCount)
+ {
+ sAttach += '.';
+ ++nTokenCount;
+ }
+ sAttach.SetToken( nTokenCount - 1, '.', lcl_GetExtensionForDocType( nDocType ));
+ m_aAttachmentED.SetText(sAttach);
+ }
+ }
+ return 0;
+}
+/*-- 17.05.2004 13:51:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeOutputPage, SendAsHdl_Impl, PushButton*, pButton)
+{
+ SwMailBodyDialog* pDlg = new SwMailBodyDialog(pButton, m_pWizard);
+ pDlg->SetBody(m_sBody);
+ if(RET_OK == pDlg->Execute())
+ {
+ m_sBody = pDlg->GetBody();
+ }
+ return 0;
+}
+/*-- 21.05.2004 12:03:25---------------------------------------------------
+ Send documents as e-mail
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton)
+{
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+
+ //get the composed document
+ SwView* pTargetView = rConfigItem.GetTargetView();
+ DBG_ASSERT(pTargetView, "no target view exists");
+ if(!pTargetView)
+ return 0;
+
+ if(!rConfigItem.GetMailServer().getLength() ||
+ !SwMailMergeHelper::CheckMailAddress(rConfigItem.GetMailAddress()) )
+ {
+ QueryBox aQuery(pButton, WB_YES_NO_CANCEL, m_sConfigureMail);
+ USHORT nRet = aQuery.Execute();
+ if(RET_YES == nRet )
+ {
+ SfxAllItemSet aSet(pTargetView->GetPool());
+ SwMailConfigDlg* pDlg = new SwMailConfigDlg(pButton, aSet);
+ nRet = pDlg->Execute();
+ delete pDlg;
+ }
+
+ if(nRet != RET_OK && nRet != RET_YES)
+ return 0;
+ }
+ //add the documents
+ sal_uInt32 nBegin = 0;
+ sal_uInt32 nEnd = 0;
+ if(m_aSendAllRB.IsChecked())
+ {
+ nBegin = 0;
+ nEnd = rConfigItem.GetMergedDocumentCount();
+ }
+ else
+ {
+ nBegin = static_cast< sal_Int32 >(m_aFromNF.GetValue() - 1);
+ nEnd = static_cast< sal_Int32 >(m_aToNF.GetValue());
+ if(nEnd > rConfigItem.GetMergedDocumentCount())
+ nEnd = rConfigItem.GetMergedDocumentCount();
+ }
+ bool bAsBody = false;
+ bool bIsPDF = false;
+ rtl_TextEncoding eEncoding = ::gsl_getSystemTextEncoding();
+ SfxFilterContainer* pFilterContainer = SwDocShell::Factory().GetFilterContainer();
+ const SfxFilter *pSfxFlt = 0;
+ ULONG nDocType = (ULONG)m_aSendAsLB.GetEntryData(m_aSendAsLB.GetSelectEntryPos());
+ String sExtension = lcl_GetExtensionForDocType(nDocType);
+ switch( nDocType )
+ {
+ case MM_DOCTYPE_OOO : break;
+ case MM_DOCTYPE_PDF : bIsPDF = true;
+ {
+ //the method SwIOSystemGetFilterOfFormat( ) returns the template filter
+ //because it uses the same user data :-(
+ SfxFilterMatcher aMatcher( pFilterContainer->GetName() );
+ SfxFilterMatcherIter aIter( &aMatcher );
+ const SfxFilter* pFilter = aIter.First();
+ String sFilterMime( String::CreateFromAscii( "application/pdf" ));
+ while ( pFilter )
+ {
+ if( pFilter->GetMimeType() == sFilterMime && pFilter->CanExport() )
+ {
+ pSfxFlt = pFilter;
+ break;
+ }
+ pFilter = aIter.Next();
+ }
+
+ }
+ break;
+ case MM_DOCTYPE_WORD:
+ {
+ //the method SwIOSystemGetFilterOfFormat( ) returns the template filter
+ //because it uses the same user data :-(
+ SfxFilterMatcher aMatcher( pFilterContainer->GetName() );
+ SfxFilterMatcherIter aIter( &aMatcher );
+ const SfxFilter* pFilter = aIter.First();
+ String sFilterUserData( String::CreateFromAscii( FILTER_WW8 ));
+ while ( pFilter )
+ {
+ if( pFilter->GetUserData() == sFilterUserData && pFilter->CanExport() )
+ {
+ pSfxFlt = pFilter;
+ break;
+ }
+ pFilter = aIter.Next();
+ }
+
+ }
+ break;
+ case MM_DOCTYPE_HTML:
+ {
+ bAsBody = true;
+ SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get();
+ eEncoding = pHtmlOptions->GetTextEncoding();
+ }
+ break;
+ case MM_DOCTYPE_TEXT:
+ bAsBody = true;
+ break;
+ }
+ if(!pSfxFlt)
+ pSfxFlt = pFilterContainer->GetFilter4Extension(sExtension, SFX_FILTER_EXPORT);
+
+ if(!pSfxFlt)
+ return 0;
+ String sMimeType = pSfxFlt->GetMimeType();
+
+ if(!m_aSubjectED.GetText().Len())
+ {
+ SwSendQueryBox_Impl aQuery(pButton, m_sNoSubjectQueryST);
+ aQuery.SetIsEmptyTextAllowed(true);
+ aQuery.SetValue(m_sNoSubjectST);
+ if(RET_OK == aQuery.Execute())
+ {
+ if(aQuery.GetValue() != m_sNoSubjectST)
+ m_aSubjectED.SetText(aQuery.GetValue());
+ }
+ else
+ return 0;
+ }
+ if(!bAsBody && !m_aAttachmentED.GetText().Len())
+ {
+ SwSendQueryBox_Impl aQuery(pButton, m_sNoAttachmentNameST);
+ aQuery.SetIsEmptyTextAllowed(false);
+ if(RET_OK == aQuery.Execute())
+ {
+ String sAttach(aQuery.GetValue());
+ xub_StrLen nTokenCount = sAttach.GetTokenCount( '.' );
+ if( 2 > nTokenCount)
+ {
+ sAttach += '.';
+ ++nTokenCount;
+ }
+ sAttach.SetToken( nTokenCount - 1, '.', lcl_GetExtensionForDocType(
+ (ULONG)m_aSendAsLB.GetEntryData(m_aSendAsLB.GetSelectEntryPos())));
+ m_aAttachmentED.SetText(sAttach);
+ }
+ else
+ return 0;
+ }
+ SfxStringItem aFilterName( SID_FILTER_NAME, pSfxFlt->GetFilterName() );
+ String sEMailColumn = m_aMailToLB.GetSelectEntry();
+ DBG_ASSERT( sEMailColumn.Len(), "No email column selected");
+ Reference< sdbcx::XColumnsSupplier > xColsSupp( rConfigItem.GetResultSet(), UNO_QUERY);
+ Reference < container::XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : 0;
+ if(!sEMailColumn.Len() || !xColAccess.is() || !xColAccess->hasByName(sEMailColumn))
+ return 0;
+
+ String sFilterOptions;
+ if(MM_DOCTYPE_TEXT == nDocType)
+ {
+ SwAsciiOptions aOpt;
+ USHORT nAppScriptType = GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() );
+ USHORT nWhich = GetWhichOfScript( RES_CHRATR_LANGUAGE, nAppScriptType);
+ aOpt.SetLanguage( ((SvxLanguageItem&)pTargetView->GetWrtShell().
+ GetDefault( nWhich )).GetLanguage());
+ aOpt.SetParaFlags( LINEEND_CR );
+ aOpt.WriteUserData( sFilterOptions );
+ }
+ String sTargetTempURL = URIHelper::SmartRel2Abs(
+ INetURLObject(), utl::TempFile::CreateTempName(),
+ URIHelper::GetMaybeFileHdl());
+ const SfxFilter *pTargetSfxFlt = SwIoSystem::GetFilterOfFormat(
+ String::CreateFromAscii( FILTER_XML ),
+ SwDocShell::Factory().GetFilterContainer() );
+
+ uno::Sequence< beans::PropertyValue > aValues(1);
+ beans::PropertyValue* pValues = aValues.getArray();
+ pValues[0].Name = C2U("FilterName");
+ pValues[0].Value <<= ::rtl::OUString(pTargetSfxFlt->GetFilterName());
+
+ uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY);
+ xStore->storeToURL( sTargetTempURL, aValues );
+
+ //create the send dialog
+ SwSendMailDialog* pDlg = new SwSendMailDialog( pButton, rConfigItem );
+ pDlg->SetDocumentCount( nEnd );
+ pDlg->ShowDialog();
+ //help to force painting the dialog
+ //TODO/CLEANUP
+ //Sollbruchstelle
+ for ( sal_Int16 i = 0; i < 25; i++)
+ Application::Reschedule();
+ for(sal_uInt32 nDoc = nBegin; nDoc < nEnd; ++nDoc)
+ {
+ m_pWizard->EnterWait();
+ SwDocMergeInfo& rInfo = rConfigItem.GetDocumentMergeInfo(nDoc);
+
+ //now extract a document from the target document
+ // the shell will be closed at the end, but it is more safe to use SfxObjectShellLock here
+ SfxObjectShellLock xTempDocShell( new SwDocShell( SFX_CREATE_MODE_STANDARD ) );
+ xTempDocShell->DoInitNew( 0 );
+ SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 );
+// pTempFrame->GetFrame().Appear();
+ SwView* pTempView = static_cast<SwView*>( pTempFrame->GetViewShell() );
+ pTargetView->GetWrtShell().StartAction();
+ SwgReaderOption aOpt;
+ aOpt.SetTxtFmts( sal_True );
+ aOpt.SetFrmFmts( sal_True );
+ aOpt.SetPageDescs( sal_True );
+ aOpt.SetNumRules( sal_True );
+ aOpt.SetMerge( sal_False );
+ pTempView->GetDocShell()->LoadStylesFromFile(
+ sTargetTempURL, aOpt, sal_True );
+ pTargetView->GetWrtShell().PastePages(pTempView->GetWrtShell(),
+ (USHORT)rInfo.nStartPageInTarget, (USHORT)rInfo.nEndPageInTarget );
+ pTargetView->GetWrtShell().EndAction();
+
+ //then save it
+ SfxStringItem aName(SID_FILE_NAME,
+ URIHelper::SmartRel2Abs(
+ INetURLObject(), utl::TempFile::CreateTempName(0),
+ URIHelper::GetMaybeFileHdl()) );
+
+/* if(bIsPDF)
+ {
+ SfxDispatcher* pSfxDispatcher = pTempView->GetViewFrame()->GetDispatcher();
+ pSfxDispatcher->Execute(
+ SID_DIRECTEXPORTDOCASPDF,
+ SFX_CALLMODE_SYNCHRON, &aName, &aFilterName, 0L );
+ }
+ else*/
+ {
+ uno::Sequence< beans::PropertyValue > aFilterValues(MM_DOCTYPE_TEXT == nDocType ? 2 : 1);
+ beans::PropertyValue* pFilterValues = aFilterValues.getArray();
+ pFilterValues[0].Name = C2U("FilterName");
+ pFilterValues[0].Value <<= ::rtl::OUString(pSfxFlt->GetFilterName());
+ if(MM_DOCTYPE_TEXT == nDocType)
+ {
+ pFilterValues[1].Name = C2U("FilterOptions");
+ pFilterValues[1].Value <<= ::rtl::OUString(sFilterOptions);
+ }
+
+ uno::Reference< frame::XStorable > xTempStore( pTempView->GetDocShell()->GetModel(), uno::UNO_QUERY);
+ xTempStore->storeToURL( aName.GetValue(), aFilterValues );
+ }
+ xTempDocShell->DoClose();
+
+#ifdef DBG_UTIL
+ sal_Int32 nTarget =
+#endif
+ rConfigItem.MoveResultSet(rInfo.nDBRow);
+ DBG_ASSERT( nTarget == rInfo.nDBRow, "row of current document could not be selected");
+ DBG_ASSERT( sEMailColumn.Len(), "No email column selected");
+ ::rtl::OUString sEMail = lcl_GetColumnValueOf(sEMailColumn, xColAccess);
+ SwMailDescriptor aDesc;
+ aDesc.sEMail = sEMail;
+ rtl::OUString sBody;
+ if(bAsBody)
+ {
+ {
+ //read in the temporary file and use it as mail body
+ SfxMedium aMedium( aName.GetValue(), STREAM_READ, TRUE);
+ SvStream* pInStream = aMedium.GetInStream();
+ if(pInStream)
+ pInStream->SetStreamCharSet( eEncoding );
+ else
+ {
+ DBG_ERROR("no output file created?");
+ continue;
+ }
+ ByteString sLine;
+ sal_Bool bDone = pInStream->ReadLine( sLine );
+ while ( bDone )
+ {
+ sBody += rtl::OUString(String(sLine, eEncoding));
+ sBody += rtl::OUString('\n');
+ bDone = pInStream->ReadLine( sLine );
+ }
+ }
+ //remove the temporary file
+ SWUnoHelper::UCB_DeleteFile( aName.GetValue() );
+ }
+ else
+ {
+ sBody = m_sBody;
+ aDesc.sAttachmentURL = aName.GetValue();
+ String sAttachment(m_aAttachmentED.GetText());
+ xub_StrLen nTokenCount = sAttachment.GetTokenCount( '.' );
+ if( 2 > nTokenCount)
+ {
+ sAttachment += '.';
+ sAttachment.SetToken( nTokenCount, '.', sExtension);
+ }
+ else if(sAttachment.GetToken( nTokenCount - 1, '.') != sExtension)
+ sAttachment += sExtension;
+ aDesc.sAttachmentName = sAttachment;
+ aDesc.sMimeType = sMimeType;
+
+ if(rConfigItem.IsGreetingLine(sal_True))
+ {
+ ::rtl::OUString sNameColumn = rConfigItem.GetAssignedColumn(MM_PART_LASTNAME);
+ ::rtl::OUString sName = lcl_GetColumnValueOf(sNameColumn, xColAccess);
+ String sGreeting;
+ if(sName.getLength() && rConfigItem.IsIndividualGreeting(sal_True))
+ {
+ ::rtl::OUString sGenderColumn = rConfigItem.GetAssignedColumn(MM_PART_GENDER);
+ const ::rtl::OUString& sFemaleValue = rConfigItem.GetFemaleGenderValue();
+ ::rtl::OUString sGenderValue = lcl_GetColumnValueOf(sGenderColumn, xColAccess);
+ SwMailMergeConfigItem::Gender eGenderType = sGenderValue == sFemaleValue ?
+ SwMailMergeConfigItem::FEMALE :
+ SwMailMergeConfigItem::MALE;
+
+ sGreeting = SwAddressPreview::FillData(
+ rConfigItem.GetGreetings(eGenderType)
+ [rConfigItem.GetCurrentGreeting(eGenderType)],
+ rConfigItem);
+ }
+ else
+ {
+ sGreeting =
+ rConfigItem.GetGreetings(SwMailMergeConfigItem::NEUTRAL)
+ [rConfigItem.GetCurrentGreeting(SwMailMergeConfigItem::NEUTRAL)];
+
+ }
+ sGreeting += '\n';
+ ::rtl::OUString sTemp( sGreeting );
+ sTemp += sBody;
+ sBody = sTemp;
+ }
+ }
+ aDesc.sBodyContent = sBody;
+ if(MM_DOCTYPE_HTML == nDocType)
+ {
+ aDesc.sBodyMimeType = ::rtl::OUString::createFromAscii("text/html; charset=");
+ aDesc.sBodyMimeType += ::rtl::OUString::createFromAscii(
+ rtl_getBestMimeCharsetFromTextEncoding( eEncoding ));
+ }
+ else
+ aDesc.sBodyMimeType =
+ ::rtl::OUString::createFromAscii("text/plain; charset=UTF-8; format=flowed");
+
+ aDesc.sSubject = m_aSubjectED.GetText();
+ aDesc.sCC = m_sCC;
+ aDesc.sBCC = m_sBCC;
+ pDlg->AddDocument( aDesc );
+ //help to force painting the dialog
+ for ( sal_Int16 i = 0; i < 25; i++)
+ Application::Reschedule();
+ //stop creating of data when dialog has been closed
+ if(!pDlg->IsVisible())
+ {
+ m_pWizard->LeaveWait();
+ break;
+ }
+ m_pWizard->LeaveWait();
+ }
+ pDlg->EnableDesctruction();
+ ::osl::File::remove( sTargetTempURL );
+
+ m_pWizard->enableButtons(WZB_FINISH, sal_True);
+ //the dialog deletes itself
+ //delete pDlg;
+ return 0;
+}
diff --git a/sw/source/ui/dbui/mmoutputpage.hrc b/sw/source/ui/dbui/mmoutputpage.hrc
new file mode 100644
index 000000000000..f8daf2734b0c
--- /dev/null
+++ b/sw/source/ui/dbui/mmoutputpage.hrc
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEOUTPUTTYPEPAGE_HRC
+#define _MAILMERGEOUTPUTTYPEPAGE_HRC
+
+#define FI_HEADER 1
+#define FI_OPTIONS 2
+#define RB_SAVESTARTDOC 3
+#define RB_SAVEMERGEDDOC 4
+#define RB_PRINT 5
+#define RB_SENDMAIL 6
+#define FL_SEPARATOR 7
+#define PB_SAVESTARTDOC 8
+#define RB_SAVEASONE 12
+#define RB_SAVEINDIVIDUAL 13
+
+#define RB_FROM 15
+#define NF_FROM 16
+#define FT_TO 17
+#define NF_TO 18
+#define PB_SAVENOW 19
+
+#define FT_PRINT 21
+#define LB_PRINT 22
+#define PB_PRINTERSETTINGS 23
+#define RB_PRINTALL 24
+#define RB_PRINTCURRENT 25
+#define PB_PRINTNOW 26
+#define ST_SAVESTART 27
+#define ST_SAVEMERGED 28
+#define ST_PRINT 29
+#define ST_SENDMAIL 30
+
+#define FT_MAILTO 31
+#define LB_MAILTO 32
+#define PB_COPYTO 33
+#define FT_SUBJECT 34
+#define ED_SUBJECT 35
+#define FT_SENDAS 36
+#define LB_SENDAS 37
+#define PB_SENDAS 38
+#define RB_SENDALL 39
+#define PB_SENDDOCUMENTS 40
+
+#define FI_DESCRIPTION 41
+#define FT_CC 42
+#define ED_CC 43
+#define FT_BCC 44
+#define ED_BCC 45
+#define PB_OK 47
+#define PB_CANCEL 48
+#define PB_HELP 49
+#define FI_NOTE 50
+#define FT_ATTACHMENT 51
+#define ED_ATTACHMENT 52
+#define ST_DEFAULTATTACHMENT 53
+#define ST_SUBJECTQUERY 54
+#define ST_NOSUBJECT 55
+#define ST_NOATTACHMENTNAME 56
+#define ST_CONFIGUREMAIL 57
+
+#define IM_QUERY 58
+#define FI_QUERY 59
+#define ED_TEXT 60
+
+#define MM_DOCTYPE_OOO 1
+#define MM_DOCTYPE_PDF 2
+#define MM_DOCTYPE_WORD 3
+#define MM_DOCTYPE_HTML 4
+#define MM_DOCTYPE_TEXT 5
+
+
+#define IM_WARNING 1
+#define FI_WARNING 2
+#define FT_FILENAME 3
+#define ED_FILENAME 4
+
+#endif
+
diff --git a/sw/source/ui/dbui/mmoutputpage.hxx b/sw/source/ui/dbui/mmoutputpage.hxx
new file mode 100644
index 000000000000..c48d6d210c4f
--- /dev/null
+++ b/sw/source/ui/dbui/mmoutputpage.hxx
@@ -0,0 +1,242 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEOUTPUTPAGE_HXX
+#define _MAILMERGEOUTPUTPAGE_HXX
+#include <svtools/wizardmachine.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/lstbox.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svtools/svtabbx.hxx>
+#include <svtools/headbar.hxx>
+#include <svtools/prgsbar.hxx>
+#include "swdllapi.h"
+#include "mailmergehelper.hxx"
+
+class SwMailMergeWizard;
+class SfxPrinter;
+class SwSendMailDialog;
+
+namespace com{ namespace sun{ namespace star{
+ namespace mail{
+ class XMailMessage;
+ }
+}}}
+/*-- 02.04.2004 09:21:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailMergeOutputPage : public svt::OWizardPage
+{
+ SwBoldFixedInfo m_aHeaderFI;
+ FixedInfo m_aOptionsFI;
+ RadioButton m_aSaveStartDocRB;
+ RadioButton m_aSaveMergedDocRB;
+ RadioButton m_aPrintRB;
+ RadioButton m_aSendMailRB;
+
+ FixedLine m_aSeparatorFL;
+
+ PushButton m_aSaveStartDocPB;
+
+ RadioButton m_aSaveAsOneRB;
+ RadioButton m_aSaveIndividualRB;
+ RadioButton m_aPrintAllRB; //has to be here for tab control reasons
+ RadioButton m_aSendAllRB; //has to be here for tab control reasons
+ //this group is used in save and print
+ RadioButton m_aFromRB;
+ NumericField m_aFromNF;
+ FixedText m_aToFT;
+ NumericField m_aToNF;
+ PushButton m_aSaveNowPB;
+
+ FixedText m_aPrinterFT;
+ ListBox m_aPrinterLB;
+ PushButton m_aPrinterSettingsPB;
+ PushButton m_aPrintNowPB;
+
+ FixedText m_aMailToFT;
+ ListBox m_aMailToLB;
+ PushButton m_aCopyToPB;
+ FixedText m_aSubjectFT;
+ Edit m_aSubjectED;
+ FixedText m_aSendAsFT;
+ ListBox m_aSendAsLB;
+ FixedText m_aAttachmentFT;
+ Edit m_aAttachmentED;
+ PushButton m_aSendAsPB;
+ PushButton m_aSendDocumentsPB;
+
+ //some FixedLine labels
+ String m_sSaveStartST;
+ String m_sSaveMergedST;
+ String m_sPrintST;
+ String m_sSendMailST;
+
+ //misc strings
+ String m_sDefaultAttachmentST;
+ String m_sNoSubjectQueryST;
+ String m_sNoSubjectST;
+ String m_sNoAttachmentNameST;
+ String m_sConfigureMail;
+
+ String m_sBody;
+
+ long m_nFromToRBPos;
+ long m_nFromToFTPos;
+ long m_nFromToNFPos;
+ long m_nRBOffset;
+
+ bool m_bCancelSaving;
+
+ SwMailMergeWizard* m_pWizard;
+
+ //some dialog data
+ Printer* m_pTempPrinter;
+ SfxPrinter* m_pDocumentPrinterCopy;
+ String m_sCC;
+ String m_sBCC;
+
+
+ DECL_LINK(OutputTypeHdl_Impl, RadioButton*);
+ DECL_LINK(CopyToHdl_Impl, PushButton*);
+ DECL_LINK(SaveStartHdl_Impl, PushButton* );
+ DECL_LINK(SaveOutputHdl_Impl, PushButton* );
+ DECL_LINK(PrinterChangeHdl_Impl, ListBox* );
+ DECL_LINK(PrintHdl_Impl, PushButton* );
+ DECL_LINK(PrinterSetupHdl_Impl, PushButton* );
+ DECL_LINK(SendTypeHdl_Impl, ListBox*);
+ DECL_LINK(SendAsHdl_Impl, PushButton*);
+ DECL_LINK(SendDocumentsHdl_Impl, PushButton*);
+ DECL_LINK(DocumentSelectionHdl_Impl, RadioButton*);
+ DECL_LINK(SaveCancelHdl_Impl, Button*);
+protected:
+ virtual bool canAdvance() const;
+ virtual void ActivatePage();
+public:
+ SwMailMergeOutputPage( SwMailMergeWizard* _pParent);
+ ~SwMailMergeOutputPage();
+
+};
+/*-- 21.05.2004 12:48:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+struct SwMailDescriptor
+{
+ ::rtl::OUString sEMail;
+ ::rtl::OUString sAttachmentURL;
+ ::rtl::OUString sAttachmentName;
+ ::rtl::OUString sMimeType;
+ ::rtl::OUString sSubject;
+ ::rtl::OUString sBodyMimeType;
+ ::rtl::OUString sBodyContent;
+
+
+ ::rtl::OUString sCC;
+ ::rtl::OUString sBCC;
+};
+struct SwSendMailDialog_Impl;
+class SwMailMergeConfigItem;
+class SW_DLLPUBLIC SwSendMailDialog : public ModelessDialog //SfxModalDialog
+{
+ FixedLine m_aStatusFL;
+ FixedText m_aStatusFT;
+
+ FixedLine m_aTransferStatusFL;
+ FixedText m_aTransferStatusFT;
+ FixedInfo m_PausedFI;
+ ProgressBar m_aProgressBar;
+ FixedText m_aErrorStatusFT;
+
+ PushButton m_aDetailsPB;
+ HeaderBar m_aStatusHB;
+ SvTabListBox m_aStatusLB;
+
+ FixedLine m_aSeparatorFL;
+
+ PushButton m_aStopPB;
+ PushButton m_aClosePB;
+
+ String m_sMore;
+ String m_sLess;
+ String m_sContinue;
+ String m_sStop;
+ String m_sSend;
+ String m_sTransferStatus;
+ String m_sErrorStatus;
+ String m_sSendingTo;
+ String m_sCompleted;
+ String m_sFailed;
+ String m_sTerminateQuery;
+
+ bool m_bCancel;
+ bool m_bDesctructionEnabled;
+
+ ImageList m_aImageList;
+ ImageList m_aImageListHC;
+
+ SwSendMailDialog_Impl* m_pImpl;
+ SwMailMergeConfigItem* m_pConfigItem;
+ sal_Int32 m_nStatusHeight;
+ sal_Int32 m_nSendCount;
+ sal_Int32 m_nErrorCount;
+
+ SW_DLLPRIVATE DECL_LINK( DetailsHdl_Impl, PushButton* );
+ SW_DLLPRIVATE DECL_LINK( StopHdl_Impl, PushButton* );
+ SW_DLLPRIVATE DECL_LINK( CloseHdl_Impl, PushButton* );
+ SW_DLLPRIVATE DECL_STATIC_LINK( SwSendMailDialog, StartSendMails, SwSendMailDialog* );
+ SW_DLLPRIVATE DECL_STATIC_LINK( SwSendMailDialog, StopSendMails, SwSendMailDialog* );
+ SW_DLLPRIVATE DECL_STATIC_LINK( SwSendMailDialog, RemoveThis, Timer* );
+
+ SW_DLLPRIVATE void IterateMails();
+ SW_DLLPRIVATE void SendMails();
+ SW_DLLPRIVATE void UpdateTransferStatus();
+
+ virtual void StateChanged( StateChangedType nStateChange );
+
+public:
+ SwSendMailDialog( Window* pParent, SwMailMergeConfigItem& );
+ ~SwSendMailDialog();
+
+ void AddDocument( SwMailDescriptor& rDesc );
+ void SetDocumentCount( sal_Int32 nAllDocuments );
+ void EnableDesctruction() {m_bDesctructionEnabled = true;}
+ void ShowDialog();
+
+ void DocumentSent( ::com::sun::star::uno::Reference< ::com::sun::star::mail::XMailMessage>,
+ bool bResult,
+ const ::rtl::OUString* pError );
+ void AllMailsSent();
+
+};
+#endif
+
+
diff --git a/sw/source/ui/dbui/mmoutputpage.src b/sw/source/ui/dbui/mmoutputpage.src
new file mode 100644
index 000000000000..cb3a635af5fb
--- /dev/null
+++ b/sw/source/ui/dbui/mmoutputpage.src
@@ -0,0 +1,490 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <mmoutputpage.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+TabPage DLG_MM_OUTPUT_PAGE
+{
+ HelpID = HID_MM_OUTPUTPAGE ;
+ Size = MAP_APPFONT ( 260 , 250 ) ;
+ Hide = TRUE ;
+
+ FixedText FI_HEADER
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "Save, print or send the document";
+ };
+ FixedText FI_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 27 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "Select one of the options below:";
+ };
+ RadioButton RB_SAVESTARTDOC
+ {
+ HelpID = "sw:RadioButton:DLG_MM_OUTPUT_PAGE:RB_SAVESTARTDOC";
+ Pos = MAP_APPFONT ( 45 , 40 ) ;
+ Size = MAP_APPFONT ( 209 , 10 ) ;
+ Text[ en-US ] = "~Save starting document";
+ };
+ RadioButton RB_SAVEMERGEDDOC
+ {
+ HelpID = "sw:RadioButton:DLG_MM_OUTPUT_PAGE:RB_SAVEMERGEDDOC";
+ Pos = MAP_APPFONT ( 45 , 53 ) ;
+ Size = MAP_APPFONT ( 209 , 10 ) ;
+ Text[ en-US ] = "Save ~merged document" ;
+ };
+ RadioButton RB_PRINT
+ {
+ HelpID = "sw:RadioButton:DLG_MM_OUTPUT_PAGE:RB_PRINT";
+ Pos = MAP_APPFONT ( 45 , 66 ) ;
+ Size = MAP_APPFONT ( 209 , 10 ) ;
+ Text[ en-US ] = "~Print merged document";
+ };
+ RadioButton RB_SENDMAIL
+ {
+ HelpID = "sw:RadioButton:DLG_MM_OUTPUT_PAGE:RB_SENDMAIL";
+ Pos = MAP_APPFONT ( 45 , 79 ) ;
+ Size = MAP_APPFONT ( 209 , 10 ) ;
+ Text[ en-US ] = "Send merged document as ~E-Mail";
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 6 , 95 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ };
+ PushButton PB_SAVESTARTDOC
+ {
+ HelpID = "sw:PushButton:DLG_MM_OUTPUT_PAGE:PB_SAVESTARTDOC";
+ Pos = MAP_APPFONT ( 55 , 108 ) ;
+ Size = MAP_APPFONT ( 100 , 14 ) ;
+ Text[ en-US ] = "Save starting ~document";
+ };
+ RadioButton RB_SAVEASONE
+ {
+ HelpID = "sw:RadioButton:DLG_MM_OUTPUT_PAGE:RB_SAVEASONE";
+ Pos = MAP_APPFONT ( 45 , 109 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text[ en-US ] = "S~ave as single document";
+ };
+ RadioButton RB_SAVEINDIVIDUAL
+ {
+ HelpID = "sw:RadioButton:DLG_MM_OUTPUT_PAGE:RB_SAVEINDIVIDUAL";
+ Pos = MAP_APPFONT ( 45, 123 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text[ en-US ] = "Sa~ve as individual documents";
+ };
+ RadioButton RB_FROM
+ {
+ HelpID = "sw:RadioButton:DLG_MM_OUTPUT_PAGE:RB_FROM";
+ Pos = MAP_APPFONT ( 45 , 137 ) ;
+ Size = MAP_APPFONT ( 30 , 10 ) ;
+ Text[ en-US ] = "~From";
+ };
+ NumericField NF_FROM
+ {
+ HelpID = "sw:NumericField:DLG_MM_OUTPUT_PAGE:NF_FROM";
+ Pos = MAP_APPFONT ( 78 , 136 ) ;
+ Size = MAP_APPFONT ( 20 , 10 ) ;
+ Border = TRUE;
+ Left = TRUE ;
+ First = 1 ;
+ Minimum = 1 ;
+ Repeat = TRUE ;
+ Spin = FALSE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_TO
+ {
+ Pos = MAP_APPFONT ( 101 , 138 ) ;
+ Size = MAP_APPFONT ( 20 , 8 ) ;
+ Right = TRUE;
+ Text[ en-US ] = "~To";
+ };
+ NumericField NF_TO
+ {
+ HelpID = "sw:NumericField:DLG_MM_OUTPUT_PAGE:NF_TO";
+ Pos = MAP_APPFONT ( 124 , 136 ) ;
+ Size = MAP_APPFONT ( 20 , 10 ) ;
+ Border = TRUE;
+ Left = TRUE ;
+ First = 1 ;
+ Minimum = 1 ;
+ Repeat = TRUE ;
+ Spin = FALSE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_SAVENOW
+ {
+ HelpID = "sw:PushButton:DLG_MM_OUTPUT_PAGE:PB_SAVENOW";
+ Pos = MAP_APPFONT ( 45 , 150 ) ;
+ Size = MAP_APPFONT ( 80 , 14 ) ;
+ Text[ en-US ] = "Save Do~cuments";
+ };
+ FixedText FT_PRINT
+ {
+ Pos = MAP_APPFONT ( 12 , 111 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text[ en-US ] = "~Printer";
+ };
+ ListBox LB_PRINT
+ {
+ HelpID = "sw:ListBox:DLG_MM_OUTPUT_PAGE:LB_PRINT";
+ Pos = MAP_APPFONT ( 45 , 109 ) ;
+ Size = MAP_APPFONT ( 147 , 50 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ Sort = TRUE;
+ };
+ PushButton PB_PRINTERSETTINGS
+ {
+ HelpID = "sw:PushButton:DLG_MM_OUTPUT_PAGE:PB_PRINTERSETTINGS";
+ Pos = MAP_APPFONT ( 198 , 108 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text[ en-US ] = "P~roperties...";
+ };
+ RadioButton RB_PRINTALL
+ {
+ HelpID = "sw:RadioButton:DLG_MM_OUTPUT_PAGE:RB_PRINTALL";
+ Pos = MAP_APPFONT ( 45 , 126 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text[ en-US ] = "Print ~all documents";
+ };
+ PushButton PB_PRINTNOW
+ {
+ HelpID = "sw:PushButton:DLG_MM_OUTPUT_PAGE:PB_PRINTNOW";
+ Pos = MAP_APPFONT ( 45 , 155 ) ;
+ Size = MAP_APPFONT ( 80 , 14 ) ;
+ Text[ en-US ] = "Prin~t Documents";
+ };
+
+ FixedText FT_MAILTO
+ {
+ Pos = MAP_APPFONT ( 12 , 111 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text[ en-US ] = "T~o";
+ };
+ ListBox LB_MAILTO
+ {
+ HelpID = "sw:ListBox:DLG_MM_OUTPUT_PAGE:LB_MAILTO";
+ Pos = MAP_APPFONT ( 45 , 109 ) ;
+ Size = MAP_APPFONT ( 147 , 50 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ };
+ PushButton PB_COPYTO
+ {
+ HelpID = "sw:PushButton:DLG_MM_OUTPUT_PAGE:PB_COPYTO";
+ Pos = MAP_APPFONT ( 198 , 108 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text[ en-US ] = "~Copy to...";
+ };
+ FixedText FT_SUBJECT
+ {
+ Pos = MAP_APPFONT ( 12 , 127 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text[ en-US ] = "S~ubject";
+ };
+ Edit ED_SUBJECT
+ {
+ HelpID = "sw:Edit:DLG_MM_OUTPUT_PAGE:ED_SUBJECT";
+ Pos = MAP_APPFONT ( 45 , 125 ) ;
+ Size = MAP_APPFONT ( 147 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedText FT_SENDAS
+ {
+ Pos = MAP_APPFONT ( 12 , 143 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text[ en-US ] = "Sen~d as";
+ };
+ ListBox LB_SENDAS
+ {
+ HelpID = "sw:ListBox:DLG_MM_OUTPUT_PAGE:LB_SENDAS";
+ Pos = MAP_APPFONT ( 45 , 141 ) ;
+ Size = MAP_APPFONT (147 , 70 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ StringList =
+ {
+ < "OpenDocument Text" ; MM_DOCTYPE_OOO ;> ;
+ < "Adobe PDF-Dokument" ; MM_DOCTYPE_PDF ;> ;
+ < "Microsoft Word Dokument" ; MM_DOCTYPE_WORD;> ;
+ < "HTML-Nachricht" ; MM_DOCTYPE_HTML;> ;
+ < "Nur Text" ; MM_DOCTYPE_TEXT;> ;
+ };
+ StringList [en-US]=
+ {
+ < "OpenDocument Text" ; MM_DOCTYPE_OOO ;> ;
+ < "Adobe PDF-Document" ; MM_DOCTYPE_PDF ;> ;
+ < "Microsoft Word Document" ; MM_DOCTYPE_WORD;> ;
+ < "HTML Message" ; MM_DOCTYPE_HTML;> ;
+ < "Plain Text" ; MM_DOCTYPE_TEXT;> ;
+ };
+ };
+ PushButton PB_SENDAS
+ {
+ HelpID = "sw:PushButton:DLG_MM_OUTPUT_PAGE:PB_SENDAS";
+ Pos = MAP_APPFONT ( 198 , 140 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text[ en-US ] = "Pr~operties...";
+ };
+ FixedText FT_ATTACHMENT
+ {
+ Pos = MAP_APPFONT ( 45 , 157 ) ;
+ Size = MAP_APPFONT ( 147 , 8 ) ;
+ Text[ en-US ] = "Name of the a~ttachment";
+ };
+ Edit ED_ATTACHMENT
+ {
+ HelpID = "sw:Edit:DLG_MM_OUTPUT_PAGE:ED_ATTACHMENT";
+ Pos = MAP_APPFONT ( 45 , 168 ) ;
+ Size = MAP_APPFONT ( 147 , 12 ) ;
+ Border = TRUE;
+ };
+ RadioButton RB_SENDALL
+ {
+ HelpID = "sw:RadioButton:DLG_MM_OUTPUT_PAGE:RB_SENDALL";
+ Pos = MAP_APPFONT ( 45 , 184 ) ;
+ Size = MAP_APPFONT ( 153 , 10 ) ;
+ Text[ en-US ] = "S~end all documents";
+ };
+ PushButton PB_SENDDOCUMENTS
+ {
+ HelpID = "sw:PushButton:DLG_MM_OUTPUT_PAGE:PB_SENDDOCUMENTS";
+ Pos = MAP_APPFONT ( 45 , 212 ) ;
+ Size = MAP_APPFONT ( 80 , 14 ) ;
+ Text[ en-US ] = "Se~nd documents";
+ };
+ String ST_SAVESTART
+ {
+ Text[ en-US ] = "Save ~starting document";
+ };
+ String ST_SAVEMERGED
+ {
+ Text[ en-US ] = "Save merged document";
+ };
+ String ST_PRINT
+ {
+ Text[ en-US ] = "Print settings";
+ };
+ String ST_SENDMAIL
+ {
+ Text[ en-US ] = "E-Mail settings";
+ };
+ String ST_DEFAULTATTACHMENT
+ {
+ Text[ en-US ] = "Untitled";
+ };
+ String ST_SUBJECTQUERY
+ {
+ Text[ en-US ] = "You did not specify a subject for this message. If you would like to provide one, please type it now.";
+ };
+ String ST_NOSUBJECT
+ {
+ Text[ en-US ] = "No subject";
+ };
+ String ST_NOATTACHMENTNAME
+ {
+ Text[ en-US ] = "You did not specify a new name for the attachment. If you would like to provide one, please type it now.";
+ };
+ String ST_CONFIGUREMAIL
+ {
+ Text[ en-US ] = "In order to be able to send mail merge documents by e-mail, %PRODUCTNAME requires information about the e-mail account to be used.\n\n Do you want to enter e-mail account information now?";
+ };
+};
+
+ModalDialog DLG_MM_COPYTO
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_COPYTO;
+ Size = MAP_APPFONT ( 250 , 100 ) ;
+ Moveable = TRUE ;
+
+ Text [ en-US ] = "Copy To";
+
+ FixedText FI_DESCRIPTION
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 238 , 8 ) ;
+ Text[ en-US ] = "Send a copy of this mail to:";
+ };
+ FixedText FT_CC
+ {
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text[ en-US ] = "~Cc";
+ };
+ Edit ED_CC
+ {
+ HelpID = "sw:Edit:DLG_MM_COPYTO:ED_CC";
+ Pos = MAP_APPFONT ( 40 , 15 ) ;
+ Size = MAP_APPFONT ( 204 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedText FT_BCC
+ {
+ Pos = MAP_APPFONT ( 6 , 33 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text[ en-US ] = "~Bcc";
+ };
+ Edit ED_BCC
+ {
+ HelpID = "sw:Edit:DLG_MM_COPYTO:ED_BCC";
+ Pos = MAP_APPFONT ( 40 , 31 ) ;
+ Size = MAP_APPFONT ( 204 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedText FI_NOTE
+ {
+ Pos = MAP_APPFONT ( 6 , 47 ) ;
+ Size = MAP_APPFONT ( 204 , 20 ) ;
+ WordBreak = TRUE;
+ Text[ en-US ] = "Note:\nSeparate e-mail addresses with a semicolon (;).";
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 66 ) ;
+ Size = MAP_APPFONT ( 250 , 8 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 85 , 80 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 138 , 80 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 194 , 80 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+ModalDialog DLG_MM_SAVEWARNING
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_SAVEWARNING;
+ Size = MAP_APPFONT ( 200 , 99 ) ;
+ Moveable = TRUE ;
+
+ Text = "%PRODUCTNAME";
+ FixedImage IM_WARNING
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 30 , 30 ) ;
+ };
+ FixedText FI_WARNING
+ {
+ Pos = MAP_APPFONT ( 40 , 3 ) ;
+ Size = MAP_APPFONT ( 150 , 30 ) ;
+ WordBreak = TRUE;
+ Text[ en-US ] = "A document with the name '%1' already exists. Please save this document under a different name.";
+ };
+ FixedText FT_FILENAME
+ {
+ Pos = MAP_APPFONT ( 40, 39 ) ;
+ Size = MAP_APPFONT ( 154, 8 ) ;
+ Text[ en-US ] = "New document name";
+ };
+ Edit ED_FILENAME
+ {
+ HelpID = "sw:Edit:DLG_MM_SAVEWARNING:ED_FILENAME";
+ Pos = MAP_APPFONT ( 40 , 50 ) ;
+ Size = MAP_APPFONT ( 154 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 68 ) ;
+ Size = MAP_APPFONT ( 200 , 8 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 40 , 79) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 93 , 79 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+ModalDialog DLG_MM_QUERY
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_QUERY;
+ Size = MAP_APPFONT ( 240 , 88 ) ;
+ Moveable = TRUE ;
+
+ Text = "%PRODUCTNAME";
+ FixedImage IM_QUERY
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 30 , 30 ) ;
+ };
+ FixedText FI_QUERY
+ {
+ Pos = MAP_APPFONT ( 40 , 6 ) ;
+ Size = MAP_APPFONT ( 190 , 30 ) ;
+ WordBreak = TRUE;
+ };
+ Edit ED_TEXT
+ {
+ HelpID = "sw:Edit:DLG_MM_QUERY:ED_TEXT";
+ Pos = MAP_APPFONT ( 40 , 39 ) ;
+ Size = MAP_APPFONT ( 194 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0 , 57 ) ;
+ Size = MAP_APPFONT ( 240 , 8 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 69 , 68) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 122 , 68 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx
new file mode 100644
index 000000000000..8d229b94c06c
--- /dev/null
+++ b/sw/source/ui/dbui/mmoutputtypepage.cxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <mmoutputtypepage.hxx>
+#include <mailmergewizard.hxx>
+#include <mmconfigitem.hxx>
+#include <vcl/msgbox.hxx>
+#ifndef _DBUI_HRC
+#include <dbui.hrc>
+#endif
+#include <swtypes.hxx>
+#include <mmoutputtypepage.hrc>
+#include <dbui.hrc>
+
+/*-- 02.04.2004 11:06:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeOutputTypePage::SwMailMergeOutputTypePage( SwMailMergeWizard* _pParent) :
+ svt::OWizardPage( _pParent, SW_RES(DLG_MM_OUTPUTTYPE_PAGE)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aHeaderFI( this, SW_RES( FI_HEADER )),
+ m_aTypeFT( this, SW_RES( FT_TYPE )),
+ m_aLetterRB( this, SW_RES( RB_LETTER )),
+ m_aMailRB( this, SW_RES( RB_MAIL )),
+ m_aHintHeaderFI(this, SW_RES( FI_HINTHEADER)),
+ m_aHintFI( this, SW_RES( FI_HINT)),
+ m_aNoMailHintFI(this, SW_RES( FT_NOMAILHINT)),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_sLetterHintHeader( SW_RES( ST_LETTERHINTHEADER)),
+ m_sMailHintHeader( SW_RES( ST_MAILHINTHEADER)),
+ m_sLetterHint( SW_RES( ST_LETTERHINT)),
+ m_sMailHint( SW_RES( ST_MAILHINT)),
+ m_pWizard(_pParent)
+{
+ FreeResource();
+ Link aLink = LINK(this, SwMailMergeOutputTypePage, TypeHdl_Impl);
+ m_aLetterRB.SetClickHdl(aLink);
+ m_aMailRB.SetClickHdl(aLink);
+
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ m_pWizard->EnterWait();
+ bool bMailAvailable = rConfigItem.IsMailAvailable();
+ m_pWizard->LeaveWait();
+ if(rConfigItem.IsOutputToLetter())
+ m_aLetterRB.Check();
+ else
+ m_aMailRB.Check();
+ if(!bMailAvailable)
+ {
+ m_aNoMailHintFI.Show();
+ m_aMailRB.Enable(sal_False);
+ m_aLetterRB.Check();
+ }
+ TypeHdl_Impl(&m_aLetterRB);
+
+}
+/*-- 02.04.2004 11:06:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeOutputTypePage::~SwMailMergeOutputTypePage()
+{
+}
+/*-- 14.04.2004 14:44:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwMailMergeOutputTypePage, TypeHdl_Impl, RadioButton*, EMPTYARG )
+{
+ bool bLetter = m_aLetterRB.IsChecked();
+ m_aHintHeaderFI.SetText(bLetter ? m_sLetterHintHeader : m_sMailHintHeader);
+ m_aHintFI.SetText(bLetter ? m_sLetterHint : m_sMailHint);
+ m_pWizard->GetConfigItem().SetOutputToLetter(bLetter);
+ m_pWizard->updateRoadmapItemLabel( MM_ADDRESSBLOCKPAGE );
+ m_pWizard->UpdateRoadmap();
+ return 0;
+}
+
+
diff --git a/sw/source/ui/dbui/mmoutputtypepage.hrc b/sw/source/ui/dbui/mmoutputtypepage.hrc
new file mode 100644
index 000000000000..6deff71251b9
--- /dev/null
+++ b/sw/source/ui/dbui/mmoutputtypepage.hrc
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEOUTPUTTYPEPAGE_HRC
+#define _MAILMERGEOUTPUTTYPEPAGE_HRC
+
+#define FT_TYPE 1
+#define RB_LETTER 2
+#define RB_MAIL 3
+#define FI_HEADER 4
+#define FI_HINTHEADER 5
+#define FI_HINT 6
+#define ST_LETTERHINTHEADER 7
+#define ST_MAILHINTHEADER 8
+#define ST_LETTERHINT 9
+#define ST_MAILHINT 10
+#define FT_NOMAILHINT 11
+
+#endif
+
+
diff --git a/sw/source/ui/dbui/mmoutputtypepage.hxx b/sw/source/ui/dbui/mmoutputtypepage.hxx
new file mode 100644
index 000000000000..9db02409cd1c
--- /dev/null
+++ b/sw/source/ui/dbui/mmoutputtypepage.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEOUTPUTTYPEPAGE_HXX
+#define _MAILMERGEOUTPUTTYPEPAGE_HXX
+
+#include <svtools/wizardmachine.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+#include <mailmergehelper.hxx>
+class SwMailMergeWizard;
+/*-- 02.04.2004 09:21:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailMergeOutputTypePage : public svt::OWizardPage
+{
+ SwBoldFixedInfo m_aHeaderFI;
+ FixedInfo m_aTypeFT;
+ RadioButton m_aLetterRB;
+ RadioButton m_aMailRB;
+
+ SwBoldFixedInfo m_aHintHeaderFI;
+ FixedInfo m_aHintFI;
+ FixedInfo m_aNoMailHintFI;
+
+ String m_sLetterHintHeader;
+ String m_sMailHintHeader;
+ String m_sLetterHint;
+ String m_sMailHint;
+
+ SwMailMergeWizard* m_pWizard;
+
+ DECL_LINK(TypeHdl_Impl, RadioButton*);
+
+public:
+ SwMailMergeOutputTypePage( SwMailMergeWizard* _pParent);
+ ~SwMailMergeOutputTypePage();
+
+};
+#endif
+
+
diff --git a/sw/source/ui/dbui/mmoutputtypepage.src b/sw/source/ui/dbui/mmoutputtypepage.src
new file mode 100644
index 000000000000..f1b9fda069ce
--- /dev/null
+++ b/sw/source/ui/dbui/mmoutputtypepage.src
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <mmoutputtypepage.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+TabPage DLG_MM_OUTPUTTYPE_PAGE
+{
+ HelpID = HID_MM_OUTPUTTYPEPAGE ;
+ Size = MAP_APPFONT ( 260 , 250 ) ;
+ Hide = TRUE ;
+
+ FixedText FI_HEADER
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "Select a document type";
+ };
+ FixedText FT_TYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 27 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "What type of document do you want to create?";
+ };
+ RadioButton RB_LETTER
+ {
+ HelpID = "sw:RadioButton:DLG_MM_OUTPUTTYPE_PAGE:RB_LETTER";
+ Pos = MAP_APPFONT ( 12 , 43 ) ;
+ Size = MAP_APPFONT ( 240 , 10 ) ;
+ Text[ en-US ] = "~Letter";
+ };
+ RadioButton RB_MAIL
+ {
+ HelpID = "sw:RadioButton:DLG_MM_OUTPUTTYPE_PAGE:RB_MAIL";
+ Pos = MAP_APPFONT ( 12 , 57 ) ;
+ Size = MAP_APPFONT ( 240 , 10 ) ;
+ Text[ en-US ] = "~E-mail message";
+ };
+ FixedText FI_HINTHEADER
+ {
+ Pos = MAP_APPFONT ( 12 , 72) ;
+ Size = MAP_APPFONT ( 242 , 8 ) ;
+ };
+ FixedText FI_HINT
+ {
+ Pos = MAP_APPFONT ( 12 , 83 ) ;
+ Size = MAP_APPFONT ( 242 , 26 ) ;
+ WordBreak = TRUE;
+ };
+ String ST_LETTERHINTHEADER
+ {
+ Text[ en-US ] = "Letter:";
+ };
+ String ST_MAILHINTHEADER
+ {
+ Text[ en-US ] = "E-Mail Message:";
+ };
+ String ST_LETTERHINT
+ {
+ Text[ en-US ] = "Send letters to a group of recipients. The letters can contain an address block and a salutation. The letters can be personalized for each recipient.";
+ };
+ String ST_MAILHINT
+ {
+ Text[ en-US ] = "Send e-mail messages to a group of recipients. The e-mail messages can contain a salutation. The e-mail messages can be personalized for each recipient.";
+ };
+ FixedText FT_NOMAILHINT
+ {
+ Pos = MAP_APPFONT ( 12 , 113 ) ;
+ Size = MAP_APPFONT ( 242 , 42 ) ;
+ WordBreak = TRUE;
+ Hide = TRUE;
+ Text[ en-US ] = "%PRODUCTNAME was unable to find a Java Mail connection. In order to send e-mail with %PRODUCTNAME, you need to install the latest version of Java Mail. You can find further information about Java Mail on the internet at 'http://java.sun.com/products/javamail/'.";
+ };
+};
+
+
+
diff --git a/sw/source/ui/dbui/mmpreparemergepage.cxx b/sw/source/ui/dbui/mmpreparemergepage.cxx
new file mode 100644
index 000000000000..8539f037ecdc
--- /dev/null
+++ b/sw/source/ui/dbui/mmpreparemergepage.cxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <mmpreparemergepage.hxx>
+#include <mailmergewizard.hxx>
+#include <mmconfigitem.hxx>
+#ifndef _DBUI_HRC
+#include <dbui.hrc>
+#endif
+#include <swtypes.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <swabstdlg.hxx>
+
+
+#include <mmpreparemergepage.hrc>
+#include <dbui.hrc>
+
+#include <unomid.h>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdbc;
+using ::rtl::OUString;
+
+/*-- 02.04.2004 16:42:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergePrepareMergePage::SwMailMergePrepareMergePage( SwMailMergeWizard* _pParent) :
+ svt::OWizardPage( _pParent, SW_RES(DLG_MM_PREPAREMERGE_PAGE)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aHeaderFI(this, SW_RES( FI_HEADER ) ),
+ m_aPreviewFI(this, SW_RES( FI_PREVIEW ) ),
+ m_aRecipientFT(this, SW_RES( FT_RECIPIENT ) ),
+ m_aFirstPB(this, SW_RES( PB_FIRST ) ),
+ m_aPrevPB(this, SW_RES( PB_PREV ) ),
+ m_aRecordED(this, SW_RES( ED_RECORD ) ),
+ m_aNextPB(this, SW_RES( PB_NEXT ) ),
+ m_aLastPB(this, SW_RES( PB_LAST ) ),
+ m_ExcludeCB(this, SW_RES( CB_EXCLUDE ) ),
+ m_aNoteHeaderFL(this, SW_RES( FL_NOTEHEADER ) ),
+ m_aEditFI(this, SW_RES( FI_EDIT ) ),
+ m_aEditPB(this, SW_RES( PB_EDIT ) ),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_pWizard(_pParent)
+{
+ FreeResource();
+ m_aEditPB.SetClickHdl( LINK( this, SwMailMergePrepareMergePage, EditDocumentHdl_Impl));
+ Link aMoveLink(LINK( this, SwMailMergePrepareMergePage, MoveHdl_Impl));
+ m_aFirstPB.SetClickHdl( aMoveLink );
+ m_aPrevPB.SetClickHdl( aMoveLink );
+ m_aNextPB.SetClickHdl( aMoveLink );
+ m_aLastPB.SetClickHdl( aMoveLink );
+ m_aRecordED.SetActionHdl( aMoveLink );
+ m_ExcludeCB.SetClickHdl(LINK(this, SwMailMergePrepareMergePage, ExcludeHdl_Impl));
+ aMoveLink.Call(&m_aRecordED);
+}
+/*-- 02.04.2004 16:42:49---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergePrepareMergePage::~SwMailMergePrepareMergePage()
+{
+}
+/*-- 13.05.2004 15:36:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwMailMergePrepareMergePage, EditDocumentHdl_Impl, PushButton*, EMPTYARG)
+{
+ m_pWizard->SetRestartPage(MM_PREPAREMERGEPAGE);
+ m_pWizard->EndDialog(RET_EDIT_DOC);
+ return 0;
+}
+/*-- 27.05.2004 14:16:37---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwMailMergePrepareMergePage, MoveHdl_Impl, void*, pCtrl)
+{
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ sal_Int32 nPos = rConfigItem.GetResultSetPosition();
+ if(pCtrl == &m_aFirstPB)
+ {
+ rConfigItem.MoveResultSet(1);
+ }
+ else if(pCtrl == &m_aPrevPB)
+ {
+ rConfigItem.MoveResultSet(nPos - 1);
+ }
+ else if(pCtrl == &m_aRecordED)
+ {
+ rConfigItem.MoveResultSet( static_cast< sal_Int32 >(m_aRecordED.GetValue()) );
+ }
+ else if(pCtrl == &m_aNextPB)
+ rConfigItem.MoveResultSet(nPos + 1);
+ else if(pCtrl == &m_aLastPB)
+ rConfigItem.MoveResultSet(-1);
+
+ nPos = rConfigItem.GetResultSetPosition();
+ m_aRecordED.SetValue(nPos);
+ bool bIsFirst;
+ bool bIsLast;
+ bool bValid = rConfigItem.IsResultSetFirstLast(bIsFirst, bIsLast);
+ m_aFirstPB.Enable(bValid && !bIsFirst);
+ m_aPrevPB.Enable(bValid && !bIsFirst);
+ m_aNextPB.Enable(bValid && !bIsLast);
+ m_aLastPB.Enable(bValid && !bIsLast);
+ m_ExcludeCB.Check(rConfigItem.IsRecordExcluded( rConfigItem.GetResultSetPosition() ));
+ //now the record has to be merged into the source document
+ const SwDBData& rDBData = rConfigItem.GetCurrentDBData();
+
+ Sequence< PropertyValue > aArgs(7);
+ Sequence<Any> aSelection(1);
+ aSelection[0] <<= rConfigItem.GetResultSetPosition();
+ aArgs[0].Name = C2U("Selection");
+ aArgs[0].Value <<= aSelection;
+ aArgs[1].Name = C2U("DataSourceName");
+ aArgs[1].Value <<= rDBData.sDataSource;
+ aArgs[2].Name = C2U("Command");
+ aArgs[2].Value <<= rDBData.sCommand;
+ aArgs[3].Name = C2U("CommandType");
+ aArgs[3].Value <<= rDBData.nCommandType;
+ aArgs[4].Name = C2U("ActiveConnection");
+ aArgs[4].Value <<= rConfigItem.GetConnection().getTyped();
+ aArgs[5].Name = C2U("Filter");
+ aArgs[5].Value <<= rConfigItem.GetFilter();
+ aArgs[6].Name = C2U("Cursor");
+ aArgs[6].Value <<= rConfigItem.GetResultSet();
+
+ ::svx::ODataAccessDescriptor aDescriptor(aArgs);
+ SwWrtShell& rSh = m_pWizard->GetSwView()->GetWrtShell();
+ SwMergeDescriptor aMergeDesc( DBMGR_MERGE, rSh, aDescriptor );
+ rSh.GetNewDBMgr()->MergeNew(aMergeDesc);
+ return 0;
+}
+/*-- 27.05.2004 14:46:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwMailMergePrepareMergePage, ExcludeHdl_Impl, CheckBox*, pBox)
+{
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ rConfigItem.ExcludeRecord( rConfigItem.GetResultSetPosition(), pBox->IsChecked());
+ return 0;
+};
+/*-- 18.08.2004 10:36:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMailMergePrepareMergePage::ActivatePage()
+{
+ MoveHdl_Impl(&m_aRecordED);
+}
+/*-- 13.05.2004 15:38:32---------------------------------------------------
+ merge the data into a new file
+ -----------------------------------------------------------------------*/
+sal_Bool SwMailMergePrepareMergePage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason )
+{
+ SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
+ if(::svt::WizardTypes::eTravelForward == _eReason && !rConfigItem.IsMergeDone())
+ {
+ m_pWizard->CreateTargetDocument();
+ m_pWizard->SetRestartPage(MM_MERGEPAGE);
+ m_pWizard->EndDialog(RET_TARGET_CREATED);
+ }
+ return sal_True;
+}
diff --git a/sw/source/ui/dbui/mmpreparemergepage.hrc b/sw/source/ui/dbui/mmpreparemergepage.hrc
new file mode 100644
index 000000000000..958df827749b
--- /dev/null
+++ b/sw/source/ui/dbui/mmpreparemergepage.hrc
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEPREPAREMERGEPAGE_HRC
+#define _MAILMERGEPREPAREMERGEPAGE_HRC
+
+#define FI_HEADER 1
+#define FI_PREVIEW 2
+#define PB_FIRST 3
+#define PB_PREV 4
+#define ED_RECORD 5
+#define PB_NEXT 6
+#define PB_LAST 7
+#define CB_EXCLUDE 8
+#define FI_EDIT 9
+#define PB_EDIT 10
+#define FL_NOTEHEADER 11
+
+#define FT_RECIPIENT 13
+
+#endif
+
+
diff --git a/sw/source/ui/dbui/mmpreparemergepage.hxx b/sw/source/ui/dbui/mmpreparemergepage.hxx
new file mode 100644
index 000000000000..8fb7ad938996
--- /dev/null
+++ b/sw/source/ui/dbui/mmpreparemergepage.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEPREPAREMERGEPAGE_HXX
+#define _MAILMERGEPREPAREMERGEPAGE_HXX
+
+#include <svtools/wizardmachine.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/field.hxx>
+#include <svtools/stdctrl.hxx>
+#include <mailmergehelper.hxx>
+#include "actctrl.hxx"
+
+class SwMailMergeWizard;
+/*-- 02.04.2004 09:21:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailMergePrepareMergePage : public svt::OWizardPage
+{
+ SwBoldFixedInfo m_aHeaderFI;
+ FixedInfo m_aPreviewFI;
+ FixedText m_aRecipientFT;
+ PushButton m_aFirstPB;
+ PushButton m_aPrevPB;
+ NumEditAction m_aRecordED;
+ PushButton m_aNextPB;
+ PushButton m_aLastPB;
+ CheckBox m_ExcludeCB;
+
+ FixedLine m_aNoteHeaderFL;
+ FixedInfo m_aEditFI;
+ PushButton m_aEditPB;
+
+
+ SwMailMergeWizard* m_pWizard;
+
+ DECL_LINK(EditDocumentHdl_Impl, PushButton*);
+ DECL_LINK(ExcludeHdl_Impl, CheckBox*);
+ DECL_LINK(MoveHdl_Impl, void*);
+
+ virtual void ActivatePage();
+ virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
+
+public:
+ SwMailMergePrepareMergePage( SwMailMergeWizard* _pParent);
+ ~SwMailMergePrepareMergePage();
+
+};
+
+#endif
+
+
diff --git a/sw/source/ui/dbui/mmpreparemergepage.src b/sw/source/ui/dbui/mmpreparemergepage.src
new file mode 100644
index 000000000000..a94c38bc40fa
--- /dev/null
+++ b/sw/source/ui/dbui/mmpreparemergepage.src
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <mmpreparemergepage.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+TabPage DLG_MM_PREPAREMERGE_PAGE
+{
+ HelpID = HID_MM_PREPAREMERGEPAGE ;
+ Size = MAP_APPFONT ( 260 , 250 ) ;
+ Hide = TRUE ;
+
+ FixedText FI_HEADER
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "Preview and edit the document";
+ };
+
+ FixedText FI_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 6 , 27 ) ;
+ Size = MAP_APPFONT ( 248 , 26 ) ;
+ WordBreak = TRUE;
+ Text[ en-US ] = "The preview of a merged document is visible now. To see the preview of another document click one of the arrows.";
+ };
+ FixedText FT_RECIPIENT
+ {
+ Pos = MAP_APPFONT ( 12 , 58 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text[ en-US ] = "~Recipient";
+ };
+
+ PushButton PB_FIRST
+ {
+ HelpID = "sw:PushButton:DLG_MM_PREPAREMERGE_PAGE:PB_FIRST";
+ Pos = MAP_APPFONT ( 75 , 55 ) ;
+ Size = MAP_APPFONT ( 20 , 14 ) ;
+ Text = "|<" ;
+ QuickHelpText [en-US] = "First";
+ };
+ PushButton PB_PREV
+ {
+ HelpID = "sw:PushButton:DLG_MM_PREPAREMERGE_PAGE:PB_PREV";
+ Pos = MAP_APPFONT ( 98 , 55 ) ;
+ Size = MAP_APPFONT ( 20 , 14 ) ;
+ Text = "<" ;
+ QuickHelpText [en-US] = "Previous";
+ };
+ NumericField ED_RECORD
+ {
+ HelpID = "sw:NumericField:DLG_MM_PREPAREMERGE_PAGE:ED_RECORD";
+ Pos = MAP_APPFONT ( 121 , 56 ) ;
+ Size = MAP_APPFONT ( 20 , 12 ) ;
+ Border = TRUE ;
+ Left = TRUE ;
+ First = 1 ;
+ Minimum = 1 ;
+ Repeat = TRUE ;
+ Spin = FALSE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_NEXT
+ {
+ HelpID = "sw:PushButton:DLG_MM_PREPAREMERGE_PAGE:PB_NEXT";
+ Pos = MAP_APPFONT ( 144 , 55 ) ;
+ Size = MAP_APPFONT ( 20 , 14 ) ;
+ Text = ">" ;
+ QuickHelpText [en-US] = "Next";
+ };
+ PushButton PB_LAST
+ {
+ HelpID = "sw:PushButton:DLG_MM_PREPAREMERGE_PAGE:PB_LAST";
+ Pos = MAP_APPFONT ( 167 , 55 ) ;
+ Size = MAP_APPFONT ( 20 , 14 ) ;
+ Text = ">|" ;
+ QuickHelpText [en-US] = "Last";
+ };
+ CheckBox CB_EXCLUDE
+ {
+ HelpID = "sw:CheckBox:DLG_MM_PREPAREMERGE_PAGE:CB_EXCLUDE";
+ Pos = MAP_APPFONT ( 75, 77 ) ;
+ Size = MAP_APPFONT ( 179 , 10 ) ;
+ Text[ en-US ] = "E~xclude this recipient";
+ };
+ FixedLine FL_NOTEHEADER
+ {
+ Pos = MAP_APPFONT ( 6 , 100 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text[ en-US ] = "Edit Document";
+ };
+ FixedText FI_EDIT
+ {
+ Pos = MAP_APPFONT ( 12 , 122 ) ;
+ Size = MAP_APPFONT ( 242 , 60 ) ;
+ WordBreak = TRUE;
+ Text[ en-US ] = "Write or edit your document now if you have not already done so. The changes will effect all merged documents.\n\nClicking 'Edit Document...' will temporarily reduce the wizard to a small window so you can edit the mail merge document. After editing the document, return to the wizard by clicking 'Return to Mail Merge Wizard' in the small window." ;
+ };
+ PushButton PB_EDIT
+ {
+ HelpID = "sw:PushButton:DLG_MM_PREPAREMERGE_PAGE:PB_EDIT";
+ Pos = MAP_APPFONT ( 90 , 185 ) ;
+ Size = MAP_APPFONT ( 80 , 14 ) ;
+ Text[ en-US ] = "~Edit Document...";
+ };
+};
+
+
diff --git a/sw/source/ui/dbui/selectdbtabledialog.cxx b/sw/source/ui/dbui/selectdbtabledialog.cxx
new file mode 100644
index 000000000000..41f9a18a0325
--- /dev/null
+++ b/sw/source/ui/dbui/selectdbtabledialog.cxx
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <swtypes.hxx>
+#include <selectdbtabledialog.hxx>
+#include <dbtablepreviewdialog.hxx>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+
+#include <unomid.h>
+
+#include <selectdbtabledialog.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+
+/*-- 08.04.2004 14:33:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSelectDBTableDialog::SwSelectDBTableDialog(Window* pParent,
+ const uno::Reference< sdbc::XConnection>& rConnection) :
+ SfxModalDialog(pParent, SW_RES(DLG_MM_SELECTDBTABLEDDIALOG)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ m_aSelectFI( this, SW_RES( FI_SELECT )),
+ m_aTableHB( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER),
+ m_aTableLB( this, SW_RES( LB_TABLE )),
+ m_aPreviewPB( this, SW_RES( PB_PREVIEW )),
+ m_aSeparatorFL(this, SW_RES( FL_SEPARATOR )),
+ m_aOK( this, SW_RES( PB_OK )),
+ m_aCancel( this, SW_RES( PB_CANCEL )),
+ m_aHelp( this, SW_RES( PB_HELP )),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ m_sName( SW_RES( ST_NAME )),
+ m_sType( SW_RES( ST_TYPE )),
+ m_sTable( SW_RES( ST_TABLE )),
+ m_sQuery( SW_RES( ST_QUERY )),
+ m_xConnection(rConnection)
+{
+ FreeResource();
+
+ Size aLBSize(m_aTableLB.GetSizePixel());
+ m_aTableHB.SetSizePixel(aLBSize);
+ Size aHeadSize(m_aTableHB.CalcWindowSizePixel());
+ aHeadSize.Width() = aLBSize.Width();
+ m_aTableHB.SetSizePixel(aHeadSize);
+ Point aLBPos(m_aTableLB.GetPosPixel());
+ m_aTableHB.SetPosPixel(aLBPos);
+ aLBPos.Y() += aHeadSize.Height();
+ aLBSize.Height() -= aHeadSize.Height();
+ m_aTableLB.SetPosSizePixel(aLBPos, aLBSize);
+
+ Size aSz(m_aTableHB.GetOutputSizePixel());
+ m_aTableHB.InsertItem( 1, m_sName,
+ aSz.Width()/2,
+ HIB_LEFT | HIB_VCENTER /*| HIB_CLICKABLE | HIB_UPARROW */);
+ m_aTableHB.InsertItem( 2, m_sType,
+ aSz.Width()/2,
+ HIB_LEFT | HIB_VCENTER /*| HIB_CLICKABLE | HIB_UPARROW */);
+ m_aTableHB.SetHelpId(HID_MM_ADDRESSLIST_HB );
+ m_aTableHB.Show();
+
+ static long nTabs[] = {3, 0, aSz.Width()/2, aSz.Width() };
+ m_aTableLB.SetTabs(&nTabs[0], MAP_PIXEL);
+ m_aTableLB.SetHelpId(HID_MM_SELECTDBTABLEDDIALOG_LISTBOX);
+ m_aTableLB.SetStyle( m_aTableLB.GetStyle() | WB_CLIPCHILDREN );
+ m_aTableLB.SetSpaceBetweenEntries(3);
+ m_aTableLB.SetSelectionMode( SINGLE_SELECTION );
+ m_aTableLB.SetDragDropMode( 0 );
+ m_aTableLB.EnableAsyncDrag(FALSE);
+
+ m_aPreviewPB.SetClickHdl(LINK(this, SwSelectDBTableDialog, PreviewHdl));
+
+ Reference<XTablesSupplier> xTSupplier(m_xConnection, UNO_QUERY);
+ if(xTSupplier.is())
+ {
+ Reference<XNameAccess> xTbls = xTSupplier->getTables();
+ Sequence<rtl::OUString> aTbls = xTbls->getElementNames();
+ const rtl::OUString* pTbls = aTbls.getConstArray();
+ for(long i = 0; i < aTbls.getLength(); i++)
+ {
+ String sEntry = pTbls[i];
+ sEntry += '\t';
+ sEntry += m_sTable;
+ SvLBoxEntry* pEntry = m_aTableLB.InsertEntry(sEntry);
+ pEntry->SetUserData((void*)0);
+ }
+ }
+ Reference<XQueriesSupplier> xQSupplier(m_xConnection, UNO_QUERY);
+ if(xQSupplier.is())
+ {
+ Reference<XNameAccess> xQueries = xQSupplier->getQueries();
+ Sequence<rtl::OUString> aQueries = xQueries->getElementNames();
+ const rtl::OUString* pQueries = aQueries.getConstArray();
+ for(long i = 0; i < aQueries.getLength(); i++)
+ {
+ String sEntry = pQueries[i];
+ sEntry += '\t';
+ sEntry += m_sQuery;
+ SvLBoxEntry* pEntry = m_aTableLB.InsertEntry(sEntry);
+ pEntry->SetUserData((void*)1);
+ }
+ }
+}
+/*-- 08.04.2004 14:33:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSelectDBTableDialog::~SwSelectDBTableDialog()
+{
+}
+/*-- 08.04.2004 14:33:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwSelectDBTableDialog, PreviewHdl, PushButton*, pButton)
+{
+ SvLBoxEntry* pEntry = m_aTableLB.FirstSelected();
+ if(pEntry)
+ {
+ ::rtl::OUString sTableOrQuery = m_aTableLB.GetEntryText(pEntry, 0);
+ sal_Int32 nCommandType = 0 == pEntry->GetUserData() ? 0 : 1;
+
+ ::rtl::OUString sDataSourceName;
+ Reference<XChild> xChild(m_xConnection, UNO_QUERY);
+ if(xChild.is())
+ {
+ Reference<XDataSource> xSource(xChild->getParent(), UNO_QUERY);
+ Reference<XPropertySet> xPrSet(xSource, UNO_QUERY);
+ xPrSet->getPropertyValue(C2U("Name")) >>= sDataSourceName;
+ }
+ DBG_ASSERT(sDataSourceName.getLength(), "no data source found");
+ Sequence<PropertyValue> aProperties(5);
+ PropertyValue* pProperties = aProperties.getArray();
+ pProperties[0].Name = C2U("DataSourceName");
+ pProperties[0].Value <<= sDataSourceName;
+ pProperties[1].Name = C2U("Command");
+ pProperties[1].Value <<= sTableOrQuery;
+ pProperties[2].Name = C2U("CommandType");
+ pProperties[2].Value <<= nCommandType;
+ pProperties[3].Name = C2U("ShowTreeView");
+ sal_Bool bFalse = sal_False;
+ pProperties[3].Value <<= bFalse;
+ pProperties[4].Name = C2U("ShowTreeViewButton");
+ pProperties[4].Value <<= bFalse;
+
+ SwDBTablePreviewDialog* pDlg = new SwDBTablePreviewDialog(pButton, aProperties);
+ pDlg->Execute();
+ delete pDlg;
+ }
+
+ return 0;
+}
+/*-- 19.04.2004 10:03:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+String SwSelectDBTableDialog::GetSelectedTable(bool& bIsTable)
+{
+ SvLBoxEntry* pEntry = m_aTableLB.FirstSelected();
+ bIsTable = pEntry->GetUserData() ? false : true;
+ return pEntry ? m_aTableLB.GetEntryText(pEntry, 0) : String();
+}
+/*-- 13.05.2004 12:58:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSelectDBTableDialog::SetSelectedTable(const String& rTable, bool bIsTable)
+{
+ SvLBoxEntry* pEntry = m_aTableLB.First();
+ while(pEntry)
+ {
+ if((m_aTableLB.GetEntryText(pEntry, 0) == rTable) &&
+ ((pEntry->GetUserData() == 0 ) == bIsTable))
+ {
+ m_aTableLB.Select(pEntry);
+ break;
+ }
+ pEntry = m_aTableLB.Next( pEntry );
+ }
+}
diff --git a/sw/source/ui/dbui/selectdbtabledialog.hrc b/sw/source/ui/dbui/selectdbtabledialog.hrc
new file mode 100644
index 000000000000..24ed1183f97b
--- /dev/null
+++ b/sw/source/ui/dbui/selectdbtabledialog.hrc
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SELECTDBTABLEDIALOG_HRC
+#define _SELECTDBTABLEDIALOG_HRC
+
+#define FI_SELECT 1
+#define LB_TABLE 2
+#define PB_PREVIEW 3
+#define PB_OK 4
+#define PB_CANCEL 5
+#define PB_HELP 6
+#define FL_SEPARATOR 7
+#define ST_TYPE 8
+#define ST_NAME 9
+#define ST_TABLE 10
+#define ST_QUERY 11
+
+#endif
+
diff --git a/sw/source/ui/dbui/selectdbtabledialog.hxx b/sw/source/ui/dbui/selectdbtabledialog.hxx
new file mode 100644
index 000000000000..25b23f692a4c
--- /dev/null
+++ b/sw/source/ui/dbui/selectdbtabledialog.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SELECTDBTABLEDIALOG_HXX
+#define _SELECTDBTABLEDIALOG_HXX
+
+#include <sfx2/basedlgs.hxx>
+
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/fixed.hxx>
+#include <svtools/svtabbx.hxx>
+#include <svtools/headbar.hxx>
+namespace com{namespace sun{namespace star{
+ namespace sdbc{
+ class XConnection;
+ }
+}}}
+
+/*-- 08.04.2004 14:04:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwSelectDBTableDialog : public SfxModalDialog
+{
+ FixedText m_aSelectFI;
+ HeaderBar m_aTableHB;
+ SvTabListBox m_aTableLB;
+ PushButton m_aPreviewPB;
+
+ FixedLine m_aSeparatorFL;
+
+ OKButton m_aOK;
+ CancelButton m_aCancel;
+ HelpButton m_aHelp;
+
+ String m_sName;
+ String m_sType;
+ String m_sTable;
+ String m_sQuery;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> m_xConnection;
+
+ DECL_LINK(PreviewHdl, PushButton*);
+public:
+
+ SwSelectDBTableDialog(Window* pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& xConnection
+ );
+ ~SwSelectDBTableDialog();
+
+ String GetSelectedTable(bool& bIsTable);
+ void SetSelectedTable(const String& rTable, bool bIsTable);
+};
+#endif
+
diff --git a/sw/source/ui/dbui/selectdbtabledialog.src b/sw/source/ui/dbui/selectdbtabledialog.src
new file mode 100644
index 000000000000..157a05faf9f8
--- /dev/null
+++ b/sw/source/ui/dbui/selectdbtabledialog.src
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <selectdbtabledialog.hrc>
+#include <dbui.hrc>
+#include <helpid.h>
+
+ModalDialog DLG_MM_SELECTDBTABLEDDIALOG
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_MM_SELECTDBTABLEDDIALOG;
+ Size = MAP_APPFONT ( 250 , 135 ) ;
+ Moveable = TRUE ;
+
+ Text [ en-US ] = "Select Table";
+
+ FixedText FI_SELECT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 238 , 24 ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "The file you have selected contains more than one table. Please select the table containing the address list you want to use.";
+ };
+ Control LB_TABLE
+ {
+ Pos = MAP_APPFONT ( 6 , 30 ) ;
+ Size = MAP_APPFONT ( 238 , 50 ) ;
+ Border = TRUE;
+ };
+ PushButton PB_PREVIEW
+ {
+ HelpID = "sw:PushButton:DLG_MM_SELECTDBTABLEDDIALOG:PB_PREVIEW";
+ Pos = MAP_APPFONT ( 6 , 84 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Preview";
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 6 , 104 ) ;
+ Size = MAP_APPFONT ( 238 , 8 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 85 , 115 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 138 , 115 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 194 , 115 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ String ST_NAME
+ {
+ Text [ en-US ] = "Name";
+ };
+ String ST_TYPE
+ {
+ Text [ en-US ] = "Type";
+ };
+ String ST_TABLE
+ {
+ Text [ en-US ] = "Table";
+ };
+ String ST_QUERY
+ {
+ Text [ en-US ] = "Query";
+ };
+
+};
diff --git a/sw/source/ui/dbui/swdbtoolsclient.cxx b/sw/source/ui/dbui/swdbtoolsclient.cxx
new file mode 100644
index 000000000000..bb932f0f9a04
--- /dev/null
+++ b/sw/source/ui/dbui/swdbtoolsclient.cxx
@@ -0,0 +1,248 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+#include <swdbtoolsclient.hxx>
+#include <osl/diagnose.h>
+#include <tools/solar.h>
+
+//........................................................................
+
+using namespace ::connectivity::simple;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::sdb;
+
+//====================================================================
+//= SwDbtoolsClient
+//====================================================================
+namespace
+{
+ // -----------------------------------------------------------------------------
+ // this namespace contains access to all static members of the class SwDbtoolsClient
+ // to make the initialize of the dll a little bit faster
+ // -----------------------------------------------------------------------------
+ ::osl::Mutex& getDbtoolsClientMutex()
+ {
+ static ::osl::Mutex aMutex;
+ return aMutex;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int32& getDbToolsClientClients()
+ {
+ static sal_Int32 nClients = 0;
+ return nClients;
+ }
+ // -----------------------------------------------------------------------------
+ oslModule& getDbToolsClientModule()
+ {
+ static oslModule hDbtoolsModule = NULL;
+ return hDbtoolsModule;
+ }
+ // -----------------------------------------------------------------------------
+ createDataAccessToolsFactoryFunction& getDbToolsClientFactoryFunction()
+ {
+ static createDataAccessToolsFactoryFunction pFactoryCreationFunc = NULL;
+ return pFactoryCreationFunc;
+ }
+ // -----------------------------------------------------------------------------
+}
+// -----------------------------------------------------------------------------
+SwDbtoolsClient::SwDbtoolsClient()
+{
+}
+
+//--------------------------------------------------------------------
+SwDbtoolsClient::~SwDbtoolsClient()
+{
+ if(m_xDataAccessFactory.is())
+ {
+ // clear the factory _before_ revoking the client
+ // (the revocation may unload the DBT lib)
+ m_xDataAccessFactory = NULL;
+ // revoke the client
+ revokeClient();
+ }
+}
+
+//--------------------------------------------------------------------
+extern "C" { static void SAL_CALL thisModule() {} }
+
+void SwDbtoolsClient::registerClient()
+{
+ ::osl::MutexGuard aGuard(getDbtoolsClientMutex());
+ if (1 == ++getDbToolsClientClients())
+ {
+ OSL_ENSURE(NULL == getDbToolsClientModule(), "SwDbtoolsClient::registerClient: inconsistence: already have a module!");
+ OSL_ENSURE(NULL == getDbToolsClientFactoryFunction(), "SwDbtoolsClient::registerClient: inconsistence: already have a factory function!");
+
+ const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii(
+ SVLIBRARY( "dbtools" )
+ );
+
+ // load the dbtools library
+ getDbToolsClientModule() = osl_loadModuleRelative(
+ &thisModule, sModuleName.pData, 0);
+ OSL_ENSURE(NULL != getDbToolsClientModule(), "SwDbtoolsClient::registerClient: could not load the dbtools library!");
+ if (NULL != getDbToolsClientModule())
+ {
+ // get the symbol for the method creating the factory
+ const ::rtl::OUString sFactoryCreationFunc = ::rtl::OUString::createFromAscii("createDataAccessToolsFactory");
+ // reinterpret_cast<createDataAccessToolsFactoryFunction> removed for gcc permissive
+ getDbToolsClientFactoryFunction() = reinterpret_cast< createDataAccessToolsFactoryFunction >(
+ osl_getFunctionSymbol(getDbToolsClientModule(), sFactoryCreationFunc.pData));
+
+ if (NULL == getDbToolsClientFactoryFunction())
+ { // did not find the symbol
+ OSL_ENSURE(sal_False, "SwDbtoolsClient::registerClient: could not find the symbol for creating the factory!");
+ osl_unloadModule(getDbToolsClientModule());
+ getDbToolsClientModule() = NULL;
+ }
+ }
+ }
+}
+
+//--------------------------------------------------------------------
+void SwDbtoolsClient::revokeClient()
+{
+ ::osl::MutexGuard aGuard(getDbtoolsClientMutex());
+ if (0 == --getDbToolsClientClients())
+ {
+ getDbToolsClientFactoryFunction() = NULL;
+ if (getDbToolsClientModule())
+ osl_unloadModule(getDbToolsClientModule());
+ getDbToolsClientModule() = NULL;
+ }
+}
+/* -----------------------------30.08.2001 14:58------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDbtoolsClient::getFactory()
+{
+ if(!m_xDataAccessFactory.is())
+ {
+ registerClient();
+ if(getDbToolsClientFactoryFunction())
+ { // loading the lib succeeded
+ void* pUntypedFactory = (*getDbToolsClientFactoryFunction())();
+ IDataAccessToolsFactory* pDBTFactory = static_cast<IDataAccessToolsFactory*>(pUntypedFactory);
+ OSL_ENSURE(pDBTFactory, "SwDbtoolsClient::SwDbtoolsClient: no factory returned!");
+ if (pDBTFactory)
+ {
+ m_xDataAccessFactory = pDBTFactory;
+ // by definition, the factory was aquired once
+ m_xDataAccessFactory->release();
+ }
+ }
+ }
+}
+/* -----------------------------30.08.2001 11:32------------------------------
+
+ ---------------------------------------------------------------------------*/
+::rtl::Reference< ::connectivity::simple::IDataAccessTools >
+ SwDbtoolsClient::getDataAccessTools()
+{
+ if(!m_xDataAccessTools.is())
+ {
+ getFactory();
+ if(m_xDataAccessFactory.is())
+ m_xDataAccessTools = m_xDataAccessFactory->getDataAccessTools();
+ }
+ return m_xDataAccessTools;
+}
+/* -----------------------------30.08.2001 12:40------------------------------
+
+ ---------------------------------------------------------------------------*/
+::rtl::Reference< ::connectivity::simple::IDataAccessTypeConversion >
+ SwDbtoolsClient::getAccessTypeConversion()
+{
+ if(!m_xAccessTypeConversion.is())
+ {
+ getFactory();
+ if(m_xDataAccessFactory.is())
+ m_xAccessTypeConversion = m_xDataAccessFactory->getTypeConversionHelper();
+ }
+ return m_xAccessTypeConversion;
+}
+
+/* -----------------------------30.08.2001 11:37------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference< XDataSource > SwDbtoolsClient::getDataSource(
+ const ::rtl::OUString& rRegisteredName,
+ const Reference< XMultiServiceFactory>& xFactory
+ )
+{
+ Reference< XDataSource > xRet;
+ ::rtl::Reference< ::connectivity::simple::IDataAccessTools > xAccess = getDataAccessTools();
+ if(xAccess.is())
+ xRet = xAccess->getDataSource(rRegisteredName, xFactory);
+ return xRet;
+}
+/* -----------------------------30.08.2001 12:06------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int32 SwDbtoolsClient::getDefaultNumberFormat(
+ const Reference< XPropertySet >& rxColumn,
+ const Reference< XNumberFormatTypes >& rxTypes,
+ const Locale& rLocale
+ )
+{
+ sal_Int32 nRet = -1;
+ ::rtl::Reference< ::connectivity::simple::IDataAccessTools > xAccess = getDataAccessTools();
+ if(xAccess.is())
+ nRet = xAccess->getDefaultNumberFormat( rxColumn, rxTypes, rLocale);
+ return nRet;
+}
+/* -----------------------------30.08.2001 12:38------------------------------
+
+ ---------------------------------------------------------------------------*/
+::rtl::OUString SwDbtoolsClient::getFormattedValue(
+ const uno::Reference< beans::XPropertySet>& _rxColumn,
+ const uno::Reference< util::XNumberFormatter>& _rxFormatter,
+ const lang::Locale& _rLocale,
+ const util::Date& _rNullDate
+ )
+
+{
+ ::rtl::Reference< ::connectivity::simple::IDataAccessTypeConversion > xConversion =
+ getAccessTypeConversion();
+ rtl::OUString sRet;
+ if(xConversion.is())
+ sRet = xConversion->getFormattedValue(_rxColumn, _rxFormatter, _rLocale, _rNullDate);
+ return sRet;
+}
+
diff --git a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx
new file mode 100644
index 000000000000..c9e99979e66b
--- /dev/null
+++ b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx
@@ -0,0 +1,934 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <SwSpellDialogChildWindow.hxx>
+#include <vcl/msgbox.hxx>
+#include <editeng/svxacorr.hxx>
+#include <editeng/acorrcfg.hxx>
+#include <svx/svxids.hrc>
+#include <sfx2/app.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <editeng/unolingu.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editview.hxx>
+#include <wrtsh.hxx>
+#include <sfx2/printer.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svditer.hxx>
+#include <svx/svdogrp.hxx>
+#include <unotools/linguprops.hxx>
+#include <unotools/lingucfg.hxx>
+#include <doc.hxx>
+#include <docsh.hxx>
+#include <docary.hxx>
+#include <frmfmt.hxx>
+#include <dcontact.hxx>
+#include <edtwin.hxx>
+#include <pam.hxx>
+#include <drawbase.hxx>
+#include <unotextrange.hxx>
+#include <dialog.hrc>
+#include <cmdid.h>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::com::sun::star::beans;
+
+SFX_IMPL_CHILDWINDOW(SwSpellDialogChildWindow, FN_SPELL_GRAMMAR_DIALOG)
+
+
+#define SPELL_START_BODY 0 // body text area
+#define SPELL_START_OTHER 1 // frame, footnote, header, footer
+#define SPELL_START_DRAWTEXT 2 // started in a draw text object
+
+struct SpellState
+{
+ bool m_bInitialCall;
+ bool m_bLockFocus; //lock the focus notification while a modal dialog is active
+ bool m_bLostFocus;
+
+ //restart and progress information
+ USHORT m_SpellStartPosition;
+ bool m_bBodySpelled; //body already spelled
+ bool m_bOtherSpelled; //frames, footnotes, headers and footers spelled
+ bool m_bStartedInOther; //started the spelling insided of the _other_ area
+ bool m_bStartedInSelection; // there was an initial text selection
+ SwPaM* pOtherCursor; // position where the spelling inside the _other_ area started
+ bool m_bDrawingsSpelled; //all drawings spelled
+ Reference<XTextRange> m_xStartRange; //text range that marks the start of spelling
+ const SdrObject* m_pStartDrawing; //draw text object spelling started in
+ ESelection m_aStartDrawingSelection; //draw text start selection
+ bool m_bRestartDrawing; // the first selected drawing object is found again
+
+ //lose/get focus information to decide if spelling can be continued
+ ShellModes m_eSelMode;
+ const SwNode* m_pPointNode;
+ const SwNode* m_pMarkNode;
+ xub_StrLen m_nPointPos;
+ xub_StrLen m_nMarkPos;
+ const SdrOutliner* m_pOutliner;
+ ESelection m_aESelection;
+
+ //iterating over draw text objects
+ std::vector<SdrTextObj*> m_aTextObjects;
+ bool m_bTextObjectsCollected;
+
+ SpellState() :
+ m_bInitialCall(true),
+ m_bLockFocus(false),
+ m_bLostFocus(false),
+ m_SpellStartPosition(SPELL_START_BODY),
+ m_bBodySpelled(false),
+ m_bOtherSpelled(false),
+ m_bStartedInOther(false),
+ m_bStartedInSelection(false),
+ pOtherCursor(0),
+ m_bDrawingsSpelled(false),
+ m_pStartDrawing(0),
+ m_bRestartDrawing(false),
+
+ m_eSelMode(SHELL_MODE_OBJECT), //initially invalid
+ m_pPointNode(0),
+ m_pMarkNode(0),
+ m_nPointPos(0),
+ m_nMarkPos(0),
+ m_pOutliner(0),
+ m_bTextObjectsCollected(false)
+ {}
+
+ ~SpellState() {delete pOtherCursor;}
+
+ // reset state in ::InvalidateSpellDialog
+ void Reset()
+ { m_bInitialCall = true;
+ m_bBodySpelled = m_bOtherSpelled = m_bDrawingsSpelled = false;
+ m_xStartRange = 0;
+ m_pStartDrawing = 0;
+ m_bRestartDrawing = false;
+ m_bTextObjectsCollected = false;
+ m_aTextObjects.clear();
+ m_bStartedInOther = false;
+ delete pOtherCursor;
+ pOtherCursor = 0;
+ }
+};
+/*-- 30.10.2003 14:33:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_LeaveDrawText(SwWrtShell& rSh)
+{
+ if(rSh.GetDrawView())
+ {
+ rSh.GetDrawView()->SdrEndTextEdit( TRUE );
+ Point aPt(LONG_MIN, LONG_MIN);
+ //go out of the frame
+ rSh.SelectObj(aPt, SW_LEAVE_FRAME);
+ rSh.EnterStdMode();
+ rSh.GetView().AttrChangedNotify(&rSh);
+ }
+}
+/*-- 09.09.2003 10:39:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSpellDialogChildWindow::SwSpellDialogChildWindow (
+ Window* _pParent,
+ USHORT nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo) :
+ svx::SpellDialogChildWindow (
+ _pParent, nId, pBindings, pInfo),
+ m_pSpellState(new SpellState)
+{
+
+ String aPropName( String::CreateFromAscii(UPN_IS_GRAMMAR_INTERACTIVE ) );
+ SvtLinguConfig().GetProperty( aPropName ) >>= m_bIsGrammarCheckingOn;
+}
+/*-- 09.09.2003 10:39:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSpellDialogChildWindow::~SwSpellDialogChildWindow ()
+{
+ SwWrtShell* pWrtShell = GetWrtShell_Impl();
+ if(!m_pSpellState->m_bInitialCall && pWrtShell)
+ pWrtShell->SpellEnd();
+ delete m_pSpellState;
+}
+
+/*-- 09.09.2003 12:40:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxChildWinInfo SwSpellDialogChildWindow::GetInfo (void) const
+{
+ SfxChildWinInfo aInfo = svx::SpellDialogChildWindow::GetInfo();
+ aInfo.bVisible = FALSE;
+ return aInfo;
+}
+
+/*-- 09.09.2003 10:39:40---------------------------------------------------
+
+
+ -----------------------------------------------------------------------*/
+svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence(bool bRecheck)
+{
+ svx::SpellPortions aRet;
+ SwWrtShell* pWrtShell = GetWrtShell_Impl();
+ if(pWrtShell)
+ {
+ if (!bRecheck)
+ {
+ // first set continuation point for spell/grammar check to the
+ // end of the current sentence
+ pWrtShell->MoveContinuationPosToEndOfCheckedSentence();
+ }
+
+ ShellModes eSelMode = pWrtShell->GetView().GetShellMode();
+ bool bDrawText = SHELL_MODE_DRAWTEXT == eSelMode;
+ bool bNormalText =
+ SHELL_MODE_TABLE_TEXT == eSelMode ||
+ SHELL_MODE_LIST_TEXT == eSelMode ||
+ SHELL_MODE_TABLE_LIST_TEXT == eSelMode ||
+ SHELL_MODE_TEXT == eSelMode;
+ //Writer text outside of the body
+ bool bOtherText = false;
+
+ if( m_pSpellState->m_bInitialCall )
+ {
+ //if no text selection exists the cursor has to be set into the text
+ if(!bDrawText && !bNormalText)
+ {
+ if(!MakeTextSelection_Impl(*pWrtShell, eSelMode))
+ return aRet;
+ else
+ {
+ // the selection type has to be checked again - both text types are possible
+ if(0 != (pWrtShell->GetSelectionType()& nsSelectionType::SEL_DRW_TXT))
+ bDrawText = true;
+ bNormalText = !bDrawText;
+ }
+ }
+ if(bNormalText)
+ {
+ //set cursor to the start of the sentence
+ if(!pWrtShell->HasSelection())
+ pWrtShell->GoStartSentence();
+ else
+ {
+ pWrtShell->ExpandToSentenceBorders();
+ m_pSpellState->m_bStartedInSelection = true;
+ }
+ //determine if the selection is outside of the body text
+ bOtherText = !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY);
+ m_pSpellState->m_SpellStartPosition = bOtherText ? SPELL_START_OTHER : SPELL_START_BODY;
+ if(bOtherText)
+ {
+ m_pSpellState->pOtherCursor = new SwPaM(*pWrtShell->GetCrsr()->GetPoint());
+ m_pSpellState->m_bStartedInOther = true;
+ pWrtShell->SpellStart( DOCPOS_OTHERSTART, DOCPOS_OTHEREND, DOCPOS_CURR, FALSE );
+ }
+ else
+ {
+ SwPaM* pCrsr = pWrtShell->GetCrsr();
+ //mark the start position only if not at start of doc
+ if(!pWrtShell->IsStartOfDoc())
+ {
+ m_pSpellState->m_xStartRange =
+ SwXTextRange::CreateXTextRange(
+ *pWrtShell->GetDoc(),
+ *pCrsr->Start(), pCrsr->End());
+ }
+ pWrtShell->SpellStart( DOCPOS_START, DOCPOS_END, DOCPOS_CURR, FALSE );
+ }
+ }
+ else
+ {
+ SdrView* pSdrView = pWrtShell->GetDrawView();
+ m_pSpellState->m_SpellStartPosition = SPELL_START_DRAWTEXT;
+ m_pSpellState->m_pStartDrawing = pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ // start checking at the top of the drawing object
+ pOLV->SetSelection( ESelection() );
+ m_pSpellState->m_aStartDrawingSelection = ESelection();
+/*
+Note: spelling in a selection only, or starting in a mid of a drawing object requires
+further changes elsewhere. (Especially if it should work in sc and sd as well.)
+The code below would only be part of the solution.
+(Keeping it a as a comment for the time being)
+ ESelection aCurSel( pOLV->GetSelection() );
+ ESelection aSentenceSel( pOLV->GetEditView().GetEditEngine()->SelectSentence( aCurSel ) );
+ if (!aCurSel.HasRange())
+ {
+ aSentenceSel.nEndPara = aSentenceSel.nStartPara;
+ aSentenceSel.nEndPos = aSentenceSel.nStartPos;
+ }
+ pOLV->SetSelection( aSentenceSel );
+ m_pSpellState->m_aStartDrawingSelection = aSentenceSel;
+*/
+ }
+
+ m_pSpellState->m_bInitialCall = false;
+ }
+ if( bDrawText )
+ {
+ // spell inside of the current draw text
+ if(!SpellDrawText_Impl(*pWrtShell, aRet))
+ {
+ if(!FindNextDrawTextError_Impl(*pWrtShell) || !SpellDrawText_Impl(*pWrtShell, aRet))
+ {
+ lcl_LeaveDrawText(*pWrtShell);
+ //now the drawings have been spelled
+ m_pSpellState->m_bDrawingsSpelled = true;
+ //the spelling continues at the other content
+ //if there's any that has not been spelled yet
+ if(!m_pSpellState->m_bOtherSpelled && pWrtShell->HasOtherCnt())
+ {
+ pWrtShell->SpellStart(DOCPOS_OTHERSTART, DOCPOS_OTHEREND, DOCPOS_OTHERSTART, FALSE );
+ if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn))
+ {
+ pWrtShell->SpellEnd();
+ m_pSpellState->m_bOtherSpelled = true;
+ }
+ }
+ else
+ m_pSpellState->m_bOtherSpelled = true;
+ //if no result has been found try at the body text - completely
+ if(!m_pSpellState->m_bBodySpelled && !aRet.size())
+ {
+ pWrtShell->SpellStart(DOCPOS_START, DOCPOS_END, DOCPOS_START, FALSE );
+ if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn))
+ {
+ m_pSpellState->m_bBodySpelled = true;
+ pWrtShell->SpellEnd();
+ }
+ }
+
+ }
+ }
+ }
+ else
+ {
+ //spell inside of the Writer text
+ if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn))
+ {
+ // if there is a selection (within body or header/footer text)
+ // then spell/grammar checking should not move outside of it.
+ if (!m_pSpellState->m_bStartedInSelection)
+ {
+ //find out which text has been spelled body or other
+ bOtherText = !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY);
+ if(bOtherText && m_pSpellState->m_bStartedInOther && m_pSpellState->pOtherCursor)
+ {
+ m_pSpellState->m_bStartedInOther = false;
+ pWrtShell->SetSelection(*m_pSpellState->pOtherCursor);
+ pWrtShell->SpellEnd();
+ delete m_pSpellState->pOtherCursor;
+ m_pSpellState->pOtherCursor = 0;
+ pWrtShell->SpellStart(DOCPOS_OTHERSTART, DOCPOS_CURR, DOCPOS_OTHERSTART, FALSE );
+ pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn);
+ }
+ if(!aRet.size())
+ {
+ //end spelling
+ pWrtShell->SpellEnd();
+ if(bOtherText)
+ {
+ m_pSpellState->m_bOtherSpelled = true;
+ //has the body been spelled?
+ if(!m_pSpellState->m_bBodySpelled)
+ {
+ pWrtShell->SpellStart(DOCPOS_START, DOCPOS_END, DOCPOS_START, FALSE );
+ if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn))
+ {
+ m_pSpellState->m_bBodySpelled = true;
+ pWrtShell->SpellEnd();
+ }
+ }
+ }
+ else
+ {
+ m_pSpellState->m_bBodySpelled = true;
+ if(!m_pSpellState->m_bOtherSpelled && pWrtShell->HasOtherCnt())
+ {
+ pWrtShell->SpellStart(DOCPOS_OTHERSTART, DOCPOS_OTHEREND, DOCPOS_OTHERSTART, FALSE );
+ if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn))
+ {
+ pWrtShell->SpellEnd();
+ m_pSpellState->m_bOtherSpelled = true;
+ }
+ }
+ else
+ m_pSpellState->m_bOtherSpelled = true;
+ }
+ }
+
+ //search for a draw text object that contains error and spell it
+ if(!aRet.size() &&
+ (m_pSpellState->m_bDrawingsSpelled ||
+ !FindNextDrawTextError_Impl(*pWrtShell) || !SpellDrawText_Impl(*pWrtShell, aRet)))
+ {
+ lcl_LeaveDrawText(*pWrtShell);
+ m_pSpellState->m_bDrawingsSpelled = true;
+ }
+ }
+ }
+ }
+ // now only the rest of the body text can be spelled -
+ // if the spelling started inside of the body
+ //
+ bool bCloseMessage = true;
+ if(!aRet.size() && !m_pSpellState->m_bStartedInSelection)
+ {
+ DBG_ASSERT(m_pSpellState->m_bDrawingsSpelled &&
+ m_pSpellState->m_bOtherSpelled && m_pSpellState->m_bBodySpelled,
+ "not all parts of the document are already spelled");
+ if(m_pSpellState->m_xStartRange.is())
+ {
+ LockFocusNotification( true );
+ USHORT nRet = QueryBox( GetWindow(), SW_RES(RID_QB_SPELL_CONTINUE)).Execute();
+ if(RET_YES == nRet)
+ {
+ SwUnoInternalPaM aPam(*pWrtShell->GetDoc());
+ if (::sw::XTextRangeToSwPaM(aPam,
+ m_pSpellState->m_xStartRange))
+ {
+ pWrtShell->SetSelection(aPam);
+ pWrtShell->SpellStart(DOCPOS_START, DOCPOS_CURR, DOCPOS_START);
+ if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn))
+ pWrtShell->SpellEnd();
+ }
+ m_pSpellState->m_xStartRange = 0;
+ LockFocusNotification( false );
+ //take care that the now valid selection is stored
+ LoseFocus();
+ }
+ else
+ bCloseMessage = false; //no closing message if a wrap around has been denied
+ }
+ }
+ if(!aRet.size())
+ {
+ if(bCloseMessage)
+ {
+ LockFocusNotification( true );
+ String sInfo(SW_RES(STR_SPELLING_COMPLETED));
+ //#i84610#
+ Window* pTemp = GetWindow(); // temporary needed for g++ 3.3.5
+ InfoBox(pTemp, sInfo ).Execute();
+ LockFocusNotification( false );
+ //take care that the now valid selection is stored
+ LoseFocus();
+ }
+
+ //close the spelling dialog
+ GetBindings().GetDispatcher()->Execute(FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON);
+ }
+ }
+ return aRet;
+
+}
+/*-- 09.09.2003 10:39:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSpellDialogChildWindow::ApplyChangedSentence(const svx::SpellPortions& rChanged, bool bRecheck)
+{
+ SwWrtShell* pWrtShell = GetWrtShell_Impl();
+ DBG_ASSERT(!m_pSpellState->m_bInitialCall, "ApplyChangedSentence in initial call or after resume");
+ if(pWrtShell && !m_pSpellState->m_bInitialCall)
+ {
+ ShellModes eSelMode = pWrtShell->GetView().GetShellMode();
+ bool bDrawText = SHELL_MODE_DRAWTEXT == eSelMode;
+ bool bNormalText =
+ SHELL_MODE_TABLE_TEXT == eSelMode ||
+ SHELL_MODE_LIST_TEXT == eSelMode ||
+ SHELL_MODE_TABLE_LIST_TEXT == eSelMode ||
+ SHELL_MODE_TEXT == eSelMode;
+
+ // evaluate if the same sentence should be rechecked or not.
+ // Sentences that got grammar checked should always be rechecked in order
+ // to detect possible errors that get introduced with the changes
+ bRecheck |= pWrtShell->HasLastSentenceGotGrammarChecked();
+
+ if(bNormalText)
+ pWrtShell->ApplyChangedSentence(rChanged, bRecheck);
+ else if(bDrawText )
+ {
+ SdrView* pDrView = pWrtShell->GetDrawView();
+ SdrOutliner *pOutliner = pDrView->GetTextEditOutliner();
+ pOutliner->ApplyChangedSentence(pDrView->GetTextEditOutlinerView()->GetEditView(), rChanged, bRecheck);
+ }
+ }
+}
+/*-- 21.10.2003 09:33:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSpellDialogChildWindow::AddAutoCorrection(
+ const String& rOld, const String& rNew, LanguageType eLanguage)
+{
+ SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ pACorr->PutText( rOld, rNew, eLanguage );
+}
+/*-- 21.10.2003 09:33:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwSpellDialogChildWindow::HasAutoCorrection()
+{
+ return true;
+}
+/*-- 16.06.2008 11:59:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwSpellDialogChildWindow::HasGrammarChecking()
+{
+ return SvtLinguConfig().HasGrammarChecker();
+}
+/*-- 18.06.2008 12:27:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwSpellDialogChildWindow::IsGrammarChecking()
+{
+ return m_bIsGrammarCheckingOn;
+}
+/*-- 18.06.2008 12:27:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSpellDialogChildWindow::SetGrammarChecking(bool bOn)
+{
+ uno::Any aVal;
+ aVal <<= bOn;
+ m_bIsGrammarCheckingOn = bOn;
+ String aPropName( C2S(UPN_IS_GRAMMAR_INTERACTIVE ) );
+ SvtLinguConfig().SetProperty( aPropName, aVal );
+ // set current spell position to the start of the current sentence to
+ // continue with this sentence after grammar checking state has been changed
+ SwWrtShell* pWrtShell = GetWrtShell_Impl();
+ if(pWrtShell)
+ {
+ ShellModes eSelMode = pWrtShell->GetView().GetShellMode();
+ bool bDrawText = SHELL_MODE_DRAWTEXT == eSelMode;
+ bool bNormalText =
+ SHELL_MODE_TABLE_TEXT == eSelMode ||
+ SHELL_MODE_LIST_TEXT == eSelMode ||
+ SHELL_MODE_TABLE_LIST_TEXT == eSelMode ||
+ SHELL_MODE_TEXT == eSelMode;
+ if( bNormalText )
+ pWrtShell->PutSpellingToSentenceStart();
+ else if( bDrawText )
+ {
+ SdrView* pSdrView = pWrtShell->GetDrawView();
+ SdrOutliner* pOutliner = pSdrView ? pSdrView->GetTextEditOutliner() : 0;
+ DBG_ASSERT(pOutliner, "No Outliner in SwSpellDialogChildWindow::SetGrammarChecking");
+ if(pOutliner)
+ {
+ pOutliner->PutSpellingToSentenceStart( pSdrView->GetTextEditOutlinerView()->GetEditView() );
+ }
+ }
+ }
+}
+/*-- 28.10.2003 08:41:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSpellDialogChildWindow::GetFocus()
+{
+ if(m_pSpellState->m_bLockFocus)
+ return;
+ bool bInvalidate = false;
+ SwWrtShell* pWrtShell = GetWrtShell_Impl();
+ if(pWrtShell && !m_pSpellState->m_bInitialCall)
+ {
+ ShellModes eSelMode = pWrtShell->GetView().GetShellMode();
+ if(eSelMode != m_pSpellState->m_eSelMode)
+ {
+ //prevent initial invalidation
+ if(m_pSpellState->m_bLostFocus)
+ bInvalidate = true;
+ }
+ else
+ {
+ switch(m_pSpellState->m_eSelMode)
+ {
+ case SHELL_MODE_TEXT:
+ case SHELL_MODE_LIST_TEXT:
+ case SHELL_MODE_TABLE_TEXT:
+ case SHELL_MODE_TABLE_LIST_TEXT:
+ {
+ SwPaM* pCursor = pWrtShell->GetCrsr();
+ if(m_pSpellState->m_pPointNode != pCursor->GetNode(TRUE) ||
+ m_pSpellState->m_pMarkNode != pCursor->GetNode(FALSE)||
+ m_pSpellState->m_nPointPos != pCursor->GetPoint()->nContent.GetIndex()||
+ m_pSpellState->m_nMarkPos != pCursor->GetMark()->nContent.GetIndex())
+ bInvalidate = true;
+ }
+ break;
+ case SHELL_MODE_DRAWTEXT:
+ {
+ SdrView* pSdrView = pWrtShell->GetDrawView();
+ SdrOutliner* pOutliner = pSdrView ? pSdrView->GetTextEditOutliner() : 0;
+ if(!pOutliner || m_pSpellState->m_pOutliner != pOutliner)
+ bInvalidate = true;
+ else
+ {
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ DBG_ASSERT(pOLV, "no OutlinerView in SwSpellDialogChildWindow::GetFocus()");
+ if(!pOLV || !m_pSpellState->m_aESelection.IsEqual(pOLV->GetSelection()))
+ bInvalidate = true;
+ }
+ }
+ break;
+ default: bInvalidate = true;
+ }
+ }
+ }
+ else
+ {
+ bInvalidate = true;
+ }
+ if(bInvalidate)
+ InvalidateSpellDialog();
+}
+/*-- 28.10.2003 08:41:09---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSpellDialogChildWindow::LoseFocus()
+{
+ //prevent initial invalidation
+ m_pSpellState->m_bLostFocus = true;
+ if(m_pSpellState->m_bLockFocus)
+ return;
+ SwWrtShell* pWrtShell = GetWrtShell_Impl();
+ if(pWrtShell)
+ {
+ m_pSpellState->m_eSelMode = pWrtShell->GetView().GetShellMode();
+ m_pSpellState->m_pPointNode = m_pSpellState->m_pMarkNode = 0;
+ m_pSpellState->m_nPointPos = m_pSpellState->m_nMarkPos = 0;
+ m_pSpellState->m_pOutliner = 0;
+
+ switch(m_pSpellState->m_eSelMode)
+ {
+ case SHELL_MODE_TEXT:
+ case SHELL_MODE_LIST_TEXT:
+ case SHELL_MODE_TABLE_TEXT:
+ case SHELL_MODE_TABLE_LIST_TEXT:
+ {
+ //store a node pointer and a pam-position to be able to check on next GetFocus();
+ SwPaM* pCursor = pWrtShell->GetCrsr();
+ m_pSpellState->m_pPointNode = pCursor->GetNode(TRUE);
+ m_pSpellState->m_pMarkNode = pCursor->GetNode(FALSE);
+ m_pSpellState->m_nPointPos = pCursor->GetPoint()->nContent.GetIndex();
+ m_pSpellState->m_nMarkPos = pCursor->GetMark()->nContent.GetIndex();
+
+ }
+ break;
+ case SHELL_MODE_DRAWTEXT:
+ {
+ SdrView* pSdrView = pWrtShell->GetDrawView();
+ SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner();
+ m_pSpellState->m_pOutliner = pOutliner;
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ DBG_ASSERT(pOutliner && pOLV, "no Outliner/OutlinerView in SwSpellDialogChildWindow::LoseFocus()");
+ if(pOLV)
+ {
+ m_pSpellState->m_aESelection = pOLV->GetSelection();
+ }
+ }
+ break;
+ default:;//prevent warning
+ }
+ }
+ else
+ m_pSpellState->m_eSelMode = SHELL_MODE_OBJECT;
+}
+/*-- 18.09.2003 12:50:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSpellDialogChildWindow::InvalidateSpellDialog()
+{
+ SwWrtShell* pWrtShell = GetWrtShell_Impl();
+ if(!m_pSpellState->m_bInitialCall && pWrtShell)
+ pWrtShell->SpellEnd(0, false);
+ m_pSpellState->Reset();
+ svx::SpellDialogChildWindow::InvalidateSpellDialog();
+}
+
+/*-- 18.09.2003 12:54:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwWrtShell* SwSpellDialogChildWindow::GetWrtShell_Impl()
+{
+ SfxDispatcher* pDispatch = GetBindings().GetDispatcher();
+ SwView* pView = 0;
+ if(pDispatch)
+ {
+ USHORT nShellIdx = 0;
+ SfxShell* pShell;
+ while(0 != (pShell = pDispatch->GetShell(nShellIdx++)))
+ if(pShell->ISA(SwView))
+ {
+ pView = static_cast<SwView* >(pShell);
+ break;
+ }
+ }
+ return pView ? pView->GetWrtShellPtr(): 0;
+}
+
+/*-- 13.10.2003 15:19:04---------------------------------------------------
+ set the cursor into the body text - necessary if any object is selected
+ on start of the spelling dialog
+ -----------------------------------------------------------------------*/
+bool SwSpellDialogChildWindow::MakeTextSelection_Impl(SwWrtShell& rShell, ShellModes eSelMode)
+{
+ SwView& rView = rShell.GetView();
+ switch(eSelMode)
+ {
+ case SHELL_MODE_TEXT:
+ case SHELL_MODE_LIST_TEXT:
+ case SHELL_MODE_TABLE_TEXT:
+ case SHELL_MODE_TABLE_LIST_TEXT:
+ case SHELL_MODE_DRAWTEXT:
+ DBG_ERROR("text already active in SwSpellDialogChildWindow::MakeTextSelection_Impl()");
+ break;
+
+ case SHELL_MODE_FRAME:
+ {
+ rShell.UnSelectFrm();
+ rShell.LeaveSelFrmMode();
+ rView.AttrChangedNotify(&rShell);
+ }
+ break;
+
+ case SHELL_MODE_DRAW:
+ case SHELL_MODE_DRAW_CTRL:
+ case SHELL_MODE_DRAW_FORM:
+ case SHELL_MODE_BEZIER:
+ if(FindNextDrawTextError_Impl(rShell))
+ {
+ rView.AttrChangedNotify(&rShell);
+ break;
+ }
+ //otherwise no break to deselect the object
+ case SHELL_MODE_GRAPHIC:
+ case SHELL_MODE_OBJECT:
+ {
+ if ( rShell.IsDrawCreate() )
+ {
+ rView.GetDrawFuncPtr()->BreakCreate();
+ rView.AttrChangedNotify(&rShell);
+ }
+ else if ( rShell.HasSelection() || rView.IsDrawMode() )
+ {
+ SdrView *pSdrView = rShell.GetDrawView();
+ if(pSdrView && pSdrView->AreObjectsMarked() &&
+ pSdrView->GetHdlList().GetFocusHdl())
+ {
+ ((SdrHdlList&)pSdrView->GetHdlList()).ResetFocusHdl();
+ }
+ else
+ {
+ rView.LeaveDrawCreate();
+ Point aPt(LONG_MIN, LONG_MIN);
+ //go out of the frame
+ rShell.SelectObj(aPt, SW_LEAVE_FRAME);
+ SfxBindings& rBind = rView.GetViewFrame()->GetBindings();
+ rBind.Invalidate( SID_ATTR_SIZE );
+ rShell.EnterStdMode();
+ rView.AttrChangedNotify(&rShell);
+ }
+ }
+ }
+ break;
+ default:; //prevent warning
+ }
+ return true;
+}
+/*-- 13.10.2003 15:20:09---------------------------------------------------
+ select the next draw text object that has a spelling error
+ -----------------------------------------------------------------------*/
+bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh)
+{
+ bool bNextDoc = false;
+ SdrView* pDrView = rSh.GetDrawView();
+ if(!pDrView)
+ return bNextDoc;
+ SwView& rView = rSh.GetView();
+ SwDoc* pDoc = rView.GetDocShell()->GetDoc();
+ const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
+ //start at the current draw object - if there is any selected
+ SdrTextObj* pCurrentTextObj = 0;
+ if ( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if( pObj && pObj->ISA(SdrTextObj) )
+ pCurrentTextObj = static_cast<SdrTextObj*>(pObj);
+ }
+ //at first fill the vector of drawing objects
+ if(!m_pSpellState->m_bTextObjectsCollected )
+ {
+ m_pSpellState->m_bTextObjectsCollected = true;
+ sal_uInt16 n = 0;
+ //iterate in the 'normal' array of objects
+ while( n < pDoc->GetSpzFrmFmts()->Count() )
+ {
+ SwFrmFmt* pFly = (*pDoc->GetSpzFrmFmts())[ n ];
+ if( pFly->IsA( TYPE(SwDrawFrmFmt) ) )
+ {
+ SwClientIter aIter( (SwFmt&) *pFly );
+ if( aIter.First( TYPE(SwDrawContact) ) )
+ {
+ SdrObject* pSdrO = ((SwDrawContact*)aIter())->GetMaster();
+ if ( pSdrO )
+ {
+ if ( pSdrO->IsA( TYPE(SdrObjGroup) ) )
+ {
+ SdrObjListIter aListIter( *pSdrO, IM_DEEPNOGROUPS );
+ //iterate inside of a grouped object
+ while( aListIter.IsMore() )
+ {
+ SdrObject* pSdrOElement = aListIter.Next();
+ if( pSdrOElement && pSdrOElement->IsA( TYPE(SdrTextObj) ) &&
+ static_cast<SdrTextObj*>( pSdrOElement)->HasText() &&
+ pCurrentTextObj != pSdrOElement)
+ {
+ m_pSpellState->m_aTextObjects.push_back((SdrTextObj*) pSdrOElement);
+ }
+ }
+ }
+ else if( pSdrO->IsA( TYPE(SdrTextObj) ) &&
+ static_cast<SdrTextObj*>( pSdrO )->HasText() &&
+ pCurrentTextObj != pSdrO)
+ {
+ m_pSpellState->m_aTextObjects.push_back((SdrTextObj*) pSdrO);
+ }
+ }
+ }
+ }
+ ++n;
+ }
+ if(pCurrentTextObj)
+ m_pSpellState->m_aTextObjects.push_back(pCurrentTextObj);
+ }
+ if(m_pSpellState->m_aTextObjects.size())
+ {
+ Reference< XSpellChecker1 > xSpell( GetSpellChecker() );
+ while(!bNextDoc && m_pSpellState->m_aTextObjects.size())
+ {
+ std::vector<SdrTextObj*>::iterator aStart = m_pSpellState->m_aTextObjects.begin();
+ SdrTextObj* pTextObj = *aStart;
+ if(m_pSpellState->m_pStartDrawing == pTextObj)
+ m_pSpellState->m_bRestartDrawing = true;
+ m_pSpellState->m_aTextObjects.erase(aStart);
+ OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
+ if ( pParaObj )
+ {
+ bool bHasSpellError = false;
+ {
+ SdrOutliner aTmpOutliner(pDoc->GetDrawModel()->
+ GetDrawOutliner().GetEmptyItemSet().GetPool(),
+ OUTLINERMODE_TEXTOBJECT );
+ aTmpOutliner.SetRefDevice( pDoc->getPrinter( false ) );
+ MapMode aMapMode (MAP_TWIP);
+ aTmpOutliner.SetRefMapMode(aMapMode);
+ aTmpOutliner.SetPaperSize( pTextObj->GetLogicRect().GetSize() );
+ aTmpOutliner.SetSpeller( xSpell );
+
+ OutlinerView* pOutlView = new OutlinerView( &aTmpOutliner, &(rView.GetEditWin()) );
+ pOutlView->GetOutliner()->SetRefDevice( rSh.getIDocumentDeviceAccess()->getPrinter( false ) );
+ aTmpOutliner.InsertView( pOutlView );
+ Point aPt;
+ Size aSize(1,1);
+ Rectangle aRect( aPt, aSize );
+ pOutlView->SetOutputArea( aRect );
+ aTmpOutliner.SetText( *pParaObj );
+ aTmpOutliner.ClearModifyFlag();
+ bHasSpellError = EE_SPELL_OK != aTmpOutliner.HasSpellErrors();
+ aTmpOutliner.RemoveView( pOutlView );
+ delete pOutlView;
+ }
+ if(bHasSpellError)
+ {
+ //now the current one has to be deselected
+ if(pCurrentTextObj)
+ pDrView->SdrEndTextEdit( TRUE );
+ //and the found one should be activated
+ rSh.MakeVisible(pTextObj->GetLogicRect());
+ Point aTmp( 0,0 );
+ rSh.SelectObj( aTmp, 0, pTextObj );
+ SdrPageView* pPV = pDrView->GetSdrPageView();
+ rView.BeginTextEdit( pTextObj, pPV, &rView.GetEditWin(), FALSE, TRUE );
+ rView.AttrChangedNotify(&rSh);
+ bNextDoc = true;
+ }
+ }
+ }
+ }
+ return bNextDoc;
+}
+
+/*-- 13.10.2003 15:24:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool SwSpellDialogChildWindow::SpellDrawText_Impl(SwWrtShell& rSh, ::svx::SpellPortions& rPortions)
+{
+ bool bRet = false;
+ SdrView* pSdrView = rSh.GetDrawView();
+ SdrOutliner* pOutliner = pSdrView ? pSdrView->GetTextEditOutliner() : 0;
+ DBG_ASSERT(pOutliner, "No Outliner in SwSpellDialogChildWindow::SpellDrawText_Impl");
+ if(pOutliner)
+ {
+ bRet = pOutliner->SpellSentence(pSdrView->GetTextEditOutlinerView()->GetEditView(), rPortions, m_bIsGrammarCheckingOn);
+ //find out if the current selection is in the first spelled drawing object
+ //and behind the initial selection
+ if(bRet && m_pSpellState->m_bRestartDrawing)
+ {
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ ESelection aCurrentSelection = pOLV->GetSelection();
+ if(m_pSpellState->m_aStartDrawingSelection.nEndPara < aCurrentSelection.nEndPara ||
+ (m_pSpellState->m_aStartDrawingSelection.nEndPara == aCurrentSelection.nEndPara &&
+ m_pSpellState->m_aStartDrawingSelection.nEndPos < aCurrentSelection.nEndPos))
+ {
+ bRet = false;
+ rPortions.clear();
+ }
+ }
+ }
+ return bRet;
+}
+/*-- 30.10.2003 14:54:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSpellDialogChildWindow::LockFocusNotification(bool bLock)
+{
+ DBG_ASSERT(m_pSpellState->m_bLockFocus != bLock, "invalid locking - no change of state");
+ m_pSpellState->m_bLockFocus = bLock;
+}
+
+
diff --git a/sw/source/ui/dialog/abstract.cxx b/sw/source/ui/dialog/abstract.cxx
new file mode 100644
index 000000000000..54955c286a02
--- /dev/null
+++ b/sw/source/ui/dialog/abstract.cxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include "swtypes.hxx"
+#include "hintids.hxx"
+
+#include "dialog.hrc"
+#include "abstract.hxx"
+#include "abstract.hrc"
+
+
+/*-----------------22.02.97 15.32-------------------
+
+--------------------------------------------------*/
+
+SwInsertAbstractDlg::SwInsertAbstractDlg( Window* pParent ) :
+ SfxModalDialog(pParent, SW_RES(DLG_INSERT_ABSTRACT)),
+ aFL (this, SW_RES(FL_1 )),
+ aLevelFT(this, SW_RES(FT_LEVEL )),
+ aLevelNF(this, SW_RES(NF_LEVEL )),
+ aParaFT (this, SW_RES(FT_PARA )),
+ aParaNF (this, SW_RES(NF_PARA )),
+ aDescFT (this, SW_RES(FT_DESC )),
+ aOkPB (this, SW_RES(PB_OK )),
+ aCancelPB (this, SW_RES(PB_CANCEL )),
+ aHelpPB (this, SW_RES(PB_HELP ))
+{
+ FreeResource();
+}
+
+/*-----------------22.02.97 15.32-------------------
+
+--------------------------------------------------*/
+
+SwInsertAbstractDlg::~SwInsertAbstractDlg()
+{
+}
+
+/*-----------------22.02.97 15.34-------------------
+
+--------------------------------------------------*/
+
+BYTE SwInsertAbstractDlg::GetLevel() const
+{
+ return static_cast< BYTE >(aLevelNF.GetValue() - 1);
+}
+/*-----------------22.02.97 15.34-------------------
+
+--------------------------------------------------*/
+
+BYTE SwInsertAbstractDlg::GetPara() const
+{
+ return (BYTE) aParaNF.GetValue();
+}
+
+
+
+
+
+
diff --git a/sw/source/ui/dialog/abstract.hrc b/sw/source/ui/dialog/abstract.hrc
new file mode 100644
index 000000000000..c36d02ee1b1f
--- /dev/null
+++ b/sw/source/ui/dialog/abstract.hrc
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FL_1 1
+#define FT_PARA 2
+#define NF_PARA 3
+#define FT_LEVEL 4
+#define NF_LEVEL 5
+#define FT_DESC 6
+#define PB_OK 7
+#define PB_CANCEL 8
+#define PB_HELP 9
diff --git a/sw/source/ui/dialog/abstract.src b/sw/source/ui/dialog/abstract.src
new file mode 100644
index 000000000000..5cb877a1549b
--- /dev/null
+++ b/sw/source/ui/dialog/abstract.src
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "dialog.hrc"
+#include "helpid.h"
+#include "abstract.hrc"
+
+ModalDialog DLG_INSERT_ABSTRACT
+{
+ HelpID = HID_INSERT_ABSTRACT ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 239 , 68 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? AutoAbstract erzeugen : AutoAbstrakt erzeugen */
+ /* ### ACHTUNG: Neuer Text in Resource? AutoAbstract erzeugen : AutoAbstrakt erzeugen */
+ /* ### ACHTUNG: Neuer Text in Resource? AutoAbstract erzeugen : AutoAbstrakt erzeugen */
+ Moveable = TRUE ;
+ FixedLine FL_1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 174 , 8 ) ;
+ Text [ en-US ] = "Properties" ;
+ };
+ FixedText FT_LEVEL
+ {
+ Pos = MAP_APPFONT ( 12 , 12 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "Included outline levels" ;
+ };
+ NumericField NF_LEVEL
+ {
+ HelpID = "sw:NumericField:DLG_INSERT_ABSTRACT:NF_LEVEL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 153 , 12 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 5 ;
+ Value = 3 ;
+ First = 1 ;
+ Last = 5 ;
+ };
+ FixedText FT_PARA
+ {
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Absätze je Kapitel : Absõtze je Kapitel */
+ Text [ en-US ] = "Subpoints per level" ;
+ };
+ NumericField NF_PARA
+ {
+ HelpID = "sw:NumericField:DLG_INSERT_ABSTRACT:NF_PARA";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 153 , 27 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 5 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 5 ;
+ };
+ FixedText FT_DESC
+ {
+ Pos = MAP_APPFONT ( 12 , 43 ) ;
+ Size = MAP_APPFONT ( 165 , 16 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Im Abstrakt erscheint die ausgewählte Anzahl von Absätzen aus den einbezogenen Kapitelebenen. : Im Abstrakt erscheint die ausgewõhlte Anzahl von Absõtzen aus den einbezogenen Kapitelebenen. */
+ WordBreak = TRUE ;
+ Text [ en-US ] = "The abstract contains the selected number of paragraphs from the included outline levels." ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 186 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 186 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 186 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ Text [ en-US ] = "Create AutoAbstract" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/dialog/addrdlg.cxx b/sw/source/ui/dialog/addrdlg.cxx
new file mode 100644
index 000000000000..f168d0684a81
--- /dev/null
+++ b/sw/source/ui/dialog/addrdlg.cxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include "addrdlg.hxx"
+#include <svx/svxdlg.hxx>
+#include <sfx2/sfx.hrc>
+
+/****************************************************************************
+Ctor
+****************************************************************************/
+
+
+SwAddrDlg::SwAddrDlg(Window* pParent, const SfxItemSet& rSet ) :
+
+ SfxSingleTabDialog(pParent, rSet, 0)
+
+{
+ // TabPage erzeugen
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SFXPAGE_GENERAL );
+ if ( fnCreatePage )
+ {
+ SfxTabPage* pPage2 = (*fnCreatePage)( this, rSet );
+ SetTabPage(pPage2);
+ }
+}
+
+/****************************************************************************
+Dtor
+****************************************************************************/
+
+
+__EXPORT SwAddrDlg::~SwAddrDlg()
+{
+}
+
+
diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx
new file mode 100644
index 000000000000..4cab48e79d8a
--- /dev/null
+++ b/sw/source/ui/dialog/ascfldlg.cxx
@@ -0,0 +1,462 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <hintids.hxx>
+#include <rtl/textenc.h>
+#include <i18npool/mslangid.hxx>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <unotools/lingucfg.hxx>
+#include <fontcfg.hxx>
+#include <swmodule.hxx>
+#include <editeng/unolingu.hxx>
+#include <sfx2/printer.hxx>
+#include <editeng/flstitem.hxx>
+#include <svx/dlgutil.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <swtypes.hxx>
+#include <ascfldlg.hxx>
+#include <shellio.hxx>
+#include <docsh.hxx>
+#include <doc.hxx>
+#include <errhdl.hxx>
+
+#ifndef _DIALOG_HRC
+#include <dialog.hrc>
+#endif
+#ifndef _ASCFLDLG_HRC
+#include <ascfldlg.hrc>
+#endif
+
+#include "vcl/metric.hxx"
+
+
+using namespace ::com::sun::star;
+
+const sal_Unicode cDialogExtraDataClose = '}';
+const char __FAR_DATA sDialogImpExtraData[] = "EncImpDlg:{";
+const char __FAR_DATA sDialogExpExtraData[] = "EncExpDlg:{";
+const USHORT nDialogExtraDataLen = 11; // 12345678901
+
+SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh,
+ SvStream* pStream )
+ : SfxModalDialog( pParent, SW_RES( DLG_ASCII_FILTER )),
+ aFL( this, SW_RES( FL_1 )),
+ aCharSetFT( this, SW_RES( FT_CHARSET )),
+ aCharSetLB( this, SW_RES( LB_CHARSET )),
+ aFontFT( this, SW_RES( FT_FONT )),
+ aFontLB( this, SW_RES( LB_FONT )),
+ aLanguageFT( this, SW_RES( FT_LANGUAGE )),
+ aLanguageLB( this, SW_RES( LB_LANGUAGE )),
+ aCRLF_FT( this, SW_RES( FT_CRLF )),
+ aCRLF_RB( this, SW_RES( RB_CRLF )),
+ aCR_RB( this, SW_RES( RB_CR )),
+ aLF_RB( this, SW_RES( RB_LF )),
+ aOkPB( this, SW_RES( PB_OK )),
+ aCancelPB( this, SW_RES( PB_CANCEL )),
+ aHelpPB( this, SW_RES( PB_HELP )),
+ sSystemCharSet( SW_RES( STR_SYS_CHARSET )),
+ bSaveLineStatus( TRUE )
+{
+ FreeResource();
+
+ SwAsciiOptions aOpt;
+ {
+ const String& rFindNm = String::CreateFromAscii(
+ pStream ? sDialogImpExtraData
+ : sDialogExpExtraData);
+ USHORT nEnd, nStt = GetExtraData().Search( rFindNm );
+ if( STRING_NOTFOUND != nStt )
+ {
+ nStt += nDialogExtraDataLen;
+ nEnd = GetExtraData().Search( cDialogExtraDataClose, nStt );
+ if( STRING_NOTFOUND != nEnd )
+ {
+ aOpt.ReadUserData( GetExtraData().Copy( nStt, nEnd - nStt ));
+ nStt -= nDialogExtraDataLen;
+ GetExtraData().Erase( nStt, nEnd - nStt + 1 );
+ }
+ }
+ }
+
+ // read the first chars and check the charset, (language - with L&H)
+ if( pStream )
+ {
+ char aBuffer[ 4098 ];
+ ULONG nOldPos = pStream->Tell();
+ ULONG nBytesRead = pStream->Read( aBuffer, 4096 );
+ pStream->Seek( nOldPos );
+
+ if( nBytesRead <= 4096 )
+ {
+ aBuffer[ nBytesRead ] = '0';
+ aBuffer[ nBytesRead+1 ] = '0';
+ if( 0 != ( nBytesRead & 0x00000001 ) )
+ aBuffer[ nBytesRead + 2 ] = '0';
+ }
+
+ BOOL bCR = FALSE, bLF = FALSE, bNoNormalChar = FALSE,
+ bNullChar = FALSE;
+ for( USHORT nCnt = 0; nCnt < nBytesRead; ++nCnt )
+ switch( aBuffer[ nCnt ] )
+ {
+ case 0x0: bNullChar = TRUE; break;
+ case 0xA: bLF = TRUE; break;
+ case 0xD: bCR = TRUE; break;
+ case 0xC:
+ case 0x1A:
+ case 0x9: break;
+ default:
+ if( 0x20 > aBuffer[ nCnt ] )
+ bNoNormalChar = TRUE;
+ }
+
+ if( !bNullChar )
+ {
+ if( bCR )
+ {
+ if( bLF )
+ {
+ aOpt.SetParaFlags( LINEEND_CRLF );
+// have to check if of CharSet is type of ANSI
+// aOpt.SetCharSet( CHARSET_ANSI );
+ }
+ else
+ {
+ aOpt.SetParaFlags( LINEEND_CR );
+// have to check if CharSet is type of MAC
+// aOpt.SetCharSet( CHARSET_MAC );
+ }
+ }
+ else if( bLF )
+ {
+ aOpt.SetParaFlags( LINEEND_LF );
+// have to check if of CharSet is type of ANSI
+// aOpt.SetCharSet( CHARSET_ANSI );
+ }
+ }
+
+ SwDoc* pDoc = rDocSh.GetDoc();
+
+ USHORT nAppScriptType = GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() );
+ {
+ BOOL bDelPrinter = FALSE;
+ SfxPrinter* pPrt = pDoc ? pDoc->getPrinter(false) : 0;
+ if( !pPrt )
+ {
+ SfxItemSet* pSet = new SfxItemSet( rDocSh.GetPool(),
+ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+ 0 );
+ pPrt = new SfxPrinter( pSet );
+ bDelPrinter = TRUE;
+ }
+
+
+ // get the set of disctinct available family names
+ std::set< String > aFontNames;
+ int nFontNames = pPrt->GetDevFontCount();
+ for( int i = 0; i < nFontNames; i++ )
+ {
+ FontInfo aInf( pPrt->GetDevFont( i ) );
+ aFontNames.insert( aInf.GetName() );
+ }
+
+ // insert to listbox
+ for( std::set< String >::const_iterator it = aFontNames.begin();
+ it != aFontNames.end(); ++it )
+ {
+ aFontLB.InsertEntry( *it );
+ }
+
+ if( !aOpt.GetFontName().Len() )
+ {
+ if(pDoc)
+ {
+ USHORT nFontRes = RES_CHRATR_FONT;
+ if(SCRIPTTYPE_ASIAN == nAppScriptType)
+ nFontRes = RES_CHRATR_CJK_FONT;
+ else if(SCRIPTTYPE_COMPLEX == nAppScriptType)
+ nFontRes = RES_CHRATR_CTL_FONT;
+
+ aOpt.SetFontName( ((SvxFontItem&)pDoc->GetDefault(
+ nFontRes )).GetFamilyName() );
+ }
+ else
+ {
+ USHORT nFontType = FONT_STANDARD;
+ if(SCRIPTTYPE_ASIAN == nAppScriptType)
+ nFontType = FONT_STANDARD_CJK;
+ else if(SCRIPTTYPE_COMPLEX == nAppScriptType)
+ nFontType = FONT_STANDARD_CTL;
+ aOpt.SetFontName(SW_MOD()->GetStdFontConfig()->GetFontFor(nFontType));
+ }
+ }
+ aFontLB.SelectEntry( aOpt.GetFontName() );
+
+ if( bDelPrinter )
+ delete pPrt;
+ }
+
+ // initialisiere Sprache
+ {
+ if( !aOpt.GetLanguage() )
+ {
+ if(pDoc)
+ {
+ USHORT nWhich = GetWhichOfScript( RES_CHRATR_LANGUAGE, nAppScriptType);
+ aOpt.SetLanguage( ((SvxLanguageItem&)pDoc->
+ GetDefault( nWhich )).GetLanguage());
+ }
+ else
+ {
+ SvtLinguOptions aLinguOpt;
+ SvtLinguConfig().GetOptions( aLinguOpt );
+ switch(nAppScriptType)
+ {
+ case SCRIPTTYPE_ASIAN:
+ aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, SCRIPTTYPE_ASIAN));
+ break;
+ case SCRIPTTYPE_COMPLEX:
+ aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, SCRIPTTYPE_COMPLEX));
+ break;
+ //SCRIPTTYPE_LATIN:
+ default:
+ aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, SCRIPTTYPE_LATIN));
+ }
+ }
+ }
+
+ aLanguageLB.SetLanguageList( LANG_LIST_ALL, TRUE, FALSE );
+ aLanguageLB.SelectLanguage( aOpt.GetLanguage() );
+ }
+ }
+ else
+ {
+ // hide the used Control for the Export and move the
+ // other behind the charset controls
+ aFontFT.Hide();
+ aFontLB.Hide();
+ aLanguageFT.Hide();
+ aLanguageLB.Hide();
+
+ long nY = aFontFT.GetPosPixel().Y() + 1;
+ Point aPos( aCRLF_FT.GetPosPixel() ); aPos.Y() = nY;
+ aCRLF_FT.SetPosPixel( aPos );
+
+ aPos = aCRLF_RB.GetPosPixel(); aPos.Y() = nY;
+ aCRLF_RB.SetPosPixel( aPos );
+
+ aPos = aCR_RB.GetPosPixel(); aPos.Y() = nY;
+ aCR_RB.SetPosPixel( aPos );
+
+ aPos = aLF_RB.GetPosPixel(); aPos.Y() = nY;
+ aLF_RB.SetPosPixel( aPos );
+
+ Size aSize = GetSizePixel();
+ Size aTmpSz( 6, 6 );
+ aTmpSz = LogicToPixel(aTmpSz, MAP_APPFONT);
+ aSize.Height() = aHelpPB.GetPosPixel().Y() +
+ aHelpPB.GetSizePixel().Height() + aTmpSz.Height();
+ SetSizePixel( aSize );
+ }
+
+ // initialisiere Zeichensatz
+ aCharSetLB.FillFromTextEncodingTable( pStream != NULL );
+ aCharSetLB.SelectTextEncoding( aOpt.GetCharSet() );
+
+ aCharSetLB.SetSelectHdl( LINK( this, SwAsciiFilterDlg, CharSetSelHdl ));
+ aCRLF_RB.SetToggleHdl( LINK( this, SwAsciiFilterDlg, LineEndHdl ));
+ aLF_RB.SetToggleHdl( LINK( this, SwAsciiFilterDlg, LineEndHdl ));
+ aCR_RB.SetToggleHdl( LINK( this, SwAsciiFilterDlg, LineEndHdl ));
+
+ SetCRLF( aOpt.GetParaFlags() );
+
+ aCRLF_RB.SaveValue();
+ aLF_RB.SaveValue();
+ aCR_RB.SaveValue();
+}
+
+
+SwAsciiFilterDlg::~SwAsciiFilterDlg()
+{
+}
+
+
+void SwAsciiFilterDlg::FillOptions( SwAsciiOptions& rOptions )
+{
+ ULONG nCCode = aCharSetLB.GetSelectTextEncoding();
+ String sFont;
+ ULONG nLng = 0;
+ if( aFontLB.IsVisible() )
+ {
+ sFont = aFontLB.GetSelectEntry();
+ nLng = (ULONG)aLanguageLB.GetSelectLanguage();
+ }
+
+ rOptions.SetFontName( sFont );
+ rOptions.SetCharSet( rtl_TextEncoding( nCCode ) );
+ rOptions.SetLanguage( USHORT( nLng ) );
+ rOptions.SetParaFlags( GetCRLF() );
+
+ // JP: Task #71802# save the user settings
+ String sData;
+ rOptions.WriteUserData( sData );
+ if( sData.Len() )
+ {
+ const String& rFindNm = String::CreateFromAscii(
+ aFontLB.IsVisible() ? sDialogImpExtraData
+ : sDialogExpExtraData);
+ USHORT nEnd, nStt = GetExtraData().Search( rFindNm );
+ if( STRING_NOTFOUND != nStt )
+ {
+ // called twice, so remove "old" settings
+ nEnd = GetExtraData().Search( cDialogExtraDataClose,
+ nStt + nDialogExtraDataLen );
+ if( STRING_NOTFOUND != nEnd )
+ GetExtraData().Erase( nStt, nEnd - nStt + 1 );
+ }
+ String sTmp(GetExtraData());
+ sTmp += rFindNm;
+ sTmp += sData;
+ sTmp += cDialogExtraDataClose;
+ GetExtraData() = sTmp;
+ }
+}
+
+void SwAsciiFilterDlg::SetCRLF( LineEnd eEnd )
+{
+ switch( eEnd )
+ {
+ case LINEEND_CR: aCR_RB.Check(); break;
+ case LINEEND_CRLF: aCRLF_RB.Check(); break;
+ case LINEEND_LF: aLF_RB.Check(); break;
+ }
+}
+
+LineEnd SwAsciiFilterDlg::GetCRLF() const
+{
+ LineEnd eEnd;
+ if( aCR_RB.IsChecked() )
+ eEnd = LINEEND_CR;
+ else if( aLF_RB.IsChecked() )
+ eEnd = LINEEND_LF;
+ else
+ eEnd = LINEEND_CRLF;
+ return eEnd;
+}
+
+IMPL_LINK( SwAsciiFilterDlg, CharSetSelHdl, SvxTextEncodingBox*, pBox )
+{
+ LineEnd eOldEnd = GetCRLF(), eEnd = (LineEnd)-1;
+ LanguageType nLng = aFontLB.IsVisible()
+ ? aLanguageLB.GetSelectLanguage()
+ : LANGUAGE_SYSTEM,
+ nOldLng = nLng;
+
+ rtl_TextEncoding nChrSet = pBox->GetSelectTextEncoding();
+ if( nChrSet == gsl_getSystemTextEncoding() )
+ eEnd = GetSystemLineEnd();
+ else
+ {
+ switch( nChrSet )
+ {
+ case RTL_TEXTENCODING_MS_1252:
+#ifdef UNX
+ eEnd = LINEEND_LF;
+#else
+ eEnd = LINEEND_CRLF; // ANSI
+#endif
+ break;
+
+ case RTL_TEXTENCODING_APPLE_ROMAN: // MAC
+ eEnd = LINEEND_CR;
+ break;
+
+ case RTL_TEXTENCODING_IBM_850: // DOS
+ eEnd = LINEEND_CRLF;
+ break;
+
+ case RTL_TEXTENCODING_APPLE_ARABIC:
+ case RTL_TEXTENCODING_APPLE_CENTEURO:
+ case RTL_TEXTENCODING_APPLE_CROATIAN:
+ case RTL_TEXTENCODING_APPLE_CYRILLIC:
+ case RTL_TEXTENCODING_APPLE_DEVANAGARI:
+ case RTL_TEXTENCODING_APPLE_FARSI:
+ case RTL_TEXTENCODING_APPLE_GREEK:
+ case RTL_TEXTENCODING_APPLE_GUJARATI:
+ case RTL_TEXTENCODING_APPLE_GURMUKHI:
+ case RTL_TEXTENCODING_APPLE_HEBREW:
+ case RTL_TEXTENCODING_APPLE_ICELAND:
+ case RTL_TEXTENCODING_APPLE_ROMANIAN:
+ case RTL_TEXTENCODING_APPLE_THAI:
+ case RTL_TEXTENCODING_APPLE_TURKISH:
+ case RTL_TEXTENCODING_APPLE_UKRAINIAN:
+ case RTL_TEXTENCODING_APPLE_CHINSIMP:
+ case RTL_TEXTENCODING_APPLE_CHINTRAD:
+ case RTL_TEXTENCODING_APPLE_JAPANESE:
+ case RTL_TEXTENCODING_APPLE_KOREAN:
+ eEnd = LINEEND_CR;
+ break;
+ }
+ }
+
+ bSaveLineStatus = FALSE;
+ if( eEnd != (LineEnd)-1 ) // changed?
+ {
+ if( eOldEnd != eEnd )
+ SetCRLF( eEnd );
+ }
+ else
+ {
+ // restore old user choise (not the automatic!)
+ aCRLF_RB.Check( aCRLF_RB.GetSavedValue() );
+ aCR_RB.Check( aCR_RB.GetSavedValue() );
+ aLF_RB.Check( aLF_RB.GetSavedValue() );
+ }
+ bSaveLineStatus = TRUE;
+
+ if( nOldLng != nLng && aFontLB.IsVisible() )
+ aLanguageLB.SelectLanguage( nLng );
+
+ return 0;
+}
+
+IMPL_LINK( SwAsciiFilterDlg, LineEndHdl, RadioButton*, pBtn )
+{
+ if( bSaveLineStatus )
+ pBtn->SaveValue();
+ return 0;
+}
+
+
diff --git a/sw/source/ui/dialog/ascfldlg.hrc b/sw/source/ui/dialog/ascfldlg.hrc
new file mode 100644
index 000000000000..b96cdc39b57a
--- /dev/null
+++ b/sw/source/ui/dialog/ascfldlg.hrc
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FL_1 1
+#define FT_CHARSET 2
+#define LB_CHARSET 3
+#define FT_FONT 4
+#define LB_FONT 5
+#define FT_LANGUAGE 6
+#define LB_LANGUAGE 7
+#define FT_CRLF 8
+#define RB_CRLF 9
+#define RB_CR 10
+#define RB_LF 11
+#define PB_OK 12
+#define PB_CANCEL 13
+#define PB_HELP 14
+#define STR_SYS_CHARSET 15
+
+
diff --git a/sw/source/ui/dialog/ascfldlg.src b/sw/source/ui/dialog/ascfldlg.src
new file mode 100644
index 000000000000..78dc6df5ff15
--- /dev/null
+++ b/sw/source/ui/dialog/ascfldlg.src
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "dialog.hrc"
+#include "helpid.h"
+#include "ascfldlg.hrc"
+
+ModalDialog DLG_ASCII_FILTER
+{
+ HelpID = HID_ASCII_FILTER ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 239 , 80 ) ;
+ Moveable = TRUE ;
+ FixedLine FL_1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 170 , 8 ) ;
+ Text [ en-US ] = "Properties";
+ };
+ FixedText FT_CHARSET
+ {
+ Pos = MAP_APPFONT ( 12 , 15 ) ;
+ Size = MAP_APPFONT ( 66 , 10 ) ;
+ Text [ en-US ] = "~Character set";
+ };
+ ListBox LB_CHARSET
+ {
+ HelpID = "sw:ListBox:DLG_ASCII_FILTER:LB_CHARSET";
+ Pos = MAP_APPFONT ( 80 , 14 ) ;
+ Size = MAP_APPFONT ( 90 , 61 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_FONT
+ {
+ Pos = MAP_APPFONT ( 12 , 31 ) ;
+ Size = MAP_APPFONT ( 66 , 10 ) ;
+ Text [ en-US ] = "Default fonts";
+ };
+ ListBox LB_FONT
+ {
+ HelpID = "sw:ListBox:DLG_ASCII_FILTER:LB_FONT";
+ Pos = MAP_APPFONT ( 80 , 30 ) ;
+ Size = MAP_APPFONT ( 90 , 61 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_LANGUAGE
+ {
+ Pos = MAP_APPFONT ( 12 , 47 ) ;
+ Size = MAP_APPFONT ( 66 , 10 ) ;
+ Text [ en-US ] = "Lan~guage";
+ };
+ ListBox LB_LANGUAGE
+ {
+ HelpID = "sw:ListBox:DLG_ASCII_FILTER:LB_LANGUAGE";
+ Pos = MAP_APPFONT ( 80 , 46 ) ;
+ Size = MAP_APPFONT ( 90 , 61 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_CRLF
+ {
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 66 , 8 ) ;
+ Text [ en-US ] = "~Paragraph break";
+ };
+ RadioButton RB_CRLF
+ {
+ HelpID = "sw:RadioButton:DLG_ASCII_FILTER:RB_CRLF";
+ Pos = MAP_APPFONT ( 80 , 64 ) ;
+ Size = MAP_APPFONT ( 40 , 10 ) ;
+ TabStop = TRUE ;
+ Check = TRUE;
+ Text [ en-US ] = "~CR & LF";
+ };
+ RadioButton RB_CR
+ {
+ HelpID = "sw:RadioButton:DLG_ASCII_FILTER:RB_CR";
+ Pos = MAP_APPFONT ( 121 , 64 ) ;
+ Size = MAP_APPFONT ( 20 , 10 ) ;
+// TabStop = TRUE ;
+ Text [ en-US ] = "C~R";
+ };
+ RadioButton RB_LF
+ {
+ HelpID = "sw:RadioButton:DLG_ASCII_FILTER:RB_LF";
+ Pos = MAP_APPFONT ( 155 , 64 ) ;
+ Size = MAP_APPFONT ( 20 , 10 ) ;
+// TabStop = TRUE ;
+ Text [ en-US ] = "~LF";
+ };
+
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 183 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 183 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 183 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ String STR_SYS_CHARSET
+ {
+ Text [ en-US ] = "System";
+ };
+ Text [ en-US ] = "ASCII Filter Options";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/dialog/dialog.src b/sw/source/ui/dialog/dialog.src
new file mode 100644
index 000000000000..26b615bff7b2
--- /dev/null
+++ b/sw/source/ui/dialog/dialog.src
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "dialog.hrc"
+
+CheckBox CB_USE_PASSWD
+{
+ /* ### ACHTUNG: Neuer Text in Resource? ~Paßwort : ~Pa˜wort */
+ Text [ en-US ] = "~Password" ;
+};
+CheckBox CB_READ_ONLY
+{
+ Text [ en-US ] = "~Read-only" ;
+};
+String STR_LINKEDIT_TEXT
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Verknüpfungen bearbeiten : Verkn³pfungen bearbeiten */
+ Text [ en-US ] = "Edit links" ;
+};
+String STR_PATH_NOT_FOUND
+{
+ Text [ en-US ] = "The directory '%1' does not exist." ;
+};
+String STR_FLT_SGV
+{
+ Text = "SGV - StarDraw 2.0,SGV" ;
+};
+
+QueryBox RID_QB_SPELL_CONTINUE
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_YES ;
+ MESSAGE [ en-US ] = "Continue checking at beginning of document?" ;
+};
+String STR_SPELLING_COMPLETED
+{
+ Text [ en-US ] = "The spellcheck is complete." ;
+};
+
diff --git a/sw/source/ui/dialog/docstdlg.cxx b/sw/source/ui/dialog/docstdlg.cxx
new file mode 100644
index 000000000000..40f0fddf98f8
--- /dev/null
+++ b/sw/source/ui/dialog/docstdlg.cxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <stdio.h>
+#include <ctype.h>
+#include <swwait.hxx>
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <swmodule.hxx>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#ifndef _PVIEW_HXX
+#include <pview.hxx>
+#endif
+#include <doc.hxx>
+#include <docstdlg.hxx>
+#ifndef _MODCFG_HXX
+#include <modcfg.hxx>
+#endif
+
+// fuer Statistikfelder
+#include <fldmgr.hxx>
+#include <fldbas.hxx>
+
+#ifndef _DOCSTDLG_HRC
+#include <docstdlg.hrc>
+#endif
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Create
+ --------------------------------------------------------------------*/
+
+
+SfxTabPage * SwDocStatPage::Create(Window *pParent, const SfxItemSet &rSet)
+{
+ return new SwDocStatPage(pParent, rSet);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ctor
+ --------------------------------------------------------------------*/
+
+
+SwDocStatPage::SwDocStatPage(Window *pParent, const SfxItemSet &rSet) :
+
+ SfxTabPage (pParent, SW_RES(TP_DOC_STAT), rSet),
+
+ aTableLbl (this, SW_RES( FT_TABLE )),
+ aGrfLbl (this, SW_RES( FT_GRF )),
+ aOLELbl (this, SW_RES( FT_OLE )),
+ aPageLbl (this, SW_RES( FT_PAGE )),
+ aParaLbl (this, SW_RES( FT_PARA )),
+ aWordLbl (this, SW_RES( FT_WORD )),
+ aCharLbl (this, SW_RES( FT_CHAR )),
+ aLineLbl (this, SW_RES( FT_LINE )),
+
+ aTableNo (this, SW_RES( FT_TABLE_COUNT)),
+ aGrfNo (this, SW_RES( FT_GRF_COUNT )),
+ aOLENo (this, SW_RES( FT_OLE_COUNT )),
+ aPageNo (this, SW_RES( FT_PAGE_COUNT )),
+ aParaNo (this, SW_RES( FT_PARA_COUNT )),
+ aWordNo (this, SW_RES( FT_WORD_COUNT )),
+ aCharNo (this, SW_RES( FT_CHAR_COUNT )),
+ aLineNo (this, SW_RES( FT_LINE_COUNT )),
+ aUpdatePB (this, SW_RES( PB_PDATE ))
+{
+ Update();
+ FreeResource();
+ aUpdatePB.SetClickHdl(LINK(this, SwDocStatPage, UpdateHdl));
+ //#111684# is the current view a page preview no SwFEShell can be found -> hide the update button
+ SwDocShell* pDocShell = (SwDocShell*) SfxObjectShell::Current();
+ SwFEShell* pFEShell = pDocShell->GetFEShell();
+ if(!pFEShell)
+ {
+ aUpdatePB.Show(FALSE);
+ aLineLbl.Show(FALSE);
+ aLineNo .Show(FALSE);
+ }
+
+}
+
+
+ SwDocStatPage::~SwDocStatPage()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: ItemSet fuellen bei Aenderung
+ --------------------------------------------------------------------*/
+
+
+BOOL SwDocStatPage::FillItemSet(SfxItemSet & /*rSet*/)
+{
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwDocStatPage::Reset(const SfxItemSet &/*rSet*/)
+{
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Aktualisieren / Setzen der Daten
+------------------------------------------------------------------------*/
+
+
+void SwDocStatPage::SetData(const SwDocStat &rStat)
+{
+ aTableNo.SetText(String::CreateFromInt32( rStat.nTbl ));
+ aGrfNo.SetText(String::CreateFromInt32( rStat.nGrf ));
+ aOLENo.SetText(String::CreateFromInt32( rStat.nOLE ));
+ aPageNo.SetText(String::CreateFromInt32( rStat.nPage ));
+ aParaNo.SetText(String::CreateFromInt32( rStat.nPara ));
+ aWordNo.SetText(String::CreateFromInt32( rStat.nWord ));
+ aCharNo.SetText(String::CreateFromInt32( rStat.nChar ));
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Aktualisieren der Statistik
+------------------------------------------------------------------------*/
+
+
+void SwDocStatPage::Update()
+{
+ SfxViewShell *pVSh = SfxViewShell::Current();
+ ViewShell *pSh = 0;
+ if ( pVSh->ISA(SwView) )
+ pSh = ((SwView*)pVSh)->GetWrtShellPtr();
+ else if ( pVSh->ISA(SwPagePreView) )
+ pSh = ((SwPagePreView*)pVSh)->GetViewShell();
+
+ ASSERT( pSh, "Shell not found" );
+
+ SwWait aWait( *pSh->GetDoc()->GetDocShell(), TRUE );
+ pSh->StartAction();
+ aDocStat = pSh->GetDoc()->GetDocStat();
+ pSh->GetDoc()->UpdateDocStat( aDocStat );
+ pSh->EndAction();
+
+ SetData(aDocStat);
+}
+
+/*-----------------19.06.97 16.37-------------------
+ Zeilennummer aktualisieren
+--------------------------------------------------*/
+IMPL_LINK( SwDocStatPage, UpdateHdl, PushButton*, EMPTYARG)
+{
+ Update();
+ SwDocShell* pDocShell = (SwDocShell*) SfxObjectShell::Current();
+ SwFEShell* pFEShell = pDocShell->GetFEShell();
+ if(pFEShell)
+ aLineNo.SetText( String::CreateFromInt32( pFEShell->GetLineCount(FALSE)));
+ //pButton->Disable();
+ return 0;
+}
+
diff --git a/sw/source/ui/dialog/docstdlg.hrc b/sw/source/ui/dialog/docstdlg.hrc
new file mode 100644
index 000000000000..5084ea58dbdb
--- /dev/null
+++ b/sw/source/ui/dialog/docstdlg.hrc
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FT_TABLE 1
+#define FT_GRF 2
+#define FT_OLE 3
+#define FT_PAGE 4
+#define FT_PARA 5
+#define FT_WORD 6
+#define FT_CHAR 9
+#define FT_TABLE_COUNT 10
+#define FT_GRF_COUNT 11
+#define FT_OLE_COUNT 12
+#define FT_PAGE_COUNT 13
+#define FT_PARA_COUNT 14
+#define FT_WORD_COUNT 15
+#define FT_CHAR_COUNT 16
+#define FT_LINE 17
+#define FT_LINE_COUNT 18
+#define PB_PDATE 19
+
+#define BT_OK 100
+
diff --git a/sw/source/ui/dialog/docstdlg.src b/sw/source/ui/dialog/docstdlg.src
new file mode 100644
index 000000000000..4976a42176a2
--- /dev/null
+++ b/sw/source/ui/dialog/docstdlg.src
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "docstdlg.hrc"
+#include "helpid.h"
+ // #define TP_DOC_STAT 256
+TabPage TP_DOC_STAT
+{
+ HelpID = HID_DOC_STAT ;
+ Hide = TRUE;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_PAGE
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Number of Pages:" ;
+ Left = TRUE ;
+ };
+ FixedText FT_TABLE
+ {
+ Pos = MAP_APPFONT ( 6 , 18 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Number of Tables:" ;
+ Left = TRUE ;
+ };
+ FixedText FT_GRF
+ {
+ Pos = MAP_APPFONT ( 6 , 30 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Number of Graphics:" ;
+ Left = TRUE ;
+ };
+ FixedText FT_OLE
+ {
+ Pos = MAP_APPFONT ( 6 , 42 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Number of OLE Objects:" ;
+ Left = TRUE ;
+ };
+ FixedText FT_PARA
+ {
+ Pos = MAP_APPFONT ( 6 , 54 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Number of Paragraphs:" ;
+ Left = TRUE ;
+ };
+ FixedText FT_WORD
+ {
+ Pos = MAP_APPFONT ( 6 , 68 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Number of Words:" ;
+ Left = TRUE ;
+ };
+ FixedText FT_CHAR
+ {
+ Pos = MAP_APPFONT ( 6 , 82 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Number of Characters:" ;
+ Left = TRUE ;
+ };
+ FixedText FT_LINE
+ {
+ Pos = MAP_APPFONT ( 6 , 96 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Number of Lines:" ;
+ };
+ FixedText FT_PAGE_COUNT
+ {
+ Pos = MAP_APPFONT ( 114 , 6 ) ;
+ Size = MAP_APPFONT ( 27 , 8 ) ;
+ Left = TRUE ;
+ };
+ FixedText FT_TABLE_COUNT
+ {
+ Pos = MAP_APPFONT ( 114 , 18 ) ;
+ Size = MAP_APPFONT ( 27 , 8 ) ;
+ Left = TRUE ;
+ };
+ FixedText FT_GRF_COUNT
+ {
+ Pos = MAP_APPFONT ( 114 , 30 ) ;
+ Size = MAP_APPFONT ( 27 , 8 ) ;
+ Left = TRUE ;
+ };
+ FixedText FT_OLE_COUNT
+ {
+ Pos = MAP_APPFONT ( 114 , 42 ) ;
+ Size = MAP_APPFONT ( 27 , 8 ) ;
+ Left = TRUE ;
+ };
+ FixedText FT_PARA_COUNT
+ {
+ Pos = MAP_APPFONT ( 114 , 54 ) ;
+ Size = MAP_APPFONT ( 27 , 8 ) ;
+ Left = TRUE ;
+ };
+ FixedText FT_WORD_COUNT
+ {
+ Pos = MAP_APPFONT ( 114 , 68 ) ;
+ Size = MAP_APPFONT ( 27 , 8 ) ;
+ Left = TRUE ;
+ };
+ FixedText FT_CHAR_COUNT
+ {
+ Pos = MAP_APPFONT ( 114 , 82 ) ;
+ Size = MAP_APPFONT ( 27 , 8 ) ;
+ Left = TRUE ;
+ };
+ FixedText FT_LINE_COUNT
+ {
+ Pos = MAP_APPFONT ( 114 , 96 ) ;
+ Size = MAP_APPFONT ( 27 , 8 ) ;
+ Left = TRUE ;
+ Text = "..." ;
+ };
+ PushButton PB_PDATE
+ {
+ HelpID = "sw:PushButton:TP_DOC_STAT:PB_PDATE";
+ Pos = MAP_APPFONT ( 204 , 94 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Update" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/dialog/macassgn.cxx b/sw/source/ui/dialog/macassgn.cxx
new file mode 100644
index 000000000000..fe19a7310135
--- /dev/null
+++ b/sw/source/ui/dialog/macassgn.cxx
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include "hintids.hxx"
+
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#include <svx/htmlmode.hxx>
+#ifndef _SVX_SVXIDS_HRC //autogen
+#include <svx/svxids.hrc>
+#endif
+#include <sfx2/app.hxx>
+#include <vcl/msgbox.hxx>
+
+#include "swtypes.hxx"
+#include "wrtsh.hxx"
+#include "viewopt.hxx"
+#include "macassgn.hxx"
+#include "swevent.hxx"
+#include "docsh.hxx"
+#include "globals.hrc"
+#include "view.hxx"
+#include <sfx2/viewfrm.hxx>
+
+#include <svx/svxdlg.hxx>
+
+#include <doc.hxx>
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::frame::XFrame;
+
+SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType )
+{
+ // const SfxItemSet& rSet = rPg.GetItemSet();
+ SfxEventNamesItem aItem(SID_EVENTCONFIG);
+
+ BOOL bHtmlMode = FALSE;
+ USHORT nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current());
+ bHtmlMode = nHtmlMode & HTMLMODE_ON ? TRUE : FALSE;
+
+ switch( eType )
+ {
+ case MACASSGN_TEXTBAUST: // Textbausteine
+ // rPg.SetGetRangeLink( &_GetRangeHdl );
+ aItem.AddEvent( String( SW_RES(STR_EVENT_START_INS_GLOSSARY) ), String(),
+ SW_EVENT_START_INS_GLOSSARY );
+ aItem.AddEvent( String( SW_RES(STR_EVENT_END_INS_GLOSSARY) ), String(),
+ SW_EVENT_END_INS_GLOSSARY);
+ // damit der neue Handler aktiv wird!
+ // rPg.Reset( rSet );
+ break;
+ case MACASSGN_ALLFRM:
+ case MACASSGN_GRAPHIC: // Grafiken
+ {
+ aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ERROR) ), String(),
+ SVX_EVENT_IMAGE_ERROR);
+ aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ABORT) ), String(),
+ SVX_EVENT_IMAGE_ABORT);
+ aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_LOAD) ), String(),
+ SVX_EVENT_IMAGE_LOAD);
+ }
+ // kein break;
+ case MACASSGN_FRMURL: // Frm - URL-Attribute
+ {
+ if( !bHtmlMode &&
+ (MACASSGN_FRMURL == eType || MACASSGN_ALLFRM == eType))
+ {
+ aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_A ) ), String(),
+ SW_EVENT_FRM_KEYINPUT_ALPHA );
+ aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_NOA ) ), String(),
+ SW_EVENT_FRM_KEYINPUT_NOALPHA );
+ aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_RESIZE ) ), String(),
+ SW_EVENT_FRM_RESIZE );
+ aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_MOVE ) ), String(),
+ SW_EVENT_FRM_MOVE );
+ }
+ }
+ // kein break;
+ case MACASSGN_OLE: // OLE
+ {
+ if( !bHtmlMode )
+ aItem.AddEvent( String( SW_RES(STR_EVENT_OBJECT_SELECT) ), String(),
+ SW_EVENT_OBJECT_SELECT );
+ }
+ // kein break;
+ case MACASSGN_INETFMT: // INetFmt-Attribute
+ {
+ aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSEOVER_OBJECT) ), String(),
+ SFX_EVENT_MOUSEOVER_OBJECT );
+ aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSECLICK_OBJECT) ), String(),
+ SFX_EVENT_MOUSECLICK_OBJECT);
+ aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSEOUT_OBJECT) ), String(),
+ SFX_EVENT_MOUSEOUT_OBJECT);
+ }
+ break;
+ }
+
+ return aItem;
+}
+
+
+BOOL SwMacroAssignDlg::INetFmtDlg( Window* pParent, SwWrtShell& rSh,
+ SvxMacroItem*& rpINetItem )
+{
+ BOOL bRet = FALSE;
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_FRMMACRO, RES_FRMMACRO, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 );
+ SvxMacroItem aItem( RES_FRMMACRO );
+ if( !rpINetItem )
+ rpINetItem = new SvxMacroItem( RES_FRMMACRO );
+ else
+ aItem.SetMacroTable( rpINetItem->GetMacroTable() );
+
+ aSet.Put( aItem );
+ aSet.Put( AddEvents( MACASSGN_INETFMT ) );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( pParent, aSet,
+ rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(),
+ SID_EVENTCONFIG );
+ if ( pMacroDlg && pMacroDlg->Execute() == RET_OK )
+ {
+ const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet();
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == pOutSet->GetItemState( RES_FRMMACRO, FALSE, &pItem ))
+ {
+ rpINetItem->SetMacroTable( ((SvxMacroItem*)pItem)->GetMacroTable() );
+ bRet = TRUE;
+ }
+ }
+ return bRet;
+}
diff --git a/sw/source/ui/dialog/regionsw.cxx b/sw/source/ui/dialog/regionsw.cxx
new file mode 100644
index 000000000000..8a4304bcd5a9
--- /dev/null
+++ b/sw/source/ui/dialog/regionsw.cxx
@@ -0,0 +1,264 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <uitool.hxx>
+#include <svl/urihelper.hxx>
+#include <svl/PasswordHelper.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <sot/formats.hxx>
+#include <sfx2/passwd.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <editeng/sizeitem.hxx>
+#include <svtools/htmlcfg.hxx>
+#include <section.hxx>
+#include <docary.hxx>
+#include <regionsw.hxx>
+#include <basesh.hxx>
+#include <wdocsh.hxx>
+#include <view.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <swundo.hxx> // fuer Undo-Ids
+#include <column.hxx>
+#include <fmtfsize.hxx>
+#include <swunodef.hxx>
+#include <shellio.hxx>
+#include <helpid.h>
+#include <cmdid.h>
+#include <regionsw.hrc>
+#include <comcore.hrc>
+#include <globals.hrc>
+#include <sfx2/bindings.hxx>
+#include <svx/htmlmode.hxx>
+#include <svx/dlgutil.hxx>
+#include "swabstdlg.hxx"
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bereiche einfuegen
+ --------------------------------------------------------------------*/
+
+
+void SwBaseShell::InsertRegionDialog(SfxRequest& rReq)
+{
+ SwWrtShell& rSh = GetShell();
+ const SfxItemSet *pSet = rReq.GetArgs();
+
+ SfxItemSet aSet(GetPool(),
+ RES_COL, RES_COL,
+ RES_LR_SPACE, RES_LR_SPACE,
+ RES_COLUMNBALANCE, RES_FRAMEDIR,
+ RES_BACKGROUND, RES_BACKGROUND,
+ RES_FRM_SIZE, RES_FRM_SIZE,
+ RES_FTN_AT_TXTEND, RES_END_AT_TXTEND,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ 0);
+
+ if (!pSet || pSet->Count()==0)
+ {
+ SwRect aRect;
+ rSh.CalcBoundRect(aRect, FLY_AS_CHAR);
+
+ long nWidth = aRect.Width();
+ aSet.Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth));
+
+ // Hoehe=Breite fuer konsistentere Vorschau (analog zu Bereich bearbeiten)
+ aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractInsertSectionTabDialog* aTabDlg = pFact->CreateInsertSectionTabDialog( DLG_INSERT_SECTION,
+ &GetView().GetViewFrame()->GetWindow(), aSet , rSh);
+ DBG_ASSERT(aTabDlg, "Dialogdiet fail!");
+ aTabDlg->Execute();
+ rReq.Ignore();
+ delete aTabDlg;
+ }
+ else
+ {
+ const SfxPoolItem *pItem = 0;
+ String aTmpStr;
+ if ( SFX_ITEM_SET ==
+ pSet->GetItemState(FN_PARAM_REGION_NAME, TRUE, &pItem) )
+ aTmpStr = rSh.GetUniqueSectionName(
+ &((const SfxStringItem *)pItem)->GetValue() );
+ else
+ aTmpStr = rSh.GetUniqueSectionName();
+
+ SwSectionData aSection(CONTENT_SECTION, aTmpStr);
+ rReq.SetReturnValue(SfxStringItem(FN_INSERT_REGION, aTmpStr));
+
+ aSet.Put( *pSet );
+ if(SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_COLUMNS, FALSE, &pItem)||
+ SFX_ITEM_SET == pSet->GetItemState(FN_INSERT_REGION, FALSE, &pItem))
+ {
+ SwFmtCol aCol;
+ SwRect aRect;
+ rSh.CalcBoundRect(aRect, FLY_AS_CHAR);
+ long nWidth = aRect.Width();
+
+ USHORT nCol = ((SfxUInt16Item *)pItem)->GetValue();
+ if(nCol)
+ {
+ aCol.Init( nCol, 0, static_cast< USHORT >(nWidth) );
+ aSet.Put(aCol);
+ }
+ }
+ else if(SFX_ITEM_SET == pSet->GetItemState(RES_COL, FALSE, &pItem))
+ {
+ aSet.Put(*pItem);
+ }
+
+ const BOOL bHidden = SFX_ITEM_SET ==
+ pSet->GetItemState(FN_PARAM_REGION_HIDDEN, TRUE, &pItem)?
+ (BOOL)((const SfxBoolItem *)pItem)->GetValue():FALSE;
+ const BOOL bProtect = SFX_ITEM_SET ==
+ pSet->GetItemState(FN_PARAM_REGION_PROTECT, TRUE, &pItem)?
+ (BOOL)((const SfxBoolItem *)pItem)->GetValue():FALSE;
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ const BOOL bEditInReadonly = SFX_ITEM_SET ==
+ pSet->GetItemState(FN_PARAM_REGION_EDIT_IN_READONLY, TRUE, &pItem)?
+ (BOOL)((const SfxBoolItem *)pItem)->GetValue():FALSE;
+ // <--
+
+ aSection.SetProtectFlag(bProtect);
+ aSection.SetHidden(bHidden);
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aSection.SetEditInReadonlyFlag(bEditInReadonly);
+ // <--
+
+ if(SFX_ITEM_SET ==
+ pSet->GetItemState(FN_PARAM_REGION_CONDITION, TRUE, &pItem))
+ aSection.SetCondition(((const SfxStringItem *)pItem)->GetValue());
+
+ String aFile, aSub;
+ if(SFX_ITEM_SET ==
+ pSet->GetItemState(FN_PARAM_1, TRUE, &pItem))
+ aFile = ((const SfxStringItem *)pItem)->GetValue();
+
+ if(SFX_ITEM_SET ==
+ pSet->GetItemState(FN_PARAM_3, TRUE, &pItem))
+ aSub = ((const SfxStringItem *)pItem)->GetValue();
+
+
+ if(aFile.Len() || aSub.Len())
+ {
+ String sLinkFileName(sfx2::cTokenSeperator);
+ sLinkFileName += sfx2::cTokenSeperator;
+ sLinkFileName.SetToken(0, sfx2::cTokenSeperator,aFile);
+
+ if(SFX_ITEM_SET ==
+ pSet->GetItemState(FN_PARAM_2, TRUE, &pItem))
+ sLinkFileName.SetToken(1, sfx2::cTokenSeperator,
+ ((const SfxStringItem *)pItem)->GetValue());
+
+ sLinkFileName += aSub;
+ aSection.SetType( FILE_LINK_SECTION );
+ aSection.SetLinkFileName(sLinkFileName);
+ }
+ rSh.InsertSection(aSection, aSet.Count() ? &aSet : 0);
+ rReq.Done();
+ }
+}
+
+IMPL_STATIC_LINK( SwWrtShell, InsertRegionDialog, SwSectionData*, pSect )
+{
+ ::std::auto_ptr<SwSectionData> pSectionData(pSect);
+ if (pSectionData.get())
+ {
+ SfxItemSet aSet(pThis->GetView().GetPool(),
+ RES_COL, RES_COL,
+ RES_BACKGROUND, RES_BACKGROUND,
+ RES_FRM_SIZE, RES_FRM_SIZE,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ 0);
+ SwRect aRect;
+ pThis->CalcBoundRect(aRect, FLY_AS_CHAR);
+ long nWidth = aRect.Width();
+ aSet.Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth));
+ // Hoehe=Breite fuer konsistentere Vorschau (analog zu Bereich bearbeiten)
+ aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractInsertSectionTabDialog* aTabDlg = pFact->CreateInsertSectionTabDialog( DLG_INSERT_SECTION,
+ &pThis->GetView().GetViewFrame()->GetWindow(),aSet , *pThis);
+ DBG_ASSERT(aTabDlg, "Dialogdiet fail!");
+ aTabDlg->SetSectionData(*pSectionData);
+ aTabDlg->Execute();
+
+ delete aTabDlg;
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bereich bearbeiten
+ --------------------------------------------------------------------*/
+
+void SwBaseShell::EditRegionDialog(SfxRequest& rReq)
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ USHORT nSlot = rReq.GetSlot();
+ const SfxPoolItem* pItem = 0;
+ if(pArgs)
+ pArgs->GetItemState(nSlot, FALSE, &pItem);
+ SwWrtShell& rWrtShell = GetShell();
+
+ switch ( nSlot )
+ {
+ case FN_EDIT_REGION:
+ {
+ Window* pParentWin = &GetView().GetViewFrame()->GetWindow();
+ BOOL bStart = TRUE;
+ if(bStart)
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractEditRegionDlg* pEditRegionDlg = pFact->CreateEditRegionDlg( MD_EDIT_REGION,
+ pParentWin, rWrtShell);
+ DBG_ASSERT(pEditRegionDlg, "Dialogdiet fail!");
+ if(pItem && pItem->ISA(SfxStringItem))
+ {
+ pEditRegionDlg->SelectSection(((const SfxStringItem*)pItem)->GetValue());
+ }
+ pEditRegionDlg->Execute();
+ delete pEditRegionDlg;
+ }
+ else
+ InfoBox(pParentWin, SW_RES(REG_WRONG_PASSWORD)).Execute();
+ }
+ break;
+ }
+}
diff --git a/sw/source/ui/dialog/regionsw.hrc b/sw/source/ui/dialog/regionsw.hrc
new file mode 100644
index 000000000000..0535ed46a630
--- /dev/null
+++ b/sw/source/ui/dialog/regionsw.hrc
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _REGIONSW_HRC
+#define _REGIONSW_HRC
+
+#include "dialog.hrc"
+
+
+#define CB_DDE 1
+#define CB_DISMISS 2
+#define CB_END_AT_TXTEND 3
+#define CB_END_NUM 4
+#define CB_FILE 5
+#define CB_FTN_AT_TXTEND 6
+#define CB_FTN_NUM 7
+#define CB_HIDE 8
+#define CB_PASSWD 9
+#define CB_PROTECT 10
+#define CB_FTN_NUM_FMT 11
+#define CB_END_NUM_FMT 12
+#define ED_CONDITION 13
+#define ED_END_PREFIX 14
+#define ED_END_SUFFIX 15
+#define ED_FILE 16
+#define ED_FTN_PREFIX 17
+#define ED_FTN_SUFFIX 18
+#define ED_RANAME 19
+#define ED_RNAME 20
+#define FT_CONDITION 21
+#define FL_EDIT_OPTIONS 22
+#define FLD_END_OFFSET 23
+#define FLD_FTN_OFFSET 24
+#define FT_DDE 25
+#define FT_END_OFFSET 26
+#define FT_END_PREFIX 27
+#define FT_END_SUFFIX 28
+#define FT_FILE 29
+#define FT_FTN_OFFSET 30
+#define FT_FTN_PREFIX 31
+#define FT_FTN_SUFFIX 32
+#define FT_RNAME 33
+#define FT_SUBREG 34
+#define LB_END_NUMVIEW 36
+#define LB_FTN_NUMVIEW 37
+#define LB_SUBREG 38
+#define PB_CANCEL 39
+#define PB_FILE 40
+#define PB_HELP 41
+#define PB_OK 42
+#define PB_OPTIONS 43
+#define PB_SAVED 44
+#define ST_INSERT 45
+#define TLB_SECTION 46
+#define FL_NAME 47
+#define FL_LINK 48
+#define FL_PROTECT 49
+#define FL_HIDE 50
+#define PB_PASSWD 51
+#define FL_END 52
+#define FL_FTN 53
+#define IL_BITMAPS 54
+#define ILH_BITMAPS 55
+// --> FME 2004-06-22 #114856# edit in readonly sections
+#define FL_PROPERTIES 56
+#define CB_EDIT_IN_READONLY 57
+// <--
+
+/* Globale Resourcen */
+#define STR_REG_DUPLICATE (RC_REGIONSW_BEGIN+6)
+#define STR_INFO_DUPLICATE (RC_REGIONSW_BEGIN+7)
+
+#define MD_INS_REGION (RC_REGIONSW_BEGIN+8)
+#define MD_EDIT_REGION (RC_REGIONSW_BEGIN+9)
+#define QB_CONNECT (RC_REGIONSW_BEGIN+10)
+#define REG_WRONG_PASSWORD (RC_REGIONSW_BEGIN+11)
+#define REG_WRONG_PASSWD_REPEAT (RC_REGIONSW_BEGIN+12)
+
+//ImageList elements
+#define BMP_HIDE 1
+#define BMP_NO_HIDE 2
+#define BMP_PROT_HIDE 3
+#define BMP_PROT_NO_HIDE 4
+
+//SwSectionIndentTabPage
+#define FL_INDENT 1
+#define FT_BEFORE 2
+#define MF_BEFORE 3
+#define FT_AFTER 4
+#define MF_AFTER 5
+#define WIN_PREVIEW 6
+
+#endif
diff --git a/sw/source/ui/dialog/regionsw.src b/sw/source/ui/dialog/regionsw.src
new file mode 100644
index 000000000000..9b0671af93f8
--- /dev/null
+++ b/sw/source/ui/dialog/regionsw.src
@@ -0,0 +1,899 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "regionsw.hrc"
+#include "cmdid.h"
+#include "globals.hrc"
+#include "helpid.h"
+/*************************************************************************
+
+ Dialog "Bereich einfuegen"
+
+*************************************************************************/
+#define FT_SUBREG_TEXT \
+ Text [ en-US ] = "~Section" ; \
+
+#define CB_HIDE_TEXT \
+ Text [ en-US ] = "H~ide" ;\
+
+#define FL_HIDE_TEXT \
+ Text [ en-US ] = "Hide" ;\
+
+#define CB_CONDITION_TEXT \
+ Text [ en-US ] = "~With Condition" ;\
+
+#define FL_PROPERTIES_TEXT \
+ Text [ en-US ] = "Properties" ;\
+
+#define CB_EDIT_IN_READONLY_TEXT \
+ Text [ en-US ] = "E~ditable in read-only document" ;\
+
+#define FL_FILE_TEXT \
+ Text [ en-US ] = "Link" ;\
+
+#define CB_FILE_TEXT\
+ Text [ en-US ] = "~Link";\
+
+#define CB_DDE_TEXT \
+ Text [ en-US ] = "DD~E" ;\
+
+#define FT_DDE_TEXT \
+ Text [ en-US ] = "DDE ~command" ;\
+
+#define FT_FILE_TEXT \
+ Text [ en-US ] = "~File name" ;\
+
+
+#define GB_HIDE_TEXT \
+ Text [ en-US ] = "Hide";\
+
+#define GB_OPTIONS_TEXT \
+ Text [ en-US ] = "Options" ;\
+
+#define FL_PROTECT_TEXT \
+ Text [ en-US ] = "Write protection";\
+
+#define CB_PASSWD_TEXT\
+ Text [ en-US ] = "Wit~h password";\
+
+/*************************************************************************
+
+ Dialog "Bereiche bearbeiten"
+
+*************************************************************************/
+ModalDialog MD_EDIT_REGION
+{
+ HelpID = CMD_FN_EDIT_REGION ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 316 , 185 ) ;
+ Text [ en-US ] = "Edit Sections" ;
+ Moveable = TRUE ;
+ FixedLine FL_NAME
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Section" ;
+ };
+ Edit ED_RANAME
+ {
+ HelpID = "sw:Edit:MD_EDIT_REGION:ED_RANAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ };
+ Control TLB_SECTION
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 29 ) ;
+ Size = MAP_APPFONT ( 71 , 150 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_LINK
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 92 , 3 ) ;
+ Size = MAP_APPFONT ( 162 , 8 ) ;
+ FL_FILE_TEXT
+ };
+ TriStateBox CB_FILE
+ {
+ HelpID = "sw:TriStateBox:MD_EDIT_REGION:CB_FILE";
+ Pos = MAP_APPFONT ( 98 , 14 ) ;
+ Size = MAP_APPFONT ( 59 , 10 ) ;
+ TabStop = TRUE ;
+ CB_FILE_TEXT
+ };
+ CheckBox CB_DDE
+ {
+ HelpID = "sw:CheckBox:MD_EDIT_REGION:CB_DDE";
+ Pos = MAP_APPFONT ( 98 , 28 ) ;
+ Size = MAP_APPFONT ( 30 , 10 ) ;
+ Disable = TRUE ;
+ CB_DDE_TEXT
+ };
+ FixedText FT_DDE
+ {
+ Pos = MAP_APPFONT ( 104 , 44) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Hide = TRUE ;
+ FT_DDE_TEXT
+ };
+ FixedText FT_FILE
+ {
+ Pos = MAP_APPFONT ( 104 , 44 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Disable = TRUE ;
+ FT_FILE_TEXT
+ };
+ Edit ED_FILE
+ {
+ HelpID = "sw:Edit:MD_EDIT_REGION:ED_FILE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 165 , 42 ) ;
+ Size = MAP_APPFONT ( 68 , 12 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_FILE
+ {
+ HelpID = "sw:PushButton:MD_EDIT_REGION:PB_FILE";
+ Pos = MAP_APPFONT ( 239 , 42 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ Text = "...";
+ };
+ FixedText FT_SUBREG
+ {
+ Pos = MAP_APPFONT ( 104 , 59 ) ;
+ Size = MAP_APPFONT ( 38 , 8 ) ;
+ Disable = TRUE ;
+ FT_SUBREG_TEXT
+ };
+ ComboBox LB_SUBREG
+ {
+ HelpID = "sw:ComboBox:MD_EDIT_REGION:LB_SUBREG";
+ Pos = MAP_APPFONT ( 165 , 57 ) ;
+ Size = MAP_APPFONT ( 68 , 50 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedLine FL_PROTECT
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 92 , 75 ) ;
+ Size = MAP_APPFONT ( 162 , 8 ) ;
+ FL_PROTECT_TEXT
+ };
+ TriStateBox CB_PROTECT
+ {
+ HelpID = "sw:TriStateBox:MD_EDIT_REGION:CB_PROTECT";
+ Pos = MAP_APPFONT ( 98 , 86 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ TriStateDisable = FALSE ;
+ Text [ en-US ] = "~Protected" ;
+ };
+ CheckBox CB_PASSWD
+ {
+ HelpID = "sw:CheckBox:MD_EDIT_REGION:CB_PASSWD";
+ Pos = MAP_APPFONT ( 107 , 100 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ CB_PASSWD_TEXT
+ };
+ PushButton PB_PASSWD
+ {
+ HelpID = "sw:PushButton:MD_EDIT_REGION:PB_PASSWD";
+ Pos = MAP_APPFONT ( 239 , 98 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ TabStop = TRUE ;
+ Text = "..." ;
+ };
+ FixedLine FL_HIDE
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 92 , 116 ) ;
+ Size = MAP_APPFONT ( 162 , 8 ) ;
+ FL_HIDE_TEXT
+ };
+ TriStateBox CB_HIDE
+ {
+ HelpID = "sw:TriStateBox:MD_EDIT_REGION:CB_HIDE";
+ Pos = MAP_APPFONT ( 98 , 127 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ TabStop = TRUE ;
+ TriStateDisable = FALSE ;
+ CB_HIDE_TEXT
+ };
+ FixedText FT_CONDITION
+ {
+ Pos = MAP_APPFONT ( 104 , 143) ;
+ Size = MAP_APPFONT ( 55 , 8 ) ;
+ Disable = TRUE ;
+ CB_CONDITION_TEXT
+ };
+ Edit ED_CONDITION
+ {
+ HelpID = "sw:Edit:MD_EDIT_REGION:ED_CONDITION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 165 , 141) ;
+ Size = MAP_APPFONT ( 86 , 12 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ };
+
+ FixedLine FL_PROPERTIES
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 92 , 159 ) ;
+ Size = MAP_APPFONT ( 162 , 8 ) ;
+ FL_PROPERTIES_TEXT
+ };
+ TriStateBox CB_EDIT_IN_READONLY
+ {
+ HelpID = "sw:TriStateBox:MD_EDIT_REGION:CB_EDIT_IN_READONLY";
+ Pos = MAP_APPFONT ( 98 , 170 ) ;
+ Size = MAP_APPFONT ( 156 , 10 ) ;
+ TabStop = TRUE ;
+ TriStateDisable = FALSE ;
+ CB_EDIT_IN_READONLY_TEXT
+ };
+
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 263 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 263 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_OPTIONS
+ {
+ HelpID = "sw:PushButton:MD_EDIT_REGION:PB_OPTIONS";
+ Pos = MAP_APPFONT ( 263 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Options...";
+ };
+ PushButton CB_DISMISS
+ {
+ HelpID = "sw:PushButton:MD_EDIT_REGION:CB_DISMISS";
+ Pos = MAP_APPFONT ( 263 , 57 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Remove" ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 263 , 77 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+
+#define DLG_IMAGE_IDLIST \
+ IdList = \
+ { \
+ BMP_HIDE /*1*/ ;\
+ BMP_NO_HIDE /*2*/ ;\
+ BMP_PROT_HIDE /*3*/ ;\
+ BMP_PROT_NO_HIDE /*4*/ ;\
+ }; \
+ IdCount = { 4 ; };
+
+ ImageList IL_BITMAPS
+ {
+ Prefix = "re";
+ MaskColor = IMAGE_MASK_COLOR ;
+ DLG_IMAGE_IDLIST
+ };
+ ImageList ILH_BITMAPS
+ {
+ Prefix = "reh";
+ MaskColor = IMAGE_MASK_COLOR ;
+ DLG_IMAGE_IDLIST
+ };
+};
+String STR_REG_DUPLICATE
+{
+ Text [ en-US ] = "Section name changed:" ;
+};
+String STR_INFO_DUPLICATE
+{
+ Text [ en-US ] = "Duplicate section name" ;
+};
+QueryBox QB_CONNECT
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_NO ;
+ Message [ en-US ] = "A file connection will delete the contents of the current section. Connect anyway?" ;
+};
+InfoBox REG_WRONG_PASSWORD
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "The password entered is invalid." ;
+};
+InfoBox REG_WRONG_PASSWD_REPEAT
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "The password has not been set." ;
+};
+
+TabDialog DLG_INSERT_SECTION
+{
+ HelpId = HID_INSERT_SECTION_DLG;
+ Text [ en-US ] = "Insert Section" ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_INSERT_SECTION;
+ PageResID = TP_INSERT_SECTION;
+ Text [ en-US ] = "Section";
+ };
+ PageItem
+ {
+ Identifier = TP_COLUMN ;
+ PageResID = TP_COLUMN ;
+ Text [ en-US ] = "Columns" ;
+ };
+ PageItem
+ {
+ Identifier = TP_SECTION_INDENTS;
+ PageResID = TP_SECTION_INDENTS;
+ Text [ en-US ] = "Indents" ;
+ };
+ PageItem
+ {
+ Identifier = TP_BACKGROUND ;
+ PageResID = TP_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ };
+ PageItem
+ {
+ Identifier = TP_SECTION_FTNENDNOTES ;
+ PageResID = TP_SECTION_FTNENDNOTES ;
+ Text [ en-US ] = "Footnotes/Endnotes";
+ };
+ };
+ };
+ String ST_INSERT
+ {
+ Text [ en-US ] = "Insert" ;
+ };
+};
+
+TabPage TP_INSERT_SECTION
+{
+ HelpID = HID_INSERT_SECTION_PAGE;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_NAME
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 78 , 8 ) ;
+ Text [ en-US ] = "New section" ;
+ };
+ ComboBox ED_RNAME
+ {
+ HelpID = "sw:ComboBox:TP_INSERT_SECTION:ED_RNAME";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 69 , 140 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ SORT = TRUE ;
+ };
+ FixedLine FL_LINK
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 90 , 3 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ FL_FILE_TEXT
+ };
+ CheckBox CB_FILE
+ {
+ HelpID = "sw:CheckBox:TP_INSERT_SECTION:CB_FILE";
+ Pos = MAP_APPFONT ( 96 , 14 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ TabStop = TRUE ;
+ CB_FILE_TEXT
+ };
+ CheckBox CB_DDE
+ {
+ HelpID = "sw:CheckBox:TP_INSERT_SECTION:CB_DDE";
+ Pos = MAP_APPFONT ( 96 , 28) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Disable = TRUE ;
+ CB_DDE_TEXT
+ };
+ FixedText FT_DDE
+ {
+ Pos = MAP_APPFONT ( 96 , 44 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Hide = TRUE ;
+ FT_DDE_TEXT
+ };
+ FixedText FT_FILE
+ {
+ Pos = MAP_APPFONT ( 96 , 44 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Disable = TRUE ;
+ FT_FILE_TEXT
+ };
+ Edit ED_FILE
+ {
+ HelpID = "sw:Edit:TP_INSERT_SECTION:ED_FILE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 160 , 42 ) ;
+ Size = MAP_APPFONT ( 76 , 12 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_FILE
+ {
+ HelpID = "sw:PushButton:TP_INSERT_SECTION:PB_FILE";
+ Pos = MAP_APPFONT ( 239 , 42 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ Text = "...";
+ };
+ FixedText FT_SUBREG
+ {
+ Pos = MAP_APPFONT ( 96 , 60 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Disable = TRUE ;
+ FT_SUBREG_TEXT
+ };
+ ComboBox LB_SUBREG
+ {
+ HelpID = "sw:ComboBox:TP_INSERT_SECTION:LB_SUBREG";
+ Pos = MAP_APPFONT ( 160 , 58 ) ;
+ Size = MAP_APPFONT ( 76 , 50 ) ;
+ DropDown = TRUE ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedLine FL_PROTECT
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 90 , 76 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ FL_PROTECT_TEXT
+ };
+ CheckBox CB_PROTECT
+ {
+ HelpID = "sw:CheckBox:TP_INSERT_SECTION:CB_PROTECT";
+ Pos = MAP_APPFONT ( 96 , 87 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Protect";
+ };
+ CheckBox CB_PASSWD
+ {
+ HelpID = "sw:CheckBox:TP_INSERT_SECTION:CB_PASSWD";
+ Pos = MAP_APPFONT ( 105 , 101 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ CB_PASSWD_TEXT
+ };
+ PushButton PB_PASSWD
+ {
+ HelpID = "sw:PushButton:TP_INSERT_SECTION:PB_PASSWD";
+ Pos = MAP_APPFONT ( 239 , 99 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ TabStop = TRUE ;
+ Text = "..." ;
+ };
+ FixedLine FL_HIDE
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 90 , 117 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ FL_HIDE_TEXT
+ };
+ CheckBox CB_HIDE
+ {
+ HelpID = "sw:CheckBox:TP_INSERT_SECTION:CB_HIDE";
+ Pos = MAP_APPFONT ( 96 , 128 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ CB_HIDE_TEXT
+ };
+ FixedText FT_CONDITION
+ {
+ Pos = MAP_APPFONT ( 96 , 144 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Disable = TRUE ;
+ CB_CONDITION_TEXT
+ };
+ Edit ED_CONDITION
+ {
+ HelpID = "sw:Edit:TP_INSERT_SECTION:ED_CONDITION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 160 , 142 ) ;
+ Size = MAP_APPFONT ( 91 , 12 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ };
+
+ FixedLine FL_PROPERTIES
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 90 , 159 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ FL_PROPERTIES_TEXT
+ };
+ CheckBox CB_EDIT_IN_READONLY
+ {
+ HelpID = "sw:CheckBox:TP_INSERT_SECTION:CB_EDIT_IN_READONLY";
+ Pos = MAP_APPFONT ( 96 , 170 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ CB_EDIT_IN_READONLY_TEXT
+ };
+
+};
+
+TabDialog DLG_SECTION_PROPERTIES
+{
+ HelpId = HID_SECTION_PROPERTIES_DLG;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_COLUMN ;
+ PageResID = TP_COLUMN ;
+ Text [ en-US ] = "Columns" ;
+ };
+ PageItem
+ {
+ Identifier = TP_SECTION_INDENTS;
+ PageResID = TP_SECTION_INDENTS;
+ Text [ en-US ] = "Indents" ;
+ };
+ PageItem
+ {
+ Identifier = TP_BACKGROUND ;
+ PageResID = TP_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ };
+ PageItem
+ {
+ Identifier = TP_SECTION_FTNENDNOTES ;
+ PageResID = TP_SECTION_FTNENDNOTES ;
+ Text [ en-US ] = "Footnotes/Endnotes";
+ };
+ };
+ };
+ Text [ en-US ] = "Options";
+};
+
+
+TabPage TP_SECTION_FTNENDNOTES
+{
+ HelpID = HID_SECTION_FTNENDNOTES_PAGE;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_FTN
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Footnotes";
+ };
+ CheckBox CB_FTN_AT_TXTEND
+ {
+ HelpID = "sw:CheckBox:TP_SECTION_FTNENDNOTES:CB_FTN_AT_TXTEND";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Collec~t at end of text";
+
+ };
+ CheckBox CB_FTN_NUM
+ {
+ HelpID = "sw:CheckBox:TP_SECTION_FTNENDNOTES:CB_FTN_NUM";
+ Pos = MAP_APPFONT ( 18 , 29 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Restart numbering";
+ };
+ FixedText FT_FTN_OFFSET
+ {
+ Pos = MAP_APPFONT ( 24 , 46 ) ;
+ Size = MAP_APPFONT ( 64 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Start at" ;
+ };
+ NumericField FLD_FTN_OFFSET
+ {
+ HelpID = "sw:NumericField:TP_SECTION_FTNENDNOTES:FLD_FTN_OFFSET";
+ Pos = MAP_APPFONT ( 90 , 44 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ First = 1 ;
+ Last = 9999 ;
+ Maximum = 9999 ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+ CheckBox CB_FTN_NUM_FMT
+ {
+ HelpID = "sw:CheckBox:TP_SECTION_FTNENDNOTES:CB_FTN_NUM_FMT";
+ Pos = MAP_APPFONT ( 24 , 61 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Custom ~format";
+ };
+ FixedText FT_FTN_PREFIX
+ {
+ Pos = MAP_APPFONT ( 30 , 76 ) ;
+ Size = MAP_APPFONT ( 58 , 8 ) ;
+ Text [ en-US ] = "Be~fore" ;
+ Left = TRUE ;
+ };
+ Edit ED_FTN_PREFIX
+ {
+ HelpID = "sw:Edit:TP_SECTION_FTNENDNOTES:ED_FTN_PREFIX";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 90 , 74 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ MaxTextLength = 50 ;
+ };
+ ListBox LB_FTN_NUMVIEW
+ {
+ HelpID = "sw:ListBox:TP_SECTION_FTNENDNOTES:LB_FTN_NUMVIEW";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 123 , 74 ) ;
+ Size = MAP_APPFONT ( 62 , 50 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_FTN_SUFFIX
+ {
+ Pos = MAP_APPFONT ( 191 , 76 ) ;
+ Size = MAP_APPFONT ( 25 , 8 ) ;
+ Text [ en-US ] = "Aft~er" ;
+ Right = TRUE ;
+ };
+ Edit ED_FTN_SUFFIX
+ {
+ HelpID = "sw:Edit:TP_SECTION_FTNENDNOTES:ED_FTN_SUFFIX";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 219 , 74 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ MaxTextLength = 50 ;
+ };
+
+
+ FixedLine FL_END
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 92 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Endnotes";
+ };
+ CheckBox CB_END_AT_TXTEND
+ {
+ HelpID = "sw:CheckBox:TP_SECTION_FTNENDNOTES:CB_END_AT_TXTEND";
+ Pos = MAP_APPFONT ( 12 , 103 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "C~ollect at end of section";
+ };
+ CheckBox CB_END_NUM
+ {
+ HelpID = "sw:CheckBox:TP_SECTION_FTNENDNOTES:CB_END_NUM";
+ Pos = MAP_APPFONT ( 16 , 118 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Restart numbering";
+ };
+ FixedText FT_END_OFFSET
+ {
+ Pos = MAP_APPFONT ( 24 , 135 ) ;
+ Size = MAP_APPFONT ( 64 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Start at" ;
+ };
+ NumericField FLD_END_OFFSET
+ {
+ HelpID = "sw:NumericField:TP_SECTION_FTNENDNOTES:FLD_END_OFFSET";
+ Pos = MAP_APPFONT ( 90 , 133 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ First = 1 ;
+ Last = 9999 ;
+ Maximum = 9999 ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+ CheckBox CB_END_NUM_FMT
+ {
+ HelpID = "sw:CheckBox:TP_SECTION_FTNENDNOTES:CB_END_NUM_FMT";
+ Pos = MAP_APPFONT ( 24 , 150 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Custom format";
+ };
+
+ FixedText FT_END_PREFIX
+ {
+ Pos = MAP_APPFONT ( 30 , 165 ) ;
+ Size = MAP_APPFONT ( 58 , 8 ) ;
+ Text [ en-US ] = "Be~fore" ;
+ Left = TRUE ;
+ };
+ Edit ED_END_PREFIX
+ {
+ HelpID = "sw:Edit:TP_SECTION_FTNENDNOTES:ED_END_PREFIX";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 90 , 163 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ MaxTextLength = 50 ;
+ };
+ ListBox LB_END_NUMVIEW
+ {
+ HelpID = "sw:ListBox:TP_SECTION_FTNENDNOTES:LB_END_NUMVIEW";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 123 , 163 ) ;
+ Size = MAP_APPFONT ( 62 , 50 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ };
+ FixedText FT_END_SUFFIX
+ {
+ Pos = MAP_APPFONT ( 191 , 165 ) ;
+ Size = MAP_APPFONT ( 25 , 8 ) ;
+ Text [ en-US ] = "Aft~er" ;
+ Right = TRUE ;
+ };
+ Edit ED_END_SUFFIX
+ {
+ HelpID = "sw:Edit:TP_SECTION_FTNENDNOTES:ED_END_SUFFIX";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 219 , 163 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ MaxTextLength = 50 ;
+ };
+};
+
+TabPage TP_SECTION_INDENTS
+{
+ HelpID = HID_SECTION_INDENTS_PAGE;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_INDENT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 173 , 8 ) ;
+ Text [ en-US ] = "Indent" ;
+ };
+ FixedText FT_BEFORE
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Before section" ;
+ };
+ MetricField MF_BEFORE
+ {
+ HelpID = "sw:MetricField:TP_SECTION_INDENTS:MF_BEFORE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 135 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ Minimum = -9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_AFTER
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~After section" ;
+ };
+ MetricField MF_AFTER
+ {
+ HelpID = "sw:MetricField:TP_SECTION_INDENTS:MF_AFTER";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 135 , 30 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ Minimum = -9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ Window WIN_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 185 , 7 ) ;
+ Size = MAP_APPFONT ( 68 , 112 ) ;
+ };
+};
diff --git a/sw/source/ui/dialog/swabstdlg.cxx b/sw/source/ui/dialog/swabstdlg.cxx
new file mode 100644
index 000000000000..b873d8028024
--- /dev/null
+++ b/sw/source/ui/dialog/swabstdlg.cxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include "swabstdlg.hxx"
+
+#include <osl/module.hxx>
+#include <tools/string.hxx>
+#include <vcl/unohelp.hxx>
+
+typedef SwAbstractDialogFactory* (__LOADONCALLAPI *SwFuncPtrCreateDialogFactory)();
+
+extern "C" { static void SAL_CALL thisModule() {} }
+
+SwAbstractDialogFactory* SwAbstractDialogFactory::Create()
+{
+ SwFuncPtrCreateDialogFactory fp = 0;
+ static ::osl::Module aDialogLibrary;
+ static const ::rtl::OUString sLibName(::vcl::unohelper::CreateLibraryName("swui", TRUE));
+ if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, String( sLibName ) ) )
+ fp = ( SwAbstractDialogFactory* (__LOADONCALLAPI*)() )
+ aDialogLibrary.getFunctionSymbol( ::rtl::OUString::createFromAscii("CreateDialogFactory") );
+ if ( fp )
+ return fp();
+ return 0;
+}
diff --git a/sw/source/ui/dialog/swdialmgr.cxx b/sw/source/ui/dialog/swdialmgr.cxx
new file mode 100644
index 000000000000..308411358efa
--- /dev/null
+++ b/sw/source/ui/dialog/swdialmgr.cxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+// include ---------------------------------------------------------------
+
+#include "dialmgr.hxx"
+#include "tools/string.hxx"
+#include <sfx2/app.hxx>
+
+//copy from core\bastyp\swtypes.cxx
+String aEmptyStr; // Konstante Strings
+
+ResMgr* pSwResMgr=0;
+
+ResMgr* SwDialogsResMgr::GetResMgr()
+{
+ if ( !pSwResMgr )
+ {
+ pSwResMgr = SfxApplication::CreateResManager( "sw" );
+ }
+
+ return pSwResMgr;
+}
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
new file mode 100644
index 000000000000..91d2b2c12b47
--- /dev/null
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -0,0 +1,1742 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include "swdlgfact.hxx"
+#include <svl/style.hxx>
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include "dialog.hrc"
+#include "misc.hrc"
+#include "chrdlg.hrc"
+#include "fldui.hrc"
+#include "table.hrc"
+#include "frmui.hrc"
+#include "dbui.hrc"
+#include "globals.hrc"
+#include "fldui.hrc"
+#include "envelp.hrc"
+#include "dochdl.hrc"
+#include <index.hrc>
+#include <regionsw.hrc>
+#include <fmtui.hrc>
+
+#include <wordcountdialog.hxx>
+#include "abstract.hxx" // add for SwInsertAbstractDlg
+#include "addrdlg.hxx" // add for SwAddrDlg
+#include "ascfldlg.hxx" // add for SwAsciiFilterDlg
+#include "bookmark.hxx" //add for SwInsertBookmarkDlg
+#include "break.hxx" //add for SwBreakDlg
+#include "changedb.hxx" //add for SwChangeDBDlg
+#include "chrdlg.hxx" // add for SwCharDlg
+#include "convert.hxx" //add for SwConvertTableDlg
+#include "cption.hxx" //add for SwCaptionDialog
+#include "dbinsdlg.hxx" //add for SwInsertDBColAutoPilot
+#include "docfnote.hxx" //add for SwFootNoteOptionDlg
+#include "docstdlg.hxx" //add for SwDocStatPage
+#include "DropDownFieldDialog.hxx" //add for DropDownFieldDialog
+#include "envlop.hxx" //add for SwEnvDlg
+#include "label.hxx" //add for SwLabDlg
+#include "drpcps.hxx" //add for SwDropCapsDlg
+#include "swuipardlg.hxx" //add for SwParaDlg
+#include "pattern.hxx" //add for SwBackgroundDlg
+#include "rowht.hxx" //add for SwTableHeightDlg
+#include "selglos.hxx" //add for SwSelGlossaryDlg
+#include "splittbl.hxx" //add for SwSplitTblDlg
+#include "srtdlg.hxx" //add for SwSortDlg
+#include "tautofmt.hxx" //add for SwAutoFormatDlg
+#include "tblnumfm.hxx" //add for SwNumFmtDlg
+#include "uiborder.hxx" //add for SwBorderDlg
+#include "wrap.hxx" //add for SwWrapDlg
+#include "colwd.hxx" //add for SwTableWidthDlg
+#include "tabledlg.hxx" //add for SwTableTabDlg
+#include "fldtdlg.hxx" //add for SwFldDlg
+#include "fldedt.hxx" //add for SwFldEditDlg
+#include "swrenamexnameddlg.hxx" //add for SwRenameXNamedDlg
+#include "swmodalredlineacceptdlg.hxx" //add for SwModalRedlineAcceptDlg
+#include <frmdlg.hxx> //add for SwFrmDlg
+#include <tmpdlg.hxx> //add for SwTemplateDlg
+#include <glossary.hxx> //add for SwGlossaryDlg
+#include <inpdlg.hxx> //add for SwFldInputDlg
+#include <insfnote.hxx> //add for SwInsFootNoteDlg
+#include <insrule.hxx> //add for SwInsertGrfRulerDlg
+#include <instable.hxx> //add for SwInsTableDlg
+#include <javaedit.hxx> //add for SwJavaEditDialog
+#include <linenum.hxx> //add for SwLineNumberingDlg
+#include <mailmrge.hxx> //add for SwMailMergeDlg, SwMailMergeCreateFromDlg, SwMailMergeFieldConnectionsDlg
+#include <mergetbl.hxx> //add for SwMergeTblDlg
+#include <multmrk.hxx> //add for SwMultiTOXMarkDlg
+#include <num.hxx> //add for SwSvxNumBulletTabDialog
+#include <outline.hxx> //add for SwOutlineTabDialog
+#include <column.hxx> //add for SwColumnDlg
+#include <cnttab.hxx> //add for SwMultiTOXTabDialog
+#include <swuicnttab.hxx> //add for SwMultiTOXTabDialog
+#include <regionsw.hxx> //add for SwEditRegionDlg, SwInsertSectionTabDialog
+#include <optcomp.hxx> //add for SwCompatibilityOptPage
+#include <optload.hxx> //add for SwLoadOptPage
+#include <optpage.hxx> //add for OptPage
+#include <swuiidxmrk.hxx> //add for SwIndexMarkDlg, SwAuthMarkDlg, SwIndexMarkModalDlg, SwAuthMarkModalDlg
+#include <svx/dialogs.hrc>
+#include <mailmergewizard.hxx>
+#include <mailconfigpage.hxx>
+
+using namespace ::com::sun::star;
+
+IMPL_ABSTDLG_BASE(AbstractSwWordCountDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractSfxDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSwAsciiFilterDlg_Impl);
+IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSplitTableDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractSwBreakDlg_Impl); //add for SwBreakDlg
+IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); //add for SwCharDlg, SwFootNoteOptionDlg, SwEnvDlg SwParaDlg SwTableTabDlg
+IMPL_ABSTDLG_BASE(AbstractSwConvertTableDlg_Impl); //add for SwConvertTableDlg
+IMPL_ABSTDLG_BASE(AbstractSwInsertDBColAutoPilot_Impl); //add for SwInsertDBColAutoPilot
+IMPL_ABSTDLG_BASE(AbstractDropDownFieldDialog_Impl); //add for DropDownFieldDialog
+IMPL_ABSTDLG_BASE(AbstarctSwLabDlg_Impl);//add for SwLabDlg
+IMPL_ABSTDLG_BASE(AbstarctSwSelGlossaryDlg_Impl);//add for SwSelGlossaryDlg
+IMPL_ABSTDLG_BASE(AbstractSwAutoFormatDlg_Impl); //add for SwAutoFormatDlg
+IMPL_ABSTDLG_BASE(AbstractSwFldDlg_Impl); //add for SwFldDlg
+IMPL_ABSTDLG_BASE(AbstractSwRenameXNamedDlg_Impl); //add for SwRenameXNamedDlg
+IMPL_ABSTDLG_BASE(AbstractSwModalRedlineAcceptDlg_Impl); //add for SwModalRedlineAcceptDlg
+IMPL_ABSTDLG_BASE(AbstractGlossaryDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractFldInputDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractInsFootNoteDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractInsertGrfRulerDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractInsTableDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractJavaEditDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractMailMergeDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractMailMergeCreateFromDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractMailMergeFieldConnectionsDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractMultiTOXTabDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractEditRegionDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractInsertSectionTabDialog_Impl);
+IMPL_ABSTDLG_BASE(AbstractIndexMarkFloatDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractAuthMarkFloatDlg_Impl);
+
+// AbstractTabDialog_Impl begin
+void AbstractTabDialog_Impl::SetCurPageId( USHORT nId )
+{
+ pDlg->SetCurPageId( nId );
+}
+
+const SfxItemSet* AbstractTabDialog_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+
+const USHORT* AbstractTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem )
+{
+ return pDlg->GetInputRanges( pItem );
+}
+
+void AbstractTabDialog_Impl::SetInputSet( const SfxItemSet* pInSet )
+{
+ pDlg->SetInputSet( pInSet );
+}
+//From class Window.
+void AbstractTabDialog_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+String AbstractTabDialog_Impl::GetText() const
+{
+ return pDlg->GetText();
+}
+
+//add for AbstractTabDialog_Impl end
+
+void AbstractSwWordCountDialog_Impl::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc)
+{
+ pDlg->SetValues(rCurrent, rDoc);
+}
+
+//add for SwInsertAbstractDlg begin
+BYTE AbstractSwInsertAbstractDlg_Impl::GetLevel() const
+{
+ return pDlg->GetLevel();
+}
+BYTE AbstractSwInsertAbstractDlg_Impl::GetPara() const
+{
+ return pDlg->GetPara();
+}
+//add for SwInsertAbstractDlg end
+
+//add for SwAddrDlg, SwDropCapsDlg ,SwBackgroundDlg, SwNumFmtDlg SwBorderDlg SwWrapDlg SwFldEditDlg begin
+const SfxItemSet* AbstractSfxDialog_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+
+void AbstractSfxDialog_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+String AbstractSfxDialog_Impl::GetText() const
+{
+ return pDlg->GetText();
+}
+
+//add for SwAddrDlg, SwDropCapsDlg ,SwBackgroundDlg, SwNumFmtDlg SwBorderDlg SwWrapDlg SwFldEditDlg end
+
+//add for SwAsciiFilterDlg begin
+void AbstractSwAsciiFilterDlg_Impl::FillOptions( SwAsciiOptions& rOptions )
+{
+ pDlg->FillOptions(rOptions);
+}
+//add for SwAsciiFilterDlg end
+
+//add for SwSplitTblDlg
+sal_uInt16 AbstractSplitTableDialog_Impl::GetSplitMode()
+{
+ return pDlg->GetSplitMode();
+}
+//add for SwBreakDlg begin
+String AbstractSwBreakDlg_Impl::GetTemplateName()
+{
+ return pDlg->GetTemplateName();
+}
+
+USHORT AbstractSwBreakDlg_Impl:: GetKind()
+{
+ return pDlg->GetKind();
+}
+
+USHORT AbstractSwBreakDlg_Impl:: GetPageNumber()
+{
+ return pDlg->GetPageNumber();
+}
+//add for SwBreakDlg end
+
+//add for SwConvertTableDlg begin
+void AbstractSwConvertTableDlg_Impl::GetValues( sal_Unicode& rDelim,SwInsertTableOptions& rInsTblFlags,
+ SwTableAutoFmt *& prTAFmt )
+{
+ pDlg->GetValues(rDelim,rInsTblFlags, prTAFmt);
+}
+//add for SwConvertTableDlg end
+
+//add for SwInsertDBColAutoPilot begin
+void AbstractSwInsertDBColAutoPilot_Impl::DataToDoc( const uno::Sequence< uno::Any >& rSelection,
+ uno::Reference< sdbc::XDataSource> rxSource,
+ uno::Reference< sdbc::XConnection> xConnection,
+ uno::Reference< sdbc::XResultSet > xResultSet)
+{
+ pDlg->DataToDoc(rSelection, rxSource, xConnection, xResultSet);
+}
+//add for SwInsertDBColAutoPilot end
+
+// add for DropDownFieldDialog begin
+ByteString AbstractDropDownFieldDialog_Impl::GetWindowState( ULONG nMask ) const
+{
+ return pDlg->GetWindowState(nMask);
+}
+void AbstractDropDownFieldDialog_Impl::SetWindowState( const ByteString& rStr )
+{
+ pDlg->SetWindowState(rStr);
+}
+//add for DropDownFieldDialog end
+
+//add for SwLabDlg begin
+
+void AbstarctSwLabDlg_Impl::SetCurPageId( USHORT nId )
+{
+ pDlg->SetCurPageId( nId );
+}
+
+const SfxItemSet* AbstarctSwLabDlg_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+
+const USHORT* AbstarctSwLabDlg_Impl::GetInputRanges(const SfxItemPool& pItem )
+{
+ return pDlg->GetInputRanges( pItem );
+}
+
+void AbstarctSwLabDlg_Impl::SetInputSet( const SfxItemSet* pInSet )
+{
+ pDlg->SetInputSet( pInSet );
+}
+
+void AbstarctSwLabDlg_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+String AbstarctSwLabDlg_Impl::GetText() const
+{
+ return pDlg->GetText();
+}
+const String& AbstarctSwLabDlg_Impl::GetBusinessCardStr() const
+{
+ return pDlg->GetBusinessCardStr();
+}
+Printer * AbstarctSwLabDlg_Impl::GetPrt()
+{
+ return pDlg->GetPrt();
+}
+//add for SwLabDlg end
+
+
+//add for SwSelGlossaryDlg begin
+
+void AbstarctSwSelGlossaryDlg_Impl::InsertGlos(const String &rRegion, const String &rGlosName)
+{
+ pDlg->InsertGlos( rRegion, rGlosName );
+}
+USHORT AbstarctSwSelGlossaryDlg_Impl::GetSelectedIdx() const
+{
+ return pDlg->GetSelectedIdx();
+}
+void AbstarctSwSelGlossaryDlg_Impl::SelectEntryPos(USHORT nIdx)
+{
+ pDlg->SelectEntryPos( nIdx );
+}
+
+//add for SwSelGlossaryDlg end
+
+//add for SwAutoFormatDlg begin
+
+void AbstractSwAutoFormatDlg_Impl::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const
+{
+ pDlg->FillAutoFmtOfIndex(rToFill);
+}
+//add for SwAutoFormatDlg end
+
+//add for SwFldDlg begin
+void AbstractSwFldDlg_Impl::SetCurPageId( USHORT nId )
+{
+ pDlg->SetCurPageId( nId );
+}
+
+const SfxItemSet* AbstractSwFldDlg_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+
+const USHORT* AbstractSwFldDlg_Impl::GetInputRanges(const SfxItemPool& pItem )
+{
+ return pDlg->GetInputRanges( pItem );
+}
+
+void AbstractSwFldDlg_Impl::SetInputSet( const SfxItemSet* pInSet )
+{
+ pDlg->SetInputSet( pInSet );
+}
+
+void AbstractSwFldDlg_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+String AbstractSwFldDlg_Impl::GetText() const
+{
+ return pDlg->GetText();
+}
+void AbstractSwFldDlg_Impl::Start( BOOL bShowl )
+{
+ pDlg->Start( bShowl );
+}
+
+void AbstractSwFldDlg_Impl::Initialize(SfxChildWinInfo *pInfo)
+{
+ pDlg->Initialize( pInfo );
+}
+
+void AbstractSwFldDlg_Impl::ReInitDlg()
+{
+ pDlg->ReInitDlg();
+}
+void AbstractSwFldDlg_Impl::ActivateDatabasePage()
+{
+ pDlg->ActivateDatabasePage();
+}
+Window* AbstractSwFldDlg_Impl::GetWindow()
+{
+ return (Window*)pDlg;
+}
+void AbstractSwFldDlg_Impl::ShowPage( USHORT nId )
+{
+ pDlg->ShowPage(nId);
+}
+//add for SwFldD end
+
+//add for SwRenameXNamedDlg begin
+
+void AbstractSwRenameXNamedDlg_Impl::SetForbiddenChars( const String& rSet )
+{
+ pDlg->SetForbiddenChars( rSet );
+}
+
+void AbstractSwRenameXNamedDlg_Impl::SetAlternativeAccess(
+ STAR_REFERENCE( container::XNameAccess ) & xSecond,
+ STAR_REFERENCE( container::XNameAccess ) & xThird )
+{
+ pDlg->SetAlternativeAccess( xSecond, xThird);
+}
+//add for SwRenameXNamedDlg end
+
+//add for SwModalRedlineAcceptDlg begin
+
+void AbstractSwModalRedlineAcceptDlg_Impl::AcceptAll( BOOL bAccept )
+{
+ pDlg->AcceptAll( bAccept);
+}
+//add for SwModalRedlineAcceptDlg end
+
+// AbstractGlossaryDlg_Impl begin
+String AbstractGlossaryDlg_Impl::GetCurrGrpName() const
+{
+ return pDlg->GetCurrGrpName();
+}
+
+String AbstractGlossaryDlg_Impl::GetCurrShortName() const
+{
+ return pDlg->GetCurrShortName();
+}
+// AbstractGlossaryDlg_Impl end
+
+// AbstractFldInputDlg_Impl begin
+void AbstractFldInputDlg_Impl::SetWindowState( const ByteString& rStr )
+{
+ pDlg->SetWindowState( rStr );
+}
+
+ByteString AbstractFldInputDlg_Impl::GetWindowState( ULONG nMask ) const
+{
+ return pDlg->GetWindowState( nMask );
+}
+// AbstractFldInputDlg_Impl end
+
+// AbstractInsFootNoteDlg_Impl begin
+String AbstractInsFootNoteDlg_Impl::GetFontName()
+{
+ return pDlg->GetFontName();
+}
+BOOL AbstractInsFootNoteDlg_Impl::IsEndNote()
+{
+ return pDlg->IsEndNote();
+}
+String AbstractInsFootNoteDlg_Impl::GetStr()
+{
+ return pDlg->GetStr();
+}
+void AbstractInsFootNoteDlg_Impl::SetHelpId( const rtl::OString& sHelpId )
+{
+ pDlg->SetHelpId( sHelpId );
+}
+void AbstractInsFootNoteDlg_Impl::SetText( const XubString& rStr )
+{
+ pDlg->SetText( rStr );
+}
+// AbstractInsFootNoteDlg_Impl end
+
+// AbstractInsertGrfRulerDlg_Impl begin
+String AbstractInsertGrfRulerDlg_Impl::GetGraphicName()
+{
+ return pDlg->GetGraphicName();
+}
+BOOL AbstractInsertGrfRulerDlg_Impl::IsSimpleLine()
+{
+ return pDlg->IsSimpleLine();
+}
+BOOL AbstractInsertGrfRulerDlg_Impl::HasImages() const
+{
+ return pDlg->HasImages();
+}
+// AbstractInsertGrfRulerDlg_Impl end
+
+// AbstractInsTableDlg_Impl begin
+void AbstractInsTableDlg_Impl::GetValues( String& rName, USHORT& rRow, USHORT& rCol,
+ SwInsertTableOptions& rInsTblFlags, String& rTableAutoFmtName,
+ SwTableAutoFmt *& prTAFmt )
+{
+ pDlg->GetValues( rName, rRow, rCol, rInsTblFlags, rTableAutoFmtName, prTAFmt);
+}
+// AbstractInsTableDlg_Impl end
+
+// AbstractJavaEditDialog_Impl begin
+String AbstractJavaEditDialog_Impl::GetText()
+{
+ return pDlg->GetText();
+}
+String AbstractJavaEditDialog_Impl::GetType()
+{
+ return pDlg->GetType();
+}
+BOOL AbstractJavaEditDialog_Impl::IsUrl()
+{
+ return pDlg->IsUrl();
+}
+BOOL AbstractJavaEditDialog_Impl::IsNew()
+{
+ return pDlg->IsNew();
+}
+BOOL AbstractJavaEditDialog_Impl::IsUpdate()
+{
+ return pDlg->IsUpdate();
+}
+// AbstractJavaEditDialog_Impl end
+
+// AbstractMailMergeDlg_Impl begin
+USHORT AbstractMailMergeDlg_Impl::GetMergeType()
+{
+ return pDlg->GetMergeType();
+}
+const ::rtl::OUString& AbstractMailMergeDlg_Impl::GetSaveFilter() const
+{
+ return pDlg->GetSaveFilter();
+}
+
+const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > AbstractMailMergeDlg_Impl::GetSelection() const
+{
+ return pDlg->GetSelection();
+}
+uno::Reference< sdbc::XResultSet> AbstractMailMergeDlg_Impl::GetResultSet() const
+{
+ return pDlg->GetResultSet();
+}
+// AbstractMailMergeDlg_Impl end
+// AbstractMailMergeCreateFromDlg_Impl begin
+BOOL AbstractMailMergeCreateFromDlg_Impl::IsThisDocument() const
+{
+ return pDlg->IsThisDocument();
+}
+// AbstractMailMergeCreateFromDlg_Impl end
+//AbstractMailMergeFieldConnectionsDlg_Impl begin
+BOOL AbstractMailMergeFieldConnectionsDlg_Impl::IsUseExistingConnections() const
+{
+ return pDlg->IsUseExistingConnections();
+}
+// AbstractMailMergeFieldConnectionsDlg_Impl end
+
+// AbstractMultiTOXTabDialog_Impl begin
+SwForm* AbstractMultiTOXTabDialog_Impl::GetForm(CurTOXType eType)
+{
+ return pDlg->GetForm(eType);
+}
+CurTOXType AbstractMultiTOXTabDialog_Impl::GetCurrentTOXType() const
+{
+ return pDlg->GetCurrentTOXType();
+}
+SwTOXDescription& AbstractMultiTOXTabDialog_Impl::GetTOXDescription(CurTOXType eTOXTypes)
+{
+ return pDlg->GetTOXDescription(eTOXTypes);
+}
+const SfxItemSet* AbstractMultiTOXTabDialog_Impl::GetOutputItemSet() const
+{
+ return pDlg->GetOutputItemSet();
+}
+// AbstractMultiTOXTabDialog_Impl end
+
+// AbstractEditRegionDlg_Impl begin
+void AbstractEditRegionDlg_Impl::SelectSection(const String& rSectionName)
+{
+ pDlg->SelectSection(rSectionName);
+}
+// AbstractEditRegionDlg_Impl end
+//AbstractInsertSectionTabDialog_Impl begin
+void
+AbstractInsertSectionTabDialog_Impl::SetSectionData(SwSectionData const& rSect)
+{
+ pDlg->SetSectionData(rSect);
+}
+// AbstractInsertSectionTabDialog_Impl end
+
+//AbstractIndexMarkFloatDlg_Impl begin
+void AbstractIndexMarkFloatDlg_Impl::ReInitDlg(SwWrtShell& rWrtShell)
+{
+ pDlg->ReInitDlg( rWrtShell);
+}
+Window* AbstractIndexMarkFloatDlg_Impl::GetWindow()
+{
+ return (Window*)pDlg;
+}
+// AbstractIndexMarkFloatDlg_Impl end
+
+//AbstractAuthMarkFloatDlg_Impl begin
+void AbstractAuthMarkFloatDlg_Impl::ReInitDlg(SwWrtShell& rWrtShell)
+{
+ pDlg->ReInitDlg( rWrtShell);
+}
+Window* AbstractAuthMarkFloatDlg_Impl::GetWindow()
+{
+ return (Window*)pDlg;
+}
+// AbstractAuthMarkFloatDlg_Impl end
+
+AbstractMailMergeWizard_Impl::~AbstractMailMergeWizard_Impl()
+{
+ delete pDlg;
+}
+
+void AbstractMailMergeWizard_Impl::StartExecuteModal( const Link& rEndDialogHdl )
+{
+ aEndDlgHdl = rEndDialogHdl;
+ pDlg->StartExecuteModal(
+ LINK( this, AbstractMailMergeWizard_Impl, EndDialogHdl ) );
+}
+
+long AbstractMailMergeWizard_Impl::GetResult()
+{
+ return pDlg->GetResult();
+}
+
+#ifdef DBG_UTIL
+IMPL_LINK( AbstractMailMergeWizard_Impl, EndDialogHdl, SwMailMergeWizard*, pDialog )
+#else
+IMPL_LINK( AbstractMailMergeWizard_Impl, EndDialogHdl, SwMailMergeWizard*, EMPTYARG )
+#endif
+{
+ DBG_ASSERT( pDialog == pDlg, "wrong dialog passed to EndDialogHdl!" );
+
+ aEndDlgHdl.Call( this );
+ aEndDlgHdl = Link();
+
+ return 0L;
+}
+
+void AbstractMailMergeWizard_Impl::SetReloadDocument(const String& rURL)
+{
+ pDlg->SetReloadDocument(rURL);
+}
+const String& AbstractMailMergeWizard_Impl::GetReloadDocument() const
+{
+ return pDlg->GetReloadDocument();
+}
+BOOL AbstractMailMergeWizard_Impl::ShowPage( USHORT nLevel )
+{
+ return pDlg->skipUntil(nLevel);
+}
+sal_uInt16 AbstractMailMergeWizard_Impl::GetRestartPage() const
+{
+ return pDlg->GetRestartPage();
+}
+
+//-------------- SwAbstractDialogFactory implementation--------------
+
+AbstractSwWordCountDialog* SwAbstractDialogFactory_Impl::CreateSwWordCountDialog(Window* pParent)
+{
+ SwWordCountDialog* pDlg = new SwWordCountDialog( pParent );
+ return new AbstractSwWordCountDialog_Impl( pDlg );
+}
+
+//add for SwInsertAbstractDlg begin
+AbstractSwInsertAbstractDlg * SwAbstractDialogFactory_Impl::CreateSwInsertAbstractDlg( Window* pParent,
+ int nResId )
+{
+ SwInsertAbstractDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_INSERT_ABSTRACT :
+ pDlg = new SwInsertAbstractDlg( pParent);
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSwInsertAbstractDlg_Impl( pDlg );
+ return 0;
+}
+//add for SwInsertAbstractDlg end
+
+SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSfxDialog( Window* pParent,
+ const SfxItemSet& rSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&,
+ sal_uInt32 nResId
+ )
+{
+ SfxModalDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RC_DLG_ADDR :
+ pDlg = new SwAddrDlg( pParent, rSet );
+ break;
+ case DLG_SWDROPCAPS :
+ pDlg = new SwDropCapsDlg( pParent, rSet );
+ break;
+ case RC_SWDLG_BACKGROUND :
+ pDlg = new SwBackgroundDlg( pParent, rSet );
+ break;
+ case RC_DLG_SWNUMFMTDLG :
+ pDlg = new SwNumFmtDlg( pParent, rSet );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSfxDialog_Impl( pDlg );
+ return 0;
+}
+
+// add for SwAsciiFilterDlg begin
+AbstractSwAsciiFilterDlg* SwAbstractDialogFactory_Impl::CreateSwAsciiFilterDlg( Window* pParent,
+ SwDocShell& rDocSh,
+ SvStream* pStream,
+ int nResId )
+{
+ SwAsciiFilterDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_ASCII_FILTER :
+ pDlg = new SwAsciiFilterDlg( pParent, rDocSh, pStream );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSwAsciiFilterDlg_Impl( pDlg );
+ return 0;
+}
+
+//add for SwAsciiFilterDlg end
+
+// add for SwInsertBookmarkDlg begin
+VclAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwInsertBookmarkDlg( Window *pParent,
+ SwWrtShell &rSh,
+ SfxRequest& rReq,
+ int nResId )
+{
+ Dialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_INSERT_BOOKMARK :
+ pDlg = new SwInsertBookmarkDlg( pParent, rSh, rReq );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+
+//add for SwInsertBookmarkDlg end
+
+//add for SwBreakDlg begin
+
+AbstractSwBreakDlg * SwAbstractDialogFactory_Impl::CreateSwBreakDlg ( Window *pParent,
+ SwWrtShell &rSh,
+ int nResId )
+{
+ SwBreakDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_BREAK :
+ pDlg = new SwBreakDlg( pParent, rSh );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSwBreakDlg_Impl( pDlg );
+ return 0;
+}
+//add for SwBreakDlg end
+
+// add for SwChangeDBDlg begin
+VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwChangeDBDlg( SwView& rVw, int nResId )
+{
+ Dialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_CHANGE_DB :
+ pDlg = new SwChangeDBDlg( rVw );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+
+// add for SwChangeDBDlg end
+
+// add for SwCharDlg begin
+SfxAbstractTabDialog * SwAbstractDialogFactory_Impl::CreateSwCharDlg(Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, int nResId, // add for SwCharDlg
+ const String* pFmtStr , BOOL bIsDrwTxtDlg )
+{
+
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_CHAR :
+ pDlg = new SwCharDlg( pParent, pVw, rCoreSet, pFmtStr, bIsDrwTxtDlg );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+
+}
+// add for SwCharDlg end
+
+//add for SwConvertTableDlg begin
+AbstractSwConvertTableDlg* SwAbstractDialogFactory_Impl::CreateSwConvertTableDlg (
+ SwView& rView,int nResId, bool bToTable )
+{
+ SwConvertTableDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_CONV_TEXT_TABLE :
+ pDlg = new SwConvertTableDlg( rView, bToTable );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSwConvertTableDlg_Impl( pDlg );
+ return 0;
+}
+
+//add for SwConvertTableDlg end
+
+//add for SwCaptionDialog begin
+VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwCaptionDialog ( Window *pParent, SwView &rV,int nResId)
+{
+ Dialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_CAPTION :
+ pDlg = new SwCaptionDialog( pParent, rV );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+//add for SwCaptionDialog end
+
+//add for SwInsertDBColAutoPilot begin
+
+AbstractSwInsertDBColAutoPilot* SwAbstractDialogFactory_Impl::CreateSwInsertDBColAutoPilot( SwView& rView, // add for SwInsertDBColAutoPilot
+ uno::Reference< sdbc::XDataSource> rxSource,
+ uno::Reference<sdbcx::XColumnsSupplier> xColSupp,
+ const SwDBData& rData, int nResId)
+{
+ SwInsertDBColAutoPilot* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_AP_INSERT_DB_SEL :
+ pDlg = new SwInsertDBColAutoPilot( rView, rxSource, xColSupp, rData );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSwInsertDBColAutoPilot_Impl( pDlg );
+ return 0;
+}
+//add for SwInsertDBColAutoPilot end
+//add for SwFootNoteOptionDlg begin
+SfxAbstractTabDialog * SwAbstractDialogFactory_Impl::CreateSwFootNoteOptionDlg( Window *pParent, SwWrtShell &rSh,int nResId)
+{
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_DOC_FOOTNOTE :
+ pDlg = new SwFootNoteOptionDlg( pParent, rSh );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+}
+//add for SwFootNoteOptionDlg begin
+
+
+//add for DropDownFieldDialog begin
+
+AbstractDropDownFieldDialog * SwAbstractDialogFactory_Impl::CreateDropDownFieldDialog ( Window *pParent, SwWrtShell &rSh, //add for DropDownFieldDialog
+ SwField* pField,int nResId, BOOL bNextButton )
+{
+ sw::DropDownFieldDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_FLD_DROPDOWN :
+ pDlg = new sw::DropDownFieldDialog( pParent, rSh, pField, bNextButton );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractDropDownFieldDialog_Impl( pDlg );
+ return 0;
+}
+//add for DropDownFieldDialog end
+
+//add for SwEnvDlg begin
+SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwEnvDlg ( Window* pParent, const SfxItemSet& rSet,
+ SwWrtShell* pWrtSh, Printer* pPrt,
+ BOOL bInsert,int nResId ) //add for SwEnvDlg
+{
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_ENV :
+ pDlg = new SwEnvDlg( pParent, rSet, pWrtSh,pPrt, bInsert );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+}
+//add for SwEnvDlg end
+
+//add for SwLabDlg begin
+
+AbstarctSwLabDlg* SwAbstractDialogFactory_Impl::CreateSwLabDlg ( Window* pParent, const SfxItemSet& rSet, //add for SwLabDlg
+ SwNewDBMgr* pNewDBMgr, BOOL bLabel,int nResId )
+{
+ SwLabDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_LAB :
+ pDlg = new SwLabDlg( pParent, rSet, pNewDBMgr,bLabel );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstarctSwLabDlg_Impl( pDlg );
+ return 0;
+}
+
+SwLabDlgMethod SwAbstractDialogFactory_Impl::GetSwLabDlgStaticMethod ()
+{
+ return SwLabDlg::UpdateFieldInformation;
+}
+
+//add for SwLabDlg end
+
+//add for SwParaDlg begin
+SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwParaDlg ( Window *pParent, SwView& rVw,
+ const SfxItemSet& rCoreSet ,
+ BYTE nDialogMode,
+ int nResId,
+ const String *pCollName,
+ BOOL bDraw , UINT16 nDefPage)
+{
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_DRAWPARA :
+ case DLG_PARA :
+ pDlg = new SwParaDlg( pParent, rVw, rCoreSet,nDialogMode, pCollName, bDraw, nDefPage );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+}
+//add for SwParaDlg end
+
+//add for SwTableHeightDlg SwSortDlg begin
+VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateVclAbstractDialog ( Window *pParent, SwWrtShell &rSh, int nResId )
+{
+ Dialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_ROW_HEIGHT :
+ pDlg = new SwTableHeightDlg( pParent, rSh);
+ break;
+
+ case DLG_SORTING :
+ pDlg = new SwSortDlg( pParent, rSh);
+ break;
+ case DLG_COLUMN :
+ pDlg = new SwColumnDlg( pParent, rSh );
+ break;
+ case DLG_EDIT_AUTHMARK :
+ pDlg = new SwAuthMarkModalDlg( pParent, rSh );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+//add for SwTableHeightDlg SwSortDlg ,end
+//add for SwSplitTblDlg begin
+AbstractSplitTableDialog * SwAbstractDialogFactory_Impl::CreateSplitTblDialog ( Window *pParent, SwWrtShell &rSh )
+{
+ return new AbstractSplitTableDialog_Impl( new SwSplitTblDlg( pParent, rSh) );
+}
+//add SwSplitTblDlg end
+
+//add for SwSelGlossaryDlg begin
+AbstarctSwSelGlossaryDlg * SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg ( Window * pParent, const String &rShortName, int nResId )
+{
+ SwSelGlossaryDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_SEL_GLOS :
+ pDlg = new SwSelGlossaryDlg( pParent, rShortName);
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstarctSwSelGlossaryDlg_Impl( pDlg );
+ return 0;
+}
+
+//add for SwSelGlossaryDlg end
+
+//add for SwAutoFormatDlg begin
+AbstractSwAutoFormatDlg * SwAbstractDialogFactory_Impl::CreateSwAutoFormatDlg( Window* pParent, SwWrtShell* pShell,
+ int nResId,
+ BOOL bSetAutoFmt,
+ const SwTableAutoFmt* pSelFmt )
+{
+ SwAutoFormatDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_AUTOFMT_TABLE :
+ pDlg = new SwAutoFormatDlg( pParent, pShell,bSetAutoFmt,pSelFmt);
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSwAutoFormatDlg_Impl( pDlg );
+ return 0;
+}
+//add for SwAutoFormatDlg end
+
+//add for SwBorderDlg begin
+SfxAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwBorderDlg (Window* pParent, SfxItemSet& rSet, USHORT nType,int nResId )
+{
+ SfxModalDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RC_DLG_SWBORDERDLG :
+ pDlg = new SwBorderDlg( pParent, rSet, nType );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSfxDialog_Impl( pDlg );
+ return 0;
+}
+//add for SwBorderDlg end
+
+//add for SwWrapDlg begin
+SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwWrapDlg ( Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, BOOL bDrawMode, int nResId )
+{
+ SfxModalDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RC_DLG_SWWRAPDLG :
+ pDlg = new SwWrapDlg( pParent, rSet, pSh, bDrawMode );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSfxDialog_Impl( pDlg );
+ return 0;
+}
+//add for SwWrapDlg end
+
+//add for SwTableWidthDlg begin
+VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwTableWidthDlg ( Window *pParent, SwTableFUNC &rFnc , int nResId )
+{
+ Dialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_COL_WIDTH :
+ pDlg = new SwTableWidthDlg( pParent, rFnc);
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+//add for SwTableWidthDlg end
+
+ //add for SwTableTabDlg begin
+SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwTableTabDlg( Window* pParent, SfxItemPool& Pool,
+ const SfxItemSet* pItemSet, SwWrtShell* pSh,int nResId )
+{
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_FORMAT_TABLE :
+ pDlg = new SwTableTabDlg( pParent, Pool, pItemSet,pSh );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+}
+ //add for SwTableTabDlg end
+
+//add for SwFldDlg begin
+AbstractSwFldDlg * SwAbstractDialogFactory_Impl::CreateSwFldDlg ( SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent, int nResId )
+{
+ SwFldDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_FLD_INSERT :
+ pDlg = new SwFldDlg( pB, pCW,pParent);
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSwFldDlg_Impl( pDlg );
+ return 0;
+}
+//add for SwFldDlg end
+
+//add for SwFldEditDlg begin
+SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwFldEditDlg ( SwView& rVw, int nResId )
+{
+ SfxModalDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case RC_DLG_SWFLDEDITDLG :
+ pDlg = new SwFldEditDlg( rVw );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSfxDialog_Impl( pDlg );
+ return 0;
+}
+//add for SwFldEditDlg
+
+//add for SwRenameXNamedDlg begin
+AbstractSwRenameXNamedDlg * SwAbstractDialogFactory_Impl::CreateSwRenameXNamedDlg( Window* pParent,
+ STAR_REFERENCE( container::XNamed ) & xNamed,
+ STAR_REFERENCE( container::XNameAccess ) & xNameAccess,int nResId )
+{
+ SwRenameXNamedDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_RENAME_XNAMED :
+ pDlg = new SwRenameXNamedDlg( pParent,xNamed, xNameAccess);
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSwRenameXNamedDlg_Impl( pDlg );
+ return 0;
+}
+
+//add for SwRenameXNamedDlg end
+
+//add for SwModalRedlineAcceptDlg begin
+AbstractSwModalRedlineAcceptDlg * SwAbstractDialogFactory_Impl::CreateSwModalRedlineAcceptDlg ( Window *pParent, int nResId )
+{
+ SwModalRedlineAcceptDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_MOD_REDLINE_ACCEPT :
+ pDlg = new SwModalRedlineAcceptDlg( pParent );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractSwModalRedlineAcceptDlg_Impl( pDlg );
+ return 0;
+}
+//add for SwModalRedlineAcceptDlg end
+
+VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwVclDialog( int nResId,
+ Window* pParent, BOOL& rWithPrev ) //add for SwMergeTblDlg
+{
+ Dialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_MERGE_TABLE :
+ pDlg = new SwMergeTblDlg( pParent, rWithPrev );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateFrmTabDialog( int nResId,
+ SfxViewFrame *pFrame, Window *pParent,
+ const SfxItemSet& rCoreSet,
+ BOOL bNewFrm,
+ USHORT nResType,
+ BOOL bFmt,
+ UINT16 nDefPage,
+ const String* pFmtStr ) //add for SwFrmDlg
+{
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_FRM_GRF :
+ case DLG_FRM_OLE :
+ case DLG_FRM_STD :
+ pDlg = new SwFrmDlg( pFrame, pParent, rCoreSet, bNewFrm, nResType, bFmt, nDefPage, pFmtStr );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+}
+
+SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateTemplateDialog( int nResId,
+ Window* pParent,
+ SfxStyleSheetBase& rBase,
+ USHORT nRegion,
+ BOOL bColumn,
+ SwWrtShell* pActShell,
+ BOOL bNew ) //add for SwTemplateDlg
+{
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_TEMPLATE_BASE :
+ pDlg = new SwTemplateDlg( pParent, rBase, nRegion, bColumn, pActShell, bNew );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+}
+
+AbstractGlossaryDlg* SwAbstractDialogFactory_Impl::CreateGlossaryDlg( int nResId,
+ SfxViewFrame* pViewFrame,
+ SwGlossaryHdl* pGlosHdl,
+ SwWrtShell *pWrtShell) //add for SwGlossaryDlg
+{
+ SwGlossaryDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_RENAME_GLOS :
+ pDlg = new SwGlossaryDlg( pViewFrame, pGlosHdl, pWrtShell );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new AbstractGlossaryDlg_Impl( pDlg );
+ return 0;
+}
+
+AbstractFldInputDlg* SwAbstractDialogFactory_Impl::CreateFldInputDlg( int nResId,
+ Window *pParent, SwWrtShell &rSh,
+ SwField* pField, BOOL bNextButton ) //add for SwFldInputDlg
+{
+ SwFldInputDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_FLD_INPUT :
+ pDlg = new SwFldInputDlg( pParent, rSh, pField, bNextButton );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new AbstractFldInputDlg_Impl( pDlg );
+ return 0;
+}
+
+AbstractInsFootNoteDlg* SwAbstractDialogFactory_Impl::CreateInsFootNoteDlg( int nResId,
+ Window * pParent, SwWrtShell &rSh, BOOL bEd ) //add for SwInsFootNoteDlg
+{
+ SwInsFootNoteDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_INS_FOOTNOTE :
+ pDlg = new SwInsFootNoteDlg( pParent, rSh, bEd );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new AbstractInsFootNoteDlg_Impl( pDlg );
+ return 0;
+}
+
+VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateVclSwViewDialog( int nResId,
+ SwView& rView, BOOL /*bCol*/ ) //add for SwInsRowColDlg, SwLineNumberingDlg
+{
+ Dialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_LINE_NUMBERING :
+ pDlg = new SwLineNumberingDlg( &rView );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+
+AbstractInsertGrfRulerDlg * SwAbstractDialogFactory_Impl::CreateInsertGrfRulerDlg( int nResId,
+ Window * pParent ) //add for SwInsertGrfRulerDlg
+{
+ SwInsertGrfRulerDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_INSERT_RULER :
+ pDlg = new SwInsertGrfRulerDlg( pParent );
+ break;
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new AbstractInsertGrfRulerDlg_Impl( pDlg );
+ return 0;
+}
+
+AbstractInsTableDlg * SwAbstractDialogFactory_Impl::CreateInsTableDlg( int nResId,
+ SwView& rView ) //add for SwInsTableDlg
+{
+ SwInsTableDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_INSERT_TABLE :
+ pDlg = new SwInsTableDlg( rView );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new AbstractInsTableDlg_Impl( pDlg );
+ return 0;
+}
+
+AbstractJavaEditDialog * SwAbstractDialogFactory_Impl::CreateJavaEditDialog( int nResId,
+ Window* pParent, SwWrtShell* pWrtSh ) //add for SwJavaEditDialog
+{
+ SwJavaEditDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_JAVAEDIT :
+ pDlg = new SwJavaEditDialog( pParent, pWrtSh );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new AbstractJavaEditDialog_Impl( pDlg );
+ return 0;
+}
+
+AbstractMailMergeDlg * SwAbstractDialogFactory_Impl::CreateMailMergeDlg( int nResId,
+ Window* pParent, SwWrtShell& rSh,
+ const String& rSourceName,
+ const String& rTblName,
+ sal_Int32 nCommandType,
+ const uno::Reference< sdbc::XConnection>& xConnection,
+ uno::Sequence< uno::Any >* pSelection ) //add for SwMailMergeDlg
+{
+ SwMailMergeDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_MAILMERGE :
+ pDlg = new SwMailMergeDlg( pParent, rSh, rSourceName, rTblName, nCommandType, xConnection, pSelection );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new AbstractMailMergeDlg_Impl( pDlg );
+ return 0;
+}
+AbstractMailMergeCreateFromDlg * SwAbstractDialogFactory_Impl::CreateMailMergeCreateFromDlg( int nResId,
+ Window* pParent ) //add for SwMailMergeCreateFromDlg
+{
+ SwMailMergeCreateFromDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_MERGE_CREATE :
+ pDlg = new SwMailMergeCreateFromDlg( pParent );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new AbstractMailMergeCreateFromDlg_Impl( pDlg );
+ return 0;
+}
+AbstractMailMergeFieldConnectionsDlg * SwAbstractDialogFactory_Impl::CreateMailMergeFieldConnectionsDlg( int nResId,
+ Window* pParent ) //add for SwMailMergeFieldConnectionsDlg
+{
+ SwMailMergeFieldConnectionsDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_MERGE_FIELD_CONNECTIONS :
+ pDlg = new SwMailMergeFieldConnectionsDlg( pParent );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new AbstractMailMergeFieldConnectionsDlg_Impl( pDlg );
+ return 0;
+}
+
+VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateMultiTOXMarkDlg( int nResId,
+ Window* pParent, SwTOXMgr &rTOXMgr ) //add for SwMultiTOXMarkDlg
+{
+ Dialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_MULTMRK :
+ pDlg = new SwMultiTOXMarkDlg( pParent, rTOXMgr );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwTabDialog( int nResId,
+ Window* pParent,
+ const SfxItemSet* pSwItemSet,
+ SwWrtShell & rWrtSh ) //add for SwSvxNumBulletTabDialog, SwOutlineTabDialog
+{
+ SfxTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_SVXTEST_NUM_BULLET :
+ pDlg = new SwSvxNumBulletTabDialog( pParent, pSwItemSet, rWrtSh );
+ break;
+ case DLG_TAB_OUTLINE :
+ pDlg = new SwOutlineTabDialog( pParent, pSwItemSet, rWrtSh );
+ break;
+
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new AbstractTabDialog_Impl( pDlg );
+ return 0;
+}
+AbstractMultiTOXTabDialog * SwAbstractDialogFactory_Impl::CreateMultiTOXTabDialog( int nResId,
+ Window* pParent, const SfxItemSet& rSet,
+ SwWrtShell &rShell,
+ SwTOXBase* pCurTOX, USHORT nToxType,
+ BOOL bGlobal ) //add for SwMultiTOXTabDialog
+{
+ SwMultiTOXTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_MULTI_TOX :
+ pDlg = new SwMultiTOXTabDialog( pParent, rSet, rShell, pCurTOX, nToxType, bGlobal );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new AbstractMultiTOXTabDialog_Impl( pDlg );
+ return 0;
+}
+AbstractEditRegionDlg * SwAbstractDialogFactory_Impl::CreateEditRegionDlg( int nResId,
+ Window* pParent, SwWrtShell& rWrtSh ) //add for SwEditRegionDlg
+{
+ SwEditRegionDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case MD_EDIT_REGION :
+ pDlg = new SwEditRegionDlg( pParent, rWrtSh );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new AbstractEditRegionDlg_Impl( pDlg );
+ return 0;
+}
+AbstractInsertSectionTabDialog * SwAbstractDialogFactory_Impl::CreateInsertSectionTabDialog( int nResId,
+ Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh) //add for SwInsertSectionTabDialog
+{
+ SwInsertSectionTabDialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_INSERT_SECTION :
+ pDlg = new SwInsertSectionTabDialog( pParent, rSet, rSh );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new AbstractInsertSectionTabDialog_Impl( pDlg );
+ return 0;
+}
+
+AbstractMarkFloatDlg * SwAbstractDialogFactory_Impl::CreateIndexMarkFloatDlg( int nResId,
+ SfxBindings* pBindings,
+ SfxChildWindow* pChild,
+ Window *pParent,
+ SfxChildWinInfo* pInfo,
+ sal_Bool bNew ) //add for SwIndexMarkFloatDlg
+{
+ SwIndexMarkFloatDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_INSIDXMARK_CJK :
+ case DLG_INSIDXMARK :
+ pDlg = new SwIndexMarkFloatDlg( pBindings, pChild, pParent, pInfo, bNew );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new AbstractIndexMarkFloatDlg_Impl( pDlg );
+ return 0;
+}
+
+AbstractMarkFloatDlg * SwAbstractDialogFactory_Impl::CreateAuthMarkFloatDlg( int nResId,
+ SfxBindings* pBindings,
+ SfxChildWindow* pChild,
+ Window *pParent,
+ SfxChildWinInfo* pInfo,
+ sal_Bool bNew ) //add for SwAuthMarkFloatDlg
+{
+ SwAuthMarkFloatDlg* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_INSAUTHMARK :
+ pDlg = new SwAuthMarkFloatDlg( pBindings, pChild, pParent, pInfo, bNew );
+ break;
+ default:
+ break;
+ }
+ if ( pDlg )
+ return new AbstractAuthMarkFloatDlg_Impl( pDlg );
+ return 0;
+}
+
+//add for SwIndexMarkModalDlg begin
+VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateIndexMarkModalDlg( int nResId,
+ Window *pParent, SwWrtShell& rSh, SwTOXMark* pCurTOXMark ) //add for SwIndexMarkModalDlg
+{
+ Dialog* pDlg=NULL;
+ switch ( nResId )
+ {
+ case DLG_EDIT_IDXMARK_CJK :
+ case DLG_EDIT_IDXMARK :
+ pDlg = new SwIndexMarkModalDlg( pParent, rSh, pCurTOXMark );
+ break;
+
+ default:
+ break;
+ }
+
+ if ( pDlg )
+ return new VclAbstractDialog_Impl( pDlg );
+ return 0;
+}
+//add for SwIndexMarkModalDlg end
+AbstractMailMergeWizard* SwAbstractDialogFactory_Impl::CreateMailMergeWizard(
+ SwView& rView, SwMailMergeConfigItem& rConfigItem)
+{
+ return new AbstractMailMergeWizard_Impl( new SwMailMergeWizard(rView, rConfigItem));
+}
+
+//add for static func in SwGlossaryDlg
+GlossaryGetCurrGroup SwAbstractDialogFactory_Impl::GetGlossaryCurrGroupFunc( USHORT nId )
+{
+ switch ( nId )
+ {
+ case DLG_RENAME_GLOS :
+ return SwGlossaryDlg::GetCurrGroup;
+ default:
+ break;
+ }
+ return 0;
+}
+GlossarySetActGroup SwAbstractDialogFactory_Impl::SetGlossaryActGroupFunc( USHORT nId )
+{
+ switch ( nId )
+ {
+ case DLG_RENAME_GLOS :
+ return SwGlossaryDlg::SetActGroup;
+ default:
+ break;
+ }
+ return 0;
+}
+
+//------------------ Factories for TabPages
+CreateTabPage SwAbstractDialogFactory_Impl::GetTabPageCreatorFunc( USHORT nId )
+{
+ CreateTabPage pRet = 0;
+ switch ( nId )
+ {
+ case TP_OPTCOMPATIBILITY_PAGE :
+ case RID_SW_TP_OPTCOMPATIBILITY_PAGE :
+ pRet = SwCompatibilityOptPage::Create;
+ break;
+ case TP_OPTLOAD_PAGE :
+ case RID_SW_TP_OPTLOAD_PAGE :
+ pRet = SwLoadOptPage::Create;
+ break;
+ case TP_OPTCAPTION_PAGE:
+ case RID_SW_TP_OPTCAPTION_PAGE:
+ return SwCaptionOptPage::Create;
+ case TP_CONTENT_OPT :
+ case RID_SW_TP_CONTENT_OPT:
+ case RID_SW_TP_HTML_CONTENT_OPT:
+ pRet = SwContentOptPage::Create;
+ break;
+ case TP_OPTSHDWCRSR :
+ case RID_SW_TP_OPTSHDWCRSR:
+ case RID_SW_TP_HTML_OPTSHDWCRSR:
+ pRet = SwShdwCrsrOptionsTabPage::Create;
+ break;
+ case RID_SW_TP_REDLINE_OPT :
+ case TP_REDLINE_OPT :
+ pRet = SwRedlineOptionsTabPage::Create;
+ break;
+ case RID_SW_TP_OPTTEST_PAGE :
+ case TP_OPTTEST_PAGE :
+#ifdef DBG_UTIL
+ pRet = SwTestTabPage::Create;
+#endif
+ break;
+ case TP_OPTPRINT_PAGE :
+ case RID_SW_TP_HTML_OPTPRINT_PAGE:
+ case RID_SW_TP_OPTPRINT_PAGE:
+ pRet = SwAddPrinterTabPage::Create;
+ break;
+ case TP_STD_FONT :
+ case RID_SW_TP_STD_FONT:
+ case RID_SW_TP_STD_FONT_CJK:
+ case RID_SW_TP_STD_FONT_CTL:
+ pRet = SwStdFontTabPage::Create;
+ break;
+ case TP_OPTTABLE_PAGE :
+ case RID_SW_TP_HTML_OPTTABLE_PAGE:
+ case RID_SW_TP_OPTTABLE_PAGE:
+ pRet = SwTableOptionsTabPage::Create;
+ break;
+ case TP_DOC_STAT :
+ pRet = SwDocStatPage::Create;
+ break;
+ case RID_SW_TP_MAILCONFIG:
+ pRet = SwMailConfigPage::Create;
+ break;
+ }
+
+ return pRet;
+}
+
+GetTabPageRanges SwAbstractDialogFactory_Impl::GetTabPageRangesFunc( USHORT nId )
+{
+ switch ( nId )
+ {
+ case 1 : //RID_SVXPAGE_TEXTANIMATION :
+ //return SvxTextAnimationPage::GetRanges;
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
new file mode 100644
index 000000000000..c8c19d5bcc0b
--- /dev/null
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -0,0 +1,584 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_DLGFACT_HXX
+#define _SW_DLGFACT_HXX
+
+// include ---------------------------------------------------------------
+#include "swabstdlg.hxx"
+
+class SwSaveLabelDlg;
+class SwInsertAbstractDlg;
+class SfxSingleTabDialog;
+class SwAsciiFilterDlg;
+class Dialog;
+class SwBreakDlg;
+class SfxTabDialog;
+class SwConvertTableDlg;
+class SwInsertDBColAutoPilot;
+class SwLabDlg;
+class SwSelGlossaryDlg;
+class SwAutoFormatDlg;
+class SwFldDlg;
+class SwRenameXNamedDlg;
+class SwModalRedlineAcceptDlg;
+class SwTOXMark;
+class SwWordCountDialog;
+class SwSplitTblDlg;
+
+#include "itabenum.hxx"
+
+namespace sw
+{
+class DropDownFieldDialog;
+}
+
+#define DECL_ABSTDLG_BASE(Class,DialogClass) \
+ DialogClass* pDlg; \
+public: \
+ Class( DialogClass* p) \
+ : pDlg(p) \
+ {} \
+ virtual ~Class(); \
+ virtual short Execute() ;
+// virtual void Show( BOOL bVisible = TRUE, USHORT nFlags = 0 )
+
+#define IMPL_ABSTDLG_BASE(Class) \
+Class::~Class() \
+{ \
+ delete pDlg; \
+} \
+short Class::Execute() \
+{ \
+ return pDlg->Execute(); \
+}
+
+
+class AbstractSwWordCountDialog_Impl : public AbstractSwWordCountDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSwWordCountDialog_Impl,SwWordCountDialog)
+ void SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc);
+};
+
+//add for SwInsertAbstractDlg begin
+class AbstractSwInsertAbstractDlg_Impl : public AbstractSwInsertAbstractDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl,SwInsertAbstractDlg)
+ virtual BYTE GetLevel() const ;
+ virtual BYTE GetPara() const ;
+};
+
+//add for SwInsertAbstractDlg end
+
+// add for SwAddrDlg, SwDropCapsDlg, SwBackgroundDlg SwNumFmtDlg SwWrapDlg SwBorderDlg, SwFldEditDlg begin
+class SfxSingleTabDialog;
+class AbstractSfxDialog_Impl :public SfxAbstractDialog
+{
+ DECL_ABSTDLG_BASE(AbstractSfxDialog_Impl,SfxModalDialog)
+ virtual const SfxItemSet* GetOutputItemSet() const;
+ virtual void SetText( const XubString& rStr );
+ virtual String GetText() const;
+};
+// add for SwAddrDlg,SwDropCapsDlg , SwBackgroundDlg SwNumFmtDlg SwWrapDlg SwBorderDlg, SwFldEditDlg end
+
+// add for SwAsciiFilterDlg begin
+class AbstractSwAsciiFilterDlg_Impl : public AbstractSwAsciiFilterDlg
+{
+ DECL_ABSTDLG_BASE( AbstractSwAsciiFilterDlg_Impl,SwAsciiFilterDlg )
+ virtual void FillOptions( SwAsciiOptions& rOptions );
+
+};
+// add for SwAsciiFilterDlg end
+
+// add for SwInsertBookmarkDlg SwChangeDBDlg, SwTableHeightDlg, SwSplitTblDlg SwSortDlg SwTableWidthDlgbegin
+class VclAbstractDialog_Impl : public VclAbstractDialog
+{
+ DECL_ABSTDLG_BASE(VclAbstractDialog_Impl,Dialog)
+};
+// add for SwInsertBookmarkDlg SwChangeDBDlg, SwTableHeightDlg SwSplitTblDlg SwSortDlg SwTableWidthDlg end
+
+// add for SwBreakDlg begin
+class AbstractSwBreakDlg_Impl : public AbstractSwBreakDlg // add for SwBreakDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSwBreakDlg_Impl,SwBreakDlg)
+ virtual String GetTemplateName();
+ virtual USHORT GetKind();
+ virtual USHORT GetPageNumber();
+
+};
+class AbstractSplitTableDialog_Impl : public AbstractSplitTableDialog // add for
+{
+ DECL_ABSTDLG_BASE(AbstractSplitTableDialog_Impl, SwSplitTblDlg)
+ virtual sal_uInt16 GetSplitMode();
+};
+
+// add for SwBreakDlg end
+
+//add for SwCharDlg , SwEnvDlg , SwFootNoteOptionDlg SwParaDlg SwTableTabDlg begin
+class AbstractTabDialog_Impl : public SfxAbstractTabDialog
+{
+ DECL_ABSTDLG_BASE( AbstractTabDialog_Impl,SfxTabDialog )
+ virtual void SetCurPageId( USHORT nId );
+ virtual const SfxItemSet* GetOutputItemSet() const;
+ virtual const USHORT* GetInputRanges( const SfxItemPool& pItem );
+ virtual void SetInputSet( const SfxItemSet* pInSet );
+ //From class Window.
+ virtual void SetText( const XubString& rStr );
+ virtual String GetText() const;
+};
+//add for SwCharDlg, SwEnvDlg ,SwFootNoteOptionDlg SwParaDlg SwTableTabDlg end
+
+//add for SwConvertTableDlg begin
+class AbstractSwConvertTableDlg_Impl : public AbstractSwConvertTableDlg // add for SwConvertTableDlg
+{
+ DECL_ABSTDLG_BASE( AbstractSwConvertTableDlg_Impl,SwConvertTableDlg)
+ virtual void GetValues( sal_Unicode& rDelim,SwInsertTableOptions& rInsTblFlags,
+ SwTableAutoFmt *& prTAFmt );
+};
+//add for SwConvertTableDlg end
+
+//add for SwInsertDBColAutoPilot begin
+class AbstractSwInsertDBColAutoPilot_Impl : public AbstractSwInsertDBColAutoPilot // add for SwInsertDBColAutoPilot
+{
+ DECL_ABSTDLG_BASE( AbstractSwInsertDBColAutoPilot_Impl,SwInsertDBColAutoPilot)
+ virtual void DataToDoc( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConnection,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet);
+};
+//add for SwInsertDBColAutoPilot end
+
+//add for DropDownFieldDialog begin
+class AbstractDropDownFieldDialog_Impl : public AbstractDropDownFieldDialog //add for DropDownFieldDialog
+{
+ DECL_ABSTDLG_BASE(AbstractDropDownFieldDialog_Impl, sw::DropDownFieldDialog)
+ virtual ByteString GetWindowState( ULONG nMask = WINDOWSTATE_MASK_ALL ) const; //this method inherit from SystemWindow
+ virtual void SetWindowState( const ByteString& rStr );//this method inherit from SystemWindow
+};
+//add for DropDownFieldDialog end
+
+
+class AbstarctSwLabDlg_Impl : public AbstarctSwLabDlg
+{
+ DECL_ABSTDLG_BASE(AbstarctSwLabDlg_Impl,SwLabDlg)
+ virtual void SetCurPageId( USHORT nId );
+ virtual const SfxItemSet* GetOutputItemSet() const;
+ virtual const USHORT* GetInputRanges( const SfxItemPool& pItem );
+ virtual void SetInputSet( const SfxItemSet* pInSet );
+ //From class Window.
+ virtual void SetText( const XubString& rStr );
+ virtual String GetText() const;
+ virtual const String& GetBusinessCardStr() const;
+ virtual Printer *GetPrt();
+};
+//add for SwLabDlg end
+
+//add for SwSelGlossaryDlg begin
+class AbstarctSwSelGlossaryDlg_Impl : public AbstarctSwSelGlossaryDlg
+{
+ DECL_ABSTDLG_BASE(AbstarctSwSelGlossaryDlg_Impl,SwSelGlossaryDlg)
+ virtual void InsertGlos(const String &rRegion, const String &rGlosName); // inline
+ virtual USHORT GetSelectedIdx() const; // inline
+ virtual void SelectEntryPos(USHORT nIdx); // inline
+};
+//add for SwSelGlossaryDlg end
+
+//add for SwAutoFormatDlg begin
+class AbstractSwAutoFormatDlg_Impl : public AbstractSwAutoFormatDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSwAutoFormatDlg_Impl,SwAutoFormatDlg )
+ virtual void FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const;
+};
+//add for SwAutoFormatDlg end
+
+//add for SwFldDlg begin
+
+class AbstractSwFldDlg_Impl : public AbstractSwFldDlg //add for SwFldDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSwFldDlg_Impl,SwFldDlg )
+ virtual void SetCurPageId( USHORT nId );
+ virtual const SfxItemSet* GetOutputItemSet() const;
+ virtual const USHORT* GetInputRanges( const SfxItemPool& pItem );
+ virtual void SetInputSet( const SfxItemSet* pInSet );
+ //From class Window.
+ virtual void SetText( const XubString& rStr );
+ virtual String GetText() const;
+ virtual void Start( BOOL bShow = TRUE ); //this method from SfxTabDialog
+ virtual void ShowPage( USHORT nId );// this method from SfxTabDialog
+ virtual void Initialize(SfxChildWinInfo *pInfo);
+ virtual void ReInitDlg();
+ virtual void ActivateDatabasePage();
+ virtual Window * GetWindow(); //this method is added for return a Window type pointer
+};
+//add for SwFldD end
+
+//add for SwRenameXNamedDlg begin
+class AbstractSwRenameXNamedDlg_Impl : public AbstractSwRenameXNamedDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSwRenameXNamedDlg_Impl,SwRenameXNamedDlg )
+ virtual void SetForbiddenChars( const String& rSet );
+ virtual void SetAlternativeAccess(
+ STAR_REFERENCE( container::XNameAccess ) & xSecond,
+ STAR_REFERENCE( container::XNameAccess ) & xThird );
+};
+//add for SwRenameXNamedDlg end
+//add for SwModalRedlineAcceptDlg begin
+class AbstractSwModalRedlineAcceptDlg_Impl : public AbstractSwModalRedlineAcceptDlg
+{
+ DECL_ABSTDLG_BASE(AbstractSwModalRedlineAcceptDlg_Impl,SwModalRedlineAcceptDlg )
+ virtual void AcceptAll( BOOL bAccept );
+};
+//add for SwModalRedlineAcceptDlg end
+
+//for SwGlossaryDlg begin
+class SwGlossaryDlg;
+class AbstractGlossaryDlg_Impl : public AbstractGlossaryDlg
+{
+ DECL_ABSTDLG_BASE(AbstractGlossaryDlg_Impl,SwGlossaryDlg)
+ virtual String GetCurrGrpName() const;
+ virtual String GetCurrShortName() const;
+};
+//for SwGlossaryDlg end
+
+//for SwFldInputDlg begin
+class SwFldInputDlg;
+class AbstractFldInputDlg_Impl : public AbstractFldInputDlg
+{
+ DECL_ABSTDLG_BASE(AbstractFldInputDlg_Impl,SwFldInputDlg)
+ //from class SalFrame
+ virtual void SetWindowState( const ByteString& rStr ) ;
+ virtual ByteString GetWindowState( ULONG nMask = WINDOWSTATE_MASK_ALL ) const ;
+};
+//for SwFldInputDlg end
+
+//for SwInsFootNoteDlg begin
+class SwInsFootNoteDlg;
+class AbstractInsFootNoteDlg_Impl : public AbstractInsFootNoteDlg
+{
+ DECL_ABSTDLG_BASE(AbstractInsFootNoteDlg_Impl,SwInsFootNoteDlg)
+ virtual String GetFontName();
+ virtual BOOL IsEndNote();
+ virtual String GetStr();
+ //from class Window
+ virtual void SetHelpId( const rtl::OString& sHelpId );
+ virtual void SetText( const XubString& rStr );
+};
+//for SwInsFootNoteDlg end
+
+//for SwInsertGrfRulerDlg begin
+class SwInsertGrfRulerDlg;
+class AbstractInsertGrfRulerDlg_Impl : public AbstractInsertGrfRulerDlg
+{
+ DECL_ABSTDLG_BASE(AbstractInsertGrfRulerDlg_Impl,SwInsertGrfRulerDlg)
+ virtual String GetGraphicName();
+ virtual BOOL IsSimpleLine();
+ virtual BOOL HasImages() const ;
+};
+//for SwInsertGrfRulerDlg end
+
+//for SwInsTableDlg begin
+class SwInsTableDlg;
+class AbstractInsTableDlg_Impl : public AbstractInsTableDlg
+{
+ DECL_ABSTDLG_BASE(AbstractInsTableDlg_Impl,SwInsTableDlg)
+ virtual void GetValues( String& rName, USHORT& rRow, USHORT& rCol,
+ SwInsertTableOptions& rInsTblFlags, String& rTableAutoFmtName,
+ SwTableAutoFmt *& prTAFmt );
+};
+//for SwInsTableDlg end
+
+//for SwJavaEditDialog begin
+class SwJavaEditDialog;
+class AbstractJavaEditDialog_Impl : public AbstractJavaEditDialog
+{
+ DECL_ABSTDLG_BASE(AbstractJavaEditDialog_Impl,SwJavaEditDialog)
+ virtual String GetText();
+ virtual String GetType();
+ virtual BOOL IsUrl();
+ virtual BOOL IsNew();
+ virtual BOOL IsUpdate();
+};
+//for SwJavaEditDialog end
+
+//for SwMailMergeDlg begin
+class SwMailMergeDlg;
+class AbstractMailMergeDlg_Impl : public AbstractMailMergeDlg
+{
+ DECL_ABSTDLG_BASE(AbstractMailMergeDlg_Impl,SwMailMergeDlg)
+ virtual USHORT GetMergeType() ;
+ virtual const ::rtl::OUString& GetSaveFilter() const;
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > GetSelection() const ;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> GetResultSet() const;
+};
+//for SwMailMergeDlg end
+//for SwMailMergeCreateFromDlg begin
+class SwMailMergeCreateFromDlg;
+class AbstractMailMergeCreateFromDlg_Impl : public AbstractMailMergeCreateFromDlg
+{
+ DECL_ABSTDLG_BASE(AbstractMailMergeCreateFromDlg_Impl,SwMailMergeCreateFromDlg)
+ virtual BOOL IsThisDocument() const ;
+};
+//for SwMailMergeCreateFromDlg end
+//for SwMailMergeFieldConnectionsDlg begin
+class SwMailMergeFieldConnectionsDlg;
+class AbstractMailMergeFieldConnectionsDlg_Impl : public AbstractMailMergeFieldConnectionsDlg
+{
+ DECL_ABSTDLG_BASE(AbstractMailMergeFieldConnectionsDlg_Impl,SwMailMergeFieldConnectionsDlg)
+ virtual BOOL IsUseExistingConnections() const ;
+};
+//for SwMailMergeFieldConnectionsDlg end
+
+//for SwMultiTOXTabDialog begin
+class SwMultiTOXTabDialog;
+class AbstractMultiTOXTabDialog_Impl : public AbstractMultiTOXTabDialog
+{
+ DECL_ABSTDLG_BASE(AbstractMultiTOXTabDialog_Impl,SwMultiTOXTabDialog)
+ virtual SwForm* GetForm(CurTOXType eType);
+ virtual CurTOXType GetCurrentTOXType() const ;
+ virtual SwTOXDescription& GetTOXDescription(CurTOXType eTOXTypes);
+ //from SfxTabDialog
+ virtual const SfxItemSet* GetOutputItemSet() const;
+};
+//for SwMultiTOXTabDialog end
+
+//for SwEditRegionDlg begin
+class SwEditRegionDlg;
+class AbstractEditRegionDlg_Impl : public AbstractEditRegionDlg
+{
+ DECL_ABSTDLG_BASE(AbstractEditRegionDlg_Impl,SwEditRegionDlg)
+ virtual void SelectSection(const String& rSectionName);
+};
+//for SwEditRegionDlg end
+//for SwInsertSectionTabDialog begin
+class SwInsertSectionTabDialog;
+class AbstractInsertSectionTabDialog_Impl : public AbstractInsertSectionTabDialog
+{
+ DECL_ABSTDLG_BASE(AbstractInsertSectionTabDialog_Impl,SwInsertSectionTabDialog)
+ virtual void SetSectionData(SwSectionData const& rSect);
+};
+//for SwInsertSectionTabDialog end
+
+//for SwIndexMarkFloatDlg begin
+class SwIndexMarkFloatDlg;
+class AbstractIndexMarkFloatDlg_Impl : public AbstractMarkFloatDlg
+{
+ DECL_ABSTDLG_BASE(AbstractIndexMarkFloatDlg_Impl,SwIndexMarkFloatDlg)
+ virtual void ReInitDlg(SwWrtShell& rWrtShell);
+ virtual Window * GetWindow(); //this method is added for return a Window type pointer
+};
+//for SwIndexMarkFloatDlg end
+
+//for SwAuthMarkFloatDlg begin
+class SwAuthMarkFloatDlg;
+class AbstractAuthMarkFloatDlg_Impl : public AbstractMarkFloatDlg
+{
+ DECL_ABSTDLG_BASE(AbstractAuthMarkFloatDlg_Impl,SwAuthMarkFloatDlg)
+ virtual void ReInitDlg(SwWrtShell& rWrtShell);
+ virtual Window * GetWindow(); //this method is added for return a Window type pointer
+};
+//for SwAuthMarkFloatDlg end
+
+class SwMailMergeWizard;
+class AbstractMailMergeWizard_Impl : public AbstractMailMergeWizard
+{
+ SwMailMergeWizard* pDlg;
+ Link aEndDlgHdl;
+
+ DECL_LINK( EndDialogHdl, SwMailMergeWizard* );
+public:
+ AbstractMailMergeWizard_Impl( SwMailMergeWizard* p )
+ : pDlg(p)
+ {}
+ virtual ~AbstractMailMergeWizard_Impl();
+ virtual void StartExecuteModal( const Link& rEndDialogHdl );
+ virtual long GetResult();
+
+ virtual void SetReloadDocument(const String& rURL);
+ virtual const String& GetReloadDocument() const;
+ virtual BOOL ShowPage( USHORT nLevel );
+ virtual sal_uInt16 GetRestartPage() const;
+};
+
+//------------------------------------------------------------------------
+//AbstractDialogFactory_Impl implementations
+class SwAbstractDialogFactory_Impl : public SwAbstractDialogFactory
+{
+
+public:
+ virtual SfxAbstractDialog* CreateSfxDialog( Window* pParent, //add for SvxMeasureDialog & SvxConnectionDialog
+ const SfxItemSet& rAttr,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame,
+ sal_uInt32 nResId
+ );
+ virtual AbstractSwWordCountDialog* CreateSwWordCountDialog(Window* pParent);
+ virtual AbstractSwInsertAbstractDlg * CreateSwInsertAbstractDlg( Window* pParent,int nResId );
+ virtual AbstractSwAsciiFilterDlg* CreateSwAsciiFilterDlg ( Window* pParent, SwDocShell& rDocSh,
+ SvStream* pStream, int nResId ); //add for SwAsciiFilterDlg
+ virtual VclAbstractDialog * CreateSwInsertBookmarkDlg( Window *pParent, SwWrtShell &rSh, SfxRequest& rReq, int nResId );//add for SwInsertBookmarkDlg
+ virtual AbstractSwBreakDlg * CreateSwBreakDlg ( Window *pParent, SwWrtShell &rSh,int nResId ); // add for SwBreakDlg
+ virtual VclAbstractDialog * CreateSwChangeDBDlg( SwView& rVw, int nResId ); //add for SwChangeDBDlg
+ virtual SfxAbstractTabDialog * CreateSwCharDlg( Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, int nResId, // add for SwCharDlg
+ const String* pFmtStr = 0, BOOL bIsDrwTxtDlg = FALSE);
+ virtual AbstractSwConvertTableDlg* CreateSwConvertTableDlg ( SwView& rView, int nResId, bool bToTable ); //add for SwConvertTableDlg
+ virtual VclAbstractDialog * CreateSwCaptionDialog ( Window *pParent, SwView &rV,int nResId); //add for SwCaptionDialog
+
+ virtual AbstractSwInsertDBColAutoPilot* CreateSwInsertDBColAutoPilot( SwView& rView, // add for SwInsertDBColAutoPilot
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
+ com::sun::star::uno::Reference<com::sun::star::sdbcx::XColumnsSupplier> xColSupp,
+ const SwDBData& rData, int nResId);
+ virtual SfxAbstractTabDialog * CreateSwFootNoteOptionDlg( Window *pParent, SwWrtShell &rSh,int nResId);//add for SwFootNoteOptionDlg
+
+ virtual AbstractDropDownFieldDialog * CreateDropDownFieldDialog ( Window *pParent, SwWrtShell &rSh, //add for DropDownFieldDialog
+ SwField* pField,int nResId, BOOL bNextButton = FALSE );
+ virtual SfxAbstractTabDialog* CreateSwEnvDlg ( Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, BOOL bInsert,int nResId ); //add for SwEnvDlg
+ virtual AbstarctSwLabDlg* CreateSwLabDlg ( Window* pParent, const SfxItemSet& rSet, //add for SwLabDlg
+ SwNewDBMgr* pNewDBMgr, BOOL bLabel,int nResId );
+
+ virtual SwLabDlgMethod GetSwLabDlgStaticMethod (); //add for SwLabDlg
+ virtual SfxAbstractTabDialog* CreateSwParaDlg ( Window *pParent, //add for SwParaDlg
+ SwView& rVw,
+ const SfxItemSet& rCoreSet,
+ BYTE nDialogMode,
+ int nResId,
+ const String *pCollName = 0,
+ BOOL bDraw = FALSE,
+ UINT16 nDefPage = 0);
+
+ virtual AbstarctSwSelGlossaryDlg * CreateSwSelGlossaryDlg ( Window * pParent, const String &rShortName, int nResId ); //add for SwSelGlossaryDlg
+ virtual VclAbstractDialog * CreateVclAbstractDialog ( Window * pParent, SwWrtShell &rSh, int nResId ); //add for SwTableHeightDlg SwSortDlg
+ virtual AbstractSplitTableDialog * CreateSplitTblDialog ( Window * pParent, SwWrtShell &rSh ); //add for SwSplitTblDlg
+
+ virtual AbstractSwAutoFormatDlg * CreateSwAutoFormatDlg( Window* pParent, SwWrtShell* pShell, //add for SwAutoFormatDlg
+ int nResId,
+ BOOL bSetAutoFmt = TRUE,
+ const SwTableAutoFmt* pSelFmt = 0 );
+ virtual SfxAbstractDialog * CreateSwBorderDlg (Window* pParent, SfxItemSet& rSet, USHORT nType,int nResId );//add for SwBorderDlg
+
+ virtual SfxAbstractDialog * CreateSwWrapDlg ( Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, BOOL bDrawMode, int nResId ); //add for SwWrapDlg
+ virtual VclAbstractDialog * CreateSwTableWidthDlg ( Window *pParent, SwTableFUNC &rFnc , int nResId ); //add for SwTableWidthDlg
+ virtual SfxAbstractTabDialog* CreateSwTableTabDlg( Window* pParent, SfxItemPool& Pool,
+ const SfxItemSet* pItemSet, SwWrtShell* pSh,int nResId ); //add for SwTableTabDlg
+ virtual AbstractSwFldDlg * CreateSwFldDlg ( SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent, int nResId ); //add for SwFldDlg
+ virtual SfxAbstractDialog* CreateSwFldEditDlg ( SwView& rVw, int nResId ); //add for SwFldEditDlg
+ virtual AbstractSwRenameXNamedDlg * CreateSwRenameXNamedDlg( Window* pParent, //add for SwRenameXNamedDlg
+ STAR_REFERENCE( container::XNamed ) & xNamed,
+ STAR_REFERENCE( container::XNameAccess ) & xNameAccess, int nResId );
+ virtual AbstractSwModalRedlineAcceptDlg * CreateSwModalRedlineAcceptDlg ( Window *pParent, int nResId ); //add for SwModalRedlineAcceptDlg
+
+ virtual VclAbstractDialog* CreateSwVclDialog( int nResId,
+ Window* pParent, BOOL& rWithPrev ); //add for SwMergeTblDlg
+ virtual SfxAbstractTabDialog* CreateFrmTabDialog( int nResId,
+ SfxViewFrame *pFrame, Window *pParent,
+ const SfxItemSet& rCoreSet,
+ BOOL bNewFrm = TRUE,
+ USHORT nResType = DLG_FRM_STD,
+ BOOL bFmt = FALSE,
+ UINT16 nDefPage = 0,
+ const String* pFmtStr = 0); //add for SwFrmDlg
+ virtual SfxAbstractTabDialog* CreateTemplateDialog( int nResId,
+ Window* pParent,
+ SfxStyleSheetBase& rBase,
+ USHORT nRegion,
+ BOOL bColumn = FALSE,
+ SwWrtShell* pActShell = 0,
+ BOOL bNew = FALSE ); //add for SwTemplateDlg
+ virtual AbstractGlossaryDlg* CreateGlossaryDlg( int nResId,
+ SfxViewFrame* pViewFrame,
+ SwGlossaryHdl* pGlosHdl,
+ SwWrtShell *pWrtShell); //add for SwGlossaryDlg
+ virtual AbstractFldInputDlg* CreateFldInputDlg( int nResId,
+ Window *pParent, SwWrtShell &rSh,
+ SwField* pField, BOOL bNextButton = FALSE ); //add for SwFldInputDlg
+ virtual AbstractInsFootNoteDlg* CreateInsFootNoteDlg( int nResId,
+ Window * pParent, SwWrtShell &rSh, BOOL bEd = FALSE); //add for SwInsFootNoteDlg
+ virtual VclAbstractDialog * CreateVclSwViewDialog( int nResId,
+ SwView& rView, BOOL bCol = FALSE ); //add for SwInsRowColDlg, SwLineNumberingDlg
+ virtual AbstractInsertGrfRulerDlg* CreateInsertGrfRulerDlg( int nResId,
+ Window * pParent ); //add for SwInsertGrfRulerDlg
+ virtual AbstractInsTableDlg* CreateInsTableDlg( int nResId,
+ SwView& rView ); //add for SwInsTableDlg
+ virtual AbstractJavaEditDialog* CreateJavaEditDialog( int nResId,
+ Window* pParent, SwWrtShell* pWrtSh ); //add for SwJavaEditDialog
+ virtual AbstractMailMergeDlg* CreateMailMergeDlg( int nResId,
+ Window* pParent, SwWrtShell& rSh,
+ const String& rSourceName,
+ const String& rTblName,
+ sal_Int32 nCommandType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& xConnection,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >* pSelection = 0 ); //add for SwMailMergeDlg
+ virtual AbstractMailMergeCreateFromDlg* CreateMailMergeCreateFromDlg( int nResId,
+ Window* pParent ); //add for SwMailMergeCreateFromDlg
+ virtual AbstractMailMergeFieldConnectionsDlg* CreateMailMergeFieldConnectionsDlg( int nResId,
+ Window* pParent ); //add for SwMailMergeFieldConnectionsDlg
+ virtual VclAbstractDialog* CreateMultiTOXMarkDlg( int nResId,
+ Window* pParent, SwTOXMgr &rTOXMgr ); //add for SwMultiTOXMarkDlg
+ virtual SfxAbstractTabDialog* CreateSwTabDialog( int nResId,
+ Window* pParent,
+ const SfxItemSet* pSwItemSet,
+ SwWrtShell &); //add for SwSvxNumBulletTabDialog, SwOutlineTabDialog
+ virtual AbstractMultiTOXTabDialog* CreateMultiTOXTabDialog( int nResId,
+ Window* pParent, const SfxItemSet& rSet,
+ SwWrtShell &rShell,
+ SwTOXBase* pCurTOX, USHORT nToxType = USHRT_MAX,
+ BOOL bGlobal = FALSE); //add for SwMultiTOXTabDialog
+ virtual AbstractEditRegionDlg* CreateEditRegionDlg( int nResId,
+ Window* pParent, SwWrtShell& rWrtSh ); //add for SwEditRegionDlg
+ virtual AbstractInsertSectionTabDialog* CreateInsertSectionTabDialog( int nResId,
+ Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh); //add for SwInsertSectionTabDialog
+ virtual AbstractMarkFloatDlg* CreateIndexMarkFloatDlg( int nResId,
+ SfxBindings* pBindings,
+ SfxChildWindow* pChild,
+ Window *pParent,
+ SfxChildWinInfo* pInfo,
+ sal_Bool bNew=sal_True); //add for SwIndexMarkFloatDlg
+ virtual AbstractMarkFloatDlg* CreateAuthMarkFloatDlg( int nResId,
+ SfxBindings* pBindings,
+ SfxChildWindow* pChild,
+ Window *pParent,
+ SfxChildWinInfo* pInfo,
+ sal_Bool bNew=sal_True); //add for SwAuthMarkFloatDlg
+ virtual VclAbstractDialog * CreateIndexMarkModalDlg( int nResId,
+ Window *pParent, SwWrtShell& rSh, SwTOXMark* pCurTOXMark ); //add for SwIndexMarkModalDlg
+
+ virtual AbstractMailMergeWizard* CreateMailMergeWizard(SwView& rView, SwMailMergeConfigItem& rConfigItem);
+
+ //add for static func in SwGlossaryDlg
+ virtual GlossaryGetCurrGroup GetGlossaryCurrGroupFunc( USHORT nId );
+ virtual GlossarySetActGroup SetGlossaryActGroupFunc( USHORT nId );
+
+ // For TabPage
+ virtual CreateTabPage GetTabPageCreatorFunc( USHORT nId );
+
+ virtual GetTabPageRanges GetTabPageRangesFunc( USHORT nId );
+
+};
+
+struct SwDialogsResMgr
+{
+ static ResMgr* GetResMgr();
+};
+
+#endif
diff --git a/sw/source/ui/dialog/swuiexp.cxx b/sw/source/ui/dialog/swuiexp.cxx
new file mode 100644
index 000000000000..3957a233f5e2
--- /dev/null
+++ b/sw/source/ui/dialog/swuiexp.cxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include "swdlgfact.hxx"
+
+namespace swui
+{
+ static SwAbstractDialogFactory_Impl* pFactory=NULL;
+ SwAbstractDialogFactory * GetFactory()
+ {
+ if ( !pFactory )
+ pFactory = new SwAbstractDialogFactory_Impl;
+ if ( !pSwResMgr)
+ SwDialogsResMgr::GetResMgr();
+ return pFactory;
+ }
+}
+
+extern "C"
+{
+ SAL_DLLPUBLIC_EXPORT SwAbstractDialogFactory* CreateDialogFactory()
+ {
+ return ::swui::GetFactory();
+ }
+}
diff --git a/sw/source/ui/dialog/swwrtshitem.cxx b/sw/source/ui/dialog/swwrtshitem.cxx
new file mode 100644
index 000000000000..f9015e3a0387
--- /dev/null
+++ b/sw/source/ui/dialog/swwrtshitem.cxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include "swwrtshitem.hxx"
+TYPEINIT1(SwWrtShellItem,SfxPoolItem);
+SwWrtShellItem::SwWrtShellItem( USHORT _nWhich, SwWrtShell* pSh )
+ : SfxPoolItem( _nWhich ), pWrtSh( pSh )
+{
+
+}
+SwWrtShellItem::SwWrtShellItem( const SwWrtShellItem& rItem) :
+ SfxPoolItem( rItem.Which() ),
+ pWrtSh( rItem.pWrtSh )
+{
+}
+
+int SwWrtShellItem::operator==( const SfxPoolItem& rItem) const
+{
+ return ((SwWrtShellItem&)rItem).pWrtSh == pWrtSh;
+}
+
+SfxPoolItem* SwWrtShellItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ return new SwWrtShellItem( *this );
+}
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
new file mode 100644
index 000000000000..5acc169c4979
--- /dev/null
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -0,0 +1,2457 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include <hintids.hxx>
+#include <regionsw.hxx>
+#include <svl/urihelper.hxx>
+#include <svl/PasswordHelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/passwd.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <sfx2/docinsert.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <editeng/sizeitem.hxx>
+#include <svtools/htmlcfg.hxx>
+
+#include <comphelper/storagehelper.hxx>
+#include <uitool.hxx>
+#include <IMark.hxx>
+#include <section.hxx>
+#include <docary.hxx>
+#include <doc.hxx> // fuers SwSectionFmt-Array
+#include <basesh.hxx>
+#include <wdocsh.hxx>
+#include <view.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <swundo.hxx> // fuer Undo-Ids
+#include <column.hxx>
+#include <fmtfsize.hxx>
+#include <swunodef.hxx>
+#include <shellio.hxx>
+
+#include <helpid.h>
+#include <cmdid.h>
+#include <regionsw.hrc>
+#include <comcore.hrc>
+#include <globals.hrc>
+#include <sfx2/bindings.hxx>
+#include <svx/htmlmode.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svxdlg.hxx>
+#include <svx/flagsdef.hxx>
+
+using namespace ::com::sun::star;
+
+
+// sw/inc/docary.hxx
+SV_IMPL_PTRARR( SwSectionFmts, SwSectionFmtPtr )
+
+#define FILE_NAME_LENGTH 17
+
+static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox );
+
+void lcl_FillList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAvailNames, const SwSectionFmt* pNewFmt )
+{
+ const SwSectionFmt* pFmt;
+ if( !pNewFmt )
+ {
+ USHORT nCount = rSh.GetSectionFmtCount();
+ for(USHORT i=0;i<nCount;i++)
+ {
+ SectionType eTmpType;
+ if( !(pFmt = &rSh.GetSectionFmt(i))->GetParent() &&
+ pFmt->IsInNodesArr() &&
+ (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
+ && TOX_HEADER_SECTION != eTmpType )
+ {
+ String* pString =
+ new String(pFmt->GetSection()->GetSectionName());
+ if(pAvailNames)
+ pAvailNames->InsertEntry(*pString);
+ rSubRegions.InsertEntry(*pString);
+ lcl_FillList( rSh, rSubRegions, pAvailNames, pFmt );
+ }
+ }
+ }
+ else
+ {
+ SwSections aTmpArr;
+ USHORT nCnt = pNewFmt->GetChildSections(aTmpArr,SORTSECT_POS);
+ if( nCnt )
+ {
+ SectionType eTmpType;
+ for( USHORT n = 0; n < nCnt; ++n )
+ if( (pFmt = aTmpArr[n]->GetFmt())->IsInNodesArr()&&
+ (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
+ && TOX_HEADER_SECTION != eTmpType )
+ {
+ String* pString =
+ new String(pFmt->GetSection()->GetSectionName());
+ if(pAvailNames)
+ pAvailNames->InsertEntry(*pString);
+ rSubRegions.InsertEntry(*pString);
+ lcl_FillList( rSh, rSubRegions, pAvailNames, pFmt );
+ }
+ }
+ }
+}
+
+void lcl_FillSubRegionList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAvailNames )
+{
+ lcl_FillList( rSh, rSubRegions, pAvailNames, 0 );
+ IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
+ for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
+ ppMark != pMarkAccess->getMarksEnd();
+ ppMark++)
+ {
+ const ::sw::mark::IMark* pBkmk = ppMark->get();
+ if( pBkmk->IsExpanded() )
+ rSubRegions.InsertEntry( pBkmk->GetName() );
+ }
+}
+
+/* -----------------25.06.99 15:38-------------------
+
+ --------------------------------------------------*/
+class SwTestPasswdDlg : public SfxPasswordDialog
+{
+public:
+ SwTestPasswdDlg(Window* pParent) :
+ SfxPasswordDialog(pParent)
+ {
+ SetHelpId(HID_DLG_PASSWD_SECTION);
+ }
+};
+
+/*----------------------------------------------------------------------------
+ Beschreibung: User Data Klasse fuer Bereichsinformationen
+----------------------------------------------------------------------------*/
+
+class SectRepr
+{
+private:
+ SwSectionData m_SectionData;
+ SwFmtCol m_Col;
+ SvxBrushItem m_Brush;
+ SwFmtFtnAtTxtEnd m_FtnNtAtEnd;
+ SwFmtEndAtTxtEnd m_EndNtAtEnd;
+ SwFmtNoBalancedColumns m_Balance;
+ SvxFrameDirectionItem m_FrmDirItem;
+ SvxLRSpaceItem m_LRSpaceItem;
+ USHORT m_nArrPos;
+ // zeigt an, ob evtl. Textinhalt im Bereich ist
+ bool m_bContent : 1;
+ // fuer Multiselektion erst markieren, dann mit der TreeListBox arbeiten!
+ bool m_bSelected : 1;
+ uno::Sequence<sal_Int8> m_TempPasswd;
+
+public:
+ SectRepr(USHORT nPos, SwSection& rSect);
+ bool operator==(SectRepr& rSectRef) const
+ { return m_nArrPos == rSectRef.GetArrPos(); }
+
+ bool operator< (SectRepr& rSectRef) const
+ { return m_nArrPos < rSectRef.GetArrPos(); }
+
+ SwSectionData & GetSectionData() { return m_SectionData; }
+ SwSectionData const&GetSectionData() const { return m_SectionData; }
+ SwFmtCol& GetCol() { return m_Col; }
+ SvxBrushItem& GetBackground() { return m_Brush; }
+ SwFmtFtnAtTxtEnd& GetFtnNtAtEnd() { return m_FtnNtAtEnd; }
+ SwFmtEndAtTxtEnd& GetEndNtAtEnd() { return m_EndNtAtEnd; }
+ SwFmtNoBalancedColumns& GetBalance() { return m_Balance; }
+ SvxFrameDirectionItem& GetFrmDir() { return m_FrmDirItem; }
+ SvxLRSpaceItem& GetLRSpace() { return m_LRSpaceItem; }
+
+ USHORT GetArrPos() const { return m_nArrPos; }
+ String GetFile() const;
+ String GetSubRegion() const;
+ void SetFile(String const& rFile);
+ void SetFilter(String const& rFilter);
+ void SetSubRegion(String const& rSubRegion);
+
+ bool IsContent() { return m_bContent; }
+ void SetContent(bool const bValue) { m_bContent = bValue; }
+
+ void SetSelected() { m_bSelected = true; }
+ bool IsSelected() const { return m_bSelected; }
+
+ uno::Sequence<sal_Int8> & GetTempPasswd() { return m_TempPasswd; }
+ void SetTempPasswd(const uno::Sequence<sal_Int8> & rPasswd)
+ { m_TempPasswd = rPasswd; }
+};
+
+
+SV_IMPL_OP_PTRARR_SORT( SectReprArr, SectReprPtr )
+
+SectRepr::SectRepr( USHORT nPos, SwSection& rSect )
+ : m_SectionData( rSect )
+ , m_Brush( RES_BACKGROUND )
+ , m_FrmDirItem( FRMDIR_ENVIRONMENT, RES_FRAMEDIR )
+ , m_LRSpaceItem( RES_LR_SPACE )
+ , m_nArrPos(nPos)
+ , m_bContent(m_SectionData.GetLinkFileName().Len() == 0)
+ , m_bSelected(false)
+{
+ SwSectionFmt *pFmt = rSect.GetFmt();
+ if( pFmt )
+ {
+ m_Col = pFmt->GetCol();
+ m_Brush = pFmt->GetBackground();
+ m_FtnNtAtEnd = pFmt->GetFtnAtTxtEnd();
+ m_EndNtAtEnd = pFmt->GetEndAtTxtEnd();
+ m_Balance.SetValue(pFmt->GetBalancedColumns().GetValue());
+ m_FrmDirItem = pFmt->GetFrmDir();
+ m_LRSpaceItem = pFmt->GetLRSpace();
+ }
+}
+
+void SectRepr::SetFile( const String& rFile )
+{
+ String sNewFile( INetURLObject::decode( rFile, INET_HEX_ESCAPE,
+ INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 ));
+ String sOldFileName( m_SectionData.GetLinkFileName() );
+ String sSub( sOldFileName.GetToken( 2, sfx2::cTokenSeperator ) );
+
+ if( rFile.Len() || sSub.Len() )
+ {
+ sNewFile += sfx2::cTokenSeperator;
+ if( rFile.Len() ) // Filter nur mit FileName
+ sNewFile += sOldFileName.GetToken( 1, sfx2::cTokenSeperator );
+
+ sNewFile += sfx2::cTokenSeperator;
+ sNewFile += sSub;
+ }
+
+ m_SectionData.SetLinkFileName( sNewFile );
+
+ if( rFile.Len() || sSub.Len() )
+ {
+ m_SectionData.SetType( FILE_LINK_SECTION );
+ }
+ else
+ {
+ m_SectionData.SetType( CONTENT_SECTION );
+ }
+}
+
+
+void SectRepr::SetFilter( const String& rFilter )
+{
+ String sNewFile;
+ String sOldFileName( m_SectionData.GetLinkFileName() );
+ String sFile( sOldFileName.GetToken( 0, sfx2::cTokenSeperator ) );
+ String sSub( sOldFileName.GetToken( 2, sfx2::cTokenSeperator ) );
+
+ if( sFile.Len() )
+ (((( sNewFile = sFile ) += sfx2::cTokenSeperator ) += rFilter )
+ += sfx2::cTokenSeperator ) += sSub;
+ else if( sSub.Len() )
+ (( sNewFile = sfx2::cTokenSeperator ) += sfx2::cTokenSeperator ) += sSub;
+
+ m_SectionData.SetLinkFileName( sNewFile );
+
+ if( sNewFile.Len() )
+ {
+ m_SectionData.SetType( FILE_LINK_SECTION );
+ }
+}
+
+void SectRepr::SetSubRegion(const String& rSubRegion)
+{
+ String sNewFile;
+ String sOldFileName( m_SectionData.GetLinkFileName() );
+ String sFilter( sOldFileName.GetToken( 1, sfx2::cTokenSeperator ) );
+ sOldFileName = sOldFileName.GetToken( 0, sfx2::cTokenSeperator );
+
+ if( rSubRegion.Len() || sOldFileName.Len() )
+ (((( sNewFile = sOldFileName ) += sfx2::cTokenSeperator ) += sFilter )
+ += sfx2::cTokenSeperator ) += rSubRegion;
+
+ m_SectionData.SetLinkFileName( sNewFile );
+
+ if( rSubRegion.Len() || sOldFileName.Len() )
+ {
+ m_SectionData.SetType( FILE_LINK_SECTION );
+ }
+ else
+ {
+ m_SectionData.SetType( CONTENT_SECTION );
+ }
+}
+
+
+String SectRepr::GetFile() const
+{
+ String sLinkFile( m_SectionData.GetLinkFileName() );
+ if( sLinkFile.Len() )
+ {
+ if (DDE_LINK_SECTION == m_SectionData.GetType())
+ {
+ USHORT n = sLinkFile.SearchAndReplace( sfx2::cTokenSeperator, ' ' );
+ sLinkFile.SearchAndReplace( sfx2::cTokenSeperator, ' ', n );
+ }
+ else
+ sLinkFile = INetURLObject::decode( sLinkFile.GetToken( 0,
+ sfx2::cTokenSeperator ),
+ INET_HEX_ESCAPE,
+ INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 );
+ }
+ return sLinkFile;
+}
+
+
+String SectRepr::GetSubRegion() const
+{
+ String sLinkFile( m_SectionData.GetLinkFileName() );
+ if( sLinkFile.Len() )
+ sLinkFile = sLinkFile.GetToken( 2, sfx2::cTokenSeperator );
+ return sLinkFile;
+}
+
+
+
+/*----------------------------------------------------------------------------
+ Beschreibung: Dialog Bearbeiten Bereiche
+----------------------------------------------------------------------------*/
+
+//---------------------------------------------------------------------
+
+SwEditRegionDlg::SwEditRegionDlg( Window* pParent, SwWrtShell& rWrtSh )
+ : SfxModalDialog( pParent, SW_RES(MD_EDIT_REGION) ),
+ aNameFL ( this, SW_RES( FL_NAME ) ),
+ aCurName ( this, SW_RES( ED_RANAME ) ),
+ aTree ( this, SW_RES( TLB_SECTION )),
+ aLinkFL ( this, SW_RES( FL_LINK ) ),
+ aFileCB ( this, SW_RES( CB_FILE ) ),
+ aDDECB ( this, SW_RES( CB_DDE ) ) ,
+ aFileNameFT ( this, SW_RES( FT_FILE ) ) ,
+ aDDECommandFT ( this, SW_RES( FT_DDE ) ) ,
+ aFileNameED ( this, SW_RES( ED_FILE ) ),
+ aFilePB ( this, SW_RES( PB_FILE ) ),
+ aSubRegionFT ( this, SW_RES( FT_SUBREG ) ) ,
+ aSubRegionED ( this, SW_RES( LB_SUBREG ) ) ,
+ bSubRegionsFilled( false ),
+
+ aProtectFL ( this, SW_RES( FL_PROTECT ) ),
+ aProtectCB ( this, SW_RES( CB_PROTECT ) ),
+ aPasswdCB ( this, SW_RES( CB_PASSWD ) ),
+ aPasswdPB ( this, SW_RES( PB_PASSWD ) ),
+
+ aHideFL ( this, SW_RES( FL_HIDE ) ),
+ aHideCB ( this, SW_RES( CB_HIDE ) ),
+ aConditionFT ( this, SW_RES( FT_CONDITION ) ),
+ aConditionED ( this, SW_RES( ED_CONDITION ) ),
+
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aPropertiesFL ( this, SW_RES( FL_PROPERTIES ) ),
+ aEditInReadonlyCB ( this, SW_RES( CB_EDIT_IN_READONLY ) ),
+ // <--
+
+ aOK ( this, SW_RES( PB_OK ) ),
+ aCancel ( this, SW_RES( PB_CANCEL ) ),
+ aOptionsPB ( this, SW_RES( PB_OPTIONS ) ),
+ aDismiss ( this, SW_RES( CB_DISMISS ) ),
+ aHelp ( this, SW_RES( PB_HELP ) ),
+
+ aImageIL ( SW_RES(IL_BITMAPS)),
+ aImageILH ( SW_RES(ILH_BITMAPS)),
+
+ rSh( rWrtSh ),
+ pAktEntry( 0 ),
+ m_pDocInserter ( NULL ),
+ m_pOldDefDlgParent ( NULL ),
+ bDontCheckPasswd ( sal_True)
+{
+ FreeResource();
+
+ bWeb = 0 != PTR_CAST( SwWebDocShell, rSh.GetView().GetDocShell() );
+
+ aTree.SetSelectHdl ( LINK( this, SwEditRegionDlg, GetFirstEntryHdl));
+ aTree.SetDeselectHdl ( LINK( this, SwEditRegionDlg, DeselectHdl));
+ aCurName.SetModifyHdl ( LINK( this, SwEditRegionDlg, NameEditHdl));
+ aConditionED.SetModifyHdl( LINK( this, SwEditRegionDlg, ConditionEditHdl));
+ aOK.SetClickHdl ( LINK( this, SwEditRegionDlg, OkHdl));
+ aPasswdCB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangePasswdHdl));
+ aPasswdPB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangePasswdHdl));
+ aHideCB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangeHideHdl));
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aEditInReadonlyCB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangeEditInReadonlyHdl));
+ // <--
+
+ aOptionsPB.Show();
+ aOptionsPB.SetClickHdl ( LINK( this, SwEditRegionDlg, OptionsHdl));
+ aProtectCB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangeProtectHdl));
+ aDismiss.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangeDismissHdl));
+ aFileCB.SetClickHdl ( LINK( this, SwEditRegionDlg, UseFileHdl ));
+ aFilePB.SetClickHdl ( LINK( this, SwEditRegionDlg, FileSearchHdl ));
+ aFileNameED.SetModifyHdl( LINK( this, SwEditRegionDlg, FileNameHdl ));
+ aSubRegionED.SetModifyHdl( LINK( this, SwEditRegionDlg, FileNameHdl ));
+ aSubRegionED.AddEventListener( LINK( this, SwEditRegionDlg, SubRegionEventHdl ));
+ aSubRegionED.EnableAutocomplete( sal_True, sal_True );
+
+ aTree.SetHelpId(HID_REGION_TREE);
+ aTree.SetSelectionMode( MULTIPLE_SELECTION );
+ aTree.SetStyle(aTree.GetStyle()|WB_HASBUTTONSATROOT|WB_CLIPCHILDREN|WB_HSCROLL);
+ aTree.SetSpaceBetweenEntries(0);
+
+ if(bWeb)
+ {
+ aConditionFT .Hide();
+ aConditionED .Hide();
+ aPasswdCB .Hide();
+ aHideCB .Hide();
+
+ aDDECB .Hide();
+ aDDECommandFT .Hide();
+ }
+
+ aDDECB.SetClickHdl ( LINK( this, SwEditRegionDlg, DDEHdl ));
+
+ //Ermitteln der vorhandenen Bereiche
+ pCurrSect = rSh.GetCurrSection();
+ RecurseList( 0, 0 );
+ //falls der Cursor nicht in einem Bereich steht,
+ //wird immer der erste selektiert
+ if( !aTree.FirstSelected() && aTree.First() )
+ aTree.Select( aTree.First() );
+ aTree.Show();
+ bDontCheckPasswd = sal_False;
+}
+/* -----------------------------26.04.01 14:56--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwEditRegionDlg::CheckPasswd(CheckBox* pBox)
+{
+ if(bDontCheckPasswd)
+ return TRUE;
+ sal_Bool bRet = TRUE;
+ SvLBoxEntry* pEntry = aTree.FirstSelected();
+ while( pEntry )
+ {
+ SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData();
+ if (!pRepr->GetTempPasswd().getLength()
+ && pRepr->GetSectionData().GetPassword().getLength())
+ {
+ SwTestPasswdDlg aPasswdDlg(this);
+ bRet = FALSE;
+ if (aPasswdDlg.Execute())
+ {
+ String sNewPasswd( aPasswdDlg.GetPassword() );
+ UNO_NMSPC::Sequence <sal_Int8 > aNewPasswd;
+ SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
+ if (SvPasswordHelper::CompareHashPassword(
+ pRepr->GetSectionData().GetPassword(), sNewPasswd))
+ {
+ pRepr->SetTempPasswd(aNewPasswd);
+ bRet = TRUE;
+ }
+ else
+ {
+ InfoBox(this, SW_RES(REG_WRONG_PASSWORD)).Execute();
+ }
+ }
+ }
+ pEntry = aTree.NextSelected(pEntry);
+ }
+ if(!bRet && pBox)
+ {
+ //reset old button state
+ if(pBox->IsTriStateEnabled())
+ pBox->SetState(pBox->IsChecked() ? STATE_NOCHECK : STATE_DONTKNOW);
+ else
+ pBox->Check(!pBox->IsChecked());
+ }
+
+ return bRet;
+}
+/*---------------------------------------------------------------------
+ Beschreibung: Durchsuchen nach Child-Sections, rekursiv
+---------------------------------------------------------------------*/
+
+void SwEditRegionDlg::RecurseList( const SwSectionFmt* pFmt, SvLBoxEntry* pEntry )
+{
+ SwSection* pSect = 0;
+ SvLBoxEntry* pSelEntry = 0;
+
+ if (!pFmt)
+ {
+ USHORT nCount=rSh.GetSectionFmtCount();
+ for ( USHORT n=0; n < nCount; n++ )
+ {
+ SectionType eTmpType;
+ if( !( pFmt = &rSh.GetSectionFmt(n))->GetParent() &&
+ pFmt->IsInNodesArr() &&
+ (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
+ && TOX_HEADER_SECTION != eTmpType )
+ {
+ SectRepr* pSectRepr = new SectRepr( n,
+ *(pSect=pFmt->GetSection()) );
+ Image aImg = BuildBitmap( pSect->IsProtect(),pSect->IsHidden(), FALSE);
+ pEntry = aTree.InsertEntry(pSect->GetSectionName(), aImg, aImg);
+ Image aHCImg = BuildBitmap( pSect->IsProtect(),pSect->IsHidden(), TRUE);
+ aTree.SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ aTree.SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ pEntry->SetUserData(pSectRepr);
+ RecurseList( pFmt, pEntry );
+ if (pEntry->HasChilds())
+ aTree.Expand(pEntry);
+ if (pCurrSect==pSect)
+ aTree.Select(pEntry);
+ }
+ }
+ }
+ else
+ {
+ SwSections aTmpArr;
+ SvLBoxEntry* pNEntry;
+ USHORT nCnt = pFmt->GetChildSections(aTmpArr,SORTSECT_POS);
+ if( nCnt )
+ {
+ for( USHORT n = 0; n < nCnt; ++n )
+ {
+ SectionType eTmpType;
+ pFmt = aTmpArr[n]->GetFmt();
+ if( pFmt->IsInNodesArr() &&
+ (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
+ && TOX_HEADER_SECTION != eTmpType )
+ {
+ pSect=aTmpArr[n];
+ SectRepr* pSectRepr=new SectRepr(
+ FindArrPos( pSect->GetFmt() ), *pSect );
+ Image aImage = BuildBitmap( pSect->IsProtect(),
+ pSect->IsHidden(), FALSE);
+ pNEntry = aTree.InsertEntry(
+ pSect->GetSectionName(), aImage, aImage, pEntry);
+ Image aHCImg = BuildBitmap( pSect->IsProtect(),pSect->IsHidden(), TRUE);
+ aTree.SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ aTree.SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ pNEntry->SetUserData(pSectRepr);
+ RecurseList( aTmpArr[n]->GetFmt(), pNEntry );
+ if( pNEntry->HasChilds())
+ aTree.Expand(pNEntry);
+ if (pCurrSect==pSect)
+ pSelEntry = pNEntry;
+ }
+ }
+ }
+ }
+ if(0 != pSelEntry)
+ {
+ aTree.MakeVisible(pSelEntry);
+ aTree.Select(pSelEntry);
+ }
+}
+/*---------------------------------------------------------------------
+
+---------------------------------------------------------------------*/
+
+USHORT SwEditRegionDlg::FindArrPos(const SwSectionFmt* pFmt )
+{
+ USHORT nCount=rSh.GetSectionFmtCount();
+ for (USHORT i=0;i<nCount;i++)
+ if (pFmt==&rSh.GetSectionFmt(i))
+ return i;
+
+ DBG_ERROR( "SectionFormat nicht in der Liste" );
+ return USHRT_MAX;
+}
+/*---------------------------------------------------------------------
+ Beschreibung:
+---------------------------------------------------------------------*/
+
+SwEditRegionDlg::~SwEditRegionDlg( )
+{
+ SvLBoxEntry* pEntry = aTree.First();
+ while( pEntry )
+ {
+ delete (SectRepr*)pEntry->GetUserData();
+ pEntry = aTree.Next( pEntry );
+ }
+
+ aSectReprArr.DeleteAndDestroy( 0, aSectReprArr.Count() );
+ delete m_pDocInserter;
+}
+/* -----------------------------09.10.2001 15:41------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwEditRegionDlg::SelectSection(const String& rSectionName)
+{
+ SvLBoxEntry* pEntry = aTree.First();
+ while(pEntry)
+ {
+ SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData();
+ if (pRepr->GetSectionData().GetSectionName() == rSectionName)
+ break;
+ pEntry = aTree.Next(pEntry);
+ }
+ if(pEntry)
+ {
+ aTree.SelectAll( FALSE);
+ aTree.Select(pEntry);
+ aTree.MakeVisible(pEntry);
+ }
+}
+/*---------------------------------------------------------------------
+ Beschreibung: Selektierte Eintrag in der TreeListBox wird im
+ Edit-Fenster angezeigt
+ Bei Multiselektion werden einige Controls disabled
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwEditRegionDlg, GetFirstEntryHdl, SvTreeListBox *, pBox )
+{
+ bDontCheckPasswd = sal_True;
+ SvLBoxEntry* pEntry=pBox->FirstSelected();
+ aHideCB .Enable(TRUE);
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aEditInReadonlyCB.Enable(TRUE);
+ // <--
+ aProtectCB .Enable(TRUE);
+ aFileCB .Enable(TRUE);
+ UNO_NMSPC::Sequence <sal_Int8> aCurPasswd;
+ if( 1 < pBox->GetSelectionCount() )
+ {
+ aHideCB.EnableTriState( TRUE );
+ aProtectCB.EnableTriState( TRUE );
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aEditInReadonlyCB.EnableTriState ( TRUE );
+ // <--
+ aFileCB.EnableTriState( TRUE );
+
+ bool bHiddenValid = true;
+ bool bProtectValid = true;
+ bool bConditionValid = true;
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ bool bEditInReadonlyValid = true;
+ bool bEditInReadonly = true;
+ // <--
+ bool bHidden = true;
+ bool bProtect = true;
+ String sCondition;
+ BOOL bFirst = TRUE;
+ BOOL bFileValid = TRUE;
+ BOOL bFile = TRUE;
+ BOOL bPasswdValid = TRUE;
+
+ while( pEntry )
+ {
+ SectRepr* pRepr=(SectRepr*) pEntry->GetUserData();
+ SwSectionData const& rData( pRepr->GetSectionData() );
+ if(bFirst)
+ {
+ sCondition = rData.GetCondition();
+ bHidden = rData.IsHidden();
+ bProtect = rData.IsProtectFlag();
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ bEditInReadonly = rData.IsEditInReadonlyFlag();
+ // <--
+ bFile = (rData.GetType() != CONTENT_SECTION);
+ aCurPasswd = rData.GetPassword();
+ }
+ else
+ {
+ String sTemp(rData.GetCondition());
+ if(sCondition != sTemp)
+ bConditionValid = FALSE;
+ bHiddenValid = (bHidden == rData.IsHidden());
+ bProtectValid = (bProtect == rData.IsProtectFlag());
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ bEditInReadonlyValid =
+ (bEditInReadonly == rData.IsEditInReadonlyFlag());
+ // <--
+ bFileValid = (bFile ==
+ (rData.GetType() != CONTENT_SECTION));
+ bPasswdValid = (aCurPasswd == rData.GetPassword());
+ }
+ pEntry = pBox->NextSelected(pEntry);
+ bFirst = FALSE;
+ }
+
+ aHideCB.SetState( !bHiddenValid ? STATE_DONTKNOW :
+ bHidden ? STATE_CHECK : STATE_NOCHECK);
+ aProtectCB.SetState( !bProtectValid ? STATE_DONTKNOW :
+ bProtect ? STATE_CHECK : STATE_NOCHECK);
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aEditInReadonlyCB.SetState( !bEditInReadonlyValid ? STATE_DONTKNOW :
+ bEditInReadonly ? STATE_CHECK : STATE_NOCHECK);
+ // <--
+ aFileCB.SetState(!bFileValid ? STATE_DONTKNOW :
+ bFile ? STATE_CHECK : STATE_NOCHECK);
+
+ if(bConditionValid)
+ aConditionED.SetText(sCondition);
+ else
+ {
+// aConditionED.SetText(aEmptyStr);
+ aConditionFT.Enable(FALSE);
+ aConditionED.Enable(FALSE);
+ }
+
+ aFilePB.Enable(FALSE);
+ aFileNameFT .Enable(FALSE);
+ aFileNameED .Enable(FALSE);
+ aSubRegionFT.Enable(FALSE);
+ aSubRegionED.Enable(FALSE);
+// aNameFT .Enable(FALSE);
+ aCurName .Enable(FALSE);
+ aOptionsPB .Enable(FALSE);
+ aDDECB .Enable(FALSE);
+ aDDECommandFT .Enable(FALSE);
+ BOOL bPasswdEnabled = aProtectCB.GetState() == STATE_CHECK;
+ aPasswdCB.Enable(bPasswdEnabled);
+ aPasswdPB.Enable(bPasswdEnabled);
+ if(!bPasswdValid)
+ {
+ pEntry = pBox->FirstSelected();
+ pBox->SelectAll( FALSE );
+ pBox->Select( pEntry );
+ GetFirstEntryHdl(pBox);
+ return 0;
+ }
+ else
+ aPasswdCB.Check(aCurPasswd.getLength() > 0);
+ }
+ else if (pEntry )
+ {
+// aNameFT .Enable(TRUE);
+ aCurName .Enable(TRUE);
+ aOptionsPB .Enable(TRUE);
+ SectRepr* pRepr=(SectRepr*) pEntry->GetUserData();
+ SwSectionData const& rData( pRepr->GetSectionData() );
+ aConditionED.SetText(rData.GetCondition());
+ aHideCB.Enable();
+ aHideCB.SetState((rData.IsHidden()) ? STATE_CHECK : STATE_NOCHECK);
+ BOOL bHide = STATE_CHECK == aHideCB.GetState();
+ aConditionED.Enable(bHide);
+ aConditionFT.Enable(bHide);
+ aPasswdCB.Check(rData.GetPassword().getLength() > 0);
+
+ aOK.Enable();
+ aPasswdCB.Enable();
+ aCurName.SetText(pBox->GetEntryText(pEntry));
+ aCurName.Enable();
+ aDismiss.Enable();
+ String aFile = pRepr->GetFile();
+ String sSub = pRepr->GetSubRegion();
+ bSubRegionsFilled = false;
+ aSubRegionED.Clear();
+ if(aFile.Len()||sSub.Len())
+ {
+ aFileCB.Check(TRUE);
+ aFileNameED.SetText(aFile);
+ aSubRegionED.SetText(sSub);
+ aDDECB.Check(rData.GetType() == DDE_LINK_SECTION);
+ }
+ else
+ {
+ aFileCB.Check(FALSE);
+ aFileNameED.SetText(aFile);
+ aDDECB.Enable(FALSE);
+ aDDECB.Check(FALSE);
+ }
+ UseFileHdl(&aFileCB);
+ DDEHdl( &aDDECB );
+ aProtectCB.SetState((rData.IsProtectFlag())
+ ? STATE_CHECK : STATE_NOCHECK);
+ aProtectCB.Enable();
+
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aEditInReadonlyCB.SetState((rData.IsEditInReadonlyFlag())
+ ? STATE_CHECK : STATE_NOCHECK);
+ aEditInReadonlyCB.Enable();
+ // <--
+
+ BOOL bPasswdEnabled = aProtectCB.IsChecked();
+ aPasswdCB.Enable(bPasswdEnabled);
+ aPasswdPB.Enable(bPasswdEnabled);
+ }
+ bDontCheckPasswd = sal_False;
+ return 0;
+}
+/*-----------------28.06.97 09:19-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwEditRegionDlg, DeselectHdl, SvTreeListBox *, pBox )
+{
+ if( !pBox->GetSelectionCount() )
+ {
+ aHideCB .Enable(FALSE);
+ aProtectCB .Enable(FALSE);
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aEditInReadonlyCB.Enable(FALSE);
+ // <--
+ aPasswdCB .Enable(FALSE);
+ aPasswdCB .Enable(FALSE);
+ aConditionFT .Enable(FALSE);
+ aConditionED.Enable(FALSE);
+ aFileCB .Enable(FALSE);
+ aFilePB .Enable(FALSE);
+ aFileNameFT .Enable(FALSE);
+ aFileNameED .Enable(FALSE);
+ aSubRegionFT .Enable(FALSE);
+ aSubRegionED .Enable(FALSE);
+// aNameFT .Enable(FALSE);
+ aCurName .Enable(FALSE);
+ aDDECB .Enable(FALSE);
+ aDDECommandFT .Enable(FALSE);
+
+ UseFileHdl(&aFileCB);
+ DDEHdl( &aDDECB );
+ }
+ return 0;
+}
+
+/*---------------------------------------------------------------------
+ Beschreibung: Im OkHdl werden die veraenderten Einstellungen
+ uebernommen und aufgehobene Bereiche geloescht
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwEditRegionDlg, OkHdl, CheckBox *, EMPTYARG )
+{
+ // JP 13.03.96:
+ // temp. Array weil sich waehrend des aendern eines Bereiches die
+ // Position innerhalb des "Core-Arrays" verschieben kann:
+ // - bei gelinkten Bereichen, wenn sie weitere SubBereiche haben oder
+ // neu erhalten.
+ // JP 30.05.97: StartUndo darf natuerlich auch erst nach dem Kopieren
+ // der Formate erfolgen (ClearRedo!)
+
+ const SwSectionFmts& rDocFmts = rSh.GetDoc()->GetSections();
+ SwSectionFmts aOrigArray( 0, 5 );
+ aOrigArray.Insert( &rDocFmts, 0 );
+
+ rSh.StartAllAction();
+ rSh.StartUndo();
+ rSh.ResetSelect( 0,FALSE );
+ SvLBoxEntry* pEntry = aTree.First();
+
+ while( pEntry )
+ {
+ SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData();
+ SwSectionFmt* pFmt = aOrigArray[ pRepr->GetArrPos() ];
+ if (!pRepr->GetSectionData().IsProtectFlag())
+ {
+ pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >());
+ }
+ USHORT nNewPos = rDocFmts.GetPos( pFmt );
+ if( USHRT_MAX != nNewPos )
+ {
+ SfxItemSet* pSet = pFmt->GetAttrSet().Clone( FALSE );
+ if( pFmt->GetCol() != pRepr->GetCol() )
+ pSet->Put( pRepr->GetCol() );
+
+ if( pFmt->GetBackground(FALSE) != pRepr->GetBackground() )
+ pSet->Put( pRepr->GetBackground() );
+
+ if( pFmt->GetFtnAtTxtEnd(FALSE) != pRepr->GetFtnNtAtEnd() )
+ pSet->Put( pRepr->GetFtnNtAtEnd() );
+
+ if( pFmt->GetEndAtTxtEnd(FALSE) != pRepr->GetEndNtAtEnd() )
+ pSet->Put( pRepr->GetEndNtAtEnd() );
+
+ if( pFmt->GetBalancedColumns() != pRepr->GetBalance() )
+ pSet->Put( pRepr->GetBalance() );
+
+ if( pFmt->GetFrmDir() != pRepr->GetFrmDir() )
+ pSet->Put( pRepr->GetFrmDir() );
+
+ if( pFmt->GetLRSpace() != pRepr->GetLRSpace())
+ pSet->Put( pRepr->GetLRSpace());
+
+ rSh.UpdateSection( nNewPos, pRepr->GetSectionData(),
+ pSet->Count() ? pSet : 0 );
+ delete pSet;
+ }
+ pEntry = aTree.Next( pEntry );
+ }
+
+ for(USHORT i = aSectReprArr.Count(); i; )
+ {
+ SwSectionFmt* pFmt = aOrigArray[ aSectReprArr[ --i ]->GetArrPos() ];
+ USHORT nNewPos = rDocFmts.GetPos( pFmt );
+ if( USHRT_MAX != nNewPos )
+ rSh.DelSectionFmt( nNewPos );
+ }
+// rSh.ChgSectionPasswd(aNewPasswd);
+
+ aOrigArray.Remove( 0, aOrigArray.Count() );
+
+ //JP 21.05.97: EndDialog muss vor Ende der EndAction gerufen werden,
+ // sonst kann es ScrollFehler geben.
+ EndDialog(RET_OK);
+
+ rSh.EndUndo();
+ rSh.EndAllAction();
+
+ return 0;
+}
+/*---------------------------------------------------------------------
+ Beschreibung: Toggle protect
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwEditRegionDlg, ChangeProtectHdl, TriStateBox *, pBox )
+{
+ if(!CheckPasswd(pBox))
+ return 0;
+ pBox->EnableTriState( FALSE );
+ SvLBoxEntry* pEntry=aTree.FirstSelected();
+ DBG_ASSERT(pEntry,"kein Entry gefunden");
+ BOOL bCheck = STATE_CHECK == pBox->GetState();
+ while( pEntry )
+ {
+ SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData();
+ pRepr->GetSectionData().SetProtectFlag(bCheck);
+ Image aImage = BuildBitmap( bCheck,
+ STATE_CHECK == aHideCB.GetState(), FALSE);
+ aTree.SetExpandedEntryBmp(pEntry, aImage, BMP_COLOR_NORMAL);
+ aTree.SetCollapsedEntryBmp(pEntry, aImage, BMP_COLOR_NORMAL);
+ Image aHCImg = BuildBitmap( bCheck, STATE_CHECK == aHideCB.GetState(), TRUE);
+ aTree.SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ aTree.SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ pEntry = aTree.NextSelected(pEntry);
+ }
+ aPasswdCB.Enable(bCheck);
+ aPasswdPB.Enable(bCheck);
+ return 0;
+}
+/*---------------------------------------------------------------------
+ Beschreibung: Toggle hide
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwEditRegionDlg, ChangeHideHdl, TriStateBox *, pBox )
+{
+ if(!CheckPasswd(pBox))
+ return 0;
+ pBox->EnableTriState( FALSE );
+ SvLBoxEntry* pEntry=aTree.FirstSelected();
+ DBG_ASSERT(pEntry,"kein Entry gefunden");
+ while( pEntry )
+ {
+ SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData();
+ pRepr->GetSectionData().SetHidden(STATE_CHECK == pBox->GetState());
+ Image aImage = BuildBitmap(STATE_CHECK == aProtectCB.GetState(),
+ STATE_CHECK == pBox->GetState(), FALSE);
+ aTree.SetExpandedEntryBmp(pEntry, aImage, BMP_COLOR_NORMAL);
+ aTree.SetCollapsedEntryBmp(pEntry, aImage, BMP_COLOR_NORMAL);
+ Image aHCImg = BuildBitmap( STATE_CHECK == aProtectCB.GetState(),
+ STATE_CHECK == pBox->GetState(), TRUE);
+ aTree.SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+ aTree.SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST);
+
+ pEntry = aTree.NextSelected(pEntry);
+ }
+
+ BOOL bHide = STATE_CHECK == pBox->GetState();
+ aConditionED.Enable(bHide);
+ aConditionFT.Enable(bHide);
+ return 0;
+}
+
+/*---------------------------------------------------------------------
+ Beschreibung: Toggle edit in readonly
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwEditRegionDlg, ChangeEditInReadonlyHdl, TriStateBox *, pBox )
+{
+ if(!CheckPasswd(pBox))
+ return 0;
+ pBox->EnableTriState( FALSE );
+ SvLBoxEntry* pEntry=aTree.FirstSelected();
+ DBG_ASSERT(pEntry,"kein Entry gefunden");
+ while( pEntry )
+ {
+ SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData();
+ pRepr->GetSectionData().SetEditInReadonlyFlag(
+ STATE_CHECK == pBox->GetState());
+ pEntry = aTree.NextSelected(pEntry);
+ }
+
+ return 0;
+}
+
+/*---------------------------------------------------------------------
+ Beschreibung: selektierten Bereich aufheben
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwEditRegionDlg, ChangeDismissHdl, CheckBox *, EMPTYARG )
+{
+ if(!CheckPasswd())
+ return 0;
+ SvLBoxEntry* pEntry = aTree.FirstSelected();
+ SvLBoxEntry* pChild;
+ SvLBoxEntry* pParent;
+ //zuerst alle selektierten markieren
+ while(pEntry)
+ {
+ const SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData();
+ pSectRepr->SetSelected();
+ pEntry = aTree.NextSelected(pEntry);
+ }
+ pEntry = aTree.FirstSelected();
+ // dann loeschen
+ while(pEntry)
+ {
+ const SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData();
+ SvLBoxEntry* pRemove = 0;
+ BOOL bRestart = FALSE;
+ if(pSectRepr->IsSelected())
+ {
+ aSectReprArr.Insert( pSectRepr );
+ while( (pChild = aTree.FirstChild(pEntry) )!= 0 )
+ {
+ //durch das Umhaengen muss wieder am Anfang aufgesetzt werden
+ bRestart = TRUE;
+ pParent=aTree.GetParent(pEntry);
+ aTree.GetModel()->Move(pChild, pParent, aTree.GetModel()->GetRelPos(pEntry));
+ }
+ pRemove = pEntry;
+ }
+ if(bRestart)
+ pEntry = aTree.First();
+ else
+ pEntry = aTree.Next(pEntry);
+ if(pRemove)
+ aTree.GetModel()->Remove( pRemove );
+ }
+
+ if ( (pEntry=aTree.FirstSelected()) == 0 )
+ {
+ aConditionFT. Enable(FALSE);
+ aConditionED. Enable(FALSE);
+ aDismiss. Enable(FALSE);
+ aCurName. Enable(FALSE);
+ aProtectCB. Enable(FALSE);
+ aPasswdCB. Enable(FALSE);
+ aHideCB. Enable(FALSE);
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aEditInReadonlyCB.Enable(FALSE);
+ aEditInReadonlyCB.SetState(STATE_NOCHECK);
+ // <--
+ aProtectCB. SetState(STATE_NOCHECK);
+ aPasswdCB. Check(FALSE);
+ aHideCB. SetState(STATE_NOCHECK);
+ aFileCB. Check(FALSE);
+ //sonst liegt der Focus auf dem HelpButton
+ aOK.GrabFocus();
+ UseFileHdl(&aFileCB);
+ }
+ return 0;
+}
+/*---------------------------------------------------------------------
+ Beschreibung: CheckBox mit Datei verknuepfen?
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwEditRegionDlg, UseFileHdl, CheckBox *, pBox )
+{
+ if(!CheckPasswd(pBox))
+ return 0;
+ SvLBoxEntry* pEntry = aTree.FirstSelected();
+ pBox->EnableTriState(FALSE);
+ BOOL bMulti = 1 < aTree.GetSelectionCount();
+ BOOL bFile = pBox->IsChecked();
+ if(pEntry)
+ {
+ while(pEntry)
+ {
+ const SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData();
+ BOOL bContent = pSectRepr->IsContent();
+ if( pBox->IsChecked() && bContent && rSh.HasSelection() )
+ {
+ if( RET_NO == QueryBox( this, SW_RES(QB_CONNECT) ).Execute() )
+ pBox->Check( FALSE );
+ }
+ if( bFile )
+ pSectRepr->SetContent(FALSE);
+ else
+ {
+ pSectRepr->SetFile(aEmptyStr);
+ pSectRepr->SetSubRegion(aEmptyStr);
+ pSectRepr->GetSectionData().SetLinkFilePassword(aEmptyStr);
+ }
+
+ pEntry = aTree.NextSelected(pEntry);
+ }
+ aFileNameFT.Enable(bFile && ! bMulti);
+ aFileNameED.Enable(bFile && ! bMulti);
+ aFilePB.Enable(bFile && ! bMulti);
+ aSubRegionED.Enable(bFile && ! bMulti);
+ aSubRegionFT.Enable(bFile && ! bMulti);
+ aDDECommandFT.Enable(bFile && ! bMulti);
+ aDDECB.Enable(bFile && ! bMulti);
+ if( bFile )
+ {
+ aProtectCB.SetState(STATE_CHECK);
+ aFileNameED.GrabFocus();
+
+ }
+ else
+ {
+ aDDECB.Check(FALSE);
+ DDEHdl(&aDDECB);
+// aFileNameED.SetText(aEmptyStr);
+ aSubRegionED.SetText(aEmptyStr);
+ }
+ }
+ else
+ {
+ pBox->Check(FALSE);
+ pBox->Enable(FALSE);
+ aFilePB.Enable(FALSE);
+ aFileNameED.Enable(FALSE);
+ aFileNameFT.Enable(FALSE);
+ aSubRegionED.Enable(FALSE);
+ aSubRegionFT.Enable(FALSE);
+ aDDECB.Check(FALSE);
+ aDDECB.Enable(FALSE);
+ aDDECommandFT.Enable(FALSE);
+ }
+ return 0;
+}
+
+/*---------------------------------------------------------------------
+ Beschreibung: Dialog Datei einfuegen rufen
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwEditRegionDlg, FileSearchHdl, PushButton *, EMPTYARG )
+{
+ if(!CheckPasswd(0))
+ return 0;
+
+ m_pOldDefDlgParent = Application::GetDefDialogParent();
+ Application::SetDefDialogParent( this );
+ if ( m_pDocInserter )
+ delete m_pDocInserter;
+ m_pDocInserter = new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter") );
+ m_pDocInserter->StartExecuteModal( LINK( this, SwEditRegionDlg, DlgClosedHdl ) );
+ return 0;
+}
+
+/*---------------------------------------------------------------------
+ Beschreibung:
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwEditRegionDlg, OptionsHdl, PushButton *, EMPTYARG )
+{
+ if(!CheckPasswd())
+ return 0;
+ SvLBoxEntry* pEntry = aTree.FirstSelected();
+
+ if(pEntry)
+ {
+ SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData();
+ SfxItemSet aSet(rSh.GetView().GetPool(),
+ RES_COL, RES_COL,
+ RES_COLUMNBALANCE, RES_FRAMEDIR,
+ RES_BACKGROUND, RES_BACKGROUND,
+ RES_FRM_SIZE, RES_FRM_SIZE,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ RES_LR_SPACE, RES_LR_SPACE,
+ RES_FTN_AT_TXTEND, RES_END_AT_TXTEND,
+ 0);
+
+ aSet.Put( pSectRepr->GetCol() );
+ aSet.Put( pSectRepr->GetBackground() );
+ aSet.Put( pSectRepr->GetFtnNtAtEnd() );
+ aSet.Put( pSectRepr->GetEndNtAtEnd() );
+ aSet.Put( pSectRepr->GetBalance() );
+ aSet.Put( pSectRepr->GetFrmDir() );
+ aSet.Put( pSectRepr->GetLRSpace() );
+
+ const SwSectionFmts& rDocFmts = rSh.GetDoc()->GetSections();
+ SwSectionFmts aOrigArray( 0, 5 );
+ aOrigArray.Insert( &rDocFmts, 0 );
+
+ SwSectionFmt* pFmt = aOrigArray[pSectRepr->GetArrPos()];
+ long nWidth = rSh.GetSectionWidth(*pFmt);
+ aOrigArray.Remove( 0, aOrigArray.Count() );
+ if (!nWidth)
+ nWidth = USHRT_MAX;
+
+ aSet.Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth));
+ aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
+
+ SwSectionPropertyTabDialog aTabDlg(this, aSet, rSh);
+ if(RET_OK == aTabDlg.Execute())
+ {
+ const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet();
+ if( pOutSet && pOutSet->Count() )
+ {
+ const SfxPoolItem *pColItem, *pBrushItem,
+ *pFtnItem, *pEndItem, *pBalanceItem,
+ *pFrmDirItem, *pLRSpaceItem;
+ SfxItemState eColState = pOutSet->GetItemState(
+ RES_COL, FALSE, &pColItem );
+ SfxItemState eBrushState = pOutSet->GetItemState(
+ RES_BACKGROUND, FALSE, &pBrushItem );
+ SfxItemState eFtnState = pOutSet->GetItemState(
+ RES_FTN_AT_TXTEND, FALSE, &pFtnItem );
+ SfxItemState eEndState = pOutSet->GetItemState(
+ RES_END_AT_TXTEND, FALSE, &pEndItem );
+ SfxItemState eBalanceState = pOutSet->GetItemState(
+ RES_COLUMNBALANCE, FALSE, &pBalanceItem );
+ SfxItemState eFrmDirState = pOutSet->GetItemState(
+ RES_FRAMEDIR, FALSE, &pFrmDirItem );
+ SfxItemState eLRState = pOutSet->GetItemState(
+ RES_LR_SPACE, FALSE, &pLRSpaceItem);
+
+ if( SFX_ITEM_SET == eColState ||
+ SFX_ITEM_SET == eBrushState ||
+ SFX_ITEM_SET == eFtnState ||
+ SFX_ITEM_SET == eEndState ||
+ SFX_ITEM_SET == eBalanceState||
+ SFX_ITEM_SET == eFrmDirState||
+ SFX_ITEM_SET == eLRState)
+ {
+ SvLBoxEntry* pSelEntry = aTree.FirstSelected();
+ while( pSelEntry )
+ {
+ SectReprPtr pRepr = (SectReprPtr)pSelEntry->GetUserData();
+ if( SFX_ITEM_SET == eColState )
+ pRepr->GetCol() = *(SwFmtCol*)pColItem;
+ if( SFX_ITEM_SET == eBrushState )
+ pRepr->GetBackground() = *(SvxBrushItem*)pBrushItem;
+ if( SFX_ITEM_SET == eFtnState )
+ pRepr->GetFtnNtAtEnd() = *(SwFmtFtnAtTxtEnd*)pFtnItem;
+ if( SFX_ITEM_SET == eEndState )
+ pRepr->GetEndNtAtEnd() = *(SwFmtEndAtTxtEnd*)pEndItem;
+ if( SFX_ITEM_SET == eBalanceState )
+ pRepr->GetBalance().SetValue(((SwFmtNoBalancedColumns*)pBalanceItem)->GetValue());
+ if( SFX_ITEM_SET == eFrmDirState )
+ pRepr->GetFrmDir().SetValue(((SvxFrameDirectionItem*)pFrmDirItem)->GetValue());
+ if( SFX_ITEM_SET == eLRState )
+ pRepr->GetLRSpace() = *(SvxLRSpaceItem*)pLRSpaceItem;
+
+ pSelEntry = aTree.NextSelected(pSelEntry);
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+/*---------------------------------------------------------------------
+ Beschreibung: Uebernahme des Dateinamen oder
+ des verknuepften Bereichs
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwEditRegionDlg, FileNameHdl, Edit *, pEdit )
+{
+ Selection aSelect = pEdit->GetSelection();
+ if(!CheckPasswd())
+ return 0;
+ pEdit->SetSelection(aSelect);
+ SvLBoxEntry* pEntry=aTree.FirstSelected();
+ DBG_ASSERT(pEntry,"kein Entry gefunden");
+ SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData();
+ if(pEdit == &aFileNameED)
+ {
+ bSubRegionsFilled = false;
+ aSubRegionED.Clear();
+ if( aDDECB.IsChecked() )
+ {
+ String sLink( pEdit->GetText() );
+ USHORT nPos = 0;
+ while( STRING_NOTFOUND != (nPos = sLink.SearchAscii( " ", nPos )) )
+ sLink.Erase( nPos--, 1 );
+
+ nPos = sLink.SearchAndReplace( ' ', sfx2::cTokenSeperator );
+ sLink.SearchAndReplace( ' ', sfx2::cTokenSeperator, nPos );
+
+ pSectRepr->GetSectionData().SetLinkFileName( sLink );
+ pSectRepr->GetSectionData().SetType( DDE_LINK_SECTION );
+ }
+ else
+ {
+ String sTmp(pEdit->GetText());
+ if(sTmp.Len())
+ {
+ SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium();
+ INetURLObject aAbs;
+ if( pMedium )
+ aAbs = pMedium->GetURLObject();
+ sTmp = URIHelper::SmartRel2Abs(
+ aAbs, sTmp, URIHelper::GetMaybeFileHdl() );
+ }
+ pSectRepr->SetFile( sTmp );
+ pSectRepr->GetSectionData().SetLinkFilePassword( aEmptyStr );
+ }
+ }
+ else
+ {
+ pSectRepr->SetSubRegion( pEdit->GetText() );
+ }
+ return 0;
+}
+/*---------------------------------------------------------------------
+ Beschreibung:
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwEditRegionDlg, DDEHdl, CheckBox*, pBox )
+{
+ if(!CheckPasswd(pBox))
+ return 0;
+ SvLBoxEntry* pEntry=aTree.FirstSelected();
+ if(pEntry)
+ {
+ BOOL bFile = aFileCB.IsChecked();
+ SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData();
+ SwSectionData & rData( pSectRepr->GetSectionData() );
+ BOOL bDDE = pBox->IsChecked();
+ if(bDDE)
+ {
+ aFileNameFT.Hide();
+ aDDECommandFT.Enable();
+ aDDECommandFT.Show();
+ aSubRegionFT.Hide();
+ aSubRegionED.Hide();
+ if (FILE_LINK_SECTION == rData.GetType())
+ {
+ pSectRepr->SetFile(aEmptyStr);
+ aFileNameED.SetText(aEmptyStr);
+ rData.SetLinkFilePassword( aEmptyStr );
+ }
+ rData.SetType(DDE_LINK_SECTION);
+ }
+ else
+ {
+ aDDECommandFT.Hide();
+ aFileNameFT.Enable(bFile);
+ aFileNameFT.Show();
+ aSubRegionED.Show();
+ aSubRegionFT.Show();
+ aSubRegionED.Enable(bFile);
+ aSubRegionFT.Enable(bFile);
+ aSubRegionED.Enable(bFile);
+ if (DDE_LINK_SECTION == rData.GetType())
+ {
+ rData.SetType(FILE_LINK_SECTION);
+ pSectRepr->SetFile(aEmptyStr);
+ rData.SetLinkFilePassword( aEmptyStr );
+ aFileNameED.SetText(aEmptyStr);
+ }
+ }
+ aFilePB.Enable(bFile && !bDDE);
+ }
+ return 0;
+}
+/*---------------------------------------------------------------------
+
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwEditRegionDlg, ChangePasswdHdl, Button *, pBox )
+{
+ sal_Bool bChange = pBox == &aPasswdPB;
+ if(!CheckPasswd(0))
+ {
+ if(!bChange)
+ aPasswdCB.Check(!aPasswdCB.IsChecked());
+ return 0;
+ }
+ SvLBoxEntry* pEntry=aTree.FirstSelected();
+ sal_Bool bSet = bChange ? bChange : aPasswdCB.IsChecked();
+ DBG_ASSERT(pEntry,"kein Entry gefunden");
+ while( pEntry )
+ {
+ SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData();
+ if(bSet)
+ {
+ if(!pRepr->GetTempPasswd().getLength() || bChange)
+ {
+ SwTestPasswdDlg aPasswdDlg(this);
+ aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM);
+ if(RET_OK == aPasswdDlg.Execute())
+ {
+ String sNewPasswd( aPasswdDlg.GetPassword() );
+ if( aPasswdDlg.GetConfirm() == sNewPasswd )
+ {
+ SvPasswordHelper::GetHashPassword( pRepr->GetTempPasswd(), sNewPasswd );
+ }
+ else
+ {
+ InfoBox(pBox, SW_RES(REG_WRONG_PASSWD_REPEAT)).Execute();
+ ChangePasswdHdl(pBox);
+ break;
+ }
+ }
+ else
+ {
+ if(!bChange)
+ aPasswdCB.Check(FALSE);
+ break;
+ }
+ }
+ pRepr->GetSectionData().SetPassword(pRepr->GetTempPasswd());
+ }
+ else
+ {
+ pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >());
+ }
+ pEntry = aTree.NextSelected(pEntry);
+ }
+ return 0;
+}
+/*---------------------------------------------------------------------
+ Beschreibung: Aktueller Bereichsname wird sofort beim editieren
+ in die TreeListBox eingetragen, mit leerem String
+ kein Ok()
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwEditRegionDlg, NameEditHdl, Edit *, EMPTYARG )
+{
+ if(!CheckPasswd(0))
+ return 0;
+ SvLBoxEntry* pEntry=aTree.FirstSelected();
+ DBG_ASSERT(pEntry,"kein Entry gefunden");
+ if (pEntry)
+ {
+ String aName = aCurName.GetText();
+ aTree.SetEntryText(pEntry,aName);
+ SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData();
+ pRepr->GetSectionData().SetSectionName(aName);
+
+ aOK.Enable(aName.Len() != 0);
+ }
+ return 0;
+}
+/*---------------------------------------------------------------------
+
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwEditRegionDlg, ConditionEditHdl, Edit *, pEdit )
+{
+ Selection aSelect = pEdit->GetSelection();
+ if(!CheckPasswd(0))
+ return 0;
+ pEdit->SetSelection(aSelect);
+ SvLBoxEntry* pEntry = aTree.FirstSelected();
+ DBG_ASSERT(pEntry,"kein Entry gefunden");
+ while( pEntry )
+ {
+ SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData();
+ pRepr->GetSectionData().SetCondition(pEdit->GetText());
+ pEntry = aTree.NextSelected(pEntry);
+ }
+ return 0;
+}
+
+IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg )
+{
+ String sFileName, sFilterName, sPassword;
+ if ( _pFileDlg->GetError() == ERRCODE_NONE )
+ {
+ SfxMedium* pMedium = m_pDocInserter->CreateMedium();
+ if ( pMedium )
+ {
+ sFileName = pMedium->GetURLObject().GetMainURL( INetURLObject::NO_DECODE );
+ sFilterName = pMedium->GetFilter()->GetFilterName();
+ const SfxPoolItem* pItem;
+ if ( SFX_ITEM_SET == pMedium->GetItemSet()->GetItemState( SID_PASSWORD, FALSE, &pItem ) )
+ sPassword = ( (SfxStringItem*)pItem )->GetValue();
+ ::lcl_ReadSections( *pMedium, aSubRegionED );
+ delete pMedium;
+ }
+ }
+
+ SvLBoxEntry* pEntry = aTree.FirstSelected();
+ DBG_ASSERT( pEntry, "no entry found" );
+ if ( pEntry )
+ {
+ SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData();
+ pSectRepr->SetFile( sFileName );
+ pSectRepr->SetFilter( sFilterName );
+ pSectRepr->GetSectionData().SetLinkFilePassword(sPassword);
+ aFileNameED.SetText( pSectRepr->GetFile() );
+ }
+
+ Application::SetDefDialogParent( m_pOldDefDlgParent );
+ return 0;
+}
+/*-- 03.09.2009 16:24:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwEditRegionDlg, SubRegionEventHdl, VclWindowEvent *, pEvent )
+{
+ if( !bSubRegionsFilled && pEvent && pEvent->GetId() == VCLEVENT_DROPDOWN_PRE_OPEN )
+ {
+ //if necessary fill the names bookmarks/sections/tables now
+
+ rtl::OUString sFileName = aFileNameED.GetText();
+ if(sFileName.getLength())
+ {
+ SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium();
+ INetURLObject aAbs;
+ if( pMedium )
+ aAbs = pMedium->GetURLObject();
+ sFileName = URIHelper::SmartRel2Abs(
+ aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
+
+ //load file and set the shell
+ SfxMedium aMedium( sFileName, STREAM_STD_READ );
+ sFileName = aMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE );
+ ::lcl_ReadSections( aMedium, aSubRegionED );
+ }
+ else
+ lcl_FillSubRegionList( rSh, aSubRegionED, 0 );
+ bSubRegionsFilled = true;
+ }
+ return 0;
+}
+
+/* -----------------------------08.05.2002 15:00------------------------------
+
+ ---------------------------------------------------------------------------*/
+Image SwEditRegionDlg::BuildBitmap(BOOL bProtect,BOOL bHidden, BOOL bHighContrast)
+{
+ ImageList& rImgLst = bHighContrast ? aImageILH : aImageIL;
+ return rImgLst.GetImage((!bHidden+(bProtect<<1)) + 1);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Hilfsfunktion - Bereichsnamen aus dem Medium lesen
+ --------------------------------------------------------------------*/
+
+static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox )
+{
+ rBox.Clear();
+ uno::Reference < embed::XStorage > xStg;
+ if( rMedium.IsStorage() && (xStg = rMedium.GetStorage()).is() )
+ {
+ SvStrings aArr( 10, 10 );
+ sal_uInt32 nFormat = SotStorage::GetFormatID( xStg );
+ if ( nFormat == SOT_FORMATSTR_ID_STARWRITER_60 || nFormat == SOT_FORMATSTR_ID_STARWRITERGLOB_60 ||
+ nFormat == SOT_FORMATSTR_ID_STARWRITER_8 || nFormat == SOT_FORMATSTR_ID_STARWRITERGLOB_8)
+ SwGetReaderXML()->GetSectionList( rMedium, aArr );
+
+ for( USHORT n = 0; n < aArr.Count(); ++n )
+ rBox.InsertEntry( *aArr[ n ] );
+
+ aArr.DeleteAndDestroy(0, aArr.Count());
+ }
+}
+/* -----------------21.05.99 10:16-------------------
+ *
+ * --------------------------------------------------*/
+SwInsertSectionTabDialog::SwInsertSectionTabDialog(
+ Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh) :
+ SfxTabDialog( pParent, SW_RES(DLG_INSERT_SECTION), &rSet ),
+ rWrtSh(rSh)
+ , m_pSectionData(0)
+{
+ String sInsert(SW_RES(ST_INSERT));
+ GetOKButton().SetText(sInsert);
+ FreeResource();
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AddTabPage(TP_INSERT_SECTION, SwInsertSectionTabPage::Create, 0);
+ AddTabPage(TP_COLUMN, SwColumnPage::Create, 0);
+ AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0);
+ AddTabPage(TP_SECTION_FTNENDNOTES, SwSectionFtnEndTabPage::Create, 0);
+ AddTabPage(TP_SECTION_INDENTS, SwSectionIndentTabPage::Create, 0);
+
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ long nHtmlMode = pHtmlOpt->GetExportMode();
+
+ BOOL bWeb = 0 != PTR_CAST( SwWebDocShell, rSh.GetView().GetDocShell() );
+ if(bWeb)
+ {
+ RemoveTabPage(TP_SECTION_FTNENDNOTES);
+ RemoveTabPage(TP_SECTION_INDENTS);
+ if( HTML_CFG_NS40 != nHtmlMode && HTML_CFG_WRITER != nHtmlMode)
+ RemoveTabPage(TP_COLUMN);
+ }
+ SetCurPageId(TP_INSERT_SECTION);
+}
+/* -----------------21.05.99 10:17-------------------
+ *
+ * --------------------------------------------------*/
+SwInsertSectionTabDialog::~SwInsertSectionTabDialog()
+{
+}
+/* -----------------21.05.99 10:23-------------------
+ *
+ * --------------------------------------------------*/
+void SwInsertSectionTabDialog::PageCreated( USHORT nId, SfxTabPage &rPage )
+{
+ if(TP_INSERT_SECTION == nId)
+ ((SwInsertSectionTabPage&)rPage).SetWrtShell(rWrtSh);
+ else if( TP_BACKGROUND == nId )
+ {
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR));
+ rPage.PageCreated(aSet);
+ }
+ else if( TP_COLUMN == nId )
+ {
+ const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)GetInputSetImpl()->Get(RES_FRM_SIZE);
+ ((SwColumnPage&)rPage).SetPageWidth(rSize.GetWidth());
+ ((SwColumnPage&)rPage).ShowBalance(TRUE);
+ ((SwColumnPage&)rPage).SetInSection(TRUE);
+ }
+ else if(TP_SECTION_INDENTS == nId)
+ ((SwSectionIndentTabPage&)rPage).SetWrtShell(rWrtSh);
+}
+/* -----------------21.05.99 13:08-------------------
+ *
+ * --------------------------------------------------*/
+
+void SwInsertSectionTabDialog::SetSectionData(SwSectionData const& rSect)
+{
+ m_pSectionData.reset( new SwSectionData(rSect) );
+}
+/* -----------------21.05.99 13:10-------------------
+ *
+ * --------------------------------------------------*/
+short SwInsertSectionTabDialog::Ok()
+{
+ short nRet = SfxTabDialog::Ok();
+ DBG_ASSERT(m_pSectionData.get(),
+ "SwInsertSectionTabDialog: no SectionData?");
+ const SfxItemSet* pOutputItemSet = GetOutputItemSet();
+ rWrtSh.InsertSection(*m_pSectionData, pOutputItemSet);
+ SfxViewFrame* pViewFrm = rWrtSh.GetView().GetViewFrame();
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ pViewFrm->GetBindings().GetRecorder();
+ if ( xRecorder.is() )
+ {
+ SfxRequest aRequest( pViewFrm, FN_INSERT_REGION);
+ const SfxPoolItem* pCol;
+ if(SFX_ITEM_SET == pOutputItemSet->GetItemState(RES_COL, FALSE, &pCol))
+ {
+ aRequest.AppendItem(SfxUInt16Item(SID_ATTR_COLUMNS,
+ ((const SwFmtCol*)pCol)->GetColumns().Count()));
+ }
+ aRequest.AppendItem(SfxStringItem( FN_PARAM_REGION_NAME,
+ m_pSectionData->GetSectionName()));
+ aRequest.AppendItem(SfxStringItem( FN_PARAM_REGION_CONDITION,
+ m_pSectionData->GetCondition()));
+ aRequest.AppendItem(SfxBoolItem( FN_PARAM_REGION_HIDDEN,
+ m_pSectionData->IsHidden()));
+ aRequest.AppendItem(SfxBoolItem( FN_PARAM_REGION_PROTECT,
+ m_pSectionData->IsProtectFlag()));
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aRequest.AppendItem(SfxBoolItem( FN_PARAM_REGION_EDIT_IN_READONLY,
+ m_pSectionData->IsEditInReadonlyFlag()));
+ // <--
+
+ String sLinkFileName( m_pSectionData->GetLinkFileName() );
+ aRequest.AppendItem(SfxStringItem( FN_PARAM_1, sLinkFileName.GetToken( 0, sfx2::cTokenSeperator )));
+ aRequest.AppendItem(SfxStringItem( FN_PARAM_2, sLinkFileName.GetToken( 1, sfx2::cTokenSeperator )));
+ aRequest.AppendItem(SfxStringItem( FN_PARAM_3, sLinkFileName.GetToken( 2, sfx2::cTokenSeperator )));
+ aRequest.Done();
+ }
+ return nRet;
+}
+
+/* -----------------21.05.99 10:31-------------------
+ *
+ * --------------------------------------------------*/
+SwInsertSectionTabPage::SwInsertSectionTabPage(
+ Window *pParent, const SfxItemSet &rAttrSet) :
+ SfxTabPage( pParent, SW_RES(TP_INSERT_SECTION), rAttrSet ),
+ aNameFL ( this, SW_RES( FL_NAME ) ),
+ aCurName ( this, SW_RES( ED_RNAME ) ),
+ aLinkFL ( this, SW_RES( FL_LINK ) ),
+ aFileCB ( this, SW_RES( CB_FILE ) ),
+ aDDECB ( this, SW_RES( CB_DDE ) ) ,
+ aDDECommandFT ( this, SW_RES( FT_DDE ) ) ,
+ aFileNameFT ( this, SW_RES( FT_FILE ) ) ,
+ aFileNameED ( this, SW_RES( ED_FILE ) ),
+ aFilePB ( this, SW_RES( PB_FILE ) ),
+ aSubRegionFT ( this, SW_RES( FT_SUBREG ) ) ,
+ aSubRegionED ( this, SW_RES( LB_SUBREG ) ) ,
+
+ aProtectFL ( this, SW_RES( FL_PROTECT ) ),
+ aProtectCB ( this, SW_RES( CB_PROTECT ) ),
+ aPasswdCB ( this, SW_RES( CB_PASSWD ) ),
+ aPasswdPB ( this, SW_RES( PB_PASSWD ) ),
+
+ aHideFL ( this, SW_RES( FL_HIDE ) ),
+ aHideCB ( this, SW_RES( CB_HIDE ) ),
+ aConditionFT ( this, SW_RES( FT_CONDITION ) ),
+ aConditionED ( this, SW_RES( ED_CONDITION ) ),
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aPropertiesFL ( this, SW_RES( FL_PROPERTIES ) ),
+ aEditInReadonlyCB ( this, SW_RES( CB_EDIT_IN_READONLY ) ),
+ // <--
+
+ m_pWrtSh(0),
+ m_pDocInserter(NULL),
+ m_pOldDefDlgParent(NULL)
+{
+ FreeResource();
+
+ aProtectCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangeProtectHdl));
+ aPasswdCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangePasswdHdl));
+ aPasswdPB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangePasswdHdl));
+ aHideCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangeHideHdl));
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aEditInReadonlyCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangeEditInReadonlyHdl));
+ // <--
+ aFileCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, UseFileHdl ));
+ aFilePB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, FileSearchHdl ));
+ aCurName.SetModifyHdl ( LINK( this, SwInsertSectionTabPage, NameEditHdl));
+ aDDECB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, DDEHdl ));
+ ChangeProtectHdl(&aProtectCB);
+ aSubRegionED.EnableAutocomplete( sal_True, sal_True );
+}
+/* -----------------21.05.99 10:31-------------------
+ *
+ * --------------------------------------------------*/
+SwInsertSectionTabPage::~SwInsertSectionTabPage()
+{
+ delete m_pDocInserter;
+}
+
+void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh)
+{
+ m_pWrtSh = &rSh;
+
+ BOOL bWeb = 0 != PTR_CAST(SwWebDocShell, m_pWrtSh->GetView().GetDocShell());
+ if(bWeb)
+ {
+ aHideCB .Hide();
+ aConditionED .Hide();
+ aConditionFT .Hide();
+ aDDECB .Hide();
+ aDDECommandFT .Hide();
+ }
+
+ lcl_FillSubRegionList( *m_pWrtSh, aSubRegionED, &aCurName );
+
+ SwSectionData *const pSectionData =
+ static_cast<SwInsertSectionTabDialog*>(GetTabDialog())
+ ->GetSectionData();
+ if (pSectionData) // something set?
+ {
+ aCurName.SetText(
+ rSh.GetUniqueSectionName(& pSectionData->GetSectionName()));
+ aProtectCB.Check( 0 != pSectionData->IsProtectFlag() );
+ m_sFileName = pSectionData->GetLinkFileName();
+ m_sFilePasswd = pSectionData->GetLinkFilePassword();
+ aFileCB.Check( 0 != m_sFileName.Len() );
+ aFileNameED.SetText( m_sFileName );
+ UseFileHdl( &aFileCB );
+ }
+ else
+ {
+ aCurName.SetText( rSh.GetUniqueSectionName() );
+ }
+}
+/* -----------------21.05.99 10:32-------------------
+ *
+ * --------------------------------------------------*/
+BOOL SwInsertSectionTabPage::FillItemSet( SfxItemSet& )
+{
+ SwSectionData aSection(CONTENT_SECTION, aCurName.GetText());
+ aSection.SetCondition(aConditionED.GetText());
+ BOOL bProtected = aProtectCB.IsChecked();
+ aSection.SetProtectFlag(bProtected);
+ aSection.SetHidden(aHideCB.IsChecked());
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ aSection.SetEditInReadonlyFlag(aEditInReadonlyCB.IsChecked());
+ // <--
+ if(bProtected)
+ {
+ aSection.SetPassword(m_aNewPasswd);
+ }
+ String sFileName = aFileNameED.GetText();
+ String sSubRegion = aSubRegionED.GetText();
+ BOOL bDDe = aDDECB.IsChecked();
+ if(aFileCB.IsChecked() && (sFileName.Len() || sSubRegion.Len() || bDDe))
+ {
+ String aLinkFile;
+ if( bDDe )
+ {
+ aLinkFile = sFileName;
+
+ USHORT nPos = 0;
+ while( STRING_NOTFOUND != (nPos = aLinkFile.SearchAscii( " ", nPos )) )
+ aLinkFile.Erase( nPos--, 1 );
+
+ nPos = aLinkFile.SearchAndReplace( ' ', sfx2::cTokenSeperator );
+ aLinkFile.SearchAndReplace( ' ', sfx2::cTokenSeperator, nPos );
+ }
+ else
+ {
+ if(sFileName.Len())
+ {
+ SfxMedium* pMedium = m_pWrtSh->GetView().GetDocShell()->GetMedium();
+ INetURLObject aAbs;
+ if( pMedium )
+ aAbs = pMedium->GetURLObject();
+ aLinkFile = URIHelper::SmartRel2Abs(
+ aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
+ aSection.SetLinkFilePassword( m_sFilePasswd );
+ }
+
+ aLinkFile += sfx2::cTokenSeperator;
+ aLinkFile += m_sFilterName;
+ aLinkFile += sfx2::cTokenSeperator;
+ aLinkFile += sSubRegion;
+ }
+
+ aSection.SetLinkFileName(aLinkFile);
+ if(aLinkFile.Len())
+ {
+ aSection.SetType( aDDECB.IsChecked() ?
+ DDE_LINK_SECTION :
+ FILE_LINK_SECTION);
+ }
+ }
+ ((SwInsertSectionTabDialog*)GetTabDialog())->SetSectionData(aSection);
+ return TRUE;
+}
+/* -----------------21.05.99 10:32-------------------
+ *
+ * --------------------------------------------------*/
+void SwInsertSectionTabPage::Reset( const SfxItemSet& )
+{
+}
+/* -----------------21.05.99 11:22-------------------
+ *
+ * --------------------------------------------------*/
+SfxTabPage* SwInsertSectionTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SwInsertSectionTabPage(pParent, rAttrSet);
+}
+/*---------------------------------------------------------------------
+
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwInsertSectionTabPage, ChangeHideHdl, CheckBox *, pBox )
+{
+ BOOL bHide = pBox->IsChecked();
+ aConditionED.Enable(bHide);
+ aConditionFT.Enable(bHide);
+ return 0;
+}
+/*---------------------------------------------------------------------
+
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwInsertSectionTabPage, ChangeEditInReadonlyHdl, CheckBox *, EMPTYARG )
+{
+ return 0;
+}
+/*---------------------------------------------------------------------
+
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwInsertSectionTabPage, ChangeProtectHdl, CheckBox *, pBox )
+{
+ sal_Bool bCheck = pBox->IsChecked();
+ aPasswdCB.Enable(bCheck);
+ aPasswdPB.Enable(bCheck);
+ return 0;
+}
+/* -----------------------------26.04.01 14:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SwInsertSectionTabPage, ChangePasswdHdl, Button *, pButton )
+{
+ sal_Bool bChange = pButton == &aPasswdPB;
+ sal_Bool bSet = bChange ? bChange : aPasswdCB.IsChecked();
+ if(bSet)
+ {
+ if(!m_aNewPasswd.getLength() || bChange)
+ {
+ SwTestPasswdDlg aPasswdDlg(this);
+ aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM);
+ if(RET_OK == aPasswdDlg.Execute())
+ {
+ String sNewPasswd( aPasswdDlg.GetPassword() );
+ if( aPasswdDlg.GetConfirm() == sNewPasswd )
+ {
+ SvPasswordHelper::GetHashPassword( m_aNewPasswd, sNewPasswd );
+ }
+ else
+ {
+ InfoBox(pButton, SW_RES(REG_WRONG_PASSWD_REPEAT)).Execute();
+ }
+ }
+ else if(!bChange)
+ aPasswdCB.Check(FALSE);
+ }
+ }
+ else
+ m_aNewPasswd.realloc(0);
+ return 0;
+}
+/*---------------------------------------------------------------------
+
+---------------------------------------------------------------------*/
+
+IMPL_LINK_INLINE_START( SwInsertSectionTabPage, NameEditHdl, Edit *, EMPTYARG )
+{
+ String aName=aCurName.GetText();
+ GetTabDialog()->GetOKButton().Enable(aName.Len() && aCurName.GetEntryPos( aName ) == USHRT_MAX);
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwInsertSectionTabPage, NameEditHdl, Edit *, EMPTYARG )
+
+/*---------------------------------------------------------------------
+
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwInsertSectionTabPage, UseFileHdl, CheckBox *, pBox )
+{
+ if( pBox->IsChecked() )
+ {
+ if( m_pWrtSh->HasSelection() &&
+ RET_NO == QueryBox( this, SW_RES(QB_CONNECT) ).Execute() )
+ pBox->Check( FALSE );
+ }
+
+ BOOL bFile = pBox->IsChecked();
+ aFileNameFT.Enable(bFile);
+ aFileNameED.Enable(bFile);
+ aFilePB.Enable(bFile);
+ aSubRegionFT.Enable(bFile);
+ aSubRegionED.Enable(bFile);
+ aDDECommandFT.Enable(bFile);
+ aDDECB.Enable(bFile);
+ if( bFile )
+ {
+// aFileNameED.SetText( aFileName );
+ aFileNameED.GrabFocus();
+ aProtectCB.Check( TRUE );
+ }
+ else
+ {
+ aDDECB.Check(FALSE);
+ DDEHdl(&aDDECB);
+// aFileNameED.SetText(aEmptyStr);
+ }
+ return 0;
+}
+
+/*---------------------------------------------------------------------
+
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwInsertSectionTabPage, FileSearchHdl, PushButton *, EMPTYARG )
+{
+ m_pOldDefDlgParent = Application::GetDefDialogParent();
+ Application::SetDefDialogParent( this );
+ if ( m_pDocInserter )
+ delete m_pDocInserter;
+ m_pDocInserter = new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter") );
+ m_pDocInserter->StartExecuteModal( LINK( this, SwInsertSectionTabPage, DlgClosedHdl ) );
+ return 0;
+}
+
+/*---------------------------------------------------------------------
+
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwInsertSectionTabPage, DDEHdl, CheckBox*, pBox )
+{
+ BOOL bDDE = pBox->IsChecked();
+ BOOL bFile = aFileCB.IsChecked();
+ aFilePB.Enable(!bDDE && bFile);
+ if(bDDE)
+ {
+ aFileNameFT.Hide();
+ aDDECommandFT.Enable(bDDE);
+ aDDECommandFT.Show();
+ aSubRegionFT.Hide();
+ aSubRegionED.Hide();
+ }
+ else
+ {
+ aDDECommandFT.Hide();
+ aFileNameFT.Enable(bFile);
+ aFileNameFT.Show();
+ aSubRegionFT.Show();
+ aSubRegionED.Show();
+ aSubRegionED.Enable(bFile);
+ }
+ return 0;
+}
+
+IMPL_LINK( SwInsertSectionTabPage, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg )
+{
+ if ( _pFileDlg->GetError() == ERRCODE_NONE )
+ {
+ SfxMedium* pMedium = m_pDocInserter->CreateMedium();
+ if ( pMedium )
+ {
+ m_sFileName = pMedium->GetURLObject().GetMainURL( INetURLObject::NO_DECODE );
+ m_sFilterName = pMedium->GetFilter()->GetFilterName();
+ const SfxPoolItem* pItem;
+ if ( SFX_ITEM_SET == pMedium->GetItemSet()->GetItemState( SID_PASSWORD, FALSE, &pItem ) )
+ m_sFilePasswd = ( (SfxStringItem*)pItem )->GetValue();
+ aFileNameED.SetText( INetURLObject::decode(
+ m_sFileName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS, RTL_TEXTENCODING_UTF8 ) );
+ ::lcl_ReadSections( *pMedium, aSubRegionED );
+ delete pMedium;
+ }
+ }
+ else
+ m_sFilterName = m_sFilePasswd = aEmptyStr;
+
+ Application::SetDefDialogParent( m_pOldDefDlgParent );
+ return 0;
+}
+
+// --------------------------------------------------------------
+
+// Numerierungsformat Umsetzung:
+// ListBox - Format - Enum-Wert
+// 0 - A, B, C, ... - 0
+// 1 - a, b, c, ... - 1
+// 2 - I, II, III, ... - 2
+// 3 - i, ii, iii, ... - 3
+// 4 - 1, 2, 3, ... - 4
+// 5 - A, .., AA, .., - 9
+// 6 - a, .., aa, .., - 10
+
+inline USHORT GetNumPos( USHORT n )
+{
+ return SVX_NUM_ARABIC < n ? n - 4 : n;
+}
+
+inline SvxExtNumType GetNumType( USHORT n )
+{
+ return (SvxExtNumType)(4 < n ? n + 4 : n );
+}
+
+SwSectionFtnEndTabPage::SwSectionFtnEndTabPage( Window *pParent,
+ const SfxItemSet &rAttrSet)
+ : SfxTabPage( pParent, SW_RES( TP_SECTION_FTNENDNOTES ), rAttrSet ),
+ aFtnFL ( this, SW_RES( FL_FTN ) ),
+ aFtnNtAtTextEndCB ( this, SW_RES( CB_FTN_AT_TXTEND ) ),
+
+ aFtnNtNumCB ( this, SW_RES( CB_FTN_NUM ) ),
+ aFtnOffsetLbl ( this, SW_RES( FT_FTN_OFFSET )),
+ aFtnOffsetFld ( this, SW_RES( FLD_FTN_OFFSET )),
+
+ aFtnNtNumFmtCB ( this, SW_RES( CB_FTN_NUM_FMT ) ),
+ aFtnPrefixFT ( this, SW_RES( FT_FTN_PREFIX )),
+ aFtnPrefixED ( this, SW_RES( ED_FTN_PREFIX )),
+ aFtnNumViewBox ( this, SW_RES( LB_FTN_NUMVIEW ), INSERT_NUM_EXTENDED_TYPES),
+ aFtnSuffixFT ( this, SW_RES( FT_FTN_SUFFIX )),
+ aFtnSuffixED ( this, SW_RES( ED_FTN_SUFFIX )),
+
+ aEndFL ( this, SW_RES( FL_END ) ),
+ aEndNtAtTextEndCB ( this, SW_RES( CB_END_AT_TXTEND )),
+
+ aEndNtNumCB ( this, SW_RES( CB_END_NUM )),
+ aEndOffsetLbl ( this, SW_RES( FT_END_OFFSET )),
+ aEndOffsetFld ( this, SW_RES( FLD_END_OFFSET )),
+
+ aEndNtNumFmtCB ( this, SW_RES( CB_END_NUM_FMT ) ),
+ aEndPrefixFT ( this, SW_RES( FT_END_PREFIX )),
+ aEndPrefixED ( this, SW_RES( ED_END_PREFIX )),
+ aEndNumViewBox ( this, SW_RES( LB_END_NUMVIEW ), INSERT_NUM_EXTENDED_TYPES),
+ aEndSuffixFT ( this, SW_RES( FT_END_SUFFIX )),
+ aEndSuffixED ( this, SW_RES( ED_END_SUFFIX ))
+{
+ FreeResource();
+
+ Link aLk( LINK( this, SwSectionFtnEndTabPage, FootEndHdl));
+ aFtnNtAtTextEndCB.SetClickHdl( aLk );
+ aFtnNtNumCB.SetClickHdl( aLk );
+ aEndNtAtTextEndCB.SetClickHdl( aLk );
+ aEndNtNumCB.SetClickHdl( aLk );
+ aFtnNtNumFmtCB.SetClickHdl( aLk );
+ aEndNtNumFmtCB.SetClickHdl( aLk );
+}
+
+SwSectionFtnEndTabPage::~SwSectionFtnEndTabPage()
+{
+}
+
+BOOL SwSectionFtnEndTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ SwFmtFtnAtTxtEnd aFtn( aFtnNtAtTextEndCB.IsChecked()
+ ? ( aFtnNtNumCB.IsChecked()
+ ? ( aFtnNtNumFmtCB.IsChecked()
+ ? FTNEND_ATTXTEND_OWNNUMANDFMT
+ : FTNEND_ATTXTEND_OWNNUMSEQ )
+ : FTNEND_ATTXTEND )
+ : FTNEND_ATPGORDOCEND );
+
+ switch( aFtn.GetValue() )
+ {
+ case FTNEND_ATTXTEND_OWNNUMANDFMT:
+ aFtn.SetNumType( aFtnNumViewBox.GetSelectedNumberingType() );
+ aFtn.SetPrefix( aFtnPrefixED.GetText() );
+ aFtn.SetSuffix( aFtnSuffixED.GetText() );
+ // no break;
+
+ case FTNEND_ATTXTEND_OWNNUMSEQ:
+ aFtn.SetOffset( static_cast< USHORT >( aFtnOffsetFld.GetValue()-1 ) );
+ // no break;
+ }
+
+ SwFmtEndAtTxtEnd aEnd( aEndNtAtTextEndCB.IsChecked()
+ ? ( aEndNtNumCB.IsChecked()
+ ? ( aEndNtNumFmtCB.IsChecked()
+ ? FTNEND_ATTXTEND_OWNNUMANDFMT
+ : FTNEND_ATTXTEND_OWNNUMSEQ )
+ : FTNEND_ATTXTEND )
+ : FTNEND_ATPGORDOCEND );
+
+ switch( aEnd.GetValue() )
+ {
+ case FTNEND_ATTXTEND_OWNNUMANDFMT:
+ aEnd.SetNumType( aEndNumViewBox.GetSelectedNumberingType() );
+ aEnd.SetPrefix( aEndPrefixED.GetText() );
+ aEnd.SetSuffix( aEndSuffixED.GetText() );
+ // no break;
+
+ case FTNEND_ATTXTEND_OWNNUMSEQ:
+ aEnd.SetOffset( static_cast< USHORT >( aEndOffsetFld.GetValue()-1 ) );
+ // no break;
+ }
+
+ rSet.Put( aFtn );
+ rSet.Put( aEnd );
+
+ return TRUE;
+}
+
+void SwSectionFtnEndTabPage::ResetState( BOOL bFtn,
+ const SwFmtFtnEndAtTxtEnd& rAttr )
+{
+ CheckBox *pNtAtTextEndCB, *pNtNumCB, *pNtNumFmtCB;
+ FixedText*pPrefixFT, *pSuffixFT;
+ Edit *pPrefixED, *pSuffixED;
+ SwNumberingTypeListBox *pNumViewBox;
+ FixedText* pOffsetTxt;
+ NumericField *pOffsetFld;
+
+ if( bFtn )
+ {
+ pNtAtTextEndCB = &aFtnNtAtTextEndCB;
+ pNtNumCB = &aFtnNtNumCB;
+ pNtNumFmtCB = &aFtnNtNumFmtCB;
+ pPrefixFT = &aFtnPrefixFT;
+ pPrefixED = &aFtnPrefixED;
+ pSuffixFT = &aFtnSuffixFT;
+ pSuffixED = &aFtnSuffixED;
+ pNumViewBox = &aFtnNumViewBox;
+ pOffsetTxt = &aFtnOffsetLbl;
+ pOffsetFld = &aFtnOffsetFld;
+ }
+ else
+ {
+ pNtAtTextEndCB = &aEndNtAtTextEndCB;
+ pNtNumCB = &aEndNtNumCB;
+ pNtNumFmtCB = &aEndNtNumFmtCB;
+ pPrefixFT = &aEndPrefixFT;
+ pPrefixED = &aEndPrefixED;
+ pSuffixFT = &aEndSuffixFT;
+ pSuffixED = &aEndSuffixED;
+ pNumViewBox = &aEndNumViewBox;
+ pOffsetTxt = &aEndOffsetLbl;
+ pOffsetFld = &aEndOffsetFld;
+ }
+
+ USHORT eState = rAttr.GetValue();
+ switch( eState )
+ {
+ // case FTNEND_ATPGORDOCEND:
+ case FTNEND_ATTXTEND_OWNNUMANDFMT:
+ pNtNumFmtCB->SetState( STATE_CHECK );
+ // no break;
+
+ case FTNEND_ATTXTEND_OWNNUMSEQ:
+ pNtNumCB->SetState( STATE_CHECK );
+ // no break;
+
+ case FTNEND_ATTXTEND:
+ pNtAtTextEndCB->SetState( STATE_CHECK );
+ // no break;
+ }
+
+ pNumViewBox->SelectNumberingType( rAttr.GetNumType() );
+ pOffsetFld->SetValue( rAttr.GetOffset() + 1 );
+ pPrefixED->SetText( rAttr.GetPrefix() );
+ pSuffixED->SetText( rAttr.GetSuffix() );
+
+ switch( eState )
+ {
+ case FTNEND_ATPGORDOCEND:
+ pNtNumCB->Enable( FALSE );
+ // no break;
+
+ case FTNEND_ATTXTEND:
+ pNtNumFmtCB->Enable( FALSE );
+ pOffsetFld->Enable( FALSE );
+ pOffsetTxt->Enable( FALSE );
+ // no break;
+
+ case FTNEND_ATTXTEND_OWNNUMSEQ:
+ pNumViewBox->Enable( FALSE );
+ pPrefixFT->Enable( FALSE );
+ pPrefixED->Enable( FALSE );
+ pSuffixFT->Enable( FALSE );
+ pSuffixED->Enable( FALSE );
+ // no break;
+ }
+}
+
+void SwSectionFtnEndTabPage::Reset( const SfxItemSet& rSet )
+{
+ ResetState( TRUE, (const SwFmtFtnAtTxtEnd&)rSet.Get(
+ RES_FTN_AT_TXTEND, FALSE ));
+ ResetState( FALSE, (const SwFmtEndAtTxtEnd&)rSet.Get(
+ RES_END_AT_TXTEND, FALSE ));
+}
+
+SfxTabPage* SwSectionFtnEndTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SwSectionFtnEndTabPage(pParent, rAttrSet);
+}
+
+IMPL_LINK( SwSectionFtnEndTabPage, FootEndHdl, CheckBox *, pBox )
+{
+// pBox->EnableTriState( FALSE );
+ BOOL bFoot = &aFtnNtAtTextEndCB == pBox || &aFtnNtNumCB == pBox ||
+ &aFtnNtNumFmtCB == pBox ;
+
+ CheckBox *pNumBox, *pNumFmtBox, *pEndBox;
+ SwNumberingTypeListBox* pNumViewBox;
+ FixedText* pOffsetTxt;
+ NumericField *pOffsetFld;
+ FixedText*pPrefixFT, *pSuffixFT;
+ Edit *pPrefixED, *pSuffixED;
+
+ if( bFoot )
+ {
+ pEndBox = &aFtnNtAtTextEndCB;
+ pNumBox = &aFtnNtNumCB;
+ pNumFmtBox = &aFtnNtNumFmtCB;
+ pNumViewBox = &aFtnNumViewBox;
+ pOffsetTxt = &aFtnOffsetLbl;
+ pOffsetFld = &aFtnOffsetFld;
+ pPrefixFT = &aFtnPrefixFT;
+ pSuffixFT = &aFtnSuffixFT;
+ pPrefixED = &aFtnPrefixED;
+ pSuffixED = &aFtnSuffixED;
+ }
+ else
+ {
+ pEndBox = &aEndNtAtTextEndCB;
+ pNumBox = &aEndNtNumCB;
+ pNumFmtBox = &aEndNtNumFmtCB;
+ pNumViewBox = &aEndNumViewBox;
+ pOffsetTxt = &aEndOffsetLbl;
+ pOffsetFld = &aEndOffsetFld;
+ pPrefixFT = &aEndPrefixFT;
+ pSuffixFT = &aEndSuffixFT;
+ pPrefixED = &aEndPrefixED;
+ pSuffixED = &aEndSuffixED;
+ }
+
+ BOOL bEnableAtEnd = STATE_CHECK == pEndBox->GetState();
+ BOOL bEnableNum = bEnableAtEnd && STATE_CHECK == pNumBox->GetState();
+ BOOL bEnableNumFmt = bEnableNum && STATE_CHECK == pNumFmtBox->GetState();
+
+ pNumBox->Enable( bEnableAtEnd );
+ pOffsetTxt->Enable( bEnableNum );
+ pOffsetFld->Enable( bEnableNum );
+ pNumFmtBox->Enable( bEnableNum );
+ pNumViewBox->Enable( bEnableNumFmt );
+ pPrefixED->Enable( bEnableNumFmt );
+ pSuffixED->Enable( bEnableNumFmt );
+ pPrefixFT->Enable( bEnableNumFmt );
+ pSuffixFT->Enable( bEnableNumFmt );
+
+ return 0;
+}
+
+/* -----------------21.05.99 13:59-------------------
+ *
+ * --------------------------------------------------*/
+SwSectionPropertyTabDialog::SwSectionPropertyTabDialog(
+ Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh) :
+ SfxTabDialog(pParent, SW_RES(DLG_SECTION_PROPERTIES), &rSet),
+ rWrtSh(rSh)
+{
+ FreeResource();
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AddTabPage(TP_COLUMN, SwColumnPage::Create, 0);
+ AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
+ AddTabPage(TP_SECTION_FTNENDNOTES, SwSectionFtnEndTabPage::Create, 0);
+ AddTabPage(TP_SECTION_INDENTS, SwSectionIndentTabPage::Create, 0);
+
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ long nHtmlMode = pHtmlOpt->GetExportMode();
+ BOOL bWeb = 0 != PTR_CAST( SwWebDocShell, rSh.GetView().GetDocShell() );
+ if(bWeb)
+ {
+ RemoveTabPage(TP_SECTION_FTNENDNOTES);
+ RemoveTabPage(TP_SECTION_INDENTS);
+ if( HTML_CFG_NS40 != nHtmlMode && HTML_CFG_WRITER != nHtmlMode)
+ RemoveTabPage(TP_COLUMN);
+ }
+}
+/* -----------------21.05.99 13:59-------------------
+ *
+ * --------------------------------------------------*/
+SwSectionPropertyTabDialog::~SwSectionPropertyTabDialog()
+{
+}
+/* -----------------21.05.99 13:59-------------------
+ *
+ * --------------------------------------------------*/
+void SwSectionPropertyTabDialog::PageCreated( USHORT nId, SfxTabPage &rPage )
+{
+ if( TP_BACKGROUND == nId )
+ {
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR));
+ rPage.PageCreated(aSet);
+ }
+ else if( TP_COLUMN == nId )
+ {
+ ((SwColumnPage&)rPage).ShowBalance(TRUE);
+ ((SwColumnPage&)rPage).SetInSection(TRUE);
+ }
+ else if(TP_SECTION_INDENTS == nId)
+ ((SwSectionIndentTabPage&)rPage).SetWrtShell(rWrtSh);
+}
+/*-- 13.06.2003 09:59:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSectionIndentTabPage::SwSectionIndentTabPage( Window *pParent, const SfxItemSet &rAttrSet ) :
+ SfxTabPage(pParent, SW_RES(TP_SECTION_INDENTS), rAttrSet),
+ aIndentFL(this, SW_RES(FL_INDENT )),
+ aBeforeFT(this, SW_RES(FT_BEFORE )),
+ aBeforeMF(this, SW_RES(MF_BEFORE )),
+ aAfterFT(this, SW_RES(FT_AFTER )),
+ aAfterMF(this, SW_RES(MF_AFTER )),
+ aPreviewWin(this, SW_RES(WIN_PREVIEW ))
+{
+ FreeResource();
+ Link aLk = LINK(this, SwSectionIndentTabPage, IndentModifyHdl);
+ aBeforeMF.SetModifyHdl(aLk);
+ aAfterMF.SetModifyHdl(aLk);
+}
+/*-- 13.06.2003 09:59:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwSectionIndentTabPage::~SwSectionIndentTabPage()
+{
+}
+/*-- 13.06.2003 09:59:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+BOOL SwSectionIndentTabPage::FillItemSet( SfxItemSet& rSet)
+{
+ if(aBeforeMF.IsValueModified() ||
+ aAfterMF.IsValueModified())
+ {
+ SvxLRSpaceItem aLRSpace(
+ static_cast< long >(aBeforeMF.Denormalize(aBeforeMF.GetValue(FUNIT_TWIP))) ,
+ static_cast< long >(aAfterMF.Denormalize(aAfterMF.GetValue(FUNIT_TWIP))), 0, 0, RES_LR_SPACE);
+ rSet.Put(aLRSpace);
+ }
+ return TRUE;
+}
+/*-- 13.06.2003 09:59:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSectionIndentTabPage::Reset( const SfxItemSet& rSet)
+{
+ //this page doesn't show up in HTML mode
+ FieldUnit aMetric = ::GetDfltMetric(FALSE);
+ SetMetric(aBeforeMF, aMetric);
+ SetMetric(aAfterMF , aMetric);
+
+ SfxItemState eItemState = rSet.GetItemState( RES_LR_SPACE );
+ if ( eItemState >= SFX_ITEM_AVAILABLE )
+ {
+ const SvxLRSpaceItem& rSpace =
+ (const SvxLRSpaceItem&)rSet.Get( RES_LR_SPACE );
+
+ aBeforeMF.SetValue( aBeforeMF.Normalize(rSpace.GetLeft()), FUNIT_TWIP );
+ aAfterMF.SetValue( aAfterMF.Normalize(rSpace.GetRight()), FUNIT_TWIP );
+ }
+ else
+ {
+ aBeforeMF.SetEmptyFieldValue();
+ aAfterMF.SetEmptyFieldValue();
+ }
+ aBeforeMF.SaveValue();
+ aAfterMF.SaveValue();
+ IndentModifyHdl(0);
+}
+/*-- 13.06.2003 09:59:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxTabPage* SwSectionIndentTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet)
+{
+ return new SwSectionIndentTabPage(pParent, rAttrSet);
+}
+/* -----------------13.06.2003 13:57-----------------
+
+ --------------------------------------------------*/
+void SwSectionIndentTabPage::SetWrtShell(SwWrtShell& rSh)
+{
+ //set sensible values at the preview
+ aPreviewWin.SetAdjust(SVX_ADJUST_BLOCK);
+ aPreviewWin.SetLastLine(SVX_ADJUST_BLOCK);
+ const SwRect& rPageRect = rSh.GetAnyCurRect( RECT_PAGE, 0 );
+ Size aPageSize(rPageRect.Width(), rPageRect.Height());
+ aPreviewWin.SetSize(aPageSize);
+}
+/* -----------------13.06.2003 14:02-----------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwSectionIndentTabPage, IndentModifyHdl, MetricField*, EMPTYARG)
+{
+ aPreviewWin.SetLeftMargin( static_cast< long >(aBeforeMF.Denormalize(aBeforeMF.GetValue(FUNIT_TWIP))) );
+ aPreviewWin.SetRightMargin( static_cast< long >(aAfterMF.Denormalize(aAfterMF.GetValue(FUNIT_TWIP))) );
+ aPreviewWin.Draw(TRUE);
+ return 0;
+}
+
diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx
new file mode 100644
index 000000000000..4af058eeae1f
--- /dev/null
+++ b/sw/source/ui/dialog/wordcountdialog.cxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <swtypes.hxx>
+#include <wordcountdialog.hxx>
+#include <docstat.hxx>
+
+#include <dialog.hrc>
+#include <layout/layout-pre.hxx>
+#include <wordcountdialog.hrc>
+
+#if ENABLE_LAYOUT
+#undef SW_RES
+#define SW_RES(x) #x
+#undef SfxModalDialog
+#define SfxModalDialog( parent, id ) Dialog( parent, "wordcount.xml", id )
+#define SW_WORDCOUNTDIALOG_HRC
+#include <helpid.h>
+#endif /* ENABLE_LAYOUT */
+
+/*-- 06.04.2004 16:05:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwWordCountDialog::SwWordCountDialog(Window* pParent) :
+ SfxModalDialog(pParent, SW_RES(DLG_WORDCOUNT)),
+#if defined _MSC_VER
+#pragma warning (disable : 4355)
+#endif
+ aCurrentFL( this, SW_RES( FL_CURRENT )),
+ aCurrentWordFT( this, SW_RES( FT_CURRENTWORD )),
+ aCurrentWordFI( this, SW_RES( FI_CURRENTWORD )),
+ aCurrentCharacterFT( this, SW_RES( FT_CURRENTCHARACTER )),
+ aCurrentCharacterFI( this, SW_RES( FI_CURRENTCHARACTER )),
+
+ aDocFL( this, SW_RES( FL_DOC )),
+ aDocWordFT( this, SW_RES( FT_DOCWORD )),
+ aDocWordFI( this, SW_RES( FI_DOCWORD )),
+ aDocCharacterFT( this, SW_RES( FT_DOCCHARACTER )),
+ aDocCharacterFI( this, SW_RES( FI_DOCCHARACTER )),
+ aBottomFL(this, SW_RES( FL_BOTTOM )),
+ aOK( this, SW_RES( PB_OK )),
+ aHelp( this, SW_RES( PB_HELP ))
+#if defined _MSC_VER
+#pragma warning (default : 4355)
+#endif
+{
+#if ENABLE_LAYOUT
+ SetHelpId (HID_DLG_WORDCOUNT);
+#endif /* ENABLE_LAYOUT */
+ FreeResource();
+}
+/*-- 06.04.2004 16:05:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwWordCountDialog::~SwWordCountDialog()
+{
+}
+/*-- 06.04.2004 16:05:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwWordCountDialog::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc)
+{
+ aCurrentWordFI.SetText( String::CreateFromInt32(rCurrent.nWord ));
+ aCurrentCharacterFI.SetText(String::CreateFromInt32(rCurrent.nChar ));
+ aDocWordFI.SetText( String::CreateFromInt32(rDoc.nWord ));
+ aDocCharacterFI.SetText( String::CreateFromInt32(rDoc.nChar ));
+}
+
+
+
diff --git a/sw/source/ui/dialog/wordcountdialog.hrc b/sw/source/ui/dialog/wordcountdialog.hrc
new file mode 100644
index 000000000000..00749412ac97
--- /dev/null
+++ b/sw/source/ui/dialog/wordcountdialog.hrc
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_WORDCOUNTDIALOG_HRC
+#define SW_WORDCOUNTDIALOG_HRC
+#define FL_CURRENT 1
+#define FT_CURRENTWORD 2
+#define FI_CURRENTWORD 3
+#define FT_CURRENTCHARACTER 4
+#define FI_CURRENTCHARACTER 5
+#define FL_DOC 6
+#define FT_DOCWORD 7
+#define FI_DOCWORD 8
+#define FT_DOCCHARACTER 9
+#define FI_DOCCHARACTER 10
+#define FL_BOTTOM 11
+#define PB_OK 12
+#define PB_HELP 13
+
+#endif
diff --git a/sw/source/ui/dialog/wordcountdialog.src b/sw/source/ui/dialog/wordcountdialog.src
new file mode 100644
index 000000000000..454a6c050b34
--- /dev/null
+++ b/sw/source/ui/dialog/wordcountdialog.src
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <helpid.h>
+#include <dialog.hrc>
+#include <wordcountdialog.hrc>
+ModalDialog DLG_WORDCOUNT
+{
+ HelpID = HID_DLG_WORDCOUNT ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 170 , 108 ) ;
+ Text [ en-US ] = "Word Count" ;
+ Moveable = TRUE ;
+
+ FixedLine FL_CURRENT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 158 , 8 ) ;
+ Text [ en-US ] = "Current selection";
+ };
+ FixedText FT_CURRENTWORD
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Words:";
+ };
+ FixedText FI_CURRENTWORD
+ {
+ Pos = MAP_APPFONT ( 111 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Right = TRUE;
+ };
+ FixedText FT_CURRENTCHARACTER
+ {
+ Pos = MAP_APPFONT ( 12 , 26 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Characters:";
+ };
+ FixedText FI_CURRENTCHARACTER
+ {
+ Pos = MAP_APPFONT ( 111 , 26 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Right = TRUE;
+ };
+ FixedLine FL_DOC
+ {
+ Pos = MAP_APPFONT ( 6, 40 ) ;
+ Size = MAP_APPFONT ( 158 , 8 ) ;
+ Text [ en-US ] = "Whole document";
+ };
+ FixedText FT_DOCWORD
+ {
+ Pos = MAP_APPFONT ( 12, 51 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Words:";
+ };
+ FixedText FI_DOCWORD
+ {
+ Pos = MAP_APPFONT ( 111 , 51 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Right = TRUE;
+ };
+ FixedText FT_DOCCHARACTER
+ {
+ Pos = MAP_APPFONT ( 12 , 63 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Characters:";
+ };
+ FixedText FI_DOCCHARACTER
+ {
+ Pos = MAP_APPFONT ( 111, 63 ) ;
+ Size = MAP_APPFONT ( 50, 8 ) ;
+ Right = TRUE;
+ };
+ FixedLine FL_BOTTOM
+ {
+ Pos = MAP_APPFONT ( 6 , 77 ) ;
+ Size = MAP_APPFONT ( 158 , 8 ) ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 61 , 88 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 114 , 88 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
diff --git a/sw/source/ui/dochdl/dochdl.src b/sw/source/ui/dochdl/dochdl.src
new file mode 100755
index 000000000000..f92ea43681d8
--- /dev/null
+++ b/sw/source/ui/dochdl/dochdl.src
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "dochdl.hrc"
+#include "globals.hrc"
+
+
+String STR_NOGLOS
+{
+ Text [ en-US ] = "AutoText for Shortcut '%1' not found." ;
+};
+String STR_NO_TABLE
+{
+ Text [ en-US ] = "A table cannot be inserted into another table. However, you can paste the data into the document when the cursor is not in a table.";
+};
+
+
+InfoBox MSG_ERR_INSERT_GLOS
+{
+ Message [ en-US ] = "AutoText could not be created." ;
+};
+
+InfoBox MSG_CLPBRD_FORMAT_ERROR
+{
+ Message [ en-US ] = "Requested clipboard format is not available." ;
+};
+
+QueryBox MSG_UPDATE_NEW_GLOS_FMT
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_YES ;
+ Message [ en-US ] = "The section format is outdated.\nIt needs to be converted so that changes\ncan be saved.\nShould it be converted now?" ;
+};
+
+String STR_PRIVATETEXT
+{
+ Text [ en-US ] = "%PRODUCTNAME Writer" ;
+};
+String STR_PRIVATEGRAPHIC
+{
+ Text [ en-US ] = "Graphics [%PRODUCTNAME Writer]" ;
+};
+String STR_PRIVATEOLE
+{
+ Text [ en-US ] = "Object [%PRODUCTNAME Writer]" ;
+};
+String STR_DDEFORMAT
+{
+ Text [ en-US ] = "DDE link" ;
+};
+
diff --git a/sw/source/ui/dochdl/gloshdl.cxx b/sw/source/ui/dochdl/gloshdl.cxx
new file mode 100755
index 000000000000..cc789d6e4498
--- /dev/null
+++ b/sw/source/ui/dochdl/gloshdl.cxx
@@ -0,0 +1,898 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/adjitem.hxx>
+#ifndef __RSC //autogen
+#include <tools/errinf.hxx>
+#endif
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <svl/macitem.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/docfile.hxx>
+#define _SVSTDARR_STRINGS
+#include <svl/svstdarr.hxx>
+#include <svl/urihelper.hxx>
+#include <unotools/transliterationwrapper.hxx>
+#include <poolfmt.hxx>
+#include <fmtcol.hxx>
+#include <docary.hxx>
+#include <wrtsh.hxx>
+#include <uitool.hxx> // Fehlermeldungen
+#include <view.hxx>
+#include <swevent.hxx>
+#include <gloshdl.hxx>
+#include <glosdoc.hxx>
+#include <shellio.hxx>
+#include <swundo.hxx> // fuer Undo-Ids
+#include <expfld.hxx>
+#include <initui.hxx> // fuer ::GetGlossaries()
+#include <gloslst.hxx>
+#include <swdtflvr.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <crsskip.hxx>
+
+#ifndef _DOCHDL_HRC
+#include <dochdl.hrc>
+#endif
+#ifndef _SWERROR_H
+#include <swerror.h>
+#endif
+#include <frmmgr.hxx>
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+#include <editeng/acorrcfg.hxx>
+#include "swabstdlg.hxx"
+#include <misc.hrc>
+
+#include <IDocumentFieldsAccess.hxx>
+
+using namespace ::com::sun::star;
+
+
+const short RET_EDIT = 100;
+
+// PUBLIC METHODES -------------------------------------------------------
+struct TextBlockInfo_Impl
+{
+ String sTitle;
+ String sLongName;
+ String sGroupName;
+};
+typedef TextBlockInfo_Impl* TextBlockInfo_ImplPtr;
+SV_DECL_PTRARR_DEL( TextBlockInfoArr, TextBlockInfo_ImplPtr, 0, 4 )
+SV_IMPL_PTRARR( TextBlockInfoArr, TextBlockInfo_ImplPtr )
+SV_IMPL_REF( SwDocShell )
+/*------------------------------------------------------------------------
+ Beschreibung: Dialog fuer Bearbeiten Vorlagen
+------------------------------------------------------------------------*/
+
+
+void SwGlossaryHdl::GlossaryDlg()
+{
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractGlossaryDlg* pDlg = pFact->CreateGlossaryDlg( DLG_RENAME_GLOS,
+ pViewFrame, this, pWrtShell);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ String sName, sShortName;
+
+ if( RET_EDIT == pDlg->Execute() )
+ {
+ sName = pDlg->GetCurrGrpName();
+ sShortName = pDlg->GetCurrShortName();
+ }
+
+ delete pDlg;
+ DELETEZ(pCurGrp);
+ if(HasGlossaryList())
+ {
+ GetGlossaryList()->ClearGroups();
+ }
+
+ if( sName.Len() || sShortName.Len() )
+ rStatGlossaries.EditGroupDoc( sName, sShortName );
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Setzen der aktuellen Gruppe; falls aus dem Dialog
+ gerufen, wird die Gruppe temp. erzeugt fuer einen
+ schnelleren Zugriff
+------------------------------------------------------------------------*/
+
+
+void SwGlossaryHdl::SetCurGroup(const String &rGrp, BOOL bApi, BOOL bAlwaysCreateNew )
+{
+ String sGroup(rGrp);
+ if(STRING_NOTFOUND == sGroup.Search(GLOS_DELIM) && !FindGroupName(sGroup))
+ {
+ sGroup += GLOS_DELIM;
+ sGroup += '0';
+ }
+ if(pCurGrp)
+ {
+ BOOL bPathEqual = FALSE;
+ if(!bAlwaysCreateNew)
+ {
+ INetURLObject aTemp( pCurGrp->GetFileName() );
+ String sCurBase = aTemp.getBase();
+ aTemp.removeSegment();
+ const String sCurEntryPath = aTemp.GetMainURL(INetURLObject::NO_DECODE);
+ const SvStrings* pPathArr = rStatGlossaries.GetPathArray();
+ USHORT nCurrentPath = USHRT_MAX;
+ for(USHORT nPath = 0; nPath < pPathArr->Count(); nPath++)
+ {
+ if(sCurEntryPath == *(*pPathArr)[nPath])
+ {
+ nCurrentPath = nPath;
+ break;
+ }
+ }
+ String sPath = sGroup.GetToken(1, GLOS_DELIM);
+ USHORT nComparePath = (USHORT)sPath.ToInt32();
+ if(nCurrentPath == nComparePath &&
+ sGroup.GetToken(0, GLOS_DELIM) == sCurBase)
+ bPathEqual = TRUE;
+ }
+// const String aMac_Tmp(pCurGrp->GetName());
+ // Beim Pfadwechsel kann man sich auf den Namen nicht verlassen
+ if(!bAlwaysCreateNew &&
+ bPathEqual
+// aMac_Tmp == sGroup
+ )
+ return;
+ }
+ aCurGrp = sGroup;
+ if(!bApi)
+ {
+ if(pCurGrp)
+ {
+ rStatGlossaries.PutGroupDoc(pCurGrp);
+ pCurGrp = 0;
+ }
+ pCurGrp = rStatGlossaries.GetGroupDoc(aCurGrp, TRUE);
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+USHORT SwGlossaryHdl::GetGroupCnt() const
+{
+ return rStatGlossaries.GetGroupCnt();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+String SwGlossaryHdl::GetGroupName( USHORT nId, String* pTitle )
+{
+ String sRet = rStatGlossaries.GetGroupName(nId);
+ if(pTitle)
+ {
+ SwTextBlocks* pGroup = rStatGlossaries.GetGroupDoc(sRet, FALSE);
+ if(pGroup && !pGroup->GetError())
+ {
+ *pTitle = pGroup->GetName();
+ if(!pTitle->Len())
+ {
+ *pTitle = sRet.GetToken(0, GLOS_DELIM);
+ pGroup->SetName(*pTitle);
+ }
+ rStatGlossaries.PutGroupDoc( pGroup );
+ }
+ else
+ sRet.Erase();
+ }
+ return sRet;
+}
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+BOOL SwGlossaryHdl::NewGroup(String &rGrpName, const String& rTitle)
+{
+ if(STRING_NOTFOUND == rGrpName.Search(GLOS_DELIM))
+ FindGroupName(rGrpName);
+ return rStatGlossaries.NewGroupDoc(rGrpName, rTitle);
+}
+/* -----------------23.11.98 13:10-------------------
+ * Umbenennen eines Textbausteins
+ * --------------------------------------------------*/
+BOOL SwGlossaryHdl::RenameGroup(const String & rOld, String& rNew, const String& rNewTitle)
+{
+ BOOL bRet = FALSE;
+ String sOldGroup(rOld);
+ if(STRING_NOTFOUND == rOld.Search(GLOS_DELIM))
+ FindGroupName(sOldGroup);
+ if(rOld == rNew)
+ {
+ SwTextBlocks* pGroup = rStatGlossaries.GetGroupDoc(sOldGroup, FALSE);
+ if(pGroup)
+ {
+ pGroup->SetName(rNewTitle);
+ rStatGlossaries.PutGroupDoc( pGroup );
+ bRet = TRUE;
+ }
+ }
+ else
+ {
+ String sNewGroup(rNew);
+ if(STRING_NOTFOUND == sNewGroup.Search(GLOS_DELIM))
+ {
+ sNewGroup += GLOS_DELIM;
+ sNewGroup += '0';
+ }
+ bRet = rStatGlossaries.RenameGroupDoc(sOldGroup, sNewGroup, rNewTitle);
+ rNew = sNewGroup;
+ }
+ return bRet;
+}
+/* -----------------27.11.98 13:49-------------------
+ *
+ * --------------------------------------------------*/
+BOOL SwGlossaryHdl::CopyOrMove( const String& rSourceGroupName, String& rSourceShortName,
+ const String& rDestGroupName, const String& rLongName, BOOL bMove )
+{
+ SwTextBlocks* pSourceGroup = rStatGlossaries.GetGroupDoc(rSourceGroupName, FALSE);
+
+ SwTextBlocks* pDestGroup = rStatGlossaries.GetGroupDoc(rDestGroupName, FALSE);
+ if(pDestGroup->IsReadOnly() || (bMove && pSourceGroup->IsReadOnly()) )
+ return FALSE;
+ /*if(pDestGroup->IsOld()&& 0!= pDestGroup->ConvertToNew())
+ return FALSE;
+ if(bMove && pSourceGroup->IsOld() && 0 != pSourceGroup->ConvertToNew())
+ return FALSE;*/
+
+ //Der Index muss hier ermittelt werden, weil rSourceShortName in CopyBlock evtl veraendert wird
+ USHORT nDeleteIdx = pSourceGroup->GetIndex( rSourceShortName );
+ DBG_ASSERT(USHRT_MAX != nDeleteIdx, "Eintrag nicht gefunden");
+ ULONG nRet = pSourceGroup->CopyBlock( *pDestGroup, rSourceShortName, rLongName );
+ if(!nRet && bMove)
+ {
+ // der Index muss existieren
+ nRet = pSourceGroup->Delete( nDeleteIdx ) ? 0 : 1;
+ }
+ rStatGlossaries.PutGroupDoc( pSourceGroup );
+ rStatGlossaries.PutGroupDoc( pDestGroup );
+ return !nRet;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Loeschen einer Textbausteindatei-Gruppe
+------------------------------------------------------------------------*/
+
+
+BOOL SwGlossaryHdl::DelGroup(const String &rGrpName)
+{
+ String sGroup(rGrpName);
+ if(STRING_NOTFOUND == sGroup.Search(GLOS_DELIM))
+ FindGroupName(sGroup);
+ if( rStatGlossaries.DelGroupDoc(sGroup) )
+ {
+ if(pCurGrp)
+ {
+ const String aMac_Tmp(pCurGrp->GetName());
+ if(aMac_Tmp == sGroup)
+ DELETEZ(pCurGrp);
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Anzahl Textbausteine erfragen
+------------------------------------------------------------------------*/
+
+
+USHORT SwGlossaryHdl::GetGlossaryCnt()
+{
+ return pCurGrp ? pCurGrp->GetCount() : 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+String SwGlossaryHdl::GetGlossaryName( USHORT nId )
+{
+ ASSERT(nId < GetGlossaryCnt(), Textbausteinarray ueberindiziert.);
+ return pCurGrp->GetLongName( nId );
+}
+/* -----------------30.11.98 13:18-------------------
+ *
+ * --------------------------------------------------*/
+String SwGlossaryHdl::GetGlossaryShortName(USHORT nId)
+{
+ ASSERT(nId < GetGlossaryCnt(), Textbausteinarray ueberindiziert.);
+ return pCurGrp->GetShortName( nId );
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: Kurzname erfragen
+------------------------------------------------------------------------*/
+
+
+String SwGlossaryHdl::GetGlossaryShortName(const String &rName)
+{
+ String sReturn;
+ SwTextBlocks *pTmp =
+ pCurGrp ? pCurGrp: rStatGlossaries.GetGroupDoc( aCurGrp, FALSE );
+ if(pTmp)
+ {
+ USHORT nIdx = pTmp->GetLongIndex( rName );
+ if( nIdx != (USHORT) -1 )
+ sReturn = pTmp->GetShortName( nIdx );
+ if( !pCurGrp )
+ rStatGlossaries.PutGroupDoc( pTmp );
+ }
+ return sReturn;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Kuerzel fuer Textbaustein bereits verwendet?
+------------------------------------------------------------------------*/
+
+
+BOOL SwGlossaryHdl::HasShortName(const String& rShortName) const
+{
+ SwTextBlocks *pBlock = pCurGrp ? pCurGrp
+ : rStatGlossaries.GetGroupDoc( aCurGrp );
+ BOOL bRet = pBlock->GetIndex( rShortName ) != (USHORT) -1;
+ if( !pCurGrp )
+ rStatGlossaries.PutGroupDoc( pBlock );
+ return bRet;
+}
+
+/* -----------------------------20.03.01 10:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwGlossaryHdl::ConvertToNew(SwTextBlocks& /*rOld*/)
+{
+ /*if( rOld.IsOld() )
+ {
+ QueryBox aAsk( pWrtShell->GetView().GetWindow(), SW_RES( MSG_UPDATE_NEW_GLOS_FMT ) );
+ if( aAsk.Execute() == RET_YES )
+ {
+ if( rOld.ConvertToNew() )
+ {
+ InfoBox(pWrtShell->GetView().GetWindow(), SW_RES(MSG_ERR_INSERT_GLOS)).Execute();
+ return FALSE;
+ }
+ }
+ else
+ return FALSE;
+ }*/
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Erzeugen eines Textbausteines
+------------------------------------------------------------------------*/
+
+BOOL SwGlossaryHdl::NewGlossary(const String& rName, const String& rShortName,
+ BOOL bCreateGroup, BOOL bNoAttr)
+{
+ SwTextBlocks *pTmp =
+ pCurGrp ? pCurGrp: rStatGlossaries.GetGroupDoc( aCurGrp, bCreateGroup );
+ //pTmp == 0 if the AutoText path setting is wrong
+ if(!pTmp)
+ return FALSE;
+ if(!ConvertToNew(*pTmp))
+ return FALSE;
+
+ String sOnlyTxt;
+ String* pOnlyTxt = 0;
+ if( bNoAttr )
+ {
+ if( !pWrtShell->GetSelectedText( sOnlyTxt, GETSELTXT_PARABRK_TO_ONLYCR ))
+ return FALSE;
+ pOnlyTxt = &sOnlyTxt;
+ }
+
+ const SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
+
+ const USHORT nSuccess = pWrtShell->MakeGlossary( *pTmp, rName, rShortName,
+ pCfg->IsSaveRelFile(), pOnlyTxt );
+ if(nSuccess == (USHORT) -1 )
+ {
+ InfoBox(pWrtShell->GetView().GetWindow(), SW_RES(MSG_ERR_INSERT_GLOS)).Execute();
+ }
+ if( !pCurGrp )
+ rStatGlossaries.PutGroupDoc( pTmp );
+ return BOOL( nSuccess != (USHORT) -1 );
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Loeschen eines Textbausteines
+------------------------------------------------------------------------*/
+
+
+BOOL SwGlossaryHdl::DelGlossary(const String &rShortName)
+{
+ SwTextBlocks *pGlossary = pCurGrp ? pCurGrp
+ : rStatGlossaries.GetGroupDoc(aCurGrp);
+ //pTmp == 0 if the AutoText path setting is wrong
+ if(!pGlossary || !ConvertToNew(*pGlossary))
+ return FALSE;
+
+ USHORT nIdx = pGlossary->GetIndex( rShortName );
+ if( nIdx != (USHORT) -1 )
+ pGlossary->Delete( nIdx );
+ if( !pCurGrp )
+ rStatGlossaries.PutGroupDoc( pGlossary );
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Kurzform expandieren
+------------------------------------------------------------------------*/
+
+
+BOOL SwGlossaryHdl::ExpandGlossary()
+{
+ ASSERT(pWrtShell->CanInsert(), illegal);
+ SwTextBlocks *pGlossary;
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ ::GlossaryGetCurrGroup fnGetCurrGroup = pFact->GetGlossaryCurrGroupFunc( DLG_RENAME_GLOS );
+ DBG_ASSERT(fnGetCurrGroup, "Dialogdiet fail!");
+ String sGroupName( (*fnGetCurrGroup)() );
+ if(STRING_NOTFOUND == sGroupName.Search(GLOS_DELIM))
+ FindGroupName(sGroupName);
+ pGlossary = rStatGlossaries.GetGroupDoc(sGroupName);
+
+ String aShortName;
+
+ // bei Textselektion diese verwenden
+ if(pWrtShell->SwCrsrShell::HasSelection() && !pWrtShell->IsBlockMode())
+ {
+ aShortName = pWrtShell->GetSelTxt();
+ }
+ else
+ {
+ if(pWrtShell->IsAddMode())
+ pWrtShell->LeaveAddMode();
+ else if(pWrtShell->IsBlockMode())
+ pWrtShell->LeaveBlockMode();
+ else if(pWrtShell->IsExtMode())
+ pWrtShell->LeaveExtMode();
+ // Wort selektieren
+ pWrtShell->SelNearestWrd();
+ // Wort erfragen
+ if(pWrtShell->IsSelection())
+ aShortName = pWrtShell->GetSelTxt();
+ }
+ return pGlossary ? Expand( aShortName, &rStatGlossaries, pGlossary ) : FALSE;
+}
+
+BOOL SwGlossaryHdl::Expand( const String& rShortName,
+ SwGlossaries *pGlossaries,
+ SwTextBlocks *pGlossary )
+{
+ TextBlockInfoArr aFoundArr;
+ String aShortName( rShortName );
+ BOOL bCancel = FALSE;
+ // search for text block
+ //#b6633427# - don't prefer current group depending on configuration setting
+ const SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
+ USHORT nFound = !pCfg->IsSearchInAllCategories() ? pGlossary->GetIndex( aShortName ) : -1;
+ // if not found then search in all groups
+ if( nFound == (USHORT) -1 )
+ {
+ const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
+ SwGlossaryList* pGlossaryList = ::GetGlossaryList();
+ USHORT nGroupCount = pGlossaryList->GetGroupCount();
+ for(USHORT i = 1; i <= nGroupCount; i++)
+ {
+ // Gruppenname mit Pfad-Extension besorgen
+ String sTitle;
+ String sGroupName = pGlossaryList->GetGroupName(i - 1, FALSE, &sTitle);
+ if(sGroupName == pGlossary->GetName())
+ continue;
+ USHORT nBlockCount = pGlossaryList->GetBlockCount(i -1);
+ if(nBlockCount)
+ {
+ for(USHORT j = 0; j < nBlockCount; j++)
+ {
+ String sEntry;
+ String sLongName(pGlossaryList->GetBlockName(i - 1, j, sEntry));
+ if( rSCmp.isEqual( rShortName, sEntry ))
+ {
+ TextBlockInfo_Impl* pData = new TextBlockInfo_Impl;
+ pData->sTitle = sTitle;
+ pData->sLongName = sLongName;
+ pData->sGroupName = sGroupName;
+ aFoundArr.Insert(pData, aFoundArr.Count());
+ }
+ }
+ }
+ }
+ if( aFoundArr.Count() ) // einer wurde gefunden
+ {
+ pGlossaries->PutGroupDoc(pGlossary);
+ if(1 == aFoundArr.Count())
+ {
+ TextBlockInfo_Impl* pData = aFoundArr.GetObject(0);
+ pGlossary = (SwTextBlocks *)pGlossaries->GetGroupDoc(pData->sGroupName);
+ nFound = pGlossary->GetIndex( aShortName );
+ }
+ else
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstarctSwSelGlossaryDlg* pDlg = pFact->CreateSwSelGlossaryDlg( 0, aShortName, DLG_SEL_GLOS );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ for(USHORT i = 0; i < aFoundArr.Count(); ++i)
+ {
+ TextBlockInfo_Impl* pData = aFoundArr.GetObject(i);
+ pDlg->InsertGlos(pData->sTitle, pData->sLongName);
+ }
+ pDlg->SelectEntryPos(0);
+ const USHORT nRet = RET_OK == pDlg->Execute()?
+ pDlg->GetSelectedIdx():
+ LISTBOX_ENTRY_NOTFOUND;
+ delete pDlg;
+ if(LISTBOX_ENTRY_NOTFOUND != nRet)
+ {
+ TextBlockInfo_Impl* pData = aFoundArr.GetObject(nRet);
+ pGlossary = (SwTextBlocks *)pGlossaries->GetGroupDoc(pData->sGroupName);
+ nFound = pGlossary->GetIndex( aShortName );
+ }
+ else
+ {
+ nFound = (USHORT) -1;
+ bCancel = TRUE;
+ }
+ }
+ }
+ }
+
+ // nicht gefunden
+ if( nFound == (USHORT) -1 )
+ {
+ if( !bCancel )
+ {
+ pGlossaries->PutGroupDoc(pGlossary);
+
+ const USHORT nMaxLen = 50;
+ if(pWrtShell->IsSelection() && aShortName.Len() > nMaxLen)
+ {
+ aShortName.Erase(nMaxLen);
+ aShortName.AppendAscii(" ...");
+ }
+ String aTmp( SW_RES(STR_NOGLOS));
+ aTmp.SearchAndReplaceAscii("%1", aShortName);
+ InfoBox( pWrtShell->GetView().GetWindow(), aTmp ).Execute();
+ }
+
+ return FALSE;
+ }
+ else
+ {
+ String aLongName = pGlossary->GetLongName( nFound );
+ SvxMacro aStartMacro(aEmptyStr, aEmptyStr, STARBASIC);
+ SvxMacro aEndMacro(aEmptyStr, aEmptyStr, STARBASIC);
+ GetMacros( aShortName, aStartMacro, aEndMacro, pGlossary );
+
+ // StartAction darf nich vor HasSelection und DelRight stehen,
+ // sonst wird der moeglich Shellwechsel verzoegert und
+ // API-Programme wuerden dann haengenbleiben
+ // ausserdem darf das Ereignismacro ebenfalls nicht in einer Action gerufen werden
+ pWrtShell->StartUndo(UNDO_INSGLOSSARY);
+ if( aStartMacro.GetMacName().Len() )
+ pWrtShell->ExecMacro( aStartMacro );
+ if(pWrtShell->HasSelection())
+ pWrtShell->DelLeft();
+ pWrtShell->StartAllAction();
+
+ // alle InputFelder zwischenspeichern
+ SwInputFieldList aFldLst( pWrtShell, TRUE );
+
+ pWrtShell->InsertGlossary(*pGlossary, aShortName);
+ pWrtShell->EndAllAction();
+ if( aEndMacro.GetMacName().Len() )
+ {
+ pWrtShell->ExecMacro( aEndMacro );
+ }
+ pWrtShell->EndUndo(UNDO_INSGLOSSARY);
+
+ // fuer alle neuen InputFelder die Eingaben abfordern
+ if( aFldLst.BuildSortLst() )
+ pWrtShell->UpdateInputFlds( &aFldLst );
+ }
+ pGlossaries->PutGroupDoc(pGlossary);
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Textbaustein einfuegen
+------------------------------------------------------------------------*/
+
+
+BOOL SwGlossaryHdl::InsertGlossary(const String &rName)
+{
+ ASSERT(pWrtShell->CanInsert(), illegal);
+
+ SwTextBlocks *pGlos =
+ pCurGrp? pCurGrp: rStatGlossaries.GetGroupDoc(aCurGrp);
+
+ if (!pGlos)
+ return FALSE;
+
+ SvxMacro aStartMacro(aEmptyStr, aEmptyStr, STARBASIC);
+ SvxMacro aEndMacro(aEmptyStr, aEmptyStr, STARBASIC);
+ GetMacros( rName, aStartMacro, aEndMacro, pGlos );
+
+ // StartAction darf nich vor HasSelection und DelRight stehen,
+ // sonst wird der moeglich Shellwechsel verzoegert und
+ // API-Programme wuerden dann haengenbleiben
+ // ausserdem darf das Ereignismacro ebenfalls nicht in einer Action gerufen werden
+ if( aStartMacro.GetMacName().Len() )
+ pWrtShell->ExecMacro( aStartMacro );
+ if( pWrtShell->HasSelection() )
+ pWrtShell->DelRight();
+ pWrtShell->StartAllAction();
+
+ // alle InputFelder zwischenspeichern
+ SwInputFieldList aFldLst( pWrtShell, TRUE );
+
+ pWrtShell->InsertGlossary(*pGlos, rName);
+ pWrtShell->EndAllAction();
+ if( aEndMacro.GetMacName().Len() )
+ {
+ pWrtShell->ExecMacro( aEndMacro );
+ }
+
+ // fuer alle neuen InputFelder die Eingaben abfordern
+ if( aFldLst.BuildSortLst() )
+ pWrtShell->UpdateInputFlds( &aFldLst );
+
+ if(!pCurGrp)
+ rStatGlossaries.PutGroupDoc(pGlos);
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Macro setzen / erfragen
+------------------------------------------------------------------------*/
+
+
+void SwGlossaryHdl::SetMacros(const String& rShortName,
+ const SvxMacro* pStart,
+ const SvxMacro* pEnd,
+ SwTextBlocks *pGlossary )
+{
+ SwTextBlocks *pGlos = pGlossary ? pGlossary :
+ pCurGrp ? pCurGrp
+ : rStatGlossaries.GetGroupDoc( aCurGrp );
+ SvxMacroTableDtor aMacroTbl;
+ if( pStart )
+ aMacroTbl.Insert( SW_EVENT_START_INS_GLOSSARY, new SvxMacro(*pStart));
+ if( pEnd )
+ aMacroTbl.Insert( SW_EVENT_END_INS_GLOSSARY, new SvxMacro(*pEnd));
+ USHORT nIdx = pGlos->GetIndex( rShortName );
+ if( !pGlos->SetMacroTable( nIdx, aMacroTbl ) && pGlos->GetError() )
+ ErrorHandler::HandleError( pGlos->GetError() );
+
+ if(!pCurGrp && !pGlossary)
+ rStatGlossaries.PutGroupDoc(pGlos);
+}
+
+void SwGlossaryHdl::GetMacros( const String &rShortName,
+ SvxMacro& rStart,
+ SvxMacro& rEnd,
+ SwTextBlocks *pGlossary )
+{
+ SwTextBlocks *pGlos = pGlossary ? pGlossary
+ : pCurGrp ? pCurGrp
+ : rStatGlossaries.GetGroupDoc(aCurGrp);
+ USHORT nIndex = pGlos->GetIndex( rShortName );
+ if( nIndex != USHRT_MAX )
+ {
+ SvxMacroTableDtor aMacroTbl;
+ if( pGlos->GetMacroTable( nIndex, aMacroTbl ) )
+ {
+ SvxMacro *pMacro = aMacroTbl.Get( SW_EVENT_START_INS_GLOSSARY );
+ if( pMacro )
+ rStart = *pMacro;
+
+ pMacro = aMacroTbl.Get( SW_EVENT_END_INS_GLOSSARY );
+ if( pMacro )
+ rEnd = *pMacro;
+ }
+ }
+
+ if( !pCurGrp && !pGlossary )
+ rStatGlossaries.PutGroupDoc( pGlos );
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: ctor, dtor
+------------------------------------------------------------------------*/
+
+
+SwGlossaryHdl::SwGlossaryHdl(SfxViewFrame* pVwFrm, SwWrtShell *pSh)
+ : rStatGlossaries( *::GetGlossaries() ),
+ aCurGrp( rStatGlossaries.GetDefName() ),
+ pViewFrame( pVwFrm ),
+ pWrtShell( pSh ),
+ pCurGrp( 0 )
+{
+}
+
+
+SwGlossaryHdl::~SwGlossaryHdl()
+{
+ if( pCurGrp )
+ rStatGlossaries.PutGroupDoc( pCurGrp );
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Umbenennen eines Textbausteines
+------------------------------------------------------------------------*/
+
+
+BOOL SwGlossaryHdl::Rename(const String& rOldShort, const String& rNewShortName,
+ const String& rNewName )
+{
+ BOOL bRet = FALSE;
+ SwTextBlocks *pGlossary = pCurGrp ? pCurGrp
+ : rStatGlossaries.GetGroupDoc(aCurGrp);
+ if(pGlossary)
+ {
+ if(!ConvertToNew(*pGlossary))
+ return FALSE;
+
+ USHORT nIdx = pGlossary->GetIndex( rOldShort );
+ USHORT nOldLongIdx = pGlossary->GetLongIndex( rNewName );
+ USHORT nOldIdx = pGlossary->GetIndex( rNewShortName );
+
+ if( nIdx != USHRT_MAX &&
+ (nOldLongIdx == USHRT_MAX || nOldLongIdx == nIdx )&&
+ (nOldIdx == USHRT_MAX || nOldIdx == nIdx ))
+ {
+ String aNewShort( rNewShortName );
+ String aNewName( rNewName );
+ pGlossary->Rename( nIdx, &aNewShort, &aNewName );
+ bRet = pGlossary->GetError() == 0;
+ }
+ if( !pCurGrp )
+ rStatGlossaries.PutGroupDoc(pGlossary);
+ }
+ return bRet;
+}
+
+
+BOOL SwGlossaryHdl::IsReadOnly( const String* pGrpNm ) const
+{
+ SwTextBlocks *pGlossary = 0;
+
+ if (pGrpNm)
+ pGlossary = rStatGlossaries.GetGroupDoc( *pGrpNm );
+ else if (pCurGrp)
+ pGlossary = pCurGrp;
+ else
+ pGlossary = rStatGlossaries.GetGroupDoc(aCurGrp);
+
+ BOOL bRet = pGlossary ? pGlossary->IsReadOnly() : TRUE;
+ if( pGrpNm || !pCurGrp )
+ delete pGlossary;
+ return bRet;
+}
+
+
+BOOL SwGlossaryHdl::IsOld() const
+{
+ SwTextBlocks *pGlossary = pCurGrp ? pCurGrp
+ : rStatGlossaries.GetGroupDoc(aCurGrp);
+ BOOL bRet = pGlossary ? pGlossary->IsOld() : FALSE;
+ if( !pCurGrp )
+ delete pGlossary;
+ return bRet;
+}
+
+/*-----------------09.06.97 16:15-------------------
+ Gruppe ohne Pfadindex finden
+--------------------------------------------------*/
+BOOL SwGlossaryHdl::FindGroupName(String & rGroup)
+{
+ return rStatGlossaries.FindGroupName(rGroup);
+}
+
+/* -----------------29.07.99 08:34-------------------
+
+ --------------------------------------------------*/
+BOOL SwGlossaryHdl::CopyToClipboard(SwWrtShell& rSh, const String& rShortName)
+{
+ SwTextBlocks *pGlossary = pCurGrp ? pCurGrp
+ : rStatGlossaries.GetGroupDoc(aCurGrp);
+
+ SwTransferable* pTransfer = new SwTransferable( rSh );
+/*??*/uno::Reference<
+ datatransfer::XTransferable > xRef( pTransfer );
+
+ int nRet = pTransfer->CopyGlossary( *pGlossary, rShortName );
+ if( !pCurGrp )
+ rStatGlossaries.PutGroupDoc( pGlossary );
+ return 0 != nRet;
+}
+
+BOOL SwGlossaryHdl::ImportGlossaries( const String& rName )
+{
+ BOOL bRet = FALSE;
+ if( rName.Len() )
+ {
+ const SfxFilter* pFilter = 0;
+ SfxMedium* pMed = new SfxMedium( rName, STREAM_READ, TRUE, 0, 0 );
+ SfxFilterMatcher aMatcher( String::CreateFromAscii("swriter") );
+ pMed->UseInteractionHandler( TRUE );
+ if( !aMatcher.GuessFilter( *pMed, &pFilter, FALSE ) )
+ {
+ SwTextBlocks *pGlossary;
+ pMed->SetFilter( pFilter );
+ Reader* pR = SwReaderWriter::GetReader( pFilter->GetUserData() );
+ if( pR && 0 != ( pGlossary = pCurGrp ? pCurGrp
+ : rStatGlossaries.GetGroupDoc(aCurGrp)) )
+ {
+ SwReader aReader( *pMed, rName );
+ if( aReader.HasGlossaries( *pR ) )
+ {
+ const SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
+ bRet = aReader.ReadGlossaries( *pR, *pGlossary,
+ pCfg->IsSaveRelFile() );
+ }
+ }
+ }
+ DELETEZ(pMed);
+ }
+ return bRet;
+}
+
diff --git a/sw/source/ui/dochdl/selglos.cxx b/sw/source/ui/dochdl/selglos.cxx
new file mode 100644
index 000000000000..79c18bb96e54
--- /dev/null
+++ b/sw/source/ui/dochdl/selglos.cxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#include "swtypes.hxx"
+
+#include "selglos.hxx"
+
+#include "selglos.hrc"
+#include "dochdl.hrc"
+#include <vcl/msgbox.hxx>
+
+// STATIC DATA -----------------------------------------------------------
+
+
+// CTOR / DTOR -----------------------------------------------------------
+
+SwSelGlossaryDlg::SwSelGlossaryDlg(Window * pParent, const String &rShortName)
+ : ModalDialog(pParent, SW_RES(DLG_SEL_GLOS)),
+ aGlosBox(this, SW_RES( LB_GLOS)),
+ aGlosFL(this, SW_RES( FL_GLOS)),
+ aOKBtn(this, SW_RES( BT_OK)),
+ aCancelBtn(this, SW_RES( BT_CANCEL)),
+ aHelpBtn(this, SW_RES(BT_HELP))
+{
+ String sText(aGlosFL.GetText());
+ sText += rShortName;
+ aGlosFL.SetText(sText);
+ FreeResource();
+
+ aGlosBox.SetDoubleClickHdl(LINK(this, SwSelGlossaryDlg, DoubleClickHdl));
+}
+
+/*-----------------25.02.94 20:50-------------------
+ dtor ueberladen
+--------------------------------------------------*/
+SwSelGlossaryDlg::~SwSelGlossaryDlg() {}
+/* -----------------25.10.99 08:33-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwSelGlossaryDlg, DoubleClickHdl, ListBox*, /*pBox*/)
+{
+ EndDialog(RET_OK);
+ return 0;
+}
diff --git a/sw/source/ui/dochdl/selglos.hrc b/sw/source/ui/dochdl/selglos.hrc
new file mode 100644
index 000000000000..175ee09abe1b
--- /dev/null
+++ b/sw/source/ui/dochdl/selglos.hrc
@@ -0,0 +1,31 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_HELP 102
+#define LB_GLOS 1
+#define FL_GLOS 2
diff --git a/sw/source/ui/dochdl/selglos.src b/sw/source/ui/dochdl/selglos.src
new file mode 100644
index 000000000000..d48e61aea37b
--- /dev/null
+++ b/sw/source/ui/dochdl/selglos.src
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "selglos.hrc"
+#include "dochdl.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+
+ // #define DLG_SEL_GLOS 256
+ModalDialog DLG_SEL_GLOS
+{
+ HelpID = CMD_FN_EXPAND_GLOSSARY ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 220 , 100 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? AutoText einfügen : AutoText einf³gen */
+ Text [ en-US ] = "Insert AutoText" ;
+ Moveable = TRUE ;
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 164 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 164 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 164 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_GLOS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 152 , 8 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? AutoTexte zum Kürzel : AutoTexte zum K³rzel */
+ Text [ en-US ] = "AutoTexts for shortcut " ;
+ };
+ ListBox LB_GLOS
+ {
+ HelpID = "sw:ListBox:DLG_SEL_GLOS:LB_GLOS";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 140 , 74 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
new file mode 100644
index 000000000000..23f7741969ce
--- /dev/null
+++ b/sw/source/ui/dochdl/swdtflvr.cxx
@@ -0,0 +1,3866 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef PRECOMPILED
+#include "ui_pch.hxx"
+#endif
+
+
+#include <com/sun/star/embed/XVisualObject.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/embed/XEmbedObjectClipboardCreator.hpp>
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+
+#include <svtools/embedtransfer.hxx>
+#include <svtools/insdlg.hxx>
+#include <unotools/tempfile.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <sot/filelist.hxx>
+#include <svx/svxdlg.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <osl/endian.h>
+#include <sfx2/linkmgr.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/stritem.hxx>
+#include <svtools/imap.hxx>
+#include <sot/storage.hxx>
+#include <vcl/graph.hxx>
+#include <svl/urihelper.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/xexch.hxx>
+#include <svx/xmlexchg.hxx>
+#include <svx/dbaexchange.hxx>
+#include <svx/clipfmtitem.hxx>
+#include <sfx2/mieclip.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/xoutbmp.hxx>
+#include <svl/urlbmk.hxx>
+#include <svtools/htmlout.hxx>
+#include <svx/hlnkitem.hxx>
+#include <svtools/inetimg.hxx>
+#include <editeng/paperinf.hxx>
+#include <svx/fmview.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <sfx2/docfilt.hxx>
+#include <svtools/imapobj.hxx>
+#include <sfx2/docfile.hxx>
+#include <unotools/transliterationwrapper.hxx>
+#include <unotools/streamwrap.hxx>
+#include <svtools/filter.hxx>
+
+#include <svx/unomodel.hxx>
+#include <fmturl.hxx>
+#include <fmtinfmt.hxx>
+#include <fmtfsize.hxx>
+#include <swdtflvr.hxx>
+#include <shellio.hxx>
+#include <ddefld.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <pagedesc.hxx>
+#include <IMark.hxx>
+#include <docary.hxx>
+#include <section.hxx>
+#include <ndtxt.hxx>
+#include <edtwin.hxx>
+#include <navicont.hxx>
+#include <swcont.hxx>
+#include <wrtsh.hxx>
+#include <swmodule.hxx>
+#include <view.hxx>
+#include <docsh.hxx>
+#include <wdocsh.hxx>
+#include <fldbas.hxx> //DDE
+#include <swundo.hxx> // fuer Undo-Ids
+#include <pam.hxx>
+#include <ndole.hxx>
+#include <swwait.hxx>
+#include <viewopt.hxx>
+#include <swunodef.hxx>
+#include <vcl/sound.hxx>
+#include <swerror.h>
+#include <SwCapObjType.hxx>
+#include <cmdid.h>
+#include <dochdl.hrc>
+#include <comcore.hrc> // #111827#
+#include <sot/stg.hxx>
+
+// #108584#
+#include <svx/svditer.hxx>
+
+// #108584#
+#include <editeng/eeitem.hxx>
+
+// #108584#
+#include <editeng/fhgtitem.hxx>
+
+// #108584#
+#include <svx/svdpage.hxx>
+#include <avmedia/mediawindow.hxx>
+
+// #109590#
+#include <swcrsr.hxx>
+#include <SwRewriter.hxx>
+#include <globals.hrc>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <swserv.hxx>
+
+extern BOOL bFrmDrag;
+extern BOOL bDDINetAttr;
+extern BOOL bExecuteDrag;
+
+
+#define OLESIZE 11905 - 2 * lMinBorder, 6 * MM50
+
+#define SWTRANSFER_OBJECTTYPE_DRAWMODEL 0x00000001
+#define SWTRANSFER_OBJECTTYPE_HTML 0x00000002
+#define SWTRANSFER_OBJECTTYPE_RTF 0x00000004
+#define SWTRANSFER_OBJECTTYPE_STRING 0x00000008
+#define SWTRANSFER_OBJECTTYPE_SWOLE 0x00000010
+#define SWTRANSFER_OBJECTTYPE_DDE 0x00000020
+
+#define SWTRANSFER_GRAPHIC_INSERTED 0x00000040
+
+using namespace ::svx;
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::datatransfer;
+using namespace nsTransferBufferType;
+
+#define DDE_TXT_ENCODING gsl_getSystemTextEncoding()
+
+//---------------------------------------------
+// this struct conforms to the Microsoft
+// OBJECTDESCRIPTOR -> see oleidl.h
+// (MS platform sdk)
+//---------------------------------------------
+
+struct OleObjectDescriptor
+{
+ sal_uInt32 cbSize;
+ ClsId clsid;
+ sal_uInt32 dwDrawAspect;
+ Size sizel;
+ Point pointl;
+ sal_uInt32 dwStatus;
+ sal_uInt32 dwFullUserTypeName;
+ sal_uInt32 dwSrcOfCopy;
+};
+
+class SwTrnsfrDdeLink : public ::sfx2::SvBaseLink
+{
+ String sName;
+ ::sfx2::SvLinkSourceRef refObj;
+ SwTransferable& rTrnsfr;
+ SwDocShell* pDocShell;
+ ULONG nOldTimeOut;
+ BOOL bDelBookmrk : 1;
+ BOOL bInDisconnect : 1;
+
+ BOOL FindDocShell();
+
+ using sfx2::SvBaseLink::Disconnect;
+
+protected:
+ virtual ~SwTrnsfrDdeLink();
+
+public:
+ SwTrnsfrDdeLink( SwTransferable& rTrans, SwWrtShell& rSh );
+
+ virtual void DataChanged( const String& rMimeType,
+ const uno::Any & rValue );
+ virtual void Closed();
+
+ BOOL WriteData( SvStream& rStrm );
+
+ void Disconnect( BOOL bRemoveDataAdvise );
+};
+
+// helper class for Action and Undo enclosing
+class SwTrnsfrActionAndUndo
+{
+ SwWrtShell *pSh;
+ SwUndoId eUndoId;
+public:
+ SwTrnsfrActionAndUndo( SwWrtShell *pS, SwUndoId nId,
+ const SwRewriter * pRewriter = 0,
+ BOOL bDelSel = FALSE)
+ : pSh( pS ), eUndoId( nId )
+ {
+ pSh->StartUndo( eUndoId, pRewriter );
+ if( bDelSel )
+ pSh->DelRight();
+ pSh->StartAllAction();
+ }
+ ~SwTrnsfrActionAndUndo()
+ {
+ pSh->EndUndo();
+ pSh->EndAllAction();
+ }
+};
+
+
+// -----------------------------------------------------------------------
+
+SwTransferable::SwTransferable( SwWrtShell& rSh )
+ : pWrtShell( &rSh ),
+ pCreatorView( 0 ),
+ pClpDocFac( 0 ),
+ pClpGraphic( 0 ),
+ pClpBitmap( 0 ),
+ pOrigGrf( 0 ),
+ pBkmk( 0 ),
+ pImageMap( 0 ),
+ pTargetURL( 0 ),
+ eBufferType( TRNSFR_NONE )
+{
+ rSh.GetView().AddTransferable(*this);
+ SwDocShell* pDShell = rSh.GetDoc()->GetDocShell();
+ if( pDShell )
+ {
+ pDShell->FillTransferableObjectDescriptor( aObjDesc );
+ if( pDShell->GetMedium() )
+ {
+ const INetURLObject& rURLObj = pDShell->GetMedium()->GetURLObject();
+ aObjDesc.maDisplayName = URIHelper::removePassword(
+ rURLObj.GetMainURL( INetURLObject::NO_DECODE ),
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS );
+ }
+
+ PrepareOLE( aObjDesc );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SwTransferable::~SwTransferable()
+{
+ Application::GetSolarMutex().acquire();
+
+ // der DDELink braucht noch die WrtShell!
+ if( refDdeLink.Is() )
+ {
+ ((SwTrnsfrDdeLink*)&refDdeLink)->Disconnect( TRUE );
+ refDdeLink.Clear();
+ }
+
+ pWrtShell = 0;
+
+ // dvo 2002-05-30, #99239#: release reference to the document so that
+ // aDocShellRef will delete it (if aDocShellRef is set). Otherwise, the OLE
+ // nodes keep references to their sub-storage when the storage is already
+ // dead.
+ delete pClpDocFac;
+
+ //JP 22.04.95: erst schliessen, dann kann die Ref. auch gecleared werden,
+ // so das die DocShell auch tatsaechlich geloescht wird!
+ if( aDocShellRef.Is() )
+ {
+ SfxObjectShell * pObj = aDocShellRef;
+ SwDocShell* pDocSh = (SwDocShell*)pObj;
+ pDocSh->DoClose();
+ }
+ aDocShellRef.Clear();
+
+ SwModule* pMod = SW_MOD();
+ if(pMod)
+ {
+ if ( pMod->pDragDrop == this )
+ pMod->pDragDrop = 0;
+ else if ( pMod->pXSelection == this )
+ pMod->pXSelection = 0;
+ }
+
+ delete pClpGraphic;
+ delete pClpBitmap;
+ delete pImageMap;
+ delete pTargetURL;
+ delete pBkmk;
+
+
+ eBufferType = TRNSFR_NONE;
+
+ Application::GetSolarMutex().release();
+}
+
+// -----------------------------------------------------------------------
+
+static SwDoc * lcl_GetDoc(SwDocFac & rDocFac)
+{
+ SwDoc *const pDoc = rDocFac.GetDoc();
+ ASSERT( pDoc, "Document not found" );
+ if (pDoc)
+ {
+ pDoc->SetClipBoard( true );
+ }
+ return pDoc;
+}
+
+// -----------------------------------------------------------------------
+
+void SwTransferable::ObjectReleased()
+{
+ SwModule *pMod = SW_MOD();
+ if( this == pMod->pDragDrop )
+ pMod->pDragDrop = 0;
+ else if( this == pMod->pXSelection )
+ pMod->pXSelection = 0;
+}
+
+// -----------------------------------------------------------------------
+
+void SwTransferable::AddSupportedFormats()
+{
+ // only need if we are the current XSelection Object
+ SwModule *pMod = SW_MOD();
+ if( this == pMod->pXSelection )
+ {
+ SetDataForDragAndDrop( Point( 0,0) );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SwTransferable::InitOle( SfxObjectShell* pDoc, SwDoc& rDoc )
+{
+ //OleVisArea einstellen. Linke obere Ecke der Seite und Groesse
+ //der RealSize in Twips.
+ const Size aSz( OLESIZE );
+ SwRect aVis( Point( DOCUMENTBORDER, DOCUMENTBORDER ), aSz );
+ pDoc->SetVisArea( aVis.SVRect() );
+ rDoc.set(IDocumentSettingAccess::BROWSE_MODE, true );
+}
+
+// -----------------------------------------------------------------------
+
+uno::Reference < embed::XEmbeddedObject > SwTransferable::FindOLEObj( sal_Int64& nAspect ) const
+{
+ uno::Reference < embed::XEmbeddedObject > xObj;
+ if( pClpDocFac )
+ {
+ SwClientIter aIter( *(SwModify*)pClpDocFac->GetDoc()->
+ GetDfltGrfFmtColl() );
+ for( SwCntntNode* pNd = (SwCntntNode*)aIter.First( TYPE( SwCntntNode ) );
+ pNd; pNd = (SwCntntNode*)aIter.Next() )
+ if( ND_OLENODE == pNd->GetNodeType() )
+ {
+ xObj = ((SwOLENode*)pNd)->GetOLEObj().GetOleRef();
+ nAspect = ((SwOLENode*)pNd)->GetAspect();
+ break;
+ }
+ }
+ return xObj;
+}
+
+// -----------------------------------------------------------------------
+
+Graphic* SwTransferable::FindOLEReplacementGraphic() const
+{
+ if( pClpDocFac )
+ {
+ SwClientIter aIter( *(SwModify*)pClpDocFac->GetDoc()->
+ GetDfltGrfFmtColl() );
+ for( SwCntntNode* pNd = (SwCntntNode*)aIter.First( TYPE( SwCntntNode ) );
+ pNd; pNd = (SwCntntNode*)aIter.Next() )
+ if( ND_OLENODE == pNd->GetNodeType() )
+ {
+ return ((SwOLENode*)pNd)->GetGraphic();
+ }
+ }
+
+ return NULL;
+}
+
+
+// -----------------------------------------------------------------------
+
+void SwTransferable::RemoveDDELinkFormat( const Window& rWin )
+{
+ RemoveFormat( SOT_FORMATSTR_ID_LINK );
+ CopyToClipboard( (Window*)&rWin );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SwTransferable::GetData( const DATA_FLAVOR& rFlavor )
+{
+ sal_uInt32 nFormat = SotExchange::GetFormat( rFlavor );
+
+ // we can only fullfil the request if
+ // 1) we have data for this format
+ // 2) we have either a clipboard document (pClpDocFac), or
+ // we have a SwWrtShell (so we can generate a new clipboard document)
+ if( !HasFormat( nFormat ) || ( pClpDocFac == NULL && pWrtShell == NULL ) )
+ return sal_False;
+
+ if( !pClpDocFac )
+ {
+ SelectionType nSelectionType = pWrtShell->GetSelectionType();
+
+// SEL_GRF kommt vom ContentType der editsh
+ if( (nsSelectionType::SEL_GRF | nsSelectionType::SEL_DRW_FORM) & nSelectionType )
+ {
+ pClpGraphic = new Graphic;
+ if( !pWrtShell->GetDrawObjGraphic( FORMAT_GDIMETAFILE, *pClpGraphic ))
+ pOrigGrf = pClpGraphic;
+ pClpBitmap = new Graphic;
+ if( !pWrtShell->GetDrawObjGraphic( FORMAT_BITMAP, *pClpBitmap ))
+ pOrigGrf = pClpBitmap;
+
+ // ist es ein URL-Button ?
+ String sURL, sDesc;
+ if( pWrtShell->GetURLFromButton( sURL, sDesc ) )
+ {
+ pBkmk = new INetBookmark( sURL, sDesc );
+ eBufferType = TRNSFR_INETFLD;
+ }
+ }
+
+ pClpDocFac = new SwDocFac;
+ SwDoc *const pTmpDoc = lcl_GetDoc(*pClpDocFac);
+
+ pTmpDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen
+ pWrtShell->Copy( pTmpDoc );
+
+ // es wurde in der CORE eine neu angelegt (OLE-Objekte kopiert!)
+ aDocShellRef = pTmpDoc->GetTmpDocShell();
+ if( aDocShellRef.Is() )
+ SwTransferable::InitOle( aDocShellRef, *pTmpDoc );
+ pTmpDoc->SetTmpDocShell( (SfxObjectShell*)NULL );
+
+ if( nSelectionType & nsSelectionType::SEL_TXT && !pWrtShell->HasMark() )
+ {
+ SwContentAtPos aCntntAtPos( SwContentAtPos::SW_INETATTR );
+
+ Point aPos( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY());
+
+ BOOL bSelect = bExecuteDrag &&
+ pWrtShell->GetView().GetDocShell() &&
+ !pWrtShell->GetView().GetDocShell()->IsReadOnly();
+ if( pWrtShell->GetContentAtPos( aPos, aCntntAtPos, bSelect ) )
+ {
+ pBkmk = new INetBookmark(
+ ((SwFmtINetFmt*)aCntntAtPos.aFnd.pAttr)->GetValue(),
+ aCntntAtPos.sStr );
+ eBufferType = TRNSFR_INETFLD;
+ if( bSelect )
+ pWrtShell->SelectTxtAttr( RES_TXTATR_INETFMT );
+ }
+ }
+ if( pWrtShell->IsFrmSelected() )
+ {
+ SfxItemSet aSet( pWrtShell->GetAttrPool(), RES_URL, RES_URL );
+ pWrtShell->GetFlyFrmAttr( aSet );
+ const SwFmtURL& rURL = (SwFmtURL&)aSet.Get( RES_URL );
+ if( rURL.GetMap() )
+ pImageMap = new ImageMap( *rURL.GetMap() );
+ else if( rURL.GetURL().Len() )
+ pTargetURL = new INetImage( aEmptyStr, rURL.GetURL(),
+ rURL.GetTargetFrameName(),
+ aEmptyStr, Size() );
+ }
+ }
+
+ sal_Bool bOK = sal_False;
+ if( TRNSFR_OLE == eBufferType )
+ {
+ //TODO/MBA: testing - is this the "single OLE object" case?!
+ // aus dem ClipDoc das OLE-Object besorgen und von dem die Daten
+ // besorgen.
+ sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT; // will be set in the next statement
+ uno::Reference < embed::XEmbeddedObject > xObj = FindOLEObj( nAspect );
+ Graphic* pOLEGraph = FindOLEReplacementGraphic();
+ if( xObj.is() )
+ {
+ TransferableDataHelper aD( new SvEmbedTransferHelper( xObj, pOLEGraph, nAspect ) );
+ uno::Any aAny( aD.GetAny( rFlavor ));
+ if( aAny.hasValue() )
+ bOK = SetAny( aAny, rFlavor );
+ }
+
+ // the following solution will be used in the case when the object can not generate the image
+ // TODO/LATER: in future the transferhelper must probably be created based on object and the replacement stream
+ if ( nFormat == SOT_FORMAT_GDIMETAFILE )
+ {
+ pOLEGraph = FindOLEReplacementGraphic();
+ if ( pOLEGraph )
+ bOK = SetGDIMetaFile( pOLEGraph->GetGDIMetaFile(), rFlavor );
+ }
+ }
+ else
+ {
+ switch( nFormat )
+ {
+ case SOT_FORMATSTR_ID_LINK:
+ if( refDdeLink.Is() )
+ bOK = SetObject( &refDdeLink,
+ SWTRANSFER_OBJECTTYPE_DDE, rFlavor );
+ break;
+
+ case SOT_FORMATSTR_ID_OBJECTDESCRIPTOR:
+ case SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR:
+ bOK = SetTransferableObjectDescriptor( aObjDesc, rFlavor );
+ break;
+
+ case SOT_FORMATSTR_ID_DRAWING:
+ {
+ SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
+ bOK = SetObject( pDoc->GetDrawModel(),
+ SWTRANSFER_OBJECTTYPE_DRAWMODEL, rFlavor );
+ }
+ break;
+
+ case SOT_FORMAT_STRING:
+ {
+ SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
+ bOK = SetObject( pDoc, SWTRANSFER_OBJECTTYPE_STRING, rFlavor );
+ }
+ break;
+ case SOT_FORMAT_RTF:
+ {
+ SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
+ bOK = SetObject( pDoc, SWTRANSFER_OBJECTTYPE_RTF, rFlavor );
+ }
+ break;
+
+ case SOT_FORMATSTR_ID_HTML:
+ {
+ SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
+ bOK = SetObject( pDoc, SWTRANSFER_OBJECTTYPE_HTML, rFlavor );
+ }
+ break;
+
+ case SOT_FORMATSTR_ID_SVXB:
+ if( eBufferType & TRNSFR_GRAPHIC && pOrigGrf )
+ bOK = SetGraphic( *pOrigGrf, rFlavor );
+ break;
+
+ case SOT_FORMAT_GDIMETAFILE:
+ if( eBufferType & TRNSFR_GRAPHIC )
+ bOK = SetGDIMetaFile( pClpGraphic->GetGDIMetaFile(), rFlavor );
+ break;
+ case SOT_FORMAT_BITMAP:
+ // #126398# Neither pClpBitmap nor pClpGraphic are necessarily set
+ if( (eBufferType & TRNSFR_GRAPHIC) && (pClpBitmap != 0 || pClpGraphic != 0))
+ bOK = SetBitmap( (pClpBitmap ? pClpBitmap
+ : pClpGraphic)->GetBitmap(),
+ rFlavor );
+ break;
+
+ case SOT_FORMATSTR_ID_SVIM:
+ if( pImageMap )
+ bOK = SetImageMap( *pImageMap, rFlavor );
+ break;
+
+ case SOT_FORMATSTR_ID_INET_IMAGE:
+ if( pTargetURL )
+ bOK = SetINetImage( *pTargetURL, rFlavor );
+ break;
+
+ case SOT_FORMATSTR_ID_SOLK:
+ case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
+ case SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR:
+ case SOT_FORMATSTR_ID_FILECONTENT:
+ case SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR:
+ case SOT_FORMAT_FILE:
+ if( (TRNSFR_INETFLD & eBufferType) && pBkmk )
+ bOK = SetINetBookmark( *pBkmk, rFlavor );
+ break;
+
+ case SOT_FORMATSTR_ID_EMBED_SOURCE:
+// default:
+ if( !aDocShellRef.Is() )
+ {
+ SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
+ SwDocShell* pNewDocSh = new SwDocShell( pDoc,
+ SFX_CREATE_MODE_EMBEDDED );
+ aDocShellRef = pNewDocSh;
+ aDocShellRef->DoInitNew( NULL );
+ SwTransferable::InitOle( aDocShellRef, *pDoc );
+ }
+ bOK = SetObject( &aDocShellRef, SWTRANSFER_OBJECTTYPE_SWOLE,
+ rFlavor );
+ break;
+ }
+ }
+ return bOK;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SwTransferable::WriteObject( SotStorageStreamRef& xStream,
+ void* pObject, sal_uInt32 nObjectType,
+ const DATA_FLAVOR& /*rFlavor*/ )
+{
+ sal_Bool bRet = sal_False;
+ WriterRef xWrt;
+
+ switch( nObjectType )
+ {
+ case SWTRANSFER_OBJECTTYPE_DRAWMODEL:
+ {
+ //JP 28.02.2001: dont change the sequence of commands - Bug 8
+ SdrModel *pModel = (SdrModel*)pObject;
+ xStream->SetBufferSize( 16348 );
+
+ // #108584#
+ // for the changed pool defaults from drawing layer pool set those
+ // attributes as hard attributes to preserve them for saving
+ const SfxItemPool& rItemPool = pModel->GetItemPool();
+ const SvxFontHeightItem& rDefaultFontHeight = (const SvxFontHeightItem&)rItemPool.GetDefaultItem(EE_CHAR_FONTHEIGHT);
+
+ // SW should have no MasterPages
+ DBG_ASSERT(0L == pModel->GetMasterPageCount(), "SW with MasterPages (!)");
+
+ for(sal_uInt16 a(0); a < pModel->GetPageCount(); a++)
+ {
+ const SdrPage* pPage = pModel->GetPage(a);
+ SdrObjListIter aIter(*pPage, IM_DEEPNOGROUPS);
+
+ while(aIter.IsMore())
+ {
+ SdrObject* pObj = aIter.Next();
+ const SvxFontHeightItem& rItem = (const SvxFontHeightItem&)pObj->GetMergedItem(EE_CHAR_FONTHEIGHT);
+
+ if(rItem.GetHeight() == rDefaultFontHeight.GetHeight())
+ {
+ pObj->SetMergedItem(rDefaultFontHeight);
+ }
+ }
+ }
+
+ {
+ uno::Reference<io::XOutputStream> xDocOut( new utl::OOutputStreamWrapper( *xStream ) );
+ if( SvxDrawingLayerExport( pModel, xDocOut ) )
+ xStream->Commit();
+ }
+
+ bRet = ERRCODE_NONE == xStream->GetError();
+ }
+ break;
+
+ case SWTRANSFER_OBJECTTYPE_SWOLE:
+ {
+ SfxObjectShell* pEmbObj = (SfxObjectShell*) pObject;
+ try
+ {
+ ::utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ uno::Reference< embed::XStorage > xWorkStore =
+ ::comphelper::OStorageHelper::GetStorageFromURL( aTempFile.GetURL(), embed::ElementModes::READWRITE );
+
+ // write document storage
+ pEmbObj->SetupStorage( xWorkStore, SOFFICE_FILEFORMAT_CURRENT, sal_False );
+ // mba: no BaseURL for clipboard
+ SfxMedium aMedium( xWorkStore, String() );
+ bRet = pEmbObj->DoSaveObjectAs( aMedium, FALSE );
+ pEmbObj->DoSaveCompleted();
+
+ uno::Reference< embed::XTransactedObject > xTransact( xWorkStore, uno::UNO_QUERY );
+ if ( xTransact.is() )
+ xTransact->commit();
+
+ SvStream* pSrcStm = ::utl::UcbStreamHelper::CreateStream( aTempFile.GetURL(), STREAM_READ );
+ if( pSrcStm )
+ {
+ xStream->SetBufferSize( 0xff00 );
+ *xStream << *pSrcStm;
+ delete pSrcStm;
+ }
+
+ bRet = TRUE;
+
+ xWorkStore->dispose();
+ xWorkStore = uno::Reference < embed::XStorage >();
+ xStream->Commit();
+ }
+ catch ( uno::Exception& )
+ {}
+
+ bRet = ( xStream->GetError() == ERRCODE_NONE );
+ }
+ break;
+
+
+ case SWTRANSFER_OBJECTTYPE_DDE:
+ {
+ xStream->SetBufferSize( 1024 );
+ SwTrnsfrDdeLink* pDdeLnk = (SwTrnsfrDdeLink*)pObject;
+ if( pDdeLnk->WriteData( *xStream ) )
+ {
+ xStream->Commit();
+ bRet = ERRCODE_NONE == xStream->GetError();
+ }
+ }
+ break;
+
+ case SWTRANSFER_OBJECTTYPE_HTML:
+ GetHTMLWriter( aEmptyStr, String(), xWrt );
+ break;
+
+ case SWTRANSFER_OBJECTTYPE_RTF:
+ GetRTFWriter( aEmptyStr, String(), xWrt );
+ break;
+
+ case SWTRANSFER_OBJECTTYPE_STRING:
+ GetASCWriter( aEmptyStr, String(), xWrt );
+ if( xWrt.Is() )
+ {
+ SwAsciiOptions aAOpt;
+ aAOpt.SetCharSet( RTL_TEXTENCODING_UTF8 );
+ xWrt->SetAsciiOptions( aAOpt );
+
+ // #102841# no start char for clipboard
+ xWrt->bUCS2_WithStartChar = FALSE;
+ }
+ break;
+ }
+
+ if( xWrt.Is() )
+ {
+ SwDoc* pDoc = (SwDoc*)pObject;
+ xWrt->bWriteClipboardDoc = TRUE;
+ xWrt->bWriteOnlyFirstTable = 0 != (TRNSFR_TABELLE & eBufferType);
+ xWrt->SetShowProgress( FALSE );
+ SwWriter aWrt( *xStream, *pDoc );
+ if( !IsError( aWrt.Write( xWrt )) )
+ {
+ *xStream << '\0'; // terminate with a zero
+ xStream->Commit();
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::Cut()
+{
+ int nRet = Copy( TRUE );
+ if( nRet )
+ DeleteSelection();
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+void SwTransferable::DeleteSelection()
+{
+ if(!pWrtShell)
+ return;
+ // Selektionsart vor Action-Klammerung erfragen
+ const int nSelection = pWrtShell->GetSelectionType();
+ pWrtShell->StartUndo( UNDO_DELETE );
+ if( ( nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL ) & nSelection )
+ pWrtShell->IntelligentCut( nSelection );
+ pWrtShell->DelRight();
+ pWrtShell->EndUndo( UNDO_DELETE );
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::PrepareForCopy( BOOL bIsCut )
+{
+ int nRet = 1;
+ if(!pWrtShell)
+ return 0;;
+
+ String sGrfNm;
+ const int nSelection = pWrtShell->GetSelectionType();
+ if( nSelection == nsSelectionType::SEL_GRF )
+ {
+ pClpGraphic = new Graphic;
+ if( !pWrtShell->GetDrawObjGraphic( FORMAT_GDIMETAFILE, *pClpGraphic ))
+ pOrigGrf = pClpGraphic;
+ pClpBitmap = new Graphic;
+ if( !pWrtShell->GetDrawObjGraphic( FORMAT_BITMAP, *pClpBitmap ))
+ pOrigGrf = pClpBitmap;
+
+ pClpDocFac = new SwDocFac;
+ SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
+ pWrtShell->Copy( pDoc );
+
+ if (pOrigGrf && !pOrigGrf->GetBitmap().IsEmpty())
+ AddFormat( SOT_FORMATSTR_ID_SVXB );
+
+ PrepareOLE( aObjDesc );
+ AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
+
+ // --> OD 2005-02-09 #119353# - robust
+ const Graphic* pGrf = pWrtShell->GetGraphic();
+ if( pGrf && pGrf->IsSupportedGraphic() )
+ // <--
+ {
+ AddFormat( FORMAT_GDIMETAFILE );
+ AddFormat( FORMAT_BITMAP );
+ }
+ eBufferType = TRNSFR_GRAPHIC;
+ pWrtShell->GetGrfNms( &sGrfNm, 0 );
+ }
+ else if ( nSelection == nsSelectionType::SEL_OLE )
+ {
+ pClpDocFac = new SwDocFac;
+ SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
+ aDocShellRef = new SwDocShell( pDoc, SFX_CREATE_MODE_EMBEDDED);
+ aDocShellRef->DoInitNew( NULL );
+ pWrtShell->Copy( pDoc );
+
+ AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
+
+ PrepareOLE( aObjDesc );
+ AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
+
+ AddFormat( FORMAT_GDIMETAFILE );
+ eBufferType = TRNSFR_OLE;
+ }
+ //Gibt es ueberhaupt etwas zum bereitstellen?
+ else if ( pWrtShell->IsSelection() || pWrtShell->IsFrmSelected() ||
+ pWrtShell->IsObjSelected() )
+ {
+ SwWait *pWait = 0;
+ if( pWrtShell->ShouldWait() )
+ pWait = new SwWait( *pWrtShell->GetView().GetDocShell(), TRUE );
+
+ pClpDocFac = new SwDocFac;
+
+ // zusaetzlichen Cursor erzeugen, damit eine Gleichbehandlung
+ // von Tastatur- und Mausselektion moeglich ist.
+ // Im AddMode wird bei Tastaturselektion der neue Cursor erst
+ // beim Bewegen des Cursors nach Selektionsende erzeugt.
+ if( pWrtShell->IsAddMode() && pWrtShell->SwCrsrShell::HasSelection() )
+ pWrtShell->CreateCrsr();
+
+ SwDoc *const pTmpDoc = lcl_GetDoc(*pClpDocFac);
+
+ pTmpDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen
+ pWrtShell->Copy( pTmpDoc );
+
+ {
+ IDocumentMarkAccess* const pMarkAccess = pTmpDoc->getIDocumentMarkAccess();
+ ::std::vector< ::sw::mark::IMark* > vDdeMarks;
+ // find all DDE-Bookmarks
+ for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
+ ppMark != pMarkAccess->getMarksEnd();
+ ppMark++)
+ {
+ if(IDocumentMarkAccess::DDE_BOOKMARK == IDocumentMarkAccess::GetType(**ppMark))
+ vDdeMarks.push_back(ppMark->get());
+ }
+ // remove all DDE-Bookmarks, they are invalid inside the clipdoc!
+ for(::std::vector< ::sw::mark::IMark* >::iterator ppMark = vDdeMarks.begin();
+ ppMark != vDdeMarks.end();
+ ppMark++)
+ pMarkAccess->deleteMark(*ppMark);
+ }
+
+ // es wurde in der CORE eine neu angelegt (OLE-Objekte kopiert!)
+ aDocShellRef = pTmpDoc->GetTmpDocShell();
+ if( aDocShellRef.Is() )
+ SwTransferable::InitOle( aDocShellRef, *pTmpDoc );
+ pTmpDoc->SetTmpDocShell( (SfxObjectShell*)NULL );
+
+ if( pWrtShell->IsObjSelected() )
+ eBufferType = TRNSFR_DRAWING;
+ else
+ {
+ eBufferType = TRNSFR_DOCUMENT;
+ if (pWrtShell->IntelligentCut(nSelection, FALSE) != SwWrtShell::NO_WORD)
+ eBufferType = (TransferBufferType)(TRNSFR_DOCUMENT_WORD | eBufferType);
+ }
+
+ int bDDELink = pWrtShell->IsSelection();
+ if( nSelection & nsSelectionType::SEL_TBL_CELLS )
+ {
+ eBufferType = (TransferBufferType)(TRNSFR_TABELLE | eBufferType);
+ bDDELink = pWrtShell->HasWholeTabSelection();
+ }
+
+ //Wenn's einer braucht OLE'n wir ihm was.
+ AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
+
+ //RTF vor das Metafile von OLE stellen, weil mit weniger verlusten
+ //behaftet.
+ if( !pWrtShell->IsObjSelected() )
+ {
+ AddFormat( FORMAT_RTF );
+ AddFormat( SOT_FORMATSTR_ID_HTML );
+ }
+ if( pWrtShell->IsSelection() )
+ AddFormat( FORMAT_STRING );
+
+ if( nSelection & ( nsSelectionType::SEL_DRW | nsSelectionType::SEL_DRW_FORM ))
+ {
+ AddFormat( SOT_FORMATSTR_ID_DRAWING );
+ if ( nSelection & nsSelectionType::SEL_DRW )
+ {
+ AddFormat( FORMAT_GDIMETAFILE );
+ AddFormat( FORMAT_BITMAP );
+ }
+ eBufferType = (TransferBufferType)( TRNSFR_GRAPHIC | eBufferType );
+
+ pClpGraphic = new Graphic;
+ if( !pWrtShell->GetDrawObjGraphic( FORMAT_GDIMETAFILE, *pClpGraphic ))
+ pOrigGrf = pClpGraphic;
+ pClpBitmap = new Graphic;
+ if( !pWrtShell->GetDrawObjGraphic( FORMAT_BITMAP, *pClpBitmap ))
+ pOrigGrf = pClpBitmap;
+
+ // ist es ein URL-Button ?
+ String sURL, sDesc;
+ if( pWrtShell->GetURLFromButton( sURL, sDesc ) )
+ {
+ AddFormat( FORMAT_STRING );
+ AddFormat( SOT_FORMATSTR_ID_SOLK );
+ AddFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK );
+ AddFormat( SOT_FORMATSTR_ID_FILECONTENT );
+ AddFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR );
+ AddFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR );
+ eBufferType = (TransferBufferType)( TRNSFR_INETFLD | eBufferType );
+ nRet = sal_True;
+ }
+ }
+
+ // beim Cut hat DDE-Link keinen Sinn!!
+ SwDocShell* pDShell;
+ if( !bIsCut && bDDELink &&
+ 0 != ( pDShell = pWrtShell->GetDoc()->GetDocShell()) &&
+ SFX_CREATE_MODE_STANDARD == pDShell->GetCreateMode() )
+ {
+ AddFormat( SOT_FORMATSTR_ID_LINK );
+ refDdeLink = new SwTrnsfrDdeLink( *this, *pWrtShell );
+ }
+
+ //ObjectDescriptor wurde bereits aus der alten DocShell gefuellt.
+ //Jetzt noch anpassen. Dadurch kann im GetData die erste Anfrage
+ //auch noch mit delayed rendering beantwortet werden.
+ aObjDesc.mbCanLink = FALSE;
+ Size aSz( OLESIZE );
+ aObjDesc.maSize = OutputDevice::LogicToLogic( aSz, MAP_TWIP, MAP_100TH_MM );
+
+ PrepareOLE( aObjDesc );
+ AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
+
+ delete pWait;
+ }
+ else
+ nRet = 0;
+
+ if( pWrtShell->IsFrmSelected() )
+ {
+ SfxItemSet aSet( pWrtShell->GetAttrPool(), RES_URL, RES_URL );
+ pWrtShell->GetFlyFrmAttr( aSet );
+ const SwFmtURL& rURL = (SwFmtURL&)aSet.Get( RES_URL );
+ if( rURL.GetMap() )
+ {
+ pImageMap = new ImageMap( *rURL.GetMap() );
+ AddFormat( SOT_FORMATSTR_ID_SVIM );
+ }
+ else if( rURL.GetURL().Len() )
+ {
+ pTargetURL = new INetImage( sGrfNm, rURL.GetURL(),
+ rURL.GetTargetFrameName(),
+ aEmptyStr, Size() );
+ AddFormat( SOT_FORMATSTR_ID_INET_IMAGE );
+ }
+ }
+
+ return nRet;
+}
+
+int SwTransferable::Copy( BOOL bIsCut )
+{
+ int nRet = PrepareForCopy( bIsCut );
+ if ( nRet )
+ {
+ CopyToClipboard( &pWrtShell->GetView().GetEditWin() );
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::CalculateAndCopy()
+{
+ if(!pWrtShell)
+ return 0;
+ SwWait aWait( *pWrtShell->GetView().GetDocShell(), TRUE );
+
+ String aStr( pWrtShell->Calculate() );
+
+ pClpDocFac = new SwDocFac;
+ SwDoc *const pDoc = lcl_GetDoc(*pClpDocFac);
+ pWrtShell->Copy(pDoc, & aStr);
+ eBufferType = TRNSFR_DOCUMENT;
+ AddFormat( FORMAT_STRING );
+
+ CopyToClipboard( &pWrtShell->GetView().GetEditWin() );
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary,
+ const String& rStr )
+{
+ if(!pWrtShell)
+ return 0;
+ SwWait aWait( *pWrtShell->GetView().GetDocShell(), TRUE );
+
+ pClpDocFac = new SwDocFac;
+ SwDoc *const pCDoc = lcl_GetDoc(*pClpDocFac);
+
+ SwNodes& rNds = pCDoc->GetNodes();
+ SwNodeIndex aNodeIdx( *rNds.GetEndOfContent().StartOfSectionNode() );
+ SwCntntNode* pCNd = rNds.GoNext( &aNodeIdx ); // gehe zum 1. ContentNode
+ SwPaM aPam( *pCNd );
+
+ pCDoc->LockExpFlds(); // nie die Felder updaten - Text so belassen
+
+ pCDoc->InsertGlossary( rGlossary, rStr, aPam, 0 );
+
+ // es wurde in der CORE eine neu angelegt (OLE-Objekte kopiert!)
+ aDocShellRef = pCDoc->GetTmpDocShell();
+ if( aDocShellRef.Is() )
+ SwTransferable::InitOle( aDocShellRef, *pCDoc );
+ pCDoc->SetTmpDocShell( (SfxObjectShell*)NULL );
+
+ eBufferType = TRNSFR_DOCUMENT;
+
+ //Wenn's einer braucht OLE'n wir ihm was.
+ AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
+ AddFormat( FORMAT_RTF );
+ AddFormat( SOT_FORMATSTR_ID_HTML );
+ AddFormat( FORMAT_STRING );
+
+ //ObjectDescriptor wurde bereits aus der alten DocShell gefuellt.
+ //Jetzt noch anpassen. Dadurch kann im GetData die erste Anfrage
+ //auch noch mit delayed rendering beantwortet werden.
+ aObjDesc.mbCanLink = FALSE;
+ Size aSz( OLESIZE );
+ aObjDesc.maSize = OutputDevice::LogicToLogic( aSz, MAP_TWIP, MAP_100TH_MM );
+
+ PrepareOLE( aObjDesc );
+ AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
+
+ CopyToClipboard( &pWrtShell->GetView().GetEditWin() );
+
+ return 1;
+}
+
+static inline uno::Reference < XTransferable > * lcl_getTransferPointer ( uno::Reference < XTransferable > &xRef )
+{
+ return &xRef;
+}
+// -----------------------------------------------------------------------
+
+BOOL SwTransferable::IsPaste( const SwWrtShell& rSh,
+ const TransferableDataHelper& rData )
+{
+ // Check the common case first: We can always paste our own data!
+ // #106503#: If _only_ the internal format can be pasted, this check will
+ // yield 'true', while the one below would give a (wrong) result 'false'.
+
+ bool bIsPaste = ( GetSwTransferable( rData ) != NULL );
+
+ // if it's not our own data, we need to have a closer look:
+ if( ! bIsPaste )
+ {
+ // determine the proper paste action, and return true if we find one
+ uno::Reference<XTransferable> xTransferable( rData.GetXTransferable() );
+
+ USHORT nDestination = SwTransferable::GetSotDestination( rSh );
+ USHORT nSourceOptions =
+ (( EXCHG_DEST_DOC_TEXTFRAME == nDestination ||
+ EXCHG_DEST_SWDOC_FREE_AREA == nDestination ||
+ EXCHG_DEST_DOC_TEXTFRAME_WEB == nDestination ||
+ EXCHG_DEST_SWDOC_FREE_AREA_WEB == nDestination )
+ ? EXCHG_IN_ACTION_COPY
+ : EXCHG_IN_ACTION_MOVE);
+
+ ULONG nFormat; // output param for GetExchangeAction
+ USHORT nEventAction; // output param for GetExchangeAction
+ USHORT nAction = SotExchange::GetExchangeAction(
+ rData.GetDataFlavorExVector(),
+ nDestination,
+ nSourceOptions, /* ?? */
+ EXCHG_IN_ACTION_DEFAULT, /* ?? */
+ nFormat, nEventAction, 0,
+ lcl_getTransferPointer ( xTransferable ) );
+
+ // if we find a suitable action, we can paste!
+ bIsPaste = (EXCHG_INOUT_ACTION_NONE != nAction);
+ }
+
+ return bIsPaste;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::Paste( SwWrtShell& rSh, TransferableDataHelper& rData )
+{
+ USHORT nEventAction, nAction=0,
+ nDestination = SwTransferable::GetSotDestination( rSh );
+ ULONG nFormat = 0;
+
+ if( GetSwTransferable( rData ) )
+ {
+ nAction = EXCHG_OUT_ACTION_INSERT_PRIVATE;
+ }
+ else
+ {
+ USHORT nSourceOptions =
+ (( EXCHG_DEST_DOC_TEXTFRAME == nDestination ||
+ EXCHG_DEST_SWDOC_FREE_AREA == nDestination ||
+ EXCHG_DEST_DOC_TEXTFRAME_WEB == nDestination ||
+ EXCHG_DEST_SWDOC_FREE_AREA_WEB == nDestination )
+ ? EXCHG_IN_ACTION_COPY
+ : EXCHG_IN_ACTION_MOVE);
+ uno::Reference<XTransferable> xTransferable( rData.GetXTransferable() );
+ nAction = SotExchange::GetExchangeAction(
+ rData.GetDataFlavorExVector(),
+ nDestination,
+ nSourceOptions, /* ?? */
+ EXCHG_IN_ACTION_DEFAULT, /* ?? */
+ nFormat, nEventAction, 0,
+ lcl_getTransferPointer ( xTransferable ) );
+ }
+
+ // special case for tables from draw application
+ if( EXCHG_OUT_ACTION_INSERT_DRAWOBJ == (nAction & EXCHG_ACTION_MASK) )
+ {
+ if( rData.HasFormat( SOT_FORMAT_RTF ) )
+ {
+ nAction = EXCHG_OUT_ACTION_INSERT_STRING | (nAction & !EXCHG_ACTION_MASK);
+ nFormat = SOT_FORMAT_RTF;
+ }
+ }
+
+ return EXCHG_INOUT_ACTION_NONE != nAction &&
+ SwTransferable::PasteData( rData, rSh, nAction, nFormat,
+ nDestination, FALSE, FALSE );
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::PasteData( TransferableDataHelper& rData,
+ SwWrtShell& rSh, USHORT nAction, ULONG nFormat,
+ USHORT nDestination, BOOL bIsPasteFmt,
+ sal_Bool bIsDefault,
+ const Point* pPt, sal_Int8 nDropAction,
+ BOOL bPasteSelection )
+{
+ SwWait aWait( *rSh.GetView().
+ GetDocShell(), FALSE );
+ SwTrnsfrActionAndUndo* pAction = 0;
+ SwModule* pMod = SW_MOD();
+
+ int nRet = 0;
+ bool bCallAutoCaption = false;
+
+ if( pPt )
+ {
+ // external Drop
+ if( bPasteSelection ? !pMod->pXSelection : !pMod->pDragDrop )
+ {
+ switch( nDestination )
+ {
+ case EXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP:
+ case EXCHG_DEST_DOC_LNKD_GRAPHOBJ:
+ case EXCHG_DEST_DOC_GRAPH_W_IMAP:
+ case EXCHG_DEST_DOC_GRAPHOBJ:
+ case EXCHG_DEST_DOC_OLEOBJ:
+ case EXCHG_DEST_DOC_DRAWOBJ:
+ case EXCHG_DEST_DOC_URLBUTTON:
+ case EXCHG_DEST_DOC_GROUPOBJ:
+ // Rahmen/Objecte selektieren
+ SwTransferable::SetSelInShell( rSh, TRUE, pPt );
+ break;
+
+ // case EXCHG_DEST_DOC_TEXTFRAME:
+ // case EXCHG_DEST_SWDOC_FREE_AREA:
+ // case EXCHG_DEST_DOC_URLFIELD:
+ default:
+ SwTransferable::SetSelInShell( rSh, FALSE, pPt );
+ break;
+ }
+ }
+ }
+ else if( ( !GetSwTransferable( rData ) || bIsPasteFmt ) &&
+ !rSh.IsTableMode() && rSh.HasSelection() )
+ {
+ // dann die Selektionen loeschen
+
+ //Selektierten Inhalt loeschen,
+ // - nicht bei Tabellen-Selektion
+ // - nicht bei ReRead einer Grafik/DDEDaten
+ // - nicht bei D&D, fuer die richtige Selektion wurde im
+ // Drop-Handler gesorgt
+ BOOL bDelSel = FALSE;
+ switch( nDestination )
+ {
+ case EXCHG_DEST_DOC_TEXTFRAME:
+ case EXCHG_DEST_SWDOC_FREE_AREA:
+ case EXCHG_DEST_DOC_TEXTFRAME_WEB:
+ case EXCHG_DEST_SWDOC_FREE_AREA_WEB:
+ bDelSel = TRUE;
+ break;
+ }
+
+ if( bDelSel )
+ // --> FME 2004-10-19 #i34830#
+ pAction = new SwTrnsfrActionAndUndo( &rSh, UNDO_PASTE_CLIPBOARD, NULL,
+ TRUE );
+ // <--
+ }
+
+ SwTransferable *pTrans=0, *pTunneledTrans=GetSwTransferable( rData );
+// uno::Reference<XUnoTunnel> xTunnel( rData.GetTransferable(), UNO_QUERY );
+// if ( xTunnel.is() )
+// {
+// sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() );
+// if ( nHandle )
+// pTunneledTrans = (SwTransferable*) (sal_IntPtr) nHandle;
+// }
+
+ if( pPt && ( bPasteSelection ? 0 != ( pTrans = pMod->pXSelection )
+ : 0 != ( pTrans = pMod->pDragDrop) ))
+ {
+ // then internal Drag & Drop or XSelection
+ nRet = pTrans->PrivateDrop( rSh, *pPt, DND_ACTION_MOVE == nDropAction,
+ bPasteSelection );
+ }
+ else if( !pPt && pTunneledTrans &&
+ EXCHG_OUT_ACTION_INSERT_PRIVATE == nAction )
+ {
+ // then internal paste
+ nRet = pTunneledTrans->PrivatePaste( rSh );
+ }
+ else if( EXCHG_INOUT_ACTION_NONE != nAction )
+ {
+ if( !pAction )
+ {
+ // #111827#
+ pAction = new SwTrnsfrActionAndUndo( &rSh, UNDO_PASTE_CLIPBOARD);
+ }
+
+ // im Drag&Drop duerfen keine MessageBoxen angezeigt werden
+ BOOL bMsg = 0 == pPt;
+ BYTE nActionFlags = static_cast< BYTE >(( nAction >> 8 ) & 0xFF);
+
+ USHORT nClearedAction = ( nAction & EXCHG_ACTION_MASK );
+ // Selektionen loeschen
+
+ switch( nClearedAction )
+ {
+ case EXCHG_OUT_ACTION_INSERT_PRIVATE:
+ASSERT( pPt, "EXCHG_OUT_ACTION_INSERT_PRIVATE: was soll hier passieren?" );
+ break;
+
+ case EXCHG_OUT_ACTION_MOVE_PRIVATE:
+ASSERT( pPt, "EXCHG_OUT_ACTION_MOVE_PRIVATE: was soll hier passieren?" );
+ break;
+
+
+ case EXCHG_IN_ACTION_MOVE:
+ case EXCHG_IN_ACTION_COPY:
+ case EXCHG_IN_ACTION_LINK:
+ case EXCHG_OUT_ACTION_INSERT_HTML:
+ case EXCHG_OUT_ACTION_INSERT_STRING:
+ case EXCHG_OUT_ACTION_INSERT_IMAGEMAP:
+ case EXCHG_OUT_ACTION_REPLACE_IMAGEMAP:
+
+ // dann muss ueber das Format gegangen werden
+ switch( nFormat )
+ {
+ case SOT_FORMATSTR_ID_DRAWING:
+ nRet = SwTransferable::_PasteSdrFormat( rData, rSh,
+ SW_PASTESDR_INSERT, pPt,
+ nActionFlags );
+ break;
+
+ case SOT_FORMATSTR_ID_HTML:
+ case SOT_FORMATSTR_ID_HTML_SIMPLE:
+ case SOT_FORMATSTR_ID_HTML_NO_COMMENT:
+ case SOT_FORMAT_RTF:
+ case SOT_FORMAT_STRING:
+ nRet = SwTransferable::_PasteFileContent( rData, rSh,
+ nFormat, bMsg );
+ break;
+
+ case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
+ {
+ INetBookmark aBkmk;
+ if( rData.GetINetBookmark( nFormat, aBkmk ) )
+ {
+ SwFmtINetFmt aFmt( aBkmk.GetURL(), aEmptyStr );
+ rSh.InsertURL( aFmt, aBkmk.GetDescription() );
+ nRet = 1;
+ }
+ }
+ break;
+
+ case SOT_FORMATSTR_ID_SD_OLE:
+ nRet = SwTransferable::_PasteOLE( rData, rSh, nFormat,
+ nActionFlags, bMsg );
+ break;
+
+ case SOT_FORMATSTR_ID_SVIM:
+ nRet = SwTransferable::_PasteImageMap( rData, rSh );
+ break;
+
+ case SOT_FORMATSTR_ID_SVXB:
+ case SOT_FORMAT_BITMAP:
+ case SOT_FORMAT_GDIMETAFILE:
+ nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat,
+ SW_PASTESDR_INSERT,pPt,
+ nActionFlags, bMsg );
+ break;
+
+ case SOT_FORMATSTR_ID_XFORMS:
+ case SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE:
+ case SOT_FORMATSTR_ID_SBA_DATAEXCHANGE:
+ case SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE:
+ nRet = SwTransferable::_PasteDBData( rData, rSh, nFormat,
+ EXCHG_IN_ACTION_LINK == nClearedAction,
+ pPt, bMsg );
+ break;
+
+ case SOT_FORMAT_FILE:
+ nRet = SwTransferable::_PasteFileName( rData, rSh, nFormat,
+ ( EXCHG_IN_ACTION_MOVE == nClearedAction
+ ? SW_PASTESDR_REPLACE
+ : EXCHG_IN_ACTION_LINK == nClearedAction
+ ? SW_PASTESDR_SETATTR
+ : SW_PASTESDR_INSERT),
+ pPt, nActionFlags, bMsg );
+ break;
+
+ case SOT_FORMAT_FILE_LIST:
+ // dann nur als Grafiken einfuegen
+ nRet = SwTransferable::_PasteFileList( rData, rSh,
+ EXCHG_IN_ACTION_LINK == nClearedAction,
+ pPt, bMsg );
+ break;
+
+ case SOT_FORMATSTR_ID_SONLK:
+ if( pPt )
+ {
+ NaviContentBookmark aBkmk;
+ if( aBkmk.Paste( rData ) )
+ {
+ if(bIsDefault)
+ {
+ switch(aBkmk.GetDefaultDragType())
+ {
+ case REGION_MODE_NONE: nClearedAction = EXCHG_IN_ACTION_COPY; break;
+ case REGION_MODE_EMBEDDED: nClearedAction = EXCHG_IN_ACTION_MOVE; break;
+ case REGION_MODE_LINK: nClearedAction = EXCHG_IN_ACTION_LINK; break;
+ }
+ }
+ rSh.NavigatorPaste( aBkmk, nClearedAction );
+ nRet = 1;
+ }
+ }
+ break;
+
+ case SOT_FORMATSTR_ID_INET_IMAGE:
+ case SOT_FORMATSTR_ID_NETSCAPE_IMAGE:
+ nRet = SwTransferable::_PasteTargetURL( rData, rSh,
+ SW_PASTESDR_INSERT,
+ pPt, TRUE );
+ break;
+
+ default:
+ ASSERT( pPt, "unbekanntes Format" );
+ }
+ break;
+
+ case EXCHG_OUT_ACTION_INSERT_FILE:
+ nRet = SwTransferable::_PasteFileName( rData, rSh, nFormat,
+ SW_PASTESDR_INSERT, pPt,
+ nActionFlags, bMsg );
+ if( nRet & SWTRANSFER_GRAPHIC_INSERTED )
+ bCallAutoCaption = true;
+ break;
+
+ case EXCHG_OUT_ACTION_INSERT_OLE:
+ nRet = SwTransferable::_PasteOLE( rData, rSh, nFormat,
+ nActionFlags,bMsg );
+ break;
+
+ case EXCHG_OUT_ACTION_INSERT_DDE:
+ {
+ BOOL bReRead = 0 != CNT_HasGrf( rSh.GetCntType() );
+ nRet = SwTransferable::_PasteDDE( rData, rSh, bReRead, bMsg );
+ }
+ break;
+
+ case EXCHG_OUT_ACTION_INSERT_HYPERLINK:
+ {
+ String sURL, sDesc;
+ if( SOT_FORMAT_FILE == nFormat )
+ {
+ if( rData.GetString( nFormat, sURL ) && sURL.Len() )
+ {
+ SwTransferable::_CheckForURLOrLNKFile( rData, sURL, &sDesc );
+ if( !sDesc.Len() )
+ sDesc = sURL;
+ nRet = 1;
+ }
+ }
+ else
+ {
+ INetBookmark aBkmk;
+ if( rData.GetINetBookmark( nFormat, aBkmk ) )
+ {
+ sURL = aBkmk.GetURL();
+ sDesc = aBkmk.GetDescription();
+ nRet = 1;
+ }
+ }
+
+ if( nRet )
+ {
+ SwFmtINetFmt aFmt( sURL, aEmptyStr );
+ rSh.InsertURL( aFmt, sDesc );
+ }
+ }
+ break;
+
+ case EXCHG_OUT_ACTION_GET_ATTRIBUTES:
+ switch( nFormat )
+ {
+ case SOT_FORMATSTR_ID_DRAWING:
+ nRet = SwTransferable::_PasteSdrFormat( rData, rSh,
+ SW_PASTESDR_SETATTR, pPt,
+ nActionFlags );
+ break;
+ case SOT_FORMATSTR_ID_SVXB:
+ case SOT_FORMAT_GDIMETAFILE:
+ case SOT_FORMAT_BITMAP:
+ case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
+ case SOT_FORMAT_FILE:
+ case SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR:
+ case SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR:
+ nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat,
+ SW_PASTESDR_SETATTR, pPt,
+ nActionFlags, bMsg );
+ break;
+ default:
+ ASSERT( FALSE, "unbekanntes Format" );
+ }
+
+ break;
+
+ case EXCHG_OUT_ACTION_INSERT_DRAWOBJ:
+ nRet = SwTransferable::_PasteSdrFormat( rData, rSh,
+ SW_PASTESDR_INSERT, pPt,
+ nActionFlags );
+ break;
+ case EXCHG_OUT_ACTION_INSERT_SVXB:
+ case EXCHG_OUT_ACTION_INSERT_GDIMETAFILE:
+ case EXCHG_OUT_ACTION_INSERT_BITMAP:
+ case EXCHG_OUT_ACTION_INSERT_GRAPH:
+ nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat,
+ SW_PASTESDR_INSERT, pPt,
+ nActionFlags, bMsg );
+ break;
+
+ case EXCHG_OUT_ACTION_REPLACE_DRAWOBJ:
+ nRet = SwTransferable::_PasteSdrFormat( rData, rSh,
+ SW_PASTESDR_REPLACE, pPt,
+ nActionFlags );
+ break;
+
+ case EXCHG_OUT_ACTION_REPLACE_SVXB:
+ case EXCHG_OUT_ACTION_REPLACE_GDIMETAFILE:
+ case EXCHG_OUT_ACTION_REPLACE_BITMAP:
+ case EXCHG_OUT_ACTION_REPLACE_GRAPH:
+ nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat,
+ SW_PASTESDR_REPLACE,pPt,
+ nActionFlags, bMsg );
+ break;
+
+ case EXCHG_OUT_ACTION_INSERT_INTERACTIVE:
+ nRet = SwTransferable::_PasteAsHyperlink( rData, rSh, nFormat );
+ break;
+
+ default:
+ ASSERT( FALSE, "unbekannte Action" );
+ }
+ }
+
+ if( !bPasteSelection && rSh.IsFrmSelected() )
+ {
+ rSh.EnterSelFrmMode();
+ //force ::SelectShell
+ rSh.GetView().StopShellTimer();
+ }
+
+ if( pAction )
+ delete pAction;
+ if( bCallAutoCaption )
+ rSh.GetView().AutoCaption( GRAPHIC_CAP );
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT SwTransferable::GetSotDestination( const SwWrtShell& rSh,
+ const Point* pPt )
+{
+ USHORT nRet = EXCHG_INOUT_ACTION_NONE;
+
+ ObjCntType eOType;
+ if( pPt )
+ {
+ SdrObject *pObj = 0;
+ eOType = rSh.GetObjCntType( *pPt, pObj );
+ }
+ else
+ eOType = rSh.GetObjCntTypeOfSelection();
+
+ switch( eOType )
+ {
+ case OBJCNT_GRF:
+ {
+ BOOL bIMap, bLink;
+ if( pPt )
+ {
+ bIMap = 0 != rSh.GetFmtFromObj( *pPt )->GetURL().GetMap();
+ String aDummy;
+ rSh.GetGrfAtPos( *pPt, aDummy, bLink );
+ }
+ else
+ {
+ bIMap = 0 != rSh.GetFlyFrmFmt()->GetURL().GetMap();
+ String aDummy;
+ rSh.GetGrfNms( &aDummy, 0 );
+ bLink = 0 != aDummy.Len();
+ }
+
+ if( bLink && bIMap )
+ nRet = EXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP;
+ else if( bLink )
+ nRet = EXCHG_DEST_DOC_LNKD_GRAPHOBJ;
+ else if( bIMap )
+ nRet = EXCHG_DEST_DOC_GRAPH_W_IMAP;
+ else
+ nRet = EXCHG_DEST_DOC_GRAPHOBJ;
+ }
+ break;
+
+ case OBJCNT_FLY:
+ if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) )
+ nRet = EXCHG_DEST_DOC_TEXTFRAME_WEB;
+ else
+ nRet = EXCHG_DEST_DOC_TEXTFRAME;
+ break;
+ case OBJCNT_OLE: nRet = EXCHG_DEST_DOC_OLEOBJ; break;
+
+ case OBJCNT_CONTROL: /* no Action avail */
+ case OBJCNT_SIMPLE: nRet = EXCHG_DEST_DOC_DRAWOBJ; break;
+ case OBJCNT_URLBUTTON: nRet = EXCHG_DEST_DOC_URLBUTTON; break;
+ case OBJCNT_GROUPOBJ: nRet = EXCHG_DEST_DOC_GROUPOBJ; break;
+
+// was mmchen wir bei Mehrfachselektion???
+// case OBJCNT_DONTCARE:
+ default:
+ {
+/*
+JP 13.07.98: Bug 52637: es wird ein URL-Feld erkannt also werden nur die
+ Inhalte zugelassen. Das ist aber bestimmt nicht das
+ gewollte.
+ SwContentAtPos aCntntAtPos( SwContentAtPos::SW_INETATTR );
+ SfxItemSet aSet( (SfxItemPool&)rSh.GetAttrPool(),
+ RES_TXTATR_INETFMT, RES_TXTATR_INETFMT );
+ if( pPt ? ((SwWrtShell&)rSh).GetContentAtPos( *pPt, aCntntAtPos, FALSE )
+ : (rSh.GetAttr( aSet ) && aSet.Count()) )
+ nRet = EXCHG_DEST_DOC_URLFIELD;
+ else
+*/
+ if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) )
+ nRet = EXCHG_DEST_SWDOC_FREE_AREA_WEB;
+ else
+ nRet = EXCHG_DEST_SWDOC_FREE_AREA;
+ }
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::_PasteFileContent( TransferableDataHelper& rData,
+ SwWrtShell& rSh, ULONG nFmt, BOOL bMsg )
+{
+ USHORT nResId = MSG_CLPBRD_FORMAT_ERROR;
+ int nRet = 0;
+
+ MSE40HTMLClipFormatObj aMSE40ClpObj;
+
+ SotStorageStreamRef xStrm;
+ SvStream* pStream = 0;
+ SwRead pRead = 0;
+ rtl::OUString sData;
+ switch( nFmt )
+ {
+ case SOT_FORMAT_STRING:
+ {
+ pRead = ReadAscii;
+ if( rData.GetString( nFmt, sData ) )
+ {
+ pStream = new SvMemoryStream( (void*)sData.getStr(),
+ sData.getLength() * sizeof( sal_Unicode ),
+ STREAM_READ );
+#ifdef OSL_BIGENDIAN
+ pStream->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN );
+#else
+ pStream->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
+#endif
+
+ SwAsciiOptions aAOpt;
+ aAOpt.SetCharSet( RTL_TEXTENCODING_UCS2 );
+ pRead->GetReaderOpt().SetASCIIOpts( aAOpt );
+ break;
+ }
+ }
+ // no break - because then test if we get a stream
+
+ default:
+ if( rData.GetSotStorageStream( nFmt, xStrm ) )
+ {
+ if( ( SOT_FORMATSTR_ID_HTML_SIMPLE == nFmt ) ||
+ ( SOT_FORMATSTR_ID_HTML_NO_COMMENT == nFmt ) )
+ {
+ pStream = aMSE40ClpObj.IsValid( *xStrm );
+ pRead = ReadHTML;
+ pRead->SetReadUTF8( TRUE );
+ //pRead->SetBaseURL( aMSE40ClpObj.GetBaseURL() );
+
+ BOOL bNoComments =
+ ( nFmt == SOT_FORMATSTR_ID_HTML_NO_COMMENT );
+ pRead->SetIgnoreHTMLComments( bNoComments );
+ }
+ else
+ {
+ pStream = &xStrm;
+ if( SOT_FORMAT_RTF == nFmt )
+ pRead = SwReaderWriter::GetReader( READER_WRITER_RTF );
+ else if( !pRead )
+ {
+ pRead = ReadHTML;
+ pRead->SetReadUTF8( TRUE );
+ }
+ }
+ }
+ break;
+ }
+
+ if( pStream && pRead )
+ {
+ Link aOldLink( rSh.GetChgLnk() );
+ rSh.SetChgLnk( Link() );
+
+ SwReader aReader( *pStream, aEmptyStr, String(), *rSh.GetCrsr() );
+ if( IsError( aReader.Read( *pRead )) )
+ nResId = ERR_CLPBRD_READ;
+ else
+ nResId = 0, nRet = 1;
+
+ rSh.SetChgLnk( aOldLink );
+ if( nRet )
+ rSh.CallChgLnk();
+ }
+ else
+ nResId = MSG_CLPBRD_FORMAT_ERROR;
+
+ // Exist a SvMemoryStream? (data in the OUString and xStrm is empty)
+ if( pStream && !xStrm.Is() )
+ delete pStream;
+
+ if( bMsg && nResId )
+ {
+ InfoBox( 0, SW_RES( nResId )).Execute();
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::_PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh,
+ ULONG nFmt, BYTE nActionFlags, BOOL bMsg )
+{
+ int nRet = 0;
+ TransferableObjectDescriptor aObjDesc;
+ uno::Reference < io::XInputStream > xStrm;
+ uno::Reference < embed::XStorage > xStore;
+ Reader* pRead = 0;
+
+ // Get the preferred format
+ SotFormatStringId nId;
+ if( rData.HasFormat( SOT_FORMATSTR_ID_EMBEDDED_OBJ ) )
+ nId = SOT_FORMATSTR_ID_EMBEDDED_OBJ;
+ else if( rData.HasFormat( SOT_FORMATSTR_ID_EMBED_SOURCE ) &&
+ rData.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ))
+ nId = SOT_FORMATSTR_ID_EMBED_SOURCE;
+ else
+ nId = 0;
+
+ if( nId && rData.GetInputStream( nId, xStrm ) && xStrm.is() )
+ {
+ // if there is an embedded object, first try if it's a writer object
+ // this will be inserted into the document by using a Reader
+ try
+ {
+ xStore = comphelper::OStorageHelper::GetStorageFromInputStream( xStrm );
+ switch( SotStorage::GetFormatID( xStore ) )
+ {
+ case SOT_FORMATSTR_ID_STARWRITER_60:
+ case SOT_FORMATSTR_ID_STARWRITERWEB_60:
+ case SOT_FORMATSTR_ID_STARWRITERGLOB_60:
+ case SOT_FORMATSTR_ID_STARWRITER_8:
+ case SOT_FORMATSTR_ID_STARWRITERWEB_8:
+ case SOT_FORMATSTR_ID_STARWRITERGLOB_8:
+ pRead = ReadXML;
+ break;
+ default:
+ try
+ {
+ uno::Reference < lang::XComponent > xComp( xStore, uno::UNO_QUERY );
+ xComp->dispose();
+ xStore = 0;
+ }
+ catch ( uno::Exception& )
+ {
+ }
+
+ break;
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ // it wasn't a storage, but maybe it's a useful stream
+ }
+
+ nFmt = nId;
+ }
+
+ if( pRead )
+ {
+ SwPaM &rPAM = *rSh.GetCrsr();
+ SwReader aReader( xStore, aEmptyStr, rPAM );
+ if( !IsError( aReader.Read( *pRead )) )
+ nRet = 1;
+ else if( bMsg )
+ InfoBox( 0, SW_RES(ERR_CLPBRD_READ) ).Execute();
+ }
+ else
+ {
+ // temporary storage until the object is inserted
+ uno::Reference< embed::XStorage > xTmpStor;
+ uno::Reference < embed::XEmbeddedObject > xObj;
+ ::rtl::OUString aName;
+ comphelper::EmbeddedObjectContainer aCnt;
+
+ if ( xStrm.is() )
+ {
+ if ( !rData.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) )
+ {
+ DBG_ASSERT( !xStrm.is(), "An object without descriptor in clipboard!");
+ }
+ }
+ else
+ {
+ if( rData.HasFormat( nFmt = SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE ) && rData.GetTransferableObjectDescriptor( nFmt, aObjDesc ) )
+ {
+ if ( !rData.GetInputStream( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE, xStrm ) )
+ rData.GetInputStream( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE, xStrm );
+
+ if ( !xStrm.is() )
+ {
+ // This is MSOLE object that should be created by direct using of system clipboard
+ try
+ {
+ xTmpStor = ::comphelper::OStorageHelper::GetTemporaryStorage();
+ uno::Reference < embed::XEmbedObjectClipboardCreator > xClipboardCreator(
+ ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.MSOLEObjectSystemCreator")) ),
+ uno::UNO_QUERY_THROW );
+
+ embed::InsertedObjectInfo aInfo = xClipboardCreator->createInstanceInitFromClipboard(
+ xTmpStor,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "DummyName" ) ),
+ uno::Sequence< beans::PropertyValue >() );
+
+ // TODO/LATER: in future InsertedObjectInfo will be used to get container related information
+ // for example whether the object should be an iconified one
+ xObj = aInfo.Object;
+ }
+ catch( uno::Exception& )
+ {}
+ }
+ }
+ }
+
+ if ( xStrm.is() && !xObj.is() )
+ xObj = aCnt.InsertEmbeddedObject( xStrm, aName );
+
+ if( xObj.is() )
+ {
+ svt::EmbeddedObjectRef xObjRef( xObj, aObjDesc.mnViewAspect );
+
+ // try to get the replacement image from the clipboard
+ Graphic aGraphic;
+ ULONG nGrFormat = 0;
+
+// (wg. Selection Manager bei Trustet Solaris)
+#ifndef SOLARIS
+/*
+ if( rData.GetGraphic( SOT_FORMATSTR_ID_SVXB, aGraphic ) )
+ nGrFormat = SOT_FORMATSTR_ID_SVXB;
+ else if( rData.GetGraphic( FORMAT_GDIMETAFILE, aGraphic ) )
+ nGrFormat = SOT_FORMAT_GDIMETAFILE;
+ else if( rData.GetGraphic( FORMAT_BITMAP, aGraphic ) )
+ nGrFormat = SOT_FORMAT_BITMAP;
+*/
+#endif
+
+ // insert replacement image ( if there is one ) into the object helper
+ if ( nGrFormat )
+ {
+ datatransfer::DataFlavor aDataFlavor;
+ SotExchange::GetFormatDataFlavor( nGrFormat, aDataFlavor );
+ xObjRef.SetGraphic( aGraphic, aDataFlavor.MimeType );
+ }
+ else if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON )
+ {
+ // it is important to have an icon, let an empty graphic be used
+ // if no other graphic is provided
+ // TODO/LATER: in future a default bitmap could be used
+ ::rtl::OUString aMimeType;
+ MapMode aMapMode( MAP_100TH_MM );
+ aGraphic.SetPrefSize( Size( 2500, 2500 ) );
+ aGraphic.SetPrefMapMode( aMapMode );
+ xObjRef.SetGraphic( aGraphic, aMimeType );
+ }
+
+ //Size einstellen. Ist ein Hack wg. Auslieferung, die Size sollte
+ //an das InsertOle uebergeben werden!!!!!!!!!!
+ Size aSize;
+ if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON )
+ {
+ if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
+ aSize = aObjDesc.maSize;
+ else
+ {
+ MapMode aMapMode( MAP_100TH_MM );
+ aSize = xObjRef.GetSize( &aMapMode );
+ }
+ }
+ else if( aObjDesc.maSize.Width() && aObjDesc.maSize.Height() )
+ {
+ aSize = Size( aObjDesc.maSize ); //immer 100TH_MM
+ MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( aObjDesc.mnViewAspect ) );
+ aSize = OutputDevice::LogicToLogic( aSize, MAP_100TH_MM, aUnit );
+ awt::Size aSz;
+ try
+ {
+ aSz = xObj->getVisualAreaSize( aObjDesc.mnViewAspect );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {
+ // in this case the provided size is used
+ }
+
+ if ( aSz.Width != aSize.Width() || aSz.Height != aSize.Height() )
+ {
+ aSz.Width = aSize.Width();
+ aSz.Height = aSize.Height();
+ xObj->setVisualAreaSize( aObjDesc.mnViewAspect, aSz );
+ }
+ }
+ else
+ {
+ // the descriptor contains the wrong object size
+ // the following call will let the MSOLE objects cache the size if it is possible
+ // it should be done while the object is running
+ try
+ {
+ xObj->getVisualAreaSize( aObjDesc.mnViewAspect );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ //Ende mit Hack!
+
+ rSh.InsertOleObject( xObjRef );
+ nRet = 1;
+
+ if( nRet && ( nActionFlags &
+ ( EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL >> 8) ))
+ SwTransferable::_PasteTargetURL( rData, rSh, 0, 0, FALSE );
+
+ // let the object be unloaded if possible
+ SwOLEObj::UnloadObject( xObj, rSh.GetDoc(), embed::Aspects::MSOLE_CONTENT );
+ }
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::_PasteTargetURL( TransferableDataHelper& rData,
+ SwWrtShell& rSh, USHORT nAction,
+ const Point* pPt, BOOL bInsertGRF )
+{
+ int nRet = 0;
+ INetImage aINetImg;
+ if( ( rData.HasFormat( SOT_FORMATSTR_ID_INET_IMAGE ) &&
+ rData.GetINetImage( SOT_FORMATSTR_ID_INET_IMAGE, aINetImg )) ||
+ ( rData.HasFormat( SOT_FORMATSTR_ID_NETSCAPE_IMAGE ) &&
+ rData.GetINetImage( SOT_FORMATSTR_ID_NETSCAPE_IMAGE, aINetImg )) )
+ {
+ if( aINetImg.GetImageURL().Len() && bInsertGRF )
+ {
+ String sURL( aINetImg.GetImageURL() );
+ SwTransferable::_CheckForURLOrLNKFile( rData, sURL );
+
+ //!!! auf FileSystem abpruefen - nur dann ist es sinnvoll die
+ // Grafiken zu testen !!!!
+ Graphic aGrf;
+ GraphicFilter *pFlt = GraphicFilter::GetGraphicFilter();
+ nRet = GRFILTER_OK == GraphicFilter::LoadGraphic( sURL, aEmptyStr, aGrf, pFlt );
+ if( nRet )
+ {
+ switch( nAction )
+ {
+ case SW_PASTESDR_INSERT:
+ SwTransferable::SetSelInShell( rSh, FALSE, pPt );
+ rSh.Insert( sURL, aEmptyStr, aGrf );
+ break;
+
+ case SW_PASTESDR_REPLACE:
+ if( rSh.IsObjSelected() )
+ {
+ rSh.ReplaceSdrObj( sURL, aEmptyStr, &aGrf );
+ Point aPt( pPt ? *pPt : rSh.GetCrsrDocPos() );
+ SwTransferable::SetSelInShell( rSh, TRUE, &aPt );
+ }
+ else
+ rSh.ReRead( sURL, aEmptyStr, &aGrf );
+ break;
+
+ case SW_PASTESDR_SETATTR:
+ if( rSh.IsObjSelected() )
+ rSh.Paste( aGrf );
+ else if( OBJCNT_GRF == rSh.GetObjCntTypeOfSelection() )
+ rSh.ReRead( sURL, aEmptyStr, &aGrf );
+ else
+ {
+ SwTransferable::SetSelInShell( rSh, FALSE, pPt );
+ rSh.Insert( sURL, aEmptyStr, aGrf );
+ }
+ break;
+ default:
+ nRet = 0;
+ }
+ }
+ }
+ else
+ nRet = 1;
+ }
+
+ if( nRet )
+ {
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
+ rSh.GetFlyFrmAttr( aSet );
+ SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
+
+ if( aURL.GetURL() != aINetImg.GetTargetURL() ||
+ aURL.GetTargetFrameName() != aINetImg.GetTargetFrame() )
+ {
+ aURL.SetURL( aINetImg.GetTargetURL(), FALSE );
+ aURL.SetTargetFrameName( aINetImg.GetTargetFrame() );
+ aSet.Put( aURL );
+ rSh.SetFlyFrmAttr( aSet );
+ }
+ }
+ return nRet;
+}
+
+
+// -----------------------------------------------------------------------
+
+void SwTransferable::SetSelInShell( SwWrtShell& rSh, BOOL bSelectFrm,
+ const Point* pPt )
+{
+ if( bSelectFrm )
+ {
+ // Rahmen/Objecte selektieren
+ if( pPt && !rSh.GetView().GetViewFrame()->GetDispatcher()->IsLocked() )
+ {
+ rSh.GetView().NoRotate();
+ if( rSh.SelectObj( *pPt ))
+ {
+ rSh.HideCrsr();
+ rSh.EnterSelFrmMode( pPt );
+ bFrmDrag = TRUE;
+ }
+ }
+ }
+ else
+ {
+ if( rSh.IsFrmSelected() || rSh.IsObjSelected() )
+ {
+ rSh.UnSelectFrm();
+ rSh.LeaveSelFrmMode();
+ rSh.GetView().GetEditWin().StopInsFrm();
+ bFrmDrag = FALSE;
+ }
+ else if( rSh.GetView().GetDrawFuncPtr() )
+ rSh.GetView().GetEditWin().StopInsFrm();
+
+ rSh.EnterStdMode();
+ if( pPt )
+ rSh.SwCrsrShell::SetCrsr( *pPt, TRUE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::_PasteDDE( TransferableDataHelper& rData,
+ SwWrtShell& rWrtShell, BOOL bReReadGrf,
+ BOOL bMsg )
+{
+ // Daten aus dem Clipboardformat
+ String aApp, aTopic, aItem;
+
+ {
+ SotStorageStreamRef xStrm;
+ if( !rData.GetSotStorageStream( SOT_FORMATSTR_ID_LINK, xStrm ))
+ {
+ ASSERT( !&rWrtShell, "DDE Data not found." );
+ return 0;
+ } //sinnvollen Fehler melden!!
+
+ rtl_TextEncoding eEncoding = DDE_TXT_ENCODING;
+ xStrm->ReadCString( aApp, eEncoding );
+ xStrm->ReadCString( aTopic, eEncoding );
+ xStrm->ReadCString( aItem, eEncoding );
+ }
+
+ String aCmd;
+ sfx2::MakeLnkName( aCmd, &aApp, aTopic, aItem );
+
+ // wollen wir jetzt eine Grafik einlesen ?
+ ULONG nFormat;
+ if( !rData.HasFormat( FORMAT_RTF ) &&
+ !rData.HasFormat( SOT_FORMATSTR_ID_HTML ) &&
+ !rData.HasFormat( FORMAT_STRING ) &&
+ (rData.HasFormat( nFormat = FORMAT_GDIMETAFILE ) ||
+ rData.HasFormat( nFormat = FORMAT_BITMAP )) )
+ {
+ Graphic aGrf;
+ int nRet = rData.GetGraphic( nFormat, aGrf );
+ if( nRet )
+ {
+ String sLnkTyp( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "DDE" )));
+ if ( bReReadGrf )
+ rWrtShell.ReRead( aCmd, sLnkTyp, &aGrf );
+ else
+ rWrtShell.Insert( aCmd, sLnkTyp, aGrf );
+ }
+ return nRet;
+ }
+
+ SwFieldType* pTyp = 0;
+ USHORT i = 1,j;
+ String aName;
+ BOOL bAlreadyThere = FALSE, bDoublePaste = FALSE;
+ USHORT nSize = rWrtShell.GetFldTypeCount();
+ const ::utl::TransliterationWrapper& rColl = ::GetAppCmpStrIgnore();
+
+ do {
+ aName = aApp;
+ aName += String::CreateFromInt32( i );
+ for( j = INIT_FLDTYPES; j < nSize; j++ )
+ {
+ pTyp = rWrtShell.GetFldType( j );
+ if( RES_DDEFLD == pTyp->Which() )
+ {
+ String sTmp( ((SwDDEFieldType*)pTyp)->GetCmd() );
+ if( rColl.isEqual( sTmp, aCmd ) &&
+ sfx2::LINKUPDATE_ALWAYS == ((SwDDEFieldType*)pTyp)->GetType() )
+ {
+ aName = pTyp->GetName();
+ bDoublePaste = TRUE;
+ break;
+ }
+ else if( rColl.isEqual( aName, pTyp->GetName() ) )
+ break;
+ }
+ }
+ if( j == nSize )
+ bAlreadyThere = FALSE;
+ else
+ {
+ bAlreadyThere = TRUE;
+ i++;
+ }
+ }
+ while( bAlreadyThere && !bDoublePaste );
+
+ if( !bDoublePaste )
+ {
+ SwDDEFieldType aType( aName, aCmd, sfx2::LINKUPDATE_ALWAYS );
+ pTyp = rWrtShell.InsertFldType( aType );
+ }
+
+
+ SwDDEFieldType* pDDETyp = (SwDDEFieldType*)pTyp;
+
+ String aExpand;
+ if( rData.GetString( FORMAT_STRING, aExpand ))
+ {
+ do { // middle checked loop
+
+ // Wenn die Daten von einer Tabellenkalkulation kommen
+ // fuegen wir eine DDE-Tabelle ein
+ if( ( rData.HasFormat( SOT_FORMATSTR_ID_SYLK ) ||
+ rData.HasFormat( SOT_FORMATSTR_ID_SYLK_BIGCAPS ) ) &&
+ aExpand.Len() &&
+ ( 1 < aExpand.GetTokenCount( '\n' ) ||
+ aExpand.GetTokenCount( '\t' )) )
+ {
+ String sTmp( aExpand );
+ xub_StrLen nRows = sTmp.GetTokenCount( '\n' );
+ if( nRows )
+ --nRows;
+ sTmp = sTmp.GetToken( 0, '\n' );
+ xub_StrLen nCols = sTmp.GetTokenCount( '\t' );
+
+ // mindestens eine Spalte & Zeile muss vorhanden sein
+ if( !nRows || !nCols )
+ {
+ if( bMsg )
+ InfoBox(0, SW_RESSTR(STR_NO_TABLE)).Execute();
+ pDDETyp = 0;
+ break;
+ }
+
+ rWrtShell.InsertDDETable(
+ SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 1 ), // TODO MULTIHEADER
+ pDDETyp, nRows, nCols );
+ }
+ else if( 1 < aExpand.GetTokenCount( '\n' ) )
+ {
+ // mehrere Absaetze -> eine geschuetzte Section einfuegen
+ if( rWrtShell.HasSelection() )
+ rWrtShell.DelRight();
+
+ SwSectionData aSect( DDE_LINK_SECTION, aName );
+ aSect.SetLinkFileName( aCmd );
+ aSect.SetProtectFlag(true);
+ rWrtShell.InsertSection( aSect );
+
+ pDDETyp = 0; // FeldTypen wieder entfernen
+ }
+ else
+ {
+ // Einfuegen
+ SwDDEField aSwDDEField( pDDETyp );
+ rWrtShell.Insert( aSwDDEField );
+ }
+
+ } while( FALSE );
+ }
+ else
+ pDDETyp = 0; // FeldTypen wieder entfernen
+
+ if( !pDDETyp && !bDoublePaste )
+ {
+ // FeldTyp wieder entfernen - Fehler aufgetreten!
+ for( j = nSize; j >= INIT_FLDTYPES; --j )
+ if( pTyp == rWrtShell.GetFldType( j ) )
+ {
+ rWrtShell.RemoveFldType( j );
+ break;
+ }
+ }
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::_PasteSdrFormat( TransferableDataHelper& rData,
+ SwWrtShell& rSh, USHORT nAction,
+ const Point* pPt, BYTE nActionFlags )
+{
+ int nRet = 0;
+ SotStorageStreamRef xStrm;
+ if( rData.GetSotStorageStream( SOT_FORMATSTR_ID_DRAWING, xStrm ))
+ {
+ xStrm->SetVersion( SOFFICE_FILEFORMAT_50 );
+ rSh.Paste( *xStrm, nAction, pPt );
+ nRet = 1;
+
+ if( nRet && ( nActionFlags &
+ ( EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL >> 8) ))
+ SwTransferable::_PasteTargetURL( rData, rSh, 0, 0, FALSE );
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
+ ULONG nFmt, USHORT nAction, const Point* pPt,
+ BYTE nActionFlags, BOOL /*bMsg*/ )
+{
+ int nRet = 0;
+
+ Graphic aGrf;
+ INetBookmark aBkmk;
+ BOOL bCheckForGrf = FALSE, bCheckForImageMap = FALSE;
+
+ switch( nFmt )
+ {
+ case SOT_FORMAT_BITMAP:
+ case SOT_FORMAT_GDIMETAFILE:
+ nRet = rData.GetGraphic( nFmt, aGrf );
+ break;
+
+ case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
+ case SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR:
+ case SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR:
+ if( 0 != ( nRet = rData.GetINetBookmark( nFmt, aBkmk ) ))
+ {
+/* if( SW_PASTESDR_SETATTR != nAction )
+ {
+ INetURLObject aURL( aBkmk.GetURL() );
+ bCheckForGrf = INET_PROT_FILE == aURL.GetProtocol();
+ nRet = 0 != bCheckForGrf;
+ }
+*/
+ if( SW_PASTESDR_SETATTR == nAction )
+ nFmt = SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK;
+ else
+ bCheckForGrf = TRUE;
+ }
+ break;
+
+ case SOT_FORMAT_FILE:
+ {
+ String sTxt;
+ if( 0 != ( nRet = rData.GetString( nFmt, sTxt ) ) )
+ {
+ String sDesc;
+ SwTransferable::_CheckForURLOrLNKFile( rData, sTxt, &sDesc );
+
+ aBkmk = INetBookmark(
+ URIHelper::SmartRel2Abs(INetURLObject(), sTxt, Link(), false ),
+ sDesc );
+ bCheckForGrf = TRUE;
+ bCheckForImageMap = SW_PASTESDR_REPLACE == nAction;
+ }
+ }
+ break;
+
+ default:
+ nRet = rData.GetGraphic( nFmt, aGrf );
+ break;
+ }
+
+ if( bCheckForGrf )
+ {
+ //!!! auf FileSystem abpruefen - nur dann ist es sinnvoll die
+ // Grafiken zu testen !!!!
+ GraphicFilter *pFlt = GraphicFilter::GetGraphicFilter();
+ nRet = GRFILTER_OK == GraphicFilter::LoadGraphic( aBkmk.GetURL(), aEmptyStr,
+ aGrf, pFlt );
+ if( !nRet && SW_PASTESDR_SETATTR == nAction &&
+ SOT_FORMAT_FILE == nFmt &&
+ // Bug 63031 - nur bei Rahmenselektion
+ rSh.IsFrmSelected() )
+ {
+ // dann als Hyperlink hinter die Grafik setzen
+ nFmt = SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK;
+ nRet = TRUE;
+ }
+ }
+
+ if( nRet )
+ {
+ String sURL;
+ if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) )
+ sURL = aBkmk.GetURL();
+
+ switch( nAction )
+ {
+ case SW_PASTESDR_INSERT:
+ SwTransferable::SetSelInShell( rSh, FALSE, pPt );
+ rSh.Insert( sURL, aEmptyStr, aGrf );
+ break;
+
+ case SW_PASTESDR_REPLACE:
+ if( rSh.IsObjSelected() )
+ {
+ rSh.ReplaceSdrObj( sURL, aEmptyStr, &aGrf );
+ Point aPt( pPt ? *pPt : rSh.GetCrsrDocPos() );
+ SwTransferable::SetSelInShell( rSh, TRUE, &aPt );
+ }
+ else
+ rSh.ReRead( sURL, aEmptyStr, &aGrf );
+ break;
+
+ case SW_PASTESDR_SETATTR:
+ if( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK == nFmt )
+ {
+ if( rSh.IsFrmSelected() )
+ {
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
+ rSh.GetFlyFrmAttr( aSet );
+ SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
+ aURL.SetURL( aBkmk.GetURL(), FALSE );
+ aSet.Put( aURL );
+ rSh.SetFlyFrmAttr( aSet );
+ }
+ }
+ else if( rSh.IsObjSelected() )
+ rSh.Paste( aGrf );
+ else if( OBJCNT_GRF == rSh.GetObjCntTypeOfSelection() )
+ rSh.ReRead( sURL, aEmptyStr, &aGrf );
+ else
+ {
+ SwTransferable::SetSelInShell( rSh, FALSE, pPt );
+ rSh.Insert( aBkmk.GetURL(), aEmptyStr, aGrf );
+ }
+ break;
+ default:
+ nRet = 0;
+ }
+ }
+
+ if( nRet )
+ {
+
+ if( nActionFlags &
+ (( EXCHG_OUT_ACTION_FLAG_INSERT_IMAGEMAP |
+ EXCHG_OUT_ACTION_FLAG_REPLACE_IMAGEMAP ) >> 8) )
+ SwTransferable::_PasteImageMap( rData, rSh );
+
+ if( nActionFlags &
+ ( EXCHG_OUT_ACTION_FLAG_INSERT_TARGETURL >> 8) )
+ SwTransferable::_PasteTargetURL( rData, rSh, 0, 0, FALSE );
+ }
+ else if( bCheckForImageMap )
+ {
+ // oder sollte das File ein ImageMap-File sein?
+ ImageMap aMap;
+ SfxMedium aMed( INetURLObject(aBkmk.GetURL()).GetFull(),
+ STREAM_STD_READ, FALSE );
+ SvStream* pStream = aMed.GetInStream();
+ if( pStream != NULL &&
+ !pStream->GetError() &&
+ // mba: no BaseURL for clipboard functionality
+ aMap.Read( *pStream, IMAP_FORMAT_DETECT, String() ) == IMAP_ERR_OK &&
+ aMap.GetIMapObjectCount() )
+ {
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
+ rSh.GetFlyFrmAttr( aSet );
+ SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
+ aURL.SetMap( &aMap );
+ aSet.Put( aURL );
+ rSh.SetFlyFrmAttr( aSet );
+ nRet = 1;
+ }
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::_PasteImageMap( TransferableDataHelper& rData,
+ SwWrtShell& rSh )
+{
+ int nRet = 0;
+ if( rData.HasFormat( SOT_FORMATSTR_ID_SVIM ))
+ {
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
+ rSh.GetFlyFrmAttr( aSet );
+ SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
+ const ImageMap* pOld = aURL.GetMap();
+
+ // setzen oder ersetzen ist hier die Frage
+ ImageMap aImageMap;
+ if( rData.GetImageMap( SOT_FORMATSTR_ID_SVIM, aImageMap ) &&
+ ( !pOld || aImageMap != *pOld ))
+ {
+ aURL.SetMap( &aImageMap );
+ aSet.Put( aURL );
+ rSh.SetFlyFrmAttr( aSet );
+ }
+ nRet = 1;
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::_PasteAsHyperlink( TransferableDataHelper& rData,
+ SwWrtShell& rSh, ULONG nFmt )
+{
+ int nRet = 0;
+ String sFile;
+ if( rData.GetString( nFmt, sFile ) && sFile.Len() )
+ {
+ String sDesc;
+ SwTransferable::_CheckForURLOrLNKFile( rData, sFile, &sDesc );
+
+ //#41801# ersteinmal die URL absolut machen
+ INetURLObject aURL;
+ aURL.SetSmartProtocol( INET_PROT_FILE );
+ aURL.SetSmartURL( sFile );
+ sFile = aURL.GetMainURL( INetURLObject::NO_DECODE );
+
+ switch( rSh.GetObjCntTypeOfSelection() )
+ {
+ case OBJCNT_FLY:
+ case OBJCNT_GRF:
+ case OBJCNT_OLE:
+ {
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
+ rSh.GetFlyFrmAttr( aSet );
+ SwFmtURL aURL2( (SwFmtURL&)aSet.Get( RES_URL ) );
+ aURL2.SetURL( sFile, FALSE );
+ if( !aURL2.GetName().Len() )
+ aURL2.SetName( sFile );
+ aSet.Put( aURL2 );
+ rSh.SetFlyFrmAttr( aSet );
+ }
+ break;
+
+ default:
+ {
+ rSh.InsertURL( SwFmtINetFmt( sFile, aEmptyStr ),
+ sDesc.Len() ? sDesc : sFile );
+ }
+ }
+ nRet = TRUE;
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::_PasteFileName( TransferableDataHelper& rData,
+ SwWrtShell& rSh, ULONG nFmt,
+ USHORT nAction, const Point* pPt,
+ BYTE nActionFlags, BOOL bMsg )
+{
+ int nRet = SwTransferable::_PasteGrf( rData, rSh, nFmt, nAction,
+ pPt, nActionFlags, bMsg );
+ if( nRet )
+ nRet |= SWTRANSFER_GRAPHIC_INSERTED;
+ if( !nRet )
+ {
+ String sFile, sDesc;
+ if( rData.GetString( nFmt, sFile ) && sFile.Len() )
+ {
+ INetURLObject aMediaURL;
+
+ aMediaURL.SetSmartURL( sFile );
+ const String aMediaURLStr( aMediaURL.GetMainURL( INetURLObject::NO_DECODE ) );
+
+ if( ::avmedia::MediaWindow::isMediaURL( aMediaURLStr ) )
+ {
+ const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, aMediaURLStr );
+ rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(
+ SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON,
+ &aMediaURLItem, 0L );
+ }
+ else
+ {
+ BOOL bIsURLFile = SwTransferable::_CheckForURLOrLNKFile( rData, sFile, &sDesc );
+
+ //Eigenes FileFormat? -->Einfuegen, nicht fuer StarWriter/Web
+ String sFileURL = URIHelper::SmartRel2Abs(INetURLObject(), sFile, Link(), false );
+ const SfxFilter* pFlt = SW_PASTESDR_SETATTR == nAction
+ ? 0 : SwIoSystem::GetFileFilter(
+ sFileURL, aEmptyStr );
+ if( pFlt && !rSh.GetView().GetDocShell()->ISA(SwWebDocShell)
+ /*
+ JP 02.07.98: warum nur fuer die Formate ??
+ && ( pFlt->GetUserData() == FILTER_SW5 ||
+ pFlt->GetUserData() == FILTER_SW4 ||
+ pFlt->GetUserData() == FILTER_SW3 ||
+ pFlt->GetUserData() == FILTER_SWG )
+ */
+ )
+ {
+ // und dann per PostUser Event den Bereich-Einfuegen-Dialog hochreissen
+ SwSectionData * pSect = new SwSectionData(
+ FILE_LINK_SECTION,
+ rSh.GetDoc()->GetUniqueSectionName() );
+ pSect->SetLinkFileName( sFileURL );
+ pSect->SetProtectFlag( true );
+
+ Application::PostUserEvent( STATIC_LINK( &rSh, SwWrtShell,
+ InsertRegionDialog ), pSect );
+ nRet = 1;
+ }
+ else if( SW_PASTESDR_SETATTR == nAction ||
+ ( bIsURLFile && SW_PASTESDR_INSERT == nAction ))
+ {
+ //Fremde Files koennen wir immerhin noch als Links
+ //Einfuegen.
+
+ //#41801# ersteinmal die URL absolut machen
+ INetURLObject aURL;
+ aURL.SetSmartProtocol( INET_PROT_FILE );
+ aURL.SetSmartURL( sFile );
+ sFile = aURL.GetMainURL( INetURLObject::NO_DECODE );
+
+ switch( rSh.GetObjCntTypeOfSelection() )
+ {
+ case OBJCNT_FLY:
+ case OBJCNT_GRF:
+ case OBJCNT_OLE:
+ {
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
+ rSh.GetFlyFrmAttr( aSet );
+ SwFmtURL aURL2( (SwFmtURL&)aSet.Get( RES_URL ) );
+ aURL2.SetURL( sFile, FALSE );
+ if( !aURL2.GetName().Len() )
+ aURL2.SetName( sFile );
+ aSet.Put( aURL2 );
+ rSh.SetFlyFrmAttr( aSet );
+ }
+ break;
+
+ default:
+ {
+ rSh.InsertURL( SwFmtINetFmt( sFile, aEmptyStr ),
+ sDesc.Len() ? sDesc : sFile );
+ }
+ }
+ nRet = TRUE;
+ }
+ }
+ }
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::_PasteDBData( TransferableDataHelper& rData,
+ SwWrtShell& rSh, ULONG nFmt, BOOL bLink,
+ const Point* pDragPt, BOOL bMsg )
+{
+ int nRet = 0;
+ String sTxt;
+ if( rData.GetString( nFmt, sTxt ) && sTxt.Len() )
+ {
+ USHORT nWh = SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE == nFmt
+ ? 0
+ : SOT_FORMATSTR_ID_SBA_DATAEXCHANGE == nFmt
+ ? (bLink
+ ? FN_QRY_MERGE_FIELD
+ : FN_QRY_INSERT)
+ : (bLink
+ ? 0
+ : FN_QRY_INSERT_FIELD );
+ DataFlavorExVector& rVector = rData.GetDataFlavorExVector();
+ sal_Bool bHaveColumnDescriptor = OColumnTransferable::canExtractColumnDescriptor(rVector, CTF_COLUMN_DESCRIPTOR | CTF_CONTROL_EXCHANGE);
+ if ( SOT_FORMATSTR_ID_XFORMS == nFmt )
+ {
+ SdrObject* pObj;
+ rSh.MakeDrawView();
+ FmFormView* pFmView = PTR_CAST( FmFormView, rSh.GetDrawView() );
+ if(pFmView) {
+ const OXFormsDescriptor &rDesc = OXFormsTransferable::extractDescriptor(rData);
+ if(0 != (pObj = pFmView->CreateXFormsControl(rDesc)))
+ {
+ rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt );
+ }
+ }
+ }
+ else if( nWh )
+ {
+ SfxUsrAnyItem* pConnectionItem = 0;
+ SfxUsrAnyItem* pCursorItem = 0;
+ SfxUsrAnyItem* pColumnItem = 0;
+ SfxUsrAnyItem* pSourceItem = 0;
+ SfxUsrAnyItem* pCommandItem = 0;
+ SfxUsrAnyItem* pCommandTypeItem = 0;
+ SfxUsrAnyItem* pColumnNameItem = 0;
+ SfxUsrAnyItem* pSelectionItem = 0;
+
+ BOOL bDataAvailable = TRUE;
+ ODataAccessDescriptor aDesc;
+ if(bHaveColumnDescriptor)
+ aDesc = OColumnTransferable::extractColumnDescriptor(rData);
+ else if(ODataAccessObjectTransferable::canExtractObjectDescriptor(rVector) )
+ aDesc = ODataAccessObjectTransferable::extractObjectDescriptor(rData);
+ else
+ bDataAvailable = FALSE;
+
+ if ( bDataAvailable )
+ {
+ pConnectionItem = new SfxUsrAnyItem(FN_DB_CONNECTION_ANY, aDesc[daConnection]);
+ pColumnItem = new SfxUsrAnyItem(FN_DB_COLUMN_ANY, aDesc[daColumnObject]);
+ pSourceItem = new SfxUsrAnyItem(FN_DB_DATA_SOURCE_ANY, makeAny(aDesc.getDataSource()));
+ pCommandItem = new SfxUsrAnyItem(FN_DB_DATA_COMMAND_ANY, aDesc[daCommand]);
+ pCommandTypeItem = new SfxUsrAnyItem(FN_DB_DATA_COMMAND_TYPE_ANY, aDesc[daCommandType]);
+ pColumnNameItem = new SfxUsrAnyItem(FN_DB_DATA_COLUMN_NAME_ANY, aDesc[daColumnName]);
+ pSelectionItem = new SfxUsrAnyItem(FN_DB_DATA_SELECTION_ANY, aDesc[daSelection]);
+ pCursorItem = new SfxUsrAnyItem(FN_DB_DATA_CURSOR_ANY, aDesc[daCursor]);
+ }
+
+ SwView& rView = rSh.GetView();
+ //force ::SelectShell
+ rView.StopShellTimer();
+
+ SfxStringItem aDataDesc( nWh, sTxt );
+ rView.GetViewFrame()->GetDispatcher()->Execute(
+ nWh, SFX_CALLMODE_ASYNCHRON, &aDataDesc,
+ pConnectionItem, pColumnItem,
+ pSourceItem, pCommandItem, pCommandTypeItem,
+ pColumnNameItem, pSelectionItem, pCursorItem,0L);
+ delete pConnectionItem;
+ delete pColumnItem;
+ delete pSourceItem;
+ delete pCommandItem;
+ delete pCommandTypeItem;
+ delete pColumnNameItem;
+ delete pCursorItem;
+ }
+ else
+ {
+ SdrObject* pObj;
+ rSh.MakeDrawView();
+ FmFormView* pFmView = PTR_CAST( FmFormView, rSh.GetDrawView() );
+ if (pFmView && bHaveColumnDescriptor)
+ {
+ if ( 0 != (pObj = pFmView->CreateFieldControl( OColumnTransferable::extractColumnDescriptor(rData) ) ) )
+ rSh.SwFEShell::InsertDrawObj( *pObj, *pDragPt );
+ }
+ }
+ nRet = 1;
+ }
+ else if( bMsg )
+ {
+ InfoBox( 0, SW_RES(MSG_CLPBRD_FORMAT_ERROR)).Execute();
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::_PasteFileList( TransferableDataHelper& rData,
+ SwWrtShell& rSh, BOOL bLink,
+ const Point* pPt, BOOL bMsg )
+{
+ int nRet = 0;
+ FileList aFileList;
+ if( rData.GetFileList( SOT_FORMAT_FILE_LIST, aFileList ) &&
+ aFileList.Count() )
+ {
+ USHORT nAct = bLink ? SW_PASTESDR_SETATTR : SW_PASTESDR_INSERT;
+ String sFlyNm;
+ // iterate over the filelist
+ for( ULONG n = 0, nEnd = aFileList.Count(); n < nEnd; ++n )
+ {
+ TransferDataContainer* pHlp = new TransferDataContainer;
+ pHlp->CopyString( FORMAT_FILE, aFileList.GetFile( n ));
+ TransferableDataHelper aData( pHlp );
+
+ if( SwTransferable::_PasteFileName( aData, rSh, SOT_FORMAT_FILE, nAct,
+ pPt, FALSE, bMsg ))
+ {
+ if( bLink )
+ {
+ sFlyNm = rSh.GetFlyName();
+ SwTransferable::SetSelInShell( rSh, FALSE, pPt );
+ }
+ nRet = 1;
+ }
+ }
+ if( sFlyNm.Len() )
+ rSh.GotoFly( sFlyNm );
+ }
+ else if( bMsg )
+ {
+ InfoBox( 0, SW_RES(MSG_CLPBRD_FORMAT_ERROR)).Execute();
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SwTransferable::_CheckForURLOrLNKFile( TransferableDataHelper& rData,
+ String& rFileName, String* pTitle )
+{
+ BOOL bIsURLFile = FALSE;
+ INetBookmark aBkmk;
+ if( rData.GetINetBookmark( SOT_FORMATSTR_ID_SOLK, aBkmk ) )
+ {
+ rFileName = aBkmk.GetURL();
+ if( pTitle )
+ *pTitle = aBkmk.GetDescription();
+ bIsURLFile = TRUE;
+ }
+ else
+ {
+ xub_StrLen nLen = rFileName.Len();
+ if( 4 < nLen && '.' == rFileName.GetChar( nLen - 4 ))
+ {
+ String sExt( rFileName.Copy( nLen - 3 ));
+ if( sExt.EqualsIgnoreCaseAscii( "url" ))
+ {
+ASSERT( !&rFileName, "how do we read today .URL - Files?" );
+ }
+ }
+ }
+ return bIsURLFile;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SwTransferable::IsPasteSpecial( const SwWrtShell& rWrtShell,
+ const TransferableDataHelper& rData )
+{
+ // we can paste-special if there's an entry in the paste-special-format list
+ SvxClipboardFmtItem aClipboardFmtItem(0);
+ FillClipFmtItem( rWrtShell, rData, aClipboardFmtItem);
+ return aClipboardFmtItem.Count() > 0;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::PasteFormat( SwWrtShell& rSh,
+ TransferableDataHelper& rData,
+ ULONG nFormat )
+{
+ SwWait aWait( *rSh.GetView().GetDocShell(), FALSE );
+ int nRet = 0;
+
+ ULONG nPrivateFmt = FORMAT_PRIVATE;
+ SwTransferable *pClipboard = GetSwTransferable( rData );
+ if( pClipboard &&
+ ((TRNSFR_DOCUMENT|TRNSFR_GRAPHIC|TRNSFR_OLE) & pClipboard->eBufferType ))
+ nPrivateFmt = SOT_FORMATSTR_ID_EMBED_SOURCE;
+
+ if( pClipboard && nPrivateFmt == nFormat )
+ nRet = pClipboard->PrivatePaste( rSh );
+ else if( rData.HasFormat( nFormat ) )
+ {
+ uno::Reference<XTransferable> xTransferable( rData.GetXTransferable() );
+ USHORT nEventAction,
+ nDestination = SwTransferable::GetSotDestination( rSh ),
+ nSourceOptions =
+ (( EXCHG_DEST_DOC_TEXTFRAME == nDestination ||
+ EXCHG_DEST_SWDOC_FREE_AREA == nDestination ||
+ EXCHG_DEST_DOC_TEXTFRAME_WEB == nDestination ||
+ EXCHG_DEST_SWDOC_FREE_AREA_WEB == nDestination )
+ ? EXCHG_IN_ACTION_COPY
+ : EXCHG_IN_ACTION_MOVE),
+ nAction = SotExchange::GetExchangeAction(
+ rData.GetDataFlavorExVector(),
+ nDestination,
+ nSourceOptions, /* ?? */
+ EXCHG_IN_ACTION_DEFAULT, /* ?? */
+ nFormat, nEventAction, nFormat,
+ lcl_getTransferPointer ( xTransferable ) );
+
+ if( EXCHG_INOUT_ACTION_NONE != nAction )
+ nRet = SwTransferable::PasteData( rData, rSh, nAction, nFormat,
+ nDestination, TRUE, FALSE );
+ }
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::_TestAllowedFormat( const TransferableDataHelper& rData,
+ ULONG nFormat, USHORT nDestination )
+{
+ USHORT nAction = EXCHG_INOUT_ACTION_NONE, nEventAction;
+ if( rData.HasFormat( nFormat )) {
+ uno::Reference<XTransferable> xTransferable( rData.GetXTransferable() );
+ nAction = SotExchange::GetExchangeAction(
+ rData.GetDataFlavorExVector(),
+ nDestination, EXCHG_IN_ACTION_COPY,
+ EXCHG_IN_ACTION_COPY, nFormat,
+ nEventAction, nFormat,
+ lcl_getTransferPointer ( xTransferable ) );
+ }
+ return EXCHG_INOUT_ACTION_NONE != nAction;
+}
+
+// -----------------------------------------------------------------------
+
+/**
+ * the list of formats which will be offered to the user in the 'Paste
+ * Special...' dialog and the paste button menu
+ */
+static USHORT aPasteSpecialIds[] =
+{
+ SOT_FORMATSTR_ID_HTML,
+ SOT_FORMATSTR_ID_HTML_SIMPLE,
+ SOT_FORMATSTR_ID_HTML_NO_COMMENT,
+ FORMAT_RTF,
+ FORMAT_STRING,
+ SOT_FORMATSTR_ID_SONLK,
+ SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK,
+ SOT_FORMATSTR_ID_DRAWING,
+ SOT_FORMATSTR_ID_SVXB,
+ FORMAT_GDIMETAFILE,
+ FORMAT_BITMAP,
+ SOT_FORMATSTR_ID_SVIM,
+ SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR,
+ 0
+};
+
+
+int SwTransferable::PasteUnformatted( SwWrtShell& rSh, TransferableDataHelper& rData )
+{
+ // Plain text == unformatted
+ return SwTransferable::PasteFormat( rSh, rData, SOT_FORMAT_STRING );
+}
+
+// -----------------------------------------------------------------------
+
+int SwTransferable::PasteSpecial( SwWrtShell& rSh, TransferableDataHelper& rData, ULONG& rFormatUsed )
+{
+ int nRet = 0;
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( &rSh.GetView().GetEditWin() );
+
+ DataFlavorExVector aFormats( rData.GetDataFlavorExVector() );
+ TransferableObjectDescriptor aDesc;
+
+ USHORT nDest = SwTransferable::GetSotDestination( rSh );
+
+ SwTransferable *pClipboard = GetSwTransferable( rData );
+ if( pClipboard )
+ {
+ aDesc = pClipboard->aObjDesc;
+ USHORT nResId;
+ if( pClipboard->eBufferType & TRNSFR_DOCUMENT )
+ nResId = STR_PRIVATETEXT;
+ else if( pClipboard->eBufferType & TRNSFR_GRAPHIC )
+ nResId = STR_PRIVATEGRAPHIC;
+ else if( pClipboard->eBufferType == TRNSFR_OLE )
+ nResId = STR_PRIVATEOLE;
+ else
+ nResId = 0;
+
+ if( nResId )
+ {
+ if( STR_PRIVATEOLE == nResId || STR_PRIVATEGRAPHIC == nResId )
+ {
+ // add SOT_FORMATSTR_ID_EMBED_SOURCE to the formats. This
+ // format display then the private format name.
+ DataFlavorEx aFlavorEx;
+ aFlavorEx.mnSotId = SOT_FORMATSTR_ID_EMBED_SOURCE;
+ aFormats.insert( aFormats.begin(), aFlavorEx );
+ }
+ pDlg->SetObjName( pClipboard->aObjDesc.maClassName,
+ SW_RES( nResId ) );
+ pDlg->Insert( SOT_FORMATSTR_ID_EMBED_SOURCE, aEmptyStr );
+ }
+ }
+ else
+ {
+ if( rData.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) )
+ rData.GetTransferableObjectDescriptor(
+ SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDesc );
+
+ if( SwTransferable::_TestAllowedFormat( rData, SOT_FORMATSTR_ID_EMBED_SOURCE, nDest ))
+ pDlg->Insert( SOT_FORMATSTR_ID_EMBED_SOURCE, aEmptyStr );
+ if( SwTransferable::_TestAllowedFormat( rData, SOT_FORMATSTR_ID_LINK_SOURCE, nDest ))
+ pDlg->Insert( SOT_FORMATSTR_ID_LINK_SOURCE, aEmptyStr );
+ }
+
+ if( SwTransferable::_TestAllowedFormat( rData, SOT_FORMATSTR_ID_LINK, nDest ))
+ pDlg->Insert( SOT_FORMATSTR_ID_LINK, SW_RES(STR_DDEFORMAT) );
+
+ for( USHORT* pIds = aPasteSpecialIds; *pIds; ++pIds )
+ if( SwTransferable::_TestAllowedFormat( rData, *pIds, nDest ))
+ pDlg->Insert( *pIds, aEmptyStr );
+
+ ULONG nFormat = pDlg->GetFormat( rData.GetTransferable() );
+
+ if( nFormat )
+ nRet = SwTransferable::PasteFormat( rSh, rData, nFormat );
+
+ if ( nRet )
+ rFormatUsed = nFormat;
+
+ delete pDlg;
+ return nRet;
+}
+
+
+void SwTransferable::FillClipFmtItem( const SwWrtShell& rSh,
+ const TransferableDataHelper& rData,
+ SvxClipboardFmtItem & rToFill )
+{
+ USHORT nDest = SwTransferable::GetSotDestination( rSh );
+
+ SwTransferable *pClipboard = GetSwTransferable( rData );
+ if( pClipboard )
+ {
+ USHORT nResId;
+ if( pClipboard->eBufferType & TRNSFR_DOCUMENT )
+ nResId = STR_PRIVATETEXT;
+ else if( pClipboard->eBufferType & TRNSFR_GRAPHIC )
+ nResId = STR_PRIVATEGRAPHIC;
+ else if( pClipboard->eBufferType == TRNSFR_OLE )
+ nResId = STR_PRIVATEOLE;
+ else
+ nResId = 0;
+
+ if( nResId )
+ rToFill.AddClipbrdFormat( SOT_FORMATSTR_ID_EMBED_SOURCE,
+ SW_RES( nResId ) );
+ }
+ else
+ {
+ TransferableObjectDescriptor aDesc;
+ if( rData.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) )
+ ((TransferableDataHelper&)rData).GetTransferableObjectDescriptor(
+ SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDesc );
+
+ if( SwTransferable::_TestAllowedFormat( rData, SOT_FORMATSTR_ID_EMBED_SOURCE, nDest ))
+ rToFill.AddClipbrdFormat( SOT_FORMATSTR_ID_EMBED_SOURCE,
+ aDesc.maTypeName );
+ if( SwTransferable::_TestAllowedFormat( rData, SOT_FORMATSTR_ID_LINK_SOURCE, nDest ))
+ rToFill.AddClipbrdFormat( SOT_FORMATSTR_ID_LINK_SOURCE );
+
+ SotFormatStringId nFormat;
+ if ( rData.HasFormat(nFormat = SOT_FORMATSTR_ID_EMBED_SOURCE_OLE) || rData.HasFormat(nFormat = SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE) )
+ {
+ String sName,sSource;
+ if ( SvPasteObjectHelper::GetEmbeddedName(rData,sName,sSource,nFormat) )
+ rToFill.AddClipbrdFormat( nFormat, sName );
+ }
+ }
+
+ if( SwTransferable::_TestAllowedFormat( rData, SOT_FORMATSTR_ID_LINK, nDest ))
+ rToFill.AddClipbrdFormat( SOT_FORMATSTR_ID_LINK, SW_RES(STR_DDEFORMAT) );
+
+ for( USHORT* pIds = aPasteSpecialIds; *pIds; ++pIds )
+ if( SwTransferable::_TestAllowedFormat( rData, *pIds, nDest ))
+ rToFill.AddClipbrdFormat( *pIds, aEmptyStr );
+}
+
+void SwTransferable::SetDataForDragAndDrop( const Point& rSttPos )
+{
+ if(!pWrtShell)
+ return;
+ String sGrfNm;
+ const int nSelection = pWrtShell->GetSelectionType();
+ if( nsSelectionType::SEL_GRF == nSelection)
+ {
+ AddFormat( SOT_FORMATSTR_ID_SVXB );
+ // --> OD 2005-02-09 #119353# - robust
+ const Graphic* pGrf = pWrtShell->GetGraphic();
+ if ( pGrf && pGrf->IsSupportedGraphic() )
+ // <--
+ {
+ AddFormat( FORMAT_GDIMETAFILE );
+ AddFormat( FORMAT_BITMAP );
+ }
+ eBufferType = TRNSFR_GRAPHIC;
+ pWrtShell->GetGrfNms( &sGrfNm, 0 );
+ }
+ else if( nsSelectionType::SEL_OLE == nSelection )
+ {
+ AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
+ PrepareOLE( aObjDesc );
+ AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
+ AddFormat( FORMAT_GDIMETAFILE );
+ eBufferType = TRNSFR_OLE;
+ }
+ //Gibt es ueberhaupt etwas zum bereitstellen?
+ else if ( pWrtShell->IsSelection() || pWrtShell->IsFrmSelected() ||
+ pWrtShell->IsObjSelected() )
+ {
+ if( pWrtShell->IsObjSelected() )
+ eBufferType = TRNSFR_DRAWING;
+ else
+ {
+ eBufferType = TRNSFR_DOCUMENT;
+ if( SwWrtShell::NO_WORD !=
+ pWrtShell->IntelligentCut( nSelection, FALSE ))
+ eBufferType = TransferBufferType( TRNSFR_DOCUMENT_WORD
+ | eBufferType);
+ }
+
+ if( nSelection & nsSelectionType::SEL_TBL_CELLS )
+ eBufferType = (TransferBufferType)(TRNSFR_TABELLE | eBufferType);
+
+ AddFormat( SOT_FORMATSTR_ID_EMBED_SOURCE );
+
+ //RTF vor das Metafile von OLE stellen, weil mit weniger verlusten
+ //behaftet.
+ if( !pWrtShell->IsObjSelected() )
+ {
+ AddFormat( FORMAT_RTF );
+ AddFormat( SOT_FORMATSTR_ID_HTML );
+ }
+ if( pWrtShell->IsSelection() )
+ AddFormat( FORMAT_STRING );
+
+ if( nSelection & ( nsSelectionType::SEL_DRW | nsSelectionType::SEL_DRW_FORM ))
+ {
+ AddFormat( SOT_FORMATSTR_ID_DRAWING );
+ if ( nSelection & nsSelectionType::SEL_DRW )
+ {
+ AddFormat( FORMAT_GDIMETAFILE );
+ AddFormat( FORMAT_BITMAP );
+ }
+ eBufferType = (TransferBufferType)( TRNSFR_GRAPHIC | eBufferType );
+
+ pClpGraphic = new Graphic;
+ if( !pWrtShell->GetDrawObjGraphic( FORMAT_GDIMETAFILE, *pClpGraphic ))
+ pOrigGrf = pClpGraphic;
+ pClpBitmap = new Graphic;
+ if( !pWrtShell->GetDrawObjGraphic( FORMAT_BITMAP, *pClpBitmap ))
+ pOrigGrf = pClpBitmap;
+
+ // ist es ein URL-Button ?
+ String sURL, sDesc;
+ if( pWrtShell->GetURLFromButton( sURL, sDesc ) )
+ {
+ AddFormat( FORMAT_STRING );
+ AddFormat( SOT_FORMATSTR_ID_SOLK );
+ AddFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK );
+ AddFormat( SOT_FORMATSTR_ID_FILECONTENT );
+ AddFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR );
+ AddFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR );
+ eBufferType = (TransferBufferType)( TRNSFR_INETFLD | eBufferType );
+ }
+ }
+
+ //ObjectDescriptor wurde bereits aus der alten DocShell gefuellt.
+ //Jetzt noch anpassen. Dadurch kann im GetData die erste Anfrage
+ //auch noch mit delayed rendering beantwortet werden.
+ aObjDesc.mbCanLink = FALSE;
+ aObjDesc.maDragStartPos = rSttPos;
+ aObjDesc.maSize = OutputDevice::LogicToLogic( Size( OLESIZE ),
+ MAP_TWIP, MAP_100TH_MM );
+ PrepareOLE( aObjDesc );
+ AddFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR );
+ }
+ else if( nSelection & nsSelectionType::SEL_TXT && !pWrtShell->HasMark() )
+ {
+ // ist nur ein Feld - Selektiert?
+ SwContentAtPos aCntntAtPos( SwContentAtPos::SW_INETATTR );
+ Point aPos( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY());
+
+ if( pWrtShell->GetContentAtPos( aPos, aCntntAtPos ) )
+ {
+ AddFormat( FORMAT_STRING );
+ AddFormat( SOT_FORMATSTR_ID_SOLK );
+ AddFormat( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK );
+ AddFormat( SOT_FORMATSTR_ID_FILECONTENT );
+ AddFormat( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR );
+ AddFormat( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR );
+ eBufferType = TRNSFR_INETFLD;
+ }
+ }
+
+ if( pWrtShell->IsFrmSelected() )
+ {
+ SfxItemSet aSet( pWrtShell->GetAttrPool(), RES_URL, RES_URL );
+ pWrtShell->GetFlyFrmAttr( aSet );
+ const SwFmtURL& rURL = (SwFmtURL&)aSet.Get( RES_URL );
+ if( rURL.GetMap() )
+ {
+ pImageMap = new ImageMap( *rURL.GetMap() );
+ AddFormat( SOT_FORMATSTR_ID_SVIM );
+ }
+ else if( rURL.GetURL().Len() )
+ {
+ pTargetURL = new INetImage( sGrfNm, rURL.GetURL(),
+ rURL.GetTargetFrameName(),
+ aEmptyStr, Size() );
+ AddFormat( SOT_FORMATSTR_ID_INET_IMAGE );
+ }
+ }
+}
+
+void SwTransferable::StartDrag( Window* pWin, const Point& rPos )
+{
+ if(!pWrtShell)
+ return;
+ bOldIdle = pWrtShell->GetViewOptions()->IsIdle();
+ bCleanUp = TRUE;
+
+ ((SwViewOption *)pWrtShell->GetViewOptions())->SetIdle( FALSE );
+
+ if( pWrtShell->IsSelFrmMode() )
+ pWrtShell->ShowCrsr();
+
+ SW_MOD()->pDragDrop = this;
+
+ SetDataForDragAndDrop( rPos );
+
+ sal_Int8 nDragOptions = DND_ACTION_COPYMOVE | DND_ACTION_LINK;
+ SwDocShell* pDShell = pWrtShell->GetView().GetDocShell();
+ if( ( pDShell && pDShell->IsReadOnly() ) || pWrtShell->HasReadonlySel() )
+ nDragOptions &= ~DND_ACTION_MOVE;
+
+ TransferableHelper::StartDrag( pWin, nDragOptions );
+}
+
+void SwTransferable::DragFinished( sal_Int8 nAction )
+{
+ //Und noch die letzten Nacharbeiten damit alle Stati stimmen.
+ if( DND_ACTION_MOVE == nAction )
+ {
+ if( bCleanUp )
+ {
+ //Es wurde auserhalb des Writers gedroped. Wir muessen noch
+ //loeschen.
+
+ pWrtShell->StartAllAction();
+ pWrtShell->StartUndo( UNDO_UI_DRAG_AND_MOVE );
+ if ( pWrtShell->IsTableMode() )
+ pWrtShell->DeleteTblSel();
+ else
+ {
+ if ( !(pWrtShell->IsSelFrmMode() || pWrtShell->IsObjSelected()) )
+ //SmartCut, eines der Blanks mitnehmen.
+ pWrtShell->IntelligentCut( pWrtShell->GetSelectionType(), TRUE );
+ pWrtShell->DelRight();
+ }
+ pWrtShell->EndUndo( UNDO_UI_DRAG_AND_MOVE );
+ pWrtShell->EndAllAction();
+ }
+ else
+ {
+ const int nSelection = pWrtShell->GetSelectionType();
+ if( ( nsSelectionType::SEL_FRM | nsSelectionType::SEL_GRF |
+ nsSelectionType::SEL_OLE | nsSelectionType::SEL_DRW ) & nSelection )
+ {
+ pWrtShell->EnterSelFrmMode();
+ }
+ }
+ }
+ pWrtShell->GetView().GetEditWin().DragFinished();
+
+ if( pWrtShell->IsSelFrmMode() )
+ pWrtShell->HideCrsr();
+ else
+ pWrtShell->ShowCrsr();
+//!! else if( DND_ACTION_NONE != nAction )
+//!! pWrtShell->ShowCrsr();
+//!! else
+//!! {
+//!! //Muss wohl sein weil gescrollt wurde und ?...?
+//!! pWrtShell->StartAction();
+//!! pWrtShell->EndAction();
+//!! }
+
+ ((SwViewOption *)pWrtShell->GetViewOptions())->SetIdle( bOldIdle );
+}
+
+
+/* */
+
+int SwTransferable::PrivatePaste( SwWrtShell& rShell )
+{
+ // erst den SelectionType erfragen, dann Action-Klammerung !!!!
+ // (sonst wird nicht in eine TabellenSelektion gepastet!!!)
+ ASSERT( !rShell.ActionPend(), "Paste darf nie eine Actionklammerung haben" );
+ if ( !pClpDocFac )
+ return sal_False; // the return value of the SwFEShell::Paste also is BOOL!
+
+ const int nSelection = rShell.GetSelectionType();
+
+ // #111827#
+ SwRewriter aRewriter;
+
+ SwTrnsfrActionAndUndo aAction( &rShell, UNDO_PASTE_CLIPBOARD);
+
+ bool bKillPaMs = false;
+
+ //Selektierten Inhalt loeschen, nicht bei Tabellen-Selektion und
+ //Tabelle im Clipboard
+ if( rShell.HasSelection() && !( nSelection & nsSelectionType::SEL_TBL_CELLS))
+ {
+ bKillPaMs = true;
+ rShell.SetRetainSelection( true );
+ rShell.DelRight();
+ // war ein Fly selektiert, so muss jetzt fuer eine gueltige
+ // Cursor-Position gesorgt werden! (geparkter Cursor!)
+ if( ( nsSelectionType::SEL_FRM | nsSelectionType::SEL_GRF |
+ nsSelectionType::SEL_OLE | nsSelectionType::SEL_DRW |
+ nsSelectionType::SEL_DRW_FORM ) & nSelection )
+ {
+ // den Cursor wieder positionieren
+ Point aPt( rShell.GetCharRect().Pos() );
+ rShell.SwCrsrShell::SetCrsr( aPt, TRUE );
+ }
+ rShell.SetRetainSelection( false );
+ }
+
+ BOOL bInWrd = FALSE, bEndWrd = FALSE, bSttWrd = FALSE,
+ bSmart = 0 != (TRNSFR_DOCUMENT_WORD & eBufferType);
+ if( bSmart )
+ {
+// #108491# Why not for other Scripts? If TRNSFR_DOCUMENT_WORD is set, we have
+// a word in the buffer, word in this context means 'something with spaces at
+// beginning and end'. In this case we definitely want these spaces to be inserted
+// here.
+// if( SCRIPTTYPE_LATIN != rShell.GetScriptType() )
+// bSmart = FALSE;
+// else
+// {
+ bInWrd = rShell.IsInWrd();
+ bEndWrd = rShell.IsEndWrd();
+ bSmart = bInWrd || bEndWrd;
+ if( bSmart )
+ {
+ bSttWrd = rShell.IsSttWrd();
+ if( bSmart && !bSttWrd && (bInWrd || bEndWrd) )
+ rShell.SwEditShell::Insert(' ');
+ }
+// }
+ }
+
+ int nRet = rShell.Paste( pClpDocFac->GetDoc() );
+
+ if( bKillPaMs )
+ rShell.KillPams();
+
+ // Wenn Smart Paste dann Leerzeichen einfuegen
+ if( nRet && bSmart && ((bInWrd && !bEndWrd )|| bSttWrd) )
+ rShell.SwEditShell::Insert(' ');
+
+ return nRet;
+}
+
+int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt,
+ BOOL bMove, BOOL bIsXSelection )
+{
+ int cWord = 0;
+ BOOL bInWrd = FALSE;
+ BOOL bEndWrd = FALSE;
+ BOOL bSttWrd = FALSE;
+ BOOL bSttPara= FALSE;
+ BOOL bTblSel = FALSE;
+ BOOL bFrmSel = FALSE;
+
+ SwWrtShell& rSrcSh = *GetShell();
+
+ rSh.UnSetVisCrsr();
+
+ if( TRNSFR_INETFLD == eBufferType )
+ {
+ if( rSh.GetFmtFromObj( rDragPt ) )
+ {
+ INetBookmark aTmp;
+ if( (TRNSFR_INETFLD & eBufferType) && pBkmk )
+ aTmp = *pBkmk;
+
+ // Zielgrafik selektieren
+ if( rSh.SelectObj( rDragPt ) )
+ {
+ rSh.HideCrsr();
+ rSh.EnterSelFrmMode( &rDragPt );
+ bFrmDrag = TRUE;
+ }
+
+ const int nSelection = rSh.GetSelectionType();
+
+ // Draw-Objekte erstmal noch nicht beruecksichtigen
+ if( nsSelectionType::SEL_GRF & nSelection )
+ {
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
+ rSh.GetFlyFrmAttr( aSet );
+ SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
+ aURL.SetURL( aTmp.GetURL(), FALSE );
+ aSet.Put( aURL );
+ rSh.SetFlyFrmAttr( aSet );
+ return 1;
+ }
+
+ if( nsSelectionType::SEL_DRW & nSelection )
+ {
+ rSh.LeaveSelFrmMode();
+ rSh.UnSelectFrm();
+ rSh.ShowCrsr();
+ bFrmDrag = FALSE;
+ }
+ }
+ }
+
+ if( &rSh != &rSrcSh && (nsSelectionType::SEL_GRF & rSh.GetSelectionType()) &&
+ TRNSFR_GRAPHIC == eBufferType )
+ {
+ // ReRead auf die Grafik
+ String sGrfNm, sFltNm;
+ rSrcSh.GetGrfNms( &sGrfNm, &sFltNm );
+ rSh.ReRead( sGrfNm, sFltNm, rSrcSh.GetGraphic() );
+ return 1;
+ }
+
+ //Nicht in Selektionen oder selektierten Rahmen
+ if( rSh.ChgCurrPam( rDragPt ) ||
+ ( rSh.IsSelFrmMode() && rSh.IsInsideSelectedObj( rDragPt )) )
+ return 0;
+
+ if( rSrcSh.IsTableMode() )
+ bTblSel = TRUE;
+ else if( rSrcSh.IsSelFrmMode() || rSrcSh.IsObjSelected() )
+ {
+ // keine positionsgeschuetzten Objecte verschieben!
+ if( bMove && rSrcSh.IsSelObjProtected( FLYPROTECT_POS ) )
+ return 0;
+
+ bFrmSel = TRUE;
+ }
+
+ const int nSel = rSrcSh.GetSelectionType();
+
+ SwUndoId eUndoId = bMove ? UNDO_UI_DRAG_AND_MOVE : UNDO_UI_DRAG_AND_COPY;
+
+ // #111827#
+ SwRewriter aRewriter;
+
+ aRewriter.AddRule(UNDO_ARG1, rSrcSh.GetSelDescr());
+
+ if(rSrcSh.GetDoc() != rSh.GetDoc())
+ rSrcSh.StartUndo( eUndoId, &aRewriter );
+ rSh.StartUndo( eUndoId, &aRewriter );
+
+ rSh.StartAction();
+ rSrcSh.StartAction();
+
+ if( &rSrcSh != &rSh )
+ {
+ rSh.EnterStdMode();
+ rSh.SwCrsrShell::SetCrsr( rDragPt, TRUE );
+ cWord = rSrcSh.IntelligentCut( nSel, FALSE );
+ }
+ else if( !bTblSel && !bFrmSel )
+ {
+ if( !rSh.IsAddMode() )
+ {
+ // --> OD 2008-03-19 #i87233#
+ if ( rSh.IsBlockMode() )
+ {
+ // preserve order of cursors for block mode
+ rSh.GoPrevCrsr();
+ }
+ // <--
+ rSh.SwCrsrShell::CreateCrsr();
+ }
+ rSh.SwCrsrShell::SetCrsr( rDragPt, TRUE, false );
+ rSh.GoPrevCrsr();
+ cWord = rSh.IntelligentCut( rSh.GetSelectionType(), FALSE );
+ rSh.GoNextCrsr();
+ }
+
+ bInWrd = rSh.IsInWrd();
+ bEndWrd = rSh.IsEndWrd();
+ bSttWrd = !bEndWrd && rSh.IsSttWrd();
+ bSttPara= rSh.IsSttPara();
+
+ Point aSttPt( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY() );
+
+ //JP 05.03.96: INetFelder erstmal selektieren !
+ if( TRNSFR_INETFLD == eBufferType )
+ {
+ if( &rSrcSh == &rSh )
+ {
+ rSh.GoPrevCrsr();
+ rSh.SwCrsrShell::SetCrsr( aSttPt, TRUE );
+ rSh.SelectTxtAttr( RES_TXTATR_INETFMT );
+ if( rSh.ChgCurrPam( rDragPt ) )
+ {
+ // nicht in sich selbst kopieren/verschieben
+ rSh.DestroyCrsr();
+ rSh.EndUndo();
+ rSh.EndAction();
+ rSh.EndAction();
+ return 0;
+ }
+ rSh.GoNextCrsr();
+ }
+ else
+ {
+ rSrcSh.SwCrsrShell::SetCrsr( aSttPt, TRUE );
+ rSrcSh.SelectTxtAttr( RES_TXTATR_INETFMT );
+ }
+
+ // ist am Einfuege Punkt ein URL-Attribut? Dann das ersetzen,
+ // also einfach eine Selektion aufspannen?
+ rSh.DelINetAttrWithText();
+ bDDINetAttr = TRUE;
+ }
+
+ if ( rSrcSh.IsSelFrmMode() )
+ {
+ //Hack: Spezialbehandlung austricksen
+ aSttPt -= aSttPt - rSrcSh.GetObjRect().Pos();
+ }
+
+ BOOL bRet = rSrcSh.SwFEShell::Copy( &rSh, aSttPt, rDragPt, bMove,
+ !bIsXSelection );
+
+ if( !bIsXSelection )
+ {
+ rSrcSh.Push();
+ if ( bRet && bMove && !bFrmSel )
+ {
+ if ( bTblSel )
+ {
+ /* #109590# delete table contents not cells */
+ rSrcSh.Delete();
+ }
+ else
+ {
+ //SmartCut, eines der Blank mitnehmen.
+ rSh.SwCrsrShell::DestroyCrsr();
+ if ( cWord == SwWrtShell::WORD_SPACE_BEFORE )
+ rSh.ExtendSelection( FALSE );
+ else if ( cWord == SwWrtShell::WORD_SPACE_AFTER )
+ rSh.ExtendSelection();
+ rSrcSh.DelRight();
+ }
+ }
+ rSrcSh.KillPams();
+ rSrcSh.Pop( FALSE );
+
+ /* #109590# after dragging a table selection inside one shell
+ set cursor to the drop position. */
+ if( &rSh == &rSrcSh && ( bTblSel || rSh.IsBlockMode() ) )
+ {
+ rSrcSh.SwCrsrShell::SetCrsr(rDragPt);
+ rSrcSh.GetSwCrsr()->SetMark();
+ }
+ }
+
+ if( bRet && !bTblSel && !bFrmSel )
+ {
+ if( (bInWrd || bEndWrd) &&
+ (cWord == SwWrtShell::WORD_SPACE_AFTER ||
+ cWord == SwWrtShell::WORD_SPACE_BEFORE) )
+ {
+ if ( bSttWrd || (bInWrd && !bEndWrd))
+ rSh.SwEditShell::Insert(' ', bIsXSelection);
+ if ( !bSttWrd || (bInWrd && !bSttPara) )
+ {
+ rSh.SwapPam();
+ if ( !bSttWrd )
+ rSh.SwEditShell::Insert(' ', bIsXSelection);
+ rSh.SwapPam();
+ }
+ }
+
+ if( bIsXSelection )
+ {
+ if( &rSrcSh == &rSh && !rSh.IsAddMode() )
+ {
+ rSh.SwCrsrShell::DestroyCrsr();
+ rSh.GoPrevCrsr();
+ }
+ else
+ {
+ rSh.SwapPam();
+ rSh.SwCrsrShell::ClearMark();
+ }
+ }
+ else
+ {
+ if( rSh.IsAddMode() )
+ rSh.SwCrsrShell::CreateCrsr();
+ else
+ {
+ // Selektionsmodus einschalten
+ rSh.SttSelect();
+ rSh.EndSelect();
+ }
+ }
+ }
+
+ if( bRet && bMove && bFrmSel )
+ rSrcSh.LeaveSelFrmMode();
+
+ if( rSrcSh.GetDoc() != rSh.GetDoc() )
+ rSrcSh.EndUndo();
+ rSh.EndUndo();
+
+ // Shell in den richtigen Status versetzen
+ if( &rSrcSh != &rSh && ( rSh.IsFrmSelected() || rSh.IsObjSelected() ))
+ rSh.EnterSelFrmMode();
+
+ rSrcSh.EndAction();
+ rSh.EndAction();
+ return 1;
+}
+
+// Interfaces for Selection
+void SwTransferable::CreateSelection( SwWrtShell& rSh,
+ const ViewShell * _pCreatorView )
+{
+ SwModule *pMod = SW_MOD();
+ SwTransferable* pNew = new SwTransferable( rSh );
+
+ /* #96392#*/
+ pNew->pCreatorView = _pCreatorView;
+
+ uno::Reference<
+ datatransfer::XTransferable > xRef( pNew );
+ pMod->pXSelection = pNew;
+ pNew->CopyToSelection( rSh.GetWin() );
+}
+
+void SwTransferable::ClearSelection( SwWrtShell& rSh,
+ const ViewShell * _pCreatorView)
+{
+ SwModule *pMod = SW_MOD();
+ if( pMod->pXSelection &&
+ ((!pMod->pXSelection->pWrtShell) || (pMod->pXSelection->pWrtShell == &rSh)) &&
+ /* #96392# */
+ (!_pCreatorView || (pMod->pXSelection->pCreatorView == _pCreatorView)) )
+ {
+ TransferableHelper::ClearSelection( rSh.GetWin() );
+ }
+}
+/* -----------------3/31/2003 11:46AM----------------
+
+ --------------------------------------------------*/
+const Sequence< sal_Int8 >& SwTransferable::getUnoTunnelId()
+{
+ static Sequence< sal_Int8 > aSeq;
+ if( !aSeq.getLength() )
+ {
+ static osl::Mutex aCreateMutex;
+ osl::Guard< osl::Mutex > aGuard( aCreateMutex );
+ aSeq.realloc( 16 );
+ rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True );
+ }
+ return aSeq;
+}
+/* -----------------3/31/2003 11:46AM----------------
+
+ --------------------------------------------------*/
+sal_Int64 SwTransferable::getSomething( const Sequence< sal_Int8 >& rId ) throw( RuntimeException )
+{
+ sal_Int64 nRet;
+ if( ( rId.getLength() == 16 ) &&
+ ( 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
+ {
+ nRet = sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) );
+ }
+ else
+ nRet = TransferableHelper::getSomething(rId);
+ return nRet;
+}
+
+SwTransferable* SwTransferable::GetSwTransferable( const TransferableDataHelper& rData )
+{
+ SwTransferable* pSwTransferable = NULL;
+
+ uno::Reference<XUnoTunnel> xTunnel( rData.GetTransferable(), UNO_QUERY );
+ if ( xTunnel.is() )
+ {
+ sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() );
+ if ( nHandle )
+ pSwTransferable = (SwTransferable*) (sal_IntPtr) nHandle;
+ }
+
+ return pSwTransferable;
+
+}
+
+/* */
+
+// -----------------------------------------------------------------------
+
+SwTrnsfrDdeLink::SwTrnsfrDdeLink( SwTransferable& rTrans, SwWrtShell& rSh )
+ : rTrnsfr( rTrans ), pDocShell( 0 ),
+ bDelBookmrk( FALSE ), bInDisconnect( FALSE )
+{
+ // hier kommen wir nur bei Tabellen- oder Text-Selection an
+ const int nSelection = rSh.GetSelectionType();
+ if( nsSelectionType::SEL_TBL_CELLS & nSelection )
+ {
+ SwFrmFmt* pFmt = rSh.GetTableFmt();
+ if( pFmt )
+ sName = pFmt->GetName();
+ }
+ else
+ {
+ // creating a temp. bookmark without undo
+ BOOL bUndo = rSh.DoesUndo();
+ rSh.DoUndo( FALSE );
+ BOOL bIsModified = rSh.IsModified();
+
+ ::sw::mark::IMark* pMark = rSh.SetBookmark(
+ KeyCode(),
+ ::rtl::OUString(),
+ ::rtl::OUString(),
+ IDocumentMarkAccess::DDE_BOOKMARK);
+ if(pMark)
+ {
+ sName = pMark->GetName();
+ bDelBookmrk = TRUE;
+ if( !bIsModified )
+ rSh.ResetModified();
+ }
+ else
+ sName.Erase();
+ rSh.DoUndo( bUndo );
+ }
+
+ if( sName.Len() &&
+ 0 != ( pDocShell = rSh.GetDoc()->GetDocShell() ) )
+ {
+ // dann erzeugen wir uns mal unseren "Server" und connecten uns
+ // zu diesem
+ refObj = pDocShell->DdeCreateLinkSource( sName );
+ if( refObj.Is() )
+ {
+ refObj->AddConnectAdvise( this );
+ refObj->AddDataAdvise( this,
+// SotExchange::GetFormatMimeType( FORMAT_RTF ),
+ aEmptyStr,
+ ADVISEMODE_NODATA | ADVISEMODE_ONLYONCE );
+ nOldTimeOut = refObj->GetUpdateTimeout();
+ refObj->SetUpdateTimeout( 0 );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+SwTrnsfrDdeLink::~SwTrnsfrDdeLink()
+{
+ if( refObj.Is() )
+ Disconnect( TRUE );
+}
+
+// -----------------------------------------------------------------------
+
+void SwTrnsfrDdeLink::DataChanged( const String& ,
+ const uno::Any& )
+{
+ // tja das wars dann mit dem Link
+ if( !bInDisconnect )
+ {
+ if( FindDocShell() && pDocShell->GetView() )
+ rTrnsfr.RemoveDDELinkFormat( pDocShell->GetView()->GetEditWin() );
+ Disconnect( FALSE );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SwTrnsfrDdeLink::WriteData( SvStream& rStrm )
+{
+ if( !refObj.Is() || !FindDocShell() )
+ return FALSE;
+
+ rtl_TextEncoding eEncoding = DDE_TXT_ENCODING;
+ const ByteString aAppNm( GetpApp()->GetAppName(), eEncoding );
+ const ByteString aTopic( pDocShell->GetTitle( SFX_TITLE_FULLNAME ),
+ eEncoding );
+ const ByteString aName( sName, eEncoding );
+
+ sal_Char* pMem = new char[ aAppNm.Len() + aTopic.Len() + aName.Len() + 4 ];
+
+ xub_StrLen nLen = aAppNm.Len();
+ memcpy( pMem, aAppNm.GetBuffer(), nLen );
+ pMem[ nLen++ ] = 0;
+ memcpy( pMem + nLen, aTopic.GetBuffer(), aTopic.Len() );
+ nLen = nLen + aTopic.Len();
+ pMem[ nLen++ ] = 0;
+ memcpy( pMem + nLen, aName.GetBuffer(), aName.Len() );
+ nLen = nLen + aName.Len();
+ pMem[ nLen++ ] = 0;
+ pMem[ nLen++ ] = 0;
+
+ rStrm.Write( pMem, nLen );
+ delete[] pMem;
+
+ //if( bDelBookmrk )
+ //{
+ // // er wird das erstemal abgeholt, also ins Undo mitaufnehmen
+ // // aber wie??
+ //}
+
+ IDocumentMarkAccess* const pMarkAccess = pDocShell->GetDoc()->getIDocumentMarkAccess();
+ IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->findMark(sName);
+ if(ppMark != pMarkAccess->getMarksEnd()
+ && IDocumentMarkAccess::GetType(**ppMark) != IDocumentMarkAccess::BOOKMARK)
+ {
+ // the mark is still a DdeBookmark
+ // we replace it with a Bookmark, so it will get saved etc.
+ ::sw::mark::IMark* const pMark = ppMark->get();
+ SwServerObject* const pServerObject = dynamic_cast<SwServerObject *>(&refObj);
+
+ // collecting state of old mark
+ SwPaM aPaM(pMark->GetMarkStart());
+ *aPaM.GetPoint() = pMark->GetMarkStart();
+ if(pMark->IsExpanded())
+ {
+ aPaM.SetMark();
+ *aPaM.GetMark() = pMark->GetMarkEnd();
+ }
+ ::rtl::OUString sMarkName = pMark->GetName();
+
+ // remove mark
+ pServerObject->SetNoServer(); // this removes the connection between SwServerObject and mark
+ // N.B. ppMark was not loaded from file and cannot have xml:id
+ pMarkAccess->deleteMark(ppMark);
+
+ // recreate as Bookmark
+ ::sw::mark::IMark* const pNewMark = pMarkAccess->makeMark(
+ aPaM,
+ sMarkName,
+ IDocumentMarkAccess::BOOKMARK);
+ pServerObject->SetDdeBookmark(*pNewMark);
+ }
+
+ bDelBookmrk = false;
+ return true;
+}
+
+// -----------------------------------------------------------------------
+
+void SwTrnsfrDdeLink::Disconnect( BOOL bRemoveDataAdvise )
+{
+ //JP 29.01.96 Bug 24432:
+ // kein DataChanged mehr entgegen nehmen, wenn man
+ // sich schon im Disconnet befindet!
+ // (DTOR vom Bookmark verschickt einen DataChanged!)
+ BOOL bOldDisconnect = bInDisconnect;
+ bInDisconnect = TRUE;
+
+ // den nicht verwendeten Bookmark wieder zerstoeren (ohne Undo!)?
+ if( bDelBookmrk && refObj.Is() && FindDocShell() )
+ {
+ SwDoc* pDoc = pDocShell->GetDoc();
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
+
+ // --> OD, CD, OS 2005-11-25 #i58448#
+ Link aSavedOle2Link( pDoc->GetOle2Link() );
+ pDoc->SetOle2Link( Link() );
+ // <--
+ BOOL bIsModified = pDoc->IsModified();
+
+ IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
+ pMarkAccess->deleteMark(pMarkAccess->findMark(sName));
+
+ if( !bIsModified )
+ pDoc->ResetModified();
+ // --> OD, CD, OS 2005-11-25 #i58448#
+ pDoc->SetOle2Link( aSavedOle2Link );
+ // <--
+
+ bDelBookmrk = FALSE;
+ }
+
+ if( refObj.Is() )
+ {
+ refObj->SetUpdateTimeout( nOldTimeOut );
+ refObj->RemoveConnectAdvise( this );
+ if( bRemoveDataAdvise )
+ // in einem DataChanged darf das SelectionObject NIE geloescht
+ // werden; wird schon von der Basisklasse erledigt
+ // (ADVISEMODE_ONLYONCE!!!!)
+ // Im normalen Disconnet aber schon!
+ refObj->RemoveAllDataAdvise( this );
+ refObj.Clear();
+ }
+ bInDisconnect = bOldDisconnect;
+}
+
+// -----------------------------------------------------------------------
+
+BOOL SwTrnsfrDdeLink::FindDocShell()
+{
+ TypeId aType( TYPE( SwDocShell ) );
+ SfxObjectShell* pTmpSh = SfxObjectShell::GetFirst( &aType );
+ while( pTmpSh )
+ {
+ if( pTmpSh == pDocShell ) // die wollen wir haben
+ {
+ if( pDocShell->GetDoc() )
+ return TRUE;
+ break; // das Doc ist nicht mehr vorhanden, also raus!
+ }
+ pTmpSh = SfxObjectShell::GetNext( *pTmpSh, &aType );
+ }
+
+ pDocShell = 0;
+ return FALSE;
+}
+
+// -----------------------------------------------------------------------
+
+void SwTrnsfrDdeLink::Closed()
+{
+ if( !bInDisconnect && refObj.Is() )
+ {
+ refObj->RemoveAllDataAdvise( this );
+ refObj->RemoveConnectAdvise( this );
+ refObj.Clear();
+ }
+}
diff --git a/sw/source/ui/docvw/AnchorOverlayObject.cxx b/sw/source/ui/docvw/AnchorOverlayObject.cxx
new file mode 100644
index 000000000000..5ed5b076a967
--- /dev/null
+++ b/sw/source/ui/docvw/AnchorOverlayObject.cxx
@@ -0,0 +1,467 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: postit.cxx,v $
+ * $Revision: 1.8.42.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <AnchorOverlayObject.hxx>
+#include <SidebarWindowsConsts.hxx>
+
+#include <swrect.hxx>
+#include <view.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/svdview.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+
+#include <sw_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
+
+namespace sw { namespace sidebarwindows {
+
+//////////////////////////////////////////////////////////////////////////////
+// helper class: Primitive for discrete visualisation
+
+class AnchorPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D
+{
+private:
+ basegfx::B2DPolygon maTriangle;
+ basegfx::B2DPolygon maLine;
+ basegfx::B2DPolygon maLineTop;
+ const AnchorState maAnchorState;
+ basegfx::BColor maColor;
+
+ // discrete line width
+ double mfLogicLineWidth;
+
+ // bitfield
+ bool mbShadow : 1;
+ bool mbLineSolid : 1;
+
+protected:
+ virtual drawinglayer::primitive2d::Primitive2DSequence create2DDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation) const;
+
+public:
+ AnchorPrimitive( const basegfx::B2DPolygon& rTriangle,
+ const basegfx::B2DPolygon& rLine,
+ const basegfx::B2DPolygon& rLineTop,
+ AnchorState aAnchorState,
+ const basegfx::BColor& rColor,
+ double fLogicLineWidth,
+ bool bShadow,
+ bool bLineSolid )
+ : drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D(),
+ maTriangle(rTriangle),
+ maLine(rLine),
+ maLineTop(rLineTop),
+ maAnchorState(aAnchorState),
+ maColor(rColor),
+ mfLogicLineWidth(fLogicLineWidth),
+ mbShadow(bShadow),
+ mbLineSolid(bLineSolid)
+ {}
+
+ // data access
+ const basegfx::B2DPolygon& getTriangle() const { return maTriangle; }
+ const basegfx::B2DPolygon& getLine() const { return maLine; }
+ const basegfx::B2DPolygon& getLineTop() const { return maLineTop; }
+ AnchorState getAnchorState() const { return maAnchorState; }
+ const basegfx::BColor& getColor() const { return maColor; }
+ double getLogicLineWidth() const { return mfLogicLineWidth; }
+ bool getShadow() const { return mbShadow; }
+ bool getLineSolid() const { return mbLineSolid; }
+
+ virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const;
+
+ DeclPrimitrive2DIDBlock()
+};
+
+drawinglayer::primitive2d::Primitive2DSequence AnchorPrimitive::create2DDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const
+{
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+
+ if ( AS_TRI == maAnchorState ||
+ AS_ALL == maAnchorState ||
+ AS_START == maAnchorState )
+ {
+ // create triangle
+ const drawinglayer::primitive2d::Primitive2DReference aTriangle(
+ new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(getTriangle()),
+ getColor()));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aTriangle);
+ }
+
+ if ( AS_ALL == maAnchorState ||
+ AS_START == maAnchorState )
+ {
+ // create line start
+ const drawinglayer::attribute::LineAttribute aLineAttribute(
+ getColor(),
+ getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit()));
+
+ if(getLineSolid())
+ {
+ const drawinglayer::primitive2d::Primitive2DReference aSolidLine(
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ getLine(),
+ aLineAttribute));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aSolidLine);
+ }
+ else
+ {
+ ::std::vector< double > aDotDashArray;
+ const double fDistance(3.0 * 15.0);
+ const double fDashLen(5.0 * 15.0);
+
+ aDotDashArray.push_back(fDashLen);
+ aDotDashArray.push_back(fDistance);
+
+ const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(
+ aDotDashArray,
+ fDistance + fDashLen);
+
+ const drawinglayer::primitive2d::Primitive2DReference aStrokedLine(
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ getLine(),
+ aLineAttribute,
+ aStrokeAttribute));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aStrokedLine);
+ }
+ }
+
+ if(aRetval.hasElements() && getShadow())
+ {
+ // shadow is only for triangle and line start, and in upper left
+ // and lower right direction, in different colors
+ const double fColorChange(20.0 / 255.0);
+ const basegfx::B3DTuple aColorChange(fColorChange, fColorChange, fColorChange);
+ basegfx::BColor aLighterColor(getColor() + aColorChange);
+ basegfx::BColor aDarkerColor(getColor() - aColorChange);
+
+ aLighterColor.clamp();
+ aDarkerColor.clamp();
+
+ // create shadow sequence
+ drawinglayer::primitive2d::Primitive2DSequence aShadows(2);
+ basegfx::B2DHomMatrix aTransform;
+
+ aTransform.set(0, 2, -getDiscreteUnit());
+ aTransform.set(1, 2, -getDiscreteUnit());
+
+ aShadows[0] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::ShadowPrimitive2D(
+ aTransform,
+ aLighterColor,
+ aRetval));
+
+ aTransform.set(0, 2, getDiscreteUnit());
+ aTransform.set(1, 2, getDiscreteUnit());
+
+ aShadows[1] = drawinglayer::primitive2d::Primitive2DReference(
+ new drawinglayer::primitive2d::ShadowPrimitive2D(
+ aTransform,
+ aDarkerColor,
+ aRetval));
+
+ // add shadow before geometry to make it be proccessed first
+ const drawinglayer::primitive2d::Primitive2DSequence aTemporary(aRetval);
+
+ aRetval = aShadows;
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemporary);
+ }
+
+ if ( AS_ALL == maAnchorState ||
+ AS_END == maAnchorState )
+ {
+ // LineTop has to be created, too, but uses no shadow, so add after
+ // the other parts are created
+ const drawinglayer::attribute::LineAttribute aLineAttribute(
+ getColor(),
+ getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit()));
+
+ const drawinglayer::primitive2d::Primitive2DReference aLineTop(
+ new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
+ getLineTop(),
+ aLineAttribute));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aLineTop);
+ }
+
+ return aRetval;
+}
+
+bool AnchorPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const
+{
+ if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const AnchorPrimitive& rCompare = static_cast< const AnchorPrimitive& >(rPrimitive);
+
+ return (getTriangle() == rCompare.getTriangle()
+ && getLine() == rCompare.getLine()
+ && getLineTop() == rCompare.getLineTop()
+ && getAnchorState() == rCompare.getAnchorState()
+ && getColor() == rCompare.getColor()
+ && getLogicLineWidth() == rCompare.getLogicLineWidth()
+ && getShadow() == rCompare.getShadow()
+ && getLineSolid() == rCompare.getLineSolid());
+ }
+
+ return false;
+}
+
+ImplPrimitrive2DIDBlock(AnchorPrimitive, PRIMITIVE2D_ID_SWSIDEBARANCHORPRIMITIVE)
+
+/****** AnchorOverlayObject ***********************************************************/
+/*static*/ AnchorOverlayObject* AnchorOverlayObject::CreateAnchorOverlayObject(
+ SwView& rDocView,
+ const SwRect& aAnchorRect,
+ const long& aPageBorder,
+ const Point& aLineStart,
+ const Point& aLineEnd,
+ const Color& aColorAnchor )
+{
+ AnchorOverlayObject* pAnchorOverlayObject( 0 );
+ if ( rDocView.GetDrawView() )
+ {
+ SdrPaintWindow* pPaintWindow = rDocView.GetDrawView()->GetPaintWindow(0);
+ if( pPaintWindow )
+ {
+ sdr::overlay::OverlayManager* pOverlayManager = pPaintWindow->GetOverlayManager();
+
+ if ( pOverlayManager )
+ {
+ pAnchorOverlayObject = new AnchorOverlayObject(
+ basegfx::B2DPoint( aAnchorRect.Left() , aAnchorRect.Bottom()-5*15),
+ basegfx::B2DPoint( aAnchorRect.Left()-5*15 , aAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( aAnchorRect.Left()+5*15 , aAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( aAnchorRect.Left(), aAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( aPageBorder ,aAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
+ basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()) ,
+ aColorAnchor,
+ false,
+ false);
+ pOverlayManager->add(*pAnchorOverlayObject);
+ }
+ }
+ }
+
+ return pAnchorOverlayObject;
+}
+
+/*static*/ void AnchorOverlayObject::DestroyAnchorOverlayObject( AnchorOverlayObject* pAnchor )
+{
+ if ( pAnchor )
+ {
+ if ( pAnchor->getOverlayManager() )
+ {
+ // remove this object from the chain
+ pAnchor->getOverlayManager()->remove(*pAnchor);
+ }
+ delete pAnchor;
+ }
+}
+
+AnchorOverlayObject::AnchorOverlayObject( const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPos,
+ const basegfx::B2DPoint& rThirdPos,
+ const basegfx::B2DPoint& rFourthPos,
+ const basegfx::B2DPoint& rFifthPos,
+ const basegfx::B2DPoint& rSixthPos,
+ const basegfx::B2DPoint& rSeventhPos,
+ const Color aBaseColor,
+ const bool bShadowedEffect,
+ const bool bLineSolid)
+ : OverlayObjectWithBasePosition( rBasePos, aBaseColor )
+ , maSecondPosition(rSecondPos)
+ , maThirdPosition(rThirdPos)
+ , maFourthPosition(rFourthPos)
+ , maFifthPosition(rFifthPos)
+ , maSixthPosition(rSixthPos)
+ , maSeventhPosition(rSeventhPos)
+ , maTriangle()
+ , maLine()
+ , maLineTop()
+ , mHeight(0)
+ , mAnchorState(AS_ALL)
+ , mbShadowedEffect(bShadowedEffect)
+ , mbLineSolid(bLineSolid)
+{
+}
+
+AnchorOverlayObject::~AnchorOverlayObject()
+{
+}
+
+void AnchorOverlayObject::implEnsureGeometry()
+{
+ if(!maTriangle.count())
+ {
+ maTriangle.append(getBasePosition());
+ maTriangle.append(GetSecondPosition());
+ maTriangle.append(GetThirdPosition());
+ maTriangle.setClosed(true);
+ }
+
+ if(!maLine.count())
+ {
+ maLine.append(GetFourthPosition());
+ maLine.append(GetFifthPosition());
+ maLine.append(GetSixthPosition());
+ }
+
+ if(!maLineTop.count())
+ {
+ maLineTop.append(GetSixthPosition());
+ maLineTop.append(GetSeventhPosition());
+ }
+}
+
+void AnchorOverlayObject::implResetGeometry()
+{
+ maTriangle.clear();
+ maLine.clear();
+ maLineTop.clear();
+}
+
+drawinglayer::primitive2d::Primitive2DSequence AnchorOverlayObject::createOverlayObjectPrimitive2DSequence()
+{
+ implEnsureGeometry();
+
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new AnchorPrimitive( maTriangle,
+ maLine,
+ maLineTop,
+ GetAnchorState(),
+ getBaseColor().getBColor(),
+ ANCHORLINE_WIDTH * 15.0,
+ getShadowedEffect(),
+ getLineSolid()) );
+
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+}
+
+void AnchorOverlayObject::SetAllPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2,
+ const basegfx::B2DPoint& rPoint3,
+ const basegfx::B2DPoint& rPoint4,
+ const basegfx::B2DPoint& rPoint5,
+ const basegfx::B2DPoint& rPoint6,
+ const basegfx::B2DPoint& rPoint7)
+{
+ if ( rPoint1 != getBasePosition() ||
+ rPoint2 != GetSecondPosition() ||
+ rPoint3 != GetThirdPosition() ||
+ rPoint4 != GetFourthPosition() ||
+ rPoint5 != GetFifthPosition() ||
+ rPoint6 != GetSixthPosition() ||
+ rPoint7 != GetSeventhPosition() )
+ {
+ maBasePosition = rPoint1;
+ maSecondPosition = rPoint2;
+ maThirdPosition = rPoint3;
+ maFourthPosition = rPoint4;
+ maFifthPosition = rPoint5;
+ maSixthPosition = rPoint6;
+ maSeventhPosition = rPoint7;
+
+ implResetGeometry();
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::SetSixthPosition(const basegfx::B2DPoint& rNew)
+{
+ if(rNew != maSixthPosition)
+ {
+ maSixthPosition = rNew;
+ implResetGeometry();
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::SetSeventhPosition(const basegfx::B2DPoint& rNew)
+{
+ if(rNew != maSeventhPosition)
+ {
+ maSeventhPosition = rNew;
+ implResetGeometry();
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::SetTriPosition(const basegfx::B2DPoint& rPoint1,const basegfx::B2DPoint& rPoint2,const basegfx::B2DPoint& rPoint3,
+ const basegfx::B2DPoint& rPoint4,const basegfx::B2DPoint& rPoint5)
+{
+ if(rPoint1 != getBasePosition()
+ || rPoint2 != GetSecondPosition()
+ || rPoint3 != GetThirdPosition()
+ || rPoint4 != GetFourthPosition()
+ || rPoint5 != GetFifthPosition())
+ {
+ maBasePosition = rPoint1;
+ maSecondPosition = rPoint2;
+ maThirdPosition = rPoint3;
+ maFourthPosition = rPoint4;
+ maFifthPosition = rPoint5;
+
+ implResetGeometry();
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::setLineSolid( const bool bNew )
+{
+ if ( bNew != getLineSolid() )
+ {
+ mbLineSolid = bNew;
+ objectChange();
+ }
+}
+
+void AnchorOverlayObject::SetAnchorState( const AnchorState aState)
+{
+ if ( mAnchorState != aState)
+ {
+ mAnchorState = aState;
+ objectChange();
+ }
+}
+
+} } // end of namespace sw::annotation
+
diff --git a/sw/source/ui/docvw/AnchorOverlayObject.hxx b/sw/source/ui/docvw/AnchorOverlayObject.hxx
new file mode 100644
index 000000000000..cea567f22921
--- /dev/null
+++ b/sw/source/ui/docvw/AnchorOverlayObject.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ANCHOROVERLAYOBJECT_HXX
+#define _ANCHOROVERLAYOBJECT_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+class SwView;
+class SwRect;
+class Point;
+
+namespace sw { namespace sidebarwindows {
+
+enum AnchorState
+{
+ AS_ALL,
+ AS_START,
+ AS_END,
+ AS_TRI
+};
+
+class AnchorOverlayObject: public sdr::overlay::OverlayObjectWithBasePosition
+{
+ public:
+ static AnchorOverlayObject* CreateAnchorOverlayObject( SwView& rDocView,
+ const SwRect& aAnchorRect,
+ const long& aPageBorder,
+ const Point& aLineStart,
+ const Point& aLineEnd,
+ const Color& aColorAnchor );
+ static void DestroyAnchorOverlayObject( AnchorOverlayObject* pAnchor );
+
+ inline const basegfx::B2DPoint& GetSecondPosition() const { return maSecondPosition; }
+ const basegfx::B2DPoint& GetThirdPosition() const { return maThirdPosition; }
+ const basegfx::B2DPoint& GetFourthPosition() const { return maFourthPosition; }
+ const basegfx::B2DPoint& GetFifthPosition() const { return maFifthPosition; }
+ const basegfx::B2DPoint& GetSixthPosition() const { return maSixthPosition; }
+ const basegfx::B2DPoint& GetSeventhPosition() const { return maSeventhPosition; }
+
+ void SetAllPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2,
+ const basegfx::B2DPoint& rPoint3,
+ const basegfx::B2DPoint& rPoint4,
+ const basegfx::B2DPoint& rPoint5,
+ const basegfx::B2DPoint& rPoint6,
+ const basegfx::B2DPoint& rPoint7 );
+ void SetTriPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2,
+ const basegfx::B2DPoint& rPoint3,
+ const basegfx::B2DPoint& rPoint4,
+ const basegfx::B2DPoint& rPoint5 );
+ void SetSixthPosition( const basegfx::B2DPoint& rNew );
+ void SetSeventhPosition( const basegfx::B2DPoint& rNew );
+
+ void setLineSolid( const bool bNew );
+ inline bool getLineSolid() const { return mbLineSolid; }
+
+ inline void SetHeight( const unsigned long aHeight ) { mHeight = aHeight; };
+
+ bool getShadowedEffect() const { return mbShadowedEffect; }
+
+ void SetAnchorState( const AnchorState aState );
+ inline AnchorState GetAnchorState() const { return mAnchorState; }
+
+ protected:
+ /* 6------------7
+ 1 /
+ /4\ ---------------5
+ 2 - 3
+ */
+
+ basegfx::B2DPoint maSecondPosition;
+ basegfx::B2DPoint maThirdPosition;
+ basegfx::B2DPoint maFourthPosition;
+ basegfx::B2DPoint maFifthPosition;
+ basegfx::B2DPoint maSixthPosition;
+ basegfx::B2DPoint maSeventhPosition;
+
+ // helpers to fill and reset geometry
+ void implEnsureGeometry();
+ void implResetGeometry();
+
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ private:
+ // object's geometry
+ basegfx::B2DPolygon maTriangle;
+ basegfx::B2DPolygon maLine;
+ basegfx::B2DPolygon maLineTop;
+ unsigned long mHeight;
+ AnchorState mAnchorState;
+
+ bool mbShadowedEffect : 1;
+ bool mbLineSolid : 1;
+
+ AnchorOverlayObject( const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPos,
+ const basegfx::B2DPoint& rThirdPos,
+ const basegfx::B2DPoint& rFourthPos,
+ const basegfx::B2DPoint& rFifthPos,
+ const basegfx::B2DPoint& rSixthPos,
+ const basegfx::B2DPoint& rSeventhPos,
+ const Color aBaseColor,
+ const bool bShadowedEffect,
+ const bool bLineSolid );
+ virtual ~AnchorOverlayObject();
+};
+
+} } // end of namespace sw::annotation
+
+#endif
diff --git a/sw/source/ui/docvw/AnnotationMenuButton.cxx b/sw/source/ui/docvw/AnnotationMenuButton.cxx
new file mode 100644
index 000000000000..c49c689851ba
--- /dev/null
+++ b/sw/source/ui/docvw/AnnotationMenuButton.cxx
@@ -0,0 +1,215 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <AnnotationMenuButton.hxx>
+
+#include <annotation.hrc>
+#include <app.hrc>
+#include <access.hrc>
+
+#include <unotools/useroptions.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/decoview.hxx>
+#include <vcl/gradient.hxx>
+
+#include <cmdid.h>
+#include <SidebarWin.hxx>
+
+namespace sw { namespace annotation {
+
+Color ColorFromAlphaColor( const UINT8 aTransparency,
+ const Color &aFront,
+ const Color &aBack )
+{
+ return Color((UINT8)(aFront.GetRed() * aTransparency/(double)255 + aBack.GetRed() * (1-aTransparency/(double)255)),
+ (UINT8)(aFront.GetGreen() * aTransparency/(double)255 + aBack.GetGreen() * (1-aTransparency/(double)255)),
+ (UINT8)(aFront.GetBlue() * aTransparency/(double)255 + aBack.GetBlue() * (1-aTransparency/(double)255)));
+}
+
+AnnotationMenuButton::AnnotationMenuButton( sw::sidebarwindows::SwSidebarWin& rSidebarWin )
+ : MenuButton( &rSidebarWin )
+ , mrSidebarWin( rSidebarWin )
+{
+ AddEventListener( LINK( &mrSidebarWin, sw::sidebarwindows::SwSidebarWin, WindowEventListener ) );
+
+ SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_BUTTON_NAME ) );
+ SetAccessibleDescription( SW_RES( STR_ACCESS_ANNOTATION_BUTTON_DESC ) );
+ SetQuickHelpText( GetAccessibleDescription() );
+}
+
+AnnotationMenuButton::~AnnotationMenuButton()
+{
+ RemoveEventListener( LINK( &mrSidebarWin, sw::sidebarwindows::SwSidebarWin, WindowEventListener ) );
+}
+
+void AnnotationMenuButton::Select()
+{
+ mrSidebarWin.ExecuteCommand( GetCurItemId() );
+}
+
+void AnnotationMenuButton::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ PopupMenu* pButtonPopup( GetPopupMenu() );
+ if ( mrSidebarWin.IsReadOnly() )
+ {
+ pButtonPopup->EnableItem( FN_REPLY, false );
+ pButtonPopup->EnableItem( FN_DELETE_COMMENT, false );
+ pButtonPopup->EnableItem( FN_DELETE_NOTE_AUTHOR, false );
+ pButtonPopup->EnableItem( FN_DELETE_ALL_NOTES, false );
+ }
+ else
+ {
+ pButtonPopup->EnableItem( FN_DELETE_COMMENT, !mrSidebarWin.IsProtected() );
+ pButtonPopup->EnableItem( FN_DELETE_NOTE_AUTHOR, true );
+ pButtonPopup->EnableItem( FN_DELETE_ALL_NOTES, true );
+ }
+
+ if ( mrSidebarWin.IsProtected() )
+ {
+ pButtonPopup->EnableItem( FN_REPLY, false );
+ }
+ else
+ {
+ SvtUserOptions aUserOpt;
+ String sAuthor;
+ if ( !(sAuthor = aUserOpt.GetFullName()).Len() )
+ {
+ if ( !(sAuthor = aUserOpt.GetID()).Len() )
+ {
+ sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
+ }
+ }
+ // do not allow to reply to ourself and no answer possible if this note is in a protected section
+ if ( sAuthor == mrSidebarWin.GetAuthor() )
+ {
+ pButtonPopup->EnableItem( FN_REPLY, false );
+ }
+ else
+ {
+ pButtonPopup->EnableItem( FN_REPLY, true );
+ }
+ }
+
+ MenuButton::MouseButtonDown( rMEvt );
+}
+
+void AnnotationMenuButton::Paint( const Rectangle& /*rRect*/ )
+{
+ if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ SetFillColor(COL_BLACK);
+ else
+ SetFillColor( mrSidebarWin.ColorDark() );
+ SetLineColor();
+ const Rectangle aRect( Rectangle( Point( 0, 0 ), PixelToLogic( GetSizePixel() ) ) );
+ DrawRect( aRect );
+
+ if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ //draw rect around button
+ SetFillColor(COL_BLACK);
+ SetLineColor(COL_WHITE);
+ }
+ else
+ {
+ //draw button
+ Gradient aGradient;
+ if ( IsMouseOver() )
+ aGradient = Gradient( GRADIENT_LINEAR,
+ ColorFromAlphaColor( 80, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ),
+ ColorFromAlphaColor( 15, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ));
+ else
+ aGradient = Gradient( GRADIENT_LINEAR,
+ ColorFromAlphaColor( 15, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ),
+ ColorFromAlphaColor( 80, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ));
+ DrawGradient( aRect, aGradient );
+
+ //draw rect around button
+ SetFillColor();
+ SetLineColor( ColorFromAlphaColor( 90, mrSidebarWin.ColorAnchor(), mrSidebarWin.ColorDark() ));
+ }
+ DrawRect( aRect );
+
+ if ( mrSidebarWin.IsPreview() )
+ {
+ Font aOldFont( mrSidebarWin.GetFont() );
+ Font aFont(aOldFont);
+ Color aCol( COL_BLACK);
+ aFont.SetColor( aCol );
+ aFont.SetHeight(200);
+ aFont.SetWeight(WEIGHT_MEDIUM);
+ SetFont( aFont );
+ DrawText( aRect ,
+ rtl::OUString::createFromAscii("Edit Note"),
+ TEXT_DRAW_CENTER );
+ SetFont( aOldFont );
+ }
+ else
+ {
+ Rectangle aSymbolRect( aRect );
+ // 25% distance to the left and right button border
+ const long nBorderDistanceLeftAndRight = ((aSymbolRect.GetWidth()*250)+500)/1000;
+ aSymbolRect.Left()+=nBorderDistanceLeftAndRight;
+ aSymbolRect.Right()-=nBorderDistanceLeftAndRight;
+ // 40% distance to the top button border
+ const long nBorderDistanceTop = ((aSymbolRect.GetHeight()*400)+500)/1000;
+ aSymbolRect.Top()+=nBorderDistanceTop;
+ // 15% distance to the bottom button border
+ const long nBorderDistanceBottom = ((aSymbolRect.GetHeight()*150)+500)/1000;
+ aSymbolRect.Bottom()-=nBorderDistanceBottom;
+ DecorationView aDecoView( this );
+ aDecoView.DrawSymbol( aSymbolRect, SYMBOL_SPIN_DOWN,
+ ( Application::GetSettings().GetStyleSettings().GetHighContrastMode()
+ ? Color( COL_WHITE )
+ : Color( COL_BLACK ) ) );
+ }
+}
+
+void AnnotationMenuButton::KeyInput( const KeyEvent& rKeyEvt )
+{
+ const KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
+ const USHORT nKey = rKeyCode.GetCode();
+ if ( nKey == KEY_TAB )
+ {
+ mrSidebarWin.ActivatePostIt();
+ mrSidebarWin.GrabFocus();
+ }
+ else
+ {
+ MenuButton::KeyInput( rKeyEvt );
+ }
+}
+
+} } // end of namespace sw::annotation
+
diff --git a/sw/source/ui/docvw/AnnotationMenuButton.hxx b/sw/source/ui/docvw/AnnotationMenuButton.hxx
new file mode 100644
index 000000000000..c74719f1cad4
--- /dev/null
+++ b/sw/source/ui/docvw/AnnotationMenuButton.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ANNOTATIONMENUBUTTON_HXX
+#define _ANNOTATIONMENUBUTTON_HXX
+
+#include <vcl/menubtn.hxx>
+
+namespace sw { namespace sidebarwindows {
+ class SwSidebarWin;
+} }
+
+namespace sw { namespace annotation {
+
+class AnnotationMenuButton : public MenuButton
+{
+ public:
+ AnnotationMenuButton( sw::sidebarwindows::SwSidebarWin& rSidebarWin );
+ ~AnnotationMenuButton();
+
+ // overloaded <MenuButton> methods
+ virtual void Select();
+
+ // overloaded <Window> methods
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void KeyInput( const KeyEvent& rKeyEvt );
+
+ private:
+ sw::sidebarwindows::SwSidebarWin& mrSidebarWin;
+};
+
+} } // end of namespace sw::annotation
+
+#endif
diff --git a/sw/source/ui/docvw/AnnotationWin.cxx b/sw/source/ui/docvw/AnnotationWin.cxx
new file mode 100644
index 000000000000..52b1821d5a8b
--- /dev/null
+++ b/sw/source/ui/docvw/AnnotationWin.cxx
@@ -0,0 +1,296 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sw.hxx"
+
+#include <AnnotationWin.hxx>
+
+#include <AnnotationMenuButton.hxx>
+#include <PostItMgr.hxx>
+
+#include <annotation.hrc>
+#include <popup.hrc>
+#include <cmdid.h>
+
+#include <vcl/menu.hxx>
+
+#include <svl/undo.hxx>
+#include <unotools/syslocale.hxx>
+#include <svl/languageoptions.hxx>
+
+#include <editeng/postitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/langitem.hxx>
+
+#include <editeng/editview.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editobj.hxx>
+
+#include <docufld.hxx> // SwPostItField
+#include <txtfld.hxx>
+#include <ndtxt.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <SwUndoField.hxx>
+
+
+namespace sw { namespace annotation {
+
+SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits,
+ SwSidebarItem& rSidebarItem,
+ SwFmtFld* aField )
+ : SwSidebarWin( rEditWin, nBits, aMgr, aBits, rSidebarItem )
+ , mpFmtFld(aField)
+ , mpFld( static_cast<SwPostItField*>(aField->GetFld()))
+ , mpButtonPopup(0)
+{
+}
+
+SwAnnotationWin::~SwAnnotationWin()
+{
+ delete mpButtonPopup;
+}
+
+void SwAnnotationWin::SetPostItText()
+{
+ // get text from SwPostItField and insert into our textview
+ Engine()->SetModifyHdl( Link() );
+ Engine()->EnableUndo( FALSE );
+ mpFld = static_cast<SwPostItField*>(mpFmtFld->GetFld());
+ if( mpFld->GetTextObject() )
+ Engine()->SetText( *mpFld->GetTextObject() );
+ else
+ {
+ Engine()->Clear();
+ GetOutlinerView()->SetAttribs(DefaultItem());
+ GetOutlinerView()->InsertText(mpFld->GetPar2(),false);
+ }
+
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+ Engine()->EnableUndo( TRUE );
+ Engine()->SetModifyHdl( LINK( this, SwAnnotationWin, ModifyHdl ) );
+ Invalidate();
+}
+
+void SwAnnotationWin::UpdateData()
+{
+ if ( Engine()->IsModified() )
+ {
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+ SwField* pOldField = mpFld->Copy();
+ mpFld->SetPar2(Engine()->GetEditEngine().GetText());
+ mpFld->SetTextObject(Engine()->CreateParaObject());
+ DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
+ delete pOldField;
+ // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one)
+ Mgr().SetLayout();
+ // #i98686# if we have several views, all notes should update their text
+ mpFmtFld->Broadcast(SwFmtFldHint( 0, SWFMTFLD_CHANGED));
+ DocView().GetDocShell()->SetModified();
+ }
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+}
+
+void SwAnnotationWin::Delete()
+{
+ SwSidebarWin::Delete();
+ // we delete the field directly, the Mgr cleans up the PostIt by listening
+ DocView().GetWrtShellPtr()->GotoField(*mpFmtFld);
+ GrabFocusToDocument();
+ DocView().GetWrtShellPtr()->DelRight();
+}
+
+void SwAnnotationWin::GotoPos()
+{
+ DocView().GetDocShell()->GetWrtShell()->GotoField(*mpFmtFld);
+}
+
+sal_uInt32 SwAnnotationWin::MoveCaret()
+{
+ // if this is an answer, do not skip over all following ones, but insert directly behind the current one
+ // but when just leaving a note, skip all following ones as well to continue typing
+ return Mgr().IsAnswer()
+ ? 1
+ : 1 + CountFollowing();
+}
+
+//returns true, if there is another note right before this note
+bool SwAnnotationWin::CalcFollow()
+{
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+ SwTxtAttr * const pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
+ aPosition.nContent.GetIndex() - 1, RES_TXTATR_FIELD );
+ const SwField* pFld = pTxtAttr ? pTxtAttr->GetFld().GetFld() : 0;
+ return pFld && (pFld->Which()== RES_POSTITFLD);
+}
+
+// counts how many SwPostItField we have right after the current one
+sal_uInt32 SwAnnotationWin::CountFollowing()
+{
+ sal_uInt32 aCount = 1; // we start with 1, so we have to subtract one at the end again
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+
+ SwTxtAttr * pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
+ aPosition.nContent.GetIndex() + 1,
+ RES_TXTATR_FIELD );
+ SwField* pFld = pTxtAttr
+ ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld())
+ : 0;
+ while ( pFld && ( pFld->Which()== RES_POSTITFLD ) )
+ {
+ aCount++;
+ pTxtAttr = pTxtFld->GetTxtNode().GetTxtAttrForCharAt(
+ aPosition.nContent.GetIndex() + aCount,
+ RES_TXTATR_FIELD );
+ pFld = pTxtAttr
+ ? const_cast<SwField*>(pTxtAttr->GetFld().GetFld())
+ : 0;
+ }
+ return aCount - 1;
+}
+
+MenuButton* SwAnnotationWin::CreateMenuButton()
+{
+ mpButtonPopup = new PopupMenu(SW_RES(MN_ANNOTATION_BUTTON));
+ XubString aText = mpButtonPopup->GetItemText( FN_DELETE_NOTE_AUTHOR );
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1,GetAuthor());
+ aText = aRewriter.Apply(aText);
+ mpButtonPopup->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
+ MenuButton* pMenuButton = new AnnotationMenuButton( *this );
+ pMenuButton->SetPopupMenu( mpButtonPopup );
+ pMenuButton->Show();
+ return pMenuButton;
+}
+
+void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText)
+{
+ //collect our old meta data
+ SwSidebarWin* pWin = Mgr().GetNextPostIt(KEY_PAGEUP, this);
+ const SvtSysLocale aSysLocale;
+ const LocaleDataWrapper& rLocalData = aSysLocale.GetLocaleData();
+ String aText = String(SW_RES(STR_REPLY));
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, pWin->GetAuthor());
+ aText = aRewriter.Apply(aText);
+ aText.Append(String(rtl::OUString::createFromAscii(" (") +
+ String(rLocalData.getDate( pWin->GetDate())) + rtl::OUString::createFromAscii(", ") +
+ String(rLocalData.getTime( pWin->GetTime(),false)) + rtl::OUString::createFromAscii("): \"")));
+ GetOutlinerView()->InsertText(aText,false);
+
+ // insert old, selected text or "..."
+ // TOOD: iterate over all paragraphs, not only first one to find out if it is empty
+ if (pText->GetTextObject().GetText(0) != String(rtl::OUString::createFromAscii("")))
+ GetOutlinerView()->GetEditView().InsertText(pText->GetTextObject());
+ else
+ GetOutlinerView()->InsertText(rtl::OUString::createFromAscii("..."),false);
+ GetOutlinerView()->InsertText(rtl::OUString::createFromAscii("\"\n"),false);
+
+ GetOutlinerView()->SetSelection(ESelection(0x0,0x0,0xFFFF,0xFFFF));
+ SfxItemSet aAnswerSet( DocView().GetDocShell()->GetPool() );
+ aAnswerSet.Put(SvxFontHeightItem(200,80,EE_CHAR_FONTHEIGHT));
+ aAnswerSet.Put(SvxPostureItem(ITALIC_NORMAL,EE_CHAR_ITALIC));
+ GetOutlinerView()->SetAttribs(aAnswerSet);
+ GetOutlinerView()->SetSelection(ESelection(0xFFFF,0xFFFF,0xFFFF,0xFFFF));
+
+ //remove all attributes and reset our standard ones
+ GetOutlinerView()->GetEditView().RemoveAttribsKeepLanguages(true);
+ GetOutlinerView()->SetAttribs(DefaultItem());
+ // lets insert an undo step so the initial text can be easily deleted
+ // but do not use UpdateData() directly, would set modified state again and reentrance into Mgr
+ Engine()->SetModifyHdl( Link() );
+ SwTxtFld* pTxtFld = mpFmtFld->GetTxtFld();
+ SwPosition aPosition( pTxtFld->GetTxtNode() );
+ aPosition.nContent = *pTxtFld->GetStart();
+ SwField* pOldField = mpFld->Copy();
+ mpFld->SetPar2(Engine()->GetEditEngine().GetText());
+ mpFld->SetTextObject(Engine()->CreateParaObject());
+ DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true));
+ delete pOldField;
+ Engine()->SetModifyHdl( LINK( this, SwAnnotationWin, ModifyHdl ) );
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+}
+
+SvxLanguageItem SwAnnotationWin::GetLanguage(void)
+{
+ // set initial language for outliner
+ USHORT nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( mpFld->GetLanguage() );
+ USHORT nLangWhichId = 0;
+ switch (nScriptType)
+ {
+ case SCRIPTTYPE_LATIN : nLangWhichId = EE_CHAR_LANGUAGE ; break;
+ case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
+ case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
+ default: DBG_ERROR("GetLanguage: wrong script tye");
+ }
+ return SvxLanguageItem(mpFld->GetLanguage(),nLangWhichId);
+}
+
+bool SwAnnotationWin::IsProtected()
+{
+ return SwSidebarWin::IsProtected() ||
+ GetLayoutStatus() == SwPostItHelper::DELETED ||
+ ( mpFmtFld ? mpFmtFld->IsProtect() : false );
+}
+
+String SwAnnotationWin::GetAuthor()
+{
+ return mpFld->GetPar1();
+}
+
+Date SwAnnotationWin::GetDate()
+{
+ return mpFld->GetDate();
+}
+
+Time SwAnnotationWin::GetTime()
+{
+ return mpFld->GetTime();
+}
+
+} } // end of namespace sw::annotation
diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx
new file mode 100644
index 000000000000..f45d1ee1e78c
--- /dev/null
+++ b/sw/source/ui/docvw/PostItMgr.cxx
@@ -0,0 +1,2045 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include "PostItMgr.hxx"
+#include <postithelper.hxx>
+
+#include <SidebarWin.hxx>
+#include <AnnotationWin.hxx>
+#include <frmsidebarwincontainer.hxx>
+#include <accmap.hxx>
+
+#include <SidebarWindowsConsts.hxx>
+#include <AnchorOverlayObject.hxx>
+#include <ShadowOverlayObject.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/scrbar.hxx>
+#include <vcl/outdev.hxx>
+
+#include <viewopt.hxx>
+
+#include <view.hxx>
+#include <docsh.hxx>
+#include <wrtsh.hxx>
+#include <doc.hxx>
+#include <fldbas.hxx>
+#include <fmtfld.hxx>
+#include <docufld.hxx>
+#include <edtwin.hxx>
+#include <txtfld.hxx>
+#include <ndtxt.hxx>
+#include <redline.hxx>
+#include <docary.hxx>
+#include <SwRewriter.hxx>
+#include <tools/color.hxx>
+
+#include <swmodule.hxx>
+#include <annotation.hrc>
+#include "cmdid.h"
+
+#include <sfx2/request.hxx>
+#include <sfx2/event.hxx>
+#include <svl/srchitem.hxx>
+
+
+#include <svl/languageoptions.hxx>
+#include <svtools/langtab.hxx>
+#include <svl/smplhint.hxx>
+
+#include <svx/svdview.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/outliner.hxx>
+
+#include <i18npool/mslangid.hxx>
+#include <i18npool/lang.h>
+
+#include "swevent.hxx"
+
+// distance between Anchor Y and initial note position
+#define POSTIT_INITIAL_ANCHOR_DISTANCE 20
+//distance between two postits
+#define POSTIT_SPACE_BETWEEN 8
+#define POSTIT_MINIMUMSIZE_WITH_META 60
+#define POSTIT_SCROLL_SIDEBAR_HEIGHT 20
+
+// if we layout more often we stop, this should never happen
+#define MAX_LOOP_COUNT 50
+
+using namespace sw::sidebarwindows;
+
+/*
+bool comp_author( const SwPostItItem* a, const SwPostItItem* b)
+{
+ return a->pFmtFld->GetFld()->GetPar1() < b->pFmtFld->GetFld()->GetPar1();
+}
+
+bool comp_date( const SwPostItItem* a, const SwPostItItem* b)
+{
+ return static_cast<SwPostItField*>(a->pFmtFld->GetFld())->GetDate() < static_cast<SwPostItField*>(b->pFmtFld->GetFld())->GetDate();
+}
+*/
+
+//
+bool comp_pos(const SwSidebarItem* a, const SwSidebarItem* b)
+{
+ // --> OD 2010-01-19 #i88070#
+ // sort by anchor position
+//// if position is on the same line, sort by x (Left) position, otherwise by y(Bottom) position
+//// if two notes are at the same position, sort by logical node position
+// return (a->maLayoutInfo.mPosition.Bottom() == b->maLayoutInfo.mPosition.Bottom())
+// ? ( ( (a->maLayoutInfo.mPosition.Left() == b->maLayoutInfo.mPosition.Left()) &&
+// (a->GetBroadCaster()->ISA(SwFmtFld) && b->GetBroadCaster()->ISA(SwFmtFld)) )
+// ? *(static_cast<SwFmtFld*>(a->GetBroadCaster())->GetTxtFld()->GetStart()) <
+// *(static_cast<SwFmtFld*>(b->GetBroadCaster())->GetTxtFld()->GetStart())
+// : a->maLayoutInfo.mPosition.Left() < b->maLayoutInfo.mPosition.Left() )
+// : a->maLayoutInfo.mPosition.Bottom() < b->maLayoutInfo.mPosition.Bottom();
+ return a->GetAnchorPosition() < b->GetAnchorPosition();
+ // <--
+}
+
+SwPostItMgr::SwPostItMgr(SwView* pView)
+ : mpView(pView)
+ , mpWrtShell(mpView->GetDocShell()->GetWrtShell())
+ , mpEditWin(&mpView->GetEditWin())
+ , mnEventId(0)
+ , mbWaitingForCalcRects(false)
+ , mpActivePostIt(0)
+ , mbLayout(false)
+ , mbLayoutHeight(0)
+ , mbLayouting(false)
+ , mbReadOnly(mpView->GetDocShell()->IsReadOnly())
+ , mbDeleteNote(true)
+ , mpAnswer(0)
+ , mbIsShowAnchor( false )
+ , mpFrmSidebarWinContainer( 0 )
+{
+ if(!mpView->GetDrawView() )
+ mpView->GetWrtShell().MakeDrawView();
+
+ SwNoteProps aProps;
+ mbIsShowAnchor = aProps.IsShowAnchor();
+
+ //make sure we get the colour yellow always, even if not the first one of comments or redlining
+ SW_MOD()->GetRedlineAuthor();
+
+ // collect all PostIts and redline comments that exist after loading the document
+ // don't check for existance for any of them, don't focus them
+ AddPostIts(false,false);
+ /* this code can be used once we want redline comments in the Sidebar
+ AddRedlineComments(false,false);
+ */
+ // we want to receive stuff like SFX_HINT_DOCCHANGED
+ StartListening(*mpView->GetDocShell());
+ if (!mvPostItFlds.empty())
+ {
+ mbWaitingForCalcRects = true;
+ mnEventId = Application::PostUserEvent( LINK( this, SwPostItMgr, CalcHdl), 0 );
+ }
+}
+
+SwPostItMgr::~SwPostItMgr()
+{
+ if ( mnEventId )
+ Application::RemoveUserEvent( mnEventId );
+ // forget about all our Sidebar windows
+ RemoveSidebarWin();
+ EndListening( *mpView->GetDocShell() );
+
+ for(std::vector<SwPostItPageItem*>::iterator i = mPages.begin(); i!= mPages.end() ; i++)
+ delete (*i);
+ mPages.clear();
+
+ delete mpFrmSidebarWinContainer;
+ mpFrmSidebarWinContainer = 0;
+}
+
+void SwPostItMgr::CheckForRemovedPostIts()
+{
+ bool bRemoved = false;
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end(); )
+ {
+ std::list<SwSidebarItem*>::iterator it = i++;
+ if ( !(*it)->UseElement() )
+ {
+ SwSidebarItem* p = (*it);
+ mvPostItFlds.remove(*it);
+ if (GetActiveSidebarWin() == p->pPostIt)
+ SetActiveSidebarWin(0);
+ if (p->pPostIt)
+ delete p->pPostIt;
+ delete p;
+ bRemoved = true;
+ }
+ }
+
+ if ( bRemoved )
+ {
+ // make sure that no deleted items remain in page lists
+ // todo: only remove deleted ones?!
+ if ( mvPostItFlds.empty() )
+ {
+ PreparePageContainer();
+ PrepareView();
+ }
+ else
+ // if postits are their make sure that page lists are not empty
+ // otherwise sudden paints can cause pain (in BorderOverPageBorder)
+ CalcRects();
+ }
+}
+
+void SwPostItMgr::InsertItem(SfxBroadcaster* pItem, bool bCheckExistance, bool bFocus)
+{
+ if (bCheckExistance)
+ {
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ if ( (*i)->GetBroadCaster() == pItem )
+ return;
+ }
+ }
+ mbLayout = bFocus;
+ if (pItem->ISA(SwFmtFld))
+ mvPostItFlds.push_back(new SwAnnotationItem(static_cast<SwFmtFld*>(pItem), true, bFocus) );
+ /*
+ else
+ if (pItem->ISA(SwRedline))
+ mvPostItFlds.push_back(new SwRedCommentItem( static_cast<SwRedline*>(pItem), true, bFocus)) ;
+ */
+ DBG_ASSERT(pItem->ISA(SwFmtFld) /*|| pItem->ISA(SwRedline)*/,"Mgr::InsertItem: seems like new stuff was added");
+ StartListening(*pItem);
+}
+
+void SwPostItMgr::RemoveItem( SfxBroadcaster* pBroadcast )
+{
+ EndListening(*pBroadcast);
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ if ( (*i)->GetBroadCaster() == pBroadcast )
+ {
+ SwSidebarItem* p = (*i);
+ if (GetActiveSidebarWin() == p->pPostIt)
+ SetActiveSidebarWin(0);
+ mvPostItFlds.remove(*i);
+ delete p->pPostIt;
+ delete p;
+ break;
+ }
+ }
+ mbLayout = true;
+ PrepareView();
+}
+
+void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ if ( rHint.IsA(TYPE(SfxEventHint) ) )
+ {
+ sal_uInt32 nId = ((SfxEventHint&)rHint).GetEventId();
+ if ( nId == SW_EVENT_LAYOUT_FINISHED )
+ {
+ if ( !mbWaitingForCalcRects && !mvPostItFlds.empty())
+ {
+ mbWaitingForCalcRects = true;
+ mnEventId = Application::PostUserEvent( LINK( this, SwPostItMgr, CalcHdl), 0 );
+ }
+ }
+ }
+ else if ( rHint.IsA(TYPE(SfxSimpleHint) ) )
+ {
+ sal_uInt32 nId = ((SfxSimpleHint&)rHint).GetId();
+ switch ( nId )
+ {
+ case SFX_HINT_MODECHANGED:
+ {
+ if ( mbReadOnly != !!(mpView->GetDocShell()->IsReadOnly()) )
+ {
+ mbReadOnly = !mbReadOnly;
+ SetReadOnlyState();
+ mbLayout = true;
+ }
+ break;
+ }
+ case SFX_HINT_DOCCHANGED:
+ {
+ if ( mpView->GetDocShell() == &rBC )
+ {
+ if ( !mbWaitingForCalcRects && !mvPostItFlds.empty())
+ {
+ mbWaitingForCalcRects = true;
+ mnEventId = Application::PostUserEvent( LINK( this, SwPostItMgr, CalcHdl), 0 );
+ }
+ }
+ break;
+ }
+ case SFX_HINT_USER04:
+ {
+ // if we are in a SplitNode/Cut operation, do not delete note and then add again, as this will flicker
+ mbDeleteNote = !mbDeleteNote;
+ break;
+ }
+ case SFX_HINT_DYING:
+ {
+ if ( mpView->GetDocShell() != &rBC )
+ {
+ // field to be removed is the broadcaster
+ DBG_ERROR("Notification for removed SwFmtFld was not sent!");
+ RemoveItem(&rBC);
+ }
+ break;
+ }
+ }
+ }
+ /*
+ else if ( rHint.IsA(TYPE(SwRedlineHint) ) )
+ {
+ const SwRedlineHint rRedlineHint = static_cast<const SwRedlineHint&>(rHint);
+ SwRedline* pRedline = const_cast<SwRedline*>(rRedlineHint.GetRedline());
+ switch ( rRedlineHint.Which() )
+ {
+ case SWREDLINE_INSERTED :
+ {
+ bool bEmpty = !HasNotes();
+ InsertItem( pRedline, true, false );
+ if (bEmpty && !mvPostItFlds.empty())
+ PrepareView(true);
+ break;
+ }
+ case SWREDLINE_REMOVED:
+ {
+ RemoveItem(pRedline);
+ break;
+ }
+ case SWREDLINE_FOCUS:
+ {
+ if (rRedlineHint.GetView()== mpView)
+ Focus(rBC);
+ break;
+ }
+ }
+ }
+ */
+ else if ( rHint.IsA(TYPE(SwFmtFldHint) ) )
+ {
+ const SwFmtFldHint& rFmtHint = static_cast<const SwFmtFldHint&>(rHint);
+ SwFmtFld* pFld = const_cast <SwFmtFld*>( rFmtHint.GetField() );
+ switch ( rFmtHint.Which() )
+ {
+ case SWFMTFLD_INSERTED :
+ {
+ if (!pFld)
+ {
+ AddPostIts(true);
+ break;
+ }
+ // get field to be inserted from hint
+ if ( pFld->IsFldInDoc() )
+ {
+ bool bEmpty = !HasNotes();
+ InsertItem( pFld, true, false );
+ if (bEmpty && !mvPostItFlds.empty())
+ PrepareView(true);
+ }
+ else
+ {
+ DBG_ERROR( "Inserted field not in document!" );
+ }
+ break;
+ }
+ case SWFMTFLD_REMOVED:
+ {
+ if (mbDeleteNote)
+ {
+ if (!pFld)
+ {
+ CheckForRemovedPostIts();
+ break;
+ }
+ RemoveItem(pFld);
+ }
+ break;
+ }
+ case SWFMTFLD_FOCUS:
+ {
+ if (rFmtHint.GetView()== mpView)
+ Focus(rBC);
+ break;
+ }
+ case SWFMTFLD_CHANGED:
+ {
+ SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC);
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ if ( pFmtFld == (*i)->GetBroadCaster() )
+ {
+ if ((*i)->pPostIt)
+ {
+ (*i)->pPostIt->SetPostItText();
+ mbLayout = true;
+ }
+ break;
+ }
+ }
+ break;
+ }
+ case SWFMTFLD_LANGUAGE:
+ {
+ SwFmtFld* pFmtFld = dynamic_cast<SwFmtFld*>(&rBC);
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ if ( pFmtFld == (*i)->GetBroadCaster() )
+ {
+ if ((*i)->pPostIt)
+ {
+ USHORT nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( (*i)->GetFmtFld()->GetFld()->GetLanguage() );
+ USHORT nLangWhichId = 0;
+ switch (nScriptType)
+ {
+ case SCRIPTTYPE_LATIN : nLangWhichId = EE_CHAR_LANGUAGE ; break;
+ case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
+ case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
+ }
+ (*i)->pPostIt->SetLanguage( SvxLanguageItem((*i)->GetFmtFld()->GetFld()->GetLanguage(),
+ nLangWhichId) );
+ }
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+}
+
+void SwPostItMgr::Focus(SfxBroadcaster& rBC)
+{
+ if (!mpWrtShell->GetViewOptions()->IsPostIts())
+ {
+ SfxRequest aRequest(mpView->GetViewFrame(),FN_VIEW_NOTES);
+ mpView->ExecViewOptions(aRequest);
+ }
+
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ // field to get the focus is the broadcaster
+ if ( &rBC == (*i)->GetBroadCaster() )
+ {
+ if ((*i)->pPostIt)
+ {
+ (*i)->pPostIt->GrabFocus();
+ MakeVisible((*i)->pPostIt);
+ }
+ else
+ {
+ // when the layout algorithm starts, this postit is created and receives focus
+ (*i)->bFocus = true;
+ }
+ }
+ }
+}
+
+bool SwPostItMgr::CalcRects()
+{
+ if ( mnEventId )
+ {
+ // if CalcRects() was forced and an event is still pending: remove it
+ // it is superfluous and also may cause reentrance problems if triggered while layouting
+ Application::RemoveUserEvent( mnEventId );
+ mnEventId = 0;
+ }
+
+ bool bChange = false;
+ bool bRepair = false;
+ PreparePageContainer();
+ if ( !mvPostItFlds.empty() )
+ {
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ SwSidebarItem* pItem = (*i);
+ if ( !pItem->UseElement() )
+ {
+ DBG_ERROR("PostIt is not in doc or other wrong use");
+ bRepair = true;
+ continue;
+ }
+
+ //save old rect and visible state
+ SwRect aOldRect(pItem->maLayoutInfo.mPosition);
+ SwPostItHelper::SwLayoutStatus eOldStatus = pItem->mLayoutStatus;
+ std::vector< SwLayoutInfo > aInfo;
+ {
+ SwPosition aPosition = pItem->GetAnchorPosition();
+ pItem->mLayoutStatus = SwPostItHelper::getLayoutInfos( aInfo, aPosition );
+ }
+ if( aInfo.size() )
+ {
+ pItem->maLayoutInfo = aInfo[0];
+ }
+ bChange = bChange ||
+ ( pItem->maLayoutInfo.mPosition != aOldRect ) ||
+ ( eOldStatus != pItem->mLayoutStatus );
+ }
+
+ // show notes in right order in navigator
+ //prevent Anchors during layout to overlap, e.g. when moving a frame
+ Sort(SORT_POS);
+
+ // sort the items into the right page vector, so layout can be done by page
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ SwSidebarItem* pItem = (*i);
+ if( SwPostItHelper::INVISIBLE == pItem->mLayoutStatus )
+ {
+ if (pItem->pPostIt)
+ pItem->pPostIt->HideNote();
+ continue;
+ }
+
+ if( SwPostItHelper::HIDDEN == pItem->mLayoutStatus )
+ {
+ if (!mpWrtShell->GetViewOptions()->IsShowHiddenChar())
+ {
+ if (pItem->pPostIt)
+ pItem->pPostIt->HideNote();
+ continue;
+ }
+ }
+
+ const unsigned long aPageNum = pItem->maLayoutInfo.mnPageNumber;
+ if (aPageNum > mPages.size())
+ {
+ const unsigned long nNumberOfPages = mPages.size();
+ for (unsigned int j=0; j<aPageNum - nNumberOfPages; ++j)
+ mPages.push_back( new SwPostItPageItem());
+ }
+ mPages[aPageNum-1]->mList->push_back(pItem);
+ mPages[aPageNum-1]->mPageRect = pItem->maLayoutInfo.mPageFrame;
+ mPages[aPageNum-1]->eSidebarPosition = pItem->maLayoutInfo.meSidebarPosition;
+ }
+
+ if (!bChange && mpWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE))
+ {
+ long nLayoutHeight = SwPostItHelper::getLayoutHeight( mpWrtShell->GetLayout() );
+ if( nLayoutHeight > mbLayoutHeight )
+ {
+ if (mPages[0]->bScrollbar || HasScrollbars())
+ bChange = true;
+ }
+ else if( nLayoutHeight < mbLayoutHeight )
+ {
+ if (mPages[0]->bScrollbar || !BorderOverPageBorder(1))
+ bChange = true;
+ }
+ }
+ }
+
+ if ( bRepair )
+ CheckForRemovedPostIts();
+
+ mbLayoutHeight = SwPostItHelper::getLayoutHeight( mpWrtShell->GetLayout() );
+ mbWaitingForCalcRects = false;
+ return bChange;
+}
+
+bool SwPostItMgr::HasScrollbars() const
+{
+ for(std::list<SwSidebarItem*>::const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ if ((*i)->bShow && (*i)->pPostIt && (*i)->pPostIt->HasScrollbar())
+ return true;
+ }
+ return false;
+}
+
+void SwPostItMgr::PreparePageContainer()
+{
+ // we do not just delete the SwPostItPageItem, so offset/scrollbar is not lost
+ long lPageSize = mpWrtShell->GetNumPages();
+ long lContainerSize = mPages.size();
+
+ if (lContainerSize < lPageSize)
+ {
+ for (int i=0; i<lPageSize - lContainerSize;i++)
+ mPages.push_back( new SwPostItPageItem());
+ }
+ else
+ if (lContainerSize > lPageSize)
+ {
+ for (int i=mPages.size()-1; i >= lPageSize;--i)
+ {
+ delete mPages[i];
+ mPages.pop_back();
+ }
+ }
+ // only clear the list, DO NOT delete the objects itself
+ for(std::vector<SwPostItPageItem*>::iterator i = mPages.begin(); i!= mPages.end() ; i++)
+ {
+ (*i)->mList->clear();
+ if (mvPostItFlds.empty())
+ (*i)->bScrollbar = false;
+
+ }
+}
+
+void SwPostItMgr::LayoutPostIts()
+{
+ if ( !mvPostItFlds.empty() && !mbWaitingForCalcRects )
+ {
+ mbLayouting = true;
+
+ //loop over all pages and do the layout
+ // - create SwPostIt if neccessary
+ // - place SwPostIts on their initial position
+ // - calculate neccessary height for all PostIts together
+ bool bUpdate = false;
+ for (unsigned long n=0;n<mPages.size();n++)
+ {
+ // only layout if there are notes on this page
+ if (mPages[n]->mList->size()>0)
+ {
+ std::list<SwSidebarWin*> aVisiblePostItList;
+ unsigned long lNeededHeight = 0;
+ long mlPageBorder = 0;
+ long mlPageEnd = 0;
+
+ for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
+ {
+ SwSidebarItem* pItem = (*i);
+ SwSidebarWin* pPostIt = pItem->pPostIt;
+
+ if (mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT )
+ {
+ // x value for notes positioning
+ mlPageBorder = mpEditWin->LogicToPixel( Point( mPages[n]->mPageRect.Left(), 0)).X() - GetSidebarWidth(true);// - GetSidebarBorderWidth(true);
+ //bending point
+ mlPageEnd =
+ mpWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE)
+ ? pItem->maLayoutInfo.mPagePrtArea.Left()
+ : mPages[n]->mPageRect.Left() + 350;
+ }
+ else if (mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT )
+ {
+ // x value for notes positioning
+ mlPageBorder = mpEditWin->LogicToPixel( Point(mPages[n]->mPageRect.Right(), 0)).X() + GetSidebarBorderWidth(true);
+ //bending point
+ mlPageEnd =
+ mpWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE)
+ ? pItem->maLayoutInfo.mPagePrtArea.Right() :
+ mPages[n]->mPageRect.Right() - 350;
+ }
+
+ if (pItem->bShow)
+ {
+ long Y = mpEditWin->LogicToPixel( Point(0,pItem->maLayoutInfo.mPosition.Bottom())).Y();
+ long aPostItHeight = 0;
+ if (!pPostIt)
+ {
+ pPostIt = (*i)->GetSidebarWindow( mpView->GetEditWin(),
+ WB_DIALOGCONTROL,
+ *this,
+ 0 );
+ pPostIt->InitControls();
+ pPostIt->SetReadonly(mbReadOnly);
+ pItem->pPostIt = pPostIt;
+ if (mpAnswer)
+ {
+ if (pPostIt->CalcFollow()) //do we really have another note in front of this one
+ static_cast<sw::annotation::SwAnnotationWin*>(pPostIt)->InitAnswer(mpAnswer);
+ delete mpAnswer;
+ mpAnswer = 0;
+ }
+ }
+
+ pPostIt->SetChangeTracking(
+ pItem->mLayoutStatus,
+ GetColorAnchor(pItem->maLayoutInfo.mRedlineAuthor));
+ pPostIt->SetSidebarPosition(mPages[n]->eSidebarPosition);
+ pPostIt->SetFollow(pPostIt->CalcFollow());
+ aPostItHeight = ( pPostIt->GetPostItTextHeight() < pPostIt->GetMinimumSizeWithoutMeta()
+ ? pPostIt->GetMinimumSizeWithoutMeta()
+ : pPostIt->GetPostItTextHeight() )
+ + pPostIt->GetMetaHeight();
+ pPostIt->SetPosSizePixelRect( mlPageBorder ,
+ Y - GetInitialAnchorDistance(),
+ GetNoteWidth() ,
+ aPostItHeight,
+ pItem->maLayoutInfo.mPosition,
+ mlPageEnd );
+ pPostIt->ChangeSidebarItem( *pItem );
+
+ if (pItem->bFocus)
+ {
+ mbLayout = true;
+ pPostIt->GrabFocus();
+ pItem->bFocus = false;
+ }
+ // only the visible postits are used for the final layout
+ aVisiblePostItList.push_back(pPostIt);
+ lNeededHeight += pPostIt->IsFollow() ? aPostItHeight : aPostItHeight+GetSpaceBetween();
+ }
+ else // we don't want to see it
+ {
+ if (pPostIt)
+ pPostIt->HideNote();
+ }
+ }
+
+ if ((aVisiblePostItList.size()>0) && ShowNotes())
+ {
+ bool bOldScrollbar = mPages[n]->bScrollbar;
+ if (ShowNotes())
+ mPages[n]->bScrollbar = LayoutByPage(aVisiblePostItList, mPages[n]->mPageRect.SVRect(), lNeededHeight);
+ else
+ mPages[n]->bScrollbar = false;
+ if (!mPages[n]->bScrollbar)
+ {
+ mPages[n]->lOffset = 0;
+ }
+ else
+ {
+ //when we changed our zoom level, the offset value can be to big, so lets check for the largest possible zoom value
+ long aAvailableHeight = mpEditWin->LogicToPixel(Size(0,mPages[n]->mPageRect.Height())).Height() - 2 * GetSidebarScrollerHeight();
+ long lOffset = -1 * GetScrollSize() * (aVisiblePostItList.size() - aAvailableHeight / GetScrollSize());
+ if (mPages[n]->lOffset < lOffset)
+ mPages[n]->lOffset = lOffset;
+ }
+ bUpdate = (bOldScrollbar != mPages[n]->bScrollbar) || bUpdate;
+ const long aSidebarheight = mPages[n]->bScrollbar ? mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height() : 0;
+ /*
+ TODO
+ - enlarge all notes till GetNextBorder(), as we resized to average value before
+ */
+ //lets hide the ones which overlap the page
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ {
+ if (mPages[n]->lOffset != 0)
+ (*i)->TranslateTopPosition(mPages[n]->lOffset);
+
+ bool bBottom = mpEditWin->PixelToLogic(Point(0,(*i)->VirtualPos().Y()+(*i)->VirtualSize().Height())).Y() <= (mPages[n]->mPageRect.Bottom()-aSidebarheight);
+ bool bTop = mpEditWin->PixelToLogic(Point(0,(*i)->VirtualPos().Y())).Y() >= (mPages[n]->mPageRect.Top()+aSidebarheight);
+ if ( bBottom && bTop )
+ {
+ (*i)->ShowNote();
+ }
+ else
+ {
+ if (mpEditWin->PixelToLogic(Point(0,(*i)->VirtualPos().Y())).Y() < (mPages[n]->mPageRect.Top()+aSidebarheight))
+ {
+ if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT )
+ (*i)->ShowAnchorOnly(Point( mPages[n]->mPageRect.Left(),
+ mPages[n]->mPageRect.Top()));
+ else if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT )
+ (*i)->ShowAnchorOnly(Point( mPages[n]->mPageRect.Right(),
+ mPages[n]->mPageRect.Top()));
+ }
+ else
+ {
+ if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT )
+ (*i)->ShowAnchorOnly(Point(mPages[n]->mPageRect.Left(),
+ mPages[n]->mPageRect.Bottom()));
+ else if ( mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT )
+ (*i)->ShowAnchorOnly(Point(mPages[n]->mPageRect.Right(),
+ mPages[n]->mPageRect.Bottom()));
+ }
+ DBG_ASSERT(mPages[n]->bScrollbar,"SwPostItMgr::LayoutByPage(): note overlaps, but bScrollbar is not true");
+ }
+ }
+
+ // do some magic so we really see the focused note
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ {
+ if ((*i)->HasChildPathFocus())
+ {
+ MakeVisible((*i),n+1);
+ break;
+ }
+ }
+ }
+ else
+ {
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ (*i)->SetPosAndSize();
+
+ bool bOldScrollbar = mPages[n]->bScrollbar;
+ mPages[n]->bScrollbar = false;
+ bUpdate = (bOldScrollbar != mPages[n]->bScrollbar) || bUpdate;
+ }
+ aVisiblePostItList.clear();
+ }
+ else
+ {
+ bUpdate = true;
+ mPages[n]->bScrollbar = false;
+ }
+ }
+
+ if (!ShowNotes())
+ { // we do not want to see the notes anymore -> Options-Writer-View-Notes
+ bool bRepair = false;
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ SwSidebarItem* pItem = (*i);
+ if ( !pItem->UseElement() )
+ {
+ DBG_ERROR("PostIt is not in doc!");
+ bRepair = true;
+ continue;
+ }
+
+ if ((*i)->pPostIt)
+ {
+ (*i)->pPostIt->HideNote();
+ if ((*i)->pPostIt->HasChildPathFocus())
+ {
+ SetActiveSidebarWin(0);
+ (*i)->pPostIt->GrabFocusToDocument();
+ }
+ }
+ }
+
+ if ( bRepair )
+ CheckForRemovedPostIts();
+ }
+
+
+ // notes scrollbar is otherwise not drawn correctly for some cases
+ // scrollbar area is enough
+ if (bUpdate)
+ mpEditWin->Invalidate();
+ mbLayouting = false;
+ }
+}
+
+bool SwPostItMgr::BorderOverPageBorder(unsigned long aPage) const
+{
+ if ( mPages[aPage-1]->mList->empty() )
+ {
+ DBG_ERROR("Notes SidePane painted but no rects and page lists calculated!");
+ return false;
+ }
+
+ SwSidebarItem_iterator aItem = mPages[aPage-1]->mList->end();
+ --aItem;
+ DBG_ASSERT ((*aItem)->pPostIt,"BorderOverPageBorder: NULL postIt, should never happen");
+ if ((*aItem)->pPostIt)
+ {
+ const long aSidebarheight = mPages[aPage-1]->bScrollbar ? mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height() : 0;
+ const long aEndValue = mpEditWin->PixelToLogic(Point(0,(*aItem)->pPostIt->GetPosPixel().Y()+(*aItem)->pPostIt->GetSizePixel().Height())).Y();
+ return aEndValue <= mPages[aPage-1]->mPageRect.Bottom()-aSidebarheight;
+ }
+ else
+ return false;
+}
+
+void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage)
+{
+ DBG_ASSERT((lScroll % GetScrollSize() )==0,"SwPostItMgr::Scroll: scrolling by wrong value");
+ // do not scroll more than neccessary up or down
+ if ( ((mPages[aPage-1]->lOffset == 0) && (lScroll>0)) || ( BorderOverPageBorder(aPage) && (lScroll<0)) )
+ return;
+
+ const bool bOldUp = ArrowEnabled(KEY_PAGEUP,aPage);
+ const bool bOldDown = ArrowEnabled(KEY_PAGEDOWN,aPage);
+ const long aSidebarheight = mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height();
+ for(SwSidebarItem_iterator i = mPages[aPage-1]->mList->begin(); i!= mPages[aPage-1]->mList->end(); i++)
+ {
+ SwSidebarWin* pPostIt = (*i)->pPostIt;
+ // if this is an answer, we should take the normal position and not the real, slightly moved position
+ pPostIt->SetVirtualPosSize(pPostIt->GetPosPixel(),pPostIt->GetSizePixel());
+ pPostIt->TranslateTopPosition(lScroll);
+
+ if ((*i)->bShow)
+ {
+ bool bBottom = mpEditWin->PixelToLogic(Point(0,pPostIt->VirtualPos().Y()+pPostIt->VirtualSize().Height())).Y() <= (mPages[aPage-1]->mPageRect.Bottom()-aSidebarheight);
+ bool bTop = mpEditWin->PixelToLogic(Point(0,pPostIt->VirtualPos().Y())).Y() >= (mPages[aPage-1]->mPageRect.Top()+aSidebarheight);
+ if ( bBottom && bTop)
+ {
+ pPostIt->ShowNote();
+ }
+ else
+ {
+ if ( mpEditWin->PixelToLogic(Point(0,pPostIt->VirtualPos().Y())).Y() < (mPages[aPage-1]->mPageRect.Top()+aSidebarheight))
+ {
+ if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT)
+ pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Left(),mPages[aPage-1]->mPageRect.Top()));
+ else if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT)
+ pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Right(),mPages[aPage-1]->mPageRect.Top()));
+ }
+ else
+ {
+ if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT)
+ pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Left(),mPages[aPage-1]->mPageRect.Bottom()));
+ else if (mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_RIGHT)
+ pPostIt->ShowAnchorOnly(Point(mPages[aPage-1]->mPageRect.Right(),mPages[aPage-1]->mPageRect.Bottom()));
+ }
+ }
+ }
+ }
+ mPages[aPage-1]->lOffset += lScroll;
+ if ( (bOldUp != ArrowEnabled(KEY_PAGEUP,aPage)) ||(bOldDown != ArrowEnabled(KEY_PAGEDOWN,aPage)) )
+ {
+ mpEditWin->Invalidate(GetBottomScrollRect(aPage));
+ mpEditWin->Invalidate(GetTopScrollRect(aPage));
+ }
+}
+
+void SwPostItMgr::AutoScroll(const SwSidebarWin* pPostIt,const unsigned long aPage )
+{
+ // otherwise all notes are visible
+ if (mPages[aPage-1]->bScrollbar)
+ {
+ const long aSidebarheight = mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height();
+ const bool bBottom = mpEditWin->PixelToLogic(Point(0,pPostIt->GetPosPixel().Y()+pPostIt->GetSizePixel().Height())).Y() <= (mPages[aPage-1]->mPageRect.Bottom()-aSidebarheight);
+ const bool bTop = mpEditWin->PixelToLogic(Point(0,pPostIt->GetPosPixel().Y())).Y() >= (mPages[aPage-1]->mPageRect.Top()+aSidebarheight);
+ if ( !(bBottom && bTop))
+ {
+ const long aDiff = bBottom ? mpEditWin->LogicToPixel(Point(0,mPages[aPage-1]->mPageRect.Top() + aSidebarheight)).Y() - pPostIt->GetPosPixel().Y() :
+ mpEditWin->LogicToPixel(Point(0,mPages[aPage-1]->mPageRect.Bottom() - aSidebarheight)).Y() - (pPostIt->GetPosPixel().Y()+pPostIt->GetSizePixel().Height());
+ // this just adds the missing value to get the next a* GetScrollSize() after aDiff
+ // e.g aDiff= 61 POSTIT_SCOLL=50 --> lScroll = 100
+ const long lScroll = bBottom ? (aDiff + ( GetScrollSize() - (aDiff % GetScrollSize()))) : (aDiff - (GetScrollSize() + (aDiff % GetScrollSize())));
+ Scroll(lScroll, aPage);
+ }
+ }
+}
+
+void SwPostItMgr::MakeVisible(const SwSidebarWin* pPostIt,long aPage )
+{
+ if (aPage == -1)
+ {
+ // we dont know the page yet, lets find it ourselves
+ for (unsigned long n=0;n<mPages.size();n++)
+ {
+ if (mPages[n]->mList->size()>0)
+ {
+ for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
+ {
+ if ((*i)->pPostIt==pPostIt)
+ {
+ aPage = n+1;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (aPage!=-1)
+ AutoScroll(pPostIt,aPage);
+ Rectangle aNoteRect (Point(pPostIt->GetPosPixel().X(),pPostIt->GetPosPixel().Y()-5),pPostIt->GetSizePixel());
+ if (!aNoteRect.IsEmpty())
+ mpWrtShell->MakeVisible(SwRect(mpEditWin->PixelToLogic(aNoteRect)));
+}
+
+bool SwPostItMgr::ArrowEnabled(USHORT aDirection,unsigned long aPage) const
+{
+ switch (aDirection)
+ {
+ case KEY_PAGEUP:
+ {
+ return (mPages[aPage-1]->lOffset != 0);
+ }
+ case KEY_PAGEDOWN:
+ {
+ return (!BorderOverPageBorder(aPage));
+ }
+ default: return false;
+ }
+}
+
+Color SwPostItMgr::GetArrowColor(USHORT aDirection,unsigned long aPage) const
+{
+ if (ArrowEnabled(aDirection,aPage))
+ {
+ if (Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ return Color(COL_WHITE);
+ else
+ return COL_NOTES_SIDEPANE_ARROW_ENABLED;
+ }
+ else
+ {
+ return COL_NOTES_SIDEPANE_ARROW_DISABLED;
+ }
+}
+
+bool SwPostItMgr::LayoutByPage(std::list<SwSidebarWin*> &aVisiblePostItList,const Rectangle aBorder, long lNeededHeight)
+{
+ /*** General layout idea:***/
+ // - if we have space left, we always move the current one up,
+ // otherwise the next one down
+ // - first all notes are resized
+ // - then the real layout starts
+ /*************************************************************/
+
+ //rBorder is the page rect
+ const Rectangle rBorder = mpEditWin->LogicToPixel( aBorder);
+ long lTopBorder = rBorder.Top() + 5;
+ long lBottomBorder = rBorder.Bottom() - 5;
+ const long lVisibleHeight = lBottomBorder - lTopBorder; //rBorder.GetHeight() ;
+ long lSpaceUsed = 0;
+ long lTranslatePos = 0;
+ int loop = 0;
+ bool bDone = false;
+ bool bScrollbars = false;
+
+ // do all neccessary resizings
+ if (lVisibleHeight < lNeededHeight)
+ {
+ // ok, now we have to really resize and adding scrollbars
+ const long lAverageHeight = (lVisibleHeight - aVisiblePostItList.size()*GetSpaceBetween()) / aVisiblePostItList.size();
+ if (lAverageHeight<GetMinimumSizeWithMeta())
+ {
+ bScrollbars = true;
+ lTopBorder += GetSidebarScrollerHeight() + 10;
+ lBottomBorder -= (GetSidebarScrollerHeight() + 10);
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ (*i)->SetSize(Size((*i)->VirtualSize().getWidth(),(*i)->GetMinimumSizeWithMeta()));
+ }
+ else
+ {
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ {
+ if ( (*i)->VirtualSize().getHeight() > lAverageHeight)
+ (*i)->SetSize(Size((*i)->VirtualSize().getWidth(),lAverageHeight));
+ }
+ }
+ }
+
+ //start the real layout so nothing overlaps anymore
+ if (aVisiblePostItList.size()>1)
+ {
+ // if no window is moved anymore we are finished
+ while (!bDone)
+ {
+ loop++;
+ bDone = true;
+ lSpaceUsed = lTopBorder + GetSpaceBetween();
+ for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i!= aVisiblePostItList.end() ; i++)
+ {
+ SwSidebarWin_iterator aNextPostIt = i;
+ ++aNextPostIt;
+
+ if (aNextPostIt !=aVisiblePostItList.end())
+ {
+ lTranslatePos = ( (*i)->VirtualPos().Y() + (*i)->VirtualSize().Height()) - (*aNextPostIt)->VirtualPos().Y();
+ if (lTranslatePos > 0) // note windows overlaps the next one
+ {
+ // we are not done yet, loop at least once more
+ bDone = false;
+ // if there is space left, move the current note up
+ // it could also happen that there is no space left for the first note due to a scrollbar
+ // then we also jump into, so we move the current one up and the next one down
+ if ( (lSpaceUsed <= (*i)->VirtualPos().Y()) || (i==aVisiblePostItList.begin()))
+ {
+ // we have space left, so let's move the current one up
+ if ( ((*i)->VirtualPos().Y()- lTranslatePos - GetSpaceBetween()) > lTopBorder)
+ {
+ if ((*aNextPostIt)->IsFollow())
+ (*i)->TranslateTopPosition(-1*(lTranslatePos+ANCHORLINE_WIDTH));
+ else
+ (*i)->TranslateTopPosition(-1*(lTranslatePos+GetSpaceBetween()));
+ }
+ else
+ {
+ long lMoveUp = (*i)->VirtualPos().Y() - lTopBorder;
+ (*i)->TranslateTopPosition(-1* lMoveUp);
+ if ((*aNextPostIt)->IsFollow())
+ (*aNextPostIt)->TranslateTopPosition( (lTranslatePos+ANCHORLINE_WIDTH) - lMoveUp);
+ else
+ (*aNextPostIt)->TranslateTopPosition( (lTranslatePos+GetSpaceBetween()) - lMoveUp);
+ }
+ }
+ else
+ {
+ // no space left, left move the next one down
+ if ((*aNextPostIt)->IsFollow())
+ (*aNextPostIt)->TranslateTopPosition(lTranslatePos+ANCHORLINE_WIDTH);
+ else
+ (*aNextPostIt)->TranslateTopPosition(lTranslatePos+GetSpaceBetween());
+ }
+ }
+ else
+ {
+ // the first one could overlap the topborder instead of a second note
+ if (i==aVisiblePostItList.begin())
+ {
+ long lMoveDown = lTopBorder - (*i)->VirtualPos().Y();
+ if (lMoveDown>0)
+ {
+ bDone = false;
+ (*i)->TranslateTopPosition( lMoveDown);
+ }
+ }
+ }
+ if (aNextPostIt !=aVisiblePostItList.end() && (*aNextPostIt)->IsFollow())
+ lSpaceUsed += (*i)->VirtualSize().Height() + ANCHORLINE_WIDTH;
+ else
+ lSpaceUsed += (*i)->VirtualSize().Height() + GetSpaceBetween();
+ }
+ else
+ {
+ //(*i) is the last visible item
+ SwSidebarWin_iterator aPrevPostIt = i;
+ --aPrevPostIt;
+ //lTranslatePos = ( (*aPrevPostIt)->VirtualPos().Y() + (*aPrevPostIt)->VirtualSize().Height() + GetSpaceBetween() ) - (*i)->VirtualPos().Y();
+ lTranslatePos = ( (*aPrevPostIt)->VirtualPos().Y() + (*aPrevPostIt)->VirtualSize().Height() ) - (*i)->VirtualPos().Y();
+ if (lTranslatePos > 0)
+ {
+ bDone = false;
+ if ( ((*i)->VirtualPos().Y()+ (*i)->VirtualSize().Height()+lTranslatePos) < lBottomBorder)
+ {
+ if ( (*i)->IsFollow() )
+ (*i)->TranslateTopPosition(lTranslatePos+ANCHORLINE_WIDTH);
+ else
+ (*i)->TranslateTopPosition(lTranslatePos+GetSpaceBetween());
+ }
+ else
+ {
+ (*i)->TranslateTopPosition(lBottomBorder - ((*i)->VirtualPos().Y()+ (*i)->VirtualSize().Height()) );
+ }
+ }
+ else
+ {
+ // note does not overlap, but we might be over the lower border
+ // only do this if there are no scrollbars, otherwise notes are supposed to overlap the border
+ if (!bScrollbars && ((*i)->VirtualPos().Y()+ (*i)->VirtualSize().Height() > lBottomBorder) )
+ {
+ bDone = false;
+ (*i)->TranslateTopPosition(lBottomBorder - ((*i)->VirtualPos().Y()+ (*i)->VirtualSize().Height()));
+ }
+ }
+ }
+ }
+ // security check so we don't loop forever
+ if (loop>MAX_LOOP_COUNT)
+ {
+ DBG_ERROR("PostItMgr::Layout(): We are looping forever");
+ break;
+ }
+ }
+ }
+ else
+ {
+ // only one left, make sure it is not hidden at the top or bottom
+ SwSidebarWin_iterator i = aVisiblePostItList.begin();
+ lTranslatePos = lTopBorder - (*i)->VirtualPos().Y();
+ if (lTranslatePos>0)
+ {
+ (*i)->TranslateTopPosition(lTranslatePos+GetSpaceBetween());
+ }
+ lTranslatePos = lBottomBorder - ((*i)->VirtualPos().Y()+ (*i)->VirtualSize().Height());
+ if (lTranslatePos<0)
+ {
+ (*i)->TranslateTopPosition(lTranslatePos);
+ }
+ }
+ return bScrollbars;
+ }
+
+/*
+void SwPostItMgr::AddRedlineComments(bool bCheckExistance, bool bFocus)
+{
+ bool bEmpty = mvPostItFlds.empty();
+ const SwRedlineTbl& aTable = mpView->GetDocShell()->GetDoc()->GetRedlineTbl();
+ for( USHORT i = 0; i < aTable.Count(); ++i )
+ {
+ SwRedline* pRedline = const_cast<SwRedline*>((aTable)[i]);
+ if ( pRedline->GetComment() != String(rtl::OUString::createFromAscii("")) )
+ InsertItem(pRedline, bCheckExistance, bFocus);
+ }
+ if (bEmpty && !mvPostItFlds.empty())
+ PrepareView(true);
+ }
+ */
+
+void SwPostItMgr::AddPostIts(bool bCheckExistance, bool bFocus)
+{
+ bool bEmpty = mvPostItFlds.empty();
+ SwFieldType* pType = mpView->GetDocShell()->GetDoc()->GetFldType(RES_POSTITFLD, aEmptyStr,false);
+ SwClientIter aIter( *pType );
+ SwClient * pFirst = aIter.GoStart();
+ while(pFirst)
+ {
+ SwFmtFld* pSwFmtFld = static_cast<SwFmtFld*>(pFirst);
+ if ( pSwFmtFld->GetTxtFld())
+ {
+ if ( pSwFmtFld->IsFldInDoc() )
+ InsertItem(pSwFmtFld,bCheckExistance,bFocus);
+ }
+ pFirst = aIter++;
+ }
+
+ // if we just added the first one we have to update the view for centering
+ if (bEmpty && !mvPostItFlds.empty())
+ PrepareView(true);
+}
+
+void SwPostItMgr::RemoveSidebarWin()
+{
+ if (!mvPostItFlds.empty())
+ {
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ EndListening( *((*i)->GetBroadCaster()) );
+ if ((*i)->pPostIt)
+ delete (*i)->pPostIt;
+ delete (*i);
+ }
+ mvPostItFlds.clear();
+ }
+
+ // all postits removed, no items should be left in pages
+ PreparePageContainer();
+}
+
+// copy to new vector, otherwise RemoveItem would operate and delete stuff on mvPostItFlds as well
+// RemoveItem will clean up the core field and visible postit if neccessary
+// we cannot just delete everything as before, as postits could move into change tracking
+void SwPostItMgr::Delete(String aAuthor)
+{
+ mpWrtShell->StartAllAction();
+ if ( HasActiveSidebarWin() && (GetActiveSidebarWin()->GetAuthor()==aAuthor) )
+ {
+ SetActiveSidebarWin(0);
+ }
+ SwRewriter aRewriter;
+ String aUndoString = SW_RES(STR_DELETE_AUTHOR_NOTES);
+ aUndoString += aAuthor;
+ aRewriter.AddRule(UNDO_ARG1, aUndoString);
+ mpWrtShell->StartUndo( UNDO_DELETE, &aRewriter );
+
+ std::vector<SwFmtFld*> aTmp;
+ aTmp.reserve( mvPostItFlds.size() );
+ for(std::list<SwSidebarItem*>::iterator pPostIt = mvPostItFlds.begin(); pPostIt!= mvPostItFlds.end() ; pPostIt++)
+ {
+ if ((*pPostIt)->GetFmtFld() && ((*pPostIt)->pPostIt->GetAuthor() == aAuthor) )
+ aTmp.push_back( (*pPostIt)->GetFmtFld() );
+ }
+ for(std::vector<SwFmtFld*>::iterator i = aTmp.begin(); i!= aTmp.end() ; i++)
+ {
+ mpWrtShell->GotoField( *(*i) );
+ mpWrtShell->DelRight();
+ }
+ mpWrtShell->EndUndo();
+ PrepareView();
+ mpWrtShell->EndAllAction();
+ mbLayout = true;
+ CalcRects();
+ LayoutPostIts();
+}
+
+void SwPostItMgr::Delete()
+{
+ mpWrtShell->StartAllAction();
+ SetActiveSidebarWin(0);
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_DELETE_ALL_NOTES) );
+ mpWrtShell->StartUndo( UNDO_DELETE, &aRewriter );
+
+ std::vector<SwFmtFld*> aTmp;
+ aTmp.reserve( mvPostItFlds.size() );
+ for(std::list<SwSidebarItem*>::iterator pPostIt = mvPostItFlds.begin(); pPostIt!= mvPostItFlds.end() ; pPostIt++)
+ {
+ if ((*pPostIt)->GetFmtFld())
+ aTmp.push_back( (*pPostIt)->GetFmtFld() );
+ }
+ for(std::vector<SwFmtFld*>::iterator i = aTmp.begin(); i!= aTmp.end() ; i++)
+ {
+ mpWrtShell->GotoField( *(*i) );
+ mpWrtShell->DelRight();
+ }
+
+/*
+ for(std::list<SwPostItItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ SwPostItItem* pItem = (*i);
+ // stop listening, we delete ourselves
+ EndListening( *(pItem->pFmtFld) );
+ // delete the actual SwPostItField
+ mpWrtShell->GotoField(*pItem->pFmtFld);
+ mpWrtShell->DelRight();
+ // delete visual representation
+ delete pItem->pPostIt;
+ // delete struct saving the pointers
+ delete pItem;
+ }
+ mvPostItFlds.clear();
+*/
+
+ mpWrtShell->EndUndo();
+ PrepareView();
+ mpWrtShell->EndAllAction();
+ mbLayout = true;
+ CalcRects();
+ LayoutPostIts();
+}
+#if 0
+void SwPostItMgr::Hide(SwPostItField* pPostItField )
+{
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ if ((*i)->GetFmtFld())
+ {
+ SwPostItField* pField = static_cast<SwPostItField*>((*i)->GetFmtFld()->GetFld());
+ if (pPostItField==pField)
+ {
+ (*i)->bShow = false;
+ (*i)->pPostIt->HideNote();
+ break;
+ }
+ }
+ }
+
+ LayoutPostIts();
+}
+#endif
+void SwPostItMgr::Hide( const String& rAuthor )
+{
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ if ( (*i)->pPostIt && ((*i)->pPostIt->GetAuthor() == rAuthor) )
+ {
+ (*i)->bShow = false;
+ (*i)->pPostIt->HideNote();
+ }
+ }
+
+ LayoutPostIts();
+}
+
+void SwPostItMgr::Hide()
+{
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ (*i)->bShow = false;
+ (*i)->pPostIt->HideNote();
+ }
+}
+
+
+void SwPostItMgr::Show()
+{
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ (*i)->bShow = true;
+ }
+ LayoutPostIts();
+}
+
+void SwPostItMgr::Sort(const short aType)
+{
+ if (mvPostItFlds.size()>1 )
+ {
+ switch (aType)
+ {
+ case SORT_POS:
+ mvPostItFlds.sort(comp_pos);
+ break;
+ /*
+ case SORT_AUTHOR:
+ mvPostItFlds.sort(comp_author);
+ break;
+ case SORT_DATE:
+ mvPostItFlds.sort(comp_date);
+ break;
+ */
+ }
+ }
+}
+
+SwSidebarWin* SwPostItMgr::GetSidebarWin( const SfxBroadcaster* pBroadcaster) const
+{
+ for(const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ if ( (*i)->GetBroadCaster() == pBroadcaster)
+ return (*i)->pPostIt;
+ }
+ return NULL;
+}
+
+sw::annotation::SwAnnotationWin* SwPostItMgr::GetAnnotationWin(const SwPostItField* pFld) const
+{
+ for(const_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ if ( (*i)->GetFmtFld() && ((*i)->GetFmtFld()->GetFld() == pFld))
+ return dynamic_cast<sw::annotation::SwAnnotationWin*>((*i)->pPostIt);
+ }
+ return NULL;
+}
+
+SwSidebarWin* SwPostItMgr::GetNextPostIt( USHORT aDirection,
+ SwSidebarWin* aPostIt )
+{
+ if (mvPostItFlds.size()>1)
+ {
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ if ( (*i)->pPostIt ==aPostIt)
+ {
+ SwSidebarItem_iterator iNextPostIt = i;
+ if (aDirection==KEY_PAGEUP)
+ {
+ if ( iNextPostIt==mvPostItFlds.begin() )
+ {
+ return NULL;
+ }
+ --iNextPostIt;
+ }
+ else
+ {
+ iNextPostIt++;
+ if ( iNextPostIt==mvPostItFlds.end() )
+ {
+ return NULL;
+ }
+ }
+ // lets quit, we are back at the beginng
+ if ( (*iNextPostIt)->pPostIt==aPostIt)
+ return NULL;
+ return (*iNextPostIt)->pPostIt;
+ }
+ }
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+long SwPostItMgr::GetNextBorder()
+{
+ for (unsigned long n=0;n<mPages.size();n++)
+ {
+ for(SwSidebarItem_iterator b = mPages[n]->mList->begin(); b!= mPages[n]->mList->end(); b++)
+ {
+ if ((*b)->pPostIt == mpActivePostIt)
+ {
+ SwSidebarItem_iterator aNext = b;
+ aNext++;
+ bool bFollow = (aNext == mPages[n]->mList->end()) ? false : (*aNext)->pPostIt->IsFollow();
+ if ( mPages[n]->bScrollbar || bFollow )
+ {
+ return -1;
+ }
+ else
+ {
+ //if this is the last item, return the bottom border otherwise the next item
+ if (aNext == mPages[n]->mList->end())
+ return mpEditWin->LogicToPixel(Point(0,mPages[n]->mPageRect.Bottom())).Y() - GetSpaceBetween();
+ else
+ return (*aNext)->pPostIt->GetPosPixel().Y() - GetSpaceBetween();
+ }
+ }
+ }
+ }
+
+ DBG_ERROR("SwPostItMgr::GetNextBorder(): We have to find a next border here");
+ return -1;
+}
+
+void SwPostItMgr::SetShadowState(const SwPostItField* pFld,bool bCursor)
+{
+ if (pFld)
+ {
+ if (pFld !=mShadowState.mpShadowFld)
+ {
+ if (mShadowState.mpShadowFld)
+ {
+ // reset old one if still alive
+ // TODO: does not work properly if mouse and cursor was set
+ sw::annotation::SwAnnotationWin* pOldPostIt =
+ GetAnnotationWin(mShadowState.mpShadowFld);
+ if (pOldPostIt && pOldPostIt->Shadow() && (pOldPostIt->Shadow()->GetShadowState() != SS_EDIT))
+ pOldPostIt->SetViewState(VS_NORMAL);
+ }
+ //set new one, if it is not currently edited
+ sw::annotation::SwAnnotationWin* pNewPostIt = GetAnnotationWin(pFld);
+ if (pNewPostIt && pNewPostIt->Shadow() && (pNewPostIt->Shadow()->GetShadowState() != SS_EDIT))
+ {
+ pNewPostIt->SetViewState(VS_VIEW);
+ //remember our new field
+ mShadowState.mpShadowFld = pFld;
+ mShadowState.bCursor = false;
+ mShadowState.bMouse = false;
+ }
+ }
+ if (bCursor)
+ mShadowState.bCursor = true;
+ else
+ mShadowState.bMouse = true;
+ }
+ else
+ {
+ if (mShadowState.mpShadowFld)
+ {
+ if (bCursor)
+ mShadowState.bCursor = false;
+ else
+ mShadowState.bMouse = false;
+ if (!mShadowState.bCursor && !mShadowState.bMouse)
+ {
+ // reset old one if still alive
+ sw::annotation::SwAnnotationWin* pOldPostIt = GetAnnotationWin(mShadowState.mpShadowFld);
+ if (pOldPostIt && pOldPostIt->Shadow() && (pOldPostIt->Shadow()->GetShadowState() != SS_EDIT))
+ {
+ pOldPostIt->SetViewState(VS_NORMAL);
+ mShadowState.mpShadowFld = 0;
+ }
+ }
+ }
+ }
+}
+
+void SwPostItMgr::PrepareView(bool bIgnoreCount)
+{
+ if (!HasNotes() || bIgnoreCount)
+ {
+ mpWrtShell->StartAllAction();
+ //mpEditWin->Invalidate(); // really not needed anymore??
+ SwRootFrm* pLayout = mpWrtShell->GetLayout();
+ if ( pLayout )
+ SwPostItHelper::setSidebarChanged( pLayout,
+ mpWrtShell->getIDocumentSettingAccess()->get( IDocumentSettingAccess::BROWSE_MODE ) );
+ mpWrtShell->EndAllAction();
+ }
+}
+
+bool SwPostItMgr::ShowScrollbar(const unsigned long aPage) const
+{
+ if (mPages.size() > aPage-1)
+ return (mPages[aPage-1]->bScrollbar && !mbWaitingForCalcRects);
+ else
+ return false;
+}
+
+bool SwPostItMgr::IsHit(const Point &aPointPixel)
+{
+ if (HasNotes() && ShowNotes())
+ {
+ const Point aPoint = mpEditWin->PixelToLogic(aPointPixel);
+ const SwRootFrm* pLayout = mpWrtShell->GetLayout();
+ SwRect aPageFrm;
+ const unsigned long nPageNum = SwPostItHelper::getPageInfo( aPageFrm, pLayout, aPoint );
+ if( nPageNum )
+ {
+ Rectangle aRect;
+ DBG_ASSERT(mPages.size()>nPageNum-1,"SwPostitMgr:: page container size wrong");
+ aRect = mPages[nPageNum-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Rectangle(Point(aPageFrm.Left()-GetSidebarWidth()-GetSidebarBorderWidth(),aPageFrm.Top()),Size(GetSidebarWidth(),aPageFrm.Height()))
+ : Rectangle( Point(aPageFrm.Right()+GetSidebarBorderWidth(),aPageFrm.Top()) , Size(GetSidebarWidth(),aPageFrm.Height()));
+ if (aRect.IsInside(aPoint))
+ {
+ // we hit the note's sidebar
+ // lets now test for the arrow area
+ if (mPages[nPageNum-1]->bScrollbar)
+ return ScrollbarHit(nPageNum,aPoint);
+ else
+ return false;
+ }
+ }
+ }
+ return false;
+}
+Rectangle SwPostItMgr::GetBottomScrollRect(const unsigned long aPage) const
+{
+ SwRect aPageRect = mPages[aPage-1]->mPageRect;
+ Point aPointBottom = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Point(aPageRect.Left() - GetSidebarWidth() - GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height())
+ : Point(aPageRect.Right() + GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height());
+ Size aSize(GetSidebarWidth() - mpEditWin->PixelToLogic(Size(4,0)).Width(), mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height()) ;
+ return Rectangle(aPointBottom,aSize);
+
+}
+
+Rectangle SwPostItMgr::GetTopScrollRect(const unsigned long aPage) const
+{
+ SwRect aPageRect = mPages[aPage-1]->mPageRect;
+ Point aPointTop = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Point(aPageRect.Left() - GetSidebarWidth() -GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height())
+ : Point(aPageRect.Right() + GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height());
+ Size aSize(GetSidebarWidth() - mpEditWin->PixelToLogic(Size(4,0)).Width(), mpEditWin->PixelToLogic(Size(0,GetSidebarScrollerHeight())).Height()) ;
+ return Rectangle(aPointTop,aSize);
+}
+
+
+//IMPORTANT: if you change the rects here, also change SwPageFrm::PaintNotesSidebar()
+bool SwPostItMgr::ScrollbarHit(const unsigned long aPage,const Point &aPoint)
+{
+ SwRect aPageRect = mPages[aPage-1]->mPageRect;
+ Point aPointBottom = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Point(aPageRect.Left() - GetSidebarWidth()-GetSidebarBorderWidth() + mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height())
+ : Point(aPageRect.Right() + GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Bottom()- mpEditWin->PixelToLogic(Size(0,2+GetSidebarScrollerHeight())).Height());
+
+ Point aPointTop = mPages[aPage-1]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? Point(aPageRect.Left() - GetSidebarWidth()-GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height())
+ : Point(aPageRect.Right()+GetSidebarBorderWidth()+ mpEditWin->PixelToLogic(Size(2,0)).Width(),aPageRect.Top() + mpEditWin->PixelToLogic(Size(0,2)).Height());
+
+ Rectangle aRectBottom(GetBottomScrollRect(aPage));
+ Rectangle aRectTop(GetTopScrollRect(aPage));
+
+ if (aRectBottom.IsInside(aPoint))
+ {
+ if (aPoint.X() < long((aPointBottom.X() + GetSidebarWidth()/3)))
+ Scroll( GetScrollSize(),aPage);
+ else
+ Scroll( -1*GetScrollSize(), aPage);
+ return true;
+ }
+ else
+ if (aRectTop.IsInside(aPoint))
+ {
+ if (aPoint.X() < long((aPointTop.X() + GetSidebarWidth()/3*2)))
+ Scroll(GetScrollSize(), aPage);
+ else
+ Scroll(-1*GetScrollSize(), aPage);
+ return true;
+ }
+ return false;
+}
+
+void SwPostItMgr::CorrectPositions()
+{
+ if ( mbWaitingForCalcRects || mbLayouting || mvPostItFlds.empty() )
+ return;
+
+ // find first valid note
+ SwSidebarWin *pFirstPostIt = 0;
+ for(SwSidebarItem_iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ {
+ pFirstPostIt = (*i)->pPostIt;
+ if (pFirstPostIt)
+ break;
+ }
+
+ //if we have not found a valid note, forget about it and leave
+ if (!pFirstPostIt)
+ return;
+
+ // yeah, I know, if this is a left page it could be wrong, but finding the page and the note is probably not even faster than just doing it
+ // --> OD 2010-06-03 #i111964# - check, if anchor overlay object exists.
+ const long aAnchorX = pFirstPostIt->Anchor()
+ ? mpEditWin->LogicToPixel( Point((long)(pFirstPostIt->Anchor()->GetSixthPosition().getX()),0)).X()
+ : 0;
+ const long aAnchorY = pFirstPostIt->Anchor()
+ ? mpEditWin->LogicToPixel( Point(0,(long)(pFirstPostIt->Anchor()->GetSixthPosition().getY()))).Y() + 1
+ : 0;
+ // <--
+ if (Point(aAnchorX,aAnchorY) != pFirstPostIt->GetPosPixel())
+ {
+ long aAnchorPosX = 0;
+ long aAnchorPosY = 0;
+ for (unsigned long n=0;n<mPages.size();n++)
+ {
+ for(SwSidebarItem_iterator i = mPages[n]->mList->begin(); i!= mPages[n]->mList->end(); i++)
+ {
+ // --> OD 2010-06-03 #i111964# - check, if anchor overlay object exists.
+ if ( (*i)->bShow && (*i)->pPostIt && (*i)->pPostIt->Anchor() )
+ // <--
+ {
+ aAnchorPosX = mPages[n]->eSidebarPosition == sw::sidebarwindows::SIDEBAR_LEFT
+ ? mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSeventhPosition().getX()),0)).X()
+ : mpEditWin->LogicToPixel( Point((long)((*i)->pPostIt->Anchor()->GetSixthPosition().getX()),0)).X();
+ aAnchorPosY = mpEditWin->LogicToPixel( Point(0,(long)((*i)->pPostIt->Anchor()->GetSixthPosition().getY()))).Y() + 1;
+ (*i)->pPostIt->SetPosPixel(Point(aAnchorPosX,aAnchorPosY));
+ }
+ }
+ }
+ }
+}
+
+
+bool SwPostItMgr::ShowNotes() const
+{
+ // we only want to see notes if Options - Writer - View - Notes is ticked
+ return mpWrtShell->GetViewOptions()->IsPostIts();
+}
+
+bool SwPostItMgr::HasNotes() const
+{
+ return !mvPostItFlds.empty();
+}
+
+unsigned long SwPostItMgr::GetSidebarWidth(bool bPx) const
+{
+ unsigned long aWidth = (unsigned long)(mpWrtShell->GetViewOptions()->GetZoom() * 1.8);
+ if (bPx)
+ return aWidth;
+ else
+ return mpEditWin->PixelToLogic(Size( aWidth ,0)).Width();
+}
+
+unsigned long SwPostItMgr::GetSidebarBorderWidth(bool bPx) const
+{
+ if (bPx)
+ return 2;
+ else
+ return mpEditWin->PixelToLogic(Size(2,0)).Width();
+}
+
+unsigned long SwPostItMgr::GetNoteWidth()
+{
+ return GetSidebarWidth(true);
+}
+
+Color SwPostItMgr::GetColorDark(sal_uInt16 aAuthorIndex)
+{
+ if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ static const Color aArrayNormal[] = {
+ COL_AUTHOR1_NORMAL, COL_AUTHOR2_NORMAL, COL_AUTHOR3_NORMAL,
+ COL_AUTHOR4_NORMAL, COL_AUTHOR5_NORMAL, COL_AUTHOR6_NORMAL,
+ COL_AUTHOR7_NORMAL, COL_AUTHOR8_NORMAL, COL_AUTHOR9_NORMAL };
+
+ return Color( aArrayNormal[ aAuthorIndex % (sizeof( aArrayNormal )/ sizeof( aArrayNormal[0] ))]);
+ }
+ else
+ return Color(COL_WHITE);
+}
+
+Color SwPostItMgr::GetColorLight(sal_uInt16 aAuthorIndex)
+{
+ if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ static const Color aArrayLight[] = {
+ COL_AUTHOR1_LIGHT, COL_AUTHOR2_LIGHT, COL_AUTHOR3_LIGHT,
+ COL_AUTHOR4_LIGHT, COL_AUTHOR5_LIGHT, COL_AUTHOR6_LIGHT,
+ COL_AUTHOR7_LIGHT, COL_AUTHOR8_LIGHT, COL_AUTHOR9_LIGHT };
+
+ return Color( aArrayLight[ aAuthorIndex % (sizeof( aArrayLight )/ sizeof( aArrayLight[0] ))]);
+ }
+ else
+ return Color(COL_WHITE);
+}
+
+Color SwPostItMgr::GetColorAnchor(sal_uInt16 aAuthorIndex)
+{
+ if (!Application::GetSettings().GetStyleSettings().GetHighContrastMode())
+ {
+ static const Color aArrayAnchor[] = {
+ COL_AUTHOR1_DARK, COL_AUTHOR2_DARK, COL_AUTHOR3_DARK,
+ COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK,
+ COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK };
+
+ return Color( aArrayAnchor[ aAuthorIndex % (sizeof( aArrayAnchor ) / sizeof( aArrayAnchor[0] ))]);
+ }
+ else
+ return Color(COL_WHITE);
+}
+
+void SwPostItMgr::SetActiveSidebarWin( SwSidebarWin* p)
+{
+ if ( p != mpActivePostIt )
+ {
+ // we need the temp variable so we can set mpActivePostIt before we call DeactivatePostIt
+ // therefore we get a new layout in DOCCHANGED when switching from postit to document,
+ // otherwise, GetActivePostIt() would still hold our old postit
+ SwSidebarWin* pActive = mpActivePostIt;
+ mpActivePostIt = p;
+ if (pActive)
+ {
+ pActive->DeactivatePostIt();
+ mShadowState.mpShadowFld = 0;
+ }
+ if (mpActivePostIt)
+ {
+ mpActivePostIt->GotoPos();
+ mpView->AttrChangedNotify(0);
+ mpActivePostIt->ActivatePostIt();
+ }
+ }
+}
+
+IMPL_LINK( SwPostItMgr, CalcHdl, void*, /* pVoid*/ )
+{
+ mnEventId = 0;
+ if ( mbLayouting )
+ {
+ DBG_ERROR("Reentrance problem in Layout Manager!");
+ mbWaitingForCalcRects = false;
+ return 0;
+ }
+
+ // do not change order, even if it would seem so in the first place, we need the calcrects always
+ if (CalcRects() || mbLayout)
+ {
+ mbLayout = false;
+ LayoutPostIts();
+ }
+ return 0;
+}
+
+void SwPostItMgr::Rescale()
+{
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ if ( (*i)->pPostIt )
+ (*i)->pPostIt->Rescale();
+}
+
+sal_Int32 SwPostItMgr::GetInitialAnchorDistance() const
+{
+ const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
+ return POSTIT_INITIAL_ANCHOR_DISTANCE * f.GetNumerator() / f.GetDenominator();
+}
+
+sal_Int32 SwPostItMgr::GetSpaceBetween() const
+{
+ const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
+ return ( POSTIT_SPACE_BETWEEN ) * f.GetNumerator() / f.GetDenominator();
+}
+
+sal_Int32 SwPostItMgr::GetScrollSize() const
+{
+ const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
+ return ( POSTIT_SPACE_BETWEEN + POSTIT_MINIMUMSIZE_WITH_META ) * f.GetNumerator() / f.GetDenominator();
+}
+
+sal_Int32 SwPostItMgr::GetMinimumSizeWithMeta() const
+{
+ const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
+ return POSTIT_MINIMUMSIZE_WITH_META * f.GetNumerator() / f.GetDenominator();
+}
+
+sal_Int32 SwPostItMgr::GetSidebarScrollerHeight() const
+{
+ const Fraction& f( mpEditWin->GetMapMode().GetScaleY() );
+ return POSTIT_SCROLL_SIDEBAR_HEIGHT * f.GetNumerator() / f.GetDenominator();
+}
+
+void SwPostItMgr::SetSpellChecking()
+{
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ if ( (*i)->pPostIt )
+ (*i)->pPostIt->SetSpellChecking();
+}
+
+void SwPostItMgr::SetReadOnlyState()
+{
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ if ( (*i)->pPostIt )
+ (*i)->pPostIt->SetReadonly( mbReadOnly );
+}
+
+void SwPostItMgr::CheckMetaText()
+{
+ for(std::list<SwSidebarItem*>::iterator i = mvPostItFlds.begin(); i!= mvPostItFlds.end() ; i++)
+ if ( (*i)->pPostIt )
+ (*i)->pPostIt->CheckMetaText();
+
+}
+
+sal_uInt16 SwPostItMgr::Replace(SvxSearchItem* pItem)
+{
+ SwSidebarWin* pWin = GetActiveSidebarWin();
+ sal_uInt16 aResult = pWin->GetOutlinerView()->StartSearchAndReplace( *pItem );
+ if (!aResult)
+ SetActiveSidebarWin(0);
+ return aResult;
+}
+
+sal_uInt16 SwPostItMgr::FinishSearchReplace(const ::com::sun::star::util::SearchOptions& rSearchOptions, bool bSrchForward)
+{
+ SwSidebarWin* pWin = GetActiveSidebarWin();
+ SvxSearchItem aItem(SID_SEARCH_ITEM );
+ aItem.SetSearchOptions(rSearchOptions);
+ aItem.SetBackward(!bSrchForward);
+ sal_uInt16 aResult = pWin->GetOutlinerView()->StartSearchAndReplace( aItem );
+ if (!aResult)
+ SetActiveSidebarWin(0);
+ return aResult;
+}
+
+sal_uInt16 SwPostItMgr::SearchReplace(const SwFmtFld &pFld, const ::com::sun::star::util::SearchOptions& rSearchOptions, bool bSrchForward)
+{
+ sal_uInt16 aResult = 0;
+ SwSidebarWin* pWin = GetSidebarWin(&pFld);
+ if (pWin)
+ {
+ ESelection aOldSelection = pWin->GetOutlinerView()->GetSelection();
+ if (bSrchForward)
+ pWin->GetOutlinerView()->SetSelection(ESelection(0,0,0,0));
+ else
+ pWin->GetOutlinerView()->SetSelection(ESelection(0xFFFF,0xFFFF,0xFFFF,0xFFFF));
+ SvxSearchItem aItem(SID_SEARCH_ITEM );
+ aItem.SetSearchOptions(rSearchOptions);
+ aItem.SetBackward(!bSrchForward);
+ aResult = pWin->GetOutlinerView()->StartSearchAndReplace( aItem );
+ if (!aResult)
+ pWin->GetOutlinerView()->SetSelection(aOldSelection);
+ else
+ {
+ SetActiveSidebarWin(pWin);
+ MakeVisible(pWin);
+ }
+ }
+ return aResult;
+}
+
+void SwPostItMgr::AssureStdModeAtShell()
+{
+ //#i103373# #i103645#
+ // deselect any drawing or frame and leave editing mode
+ SdrView* pSdrView = mpWrtShell->GetDrawView();
+ if ( pSdrView && pSdrView->IsTextEdit() )
+ {
+ sal_Bool bLockView = mpWrtShell->IsViewLocked();
+ mpWrtShell->LockView( sal_True );
+ mpWrtShell->EndTextEdit();
+ mpWrtShell->LockView( bLockView );
+ }
+
+ if( mpWrtShell->IsSelFrmMode() || mpWrtShell->IsObjSelected())
+ {
+ mpWrtShell->UnSelectFrm();
+ mpWrtShell->LeaveSelFrmMode();
+ mpWrtShell->GetView().LeaveDrawCreate();
+ mpWrtShell->EnterStdMode();
+
+ mpWrtShell->DrawSelChanged();
+ mpView->StopShellTimer();
+ }
+}
+
+bool SwPostItMgr::HasActiveSidebarWin() const
+{
+ return mpActivePostIt != 0;
+}
+
+bool SwPostItMgr::HasActiveAnnotationWin() const
+{
+ return HasActiveSidebarWin() &&
+ dynamic_cast<sw::annotation::SwAnnotationWin*>(mpActivePostIt) != 0;
+}
+
+void SwPostItMgr::GrabFocusOnActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->GrabFocus();
+ }
+}
+
+void SwPostItMgr::UpdateDataOnActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->UpdateData();
+ }
+}
+
+void SwPostItMgr::DeleteActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->Delete();
+ }
+}
+
+void SwPostItMgr::HideActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->Hide();
+ }
+}
+
+void SwPostItMgr::ToggleInsModeOnActiveSidebarWin()
+{
+ if ( HasActiveSidebarWin() )
+ {
+ mpActivePostIt->ToggleInsMode();
+ }
+}
+
+void SwPostItMgr::ConnectSidebarWinToFrm( const SwFrm& rFrm,
+ const SwFmtFld& rFmtFld,
+ SwSidebarWin& rSidebarWin )
+{
+ if ( mpFrmSidebarWinContainer == 0 )
+ {
+ mpFrmSidebarWinContainer = new SwFrmSidebarWinContainer();
+ }
+
+ const bool bInserted = mpFrmSidebarWinContainer->insert( rFrm, rFmtFld, rSidebarWin );
+ if ( bInserted &&
+ mpWrtShell->GetAccessibleMap() )
+ {
+ mpWrtShell->GetAccessibleMap()->InvalidatePosOrSize( 0, 0, &rSidebarWin, SwRect() );
+ }
+}
+
+void SwPostItMgr::DisconnectSidebarWinFromFrm( const SwFrm& rFrm,
+ SwSidebarWin& rSidebarWin )
+{
+ if ( mpFrmSidebarWinContainer != 0 )
+ {
+ const bool bRemoved = mpFrmSidebarWinContainer->remove( rFrm, rSidebarWin );
+ if ( bRemoved &&
+ mpWrtShell->GetAccessibleMap() )
+ {
+ mpWrtShell->GetAccessibleMap()->Dispose( 0, 0, &rSidebarWin );
+ }
+ }
+}
+
+bool SwPostItMgr::HasFrmConnectedSidebarWins( const SwFrm& rFrm )
+{
+ bool bRet( false );
+
+ if ( mpFrmSidebarWinContainer != 0 )
+ {
+ bRet = !mpFrmSidebarWinContainer->empty( rFrm );
+ }
+
+ return bRet;
+}
+
+Window* SwPostItMgr::GetSidebarWinForFrmByIndex( const SwFrm& rFrm,
+ const sal_Int32 nIndex )
+{
+ Window* pSidebarWin( 0 );
+
+ if ( mpFrmSidebarWinContainer != 0 )
+ {
+ pSidebarWin = mpFrmSidebarWinContainer->get( rFrm, nIndex );
+ }
+
+ return pSidebarWin;
+}
+
+void SwPostItMgr::GetAllSidebarWinForFrm( const SwFrm& rFrm,
+ std::vector< Window* >* pChildren )
+{
+ if ( mpFrmSidebarWinContainer != 0 )
+ {
+ mpFrmSidebarWinContainer->getAll( rFrm, pChildren );
+ }
+}
+
+void SwNoteProps::Commit() {}
+void SwNoteProps::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
diff --git a/sw/source/ui/docvw/ShadowOverlayObject.cxx b/sw/source/ui/docvw/ShadowOverlayObject.cxx
new file mode 100644
index 000000000000..b11fc914b5fd
--- /dev/null
+++ b/sw/source/ui/docvw/ShadowOverlayObject.cxx
@@ -0,0 +1,268 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: postit.cxx,v $
+ * $Revision: 1.8.42.11 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <ShadowOverlayObject.hxx>
+
+#include <view.hxx>
+#include <svx/sdrpaintwindow.hxx>
+#include <svx/svdview.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+
+#include <sw_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
+
+namespace sw { namespace sidebarwindows {
+
+//////////////////////////////////////////////////////////////////////////////
+// helper SwPostItShadowPrimitive
+//
+// Used to allow view-dependent primitive definition. For that purpose, the
+// initially created primitive (this one) always has to be view-independent,
+// but the decomposition is made view-dependent. Very simple primitive which
+// just remembers the discrete data and applies it at decomposition time.
+
+class ShadowPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D
+{
+private:
+ basegfx::B2DPoint maBasePosition;
+ basegfx::B2DPoint maSecondPosition;
+ ShadowState maShadowState;
+
+protected:
+ virtual drawinglayer::primitive2d::Primitive2DSequence create2DDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation) const;
+
+public:
+ ShadowPrimitive(
+ const basegfx::B2DPoint& rBasePosition,
+ const basegfx::B2DPoint& rSecondPosition,
+ ShadowState aShadowState)
+ : drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D(),
+ maBasePosition(rBasePosition),
+ maSecondPosition(rSecondPosition),
+ maShadowState(aShadowState)
+ {}
+
+ // data access
+ const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
+ const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; }
+ ShadowState getShadowState() const { return maShadowState; }
+
+ virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const;
+
+ DeclPrimitrive2DIDBlock()
+};
+
+drawinglayer::primitive2d::Primitive2DSequence ShadowPrimitive::create2DDecomposition(
+ const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const
+{
+ // get logic sizes in object coordinate system
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ basegfx::B2DRange aRange(getBasePosition());
+
+ switch(maShadowState)
+ {
+ case SS_NORMAL:
+ {
+ aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (2.0 * getDiscreteUnit())));
+ const ::drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
+ drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
+ 0.0,
+ 0.5,
+ 0.5,
+ 1800.0 * F_PI1800,
+ basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
+ basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
+ 2);
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ aRange,
+ aFillGradientAttribute));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ break;
+ }
+ case SS_VIEW:
+ {
+ aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit())));
+ const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
+ drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
+ 0.0,
+ 0.5,
+ 0.5,
+ 1800.0 * F_PI1800,
+ basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
+ basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
+ 4);
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ aRange,
+ aFillGradientAttribute));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ break;
+ }
+ case SS_EDIT:
+ {
+ aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit())));
+ const drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
+ drawinglayer::attribute::GRADIENTSTYLE_LINEAR,
+ 0.0,
+ 0.5,
+ 0.5,
+ 1800.0 * F_PI1800,
+ basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
+ basegfx::BColor(83.0/255.0,83.0/255.0,83.0/255.0),
+ 4);
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ new drawinglayer::primitive2d::FillGradientPrimitive2D(
+ aRange,
+ aFillGradientAttribute));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ return xRetval;
+}
+
+bool ShadowPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const
+{
+ if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
+ {
+ const ShadowPrimitive& rCompare = static_cast< const ShadowPrimitive& >(rPrimitive);
+
+ return (getBasePosition() == rCompare.getBasePosition()
+ && getSecondPosition() == rCompare.getSecondPosition()
+ && getShadowState() == rCompare.getShadowState());
+ }
+
+ return false;
+}
+
+ImplPrimitrive2DIDBlock(ShadowPrimitive, PRIMITIVE2D_ID_SWSIDEBARSHADOWPRIMITIVE)
+
+/****** ShadowOverlayObject **************************************************/
+/* static */ ShadowOverlayObject* ShadowOverlayObject::CreateShadowOverlayObject( SwView& rDocView )
+{
+ ShadowOverlayObject* pShadowOverlayObject( 0 );
+
+ if ( rDocView.GetDrawView() )
+ {
+ SdrPaintWindow* pPaintWindow = rDocView.GetDrawView()->GetPaintWindow(0);
+ if( pPaintWindow )
+ {
+ sdr::overlay::OverlayManager* pOverlayManager = pPaintWindow->GetOverlayManager();
+
+ if ( pOverlayManager )
+ {
+ pShadowOverlayObject = new ShadowOverlayObject( basegfx::B2DPoint(0,0),
+ basegfx::B2DPoint(0,0),
+ Color(0,0,0),
+ SS_NORMAL );
+ pOverlayManager->add(*pShadowOverlayObject);
+ }
+ }
+ }
+
+ return pShadowOverlayObject;
+}
+
+/* static */ void ShadowOverlayObject::DestroyShadowOverlayObject( ShadowOverlayObject* pShadow )
+{
+ if ( pShadow )
+ {
+ if ( pShadow->getOverlayManager() )
+ {
+ pShadow->getOverlayManager()->remove(*pShadow);
+ }
+ delete pShadow;
+ }
+}
+
+ShadowOverlayObject::ShadowOverlayObject( const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPosition,
+ Color aBaseColor,
+ ShadowState aState )
+ : OverlayObjectWithBasePosition(rBasePos, aBaseColor)
+ , maSecondPosition(rSecondPosition)
+ , mShadowState(aState)
+{
+}
+
+ShadowOverlayObject::~ShadowOverlayObject()
+{
+}
+
+drawinglayer::primitive2d::Primitive2DSequence ShadowOverlayObject::createOverlayObjectPrimitive2DSequence()
+{
+ const drawinglayer::primitive2d::Primitive2DReference aReference(
+ new ShadowPrimitive( getBasePosition(),
+ GetSecondPosition(),
+ GetShadowState() ) );
+ return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
+}
+
+void ShadowOverlayObject::SetShadowState(ShadowState aState)
+{
+ if (mShadowState != aState)
+ {
+ mShadowState = aState;
+
+ objectChange();
+ }
+}
+
+void ShadowOverlayObject::SetPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2)
+{
+ if(!rPoint1.equal(getBasePosition()) || !rPoint2.equal(GetSecondPosition()))
+ {
+ maBasePosition = rPoint1;
+ maSecondPosition = rPoint2;
+
+ objectChange();
+ }
+}
+
+} } // end of namespace sw::sidebarwindows
+
diff --git a/sw/source/ui/docvw/ShadowOverlayObject.hxx b/sw/source/ui/docvw/ShadowOverlayObject.hxx
new file mode 100644
index 000000000000..a00aea380fdb
--- /dev/null
+++ b/sw/source/ui/docvw/ShadowOverlayObject.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SHADOWOVERLAYOBJECT_HXX
+#define _SHADOWOVERLAYOBJECT_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+
+class SwView;
+
+namespace sw { namespace sidebarwindows {
+
+enum ShadowState
+{
+ SS_NORMAL,
+ SS_VIEW,
+ SS_EDIT
+};
+
+class ShadowOverlayObject: public sdr::overlay::OverlayObjectWithBasePosition
+{
+ protected:
+ // geometry creation for OverlayObject
+ virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+ private:
+ basegfx::B2DPoint maSecondPosition;
+ ShadowState mShadowState;
+
+ ShadowOverlayObject( const basegfx::B2DPoint& rBasePos,
+ const basegfx::B2DPoint& rSecondPosition,
+ Color aBaseColor,
+ ShadowState aState );
+ virtual ~ShadowOverlayObject();
+
+ public:
+ void SetShadowState(ShadowState aState);
+ inline ShadowState GetShadowState() {return mShadowState;}
+
+ inline const basegfx::B2DPoint& GetSecondPosition() const { return maSecondPosition; }
+ void SetSecondPosition( const basegfx::B2DPoint& rNew );
+
+ void SetPosition( const basegfx::B2DPoint& rPoint1,
+ const basegfx::B2DPoint& rPoint2 );
+
+ static ShadowOverlayObject* CreateShadowOverlayObject( SwView& rDocView );
+ static void DestroyShadowOverlayObject( ShadowOverlayObject* pShadow );
+};
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/docvw/SidebarTxtControl.cxx b/sw/source/ui/docvw/SidebarTxtControl.cxx
new file mode 100644
index 000000000000..bd645324ee13
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarTxtControl.cxx
@@ -0,0 +1,427 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <SidebarTxtControl.hxx>
+
+#include <SidebarTxtControlAcc.hxx>
+
+#include <SidebarWin.hxx>
+#include <PostItMgr.hxx>
+
+#include <cmdid.h>
+#include <docvw.hrc>
+
+#include <unotools/securityoptions.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/mnumgr.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/help.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/gradient.hxx>
+#include <vcl/scrbar.hxx>
+
+#include <editeng/outliner.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editview.hxx>
+#include <editeng/flditem.hxx>
+
+#include <uitool.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <shellres.hxx>
+#include <SwRewriter.hxx>
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace sidebarwindows {
+
+SidebarTxtControl::SidebarTxtControl( SwSidebarWin& rSidebarWin,
+ WinBits nBits,
+ SwView& rDocView,
+ SwPostItMgr& rPostItMgr )
+ : Control( &rSidebarWin, nBits )
+ , mrSidebarWin( rSidebarWin )
+ , mrDocView( rDocView )
+ , mrPostItMgr( rPostItMgr )
+ , mbMouseOver( false )
+{
+ AddEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) );
+}
+
+SidebarTxtControl::~SidebarTxtControl()
+{
+ RemoveEventListener( LINK( &mrSidebarWin, SwSidebarWin, WindowEventListener ) );
+}
+
+OutlinerView* SidebarTxtControl::GetTextView() const
+{
+ return mrSidebarWin.GetOutlinerView();
+}
+
+void SidebarTxtControl::GetFocus()
+{
+ Window::GetFocus();
+ if ( !mrSidebarWin.IsMouseOver() )
+ {
+ Invalidate();
+ }
+}
+
+void SidebarTxtControl::LoseFocus()
+{
+ // write the visible text back into the SwField
+ mrSidebarWin.UpdateData();
+
+ Window::LoseFocus();
+ if ( !mrSidebarWin.IsMouseOver() )
+ {
+ Invalidate();
+ }
+}
+
+void SidebarTxtControl::RequestHelp(const HelpEvent &rEvt)
+{
+ USHORT nResId = 0;
+ switch( mrSidebarWin.GetLayoutStatus() )
+ {
+ case SwPostItHelper::INSERTED: nResId = STR_REDLINE_INSERT; break;
+ case SwPostItHelper::DELETED: nResId = STR_REDLINE_DELETE; break;
+ default: nResId = 0;
+ }
+
+ SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE );
+ if ( nResId &&
+ mrDocView.GetWrtShell().GetContentAtPos( mrSidebarWin.GetAnchorPos(), aCntntAtPos ) )
+ {
+ String sTxt;
+ sTxt = SW_RESSTR( nResId );
+ sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM(": " ));
+ sTxt += aCntntAtPos.aFnd.pRedl->GetAuthorString();
+ sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " ));
+ sTxt += GetAppLangDateTimeString( aCntntAtPos.aFnd.pRedl->GetTimeStamp() );
+ Help::ShowQuickHelp( this,PixelToLogic(Rectangle(rEvt.GetMousePosPixel(),Size(50,10))),sTxt);
+ }
+}
+
+void SidebarTxtControl::Paint( const Rectangle& rRect)
+{
+ if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ if ( mrSidebarWin.IsMouseOverSidebarWin() ||
+ HasFocus() )
+ {
+ DrawGradient( Rectangle( Point(0,0), PixelToLogic(GetSizePixel()) ),
+ Gradient( GRADIENT_LINEAR,
+ mrSidebarWin.ColorDark(),
+ mrSidebarWin.ColorDark() ) );
+ }
+ else
+ {
+ DrawGradient( Rectangle( Point(0,0), PixelToLogic(GetSizePixel()) ),
+ Gradient( GRADIENT_LINEAR,
+ mrSidebarWin.ColorLight(),
+ mrSidebarWin.ColorDark()));
+ }
+ }
+
+ if ( GetTextView() )
+ {
+ GetTextView()->Paint( rRect );
+ }
+
+ if ( mrSidebarWin.GetLayoutStatus()==SwPostItHelper::DELETED )
+ {
+ SetLineColor(mrSidebarWin.GetChangeColor());
+ DrawLine( PixelToLogic( GetPosPixel() ),
+ PixelToLogic( GetPosPixel() +
+ Point( GetSizePixel().Width(),
+ GetSizePixel().Height() ) ) );
+ DrawLine( PixelToLogic( GetPosPixel() +
+ Point( GetSizePixel().Width(),0) ),
+ PixelToLogic( GetPosPixel() +
+ Point( 0, GetSizePixel().Height() ) ) );
+ }
+}
+
+void SidebarTxtControl::KeyInput( const KeyEvent& rKeyEvt )
+{
+ const KeyCode& rKeyCode = rKeyEvt.GetKeyCode();
+ USHORT nKey = rKeyCode.GetCode();
+ if ( ( rKeyCode.IsMod1() && rKeyCode.IsMod2() ) &&
+ ( (nKey == KEY_PAGEUP) || (nKey == KEY_PAGEDOWN) ) )
+ {
+ mrSidebarWin.SwitchToPostIt(nKey);
+ }
+ else if ( nKey == KEY_ESCAPE ||
+ ( rKeyCode.IsMod1() &&
+ ( nKey == KEY_PAGEUP ||
+ nKey == KEY_PAGEDOWN ) ) )
+ {
+ mrSidebarWin.SwitchToFieldPos();
+ }
+ else if ( nKey == KEY_INSERT )
+ {
+ if ( !rKeyCode.IsMod1() && !rKeyCode.IsMod2() )
+ {
+ mrSidebarWin.ToggleInsMode();
+ }
+ }
+ else
+ {
+ //let's make sure we see our note
+ mrPostItMgr.MakeVisible(&mrSidebarWin);
+
+ long aOldHeight = mrSidebarWin.GetPostItTextHeight();
+ bool bDone = false;
+
+ /// HACK: need to switch off processing of Undo/Redo in Outliner
+ if ( !( (nKey == KEY_Z || nKey == KEY_Y) && rKeyCode.IsMod1()) )
+ {
+ bool bIsProtected = mrSidebarWin.IsProtected();
+ if ( !bIsProtected ||
+ ( bIsProtected &&
+ !mrSidebarWin.GetOutlinerView()->GetOutliner()->GetEditEngine().DoesKeyChangeText(rKeyEvt)) )
+ {
+ bDone = GetTextView() && GetTextView()->PostKeyEvent( rKeyEvt );
+ }
+ else
+ {
+ InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute();
+ }
+ }
+ if (bDone)
+ mrSidebarWin.ResizeIfNeccessary( aOldHeight, mrSidebarWin.GetPostItTextHeight() );
+ else
+ {
+ // write back data first when showing navigator
+ if ( nKey==KEY_F5 )
+ mrSidebarWin.UpdateData();
+ if (!mrDocView.KeyInput(rKeyEvt))
+ Window::KeyInput(rKeyEvt);
+ }
+ }
+
+ mrDocView.GetViewFrame()->GetBindings().InvalidateAll(FALSE);
+}
+
+void SidebarTxtControl::MouseMove( const MouseEvent& rMEvt )
+{
+ if ( GetTextView() )
+ {
+ OutlinerView* pOutlinerView( GetTextView() );
+ pOutlinerView->MouseMove( rMEvt );
+ // mba: why does OutlinerView not handle the modifier setting?!
+ // this forces the postit to handle *all* pointer types
+ SetPointer( pOutlinerView->GetPointer( rMEvt.GetPosPixel() ) );
+
+ const EditView& aEV = pOutlinerView->GetEditView();
+ const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer();
+ if ( pItem )
+ {
+ const SvxFieldData* pFld = pItem->GetField();
+ const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld );
+ if ( pURL )
+ {
+ String sURL( pURL->GetURL() );
+ SvtSecurityOptions aSecOpts;
+ if ( aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK) )
+ {
+ sURL.InsertAscii( ": ", 0 );
+ sURL.Insert( ViewShell::GetShellRes()->aHyperlinkClick, 0 );
+ }
+ Help::ShowQuickHelp( this,PixelToLogic(Rectangle(GetPosPixel(),Size(50,10))),sURL);
+ }
+ }
+ }
+}
+
+void SidebarTxtControl::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if ( GetTextView() )
+ {
+ SvtSecurityOptions aSecOpts;
+ bool bExecuteMod = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK);
+
+ if ( !bExecuteMod || (bExecuteMod && rMEvt.GetModifier() == KEY_MOD1))
+ {
+ const EditView& aEV = GetTextView()->GetEditView();
+ const SvxFieldItem* pItem = aEV.GetFieldUnderMousePointer();
+ if ( pItem )
+ {
+ const SvxFieldData* pFld = pItem->GetField();
+ const SvxURLField* pURL = PTR_CAST( SvxURLField, pFld );
+ if ( pURL )
+ {
+ GetTextView()->MouseButtonDown( rMEvt );
+ SwWrtShell &rSh = mrDocView.GetWrtShell();
+ String sURL( pURL->GetURL() );
+ String sTarget( pURL->GetTargetFrame() );
+ ::LoadURL( sURL, &rSh, URLLOAD_NOFILTER, &sTarget);
+ return;
+ }
+ }
+ }
+ }
+
+ GrabFocus();
+ if ( GetTextView() )
+ {
+ GetTextView()->MouseButtonDown( rMEvt );
+ }
+ mrDocView.GetViewFrame()->GetBindings().InvalidateAll(FALSE);
+}
+
+void SidebarTxtControl::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ if ( GetTextView() )
+ GetTextView()->MouseButtonUp( rMEvt );
+}
+
+IMPL_LINK( SidebarTxtControl, OnlineSpellCallback, SpellCallbackInfo*, pInfo )
+{
+ if ( pInfo->nCommand == SPELLCMD_STARTSPELLDLG )
+ {
+ mrDocView.GetViewFrame()->GetDispatcher()->Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON);
+ }
+ return 0;
+}
+
+IMPL_LINK( SidebarTxtControl, Select, Menu*, pSelMenu )
+{
+ mrSidebarWin.ExecuteCommand( pSelMenu->GetCurItemId() );
+ return 0;
+}
+
+void SidebarTxtControl::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ {
+ if ( !mrSidebarWin.IsProtected() &&
+ GetTextView() &&
+ GetTextView()->IsWrongSpelledWordAtPos( rCEvt.GetMousePosPixel(),TRUE ))
+ {
+ Link aLink = LINK(this, SidebarTxtControl, OnlineSpellCallback);
+ GetTextView()->ExecuteSpellPopup(rCEvt.GetMousePosPixel(),&aLink);
+ }
+ else
+ {
+ SfxPopupMenuManager* pMgr = mrDocView.GetViewFrame()->GetDispatcher()->Popup(0, this,&rCEvt.GetMousePosPixel());
+ ((PopupMenu*)pMgr->GetSVMenu())->SetSelectHdl( LINK(this, SidebarTxtControl, Select) );
+
+ {
+ XubString aText = ((PopupMenu*)pMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR );
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, mrSidebarWin.GetAuthor());
+ aText = aRewriter.Apply(aText);
+ ((PopupMenu*)pMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
+ }
+
+ Point aPos;
+ if (rCEvt.IsMouseEvent())
+ aPos = rCEvt.GetMousePosPixel();
+ else
+ {
+ const Size aSize = GetSizePixel();
+ aPos = Point( aSize.getWidth()/2, aSize.getHeight()/2 );
+ }
+
+ //!! call different Execute function to get rid of the new thesaurus sub menu
+ //!! pointer created in the call to Popup.
+ //!! Otherwise we would have a memory leak (see also #i107205#)
+ //((PopupMenu*)pMgr->GetSVMenu())->Execute( this, aPos );
+ pMgr->Execute( aPos, this );
+ delete pMgr;
+ }
+ }
+ else
+ if (rCEvt.GetCommand() == COMMAND_WHEEL)
+ {
+ if (mrSidebarWin.IsScrollbarVisible())
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if (pData->IsShift() || pData->IsMod1() || pData->IsMod2())
+ {
+ mrDocView.HandleWheelCommands(rCEvt);
+ }
+ else
+ {
+ HandleScrollCommand( rCEvt, 0 , mrSidebarWin.Scrollbar());
+ }
+ }
+ else
+ {
+ mrDocView.HandleWheelCommands(rCEvt);
+ }
+ }
+ else
+ {
+ if ( GetTextView() )
+ GetTextView()->Command( rCEvt );
+ else
+ Window::Command(rCEvt);
+ }
+}
+
+XubString SidebarTxtControl::GetSurroundingText() const
+{
+ if( GetTextView() )
+ return GetTextView()->GetSurroundingText();
+ else
+ return XubString::EmptyString();
+}
+
+Selection SidebarTxtControl::GetSurroundingTextSelection() const
+{
+ if( GetTextView() )
+ return GetTextView()->GetSurroundingTextSelection();
+ else
+ return Selection( 0, 0 );
+}
+
+css::uno::Reference< css::accessibility::XAccessible > SidebarTxtControl::CreateAccessible()
+{
+
+ SidebarTxtControlAccessible* pAcc( new SidebarTxtControlAccessible( *this ) );
+ css::uno::Reference< css::awt::XWindowPeer > xWinPeer( pAcc );
+ SetWindowPeer( xWinPeer, pAcc );
+
+ css::uno::Reference< css::accessibility::XAccessible > xAcc( xWinPeer, css::uno::UNO_QUERY );
+ return xAcc;
+}
+
+} } // end of namespace sw::sidebarwindows
+
diff --git a/sw/source/ui/docvw/SidebarTxtControl.hxx b/sw/source/ui/docvw/SidebarTxtControl.hxx
new file mode 100644
index 000000000000..08a5de0003c4
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarTxtControl.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SIDEBARTXTCONTROL_HXX
+#define _SIDEBARTXTCONTROL_HXX
+
+#include <vcl/ctrl.hxx>
+
+class OutlinerView;
+class SwView;
+class SwPostItMgr;
+class SpellCallbackInfo;
+
+namespace sw { namespace sidebarwindows {
+
+class SwSidebarWin;
+
+class SidebarTxtControl : public Control
+{
+ private:
+ SwSidebarWin& mrSidebarWin;
+ SwView& mrDocView;
+ SwPostItMgr& mrPostItMgr;
+
+ bool mbMouseOver;
+
+ protected:
+ virtual void Paint( const Rectangle& rRect);
+ virtual void KeyInput( const KeyEvent& rKeyEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void LoseFocus();
+ virtual void RequestHelp(const HelpEvent &rEvt);
+ virtual XubString GetSurroundingText() const;
+ virtual Selection GetSurroundingTextSelection() const;
+
+ DECL_LINK( Select, Menu* );
+
+ public:
+ SidebarTxtControl( SwSidebarWin& rSidebarWin,
+ WinBits nBits,
+ SwView& rDocView,
+ SwPostItMgr& rPostItMgr );
+ ~SidebarTxtControl();
+
+ virtual void GetFocus();
+
+ OutlinerView* GetTextView() const;
+
+ DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+};
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/docvw/SidebarTxtControlAcc.cxx b/sw/source/ui/docvw/SidebarTxtControlAcc.cxx
new file mode 100644
index 000000000000..bd613fc7c031
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarTxtControlAcc.cxx
@@ -0,0 +1,317 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <SidebarTxtControlAcc.hxx>
+
+#include <SidebarTxtControl.hxx>
+
+#include <svl/brdcst.hxx>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <editeng/unoedsrc.hxx>
+#include <editeng/unoforou.hxx>
+#include <editeng/unoviwou.hxx>
+#include <editeng/unoedhlp.hxx>
+#include <svx/AccessibleTextHelper.hxx>
+#include <editeng/outliner.hxx>
+
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace sidebarwindows {
+
+// =============================================================================
+// declaration and implementation of <SvxEditSource>
+// for <::accessibiliy::AccessibleTextHelper> instance
+// =============================================================================
+class SidebarTextEditSource : public SvxEditSource,
+ public SfxBroadcaster
+{
+ public:
+ SidebarTextEditSource( SidebarTxtControl& rSidebarTxtControl );
+ virtual ~SidebarTextEditSource();
+
+ virtual SvxEditSource* Clone() const;
+
+ virtual SvxTextForwarder* GetTextForwarder();
+ virtual SvxViewForwarder* GetViewForwarder();
+ virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
+
+ virtual void UpdateData();
+
+ virtual SfxBroadcaster& GetBroadcaster() const;
+ DECL_LINK( NotifyHdl, EENotify* );
+
+ private:
+ SidebarTxtControl& mrSidebarTxtControl;
+ SvxOutlinerForwarder mTextForwarder;
+ SvxDrawOutlinerViewForwarder mViewForwarder;
+};
+
+SidebarTextEditSource::SidebarTextEditSource( SidebarTxtControl& rSidebarTxtControl )
+ : SvxEditSource()
+ , mrSidebarTxtControl( rSidebarTxtControl )
+ , mTextForwarder( *(rSidebarTxtControl.GetTextView()->GetOutliner()), FALSE )
+ , mViewForwarder( *(rSidebarTxtControl.GetTextView()) )
+{
+ if ( mrSidebarTxtControl.GetTextView() )
+ {
+ mrSidebarTxtControl.GetTextView()->GetOutliner()->SetNotifyHdl( LINK(this, SidebarTextEditSource, NotifyHdl) );
+ }
+}
+
+SidebarTextEditSource::~SidebarTextEditSource()
+{
+ if ( mrSidebarTxtControl.GetTextView() )
+ {
+ mrSidebarTxtControl.GetTextView()->GetOutliner()->SetNotifyHdl( Link() );
+ }
+}
+
+SvxEditSource* SidebarTextEditSource::Clone() const
+{
+ return new SidebarTextEditSource( mrSidebarTxtControl );
+}
+
+SvxTextForwarder* SidebarTextEditSource::GetTextForwarder()
+{
+ return &mTextForwarder;
+}
+
+SvxViewForwarder* SidebarTextEditSource::GetViewForwarder()
+{
+ return &mViewForwarder;
+}
+
+SvxEditViewForwarder* SidebarTextEditSource::GetEditViewForwarder( sal_Bool /*bCreate*/ )
+{
+ return &mViewForwarder;
+}
+
+void SidebarTextEditSource::UpdateData()
+{
+ // nothing to do
+}
+
+SfxBroadcaster& SidebarTextEditSource::GetBroadcaster() const
+{
+ return *( const_cast< SidebarTextEditSource* > (this) );
+}
+
+IMPL_LINK(SidebarTextEditSource, NotifyHdl, EENotify*, pNotify)
+{
+ if ( pNotify )
+ {
+ ::std::auto_ptr< SfxHint > aHint( SvxEditSourceHelper::EENotification2Hint( pNotify ) );
+
+ if( aHint.get() )
+ {
+ Broadcast( *aHint.get() );
+ }
+ }
+
+ return 0;
+}
+
+
+// =============================================================================
+// declaration and implementation of accessible context for <SidebarTxtControl> instance
+// =============================================================================
+class SidebarTxtControlAccessibleContext : public VCLXAccessibleComponent
+{
+ public:
+ explicit SidebarTxtControlAccessibleContext( SidebarTxtControl& rSidebarTxtControl );
+ virtual ~SidebarTxtControlAccessibleContext();
+
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 i )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ using WeakAggComponentImplHelperBase::addEventListener;
+ using WeakAggComponentImplHelperBase::removeEventListener;
+
+ virtual void SAL_CALL
+ addEventListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL
+ removeEventListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+
+ private:
+ SidebarTxtControl& mrSidebarTxtControl;
+ ::accessibility::AccessibleTextHelper* mpAccessibleTextHelper;
+
+ ::vos::OMutex maMutex;
+
+ void defunc();
+};
+
+SidebarTxtControlAccessibleContext::SidebarTxtControlAccessibleContext( SidebarTxtControl& rSidebarTxtControl )
+ : VCLXAccessibleComponent( rSidebarTxtControl.GetWindowPeer() )
+ , mrSidebarTxtControl( rSidebarTxtControl )
+ , mpAccessibleTextHelper( 0 )
+ , maMutex()
+{
+ ::std::auto_ptr<SvxEditSource> pEditSource(
+ new SidebarTextEditSource( mrSidebarTxtControl ) );
+ mpAccessibleTextHelper = new ::accessibility::AccessibleTextHelper( pEditSource );
+ mpAccessibleTextHelper->SetEventSource( mrSidebarTxtControl.GetWindowPeer() );
+}
+
+SidebarTxtControlAccessibleContext::~SidebarTxtControlAccessibleContext()
+{
+ defunc();
+}
+
+void SidebarTxtControlAccessibleContext::defunc()
+{
+ delete mpAccessibleTextHelper;
+ mpAccessibleTextHelper = 0;
+}
+
+sal_Int32 SAL_CALL SidebarTxtControlAccessibleContext::getAccessibleChildCount()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aGuard( maMutex );
+
+ sal_Int32 nChildCount( 0 );
+
+ if ( mpAccessibleTextHelper )
+ {
+ nChildCount = mpAccessibleTextHelper->GetChildCount();
+ }
+
+ return nChildCount;
+}
+
+css::uno::Reference< css::accessibility::XAccessible > SAL_CALL SidebarTxtControlAccessibleContext::getAccessibleChild( sal_Int32 i )
+ throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException )
+{
+ vos::OGuard aGuard( maMutex );
+
+ css::uno::Reference< css::accessibility::XAccessible > xChild;
+
+ if ( mpAccessibleTextHelper )
+ {
+ xChild = mpAccessibleTextHelper->GetChild( i );
+ }
+
+ return xChild;
+}
+
+void SAL_CALL SidebarTxtControlAccessibleContext::addEventListener (
+ const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener)
+ throw (css::uno::RuntimeException)
+{
+ vos::OGuard aGuard( maMutex );
+
+ if ( mpAccessibleTextHelper )
+ {
+ mpAccessibleTextHelper->AddEventListener(xListener);
+ }
+}
+
+void SAL_CALL SidebarTxtControlAccessibleContext::removeEventListener (
+ const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener)
+ throw (css::uno::RuntimeException)
+{
+ vos::OGuard aGuard( maMutex );
+
+ if ( mpAccessibleTextHelper )
+ {
+ mpAccessibleTextHelper->RemoveEventListener(xListener);
+ }
+}
+
+void SidebarTxtControlAccessibleContext::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ if ( mpAccessibleTextHelper )
+ {
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_OBJECT_DYING:
+ {
+ defunc();
+ }
+ break;
+ case VCLEVENT_WINDOW_GETFOCUS:
+ case VCLEVENT_CONTROL_GETFOCUS:
+ {
+ mpAccessibleTextHelper->SetFocus( sal_True );
+ }
+ break;
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ case VCLEVENT_CONTROL_LOSEFOCUS:
+ {
+ mpAccessibleTextHelper->SetFocus( sal_False );
+ }
+ break;
+ }
+ }
+
+ VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+}
+
+// =============================================================================
+// implementaion of accessible for <SidebarTxtControl> instance
+// =============================================================================
+SidebarTxtControlAccessible::SidebarTxtControlAccessible( SidebarTxtControl& rSidebarTxtControl )
+ : VCLXWindow()
+ , mrSidebarTxtControl( rSidebarTxtControl )
+{
+ SetWindow( &mrSidebarTxtControl );
+}
+
+SidebarTxtControlAccessible::~SidebarTxtControlAccessible()
+{
+}
+
+css::uno::Reference< css::accessibility::XAccessibleContext > SidebarTxtControlAccessible::CreateAccessibleContext()
+{
+ SidebarTxtControlAccessibleContext* pAccContext(
+ new SidebarTxtControlAccessibleContext( mrSidebarTxtControl ) );
+ css::uno::Reference< css::accessibility::XAccessibleContext > xAcc( pAccContext );
+ return xAcc;
+}
+
+} } // end of namespace sw::sidebarwindows
+
diff --git a/sw/source/ui/docvw/SidebarTxtControlAcc.hxx b/sw/source/ui/docvw/SidebarTxtControlAcc.hxx
new file mode 100644
index 000000000000..57edc50512d5
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarTxtControlAcc.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SIDEBARTXTCONTROLACC_HXX
+#define _SIDEBARTXTCONTROLACC_HXX
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+namespace sw { namespace sidebarwindows {
+
+class SidebarTxtControl;
+
+class SidebarTxtControlAccessible : public VCLXWindow
+{
+ public:
+ explicit SidebarTxtControlAccessible( SidebarTxtControl& rSidebarTxtControl );
+ virtual ~SidebarTxtControlAccessible();
+
+ virtual com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessibleContext >
+ CreateAccessibleContext();
+
+ private:
+ SidebarTxtControl& mrSidebarTxtControl;
+};
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/docvw/SidebarWin.cxx b/sw/source/ui/docvw/SidebarWin.cxx
new file mode 100644
index 000000000000..413ffaef4333
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarWin.cxx
@@ -0,0 +1,1392 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sw.hxx"
+
+#include <SidebarWin.hxx>
+#include <SidebarWinAcc.hxx>
+#include <PostItMgr.hxx>
+
+#include <SidebarTxtControl.hxx>
+#include <AnchorOverlayObject.hxx>
+#include <ShadowOverlayObject.hxx>
+
+#include <annotation.hrc>
+#include <popup.hrc>
+#include <docvw.hrc>
+#include <app.hrc>
+#include <access.hrc>
+
+#include <viewopt.hxx>
+#include <cmdid.h>
+
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/editview.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/eeitem.hxx>
+
+#include <svl/zforlist.hxx>
+#include <svl/undo.hxx>
+#include <svl/stritem.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <vcl/scrbar.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/menubtn.hxx>
+
+#include <edtwin.hxx>
+#include <view.hxx>
+#include <docsh.hxx>
+#include <wrtsh.hxx>
+#include <doc.hxx>
+#include <swmodule.hxx>
+#include <langhelper.hxx>
+
+#include <sw_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace sidebarwindows {
+
+#define METABUTTON_WIDTH 16
+#define METABUTTON_HEIGHT 18
+#define METABUTTON_AREA_WIDTH 30
+#define POSTIT_META_HEIGHT (sal_Int32) 30
+#define POSTIT_MINIMUMSIZE_WITHOUT_META 50
+
+#define POSTIT_SHADOW_BRIGHT Color(180,180,180)
+#define POSTIT_SHADOW_DARK Color(83,83,83)
+
+#define EMPTYSTRING rtl::OUString::createFromAscii("")
+
+/************** SwSidebarWin************************************/
+SwSidebarWin::SwSidebarWin( SwEditWin& rEditWin,
+ WinBits nBits,
+ SwPostItMgr& aMgr,
+ SwPostItBits aBits,
+ SwSidebarItem& rSidebarItem )
+ : Window(&rEditWin, nBits)
+ , mrMgr(aMgr)
+ , mrView( rEditWin.GetView() )
+ , nFlags(aBits)
+ , mnEventId(0)
+ , mpOutlinerView(0)
+ , mpOutliner(0)
+ , mpSidebarTxtControl(0)
+ , mpVScrollbar(0)
+ , mpMetadataAuthor(0)
+ , mpMetadataDate(0)
+ , mpMenuButton(0)
+ , mpAnchor(0)
+ , mpShadow(0)
+ , mColorAnchor()
+ , mColorDark()
+ , mColorLight()
+ , mChangeColor()
+ , meSidebarPosition( sw::sidebarwindows::SIDEBAR_NONE )
+ , mPosSize()
+ , mAnchorRect()
+ , mPageBorder( 0 )
+ , mbMouseOver( false )
+ , mLayoutStatus( SwPostItHelper::INVISIBLE )
+ , mbReadonly( false )
+ , mbIsFollow( false )
+ , mrSidebarItem( rSidebarItem )
+ , mpAnchorFrm( rSidebarItem.maLayoutInfo.mpAnchorFrm )
+{
+ mpShadow = ShadowOverlayObject::CreateShadowOverlayObject( mrView );
+ if ( mpShadow )
+ {
+ mpShadow->setVisible(false);
+ }
+
+ mrMgr.ConnectSidebarWinToFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm),
+ *(mrSidebarItem.GetFmtFld()),
+ *this );
+}
+
+SwSidebarWin::~SwSidebarWin()
+{
+ mrMgr.DisconnectSidebarWinFromFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm),
+ *this );
+
+ Disable();
+
+ if ( mpSidebarTxtControl )
+ {
+ if ( mpOutlinerView )
+ {
+ mpOutlinerView->SetWindow( 0 );
+ }
+ delete mpSidebarTxtControl;
+ mpSidebarTxtControl = 0;
+ }
+
+ if ( mpOutlinerView )
+ {
+ delete mpOutlinerView;
+ mpOutlinerView = 0;
+ }
+
+ if (mpOutliner)
+ {
+ delete mpOutliner;
+ mpOutliner = 0;
+ }
+
+ if (mpMetadataAuthor)
+ {
+ mpMetadataAuthor->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ delete mpMetadataAuthor;
+ mpMetadataAuthor = 0;
+ }
+
+ if (mpMetadataDate)
+ {
+ mpMetadataDate->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ delete mpMetadataDate;
+ mpMetadataDate = 0;
+ }
+
+ if (mpVScrollbar)
+ {
+ mpVScrollbar->RemoveEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ delete mpVScrollbar;
+ mpVScrollbar = 0;
+ }
+
+ AnchorOverlayObject::DestroyAnchorOverlayObject( mpAnchor );
+ mpAnchor = 0;
+
+ ShadowOverlayObject::DestroyShadowOverlayObject( mpShadow );
+ mpShadow = 0;
+
+ delete mpMenuButton;
+ mpMenuButton = 0;
+
+ if (mnEventId)
+ Application::RemoveUserEvent( mnEventId );
+}
+
+void SwSidebarWin::Paint( const Rectangle& rRect)
+{
+ Window::Paint(rRect);
+
+ if (mpMetadataAuthor->IsVisible() )
+ {
+ //draw left over space
+ if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ SetFillColor(COL_BLACK);
+ }
+ else
+ {
+ SetFillColor(mColorDark);
+ }
+ SetLineColor();
+ DrawRect( PixelToLogic(
+ Rectangle( Point( mpMetadataAuthor->GetPosPixel().X() +
+ mpMetadataAuthor->GetSizePixel().Width(),
+ mpMetadataAuthor->GetPosPixel().Y() ),
+ Size( GetMetaButtonAreaWidth(),
+ mpMetadataAuthor->GetSizePixel().Height() +
+ mpMetadataDate->GetSizePixel().Height() ) ) ) );
+ }
+}
+
+void SwSidebarWin::SetPosSizePixelRect( long nX,
+ long nY,
+ long nWidth,
+ long nHeight,
+ const SwRect &aRect,
+ const long aPageBorder)
+{
+ mPosSize = Rectangle(Point(nX,nY),Size(nWidth,nHeight));
+ mAnchorRect = aRect;
+ mPageBorder = aPageBorder;
+}
+
+void SwSidebarWin::SetSize( const Size& rNewSize )
+{
+ mPosSize.SetSize(rNewSize);
+}
+
+void SwSidebarWin::SetVirtualPosSize( const Point& aPoint, const Size& aSize)
+{
+ mPosSize = Rectangle(aPoint,aSize);
+}
+
+void SwSidebarWin::TranslateTopPosition(const long aAmount)
+{
+ mPosSize.Move(0,aAmount);
+}
+
+void SwSidebarWin::ShowAnchorOnly(const Point &aPoint)
+{
+ HideNote();
+ SetPosAndSize();
+ if (mpAnchor)
+ {
+ mpAnchor->SetSixthPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
+ mpAnchor->SetSeventhPosition(basegfx::B2DPoint(aPoint.X(),aPoint.Y()));
+ mpAnchor->SetAnchorState(AS_ALL);
+ mpAnchor->setVisible(true);
+ }
+ if (mpShadow)
+ mpShadow->setVisible(false);
+}
+
+SfxItemSet SwSidebarWin::DefaultItem()
+{
+ SfxItemSet aItem( mrView.GetDocShell()->GetPool() );
+ aItem.Put(SvxFontHeightItem(200,100,EE_CHAR_FONTHEIGHT));
+ aItem.Put(SvxFontItem(FAMILY_SWISS,GetSettings().GetStyleSettings().GetFieldFont().GetName(),
+ EMPTYSTRING,PITCH_DONTKNOW,RTL_TEXTENCODING_DONTKNOW,EE_CHAR_FONTINFO));
+ return aItem;
+}
+
+void SwSidebarWin::InitControls()
+{
+ AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+
+ // actual window which holds the user text
+ mpSidebarTxtControl = new SidebarTxtControl( *this,
+ WB_NODIALOGCONTROL,
+ mrView, mrMgr );
+ mpSidebarTxtControl->SetPointer(Pointer(POINTER_TEXT));
+
+ // window controls for author and date
+ mpMetadataAuthor = new Edit( this, 0 );
+ mpMetadataAuthor->SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_AUTHOR_NAME ) );
+ mpMetadataAuthor->SetReadOnly();
+ mpMetadataAuthor->AlwaysDisableInput(true);
+ mpMetadataAuthor->SetCallHandlersOnInputDisabled(true);
+ mpMetadataAuthor->AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ // we should leave this setting alone, but for this we need a better layout algo
+ // with variable meta size height
+ {
+ AllSettings aSettings = mpMetadataAuthor->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ Font aFont = aStyleSettings.GetFieldFont();
+ aFont.SetHeight(8);
+ aStyleSettings.SetFieldFont(aFont);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMetadataAuthor->SetSettings(aSettings);
+ }
+
+ mpMetadataDate = new Edit( this, 0 );
+ mpMetadataDate->SetAccessibleName( SW_RES( STR_ACCESS_ANNOTATION_DATE_NAME ) );
+ mpMetadataDate->SetReadOnly();
+ mpMetadataDate->AlwaysDisableInput(true);
+ mpMetadataDate->SetCallHandlersOnInputDisabled(true);
+ mpMetadataDate->AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+ // we should leave this setting alone, but for this we need a better layout algo
+ // with variable meta size height
+ {
+ AllSettings aSettings = mpMetadataDate->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ Font aFont = aStyleSettings.GetFieldFont();
+ aFont.SetHeight(8);
+ aStyleSettings.SetFieldFont(aFont);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMetadataDate->SetSettings(aSettings);
+ }
+
+
+ SwDocShell* aShell = mrView.GetDocShell();
+ mpOutliner = new Outliner(&aShell->GetPool(),OUTLINERMODE_TEXTOBJECT);
+ aShell->GetDoc()->SetCalcFieldValueHdl( mpOutliner );
+ mpOutliner->SetUpdateMode( TRUE );
+ Rescale();
+
+ mpOutlinerView = new OutlinerView ( mpOutliner, mpSidebarTxtControl );
+ mpOutlinerView->SetBackgroundColor(COL_TRANSPARENT);
+ mpOutliner->InsertView(mpOutlinerView );
+ mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,1,1) ) );
+
+ mpOutlinerView->SetAttribs(DefaultItem());
+
+ // TODO: ??
+ EEHorizontalTextDirection aDefHoriTextDir = Application::GetSettings().GetLayoutRTL() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
+ mpOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir );
+
+ //create Scrollbars
+ mpVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
+ mpVScrollbar->EnableNativeWidget(false);
+ mpVScrollbar->EnableRTL( false );
+ mpVScrollbar->SetScrollHdl(LINK(this, SwSidebarWin, ScrollHdl));
+ mpVScrollbar->EnableDrag();
+ mpVScrollbar->AddEventListener( LINK( this, SwSidebarWin, WindowEventListener ) );
+
+ const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
+ ULONG nCntrl = mpOutliner->GetControlWord();
+ // TODO: crash when AUTOCOMPLETE enabled
+ nCntrl |= EE_CNTRL_MARKFIELDS | EE_CNTRL_PASTESPECIAL | EE_CNTRL_AUTOCORRECT | EV_CNTRL_AUTOSCROLL | EE_CNTRL_URLSFXEXECUTE; // | EE_CNTRL_AUTOCOMPLETE;
+ if (pVOpt->IsFieldShadings())
+ nCntrl |= EE_CNTRL_MARKFIELDS;
+ else
+ nCntrl &= ~EE_CNTRL_MARKFIELDS;
+ if (pVOpt->IsOnlineSpell())
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ mpOutliner->SetControlWord(nCntrl);
+
+ sal_uInt16 aIndex = SW_MOD()->InsertRedlineAuthor(GetAuthor());
+ SetColor( mrMgr.GetColorDark(aIndex),
+ mrMgr.GetColorLight(aIndex),
+ mrMgr.GetColorAnchor(aIndex));
+
+ CheckMetaText();
+
+ mpMenuButton = CreateMenuButton();
+
+ SetLanguage(GetLanguage());
+ GetOutlinerView()->StartSpeller();
+ SetPostItText();
+ Engine()->CompleteOnlineSpelling();
+
+ mpSidebarTxtControl->Show();
+ mpMetadataAuthor->Show();
+ mpMetadataDate->Show();
+ mpVScrollbar->Show();
+}
+
+void SwSidebarWin::CheckMetaText()
+{
+ const SvtSysLocale aSysLocale;
+ const LocaleDataWrapper& rLocalData = aSysLocale.GetLocaleData();
+ String sMeta = GetAuthor();
+ if (sMeta.Len() == 0)
+ {
+ sMeta = String(SW_RES(STR_NOAUTHOR));
+ }
+ else if (sMeta.Len() > 22)
+ {
+ sMeta.Erase(20);
+ sMeta = sMeta + rtl::OUString::createFromAscii("...");
+ }
+ if ( mpMetadataAuthor->GetText() != sMeta )
+ {
+ mpMetadataAuthor->SetText(sMeta);
+ }
+
+ Date aDate = GetDate();
+ if (aDate==Date())
+ {
+ sMeta = String(SW_RES(STR_POSTIT_TODAY));
+ }
+ else if (aDate == Date(Date()-1))
+ {
+ sMeta = String(SW_RES(STR_POSTIT_YESTERDAY));
+ }
+ else if (aDate.IsValid() )
+ {
+ sMeta = rLocalData.getDate(aDate);
+ }
+ else
+ {
+ sMeta = String(SW_RES(STR_NODATE));
+ }
+ if (GetTime()!=0)
+ {
+ sMeta = sMeta + rtl::OUString::createFromAscii(" ") + rLocalData.getTime( GetTime(),false );
+ }
+ if ( mpMetadataDate->GetText() != sMeta )
+ {
+ mpMetadataDate->SetText(sMeta);
+ }
+
+}
+
+void SwSidebarWin::Rescale()
+{
+ MapMode aMode = GetParent()->GetMapMode();
+ aMode.SetOrigin( Point() );
+ mpOutliner->SetRefMapMode( aMode );
+ SetMapMode( aMode );
+ mpSidebarTxtControl->SetMapMode( aMode );
+ if ( mpMetadataAuthor )
+ {
+ Font aFont( mpMetadataAuthor->GetSettings().GetStyleSettings().GetFieldFont() );
+ sal_Int32 nHeight = aFont.GetHeight();
+ nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
+ aFont.SetHeight( nHeight );
+ mpMetadataAuthor->SetControlFont( aFont );
+ }
+ if ( mpMetadataDate )
+ {
+ Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() );
+ sal_Int32 nHeight = aFont.GetHeight();
+ nHeight = nHeight * aMode.GetScaleY().GetNumerator() / aMode.GetScaleY().GetDenominator();
+ aFont.SetHeight( nHeight );
+ mpMetadataDate->SetControlFont( aFont );
+ }
+}
+
+void SwSidebarWin::SetPosAndSize()
+{
+ bool bChange = false;
+
+ if (GetSizePixel() != mPosSize.GetSize())
+ {
+ bChange = true;
+ SetSizePixel(mPosSize.GetSize());
+ DoResize();
+ }
+
+ if (GetPosPixel().X() != mPosSize.TopLeft().X() || (abs(GetPosPixel().Y() - mPosSize.TopLeft().Y()) > 5) )
+ {
+ bChange = true;
+ SetPosPixel(mPosSize.TopLeft());
+
+ Point aLineStart;
+ Point aLineEnd ;
+ switch ( meSidebarPosition )
+ {
+ case sw::sidebarwindows::SIDEBAR_LEFT:
+ {
+ aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
+ aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
+ }
+ break;
+ case sw::sidebarwindows::SIDEBAR_RIGHT:
+ {
+ aLineStart = EditWin()->PixelToLogic( Point(GetPosPixel().X(),GetPosPixel().Y()-1) );
+ aLineEnd = EditWin()->PixelToLogic( Point(GetPosPixel().X()+GetSizePixel().Width(),GetPosPixel().Y()-1) );
+ }
+ break;
+ default:
+ ASSERT( false,
+ "<SwSidebarWin::SetPosAndSize()> - unexpected position of sidebar" );
+ break;
+ }
+
+ if (!IsPreview())
+ {
+ if (mpAnchor)
+ {
+ mpAnchor->SetAllPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
+ basegfx::B2DPoint( mAnchorRect.Left()-5*15 , mAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( mAnchorRect.Left()+5*15 , mAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( mAnchorRect.Left(), mAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( mPageBorder ,mAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
+ basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()));
+ mpAnchor->SetHeight(mAnchorRect.Height());
+ }
+ else
+ {
+ mpAnchor = AnchorOverlayObject::CreateAnchorOverlayObject( mrView,
+ mAnchorRect,
+ mPageBorder,
+ aLineStart,
+ aLineEnd,
+ mColorAnchor );
+ if ( mpAnchor )
+ {
+ mpAnchor->SetHeight(mAnchorRect.Height());
+ mpAnchor->setVisible(true);
+ mpAnchor->SetAnchorState(AS_TRI);
+ if (HasChildPathFocus())
+ {
+ mpAnchor->setLineSolid(true);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if ( mpAnchor &&
+ ( mpAnchor->getBasePosition() != basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom()-5*15) ) )
+ {
+ mpAnchor->SetTriPosition( basegfx::B2DPoint( mAnchorRect.Left() , mAnchorRect.Bottom() - 5* 15),
+ basegfx::B2DPoint( mAnchorRect.Left()-5*15 , mAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( mAnchorRect.Left()+5*15 , mAnchorRect.Bottom()+5*15),
+ basegfx::B2DPoint( mAnchorRect.Left(), mAnchorRect.Bottom()+2*15),
+ basegfx::B2DPoint( mPageBorder , mAnchorRect.Bottom()+2*15));
+ }
+ }
+
+ if (bChange)
+ {
+ Point aStart = EditWin()->PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height()));
+ Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height()));
+ mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
+ }
+
+ if (mrMgr.ShowNotes())
+ {
+ if (IsFollow() && !HasChildPathFocus())
+ {
+ // --> OD 2010-06-03 #i111964#
+ if ( mpAnchor )
+ {
+ mpAnchor->SetAnchorState(AS_END);
+ }
+ // <--
+ }
+ else
+ {
+ // --> OD 2010-06-03 #i111964#
+ if ( mpAnchor )
+ {
+ mpAnchor->SetAnchorState(AS_ALL);
+ }
+ // <--
+ SwSidebarWin* pWin = GetTopReplyNote();
+ // --> OD 2010-06-03 #i111964#
+ if ( pWin && pWin->Anchor() )
+ // <--
+ {
+ pWin->Anchor()->SetAnchorState(AS_END);
+ }
+ }
+ }
+}
+
+void SwSidebarWin::DoResize()
+{
+ long aTextHeight = LogicToPixel( mpOutliner->CalcTextSize()).Height();
+ long aHeight = GetSizePixel().Height();
+ unsigned long aWidth = GetSizePixel().Width();
+
+ aHeight -= GetMetaHeight();
+ mpMetadataAuthor->Show();
+ mpMetadataDate->Show();
+ mpSidebarTxtControl->SetQuickHelpText(EMPTYSTRING);
+
+ if ((aTextHeight > aHeight) && !IsPreview())
+ { // we need vertical scrollbars and have to reduce the width
+ aWidth -= GetScrollbarWidth();
+ mpVScrollbar->Show();
+ }
+ else
+ {
+ mpVScrollbar->Hide();
+ }
+
+ {
+ const Size aSizeOfMetadataControls( GetSizePixel().Width() - GetMetaButtonAreaWidth(),
+ GetMetaHeight()/2 );
+ mpMetadataAuthor->SetPosSizePixel( 0,
+ aHeight,
+ aSizeOfMetadataControls.Width(),
+ aSizeOfMetadataControls.Height() );
+ mpMetadataDate->SetPosSizePixel( 0,
+ aHeight + aSizeOfMetadataControls.Height(),
+ aSizeOfMetadataControls.Width(),
+ aSizeOfMetadataControls.Height() );
+ }
+
+ mpOutliner->SetPaperSize( PixelToLogic( Size(aWidth,aHeight) ) ) ;
+ mpOutlinerView->SetOutputArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
+ if (!mpVScrollbar->IsVisible())
+ { // if we do not have a scrollbar anymore, we want to see the complete text
+ mpOutlinerView->SetVisArea( PixelToLogic( Rectangle(0,0,aWidth,aHeight) ) );
+ }
+
+ if (!Application::GetSettings().GetLayoutRTL())
+ {
+ mpSidebarTxtControl->SetPosSizePixel(0, 0, aWidth, aHeight);
+ mpVScrollbar->SetPosSizePixel( aWidth, 0, GetScrollbarWidth(), aHeight);
+ }
+ else
+ {
+ mpSidebarTxtControl->SetPosSizePixel( ( (aTextHeight > aHeight) && !IsPreview()
+ ? GetScrollbarWidth() : 0 ) , 0,
+ aWidth, aHeight);
+ mpVScrollbar->SetPosSizePixel( 0, 0, GetScrollbarWidth(), aHeight);
+ }
+
+ mpVScrollbar->SetVisibleSize( PixelToLogic(Size(0,aHeight)).Height() );
+ mpVScrollbar->SetPageSize( PixelToLogic(Size(0,aHeight)).Height() * 8 / 10 );
+ mpVScrollbar->SetLineSize( mpOutliner->GetTextHeight() / 10 );
+ SetScrollbar();
+ mpVScrollbar->SetRange( Range(0, mpOutliner->GetTextHeight()));
+
+ //calculate rects for meta- button
+ const Fraction& fx( GetMapMode().GetScaleX() );
+ const Fraction& fy( GetMapMode().GetScaleY() );
+
+ const Point aPos( mpMetadataAuthor->GetPosPixel());
+ Rectangle aRectMetaButton;
+ if (IsPreview())
+ {
+ aRectMetaButton = PixelToLogic(
+ Rectangle( Point( aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH*4+10)*fx.GetNumerator()/fx.GetDenominator(),
+ aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ),
+ Size( METABUTTON_WIDTH*4*fx.GetNumerator()/fx.GetDenominator(),
+ METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) );
+ }
+ else
+ {
+ aRectMetaButton = PixelToLogic(
+ Rectangle( Point( aPos.X()+GetSizePixel().Width()-(METABUTTON_WIDTH+10)*fx.GetNumerator()/fx.GetDenominator(),
+ aPos.Y()+5*fy.GetNumerator()/fy.GetDenominator() ),
+ Size( METABUTTON_WIDTH*fx.GetNumerator()/fx.GetDenominator(),
+ METABUTTON_HEIGHT*fy.GetNumerator()/fy.GetDenominator() ) ) );
+ }
+
+ {
+ const Rectangle aRectMetaButtonPixel( LogicToPixel( aRectMetaButton ) );
+ mpMenuButton->SetPosSizePixel( aRectMetaButtonPixel.Left(),
+ aRectMetaButtonPixel.Top(),
+ aRectMetaButtonPixel.GetWidth(),
+ aRectMetaButtonPixel.GetHeight() );
+ }
+}
+
+void SwSidebarWin::SetSizePixel( const Size& rNewSize )
+{
+ Window::SetSizePixel(rNewSize);
+
+ if (mpShadow)
+ {
+ Point aStart = EditWin()->PixelToLogic(GetPosPixel()+Point(0,GetSizePixel().Height()));
+ Point aEnd = EditWin()->PixelToLogic(GetPosPixel()+Point(GetSizePixel().Width()-1,GetSizePixel().Height()));
+ mpShadow->SetPosition(basegfx::B2DPoint(aStart.X(),aStart.Y()), basegfx::B2DPoint(aEnd.X(),aEnd.Y()));
+ }
+}
+
+void SwSidebarWin::SetScrollbar()
+{
+ mpVScrollbar->SetThumbPos( mpOutlinerView->GetVisArea().Top()+ mpOutlinerView->GetEditView().GetCursor()->GetOffsetY());
+}
+
+void SwSidebarWin::ResizeIfNeccessary(long aOldHeight, long aNewHeight)
+{
+ if (aOldHeight != aNewHeight)
+ {
+ //check for lower border or next note
+ long aBorder = mrMgr.GetNextBorder();
+ if (aBorder != -1)
+ {
+ if (aNewHeight > GetMinimumSizeWithoutMeta())
+ {
+ long aNewLowerValue = GetPosPixel().Y() + aNewHeight + GetMetaHeight();
+ if (aNewLowerValue < aBorder)
+ SetSizePixel(Size(GetSizePixel().Width(),aNewHeight+GetMetaHeight()));
+ else
+ SetSizePixel(Size(GetSizePixel().Width(),aBorder - GetPosPixel().Y()));
+ DoResize();
+ Invalidate();
+ }
+ else
+ {
+ if (GetSizePixel().Height() != GetMinimumSizeWithoutMeta() + GetMetaHeight())
+ SetSizePixel(Size(GetSizePixel().Width(),GetMinimumSizeWithoutMeta() + GetMetaHeight()));
+ DoResize();
+ Invalidate();
+ }
+ }
+ else
+ {
+ DoResize();
+ Invalidate();
+ }
+ }
+ else
+ {
+ SetScrollbar();
+ }
+}
+
+void SwSidebarWin::SetColor(Color aColorDark,Color aColorLight, Color aColorAnchor)
+{
+ mColorDark = aColorDark;
+ mColorLight = aColorLight;
+ mColorAnchor = aColorAnchor;
+
+ if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ {
+ {
+ mpMetadataAuthor->SetControlBackground(mColorDark);
+ AllSettings aSettings = mpMetadataAuthor->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ aStyleSettings.SetFieldTextColor(aColorAnchor);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMetadataAuthor->SetSettings(aSettings);
+ }
+
+ {
+ mpMetadataDate->SetControlBackground(mColorDark);
+ AllSettings aSettings = mpMetadataDate->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ aStyleSettings.SetFieldTextColor(aColorAnchor);
+ aSettings.SetStyleSettings(aStyleSettings);
+ mpMetadataDate->SetSettings(aSettings);
+ }
+
+ AllSettings aSettings2 = mpVScrollbar->GetSettings();
+ StyleSettings aStyleSettings2 = aSettings2.GetStyleSettings();
+ aStyleSettings2.SetButtonTextColor(Color(0,0,0));
+ aStyleSettings2.SetCheckedColor(mColorLight); //hintergund
+ aStyleSettings2.SetShadowColor(mColorAnchor);
+ aStyleSettings2.SetFaceColor(mColorDark);
+ aSettings2.SetStyleSettings(aStyleSettings2);
+ mpVScrollbar->SetSettings(aSettings2);
+ }
+}
+
+void SwSidebarWin::SetSidebarPosition(sw::sidebarwindows::SidebarPosition eSidebarPosition)
+{
+ meSidebarPosition = eSidebarPosition;
+}
+
+void SwSidebarWin::SetReadonly(BOOL bSet)
+{
+ mbReadonly = bSet;
+ GetOutlinerView()->SetReadOnly(bSet);
+}
+
+void SwSidebarWin::SetLanguage(const SvxLanguageItem aNewItem)
+{
+ Link pLink = Engine()->GetModifyHdl();
+ Engine()->SetModifyHdl( Link() );
+ ESelection aOld = GetOutlinerView()->GetSelection();
+
+ ESelection aNewSelection( 0, 0, (USHORT)Engine()->GetParagraphCount()-1, USHRT_MAX );
+ GetOutlinerView()->SetSelection( aNewSelection );
+ SfxItemSet aEditAttr(GetOutlinerView()->GetAttribs());
+ aEditAttr.Put(aNewItem);
+ GetOutlinerView()->SetAttribs( aEditAttr );
+
+ GetOutlinerView()->SetSelection(aOld);
+ Engine()->SetModifyHdl( pLink );
+
+ const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
+ ULONG nCntrl = Engine()->GetControlWord();
+ // turn off
+ if (!pVOpt->IsOnlineSpell())
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ Engine()->SetControlWord(nCntrl);
+
+ //turn back on
+ if (pVOpt->IsOnlineSpell())
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ Engine()->SetControlWord(nCntrl);
+
+ Engine()->CompleteOnlineSpelling();
+ Invalidate();
+}
+
+void SwSidebarWin::DataChanged( const DataChangedEvent& aEvent)
+{
+ Window::DataChanged( aEvent );
+}
+
+void SwSidebarWin::GetFocus()
+{
+ if (mpSidebarTxtControl)
+ mpSidebarTxtControl->GrabFocus();
+}
+
+void SwSidebarWin::LoseFocus()
+{
+}
+
+void SwSidebarWin::ShowNote()
+{
+ SetPosAndSize();
+ if (!IsVisible())
+ Window::Show();
+ if (mpShadow && !mpShadow->isVisible())
+ mpShadow->setVisible(true);
+ if (mpAnchor && !mpAnchor->isVisible())
+ mpAnchor->setVisible(true);
+}
+
+void SwSidebarWin::HideNote()
+{
+ if (IsVisible())
+ Window::Hide();
+ if (mpAnchor)
+ {
+ if (mrMgr.IsShowAnchor())
+ mpAnchor->SetAnchorState(AS_TRI);
+ else
+ mpAnchor->setVisible(false);
+ }
+ if (mpShadow && mpShadow->isVisible())
+ mpShadow->setVisible(false);
+}
+
+void SwSidebarWin::ActivatePostIt()
+{
+ mrMgr.AssureStdModeAtShell();
+
+ mpOutliner->ClearModifyFlag();
+ mpOutliner->GetUndoManager().Clear();
+
+ CheckMetaText();
+ SetViewState(VS_EDIT);
+ GetOutlinerView()->ShowCursor();
+
+ mpOutlinerView->GetEditView().SetInsertMode(mrView.GetWrtShellPtr()->IsInsMode());
+
+ if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ GetOutlinerView()->SetBackgroundColor(mColorDark);
+}
+
+void SwSidebarWin::DeactivatePostIt()
+{
+ // remove selection, #i87073#
+ if (GetOutlinerView()->GetEditView().HasSelection())
+ {
+ ESelection aSelection = GetOutlinerView()->GetEditView().GetSelection();
+ aSelection.nEndPara = aSelection.nStartPara;
+ aSelection.nEndPos = aSelection.nStartPos;
+ GetOutlinerView()->GetEditView().SetSelection(aSelection);
+ }
+
+ mpOutliner->CompleteOnlineSpelling();
+
+ SetViewState(VS_NORMAL);
+ // write the visible text back into the SwField
+ UpdateData();
+
+ if ( !Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ GetOutlinerView()->SetBackgroundColor(COL_TRANSPARENT);
+
+
+ if ( !IsProtected() &&
+ Engine()->GetEditEngine().GetText()==String(EMPTYSTRING) )
+ {
+ mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), 0 );
+ }
+}
+
+void SwSidebarWin::ToggleInsMode()
+{
+ if (!mrView.GetWrtShell().IsRedlineOn())
+ {
+ //change outliner
+ mpOutlinerView->GetEditView().SetInsertMode(!mpOutlinerView->GetEditView().IsInsertMode());
+ //change documnet
+ mrView.GetWrtShell().ToggleInsMode();
+ //update statusbar
+ SfxBindings &rBnd = mrView.GetViewFrame()->GetBindings();
+ rBnd.Invalidate(SID_ATTR_INSERT);
+ rBnd.Update(SID_ATTR_INSERT);
+ }
+}
+
+void SwSidebarWin::ExecuteCommand(USHORT nSlot)
+{
+ mrMgr.AssureStdModeAtShell();
+
+ switch (nSlot)
+ {
+ case FN_POSTIT:
+ case FN_REPLY:
+ {
+ // if this note is empty, it will be deleted once losing the focus, so no reply, but only a new note
+ // will be created
+ if (Engine()->GetEditEngine().GetText() != String(EMPTYSTRING))
+ {
+ OutlinerParaObject* pPara = new OutlinerParaObject(*GetOutlinerView()->GetEditView().CreateTextObject());
+ mrMgr.RegisterAnswer(pPara);
+ }
+ if (mrMgr.HasActiveSidebarWin())
+ mrMgr.SetActiveSidebarWin(0);
+ SwitchToFieldPos();
+ mrView.GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
+ break;
+ }
+ case FN_DELETE_COMMENT:
+
+ //Delete(); // do not kill the parent of our open popup menu
+ mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), 0 );
+ break;
+ case FN_DELETE_ALL_NOTES:
+ case FN_HIDE_ALL_NOTES:
+ // not possible as slot as this would require that "this" is the active postit
+ mrView.GetViewFrame()->GetBindings().Execute( nSlot, 0, 0, SFX_CALLMODE_ASYNCHRON );
+ break;
+ case FN_DELETE_NOTE_AUTHOR:
+ case FN_HIDE_NOTE_AUTHOR:
+ {
+ // not possible as slot as this would require that "this" is the active postit
+ SfxStringItem aItem( nSlot, GetAuthor() );
+ const SfxPoolItem* aItems[2];
+ aItems[0] = &aItem;
+ aItems[1] = 0;
+ mrView.GetViewFrame()->GetBindings().Execute( nSlot, aItems, 0, SFX_CALLMODE_ASYNCHRON );
+ }
+ default:
+ mrView.GetViewFrame()->GetBindings().Execute( nSlot );
+ break;
+ }
+}
+
+SwEditWin* SwSidebarWin::EditWin()
+{
+ return &mrView.GetEditWin();
+}
+
+long SwSidebarWin::GetPostItTextHeight()
+{
+ return mpOutliner ? LogicToPixel(mpOutliner->CalcTextSize()).Height() : 0;
+}
+
+void SwSidebarWin::SwitchToPostIt(USHORT aDirection)
+{
+ SwSidebarWin* pPostIt = mrMgr.GetNextPostIt(aDirection, this);
+ if (pPostIt)
+ pPostIt->GrabFocus();
+}
+
+IMPL_LINK( SwSidebarWin, WindowEventListener, VclSimpleEvent*, pEvent )
+{
+ VclWindowEvent* pWinEvent = dynamic_cast<VclWindowEvent*>(pEvent);
+ if ( pWinEvent )
+ {
+ if ( pWinEvent->GetId() == VCLEVENT_WINDOW_MOUSEMOVE )
+ {
+ MouseEvent* pMouseEvt = (MouseEvent*)pWinEvent->GetData();
+ if ( pMouseEvt->IsEnterWindow() )
+ {
+ mbMouseOver = true;
+ if ( !HasFocus() )
+ {
+ SetViewState(VS_VIEW);
+ Invalidate();
+ }
+ }
+ else if ( pMouseEvt->IsLeaveWindow())
+ {
+ if (IsPreview())
+ {
+ //doLazyDelete();
+ }
+ else
+ {
+ mbMouseOver = false;
+ if ( !HasFocus() )
+ {
+ SetViewState(VS_NORMAL);
+ Invalidate();
+ }
+ }
+ }
+ }
+ else if ( pWinEvent->GetId() == VCLEVENT_WINDOW_ACTIVATE &&
+ pWinEvent->GetWindow() == mpSidebarTxtControl )
+ {
+ const BOOL bLockView = mrView.GetWrtShell().IsViewLocked();
+ mrView.GetWrtShell().LockView( TRUE );
+
+ if ( !IsPreview() )
+ {
+ mrMgr.SetActiveSidebarWin( this );
+ }
+
+ mrView.GetWrtShell().LockView( bLockView );
+ mrMgr.MakeVisible( this );
+ }
+ else if ( pWinEvent->GetWindow() == mpSidebarTxtControl )
+ {
+ int i = 5;
+ ++i;
+ }
+ }
+ return sal_True;
+}
+
+void SwSidebarWin::Delete()
+{
+ if ( mrMgr.GetActiveSidebarWin() == this)
+ {
+ mrMgr.SetActiveSidebarWin(0);
+ // if the note is empty, the previous line will send a delete event, but we are already there
+ if (mnEventId)
+ {
+ Application::RemoveUserEvent( mnEventId );
+ mnEventId = 0;
+ }
+ }
+}
+
+IMPL_LINK(SwSidebarWin, ScrollHdl, ScrollBar*, pScroll)
+{
+ long nDiff = GetOutlinerView()->GetEditView().GetVisArea().Top() - pScroll->GetThumbPos();
+ GetOutlinerView()->Scroll( 0, nDiff );
+ return 0;
+}
+
+IMPL_LINK(SwSidebarWin, ModifyHdl, void*, pVoid)
+{
+ // no warnings, please
+ pVoid=0;
+ mrView.GetDocShell()->SetModified(sal_True);
+ return 0;
+}
+
+IMPL_LINK(SwSidebarWin, DeleteHdl, void*, pVoid)
+{
+ // no warnings, please
+ pVoid=0;
+ mnEventId = 0;
+ Delete();
+ return 0;
+}
+
+
+void SwSidebarWin::ResetAttributes()
+{
+ mpOutlinerView->RemoveAttribsKeepLanguages(TRUE);
+ mpOutliner->RemoveFields(TRUE);
+ mpOutlinerView->SetAttribs(DefaultItem());
+}
+
+sal_Int32 SwSidebarWin::GetScrollbarWidth()
+{
+ return mrView.GetWrtShell().GetViewOptions()->GetZoom() / 10;
+}
+
+sal_Int32 SwSidebarWin::GetMetaButtonAreaWidth()
+{
+ const Fraction& f( GetMapMode().GetScaleX() );
+ if (IsPreview())
+ return 3 * METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
+ else
+ return METABUTTON_AREA_WIDTH * f.GetNumerator() / f.GetDenominator();
+}
+
+sal_Int32 SwSidebarWin::GetMetaHeight()
+{
+ const Fraction& f( GetMapMode().GetScaleY() );
+ return POSTIT_META_HEIGHT * f.GetNumerator() / f.GetDenominator();
+}
+
+sal_Int32 SwSidebarWin::GetMinimumSizeWithMeta()
+{
+ return mrMgr.GetMinimumSizeWithMeta();
+}
+
+sal_Int32 SwSidebarWin::GetMinimumSizeWithoutMeta()
+{
+ const Fraction& f( GetMapMode().GetScaleY() );
+ return POSTIT_MINIMUMSIZE_WITHOUT_META * f.GetNumerator() / f.GetDenominator();
+}
+
+void SwSidebarWin::SetSpellChecking()
+{
+ const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
+ ULONG nCntrl = mpOutliner->GetControlWord();
+ if (pVOpt->IsOnlineSpell())
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ mpOutliner->SetControlWord(nCntrl);
+
+ mpOutliner->CompleteOnlineSpelling();
+ Invalidate();
+}
+
+void SwSidebarWin::SetViewState(ViewState bViewState)
+{
+ switch (bViewState)
+ {
+ case VS_EDIT:
+ {
+ if (mpAnchor)
+ {
+ mpAnchor->SetAnchorState(AS_ALL);
+ SwSidebarWin* pWin = GetTopReplyNote();
+ // --> OD 2010-06-03 #i111964#
+ if ( pWin && pWin->Anchor() )
+ // <--
+ {
+ pWin->Anchor()->SetAnchorState(AS_END);
+ }
+ mpAnchor->setLineSolid(true);
+ }
+ if (mpShadow)
+ mpShadow->SetShadowState(SS_EDIT);
+ break;
+ }
+ case VS_VIEW:
+ {
+ if (mpAnchor)
+ mpAnchor->setLineSolid(true);
+ if (mpShadow)
+ mpShadow->SetShadowState(SS_VIEW);
+ break;
+ }
+ case VS_NORMAL:
+ {
+ if (mpAnchor)
+ {
+ if (IsFollow())
+ {
+ // if there is no visible parent note, we want to see the complete anchor ??
+ //if (IsAnyStackParentVisible())
+ mpAnchor->SetAnchorState(AS_END);
+ SwSidebarWin* pTopWinSelf = GetTopReplyNote();
+ SwSidebarWin* pTopWinActive = mrMgr.HasActiveSidebarWin()
+ ? mrMgr.GetActiveSidebarWin()->GetTopReplyNote()
+ : 0;
+ // --> OD 2010-06-03 #i111964#
+ if ( pTopWinSelf && ( pTopWinSelf != pTopWinActive ) &&
+ pTopWinSelf->Anchor() )
+ // <--
+ {
+ if ( pTopWinSelf != mrMgr.GetActiveSidebarWin() )
+ {
+ pTopWinSelf->Anchor()->setLineSolid(false);
+ }
+ pTopWinSelf->Anchor()->SetAnchorState(AS_ALL);
+ }
+ }
+ mpAnchor->setLineSolid(false);
+ }
+ if ( mpShadow )
+ {
+ mpShadow->SetShadowState(SS_NORMAL);
+ }
+ break;
+ }
+ }
+}
+
+SwSidebarWin* SwSidebarWin::GetTopReplyNote()
+{
+ SwSidebarWin* pTopNote = 0;
+ SwSidebarWin* pSidebarWin = IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, this) : 0;
+ while (pSidebarWin)
+ {
+ pTopNote = pSidebarWin;
+ pSidebarWin = pSidebarWin->IsFollow() ? mrMgr.GetNextPostIt(KEY_PAGEUP, pSidebarWin) : 0;
+ }
+ return pTopNote;
+}
+
+void SwSidebarWin::SwitchToFieldPos()
+{
+ if ( mrMgr.GetActiveSidebarWin() == this )
+ mrMgr.SetActiveSidebarWin(0);
+ GotoPos();
+ sal_uInt32 aCount = MoveCaret();
+ if (aCount)
+ mrView.GetDocShell()->GetWrtShell()->SwCrsrShell::Right(aCount, 0, FALSE);
+ GrabFocusToDocument();
+}
+
+SvxLanguageItem SwSidebarWin::GetLanguage(void)
+{
+ return SvxLanguageItem(SwLangHelper::GetLanguage(mrView.GetWrtShell(),RES_CHRATR_LANGUAGE),RES_CHRATR_LANGUAGE);
+}
+
+void SwSidebarWin::SetChangeTracking( const SwPostItHelper::SwLayoutStatus aLayoutStatus,
+ const Color& aChangeColor )
+{
+ if ( (mLayoutStatus != aLayoutStatus) ||
+ (mChangeColor != aChangeColor) )
+ {
+ mLayoutStatus = aLayoutStatus;
+ mChangeColor = aChangeColor;
+ Invalidate();
+ }
+}
+
+bool SwSidebarWin::HasScrollbar() const
+{
+ return mpVScrollbar != 0;
+}
+
+bool SwSidebarWin::IsScrollbarVisible() const
+{
+ return HasScrollbar() && mpVScrollbar->IsVisible();
+}
+
+void SwSidebarWin::ChangeSidebarItem( SwSidebarItem& rSidebarItem )
+{
+ const bool bAnchorChanged = mpAnchorFrm != rSidebarItem.maLayoutInfo.mpAnchorFrm;
+ if ( bAnchorChanged )
+ {
+ mrMgr.DisconnectSidebarWinFromFrm( *(mpAnchorFrm), *this );
+ }
+
+ mrSidebarItem = rSidebarItem;
+ mpAnchorFrm = mrSidebarItem.maLayoutInfo.mpAnchorFrm;
+
+ if ( GetWindowPeer() )
+ {
+ SidebarWinAccessible* pAcc =
+ static_cast<SidebarWinAccessible*>( GetWindowPeer() );
+ ASSERT( dynamic_cast<SidebarWinAccessible*>( GetWindowPeer() ),
+ "<SwSidebarWin::ChangeSidebarItem(..)> - unexpected type of window peer -> crash possible!" );
+ pAcc->ChangeSidebarItem( mrSidebarItem );
+ }
+
+ if ( bAnchorChanged )
+ {
+ mrMgr.ConnectSidebarWinToFrm( *(mrSidebarItem.maLayoutInfo.mpAnchorFrm),
+ *(mrSidebarItem.GetFmtFld()),
+ *this );
+ }
+}
+
+css::uno::Reference< css::accessibility::XAccessible > SwSidebarWin::CreateAccessible()
+{
+ SidebarWinAccessible* pAcc( new SidebarWinAccessible( *this,
+ mrView.GetWrtShell(),
+ mrSidebarItem ) );
+ css::uno::Reference< css::awt::XWindowPeer > xWinPeer( pAcc );
+ SetWindowPeer( xWinPeer, pAcc );
+
+ css::uno::Reference< css::accessibility::XAccessible > xAcc( xWinPeer, css::uno::UNO_QUERY );
+ return xAcc;
+}
+
+} } // eof of namespace sw::sidebarwindows
+
+/********** SwRedComment**************/
+/*
+SwRedComment::SwRedComment( Window* pParent, WinBits nBits,SwPostItMgr* aMgr,SwPostItBits aBits,SwRedline* pRed)
+ : SwSidebarWin(pParent,nBits,aMgr,aBits),
+ pRedline(pRed)
+{
+}
+
+void SwRedComment::SetPopup()
+{
+ mpButtonPopup = new PopupMenu(SW_RES(MN_REDCOMMENT_BUTTON));
+ //mpButtonPopup->SetMenuFlags(MENU_FLAG_ALWAYSSHOWDISABLEDENTRIES);
+}
+
+void SwRedComment::UpdateData()
+{
+ if ( Engine()->IsModified() )
+ {
+ // so we get a new layout of notes (Anchor position is still the same and we would otherwise not get one)
+ Mgr()->SetLayout();
+ // SetRedline is calling SetModified already
+ DocView()->GetWrtShell().SetRedlineComment(Engine()->GetEditEngine().GetText());
+ }
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+}
+
+void SwRedComment::SetPostItText()
+{
+ Engine()->SetModifyHdl( Link() );
+ Engine()->EnableUndo( FALSE );
+
+ Engine()->Clear();
+ View()->SetAttribs(DefaultItem());
+ View()->InsertText(pRedline->GetComment(),false);
+
+ Engine()->ClearModifyFlag();
+ Engine()->GetUndoManager().Clear();
+ Engine()->EnableUndo( TRUE );
+ Engine()->SetModifyHdl( LINK( this, SwSidebarWin, ModifyHdl ) );
+ Invalidate();
+}
+
+void SwRedComment::DeactivatePostIt()
+{
+ SwSidebarWin::DeactivatePostIt();
+ // current Redline is still selected
+ DocView()->GetWrtShellPtr()->ClearMark();
+}
+
+void SwRedComment::ActivatePostIt()
+{
+ SwSidebarWin::ActivatePostIt();
+
+ // do we want the redline selected?
+ // otherwise, SwRedComment::ActivatePostIt() as well as SwRedComment::DeactivatePostIt()
+ // can be thrown out completly
+ DocView()->GetDocShell()->GetWrtShell()->GotoRedline(
+ DocView()->GetDocShell()->GetWrtShell()->FindRedlineOfData(pRedline->GetRedlineData()),true);
+}
+
+void SwRedComment::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if (mRectMetaButton.IsInside(PixelToLogic(rMEvt.GetPosPixel())) && rMEvt.IsLeft())
+ {
+ ExecuteCommand( mpButtonPopup->Execute( this,Rectangle(LogicToPixel(mRectMetaButton.BottomLeft()),LogicToPixel(mRectMetaButton.BottomLeft())),POPUPMENU_EXECUTE_DOWN | POPUPMENU_NOMOUSEUPCLOSE) );
+ }
+}
+
+void SwRedComment::Delete()
+{
+ SwSidebarWin::Delete();
+ // we are not neccessarily on our redline, so let's move there
+ GotoPos();
+ DocView()->GetWrtShell().SetRedlineComment(EMPTYSTRING);
+ DocView()->GetWrtShell().ClearMark();
+ // so we get a new layout of notes (Anchor position is still the same and we would otherwise not get one)
+ Mgr()->SetLayout();
+ Mgr()->RemoveItem(pRedline);
+}
+
+void SwRedComment::GotoPos()
+{
+ DocView()->GetDocShell()->GetWrtShell()->GotoRedline(
+ DocView()->GetDocShell()->GetWrtShell()->FindRedlineOfData(pRedline->GetRedlineData()));
+}
+
+String SwRedComment::GetAuthor()
+{
+ return pRedline->GetAuthorString();
+}
+
+Date SwRedComment::GetDate()
+{
+ return pRedline->GetTimeStamp().GetDate();
+}
+
+Time SwRedComment::GetTime()
+{
+ return pRedline->GetTimeStamp().GetTime();
+}
+
+bool SwRedComment::IsProtected()
+{
+ return SwSidebarWin::IsProtected() || pRedline->Start()->nNode.GetNode().GetTxtNode()->IsInProtectSect();
+}
+*/
diff --git a/sw/source/ui/docvw/SidebarWinAcc.cxx b/sw/source/ui/docvw/SidebarWinAcc.cxx
new file mode 100644
index 000000000000..214913963dcb
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarWinAcc.cxx
@@ -0,0 +1,162 @@
+/************************************************************************* *
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "precompiled_sw.hxx"
+
+#include <SidebarWinAcc.hxx>
+
+#include <SidebarWin.hxx>
+#include <viewsh.hxx>
+#include <accmap.hxx>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sw { namespace sidebarwindows {
+
+// =============================================================================
+// declaration and implementation of accessible context for <SidebarWinAccessible> instance
+// =============================================================================
+class SidebarWinAccessibleContext : public VCLXAccessibleComponent
+{
+ public:
+ explicit SidebarWinAccessibleContext( SwSidebarWin& rSidebarWin,
+ ViewShell& rViewShell,
+ const SwFrm* pAnchorFrm )
+ : VCLXAccessibleComponent( rSidebarWin.GetWindowPeer() )
+ , mrViewShell( rViewShell )
+ , mpAnchorFrm( pAnchorFrm )
+ , maMutex()
+ {
+ rSidebarWin.SetAccessibleRole( css::accessibility::AccessibleRole::COMMENT );
+ }
+
+ virtual ~SidebarWinAccessibleContext()
+ {}
+
+ void ChangeAnchor( const SwFrm* pAnchorFrm )
+ {
+ vos::OGuard aGuard(maMutex);
+
+ mpAnchorFrm = pAnchorFrm;
+ }
+
+ virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
+ getAccessibleParent() throw (css::uno::RuntimeException)
+ {
+ vos::OGuard aGuard(maMutex);
+
+ css::uno::Reference< css::accessibility::XAccessible > xAccParent;
+
+ if ( mpAnchorFrm &&
+ mrViewShell.GetAccessibleMap() )
+ {
+ xAccParent = mrViewShell.GetAccessibleMap()->GetContext( mpAnchorFrm, sal_False );
+ }
+
+ return xAccParent;
+ }
+
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (css::uno::RuntimeException)
+ {
+ vos::OGuard aGuard(maMutex);
+
+ sal_Int32 nIndex( -1 );
+
+ if ( mpAnchorFrm && GetWindow() &&
+ mrViewShell.GetAccessibleMap() )
+ {
+ nIndex = mrViewShell.GetAccessibleMap()->GetChildIndex( *mpAnchorFrm,
+ *GetWindow() );
+ }
+
+ return nIndex;
+ }
+
+ private:
+ ViewShell& mrViewShell;
+ const SwFrm* mpAnchorFrm;
+
+ ::vos::OMutex maMutex;
+};
+
+// =============================================================================
+// implementaion of accessible for <SwSidebarWin> instance
+// =============================================================================
+SidebarWinAccessible::SidebarWinAccessible( SwSidebarWin& rSidebarWin,
+ ViewShell& rViewShell,
+ const SwSidebarItem& rSidebarItem )
+ : VCLXWindow()
+ , mrSidebarWin( rSidebarWin )
+ , mrViewShell( rViewShell )
+ , mpAnchorFrm( rSidebarItem.maLayoutInfo.mpAnchorFrm )
+ , bAccContextCreated( false )
+{
+ SetWindow( &mrSidebarWin );
+}
+
+SidebarWinAccessible::~SidebarWinAccessible()
+{
+}
+
+void SidebarWinAccessible::ChangeSidebarItem( const SwSidebarItem& rSidebarItem )
+{
+ if ( bAccContextCreated )
+ {
+ css::uno::Reference< css::accessibility::XAccessibleContext > xAcc
+ = getAccessibleContext();
+ if ( xAcc.is() )
+ {
+ SidebarWinAccessibleContext* pAccContext =
+ dynamic_cast<SidebarWinAccessibleContext*>(xAcc.get());
+ if ( pAccContext )
+ {
+ pAccContext->ChangeAnchor( rSidebarItem.maLayoutInfo.mpAnchorFrm );
+ }
+ }
+ }
+}
+
+css::uno::Reference< css::accessibility::XAccessibleContext > SidebarWinAccessible::CreateAccessibleContext()
+{
+ SidebarWinAccessibleContext* pAccContext =
+ new SidebarWinAccessibleContext( mrSidebarWin,
+ mrViewShell,
+ mpAnchorFrm );
+ css::uno::Reference< css::accessibility::XAccessibleContext > xAcc( pAccContext );
+ bAccContextCreated = true;
+ return xAcc;
+}
+
+} } // end of namespace sw::sidebarwindows
+
diff --git a/sw/source/ui/docvw/SidebarWinAcc.hxx b/sw/source/ui/docvw/SidebarWinAcc.hxx
new file mode 100644
index 000000000000..0abe1acbfaf5
--- /dev/null
+++ b/sw/source/ui/docvw/SidebarWinAcc.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SIDEBARWINACC_HXX
+#define _SIDEBARWINACC_HXX
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+class ViewShell;
+class SwSidebarItem;
+class SwFrm;
+
+namespace sw { namespace sidebarwindows {
+
+class SwSidebarWin;
+
+class SidebarWinAccessible : public VCLXWindow
+{
+ public:
+ explicit SidebarWinAccessible( SwSidebarWin& rSidebarWin,
+ ViewShell& rViewShell,
+ const SwSidebarItem& rSidebarItem );
+ virtual ~SidebarWinAccessible();
+
+ virtual com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessibleContext >
+ CreateAccessibleContext();
+
+ void ChangeSidebarItem( const SwSidebarItem& rSidebarItem );
+
+ private:
+ SwSidebarWin& mrSidebarWin;
+ ViewShell& mrViewShell;
+ const SwFrm* mpAnchorFrm;
+ bool bAccContextCreated;
+};
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/docvw/access.src b/sw/source/ui/docvw/access.src
new file mode 100644
index 000000000000..42081d3ab7e7
--- /dev/null
+++ b/sw/source/ui/docvw/access.src
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "access.hrc"
+
+String STR_ACCESS_DOC_NAME
+{
+ Text [ en-US ] = "Document view";
+};
+String STR_ACCESS_DOC_DESC
+{
+ Text [ en-US ] = "Document view";
+};
+String STR_ACCESS_HEADING_WITH_NUM_DESC
+{
+ Text [ en-US ] = "Heading number $(ARG2): $(ARG1)";
+};
+String STR_ACCESS_HEADER_NAME
+{
+ Text [ en-US ] = "Header $(ARG1)";
+};
+String STR_ACCESS_HEADER_DESC
+{
+ Text [ en-US ] = "Header page $(ARG1)";
+};
+String STR_ACCESS_FOOTER_NAME
+{
+ Text [ en-US ] = "Footer $(ARG1)";
+};
+String STR_ACCESS_FOOTER_DESC
+{
+ Text [ en-US ] = "Footer page $(ARG1)";
+};
+String STR_ACCESS_FOOTNOTE_NAME
+{
+ Text [ en-US ] = "Footnote $(ARG1)";
+};
+String STR_ACCESS_FOOTNOTE_DESC
+{
+ Text [ en-US ] = "Footnote $(ARG1)";
+};
+String STR_ACCESS_ENDNOTE_NAME
+{
+ Text [ en-US ] = "Endnote $(ARG1)";
+};
+String STR_ACCESS_ENDNOTE_DESC
+{
+ Text [ en-US ] = "Endnote $(ARG1)";
+};
+String STR_ACCESS_TABLE_DESC
+{
+ Text [ en-US ] = "$(ARG1) on page $(ARG2)";
+};
+String STR_ACCESS_PAGE_NAME
+{
+ Text [ en-US ] = "Page $(ARG1)";
+};
+String STR_ACCESS_PAGE_DESC
+{
+ Text [ en-US ] = "Page: $(ARG1)";
+};
+String STR_ACCESS_ANNOTATION_AUTHOR_NAME
+{
+ Text [ en-US ] = "Author";
+};
+String STR_ACCESS_ANNOTATION_DATE_NAME
+{
+ Text [ en-US ] = "Date";
+};
+String STR_ACCESS_ANNOTATION_BUTTON_NAME
+{
+ Text [ en-US ] = "Actions";
+};
+String STR_ACCESS_ANNOTATION_BUTTON_DESC
+{
+ Text [ en-US ] = "Activate this button to open a list of actions which can be performed on this comment and other comments";
+};
+
diff --git a/sw/source/ui/docvw/annotation.hrc b/sw/source/ui/docvw/annotation.hrc
new file mode 100644
index 000000000000..e43a90342409
--- /dev/null
+++ b/sw/source/ui/docvw/annotation.hrc
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ANNOTATION_HRC
+#define _ANNOTATION_HRC
+
+#include "rcid.hrc"
+
+#define STR_POSTIT_TODAY (RC_ANNOTATION_BEGIN + 1)
+#define STR_POSTIT_YESTERDAY (RC_ANNOTATION_BEGIN + 2)
+
+#define STR_DELETE_ALL_NOTES (RC_ANNOTATION_BEGIN + 3)
+#define STR_DELETE_AUTHOR_NOTES (RC_ANNOTATION_BEGIN + 4)
+
+#define STR_NODATE (RC_ANNOTATION_BEGIN + 5)
+#define STR_NOAUTHOR (RC_ANNOTATION_BEGIN + 6)
+
+#define STR_REPLY (RC_ANNOTATION_BEGIN + 7)
+
+
+#define ANNOTATION_ACT_END STR_REPLY
+#if ANNOTATION_ACT_END > RC_ANNOTATION_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+
+#endif
diff --git a/sw/source/ui/docvw/annotation.src b/sw/source/ui/docvw/annotation.src
new file mode 100644
index 000000000000..8dcda9c25b8c
--- /dev/null
+++ b/sw/source/ui/docvw/annotation.src
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "annotation.hrc"
+#include "cmdid.h"
+
+String STR_POSTIT_TODAY
+{
+ Text [ en-US ] = "Today," ;
+};
+
+String STR_POSTIT_YESTERDAY
+{
+ Text [ en-US ] = "Yesterday," ;
+};
+
+String STR_DELETE_ALL_NOTES
+{
+ Text [ en-US ] = "All Comments" ;
+};
+
+String STR_DELETE_AUTHOR_NOTES
+{
+ Text [ en-US ] = "Comments by " ;
+};
+
+String STR_NODATE
+{
+ Text [ en-US ] = "(no date)" ;
+};
+
+String STR_NOAUTHOR
+{
+ Text [ en-US ] = "(no author)" ;
+};
+
+String STR_REPLY
+{
+ Text [ en-US ] = "Reply to $1" ;
+};
+
diff --git a/sw/source/ui/docvw/docvw.hrc b/sw/source/ui/docvw/docvw.hrc
new file mode 100644
index 000000000000..c0f15291795b
--- /dev/null
+++ b/sw/source/ui/docvw/docvw.hrc
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DOCVW_HRC
+#define _DOCVW_HRC
+
+#include "rcid.hrc"
+
+#define MN_READONLY_POPUP (RC_DOCVW_BEGIN + 1)
+#define MN_READONLY_OPENURL (RC_DOCVW_BEGIN + 2)
+#define MN_READONLY_OPENURLNEW (RC_DOCVW_BEGIN + 3)
+#define MN_READONLY_EDITDOC (RC_DOCVW_BEGIN + 4)
+ // FREE, formerly known as MN_READONLY_BROWSE_STOP
+#define MN_READONLY_BROWSE_BACKWARD (RC_DOCVW_BEGIN + 6)
+#define MN_READONLY_BROWSE_FORWARD (RC_DOCVW_BEGIN + 7)
+#define MN_READONLY_SELECTION_MODE (RC_DOCVW_BEGIN + 8)
+#define MN_READONLY_SAVEGRAPHIC (RC_DOCVW_BEGIN + 11)
+#define MN_READONLY_SAVEBACKGROUND (RC_DOCVW_BEGIN + 12)
+#define MN_READONLY_COPYLINK (RC_DOCVW_BEGIN + 13)
+#define MN_READONLY_COPYGRAPHIC (RC_DOCVW_BEGIN + 14)
+#define MN_READONLY_LOADGRAPHIC (RC_DOCVW_BEGIN + 15)
+#define MN_READONLY_GRAPHICOFF (RC_DOCVW_BEGIN + 16)
+#define MN_READONLY_PLUGINOFF (RC_DOCVW_BEGIN + 17)
+#define MN_READONLY_TOGALLERYLINK (RC_DOCVW_BEGIN + 18)
+#define MN_READONLY_TOGALLERYCOPY (RC_DOCVW_BEGIN + 19)
+#define MN_READONLY_SOURCEVIEW (RC_DOCVW_BEGIN + 20)
+#define MN_READONLY_RELOAD_FRAME (RC_DOCVW_BEGIN + 21)
+#define MN_READONLY_RELOAD (RC_DOCVW_BEGIN + 22)
+#define MN_READONLY_COPY (RC_DOCVW_BEGIN + 23)
+
+//Bei den folgenden brauchen wir Luft fuer die Gallery-Themen
+#define MN_READONLY_GRAPHICTOGALLERY (RC_DOCVW_BEGIN + 24)
+#define MN_READONLY_BACKGROUNDTOGALLERY (RC_DOCVW_BEGIN + 60)
+
+
+#define STR_EXPORT_GRAFIK_TITLE (RC_DOCVW_BEGIN + 1)
+#define STR_CHAIN_OK (RC_DOCVW_BEGIN + 2)
+#define STR_CHAIN_NOT_EMPTY (RC_DOCVW_BEGIN + 3)
+#define STR_CHAIN_IS_IN_CHAIN (RC_DOCVW_BEGIN + 4)
+#define STR_CHAIN_WRONG_AREA (RC_DOCVW_BEGIN + 5)
+#define STR_CHAIN_NOT_FOUND (RC_DOCVW_BEGIN + 6)
+#define STR_CHAIN_SOURCE_CHAINED (RC_DOCVW_BEGIN + 7)
+#define STR_CHAIN_SELF (RC_DOCVW_BEGIN + 8)
+#define STR_REDLINE_INSERT (RC_DOCVW_BEGIN + 9)
+#define STR_REDLINE_DELETE (RC_DOCVW_BEGIN + 10)
+#define STR_REDLINE_FORMAT (RC_DOCVW_BEGIN + 11)
+#define STR_REDLINE_TABLE (RC_DOCVW_BEGIN + 12)
+#define STR_REDLINE_FMTCOLL (RC_DOCVW_BEGIN + 13)
+#define STR_ENDNOTE (RC_DOCVW_BEGIN + 14)
+#define STR_FTNNOTE (RC_DOCVW_BEGIN + 15)
+
+#define STR_TABLE_COL_ADJUST (RC_DOCVW_BEGIN + 16)
+#define STR_TABLE_ROW_ADJUST (RC_DOCVW_BEGIN + 17)
+#define STR_TABLE_SELECT_ALL (RC_DOCVW_BEGIN + 18)
+#define STR_TABLE_SELECT_ROW (RC_DOCVW_BEGIN + 19)
+#define STR_TABLE_SELECT_COL (RC_DOCVW_BEGIN + 20)
+
+#define STR_SMARTTAG_CLICK (RC_DOCVW_BEGIN + 21)
+
+#define MSG_READONLY_CONTENT (RC_DOCVW_BEGIN + 1)
+
+#define DOCVW_ACT_END STR_SMARTTAG_CLICK
+
+#if DOCVW_ACT_END > RC_DOCVW_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+
+#endif
diff --git a/sw/source/ui/docvw/docvw.src b/sw/source/ui/docvw/docvw.src
new file mode 100644
index 000000000000..459b673cb188
--- /dev/null
+++ b/sw/source/ui/docvw/docvw.src
@@ -0,0 +1,296 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "docvw.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+#define SEPARATOR MenuItem { Separator = TRUE; };
+Menu MN_READONLY_POPUP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_READONLY_OPENURL ;
+ HelpId = CMD_SID_OPENDOC ;
+ Text [ en-US ] = "~Open" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_OPENURLNEW ;
+ HelpId = CMD_SID_OPENDOC ;
+ Text [ en-US ] = "Open in New Window" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_EDITDOC ;
+ HelpId = CMD_SID_EDITDOC ;
+ Text [ en-US ] = "~Edit" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_SELECTION_MODE ;
+ HelpId = CMD_FN_READONLY_SELECTION_MODE ;
+ Text [ en-US ] = "Select Text";
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_RELOAD;
+ HelpId = CMD_SID_RELOAD;
+ Text [ en-US ] = "Re~load";
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_RELOAD_FRAME;
+ HelpId = CMD_SID_RELOAD;
+ Text [ en-US ] = "Reload Frame";
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_SOURCEVIEW ;
+ HelpId = HID_SOURCEVIEW ;
+ Text [ en-US ] = "HT~ML Source" ;
+ };
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = MN_READONLY_BROWSE_BACKWARD ;
+ HelpId = CMD_SID_BROWSE_BACKWARD ;
+ Text [ en-US ] = "Backwards" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_BROWSE_FORWARD ;
+ HelpId = CMD_SID_BROWSE_FORWARD ;
+ Text [ en-US ] = "~Forward" ;
+ };
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = MN_READONLY_SAVEGRAPHIC ;
+ HelpID = HID_MN_READONLY_SAVEGRAPHIC ;
+ Text [ en-US ] = "Save Graphics..." ;
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_GRAPHICTOGALLERY ;
+ HelpID = HID_MN_READONLY_GRAPHICTOGALLERY ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_READONLY_TOGALLERYLINK ;
+ HelpID = HID_MN_READONLY_TOGALLERYLINK ;
+ Text [ en-US ] = "As Link" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_TOGALLERYCOPY ;
+ HelpID = HID_MN_READONLY_TOGALLERYCOPY ;
+ Text [ en-US ] = "Copy" ;
+ };
+ SEPARATOR
+ };
+ };
+ Text [ en-US ] = "Add Graphics" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_SAVEBACKGROUND ;
+ HelpID = HID_MN_READONLY_SAVEBACKGROUND ;
+ Text [ en-US ] = "Save Background..." ;
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_BACKGROUNDTOGALLERY ;
+ HelpID = HID_MN_READONLY_BACKGROUNDTOGALLERY ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_READONLY_TOGALLERYLINK ;
+ HelpID = HID_MN_READONLY_TOGALLERYLINK ;
+ Text [ en-US ] = "As Link" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_TOGALLERYCOPY ;
+ HelpID = HID_MN_READONLY_TOGALLERYCOPY ;
+ Text [ en-US ] = "Copy" ;
+ };
+ SEPARATOR
+ };
+ };
+ Text [ en-US ] = "Add Background" ;
+ };
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = MN_READONLY_COPYLINK ;
+ HelpID = HID_MN_READONLY_COPYLINK ;
+ Text [ en-US ] = "Copy ~Link" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_COPYGRAPHIC ;
+ HelpID = HID_MN_READONLY_COPYGRAPHIC ;
+ /* ### ACHTUNG: Neuer Text in Resource? Grafik ~kopieren : ~Grafik kopieren */
+ /* ### ACHTUNG: Neuer Text in Resource? Grafik ~kopieren : ~Grafik kopieren */
+ /* ### ACHTUNG: Neuer Text in Resource? Grafik ~kopieren : ~Grafik kopieren */
+ Text [ en-US ] = "Copy ~Graphics" ;
+ };
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = MN_READONLY_LOADGRAPHIC ;
+ HelpID = HID_MN_READONLY_LOADGRAPHIC ;
+ Text [ en-US ] = "Load Graphics" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_GRAPHICOFF ;
+ HelpID = HID_MN_READONLY_GRAPHICOFF ;
+ Text [ en-US ] = "Graphics Off" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_READONLY_PLUGINOFF ;
+ HelpID = HID_MN_READONLY_PLUGINOFF ;
+ Text [ en-US ] = "Plug-ins Off" ;
+ };
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = SID_WIN_FULLSCREEN;
+ HelpId = CMD_SID_WIN_FULLSCREEN;
+ Text [ en-US ] = "Leave Full-Screen Mode" ;
+ };
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = MN_READONLY_COPY ;
+ HelpId = CMD_SID_COPY;
+ Text [ en-US ] = "~Copy" ;
+ };
+ };
+};
+String STR_EXPORT_GRAFIK_TITLE
+{
+ Text [ en-US ] = "Graphics Export" ;
+};
+String STR_CHAIN_OK
+{
+ Text [ en-US ] = "Click the left mouse button to link the frames." ;
+};
+String STR_CHAIN_NOT_EMPTY
+{
+ Text [ en-US ] = "Target frame not empty." ;
+};
+String STR_CHAIN_IS_IN_CHAIN
+{
+ Text [ en-US ] = "Target frame is already linked." ;
+};
+String STR_CHAIN_WRONG_AREA
+{
+ Text [ en-US ] = "The target frame for the link is in an invalid area." ;
+};
+String STR_CHAIN_NOT_FOUND
+{
+ Text [ en-US ] = "Target frame not found at current position." ;
+};
+String STR_CHAIN_SOURCE_CHAINED
+{
+ Text [ en-US ] = "The source frame is already the source of a link." ;
+};
+String STR_CHAIN_SELF
+{
+ Text [ en-US ] = "A closed link is not possible." ;
+};
+String STR_REDLINE_INSERT
+{
+ Text [ en-US ] = "Inserted" ;
+};
+String STR_REDLINE_DELETE
+{
+ Text [ en-US ] = "Deleted" ;
+};
+String STR_REDLINE_FORMAT
+{
+ Text [ en-US ] = "Formatted" ;
+};
+String STR_REDLINE_TABLE
+{
+ Text [ en-US ] = "Table changed" ;
+};
+String STR_REDLINE_FMTCOLL
+{
+ Text [ en-US ] = "Applied Paragraph Styles";
+};
+String STR_ENDNOTE
+{
+ Text [ en-US ] = "Endnote: " ;
+};
+String STR_FTNNOTE
+{
+ Text [ en-US ] = "Footnote: " ;
+};
+
+InfoBox MSG_READONLY_CONTENT
+{
+ Message [ en-US ] = "Readonly content cannot be changed.\nNo modifications will be accepted";
+};
+
+String STR_TABLE_COL_ADJUST
+{
+ Text [ en-US ] = "Adjust table column" ;
+};
+String STR_TABLE_ROW_ADJUST
+{
+ Text [ en-US ] = "Adjust table row" ;
+};
+String STR_TABLE_SELECT_ALL
+{
+ Text [ en-US ] = "Select whole table" ;
+};
+String STR_TABLE_SELECT_ROW
+{
+ Text [ en-US ] = "Select table row" ;
+};
+String STR_TABLE_SELECT_COL
+{
+ Text [ en-US ] = "Select table column" ;
+};
+
+String STR_SMARTTAG_CLICK
+{
+ Text [ en-US ] = "%s-click to open Smart Tag menu" ;
+};
+
diff --git a/sw/source/ui/docvw/edtdd.cxx b/sw/source/ui/docvw/edtdd.cxx
new file mode 100644
index 000000000000..8e11e5117c27
--- /dev/null
+++ b/sw/source/ui/docvw/edtdd.cxx
@@ -0,0 +1,527 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+
+
+#include <svx/svdview.hxx>
+#include <editeng/outliner.hxx>
+//#ifndef _SVDVMARK_HXX //autogen
+//#include <svx/svdvmark.hxx>
+//#endif
+#include <svx/svdobj.hxx>
+#include <sot/exchange.hxx>
+#include <sot/formats.hxx>
+#include <sfx2/bindings.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <fmturl.hxx>
+#include <frmfmt.hxx>
+#include <wrtsh.hxx>
+#include <edtwin.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <viewopt.hxx>
+#include <swdtflvr.hxx>
+#include <swmodule.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <wdocsh.hxx>
+#include <swundo.hxx>
+
+using namespace ::com::sun::star;
+
+// no include "dbgoutsw.hxx" here!!!!!!
+
+extern BOOL bNoInterrupt;
+extern BOOL bFrmDrag;
+extern BOOL bDDTimerStarted;
+
+BOOL bExecuteDrag = FALSE;
+
+void SwEditWin::StartDDTimer()
+{
+ aTimer.SetTimeoutHdl(LINK(this, SwEditWin, DDHandler));
+ aTimer.SetTimeout(480);
+ aTimer.Start();
+ bDDTimerStarted = TRUE;
+}
+
+
+void SwEditWin::StopDDTimer(SwWrtShell *pSh, const Point &rPt)
+{
+ aTimer.Stop();
+ bDDTimerStarted = FALSE;
+ if(!pSh->IsSelFrmMode())
+ (pSh->*pSh->fnSetCrsr)(&rPt,FALSE);
+ aTimer.SetTimeoutHdl(LINK(this,SwEditWin, TimerHandler));
+}
+
+void SwEditWin::StartDrag( sal_Int8 /*nAction*/, const Point& rPosPixel )
+{
+ SwWrtShell &rSh = rView.GetWrtShell();
+ if( rSh.GetDrawView() )
+ {
+ CommandEvent aDragEvent( rPosPixel, COMMAND_STARTDRAG, TRUE );
+ if( rSh.GetDrawView()->Command( aDragEvent, this ) )
+ {
+ rView.GetViewFrame()->GetBindings().InvalidateAll(FALSE);
+ return; // Event von der SdrView ausgewertet
+ }
+ }
+
+ if ( !pApplyTempl && !rSh.IsDrawCreate() && !IsDrawAction())
+ {
+ BOOL bStart = FALSE, bDelSelect = FALSE;
+ SdrObject *pObj = NULL;
+ Point aDocPos( PixelToLogic( rPosPixel ) );
+ if ( !rSh.IsInSelect() && rSh.ChgCurrPam( aDocPos, TRUE, TRUE))
+ //Wir sind nicht beim Selektieren und stehen auf einer
+ //Selektion
+ bStart = TRUE;
+ else if ( !bFrmDrag && rSh.IsSelFrmMode() &&
+ rSh.IsInsideSelectedObj( aDocPos ) )
+ {
+ //Wir sind nicht am internen Draggen und stehen auf
+ //einem Objekt (Rahmen, Zeichenobjekt)
+
+ bStart = TRUE;
+ }
+ else if( !bFrmDrag && rView.GetDocShell()->IsReadOnly() &&
+ OBJCNT_NONE != rSh.GetObjCntType( aDocPos, pObj ))
+ {
+ rSh.LockPaint();
+ if( rSh.SelectObj( aDocPos, 0, pObj ))
+ bStart = bDelSelect = TRUE;
+ else
+ rSh.UnlockPaint();
+ }
+ else
+ {
+ SwContentAtPos aSwContentAtPos( SwContentAtPos::SW_INETATTR );
+ bStart = rSh.GetContentAtPos( aDocPos,
+ aSwContentAtPos,
+ FALSE );
+ }
+
+ if ( bStart && !bIsInDrag )
+ {
+ bMBPressed = FALSE;
+ ReleaseMouse();
+ bFrmDrag = FALSE;
+ bExecuteDrag = TRUE;
+ SwEditWin::nDDStartPosY = aDocPos.Y();
+ SwEditWin::nDDStartPosX = aDocPos.X();
+ aMovePos = aDocPos;
+ StartExecuteDrag();
+ if( bDelSelect )
+ {
+ rSh.UnSelectFrm();
+ rSh.UnlockPaint();
+ }
+ }
+ }
+}
+
+void SwEditWin::StartExecuteDrag()
+{
+ if( !bExecuteDrag || bIsInDrag )
+ return;
+
+ bIsInDrag = TRUE;
+
+ SwTransferable* pTransfer = new SwTransferable( rView.GetWrtShell() );
+ uno::Reference<
+ datatransfer::XTransferable > xRef( pTransfer );
+
+ pTransfer->StartDrag( this, aMovePos );
+}
+
+void SwEditWin::DragFinished()
+{
+ DropCleanup();
+ aTimer.SetTimeoutHdl( LINK(this,SwEditWin, TimerHandler) );
+ bIsInDrag = FALSE;
+}
+
+
+void SwEditWin::DropCleanup()
+{
+ SwWrtShell &rSh = rView.GetWrtShell();
+
+ // Stati zuruecksetzen
+ bNoInterrupt = FALSE;
+ if ( bOldIdleSet )
+ {
+ ((SwViewOption*)rSh.GetViewOptions())->SetIdle( bOldIdle );
+ bOldIdleSet = FALSE;
+ }
+ if ( pUserMarker )
+ CleanupDropUserMarker();
+ else
+ rSh.UnSetVisCrsr();
+
+}
+
+void SwEditWin::CleanupDropUserMarker()
+{
+ if ( pUserMarker )
+ {
+ delete pUserMarker;
+ pUserMarker = 0;
+ pUserMarkerObj = 0;
+ }
+}
+
+
+//Messehack (MA,MBA)
+void lcl_SelectShellForDrop( SwView &rView )
+{
+ if ( !rView.GetCurShell() )
+ rView.SelectShell();
+}
+
+sal_Int8 SwEditWin::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ ::lcl_SelectShellForDrop( GetView() );
+ DropCleanup();
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ //Ein Drop auf eine offene OutlinerView geht uns nichts an (siehe auch QueryDrop)
+ SwWrtShell &rSh = rView.GetWrtShell();
+ const Point aDocPt( PixelToLogic( rEvt.maPosPixel ));
+ SdrObject *pObj = 0;
+ OutlinerView* pOLV;
+ rSh.GetObjCntType( aDocPt, pObj );
+
+ if( pObj && 0 != ( pOLV = rSh.GetDrawView()->GetTextEditOutlinerView() ))
+ {
+ Rectangle aRect( pOLV->GetOutputArea() );
+ aRect.Union( pObj->GetLogicRect() );
+ const Point aPos = pOLV->GetWindow()->PixelToLogic(rEvt.maPosPixel);
+ if ( aRect.IsInside(aPos) )
+ {
+ rSh.StartAllAction();
+//!! sal_Int8 nRet = DND_ACTION_NONE/*pOLV->ExecuteDrop( rEvt )*/;
+ rSh.EndAllAction();
+ return nRet;
+ }
+ }
+
+
+ // dvo 2002-05-27, #99027#: There's a special treatment for file lists with a single
+ // element, that depends on the actual content of the
+ // Transferable to be accessible. Since the transferable
+ // may only be accessed after the drop has been accepted
+ // (according to KA due to Java D&D), we'll have to
+ // reevaluate the drop action once more _with_ the
+ // Transferable.
+ USHORT nEventAction;
+ sal_Int8 nUserOpt = rEvt.mbDefault ? EXCHG_IN_ACTION_DEFAULT
+ : rEvt.mnAction;
+ m_nDropAction = SotExchange::GetExchangeAction(
+ GetDataFlavorExVector(),
+ m_nDropDestination,
+ rEvt.mnAction,
+//!! rEvt.GetSourceOptions(),
+ nUserOpt, m_nDropFormat, nEventAction, 0,
+ &rEvt.maDropEvent.Transferable );
+
+
+ TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
+ nRet = rEvt.mnAction;
+ if( !SwTransferable::PasteData( aData, rSh, m_nDropAction, m_nDropFormat,
+ m_nDropDestination, FALSE, rEvt.mbDefault, &aDocPt, nRet))
+//!! nRet = SFX_APP()->ExecuteDrop( rEvt );
+ nRet = DND_ACTION_NONE;
+ else if ( SW_MOD()->pDragDrop )
+ //Bei internem D&D nicht mehr aufraeumen!
+ SW_MOD()->pDragDrop->SetCleanUp( FALSE );
+
+ return nRet;
+}
+
+
+USHORT SwEditWin::GetDropDestination( const Point& rPixPnt, SdrObject ** ppObj )
+{
+ SwWrtShell &rSh = rView.GetWrtShell();
+ const Point aDocPt( PixelToLogic( rPixPnt ) );
+ if( rSh.ChgCurrPam( aDocPt ) || rSh.IsOverReadOnlyPos( aDocPt ) )
+ return 0;
+
+ SdrObject *pObj = NULL;
+ const ObjCntType eType = rSh.GetObjCntType( aDocPt, pObj );
+
+ //Drop auf OutlinerView (TextEdit im Drawing) soll diese selbst entscheiden!
+ if( pObj )
+ {
+ OutlinerView* pOLV = rSh.GetDrawView()->GetTextEditOutlinerView();
+ if ( pOLV )
+ {
+ Rectangle aRect( pOLV->GetOutputArea() );
+ aRect.Union( pObj->GetLogicRect() );
+ const Point aPos = pOLV->GetWindow()->PixelToLogic( rPixPnt );
+ if( aRect.IsInside( aPos ) )
+ return 0;
+ }
+ }
+
+ //Auf was wollen wir denn gerade droppen?
+ USHORT nDropDestination = 0;
+
+ //Sonst etwas aus der DrawingEngine getroffen?
+ if( OBJCNT_NONE != eType )
+ {
+ switch ( eType )
+ {
+ case OBJCNT_GRF:
+ {
+ BOOL bLink,
+ bIMap = 0 != rSh.GetFmtFromObj( aDocPt )->GetURL().GetMap();
+ String aDummy;
+ rSh.GetGrfAtPos( aDocPt, aDummy, bLink );
+ if ( bLink && bIMap )
+ nDropDestination = EXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP;
+ else if ( bLink )
+ nDropDestination = EXCHG_DEST_DOC_LNKD_GRAPHOBJ;
+ else if ( bIMap )
+ nDropDestination = EXCHG_DEST_DOC_GRAPH_W_IMAP;
+ else
+ nDropDestination = EXCHG_DEST_DOC_GRAPHOBJ;
+ }
+ break;
+ case OBJCNT_FLY:
+ if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) )
+ nDropDestination = EXCHG_DEST_DOC_TEXTFRAME_WEB;
+ else
+ nDropDestination = EXCHG_DEST_DOC_TEXTFRAME;
+ break;
+ case OBJCNT_OLE: nDropDestination = EXCHG_DEST_DOC_OLEOBJ; break;
+ case OBJCNT_CONTROL: /* no Action avail */
+ case OBJCNT_SIMPLE: nDropDestination = EXCHG_DEST_DOC_DRAWOBJ; break;
+ case OBJCNT_URLBUTTON: nDropDestination = EXCHG_DEST_DOC_URLBUTTON; break;
+ case OBJCNT_GROUPOBJ: nDropDestination = EXCHG_DEST_DOC_GROUPOBJ; break;
+
+ default: ASSERT( !this, "new ObjectType?" );
+ }
+ }
+ if ( !nDropDestination )
+ {
+ if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) )
+ nDropDestination = EXCHG_DEST_SWDOC_FREE_AREA_WEB;
+ else
+ nDropDestination = EXCHG_DEST_SWDOC_FREE_AREA;
+ }
+ if( ppObj )
+ *ppObj = pObj;
+ return nDropDestination;
+}
+
+sal_Int8 SwEditWin::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ if( rEvt.mbLeaving )
+ {
+ DropCleanup();
+ return rEvt.mnAction;
+ }
+
+ if( rView.GetDocShell()->IsReadOnly() )
+ return DND_ACTION_NONE;
+
+ SwWrtShell &rSh = rView.GetWrtShell();
+
+ Point aPixPt( rEvt.maPosPixel );
+
+ // If the cursor is near the inner boundary
+ // we attempt to scroll towards the desired direction.
+ Point aPoint;
+ Rectangle aWin(aPoint,GetOutputSizePixel());
+ const int nMargin = 10;
+ aWin.Left() += nMargin;
+ aWin.Top() += nMargin;
+ aWin.Right() -= nMargin;
+ aWin.Bottom() -= nMargin;
+ if(!aWin.IsInside(aPixPt)) {
+ static ULONG last_tick = 0;
+ ULONG current_tick = Time::GetSystemTicks();
+ if((current_tick-last_tick) > 500) {
+ last_tick = current_tick;
+ if(!bOldIdleSet) {
+ bOldIdle = rSh.GetViewOptions()->IsIdle();
+ ((SwViewOption *)rSh.GetViewOptions())->SetIdle(FALSE);
+ bOldIdleSet = TRUE;
+ }
+ CleanupDropUserMarker();
+ if(aPixPt.X() > aWin.Right()) aPixPt.X() += nMargin;
+ if(aPixPt.X() < aWin.Left()) aPixPt.X() -= nMargin;
+ if(aPixPt.Y() > aWin.Bottom()) aPixPt.Y() += nMargin;
+ if(aPixPt.Y() < aWin.Top()) aPixPt.Y() -= nMargin;
+ Point aDocPt(PixelToLogic(aPixPt));
+ SwRect rect(aDocPt,Size(1,1));
+ rSh.MakeVisible(rect);
+ }
+ }
+
+ if(bOldIdleSet) {
+ ((SwViewOption *)rSh.GetViewOptions())->SetIdle( bOldIdle );
+ bOldIdleSet = FALSE;
+ }
+
+ SdrObject *pObj = NULL;
+ m_nDropDestination = GetDropDestination( aPixPt, &pObj );
+ if( !m_nDropDestination )
+ return DND_ACTION_NONE;
+
+ USHORT nEventAction;
+ sal_Int8 nUserOpt = rEvt.mbDefault ? EXCHG_IN_ACTION_DEFAULT
+ : rEvt.mnAction;
+
+ m_nDropAction = SotExchange::GetExchangeAction(
+ GetDataFlavorExVector(),
+ m_nDropDestination,
+ rEvt.mnAction,
+//!! rEvt.GetSourceOptions(),
+ nUserOpt, m_nDropFormat, nEventAction );
+
+ if( EXCHG_INOUT_ACTION_NONE != m_nDropAction )
+ {
+ const Point aDocPt( PixelToLogic( aPixPt ) );
+
+ //Bei den default Aktionen wollen wir noch ein bischen mitreden.
+ SwModule *pMod = SW_MOD();
+ if( pMod->pDragDrop )
+ {
+ BOOL bCleanup = FALSE;
+ //Zeichenobjekte in Kopf-/Fusszeilen sind nicht erlaubt
+
+ SwWrtShell *pSrcSh = pMod->pDragDrop->GetShell();
+ if( (pSrcSh->GetSelFrmType() == FRMTYPE_DRAWOBJ) &&
+ pSrcSh->IsSelContainsControl() &&
+ (rSh.GetFrmType( &aDocPt, FALSE ) & (FRMTYPE_HEADER|FRMTYPE_FOOTER)) )
+ {
+ bCleanup = TRUE;
+ }
+ // keine positionsgeschuetzten Objecte verschieben!
+ else if( DND_ACTION_MOVE == rEvt.mnAction &&
+ pSrcSh->IsSelObjProtected( FLYPROTECT_POS ) )
+ {
+ bCleanup = TRUE;
+ }
+ else if( rEvt.mbDefault )
+ {
+ // JP 13.08.98: internes Drag&Drop: bei gleichem Doc ein Move
+ // ansonten ein Copy - Task 54974
+ nEventAction = pSrcSh->GetDoc() == rSh.GetDoc()
+ ? DND_ACTION_MOVE
+ : DND_ACTION_COPY;
+ }
+ if ( bCleanup )
+ {
+ CleanupDropUserMarker();
+ rSh.UnSetVisCrsr();
+ return DND_ACTION_NONE;
+ }
+ }
+ else
+ {
+ //D&D von ausserhalb des SW soll per default ein Copy sein.
+ if( EXCHG_IN_ACTION_DEFAULT == nEventAction &&
+ DND_ACTION_MOVE == rEvt.mnAction )
+ nEventAction = DND_ACTION_COPY;
+
+ if( (SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE == m_nDropFormat &&
+ EXCHG_IN_ACTION_LINK == m_nDropAction) ||
+ SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE == m_nDropFormat )
+ {
+ SdrMarkView* pMView = PTR_CAST( SdrMarkView, rSh.GetDrawView() );
+ if( pMView && !pMView->IsDesignMode() )
+ return DND_ACTION_NONE;
+ }
+ }
+
+ if ( EXCHG_IN_ACTION_DEFAULT != nEventAction )
+ nUserOpt = (sal_Int8)nEventAction;
+
+ // show DropCursor or UserMarker ?
+ if( EXCHG_DEST_SWDOC_FREE_AREA_WEB == m_nDropDestination ||
+ EXCHG_DEST_SWDOC_FREE_AREA == m_nDropDestination )
+ {
+ CleanupDropUserMarker();
+ SwContentAtPos aCont( SwContentAtPos::SW_CONTENT_CHECK );
+ if(rSh.GetContentAtPos(aDocPt, aCont))
+ rSh.SwCrsrShell::SetVisCrsr( aDocPt );
+ }
+ else
+ {
+ rSh.UnSetVisCrsr();
+
+ if ( pUserMarkerObj != pObj )
+ {
+ CleanupDropUserMarker();
+ pUserMarkerObj = pObj;
+
+ if(pUserMarkerObj)
+ {
+ pUserMarker = new SdrDropMarkerOverlay( *rSh.GetDrawView(), *pUserMarkerObj );
+ }
+ }
+ }
+ return nUserOpt;
+ }
+
+ CleanupDropUserMarker();
+ rSh.UnSetVisCrsr();
+//!! return SFX_APP()->AcceptDrop( rEvt );
+ return DND_ACTION_NONE;
+}
+
+
+IMPL_LINK( SwEditWin, DDHandler, Timer *, EMPTYARG )
+{
+ bDDTimerStarted = FALSE;
+ aTimer.Stop();
+ aTimer.SetTimeout(240);
+ bMBPressed = FALSE;
+ ReleaseMouse();
+ bFrmDrag = FALSE;
+
+ if ( rView.GetViewFrame() )
+ {
+ bExecuteDrag = TRUE;
+ StartExecuteDrag();
+ }
+ return 0;
+}
+
+
+
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
new file mode 100644
index 000000000000..e3991352b0b3
--- /dev/null
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -0,0 +1,5799 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <tools/list.hxx>
+#include <swtypes.hxx>
+#include <hintids.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <com/sun/star/i18n/InputSequenceCheckMode.hpp>
+
+#include <com/sun/star/i18n/UnicodeScript.hpp>
+
+#include <vcl/help.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/cmdevt.h>
+#include <sot/storage.hxx>
+#include <svl/macitem.hxx>
+#include <unotools/securityoptions.hxx>
+#include <basic/sbxvar.hxx>
+#include <svl/ctloptions.hxx>
+#include <basic/sbx.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/ipclient.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/ptitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/langitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdhdl.hxx>
+#include <svx/svdoutl.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/svxacorr.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <editeng/flditem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/protitem.hxx>
+#include <unotools/charclass.hxx>
+
+#include <editeng/acorrcfg.hxx>
+#include <SwSmartTagMgr.hxx>
+#include <edtwin.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <IDocumentSettingAccess.hxx>
+#include <fldbas.hxx>
+#include <swmodule.hxx>
+#include <docsh.hxx>
+#include <viewopt.hxx>
+#include <drawbase.hxx>
+#include <dselect.hxx>
+#include <textsh.hxx>
+#include <shdwcrsr.hxx>
+#include <fmtanchr.hxx>
+#include <fmtornt.hxx>
+#include <fmtfsize.hxx>
+#include <fmtclds.hxx>
+#include <frmfmt.hxx>
+#include <modcfg.hxx>
+#include <fmtcol.hxx>
+#include <wview.hxx>
+#include <listsh.hxx>
+#include <gloslst.hxx>
+#include <inputwin.hxx>
+#include <gloshdl.hxx>
+#include <swundo.hxx>
+#include <drwtxtsh.hxx>
+#include <fchrfmt.hxx>
+#include <fmturl.hxx>
+#include <romenu.hxx>
+#include <initui.hxx>
+#include <frmatr.hxx>
+#include <extinput.hxx>
+#include <acmplwrd.hxx>
+#include <swcalwrp.hxx>
+#include <swdtflvr.hxx>
+#include <wdocsh.hxx>
+#include <crsskip.hxx>
+#include <breakit.hxx>
+#include <checkit.hxx>
+
+#include <helpid.h>
+#include <cmdid.h>
+#ifndef _DOCVW_HRC
+#include <docvw.hrc>
+#endif
+#include <uitool.hxx>
+// OD 18.09.2003 #i18732#
+#include <fmtfollowtextflow.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <charfmt.hxx>
+#include <numrule.hxx>
+#include <pagedesc.hxx>
+#include <svtools/ruler.hxx> // #i23726#
+#include "formatclipboard.hxx"
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+#include <IMark.hxx>
+#include <doc.hxx>
+#include <xmloff/odffields.hxx>
+
+#include <PostItMgr.hxx>
+
+//JP 11.10.2001: enable test code for bug fix 91313
+#if defined(DBG_UTIL) && (OSL_DEBUG_LEVEL > 1)
+//#define TEST_FOR_BUG91313
+#endif
+
+using namespace sw::mark;
+using namespace ::com::sun::star;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Globals
+ --------------------------------------------------------------------*/
+
+static bool bInputLanguageSwitched = false;
+extern BOOL bNoInterrupt; // in mainwn.cxx
+
+//Normalerweise wird im MouseButtonUp eine Selektion aufgehoben wenn die
+//Selektion nicht gerade aufgezogen wird. Leider wird im MouseButtonDown
+//bei doppel-/dreifach-Klick Selektiert, diese Selektion wird in dem Handler
+//komplett abgeschlossen und kann deshalb im Up nicht mehr unterschieden
+//werden. Um dies Aufzuloese wird bHoldSelection im Down gesetzt und im
+//Up ausgewertet.
+static BOOL bHoldSelection = FALSE;
+
+BOOL bFrmDrag = FALSE;
+BOOL bValidCrsrPos = FALSE;
+BOOL bModePushed = FALSE;
+BOOL bDDTimerStarted = FALSE;
+BOOL bFlushCharBuffer = FALSE;
+BOOL SwEditWin::bReplaceQuote = FALSE;
+BOOL bDDINetAttr = FALSE;
+SdrHdlKind eSdrMoveHdl = HDL_USER;
+
+QuickHelpData* SwEditWin::pQuickHlpData = 0;
+
+long SwEditWin::nDDStartPosY = 0;
+long SwEditWin::nDDStartPosX = 0;
+Color SwEditWin::aTextBackColor(COL_YELLOW);
+Color SwEditWin::aTextColor(COL_RED);
+BOOL SwEditWin::bTransparentBackColor = FALSE; // Hintergrund nicht transparent
+
+
+extern BOOL bExecuteDrag;
+
+SfxShell* lcl_GetShellFromDispatcher( SwView& rView, TypeId nType );
+
+DBG_NAME(edithdl)
+
+class SwAnchorMarker
+{
+ SdrHdl* pHdl;
+ Point aHdlPos;
+ Point aLastPos;
+ // --> OD 2010-09-16 #i114522#
+ bool bTopRightHandle;
+ // <--
+public:
+ SwAnchorMarker( SdrHdl* pH )
+ : pHdl( pH )
+ , aHdlPos( pH->GetPos() )
+ , aLastPos( pH->GetPos() )
+ // --> OD 2010-09-16 #i114522#
+ , bTopRightHandle( pH->GetKind() == HDL_ANCHOR_TR )
+ // <--
+ {}
+ const Point& GetLastPos() const { return aLastPos; }
+ void SetLastPos( const Point& rNew ) { aLastPos = rNew; }
+ void SetPos( const Point& rNew ) { pHdl->SetPos( rNew ); }
+ const Point& GetPos() { return pHdl->GetPos(); }
+ const Point& GetHdlPos() { return aHdlPos; }
+ void ChgHdl( SdrHdl* pNew )
+ {
+ pHdl = pNew;
+ // --> OD 2010-09-16 #i114522#
+ if ( pHdl )
+ {
+ bTopRightHandle = (pHdl->GetKind() == HDL_ANCHOR_TR);
+ }
+ // <--
+ }
+ // --> OD 2010-09-16 #i114522#
+ const Point GetPosForHitTest( const OutputDevice& rOut )
+ {
+ Point aHitTestPos( GetPos() );
+ aHitTestPos = rOut.LogicToPixel( aHitTestPos );
+ if ( bTopRightHandle )
+ {
+ aHitTestPos += Point( -1, 1 );
+ }
+ else
+ {
+ aHitTestPos += Point( 1, 1 );
+ }
+ aHitTestPos = rOut.PixelToLogic( aHitTestPos );
+
+ return aHitTestPos;
+ }
+ // <--
+};
+
+struct QuickHelpData
+{
+ SvStringsISortDtor aArr;
+ USHORT* pAttrs;
+ CommandExtTextInputData* pCETID;
+ ULONG nTipId;
+ USHORT nLen, nCurArrPos;
+ BOOL bClear : 1, bChkInsBlank : 1, bIsTip : 1, bIsAutoText : 1;
+
+ QuickHelpData() : pAttrs( 0 ), pCETID( 0 ) { ClearCntnt(); }
+
+ void Move( QuickHelpData& rCpy );
+ void ClearCntnt();
+ void Start( SwWrtShell& rSh, USHORT nWrdLen );
+ void Stop( SwWrtShell& rSh );
+
+ BOOL HasCntnt() const { return aArr.Count() && 0 != nLen; }
+
+ void Inc( BOOL bEndLess )
+ {
+ if( ++nCurArrPos >= aArr.Count() )
+ nCurArrPos = (bEndLess && !bIsAutoText )? 0 : nCurArrPos-1;
+ }
+ void Dec( BOOL bEndLess )
+ {
+ if( 0 == nCurArrPos-- )
+ nCurArrPos = (bEndLess && !bIsAutoText ) ? aArr.Count()-1 : 0;
+ }
+ void FillStrArr( SwWrtShell& rSh, const String& rWord );
+};
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Minimale Bewegung Zittern vermeiden
+ --------------------------------------------------------------------*/
+
+#define HIT_PIX 2 /* Hit-Toleranz in Pixel */
+#define MIN_MOVE 4
+
+inline BOOL IsMinMove(const Point &rStartPos, const Point &rLPt)
+{
+ return Abs(rStartPos.X() - rLPt.X()) > MIN_MOVE ||
+ Abs(rStartPos.Y() - rLPt.Y()) > MIN_MOVE;
+}
+
+/*--------------------------------------------------------------------
+ JP 30.07.98: fuer MouseButtonDown - feststellen, ob ein DrawObject
+ und KEIN SwgFrame getroffen wurde! Shift/Ctrl sollen
+ nur bei DrawObjecte zum Selektieren fuehren, bei SwgFlys
+ ggfs zum ausloesen von Hyperlinks (DownLoad/NewWindow!)
+ --------------------------------------------------------------------*/
+inline BOOL IsDrawObjSelectable( const SwWrtShell& rSh, const Point& rPt )
+{
+ BOOL bRet = TRUE;
+ SdrObject* pObj;
+ switch( rSh.GetObjCntType( rPt, pObj ))
+ {
+ case OBJCNT_NONE:
+ case OBJCNT_FLY:
+ case OBJCNT_GRF:
+ case OBJCNT_OLE:
+ bRet = FALSE;
+ break;
+ default:; //prevent warning
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Pointer umschalten
+ --------------------------------------------------------------------*/
+
+
+void SwEditWin::UpdatePointer(const Point &rLPt, USHORT nModifier )
+{
+ SwWrtShell &rSh = rView.GetWrtShell();
+ if( pApplyTempl )
+ {
+ PointerStyle eStyle = POINTER_FILL;
+ if( rSh.IsOverReadOnlyPos( rLPt ))
+ {
+ if( pUserMarker )
+ {
+ delete pUserMarker;
+ pUserMarker = 0L;
+ }
+// rSh.SwCrsrShell::UnSetVisCrsr( rLPt );
+ eStyle = POINTER_NOTALLOWED;
+ }
+ else
+ {
+ SwRect aRect;
+ SwRect* pRect = &aRect;
+ const SwFrmFmt* pFmt = 0;
+
+ bool bFrameIsValidTarget = false;
+ if( pApplyTempl->pFormatClipboard )
+ bFrameIsValidTarget = pApplyTempl->pFormatClipboard->HasContentForThisType( nsSelectionType::SEL_FRM );
+ else if( !pApplyTempl->nColor )
+ bFrameIsValidTarget = ( pApplyTempl->eType == SFX_STYLE_FAMILY_FRAME );
+
+ if( bFrameIsValidTarget &&
+ 0 !=(pFmt = rSh.GetFmtFromObj( rLPt, &pRect )) &&
+ PTR_CAST(SwFlyFrmFmt, pFmt))
+ {
+ //Highlight fuer Rahmen anwerfen
+ Rectangle aTmp( pRect->SVRect() );
+
+ if ( !pUserMarker )
+ {
+ pUserMarker = new SdrDropMarkerOverlay( *rSh.GetDrawView(), aTmp );
+ }
+ }
+ else if(pUserMarker)
+ {
+ delete pUserMarker;
+ pUserMarker = 0L;
+ }
+
+ rSh.SwCrsrShell::SetVisCrsr( rLPt );
+ }
+ SetPointer( eStyle );
+ return;
+ }
+
+ if( !rSh.VisArea().Width() )
+ return;
+
+ SET_CURR_SHELL(&rSh);
+
+ if ( IsChainMode() )
+ {
+ SwRect aRect;
+ int nChainable = rSh.Chainable( aRect, *rSh.GetFlyFrmFmt(), rLPt );
+ PointerStyle eStyle = nChainable
+ ? POINTER_CHAIN_NOTALLOWED : POINTER_CHAIN;
+ if ( !nChainable )
+ {
+ Rectangle aTmp( aRect.SVRect() );
+
+ if ( !pUserMarker )
+ {
+ pUserMarker = new SdrDropMarkerOverlay( *rSh.GetDrawView(), aTmp );
+ }
+ }
+ else
+ {
+ delete pUserMarker;
+ pUserMarker = 0L;
+ }
+
+ rView.GetViewFrame()->ShowStatusText(
+ SW_RESSTR(STR_CHAIN_OK+nChainable));
+ SetPointer( eStyle );
+ return;
+ }
+
+ // Removed ExecHyperlink option.
+ //BOOL bExecHyperlinks = rSh.GetViewOptions()->IsExecHyperlinks() ^
+ // (nModifier == KEY_MOD2 ? TRUE : FALSE);
+ BOOL bExecHyperlinks = rView.GetDocShell()->IsReadOnly();
+ if ( !bExecHyperlinks )
+ {
+ SvtSecurityOptions aSecOpts;
+ const BOOL bSecureOption = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK );
+ if ( ( bSecureOption && nModifier == KEY_MOD1 ) ||
+ ( !bSecureOption && nModifier != KEY_MOD1 ) )
+ bExecHyperlinks = TRUE;
+ }
+
+ const BOOL bExecSmarttags = nModifier == KEY_MOD1;
+
+ SdrView *pSdrView = rSh.GetDrawView();
+ BOOL bPrefSdrPointer = FALSE;
+ BOOL bHitHandle = FALSE;
+ BOOL bCntAtPos = FALSE;
+ BOOL bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() &&
+ rSh.IsCrsrReadonly();
+ aActHitType = SDRHIT_NONE;
+ PointerStyle eStyle = POINTER_TEXT;
+ if ( !pSdrView )
+ bCntAtPos = TRUE;
+ else if ( TRUE == (bHitHandle = pSdrView->PickHandle( rLPt ) != 0) )
+ {
+ aActHitType = SDRHIT_OBJECT;
+ bPrefSdrPointer = TRUE;
+ }
+ else
+ {
+ const BOOL bNotInSelObj = !rSh.IsInsideSelectedObj( rLPt );
+ if ( rView.GetDrawFuncPtr() && !bInsDraw && bNotInSelObj )
+ {
+ aActHitType = SDRHIT_OBJECT;
+ if (IsObjectSelect())
+ eStyle = POINTER_ARROW;
+ else
+ bPrefSdrPointer = TRUE;
+ }
+ else
+ {
+ SdrObject* pObj; SdrPageView* pPV;
+ pSdrView->SetHitTolerancePixel( HIT_PIX );
+ if ( bNotInSelObj && bExecHyperlinks &&
+ pSdrView->PickObj( rLPt, pSdrView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO ))
+ {
+ SdrObjMacroHitRec aTmp;
+ aTmp.aPos = rLPt;
+ aTmp.pPageView = pPV;
+ SetPointer( pObj->GetMacroPointer( aTmp ) );
+ return;
+ }
+ else
+ {
+ // dvo: IsObjSelectable() eventually calls SdrView::PickObj, so
+ // apparently this is used to determine whether this is a
+ // drawling layer object or not.
+ if ( rSh.IsObjSelectable( rLPt ) )
+ {
+ if (pSdrView->IsTextEdit())
+ {
+ aActHitType = SDRHIT_NONE;
+ bPrefSdrPointer = TRUE;
+ }
+ else
+ {
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = pSdrView->PickAnything(rLPt, aVEvt);
+
+ if (eHit == SDRHIT_URLFIELD && bExecHyperlinks)
+ {
+ aActHitType = SDRHIT_OBJECT;
+ bPrefSdrPointer = TRUE;
+ }
+ else
+ {
+ // if we're over a selected object, we show an
+ // ARROW by default. We only show a MOVE if 1) the
+ // object is selected, and 2) it may be moved
+ // (i.e., position is not protected).
+ bool bMovable =
+ (!bNotInSelObj) &&
+ (rSh.IsObjSelected() || rSh.IsFrmSelected()) &&
+ (!rSh.IsSelObjProtected(FLYPROTECT_POS));
+
+ eStyle = bMovable ? POINTER_MOVE : POINTER_ARROW;
+ aActHitType = SDRHIT_OBJECT;
+ }
+ }
+ }
+ else
+ {
+ if ( rSh.IsFrmSelected() && !bNotInSelObj )
+ {
+ // dvo: this branch appears to be dead and should be
+ // removed in a future version. Reason: The condition
+ // !bNotInSelObj means that this branch will only be
+ // executed in the cursor points inside a selected
+ // object. However, if this is the case, the previous
+ // if( rSh.IsObjSelectable(rLPt) ) must always be true:
+ // rLPt is inside a selected object, then obviously
+ // rLPt is over a selectable object.
+ if (rSh.IsSelObjProtected(FLYPROTECT_SIZE))
+ eStyle = POINTER_NOTALLOWED;
+ else
+ eStyle = POINTER_MOVE;
+ aActHitType = SDRHIT_OBJECT;
+ }
+ else
+ {
+ if ( rView.GetDrawFuncPtr() )
+ bPrefSdrPointer = TRUE;
+ else
+ bCntAtPos = TRUE;
+ }
+ }
+ }
+ }
+ }
+ if ( bPrefSdrPointer )
+ {
+ if (bIsDocReadOnly || (rSh.IsObjSelected() && rSh.IsSelObjProtected(FLYPROTECT_CONTENT)))
+ SetPointer( POINTER_NOTALLOWED );
+ else
+ {
+ if (rView.GetDrawFuncPtr() && rView.GetDrawFuncPtr()->IsInsertForm() && !bHitHandle)
+ SetPointer( POINTER_DRAW_RECT );
+ else
+ SetPointer( pSdrView->GetPreferedPointer( rLPt, rSh.GetOut() ) );
+ }
+ }
+ else
+ {
+ if( !rSh.IsPageAtPos( rLPt ) || pAnchorMarker )
+ eStyle = POINTER_ARROW;
+ else
+ {
+ if( bCntAtPos )
+ {
+ SwContentAtPos aSwContentAtPos(
+ SwContentAtPos::SW_CLICKFIELD|
+ SwContentAtPos::SW_INETATTR|
+ SwContentAtPos::SW_FTN |
+ SwContentAtPos::SW_SMARTTAG );
+ if( rSh.GetContentAtPos( rLPt, aSwContentAtPos) )
+ {
+ const bool bClickToFollow = SwContentAtPos::SW_INETATTR == aSwContentAtPos.eCntntAtPos ||
+ SwContentAtPos::SW_SMARTTAG == aSwContentAtPos.eCntntAtPos;
+
+ if( !bClickToFollow ||
+ (SwContentAtPos::SW_INETATTR == aSwContentAtPos.eCntntAtPos && bExecHyperlinks) ||
+ (SwContentAtPos::SW_SMARTTAG == aSwContentAtPos.eCntntAtPos && bExecSmarttags) )
+ eStyle = POINTER_REFHAND;
+ }
+ }
+ }
+
+ // which kind of text pointer have we to show - horz / vert - ?
+ if( POINTER_TEXT == eStyle && rSh.IsInVerticalText( &rLPt ))
+ eStyle = POINTER_TEXT_VERTICAL;
+
+ SetPointer( eStyle );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Timer fuer Selektion vergroessern
+ --------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwEditWin, TimerHandler, Timer *, EMPTYARG )
+{
+ DBG_PROFSTART(edithdl);
+
+ SwWrtShell &rSh = rView.GetWrtShell();
+ Point aModPt( aMovePos );
+ const SwRect aOldVis( rSh.VisArea() );
+ BOOL bDone = FALSE;
+
+ if ( !rSh.VisArea().IsInside( aModPt ) )
+ {
+ if ( bInsDraw )
+ {
+ const int nMaxScroll = 40;
+ rView.Scroll( Rectangle(aModPt,Size(1,1)), nMaxScroll, nMaxScroll);
+ bDone = TRUE;
+ }
+ else if ( bFrmDrag )
+ {
+ (rSh.*rSh.fnDrag)(&aModPt,FALSE);
+ bDone = TRUE;
+ }
+ if ( !bDone )
+ aModPt = rSh.GetCntntPos( aModPt,aModPt.Y() > rSh.VisArea().Bottom() );
+ }
+ if ( !bDone && !(bFrmDrag || bInsDraw) )
+ {
+ if ( pRowColumnSelectionStart )
+ {
+ Point aPos( aModPt );
+ rSh.SelectTableRowCol( *pRowColumnSelectionStart, &aPos, bIsRowDrag );
+ }
+ else
+ (rSh.*rSh.fnSetCrsr)( &aModPt, FALSE );
+
+ //fix(24138): Es kann sein, dass der "Sprung" ueber eine Tabelle so
+ //nicht geschafft wird. Deshalb wir hier eben per Up/Down ueber die
+ //Tabelle gesprungen.
+ const SwRect& rVisArea = rSh.VisArea();
+ if( aOldVis == rVisArea && !rSh.IsStartOfDoc() && !rSh.IsEndOfDoc() )
+ {
+ //JP 11.10.2001 Bug 72294 - take the center point of VisArea to
+ // decide in which direction the user want.
+ if( aModPt.Y() < ( rVisArea.Top() + rVisArea.Height() / 2 ) )
+ rSh.Up( TRUE, 1 );
+ else
+ rSh.Down( TRUE, 1 );
+ }
+ }
+
+ aMovePos += rSh.VisArea().Pos() - aOldVis.Pos();
+ JustifyAreaTimer();
+ DBG_PROFSTOP(edithdl);
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwEditWin::JustifyAreaTimer()
+{
+ const Rectangle &rVisArea = GetView().GetVisArea();
+#ifdef UNX
+ const long coMinLen = 100;
+#else
+ const long coMinLen = 50;
+#endif
+ long nTimeout = 800,
+ nDiff = Max(
+ Max( aMovePos.Y() - rVisArea.Bottom(), rVisArea.Top() - aMovePos.Y() ),
+ Max( aMovePos.X() - rVisArea.Right(), rVisArea.Left() - aMovePos.X()));
+#ifdef TEST_FOR_BUG91313
+ aTimer.SetTimeout( Max( coMinLen, nTimeout - nDiff) );
+#else
+ aTimer.SetTimeout( Max( coMinLen, nTimeout - nDiff*2L) );
+#endif
+}
+
+void SwEditWin::LeaveArea(const Point &rPos)
+{
+ aMovePos = rPos;
+ JustifyAreaTimer();
+ if( !aTimer.IsActive() )
+ aTimer.Start();
+ if( pShadCrsr )
+ delete pShadCrsr, pShadCrsr = 0;
+}
+
+inline void SwEditWin::EnterArea()
+{
+ aTimer.Stop();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Modus fuer Rahmen einfuegen
+------------------------------------------------------------------------*/
+
+
+void SwEditWin::InsFrm(USHORT nCols)
+{
+ StdDrawMode( OBJ_NONE, FALSE );
+ bInsFrm = TRUE;
+ nInsFrmColCount = nCols;
+}
+
+
+
+void SwEditWin::StdDrawMode( SdrObjKind eSdrObjectKind, BOOL bObjSelect )
+{
+ SetSdrDrawMode( eSdrObjectKind );
+
+/* if (GetDrawFuncPtr())
+ GetDrawFuncPtr()->Deactivate();*/
+
+ if (bObjSelect)
+ rView.SetDrawFuncPtr(new DrawSelection( &rView.GetWrtShell(), this, &rView ));
+ else
+ rView.SetDrawFuncPtr(new SwDrawBase( &rView.GetWrtShell(), this, &rView ));
+
+ rView.SetSelDrawSlot();
+ SetSdrDrawMode( eSdrObjectKind );
+ if (bObjSelect)
+ rView.GetDrawFuncPtr()->Activate( SID_OBJECT_SELECT );
+ else
+ rView.GetDrawFuncPtr()->Activate( sal::static_int_cast< USHORT >(eSdrObjectKind) ); // don't know if this is useful at all; but it keeps functionality as it was...
+ bInsFrm = FALSE;
+ nInsFrmColCount = 1;
+}
+
+
+
+void SwEditWin::StopInsFrm()
+{
+ if (rView.GetDrawFuncPtr())
+ {
+ rView.GetDrawFuncPtr()->Deactivate();
+ rView.SetDrawFuncPtr(NULL);
+ }
+ rView.LeaveDrawCreate(); // Konstruktionsmode verlassen
+ bInsFrm = FALSE;
+ nInsFrmColCount = 1;
+}
+
+/*--------------------------------------------------------------------
+ --------------------------------------------------------------------*/
+
+
+BOOL SwEditWin::IsInputSequenceCheckingRequired( const String &rText, const SwPaM& rCrsr ) const
+{
+ const SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions();
+ if ( !rCTLOptions.IsCTLFontEnabled() ||
+ !rCTLOptions.IsCTLSequenceChecking() )
+ return FALSE;
+
+ const xub_StrLen nFirstPos = rCrsr.Start()->nContent.GetIndex();
+ if ( 0 == nFirstPos ) /* first char needs not to be checked */
+ return FALSE;
+
+ SwBreakIt *pBreakIter = SwBreakIt::Get();
+ uno::Reference < i18n::XBreakIterator > xBI = pBreakIter->GetBreakIter();
+ long nCTLScriptPos = -1;
+
+ if (xBI.is())
+ {
+ if (xBI->getScriptType( rText, 0 ) == i18n::ScriptType::COMPLEX)
+ nCTLScriptPos = 0;
+ else
+ nCTLScriptPos = xBI->nextScript( rText, 0, i18n::ScriptType::COMPLEX );
+ }
+
+ return (0 <= nCTLScriptPos && nCTLScriptPos <= rText.Len());
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Der Character Buffer wird in das Dokument eingefuegt
+ --------------------------------------------------------------------*/
+
+
+void SwEditWin::FlushInBuffer()
+{
+ if ( aInBuffer.Len() )
+ {
+ SwWrtShell& rSh = rView.GetWrtShell();
+
+ // generate new sequence input checker if not already done
+ if ( !pCheckIt )
+ pCheckIt = new SwCheckIt;
+
+ uno::Reference < i18n::XExtendedInputSequenceChecker > xISC = pCheckIt->xCheck;
+ if ( xISC.is() && IsInputSequenceCheckingRequired( aInBuffer, *rSh.GetCrsr() ) )
+ {
+ //
+ // apply (Thai) input sequence checking/correction
+ //
+
+ rSh.Push(); // push current cursor to stack
+
+ // get text from the beginning (i.e left side) of current selection
+ // to the start of the paragraph
+ rSh.NormalizePam(); // make point be the first (left) one
+ if (!rSh.GetCrsr()->HasMark())
+ rSh.GetCrsr()->SetMark();
+ rSh.GetCrsr()->GetMark()->nContent = 0;
+ String aLeftText( rSh.GetCrsr()->GetTxt() );
+
+ SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions();
+
+ xub_StrLen nExpandSelection = 0;
+ if (aLeftText.Len() > 0)
+ {
+ sal_Unicode cChar = '\0';
+
+ xub_StrLen nTmpPos = aLeftText.Len();
+ sal_Int16 nCheckMode = rCTLOptions.IsCTLSequenceCheckingRestricted() ?
+ i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC;
+
+ rtl::OUString aOldText( aLeftText );
+ rtl::OUString aNewText( aOldText );
+ if (rCTLOptions.IsCTLSequenceCheckingTypeAndReplace())
+ {
+ for (xub_StrLen k = 0; k < aInBuffer.Len(); ++k)
+ {
+ cChar = aInBuffer.GetChar(k);
+ const xub_StrLen nPrevPos = static_cast<xub_StrLen>(xISC->correctInputSequence( aNewText, nTmpPos - 1, cChar, nCheckMode ));
+
+ // valid sequence or sequence could be corrected:
+ if (nPrevPos != aNewText.getLength())
+ nTmpPos = nPrevPos + 1;
+ }
+
+ // find position of first character that has changed
+ sal_Int32 nOldLen = aOldText.getLength();
+ sal_Int32 nNewLen = aNewText.getLength();
+ const sal_Unicode *pOldTxt = aOldText.getStr();
+ const sal_Unicode *pNewTxt = aNewText.getStr();
+ sal_Int32 nChgPos = 0;
+ while ( nChgPos < nOldLen && nChgPos < nNewLen &&
+ pOldTxt[nChgPos] == pNewTxt[nChgPos] )
+ ++nChgPos;
+
+ xub_StrLen nChgLen = static_cast< xub_StrLen >(nNewLen - nChgPos);
+ String aChgText( aNewText.copy( static_cast< xub_StrLen >(nChgPos), nChgLen ) );
+
+ if (aChgText.Len())
+ {
+ aInBuffer = aChgText;
+ nExpandSelection = aLeftText.Len() - static_cast< xub_StrLen >(nChgPos);
+ }
+ else
+ aInBuffer.Erase();
+ }
+ else
+ {
+ for (xub_StrLen k = 0; k < aInBuffer.Len(); ++k)
+ {
+ cChar = aInBuffer.GetChar(k);
+ if (xISC->checkInputSequence( aNewText, nTmpPos - 1, cChar, nCheckMode ))
+ {
+ // character can be inserted:
+ aNewText += rtl::OUString( (sal_Unicode) cChar );
+ ++nTmpPos;
+ }
+ }
+ aInBuffer = aNewText.copy( aOldText.getLength() ); // copy new text to be inserted to buffer
+ }
+ }
+
+ // at this point now we will insert the buffer text 'normally' some lines below...
+
+ rSh.Pop( FALSE ); // pop old cursor from stack
+
+ if (!aInBuffer.Len())
+ return;
+
+ // if text prior to the original selection needs to be changed
+ // as well, we now expand the selection accordingly.
+ SwPaM &rCrsr = *rSh.GetCrsr();
+ xub_StrLen nCrsrStartPos = rCrsr.Start()->nContent.GetIndex();
+ DBG_ASSERT( nCrsrStartPos >= nExpandSelection, "cannot expand selection as specified!!" );
+ if (nExpandSelection && nCrsrStartPos >= nExpandSelection)
+ {
+ if (!rCrsr.HasMark())
+ rCrsr.SetMark();
+ rCrsr.Start()->nContent -= nExpandSelection;
+ }
+ }
+
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ rView.GetViewFrame()->GetBindings().GetRecorder();
+ if ( xRecorder.is() )
+ {
+ //Shell ermitteln
+ SfxShell *pSfxShell = lcl_GetShellFromDispatcher( rView, TYPE(SwTextShell) );
+ // Request generieren und recorden
+ if (pSfxShell)
+ {
+ SfxRequest aReq( rView.GetViewFrame(), FN_INSERT_STRING );
+ aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, aInBuffer ) );
+ aReq.Done();
+ }
+ }
+ //#21019# apply CTL and CJK language to the text input
+ sal_Bool bLang = true;
+ if(eBufferLanguage != LANGUAGE_DONTKNOW)
+ {
+ USHORT nWhich = 0;
+ switch( GetI18NScriptTypeOfLanguage( eBufferLanguage ))
+ {
+ case i18n::ScriptType::ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break;
+ case i18n::ScriptType::COMPLEX: nWhich = RES_CHRATR_CTL_LANGUAGE; break;
+ case i18n::ScriptType::LATIN: nWhich = RES_CHRATR_LANGUAGE; break;
+ default: bLang = sal_False;
+ }
+ if(bLang)
+ {
+ SfxItemSet aLangSet(rView.GetPool(), nWhich, nWhich);
+ rSh.GetCurAttr(aLangSet);
+ if(SFX_ITEM_DEFAULT <= aLangSet.GetItemState(nWhich, TRUE))
+ {
+ LanguageType eLang = static_cast<const SvxLanguageItem&>(aLangSet.Get(nWhich)).GetLanguage();
+ if ( eLang == eBufferLanguage )
+ // current language attribute equal to language reported from system
+ bLang = sal_False;
+ else if ( !bInputLanguageSwitched && RES_CHRATR_LANGUAGE == nWhich /* && (eLang&LANGUAGE_MASK_PRIMARY) == LANGUAGE_ENGLISH */ )
+ {
+ // special case: switching between two "LATIN" languages
+ // In case the current keyboard setting might be suitable for both languages we can't safely assume that the user
+ // wants to use the language reported from the system, except if we knew that it was explicitly switched (thus the check for "bInputLangeSwitched").
+ // The language reported by the system could be just the system default language that the user is not even aware of,
+ // because no language selection tool is installed at all. In this case the OOo language should get preference as
+ // it might have been selected by the user explicitly.
+ // Usually this case happens if the OOo language is different to the system language but the system keyboard is still suitable
+ // for the OOo language (e.g. writing English texts with a German keyboard).
+ // For non-latin keyboards overwriting the attribute is still valid. We do this for kyrillic and greek ATM.
+ // In future versions of OOo this should be replaced by a configuration switch that allows to give the preference to
+ // the OOo setting or the system setting explicitly and/or a better handling of the script type.
+ sal_Int16 nScript = GetAppCharClass().getScript( aInBuffer, 0 );
+ i18n::UnicodeScript eType = (i18n::UnicodeScript) nScript;
+
+ bool bSystemIsNonLatin = false, bOOoLangIsNonLatin = false;
+ switch ( eType )
+ {
+ case i18n::UnicodeScript_kGreek:
+ case i18n::UnicodeScript_kCyrillic:
+ // in case other UnicodeScripts require special keyboards they can be added here
+ bSystemIsNonLatin = true;
+ break;
+ default:
+ break;
+ }
+
+ switch ( eLang )
+ {
+ case LANGUAGE_AZERI_CYRILLIC:
+ case LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA:
+ case LANGUAGE_BULGARIAN:
+ case LANGUAGE_GREEK:
+ case LANGUAGE_RUSSIAN:
+ case LANGUAGE_RUSSIAN_MOLDOVA:
+ case LANGUAGE_SERBIAN_CYRILLIC:
+ case LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA:
+ case LANGUAGE_UZBEK_CYRILLIC:
+ case LANGUAGE_UKRAINIAN:
+ case LANGUAGE_BELARUSIAN:
+ bOOoLangIsNonLatin = true;
+ break;
+ default:
+ break;
+ }
+
+ bLang = (bSystemIsNonLatin != bOOoLangIsNonLatin);
+ }
+ }
+ if(bLang)
+ {
+ SvxLanguageItem aLangItem( eBufferLanguage, nWhich );
+ rSh.SetAttr( aLangItem );
+ }
+ }
+ }
+
+ rSh.Insert( aInBuffer );
+ eBufferLanguage = LANGUAGE_DONTKNOW;
+ aInBuffer.Erase();
+ bFlushCharBuffer = FALSE;
+ }
+}
+
+#define MOVE_LEFT_SMALL 0
+#define MOVE_UP_SMALL 1
+#define MOVE_RIGHT_BIG 2
+#define MOVE_DOWN_BIG 3
+#define MOVE_LEFT_BIG 4
+#define MOVE_UP_BIG 5
+#define MOVE_RIGHT_SMALL 6
+#define MOVE_DOWN_SMALL 7
+
+void SwEditWin::ChangeFly( BYTE nDir, BOOL bWeb )
+{
+ SwWrtShell &rSh = rView.GetWrtShell();
+ SwRect aTmp = rSh.GetFlyRect();
+ if( aTmp.HasArea() &&
+ // --> FME 2005-01-13 #i40348#
+ // IsSelObjProtected() seems to be the correct condition, not
+ // !HasReadonlySel(), otherwise frame is not moveable if content is
+ // protected.
+ !rSh.IsSelObjProtected( FLYPROTECT_POS|FLYPROTECT_SIZE ) )
+ // <--
+ {
+ // OD 18.09.2003 #i18732# - add item <RES_FOLLOW_TEXT_FLOW>
+ SfxItemSet aSet(rSh.GetAttrPool(),
+ RES_FRM_SIZE, RES_FRM_SIZE,
+ RES_VERT_ORIENT, RES_ANCHOR,
+ RES_COL, RES_COL,
+ RES_PROTECT, RES_PROTECT,
+ RES_FOLLOW_TEXT_FLOW, RES_FOLLOW_TEXT_FLOW, 0);
+ rSh.GetFlyFrmAttr( aSet );
+ RndStdIds eAnchorId = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
+ Size aSnap;
+ if(MOVE_LEFT_SMALL == nDir ||
+ MOVE_UP_SMALL == nDir ||
+ MOVE_RIGHT_SMALL == nDir ||
+ MOVE_DOWN_SMALL == nDir )
+ aSnap = PixelToLogic(Size(1,1));
+ else
+ {
+ aSnap = rSh.GetViewOptions()->GetSnapSize();
+ short nDiv = rSh.GetViewOptions()->GetDivisionX();
+ if ( nDiv > 0 )
+ aSnap.Width() = Max( (ULONG)1, (ULONG)aSnap.Width() / nDiv );
+ nDiv = rSh.GetViewOptions()->GetDivisionY();
+ if ( nDiv > 0 )
+ aSnap.Height() = Max( (ULONG)1, (ULONG)aSnap.Height() / nDiv );
+ }
+
+ SwRect aBoundRect;
+ Point aRefPoint;
+ // OD 18.09.2003 #i18732# - adjustment for allowing vertical position
+ // aligned to page for fly frame anchored to paragraph or to character.
+ {
+ SwFmtVertOrient aVert( (SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT) );
+ const bool bFollowTextFlow =
+ static_cast<const SwFmtFollowTextFlow&>(aSet.Get(RES_FOLLOW_TEXT_FLOW)).GetValue();
+ // OD 12.11.2003 #i22341# - additional provide content position
+ const SwPosition* pToCharCntntPos = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetCntntAnchor();
+ rSh.CalcBoundRect( aBoundRect, eAnchorId,
+ text::RelOrientation::FRAME, aVert.GetRelationOrient(),
+ pToCharCntntPos, bFollowTextFlow,
+ false, &aRefPoint );
+ }
+ long nLeft = Min( aTmp.Left() - aBoundRect.Left(), aSnap.Width() );
+ long nRight = Min( aBoundRect.Right() - aTmp.Right(), aSnap.Width() );
+ long nUp = Min( aTmp.Top() - aBoundRect.Top(), aSnap.Height() );
+ long nDown = Min( aBoundRect.Bottom() - aTmp.Bottom(), aSnap.Height() );
+
+ switch ( nDir )
+ {
+ case MOVE_LEFT_BIG:
+ case MOVE_LEFT_SMALL: aTmp.Left( aTmp.Left() - nLeft ); break;
+ case MOVE_UP_BIG:
+ case MOVE_UP_SMALL: aTmp.Top( aTmp.Top() - nUp ); break;
+ case MOVE_RIGHT_SMALL: if( aTmp.Width() < aSnap.Width() + MINFLY ) break;
+ nRight = aSnap.Width(); // kein break
+ case MOVE_RIGHT_BIG: aTmp.Left( aTmp.Left() + nRight ); break;
+ case MOVE_DOWN_SMALL: if( aTmp.Height() < aSnap.Height() + MINFLY ) break;
+ nDown = aSnap.Height(); // kein break
+ case MOVE_DOWN_BIG: aTmp.Top( aTmp.Top() + nDown ); break;
+ default: ASSERT( TRUE, "ChangeFly: Unknown direction." );
+ }
+ BOOL bSet = FALSE;
+ if ((FLY_AS_CHAR == eAnchorId) && ( nDir % 2 ))
+ {
+ long aDiff = aTmp.Top() - aRefPoint.Y();
+ if( aDiff > 0 )
+ aDiff = 0;
+ else if ( aDiff < -aTmp.Height() )
+ aDiff = -aTmp.Height();
+ SwFmtVertOrient aVert( (SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT) );
+ sal_Int16 eNew;
+ if( bWeb )
+ {
+ eNew = aVert.GetVertOrient();
+ BOOL bDown = 0 != ( nDir & 0x02 );
+ switch( eNew )
+ {
+ case text::VertOrientation::CHAR_TOP:
+ if( bDown ) eNew = text::VertOrientation::CENTER;
+ break;
+ case text::VertOrientation::CENTER:
+ eNew = bDown ? text::VertOrientation::TOP : text::VertOrientation::CHAR_TOP;
+ break;
+ case text::VertOrientation::TOP:
+ if( !bDown ) eNew = text::VertOrientation::CENTER;
+ break;
+ case text::VertOrientation::LINE_TOP:
+ if( bDown ) eNew = text::VertOrientation::LINE_CENTER;
+ break;
+ case text::VertOrientation::LINE_CENTER:
+ eNew = bDown ? text::VertOrientation::LINE_BOTTOM : text::VertOrientation::LINE_TOP;
+ break;
+ case text::VertOrientation::LINE_BOTTOM:
+ if( !bDown ) eNew = text::VertOrientation::LINE_CENTER;
+ break;
+ default:; //prevent warning
+ }
+ }
+ else
+ {
+ aVert.SetPos( aDiff );
+ eNew = text::VertOrientation::NONE;
+ }
+ aVert.SetVertOrient( eNew );
+ aSet.Put( aVert );
+ bSet = TRUE;
+ }
+ if (bWeb && (FLY_AT_PARA == eAnchorId)
+ && ( nDir==MOVE_LEFT_SMALL || nDir==MOVE_RIGHT_BIG ))
+ {
+ SwFmtHoriOrient aHori( (SwFmtHoriOrient&)aSet.Get(RES_HORI_ORIENT) );
+ sal_Int16 eNew;
+ eNew = aHori.GetHoriOrient();
+ switch( eNew )
+ {
+ case text::HoriOrientation::RIGHT:
+ if( nDir==MOVE_LEFT_SMALL )
+ eNew = text::HoriOrientation::LEFT;
+ break;
+ case text::HoriOrientation::LEFT:
+ if( nDir==MOVE_RIGHT_BIG )
+ eNew = text::HoriOrientation::RIGHT;
+ break;
+ default:; //prevent warning
+ }
+ if( eNew != aHori.GetHoriOrient() )
+ {
+ aHori.SetHoriOrient( eNew );
+ aSet.Put( aHori );
+ bSet = TRUE;
+ }
+ }
+ rSh.StartAllAction();
+ if( bSet )
+ rSh.SetFlyFrmAttr( aSet );
+ BOOL bSetPos = (FLY_AS_CHAR != eAnchorId);
+ if(bSetPos && bWeb)
+ {
+ if (FLY_AT_PAGE != eAnchorId)
+ {
+ bSetPos = FALSE;
+ }
+ else
+ {
+ bSetPos = (::GetHtmlMode(rView.GetDocShell()) & HTMLMODE_SOME_ABS_POS) ?
+ TRUE : FALSE;
+ }
+ }
+ if( bSetPos )
+ rSh.SetFlyPos( aTmp.Pos() );
+ rSh.EndAllAction();
+ }
+}
+/* -----------------------------23.05.2002 11:35------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwEditWin::ChangeDrawing( BYTE nDir )
+{
+ // --> OD 2005-01-31 #i40845# - start undo action in order to get only one
+ // undo action for this change.
+ SwWrtShell &rSh = rView.GetWrtShell();
+ rSh.StartUndo();
+ // <--
+
+ long nX = 0;
+ long nY = 0;
+ sal_Bool bOnePixel = sal_False;
+ USHORT nAnchorDir = SW_MOVE_UP;
+ switch(nDir)
+ {
+ case MOVE_LEFT_SMALL:
+ bOnePixel = sal_True;
+ //no break;
+ case MOVE_LEFT_BIG:
+ nX = -1;
+ nAnchorDir = SW_MOVE_LEFT;
+ break;
+ case MOVE_UP_SMALL:
+ bOnePixel = sal_True;
+ //no break;
+ case MOVE_UP_BIG:
+ nY = -1;
+ break;
+ case MOVE_RIGHT_SMALL:
+ bOnePixel = sal_True;
+ //no break;
+ case MOVE_RIGHT_BIG:
+ nX = +1;
+ nAnchorDir = SW_MOVE_RIGHT;
+ break;
+ case MOVE_DOWN_SMALL:
+ bOnePixel = sal_True;
+ //no break;
+ case MOVE_DOWN_BIG:
+ nY = +1;
+ nAnchorDir = SW_MOVE_DOWN;
+ break;
+ }
+
+ if(0 != nX || 0 != nY)
+ {
+ BYTE nProtect = rSh.IsSelObjProtected( FLYPROTECT_POS|FLYPROTECT_SIZE );
+ Size aSnap( rSh.GetViewOptions()->GetSnapSize() );
+ short nDiv = rSh.GetViewOptions()->GetDivisionX();
+ if ( nDiv > 0 )
+ aSnap.Width() = Max( (ULONG)1, (ULONG)aSnap.Width() / nDiv );
+ nDiv = rSh.GetViewOptions()->GetDivisionY();
+ if ( nDiv > 0 )
+ aSnap.Height() = Max( (ULONG)1, (ULONG)aSnap.Height() / nDiv );
+
+ if(bOnePixel)
+ aSnap = PixelToLogic(Size(1,1));
+
+ nX *= aSnap.Width();
+ nY *= aSnap.Height();
+
+ SdrView *pSdrView = rSh.GetDrawView();
+ const SdrHdlList& rHdlList = pSdrView->GetHdlList();
+ SdrHdl* pHdl = rHdlList.GetFocusHdl();
+ rSh.StartAllAction();
+ if(0L == pHdl)
+ {
+ // now move the selected draw objects
+ // if the object's position is not protected
+ if(0 == (nProtect&FLYPROTECT_POS))
+ {
+ // --> FME 2005-04-26 #i47138#
+ // Check if object is anchored as character and move direction
+ BOOL bDummy;
+ const bool bVertAnchor = rSh.IsFrmVertical( TRUE, bDummy );
+ const bool bHoriMove = !bVertAnchor == !( nDir % 2 );
+ const bool bMoveAllowed =
+ !bHoriMove || (rSh.GetAnchorId() != FLY_AS_CHAR);
+ if ( bMoveAllowed )
+ {
+ // <--
+ pSdrView->MoveAllMarked(Size(nX, nY));
+ rSh.SetModified();
+ }
+ }
+ }
+ else
+ {
+ // move handle with index nHandleIndex
+ if(pHdl && (nX || nY))
+ {
+ if( HDL_ANCHOR == pHdl->GetKind() ||
+ HDL_ANCHOR_TR == pHdl->GetKind() )
+ {
+ // anchor move cannot be allowed when position is protected
+ if(0 == (nProtect&FLYPROTECT_POS))
+ rSh.MoveAnchor( nAnchorDir );
+ }
+ //now resize if size is protected
+ else if(0 == (nProtect&FLYPROTECT_SIZE))
+ {
+ // now move the Handle (nX, nY)
+ Point aStartPoint(pHdl->GetPos());
+ Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
+ const SdrDragStat& rDragStat = pSdrView->GetDragStat();
+
+ // start dragging
+ pSdrView->BegDragObj(aStartPoint, 0, pHdl, 0);
+
+ if(pSdrView->IsDragObj())
+ {
+ BOOL bWasNoSnap = static_cast< BOOL >(rDragStat.IsNoSnap());
+ BOOL bWasSnapEnabled = pSdrView->IsSnapEnabled();
+
+ // switch snapping off
+ if(!bWasNoSnap)
+ ((SdrDragStat&)rDragStat).SetNoSnap(TRUE);
+ if(bWasSnapEnabled)
+ pSdrView->SetSnapEnabled(FALSE);
+
+ pSdrView->MovAction(aEndPoint);
+ pSdrView->EndDragObj();
+ rSh.SetModified();
+
+ // restore snap
+ if(!bWasNoSnap)
+ ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
+ if(bWasSnapEnabled)
+ pSdrView->SetSnapEnabled(bWasSnapEnabled);
+ }
+ }
+ }
+ }
+ rSh.EndAllAction();
+ }
+
+ // --> OD 2005-01-31 #i40845# - end undo action
+ rSh.EndUndo();
+ // <--
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: KeyEvents
+ --------------------------------------------------------------------*/
+
+
+
+void SwEditWin::KeyInput(const KeyEvent &rKEvt)
+{
+ if( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE &&
+ pApplyTempl && pApplyTempl->pFormatClipboard )
+ {
+ pApplyTempl->pFormatClipboard->Erase();
+ SetApplyTemplate(SwApplyTemplate());
+ rView.GetViewFrame()->GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
+ }
+
+ SfxObjectShell *pObjSh = (SfxObjectShell*)rView.GetViewFrame()->GetObjectShell();
+ if ( bLockInput || (pObjSh && pObjSh->GetProgress()) )
+ // Wenn die Rechenleiste aktiv ist oder
+ // auf dem Document ein Progress laeuft wird keine
+ // Bestellungen angenommen.
+ return;
+
+ if( pShadCrsr )
+ delete pShadCrsr, pShadCrsr = 0;
+ aKeyInputFlushTimer.Stop();
+
+ SwWrtShell &rSh = rView.GetWrtShell();
+ BOOL bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() &&
+ rSh.IsCrsrReadonly();
+
+ //if the language changes the buffer must be flushed
+ LanguageType eNewLanguage = GetInputLanguage();
+ if(!bIsDocReadOnly && eBufferLanguage != eNewLanguage && aInBuffer.Len())
+ {
+ FlushInBuffer();
+ }
+ eBufferLanguage = eNewLanguage;
+
+ QuickHelpData aTmpQHD;
+ if( pQuickHlpData->bClear )
+ {
+ aTmpQHD.Move( *pQuickHlpData );
+ pQuickHlpData->Stop( rSh );
+ }
+
+ // OS:auch die DrawView braucht noch ein readonly-Flag
+ if ( !bIsDocReadOnly && rSh.GetDrawView() && rSh.GetDrawView()->KeyInput( rKEvt, this ) )
+ {
+ rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll( FALSE );
+ rSh.SetModified();
+ return; // Event von der SdrView ausgewertet
+ }
+
+ if ( rView.GetDrawFuncPtr() && bInsFrm )
+ {
+ StopInsFrm();
+ rSh.Edit();
+ }
+
+ BOOL bFlushBuffer = FALSE;
+ BOOL bNormalChar = FALSE;
+ BOOL bChkInsBlank = pQuickHlpData->bChkInsBlank;
+ pQuickHlpData->bChkInsBlank = FALSE;
+
+ KeyEvent aKeyEvent( rKEvt );
+ // look for vertical mappings
+ if( !bIsDocReadOnly && !rSh.IsSelFrmMode() && !rSh.IsObjSelected() )
+ {
+ //JP 21.2.2002: must changed from switch to if, because the Linux
+ // compiler has problem with the code. Has to remove if the new general
+ // handler exist.
+ USHORT nKey = rKEvt.GetKeyCode().GetCode();
+
+ if( KEY_UP == nKey || KEY_DOWN == nKey ||
+ KEY_LEFT == nKey || KEY_RIGHT == nKey )
+ {
+ // In general, we want to map the direction keys if we are inside
+ // some vertical formatted text.
+ // 1. Exception: For a table cursor in a horizontal table, the
+ // directions should never be mapped.
+ // 2. Exception: For a table cursor in a vertical table, the
+ // directions should always be mapped.
+ const bool bVertText = rSh.IsInVerticalText();
+ const bool bTblCrsr = rSh.GetTableCrsr();
+ const bool bVertTable = rSh.IsTableVertical();
+ if( ( bVertText && ( !bTblCrsr || bVertTable ) ) ||
+ ( bTblCrsr && bVertTable ) )
+ {
+ if( KEY_UP == nKey ) nKey = KEY_LEFT;
+ else if( KEY_DOWN == nKey ) nKey = KEY_RIGHT;
+ else if( KEY_LEFT == nKey ) nKey = KEY_DOWN;
+ else if( KEY_RIGHT == nKey ) nKey = KEY_UP;
+ }
+ if ( rSh.IsInRightToLeftText() )
+ {
+ if( KEY_LEFT == nKey ) nKey = KEY_RIGHT;
+ else if( KEY_RIGHT == nKey ) nKey = KEY_LEFT;
+ }
+
+ aKeyEvent = KeyEvent( rKEvt.GetCharCode(),
+ KeyCode( nKey, rKEvt.GetKeyCode().GetModifier() ),
+ rKEvt.GetRepeat() );
+ }
+ }
+
+ const KeyCode& rKeyCode = aKeyEvent.GetKeyCode();
+ sal_Unicode aCh = aKeyEvent.GetCharCode();
+
+ // enable switching to notes ankor with Ctrl - Alt - Page Up/Down
+ // pressing this inside a note will switch to next/previous note
+ if ((rKeyCode.IsMod1() && rKeyCode.IsMod2()) && ((rKeyCode.GetCode() == KEY_PAGEUP) || (rKeyCode.GetCode() == KEY_PAGEDOWN)))
+ {
+ bool bNext = rKeyCode.GetCode()==KEY_PAGEDOWN ? true : false;
+ SwFieldType* pFldType = rSh.GetFldType(0, RES_POSTITFLD);
+ rSh.MoveFldType( pFldType, bNext );
+ return;
+ }
+
+ const SwFrmFmt* pFlyFmt = rSh.GetFlyFrmFmt();
+ if( pFlyFmt )
+ {
+ USHORT nEvent;
+
+ if( 32 <= aCh &&
+ 0 == (( KEY_MOD1 | KEY_MOD2 ) & rKeyCode.GetModifier() ))
+ nEvent = SW_EVENT_FRM_KEYINPUT_ALPHA;
+ else
+ nEvent = SW_EVENT_FRM_KEYINPUT_NOALPHA;
+
+ const SvxMacro* pMacro = pFlyFmt->GetMacro().GetMacroTable().Get( nEvent );
+ if( pMacro )
+ {
+ String sRet;
+ SbxArrayRef xArgs = new SbxArray;
+ SbxVariableRef xVar = new SbxVariable;
+ xVar->PutString( pFlyFmt->GetName() );
+ xArgs->Put( &xVar, 1 );
+
+ xVar = new SbxVariable;
+ if( SW_EVENT_FRM_KEYINPUT_ALPHA == nEvent )
+ xVar->PutChar( aCh );
+ else
+ xVar->PutUShort( rKeyCode.GetModifier() | rKeyCode.GetCode() );
+ xArgs->Put( &xVar, 2 );
+
+ rSh.ExecMacro( *pMacro, &sRet, &xArgs );
+ if( sRet.Len() && 0 != sRet.ToInt32() )
+ return ;
+ }
+ }
+ int nLclSelectionType;
+ //A is converted to 1
+ if( rKeyCode.GetFullCode() == (KEY_A | KEY_MOD1 |KEY_SHIFT)
+ && rSh.HasDrawView() &&
+ (0 != (nLclSelectionType = rSh.GetSelectionType()) &&
+ ((nLclSelectionType & (nsSelectionType::SEL_FRM|nsSelectionType::SEL_GRF)) ||
+ ((nLclSelectionType & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM)) &&
+ rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1))))
+ {
+ SdrHdlList& rHdlList = (SdrHdlList&)rSh.GetDrawView()->GetHdlList();
+ SdrHdl* pAnchor = rHdlList.GetHdl(HDL_ANCHOR);
+ if ( ! pAnchor )
+ pAnchor = rHdlList.GetHdl(HDL_ANCHOR_TR);
+ if(pAnchor)
+ rHdlList.SetFocusHdl(pAnchor);
+ return;
+ }
+
+ SvxAutoCorrCfg* pACfg = 0;
+ SvxAutoCorrect* pACorr = 0;
+
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ rView.GetViewFrame()->GetBindings().GetRecorder();
+ if ( !xRecorder.is() )
+ {
+ pACfg = SvxAutoCorrCfg::Get();
+ pACorr = pACfg->GetAutoCorrect();
+ }
+
+ SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+
+ TblChgWidthHeightType eTblChgMode = nsTblChgWidthHeightType::WH_COL_LEFT; // initialization just for warning-free code
+ USHORT nTblChgSize = 0;
+ BOOL bStopKeyInputTimer = TRUE;
+ String sFmlEntry;
+
+ enum SW_KeyState { KS_Start,
+ KS_CheckKey, KS_InsChar, KS_InsTab,
+ KS_NoNum, KS_NumOff, KS_NumOrNoNum, KS_NumDown, KS_NumUp,
+ // -> #i23725#
+ KS_NumIndentInc, KS_NumIndentDec,
+ // <- #i23725#
+
+ KS_OutlineLvOff,
+ KS_NextCell, KS_PrevCell, KS_OutlineUp, KS_OutlineDown,
+ KS_GlossaryExpand, KS_NextPrevGlossary,
+ KS_AutoFmtByInput,
+ KS_NextObject, KS_PrevObject,
+ KS_KeyToView,
+ KS_LaunchOLEObject, KS_GoIntoFly, KS_GoIntoDrawing,
+ KS_EnterDrawHandleMode,
+ KS_CheckDocReadOnlyKeys,
+ KS_CheckAutoCorrect, KS_EditFormula,
+ KS_ColLeftBig, KS_ColRightBig,
+ KS_ColLeftSmall, KS_ColRightSmall,
+ KS_ColTopBig, KS_ColBottomBig,
+ KS_ColTopSmall, KS_ColBottomSmall,
+ KS_CellLeftBig, KS_CellRightBig,
+ KS_CellLeftSmall, KS_CellRightSmall,
+ KS_CellTopBig, KS_CellBottomBig,
+ KS_CellTopSmall, KS_CellBottomSmall,
+
+ KS_InsDel_ColLeftBig, KS_InsDel_ColRightBig,
+ KS_InsDel_ColLeftSmall, KS_InsDel_ColRightSmall,
+ KS_InsDel_ColTopBig, KS_InsDel_ColBottomBig,
+ KS_InsDel_ColTopSmall, KS_InsDel_ColBottomSmall,
+ KS_InsDel_CellLeftBig, KS_InsDel_CellRightBig,
+ KS_InsDel_CellLeftSmall, KS_InsDel_CellRightSmall,
+ KS_InsDel_CellTopBig, KS_InsDel_CellBottomBig,
+ KS_InsDel_CellTopSmall, KS_InsDel_CellBottomSmall,
+ KS_TblColCellInsDel,
+
+ KS_Fly_Change, KS_Draw_Change,
+ KS_SpecialInsert,
+ KS_EnterCharCell,
+ KS_GotoNextFieldMark,
+ KS_GotoPrevFieldMark,
+ KS_Ende };
+
+
+
+ SW_KeyState eKeyState = bIsDocReadOnly ? KS_CheckDocReadOnlyKeys
+ : KS_CheckKey,
+ eNextKeyState = KS_Ende;
+ BYTE nDir = 0;
+
+ // -> #i23725#
+ if (nKS_NUMDOWN_Count > 0)
+ nKS_NUMDOWN_Count--;
+
+ if (nKS_NUMINDENTINC_Count > 0)
+ nKS_NUMINDENTINC_Count--;
+ // <- #i23725#
+
+ while( KS_Ende != eKeyState )
+ {
+ SW_KeyState eFlyState = KS_KeyToView;
+
+ switch( eKeyState )
+ {
+ case KS_CheckKey:
+ eKeyState = KS_KeyToView; // default weiter zur View
+
+#ifdef DBG_UTIL
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ // JP 19.01.99: zum Umschalten des Cursor Verhaltens in ReadOnly
+ // Bereichen
+ if( 0x7210 == rKeyCode.GetFullCode() )
+ rSh.SetReadOnlyAvailable( !rSh.IsReadOnlyAvailable() );
+ else
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+#endif
+
+ if( !rKeyCode.IsMod2() && '=' == aCh &&
+ !rSh.IsTableMode() && rSh.GetTableFmt() &&
+ rSh.IsSttPara() /*&& rSh.IsEndPara()*/ &&
+ !rSh.HasReadonlySel() )
+ {
+ // in der Tabelle am Anfang der Zelle ein '=' ->
+ // EditZeile aufrufen (F2-Funktionalitaet)
+ rSh.Push();
+ if( !rSh.MoveSection( fnSectionCurr, fnSectionStart) &&
+ !rSh.IsTableBoxTextFormat() )
+ {
+ // steht also am Anfang der Box
+ eKeyState = KS_EditFormula;
+ if( rSh.HasMark() )
+ rSh.SwapPam();
+ else
+ rSh.SttSelect();
+ rSh.MoveSection( fnSectionCurr, fnSectionEnd );
+ rSh.Pop( TRUE );
+ rSh.EndSelect();
+ sFmlEntry = '=';
+ }
+ else
+ rSh.Pop( FALSE );
+ }
+ else
+ {
+ if( pACorr && aTmpQHD.HasCntnt() && !rSh.HasSelection() &&
+ !rSh.HasReadonlySel() && !aTmpQHD.bIsAutoText &&
+ pACorr->GetSwFlags().nAutoCmpltExpandKey ==
+ (rKeyCode.GetModifier() | rKeyCode.GetCode()) )
+ {
+ eKeyState = KS_GlossaryExpand;
+ break;
+ }
+
+ switch( rKeyCode.GetModifier() | rKeyCode.GetCode() )
+ {
+ case KEY_RIGHT | KEY_MOD2:
+ eKeyState = KS_ColRightBig;
+ eFlyState = KS_Fly_Change;
+ nDir = MOVE_RIGHT_SMALL;
+ goto KEYINPUT_CHECKTABLE;
+
+ case KEY_LEFT | KEY_MOD2:
+ eKeyState = KS_ColRightSmall;
+ eFlyState = KS_Fly_Change;
+ nDir = MOVE_LEFT_SMALL;
+ goto KEYINPUT_CHECKTABLE;
+ case KEY_RIGHT | KEY_MOD2 | KEY_SHIFT:
+ eKeyState = KS_ColLeftSmall;
+ goto KEYINPUT_CHECKTABLE;
+ case KEY_LEFT | KEY_MOD2 | KEY_SHIFT:
+ eKeyState = KS_ColLeftBig;
+ goto KEYINPUT_CHECKTABLE;
+
+ case KEY_RIGHT | KEY_MOD2 | KEY_MOD1:
+ eKeyState = KS_CellRightBig;
+ goto KEYINPUT_CHECKTABLE;
+ case KEY_LEFT | KEY_MOD2 | KEY_MOD1:
+ eKeyState = KS_CellRightSmall;
+ goto KEYINPUT_CHECKTABLE;
+ case KEY_RIGHT | KEY_MOD2 | KEY_SHIFT | KEY_MOD1:
+ eKeyState = KS_CellLeftSmall;
+ goto KEYINPUT_CHECKTABLE;
+ case KEY_LEFT | KEY_MOD2 | KEY_SHIFT | KEY_MOD1:
+ eKeyState = KS_CellLeftBig;
+ goto KEYINPUT_CHECKTABLE;
+
+ case KEY_UP | KEY_MOD2:
+ eKeyState = KS_ColBottomSmall;
+ eFlyState = KS_Fly_Change;
+ nDir = MOVE_UP_SMALL;
+ goto KEYINPUT_CHECKTABLE;
+ case KEY_DOWN | KEY_MOD2:
+ eKeyState = KS_ColBottomBig;
+ eFlyState = KS_Fly_Change;
+ nDir = MOVE_DOWN_SMALL;
+ goto KEYINPUT_CHECKTABLE;
+// case KEY_UP | KEY_MOD2 | KEY_SHIFT:
+// eKeyState = KS_ColTopBig;
+// goto KEYINPUT_CHECKTABLE;
+// case KEY_DOWN | KEY_MOD2 | KEY_SHIFT:
+// eKeyState = KS_ColTopSmall;
+// goto KEYINPUT_CHECKTABLE;
+
+ case KEY_UP | KEY_MOD2 | KEY_MOD1:
+ eKeyState = KS_CellBottomSmall;
+ goto KEYINPUT_CHECKTABLE;
+ case KEY_DOWN | KEY_MOD2 | KEY_MOD1:
+ eKeyState = KS_CellBottomBig;
+ goto KEYINPUT_CHECKTABLE;
+ case KEY_UP | KEY_MOD2 | KEY_SHIFT | KEY_MOD1:
+ eKeyState = KS_CellTopBig;
+ goto KEYINPUT_CHECKTABLE;
+ case KEY_DOWN | KEY_MOD2 | KEY_SHIFT | KEY_MOD1:
+ eKeyState = KS_CellTopSmall;
+ goto KEYINPUT_CHECKTABLE;
+
+KEYINPUT_CHECKTABLE:
+ if( rSh.IsTableMode() || !rSh.GetTableFmt() )
+ {
+ if(KS_KeyToView != eFlyState)
+ {
+ if(!pFlyFmt && KS_KeyToView != eFlyState &&
+ (rSh.GetSelectionType() & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM)) &&
+ rSh.GetDrawView()->AreObjectsMarked())
+ eKeyState = KS_Draw_Change;
+ }
+
+ if( pFlyFmt )
+ eKeyState = eFlyState;
+ else if( KS_Draw_Change != eKeyState)
+ eKeyState = KS_EnterCharCell;
+ }
+ break;
+
+//-------
+// Insert/Delete
+ case KEY_LEFT:
+ case KEY_LEFT | KEY_MOD1:
+ {
+ BOOL bMod1 = 0 != (rKeyCode.GetModifier() & KEY_MOD1);
+ if(!bMod1)
+ {
+ eFlyState = KS_Fly_Change;
+ nDir = MOVE_LEFT_BIG;
+ }
+ eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL |
+ ( bMod1
+ ? nsTblChgWidthHeightType::WH_CELL_LEFT
+ : nsTblChgWidthHeightType::WH_COL_LEFT );
+ nTblChgSize = pModOpt->GetTblVInsert();
+ }
+ goto KEYINPUT_CHECKTABLE_INSDEL;
+// case KEY_RIGHT:
+ case KEY_RIGHT | KEY_MOD1:
+ {
+ eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL | nsTblChgWidthHeightType::WH_CELL_RIGHT;
+ nTblChgSize = pModOpt->GetTblVInsert();
+ }
+ goto KEYINPUT_CHECKTABLE_INSDEL;
+ case KEY_UP:
+ case KEY_UP | KEY_MOD1:
+ {
+ BOOL bMod1 = 0 != (rKeyCode.GetModifier() & KEY_MOD1);
+ if(!bMod1)
+ {
+ eFlyState = KS_Fly_Change;
+ nDir = MOVE_UP_BIG;
+ }
+ eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL |
+ ( bMod1
+ ? nsTblChgWidthHeightType::WH_CELL_TOP
+ : nsTblChgWidthHeightType::WH_ROW_TOP );
+ nTblChgSize = pModOpt->GetTblHInsert();
+ }
+ goto KEYINPUT_CHECKTABLE_INSDEL;
+ case KEY_DOWN:
+ case KEY_DOWN | KEY_MOD1:
+ {
+ BOOL bMod1 = 0 != (rKeyCode.GetModifier() & KEY_MOD1);
+ if(!bMod1)
+ {
+ eFlyState = KS_Fly_Change;
+ nDir = MOVE_DOWN_BIG;
+ }
+ eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL |
+ ( bMod1
+ ? nsTblChgWidthHeightType::WH_CELL_BOTTOM
+ : nsTblChgWidthHeightType::WH_ROW_BOTTOM );
+ nTblChgSize = pModOpt->GetTblHInsert();
+ }
+ goto KEYINPUT_CHECKTABLE_INSDEL;
+
+KEYINPUT_CHECKTABLE_INSDEL:
+ if( rSh.IsTableMode() || !rSh.GetTableFmt() ||
+ !bTblInsDelMode ||
+ FALSE /* Tabelle geschuetzt */
+ )
+ {
+ const int nSelectionType = rSh.GetSelectionType();
+
+ eKeyState = KS_KeyToView;
+ if(KS_KeyToView != eFlyState)
+ {
+ if((nSelectionType & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM)) &&
+ rSh.GetDrawView()->AreObjectsMarked())
+ eKeyState = KS_Draw_Change;
+ else if(nSelectionType & (nsSelectionType::SEL_FRM|nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF))
+ eKeyState = KS_Fly_Change;
+ }
+ }
+ else
+ {
+ if( !bTblIsInsMode )
+ eTblChgMode = eTblChgMode | nsTblChgWidthHeightType::WH_FLAG_BIGGER;
+ eKeyState = KS_TblColCellInsDel;
+ }
+ break;
+
+ case KEY_DELETE:
+ if (rSh.IsInFrontOfLabel() &&
+ rSh.NumOrNoNum(FALSE))
+ eKeyState = KS_NumOrNoNum;
+ break;
+
+ case KEY_DELETE | KEY_MOD2:
+ if( !rSh.IsTableMode() && rSh.GetTableFmt() )
+ {
+ eKeyState = KS_Ende;
+ bTblInsDelMode = TRUE;
+ bTblIsInsMode = FALSE;
+ bTblIsColMode = TRUE;
+ aKeyInputTimer.Start();
+ bStopKeyInputTimer = FALSE;
+ }
+ break;
+ case KEY_INSERT | KEY_MOD2:
+ if( !rSh.IsTableMode() && rSh.GetTableFmt() )
+ {
+ eKeyState = KS_Ende;
+ bTblInsDelMode = TRUE;
+ bTblIsInsMode = TRUE;
+ bTblIsColMode = TRUE;
+ aKeyInputTimer.Start();
+ bStopKeyInputTimer = FALSE;
+ }
+ break;
+
+ case KEY_RETURN: // Return
+ if( !rSh.HasReadonlySel() )
+ {
+ const int nSelectionType = rSh.GetSelectionType();
+ if(nSelectionType & nsSelectionType::SEL_OLE)
+ eKeyState = KS_LaunchOLEObject;
+ else if(nSelectionType & nsSelectionType::SEL_FRM)
+ eKeyState = KS_GoIntoFly;
+ else if((nSelectionType & nsSelectionType::SEL_DRW) &&
+ 0 == (nSelectionType & nsSelectionType::SEL_DRW_TXT) &&
+ rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1)
+ eKeyState = KS_GoIntoDrawing;
+ else if( aTmpQHD.HasCntnt() && !rSh.HasSelection() &&
+ aTmpQHD.bIsAutoText )
+ eKeyState = KS_GlossaryExpand;
+
+ //RETURN und leerer Absatz in Numerierung -> Num. beenden
+ else if( !aInBuffer.Len() &&
+ rSh.GetCurNumRule() &&
+ !rSh.GetCurNumRule()->IsOutlineRule() &&
+ !rSh.HasSelection() &&
+ rSh.IsSttPara() && rSh.IsEndPara() )
+ eKeyState = KS_NumOff, eNextKeyState = KS_OutlineLvOff;
+
+ //RETURN fuer neuen Absatz mit AutoFormatierung
+ else if( pACfg && pACfg->IsAutoFmtByInput() &&
+ !(nSelectionType & (nsSelectionType::SEL_GRF |
+ nsSelectionType::SEL_OLE | nsSelectionType::SEL_FRM |
+ nsSelectionType::SEL_TBL_CELLS | nsSelectionType::SEL_DRW |
+ nsSelectionType::SEL_DRW_TXT)) )
+ eKeyState = KS_CheckAutoCorrect, eNextKeyState = KS_AutoFmtByInput;
+ else
+ eNextKeyState = eKeyState, eKeyState = KS_CheckAutoCorrect;
+ }
+ break;
+
+ case KEY_RETURN | KEY_MOD2: // ALT-Return
+ if( !rSh.HasReadonlySel() && !rSh.IsSttPara() && rSh.GetCurNumRule() )
+ eKeyState = KS_NoNum;
+ else if( rSh.CanSpecialInsert() )
+ eKeyState = KS_SpecialInsert;
+ break;
+
+ case KEY_BACKSPACE:
+ case KEY_BACKSPACE | KEY_SHIFT:
+ if( !rSh.HasReadonlySel() )
+ {
+ // #i23725#
+ BOOL bDone = FALSE;
+ // --> OD 2006-01-31 - try to add comment for code snip:
+ // Remove the paragraph indent, if the cursor is at the
+ // beginning of a paragraph, there is no selection
+ // and no numbering rule found at the current paragraph
+ // --> OD 2006-01-31 #b6341339#, #i58776#
+ // Also try to remove indent, if current paragraph
+ // has numbering rule, but isn't counted and only
+ // key <backspace> is hit.
+ const bool bOnlyBackspaceKey(
+ KEY_BACKSPACE == rKeyCode.GetFullCode() );
+ if ( rSh.IsSttPara() &&
+ !rSh.HasSelection() && // i40834
+ ( NULL == rSh.GetCurNumRule() ||
+ ( rSh.IsNoNum() && bOnlyBackspaceKey ) ) )
+ {
+ bDone = rSh.TryRemoveIndent();
+ }
+ // <--
+
+ // -> #i23725#
+ if (bDone)
+ eKeyState = KS_Ende;
+ else
+ {
+ if (rSh.IsSttPara() &&
+ ! rSh.IsNoNum())
+ {
+ if (nKS_NUMDOWN_Count > 0 &&
+ 0 < rSh.GetNumLevel())
+ {
+ eKeyState = KS_NumUp;
+ nKS_NUMDOWN_Count = 2;
+ bDone = TRUE;
+ }
+ else if (nKS_NUMINDENTINC_Count > 0)
+ {
+ eKeyState = KS_NumIndentDec;
+ nKS_NUMINDENTINC_Count = 2;
+ bDone = TRUE;
+ }
+ }
+ // <- #i23725#
+ // --> OD 2006-01-31 #b6341339#, #i58776#
+ // --> OD 2006-04-21 #i63540#
+ // revise fix for issues b6341339 and i58776:
+ // If the cursor is in an empty paragraph, which has
+ // a numbering, but not the oultine numbering, and
+ // there is no selection, the numbering has to be
+ // deleted on key <Backspace>.
+ // Otherwise method <SwEditShell::NumOrNoNum(..)>
+ // should only change the <IsCounted()> state of
+ // the current paragraph depending of the key.
+ // On <backspace> it is set to <false>,
+ // on <shift-backspace> it is set to <true>.
+ // Thus, assure that method <SwEditShell::NumOrNum(..)>
+ // is only called for the intended purpose.
+ bool bCallNumOrNoNum( false );
+ {
+ if ( !bDone )
+ {
+ if ( bOnlyBackspaceKey && !rSh.IsNoNum() )
+ {
+ bCallNumOrNoNum = true;
+ }
+ else if ( !bOnlyBackspaceKey && rSh.IsNoNum() )
+ {
+ bCallNumOrNoNum = true;
+ }
+ else if ( bOnlyBackspaceKey &&
+ rSh.IsSttPara() && rSh.IsEndPara() &&
+ !rSh.HasSelection() )
+ {
+ const SwNumRule* pCurrNumRule( rSh.GetCurNumRule() );
+ if ( pCurrNumRule &&
+ pCurrNumRule != rSh.GetOutlineNumRule() )
+ {
+ bCallNumOrNoNum = true;
+ }
+ }
+ }
+ }
+ if ( bCallNumOrNoNum &&
+ rSh.NumOrNoNum( !bOnlyBackspaceKey, TRUE ) )
+ {
+ eKeyState = KS_NumOrNoNum;
+ }
+ // <--
+ }
+ }
+ break;
+
+ case KEY_RIGHT:
+ {
+ eFlyState = KS_Fly_Change;
+ nDir = MOVE_RIGHT_BIG;
+ eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL | nsTblChgWidthHeightType::WH_COL_RIGHT;
+ nTblChgSize = pModOpt->GetTblVInsert();
+ goto KEYINPUT_CHECKTABLE_INSDEL;
+ }
+ case KEY_TAB:
+ {
+
+#ifdef SW_CRSR_TIMER
+ BOOL bOld = rSh.ChgCrsrTimerFlag( FALSE );
+#endif
+ if (rSh.IsFormProtected() || rSh.GetCurrentFieldmark() || rSh.GetChar(FALSE)==CH_TXT_ATR_FORMELEMENT)
+ {
+ eKeyState=KS_GotoNextFieldMark;
+ }
+ else
+ if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
+ !rSh.HasReadonlySel() )
+ {
+ // --> OD 2007-10-02 #b660435#
+// if (rSh.IsFirstOfNumRule()) // #i23725#
+ if ( rSh.IsFirstOfNumRule() &&
+ numfunc::ChangeIndentOnTabAtFirstPosOfFirstListItem() )
+ // <--
+ eKeyState = KS_NumIndentInc;
+ else
+ eKeyState = KS_NumDown;
+ }
+ else if ( rSh.GetTableFmt() )
+ {
+ if( rSh.HasSelection() || rSh.HasReadonlySel() )
+ eKeyState = KS_NextCell;
+ else
+ eKeyState = KS_CheckAutoCorrect, eNextKeyState = KS_NextCell;
+ }
+ else if ( rSh.GetSelectionType() &
+ (nsSelectionType::SEL_GRF |
+ nsSelectionType::SEL_FRM |
+ nsSelectionType::SEL_OLE |
+ nsSelectionType::SEL_DRW |
+ nsSelectionType::SEL_DRW_FORM))
+
+ eKeyState = KS_NextObject;
+ else
+ {
+ eKeyState = KS_InsTab;
+ if( rSh.IsSttOfPara() && !rSh.HasReadonlySel() )
+ {
+ SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
+ if( pColl &&
+ //0 <= pColl->GetOutlineLevel() && #i24560#
+ //MAXLEVEL - 1 > pColl->GetOutlineLevel() )//#outline level,zhaojianwei
+ pColl->IsAssignedToListLevelOfOutlineStyle()
+ && MAXLEVEL-1 > pColl->GetAssignedOutlineStyleLevel() )//<-end,zhaojianwei
+ eKeyState = KS_OutlineDown;
+ }
+ }
+#ifdef SW_CRSR_TIMER
+ rSh.ChgCrsrTimerFlag( bOld );
+#endif
+ }
+ break;
+ case KEY_TAB | KEY_SHIFT:
+ {
+#ifdef SW_CRSR_TIMER
+ BOOL bOld = rSh.ChgCrsrTimerFlag( FALSE );
+#endif
+ if (rSh.IsFormProtected() || rSh.GetCurrentFieldmark()|| rSh.GetChar(FALSE)==CH_TXT_ATR_FORMELEMENT) {
+ eKeyState=KS_GotoPrevFieldMark;
+ }
+ else if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
+ !rSh.HasReadonlySel() )
+ {
+ // --> OD 2007-10-02 #b660435#
+// if (rSh.IsFirstOfNumRule()) // #i23725#
+ if ( rSh.IsFirstOfNumRule() &&
+ numfunc::ChangeIndentOnTabAtFirstPosOfFirstListItem() )
+ // <--
+ eKeyState = KS_NumIndentDec;
+ else
+ eKeyState = KS_NumUp;
+ }
+ else if ( rSh.GetTableFmt() )
+ {
+ if( rSh.HasSelection() || rSh.HasReadonlySel() )
+ eKeyState = KS_PrevCell;
+ else
+ eKeyState = KS_CheckAutoCorrect, eNextKeyState = KS_PrevCell;
+ }
+ else if ( rSh.GetSelectionType() &
+ (nsSelectionType::SEL_GRF |
+ nsSelectionType::SEL_FRM |
+ nsSelectionType::SEL_OLE |
+ nsSelectionType::SEL_DRW |
+ nsSelectionType::SEL_DRW_FORM))
+
+ eKeyState = KS_PrevObject;
+ else
+ {
+ eKeyState = KS_Ende;
+ if( rSh.IsSttOfPara() && !rSh.HasReadonlySel() )
+ {
+ SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
+ //if( pColl && 0 < pColl->GetOutlineLevel() && //#outline level,zhaojianwei
+ // MAXLEVEL - 1 >= pColl->GetOutlineLevel() )
+ if( pColl &&
+ pColl->IsAssignedToListLevelOfOutlineStyle() &&
+ 0 < pColl->GetAssignedOutlineStyleLevel())
+ eKeyState = KS_OutlineUp;
+ }
+ }
+#ifdef SW_CRSR_TIMER
+ rSh.ChgCrsrTimerFlag( bOld );
+#endif
+ }
+ break;
+ case KEY_TAB | KEY_MOD1:
+ case KEY_TAB | KEY_MOD2:
+ if( !rSh.HasReadonlySel() )
+ {
+ if( aTmpQHD.HasCntnt() && !rSh.HasSelection() )
+ {
+ // zum naechsten Tip
+ aTmpQHD.Inc( pACorr && pACorr->GetSwFlags().
+ bAutoCmpltEndless );
+ eKeyState = KS_NextPrevGlossary;
+ }
+ else if( rSh.GetTableFmt() )
+ eKeyState = KS_InsTab;
+ else if((rSh.GetSelectionType() &
+ (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM|
+ nsSelectionType::SEL_FRM|nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF)) &&
+ rSh.GetDrawView()->AreObjectsMarked())
+ eKeyState = KS_EnterDrawHandleMode;
+ else
+ {
+ eKeyState = KS_InsTab;
+ }
+ }
+ break;
+
+ case KEY_TAB | KEY_MOD1 | KEY_SHIFT:
+ if( aTmpQHD.HasCntnt() && !rSh.HasSelection() &&
+ !rSh.HasReadonlySel() )
+ {
+ // zum vorherigen Tip
+ aTmpQHD.Dec( pACorr && pACorr->GetSwFlags().
+ bAutoCmpltEndless );
+ eKeyState = KS_NextPrevGlossary;
+ }
+ else if((rSh.GetSelectionType() & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM|
+ nsSelectionType::SEL_FRM|nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF)) &&
+ rSh.GetDrawView()->AreObjectsMarked())
+ eKeyState = KS_EnterDrawHandleMode;
+ break;
+ case KEY_F2 :
+ if( !rSh.HasReadonlySel() )
+ {
+ const int nSelectionType = rSh.GetSelectionType();
+ if(nSelectionType & nsSelectionType::SEL_FRM)
+ eKeyState = KS_GoIntoFly;
+ else if((nSelectionType & nsSelectionType::SEL_DRW))
+ eKeyState = KS_GoIntoDrawing;
+ }
+ break;
+ }
+ }
+ break;
+ case KS_CheckDocReadOnlyKeys:
+ {
+ eKeyState = KS_KeyToView;
+ switch( rKeyCode.GetModifier() | rKeyCode.GetCode() )
+ {
+ case KEY_TAB:
+ case KEY_TAB | KEY_SHIFT:
+ bNormalChar = FALSE;
+ eKeyState = KS_Ende;
+ if ( rSh.GetSelectionType() &
+ (nsSelectionType::SEL_GRF |
+ nsSelectionType::SEL_FRM |
+ nsSelectionType::SEL_OLE |
+ nsSelectionType::SEL_DRW |
+ nsSelectionType::SEL_DRW_FORM))
+
+ {
+ eKeyState = rKeyCode.GetModifier() & KEY_SHIFT ?
+ KS_PrevObject : KS_NextObject;
+ }
+ else
+ rSh.SelectNextPrevHyperlink(
+ KEY_SHIFT != rKeyCode.GetModifier() );
+ break;
+ case KEY_RETURN:
+ {
+ const int nSelectionType = rSh.GetSelectionType();
+ if(nSelectionType & nsSelectionType::SEL_FRM)
+ eKeyState = KS_GoIntoFly;
+ else
+ {
+ SfxItemSet aSet(rSh.GetAttrPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT);
+ rSh.GetCurAttr(aSet);
+ if(SFX_ITEM_SET == aSet.GetItemState(RES_TXTATR_INETFMT, FALSE))
+ {
+ const SfxPoolItem& rItem = aSet.Get(RES_TXTATR_INETFMT, TRUE);
+ bNormalChar = FALSE;
+ eKeyState = KS_Ende;
+ rSh.ClickToINetAttr((const SwFmtINetFmt&)rItem, URLLOAD_NOFILTER);
+ }
+ }
+ }
+ break;
+ }
+ }
+ break;
+
+ case KS_EnterCharCell:
+ {
+ eKeyState = KS_KeyToView;
+ switch ( rKeyCode.GetModifier() | rKeyCode.GetCode() )
+ {
+ case KEY_RIGHT | KEY_MOD2:
+ rSh.Right( CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ eKeyState = KS_Ende;
+ FlushInBuffer();
+ break;
+ case KEY_LEFT | KEY_MOD2:
+ rSh.Left( CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ eKeyState = KS_Ende;
+ FlushInBuffer();
+ break;
+ }
+ }
+ break;
+
+ case KS_KeyToView:
+ {
+ eKeyState = KS_Ende;
+ bNormalChar =
+ !rKeyCode.IsMod2() &&
+ rKeyCode.GetModifier() != (KEY_MOD1) &&
+ rKeyCode.GetModifier() != (KEY_MOD1|KEY_SHIFT) &&
+ SW_ISPRINTABLE( aCh );
+
+ if (bNormalChar && rSh.IsInFrontOfLabel())
+ {
+ rSh.NumOrNoNum(FALSE);
+ }
+
+ if( aInBuffer.Len() && ( !bNormalChar || bIsDocReadOnly ))
+ FlushInBuffer();
+
+ if( rView.KeyInput( aKeyEvent ) )
+ bFlushBuffer = TRUE, bNormalChar = FALSE;
+ else
+ {
+// OS 22.09.95: Da der Sfx Acceleratoren nur aufruft, wenn sie beim letzten
+// Statusupdate enabled wurden, muss copy ggf. von uns
+// 'gewaltsam' gerufen werden.
+ if( rKeyCode.GetFunction() == KEYFUNC_COPY )
+ GetView().GetViewFrame()->GetBindings().Execute(SID_COPY);
+
+
+ if( !bIsDocReadOnly && bNormalChar )
+ {
+ const int nSelectionType = rSh.GetSelectionType();
+ if((nSelectionType & nsSelectionType::SEL_DRW) &&
+ 0 == (nSelectionType & nsSelectionType::SEL_DRW_TXT) &&
+ rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1)
+ {
+ SdrObject* pObj = rSh.GetDrawView()->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+ if(pObj)
+ {
+ EnterDrawTextMode(pObj->GetLogicRect().Center());
+ if ( rView.GetCurShell()->ISA(SwDrawTextShell) )
+ ((SwDrawTextShell*)rView.GetCurShell())->Init();
+ rSh.GetDrawView()->KeyInput( rKEvt, this );
+ }
+ }
+ else if(nSelectionType & nsSelectionType::SEL_FRM)
+ {
+ rSh.UnSelectFrm();
+ rSh.LeaveSelFrmMode();
+ rView.AttrChangedNotify(&rSh);
+ rSh.MoveSection( fnSectionCurr, fnSectionEnd );
+ }
+ eKeyState = KS_InsChar;
+ }
+ else
+ {
+ bNormalChar = FALSE;
+ Window::KeyInput( aKeyEvent );
+ }
+ }
+ }
+ break;
+ case KS_LaunchOLEObject:
+ rSh.LaunchOLEObj();
+ eKeyState = KS_Ende;
+ break;
+ case KS_GoIntoFly :
+ rSh.UnSelectFrm();
+ rSh.LeaveSelFrmMode();
+ rView.AttrChangedNotify(&rSh);
+ rSh.MoveSection( fnSectionCurr, fnSectionEnd );
+ eKeyState = KS_Ende;
+ break;
+ case KS_GoIntoDrawing :
+ {
+ SdrObject* pObj = rSh.GetDrawView()->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+ if(pObj)
+ {
+ EnterDrawTextMode(pObj->GetLogicRect().Center());
+ if ( rView.GetCurShell()->ISA(SwDrawTextShell) )
+ ((SwDrawTextShell*)rView.GetCurShell())->Init();
+ }
+ eKeyState = KS_Ende;
+ }
+ break;
+ case KS_EnterDrawHandleMode:
+ {
+ const SdrHdlList& rHdlList = rSh.GetDrawView()->GetHdlList();
+ sal_Bool bForward(!aKeyEvent.GetKeyCode().IsShift());
+
+ ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
+ eKeyState = KS_Ende;
+ }
+ break;
+ case KS_InsTab:
+ if( rView.ISA( SwWebView )) //Kein Tabulator fuer Web!
+ {
+ // Bug 56196 - dann sollte der weiter gereicht werden.
+ Window::KeyInput( aKeyEvent );
+ eKeyState = KS_Ende;
+ break;
+ }
+ aCh = '\t';
+ // kein break!
+ case KS_InsChar:
+ if (rSh.GetChar(FALSE)==CH_TXT_ATR_FORMELEMENT)
+ {
+ ::sw::mark::ICheckboxFieldmark* pFieldmark =
+ dynamic_cast< ::sw::mark::ICheckboxFieldmark* >
+ (rSh.GetCurrentFieldmark());
+ OSL_ENSURE(pFieldmark,
+ "Where is my FieldMark??");
+ if(pFieldmark)
+ {
+ pFieldmark->SetChecked(!pFieldmark->IsChecked());
+ SwDocShell* pDocSh = rView.GetDocShell();
+ SwDoc *pDoc=pDocSh->GetDoc();
+ OSL_ENSURE(pFieldmark->IsExpanded(),
+ "where is the otherpos?");
+ if (pFieldmark->IsExpanded())
+ {
+ SwPaM aPaM(pFieldmark->GetMarkPos(), pFieldmark->GetOtherMarkPos());
+ if(0)
+ {
+ rSh.StartAllAction(); //$flr TODO: understand why this not works
+ pDoc->SetModified(aPaM);
+ rSh.EndAllAction();
+ }
+ else
+ {
+ rSh.CalcLayout(); // workaround
+ }
+ }
+ }
+ eKeyState = KS_Ende;
+ }
+ else if(!rSh.HasReadonlySel())
+ {
+ BOOL bIsNormalChar = GetAppCharClass().isLetterNumeric(
+ String( aCh ), 0 );
+ if( bChkInsBlank && bIsNormalChar &&
+ (aInBuffer.Len() || !rSh.IsSttPara() || !rSh.IsEndPara() ))
+ {
+ // vor dem Zeichen noch ein Blank einfuegen. Dieses
+ // kommt zwischen den Expandierten Text und dem neuen
+ // "nicht Worttrenner".
+ aInBuffer.Expand( aInBuffer.Len() + 1, ' ' );
+ }
+
+
+ BOOL bIsAutoCorrectChar = SvxAutoCorrect::IsAutoCorrectChar( aCh );
+ BOOL bRunNext = pACorr && pACorr->HasRunNext();
+ if( !aKeyEvent.GetRepeat() && pACorr && ( bIsAutoCorrectChar || bRunNext ) &&
+ pACfg->IsAutoFmtByInput() &&
+ (( pACorr->IsAutoCorrFlag( ChgWeightUnderl ) &&
+ ( '*' == aCh || '_' == aCh ) ) ||
+ ( pACorr->IsAutoCorrFlag( ChgQuotes ) && ('\"' == aCh ))||
+ ( pACorr->IsAutoCorrFlag( ChgSglQuotes ) && ( '\'' == aCh))))
+ {
+ FlushInBuffer();
+ rSh.AutoCorrect( *pACorr, aCh );
+ if( '\"' != aCh && '\'' != aCh ) // nur bei "*_" rufen!
+ rSh.UpdateAttr();
+ }
+ else if( !aKeyEvent.GetRepeat() && pACorr && ( bIsAutoCorrectChar || bRunNext ) &&
+ pACfg->IsAutoFmtByInput() &&
+ pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd |
+ ChgOrdinalNumber | AddNonBrkSpace |
+ ChgToEnEmDash | SetINetAttr |
+ Autocorrect ) &&
+ '\"' != aCh && '\'' != aCh && '*' != aCh && '_' != aCh
+ )
+ {
+ FlushInBuffer();
+ rSh.AutoCorrect( *pACorr, aCh );
+ }
+ else
+ {
+ aInBuffer.Expand( aInBuffer.Len() + aKeyEvent.GetRepeat() + 1,aCh );
+ bFlushCharBuffer = Application::AnyInput( INPUT_KEYBOARD );
+ bFlushBuffer = !bFlushCharBuffer;
+ if( bFlushCharBuffer )
+ aKeyInputFlushTimer.Start();
+ }
+ eKeyState = KS_Ende;
+ }
+ else
+ {
+ InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute();
+ // ??? Window::KeyInput( aKeyEvent );
+ eKeyState = KS_Ende;
+ }
+ break;
+
+ case KS_CheckAutoCorrect:
+ {
+ if( pACorr && pACfg->IsAutoFmtByInput() &&
+ pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd |
+ ChgOrdinalNumber |
+ ChgToEnEmDash | SetINetAttr |
+ Autocorrect ) &&
+ !rSh.HasReadonlySel() )
+ /* {
+ pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd |
+ ChgFractionSymbol | ChgOrdinalNumber |
+ ChgToEnEmDash | SetINetAttr |
+ Autocorrect ) &&
+ !rSh.HasReadonlySel() ) */
+ {
+ FlushInBuffer();
+ rSh.AutoCorrect( *pACorr, static_cast< sal_Unicode >('\0') );
+ }
+ eKeyState = eNextKeyState;
+ }
+ break;
+
+ default:
+ {
+ USHORT nSlotId = 0;
+ FlushInBuffer();
+//??? if( bFlushCharBuffer )
+//??? FlushInBuffer( &rSh );
+ switch( eKeyState )
+ {
+ case KS_SpecialInsert:
+ rSh.DoSpecialInsert();
+ break;
+
+ case KS_NoNum:
+ rSh.NoNum();
+ break;
+
+ case KS_NumOff:
+ // Shellwechsel - also vorher aufzeichnen
+ rSh.DelNumRules();
+ eKeyState = eNextKeyState;
+ break;
+ case KS_OutlineLvOff: // delete autofmt outlinelevel later
+ break;
+
+ case KS_NumDown:
+ rSh.NumUpDown( TRUE );
+ nKS_NUMDOWN_Count = 2; // #i23725#
+ break;
+ case KS_NumUp:
+ rSh.NumUpDown( FALSE );
+ break;
+
+ // -> #i23726#
+ case KS_NumIndentInc:
+ // --> OD 2008-06-16 #i90078#
+ rSh.ChangeIndentOfAllListLevels(360);
+ // <--
+ nKS_NUMINDENTINC_Count = 2;
+ break;
+
+ case KS_GotoNextFieldMark:
+ {
+ ::sw::mark::IFieldmark const * const pFieldmark = rSh.GetFieldmarkAfter();
+ if(pFieldmark) rSh.GotoFieldmark(pFieldmark);
+ }
+ break;
+
+ case KS_GotoPrevFieldMark:
+ {
+ ::sw::mark::IFieldmark const * const pFieldmark = rSh.GetFieldmarkBefore();
+ if(pFieldmark) rSh.GotoFieldmark(pFieldmark);
+ }
+ break;
+
+ case KS_NumIndentDec:
+ // --> OD 2008-06-16 #i90078#
+ rSh.ChangeIndentOfAllListLevels(-360);
+ // <--
+ break;
+ // <- #i23726#
+
+ case KS_OutlineDown:
+ rSh.OutlineUpDown( 1 );
+ break;
+ case KS_OutlineUp:
+ rSh.OutlineUpDown( -1 );
+ break;
+
+ case KS_NextCell:
+ //In Tabelle immer 'flushen'
+ rSh.GoNextCell();
+ nSlotId = FN_GOTO_NEXT_CELL;
+ break;
+ case KS_PrevCell:
+ rSh.GoPrevCell();
+ nSlotId = FN_GOTO_PREV_CELL;
+ break;
+ case KS_AutoFmtByInput:
+ rSh.SplitNode( TRUE );
+ break;
+
+// case KS_NumOrNoNum:
+// break;
+ case KS_NextObject:
+ case KS_PrevObject:
+ if(rSh.GotoObj( KS_NextObject == eKeyState, GOTOOBJ_GOTO_ANY))
+ {
+ if( rSh.IsFrmSelected() &&
+ rView.GetDrawFuncPtr() )
+ {
+ rView.GetDrawFuncPtr()->Deactivate();
+ rView.SetDrawFuncPtr(NULL);
+ rView.LeaveDrawCreate();
+ rView.AttrChangedNotify( &rSh );
+ }
+ rSh.HideCrsr();
+ rSh.EnterSelFrmMode();
+ }
+ break;
+ case KS_GlossaryExpand:
+ {
+ // ersetze das Wort oder Kuerzel durch den den Textbaustein
+ rSh.StartUndo( UNDO_START );
+
+ String sFnd( *aTmpQHD.aArr[ aTmpQHD.nCurArrPos ] );
+ if( aTmpQHD.bIsAutoText )
+ {
+ SwGlossaryList* pList = ::GetGlossaryList();
+ String sShrtNm;
+ String sGroup;
+ if(pList->GetShortName( sFnd, sShrtNm, sGroup))
+ {
+ rSh.SttSelect();
+ rSh.ExtendSelection( FALSE, aTmpQHD.nLen );
+ SwGlossaryHdl* pGlosHdl = GetView().GetGlosHdl();
+ pGlosHdl->SetCurGroup(sGroup, TRUE);
+ pGlosHdl->InsertGlossary( sShrtNm);
+ pQuickHlpData->bChkInsBlank = TRUE;
+ }
+ }
+ else
+ {
+ rSh.Insert( sFnd.Erase( 0, aTmpQHD.nLen ));
+ pQuickHlpData->bChkInsBlank = !pACorr ||
+ pACorr->GetSwFlags().bAutoCmpltAppendBlanc;
+ }
+ rSh.EndUndo( UNDO_END );
+ }
+ break;
+
+ case KS_NextPrevGlossary:
+ pQuickHlpData->Move( aTmpQHD );
+ pQuickHlpData->Start( rSh, USHRT_MAX );
+ break;
+
+ case KS_EditFormula:
+ {
+ const USHORT nId = SwInputChild::GetChildWindowId();
+
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ pVFrame->ToggleChildWindow( nId );
+ SwInputChild* pChildWin = (SwInputChild*)pVFrame->
+ GetChildWindow( nId );
+ if( pChildWin )
+ pChildWin->SetFormula( sFmlEntry );
+ }
+ break;
+
+ case KS_ColLeftBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_LEFT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() ); break;
+ case KS_ColRightBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_RIGHT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() ); break;
+ case KS_ColLeftSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_LEFT, pModOpt->GetTblHMove() ); break;
+ case KS_ColRightSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_RIGHT, pModOpt->GetTblHMove() ); break;
+// case KS_ColTopBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_ROW_TOP|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVMove() ); break;
+ case KS_ColBottomBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_ROW_BOTTOM|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVMove() ); break;
+// case KS_ColTopSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_ROW_TOP, pModOpt->GetTblVMove() ); break;
+ case KS_ColBottomSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_ROW_BOTTOM, pModOpt->GetTblVMove() ); break;
+ case KS_CellLeftBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_LEFT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() ); break;
+ case KS_CellRightBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_RIGHT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() ); break;
+ case KS_CellLeftSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_LEFT, pModOpt->GetTblHMove() ); break;
+ case KS_CellRightSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_RIGHT, pModOpt->GetTblHMove() ); break;
+ case KS_CellTopBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_TOP|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVMove() ); break;
+ case KS_CellBottomBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_BOTTOM|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVMove() ); break;
+ case KS_CellTopSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_TOP, pModOpt->GetTblVMove() ); break;
+ case KS_CellBottomSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_BOTTOM, pModOpt->GetTblVMove() ); break;
+
+//---------------
+ case KS_InsDel_ColLeftBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_COL_LEFT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHInsert() ); break;
+ case KS_InsDel_ColRightBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_COL_RIGHT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHInsert() ); break;
+ case KS_InsDel_ColLeftSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_COL_LEFT, pModOpt->GetTblHInsert() ); break;
+ case KS_InsDel_ColRightSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_COL_RIGHT, pModOpt->GetTblHInsert() ); break;
+ case KS_InsDel_ColTopBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_ROW_TOP|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVInsert() ); break;
+ case KS_InsDel_ColBottomBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_ROW_BOTTOM|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVInsert() ); break;
+ case KS_InsDel_ColTopSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_ROW_TOP, pModOpt->GetTblVInsert() ); break;
+ case KS_InsDel_ColBottomSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_ROW_BOTTOM, pModOpt->GetTblVInsert() ); break;
+ case KS_InsDel_CellLeftBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_LEFT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHInsert() ); break;
+ case KS_InsDel_CellRightBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_RIGHT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHInsert() ); break;
+ case KS_InsDel_CellLeftSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_LEFT, pModOpt->GetTblHInsert() ); break;
+ case KS_InsDel_CellRightSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_RIGHT, pModOpt->GetTblHInsert() ); break;
+ case KS_InsDel_CellTopBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_TOP|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVInsert() ); break;
+ case KS_InsDel_CellBottomBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_BOTTOM|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVInsert() ); break;
+ case KS_InsDel_CellTopSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_TOP, pModOpt->GetTblVInsert() ); break;
+ case KS_InsDel_CellBottomSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_BOTTOM, pModOpt->GetTblVInsert() ); break;
+//---------------
+ case KS_TblColCellInsDel:
+ rSh.SetColRowWidthHeight( eTblChgMode, nTblChgSize );
+ break;
+ case KS_Fly_Change:
+ {
+ SdrView *pSdrView = rSh.GetDrawView();
+ const SdrHdlList& rHdlList = pSdrView->GetHdlList();
+ if(rHdlList.GetFocusHdl())
+ ChangeDrawing( nDir );
+ else
+ ChangeFly( nDir, rView.ISA( SwWebView ) );
+ }
+ break;
+ case KS_Draw_Change :
+ ChangeDrawing( nDir );
+ break;
+ default:; //prevent warning
+ }
+ if( nSlotId && rView.GetViewFrame()->GetBindings().GetRecorder().is() )
+ {
+ SfxRequest aReq(rView.GetViewFrame(), nSlotId );
+ aReq.Done();
+ }
+ eKeyState = KS_Ende;
+ }
+ }
+ }
+
+ if( bStopKeyInputTimer )
+ {
+ aKeyInputTimer.Stop();
+ bTblInsDelMode = FALSE;
+ }
+
+ // falls die gepufferten Zeichen eingefuegt werden sollen
+ if( bFlushBuffer && aInBuffer.Len() )
+ {
+ //OS 16.02.96 11.04: bFlushCharBuffer wurde hier nicht zurueckgesetzt
+ // warum nicht?
+ BOOL bSave = bFlushCharBuffer;
+ FlushInBuffer();
+ bFlushCharBuffer = bSave;
+
+ // evt. Tip-Hilfe anzeigen
+ String sWord;
+ if( bNormalChar && pACfg && pACorr &&
+ ( pACfg->IsAutoTextTip() ||
+ pACorr->GetSwFlags().bAutoCompleteWords ) &&
+ rSh.GetPrevAutoCorrWord( *pACorr, sWord ) )
+ {
+ ShowAutoTextCorrectQuickHelp(sWord, pACfg, pACorr);
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: MouseEvents
+ --------------------------------------------------------------------*/
+
+
+void SwEditWin::RstMBDownFlags()
+{
+ //Nicht auf allen Systemen kommt vor dem modalen
+ //Dialog noch ein MouseButton Up (wie unter WINDOWS).
+ //Daher hier die Stati zuruecksetzen und die Maus
+ //fuer den Dialog freigeben.
+ bMBPressed = bNoInterrupt = FALSE;
+ EnterArea();
+ ReleaseMouse();
+}
+
+
+
+void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
+{
+ SwWrtShell &rSh = rView.GetWrtShell();
+
+ // We have to check if a context menu is shown and we have an UI
+ // active inplace client. In that case we have to ignore the mouse
+ // button down event. Otherwise we would crash (context menu has been
+ // opened by inplace client and we would deactivate the inplace client,
+ // the contex menu is closed by VCL asynchronously which in the end
+ // would work on deleted objects or the context menu has no parent anymore)
+ // See #126086# and #128122#
+ SfxInPlaceClient* pIPClient = rSh.GetSfxViewShell()->GetIPClient();
+ BOOL bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() );
+
+ if ( bIsOleActive && PopupMenu::IsInExecute() )
+ return;
+
+ MouseEvent rMEvt(_rMEvt);
+
+ if (rView.GetPostItMgr()->IsHit(rMEvt.GetPosPixel()))
+ return;
+
+ rView.GetPostItMgr()->SetActiveSidebarWin(0);
+
+ GrabFocus();
+
+ //ignore key modifiers for format paintbrush
+ {
+ BOOL bExecFormatPaintbrush = pApplyTempl && pApplyTempl->pFormatClipboard
+ && pApplyTempl->pFormatClipboard->HasContent();
+ if( bExecFormatPaintbrush )
+ rMEvt = MouseEvent( _rMEvt.GetPosPixel(), _rMEvt.GetClicks(),
+ _rMEvt.GetMode(), _rMEvt.GetButtons() );
+ }
+
+ bWasShdwCrsr = 0 != pShadCrsr;
+ if( bWasShdwCrsr )
+ delete pShadCrsr, pShadCrsr = 0;
+
+ const Point aDocPos( PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if ( IsChainMode() )
+ {
+ SetChainMode( FALSE );
+ SwRect aDummy;
+ SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)rSh.GetFlyFrmFmt();
+ if ( !rSh.Chainable( aDummy, *pFmt, aDocPos ) )
+ rSh.Chain( *pFmt, aDocPos );
+ UpdatePointer( aDocPos, rMEvt.GetModifier() );
+ return;
+ }
+
+ //Nach GrabFocus sollte eine Shell gepusht sein. Das muss eigentlich
+ //klappen aber in der Praxis ...
+ lcl_SelectShellForDrop( rView );
+
+ BOOL bIsDocReadOnly = rView.GetDocShell()->IsReadOnly();
+ BOOL bCallBase = TRUE;
+
+ if( pQuickHlpData->bClear )
+ pQuickHlpData->Stop( rSh );
+ pQuickHlpData->bChkInsBlank = FALSE;
+
+ if( rSh.FinishOLEObj() )
+ return; //InPlace beenden und der Klick zaehlt nicht mehr
+
+ SET_CURR_SHELL( &rSh );
+
+ SdrView *pSdrView = rSh.GetDrawView();
+ if ( pSdrView )
+ {
+ if (pSdrView->MouseButtonDown( rMEvt, this ) )
+ {
+ rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll(FALSE);
+ return; // Event von der SdrView ausgewertet
+ }
+ }
+
+
+ bIsInMove = FALSE;
+ aStartPos = rMEvt.GetPosPixel();
+ aRszMvHdlPt.X() = 0, aRszMvHdlPt.Y() = 0;
+
+ BYTE nMouseTabCol = 0;
+ const BOOL bTmp = !rSh.IsDrawCreate() && !pApplyTempl && !rSh.IsInSelect() &&
+ rMEvt.GetClicks() == 1 && MOUSE_LEFT == rMEvt.GetButtons();
+ if ( bTmp &&
+ 0 != (nMouseTabCol = rSh.WhichMouseTabCol( aDocPos ) ) &&
+ !rSh.IsObjSelectable( aDocPos ) )
+ {
+ // --> FME 2004-07-30 #i32329# Enhanced table selection
+ if ( SW_TABSEL_HORI <= nMouseTabCol && SW_TABCOLSEL_VERT >= nMouseTabCol )
+ {
+ rSh.EnterStdMode();
+ rSh.SelectTableRowCol( aDocPos );
+ if( SW_TABSEL_HORI != nMouseTabCol && SW_TABSEL_HORI_RTL != nMouseTabCol)
+ {
+ pRowColumnSelectionStart = new Point( aDocPos );
+ bIsRowDrag = SW_TABROWSEL_HORI == nMouseTabCol||
+ SW_TABROWSEL_HORI_RTL == nMouseTabCol ||
+ SW_TABCOLSEL_VERT == nMouseTabCol;
+ bMBPressed = TRUE;
+ CaptureMouse();
+ }
+ return;
+ }
+ // <--
+
+ if ( !rSh.IsTableMode() )
+ {
+ //Zuppeln von Tabellenspalten aus dem Dokument heraus.
+ if(SW_TABCOL_VERT == nMouseTabCol || SW_TABCOL_HORI == nMouseTabCol)
+ rView.SetTabColFromDoc( TRUE );
+ else
+ rView.SetTabRowFromDoc( TRUE );
+
+ rView.SetTabColFromDocPos( aDocPos );
+ rView.InvalidateRulerPos();
+ SfxBindings& rBind = rView.GetViewFrame()->GetBindings();
+ rBind.Update();
+ if ( RulerColumnDrag( rMEvt,
+ (SW_TABCOL_VERT == nMouseTabCol || SW_TABROW_HORI == nMouseTabCol)) )
+ {
+ rView.SetTabColFromDoc( FALSE );
+ rView.SetTabRowFromDoc( FALSE );
+ rView.InvalidateRulerPos();
+ rBind.Update();
+ bCallBase = FALSE;
+ }
+ else
+ {
+ return;
+ }
+ }
+ }
+ // #i23726#
+ else if (bTmp &&
+ rSh.IsNumLabel(aDocPos))
+ {
+ SwTxtNode* pNodeAtPos = rSh.GetNumRuleNodeAtPos( aDocPos );
+ rView.SetNumRuleNodeFromDoc( pNodeAtPos );
+ rView.InvalidateRulerPos();
+ SfxBindings& rBind = rView.GetViewFrame()->GetBindings();
+ rBind.Update();
+
+ // --> OD 2005-02-21 #i42921#
+ if ( RulerMarginDrag( rMEvt,
+ rSh.IsVerticalModeAtNdAndPos( *pNodeAtPos, aDocPos ) ) )
+ // <--
+ {
+ rView.SetNumRuleNodeFromDoc( NULL );
+ rView.InvalidateRulerPos();
+ rBind.Update();
+ bCallBase = FALSE;
+ }
+ else
+ {
+ // --> FME 2005-11-03 #125036# Make sure the pointer is set to 0,
+ // otherwise it may point to nowhere after deleting the corresponding
+ // text node.
+ rView.SetNumRuleNodeFromDoc( NULL );
+ // <--
+ return;
+ }
+ }
+
+ //Man kann sich in einem Selektionszustand befinden, wenn zuletzt
+ //mit dem Keyboard selektiert wurde, aber noch kein CURSOR_KEY
+ //anschliessend bewegt worden ist. In diesem Fall muss die vorher-
+ //gehende Selektion zuerst beendet werden.
+ //MA 07. Oct. 95: Und zwar nicht nur bei Linker Maustaste sondern immer.
+ //siehe auch Bug: 19263
+ if ( rSh.IsInSelect() )
+ rSh.EndSelect();
+
+ //Abfrage auf LEFT, da sonst auch bei einem Click mit der rechten Taste
+ //beispielsweise die Selektion aufgehoben wird.
+ if ( MOUSE_LEFT == rMEvt.GetButtons() )
+ {
+ BOOL bOnlyText = FALSE;
+ bMBPressed = bNoInterrupt = TRUE;
+ nKS_NUMDOWN_Count = 0; // #i23725#
+
+ CaptureMouse();
+
+ //ggf. Cursorpositionen zuruecksetzen
+ rSh.ResetCursorStack();
+
+ switch ( rMEvt.GetModifier() + rMEvt.GetButtons() )
+ {
+ case MOUSE_LEFT:
+ case MOUSE_LEFT + KEY_SHIFT:
+ case MOUSE_LEFT + KEY_MOD2:
+ if( rSh.IsObjSelected() )
+ {
+ SdrHdl* pHdl;
+ if( !bIsDocReadOnly &&
+ !pAnchorMarker &&
+ 0 != ( pHdl = pSdrView->PickHandle(aDocPos) ) &&
+ ( pHdl->GetKind() == HDL_ANCHOR ||
+ pHdl->GetKind() == HDL_ANCHOR_TR ) )
+ {
+ pAnchorMarker = new SwAnchorMarker( pHdl );
+ UpdatePointer( aDocPos, rMEvt.GetModifier() );
+ return;
+ }
+ }
+ if ( EnterDrawMode( rMEvt, aDocPos ) )
+ {
+ bNoInterrupt = FALSE;
+ return;
+ }
+ else if ( rView.GetDrawFuncPtr() && bInsFrm )
+ {
+ StopInsFrm();
+ rSh.Edit();
+ }
+
+ // Ohne SHIFT, da sonst Toggle bei Selektion nicht funktioniert
+ if (rMEvt.GetClicks() == 1)
+ {
+ if ( rSh.IsSelFrmMode())
+ {
+ SdrHdl* pHdl = rSh.GetDrawView()->PickHandle(aDocPos);
+ BOOL bHitHandle = pHdl && pHdl->GetKind() != HDL_ANCHOR &&
+ pHdl->GetKind() != HDL_ANCHOR_TR;
+
+ if ((rSh.IsInsideSelectedObj(aDocPos) || bHitHandle) &&
+ !(rMEvt.GetModifier() == KEY_SHIFT && !bHitHandle))
+ {
+ rSh.EnterSelFrmMode( &aDocPos );
+ if ( !pApplyTempl )
+ {
+ //nur, wenn keine Position zum Sizen getroffen ist.
+ if (!bHitHandle)
+ {
+ StartDDTimer();
+ SwEditWin::nDDStartPosY = aDocPos.Y();
+ SwEditWin::nDDStartPosX = aDocPos.X();
+ }
+ bFrmDrag = TRUE;
+ }
+ bNoInterrupt = FALSE;
+ return;
+ }
+ }
+ }
+ }
+
+ BOOL bExecHyperlinks = rView.GetDocShell()->IsReadOnly();
+ if ( !bExecHyperlinks )
+ {
+ SvtSecurityOptions aSecOpts;
+ const BOOL bSecureOption = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK );
+ if ( ( bSecureOption && rMEvt.GetModifier() == KEY_MOD1 ) ||
+ ( !bSecureOption && rMEvt.GetModifier() != KEY_MOD1 ) )
+ bExecHyperlinks = TRUE;
+ }
+
+ // --> FME 2004-07-30 #i32329# Enhanced selection
+ BYTE nNumberOfClicks = static_cast< BYTE >(rMEvt.GetClicks() % 4);
+ if ( 0 == nNumberOfClicks && 0 < rMEvt.GetClicks() )
+ nNumberOfClicks = 4;
+ // <--
+
+ BOOL bExecDrawTextLink = FALSE;
+
+ switch ( rMEvt.GetModifier() + rMEvt.GetButtons() )
+ {
+ case MOUSE_LEFT:
+ case MOUSE_LEFT + KEY_MOD1:
+ case MOUSE_LEFT + KEY_MOD2:
+ switch ( nNumberOfClicks )
+ {
+ case 1:
+ {
+ UpdatePointer( aDocPos, rMEvt.GetModifier() );
+ SwEditWin::nDDStartPosY = aDocPos.Y();
+ SwEditWin::nDDStartPosX = aDocPos.X();
+
+ // URL in DrawText-Objekt getroffen?
+ if (bExecHyperlinks && pSdrView)
+ {
+ SdrViewEvent aVEvt;
+ pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (aVEvt.eEvent == SDREVENT_EXECUTEURL)
+ bExecDrawTextLink = TRUE;
+ }
+
+ //Rahmen nur zu selektieren versuchen, wenn
+ //der Pointer bereits entsprechend geschaltet wurde
+ if ( aActHitType != SDRHIT_NONE && !rSh.IsSelFrmMode() &&
+ !GetView().GetViewFrame()->GetDispatcher()->IsLocked() &&
+ !bExecDrawTextLink)
+ {
+ // #107513#
+ // Test if there is a draw object at that position and if it should be selected.
+ sal_Bool bShould = rSh.ShouldObjectBeSelected(aDocPos);
+
+ if(bShould)
+ {
+ rView.NoRotate();
+ rSh.HideCrsr();
+
+ BOOL bUnLockView = !rSh.IsViewLocked();
+ rSh.LockView( TRUE );
+ BOOL bSelObj = rSh.SelectObj( aDocPos,
+ rMEvt.IsMod1() ? SW_ENTER_GROUP : 0);
+ if( bUnLockView )
+ rSh.LockView( FALSE );
+
+ if( bSelObj )
+ {
+ // falls im Macro der Rahmen deselektiert
+ // wurde, muss nur noch der Cursor
+ // wieder angezeigt werden.
+ if( FRMTYPE_NONE == rSh.GetSelFrmType() )
+ rSh.ShowCrsr();
+ else
+ {
+ if (rSh.IsFrmSelected() && rView.GetDrawFuncPtr())
+ {
+ rView.GetDrawFuncPtr()->Deactivate();
+ rView.SetDrawFuncPtr(NULL);
+ rView.LeaveDrawCreate();
+ rView.AttrChangedNotify( &rSh );
+ }
+
+ rSh.EnterSelFrmMode( &aDocPos );
+ bFrmDrag = TRUE;
+ UpdatePointer( aDocPos, rMEvt.GetModifier() );
+ }
+ return;
+ }
+ else
+ bOnlyText = static_cast< BOOL >(rSh.IsObjSelectable( aDocPos ));
+
+ if (!rView.GetDrawFuncPtr())
+ rSh.ShowCrsr();
+ }
+ else
+ bOnlyText = KEY_MOD1 != rMEvt.GetModifier();
+ }
+ else if ( rSh.IsSelFrmMode() &&
+ (aActHitType == SDRHIT_NONE ||
+ !rSh.IsInsideSelectedObj( aDocPos )))
+ {
+ rView.NoRotate();
+ SdrHdl *pHdl;
+ if( !bIsDocReadOnly && !pAnchorMarker && 0 !=
+ ( pHdl = pSdrView->PickHandle(aDocPos) ) &&
+ ( pHdl->GetKind() == HDL_ANCHOR ||
+ pHdl->GetKind() == HDL_ANCHOR_TR ) )
+ {
+ pAnchorMarker = new SwAnchorMarker( pHdl );
+ UpdatePointer( aDocPos, rMEvt.GetModifier() );
+ return;
+ }
+ else
+ {
+ BOOL bUnLockView = !rSh.IsViewLocked();
+ rSh.LockView( TRUE );
+ BYTE nFlag = rMEvt.IsShift() ? SW_ADD_SELECT :0;
+ if( rMEvt.IsMod1() )
+ nFlag = nFlag | SW_ENTER_GROUP;
+
+ if ( rSh.IsSelFrmMode() )
+ {
+ rSh.UnSelectFrm();
+ rSh.LeaveSelFrmMode();
+ rView.AttrChangedNotify(&rSh);
+ }
+
+ BOOL bSelObj = rSh.SelectObj( aDocPos, nFlag );
+ if( bUnLockView )
+ rSh.LockView( FALSE );
+
+ if( !bSelObj )
+ {
+ // Cursor hier umsetzen, damit er nicht zuerst
+ // im Rahmen gezeichnet wird; ShowCrsr() geschieht
+ // in LeaveSelFrmMode()
+ bValidCrsrPos = !(CRSR_POSCHG & (rSh.*rSh.fnSetCrsr)(&aDocPos,FALSE));
+ rSh.LeaveSelFrmMode();
+ rView.AttrChangedNotify( &rSh );
+ bCallBase = FALSE;
+ }
+ else
+ {
+ rSh.HideCrsr();
+ rSh.EnterSelFrmMode( &aDocPos );
+ rSh.SelFlyGrabCrsr();
+ rSh.MakeSelVisible();
+ bFrmDrag = TRUE;
+ if( rSh.IsFrmSelected() &&
+ rView.GetDrawFuncPtr() )
+ {
+ rView.GetDrawFuncPtr()->Deactivate();
+ rView.SetDrawFuncPtr(NULL);
+ rView.LeaveDrawCreate();
+ rView.AttrChangedNotify( &rSh );
+ }
+ UpdatePointer( aDocPos, rMEvt.GetModifier() );
+ return;
+ }
+ }
+ }
+
+ break;
+ }
+ case 2:
+ {
+ bFrmDrag = FALSE;
+ if ( !bIsDocReadOnly && rSh.IsInsideSelectedObj(aDocPos) &&
+ 0 == rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) )
+
+/* SJ: 01.03.2005: this is no good, on the one hand GetSelectionType is used as flag field (take a look into the GetSelectionType method)
+ on the other hand the return value is used in a switch without proper masking (very nice), this must lead to trouble
+*/
+ switch ( rSh.GetSelectionType() &~ ( nsSelectionType::SEL_FONTWORK | nsSelectionType::SEL_EXTRUDED_CUSTOMSHAPE ) )
+ {
+ case nsSelectionType::SEL_GRF:
+ RstMBDownFlags();
+ GetView().GetViewFrame()->GetBindings().Execute(
+ FN_FORMAT_GRAFIC_DLG, 0, 0,
+ SFX_CALLMODE_RECORD|SFX_CALLMODE_SLOT);
+ return;
+
+ // Doppelklick auf OLE-Objekt --> OLE-InPlace
+ case nsSelectionType::SEL_OLE:
+ if (!rSh.IsSelObjProtected(FLYPROTECT_CONTENT))
+ {
+ RstMBDownFlags();
+ rSh.LaunchOLEObj();
+ }
+ return;
+
+ case nsSelectionType::SEL_FRM:
+ RstMBDownFlags();
+ GetView().GetViewFrame()->GetBindings().Execute(
+ FN_FORMAT_FRAME_DLG, 0, 0, SFX_CALLMODE_RECORD|SFX_CALLMODE_SLOT);
+ return;
+
+ case nsSelectionType::SEL_DRW:
+ RstMBDownFlags();
+ EnterDrawTextMode(aDocPos);
+ if ( rView.GetCurShell()->ISA(SwDrawTextShell) )
+ ((SwDrawTextShell*)rView.GetCurShell())->Init();
+ return;
+ }
+
+ //falls die Cursorposition korrigiert wurde oder
+ // ein Fly im ReadOnlyModus selektiert ist,
+ //keine Wortselektion.
+ if ( !bValidCrsrPos ||
+ (rSh.IsFrmSelected() && rSh.IsFrmSelected() ))
+ return;
+
+ SwField *pFld;
+ BOOL bFtn = FALSE;
+
+ if( !bIsDocReadOnly &&
+ ( 0 != ( pFld = rSh.GetCurFld() ) ||
+ 0 != ( bFtn = rSh.GetCurFtn() )) )
+ {
+ RstMBDownFlags();
+ if( bFtn )
+ GetView().GetViewFrame()->GetBindings().Execute( FN_EDIT_FOOTNOTE );
+ else
+ {
+ USHORT nTypeId = pFld->GetTypeId();
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ switch( nTypeId )
+ {
+ case TYP_POSTITFLD:
+ case TYP_SCRIPTFLD:
+ {
+ //falls es ein Readonly-Bereich ist, dann muss der Status
+ //enabled werden
+ USHORT nSlot = TYP_POSTITFLD == nTypeId ? FN_POSTIT : FN_JAVAEDIT;
+ SfxBoolItem aItem(nSlot, TRUE);
+ pVFrame->GetBindings().SetState(aItem);
+ pVFrame->GetBindings().Execute(nSlot);
+ break;
+ }
+ case TYP_AUTHORITY :
+ pVFrame->GetBindings().Execute(FN_EDIT_AUTH_ENTRY_DLG);
+ break;
+ default:
+ pVFrame->GetBindings().Execute(FN_EDIT_FIELD);
+ }
+ }
+ return;
+ }
+ //im Extended Mode hat Doppel- und
+ //Dreifachklick keine Auswirkungen.
+ if ( rSh.IsExtMode() || rSh.IsBlockMode() )
+ return;
+
+ //Wort selektieren, gfs. Additional Mode
+ if ( KEY_MOD1 == rMEvt.GetModifier() && !rSh.IsAddMode() )
+ {
+ rSh.EnterAddMode();
+ rSh.SelWrd( &aDocPos );
+ rSh.LeaveAddMode();
+ }
+ else
+ rSh.SelWrd( &aDocPos );
+ bHoldSelection = TRUE;
+ return;
+ }
+ case 3:
+ case 4:
+ {
+ bFrmDrag = FALSE;
+ //im Extended Mode hat Doppel- und
+ //Dreifachklick keine Auswirkungen.
+ if ( rSh.IsExtMode() )
+ return;
+
+ //falls die Cursorposition korrigiert wurde oder
+ // ein Fly im ReadOnlyModus selektiert ist,
+ //keine Wortselektion.
+ if ( !bValidCrsrPos || rSh.IsFrmSelected() )
+ return;
+
+ //Zeile selektieren, gfs. Additional Mode
+ const bool bMod = KEY_MOD1 == rMEvt.GetModifier() &&
+ !rSh.IsAddMode();
+
+ if ( bMod )
+ rSh.EnterAddMode();
+
+ // --> FME 2004-07-30 #i32329# Enhanced selection
+ if ( 3 == nNumberOfClicks )
+ rSh.SelSentence( &aDocPos );
+ else
+ rSh.SelPara( &aDocPos );
+ // <--
+
+ if ( bMod )
+ rSh.LeaveAddMode();
+
+ bHoldSelection = TRUE;
+ return;
+ }
+
+ default:
+ return;
+ }
+ /* no break */
+ case MOUSE_LEFT + KEY_SHIFT:
+ case MOUSE_LEFT + KEY_SHIFT + KEY_MOD1:
+ {
+ BOOL bLockView = bWasShdwCrsr;
+
+ switch ( rMEvt.GetModifier() )
+ {
+ case KEY_MOD1 + KEY_SHIFT:
+ {
+ if ( !bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) )
+ {
+ rView.NoRotate();
+ rSh.HideCrsr();
+ if ( rSh.IsSelFrmMode() )
+ rSh.SelectObj(aDocPos, SW_ADD_SELECT | SW_ENTER_GROUP);
+ else
+ { if ( rSh.SelectObj( aDocPos, SW_ADD_SELECT | SW_ENTER_GROUP ) )
+ {
+ rSh.EnterSelFrmMode( &aDocPos );
+ SwEditWin::nDDStartPosY = aDocPos.Y();
+ SwEditWin::nDDStartPosX = aDocPos.X();
+ bFrmDrag = TRUE;
+ return;
+ }
+ }
+ }
+ else if( rSh.IsSelFrmMode() &&
+ rSh.GetDrawView()->PickHandle( aDocPos ))
+ {
+ bFrmDrag = TRUE;
+ bNoInterrupt = FALSE;
+ return;
+ }
+ }
+ break;
+ case KEY_MOD1:
+ if ( !bExecDrawTextLink )
+ {
+ if ( !bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) )
+ {
+ rView.NoRotate();
+ rSh.HideCrsr();
+ if ( rSh.IsSelFrmMode() )
+ rSh.SelectObj(aDocPos, SW_ENTER_GROUP);
+ else
+ { if ( rSh.SelectObj( aDocPos, SW_ENTER_GROUP ) )
+ {
+ rSh.EnterSelFrmMode( &aDocPos );
+ SwEditWin::nDDStartPosY = aDocPos.Y();
+ SwEditWin::nDDStartPosX = aDocPos.X();
+ bFrmDrag = TRUE;
+ return;
+ }
+ }
+ }
+ else if( rSh.IsSelFrmMode() &&
+ rSh.GetDrawView()->PickHandle( aDocPos ))
+ {
+ bFrmDrag = TRUE;
+ bNoInterrupt = FALSE;
+ return;
+ }
+ else
+ {
+ if ( !rSh.IsAddMode() && !rSh.IsExtMode() && !rSh.IsBlockMode() )
+ {
+ rSh.PushMode();
+ bModePushed = TRUE;
+
+ BOOL bUnLockView = !rSh.IsViewLocked();
+ rSh.LockView( TRUE );
+ rSh.EnterAddMode();
+ if( bUnLockView )
+ rSh.LockView( FALSE );
+ }
+ bCallBase = FALSE;
+ }
+ }
+ break;
+ case KEY_MOD2:
+ {
+ if ( !rSh.IsAddMode() && !rSh.IsExtMode() && !rSh.IsBlockMode() )
+ {
+ rSh.PushMode();
+ bModePushed = TRUE;
+ BOOL bUnLockView = !rSh.IsViewLocked();
+ rSh.LockView( TRUE );
+ rSh.EnterBlockMode();
+ if( bUnLockView )
+ rSh.LockView( FALSE );
+ }
+ bCallBase = FALSE;
+ }
+ break;
+ case KEY_SHIFT:
+ {
+ if ( !bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) )
+ {
+ rView.NoRotate();
+ rSh.HideCrsr();
+ if ( rSh.IsSelFrmMode() )
+ {
+ rSh.SelectObj(aDocPos, SW_ADD_SELECT);
+
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ if (rMarkList.GetMark(0) == NULL)
+ {
+ rSh.LeaveSelFrmMode();
+ rView.AttrChangedNotify(&rSh);
+ bFrmDrag = FALSE;
+ }
+ }
+ else
+ { if ( rSh.SelectObj( aDocPos ) )
+ {
+ rSh.EnterSelFrmMode( &aDocPos );
+ SwEditWin::nDDStartPosY = aDocPos.Y();
+ SwEditWin::nDDStartPosX = aDocPos.X();
+ bFrmDrag = TRUE;
+ return;
+ }
+ }
+ }
+ else
+ {
+ if ( rSh.IsSelFrmMode() &&
+ rSh.IsInsideSelectedObj( aDocPos ) )
+ {
+ rSh.EnterSelFrmMode( &aDocPos );
+ SwEditWin::nDDStartPosY = aDocPos.Y();
+ SwEditWin::nDDStartPosX = aDocPos.X();
+ bFrmDrag = TRUE;
+ return;
+ }
+ if ( rSh.IsSelFrmMode() )
+ {
+ rSh.UnSelectFrm();
+ rSh.LeaveSelFrmMode();
+ rView.AttrChangedNotify(&rSh);
+ bFrmDrag = FALSE;
+ }
+ if ( !rSh.IsExtMode() )
+ {
+ // keine Selection anfangen, wenn in ein URL-
+ // Feld oder eine -Grafik geklickt wird
+ BOOL bSttSelect = rSh.HasSelection() ||
+ Pointer(POINTER_REFHAND) != GetPointer();
+
+ if( !bSttSelect )
+ {
+ bSttSelect = TRUE;
+ if( bExecHyperlinks )
+ {
+ SwContentAtPos aCntntAtPos(
+ SwContentAtPos::SW_FTN |
+ SwContentAtPos::SW_INETATTR );
+
+ if( rSh.GetContentAtPos( aDocPos, aCntntAtPos ) )
+ {
+ if( !rSh.IsViewLocked() &&
+ !rSh.IsReadOnlyAvailable() &&
+ aCntntAtPos.IsInProtectSect() )
+ bLockView = TRUE;
+
+ bSttSelect = FALSE;
+ }
+ else if( rSh.IsURLGrfAtPos( aDocPos ))
+ bSttSelect = FALSE;
+ }
+ }
+
+ if( bSttSelect )
+ rSh.SttSelect();
+ }
+ }
+ bCallBase = FALSE;
+ break;
+ }
+ default:
+ if( !rSh.IsViewLocked() )
+ {
+ SwContentAtPos aCntntAtPos( SwContentAtPos::SW_CLICKFIELD |
+ SwContentAtPos::SW_INETATTR );
+ if( rSh.GetContentAtPos( aDocPos, aCntntAtPos, FALSE ) &&
+ !rSh.IsReadOnlyAvailable() &&
+ aCntntAtPos.IsInProtectSect() )
+ bLockView = TRUE;
+ }
+ }
+
+ if ( rSh.IsGCAttr() )
+ {
+ rSh.GCAttr();
+ rSh.ClearGCAttr();
+ }
+
+ BOOL bOverSelect = rSh.ChgCurrPam( aDocPos ), bOverURLGrf = FALSE;
+ if( !bOverSelect )
+ bOverURLGrf = bOverSelect = 0 != rSh.IsURLGrfAtPos( aDocPos );
+
+ if ( !bOverSelect )
+ {
+ const BOOL bTmpNoInterrupt = bNoInterrupt;
+ bNoInterrupt = FALSE;
+
+ if( !rSh.IsViewLocked() && bLockView )
+ rSh.LockView( TRUE );
+ else
+ bLockView = FALSE;
+
+ int nTmpSetCrsr = 0;
+
+ { // nur temp. Move-Kontext aufspannen, da sonst die
+ // Abfrage auf die Inhaltsform nicht funktioniert!!!
+ MV_KONTEXT( &rSh );
+ nTmpSetCrsr = (rSh.*rSh.fnSetCrsr)(&aDocPos,bOnlyText);
+ bValidCrsrPos = !(CRSR_POSCHG & nTmpSetCrsr);
+ bCallBase = FALSE;
+ }
+
+ //#i42732# - notify the edit window that from now on we do not use the input language
+ if ( !(CRSR_POSOLD & nTmpSetCrsr) )
+ SetUseInputLanguage( sal_False );
+
+ if( bLockView )
+ rSh.LockView( FALSE );
+
+ bNoInterrupt = bTmpNoInterrupt;
+ }
+ if ( !bOverURLGrf && !bOnlyText )
+ {
+ const int nSelType = rSh.GetSelectionType();
+ // --> OD 2009-12-30 #i89920#
+ // Check in general, if an object is selectable at given position.
+ // Thus, also text fly frames in background become selectable via Ctrl-Click.
+ if ( nSelType & nsSelectionType::SEL_OLE ||
+ nSelType & nsSelectionType::SEL_GRF ||
+ rSh.IsObjSelectable( aDocPos ) )
+ // <--
+ {
+ MV_KONTEXT( &rSh );
+ if( !rSh.IsFrmSelected() )
+ rSh.GotoNextFly();
+ rSh.EnterSelFrmMode();
+ bCallBase = FALSE;
+ }
+ }
+ // nicht mehr hier zuruecksetzen, damit -- falls durch MouseMove
+ // bei gedrueckter Ctrl-Taste eine Mehrfachselektion erfolgen soll,
+ // im Drag nicht die vorherige Selektion aufgehoben wird.
+// if(bModePushed)
+// rSh.PopMode(FALSE);
+ break;
+ }
+ }
+ }
+ if (bCallBase)
+ Window::MouseButtonDown(rMEvt);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: MouseMove
+ --------------------------------------------------------------------*/
+
+
+void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
+{
+ MouseEvent rMEvt(_rMEvt);
+
+ //ignore key modifiers for format paintbrush
+ {
+ BOOL bExecFormatPaintbrush = pApplyTempl && pApplyTempl->pFormatClipboard
+ && pApplyTempl->pFormatClipboard->HasContent();
+ if( bExecFormatPaintbrush )
+ rMEvt = MouseEvent( _rMEvt.GetPosPixel(), _rMEvt.GetClicks(),
+ _rMEvt.GetMode(), _rMEvt.GetButtons() );
+ }
+
+ // solange eine Action laeuft sollte das MouseMove abgeklemmt sein
+ // Ansonsten gibt es den Bug 40102
+ SwWrtShell &rSh = rView.GetWrtShell();
+ if( rSh.ActionPend() )
+ return ;
+
+ if( pShadCrsr && 0 != (rMEvt.GetModifier() + rMEvt.GetButtons() ) )
+ delete pShadCrsr, pShadCrsr = 0;
+
+ BOOL bIsDocReadOnly = rView.GetDocShell()->IsReadOnly();
+
+ SET_CURR_SHELL( &rSh );
+
+ //aPixPt == Point in Pixel, rel. zu ChildWin
+ //aDocPt == Point in Twips, Dokumentkoordinaten
+ const Point aPixPt( rMEvt.GetPosPixel() );
+ const Point aDocPt( PixelToLogic( aPixPt ) );
+
+ if ( IsChainMode() )
+ {
+ UpdatePointer( aDocPt, rMEvt.GetModifier() );
+ if ( rMEvt.IsLeaveWindow() )
+ rView.GetViewFrame()->HideStatusText();
+ return;
+ }
+
+ SdrView *pSdrView = rSh.GetDrawView();
+
+ const SwCallMouseEvent aLastCallEvent( aSaveCallEvent );
+ aSaveCallEvent.Clear();
+
+ if ( !bIsDocReadOnly && pSdrView && pSdrView->MouseMove(rMEvt,this) )
+ {
+ SetPointer( POINTER_TEXT );
+ return; // Event von der SdrView ausgewertet
+ }
+
+ const Point aOldPt( rSh.VisArea().Pos() );
+#ifdef TEST_FOR_BUG91313
+ // n Pixel as FUZZY border
+ SwRect aVis( rSh.VisArea() );
+ Size aFuzzySz( 2, 2 );
+ aFuzzySz = PixelToLogic( aFuzzySz );
+
+ aVis.Top( aVis.Top() + aFuzzySz.Height() );
+ aVis.Bottom( aVis.Bottom() - aFuzzySz.Height() );
+ aVis.Left( aVis.Left() + aFuzzySz.Width() );
+ aVis.Right( aVis.Right() - aFuzzySz.Width() );
+ const BOOL bInsWin = aVis.IsInside( aDocPt );
+#else
+ const BOOL bInsWin = rSh.VisArea().IsInside( aDocPt );
+#endif
+
+ if( pShadCrsr && !bInsWin )
+ delete pShadCrsr, pShadCrsr = 0;
+
+ if( bInsWin && pRowColumnSelectionStart )
+ {
+ EnterArea();
+ Point aPos( aDocPt );
+ if( rSh.SelectTableRowCol( *pRowColumnSelectionStart, &aPos, bIsRowDrag ))
+ return;
+ }
+
+ // Position ist noetig fuer OS/2, da dort nach einem MB-Down
+ // offensichtlich sofort ein MB-Move gerufen wird.
+ if( bDDTimerStarted )
+ {
+ Point aDD( SwEditWin::nDDStartPosX, SwEditWin::nDDStartPosY );
+ aDD = LogicToPixel( aDD );
+ Rectangle aRect( aDD.X()-3, aDD.Y()-3, aDD.X()+3, aDD.Y()+3 );
+ if ( !aRect.IsInside( aPixPt ) ) // MA 23. May. 95: Tatterschutz.
+ StopDDTimer( &rSh, aDocPt );
+ }
+
+ if(rView.GetDrawFuncPtr())
+ {
+ if( bInsDraw )
+ {
+ rView.GetDrawFuncPtr()->MouseMove( rMEvt );
+ if ( !bInsWin )
+ {
+ Point aTmp( aDocPt );
+ aTmp += rSh.VisArea().Pos() - aOldPt;
+ LeaveArea( aTmp );
+ }
+ else
+ EnterArea();
+ return;
+ }
+ else if(!rSh.IsFrmSelected() && !rSh.IsObjSelected())
+ {
+ SfxBindings &rBnd = rSh.GetView().GetViewFrame()->GetBindings();
+ Point aRelPos = rSh.GetRelativePagePosition(aDocPt);
+ if(aRelPos.X() >= 0)
+ {
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
+ const SfxPointItem aTmp1( SID_ATTR_POSITION, aRelPos );
+ rBnd.SetState( aTmp1 );
+ }
+ else
+ {
+ rBnd.Invalidate(SID_ATTR_POSITION);
+ }
+ rBnd.Invalidate(SID_ATTR_SIZE);
+ const SfxStringItem aCell( SID_TABLE_CELL, aEmptyStr );
+ rBnd.SetState( aCell );
+ }
+ }
+
+ BYTE nMouseTabCol;
+ if( !bIsDocReadOnly && bInsWin && !pApplyTempl && !rSh.IsInSelect() )
+ {
+ if ( SW_TABCOL_NONE != (nMouseTabCol = rSh.WhichMouseTabCol( aDocPt ) ) &&
+ !rSh.IsObjSelectable( aDocPt ) )
+ {
+ USHORT nPointer = USHRT_MAX;
+ bool bChkTblSel = false;
+
+ switch ( nMouseTabCol )
+ {
+ case SW_TABCOL_VERT :
+ case SW_TABROW_HORI :
+ nPointer = POINTER_VSIZEBAR;
+ bChkTblSel = true;
+ break;
+ case SW_TABROW_VERT :
+ case SW_TABCOL_HORI :
+ nPointer = POINTER_HSIZEBAR;
+ bChkTblSel = true;
+ break;
+ // --> FME 2004-07-30 #i20126# Enhanced table selection
+ case SW_TABSEL_HORI :
+ nPointer = POINTER_TAB_SELECT_SE;
+ break;
+ case SW_TABSEL_HORI_RTL :
+ case SW_TABSEL_VERT :
+ nPointer = POINTER_TAB_SELECT_SW;
+ break;
+ case SW_TABCOLSEL_HORI :
+ case SW_TABROWSEL_VERT :
+ nPointer = POINTER_TAB_SELECT_S;
+ break;
+ case SW_TABROWSEL_HORI :
+ nPointer = POINTER_TAB_SELECT_E;
+ break;
+ case SW_TABROWSEL_HORI_RTL :
+ case SW_TABCOLSEL_VERT :
+ nPointer = POINTER_TAB_SELECT_W;
+ break;
+ // <--
+ }
+
+ if ( USHRT_MAX != nPointer &&
+ // --> FME 2004-10-20 #i35543#
+ // Enhanced table selection is explicitely allowed in table mode
+ ( !bChkTblSel || !rSh.IsTableMode() ) )
+ // <--
+ {
+ SetPointer( nPointer );
+ }
+
+ return;
+ }
+ // #i23726#
+ else if (rSh.IsNumLabel(aDocPt, RULER_MOUSE_MARGINWIDTH))
+ {
+ // --> OD 2005-02-21 #i42921# - consider vertical mode
+ SwTxtNode* pNodeAtPos = rSh.GetNumRuleNodeAtPos( aDocPt );
+ const USHORT nPointer =
+ rSh.IsVerticalModeAtNdAndPos( *pNodeAtPos, aDocPt )
+ ? POINTER_VSIZEBAR
+ : POINTER_HSIZEBAR;
+ SetPointer( nPointer );
+ // <--
+
+ return;
+ }
+ }
+
+ BOOL bDelShadCrsr = TRUE;
+
+ switch ( rMEvt.GetModifier() + rMEvt.GetButtons() )
+ {
+ case MOUSE_LEFT:
+ if( pAnchorMarker )
+ {
+ // Now we need to refresh the SdrHdl pointer of pAnchorMarker.
+ // This looks a little bit tricky, but it solves the following
+ // problem: the pAnchorMarker contains a pointer to an SdrHdl,
+ // if the FindAnchorPos-call cause a scrolling of the visible
+ // area, it's possible that the SdrHdl will be destroyed and a
+ // new one will initialized at the original position(GetHdlPos).
+ // So the pAnchorMarker has to find the right SdrHdl, if it's
+ // the old one, it will find it with position aOld, if this one
+ // is destroyed, it will find a new one at position GetHdlPos().
+ // --> OD 2010-09-16 #i114522#
+// const Point aOld = pAnchorMarker->GetPos();
+ const Point aOld = pAnchorMarker->GetPosForHitTest( *(rSh.GetOut()) );
+ // <--
+ Point aNew = rSh.FindAnchorPos( aDocPt );
+ SdrHdl* pHdl;
+ if( (0!=( pHdl = pSdrView->PickHandle( aOld ) )||
+ 0 !=(pHdl = pSdrView->PickHandle( pAnchorMarker->GetHdlPos()) ) ) &&
+ ( pHdl->GetKind() == HDL_ANCHOR ||
+ pHdl->GetKind() == HDL_ANCHOR_TR ) )
+ {
+ pAnchorMarker->ChgHdl( pHdl );
+ if( aNew.X() || aNew.Y() )
+ {
+ pAnchorMarker->SetPos( aNew );
+ pAnchorMarker->SetLastPos( aDocPt );
+ //OLMpSdrView->RefreshAllIAOManagers();
+ }
+ }
+ else
+ {
+ delete pAnchorMarker;
+ pAnchorMarker = NULL;
+ }
+ }
+ if ( bInsDraw )
+ {
+ if ( !bMBPressed )
+ break;
+ if ( bIsInMove || IsMinMove( aStartPos, aPixPt ) )
+ {
+ if ( !bInsWin )
+ LeaveArea( aDocPt );
+ else
+ EnterArea();
+ if ( rView.GetDrawFuncPtr() )
+ {
+ pSdrView->SetOrtho(FALSE);
+ rView.GetDrawFuncPtr()->MouseMove( rMEvt );
+ }
+ bIsInMove = TRUE;
+ }
+ return;
+ }
+ case MOUSE_LEFT + KEY_SHIFT:
+ case MOUSE_LEFT + KEY_SHIFT + KEY_MOD1:
+ if ( !bMBPressed )
+ break;
+ case MOUSE_LEFT + KEY_MOD1:
+ if ( bFrmDrag && rSh.IsSelFrmMode() )
+ {
+ if( !bMBPressed )
+ break;
+
+ if ( bIsInMove || IsMinMove( aStartPos, aPixPt ) )
+ {
+ // Event-Verarbeitung fuers Resizen
+ if( pSdrView->AreObjectsMarked() )
+ {
+ const SwFrmFmt* pFlyFmt;
+ const SvxMacro* pMacro;
+
+ const Point aSttPt( PixelToLogic( aStartPos ) );
+
+ // geht es los?
+ if( HDL_USER == eSdrMoveHdl )
+ {
+ SdrHdl* pHdl = pSdrView->PickHandle( aSttPt );
+ eSdrMoveHdl = pHdl ? pHdl->GetKind() : HDL_MOVE;
+ }
+
+ USHORT nEvent = HDL_MOVE == eSdrMoveHdl
+ ? SW_EVENT_FRM_MOVE
+ : SW_EVENT_FRM_RESIZE;
+
+ if( 0 != ( pFlyFmt = rSh.GetFlyFrmFmt() ) &&
+ 0 != ( pMacro = pFlyFmt->GetMacro().GetMacroTable().
+ Get( nEvent )) &&
+// oder nur z.B. alle 20 Twip bescheid sagen?
+// ( 20 > Abs( aRszMvHdlPt.X() - aDocPt.X() ) ||
+// 20 > Abs( aRszMvHdlPt.Y() - aDocPt.Y() ) )
+ aRszMvHdlPt != aDocPt )
+ {
+ aRszMvHdlPt = aDocPt;
+ USHORT nPos = 0;
+ String sRet;
+ SbxArrayRef xArgs = new SbxArray;
+ SbxVariableRef xVar = new SbxVariable;
+ xVar->PutString( pFlyFmt->GetName() );
+ xArgs->Put( &xVar, ++nPos );
+
+ if( SW_EVENT_FRM_RESIZE == nEvent )
+ {
+ xVar = new SbxVariable;
+ xVar->PutUShort( static_cast< UINT16 >(eSdrMoveHdl) );
+ xArgs->Put( &xVar, ++nPos );
+ }
+
+ xVar = new SbxVariable;
+ xVar->PutLong( aDocPt.X() - aSttPt.X() );
+ xArgs->Put( &xVar, ++nPos );
+ xVar = new SbxVariable;
+ xVar->PutLong( aDocPt.Y() - aSttPt.Y() );
+ xArgs->Put( &xVar, ++nPos );
+
+ ReleaseMouse();
+
+ rSh.ExecMacro( *pMacro, &sRet, &xArgs );
+
+ CaptureMouse();
+
+ if( sRet.Len() && 0 != sRet.ToInt32() )
+ return ;
+ }
+ }
+ // Event-Verarbeitung fuers Resizen
+
+ if( bIsDocReadOnly )
+ break;
+
+ if ( rMEvt.IsShift() )
+ {
+ pSdrView->SetOrtho(TRUE);
+ pSdrView->SetAngleSnapEnabled(TRUE);
+ }
+ else
+ {
+ pSdrView->SetOrtho(FALSE);
+ pSdrView->SetAngleSnapEnabled(FALSE);
+ }
+
+ (rSh.*rSh.fnDrag)( &aDocPt, rMEvt.IsShift() );
+ bIsInMove = TRUE;
+ }
+ else if( bIsDocReadOnly )
+ break;
+
+ if ( !bInsWin )
+ {
+ Point aTmp( aDocPt );
+ aTmp += rSh.VisArea().Pos() - aOldPt;
+ LeaveArea( aTmp );
+ }
+ else if(bIsInMove)
+ EnterArea();
+ return;
+ }
+ if ( !rSh.IsSelFrmMode() && !bDDINetAttr &&
+ (IsMinMove( aStartPos,aPixPt ) || bIsInMove) &&
+ (rSh.IsInSelect() || !rSh.ChgCurrPam( aDocPt )) )
+ {
+ if ( pSdrView )
+ {
+ if ( rMEvt.IsShift() )
+ pSdrView->SetOrtho(TRUE);
+ else
+ pSdrView->SetOrtho(FALSE);
+ }
+ if ( !bInsWin )
+ {
+ Point aTmp( aDocPt );
+ aTmp += rSh.VisArea().Pos() - aOldPt;
+ LeaveArea( aTmp );
+ }
+ else
+ {
+ //JP 24.09.98: Fix fuer die Bugs 55592 / 55931
+ //JP 23.04.99: Fix fuer den Bugs 65289
+ //JP 06.07.99: Fix fuer den Bugs 67360
+ if( !rMEvt.IsSynthetic() &&
+ !(( MOUSE_LEFT + KEY_MOD1 ==
+ rMEvt.GetModifier() + rMEvt.GetButtons() ) &&
+ rSh.Is_FnDragEQBeginDrag() && !rSh.IsAddMode() ))
+ {
+ (rSh.*rSh.fnDrag)( &aDocPt,FALSE );
+
+ bValidCrsrPos = !(CRSR_POSCHG & (rSh.*rSh.fnSetCrsr)(&aDocPt,FALSE));
+ EnterArea();
+ }
+ }
+ }
+ bDDINetAttr = FALSE;
+ break;
+ case 0:
+ {
+ if ( pApplyTempl )
+ {
+ UpdatePointer(aDocPt, 0); // evtl. muss hier ein Rahmen markiert werden
+ break;
+ }
+ //#i6193#, change ui if mouse is over SwPostItField
+ // TODO: do the same thing for redlines SW_REDLINE
+ SwRect aFldRect;
+ SwContentAtPos aCntntAtPos( SwContentAtPos::SW_FIELD);
+ if( rSh.GetContentAtPos( aDocPt, aCntntAtPos, FALSE, &aFldRect ) )
+ {
+ const SwField* pFld = aCntntAtPos.aFnd.pFld;
+ if (pFld->Which()== RES_POSTITFLD)
+ {
+ rView.GetPostItMgr()->SetShadowState(reinterpret_cast<const SwPostItField*>(pFld),false);
+ }
+ else
+ rView.GetPostItMgr()->SetShadowState(0,false);
+ }
+ else
+ rView.GetPostItMgr()->SetShadowState(0,false);
+ // no break;
+ }
+ case KEY_SHIFT:
+ case KEY_MOD2:
+ case KEY_MOD1:
+ if ( !bInsDraw )
+ {
+ BOOL bTstShdwCrsr = TRUE;
+
+ UpdatePointer( aDocPt, rMEvt.GetModifier() );
+
+ const SwFrmFmt* pFmt = 0;
+ const SwFmtINetFmt* pINet = 0;
+ SwContentAtPos aCntntAtPos( SwContentAtPos::SW_INETATTR );
+ if( rSh.GetContentAtPos( aDocPt, aCntntAtPos ) )
+ pINet = (SwFmtINetFmt*)aCntntAtPos.aFnd.pAttr;
+
+ const void* pTmp = pINet;
+
+ if( pINet ||
+ 0 != ( pTmp = pFmt = rSh.GetFmtFromAnyObj( aDocPt )))
+ {
+ bTstShdwCrsr = FALSE;
+ if( pTmp == pINet )
+ aSaveCallEvent.Set( pINet );
+ else
+ {
+ IMapObject* pIMapObj = pFmt->GetIMapObject( aDocPt );
+ if( pIMapObj )
+ aSaveCallEvent.Set( pFmt, pIMapObj );
+ else
+ aSaveCallEvent.Set( EVENT_OBJECT_URLITEM, pFmt );
+ }
+
+ // sollte wir ueber einem InternetFeld mit einem
+ // gebundenen Macro stehen?
+ if( aSaveCallEvent != aLastCallEvent )
+ {
+ if( aLastCallEvent.HasEvent() )
+ rSh.CallEvent( SFX_EVENT_MOUSEOUT_OBJECT,
+ aLastCallEvent, TRUE );
+ // 0 besagt, das das Object gar keine Tabelle hat
+ if( !rSh.CallEvent( SFX_EVENT_MOUSEOVER_OBJECT,
+ aSaveCallEvent ))
+ aSaveCallEvent.Clear();
+ }
+ }
+ else if( aLastCallEvent.HasEvent() )
+ {
+ // Cursor stand auf einem Object
+ rSh.CallEvent( SFX_EVENT_MOUSEOUT_OBJECT,
+ aLastCallEvent, TRUE );
+ }
+
+ if( bTstShdwCrsr && bInsWin && !bIsDocReadOnly &&
+ !bInsFrm &&
+ !rSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) &&
+ rSh.GetViewOptions()->IsShadowCursor() &&
+ !(rMEvt.GetModifier() + rMEvt.GetButtons()) &&
+ !rSh.HasSelection() && !GetConnectMetaFile() )
+ {
+ SwRect aRect;
+ sal_Int16 eOrient;
+ SwFillMode eMode = (SwFillMode)rSh.GetViewOptions()->GetShdwCrsrFillMode();
+ if( rSh.GetShadowCrsrPos( aDocPt, eMode, aRect, eOrient ))
+ {
+ if( !pShadCrsr )
+ pShadCrsr = new SwShadowCursor( *this,
+ SwViewOption::GetDirectCursorColor() );
+ if( text::HoriOrientation::RIGHT != eOrient && text::HoriOrientation::CENTER != eOrient )
+ eOrient = text::HoriOrientation::LEFT;
+ pShadCrsr->SetPos( aRect.Pos(), aRect.Height(), static_cast< USHORT >(eOrient) );
+ bDelShadCrsr = FALSE;
+ }
+ }
+ }
+ break;
+ case MOUSE_LEFT + KEY_MOD2:
+ if( rSh.IsBlockMode() && !rMEvt.IsSynthetic() )
+ {
+ (rSh.*rSh.fnDrag)( &aDocPt,FALSE );
+ bValidCrsrPos = !(CRSR_POSCHG & (rSh.*rSh.fnSetCrsr)(&aDocPt,FALSE));
+ EnterArea();
+ }
+ break;
+ }
+
+ if( bDelShadCrsr && pShadCrsr )
+ delete pShadCrsr, pShadCrsr = 0;
+ bWasShdwCrsr = FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Button Up
+ --------------------------------------------------------------------*/
+
+
+void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ BOOL bCallBase = TRUE;
+
+ BOOL bCallShadowCrsr = bWasShdwCrsr;
+ bWasShdwCrsr = FALSE;
+ if( pShadCrsr )
+ delete pShadCrsr, pShadCrsr = 0;
+
+ if( pRowColumnSelectionStart )
+ DELETEZ( pRowColumnSelectionStart );
+
+ SdrHdlKind eOldSdrMoveHdl = eSdrMoveHdl;
+ eSdrMoveHdl = HDL_USER; // fuer die MoveEvents - wieder zuruecksetzen
+
+ // sicherheitshalber zuruecksetzen Bug 27900
+ rView.SetTabColFromDoc( FALSE );
+ rView.SetNumRuleNodeFromDoc(NULL);
+
+ SwWrtShell &rSh = rView.GetWrtShell();
+ SET_CURR_SHELL( &rSh );
+ SdrView *pSdrView = rSh.GetDrawView();
+ if ( pSdrView )
+ {
+ pSdrView->SetOrtho(FALSE);
+
+ if ( pSdrView->MouseButtonUp( rMEvt,this ) )
+ {
+ rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll(FALSE);
+ return; // Event von der SdrView ausgewertet
+ }
+ }
+ //MouseButtonUp nur bearbeiten, wenn auch das Down an dieses Fenster ging.
+ if ( !bMBPressed )
+ {
+// OS 25.02.97 Undo fuer die Giesskann ist bereits im CommandHdl
+//JP 29.09.95: so sollte es sein!!! if(pApplyTempl->bUndo)
+// if( pApplyTempl && MOUSE_RIGHT == rMEvt.GetModifier() + rMEvt.GetButtons() )
+// rSh.Do( SwWrtShell::UNDO );
+ return;
+ }
+
+ Point aDocPt( PixelToLogic( rMEvt.GetPosPixel() ) );
+
+ if ( bDDTimerStarted )
+ {
+ StopDDTimer( &rSh, aDocPt );
+ bMBPressed = FALSE;
+ if ( rSh.IsSelFrmMode() )
+ {
+ (rSh.*rSh.fnEndDrag)( &aDocPt, FALSE );
+ bFrmDrag = FALSE;
+ }
+ bNoInterrupt = FALSE;
+ ReleaseMouse();
+ return;
+ }
+
+ if( pAnchorMarker )
+ {
+ Point aPnt( pAnchorMarker->GetLastPos() );
+ //OLMpSdrView->RefreshAllIAOManagers();
+ DELETEZ( pAnchorMarker );
+ if( aPnt.X() || aPnt.Y() )
+ rSh.FindAnchorPos( aPnt, TRUE );
+ }
+ if ( bInsDraw && rView.GetDrawFuncPtr() )
+ {
+ if ( rView.GetDrawFuncPtr()->MouseButtonUp( rMEvt ) )
+ {
+ if (rView.GetDrawFuncPtr()) // Koennte im MouseButtonUp zerstoert worden sein
+ {
+ rView.GetDrawFuncPtr()->Deactivate();
+
+ if (!rView.IsDrawMode())
+ {
+ rView.SetDrawFuncPtr(NULL);
+ SfxBindings& rBind = rView.GetViewFrame()->GetBindings();
+ rBind.Invalidate( SID_ATTR_SIZE );
+ rBind.Invalidate( SID_TABLE_CELL );
+ }
+ }
+
+ if ( rSh.IsObjSelected() )
+ {
+ rSh.EnterSelFrmMode();
+ if (!rView.GetDrawFuncPtr())
+ StdDrawMode( OBJ_NONE, TRUE );
+ }
+ else if ( rSh.IsFrmSelected() )
+ {
+ rSh.EnterSelFrmMode();
+ StopInsFrm();
+ }
+ else
+ {
+ const Point aDocPos( PixelToLogic( aStartPos ) );
+ bValidCrsrPos = !(CRSR_POSCHG & (rSh.*rSh.fnSetCrsr)(&aDocPos,FALSE));
+ rSh.Edit();
+ }
+
+ rView.AttrChangedNotify( &rSh );
+ }
+ else if (rMEvt.GetButtons() == MOUSE_RIGHT && rSh.IsDrawCreate())
+ rView.GetDrawFuncPtr()->BreakCreate(); // Zeichnen abbrechen
+
+ bNoInterrupt = FALSE;
+ ReleaseMouse();
+ return;
+ }
+ BOOL bPopMode = FALSE;
+ switch ( rMEvt.GetModifier() + rMEvt.GetButtons() )
+ {
+ case MOUSE_LEFT:
+ if ( bInsDraw && rSh.IsDrawCreate() )
+ {
+ if ( rView.GetDrawFuncPtr() && rView.GetDrawFuncPtr()->MouseButtonUp(rMEvt) == TRUE )
+ {
+ rView.GetDrawFuncPtr()->Deactivate();
+ rView.AttrChangedNotify( &rSh );
+ if ( rSh.IsObjSelected() )
+ rSh.EnterSelFrmMode();
+ if ( rView.GetDrawFuncPtr() && bInsFrm )
+ StopInsFrm();
+ }
+ bCallBase = FALSE;
+ break;
+ }
+ case MOUSE_LEFT + KEY_MOD1:
+ case MOUSE_LEFT + KEY_MOD2:
+ case MOUSE_LEFT + KEY_SHIFT + KEY_MOD1:
+ if ( bFrmDrag && rSh.IsSelFrmMode() )
+ {
+ if ( rMEvt.IsMod1() ) //Kopieren und nicht moven.
+ {
+ //Drag abbrechen, statt dessen internes Copy verwenden
+ Rectangle aRect;
+ rSh.GetDrawView()->TakeActionRect( aRect );
+ if (!aRect.IsEmpty())
+ {
+ rSh.BreakDrag();
+ Point aEndPt, aSttPt;
+ if ( rSh.GetSelFrmType() & FRMTYPE_FLY_ATCNT )
+ {
+ aEndPt = aRect.TopLeft();
+ aSttPt = rSh.GetDrawView()->GetAllMarkedRect().TopLeft();
+ }
+ else
+ {
+ aEndPt = aRect.Center();
+ aSttPt = rSh.GetDrawView()->GetAllMarkedRect().Center();
+ }
+ if ( aSttPt != aEndPt )
+ {
+ rSh.StartUndo( UNDO_UI_DRAG_AND_COPY );
+ rSh.Copy(&rSh, aSttPt, aEndPt, FALSE);
+ rSh.EndUndo( UNDO_UI_DRAG_AND_COPY );
+ }
+ }
+ else
+ (rSh.*rSh.fnEndDrag)( &aDocPt,FALSE );
+ }
+ else
+ {
+ {
+ const SwFrmFmt* pFlyFmt;
+ const SvxMacro* pMacro;
+
+ USHORT nEvent = HDL_MOVE == eOldSdrMoveHdl
+ ? SW_EVENT_FRM_MOVE
+ : SW_EVENT_FRM_RESIZE;
+
+ if( 0 != ( pFlyFmt = rSh.GetFlyFrmFmt() ) &&
+ 0 != ( pMacro = pFlyFmt->GetMacro().GetMacroTable().
+ Get( nEvent )) )
+ {
+ const Point aSttPt( PixelToLogic( aStartPos ) );
+ aRszMvHdlPt = aDocPt;
+ USHORT nPos = 0;
+ SbxArrayRef xArgs = new SbxArray;
+ SbxVariableRef xVar = new SbxVariable;
+ xVar->PutString( pFlyFmt->GetName() );
+ xArgs->Put( &xVar, ++nPos );
+
+ if( SW_EVENT_FRM_RESIZE == nEvent )
+ {
+ xVar = new SbxVariable;
+ xVar->PutUShort( static_cast< UINT16 >(eOldSdrMoveHdl) );
+ xArgs->Put( &xVar, ++nPos );
+ }
+
+ xVar = new SbxVariable;
+ xVar->PutLong( aDocPt.X() - aSttPt.X() );
+ xArgs->Put( &xVar, ++nPos );
+ xVar = new SbxVariable;
+ xVar->PutLong( aDocPt.Y() - aSttPt.Y() );
+ xArgs->Put( &xVar, ++nPos );
+
+ xVar = new SbxVariable;
+ xVar->PutUShort( 1 );
+ xArgs->Put( &xVar, ++nPos );
+
+ ReleaseMouse();
+
+ rSh.ExecMacro( *pMacro, 0, &xArgs );
+
+ CaptureMouse();
+ }
+ }
+ (rSh.*rSh.fnEndDrag)( &aDocPt,FALSE );
+ }
+ bFrmDrag = FALSE;
+ bCallBase = FALSE;
+ break;
+ }
+ bPopMode = TRUE;
+ // no break
+ case MOUSE_LEFT + KEY_SHIFT:
+ if (rSh.IsSelFrmMode())
+ {
+
+ (rSh.*rSh.fnEndDrag)( &aDocPt, FALSE );
+ bFrmDrag = FALSE;
+ bCallBase = FALSE;
+ break;
+ }
+
+ if( bHoldSelection )
+ {
+ //JP 27.04.99: Bug 65389 - das EndDrag sollte auf jedenfall
+ // gerufen werden.
+ bHoldSelection = FALSE;
+ (rSh.*rSh.fnEndDrag)( &aDocPt, FALSE );
+ }
+ else
+ {
+ if ( !rSh.IsInSelect() && rSh.ChgCurrPam( aDocPt ) )
+ {
+ const BOOL bTmpNoInterrupt = bNoInterrupt;
+ bNoInterrupt = FALSE;
+ { // nur temp. Move-Kontext aufspannen, da sonst die
+ // Abfrage auf die Inhaltsform nicht funktioniert!!!
+ MV_KONTEXT( &rSh );
+ const Point aDocPos( PixelToLogic( aStartPos ) );
+ bValidCrsrPos = !(CRSR_POSCHG & (rSh.*rSh.fnSetCrsr)(&aDocPos,FALSE));
+ }
+ bNoInterrupt = bTmpNoInterrupt;
+
+ }
+ else
+ {
+ BOOL bInSel = rSh.IsInSelect();
+ (rSh.*rSh.fnEndDrag)( &aDocPt, FALSE );
+
+ // Internetfield? --> Link-Callen (DocLaden!!)
+//JP 18.10.96: Bug 32437 -
+// if( !rSh.HasSelection() )
+ if( !bInSel )
+ {
+ USHORT nFilter = URLLOAD_NOFILTER;
+ if( KEY_MOD1 == rMEvt.GetModifier() )
+ nFilter |= URLLOAD_NEWVIEW;
+
+ BOOL bExecHyperlinks = rView.GetDocShell()->IsReadOnly();
+ if ( !bExecHyperlinks )
+ {
+ SvtSecurityOptions aSecOpts;
+ const BOOL bSecureOption = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK );
+ if ( ( bSecureOption && rMEvt.GetModifier() == KEY_MOD1 ) ||
+ ( !bSecureOption && rMEvt.GetModifier() != KEY_MOD1 ) )
+ bExecHyperlinks = TRUE;
+ }
+
+ const BOOL bExecSmarttags = rMEvt.GetModifier() == KEY_MOD1;
+
+ if(pApplyTempl)
+ bExecHyperlinks = FALSE;
+
+ SwContentAtPos aCntntAtPos( SwContentAtPos::SW_CLICKFIELD |
+ SwContentAtPos::SW_INETATTR |
+ SwContentAtPos::SW_SMARTTAG | SwContentAtPos::SW_FORMCTRL);
+
+ if( rSh.GetContentAtPos( aDocPt, aCntntAtPos, TRUE ) )
+ {
+ BOOL bViewLocked = rSh.IsViewLocked();
+ if( !bViewLocked && !rSh.IsReadOnlyAvailable() &&
+ aCntntAtPos.IsInProtectSect() )
+ rSh.LockView( TRUE );
+
+ ReleaseMouse();
+
+ if( SwContentAtPos::SW_FIELD == aCntntAtPos.eCntntAtPos )
+ {
+ rSh.ClickToField( *aCntntAtPos.aFnd.pFld );
+ }
+ else if ( SwContentAtPos::SW_SMARTTAG == aCntntAtPos.eCntntAtPos )
+ {
+ // execute smarttag menu
+ if ( bExecSmarttags && SwSmartTagMgr::Get().IsSmartTagsEnabled() )
+ rView.ExecSmartTagPopup( aDocPt );
+ }
+ else if ( SwContentAtPos::SW_FORMCTRL == aCntntAtPos.eCntntAtPos )
+ {
+ ASSERT( aCntntAtPos.aFnd.pFldmark != NULL, "where is my field ptr???");
+ if ( aCntntAtPos.aFnd.pFldmark != NULL)
+ {
+ IFieldmark *fieldBM = const_cast< IFieldmark* > ( aCntntAtPos.aFnd.pFldmark );
+ //SwDocShell* pDocSh = rView.GetDocShell();
+ //SwDoc *pDoc=pDocSh->GetDoc();
+ if (fieldBM->GetFieldname( ).equalsAscii( ODF_FORMCHECKBOX ) )
+ {
+ ICheckboxFieldmark* pCheckboxFm = dynamic_cast<ICheckboxFieldmark*>(fieldBM);
+ pCheckboxFm->SetChecked(!pCheckboxFm->IsChecked());
+ pCheckboxFm->Invalidate();
+ rSh.InvalidateWindows( rView.GetVisArea() );
+ } else if (fieldBM->GetFieldname().equalsAscii( ODF_FORMDROPDOWN) ) {
+ rView.ExecFieldPopup( aDocPt, fieldBM );
+ fieldBM->Invalidate();
+ rSh.InvalidateWindows( rView.GetVisArea() );
+ } else {
+ // unknown type..
+ }
+ }
+ }
+ else // if ( SwContentAtPos::SW_INETATTR == aCntntAtPos.eCntntAtPos )
+ {
+ if ( bExecHyperlinks )
+ rSh.ClickToINetAttr( *(SwFmtINetFmt*)aCntntAtPos.aFnd.pAttr, nFilter );
+ }
+
+ rSh.LockView( bViewLocked );
+ bCallShadowCrsr = FALSE;
+ }
+ else
+ {
+ aCntntAtPos = SwContentAtPos( SwContentAtPos::SW_FTN );
+ if( !rSh.GetContentAtPos( aDocPt, aCntntAtPos, TRUE ) && bExecHyperlinks )
+ {
+ SdrViewEvent aVEvt;
+
+ if (pSdrView)
+ pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ if (pSdrView && aVEvt.eEvent == SDREVENT_EXECUTEURL)
+ {
+ // URL-Feld getroffen
+ const SvxURLField *pField = aVEvt.pURLField;
+ if (pField)
+ {
+ String sURL(pField->GetURL());
+ String sTarget(pField->GetTargetFrame());
+ ::LoadURL( sURL, &rSh, nFilter, &sTarget);
+ }
+ bCallShadowCrsr = FALSE;
+ }
+ else
+ {
+ // Grafik getroffen
+ ReleaseMouse();
+ if( rSh.ClickToINetGrf( aDocPt, nFilter ))
+ bCallShadowCrsr = FALSE;
+ }
+ }
+ }
+
+ if( bCallShadowCrsr &&
+ rSh.GetViewOptions()->IsShadowCursor() &&
+ MOUSE_LEFT == (rMEvt.GetModifier() + rMEvt.GetButtons()) &&
+ !rSh.HasSelection() &&
+ !GetConnectMetaFile() &&
+ rSh.VisArea().IsInside( aDocPt ))
+ {
+ SwUndoId nLastUndoId(UNDO_EMPTY);
+ if (rSh.GetLastUndoInfo(0, & nLastUndoId))
+ {
+ if (UNDO_INS_FROM_SHADOWCRSR == nLastUndoId)
+ {
+ rSh.Undo();
+ }
+ }
+ SwFillMode eMode = (SwFillMode)rSh.GetViewOptions()->GetShdwCrsrFillMode();
+ rSh.SetShadowCrsrPos( aDocPt, eMode );
+ }
+ }
+ }
+ bCallBase = FALSE;
+
+ }
+
+ // gfs. im Down gepushten Mode wieder zuruecksetzen
+ if ( bPopMode && bModePushed )
+ {
+ rSh.PopMode();
+ bModePushed = FALSE;
+ bCallBase = FALSE;
+ }
+ break;
+
+ default:
+ ReleaseMouse();
+ return;
+ }
+
+ if( pApplyTempl )
+ {
+ int eSelection = rSh.GetSelectionType();
+ SwFormatClipboard* pFormatClipboard = pApplyTempl->pFormatClipboard;
+ if( pFormatClipboard )//apply format paintbrush
+ {
+ //get some parameters
+ SwWrtShell& rWrtShell = rView.GetWrtShell();
+ SfxStyleSheetBasePool* pPool=0;
+ bool bNoCharacterFormats = false;
+ bool bNoParagraphFormats = false;
+ {
+ SwDocShell* pDocSh = rView.GetDocShell();
+ if(pDocSh)
+ pPool = pDocSh->GetStyleSheetPool();
+ if( (rMEvt.GetModifier()&KEY_MOD1) && (rMEvt.GetModifier()&KEY_SHIFT) )
+ bNoCharacterFormats = true;
+ else if( rMEvt.GetModifier() & KEY_MOD1 )
+ bNoParagraphFormats = true;
+ }
+ //execute paste
+ pFormatClipboard->Paste( rWrtShell, pPool, bNoCharacterFormats, bNoParagraphFormats );
+
+ //if the clipboard is empty after paste remove the ApplyTemplate
+ if(!pFormatClipboard->HasContent())
+ SetApplyTemplate(SwApplyTemplate());
+ }
+ else if( pApplyTempl->nColor )
+ {
+ USHORT nId = 0;
+ switch( pApplyTempl->nColor )
+ {
+ case SID_ATTR_CHAR_COLOR_EXT:
+ nId = RES_CHRATR_COLOR;
+ break;
+ case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
+ nId = RES_CHRATR_BACKGROUND;
+ break;
+ }
+ if( nId && (nsSelectionType::SEL_TXT|nsSelectionType::SEL_TBL) & eSelection)
+ {
+ if( rSh.IsSelection() && !rSh.HasReadonlySel() )
+ {
+ if(nId == RES_CHRATR_BACKGROUND)
+ {
+ Color aColor( COL_TRANSPARENT );
+ if( !SwEditWin::bTransparentBackColor )
+ aColor = SwEditWin::aTextBackColor;
+ rSh.SetAttr( SvxBrushItem( aColor, nId ) );
+ }
+ else
+ rSh.SetAttr( SvxColorItem(SwEditWin::aTextColor, nId) );
+ rSh.UnSetVisCrsr();
+ rSh.EnterStdMode();
+ rSh.SetVisCrsr(aDocPt);
+
+ pApplyTempl->bUndo = TRUE;
+ bCallBase = FALSE;
+ aTemplateTimer.Stop();
+ }
+ else if(rMEvt.GetClicks() == 1)
+ {
+ // keine Selektion -> also Giesskanne abschalten
+ aTemplateTimer.Start();
+ }
+ }
+ }
+ else
+ {
+ String aStyleName;
+ switch ( pApplyTempl->eType )
+ {
+ case SFX_STYLE_FAMILY_PARA:
+ if( (( nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL )
+ & eSelection ) && !rSh.HasReadonlySel() )
+ {
+ rSh.SetTxtFmtColl( pApplyTempl->aColl.pTxtColl );
+ pApplyTempl->bUndo = TRUE;
+ bCallBase = FALSE;
+ if ( pApplyTempl->aColl.pTxtColl )
+ aStyleName = pApplyTempl->aColl.pTxtColl->GetName();
+ }
+ break;
+ case SFX_STYLE_FAMILY_CHAR:
+ if( (( nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL )
+ & eSelection ) && !rSh.HasReadonlySel() )
+ {
+ rSh.SetAttr( SwFmtCharFmt(pApplyTempl->aColl.pCharFmt) );
+ rSh.UnSetVisCrsr();
+ rSh.EnterStdMode();
+ rSh.SetVisCrsr(aDocPt);
+ pApplyTempl->bUndo = TRUE;
+ bCallBase = FALSE;
+ if ( pApplyTempl->aColl.pCharFmt )
+ aStyleName = pApplyTempl->aColl.pCharFmt->GetName();
+ }
+ break;
+ case SFX_STYLE_FAMILY_FRAME :
+ {
+ const SwFrmFmt* pFmt = rSh.GetFmtFromObj( aDocPt );
+ if(PTR_CAST(SwFlyFrmFmt, pFmt))
+ {
+ rSh.SetFrmFmt( pApplyTempl->aColl.pFrmFmt, FALSE, &aDocPt );
+ pApplyTempl->bUndo = TRUE;
+ bCallBase = FALSE;
+ if( pApplyTempl->aColl.pFrmFmt )
+ aStyleName = pApplyTempl->aColl.pFrmFmt->GetName();
+ }
+ break;
+ }
+ case SFX_STYLE_FAMILY_PAGE:
+ // Kein Undo bei Seitenvorlagen
+ rSh.ChgCurPageDesc( *pApplyTempl->aColl.pPageDesc );
+ if ( pApplyTempl->aColl.pPageDesc )
+ aStyleName = pApplyTempl->aColl.pPageDesc->GetName();
+ bCallBase = FALSE;
+ break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ if( !rSh.HasReadonlySel() )
+ {
+ // --> OD 2008-03-17 #refactorlists#
+ rSh.SetCurNumRule( *pApplyTempl->aColl.pNumRule,
+ false,
+ pApplyTempl->aColl.pNumRule->GetDefaultListId() );
+ // <--
+ bCallBase = FALSE;
+ pApplyTempl->bUndo = TRUE;
+ if( pApplyTempl->aColl.pNumRule )
+ aStyleName = pApplyTempl->aColl.pNumRule->GetName();
+ }
+ break;
+ }
+
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ rView.GetViewFrame()->GetBindings().GetRecorder();
+ if ( aStyleName.Len() && xRecorder.is() )
+ {
+ SfxShell *pSfxShell = lcl_GetShellFromDispatcher( rView, TYPE(SwTextShell) );
+ if ( pSfxShell )
+ {
+ SfxRequest aReq( rView.GetViewFrame(), SID_STYLE_APPLY );
+ aReq.AppendItem( SfxStringItem( SID_STYLE_APPLY, aStyleName ) );
+ aReq.AppendItem( SfxUInt16Item( SID_STYLE_FAMILY, (USHORT) pApplyTempl->eType ) );
+ aReq.Done();
+ }
+ }
+ }
+
+ }
+ ReleaseMouse();
+ // Hier kommen nur verarbeitete MouseEvents an; nur bei diesen duerfen
+ // die Modi zurueckgesetzt werden.
+ bMBPressed = FALSE;
+
+ //sicherheitshalber aufrufen, da jetzt das Selektieren bestimmt zu Ende ist.
+ //Andernfalls koennte der Timeout des Timers Kummer machen.
+ EnterArea();
+ bNoInterrupt = FALSE;
+
+ if (bCallBase)
+ Window::MouseButtonUp(rMEvt);
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Vorlage anwenden
+ --------------------------------------------------------------------*/
+
+
+void SwEditWin::SetApplyTemplate(const SwApplyTemplate &rTempl)
+{
+ static BOOL bIdle = FALSE;
+ DELETEZ(pApplyTempl);
+ SwWrtShell &rSh = rView.GetWrtShell();
+
+ if(rTempl.pFormatClipboard)
+ {
+ pApplyTempl = new SwApplyTemplate( rTempl );
+ SetPointer( POINTER_FILL );//@todo #i20119# maybe better a new brush pointer here in future
+ rSh.NoEdit( FALSE );
+ bIdle = rSh.GetViewOptions()->IsIdle();
+ ((SwViewOption *)rSh.GetViewOptions())->SetIdle( FALSE );
+ }
+ else if(rTempl.nColor)
+ {
+ pApplyTempl = new SwApplyTemplate( rTempl );
+ SetPointer( POINTER_FILL );
+ rSh.NoEdit( FALSE );
+ bIdle = rSh.GetViewOptions()->IsIdle();
+ ((SwViewOption *)rSh.GetViewOptions())->SetIdle( FALSE );
+ }
+ else if( rTempl.eType )
+ {
+ pApplyTempl = new SwApplyTemplate( rTempl );
+ SetPointer( POINTER_FILL );
+ rSh.NoEdit( FALSE );
+ bIdle = rSh.GetViewOptions()->IsIdle();
+ ((SwViewOption *)rSh.GetViewOptions())->SetIdle( FALSE );
+ }
+ else
+ {
+ SetPointer( POINTER_TEXT );
+ rSh.UnSetVisCrsr();
+
+ ((SwViewOption *)rSh.GetViewOptions())->SetIdle( bIdle );
+ if ( !rSh.IsSelFrmMode() )
+ rSh.Edit();
+ }
+
+ static USHORT __READONLY_DATA aInva[] =
+ {
+ SID_STYLE_WATERCAN,
+ SID_ATTR_CHAR_COLOR_EXT,
+ SID_ATTR_CHAR_COLOR_BACKGROUND_EXT,
+ 0
+ };
+ rView.GetViewFrame()->GetBindings().Invalidate(aInva);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: ctor
+ --------------------------------------------------------------------*/
+
+
+SwEditWin::SwEditWin(Window *pParent, SwView &rMyView):
+ Window(pParent, WinBits(WB_CLIPCHILDREN | WB_DIALOGCONTROL)),
+ DropTargetHelper( this ),
+ DragSourceHelper( this ),
+
+ eBufferLanguage(LANGUAGE_DONTKNOW),
+ pApplyTempl(0),
+ pAnchorMarker( 0 ),
+ pUserMarker( 0 ),
+ pUserMarkerObj( 0 ),
+ pShadCrsr( 0 ),
+ pRowColumnSelectionStart( 0 ),
+
+ rView( rMyView ),
+
+ aActHitType(SDRHIT_NONE),
+ m_nDropFormat( 0 ),
+ m_nDropAction( 0 ),
+ m_nDropDestination( 0 ),
+
+ nInsFrmColCount( 1 ),
+ eDrawMode(OBJ_NONE),
+
+ bLockInput(FALSE),
+ bObjectSelect( FALSE ),
+ nKS_NUMDOWN_Count(0), // #i23725#
+ nKS_NUMINDENTINC_Count(0) // #i23725#
+{
+ SetHelpId(HID_EDIT_WIN);
+ EnableChildTransparentMode();
+ SetDialogControlFlags( WINDOW_DLGCTRL_RETURN | WINDOW_DLGCTRL_WANTFOCUS );
+
+ bLinkRemoved = bMBPressed = bInsDraw = bInsFrm =
+ bIsInDrag = bOldIdle = bOldIdleSet = bChainMode = bWasShdwCrsr = FALSE;
+ //#i42732# initially use the input language
+ bUseInputLanguage = sal_True;
+
+ SetMapMode(MapMode(MAP_TWIP));
+
+ SetPointer( POINTER_TEXT );
+ aTimer.SetTimeoutHdl(LINK(this, SwEditWin, TimerHandler));
+
+ bTblInsDelMode = FALSE;
+ aKeyInputTimer.SetTimeout( 3000 );
+ aKeyInputTimer.SetTimeoutHdl(LINK(this, SwEditWin, KeyInputTimerHandler));
+
+ aKeyInputFlushTimer.SetTimeout( 200 );
+ aKeyInputFlushTimer.SetTimeoutHdl(LINK(this, SwEditWin, KeyInputFlushHandler));
+
+ // TemplatePointer fuer Farben soll nach Einfachclick
+ // ohne Selektion zurueckgesetzt werden
+ aTemplateTimer.SetTimeout(400);
+ aTemplateTimer.SetTimeoutHdl(LINK(this, SwEditWin, TemplateTimerHdl));
+
+ //JP 16.12.98: temporaere Loesung!!! Sollte bei jeder Cursorbewegung
+ // den Font von der akt. einfuege Position setzen!
+ if( !rMyView.GetDocShell()->IsReadOnly() )
+ {
+ Font aFont;
+ SetInputContext( InputContext( aFont, INPUTCONTEXT_TEXT |
+ INPUTCONTEXT_EXTTEXTINPUT ) );
+ }
+}
+
+
+
+SwEditWin::~SwEditWin()
+{
+ aKeyInputTimer.Stop();
+ delete pShadCrsr;
+ delete pRowColumnSelectionStart;
+ if( pQuickHlpData->bClear && rView.GetWrtShellPtr() )
+ pQuickHlpData->Stop( rView.GetWrtShell() );
+ bExecuteDrag = FALSE;
+ delete pApplyTempl;
+ rView.SetDrawFuncPtr(NULL);
+
+ if(pUserMarker)
+ {
+ delete pUserMarker;
+ }
+
+ delete pAnchorMarker;
+}
+
+
+/******************************************************************************
+ * Beschreibung: DrawTextEditMode einschalten
+ ******************************************************************************/
+
+
+void SwEditWin::EnterDrawTextMode( const Point& aDocPos )
+{
+ if ( rView.EnterDrawTextMode(aDocPos) == TRUE )
+ {
+ if (rView.GetDrawFuncPtr())
+ {
+ rView.GetDrawFuncPtr()->Deactivate();
+ rView.SetDrawFuncPtr(NULL);
+ rView.LeaveDrawCreate();
+ }
+ rView.NoRotate();
+ rView.AttrChangedNotify( &rView.GetWrtShell() );
+ }
+}
+
+/******************************************************************************
+ * Beschreibung: DrawMode einschalten
+ ******************************************************************************/
+
+
+
+BOOL SwEditWin::EnterDrawMode(const MouseEvent& rMEvt, const Point& aDocPos)
+{
+ SwWrtShell &rSh = rView.GetWrtShell();
+ SdrView *pSdrView = rSh.GetDrawView();
+
+// if ( GetDrawFuncPtr() && (aActHitType == SDRHIT_NONE || rSh.IsDrawCreate()) )
+ if ( rView.GetDrawFuncPtr() )
+ {
+ if (rSh.IsDrawCreate())
+ return TRUE;
+
+ BOOL bRet = rView.GetDrawFuncPtr()->MouseButtonDown( rMEvt );
+ rView.AttrChangedNotify( &rSh );
+ return bRet;
+ }
+
+ if ( pSdrView && pSdrView->IsTextEdit() )
+ {
+ BOOL bUnLockView = !rSh.IsViewLocked();
+ rSh.LockView( TRUE );
+
+ rSh.EndTextEdit(); // Danebengeklickt, Ende mit Edit
+ rSh.SelectObj( aDocPos );
+ if ( !rSh.IsObjSelected() && !rSh.IsFrmSelected() )
+ rSh.LeaveSelFrmMode();
+ else
+ {
+ SwEditWin::nDDStartPosY = aDocPos.Y();
+ SwEditWin::nDDStartPosX = aDocPos.X();
+ bFrmDrag = TRUE;
+ }
+ if( bUnLockView )
+ rSh.LockView( FALSE );
+ rView.AttrChangedNotify( &rSh );
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/******************************************************************************
+ * Beschreibung:
+ ******************************************************************************/
+
+
+
+BOOL SwEditWin::IsDrawSelMode()
+{
+// return (IsFrmAction() == FALSE && GetSdrDrawMode() == OBJ_NONE);
+ return IsObjectSelect();
+}
+
+/******************************************************************************
+ * Beschreibung:
+ ******************************************************************************/
+
+
+void SwEditWin::GetFocus()
+{
+ if ( rView.GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ rView.GetPostItMgr()->GrabFocusOnActiveSidebarWin();
+ }
+ else
+ {
+ rView.GotFocus();
+ Window::GetFocus();
+ rView.GetWrtShell().InvalidateAccessibleFocus();
+ }
+}
+
+/******************************************************************************
+ * Beschreibung:
+ ******************************************************************************/
+
+
+
+void SwEditWin::LoseFocus()
+{
+ rView.GetWrtShell().InvalidateAccessibleFocus();
+ Window::LoseFocus();
+ if( pQuickHlpData->bClear )
+ pQuickHlpData->Stop( rView.GetWrtShell() );
+ rView.LostFocus();
+}
+
+/******************************************************************************
+ * Beschreibung:
+ ******************************************************************************/
+
+
+
+void SwEditWin::Command( const CommandEvent& rCEvt )
+{
+ SwWrtShell &rSh = rView.GetWrtShell();
+
+ if ( !rView.GetViewFrame() )
+ {
+ //Wenn der ViewFrame in Kuerze stirbt kein Popup mehr!
+ Window::Command(rCEvt);
+ return;
+ }
+
+ // The command event is send to the window after a possible context
+ // menu from an inplace client has been closed. Now we have the chance
+ // to deactivate the inplace client without any problem regarding parent
+ // windows and code on the stack.
+ // For more information, see #126086# and #128122#
+ SfxInPlaceClient* pIPClient = rSh.GetSfxViewShell()->GetIPClient();
+ BOOL bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() );
+ if ( bIsOleActive && ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ))
+ {
+ rSh.FinishOLEObj();
+ return;
+ }
+
+ BOOL bCallBase = TRUE;
+
+ switch ( rCEvt.GetCommand() )
+ {
+ case COMMAND_CONTEXTMENU:
+ {
+ const USHORT nId = SwInputChild::GetChildWindowId();
+ SwInputChild* pChildWin = (SwInputChild*)GetView().GetViewFrame()->
+ GetChildWindow( nId );
+
+ if (rView.GetPostItMgr()->IsHit(rCEvt.GetMousePosPixel()))
+ return;
+
+ if((!pChildWin || pChildWin->GetView() != &rView) &&
+ !rSh.IsDrawCreate() && !IsDrawAction())
+ {
+ SET_CURR_SHELL( &rSh );
+ if (!pApplyTempl)
+ {
+ if (bNoInterrupt == TRUE)
+ {
+ ReleaseMouse();
+ bNoInterrupt = FALSE;
+ bMBPressed = FALSE;
+ }
+ Point aDocPos( PixelToLogic( rCEvt.GetMousePosPixel() ) );
+ if ( !rCEvt.IsMouseEvent() )
+ aDocPos = rSh.GetCharRect().Center();
+ else
+ {
+ SelectMenuPosition(rSh, rCEvt.GetMousePosPixel());
+ rView.StopShellTimer();
+
+ }
+ const Point aPixPos = LogicToPixel( aDocPos );
+
+ if ( rView.GetDocShell()->IsReadOnly() )
+ {
+ SwReadOnlyPopup* pROPopup = new SwReadOnlyPopup( aDocPos, rView );
+
+ ui::ContextMenuExecuteEvent aEvent;
+ aEvent.SourceWindow = VCLUnoHelper::GetInterface( this );
+ aEvent.ExecutePosition.X = aPixPos.X();
+ aEvent.ExecutePosition.Y = aPixPos.Y();
+ Menu* pMenu = 0;
+ ::rtl::OUString sMenuName =
+ ::rtl::OUString::createFromAscii( "private:resource/ReadonlyContextMenu");
+ if( GetView().TryContextMenuInterception( *pROPopup, sMenuName, pMenu, aEvent ) )
+ {
+ if ( pMenu )
+ {
+ USHORT nExecId = ((PopupMenu*)pMenu)->Execute(this, aPixPos);
+ if( !::ExecuteMenuCommand( *static_cast<PopupMenu*>(pMenu), *rView.GetViewFrame(), nExecId ))
+ pROPopup->Execute(this, nExecId);
+ }
+ else
+ pROPopup->Execute(this, aPixPos);
+ }
+ delete pROPopup;
+ }
+ else if ( !rView.ExecSpellPopup( aDocPos ) )
+ GetView().GetViewFrame()->GetDispatcher()->ExecutePopup( 0, this, &aPixPos);
+ }
+ else if (pApplyTempl->bUndo)
+ rSh.Do(SwWrtShell::UNDO);
+ bCallBase = FALSE;
+ }
+ }
+ break;
+
+ case COMMAND_WHEEL:
+ case COMMAND_STARTAUTOSCROLL:
+ case COMMAND_AUTOSCROLL:
+ if( pShadCrsr )
+ delete pShadCrsr, pShadCrsr = 0;
+ bCallBase = !rView.HandleWheelCommands( rCEvt );
+ break;
+
+ case COMMAND_VOICE:
+ {
+ //ggf. an Outliner weiterleiten
+ if ( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() )
+ {
+ bCallBase = FALSE;
+ rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt );
+ break;
+ }
+
+ const CommandVoiceData *pCData = rCEvt.GetVoiceData();
+ if ( VOICECOMMANDTYPE_CONTROL == pCData->GetType() )
+ break;
+
+
+ USHORT nSlotId = 0;
+ SfxPoolItem *pItem = 0;
+
+ switch ( pCData->GetCommand() )
+ {
+ case DICTATIONCOMMAND_NEWPARAGRAPH: nSlotId = FN_INSERT_BREAK; break;
+ case DICTATIONCOMMAND_NEWLINE: nSlotId = FN_INSERT_LINEBREAK; break;
+ case DICTATIONCOMMAND_LEFT: nSlotId = FN_PREV_WORD; break;
+ case DICTATIONCOMMAND_RIGHT: nSlotId = FN_NEXT_WORD; break;
+ case DICTATIONCOMMAND_UP: nSlotId = FN_LINE_UP; break;
+ case DICTATIONCOMMAND_DOWN: nSlotId = FN_LINE_DOWN; break;
+ case DICTATIONCOMMAND_UNDO: nSlotId = SID_UNDO; break;
+ case DICTATIONCOMMAND_REPEAT: nSlotId = SID_REPEAT; break;
+ case DICTATIONCOMMAND_DEL: nSlotId = FN_DELETE_BACK_WORD; break;
+
+ case DICTATIONCOMMAND_BOLD_ON: nSlotId = SID_ATTR_CHAR_WEIGHT;
+ pItem = new SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT );
+ break;
+ case DICTATIONCOMMAND_BOLD_OFF: nSlotId = SID_ATTR_CHAR_WEIGHT;
+ pItem = new SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_WEIGHT );
+ break;
+ case DICTATIONCOMMAND_UNDERLINE_ON: nSlotId = SID_ATTR_CHAR_UNDERLINE;
+ pItem = new SvxUnderlineItem( UNDERLINE_SINGLE, RES_CHRATR_WEIGHT );
+ break;
+ case DICTATIONCOMMAND_UNDERLINE_OFF:nSlotId = SID_ATTR_CHAR_UNDERLINE;
+ pItem = new SvxUnderlineItem( UNDERLINE_NONE, RES_CHRATR_UNDERLINE );
+ break;
+ case DICTATIONCOMMAND_ITALIC_ON: nSlotId = SID_ATTR_CHAR_POSTURE;
+ pItem = new SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE );
+ break;
+ case DICTATIONCOMMAND_ITALIC_OFF: nSlotId = SID_ATTR_CHAR_POSTURE;
+ pItem = new SvxPostureItem( ITALIC_NONE, RES_CHRATR_POSTURE );
+ break;
+ case DICTATIONCOMMAND_NUMBERING_ON:
+ if ( !rSh.GetCurNumRule() )
+ nSlotId = FN_NUM_NUMBERING_ON;
+ break;
+ case DICTATIONCOMMAND_NUMBERING_OFF:
+ if ( rSh.GetCurNumRule() )
+ nSlotId = FN_NUM_NUMBERING_ON;
+ break;
+ case DICTATIONCOMMAND_TAB:
+ {
+ rSh.Insert( '\t' );
+ }
+ break;
+ case DICTATIONCOMMAND_UNKNOWN:
+ {
+ rView.GetWrtShell().Insert( pCData->GetText() );
+ }
+ break;
+
+#ifdef DBG_UTIL
+ default:
+ ASSERT( !this, "unknown speech command." );
+#endif
+ }
+ if ( nSlotId )
+ {
+ bCallBase = FALSE;
+ if ( pItem )
+ {
+ const SfxPoolItem* aArgs[2];
+ aArgs[0] = pItem;
+ aArgs[1] = 0;
+ GetView().GetViewFrame()->GetBindings().Execute(
+ nSlotId, aArgs, 0, SFX_CALLMODE_STANDARD );
+ delete pItem;
+ }
+ else
+ GetView().GetViewFrame()->GetBindings().Execute( nSlotId );
+ }
+ }
+ break;
+
+ case COMMAND_STARTEXTTEXTINPUT:
+ {
+ BOOL bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() &&
+ rSh.IsCrsrReadonly();
+ if(!bIsDocReadOnly)
+ {
+ if( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() )
+ {
+ bCallBase = FALSE;
+ rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt );
+ }
+ else
+ {
+ if( rSh.HasSelection() )
+ rSh.DelRight();
+
+ bCallBase = FALSE;
+ LanguageType eInputLanguage = GetInputLanguage();
+ rSh.CreateExtTextInput(eInputLanguage);
+ }
+ }
+ break;
+ }
+ case COMMAND_ENDEXTTEXTINPUT:
+ {
+ BOOL bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() &&
+ rSh.IsCrsrReadonly();
+ if(!bIsDocReadOnly)
+ {
+ if( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() )
+ {
+ bCallBase = FALSE;
+ rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt );
+ }
+ else
+ {
+ bCallBase = FALSE;
+ String sRecord = rSh.DeleteExtTextInput();
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ rView.GetViewFrame()->GetBindings().GetRecorder();
+
+ if ( sRecord.Len() )
+ {
+ // #102812# convert quotes in IME text
+ // works on the last input character, this is escpecially in Korean text often done
+ // quotes that are inside of the string are not replaced!
+ const sal_Unicode aCh = sRecord.GetChar(sRecord.Len() - 1);
+ SvxAutoCorrCfg* pACfg = SvxAutoCorrCfg::Get();
+ SvxAutoCorrect* pACorr = pACfg->GetAutoCorrect();
+ if(pACorr &&
+ (( pACorr->IsAutoCorrFlag( ChgQuotes ) && ('\"' == aCh ))||
+ ( pACorr->IsAutoCorrFlag( ChgSglQuotes ) && ( '\'' == aCh))))
+ {
+ rSh.DelLeft();
+ rSh.AutoCorrect( *pACorr, aCh );
+ }
+
+ if ( xRecorder.is() )
+ {
+ //Shell ermitteln
+ SfxShell *pSfxShell = lcl_GetShellFromDispatcher( rView, TYPE(SwTextShell) );
+ // Request generieren und recorden
+ if (pSfxShell)
+ {
+ SfxRequest aReq( rView.GetViewFrame(), FN_INSERT_STRING );
+ aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, sRecord ) );
+ aReq.Done();
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+ case COMMAND_EXTTEXTINPUT:
+ {
+ BOOL bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() &&
+ rSh.IsCrsrReadonly();
+ if(!bIsDocReadOnly)
+ {
+ QuickHelpData aTmpQHD;
+ if( pQuickHlpData->bClear )
+ {
+ aTmpQHD.Move( *pQuickHlpData );
+ pQuickHlpData->Stop( rSh );
+ }
+ String sWord;
+ if( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() )
+ {
+ bCallBase = FALSE;
+ rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt );
+ }
+ else
+ {
+ const CommandExtTextInputData* pData = rCEvt.GetExtTextInputData();
+ if( pData )
+ {
+ sWord = pData->GetText();
+ bCallBase = FALSE;
+ rSh.SetExtTextInputData( *pData );
+ }
+ }
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ rView.GetViewFrame()->GetBindings().GetRecorder();
+ if(!xRecorder.is())
+ {
+ SvxAutoCorrCfg* pACfg = SvxAutoCorrCfg::Get();
+ SvxAutoCorrect* pACorr = pACfg->GetAutoCorrect();
+ if( pACfg && pACorr &&
+ ( pACfg->IsAutoTextTip() ||
+ pACorr->GetSwFlags().bAutoCompleteWords ) &&
+ rSh.GetPrevAutoCorrWord( *pACorr, sWord ) )
+ {
+ ShowAutoTextCorrectQuickHelp(sWord, pACfg, pACorr, sal_True);
+ }
+ }
+ }
+ }
+ break;
+ case COMMAND_CURSORPOS:
+ // will be handled by the base class
+ break;
+
+ case COMMAND_PASTESELECTION:
+ if( !rView.GetDocShell()->IsReadOnly() )
+ {
+ TransferableDataHelper aDataHelper(
+ TransferableDataHelper::CreateFromSelection( this ));
+ if( !aDataHelper.GetXTransferable().is() )
+ break;
+
+ ULONG nDropFormat;
+ USHORT nEventAction, nDropAction, nDropDestination;
+ nDropDestination = GetDropDestination( rCEvt.GetMousePosPixel() );
+ if( !nDropDestination )
+ break;
+
+ nDropAction = SotExchange::GetExchangeAction(
+ aDataHelper.GetDataFlavorExVector(),
+ nDropDestination, EXCHG_IN_ACTION_COPY,
+ EXCHG_IN_ACTION_COPY, nDropFormat,
+ nEventAction );
+ if( EXCHG_INOUT_ACTION_NONE != nDropAction )
+ {
+ const Point aDocPt( PixelToLogic( rCEvt.GetMousePosPixel() ) );
+ SwTransferable::PasteData( aDataHelper, rSh, nDropAction,
+ nDropFormat, nDropDestination, FALSE,
+ FALSE, &aDocPt, EXCHG_IN_ACTION_COPY,
+ TRUE );
+ }
+ }
+ break;
+ case COMMAND_MODKEYCHANGE :
+ {
+ const CommandModKeyData* pCommandData = (const CommandModKeyData*)rCEvt.GetData();
+ if(pCommandData->IsMod1() && !pCommandData->IsMod2())
+ {
+ USHORT nSlot = 0;
+ if(pCommandData->IsLeftShift() && !pCommandData->IsRightShift())
+ nSlot = SID_ATTR_PARA_LEFT_TO_RIGHT;
+ else if(!pCommandData->IsLeftShift() && pCommandData->IsRightShift())
+ nSlot = SID_ATTR_PARA_RIGHT_TO_LEFT;
+ if(nSlot && SW_MOD()->GetCTLOptions().IsCTLFontEnabled())
+ GetView().GetViewFrame()->GetDispatcher()->Execute(nSlot);
+ }
+ }
+ break;
+ case COMMAND_HANGUL_HANJA_CONVERSION :
+ GetView().GetViewFrame()->GetDispatcher()->Execute(SID_HANGUL_HANJA_CONVERSION);
+ break;
+ case COMMAND_INPUTLANGUAGECHANGE :
+ //#i42732# update state of fontname if input language changes
+ bInputLanguageSwitched = true;
+ SetUseInputLanguage( sal_True );
+ break;
+ case COMMAND_SELECTIONCHANGE:
+ {
+ const CommandSelectionChangeData *pData = rCEvt.GetSelectionChangeData();
+ rSh.SttCrsrMove();
+ rSh.GoStartSentence();
+ rSh.GetCrsr()->GetPoint()->nContent += sal::static_int_cast<sal_uInt16, ULONG>(pData->GetStart());
+ rSh.SetMark();
+ rSh.GetCrsr()->GetMark()->nContent += sal::static_int_cast<sal_uInt16, ULONG>(pData->GetEnd() - pData->GetStart());
+ rSh.EndCrsrMove( TRUE );
+ }
+ break;
+ case COMMAND_PREPARERECONVERSION:
+ if( rSh.HasSelection() )
+ {
+ SwPaM *pCrsr = (SwPaM*)rSh.GetCrsr();
+
+ if( rSh.IsMultiSelection() )
+ {
+ if( pCrsr && !pCrsr->HasMark() &&
+ pCrsr->GetPoint() == pCrsr->GetMark() )
+ {
+ rSh.GoPrevCrsr();
+ pCrsr = (SwPaM*)rSh.GetCrsr();
+ }
+
+ // Cancel all selections other than the last selected one.
+ while( rSh.GetCrsr()->GetNext() != rSh.GetCrsr() )
+ delete rSh.GetCrsr()->GetNext();
+ }
+
+ if( pCrsr )
+ {
+ ULONG nPosNodeIdx = pCrsr->GetPoint()->nNode.GetIndex();
+ xub_StrLen nPosIdx = pCrsr->GetPoint()->nContent.GetIndex();
+ ULONG nMarkNodeIdx = pCrsr->GetMark()->nNode.GetIndex();
+ xub_StrLen nMarkIdx = pCrsr->GetMark()->nContent.GetIndex();
+
+ if( !rSh.GetCrsr()->HasMark() )
+ rSh.GetCrsr()->SetMark();
+
+ rSh.SttCrsrMove();
+
+ if( nPosNodeIdx < nMarkNodeIdx )
+ {
+ rSh.GetCrsr()->GetPoint()->nNode = nPosNodeIdx;
+ rSh.GetCrsr()->GetPoint()->nContent = nPosIdx;
+ rSh.GetCrsr()->GetMark()->nNode = nPosNodeIdx;
+ rSh.GetCrsr()->GetMark()->nContent =
+ rSh.GetCrsr()->GetCntntNode( TRUE )->Len();
+ }
+ else if( nPosNodeIdx == nMarkNodeIdx )
+ {
+ rSh.GetCrsr()->GetPoint()->nNode = nPosNodeIdx;
+ rSh.GetCrsr()->GetPoint()->nContent = nPosIdx;
+ rSh.GetCrsr()->GetMark()->nNode = nMarkNodeIdx;
+ rSh.GetCrsr()->GetMark()->nContent = nMarkIdx;
+ }
+ else
+ {
+ rSh.GetCrsr()->GetMark()->nNode = nMarkNodeIdx;
+ rSh.GetCrsr()->GetMark()->nContent = nMarkIdx;
+ rSh.GetCrsr()->GetPoint()->nNode = nMarkNodeIdx;
+ rSh.GetCrsr()->GetPoint()->nContent =
+ rSh.GetCrsr()->GetCntntNode( FALSE )->Len();
+ }
+
+ rSh.EndCrsrMove( TRUE );
+ }
+ }
+ break;
+#ifdef DBG_UTIL
+ default:
+ ASSERT( !this, "unknown command." );
+#endif
+ }
+ if (bCallBase)
+ Window::Command(rCEvt);
+}
+
+/* -----------------25.08.2003 10:12-----------------
+ #i18686#: select the object/cursor at the mouse
+ position of the context menu request
+ --------------------------------------------------*/
+BOOL SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos )
+{
+ BOOL bRet = FALSE;
+ const Point aDocPos( PixelToLogic( rMousePos ) );
+ // --> OD 2005-02-17 #i42258#
+ const bool bIsInsideSelectedObj( rSh.IsInsideSelectedObj( aDocPos ) );
+ // <--
+ //create a synthetic mouse event out of the coordinates
+ MouseEvent aMEvt(rMousePos);
+ SdrView *pSdrView = rSh.GetDrawView();
+ if ( pSdrView )
+ {
+ // --> OD 2005-02-17 #i42258# - no close of insert_draw and reset of
+ // draw mode, if context menu position is inside a selected object.
+ if ( !bIsInsideSelectedObj && rView.GetDrawFuncPtr() )
+ // <--
+ {
+
+ rView.GetDrawFuncPtr()->Deactivate();
+ rView.SetDrawFuncPtr(NULL);
+ rView.LeaveDrawCreate();
+ SfxBindings& rBind = rView.GetViewFrame()->GetBindings();
+ rBind.Invalidate( SID_ATTR_SIZE );
+ rBind.Invalidate( SID_TABLE_CELL );
+ }
+
+ // if draw text is active and there's a text selection
+ // at the mouse position then do nothing
+ if(rSh.GetSelectionType() & nsSelectionType::SEL_DRW_TXT)
+ {
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ ESelection aSelection = pOLV->GetSelection();
+ if(!aSelection.IsZero())
+ {
+ SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner();
+ BOOL bVertical = pOutliner->IsVertical();
+ const EditEngine& rEditEng = pOutliner->GetEditEngine();
+ Point aEEPos(aDocPos);
+ const Rectangle& rOutputArea = pOLV->GetOutputArea();
+ // regard vertical mode
+ if(bVertical)
+ {
+ aEEPos -= rOutputArea.TopRight();
+ //invert the horizontal direction and exchange X and Y
+ long nTemp = -aEEPos.X();
+ aEEPos.X() = aEEPos.Y();
+ aEEPos.Y() = nTemp;
+ }
+ else
+ aEEPos -= rOutputArea.TopLeft();
+
+ EPosition aDocPosition = rEditEng.FindDocPosition(aEEPos);
+ ESelection aCompare(aDocPosition.nPara, aDocPosition.nIndex);
+ // make it a forward selection - otherwise the IsLess/IsGreater do not work :-(
+ aSelection.Adjust();
+ if(!aCompare.IsLess(aSelection) && !aCompare.IsGreater(aSelection))
+ {
+ return FALSE;
+ }
+ }
+
+ }
+
+ if (pSdrView->MouseButtonDown( aMEvt, this ) )
+ {
+ pSdrView->MouseButtonUp( aMEvt, this );
+ rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll(FALSE);
+ return TRUE;
+ }
+ }
+ rSh.ResetCursorStack();
+
+ if ( EnterDrawMode( aMEvt, aDocPos ) )
+ {
+ return TRUE;
+ }
+ if ( rView.GetDrawFuncPtr() && bInsFrm )
+ {
+ StopInsFrm();
+ rSh.Edit();
+ }
+
+ UpdatePointer( aDocPos, 0 );
+
+ if( !rSh.IsSelFrmMode() &&
+ !GetView().GetViewFrame()->GetDispatcher()->IsLocked() )
+ {
+ // #107513#
+ // Test if there is a draw object at that position and if it should be selected.
+ sal_Bool bShould = rSh.ShouldObjectBeSelected(aDocPos);
+
+ if(bShould)
+ {
+ rView.NoRotate();
+ rSh.HideCrsr();
+
+ BOOL bUnLockView = !rSh.IsViewLocked();
+ rSh.LockView( TRUE );
+ BOOL bSelObj = rSh.SelectObj( aDocPos, 0);
+ if( bUnLockView )
+ rSh.LockView( FALSE );
+
+ if( bSelObj )
+ {
+ bRet = TRUE;
+ // falls im Macro der Rahmen deselektiert
+ // wurde, muss nur noch der Cursor
+ // wieder angezeigt werden.
+ if( FRMTYPE_NONE == rSh.GetSelFrmType() )
+ rSh.ShowCrsr();
+ else
+ {
+ if (rSh.IsFrmSelected() && rView.GetDrawFuncPtr())
+ {
+ rView.GetDrawFuncPtr()->Deactivate();
+ rView.SetDrawFuncPtr(NULL);
+ rView.LeaveDrawCreate();
+ rView.AttrChangedNotify( &rSh );
+ }
+
+ rSh.EnterSelFrmMode( &aDocPos );
+ bFrmDrag = TRUE;
+ UpdatePointer( aDocPos, 0 );
+ return bRet;
+ }
+ }
+
+ if (!rView.GetDrawFuncPtr())
+ rSh.ShowCrsr();
+ }
+ }
+ else if ( rSh.IsSelFrmMode() &&
+ (aActHitType == SDRHIT_NONE ||
+ !bIsInsideSelectedObj))
+ {
+ rView.NoRotate();
+ BOOL bUnLockView = !rSh.IsViewLocked();
+ rSh.LockView( TRUE );
+ BYTE nFlag = 0;
+
+ if ( rSh.IsSelFrmMode() )
+ {
+ rSh.UnSelectFrm();
+ rSh.LeaveSelFrmMode();
+ rView.AttrChangedNotify(&rSh);
+ bRet = TRUE;
+ }
+
+ BOOL bSelObj = rSh.SelectObj( aDocPos, nFlag );
+ if( bUnLockView )
+ rSh.LockView( FALSE );
+
+ if( !bSelObj )
+ {
+ // Cursor hier umsetzen, damit er nicht zuerst
+ // im Rahmen gezeichnet wird; ShowCrsr() geschieht
+ // in LeaveSelFrmMode()
+ bValidCrsrPos = !(CRSR_POSCHG & (rSh.*rSh.fnSetCrsr)(&aDocPos,FALSE));
+ rSh.LeaveSelFrmMode();
+ rView.LeaveDrawCreate();
+ rView.AttrChangedNotify( &rSh );
+ bRet = TRUE;
+ }
+ else
+ {
+ rSh.HideCrsr();
+ rSh.EnterSelFrmMode( &aDocPos );
+ rSh.SelFlyGrabCrsr();
+ rSh.MakeSelVisible();
+ bFrmDrag = TRUE;
+ if( rSh.IsFrmSelected() &&
+ rView.GetDrawFuncPtr() )
+ {
+ rView.GetDrawFuncPtr()->Deactivate();
+ rView.SetDrawFuncPtr(NULL);
+ rView.LeaveDrawCreate();
+ rView.AttrChangedNotify( &rSh );
+ }
+ UpdatePointer( aDocPos, 0 );
+ bRet = TRUE;
+ }
+ }
+ else if ( rSh.IsSelFrmMode() && bIsInsideSelectedObj )
+ {
+ // ## object at the mouse cursor is already selected - do nothing
+ return FALSE;
+ }
+
+ if ( rSh.IsGCAttr() )
+ {
+ rSh.GCAttr();
+ rSh.ClearGCAttr();
+ }
+
+ BOOL bOverSelect = rSh.ChgCurrPam( aDocPos ), bOverURLGrf = FALSE;
+ if( !bOverSelect )
+ bOverURLGrf = bOverSelect = 0 != rSh.IsURLGrfAtPos( aDocPos );
+
+ if ( !bOverSelect )
+ {
+ { // nur temp. Move-Kontext aufspannen, da sonst die
+ // Abfrage auf die Inhaltsform nicht funktioniert!!!
+ MV_KONTEXT( &rSh );
+ (rSh.*rSh.fnSetCrsr)(&aDocPos, FALSE);
+ bRet = TRUE;
+ }
+ }
+ if( !bOverURLGrf )
+ {
+ const int nSelType = rSh.GetSelectionType();
+ if( nSelType == nsSelectionType::SEL_OLE ||
+ nSelType == nsSelectionType::SEL_GRF )
+ {
+ MV_KONTEXT( &rSh );
+ if( !rSh.IsFrmSelected() )
+ rSh.GotoNextFly();
+ rSh.EnterSelFrmMode();
+ bRet = TRUE;
+ }
+ }
+ return bRet;
+}
+
+SfxShell* lcl_GetShellFromDispatcher( SwView& rView, TypeId nType )
+{
+ //Shell ermitteln
+ SfxShell* pShell;
+ SfxDispatcher* pDispatcher = rView.GetViewFrame()->GetDispatcher();
+ for(USHORT i = 0; TRUE; ++i )
+ {
+ pShell = pDispatcher->GetShell( i );
+ if( !pShell || pShell->IsA( nType ) )
+ break;
+ }
+ return pShell;
+}
+
+
+
+void SwEditWin::ClearTip()
+{
+}
+
+IMPL_LINK( SwEditWin, KeyInputFlushHandler, Timer *, EMPTYARG )
+{
+ FlushInBuffer();
+ return 0;
+}
+
+
+IMPL_LINK( SwEditWin, KeyInputTimerHandler, Timer *, EMPTYARG )
+{
+ bTblInsDelMode = FALSE;
+ return 0;
+}
+
+void SwEditWin::_InitStaticData()
+{
+ pQuickHlpData = new QuickHelpData();
+}
+
+void SwEditWin::_FinitStaticData()
+{
+ delete pQuickHlpData;
+}
+/* -----------------23.01.2003 12:15-----------------
+ * #i3370# remove quick help to prevent saving
+ * of autocorrection suggestions
+ * --------------------------------------------------*/
+void SwEditWin::StopQuickHelp()
+{
+ if( HasFocus() && pQuickHlpData && pQuickHlpData->bClear )
+ pQuickHlpData->Stop( rView.GetWrtShell() );
+}
+
+/*-----------------23.02.97 18:39-------------------
+
+--------------------------------------------------*/
+
+
+IMPL_LINK(SwEditWin, TemplateTimerHdl, Timer*, EMPTYARG)
+{
+ SetApplyTemplate(SwApplyTemplate());
+ return 0;
+}
+
+
+void SwEditWin::SetChainMode( BOOL bOn )
+{
+ if ( !bChainMode )
+ StopInsFrm();
+
+ if ( pUserMarker )
+ {
+ delete pUserMarker;
+ pUserMarker = 0L;
+ }
+
+ bChainMode = bOn;
+ if ( !bChainMode )
+ rView.GetViewFrame()->HideStatusText();
+
+ static USHORT __READONLY_DATA aInva[] =
+ {
+ FN_FRAME_CHAIN, FN_FRAME_UNCHAIN, 0
+ };
+ rView.GetViewFrame()->GetBindings().Invalidate(aInva);
+}
+
+uno::Reference< ::com::sun::star::accessibility::XAccessible > SwEditWin::CreateAccessible()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex()); // this should have
+ // happend already!!!
+ SwWrtShell *pSh = rView.GetWrtShellPtr();
+ ASSERT( pSh, "no writer shell, no accessible object" );
+ uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > xAcc;
+ if( pSh )
+ xAcc = pSh->CreateAccessible();
+
+ return xAcc;
+}
+
+//-------------------------------------------------------------
+
+void QuickHelpData::Move( QuickHelpData& rCpy )
+{
+ // Pointer verschieben
+ aArr.Insert( &rCpy.aArr );
+ rCpy.aArr.Remove( (USHORT)0, rCpy.aArr.Count() );
+// nTipId = rCpy.nTipId;
+ bClear = rCpy.bClear;
+ nLen = rCpy.nLen;
+ nCurArrPos = rCpy.nCurArrPos;
+ bChkInsBlank = rCpy.bChkInsBlank;
+ bIsTip = rCpy.bIsTip;
+ bIsAutoText = rCpy.bIsAutoText;
+
+ if( pCETID ) delete pCETID;
+ pCETID = rCpy.pCETID;
+ rCpy.pCETID = 0;
+
+ if( pAttrs )
+ delete[] pAttrs;
+ pAttrs = rCpy.pAttrs;
+ rCpy.pAttrs = 0;
+}
+
+void QuickHelpData::ClearCntnt()
+{
+ nLen = nCurArrPos = 0;
+ bClear = bChkInsBlank = FALSE;
+ nTipId = 0;
+ aArr.DeleteAndDestroy( 0 , aArr.Count() );
+ bIsTip = TRUE;
+ bIsAutoText = TRUE;
+ delete pCETID, pCETID = 0;
+ delete[] pAttrs, pAttrs = 0;
+}
+
+
+void QuickHelpData::Start( SwWrtShell& rSh, USHORT nWrdLen )
+{
+ if( pCETID ) delete pCETID, pCETID = 0;
+ if( pAttrs ) delete[] pAttrs, pAttrs = 0;
+
+ if( USHRT_MAX != nWrdLen )
+ {
+ nLen = nWrdLen;
+ nCurArrPos = 0;
+ }
+ bClear = TRUE;
+
+ Window& rWin = rSh.GetView().GetEditWin();
+ if( bIsTip )
+ {
+ Point aPt( rWin.OutputToScreenPixel( rWin.LogicToPixel(
+ rSh.GetCharRect().Pos() )));
+ aPt.Y() -= 3;
+ nTipId = Help::ShowTip( &rWin, Rectangle( aPt, Size( 1, 1 )),
+ *aArr[ nCurArrPos ],
+ QUICKHELP_LEFT | QUICKHELP_BOTTOM );
+ }
+ else
+ {
+ String sStr( *aArr[ nCurArrPos ] );
+ sStr.Erase( 0, nLen );
+ USHORT nL = sStr.Len();
+ pAttrs = new USHORT[ nL ];
+ for( USHORT n = nL; n; )
+ *(pAttrs + --n ) = EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE |
+ EXTTEXTINPUT_ATTR_HIGHLIGHT;
+ pCETID = new CommandExtTextInputData( sStr, pAttrs, nL,
+ 0, 0, 0, FALSE );
+ rSh.CreateExtTextInput(rWin.GetInputLanguage());
+ rSh.SetExtTextInputData( *pCETID );
+ }
+}
+
+void QuickHelpData::Stop( SwWrtShell& rSh )
+{
+ if( !bIsTip )
+ rSh.DeleteExtTextInput( 0, FALSE );
+ else if( nTipId )
+ Help::HideTip( nTipId );
+ ClearCntnt();
+}
+
+
+
+void QuickHelpData::FillStrArr( SwWrtShell& rSh, const String& rWord )
+{
+ salhelper::SingletonRef<SwCalendarWrapper>* pCalendar = s_getCalendarWrapper();
+ (*pCalendar)->LoadDefaultCalendar( rSh.GetCurLang() );
+
+ {
+ uno::Sequence< i18n::CalendarItem > aNames(
+ (*pCalendar)->getMonths() );
+ for( int n = 0; n < 2; ++n )
+ {
+ for( long nPos = 0, nEnd = aNames.getLength(); nPos < nEnd; ++nPos )
+ {
+ String sStr( aNames[ nPos ].FullName );
+ if( rWord.Len() + 1 < sStr.Len() &&
+
+//!!! UNICODE: fehlendes interface
+// pIntl->CompareEqual( rWord, sStr.Copy( 0, rWord.Len() ),
+// INTN_COMPARE_IGNORECASE ) )
+ COMPARE_EQUAL == rWord.CompareIgnoreCaseToAscii(
+ sStr, rWord.Len() ))
+ {
+ String* pNew = new String( sStr );
+ if( !aArr.Insert( pNew ) )
+ delete pNew;
+ }
+ }
+ if( !n ) // get data for the second loop
+ aNames = (*pCalendar)->getDays();
+ }
+ }
+
+ // and than add all words from the AutoCompleteWord-List
+ const SwAutoCompleteWord& rACLst = rSh.GetAutoCompleteWords();
+ USHORT nStt, nEnd;
+ if( rACLst.GetRange( rWord, nStt, nEnd ) )
+ {
+ while( nStt < nEnd )
+ {
+ const String& rS = rACLst[ nStt ];
+ //JP 16.06.99: Bug 66927 - only if the count of chars
+ // from the suggest greater as the
+ // actual word
+ if( rS.Len() > rWord.Len() )
+ {
+ String* pNew = new String( rS );
+ if( !aArr.Insert( pNew ) )
+ delete pNew;
+ }
+ ++nStt;
+ }
+ }
+}
+/* -----------------06.11.2002 12:01-----------------
+ *
+ * --------------------------------------------------*/
+void SwEditWin::ShowAutoTextCorrectQuickHelp(
+ const String& rWord, SvxAutoCorrCfg* pACfg, SvxAutoCorrect* pACorr,
+ sal_Bool bFromIME )
+{
+ SwWrtShell& rSh = rView.GetWrtShell();
+ pQuickHlpData->ClearCntnt();
+ if( pACfg->IsAutoTextTip() )
+ {
+ SwGlossaryList* pList = ::GetGlossaryList();
+ pList->HasLongName( rWord, &pQuickHlpData->aArr );
+ }
+
+ if( pQuickHlpData->aArr.Count() )
+ {
+ pQuickHlpData->bIsTip = TRUE;
+ pQuickHlpData->bIsAutoText = TRUE;
+ }
+ else if( pACorr->GetSwFlags().bAutoCompleteWords )
+ {
+ pQuickHlpData->bIsAutoText = FALSE;
+ pQuickHlpData->bIsTip = bFromIME ||
+ !pACorr ||
+ pACorr->GetSwFlags().bAutoCmpltShowAsTip;
+
+ pQuickHlpData->FillStrArr( rSh, rWord );
+ }
+
+ if( pQuickHlpData->aArr.Count() )
+ pQuickHlpData->Start( rSh, rWord.Len() );
+}
+
+/* -----------------29.03.2006 11:01-----------------
+ *
+ * --------------------------------------------------*/
+
+void SwEditWin::SetUseInputLanguage( sal_Bool bNew )
+{
+ if ( bNew || bUseInputLanguage )
+ {
+ SfxBindings& rBind = GetView().GetViewFrame()->GetBindings();
+ rBind.Invalidate( SID_ATTR_CHAR_FONT );
+ rBind.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
+ }
+ bUseInputLanguage = bNew;
+}
+
+/*-- 13.11.2008 10:18:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+XubString SwEditWin::GetSurroundingText() const
+{
+ String sReturn;
+ SwWrtShell& rSh = rView.GetWrtShell();
+ if( rSh.HasSelection() && !rSh.IsMultiSelection() && rSh.IsSelOnePara() )
+ rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR );
+ else if( !rSh.HasSelection() )
+ {
+ SwPosition *pPos = rSh.GetCrsr()->GetPoint();
+ xub_StrLen nPos = pPos->nContent.GetIndex();
+
+ // get the sentence around the cursor
+ rSh.HideCrsr();
+ rSh.GoStartSentence();
+ rSh.SetMark();
+ rSh.GoEndSentence();
+ rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR );
+
+ pPos->nContent = nPos;
+ rSh.ClearMark();
+ rSh.HideCrsr();
+ }
+
+ return sReturn;
+}
+/*-- 13.11.2008 10:18:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Selection SwEditWin::GetSurroundingTextSelection() const
+{
+ SwWrtShell& rSh = rView.GetWrtShell();
+ if( rSh.HasSelection() )
+ {
+ String sReturn;
+ rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR );
+ return Selection( 0, sReturn.Len() );
+ }
+ else
+ {
+ // Return the position of the visible cursor in the sentence
+ // around the visible cursor.
+ SwPosition *pPos = rSh.GetCrsr()->GetPoint();
+ xub_StrLen nPos = pPos->nContent.GetIndex();
+
+ rSh.HideCrsr();
+ rSh.GoStartSentence();
+ xub_StrLen nStartPos = rSh.GetCrsr()->GetPoint()->nContent.GetIndex();
+
+ pPos->nContent = nPos;
+ rSh.ClearMark();
+ rSh.ShowCrsr();
+
+ return Selection( nPos - nStartPos, nPos - nStartPos );
+ }
+}
diff --git a/sw/source/ui/docvw/edtwin2.cxx b/sw/source/ui/docvw/edtwin2.cxx
new file mode 100644
index 000000000000..1ecf32144ee5
--- /dev/null
+++ b/sw/source/ui/docvw/edtwin2.cxx
@@ -0,0 +1,592 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <tools/ref.hxx>
+#include <hintids.hxx>
+
+#include <doc.hxx>
+#ifdef DBG_UTIL
+#include <stdio.h>
+#endif
+
+#include <vcl/help.hxx>
+#include <svl/stritem.hxx>
+#include <unotools/securityoptions.hxx>
+#include <tools/urlobj.hxx>
+#include <txtrfmrk.hxx>
+#include <fmtrfmrk.hxx>
+#include <editeng/flditem.hxx>
+#include <svl/urihelper.hxx>
+#include <svx/svdotext.hxx>
+#include <editeng/outliner.hxx>
+#include <svl/itemiter.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdpagv.hxx>
+#include <swmodule.hxx>
+#include <modcfg.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <edtwin.hxx>
+#include <dpage.hxx>
+#include <shellres.hxx>
+#include <docufld.hxx>
+#include <dbfld.hxx>
+#include <reffld.hxx>
+#include <cellatr.hxx>
+#include <shdwcrsr.hxx>
+#include <fmtcol.hxx>
+#include <charfmt.hxx>
+#include <fmtftn.hxx>
+#include <redline.hxx>
+#include <tox.hxx>
+#include <txttxmrk.hxx>
+#include <uitool.hxx>
+#include <viewopt.hxx>
+#include <docvw.hrc>
+#include <utlui.hrc>
+
+#include <PostItMgr.hxx>
+#include <fmtfld.hxx>
+
+// --> OD 2009-08-18 #i104300#
+#include <IDocumentMarkAccess.hxx>
+#include <ndtxt.hxx>
+// <--
+
+/*--------------------------------------------------------------------
+ Beschreibung: KeyEvents
+ --------------------------------------------------------------------*/
+static void lcl_GetRedlineHelp( const SwRedline& rRedl, String& rTxt, BOOL bBalloon )
+{
+ USHORT nResId = 0;
+ switch( rRedl.GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT: nResId = STR_REDLINE_INSERT; break;
+ case nsRedlineType_t::REDLINE_DELETE: nResId = STR_REDLINE_DELETE; break;
+ case nsRedlineType_t::REDLINE_FORMAT: nResId = STR_REDLINE_FORMAT; break;
+ case nsRedlineType_t::REDLINE_TABLE: nResId = STR_REDLINE_TABLE; break;
+ case nsRedlineType_t::REDLINE_FMTCOLL: nResId = STR_REDLINE_FMTCOLL; break;
+ }
+
+ if( nResId )
+ {
+ rTxt = SW_RESSTR( nResId );
+ rTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM(": " ));
+ rTxt += rRedl.GetAuthorString();
+ rTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " ));
+ rTxt += GetAppLangDateTimeString( rRedl.GetTimeStamp() );
+ if( bBalloon && rRedl.GetComment().Len() )
+ ( rTxt += '\n' ) += rRedl.GetComment();
+ }
+}
+
+
+void SwEditWin::RequestHelp(const HelpEvent &rEvt)
+{
+ SwWrtShell &rSh = rView.GetWrtShell();
+ BOOL bQuickBalloon = 0 != (rEvt.GetMode() & ( HELPMODE_QUICK | HELPMODE_BALLOON ));
+ if(bQuickBalloon && rSh.GetViewOptions()->IsPreventTips())
+ return;
+ BOOL bWeiter = TRUE;
+ SET_CURR_SHELL(&rSh);
+ String sTxt;
+ Point aPos( PixelToLogic( ScreenToOutputPixel( rEvt.GetMousePosPixel() ) ));
+ BOOL bBalloon = static_cast< BOOL >(rEvt.GetMode() & HELPMODE_BALLOON);
+
+ SdrView *pSdrView = rSh.GetDrawView();
+
+ if( bQuickBalloon )
+ {
+ if( pSdrView )
+ {
+ SdrPageView* pPV = pSdrView->GetSdrPageView();
+ SwDPage* pPage = pPV ? ((SwDPage*)pPV->GetPage()) : 0;
+ bWeiter = pPage && pPage->RequestHelp(this, pSdrView, rEvt);
+ }
+ }
+
+ if( bWeiter && bQuickBalloon)
+ {
+ SwRect aFldRect;
+ USHORT nStyle = 0; // style of quick help
+ SwContentAtPos aCntntAtPos( SwContentAtPos::SW_FIELD |
+ SwContentAtPos::SW_INETATTR |
+ SwContentAtPos::SW_FTN |
+ SwContentAtPos::SW_REDLINE |
+ SwContentAtPos::SW_TOXMARK |
+ SwContentAtPos::SW_REFMARK |
+ SwContentAtPos::SW_SMARTTAG |
+#ifdef DBG_UTIL
+ SwContentAtPos::SW_TABLEBOXVALUE |
+ ( bBalloon ? SwContentAtPos::SW_CURR_ATTRS : 0) |
+#endif
+ SwContentAtPos::SW_TABLEBOXFML );
+
+ if( rSh.GetContentAtPos( aPos, aCntntAtPos, FALSE, &aFldRect ) )
+ {
+ switch( aCntntAtPos.eCntntAtPos )
+ {
+ case SwContentAtPos::SW_TABLEBOXFML:
+ sTxt.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "= " ));
+ sTxt += ((SwTblBoxFormula*)aCntntAtPos.aFnd.pAttr)->GetFormula();
+ break;
+#ifdef DBG_UTIL
+ case SwContentAtPos::SW_TABLEBOXVALUE:
+ {
+ sTxt = UniString(
+ ByteString::CreateFromDouble(
+ ((SwTblBoxValue*)aCntntAtPos.aFnd.pAttr)->GetValue() )
+ , gsl_getSystemTextEncoding());
+ }
+ break;
+ case SwContentAtPos::SW_CURR_ATTRS:
+ sTxt = aCntntAtPos.sStr;
+ break;
+#endif
+
+ case SwContentAtPos::SW_INETATTR:
+ {
+ sTxt = ((SfxStringItem*)aCntntAtPos.aFnd.pAttr)->GetValue();
+ sTxt = URIHelper::removePassword( sTxt,
+ INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS);
+ //#i63832# remove the link target type
+ xub_StrLen nFound = sTxt.Search(cMarkSeperator);
+ if( nFound != STRING_NOTFOUND && (++nFound) < sTxt.Len() )
+ {
+ String sSuffix( sTxt.Copy(nFound) );
+ if( sSuffix.EqualsAscii( pMarkToTable ) ||
+ sSuffix.EqualsAscii( pMarkToFrame ) ||
+ sSuffix.EqualsAscii( pMarkToRegion ) ||
+ sSuffix.EqualsAscii( pMarkToOutline ) ||
+ sSuffix.EqualsAscii( pMarkToText ) ||
+ sSuffix.EqualsAscii( pMarkToGraphic ) ||
+ sSuffix.EqualsAscii( pMarkToOLE ))
+ sTxt = sTxt.Copy( 0, nFound - 1);
+ }
+ // --> OD 2009-08-18 #i104300#
+ // special handling if target is a cross-reference bookmark
+ {
+ String sTmpSearchStr = sTxt.Copy( 1, sTxt.Len() );
+ IDocumentMarkAccess* const pMarkAccess =
+ rSh.getIDocumentMarkAccess();
+ IDocumentMarkAccess::const_iterator_t ppBkmk =
+ pMarkAccess->findBookmark( sTmpSearchStr );
+ if ( ppBkmk != pMarkAccess->getBookmarksEnd() &&
+ IDocumentMarkAccess::GetType( *(ppBkmk->get()) )
+ == IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK )
+ {
+ SwTxtNode* pTxtNode = ppBkmk->get()->GetMarkStart().nNode.GetNode().GetTxtNode();
+ if ( pTxtNode )
+ {
+ sTxt = pTxtNode->GetExpandTxt( 0, pTxtNode->Len(), true, true );
+
+ if( sTxt.Len() )
+ {
+ sTxt.EraseAllChars( 0xad );
+ for( sal_Unicode* p = sTxt.GetBufferAccess(); *p; ++p )
+ {
+ if( *p < 0x20 )
+ *p = 0x20;
+ else if(*p == 0x2011)
+ *p = '-';
+ }
+ }
+ }
+ }
+ }
+ // <--
+ // --> OD 2007-07-26 #i80029#
+ BOOL bExecHyperlinks = rView.GetDocShell()->IsReadOnly();
+ if ( !bExecHyperlinks )
+ {
+ SvtSecurityOptions aSecOpts;
+ bExecHyperlinks = !aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK );
+
+ if ( !bExecHyperlinks )
+ {
+ sTxt.InsertAscii( ": ", 0 );
+ sTxt.Insert( ViewShell::GetShellRes()->aHyperlinkClick, 0 );
+ }
+ }
+ // <--
+ break;
+ }
+ case SwContentAtPos::SW_SMARTTAG:
+ {
+ sTxt = SW_RESSTR(STR_SMARTTAG_CLICK);
+
+ KeyCode aCode( KEY_SPACE );
+ KeyCode aModifiedCode( KEY_SPACE, KEY_MOD1 );
+ String aModStr( aModifiedCode.GetName() );
+ aModStr.SearchAndReplace( aCode.GetName(), String() );
+ aModStr.SearchAndReplaceAllAscii( "+", String() );
+ sTxt.SearchAndReplaceAllAscii( "%s", aModStr );
+ }
+ break;
+
+ case SwContentAtPos::SW_FTN:
+ if( aCntntAtPos.pFndTxtAttr && aCntntAtPos.aFnd.pAttr )
+ {
+ const SwFmtFtn* pFtn = (SwFmtFtn*)aCntntAtPos.aFnd.pAttr;
+ pFtn->GetFtnText( sTxt );
+ sTxt.Insert( SW_RESSTR( pFtn->IsEndNote()
+ ? STR_ENDNOTE : STR_FTNNOTE ), 0 );
+ if( aCntntAtPos.IsInRTLText() )
+ nStyle |= QUICKHELP_BIDI_RTL;
+ }
+ break;
+
+ case SwContentAtPos::SW_REDLINE:
+ lcl_GetRedlineHelp( *aCntntAtPos.aFnd.pRedl, sTxt, bBalloon );
+ break;
+
+ case SwContentAtPos::SW_TOXMARK:
+ sTxt = aCntntAtPos.sStr;
+ if( sTxt.Len() && aCntntAtPos.pFndTxtAttr )
+ {
+ const SwTOXType* pTType = aCntntAtPos.pFndTxtAttr->
+ GetTOXMark().GetTOXType();
+ if( pTType && pTType->GetTypeName().Len() )
+ {
+ sTxt.InsertAscii( ": ", 0 );
+ sTxt.Insert( pTType->GetTypeName(), 0 );
+ }
+ }
+ break;
+ case SwContentAtPos::SW_REFMARK:
+ if(aCntntAtPos.aFnd.pAttr)
+ {
+ sTxt = SW_RES(STR_CONTENT_TYPE_SINGLE_REFERENCE);
+ sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": "));
+ sTxt += ((const SwFmtRefMark*)aCntntAtPos.aFnd.pAttr)->GetRefName();
+ }
+ break;
+
+ default:
+ {
+ SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+ if(!pModOpt->IsHideFieldTips())
+ {
+ const SwField* pFld = aCntntAtPos.aFnd.pFld;
+ switch( pFld->Which() )
+ {
+ case RES_SETEXPFLD:
+ case RES_TABLEFLD:
+ case RES_GETEXPFLD:
+ {
+ USHORT nOldSubType = pFld->GetSubType();
+ ((SwField*)pFld)->SetSubType(nsSwExtendedSubType::SUB_CMD);
+ sTxt = pFld->ExpandField(true);
+ ((SwField*)pFld)->SetSubType(nOldSubType);
+ }
+ break;
+
+ case RES_POSTITFLD:
+ {
+ /*
+ SwPostItMgr* pMgr = rView.GetPostItMgr();
+ if (pMgr->ShowNotes())
+ {
+ SwFmtFld* pSwFmtFld = 0;
+ if (pMgr->ShowPreview(pFld,pSwFmtFld))
+ {
+ SwPostIt* pPostIt = new SwPostIt(static_cast<Window*>(this),0,pSwFmtFld,pMgr,PB_Preview);
+ pPostIt->InitControls();
+ pPostIt->SetReadonly(true);
+ pMgr->SetColors(pPostIt,static_cast<SwPostItField*>(pSwFmtFld->GetFld()));
+ pPostIt->SetVirtualPosSize(rEvt.GetMousePosPixel(),Size(180,70));
+ pPostIt->ShowNote();
+ SetPointerPosPixel(pPostIt->GetPosPixel() + Point(20,20));
+ }
+ return;
+ }
+ */
+ break;
+ }
+ case RES_INPUTFLD: // BubbleHelp, da der Hinweis ggf ziemlich lang sein kann
+ bBalloon = TRUE;
+ /* no break */
+ case RES_JUMPEDITFLD:
+ sTxt = pFld->GetPar2();
+ break;
+
+ case RES_DBFLD:
+ sTxt = pFld->GetFieldName();
+ break;
+
+ case RES_USERFLD:
+ case RES_HIDDENTXTFLD:
+ sTxt = pFld->GetPar1();
+ break;
+
+ case RES_DOCSTATFLD:
+ break;
+
+ case RES_MACROFLD:
+ sTxt = ((const SwMacroField*)pFld)->GetMacro();
+ break;
+
+ case RES_GETREFFLD:
+ {
+ // --> OD 2008-01-09 #i85090#
+ const SwGetRefField* pRefFld( dynamic_cast<const SwGetRefField*>(pFld) );
+ ASSERT( pRefFld,
+ "<SwEditWin::RequestHelp(..)> - unexpected type of <pFld>" );
+ if ( pRefFld )
+ {
+ if ( pRefFld->IsRefToHeadingCrossRefBookmark() ||
+ pRefFld->IsRefToNumItemCrossRefBookmark() )
+ {
+ sTxt = pRefFld->GetExpandedTxtOfReferencedTxtNode();
+ if ( sTxt.Len() > 80 )
+ {
+ sTxt.Erase( 80 );
+ sTxt += '.';
+ sTxt += '.';
+ sTxt += '.';
+ }
+ }
+ else
+ {
+ sTxt = ((SwGetRefField*)pFld)->GetSetRefName();
+ }
+ }
+ // <--
+ }
+ break;
+ }
+ }
+
+ if( !sTxt.Len() )
+ {
+ aCntntAtPos.eCntntAtPos = SwContentAtPos::SW_REDLINE;
+ if( rSh.GetContentAtPos( aPos, aCntntAtPos, FALSE, &aFldRect ) )
+ lcl_GetRedlineHelp( *aCntntAtPos.aFnd.pRedl,
+ sTxt, bBalloon );
+ }
+ }
+ }
+ if (sTxt.Len() )
+ {
+ if( bBalloon )
+ Help::ShowBalloon( this, rEvt.GetMousePosPixel(), sTxt );
+ else
+ {
+ // dann zeige die Hilfe mal an:
+ Rectangle aRect( aFldRect.SVRect() );
+ Point aPt( OutputToScreenPixel( LogicToPixel( aRect.TopLeft() )));
+ aRect.Left() = aPt.X();
+ aRect.Top() = aPt.Y();
+ aPt = OutputToScreenPixel( LogicToPixel( aRect.BottomRight() ));
+ aRect.Right() = aPt.X();
+ aRect.Bottom() = aPt.Y();
+ Help::ShowQuickHelp( this, aRect, sTxt, nStyle );
+ }
+ }
+
+ bWeiter = FALSE;
+ }
+ if( bWeiter )
+ {
+ BYTE nTabCols = rSh.WhichMouseTabCol(aPos);
+ USHORT nTabRes = 0;
+ switch(nTabCols)
+ {
+ case SW_TABCOL_HORI:
+ case SW_TABCOL_VERT:
+ nTabRes = STR_TABLE_COL_ADJUST;
+ break;
+ case SW_TABROW_HORI:
+ case SW_TABROW_VERT:
+ nTabRes = STR_TABLE_ROW_ADJUST;
+ break;
+ // --> FME 2004-07-30 #i32329# Enhanced table selection
+ case SW_TABSEL_HORI:
+ case SW_TABSEL_HORI_RTL:
+ case SW_TABSEL_VERT:
+ nTabRes = STR_TABLE_SELECT_ALL;
+ break;
+ case SW_TABROWSEL_HORI:
+ case SW_TABROWSEL_HORI_RTL:
+ case SW_TABROWSEL_VERT:
+ nTabRes = STR_TABLE_SELECT_ROW;
+ break;
+ case SW_TABCOLSEL_HORI:
+ case SW_TABCOLSEL_VERT:
+ nTabRes = STR_TABLE_SELECT_COL;
+ break;
+ // <--
+ }
+ if(nTabRes)
+ {
+ sTxt = SW_RESSTR(nTabRes);
+ Size aTxtSize( GetTextWidth(sTxt), GetTextHeight());
+ Rectangle aRect(rEvt.GetMousePosPixel(), aTxtSize);
+ Help::ShowQuickHelp(this, aRect, sTxt);
+ }
+ bWeiter = FALSE;
+ }
+ }
+
+/*
+aktuelle Zeichenvorlage anzeigen?
+ if( bWeiter && rEvt.GetMode() & ( HELPMODE_QUICK | HELPMODE_BALLOON ))
+ {
+ SwCharFmt* pChrFmt = rSh.GetCurCharFmt();
+
+ }
+*/
+ if( bWeiter && pSdrView && bQuickBalloon)
+ {
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = pSdrView->PickAnything(aPos, aVEvt);
+ const SvxURLField *pField;
+ SdrObject* pObj = NULL;
+
+ if ((pField = aVEvt.pURLField) != 0)
+ {
+ // URL-Feld getroffen
+ if (pField)
+ {
+ pObj = aVEvt.pObj;
+ sTxt = pField->GetURL();
+
+ bWeiter = FALSE;
+ }
+ }
+ if (bWeiter && eHit == SDRHIT_TEXTEDIT)
+ {
+ // URL-Feld in zum Editieren ge?ffneten DrawText-Objekt suchen
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ const SvxFieldItem* pFieldItem;
+
+ if (pSdrView->AreObjectsMarked())
+ {
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+
+ if (rMarkList.GetMarkCount() == 1)
+ pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ }
+
+ if (pObj && pObj->ISA(SdrTextObj) && pOLV &&
+ (pFieldItem = pOLV->GetFieldUnderMousePointer()) != 0)
+ {
+ pField = dynamic_cast<const SvxURLField*>(pFieldItem->GetField());
+
+ if (pField )
+ {
+ sTxt = ((const SvxURLField*) pField)->GetURL();
+ bWeiter = FALSE;
+ }
+ }
+ }
+ if (sTxt.Len() && pObj)
+ {
+ sTxt = URIHelper::removePassword( sTxt, INetURLObject::WAS_ENCODED,
+ INetURLObject::DECODE_UNAMBIGUOUS);
+
+ Rectangle aLogicPix = LogicToPixel(pObj->GetLogicRect());
+ Rectangle aScreenRect(OutputToScreenPixel(aLogicPix.TopLeft()),
+ OutputToScreenPixel(aLogicPix.BottomRight()));
+
+ if (bBalloon)
+ Help::ShowBalloon(this, rEvt.GetMousePosPixel(), aScreenRect, sTxt);
+ else
+ Help::ShowQuickHelp(this, aScreenRect, sTxt);
+ }
+ }
+
+ if( bWeiter )
+ Window::RequestHelp( rEvt );
+}
+
+void SwEditWin::PrePaint()
+{
+ SwWrtShell* pWrtShell = GetView().GetWrtShellPtr();
+
+ if(pWrtShell)
+ {
+ pWrtShell->PrePaint();
+ }
+}
+
+void SwEditWin::Paint(const Rectangle& rRect)
+{
+#if defined(MYDEBUG)
+ // StartUp-Statistik
+ if ( pTickList )
+ {
+ SYSTICK( "Start SwEditWin::Paint" );
+ READ_FIRST_TICKS()
+ FLUSH_TICKS()
+ }
+#endif
+
+ SwWrtShell* pWrtShell = GetView().GetWrtShellPtr();
+ if(!pWrtShell)
+ return;
+ BOOL bPaintShadowCrsr = FALSE;
+ if( pShadCrsr )
+ {
+ Rectangle aRect( pShadCrsr->GetRect());
+ // liegt vollstaendig drin?
+ if( rRect.IsInside( aRect ) )
+ // dann aufheben
+ delete pShadCrsr, pShadCrsr = 0;
+ else if( rRect.IsOver( aRect ))
+ {
+ // liegt irgendwie drueber, dann ist alles ausserhalb geclippt
+ // und wir muessen den "inneren Teil" am Ende vom Paint
+ // wieder sichtbar machen. Sonst kommt es zu Paintfehlern!
+ bPaintShadowCrsr = TRUE;
+ }
+ }
+/*
+ //TODO/LATER: what's the replacement for this? Do we need it?
+ SwDocShell* pDocShell = GetView().GetDocShell();
+
+ SvInPlaceEnvironment *pIpEnv = pDocShell ?
+ pDocShell->GetIPEnv() : 0;
+ if ( pIpEnv && pIpEnv->GetRectsChangedLockCount() )
+ //Wir stehen in Groessenverhandlungen (MM), Paint verzoegern
+ Invalidate( rRect );
+ else */
+ if ( GetView().GetVisArea().GetWidth() <= 0 ||
+ GetView().GetVisArea().GetHeight() <= 0 )
+ Invalidate( rRect );
+ else
+ pWrtShell->Paint( rRect );
+
+ if( bPaintShadowCrsr )
+ pShadCrsr->Paint();
+}
+
+
diff --git a/sw/source/ui/docvw/edtwin3.cxx b/sw/source/ui/docvw/edtwin3.cxx
new file mode 100644
index 000000000000..c2d7492cb066
--- /dev/null
+++ b/sw/source/ui/docvw/edtwin3.cxx
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include <hintids.hxx>
+#include <vcl/settings.hxx>
+#include <svx/ruler.hxx>
+#include <viewopt.hxx>
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "basesh.hxx"
+#include "pview.hxx"
+#include "mdiexp.hxx"
+#include "edtwin.hxx"
+#include "swmodule.hxx"
+#include "modcfg.hxx"
+#include "swtable.hxx"
+#include "docsh.hxx"
+#include "pagedesc.hxx" // Aktuelles Seitenformat
+#include <frmatr.hxx>
+#include <editeng/frmdiritem.hxx>
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Core-Notify
+ --------------------------------------------------------------------*/
+
+
+
+void ScrollMDI( ViewShell* pVwSh, const SwRect &rRect,
+ USHORT nRangeX, USHORT nRangeY)
+{
+ SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
+ if (pSfxVwSh && pSfxVwSh->ISA(SwView))
+ ((SwView *)pSfxVwSh)->Scroll( rRect.SVRect(), nRangeX, nRangeY );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Docmdi - verschiebbar
+ --------------------------------------------------------------------*/
+
+
+
+BOOL IsScrollMDI( ViewShell* pVwSh, const SwRect &rRect )
+{
+ SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
+ if (pSfxVwSh && pSfxVwSh->ISA(SwView))
+ return (((SwView *)pSfxVwSh)->IsScroll(rRect.SVRect()));
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Notify fuer Groessen-Aenderung
+ --------------------------------------------------------------------*/
+
+
+
+void SizeNotify(ViewShell* pVwSh, const Size &rSize)
+{
+ SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
+ if (pSfxVwSh)
+ {
+ if (pSfxVwSh->ISA(SwView))
+ ((SwView *)pSfxVwSh)->DocSzChgd(rSize);
+ else if (pSfxVwSh->ISA(SwPagePreView))
+ ((SwPagePreView *)pSfxVwSh)->DocSzChgd( rSize );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Notify fuer Seitenzahl-Update
+ --------------------------------------------------------------------*/
+
+
+
+void PageNumNotify( ViewShell* pVwSh, USHORT nPhyNum, USHORT nVirtNum,
+ const String& rPgStr)
+{
+ SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
+ if ( pSfxVwSh && pSfxVwSh->ISA(SwView) &&
+ ((SwView*)pSfxVwSh)->GetCurShell() )
+ ((SwView *)pSfxVwSh)->UpdatePageNums(nPhyNum, nVirtNum, rPgStr);
+}
+
+/******************************************************************************
+ * Methode : void FrameNotify( DocMDIBase *pWin, FlyMode eMode )
+ * Beschreibung:
+ * Erstellt : OK 08.02.94 13:49
+ * Aenderung :
+ ******************************************************************************/
+
+
+
+void FrameNotify( ViewShell* pVwSh, FlyMode eMode )
+{
+ if ( pVwSh->ISA(SwCrsrShell) )
+ SwBaseShell::SetFrmMode( eMode, (SwWrtShell*)pVwSh );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Notify fuer Seitenzahl-Update
+ --------------------------------------------------------------------*/
+BOOL SwEditWin::RulerColumnDrag( const MouseEvent& rMEvt, BOOL bVerticalMode)
+{
+ SvxRuler& rRuler = bVerticalMode ? rView.GetVLineal() : rView.GetHLineal();
+ return (!rRuler.StartDocDrag( rMEvt, RULER_TYPE_BORDER ) &&
+ !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN1) &&
+ !rRuler.StartDocDrag( rMEvt, RULER_TYPE_MARGIN2));
+}
+
+// #i23726#
+// --> OD 2005-02-18 #i42921# - add 3rd parameter <bVerticalMode> in order
+// to consider vertical layout
+BOOL SwEditWin::RulerMarginDrag( const MouseEvent& rMEvt,
+ const bool bVerticalMode )
+{
+ SvxRuler& rRuler = bVerticalMode ? rView.GetVLineal() : rView.GetHLineal();
+ return !rRuler.StartDocDrag( rMEvt, RULER_TYPE_INDENT);
+}
+// <--
+
+LAYOUT_NS Dialog* GetSearchDialog()
+{
+ return SwView::GetSearchDialog();
+}
+
+TblChgMode GetTblChgDefaultMode()
+{
+ SwModuleOptions* pOpt = SW_MOD()->GetModuleConfig();
+ return pOpt ? pOpt->GetTblMode() : TBLVAR_CHGABS;
+}
+
+void RepaintPagePreview( ViewShell* pVwSh, const SwRect& rRect )
+{
+ SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
+ if (pSfxVwSh && pSfxVwSh->ISA( SwPagePreView ))
+ ((SwPagePreView *)pSfxVwSh)->RepaintCoreRect( rRect );
+}
+
+BOOL JumpToSwMark( ViewShell* pVwSh, const String& rMark )
+{
+ SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
+ if( pSfxVwSh && pSfxVwSh->ISA( SwView ) )
+ return ((SwView *)pSfxVwSh)->JumpToSwMark( rMark );
+ return FALSE;
+}
+
+void SwEditWin::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ SwWrtShell* pSh = GetView().GetWrtShellPtr();
+ //#99906# DataChanged() is sometimes called prior to creating
+ // the SwWrtShell
+ if(!pSh)
+ return;
+ BOOL bViewWasLocked = pSh->IsViewLocked(), bUnlockPaint = FALSE;
+ pSh->LockView( TRUE );
+ switch( rDCEvt.GetType() )
+ {
+ case DATACHANGED_SETTINGS:
+ // ScrollBars neu anordnen bzw. Resize ausloesen, da sich
+ // ScrollBar-Groesse geaendert haben kann. Dazu muss dann im
+ // Resize-Handler aber auch die Groesse der ScrollBars aus
+ // den Settings abgefragt werden.
+ if( rDCEvt.GetFlags() & SETTINGS_STYLE )
+ {
+ pSh->LockPaint();
+ bUnlockPaint = TRUE;
+ ViewShell::DeleteReplacementBitmaps();
+ GetView().InvalidateBorder(); //Scrollbarbreiten
+ }
+ break;
+
+ case DATACHANGED_PRINTER:
+ case DATACHANGED_DISPLAY:
+ case DATACHANGED_FONTS:
+ case DATACHANGED_FONTSUBSTITUTION:
+ pSh->LockPaint();
+ bUnlockPaint = TRUE;
+ GetView().GetDocShell()->UpdateFontList(); //z.B. Druckerwechsel
+ break;
+ }
+ pSh->LockView( bViewWasLocked );
+ if( bUnlockPaint )
+ pSh->UnlockPaint();
+}
+
diff --git a/sw/source/ui/docvw/frmsidebarwincontainer.cxx b/sw/source/ui/docvw/frmsidebarwincontainer.cxx
new file mode 100644
index 000000000000..b5e406dcf69b
--- /dev/null
+++ b/sw/source/ui/docvw/frmsidebarwincontainer.cxx
@@ -0,0 +1,216 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <frmsidebarwincontainer.hxx>
+
+#include <map>
+#include <fmtfld.hxx>
+#include <txtfld.hxx>
+#include <SidebarWin.hxx>
+
+namespace {
+ struct SidebarWinKey
+ {
+ const xub_StrLen mnIndex;
+
+ explicit SidebarWinKey( const xub_StrLen nIndex )
+ : mnIndex( nIndex )
+ {}
+
+ bool operator < ( const SidebarWinKey& rSidebarWinKey ) const
+ {
+ return mnIndex < rSidebarWinKey.mnIndex;
+ }
+ };
+
+ struct SidebarWinOrder
+ {
+ sal_Bool operator()( const SidebarWinKey& rSidebarWinKeyA,
+ const SidebarWinKey& rSidebarWinKeyB ) const
+ {
+ return rSidebarWinKeyA < rSidebarWinKeyB;
+ }
+ };
+
+ typedef ::std::map < SidebarWinKey, sw::sidebarwindows::SwSidebarWin*, SidebarWinOrder > SidebarWinContainer;
+
+ struct FrmKey
+ {
+ const SwFrm* mpFrm;
+
+ explicit FrmKey( const SwFrm* pFrm )
+ : mpFrm( pFrm )
+ {}
+
+ bool operator < ( const FrmKey& rFrmKey ) const
+ {
+ return mpFrm < rFrmKey.mpFrm;
+ }
+ };
+
+ struct FrmOrder
+ {
+ sal_Bool operator()( const FrmKey& rFrmKeyA,
+ const FrmKey& rFrmKeyB ) const
+ {
+ return rFrmKeyA < rFrmKeyB;
+ }
+ };
+
+ typedef ::std::map < FrmKey, SidebarWinContainer, FrmOrder > _FrmSidebarWinContainer;
+}
+
+namespace sw { namespace sidebarwindows {
+
+class FrmSidebarWinContainer : public _FrmSidebarWinContainer
+{
+};
+
+SwFrmSidebarWinContainer::SwFrmSidebarWinContainer()
+ : mpFrmSidebarWinContainer( new FrmSidebarWinContainer() )
+{}
+
+SwFrmSidebarWinContainer::~SwFrmSidebarWinContainer()
+{
+ mpFrmSidebarWinContainer->clear();
+ delete mpFrmSidebarWinContainer;
+}
+
+bool SwFrmSidebarWinContainer::insert( const SwFrm& rFrm,
+ const SwFmtFld& rFmtFld,
+ SwSidebarWin& rSidebarWin )
+{
+ bool bInserted( false );
+
+ FrmKey aFrmKey( &rFrm );
+ SidebarWinContainer& rSidebarWinContainer = (*mpFrmSidebarWinContainer)[ aFrmKey ];
+
+ SidebarWinKey aSidebarWinKey( *(rFmtFld.GetTxtFld()->GetStart()) );
+ if ( rSidebarWinContainer.empty() ||
+ rSidebarWinContainer.find( aSidebarWinKey) == rSidebarWinContainer.end() )
+ {
+ rSidebarWinContainer[ aSidebarWinKey ] = &rSidebarWin;
+ bInserted = true;
+ }
+
+ return bInserted;
+}
+
+bool SwFrmSidebarWinContainer::remove( const SwFrm& rFrm,
+ const SwSidebarWin& rSidebarWin )
+{
+ bool bRemoved( false );
+
+ FrmKey aFrmKey( &rFrm );
+ FrmSidebarWinContainer::iterator aFrmIter = mpFrmSidebarWinContainer->find( aFrmKey );
+ if ( aFrmIter != mpFrmSidebarWinContainer->end() )
+ {
+ SidebarWinContainer& rSidebarWinContainer = (*aFrmIter).second;
+ for ( SidebarWinContainer::iterator aIter = rSidebarWinContainer.begin();
+ aIter != rSidebarWinContainer.end();
+ ++aIter )
+ {
+ if ( (*aIter).second == &rSidebarWin )
+ {
+ rSidebarWinContainer.erase( aIter );
+ bRemoved = true;
+ break;
+ }
+ }
+ }
+
+ return bRemoved;
+}
+
+bool SwFrmSidebarWinContainer::empty( const SwFrm& rFrm )
+{
+ bool bEmpty( true );
+
+ FrmKey aFrmKey( &rFrm );
+ FrmSidebarWinContainer::iterator aFrmIter = mpFrmSidebarWinContainer->find( aFrmKey );
+ if ( aFrmIter != mpFrmSidebarWinContainer->end() )
+ {
+ bEmpty = (*aFrmIter).second.empty();
+ }
+
+ return bEmpty;
+}
+
+SwSidebarWin* SwFrmSidebarWinContainer::get( const SwFrm& rFrm,
+ const sal_Int32 nIndex )
+{
+ SwSidebarWin* pRet( 0 );
+
+ FrmKey aFrmKey( &rFrm );
+ FrmSidebarWinContainer::iterator aFrmIter = mpFrmSidebarWinContainer->find( aFrmKey );
+ if ( aFrmIter != mpFrmSidebarWinContainer->end() )
+ {
+ SidebarWinContainer& rSidebarWinContainer = (*aFrmIter).second;
+ sal_Int32 nCounter( nIndex );
+ for ( SidebarWinContainer::iterator aIter = rSidebarWinContainer.begin();
+ nCounter >= 0 && aIter != rSidebarWinContainer.end();
+ ++aIter )
+ {
+ if ( nCounter == 0 )
+ {
+ pRet = (*aIter).second;
+ break;
+ }
+
+ --nCounter;
+ }
+ }
+
+ return pRet;
+}
+
+void SwFrmSidebarWinContainer::getAll( const SwFrm& rFrm,
+ std::vector< Window* >* pSidebarWins )
+{
+ pSidebarWins->clear();
+
+ FrmKey aFrmKey( &rFrm );
+ FrmSidebarWinContainer::iterator aFrmIter = mpFrmSidebarWinContainer->find( aFrmKey );
+ if ( aFrmIter != mpFrmSidebarWinContainer->end() )
+ {
+ SidebarWinContainer& rSidebarWinContainer = (*aFrmIter).second;
+ for ( SidebarWinContainer::iterator aIter = rSidebarWinContainer.begin();
+ aIter != rSidebarWinContainer.end();
+ ++aIter )
+ {
+ pSidebarWins->push_back( (*aIter).second );
+ }
+ }
+}
+
+} } // eof of namespace sw::sidebarwindows::
diff --git a/sw/source/ui/docvw/frmsidebarwincontainer.hxx b/sw/source/ui/docvw/frmsidebarwincontainer.hxx
new file mode 100644
index 000000000000..1583f36a0bb6
--- /dev/null
+++ b/sw/source/ui/docvw/frmsidebarwincontainer.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FRMSIDEBARWINCONTAINER_HXX
+#define _FRMSIDEBARWINCONTAINER_HXX
+
+#include <sal/types.h>
+#include <vector>
+
+class SwFrm;
+class SwFmtFld;
+class Window;
+
+namespace sw { namespace sidebarwindows {
+
+class SwSidebarWin;
+class FrmSidebarWinContainer;
+
+class SwFrmSidebarWinContainer
+{
+ public:
+ SwFrmSidebarWinContainer();
+ ~SwFrmSidebarWinContainer();
+
+ bool insert( const SwFrm& rFrm,
+ const SwFmtFld& rFmtFld,
+ SwSidebarWin& rSidebarWin );
+
+ bool remove( const SwFrm& rFrm,
+ const SwSidebarWin& rSidebarWin );
+
+ bool empty( const SwFrm& rFrm );
+
+ SwSidebarWin* get( const SwFrm& rFrm,
+ const sal_Int32 nIndex );
+
+ void getAll( const SwFrm& rFrm,
+ std::vector< Window* >* pSidebarWins );
+
+ private:
+ FrmSidebarWinContainer* mpFrmSidebarWinContainer;
+};
+
+} } // eof of namespace sw::sidebarwindows::
+
+#endif
+
diff --git a/sw/source/ui/docvw/romenu.cxx b/sw/source/ui/docvw/romenu.cxx
new file mode 100644
index 000000000000..c93409441be9
--- /dev/null
+++ b/sw/source/ui/docvw/romenu.cxx
@@ -0,0 +1,523 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <hintids.hxx>
+
+
+#include <tools/urlobj.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/msgbox.hxx>
+#include <sot/formats.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svtools/filter.hxx>
+#include <svtools/imap.hxx>
+#include <svtools/inetimg.hxx>
+#include <svtools/transfer.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/xoutbmp.hxx>
+#include <svx/gallery.hxx>
+#include <editeng/brshitem.hxx>
+
+
+#include <swunodef.hxx>
+#include <frmatr.hxx>
+#include <fmturl.hxx>
+#include <fmtinfmt.hxx>
+#include <docsh.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <viewopt.hxx>
+#include <swmodule.hxx>
+#include <romenu.hxx>
+#include <pagedesc.hxx>
+#include <modcfg.hxx>
+
+#include <cmdid.h>
+#include <helpid.h>
+#include <docvw.hrc>
+#include <docvw.hrc>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <sfx2/filedlghelper.hxx>
+
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::sfx2;
+
+SwReadOnlyPopup::~SwReadOnlyPopup()
+{
+ String *pDel = (String*)aThemeList.First();
+ while ( pDel )
+ {
+ delete pDel;
+ pDel = (String*)aThemeList.Next();
+ }
+ delete pImageMap;
+ delete pTargetURL;
+}
+
+
+
+void SwReadOnlyPopup::Check( USHORT nMID, USHORT nSID, SfxDispatcher &rDis )
+{
+ SfxPoolItem *_pItem = 0;
+ SfxItemState eState = rDis.GetBindings()->QueryState( nSID, _pItem );
+ if (eState >= SFX_ITEM_AVAILABLE)
+ {
+ EnableItem( nMID, TRUE );
+ if (_pItem)
+ {
+ CheckItem ( nMID, !_pItem->ISA(SfxVoidItem) &&
+ _pItem->ISA(SfxBoolItem) &&
+ ((SfxBoolItem*)_pItem)->GetValue());
+ //remove full screen entry when not in full screen mode
+ if(SID_WIN_FULLSCREEN == nSID && !IsItemChecked(SID_WIN_FULLSCREEN) )
+ EnableItem(nMID, FALSE);
+ }
+ }
+ else
+ EnableItem( nMID, FALSE );
+
+ delete _pItem;
+}
+
+
+SwReadOnlyPopup::SwReadOnlyPopup( const Point &rDPos, SwView &rV ) :
+ PopupMenu( SW_RES(MN_READONLY_POPUP) ),
+ rView ( rV ),
+ rDocPos( rDPos ),
+ pImageMap( 0 ),
+ pTargetURL( 0 )
+{
+ bGrfToGalleryAsLnk = SW_MOD()->GetModuleConfig()->IsGrfToGalleryAsLnk();
+ SwWrtShell &rSh = rView.GetWrtShell();
+ rSh.IsURLGrfAtPos( rDocPos, &sURL, &sTargetFrameName, &sDescription );
+ if ( !sURL.Len() )
+ {
+ SwContentAtPos aCntntAtPos( SwContentAtPos::SW_INETATTR );
+ if( rSh.GetContentAtPos( rDocPos, aCntntAtPos, FALSE))
+ {
+ SwFmtINetFmt &rIItem = *(SwFmtINetFmt*)aCntntAtPos.aFnd.pAttr;
+ sURL = rIItem.GetValue();
+ sTargetFrameName = rIItem.GetTargetFrame();
+ sDescription = aCntntAtPos.sStr;
+ }
+ }
+
+ BOOL bLink = FALSE;
+ const Graphic *pGrf;
+ if ( 0 == (pGrf = rSh.GetGrfAtPos( rDocPos, sGrfName, bLink )) )
+ {
+ EnableItem( MN_READONLY_SAVEGRAPHIC, FALSE );
+ EnableItem( MN_READONLY_COPYGRAPHIC, FALSE );
+ }
+ else
+ {
+ aGraphic = *pGrf;
+ const SwFrmFmt* pGrfFmt = rSh.GetFmtFromObj( rDocPos );
+ const SfxPoolItem* pURLItem;
+ if( pGrfFmt && SFX_ITEM_SET == pGrfFmt->GetItemState(
+ RES_URL, TRUE, &pURLItem ))
+ {
+ const SwFmtURL& rURL = *(SwFmtURL*)pURLItem;
+ if( rURL.GetMap() )
+ pImageMap = new ImageMap( *rURL.GetMap() );
+ else if( rURL.GetURL().Len() )
+ pTargetURL = new INetImage( bLink ? sGrfName : aEmptyStr,
+ rURL.GetURL(),
+ rURL.GetTargetFrameName(),
+ aEmptyStr, Size() );
+ }
+ }
+
+ BOOL bEnableGraphicToGallery;
+ if ( TRUE == (bEnableGraphicToGallery = bLink) )
+ {
+ GalleryExplorer::FillThemeList( aThemeList );
+ if ( aThemeList.Count() )
+ {
+ PopupMenu *pMenu = GetPopupMenu(MN_READONLY_GRAPHICTOGALLERY);
+ pMenu->CheckItem( MN_READONLY_TOGALLERYLINK, bGrfToGalleryAsLnk );
+ pMenu->CheckItem( MN_READONLY_TOGALLERYCOPY, !bGrfToGalleryAsLnk );
+ for ( USHORT i=0; i < aThemeList.Count(); ++i )
+ pMenu->InsertItem( MN_READONLY_GRAPHICTOGALLERY+i + 3,
+ *(String*)aThemeList.GetObject( i ) );
+ }
+ else
+ bEnableGraphicToGallery = FALSE;
+ }
+ EnableItem( MN_READONLY_GRAPHICTOGALLERY, bEnableGraphicToGallery );
+
+ SfxViewFrame * pVFrame = rV.GetViewFrame();
+ SfxDispatcher &rDis = *pVFrame->GetDispatcher();
+ const SwPageDesc &rDesc = rSh.GetPageDesc( rSh.GetCurPageDesc() );
+ pItem = &rDesc.GetMaster().GetBackground();
+ BOOL bEnableBackGallery = FALSE,
+ bEnableBack = FALSE;
+
+ if ( GPOS_NONE != pItem->GetGraphicPos() )
+ {
+ bEnableBack = TRUE;
+ if ( pItem->GetGraphicLink() )
+ {
+ if ( !aThemeList.Count() )
+ GalleryExplorer::FillThemeList( aThemeList );
+ if ( aThemeList.Count() )
+ {
+ PopupMenu *pMenu = GetPopupMenu(MN_READONLY_BACKGROUNDTOGALLERY);
+ pMenu->CheckItem( MN_READONLY_TOGALLERYLINK, bGrfToGalleryAsLnk );
+ pMenu->CheckItem( MN_READONLY_TOGALLERYCOPY, !bGrfToGalleryAsLnk );
+ bEnableBackGallery = TRUE;
+ for ( USHORT i=0; i < aThemeList.Count(); ++i )
+ pMenu->InsertItem( MN_READONLY_BACKGROUNDTOGALLERY+i + 3,
+ *(String*)aThemeList.GetObject( i ) );
+ }
+ }
+ }
+ EnableItem( MN_READONLY_SAVEBACKGROUND, bEnableBack );
+ EnableItem( MN_READONLY_BACKGROUNDTOGALLERY, bEnableBackGallery );
+
+ if ( !rSh.GetViewOptions()->IsGraphic() )
+ CheckItem( MN_READONLY_GRAPHICOFF );
+ else
+ EnableItem( MN_READONLY_LOADGRAPHIC, FALSE );
+
+ BOOL bReloadFrame = 0 != rSh.GetView().GetViewFrame()->GetFrame().GetParentFrame();
+ EnableItem( MN_READONLY_RELOAD_FRAME,
+ bReloadFrame );
+ EnableItem( MN_READONLY_RELOAD, !bReloadFrame);
+
+ Check( MN_READONLY_EDITDOC, SID_EDITDOC, rDis );
+ Check( MN_READONLY_SELECTION_MODE, FN_READONLY_SELECTION_MODE, rDis );
+ Check( MN_READONLY_SOURCEVIEW, SID_SOURCEVIEW, rDis );
+ Check( MN_READONLY_BROWSE_BACKWARD, SID_BROWSE_BACKWARD,rDis );
+ Check( MN_READONLY_BROWSE_FORWARD, SID_BROWSE_FORWARD, rDis );
+#ifdef WNT
+ Check( MN_READONLY_PLUGINOFF, SID_PLUGINS_ACTIVE, rDis );
+#endif
+ Check( MN_READONLY_OPENURL, SID_OPENDOC, rDis );
+ Check( MN_READONLY_OPENURLNEW, SID_OPENDOC, rDis );
+
+ SfxPoolItem* pState;
+
+ SfxItemState eState = pVFrame->GetBindings().QueryState( SID_COPY, pState );
+ Check( MN_READONLY_COPY, SID_COPY, rDis );
+ if(eState < SFX_ITEM_AVAILABLE)
+ EnableItem( MN_READONLY_COPY, FALSE );
+
+ eState = pVFrame->GetBindings().QueryState( SID_EDITDOC, pState );
+ if (
+ eState < SFX_ITEM_DEFAULT ||
+ (rSh.IsGlobalDoc() && rView.GetDocShell()->IsReadOnlyUI())
+ )
+ {
+ EnableItem( MN_READONLY_EDITDOC, FALSE );
+ }
+
+ if ( !sURL.Len() )
+ {
+ EnableItem( MN_READONLY_OPENURL, FALSE );
+ EnableItem( MN_READONLY_OPENURLNEW, FALSE );
+ EnableItem( MN_READONLY_COPYLINK, FALSE );
+ }
+ Check( SID_WIN_FULLSCREEN, SID_WIN_FULLSCREEN, rDis );
+
+ RemoveDisabledEntries( TRUE, TRUE );
+}
+
+void SwReadOnlyPopup::Execute( Window* pWin, const Point &rPixPos )
+{
+ USHORT nId = PopupMenu::Execute(
+ pWin,
+ rPixPos );
+ Execute(pWin, nId);
+}
+
+/*-- 17.03.2004 13:06:18---------------------------------------------------
+ execute the resulting ID only - necessary to support XContextMenuInterception
+ -----------------------------------------------------------------------*/
+void SwReadOnlyPopup::Execute( Window* pWin, USHORT nId )
+{
+ SwWrtShell &rSh = rView.GetWrtShell();
+ SfxDispatcher &rDis = *rView.GetViewFrame()->GetDispatcher();
+ if ( nId >= MN_READONLY_GRAPHICTOGALLERY )
+ {
+ String sTmp;
+ USHORT nSaveId;
+ if ( nId >= MN_READONLY_BACKGROUNDTOGALLERY )
+ {
+ nId -= MN_READONLY_BACKGROUNDTOGALLERY+3;
+ nSaveId = MN_READONLY_SAVEBACKGROUND;
+ sTmp = *pItem->GetGraphicLink();
+ }
+ else
+ {
+ nId -= MN_READONLY_GRAPHICTOGALLERY+3;
+ nSaveId = MN_READONLY_SAVEGRAPHIC;
+ sTmp = sGrfName;
+ }
+ if ( !bGrfToGalleryAsLnk )
+ sTmp = SaveGraphic( nSaveId );
+
+ if ( sTmp.Len() )
+ {
+ String sThemeName( *(String*)aThemeList.GetObject( nId ));
+ GalleryExplorer::InsertURL( sThemeName, sTmp );
+ }
+ return;
+ }
+
+ TransferDataContainer* pClipCntnr = 0;
+
+ USHORT nExecId = USHRT_MAX;
+ USHORT nFilter = USHRT_MAX;
+ switch( nId )
+ {
+ case SID_WIN_FULLSCREEN : nExecId = SID_WIN_FULLSCREEN; break;
+ case MN_READONLY_OPENURL: nFilter = URLLOAD_NOFILTER; break;
+ case MN_READONLY_OPENURLNEW: nFilter = URLLOAD_NEWVIEW; break;
+ case MN_READONLY_COPY: nExecId = SID_COPY; break;
+
+ case MN_READONLY_EDITDOC: nExecId = SID_EDITDOC; break;
+ case MN_READONLY_SELECTION_MODE: nExecId = FN_READONLY_SELECTION_MODE; break;
+ case MN_READONLY_RELOAD:
+ case MN_READONLY_RELOAD_FRAME:
+ rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(SID_RELOAD);
+ break;
+
+ case MN_READONLY_BROWSE_BACKWARD: nExecId = SID_BROWSE_BACKWARD;break;
+ case MN_READONLY_BROWSE_FORWARD: nExecId = SID_BROWSE_FORWARD; break;
+ case MN_READONLY_SOURCEVIEW: nExecId = SID_SOURCEVIEW; break;
+ case MN_READONLY_SAVEGRAPHIC:
+ case MN_READONLY_SAVEBACKGROUND:
+ {
+ SaveGraphic( nId );
+ break;
+ }
+ case MN_READONLY_COPYLINK:
+ pClipCntnr = new TransferDataContainer;
+ pClipCntnr->CopyString( sURL );
+ break;
+
+ case MN_READONLY_COPYGRAPHIC:
+ pClipCntnr = new TransferDataContainer;
+ pClipCntnr->CopyGraphic( aGraphic );
+
+ if( pImageMap )
+ pClipCntnr->CopyImageMap( *pImageMap );
+ if( pTargetURL )
+ pClipCntnr->CopyINetImage( *pTargetURL );
+ break;
+
+ case MN_READONLY_LOADGRAPHIC:
+ {
+ BOOL bModified = rSh.IsModified();
+ SwViewOption aOpt( *rSh.GetViewOptions() );
+ aOpt.SetGraphic( TRUE );
+ rSh.ApplyViewOptions( aOpt );
+ if(!bModified)
+ rSh.ResetModified();
+ break;
+ }
+ case MN_READONLY_GRAPHICOFF: nExecId = FN_VIEW_GRAPHIC; break;
+#ifdef WNT
+ case MN_READONLY_PLUGINOFF: nExecId = SID_PLUGINS_ACTIVE; break;
+#endif
+ case MN_READONLY_TOGALLERYLINK:
+ SW_MOD()->GetModuleConfig()->SetGrfToGalleryAsLnk( TRUE );
+ break;
+ case MN_READONLY_TOGALLERYCOPY:
+ SW_MOD()->GetModuleConfig()->SetGrfToGalleryAsLnk( FALSE );
+ break;
+
+ default: //forward the id to the SfxBindings
+ nExecId = nId;
+ }
+ if( USHRT_MAX != nExecId )
+ rDis.GetBindings()->Execute( nExecId );
+ if( USHRT_MAX != nFilter )
+ ::LoadURL( sURL, &rSh, nFilter, &sTargetFrameName);
+
+ if( pClipCntnr )
+ {
+ STAR_REFERENCE( datatransfer::XTransferable ) xRef( pClipCntnr );
+ if( pClipCntnr->HasAnyData() )
+ pClipCntnr->CopyToClipboard( pWin );
+ }
+}
+static void lcl_GetPreferedExtension( String &rExt, const Graphic &rGrf )
+{
+ // dann ggfs. ueber die native-Info der Grafik den "besten"
+ // Filter vorschlagen
+ const sal_Char* pExt = "png";
+ switch( const_cast<Graphic&>(rGrf).GetLink().GetType() )
+ {
+ case GFX_LINK_TYPE_NATIVE_GIF: pExt = "gif"; break;
+ case GFX_LINK_TYPE_NATIVE_TIF: pExt = "tif"; break;
+ case GFX_LINK_TYPE_NATIVE_WMF: pExt = "wmf"; break;
+ case GFX_LINK_TYPE_NATIVE_MET: pExt = "met"; break;
+ case GFX_LINK_TYPE_NATIVE_PCT: pExt = "pct"; break;
+ case GFX_LINK_TYPE_NATIVE_JPG: pExt = "jpg"; break;
+ default:; //prevent warning
+ }
+ rExt.AssignAscii( pExt );
+}
+
+
+String SwReadOnlyPopup::SaveGraphic( USHORT nId )
+{
+
+ //Namen der Grafik herausfischen.
+ String aName;
+ if ( MN_READONLY_SAVEBACKGROUND == nId )
+ {
+ if ( pItem->GetGraphicLink() )
+ sGrfName = *pItem->GetGraphicLink();
+ ((SvxBrushItem*)pItem)->SetDoneLink( Link() );
+ const Graphic *pGrf = pItem->GetGraphic();
+ if ( pGrf )
+ {
+ aGraphic = *pGrf;
+ if ( pItem->GetGraphicLink() )
+ sGrfName = *pItem->GetGraphicLink();
+ }
+ else
+ return aEmptyStr;
+ }
+ return ExportGraphic( aGraphic, sGrfName );
+}
+
+String ExportGraphic( const Graphic &rGraphic, const String &rGrfName )
+{
+ SvtPathOptions aPathOpt;
+ String sGrfPath( aPathOpt.GetGraphicPath() );
+
+ FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_SIMPLE, 0 );
+ Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+
+// aExpDlg.SetHelpId(HID_FILEDLG_ROMENU);
+ INetURLObject aPath;
+ aPath.SetSmartURL( sGrfPath );
+
+ //Namen der Grafik herausfischen.
+ String aName = rGrfName;
+
+ aDlgHelper.SetTitle( SW_RESSTR(STR_EXPORT_GRAFIK_TITLE));
+ aDlgHelper.SetDisplayDirectory( aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) );
+ INetURLObject aURL;
+ aURL.SetSmartURL( aName );
+ aDlgHelper.SetFileName( aURL.GetName() );
+
+ GraphicFilter& rGF = *GraphicFilter::GetGraphicFilter();
+ const USHORT nCount = rGF.GetExportFormatCount();
+
+ String aExt( aURL.GetExtension() );
+ if( !aExt.Len() )
+ lcl_GetPreferedExtension( aExt, rGraphic );
+
+ aExt.ToLowerAscii();
+ USHORT nDfltFilter = USHRT_MAX;
+
+ Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
+
+ for ( USHORT i = 0; i < nCount; i++ )
+ {
+ xFltMgr->appendFilter( rGF.GetExportFormatName( i ), rGF.GetExportWildcard( i ) );
+ if ( COMPARE_EQUAL == aExt.CompareIgnoreCaseToAscii(rGF.GetExportFormatShortName( i ).ToLowerAscii() ))
+ nDfltFilter = i;
+ }
+ if ( USHRT_MAX == nDfltFilter )
+ {
+ //"falsche" Extension?
+ lcl_GetPreferedExtension( aExt, rGraphic );
+ for ( USHORT i = 0; i < nCount; ++i )
+ if ( aExt == rGF.GetExportFormatShortName( i ).ToLowerAscii() )
+ {
+ nDfltFilter = i;
+ break;
+ }
+ }
+
+ if( USHRT_MAX != nDfltFilter )
+ {
+ xFltMgr->setCurrentFilter( rGF.GetExportFormatName( nDfltFilter ) ) ;
+
+ if( aDlgHelper.Execute() == ERRCODE_NONE )
+ {
+ String sPath( xFP->getFiles().getConstArray()[0] );
+ //verwendeten Pfad merken - bitte nicht wieder wegoptimieren!
+ aPath.SetSmartURL( sPath);
+ sGrfPath = aPath.GetPath();
+
+ if( rGrfName.Len() &&
+ nDfltFilter == rGF.GetExportFormatNumber( xFltMgr->getCurrentFilter()))
+ {
+ //Versuchen die Originalgrafik zu speichern.
+ SfxMedium aIn( rGrfName, STREAM_READ | STREAM_NOCREATE,
+ TRUE );
+ if( aIn.GetInStream() && !aIn.GetInStream()->GetError() )
+ {
+ SfxMedium aOut( sPath, STREAM_WRITE | STREAM_SHARE_DENYNONE,
+ FALSE);
+ if( aOut.GetOutStream() && !aOut.GetOutStream()->GetError())
+ {
+ *aOut.GetOutStream() << *aIn.GetInStream();
+ if ( 0 == aIn.GetError() )
+ {
+ aOut.Close();
+ aOut.Commit();
+ if ( 0 == aOut.GetError() )
+ return sPath;
+ }
+ }
+ }
+ }
+
+ USHORT nFilter;
+ if ( xFltMgr->getCurrentFilter().getLength() && rGF.GetExportFormatCount() )
+ nFilter = rGF.GetExportFormatNumber( xFltMgr->getCurrentFilter() );
+ else
+ nFilter = GRFILTER_FORMAT_DONTKNOW;
+ String aFilter( rGF.GetExportFormatShortName( nFilter ) );
+ XOutBitmap::WriteGraphic( rGraphic, sPath, aFilter,
+ XOUTBMP_DONT_EXPAND_FILENAME );
+ return sPath;
+ }
+ }
+ return aEmptyStr;
+}
+
+
+
diff --git a/sw/source/ui/docvw/romenu.hxx b/sw/source/ui/docvw/romenu.hxx
new file mode 100644
index 000000000000..2d60689c6854
--- /dev/null
+++ b/sw/source/ui/docvw/romenu.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ROMENU_HXX
+#define _ROMENU_HXX
+
+
+#ifndef _GRAPH_HXX //autogen
+#include <vcl/graph.hxx>
+#endif
+#include <tools/list.hxx>
+#ifndef _MENU_HXX //autogen
+#include <vcl/menu.hxx>
+#endif
+
+class SwView;
+class SfxDispatcher;
+class SvxBrushItem;
+class ImageMap;
+class INetImage;
+
+class SwReadOnlyPopup : public PopupMenu
+{
+ SwView &rView;
+ const SvxBrushItem *pItem;
+ const Point &rDocPos;
+ Graphic aGraphic;
+ String sURL,
+ sTargetFrameName,
+ sDescription,
+ sGrfName;
+ List aThemeList;
+ BOOL bGrfToGalleryAsLnk;
+ ImageMap* pImageMap;
+ INetImage* pTargetURL;
+
+ void Check( USHORT nMID, USHORT nSID, SfxDispatcher &rDis );
+ String SaveGraphic( USHORT nId );
+
+ using PopupMenu::Execute;
+
+public:
+ SwReadOnlyPopup( const Point &rDPos, SwView &rV );
+ ~SwReadOnlyPopup();
+
+ void Execute( Window* pWin, const Point &rPPos );
+ void Execute( Window* pWin, USHORT nId );
+};
+
+
+#endif
+
diff --git a/sw/source/ui/docvw/srcedtw.cxx b/sw/source/ui/docvw/srcedtw.cxx
new file mode 100644
index 000000000000..56c4eba3b8f1
--- /dev/null
+++ b/sw/source/ui/docvw/srcedtw.cxx
@@ -0,0 +1,1099 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+
+
+#include <svtools/textview.hxx>
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#ifndef _SCRBAR_HXX //autogen
+#include <vcl/scrbar.hxx>
+#endif
+#include <sfx2/dispatch.hxx>
+#include <sfx2/app.hxx>
+#include <svtools/htmltokn.h>
+#include <svtools/txtattr.hxx>
+#include <unotools/sourceviewconfig.hxx>
+#include <svtools/colorcfg.hxx>
+#include <editeng/flstitem.hxx>
+#include <vcl/metric.hxx>
+#include <svtools/ctrltool.hxx>
+#include <tools/time.hxx>
+#include <swmodule.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#ifndef _SRCVIEW_HXX
+#include <srcview.hxx>
+#endif
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#include <deque>
+
+
+
+struct SwTextPortion
+{
+ USHORT nLine;
+ USHORT nStart, nEnd;
+ svtools::ColorConfigEntry eType;
+};
+
+#define MAX_SYNTAX_HIGHLIGHT 20
+#define MAX_HIGHLIGHTTIME 200
+#define SYNTAX_HIGHLIGHT_TIMEOUT 200
+
+typedef std::deque<SwTextPortion> SwTextPortions;
+
+
+static void lcl_Highlight(const String& rSource, SwTextPortions& aPortionList)
+{
+ const sal_Unicode cOpenBracket = '<';
+ const sal_Unicode cCloseBracket= '>';
+ const sal_Unicode cSlash = '/';
+ const sal_Unicode cExclamation = '!';
+ const sal_Unicode cMinus = '-';
+ const sal_Unicode cSpace = ' ';
+ const sal_Unicode cTab = 0x09;
+ const sal_Unicode cLF = 0x0a;
+ const sal_Unicode cCR = 0x0d;
+
+
+ const USHORT nStrLen = rSource.Len();
+ USHORT nInsert = 0; // Number of inserted Portions
+ USHORT nActPos = 0; // Position, at the '<' was found
+ USHORT nOffset = 0; // Offset of nActPos for '<'
+ USHORT nPortStart = USHRT_MAX; // For the TextPortion
+ USHORT nPortEnd = 0; //
+ SwTextPortion aText;
+ while(nActPos < nStrLen)
+ {
+ svtools::ColorConfigEntry eFoundType = svtools::HTMLUNKNOWN;
+ if(rSource.GetChar(nActPos) == cOpenBracket && nActPos < nStrLen - 2 )
+ {
+ // 'leere' Portion einfuegen
+ if(nPortEnd < nActPos - 1 )
+ {
+ aText.nLine = 0;
+ // am Anfang nicht verschieben
+ aText.nStart = nPortEnd;
+ if(nInsert)
+ aText.nStart += 1;
+ aText.nEnd = nActPos - 1;
+ aText.eType = svtools::HTMLUNKNOWN;
+ aPortionList.push_back( aText );
+ nInsert++;
+ }
+ sal_Unicode cFollowFirst = rSource.GetChar((xub_StrLen)(nActPos + 1));
+ sal_Unicode cFollowNext = rSource.GetChar((xub_StrLen)(nActPos + 2));
+ if(cExclamation == cFollowFirst)
+ {
+ // "<!" SGML oder Kommentar
+ if(cMinus == cFollowNext &&
+ nActPos < nStrLen - 3 && cMinus == rSource.GetChar((xub_StrLen)(nActPos + 3)))
+ {
+ eFoundType = svtools::HTMLCOMMENT;
+ }
+ else
+ eFoundType = svtools::HTMLSGML;
+ nPortStart = nActPos;
+ nPortEnd = nActPos + 1;
+ }
+ else if(cSlash == cFollowFirst)
+ {
+ // "</" Slash ignorieren
+ nPortStart = nActPos;
+ nActPos++;
+ nOffset++;
+ }
+ if(svtools::HTMLUNKNOWN == eFoundType)
+ {
+ //jetzt koennte hier ein keyword folgen
+ USHORT nSrchPos = nActPos;
+ while(++nSrchPos < nStrLen - 1)
+ {
+ sal_Unicode cNext = rSource.GetChar(nSrchPos);
+ if( cNext == cSpace ||
+ cNext == cTab ||
+ cNext == cLF ||
+ cNext == cCR)
+ break;
+ else if(cNext == cCloseBracket)
+ {
+ break;
+ }
+ }
+ if(nSrchPos > nActPos + 1)
+ {
+ //irgend ein String wurde gefunden
+ String sToken = rSource.Copy(nActPos + 1, nSrchPos - nActPos - 1 );
+ sToken.ToUpperAscii();
+ int nToken = ::GetHTMLToken(sToken);
+ if(nToken)
+ {
+ //Token gefunden
+ eFoundType = svtools::HTMLKEYWORD;
+ nPortEnd = nSrchPos;
+ nPortStart = nActPos;
+ }
+ else
+ {
+ //was war das denn?
+#if OSL_DEBUG_LEVEL > 1
+ DBG_ERROR("Token nicht erkannt!");
+ DBG_ERROR(ByteString(sToken, gsl_getSystemTextEncoding()).GetBuffer());
+#endif
+ }
+
+ }
+ }
+ // jetzt muss noch '>' gesucht werden
+ if(svtools::HTMLUNKNOWN != eFoundType)
+ {
+ BOOL bFound = FALSE;
+ for(USHORT i = nPortEnd; i < nStrLen; i++)
+ if(cCloseBracket == rSource.GetChar(i))
+ {
+ bFound = TRUE;
+ nPortEnd = i;
+ break;
+ }
+ if(!bFound && (eFoundType == svtools::HTMLCOMMENT))
+ {
+ // Kommentar ohne Ende in dieser Zeile
+ bFound = TRUE;
+ nPortEnd = nStrLen - 1;
+ }
+
+ if(bFound ||(eFoundType == svtools::HTMLCOMMENT))
+ {
+ SwTextPortion aTextPortion;
+ aTextPortion.nLine = 0;
+ aTextPortion.nStart = nPortStart + 1;
+ aTextPortion.nEnd = nPortEnd;
+ aTextPortion.eType = eFoundType;
+ aPortionList.push_back( aTextPortion );
+ nInsert++;
+ eFoundType = svtools::HTMLUNKNOWN;
+ }
+
+ }
+ }
+ nActPos++;
+ }
+ if(nInsert && nPortEnd < nActPos - 1)
+ {
+ aText.nLine = 0;
+ aText.nStart = nPortEnd + 1;
+ aText.nEnd = nActPos - 1;
+ aText.eType = svtools::HTMLUNKNOWN;
+ aPortionList.push_back( aText );
+ nInsert++;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwSrcEditWindow::SwSrcEditWindow( Window* pParent, SwSrcView* pParentView ) :
+ Window( pParent, WB_BORDER|WB_CLIPCHILDREN ),
+
+ pTextEngine(0),
+
+ pOutWin(0),
+ pHScrollbar(0),
+ pVScrollbar(0),
+
+ pSrcView(pParentView),
+ pSourceViewConfig(new utl::SourceViewConfig),
+
+ nCurTextWidth(0),
+ nStartLine(USHRT_MAX),
+ eSourceEncoding(gsl_getSystemTextEncoding()),
+ bDoSyntaxHighlight(TRUE),
+ bHighlighting(FALSE)
+{
+ SetHelpId(HID_SOURCE_EDITWIN);
+ CreateTextEngine();
+ pSourceViewConfig->AddListener(this);
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+ SwSrcEditWindow::~SwSrcEditWindow()
+{
+ pSourceViewConfig->RemoveListener(this);
+ delete pSourceViewConfig;
+ aSyntaxIdleTimer.Stop();
+ if ( pTextEngine )
+ {
+ EndListening( *pTextEngine );
+ pTextEngine->RemoveView( pTextView );
+
+ delete pHScrollbar;
+ delete pVScrollbar;
+
+ delete pTextView;
+ delete pTextEngine;
+ }
+ delete pOutWin;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwSrcEditWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ switch ( rDCEvt.GetType() )
+ {
+ case DATACHANGED_SETTINGS:
+ // ScrollBars neu anordnen bzw. Resize ausloesen, da sich
+ // ScrollBar-Groesse geaendert haben kann. Dazu muss dann im
+ // Resize-Handler aber auch die Groesse der ScrollBars aus
+ // den Settings abgefragt werden.
+ if( rDCEvt.GetFlags() & SETTINGS_STYLE )
+ Resize();
+ break;
+ }
+}
+
+void SwSrcEditWindow::Resize()
+{
+ // ScrollBars, etc. passiert in Adjust...
+ if ( pTextView )
+ {
+ long nVisY = pTextView->GetStartDocPos().Y();
+ pTextView->ShowCursor();
+ Size aOutSz( GetOutputSizePixel() );
+ long nMaxVisAreaStart = pTextView->GetTextEngine()->GetTextHeight() - aOutSz.Height();
+ if ( nMaxVisAreaStart < 0 )
+ nMaxVisAreaStart = 0;
+ if ( pTextView->GetStartDocPos().Y() > nMaxVisAreaStart )
+ {
+ Point aStartDocPos( pTextView->GetStartDocPos() );
+ aStartDocPos.Y() = nMaxVisAreaStart;
+ pTextView->SetStartDocPos( aStartDocPos );
+ pTextView->ShowCursor();
+ }
+ long nScrollStd = GetSettings().GetStyleSettings().GetScrollBarSize();
+ Size aScrollSz(aOutSz.Width() - nScrollStd, nScrollStd );
+ Point aScrollPos(0, aOutSz.Height() - nScrollStd);
+
+ pHScrollbar->SetPosSizePixel( aScrollPos, aScrollSz);
+
+ aScrollSz.Width() = aScrollSz.Height();
+ aScrollSz.Height() = aOutSz.Height();
+ aScrollPos = Point(aOutSz.Width() - nScrollStd, 0);
+
+ pVScrollbar->SetPosSizePixel( aScrollPos, aScrollSz);
+ aOutSz.Width() -= nScrollStd;
+ aOutSz.Height() -= nScrollStd;
+ pOutWin->SetOutputSizePixel(aOutSz);
+ InitScrollBars();
+
+ // Zeile im ersten Resize setzen
+ if(USHRT_MAX != nStartLine)
+ {
+ if(nStartLine < pTextEngine->GetParagraphCount())
+ {
+ TextSelection aSel(TextPaM( nStartLine, 0 ), TextPaM( nStartLine, 0x0 ));
+ pTextView->SetSelection(aSel);
+ pTextView->ShowCursor();
+ }
+ nStartLine = USHRT_MAX;
+ }
+
+ if ( nVisY != pTextView->GetStartDocPos().Y() )
+ Invalidate();
+ }
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void TextViewOutWin::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ switch( rDCEvt.GetType() )
+ {
+ case DATACHANGED_SETTINGS:
+ // den Settings abgefragt werden.
+ if( rDCEvt.GetFlags() & SETTINGS_STYLE )
+ {
+ const Color &rCol = GetSettings().GetStyleSettings().GetWindowColor();
+ SetBackground( rCol );
+ Font aFont( pTextView->GetTextEngine()->GetFont() );
+ aFont.SetFillColor( rCol );
+ pTextView->GetTextEngine()->SetFont( aFont );
+ }
+ break;
+ }
+}
+
+void TextViewOutWin::MouseMove( const MouseEvent &rEvt )
+{
+ if ( pTextView )
+ pTextView->MouseMove( rEvt );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void TextViewOutWin::MouseButtonUp( const MouseEvent &rEvt )
+{
+ if ( pTextView )
+ {
+ pTextView->MouseButtonUp( rEvt );
+ SfxBindings& rBindings = ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->GetBindings();
+ rBindings.Invalidate( SID_TABLE_CELL );
+ rBindings.Invalidate( SID_CUT );
+ rBindings.Invalidate( SID_COPY );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void TextViewOutWin::MouseButtonDown( const MouseEvent &rEvt )
+{
+ GrabFocus();
+ if ( pTextView )
+ pTextView->MouseButtonDown( rEvt );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void TextViewOutWin::Command( const CommandEvent& rCEvt )
+{
+ switch(rCEvt.GetCommand())
+ {
+ case COMMAND_CONTEXTMENU:
+ ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->
+ GetDispatcher()->ExecutePopup();
+ break;
+ case COMMAND_WHEEL:
+ case COMMAND_STARTAUTOSCROLL:
+ case COMMAND_AUTOSCROLL:
+ {
+ const CommandWheelData* pWData = rCEvt.GetWheelData();
+ if( !pWData || COMMAND_WHEEL_ZOOM != pWData->GetMode() )
+ {
+ ((SwSrcEditWindow*)GetParent())->HandleWheelCommand( rCEvt );
+ }
+ }
+ break;
+
+ default:
+ if ( pTextView )
+ pTextView->Command( rCEvt );
+ else
+ Window::Command(rCEvt);
+ }
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void TextViewOutWin::KeyInput( const KeyEvent& rKEvt )
+{
+ BOOL bDone = FALSE;
+ SwSrcEditWindow* pSrcEditWin = (SwSrcEditWindow*)GetParent();
+ BOOL bChange = !pSrcEditWin->IsReadonly() || !TextEngine::DoesKeyChangeText( rKEvt );
+ if(bChange)
+ bDone = pTextView->KeyInput( rKEvt );
+
+ SfxBindings& rBindings = ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->GetBindings();
+ if ( !bDone )
+ {
+ if ( !SfxViewShell::Current()->KeyInput( rKEvt ) )
+ Window::KeyInput( rKEvt );
+ }
+ else
+ {
+ rBindings.Invalidate( SID_TABLE_CELL );
+ if ( rKEvt.GetKeyCode().GetGroup() == KEYGROUP_CURSOR )
+ rBindings.Update( SID_BASICIDE_STAT_POS );
+ if (pSrcEditWin->GetTextEngine()->IsModified() )
+ {
+ rBindings.Invalidate( SID_SAVEDOC );
+ rBindings.Invalidate( SID_DOC_MODIFIED );
+ }
+ if( rKEvt.GetKeyCode().GetCode() == KEY_INSERT )
+ rBindings.Invalidate( SID_ATTR_INSERT );
+ }
+
+ rBindings.Invalidate( SID_CUT );
+ rBindings.Invalidate( SID_COPY );
+
+ SwDocShell* pDocShell = pSrcEditWin->GetSrcView()->GetDocShell();
+ if(pSrcEditWin->GetTextEngine()->IsModified())
+ {
+ pDocShell->SetModified();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void TextViewOutWin::Paint( const Rectangle& rRect )
+{
+ pTextView->Paint( rRect );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwSrcEditWindow::CreateTextEngine()
+{
+ const Color &rCol = GetSettings().GetStyleSettings().GetWindowColor();
+ pOutWin = new TextViewOutWin(this, 0);
+ pOutWin->SetBackground(Wallpaper(rCol));
+ pOutWin->SetPointer(Pointer(POINTER_TEXT));
+ pOutWin->Show();
+
+ //Scrollbars anlegen
+ pHScrollbar = new ScrollBar(this, WB_3DLOOK |WB_HSCROLL|WB_DRAG);
+ pHScrollbar->EnableRTL( false ); // #107300# --- RTL --- no mirroring for scrollbars
+ pHScrollbar->SetScrollHdl(LINK(this, SwSrcEditWindow, ScrollHdl));
+ pHScrollbar->Show();
+
+ pVScrollbar = new ScrollBar(this, WB_3DLOOK |WB_VSCROLL|WB_DRAG);
+ pVScrollbar->EnableRTL( false ); // #107300# --- RTL --- no mirroring for scrollbars
+ pVScrollbar->SetScrollHdl(LINK(this, SwSrcEditWindow, ScrollHdl));
+ pHScrollbar->EnableDrag();
+ pVScrollbar->Show();
+
+ pTextEngine = new ExtTextEngine;
+ pTextView = new ExtTextView( pTextEngine, pOutWin );
+ pTextView->SetAutoIndentMode(TRUE);
+ pOutWin->SetTextView(pTextView);
+
+ pTextEngine->SetUpdateMode( FALSE );
+ pTextEngine->InsertView( pTextView );
+
+ Font aFont;
+ aFont.SetTransparent( FALSE );
+ aFont.SetFillColor( rCol );
+ SetPointFont( aFont );
+ aFont = GetFont();
+ aFont.SetFillColor( rCol );
+ pOutWin->SetFont( aFont );
+ pTextEngine->SetFont( aFont );
+
+ aSyntaxIdleTimer.SetTimeout( SYNTAX_HIGHLIGHT_TIMEOUT );
+ aSyntaxIdleTimer.SetTimeoutHdl( LINK( this, SwSrcEditWindow, SyntaxTimerHdl ) );
+
+ pTextEngine->EnableUndo( TRUE );
+ pTextEngine->SetUpdateMode( TRUE );
+
+ pTextView->ShowCursor( TRUE, TRUE );
+ InitScrollBars();
+ StartListening( *pTextEngine );
+
+ SfxBindings& rBind = GetSrcView()->GetViewFrame()->GetBindings();
+ rBind.Invalidate( SID_TABLE_CELL );
+// rBind.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwSrcEditWindow::SetScrollBarRanges()
+{
+ // Extra-Methode, nicht InitScrollBars, da auch fuer TextEngine-Events.
+
+ pHScrollbar->SetRange( Range( 0, nCurTextWidth-1 ) );
+ pVScrollbar->SetRange( Range(0, pTextEngine->GetTextHeight()-1) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwSrcEditWindow::InitScrollBars()
+{
+ SetScrollBarRanges();
+
+ Size aOutSz( pOutWin->GetOutputSizePixel() );
+ pVScrollbar->SetVisibleSize( aOutSz.Height() );
+ pVScrollbar->SetPageSize( aOutSz.Height() * 8 / 10 );
+ pVScrollbar->SetLineSize( pOutWin->GetTextHeight() );
+ pVScrollbar->SetThumbPos( pTextView->GetStartDocPos().Y() );
+ pHScrollbar->SetVisibleSize( aOutSz.Width() );
+ pHScrollbar->SetPageSize( aOutSz.Width() * 8 / 10 );
+ pHScrollbar->SetLineSize( pOutWin->GetTextWidth( 'x' ) );
+ pHScrollbar->SetThumbPos( pTextView->GetStartDocPos().X() );
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+IMPL_LINK(SwSrcEditWindow, ScrollHdl, ScrollBar*, pScroll)
+{
+ if(pScroll == pVScrollbar)
+ {
+ long nDiff = pTextView->GetStartDocPos().Y() - pScroll->GetThumbPos();
+ GetTextView()->Scroll( 0, nDiff );
+ pTextView->ShowCursor( FALSE, TRUE );
+ pScroll->SetThumbPos( pTextView->GetStartDocPos().Y() );
+ }
+ else
+ {
+ long nDiff = pTextView->GetStartDocPos().X() - pScroll->GetThumbPos();
+ GetTextView()->Scroll( nDiff, 0 );
+ pTextView->ShowCursor( FALSE, TRUE );
+ pScroll->SetThumbPos( pTextView->GetStartDocPos().X() );
+ }
+ GetSrcView()->GetViewFrame()->GetBindings().Invalidate( SID_TABLE_CELL );
+ return 0;
+}
+
+/*-----------------15.01.97 09.22-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK( SwSrcEditWindow, SyntaxTimerHdl, Timer *, pTimer )
+{
+ Time aSyntaxCheckStart;
+ DBG_ASSERT( pTextView, "Noch keine View, aber Syntax-Highlight ?!" );
+ // pTextEngine->SetUpdateMode( FALSE );
+
+ bHighlighting = TRUE;
+ USHORT nLine;
+ USHORT nCount = 0;
+ // zuerst wird der Bereich um dem Cursor bearbeitet
+ TextSelection aSel = pTextView->GetSelection();
+ USHORT nCur = (USHORT)aSel.GetStart().GetPara();
+ if(nCur > 40)
+ nCur -= 40;
+ else
+ nCur = 0;
+ if(aSyntaxLineTable.Count())
+ for(USHORT i = 0; i < 80 && nCount < 40; i++, nCur++)
+ {
+ void * p = aSyntaxLineTable.Get(nCur);
+ if(p)
+ {
+ DoSyntaxHighlight( nCur );
+ aSyntaxLineTable.Remove( nCur );
+ nCount++;
+ if(!aSyntaxLineTable.Count())
+ break;
+ if((Time().GetTime() - aSyntaxCheckStart.GetTime()) > MAX_HIGHLIGHTTIME )
+ {
+ pTimer->SetTimeout( 2 * SYNTAX_HIGHLIGHT_TIMEOUT );
+ break;
+ }
+ }
+ }
+
+ // wenn dann noch etwas frei ist, wird von Beginn an weitergearbeitet
+ void* p = aSyntaxLineTable.First();
+ while ( p && nCount < MAX_SYNTAX_HIGHLIGHT)
+ {
+ nLine = (USHORT)aSyntaxLineTable.GetCurKey();
+ DoSyntaxHighlight( nLine );
+ USHORT nCurKey = (USHORT)aSyntaxLineTable.GetCurKey();
+ p = aSyntaxLineTable.Next();
+ aSyntaxLineTable.Remove(nCurKey);
+ nCount ++;
+ if(Time().GetTime() - aSyntaxCheckStart.GetTime() > MAX_HIGHLIGHTTIME)
+ {
+ pTimer->SetTimeout( 2 * SYNTAX_HIGHLIGHT_TIMEOUT );
+ break;
+ }
+ }
+ // os: #43050# hier wird ein TextView-Problem umpopelt:
+ // waehrend des Highlightings funktionierte das Scrolling nicht
+ /* MT: Shouldn't be a oproblem any more, using IdeFormatter in Insert/RemoveAttrib now.
+
+ TextView* pTmp = pTextEngine->GetActiveView();
+ pTextEngine->SetActiveView(0);
+ // pTextEngine->SetUpdateMode( TRUE );
+ pTextEngine->SetActiveView(pTmp);
+ pTextView->ShowCursor(FALSE, FALSE);
+ */
+
+ if(aSyntaxLineTable.Count() && !pTimer->IsActive())
+ pTimer->Start();
+ // SyntaxTimerHdl wird gerufen, wenn Text-Aenderung
+ // => gute Gelegenheit, Textbreite zu ermitteln!
+ long nPrevTextWidth = nCurTextWidth;
+ nCurTextWidth = pTextEngine->CalcTextWidth() + 25; // kleine Toleranz
+ if ( nCurTextWidth != nPrevTextWidth )
+ SetScrollBarRanges();
+ bHighlighting = FALSE;
+
+ return 0;
+}
+/*-----------------15.01.97 10.01-------------------
+
+--------------------------------------------------*/
+
+void SwSrcEditWindow::DoSyntaxHighlight( USHORT nPara )
+{
+ // Durch das DelayedSyntaxHighlight kann es passieren,
+ // dass die Zeile nicht mehr existiert!
+ if ( nPara < pTextEngine->GetParagraphCount() )
+ {
+ BOOL bTempModified = IsModified();
+ pTextEngine->RemoveAttribs( nPara, (BOOL)TRUE );
+ String aSource( pTextEngine->GetText( nPara ) );
+ pTextEngine->SetUpdateMode( FALSE );
+ ImpDoHighlight( aSource, nPara );
+ // os: #43050# hier wird ein TextView-Problem umpopelt:
+ // waehrend des Highlightings funktionierte das Scrolling nicht
+ TextView* pTmp = pTextEngine->GetActiveView();
+ pTmp->SetAutoScroll(FALSE);
+ pTextEngine->SetActiveView(0);
+ pTextEngine->SetUpdateMode( TRUE );
+ pTextEngine->SetActiveView(pTmp);
+ // Bug 72887 show the cursor
+ pTmp->SetAutoScroll(TRUE);
+ pTmp->ShowCursor( FALSE/*pTmp->IsAutoScroll()*/ );
+
+ if(!bTempModified)
+ ClearModifyFlag();
+ }
+}
+
+/*-----------------15.01.97 09.49-------------------
+
+--------------------------------------------------*/
+
+void SwSrcEditWindow::DoDelayedSyntaxHighlight( USHORT nPara )
+{
+ if ( !bHighlighting && bDoSyntaxHighlight )
+ {
+ aSyntaxLineTable.Insert( nPara, (void*)(USHORT)1 );
+ aSyntaxIdleTimer.Start();
+ }
+}
+
+/*-----------------15.01.97 11.32-------------------
+
+--------------------------------------------------*/
+
+void SwSrcEditWindow::ImpDoHighlight( const String& rSource, USHORT nLineOff )
+{
+ SwTextPortions aPortionList;
+ lcl_Highlight(rSource, aPortionList);
+
+ size_t nCount = aPortionList.size();
+ if ( !nCount )
+ return;
+
+ SwTextPortion& rLast = aPortionList[nCount-1];
+ if ( rLast.nStart > rLast.nEnd ) // Nur bis Bug von MD behoeben
+ {
+ nCount--;
+ aPortionList.pop_back();
+ if ( !nCount )
+ return;
+ }
+
+ // Evtl. Optimieren:
+ // Wenn haufig gleiche Farbe, dazwischen Blank ohne Farbe,
+ // ggf. zusammenfassen, oder zumindest das Blank,
+ // damit weniger Attribute
+ BOOL bOptimizeHighlight = TRUE; // war in der BasicIDE static
+ if ( bOptimizeHighlight )
+ {
+ // Es muessen nur die Blanks und Tabs mit attributiert werden.
+ // Wenn zwei gleiche Attribute hintereinander eingestellt werden,
+ // optimiert das die TextEngine.
+ USHORT nLastEnd = 0;
+
+#ifdef DBG_UTIL
+ USHORT nLine = aPortionList[0].nLine;
+#endif
+ for ( size_t i = 0; i < nCount; i++ )
+ {
+ SwTextPortion& r = aPortionList[i];
+ DBG_ASSERT( r.nLine == nLine, "doch mehrere Zeilen ?" );
+ if ( r.nStart > r.nEnd ) // Nur bis Bug von MD behoeben
+ continue;
+
+ if ( r.nStart > nLastEnd )
+ {
+ // Kann ich mich drauf verlassen, dass alle ausser
+ // Blank und Tab gehighlightet wird ?!
+ r.nStart = nLastEnd;
+ }
+ nLastEnd = r.nEnd+1;
+ if ( ( i == (nCount-1) ) && ( r.nEnd < rSource.Len() ) )
+ r.nEnd = rSource.Len();
+ }
+ }
+
+ for ( size_t i = 0; i < aPortionList.size(); i++ )
+ {
+ SwTextPortion& r = aPortionList[i];
+ if ( r.nStart > r.nEnd ) // Nur bis Bug von MD behoeben
+ continue;
+ if(r.eType != svtools::HTMLSGML &&
+ r.eType != svtools::HTMLCOMMENT &&
+ r.eType != svtools::HTMLKEYWORD &&
+ r.eType != svtools::HTMLUNKNOWN)
+ r.eType = svtools::HTMLUNKNOWN;
+ Color aColor((ColorData)SW_MOD()->GetColorConfig().GetColorValue((svtools::ColorConfigEntry)r.eType).nColor);
+ USHORT nLine = nLineOff+r.nLine; //
+ pTextEngine->SetAttrib( TextAttribFontColor( aColor ), nLine, r.nStart, r.nEnd+1, TRUE );
+ }
+}
+
+/*-----------------30.06.97 09:12-------------------
+
+--------------------------------------------------*/
+
+void SwSrcEditWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+{
+ if ( rHint.ISA( TextHint ) )
+ {
+ const TextHint& rTextHint = (const TextHint&)rHint;
+ if( rTextHint.GetId() == TEXT_HINT_VIEWSCROLLED )
+ {
+ pHScrollbar->SetThumbPos( pTextView->GetStartDocPos().X() );
+ pVScrollbar->SetThumbPos( pTextView->GetStartDocPos().Y() );
+ }
+ else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED )
+ {
+ if ( (long)pTextEngine->GetTextHeight() < pOutWin->GetOutputSizePixel().Height() )
+ pTextView->Scroll( 0, pTextView->GetStartDocPos().Y() );
+ pVScrollbar->SetThumbPos( pTextView->GetStartDocPos().Y() );
+ SetScrollBarRanges();
+ }
+ else if( ( rTextHint.GetId() == TEXT_HINT_PARAINSERTED ) ||
+ ( rTextHint.GetId() == TEXT_HINT_PARACONTENTCHANGED ) )
+ {
+ DoDelayedSyntaxHighlight( (USHORT)rTextHint.GetValue() );
+ }
+ }
+}
+
+void SwSrcEditWindow::ConfigurationChanged( utl::ConfigurationBroadcaster* pBrdCst, sal_uInt32 )
+{
+ if( pBrdCst == pSourceViewConfig)
+ SetFont();
+}
+
+/*-----------------30.06.97 13:22-------------------
+
+--------------------------------------------------*/
+
+void SwSrcEditWindow::Invalidate(USHORT )
+{
+ pOutWin->Invalidate();
+ Window::Invalidate();
+
+}
+
+void SwSrcEditWindow::Command( const CommandEvent& rCEvt )
+{
+ switch(rCEvt.GetCommand())
+ {
+ case COMMAND_WHEEL:
+ case COMMAND_STARTAUTOSCROLL:
+ case COMMAND_AUTOSCROLL:
+ {
+ const CommandWheelData* pWData = rCEvt.GetWheelData();
+ if( !pWData || COMMAND_WHEEL_ZOOM != pWData->GetMode() )
+ HandleScrollCommand( rCEvt, pHScrollbar, pVScrollbar );
+ }
+ break;
+ default:
+ Window::Command(rCEvt);
+ }
+}
+
+void SwSrcEditWindow::HandleWheelCommand( const CommandEvent& rCEvt )
+{
+ pTextView->Command(rCEvt);
+ HandleScrollCommand( rCEvt, pHScrollbar, pVScrollbar );
+}
+
+void SwSrcEditWindow::GetFocus()
+{
+ pOutWin->GrabFocus();
+}
+
+/*void SwSrcEditWindow::LoseFocus()
+{
+ Window::LoseFocus();
+// pOutWin->LoseFocus();
+// rView.LostFocus();
+} */
+/* -----------------------------29.08.2002 13:21------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL lcl_GetLanguagesForEncoding(rtl_TextEncoding eEnc, LanguageType aLanguages[])
+{
+ switch(eEnc)
+ {
+ case RTL_TEXTENCODING_UTF7 :
+ case RTL_TEXTENCODING_UTF8 :
+ // don#t fill - all LANGUAGE_SYSTEM means unicode font has to be used
+ break;
+
+
+ case RTL_TEXTENCODING_ISO_8859_3:
+ case RTL_TEXTENCODING_ISO_8859_1 :
+ case RTL_TEXTENCODING_MS_1252 :
+ case RTL_TEXTENCODING_APPLE_ROMAN :
+ case RTL_TEXTENCODING_IBM_850 :
+ case RTL_TEXTENCODING_ISO_8859_14 :
+ case RTL_TEXTENCODING_ISO_8859_15 :
+ //fill with western languages
+ aLanguages[0] = LANGUAGE_GERMAN;
+ aLanguages[1] = LANGUAGE_FRENCH;
+ aLanguages[2] = LANGUAGE_ITALIAN;
+ aLanguages[3] = LANGUAGE_SPANISH;
+ break;
+
+ case RTL_TEXTENCODING_IBM_865 :
+ //scandinavian
+ aLanguages[0] = LANGUAGE_FINNISH;
+ aLanguages[1] = LANGUAGE_NORWEGIAN;
+ aLanguages[2] = LANGUAGE_SWEDISH;
+ aLanguages[3] = LANGUAGE_DANISH;
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_10 :
+ case RTL_TEXTENCODING_ISO_8859_13 :
+ case RTL_TEXTENCODING_ISO_8859_2 :
+ case RTL_TEXTENCODING_IBM_852 :
+ case RTL_TEXTENCODING_MS_1250 :
+ case RTL_TEXTENCODING_APPLE_CENTEURO :
+ aLanguages[0] = LANGUAGE_POLISH;
+ aLanguages[1] = LANGUAGE_CZECH;
+ aLanguages[2] = LANGUAGE_HUNGARIAN;
+ aLanguages[3] = LANGUAGE_SLOVAK;
+ break;
+
+ case RTL_TEXTENCODING_ISO_8859_4 :
+ case RTL_TEXTENCODING_IBM_775 :
+ case RTL_TEXTENCODING_MS_1257 :
+ aLanguages[0] = LANGUAGE_LATVIAN ;
+ aLanguages[1] = LANGUAGE_LITHUANIAN;
+ aLanguages[2] = LANGUAGE_ESTONIAN ;
+ break;
+
+ case RTL_TEXTENCODING_IBM_863 : aLanguages[0] = LANGUAGE_FRENCH_CANADIAN; break;
+ case RTL_TEXTENCODING_APPLE_FARSI : aLanguages[0] = LANGUAGE_FARSI; break;
+ case RTL_TEXTENCODING_APPLE_ROMANIAN:aLanguages[0] = LANGUAGE_ROMANIAN; break;
+
+ case RTL_TEXTENCODING_IBM_861 :
+ case RTL_TEXTENCODING_APPLE_ICELAND :
+ aLanguages[0] = LANGUAGE_ICELANDIC;
+ break;
+
+ case RTL_TEXTENCODING_APPLE_CROATIAN:aLanguages[0] = LANGUAGE_CROATIAN; break;
+
+ case RTL_TEXTENCODING_IBM_437 :
+ case RTL_TEXTENCODING_ASCII_US : aLanguages[0] = LANGUAGE_ENGLISH; break;
+
+ case RTL_TEXTENCODING_IBM_862 :
+ case RTL_TEXTENCODING_MS_1255 :
+ case RTL_TEXTENCODING_APPLE_HEBREW :
+ case RTL_TEXTENCODING_ISO_8859_8 :
+ aLanguages[0] = LANGUAGE_HEBREW;
+ break;
+
+ case RTL_TEXTENCODING_IBM_857 :
+ case RTL_TEXTENCODING_MS_1254 :
+ case RTL_TEXTENCODING_APPLE_TURKISH:
+ case RTL_TEXTENCODING_ISO_8859_9 :
+ aLanguages[0] = LANGUAGE_TURKISH;
+ break;
+
+ case RTL_TEXTENCODING_IBM_860 :
+ aLanguages[0] = LANGUAGE_PORTUGUESE;
+ break;
+
+ case RTL_TEXTENCODING_IBM_869 :
+ case RTL_TEXTENCODING_MS_1253 :
+ case RTL_TEXTENCODING_APPLE_GREEK :
+ case RTL_TEXTENCODING_ISO_8859_7 :
+ case RTL_TEXTENCODING_IBM_737 :
+ aLanguages[0] = LANGUAGE_GREEK;
+ break;
+
+ case RTL_TEXTENCODING_KOI8_R :
+ case RTL_TEXTENCODING_ISO_8859_5 :
+ case RTL_TEXTENCODING_IBM_855 :
+ case RTL_TEXTENCODING_MS_1251 :
+ case RTL_TEXTENCODING_IBM_866 :
+ case RTL_TEXTENCODING_APPLE_CYRILLIC :
+ aLanguages[0] = LANGUAGE_RUSSIAN;
+ break;
+
+ case RTL_TEXTENCODING_APPLE_UKRAINIAN:
+ case RTL_TEXTENCODING_KOI8_U:
+ aLanguages[0] = LANGUAGE_UKRAINIAN;
+ break;
+
+ case RTL_TEXTENCODING_IBM_864 :
+ case RTL_TEXTENCODING_MS_1256 :
+ case RTL_TEXTENCODING_ISO_8859_6 :
+ case RTL_TEXTENCODING_APPLE_ARABIC :
+ aLanguages[0] = LANGUAGE_ARABIC_SAUDI_ARABIA;
+ break;
+
+ case RTL_TEXTENCODING_APPLE_CHINTRAD :
+ case RTL_TEXTENCODING_MS_950 :
+ case RTL_TEXTENCODING_GBT_12345 :
+ case RTL_TEXTENCODING_BIG5 :
+ case RTL_TEXTENCODING_EUC_TW :
+ case RTL_TEXTENCODING_BIG5_HKSCS :
+ aLanguages[0] = LANGUAGE_CHINESE_TRADITIONAL;
+ break;
+
+ case RTL_TEXTENCODING_EUC_JP :
+ case RTL_TEXTENCODING_ISO_2022_JP :
+ case RTL_TEXTENCODING_JIS_X_0201 :
+ case RTL_TEXTENCODING_JIS_X_0208 :
+ case RTL_TEXTENCODING_JIS_X_0212 :
+ case RTL_TEXTENCODING_APPLE_JAPANESE :
+ case RTL_TEXTENCODING_MS_932 :
+ case RTL_TEXTENCODING_SHIFT_JIS :
+ aLanguages[0] = LANGUAGE_JAPANESE;
+ break;
+
+ case RTL_TEXTENCODING_GB_2312 :
+ case RTL_TEXTENCODING_MS_936 :
+ case RTL_TEXTENCODING_GBK :
+ case RTL_TEXTENCODING_GB_18030 :
+ case RTL_TEXTENCODING_APPLE_CHINSIMP :
+ case RTL_TEXTENCODING_EUC_CN :
+ case RTL_TEXTENCODING_ISO_2022_CN :
+ aLanguages[0] = LANGUAGE_CHINESE_SIMPLIFIED;
+ break;
+
+ case RTL_TEXTENCODING_APPLE_KOREAN :
+ case RTL_TEXTENCODING_MS_949 :
+ case RTL_TEXTENCODING_EUC_KR :
+ case RTL_TEXTENCODING_ISO_2022_KR :
+ case RTL_TEXTENCODING_MS_1361 :
+ aLanguages[0] = LANGUAGE_KOREAN;
+ break;
+
+ case RTL_TEXTENCODING_APPLE_THAI :
+ case RTL_TEXTENCODING_MS_874 :
+ case RTL_TEXTENCODING_TIS_620 :
+ aLanguages[0] = LANGUAGE_THAI;
+ break;
+// case RTL_TEXTENCODING_SYMBOL :
+// case RTL_TEXTENCODING_DONTKNOW: :
+ default: aLanguages[0] = Application::GetSettings().GetUILanguage();
+ }
+ return aLanguages[0] != LANGUAGE_SYSTEM;
+}
+void SwSrcEditWindow::SetFont()
+{
+ String sFontName = pSourceViewConfig->GetFontName();
+ if(!sFontName.Len())
+ {
+ LanguageType aLanguages[5] =
+ {
+ LANGUAGE_SYSTEM, LANGUAGE_SYSTEM, LANGUAGE_SYSTEM, LANGUAGE_SYSTEM, LANGUAGE_SYSTEM
+ };
+ Font aFont;
+ if(lcl_GetLanguagesForEncoding(eSourceEncoding, aLanguages))
+ {
+ //TODO: check for multiple languages
+ aFont = OutputDevice::GetDefaultFont(DEFAULTFONT_FIXED, aLanguages[0], 0, this);
+ }
+ else
+ aFont = OutputDevice::GetDefaultFont(DEFAULTFONT_SANS_UNICODE,
+ Application::GetSettings().GetLanguage(), 0, this);
+ sFontName = aFont.GetName();
+ }
+ const SvxFontListItem* pFontListItem =
+ (const SvxFontListItem* )pSrcView->GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST );
+ const FontList* pList = pFontListItem->GetFontList();
+ FontInfo aInfo = pList->Get(sFontName,WEIGHT_NORMAL, ITALIC_NONE);
+
+ const Font& rFont = GetTextEngine()->GetFont();
+ Font aFont(aInfo);
+ Size aSize(rFont.GetSize());
+ //font height is stored in point and set in twip
+ aSize.Height() = pSourceViewConfig->GetFontHeight() * 20;
+ aFont.SetSize(pOutWin->LogicToPixel(aSize, MAP_TWIP));
+ GetTextEngine()->SetFont( aFont );
+ pOutWin->SetFont(aFont);
+}
+/* -----------------------------29.08.2002 13:47------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwSrcEditWindow::SetTextEncoding(rtl_TextEncoding eEncoding)
+{
+ eSourceEncoding = eEncoding;
+ SetFont();
+}
+
diff --git a/sw/source/ui/envelp/envelp.src b/sw/source/ui/envelp/envelp.src
new file mode 100644
index 000000000000..0381ad81d249
--- /dev/null
+++ b/sw/source/ui/envelp/envelp.src
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // #pragma ******************************************************************
+
+ // #include *****************************************************************
+#include "envelp.hrc"
+#include "globals.hrc"
+ // Strings ******************************************************************
+String STR_DATABASE_NOT_OPENED
+{
+ Text [ en-US ] = "Database could not be opened." ;
+};
+String STR_NO_DRIVERS
+{
+ Text [ en-US ] = "No database drivers installed." ;
+};
+String STR_BTN_NEW_DOC
+{
+ Text [ en-US ] = "~New Document" ;
+};
+
+String STR_BTN_NEWDOC
+{
+ Text [ en-US ] = "~New Doc.";
+};
+
+String STR_SENDER_TOKENS
+{
+ Text [ en-US ] = "COMPANY;CR;FIRSTNAME; ;LASTNAME;CR;ADDRESS;CR;CITY; ;STATEPROV; ;POSTALCODE;CR;COUNTRY;CR;";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
new file mode 100644
index 000000000000..cfb5ad8f4afd
--- /dev/null
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -0,0 +1,635 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+
+#include <hintids.hxx>
+
+#include <tools/pstm.hxx>
+
+#define _SVSTDARR_LONGSSORT
+#define _SVSTDARR_LONGS
+#include <svl/svstdarr.hxx>
+#include <editeng/paperinf.hxx>
+#ifndef _SVX_TSTPITEM_HXX //autogen
+#include <editeng/tstpitem.hxx>
+#endif
+#include <editeng/lrspitem.hxx>
+#include <editeng/brshitem.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#ifndef _MENU_HXX //autogen
+#include <vcl/menu.hxx>
+#endif
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <frmatr.hxx>
+#include <swtypes.hxx>
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#ifndef _BASESH_HXX
+#include <basesh.hxx>
+#endif
+#include <drpcps.hxx>
+#include <envfmt.hxx>
+#include <fmtcol.hxx>
+#ifndef _PARDLG_HXX
+#include "swuipardlg.hxx"
+#endif
+#include <pattern.hxx>
+#include <poolfmt.hxx>
+#include <uiborder.hxx>
+#include <uitool.hxx>
+
+#ifndef _ENVFMT_HRC
+#include <envfmt.hrc>
+#endif
+
+#include "swabstdlg.hxx"
+#include "chrdlg.hrc"
+
+namespace swui
+{
+ SwAbstractDialogFactory * GetFactory();
+}
+
+static PopupMenu *pMenu;
+static long lUserW = 5669; // 10 cm
+static long lUserH = 5669; // 10 cm
+
+// --------------------------------------------------------------------------
+
+
+SwEnvFmtPage::SwEnvFmtPage(Window* pParent, const SfxItemSet& rSet) :
+
+ SfxTabPage(pParent, SW_RES(TP_ENV_FMT), rSet),
+
+ aAddrFL (this, SW_RES( FL_ADDRESSEE )),
+ aAddrPosInfo (this, SW_RES( TXT_ADDR_POS )),
+ aAddrLeftText (this, SW_RES( TXT_ADDR_LEFT )),
+ aAddrLeftField (this, SW_RES( FLD_ADDR_LEFT )),
+ aAddrTopText (this, SW_RES( TXT_ADDR_TOP )),
+ aAddrTopField (this, SW_RES( FLD_ADDR_TOP )),
+ aAddrFormatInfo (this, SW_RES( TXT_ADDR_FORMAT )),
+ aAddrEditButton (this, SW_RES( BTN_ADDR_EDIT )),
+ aSendFL (this, SW_RES( FL_SENDER )),
+ aSendPosInfo (this, SW_RES( TXT_SEND_POS )),
+ aSendLeftText (this, SW_RES( TXT_SEND_LEFT )),
+ aSendLeftField (this, SW_RES( FLD_SEND_LEFT )),
+ aSendTopText (this, SW_RES( TXT_SEND_TOP )),
+ aSendTopField (this, SW_RES( FLD_SEND_TOP )),
+ aSendFormatInfo (this, SW_RES( TXT_SEND_FORMAT )),
+ aSendEditButton (this, SW_RES( BTN_SEND_EDIT )),
+ aSizeFL (this, SW_RES( FL_SIZE )),
+ aSizeFormatText (this, SW_RES( TXT_SIZE_FORMAT )),
+ aSizeFormatBox (this, SW_RES( BOX_SIZE_FORMAT )),
+ aSizeWidthText (this, SW_RES( TXT_SIZE_WIDTH )),
+ aSizeWidthField (this, SW_RES( FLD_SIZE_WIDTH )),
+ aSizeHeightText (this, SW_RES( TXT_SIZE_HEIGHT )),
+ aSizeHeightField (this, SW_RES( FLD_SIZE_HEIGHT )),
+ aPreview (this, SW_RES( WIN_PREVIEW ))
+
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ // Metriken
+ FieldUnit aMetric = ::GetDfltMetric(FALSE);
+ SetMetric(aAddrLeftField, aMetric);
+ SetMetric(aAddrTopField, aMetric);
+ SetMetric(aSendLeftField, aMetric);
+ SetMetric(aSendTopField, aMetric);
+ SetMetric(aSizeWidthField, aMetric);
+ SetMetric(aSizeHeightField, aMetric);
+
+ // Menues einhaengen
+ ::pMenu = new PopupMenu(SW_RES(MNU_EDIT));
+ aAddrEditButton.SetPopupMenu(::pMenu);
+ aSendEditButton.SetPopupMenu(::pMenu);
+
+ // Handler installieren
+ Link aLk = LINK(this, SwEnvFmtPage, ModifyHdl);
+ aAddrLeftField .SetUpHdl( aLk );
+ aAddrTopField .SetUpHdl( aLk );
+ aSendLeftField .SetUpHdl( aLk );
+ aSendTopField .SetUpHdl( aLk );
+ aSizeWidthField .SetUpHdl( aLk );
+ aSizeHeightField.SetUpHdl( aLk );
+
+ aAddrLeftField .SetDownHdl( aLk );
+ aAddrTopField .SetDownHdl( aLk );
+ aSendLeftField .SetDownHdl( aLk );
+ aSendTopField .SetDownHdl( aLk );
+ aSizeWidthField .SetDownHdl( aLk );
+ aSizeHeightField.SetDownHdl( aLk );
+
+ aAddrLeftField .SetLoseFocusHdl( aLk );
+ aAddrTopField .SetLoseFocusHdl( aLk );
+ aSendLeftField .SetLoseFocusHdl( aLk );
+ aSendTopField .SetLoseFocusHdl( aLk );
+ aSizeWidthField .SetLoseFocusHdl( aLk );
+ aSizeHeightField.SetLoseFocusHdl( aLk );
+
+ aLk = LINK(this, SwEnvFmtPage, EditHdl );
+ aAddrEditButton.SetSelectHdl( aLk );
+ aSendEditButton.SetSelectHdl( aLk );
+
+ aPreview.SetBorderStyle( WINDOW_BORDER_MONO );
+
+ aSizeFormatBox .SetSelectHdl(LINK(this, SwEnvFmtPage, FormatHdl));
+
+ // aSizeFormatBox
+ for (USHORT i = PAPER_A3; i <= PAPER_KAI32BIG; i++)
+ {
+ if (i != PAPER_USER)
+ {
+ String aPaperName = SvxPaperInfo::GetName((Paper) i),
+ aEntryName;
+
+ USHORT nPos = 0;
+ BOOL bFound = FALSE;
+ while (nPos < aSizeFormatBox.GetEntryCount() && !bFound)
+ {
+ aEntryName = aSizeFormatBox.GetEntry(i);
+ if (aEntryName < aPaperName)
+ nPos++;
+ else
+ bFound = TRUE;
+ }
+ aSizeFormatBox.InsertEntry(aPaperName, nPos);
+ aIDs.Insert((USHORT) i, nPos);
+ }
+ }
+ aSizeFormatBox.InsertEntry(SvxPaperInfo::GetName(PAPER_USER));
+ aIDs.Insert((USHORT) PAPER_USER, aIDs.Count());
+
+}
+
+// --------------------------------------------------------------------------
+
+
+__EXPORT SwEnvFmtPage::~SwEnvFmtPage()
+{
+ aAddrEditButton.SetPopupMenu(0);
+ aSendEditButton.SetPopupMenu(0);
+ delete ::pMenu;
+}
+
+// --------------------------------------------------------------------------
+
+
+IMPL_LINK_INLINE_START( SwEnvFmtPage, ModifyHdl, Edit *, pEdit )
+{
+ long lWVal = static_cast< long >(GetFldVal(aSizeWidthField ));
+ long lHVal = static_cast< long >(GetFldVal(aSizeHeightField));
+
+ long lWidth = Max(lWVal, lHVal);
+ long lHeight = Min(lWVal, lHVal);
+
+ if (pEdit == &aSizeWidthField || pEdit == &aSizeHeightField)
+ {
+ Paper ePaper = SvxPaperInfo::GetSvxPaper(
+ Size(lHeight, lWidth), MAP_TWIP, TRUE);
+ for (USHORT i = 0; i < aIDs.Count(); i++)
+ if (aIDs[i] == (USHORT)ePaper)
+ aSizeFormatBox.SelectEntryPos(i);
+
+ // Benutzergroesse merken
+ if (aIDs[aSizeFormatBox.GetSelectEntryPos()] == (USHORT)PAPER_USER)
+ {
+ lUserW = lWidth ;
+ lUserH = lHeight;
+ }
+
+ aSizeFormatBox.GetSelectHdl().Call(&aSizeFormatBox);
+ }
+ else
+ {
+ FillItem(GetParent()->aEnvItem);
+ SetMinMax();
+ aPreview.Invalidate();
+ }
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwEnvFmtPage, ModifyHdl, Edit *, pEdit )
+
+// --------------------------------------------------------------------------
+
+
+IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton )
+{
+ SwWrtShell* pSh = GetParent()->pSh;
+ ASSERT(pSh, "Shell fehlt");
+
+ // Collection-Ptr ermitteln
+ BOOL bSender = pButton != &aAddrEditButton;
+
+ SwTxtFmtColl* pColl = pSh->GetTxtCollFromPool( static_cast< USHORT >(
+ bSender ? RES_POOLCOLL_SENDADRESS : RES_POOLCOLL_JAKETADRESS));
+ ASSERT(pColl, "Text-Collection fehlt");
+
+ switch (pButton->GetCurItemId())
+ {
+ case MID_CHAR:
+ {
+ SfxItemSet *pCollSet = GetCollItemSet(pColl, bSender);
+
+ // Damit die Hintergrundfarbe nicht uebergebuegelt wird:
+ SfxAllItemSet aTmpSet(*pCollSet);
+
+ // Das CHRATR_BACKGROUND-Attribut wird fuer den Dialog in
+ // ein RES_BACKGROUND verwandelt und wieder zurueck ...
+ const SfxPoolItem *pTmpBrush;
+
+ if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_CHRATR_BACKGROUND,
+ TRUE, &pTmpBrush ) )
+ {
+ SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
+ aTmpBrush.SetWhich( RES_BACKGROUND );
+ aTmpSet.Put( aTmpBrush );
+ }
+ else
+ aTmpSet.ClearItem( RES_BACKGROUND );
+
+ SwAbstractDialogFactory* pFact = swui::GetFactory();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( GetParent(), pSh->GetView(), aTmpSet, DLG_CHAR ,&pColl->GetName() );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if (pDlg->Execute() == RET_OK)
+ {
+ SfxItemSet aOutputSet( *pDlg->GetOutputItemSet() );
+ if( SFX_ITEM_SET == aOutputSet.GetItemState( RES_BACKGROUND,
+ FALSE, &pTmpBrush ) )
+ {
+ SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
+ aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
+ pCollSet->Put( aTmpBrush );
+ }
+ aOutputSet.ClearItem( RES_BACKGROUND );
+ //pColl->SetAttr( aTmpSet );
+ pCollSet->Put(aOutputSet);
+ }
+ delete pDlg;
+ }
+ break;
+
+ case MID_PARA:
+ {
+ SfxItemSet *pCollSet = GetCollItemSet(pColl, bSender);
+
+ // Damit die Tabulatoren nicht uebergebuegelt werden:
+ SfxAllItemSet aTmpSet(*pCollSet);
+
+ // Tabulatoren, DefaultTabs ins ItemSet Stecken
+ const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&)
+ pSh->GetView().GetCurShell()->GetPool().GetDefaultItem(RES_PARATR_TABSTOP);
+
+ USHORT nDefDist = ::GetTabDist( rDefTabs );
+ SfxUInt16Item aDefDistItem( SID_ATTR_TABSTOP_DEFAULTS, nDefDist );
+ aTmpSet.Put( aDefDistItem );
+
+ // Aktueller Tab
+ SfxUInt16Item aTabPos( SID_ATTR_TABSTOP_POS, 0 );
+ aTmpSet.Put( aTabPos );
+
+ // linker Rand als Offset
+ const long nOff = ((SvxLRSpaceItem&)aTmpSet.Get( RES_LR_SPACE )).
+ GetTxtLeft();
+ SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
+ aTmpSet.Put( aOff );
+
+ // BoxInfo setzen
+ ::PrepareBoxInfo( aTmpSet, *pSh );
+
+ SwParaDlg *pDlg = new SwParaDlg(GetParent(), pSh->GetView(), aTmpSet, DLG_ENVELOP, &pColl->GetName());
+
+ if ( pDlg->Execute() == RET_OK )
+ {
+ // Defaults evtl umsetzen
+ const SfxPoolItem* pItem = 0;
+ SfxItemSet* pOutputSet = (SfxItemSet*)pDlg->GetOutputItemSet();
+ USHORT nNewDist;
+ if( SFX_ITEM_SET == pOutputSet->GetItemState( SID_ATTR_TABSTOP_DEFAULTS,
+ FALSE, &pItem ) &&
+ nDefDist != (nNewDist = ((SfxUInt16Item*)pItem)->GetValue()) )
+ {
+ SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
+ MakeDefTabs( nNewDist, aDefTabs );
+ pSh->SetDefault( aDefTabs );
+ pOutputSet->ClearItem( SID_ATTR_TABSTOP_DEFAULTS );
+ }
+ if( pOutputSet->Count() )
+ {
+ //pColl->SetAttr( *pOutputSet );
+ pCollSet->Put(*pOutputSet);
+ }
+ }
+ delete pDlg;
+ }
+ break;
+ }
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Ein temporaeres Itemset, das bei Abbruch verworfen wird
+------------------------------------------------------------------------*/
+
+SfxItemSet *SwEnvFmtPage::GetCollItemSet(SwTxtFmtColl* pColl, BOOL bSender)
+{
+ SfxItemSet *&pAddrSet = bSender ? GetParent()->pSenderSet : GetParent()->pAddresseeSet;
+
+ if (!pAddrSet)
+ {
+ // Range ermitteln (Ranges beider Itemsets mergen)
+ const USHORT *pRanges = pColl->GetAttrSet().GetRanges();
+
+ static USHORT __READONLY_DATA aRanges[] =
+ {
+ RES_PARATR_BEGIN, RES_PARATR_ADJUST,
+ RES_PARATR_TABSTOP, RES_PARATR_END-1,
+ RES_LR_SPACE, RES_UL_SPACE,
+ RES_BACKGROUND, RES_SHADOW,
+ SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS,
+ SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS,
+ SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ 0, 0
+ };
+
+ // BruteForce-Merge, weil MergeRange in SvTools buggy ist:
+ USHORT i = 0;
+ SvLongsSort aMergedRanges( 0, 10 );
+
+ while (pRanges[i])
+ {
+ for (USHORT nPos = pRanges[i]; nPos <= pRanges[i+1]; nPos++)
+ aMergedRanges.Insert(nPos);
+ i += 2;
+ }
+
+ i = 0;
+
+ while (aRanges[i])
+ {
+ for (USHORT nPos = aRanges[i]; nPos <= aRanges[i+1]; nPos++)
+ aMergedRanges.Insert(nPos);
+ i += 2;
+ }
+
+ // Ranges kompaktieren
+ SvLongs aCompactedRanges( 0, 10 );
+
+ aCompactedRanges.Insert(aMergedRanges[0], aCompactedRanges.Count());
+
+ for (i = 0; i < aMergedRanges.Count(); i++)
+ {
+ while (i + 1 < aMergedRanges.Count() &&
+ aMergedRanges[i+1] - aMergedRanges[i] == 1)
+ {
+ i++;
+ }
+ long nEnd = aMergedRanges[i];
+ aCompactedRanges.Insert(nEnd, aCompactedRanges.Count());
+
+ if (i + 1 < aMergedRanges.Count())
+ {
+ long nStart = aMergedRanges[i+1];
+ aCompactedRanges.Insert(nStart, aCompactedRanges.Count());
+ }
+ }
+
+ // Neue Ranges erzeugen
+ USHORT *pNewRanges = new USHORT[aCompactedRanges.Count() + 1];
+ for (i = 0; i < aCompactedRanges.Count(); i++)
+ pNewRanges[i] = (USHORT)aCompactedRanges[i];
+
+ pNewRanges[i] = 0;
+
+ pAddrSet = new SfxItemSet(GetParent()->pSh->GetView().GetCurShell()->GetPool(),
+ pNewRanges);
+
+ pAddrSet->Put(pColl->GetAttrSet());
+ delete[] pNewRanges;
+ }
+
+ return pAddrSet;
+}
+
+// --------------------------------------------------------------------------
+
+
+IMPL_LINK( SwEnvFmtPage, FormatHdl, ListBox *, EMPTYARG )
+{
+ long lWidth;
+ long lHeight;
+ long lSendFromLeft;
+ long lSendFromTop;
+ long lAddrFromLeft;
+ long lAddrFromTop;
+
+ USHORT nPaper = aIDs[aSizeFormatBox.GetSelectEntryPos()];
+ if (nPaper != (USHORT)PAPER_USER)
+ {
+ Size aSz = SvxPaperInfo::GetPaperSize((Paper)nPaper);
+ lWidth = Max(aSz.Width(), aSz.Height());
+ lHeight = Min(aSz.Width(), aSz.Height());
+ }
+ else
+ {
+ lWidth = lUserW;
+ lHeight = lUserH;
+ }
+
+ lSendFromLeft = 566; // 1cm
+ lSendFromTop = 566; // 1cm
+ lAddrFromLeft = lWidth / 2;
+ lAddrFromTop = lHeight / 2;
+
+ SetFldVal(aAddrLeftField, lAddrFromLeft);
+ SetFldVal(aAddrTopField , lAddrFromTop );
+ SetFldVal(aSendLeftField, lSendFromLeft);
+ SetFldVal(aSendTopField , lSendFromTop );
+
+ SetFldVal(aSizeWidthField , lWidth );
+ SetFldVal(aSizeHeightField, lHeight);
+
+ SetMinMax();
+
+ FillItem(GetParent()->aEnvItem);
+ aPreview.Invalidate();
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+
+
+void SwEnvFmtPage::SetMinMax()
+{
+ long lWVal = static_cast< long >(GetFldVal(aSizeWidthField ));
+ long lHVal = static_cast< long >(GetFldVal(aSizeHeightField));
+
+ long lWidth = Max(lWVal, lHVal),
+ lHeight = Min(lWVal, lHVal);
+
+ // Min und Max
+ aAddrLeftField.SetMin((long) 100 * (GetFldVal(aSendLeftField) + 566), FUNIT_TWIP);
+ aAddrLeftField.SetMax((long) 100 * (lWidth - 2 * 566), FUNIT_TWIP);
+ aAddrTopField .SetMin((long) 100 * (GetFldVal(aSendTopField ) + 2 * 566), FUNIT_TWIP);
+ aAddrTopField .SetMax((long) 100 * (lHeight - 2 * 566), FUNIT_TWIP);
+ aSendLeftField.SetMin((long) 100 * (566), FUNIT_TWIP);
+ aSendLeftField.SetMax((long) 100 * (GetFldVal(aAddrLeftField) - 566), FUNIT_TWIP);
+ aSendTopField .SetMin((long) 100 * (566), FUNIT_TWIP);
+ aSendTopField .SetMax((long) 100 * (GetFldVal(aAddrTopField ) - 2 * 566), FUNIT_TWIP);
+
+ // First und Last
+ aAddrLeftField.SetFirst(aAddrLeftField.GetMin());
+ aAddrLeftField.SetLast (aAddrLeftField.GetMax());
+ aAddrTopField .SetFirst(aAddrTopField .GetMin());
+ aAddrTopField .SetLast (aAddrTopField .GetMax());
+ aSendLeftField.SetFirst(aSendLeftField.GetMin());
+ aSendLeftField.SetLast (aSendLeftField.GetMax());
+ aSendTopField .SetFirst(aSendTopField .GetMin());
+ aSendTopField .SetLast (aSendTopField .GetMax());
+
+ // Fields neu formatieren
+ aAddrLeftField .Reformat();
+ aAddrTopField .Reformat();
+ aSendLeftField .Reformat();
+ aSendTopField .Reformat();
+ aSizeWidthField .Reformat();
+ aSizeHeightField.Reformat();
+}
+
+// --------------------------------------------------------------------------
+
+
+SfxTabPage* __EXPORT SwEnvFmtPage::Create(Window* pParent, const SfxItemSet& rSet)
+{
+ return new SwEnvFmtPage(pParent, rSet);
+}
+
+// ----------------------------------------------------------------------------
+
+
+void __EXPORT SwEnvFmtPage::ActivatePage(const SfxItemSet& rSet)
+{
+ SfxItemSet aSet(rSet);
+ aSet.Put(GetParent()->aEnvItem);
+ Reset(aSet);
+}
+
+// ----------------------------------------------------------------------------
+
+
+int __EXPORT SwEnvFmtPage::DeactivatePage(SfxItemSet* _pSet)
+{
+ if( _pSet )
+ FillItemSet(*_pSet);
+ return SfxTabPage::LEAVE_PAGE;
+}
+
+// --------------------------------------------------------------------------
+
+
+void SwEnvFmtPage::FillItem(SwEnvItem& rItem)
+{
+ rItem.lAddrFromLeft = static_cast< sal_Int32 >(GetFldVal(aAddrLeftField));
+ rItem.lAddrFromTop = static_cast< sal_Int32 >(GetFldVal(aAddrTopField ));
+ rItem.lSendFromLeft = static_cast< sal_Int32 >(GetFldVal(aSendLeftField));
+ rItem.lSendFromTop = static_cast< sal_Int32 >(GetFldVal(aSendTopField ));
+
+ USHORT nPaper = aIDs[aSizeFormatBox.GetSelectEntryPos()];
+ if (nPaper == (USHORT)PAPER_USER)
+ {
+ long lWVal = static_cast< long >(GetFldVal(aSizeWidthField ));
+ long lHVal = static_cast< long >(GetFldVal(aSizeHeightField));
+ rItem.lWidth = Max(lWVal, lHVal);
+ rItem.lHeight = Min(lWVal, lHVal);
+ }
+ else
+ {
+ long lWVal = SvxPaperInfo::GetPaperSize((Paper)nPaper).Width ();
+ long lHVal = SvxPaperInfo::GetPaperSize((Paper)nPaper).Height();
+ rItem.lWidth = Max(lWVal, lHVal);
+ rItem.lHeight = Min(lWVal, lHVal);
+ }
+}
+
+// --------------------------------------------------------------------------
+
+
+BOOL __EXPORT SwEnvFmtPage::FillItemSet(SfxItemSet& rSet)
+{
+ FillItem(GetParent()->aEnvItem);
+ rSet.Put(GetParent()->aEnvItem);
+ return TRUE;
+}
+
+// --------------------------------------------------------------------------
+
+
+void __EXPORT SwEnvFmtPage::Reset(const SfxItemSet& rSet)
+{
+ const SwEnvItem& rItem = (const SwEnvItem&) rSet.Get(FN_ENVELOP);
+
+ Paper ePaper = SvxPaperInfo::GetSvxPaper(
+ Size( Min(rItem.lWidth, rItem.lHeight),
+ Max(rItem.lWidth, rItem.lHeight)), MAP_TWIP, TRUE);
+ for (USHORT i = 0; i < (USHORT) aIDs.Count(); i++)
+ if (aIDs[i] == (USHORT)ePaper)
+ aSizeFormatBox.SelectEntryPos(i);
+
+ // Die MetricFields
+ SetFldVal(aAddrLeftField, rItem.lAddrFromLeft);
+ SetFldVal(aAddrTopField , rItem.lAddrFromTop );
+ SetFldVal(aSendLeftField, rItem.lSendFromLeft);
+ SetFldVal(aSendTopField , rItem.lSendFromTop );
+ SetFldVal(aSizeWidthField , Max(rItem.lWidth, rItem.lHeight));
+ SetFldVal(aSizeHeightField , Min(rItem.lWidth, rItem.lHeight));
+ SetMinMax();
+
+ DELETEZ(GetParent()->pSenderSet);
+ DELETEZ(GetParent()->pAddresseeSet);
+}
+
+
+
diff --git a/sw/source/ui/envelp/envfmt.hrc b/sw/source/ui/envelp/envfmt.hrc
new file mode 100644
index 000000000000..fb15678cacee
--- /dev/null
+++ b/sw/source/ui/envelp/envfmt.hrc
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ENVFMT_HRC
+#define _ENVFMT_HRC
+
+// #include *****************************************************************
+
+#include "envelp.hrc"
+
+// Lokale Resourcen *********************************************************
+
+#define FL_ADDRESSEE 11
+#define TXT_ADDR_POS 12
+#define TXT_ADDR_LEFT 13
+#define FLD_ADDR_LEFT 14
+#define TXT_ADDR_TOP 15
+#define FLD_ADDR_TOP 16
+#define TXT_ADDR_FORMAT 17
+#define BTN_ADDR_EDIT 18
+
+#define FL_SENDER 21
+#define TXT_SEND_POS 22
+#define TXT_SEND_LEFT 23
+#define FLD_SEND_LEFT 24
+#define TXT_SEND_TOP 25
+#define FLD_SEND_TOP 26
+#define TXT_SEND_FORMAT 27
+#define BTN_SEND_EDIT 28
+
+#define FL_SIZE 31
+#define TXT_SIZE_FORMAT 32
+#define BOX_SIZE_FORMAT 33
+#define TXT_SIZE_WIDTH 34
+#define FLD_SIZE_WIDTH 35
+#define TXT_SIZE_HEIGHT 36
+#define FLD_SIZE_HEIGHT 37
+
+#define WIN_PREVIEW 41
+
+
+#define MID_CHAR 1
+#define MID_PARA 2
+
+// Globale Resourcen ********************************************************
+
+#define MNU_EDIT (RC_ENVFMT_BEGIN )
+
+// Ueberlaufpruefung ********************************************************
+
+#define ENVFMT_ACT_END MNU_EDIT
+
+#if ENVFMT_ACT_END > RC_ENVFMT_END
+#error Resource-Ueberlauf in #file, #line
+#endif
+
+#endif
+
diff --git a/sw/source/ui/envelp/envfmt.hxx b/sw/source/ui/envelp/envfmt.hxx
new file mode 100644
index 000000000000..f8508bb7e69a
--- /dev/null
+++ b/sw/source/ui/envelp/envfmt.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ENVFMT_HXX
+#define _ENVFMT_HXX
+
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#ifndef _MENUBTN_HXX //autogen
+#include <vcl/menubtn.hxx>
+#endif
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+
+#include "envlop.hxx"
+
+class SwTxtFmtColl;
+
+// class SwEnvFmtPage ---------------------------------------------------------
+
+class SwEnvFmtPage : public SfxTabPage
+{
+
+ FixedLine aAddrFL;
+ FixedInfo aAddrPosInfo;
+ FixedText aAddrLeftText;
+ MetricField aAddrLeftField;
+ FixedText aAddrTopText;
+ MetricField aAddrTopField;
+ FixedInfo aAddrFormatInfo;
+ MenuButton aAddrEditButton;
+ FixedLine aSendFL;
+ FixedInfo aSendPosInfo;
+ FixedText aSendLeftText;
+ MetricField aSendLeftField;
+ FixedText aSendTopText;
+ MetricField aSendTopField;
+ FixedInfo aSendFormatInfo;
+ MenuButton aSendEditButton;
+ FixedLine aSizeFL;
+ FixedText aSizeFormatText;
+ ListBox aSizeFormatBox;
+ FixedText aSizeWidthText;
+ MetricField aSizeWidthField;
+ FixedText aSizeHeightText;
+ MetricField aSizeHeightField;
+ SwEnvPreview aPreview;
+
+ SvUShorts aIDs;
+
+ SwEnvFmtPage(Window* pParent, const SfxItemSet& rSet);
+ ~SwEnvFmtPage();
+
+ DECL_LINK( ModifyHdl, Edit * );
+ DECL_LINK( EditHdl, MenuButton * );
+ DECL_LINK( FormatHdl, ListBox * );
+
+ void SetMinMax();
+
+ SfxItemSet *GetCollItemSet(SwTxtFmtColl* pColl, BOOL bSender);
+
+ using Window::GetParent;
+ SwEnvDlg *GetParent() {return (SwEnvDlg*) SfxTabPage::GetParent()->GetParent();}
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+public:
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet* pSet = 0);
+ void FillItem(SwEnvItem& rItem);
+ virtual BOOL FillItemSet(SfxItemSet& rSet);
+ virtual void Reset(const SfxItemSet& rSet);
+};
+
+#endif
+
+
diff --git a/sw/source/ui/envelp/envfmt.src b/sw/source/ui/envelp/envfmt.src
new file mode 100644
index 000000000000..5ad5a4b9d6a4
--- /dev/null
+++ b/sw/source/ui/envelp/envfmt.src
@@ -0,0 +1,324 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // #pragma ******************************************************************
+
+ // #include *****************************************************************
+#include "envfmt.hrc"
+#include "helpid.h"
+ // TP_ENV_FMT ---------------------------------------------------------------
+TabPage TP_ENV_FMT
+{
+ HelpID = HID_ENV_FMT ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_ADDRESSEE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Addressee" ;
+ };
+ FixedText TXT_ADDR_POS
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Position";
+ };
+ FixedText TXT_ADDR_LEFT
+ {
+ Pos = MAP_APPFONT ( 18 , 27 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "from left" ;
+ };
+ MetricField FLD_ADDR_LEFT
+ {
+ HelpID = "sw:MetricField:TP_ENV_FMT:FLD_ADDR_LEFT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 25 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Minimum = 0 ;
+ Maximum = 10000 ;
+ First = 0 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ Repeat = TRUE ;
+ };
+ FixedText TXT_ADDR_TOP
+ {
+ Pos = MAP_APPFONT ( 18 , 43 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "from top" ;
+ };
+ MetricField FLD_ADDR_TOP
+ {
+ HelpID = "sw:MetricField:TP_ENV_FMT:FLD_ADDR_TOP";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 41 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Minimum = 0 ;
+ Maximum = 10000 ;
+ First = 0 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ Repeat = TRUE ;
+ };
+ FixedText TXT_ADDR_FORMAT
+ {
+ Pos = MAP_APPFONT ( 149 , 27 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Format";
+ };
+ MenuButton BTN_ADDR_EDIT
+ {
+ HelpID = "sw:MenuButton:TP_ENV_FMT:BTN_ADDR_EDIT";
+ Pos = MAP_APPFONT ( 194 , 24 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Edit" ;
+ };
+ FixedLine FL_SENDER
+ {
+ Pos = MAP_APPFONT ( 6 , 56 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Sender" ;
+ };
+ FixedText TXT_SEND_POS
+ {
+ Pos = MAP_APPFONT ( 12 , 67 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Position";
+ };
+ FixedText TXT_SEND_LEFT
+ {
+ Pos = MAP_APPFONT ( 18 , 80 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "from left" ;
+ };
+ MetricField FLD_SEND_LEFT
+ {
+ HelpID = "sw:MetricField:TP_ENV_FMT:FLD_SEND_LEFT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 78 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Minimum = 0 ;
+ Maximum = 10000 ;
+ First = 0 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ Repeat = TRUE ;
+ };
+ FixedText TXT_SEND_TOP
+ {
+ Pos = MAP_APPFONT ( 18 , 96 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "from top" ;
+ };
+ MetricField FLD_SEND_TOP
+ {
+ HelpID = "sw:MetricField:TP_ENV_FMT:FLD_SEND_TOP";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 94 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Minimum = 0 ;
+ Maximum = 10000 ;
+ First = 0 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ Repeat = TRUE ;
+ };
+ FixedText TXT_SEND_FORMAT
+ {
+ Pos = MAP_APPFONT ( 149 , 80 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Format";
+ };
+ MenuButton BTN_SEND_EDIT
+ {
+ HelpID = "sw:MenuButton:TP_ENV_FMT:BTN_SEND_EDIT";
+ Pos = MAP_APPFONT ( 194 , 77 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Edit" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SIZE
+ {
+ Pos = MAP_APPFONT ( 6 , 109 ) ;
+ Size = MAP_APPFONT ( 148 , 8 ) ;
+ Text [ en-US ] = "Size" ;
+ };
+ FixedText TXT_SIZE_FORMAT
+ {
+ Pos = MAP_APPFONT ( 12 , 122 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "F~ormat" ;
+ Left = TRUE ;
+ };
+ ListBox BOX_SIZE_FORMAT
+ {
+ HelpID = "sw:ListBox:TP_ENV_FMT:BOX_SIZE_FORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 120 ) ;
+ Size = MAP_APPFONT ( 40 , 72 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText TXT_SIZE_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 138 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "~Width" ;
+ Left = TRUE ;
+ };
+ MetricField FLD_SIZE_WIDTH
+ {
+ HelpID = "sw:MetricField:TP_ENV_FMT:FLD_SIZE_WIDTH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 136 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Minimum = 500 ;
+ Maximum = 10000 ;
+ First = 500 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ Repeat = TRUE ;
+ };
+ FixedText TXT_SIZE_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 154 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Height" ;
+ };
+ MetricField FLD_SIZE_HEIGHT
+ {
+ HelpID = "sw:MetricField:TP_ENV_FMT:FLD_SIZE_HEIGHT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 152 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Minimum = 500 ;
+ Maximum = 10000 ;
+ First = 500 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ Repeat = TRUE ;
+ };
+ Window WIN_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 160 , 116 ) ;
+ Size = MAP_APPFONT ( 84 , 63 ) ;
+ };
+};
+ // Menu *********************************************************************
+Menu MNU_EDIT
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ IDENTIFIER = MID_CHAR ;
+ Text [ en-US ] = "C~haracter..." ;
+ };
+ MenuItem
+ {
+ IDENTIFIER = MID_PARA ;
+ Text [ en-US ] = "P~aragraph..." ;
+ };
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/envelp/envimg.cxx b/sw/source/ui/envelp/envimg.cxx
new file mode 100644
index 000000000000..436f4bd27df6
--- /dev/null
+++ b/sw/source/ui/envelp/envimg.cxx
@@ -0,0 +1,381 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <tools/stream.hxx>
+#include <tools/resid.hxx>
+#include <sfx2/app.hxx>
+#include <editeng/paperinf.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <unotools/useroptions.hxx>
+#include <tools/shl.hxx>
+#include <swmodule.hxx>
+#include <errhdl.hxx>
+#include <swtypes.hxx>
+#include <envimg.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _ENVELP_HRC
+#include <envelp.hrc>
+#endif
+
+#include <unomid.h>
+
+#ifdef WNT
+#define NEXTLINE UniString::CreateFromAscii("\r\n")
+#else
+#define NEXTLINE '\n'
+#endif
+
+using namespace utl;
+using namespace rtl;
+using namespace ::com::sun::star::uno;
+
+
+TYPEINIT1_AUTOFACTORY( SwEnvItem, SfxPoolItem );
+
+// --------------------------------------------------------------------------
+SW_DLLPUBLIC String MakeSender()
+{
+ SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions();
+
+ String sRet;
+ String sSenderToken(SW_RES(STR_SENDER_TOKENS));
+ xub_StrLen nSttPos = 0, nTokenCount = sSenderToken.GetTokenCount(';');
+ BOOL bLastLength = TRUE;
+ for( xub_StrLen i = 0; i < nTokenCount; i++ )
+ {
+ String sToken = sSenderToken.GetToken( 0, ';', nSttPos );
+ if(sToken.EqualsAscii("COMPANY"))
+ {
+ xub_StrLen nOldLen = sRet.Len();
+ sRet += (String)rUserOpt.GetCompany();
+ bLastLength = sRet.Len() != nOldLen;
+ }
+ else if(sToken.EqualsAscii("CR"))
+ {
+ if(bLastLength)
+ sRet +=NEXTLINE;
+ bLastLength = TRUE;
+ }
+ else if(sToken.EqualsAscii("FIRSTNAME"))
+ sRet += (String)rUserOpt.GetFirstName();
+ else if(sToken.EqualsAscii("LASTNAME"))
+ sRet += (String)rUserOpt.GetLastName();
+ else if(sToken.EqualsAscii("ADDRESS"))
+ sRet += (String)rUserOpt.GetStreet();
+ else if(sToken.EqualsAscii("COUNTRY"))
+ sRet += (String)rUserOpt.GetCountry();
+ else if(sToken.EqualsAscii("POSTALCODE"))
+ sRet += (String)rUserOpt.GetZip();
+ else if(sToken.EqualsAscii("CITY"))
+ sRet += (String)rUserOpt.GetCity();
+ else if(sToken.EqualsAscii("STATEPROV"))
+ sRet += (String)rUserOpt.GetState();
+ else if(sToken.Len()) //spaces
+ sRet += sToken;
+ }
+ return sRet;
+}
+// --------------------------------------------------------------------------
+SwEnvItem::SwEnvItem() :
+ SfxPoolItem(FN_ENVELOP)
+{
+ aAddrText = aEmptyStr;
+ bSend = TRUE;
+ aSendText = MakeSender();
+ lSendFromLeft = 566; // 1 cm
+ lSendFromTop = 566; // 1 cm
+ Size aEnvSz = SvxPaperInfo::GetPaperSize(PAPER_ENV_C65);
+ lWidth = aEnvSz.Width();
+ lHeight = aEnvSz.Height();
+ eAlign = ENV_HOR_LEFT;
+ bPrintFromAbove = TRUE;
+ lShiftRight = 0;
+ lShiftDown = 0;
+
+ lAddrFromLeft = Max(lWidth, lHeight) / 2;
+ lAddrFromTop = Min(lWidth, lHeight) / 2;
+}
+// --------------------------------------------------------------------------
+SwEnvItem::SwEnvItem(const SwEnvItem& rItem) :
+ SfxPoolItem(FN_ENVELOP),
+ aAddrText (rItem.aAddrText),
+ bSend (rItem.bSend),
+ aSendText (rItem.aSendText),
+ lAddrFromLeft (rItem.lAddrFromLeft),
+ lAddrFromTop (rItem.lAddrFromTop),
+ lSendFromLeft (rItem.lSendFromLeft),
+ lSendFromTop (rItem.lSendFromTop),
+ lWidth (rItem.lWidth),
+ lHeight (rItem.lHeight),
+ eAlign (rItem.eAlign),
+ bPrintFromAbove(rItem.bPrintFromAbove),
+ lShiftRight (rItem.lShiftRight),
+ lShiftDown (rItem.lShiftDown)
+{
+}
+
+// --------------------------------------------------------------------------
+SwEnvItem& SwEnvItem::operator =(const SwEnvItem& rItem)
+{
+ aAddrText = rItem.aAddrText;
+ bSend = rItem.bSend;
+ aSendText = rItem.aSendText;
+ lSendFromLeft = rItem.lSendFromLeft;
+ lSendFromTop = rItem.lSendFromTop;
+ lAddrFromLeft = rItem.lAddrFromLeft;
+ lAddrFromTop = rItem.lAddrFromTop;
+ lWidth = rItem.lWidth;
+ lHeight = rItem.lHeight;
+ eAlign = rItem.eAlign;
+ bPrintFromAbove = rItem.bPrintFromAbove;
+ lShiftRight = rItem.lShiftRight;
+ lShiftDown = rItem.lShiftDown;
+ return *this;
+}
+// --------------------------------------------------------------------------
+int SwEnvItem::operator ==(const SfxPoolItem& rItem) const
+{
+ const SwEnvItem& rEnv = (const SwEnvItem&) rItem;
+
+ return aAddrText == rEnv.aAddrText &&
+ bSend == rEnv.bSend &&
+ aSendText == rEnv.aSendText &&
+ lSendFromLeft == rEnv.lSendFromLeft &&
+ lSendFromTop == rEnv.lSendFromTop &&
+ lAddrFromLeft == rEnv.lAddrFromLeft &&
+ lAddrFromTop == rEnv.lAddrFromTop &&
+ lWidth == rEnv.lWidth &&
+ lHeight == rEnv.lHeight &&
+ eAlign == rEnv.eAlign &&
+ bPrintFromAbove == rEnv.bPrintFromAbove &&
+ lShiftRight == rEnv.lShiftRight &&
+ lShiftDown == rEnv.lShiftDown;
+}
+
+// --------------------------------------------------------------------------
+SfxPoolItem* SwEnvItem::Clone(SfxItemPool*) const
+{
+ return new SwEnvItem(*this);
+}
+// --------------------------------------------------------------------------
+// --------------------------------------------------------------------------
+SwEnvCfgItem::SwEnvCfgItem() :
+ ConfigItem(C2U("Office.Writer/Envelope"))
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+ EnableNotification(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aNames.getLength())
+ {
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ switch(nProp)
+ {
+ case 0: pValues[nProp] >>= aEnvItem.aAddrText; break;// "Inscription/Addressee",
+ case 1: pValues[nProp] >>= aEnvItem.aSendText; break;// "Inscription/Sender",
+ case 2: aEnvItem.bSend = *(sal_Bool*)pValues[nProp].getValue(); break;// "Inscription/UseSender",
+ case 3:
+ pValues[nProp] >>= aEnvItem.lAddrFromLeft;// "Format/AddresseeFromLeft",
+ aEnvItem.lAddrFromLeft = MM100_TO_TWIP(aEnvItem.lAddrFromLeft);
+ break;
+ case 4:
+ pValues[nProp] >>= aEnvItem.lAddrFromTop; // "Format/AddresseeFromTop",
+ aEnvItem.lAddrFromTop = MM100_TO_TWIP(aEnvItem.lAddrFromTop);
+ break;
+ case 5:
+ pValues[nProp] >>= aEnvItem.lSendFromLeft; // "Format/SenderFromLeft",
+ aEnvItem.lSendFromLeft = MM100_TO_TWIP(aEnvItem.lSendFromLeft);
+ break;
+ case 6:
+ pValues[nProp] >>= aEnvItem.lSendFromTop;// "Format/SenderFromTop",
+ aEnvItem.lSendFromTop = MM100_TO_TWIP(aEnvItem.lSendFromTop);
+ break;
+ case 7:
+ pValues[nProp] >>= aEnvItem.lWidth; // "Format/Width",
+ aEnvItem.lWidth = MM100_TO_TWIP(aEnvItem.lWidth);
+ break;
+ case 8:
+ pValues[nProp] >>= aEnvItem.lHeight; // "Format/Height",
+ aEnvItem.lHeight = MM100_TO_TWIP(aEnvItem.lHeight);
+ break;
+ case 9:
+ {
+ sal_Int32 nTemp = 0;
+ pValues[nProp] >>= nTemp; aEnvItem.eAlign = (SwEnvAlign)nTemp; break;// "Print/Alignment",
+ }
+ case 10: aEnvItem.bPrintFromAbove = *(sal_Bool*)pValues[nProp].getValue(); break;// "Print/FromAbove",
+ case 11:
+ pValues[nProp] >>= aEnvItem.lShiftRight;
+ aEnvItem.lShiftRight = MM100_TO_TWIP(aEnvItem.lShiftRight);// "Print/Right",
+ break;
+ case 12:
+ pValues[nProp] >>= aEnvItem.lShiftDown;
+ aEnvItem.lShiftDown = MM100_TO_TWIP(aEnvItem.lShiftDown);
+ break;// "Print/Down"
+ }
+ }
+ }
+ }
+}
+/* -----------------------------26.09.00 14:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwEnvCfgItem::~SwEnvCfgItem()
+{
+}
+/* -----------------------------26.09.00 14:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwEnvCfgItem::Commit()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+
+ const Type& rType = ::getBooleanCppuType();
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ switch(nProp)
+ {
+ case 0: pValues[nProp] <<= aEnvItem.aAddrText; break;// "Inscription/Addressee",
+ case 1: pValues[nProp] <<= aEnvItem.aSendText; break;// "Inscription/Sender",
+ case 2: pValues[nProp].setValue(&aEnvItem.bSend, rType);break;// "Inscription/UseSender",
+ case 3: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lAddrFromLeft)) ; break;// "Format/AddresseeFromLeft",
+ case 4: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lAddrFromTop)) ; break;// "Format/AddresseeFromTop",
+ case 5: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lSendFromLeft)) ; break;// "Format/SenderFromLeft",
+ case 6: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lSendFromTop)) ; break;// "Format/SenderFromTop",
+ case 7: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lWidth)) ; break;// "Format/Width",
+ case 8: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lHeight)) ; break;// "Format/Height",
+ case 9: pValues[nProp] <<= sal_Int32(aEnvItem.eAlign); break;// "Print/Alignment",
+ case 10: pValues[nProp].setValue(&aEnvItem.bPrintFromAbove, rType); break;// "Print/FromAbove",
+ case 11: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lShiftRight));break; // "Print/Right",
+ case 12: pValues[nProp] <<= static_cast <sal_Int32>(TWIP_TO_MM100(aEnvItem.lShiftDown)); break;// "Print/Down"
+ }
+ }
+ PutProperties(aNames, aValues);
+}
+
+void SwEnvCfgItem::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+/* -----------------------------26.09.00 14:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence<rtl::OUString> SwEnvCfgItem::GetPropertyNames()
+{
+ static const char* aPropNames[] =
+ {
+ "Inscription/Addressee", // 0
+ "Inscription/Sender", // 1
+ "Inscription/UseSender", // 2
+ "Format/AddresseeFromLeft", // 3
+ "Format/AddresseeFromTop", // 4
+ "Format/SenderFromLeft", // 5
+ "Format/SenderFromTop", // 6
+ "Format/Width", // 7
+ "Format/Height", // 8
+ "Print/Alignment", // 9
+ "Print/FromAbove", // 10
+ "Print/Right", // 11
+ "Print/Down" // 12
+ };
+ const int nCount = 13;
+ Sequence<OUString> aNames(nCount);
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ pNames[i] = OUString::createFromAscii(aPropNames[i]);
+ return aNames;
+}
+
+BOOL SwEnvItem::QueryValue( Any& rVal, BYTE nMemberId ) const
+{
+ sal_Bool bRet = sal_True;
+ switch(nMemberId & ~CONVERT_TWIPS)
+ {
+ case MID_ENV_ADDR_TEXT : rVal <<= aAddrText; break;
+ case MID_ENV_SEND : rVal <<= bSend; break;
+ case MID_SEND_TEXT : rVal <<= aSendText; break;
+ case MID_ENV_ADDR_FROM_LEFT : rVal <<= lAddrFromLeft; break;
+ case MID_ENV_ADDR_FROM_TOP : rVal <<= lAddrFromTop; break;
+ case MID_ENV_SEND_FROM_LEFT : rVal <<= lSendFromLeft; break;
+ case MID_ENV_SEND_FROM_TOP : rVal <<= lSendFromTop; break;
+ case MID_ENV_WIDTH : rVal <<= lWidth; break;
+ case MID_ENV_HEIGHT : rVal <<= lHeight; break;
+ case MID_ENV_ALIGN : rVal <<= (sal_Int16) eAlign; break;
+ case MID_ENV_PRINT_FROM_ABOVE : rVal <<= bPrintFromAbove; break;
+ case MID_ENV_SHIFT_RIGHT : rVal <<= lShiftRight; break;
+ case MID_ENV_SHIFT_DOWN : rVal <<= lShiftDown; break;
+ default:
+ DBG_ERROR("Wrong memberId");
+ bRet = sal_False;
+ }
+ return bRet;
+}
+/* -----------------------------26.04.01 12:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwEnvItem::PutValue(const Any& rVal, BYTE nMemberId)
+{
+ BOOL bRet = FALSE;
+ switch(nMemberId & ~CONVERT_TWIPS)
+ {
+ case MID_ENV_ADDR_TEXT : bRet = (rVal >>= aAddrText); break;
+ case MID_ENV_SEND : bRet = (rVal >>= bSend); break;
+ case MID_SEND_TEXT : bRet = (rVal >>= aSendText); break;
+ case MID_ENV_ADDR_FROM_LEFT : bRet = (rVal >>= lAddrFromLeft); break;
+ case MID_ENV_ADDR_FROM_TOP : bRet = (rVal >>= lAddrFromTop); break;
+ case MID_ENV_SEND_FROM_LEFT : bRet = (rVal >>= lSendFromLeft); break;
+ case MID_ENV_SEND_FROM_TOP : bRet = (rVal >>= lSendFromTop); break;
+ case MID_ENV_WIDTH : bRet = (rVal >>= lWidth); break;
+ case MID_ENV_HEIGHT : bRet = (rVal >>= lHeight); break;
+ case MID_ENV_ALIGN :
+ {
+ sal_Int16 nTemp = 0;
+ bRet = (rVal >>= nTemp);
+ if (bRet)
+ eAlign = SwEnvAlign(nTemp);
+ break;
+ }
+ case MID_ENV_PRINT_FROM_ABOVE : bRet = (rVal >>= bPrintFromAbove); break;
+ case MID_ENV_SHIFT_RIGHT : bRet = (rVal >>= lShiftRight); break;
+ case MID_ENV_SHIFT_DOWN : bRet = (rVal >>= lShiftDown); break;
+ default:
+ DBG_ERROR("Wrong memberId");
+ }
+ return bRet;
+}
diff --git a/sw/source/ui/envelp/envlop.hrc b/sw/source/ui/envelp/envlop.hrc
new file mode 100644
index 000000000000..43f51d3a48df
--- /dev/null
+++ b/sw/source/ui/envelp/envlop.hrc
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ENVLOP_HRC
+#define _ENVLOP_HRC
+
+// #include *****************************************************************
+
+#include "envelp.hrc"
+
+// Lokale Resourcen *********************************************************
+
+#define TXT_ADDR 1
+#define EDT_ADDR 2
+#define FT_DATABASE 3
+#define LB_DATABASE 4
+#define FT_TABLE 5
+#define LB_TABLE 6
+#define BTN_INSERT 7
+#define FT_DBFIELD 8
+#define LB_DBFIELD 9
+#define BOX_SEND 10
+#define EDT_SEND 11
+#define WIN_PREVIEW 12
+#define ST_INSERT 13
+#define ST_CHANGE 14
+// Globale Resourcen ********************************************************
+
+#define STR_DOC_TITLE (RC_ENVLOP_BEGIN)
+
+// Ueberlaufpruefung ********************************************************
+
+#define ENVLOP_ACT_END STR_DOC_TITLE
+
+#if ENVLOP_ACT_END > RC_ENVLOP_END
+#error Resource-Ueberlauf in #file, #line
+#endif
+
+#endif
+
+
diff --git a/sw/source/ui/envelp/envlop.src b/sw/source/ui/envelp/envlop.src
new file mode 100644
index 000000000000..2b9a5a084cc8
--- /dev/null
+++ b/sw/source/ui/envelp/envlop.src
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // #pragma ******************************************************************
+
+ // #include *****************************************************************
+#include "envlop.hrc"
+#include "helpid.h"
+ // DLG_ENV ------------------------------------------------------------------
+TabDialog DLG_ENV
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Envelope" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_ENV_ENV ;
+ Text [ en-US ] = "Envelope" ;
+ PageResID = TP_ENV_ENV ;
+ };
+ PageItem
+ {
+ Identifier = TP_ENV_FMT ;
+ PageResID = TP_ENV_FMT ;
+ Text [ en-US ] = "Format";
+ };
+ PageItem
+ {
+ Identifier = TP_ENV_PRT ;
+ Text [ en-US ] = "Printer" ;
+ PageResID = TP_ENV_PRT ;
+ };
+ };
+ };
+ String ST_INSERT
+ {
+ Text [ en-US ] = "~Insert" ;
+ };
+ String ST_CHANGE
+ {
+ Text [ en-US ] = "~Modify" ;
+ };
+};
+ // TP_ENV_ENV ---------------------------------------------------------------
+TabPage TP_ENV_ENV
+{
+ HelpID = HID_ENV_ENV ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedText TXT_ADDR
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 124 , 8 ) ;
+ Text [ en-US ] = "Addr~essee" ;
+ Group = TRUE ;
+ Left = TRUE ;
+ };
+ MultiLineEdit EDT_ADDR
+ {
+ HelpID = "sw:MultiLineEdit:TP_ENV_ENV:EDT_ADDR";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 124 , 66 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ HScroll = TRUE ;
+ VScroll = TRUE ;
+ IgnoreTab = TRUE;
+ };
+ FixedText FT_DATABASE
+ {
+ Pos = MAP_APPFONT ( 162 , 6 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ Text [ en-US ] = "Database" ;
+ };
+ ListBox LB_DATABASE
+ {
+ HelpID = "sw:ListBox:TP_ENV_ENV:LB_DATABASE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 162 , 17 ) ;
+ Size = MAP_APPFONT ( 82 , 50 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_TABLE
+ {
+ Pos = MAP_APPFONT ( 162 , 33 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ Text [ en-US ] = "Table" ;
+ };
+ ListBox LB_TABLE
+ {
+ HelpID = "sw:ListBox:TP_ENV_ENV:LB_TABLE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 162 , 44 ) ;
+ Size = MAP_APPFONT ( 82 , 50 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ImageButton BTN_INSERT
+ {
+ HelpID = "sw:ImageButton:TP_ENV_ENV:BTN_INSERT";
+ Pos = MAP_APPFONT ( 137 , 71 ) ;
+ Size = MAP_APPFONT ( 18 , 12 ) ;
+ SYMBOL = IMAGEBUTTON_ARROW_LEFT ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_DBFIELD
+ {
+ Pos = MAP_APPFONT ( 162 , 60 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ Text [ en-US ] = "~Database field" ;
+ };
+ ListBox LB_DBFIELD
+ {
+ HelpID = "sw:ListBox:TP_ENV_ENV:LB_DBFIELD";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 162 , 71 ) ;
+ Size = MAP_APPFONT ( 82 , 50 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ CheckBox BOX_SEND
+ {
+ HelpID = "sw:CheckBox:TP_ENV_ENV:BOX_SEND";
+ Pos = MAP_APPFONT ( 6 , 105 ) ;
+ Size = MAP_APPFONT ( 124 , 8 ) ;
+ Text [ en-US ] = "~Sender" ;
+ TabStop = TRUE ;
+ };
+ MultiLineEdit EDT_SEND
+ {
+ HelpID = "sw:MultiLineEdit:TP_ENV_ENV:EDT_SEND";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 116) ;
+ Size = MAP_APPFONT ( 124 , 63 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ HScroll = TRUE ;
+ VScroll = TRUE ;
+ IgnoreTab = TRUE;
+ };
+ Window WIN_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 160 , 116 ) ;
+ Size = MAP_APPFONT ( 84 , 63 ) ;
+ };
+};
+ // Strings ******************************************************************
+String STR_DOC_TITLE
+{
+ Text [ en-US ] = "Envelope" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx
new file mode 100644
index 000000000000..d10a938c3046
--- /dev/null
+++ b/sw/source/ui/envelp/envlop1.cxx
@@ -0,0 +1,441 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#include "dbmgr.hxx"
+#include <sfx2/app.hxx>
+#include <vcl/msgbox.hxx>
+#include <swwait.hxx>
+#include <viewopt.hxx>
+
+#include "wrtsh.hxx"
+#include "errhdl.hxx"
+#include "cmdid.h"
+#include "helpid.h"
+#include "envfmt.hxx"
+#include "envlop.hxx"
+#include "envprt.hxx"
+#include "fmtcol.hxx"
+#include "poolfmt.hxx"
+#include "view.hxx"
+
+#include "envlop.hrc"
+#include <comphelper/processfactory.hxx>
+
+#include <unomid.h>
+
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+
+//impl in envimg.cxx
+extern SW_DLLPUBLIC String MakeSender();
+
+// --------------------------------------------------------------------------
+
+SwEnvPreview::SwEnvPreview(SfxTabPage* pParent, const ResId& rResID) :
+
+ Window(pParent, rResID)
+
+{
+ SetMapMode(MapMode(MAP_PIXEL));
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SwEnvPreview::~SwEnvPreview()
+{
+}
+
+// ----------------------------------------------------------------------------
+void SwEnvPreview::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+ if ( DATACHANGED_SETTINGS == rDCEvt.GetType() )
+ SetBackground( GetSettings().GetStyleSettings().GetDialogColor() );
+}
+
+// ----------------------------------------------------------------------------
+
+void SwEnvPreview::Paint(const Rectangle &)
+{
+ const StyleSettings& rSettings = GetSettings().GetStyleSettings();
+
+ const SwEnvItem& rItem =
+ ((SwEnvDlg*) GetParent()->GetParent()->GetParent())->aEnvItem;
+
+ USHORT nPageW = (USHORT) Max(rItem.lWidth, rItem.lHeight),
+ nPageH = (USHORT) Min(rItem.lWidth, rItem.lHeight);
+
+ float fx = (float)GetOutputSizePixel().Width () / (float)nPageW,
+ fy = (float)GetOutputSizePixel().Height() / (float)nPageH,
+ f = 0.8f * ( fx < fy ? fx : fy );
+
+ Color aBack = rSettings.GetWindowColor( );
+ Color aFront = SwViewOption::GetFontColor();
+ Color aMedium = Color( ( aBack.GetRed() + aFront.GetRed() ) / 2,
+ ( aBack.GetGreen() + aFront.GetGreen() ) / 2,
+ ( aBack.GetBlue() + aFront.GetBlue() ) / 2
+ );
+
+ SetLineColor( aFront );
+
+ // Umschlag
+ long nW = (USHORT) (f * nPageW),
+ nH = (USHORT) (f * nPageH),
+ nX = (GetOutputSizePixel().Width () - nW) / 2,
+ nY = (GetOutputSizePixel().Height() - nH) / 2;
+ SetFillColor( aBack );
+ DrawRect(Rectangle(Point(nX, nY), Size(nW, nH)));
+
+ // Absender
+ if (rItem.bSend)
+ {
+ long nSendX = nX + (USHORT) (f * rItem.lSendFromLeft),
+ nSendY = nY + (USHORT) (f * rItem.lSendFromTop ),
+ nSendW = (USHORT) (f * (rItem.lAddrFromLeft - rItem.lSendFromLeft)),
+ nSendH = (USHORT) (f * (rItem.lAddrFromTop - rItem.lSendFromTop - 566));
+ SetFillColor( aMedium );
+
+ DrawRect(Rectangle(Point(nSendX, nSendY), Size(nSendW, nSendH)));
+ }
+
+ // Empfaenger
+ long nAddrX = nX + (USHORT) (f * rItem.lAddrFromLeft),
+ nAddrY = nY + (USHORT) (f * rItem.lAddrFromTop ),
+ nAddrW = (USHORT) (f * (nPageW - rItem.lAddrFromLeft - 566)),
+ nAddrH = (USHORT) (f * (nPageH - rItem.lAddrFromTop - 566));
+ SetFillColor( aMedium );
+ DrawRect(Rectangle(Point(nAddrX, nAddrY), Size(nAddrW, nAddrH)));
+
+ // Briefmarke
+ long nStmpW = (USHORT) (f * 1417 /* 2,5 cm */),
+ nStmpH = (USHORT) (f * 1701 /* 3,0 cm */),
+ nStmpX = nX + nW - (USHORT) (f * 566) - nStmpW,
+ nStmpY = nY + (USHORT) (f * 566);
+
+ SetFillColor( aBack );
+ DrawRect(Rectangle(Point(nStmpX, nStmpY), Size(nStmpW, nStmpH)));
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SwEnvDlg::SwEnvDlg(Window* pParent, const SfxItemSet& rSet,
+ SwWrtShell* pWrtSh, Printer* pPrt, BOOL bInsert) :
+
+ SfxTabDialog(pParent, SW_RES(DLG_ENV), &rSet, FALSE, &aEmptyStr),
+ sInsert(SW_RES(ST_INSERT)),
+ sChange(SW_RES(ST_CHANGE)),
+ aEnvItem((const SwEnvItem&) rSet.Get(FN_ENVELOP)),
+ pSh(pWrtSh),
+ pPrinter(pPrt),
+ pAddresseeSet(0),
+ pSenderSet(0)
+{
+ FreeResource();
+
+ GetOKButton().SetText(String(SW_RES(STR_BTN_NEWDOC)));
+ GetOKButton().SetHelpId(HID_ENVELOP_PRINT);
+ GetOKButton().SetHelpText(aEmptyStr); // Damit generierter Hilfetext verwendet wird
+ if (GetUserButton())
+ {
+ GetUserButton()->SetText(bInsert ? sInsert : sChange);
+ GetUserButton()->SetHelpId(HID_ENVELOP_INSERT);
+ }
+
+ AddTabPage(TP_ENV_ENV, SwEnvPage ::Create, 0);
+ AddTabPage(TP_ENV_FMT, SwEnvFmtPage::Create, 0);
+ AddTabPage(TP_ENV_PRT, SwEnvPrtPage::Create, 0);
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SwEnvDlg::~SwEnvDlg()
+{
+ delete pAddresseeSet;
+ delete pSenderSet;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+void SwEnvDlg::PageCreated(USHORT nId, SfxTabPage &rPage)
+{
+ if (nId == TP_ENV_PRT)
+ {
+ ((SwEnvPrtPage*)&rPage)->SetPrt(pPrinter);
+ }
+}
+
+// --------------------------------------------------------------------------
+
+short SwEnvDlg::Ok()
+{
+ short nRet = SfxTabDialog::Ok();
+
+ if (nRet == RET_OK || nRet == RET_USER)
+ {
+ if (pAddresseeSet)
+ {
+ SwTxtFmtColl* pColl = pSh->GetTxtCollFromPool(RES_POOLCOLL_JAKETADRESS);
+ pColl->SetFmtAttr(*pAddresseeSet);
+ }
+ if (pSenderSet)
+ {
+ SwTxtFmtColl* pColl = pSh->GetTxtCollFromPool(RES_POOLCOLL_SENDADRESS);
+ pColl->SetFmtAttr(*pSenderSet);
+ }
+ }
+
+ return nRet;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SwEnvPage::SwEnvPage(Window* pParent, const SfxItemSet& rSet) :
+
+ SfxTabPage(pParent, SW_RES(TP_ENV_ENV), rSet),
+
+ aAddrText (this, SW_RES(TXT_ADDR )),
+ aAddrEdit (this, SW_RES(EDT_ADDR )),
+ aDatabaseFT (this, SW_RES(FT_DATABASE)),
+ aDatabaseLB (this, SW_RES(LB_DATABASE)),
+ aTableFT (this, SW_RES(FT_TABLE )),
+ aTableLB (this, SW_RES(LB_TABLE )),
+ aInsertBT (this, SW_RES(BTN_INSERT )),
+ aDBFieldFT (this, SW_RES(FT_DBFIELD )),
+ aDBFieldLB (this, SW_RES(LB_DBFIELD )),
+ aSenderBox (this, SW_RES(BOX_SEND )),
+ aSenderEdit (this, SW_RES(EDT_SEND )),
+ aPreview (this, SW_RES(WIN_PREVIEW))
+
+{
+ FreeResource();
+ SetExchangeSupport();
+ pSh = GetParent()->pSh;
+
+ // Handler installieren
+ aDatabaseLB .SetSelectHdl(LINK(this, SwEnvPage, DatabaseHdl ));
+ aTableLB .SetSelectHdl(LINK(this, SwEnvPage, DatabaseHdl ));
+ aInsertBT .SetClickHdl (LINK(this, SwEnvPage, FieldHdl ));
+ aSenderBox .SetClickHdl (LINK(this, SwEnvPage, SenderHdl ));
+ aPreview.SetBorderStyle( WINDOW_BORDER_MONO );
+
+ SwDBData aData = pSh->GetDBData();
+ sActDBName = aData.sDataSource;
+ sActDBName += DB_DELIM;
+ sActDBName += (String)aData.sCommand;
+ InitDatabaseBox();
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SwEnvPage::~SwEnvPage()
+{
+}
+
+// --------------------------------------------------------------------------
+
+
+
+IMPL_LINK( SwEnvPage, DatabaseHdl, ListBox *, pListBox )
+{
+ SwWait aWait( *pSh->GetView().GetDocShell(), TRUE );
+
+ if (pListBox == &aDatabaseLB)
+ {
+ sActDBName = pListBox->GetSelectEntry();
+ pSh->GetNewDBMgr()->GetTableNames(&aTableLB, sActDBName);
+ sActDBName += DB_DELIM;
+ }
+ else
+ sActDBName.SetToken(1, DB_DELIM, aTableLB.GetSelectEntry());
+ pSh->GetNewDBMgr()->GetColumnNames(
+ &aDBFieldLB, aDatabaseLB.GetSelectEntry(), aTableLB.GetSelectEntry());
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+IMPL_LINK( SwEnvPage, FieldHdl, Button *, EMPTYARG )
+{
+ String aStr ( '<' );
+ aStr += aDatabaseLB.GetSelectEntry();
+ aStr += '.';
+// aStr += DB_DELIM;
+ aStr += aTableLB.GetSelectEntry();
+ aStr += '.';
+ aStr += aTableLB.GetEntryData(aTableLB.GetSelectEntryPos()) == 0 ? '0' : '1';
+ aStr += '.';
+// aStr += DB_DELIM;
+ aStr += aDBFieldLB.GetSelectEntry();
+ aStr += '>';
+ aAddrEdit.ReplaceSelected(aStr);
+ Selection aSel = aAddrEdit.GetSelection();
+ aAddrEdit.GrabFocus();
+ aAddrEdit.SetSelection(aSel);
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+IMPL_LINK( SwEnvPage, SenderHdl, Button *, EMPTYARG )
+{
+ const BOOL bEnable = aSenderBox.IsChecked();
+ GetParent()->aEnvItem.bSend = bEnable;
+ aSenderEdit.Enable(bEnable);
+ if ( bEnable )
+ {
+ aSenderEdit.GrabFocus();
+ if(!aSenderEdit.GetText().Len())
+ aSenderEdit.SetText(MakeSender());
+ }
+ aPreview.Invalidate();
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+void SwEnvPage::InitDatabaseBox()
+{
+ if (pSh->GetNewDBMgr())
+ {
+ aDatabaseLB.Clear();
+ Sequence<OUString> aDataNames = SwNewDBMgr::GetExistingDatabaseNames();
+ const OUString* pDataNames = aDataNames.getConstArray();
+ for (long i = 0; i < aDataNames.getLength(); i++)
+ aDatabaseLB.InsertEntry(pDataNames[i]);
+
+ String sDBName = sActDBName.GetToken( 0, DB_DELIM );
+ String sTableName = sActDBName.GetToken( 1, DB_DELIM );
+ aDatabaseLB.SelectEntry(sDBName);
+ if (pSh->GetNewDBMgr()->GetTableNames(&aTableLB, sDBName))
+ {
+ aTableLB.SelectEntry(sTableName);
+ pSh->GetNewDBMgr()->GetColumnNames(&aDBFieldLB, sDBName, sTableName);
+ }
+ else
+ aDBFieldLB.Clear();
+
+ }
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SfxTabPage* SwEnvPage::Create(Window* pParent, const SfxItemSet& rSet)
+{
+ return new SwEnvPage(pParent, rSet);
+}
+
+// --------------------------------------------------------------------------
+
+
+
+void SwEnvPage::ActivatePage(const SfxItemSet& rSet)
+{
+ SfxItemSet aSet(rSet);
+ aSet.Put(GetParent()->aEnvItem);
+ Reset(aSet);
+}
+
+// --------------------------------------------------------------------------
+
+
+
+int SwEnvPage::DeactivatePage(SfxItemSet* _pSet)
+{
+ FillItem(GetParent()->aEnvItem);
+ if( _pSet )
+ FillItemSet(*_pSet);
+ return SfxTabPage::LEAVE_PAGE;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+void SwEnvPage::FillItem(SwEnvItem& rItem)
+{
+ rItem.aAddrText = aAddrEdit .GetText();
+ rItem.bSend = aSenderBox .IsChecked();
+ rItem.aSendText = aSenderEdit.GetText();
+}
+
+// --------------------------------------------------------------------------
+
+
+
+BOOL SwEnvPage::FillItemSet(SfxItemSet& rSet)
+{
+ FillItem(GetParent()->aEnvItem);
+ rSet.Put(GetParent()->aEnvItem);
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+
+
+
+void SwEnvPage::Reset(const SfxItemSet& rSet)
+{
+ SwEnvItem aItem = (const SwEnvItem&) rSet.Get(FN_ENVELOP);
+ aAddrEdit .SetText(String(aItem.aAddrText).ConvertLineEnd());
+ aSenderEdit.SetText(String(aItem.aSendText).ConvertLineEnd());
+ aSenderBox .Check (aItem.bSend);
+ aSenderBox.GetClickHdl().Call(&aSenderBox);
+}
+
+
diff --git a/sw/source/ui/envelp/envprt.cxx b/sw/source/ui/envelp/envprt.cxx
new file mode 100644
index 000000000000..22690e95abff
--- /dev/null
+++ b/sw/source/ui/envelp/envprt.cxx
@@ -0,0 +1,259 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <vcl/print.hxx>
+#include <svtools/prnsetup.hxx>
+
+#include "swtypes.hxx"
+#include "cmdid.h"
+#include "envprt.hxx"
+#include "envlop.hxx"
+#include "uitool.hxx"
+
+#include "envprt.hrc"
+
+
+
+
+
+SwEnvPrtPage::SwEnvPrtPage(Window* pParent, const SfxItemSet& rSet) :
+
+ SfxTabPage(pParent, SW_RES(TP_ENV_PRT), rSet),
+
+ aAlignBox (this, SW_RES(BOX_ALIGN )),
+ aTopButton (this, SW_RES(BTN_TOP )),
+ aBottomButton(this, SW_RES(BTN_BOTTOM )),
+ aRightText (this, SW_RES(TXT_RIGHT )),
+ aRightField (this, SW_RES(FLD_RIGHT )),
+ aDownText (this, SW_RES(TXT_DOWN )),
+ aDownField (this, SW_RES(FLD_DOWN )),
+ aPrinterInfo (this, SW_RES(TXT_PRINTER)),
+ aNoNameFL (this, SW_RES(FL_NONAME )),
+ aPrinterFL (this, SW_RES(FL_PRINTER )),
+ aPrtSetup (this, SW_RES(BTN_PRTSETUP))
+
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ // Metriken
+ FieldUnit eUnit = ::GetDfltMetric(FALSE);
+ SetMetric(aRightField, eUnit);
+ SetMetric(aDownField , eUnit);
+
+ // Handler installieren
+ aTopButton .SetClickHdl(LINK(this, SwEnvPrtPage, ClickHdl));
+ aBottomButton.SetClickHdl(LINK(this, SwEnvPrtPage, ClickHdl));
+
+ aPrtSetup .SetClickHdl(LINK(this, SwEnvPrtPage, ButtonHdl));
+
+ // Bitmaps
+ aBottomButton.GetClickHdl().Call(&aBottomButton);
+
+ // ToolBox
+ Size aSz = aAlignBox.CalcWindowSizePixel();
+ aAlignBox.SetSizePixel(aSz);
+// aAlignBox.SetPosPixel(Point(aNoNameFL.GetPosPixel().X() + (aNoNameFL.GetSizePixel().Width() - aSz.Width()) / 2, aAlignBox.GetPosPixel().Y()));
+ aAlignBox.SetClickHdl(LINK(this, SwEnvPrtPage, AlignHdl));
+
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SwEnvPrtPage::~SwEnvPrtPage()
+{
+}
+
+// --------------------------------------------------------------------------
+
+
+
+IMPL_LINK( SwEnvPrtPage, ClickHdl, Button *, EMPTYARG )
+{
+ sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
+ if (aBottomButton.IsChecked())
+ {
+ // Briefumschlaege von unten
+ aAlignBox.SetItemImage(ITM_HOR_LEFT, Bitmap(SW_RES(bHC ? BMP_HOR_LEFT_LOWER_H : BMP_HOR_LEFT_LOWER)));
+ aAlignBox.SetItemImage(ITM_HOR_CNTR, Bitmap(SW_RES(bHC ? BMP_HOR_CNTR_LOWER_H : BMP_HOR_CNTR_LOWER)));
+ aAlignBox.SetItemImage(ITM_HOR_RGHT, Bitmap(SW_RES(bHC ? BMP_HOR_RGHT_LOWER_H : BMP_HOR_RGHT_LOWER)));
+ aAlignBox.SetItemImage(ITM_VER_LEFT, Bitmap(SW_RES(bHC ? BMP_VER_LEFT_LOWER_H : BMP_VER_LEFT_LOWER)));
+ aAlignBox.SetItemImage(ITM_VER_CNTR, Bitmap(SW_RES(bHC ? BMP_VER_CNTR_LOWER_H : BMP_VER_CNTR_LOWER)));
+ aAlignBox.SetItemImage(ITM_VER_RGHT, Bitmap(SW_RES(bHC ? BMP_VER_RGHT_LOWER_H : BMP_VER_RGHT_LOWER)));
+ }
+ else
+ {
+ // Briefumschlaege von oben
+ aAlignBox.SetItemImage(ITM_HOR_LEFT, Bitmap(SW_RES(bHC ? BMP_HOR_LEFT_UPPER_H : BMP_HOR_LEFT_UPPER)));
+ aAlignBox.SetItemImage(ITM_HOR_CNTR, Bitmap(SW_RES(bHC ? BMP_HOR_CNTR_UPPER_H : BMP_HOR_CNTR_UPPER)));
+ aAlignBox.SetItemImage(ITM_HOR_RGHT, Bitmap(SW_RES(bHC ? BMP_HOR_RGHT_UPPER_H : BMP_HOR_RGHT_UPPER)));
+ aAlignBox.SetItemImage(ITM_VER_LEFT, Bitmap(SW_RES(bHC ? BMP_VER_LEFT_UPPER_H : BMP_VER_LEFT_UPPER)));
+ aAlignBox.SetItemImage(ITM_VER_CNTR, Bitmap(SW_RES(bHC ? BMP_VER_CNTR_UPPER_H : BMP_VER_CNTR_UPPER)));
+ aAlignBox.SetItemImage(ITM_VER_RGHT, Bitmap(SW_RES(bHC ? BMP_VER_RGHT_UPPER_H : BMP_VER_RGHT_UPPER)));
+ }
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+IMPL_LINK( SwEnvPrtPage, ButtonHdl, Button *, pBtn )
+{
+ if (pBtn == &aPrtSetup)
+ {
+ // Druck-Setup aufrufen
+ if (pPrt)
+ {
+ PrinterSetupDialog* pDlg = new PrinterSetupDialog(this );
+ pDlg->SetPrinter(pPrt);
+ pDlg->Execute();
+ delete pDlg;
+ GrabFocus();
+ aPrinterInfo.SetText(pPrt->GetName());
+ }
+ }
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+IMPL_LINK( SwEnvPrtPage, AlignHdl, ToolBox *, EMPTYARG )
+{
+ if (aAlignBox.GetCurItemId())
+ {
+ for (USHORT i = ITM_HOR_LEFT; i <= ITM_VER_RGHT; i++)
+ aAlignBox.CheckItem(i, FALSE);
+ aAlignBox.CheckItem(aAlignBox.GetCurItemId(), TRUE);
+ }
+ else
+ {
+ // GetCurItemId() == 0 ist moeglich!
+ const SwEnvItem& rItem = (const SwEnvItem&) GetItemSet().Get(FN_ENVELOP);
+ aAlignBox.CheckItem((USHORT) rItem.eAlign + ITM_HOR_LEFT, TRUE);
+ }
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SfxTabPage* SwEnvPrtPage::Create(Window* pParent, const SfxItemSet& rSet)
+{
+ return new SwEnvPrtPage(pParent, rSet);
+}
+
+// --------------------------------------------------------------------------
+
+
+
+void SwEnvPrtPage::ActivatePage(const SfxItemSet&)
+{
+ if (pPrt)
+ aPrinterInfo.SetText(pPrt->GetName());
+}
+
+// --------------------------------------------------------------------------
+
+
+
+int SwEnvPrtPage::DeactivatePage(SfxItemSet* _pSet)
+{
+ if( _pSet )
+ FillItemSet(*_pSet);
+ return SfxTabPage::LEAVE_PAGE;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+void SwEnvPrtPage::FillItem(SwEnvItem& rItem)
+{
+ USHORT nID = 0;
+ for (USHORT i = ITM_HOR_LEFT; i <= ITM_VER_RGHT && !nID; i++)
+ if (aAlignBox.IsItemChecked(i))
+ nID = i;
+
+ rItem.eAlign = (SwEnvAlign) (nID - ITM_HOR_LEFT);
+ rItem.bPrintFromAbove = aTopButton.IsChecked();
+ rItem.lShiftRight = static_cast< sal_Int32 >(GetFldVal(aRightField));
+ rItem.lShiftDown = static_cast< sal_Int32 >(GetFldVal(aDownField ));
+}
+
+// --------------------------------------------------------------------------
+
+
+
+BOOL SwEnvPrtPage::FillItemSet(SfxItemSet& rSet)
+{
+ FillItem(GetParent()->aEnvItem);
+ rSet.Put(GetParent()->aEnvItem);
+ return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+
+
+
+void SwEnvPrtPage::Reset(const SfxItemSet& rSet)
+{
+// SfxItemSet aSet(rSet);
+// aSet.Put(GetParent()->aEnvItem);
+
+ // Item auslesen
+ const SwEnvItem& rItem = (const SwEnvItem&) rSet.Get(FN_ENVELOP);
+ aAlignBox.CheckItem((USHORT) rItem.eAlign + ITM_HOR_LEFT);
+
+ if (rItem.bPrintFromAbove)
+ aTopButton .Check();
+ else
+ aBottomButton.Check();
+
+ SetFldVal(aRightField, rItem.lShiftRight);
+ SetFldVal(aDownField , rItem.lShiftDown );
+
+ ActivatePage(rSet);
+ ClickHdl(&aTopButton);
+}
+
+
+
+
diff --git a/sw/source/ui/envelp/envprt.hrc b/sw/source/ui/envelp/envprt.hrc
new file mode 100644
index 000000000000..902416e80764
--- /dev/null
+++ b/sw/source/ui/envelp/envprt.hrc
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ENVPRT_HRC
+#define _ENVPRT_HRC
+
+// #include *****************************************************************
+
+#include "envelp.hrc"
+
+// Lokale Resourcen *********************************************************
+
+#define BOX_ALIGN 1
+#define BTN_TOP 7
+#define BTN_BOTTOM 8
+#define TXT_RIGHT 9
+#define FLD_RIGHT 10
+#define TXT_DOWN 11
+#define FLD_DOWN 12
+#define TXT_PRINTER 13
+#define FL_NONAME 14
+#define BTN_PRTSETUP 15
+#define FL_PRINTER 16
+
+// Globale Resourcen ********************************************************
+
+#define BMP_HOR_LEFT_LOWER (RC_ENVPRT_BEGIN )
+#define BMP_HOR_LEFT_UPPER (RC_ENVPRT_BEGIN + 1)
+#define BMP_HOR_CNTR_LOWER (RC_ENVPRT_BEGIN + 2)
+#define BMP_HOR_CNTR_UPPER (RC_ENVPRT_BEGIN + 3)
+#define BMP_HOR_RGHT_LOWER (RC_ENVPRT_BEGIN + 4)
+#define BMP_HOR_RGHT_UPPER (RC_ENVPRT_BEGIN + 5)
+
+#define BMP_VER_LEFT_LOWER (RC_ENVPRT_BEGIN + 6)
+#define BMP_VER_LEFT_UPPER (RC_ENVPRT_BEGIN + 7)
+#define BMP_VER_CNTR_LOWER (RC_ENVPRT_BEGIN + 8)
+#define BMP_VER_CNTR_UPPER (RC_ENVPRT_BEGIN + 9)
+#define BMP_VER_RGHT_LOWER (RC_ENVPRT_BEGIN + 10)
+#define BMP_VER_RGHT_UPPER (RC_ENVPRT_BEGIN + 11)
+
+#define ITM_HOR_LEFT (RC_ENVPRT_BEGIN + 12)
+#define ITM_HOR_CNTR (RC_ENVPRT_BEGIN + 13)
+#define ITM_HOR_RGHT (RC_ENVPRT_BEGIN + 14)
+#define ITM_VER_LEFT (RC_ENVPRT_BEGIN + 15)
+#define ITM_VER_CNTR (RC_ENVPRT_BEGIN + 16)
+#define ITM_VER_RGHT (RC_ENVPRT_BEGIN + 17)
+
+#define BMP_HOR_LEFT_LOWER_H (RC_ENVPRT_HC_BEGIN )
+#define BMP_HOR_LEFT_UPPER_H (RC_ENVPRT_HC_BEGIN + 1)
+#define BMP_HOR_CNTR_LOWER_H (RC_ENVPRT_HC_BEGIN + 2)
+#define BMP_HOR_CNTR_UPPER_H (RC_ENVPRT_HC_BEGIN + 3)
+#define BMP_HOR_RGHT_LOWER_H (RC_ENVPRT_HC_BEGIN + 4)
+#define BMP_HOR_RGHT_UPPER_H (RC_ENVPRT_HC_BEGIN + 5)
+
+#define BMP_VER_LEFT_LOWER_H (RC_ENVPRT_HC_BEGIN + 6)
+#define BMP_VER_LEFT_UPPER_H (RC_ENVPRT_HC_BEGIN + 7)
+#define BMP_VER_CNTR_LOWER_H (RC_ENVPRT_HC_BEGIN + 8)
+#define BMP_VER_CNTR_UPPER_H (RC_ENVPRT_HC_BEGIN + 9)
+#define BMP_VER_RGHT_LOWER_H (RC_ENVPRT_HC_BEGIN + 10)
+#define BMP_VER_RGHT_UPPER_H (RC_ENVPRT_HC_BEGIN + 11)
+
+
+// Ueberlaufpruefung ********************************************************
+
+#define ENVPRT_ACT_END BMP_VER_RGHT_UPPER_H
+
+#if ENVPRT_ACT_END > RC_ENVPRT_HC_END
+#error Resource-Ueberlauf in #file, #line
+#endif
+
+#endif
+
diff --git a/sw/source/ui/envelp/envprt.hxx b/sw/source/ui/envelp/envprt.hxx
new file mode 100644
index 000000000000..4c2c14fb5cd6
--- /dev/null
+++ b/sw/source/ui/envelp/envprt.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ENVPRT_HXX
+#define _ENVPRT_HXX
+
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/group.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+
+
+
+#include "envimg.hxx"
+
+class SwEnvDlg;
+
+// class SwEnvPrtPage ---------------------------------------------------------
+
+class SwEnvPrtPage : public SfxTabPage
+{
+ ToolBox aAlignBox;
+ RadioButton aTopButton;
+ RadioButton aBottomButton;
+ FixedText aRightText;
+ MetricField aRightField;
+ FixedText aDownText;
+ MetricField aDownField;
+ FixedInfo aPrinterInfo;
+ FixedLine aNoNameFL;
+ FixedLine aPrinterFL;
+ PushButton aPrtSetup;
+
+ Printer* pPrt;
+
+ SwEnvPrtPage(Window* pParent, const SfxItemSet& rSet);
+ ~SwEnvPrtPage();
+
+ DECL_LINK( ClickHdl, Button * );
+ DECL_LINK( AlignHdl, ToolBox * );
+ DECL_LINK( ButtonHdl, Button * );
+
+ using Window::GetParent;
+ SwEnvDlg* GetParent() {return (SwEnvDlg*) SfxTabPage::GetParent()->GetParent();}
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+public:
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet* pSet = 0);
+ void FillItem(SwEnvItem& rItem);
+ virtual BOOL FillItemSet(SfxItemSet& rSet);
+ virtual void Reset(const SfxItemSet& rSet);
+
+ inline void SetPrt(Printer* pPrinter) { pPrt = pPrinter; }
+};
+
+#endif
+
diff --git a/sw/source/ui/envelp/envprt.src b/sw/source/ui/envelp/envprt.src
new file mode 100644
index 000000000000..a12db0d166f9
--- /dev/null
+++ b/sw/source/ui/envelp/envprt.src
@@ -0,0 +1,297 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // #pragma *****************************************************************
+
+ // #include ****************************************************************
+#include "envprt.hrc"
+#include "helpid.h"
+ // TP_ENV_PRT ---------------------------------------------------------------
+TabPage TP_ENV_PRT
+{
+ HelpID = HID_ENV_PRT ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_NONAME
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Envelope orientation";
+ };
+ ToolBox BOX_ALIGN
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = ITM_HOR_LEFT ;
+ HelpID = HID_ITM_HOR_LEFT ;
+ };
+ ToolBoxItem
+ {
+ Identifier = ITM_HOR_CNTR ;
+ HelpID = HID_ITM_HOR_CNTR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = ITM_HOR_RGHT ;
+ HelpID = HID_ITM_HOR_RGHT ;
+ };
+ ToolBoxItem
+ {
+ Identifier = ITM_VER_LEFT ;
+ HelpID = HID_ITM_VER_LEFT ;
+ };
+ ToolBoxItem
+ {
+ Identifier = ITM_VER_CNTR ;
+ HelpID = HID_ITM_VER_CNTR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = ITM_VER_RGHT ;
+ HelpID = HID_ITM_VER_RGHT ;
+ };
+ };
+ };
+ RadioButton BTN_TOP
+ {
+ HelpID = "sw:RadioButton:TP_ENV_PRT:BTN_TOP";
+ Pos = MAP_APPFONT ( 18 , 42 ) ;
+ Size = MAP_APPFONT ( 179 , 10 ) ;
+ Text [ en-US ] = "~Print from top" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ Check = TRUE ;
+ };
+ RadioButton BTN_BOTTOM
+ {
+ HelpID = "sw:RadioButton:TP_ENV_PRT:BTN_BOTTOM";
+ Pos = MAP_APPFONT ( 18 , 56 ) ;
+ Size = MAP_APPFONT ( 179 , 10 ) ;
+ Text [ en-US ] = "Print from ~bottom" ;
+ TabStop = TRUE ;
+ };
+ FixedText TXT_RIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 74 ) ;
+ Size = MAP_APPFONT ( 72 , 8 ) ;
+ Text [ en-US ] = "~Shift right" ;
+ Left = TRUE ;
+ };
+ MetricField FLD_RIGHT
+ {
+ HelpID = "sw:MetricField:TP_ENV_PRT:FLD_RIGHT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 86 , 72 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 10000 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ };
+ FixedText TXT_DOWN
+ {
+ Pos = MAP_APPFONT ( 12 , 90 ) ;
+ Size = MAP_APPFONT ( 72 , 8 ) ;
+ Text [ en-US ] = "Shift ~down" ;
+ Left = TRUE ;
+ };
+ MetricField FLD_DOWN
+ {
+ HelpID = "sw:MetricField:TP_ENV_PRT:FLD_DOWN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 86 , 88 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 10000 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 10000 ;
+ SpinSize = 10 ;
+ };
+ FixedLine FL_PRINTER
+ {
+ Pos = MAP_APPFONT ( 3 , 103 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Current printer";
+ };
+ FixedText TXT_PRINTER
+ {
+ Pos = MAP_APPFONT ( 12 , 116 ) ;
+ Size = MAP_APPFONT ( 179 , 8 ) ;
+ Text [ en-US ] = "- No printer installed -" ;
+ Left = TRUE ;
+ };
+ PushButton BTN_PRTSETUP
+ {
+ HelpID = "sw:PushButton:TP_ENV_PRT:BTN_PRTSETUP";
+ Pos = MAP_APPFONT ( 198 , 114 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Setup..." ;
+ };
+};
+ // Bitmaps ******************************************************************
+Bitmap BMP_HOR_LEFT_LOWER
+{
+ File = "envhl_l.bmp" ;
+};
+Bitmap BMP_HOR_LEFT_UPPER
+{
+ File = "envhl_u.bmp" ;
+};
+Bitmap BMP_HOR_CNTR_LOWER
+{
+ File = "envhc_l.bmp" ;
+};
+Bitmap BMP_HOR_CNTR_UPPER
+{
+ File = "envhc_u.bmp" ;
+};
+Bitmap BMP_HOR_RGHT_LOWER
+{
+ File = "envhr_l.bmp" ;
+};
+Bitmap BMP_HOR_RGHT_UPPER
+{
+ File = "envhr_u.bmp" ;
+};
+Bitmap BMP_VER_LEFT_LOWER
+{
+ File = "envvl_l.bmp" ;
+};
+Bitmap BMP_VER_LEFT_UPPER
+{
+ File = "envvl_u.bmp" ;
+};
+Bitmap BMP_VER_CNTR_LOWER
+{
+ File = "envvc_l.bmp" ;
+};
+Bitmap BMP_VER_CNTR_UPPER
+{
+ File = "envvc_u.bmp" ;
+};
+Bitmap BMP_VER_RGHT_LOWER
+{
+ File = "envvr_l.bmp" ;
+};
+Bitmap BMP_VER_RGHT_UPPER
+{
+ File = "envvr_u.bmp" ;
+};
+// HighContrast Bitmaps
+Bitmap BMP_HOR_LEFT_LOWER_H
+{
+ File = "envhl_l_h.bmp" ;
+};
+Bitmap BMP_HOR_LEFT_UPPER_H
+{
+ File = "envhl_u_h.bmp" ;
+};
+Bitmap BMP_HOR_CNTR_LOWER_H
+{
+ File = "envhc_l_h.bmp" ;
+};
+Bitmap BMP_HOR_CNTR_UPPER_H
+{
+ File = "envhc_u_h.bmp" ;
+};
+Bitmap BMP_HOR_RGHT_LOWER_H
+{
+ File = "envhr_l_h.bmp" ;
+};
+Bitmap BMP_HOR_RGHT_UPPER_H
+{
+ File = "envhr_u_h.bmp" ;
+};
+Bitmap BMP_VER_LEFT_LOWER_H
+{
+ File = "envvl_l_h.bmp" ;
+};
+Bitmap BMP_VER_LEFT_UPPER_H
+{
+ File = "envvl_u_h.bmp" ;
+};
+Bitmap BMP_VER_CNTR_LOWER_H
+{
+ File = "envvc_l_h.bmp" ;
+};
+Bitmap BMP_VER_CNTR_UPPER_H
+{
+ File = "envvc_u_h.bmp" ;
+};
+Bitmap BMP_VER_RGHT_LOWER_H
+{
+ File = "envvr_l_h.bmp" ;
+};
+Bitmap BMP_VER_RGHT_UPPER_H
+{
+ File = "envvr_u_h.bmp" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/envelp/label.hrc b/sw/source/ui/envelp/label.hrc
new file mode 100644
index 000000000000..3817ff92def4
--- /dev/null
+++ b/sw/source/ui/envelp/label.hrc
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _LABEL_HRC
+#define _LABEL_HRC
+
+// #include *****************************************************************
+
+#include "envelp.hrc"
+
+// Lokale Resourcen *********************************************************
+
+#define TXT_WRITING 1
+#define BOX_ADDR 2
+#define EDT_WRITING 3
+#define FT_DATABASE 4
+#define LB_DATABASE 5
+#define FT_TABLE 6
+#define LB_TABLE 7
+#define FL_WRITING 8
+#define BTN_CONT 9
+#define BTN_SHEET 10
+#define TXT_MAKE 11
+#define BOX_MAKE 12
+#define TXT_TYPE 13
+#define BOX_TYPE 14
+#define INF_FORMAT 15
+#define FL_FORMAT 16
+#define FT_DBFIELD 17
+#define LB_DBFIELD 18
+#define BTN_INSERT 19
+#define BTN_SYNC 20
+
+#define RB_FROM_AUTO_TEXT 1
+#define RB_FROM_EDIT 2
+#define LB_AUTO_TEXT 3
+#define FT_AUTO_TEXT_GROUP 4
+#define LB_AUTO_TEXT_GROUP 5
+#define ED_TEXT 6
+#define FL_CONTENT 7
+#define WIN_EXAMPLE 8
+#define ST_VISCARD_GROUP 10
+
+#define FL_DATA 30
+#define FT_NAME 31
+#define ED_FIRSTNAME 32
+#define ED_NAME 33
+#define ED_SHORTCUT 34
+#define FT_STREET 35
+#define ED_STREET 36
+#define FT_ZIPCITY 37
+#define ED_ZIP 38
+#define ED_CITY 39
+#define FT_COUNTRYSTATE 40
+#define ED_COUNTRY 41
+#define FT_TITLEPROF 42
+#define ED_PROFESSION 43
+#define ED_TITLE 44
+
+#define ED_PHONE 46
+#define ED_MOBILE 47
+
+#define ED_FAX 49
+#define FT_WWWMAIL 50
+#define ED_WWW 51
+#define ED_MAIL 52
+#define ED_STATE 53
+#define FT_COMP 54
+#define ED_COMP 55
+#define FT_COMP_EXT 56
+#define ED_COMP_EXT 57
+#define FT_SLOGAN 58
+#define ED_SLOGAN 59
+#define FT_POSITION 60
+#define ED_POSITION 61
+
+#define ST_BUSINESSCARDDLG 62
+#define ST_FIRSTPAGE_LAB 63
+#define ST_FIRSTPAGE_BC 64
+
+#define FT_NAME_2 65
+#define ED_FIRSTNAME_2 66
+#define ED_NAME_2 67
+#define ED_SHORTCUT_2 68
+
+#define FT_PHONE_MOBILE 70
+//#define FT_PHONE 71
+//#define FT_MOBILE 72
+#define FT_FAX 73
+
+// Globale Resourcen ********************************************************
+#define STR_DOC_TITLE (RC_LABEL_BEGIN)
+#define STR_CUSTOM (RC_LABEL_BEGIN + 1)
+
+// Ueberlaufpruefung ********************************************************
+
+#define LABEL_ACT_END STR_CUSTOM
+
+#if LABEL_ACT_END > RC_LABEL_END
+#error Resource-Ueberlauf in #file, #line
+#endif
+
+#endif
+
diff --git a/sw/source/ui/envelp/label.src b/sw/source/ui/envelp/label.src
new file mode 100644
index 000000000000..bd5be722ce46
--- /dev/null
+++ b/sw/source/ui/envelp/label.src
@@ -0,0 +1,758 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // #pragma ******************************************************************
+
+ // #include *****************************************************************
+#include "label.hrc"
+#include "globals.hrc"
+#include "helpid.h"
+// ----- defined strings -----------------------------------------------------
+#define LABEL_STRING \
+ Text [ en-US ] = "Labels" ; \
+
+#define BUSINESS_CARD_STRING \
+ Text [ en-US ] = "Business Cards"; \
+
+ // DLG_LAB ------------------------------------------------------------------
+TabDialog DLG_LAB
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ LABEL_STRING
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_VISITING_CARDS;
+ PageResID = TP_VISITING_CARDS;
+ BUSINESS_CARD_STRING
+ };
+ PageItem
+ {
+ Identifier = TP_PRIVATE_DATA;
+ PageResID = TP_PRIVATE_DATA;
+ Text [ en-US ] = "Private";
+ };
+ PageItem
+ {
+ Identifier = TP_BUSINESS_DATA;
+ PageResID = TP_BUSINESS_DATA;
+ Text [ en-US ] = "Business";
+ };
+ PageItem
+ {
+ Identifier = TP_LAB_FMT ;
+ PageResID = TP_LAB_FMT ;
+ Text [ en-US ] = "Format" ;
+ };
+ PageItem
+ {
+ Identifier = TP_LAB_PRT ;
+ PageResID = TP_LAB_PRT ;
+ Text [ en-US ] = "Options" ;
+ };
+ };
+ };
+ String ST_BUSINESSCARDDLG
+ {
+ BUSINESS_CARD_STRING
+ };
+ String ST_FIRSTPAGE_LAB
+ {
+ LABEL_STRING
+ };
+ String ST_FIRSTPAGE_BC
+ {
+ Text [ en-US ] = "Medium";
+ };
+};
+ // TP_LAB_LAB ---------------------------------------------------------------
+TabPage TP_LAB_LAB
+{
+ HelpID = HID_LAB_LAB ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedText TXT_WRITING
+ {
+ Pos = MAP_APPFONT ( 12 , 15 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Text [ en-US ] = "Label text" ;
+ };
+ CheckBox BOX_ADDR
+ {
+ HelpID = "sw:CheckBox:TP_LAB_LAB:BOX_ADDR";
+ Pos = MAP_APPFONT ( 67 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Address" ;
+ };
+ MultiLineEdit EDT_WRITING
+ {
+ HelpID = "sw:MultiLineEdit:TP_LAB_LAB:EDT_WRITING";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 105 , 89 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ HScroll = TRUE ;
+ VScroll = TRUE ;
+ IgnoreTab = TRUE;
+ };
+ FixedText FT_DATABASE
+ {
+ Pos = MAP_APPFONT ( 149 , 16 ) ;
+ Size = MAP_APPFONT ( 99 , 8 ) ;
+ Text [ en-US ] = "Database" ;
+ };
+ ListBox LB_DATABASE
+ {
+ HelpID = "sw:ListBox:TP_LAB_LAB:LB_DATABASE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 149 , 27 ) ;
+ Size = MAP_APPFONT ( 99 , 70 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_TABLE
+ {
+ Pos = MAP_APPFONT ( 149 , 45 ) ;
+ Size = MAP_APPFONT ( 99 , 8 ) ;
+ Text [ en-US ] = "Table" ;
+ };
+ ListBox LB_TABLE
+ {
+ HelpID = "sw:ListBox:TP_LAB_LAB:LB_TABLE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 149 , 56 ) ;
+ Size = MAP_APPFONT ( 99 , 70 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ImageButton BTN_INSERT
+ {
+ HelpID = "sw:ImageButton:TP_LAB_LAB:BTN_INSERT";
+ Pos = MAP_APPFONT ( 124 , 92 ) ;
+ Size = MAP_APPFONT ( 18 , 12 ) ;
+ SYMBOL = IMAGEBUTTON_ARROW_LEFT ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_DBFIELD
+ {
+ Pos = MAP_APPFONT ( 149 , 81 ) ;
+ Size = MAP_APPFONT ( 99 , 8 ) ;
+ Text [ en-US ] = "Database field" ;
+ };
+ ListBox LB_DBFIELD
+ {
+ HelpID = "sw:ListBox:TP_LAB_LAB:LB_DBFIELD";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 149 , 92 ) ;
+ Size = MAP_APPFONT ( 99 , 70 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedLine FL_WRITING
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Group = TRUE ;
+ Text [ en-US ] = "Inscription" ;
+ };
+ RadioButton BTN_CONT
+ {
+ HelpID = "sw:RadioButton:TP_LAB_LAB:BTN_CONT";
+ Pos = MAP_APPFONT ( 12 , 137 ) ;
+ Size = MAP_APPFONT ( 65 , 10 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ Text [ en-US ] = "~Continuous" ;
+ };
+ RadioButton BTN_SHEET
+ {
+ HelpID = "sw:RadioButton:TP_LAB_LAB:BTN_SHEET";
+ Pos = MAP_APPFONT ( 12 , 153 ) ;
+ Size = MAP_APPFONT ( 65 , 10 ) ;
+ Text [ en-US ] = "~Sheet" ;
+ };
+ FixedText TXT_MAKE
+ {
+ Pos = MAP_APPFONT ( 91 , 138 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Brand" ;
+ Left = TRUE ;
+ };
+ ListBox BOX_MAKE
+ {
+ HelpID = "sw:ListBox:TP_LAB_LAB:BOX_MAKE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 136 ) ;
+ Size = MAP_APPFONT ( 124 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText TXT_TYPE
+ {
+ Pos = MAP_APPFONT ( 91 , 154 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Type" ;
+ };
+ ListBox BOX_TYPE
+ {
+ HelpID = "sw:ListBox:TP_LAB_LAB:BOX_TYPE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 124 , 152 ) ;
+ Size = MAP_APPFONT ( 124 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText INF_FORMAT
+ {
+ Pos = MAP_APPFONT ( 12 , 168 ) ;
+ Size = MAP_APPFONT ( 236 , 8 ) ;
+ Left = TRUE ;
+ };
+ FixedLine FL_FORMAT
+ {
+ Pos = MAP_APPFONT ( 6 , 125 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Group = TRUE ;
+ Text [ en-US ] = "Format" ;
+ };
+};
+#define WIDTH 100
+#define HEIGHT 16
+FloatingWindow DLG_SYNC_BTN
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( WIDTH , HEIGHT ) ;
+ Moveable = TRUE ;
+ Closeable = FALSE ;
+ Sizeable = FALSE ;
+ Zoomable = TRUE ;
+ HelpID = HID_SYNC_BTN ;
+ Hide = TRUE ;
+ PushButton BTN_SYNC
+ {
+ HelpID = "sw:PushButton:DLG_SYNC_BTN:BTN_SYNC";
+ Pos = MAP_APPFONT ( 1 , 1 ) ;
+ Size = MAP_APPFONT ( WIDTH - 1 , HEIGHT - 1 ) ;
+ Text [ en-US ] = "Synchronize Labels" ;
+ };
+};
+ // String *******************************************************************
+String STR_DOC_TITLE
+{
+ Text [ en-US ] = "Labels" ;
+};
+String STR_CUSTOM
+{
+ Text [ en-US ] = "[User]";
+};
+/********************************************************************/
+TabPage TP_VISITING_CARDS
+{
+ HelpID = HID_TP_VISITING_CARDS ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+
+ Control LB_AUTO_TEXT
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 109 , 135 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_AUTO_TEXT_GROUP
+ {
+ Pos = MAP_APPFONT ( 12 , 153) ;
+ Size = MAP_APPFONT ( 109 , 8 ) ;
+ Text [ en-US ] = "AutoText - Section";
+ };
+ ListBox LB_AUTO_TEXT_GROUP
+ {
+ HelpID = "sw:ListBox:TP_VISITING_CARDS:LB_AUTO_TEXT_GROUP";
+ Pos = MAP_APPFONT ( 12 , 164) ;
+ Size = MAP_APPFONT ( 109 , 50 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedLine FL_CONTENT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Content";
+ };
+ Window WIN_EXAMPLE
+ {
+ Pos = MAP_APPFONT ( 139, 14 ) ;
+ Size = MAP_APPFONT ( 109 , 162 ) ;
+ };
+ String ST_VISCARD_GROUP
+ {
+ Text = "Cards";
+ };
+};
+TabPage TP_PRIVATE_DATA
+{
+ HelpID = HID_TP_PRIVATE_DATA ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_DATA
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Private data";
+ };
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 16) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "First/Last ~name/Initials";
+ };
+ Edit ED_FIRSTNAME
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_FIRSTNAME";
+ Pos = MAP_APPFONT ( 105 , 14 ) ;
+ Size = MAP_APPFONT ( 55 , 12 ) ;
+ Border = TRUE ;
+ };
+ Edit ED_NAME
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_NAME";
+ Pos = MAP_APPFONT ( 163 , 14 ) ;
+ Size = MAP_APPFONT ( 55 , 12 ) ;
+ Border = TRUE ;
+ };
+ Edit ED_SHORTCUT
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_SHORTCUT";
+ Pos = MAP_APPFONT ( 221 , 14 ) ;
+ Size = MAP_APPFONT ( 27 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_NAME_2
+ {
+ Pos = MAP_APPFONT ( 12 , 32) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "First/Last ~name/Initials 2";
+ };
+ Edit ED_FIRSTNAME_2
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_FIRSTNAME_2";
+ Pos = MAP_APPFONT ( 105 , 30 ) ;
+ Size = MAP_APPFONT ( 55 , 12 ) ;
+ Border = TRUE ;
+ };
+ Edit ED_NAME_2
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_NAME_2";
+ Pos = MAP_APPFONT ( 163 , 30 ) ;
+ Size = MAP_APPFONT ( 55 , 12 ) ;
+ Border = TRUE ;
+ };
+ Edit ED_SHORTCUT_2
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_SHORTCUT_2";
+ Pos = MAP_APPFONT ( 221 , 30 ) ;
+ Size = MAP_APPFONT ( 27 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_STREET
+ {
+ Pos = MAP_APPFONT ( 12 , 48) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "S~treet";
+ };
+ Edit ED_STREET
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_STREET";
+ Pos = MAP_APPFONT ( 105 , 46 ) ;
+ Size = MAP_APPFONT ( 143 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_ZIPCITY
+ {
+ Pos = MAP_APPFONT ( 12 , 64) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Zip/Cit~y";
+ };
+ Edit ED_ZIP
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_ZIP";
+ Pos = MAP_APPFONT ( 105 , 62 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ Border = TRUE ;
+ };
+ Edit ED_CITY
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_CITY";
+ Pos = MAP_APPFONT ( 158 , 62 ) ;
+ Size = MAP_APPFONT ( 90 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_COUNTRYSTATE
+ {
+ Pos = MAP_APPFONT ( 12 , 80) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Co~untry/State";
+ };
+ Edit ED_COUNTRY
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_COUNTRY";
+ Pos = MAP_APPFONT ( 105 , 78 ) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ Border = TRUE ;
+ };
+ Edit ED_STATE
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_STATE";
+ Pos = MAP_APPFONT ( 179 , 78 ) ;
+ Size = MAP_APPFONT ( 69 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_TITLEPROF
+ {
+ Pos = MAP_APPFONT ( 12 , 96) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Title/~Profession";
+ };
+ Edit ED_TITLE
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_TITLE";
+ Pos = MAP_APPFONT ( 105 , 94 ) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ Border = TRUE ;
+ };
+ Edit ED_PROFESSION
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_PROFESSION";
+ Pos = MAP_APPFONT ( 179 , 94 ) ;
+ Size = MAP_APPFONT ( 69 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_PHONE_MOBILE
+ {
+ Pos = MAP_APPFONT ( 12 , 112) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Phone/Mobile";
+ };
+ Edit ED_PHONE
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_PHONE";
+ Pos = MAP_APPFONT ( 105 , 110 ) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ Border = TRUE ;
+ };
+ Edit ED_MOBILE
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_MOBILE";
+ Pos = MAP_APPFONT ( 179 , 110 ) ;
+ Size = MAP_APPFONT ( 69 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_FAX
+ {
+ Pos = MAP_APPFONT ( 12 , 128) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Fa~x";
+ };
+ Edit ED_FAX
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_FAX";
+ Pos = MAP_APPFONT ( 105 , 126 ) ;
+ Size = MAP_APPFONT ( 143 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_WWWMAIL
+ {
+ Pos = MAP_APPFONT ( 12 , 144) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Homepage / e-mail";
+ };
+ Edit ED_WWW
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_WWW";
+ Pos = MAP_APPFONT ( 105 , 142) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ Border = TRUE ;
+ };
+ Edit ED_MAIL
+ {
+ HelpID = "sw:Edit:TP_PRIVATE_DATA:ED_MAIL";
+ Pos = MAP_APPFONT ( 179 , 142) ;
+ Size = MAP_APPFONT ( 69 , 12 ) ;
+ Border = TRUE ;
+ };
+};
+TabPage TP_BUSINESS_DATA
+{
+ HelpID = HID_TP_BUSINESS_DATA;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedLine FL_DATA
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Business data";
+ };
+ FixedText FT_COMP
+ {
+ Pos = MAP_APPFONT ( 12 , 16) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Company";
+ };
+ Edit ED_COMP
+ {
+ HelpID = "sw:Edit:TP_BUSINESS_DATA:ED_COMP";
+ Pos = MAP_APPFONT ( 105 , 14) ;
+ Size = MAP_APPFONT ( 143 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_COMP_EXT
+ {
+ Pos = MAP_APPFONT ( 12 , 32) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Company 2nd line";
+ };
+ Edit ED_COMP_EXT
+ {
+ HelpID = "sw:Edit:TP_BUSINESS_DATA:ED_COMP_EXT";
+ Pos = MAP_APPFONT ( 105 , 30) ;
+ Size = MAP_APPFONT ( 143 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_SLOGAN
+ {
+ Pos = MAP_APPFONT ( 12 , 48) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Slogan";
+ };
+ Edit ED_SLOGAN
+ {
+ HelpID = "sw:Edit:TP_BUSINESS_DATA:ED_SLOGAN";
+ Pos = MAP_APPFONT ( 105 , 46) ;
+ Size = MAP_APPFONT ( 143 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_STREET
+ {
+ Pos = MAP_APPFONT ( 12 , 64) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Street";
+ };
+ Edit ED_STREET
+ {
+ HelpID = "sw:Edit:TP_BUSINESS_DATA:ED_STREET";
+ Pos = MAP_APPFONT ( 105 , 62) ;
+ Size = MAP_APPFONT ( 143 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_ZIPCITY
+ {
+ Pos = MAP_APPFONT ( 12 , 80) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "ZIP/City";
+ };
+ Edit ED_ZIP
+ {
+ HelpID = "sw:Edit:TP_BUSINESS_DATA:ED_ZIP";
+ Pos = MAP_APPFONT ( 105 , 78) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ Border = TRUE ;
+ };
+ Edit ED_CITY
+ {
+ HelpID = "sw:Edit:TP_BUSINESS_DATA:ED_CITY";
+ Pos = MAP_APPFONT ( 158 , 78) ;
+ Size = MAP_APPFONT ( 90 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_COUNTRYSTATE
+ {
+ Pos = MAP_APPFONT ( 12 , 96) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Country/State";
+ };
+ Edit ED_COUNTRY
+ {
+ HelpID = "sw:Edit:TP_BUSINESS_DATA:ED_COUNTRY";
+ Pos = MAP_APPFONT ( 105 , 94) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ Border = TRUE ;
+ };
+ Edit ED_STATE
+ {
+ HelpID = "sw:Edit:TP_BUSINESS_DATA:ED_STATE";
+ Pos = MAP_APPFONT ( 179 , 94) ;
+ Size = MAP_APPFONT ( 69 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_POSITION
+ {
+ Pos = MAP_APPFONT ( 12 , 112) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Position";
+ };
+ Edit ED_POSITION
+ {
+ HelpID = "sw:Edit:TP_BUSINESS_DATA:ED_POSITION";
+ Pos = MAP_APPFONT ( 105 , 110) ;
+ Size = MAP_APPFONT ( 143 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_PHONE_MOBILE
+ {
+ Pos = MAP_APPFONT ( 12 , 128) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Phone/Mobile";
+ };
+ Edit ED_PHONE
+ {
+ HelpID = "sw:Edit:TP_BUSINESS_DATA:ED_PHONE";
+ Pos = MAP_APPFONT ( 105 , 126) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ Border = TRUE ;
+ };
+ Edit ED_MOBILE
+ {
+ HelpID = "sw:Edit:TP_BUSINESS_DATA:ED_MOBILE";
+ Pos = MAP_APPFONT ( 179 , 126) ;
+ Size = MAP_APPFONT ( 69 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_FAX
+ {
+ Pos = MAP_APPFONT ( 12 , 144) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Fax";
+ };
+ Edit ED_FAX
+ {
+ HelpID = "sw:Edit:TP_BUSINESS_DATA:ED_FAX";
+ Pos = MAP_APPFONT ( 105 , 142) ;
+ Size = MAP_APPFONT ( 143 , 12 ) ;
+ Border = TRUE ;
+ };
+ FixedText FT_WWWMAIL
+ {
+ Pos = MAP_APPFONT ( 12 , 160) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "Ho~mepage / e-mail";
+ };
+ Edit ED_WWW
+ {
+ HelpID = "sw:Edit:TP_BUSINESS_DATA:ED_WWW";
+ Pos = MAP_APPFONT ( 105 , 158) ;
+ Size = MAP_APPFONT ( 71 , 12 ) ;
+ Border = TRUE ;
+ };
+ Edit ED_MAIL
+ {
+ HelpID = "sw:Edit:TP_BUSINESS_DATA:ED_MAIL";
+ Pos = MAP_APPFONT ( 179 , 158) ;
+ Size = MAP_APPFONT ( 69 , 12 ) ;
+ Border = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx
new file mode 100644
index 000000000000..c18e5587445f
--- /dev/null
+++ b/sw/source/ui/envelp/label1.cxx
@@ -0,0 +1,1111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <vcl/waitobj.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <swtypes.hxx>
+#include <wrtsh.hxx>
+#include <initui.hxx>
+#include <labimp.hxx>
+#include <labfmt.hxx>
+#include <labprt.hxx>
+#include <unotools.hxx>
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+#include "uitool.hxx"
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _LABEL_HRC
+#include <label.hrc>
+#endif
+
+//impl in envimg.cxx
+extern SW_DLLPUBLIC String MakeSender();
+
+
+SV_IMPL_PTRARR( SwLabRecs, SwLabRec* );
+
+void SwLabRec::SetFromItem( const SwLabItem& rItem )
+{
+ lHDist = rItem.lHDist;
+ lVDist = rItem.lVDist;
+ lWidth = rItem.lWidth;
+ lHeight = rItem.lHeight;
+ lLeft = rItem.lLeft;
+ lUpper = rItem.lUpper;
+ nCols = rItem.nCols;
+ nRows = rItem.nRows;
+ bCont = rItem.bCont;
+}
+
+void SwLabRec::FillItem( SwLabItem& rItem ) const
+{
+ rItem.lHDist = lHDist;
+ rItem.lVDist = lVDist;
+ rItem.lWidth = lWidth;
+ rItem.lHeight = lHeight;
+ rItem.lLeft = lLeft;
+ rItem.lUpper = lUpper;
+ rItem.nCols = nCols;
+ rItem.nRows = nRows;
+}
+
+// --------------------------------------------------------------------------
+void SwLabDlg::_ReplaceGroup( const String &rMake )
+{
+ //Die alten Eintraege vernichten.
+ pRecs->Remove( 1, pRecs->Count() - 1 );
+ aLabelsCfg.FillLabels(rtl::OUString(rMake), *pRecs);
+ aLstGroup = rMake;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+void SwLabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
+{
+ if (nId == TP_LAB_LAB)
+ {
+ if(m_bLabel)
+ {
+ ((SwLabPage*)&rPage)->SetNewDBMgr(pNewDBMgr);
+ ((SwLabPage*)&rPage)->InitDatabaseBox();
+ }
+ else
+ ((SwLabPage*)&rPage)->SetToBusinessCard();
+ }
+ else if (nId == TP_LAB_PRT)
+ pPrtPage = (SwLabPrtPage*)&rPage;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SwLabDlg::SwLabDlg(Window* pParent, const SfxItemSet& rSet,
+ SwNewDBMgr* pDBMgr, sal_Bool bLabel) :
+ SfxTabDialog( pParent, SW_RES(DLG_LAB), &rSet, sal_False ),
+ pNewDBMgr(pDBMgr),
+ pPrtPage(0),
+
+ aTypeIds( 50, 10 ),
+ aMakes ( 5, 0 ),
+
+ pRecs ( new SwLabRecs() ),
+ sBusinessCardDlg(SW_RES(ST_BUSINESSCARDDLG)),
+ sFormat(SW_RES(ST_FIRSTPAGE_LAB)),
+ sMedium(SW_RES(ST_FIRSTPAGE_BC)),
+ m_bLabel(bLabel)
+{
+ WaitObject aWait( pParent );
+
+ FreeResource();
+
+ GetOKButton().SetText(String(SW_RES(STR_BTN_NEW_DOC)));
+ GetOKButton().SetHelpId(HID_LABEL_INSERT);
+ GetOKButton().SetHelpText(aEmptyStr); // Damit generierter Hilfetext verwendet wird
+
+ AddTabPage(TP_LAB_LAB, m_bLabel ? sFormat : sMedium ,SwLabPage ::Create, 0, sal_False, 0);
+ AddTabPage(TP_VISITING_CARDS, SwVisitingCardPage::Create, 0);
+ AddTabPage(TP_LAB_FMT, SwLabFmtPage::Create, 0);
+ AddTabPage(TP_LAB_PRT, SwLabPrtPage::Create, 0);
+ AddTabPage(TP_BUSINESS_DATA, SwBusinessDataPage::Create, 0 );
+ AddTabPage(TP_PRIVATE_DATA, SwPrivateDataPage::Create, 0);
+
+
+ if(m_bLabel)
+ {
+ RemoveTabPage(TP_BUSINESS_DATA);
+ RemoveTabPage(TP_PRIVATE_DATA);
+ RemoveTabPage(TP_VISITING_CARDS);
+ }
+ else
+ {
+ SetText(sBusinessCardDlg);
+ }
+ // Benutzer-Etikette aus writer.cfg lesen
+ SwLabItem aItem((const SwLabItem&)rSet.Get( FN_LABEL ));
+ SwLabRec* pRec = new SwLabRec;
+ const String aTmp( SW_RES( STR_CUSTOM ) );
+ pRec->aMake = pRec->aType = aTmp;
+ pRec->SetFromItem( aItem );
+
+ sal_Bool bDouble = sal_False;
+
+ for (sal_uInt16 nRecPos = 0; nRecPos < pRecs->Count(); nRecPos++)
+ {
+ if (pRec->aMake == pRecs->GetObject(nRecPos)->aMake &&
+ pRec->aType == pRecs->GetObject(nRecPos)->aType)
+ {
+ bDouble = sal_True;
+ break;
+ }
+ }
+
+ if (!bDouble)
+ pRecs->C40_INSERT( SwLabRec, pRec, 0 );
+
+ sal_uInt16 nLstGroup = 0;
+ const UNO_NMSPC::Sequence<rtl::OUString>& rMan = aLabelsCfg.GetManufacturers();
+ const rtl::OUString* pMan = rMan.getConstArray();
+ for(sal_Int32 nMan = 0; nMan < rMan.getLength(); nMan++)
+ {
+ aMakes.Insert( new String(pMan[nMan]), aMakes.Count() );
+ if ( pMan[nMan] == aItem.aLstMake )
+ nLstGroup = (sal_uInt16) nMan;
+ }
+
+ if ( aMakes.Count() )
+ _ReplaceGroup( *aMakes[nLstGroup] );
+ if (pExampleSet)
+ pExampleSet->Put(aItem);
+}
+
+// --------------------------------------------------------------------------
+
+SwLabDlg::~SwLabDlg()
+{
+ delete pRecs;
+}
+// --------------------------------------------------------------------------
+
+void SwLabDlg::GetLabItem(SwLabItem &rItem)
+{
+ const SwLabItem& rActItem = (const SwLabItem&)GetExampleSet()->Get(FN_LABEL);
+ const SwLabItem& rOldItem = (const SwLabItem&)GetInputSetImpl()->Get(FN_LABEL);
+
+ if (rActItem != rOldItem)
+ { // Wurde schon mal mit (hoffentlich) korrektem Inhalt "geputtet"
+ rItem = rActItem;
+ }
+ else
+ {
+ rItem = rOldItem;
+
+ // Im rItem stehen (vom Namen mal abgesehen) immer nur die
+ // benutzerdefinierbaren Einstellungen. Daher richtige Werte
+ // direkt aus dem Record besorgen:
+ SwLabRec* pRec = GetRecord(rItem.aType, rItem.bCont);
+ pRec->FillItem( rItem );
+ }
+}
+
+// --------------------------------------------------------------------------
+
+SwLabRec* SwLabDlg::GetRecord(const String &rRecName, sal_Bool bCont)
+{
+ SwLabRec* pRec = NULL;
+ sal_Bool bFound = sal_False;
+ String sCustom(SW_RES(STR_CUSTOM));
+
+ const sal_uInt16 nCount = Recs().Count();
+ for (sal_uInt16 i = 0; i < nCount; i++)
+ {
+ pRec = Recs()[i];
+ if (pRec->aType != sCustom &&
+ rRecName == pRec->aType && bCont == pRec->bCont)
+ {
+ bFound = sal_True;
+ break;
+ }
+ }
+ if (!bFound) // Benutzerdefiniert
+ pRec = Recs()[0];
+
+ return(pRec);
+}
+
+// --------------------------------------------------------------------------
+
+Printer *SwLabDlg::GetPrt()
+{
+ if (pPrtPage)
+ return (pPrtPage->GetPrt());
+ else
+ return (NULL);
+}
+
+// --------------------------------------------------------------------------
+SwLabPage::SwLabPage(Window* pParent, const SfxItemSet& rSet) :
+ SfxTabPage(pParent, SW_RES(TP_LAB_LAB), rSet),
+ pNewDBMgr(NULL),
+ aItem ((const SwLabItem&) rSet.Get(FN_LABEL)),
+
+ aWritingText (this, SW_RES(TXT_WRITING)),
+ aAddrBox (this, SW_RES(BOX_ADDR )),
+ aWritingEdit (this, SW_RES(EDT_WRITING)),
+ aDatabaseFT (this, SW_RES(FT_DATABASE)),
+ aDatabaseLB (this, SW_RES(LB_DATABASE)),
+ aTableFT (this, SW_RES(FT_TABLE )),
+ aTableLB (this, SW_RES(LB_TABLE )),
+ aInsertBT (this, SW_RES(BTN_INSERT )),
+ aDBFieldFT (this, SW_RES(FT_DBFIELD )),
+ aDBFieldLB (this, SW_RES(LB_DBFIELD )),
+ aWritingFL (this, SW_RES(FL_WRITING)),
+ aContButton (this, SW_RES(BTN_CONT )),
+ aSheetButton (this, SW_RES(BTN_SHEET )),
+ aMakeText (this, SW_RES(TXT_MAKE )),
+ aMakeBox (this, SW_RES(BOX_MAKE )),
+ aTypeText (this, SW_RES(TXT_TYPE )),
+ aTypeBox (this, SW_RES(BOX_TYPE )),
+ aHiddenSortTypeBox(this, WB_SORT|WB_HIDE),
+ aFormatInfo (this, SW_RES(INF_FORMAT )),
+ aFormatFL (this, SW_RES(FL_FORMAT ))
+{
+ WaitObject aWait( pParent );
+
+ FreeResource();
+ SetExchangeSupport();
+
+
+ // Handler installieren
+ aAddrBox .SetClickHdl (LINK(this, SwLabPage, AddrHdl ));
+ aDatabaseLB .SetSelectHdl(LINK(this, SwLabPage, DatabaseHdl ));
+ aTableLB .SetSelectHdl(LINK(this, SwLabPage, DatabaseHdl ));
+ aInsertBT .SetClickHdl (LINK(this, SwLabPage, FieldHdl ));
+ aContButton .SetClickHdl (LINK(this, SwLabPage, PageHdl ));
+ aSheetButton .SetClickHdl (LINK(this, SwLabPage, PageHdl ));
+ aMakeBox .SetSelectHdl(LINK(this, SwLabPage, MakeHdl ));
+ aTypeBox .SetSelectHdl(LINK(this, SwLabPage, TypeHdl ));
+
+ InitDatabaseBox();
+
+ sal_uInt16 nLstGroup = 0;
+
+ const sal_uInt16 nCount = (sal_uInt16)GetParent()->Makes().Count();
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ {
+ String &rStr = *GetParent()->Makes()[i];
+ aMakeBox.InsertEntry( rStr );
+ if ( rStr == String(aItem.aLstMake) )
+ nLstGroup = i;
+ }
+// Reset(rSet);
+ aMakeBox.SelectEntryPos( nLstGroup );
+ aMakeBox.GetSelectHdl().Call( &aMakeBox );
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SwLabPage::~SwLabPage()
+{
+}
+/* -----------------29.09.99 09:08-------------------
+
+ --------------------------------------------------*/
+void lcl_ChgYPos(Window& rWin, long nDiff)
+{
+ Point aTempPos(rWin.GetPosPixel());
+ aTempPos.Y() += nDiff;
+ rWin.SetPosPixel(aTempPos);
+}
+
+void SwLabPage::SetToBusinessCard()
+{
+ SetHelpId(HID_BUSINESS_FMT_PAGE);
+ aContButton.SetHelpId(HID_BUSINESS_FMT_PAGE_CONT);
+ aSheetButton.SetHelpId(HID_BUSINESS_FMT_PAGE_SHEET);
+ aMakeBox.SetHelpId(HID_BUSINESS_FMT_PAGE_BRAND);
+ aTypeBox.SetHelpId(HID_BUSINESS_FMT_PAGE_TYPE);
+ m_bLabel = sal_False;
+ aWritingText.Hide();
+ aAddrBox.Hide();
+ aWritingEdit.Hide();
+ aDatabaseFT.Hide();
+ aDatabaseLB.Hide();
+ aTableFT.Hide();
+ aTableLB.Hide();
+ aInsertBT.Hide();
+ aDBFieldFT.Hide();
+ aDBFieldLB.Hide();
+ aWritingFL.Hide();
+
+ //resize the form
+ Point aFLPos(aWritingFL.GetPosPixel());
+ long nDiffPos = aFormatFL.GetPosPixel().Y() - aFLPos.Y();
+ Size aFLSz(aFormatFL.GetSizePixel());
+// aFLSz.Height() += nDiffPos;
+ aFormatFL.SetPosSizePixel(aFLPos, aFLSz);
+
+ // move all controls up
+ lcl_ChgYPos(aContButton, -nDiffPos);
+ lcl_ChgYPos(aSheetButton, -nDiffPos);
+ lcl_ChgYPos(aMakeText, -nDiffPos);
+
+ lcl_ChgYPos(aTypeText, -nDiffPos);
+ lcl_ChgYPos(aFormatInfo, -nDiffPos);
+
+ Size aTmpSz(3, 3);
+ aTmpSz = LogicToPixel(aTmpSz, MAP_APPFONT);
+
+ lcl_ChgYPos(aMakeBox, - nDiffPos);
+ Point aLBPos(aMakeBox.GetPosPixel());
+ aLBPos.Y() += aMakeBox.GetSizePixel().Height() + aTmpSz.Height();
+ aTypeBox.SetPosPixel(aLBPos);
+};
+
+// --------------------------------------------------------------------------
+
+
+IMPL_LINK( SwLabPage, AddrHdl, Button *, EMPTYARG )
+{
+ String aWriting;
+ if ( aAddrBox.IsChecked() )
+ aWriting = MakeSender();
+ aWritingEdit.SetText( aWriting.ConvertLineEnd() );
+ aWritingEdit.GrabFocus();
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+IMPL_LINK( SwLabPage, DatabaseHdl, ListBox *, pListBox )
+{
+ sActDBName = aDatabaseLB.GetSelectEntry();
+
+ WaitObject aObj( GetParent() );
+
+ if (pListBox == &aDatabaseLB)
+ GetNewDBMgr()->GetTableNames(&aTableLB, sActDBName);
+ GetNewDBMgr()->GetColumnNames(&aDBFieldLB, sActDBName, aTableLB.GetSelectEntry());
+ return 0;
+}
+
+
+
+IMPL_LINK( SwLabPage, FieldHdl, Button *, EMPTYARG )
+{
+ String aStr ( '<' );
+ aStr += aDatabaseLB.GetSelectEntry();
+ aStr += '.';
+ aStr += aTableLB.GetSelectEntry();
+ aStr += '.';
+ aStr += aTableLB.GetEntryData(aTableLB.GetSelectEntryPos()) == 0 ? '0' : '1';
+ aStr += '.';
+ aStr += aDBFieldLB.GetSelectEntry();
+ aStr += '>';
+ aWritingEdit.ReplaceSelected(aStr);
+ Selection aSel = aWritingEdit.GetSelection();
+ aWritingEdit.GrabFocus();
+ aWritingEdit.SetSelection(aSel);
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+IMPL_LINK_INLINE_START( SwLabPage, PageHdl, Button *, EMPTYARG )
+{
+ aMakeBox.GetSelectHdl().Call( &aMakeBox );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwLabPage, PageHdl, Button *, EMPTYARG )
+
+// --------------------------------------------------------------------------
+
+
+
+IMPL_LINK( SwLabPage, MakeHdl, ListBox *, EMPTYARG )
+{
+ WaitObject aWait( GetParent() );
+
+ aTypeBox.Clear();
+ aHiddenSortTypeBox.Clear();
+ GetParent()->TypeIds().Remove( 0, GetParent()->TypeIds().Count() );
+
+ const String aMake = aMakeBox.GetSelectEntry();
+ GetParent()->ReplaceGroup( aMake );
+ aItem.aLstMake = aMake;
+
+ const sal_Bool bCont = aContButton.IsChecked();
+ const sal_uInt16 nCount = GetParent()->Recs().Count();
+ sal_uInt16 nLstType = 0;
+
+ const String sCustom(SW_RES(STR_CUSTOM));
+ //insert the entries into the sorted list box
+ for ( sal_uInt16 i = 0; i < nCount; ++i )
+ {
+ const String aType ( GetParent()->Recs()[i]->aType );
+ BOOL bInsert = FALSE;
+ if ( GetParent()->Recs()[i]->aType == sCustom )
+ {
+ bInsert = TRUE;
+ aTypeBox.InsertEntry(aType );
+ }
+ else if ( GetParent()->Recs()[i]->bCont == bCont )
+ {
+ if ( aHiddenSortTypeBox.GetEntryPos(aType) == LISTBOX_ENTRY_NOTFOUND )
+ {
+ bInsert = TRUE;
+ aHiddenSortTypeBox.InsertEntry( aType );
+ }
+ }
+ if(bInsert)
+ {
+ GetParent()->TypeIds().Insert(i, GetParent()->TypeIds().Count());
+ if ( !nLstType && aType == String(aItem.aLstType) )
+ nLstType = GetParent()->TypeIds().Count();
+ }
+ }
+ for(sal_uInt16 nEntry = 0; nEntry < aHiddenSortTypeBox.GetEntryCount(); nEntry++)
+ {
+ aTypeBox.InsertEntry(aHiddenSortTypeBox.GetEntry(nEntry));
+ }
+ if (nLstType)
+ aTypeBox.SelectEntry(aItem.aLstType);
+ else
+ aTypeBox.SelectEntryPos(0);
+ aTypeBox.GetSelectHdl().Call( &aTypeBox );
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+IMPL_LINK_INLINE_START( SwLabPage, TypeHdl, ListBox *, EMPTYARG )
+{
+ DisplayFormat();
+ aItem.aType = aTypeBox.GetSelectEntry();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwLabPage, TypeHdl, ListBox *, EMPTYARG )
+
+// --------------------------------------------------------------------------
+
+
+
+void SwLabPage::DisplayFormat()
+{
+ MetricField aField(this, WinBits(0));
+ FieldUnit aMetric = ::GetDfltMetric(FALSE);
+ SetMetric(aField, aMetric);
+ aField.SetDecimalDigits(2);
+ aField.SetMin (0);
+ aField.SetMax (LONG_MAX);
+
+ SwLabRec* pRec = GetSelectedEntryPos();
+ aItem.aLstType = pRec->aType;
+ SETFLDVAL(aField, pRec->lWidth);
+ aField.Reformat();
+ const String aWString = aField.GetText();
+
+ SETFLDVAL(aField, pRec->lHeight);
+ aField.Reformat();
+
+ String aText = pRec->aType;
+ aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": "));
+ aText += aWString;
+ aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" x "));
+ aText += aField.GetText();
+ aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" ("));
+ aText += String::CreateFromInt32( pRec->nCols );
+ aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" x "));
+ aText += String::CreateFromInt32( pRec->nRows );
+ aText += ')';
+ aFormatInfo.SetText(aText);
+}
+
+// --------------------------------------------------------------------------
+
+SwLabRec* SwLabPage::GetSelectedEntryPos()
+{
+ String sSelEntry(aTypeBox.GetSelectEntry());
+
+ return GetParent()->GetRecord(sSelEntry, aContButton.IsChecked());
+}
+
+// --------------------------------------------------------------------------
+
+
+
+void SwLabPage::InitDatabaseBox()
+{
+ if( GetNewDBMgr() )
+ {
+ aDatabaseLB.Clear();
+ UNO_NMSPC::Sequence<rtl::OUString> aDataNames = SwNewDBMgr::GetExistingDatabaseNames();
+ const rtl::OUString* pDataNames = aDataNames.getConstArray();
+ for (long i = 0; i < aDataNames.getLength(); i++)
+ aDatabaseLB.InsertEntry(pDataNames[i]);
+ String sDBName = sActDBName.GetToken( 0, DB_DELIM );
+ String sTableName = sActDBName.GetToken( 1, DB_DELIM );
+ aDatabaseLB.SelectEntry(sDBName);
+ if( sDBName.Len() && GetNewDBMgr()->GetTableNames(&aTableLB, sDBName))
+ {
+ aTableLB.SelectEntry(sTableName);
+ GetNewDBMgr()->GetColumnNames(&aDBFieldLB, sActDBName, sTableName);
+ }
+ else
+ aDBFieldLB.Clear();
+ }
+}
+
+// --------------------------------------------------------------------------
+SfxTabPage* SwLabPage::Create(Window* pParent, const SfxItemSet& rSet)
+{
+ return new SwLabPage(pParent, rSet);
+}
+
+// --------------------------------------------------------------------------
+void SwLabPage::ActivatePage(const SfxItemSet& rSet)
+{
+ Reset( rSet );
+}
+// --------------------------------------------------------------------------
+int SwLabPage::DeactivatePage(SfxItemSet* _pSet)
+{
+ if (_pSet)
+ FillItemSet(*_pSet);
+
+ return sal_True;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+void SwLabPage::FillItem(SwLabItem& rItem)
+{
+ rItem.bAddr = aAddrBox.IsChecked();
+ rItem.aWriting = aWritingEdit.GetText();
+ rItem.bCont = aContButton.IsChecked();
+ rItem.aMake = aMakeBox.GetSelectEntry();
+ rItem.aType = aTypeBox.GetSelectEntry();
+ rItem.sDBName = sActDBName;
+
+ SwLabRec* pRec = GetSelectedEntryPos();
+ pRec->FillItem( rItem );
+
+ rItem.aLstMake = aMakeBox.GetSelectEntry();
+ rItem.aLstType = aTypeBox.GetSelectEntry();
+}
+
+// --------------------------------------------------------------------------
+
+
+
+sal_Bool SwLabPage::FillItemSet(SfxItemSet& rSet)
+{
+ FillItem( aItem );
+ rSet.Put( aItem );
+
+ return sal_True;
+}
+
+// --------------------------------------------------------------------------
+
+void SwLabPage::Reset(const SfxItemSet& rSet)
+{
+ aItem = (const SwLabItem&) rSet.Get(FN_LABEL);
+ String sDBName = aItem.sDBName;
+
+ String aWriting( aItem.aWriting );
+
+ aAddrBox .Check ( aItem.bAddr );
+ aWritingEdit.SetText ( aWriting.ConvertLineEnd() );
+
+ const sal_uInt16 nCount = (sal_uInt16)GetParent()->Makes().Count();
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ {
+ String &rStr = *GetParent()->Makes()[i];
+ if(aMakeBox.GetEntryPos(String(rStr)) == LISTBOX_ENTRY_NOTFOUND)
+ aMakeBox.InsertEntry( rStr );
+ }
+
+
+ aMakeBox .SelectEntry( aItem.aMake );
+ //save the current type
+ String sType(aItem.aType);
+ aMakeBox.GetSelectHdl().Call( &aMakeBox );
+ aItem.aType = sType;
+ //#102806# a newly added make may not be in the type ListBox already
+ if (aTypeBox.GetEntryPos(String(aItem.aType)) == LISTBOX_ENTRY_NOTFOUND && aItem.aMake.getLength())
+ GetParent()->UpdateGroup( aItem.aMake );
+ if (aTypeBox.GetEntryPos(String(aItem.aType)) != LISTBOX_ENTRY_NOTFOUND)
+ {
+ aTypeBox.SelectEntry(aItem.aType);
+ aTypeBox.GetSelectHdl().Call(&aTypeBox);
+ }
+ if (aDatabaseLB.GetEntryPos(sDBName) != LISTBOX_ENTRY_NOTFOUND)
+ {
+ aDatabaseLB.SelectEntry(sDBName);
+ aDatabaseLB.GetSelectHdl().Call(&aDatabaseLB);
+ }
+
+ if (aItem.bCont)
+ aContButton .Check();
+ else
+ aSheetButton.Check();
+}
+
+/*-- 08.07.99 14:00:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+//-----------------------------------------------------------------------------
+void SwVisitingCardPage::ClearUserData()
+{
+ SvLBoxEntry* pEntry = aAutoTextLB.First();
+ while(pEntry)
+ {
+ delete (String*)pEntry->GetUserData();
+ pEntry = aAutoTextLB.Next(pEntry);
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+void SwVisitingCardPage::SetUserData( sal_uInt32 nCnt,
+ const rtl::OUString* pNames, const rtl::OUString* pValues )
+{
+ for( sal_uInt32 i = 0; i < nCnt; ++i )
+ {
+ SvLBoxEntry* pEntry = aAutoTextLB.InsertEntry( pNames[ i ] );
+ pEntry->SetUserData( new String( pValues[ i ] ));
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+SwVisitingCardPage::SwVisitingCardPage(Window* pParent, const SfxItemSet& rSet) :
+ SfxTabPage(pParent, SW_RES(TP_VISITING_CARDS), rSet),
+ aAutoTextLB(this, SW_RES( LB_AUTO_TEXT )),
+ aAutoTextGroupFT(this, SW_RES( FT_AUTO_TEXT_GROUP )),
+ aAutoTextGroupLB(this, SW_RES( LB_AUTO_TEXT_GROUP )),
+ aContentFL(this, SW_RES( FL_CONTENT )),
+ aExampleWIN(this, SW_RES( WIN_EXAMPLE )),
+ sVisCardGroup(SW_RES(ST_VISCARD_GROUP)),
+ pExampleFrame(0)
+{
+ FreeResource();
+ aAutoTextLB.SetStyle( aAutoTextLB.GetStyle() | WB_HSCROLL );
+ aAutoTextLB.SetSpaceBetweenEntries(0);
+ aAutoTextLB.SetSelectionMode( SINGLE_SELECTION );
+ aAutoTextLB.SetHelpId(HID_BUSINESS_CARD_CONTENT);
+
+ SetExchangeSupport();
+ aAutoTextLB.SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl));
+ aAutoTextGroupLB.SetSelectHdl(LINK(this, SwVisitingCardPage, AutoTextSelectHdl));
+
+ aExampleWIN.Hide();
+
+ aAutoTextLB.Show();
+ aAutoTextGroupFT.Show();
+ aAutoTextGroupLB.Show();
+ InitFrameControl();
+}
+/*-- 08.07.99 14:00:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwVisitingCardPage::~SwVisitingCardPage()
+{
+ for(sal_uInt16 i = 0; i < aAutoTextGroupLB.GetEntryCount(); i++)
+ delete (String*)aAutoTextGroupLB.GetEntryData( i );
+ _xAutoText = 0;
+
+ ClearUserData();
+ delete pExampleFrame;
+}
+/*-- 08.07.99 14:00:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxTabPage* SwVisitingCardPage::Create(Window* pParent, const SfxItemSet& rSet)
+{
+ return new SwVisitingCardPage(pParent, rSet);
+}
+/*-- 08.07.99 14:00:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwVisitingCardPage::ActivatePage(const SfxItemSet& rSet)
+{
+ Reset( rSet );
+ UpdateFields();
+}
+/*-- 08.07.99 14:00:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+int SwVisitingCardPage::DeactivatePage(SfxItemSet* _pSet)
+{
+ if (_pSet)
+ FillItemSet(*_pSet);
+ return LEAVE_PAGE;
+}
+/*-- 08.07.99 14:00:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwVisitingCardPage::FillItemSet(SfxItemSet& rSet)
+{
+ String* pGroup = (String*)aAutoTextGroupLB.GetEntryData(
+ aAutoTextGroupLB.GetSelectEntryPos());
+ DBG_ASSERT(pGroup, "no group selected?");
+ if(pGroup)
+ aLabItem.sGlossaryGroup = *pGroup;
+
+ SvLBoxEntry* pSelEntry = aAutoTextLB.FirstSelected();
+ if(pSelEntry)
+ aLabItem.sGlossaryBlockName = *(String*)pSelEntry->GetUserData();
+ rSet.Put(aLabItem);
+ return sal_True;
+}
+/*-- 08.07.99 14:00:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_SelectBlock(SvTreeListBox& rAutoTextLB, const String& rBlockName)
+{
+ SvLBoxEntry* pEntry = rAutoTextLB.First();
+ while(pEntry)
+ {
+ if(*(String*)pEntry->GetUserData() == rBlockName)
+ {
+ rAutoTextLB.Select(pEntry);
+ rAutoTextLB.MakeVisible(pEntry);
+ break;
+ }
+ pEntry = rAutoTextLB.Next(pEntry);
+ }
+}
+//-----------------------------------------------------------------------------
+sal_Bool lcl_FindBlock(SvTreeListBox& rAutoTextLB, const String& rBlockName)
+{
+ SvLBoxEntry* pEntry = rAutoTextLB.First();
+ while(pEntry)
+ {
+ if(*(String*)pEntry->GetUserData() == rBlockName)
+ {
+ rAutoTextLB.Select(pEntry);
+ return sal_True;
+ }
+ pEntry = rAutoTextLB.Next(pEntry);
+ }
+ return sal_False;
+}
+
+//-----------------------------------------------------------------------------
+void SwVisitingCardPage::Reset(const SfxItemSet& rSet)
+{
+ aLabItem = (const SwLabItem&) rSet.Get(FN_LABEL);
+
+ sal_Bool bFound = sal_False;
+ sal_uInt16 i;
+ for(i = 0; i < aAutoTextGroupLB.GetEntryCount() && !bFound; i++)
+ if( String(aLabItem.sGlossaryGroup) ==
+ *(String*)aAutoTextGroupLB.GetEntryData( i ))
+ {
+ bFound = sal_True;
+ break;
+ }
+
+ if(!bFound)
+ {
+ // initially search for a group starting with "crd" which is the name of the
+ // business card AutoTexts
+ for(i = 0; i < aAutoTextGroupLB.GetEntryCount() && !bFound; i++)
+ if(0 == (*(String*)aAutoTextGroupLB.GetEntryData( i )).SearchAscii( "crd") )
+ {
+ bFound = sal_True;
+ break;
+ }
+ }
+ if(bFound)
+ {
+ if(aAutoTextGroupLB.GetSelectEntryPos() != i)
+ {
+ aAutoTextGroupLB.SelectEntryPos(i);
+ AutoTextSelectHdl(&aAutoTextGroupLB);
+ }
+ if(lcl_FindBlock(aAutoTextLB, aLabItem.sGlossaryBlockName))
+ {
+ SvLBoxEntry* pSelEntry = aAutoTextLB.FirstSelected();
+ if( pSelEntry &&
+ *(String*)pSelEntry->GetUserData() != String(aLabItem.sGlossaryBlockName))
+ {
+ lcl_SelectBlock(aAutoTextLB, aLabItem.sGlossaryBlockName);
+ AutoTextSelectHdl(&aAutoTextLB);
+ }
+ }
+ }
+}
+
+/* -----------------29.09.99 08:55-------------------
+
+ --------------------------------------------------*/
+SwPrivateDataPage::SwPrivateDataPage(Window* pParent, const SfxItemSet& rSet) :
+ SfxTabPage(pParent, SW_RES(TP_PRIVATE_DATA), rSet),
+ aDataFL (this, SW_RES( FL_DATA )),
+
+ aNameFT (this, SW_RES( FT_NAME )),
+ aFirstNameED (this, SW_RES( ED_FIRSTNAME )),
+ aNameED (this, SW_RES( ED_NAME )),
+ aShortCutED (this, SW_RES( ED_SHORTCUT )),
+
+ aName2FT (this, SW_RES( FT_NAME_2 )),
+ aFirstName2ED (this, SW_RES( ED_FIRSTNAME_2)),
+ aName2ED (this, SW_RES( ED_NAME_2 )),
+ aShortCut2ED (this, SW_RES( ED_SHORTCUT_2 )),
+
+ aStreetFT (this, SW_RES( FT_STREET )),
+ aStreetED (this, SW_RES( ED_STREET )),
+ aZipCityFT (this, SW_RES( FT_ZIPCITY )),
+ aZipED (this, SW_RES( ED_ZIP )),
+ aCityED (this, SW_RES( ED_CITY )),
+ aCountryStateFT (this, SW_RES( FT_COUNTRYSTATE )),
+ aCountryED (this, SW_RES( ED_COUNTRY )),
+ aStateED (this, SW_RES( ED_STATE )),
+ aTitleProfessionFT (this, SW_RES( FT_TITLEPROF )),
+ aTitleED (this, SW_RES( ED_TITLE )),
+ aProfessionED (this, SW_RES( ED_PROFESSION )),
+ aPhoneFT (this, SW_RES( FT_PHONE_MOBILE )),
+ aPhoneED (this, SW_RES( ED_PHONE )),
+ aMobilePhoneED (this, SW_RES( ED_MOBILE )),
+ aFaxFT (this, SW_RES( FT_FAX )),
+ aFaxED (this, SW_RES( ED_FAX )),
+ aWWWMailFT (this, SW_RES( FT_WWWMAIL )),
+ aHomePageED (this, SW_RES( ED_WWW )),
+ aMailED (this, SW_RES( ED_MAIL ))
+{
+ FreeResource();
+ SetExchangeSupport();
+}
+
+/*-- 29.09.99 08:55:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwPrivateDataPage::~SwPrivateDataPage()
+{
+}
+/*-- 29.09.99 08:55:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxTabPage* SwPrivateDataPage::Create(Window* pParent, const SfxItemSet& rSet)
+{
+ return new SwPrivateDataPage(pParent, rSet);
+}
+/*-- 29.09.99 08:55:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwPrivateDataPage::ActivatePage(const SfxItemSet& rSet)
+{
+ Reset(rSet);
+}
+/*-- 29.09.99 08:55:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+int SwPrivateDataPage::DeactivatePage(SfxItemSet* _pSet)
+{
+ if (_pSet)
+ FillItemSet(*_pSet);
+ return LEAVE_PAGE;
+}
+/*-- 29.09.99 08:55:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwPrivateDataPage::FillItemSet(SfxItemSet& rSet)
+{
+
+ SwLabItem aItem = (const SwLabItem&) GetTabDialog()->GetExampleSet()->Get(FN_LABEL);
+ aItem.aPrivFirstName = aFirstNameED .GetText();
+ aItem.aPrivName = aNameED .GetText( );
+ aItem.aPrivShortCut = aShortCutED .GetText( );
+ aItem.aPrivFirstName2 = aFirstName2ED .GetText();
+ aItem.aPrivName2 = aName2ED .GetText( );
+ aItem.aPrivShortCut2 = aShortCut2ED .GetText( );
+ aItem.aPrivStreet = aStreetED .GetText( );
+ aItem.aPrivZip = aZipED .GetText( );
+ aItem.aPrivCity = aCityED .GetText( );
+ aItem.aPrivCountry = aCountryED .GetText( );
+ aItem.aPrivState = aStateED .GetText( );
+ aItem.aPrivTitle = aTitleED .GetText( );
+ aItem.aPrivProfession= aProfessionED.GetText( );
+ aItem.aPrivPhone = aPhoneED .GetText( );
+ aItem.aPrivMobile = aMobilePhoneED.GetText( );
+ aItem.aPrivFax = aFaxED .GetText( );
+ aItem.aPrivWWW = aHomePageED .GetText( );
+ aItem.aPrivMail = aMailED .GetText( );
+
+ rSet.Put(aItem);
+ return sal_True;
+}
+/*-- 29.09.99 08:55:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwPrivateDataPage::Reset(const SfxItemSet& rSet)
+{
+ const SwLabItem& aItem = (const SwLabItem&) rSet.Get(FN_LABEL);
+ aFirstNameED.SetText(aItem.aPrivFirstName);
+ aNameED .SetText(aItem.aPrivName);
+ aShortCutED .SetText(aItem.aPrivShortCut);
+ aFirstName2ED.SetText(aItem.aPrivFirstName2);
+ aName2ED .SetText(aItem.aPrivName2);
+ aShortCut2ED .SetText(aItem.aPrivShortCut2);
+ aStreetED .SetText(aItem.aPrivStreet);
+ aZipED .SetText(aItem.aPrivZip);
+ aCityED .SetText(aItem.aPrivCity);
+ aCountryED .SetText(aItem.aPrivCountry);
+ aStateED .SetText(aItem.aPrivState);
+ aTitleED .SetText(aItem.aPrivTitle);
+ aProfessionED.SetText(aItem.aPrivProfession);
+ aPhoneED .SetText(aItem.aPrivPhone);
+ aMobilePhoneED.SetText(aItem.aPrivMobile);
+ aFaxED .SetText(aItem.aPrivFax);
+ aHomePageED .SetText(aItem.aPrivWWW);
+ aMailED .SetText(aItem.aPrivMail);
+}
+/* -----------------29.09.99 08:56-------------------
+
+ --------------------------------------------------*/
+SwBusinessDataPage::SwBusinessDataPage(Window* pParent, const SfxItemSet& rSet) :
+ SfxTabPage(pParent, SW_RES(TP_BUSINESS_DATA), rSet),
+ aDataFL (this, SW_RES( FL_DATA )),
+ aCompanyFT (this, SW_RES( FT_COMP )),
+ aCompanyED (this, SW_RES( ED_COMP )),
+ aCompanyExtFT (this, SW_RES( FT_COMP_EXT )),
+ aCompanyExtED (this, SW_RES( ED_COMP_EXT )),
+ aSloganFT (this, SW_RES( FT_SLOGAN )),
+ aSloganED (this, SW_RES( ED_SLOGAN )),
+ aStreetFT (this, SW_RES( FT_STREET )),
+ aStreetED (this, SW_RES( ED_STREET )),
+ aZipCityFT (this, SW_RES( FT_ZIPCITY )),
+ aZipED (this, SW_RES( ED_ZIP )),
+ aCityED (this, SW_RES( ED_CITY )),
+ aCountryStateFT (this, SW_RES( FT_COUNTRYSTATE )),
+ aCountryED (this, SW_RES( ED_COUNTRY )),
+ aStateED (this, SW_RES( ED_STATE )),
+ aPositionFT (this, SW_RES( FT_POSITION )),
+ aPositionED (this, SW_RES( ED_POSITION )),
+ aPhoneFT (this, SW_RES( FT_PHONE_MOBILE )),
+ aPhoneED (this, SW_RES( ED_PHONE )),
+ aMobilePhoneED (this, SW_RES( ED_MOBILE )),
+ aFaxFT (this, SW_RES( FT_FAX )),
+ aFaxED (this, SW_RES( ED_FAX )),
+ aWWWMailFT (this, SW_RES( FT_WWWMAIL )),
+ aHomePageED (this, SW_RES( ED_WWW )),
+ aMailED (this, SW_RES( ED_MAIL ))
+{
+ FreeResource();
+ SetExchangeSupport();
+}
+
+/*-- 29.09.99 08:56:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwBusinessDataPage::~SwBusinessDataPage()
+{
+}
+/*-- 29.09.99 08:56:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxTabPage* SwBusinessDataPage::Create(Window* pParent, const SfxItemSet& rSet)
+{
+ return new SwBusinessDataPage(pParent, rSet);
+}
+/*-- 29.09.99 08:56:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwBusinessDataPage::ActivatePage(const SfxItemSet& rSet)
+{
+ Reset(rSet);
+}
+/*-- 29.09.99 08:56:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+int SwBusinessDataPage::DeactivatePage(SfxItemSet* _pSet)
+{
+ if (_pSet)
+ FillItemSet(*_pSet);
+ return LEAVE_PAGE;
+}
+/*-- 29.09.99 08:56:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwBusinessDataPage::FillItemSet(SfxItemSet& rSet)
+{
+ SwLabItem aItem = (const SwLabItem&) GetTabDialog()->GetExampleSet()->Get(FN_LABEL);
+
+ aItem.aCompCompany = aCompanyED .GetText();
+ aItem.aCompCompanyExt= aCompanyExtED .GetText();
+ aItem.aCompSlogan = aSloganED .GetText();
+ aItem.aCompStreet = aStreetED .GetText();
+ aItem.aCompZip = aZipED .GetText();
+ aItem.aCompCity = aCityED .GetText();
+ aItem.aCompCountry = aCountryED .GetText();
+ aItem.aCompState = aStateED .GetText();
+ aItem.aCompPosition = aPositionED .GetText();
+ aItem.aCompPhone = aPhoneED .GetText();
+ aItem.aCompMobile = aMobilePhoneED .GetText();
+ aItem.aCompFax = aFaxED .GetText();
+ aItem.aCompWWW = aHomePageED .GetText();
+ aItem.aCompMail = aMailED .GetText();
+
+ rSet.Put(aItem);
+ return sal_True;
+}
+/*-- 29.09.99 08:56:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwBusinessDataPage::Reset(const SfxItemSet& rSet)
+{
+ const SwLabItem& aItem = (const SwLabItem&) rSet.Get(FN_LABEL);
+ aCompanyED .SetText(aItem.aCompCompany);
+ aCompanyExtED .SetText(aItem.aCompCompanyExt);
+ aSloganED .SetText(aItem.aCompSlogan);
+ aStreetED .SetText(aItem.aCompStreet);
+ aZipED .SetText(aItem.aCompZip);
+ aCityED .SetText(aItem.aCompCity);
+ aCountryED .SetText(aItem.aCompCountry);
+ aStateED .SetText(aItem.aCompState);
+ aPositionED .SetText(aItem.aCompPosition);
+ aPhoneED .SetText(aItem.aCompPhone);
+ aMobilePhoneED .SetText(aItem.aCompMobile);
+ aFaxED .SetText(aItem.aCompFax);
+ aHomePageED .SetText(aItem.aCompWWW);
+ aMailED .SetText(aItem.aCompMail);
+}
+
+
+
diff --git a/sw/source/ui/envelp/labelcfg.cxx b/sw/source/ui/envelp/labelcfg.cxx
new file mode 100644
index 000000000000..7b906c0ae6bf
--- /dev/null
+++ b/sw/source/ui/envelp/labelcfg.cxx
@@ -0,0 +1,302 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <swtypes.hxx>
+#include <labelcfg.hxx>
+#include <labimp.hxx>
+#include <unotools/configpathes.hxx>
+
+#include <unomid.h>
+
+using namespace utl;
+using namespace rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+
+/* -----------------------------15.01.01 11:17--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwLabelConfig::SwLabelConfig() :
+ ConfigItem(C2U("Office.Labels/Manufacturer"))
+{
+ aNodeNames = GetNodeNames(OUString());
+}
+/* -----------------------------06.09.00 16:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwLabelConfig::~SwLabelConfig()
+{
+}
+/* -----------------------------06.09.00 16:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwLabelConfig::Commit()
+{
+ // the config item is not writable yet
+}
+
+void SwLabelConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+/* -----------------------------15.01.01 11:42--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence<OUString> lcl_CreatePropertyNames(const OUString& rPrefix)
+{
+ Sequence<OUString> aProperties(2);
+ OUString* pProperties = aProperties.getArray();
+ for(sal_Int32 nProp = 0; nProp < 2; nProp++)
+ pProperties[nProp] = rPrefix;
+
+ pProperties[ 0] += C2U("Name");
+ pProperties[ 1] += C2U("Measure");
+ return aProperties;
+}
+//-----------------------------------------------------------------------------
+SwLabRec* lcl_CreateSwLabRec(Sequence<Any>& rValues, const OUString& rManufacturer)
+{
+ SwLabRec* pNewRec = new SwLabRec;
+ const Any* pValues = rValues.getConstArray();
+ OUString sTmp;
+ pNewRec->aMake = rManufacturer;
+ for(sal_Int32 nProp = 0; nProp < rValues.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ switch(nProp)
+ {
+ case 0: pValues[nProp] >>= sTmp; pNewRec->aType = sTmp; break;
+ case 1:
+ {
+//all values are contained as colon-separated 1/100 mm values except for the
+//continuous flag ('C'/'S')
+ pValues[nProp] >>= sTmp;
+ String sMeasure(sTmp);
+ USHORT nTokenCount = sMeasure.GetTokenCount(';');
+ for(USHORT i = 0; i < nTokenCount; i++)
+ {
+ String sToken(sMeasure.GetToken(i, ';' ));
+ int nVal = sToken.ToInt32();
+ switch(i)
+ {
+ case 0 : pNewRec->bCont = sToken.GetChar(0) == 'C'; break;
+ case 1 : pNewRec->lHDist = MM100_TO_TWIP(nVal);break;
+ case 2 : pNewRec->lVDist = MM100_TO_TWIP(nVal);break;
+ case 3 : pNewRec->lWidth = MM100_TO_TWIP(nVal);break;
+ case 4 : pNewRec->lHeight = MM100_TO_TWIP(nVal); break;
+ case 5 : pNewRec->lLeft = MM100_TO_TWIP(nVal);break;
+ case 6 : pNewRec->lUpper = MM100_TO_TWIP(nVal);break;
+ case 7 : pNewRec->nCols = nVal; break;
+ case 8 : pNewRec->nRows = nVal; break;
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ return pNewRec;
+}
+//-----------------------------------------------------------------------------
+Sequence<PropertyValue> lcl_CreateProperties(
+ Sequence<OUString>& rPropNames, const SwLabRec& rRec)
+{
+ const OUString* pNames = rPropNames.getConstArray();
+ Sequence<PropertyValue> aRet(rPropNames.getLength());
+ PropertyValue* pValues = aRet.getArray();
+ OUString sColon(C2U(";"));
+
+ for(sal_Int32 nProp = 0; nProp < rPropNames.getLength(); nProp++)
+ {
+ pValues[nProp].Name = pNames[nProp];
+ switch(nProp)
+ {
+ case 0: pValues[nProp].Value <<= OUString(rRec.aType); break;
+ case 1:
+ {
+ OUString sTmp;
+ sTmp += C2U( rRec.bCont ? "C" : "S"); sTmp += sColon;
+ sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lHDist) ); sTmp += sColon;
+ sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lVDist)); sTmp += sColon;
+ sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lWidth) ); sTmp += sColon;
+ sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lHeight) ); sTmp += sColon;
+ sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lLeft) ); sTmp += sColon;
+ sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lUpper) ); sTmp += sColon;
+ sTmp += OUString::valueOf(rRec.nCols );sTmp += sColon;
+ sTmp += OUString::valueOf(rRec.nRows );
+ pValues[nProp].Value <<= sTmp;
+ }
+ break;
+ }
+ }
+ return aRet;
+}
+//-----------------------------------------------------------------------------
+void SwLabelConfig::FillLabels(const OUString& rManufacturer, SwLabRecs& rLabArr)
+{
+ OUString sManufacturer(wrapConfigurationElementName(rManufacturer));
+ const Sequence<OUString> aLabels = GetNodeNames(sManufacturer);
+ const OUString* pLabels = aLabels.getConstArray();
+ for(sal_Int32 nLabel = 0; nLabel < aLabels.getLength(); nLabel++)
+ {
+ OUString sPrefix(sManufacturer);
+ sPrefix += C2U("/");
+ sPrefix += pLabels[nLabel];
+ sPrefix += C2U("/");
+ Sequence<OUString> aPropNames = lcl_CreatePropertyNames(sPrefix);
+ Sequence<Any> aValues = GetProperties(aPropNames);
+ SwLabRec* pNewRec = lcl_CreateSwLabRec(aValues, rManufacturer);
+ rLabArr.C40_INSERT( SwLabRec, pNewRec, rLabArr.Count() );
+ }
+}
+/* -----------------------------23.01.01 11:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwLabelConfig::HasLabel(const rtl::OUString& rManufacturer, const rtl::OUString& rType)
+{
+ const OUString* pNode = aNodeNames.getConstArray();
+ sal_Bool bFound = sal_False;
+ for(sal_Int32 nNode = 0; nNode < aNodeNames.getLength() && !bFound; nNode++)
+ {
+ if(pNode[nNode] == rManufacturer)
+ bFound = sal_True;
+ }
+ if(bFound)
+ {
+ OUString sManufacturer(wrapConfigurationElementName(rManufacturer));
+ const Sequence<OUString> aLabels = GetNodeNames(sManufacturer);
+ const OUString* pLabels = aLabels.getConstArray();
+ for(sal_Int32 nLabel = 0; nLabel < aLabels.getLength(); nLabel++)
+ {
+ OUString sPrefix(sManufacturer);
+ sPrefix += C2U("/");
+ sPrefix += pLabels[nLabel];
+ sPrefix += C2U("/");
+ Sequence<OUString> aProperties(1);
+ aProperties.getArray()[0] = sPrefix;
+ aProperties.getArray()[0] += C2U("Name");
+ Sequence<Any> aValues = GetProperties(aProperties);
+ const Any* pValues = aValues.getConstArray();
+ if(pValues[0].hasValue())
+ {
+ OUString sTmp;
+ pValues[0] >>= sTmp;
+ if(rType == sTmp)
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+}
+/* -----------------------------23.01.01 11:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool lcl_Exists(const OUString& rNode, const Sequence<OUString>& rLabels)
+{
+ const OUString* pLabels = rLabels.getConstArray();
+ for(sal_Int32 i = 0; i < rLabels.getLength(); i++)
+ if(pLabels[i] == rNode)
+ return sal_True;
+ return sal_False;
+}
+//-----------------------------------------------------------------------------
+void SwLabelConfig::SaveLabel( const rtl::OUString& rManufacturer,
+ const rtl::OUString& rType, const SwLabRec& rRec)
+{
+ const OUString* pNode = aNodeNames.getConstArray();
+ sal_Bool bFound = sal_False;
+ for(sal_Int32 nNode = 0; nNode < aNodeNames.getLength() && !bFound; nNode++)
+ {
+ if(pNode[nNode] == rManufacturer)
+ bFound = sal_True;
+ }
+ if(!bFound)
+ {
+ if(!AddNode(OUString(), rManufacturer))
+ {
+ DBG_ERROR("New configuration node could not be created");
+ return ;
+ }
+ else
+ {
+ aNodeNames = GetNodeNames(OUString());
+ }
+ }
+
+ OUString sManufacturer(wrapConfigurationElementName(rManufacturer));
+ const Sequence<OUString> aLabels = GetNodeNames(sManufacturer);
+ const OUString* pLabels = aLabels.getConstArray();
+ OUString sFoundNode;
+ for(sal_Int32 nLabel = 0; nLabel < aLabels.getLength(); nLabel++)
+ {
+ OUString sPrefix(sManufacturer);
+ sPrefix += C2U("/");
+ sPrefix += pLabels[nLabel];
+ sPrefix += C2U("/");
+ Sequence<OUString> aProperties(1);
+ aProperties.getArray()[0] = sPrefix;
+ aProperties.getArray()[0] += C2U("Name");
+ Sequence<Any> aValues = GetProperties(aProperties);
+ const Any* pValues = aValues.getConstArray();
+ if(pValues[0].hasValue())
+ {
+ OUString sTmp;
+ pValues[0] >>= sTmp;
+ if(rType == sTmp)
+ {
+ sFoundNode = pLabels[nLabel];
+ break;
+ }
+ }
+ }
+ // if not found - generate a unique node name
+ if(!sFoundNode.getLength())
+ {
+ sal_Int32 nIndex = aLabels.getLength();
+ OUString sPrefix(C2U("Label"));
+ sFoundNode = sPrefix;
+ sFoundNode += OUString::valueOf(nIndex);
+ while(lcl_Exists(sFoundNode, aLabels))
+ {
+ sFoundNode = sPrefix;
+ sFoundNode += OUString::valueOf(nIndex++);
+ }
+ }
+ OUString sPrefix(wrapConfigurationElementName(rManufacturer));
+ sPrefix += C2U("/");
+ sPrefix += sFoundNode;
+ sPrefix += C2U("/");
+ Sequence<OUString> aPropNames = lcl_CreatePropertyNames(sPrefix);
+ Sequence<PropertyValue> aPropValues = lcl_CreateProperties(aPropNames, rRec);
+ SetSetProperties(wrapConfigurationElementName(rManufacturer), aPropValues);
+
+}
+
+
diff --git a/sw/source/ui/envelp/labelexp.cxx b/sw/source/ui/envelp/labelexp.cxx
new file mode 100644
index 000000000000..22e281cfcef7
--- /dev/null
+++ b/sw/source/ui/envelp/labelexp.cxx
@@ -0,0 +1,281 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <swtypes.hxx>
+#include <labfmt.hxx>
+#include <unotools.hxx>
+#include <unoatxt.hxx>
+#include <unomid.h>
+#include <unoprnms.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::uno;
+using namespace ::comphelper;
+using ::rtl::OUString;
+
+#ifdef SW_PROP_NAME_STR
+#undef SW_PROP_NAME_STR
+#endif
+#define SW_PROP_NAME_STR(nId) SwGetPropName((nId)).pName
+
+/* -----------------08.07.99 15:15-------------------
+
+ --------------------------------------------------*/
+void SwVisitingCardPage::InitFrameControl()
+{
+ Link aLink(LINK(this, SwVisitingCardPage, FrameControlInitializedHdl));
+ pExampleFrame = new SwOneExampleFrame( aExampleWIN,
+ EX_SHOW_BUSINESS_CARDS, &aLink );
+
+ uno::Reference< lang::XMultiServiceFactory > xMgr =
+ getProcessServiceFactory();
+ //now the AutoText ListBoxes have to be filled
+
+ uno::Reference< uno::XInterface > xAText =
+ xMgr->createInstance( C2U("com.sun.star.text.AutoTextContainer") );
+ _xAutoText = uno::Reference< container::XNameAccess >(xAText, uno::UNO_QUERY);
+
+ uno::Sequence<OUString> aNames = _xAutoText->getElementNames();
+ const OUString* pGroups = aNames.getConstArray();
+ OUString uTitleName( C2U(SW_PROP_NAME_STR(UNO_NAME_TITLE)) );
+
+ for(sal_uInt16 i = 0; i < aNames.getLength(); i++)
+ {
+ uno::Any aGroup = _xAutoText->getByName(pGroups[i]);
+ uno::Reference< text::XAutoTextGroup > xGroup;
+ aGroup >>= xGroup;
+ uno::Reference< container::XIndexAccess > xIdxAcc(xGroup, uno::UNO_QUERY);
+ try
+ {
+ if(!xIdxAcc.is() || xIdxAcc->getCount())
+ {
+ uno::Reference< beans::XPropertySet > xPrSet(xGroup, uno::UNO_QUERY);
+ uno::Any aTitle = xPrSet->getPropertyValue( uTitleName );
+ OUString uTitle;
+ aTitle >>= uTitle;
+ String sGroup(pGroups[i]);
+ sal_uInt16 nEntry = aAutoTextGroupLB.InsertEntry(uTitle);
+ aAutoTextGroupLB.SetEntryData(nEntry, new String(sGroup));
+ }
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ if(aAutoTextGroupLB.GetEntryCount())
+ {
+ if(LISTBOX_ENTRY_NOTFOUND == aAutoTextGroupLB.GetSelectEntryPos())
+ aAutoTextGroupLB.SelectEntryPos(0);
+ String sCurGroupName(
+ *(String*)aAutoTextGroupLB.GetEntryData(aAutoTextGroupLB.GetSelectEntryPos()));
+ if(_xAutoText->hasByName(sCurGroupName))
+ {
+ uno::Any aGroup = _xAutoText->getByName(sCurGroupName);
+ try
+ {
+ uno::Reference< text::XAutoTextGroup > xGroup;
+ aGroup >>= xGroup;
+ uno::Sequence< OUString > aBlockNames = xGroup->getElementNames();
+ uno::Sequence< OUString > aTitles = xGroup->getTitles() ;
+
+ SetUserData( aBlockNames.getLength(), aTitles.getConstArray(),
+ aBlockNames.getConstArray() );
+ }
+ catch( uno::RuntimeException& )
+ {
+ // we'll be her if path settings were wrong
+ }
+ }
+ }
+}
+/* -----------------01.10.99 13:19-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK( SwVisitingCardPage, FrameControlInitializedHdl, void*, EMPTYARG )
+{
+ SvLBoxEntry* pSel = aAutoTextLB.FirstSelected();
+ String sEntry;
+ if( pSel )
+ sEntry = *(String*)pSel->GetUserData();
+ uno::Reference< text::XTextCursor > & xCrsr = pExampleFrame->GetTextCursor();
+ OUString uEntry(sEntry);
+
+ if(LISTBOX_ENTRY_NOTFOUND != aAutoTextGroupLB.GetSelectEntryPos())
+ {
+ String sGroup( *(String*)aAutoTextGroupLB.GetEntryData(
+ aAutoTextGroupLB.GetSelectEntryPos() ) );
+ uno::Any aGroup = _xAutoText->getByName(sGroup);
+ uno::Reference< text::XAutoTextGroup > xGroup;
+ aGroup >>= xGroup;
+
+ if( sEntry.Len() && xGroup->hasByName( uEntry ) )
+ {
+ uno::Any aEntry(xGroup->getByName(uEntry));
+ uno::Reference< text::XAutoTextEntry > xEntry;
+ aEntry >>= xEntry;
+ if(xEntry.is())
+ {
+ uno::Reference< text::XTextRange > xRange(xCrsr, uno::UNO_QUERY);
+ xEntry->applyTo(xRange);
+ }
+ UpdateFields();
+ }
+ }
+ return 0;
+}
+/* -----------------22.07.99 11:06-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK( SwVisitingCardPage, AutoTextSelectHdl, void*, pBox )
+{
+ if(_xAutoText.is())
+ {
+ if( &aAutoTextGroupLB == pBox )
+ {
+ String sGroup( *(String*)aAutoTextGroupLB.GetEntryData(
+ aAutoTextGroupLB.GetSelectEntryPos()));
+ uno::Any aGroup = _xAutoText->getByName(sGroup);
+ uno::Reference< text::XAutoTextGroup > xGroup;
+ aGroup >>= xGroup;
+
+ ClearUserData();
+ aAutoTextLB.Clear();
+
+ uno::Sequence<OUString> aBlockNames = xGroup->getElementNames();
+ uno::Sequence< OUString > aTitles = xGroup->getTitles() ;
+ SetUserData( aBlockNames.getLength(), aTitles.getConstArray(),
+ aBlockNames.getConstArray() );
+ }
+ if(pExampleFrame->IsInitialized())
+ pExampleFrame->ClearDocument( TRUE );
+ }
+ return 0;
+}
+
+/* -----------------01.10.99 11:59-------------------
+
+ --------------------------------------------------*/
+void SwVisitingCardPage::UpdateFields()
+{
+ uno::Reference< frame::XModel > xModel;
+ if( pExampleFrame && (xModel = pExampleFrame->GetModel()).is())
+ {
+ SwLabDlg::UpdateFieldInformation(xModel, aLabItem);
+ }
+}
+/* -----------------01.10.99 15:16-------------------
+
+ --------------------------------------------------*/
+void SwLabDlg::UpdateFieldInformation(uno::Reference< frame::XModel > & xModel, const SwLabItem& rItem)
+{
+ uno::Reference< text::XTextFieldsSupplier > xFlds(xModel, uno::UNO_QUERY);
+ uno::Reference< container::XNameAccess > xFldMasters = xFlds->getTextFieldMasters();
+
+ static const struct _SwLabItemMap {
+ const char* pName;
+ rtl::OUString SwLabItem:: *pValue;
+ } aArr[] = {
+ { "BC_PRIV_FIRSTNAME" , &SwLabItem::aPrivFirstName },
+ { "BC_PRIV_NAME" , &SwLabItem::aPrivName },
+ { "BC_PRIV_INITIALS" , &SwLabItem::aPrivShortCut },
+ { "BC_PRIV_FIRSTNAME_2", &SwLabItem::aPrivFirstName2 },
+ { "BC_PRIV_NAME_2" , &SwLabItem::aPrivName2 },
+ { "BC_PRIV_INITIALS_2" , &SwLabItem::aPrivShortCut2 },
+ { "BC_PRIV_STREET" , &SwLabItem::aPrivStreet },
+ { "BC_PRIV_ZIP" , &SwLabItem::aPrivZip },
+ { "BC_PRIV_CITY" , &SwLabItem::aPrivCity },
+ { "BC_PRIV_COUNTRY" , &SwLabItem::aPrivCountry },
+ { "BC_PRIV_STATE" , &SwLabItem::aPrivState },
+ { "BC_PRIV_TITLE" , &SwLabItem::aPrivTitle },
+ { "BC_PRIV_PROFESSION" , &SwLabItem::aPrivProfession },
+ { "BC_PRIV_PHONE" , &SwLabItem::aPrivPhone },
+ { "BC_PRIV_MOBILE" , &SwLabItem::aPrivMobile },
+ { "BC_PRIV_FAX" , &SwLabItem::aPrivFax },
+ { "BC_PRIV_WWW" , &SwLabItem::aPrivWWW },
+ { "BC_PRIV_MAIL" , &SwLabItem::aPrivMail },
+ { "BC_COMP_COMPANY" , &SwLabItem::aCompCompany },
+ { "BC_COMP_COMPANYEXT" , &SwLabItem::aCompCompanyExt },
+ { "BC_COMP_SLOGAN" , &SwLabItem::aCompSlogan },
+ { "BC_COMP_STREET" , &SwLabItem::aCompStreet },
+ { "BC_COMP_ZIP" , &SwLabItem::aCompZip },
+ { "BC_COMP_CITY" , &SwLabItem::aCompCity },
+ { "BC_COMP_COUNTRY" , &SwLabItem::aCompCountry },
+ { "BC_COMP_STATE" , &SwLabItem::aCompState },
+ { "BC_COMP_POSITION" , &SwLabItem::aCompPosition },
+ { "BC_COMP_PHONE" , &SwLabItem::aCompPhone },
+ { "BC_COMP_MOBILE" , &SwLabItem::aCompMobile },
+ { "BC_COMP_FAX" , &SwLabItem::aCompFax },
+ { "BC_COMP_WWW" , &SwLabItem::aCompWWW },
+ { "BC_COMP_MAIL" , &SwLabItem::aCompMail },
+ { 0, 0 }
+ };
+
+ try
+ {
+ String sFldName( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM(
+ "com.sun.star.text.FieldMaster.User." )));
+ OUString uCntName( C2U( SW_PROP_NAME_STR(UNO_NAME_CONTENT )));
+ for( const _SwLabItemMap* p = aArr; p->pName; ++p )
+ {
+ String sCurFldName( sFldName );
+ sCurFldName.AppendAscii( p->pName );
+ OUString uFldName( sCurFldName );
+ if( xFldMasters->hasByName( uFldName ))
+ {
+ uno::Any aFirstName = xFldMasters->getByName( uFldName );
+ uno::Reference< beans::XPropertySet > xFld;
+ aFirstName >>= xFld;
+ uno::Any aContent;
+ aContent <<= rItem.*p->pValue;
+ xFld->setPropertyValue( uCntName, aContent );
+ }
+ }
+ }
+ catch( uno::RuntimeException&)
+ {
+ //
+ }
+
+ uno::Reference< container::XEnumerationAccess > xFldAcc = xFlds->getTextFields();
+ uno::Reference< util::XRefreshable > xRefresh(xFldAcc, uno::UNO_QUERY);
+ xRefresh->refresh();
+}
+
diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx
new file mode 100644
index 000000000000..c39daed1729e
--- /dev/null
+++ b/sw/source/ui/envelp/labfmt.cxx
@@ -0,0 +1,712 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <tools/poly.hxx>
+#include <viewopt.hxx>
+
+#include "swtypes.hxx"
+#include "cmdid.h"
+#include "label.hxx"
+#include "labimp.hxx"
+#include "labimg.hxx"
+#include "labfmt.hxx"
+#include "uitool.hxx"
+
+#include "label.hrc"
+#include "labfmt.hrc"
+#include <unomid.h>
+
+using namespace utl;
+using namespace rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+
+// #define ------------------------------------------------------------------
+
+#define ROUND(x) ((USHORT) ((x) + .5))
+
+// --------------------------------------------------------------------------
+SwLabPreview::SwLabPreview( const SwLabFmtPage* pParent, const ResId& rResID ) :
+
+ Window((Window*) pParent, rResID),
+
+ aGrayColor(COL_LIGHTGRAY),
+
+ aHDistStr (SW_RES(STR_HDIST )),
+ aVDistStr (SW_RES(STR_VDIST )),
+ aWidthStr (SW_RES(STR_WIDTH )),
+ aHeightStr(SW_RES(STR_HEIGHT)),
+ aLeftStr (SW_RES(STR_LEFT )),
+ aUpperStr (SW_RES(STR_UPPER )),
+ aColsStr (SW_RES(STR_COLS )),
+ aRowsStr (SW_RES(STR_ROWS ))
+{
+ SetMapMode(MAP_PIXEL);
+
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ const Color& rWinColor = rStyleSettings.GetWindowColor();
+ SetBackground(Wallpaper(rWinColor));
+
+ Font aFont = GetFont();
+ aFont.SetTransparent(TRUE);
+ aFont.SetWeight (WEIGHT_NORMAL);
+ SetFont(aFont);
+
+ const Size aSz(GetOutputSizePixel());
+
+ lOutWPix = aSz.Width ();
+ lOutHPix = aSz.Height();
+
+
+ lHDistWidth = GetTextWidth(aHDistStr );
+ lVDistWidth = GetTextWidth(aVDistStr );
+ lHeightWidth = GetTextWidth(aHeightStr);
+ lLeftWidth = GetTextWidth(aLeftStr );
+ lUpperWidth = GetTextWidth(aUpperStr );
+ lColsWidth = GetTextWidth(aColsStr );
+
+ lXHeight = GetTextHeight();
+ lXWidth = GetTextWidth('X');
+
+ // Skalierungsfaktor
+ float fx = (float)(lOutWPix - (2 * (lLeftWidth + 15))) / (float)lOutWPix;
+
+ lOutWPix23 = (long)((float)lOutWPix * fx);
+ lOutHPix23 = (long)((float)lOutHPix * fx);
+}
+
+// --------------------------------------------------------------------------
+SwLabPreview::~SwLabPreview()
+{
+}
+// --------------------------------------------------------------------------
+void SwLabPreview::Paint(const Rectangle &)
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ const Color& rWinColor = rStyleSettings.GetWindowColor();
+ const Color& rFieldTextColor = SwViewOption::GetFontColor();
+
+ Font aFont = GetFont();
+ aFont.SetFillColor( rWinColor );
+ aFont.SetColor(rFieldTextColor);
+ SetFont(aFont);
+
+ SetBackground(Wallpaper(rWinColor));
+
+ SetLineColor(rWinColor);
+ SetFillColor(aGrayColor);
+ Font aPaintFont(GetFont());
+ aPaintFont.SetTransparent(FALSE);
+ SetFont(aPaintFont);
+
+ // Groesse des darzustellenden Bereichs
+ long lDispW = ROUND(aItem.lLeft + aItem.lHDist);
+ long lDispH = ROUND(aItem.lUpper + aItem.lVDist);
+ if (aItem.nCols == 1)
+ lDispW += ROUND(aItem.lLeft );
+ else
+ lDispW += ROUND(aItem.lHDist / 10);
+ if (aItem.nRows == 1)
+ lDispH += ROUND(aItem.lUpper);
+ else
+ lDispH += ROUND(aItem.lVDist / 10);
+
+ // Skalierungsfaktor
+ float fx = (float) lOutWPix23 / Max(1L, lDispW),
+ fy = (float) lOutHPix23 / Max(1L, lDispH),
+ f = fx < fy ? fx : fy;
+
+ // Nullpunkt
+ long lOutlineW = ROUND(f * lDispW);
+ long lOutlineH = ROUND(f * lDispH);
+
+ long lX0 = (lOutWPix - lOutlineW) / 2;
+ long lY0 = (lOutHPix - lOutlineH) / 2;
+ long lX1 = ROUND(lX0 + f * aItem.lLeft );
+ long lY1 = ROUND(lY0 + f * aItem.lUpper);
+ long lX2 = ROUND(lX0 + f * (aItem.lLeft + aItem.lWidth ));
+ long lY2 = ROUND(lY0 + f * (aItem.lUpper + aItem.lHeight));
+ long lX3 = ROUND(lX0 + f * (aItem.lLeft + aItem.lHDist ));
+ long lY3 = ROUND(lY0 + f * (aItem.lUpper + aItem.lVDist ));
+
+ // Umriss zeichnen (Flaeche)
+ DrawRect(Rectangle(Point(lX0, lY0), Size(lOutlineW, lOutlineH)));
+
+ // Umriss zeichnen (Umrandung)
+ SetLineColor(rFieldTextColor);
+ DrawLine(Point(lX0, lY0), Point(lX0 + lOutlineW - 1, lY0)); // Oben
+ DrawLine(Point(lX0, lY0), Point(lX0, lY0 + lOutlineH - 1)); // Links
+ if (aItem.nCols == 1)
+ DrawLine(Point(lX0 + lOutlineW - 1, lY0), Point(lX0 + lOutlineW - 1, lY0 + lOutlineH - 1)); // Rechts
+ if (aItem.nRows == 1)
+ DrawLine(Point(lX0, lY0 + lOutlineH - 1), Point(lX0 + lOutlineW - 1, lY0 + lOutlineH - 1)); // Unten
+
+ // Etiketten
+ SetClipRegion (Rectangle(Point(lX0, lY0), Size(lOutlineW, lOutlineH)));
+ SetFillColor(rWinColor);
+ for (USHORT nRow = 0; nRow < Min((USHORT) 2, (USHORT) aItem.nRows); nRow++)
+ for (USHORT nCol = 0; nCol < Min((USHORT) 2, (USHORT) aItem.nCols); nCol++)
+ DrawRect(Rectangle(
+ Point(ROUND(lX0 + f * (aItem.lLeft + nCol * aItem.lHDist)),
+ ROUND(lY0 + f * (aItem.lUpper + nRow * aItem.lVDist))),
+ Size (ROUND(f * aItem.lWidth ),
+ ROUND(f * aItem.lHeight))));
+ SetClipRegion();
+
+ // Beschritung: Rand links
+ if (aItem.lLeft)
+ {
+ long lX = (lX0 + lX1) / 2;
+ DrawArrow(Point(lX0, lY0 - 5), Point(lX1, lY0 - 5), FALSE);
+ DrawArrow(Point(lX, lY0 - 10), Point(lX, lY0 - 5), TRUE);
+ DrawText(Point(lX1 - lLeftWidth, lY0 - 10 - lXHeight), aLeftStr);
+ }
+
+ // Beschriftung: Rand oben
+ if (aItem.lUpper)
+ {
+ DrawArrow(Point(lX0 - 5, lY0), Point(lX0 - 5, lY1), FALSE);
+ DrawText(Point(lX0 - 10 - lUpperWidth, ROUND(lY0 + f * aItem.lUpper / 2 - lXHeight / 2)), aUpperStr);
+ }
+
+ // Beschriftung: Breite und Hoehe
+ {
+ long lX = lX2 - lXWidth / 2 - lHeightWidth / 2;
+ long lY = lY1 + lXHeight;
+
+ DrawLine(Point(lX1, lY), Point(lX2 - 1, lY));
+ DrawLine(Point(lX, lY1), Point(lX, lY2 - 1));
+
+ DrawText(Point(lX1 + lXWidth / 2, lY - lXHeight / 2), aWidthStr);
+ DrawText(Point(lX - lHeightWidth / 2, lY2 - lXHeight - lXHeight / 2), aHeightStr);
+ }
+
+ // Beschriftung: Horz. Abstand
+ if (aItem.nCols > 1)
+ {
+ long lX = (lX1 + lX3) / 2;
+ DrawArrow(Point(lX1, lY0 - 5), Point(lX3, lY0 - 5), FALSE);
+ DrawArrow(Point(lX, lY0 - 10), Point(lX, lY0 - 5), TRUE);
+ DrawText(Point(lX - lHDistWidth / 2, lY0 - 10 - lXHeight), aHDistStr);
+ }
+
+ // Beschriftung: Vertikaler Abstand
+ if (aItem.nRows > 1)
+ {
+ DrawArrow(Point(lX0 - 5, lY1), Point(lX0 - 5, lY3), FALSE);
+ DrawText(Point(lX0 - 10 - lVDistWidth, ROUND(lY1 + f * aItem.lVDist / 2 - lXHeight / 2)), aVDistStr);
+ }
+
+ // Beschriftung: Spalten
+ {
+ long lY = lY0 + lOutlineH + 4;
+ DrawArrow(Point(lX0, lY), Point(lX0 + lOutlineW - 1, lY), TRUE);
+ DrawText(Point((lX0 + lX0 + lOutlineW - 1) / 2 - lColsWidth / 2, lY + 5), aColsStr);
+ }
+
+ // Beschriftung: Zeilen
+ {
+ long lX = lX0 + lOutlineW + 4;
+ DrawArrow(Point(lX, lY0), Point(lX, lY0 + lOutlineH - 1), TRUE);
+ DrawText(Point(lX + 5, (lY0 + lY0 + lOutlineH - 1 - lXHeight / 2) / 2), aRowsStr);
+ }
+}
+
+// Pfeil bzw. Intervall zeichnen --------------------------------------------
+
+
+
+void SwLabPreview::DrawArrow(const Point &rP1, const Point &rP2, BOOL bArrow)
+{
+ DrawLine(rP1, rP2);
+
+ if (bArrow)
+ {
+ Point aArr[3];
+
+ // Pfeil zeichnen
+ if (rP1.Y() == rP2.Y())
+ {
+ // Waagerecht
+ aArr[0].X() = rP2.X() - 5;
+ aArr[0].Y() = rP2.Y() - 2;
+ aArr[1].X() = rP2.X();
+ aArr[1].Y() = rP2.Y();
+ aArr[2].X() = rP2.X() - 5;
+ aArr[2].Y() = rP2.Y() + 2;
+ }
+ else
+ {
+ // Senkrecht
+ aArr[0].X() = rP2.X() - 2;
+ aArr[0].Y() = rP2.Y() - 5;
+ aArr[1].X() = rP2.X() + 2;
+ aArr[1].Y() = rP2.Y() - 5;
+ aArr[2].X() = rP2.X();
+ aArr[2].Y() = rP2.Y();
+ }
+
+ const Color& rFieldTextColor = SwViewOption::GetFontColor();
+ SetFillColor(rFieldTextColor);
+ DrawPolygon(Polygon(3, aArr));
+ }
+ else
+ {
+ // Intervall zeichnen
+ if (rP1.Y() == rP2.Y())
+ {
+ // Waagerecht
+ DrawLine(Point(rP1.X(), rP1.Y() - 2), Point(rP1.X(), rP1.Y() + 2));
+ DrawLine(Point(rP2.X(), rP2.Y() - 2), Point(rP2.X(), rP2.Y() + 2));
+ }
+ else
+ {
+ // Senkrecht
+ DrawLine(Point(rP1.X() - 2, rP1.Y()), Point(rP1.X() + 2, rP1.Y()));
+ DrawLine(Point(rP2.X() - 2, rP2.Y()), Point(rP2.X() + 2, rP2.Y()));
+ }
+ }
+}
+
+// --------------------------------------------------------------------------
+
+void SwLabPreview::Update(const SwLabItem& rItem)
+{
+ aItem = rItem;
+ Invalidate();
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SwLabFmtPage::SwLabFmtPage(Window* pParent, const SfxItemSet& rSet) :
+
+ SfxTabPage(pParent, SW_RES(TP_LAB_FMT), rSet),
+ aMakeFI (this, SW_RES(FI_MAKE)),
+ aTypeFI (this, SW_RES(FI_TYPE)),
+ aPreview (this, SW_RES(WIN_PREVIEW)),
+ aHDistText (this, SW_RES(TXT_HDIST )),
+ aHDistField (this, SW_RES(FLD_HDIST )),
+ aVDistText (this, SW_RES(TXT_VDIST )),
+ aVDistField (this, SW_RES(FLD_VDIST )),
+ aWidthText (this, SW_RES(TXT_WIDTH )),
+ aWidthField (this, SW_RES(FLD_WIDTH )),
+ aHeightText (this, SW_RES(TXT_HEIGHT )),
+ aHeightField (this, SW_RES(FLD_HEIGHT )),
+ aLeftText (this, SW_RES(TXT_LEFT )),
+ aLeftField (this, SW_RES(FLD_LEFT )),
+ aUpperText (this, SW_RES(TXT_UPPER )),
+ aUpperField (this, SW_RES(FLD_UPPER )),
+ aColsText (this, SW_RES(TXT_COLUMNS)),
+ aColsField (this, SW_RES(FLD_COLUMNS)),
+ aRowsText (this, SW_RES(TXT_ROWS )),
+ aRowsField (this, SW_RES(FLD_ROWS )),
+ aSavePB (this, SW_RES(PB_SAVE )),
+ bModified(FALSE),
+ aItem ((const SwLabItem&) rSet.Get(FN_LABEL))
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ // Metriken
+ FieldUnit aMetric = ::GetDfltMetric(FALSE);
+ SetMetric(aHDistField , aMetric);
+ SetMetric(aVDistField , aMetric);
+ SetMetric(aWidthField , aMetric);
+ SetMetric(aHeightField, aMetric);
+ SetMetric(aLeftField , aMetric);
+ SetMetric(aUpperField , aMetric);
+
+ // Handler installieren
+ Link aLk = LINK(this, SwLabFmtPage, ModifyHdl);
+ aHDistField .SetModifyHdl( aLk );
+ aVDistField .SetModifyHdl( aLk );
+ aWidthField .SetModifyHdl( aLk );
+ aHeightField.SetModifyHdl( aLk );
+ aLeftField .SetModifyHdl( aLk );
+ aUpperField .SetModifyHdl( aLk );
+ aColsField .SetModifyHdl( aLk );
+ aRowsField .SetModifyHdl( aLk );
+
+ aLk = LINK(this, SwLabFmtPage, LoseFocusHdl);
+ aHDistField .SetLoseFocusHdl( aLk );
+ aVDistField .SetLoseFocusHdl( aLk );
+ aWidthField .SetLoseFocusHdl( aLk );
+ aHeightField.SetLoseFocusHdl( aLk );
+ aLeftField .SetLoseFocusHdl( aLk );
+ aUpperField .SetLoseFocusHdl( aLk );
+ aColsField .SetLoseFocusHdl( aLk );
+ aRowsField .SetLoseFocusHdl( aLk );
+
+ aSavePB.SetClickHdl( LINK (this, SwLabFmtPage, SaveHdl));
+ // Timer einstellen
+ aPreviewTimer.SetTimeout(1000);
+ aPreviewTimer.SetTimeoutHdl(LINK(this, SwLabFmtPage, PreviewHdl));
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SwLabFmtPage::~SwLabFmtPage()
+{
+}
+
+// Modify-Handler der MetricFields. Preview-Timer starten -------------------
+
+
+
+IMPL_LINK_INLINE_START( SwLabFmtPage, ModifyHdl, Edit *, EMPTYARG )
+{
+ bModified = TRUE;
+ aPreviewTimer.Start();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwLabFmtPage, ModifyHdl, Edit *, EMPTYARG )
+
+// Preview invalidaten ------------------------------------------------------
+
+
+
+IMPL_LINK_INLINE_START( SwLabFmtPage, PreviewHdl, Timer *, EMPTYARG )
+{
+ aPreviewTimer.Stop();
+ ChangeMinMax();
+ FillItem( aItem );
+ aPreview.Update( aItem );
+
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwLabFmtPage, PreviewHdl, Timer *, EMPTYARG )
+
+// LoseFocus-Handler: Bei Aenderung sofort updaten --------------------------
+
+
+
+IMPL_LINK_INLINE_START( SwLabFmtPage, LoseFocusHdl, Control *, pControl )
+{
+ if (((Edit*) pControl)->IsModified())
+ PreviewHdl(0);
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwLabFmtPage, LoseFocusHdl, Control *, pControl )
+
+// Minima und Maxima fuer Fields festlegen ----------------------------------
+
+
+void SwLabFmtPage::ChangeMinMax()
+{
+ long lMax = 31748; // 56 cm
+
+ // Min und Max
+
+ long lLeft = static_cast< long >(GETFLDVAL(aLeftField )),
+ lUpper = static_cast< long >(GETFLDVAL(aUpperField)),
+ lHDist = static_cast< long >(GETFLDVAL(aHDistField)),
+ lVDist = static_cast< long >(GETFLDVAL(aVDistField));
+
+ long nMinSize = 10; // 0,1cm
+
+ aHDistField .SetMin(nMinSize, FUNIT_CM);
+ aVDistField .SetMin(nMinSize, FUNIT_CM);
+
+ aHDistField .SetMax((long) 100 * ((lMax - lLeft ) / Max(1L, (long) aColsField.GetValue())), FUNIT_TWIP);
+ aVDistField .SetMax((long) 100 * ((lMax - lUpper) / Max(1L, (long) aRowsField.GetValue())), FUNIT_TWIP);
+
+ aWidthField .SetMin(nMinSize, FUNIT_CM);
+ aHeightField.SetMin(nMinSize, FUNIT_CM);
+
+ aWidthField .SetMax((long) 100 * (lHDist), FUNIT_TWIP);
+ aHeightField.SetMax((long) 100 * (lVDist), FUNIT_TWIP);
+
+ aLeftField .SetMax((long) 100 * (lMax - (long) aColsField.GetValue() * GETFLDVAL(aHDistField)), FUNIT_TWIP);
+ aUpperField .SetMax((long) 100 * (lMax - (long) aRowsField.GetValue() * GETFLDVAL(aVDistField)), FUNIT_TWIP);
+
+ aColsField .SetMax((lMax - lLeft ) / Max(1L, lHDist));
+ aRowsField .SetMax((lMax - lUpper) / Max(1L, lVDist));
+
+ // First und Last
+
+ aHDistField .SetFirst(aHDistField .GetMin());
+ aVDistField .SetFirst(aVDistField .GetMin());
+
+ aHDistField .SetLast (aHDistField .GetMax());
+ aVDistField .SetLast (aVDistField .GetMax());
+
+ aWidthField .SetFirst(aWidthField .GetMin());
+ aHeightField.SetFirst(aHeightField.GetMin());
+
+ aWidthField .SetLast (aWidthField .GetMax());
+ aHeightField.SetLast (aHeightField.GetMax());
+
+ aLeftField .SetLast (aLeftField .GetMax());
+ aUpperField .SetLast (aUpperField .GetMax());
+
+ aColsField .SetLast (aColsField .GetMax());
+ aRowsField .SetLast (aRowsField .GetMax());
+
+ aHDistField .Reformat();
+ aVDistField .Reformat();
+ aWidthField .Reformat();
+ aHeightField.Reformat();
+ aLeftField .Reformat();
+ aUpperField .Reformat();
+ aColsField .Reformat();
+ aRowsField .Reformat();
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SfxTabPage* SwLabFmtPage::Create(Window* pParent, const SfxItemSet& rSet)
+{
+ return new SwLabFmtPage(pParent, rSet);
+}
+
+// ----------------------------------------------------------------------------
+
+
+
+void SwLabFmtPage::ActivatePage(const SfxItemSet& rSet)
+{
+ SfxItemSet aSet(rSet);
+ Reset(aSet);
+}
+
+// ----------------------------------------------------------------------------
+
+
+
+int SwLabFmtPage::DeactivatePage(SfxItemSet* _pSet)
+{
+ if (_pSet)
+ FillItemSet(*_pSet);
+
+ return TRUE;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+void SwLabFmtPage::FillItem(SwLabItem& rItem)
+{
+ if (bModified)
+ {
+ rItem.aMake = rItem.aType = SW_RESSTR(STR_CUSTOM);
+
+ SwLabRec& rRec = *GetParent()->Recs()[0];
+ rItem.lHDist = rRec.lHDist = static_cast< long >(GETFLDVAL(aHDistField ));
+ rItem.lVDist = rRec.lVDist = static_cast< long >(GETFLDVAL(aVDistField ));
+ rItem.lWidth = rRec.lWidth = static_cast< long >(GETFLDVAL(aWidthField ));
+ rItem.lHeight = rRec.lHeight = static_cast< long >(GETFLDVAL(aHeightField));
+ rItem.lLeft = rRec.lLeft = static_cast< long >(GETFLDVAL(aLeftField ));
+ rItem.lUpper = rRec.lUpper = static_cast< long >(GETFLDVAL(aUpperField ));
+ rItem.nCols = rRec.nCols = (USHORT) aColsField.GetValue();
+ rItem.nRows = rRec.nRows = (USHORT) aRowsField.GetValue();
+ }
+}
+
+// --------------------------------------------------------------------------
+
+
+
+BOOL SwLabFmtPage::FillItemSet(SfxItemSet& rSet)
+{
+ FillItem(aItem);
+ rSet.Put(aItem);
+
+ return TRUE;
+}
+
+// --------------------------------------------------------------------------
+void SwLabFmtPage::Reset(const SfxItemSet& )
+{
+ // Fields initialisieren
+ GetParent()->GetLabItem(aItem);
+
+ aHDistField .SetMax(100 * aItem.lHDist , FUNIT_TWIP);
+ aVDistField .SetMax(100 * aItem.lVDist , FUNIT_TWIP);
+ aWidthField .SetMax(100 * aItem.lWidth , FUNIT_TWIP);
+ aHeightField.SetMax(100 * aItem.lHeight, FUNIT_TWIP);
+ aLeftField .SetMax(100 * aItem.lLeft , FUNIT_TWIP);
+ aUpperField .SetMax(100 * aItem.lUpper , FUNIT_TWIP);
+
+ SETFLDVAL(aHDistField , aItem.lHDist );
+ SETFLDVAL(aVDistField , aItem.lVDist );
+ SETFLDVAL(aWidthField , aItem.lWidth );
+ SETFLDVAL(aHeightField, aItem.lHeight);
+ SETFLDVAL(aLeftField , aItem.lLeft );
+ SETFLDVAL(aUpperField , aItem.lUpper );
+
+ aColsField.SetMax(aItem.nCols);
+ aRowsField.SetMax(aItem.nRows);
+
+ aColsField .SetValue(aItem.nCols);
+ aRowsField .SetValue(aItem.nRows);
+ aMakeFI.SetText(aItem.aMake);
+ aTypeFI.SetText(aItem.aType);
+ PreviewHdl(0);
+}
+/* -----------------------------22.01.01 15:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+IMPL_LINK( SwLabFmtPage, SaveHdl, PushButton *, EMPTYARG )
+{
+ SwLabRec aRec;
+ aRec.lHDist = static_cast< long >(GETFLDVAL(aHDistField ));
+ aRec.lVDist = static_cast< long >(GETFLDVAL(aVDistField ));
+ aRec.lWidth = static_cast< long >(GETFLDVAL(aWidthField ));
+ aRec.lHeight = static_cast< long >(GETFLDVAL(aHeightField));
+ aRec.lLeft = static_cast< long >(GETFLDVAL(aLeftField ));
+ aRec.lUpper = static_cast< long >(GETFLDVAL(aUpperField ));
+ aRec.nCols = (USHORT) aColsField.GetValue();
+ aRec.nRows = (USHORT) aRowsField.GetValue();
+ aRec.bCont = aItem.bCont;
+ SwSaveLabelDlg* pSaveDlg = new SwSaveLabelDlg(this, aRec);
+ pSaveDlg->SetLabel(aItem.aLstMake, aItem.aLstType);
+ pSaveDlg->Execute();
+ if(pSaveDlg->GetLabel(aItem))
+ {
+ bModified = FALSE;
+ const Sequence<OUString>& rMan = GetParent()->GetLabelsConfig().GetManufacturers();
+ SvStringsDtor& rMakes = GetParent()->Makes();
+ if(rMakes.Count() < (USHORT)rMan.getLength())
+ {
+ rMakes.DeleteAndDestroy(0, rMakes.Count());
+ const OUString* pMan = rMan.getConstArray();
+ for(sal_Int32 nMan = 0; nMan < rMan.getLength(); nMan++)
+ {
+ rMakes.Insert( new String(pMan[nMan]), rMakes.Count() );
+ }
+ }
+ aMakeFI.SetText(aItem.aMake);
+ aTypeFI.SetText(aItem.aType);
+ }
+ delete pSaveDlg;
+ return 0;
+}
+/* -----------------------------23.01.01 10:41--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwSaveLabelDlg::SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec) :
+ ModalDialog(pParent, SW_RES(DLG_SAVE_LABEL)),
+ aOptionsFL(this,SW_RES(FL_OPTIONS )),
+ aMakeFT(this, SW_RES(FT_MAKE )),
+ aMakeCB(this, SW_RES(CB_MAKE )),
+ aTypeFT(this, SW_RES(FT_TYPE )),
+ aTypeED(this, SW_RES(ED_TYPE )),
+
+ aOKPB(this, SW_RES(PB_OK )),
+ aCancelPB(this, SW_RES(PB_CANCEL )),
+ aHelpPB(this, SW_RES(PB_HELP )),
+
+ aQueryMB(this, SW_RES(MB_QUERY )),
+
+ bSuccess(sal_False),
+ pLabPage(pParent),
+ rLabRec(rRec)
+{
+ FreeResource();
+
+ aOKPB.SetClickHdl(LINK(this, SwSaveLabelDlg, OkHdl));
+ Link aLk(LINK(this, SwSaveLabelDlg, ModifyHdl));
+ aMakeCB.SetModifyHdl(aLk);
+ aTypeED.SetModifyHdl(aLk);
+
+ SwLabelConfig& rCfg = pLabPage->GetParent()->GetLabelsConfig();
+ const Sequence<OUString>& rMan = rCfg.GetManufacturers();
+ const OUString* pMan = rMan.getConstArray();
+ for(sal_Int32 i = 0; i < rMan.getLength(); i++)
+ aMakeCB.InsertEntry(pMan[i]);
+}
+/* -----------------------------23.01.01 10:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwSaveLabelDlg, OkHdl, OKButton*, EMPTYARG)
+{
+ SwLabelConfig& rCfg = pLabPage->GetParent()->GetLabelsConfig();
+ String sMake(aMakeCB.GetText());
+ String sType(aTypeED.GetText());
+ if(rCfg.HasLabel(sMake, sType))
+ {
+ String sTmp(aQueryMB.GetMessText());
+ String sQuery(sTmp);
+ sQuery.SearchAndReplace(C2S("%1"), sMake);
+ sQuery.SearchAndReplace(C2S("%2"), sType);
+ aQueryMB.SetMessText(sQuery);
+
+ short eRet = aQueryMB.Execute();
+ aQueryMB.SetMessText(sTmp);
+ if(RET_YES != eRet)
+ return 0;
+ }
+ rLabRec.aType = sType;
+ rCfg.SaveLabel(sMake, sType, rLabRec);
+ bSuccess = sal_True;
+ EndDialog(RET_OK);
+ return 0;
+}
+/* -----------------------------23.01.01 11:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwSaveLabelDlg, ModifyHdl, Edit*, EMPTYARG)
+{
+ aOKPB.Enable(aMakeCB.GetText().Len() && aTypeED.GetText().Len());
+ return 0;
+}
+/* -----------------------------23.01.01 16:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwSaveLabelDlg::GetLabel(SwLabItem& rItem)
+{
+ if(bSuccess)
+ {
+ rItem.aMake = aMakeCB.GetText();
+ rItem.aType = aTypeED.GetText();
+ rItem.lHDist = rLabRec.lHDist;
+ rItem.lVDist = rLabRec.lVDist;
+ rItem.lWidth = rLabRec.lWidth;
+ rItem.lHeight = rLabRec.lHeight;
+ rItem.lLeft = rLabRec.lLeft;
+ rItem.lUpper = rLabRec.lUpper;
+ rItem.nCols = rLabRec.nCols;
+ rItem.nRows = rLabRec.nRows;
+ }
+ return bSuccess;
+}
+
diff --git a/sw/source/ui/envelp/labfmt.hrc b/sw/source/ui/envelp/labfmt.hrc
new file mode 100644
index 000000000000..ae6786dce3a9
--- /dev/null
+++ b/sw/source/ui/envelp/labfmt.hrc
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _LABFMT_HRC
+#define _LABFMT_HRC
+
+// #include *****************************************************************
+
+#include "envelp.hrc"
+
+// Lokale Resourcen *********************************************************
+
+#define WIN_PREVIEW 1
+#define TXT_HDIST 2
+#define FLD_HDIST 3
+#define TXT_VDIST 4
+#define FLD_VDIST 5
+#define TXT_WIDTH 6
+#define FLD_WIDTH 7
+#define TXT_HEIGHT 8
+#define FLD_HEIGHT 9
+#define TXT_LEFT 10
+#define FLD_LEFT 11
+#define TXT_UPPER 12
+#define FLD_UPPER 13
+#define TXT_COLUMNS 14
+#define FLD_COLUMNS 15
+#define TXT_ROWS 16
+#define FLD_ROWS 17
+#define FL_NONAME 18
+#define PB_SAVE 19
+#define FI_MAKE 20
+#define FI_TYPE 21
+
+#define FL_OPTIONS 1
+#define FT_MAKE 2
+#define CB_MAKE 3
+#define FT_TYPE 4
+#define ED_TYPE 5
+#define PB_OK 6
+#define PB_CANCEL 7
+#define PB_HELP 8
+#define MB_QUERY 9
+
+// Globale Resourcen ********************************************************
+
+#define STR_HDIST (RC_LABFMT_BEGIN + 1)
+#define STR_VDIST (RC_LABFMT_BEGIN + 2)
+#define STR_WIDTH (RC_LABFMT_BEGIN + 3)
+#define STR_HEIGHT (RC_LABFMT_BEGIN + 4)
+#define STR_LEFT (RC_LABFMT_BEGIN + 5)
+#define STR_UPPER (RC_LABFMT_BEGIN + 6)
+#define STR_COLS (RC_LABFMT_BEGIN + 7)
+#define STR_ROWS (RC_LABFMT_BEGIN + 8)
+
+// Ueberlaufpruefung ********************************************************
+
+#define LABFMT_ACT_END STR_ROWS
+
+#if LABFMT_ACT_END > RC_LABFMT_END
+#error Resource-Ueberlauf in #file, #line
+#endif
+
+#endif
+
diff --git a/sw/source/ui/envelp/labfmt.hxx b/sw/source/ui/envelp/labfmt.hxx
new file mode 100644
index 000000000000..ebe7ab46dc81
--- /dev/null
+++ b/sw/source/ui/envelp/labfmt.hxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _LABFMT_HXX
+#define _LABFMT_HXX
+
+#include "swuilabimp.hxx"
+#include "labimg.hxx"
+#include <vcl/msgbox.hxx>
+class SwLabFmtPage;
+
+// class SwLabPreview -------------------------------------------------------
+
+class SwLabPreview : public Window
+{
+ long lOutWPix;
+ long lOutHPix;
+ long lOutWPix23;
+ long lOutHPix23;
+
+ Color aGrayColor;
+
+ String aHDistStr;
+ String aVDistStr;
+ String aWidthStr;
+ String aHeightStr;
+ String aLeftStr;
+ String aUpperStr;
+ String aColsStr;
+ String aRowsStr;
+
+ long lHDistWidth;
+ long lVDistWidth;
+ long lHeightWidth;
+ long lLeftWidth;
+ long lUpperWidth;
+ long lColsWidth;
+
+ long lXWidth;
+ long lXHeight;
+
+ SwLabItem aItem;
+
+ void Paint(const Rectangle&);
+
+ void DrawArrow(const Point& rP1, const Point& rP2, BOOL bArrow);
+
+ using Window::GetParent;
+ SwLabFmtPage* GetParent() {return (SwLabFmtPage*) Window::GetParent();}
+
+ using Window::Update;
+
+public:
+
+ SwLabPreview(const SwLabFmtPage* pParent, const ResId& rResID);
+ ~SwLabPreview();
+
+ void Update(const SwLabItem& rItem);
+};
+
+// class SwLabFmtPage -------------------------------------------------------
+
+class SwLabFmtPage : public SfxTabPage
+{
+ FixedInfo aMakeFI;
+ FixedInfo aTypeFI;
+ SwLabPreview aPreview;
+ FixedText aHDistText;
+ MetricField aHDistField;
+ FixedText aVDistText;
+ MetricField aVDistField;
+ FixedText aWidthText;
+ MetricField aWidthField;
+ FixedText aHeightText;
+ MetricField aHeightField;
+ FixedText aLeftText;
+ MetricField aLeftField;
+ FixedText aUpperText;
+ MetricField aUpperField;
+ FixedText aColsText;
+ NumericField aColsField;
+ FixedText aRowsText;
+ NumericField aRowsField;
+ PushButton aSavePB;
+
+ Timer aPreviewTimer;
+ BOOL bModified;
+
+ SwLabItem aItem;
+
+ SwLabFmtPage(Window* pParent, const SfxItemSet& rSet);
+ ~SwLabFmtPage();
+
+ DECL_LINK( ModifyHdl, Edit * );
+ DECL_LINK( PreviewHdl, Timer * );
+ DECL_LINK( LoseFocusHdl, Control * );
+ DECL_LINK( SaveHdl, PushButton* );
+
+ void ChangeMinMax();
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+ using Window::GetParent;
+
+public:
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet* pSet = 0);
+ void FillItem(SwLabItem& rItem);
+ virtual BOOL FillItemSet(SfxItemSet& rSet);
+ virtual void Reset(const SfxItemSet& rSet);
+
+ SwLabDlg* GetParent() {return (SwLabDlg*) SfxTabPage::GetParent()->GetParent();}
+};
+/* -----------------------------23.01.01 10:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwSaveLabelDlg : public ModalDialog
+{
+ FixedLine aOptionsFL;
+ FixedText aMakeFT;
+ ComboBox aMakeCB;
+ FixedText aTypeFT;
+ Edit aTypeED;
+
+ OKButton aOKPB;
+ CancelButton aCancelPB;
+ HelpButton aHelpPB;
+
+ QueryBox aQueryMB;
+
+ sal_Bool bSuccess;
+ SwLabFmtPage* pLabPage;
+ SwLabRec& rLabRec;
+
+ DECL_LINK(OkHdl, OKButton*);
+ DECL_LINK(ModifyHdl, Edit*);
+
+public:
+ SwSaveLabelDlg(SwLabFmtPage* pParent, SwLabRec& rRec);
+
+ void SetLabel(const rtl::OUString& rMake, const rtl::OUString& rType)
+ {
+ aMakeCB.SetText(String(rMake));
+ aTypeED.SetText(String(rType));
+ }
+ sal_Bool GetLabel(SwLabItem& rItem);
+};
+#endif
+
diff --git a/sw/source/ui/envelp/labfmt.src b/sw/source/ui/envelp/labfmt.src
new file mode 100644
index 000000000000..58605e3db43d
--- /dev/null
+++ b/sw/source/ui/envelp/labfmt.src
@@ -0,0 +1,370 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // #pragma ******************************************************************
+
+ // #include *****************************************************************
+#include "labfmt.hrc"
+#include "helpid.h"
+ // TP_LAB_FMT ---------------------------------------------------------------
+TabPage TP_LAB_FMT
+{
+ HelpID = HID_LAB_FMT ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedText FI_MAKE
+ {
+ Pos = MAP_APPFONT ( 108 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ };
+ FixedText FI_TYPE
+ {
+ Pos = MAP_APPFONT ( 162 , 6 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ };
+ Window WIN_PREVIEW
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 108 , 17 ) ;
+ Size = MAP_APPFONT ( 146 , 161 ) ;
+ };
+ FixedText TXT_HDIST
+ {
+ Pos = MAP_APPFONT ( 6 , 19 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Hori~zontal pitch" ;
+ Group = TRUE ;
+ Left = TRUE ;
+ };
+ MetricField FLD_HDIST
+ {
+ HelpID = "sw:MetricField:TP_LAB_FMT:FLD_HDIST";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 17 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Repeat = TRUE ;
+ SpinSize = 10 ;
+ };
+ FixedText TXT_VDIST
+ {
+ Pos = MAP_APPFONT ( 6 , 35 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Vertical pitch" ;
+ Left = TRUE ;
+ };
+ MetricField FLD_VDIST
+ {
+ HelpID = "sw:MetricField:TP_LAB_FMT:FLD_VDIST";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 33 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Repeat = TRUE ;
+ SpinSize = 10 ;
+ };
+ FixedText TXT_WIDTH
+ {
+ Pos = MAP_APPFONT ( 6 , 51 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Width" ;
+ Left = TRUE ;
+ };
+ MetricField FLD_WIDTH
+ {
+ HelpID = "sw:MetricField:TP_LAB_FMT:FLD_WIDTH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 49 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Repeat = TRUE ;
+ SpinSize = 10 ;
+ };
+ FixedText TXT_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 6 , 67 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Height" ;
+ Left = TRUE ;
+ };
+ MetricField FLD_HEIGHT
+ {
+ HelpID = "sw:MetricField:TP_LAB_FMT:FLD_HEIGHT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 65 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Repeat = TRUE ;
+ SpinSize = 10 ;
+ };
+ FixedText TXT_LEFT
+ {
+ Pos = MAP_APPFONT ( 6 , 83 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Left margin" ;
+ Left = TRUE ;
+ };
+ MetricField FLD_LEFT
+ {
+ HelpID = "sw:MetricField:TP_LAB_FMT:FLD_LEFT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 81 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Repeat = TRUE ;
+ Minimum = 0 ;
+ First = 0 ;
+ SpinSize = 10 ;
+ };
+ FixedText TXT_UPPER
+ {
+ Pos = MAP_APPFONT ( 6 , 99 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Top margin" ;
+ Left = TRUE ;
+ };
+ MetricField FLD_UPPER
+ {
+ HelpID = "sw:MetricField:TP_LAB_FMT:FLD_UPPER";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 97 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Repeat = TRUE ;
+ Minimum = 0 ;
+ First = 0 ;
+ SpinSize = 10 ;
+ };
+ FixedText TXT_COLUMNS
+ {
+ Pos = MAP_APPFONT ( 6 , 115 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Columns" ;
+ Left = TRUE ;
+ };
+ NumericField FLD_COLUMNS
+ {
+ HelpID = "sw:NumericField:TP_LAB_FMT:FLD_COLUMNS";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 113 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ First = 1 ;
+ };
+ FixedText TXT_ROWS
+ {
+ Pos = MAP_APPFONT ( 6 , 131 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "R~ows" ;
+ Left = TRUE ;
+ };
+ NumericField FLD_ROWS
+ {
+ HelpID = "sw:NumericField:TP_LAB_FMT:FLD_ROWS";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 60 , 129 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ First = 1 ;
+ };
+ PushButton PB_SAVE
+ {
+ HelpID = "sw:PushButton:TP_LAB_FMT:PB_SAVE";
+ Pos = MAP_APPFONT ( 50 , 148 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Save...";
+ };
+};
+ // String *******************************************************************
+String STR_HDIST
+{
+ Text [ en-US ] = "H. Pitch" ;
+};
+String STR_VDIST
+{
+ Text [ en-US ] = "V. Pitch" ;
+};
+String STR_WIDTH
+{
+ Text [ en-US ] = "Width" ;
+};
+String STR_HEIGHT
+{
+ Text [ en-US ] = "Height" ;
+};
+String STR_LEFT
+{
+ Text [ en-US ] = "Left margin" ;
+};
+String STR_UPPER
+{
+ Text [ en-US ] = "Top margin" ;
+};
+String STR_COLS
+{
+ Text [ en-US ] = "Columns" ;
+};
+String STR_ROWS
+{
+ Text [ en-US ] = "Rows" ;
+};
+ModalDialog DLG_SAVE_LABEL
+{
+ HelpID = HID_SAVE_LABEL_DLG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 230 , 60 ) ;
+ Moveable = TRUE ;
+ FixedText FT_MAKE
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "Brand" ;
+ Left = TRUE ;
+ };
+ ComboBox CB_MAKE
+ {
+ HelpID = "sw:ComboBox:DLG_SAVE_LABEL:CB_MAKE";
+ Pos = MAP_APPFONT ( 65 , 15 ) ;
+ Size = MAP_APPFONT ( 100 , 50 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ };
+ FixedText FT_TYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 31 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "T~ype" ;
+ Left = TRUE ;
+ };
+ Edit ED_TYPE
+ {
+ HelpID = "sw:Edit:DLG_SAVE_LABEL:ED_TYPE";
+ Pos = MAP_APPFONT ( 65 , 30 ) ;
+ Size = MAP_APPFONT ( 100 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 165 , 8 ) ;
+ Text [ en-US ] = "Options";
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 174 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 174 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 174 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ QueryBox MB_QUERY
+ {
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_CANCEL ;
+ Message [ en-US ] = "The label \"%1 / %2\" already exists.\nDo you want to overwrite it?";
+ };
+ Text [ en-US ] = "Save Label Format";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/envelp/labimg.cxx b/sw/source/ui/envelp/labimg.cxx
new file mode 100644
index 000000000000..0be179372ca5
--- /dev/null
+++ b/sw/source/ui/envelp/labimg.cxx
@@ -0,0 +1,482 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <tools/stream.hxx>
+#ifndef _RESID_HXX //autogen
+#include <tools/resid.hxx>
+#endif
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <unotools/useroptions.hxx>
+#include <tools/shl.hxx>
+#include <swmodule.hxx>
+#include "labimg.hxx"
+#include "cmdid.h"
+#include "swtypes.hxx"
+#include <unomid.h>
+
+using namespace utl;
+using namespace rtl;
+using namespace ::com::sun::star::uno;
+
+
+// ----------------------------------------------------------------------------
+SwLabItem::SwLabItem() :
+
+ SfxPoolItem(FN_LABEL),
+ lLeft (0),
+ lUpper(0),
+ nCols (1),
+ nRows (1),
+ nCol (1),
+ nRow (1)
+{
+ bAddr = bCont = bSynchron = FALSE;
+ bPage = TRUE;
+ lHDist =
+ lVDist =
+ lWidth =
+ lHeight = 5669; // 10 cm
+}
+
+// ----------------------------------------------------------------------------
+SwLabItem::SwLabItem(const SwLabItem& rItem) :
+ SfxPoolItem(FN_LABEL)
+{
+ *this = rItem;
+}
+// ----------------------------------------------------------------------------
+SwLabItem& SwLabItem::operator =(const SwLabItem& rItem)
+{
+ bAddr = rItem.bAddr;
+ aWriting = rItem.aWriting;
+ bCont = rItem.bCont;
+ sDBName = rItem.sDBName;
+ aLstMake = rItem.aLstMake;
+ aLstType = rItem.aLstType;
+ aMake = rItem.aMake;
+ aType = rItem.aType;
+ bPage = rItem.bPage;
+ bSynchron = rItem.bSynchron;
+ aBin = rItem.aBin;
+ nCol = rItem.nCol;
+ nRow = rItem.nRow;
+ lHDist = rItem.lHDist;
+ lVDist = rItem.lVDist;
+ lWidth = rItem.lWidth;
+ lHeight = rItem.lHeight;
+ lLeft = rItem.lLeft;
+ lUpper = rItem.lUpper;
+ nCols = rItem.nCols;
+ nRows = rItem.nRows;
+ aPrivFirstName = rItem.aPrivFirstName;
+ aPrivName = rItem.aPrivName;
+ aPrivShortCut = rItem.aPrivShortCut;
+ aPrivFirstName2 = rItem.aPrivFirstName2;
+ aPrivName2 = rItem.aPrivName2;
+ aPrivShortCut2 = rItem.aPrivShortCut2;
+ aPrivStreet = rItem.aPrivStreet;
+ aPrivZip = rItem.aPrivZip;
+ aPrivCity = rItem.aPrivCity;
+ aPrivCountry = rItem.aPrivCountry;
+ aPrivState = rItem.aPrivState;
+ aPrivTitle = rItem.aPrivTitle;
+ aPrivProfession = rItem.aPrivProfession;
+ aPrivPhone = rItem.aPrivPhone;
+ aPrivMobile = rItem.aPrivMobile;
+ aPrivFax = rItem.aPrivFax;
+ aPrivWWW = rItem.aPrivWWW;
+ aPrivMail = rItem.aPrivMail;
+ aCompCompany = rItem.aCompCompany;
+ aCompCompanyExt = rItem.aCompCompanyExt;
+ aCompSlogan = rItem.aCompSlogan;
+ aCompStreet = rItem.aCompStreet;
+ aCompZip = rItem.aCompZip;
+ aCompCity = rItem.aCompCity;
+ aCompCountry = rItem.aCompCountry;
+ aCompState = rItem.aCompState;
+ aCompPosition = rItem.aCompPosition;
+ aCompPhone = rItem.aCompPhone;
+ aCompMobile = rItem.aCompMobile;
+ aCompFax = rItem.aCompFax;
+ aCompWWW = rItem.aCompWWW;
+ aCompMail = rItem.aCompMail;
+ sGlossaryGroup = rItem.sGlossaryGroup;
+ sGlossaryBlockName = rItem.sGlossaryBlockName;
+ return *this;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+int SwLabItem::operator ==(const SfxPoolItem& rItem) const
+{
+ const SwLabItem& rLab = (const SwLabItem&) rItem;
+
+ return bAddr == rLab.bAddr &&
+ bCont == rLab.bCont &&
+ bPage == rLab.bPage &&
+ bSynchron == rLab.bSynchron &&
+ aBin == rLab.aBin &&
+ nCol == rLab.nCol &&
+ nRow == rLab.nRow &&
+ lHDist == rLab.lHDist &&
+ lVDist == rLab.lVDist &&
+ lWidth == rLab.lWidth &&
+ lHeight == rLab.lHeight &&
+ lLeft == rLab.lLeft &&
+ lUpper == rLab.lUpper &&
+ nCols == rLab.nCols &&
+ nRows == rLab.nRows &&
+ aWriting == rLab.aWriting&&
+ aMake == rLab.aMake &&
+ aType == rLab.aType &&
+ aLstMake == rLab.aLstMake&&
+ aLstType == rLab.aLstType&&
+ sDBName == rLab.sDBName &&
+ aPrivFirstName == rLab.aPrivFirstName&&
+ aPrivName == rLab.aPrivName&&
+ aPrivShortCut == rLab.aPrivShortCut&&
+ aPrivFirstName2 == rLab.aPrivFirstName2&&
+ aPrivName2 == rLab.aPrivName2&&
+ aPrivShortCut2 == rLab.aPrivShortCut2&&
+ aPrivStreet == rLab.aPrivStreet&&
+ aPrivZip == rLab.aPrivZip&&
+ aPrivCity == rLab.aPrivCity&&
+ aPrivCountry == rLab.aPrivCountry&&
+ aPrivState == rLab.aPrivState&&
+ aPrivTitle == rLab.aPrivTitle&&
+ aPrivProfession == rLab.aPrivProfession&&
+ aPrivPhone == rLab.aPrivPhone&&
+ aPrivMobile == rLab.aPrivMobile&&
+ aPrivFax == rLab.aPrivFax&&
+ aPrivWWW == rLab.aPrivWWW&&
+ aPrivMail == rLab.aPrivMail&&
+ aCompCompany == rLab.aCompCompany&&
+ aCompCompanyExt == rLab.aCompCompanyExt&&
+ aCompSlogan == rLab.aCompSlogan&&
+ aCompStreet == rLab.aCompStreet&&
+ aCompZip == rLab.aCompZip&&
+ aCompCity == rLab.aCompCity&&
+ aCompCountry == rLab.aCompCountry&&
+ aCompState == rLab.aCompState&&
+ aCompPosition == rLab.aCompPosition&&
+ aCompPhone == rLab.aCompPhone&&
+ aCompMobile == rLab.aCompMobile&&
+ aCompFax == rLab.aCompFax&&
+ aCompWWW == rLab.aCompWWW&&
+ aCompMail == rLab.aCompMail &&
+ sGlossaryGroup == rLab.sGlossaryGroup &&
+ sGlossaryBlockName == rLab.sGlossaryBlockName;
+}
+
+// --------------------------------------------------------------------------
+SfxPoolItem* SwLabItem::Clone(SfxItemPool*) const
+{
+ return new SwLabItem(*this);
+}
+
+/* -----------------------------25.09.00 16:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence<rtl::OUString> SwLabCfgItem::GetPropertyNames()
+{
+ static const char* aLabelPropNames[] =
+ {
+ "Medium/Continous", // 0
+ "Medium/Brand", // 1
+ "Medium/Type", // 2
+ "Format/Column", // 3
+ "Format/Row", // 4
+ "Format/HorizontalDistance",// 5
+ "Format/VerticalDistance", // 6
+ "Format/Width", // 7
+ "Format/Height", // 8
+ "Format/LeftMargin", // 9
+ "Format/TopMargin", //10
+ "Option/Synchronize", //11
+ "Option/Page", //12
+ "Option/Column", //13
+ "Option/Row", //14
+ "Inscription/UseAddress", //15
+ "Inscription/Address", //16
+ "Inscription/Database" //17
+ };
+ static const char* aBusinessPropNames[] =
+ {
+ "PrivateAddress/FirstName", // 0
+ "PrivateAddress/Name", // 1
+ "PrivateAddress/ShortCut", // 2
+ "PrivateAddress/SecondFirstName", // 3
+ "PrivateAddress/SecondName", // 4
+ "PrivateAddress/SecondShortCut", // 5
+ "PrivateAddress/Street", // 6
+ "PrivateAddress/Zip", // 7
+ "PrivateAddress/City", // 8
+ "PrivateAddress/Country", // 9
+ "PrivateAddress/State", // 10
+ "PrivateAddress/Title", // 11
+ "PrivateAddress/Profession", // 12
+ "PrivateAddress/Phone", // 13
+ "PrivateAddress/Mobile", // 14
+ "PrivateAddress/Fax", // 15
+ "PrivateAddress/WebAddress", // 16
+ "PrivateAddress/Email", // 17
+ "BusinessAddress/Company", // 18
+ "BusinessAddress/CompanyExt", // 19
+ "BusinessAddress/Slogan", // 20
+ "BusinessAddress/Street", // 21
+ "BusinessAddress/Zip", // 22
+ "BusinessAddress/City", // 23
+ "BusinessAddress/Country", // 24
+ "BusinessAddress/State", // 25
+ "BusinessAddress/Position", // 26
+ "BusinessAddress/Phone", // 27
+ "BusinessAddress/Mobile", // 28
+ "BusinessAddress/Fax", // 29
+ "BusinessAddress/WebAddress", // 30
+ "BusinessAddress/Email", // 31
+ "AutoText/Group", // 32
+ "AutoText/Block" // 33
+ };
+ const int nBusinessCount = bIsLabel ? 0 : 34;
+ const int nLabelCount = bIsLabel ? 18 : 15;
+ Sequence<OUString> aNames(nBusinessCount + nLabelCount);
+ OUString* pNames = aNames.getArray();
+ int nIndex = 0;
+ for(int nLabel = 0; nLabel < nLabelCount; nLabel++)
+ pNames[nIndex++] = OUString::createFromAscii(aLabelPropNames[nLabel]);
+ for(int nBusiness = 0; nBusiness < nBusinessCount; nBusiness++)
+ pNames[nIndex++] = OUString::createFromAscii(aBusinessPropNames[nBusiness]);
+ return aNames;
+}
+/* ----------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwLabCfgItem::SwLabCfgItem(sal_Bool bLabel) :
+ ConfigItem(bLabel ? C2U("Office.Writer/Label") : C2U("Office.Writer/BusinessCard")),
+ bIsLabel(bLabel)
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+ EnableNotification(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ sal_Bool bNoConfigValues = sal_True;
+ if(aValues.getLength() == aNames.getLength())
+ {
+ for(int nProp = 0, nProperty = 0; nProp < aNames.getLength(); nProp++, nProperty++)
+ {
+
+ if(pValues[nProp].hasValue())
+ {
+ //to have a contiuous switch an offset is added
+ if(nProp == 15 && !bIsLabel)
+ nProperty += 3;
+ if(nProperty >= 18)
+ bNoConfigValues = sal_False;
+ switch(nProperty)
+ {
+ case 0: aItem.bCont = *(sal_Bool*)pValues[nProp].getValue(); break;// "Medium/Continous",
+ case 1: pValues[nProp] >>= aItem.aMake; break;// "Medium/Brand",
+ case 2: pValues[nProp] >>= aItem.aType; break;// "Medium/Type",
+ case 3: pValues[nProp] >>= aItem.nCols; break;// "Format/Column",
+ case 4: pValues[nProp] >>= aItem.nRows; break;// "Format/Row",
+ case 5:
+ pValues[nProp] >>= aItem.lHDist;
+ aItem.lHDist = MM100_TO_TWIP(aItem.lHDist);
+ break;// "Format/HorizontalDistance",
+ case 6:
+ pValues[nProp] >>= aItem.lVDist;
+ aItem.lVDist = MM100_TO_TWIP(aItem.lVDist);
+ break;// "Format/VerticalDistance",
+ case 7:
+ pValues[nProp] >>= aItem.lWidth;
+ aItem.lWidth = MM100_TO_TWIP(aItem.lWidth);
+ break;// "Format/Width",
+ case 8:
+ pValues[nProp] >>= aItem.lHeight;
+ aItem.lHeight = MM100_TO_TWIP(aItem.lHeight);
+ break;// "Format/Height",
+ case 9:
+ pValues[nProp] >>= aItem.lLeft;
+ aItem.lLeft = MM100_TO_TWIP(aItem.lLeft);
+ break;// "Format/LeftMargin",
+ case 10:
+ pValues[nProp] >>= aItem.lUpper;
+ aItem.lUpper = MM100_TO_TWIP(aItem.lUpper);
+ break;// "Format/TopMargin",
+ case 11: aItem.bSynchron = *(sal_Bool*)pValues[nProp].getValue(); break;// "Option/Synchronize",
+ case 12: aItem.bPage = *(sal_Bool*)pValues[nProp].getValue(); break;// "Option/Page",
+ case 13: pValues[nProp] >>= aItem.nCol; break;// "Option/Column",
+ case 14: pValues[nProp] >>= aItem.nRow; break;// "Option/Row"
+ case 15: aItem.bAddr = *(sal_Bool*)pValues[nProp].getValue(); break;// "Inscription/UseAddress",
+ case 16: pValues[nProp] >>= aItem.aWriting; break;// "Inscription/Address",
+ case 17: pValues[nProp] >>= aItem.sDBName; break;// "Inscription/Database"
+ case 18: pValues[nProp] >>= aItem.aPrivFirstName; break;// "PrivateAddress/FirstName",
+ case 19: pValues[nProp] >>= aItem.aPrivName; break;// "PrivateAddress/Name",
+ case 20: pValues[nProp] >>= aItem.aPrivShortCut; break;// "PrivateAddress/ShortCut",
+ case 21: pValues[nProp] >>= aItem.aPrivFirstName2; break;// "PrivateAddress/SecondFirstName",
+ case 22: pValues[nProp] >>= aItem.aPrivName2; break;// "PrivateAddress/SecondName",
+ case 23: pValues[nProp] >>= aItem.aPrivShortCut2; break;// "PrivateAddress/SecondShortCut",
+ case 24: pValues[nProp] >>= aItem.aPrivStreet; break;// "PrivateAddress/Street",
+ case 25: pValues[nProp] >>= aItem.aPrivZip; break;// "PrivateAddress/Zip",
+ case 26: pValues[nProp] >>= aItem.aPrivCity; break;// "PrivateAddress/City",
+ case 27: pValues[nProp] >>= aItem.aPrivCountry; break;// "PrivateAddress/Country",
+ case 28: pValues[nProp] >>= aItem.aPrivState; break;// "PrivateAddress/State",
+ case 29: pValues[nProp] >>= aItem.aPrivTitle; break;// "PrivateAddress/Title",
+ case 30: pValues[nProp] >>= aItem.aPrivProfession; break;// "PrivateAddress/Profession",
+ case 31: pValues[nProp] >>= aItem.aPrivPhone; break;// "PrivateAddress/Phone",
+ case 32: pValues[nProp] >>= aItem.aPrivMobile; break;// "PrivateAddress/Mobile",
+ case 33: pValues[nProp] >>= aItem.aPrivFax; break;// "PrivateAddress/Fax",
+ case 34: pValues[nProp] >>= aItem.aPrivWWW; break;// "PrivateAddress/WebAddress",
+ case 35: pValues[nProp] >>= aItem.aPrivMail; break;// "PrivateAddress/Email",
+ case 36: pValues[nProp] >>= aItem.aCompCompany; break;// "BusinessAddress/Company",
+ case 37: pValues[nProp] >>= aItem.aCompCompanyExt; break;// "BusinessAddress/CompanyExt",
+ case 38: pValues[nProp] >>= aItem.aCompSlogan; break;// "BusinessAddress/Slogan",
+ case 39: pValues[nProp] >>= aItem.aCompStreet; break;// "BusinessAddress/Street",
+ case 40: pValues[nProp] >>= aItem.aCompZip; break;// "BusinessAddress/Zip",
+ case 41: pValues[nProp] >>= aItem.aCompCity; break;// "BusinessAddress/City",
+ case 42: pValues[nProp] >>= aItem.aCompCountry; break;// "BusinessAddress/Country",
+ case 43: pValues[nProp] >>= aItem.aCompState; break;// "BusinessAddress/State",
+ case 44: pValues[nProp] >>= aItem.aCompPosition; break;// "BusinessAddress/Position",
+ case 45: pValues[nProp] >>= aItem.aCompPhone; break;// "BusinessAddress/Phone",
+ case 46: pValues[nProp] >>= aItem.aCompMobile; break;// "BusinessAddress/Mobile",
+ case 47: pValues[nProp] >>= aItem.aCompFax; break;// "BusinessAddress/Fax",
+ case 48: pValues[nProp] >>= aItem.aCompWWW; break;// "BusinessAddress/WebAddress",
+ case 49: pValues[nProp] >>= aItem.aCompMail; break;// "BusinessAddress/Email",
+ case 50: pValues[nProp] >>= aItem.sGlossaryGroup; break;// "AutoText/Group"
+ case 51: pValues[nProp] >>= aItem.sGlossaryBlockName; break;// "AutoText/Block"
+ }
+ }
+ }
+ }
+ if(!bIsLabel && bNoConfigValues)
+ {
+
+ SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions();
+ aItem.aPrivFirstName = rUserOpt.GetFirstName();
+ aItem.aPrivName = rUserOpt.GetLastName();
+ aItem.aPrivShortCut = rUserOpt.GetID();
+ aItem.aCompCompany = rUserOpt.GetCompany();
+ aItem.aCompStreet = aItem.aPrivStreet = rUserOpt.GetStreet();
+
+ aItem.aCompCountry = aItem.aPrivCountry = rUserOpt.GetCountry();
+ aItem.aCompZip = aItem.aPrivZip= rUserOpt.GetZip();
+ aItem.aCompCity = aItem.aPrivCity = rUserOpt.GetCity();
+ aItem.aPrivTitle = rUserOpt.GetTitle();
+ aItem.aCompPosition = rUserOpt.GetPosition();
+ aItem.aPrivPhone = rUserOpt.GetTelephoneHome();
+ aItem.aCompPhone = rUserOpt.GetTelephoneWork();
+ aItem.aCompFax = aItem.aPrivFax = rUserOpt.GetFax();
+ aItem.aCompMail = aItem.aPrivMail = rUserOpt.GetEmail();
+ aItem.aCompState = aItem.aPrivState = rUserOpt.GetState();
+ aItem.bSynchron = TRUE;
+ SetModified();
+ }
+}
+/* -----------------------------25.09.00 16:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwLabCfgItem::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+void SwLabCfgItem::Commit()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+
+ const Type& rType = ::getBooleanCppuType();
+ for(int nProp = 0, nProperty = 0; nProp < aNames.getLength(); nProp++, nProperty++)
+ {
+ //to have a contiuous switch an offset is added
+ if(nProp == 15 && !bIsLabel)
+ nProperty += 3;
+ switch(nProperty)
+ {
+ case 0: pValues[nProp].setValue(&aItem.bCont, rType); break;// "Medium/Continous",
+ case 1: pValues[nProp] <<= aItem.aMake; break;// "Medium/Brand",
+ case 2: pValues[nProp] <<= aItem.aType; break;// "Medium/Type",
+ case 3: pValues[nProp] <<= aItem.nCols; break;// "Format/Column",
+ case 4: pValues[nProp] <<= aItem.nRows; break;// "Format/Row",
+ case 5: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lHDist));break;// "Format/HorizontalDistance",
+ case 6: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lVDist));break;// "Format/VerticalDistance",
+ case 7: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lWidth)); break;// "Format/Width",
+ case 8: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lHeight)); break;// "Format/Height",
+ case 9: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lLeft)); break;// "Format/LeftMargin",
+ case 10: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(aItem.lUpper)); break;// "Format/TopMargin",
+ case 11: pValues[nProp].setValue(&aItem.bSynchron, rType); break;// "Option/Synchronize",
+ case 12: pValues[nProp].setValue(&aItem.bPage, rType); break;// "Option/Page",
+ case 13: pValues[nProp] <<= aItem.nCol; break;// "Option/Column",
+ case 14: pValues[nProp] <<= aItem.nRow; break;// "Option/Row"
+ case 15: pValues[nProp].setValue(&aItem.bAddr, rType); break;// "Inscription/UseAddress",
+ case 16: pValues[nProp] <<= aItem.aWriting; break;// "Inscription/Address",
+ case 17: pValues[nProp] <<= aItem.sDBName; break;// "Inscription/Database"
+ case 18: pValues[nProp] <<= aItem.aPrivFirstName; break;// "PrivateAddress/FirstName",
+ case 19: pValues[nProp] <<= aItem.aPrivName; break;// "PrivateAddress/Name",
+ case 20: pValues[nProp] <<= aItem.aPrivShortCut; break;// "PrivateAddress/ShortCut",
+ case 21: pValues[nProp] <<= aItem.aPrivFirstName2; break;// "PrivateAddress/SecondFirstName",
+ case 22: pValues[nProp] <<= aItem.aPrivName2; break;// "PrivateAddress/SecondName",
+ case 23: pValues[nProp] <<= aItem.aPrivShortCut2; break;// "PrivateAddress/SecondShortCut",
+ case 24: pValues[nProp] <<= aItem.aPrivStreet; break;// "PrivateAddress/Street",
+ case 25: pValues[nProp] <<= aItem.aPrivZip; break;// "PrivateAddress/Zip",
+ case 26: pValues[nProp] <<= aItem.aPrivCity; break;// "PrivateAddress/City",
+ case 27: pValues[nProp] <<= aItem.aPrivCountry; break;// "PrivateAddress/Country",
+ case 28: pValues[nProp] <<= aItem.aPrivState; break;// "PrivateAddress/State",
+ case 29: pValues[nProp] <<= aItem.aPrivTitle; break;// "PrivateAddress/Title",
+ case 30: pValues[nProp] <<= aItem.aPrivProfession; break;// "PrivateAddress/Profession",
+ case 31: pValues[nProp] <<= aItem.aPrivPhone; break;// "PrivateAddress/Phone",
+ case 32: pValues[nProp] <<= aItem.aPrivMobile; break;// "PrivateAddress/Mobile",
+ case 33: pValues[nProp] <<= aItem.aPrivFax; break;// "PrivateAddress/Fax",
+ case 34: pValues[nProp] <<= aItem.aPrivWWW; break;// "PrivateAddress/WebAddress",
+ case 35: pValues[nProp] <<= aItem.aPrivMail; break;// "PrivateAddress/Email",
+ case 36: pValues[nProp] <<= aItem.aCompCompany; break;// "BusinessAddress/Company",
+ case 37: pValues[nProp] <<= aItem.aCompCompanyExt; break;// "BusinessAddress/CompanyExt",
+ case 38: pValues[nProp] <<= aItem.aCompSlogan; break;// "BusinessAddress/Slogan",
+ case 39: pValues[nProp] <<= aItem.aCompStreet; break;// "BusinessAddress/Street",
+ case 40: pValues[nProp] <<= aItem.aCompZip; break;// "BusinessAddress/Zip",
+ case 41: pValues[nProp] <<= aItem.aCompCity; break;// "BusinessAddress/City",
+ case 42: pValues[nProp] <<= aItem.aCompCountry; break;// "BusinessAddress/Country",
+ case 43: pValues[nProp] <<= aItem.aCompState; break;// "BusinessAddress/State",
+ case 44: pValues[nProp] <<= aItem.aCompPosition; break;// "BusinessAddress/Position",
+ case 45: pValues[nProp] <<= aItem.aCompPhone; break;// "BusinessAddress/Phone",
+ case 46: pValues[nProp] <<= aItem.aCompMobile; break;// "BusinessAddress/Mobile",
+ case 47: pValues[nProp] <<= aItem.aCompFax; break;// "BusinessAddress/Fax",
+ case 48: pValues[nProp] <<= aItem.aCompWWW; break;// "BusinessAddress/WebAddress",
+ case 49: pValues[nProp] <<= aItem.aCompMail; break;// "BusinessAddress/Email",
+ case 50: pValues[nProp] <<= aItem.sGlossaryGroup; break;// "AutoText/Group"
+ case 51: pValues[nProp] <<= aItem.sGlossaryBlockName; break;// "AutoText/Block"
+ }
+ }
+ PutProperties(aNames, aValues);
+}
+
diff --git a/sw/source/ui/envelp/labimp.hxx b/sw/source/ui/envelp/labimp.hxx
new file mode 100644
index 000000000000..5176394e8249
--- /dev/null
+++ b/sw/source/ui/envelp/labimp.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _LABIMP_HXX
+#define _LABIMP_HXX
+
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/fixed.hxx>
+#include <svtools/svmedit.hxx>
+#include <vcl/field.hxx>
+#include <svtools/stdctrl.hxx>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XWordCursor.hpp>
+#include <com/sun/star/text/XParagraphCursor.hpp>
+#include <com/sun/star/text/XPageCursor.hpp>
+#include <com/sun/star/text/XSentenceCursor.hpp>
+#include <com/sun/star/awt/XFileDialog.hpp>
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/awt/XListBox.hpp>
+#include <com/sun/star/awt/XProgressMonitor.hpp>
+#include <com/sun/star/awt/TextAlign.hpp>
+#include <com/sun/star/awt/XScrollBar.hpp>
+#include <com/sun/star/awt/XVclContainerPeer.hpp>
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#include <com/sun/star/awt/XMessageBox.hpp>
+#include <com/sun/star/awt/XTextEditField.hpp>
+#include <com/sun/star/awt/Style.hpp>
+#include <com/sun/star/awt/XTimeField.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/awt/XSpinField.hpp>
+#include <com/sun/star/awt/XUnoControlContainer.hpp>
+#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
+#include <com/sun/star/awt/XNumericField.hpp>
+#include <com/sun/star/awt/XButton.hpp>
+#include <com/sun/star/awt/XTextArea.hpp>
+#include <com/sun/star/awt/XImageButton.hpp>
+#include <com/sun/star/awt/XFixedText.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#include <com/sun/star/awt/XRadioButton.hpp>
+#include <com/sun/star/awt/XCurrencyField.hpp>
+#include <com/sun/star/awt/XPatternField.hpp>
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+#include <com/sun/star/awt/XTabController.hpp>
+#include <com/sun/star/awt/XVclContainer.hpp>
+#include <com/sun/star/awt/XDateField.hpp>
+#include <com/sun/star/awt/XComboBox.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XCheckBox.hpp>
+#include <com/sun/star/awt/MessageBoxCommand.hpp>
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <com/sun/star/awt/XProgressBar.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <svtools/svtreebx.hxx>
+#include <label.hxx>
+#include <labimg.hxx>
+
+#define GETFLDVAL(rField) (rField).Denormalize((rField).GetValue(FUNIT_TWIP))
+#define SETFLDVAL(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FUNIT_TWIP)
+
+class SwNewDBMgr;
+
+class SwLabRec
+{
+public:
+ SwLabRec() {}
+
+ void SetFromItem( const SwLabItem& rItem );
+ void FillItem( SwLabItem& rItem ) const;
+
+ String aMake;
+ String aType;
+ long lHDist;
+ long lVDist;
+ long lWidth;
+ long lHeight;
+ long lLeft;
+ long lUpper;
+ sal_Int32 nCols;
+ sal_Int32 nRows;
+ sal_Bool bCont;
+};
+
+/* --------------------------------------------------
+
+ --------------------------------------------------*/
+SV_DECL_PTRARR_DEL( SwLabRecs, SwLabRec*, 110, 10 )
+
+#endif
+
diff --git a/sw/source/ui/envelp/labprt.cxx b/sw/source/ui/envelp/labprt.cxx
new file mode 100644
index 000000000000..633e40a5d146
--- /dev/null
+++ b/sw/source/ui/envelp/labprt.cxx
@@ -0,0 +1,242 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <svtools/prnsetup.hxx>
+#include <unotools/cmdoptions.hxx>
+#include <vcl/print.hxx>
+#include <wrtsh.hxx>
+#include <label.hxx>
+#include <labprt.hxx>
+#include <labimg.hxx>
+#ifndef _LABIMP_HXX
+#include "swuilabimp.hxx"
+#endif
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _LABPRT_HRC
+#include <labprt.hrc>
+#endif
+
+
+// --------------------------------------------------------------------------
+
+
+
+SwLabPrtPage::SwLabPrtPage(Window* pParent, const SfxItemSet& rSet) :
+
+ SfxTabPage(pParent, SW_RES(TP_LAB_PRT), rSet),
+
+ pPrinter( 0 ),
+ aPageButton (this, SW_RES(BTN_PAGE )),
+ aSingleButton (this, SW_RES(BTN_SINGLE )),
+ aColText (this, SW_RES(TXT_COL )),
+ aColField (this, SW_RES(FLD_COL )),
+ aRowText (this, SW_RES(TXT_ROW )),
+ aRowField (this, SW_RES(FLD_ROW )),
+ aSynchronCB (this, SW_RES(CB_SYNCHRON)),
+ aFLDontKnow (this, SW_RES(FL_DONTKNOW)),
+ aPrinterInfo (this, SW_RES(INF_PRINTER)),
+ aPrtSetup (this, SW_RES(BTN_PRTSETUP)),
+ aFLPrinter (this, SW_RES(FL_PRINTER ))
+
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ // Handler installieren
+ Link aLk = LINK(this, SwLabPrtPage, CountHdl);
+ aPageButton .SetClickHdl( aLk );
+ aSingleButton.SetClickHdl( aLk );
+
+ aPrtSetup.SetClickHdl( aLk );
+
+ SvtCommandOptions aCmdOpts;
+ if ( aCmdOpts.Lookup(
+ SvtCommandOptions::CMDOPTION_DISABLED,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Print" ) ) ) )
+ {
+ aPrinterInfo.Hide();
+ aPrtSetup.Hide();
+ aFLPrinter.Hide();
+ }
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SwLabPrtPage::~SwLabPrtPage()
+{
+ if (pPrinter)
+ delete pPrinter;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+IMPL_LINK( SwLabPrtPage, CountHdl, Button *, pButton )
+{
+ if (pButton == &aPrtSetup)
+ {
+ // Druck-Setup aufrufen
+ if (!pPrinter)
+ pPrinter = new Printer;
+
+ PrinterSetupDialog* pDlg = new PrinterSetupDialog(this );
+ pDlg->SetPrinter(pPrinter);
+ pDlg->Execute();
+ delete pDlg;
+ GrabFocus();
+ aPrinterInfo.SetText(pPrinter->GetName());
+ return 0;
+ }
+ const BOOL bEnable = pButton == &aSingleButton;
+ aColText .Enable(bEnable);
+ aColField.Enable(bEnable);
+ aRowText .Enable(bEnable);
+ aRowField.Enable(bEnable);
+ aSynchronCB.Enable(!bEnable);
+
+ if ( bEnable )
+ aColField.GrabFocus();
+#ifdef DBG_UTIL
+ else
+ ASSERT( pButton == &aPageButton, "NewButton?" );
+#endif
+ return 0;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+SfxTabPage* SwLabPrtPage::Create(Window* pParent, const SfxItemSet& rSet)
+{
+ return new SwLabPrtPage( pParent, rSet );
+}
+
+// --------------------------------------------------------------------------
+
+
+
+void SwLabPrtPage::ActivatePage( const SfxItemSet& rSet )
+{
+ Reset(rSet);
+}
+
+// --------------------------------------------------------------------------
+
+
+
+int SwLabPrtPage::DeactivatePage(SfxItemSet* _pSet)
+{
+ if ( _pSet )
+ FillItemSet(*_pSet);
+
+ return TRUE;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+void SwLabPrtPage::FillItem(SwLabItem& rItem)
+{
+ rItem.bPage = aPageButton.IsChecked();
+ rItem.nCol = (USHORT) aColField.GetValue();
+ rItem.nRow = (USHORT) aRowField.GetValue();
+ rItem.bSynchron = aSynchronCB.IsChecked() && aSynchronCB.IsEnabled();
+}
+
+// --------------------------------------------------------------------------
+
+
+
+BOOL SwLabPrtPage::FillItemSet(SfxItemSet& rSet)
+{
+ SwLabItem aItem;
+ GetParent()->GetLabItem(aItem);
+ FillItem(aItem);
+ rSet.Put(aItem);
+
+ return TRUE;
+}
+
+// --------------------------------------------------------------------------
+
+
+
+void SwLabPrtPage::Reset(const SfxItemSet& )
+{
+ SwLabItem aItem;
+ GetParent()->GetLabItem(aItem);
+
+ aColField.SetValue (aItem.nCol);
+ aRowField.SetValue (aItem.nRow);
+
+ if (aItem.bPage)
+ {
+ aPageButton.Check();
+ aPageButton.GetClickHdl().Call(&aPageButton);
+ }
+ else
+ {
+ aSingleButton.GetClickHdl().Call(&aSingleButton);
+ aSingleButton.Check();
+ }
+
+ if (pPrinter)
+ {
+ // Drucker anzeigen
+ aPrinterInfo.SetText(pPrinter->GetName());
+ }
+ else
+ aPrinterInfo.SetText(Printer::GetDefaultPrinterName());
+
+ aColField.SetMax(aItem.nCols);
+ aRowField.SetMax(aItem.nRows);
+
+ aColField.SetLast(aColField.GetMax());
+ aRowField.SetLast(aRowField.GetMax());
+
+ aSynchronCB.Check(aItem.bSynchron);
+}
+
+
+
+
diff --git a/sw/source/ui/envelp/labprt.hrc b/sw/source/ui/envelp/labprt.hrc
new file mode 100644
index 000000000000..07453cb01e89
--- /dev/null
+++ b/sw/source/ui/envelp/labprt.hrc
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _LABPRT_HRC
+#define _LABPRT_HRC
+
+// #include *****************************************************************
+
+#include "envelp.hrc"
+
+// Lokale Resourcen *********************************************************
+
+#define BTN_PAGE 1
+#define BTN_SINGLE 2
+#define INF_PRINTER 3
+#define TXT_COL 4
+#define FLD_COL 5
+#define TXT_ROW 6
+#define FLD_ROW 7
+#define BTN_PRTSETUP 8
+#define FL_PRINTER 9
+#define FL_DONTKNOW 10
+#define CB_SYNCHRON 11
+
+// Ueberlaufpruefung ********************************************************
+
+#define LABPRT_ACT_END 0
+
+#if LABPRT_ACT_END > RC_LABPRT_END
+#error Resource-Ueberlauf in #file, #line
+#endif
+
+#endif
+
+
diff --git a/sw/source/ui/envelp/labprt.hxx b/sw/source/ui/envelp/labprt.hxx
new file mode 100644
index 000000000000..1f8ff491423d
--- /dev/null
+++ b/sw/source/ui/envelp/labprt.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _LABPRT_HXX
+#define _LABPRT_HXX
+
+#include <vcl/group.hxx>
+#include <vcl/field.hxx>
+#include <svtools/stdctrl.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <sfx2/tabdlg.hxx>
+
+
+class SwLabDlg;
+class SwLabItem;
+
+// class SwLabPrtPage -------------------------------------------------------
+
+class SwLabPrtPage : public SfxTabPage
+{
+ Printer* pPrinter; //Fuer die Schachteinstellug - leider.
+
+ RadioButton aPageButton;
+ RadioButton aSingleButton;
+ FixedText aColText;
+ NumericField aColField;
+ FixedText aRowText;
+ NumericField aRowField;
+ CheckBox aSynchronCB;
+ FixedLine aFLDontKnow;
+
+ FixedInfo aPrinterInfo;
+ PushButton aPrtSetup;
+ FixedLine aFLPrinter;
+
+ SwLabPrtPage(Window* pParent, const SfxItemSet& rSet);
+ ~SwLabPrtPage();
+
+ DECL_LINK( CountHdl, Button * );
+
+ using Window::GetParent;
+ SwLabDlg* GetParent() {return (SwLabDlg*) SfxTabPage::GetParent()->GetParent();}
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+public:
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet* pSet = 0);
+ void FillItem(SwLabItem& rItem);
+ virtual BOOL FillItemSet(SfxItemSet& rSet);
+ virtual void Reset(const SfxItemSet& rSet);
+ inline Printer* GetPrt() { return (pPrinter); }
+};
+
+#endif
+
+
diff --git a/sw/source/ui/envelp/labprt.src b/sw/source/ui/envelp/labprt.src
new file mode 100644
index 000000000000..2a8b4e537bd0
--- /dev/null
+++ b/sw/source/ui/envelp/labprt.src
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // #pragma ******************************************************************
+
+ // #include *****************************************************************
+#include "labprt.hrc"
+#include "helpid.h"
+ // TP_LAB_PRT ---------------------------------------------------------------
+TabPage TP_LAB_PRT
+{
+ HelpID = HID_LAB_PRT ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ RadioButton BTN_PAGE
+ {
+ HelpID = "sw:RadioButton:TP_LAB_PRT:BTN_PAGE";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ Text [ en-US ] = "~Entire page" ;
+ };
+ RadioButton BTN_SINGLE
+ {
+ HelpID = "sw:RadioButton:TP_LAB_PRT:BTN_SINGLE";
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~Single label" ;
+ };
+ FixedText TXT_COL
+ {
+ Pos = MAP_APPFONT ( 127 , 29 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Colu~mn" ;
+ Left = TRUE ;
+ };
+ NumericField FLD_COL
+ {
+ HelpID = "sw:NumericField:TP_LAB_PRT:FLD_COL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 160 , 27 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ First = 1 ;
+ };
+ FixedText TXT_ROW
+ {
+ Pos = MAP_APPFONT ( 191 , 29 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Ro~w" ;
+ Left = TRUE ;
+ };
+ NumericField FLD_ROW
+ {
+ HelpID = "sw:NumericField:TP_LAB_PRT:FLD_ROW";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 224 , 27 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ First = 1 ;
+ };
+ CheckBox CB_SYNCHRON
+ {
+ HelpID = "sw:CheckBox:TP_LAB_PRT:CB_SYNCHRON";
+ Pos = MAP_APPFONT ( 12 , 43 ) ;
+ Size = MAP_APPFONT ( 120 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Synchroni~ze contents" ;
+ };
+ FixedLine FL_DONTKNOW
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Distribute";
+ };
+ FixedText INF_PRINTER
+ {
+ Pos = MAP_APPFONT ( 12 , 73 ) ;
+ Size = MAP_APPFONT ( 182 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Printer Name" ;
+ };
+ PushButton BTN_PRTSETUP
+ {
+ HelpID = "sw:PushButton:TP_LAB_PRT:BTN_PRTSETUP";
+ Pos = MAP_APPFONT ( 198 , 70 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Setup..." ;
+ };
+ FixedLine FL_PRINTER
+ {
+ Pos = MAP_APPFONT ( 6 , 59 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = " Printer " ;
+ };
+};
+ // **************************************************************************
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx
new file mode 100644
index 000000000000..49932804d8ea
--- /dev/null
+++ b/sw/source/ui/envelp/mailmrge.cxx
@@ -0,0 +1,938 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <tools/urlobj.hxx>
+#include <svl/urihelper.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svl/mailenum.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <helpid.h>
+#include <view.hxx>
+#include <docsh.hxx>
+#include <IDocumentDeviceAccess.hxx>
+#include <wrtsh.hxx>
+#include <dbmgr.hxx>
+#include <dbui.hxx>
+#include <prtopt.hxx>
+#include <swmodule.hxx>
+#include <modcfg.hxx>
+#include <mailmergehelper.hxx>
+#include <envelp.hrc>
+#include <mailmrge.hrc>
+#include <mailmrge.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#include <com/sun/star/sdb/XResultSetAccess.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <toolkit/unohlp.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/form/runtime/XFormController.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/container/XContainerQuery.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+
+#include <unomid.h>
+
+#include <algorithm>
+
+using namespace rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::form;
+using namespace ::com::sun::star::view;
+using namespace ::com::sun::star::ui::dialogs;
+
+
+/* -----------------------------05.06.01 13:54--------------------------------
+
+ ---------------------------------------------------------------------------*/
+struct SwMailMergeDlg_Impl
+{
+ uno::Reference<runtime::XFormController> xFController;
+ uno::Reference<XSelectionChangeListener> xChgLstnr;
+ uno::Reference<XSelectionSupplier> xSelSupp;
+};
+/* -----------------------------05.06.01 13:47--------------------------------
+ helper classes
+ ---------------------------------------------------------------------------*/
+class SwXSelChgLstnr_Impl : public cppu::WeakImplHelper1
+<
+ view::XSelectionChangeListener
+>
+{
+ SwMailMergeDlg& rParent;
+public:
+ SwXSelChgLstnr_Impl(SwMailMergeDlg& rParentDlg);
+ ~SwXSelChgLstnr_Impl();
+
+ virtual void SAL_CALL selectionChanged( const EventObject& aEvent ) throw (RuntimeException);
+ virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
+};
+/* -----------------------------05.06.01 13:51--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXSelChgLstnr_Impl::SwXSelChgLstnr_Impl(SwMailMergeDlg& rParentDlg) :
+ rParent(rParentDlg)
+{}
+/* -----------------------------05.06.01 14:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXSelChgLstnr_Impl::~SwXSelChgLstnr_Impl()
+{}
+/* -----------------------------05.06.01 14:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXSelChgLstnr_Impl::selectionChanged( const EventObject& ) throw (RuntimeException)
+{
+ //call the parent to enable selection mode
+ Sequence <Any> aSelection;
+ if(rParent.pImpl->xSelSupp.is())
+ rParent.pImpl->xSelSupp->getSelection() >>= aSelection;
+
+ sal_Bool bEnable = aSelection.getLength() > 0;
+ rParent.aMarkedRB.Enable(bEnable);
+ if(bEnable)
+ rParent.aMarkedRB.Check();
+ else if(rParent.aMarkedRB.IsChecked())
+ {
+ rParent.aAllRB.Check();
+ rParent.m_aSelection.realloc(0);
+ }
+}
+/* -----------------------------05.06.01 14:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXSelChgLstnr_Impl::disposing( const EventObject& ) throw (RuntimeException)
+{
+ DBG_ERROR("disposing");
+}
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell,
+ const String& rSourceName,
+ const String& rTblName,
+ sal_Int32 nCommandType,
+ const uno::Reference< XConnection>& _xConnection,
+ Sequence< Any >* pSelection) :
+
+ SvxStandardDialog(pParent, SW_RES(DLG_MAILMERGE)),
+ pBeamerWin (new Window(this, SW_RES(WIN_BEAMER))),
+
+ aAllRB (this, SW_RES(RB_ALL)),
+ aMarkedRB (this, SW_RES(RB_MARKED)),
+ aFromRB (this, SW_RES(RB_FROM)),
+ aFromNF (this, SW_RES(NF_FROM)),
+ aBisFT (this, SW_RES(FT_BIS)),
+ aToNF (this, SW_RES(NF_TO)),
+ aRecordFL (this, SW_RES(FL_RECORD)),
+
+ aSeparatorFL (this, SW_RES(FL_SEPARATOR)),
+
+ aPrinterRB (this, SW_RES(RB_PRINTER)),
+ aMailingRB (this, SW_RES(RB_MAILING)),
+ aFileRB (this, SW_RES(RB_FILE)),
+
+ aSingleJobsCB (this, SW_RES(CB_SINGLE_JOBS)),
+
+ aSaveMergedDocumentFL(this, SW_RES( FL_SAVE_MERGED_DOCUMENT)),
+ aSaveSingleDocRB(this, SW_RES( RB_SAVE_SINGLE_DOC )),
+ aSaveIndividualRB(this, SW_RES( RB_SAVE_INDIVIDUAL )),
+ aGenerateFromDataBaseCB(this, SW_RES( RB_GENERATE_FROM_DATABASE )),
+
+ aColumnFT (this, SW_RES(FT_COLUMN)),
+ aColumnLB (this, SW_RES(LB_COLUMN)),
+
+ aPathFT (this, SW_RES(FT_PATH)),
+ aPathED (this, SW_RES(ED_PATH)),
+ aPathPB (this, SW_RES(PB_PATH)),
+ aFilterFT (this, SW_RES(FT_FILTER)),
+ aFilterLB (this, SW_RES(LB_FILTER)),
+
+ aAddressFldLB (this, SW_RES(LB_ADDRESSFLD)),
+ aSubjectFT (this, SW_RES(FT_SUBJECT)),
+ aSubjectED (this, SW_RES(ED_SUBJECT)),
+ aFormatFT (this, SW_RES(FT_FORMAT)),
+ aAttachFT (this, SW_RES(FT_ATTACH)),
+ aAttachED (this, SW_RES(ED_ATTACH)),
+ aAttachPB (this, SW_RES(PB_ATTACH)),
+ aFormatHtmlCB (this, SW_RES(CB_FORMAT_HTML)),
+ aFormatRtfCB (this, SW_RES(CB_FORMAT_RTF)),
+ aFormatSwCB (this, SW_RES(CB_FORMAT_SW)),
+ aDestFL (this, SW_RES(FL_DEST)),
+
+ aBottomSeparatorFL(this, SW_RES(FL_BOTTOM_SEPARATOR)),
+
+ aOkBTN (this, SW_RES(BTN_OK)),
+ aCancelBTN (this, SW_RES(BTN_CANCEL)),
+ aHelpBTN (this, SW_RES(BTN_HELP)),
+
+ pImpl (new SwMailMergeDlg_Impl),
+
+ rSh (rShell),
+ rDBName (rSourceName),
+ rTableName (rTblName),
+ nMergeType (DBMGR_MERGE_MAILING),
+ m_aDialogSize( GetSizePixel() )
+{
+ FreeResource();
+ aSingleJobsCB.Show(sal_False); // not supported in since cws printerpullpages anymore
+ //task #97066# mailing of form letters is currently not supported
+ aMailingRB.Show(FALSE);
+ aSubjectFT.Show(FALSE);
+ aSubjectED.Show(FALSE);
+ aFormatFT.Show(FALSE);
+ aFormatSwCB.Show(FALSE);
+ aFormatHtmlCB.Show(FALSE);
+ aFormatRtfCB.Show(FALSE);
+ aAttachFT.Show(FALSE);
+ aAttachED.Show(FALSE);
+ aAttachPB.Show(FALSE);
+
+ Point aMailPos = aMailingRB.GetPosPixel();
+ Point aFilePos = aFileRB.GetPosPixel();
+ aFilePos.X() -= (aFilePos.X() - aMailPos.X()) /2;
+ aFileRB.SetPosPixel(aFilePos);
+ uno::Reference< lang::XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory();
+ if(pSelection)
+ {
+ m_aSelection = *pSelection;
+ //move all controls
+ long nDiff = aRecordFL.GetPosPixel().Y() - pBeamerWin->GetPosPixel().Y();
+ pBeamerWin->Show(FALSE);
+ ::Size aSize = GetSizePixel();
+ aSize.Height() -= nDiff;
+ SetSizePixel(aSize);
+ Window* aCntrlArr[] = {
+ &aAllRB ,
+ &aMarkedRB ,
+ &aFromRB ,
+ &aFromNF ,
+ &aBisFT ,
+ &aToNF ,
+ &aRecordFL ,
+ &aPrinterRB ,
+ &aMailingRB ,
+ &aFileRB ,
+ &aSingleJobsCB,
+ &aPathFT ,
+ &aPathED ,
+ &aPathPB ,
+ &aFilterFT ,
+ &aFilterLB ,
+ &aColumnLB ,
+ &aAddressFldLB,
+ &aSubjectFT ,
+ &aSubjectED ,
+ &aFormatFT ,
+ &aAttachFT ,
+ &aAttachED ,
+ &aAttachPB ,
+ &aFormatHtmlCB,
+ &aFormatRtfCB ,
+ &aFormatSwCB ,
+ &aDestFL ,
+ &aSeparatorFL ,
+ 0};
+
+ for( Window** ppW = aCntrlArr; *ppW; ++ppW )
+ {
+ ::Point aPnt( (*ppW)->GetPosPixel() );
+ aPnt.Y() -= nDiff;
+ (*ppW)->SetPosPixel( aPnt );
+ }
+ }
+ else
+ {
+ try
+ {
+ // create a frame wrapper for myself
+ uno::Reference< XMultiServiceFactory >
+ xMgr = comphelper::getProcessServiceFactory();
+ xFrame = uno::Reference< XFrame >(xMgr->createInstance(C2U("com.sun.star.frame.Frame")), UNO_QUERY);
+ if(xFrame.is())
+ {
+ xFrame->initialize( VCLUnoHelper::GetInterface ( pBeamerWin ) );
+ }
+ }
+ catch (Exception&)
+ {
+ xFrame.clear();
+ }
+ if(xFrame.is())
+ {
+ uno::Reference<XDispatchProvider> xDP(xFrame, UNO_QUERY);
+ URL aURL;
+ aURL.Complete = C2U(".component:DB/DataSourceBrowser");
+ uno::Reference<XDispatch> xD = xDP->queryDispatch(aURL,
+ C2U(""),
+ 0x0C);
+ if(xD.is())
+ {
+ Sequence<PropertyValue> aProperties(3);
+ PropertyValue* pProperties = aProperties.getArray();
+ pProperties[0].Name = C2U("DataSourceName");
+ pProperties[0].Value <<= OUString(rSourceName);
+ pProperties[1].Name = C2U("Command");
+ pProperties[1].Value <<= OUString(rTableName);
+ pProperties[2].Name = C2U("CommandType");
+ pProperties[2].Value <<= nCommandType;
+ xD->dispatch(aURL, aProperties);
+ pBeamerWin->Show();
+ }
+ uno::Reference<XController> xController = xFrame->getController();
+ pImpl->xFController = uno::Reference<runtime::XFormController>(xController, UNO_QUERY);
+ if(pImpl->xFController.is())
+ {
+ uno::Reference< awt::XControl > xCtrl = pImpl->xFController->getCurrentControl( );
+ pImpl->xSelSupp = uno::Reference<XSelectionSupplier>(xCtrl, UNO_QUERY);
+ if(pImpl->xSelSupp.is())
+ {
+ pImpl->xChgLstnr = new SwXSelChgLstnr_Impl(*this);
+ pImpl->xSelSupp->addSelectionChangeListener( pImpl->xChgLstnr );
+ }
+ }
+ }
+ }
+
+ pModOpt = SW_MOD()->GetModuleConfig();
+
+ //aSingleJobsCB.Check(pModOpt->IsSinglePrintJob());// not supported in since cws printerpullpages anymore
+
+ sal_Int16 nMailingMode(pModOpt->GetMailingFormats());
+ aFormatSwCB.Check((nMailingMode & TXTFORMAT_OFFICE) != 0);
+ aFormatHtmlCB.Check((nMailingMode & TXTFORMAT_HTML) != 0);
+ aFormatRtfCB.Check((nMailingMode & TXTFORMAT_RTF) != 0);
+
+ aAllRB.Check(TRUE);
+
+ // Handler installieren
+ Link aLk = LINK(this, SwMailMergeDlg, ButtonHdl);
+ aOkBTN.SetClickHdl(aLk);
+
+ aPathPB.SetClickHdl(LINK(this, SwMailMergeDlg, InsertPathHdl));
+ aAttachPB.SetClickHdl(LINK(this, SwMailMergeDlg, AttachFileHdl));
+
+ aLk = LINK(this, SwMailMergeDlg, OutputTypeHdl);
+ aPrinterRB.SetClickHdl(aLk);
+ aMailingRB.SetClickHdl(aLk);
+ aFileRB.SetClickHdl(aLk);
+
+ //#i63267# printing might be disabled
+ bool bIsPrintable = !Application::GetSettings().GetMiscSettings().GetDisablePrinting();
+ aPrinterRB.Enable(bIsPrintable);
+ OutputTypeHdl(bIsPrintable ? &aPrinterRB : &aFileRB);
+
+ aLk = LINK(this, SwMailMergeDlg, FilenameHdl);
+ aGenerateFromDataBaseCB.SetClickHdl( aLk );
+ BOOL bColumn = pModOpt->IsNameFromColumn();
+ if(bColumn)
+ aGenerateFromDataBaseCB.Check();
+
+ FilenameHdl( &aGenerateFromDataBaseCB );
+ aLk = LINK(this, SwMailMergeDlg, SaveTypeHdl);
+ aSaveSingleDocRB.Check( true );
+ aSaveSingleDocRB.SetClickHdl( aLk );
+ aSaveIndividualRB.SetClickHdl( aLk );
+ aLk.Call( &aSaveSingleDocRB );
+
+ aLk = LINK(this, SwMailMergeDlg, ModifyHdl);
+ aFromNF.SetModifyHdl(aLk);
+ aToNF.SetModifyHdl(aLk);
+ aFromNF.SetMax(SAL_MAX_INT32);
+ aToNF.SetMax(SAL_MAX_INT32);
+
+ SwNewDBMgr* pNewDBMgr = rSh.GetNewDBMgr();
+ if(_xConnection.is())
+ pNewDBMgr->GetColumnNames(&aAddressFldLB, _xConnection, rTableName);
+ else
+ pNewDBMgr->GetColumnNames(&aAddressFldLB, rDBName, rTableName);
+ for(USHORT nEntry = 0; nEntry < aAddressFldLB.GetEntryCount(); nEntry++)
+ aColumnLB.InsertEntry(aAddressFldLB.GetEntry(nEntry));
+
+ aAddressFldLB.SelectEntry(C2S("EMAIL"));
+
+ String sPath(pModOpt->GetMailingPath());
+ if(!sPath.Len())
+ {
+ SvtPathOptions aPathOpt;
+ sPath = aPathOpt.GetWorkPath();
+ }
+ INetURLObject aURL(sPath);
+ if(aURL.GetProtocol() == INET_PROT_FILE)
+ aPathED.SetText(aURL.PathToFileName());
+ else
+ aPathED.SetText(aURL.GetFull());
+
+ if (!bColumn )
+ {
+ aColumnLB.SelectEntry(C2S("NAME"));
+ }
+ else
+ aColumnLB.SelectEntry(pModOpt->GetNameFromColumn());
+
+ if (aAddressFldLB.GetSelectEntryCount() == 0)
+ aAddressFldLB.SelectEntryPos(0);
+ if (aColumnLB.GetSelectEntryCount() == 0)
+ aColumnLB.SelectEntryPos(0);
+
+ const BOOL bEnable = m_aSelection.getLength() != 0;
+ aMarkedRB.Enable(bEnable);
+ if (bEnable)
+ aMarkedRB.Check();
+ else
+ {
+ aAllRB.Check();
+ aMarkedRB.Enable(FALSE);
+ }
+ SetMinOutputSizePixel(m_aDialogSize);
+ try
+ {
+ uno::Reference< container::XNameContainer> xFilterFactory(
+ xMSF->createInstance(C2U("com.sun.star.document.FilterFactory")), UNO_QUERY_THROW);
+ uno::Reference< container::XContainerQuery > xQuery(xFilterFactory, UNO_QUERY_THROW);
+ OUString sCommand(C2U("matchByDocumentService=com.sun.star.text.TextDocument:iflags="));
+ sCommand += String::CreateFromInt32(SFX_FILTER_EXPORT);
+ sCommand += C2U(":eflags=");
+ sCommand += String::CreateFromInt32(SFX_FILTER_NOTINFILEDLG);
+ sCommand += C2U(":default_first");
+ uno::Reference< container::XEnumeration > xList = xQuery->createSubSetEnumerationByQuery(sCommand);
+ const ::rtl::OUString sName = OUString::createFromAscii("Name");
+ const ::rtl::OUString sFlags = OUString::createFromAscii("Flags");
+ const ::rtl::OUString sUIName = OUString::createFromAscii("UIName");
+ USHORT nODT = USHRT_MAX;
+ while(xList->hasMoreElements())
+ {
+ comphelper::SequenceAsHashMap aFilter(xList->nextElement());
+ OUString sFilter = aFilter.getUnpackedValueOrDefault(sName, OUString());
+
+ uno::Any aProps = xFilterFactory->getByName(sFilter);
+ uno::Sequence< beans::PropertyValue > aFilterProperties;
+ aProps >>= aFilterProperties;
+ ::rtl::OUString sUIName2;
+ const beans::PropertyValue* pFilterProperties = aFilterProperties.getConstArray();
+ for(int nProp = 0; nProp < aFilterProperties.getLength(); nProp++)
+ {
+ if(!pFilterProperties[nProp].Name.compareToAscii("UIName"))
+ {
+ pFilterProperties[nProp].Value >>= sUIName2;
+ break;
+ }
+ }
+ if( sUIName2.getLength() )
+ {
+ USHORT nFilter = aFilterLB.InsertEntry( sUIName2 );
+ if( 0 == sFilter.compareToAscii("writer8") )
+ nODT = nFilter;
+ aFilterLB.SetEntryData( nFilter, new ::rtl::OUString( sFilter ) );
+ }
+ }
+ aFilterLB.SelectEntryPos( nODT );
+ }
+ catch( const uno::Exception& )
+ {
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwMailMergeDlg::~SwMailMergeDlg()
+{
+ if(xFrame.is())
+ {
+ xFrame->setComponent(NULL, NULL);
+ xFrame->dispose();
+ }
+ else
+ delete pBeamerWin;
+
+ for( USHORT nFilter = 0; nFilter < aFilterLB.GetEntryCount(); ++nFilter )
+ {
+ ::rtl::OUString* pData = reinterpret_cast< ::rtl::OUString* >( aFilterLB.GetEntryData(nFilter) );
+ delete pData;
+ }
+ delete pImpl;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwMailMergeDlg::Apply()
+{
+}
+/*-- 01.06.2007 13:06:50---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_MoveControlY( Window* ppW, long nDiffSize )
+{
+ Point aPos( ppW->GetPosPixel());
+ aPos.Y() += nDiffSize;
+ ppW->SetPosPixel( aPos );
+}
+void lcl_MoveControlX( Window* ppW, long nDiffSize )
+{
+ Point aPos( ppW->GetPosPixel());
+ aPos.X() += nDiffSize;
+ ppW->SetPosPixel( aPos );
+}
+void lcl_ChangeWidth( Window* ppW, long nDiffSize )
+{
+ Size aSize( ppW->GetSizePixel());
+ aSize.Width() += nDiffSize;
+ ppW->SetSizePixel( aSize );
+}
+void SwMailMergeDlg::Resize()
+{
+ //the only controls that profit from the resize is pBeamerWin
+ // and aPathED, aFilenameED and aColumnLB
+
+ Size aCurSize( GetSizePixel() );
+ //find the difference
+ Size aDiffSize( aCurSize.Width() - m_aDialogSize.Width(),
+ aCurSize.Height() - m_aDialogSize.Height() );
+ m_aDialogSize = aCurSize;
+ if( pBeamerWin->IsVisible() )
+ {
+ Window* aCntrlArr[] = {
+ &aAllRB ,
+ &aMarkedRB ,
+ &aFromRB ,
+ &aFromNF ,
+ &aBisFT ,
+ &aToNF ,
+ &aRecordFL ,
+ &aPrinterRB ,
+ &aMailingRB ,
+ &aFileRB ,
+ &aSingleJobsCB,
+ &aSaveMergedDocumentFL,
+ &aSaveSingleDocRB,
+ &aSaveIndividualRB,
+ &aGenerateFromDataBaseCB,
+ &aPathFT ,
+ &aPathED ,
+ &aPathPB ,
+ &aColumnFT,
+ &aColumnLB ,
+ &aFilterFT ,
+ &aFilterLB ,
+ &aAddressFldLB,
+ &aSubjectFT ,
+ &aSubjectED ,
+ &aFormatFT ,
+ &aAttachFT ,
+ &aAttachED ,
+ &aAttachPB ,
+ &aFormatHtmlCB,
+ &aFormatRtfCB ,
+ &aFormatSwCB ,
+ &aDestFL ,
+ &aSeparatorFL ,
+ &aBottomSeparatorFL,
+ &aOkBTN,
+ &aCancelBTN,
+ &aHelpBTN,
+ 0};
+ for( Window** ppW = aCntrlArr; *ppW; ++ppW )
+ {
+ lcl_MoveControlY( *ppW, aDiffSize.Height() );
+ }
+ //some controls have to be extended horizontally
+ lcl_MoveControlX( &aOkBTN, aDiffSize.Width() );
+ lcl_MoveControlX( &aCancelBTN, aDiffSize.Width() );
+ lcl_MoveControlX( &aHelpBTN, aDiffSize.Width() );
+ lcl_MoveControlX( &aPathPB, aDiffSize.Width() );
+ lcl_MoveControlX( &aFileRB, aDiffSize.Width()/2 );
+
+ lcl_ChangeWidth( &aBottomSeparatorFL, aDiffSize.Width() );
+ lcl_ChangeWidth( &aSaveMergedDocumentFL, aDiffSize.Width() );
+ lcl_ChangeWidth( &aColumnLB, aDiffSize.Width() );
+ lcl_ChangeWidth( &aPathED, aDiffSize.Width() );
+ lcl_ChangeWidth( &aFilterLB, aDiffSize.Width() );
+ lcl_ChangeWidth( &aDestFL, aDiffSize.Width() );
+
+ Size aBeamerSize( pBeamerWin->GetSizePixel() ) ;
+ aBeamerSize.Width() += aDiffSize.Width();
+ aBeamerSize.Height() += aDiffSize.Height();
+ pBeamerWin->SetSizePixel(aBeamerSize);
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwMailMergeDlg, ButtonHdl, Button *, pBtn )
+{
+ if (pBtn == &aOkBTN)
+ {
+ if( ExecQryShell() )
+ EndDialog(RET_OK);
+ }
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwMailMergeDlg, OutputTypeHdl, RadioButton *, pBtn )
+{
+ sal_Bool bPrint = pBtn == &aPrinterRB;
+ aSingleJobsCB.Enable(bPrint);
+
+ aSaveMergedDocumentFL.Enable( !bPrint );
+ aSaveSingleDocRB.Enable( !bPrint );
+ aSaveIndividualRB.Enable( !bPrint );
+
+ if( !bPrint )
+ {
+ SaveTypeHdl( aSaveSingleDocRB.IsChecked() ? &aSaveSingleDocRB : &aSaveIndividualRB );
+ }
+ else
+ {
+ aPathFT.Enable(false);
+ aPathED.Enable(false);
+ aPathPB.Enable(false);
+ aColumnFT.Enable(false);
+ aColumnLB.Enable(false);
+ aFilterFT.Enable(false);
+ aFilterLB.Enable(false);
+ aGenerateFromDataBaseCB.Enable(false);
+ }
+
+ return 0;
+}
+/*-- 01.06.2007 12:36:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwMailMergeDlg, SaveTypeHdl, RadioButton*, pBtn )
+{
+ bool bIndividual = pBtn == &aSaveIndividualRB;
+
+ aGenerateFromDataBaseCB.Enable( bIndividual );
+ if( bIndividual )
+ {
+ FilenameHdl( &aGenerateFromDataBaseCB );
+ }
+ else
+ {
+ aColumnFT.Enable(false);
+ aColumnLB.Enable(false);
+ aPathFT.Enable( false );
+ aPathED.Enable( false );
+ aPathPB.Enable( false );
+ aFilterFT.Enable( false );
+ aFilterLB.Enable( false );
+ }
+ return 0;
+}
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwMailMergeDlg, FilenameHdl, CheckBox*, pBox )
+{
+ BOOL bEnable = pBox->IsChecked();
+ aColumnFT.Enable( bEnable );
+ aColumnLB.Enable(bEnable);
+ aPathFT.Enable( bEnable );
+ aPathED.Enable(bEnable);
+ aPathPB.Enable( bEnable );
+ aFilterFT.Enable( bEnable );
+ aFilterLB.Enable( bEnable );
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwMailMergeDlg, ModifyHdl, NumericField *, EMPTYARG )
+{
+ aFromRB.Check();
+ return (0);
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+bool SwMailMergeDlg::ExecQryShell()
+{
+ if(pImpl->xSelSupp.is())
+ {
+ pImpl->xSelSupp->removeSelectionChangeListener( pImpl->xChgLstnr );
+ }
+ SwNewDBMgr* pMgr = rSh.GetNewDBMgr();
+
+ if (aPrinterRB.IsChecked())
+ nMergeType = DBMGR_MERGE_MAILMERGE;
+ else if (aMailingRB.IsChecked())
+ {
+ nMergeType = DBMGR_MERGE_MAILING;
+ pMgr->SetEMailColumn(aAddressFldLB.GetSelectEntry());
+ pMgr->SetSubject(aSubjectED.GetText());
+ pMgr->SetAttachment(aAttachED.GetText());
+ }
+ else
+ {
+ nMergeType = static_cast< USHORT >( aSaveSingleDocRB.IsChecked() ?
+ DBMGR_MERGE_SINGLE_FILE : DBMGR_MERGE_MAILFILES );
+ SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium();
+ INetURLObject aAbs;
+ if( pMedium )
+ aAbs = pMedium->GetURLObject();
+ String sPath(
+ URIHelper::SmartRel2Abs(
+ aAbs, aPathED.GetText(), URIHelper::GetMaybeFileHdl()));
+ pModOpt->SetMailingPath(sPath);
+ String sDelim(INET_PATH_TOKEN);
+
+ if (sPath.Len() >= sDelim.Len() &&
+ sPath.Copy(sPath.Len()-sDelim.Len()).CompareTo(sDelim) != COMPARE_EQUAL)
+ sPath += sDelim;
+
+ pModOpt->SetIsNameFromColumn(aGenerateFromDataBaseCB.IsChecked());
+
+ if (aGenerateFromDataBaseCB.IsEnabled() && aGenerateFromDataBaseCB.IsChecked())
+ {
+ pMgr->SetEMailColumn(aColumnLB.GetSelectEntry());
+ pModOpt->SetNameFromColumn(aColumnLB.GetSelectEntry());
+ if( aFilterLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND)
+ m_sSaveFilter = *static_cast<const ::rtl::OUString*>(aFilterLB.GetEntryData( aFilterLB.GetSelectEntryPos() ));
+ }
+ else
+ {
+ //#i97667# reset column name - otherwise it's remembered from the last run
+ pMgr->SetEMailColumn(::rtl::OUString());
+ //start save as dialog
+ String sFilter;
+ sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter);
+ if(!sPath.Len())
+ return false;
+ m_sSaveFilter = sFilter;
+ }
+
+ pMgr->SetSubject(sPath);
+ }
+
+ if (aFromRB.IsChecked()) // Liste Einfuegen
+ {
+ // Safe: the maximal value of the fields is limited
+ sal_Int32 nStart = sal::static_int_cast<sal_Int32>(aFromNF.GetValue());
+ sal_Int32 nEnd = sal::static_int_cast<sal_Int32>(aToNF.GetValue());
+
+ if (nEnd < nStart)
+ std::swap(nEnd, nStart);
+
+ m_aSelection.realloc(nEnd - nStart + 1);
+ Any* pSelection = m_aSelection.getArray();
+ for (sal_Int32 i = nStart; i <= nEnd; ++i, ++pSelection)
+ *pSelection <<= i;
+ }
+ else if (aAllRB.IsChecked() )
+ m_aSelection.realloc(0); // Leere Selektion = Alles einfuegen
+ else
+ {
+ if(pImpl->xSelSupp.is())
+ {
+ //update selection
+ uno::Reference< XRowLocate > xRowLocate(GetResultSet(),UNO_QUERY);
+ uno::Reference< XResultSet > xRes(xRowLocate,UNO_QUERY);
+ pImpl->xSelSupp->getSelection() >>= m_aSelection;
+ if ( xRowLocate.is() )
+ {
+ Any* pBegin = m_aSelection.getArray();
+ Any* pEnd = pBegin + m_aSelection.getLength();
+ for (;pBegin != pEnd ; ++pBegin)
+ {
+ if ( xRowLocate->moveToBookmark(*pBegin) )
+ *pBegin <<= xRes->getRow();
+ }
+ }
+ }
+ }
+ IDocumentDeviceAccess* pIDDA = rSh.getIDocumentDeviceAccess();
+ SwPrintData aPrtData( pIDDA->getPrintData() );
+ aPrtData.SetPrintSingleJobs(aSingleJobsCB.IsChecked());
+ pIDDA->setPrintData(aPrtData);
+
+ pModOpt->SetSinglePrintJob(aSingleJobsCB.IsChecked());
+
+ BYTE nMailingMode = 0;
+
+ if (aFormatSwCB.IsChecked())
+ nMailingMode |= TXTFORMAT_OFFICE;
+ if (aFormatHtmlCB.IsChecked())
+ nMailingMode |= TXTFORMAT_HTML;
+ if (aFormatRtfCB.IsChecked())
+ nMailingMode |= TXTFORMAT_RTF;
+ pModOpt->SetMailingFormats(nMailingMode);
+ return true;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwMailMergeDlg, InsertPathHdl, PushButton *, EMPTYARG )
+{
+ String sPath( aPathED.GetText() );
+ if( !sPath.Len() )
+ {
+ SvtPathOptions aPathOpt;
+ sPath = aPathOpt.GetWorkPath();
+ }
+
+ uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ uno::Reference < XFolderPicker > xFP;
+ if( xMgr.is() )
+ {
+ xFP = uno::Reference< XFolderPicker >(
+ xMgr->createInstance(
+ C2U( "com.sun.star.ui.dialogs.FolderPicker" ) ),
+ UNO_QUERY );
+ }
+// pFileDlg->SetHelpId(HID_FILEDLG_MAILMRGE1);
+ xFP->setDisplayDirectory(sPath);
+ if( xFP->execute() == RET_OK )
+ {
+ INetURLObject aURL(xFP->getDirectory());
+ if(aURL.GetProtocol() == INET_PROT_FILE)
+ aPathED.SetText(aURL.PathToFileName());
+ else
+ aPathED.SetText(aURL.GetFull());
+ }
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwMailMergeDlg, AttachFileHdl, PushButton *, EMPTYARG )
+{
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractSvxMultiFileDialog* pFileDlg = pFact->CreateSvxMultiFileDialog( this );
+ DBG_ASSERT(pFileDlg, "Dialogdiet fail!");
+ pFileDlg->SetFiles(aAttachED.GetText());
+ pFileDlg->SetHelpId(HID_FILEDLG_MAILMRGE2);
+
+ if (pFileDlg->Execute())
+ aAttachED.SetText(pFileDlg->GetFiles());
+
+ delete pFileDlg;
+ }
+ return 0;
+}
+/* -----------------------------05.06.01 14:56--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference<XResultSet> SwMailMergeDlg::GetResultSet() const
+{
+ uno::Reference< XResultSet > xResSetClone;
+ if ( pImpl->xFController.is() )
+ {
+ // we create a clone to do the task
+ uno::Reference< XResultSetAccess > xResultSetAccess( pImpl->xFController->getModel(),UNO_QUERY);
+ if ( xResultSetAccess.is() )
+ xResSetClone = xResultSetAccess->createResultSet();
+ }
+ return xResSetClone;
+}
+/*-- 27.11.2002 12:27:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeCreateFromDlg::SwMailMergeCreateFromDlg(Window* pParent) :
+ ModalDialog(pParent, SW_RES(DLG_MERGE_CREATE)),
+ aCreateFromFL( this, SW_RES( FL_CREATEFROM )),
+ aThisDocRB( this, SW_RES( RB_THISDOC )),
+ aUseTemplateRB( this, SW_RES( RB_TEMPLATE )),
+ aOK( this, SW_RES( BT_OK )),
+ aCancel( this, SW_RES( BT_CANCEL )),
+ aHelp( this, SW_RES( BT_HELP ))
+{
+ FreeResource();
+}
+/*-- 27.11.2002 12:27:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeCreateFromDlg::~SwMailMergeCreateFromDlg()
+{
+}
+/* -----------------04.02.2003 13:45-----------------
+ *
+ * --------------------------------------------------*/
+SwMailMergeFieldConnectionsDlg::SwMailMergeFieldConnectionsDlg(Window* pParent) :
+ ModalDialog(pParent, SW_RES(DLG_MERGE_FIELD_CONNECTIONS)),
+ aConnectionsFL( this, SW_RES( FL_CONNECTIONS )),
+ aUseExistingRB( this, SW_RES( RB_USEEXISTING )),
+ aCreateNewRB( this, SW_RES( RB_CREATENEW )),
+ aInfoFI( this, SW_RES( FT_INFO )),
+ aOK( this, SW_RES( BT_OK )),
+ aCancel( this, SW_RES( BT_CANCEL )),
+ aHelp( this, SW_RES( BT_HELP ))
+{
+ FreeResource();
+}
+/* -----------------04.02.2003 13:45-----------------
+ *
+ * --------------------------------------------------*/
+SwMailMergeFieldConnectionsDlg::~SwMailMergeFieldConnectionsDlg()
+{
+}
+
diff --git a/sw/source/ui/envelp/mailmrge.hrc b/sw/source/ui/envelp/mailmrge.hrc
new file mode 100644
index 000000000000..f03c42663fe6
--- /dev/null
+++ b/sw/source/ui/envelp/mailmrge.hrc
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _MAILMRGE_HRC
+#define _MAILMRGE_HRC
+
+// #include -----------------------------------------------------------------
+
+#include "envelp.hrc"
+
+// Elemente -----------------------------------------------------------------
+
+#define FL_RECORD 1
+#define RB_ALL 2
+#define RB_MARKED 3
+#define RB_FROM 4
+#define NF_FROM 5
+#define FT_BIS 6
+#define NF_TO 7
+#define BTN_OK 8
+#define BTN_CANCEL 9
+#define BTN_HELP 10
+#define RB_PRINTER 11
+#define RB_MAILING 12
+#define FT_ADDRESS 13
+#define LB_ADDRESSFLD 14
+#define FT_SUBJECT 15
+#define ED_SUBJECT 16
+#define FL_DEST 17
+#define CB_SINGLE_JOBS 18
+#define FT_FORMAT 19
+#define CB_FORMAT_SW 20
+#define CB_FORMAT_HTML 21
+#define CB_FORMAT_RTF 22
+#define RB_FILE 23
+#define FT_PATH 24
+#define ED_PATH 25
+#define PB_PATH 26
+#define LB_COLUMN 30
+#define FT_ATTACH 32
+#define ED_ATTACH 33
+#define PB_ATTACH 34
+#define WIN_BEAMER 35
+#define FL_SEPARATOR 36
+#define FL_BOTTOM_SEPARATOR 37
+#define FL_SAVE_MERGED_DOCUMENT 38
+#define RB_SAVE_SINGLE_DOC 39
+#define RB_SAVE_INDIVIDUAL 40
+#define RB_GENERATE_FROM_DATABASE 41
+#define FT_COLUMN 42
+#define FT_FILTER 43
+#define LB_FILTER 44
+
+#define FL_CREATEFROM 1
+#define RB_THISDOC 2
+#define RB_TEMPLATE 3
+#define BT_OK 4
+#define BT_CANCEL 5
+#define BT_HELP 6
+#define FL_CONNECTIONS 7
+#define RB_USEEXISTING 8
+#define RB_CREATENEW 9
+#define FT_INFO 10
+
+
+#endif
+
+
diff --git a/sw/source/ui/envelp/mailmrge.src b/sw/source/ui/envelp/mailmrge.src
new file mode 100644
index 000000000000..a19c36458366
--- /dev/null
+++ b/sw/source/ui/envelp/mailmrge.src
@@ -0,0 +1,455 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+ // #include *****************************************************************
+#include "mailmrge.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+
+#define _MAIL_MERGE_STRING_ \
+ Text [ en-US ] = "Mail Merge" ; \
+
+ModalDialog DLG_MAILMERGE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 312 , 264 ) ;
+ _MAIL_MERGE_STRING_
+ Moveable = TRUE ;
+ Sizeable = TRUE;
+ HelpID = CMD_FN_QRY_MERGE ;
+ Window WIN_BEAMER
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 300 , 80 ) ;
+ };
+ RadioButton RB_ALL
+ {
+ HelpID = "sw:RadioButton:DLG_MAILMERGE:RB_ALL";
+ Pos = MAP_APPFONT ( 12 , 97 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "~All" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_MARKED
+ {
+ HelpID = "sw:RadioButton:DLG_MAILMERGE:RB_MARKED";
+ Pos = MAP_APPFONT ( 12 , 110 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "~Selected records" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_FROM
+ {
+ HelpID = "sw:RadioButton:DLG_MAILMERGE:RB_FROM";
+ Pos = MAP_APPFONT ( 12 , 123 ) ;
+ Size = MAP_APPFONT ( 33 , 10 ) ;
+ Text [ en-US ] = "~From:" ;
+ TabStop = TRUE ;
+ };
+ NumericField NF_FROM
+ {
+ HelpID = "sw:NumericField:DLG_MAILMERGE:NF_FROM";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 48 , 122 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ TabStop = TRUE ;
+ StrictFormat = TRUE ;
+ Minimum = 1 ;
+ Maximum = 999999 ;
+ };
+ FixedText FT_BIS
+ {
+ Pos = MAP_APPFONT ( 75 , 123 ) ;
+ Size = MAP_APPFONT ( 27 , 10 ) ;
+ Text [ en-US ] = "~To:" ;
+ Center = TRUE ;
+ };
+ NumericField NF_TO
+ {
+ HelpID = "sw:NumericField:DLG_MAILMERGE:NF_TO";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 105 , 122 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ TabStop = TRUE ;
+ StrictFormat = TRUE ;
+ Minimum = 1 ;
+ Maximum = 999999 ;
+ };
+ FixedLine FL_RECORD
+ {
+ Pos = MAP_APPFONT ( 6 , 86 ) ;
+ Size = MAP_APPFONT ( 126 , 8 ) ;
+ Text [ en-US ] = "Records" ;
+ };
+ RadioButton RB_PRINTER
+ {
+ HelpID = "sw:RadioButton:DLG_MAILMERGE:RB_PRINTER";
+ Pos = MAP_APPFONT ( 144 , 97 ) ;
+ Size = MAP_APPFONT ( 53 , 10 ) ;
+ Check = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Printer" ;
+ };
+ RadioButton RB_MAILING
+ {
+ HelpID = "sw:RadioButton:DLG_MAILMERGE:RB_MAILING";
+ Pos = MAP_APPFONT ( 200 , 97 ) ;
+ Size = MAP_APPFONT ( 53 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Electronic" ;
+ };
+ RadioButton RB_FILE
+ {
+ HelpID = "sw:RadioButton:DLG_MAILMERGE:RB_FILE";
+ Pos = MAP_APPFONT ( 256 , 97 ) ;
+ Size = MAP_APPFONT ( 56 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "File" ;
+ };
+ CheckBox CB_SINGLE_JOBS
+ {
+ HelpID = "sw:CheckBox:DLG_MAILMERGE:CB_SINGLE_JOBS";
+ Pos = MAP_APPFONT ( 150 , 112 ) ;
+ Size = MAP_APPFONT ( 142 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Single print jobs" ;
+ };
+ FixedLine FL_SAVE_MERGED_DOCUMENT
+ {
+ Pos = MAP_APPFONT ( 144, 128 ) ;
+ Size = MAP_APPFONT ( 156 , 8 ) ;
+ Text [ en-US ] = "Save merged document" ;
+ };
+ RadioButton RB_SAVE_SINGLE_DOC
+ {
+ HelpID = "sw:RadioButton:DLG_MAILMERGE:RB_SAVE_SINGLE_DOC";
+ Pos = MAP_APPFONT ( 150, 139 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "S~ave as single document";
+ };
+ RadioButton RB_SAVE_INDIVIDUAL
+ {
+ HelpID = "sw:RadioButton:DLG_MAILMERGE:RB_SAVE_INDIVIDUAL";
+ Pos = MAP_APPFONT ( 150, 152 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Sa~ve as individual documents";
+ };
+ CheckBox RB_GENERATE_FROM_DATABASE
+ {
+ HelpID = "sw:CheckBox:DLG_MAILMERGE:RB_GENERATE_FROM_DATABASE";
+ Pos = MAP_APPFONT ( 156, 168 ) ;
+ Size = MAP_APPFONT ( 144 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Generate file name from ~Database";
+ };
+ FixedText FT_COLUMN
+ {
+ Pos = MAP_APPFONT ( 162 , 184 ) ;
+ Size = MAP_APPFONT ( 41 , 10 ) ;
+ Text [ en-US ] = "Field" ;
+ };
+ ListBox LB_COLUMN
+ {
+ HelpID = "sw:ListBox:DLG_MAILMERGE:LB_COLUMN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 205 , 182 ) ;
+ Size = MAP_APPFONT ( 103 , 84 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_PATH
+ {
+ Pos = MAP_APPFONT ( 162 , 200 ) ;
+ Size = MAP_APPFONT ( 41 , 10 ) ;
+ Text [ en-US ] = "~Path" ;
+ };
+ Edit ED_PATH
+ {
+ HelpID = "sw:Edit:DLG_MAILMERGE:ED_PATH";
+ Pos = MAP_APPFONT ( 205 , 198 ) ;
+ Size = MAP_APPFONT ( 86 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_PATH
+ {
+ HelpID = "sw:PushButton:DLG_MAILMERGE:PB_PATH";
+ Pos = MAP_APPFONT ( 294 , 198 ) ;
+ Size = MAP_APPFONT ( 14 , 12 ) ;
+ // Soll Groesse des Edits haben (12)!
+ Text = "~..." ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_FILTER
+ {
+ Pos = MAP_APPFONT ( 162 , 216 ) ;
+ Size = MAP_APPFONT ( 41 , 8 ) ;
+ Text [ en-US ] = "F~ile format" ;
+ };
+ ListBox LB_FILTER
+ {
+ HelpID = "sw:ListBox:DLG_MAILMERGE:LB_FILTER";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 205 , 214 ) ;
+ Size = MAP_APPFONT ( 103 , 84 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ ListBox LB_ADDRESSFLD
+ {
+ HelpID = "sw:ListBox:DLG_MAILMERGE:LB_ADDRESSFLD";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 220 , 110 ) ;
+ Size = MAP_APPFONT ( 74 , 84 ) ;
+ Disable = TRUE ;
+ Hide = TRUE ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_SUBJECT
+ {
+ Pos = MAP_APPFONT ( 144 , 125 ) ;
+ Size = MAP_APPFONT ( 51 , 10 ) ;
+ Disable = TRUE ;
+ Text [ en-US ] = "~Subject" ;
+ };
+ Edit ED_SUBJECT
+ {
+ HelpID = "sw:Edit:DLG_MAILMERGE:ED_SUBJECT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 220 , 127 ) ;
+ Size = MAP_APPFONT ( 88 , 12 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_ATTACH
+ {
+ Pos = MAP_APPFONT ( 144 , 140 ) ;
+ Size = MAP_APPFONT ( 51 , 10 ) ;
+ Disable = TRUE ;
+ Text [ en-US ] = "Attachments" ;
+ };
+ Edit ED_ATTACH
+ {
+ HelpID = "sw:Edit:DLG_MAILMERGE:ED_ATTACH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 220 , 140 ) ;
+ Size = MAP_APPFONT ( 72 , 12 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ ReadOnly = TRUE ;
+ };
+ PushButton PB_ATTACH
+ {
+ HelpID = "sw:PushButton:DLG_MAILMERGE:PB_ATTACH";
+ Pos = MAP_APPFONT ( 294 , 140 ) ;
+ Size = MAP_APPFONT ( 14 , 12 ) ;
+ // Soll Groesse des Edits haben (12)!
+ Text = "~..." ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ };
+ FixedText FT_FORMAT
+ {
+ Pos = MAP_APPFONT ( 144 , 157 ) ;
+ Size = MAP_APPFONT ( 51 , 8 ) ;
+ Disable = TRUE ;
+ Text [ en-US ] = "Mail Format" ;
+ };
+ CheckBox CB_FORMAT_HTML
+ {
+ HelpID = "sw:CheckBox:DLG_MAILMERGE:CB_FORMAT_HTML";
+ Pos = MAP_APPFONT ( 220 , 156 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Disable = TRUE ;
+ /* ### ACHTUNG: Neuer Text in Resource? HTM~L : HTML */
+ TabStop = TRUE ;
+ Text [ en-US ] = "HTM~L" ;
+ };
+ CheckBox CB_FORMAT_RTF
+ {
+ HelpID = "sw:CheckBox:DLG_MAILMERGE:CB_FORMAT_RTF";
+ Pos = MAP_APPFONT ( 220 , 169 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "RT~F" ;
+ };
+ CheckBox CB_FORMAT_SW
+ {
+ HelpID = "sw:CheckBox:DLG_MAILMERGE:CB_FORMAT_SW";
+ Pos = MAP_APPFONT ( 220, 182 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "%PRODUCTNAME Writer" ;
+ };
+ FixedLine FL_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 133 , 93 ) ;
+ Size = MAP_APPFONT ( 4 , 136 ) ;
+ Vert = TRUE;
+ };
+ FixedLine FL_DEST
+ {
+ Pos = MAP_APPFONT ( 138 , 86 ) ;
+ Size = MAP_APPFONT ( 162 , 8 ) ;
+ Text [ en-US ] = "Output" ;
+ };
+ FixedLine FL_BOTTOM_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 0, 232 ) ;
+ Size = MAP_APPFONT ( 312 , 8 ) ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 147 , 244 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 200 , 244 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 256 , 244 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+};
+
+ModalDialog DLG_MERGE_CREATE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 145 , 63 ) ;
+ Moveable = TRUE ;
+ HelpID = HID_MAIL_MERGE_CREATE_FROM;
+ _MAIL_MERGE_STRING_
+ FixedLine FL_CREATEFROM
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Create" ;
+ };
+ RadioButton RB_THISDOC
+ {
+ HelpID = "sw:RadioButton:DLG_MERGE_CREATE:RB_THISDOC";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Check = TRUE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "From this ~document" ;
+ };
+ RadioButton RB_TEMPLATE
+ {
+ HelpID = "sw:RadioButton:DLG_MERGE_CREATE:RB_TEMPLATE";
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "From a ~template" ;
+ };
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 89 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 89 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 89 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+
+};
+ModalDialog DLG_MERGE_FIELD_CONNECTIONS
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 205 , 97 ) ;
+ Moveable = TRUE ;
+ HelpID = HID_MAIL_MERGE_INSERT_FIELDS;
+ Text [ en-US ] = "Data Source Connection" ;
+ FixedLine FL_CONNECTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 140 , 8 ) ;
+ Text [ en-US ] = "Connect" ;
+ };
+ RadioButton RB_USEEXISTING
+ {
+ HelpID = "sw:RadioButton:DLG_MERGE_FIELD_CONNECTIONS:RB_USEEXISTING";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 130 , 10 ) ;
+ Check = TRUE;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Use existing" ;
+ };
+ RadioButton RB_CREATENEW
+ {
+ HelpID = "sw:RadioButton:DLG_MERGE_FIELD_CONNECTIONS:RB_CREATENEW";
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 130 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Create new connection" ;
+ };
+ FixedText FT_INFO
+ {
+ Pos = MAP_APPFONT ( 6 , 41 ) ;
+ Size = MAP_APPFONT ( 141 , 50 ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "Fields are used to personalize form letters. The fields are placeholders for data from a data source, such as a database. The fields in the form letter must be connected to the data source." ;
+ };
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 149 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 149 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 149 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+
+};
+
diff --git a/sw/source/ui/envelp/swuilabimp.hxx b/sw/source/ui/envelp/swuilabimp.hxx
new file mode 100644
index 000000000000..2bfcc7e27cae
--- /dev/null
+++ b/sw/source/ui/envelp/swuilabimp.hxx
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWUILABIMP_HXX
+#define _SWUILABIMP_HXX
+#include "labimp.hxx"
+
+class SwLabPage : public SfxTabPage
+{
+ SwNewDBMgr* pNewDBMgr;
+ String sActDBName;
+ SwLabItem aItem;
+
+ FixedText aWritingText;
+ CheckBox aAddrBox;
+ MultiLineEdit aWritingEdit;
+ FixedText aDatabaseFT;
+ ListBox aDatabaseLB;
+ FixedText aTableFT;
+ ListBox aTableLB;
+ ImageButton aInsertBT;
+ FixedText aDBFieldFT;
+ ListBox aDBFieldLB;
+// PushButton aDatabaseButton;
+ FixedLine aWritingFL;
+
+ RadioButton aContButton;
+ RadioButton aSheetButton;
+ FixedText aMakeText;
+ ListBox aMakeBox;
+ FixedText aTypeText;
+ ListBox aTypeBox;
+ ListBox aHiddenSortTypeBox;
+ FixedInfo aFormatInfo;
+ FixedLine aFormatFL;
+
+ sal_Bool m_bLabel;
+
+ SwLabPage(Window* pParent, const SfxItemSet& rSet);
+ ~SwLabPage();
+
+ DECL_LINK( AddrHdl, Button * );
+ DECL_LINK( DatabaseHdl, ListBox *pListBox );
+// DECL_LINK( DatabaseButtonHdl, Button * );
+ DECL_LINK( FieldHdl, Button * );
+ DECL_LINK( PageHdl, Button * );
+ DECL_LINK( MakeHdl, ListBox * );
+ DECL_LINK( TypeHdl, ListBox * );
+
+ void DisplayFormat ();
+ SwLabRec* GetSelectedEntryPos();
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+ using Window::GetParent;
+
+public:
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet* pSet = 0);
+ void FillItem(SwLabItem& rItem);
+ virtual sal_Bool FillItemSet(SfxItemSet& rSet);
+ virtual void Reset(const SfxItemSet& rSet);
+
+ SwLabDlg* GetParent() {return (SwLabDlg*) SfxTabPage::GetParent()->GetParent();}
+
+ void SetToBusinessCard();
+
+ void InitDatabaseBox();
+ inline void SetNewDBMgr(SwNewDBMgr* pDBMgr) { pNewDBMgr = pDBMgr; }
+ inline SwNewDBMgr* GetNewDBMgr() const { return pNewDBMgr; }
+};
+
+/* -----------------08.07.99 13:48-------------------
+
+ --------------------------------------------------*/
+class SwOneExampleFrame;
+class SwVisitingCardPage : public SfxTabPage
+{
+ SvTreeListBox aAutoTextLB;
+ FixedText aAutoTextGroupFT;
+ ListBox aAutoTextGroupLB;
+
+ FixedLine aContentFL;
+
+ Window aExampleWIN;
+
+ String sVisCardGroup;
+ String sTempURL;
+
+ SwLabItem aLabItem;
+
+ SwOneExampleFrame* pExampleFrame;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > _xAutoText;
+
+
+ DECL_LINK( AutoTextSelectHdl, void* );
+ DECL_LINK( FrameControlInitializedHdl, void* );
+
+ void InitFrameControl();
+ void UpdateFields();
+
+ void ClearUserData();
+
+ using SfxTabPage::SetUserData;
+ void SetUserData( sal_uInt32 nCnt,
+ const rtl::OUString* pNames,
+ const rtl::OUString* pValues );
+
+ SwVisitingCardPage(Window* pParent, const SfxItemSet& rSet);
+ ~SwVisitingCardPage();
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+public:
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet* pSet = 0);
+ virtual sal_Bool FillItemSet(SfxItemSet& rSet);
+ virtual void Reset(const SfxItemSet& rSet);
+};
+/* -----------------29.09.99 08:51-------------------
+
+ --------------------------------------------------*/
+class SwPrivateDataPage : public SfxTabPage
+{
+ FixedLine aDataFL;
+
+ FixedText aNameFT;
+ Edit aFirstNameED;
+ Edit aNameED;
+ Edit aShortCutED;
+
+ FixedText aName2FT;
+ Edit aFirstName2ED;
+ Edit aName2ED;
+ Edit aShortCut2ED;
+
+ FixedText aStreetFT;
+ Edit aStreetED;
+ FixedText aZipCityFT;
+ Edit aZipED;
+ Edit aCityED;
+ FixedText aCountryStateFT;
+ Edit aCountryED;
+ Edit aStateED;
+ FixedText aTitleProfessionFT;
+ Edit aTitleED;
+ Edit aProfessionED;
+ FixedText aPhoneFT;
+ Edit aPhoneED;
+ Edit aMobilePhoneED;
+ FixedText aFaxFT;
+ Edit aFaxED;
+ FixedText aWWWMailFT;
+ Edit aHomePageED;
+ Edit aMailED;
+
+ SwPrivateDataPage(Window* pParent, const SfxItemSet& rSet);
+ ~SwPrivateDataPage();
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+public:
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet* pSet = 0);
+ virtual sal_Bool FillItemSet(SfxItemSet& rSet);
+ virtual void Reset(const SfxItemSet& rSet);
+};
+/* -----------------29.09.99 08:51-------------------
+
+ --------------------------------------------------*/
+class SwBusinessDataPage : public SfxTabPage
+{
+ FixedLine aDataFL;
+ FixedText aCompanyFT;
+ Edit aCompanyED;
+ FixedText aCompanyExtFT;
+ Edit aCompanyExtED;
+ FixedText aSloganFT;
+ Edit aSloganED;
+
+ FixedText aStreetFT;
+ Edit aStreetED;
+ FixedText aZipCityFT;
+ Edit aZipED;
+ Edit aCityED;
+ FixedText aCountryStateFT;
+ Edit aCountryED;
+ Edit aStateED;
+
+ FixedText aPositionFT;
+ Edit aPositionED;
+
+ FixedText aPhoneFT;
+ Edit aPhoneED;
+ Edit aMobilePhoneED;
+ FixedText aFaxFT;
+ Edit aFaxED;
+
+ FixedText aWWWMailFT;
+ Edit aHomePageED;
+ Edit aMailED;
+
+ SwBusinessDataPage(Window* pParent, const SfxItemSet& rSet);
+ ~SwBusinessDataPage();
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+public:
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet* pSet = 0);
+ virtual sal_Bool FillItemSet(SfxItemSet& rSet);
+ virtual void Reset(const SfxItemSet& rSet);
+};
+
+#endif
+
diff --git a/sw/source/ui/envelp/syncbtn.cxx b/sw/source/ui/envelp/syncbtn.cxx
new file mode 100644
index 000000000000..a0e7c0ac659e
--- /dev/null
+++ b/sw/source/ui/envelp/syncbtn.cxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include "cmdid.h"
+#include "swmodule.hxx"
+#include "view.hxx"
+#include "edtwin.hxx"
+#include "label.hrc"
+
+#define _SYNCDLG
+#include "syncbtn.hxx"
+#include "swtypes.hxx"
+
+SFX_IMPL_FLOATINGWINDOW( SwSyncChildWin, FN_SYNC_LABELS )
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwSyncChildWin::SwSyncChildWin( Window* _pParent,
+ USHORT nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo ) :
+ SfxChildWindow( _pParent, nId )
+{
+ pWindow = new SwSyncBtnDlg( pBindings, this, _pParent);
+
+ if (!pInfo->aSize.Width() || !pInfo->aSize.Height())
+ {
+ SwView* pActiveView = ::GetActiveView();
+ if(pActiveView)
+ {
+ const SwEditWin &rEditWin = pActiveView->GetEditWin();
+ pWindow->SetPosPixel(rEditWin.OutputToScreenPixel(Point(0, 0)));
+ }
+ else
+ pWindow->SetPosPixel(_pParent->OutputToScreenPixel(Point(0, 0)));
+ pInfo->aPos = pWindow->GetPosPixel();
+ pInfo->aSize = pWindow->GetSizePixel();
+ }
+
+ ((SwSyncBtnDlg *)pWindow)->Initialize(pInfo);
+
+ pWindow->Show();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwSyncBtnDlg::SwSyncBtnDlg( SfxBindings* _pBindings,
+ SfxChildWindow* pChild,
+ Window *pParent) :
+ SfxFloatingWindow(_pBindings, pChild, pParent, SW_RES(DLG_SYNC_BTN)),
+ aSyncBtn (this, SW_RES(BTN_SYNC ))
+{
+ FreeResource();
+ aSyncBtn.SetClickHdl(LINK(this, SwSyncBtnDlg, BtnHdl));
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+__EXPORT SwSyncBtnDlg::~SwSyncBtnDlg()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwSyncBtnDlg, BtnHdl, PushButton *, EMPTYARG )
+{
+ SfxViewFrame::Current()->GetDispatcher()->Execute(FN_UPDATE_ALL_LINKS, SFX_CALLMODE_ASYNCHRON);
+ return 0;
+}
+
+
diff --git a/sw/source/ui/fldui/DropDownFieldDialog.cxx b/sw/source/ui/fldui/DropDownFieldDialog.cxx
new file mode 100644
index 000000000000..1d3fafa880a1
--- /dev/null
+++ b/sw/source/ui/fldui/DropDownFieldDialog.cxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include <wrtsh.hxx>
+#include <fldbas.hxx>
+#include <fldmgr.hxx>
+#include <vcl/msgbox.hxx>
+#include <DropDownFieldDialog.hxx>
+#include <flddropdown.hxx>
+#include <fldui.hrc>
+#include <DropDownFieldDialog.hrc>
+
+using namespace ::com::sun::star;
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldeinfuegen bearbeiten
+ --------------------------------------------------------------------*/
+
+sw::DropDownFieldDialog::DropDownFieldDialog( Window *pParent, SwWrtShell &rS,
+ SwField* pField, BOOL bNextButton ) :
+
+ SvxStandardDialog(pParent, SW_RES(DLG_FLD_DROPDOWN)),
+ aItemsFL( this, SW_RES( FL_ITEMS )),
+ aListItemsLB( this, SW_RES( LB_LISTITEMS )),
+
+ aOKPB( this, SW_RES( PB_OK )),
+ aCancelPB( this, SW_RES( PB_CANCEL )),
+ aNextPB( this, SW_RES( PB_NEXT )),
+ aHelpPB( this, SW_RES( PB_HELP )),
+
+ aEditPB( this, SW_RES( PB_EDIT )),
+
+ rSh( rS ),
+ pDropField(0)
+{
+ Link aButtonLk = LINK(this, DropDownFieldDialog, ButtonHdl);
+ aEditPB.SetClickHdl(aButtonLk);
+ if( bNextButton )
+ {
+ aNextPB.Show();
+ aNextPB.SetClickHdl(aButtonLk);
+ }
+ else
+ {
+ long nDiff = aCancelPB.GetPosPixel().Y() - aOKPB.GetPosPixel().Y();
+ Point aPos = aHelpPB.GetPosPixel();
+ aPos.Y() -= nDiff;
+ aHelpPB.SetPosPixel(aPos);
+ }
+ if( RES_DROPDOWN == pField->GetTyp()->Which() )
+ {
+ //
+ pDropField = (SwDropDownField*)pField;
+ String sTitle = GetText();
+ sTitle += pDropField->GetPar2();
+ SetText(sTitle);
+ uno::Sequence< rtl::OUString > aItems = pDropField->GetItemSequence();
+ const rtl::OUString* pArray = aItems.getConstArray();
+ for(sal_Int32 i = 0; i < aItems.getLength(); i++)
+ aListItemsLB.InsertEntry(pArray[i]);
+ aListItemsLB.SelectEntry(pDropField->GetSelectedItem());
+ }
+
+ BOOL bEnable = !rSh.IsCrsrReadonly();
+ aOKPB.Enable( bEnable );
+
+ aListItemsLB.GrabFocus();
+ FreeResource();
+}
+
+sw::DropDownFieldDialog::~DropDownFieldDialog()
+{
+}
+
+/*--------------------------------------------------------------------
+
+ --------------------------------------------------------------------*/
+
+void sw::DropDownFieldDialog::Apply()
+{
+ if(pDropField)
+ {
+ String sSelect = aListItemsLB.GetSelectEntry();
+ if(pDropField->GetPar1() != sSelect)
+ {
+ rSh.StartAllAction();
+
+ ::std::auto_ptr<SwDropDownField> const pCopy(
+ static_cast<SwDropDownField *>( pDropField->CopyField() ) );
+
+ pCopy->SetPar1(sSelect);
+ rSh.SwEditShell::UpdateFlds(*pCopy);
+
+ rSh.SetUndoNoResetModified();
+ rSh.EndAllAction();
+ }
+ }
+}
+/* -----------------17.06.2003 10:50-----------------
+
+ --------------------------------------------------*/
+IMPL_LINK(sw::DropDownFieldDialog, ButtonHdl, PushButton*, pButton)
+{
+ EndDialog(&aNextPB == pButton ? RET_OK : RET_YES );
+ return 0;
+}
+
diff --git a/sw/source/ui/fldui/DropDownFieldDialog.hrc b/sw/source/ui/fldui/DropDownFieldDialog.hrc
new file mode 100644
index 000000000000..dc63ae58e5ac
--- /dev/null
+++ b/sw/source/ui/fldui/DropDownFieldDialog.hrc
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_DROPDOWNFIELDDIALOG_HRC
+#define _SW_DROPDOWNFIELDDIALOG_HRC
+#define FL_ITEMS 1
+#define LB_LISTITEMS 2
+#define PB_OK 3
+#define PB_CANCEL 4
+#define PB_NEXT 5
+#define PB_HELP 6
+#define PB_EDIT 7
+
+#endif
diff --git a/sw/source/ui/fldui/DropDownFieldDialog.src b/sw/source/ui/fldui/DropDownFieldDialog.src
new file mode 100644
index 000000000000..e84b3d73c854
--- /dev/null
+++ b/sw/source/ui/fldui/DropDownFieldDialog.src
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "fldui.hrc"
+#include "DropDownFieldDialog.hrc"
+#include "helpid.h"
+ModalDialog DLG_FLD_DROPDOWN
+{
+ HelpID = HID_FLD_DROPDOWN ;
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 194 , 119 ) ;
+ Text [ en-US ] = "Choose Item: " ;
+ Moveable = TRUE ;
+ FixedLine FL_ITEMS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 127 , 8 ) ;
+ Text [ en-US ] = "Edit" ;
+ };
+ ListBox LB_LISTITEMS
+ {
+ HelpID = "sw:ListBox:DLG_FLD_DROPDOWN:LB_LISTITEMS";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 115 , 99 ) ;
+ TabStop = TRUE ;
+ Sort = FALSE ;
+ AutoHScroll = TRUE ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 139 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 139 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_NEXT
+ {
+ HelpID = "sw:PushButton:DLG_FLD_DROPDOWN:PB_NEXT";
+ Pos = MAP_APPFONT ( 139 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Next" ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 139 , 60 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_EDIT
+ {
+ HelpID = "sw:PushButton:DLG_FLD_DROPDOWN:PB_EDIT";
+ Pos = MAP_APPFONT ( 139 , 99 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Edit" ;
+ };
+
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/FldRefTreeListBox.cxx b/sw/source/ui/fldui/FldRefTreeListBox.cxx
new file mode 100644
index 000000000000..38910327754e
--- /dev/null
+++ b/sw/source/ui/fldui/FldRefTreeListBox.cxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <FldRefTreeListBox.hxx>
+
+#include <helpid.h>
+#include <vcl/help.hxx>
+
+SwFldRefTreeListBox::SwFldRefTreeListBox( Window* pParent,
+ const ResId& rResId)
+ : SvTreeListBox( pParent, rResId )
+{
+ SetHelpId( HID_REFSELECTION_TOOLTIP );
+}
+
+SwFldRefTreeListBox::~SwFldRefTreeListBox()
+{
+}
+
+void SwFldRefTreeListBox::RequestHelp( const HelpEvent& rHEvt )
+{
+ bool bCallBase( true );
+ if ( rHEvt.GetMode() & HELPMODE_QUICK )
+ {
+ Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
+ SvLBoxEntry* pEntry = GetEntry( aPos );
+ if( pEntry )
+ {
+ String sEntry( GetEntryText( pEntry ) );
+ SvLBoxTab* pTab;
+ SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab );
+ if( pItem )
+ {
+ aPos = GetEntryPosition( pEntry );
+
+ aPos.X() = GetTabPos( pEntry, pTab );
+ Size aSize( pItem->GetSize( this, pEntry ) );
+
+ if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
+ aSize.Width() = GetSizePixel().Width() - aPos.X();
+
+ aPos = OutputToScreenPixel(aPos);
+ Rectangle aItemRect( aPos, aSize );
+ Help::ShowQuickHelp( this, aItemRect, sEntry,
+ QUICKHELP_LEFT|QUICKHELP_VCENTER );
+ bCallBase = false;
+ }
+ }
+ }
+ if ( bCallBase )
+ {
+ Window::RequestHelp( rHEvt );
+ }
+}
diff --git a/sw/source/ui/fldui/FldRefTreeListBox.hxx b/sw/source/ui/fldui/FldRefTreeListBox.hxx
new file mode 100644
index 000000000000..92df954c8ddd
--- /dev/null
+++ b/sw/source/ui/fldui/FldRefTreeListBox.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FLDREFTREELISTBOX_HXX
+#define _FLDREFTREELISTBOX_HXX
+
+#include <svtools/svtreebx.hxx>
+
+class SwFldRefTreeListBox : public SvTreeListBox
+{
+protected:
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+
+public:
+ SwFldRefTreeListBox(Window* pParent, const ResId& rResId);
+ virtual ~SwFldRefTreeListBox();
+
+// virtual long GetTabPos( SvLBoxEntry*, SvLBoxTab* );
+};
+#endif
+
diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx
new file mode 100644
index 000000000000..a08e717f6948
--- /dev/null
+++ b/sw/source/ui/fldui/changedb.cxx
@@ -0,0 +1,363 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#define _CHANGEDB_CXX
+
+#include <svtools/stdctrl.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdb/XDatabaseAccess.hpp>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+#include <fldmgr.hxx>
+#include <expfld.hxx>
+#include <txtatr.hxx>
+#include <ndtxt.hxx>
+#include <fldbas.hxx>
+#include <dbfld.hxx>
+#include <changedb.hxx>
+
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _UTLUI_HRC
+#include <utlui.hrc>
+#endif
+#ifndef _CHANGEDB_HRC
+#include <changedb.hrc>
+#endif
+
+#include <unomid.h>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldeinfuegen bearbeiten
+ --------------------------------------------------------------------*/
+
+
+SwChangeDBDlg::SwChangeDBDlg(SwView& rVw) :
+ SvxStandardDialog(&rVw.GetViewFrame()->GetWindow(), SW_RES(DLG_CHANGE_DB)),
+
+ aDBListFL (this, SW_RES(FL_DBLIST )),
+ aUsedDBFT (this, SW_RES(FT_USEDDB )),
+ aAvailDBFT (this, SW_RES(FT_AVAILDB )),
+ aUsedDBTLB (this, SW_RES(TLB_USEDDB )),
+ aAvailDBTLB (this, SW_RES(TLB_AVAILDB ), 0),
+ aAddDBPB (this, SW_RES(PB_ADDDB)),
+ aDescFT (this, SW_RES(FT_DESC )),
+ aDocDBTextFT(this, SW_RES(FT_DOCDBTEXT )),
+ aDocDBNameFT(this, SW_RES(FT_DOCDBNAME )),
+ aOKBT (this, SW_RES(BT_OK )),
+ aCancelBT (this, SW_RES(BT_CANCEL )),
+ aHelpBT (this, SW_RES(BT_HELP )),
+// aChangeBT (this, SW_RES(BT_CHANGEDB )),
+ aImageList (SW_RES(ILIST_DB_DLG )),
+ aImageListHC (SW_RES(ILIST_DB_DLG_HC )),
+
+ pSh(rVw.GetWrtShellPtr()),
+ pMgr( new SwFldMgr() )
+{
+ aAvailDBTLB.SetWrtShell(*pSh);
+ FillDBPopup();
+
+ FreeResource();
+
+ ShowDBName(pSh->GetDBData());
+ aOKBT.SetClickHdl(LINK(this, SwChangeDBDlg, ButtonHdl));
+ aAddDBPB.SetClickHdl(LINK(this, SwChangeDBDlg, AddDBHdl));
+
+ aUsedDBTLB.SetSelectionMode(MULTIPLE_SELECTION);
+ aUsedDBTLB.SetStyle(aUsedDBTLB.GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL);
+ aUsedDBTLB.SetSpaceBetweenEntries(0);
+
+ aUsedDBTLB.SetNodeBitmaps( aImageList.GetImage(IMG_COLLAPSE),
+ aImageList.GetImage(IMG_EXPAND ), BMP_COLOR_NORMAL );
+ aUsedDBTLB.SetNodeBitmaps( aImageListHC.GetImage(IMG_COLLAPSE),
+ aImageListHC.GetImage(IMG_EXPAND ), BMP_COLOR_HIGHCONTRAST );
+
+ Link aLink = LINK(this, SwChangeDBDlg, TreeSelectHdl);
+
+ aUsedDBTLB.SetSelectHdl(aLink);
+ aUsedDBTLB.SetDeselectHdl(aLink);
+ aAvailDBTLB.SetSelectHdl(aLink);
+ aAvailDBTLB.SetDeselectHdl(aLink);
+ TreeSelectHdl();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datenbank-Listboxen initialisieren
+ --------------------------------------------------------------------*/
+
+
+void SwChangeDBDlg::FillDBPopup()
+{
+ Reference<XNameAccess> xDBContext;
+ Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ if( xMgr.is() )
+ {
+ Reference<XInterface> xInstance = xMgr->createInstance( C2U( "com.sun.star.sdb.DatabaseContext" ));
+ xDBContext = Reference<XNameAccess>(xInstance, UNO_QUERY) ;
+ }
+ DBG_ASSERT(xDBContext.is(), "com.sun.star.sdb.DataBaseContext: service not available");
+
+ const SwDBData& rDBData = pSh->GetDBData();
+ String sDBName(rDBData.sDataSource);
+ String sTableName(rDBData.sCommand);
+ aAvailDBTLB.Select(sDBName, sTableName, aEmptyStr);
+
+ SvStringsDtor aAllDBNames(5, 5);
+
+ Sequence< ::rtl::OUString > aDBNames = xDBContext->getElementNames();
+ const ::rtl::OUString* pDBNames = aDBNames.getConstArray();
+ sal_Int32 nDBCount = aDBNames.getLength();
+ for(sal_Int32 i = 0; i < nDBCount; i++)
+ {
+ aAllDBNames.Insert(new String(pDBNames[i]), aAllDBNames.Count());
+ }
+
+ SvStringsDtor aDBNameList(5, 1);
+ pSh->GetAllUsedDB( aDBNameList, &aAllDBNames );
+
+ USHORT nCount = aDBNameList.Count();
+ aUsedDBTLB.Clear();
+ SvLBoxEntry *pFirst = 0;
+ SvLBoxEntry *pLast = 0;
+
+ for (USHORT k = 0; k < nCount; k++)
+ {
+ sDBName = *aDBNameList.GetObject(k);
+ sDBName = sDBName.GetToken(0);
+ pLast = Insert(sDBName);
+ if (!pFirst)
+ pFirst = pLast;
+ }
+
+ if (pFirst)
+ {
+ aUsedDBTLB.MakeVisible(pFirst);
+ aUsedDBTLB.Select(pFirst);
+ }
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SvLBoxEntry* SwChangeDBDlg::Insert(const String& rDBName)
+{
+ String sDBName(rDBName.GetToken(0, DB_DELIM));
+ String sTableName(rDBName.GetToken(1, DB_DELIM));
+ int nCommandType = rDBName.GetToken(2, DB_DELIM).ToInt32();
+ SvLBoxEntry* pParent;
+ SvLBoxEntry* pChild;
+
+ USHORT nParent = 0;
+ USHORT nChild = 0;
+
+ Image aTableImg = aImageList.GetImage(IMG_DBTABLE);
+ Image aDBImg = aImageList.GetImage(IMG_DB);
+ Image aQueryImg = aImageList.GetImage(IMG_DBQUERY);
+ Image aHCTableImg = aImageListHC.GetImage(IMG_DBTABLE);
+ Image aHCDBImg = aImageListHC.GetImage(IMG_DB);
+ Image aHCQueryImg = aImageListHC.GetImage(IMG_DBQUERY);
+ Image& rToInsert = nCommandType ? aQueryImg : aTableImg;
+ Image& rHCToInsert = nCommandType ? aHCQueryImg : aHCTableImg;
+ while ((pParent = aUsedDBTLB.GetEntry(nParent++)) != NULL)
+ {
+ if (sDBName == aUsedDBTLB.GetEntryText(pParent))
+ {
+ while ((pChild = aUsedDBTLB.GetEntry(pParent, nChild++)) != NULL)
+ {
+ if (sTableName == aUsedDBTLB.GetEntryText(pChild))
+ return pChild;
+ }
+ SvLBoxEntry* pRet = aUsedDBTLB.InsertEntry(sTableName, rToInsert, rToInsert, pParent);
+ aUsedDBTLB.SetExpandedEntryBmp(pRet, rHCToInsert, BMP_COLOR_HIGHCONTRAST);
+ aUsedDBTLB.SetCollapsedEntryBmp(pRet, rHCToInsert, BMP_COLOR_HIGHCONTRAST);
+ pRet->SetUserData((void*)nCommandType);
+ return pRet;
+ }
+ }
+ pParent = aUsedDBTLB.InsertEntry(sDBName, aDBImg, aDBImg);
+ aUsedDBTLB.SetExpandedEntryBmp(pParent, aHCDBImg, BMP_COLOR_HIGHCONTRAST);
+ aUsedDBTLB.SetCollapsedEntryBmp(pParent, aHCDBImg, BMP_COLOR_HIGHCONTRAST);
+
+ SvLBoxEntry* pRet = aUsedDBTLB.InsertEntry(sTableName, rToInsert, rToInsert, pParent);
+ aUsedDBTLB.SetExpandedEntryBmp(pRet, rHCToInsert, BMP_COLOR_HIGHCONTRAST);
+ aUsedDBTLB.SetCollapsedEntryBmp(pRet, rHCToInsert, BMP_COLOR_HIGHCONTRAST);
+ pRet->SetUserData((void*)nCommandType);
+ return pRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Dialog zerstoeren
+ --------------------------------------------------------------------*/
+__EXPORT SwChangeDBDlg::~SwChangeDBDlg()
+{
+ delete pMgr;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Schliessen
+ --------------------------------------------------------------------*/
+void __EXPORT SwChangeDBDlg::Apply()
+{
+ UpdateFlds();
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+void SwChangeDBDlg::UpdateFlds()
+{
+ SvStringsDtor aDBNames( (BYTE)aUsedDBTLB.GetSelectionCount(), 1 );
+ SvLBoxEntry* pEntry = aUsedDBTLB.FirstSelected();
+
+ while( pEntry )
+ {
+ if( aUsedDBTLB.GetParent( pEntry ))
+ {
+ String* pTmp = new String( aUsedDBTLB.GetEntryText(
+ aUsedDBTLB.GetParent( pEntry )));
+ *pTmp += DB_DELIM;
+ *pTmp += aUsedDBTLB.GetEntryText( pEntry );
+ *pTmp += DB_DELIM;
+ int nCommandType = (int)(ULONG)pEntry->GetUserData();
+ *pTmp += String::CreateFromInt32(nCommandType);
+ aDBNames.Insert(pTmp, aDBNames.Count() );
+ }
+ pEntry = aUsedDBTLB.NextSelected(pEntry);
+ }
+
+ pSh->StartAllAction();
+ String sTableName, sColumnName;
+ sal_Bool bIsTable = sal_False;
+ String sTemp(aAvailDBTLB.GetDBName(sTableName, sColumnName, &bIsTable));
+ sTemp += DB_DELIM;
+ sTemp += sTableName;
+ sTemp += DB_DELIM;
+ sTemp += bIsTable ? '0' : '1';
+ pSh->ChangeDBFields( aDBNames, sTemp);
+ pSh->EndAllAction();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwChangeDBDlg, ButtonHdl, Button *, EMPTYARG )
+{
+ String sTableName, sColumnName;
+ SwDBData aData;
+ sal_Bool bIsTable = sal_False;
+ aData.sDataSource = aAvailDBTLB.GetDBName(sTableName, sColumnName, &bIsTable);
+ aData.sCommand = sTableName;
+ aData.nCommandType = bIsTable ? 0 : 1;;
+ pSh->ChgDBData(aData);
+ ShowDBName(pSh->GetDBData());
+ EndDialog(RET_OK);
+
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwChangeDBDlg, TreeSelectHdl, SvTreeListBox *, EMPTYARG )
+{
+ BOOL bEnable = FALSE;
+
+ SvLBoxEntry* pEntry = aAvailDBTLB.GetCurEntry();
+
+ if (pEntry)
+ {
+ if (aAvailDBTLB.GetParent(pEntry))
+ bEnable = TRUE;
+ aOKBT.Enable( bEnable );
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datenbankname fuer Anzeige wandeln
+ --------------------------------------------------------------------*/
+
+void SwChangeDBDlg::ShowDBName(const SwDBData& rDBData)
+{
+ String sTmp(rDBData.sDataSource);
+ String sName;
+ sTmp += '.';
+ sTmp += (String)rDBData.sCommand;
+
+ for (USHORT i = 0; i < sTmp.Len(); i++)
+ {
+ sName += sTmp.GetChar(i);
+ if (sTmp.GetChar(i) == '~')
+ sName += '~';
+ }
+
+ aDocDBNameFT.SetText(sName);
+}
+/*-- 27.05.2004 09:14:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwChangeDBDlg, AddDBHdl, PushButton *, EMPTYARG )
+{
+ String sNewDB = SwNewDBMgr::LoadAndRegisterDataSource();
+ if(sNewDB.Len())
+ aAvailDBTLB.AddDataSource(sNewDB);
+ return 0;
+}
+
diff --git a/sw/source/ui/fldui/changedb.hrc b/sw/source/ui/fldui/changedb.hrc
new file mode 100644
index 000000000000..7bccd2fa9363
--- /dev/null
+++ b/sw/source/ui/fldui/changedb.hrc
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHANGEDB_HRC
+#define _CHANGEDB_HRC
+
+// #include -----------------------------------------------------------------
+
+// Elemente -----------------------------------------------------------------
+
+#define FT_DESC 1
+#define FT_DOCDBTEXT 2
+#define FT_DOCDBNAME 3
+#define BT_CHANGEDB 4
+#define FT_USEDDB 5
+#define FT_AVAILDB 6
+#define TLB_USEDDB 7
+#define TLB_AVAILDB 8
+#define FL_DBLIST 9
+#define BT_OK 10
+#define BT_CANCEL 11
+#define BT_HELP 12
+#define PB_ADDDB 13
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bitmaps
+ --------------------------------------------------------------------*/
+
+#define IMG_COLLAPSE 18002 /*RID_SVXIMG_COLLAPSEDNODE*/
+#define IMG_EXPAND 18003 /*RID_SVXIMG_EXPANDEDNODE*/
+#define IMG_DB 1
+#define IMG_DBTABLE 2
+#define IMG_DBQUERY 3
+
+#endif
+
+
diff --git a/sw/source/ui/fldui/changedb.src b/sw/source/ui/fldui/changedb.src
new file mode 100644
index 000000000000..7a67a360eda7
--- /dev/null
+++ b/sw/source/ui/fldui/changedb.src
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "changedb.hrc"
+#include "fldui.hrc"
+
+
+ModalDialog DLG_CHANGE_DB
+{
+ HelpID = "sw:ModalDialog:DLG_CHANGE_DB";
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 286 , 175 ) ;
+
+ Text [ en-US ] = "Exchange Databases" ;
+ Moveable = TRUE ;
+ FixedLine FL_DBLIST
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 218 , 8 ) ;
+
+ Text [ en-US ] = "Exchange databases" ;
+ };
+ FixedText FT_USEDDB
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Databases in Use" ;
+ };
+ FixedText FT_AVAILDB
+ {
+ Pos = MAP_APPFONT ( 118 , 14 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Available Databases" ;
+ };
+ Control TLB_USEDDB
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 100 , 62 ) ;
+ TabStop = TRUE ;
+ };
+ Control TLB_AVAILDB
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 118 , 25 ) ;
+ Size = MAP_APPFONT ( 100 , 62 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_ADDDB
+ {
+ HelpID = "sw:PushButton:DLG_CHANGE_DB:PB_ADDDB";
+ Pos = MAP_APPFONT ( 118 , 90 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Browse..." ;
+ };
+ FixedText FT_DESC
+ {
+ Pos = MAP_APPFONT ( 12 , 110 ) ;
+ Size = MAP_APPFONT ( 210 , 45 ) ;
+ WordBreak = TRUE ;
+ Left = TRUE ;
+ Text [ en-US ] = "Use this dialog to replace the databases you access in your document via database fields, with other databases. You can only make one change at a time. Multiple selection is possible in the list on the left.\nUse the browse button to select a database file." ;
+ };
+ FixedText FT_DOCDBTEXT
+ {
+ Pos = MAP_APPFONT ( 6 , 161 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Database applied to document:" ;
+ };
+ FixedText FT_DOCDBNAME
+ {
+ Pos = MAP_APPFONT ( 109 , 161 ) ;
+ Size = MAP_APPFONT ( 114 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Addresses.Addresses" ;
+ };
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 230 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Define" ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 230 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Close" ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 230 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+
diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
new file mode 100644
index 000000000000..3c67cdb6afe7
--- /dev/null
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -0,0 +1,583 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <swmodule.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <dbfld.hxx>
+#ifndef _FLDTDLG_HXX
+#include <fldtdlg.hxx>
+#endif
+#include <numrule.hxx>
+
+#ifndef _FLDTDLG_HRC
+#include <fldtdlg.hrc>
+#endif
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _FLDDB_HXX
+#include <flddb.hxx>
+#endif
+#include <dbconfig.hxx>
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+
+#define USER_DATA_VERSION_1 "1"
+#define USER_DATA_VERSION USER_DATA_VERSION_1
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldDBPage::SwFldDBPage(Window* pParent, const SfxItemSet& rCoreSet ) :
+ SwFldPage( pParent, SW_RES( TP_FLD_DB ), rCoreSet ),
+ aTypeFT (this, SW_RES(FT_DBTYPE)),
+ aTypeLB (this, SW_RES(LB_DBTYPE)),
+ aSelectionFT(this, SW_RES(FT_DBSELECTION)),
+ aDatabaseTLB(this, SW_RES(TLB_DBLIST), 0, aEmptyStr, FALSE),
+ aAddDBFT(this, SW_RES(FT_ADDDB)),
+ aAddDBPB(this, SW_RES(PB_ADDDB)),
+ aConditionFT(this, SW_RES(FT_DBCONDITION)),
+ aConditionED(this, SW_RES(ED_DBCONDITION)),
+ aValueFT (this, SW_RES(FT_DBSETNUMBER)),
+ aValueED (this, SW_RES(ED_DBSETNUMBER)),
+ aDBFormatRB (this, SW_RES(RB_DBOWNFORMAT)),
+ aNewFormatRB(this, SW_RES(RB_DBFORMAT)),
+ aNumFormatLB(this, SW_RES(LB_DBNUMFORMAT)),
+ aFormatLB (this, SW_RES(LB_DBFORMAT)),
+ aFormatFL (this, SW_RES(FL_DBFORMAT)),
+ aFormatVertFL (this, SW_RES(FL_DBFORMAT_VERT))
+{
+ FreeResource();
+
+ aOldNumSelectHdl = aNumFormatLB.GetSelectHdl();
+
+ aNumFormatLB.SetSelectHdl(LINK(this, SwFldDBPage, NumSelectHdl));
+ aDatabaseTLB.SetSelectHdl(LINK(this, SwFldDBPage, TreeSelectHdl));
+ aDatabaseTLB.SetDoubleClickHdl(LINK(this, SwFldDBPage, InsertHdl));
+
+ aValueED.SetModifyHdl(LINK(this, SwFldDBPage, ModifyHdl));
+ aAddDBPB.SetClickHdl(LINK(this, SwFldDBPage, AddDBHdl));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+__EXPORT SwFldDBPage::~SwFldDBPage()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: TabPage initialisieren
+ --------------------------------------------------------------------*/
+
+void __EXPORT SwFldDBPage::Reset(const SfxItemSet&)
+{
+ Init(); // Allgemeine initialisierung
+
+ aTypeLB.SetUpdateMode(FALSE);
+ USHORT nOldPos = aTypeLB.GetSelectEntryPos();
+ sOldDBName = aDatabaseTLB.GetDBName(sOldTableName, sOldColumnName);
+
+ aTypeLB.Clear();
+
+ USHORT nPos, nTypeId, i;
+
+ if (!IsFldEdit())
+ {
+ // TypeListBox initialisieren
+ const SwFldGroupRgn& rRg = GetFldMgr().GetGroupRange(IsFldDlgHtmlMode(), GetGroup());
+
+ for(i = rRg.nStart; i < rRg.nEnd; ++i)
+ {
+ nTypeId = GetFldMgr().GetTypeId(i);
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(i));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ }
+ }
+ else
+ {
+ nTypeId = GetCurField()->GetTypeId();
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(GetFldMgr().GetPos(nTypeId)));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ }
+
+ // alte Pos selektieren
+ if (GetTypeSel() != LISTBOX_ENTRY_NOTFOUND)
+ aTypeLB.SelectEntryPos(GetTypeSel());
+
+ aFormatLB.Clear();
+
+ USHORT nSize = GetFldMgr().GetFormatCount(TYP_DBSETNUMBERFLD, FALSE, IsFldDlgHtmlMode());
+ for( i = 0; i < nSize; ++i )
+ {
+ USHORT nEntryPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr(TYP_DBSETNUMBERFLD, i));
+ USHORT nFmtId = GetFldMgr().GetFormatId( TYP_DBSETNUMBERFLD, i );
+ aFormatLB.SetEntryData( nEntryPos, reinterpret_cast<void*>(nFmtId) );
+ if( SVX_NUM_ARABIC == nFmtId )
+ aFormatLB.SelectEntryPos( nEntryPos );
+ }
+
+ if (!IsFldEdit())
+ {
+ if (nOldPos != LISTBOX_ENTRY_NOTFOUND)
+ aTypeLB.SelectEntryPos(nOldPos);
+
+ if (sOldDBName.Len())
+ {
+ aDatabaseTLB.Select(sOldDBName, sOldTableName, sOldColumnName);
+ }
+ else
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ SwDBData aTmp(pSh->GetDBData());
+ aDatabaseTLB.Select(aTmp.sDataSource, aTmp.sCommand, aEmptyStr);
+ }
+ }
+ }
+
+ if( !IsRefresh() )
+ {
+ String sUserData = GetUserData();
+ if(sUserData.GetToken(0, ';').EqualsIgnoreCaseAscii(USER_DATA_VERSION_1))
+ {
+ String sVal = sUserData.GetToken(1, ';');
+ USHORT nVal = (USHORT)sVal.ToInt32();
+ if(nVal != USHRT_MAX)
+ {
+ for(i = 0; i < aTypeLB.GetEntryCount(); i++)
+ if(nVal == (USHORT)(ULONG)aTypeLB.GetEntryData(i))
+ {
+ aTypeLB.SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+ }
+ TypeHdl(0);
+
+ aTypeLB.SetUpdateMode(TRUE);
+ aTypeLB.SetSelectHdl(LINK(this, SwFldDBPage, TypeHdl));
+ aTypeLB.SetDoubleClickHdl(LINK(this, SwFldDBPage, InsertHdl));
+
+ if (IsFldEdit())
+ {
+ aConditionED.SaveValue();
+ aValueED.SaveValue();
+ sOldDBName = aDatabaseTLB.GetDBName(sOldTableName, sOldColumnName);
+ nOldFormat = GetCurField()->GetFormat();
+ nOldSubType = GetCurField()->GetSubType();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL __EXPORT SwFldDBPage::FillItemSet(SfxItemSet& )
+{
+ String sTableName, sColumnName;
+ SwDBData aData;
+ sal_Bool bIsTable;
+ aData.sDataSource = aDatabaseTLB.GetDBName(sTableName, sColumnName, &bIsTable);
+ aData.sCommand = sTableName;
+ aData.nCommandType = bIsTable ? 0 : 1;
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+
+ if (!aData.sDataSource.getLength())
+ aData = pSh->GetDBData();
+
+ if(aData.sDataSource.getLength()) // Ohne Datenbank kein neuer Feldbefehl
+ {
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+ String aVal(aValueED.GetText());
+ String aName(aConditionED.GetText());
+ ULONG nFormat = 0;
+ USHORT nSubType = 0;
+
+ String sDBName = aData.sDataSource;
+ sDBName += DB_DELIM;
+ sDBName += (String)aData.sCommand;
+ sDBName += DB_DELIM;
+ sDBName += String::CreateFromInt32(aData.nCommandType);
+ sDBName += DB_DELIM;
+ if(sColumnName.Len())
+ {
+ sDBName += sColumnName;
+ sDBName += DB_DELIM;
+ }
+ aName.Insert(sDBName, 0);
+
+ switch (nTypeId)
+ {
+ case TYP_DBFLD:
+ nFormat = aNumFormatLB.GetFormat();
+ if (aNewFormatRB.IsEnabled() && aNewFormatRB.IsChecked())
+ nSubType = nsSwExtendedSubType::SUB_OWN_FMT;
+ aName = sDBName;
+ break;
+
+ case TYP_DBSETNUMBERFLD:
+ nFormat = (USHORT)(ULONG)aFormatLB.GetEntryData(
+ aFormatLB.GetSelectEntryPos() );
+ break;
+ }
+
+
+ String sTempDBName, sTempTableName, sTempColumnName;
+ sTempDBName = aDatabaseTLB.GetDBName(sTempTableName, sTempColumnName);
+ BOOL bDBListBoxChanged = sOldDBName != sTempDBName ||
+ sOldTableName != sTempTableName || sOldColumnName != sTempColumnName;
+ if (!IsFldEdit() ||
+ aConditionED.GetSavedValue() != aConditionED.GetText() ||
+ aValueED.GetSavedValue() != aValueED.GetText() ||
+ bDBListBoxChanged ||
+ nOldFormat != nFormat || nOldSubType != nSubType)
+ {
+ InsertFld( nTypeId, nSubType, aName, aVal, nFormat);
+ }
+ }
+
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* __EXPORT SwFldDBPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwFldDBPage( pParent, rAttrSet ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldDBPage::GetGroup()
+{
+ return GRP_DB;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDBPage, TypeHdl, ListBox *, pBox )
+{
+ // Alte ListBoxPos sichern
+ const USHORT nOld = GetTypeSel();
+
+ // Aktuelle ListBoxPos
+ SetTypeSel(aTypeLB.GetSelectEntryPos());
+
+ if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
+ {
+ SetTypeSel(0);
+ aTypeLB.SelectEntryPos(0);
+ }
+
+ if (nOld != GetTypeSel())
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ BOOL bCond = FALSE, bSetNo = FALSE, bFormat = FALSE, bDBFormat = FALSE;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ aDatabaseTLB.ShowColumns(nTypeId == TYP_DBFLD);
+
+ if (IsFldEdit())
+ {
+ SwDBData aData;
+ String sColumnName;
+ if (nTypeId == TYP_DBFLD)
+ {
+ aData = ((SwDBField*)GetCurField())->GetDBData();
+ sColumnName = ((SwDBFieldType*)GetCurField()->GetTyp())->GetColumnName();
+ }
+ else
+ {
+ aData = ((SwDBNameInfField*)GetCurField())->GetDBData(pSh->GetDoc());
+ }
+ aDatabaseTLB.Select(aData.sDataSource, aData.sCommand, sColumnName);
+ }
+
+ switch (nTypeId)
+ {
+ case TYP_DBFLD:
+ bFormat = TRUE;
+ bDBFormat = TRUE;
+ aNumFormatLB.Show();
+ aFormatLB.Hide();
+
+ if (pBox) // Typ wurde vom User geaendert
+ aDBFormatRB.Check();
+
+ if (IsFldEdit())
+ {
+ if (GetCurField()->GetFormat() != 0 && GetCurField()->GetFormat() != SAL_MAX_UINT32)
+ aNumFormatLB.SetDefFormat(GetCurField()->GetFormat());
+
+ if (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_OWN_FMT)
+ aNewFormatRB.Check();
+ else
+ aDBFormatRB.Check();
+ }
+ break;
+
+ case TYP_DBNUMSETFLD:
+ bSetNo = TRUE;
+ // kein break!
+ case TYP_DBNEXTSETFLD:
+ bCond = TRUE;
+ if (IsFldEdit())
+ {
+ aConditionED.SetText(GetCurField()->GetPar1());
+ aValueED.SetText(GetCurField()->GetPar2());
+ }
+ break;
+
+ case TYP_DBNAMEFLD:
+ break;
+
+ case TYP_DBSETNUMBERFLD:
+ bFormat = TRUE;
+ aNewFormatRB.Check();
+ aNumFormatLB.Hide();
+ aFormatLB.Show();
+ if( IsFldEdit() )
+ {
+ for( USHORT nI = aFormatLB.GetEntryCount(); nI; )
+ if( GetCurField()->GetFormat() == (USHORT)(ULONG)
+ aFormatLB.GetEntryData( --nI ))
+ {
+ aFormatLB.SelectEntryPos( nI );
+ break;
+ }
+ }
+ break;
+ }
+
+ aConditionFT.Enable(bCond);
+ aConditionED.Enable(bCond);
+ aValueFT.Enable(bSetNo);
+ aValueED.Enable(bSetNo);
+ if (nTypeId != TYP_DBFLD)
+ {
+ aDBFormatRB.Enable(bDBFormat);
+ aNewFormatRB.Enable(bDBFormat|bFormat);
+ aNumFormatLB.Enable(bDBFormat);
+ aFormatLB.Enable(bFormat);
+ }
+ aFormatFL.Enable(bDBFormat|bFormat);
+
+ if (!IsFldEdit())
+ {
+ aValueED.SetText(aEmptyStr);
+ if (bCond)
+ aConditionED.SetText( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( "TRUE" )));
+ else
+ aConditionED.SetText(aEmptyStr);
+ }
+
+ CheckInsert();
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDBPage, NumSelectHdl, NumFormatListBox *, pLB )
+{
+ aNewFormatRB.Check();
+ aOldNumSelectHdl.Call(pLB);
+
+ return 0;
+}
+
+/*---------------------------------------------------------------------
+ Beschreibung:
+---------------------------------------------------------------------*/
+
+void SwFldDBPage::CheckInsert()
+{
+ BOOL bInsert = TRUE;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ SvLBoxEntry* pEntry = aDatabaseTLB.GetCurEntry();
+
+ if (pEntry)
+ {
+ pEntry = aDatabaseTLB.GetParent(pEntry);
+
+ if (nTypeId == TYP_DBFLD && pEntry)
+ pEntry = aDatabaseTLB.GetParent(pEntry);
+
+ bInsert &= pEntry != 0;
+ }
+ else
+ bInsert = FALSE;
+
+ if (nTypeId == TYP_DBNUMSETFLD)
+ {
+ BOOL bHasValue = aValueED.GetText().Len() != 0;
+
+ bInsert &= bHasValue;
+ }
+
+ EnableInsert(bInsert);
+}
+
+/*---------------------------------------------------------------------
+ Beschreibung:
+---------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDBPage, TreeSelectHdl, SvTreeListBox *, pBox )
+{
+ SvLBoxEntry* pColEntry;
+ SvLBoxEntry* pEntry = pColEntry = pBox->GetCurEntry();
+ if (pEntry)
+ {
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ pEntry = aDatabaseTLB.GetParent(pEntry);
+
+ if (nTypeId == TYP_DBFLD && pEntry)
+ pEntry = aDatabaseTLB.GetParent(pEntry);
+
+ CheckInsert();
+
+ if (nTypeId == TYP_DBFLD)
+ {
+ BOOL bNumFormat = FALSE;
+
+ if (pEntry != 0)
+ {
+ String sTableName;
+ String sColumnName;
+ BOOL bIsTable;
+ String sDBName = aDatabaseTLB.GetDBName(sTableName, sColumnName, &bIsTable);
+ bNumFormat = GetFldMgr().IsDBNumeric(sDBName,
+ sTableName,
+ bIsTable,
+ sColumnName);
+ if (!IsFldEdit())
+ aDBFormatRB.Check();
+ }
+
+ aDBFormatRB.Enable(bNumFormat);
+ aNewFormatRB.Enable(bNumFormat);
+ aNumFormatLB.Enable(bNumFormat);
+ aFormatFL.Enable(bNumFormat);
+ }
+ }
+ return 0;
+}
+/*-- 27.05.2004 09:14:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwFldDBPage, AddDBHdl, PushButton *, EMPTYARG )
+{
+ String sNewDB = SwNewDBMgr::LoadAndRegisterDataSource();
+ if(sNewDB.Len())
+ {
+ aDatabaseTLB.AddDataSource(sNewDB);
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Modify
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDBPage, ModifyHdl, Edit *, EMPTYARG )
+{
+ CheckInsert();
+ return 0;
+}
+
+/* -----------------12.01.99 11:21-------------------
+ *
+ * --------------------------------------------------*/
+void SwFldDBPage::FillUserData()
+{
+ String sData( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( USER_DATA_VERSION )));
+ sData += ';';
+ USHORT nTypeSel = aTypeLB.GetSelectEntryPos();
+
+ if( LISTBOX_ENTRY_NOTFOUND == nTypeSel )
+ nTypeSel = USHRT_MAX;
+ else
+ nTypeSel = (USHORT)(ULONG)aTypeLB.GetEntryData( nTypeSel );
+ sData += String::CreateFromInt32( nTypeSel );
+ SetUserData(sData);
+}
+/* -----------------12.12.2002 11:33-----------------
+ *
+ * --------------------------------------------------*/
+void SwFldDBPage::ActivateMailMergeAddress()
+{
+ ULONG nData = TYP_DBFLD;
+ aTypeLB.SelectEntryPos(aTypeLB.GetEntryPos( (const void*) nData ));
+ aTypeLB.GetSelectHdl().Call(&aTypeLB);
+ const SwDBData& rData = SW_MOD()->GetDBConfig()->GetAddressSource();
+ aDatabaseTLB.Select(rData.sDataSource, rData.sCommand, aEmptyStr);
+}
+/*-- 07.10.2003 13:59:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwFldDBPage::SetWrtShell(SwWrtShell& rSh)
+{
+ aDatabaseTLB.SetWrtShell(rSh);
+}
diff --git a/sw/source/ui/fldui/flddb.hxx b/sw/source/ui/fldui/flddb.hxx
new file mode 100644
index 000000000000..2472031777a1
--- /dev/null
+++ b/sw/source/ui/fldui/flddb.hxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWFLDDB_HXX
+#define _SWFLDDB_HXX
+
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/group.hxx>
+
+#include "condedit.hxx"
+#include "dbtree.hxx"
+#include "numfmtlb.hxx"
+
+#include "fldpage.hxx"
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwFldDBPage : public SwFldPage
+{
+ FixedText aTypeFT;
+ ListBox aTypeLB;
+ FixedText aSelectionFT;
+ SwDBTreeList aDatabaseTLB;
+
+ FixedText aAddDBFT;
+ PushButton aAddDBPB;
+
+ FixedText aConditionFT;
+ ConditionEdit aConditionED;
+ FixedText aValueFT;
+ Edit aValueED;
+ RadioButton aDBFormatRB;
+ RadioButton aNewFormatRB;
+ NumFormatListBox aNumFormatLB;
+ ListBox aFormatLB;
+ FixedLine aFormatFL;
+ FixedLine aFormatVertFL;
+
+ String sOldDBName;
+ String sOldTableName;
+ String sOldColumnName;
+ ULONG nOldFormat;
+ USHORT nOldSubType;
+ Link aOldNumSelectHdl;
+
+ DECL_LINK( TypeHdl, ListBox* );
+ DECL_LINK( NumSelectHdl, NumFormatListBox* pLB = 0);
+ DECL_LINK( TreeSelectHdl, SvTreeListBox* pBox );
+ DECL_LINK( ModifyHdl, Edit *pED = 0 );
+ DECL_LINK( AddDBHdl, PushButton* );
+
+ void CheckInsert();
+
+ using SwFldPage::SetWrtShell;
+
+protected:
+ virtual USHORT GetGroup();
+
+public:
+ SwFldDBPage(Window* pParent, const SfxItemSet& rSet);
+
+ ~SwFldDBPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual void FillUserData();
+ void ActivateMailMergeAddress();
+
+ void SetWrtShell(SwWrtShell& rSh);
+};
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/flddb.src b/sw/source/ui/fldui/flddb.src
new file mode 100644
index 000000000000..6e715c455473
--- /dev/null
+++ b/sw/source/ui/fldui/flddb.src
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "fldtdlg.hrc"
+#include "helpid.h"
+TabPage TP_FLD_DB
+{
+ HelpID = HID_FLD_DB ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_DBTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Type" ;
+ Left = TRUE ;
+ };
+ ListBox LB_DBTYPE
+ {
+ HelpID = "sw:ListBox:TP_FLD_DB:LB_DBTYPE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 104 ) ;
+ TabStop = TRUE ;
+ Sort = TRUE ;
+ AutoHScroll = TRUE ;
+ /* StringList =
+ {
+ < "Beliebiger Datensatz" ; > ;
+ < "Datensatznummer" ; > ;
+ < "Nächster Datensatz" ; > ;
+ < "Serienbrieffeld" ; > ;
+ < "Datenbankname" ; > ;
+ };*/
+ };
+ FixedText FT_DBCONDITION
+ {
+ Pos = MAP_APPFONT ( 6 , 126 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Condition" ;
+ Left = TRUE ;
+ };
+ Edit ED_DBCONDITION
+ {
+ HelpID = "sw:Edit:TP_FLD_DB:ED_DBCONDITION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 137 ) ;
+ Size = MAP_APPFONT ( 76 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_DBSETNUMBER
+ {
+ Pos = MAP_APPFONT ( 6 , 156 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "Record number" ;
+ Left = TRUE ;
+ };
+ Edit ED_DBSETNUMBER
+ {
+ HelpID = "sw:Edit:TP_FLD_DB:ED_DBSETNUMBER";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 167 ) ;
+ Size = MAP_APPFONT ( 76 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_DBSELECTION
+ {
+ Pos = MAP_APPFONT ( 88 , 3 ) ;
+ Size = MAP_APPFONT ( 166 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Database s~election" ;
+ };
+ Control TLB_DBLIST
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 14 ) ;
+ Size = MAP_APPFONT ( 160 , 104 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_ADDDB
+ {
+ Pos = MAP_APPFONT ( 88 , 123) ;
+ Size = MAP_APPFONT ( 105 , 8 ) ;
+ Text [ en-US ] = "Add database file" ;
+ };
+ PushButton PB_ADDDB
+ {
+ HelpID = "sw:PushButton:TP_FLD_DB:PB_ADDDB";
+ Pos = MAP_APPFONT ( 198 , 121) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Browse..." ;
+ };
+
+ RadioButton RB_DBOWNFORMAT
+ {
+ HelpID = "sw:RadioButton:TP_FLD_DB:RB_DBOWNFORMAT";
+ Pos = MAP_APPFONT ( 94 , 153 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Check = TRUE ;
+ Text [ en-US ] = "From database" ;
+ };
+ RadioButton RB_DBFORMAT
+ {
+ HelpID = "sw:RadioButton:TP_FLD_DB:RB_DBFORMAT";
+ Pos = MAP_APPFONT ( 94 , 166 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "User-defined" ;
+ };
+ ListBox LB_DBNUMFORMAT
+ {
+ HelpID = "sw:ListBox:TP_FLD_DB:LB_DBNUMFORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 195 , 164 ) ;
+ Size = MAP_APPFONT ( 53 , 60 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ DropDown = TRUE ;
+ };
+ ListBox LB_DBFORMAT
+ {
+ HelpID = "sw:ListBox:TP_FLD_DB:LB_DBFORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 195 , 163 ) ;
+ Size = MAP_APPFONT ( 53 , 60 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ DropDown = TRUE ;
+ Sort = FALSE ;
+ Hide = TRUE ;
+ };
+ FixedLine FL_DBFORMAT
+ {
+ Pos = MAP_APPFONT ( 88 , 141 ) ;
+ Size = MAP_APPFONT ( 166 , 8 ) ;
+ Text [ en-US ] = "Format" ;
+ };
+ FixedLine FL_DBFORMAT_VERT
+ {
+ Pos = MAP_APPFONT ( 87 , 152 ) ;
+ Size = MAP_APPFONT ( 4 , 28 ) ;
+ Vert = TRUE;
+ };
+ Text [ en-US ] = "Database" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx
new file mode 100644
index 000000000000..1fd345c832d4
--- /dev/null
+++ b/sw/source/ui/fldui/flddinf.cxx
@@ -0,0 +1,537 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include <sfx2/request.hxx>
+#include <sfx2/frame.hxx>
+#include <vcl/svapp.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
+
+#include <helpid.h>
+#include <swtypes.hxx>
+#include <globals.hrc>
+#include <fldbas.hxx>
+#include <docufld.hxx>
+#include <wrtsh.hxx>
+
+#include <fldui.hrc>
+
+#ifndef _FLDTDLG_HRC
+#include <fldtdlg.hrc>
+#endif
+#ifndef _FLDDINF_HXX
+#include <flddinf.hxx>
+#endif
+#include <swmodule.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+
+#define USER_DATA_VERSION_1 "1"
+#define USER_DATA_VERSION USER_DATA_VERSION_1
+
+using namespace nsSwDocInfoSubType;
+using namespace com::sun::star;
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldDokInfPage::SwFldDokInfPage(Window* pWindow, const SfxItemSet& rCoreSet ) :
+ SwFldPage( pWindow, SW_RES( TP_FLD_DOKINF ), rCoreSet ),
+
+ aTypeFT (this, SW_RES(FT_DOKINFTYPE)),
+ aTypeTLB (this, SW_RES(TLB_DOKINFTYPE)),
+ aSelectionFT(this, SW_RES(FT_DOKINFSELECTION)),
+ aSelectionLB(this, SW_RES(LB_DOKINFSELECTION)),
+ aFormatFT (this, SW_RES(FT_DOKINFFORMAT)),
+ aFormatLB (this, SW_RES(LB_DOKINFFORMAT)),
+ aFixedCB (this, SW_RES(CB_DOKINFFIXEDCONTENT)),
+
+ pSelEntry (0),
+ aInfoStr (SW_RES(STR_DOKINF_INFO))
+{
+ FreeResource();
+
+ aTypeTLB.SetHelpId(HID_FIELD_DINF_TYPE);
+ aTypeTLB.SetSelectionMode(SINGLE_SELECTION);
+ aTypeTLB.SetStyle(aTypeTLB.GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL);
+ // Font nicht setzen, damit der Font des Controls uebernommen wird!
+ // Sonst bei falschem Font Bug an OV.
+ aTypeTLB.SetSpaceBetweenEntries(0);
+
+ aTypeTLB.SetNodeDefaultImages();
+ //enable 'active' language selection
+ aFormatLB.SetShowLanguageControl(TRUE);
+
+ SFX_ITEMSET_ARG( &rCoreSet, pItem, SfxUnoAnyItem, SID_DOCINFO, FALSE );
+ if ( pItem )
+ pItem->GetValue() >>= xCustomPropertySet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+__EXPORT SwFldDokInfPage::~SwFldDokInfPage()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void __EXPORT SwFldDokInfPage::Reset(const SfxItemSet& )
+{
+ Init(); // Allgemeine initialisierung
+
+ // TypeListBox initialisieren
+ aTypeTLB.SetUpdateMode(FALSE);
+ aTypeTLB.Clear();
+ pSelEntry = 0;
+
+ // SubTypes in der TypeLB anzeigen
+ USHORT nTypeId = TYP_DOCINFOFLD;
+ SvLBoxEntry* pEntry = 0;
+
+ SvLBoxEntry* pInfo = 0;
+
+ USHORT nSubType = USHRT_MAX;
+ if (IsFldEdit())
+ {
+ const SwField* pCurField = GetCurField();
+ nSubType = ((SwDocInfoField*)pCurField)->GetSubType() & 0xff;
+ if( nSubType == DI_CUSTOM )
+ {
+ m_sOldCustomFieldName = static_cast<const SwDocInfoField*>(pCurField)->GetName();
+ }
+ aFormatLB.SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
+ SwWrtShell *pSh = GetWrtShell();
+ if(pSh)
+ {
+ const SvNumberformat* pFormat = pSh->GetNumberFormatter()->GetEntry(pCurField->GetFormat());
+ if(pFormat)
+ aFormatLB.SetLanguage(pFormat->GetLanguage());
+ }
+ }
+
+ USHORT nSelEntryData = USHRT_MAX;
+ String sUserData = GetUserData();
+ if(sUserData.GetToken(0, ';').EqualsIgnoreCaseAscii(USER_DATA_VERSION_1))
+ {
+ String sVal = sUserData.GetToken(1, ';');
+ nSelEntryData = static_cast< USHORT >(sVal.ToInt32());
+ }
+
+ SvStringsDtor aLst;
+ GetFldMgr().GetSubTypes(nTypeId, aLst);
+ for (USHORT i = 0; i < aLst.Count(); ++i)
+ {
+ if (!IsFldEdit() || nSubType == i)
+ {
+ if (DI_CUSTOM == i)
+ {
+ if(xCustomPropertySet.is() )
+ {
+ uno::Reference< beans::XPropertySetInfo > xSetInfo = xCustomPropertySet->getPropertySetInfo();
+ const uno::Sequence< beans::Property > rProperties = xSetInfo->getProperties();
+// uno::Sequence< ::rtl::OUString > aPropertyNames(rProperties.getLength());
+// for (sal_Int32 i = 0; i < rProperties.getLength(); ++i) {
+// aPropertyNames[i] = rProperties[i].Name;
+// }
+ //if ( !IsFldEdit() )
+ if( rProperties.getLength() )
+ {
+ pInfo = aTypeTLB.InsertEntry( String(SW_RES( STR_CUSTOM )) );
+ pInfo->SetUserData(reinterpret_cast<void*>(USHRT_MAX));
+
+ for (sal_Int32 n=0; n < rProperties.getLength(); n++)
+ {
+ rtl::OUString sEntry = rProperties[n].Name;
+ pEntry = aTypeTLB.InsertEntry(sEntry, pInfo);
+ if(m_sOldCustomFieldName.equals( sEntry ))
+ {
+ pSelEntry = pEntry;
+ aTypeTLB.Expand( pInfo );
+ }
+ pEntry->SetUserData(reinterpret_cast<void*>(i));
+ }
+ }
+ }
+ }
+ else
+ {
+ if (!(IsFldDlgHtmlMode() && (i == DI_EDIT || i == DI_THEMA || i == DI_PRINT)))
+ {
+ pEntry = aTypeTLB.InsertEntry(*aLst[i]);
+ pEntry->SetUserData(reinterpret_cast<void*>(i));
+ }
+ }
+ if(nSelEntryData == i)
+ pSelEntry = pEntry;
+ }
+ }
+
+ // alte Pos selektieren
+ if (pSelEntry != 0)
+ {
+ aTypeTLB.Select(pSelEntry);
+ nSubType = (USHORT)(ULONG)pSelEntry->GetUserData();
+ }
+ else if ( aTypeTLB.GetEntry(0) )
+ {
+ pSelEntry = aTypeTLB.GetEntry(0);
+ nSubType = (USHORT)(ULONG)pSelEntry->GetUserData();
+ }
+
+ FillSelectionLB(nSubType);
+ if ( pSelEntry )
+ TypeHdl();
+
+ aTypeTLB.SetUpdateMode(TRUE);
+ aTypeTLB.SetSelectHdl(LINK(this, SwFldDokInfPage, TypeHdl));
+ aTypeTLB.SetDoubleClickHdl(LINK(this, SwFldDokInfPage, InsertHdl));
+ aSelectionLB.SetSelectHdl(LINK(this, SwFldDokInfPage, SubTypeHdl));
+ aSelectionLB.SetDoubleClickHdl(LINK(this, SwFldDokInfPage, InsertHdl));
+ aFormatLB.SetDoubleClickHdl(LINK(this, SwFldDokInfPage, InsertHdl));
+
+ if (IsFldEdit())
+ {
+ nOldSel = aSelectionLB.GetSelectEntryPos();
+ nOldFormat = GetCurField()->GetFormat();
+ aFixedCB.SaveValue();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDokInfPage, TypeHdl, ListBox *, EMPTYARG )
+{
+ // Alte ListBoxPos sichern
+ SvLBoxEntry* pOldEntry = pSelEntry;
+
+ // Aktuelle ListBoxPos
+ pSelEntry = aTypeTLB.FirstSelected();
+
+ if(!pSelEntry)
+ {
+ pSelEntry = aTypeTLB.GetEntry(0);
+ aTypeTLB.Select(pSelEntry);
+ }
+ else
+
+ if (pOldEntry != pSelEntry)
+ FillSelectionLB((USHORT)(ULONG)pSelEntry->GetUserData());
+
+ SubTypeHdl();
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+IMPL_LINK( SwFldDokInfPage, SubTypeHdl, ListBox *, EMPTYARG )
+{
+ USHORT nSubType = (USHORT)(ULONG)pSelEntry->GetUserData();
+ USHORT nPos = aSelectionLB.GetSelectEntryPos();
+ USHORT nExtSubType;
+ USHORT nNewType = 0;
+
+ if (nSubType != DI_EDIT)
+ {
+ if (nPos == LISTBOX_ENTRY_NOTFOUND)
+ {
+ if (!aSelectionLB.GetEntryCount())
+ {
+ aFormatLB.Clear();
+ aFormatLB.Enable(FALSE);
+ aFormatFT.Enable(FALSE);
+ if( nSubType == DI_CUSTOM )
+ {
+ //find out which type the custom field has - for a start set to DATE format
+ ::rtl::OUString sName = aTypeTLB.GetEntryText(pSelEntry);
+ try
+ {
+ uno::Any aVal = xCustomPropertySet->getPropertyValue( sName );
+ const uno::Type& rValueType = aVal.getValueType();
+ if( rValueType == ::getCppuType( (util::DateTime*)0 ))
+ {
+ nNewType = NUMBERFORMAT_DATETIME;
+ }
+ else if( rValueType == ::getCppuType( (util::Date*)0 ))
+ {
+ nNewType = NUMBERFORMAT_DATE;
+ }
+ else if( rValueType == ::getCppuType( (util::Time*)0 ))
+ {
+ nNewType = NUMBERFORMAT_TIME;
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ }
+ }
+ else
+ return 0;
+ }
+ nPos = 0;
+ }
+
+ nExtSubType = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
+ }
+ else
+ nExtSubType = DI_SUB_TIME;
+
+ USHORT nOldType = 0;
+ BOOL bEnable = FALSE;
+ BOOL bOneArea = FALSE;
+
+ if (aFormatLB.IsEnabled())
+ nOldType = aFormatLB.GetFormatType();
+
+ switch (nExtSubType)
+ {
+ case DI_SUB_AUTHOR:
+ break;
+
+ case DI_SUB_DATE:
+ nNewType = NUMBERFORMAT_DATE;
+ bOneArea = TRUE;
+ break;
+
+ case DI_SUB_TIME:
+ nNewType = NUMBERFORMAT_TIME;
+ bOneArea = TRUE;
+ break;
+ }
+ if (!nNewType)
+ {
+ aFormatLB.Clear();
+ }
+ else
+ {
+ if (nOldType != nNewType)
+ {
+ aFormatLB.SetFormatType(nNewType);
+ aFormatLB.SetOneArea(bOneArea);
+ }
+ bEnable = TRUE;
+ }
+
+ ULONG nFormat = IsFldEdit() ? ((SwDocInfoField*)GetCurField())->GetFormat() : 0;
+
+ USHORT nOldSubType = IsFldEdit() ? (((SwDocInfoField*)GetCurField())->GetSubType() & 0xff00) : 0;
+
+ if (IsFldEdit())
+ {
+ nPos = aSelectionLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ nSubType = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
+
+ nOldSubType &= ~DI_SUB_FIXED;
+ if (nOldSubType == nSubType)
+ {
+ if (!nFormat && (nNewType == NUMBERFORMAT_DATE || nNewType == NUMBERFORMAT_TIME))
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(pSh)
+ {
+ SvNumberFormatter* pFormatter = pSh->GetNumberFormatter();
+ LanguageType eLang = aFormatLB.GetCurLanguage();
+ if (nNewType == NUMBERFORMAT_DATE)
+ nFormat = pFormatter->GetFormatIndex( NF_DATE_SYSTEM_SHORT, eLang);
+ else if (nNewType == NUMBERFORMAT_TIME)
+ nFormat = pFormatter->GetFormatIndex( NF_TIME_HHMM, eLang);
+ }
+ }
+ aFormatLB.SetDefFormat(nFormat);
+ }
+ }
+ else if( (nSubType == DI_CUSTOM) && (nNewType != 0) )
+ {
+ aFormatLB.SetDefFormat(nFormat);
+ }
+ }
+
+ aFormatLB.Enable(bEnable);
+ aFormatFT.Enable(bEnable);
+
+ if (bEnable && aFormatLB.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND)
+ {
+ aFormatLB.SelectEntryPos(0);
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldDokInfPage::FillSelectionLB(USHORT nSubType)
+{
+ // Format-Listbox fuellen
+ USHORT nTypeId = TYP_DOCINFOFLD;
+
+ EnableInsert(nSubType != USHRT_MAX);
+
+ if (nSubType == USHRT_MAX) // Info-Text
+ nSubType = DI_SUBTYPE_BEGIN;
+
+ aSelectionLB.Clear();
+
+ USHORT nSize = 0;
+ USHORT nSelPos = USHRT_MAX;
+ USHORT nExtSubType = IsFldEdit() ? (((SwDocInfoField*)GetCurField())->GetSubType() & 0xff00) : 0;
+
+ if (IsFldEdit())
+ {
+ aFixedCB.Check((nExtSubType & DI_SUB_FIXED) != 0);
+ nExtSubType = ((nExtSubType & ~DI_SUB_FIXED) >> 8) - 1;
+ }
+
+ if (nSubType < DI_CREATE || nSubType == DI_DOCNO || nSubType == DI_EDIT|| nSubType == DI_CUSTOM )
+ {
+ // Format Box ist fuer Title und Time leer
+ }
+ else
+ {
+ nSize = GetFldMgr().GetFormatCount(nTypeId, FALSE, IsFldDlgHtmlMode());
+ for (USHORT i = 0; i < nSize; i++)
+ {
+ USHORT nPos = aSelectionLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(GetFldMgr().GetFormatId(nTypeId, i)));
+ if (IsFldEdit() && i == nExtSubType)
+ nSelPos = nPos;
+ }
+ }
+
+ BOOL bEnable = nSize != 0;
+
+ if (nSize)
+ {
+ if (!aSelectionLB.GetSelectEntryCount())
+ aSelectionLB.SelectEntryPos(nSelPos == USHRT_MAX ? 0 : nSelPos);
+
+ bEnable = TRUE;
+ }
+
+ aSelectionFT.Enable(bEnable);
+ aSelectionLB.Enable(bEnable);
+
+ return nSize;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL __EXPORT SwFldDokInfPage::FillItemSet(SfxItemSet& )
+{
+ if (!pSelEntry || (USHORT)(ULONG)pSelEntry->GetUserData() == USHRT_MAX)
+ return FALSE;
+
+ USHORT nTypeId = TYP_DOCINFOFLD;
+ USHORT nSubType = (USHORT)(ULONG)pSelEntry->GetUserData();
+
+ ULONG nFormat = 0;
+
+ USHORT nPos = aSelectionLB.GetSelectEntryPos();
+
+ ::rtl::OUString aName;
+ if (DI_CUSTOM == nSubType)
+ aName = aTypeTLB.GetEntryText(pSelEntry);
+
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ nSubType |= (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
+
+ if (aFixedCB.IsChecked())
+ nSubType |= DI_SUB_FIXED;
+
+ nPos = aFormatLB.GetSelectEntryPos();
+ if(nPos != LISTBOX_ENTRY_NOTFOUND)
+ nFormat = aFormatLB.GetFormat();
+
+ if (!IsFldEdit() || nOldSel != aSelectionLB.GetSelectEntryPos() ||
+ nOldFormat != nFormat || aFixedCB.GetState() != aFixedCB.GetSavedValue()
+ || (DI_CUSTOM == nSubType && !aName.equals( m_sOldCustomFieldName )))
+ {
+ InsertFld(nTypeId, nSubType, aName, aEmptyStr, nFormat,
+ ' ', aFormatLB.IsAutomaticLanguage());
+ }
+
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* __EXPORT SwFldDokInfPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwFldDokInfPage( pParent, rAttrSet ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldDokInfPage::GetGroup()
+{
+ return GRP_REG;
+}
+/* -----------------12.01.99 11:21-------------------
+ *
+ * --------------------------------------------------*/
+void SwFldDokInfPage::FillUserData()
+{
+ String sData( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( USER_DATA_VERSION )));
+ sData += ';';
+ SvLBoxEntry* pEntry = aTypeTLB.FirstSelected();
+ USHORT nTypeSel = pEntry ? sal::static_int_cast< USHORT >(reinterpret_cast< sal_uIntPtr >(pEntry->GetUserData())) : USHRT_MAX;
+ sData += String::CreateFromInt32( nTypeSel );
+ SetUserData(sData);
+}
+
+
+
diff --git a/sw/source/ui/fldui/flddinf.hxx b/sw/source/ui/fldui/flddinf.hxx
new file mode 100644
index 000000000000..20f9ebf3b786
--- /dev/null
+++ b/sw/source/ui/fldui/flddinf.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWFLDDINF_HXX
+#define _SWFLDDINF_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/button.hxx>
+#include <vcl/group.hxx>
+#include <svtools/svtreebx.hxx>
+
+#include "numfmtlb.hxx"
+#include "fldpage.hxx"
+
+namespace com{namespace sun{ namespace star{ namespace beans{
+ class XPropertySet;
+}}}}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwFldDokInfPage : public SwFldPage
+{
+ FixedText aTypeFT;
+ SvTreeListBox aTypeTLB;
+ FixedText aSelectionFT;
+ ListBox aSelectionLB;
+ FixedText aFormatFT;
+ NumFormatListBox aFormatLB;
+ CheckBox aFixedCB;
+
+ SvLBoxEntry* pSelEntry;
+ com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > xCustomPropertySet;
+
+ String aInfoStr;
+
+ USHORT nOldSel;
+ ULONG nOldFormat;
+ ::rtl::OUString m_sOldCustomFieldName;
+
+ DECL_LINK( TypeHdl, ListBox* pLB = 0 );
+ DECL_LINK( SubTypeHdl, ListBox* pLB = 0 );
+
+ USHORT FillSelectionLB(USHORT nSubTypeId);
+
+protected:
+ virtual USHORT GetGroup();
+
+public:
+ SwFldDokInfPage(Window* pWindow, const SfxItemSet& rSet);
+
+ ~SwFldDokInfPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual void FillUserData();
+};
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/flddinf.src b/sw/source/ui/fldui/flddinf.src
new file mode 100644
index 000000000000..824345a7162c
--- /dev/null
+++ b/sw/source/ui/fldui/flddinf.src
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "fldtdlg.hrc"
+#include "helpid.h"
+TabPage TP_FLD_DOKINF
+{
+ HelpID = HID_FLD_DOKINF ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_DOKINFTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Type" ;
+ Left = TRUE ;
+ };
+ Control TLB_DOKINFTYPE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 16 ) ;
+ Size = MAP_APPFONT ( 76 , 163 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_DOKINFSELECTION
+ {
+ Pos = MAP_APPFONT ( 88 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "S~elect" ;
+ Left = TRUE ;
+ };
+ ListBox LB_DOKINFSELECTION
+ {
+ HelpID = "sw:ListBox:TP_FLD_DOKINF:LB_DOKINFSELECTION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 16 ) ;
+ Size = MAP_APPFONT ( 76 , 163 ) ;
+ TabStop = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Author" ; > ;
+ < "Time" ; > ;
+ < "Date" ; > ;
+ < "Date Time Author" ; > ;
+ };
+ };
+ FixedText FT_DOKINFFORMAT
+ {
+ Pos = MAP_APPFONT ( 170 , 3 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "F~ormat" ;
+ };
+ ListBox LB_DOKINFFORMAT
+ {
+ HelpID = "sw:ListBox:TP_FLD_DOKINF:LB_DOKINFFORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 16 ) ;
+ Size = MAP_APPFONT ( 84 , 148 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ CheckBox CB_DOKINFFIXEDCONTENT
+ {
+ HelpID = "sw:CheckBox:TP_FLD_DOKINF:CB_DOKINFFIXEDCONTENT";
+ Pos = MAP_APPFONT ( 170 , 170 ) ;
+ Size = MAP_APPFONT ( 72 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Fixed content" ;
+ };
+ Bitmap BMP_DOKINFROOT_OPENED
+ {
+ File = "plus.bmp" ;
+ };
+ Bitmap BMP_DOKINFROOT_CLOSED
+ {
+ File = "minus.bmp" ;
+ };
+ String STR_DOKINF_INFO
+ {
+ Text [ en-US ] = "Info" ;
+ };
+ Text [ en-US ] = "DocInformation" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
new file mode 100644
index 000000000000..12d71b6f4577
--- /dev/null
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -0,0 +1,731 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <vcl/svapp.hxx>
+#include <flddat.hxx>
+#include <docufld.hxx>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <chpfld.hxx>
+#ifndef _FLDTDLG_HRC
+#include <fldtdlg.hrc>
+#endif
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _FLDDOK_HXX
+#include <flddok.hxx>
+#endif
+#include <swmodule.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <svl/zformat.hxx>
+
+#include <index.hrc>
+
+#define USER_DATA_VERSION_1 "1"
+#define USER_DATA_VERSION USER_DATA_VERSION_1
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldDokPage::SwFldDokPage(Window* pWindow, const SfxItemSet& rCoreSet ) :
+ SwFldPage( pWindow, SW_RES( TP_FLD_DOK ), rCoreSet ),
+
+ aTypeFT (this, SW_RES(FT_DOKTYPE)),
+ aTypeLB (this, SW_RES(LB_DOKTYPE)),
+ aSelectionFT (this, SW_RES(FT_DOKSELECTION)),
+ aSelectionLB (this, SW_RES(LB_DOKSELECTION)),
+ aValueFT (this, SW_RES(FT_DOKVALUE)),
+ aValueED (this, SW_RES(ED_DOKVALUE)),
+ aLevelED (this, SW_RES(ED_DOKLEVEL)),
+ aDateOffsetED (this, SW_RES(ED_DOKDATEOFF)),
+
+ aFormatFT (this, SW_RES(FT_DOKFORMAT)),
+ aFormatLB (this, SW_RES(LB_DOKFORMAT)),
+ aNumFormatLB (this, SW_RES(LB_DOKNUMFORMAT)),
+ aFixedCB (this, SW_RES(CB_DOKFIXEDCONTENT)),
+
+ sDateOffset (SW_RES(STR_DOKDATEOFF)),
+ sTimeOffset (SW_RES(STR_DOKTIMEOFF)),
+ aRootOpened (SW_RES(BMP_DOKROOT_OPENED)),
+ aRootClosed (SW_RES(BMP_DOKROOT_CLOSED))
+{
+ FreeResource();
+
+ aSelectionLB.SetDoubleClickHdl(LINK(this, SwFldDokPage, InsertHdl));
+ aFormatLB.SetDoubleClickHdl(LINK(this, SwFldDokPage, InsertHdl));
+ aNumFormatLB.SetDoubleClickHdl(LINK(this, SwFldDokPage, NumFormatHdl));
+
+ aLevelED.SetMax(MAXLEVEL);
+ aDateOffsetED.SetMin(LONG_MIN);
+ aDateOffsetED.SetMax(LONG_MAX);
+ //enable 'active' language selection
+ aNumFormatLB.SetShowLanguageControl(TRUE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+__EXPORT SwFldDokPage::~SwFldDokPage()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void __EXPORT SwFldDokPage::Reset(const SfxItemSet& )
+{
+ SavePos(&aTypeLB);
+ Init(); // Allgemeine initialisierung
+
+ // TypeListBox initialisieren
+ const SwFldGroupRgn& rRg = GetFldMgr().GetGroupRange(IsFldDlgHtmlMode(), GetGroup());
+
+ aTypeLB.SetUpdateMode(FALSE);
+ aTypeLB.Clear();
+
+ USHORT nPos, nTypeId;
+ BOOL bPage = FALSE;
+
+ if (!IsFldEdit())
+ {
+ // Typ-Listbox fuellen
+ for(short i = rRg.nStart; i < rRg.nEnd; ++i)
+ {
+ nTypeId = GetFldMgr().GetTypeId(i);
+
+ switch (nTypeId)
+ {
+ case TYP_PREVPAGEFLD:
+ case TYP_NEXTPAGEFLD:
+ case TYP_PAGENUMBERFLD:
+ if (!bPage)
+ {
+ nPos = aTypeLB.InsertEntry(SW_RESSTR(FMT_REF_PAGE));
+ aTypeLB.SetEntryData(nPos, (void*)USHRT_MAX);
+ bPage = TRUE;
+ }
+ break;
+
+ default:
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(i));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ break;
+ }
+ }
+ }
+ else
+ {
+ const SwField* pCurField = GetCurField();
+ nTypeId = pCurField->GetTypeId();
+ if (nTypeId == TYP_FIXDATEFLD)
+ nTypeId = TYP_DATEFLD;
+ if (nTypeId == TYP_FIXTIMEFLD)
+ nTypeId = TYP_TIMEFLD;
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(GetFldMgr().GetPos(nTypeId)));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ aNumFormatLB.SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ const SvNumberformat* pFormat = pSh->GetNumberFormatter()->GetEntry(pCurField->GetFormat());
+ if(pFormat)
+ aNumFormatLB.SetLanguage(pFormat->GetLanguage());
+ }
+ }
+
+ // alte Pos selektieren
+ RestorePos(&aTypeLB);
+
+ aTypeLB.SetUpdateMode(TRUE);
+ aTypeLB.SetDoubleClickHdl(LINK(this, SwFldDokPage, InsertHdl));
+ aTypeLB.SetSelectHdl(LINK(this, SwFldDokPage, TypeHdl));
+ aFormatLB.SetSelectHdl(LINK(this, SwFldDokPage, FormatHdl));
+
+ if( !IsRefresh() )
+ {
+ String sUserData = GetUserData();
+ if( sUserData.GetToken(0, ';').EqualsIgnoreCaseAscii(USER_DATA_VERSION_1 ))
+ {
+ String sVal = sUserData.GetToken(1, ';');
+ USHORT nVal = static_cast< USHORT >(sVal.ToInt32());
+ if(nVal != USHRT_MAX)
+ {
+ for(USHORT i = 0; i < aTypeLB.GetEntryCount(); i++)
+ if(nVal == (USHORT)(ULONG)aTypeLB.GetEntryData(i))
+ {
+ aTypeLB.SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+ }
+ TypeHdl(0);
+
+ if (IsFldEdit())
+ {
+ nOldSel = aSelectionLB.GetSelectEntryPos();
+ nOldFormat = GetCurField()->GetFormat();
+ aFixedCB.SaveValue();
+ aValueED.SaveValue();
+ aLevelED.SaveValue();
+ aDateOffsetED.SaveValue();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDokPage, TypeHdl, ListBox *, EMPTYARG )
+{
+ // Alte ListBoxPos sichern
+ const USHORT nOld = GetTypeSel();
+
+ // Aktuelle ListBoxPos
+ SetTypeSel(aTypeLB.GetSelectEntryPos());
+
+ if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
+ {
+ SetTypeSel(0);
+ aTypeLB.SelectEntryPos(0);
+ }
+
+ USHORT nCount;
+
+ if (nOld != GetTypeSel())
+ {
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ // Auswahl-Listbox fuellen
+ aSelectionLB.Clear();
+
+ if (nTypeId != USHRT_MAX)
+ {
+ SvStringsDtor aLst;
+ GetFldMgr().GetSubTypes(nTypeId, aLst);
+
+ if (nTypeId != TYP_AUTHORFLD)
+ nCount = aLst.Count();
+ else
+ nCount = GetFldMgr().GetFormatCount(nTypeId, FALSE, IsFldDlgHtmlMode());
+
+ USHORT nPos;
+
+ for (USHORT i = 0; i < nCount; ++i)
+ {
+ if (!IsFldEdit())
+ {
+ if (nTypeId != TYP_AUTHORFLD)
+ nPos = aSelectionLB.InsertEntry(*aLst[i]);
+ else
+ nPos = aSelectionLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
+
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ }
+ else
+ {
+ BOOL bInsert = FALSE;
+
+ switch (nTypeId)
+ {
+ case TYP_DATEFLD:
+ case TYP_TIMEFLD:
+ nPos = aSelectionLB.InsertEntry(*aLst[i]);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ if (((SwDateTimeField*)GetCurField())->IsFixed() && !i)
+ aSelectionLB.SelectEntryPos(nPos);
+ if (!((SwDateTimeField*)GetCurField())->IsFixed() && i)
+ aSelectionLB.SelectEntryPos(nPos);
+ break;
+
+ case TYP_EXTUSERFLD:
+ case TYP_DOCSTATFLD:
+ nPos = aSelectionLB.InsertEntry(*aLst[i]);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ if (GetCurField()->GetSubType() == i)
+ aSelectionLB.SelectEntryPos(nPos);
+ break;
+
+ case TYP_AUTHORFLD:
+ {
+ String sFmt(GetFldMgr().GetFormatStr(nTypeId, i));
+ nPos = aSelectionLB.InsertEntry(sFmt);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ aSelectionLB.SelectEntry(GetFldMgr().GetFormatStr(nTypeId, GetCurField()->GetFormat()));
+ break;
+ }
+
+ default:
+ if (*aLst[i] == GetCurField()->GetPar1())
+ bInsert = TRUE;
+ break;
+ }
+ if (bInsert)
+ {
+ nPos = aSelectionLB.InsertEntry(*aLst[i]);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ break;
+ }
+ }
+ }
+ aSelectionLB.SetSelectHdl(Link());
+ }
+ else
+ {
+ AddSubType(TYP_PAGENUMBERFLD);
+ AddSubType(TYP_PREVPAGEFLD);
+ AddSubType(TYP_NEXTPAGEFLD);
+ nTypeId = (USHORT)(ULONG)aSelectionLB.GetEntryData(0);
+ nCount = 3;
+ aSelectionLB.SetSelectHdl(LINK(this, SwFldDokPage, SubTypeHdl));
+ }
+
+ BOOL bEnable = nCount != 0;
+
+ if (bEnable && !aSelectionLB.GetSelectEntryCount())
+ aSelectionLB.SelectEntryPos(0);
+
+ aSelectionLB.Enable( bEnable );
+ aSelectionFT.Enable( bEnable );
+
+ // Format-Listbox fuellen
+ USHORT nSize = FillFormatLB(nTypeId);
+
+ BOOL bValue = FALSE, bLevel = FALSE, bNumFmt = FALSE, bOffset = FALSE;
+ BOOL bFormat = nSize != 0;
+ BOOL bOneArea = FALSE;
+ BOOL bFixed = FALSE;
+ USHORT nFmtType = 0;
+
+ switch (nTypeId)
+ {
+ case TYP_DATEFLD:
+ bFormat = bNumFmt = bOneArea = bOffset = TRUE;
+
+ nFmtType = NUMBERFORMAT_DATE;
+ aValueFT.SetText(sDateOffset);
+ aDateOffsetED.SetFirst(-31); // Ein Monat
+ aDateOffsetED.SetLast(31);
+
+ if (IsFldEdit())
+ aDateOffsetED.SetValue( ((SwDateTimeField*)GetCurField())->GetOffset() / 24 / 60);
+ break;
+
+ case TYP_TIMEFLD:
+ bFormat = bNumFmt = bOneArea = bOffset = TRUE;
+
+ nFmtType = NUMBERFORMAT_TIME;
+ aValueFT.SetText(sTimeOffset);
+ aDateOffsetED.SetFirst(-1440); // Ein Tag
+ aDateOffsetED.SetLast(1440);
+
+ if (IsFldEdit())
+ aDateOffsetED.SetValue( ((SwDateTimeField*)GetCurField())->GetOffset() );
+ break;
+
+ case TYP_PREVPAGEFLD:
+ case TYP_NEXTPAGEFLD:
+ if (IsFldEdit())
+ {
+ USHORT nTmp = (USHORT)(ULONG)aFormatLB.GetEntryData(
+ aFormatLB.GetSelectEntryPos() );
+ String sOldTxt(aValueFT.GetText());
+
+ if(SVX_NUM_CHAR_SPECIAL != nTmp)
+ {
+ INT32 nOff = GetCurField()->GetPar2().ToInt32();
+ if( TYP_NEXTPAGEFLD == nTypeId && 1 != nOff )
+ aValueED.SetText(
+ String::CreateFromInt32(nOff - 1) );
+ else if( TYP_PREVPAGEFLD == nTypeId && -1 != nOff )
+ aValueED.SetText(
+ String::CreateFromInt32(nOff + 1) );
+ else
+ aValueED.SetText(aEmptyStr);
+ }
+ else
+ aValueED.SetText(((SwPageNumberField*)GetCurField())->GetUserString());
+ }
+ bValue = TRUE;
+ break;
+
+ case TYP_CHAPTERFLD:
+ aValueFT.SetText(SW_RESSTR(STR_LEVEL));
+ if (IsFldEdit())
+ aLevelED.SetText(String::CreateFromInt32(((SwChapterField*)GetCurField())->GetLevel() + 1));
+ bLevel = TRUE;
+ break;
+
+ case TYP_PAGENUMBERFLD:
+ aValueFT.SetText( SW_RESSTR( STR_OFFSET ));
+ if (IsFldEdit())
+ aValueED.SetText(GetCurField()->GetPar2());
+ bValue = TRUE;
+ break;
+
+ case TYP_EXTUSERFLD:
+ case TYP_AUTHORFLD:
+ case TYP_FILENAMEFLD:
+ bFixed = TRUE;
+ break;
+
+ default:
+ break;
+ }
+
+ if (bNumFmt)
+ {
+ if (IsFldEdit())
+ {
+ aNumFormatLB.SetDefFormat(GetCurField()->GetFormat());
+
+ if (aNumFormatLB.GetFormatType() == (NUMBERFORMAT_DATE|NUMBERFORMAT_TIME))
+ {
+ // Format-Typ immer einstellen, da sonst bei kombinierten Datum/Zeitformaten
+ // beide Formate gleichzeitig angezeigt werden wuerden
+ aNumFormatLB.SetFormatType(0);
+ aNumFormatLB.SetFormatType(nFmtType);
+ // Nochmal richtiges Format einstellen
+ aNumFormatLB.SetDefFormat(GetCurField()->GetFormat());
+ }
+ }
+ else
+ aNumFormatLB.SetFormatType(nFmtType);
+
+ aNumFormatLB.SetOneArea(bOneArea);
+ }
+
+ aFormatLB.Show(!bNumFmt);
+ aNumFormatLB.Show(bNumFmt);
+
+ Size aSz(aFormatLB.GetSizePixel());
+
+ if (bValue | bLevel | bOffset)
+ aSz.Height() = aFormatLB.LogicToPixel(Size(1, 137), MAP_APPFONT).Height();
+ else
+ aSz.Height() = aFormatLB.LogicToPixel(Size(1, 152), MAP_APPFONT).Height();
+
+ aValueFT.Show(bValue | bLevel | bOffset);
+ aValueED.Show(bValue);
+ aLevelED.Show(bLevel);
+ aDateOffsetED.Show(bOffset);
+ aFixedCB.Show(!bValue && !bLevel && !bOffset);
+
+ aFormatLB.SetSizePixel(aSz);
+ aNumFormatLB.SetSizePixel(aSz);
+
+ aFormatLB.Enable(bFormat);
+ aFormatFT.Enable(bFormat);
+ aFixedCB.Enable(bFixed);
+
+ if (IsFldEdit())
+ aFixedCB.Check( static_cast< BOOL >(((GetCurField()->GetFormat() & AF_FIXED) != 0) & bFixed));
+
+ if (aNumFormatLB.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND)
+ aNumFormatLB.SelectEntryPos(0);
+ aValueFT.Enable(bValue | bLevel | bOffset);
+ aValueED.Enable(bValue);
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldDokPage::AddSubType(USHORT nTypeId)
+{
+ USHORT nPos = aSelectionLB.InsertEntry(SwFieldType::GetTypeStr(nTypeId));
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDokPage, SubTypeHdl, ListBox *, EMPTYARG )
+{
+ USHORT nPos = aSelectionLB.GetSelectEntryPos();
+ if(nPos == LISTBOX_ENTRY_NOTFOUND)
+ nPos = 0;
+
+ USHORT nTypeId = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
+ FillFormatLB(nTypeId);
+
+ USHORT nTextRes = 0;
+ switch (nTypeId)
+ {
+ case TYP_CHAPTERFLD:
+ nTextRes = STR_LEVEL;
+ break;
+
+ case TYP_PREVPAGEFLD:
+ case TYP_NEXTPAGEFLD:
+ nTextRes = SVX_NUM_CHAR_SPECIAL == (USHORT)(ULONG)aFormatLB.GetEntryData(
+ aFormatLB.GetSelectEntryPos() )
+ ? STR_VALUE : STR_OFFSET;
+ break;
+
+ case TYP_PAGENUMBERFLD:
+ nTextRes = STR_OFFSET;
+ break;
+ }
+
+ if( nTextRes )
+ aValueFT.SetText( SW_RESSTR( nTextRes ));
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldDokPage::FillFormatLB(USHORT nTypeId)
+{
+ // Format-Listbox fuellen
+ aFormatLB.Clear();
+
+ if (nTypeId == TYP_AUTHORFLD)
+ return aFormatLB.GetEntryCount();
+
+ USHORT nSize = GetFldMgr().GetFormatCount(nTypeId, FALSE, IsFldDlgHtmlMode());
+
+ for( USHORT i = 0; i < nSize; ++i )
+ {
+ USHORT nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
+ USHORT nFmtId = GetFldMgr().GetFormatId( nTypeId, i );
+ aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>( nFmtId ));
+ if (IsFldEdit() && nFmtId == (GetCurField()->GetFormat() & ~AF_FIXED))
+ aFormatLB.SelectEntryPos( nPos );
+ }
+
+ if( nSize && !aFormatLB.GetSelectEntryCount() )
+ {
+ aFormatLB.SelectEntry( SW_RESSTR(FMT_NUM_PAGEDESC) );
+ if( !aFormatLB.GetSelectEntryCount() )
+ {
+ aFormatLB.SelectEntry( SW_RESSTR(FMT_NUM_ARABIC) );
+ if( !aFormatLB.GetSelectEntryCount() )
+ aFormatLB.SelectEntryPos( 0 );
+ }
+ }
+
+ FormatHdl();
+
+ return nSize;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDokPage, FormatHdl, ListBox *, EMPTYARG )
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ if (nTypeId == USHRT_MAX)
+ {
+ USHORT nPos = aSelectionLB.GetSelectEntryPos();
+ if(nPos == LISTBOX_ENTRY_NOTFOUND)
+ nPos = 0;
+
+ nTypeId = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
+ }
+
+ if (nTypeId == TYP_NEXTPAGEFLD || nTypeId == TYP_PREVPAGEFLD)
+ {
+ // Prev/Next - PageNumFelder Sonderbehandlung:
+ USHORT nTmp = (USHORT)(ULONG)aFormatLB.GetEntryData(
+ aFormatLB.GetSelectEntryPos() );
+ String sOldTxt( aValueFT.GetText() );
+ String sNewTxt( SW_RES( SVX_NUM_CHAR_SPECIAL == nTmp ? STR_VALUE
+ : STR_OFFSET ));
+
+ if( sOldTxt != sNewTxt )
+ aValueFT.SetText( sNewTxt );
+
+ if (sOldTxt != aValueFT.GetText())
+ aValueED.SetText( aEmptyStr );
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL __EXPORT SwFldDokPage::FillItemSet(SfxItemSet& )
+{
+ BOOL bPage = FALSE;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ if (nTypeId == USHRT_MAX)
+ {
+ USHORT nPos = aSelectionLB.GetSelectEntryPos();
+ if(nPos == LISTBOX_ENTRY_NOTFOUND)
+ nPos = 0;
+ nTypeId = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
+ bPage = TRUE;
+ }
+
+ String aVal(aValueED.GetText());
+ ULONG nFormat = 0;
+ USHORT nSubType = 0;
+
+ if (aFormatLB.IsEnabled())
+ {
+ USHORT nPos = aFormatLB.GetSelectEntryPos();
+ if(nPos != LISTBOX_ENTRY_NOTFOUND)
+ nFormat = (USHORT)(ULONG)aFormatLB.GetEntryData(nPos);
+ }
+
+ if (aSelectionLB.IsEnabled())
+ {
+ USHORT nPos = aSelectionLB.GetSelectEntryPos();
+ if(nPos != LISTBOX_ENTRY_NOTFOUND)
+ nSubType = (USHORT)(ULONG)aSelectionLB.GetEntryData(nPos);
+ }
+
+ switch (nTypeId)
+ {
+ case TYP_AUTHORFLD:
+ nFormat = nSubType;
+ nSubType = 0;
+ // kein break!
+ case TYP_EXTUSERFLD:
+ nFormat |= aFixedCB.IsChecked() ? AF_FIXED : 0;
+ break;
+
+ case TYP_FILENAMEFLD:
+ nFormat |= aFixedCB.IsChecked() ? FF_FIXED : 0;
+ break;
+
+ case TYP_DATEFLD:
+ case TYP_TIMEFLD:
+ {
+ nFormat = aNumFormatLB.GetFormat();
+ long nVal = static_cast< long >(aDateOffsetED.GetValue());
+ if (nTypeId == TYP_DATEFLD)
+ aVal = String::CreateFromInt32(nVal * 60 * 24);
+ else
+ aVal = String::CreateFromInt32(nVal);
+ break;
+ }
+
+ case TYP_NEXTPAGEFLD:
+ case TYP_PREVPAGEFLD:
+ case TYP_PAGENUMBERFLD:
+ case TYP_GETREFPAGEFLD:
+ {
+ if( SVX_NUM_CHAR_SPECIAL != nFormat &&
+ (TYP_PREVPAGEFLD == nTypeId || TYP_NEXTPAGEFLD == nTypeId))
+ {
+ INT32 nVal = aValueED.GetText().ToInt32();
+ aVal = String::CreateFromInt32(nVal);
+ }
+ break;
+ }
+
+ case TYP_CHAPTERFLD:
+ aVal = aLevelED.GetText();
+ break;
+
+ default:
+ break;
+ }
+
+ if (!IsFldEdit() ||
+ nOldSel != aSelectionLB.GetSelectEntryPos() ||
+ nOldFormat != nFormat ||
+ aFixedCB.GetState() != aFixedCB.GetSavedValue() ||
+ aValueED.GetText() != aValueED.GetSavedValue() ||
+ aLevelED.GetText() != aLevelED.GetSavedValue() ||
+ aDateOffsetED.GetText() != aDateOffsetED.GetSavedValue())
+ {
+ InsertFld( nTypeId, nSubType, aEmptyStr, aVal, nFormat, ' ', aNumFormatLB.IsAutomaticLanguage() );
+ }
+
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* __EXPORT SwFldDokPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwFldDokPage( pParent, rAttrSet ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldDokPage::GetGroup()
+{
+ return GRP_DOC;
+}
+
+/* -----------------12.01.99 10:09-------------------
+ *
+ * --------------------------------------------------*/
+void SwFldDokPage::FillUserData()
+{
+ String sData( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( USER_DATA_VERSION )));
+ sData += ';';
+ USHORT nTypeSel = aTypeLB.GetSelectEntryPos();
+ if( LISTBOX_ENTRY_NOTFOUND == nTypeSel )
+ nTypeSel = USHRT_MAX;
+ else
+ nTypeSel = sal::static_int_cast< USHORT >(reinterpret_cast< sal_uIntPtr >(aTypeLB.GetEntryData( nTypeSel )));
+ sData += String::CreateFromInt32( nTypeSel );
+ SetUserData(sData);
+}
+
+
diff --git a/sw/source/ui/fldui/flddok.hxx b/sw/source/ui/fldui/flddok.hxx
new file mode 100644
index 000000000000..bd46111c0b8e
--- /dev/null
+++ b/sw/source/ui/fldui/flddok.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWFLDDOK_HXX
+#define _SWFLDDOK_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/group.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/field.hxx>
+
+#include "numfmtlb.hxx"
+#include "fldpage.hxx"
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwFldDokPage : public SwFldPage
+{
+ FixedText aTypeFT;
+ ListBox aTypeLB;
+ FixedText aSelectionFT;
+ ListBox aSelectionLB;
+ FixedText aValueFT;
+ Edit aValueED;
+ NumericField aLevelED;
+ NumericField aDateOffsetED;
+ FixedText aFormatFT;
+ ListBox aFormatLB;
+ NumFormatListBox aNumFormatLB;
+ CheckBox aFixedCB;
+
+ String sDateOffset;
+ String sTimeOffset;
+ Bitmap aRootOpened;
+ Bitmap aRootClosed;
+
+ USHORT nOldSel;
+ ULONG nOldFormat;
+
+ DECL_LINK( TypeHdl, ListBox* pLB = 0 );
+ DECL_LINK( FormatHdl, ListBox* pLB = 0 );
+ DECL_LINK( SubTypeHdl, ListBox* pLB = 0 );
+
+ void AddSubType(USHORT nTypeId);
+ USHORT FillFormatLB(USHORT nTypeId);
+
+protected:
+ virtual USHORT GetGroup();
+
+public:
+ SwFldDokPage(Window* pWindow, const SfxItemSet& rSet);
+
+ ~SwFldDokPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual void FillUserData();
+};
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/flddok.src b/sw/source/ui/fldui/flddok.src
new file mode 100644
index 000000000000..fe595268ce85
--- /dev/null
+++ b/sw/source/ui/fldui/flddok.src
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "fldtdlg.hrc"
+#include "helpid.h"
+TabPage TP_FLD_DOK
+{
+ HelpID = HID_FLD_DOK ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_DOKTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Type" ;
+ Left = TRUE ;
+ };
+ ListBox LB_DOKTYPE
+ {
+ HelpID = "sw:ListBox:TP_FLD_DOK:LB_DOKTYPE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 165 ) ;
+ TabStop = TRUE ;
+ Sort = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_DOKSELECTION
+ {
+ Pos = MAP_APPFONT ( 88 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "S~elect" ;
+ Left = TRUE ;
+ };
+ ListBox LB_DOKSELECTION
+ {
+ HelpID = "sw:ListBox:TP_FLD_DOK:LB_DOKSELECTION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 15 ) ;
+ Size = MAP_APPFONT ( 76 , 165 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_DOKFORMAT
+ {
+ Pos = MAP_APPFONT ( 170 , 3 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "F~ormat" ;
+ };
+ ListBox LB_DOKFORMAT
+ {
+ HelpID = "sw:ListBox:TP_FLD_DOK:LB_DOKFORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 14 ) ;
+ Size = MAP_APPFONT ( 84 , 151 ) ;
+ TabStop = TRUE ;
+ DropDown = FALSE ;
+ Sort = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ ListBox LB_DOKNUMFORMAT
+ {
+ HelpID = "sw:ListBox:TP_FLD_DOK:LB_DOKNUMFORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 14 ) ;
+ Size = MAP_APPFONT ( 84 , 151 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ Hide = TRUE ;
+ };
+ FixedText FT_DOKVALUE
+ {
+ Pos = MAP_APPFONT ( 170 , 155 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Text [ en-US ] = "O~ffset" ;
+ Left = TRUE ;
+ Hide = TRUE ;
+ };
+ Edit ED_DOKVALUE
+ {
+ HelpID = "sw:Edit:TP_FLD_DOK:ED_DOKVALUE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 167 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Hide = TRUE ;
+ };
+ NumericField ED_DOKLEVEL
+ {
+ HelpID = "sw:NumericField:TP_FLD_DOK:ED_DOKLEVEL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 167 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ Text = "1" ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Hide = TRUE ;
+ Minimum = 1 ;
+ Maximum = 10 ;
+ First = 1 ;
+ SpinSize = 1 ;
+ };
+ NumericField ED_DOKDATEOFF
+ {
+ HelpID = "sw:NumericField:TP_FLD_DOK:ED_DOKDATEOFF";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 167 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ Text = "0" ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Hide = TRUE ;
+ SpinSize = 1 ;
+ };
+ CheckBox CB_DOKFIXEDCONTENT
+ {
+ HelpID = "sw:CheckBox:TP_FLD_DOK:CB_DOKFIXEDCONTENT";
+ Pos = MAP_APPFONT ( 170 , 170 ) ;
+ Size = MAP_APPFONT ( 72 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Fixed content" ;
+ };
+ Bitmap BMP_DOKROOT_OPENED
+ {
+ File = "plus.bmp" ;
+ };
+ Bitmap BMP_DOKROOT_CLOSED
+ {
+ File = "minus.bmp" ;
+ };
+ String STR_DOKDATEOFF
+ {
+ Text [ en-US ] = "Offs~et in days" ;
+ };
+ String STR_DOKTIMEOFF
+ {
+ Text [ en-US ] = "Offs~et in minutes" ;
+ };
+ Text [ en-US ] = "Document" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx
new file mode 100644
index 000000000000..f423a9d70f1a
--- /dev/null
+++ b/sw/source/ui/fldui/fldedt.cxx
@@ -0,0 +1,422 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <vcl/msgbox.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/app.hxx>
+#include <svx/optgenrl.hxx>
+#include <docufld.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <dbfld.hxx>
+#include <wrtsh.hxx>
+#ifndef _FLDDB_HXX
+#include <flddb.hxx>
+#endif
+#ifndef _FLDDINF_HXX
+#include <flddinf.hxx>
+#endif
+#ifndef _FLDVAR_HXX
+#include <fldvar.hxx>
+#endif
+#ifndef _FLDDOK_HXX
+#include <flddok.hxx>
+#endif
+#ifndef _FLDFUNC_HXX
+#include <fldfunc.hxx>
+#endif
+#ifndef _FLDREF_HXX
+#include <fldref.hxx>
+#endif
+#include <fldedt.hxx>
+#include <crsskip.hxx>
+
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#include "swabstdlg.hxx"
+#include "dialog.hrc"
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+
+namespace swui
+{
+ SwAbstractDialogFactory * GetFactory();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldEditDlg::SwFldEditDlg(SwView& rVw) :
+ SfxSingleTabDialog(&rVw.GetViewFrame()->GetWindow(), 0, 0),
+ pSh (rVw.GetWrtShellPtr()),
+ aPrevBT (this, SW_RES(BTN_FLDEDT_PREV)),
+ aNextBT (this, SW_RES(BTN_FLDEDT_NEXT)),
+ aAddressBT (this, SW_RES(PB_FLDEDT_ADDRESS))
+{
+ SwFldMgr aMgr(pSh);
+
+ SwField *pCurFld = aMgr.GetCurFld();
+ if(!pCurFld)
+ return;
+
+ pSh->SetCareWin(this);
+
+ /* #108536# Only create selection if there is none
+ already. Normalize PaM instead of swapping. */
+ if ( ! pSh->HasSelection() )
+ pSh->Right(CRSR_SKIP_CHARS, TRUE, 1, FALSE );
+
+ pSh->NormalizePam();
+
+ USHORT nGroup = aMgr.GetGroup(FALSE, pCurFld->GetTypeId(), pCurFld->GetSubType());
+
+ CreatePage(nGroup);
+
+ GetOKButton()->SetClickHdl(LINK(this, SwFldEditDlg, OKHdl));
+
+ // Buttons selbst positionieren, da sie sonst bei unterschiedlichen
+ // Fontgroessen im Wald stehen, und da PB im SingleTabDlg feste Pixelgroessen
+ // fuer seine Buttons und die Dialogbreite verwendet.
+ aPrevBT.SetPosPixel(Point(GetOKButton()->GetPosPixel().X(), aPrevBT.GetPosPixel().Y()));
+ USHORT nWidth = static_cast< USHORT >(GetOKButton()->GetOutputSize().Width() / 2 - 3);
+ Size aNewSize(LogicToPixel(Size(nWidth, GetOKButton()->GetOutputSize().Height())));
+ aPrevBT.SetSizePixel(aNewSize);
+
+ aNextBT.SetSizePixel(aPrevBT.GetSizePixel());
+
+ long nXPos = GetOKButton()->GetPosPixel().X() + GetOKButton()->GetSizePixel().Width()
+ - aNextBT.GetSizePixel().Width() - 1;
+ aNextBT.SetPosPixel(Point(nXPos, aNextBT.GetPosPixel().Y()));
+
+ aAddressBT.SetPosPixel(Point(GetOKButton()->GetPosPixel().X(), aAddressBT.GetPosPixel().Y()));
+ aAddressBT.SetSizePixel(GetOKButton()->GetSizePixel());
+
+ aPrevBT.SetClickHdl(LINK(this, SwFldEditDlg, NextPrevHdl));
+ aNextBT.SetClickHdl(LINK(this, SwFldEditDlg, NextPrevHdl));
+
+ aAddressBT.SetClickHdl(LINK(this, SwFldEditDlg, AddressHdl));
+ aAddressBT.SetHelpId(HID_FLDEDT_ADDRESS);
+
+ Init();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Controlls initialisieren
+ --------------------------------------------------------------------*/
+
+void SwFldEditDlg::Init()
+{
+ SwFldPage* pTabPage = (SwFldPage*)GetTabPage();
+
+ if( pTabPage )
+ {
+ SwFldMgr& rMgr = pTabPage->GetFldMgr();
+
+ SwField *pCurFld = rMgr.GetCurFld();
+
+ if(!pCurFld)
+ return;
+
+ // Traveling nur bei mehr als einem Feld
+ pSh->StartAction();
+ pSh->CreateCrsr();
+
+ BOOL bMove = rMgr.GoNext();
+ if( bMove )
+ rMgr.GoPrev();
+ aNextBT.Enable(bMove);
+
+ if( 0 != ( bMove = rMgr.GoPrev() ) )
+ rMgr.GoNext();
+ aPrevBT.Enable( bMove );
+
+ if (pCurFld->GetTypeId() == TYP_EXTUSERFLD)
+ aAddressBT.Show();
+
+ pSh->DestroyCrsr();
+ pSh->EndAction();
+ }
+
+ GetOKButton()->Enable( !pSh->IsReadOnlyAvailable() ||
+ !pSh->HasReadonlySel() );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* SwFldEditDlg::CreatePage(USHORT nGroup)
+{
+ // TabPage erzeugen
+ SfxTabPage* pTabPage = 0;
+ const char* pHelpId = 0;
+
+ switch (nGroup)
+ {
+ case GRP_DOC:
+ pTabPage = SwFldDokPage::Create(this, *(SfxItemSet*)0);
+ pHelpId = HID_EDIT_FLD_DOK;
+ break;
+ case GRP_FKT:
+ pTabPage = SwFldFuncPage::Create(this, *(SfxItemSet*)0);
+ pHelpId = HID_EDIT_FLD_FUNC;
+ break;
+ case GRP_REF:
+ pTabPage = SwFldRefPage::Create(this, *(SfxItemSet*)0);
+ pHelpId = HID_EDIT_FLD_REF;
+ break;
+ case GRP_REG:
+ {
+ SfxObjectShell* pDocSh = SfxObjectShell::Current();
+ SfxItemSet* pSet = new SfxItemSet( pDocSh->GetPool(), SID_DOCINFO, SID_DOCINFO );
+ using namespace ::com::sun::star;
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ pDocSh->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps
+ = xDPS->getDocumentProperties();
+ uno::Reference< beans::XPropertySet > xUDProps(
+ xDocProps->getUserDefinedProperties(),
+ uno::UNO_QUERY_THROW);
+// uno::Reference< beans::XPropertySetInfo > xSetInfo
+// = xUDProps->getPropertySetInfo();
+// const uno::Sequence< beans::Property > props
+// = xSetInfo->getProperties();
+// uno::Sequence< ::rtl::OUString > names(props.getLength());
+// for (sal_Int32 i = 0; i < props.getLength(); ++i) {
+// names[i] = props[i].Name;
+// }
+ pSet->Put( SfxUnoAnyItem( SID_DOCINFO, uno::makeAny(xUDProps) ) );
+ pTabPage = SwFldDokInfPage::Create(this, *pSet);
+ pHelpId = HID_EDIT_FLD_DOKINF;
+ break;
+ }
+ case GRP_DB:
+ pTabPage = SwFldDBPage::Create(this, *(SfxItemSet*)0);
+ static_cast<SwFldDBPage*>(pTabPage)->SetWrtShell(*pSh);
+ pHelpId = HID_EDIT_FLD_DB;
+ break;
+ case GRP_VAR:
+ pTabPage = SwFldVarPage::Create(this, *(SfxItemSet*)0);
+ pHelpId = HID_EDIT_FLD_VAR;
+ break;
+
+ }
+
+ pTabPage->SetHelpId(pHelpId);
+ static_cast<SwFldPage*>(pTabPage)->SetWrtShell(pSh);
+
+ SetTabPage(pTabPage);
+
+ String sTitle(GetText());
+ sTitle.Insert(String::CreateFromAscii(": "), 0);
+ sTitle.Insert(SW_RESSTR(STR_FLD_EDIT_DLG), 0);
+ SetText(sTitle);
+
+ return pTabPage;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldEditDlg::~SwFldEditDlg()
+{
+ pSh->SetCareWin(NULL);
+ pSh->EnterStdMode();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldEditDlg::EnableInsert(BOOL bEnable)
+{
+ if( bEnable && pSh->IsReadOnlyAvailable() && pSh->HasReadonlySel() )
+ bEnable = FALSE;
+ GetOKButton()->Enable( bEnable );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldEditDlg::InsertHdl()
+{
+ GetOKButton()->Click();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aendern des Feldes anstossen
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldEditDlg, OKHdl, Button *, EMPTYARG )
+{
+ if (GetOKButton()->IsEnabled())
+ {
+ SfxTabPage* pTabPage = GetTabPage();
+ if (pTabPage)
+ {
+ pTabPage->FillItemSet(*(SfxItemSet*)0);
+
+ }
+ EndDialog( RET_OK );
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+short SwFldEditDlg::Execute()
+{
+ // Ohne TabPage kein Dialog
+ return GetTabPage() ? Dialog::Execute() : RET_CANCEL;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Traveling zwishen Feldern gleichen Typs
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldEditDlg, NextPrevHdl, Button *, pButton )
+{
+ BOOL bNext = pButton == &aNextBT;
+
+ pSh->EnterStdMode();
+
+ SwFieldType *pOldTyp = 0;
+ SwFldPage* pTabPage = (SwFldPage*)GetTabPage();
+
+ //#112462# FillItemSet may delete the current field
+ //that's why it has to be called before accessing the current field
+ if( GetOKButton()->IsEnabled() )
+ pTabPage->FillItemSet(*(SfxItemSet*)0);
+
+ SwFldMgr& rMgr = pTabPage->GetFldMgr();
+ SwField *pCurFld = rMgr.GetCurFld();
+ if (pCurFld->GetTypeId() == TYP_DBFLD)
+ pOldTyp = (SwDBFieldType*)pCurFld->GetTyp();
+
+ rMgr.GoNextPrev( bNext, pOldTyp );
+ pCurFld = rMgr.GetCurFld();
+
+ /* #108536# Only create selection if there is none
+ already. Normalize PaM instead of swapping. */
+ if ( ! pSh->HasSelection() )
+ pSh->Right(CRSR_SKIP_CHARS, TRUE, 1, FALSE );
+
+ pSh->NormalizePam();
+
+ USHORT nGroup = rMgr.GetGroup(FALSE, pCurFld->GetTypeId(), pCurFld->GetSubType());
+
+ if (nGroup != pTabPage->GetGroup())
+ pTabPage = (SwFldPage*)CreatePage(nGroup);
+
+ pTabPage->EditNewField();
+
+ Init();
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldEditDlg, AddressHdl, PushButton *, EMPTYARG )
+{
+ SwFldPage* pTabPage = (SwFldPage*)GetTabPage();
+ SwFldMgr& rMgr = pTabPage->GetFldMgr();
+ SwField *pCurFld = rMgr.GetCurFld();
+
+ SfxItemSet aSet( pSh->GetAttrPool(),
+ SID_FIELD_GRABFOCUS, SID_FIELD_GRABFOCUS,
+ 0L );
+
+ USHORT nEditPos = UNKNOWN_EDIT;
+
+ switch(pCurFld->GetSubType())
+ {
+ case EU_FIRSTNAME: nEditPos = FIRSTNAME_EDIT; break;
+ case EU_NAME: nEditPos = LASTNAME_EDIT; break;
+ case EU_SHORTCUT: nEditPos = SHORTNAME_EDIT; break;
+ case EU_COMPANY: nEditPos = COMPANY_EDIT; break;
+ case EU_STREET: nEditPos = STREET_EDIT; break;
+ case EU_TITLE: nEditPos = TITLE_EDIT; break;
+ case EU_POSITION: nEditPos = POSITION_EDIT; break;
+ case EU_PHONE_PRIVATE:nEditPos = TELPRIV_EDIT; break;
+ case EU_PHONE_COMPANY:nEditPos = TELCOMPANY_EDIT; break;
+ case EU_FAX: nEditPos = FAX_EDIT; break;
+ case EU_EMAIL: nEditPos = EMAIL_EDIT; break;
+ case EU_COUNTRY: nEditPos = COUNTRY_EDIT; break;
+ case EU_ZIP: nEditPos = PLZ_EDIT; break;
+ case EU_CITY: nEditPos = CITY_EDIT; break;
+ case EU_STATE: nEditPos = STATE_EDIT; break;
+
+ default: nEditPos = UNKNOWN_EDIT; break;
+
+ }
+ aSet.Put(SfxUInt16Item(SID_FIELD_GRABFOCUS, nEditPos));
+ SwAbstractDialogFactory* pFact = swui::GetFactory();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aSet,
+ pSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(),
+ RC_DLG_ADDR );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if(RET_OK == pDlg->Execute())
+ {
+ pSh->UpdateFlds( *pCurFld );
+ }
+ delete pDlg;
+ return 0;
+}
+
+
diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx
new file mode 100644
index 000000000000..ae05a35681a7
--- /dev/null
+++ b/sw/source/ui/fldui/fldfunc.cxx
@@ -0,0 +1,744 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <sfx2/app.hxx>
+#include <basic/basmgr.hxx>
+#include <basic/sbmod.hxx>
+#include <docsh.hxx>
+#include <swtypes.hxx>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <fldbas.hxx>
+#include <docufld.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <swmodule.hxx>
+#ifndef _FLDFUNC_HXX
+#include <fldfunc.hxx>
+#endif
+#include <flddropdown.hxx>
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _FLDTDLG_HRC
+#include <fldtdlg.hrc>
+#endif
+
+#define USER_DATA_VERSION_1 "1"
+#define USER_DATA_VERSION USER_DATA_VERSION_1
+
+using namespace ::com::sun::star;
+
+using rtl::OUString;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldFuncPage::SwFldFuncPage(Window* pParent, const SfxItemSet& rCoreSet ) :
+ SwFldPage( pParent, SW_RES( TP_FLD_FUNC ), rCoreSet ),
+
+ aTypeFT (this, SW_RES(FT_FUNCTYPE)),
+ aTypeLB (this, SW_RES(LB_FUNCTYPE)),
+ aSelectionFT(this, SW_RES(FT_FUNCSELECTION)),
+ aSelectionLB(this, SW_RES(LB_FUNCSELECTION)),
+ aFormatFT (this, SW_RES(FT_FUNCFORMAT)),
+ aFormatLB (this, SW_RES(LB_FUNCFORMAT)),
+ aNameFT (this, SW_RES(FT_FUNCNAME)),
+ aNameED (this, SW_RES(ED_FUNCNAME)),
+ aValueFT (this, SW_RES(FT_FUNCVALUE)),
+ aValueED (this, SW_RES(ED_FUNCVALUE)),
+ aCond1FT (this, SW_RES(FT_FUNCCOND1)),
+ aCond1ED (this, SW_RES(ED_FUNCCOND1)),
+ aCond2FT (this, SW_RES(FT_FUNCCOND2)),
+ aCond2ED (this, SW_RES(ED_FUNCCOND2)),
+ aMacroBT (this, SW_RES(BT_FUNCMACRO)),
+ aListItemFT( this, SW_RES( FT_LISTITEM )),
+ aListItemED( this, SW_RES( ED_LISTITEM )),
+ aListAddPB( this, SW_RES( PB_LISTADD )),
+ aListItemsFT( this, SW_RES( FT_LISTITEMS )),
+ aListItemsLB( this, SW_RES( LB_LISTITEMS )),
+ aListRemovePB( this, SW_RES( PB_LISTREMOVE )),
+ aListUpPB( this, SW_RES( PB_LISTUP )),
+ aListDownPB( this, SW_RES( PB_LISTDOWN )),
+ aListNameFT( this, SW_RES( FT_LISTNAME )),
+ aListNameED( this, SW_RES( ED_LISTNAME )),
+ bDropDownLBChanged(false)
+{
+ FreeResource();
+
+ aNameED.SetPosPixel(Point(aNameED.GetPosPixel().X(), aFormatLB.GetPosPixel().Y()));
+
+ aNameED.SetModifyHdl(LINK(this, SwFldFuncPage, ModifyHdl));
+
+ sOldValueFT = aValueFT.GetText();
+ sOldNameFT = aNameFT.GetText();
+
+ aCond1ED.ShowBrackets(FALSE);
+ aCond2ED.ShowBrackets(FALSE);
+
+// SwWrtShell* pSh = (SwWrtShell*)ViewShell::GetCurrShell();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldFuncPage::~SwFldFuncPage()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldFuncPage::Reset(const SfxItemSet& )
+{
+ SavePos(&aTypeLB);
+ Init(); // Allgemeine initialisierung
+
+ aTypeLB.SetUpdateMode(FALSE);
+ aTypeLB.Clear();
+
+ USHORT nPos, nTypeId;
+
+ if (!IsFldEdit())
+ {
+ // TypeListBox initialisieren
+ const SwFldGroupRgn& rRg = GetFldMgr().GetGroupRange(IsFldDlgHtmlMode(), GetGroup());
+
+ // Typ-Listbox fuellen
+ for(short i = rRg.nStart; i < rRg.nEnd; ++i)
+ {
+ nTypeId = GetFldMgr().GetTypeId(i);
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(i));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ }
+ }
+ else
+ {
+ nTypeId = GetCurField()->GetTypeId();
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(GetFldMgr().GetPos(nTypeId)));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+
+ if (nTypeId == TYP_MACROFLD)
+ {
+ String sName(GetCurField()->GetPar1());
+ GetFldMgr().SetMacroPath(sName);
+ }
+ }
+
+ // alte Pos selektieren
+ RestorePos(&aTypeLB);
+
+ aTypeLB.SetDoubleClickHdl (LINK(this, SwFldFuncPage, InsertHdl));
+ aTypeLB.SetSelectHdl (LINK(this, SwFldFuncPage, TypeHdl));
+ aSelectionLB.SetSelectHdl (LINK(this, SwFldFuncPage, SelectHdl));
+ aSelectionLB.SetDoubleClickHdl (LINK(this, SwFldFuncPage, InsertMacroHdl));
+ aFormatLB.SetDoubleClickHdl (LINK(this, SwFldFuncPage, InsertHdl));
+ aMacroBT.SetClickHdl (LINK(this, SwFldFuncPage, MacroHdl));
+ Link aListModifyLk( LINK(this, SwFldFuncPage, ListModifyHdl));
+ aListAddPB.SetClickHdl(aListModifyLk);
+ aListRemovePB.SetClickHdl(aListModifyLk);
+ aListUpPB.SetClickHdl(aListModifyLk);
+ aListDownPB.SetClickHdl(aListModifyLk);
+ aListItemED.SetReturnActionLink(aListModifyLk);
+ Link aListEnableLk = LINK(this, SwFldFuncPage, ListEnableHdl);
+ aListItemED.SetModifyHdl(aListEnableLk);
+ aListItemsLB.SetSelectHdl(aListEnableLk);
+
+ if( !IsRefresh() )
+ {
+ String sUserData = GetUserData();
+ if(sUserData.GetToken(0, ';').EqualsIgnoreCaseAscii(USER_DATA_VERSION_1))
+ {
+ String sVal = sUserData.GetToken(1, ';');
+ USHORT nVal = static_cast< USHORT >(sVal.ToInt32());
+ if(nVal != USHRT_MAX)
+ {
+ for(USHORT i = 0; i < aTypeLB.GetEntryCount(); i++)
+ if(nVal == (USHORT)(ULONG)aTypeLB.GetEntryData(i))
+ {
+ aTypeLB.SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+ }
+ TypeHdl(0);
+
+ aTypeLB.SetUpdateMode(TRUE);
+
+ if (IsFldEdit())
+ {
+ aNameED.SaveValue();
+ aValueED.SaveValue();
+ aCond1ED.SaveValue();
+ aCond2ED.SaveValue();
+ nOldFormat = GetCurField()->GetFormat();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldFuncPage, TypeHdl, ListBox *, EMPTYARG )
+{
+ // Alte ListBoxPos sichern
+ const USHORT nOld = GetTypeSel();
+
+ // Aktuelle ListBoxPos
+ SetTypeSel(aTypeLB.GetSelectEntryPos());
+
+ if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
+ {
+ SetTypeSel(0);
+ aTypeLB.SelectEntryPos(0);
+ }
+
+ if (nOld != GetTypeSel())
+ {
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ // Auswahl-Listbox fuellen
+ UpdateSubType();
+
+ // Format-Listbox fuellen
+ aFormatLB.Clear();
+
+ USHORT nSize = GetFldMgr().GetFormatCount(nTypeId, FALSE, IsFldDlgHtmlMode());
+
+ for (USHORT i = 0; i < nSize; i++)
+ {
+ USHORT nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
+ aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>(GetFldMgr().GetFormatId( nTypeId, i )) );
+ }
+
+ if (nSize)
+ {
+ if (IsFldEdit() && nTypeId == TYP_JUMPEDITFLD)
+ aFormatLB.SelectEntry(SW_RESSTR(FMT_MARK_BEGIN + (USHORT)GetCurField()->GetFormat()));
+
+ if (!aFormatLB.GetSelectEntryCount())
+ aFormatLB.SelectEntryPos(0);
+ }
+
+ BOOL bValue = FALSE, bName = FALSE, bMacro = FALSE, bInsert = TRUE;
+ BOOL bShowSelection = FALSE;
+ BOOL bFormat = nSize != 0;
+
+ // fuer Conditional Text zwei Controls
+ BOOL bDropDown = TYP_DROPDOWN == nTypeId;
+ BOOL bCondTxtFld = TYP_CONDTXTFLD == nTypeId;
+
+ aCond1FT.Show(!bDropDown && bCondTxtFld);
+ aCond1ED.Show(!bDropDown && bCondTxtFld);
+ aCond2FT.Show(!bDropDown && bCondTxtFld);
+ aCond2ED.Show(!bDropDown && bCondTxtFld);
+ aValueFT.Show(!bDropDown && !bCondTxtFld);
+ aValueED.Show(!bDropDown && !bCondTxtFld);
+ aMacroBT.Show(!bDropDown);
+ aNameED.Show(!bDropDown);
+ aNameFT.Show(!bDropDown);
+
+ aListItemFT.Show(bDropDown);
+ aListItemED.Show(bDropDown);
+ aListAddPB.Show(bDropDown);
+ aListItemsFT.Show(bDropDown);
+ aListItemsLB.Show(bDropDown);
+ aListRemovePB.Show(bDropDown);
+ aListUpPB.Show(bDropDown);
+ aListDownPB.Show(bDropDown);
+ aListNameFT.Show(bDropDown);
+ aListNameED.Show(bDropDown);
+
+ aNameED.SetDropEnable(FALSE);
+
+ if (IsFldEdit())
+ {
+ if(bDropDown)
+ {
+ const SwDropDownField* pDrop = (const SwDropDownField*)GetCurField();
+ uno::Sequence<OUString> aItems = pDrop->GetItemSequence();
+ const OUString* pArray = aItems.getConstArray();
+ aListItemsLB.Clear();
+ for(sal_Int32 i = 0; i < aItems.getLength(); i++)
+ aListItemsLB.InsertEntry(pArray[i]);
+ aListItemsLB.SelectEntry(pDrop->GetSelectedItem());
+ aListNameED.SetText(pDrop->GetPar2());
+ aListNameED.SaveValue();
+ bDropDownLBChanged = false;
+ }
+ else
+ {
+ aNameED.SetText(GetCurField()->GetPar1());
+ aValueED.SetText(GetCurField()->GetPar2());
+ }
+ }
+ else
+ {
+ aNameED.SetText(aEmptyStr);
+ aValueED.SetText(aEmptyStr);
+ }
+ if(bDropDown)
+ ListEnableHdl(0);
+
+ if( aNameFT.GetText() != sOldNameFT )
+ aNameFT.SetText(sOldNameFT);
+ if (aValueFT.GetText() != sOldValueFT)
+ aValueFT.SetText(sOldValueFT);
+
+ switch (nTypeId)
+ {
+ case TYP_MACROFLD:
+ bMacro = TRUE;
+ if (GetFldMgr().GetMacroPath().Len())
+ bValue = TRUE;
+ else
+ bInsert = FALSE;
+
+ aNameFT.SetText(SW_RESSTR(STR_MACNAME));
+ aValueFT.SetText(SW_RESSTR(STR_PROMPT));
+ aNameED.SetText(GetFldMgr().GetMacroName());
+ break;
+
+ case TYP_HIDDENPARAFLD:
+ aNameFT.SetText(SW_RESSTR(STR_COND));
+ aNameED.SetDropEnable(TRUE);
+ bName = TRUE;
+ break;
+
+ case TYP_HIDDENTXTFLD:
+ {
+ aNameFT.SetText(SW_RESSTR(STR_COND));
+ aNameED.SetDropEnable(TRUE);
+ aValueFT.SetText(SW_RESSTR(STR_INSTEXT));
+ SwWrtShell* pSh = GetActiveWrtShell();
+ if (!IsFldEdit() && pSh )
+ aValueED.SetText(pSh->GetSelTxt());
+ bName = bValue = TRUE;
+ }
+ break;
+
+ case TYP_CONDTXTFLD:
+ aNameFT.SetText(SW_RESSTR(STR_COND));
+ aNameED.SetDropEnable(TRUE);
+ if (IsFldEdit())
+ {
+ aCond1ED.SetText(GetCurField()->GetPar2().GetToken(0, '|'));
+ aCond2ED.SetText(GetCurField()->GetPar2().GetToken(1, '|'));
+ }
+
+ bName = bValue = TRUE;
+ break;
+
+ case TYP_JUMPEDITFLD:
+ aNameFT.SetText(SW_RESSTR(STR_JUMPEDITFLD));
+ aValueFT.SetText(SW_RESSTR(STR_PROMPT));
+ bName = bValue = TRUE;
+ break;
+
+ case TYP_INPUTFLD:
+ aValueFT.SetText(SW_RESSTR(STR_PROMPT));
+ bValue = TRUE;
+ // bShowSelection = TRUE;
+ break;
+
+ case TYP_COMBINED_CHARS:
+ {
+ aNameFT.SetText(SW_RESSTR(STR_COMBCHRS_FT));
+ aNameED.SetDropEnable(TRUE);
+ bName = TRUE;
+
+ const USHORT nLen = aNameED.GetText().Len();
+ if( !nLen || nLen > MAX_COMBINED_CHARACTERS )
+ bInsert = FALSE;
+ }
+ break;
+ case TYP_DROPDOWN :
+ break;
+ default:
+ break;
+ }
+
+ if (bShowSelection)
+ {
+ aSelectionLB.Show();
+ aSelectionFT.Show();
+ aFormatLB.Hide();
+ aFormatFT.Hide();
+ }
+ else
+ {
+ aFormatLB.Show();
+ aFormatFT.Show();
+ aSelectionLB.Hide();
+ aSelectionFT.Hide();
+ }
+
+ aFormatLB.Enable(bFormat);
+ aFormatFT.Enable(bFormat);
+ aNameFT.Enable(bName);
+ aNameED.Enable(bName);
+ aValueFT.Enable(bValue);
+ aValueED.Enable(bValue);
+ aMacroBT.Enable(bMacro);
+
+ EnableInsert( bInsert );
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldFuncPage, SelectHdl, ListBox *, EMPTYARG )
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ if( TYP_MACROFLD == nTypeId )
+ aNameED.SetText( aSelectionLB.GetSelectEntry() );
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldFuncPage, InsertMacroHdl, ListBox *, EMPTYARG )
+{
+ SelectHdl();
+ InsertHdl();
+
+ return 0;
+}
+/* -----------------16.06.2003 16:24-----------------
+
+ --------------------------------------------------*/
+IMPL_LINK( SwFldFuncPage, ListModifyHdl, Control*, pControl)
+{
+ aListItemsLB.SetUpdateMode(FALSE);
+ if(pControl == &aListAddPB ||
+ (pControl == &aListItemED && aListAddPB.IsEnabled()))
+ {
+ String sEntry(aListItemED.GetText());
+ aListItemsLB.InsertEntry(sEntry);
+ aListItemsLB.SelectEntry(sEntry);
+ }
+ else if(aListItemsLB.GetSelectEntryCount())
+ {
+ USHORT nSelPos = aListItemsLB.GetSelectEntryPos();
+ if(pControl == &aListRemovePB)
+ {
+ aListItemsLB.RemoveEntry(nSelPos);
+ aListItemsLB.SelectEntryPos(nSelPos ? nSelPos - 1 : 0);
+ }
+ else if(pControl == &aListUpPB)
+ {
+ if(nSelPos)
+ {
+ String sEntry = aListItemsLB.GetSelectEntry();
+ aListItemsLB.RemoveEntry(nSelPos);
+ nSelPos--;
+ aListItemsLB.InsertEntry(sEntry, nSelPos);
+ aListItemsLB.SelectEntryPos(nSelPos);
+ }
+ }
+ else if(pControl == &aListDownPB)
+ {
+ if(nSelPos < aListItemsLB.GetEntryCount() - 1)
+ {
+ String sEntry = aListItemsLB.GetSelectEntry();
+ aListItemsLB.RemoveEntry(nSelPos);
+ nSelPos++;
+ aListItemsLB.InsertEntry(sEntry, nSelPos);
+ aListItemsLB.SelectEntryPos(nSelPos);
+ }
+ }
+ }
+ bDropDownLBChanged = true;
+ aListItemsLB.SetUpdateMode(TRUE);
+ ListEnableHdl(0);
+ return 0;
+}
+/* -----------------17.06.2003 08:36-----------------
+
+ --------------------------------------------------*/
+IMPL_LINK( SwFldFuncPage, ListEnableHdl, void*, EMPTYARG)
+{
+ //enable "Add" button when text is in the Edit that's not already member of the box
+ aListAddPB.Enable(aListItemED.GetText().Len() &&
+ LISTBOX_ENTRY_NOTFOUND == aListItemsLB.GetEntryPos(aListItemED.GetText()));
+ BOOL bEnableButtons = aListItemsLB.GetSelectEntryCount() > 0;
+ aListRemovePB.Enable(bEnableButtons);
+ aListUpPB.Enable(bEnableButtons && (aListItemsLB.GetSelectEntryPos() > 0));
+ aListDownPB.Enable(bEnableButtons &&
+ (aListItemsLB.GetSelectEntryPos() < (aListItemsLB.GetEntryCount() - 1)));
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Typen in der SelectionBox erneuern
+ --------------------------------------------------------------------*/
+
+
+void SwFldFuncPage::UpdateSubType()
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ // Auswahl-Listbox fuellen
+ aSelectionLB.SetUpdateMode(FALSE);
+ aSelectionLB.Clear();
+
+ SvStringsDtor aLst;
+ GetFldMgr().GetSubTypes(nTypeId, aLst);
+ USHORT nCount = aLst.Count();
+
+ for (USHORT i = 0; i < nCount; ++i)
+ {
+ USHORT nPos = aSelectionLB.InsertEntry(*aLst[i]);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ }
+
+ BOOL bEnable = nCount != 0;
+
+ aSelectionLB.Enable( bEnable );
+ aSelectionFT.Enable( bEnable );
+
+ if (bEnable)
+ {
+ aSelectionLB.SelectEntryPos(0);
+ }
+
+ if (nTypeId == TYP_MACROFLD)
+ {
+ BOOL bHasMacro = GetFldMgr().GetMacroPath().Len() != 0;
+
+ if (bHasMacro)
+ {
+ aNameED.SetText(GetFldMgr().GetMacroName());
+ aValueFT.Enable();
+ aValueED.Enable();
+ }
+ EnableInsert(bHasMacro);
+ }
+
+ aSelectionLB.SetUpdateMode(TRUE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: MacroBrowser aufrufen, Listbox mit Macros fuellen
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldFuncPage, MacroHdl, Button *, pBtn )
+{
+ Window* pDefModalDlgParent = Application::GetDefDialogParent();
+ Application::SetDefDialogParent( pBtn );
+
+ String sMacro(TurnMacroString(aNameED.GetText()));
+ while (sMacro.SearchAndReplace('.', ';') != STRING_NOTFOUND) ;
+
+ if (GetFldMgr().ChooseMacro(sMacro))
+ UpdateSubType();
+
+ Application::SetDefDialogParent( pDefModalDlgParent );
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL SwFldFuncPage::FillItemSet(SfxItemSet& )
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ USHORT nSubType = 0;
+
+ ULONG nFormat = aFormatLB.GetSelectEntryPos();
+
+ if(nFormat == LISTBOX_ENTRY_NOTFOUND)
+ nFormat = 0;
+ else
+ nFormat = (ULONG)aFormatLB.GetEntryData((USHORT)nFormat);
+
+ String aVal(aValueED.GetText());
+ String aName(aNameED.GetText());
+
+ switch(nTypeId)
+ {
+ case TYP_INPUTFLD:
+ nSubType = INP_TXT;
+ // to prevent removal of CR/LF restore old content
+ if(!aNameED.IsModified() && IsFldEdit())
+ aName = GetCurField()->GetPar1();
+
+ break;
+
+ case TYP_MACROFLD:
+ // use the full script URL, not the name in the Edit control
+ aName = GetFldMgr().GetMacroPath();
+ break;
+
+ case TYP_CONDTXTFLD:
+ aVal = aCond1ED.GetText();
+ aVal += '|';
+ aVal += aCond2ED.GetText();
+ break;
+ case TYP_DROPDOWN :
+ {
+ aName = aListNameED.GetText();
+ for(USHORT i = 0; i < aListItemsLB.GetEntryCount(); i++)
+ {
+ if(i)
+ aVal += DB_DELIM;
+ aVal += aListItemsLB.GetEntry(i);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (!IsFldEdit() ||
+ aNameED.GetSavedValue() != aNameED.GetText() ||
+ aValueED.GetSavedValue() != aValueED.GetText() ||
+ aCond1ED.GetSavedValue() != aCond1ED.GetText() ||
+ aCond2ED.GetSavedValue() != aCond2ED.GetText() ||
+ aListNameED.GetSavedValue() != aListNameED.GetText() ||
+ bDropDownLBChanged ||
+ nOldFormat != nFormat)
+ {
+ InsertFld( nTypeId, nSubType, aName, aVal, nFormat );
+ }
+
+ ModifyHdl(); // Insert ggf enablen/disablen
+
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+String SwFldFuncPage::TurnMacroString(const String &rMacro)
+{
+ if (rMacro.Len())
+ {
+ // Inhalt von aName umdrehen
+ String sTmp, sBuf;
+ USHORT nPos = 0;
+
+ for (USHORT i = 0; i < 4 && nPos != STRING_NOTFOUND; i++)
+ {
+ if (i == 3)
+ sTmp = rMacro.Copy(nPos);
+ else
+ sTmp = rMacro.GetToken(0, '.', nPos);
+
+ if( sBuf.Len() )
+ sTmp += '.';
+ sBuf.Insert( sTmp, 0 );
+ }
+ return sBuf;
+ }
+
+ return rMacro;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* SwFldFuncPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwFldFuncPage( pParent, rAttrSet ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldFuncPage::GetGroup()
+{
+ return GRP_FKT;
+}
+
+/* -----------------12.01.99 10:09-------------------
+ *
+ * --------------------------------------------------*/
+void SwFldFuncPage::FillUserData()
+{
+ String sData( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( USER_DATA_VERSION )));
+ sData += ';';
+ USHORT nTypeSel = aTypeLB.GetSelectEntryPos();
+ if( LISTBOX_ENTRY_NOTFOUND == nTypeSel )
+ nTypeSel = USHRT_MAX;
+ else
+ nTypeSel = sal::static_int_cast< USHORT >(reinterpret_cast< sal_uIntPtr >(aTypeLB.GetEntryData( nTypeSel )));
+ sData += String::CreateFromInt32( nTypeSel );
+ SetUserData(sData);
+}
+
+IMPL_LINK( SwFldFuncPage, ModifyHdl, Edit *, EMPTYARG )
+{
+ String aName(aNameED.GetText());
+ const USHORT nLen = aName.Len();
+
+ BOOL bEnable = TRUE;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ if( TYP_COMBINED_CHARS == nTypeId &&
+ (!nLen || nLen > MAX_COMBINED_CHARACTERS ))
+ bEnable = FALSE;
+
+ EnableInsert( bEnable );
+
+ return 0;
+}
+
+
+
+
diff --git a/sw/source/ui/fldui/fldfunc.hxx b/sw/source/ui/fldui/fldfunc.hxx
new file mode 100644
index 000000000000..7a63385a5935
--- /dev/null
+++ b/sw/source/ui/fldui/fldfunc.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWFLDFUNC_HXX
+#define _SWFLDFUNC_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/group.hxx>
+#include <vcl/edit.hxx>
+
+#include "condedit.hxx"
+#include "fldpage.hxx"
+#include <actctrl.hxx>
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwFldFuncPage : public SwFldPage
+{
+ FixedText aTypeFT;
+ ListBox aTypeLB;
+ FixedText aSelectionFT;
+ ListBox aSelectionLB;
+ FixedText aFormatFT;
+ ListBox aFormatLB;
+ FixedText aNameFT;
+ ConditionEdit aNameED;
+ FixedText aValueFT;
+ Edit aValueED;
+ FixedText aCond1FT;
+ ConditionEdit aCond1ED;
+ FixedText aCond2FT;
+ ConditionEdit aCond2ED;
+ PushButton aMacroBT;
+
+ //controls of "Input list"
+ FixedText aListItemFT;
+ ReturnActionEdit aListItemED;
+ PushButton aListAddPB;
+ FixedText aListItemsFT;
+ ListBox aListItemsLB;
+ PushButton aListRemovePB;
+ PushButton aListUpPB;
+ PushButton aListDownPB;
+ FixedText aListNameFT;
+ Edit aListNameED;
+
+ String sOldValueFT;
+ String sOldNameFT;
+
+ ULONG nOldFormat;
+ bool bDropDownLBChanged;
+
+ DECL_LINK( TypeHdl, ListBox* pLB = 0 );
+ DECL_LINK( SelectHdl, ListBox* pLB = 0 );
+ DECL_LINK( InsertMacroHdl, ListBox* pLB = 0 );
+ DECL_LINK( ModifyHdl, Edit *pEd = 0 );
+ DECL_LINK( ListModifyHdl, Control*);
+ DECL_LINK( ListEnableHdl, void*);
+
+ // Macro ausw„hlen
+ DECL_LINK( MacroHdl, Button * );
+
+ void UpdateSubType();
+ String TurnMacroString(const String &rMacro);
+
+protected:
+ virtual USHORT GetGroup();
+
+public:
+ SwFldFuncPage(Window* pParent, const SfxItemSet& rSet);
+
+ ~SwFldFuncPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual void FillUserData();
+};
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/fldfunc.src b/sw/source/ui/fldui/fldfunc.src
new file mode 100644
index 000000000000..538aeb8e1ce3
--- /dev/null
+++ b/sw/source/ui/fldui/fldfunc.src
@@ -0,0 +1,284 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "fldtdlg.hrc"
+#include "helpid.h"
+TabPage TP_FLD_FUNC
+{
+ HelpID = HID_FLD_FUNC ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_FUNCTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Type" ;
+ Left = TRUE ;
+ };
+ ListBox LB_FUNCTYPE
+ {
+ HelpID = "sw:ListBox:TP_FLD_FUNC:LB_FUNCTYPE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 165 ) ;
+ TabStop = TRUE ;
+ Sort = FALSE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_FUNCSELECTION
+ {
+ Pos = MAP_APPFONT ( 88 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "S~elect" ;
+ Hide = TRUE ;
+ Left = TRUE ;
+ };
+ ListBox LB_FUNCSELECTION
+ {
+ HelpID = "sw:ListBox:TP_FLD_FUNC:LB_FUNCSELECTION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 165 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Sort = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_FUNCFORMAT
+ {
+ Pos = MAP_APPFONT ( 88 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "F~ormat" ;
+ };
+ ListBox LB_FUNCFORMAT
+ {
+ HelpID = "sw:ListBox:TP_FLD_FUNC:LB_FUNCFORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 165 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_FUNCNAME
+ {
+ Pos = MAP_APPFONT ( 170 , 3 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Na~me" ;
+ };
+ Edit ED_FUNCNAME
+ {
+ HelpID = "sw:Edit:TP_FLD_FUNC:ED_FUNCNAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 14 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_FUNCVALUE
+ {
+ Pos = MAP_APPFONT ( 170 , 30 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Text [ en-US ] = "~Value" ;
+ Left = TRUE ;
+ };
+ Edit ED_FUNCVALUE
+ {
+ HelpID = "sw:Edit:TP_FLD_FUNC:ED_FUNCVALUE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 41 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_FUNCCOND1
+ {
+ Pos = MAP_APPFONT ( 170 , 30 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Left = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Then" ;
+ };
+ Edit ED_FUNCCOND1
+ {
+ HelpID = "sw:Edit:TP_FLD_FUNC:ED_FUNCCOND1";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 41 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Hide = TRUE ;
+ };
+ FixedText FT_FUNCCOND2
+ {
+ Pos = MAP_APPFONT ( 170 , 57 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Left = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Else" ;
+ };
+ Edit ED_FUNCCOND2
+ {
+ HelpID = "sw:Edit:TP_FLD_FUNC:ED_FUNCCOND2";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 68 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Hide = TRUE ;
+ };
+ PushButton BT_FUNCMACRO
+ {
+ HelpID = "sw:PushButton:TP_FLD_FUNC:BT_FUNCMACRO";
+ Pos = MAP_APPFONT ( 204 , 165 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Macro..." ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_LISTITEM
+ {
+ Pos = MAP_APPFONT ( 170 , 3 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Ite~m" ;
+ };
+ Edit ED_LISTITEM
+ {
+ HelpID = "sw:Edit:TP_FLD_FUNC:ED_LISTITEM";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 14 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Hide = TRUE;
+ };
+ PushButton PB_LISTADD
+ {
+ HelpID = "sw:PushButton:TP_FLD_FUNC:PB_LISTADD";
+ Pos = MAP_APPFONT ( 170 , 29 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "~Add" ;
+ };
+ FixedText FT_LISTITEMS
+ {
+ Pos = MAP_APPFONT ( 170 , 46 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Items on ~list" ;
+ };
+ ListBox LB_LISTITEMS
+ {
+ HelpID = "sw:ListBox:TP_FLD_FUNC:LB_LISTITEMS";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 57 ) ;
+ Size = MAP_APPFONT ( 83 , 44 ) ;
+ TabStop = TRUE ;
+ Sort = FALSE ;
+ AutoHScroll = TRUE ;
+ };
+ PushButton PB_LISTREMOVE
+ {
+ HelpID = "sw:PushButton:TP_FLD_FUNC:PB_LISTREMOVE";
+ Pos = MAP_APPFONT ( 203 , 104 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "~Remove" ;
+ };
+ PushButton PB_LISTUP
+ {
+ HelpID = "sw:PushButton:TP_FLD_FUNC:PB_LISTUP";
+ Pos = MAP_APPFONT ( 203 , 121 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Move ~Up" ;
+ };
+ PushButton PB_LISTDOWN
+ {
+ HelpID = "sw:PushButton:TP_FLD_FUNC:PB_LISTDOWN";
+ Pos = MAP_APPFONT ( 203 , 138 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Move Do~wn" ;
+ };
+ FixedText FT_LISTNAME
+ {
+ Pos = MAP_APPFONT ( 170 , 156 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Na~me" ;
+ };
+ Edit ED_LISTNAME
+ {
+ HelpID = "sw:Edit:TP_FLD_FUNC:ED_LISTNAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 167 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Hide = TRUE;
+ };
+ Text [ en-US ] = "Functions" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx
new file mode 100644
index 000000000000..2088ce591bbe
--- /dev/null
+++ b/sw/source/ui/fldui/fldmgr.cxx
@@ -0,0 +1,1793 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <cmdid.h>
+#include <hintids.hxx>
+#include <svl/stritem.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
+#include <com/sun/star/text/XNumberingTypeInfo.hpp>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
+#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
+#include <comphelper/processfactory.hxx>
+#include <editeng/unolingu.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <sfx2/app.hxx>
+#include <basic/basmgr.hxx>
+#include <editeng/langitem.hxx>
+#include <svl/macitem.hxx>
+#include <basic/sbmod.hxx>
+#include <fmtrfmrk.hxx>
+#include <basic/sbmeth.hxx>
+#include <basic/sbx.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
+#include <vcl/mnemonic.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx> // Actives Fenster
+#include <doc.hxx> // Actives Fenster
+#include <docsh.hxx> // Actives Fenster
+#include <swmodule.hxx>
+#include <charatr.hxx>
+#include <fmtinfmt.hxx>
+#include <cellatr.hxx>
+#include <dbmgr.hxx>
+#include <shellres.hxx>
+#include <fldbas.hxx>
+#include <docufld.hxx>
+#include <chpfld.hxx>
+#include <ddefld.hxx>
+#include <expfld.hxx>
+#include <reffld.hxx>
+#include <usrfld.hxx>
+#include <dbfld.hxx>
+#include <authfld.hxx>
+#include <flddat.hxx>
+#include <fldmgr.hxx>
+#include <crsskip.hxx>
+#include <flddropdown.hxx>
+#include <fldui.hrc>
+#include <tox.hxx>
+
+using rtl::OUString;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::container;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::text;
+using namespace com::sun::star::style;
+using namespace com::sun::star::sdbc;
+using namespace ::com::sun::star;
+using namespace nsSwDocInfoSubType;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Gruppen der Felder
+ --------------------------------------------------------------------*/
+enum
+{
+ GRP_DOC_BEGIN = 0,
+ GRP_DOC_END = GRP_DOC_BEGIN + 11,
+
+ GRP_FKT_BEGIN = GRP_DOC_END,
+ GRP_FKT_END = GRP_FKT_BEGIN + 8,
+
+ GRP_REF_BEGIN = GRP_FKT_END,
+ GRP_REF_END = GRP_REF_BEGIN + 2,
+
+ GRP_REG_BEGIN = GRP_REF_END,
+ GRP_REG_END = GRP_REG_BEGIN + 1,
+
+ GRP_DB_BEGIN = GRP_REG_END,
+ GRP_DB_END = GRP_DB_BEGIN + 5,
+
+ GRP_VAR_BEGIN = GRP_DB_END,
+ GRP_VAR_END = GRP_VAR_BEGIN + 9
+};
+
+enum
+{
+ GRP_WEB_DOC_BEGIN = 0,
+ GRP_WEB_DOC_END = GRP_WEB_DOC_BEGIN + 9,
+
+ GRP_WEB_FKT_BEGIN = GRP_WEB_DOC_END + 2,
+ GRP_WEB_FKT_END = GRP_WEB_FKT_BEGIN + 0, // Die Gruppe ist leer!
+
+ GRP_WEB_REF_BEGIN = GRP_WEB_FKT_END + 6, // Die Gruppe ist leer!
+ GRP_WEB_REF_END = GRP_WEB_REF_BEGIN + 0,
+
+ GRP_WEB_REG_BEGIN = GRP_WEB_REF_END + 2,
+ GRP_WEB_REG_END = GRP_WEB_REG_BEGIN + 1,
+
+ GRP_WEB_DB_BEGIN = GRP_WEB_REG_END, // Die Gruppe ist leer!
+ GRP_WEB_DB_END = GRP_WEB_DB_BEGIN + 0,
+
+ GRP_WEB_VAR_BEGIN = GRP_WEB_DB_END + 5,
+ GRP_WEB_VAR_END = GRP_WEB_VAR_BEGIN + 1
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Formate in der richtigen Reihenfolge
+ --------------------------------------------------------------------*/
+static const USHORT __FAR_DATA aSetFmt[] =
+{
+// die Reihenfolge muss zu Beginn mit den ResourceIds fuer FMT_SETVAR_???
+// uebereinstimmen
+ 0,
+ 0
+};
+
+static const USHORT __FAR_DATA aGetFmt[] =
+{
+// die Reihenfolge muss zu Beginn mit den ResourceIds fuer FMT_GETVAR_???
+// uebereinstimmen
+ 0
+};
+
+static const USHORT __FAR_DATA aUsrFmt[] =
+{
+// die Reihenfolge muss zu Beginn mit den ResourceIds fuer FMT_SETVAR_???
+// uebereinstimmen
+ 0,
+ nsSwExtendedSubType::SUB_CMD
+};
+
+static const USHORT __FAR_DATA aDBFmt[] =
+{
+// die Reihenfolge muss zu Beginn mit den ResourceIds fuer FMT_DBFLD_???
+// uebereinstimmen
+ nsSwExtendedSubType::SUB_OWN_FMT
+};
+
+static const USHORT VF_COUNT = sizeof(aGetFmt) / sizeof(USHORT);
+static const USHORT VF_USR_COUNT = sizeof(aUsrFmt) / sizeof(USHORT);
+static const USHORT VF_DB_COUNT = sizeof(aDBFmt) / sizeof(USHORT);
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen und Subtypes
+ --------------------------------------------------------------------*/
+struct SwFldPack
+{
+ USHORT nTypeId;
+
+ USHORT nSubTypeStart;
+ USHORT nSubTypeEnd;
+
+ ULONG nFmtBegin;
+ ULONG nFmtEnd;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Strings und Formate
+ --------------------------------------------------------------------*/
+static const SwFldPack __FAR_DATA aSwFlds[] =
+{
+ // Dokument
+ { TYP_EXTUSERFLD, FLD_EU_BEGIN, FLD_EU_END, 0, 0 },
+ { TYP_AUTHORFLD, 0, 0, FMT_AUTHOR_BEGIN, FMT_AUTHOR_END },
+ { TYP_DATEFLD, FLD_DATE_BEGIN, FLD_DATE_END, 0, 0 },
+ { TYP_TIMEFLD, FLD_TIME_BEGIN, FLD_TIME_END, 0, 0 },
+ { TYP_PAGENUMBERFLD, 0, 0, FMT_NUM_BEGIN, FMT_NUM_END-1 },
+ { TYP_NEXTPAGEFLD, 0, 0, FMT_NUM_BEGIN, FMT_NUM_END },
+ { TYP_PREVPAGEFLD, 0, 0, FMT_NUM_BEGIN, FMT_NUM_END },
+ { TYP_FILENAMEFLD, 0, 0, FMT_FF_BEGIN, FMT_FF_END },
+ { TYP_DOCSTATFLD, FLD_STAT_BEGIN, FLD_STAT_END, FMT_NUM_BEGIN, FMT_NUM_END-1 },
+
+ { TYP_CHAPTERFLD, 0, 0, FMT_CHAPTER_BEGIN, FMT_CHAPTER_END },
+ { TYP_TEMPLNAMEFLD, 0, 0, FMT_FF_BEGIN, FMT_FF_END },
+
+ // Funktion
+ { TYP_CONDTXTFLD, 0, 0, 0, 0 },
+ { TYP_DROPDOWN, 0, 0, 0, 0 },
+ { TYP_INPUTFLD, FLD_INPUT_BEGIN, FLD_INPUT_END, 0, 0 },
+ { TYP_MACROFLD, 0, 0, 0, 0 },
+ { TYP_JUMPEDITFLD, 0, 0, FMT_MARK_BEGIN, FMT_MARK_END },
+ { TYP_COMBINED_CHARS, 0, 0, 0, 0 },
+ { TYP_HIDDENTXTFLD, 0, 0, 0, 0 },
+ { TYP_HIDDENPARAFLD, 0, 0, 0, 0 },
+
+ // Referenzen
+ { TYP_SETREFFLD, 0, 0, 0, 0 },
+ { TYP_GETREFFLD, 0, 0, FMT_REF_BEGIN, FMT_REF_END },
+
+ // Ablage
+ { TYP_DOCINFOFLD, 0, 0, FMT_REG_BEGIN, FMT_REG_END },
+
+ // Datenbank
+ { TYP_DBFLD, 0, 0, FMT_DBFLD_BEGIN, FMT_DBFLD_END },
+ { TYP_DBNEXTSETFLD, 0, 0, 0, 0 },
+ { TYP_DBNUMSETFLD, 0, 0, 0, 0 },
+ { TYP_DBSETNUMBERFLD, 0, 0, FMT_NUM_BEGIN, FMT_NUM_END-2 },
+ { TYP_DBNAMEFLD, 0, 0, 0, 0 },
+
+ // Variablen
+ { TYP_SETFLD, 0, 0, FMT_SETVAR_BEGIN, FMT_SETVAR_END },
+
+ { TYP_GETFLD, 0, 0, FMT_GETVAR_BEGIN, FMT_GETVAR_END },
+ { TYP_DDEFLD, 0, 0, FMT_DDE_BEGIN, FMT_DDE_END },
+ { TYP_FORMELFLD, 0, 0, FMT_GETVAR_BEGIN, FMT_GETVAR_END },
+ { TYP_INPUTFLD, FLD_INPUT_BEGIN, FLD_INPUT_END, 0, 0 },
+ { TYP_SEQFLD, 0, 0, FMT_NUM_BEGIN, FMT_NUM_END-2 },
+ { TYP_SETREFPAGEFLD, FLD_PAGEREF_BEGIN, FLD_PAGEREF_END,0, 0 },
+ { TYP_GETREFPAGEFLD, 0, 0, FMT_NUM_BEGIN, FMT_NUM_END-1 },
+ { TYP_USERFLD, 0, 0, FMT_USERVAR_BEGIN, FMT_USERVAR_END }
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zugriff auf die Shell
+ --------------------------------------------------------------------*/
+
+static SwWrtShell* lcl_GetShell()
+{
+ SwView* pView;
+ if ( 0 != (pView = ::GetActiveView()) )
+ return pView->GetWrtShellPtr();
+ DBG_ERROR("no current shell found!");
+ return 0;
+}
+
+inline USHORT GetPackCount() { return sizeof(aSwFlds) / sizeof(SwFldPack); }
+
+/*--------------------------------------------------------------------
+ Beschreibung: FieldManager regelt das Einfuegen und Updaten
+ von Feldern
+ --------------------------------------------------------------------*/
+
+SwFldMgr::SwFldMgr(SwWrtShell* pSh ) :
+ pModule(0),
+ pMacroItem(0),
+ pWrtShell(pSh),
+ bEvalExp(TRUE)
+{
+ // aktuelles Feld ermitteln falls vorhanden
+ GetCurFld();
+}
+
+
+SwFldMgr::~SwFldMgr()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: RefMark ueber Namen organisieren
+ --------------------------------------------------------------------*/
+
+BOOL SwFldMgr::CanInsertRefMark( const String& rStr )
+{
+ BOOL bRet = FALSE;
+ SwWrtShell *pSh = pWrtShell ? pWrtShell : lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ if(pSh)
+ {
+ USHORT nCnt = pSh->GetCrsrCnt();
+
+ // der letzte Crsr muss keine aufgespannte Selektion
+ if( 1 < nCnt && !pSh->SwCrsrShell::HasSelection() )
+ --nCnt;
+
+ bRet = 2 > nCnt && 0 == pSh->GetRefMark( rStr );
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zugriff ueber ResIds
+ --------------------------------------------------------------------*/
+
+void SwFldMgr::RemoveFldType(USHORT nResId, const String& rName )
+{
+ SwWrtShell * pSh = pWrtShell ? pWrtShell : lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ if( pSh )
+ pSh->RemoveFldType(nResId, rName);
+}
+
+USHORT SwFldMgr::GetFldTypeCount(USHORT nResId) const
+{
+ SwWrtShell * pSh = pWrtShell ? pWrtShell : lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ return pSh ? pSh->GetFldTypeCount(nResId) : 0;
+}
+
+
+SwFieldType* SwFldMgr::GetFldType(USHORT nResId, USHORT nId) const
+{
+ SwWrtShell * pSh = pWrtShell ? pWrtShell : lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ return pSh ? pSh->GetFldType(nId, nResId) : 0;
+}
+
+
+SwFieldType* SwFldMgr::GetFldType(USHORT nResId, const String& rName) const
+{
+ SwWrtShell * pSh = pWrtShell ? pWrtShell : lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ return pSh ? pSh->GetFldType(nResId, rName) : 0;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aktuelles Feld ermitteln
+ --------------------------------------------------------------------*/
+SwField* SwFldMgr::GetCurFld()
+{
+ SwWrtShell *pSh = pWrtShell ? pWrtShell : ::lcl_GetShell();
+ if ( pSh )
+ pCurFld = pSh->GetCurFld();
+ else
+ pCurFld = NULL;
+
+ // Strings und Format initialisieren
+ //
+ aCurPar1.Erase();
+ aCurPar2.Erase();
+ sCurFrame.Erase();
+ nCurFmt = 0;
+
+ if(!pCurFld)
+ return 0;
+
+ // Aktuelle Werte aufbereiten Parameter 1 und Parameter 2
+ // als auch das Format ermitteln
+ //
+ const USHORT nTypeId = pCurFld->GetTypeId();
+
+ nCurFmt = pCurFld->GetFormat();
+ aCurPar1 = pCurFld->GetPar1();
+ aCurPar2 = pCurFld->GetPar2();
+
+ switch( nTypeId )
+ {
+ case TYP_PAGENUMBERFLD:
+ case TYP_NEXTPAGEFLD:
+ case TYP_PREVPAGEFLD:
+ case TYP_GETREFPAGEFLD:
+ if( nCurFmt == SVX_NUM_PAGEDESC )
+ nCurFmt -= 2;
+ break;
+ }
+ return pCurFld;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Gruppen-Bereich liefern
+ --------------------------------------------------------------------*/
+
+
+const SwFldGroupRgn& SwFldMgr::GetGroupRange(BOOL bHtmlMode, USHORT nGrpId) const
+{
+static SwFldGroupRgn __READONLY_DATA aRanges[] =
+{
+ { /* Dokument */ GRP_DOC_BEGIN, GRP_DOC_END },
+ { /* Funktionen */ GRP_FKT_BEGIN, GRP_FKT_END },
+ { /* Referenzen */ GRP_REF_BEGIN, GRP_REF_END },
+ { /* Ablage */ GRP_REG_BEGIN, GRP_REG_END },
+ { /* DB */ GRP_DB_BEGIN, GRP_DB_END },
+ { /* User */ GRP_VAR_BEGIN, GRP_VAR_END }
+};
+static SwFldGroupRgn __READONLY_DATA aWebRanges[] =
+{
+ { /* Dokument */ GRP_WEB_DOC_BEGIN, GRP_WEB_DOC_END },
+ { /* Funktionen */ GRP_WEB_FKT_BEGIN, GRP_WEB_FKT_END },
+ { /* Referenzen */ GRP_WEB_REF_BEGIN, GRP_WEB_REF_END },
+ { /* Ablage */ GRP_WEB_REG_BEGIN, GRP_WEB_REG_END },
+ { /* DB */ GRP_WEB_DB_BEGIN, GRP_WEB_DB_END },
+ { /* User */ GRP_WEB_VAR_BEGIN, GRP_WEB_VAR_END }
+};
+
+ if (bHtmlMode)
+ return aWebRanges[(USHORT)nGrpId];
+ else
+ return aRanges[(USHORT)nGrpId];
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: GroupId bestimmen
+ --------------------------------------------------------------------*/
+
+USHORT SwFldMgr::GetGroup(BOOL bHtmlMode, USHORT nTypeId, USHORT nSubType) const
+{
+ if (nTypeId == TYP_SETINPFLD)
+ nTypeId = TYP_SETFLD;
+
+ if (nTypeId == TYP_INPUTFLD && (nSubType & INP_USR))
+ nTypeId = TYP_USERFLD;
+
+ if (nTypeId == TYP_FIXDATEFLD)
+ nTypeId = TYP_DATEFLD;
+
+ if (nTypeId == TYP_FIXTIMEFLD)
+ nTypeId = TYP_TIMEFLD;
+
+ for (USHORT i = GRP_DOC; i <= GRP_VAR; i++)
+ {
+ const SwFldGroupRgn& rRange = GetGroupRange(bHtmlMode, i);
+ for (USHORT nPos = rRange.nStart; nPos < rRange.nEnd; nPos++)
+ {
+ if (aSwFlds[nPos].nTypeId == nTypeId)
+ return i;
+ }
+ }
+ return USHRT_MAX;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Namen zur TypeId ermitteln
+ ZUGRIFF ueber TYP_....
+ --------------------------------------------------------------------*/
+
+
+USHORT SwFldMgr::GetTypeId(USHORT nPos)
+{
+ ASSERT(nPos < ::GetPackCount(), "unzulaessige Pos");
+ return aSwFlds[ nPos ].nTypeId;
+}
+
+
+const String& SwFldMgr::GetTypeStr(USHORT nPos)
+{
+ ASSERT(nPos < ::GetPackCount(), "unzulaessige TypeId");
+
+ USHORT nFldWh = aSwFlds[ nPos ].nTypeId;
+
+ // Sonderbehandlung fuer Datum/Zeit Felder (ohne var/fix)
+ if( TYP_DATEFLD == nFldWh )
+ {
+ static String g_aDate( SW_RES( STR_DATEFLD ) );
+ return g_aDate;
+ }
+ if( TYP_TIMEFLD == nFldWh )
+ {
+ static String g_aTime( SW_RES( STR_TIMEFLD ) );
+ return g_aTime;
+ }
+
+ return SwFieldType::GetTypeStr( nFldWh );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Pos in der Liste bestimmen
+ --------------------------------------------------------------------*/
+
+
+USHORT SwFldMgr::GetPos(USHORT nTypeId)
+{
+ switch( nTypeId )
+ {
+ case TYP_FIXDATEFLD: nTypeId = TYP_DATEFLD; break;
+ case TYP_FIXTIMEFLD: nTypeId = TYP_TIMEFLD; break;
+ case TYP_SETINPFLD: nTypeId = TYP_SETFLD; break;
+ case TYP_USRINPFLD: nTypeId = TYP_USERFLD; break;
+ }
+
+ for(USHORT i = 0; i < GetPackCount(); i++)
+ if(aSwFlds[i].nTypeId == nTypeId)
+ return i;
+
+ return USHRT_MAX;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Subtypen eines Feldes lokalisieren
+ --------------------------------------------------------------------*/
+
+BOOL SwFldMgr::GetSubTypes(USHORT nTypeId, SvStringsDtor& rToFill)
+{
+ BOOL bRet = FALSE;
+ SwWrtShell *pSh = pWrtShell ? pWrtShell : lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ if(pSh)
+ {
+ const USHORT nPos = GetPos(nTypeId);
+
+ switch(nTypeId)
+ {
+ case TYP_SETREFFLD:
+ case TYP_GETREFFLD:
+ {
+ // Referenzen sind keine Felder
+ pSh->GetRefMarks( &rToFill );
+ break;
+ }
+ case TYP_MACROFLD:
+ {
+ break;
+ }
+ case TYP_INPUTFLD:
+ { String* pNew = new SW_RESSTR(aSwFlds[nPos].nSubTypeStart);
+ rToFill.Insert(pNew, rToFill.Count());
+ // Weiter bei generischen Typen
+ }
+ case TYP_DDEFLD:
+ case TYP_SEQFLD:
+ case TYP_FORMELFLD:
+ case TYP_GETFLD:
+ case TYP_SETFLD:
+ case TYP_USERFLD:
+ {
+
+ const USHORT nCount = pSh->GetFldTypeCount();
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ SwFieldType* pFldType = pSh->GetFldType( i );
+ const USHORT nWhich = pFldType->Which();
+
+ if((nTypeId == TYP_DDEFLD && pFldType->Which() == RES_DDEFLD) ||
+
+ (nTypeId == TYP_USERFLD && nWhich == RES_USERFLD) ||
+
+ (nTypeId == TYP_GETFLD && nWhich == RES_SETEXPFLD &&
+ !(((SwSetExpFieldType*)pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) ||
+
+ (nTypeId == TYP_SETFLD && nWhich == RES_SETEXPFLD &&
+ !(((SwSetExpFieldType*)pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) ||
+
+ (nTypeId == TYP_SEQFLD && nWhich == RES_SETEXPFLD &&
+ (((SwSetExpFieldType*)pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) ||
+
+ ((nTypeId == TYP_INPUTFLD || nTypeId == TYP_FORMELFLD) &&
+ (nWhich == RES_USERFLD ||
+ (nWhich == RES_SETEXPFLD &&
+ !(((SwSetExpFieldType*)pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ))) ) )
+ {
+ String* pNew = new String(pFldType->GetName());
+ rToFill.Insert(pNew, rToFill.Count());
+ }
+ }
+ break;
+ }
+ case TYP_DBNEXTSETFLD:
+ case TYP_DBNUMSETFLD:
+ case TYP_DBNAMEFLD:
+ case TYP_DBSETNUMBERFLD:
+ break;
+
+ default:
+ {
+ // statische SubTypes
+ if(nPos != USHRT_MAX)
+ {
+ USHORT nCount;
+ if (nTypeId == TYP_DOCINFOFLD)
+ nCount = DI_SUBTYPE_END - DI_SUBTYPE_BEGIN;
+ else
+ nCount = aSwFlds[nPos].nSubTypeEnd - aSwFlds[nPos].nSubTypeStart;
+
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ String* pNew;
+ if (nTypeId == TYP_DOCINFOFLD)
+ {
+ if ( i == DI_CUSTOM )
+ pNew = new String( String(SW_RES( STR_CUSTOM )) );
+ else
+ pNew = new String(*ViewShell::GetShellRes()->aDocInfoLst[i]);
+ }
+ else
+ pNew = new SW_RESSTR(aSwFlds[nPos].nSubTypeStart + i);
+
+ rToFill.Insert(pNew, rToFill.Count());
+ }
+ }
+ }
+ }
+ bRet = TRUE;
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Format ermitteln
+ ZUGRIFF ueber TYP_....
+ --------------------------------------------------------------------*/
+
+
+USHORT SwFldMgr::GetFormatCount(USHORT nTypeId, BOOL bIsText, BOOL bHtmlMode) const
+{
+ ASSERT(nTypeId < TYP_END, "unzulaessige TypeId");
+
+ {
+ const USHORT nPos = GetPos(nTypeId);
+
+ if(nPos == USHRT_MAX || (bHtmlMode && nTypeId == TYP_SETFLD))
+ return 0;
+
+ ULONG nStart = aSwFlds[nPos].nFmtBegin;
+ ULONG nEnd = aSwFlds[nPos].nFmtEnd;
+
+ if (bIsText && nEnd - nStart >= 2)
+ return 2;
+
+ if (nTypeId == TYP_FILENAMEFLD)
+ nEnd -= 2; // Kein Bereich oder Vorlage
+
+ switch(nStart)
+ {
+ case FMT_GETVAR_BEGIN:
+ case FMT_SETVAR_BEGIN: return VF_COUNT;
+ case FMT_USERVAR_BEGIN: return VF_USR_COUNT;
+ case FMT_DBFLD_BEGIN: return VF_DB_COUNT;
+ case FMT_NUM_BEGIN:
+ {
+ USHORT nCount = (USHORT)(nEnd - nStart);
+ GetNumberingInfo();
+ if(xNumberingInfo.is())
+ {
+ Sequence<sal_Int16> aTypes = xNumberingInfo->getSupportedNumberingTypes();
+ const sal_Int16* pTypes = aTypes.getConstArray();
+ for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
+ {
+ sal_Int16 nCurrent = pTypes[nType];
+ //skip all values below or equal to CHARS_LOWER_LETTER_N
+ if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N)
+ {
+ // #i28073# it's not necessarily a sorted sequence
+ ++nCount;
+ }
+ }
+ }
+ return nCount;
+ }
+
+ }
+ return (USHORT)(nEnd - nStart);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: FormatString zu einem Typ ermitteln
+ --------------------------------------------------------------------*/
+
+
+String SwFldMgr::GetFormatStr(USHORT nTypeId, ULONG nFormatId) const
+{
+ String aRet;
+ ASSERT(nTypeId < TYP_END, "unzulaessige TypeId");
+
+ const USHORT nPos = GetPos(nTypeId);
+
+ if(nPos == USHRT_MAX)
+ return aRet;
+
+ ULONG nStart;
+
+ nStart = aSwFlds[nPos].nFmtBegin;
+
+ if (TYP_AUTHORFLD == nTypeId|| TYP_FILENAMEFLD == nTypeId)
+ nFormatId &= ~FF_FIXED; // Fixed-Flag ausmaskieren
+
+ if((nStart + nFormatId) < aSwFlds[nPos].nFmtEnd)
+ aRet = SW_RESSTR((USHORT)(nStart + nFormatId));
+ else if( FMT_NUM_BEGIN == nStart)
+ {
+ if(xNumberingInfo.is())
+ {
+ Sequence<sal_Int16> aTypes = xNumberingInfo->getSupportedNumberingTypes();
+ const sal_Int16* pTypes = aTypes.getConstArray();
+ sal_Int32 nOffset = aSwFlds[nPos].nFmtEnd - nStart;
+ sal_Int32 nValidEntry = 0;
+ for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
+ {
+ sal_Int16 nCurrent = pTypes[nType];
+ if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N)
+ {
+ if(nValidEntry == ((sal_Int32)nFormatId) - nOffset)
+ {
+ aRet = xNumberingInfo->getNumberingIdentifier( pTypes[nType] );
+ break;
+ }
+ ++nValidEntry;
+ }
+ }
+ }
+ }
+
+ return aRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: FormatId aus Pseudo-ID ermitteln
+ --------------------------------------------------------------------*/
+
+USHORT SwFldMgr::GetFormatId(USHORT nTypeId, ULONG nFormatId) const
+{
+ USHORT nId = (USHORT)nFormatId;
+
+ switch( nTypeId )
+ {
+ case TYP_DOCINFOFLD:
+ switch( aSwFlds[ GetPos( nTypeId ) ].nFmtBegin + nFormatId )
+ {
+ case FMT_REG_AUTHOR: nId = DI_SUB_AUTHOR; break;
+ case FMT_REG_TIME: nId = DI_SUB_TIME; break;
+ case FMT_REG_DATE: nId = DI_SUB_DATE; break;
+ }
+ break;
+
+ case TYP_PAGENUMBERFLD:
+ case TYP_NEXTPAGEFLD:
+ case TYP_PREVPAGEFLD:
+ case TYP_DOCSTATFLD:
+ case TYP_DBSETNUMBERFLD:
+ case TYP_SEQFLD:
+ case TYP_GETREFPAGEFLD:
+ {
+ USHORT nPos = GetPos( nTypeId );
+ ULONG nBegin = aSwFlds[ nPos ].nFmtBegin;
+ ULONG nEnd = aSwFlds[nPos].nFmtEnd;
+ if((nBegin + nFormatId) < nEnd)
+ {
+ switch( nBegin + nFormatId )
+ {
+ case FMT_NUM_ABC: nId = SVX_NUM_CHARS_UPPER_LETTER; break;
+ case FMT_NUM_SABC: nId = SVX_NUM_CHARS_LOWER_LETTER; break;
+ case FMT_NUM_ROMAN: nId = SVX_NUM_ROMAN_UPPER; break;
+ case FMT_NUM_SROMAN: nId = SVX_NUM_ROMAN_LOWER; break;
+ case FMT_NUM_ARABIC: nId = SVX_NUM_ARABIC; break;
+ case FMT_NUM_PAGEDESC: nId = SVX_NUM_PAGEDESC; break;
+ case FMT_NUM_PAGESPECIAL: nId = SVX_NUM_CHAR_SPECIAL; break;
+ case FMT_NUM_ABC_N: nId = SVX_NUM_CHARS_UPPER_LETTER_N; break;
+ case FMT_NUM_SABC_N: nId = SVX_NUM_CHARS_LOWER_LETTER_N; break;
+ }
+ }
+ else if(xNumberingInfo.is())
+ {
+ Sequence<sal_Int16> aTypes = xNumberingInfo->getSupportedNumberingTypes();
+ const sal_Int16* pTypes = aTypes.getConstArray();
+ sal_Int32 nOffset = nEnd - nBegin;
+ sal_Int32 nValidEntry = 0;
+ for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
+ {
+ sal_Int16 nCurrent = pTypes[nType];
+ if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N)
+ {
+ if(nValidEntry == ((sal_Int32)nFormatId) - nOffset)
+ {
+ nId = pTypes[nType];
+ break;
+ }
+ ++nValidEntry;
+ }
+ }
+ }
+ }
+ break;
+ case TYP_DDEFLD:
+ switch ( aSwFlds[ GetPos( nTypeId ) ].nFmtBegin + nFormatId )
+ {
+ case FMT_DDE_NORMAL: nId = sfx2::LINKUPDATE_ONCALL; break;
+ case FMT_DDE_HOT: nId = sfx2::LINKUPDATE_ALWAYS; break;
+ }
+ break;
+ }
+
+ return nId;
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Traveling
+ --------------------------------------------------------------------*/
+
+
+BOOL SwFldMgr::GoNextPrev( BOOL bNext, SwFieldType* pTyp )
+{
+ SwWrtShell* pSh = pWrtShell ? pWrtShell : ::lcl_GetShell();
+ if(!pSh)
+ return FALSE;
+
+ if( !pTyp && pCurFld )
+ {
+ const USHORT nTypeId = pCurFld->GetTypeId();
+ if( TYP_SETINPFLD == nTypeId || TYP_USRINPFLD == nTypeId )
+ pTyp = pSh->GetFldType( 0, RES_INPUTFLD );
+ else
+ pTyp = pCurFld->GetTyp();
+ }
+
+ if (pTyp && pTyp->Which() == RES_DBFLD)
+ {
+ // Fuer Feldbefehl-bearbeiten (alle DB-Felder anspringen)
+ return pSh->MoveFldType( 0, bNext, USHRT_MAX, RES_DBFLD );
+ }
+
+ return pTyp && pSh ? pSh->MoveFldType( pTyp, bNext ) : FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldtypen einfuegen
+ --------------------------------------------------------------------*/
+
+
+void SwFldMgr::InsertFldType(SwFieldType& rType)
+{
+ SwWrtShell* pSh = pWrtShell ? pWrtShell : ::lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ if(pSh)
+ pSh->InsertFldType(rType);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aktuelle TypeId ermitteln
+ --------------------------------------------------------------------*/
+
+
+USHORT SwFldMgr::GetCurTypeId() const
+{
+ return pCurFld ? pCurFld->GetTypeId() : USHRT_MAX;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ueber String Feld einfuegen oder Update
+ --------------------------------------------------------------------*/
+
+
+BOOL SwFldMgr::InsertFld( const SwInsertFld_Data& rData )
+{
+ SwField* pFld = 0;
+ BOOL bExp = FALSE;
+ BOOL bTbl = FALSE;
+ BOOL bPageVar = FALSE;
+ ULONG nFormatId = rData.nFormatId;
+ USHORT nSubType = rData.nSubType;
+ sal_Unicode cSeparator = rData.cSeparator;
+ SwWrtShell* pCurShell = rData.pSh;
+ if(!pCurShell)
+ pCurShell = pWrtShell ? pWrtShell : ::lcl_GetShell();
+ DBG_ASSERT(pCurShell, "no SwWrtShell found");
+ if(!pCurShell)
+ return FALSE;
+
+ switch(rData.nTypeId)
+ { // ACHTUNG dieses Feld wird ueber einen gesonderten Dialog eingefuegt
+ case TYP_POSTITFLD:
+ {
+ SwPostItFieldType* pType = (SwPostItFieldType*)pCurShell->GetFldType(0, RES_POSTITFLD);
+ pFld = new SwPostItField(pType, rData.sPar1, rData.sPar2, DateTime());
+ break;
+ }
+ case TYP_SCRIPTFLD:
+ {
+ SwScriptFieldType* pType =
+ (SwScriptFieldType*)pCurShell->GetFldType(0, RES_SCRIPTFLD);
+ pFld = new SwScriptField(pType, rData.sPar1, rData.sPar2, (BOOL)nFormatId);
+ break;
+ }
+ case TYP_COMBINED_CHARS:
+ {
+ SwCombinedCharFieldType* pType = (SwCombinedCharFieldType*)
+ pCurShell->GetFldType( 0, RES_COMBINED_CHARS );
+ pFld = new SwCombinedCharField( pType, rData.sPar1 );
+ }
+ break;
+ case TYP_AUTHORITY:
+ {
+ SwAuthorityFieldType* pType =
+ (SwAuthorityFieldType*)pCurShell->GetFldType(0, RES_AUTHORITY);
+ if(!pType)
+ {
+ pType =
+ (SwAuthorityFieldType*)pCurShell->InsertFldType(
+ SwAuthorityFieldType(pCurShell->GetDoc()));
+ }
+ pFld = new SwAuthorityField(pType, rData.sPar1);
+ }
+ break;
+ case TYP_DATEFLD:
+ case TYP_TIMEFLD:
+ {
+ USHORT nSub = static_cast< USHORT >(rData.nTypeId == TYP_DATEFLD ? DATEFLD : TIMEFLD);
+ nSub |= nSubType == DATE_VAR ? 0 : FIXEDFLD;
+
+ SwDateTimeFieldType* pTyp =
+ (SwDateTimeFieldType*)pCurShell->GetFldType(0, RES_DATETIMEFLD);
+ pFld = new SwDateTimeField(pTyp, nSub, nFormatId);
+ pFld->SetPar2(rData.sPar2);
+ break;
+ }
+ case TYP_FILENAMEFLD:
+ {
+ SwFileNameFieldType* pTyp =
+ (SwFileNameFieldType*)pCurShell->GetFldType(0, RES_FILENAMEFLD);
+ pFld = new SwFileNameField(pTyp, nFormatId);
+ break;
+ }
+ case TYP_TEMPLNAMEFLD:
+ {
+ SwTemplNameFieldType* pTyp =
+ (SwTemplNameFieldType*)pCurShell->GetFldType(0, RES_TEMPLNAMEFLD);
+ pFld = new SwTemplNameField(pTyp, nFormatId);
+ break;
+ }
+ case TYP_CHAPTERFLD:
+ {
+ USHORT nByte = (USHORT)rData.sPar2.ToInt32();
+ SwChapterFieldType* pTyp =
+ (SwChapterFieldType*)pCurShell->GetFldType(0, RES_CHAPTERFLD);
+ pFld = new SwChapterField(pTyp, nFormatId);
+ nByte = Max(USHORT(1), nByte);
+ nByte = Min(nByte, USHORT(MAXLEVEL));
+ nByte -= 1;
+ ((SwChapterField*)pFld)->SetLevel((BYTE)nByte);
+ break;
+ }
+ case TYP_NEXTPAGEFLD:
+ case TYP_PREVPAGEFLD:
+ case TYP_PAGENUMBERFLD:
+ {
+ short nOff = (short)rData.sPar2.ToInt32();
+
+ if(rData.nTypeId == TYP_NEXTPAGEFLD)
+ {
+ if( SVX_NUM_CHAR_SPECIAL == nFormatId )
+ nOff = 1;
+ else
+ nOff += 1;
+ nSubType = PG_NEXT;
+ }
+ else if(rData.nTypeId == TYP_PREVPAGEFLD)
+ {
+ if( SVX_NUM_CHAR_SPECIAL == nFormatId )
+ nOff = -1;
+ else
+ nOff -= 1;
+ nSubType = PG_PREV;
+ }
+ else
+ nSubType = PG_RANDOM;
+
+ SwPageNumberFieldType* pTyp =
+ (SwPageNumberFieldType*)pCurShell->GetFldType(0, RES_PAGENUMBERFLD);
+ pFld = new SwPageNumberField(pTyp, nSubType, nFormatId, nOff);
+
+ if( SVX_NUM_CHAR_SPECIAL == nFormatId &&
+ ( PG_PREV == nSubType || PG_NEXT == nSubType ) )
+ ((SwPageNumberField*)pFld)->SetUserString( rData.sPar2 );
+ break;
+ }
+ case TYP_DOCSTATFLD:
+ { SwDocStatFieldType* pTyp =
+ (SwDocStatFieldType*)pCurShell->GetFldType(0, RES_DOCSTATFLD);
+ pFld = new SwDocStatField(pTyp, nSubType, nFormatId);
+ break;
+ }
+ case TYP_AUTHORFLD:
+ { SwAuthorFieldType* pTyp =
+ (SwAuthorFieldType*)pCurShell->GetFldType(0, RES_AUTHORFLD);
+ pFld = new SwAuthorField(pTyp, nFormatId);
+ break;
+ }
+ case TYP_CONDTXTFLD:
+ case TYP_HIDDENTXTFLD:
+ {
+ SwHiddenTxtFieldType* pTyp =
+ (SwHiddenTxtFieldType*)pCurShell->GetFldType(0, RES_HIDDENTXTFLD);
+ pFld = new SwHiddenTxtField(pTyp, TRUE, rData.sPar1, rData.sPar2, FALSE, rData.nTypeId);
+ bExp = TRUE;
+ break;
+ }
+ case TYP_HIDDENPARAFLD:
+ {
+ SwHiddenParaFieldType* pTyp =
+ (SwHiddenParaFieldType*)pCurShell->GetFldType(0, RES_HIDDENPARAFLD);
+ pFld = new SwHiddenParaField(pTyp, rData.sPar1);
+ bExp = TRUE;
+ break;
+ }
+ case TYP_SETREFFLD:
+ {
+ if( rData.sPar1.Len() > 0 && CanInsertRefMark( rData.sPar1 ) )
+ {
+ pCurShell->SetAttr( SwFmtRefMark( rData.sPar1 ) );
+ return TRUE;
+ }
+ return FALSE;
+ }
+ case TYP_GETREFFLD:
+ {
+ SwGetRefFieldType* pTyp =
+ (SwGetRefFieldType*)pCurShell->GetFldType(0, RES_GETREFFLD);
+ USHORT nSeqNo = (USHORT)rData.sPar2.ToInt32();
+ pFld = new SwGetRefField(pTyp, rData.sPar1, nSubType, nSeqNo, nFormatId);
+ bExp = TRUE;
+ break;
+ }
+ case TYP_DDEFLD:
+ {
+ //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
+ // Namen haben! Wird hier noch nicht beachtet.
+ String sCmd( rData.sPar2 );
+ USHORT nTmpPos = sCmd.SearchAndReplace( ' ', sfx2::cTokenSeperator );
+ sCmd.SearchAndReplace( ' ', sfx2::cTokenSeperator, nTmpPos );
+
+ SwDDEFieldType* pTyp = (SwDDEFieldType*)pCurShell->InsertFldType(
+ SwDDEFieldType( rData.sPar1, sCmd, (USHORT)nFormatId ));
+ pFld = new SwDDEField( pTyp );
+ break;
+ }
+ case TYP_MACROFLD:
+ {
+ SwMacroFieldType* pTyp =
+ (SwMacroFieldType*)pCurShell->GetFldType(0, RES_MACROFLD);
+
+ pFld = new SwMacroField(pTyp, rData.sPar1, rData.sPar2);
+
+ break;
+ }
+ case TYP_INTERNETFLD:
+ {
+ SwFmtINetFmt aFmt( rData.sPar1, sCurFrame );
+ if( pMacroItem )
+ aFmt.SetMacroTbl( &pMacroItem->GetMacroTable() );
+ return pCurShell->InsertURL( aFmt, rData.sPar2 );
+ }
+ case TYP_JUMPEDITFLD:
+ {
+ SwJumpEditFieldType* pTyp =
+ (SwJumpEditFieldType*)pCurShell->GetFldType(0, RES_JUMPEDITFLD);
+
+ pFld = new SwJumpEditField(pTyp, nFormatId, rData.sPar1, rData.sPar2 );
+ break;
+ }
+ case TYP_DOCINFOFLD:
+ {
+ SwDocInfoFieldType* pTyp = (SwDocInfoFieldType*)pCurShell->GetFldType(
+ 0, RES_DOCINFOFLD );
+ pFld = new SwDocInfoField(pTyp, nSubType, rData.sPar1, nFormatId);
+ break;
+ }
+ case TYP_EXTUSERFLD:
+ {
+ SwExtUserFieldType* pTyp = (SwExtUserFieldType*)pCurShell->GetFldType(
+ 0, RES_EXTUSERFLD);
+ pFld = new SwExtUserField(pTyp, nSubType, nFormatId);
+ break;
+ }
+ case TYP_DBFLD:
+ {
+ SwDBData aDBData;
+ String sPar1;
+
+ if (rData.sPar1.Search(DB_DELIM) == STRING_NOTFOUND)
+ {
+ aDBData = pCurShell->GetDBData();
+ sPar1 = rData.sPar1;
+ }
+ else
+ {
+ aDBData.sDataSource = rData.sPar1.GetToken(0, DB_DELIM);
+ aDBData.sCommand = rData.sPar1.GetToken(1, DB_DELIM);
+ aDBData.nCommandType = rData.sPar1.GetToken(2, DB_DELIM).ToInt32();
+ sPar1 = rData.sPar1.GetToken(3, DB_DELIM);
+ }
+
+ if(aDBData.sDataSource.getLength() && pCurShell->GetDBData() != aDBData)
+ pCurShell->ChgDBData(aDBData);
+
+ SwDBFieldType* pTyp = (SwDBFieldType*)pCurShell->InsertFldType(
+ SwDBFieldType(pCurShell->GetDoc(), sPar1, aDBData) );
+ pFld = new SwDBField(pTyp);
+ pFld->SetSubType(nSubType);
+
+ if( !(nSubType & nsSwExtendedSubType::SUB_OWN_FMT) ) // Datenbankformat ermitteln
+ {
+ Reference< XDataSource> xSource;
+ rData.aDBDataSource >>= xSource;
+ Reference<XConnection> xConnection;
+ rData.aDBConnection >>= xConnection;
+ Reference<XPropertySet> xColumn;
+ rData.aDBColumn >>= xColumn;
+ if(xColumn.is())
+ {
+ nFormatId = pCurShell->GetNewDBMgr()->GetColumnFmt(xSource, xConnection, xColumn,
+ pCurShell->GetNumberFormatter(), GetCurrLanguage() );
+ }
+ else
+ nFormatId = pCurShell->GetNewDBMgr()->GetColumnFmt(
+ aDBData.sDataSource, aDBData.sCommand, sPar1,
+ pCurShell->GetNumberFormatter(), GetCurrLanguage() );
+ }
+ pFld->ChangeFormat( nFormatId );
+
+ bExp = TRUE;
+ break;
+ }
+ case TYP_DBSETNUMBERFLD:
+ case TYP_DBNUMSETFLD:
+ case TYP_DBNEXTSETFLD:
+ case TYP_DBNAMEFLD:
+ {
+ USHORT nPos, nTablePos, nCmdTypePos, nExpPos;
+ String sPar1;
+ SwDBData aDBData;
+
+ // DBName aus rData.sPar1 extrahieren. Format: DBName.TableName.CommandType.ExpStrg
+ if ((nTablePos = rData.sPar1.Search(DB_DELIM)) != STRING_NOTFOUND)
+ aDBData.sDataSource = rData.sPar1.Copy(0, nTablePos++);
+ if ((nCmdTypePos = rData.sPar1.Search(DB_DELIM, nTablePos)) != STRING_NOTFOUND)
+ {
+ aDBData.sCommand = rData.sPar1.Copy(nTablePos, nCmdTypePos++ - nTablePos);
+ }
+ if ((nExpPos = rData.sPar1.Search(DB_DELIM, nCmdTypePos)) != STRING_NOTFOUND)
+ {
+ aDBData.nCommandType = rData.sPar1.Copy(nCmdTypePos, nExpPos++ - nCmdTypePos).ToInt32();
+ }
+ if (nExpPos != STRING_NOTFOUND)
+ nPos = nExpPos;
+ else if (nTablePos != STRING_NOTFOUND)
+ nPos = nTablePos;
+ else
+ nPos = 0;
+ sPar1 = rData.sPar1.Copy(nPos);
+
+ if (aDBData.sDataSource.getLength() && pCurShell->GetDBData() != aDBData)
+ pCurShell->ChgDBData(aDBData);
+
+ switch(rData.nTypeId)
+ {
+ case TYP_DBNAMEFLD:
+ {
+ SwDBNameFieldType* pTyp =
+ (SwDBNameFieldType*)pCurShell->GetFldType(0, RES_DBNAMEFLD);
+ pFld = new SwDBNameField(pTyp, aDBData);
+
+ break;
+ }
+ case TYP_DBNEXTSETFLD:
+ {
+ SwDBNextSetFieldType* pTyp = (SwDBNextSetFieldType*)pCurShell->GetFldType(
+ 0, RES_DBNEXTSETFLD);
+ pFld = new SwDBNextSetField(pTyp, sPar1, rData.sPar2, aDBData);
+ bExp = TRUE;
+ break;
+ }
+ case TYP_DBNUMSETFLD:
+ {
+ SwDBNumSetFieldType* pTyp = (SwDBNumSetFieldType*)pCurShell->GetFldType(
+ 0, RES_DBNUMSETFLD);
+ pFld = new SwDBNumSetField( pTyp, sPar1, rData.sPar2, aDBData);
+ bExp = TRUE;
+ break;
+ }
+ case TYP_DBSETNUMBERFLD:
+ {
+ SwDBSetNumberFieldType* pTyp = (SwDBSetNumberFieldType*)
+ pCurShell->GetFldType(0, RES_DBSETNUMBERFLD);
+ pFld = new SwDBSetNumberField( pTyp, aDBData, nFormatId);
+ bExp = TRUE;
+ break;
+ }
+ }
+ break;
+ }
+ case TYP_USERFLD:
+ {
+ SwUserFieldType* pTyp =
+ (SwUserFieldType*)pCurShell->GetFldType(RES_USERFLD, rData.sPar1);
+
+ // nur wenn vorhanden
+ if(!pTyp)
+ {
+ pTyp = (SwUserFieldType*)pCurShell->InsertFldType(
+ SwUserFieldType(pCurShell->GetDoc(), rData.sPar1));
+ }
+ if (pTyp->GetContent(nFormatId) != rData.sPar2)
+ pTyp->SetContent(rData.sPar2, nFormatId);
+ pFld = new SwUserField(pTyp, 0, nFormatId);
+ if (pFld->GetSubType() != nSubType)
+ pFld->SetSubType(nSubType);
+ bTbl = TRUE;
+ break;
+ }
+ case TYP_INPUTFLD:
+ {
+ if ((nSubType & 0x00ff) == INP_VAR)
+ {
+ SwSetExpFieldType* pTyp = (SwSetExpFieldType*)
+ pCurShell->GetFldType(RES_SETEXPFLD, rData.sPar1);
+
+ // kein Experssion Type mit dem Namen vorhanden -> anlegen
+ if(pTyp)
+ {
+ SwSetExpField* pExpFld =
+ new SwSetExpField(pTyp, aEmptyStr, nFormatId);
+
+ // Typ vom SwSetExpFieldType nicht veraendern:
+ USHORT nOldSubType = pExpFld->GetSubType();
+ pExpFld->SetSubType(nOldSubType | (nSubType & 0xff00));
+
+ pExpFld->SetPromptText(rData.sPar2);
+ pExpFld->SetInputFlag(TRUE) ;
+ bExp = TRUE;
+ pFld = pExpFld;
+ }
+ else
+ return FALSE;
+ }
+ else
+ {
+ SwInputFieldType* pTyp =
+ (SwInputFieldType*)pCurShell->GetFldType(0, RES_INPUTFLD);
+
+ SwInputField* pInpFld =
+ new SwInputField(pTyp, rData.sPar1, rData.sPar2, nSubType|nsSwExtendedSubType::SUB_INVISIBLE, nFormatId);
+ pFld = pInpFld;
+ }
+
+ // Dialog starten
+ //
+ pCurShell->StartInputFldDlg(pFld, FALSE, rData.pParent);
+ break;
+ }
+ case TYP_SETFLD:
+ {
+ if (!rData.sPar2.Len()) // Leere Variablen sind nicht erlaubt
+ return FALSE;
+
+ SwSetExpFieldType* pTyp = (SwSetExpFieldType*)pCurShell->InsertFldType(
+ SwSetExpFieldType(pCurShell->GetDoc(), rData.sPar1) );
+
+ SwSetExpField* pExpFld = new SwSetExpField( pTyp, rData.sPar2, nFormatId);
+ pExpFld->SetSubType(nSubType);
+ pExpFld->SetPar2(rData.sPar2);
+ bExp = TRUE;
+ pFld = pExpFld;
+ break;
+ }
+ case TYP_SEQFLD:
+ {
+ SwSetExpFieldType* pTyp = (SwSetExpFieldType*)pCurShell->InsertFldType(
+ SwSetExpFieldType(pCurShell->GetDoc(), rData.sPar1, nsSwGetSetExpType::GSE_SEQ));
+
+ BYTE nLevel = static_cast< BYTE >(nSubType & 0xff);
+
+ pTyp->SetOutlineLvl(nLevel);
+ if (nLevel != 0x7f && cSeparator == 0)
+ cSeparator = '.';
+
+ pTyp->SetDelimiter(cSeparator);
+ SwSetExpField* pExpFld = new SwSetExpField(pTyp, rData.sPar2, nFormatId);
+ bExp = TRUE;
+ pFld = pExpFld;
+ nSubType = nsSwGetSetExpType::GSE_SEQ;
+ break;
+ }
+ case TYP_GETFLD:
+ {
+ // gibt es ein entprechendes SetField
+ SwSetExpFieldType* pSetTyp = (SwSetExpFieldType*)
+ pCurShell->GetFldType(RES_SETEXPFLD, rData.sPar1);
+
+ if(pSetTyp)
+ {
+ SwGetExpFieldType* pTyp = (SwGetExpFieldType*)pCurShell->GetFldType(
+ 0, RES_GETEXPFLD);
+ pFld = new SwGetExpField(pTyp, rData.sPar1, pSetTyp->GetType(), nFormatId);
+ pFld->SetSubType(nSubType | pSetTyp->GetType());
+ bExp = TRUE;
+ }
+ else
+ return FALSE;
+ break;
+ }
+ case TYP_FORMELFLD:
+ {
+ if(pCurShell->GetFrmType(0,FALSE) & FRMTYPE_TABLE)
+ {
+ pCurShell->StartAllAction();
+
+ SvNumberFormatter* pFormatter = pCurShell->GetDoc()->GetNumberFormatter();
+ const SvNumberformat* pEntry = pFormatter->GetEntry(nFormatId);
+
+ if (pEntry)
+ {
+ SfxStringItem aFormat(FN_NUMBER_FORMAT, pEntry->GetFormatstring());
+ pCurShell->GetView().GetViewFrame()->GetDispatcher()->
+ Execute(FN_NUMBER_FORMAT, SFX_CALLMODE_SYNCHRON, &aFormat, 0L);
+ }
+
+ SfxItemSet aBoxSet( pCurShell->GetAttrPool(),
+ RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
+
+ String sFml( rData.sPar2 );
+ if( sFml.EraseLeadingChars().Len() &&
+ '=' == sFml.GetChar( 0 ) )
+ sFml.Erase( 0, 1 );
+
+ aBoxSet.Put( SwTblBoxFormula( sFml ));
+ pCurShell->SetTblBoxFormulaAttrs( aBoxSet );
+ pCurShell->UpdateTable();
+
+ pCurShell->EndAllAction();
+ return TRUE;
+
+/* // In der Tabelle Tabellenformeln einfuegen
+ SwTblFieldType* pTyp = (SwTblFieldType*)pCurShell->GetFldType(
+ 0, RES_TABLEFLD);
+ pFld = new SwTblField(pTyp, rData.sPar2, nsSwGetSetExpType::GSE_EXPR, nFormatId);
+ bTbl = TRUE;*/
+ }
+ else
+ {
+ SwGetExpFieldType* pTyp = (SwGetExpFieldType*)
+ pCurShell->GetFldType(0, RES_GETEXPFLD);
+ pFld = new SwGetExpField(pTyp, rData.sPar2, nsSwGetSetExpType::GSE_FORMULA, nFormatId);
+ pFld->SetSubType(nSubType);
+ bExp = TRUE;
+ }
+ break;
+ }
+ case TYP_SETREFPAGEFLD:
+ pFld = new SwRefPageSetField( (SwRefPageSetFieldType*)
+ pCurShell->GetFldType( 0, RES_REFPAGESETFLD ),
+ (short)rData.sPar2.ToInt32(), 0 != nSubType );
+ bPageVar = TRUE;
+ break;
+
+ case TYP_GETREFPAGEFLD:
+ pFld = new SwRefPageGetField( (SwRefPageGetFieldType*)
+ pCurShell->GetFldType( 0, RES_REFPAGEGETFLD ), nFormatId );
+ bPageVar = TRUE;
+ break;
+ case TYP_DROPDOWN :
+ {
+ pFld = new SwDropDownField(pCurShell->GetFldType( 0, RES_DROPDOWN ));
+ xub_StrLen nTokenCount = rData.sPar2.Len() ? rData.sPar2.GetTokenCount(DB_DELIM) : 0;
+ Sequence<OUString> aEntries(nTokenCount);
+ OUString* pArray = aEntries.getArray();
+ for(xub_StrLen nToken = 0; nToken < nTokenCount; nToken++)
+ pArray[nToken] = rData.sPar2.GetToken(nToken, DB_DELIM);
+ ((SwDropDownField*)pFld)->SetItems(aEntries);
+ ((SwDropDownField*)pFld)->SetName(rData.sPar1);
+ }
+ break;
+ default:
+ { ASSERT(!this, "Falscher Feldtyp");
+ return FALSE;
+ }
+ }
+ ASSERT(pFld, "Feld nicht vorhanden");
+
+
+ //the auto language flag has to be set prior to the language!
+ pFld->SetAutomaticLanguage(rData.bIsAutomaticLanguage);
+ USHORT nLang = GetCurrLanguage();
+ pFld->SetLanguage(nLang);
+
+ // Einfuegen
+ pCurShell->StartAllAction();
+
+ pCurShell->Insert(*pFld);
+
+ if(bExp && bEvalExp)
+ pCurShell->UpdateExpFlds(TRUE);
+
+ if(bTbl)
+ {
+ pCurShell->Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ pCurShell->UpdateFlds(*pFld);
+ pCurShell->Right(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ }
+ else if( bPageVar )
+ ((SwRefPageGetFieldType*)pCurShell->GetFldType( 0, RES_REFPAGEGETFLD ))->UpdateFlds();
+ else if( TYP_GETREFFLD == rData.nTypeId )
+ pFld->GetTyp()->Modify( 0, 0 );
+
+ // temporaeres Feld loeschen
+ delete pFld;
+
+ pCurShell->EndAllAction();
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Felder Update
+ --------------------------------------------------------------------*/
+
+
+void SwFldMgr::UpdateCurFld(ULONG nFormat,
+ const String& rPar1,
+ const String& rPar2,
+ SwField * _pTmpFld) // #111840#
+{
+ // Format aendern
+ ASSERT(pCurFld, "kein Feld an der CursorPos");
+
+ bool bDelete = false;
+ SwField *pTmpFld; // mb: fixed memory leak
+ if (NULL != _pTmpFld)
+ {
+ pTmpFld = _pTmpFld;
+ }
+ else
+ {
+ pTmpFld = pCurFld->CopyField();
+ bDelete = true;
+ }
+
+ SwFieldType* pType = pTmpFld->GetTyp();
+ const USHORT nTypeId = pTmpFld->GetTypeId();
+
+ SwWrtShell* pSh = pWrtShell ? pWrtShell : ::lcl_GetShell();
+ DBG_ASSERT(pSh, "no SwWrtShell found");
+ if(!pSh)
+ return;
+ pSh->StartAllAction();
+
+ BOOL bSetPar2 = TRUE;
+ BOOL bSetPar1 = TRUE;
+ String sPar1( rPar1 );
+ String sPar2( rPar2 );
+
+ // Order to Format
+ switch( nTypeId )
+ {
+ case TYP_DDEFLD:
+ {
+ //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
+ // Namen haben! Wird hier noch nicht beachtet.
+ USHORT nTmpPos = sPar2.SearchAndReplace( ' ', sfx2::cTokenSeperator );
+ sPar2.SearchAndReplace( ' ', sfx2::cTokenSeperator, nTmpPos );
+ break;
+ }
+
+ case TYP_CHAPTERFLD:
+ {
+ USHORT nByte = (USHORT)rPar2.ToInt32();
+ nByte = Max(USHORT(1), nByte);
+ nByte = Min(nByte, USHORT(MAXLEVEL));
+ nByte -= 1;
+ ((SwChapterField*)pTmpFld)->SetLevel((BYTE)nByte);
+ bSetPar2 = FALSE;
+ break;
+ }
+
+ case TYP_SCRIPTFLD:
+ ((SwScriptField*)pTmpFld)->SetCodeURL((BOOL)nFormat);
+ break;
+
+ case TYP_NEXTPAGEFLD:
+ if( SVX_NUM_CHAR_SPECIAL == nFormat )
+ {
+ ((SwPageNumberField*)pCurFld)->SetUserString( sPar2 );
+ sPar2 = '1';
+ }
+ else
+ {
+ if( nFormat + 2 == SVX_NUM_PAGEDESC )
+ nFormat = SVX_NUM_PAGEDESC;
+ short nOff = (short)sPar2.ToInt32();
+ nOff += 1;
+ sPar2 = String::CreateFromInt32(nOff);
+ }
+ break;
+
+ case TYP_PREVPAGEFLD:
+ if( SVX_NUM_CHAR_SPECIAL == nFormat )
+ {
+ ((SwPageNumberField*)pCurFld)->SetUserString( sPar2 );
+ sPar2 = String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM("-1"));
+ }
+ else
+ {
+ if( nFormat + 2 == SVX_NUM_PAGEDESC )
+ nFormat = SVX_NUM_PAGEDESC;
+ short nOff = (short)sPar2.ToInt32();
+ nOff -= 1;
+ sPar2 = String::CreateFromInt32(nOff);
+ }
+ break;
+
+ case TYP_PAGENUMBERFLD:
+ case TYP_GETREFPAGEFLD:
+ if( nFormat + 2 == SVX_NUM_PAGEDESC )
+ nFormat = SVX_NUM_PAGEDESC;
+ break;
+
+ case TYP_GETREFFLD:
+ {
+ bSetPar2 = FALSE;
+ ((SwGetRefField*)pTmpFld)->SetSubType( (USHORT)rPar2.ToInt32() );
+ USHORT nPos = rPar2.Search( '|' );
+ if( STRING_NOTFOUND != nPos )
+ ((SwGetRefField*)pTmpFld)->SetSeqNo( (USHORT)rPar2.Copy( nPos + 1 ).ToInt32());
+ }
+ break;
+ case TYP_DROPDOWN:
+ {
+ xub_StrLen nTokenCount = sPar2.Len() ? sPar2.GetTokenCount(DB_DELIM) : 0;
+ Sequence<OUString> aEntries(nTokenCount);
+ OUString* pArray = aEntries.getArray();
+ for(xub_StrLen nToken = 0; nToken < nTokenCount; nToken++)
+ pArray[nToken] = sPar2.GetToken(nToken, DB_DELIM);
+ ((SwDropDownField*)pTmpFld)->SetItems(aEntries);
+ ((SwDropDownField*)pTmpFld)->SetName(sPar1);
+ bSetPar1 = bSetPar2 = FALSE;
+ }
+ break;
+ case TYP_AUTHORITY :
+ {
+ //#i99069# changes to a bibliography field should change the field type
+ SwAuthorityField* pAuthorityField = static_cast<SwAuthorityField*>(pTmpFld);
+ SwAuthorityFieldType* pAuthorityType = static_cast<SwAuthorityFieldType*>(pType);
+ SwAuthEntry aTempEntry;
+ for( USHORT i = 0; i < AUTH_FIELD_END; ++i )
+ aTempEntry.SetAuthorField( (ToxAuthorityField)i,
+ rPar1.GetToken( i, TOX_STYLE_DELIMITER ));
+ if( pAuthorityType->ChangeEntryContent( &aTempEntry ) )
+ {
+ pType->UpdateFlds();
+ pSh->SetModified();
+ }
+
+ if( aTempEntry.GetAuthorField( AUTH_FIELD_IDENTIFIER ) ==
+ pAuthorityField->GetFieldText( AUTH_FIELD_IDENTIFIER ) )
+ bSetPar1 = FALSE; //otherwise it's a new or changed entry, the field needs to be updated
+ bSetPar2 = FALSE;
+ }
+ break;
+ }
+
+ // Format setzen
+ // Format wegen NumberFormatter vor SetPar2 einstellen!
+ pTmpFld->ChangeFormat(nFormat);
+
+ if(bSetPar1)
+ pTmpFld->SetPar1( sPar1 );
+ if( bSetPar2 )
+ pTmpFld->SetPar2( sPar2 );
+
+ // Update anschmeissen
+ if(nTypeId == TYP_DDEFLD ||
+ nTypeId == TYP_USERFLD ||
+ nTypeId == TYP_USRINPFLD)
+ {
+ pType->UpdateFlds();
+ pSh->SetModified();
+ }
+ else {
+ // mb: #32157
+ pSh->SwEditShell::UpdateFlds(*pTmpFld);
+ GetCurFld();
+ }
+
+ if (bDelete)
+ delete pTmpFld;
+
+ pSh->EndAllAction();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: ExpressionFields explizit evaluieren
+ --------------------------------------------------------------------*/
+void SwFldMgr::EvalExpFlds(SwWrtShell* pSh)
+{
+ if (pSh == NULL)
+ pSh = pWrtShell ? pWrtShell : ::lcl_GetShell();
+
+ if(pSh)
+ {
+ pSh->StartAllAction();
+ pSh->UpdateExpFlds(TRUE);
+ pSh->EndAllAction();
+ }
+}
+USHORT SwFldMgr::GetCurrLanguage() const
+{
+ SwWrtShell* pSh = pWrtShell ? pWrtShell : ::lcl_GetShell();
+ if( pSh )
+ return pSh->GetCurLang();
+ return SvxLocaleToLanguage( SvtSysLocale().GetLocaleData().getLocale() );
+}
+
+void SwFieldType::_GetFldName()
+{
+ static const USHORT coFldCnt = STR_TYPE_END - STR_TYPE_BEGIN;
+
+ static USHORT __READONLY_DATA coFldNms[ coFldCnt ] = {
+ FLD_DATE_STD,
+ FLD_TIME_STD,
+ STR_FILENAMEFLD,
+ STR_DBNAMEFLD,
+ STR_CHAPTERFLD,
+ STR_PAGENUMBERFLD,
+ STR_DOCSTATFLD,
+ STR_AUTHORFLD,
+ STR_SETFLD,
+ STR_GETFLD,
+ STR_FORMELFLD,
+ STR_HIDDENTXTFLD,
+ STR_SETREFFLD,
+ STR_GETREFFLD,
+ STR_DDEFLD,
+ STR_MACROFLD,
+ STR_INPUTFLD,
+ STR_HIDDENPARAFLD,
+ STR_DOCINFOFLD,
+ STR_DBFLD,
+ STR_USERFLD,
+ STR_POSTITFLD,
+ STR_TEMPLNAMEFLD,
+ STR_SEQFLD,
+ STR_DBNEXTSETFLD,
+ STR_DBNUMSETFLD,
+ STR_DBSETNUMBERFLD,
+ STR_CONDTXTFLD,
+ STR_NEXTPAGEFLD,
+ STR_PREVPAGEFLD,
+ STR_EXTUSERFLD,
+ FLD_DATE_FIX,
+ FLD_TIME_FIX,
+ STR_SETINPUTFLD,
+ STR_USRINPUTFLD,
+ STR_SETREFPAGEFLD,
+ STR_GETREFPAGEFLD,
+ STR_INTERNETFLD,
+ STR_JUMPEDITFLD,
+ STR_SCRIPTFLD,
+ STR_AUTHORITY,
+ STR_COMBINED_CHARS,
+ STR_DROPDOWN
+ };
+
+ // Infos fuer Felder einfuegen
+ SwFieldType::pFldNames = new SvStringsDtor( (BYTE)coFldCnt, 2 );
+ for( USHORT nIdx = 0; nIdx < coFldCnt; ++nIdx )
+ {
+ String* pTmp = new SW_RESSTR( coFldNms[ nIdx ] );
+ pTmp->Assign( MnemonicGenerator::EraseAllMnemonicChars( *pTmp ) );
+ SwFieldType::pFldNames->Insert(pTmp, nIdx );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL SwFldMgr::ChooseMacro(const String&)
+{
+ BOOL bRet = FALSE;
+
+ // choose script dialog
+ ::rtl::OUString aScriptURL = SfxApplication::ChooseScript();
+
+ // the script selector dialog returns a valid script URL
+ if ( aScriptURL.getLength() != 0 )
+ {
+ SetMacroPath( aScriptURL );
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+
+void SwFldMgr::SetMacroPath(const String& rPath)
+{
+ sMacroPath = rPath;
+ sMacroName = rPath;
+
+ // try to set sMacroName member variable by parsing the macro path
+ // using the new URI parsing services
+
+ Reference< XMultiServiceFactory > xSMgr =
+ ::comphelper::getProcessServiceFactory();
+
+ Reference< uri::XUriReferenceFactory >
+ xFactory( xSMgr->createInstance(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.uri.UriReferenceFactory" ) ), UNO_QUERY );
+
+ if ( xFactory.is() )
+ {
+ Reference< uri::XVndSunStarScriptUrl >
+ xUrl( xFactory->parse( sMacroPath ), UNO_QUERY );
+
+ if ( xUrl.is() )
+ {
+ sMacroName = xUrl->getName();
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+ULONG SwFldMgr::GetDefaultFormat(USHORT nTypeId, BOOL bIsText, SvNumberFormatter* pFormatter, double* pVal)
+{
+ double fValue;
+ short nDefFormat;
+
+ switch (nTypeId)
+ {
+ case TYP_TIMEFLD:
+ case TYP_DATEFLD:
+ {
+ Date aDate;
+ Date* pNullDate = pFormatter->GetNullDate();
+
+ fValue = aDate - *pNullDate;
+
+ Time aTime;
+
+ ULONG nNumFmtTime = (ULONG)aTime.GetSec() + (ULONG)aTime.GetMin() * 60L +
+ (ULONG)aTime.GetHour() * 3600L;
+
+ fValue += (double)nNumFmtTime / 86400.0;
+
+ nDefFormat = (nTypeId == TYP_DATEFLD) ? NUMBERFORMAT_DATE : NUMBERFORMAT_TIME;
+ }
+ break;
+
+ default:
+ if (bIsText)
+ {
+ fValue = 0.0;
+ nDefFormat = NUMBERFORMAT_TEXT;
+ }
+ else
+ {
+ fValue = 0.0;
+ nDefFormat = NUMBERFORMAT_ALL;
+ }
+ break;
+ }
+
+ if (pVal)
+ *pVal = fValue;
+
+ return pFormatter->GetStandardFormat(nDefFormat, GetCurrLanguage());
+}
+
+/* -----------------------------01.03.01 16:46--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference<XNumberingTypeInfo> SwFldMgr::GetNumberingInfo() const
+{
+ if(!xNumberingInfo.is())
+ {
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ Reference < XInterface > xI = xMSF->createInstance(
+ ::rtl::OUString::createFromAscii(
+ "com.sun.star.text.DefaultNumberingProvider" ));
+ Reference<XDefaultNumberingProvider> xDefNum(xI, UNO_QUERY);
+ DBG_ASSERT(xDefNum.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\"");
+ ((SwFldMgr*)this)->xNumberingInfo = Reference<XNumberingTypeInfo>(xDefNum, UNO_QUERY);
+ }
+ return xNumberingInfo;
+}
diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx
new file mode 100644
index 000000000000..265a53dc6646
--- /dev/null
+++ b/sw/source/ui/fldui/fldpage.cxx
@@ -0,0 +1,421 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <vcl/lstbox.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/request.hxx>
+#include <svx/htmlmode.hxx>
+#include <dbfld.hxx>
+#include <flddat.hxx>
+#include <fmtfld.hxx>
+#include <viewopt.hxx>
+#include <fldedt.hxx>
+#include <docsh.hxx>
+#include <swmodule.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <expfld.hxx>
+#include <fldtdlg.hxx>
+#include <fldpage.hxx>
+#include <docufld.hxx>
+#include <cmdid.h>
+#include <globals.hrc>
+#include <sfx2/bindings.hxx>
+
+using namespace ::com::sun::star;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldPage::SwFldPage( Window *pParent, const ResId &rId,
+ const SfxItemSet &rAttrSet )
+ :SfxTabPage (pParent, rId, rAttrSet),
+ m_pCurFld (0),
+ m_pWrtShell (0),
+ m_nPageId ( static_cast< USHORT >(rId.GetId()) ),
+ m_nTypeSel (LISTBOX_ENTRY_NOTFOUND),
+ m_nSelectionSel (LISTBOX_ENTRY_NOTFOUND),
+ m_bFldEdit (FALSE),
+ m_bInsert (TRUE),
+ m_bFldDlgHtmlMode (FALSE),
+ m_bRefresh (FALSE),
+ m_bFirstHTMLInit (TRUE)
+{
+// FreeResource();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldPage::~SwFldPage()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: TabPage initialisieren
+ --------------------------------------------------------------------*/
+
+void SwFldPage::Init()
+{
+ SwDocShell* pDocSh = (SwDocShell*)SfxObjectShell::Current();
+ BOOL bNewMode = 0 != (::GetHtmlMode(pDocSh) & HTMLMODE_ON);
+
+ m_bFldEdit = 0 == GetTabDialog();
+
+ // FieldManager neu initialisieren wichtig fuer
+ // Dok-Wechsel (fldtdlg:ReInitTabPage)
+ m_pCurFld = m_aMgr.GetCurFld();
+
+ if( bNewMode != m_bFldDlgHtmlMode )
+ {
+ m_bFldDlgHtmlMode = bNewMode;
+
+ // Bereichslistbox initialisieren
+ if( m_bFldDlgHtmlMode && m_bFirstHTMLInit )
+ {
+ m_bFirstHTMLInit = FALSE;
+ SwWrtShell *pSh = m_pWrtShell;
+ if(! pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ SwDoc* pDoc = pSh->GetDoc();
+ pSh->InsertFldType( SwSetExpFieldType( pDoc,
+ String::CreateFromAscii("HTML_ON"), 1));
+ pSh->InsertFldType( SwSetExpFieldType(pDoc,
+ String::CreateFromAscii("HTML_OFF"), 1));
+ }
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Seite neu initialisieren
+ --------------------------------------------------------------------*/
+
+void SwFldPage::ActivatePage()
+{
+ EnableInsert(m_bInsert);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Kompletter Reset; neues Feld editieren
+ --------------------------------------------------------------------*/
+
+void SwFldPage::EditNewField( BOOL bOnlyActivate )
+{
+ if( !bOnlyActivate )
+ {
+ m_nTypeSel = LISTBOX_ENTRY_NOTFOUND;
+ }
+ m_nSelectionSel = LISTBOX_ENTRY_NOTFOUND;
+ m_bRefresh = TRUE;
+ Reset(*(SfxItemSet*)0);
+ m_bRefresh = FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feld einfuegen
+ --------------------------------------------------------------------*/
+
+BOOL SwFldPage::InsertFld(USHORT nTypeId, USHORT nSubType, const String& rPar1,
+ const String& rPar2, ULONG nFormatId,
+ sal_Unicode cSeparator, BOOL bIsAutomaticLanguage)
+{
+ BOOL bRet = FALSE;
+ SwView* pView = GetActiveView();
+ SwWrtShell *pSh = m_pWrtShell ? m_pWrtShell : pView->GetWrtShellPtr();
+
+ if (!IsFldEdit()) // Neues Feld einfuegen
+ {
+ SwInsertFld_Data aData(nTypeId, nSubType, rPar1, rPar2, nFormatId, 0, cSeparator, bIsAutomaticLanguage );
+ //#i26566# provide parent for SwWrtShell::StartInputFldDlg
+ aData.pParent = &GetTabDialog()->GetOKButton();
+ bRet = m_aMgr.InsertFld( aData );
+
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ pView->GetViewFrame()->GetBindings().GetRecorder();
+ if ( xRecorder.is() )
+ {
+ BOOL bRecordDB = TYP_DBFLD == nTypeId ||
+ TYP_DBSETNUMBERFLD == nTypeId ||
+ TYP_DBNUMSETFLD == nTypeId ||
+ TYP_DBNEXTSETFLD == nTypeId ||
+ TYP_DBNAMEFLD == nTypeId ;
+
+ SfxRequest aReq( pView->GetViewFrame(),
+ bRecordDB ? FN_INSERT_DBFIELD : FN_INSERT_FIELD );
+ if(bRecordDB)
+ {
+ aReq.AppendItem(SfxStringItem
+ (FN_INSERT_DBFIELD,rPar1.GetToken(0, DB_DELIM)));
+ aReq.AppendItem(SfxStringItem
+ (FN_PARAM_1,rPar1.GetToken(1, DB_DELIM)));
+ aReq.AppendItem(SfxInt32Item
+ (FN_PARAM_3,rPar1.GetToken(1, DB_DELIM).ToInt32()));
+ aReq.AppendItem(SfxStringItem
+ (FN_PARAM_2,rPar1.GetToken(3, DB_DELIM)));
+ }
+ else
+ {
+ aReq.AppendItem(SfxStringItem(FN_INSERT_FIELD, rPar1));
+ aReq.AppendItem(SfxStringItem
+ (FN_PARAM_3,String(cSeparator)));
+ aReq.AppendItem(SfxUInt16Item(FN_PARAM_FIELD_SUBTYPE, nSubType));
+ }
+ aReq.AppendItem(SfxUInt16Item(FN_PARAM_FIELD_TYPE , nTypeId));
+ aReq.AppendItem(SfxStringItem(FN_PARAM_FIELD_CONTENT, rPar2));
+ aReq.AppendItem(SfxUInt32Item(FN_PARAM_FIELD_FORMAT , nFormatId));
+ aReq.Done();
+ }
+
+ }
+ else // Feld aendern
+ {
+ SwField *const pTmpFld = m_pCurFld->CopyField();
+
+ String sPar1(rPar1);
+ String sPar2(rPar2);
+ BOOL bDBChanged = FALSE;
+ switch( nTypeId )
+ {
+ case TYP_DATEFLD:
+ case TYP_TIMEFLD:
+ nSubType = static_cast< USHORT >(((nTypeId == TYP_DATEFLD) ? DATEFLD : TIMEFLD) |
+ ((nSubType == DATE_VAR) ? 0 : FIXEDFLD));
+ break;
+
+ case TYP_DBNAMEFLD:
+ case TYP_DBNEXTSETFLD:
+ case TYP_DBNUMSETFLD:
+ case TYP_DBSETNUMBERFLD:
+ {
+ xub_StrLen nPos = 0;
+ SwDBData aData;
+
+ aData.sDataSource = rPar1.GetToken(0, DB_DELIM, nPos);
+ aData.sCommand = rPar1.GetToken(0, DB_DELIM, nPos);
+ aData.nCommandType = rPar1.GetToken(0, DB_DELIM, nPos).ToInt32();
+ sPar1 = rPar1.Copy(nPos);
+
+ ((SwDBNameInfField*)pTmpFld)->SetDBData(aData);
+ bDBChanged = TRUE;
+ }
+ break;
+
+ case TYP_DBFLD:
+ {
+ SwDBData aData;
+ aData.sDataSource = rPar1.GetToken(0, DB_DELIM);
+ aData.sCommand = rPar1.GetToken(1, DB_DELIM);
+ aData.nCommandType = rPar1.GetToken(2, DB_DELIM).ToInt32();
+ String sColumn = rPar1.GetToken(3, DB_DELIM);
+
+ SwDBFieldType* pOldTyp = (SwDBFieldType*)pTmpFld->GetTyp();
+ SwDBFieldType* pTyp = (SwDBFieldType*)pSh->InsertFldType(
+ SwDBFieldType(pSh->GetDoc(), sColumn, aData));
+
+ SwClientIter aIter( *pOldTyp );
+
+ for( SwFmtFld* pFmtFld = (SwFmtFld*)aIter.First( TYPE(SwFmtFld) );
+ pFmtFld; pFmtFld = (SwFmtFld*)aIter.Next() )
+ {
+ if( pFmtFld->GetFld() == m_pCurFld)
+ {
+ pTyp->Add(pFmtFld); // Feld auf neuen Typ umhaengen
+ pTmpFld->ChgTyp(pTyp);
+ break;
+ }
+ }
+ bDBChanged = TRUE;
+ }
+ break;
+
+ case TYP_SEQFLD:
+ {
+ SwSetExpFieldType* pTyp = (SwSetExpFieldType*)pTmpFld->GetTyp();
+ pTyp->SetOutlineLvl( static_cast< BYTE >(nSubType & 0xff));
+ pTyp->SetDelimiter(cSeparator);
+
+ nSubType = nsSwGetSetExpType::GSE_SEQ;
+ }
+ break;
+
+ case TYP_INPUTFLD:
+ {
+ // User- oder SetField ?
+ if (m_aMgr.GetFldType(RES_USERFLD, sPar1) == 0 &&
+ !(pTmpFld->GetSubType() & INP_TXT)) // SETEXPFLD
+ {
+ SwSetExpField* pFld = (SwSetExpField*)pTmpFld;
+ pFld->SetPromptText(sPar2);
+ sPar2 = pFld->GetPar2();
+ }
+ }
+ break;
+ case TYP_DOCINFOFLD:
+ {
+ if( nSubType == nsSwDocInfoSubType::DI_CUSTOM )
+ {
+ SwDocInfoField* pDocInfo = static_cast<SwDocInfoField*>( pTmpFld );
+ pDocInfo->SetName( rPar1 );
+ }
+ }
+ break;
+ }
+
+ pSh->StartAllAction();
+
+ pTmpFld->SetSubType(nSubType);
+ pTmpFld->SetAutomaticLanguage(bIsAutomaticLanguage);
+
+ m_aMgr.UpdateCurFld( nFormatId, sPar1, sPar2, pTmpFld );
+
+ m_pCurFld = m_aMgr.GetCurFld();
+
+ switch (nTypeId)
+ {
+ case TYP_HIDDENTXTFLD:
+ case TYP_HIDDENPARAFLD:
+ m_aMgr.EvalExpFlds(pSh);
+ break;
+ }
+
+ pSh->SetUndoNoResetModified();
+ pSh->EndAllAction();
+ }
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldPage::SavePos( const ListBox* pLst1, const ListBox* pLst2,
+ const ListBox* pLst3 )
+{
+ const ListBox* aLBArr [ coLBCount ] = { pLst1, pLst2, pLst3 };
+
+ const ListBox** ppLB = aLBArr;
+ for( int i = 0; i < coLBCount; ++i, ++ppLB )
+ if( (*ppLB) && (*ppLB)->GetEntryCount() )
+ m_aLstStrArr[ i ] = (*ppLB)->GetSelectEntry();
+ else
+ m_aLstStrArr[ i ].Erase();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldPage::RestorePos(ListBox* pLst1, ListBox* pLst2, ListBox* pLst3)
+{
+ USHORT nPos = 0;
+ ListBox* aLBArr [ coLBCount ] = { pLst1, pLst2, pLst3 };
+ ListBox** ppLB = aLBArr;
+ for( int i = 0; i < coLBCount; ++i, ++ppLB )
+ if( (*ppLB) && (*ppLB)->GetEntryCount() && m_aLstStrArr[ i ].Len() &&
+ LISTBOX_ENTRY_NOTFOUND !=
+ ( nPos = (*ppLB)->GetEntryPos(m_aLstStrArr[ i ] ) ) )
+ (*ppLB)->SelectEntryPos( nPos );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Einfuegen von neuen Feldern
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldPage, InsertHdl, Button *, pBtn )
+{
+ SwFldDlg *pDlg = (SwFldDlg*)GetTabDialog();
+
+ if (pDlg)
+ {
+ pDlg->InsertHdl();
+
+ if (pBtn)
+ pBtn->GrabFocus(); // Wegen InputField-Dlg
+ }
+ else
+ {
+ SwFldEditDlg *pEditDlg = (SwFldEditDlg *)GetParent();
+ pEditDlg->InsertHdl();
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: "Einfuegen"-Button Enablen/Disablen
+ --------------------------------------------------------------------*/
+
+void SwFldPage::EnableInsert(BOOL bEnable)
+{
+ SwFldDlg *pDlg = (SwFldDlg*)GetTabDialog();
+
+ if (pDlg)
+ {
+ if (pDlg->GetCurPageId() == m_nPageId)
+ pDlg->EnableInsert(bEnable);
+ }
+ else
+ {
+ SwFldEditDlg *pEditDlg = (SwFldEditDlg *)GetParent();
+ pEditDlg->EnableInsert(bEnable);
+ }
+
+ m_bInsert = bEnable;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldPage, NumFormatHdl, ListBox *, EMPTYARG )
+{
+ InsertHdl();
+
+ return 0;
+}
+/*-- 19.12.2005 14:05:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwFldPage::SetWrtShell( SwWrtShell* pShell )
+{
+ m_pWrtShell = pShell;
+ m_aMgr.SetWrtShell( pShell );
+}
diff --git a/sw/source/ui/fldui/fldpage.hxx b/sw/source/ui/fldui/fldpage.hxx
new file mode 100644
index 000000000000..f2dc85e07f7c
--- /dev/null
+++ b/sw/source/ui/fldui/fldpage.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWFLDPAGE_HXX
+#define _SWFLDPAGE_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <fldmgr.hxx>
+
+class ListBox;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+const int coLBCount = 3;
+
+class SwFldPage : public SfxTabPage
+{
+ String m_aLstStrArr[ coLBCount ];
+ SwFldMgr m_aMgr;
+ SwField *m_pCurFld;
+ SwWrtShell* m_pWrtShell;
+ USHORT m_nPageId;
+ USHORT m_nTypeSel;
+ USHORT m_nSelectionSel;
+ BOOL m_bFldEdit;
+ BOOL m_bInsert;
+ BOOL m_bFldDlgHtmlMode;
+ BOOL m_bRefresh;
+ BOOL m_bFirstHTMLInit;
+
+protected:
+
+ USHORT GetTypeSel() const { return m_nTypeSel;}
+ void SetTypeSel(USHORT nSet) { m_nTypeSel = nSet;}
+ USHORT GetSelectionSel() const { return m_nSelectionSel;}
+ void SetSelectionSel(USHORT nSet){ m_nSelectionSel = nSet;}
+ BOOL IsFldDlgHtmlMode() const { return m_bFldDlgHtmlMode;}
+ BOOL IsRefresh() const { return m_bRefresh;}
+ SwField* GetCurField() { return m_pCurFld;}
+ SwWrtShell* GetWrtShell() { return m_pWrtShell;}
+
+ DECL_LINK( InsertHdl, Button *pBtn = 0 );
+ DECL_LINK( NumFormatHdl, ListBox *pBtn = 0 );
+
+ void Init();
+ void SavePos( const ListBox* pLst1,
+ const ListBox* pLst2 = 0,
+ const ListBox* pLst3 = 0);
+ void RestorePos( ListBox* pLst1, ListBox* pLst2 = 0,
+ ListBox* pLst3 = 0 );
+ void EnableInsert(BOOL bEnable = TRUE);
+ inline BOOL IsFldEdit() const { return m_bFldEdit; }
+
+ // Feld einfuegen
+ BOOL InsertFld( USHORT nTypeId,
+ USHORT nSubType,
+ const String& rPar1,
+ const String& rPar2,
+ ULONG nFormatId,
+ sal_Unicode cDelim = ' ',
+ BOOL bIsAutomaticLanguage = TRUE);
+
+ using SfxTabPage::ActivatePage;
+
+public:
+ SwFldPage( Window *pParent,
+ const ResId &rId,
+ const SfxItemSet &rAttrSet );
+
+ virtual ~SwFldPage();
+
+ virtual void ActivatePage();
+
+ inline SwFldMgr& GetFldMgr() { return m_aMgr; }
+ void SetWrtShell( SwWrtShell* m_pWrtShell );
+ void EditNewField( BOOL bOnlyActivate = FALSE );
+ virtual USHORT GetGroup() = 0;
+};
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
new file mode 100644
index 000000000000..4713e30775bc
--- /dev/null
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -0,0 +1,1073 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#include "swtypes.hxx"
+#include <view.hxx>
+#include <IMark.hxx>
+#include <expfld.hxx>
+#include <swmodule.hxx>
+#ifndef _FLDREF_HXX
+#include <fldref.hxx>
+#endif
+#include <reffld.hxx>
+#include <wrtsh.hxx>
+
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _FLDTDLG_HRC
+#include <fldtdlg.hrc>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+// --> OD 2007-11-14 #i83479#
+#include <SwNodeNum.hxx>
+#include <IDocumentMarkAccess.hxx>
+#include <ndtxt.hxx>
+// <--
+
+// sw/inc/expfld.hxx
+SV_IMPL_PTRARR( _SwSeqFldList, _SeqFldLstElem* )
+
+#define REFFLDFLAG 0x4000
+#define REFFLDFLAG_BOOKMARK 0x4800
+#define REFFLDFLAG_FOOTNOTE 0x5000
+#define REFFLDFLAG_ENDNOTE 0x6000
+// --> OD 2007-11-09 #i83479#
+#define REFFLDFLAG_HEADING 0x7100
+#define REFFLDFLAG_NUMITEM 0x7200
+// <--
+
+USHORT nFldDlgFmtSel = 0;
+
+#define USER_DATA_VERSION_1 "1"
+#define USER_DATA_VERSION USER_DATA_VERSION_1
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldRefPage::SwFldRefPage(Window* pParent, const SfxItemSet& rCoreSet ) :
+ SwFldPage( pParent, SW_RES( TP_FLD_REF ), rCoreSet ),
+
+ aTypeFT (this, SW_RES(FT_REFTYPE)),
+ aTypeLB (this, SW_RES(LB_REFTYPE)),
+ aSelectionFT (this, SW_RES(FT_REFSELECTION)),
+ aSelectionLB (this, SW_RES(LB_REFSELECTION)),
+ // --> OD 2007-11-21 #i83479#
+ aSelectionToolTipLB( this, SW_RES(LB_REFSELECTION_TOOLTIP) ),
+ // <--
+ aFormatFT (this, SW_RES(FT_REFFORMAT)),
+ aFormatLB (this, SW_RES(LB_REFFORMAT)),
+ aNameFT (this, SW_RES(FT_REFNAME)),
+ aNameED (this, SW_RES(ED_REFNAME)),
+ aValueFT (this, SW_RES(FT_REFVALUE)),
+ aValueED (this, SW_RES(ED_REFVALUE)),
+
+ sBookmarkTxt (SW_RES(STR_REFBOOKMARK)),
+ sFootnoteTxt (SW_RES(STR_REFFOOTNOTE)),
+ sEndnoteTxt (SW_RES(STR_REFENDNOTE)),
+ // --> OD 2007-11-09 #i83479#
+ sHeadingTxt (SW_RES(STR_REFHEADING)),
+ sNumItemTxt (SW_RES(STR_REFNUMITEM)),
+ maOutlineNodes(),
+ maNumItems(),
+ mpSavedSelectedTxtNode( 0 ),
+ mnSavedSelectedPos( 0 )
+ // <--
+{
+ FreeResource();
+
+ aNameED.SetModifyHdl(LINK(this, SwFldRefPage, ModifyHdl));
+
+ aTypeLB.SetDoubleClickHdl (LINK(this, SwFldRefPage, InsertHdl));
+ aTypeLB.SetSelectHdl (LINK(this, SwFldRefPage, TypeHdl));
+ aSelectionLB.SetSelectHdl (LINK(this, SwFldRefPage, SubTypeHdl));
+ aSelectionLB.SetDoubleClickHdl (LINK(this, SwFldRefPage, InsertHdl));
+ aFormatLB.SetDoubleClickHdl (LINK(this, SwFldRefPage, InsertHdl));
+
+ // --> OD 2007-11-21 #i83479#
+ aSelectionToolTipLB.SetSelectHdl( LINK(this, SwFldRefPage, SubTypeHdl) );
+ aSelectionToolTipLB.SetDoubleClickHdl( LINK(this, SwFldRefPage, InsertHdl) );
+ aSelectionToolTipLB.SetStyle( aSelectionToolTipLB.GetStyle() | WB_HSCROLL );
+ aSelectionToolTipLB.SetSpaceBetweenEntries(1);
+ aSelectionToolTipLB.SetHighlightRange();
+ // <--
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldRefPage::~SwFldRefPage()
+{
+}
+
+// --> OD 2007-11-22 #i83479#
+void SwFldRefPage::SaveSelectedTxtNode()
+{
+ mpSavedSelectedTxtNode = 0;
+ mnSavedSelectedPos = 0;
+ if ( aSelectionToolTipLB.IsVisible() )
+ {
+ SvLBoxEntry* pEntry = aSelectionToolTipLB.GetCurEntry();
+ if ( pEntry )
+ {
+ const USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+ SwWrtShell *pSh = GetWrtShell();
+ if ( !pSh )
+ {
+ pSh = ::GetActiveWrtShell();
+ }
+ if ( nTypeId == REFFLDFLAG_HEADING )
+ {
+ mnSavedSelectedPos = static_cast<sal_uInt16>(reinterpret_cast<ULONG>(pEntry->GetUserData()));
+ if ( mnSavedSelectedPos < maOutlineNodes.size() )
+ {
+ mpSavedSelectedTxtNode = maOutlineNodes[mnSavedSelectedPos];
+ }
+ }
+ else if ( nTypeId == REFFLDFLAG_NUMITEM )
+ {
+ mnSavedSelectedPos = static_cast<sal_uInt16>(reinterpret_cast<ULONG>(pEntry->GetUserData()));
+ if ( mnSavedSelectedPos < maNumItems.size() )
+ {
+ mpSavedSelectedTxtNode = maNumItems[mnSavedSelectedPos]->GetTxtNode();
+ }
+ }
+ }
+ }
+}
+
+const SwTxtNode* SwFldRefPage::GetSavedSelectedTxtNode() const
+{
+ return mpSavedSelectedTxtNode;
+}
+
+sal_uInt16 SwFldRefPage::GetSavedSelectedPos() const
+{
+ return mnSavedSelectedPos;
+}
+
+// <--
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldRefPage::Reset(const SfxItemSet& )
+{
+ if (!IsFldEdit())
+ {
+ SavePos(&aTypeLB);
+ // --> OD 2007-11-22 #i83479#
+ SaveSelectedTxtNode();
+ // <--
+ }
+ SetSelectionSel(LISTBOX_ENTRY_NOTFOUND);
+ SetTypeSel(LISTBOX_ENTRY_NOTFOUND);
+ Init(); // Allgemeine initialisierung
+
+ // TypeListBox initialisieren
+ aTypeLB.SetUpdateMode(FALSE);
+ aTypeLB.Clear();
+
+ // Typ-Listbox fuellen
+
+ USHORT nPos;
+ // Referenz setzen / einfuegen
+ const SwFldGroupRgn& rRg = GetFldMgr().GetGroupRange(IsFldDlgHtmlMode(), GetGroup());
+
+ for (short i = rRg.nStart; i < rRg.nEnd; ++i)
+ {
+ const USHORT nTypeId = GetFldMgr().GetTypeId(i);
+
+ if (!IsFldEdit() || nTypeId != TYP_SETREFFLD)
+ {
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(i), i - rRg.nStart);
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ }
+ }
+
+ // --> OD 2007-11-09 #i83479#
+ // entries for headings and numbered items
+ nPos = aTypeLB.InsertEntry(sHeadingTxt);
+ aTypeLB.SetEntryData(nPos, (void*)REFFLDFLAG_HEADING);
+ nPos = aTypeLB.InsertEntry(sNumItemTxt);
+ aTypeLB.SetEntryData(nPos, (void*)REFFLDFLAG_NUMITEM);
+ // <--
+
+ // mit den Sequence-Typen auffuellen
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+
+ USHORT nFldTypeCnt = pSh->GetFldTypeCount(RES_SETEXPFLD);
+
+ for (USHORT n = 0; n < nFldTypeCnt; ++n)
+ {
+ SwSetExpFieldType* pType = (SwSetExpFieldType*)pSh->GetFldType(n, RES_SETEXPFLD);
+
+ if ((nsSwGetSetExpType::GSE_SEQ & pType->GetType()) && pType->GetDepends() && pSh->IsUsed(*pType))
+ {
+ nPos = aTypeLB.InsertEntry(pType->GetName());
+ aTypeLB.SetEntryData(nPos, (void*)(REFFLDFLAG | n));
+ }
+ }
+
+ // Textmarken - jetzt immer (wegen Globaldokumenten)
+ nPos = aTypeLB.InsertEntry(sBookmarkTxt);
+ aTypeLB.SetEntryData(nPos, (void*)REFFLDFLAG_BOOKMARK);
+
+ // Fussnoten:
+ if( pSh->HasFtns() )
+ {
+ nPos = aTypeLB.InsertEntry(sFootnoteTxt);
+ aTypeLB.SetEntryData(nPos, (void*)REFFLDFLAG_FOOTNOTE);
+ }
+
+ // Endnoten:
+ if ( pSh->HasFtns(true) )
+ {
+ nPos = aTypeLB.InsertEntry(sEndnoteTxt);
+ aTypeLB.SetEntryData(nPos, (void*)REFFLDFLAG_ENDNOTE);
+ }
+
+ // alte Pos selektieren
+ if (!IsFldEdit())
+ RestorePos(&aTypeLB);
+
+ aTypeLB.SetUpdateMode(TRUE);
+
+ nFldDlgFmtSel = 0;
+
+ if( !IsRefresh() )
+ {
+ String sUserData = GetUserData();
+ if(!IsRefresh() && sUserData.GetToken(0, ';').
+ EqualsIgnoreCaseAscii(USER_DATA_VERSION_1))
+ {
+ String sVal = sUserData.GetToken(1, ';');
+ USHORT nVal = static_cast< USHORT >(sVal.ToInt32());
+ if(nVal != USHRT_MAX)
+ {
+ for(USHORT i = 0; i < aTypeLB.GetEntryCount(); i++)
+ if(nVal == (USHORT)(ULONG)aTypeLB.GetEntryData(i))
+ {
+ aTypeLB.SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+ }
+ TypeHdl(0);
+
+ if (IsFldEdit())
+ {
+ aTypeLB.SaveValue();
+ aSelectionLB.SaveValue();
+ aFormatLB.SaveValue();
+ aNameED.SaveValue();
+ aValueED.SaveValue();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldRefPage, TypeHdl, ListBox *, EMPTYARG )
+{
+ // Alte ListBoxPos sichern
+ const USHORT nOld = GetTypeSel();
+
+ // Aktuelle ListBoxPos
+ SetTypeSel(aTypeLB.GetSelectEntryPos());
+
+ if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
+ {
+ if (IsFldEdit())
+ {
+ // Positionen selektieren
+ String sName;
+ USHORT nFlag = 0;
+
+ switch( GetCurField()->GetSubType() )
+ {
+ case REF_BOOKMARK:
+ {
+ // --> OD 2007-11-14 #i83479#
+// sName = sBookmarkTxt;
+// nFlag = REFFLDFLAG_BOOKMARK;
+ SwGetRefField* pRefFld = dynamic_cast<SwGetRefField*>(GetCurField());
+ if ( pRefFld &&
+ pRefFld->IsRefToHeadingCrossRefBookmark() )
+ {
+ sName = sHeadingTxt;
+ nFlag = REFFLDFLAG_HEADING;
+ }
+ else if ( pRefFld &&
+ pRefFld->IsRefToNumItemCrossRefBookmark() )
+ {
+ sName = sNumItemTxt;
+ nFlag = REFFLDFLAG_NUMITEM;
+ }
+ else
+ {
+ sName = sBookmarkTxt;
+ nFlag = REFFLDFLAG_BOOKMARK;
+ }
+ // <--
+ }
+ break;
+
+ case REF_FOOTNOTE:
+ sName = sFootnoteTxt;
+ nFlag = REFFLDFLAG_FOOTNOTE;
+ break;
+
+ case REF_ENDNOTE:
+ sName = sEndnoteTxt;
+ nFlag = REFFLDFLAG_ENDNOTE;
+ break;
+
+ case REF_SETREFATTR:
+ sName = SW_RESSTR(STR_GETREFFLD);
+ nFlag = REF_SETREFATTR;
+ break;
+
+ case REF_SEQUENCEFLD:
+ sName = ((SwGetRefField*)GetCurField())->GetSetRefName();
+ nFlag = REFFLDFLAG;
+ break;
+ }
+
+ if (aTypeLB.GetEntryPos(sName) == LISTBOX_ENTRY_NOTFOUND) // Referenz zu gel?schter Marke
+ {
+ USHORT nPos = aTypeLB.InsertEntry(sName);
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nFlag));
+ }
+
+ aTypeLB.SelectEntry(sName);
+ SetTypeSel(aTypeLB.GetSelectEntryPos());
+ }
+ else
+ {
+ SetTypeSel(0);
+ aTypeLB.SelectEntryPos(0);
+ }
+ }
+
+ if (nOld != GetTypeSel())
+ {
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ // Auswahl-Listbox fuellen
+ UpdateSubType();
+
+ BOOL bName = FALSE; nFldDlgFmtSel = 0;
+
+ if ( ( !IsFldEdit() || aSelectionLB.GetEntryCount() ) &&
+ nOld != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aNameED.SetText(aEmptyStr);
+ aValueED.SetText(aEmptyStr);
+ }
+
+ switch (nTypeId)
+ {
+ case TYP_GETREFFLD:
+ if (REFFLDFLAG & (USHORT)(ULONG)aTypeLB.GetEntryData(nOld))
+ // dann bleibt die alte bestehen
+ nFldDlgFmtSel = aFormatLB.GetSelectEntryPos();
+ bName = TRUE;
+ break;
+
+ case TYP_SETREFFLD:
+ bName = TRUE;
+ break;
+
+ case REFFLDFLAG_BOOKMARK:
+ bName = TRUE;
+ // kein break!!!
+ default:
+ if( REFFLDFLAG & nTypeId )
+ {
+ USHORT nOldId = (USHORT)(ULONG)aTypeLB.GetEntryData(nOld);
+ if( nOldId & REFFLDFLAG || nOldId == TYP_GETREFFLD )
+ // dann bleibt die alte bestehen
+ nFldDlgFmtSel = aFormatLB.GetSelectEntryPos();
+ }
+ break;
+ }
+
+ aNameED.Enable(bName);
+ aNameFT.Enable(bName);
+
+ // Format-Listbox fuellen
+ USHORT nSize = FillFormatLB(nTypeId);
+ BOOL bFormat = nSize != 0;
+ aFormatLB.Enable(bFormat);
+ aFormatFT.Enable(bFormat);
+
+ SubTypeHdl();
+ ModifyHdl();
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldRefPage, SubTypeHdl, ListBox *, EMPTYARG )
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ switch(nTypeId)
+ {
+ case TYP_GETREFFLD:
+ if (!IsFldEdit() || aSelectionLB.GetSelectEntryCount())
+ {
+ aNameED.SetText(aSelectionLB.GetSelectEntry());
+ ModifyHdl(&aNameED);
+ }
+ break;
+
+ case TYP_SETREFFLD:
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ aValueED.SetText(pSh->GetSelTxt());
+ }
+
+ }
+ break;
+ // --> OD 2007-11-21 #i83479#
+ case REFFLDFLAG_HEADING:
+ case REFFLDFLAG_NUMITEM:
+ {
+ if ( aSelectionToolTipLB.GetCurEntry() )
+ {
+ aNameED.SetText( aSelectionToolTipLB.GetEntryText(
+ aSelectionToolTipLB.GetCurEntry() ) );
+ }
+ }
+ break;
+ // <--
+
+ default:
+ if (!IsFldEdit() || aSelectionLB.GetSelectEntryCount())
+ aNameED.SetText(aSelectionLB.GetSelectEntry());
+ break;
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Typen in SelectionLB erneuern
+ --------------------------------------------------------------------*/
+
+void SwFldRefPage::UpdateSubType()
+{
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ SwGetRefField* pRefFld = (SwGetRefField*)GetCurField();
+ const USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ String sOldSel;
+ // --> OD 2007-11-22 #i83479#
+ if ( aSelectionLB.IsVisible() )
+ {
+ const USHORT nSelectionSel = aSelectionLB.GetSelectEntryPos();
+ if (nSelectionSel != LISTBOX_ENTRY_NOTFOUND)
+ {
+ sOldSel = aSelectionLB.GetEntry(nSelectionSel);
+ }
+ }
+ // <--
+ if (IsFldEdit() && !sOldSel.Len())
+ sOldSel = String::CreateFromInt32( pRefFld->GetSeqNo() + 1 );
+
+ aSelectionLB.SetUpdateMode(FALSE);
+ aSelectionLB.Clear();
+ // --> OD 2007-11-21 #i83479#
+ aSelectionToolTipLB.SetUpdateMode(FALSE);
+ aSelectionToolTipLB.Clear();
+ bool bShowSelectionToolTipLB( false );
+ // <--
+
+ if( REFFLDFLAG & nTypeId )
+ {
+ if (nTypeId == REFFLDFLAG_BOOKMARK) // TextMarken!
+ {
+ aSelectionLB.SetStyle(aSelectionLB.GetStyle()|WB_SORT);
+ // alle Textmarken besorgen
+ IDocumentMarkAccess* const pMarkAccess = pSh->getIDocumentMarkAccess();
+ for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin();
+ ppMark != pMarkAccess->getBookmarksEnd();
+ ppMark++)
+ {
+ const ::sw::mark::IMark* pBkmk = ppMark->get();
+ if(IDocumentMarkAccess::BOOKMARK == IDocumentMarkAccess::GetType(*pBkmk))
+ aSelectionLB.InsertEntry( pBkmk->GetName() );
+ }
+ if (IsFldEdit())
+ sOldSel = pRefFld->GetSetRefName();
+ }
+ else if (nTypeId == REFFLDFLAG_FOOTNOTE)
+ {
+ aSelectionLB.SetStyle(aSelectionLB.GetStyle() & ~WB_SORT);
+ SwSeqFldList aArr;
+ USHORT nCnt = pSh->GetSeqFtnList( aArr );
+
+ for( USHORT n = 0; n < nCnt; ++n )
+ {
+ aSelectionLB.InsertEntry( aArr[ n ]->sDlgEntry );
+ if (IsFldEdit() && pRefFld->GetSeqNo() == aArr[ n ]->nSeqNo)
+ sOldSel = aArr[n]->sDlgEntry;
+ }
+ }
+ else if (nTypeId == REFFLDFLAG_ENDNOTE)
+ {
+ aSelectionLB.SetStyle(aSelectionLB.GetStyle() & ~WB_SORT);
+ SwSeqFldList aArr;
+ USHORT nCnt = pSh->GetSeqFtnList( aArr, true );
+
+ for( USHORT n = 0; n < nCnt; ++n )
+ {
+ aSelectionLB.InsertEntry( aArr[ n ]->sDlgEntry );
+ if (IsFldEdit() && pRefFld->GetSeqNo() == aArr[ n ]->nSeqNo)
+ sOldSel = aArr[n]->sDlgEntry;
+ }
+ }
+ // --> OD 2007-11-14 #i83479#
+ else if ( nTypeId == REFFLDFLAG_HEADING )
+ {
+ bShowSelectionToolTipLB = true;
+
+ const IDocumentOutlineNodes* pIDoc( pSh->getIDocumentOutlineNodesAccess() );
+ pIDoc->getOutlineNodes( maOutlineNodes );
+ bool bCertainTxtNodeSelected( false );
+ SvLBoxEntry* pEntry = 0;
+ sal_uInt16 nOutlIdx = 0;
+ for ( nOutlIdx = 0; nOutlIdx < maOutlineNodes.size(); ++nOutlIdx )
+ {
+ pEntry = aSelectionToolTipLB.InsertEntry(
+ pIDoc->getOutlineText( nOutlIdx, true, true ) );
+ pEntry->SetUserData( reinterpret_cast<void*>(nOutlIdx) );
+ if ( ( IsFldEdit() &&
+ pRefFld->GetReferencedTxtNode() == maOutlineNodes[nOutlIdx] ) ||
+ GetSavedSelectedTxtNode() == maOutlineNodes[nOutlIdx] )
+ {
+ aSelectionToolTipLB.Select( pEntry );
+ sOldSel.Erase();
+ bCertainTxtNodeSelected = true;
+ }
+ else if ( !bCertainTxtNodeSelected &&
+ GetSavedSelectedPos() == nOutlIdx )
+ {
+ aSelectionToolTipLB.Select( pEntry );
+ sOldSel.Erase();
+ }
+ }
+ }
+ else if ( nTypeId == REFFLDFLAG_NUMITEM )
+ {
+ bShowSelectionToolTipLB = true;
+
+ const IDocumentListItems* pIDoc( pSh->getIDocumentListItemsAccess() );
+ pIDoc->getNumItems( maNumItems );
+ bool bCertainTxtNodeSelected( false );
+ SvLBoxEntry* pEntry = 0;
+ sal_uInt16 nNumItemIdx = 0;
+ for ( nNumItemIdx = 0; nNumItemIdx < maNumItems.size(); ++nNumItemIdx )
+ {
+ pEntry = aSelectionToolTipLB.InsertEntry(
+ pIDoc->getListItemText( *maNumItems[nNumItemIdx], true, true ) );
+ pEntry->SetUserData( reinterpret_cast<void*>(nNumItemIdx) );
+ if ( ( IsFldEdit() &&
+ pRefFld->GetReferencedTxtNode() == maNumItems[nNumItemIdx]->GetTxtNode() ) ||
+ GetSavedSelectedTxtNode() == maNumItems[nNumItemIdx]->GetTxtNode() )
+ {
+ aSelectionToolTipLB.Select( pEntry );
+ sOldSel.Erase();
+ bCertainTxtNodeSelected = true;
+ }
+ else if ( !bCertainTxtNodeSelected &&
+ GetSavedSelectedPos() == nNumItemIdx )
+ {
+ aSelectionToolTipLB.Select( pEntry );
+ sOldSel.Erase();
+ }
+ }
+ }
+ // <--
+ else
+ {
+ aSelectionLB.SetStyle(aSelectionLB.GetStyle()|WB_SORT);
+ // zum Seq-FeldTyp die Felder besorgen:
+
+ SwSetExpFieldType* pType = (SwSetExpFieldType*)pSh->GetFldType(
+ nTypeId & ~REFFLDFLAG, RES_SETEXPFLD );
+ if( pType )
+ {
+ SwSeqFldList aArr;
+ // old selection should be kept in non-edit mode
+ if(IsFldEdit())
+ sOldSel.Erase();
+
+ USHORT nCnt = pType->GetSeqFldList( aArr );
+ for( USHORT n = 0; n < nCnt; ++n )
+ {
+ aSelectionLB.InsertEntry( aArr[ n ]->sDlgEntry );
+ if (IsFldEdit() && !sOldSel.Len() &&
+ aArr[ n ]->nSeqNo == pRefFld->GetSeqNo())
+ sOldSel = aArr[ n ]->sDlgEntry;
+ }
+
+ if (IsFldEdit() && !sOldSel.Len())
+ sOldSel = String::CreateFromInt32( pRefFld->GetSeqNo() + 1);
+ }
+ }
+ }
+ else
+ {
+ SvStringsDtor aLst;
+ GetFldMgr().GetSubTypes(nTypeId, aLst);
+ for (USHORT i = 0; i < aLst.Count(); ++i)
+ aSelectionLB.InsertEntry(*aLst[i]);
+
+ if (IsFldEdit())
+ sOldSel = pRefFld->GetSetRefName();
+ }
+
+ // --> OD 2007-11-21 #i83479#
+ aSelectionToolTipLB.Show( bShowSelectionToolTipLB );
+ aSelectionLB.Show( !bShowSelectionToolTipLB );
+ if ( bShowSelectionToolTipLB )
+ {
+ aSelectionToolTipLB.SetUpdateMode(TRUE);
+
+ BOOL bEnable = aSelectionToolTipLB.GetEntryCount() != 0;
+ aSelectionToolTipLB.Enable( bEnable );
+ aSelectionFT.Enable( bEnable );
+
+ if ( aSelectionToolTipLB.GetCurEntry() != 0 )
+ {
+ aSelectionToolTipLB.MakeVisible( aSelectionToolTipLB.GetCurEntry() );
+ }
+
+ if ( IsFldEdit() && aSelectionToolTipLB.GetCurEntry() == 0 )
+ {
+ aNameED.SetText(sOldSel);
+ }
+ }
+ else
+ {
+ aSelectionLB.SetUpdateMode(TRUE);
+
+ // Enable oder Disable
+ BOOL bEnable = aSelectionLB.GetEntryCount() != 0;
+ aSelectionLB.Enable( bEnable );
+ aSelectionFT.Enable( bEnable );
+
+ if ( bEnable )
+ {
+ aSelectionLB.SelectEntry(sOldSel);
+ if (!aSelectionLB.GetSelectEntryCount() && !IsFldEdit())
+ aSelectionLB.SelectEntryPos(0);
+ }
+
+ if (IsFldEdit() && !aSelectionLB.GetSelectEntryCount()) // Falls die Referenz schon geloescht wurde...
+ aNameED.SetText(sOldSel);
+ }
+ // <--
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldRefPage::FillFormatLB(USHORT nTypeId)
+{
+ String sOldSel;
+
+ USHORT nFormatSel = aFormatLB.GetSelectEntryPos();
+ if (nFormatSel != LISTBOX_ENTRY_NOTFOUND)
+ sOldSel = aFormatLB.GetEntry(nFormatSel);
+
+ // Format-Listbox fuellen
+ aFormatLB.Clear();
+
+ // Referenz hat weniger als die Beschriftung
+ USHORT nSize( 0 );
+ bool bAddCrossRefFormats( false );
+ switch (nTypeId)
+ {
+ // --> OD 2007-11-16 #i83479#
+ case REFFLDFLAG_HEADING:
+ case REFFLDFLAG_NUMITEM:
+ bAddCrossRefFormats = true;
+ // intentional no break here
+ // <--
+
+ case TYP_GETREFFLD:
+ case REFFLDFLAG_BOOKMARK:
+ case REFFLDFLAG_FOOTNOTE:
+ case REFFLDFLAG_ENDNOTE:
+ nSize = FMT_REF_PAGE_PGDSC - FMT_REF_BEGIN + 1;
+ break;
+
+ default:
+ // --> OD 2007-11-16 #i83479#
+// nSize = GetFldMgr().GetFormatCount( (REFFLDFLAG & nTypeId)
+// ? (USHORT)TYP_GETREFFLD : nTypeId,
+// FALSE, IsFldDlgHtmlMode() );
+ if ( REFFLDFLAG & nTypeId )
+ {
+ nSize = FMT_REF_ONLYSEQNO - FMT_REF_BEGIN + 1;
+ }
+ else
+ {
+ nSize = GetFldMgr().GetFormatCount( nTypeId, FALSE, IsFldDlgHtmlMode() );
+ }
+ break;
+ }
+
+ if (REFFLDFLAG & nTypeId)
+ nTypeId = TYP_GETREFFLD;
+
+ for (USHORT i = 0; i < nSize; i++)
+ {
+ USHORT nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr( nTypeId, i ));
+ aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>(GetFldMgr().GetFormatId( nTypeId, i )));
+ }
+ // --> OD 2007-11-16 #i83479#
+ if ( bAddCrossRefFormats )
+ {
+ USHORT nFormat = FMT_REF_NUMBER - FMT_REF_BEGIN;
+ USHORT nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr( nTypeId, nFormat ));
+ aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>(GetFldMgr().GetFormatId( nTypeId, nFormat )));
+ nFormat = FMT_REF_NUMBER_NO_CONTEXT - FMT_REF_BEGIN;
+ nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr( nTypeId, nFormat ));
+ aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>(GetFldMgr().GetFormatId( nTypeId, nFormat )));
+ nFormat = FMT_REF_NUMBER_FULL_CONTEXT - FMT_REF_BEGIN;
+ nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr( nTypeId, nFormat ));
+ aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>(GetFldMgr().GetFormatId( nTypeId, nFormat )));
+ nSize += 3;
+ }
+ // <--
+
+ // select a certain entry
+ if (nSize)
+ {
+ if (!IsFldEdit())
+ aFormatLB.SelectEntry(sOldSel);
+ else
+ aFormatLB.SelectEntry(SW_RESSTR(FMT_REF_BEGIN + (USHORT)GetCurField()->GetFormat()));
+
+ if (!aFormatLB.GetSelectEntryCount())
+ {
+ aFormatLB.SelectEntryPos(nFldDlgFmtSel);
+ if (!aFormatLB.GetSelectEntryCount())
+ aFormatLB.SelectEntryPos(0);
+ }
+ }
+
+ return nSize;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Modify
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldRefPage, ModifyHdl, Edit *, EMPTYARG )
+{
+ String aName(aNameED.GetText());
+ const USHORT nLen = aName.Len();
+
+ BOOL bEnable = TRUE;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ if ((nTypeId == TYP_SETREFFLD && !GetFldMgr().CanInsertRefMark(aName)) ||
+ (nLen == 0 && (nTypeId == TYP_GETREFFLD || nTypeId == TYP_SETREFFLD ||
+ nTypeId == REFFLDFLAG_BOOKMARK)))
+ bEnable = FALSE;
+
+ EnableInsert(bEnable);
+
+ aSelectionLB.SelectEntry(aName);
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL SwFldRefPage::FillItemSet(SfxItemSet& )
+{
+ BOOL bModified = FALSE;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ USHORT nSubType = 0;
+ ULONG nFormat;
+
+ nFormat = aFormatLB.GetSelectEntryPos();
+
+ if(nFormat == LISTBOX_ENTRY_NOTFOUND)
+ nFormat = 0;
+ else
+ nFormat = (ULONG)aFormatLB.GetEntryData((USHORT)nFormat);
+
+ String aVal(aValueED.GetText());
+ String aName(aNameED.GetText());
+
+ switch(nTypeId)
+ {
+ case TYP_GETREFFLD:
+ // aName = aSelectionLB.GetSelectEntry();
+ nSubType = REF_SETREFATTR;
+ break;
+
+ case TYP_SETREFFLD:
+ {
+ SwFieldType* pType = GetFldMgr().GetFldType(RES_SETEXPFLD, aName);
+
+ if(!pType) // Nur einfuegen, wenn es den Namen noch nicht gibt
+ {
+ aSelectionLB.InsertEntry(aName);
+ aSelectionLB.Enable();
+ aSelectionFT.Enable();
+ }
+ break;
+ }
+ }
+
+ SwGetRefField* pRefFld = (SwGetRefField*)GetCurField();
+
+ if (REFFLDFLAG & nTypeId)
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ {
+ pSh = ::GetActiveWrtShell();
+ }
+ if (nTypeId == REFFLDFLAG_BOOKMARK) // TextMarken!
+ {
+ aName = aNameED.GetText();
+ nTypeId = TYP_GETREFFLD;
+ nSubType = REF_BOOKMARK;
+ }
+ else if (REFFLDFLAG_FOOTNOTE == nTypeId) // Fussnoten
+ {
+ SwSeqFldList aArr;
+ _SeqFldLstElem aElem( aSelectionLB.GetSelectEntry(), 0 );
+
+ USHORT nPos;
+
+ nTypeId = TYP_GETREFFLD;
+ nSubType = REF_FOOTNOTE;
+ aName.Erase();
+
+ if (pSh->GetSeqFtnList(aArr) && aArr.SeekEntry(aElem, &nPos))
+ {
+ aVal = String::CreateFromInt32( aArr[nPos]->nSeqNo );
+
+ if (IsFldEdit() && aArr[nPos]->nSeqNo == pRefFld->GetSeqNo())
+ bModified = TRUE; // Kann bei Feldern passieren, deren Referenz geloescht wurde
+ }
+ else if (IsFldEdit())
+ aVal = String::CreateFromInt32( pRefFld->GetSeqNo() );
+ }
+ else if (REFFLDFLAG_ENDNOTE == nTypeId) // Endnoten
+ {
+ SwSeqFldList aArr;
+ _SeqFldLstElem aElem( aSelectionLB.GetSelectEntry(), 0 );
+
+ USHORT nPos;
+
+ nTypeId = TYP_GETREFFLD;
+ nSubType = REF_ENDNOTE;
+ aName.Erase();
+
+ if (pSh->GetSeqFtnList(aArr, true) && aArr.SeekEntry(aElem, &nPos))
+ {
+ aVal = String::CreateFromInt32( aArr[nPos]->nSeqNo );
+
+ if (IsFldEdit() && aArr[nPos]->nSeqNo == pRefFld->GetSeqNo())
+ bModified = TRUE; // Kann bei Feldern passieren, deren Referenz geloescht wurde
+ }
+ else if (IsFldEdit())
+ aVal = String::CreateFromInt32( pRefFld->GetSeqNo() );
+ }
+ // --> OD 2007-11-16 #i83479#
+ else if ( nTypeId == REFFLDFLAG_HEADING )
+ {
+ SvLBoxEntry* pEntry = aSelectionToolTipLB.GetCurEntry();
+ ASSERT( pEntry,
+ "<SwFldRefPage::FillItemSet(..)> - no entry selected in selection tool tip listbox!" );
+ if ( pEntry )
+ {
+ const sal_uInt16 nOutlIdx( static_cast<sal_uInt16>(reinterpret_cast<ULONG>(pEntry->GetUserData())) );
+ pSh->getIDocumentOutlineNodesAccess()->getOutlineNodes( maOutlineNodes );
+ if ( nOutlIdx < maOutlineNodes.size() )
+ {
+ ::sw::mark::IMark const * const pMark = pSh->getIDocumentMarkAccess()->getMarkForTxtNode(
+ *(maOutlineNodes[nOutlIdx]),
+ IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK);
+ aName = pMark->GetName();
+ nTypeId = TYP_GETREFFLD;
+ nSubType = REF_BOOKMARK;
+ }
+ }
+ }
+ else if ( nTypeId == REFFLDFLAG_NUMITEM )
+ {
+ SvLBoxEntry* pEntry = aSelectionToolTipLB.GetCurEntry();
+ ASSERT( pEntry,
+ "<SwFldRefPage::FillItemSet(..)> - no entry selected in selection tool tip listbox!" );
+ if ( pEntry )
+ {
+ const sal_uInt16 nNumItemIdx( static_cast<sal_uInt16>(reinterpret_cast<ULONG>(pEntry->GetUserData())) );
+ pSh->getIDocumentListItemsAccess()->getNumItems( maNumItems );
+ if ( nNumItemIdx < maNumItems.size() )
+ {
+ ::sw::mark::IMark const * const pMark = pSh->getIDocumentMarkAccess()->getMarkForTxtNode(
+ *(maNumItems[nNumItemIdx]->GetTxtNode()),
+ IDocumentMarkAccess::CROSSREF_NUMITEM_BOOKMARK);
+ aName = pMark->GetName();
+ nTypeId = TYP_GETREFFLD;
+ nSubType = REF_BOOKMARK;
+ }
+ }
+ }
+ // <--
+ else // SeqenceFelder
+ {
+ // zum Seq-FeldTyp die Felder besorgen:
+ SwSetExpFieldType* pType = (SwSetExpFieldType*)pSh->GetFldType(
+ nTypeId & ~REFFLDFLAG, RES_SETEXPFLD );
+ if( pType )
+ {
+ SwSeqFldList aArr;
+ _SeqFldLstElem aElem( aSelectionLB.GetSelectEntry(), 0 );
+
+ USHORT nPos;
+
+ nTypeId = TYP_GETREFFLD;
+ nSubType = REF_SEQUENCEFLD;
+ aName = pType->GetName();
+
+ if (pType->GetSeqFldList(aArr) && aArr.SeekEntry(aElem, &nPos))
+ {
+ aVal = String::CreateFromInt32( aArr[nPos]->nSeqNo );
+
+ if (IsFldEdit() && aArr[nPos]->nSeqNo == pRefFld->GetSeqNo())
+ bModified = TRUE; // Kann bei Feldern passieren, deren Referenz geloescht wurde
+ }
+ else if (IsFldEdit())
+ aVal = String::CreateFromInt32( pRefFld->GetSeqNo() );
+ }
+ }
+ }
+
+ if (IsFldEdit() && nTypeId == TYP_GETREFFLD)
+ {
+ aVal.Insert('|', 0);
+ aVal.Insert(String::CreateFromInt32(nSubType), 0);
+ }
+
+ if (!IsFldEdit() || bModified ||
+ aNameED.GetSavedValue() != aNameED.GetText() ||
+ aValueED.GetSavedValue() != aValueED.GetText() ||
+ aTypeLB.GetSavedValue() != aTypeLB.GetSelectEntryPos() ||
+ aSelectionLB.GetSavedValue() != aSelectionLB.GetSelectEntryPos() ||
+ aFormatLB.GetSavedValue() != aFormatLB.GetSelectEntryPos())
+ {
+ InsertFld( nTypeId, nSubType, aName, aVal, nFormat );
+ }
+
+ ModifyHdl(); // Insert ggf enablen/disablen
+
+ return FALSE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* SwFldRefPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwFldRefPage( pParent, rAttrSet ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldRefPage::GetGroup()
+{
+ return GRP_REF;
+}
+
+/* -----------------12.01.99 10:09-------------------
+ *
+ * --------------------------------------------------*/
+void SwFldRefPage::FillUserData()
+{
+ String sData( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( USER_DATA_VERSION )));
+ sData += ';';
+ USHORT nTypeSel = aTypeLB.GetSelectEntryPos();
+ if( LISTBOX_ENTRY_NOTFOUND == nTypeSel )
+ nTypeSel = USHRT_MAX;
+ else
+ nTypeSel = sal::static_int_cast< USHORT >(reinterpret_cast< sal_uIntPtr >(aTypeLB.GetEntryData( nTypeSel )));
+ sData += String::CreateFromInt32( nTypeSel );
+ SetUserData(sData);
+}
+
diff --git a/sw/source/ui/fldui/fldref.hxx b/sw/source/ui/fldui/fldref.hxx
new file mode 100644
index 000000000000..0facb24bf823
--- /dev/null
+++ b/sw/source/ui/fldui/fldref.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWFLDREF_HXX
+#define _SWFLDREF_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/group.hxx>
+#include <vcl/edit.hxx>
+
+#include "fldpage.hxx"
+// --> OD 2007-11-15 #i83479#
+#include <IDocumentOutlineNodes.hxx>
+#include <IDocumentListItems.hxx>
+#include <FldRefTreeListBox.hxx>
+class SwTxtNode;
+// <--
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwFldRefPage : public SwFldPage
+{
+ FixedText aTypeFT;
+ ListBox aTypeLB;
+ FixedText aSelectionFT;
+ ListBox aSelectionLB;
+ // --> OD 2007-11-21 #i83479#
+ SwFldRefTreeListBox aSelectionToolTipLB;
+ // <--
+ FixedText aFormatFT;
+ ListBox aFormatLB;
+ FixedText aNameFT;
+ Edit aNameED;
+ FixedText aValueFT;
+ Edit aValueED;
+ const String sBookmarkTxt;
+ const String sFootnoteTxt;
+ const String sEndnoteTxt;
+ // --> OD 2007-11-09 #i83479#
+ const String sHeadingTxt;
+ const String sNumItemTxt;
+
+ IDocumentOutlineNodes::tSortedOutlineNodeList maOutlineNodes;
+ IDocumentListItems::tSortedNodeNumList maNumItems;
+
+ // selected text node in the listbox for headings and numbered items
+ // in order to restore selection after update of selection listbox
+ const SwTxtNode* mpSavedSelectedTxtNode;
+ // fallback, if previously selected text node doesn't exist anymore
+ sal_uInt16 mnSavedSelectedPos;
+ // <--
+
+ DECL_LINK( TypeHdl, ListBox* pLB = 0 );
+ DECL_LINK( SubTypeHdl, ListBox* pLB = 0 );
+ DECL_LINK( ModifyHdl, Edit *pEd = 0 );
+
+ void UpdateSubType();
+ USHORT FillFormatLB(USHORT nTypeId);
+
+ // --> OD 2007-12-05 #i83479#
+ void SaveSelectedTxtNode();
+ const SwTxtNode* GetSavedSelectedTxtNode() const;
+ sal_uInt16 GetSavedSelectedPos() const;
+ // <--
+
+protected:
+ virtual USHORT GetGroup();
+
+public:
+ SwFldRefPage(Window* pParent, const SfxItemSet& rSet);
+
+ ~SwFldRefPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual void FillUserData();
+};
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/fldref.src b/sw/source/ui/fldui/fldref.src
new file mode 100644
index 000000000000..5a589e276592
--- /dev/null
+++ b/sw/source/ui/fldui/fldref.src
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "fldtdlg.hrc"
+#include "helpid.h"
+TabPage TP_FLD_REF
+{
+ HelpID = HID_FLD_REF ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_REFTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Type" ;
+ Left = TRUE ;
+ };
+ ListBox LB_REFTYPE
+ {
+ HelpID = "sw:ListBox:TP_FLD_REF:LB_REFTYPE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 165 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_REFSELECTION
+ {
+ Pos = MAP_APPFONT ( 88 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "S~election" ;
+ Left = TRUE ;
+ };
+ ListBox LB_REFSELECTION
+ {
+ HelpID = "sw:ListBox:TP_FLD_REF:LB_REFSELECTION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 14 ) ;
+ Size = MAP_APPFONT ( 166 , 73 ) ;
+ TabStop = TRUE ;
+ Sort = TRUE ;
+ };
+ /* TreeListBox in order to have tool tips - shares window position and size with LB_REFSELECTION */
+ Control LB_REFSELECTION_TOOLTIP
+ {
+ HelpID = HID_REFSELECTION_TOOLTIP ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 14 ) ;
+ Size = MAP_APPFONT ( 166 , 73 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_REFFORMAT
+ {
+ Pos = MAP_APPFONT ( 88 , 93 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Insert ~reference to" ;
+ };
+ ListBox LB_REFFORMAT
+ {
+ HelpID = "sw:ListBox:TP_FLD_REF:LB_REFFORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 104 ) ;
+ Size = MAP_APPFONT ( 76 , 75 ) ;
+ TabStop = TRUE ;
+ DropDown = FALSE ;
+ // Sort = TRUE;
+ };
+ FixedText FT_REFNAME
+ {
+ Pos = MAP_APPFONT ( 170 , 93 ) ;
+ Size = MAP_APPFONT ( 84 , 10 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Na~me" ;
+ };
+ Edit ED_REFNAME
+ {
+ HelpID = "sw:Edit:TP_FLD_REF:ED_REFNAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 104 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_REFVALUE
+ {
+ Pos = MAP_APPFONT ( 170 , 122 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Text [ en-US ] = "~Value" ;
+ Disable = TRUE ;
+ Left = TRUE ;
+ };
+ Edit ED_REFVALUE
+ {
+ HelpID = "sw:Edit:TP_FLD_REF:ED_REFVALUE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 136 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ Left = TRUE ;
+ };
+ String STR_REFBOOKMARK
+ {
+ Text [ en-US ] = "Bookmarks" ;
+ };
+ String STR_REFFOOTNOTE
+ {
+ Text [ en-US ] = "Footnotes" ;
+ };
+ String STR_REFENDNOTE
+ {
+ Text [ en-US ] = "Endnotes" ;
+ };
+ String STR_REFHEADING
+ {
+ Text [ en-US ] = "Headings" ;
+ };
+ String STR_REFNUMITEM
+ {
+ Text [ en-US ] = "Numbered Paragraphs" ;
+ };
+ Text [ en-US ] = "Cross-references" ;
+};
diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx
new file mode 100644
index 000000000000..308bc379d4f4
--- /dev/null
+++ b/sw/source/ui/fldui/fldtdlg.cxx
@@ -0,0 +1,386 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <swtypes.hxx>
+#include <unotools/confignode.hxx>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/htmlmode.hxx>
+#include <viewopt.hxx>
+#include <docsh.hxx>
+#include <fldwrap.hxx>
+#include <flddb.hxx>
+#include <flddinf.hxx>
+#include <fldvar.hxx>
+#include <flddok.hxx>
+#include <fldfunc.hxx>
+#include <fldref.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <fldtdlg.hxx>
+#include <swmodule.hxx>
+
+#include <helpid.h>
+#include <fldui.hrc>
+#include <globals.hrc>
+#include <fldtdlg.hrc>
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Der Traeger des Dialoges
+ --------------------------------------------------------------------*/
+
+
+SwFldDlg::SwFldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent)
+ : SfxTabDialog( pParent, SW_RES( DLG_FLD_INSERT )),
+ m_pChildWin(pCW),
+ m_pBindings(pB),
+ m_bDataBaseMode(FALSE)
+{
+ SetStyle(GetStyle()|WB_STDMODELESS);
+ m_bHtmlMode = (::GetHtmlMode((SwDocShell*)SfxObjectShell::Current()) & HTMLMODE_ON) != 0;
+
+ RemoveResetButton();
+
+ GetOKButton().SetText(String(SW_RES(STR_FLD_INSERT)));
+ GetOKButton().SetHelpId(HID_FIELD_INSERT);
+ GetOKButton().SetHelpText(aEmptyStr); // Damit generierter Hilfetext verwendet wird
+
+ GetCancelButton().SetText(String(SW_RES(STR_FLD_CLOSE)));
+ GetCancelButton().SetHelpId(HID_FIELD_CLOSE);
+ GetCancelButton().SetHelpText(aEmptyStr); // Damit generierter Hilfetext verwendet wird
+
+ FreeResource();
+
+ GetOKButton().SetClickHdl(LINK(this, SwFldDlg, OKHdl));
+
+ AddTabPage(TP_FLD_DOK, SwFldDokPage::Create, 0);
+ AddTabPage(TP_FLD_VAR, SwFldVarPage::Create, 0);
+ AddTabPage(TP_FLD_DOKINF, SwFldDokInfPage::Create, 0);
+
+ if (!m_bHtmlMode)
+ {
+ AddTabPage(TP_FLD_REF, SwFldRefPage::Create, 0);
+ AddTabPage(TP_FLD_FUNC, SwFldFuncPage::Create, 0);
+
+ utl::OConfigurationTreeRoot aCfgRoot
+ = utl::OConfigurationTreeRoot::createWithServiceFactory(
+ ::comphelper::getProcessServiceFactory(),
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/org.openoffice.Office.DataAccess/Policies/Features/Writer" ) ),
+ -1,
+ utl::OConfigurationTreeRoot::CM_READONLY);
+
+ sal_Bool bDatabaseFields = sal_True;
+ aCfgRoot.getNodeValue(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DatabaseFields"))) >>= bDatabaseFields;
+
+ if (bDatabaseFields)
+ AddTabPage(TP_FLD_DB, SwFldDBPage::Create, 0);
+ else
+ RemoveTabPage(TP_FLD_DB);
+ }
+ else
+ {
+ RemoveTabPage(TP_FLD_REF);
+ RemoveTabPage(TP_FLD_FUNC);
+ RemoveTabPage(TP_FLD_DB);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldDlg::~SwFldDlg()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL SwFldDlg::Close()
+{
+ m_pBindings->GetDispatcher()->
+ Execute(m_bDataBaseMode ? FN_INSERT_FIELD_DATA_ONLY : FN_INSERT_FIELD,
+ SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD);
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldDlg::Initialize(SfxChildWinInfo *pInfo)
+{
+ Point aPos;
+ Size aSize;
+
+ if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 )
+ {
+ aPos = pInfo->aPos;
+ if ( GetStyle() & WB_SIZEABLE )
+ SetSizePixel( pInfo->aSize );
+
+ // Initiale Gr"o\se aus pInfo merken
+ aSize = GetSizePixel();
+
+ // Soll das FloatingWindow eingezoomt werden ?
+ if ( pInfo->nFlags & SFX_CHILDWIN_ZOOMIN )
+ RollUp();
+ }
+ else
+ {
+ // Initiale Gr"o\se aus Resource oder ctor merken
+ aSize = GetSizePixel();
+
+ Size aParentSize = GetParent()->GetOutputSizePixel();
+ aPos.X() += ( aParentSize.Width() - aSize.Width() ) / 2;
+ aPos.Y() += ( aParentSize.Height() - aSize.Height() ) / 2;
+ }
+
+ Point aPoint;
+ Rectangle aRect = GetDesktopRectPixel();
+ aPoint.X() = aRect.Right() - aSize.Width();
+ aPoint.Y() = aRect.Bottom() - aSize.Height();
+
+ aPoint = OutputToScreenPixel( aPoint );
+
+ if ( aPos.X() > aPoint.X() )
+ aPos.X() = aPoint.X() ;
+ if ( aPos.Y() > aPoint.Y() )
+ aPos.Y() = aPoint.Y();
+
+ if ( aPos.X() < 0 ) aPos.X() = 0;
+ if ( aPos.Y() < 0 ) aPos.Y() = 0;
+
+ SetPosPixel( aPos );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxItemSet* SwFldDlg::CreateInputItemSet( USHORT nID )
+{
+ if ( nID == TP_FLD_DOKINF )
+ {
+ SwDocShell* pDocSh = (SwDocShell*)SfxObjectShell::Current();
+ SfxItemSet* pISet = new SfxItemSet( pDocSh->GetPool(), SID_DOCINFO, SID_DOCINFO );
+ using namespace ::com::sun::star;
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ pDocSh->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps
+ = xDPS->getDocumentProperties();
+ uno::Reference< beans::XPropertySet > xUDProps(
+ xDocProps->getUserDefinedProperties(),
+ uno::UNO_QUERY_THROW);
+ pISet->Put( SfxUnoAnyItem( SID_DOCINFO, uno::makeAny(xUDProps) ) );
+ return pISet;
+ }
+ else
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Einfuegen von neuen Feldern anstossen
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldDlg, OKHdl, Button *, EMPTYARG )
+{
+ if (GetOKButton().IsEnabled())
+ {
+ SfxTabPage* pPage = GetTabPage(GetCurPageId());
+ pPage->FillItemSet(*(SfxItemSet*)0);
+
+ GetOKButton().GrabFocus(); // Wegen InputField-Dlg
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nach Dok-Wechsel Dialog neu initialisieren
+ --------------------------------------------------------------------*/
+
+void SwFldDlg::ReInitDlg()
+{
+ SwDocShell* pDocSh = (SwDocShell*)SfxObjectShell::Current();
+ BOOL bNewMode = (::GetHtmlMode(pDocSh) & HTMLMODE_ON) != 0;
+
+ if (bNewMode != m_bHtmlMode)
+ {
+ SfxViewFrame::Current()->GetDispatcher()->
+ Execute(FN_INSERT_FIELD, SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD);
+ Close();
+ }
+
+ SwView* pActiveView = ::GetActiveView();
+ if(!pActiveView)
+ return;
+ const SwWrtShell& rSh = pActiveView->GetWrtShell();
+ GetOKButton().Enable( !rSh.IsReadOnlyAvailable() ||
+ !rSh.HasReadonlySel() );
+
+ ReInitTabPage(TP_FLD_DOK);
+ ReInitTabPage(TP_FLD_VAR);
+ ReInitTabPage(TP_FLD_DOKINF);
+
+ if (!m_bHtmlMode)
+ {
+ ReInitTabPage(TP_FLD_REF);
+ ReInitTabPage(TP_FLD_FUNC);
+ ReInitTabPage(TP_FLD_DB);
+ }
+
+ m_pChildWin->SetOldDocShell(pDocSh);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nach Dok-Wechsel TabPage neu initialisieren
+ --------------------------------------------------------------------*/
+
+void SwFldDlg::ReInitTabPage( USHORT nPageId, BOOL bOnlyActivate )
+{
+ SwFldPage* pPage = (SwFldPage* )GetTabPage(nPageId);
+
+ if ( pPage )
+ pPage->EditNewField( bOnlyActivate ); // TabPage neu initialisieren
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nach Aktivierung einige TabPages neu initialisieren
+ --------------------------------------------------------------------*/
+
+void SwFldDlg::Activate()
+{
+ SwView* pView = ::GetActiveView();
+ if( pView )
+ {
+ BOOL bHtmlMode = (::GetHtmlMode((SwDocShell*)SfxObjectShell::Current()) & HTMLMODE_ON) != 0;
+ const SwWrtShell& rSh = pView->GetWrtShell();
+ GetOKButton().Enable( !rSh.IsReadOnlyAvailable() ||
+ !rSh.HasReadonlySel() );
+
+ ReInitTabPage( TP_FLD_VAR, TRUE );
+
+ if( !bHtmlMode )
+ {
+ ReInitTabPage( TP_FLD_REF, TRUE );
+ ReInitTabPage( TP_FLD_FUNC, TRUE );
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldDlg::EnableInsert(BOOL bEnable)
+{
+ if( bEnable )
+ {
+ SwView* pView = ::GetActiveView();
+ DBG_ASSERT(pView, "no view found");
+ if( !pView ||
+ (pView->GetWrtShell().IsReadOnlyAvailable() &&
+ pView->GetWrtShell().HasReadonlySel()) )
+ bEnable = FALSE;
+ }
+ GetOKButton().Enable(bEnable);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldDlg::InsertHdl()
+{
+ GetOKButton().Click();
+}
+/* -----------------27.11.2002 15:24-----------------
+ *
+ * --------------------------------------------------*/
+void SwFldDlg::ActivateDatabasePage()
+{
+ m_bDataBaseMode = TRUE;
+ ShowPage( TP_FLD_DB );
+ SfxTabPage* pDBPage = GetTabPage( TP_FLD_DB );
+ if( pDBPage )
+ {
+ ((SwFldDBPage*)pDBPage)->ActivateMailMergeAddress();
+ }
+ //remove all other pages
+ RemoveTabPage(TP_FLD_DOK);
+ RemoveTabPage(TP_FLD_VAR);
+ RemoveTabPage(TP_FLD_DOKINF);
+ RemoveTabPage(TP_FLD_REF);
+ RemoveTabPage(TP_FLD_FUNC);
+}
+/*-- 07.10.2003 14:01:44---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwFldDlg::PageCreated(USHORT nId, SfxTabPage& rPage)
+{
+ if( TP_FLD_DB == nId)
+ {
+ SfxDispatcher* pDispatch = m_pBindings->GetDispatcher();
+ SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : 0;
+ if(pViewFrame)
+ {
+ const TypeId aSwViewTypeId = TYPE(SwView);
+ SfxViewShell* pViewShell = SfxViewShell::GetFirst( &aSwViewTypeId );
+ while(pViewShell && pViewShell->GetViewFrame() != pViewFrame)
+ {
+ pViewShell = SfxViewShell::GetNext( *pViewShell, &aSwViewTypeId );
+ }
+ if(pViewShell)
+ static_cast<SwFldDBPage&>(rPage).SetWrtShell(static_cast<SwView*>(pViewShell)->GetWrtShell());
+ }
+ }
+}
+
+
diff --git a/sw/source/ui/fldui/fldtdlg.hrc b/sw/source/ui/fldui/fldtdlg.hrc
new file mode 100644
index 000000000000..221b943779c0
--- /dev/null
+++ b/sw/source/ui/fldui/fldtdlg.hrc
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _FLDTDLG_HRC
+#define _FLDTDLG_HRC
+
+// #include -----------------------------------------------------------------
+
+// #define ------------------------------------------------------------------
+
+#define RC_FLDTDLG_BEGIN 0
+
+// Datenbankfeld-TabPage:
+#define RC_TP_DB_START (RC_FLDTDLG_BEGIN)
+#define FT_DBTYPE (RC_TP_DB_START + 1)
+#define LB_DBTYPE (RC_TP_DB_START + 2)
+#define FL_DBFORMAT (RC_TP_DB_START + 3)
+#define FT_DBSELECTION (RC_TP_DB_START + 4)
+#define TLB_DBLIST (RC_TP_DB_START + 5)
+#define FT_DBCONDITION (RC_TP_DB_START + 6)
+#define FT_DBSETNUMBER (RC_TP_DB_START + 7)
+#define ED_DBCONDITION (RC_TP_DB_START + 8)
+#define ED_DBSETNUMBER (RC_TP_DB_START + 9)
+#define LB_DBFORMAT (RC_TP_DB_START + 10)
+#define LB_DBNUMFORMAT (RC_TP_DB_START + 11)
+#define RB_DBFORMAT (RC_TP_DB_START + 12)
+#define RB_DBOWNFORMAT (RC_TP_DB_START + 13)
+#define RC_TP_DB_END (RC_TP_DB_START + 14)
+#define FL_DBFORMAT_VERT (RC_TP_DB_START + 15)
+#define FT_ADDDB (RC_TP_DB_START + 16)
+#define PB_ADDDB (RC_TP_DB_START + 17)
+
+// Dokumentinfo-TabPage:
+#define RC_TP_DOCINF_START (RC_TP_DB_END)
+#define FT_DOKINFTYPE (RC_TP_DOCINF_START + 1)
+#define TLB_DOKINFTYPE (RC_TP_DOCINF_START + 2)
+#define FT_DOKINFSELECTION (RC_TP_DOCINF_START + 3)
+#define LB_DOKINFSELECTION (RC_TP_DOCINF_START + 4)
+#define FT_DOKINFFORMAT (RC_TP_DOCINF_START + 5)
+#define LB_DOKINFFORMAT (RC_TP_DOCINF_START + 6)
+#define CB_DOKINFFIXEDCONTENT (RC_TP_DOCINF_START + 7)
+#define BMP_DOKINFROOT_OPENED (RC_TP_DOCINF_START + 8)
+#define BMP_DOKINFROOT_CLOSED (RC_TP_DOCINF_START + 9)
+#define STR_DOKINF_INFO (RC_TP_DOCINF_START + 10)
+#define RC_TP_DOCINF_END (RC_TP_DOCINF_START + 11)
+
+// Variablen-TabPage:
+#define RC_TP_VAR_START (RC_TP_DOCINF_END)
+#define FT_VARTYPE (RC_TP_VAR_START + 1)
+#define LB_VARTYPE (RC_TP_VAR_START + 2)
+#define FT_VARSELECTION (RC_TP_VAR_START + 3)
+#define LB_VARSELECTION (RC_TP_VAR_START + 4)
+#define FT_VARNAME (RC_TP_VAR_START + 5)
+#define ED_VARNAME (RC_TP_VAR_START + 6)
+#define FT_VARVALUE (RC_TP_VAR_START + 7)
+#define ED_VARVALUE (RC_TP_VAR_START + 8)
+#define FT_VARFORMAT (RC_TP_VAR_START + 9)
+#define LB_VARNUMFORMAT (RC_TP_VAR_START + 10)
+#define LB_VARFORMAT (RC_TP_VAR_START + 11)
+#define FT_VARCHAPTERHEADER (RC_TP_VAR_START + 12)
+#define FT_VARCHAPTERLEVEL (RC_TP_VAR_START + 13)
+#define LB_VARCHAPTERLEVEL (RC_TP_VAR_START + 14)
+#define CB_VARINVISIBLE (RC_TP_VAR_START + 15)
+#define FT_VARSEPARATOR (RC_TP_VAR_START + 16)
+#define ED_VARSEPARATOR (RC_TP_VAR_START + 17)
+#define TBX_VARNEWDEL (RC_TP_VAR_START + 18)
+#define BT_VARAPPLY (RC_TP_VAR_START + 19)
+#define BT_VARDELETE (RC_TP_VAR_START + 20)
+#define RC_TP_VAR_END (RC_TP_VAR_START + 21)
+
+// Dokument-TabPage:
+#define RC_TP_DOC_START (RC_TP_VAR_END)
+#define FT_DOKTYPE (RC_TP_DOC_START + 1)
+#define LB_DOKTYPE (RC_TP_DOC_START + 2)
+#define FT_DOKSELECTION (RC_TP_DOC_START + 3)
+#define LB_DOKSELECTION (RC_TP_DOC_START + 4)
+#define LB_DOKNUMFORMAT (RC_TP_DOC_START + 5)
+#define LB_DOKFORMAT (RC_TP_DOC_START + 6)
+#define FT_DOKFORMAT (RC_TP_DOC_START + 7)
+#define FT_DOKVALUE (RC_TP_DOC_START + 8)
+#define ED_DOKVALUE (RC_TP_DOC_START + 9)
+#define ED_DOKLEVEL (RC_TP_DOC_START + 10)
+#define ED_DOKDATEOFF (RC_TP_DOC_START + 11)
+#define CB_DOKFIXEDCONTENT (RC_TP_DOC_START + 12)
+#define STR_DOKDATEOFF (RC_TP_DOC_START + 13)
+#define STR_DOKTIMEOFF (RC_TP_DOC_START + 14)
+#define BMP_DOKROOT_OPENED (RC_TP_DOC_START + 15)
+#define BMP_DOKROOT_CLOSED (RC_TP_DOC_START + 16)
+#define RC_TP_DOC_END (RC_TP_DOC_START + 17)
+
+// Funktion-TabPage:
+#define RC_TP_FUNC_START (RC_TP_DOC_END)
+#define FT_FUNCTYPE (RC_TP_FUNC_START + 1)
+#define LB_FUNCTYPE (RC_TP_FUNC_START + 2)
+#define LB_FUNCSELECTION (RC_TP_FUNC_START + 3)
+#define FT_FUNCSELECTION (RC_TP_FUNC_START + 4)
+#define FT_FUNCFORMAT (RC_TP_FUNC_START + 5)
+#define LB_FUNCFORMAT (RC_TP_FUNC_START + 6)
+#define FT_FUNCNAME (RC_TP_FUNC_START + 7)
+#define ED_FUNCNAME (RC_TP_FUNC_START + 8)
+#define FT_FUNCVALUE (RC_TP_FUNC_START + 9)
+#define ED_FUNCVALUE (RC_TP_FUNC_START + 10)
+#define FT_FUNCCOND1 (RC_TP_FUNC_START + 11)
+#define ED_FUNCCOND1 (RC_TP_FUNC_START + 12)
+#define FT_FUNCCOND2 (RC_TP_FUNC_START + 13)
+#define ED_FUNCCOND2 (RC_TP_FUNC_START + 14)
+#define BT_FUNCMACRO (RC_TP_FUNC_START + 15)
+#define RC_TP_FUNC_END (RC_TP_FUNC_START + 16)
+#define FT_LISTITEM (RC_TP_FUNC_START + 17)
+#define ED_LISTITEM (RC_TP_FUNC_START + 18)
+#define PB_LISTADD (RC_TP_FUNC_START + 19)
+#define FT_LISTITEMS (RC_TP_FUNC_START + 20)
+#define LB_LISTITEMS (RC_TP_FUNC_START + 21)
+#define PB_LISTREMOVE (RC_TP_FUNC_START + 22)
+#define PB_LISTUP (RC_TP_FUNC_START + 23)
+#define PB_LISTDOWN (RC_TP_FUNC_START + 24)
+#define FT_LISTNAME (RC_TP_FUNC_START + 25)
+#define ED_LISTNAME (RC_TP_FUNC_START + 26)
+
+// Referenz-TabPage:
+#define RC_TP_REF_START (RC_TP_FUNC_END)
+#define FT_REFTYPE (RC_TP_REF_START + 1)
+#define LB_REFTYPE (RC_TP_REF_START + 2)
+#define FT_REFSELECTION (RC_TP_REF_START + 3)
+#define LB_REFSELECTION (RC_TP_REF_START + 4)
+#define LB_REFSELECTION_TOOLTIP (RC_TP_REF_START + 5)
+#define LB_REFFORMAT (RC_TP_REF_START + 6)
+#define FT_REFFORMAT (RC_TP_REF_START + 7)
+#define FT_REFNAME (RC_TP_REF_START + 8)
+#define ED_REFNAME (RC_TP_REF_START + 9)
+#define FT_REFVALUE (RC_TP_REF_START + 10)
+#define ED_REFVALUE (RC_TP_REF_START + 11)
+#define STR_REFBOOKMARK (RC_TP_REF_START + 12)
+#define STR_REFFOOTNOTE (RC_TP_REF_START + 13)
+#define STR_REFENDNOTE (RC_TP_REF_START + 14)
+#define STR_REFHEADING (RC_TP_REF_START + 15)
+#define STR_REFNUMITEM (RC_TP_REF_START + 16)
+#define RC_TP_REF_END (RC_TP_REF_START + 17)
+
+#define RC_TP_END (RC_TP_REF_END)
+
+// Strings ------------------------------------------------------------------
+
+#define STR_FLD_INSERT (RC_TP_END + 1)
+#define STR_FLD_CLOSE (RC_TP_END + 2)
+
+#endif
diff --git a/sw/source/ui/fldui/fldtdlg.src b/sw/source/ui/fldui/fldtdlg.src
new file mode 100644
index 000000000000..3034146466e3
--- /dev/null
+++ b/sw/source/ui/fldui/fldtdlg.src
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "fldui.hrc"
+#include "fldtdlg.hrc"
+#include "helpid.h"
+TabDialog DLG_FLD_INSERT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_FLD_DOK ;
+ PageResID = TP_FLD_DOK ;
+ Text [ en-US ] = "Document" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FLD_REF ;
+ PageResID = TP_FLD_REF ;
+ Text [ en-US ] = "Cross-references" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FLD_FUNC ;
+ PageResID = TP_FLD_FUNC ;
+ Text [ en-US ] = "Functions" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FLD_DOKINF ;
+ PageResID = TP_FLD_DOKINF ;
+ Text [ en-US ] = "DocInformation" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FLD_VAR ;
+ PageResID = TP_FLD_VAR ;
+ Text [ en-US ] = "Variables" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FLD_DB ;
+ PageResID = TP_FLD_DB ;
+ Text [ en-US ] = "Database" ;
+ };
+ };
+ };
+ String STR_FLD_INSERT
+ {
+ Text [ en-US ] = "~Insert" ;
+ };
+ String STR_FLD_CLOSE
+ {
+ Text [ en-US ] = "~Close" ;
+ };
+ Text [ en-US ] = "Fields" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/fldui.src b/sw/source/ui/fldui/fldui.src
new file mode 100644
index 000000000000..7fb6a2e730c8
--- /dev/null
+++ b/sw/source/ui/fldui/fldui.src
@@ -0,0 +1,684 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define _FLDUI_SRC
+#include "index.hrc"
+#include "fldui.hrc"
+#include "helpid.h"
+
+/*--------------------------------------------------------------------
+ Beschreibung: Strings fuer die Types
+ --------------------------------------------------------------------*/
+String STR_FLD_EDIT_DLG
+{
+ Text [ en-US ] = "Edit Fields" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Strings fuer die Types
+ --------------------------------------------------------------------*/
+ //
+ // Bereich Dokument
+ //
+String STR_DATEFLD
+{
+ Text [ en-US ] = "Date" ;
+};
+String STR_TIMEFLD
+{
+ Text [ en-US ] = "Time" ;
+};
+String STR_FILENAMEFLD
+{
+ Text [ en-US ] = "File name" ;
+};
+String STR_DBNAMEFLD
+{
+ Text [ en-US ] = "Database Name" ;
+};
+String STR_CHAPTERFLD
+{
+ Text [ en-US ] = "Chapter" ;
+};
+String STR_PAGENUMBERFLD
+{
+ Text [ en-US ] = "Page numbers" ;
+};
+String STR_DOCSTATFLD
+{
+ Text [ en-US ] = "Statistics" ;
+};
+String STR_AUTHORFLD
+{
+ Text [ en-US ] = "Author" ;
+};
+String STR_TEMPLNAMEFLD
+{
+ Text [ en-US ] = "Templates" ;
+};
+String STR_EXTUSERFLD
+{
+ Text [ en-US ] = "Sender" ;
+};
+ //
+ // Bereich Funktionen
+ //
+String STR_SETFLD
+{
+ Text [ en-US ] = "Set variable" ;
+};
+String STR_GETFLD
+{
+ Text [ en-US ] = "Show variable" ;
+};
+String STR_FORMELFLD
+{
+ Text [ en-US ] = "Insert Formula" ;
+};
+String STR_INPUTFLD
+{
+ Text [ en-US ] = "Input field" ;
+};
+String STR_SETINPUTFLD
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Eingabefeld (Variable) : Eingabefeld (Varibale) */
+ /* ### ACHTUNG: Neuer Text in Resource? Eingabefeld (Variable) : Eingabefeld (Varibale) */
+ /* ### ACHTUNG: Neuer Text in Resource? Eingabefeld (Variable) : Eingabefeld (Varibale) */
+ /* ### ACHTUNG: Neuer Text in Resource? Eingabefeld (Variable) : Eingabefeld (Varibale) */
+ /* ### ACHTUNG: Neuer Text in Resource? Eingabefeld (Variable) : Eingabefeld (Varibale) */
+ Text [ en-US ] = "Input field (variable)" ;
+};
+String STR_USRINPUTFLD
+{
+ Text [ en-US ] = "Input field (user)" ;
+};
+String STR_CONDTXTFLD
+{
+ Text [ en-US ] = "Conditional text" ;
+};
+String STR_DDEFLD
+{
+ Text [ en-US ] = "DDE field" ;
+};
+String STR_MACROFLD
+{
+ Text [ en-US ] = "Execute macro" ;
+};
+String STR_SEQFLD
+{
+ Text [ en-US ] = "Number range" ;
+};
+String STR_SETREFPAGEFLD
+{
+ Text [ en-US ] = "Set page variable" ;
+};
+String STR_GETREFPAGEFLD
+{
+ Text [ en-US ] = "Show page variable" ;
+};
+String STR_INTERNETFLD
+{
+ Text [ en-US ] = "Load URL" ;
+};
+String STR_JUMPEDITFLD
+{
+ Text [ en-US ] = "Placeholder" ;
+};
+String STR_COMBINED_CHARS
+{
+ Text [ en-US ] = "Combine characters";
+};
+String STR_DROPDOWN
+{
+ Text [ en-US ] = "Input list" ;
+};
+ //
+ // Bereich Referenzen
+ //
+String STR_SETREFFLD
+{
+ Text [ en-US ] = "Set Reference" ;
+};
+String STR_GETREFFLD
+{
+ Text [ en-US ] = "Insert Reference" ;
+};
+ //
+ // Bereich Datenbank
+ //
+String STR_DBFLD
+{
+ Text [ en-US ] = "Mail merge fields" ;
+};
+String STR_DBNEXTSETFLD
+{
+ Text [ en-US ] = "Next record" ;
+};
+String STR_DBNUMSETFLD
+{
+ Text [ en-US ] = "Any record" ;
+};
+String STR_DBSETNUMBERFLD
+{
+ Text [ en-US ] = "Record number" ;
+};
+String STR_PREVPAGEFLD
+{
+ Text [ en-US ] = "Previous page" ;
+};
+String STR_NEXTPAGEFLD
+{
+ Text [ en-US ] = "Next page" ;
+};
+String STR_HIDDENTXTFLD
+{
+ Text [ en-US ] = "Hidden text" ;
+};
+ //
+ // Bereich Benutzerfelder
+ //
+String STR_USERFLD
+{
+ Text [ en-US ] = "User Field" ;
+};
+String STR_POSTITFLD
+{
+ Text [ en-US ] = "Note" ;
+};
+String STR_SCRIPTFLD
+{
+ Text [ en-US ] = "Script" ;
+};
+String STR_AUTHORITY
+{
+ Text [ en-US ] = "Bibliography entry";
+};
+String STR_HIDDENPARAFLD
+{
+ Text [ en-US ] = "Hidden Paragraph" ;
+};
+ //
+ // Bereich DokumentInfo
+ //
+String STR_DOCINFOFLD
+{
+ Text [ en-US ] = "DocInformation" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: SubCmd-Strings
+ --------------------------------------------------------------------*/
+String FLD_DATE_STD
+{
+ Text [ en-US ] = "Date";
+};
+String FLD_DATE_FIX
+{
+ Text [ en-US ] = "Date (fixed)" ;
+};
+String FLD_TIME_STD
+{
+ Text [ en-US ] = "Time";
+};
+String FLD_TIME_FIX
+{
+ Text [ en-US ] = "Time (fixed)" ;
+};
+ //
+ // SubCmd Statistik
+ //
+String FLD_STAT_TABLE
+{
+ Text [ en-US ] = "Tables" ;
+};
+String FLD_STAT_CHAR
+{
+ Text [ en-US ] = "Characters" ;
+};
+String FLD_STAT_WORD
+{
+ Text [ en-US ] = "Words" ;
+};
+String FLD_STAT_PARA
+{
+ Text [ en-US ] = "Paragraphs" ;
+};
+String FLD_STAT_GRF
+{
+ Text [ en-US ] = "Graphics" ;
+};
+String FLD_STAT_OBJ
+{
+ Text [ en-US ] = "Objects" ;
+};
+String FLD_STAT_PAGE
+{
+ Text [ en-US ] = "Pages" ;
+};
+ // SubCmd DDETypen
+ //
+String FMT_DDE_HOT
+{
+ Text [ en-US ] = "DDE automatic" ;
+};
+String FMT_DDE_NORMAL
+{
+ Text [ en-US ] = "DDE manual" ;
+};
+String FLD_INPUT_TEXT
+{
+ TEXT = "[Text]" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: SubType Extuser
+ --------------------------------------------------------------------*/
+String FLD_EU_FIRMA
+{
+ Text [ en-US ] = "Company" ;
+};
+String FLD_EU_VORNAME
+{
+ Text [ en-US ] = "First Name" ;
+};
+String FLD_EU_NAME
+{
+ Text [ en-US ] = "Last Name" ;
+};
+String FLD_EU_ABK
+{
+ Text [ en-US ] = "Initials" ;
+};
+String FLD_EU_STRASSE
+{
+ Text [ en-US ] = "Street" ;
+};
+String FLD_EU_LAND
+{
+ Text [ en-US ] = "Country" ;
+};
+String FLD_EU_PLZ
+{
+ Text [ en-US ] = "Zip code" ;
+};
+String FLD_EU_ORT
+{
+ Text [ en-US ] = "City" ;
+};
+String FLD_EU_TITEL
+{
+ Text [ en-US ] = "Title" ;
+};
+String FLD_EU_POS
+{
+ Text [ en-US ] = "Position" ;
+};
+String FLD_EU_TELPRIV
+{
+ Text [ en-US ] = "Tel. (Home)" ;
+};
+String FLD_EU_TELFIRMA
+{
+ Text [ en-US ] = "Tel. (Work)" ;
+};
+String FLD_EU_FAX
+{
+ Text [ en-US ] = "FAX" ;
+};
+String FLD_EU_EMAIL
+{
+ Text [ en-US ] = "E-mail" ;
+};
+String FLD_EU_STATE
+{
+ Text [ en-US ] = "State" ;
+};
+String FLD_PAGEREF_OFF
+{
+ Text [ en-US ] = "off" ;
+};
+String FLD_PAGEREF_ON
+{
+ Text [ en-US ] = "on" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Pfadname
+ --------------------------------------------------------------------*/
+ // Formate FileName
+String FMT_FF_NAME
+{
+ Text [ en-US ] = "File name" ;
+};
+String FMT_FF_NAME_NOEXT
+{
+ Text [ en-US ] = "File name without extension" ;
+};
+String FMT_FF_PATHNAME
+{
+ Text [ en-US ] = "Path/File name" ;
+};
+String FMT_FF_PATH
+{
+ Text [ en-US ] = "Path" ;
+};
+String FMT_FF_UI_NAME
+{
+ Text [ en-US ] = "Style" ;
+};
+String FMT_FF_UI_RANGE
+{
+ Text [ en-US ] = "Category" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Format Kapitel
+ --------------------------------------------------------------------*/
+String FMT_CHAPTER_NAME
+{
+ Text [ en-US ] = "Chapter name" ;
+};
+String FMT_CHAPTER_NO
+{
+ Text [ en-US ] = "Chapter number" ;
+};
+String FMT_CHAPTER_NO_NOSEPARATOR
+{
+ Text [ en-US ] = "Chapter number without separator" ;
+};
+String FMT_CHAPTER_NAMENO
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Kapitelnummer und Name : Nummer und Name */
+ Text [ en-US ] = "Chapter number and name" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Formate
+ --------------------------------------------------------------------*/
+String FMT_NUM_ABC
+{
+ TEXT = "A B C" ;
+};
+String FMT_NUM_SABC
+{
+ TEXT = "a b c" ;
+};
+String FMT_NUM_ABC_N
+{
+ TEXT = "A .. AA .. AAA" ;
+};
+String FMT_NUM_SABC_N
+{
+ TEXT = "a .. aa .. aaa" ;
+};
+String FMT_NUM_ROMAN
+{
+ Text [ en-US ] = "Roman (I II III)" ;
+};
+String FMT_NUM_SROMAN
+{
+ Text [ en-US ] = "Roman (i ii iii)" ;
+};
+String FMT_NUM_ARABIC
+{
+ Text [ en-US ] = "Arabic (1 2 3)" ;
+};
+String FMT_NUM_PAGEDESC
+{
+ Text [ en-US ] = "As Page Style" ;
+};
+String FMT_NUM_PAGESPECIAL
+{
+ Text [ en-US ] = "Text" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Author
+ --------------------------------------------------------------------*/
+String FMT_AUTHOR_NAME
+{
+ Text [ en-US ] = "Name" ;
+};
+String FMT_AUTHOR_SCUT
+{
+ Text [ en-US ] = "Initials" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Varibale setzen
+ --------------------------------------------------------------------*/
+String FMT_SETVAR_SYS
+{
+ Text [ en-US ] = "System" ;
+};
+String FMT_SETVAR_TEXT
+{
+ Text [ en-US ] = "Text" ;
+};
+String FMT_GETVAR_NAME
+{
+ Text [ en-US ] = "Name" ;
+};
+String FMT_GETVAR_TEXT
+{
+ Text [ en-US ] = "Text" ;
+};
+String FMT_USERVAR_CMD
+{
+ Text [ en-US ] = "Formula" ;
+};
+String FMT_USERVAR_TEXT
+{
+ Text [ en-US ] = "Text" ;
+};
+String FMT_DBFLD_DB
+{
+ Text [ en-US ] = "Database" ;
+};
+String FMT_DBFLD_SYS
+{
+ Text [ en-US ] = "System" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Ablagefelder
+ --------------------------------------------------------------------*/
+String FMT_REG_AUTHOR
+{
+ Text [ en-US ] = "Author" ;
+};
+String FMT_REG_TIME
+{
+ Text [ en-US ] = "Time" ;
+};
+String FMT_REG_DATE
+{
+ Text [ en-US ] = "Date" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Formate Referenzen
+ --------------------------------------------------------------------*/
+String FMT_REF_TEXT
+{
+ Text [ en-US ] = "Reference" ;
+};
+String FMT_REF_PAGE
+{
+ Text [ en-US ] = "Page" ;
+};
+String FMT_REF_CHAPTER
+{
+ Text [ en-US ] = "Chapter" ;
+};
+String FMT_REF_UPDOWN
+{
+ Text [ en-US ] = "Above/Below" ;
+};
+String FMT_REF_PAGE_PGDSC
+{
+ Text [ en-US ] = "As Page Style" ;
+};
+String FMT_REF_ONLYNUMBER
+{
+ Text [ en-US ] = "Category and Number" ;
+};
+String FMT_REF_ONLYCAPTION
+{
+ Text [ en-US ] = "Caption Text" ;
+};
+String FMT_REF_ONLYSEQNO
+{
+ Text [ en-US ] = "Numbering";
+};
+String FMT_REF_NUMBER
+{
+ Text [ en-US ] = "Number";
+};
+String FMT_REF_NUMBER_NO_CONTEXT
+{
+ Text [ en-US ] = "Number (no context)";
+};
+String FMT_REF_NUMBER_FULL_CONTEXT
+{
+ Text [ en-US ] = "Number (full context)";
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Platzhalter
+ --------------------------------------------------------------------*/
+String FMT_MARK_TEXT
+{
+ Text [ en-US ] = "Text" ;
+};
+String FMT_MARK_TABLE
+{
+ Text [ en-US ] = "Table" ;
+};
+String FMT_MARK_FRAME
+{
+ Text [ en-US ] = "Frame" ;
+};
+String FMT_MARK_GRAFIC
+{
+ Text [ en-US ] = "Graphics" ;
+};
+String FMT_MARK_OLE
+{
+ Text [ en-US ] = "Object" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Nur-Text
+ --------------------------------------------------------------------*/
+String FMT_TEXT
+{
+ TEXT = "Text" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: globale String-Ressourcen
+ --------------------------------------------------------------------*/
+String STR_ALL
+{
+ Text [ en-US ] = "All" ;
+};
+String STR_INSERT
+{
+ Text [ en-US ] = "Insert" ;
+};
+/*--------------------------------------------------------------------
+ Beschreibung: AustauschStrings fuer Edit/NameFT
+ --------------------------------------------------------------------*/
+String STR_COND
+{
+ Text [ en-US ] = "~Condition" ;
+};
+String STR_TEXT
+{
+ Text [ en-US ] = "Then, Else" ;
+};
+String STR_DDE_CMD
+{
+ Text [ en-US ] = "DDE Statement" ;
+};
+String STR_INSTEXT
+{
+ Text [ en-US ] = "Hidden t~ext" ;
+};
+String STR_MACNAME
+{
+ Text [ en-US ] = "~Macro name" ;
+};
+String STR_PROMPT
+{
+ Text [ en-US ] = "~Reference" ;
+};
+String STR_COMBCHRS_FT
+{
+ Text [ en-US ] = "Ch~aracters";
+};
+String STR_SETNO
+{
+ Text [ en-US ] = "Record number" ;
+};
+String STR_OFFSET
+{
+ Text [ en-US ] = "O~ffset" ;
+};
+String STR_VALUE
+{
+ Text [ en-US ] = "Value" ;
+};
+String STR_FORMULA
+{
+ Text [ en-US ] = "Formula" ;
+};
+String STR_URLPROMPT
+{
+ Text [ en-US ] = "~URL" ;
+};
+String STR_ALL_DATABASE
+{
+ Text [ en-US ] = "<All>" ;
+};
+ImageButton BTN_FLDEDT_PREV
+{
+ Pos = MAP_APPFONT ( 263 , 115 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ TabStop = TRUE ;
+ SYMBOL = IMAGEBUTTON_PREV ;
+ Helpid = HID_DLG_FLDEDT_PREV ;
+};
+ImageButton BTN_FLDEDT_NEXT
+{
+ Pos = MAP_APPFONT ( 294 , 115 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ TabStop = TRUE ;
+ SYMBOL = IMAGEBUTTON_NEXT ;
+ Helpid = HID_DLG_FLDEDT_NEXT ;
+};
+PushButton PB_FLDEDT_ADDRESS
+{
+ Pos = MAP_APPFONT ( 294 , 100 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Edit" ;
+ Helpid = HID_DLG_FLDEDT_ADDRESS ;
+};
+String STR_CUSTOM
+{
+ Text [ en-US ] = "Custom" ;
+};
+
diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx
new file mode 100644
index 000000000000..6aee7bba2cf3
--- /dev/null
+++ b/sw/source/ui/fldui/fldvar.cxx
@@ -0,0 +1,1383 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <swtypes.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <usrfld.hxx>
+#include <docufld.hxx>
+#include <expfld.hxx>
+#include <ddefld.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <doc.hxx>
+#include <docary.hxx>
+#include <swmodule.hxx>
+#ifndef _FLDVAR_HXX
+#include <fldvar.hxx>
+#endif
+#include <calc.hxx>
+#include <svl/zformat.hxx>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _FLDTDLG_HRC
+#include <fldtdlg.hrc>
+#endif
+
+#define USER_DATA_VERSION_1 "1"
+#define USER_DATA_VERSION USER_DATA_VERSION_1
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldVarPage::SwFldVarPage(Window* pParent, const SfxItemSet& rCoreSet ) :
+ SwFldPage ( pParent, SW_RES( TP_FLD_VAR ), rCoreSet ),
+ aTypeFT (this, SW_RES(FT_VARTYPE)),
+ aTypeLB (this, SW_RES(LB_VARTYPE)),
+ aSelectionFT (this, SW_RES(FT_VARSELECTION)),
+ aSelectionLB (this, SW_RES(LB_VARSELECTION)),
+ aNameFT (this, SW_RES(FT_VARNAME)),
+ aNameED (this, SW_RES(ED_VARNAME)),
+ aValueFT (this, SW_RES(FT_VARVALUE)),
+ aValueED (this, SW_RES(ED_VARVALUE)),
+ aFormatFT (this, SW_RES(FT_VARFORMAT)),
+ aNumFormatLB (this, SW_RES(LB_VARNUMFORMAT)),
+ aFormatLB (this, SW_RES(LB_VARFORMAT)),
+ aChapterHeaderFT(this, SW_RES(FT_VARCHAPTERHEADER)),
+ aChapterLevelFT (this, SW_RES(FT_VARCHAPTERLEVEL)),
+ aChapterLevelLB (this, SW_RES(LB_VARCHAPTERLEVEL)),
+ aInvisibleCB (this, SW_RES(CB_VARINVISIBLE)),
+ aSeparatorFT (this, SW_RES(FT_VARSEPARATOR)),
+ aSeparatorED (this, SW_RES(ED_VARSEPARATOR)),
+ aNewDelTBX (this, SW_RES(TBX_VARNEWDEL)),
+ bInit (TRUE)
+{
+ FreeResource();
+
+ aNewDelTBX.SetSizePixel( aNewDelTBX.CalcWindowSizePixel() );
+
+ long nDelta = ( aValueED.GetSizePixel().Height() -
+ aNewDelTBX.GetSizePixel().Height() ) / 2;
+ Point aNewPnt = aNewDelTBX.GetPosPixel();
+ aNewPnt.Y() += nDelta;
+ aNewDelTBX.SetPosPixel( aNewPnt );
+
+ sOldValueFT = aValueFT.GetText();
+ sOldNameFT = aNameFT.GetText();
+
+ for (USHORT i = 1; i <= MAXLEVEL; i++)
+ aChapterLevelLB.InsertEntry(String::CreateFromInt32(i));
+
+ aChapterLevelLB.SelectEntryPos(0);
+ //enable 'active' language selection
+ aNumFormatLB.SetShowLanguageControl(TRUE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldVarPage::~SwFldVarPage()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldVarPage::Reset(const SfxItemSet& )
+{
+ SavePos(&aTypeLB);
+
+ Init(); // Allgemeine initialisierung
+
+ aTypeLB.SetUpdateMode(FALSE);
+ aTypeLB.Clear();
+
+ USHORT nPos, nTypeId;
+
+ if (!IsFldEdit())
+ {
+ // TypeListBox initialisieren
+ const SwFldGroupRgn& rRg = GetFldMgr().GetGroupRange(IsFldDlgHtmlMode(), GetGroup());
+
+ for (short i = rRg.nStart; i < rRg.nEnd; ++i)
+ {
+ nTypeId = GetFldMgr().GetTypeId(i);
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(i));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ }
+ }
+ else
+ {
+ SwField* pCurField = GetCurField();
+ nTypeId = pCurField->GetTypeId();
+ if (nTypeId == TYP_SETINPFLD)
+ nTypeId = TYP_INPUTFLD;
+ nPos = aTypeLB.InsertEntry(GetFldMgr().GetTypeStr(GetFldMgr().GetPos(nTypeId)));
+ aTypeLB.SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+ aNumFormatLB.SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ const SvNumberformat* pFormat = pSh->GetNumberFormatter()->GetEntry(pCurField->GetFormat());
+ if(pFormat)
+ aNumFormatLB.SetLanguage(pFormat->GetLanguage());
+ }
+ }
+
+ // alte Pos selektieren
+ RestorePos(&aTypeLB);
+
+ aTypeLB.SetDoubleClickHdl (LINK(this, SwFldVarPage, InsertHdl));
+ aTypeLB.SetSelectHdl (LINK(this, SwFldVarPage, TypeHdl));
+ aSelectionLB.SetSelectHdl (LINK(this, SwFldVarPage, SubTypeHdl));
+ aSelectionLB.SetDoubleClickHdl (LINK(this, SwFldVarPage, InsertHdl));
+ aFormatLB.SetDoubleClickHdl (LINK(this, SwFldVarPage, InsertHdl));
+ aNumFormatLB.SetDoubleClickHdl (LINK(this, SwFldVarPage, InsertHdl));
+ aNameED.SetModifyHdl (LINK(this, SwFldVarPage, ModifyHdl));
+ aValueED.SetModifyHdl (LINK(this, SwFldVarPage, ModifyHdl));
+ aNewDelTBX.SetClickHdl (LINK(this, SwFldVarPage, TBClickHdl));
+ aChapterLevelLB.SetSelectHdl (LINK(this, SwFldVarPage, ChapterHdl));
+ aSeparatorED.SetModifyHdl (LINK(this, SwFldVarPage, SeparatorHdl));
+
+ if( !IsRefresh() )
+ {
+ String sUserData = GetUserData();
+ if(!IsRefresh() && sUserData.GetToken(0, ';').EqualsIgnoreCaseAscii(USER_DATA_VERSION_1))
+ {
+ String sVal = sUserData.GetToken(1, ';');
+ USHORT nVal = (USHORT)sVal.ToInt32();
+ if( USHRT_MAX != nVal )
+ {
+ for(USHORT i = 0; i < aTypeLB.GetEntryCount(); i++)
+ if(nVal == (USHORT)(ULONG)aTypeLB.GetEntryData(i))
+ {
+ aTypeLB.SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+ }
+ TypeHdl(0);
+
+ aTypeLB.SetUpdateMode(TRUE);
+
+ if (IsFldEdit())
+ {
+ aSelectionLB.SaveValue();
+ aFormatLB.SaveValue();
+ nOldFormat = aNumFormatLB.GetFormat();
+ aNameED.SaveValue();
+ aValueED.SaveValue();
+ aInvisibleCB.SaveValue();
+ aChapterLevelLB.SaveValue();
+ aSeparatorED.SaveValue();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldVarPage, TypeHdl, ListBox *, EMPTYARG )
+{
+ // Alte ListBoxPos sichern
+ const USHORT nOld = GetTypeSel();
+
+ // Aktuelle ListBoxPos
+ SetTypeSel(aTypeLB.GetSelectEntryPos());
+
+ if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
+ {
+ SetTypeSel(0);
+ aTypeLB.SelectEntryPos(0);
+ }
+
+ if (nOld != GetTypeSel() || nOld == LISTBOX_ENTRY_NOTFOUND)
+ {
+ bInit = TRUE;
+ if (nOld != LISTBOX_ENTRY_NOTFOUND)
+ {
+ aNameED.SetText(aEmptyStr);
+ aValueED.SetText(aEmptyStr);
+ }
+
+ aValueED.SetDropEnable(FALSE);
+ UpdateSubType(); // Auswahl-Listboxen initialisieren
+ }
+
+ bInit = FALSE;
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldVarPage, SubTypeHdl, ListBox *, pBox )
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+ USHORT nSelPos = aSelectionLB.GetSelectEntryPos();
+
+ if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
+ nSelPos = (USHORT)(ULONG)aSelectionLB.GetEntryData(nSelPos);
+
+ if (IsFldEdit() && (!pBox || bInit))
+ {
+ if (nTypeId != TYP_FORMELFLD)
+ aNameED.SetText(GetFldMgr().GetCurFldPar1());
+
+ aValueED.SetText(GetFldMgr().GetCurFldPar2());
+ }
+
+ if (aNameFT.GetText() != sOldNameFT)
+ aNameFT.SetText(sOldNameFT);
+ if (aValueFT.GetText() != sOldValueFT)
+ aValueFT.SetText(sOldValueFT);
+
+ aNumFormatLB.SetUpdateMode(FALSE);
+ aFormatLB.SetUpdateMode(FALSE);
+ FillFormatLB(nTypeId);
+
+ USHORT nSize = aFormatLB.GetEntryCount();
+
+ BOOL bValue = FALSE, bName = FALSE, bNumFmt = FALSE,
+ bInvisible = FALSE, bSeparator = FALSE, bChapterLevel = FALSE;
+ BOOL bFormat = nSize != 0;
+
+ switch (nTypeId)
+ {
+ case TYP_USERFLD:
+ {
+ // Benutzertyp aendern oder anlegen
+ SwUserFieldType* pType = (SwUserFieldType*)
+ GetFldMgr().GetFldType(RES_USERFLD, nSelPos);
+
+ if (pType)
+ {
+ if (!IsFldEdit())
+ {
+ if (pBox || (bInit && !IsRefresh())) // Nur bei Interaktion mit Maus
+ {
+ aNameED.SetText(pType->GetName());
+
+ if (pType->GetType() == UF_STRING)
+ {
+ aValueED.SetText(pType->GetContent());
+ aNumFormatLB.SelectEntryPos(0);
+ }
+ else
+ aValueED.SetText(pType->GetContent());
+// aValueED.SetText(pType->GetContent(aNumFormatLB.GetFormat()));
+ }
+ }
+ else
+ aValueED.SetText(pType->GetContent());
+ }
+ else
+ {
+ if (pBox) // Nur bei Interaktion mit Maus
+ {
+ aNameED.SetText(aEmptyStr);
+ aValueED.SetText(aEmptyStr);
+ }
+ }
+ bValue = bName = bNumFmt = bInvisible = TRUE;
+
+ aValueED.SetDropEnable(TRUE);
+ break;
+ }
+
+ case TYP_SETFLD:
+ bValue = TRUE;
+
+ bNumFmt = bInvisible = TRUE;
+
+ if (!IsFldDlgHtmlMode())
+ bName = TRUE;
+ else
+ {
+ aNumFormatLB.Clear();
+ USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_SETVAR_TEXT), 0);
+ aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
+ aNumFormatLB.SelectEntryPos(0);
+ }
+ // gibt es ein entprechendes SetField
+ if (IsFldEdit() || pBox) // Nur bei Interaktion mit Maus
+ {
+ if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ String sName(aSelectionLB.GetSelectEntry());
+ aNameED.SetText(sName);
+
+ if (!IsFldDlgHtmlMode())
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ SwSetExpFieldType* pSetTyp = (SwSetExpFieldType*)
+ pSh->GetFldType(RES_SETEXPFLD, sName);
+
+ if (pSetTyp && pSetTyp->GetType() == nsSwGetSetExpType::GSE_STRING)
+ aNumFormatLB.SelectEntryPos(0); // Textuell
+ }
+ }
+ }
+ }
+ if (IsFldEdit())
+ {
+ // GetFormula fuehrt bei Datumsformaten zu Problemen,
+ // da nur der numerische Wert ohne Formatierung returned wird.
+ // Muss aber verwendet werden, da sonst bei GetPar2 nur der vom
+ // Kalkulator errechnete Wert angezeigt werden wuerde
+ // (statt test2 = test + 1)
+ aValueED.SetText(((SwSetExpField*)GetCurField())->GetFormula());
+ }
+ aValueED.SetDropEnable(TRUE);
+ break;
+
+ case TYP_FORMELFLD:
+ {
+ bValue = TRUE;
+ bNumFmt = TRUE;
+ aValueFT.SetText(SW_RESSTR(STR_FORMULA));
+ aValueED.SetDropEnable(TRUE);
+ }
+ break;
+
+ case TYP_GETFLD:
+ {
+ if (!IsFldEdit())
+ {
+ aNameED.SetText(aEmptyStr);
+ aValueED.SetText(aEmptyStr);
+ }
+
+ if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ String sName(aSelectionLB.GetSelectEntry());
+ if (!IsFldEdit())
+ aNameED.SetText(sName);
+
+ // gibt es ein entprechendes SetField
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ SwSetExpFieldType* pSetTyp = (SwSetExpFieldType*)
+ pSh->GetFldType(RES_SETEXPFLD, sName);
+
+ if(pSetTyp)
+ {
+ if (pSetTyp->GetType() & nsSwGetSetExpType::GSE_STRING) // Textuell?
+ bFormat = TRUE;
+ else // Numerisch
+ bNumFmt = TRUE;
+ }
+ }
+ }
+ else
+ bFormat = FALSE;
+
+ EnableInsert(bFormat|bNumFmt);
+ }
+ break;
+
+ case TYP_INPUTFLD:
+ aValueFT.SetText(SW_RESSTR(STR_PROMPT));
+
+ if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ bValue = bNumFmt = TRUE;
+
+ String sName;
+
+ sName = aSelectionLB.GetSelectEntry();
+ aNameED.SetText( sName );
+
+ // User- oder SetField ?
+ USHORT nInpType = 0;
+ nInpType = static_cast< USHORT >(GetFldMgr().GetFldType(RES_USERFLD, sName) ? 0 : TYP_SETINPFLD);
+
+ if (nInpType) // SETEXPFLD
+ {
+ // gibt es ein entprechendes SetField
+ SwSetExpFieldType* pSetTyp = (SwSetExpFieldType*)
+ GetFldMgr().GetFldType(RES_SETEXPFLD, sName);
+
+ if(pSetTyp)
+ {
+ if (pSetTyp->GetType() == nsSwGetSetExpType::GSE_STRING) // Textuell?
+ {
+ aNumFormatLB.Clear();
+
+ USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_USERVAR_TEXT), 0);
+ aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
+ aNumFormatLB.SelectEntryPos(0);
+ }
+ }
+ if (IsFldEdit() && (!pBox || bInit) )
+ aValueED.SetText(((SwSetExpField*)GetCurField())->GetPromptText());
+ }
+ else // USERFLD
+ bFormat = bNumFmt = FALSE;
+ }
+ break;
+
+ case TYP_DDEFLD:
+ aValueFT.SetText(SW_RESSTR(STR_DDE_CMD));
+
+ if (IsFldEdit() || pBox) // Nur bei Interaktion mit Maus
+ {
+ if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ SwDDEFieldType* pType =
+ (SwDDEFieldType*) GetFldMgr().GetFldType(RES_DDEFLD, nSelPos);
+
+ if(pType)
+ {
+ aNameED.SetText(pType->GetName());
+
+ //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
+ // Namen haben! Wird hier noch nicht beachtet
+ String sCmd( pType->GetCmd() );
+ USHORT nTmpPos = sCmd.SearchAndReplace( sfx2::cTokenSeperator, ' ' );
+ sCmd.SearchAndReplace( sfx2::cTokenSeperator, ' ', nTmpPos );
+
+ aValueED.SetText( sCmd );
+ aFormatLB.SelectEntryPos(pType->GetType());
+ }
+ }
+ }
+ bName = bValue = TRUE;
+ break;
+
+ case TYP_SEQFLD:
+ {
+ // aNumRB.Check(TRUE);
+ bName = bValue = bSeparator = bChapterLevel = TRUE;
+
+ SwFieldType* pFldTyp;
+ if( IsFldEdit() )
+ pFldTyp = GetCurField()->GetTyp();
+ else
+ {
+ String sFldTypeName( aSelectionLB.GetEntry( nSelPos ));
+ if( sFldTypeName.Len() )
+ pFldTyp = GetFldMgr().GetFldType( RES_SETEXPFLD,
+ sFldTypeName );
+ else
+ pFldTyp = 0;
+ }
+
+ if( IsFldEdit() )
+ aValueED.SetText( ((SwSetExpField*)GetCurField())->
+ GetFormula() );
+
+ if( IsFldEdit() || pBox ) // Nur bei Interaktion mit Maus
+ aNameED.SetText( aSelectionLB.GetSelectEntry() );
+
+ if( pFldTyp )
+ {
+ BYTE nLevel = ((SwSetExpFieldType*)pFldTyp)->GetOutlineLvl();
+ if( 0x7f == nLevel )
+ aChapterLevelLB.SelectEntryPos( 0 );
+ else
+ aChapterLevelLB.SelectEntryPos( nLevel + 1 );
+ String sDelim = ((SwSetExpFieldType*)pFldTyp)->GetDelimiter();
+ aSeparatorED.SetText( sDelim );
+ ChapterHdl();
+ }
+ }
+ break;
+
+ case TYP_SETREFPAGEFLD:
+ {
+ bValue = FALSE;
+ aValueFT.SetText( SW_RESSTR( STR_OFFSET ));
+
+ if (IsFldEdit() || pBox) // Nur bei Interaktion mit Maus
+ aNameED.SetText(aEmptyStr);
+
+ if (nSelPos != 0 && nSelPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ bValue = TRUE; // SubType OFF - kennt keinen Offset
+ if (IsFldEdit())
+ aValueED.SetText(String::CreateFromInt32(((SwRefPageSetField*)GetCurField())->GetOffset()));
+ }
+ }
+ break;
+
+ case TYP_GETREFPAGEFLD:
+ aNameED.SetText(aEmptyStr);
+ aValueED.SetText(aEmptyStr);
+ break;
+ }
+
+ aNumFormatLB.Show(bNumFmt);
+ aFormatLB.Show(!bNumFmt);
+
+ if (IsFldEdit())
+ bName = FALSE;
+
+ aFormatLB.Enable(bFormat);
+ aFormatFT.Enable(bFormat|bNumFmt);
+ aNameFT.Enable(bName);
+ aNameED.Enable(bName);
+ aValueFT.Enable(bValue);
+ aValueED.Enable(bValue);
+
+ Size aSz(aFormatLB.GetSizePixel());
+
+ if (bChapterLevel)
+ aSz.Height() = aFormatLB.LogicToPixel(Size(1, 94), MAP_APPFONT).Height();
+ else
+ aSz.Height() = aFormatLB.LogicToPixel(Size(1, 123), MAP_APPFONT).Height();
+
+ aFormatLB.SetSizePixel(aSz);
+
+ aInvisibleCB.Show(!bSeparator);
+ aSeparatorFT.Show(bSeparator);
+ aSeparatorED.Show(bSeparator);
+ aChapterHeaderFT.Show(bChapterLevel);
+ aChapterLevelFT.Show(bChapterLevel);
+ aChapterLevelLB.Show(bChapterLevel);
+ aInvisibleCB.Enable(bInvisible);
+
+ ModifyHdl(); // Anwenden/Einfuegen/Loeschen Status update
+
+ aNumFormatLB.SetUpdateMode(TRUE);
+ aFormatLB.SetUpdateMode(TRUE);
+
+ if(aSelectionLB.IsCallAddSelection())
+ {
+ nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ switch (nTypeId)
+ {
+ case TYP_FORMELFLD:
+ {
+ nSelPos = aSelectionLB.GetSelectEntryPos();
+
+ if (nSelPos != LISTBOX_ENTRY_NOTFOUND)
+ nSelPos = (USHORT)(ULONG)aSelectionLB.GetEntryData(nSelPos);
+
+ if (nSelPos != LISTBOX_ENTRY_NOTFOUND && pBox && !bInit)
+ {
+ aValueED.ReplaceSelected(aSelectionLB.GetSelectEntry());
+ ModifyHdl();
+ }
+ }
+ break;
+ }
+ aSelectionLB.ResetCallAddSelection();
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Typen in der SelectionBox erneuern
+ --------------------------------------------------------------------*/
+
+void SwFldVarPage::UpdateSubType()
+{
+ String sOldSel;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ SetSelectionSel(aSelectionLB.GetSelectEntryPos());
+ if(GetSelectionSel() != LISTBOX_ENTRY_NOTFOUND)
+ sOldSel = aSelectionLB.GetEntry(GetSelectionSel());
+
+ // Auswahl-Listbox fuellen
+ aSelectionLB.SetUpdateMode(FALSE);
+ aSelectionLB.Clear();
+
+ SvStringsDtor aList;
+ GetFldMgr().GetSubTypes(nTypeId, aList);
+ USHORT nCount = aList.Count();
+ USHORT nPos;
+
+ for (USHORT i = 0; i < nCount; ++i)
+ {
+ if (nTypeId != TYP_INPUTFLD || i)
+ {
+ if (!IsFldEdit())
+ {
+ nPos = aSelectionLB.InsertEntry(*aList[i]);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ }
+ else
+ {
+ BOOL bInsert = FALSE;
+
+ switch (nTypeId)
+ {
+ case TYP_INPUTFLD:
+ if (*aList[i] == GetCurField()->GetPar1())
+ bInsert = TRUE;
+ break;
+
+ case TYP_FORMELFLD:
+ bInsert = TRUE;
+ break;
+
+ case TYP_GETFLD:
+ if (*aList[i] == ((SwFormulaField*)GetCurField())->GetFormula())
+ bInsert = TRUE;
+ break;
+
+ case TYP_SETFLD:
+ case TYP_USERFLD:
+ if (*aList[i] == GetCurField()->GetTyp()->GetName())
+ {
+ bInsert = TRUE;
+ if (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE)
+ aInvisibleCB.Check();
+ }
+ break;
+
+ case TYP_SETREFPAGEFLD:
+ if ((((SwRefPageSetField*)GetCurField())->IsOn() && i) ||
+ (!((SwRefPageSetField*)GetCurField())->IsOn() && !i))
+ sOldSel = *aList[i];
+
+ // Alle Eintr?ge zur Auswahl zulassen:
+ nPos = aSelectionLB.InsertEntry(*aList[i]);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ break;
+
+ default:
+ if (*aList[i] == GetCurField()->GetPar1())
+ bInsert = TRUE;
+ break;
+ }
+ if (bInsert)
+ {
+ nPos = aSelectionLB.InsertEntry(*aList[i]);
+ aSelectionLB.SetEntryData(nPos, reinterpret_cast<void*>(i));
+ if (nTypeId != TYP_FORMELFLD)
+ break;
+ }
+ }
+ }
+ }
+
+ BOOL bEnable = aSelectionLB.GetEntryCount() != 0;
+ ListBox *pLB = 0;
+
+ if (bEnable)
+ {
+ aSelectionLB.SelectEntry(sOldSel);
+ if (!aSelectionLB.GetSelectEntryCount())
+ {
+ aSelectionLB.SelectEntryPos(0);
+ pLB = &aSelectionLB; // Alle Controls neu initialisieren
+ }
+ }
+
+ aSelectionLB.Enable( bEnable );
+ aSelectionFT.Enable( bEnable );
+
+ SubTypeHdl(pLB);
+ aSelectionLB.SetUpdateMode(TRUE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldVarPage::FillFormatLB(USHORT nTypeId)
+{
+ String sOldSel, sOldNumSel;
+ ULONG nOldNumFormat = 0;
+
+ USHORT nFormatSel = aFormatLB.GetSelectEntryPos();
+ if (nFormatSel != LISTBOX_ENTRY_NOTFOUND)
+ sOldSel = aFormatLB.GetEntry(nFormatSel);
+
+ USHORT nNumFormatSel = aNumFormatLB.GetSelectEntryPos();
+ if (nNumFormatSel != LISTBOX_ENTRY_NOTFOUND)
+ {
+ sOldNumSel = aNumFormatLB.GetEntry(nNumFormatSel);
+ nOldNumFormat = aNumFormatLB.GetFormat();
+ }
+
+ // Format-Listbox fuellen
+ aFormatLB.Clear();
+ aNumFormatLB.Clear();
+ BOOL bSpecialFmt = FALSE;
+
+ if( TYP_GETREFPAGEFLD != nTypeId )
+ {
+ if (IsFldEdit())
+ {
+ bSpecialFmt = GetCurField()->GetFormat() == SAL_MAX_UINT32;
+
+ if (!bSpecialFmt)
+ {
+ aNumFormatLB.SetDefFormat(GetCurField()->GetFormat());
+ sOldNumSel = aEmptyStr;
+ }
+ else
+ if (nTypeId == TYP_GETFLD || nTypeId == TYP_FORMELFLD)
+ aNumFormatLB.SetFormatType(NUMBERFORMAT_NUMBER);
+ }
+ else
+ {
+ if (nOldNumFormat && nOldNumFormat != ULONG_MAX)
+ aNumFormatLB.SetDefFormat(nOldNumFormat);
+ else
+ aNumFormatLB.SetFormatType(NUMBERFORMAT_NUMBER);
+ }
+ }
+
+ switch (nTypeId)
+ {
+ case TYP_USERFLD:
+ {
+ if (!IsFldEdit() || bSpecialFmt)
+ {
+ USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_MARK_TEXT), 0);
+ aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
+ nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_USERVAR_CMD), 1);
+ aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
+ }
+ }
+ break;
+
+ case TYP_SETFLD:
+ {
+ if (!IsFldEdit() || bSpecialFmt)
+ {
+ USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_SETVAR_TEXT), 0);
+ aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
+ }
+ }
+ break;
+
+ case TYP_FORMELFLD:
+ {
+ USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_GETVAR_NAME), 0);
+ aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
+ }
+ break;
+
+ case TYP_GETFLD:
+ {
+ USHORT nPos = aNumFormatLB.InsertEntry(SW_RESSTR(FMT_GETVAR_NAME), 0);
+ aNumFormatLB.SetEntryData(nPos, (void *)ULONG_MAX);
+ }
+ break;
+ }
+
+ if (IsFldEdit() && bSpecialFmt)
+ {
+ if (nTypeId == TYP_USERFLD && (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_CMD))
+ aNumFormatLB.SelectEntryPos(1);
+ else
+ aNumFormatLB.SelectEntryPos(0);
+ }
+ else
+ {
+ if (!nOldNumFormat && (nNumFormatSel = aNumFormatLB.GetEntryPos(sOldNumSel)) != LISTBOX_ENTRY_NOTFOUND)
+ aNumFormatLB.SelectEntryPos(nNumFormatSel);
+ else if (nOldNumFormat && nOldNumFormat == ULONG_MAX)
+ aNumFormatLB.SelectEntry(sOldSel);
+ }
+
+ USHORT nSize = GetFldMgr().GetFormatCount(nTypeId, FALSE, IsFldDlgHtmlMode());
+
+ for (USHORT i = 0; i < nSize; i++)
+ {
+ USHORT nPos = aFormatLB.InsertEntry(GetFldMgr().GetFormatStr(nTypeId, i));
+ USHORT nFldId = GetFldMgr().GetFormatId( nTypeId, i );
+ aFormatLB.SetEntryData( nPos, reinterpret_cast<void*>(nFldId) );
+ if (IsFldEdit() && nFldId == GetCurField()->GetFormat())
+ aFormatLB.SelectEntryPos( nPos );
+ }
+
+ if (nSize && (!IsFldEdit() || !aFormatLB.GetSelectEntryCount()))
+ {
+ aFormatLB.SelectEntry(sOldSel);
+
+ if (!aFormatLB.GetSelectEntryCount())
+ {
+ aFormatLB.SelectEntry(SW_RESSTR(FMT_NUM_PAGEDESC));
+ if (!aFormatLB.GetSelectEntryCount())
+ {
+ aFormatLB.SelectEntry(SW_RESSTR(FMT_NUM_ARABIC));
+ if (!aFormatLB.GetSelectEntryCount())
+ aFormatLB.SelectEntryPos(0);
+ }
+ }
+ }
+
+ return nSize;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Modify
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldVarPage, ModifyHdl, Edit *, EMPTYARG )
+{
+ String sValue(aValueED.GetText());
+ BOOL bHasValue = sValue.Len() != 0;
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+ BOOL bInsert = FALSE, bApply = FALSE, bDelete = FALSE;
+
+ String sName( aNameED.GetText() );
+ xub_StrLen nLen = sName.Len();
+
+ switch( nTypeId )
+ {
+ case TYP_DDEFLD:
+ case TYP_USERFLD:
+ case TYP_SETFLD:
+ case TYP_SEQFLD:
+ SwCalc::IsValidVarName( sName, &sName );
+ if( sName.Len() != nLen )
+ {
+ nLen = sName.Len();
+ Selection aSel(aNameED.GetSelection());
+ aNameED.SetText( sName );
+ aNameED.SetSelection( aSel ); // Cursorpos restaurieren
+ }
+ break;
+ }
+
+
+ // Buttons ueberpruefen
+ switch (nTypeId)
+ {
+ case TYP_DDEFLD:
+ if( nLen )
+ {
+ // Gibts schon einen entsprechenden Type
+ bInsert = bApply = TRUE;
+
+ SwFieldType* pType = GetFldMgr().GetFldType(RES_DDEFLD, sName);
+
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh && pType)
+ bDelete = !pSh->IsUsed( *pType );
+ }
+ break;
+
+ case TYP_USERFLD:
+ if( nLen )
+ {
+ // Gibts schon einen entsprechenden Type
+ SwFieldType* pType = GetFldMgr().GetFldType(RES_USERFLD, sName);
+
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh && pType)
+ bDelete = !pSh->IsUsed( *pType );
+
+ pType = GetFldMgr().GetFldType(RES_SETEXPFLD, sName);
+ if (!pType) // Kein Namenskonflikt mit Variablen
+ {
+ // Benutzerfelder duerfen auch ohne Inhalt eingefuegt werden!
+ // Bug #56845
+ bInsert = bApply = TRUE;
+ }
+ }
+ break;
+
+ default:
+ bInsert = TRUE;
+
+ if (nTypeId == TYP_SETFLD || nTypeId == TYP_SEQFLD)
+ {
+ SwSetExpFieldType* pFldType = (SwSetExpFieldType*)
+ GetFldMgr().GetFldType(RES_SETEXPFLD, sName);
+
+ if (pFldType)
+ {
+
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ const SwFldTypes* p = pSh->GetDoc()->GetFldTypes();
+ USHORT i;
+
+ for (i = 0; i < INIT_FLDTYPES; i++)
+ {
+ SwFieldType* pType = (*p)[ i ];
+ if (pType == pFldType)
+ break;
+ }
+
+ if (i >= INIT_FLDTYPES && !pSh->IsUsed(*pFldType))
+ bDelete = TRUE;
+
+ if (nTypeId == TYP_SEQFLD && !(pFldType->GetType() & nsSwGetSetExpType::GSE_SEQ))
+ bInsert = FALSE;
+
+ if (nTypeId == TYP_SETFLD && (pFldType->GetType() & nsSwGetSetExpType::GSE_SEQ))
+ bInsert = FALSE;
+ }
+ }
+ if (GetFldMgr().GetFldType(RES_USERFLD, sName))
+ bInsert = FALSE;
+ }
+
+ if( !nLen && ( nTypeId == TYP_SETFLD ||
+ (!IsFldEdit() && nTypeId == TYP_GETFLD ) ) )
+ bInsert = FALSE;
+
+ if( (nTypeId == TYP_SETFLD || nTypeId == TYP_FORMELFLD) &&
+ !bHasValue )
+ bInsert = FALSE;
+ break;
+ }
+
+ aNewDelTBX.EnableItem(BT_VARAPPLY, bApply);
+ aNewDelTBX.EnableItem(BT_VARDELETE, bDelete);
+ EnableInsert(bInsert);
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldVarPage, TBClickHdl, ToolBox *, pBox )
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ switch (pBox->GetCurItemId())
+ {
+ case BT_VARDELETE:
+ {
+ if( nTypeId == TYP_USERFLD )
+ GetFldMgr().RemoveFldType(RES_USERFLD, aSelectionLB.GetSelectEntry());
+ else
+ {
+ USHORT nWhich;
+
+ switch(nTypeId)
+ {
+ case TYP_SETFLD:
+ case TYP_SEQFLD:
+ nWhich = RES_SETEXPFLD;
+ break;
+ default:
+ nWhich = RES_DDEFLD;
+ break;
+ }
+
+ GetFldMgr().RemoveFldType(nWhich, aSelectionLB.GetSelectEntry());
+ }
+
+ UpdateSubType();
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ pSh->SetModified();
+ }
+ }
+ break;
+
+ case BT_VARAPPLY:
+ {
+ String sName(aNameED.GetText()), sValue(aValueED.GetText());
+ SwFieldType* pType = 0;
+ USHORT nId = 0;
+ USHORT nNumFormatPos = aNumFormatLB.GetSelectEntryPos();
+
+ switch (nTypeId)
+ {
+ case TYP_USERFLD: nId = RES_USERFLD; break;
+ case TYP_DDEFLD: nId = RES_DDEFLD; break;
+ case TYP_SETFLD: nId = RES_SETEXPFLD;break;
+ }
+ pType = GetFldMgr().GetFldType(nId, sName);
+
+ ULONG nFormat = aFormatLB.GetSelectEntryPos();
+ if (nFormat != LISTBOX_ENTRY_NOTFOUND)
+ nFormat = (ULONG)aFormatLB.GetEntryData((USHORT)nFormat);
+
+ if (pType) // Aendern
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ pSh->StartAllAction();
+
+ if (nTypeId == TYP_USERFLD)
+ {
+ if (nNumFormatPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ ULONG nFmt = nNumFormatPos == 0 ? 0 : aNumFormatLB.GetFormat();
+ if (nFmt)
+ { // Sprache auf Office-Sprache umstellen, da String im Office
+ // Format vom Kalkulator erwartet wird und so in den Dlg
+ // eingegeben werden sollte
+ nFmt = SwValueField::GetSystemFormat(pSh->GetNumberFormatter(), nFmt);
+ }
+ ((SwUserFieldType*)pType)->SetContent(aValueED.GetText(), nFmt);
+ ((SwUserFieldType*)pType)->SetType(
+ nNumFormatPos == 0 ? nsSwGetSetExpType::GSE_STRING : nsSwGetSetExpType::GSE_EXPR );
+ }
+ }
+ else
+ {
+ if (nFormat != LISTBOX_ENTRY_NOTFOUND)
+ {
+ //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
+ // Namen haben! Wird hier noch nicht beachtet.
+ USHORT nTmpPos = sValue.SearchAndReplace( ' ', sfx2::cTokenSeperator );
+ sValue.SearchAndReplace( ' ', sfx2::cTokenSeperator, nTmpPos );
+ ((SwDDEFieldType*)pType)->SetCmd(sValue);
+ ((SwDDEFieldType*)pType)->SetType((USHORT)nFormat);
+ }
+ }
+ pType->UpdateFlds();
+
+ pSh->EndAllAction();
+ }
+ }
+ else // Neu
+ {
+ if(nTypeId == TYP_USERFLD)
+ {
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ SwUserFieldType aType( pSh->GetDoc(), sName );
+
+ if (nNumFormatPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ aType.SetType(nNumFormatPos == 0 ? nsSwGetSetExpType::GSE_STRING : nsSwGetSetExpType::GSE_EXPR);
+ aType.SetContent( sValue, nNumFormatPos == 0 ? 0 : aNumFormatLB.GetFormat() );
+ aSelectionLB.InsertEntry(sName);
+ aSelectionLB.SelectEntry(sName);
+ GetFldMgr().InsertFldType( aType ); // Userfld Neu
+ }
+ }
+ }
+ else
+ {
+ if (nFormat != LISTBOX_ENTRY_NOTFOUND)
+ {
+ //JP 28.08.95: DDE-Topics/-Items koennen Blanks in ihren
+ // Namen haben! Wird hier noch nicht beachtet.
+ USHORT nTmpPos = sValue.SearchAndReplace( ' ', sfx2::cTokenSeperator );
+ sValue.SearchAndReplace( ' ', sfx2::cTokenSeperator, nTmpPos );
+
+ SwDDEFieldType aType(sName, sValue, (USHORT)nFormat);
+ aSelectionLB.InsertEntry(sName);
+ aSelectionLB.SelectEntry(sName);
+ GetFldMgr().InsertFldType(aType); // DDE-Feld Neu
+ }
+ }
+ }
+ if (IsFldEdit())
+ GetFldMgr().GetCurFld(); // FieldManager Updaten
+
+ UpdateSubType();
+ }
+ break;
+ }
+
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldVarPage, ChapterHdl, ListBox *, EMPTYARG )
+{
+ BOOL bEnable = aChapterLevelLB.GetSelectEntryPos() != 0;
+
+ aSeparatorED.Enable(bEnable);
+ aSeparatorFT.Enable(bEnable);
+ SeparatorHdl();
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFldVarPage, SeparatorHdl, Edit *, EMPTYARG )
+{
+ BOOL bEnable = aSeparatorED.GetText().Len() != 0 ||
+ aChapterLevelLB.GetSelectEntryPos() == 0;
+ EnableInsert(bEnable);
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL SwFldVarPage::FillItemSet(SfxItemSet& )
+{
+ USHORT nTypeId = (USHORT)(ULONG)aTypeLB.GetEntryData(GetTypeSel());
+
+ String aVal(aValueED.GetText());
+ String aName(aNameED.GetText());
+
+ USHORT nSubType = aSelectionLB.GetSelectEntryPos();
+ if(nSubType == LISTBOX_ENTRY_NOTFOUND)
+ nSubType = 0;
+ else
+ nSubType = (USHORT)(ULONG)aSelectionLB.GetEntryData(nSubType);
+
+ ULONG nFormat;
+
+ if (!aNumFormatLB.IsVisible())
+ {
+ nFormat = aFormatLB.GetSelectEntryPos();
+
+ if(nFormat == LISTBOX_ENTRY_NOTFOUND)
+ nFormat = 0;
+ else
+ nFormat = (ULONG)aFormatLB.GetEntryData((USHORT)nFormat);
+ }
+ else
+ {
+ nFormat = aNumFormatLB.GetFormat();
+
+ if (nFormat && nFormat != ULONG_MAX && aNumFormatLB.IsAutomaticLanguage())
+ {
+ // Sprache auf Office-Sprache umstellen, da String im Office-
+ // Format vom Kalkulator erwartet wird und so in den Dlg
+ // eingegeben werden sollte
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ if(pSh)
+ {
+ nFormat = SwValueField::GetSystemFormat(pSh->GetNumberFormatter(), nFormat);
+ }
+ }
+ }
+ sal_Unicode cSeparator = ' ';
+ switch (nTypeId)
+ {
+ case TYP_USERFLD:
+ {
+ nSubType = (nFormat == ULONG_MAX) ? nsSwGetSetExpType::GSE_STRING : nsSwGetSetExpType::GSE_EXPR;
+
+ if (nFormat == ULONG_MAX && aNumFormatLB.GetSelectEntry() == SW_RESSTR(FMT_USERVAR_CMD))
+ nSubType |= nsSwExtendedSubType::SUB_CMD;
+
+ if (aInvisibleCB.IsChecked())
+ nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
+ break;
+ }
+ case TYP_FORMELFLD:
+ {
+ nSubType = nsSwGetSetExpType::GSE_FORMULA;
+ if (aNumFormatLB.IsVisible() && nFormat == ULONG_MAX)
+ nSubType |= nsSwExtendedSubType::SUB_CMD;
+ break;
+ }
+ case TYP_GETFLD:
+ {
+ nSubType &= 0xff00;
+ if (aNumFormatLB.IsVisible() && nFormat == ULONG_MAX)
+ nSubType |= nsSwExtendedSubType::SUB_CMD;
+ break;
+ }
+ case TYP_INPUTFLD:
+ {
+ SwFieldType* pType = GetFldMgr().GetFldType(RES_USERFLD, aName);
+ nSubType = static_cast< USHORT >((nSubType & 0xff00) | ((pType) ? INP_USR : INP_VAR));
+ break;
+ }
+
+ case TYP_SETFLD:
+ {
+ if (IsFldDlgHtmlMode())
+ {
+ nSubType = 0x0100;
+ nSubType = (nSubType & 0xff00) | nsSwGetSetExpType::GSE_STRING;
+ }
+ else
+ nSubType = (nSubType & 0xff00) | ((nFormat == ULONG_MAX) ? nsSwGetSetExpType::GSE_STRING : nsSwGetSetExpType::GSE_EXPR);
+
+ if (aInvisibleCB.IsChecked())
+ nSubType |= nsSwExtendedSubType::SUB_INVISIBLE;
+ break;
+ }
+ case TYP_SEQFLD:
+ {
+ // nSubType = nsSwGetSetExpType::GSE_SEQ; // nsSwGetSetExpType::GSE_SEQ wird im Fldmgr fest gesetzt, kann also entfallen
+ nSubType = aChapterLevelLB.GetSelectEntryPos();
+ if (nSubType == 0)
+ nSubType = 0x7f;
+ else
+ {
+ nSubType--;
+ String sSeparator(aSeparatorED.GetText().GetChar(0));
+ cSeparator = sSeparator.Len() ? sSeparator.GetChar(0) : ' ';
+ //nSubType |= (USHORT)(((BYTE)) << 8);
+ }
+ break;
+ }
+ case TYP_GETREFPAGEFLD:
+ if( SVX_NUM_CHAR_SPECIAL == nFormat )
+ aVal = aValueED.GetText();
+ break;
+ }
+
+ if (!IsFldEdit() ||
+ aNameED.GetSavedValue() != aNameED.GetText() ||
+ aValueED.GetSavedValue() != aValueED.GetText() ||
+ aSelectionLB.GetSavedValue() != aSelectionLB.GetSelectEntryPos() ||
+ aFormatLB.GetSavedValue() != aFormatLB.GetSelectEntryPos() ||
+ nOldFormat != aNumFormatLB.GetFormat() ||
+ aInvisibleCB.GetState() != aInvisibleCB.GetSavedValue() ||
+ aChapterLevelLB.GetSavedValue() != aChapterLevelLB.GetSelectEntryPos() ||
+ aSeparatorED.GetSavedValue() != aSeparatorED.GetText())
+ {
+ InsertFld( nTypeId, nSubType, aName, aVal, nFormat,
+ cSeparator, aNumFormatLB.IsAutomaticLanguage() );
+ }
+
+ UpdateSubType();
+
+ return FALSE;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* SwFldVarPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet )
+{
+ return ( new SwFldVarPage( pParent, rAttrSet ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFldVarPage::GetGroup()
+{
+ return GRP_VAR;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SelectionListBox::SelectionListBox( SwFldVarPage* pDialog, const ResId& rResId ) :
+ ListBox (pDialog, rResId),
+ pDlg (pDialog),
+ bCallAddSelection(FALSE)
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+long SelectionListBox::PreNotify( NotifyEvent& rNEvt )
+{
+ long nHandled = ListBox::PreNotify( rNEvt );
+ //BOOL bAddSel = FALSE;
+ if ( rNEvt.GetType() == EVENT_KEYUP )
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ const KeyCode aKeyCode = pKEvt->GetKeyCode();
+ const USHORT nModifier = aKeyCode.GetModifier();
+ if( aKeyCode.GetCode() == KEY_SPACE && !nModifier)
+// bAddSel = TRUE;
+ bCallAddSelection = TRUE;
+ }
+ if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
+ {
+ const MouseEvent* pMEvt = rNEvt.GetMouseEvent();
+
+ if (pMEvt && (pMEvt->IsMod1() || pMEvt->IsMod2())) // Alt oder Ctrl
+ //bAddSel = TRUE;
+ bCallAddSelection = TRUE;
+ }
+
+// if (bAddSel)
+// pDlg->AddSelection(this);
+
+ return nHandled;
+}
+/* -----------------12.01.99 11:14-------------------
+ *
+ * --------------------------------------------------*/
+void SwFldVarPage::FillUserData()
+{
+ String sData(String::CreateFromAscii(USER_DATA_VERSION));
+ sData += ';';
+ USHORT nTypeSel = aTypeLB.GetSelectEntryPos();
+ if( LISTBOX_ENTRY_NOTFOUND == nTypeSel )
+ nTypeSel = USHRT_MAX;
+ else
+ nTypeSel = (USHORT)(ULONG)aTypeLB.GetEntryData( nTypeSel );
+ sData += String::CreateFromInt32( nTypeSel );
+ SetUserData(sData);
+}
+
diff --git a/sw/source/ui/fldui/fldvar.hxx b/sw/source/ui/fldui/fldvar.hxx
new file mode 100644
index 000000000000..dd4665198589
--- /dev/null
+++ b/sw/source/ui/fldui/fldvar.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWFLDVAR_HXX
+#define _SWFLDVAR_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/group.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/edit.hxx>
+
+#include "fldpage.hxx"
+#include "condedit.hxx"
+#include "numfmtlb.hxx"
+
+class SwFldVarPage;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SelectionListBox : public ListBox
+{
+ SwFldVarPage* pDlg;
+ BOOL bCallAddSelection;
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+
+public:
+ SelectionListBox( SwFldVarPage* pDialog, const ResId& rResId );
+
+ // Selektieren per Ctrl oder Alt erkennen und mit SelectHdl auswerten
+ BOOL IsCallAddSelection() const {return bCallAddSelection;}
+ void ResetCallAddSelection() {bCallAddSelection = FALSE;}
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwFldVarPage : public SwFldPage
+{
+ friend class SelectionListBox;
+
+ FixedText aTypeFT;
+ ListBox aTypeLB;
+ FixedText aSelectionFT;
+ SelectionListBox aSelectionLB;
+ FixedText aNameFT;
+ Edit aNameED;
+ FixedText aValueFT;
+ ConditionEdit aValueED;
+ FixedText aFormatFT;
+ NumFormatListBox aNumFormatLB;
+ ListBox aFormatLB;
+ FixedText aChapterHeaderFT;
+ FixedText aChapterLevelFT;
+ ListBox aChapterLevelLB;
+ CheckBox aInvisibleCB;
+ FixedText aSeparatorFT;
+ Edit aSeparatorED;
+ ToolBox aNewDelTBX;
+
+ String sOldValueFT;
+ String sOldNameFT;
+
+ ULONG nOldFormat;
+ BOOL bInit;
+
+ DECL_LINK( TypeHdl, ListBox* pLB = 0 );
+ DECL_LINK( SubTypeHdl, ListBox* pLB = 0 );
+ DECL_LINK( ModifyHdl, Edit *pED = 0 );
+ DECL_LINK( TBClickHdl, ToolBox *pTB = 0);
+ DECL_LINK( ChapterHdl, ListBox *pLB = 0);
+ DECL_LINK( SeparatorHdl, Edit *pED = 0 );
+
+ void UpdateSubType();
+ USHORT FillFormatLB(USHORT nTypeId);
+
+protected:
+ virtual USHORT GetGroup();
+
+public:
+ SwFldVarPage(Window* pParent, const SfxItemSet& rSet);
+
+ ~SwFldVarPage();
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ virtual void FillUserData();
+};
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/fldvar.src b/sw/source/ui/fldui/fldvar.src
new file mode 100644
index 000000000000..7057096f72ab
--- /dev/null
+++ b/sw/source/ui/fldui/fldvar.src
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "fldtdlg.hrc"
+#include "helpid.h"
+#include "cmdid.h"
+TabPage TP_FLD_VAR
+{
+ HelpID = HID_FLD_VAR ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_VARTYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Type" ;
+ Left = TRUE ;
+ };
+ ListBox LB_VARTYPE
+ {
+ HelpID = "sw:ListBox:TP_FLD_VAR:LB_VARTYPE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 135 ) ;
+ TabStop = TRUE ;
+ Sort = FALSE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_VARSELECTION
+ {
+ Pos = MAP_APPFONT ( 88 , 3 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "S~election" ;
+ };
+ ListBox LB_VARSELECTION
+ {
+ HelpID = "sw:ListBox:TP_FLD_VAR:LB_VARSELECTION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 14 ) ;
+ Size = MAP_APPFONT ( 76 , 135 ) ;
+ TabStop = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_VARFORMAT
+ {
+ Pos = MAP_APPFONT ( 170 , 3 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Format" ;
+ };
+ ListBox LB_VARFORMAT
+ {
+ HelpID = "sw:ListBox:TP_FLD_VAR:LB_VARFORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 14 ) ;
+ Size = MAP_APPFONT ( 84 , 123 ) ;
+ TabStop = TRUE ;
+ DropDown = FALSE ;
+ };
+ ListBox LB_VARNUMFORMAT
+ {
+ HelpID = "sw:ListBox:TP_FLD_VAR:LB_VARNUMFORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 170 , 14 ) ;
+ Size = MAP_APPFONT ( 84 , 123 ) ;
+ TabStop = TRUE ;
+ DropDown = FALSE ;
+ };
+ CheckBox CB_VARINVISIBLE
+ {
+ HelpID = "sw:CheckBox:TP_FLD_VAR:CB_VARINVISIBLE";
+ Pos = MAP_APPFONT ( 170 , 141 ) ;
+ Size = MAP_APPFONT ( 84 , 10 ) ;
+ Text [ en-US ] = "Invisi~ble" ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_VARCHAPTERHEADER
+ {
+ Pos = MAP_APPFONT ( 170 , 112 ) ;
+ Size = MAP_APPFONT ( 84 , 8 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Numbering by chapter" ;
+ };
+ FixedText FT_VARCHAPTERLEVEL
+ {
+ Pos = MAP_APPFONT ( 175 , 125 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Level" ;
+ };
+ ListBox LB_VARCHAPTERLEVEL
+ {
+ HelpID = "sw:ListBox:TP_FLD_VAR:LB_VARCHAPTERLEVEL";
+ Border = TRUE ;
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 208 , 123 ) ;
+ Size = MAP_APPFONT ( 46 , 76 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "None" ; > ;
+ };
+ };
+ FixedText FT_VARSEPARATOR
+ {
+ Pos = MAP_APPFONT ( 175 , 140 ) ;
+ Size = MAP_APPFONT ( 30 , 10 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Separator" ;
+ };
+ Edit ED_VARSEPARATOR
+ {
+ HelpID = "sw:Edit:TP_FLD_VAR:ED_VARSEPARATOR";
+ Pos = MAP_APPFONT ( 208 , 138 ) ;
+ Size = MAP_APPFONT ( 46 , 12 ) ;
+ Border = TRUE ;
+ Hide = TRUE ;
+ MaxTextLength = 1 ;
+ TEXT = "." ;
+ };
+ FixedText FT_VARNAME
+ {
+ Pos = MAP_APPFONT ( 6 , 155 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Na~me" ;
+ };
+ Edit ED_VARNAME
+ {
+ HelpID = "sw:Edit:TP_FLD_VAR:ED_VARNAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 166 ) ;
+ Size = MAP_APPFONT ( 76 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_VARVALUE
+ {
+ Pos = MAP_APPFONT ( 88 , 155 ) ;
+ Size = MAP_APPFONT ( 76 , 8 ) ;
+ Text [ en-US ] = "~Value" ;
+ Left = TRUE ;
+ };
+ Edit ED_VARVALUE
+ {
+ HelpID = "sw:Edit:TP_FLD_VAR:ED_VARVALUE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 166 ) ;
+ Size = MAP_APPFONT ( 76 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ ToolBox TBX_VARNEWDEL
+ {
+ Pos = MAP_APPFONT ( 167 , 167 ) ;
+ SVLook = TRUE ;
+ Border = FALSE ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = BT_VARAPPLY ;
+ HelpID = HID_FLDVAR_APPLY ;
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap{ File = "sc20558.bmp" ;};
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ Text [ en-US ] = "Apply" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = BT_VARDELETE ;
+ HelpID = HID_FLDVAR_DELETE ;
+ ItemImage = Image
+ {
+ ImageBitmap = Bitmap{ File = "sc20557.bmp" ;};
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ Text [ en-US ] = "Delete" ;
+ };
+ };
+ };
+ Text [ en-US ] = "Variables" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/fldwrap.cxx b/sw/source/ui/fldui/fldwrap.cxx
new file mode 100644
index 000000000000..18f291d5b6e6
--- /dev/null
+++ b/sw/source/ui/fldui/fldwrap.cxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <swtypes.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/htmlmode.hxx>
+#include <viewopt.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <fldwrap.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <swmodule.hxx>
+
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _FLDTDLG_HRC
+#include <fldtdlg.hrc>
+#endif
+#include "swabstdlg.hxx"
+
+SFX_IMPL_CHILDWINDOW(SwFldDlgWrapper, FN_INSERT_FIELD)
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwChildWinWrapper::SwChildWinWrapper(Window *pParentWindow, USHORT nId) :
+ SfxChildWindow(pParentWindow, nId),
+ m_pDocSh(0)
+{
+ // Flackern der Buttons vermeiden:
+ m_aUpdateTimer.SetTimeout(200);
+ m_aUpdateTimer.SetTimeoutHdl(LINK(this, SwChildWinWrapper, UpdateHdl));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwChildWinWrapper, UpdateHdl, void*, EMPTYARG )
+{
+ GetWindow()->Activate(); // Dialog aktualisieren
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nach Dok-Wechsel Dialog neu initialisieren
+ --------------------------------------------------------------------*/
+
+BOOL SwChildWinWrapper::ReInitDlg(SwDocShell *)
+{
+ BOOL bRet = FALSE;
+
+ if (m_pDocSh != GetOldDocShell())
+ {
+ m_aUpdateTimer.Stop();
+ bRet = TRUE; // Sofortiges Update
+ }
+ else
+ m_aUpdateTimer.Start();
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxChildWinInfo SwFldDlgWrapper::GetInfo() const
+{
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
+ aInfo.aPos = GetWindow()->OutputToAbsoluteScreenPixel(aInfo.aPos);
+ return aInfo;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFldDlgWrapper::SwFldDlgWrapper( Window* _pParent, USHORT nId,
+ SfxBindings* pB,
+ SfxChildWinInfo* )
+ : SwChildWinWrapper( _pParent, nId )
+{
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwFldDlg* pDlg = pFact->CreateSwFldDlg(pB, this, _pParent, DLG_FLD_INSERT );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlgInterface = pDlg;
+ pWindow = pDlg->GetWindow();
+ pDlg->Start();
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nach Dok-Wechsel Dialog neu initialisieren
+ --------------------------------------------------------------------*/
+
+BOOL SwFldDlgWrapper::ReInitDlg(SwDocShell *pDocSh)
+{
+ BOOL bRet;
+
+ if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh)) == TRUE) // Sofort aktualisieren, Dok-Wechsel
+ {
+ pDlgInterface->ReInitDlg();
+ }
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFldDlgWrapper::ShowPage(USHORT nPage)
+{
+ pDlgInterface->ShowPage(nPage ? nPage : TP_FLD_REF);
+}
+
+SFX_IMPL_CHILDWINDOW(SwFldDataOnlyDlgWrapper, FN_INSERT_FIELD_DATA_ONLY)
+
+/* -----------------04.02.2003 14:17-----------------
+ *
+ * --------------------------------------------------*/
+SfxChildWinInfo SwFldDataOnlyDlgWrapper::GetInfo() const
+{
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
+// prevent instatiation of dialog other than by calling
+// the mail merge dialog
+ aInfo.bVisible = FALSE;
+ return aInfo;
+}
+/* -----------------04.02.2003 14:17-----------------
+ *
+ * --------------------------------------------------*/
+SwFldDataOnlyDlgWrapper::SwFldDataOnlyDlgWrapper( Window* _pParent, USHORT nId,
+ SfxBindings* pB,
+ SfxChildWinInfo* pInfo )
+ : SwChildWinWrapper( _pParent, nId )
+{
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwFldDlg* pDlg = pFact->CreateSwFldDlg(pB, this, _pParent, DLG_FLD_INSERT );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlgInterface = pDlg;
+
+ pWindow = pDlg->GetWindow();
+ pDlg->ActivateDatabasePage();
+ pDlg->Start();
+ pDlg->Initialize( pInfo );
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+}
+/* -----------------04.02.2003 14:17-----------------
+ * re-init after doc activation
+ * --------------------------------------------------*/
+BOOL SwFldDataOnlyDlgWrapper::ReInitDlg(SwDocShell *pDocSh)
+{
+ BOOL bRet;
+ if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh)) == TRUE) // Sofort aktualisieren, Dok-Wechsel
+ {
+ pDlgInterface->ReInitDlg();
+ }
+
+ return bRet;
+}
diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx
new file mode 100644
index 000000000000..6676b72a1f84
--- /dev/null
+++ b/sw/source/ui/fldui/inpdlg.cxx
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include <vcl/msgbox.hxx>
+#include <unotools/charclass.hxx>
+#include <editeng/unolingu.hxx>
+#include <wrtsh.hxx>
+#include <fldbas.hxx>
+#include <expfld.hxx>
+#include <usrfld.hxx>
+#include <inpdlg.hxx>
+#include <fldmgr.hxx>
+
+#include <fldui.hrc>
+#include <inpdlg.hrc>
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Feldeinfuegen bearbeiten
+ --------------------------------------------------------------------*/
+
+SwFldInputDlg::SwFldInputDlg( Window *pParent, SwWrtShell &rS,
+ SwField* pField, BOOL bNextButton ) :
+
+ SvxStandardDialog(pParent, SW_RES(DLG_FLD_INPUT)),
+
+ rSh( rS ),
+ pInpFld(0),
+ pSetFld(0),
+ pUsrType(0),
+
+ aLabelED (this, SW_RES(ED_LABEL )),
+ aEditED (this, SW_RES(ED_EDIT )),
+ aEditFL (this, SW_RES(FL_EDIT )),
+
+ aOKBT (this, SW_RES(BT_OK )),
+ aCancelBT (this, SW_RES(BT_CANCEL )),
+ aNextBT (this, SW_RES(PB_NEXT )),
+ aHelpBT (this, SW_RES(PB_HELP ))
+{
+ // Font fuers Edit umschalten
+ Font aFont(aEditED.GetFont());
+ aFont.SetWeight(WEIGHT_LIGHT);
+ aEditED.SetFont(aFont);
+
+ if( bNextButton )
+ {
+ aNextBT.Show();
+ aNextBT.SetClickHdl(LINK(this, SwFldInputDlg, NextHdl));
+ }
+ else
+ {
+ long nDiff = aCancelBT.GetPosPixel().Y() - aOKBT.GetPosPixel().Y();
+ Point aPos = aHelpBT.GetPosPixel();
+ aPos.Y() -= nDiff;
+ aHelpBT.SetPosPixel(aPos);
+ }
+
+ // Auswertung hier
+ String aStr;
+ if( RES_INPUTFLD == pField->GetTyp()->Which() )
+ { // Es ist eine Eingabefeld
+ //
+ pInpFld = (SwInputField*)pField;
+ aLabelED.SetText( pInpFld->GetPar2() );
+ USHORT nSubType = pInpFld->GetSubType();
+
+ switch(nSubType & 0xff)
+ {
+ case INP_TXT:
+ aStr = pInpFld->GetPar1();
+ break;
+
+ case INP_USR:
+ // Benutzerfeld
+ if( 0 != ( pUsrType = (SwUserFieldType*)rSh.GetFldType(
+ RES_USERFLD, pInpFld->GetPar1() ) ) )
+ aStr = pUsrType->GetContent();
+ break;
+ }
+ }
+ else
+ {
+ // es ist eine SetExpression
+ pSetFld = (SwSetExpField*)pField;
+ String sFormula(pSetFld->GetFormula());
+ //values are formatted - formulas are not
+ CharClass aCC( SvxCreateLocale( pSetFld->GetLanguage() ));
+ if( aCC.isNumeric( sFormula ))
+ {
+ aStr = pSetFld->ExpandField(true);
+ }
+ else
+ aStr = sFormula;
+ aLabelED.SetText( pSetFld->GetPromptText() );
+ }
+
+ // JP 31.3.00: Inputfields in readonly regions must be allowed to
+ // input any content. - 74639
+ BOOL bEnable = !rSh.IsCrsrReadonly();
+ /*!rSh.IsReadOnlyAvailable() || !rSh.HasReadonlySel()*/;
+ aOKBT.Enable( bEnable );
+ aEditED.SetReadOnly( !bEnable );
+
+ if( aStr.Len() )
+ aEditED.SetText( aStr.ConvertLineEnd() );
+ FreeResource();
+}
+
+SwFldInputDlg::~SwFldInputDlg()
+{
+}
+
+void SwFldInputDlg::StateChanged( StateChangedType nType )
+{
+ if ( nType == STATE_CHANGE_INITSHOW )
+ aEditED.GrabFocus();
+ SvxStandardDialog::StateChanged( nType );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Schliessen
+ --------------------------------------------------------------------*/
+
+void SwFldInputDlg::Apply()
+{
+ String aTmp( aEditED.GetText() );
+ aTmp.EraseAllChars( '\r' );
+
+ rSh.StartAllAction();
+ BOOL bModified = FALSE;
+ if(pInpFld)
+ {
+ if(pUsrType)
+ {
+ if( aTmp != pUsrType->GetContent() )
+ {
+ pUsrType->SetContent(aTmp);
+ pUsrType->UpdateFlds();
+ bModified = TRUE;
+ }
+ }
+ else if( aTmp != pInpFld->GetPar1() )
+ {
+ pInpFld->SetPar1(aTmp);
+ rSh.SwEditShell::UpdateFlds(*pInpFld);
+ bModified = TRUE;
+ }
+ }
+ else if( aTmp != pSetFld->GetPar2() )
+ {
+ pSetFld->SetPar2(aTmp);
+ rSh.SwEditShell::UpdateFlds(*pSetFld);
+ bModified = TRUE;
+ }
+
+ if( bModified )
+ rSh.SetUndoNoResetModified();
+
+ rSh.EndAllAction();
+}
+
+
+IMPL_LINK(SwFldInputDlg, NextHdl, PushButton*, EMPTYARG)
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+
+
diff --git a/sw/source/ui/fldui/inpdlg.hrc b/sw/source/ui/fldui/inpdlg.hrc
new file mode 100644
index 000000000000..bbd04c092010
--- /dev/null
+++ b/sw/source/ui/fldui/inpdlg.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define FT_LABEL 1
+#define ED_EDIT 3
+#define FL_EDIT 4
+#define BT_OK 5
+#define BT_CANCEL 6
+#define ED_LABEL 7
+#define PB_NEXT 8
+#define PB_HELP 9
diff --git a/sw/source/ui/fldui/inpdlg.src b/sw/source/ui/fldui/inpdlg.src
new file mode 100644
index 000000000000..799afe0ceaa8
--- /dev/null
+++ b/sw/source/ui/fldui/inpdlg.src
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "fldui.hrc"
+#include "inpdlg.hrc"
+#include "helpid.h"
+ModalDialog DLG_FLD_INPUT
+{
+ HelpID = HID_FLD_INPUT ;
+ OutputSize = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 194 , 119 ) ;
+ Text [ en-US ] = "Input Field" ;
+ Moveable = TRUE ;
+ /* FixedText FT_LABEL
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 115 , 8 ) ;
+ Text [ en-US ] = "Input" ;
+ Left = TRUE ;
+ };*/
+ Edit ED_LABEL
+ {
+ HelpID = "sw:Edit:DLG_FLD_INPUT:ED_LABEL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 115 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Text [ en-US ] = "Input" ;
+ Readonly = TRUE ;
+ };
+ MultiLineEdit ED_EDIT
+ {
+ HelpID = "sw:MultiLineEdit:DLG_FLD_INPUT:ED_EDIT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 115 , 72 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedLine FL_EDIT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 127 , 8 ) ;
+ Text [ en-US ] = "Edit" ;
+ };
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 139 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 139 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_NEXT
+ {
+ HelpID = "sw:PushButton:DLG_FLD_INPUT:PB_NEXT";
+ Pos = MAP_APPFONT ( 139 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Next" ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 139 , 60 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/javaedit.cxx b/sw/source/ui/fldui/javaedit.cxx
new file mode 100644
index 000000000000..443bc075b7db
--- /dev/null
+++ b/sw/source/ui/fldui/javaedit.cxx
@@ -0,0 +1,366 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+// include ---------------------------------------------------------------
+
+
+
+#define _JAVAEDIT_CXX
+#include <hintids.hxx>
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <vcl/svapp.hxx>
+#include <svl/urihelper.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <sfx2/docfile.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <docsh.hxx>
+#include <wrtsh.hxx>
+#include <fldbas.hxx>
+#include <fldmgr.hxx>
+#include <docufld.hxx>
+#include <uitool.hxx>
+#ifndef _JAVAEDIT_HXX
+#include <javaedit.hxx>
+#endif
+
+#ifndef _FLDUI_HRC
+#include <fldui.hrc>
+#endif
+#ifndef _JAVAEDIT_HRC
+#include <javaedit.hrc>
+#endif
+
+// static ----------------------------------------------------------------
+
+// class SwJavaEditDialog ------------------------------------------------
+
+
+
+SwJavaEditDialog::SwJavaEditDialog(Window* pParent, SwWrtShell* pWrtSh) :
+
+ SvxStandardDialog(pParent, SW_RES(DLG_JAVAEDIT)),
+
+ aTypeFT ( this, SW_RES( FT_TYPE ) ),
+ aTypeED ( this, SW_RES( ED_TYPE ) ),
+ aUrlRB ( this, SW_RES( RB_URL ) ),
+ aEditRB ( this, SW_RES( RB_EDIT ) ),
+ aUrlPB ( this, SW_RES( PB_URL ) ),
+ aUrlED ( this, SW_RES( ED_URL ) ),
+ aEditED ( this, SW_RES( ED_EDIT ) ),
+ aPostItFL ( this, SW_RES( FL_POSTIT ) ),
+
+ aOKBtn ( this, SW_RES( BTN_POST_OK ) ),
+ aCancelBtn ( this, SW_RES( BTN_POST_CANCEL ) ),
+ aPrevBtn ( this, SW_RES( BTN_PREV ) ),
+ aNextBtn ( this, SW_RES( BTN_NEXT ) ),
+ aHelpBtn ( this, SW_RES( BTN_POST_HELP ) ),
+
+ bNew(TRUE),
+ bIsUrl(FALSE),
+
+ pSh(pWrtSh),
+ pFileDlg(NULL),
+ pOldDefDlgParent(NULL)
+{
+ // Handler installieren
+ aPrevBtn.SetClickHdl( LINK( this, SwJavaEditDialog, PrevHdl ) );
+ aNextBtn.SetClickHdl( LINK( this, SwJavaEditDialog, NextHdl ) );
+ aOKBtn.SetClickHdl( LINK( this, SwJavaEditDialog, OKHdl ) );
+
+ Link aLk = LINK(this, SwJavaEditDialog, RadioButtonHdl);
+ aUrlRB.SetClickHdl(aLk);
+ aEditRB.SetClickHdl(aLk);
+ aUrlPB.SetClickHdl(LINK(this, SwJavaEditDialog, InsertFileHdl));
+
+ Font aFont( aEditED.GetFont() );
+ aFont.SetWeight( WEIGHT_LIGHT );
+ aEditED.SetFont( aFont );
+
+ pMgr = new SwFldMgr;
+ pFld = (SwScriptField*)pMgr->GetCurFld();
+
+ bNew = !(pFld && pFld->GetTyp()->Which() == RES_SCRIPTFLD);
+
+ CheckTravel();
+
+ if( !bNew )
+ SetText( SW_RES( STR_JAVA_EDIT ) );
+ else
+ // neu anlegen
+ SetText( SW_RES( STR_JAVA_INSERT ) );
+
+ FreeResource();
+
+ RadioButtonHdl(NULL);
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+SwJavaEditDialog::~SwJavaEditDialog()
+{
+ delete pMgr;
+ delete pFileDlg;
+ Application::SetDefDialogParent( pOldDefDlgParent );
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+IMPL_LINK_INLINE_START( SwJavaEditDialog, PrevHdl, Button *, EMPTYARG )
+{
+ SetFld();
+ pMgr->GoPrev();
+ pFld = (SwScriptField*)pMgr->GetCurFld();
+ CheckTravel();
+ RadioButtonHdl(NULL);
+
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwJavaEditDialog, PrevHdl, Button *, EMPTYARG )
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+IMPL_LINK_INLINE_START( SwJavaEditDialog, NextHdl, Button *, EMPTYARG )
+{
+ SetFld();
+ pMgr->GoNext();
+ pFld = (SwScriptField*)pMgr->GetCurFld();
+ CheckTravel();
+ RadioButtonHdl(NULL);
+
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwJavaEditDialog, NextHdl, Button *, EMPTYARG )
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+IMPL_LINK( SwJavaEditDialog, OKHdl, Button *, EMPTYARG )
+{
+ SetFld();
+ EndDialog( RET_OK );
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+void SwJavaEditDialog::Apply()
+{
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+void SwJavaEditDialog::CheckTravel()
+{
+ BOOL bTravel = FALSE;
+ BOOL bNext(FALSE), bPrev(FALSE);
+
+ if(!bNew)
+ {
+ // Traveling nur bei mehr als einem Feld
+ pSh->StartAction();
+ pSh->CreateCrsr();
+
+ bNext = pMgr->GoNext();
+ if( bNext )
+ pMgr->GoPrev();
+
+ if( 0 != ( bPrev = pMgr->GoPrev() ) )
+ pMgr->GoNext();
+ bTravel |= bNext|bPrev;
+
+ pSh->DestroyCrsr();
+ pSh->EndAction();
+
+ if (pFld->IsCodeURL())
+ {
+ String sURL(pFld->GetPar2());
+ if(sURL.Len())
+ {
+ INetURLObject aINetURL(sURL);
+ if(INET_PROT_FILE == aINetURL.GetProtocol())
+ sURL = aINetURL.PathToFileName();
+ }
+ aUrlED.SetText(sURL);
+ aEditED.SetText(aEmptyStr);
+ aUrlRB.Check();
+ }
+ else
+ {
+ aEditED.SetText(pFld->GetPar2());
+ aUrlED.SetText(aEmptyStr);
+ aEditRB.Check();
+ }
+ aTypeED.SetText(pFld->GetPar1());
+ }
+
+ if ( !bTravel )
+ {
+ aPrevBtn.Hide();
+ aNextBtn.Hide();
+ }
+ else
+ {
+ aPrevBtn.Enable(bPrev);
+ aNextBtn.Enable(bNext);
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+void SwJavaEditDialog::SetFld()
+{
+ if( !aOKBtn.IsEnabled() )
+ return ;
+
+ aType = aTypeED.GetText();
+ bIsUrl = aUrlRB.IsChecked();
+
+ if( bIsUrl )
+ {
+ aText = aUrlED.GetText();
+ if(aText.Len())
+ {
+ SfxMedium* pMedium = pSh->GetView().GetDocShell()->GetMedium();
+ INetURLObject aAbs;
+ if( pMedium )
+ aAbs = pMedium->GetURLObject();
+
+ aText = URIHelper::SmartRel2Abs(
+ aAbs, aText, URIHelper::GetMaybeFileHdl());
+ }
+ }
+ else
+ aText = aEditED.GetText();
+
+ if( !aType.Len() )
+ aType = String::CreateFromAscii("JavaScript");
+}
+
+BOOL SwJavaEditDialog::IsUpdate()
+{
+ return pFld && ( bIsUrl != pFld->GetFormat() || pFld->GetPar2() != aType || pFld->GetPar1() != aText );
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwJavaEditDialog, RadioButtonHdl, RadioButton *, EMPTYARG )
+{
+ BOOL bEnable = aUrlRB.IsChecked();
+ aUrlPB.Enable(bEnable);
+ aUrlED.Enable(bEnable);
+ aEditED.Enable(!bEnable);
+
+ if( !bNew )
+ {
+ bEnable = !pSh->IsReadOnlyAvailable() || !pSh->HasReadonlySel();
+ aOKBtn.Enable( bEnable );
+ aUrlED.SetReadOnly( !bEnable );
+ aEditED.SetReadOnly( !bEnable);
+ aTypeED.SetReadOnly( !bEnable);
+ if( aUrlPB.IsEnabled() && !bEnable )
+ aUrlPB.Enable( FALSE );
+ }
+ return 0;
+}
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+IMPL_LINK( SwJavaEditDialog, InsertFileHdl, PushButton *, pBtn )
+{
+ if ( !pFileDlg )
+ {
+ pOldDefDlgParent = Application::GetDefDialogParent();
+ Application::SetDefDialogParent( pBtn );
+
+ pFileDlg = new ::sfx2::FileDialogHelper(
+ (SFXWB_INSERT | WB_3DLOOK), String::CreateFromAscii("swriter") );
+ }
+
+ pFileDlg->StartExecuteModal( LINK( this, SwJavaEditDialog, DlgClosedHdl ) );
+ return 0;
+}
+
+IMPL_LINK( SwJavaEditDialog, DlgClosedHdl, sfx2::FileDialogHelper *, EMPTYARG )
+{
+ if ( pFileDlg->GetError() == ERRCODE_NONE )
+ {
+ String sFileName = pFileDlg->GetPath();
+ if ( sFileName.Len() > 0 )
+ {
+ INetURLObject aINetURL( sFileName );
+ if ( INET_PROT_FILE == aINetURL.GetProtocol() )
+ sFileName = aINetURL.PathToFileName();
+ }
+ aUrlED.SetText( sFileName );
+ }
+
+ return 0;
+}
+
diff --git a/sw/source/ui/fldui/javaedit.hrc b/sw/source/ui/fldui/javaedit.hrc
new file mode 100644
index 000000000000..d7448936d4cb
--- /dev/null
+++ b/sw/source/ui/fldui/javaedit.hrc
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_JAVAEDIT_HRC
+#define _SW_JAVAEDIT_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FT_TYPE 10
+#define ED_TYPE 11
+#define RB_EDIT 12
+#define ED_EDIT 13
+#define FL_POSTIT 14
+#define BTN_PREV 15
+#define BTN_NEXT 16
+#define STR_JAVA_EDIT 17
+#define STR_JAVA_INSERT 18
+#define RB_URL 19
+#define ED_URL 20
+#define PB_URL 21
+
+#define BTN_POST_OK 30
+#define BTN_POST_CANCEL 31
+#define BTN_POST_HELP 32
+
+
+#endif
+
diff --git a/sw/source/ui/fldui/javaedit.src b/sw/source/ui/fldui/javaedit.src
new file mode 100644
index 000000000000..bae88ed1adc5
--- /dev/null
+++ b/sw/source/ui/fldui/javaedit.src
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // include ---------------------------------------------------------------
+#include "javaedit.hrc"
+#include "fldui.hrc"
+#include "helpid.h"
+ // pragma ----------------------------------------------------------------
+
+ // RID_SVXDLG_POSTIT -----------------------------------------------------
+ModalDialog DLG_JAVAEDIT
+{
+ HelpID = "sw:ModalDialog:DLG_JAVAEDIT";
+ OutputSize = TRUE ;
+ SvLook = TRUE ;
+ Size = MAP_APPFONT ( 248 , 157 ) ;
+ Moveable = TRUE ;
+ FixedText FT_TYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 15 ) ;
+ Size = MAP_APPFONT ( 55 , 10 ) ;
+ Text [ en-US ] = "Script type" ;
+ };
+ Edit ED_TYPE
+ {
+ HelpID = "sw:Edit:DLG_JAVAEDIT:ED_TYPE";
+ Border = TRUE ;
+ Text = "JavaScript" ;
+ // Nicht uebersetzen!!!
+ Pos = MAP_APPFONT ( 70 , 14 ) ;
+ Size = MAP_APPFONT ( 87 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_URL
+ {
+ HelpID = "sw:RadioButton:DLG_JAVAEDIT:RB_URL";
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 55 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "URL" ;
+ };
+ Edit ED_URL
+ {
+ HelpID = "sw:Edit:DLG_JAVAEDIT:ED_URL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 70 , 27 ) ;
+ Size = MAP_APPFONT ( 87 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_URL
+ {
+ HelpID = "sw:PushButton:DLG_JAVAEDIT:PB_URL";
+ Pos = MAP_APPFONT ( 163 , 26 ) ;
+ Size = MAP_APPFONT ( 14 , 14 ) ;
+ Text = "~..." ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_EDIT
+ {
+ HelpID = "sw:RadioButton:DLG_JAVAEDIT:RB_EDIT";
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 140 , 10 ) ;
+ Text [ en-US ] = "~Text" ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ };
+ MultiLineEdit ED_EDIT
+ {
+ HelpID = "sw:MultiLineEdit:DLG_JAVAEDIT:ED_EDIT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 23 , 54 ) ;
+ Size = MAP_APPFONT ( 155 , 91 ) ;
+ Left = TRUE ;
+ VScroll = TRUE ;
+ HScroll = TRUE ;
+ IgnoreTab = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_POSTIT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 179 , 8 ) ;
+ Text [ en-US ] = "Contents" ;
+ };
+ OKButton BTN_POST_OK
+ {
+ Pos = MAP_APPFONT ( 191 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_POST_CANCEL
+ {
+ Pos = MAP_APPFONT ( 191 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ };
+ HelpButton BTN_POST_HELP
+ {
+ Pos = MAP_APPFONT ( 191 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 15 ) ;
+ };
+ ImageButton BTN_PREV
+ {
+ HelpID = "sw:ImageButton:DLG_JAVAEDIT:BTN_PREV";
+ Pos = MAP_APPFONT ( 191 , 60 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ Symbol = IMAGEBUTTON_ARROW_LEFT ;
+ };
+ ImageButton BTN_NEXT
+ {
+ HelpID = "sw:ImageButton:DLG_JAVAEDIT:BTN_NEXT";
+ Pos = MAP_APPFONT ( 217 , 60 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ Symbol = IMAGEBUTTON_ARROW_RIGHT ;
+ };
+ // lokale Strings
+ String STR_JAVA_EDIT
+ {
+ Text [ en-US ] = "Edit Script" ;
+ };
+ String STR_JAVA_INSERT
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Script einfügen : Script einf³gen */
+ Text [ en-US ] = "Insert Script" ;
+ };
+ Text [ en-US ] = "Edit Script" ;
+};
+ // ********************************************************************** EOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/fldui/xfldui.cxx b/sw/source/ui/fldui/xfldui.cxx
new file mode 100644
index 000000000000..a86a78943711
--- /dev/null
+++ b/sw/source/ui/fldui/xfldui.cxx
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <tools/debug.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <comphelper/processfactory.hxx>
+#include <fldmgr.hxx>
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+#include <wrtsh.hxx> // Actives Fenster
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <swmodule.hxx>
+
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::beans;
+
+
+// ---------------------------------------------------------------------------
+// This file contains all routines of the fldui directory, which must compile
+// with exceptions. So we can reduce the code of the other files, which don't
+// need any exception handling.
+// ---------------------------------------------------------------------------
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ist das Datenbankfeld numerisch?
+ Anm: Im Fehlerfall wird TRUE returnt.
+ --------------------------------------------------------------------*/
+
+BOOL SwFldMgr::IsDBNumeric( const String& rDBName, const String& rTblQryName,
+ BOOL bIsTable, const String& rFldName)
+{
+ BOOL bNumeric = TRUE;
+
+ SwNewDBMgr* pDBMgr = pWrtShell ? pWrtShell->GetNewDBMgr() :
+ ::GetActiveView()->GetWrtShell().GetNewDBMgr();
+
+ ::rtl::OUString sSource(rDBName);
+ Reference< XConnection> xConnection =
+ pDBMgr->RegisterConnection(sSource);
+
+ if( !xConnection.is() )
+ return bNumeric;
+
+ Reference<XColumnsSupplier> xColsSupplier;
+ if(bIsTable)
+ {
+ Reference<XTablesSupplier> xTSupplier = Reference<XTablesSupplier>(xConnection, UNO_QUERY);
+ if(xTSupplier.is())
+ {
+ Reference<XNameAccess> xTbls = xTSupplier->getTables();
+ DBG_ASSERT(xTbls->hasByName(rTblQryName), "table not available anymore?");
+ try
+ {
+ Any aTable = xTbls->getByName(rTblQryName);
+ Reference<XPropertySet> xPropSet;
+ aTable >>= xPropSet;
+ xColsSupplier = Reference<XColumnsSupplier>(xPropSet, UNO_QUERY);
+ }
+ catch(Exception&){}
+ }
+ }
+ else
+ {
+ Reference<XQueriesSupplier> xQSupplier = Reference<XQueriesSupplier>(xConnection, UNO_QUERY);
+ if(xQSupplier.is())
+ {
+ Reference<XNameAccess> xQueries = xQSupplier->getQueries();
+ DBG_ASSERT(xQueries->hasByName(rTblQryName), "table not available anymore?");
+ try
+ {
+ Any aQuery = xQueries->getByName(rTblQryName);
+ Reference<XPropertySet> xPropSet;
+ aQuery >>= xPropSet;
+ xColsSupplier = Reference<XColumnsSupplier>(xPropSet, UNO_QUERY);
+ }
+ catch(Exception&){}
+ }
+ }
+
+ if(xColsSupplier.is())
+ {
+ Reference <XNameAccess> xCols;
+ try
+ {
+ xCols = xColsSupplier->getColumns();
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("Exception in getColumns()");
+ }
+ if(xCols.is() && xCols->hasByName(rFldName))
+ {
+ Any aCol = xCols->getByName(rFldName);
+ Reference <XPropertySet> xCol;
+ aCol >>= xCol;
+ Any aType = xCol->getPropertyValue( UniString::CreateFromAscii("Type"));
+ sal_Int32 eDataType = 0;
+ aType >>= eDataType;
+ switch(eDataType)
+ {
+ case DataType::BIT:
+ case DataType::BOOLEAN:
+ case DataType::TINYINT:
+ case DataType::SMALLINT:
+ case DataType::INTEGER:
+ case DataType::BIGINT:
+ case DataType::FLOAT:
+ case DataType::REAL:
+ case DataType::DOUBLE:
+ case DataType::NUMERIC:
+ case DataType::DECIMAL:
+ case DataType::DATE:
+ case DataType::TIME:
+ case DataType::TIMESTAMP:
+ break;
+
+ case DataType::BINARY:
+ case DataType::VARBINARY:
+ case DataType::LONGVARBINARY:
+ case DataType::SQLNULL:
+ case DataType::OTHER:
+ case DataType::OBJECT:
+ case DataType::DISTINCT:
+ case DataType::STRUCT:
+ case DataType::ARRAY:
+ case DataType::BLOB:
+ case DataType::CLOB:
+ case DataType::REF:
+ case DataType::CHAR:
+ case DataType::VARCHAR:
+ case DataType::LONGVARCHAR:
+ default:
+ bNumeric = FALSE;
+ }
+ }
+ }
+ return bNumeric;
+}
+
+
diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
new file mode 100644
index 000000000000..015a31fce90e
--- /dev/null
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -0,0 +1,647 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <hintids.hxx>
+
+#ifndef _SVSTDARR_STRINGSSORTDTOR
+#define _SVSTDARR_STRINGSSORTDTOR
+#include <svl/svstdarr.hxx>
+#endif
+#include <vcl/msgbox.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/hdft.hxx>
+#include <editeng/flstitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <svtools/htmlcfg.hxx>
+#include <svl/cjkoptions.hxx>
+#include <numpara.hxx>
+#include <fmtclds.hxx>
+#include <swtypes.hxx>
+#include <swmodule.hxx>
+#include <errhdl.hxx> // fuer Create-Methoden
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wdocsh.hxx>
+#include <viewopt.hxx>
+#include <pgfnote.hxx>
+#ifndef _PGFGRID_HXX
+#include <pggrid.hxx>
+#endif
+#ifndef _TMPDLG_HXX
+#include <tmpdlg.hxx> // der Dialog
+#endif
+#include <column.hxx> // Spalten
+#include <drpcps.hxx> // Initialen
+#include <frmpage.hxx> // Rahmen
+#include <wrap.hxx> // Rahmen
+#include <frmmgr.hxx> // Rahmen
+#include <ccoll.hxx> // CondColl
+#include <swuiccoll.hxx>
+#include <docstyle.hxx> //
+#include <fmtcol.hxx> //
+#include <macassgn.hxx> //
+#include <poolfmt.hxx>
+#include <uitool.hxx>
+#include <shellres.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _FMTUI_HRC
+#include <fmtui.hrc>
+#endif
+#include <SwStyleNameMapper.hxx>
+#include <svx/svxids.hrc>
+#include <svl/stritem.hxx>
+#include <svl/aeitem.hxx>
+#include <svl/slstitm.hxx>
+#include <svl/eitem.hxx>
+#include <svl/intitem.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/flagsdef.hxx>
+
+extern SW_DLLPUBLIC SwWrtShell* GetActiveWrtShell();
+
+/*--------------------------------------------------------------------
+ Beschreibung: Der Traeger des Dialoges
+ --------------------------------------------------------------------*/
+
+SwTemplateDlg::SwTemplateDlg(Window* pParent,
+ SfxStyleSheetBase& rBase,
+ USHORT nRegion,
+ BOOL bColumn,
+ SwWrtShell* pActShell,
+ BOOL bNew ) :
+ SfxStyleDialog( pParent,
+ SW_RES(DLG_TEMPLATE_BASE + nRegion),
+ rBase,
+ FALSE,
+ 0 ),
+ nType( nRegion ),
+ pWrtShell(pActShell),
+ bNewStyle(bNew)
+{
+ FreeResource();
+
+ nHtmlMode = ::GetHtmlMode(pWrtShell->GetView().GetDocShell());
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ // TabPages zusammenfieseln
+ switch( nRegion )
+ {
+ // Zeichenvorlagen
+ case SFX_STYLE_FAMILY_CHAR:
+ {
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) , "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_CHAR_STD, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) );
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) , "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_CHAR_EXT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) );
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) , "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_CHAR_POS, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) );
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) , "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_CHAR_TWOLN, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) );
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) , "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
+
+ SvtCJKOptions aCJKOptions;
+ if(nHtmlMode & HTMLMODE_ON || !aCJKOptions.IsDoubleLinesEnabled())
+ RemoveTabPage(TP_CHAR_TWOLN);
+ }
+ break;
+ // Absatzvorlagen
+ case SFX_STYLE_FAMILY_PARA:
+ {
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH), "GetTabPageRangesFunc fail!");
+ AddTabPage( TP_PARA_STD, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_STD_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_STD_PARAGRAPH) );
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), "GetTabPageRangesFunc fail!");
+ AddTabPage( TP_PARA_ALIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_ALIGN_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_ALIGN_PARAGRAPH) );
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH), "GetTabPageRangesFunc fail!");
+ AddTabPage( TP_PARA_EXT, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_EXT_PARAGRAPH), pFact->GetTabPageRangesFunc(RID_SVXPAGE_EXT_PARAGRAPH) );
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!");
+ AddTabPage( TP_PARA_ASIAN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN) );
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ), "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_CHAR_STD, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME ) );
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ), "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_CHAR_EXT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS ) );
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) , "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_CHAR_POS, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_POSITION ) );
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) , "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_CHAR_TWOLN, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES ) );
+
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR), "GetTabPageRangesFunc fail!");
+ AddTabPage( TP_TABULATOR, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TABULATOR), pFact->GetTabPageRangesFunc(RID_SVXPAGE_TABULATOR) );
+
+
+ AddTabPage(TP_NUMPARA, SwParagraphNumTabPage::Create,
+ SwParagraphNumTabPage::GetRanges);
+ AddTabPage(TP_DROPCAPS, SwDropCapsPage::Create,
+ SwDropCapsPage::GetRanges );
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
+
+ AddTabPage( TP_CONDCOLL, SwCondCollPage::Create,
+ SwCondCollPage::GetRanges );
+ if( (!bNewStyle && RES_CONDTXTFMTCOLL != ((SwDocStyleSheet&)rBase).GetCollection()->Which())
+ || nHtmlMode & HTMLMODE_ON )
+ RemoveTabPage(TP_CONDCOLL);
+
+ SvtCJKOptions aCJKOptions;
+ if(nHtmlMode & HTMLMODE_ON)
+ {
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ if (!pHtmlOpt->IsPrintLayoutExtension())
+ RemoveTabPage(TP_PARA_EXT);
+ RemoveTabPage(TP_PARA_ASIAN);
+ RemoveTabPage(TP_TABULATOR);
+ RemoveTabPage(TP_NUMPARA);
+ RemoveTabPage(TP_CHAR_TWOLN);
+ if(!(nHtmlMode & HTMLMODE_FULL_STYLES))
+ {
+ RemoveTabPage(TP_BACKGROUND);
+ RemoveTabPage(TP_DROPCAPS);
+ }
+ if(!(nHtmlMode & HTMLMODE_PARA_BORDER))
+ RemoveTabPage(TP_BORDER);
+ }
+ else
+ {
+ if(!aCJKOptions.IsAsianTypographyEnabled())
+ RemoveTabPage(TP_PARA_ASIAN);
+ if(!aCJKOptions.IsDoubleLinesEnabled())
+ RemoveTabPage(TP_CHAR_TWOLN);
+ }
+ }
+ break;
+ // Rahmenvorlagen
+ case SFX_STYLE_FAMILY_FRAME:
+ {
+ AddTabPage(TP_FRM_STD, SwFrmPage::Create,
+ SwFrmPage::GetRanges );
+ AddTabPage(TP_FRM_ADD, SwFrmAddPage::Create,
+ SwFrmAddPage::GetRanges );
+ AddTabPage(TP_FRM_WRAP, SwWrapTabPage::Create,
+ SwWrapTabPage::GetRanges );
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
+
+ AddTabPage(TP_COLUMN, SwColumnPage::Create,
+ SwColumnPage::GetRanges );
+
+ AddTabPage( TP_MACRO_ASSIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0);
+
+ // Auskommentiert wegen Bug #45776 (per default keine Breite&Groesse in Rahmenvorlagen)
+/* SwFmtFrmSize aSize( (const SwFmtFrmSize&)rBase.
+ GetItemSet().Get(RES_FRM_SIZE));
+ if( !aSize.GetWidth() )
+ {
+ aSize.SetWidth( DFLT_WIDTH );
+ aSize.SetHeight( DFLT_HEIGHT );
+ rBase.GetItemSet().Put( aSize );
+ }*/
+ break;
+ }
+ // Seitenvorlagen
+ case SFX_STYLE_FAMILY_PAGE:
+ {
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ), "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BACKGROUND ) );
+ AddTabPage(TP_HEADER_PAGE, String(SW_RES(STR_PAGE_HEADER)),
+ SvxHeaderPage::Create,
+ SvxHeaderPage::GetRanges );
+ AddTabPage(TP_FOOTER_PAGE, String(SW_RES(STR_PAGE_FOOTER)),
+ SvxFooterPage::Create,
+ SvxFooterPage::GetRanges );
+ if(bColumn)
+ SetCurPageId(TP_COLUMN);
+
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ), "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_PAGE_STD, String(SW_RES(STR_PAGE_STD)),
+ pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ),
+ pFact->GetTabPageRangesFunc( RID_SVXPAGE_PAGE ),
+ FALSE,
+ 1 ); // nach der Verwalten-Page
+ if(!pActShell || 0 == ::GetHtmlMode(pWrtShell->GetView().GetDocShell()))
+ {
+ DBG_ASSERT(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), "GetTabPageCreatorFunc fail!");
+ DBG_ASSERT(pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ), "GetTabPageRangesFunc fail!");
+ AddTabPage(TP_BORDER, String(SW_RES(STR_PAGE_BORDER)),
+ pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER ) );
+ AddTabPage(TP_COLUMN, String(SW_RES(STR_PAGE_COLUMN)),
+ SwColumnPage::Create,
+ SwColumnPage::GetRanges );
+ AddTabPage(TP_FOOTNOTE_PAGE, String(SW_RES(STR_PAGE_FOOTNOTE)),
+ SwFootNotePage::Create,
+ SwFootNotePage::GetRanges );
+ AddTabPage(TP_TEXTGRID_PAGE, String(SW_RES(STR_PAGE_TEXTGRID)),
+ SwTextGridPage::Create,
+ SwTextGridPage::GetRanges );
+ SvtCJKOptions aCJKOptions;
+ if(!aCJKOptions.IsAsianTypographyEnabled())
+ RemoveTabPage(TP_TEXTGRID_PAGE);
+ }
+
+
+ }
+ break;
+ // Numerierungsvorlagen
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ AddTabPage( RID_SVXPAGE_PICK_SINGLE_NUM );
+ AddTabPage( RID_SVXPAGE_PICK_BULLET );
+ AddTabPage( RID_SVXPAGE_PICK_NUM );
+ AddTabPage( RID_SVXPAGE_PICK_BMP);
+ AddTabPage( RID_SVXPAGE_NUM_OPTIONS );
+ AddTabPage( RID_SVXPAGE_NUM_POSITION );
+
+
+/* const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rBase.GetItemSet().GetItemState(
+ FN_PARAM_ACT_NUMBER, FALSE, &pItem ))
+ {
+// pActNum = (ActNumberFormat*)((const SwPtrItem*)pItem)->GetValue();
+ }
+*/
+ }
+ break;
+
+ default:
+ ASSERT(!this, "Falsche Familie");
+
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwTemplateDlg::~SwTemplateDlg()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+short SwTemplateDlg::Ok()
+{
+ short nRet = SfxTabDialog::Ok();
+ if( RET_OK == nRet )
+ {
+ const SfxPoolItem *pOutItem, *pExItem;
+ if( SFX_ITEM_SET == pExampleSet->GetItemState(
+ SID_ATTR_NUMBERING_RULE, FALSE, &pExItem ) &&
+ ( !GetOutputItemSet() ||
+ SFX_ITEM_SET != GetOutputItemSet()->GetItemState(
+ SID_ATTR_NUMBERING_RULE, FALSE, &pOutItem ) ||
+ *pExItem != *pOutItem ))
+ {
+ if( GetOutputItemSet() )
+ ((SfxItemSet*)GetOutputItemSet())->Put( *pExItem );
+ else
+ nRet = RET_CANCEL;
+ }
+ }
+ else
+ //JP 09.01.98 Bug #46446#:
+ // das ist der Ok - Handler also muss auf OK defaultet werden!
+ nRet = RET_OK;
+ return nRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+const SfxItemSet* SwTemplateDlg::GetRefreshedSet()
+{
+ SfxItemSet* pInSet = GetInputSetImpl();
+ pInSet->ClearItem();
+ pInSet->SetParent( &GetStyleSheet().GetItemSet() );
+ return pInSet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwTemplateDlg::PageCreated( USHORT nId, SfxTabPage &rPage )
+{
+ //Namen der Vorlagen und Metric setzen
+ String sNumCharFmt, sBulletCharFmt;
+ SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFmt);
+ SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFmt);
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+
+ switch( nId )
+ {
+ case TP_CHAR_STD:
+ {
+ ASSERT(::GetActiveView(), "keine View aktiv");
+
+ SvxFontListItem aFontListItem( *( (SvxFontListItem*)::GetActiveView()->
+ GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) );
+
+ aSet.Put (SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
+ UINT32 nFlags = 0;
+ if(rPage.GetItemSet().GetParent() && 0 == (nHtmlMode & HTMLMODE_ON ))
+ nFlags = SVX_RELATIVE_MODE;
+ if( SFX_STYLE_FAMILY_CHAR == nType )
+ nFlags = nFlags|SVX_PREVIEW_CHARACTER;
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
+ rPage.PageCreated(aSet);
+ }
+ break;
+
+ case TP_CHAR_EXT:
+ {
+ UINT32 nFlags = SVX_ENABLE_FLASH;
+ if( SFX_STYLE_FAMILY_CHAR == nType )
+ nFlags = nFlags|SVX_PREVIEW_CHARACTER;
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlags));
+ rPage.PageCreated(aSet);
+ }
+ break;
+
+ case TP_CHAR_POS:
+ if( SFX_STYLE_FAMILY_CHAR == nType )
+ {
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
+ rPage.PageCreated(aSet);
+ }
+ break;
+
+ case TP_CHAR_TWOLN:
+ if( SFX_STYLE_FAMILY_CHAR == nType )
+ {
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_PREVIEW_CHARACTER));
+ rPage.PageCreated(aSet);
+ }
+ break;
+
+ case TP_PARA_STD:
+ {
+ if( rPage.GetItemSet().GetParent() )
+ {
+ aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,MM50/10));
+ aSet.Put(SfxUInt32Item(SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,0x000F));
+ rPage.PageCreated(aSet);
+ }
+
+ }
+ break;
+ case TP_NUMPARA:
+ {
+ //-->#outlinelevel added by zhaojianwei
+ // handle if the current paragraph style is assigned to a list level of outline style,
+ SwTxtFmtColl* pTmpColl = pWrtShell->FindTxtFmtCollByName( GetStyleSheet().GetName() );
+ if( pTmpColl && pTmpColl->IsAssignedToListLevelOfOutlineStyle() )
+ {
+ ((SwParagraphNumTabPage&)rPage).DisableOutline() ;
+ ((SwParagraphNumTabPage&)rPage).DisableNumbering();
+ }//<-end
+ ListBox & rBox = ((SwParagraphNumTabPage&)rPage).GetStyleBox();
+ SfxStyleSheetBasePool* pPool = pWrtShell->GetView().GetDocShell()->GetStyleSheetPool();
+ pPool->SetSearchMask(SFX_STYLE_FAMILY_PSEUDO, SFXSTYLEBIT_ALL);
+ const SfxStyleSheetBase* pBase = pPool->First();
+ SvStringsSortDtor aNames;
+ while(pBase)
+ {
+ aNames.Insert(new String(pBase->GetName()));
+ pBase = pPool->Next();
+ }
+ for(USHORT i = 0; i < aNames.Count(); i++)
+ rBox.InsertEntry(*aNames.GetObject(i));
+ }
+ break;
+ case TP_PARA_ALIGN:
+ {
+ aSet.Put(SfxBoolItem(SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,TRUE));
+ rPage.PageCreated(aSet);
+ }
+ break;
+
+ case TP_FRM_STD:
+ ((SwFrmPage&)rPage).SetNewFrame( TRUE );
+ ((SwFrmPage&)rPage).SetFormatUsed( TRUE );
+ break;
+
+ case TP_FRM_ADD:
+ ((SwFrmAddPage&)rPage).SetFormatUsed(TRUE);
+ ((SwFrmAddPage&)rPage).SetNewFrame(TRUE);
+ break;
+
+ case TP_FRM_WRAP:
+ ((SwWrapTabPage&)rPage).SetFormatUsed( TRUE, FALSE );
+ break;
+
+ case TP_COLUMN:
+ if( nType == SFX_STYLE_FAMILY_FRAME )
+ ((SwColumnPage&)rPage).SetFrmMode(TRUE);
+ ((SwColumnPage&)rPage).SetFormatUsed( TRUE );
+ break;
+
+ case TP_BACKGROUND:
+ {
+ sal_Int32 nFlagType = 0;
+ if( SFX_STYLE_FAMILY_PARA == nType )
+ nFlagType |= SVX_SHOW_PARACTL;
+ if( SFX_STYLE_FAMILY_CHAR != nType )
+ nFlagType |= SVX_SHOW_SELECTOR;
+ if( SFX_STYLE_FAMILY_FRAME == nType )
+ nFlagType |= SVX_ENABLE_TRANSPARENCY;
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
+ rPage.PageCreated(aSet);
+ }
+ break;
+ case TP_CONDCOLL:
+ ((SwCondCollPage&)rPage).SetCollection(
+ ((SwDocStyleSheet&)GetStyleSheet()).GetCollection(), bNewStyle );
+ break;
+
+ case TP_PAGE_STD:
+ if(0 == (nHtmlMode & HTMLMODE_ON ))
+ {
+ List aList;
+ String* pNew = new String;
+ SwStyleNameMapper::FillUIName( RES_POOLCOLL_TEXT, *pNew );
+ aList.Insert( pNew, (ULONG)0 );
+ if( pWrtShell )
+ {
+ SfxStyleSheetBasePool* pStyleSheetPool = pWrtShell->
+ GetView().GetDocShell()->GetStyleSheetPool();
+ pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA);
+ SfxStyleSheetBase *pFirstStyle = pStyleSheetPool->First();
+ while(pFirstStyle)
+ {
+ aList.Insert( new String(pFirstStyle->GetName()),
+ aList.Count());
+ pFirstStyle = pStyleSheetPool->Next();
+ }
+ }
+ aSet.Put (SfxStringListItem(SID_COLLECT_LIST, &aList));
+ rPage.PageCreated(aSet);
+ for( USHORT i = (USHORT)aList.Count(); i; --i )
+ delete (String*)aList.Remove(i);
+ }
+ break;
+
+ case TP_MACRO_ASSIGN:
+ {
+ SfxAllItemSet aNewSet(*aSet.GetPool());
+ aNewSet.Put( SwMacroAssignDlg::AddEvents(MACASSGN_ALLFRM) );
+ if ( pWrtShell )
+ rPage.SetFrame( pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
+ rPage.PageCreated(aNewSet);
+ break;
+ }
+
+ case RID_SVXPAGE_PICK_NUM:
+ {
+ aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
+ aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
+ rPage.PageCreated(aSet);
+ }
+ break;
+ case RID_SVXPAGE_NUM_OPTIONS:
+ {
+
+ aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
+ aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
+ // Zeichenvorlagen sammeln
+ ListBox rCharFmtLB(this);
+ rCharFmtLB.Clear();
+ rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
+ SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
+ ::FillCharStyleListBox(rCharFmtLB, pDocShell);
+ List aList;
+ for(USHORT j = 0; j < rCharFmtLB.GetEntryCount(); j++)
+ {
+
+ aList.Insert( new XubString(rCharFmtLB.GetEntry(j)), LIST_APPEND );
+ }
+ aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
+ aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< USHORT >(eMetric)));
+ rPage.PageCreated(aSet);
+ for( USHORT i = (USHORT)aList.Count(); i; --i )
+ delete (XubString*)aList.Remove(i);
+ aList.Clear();
+ }
+ break;
+ case RID_SVXPAGE_NUM_POSITION:
+ {
+ SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell();
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
+
+ aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< USHORT >(eMetric)));
+ rPage.PageCreated(aSet);
+ }
+ break;
+ case RID_SVXPAGE_PICK_BULLET :
+ {
+ aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
+ rPage.PageCreated(aSet);
+ }
+ break;
+ case TP_HEADER_PAGE:
+ if(0 == (nHtmlMode & HTMLMODE_ON ))
+ ((SvxHeaderPage&)rPage).EnableDynamicSpacing();
+ break;
+ case TP_FOOTER_PAGE:
+ if(0 == (nHtmlMode & HTMLMODE_ON ))
+ ((SvxFooterPage&)rPage).EnableDynamicSpacing();
+ break;
+ case TP_BORDER :
+ if( SFX_STYLE_FAMILY_PARA == nType )
+ {
+ aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_PARA));
+ }
+ else if( SFX_STYLE_FAMILY_FRAME == nType )
+ {
+ aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_FRAME));
+ }
+ rPage.PageCreated(aSet);
+
+ break;
+ }
+}
+
+
+
diff --git a/sw/source/ui/fmtui/tmpdlg.src b/sw/source/ui/fmtui/tmpdlg.src
new file mode 100644
index 000000000000..da2479717373
--- /dev/null
+++ b/sw/source/ui/fmtui/tmpdlg.src
@@ -0,0 +1,380 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SFX_HRC
+#include <sfx2/sfx.hrc>
+#endif
+#include "fmtui.hrc"
+#include "globals.hrc"
+#include "svx/dialogs.hrc"
+TabDialog DLG_TEMPLATE_1
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Character Style" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_CHAR_STD ;
+ Text [ en-US ] = "Font" ;
+ PageResID = TP_CHAR_STD ;
+ };
+ PageItem
+ {
+ Identifier = TP_CHAR_EXT ;
+ Text [ en-US ] = "Font Effects" ;
+ PageResID = TP_CHAR_EXT ;
+ };
+ PageItem
+ {
+ Identifier = TP_CHAR_POS ;
+ PageResID = TP_CHAR_POS ;
+ Text [ en-US ] = "Position";
+ };
+ PageItem
+ {
+ Identifier = TP_CHAR_TWOLN ;
+ PageResID = TP_CHAR_TWOLN;
+ Text [ en-US ] = "Asian Layout";
+ };
+ PageItem
+ {
+ Identifier = TP_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ PageResID = TP_BACKGROUND ;
+ };
+ };
+ };
+};
+TabDialog DLG_TEMPLATE_2
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Paragraph Style" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_PARA_STD ;
+ /* ### ACHTUNG: Neuer Text in Resource? Einzüge und Abstände : Einz³ge und Abstõnde */
+ Text [ en-US ] = "Indents & Spacing" ;
+ PageResID = TP_PARA_STD ;
+ };
+ PageItem
+ {
+ Identifier = TP_PARA_ALIGN ;
+ PageResID = TP_PARA_ALIGN ;
+ Text [ en-US ] = "Alignment" ;
+ };
+ PageItem
+ {
+ Identifier = TP_PARA_EXT ;
+ /* ### ACHTUNG: Neuer Text in Resource? Textflu?: Textflu?*/
+ Text [ en-US ] = "Text Flow" ;
+ PageResID = TP_PARA_EXT ;
+ };
+ PageItem
+ {
+ Identifier = TP_PARA_ASIAN;
+ Text [ en-US ] = "Asian Typography";
+ };
+ PageItem
+ {
+ Identifier = TP_CHAR_STD ;
+ Text [ en-US ] = "Font" ;
+ PageResID = TP_CHAR_STD ;
+ };
+ PageItem
+ {
+ Identifier = TP_CHAR_EXT ;
+ Text [ en-US ] = "Font Effects" ;
+ PageResID = TP_CHAR_EXT ;
+ };
+ PageItem
+ {
+ Identifier = TP_CHAR_POS ;
+ PageResID = TP_CHAR_POS ;
+ Text [ en-US ] = "Position";
+ };
+ PageItem
+ {
+ Identifier = TP_CHAR_TWOLN ;
+ PageResID = TP_CHAR_TWOLN;
+ Text [ en-US ] = "Asian Layout";
+ };
+ PageItem
+ {
+ Identifier = TP_NUMPARA ;
+ Text [ en-US ] = "Outline & Numbering" ;
+ };
+ PageItem
+ {
+ Identifier = TP_TABULATOR ;
+ Text [ en-US ] = "Tabs" ;
+ PageResID = TP_TABULATOR ;
+ };
+ PageItem
+ {
+ Identifier = TP_DROPCAPS ;
+ Text [ en-US ] = "Drop Caps" ;
+ PageResID = TP_DROPCAPS ;
+ };
+ PageItem
+ {
+ Identifier = TP_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ PageResID = TP_BACKGROUND ;
+ };
+ PageItem
+ {
+ Identifier = TP_BORDER ;
+ Text [ en-US ] = "Borders" ;
+ PageResID = TP_BORDER ;
+ };
+ PageItem
+ {
+ Identifier = TP_CONDCOLL ;
+ PageResID = TP_CONDCOLL ;
+ Text [ en-US ] = "Condition" ;
+ };
+ };
+ };
+};
+TabDialog DLG_TEMPLATE_4
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ // Text[norwegian_wrong] = "Sidetyper";
+ // Text[italian_wrong] = "Stili pagina";
+ // Text[portuguese_brazilian_wrong] = "Estilos da Página ";
+ // Text[portuguese_wrong] = "Estilos da Página ";
+ // Text[finnish_wrong] = "Sivutyylit";
+ // Text[danish_wrong] = "Sidelayout";
+ // Text[french_wrong] = "Styles de page";
+ // Text[swedish_wrong] = "Sidformat";
+ // Text[dutch_wrong] = "Pagina-opmaakprofielen";
+ // Text[spanish_wrong] = "Estilos de página";
+ Text [ en-US ] = "Page Style" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ /* PageItem
+ {
+ Identifier = TP_PAGE_STD ;
+ Text [ en-US ] = "Page" ;
+ PageResID = TP_PAGE_STD ;
+ };*/
+ PageItem
+ {
+ Identifier = TP_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ PageResID = TP_BACKGROUND ;
+ };
+ /* PageItem
+ {
+ Identifier = TP_BORDER ;
+ Text [ en-US ] = "Borders" ;
+ PageResID = TP_BORDER ;
+ };
+ PageItem
+ {
+ Identifier = TP_HEADER_PAGE ;
+ Text [ en-US ] = "Header" ;
+ PageResID = TP_HEADER_PAGE ;
+ };
+ PageItem
+ {
+ Identifier = TP_FOOTER_PAGE ;
+ Text [ en-US ] = "Footer" ;
+ PageResID = TP_FOOTER_PAGE ;
+ };
+ PageItem
+ {
+ Identifier = TP_COLUMN ;
+ Text [ en-US ] = "Columns" ;
+ PageResID = TP_COLUMN ;
+ };
+ PageItem
+ {
+ Identifier = TP_FOOTNOTE_PAGE ;
+ Text [ en-US ] = "Footnote" ;
+ PageResID = TP_FOOTNOTE_PAGE ;
+ };*/
+ };
+ };
+};
+String STR_PAGE_STD
+{
+ Text [ en-US ] = "Page" ;
+};
+String STR_PAGE_BORDER
+{
+ Text [ en-US ] = "Borders" ;
+};
+String STR_PAGE_HEADER
+{
+ Text [ en-US ] = "Header" ;
+};
+String STR_PAGE_FOOTER
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Fußzeile : Fu˜zeile */
+ Text [ en-US ] = "Footer" ;
+};
+String STR_PAGE_TEXTGRID
+{
+ Text [ en-US ] = "Text Grid";
+};
+String STR_PAGE_COLUMN
+{
+ Text [ en-US ] = "Columns" ;
+};
+String STR_PAGE_FOOTNOTE
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Fußnote : Fu˜note */
+ Text [ en-US ] = "Footnote" ;
+};
+TabDialog DLG_TEMPLATE_3
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ // Text[norwegian_wrong] = "Rammemaler";
+ // Text[italian_wrong] = "Stili cornice";
+ // Text[portuguese_brazilian_wrong] = "Estilos de Moldura";
+ // Text[portuguese_wrong] = "Estilos de Moldura";
+ // Text[finnish_wrong] = "Kehystyylit";
+ // Text[danish_wrong] = "Rammelayout";
+ // Text[french_wrong] = "Styles d'encadrement";
+ // Text[swedish_wrong] = "Ramformat";
+ // Text[dutch_wrong] = "Kaderopmaakprofielen";
+ // Text[spanish_wrong] = "Estilos de marco";
+ Text [ en-US ] = "Frame Style" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_FRM_STD ;
+ Text [ en-US ] = "Type" ;
+ PageResID = TP_FRM_STD ;
+ };
+ PageItem
+ {
+ Identifier = TP_FRM_ADD ;
+ PageResID = TP_FRM_ADD ;
+ /* ### ACHTUNG: Neuer Text in Resource? Zusätze : Zusõtze */
+ Text [ en-US ] = "Options" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FRM_WRAP ;
+ Text [ en-US ] = "Wrap" ;
+ PageResID = TP_FRM_WRAP ;
+ };
+ PageItem
+ {
+ Identifier = TP_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ PageResID = TP_BACKGROUND ;
+ };
+ PageItem
+ {
+ Identifier = TP_BORDER ;
+ Text [ en-US ] = "Borders" ;
+ PageResID = TP_BORDER ;
+ };
+ PageItem
+ {
+ Identifier = TP_COLUMN ;
+ Text [ en-US ] = "Columns" ;
+ PageResID = TP_COLUMN ;
+ };
+ PageItem
+ {
+ Identifier = TP_MACRO_ASSIGN ;
+ Text [ en-US ] = "Macro" ;
+ };
+ };
+ };
+};
+TabDialog DLG_TEMPLATE_5
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PICK_BULLET ;
+ Text [ en-US ] = "Bullets" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PICK_SINGLE_NUM;
+ Text [ en-US ] = "Numbering Style" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PICK_NUM ;
+ Text [ en-US ] = "Outline" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PICK_BMP;
+ Text [ en-US ] = "Graphics" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_NUM_POSITION ;
+ Text [ en-US ] = "Position" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_NUM_OPTIONS;
+ Text [ en-US ] = "Options" ;
+ };
+ };
+ };
+ Text [ en-US ] = "Numbering Style" ;
+};
diff --git a/sw/source/ui/frmdlg/colex.cxx b/sw/source/ui/frmdlg/colex.cxx
new file mode 100644
index 000000000000..2cdc9fb014f0
--- /dev/null
+++ b/sw/source/ui/frmdlg/colex.cxx
@@ -0,0 +1,610 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+
+#include "cmdid.h"
+#include "hintids.hxx"
+#include <algorithm>
+
+
+#include <svl/eitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <svx/pageitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/graph.hxx>
+#include <tgrditem.hxx>
+#include <viewopt.hxx>
+#include "colex.hxx"
+#include "colmgr.hxx"
+
+/*-----------------------------------------------------------------------
+ Beschreibung: Uebernahme der aktualisierten Werte aus dem Set
+ -----------------------------------------------------------------------*/
+void SwPageExample::UpdateExample( const SfxItemSet& rSet )
+{
+ const SvxPageItem* pPage = 0;
+ SfxItemPool* pPool = rSet.GetPool();
+ USHORT nWhich = pPool->GetWhich( SID_ATTR_PAGE );
+
+ if ( rSet.GetItemState( nWhich, FALSE ) == SFX_ITEM_SET )
+ {
+ // Ausrichtung
+ pPage = (const SvxPageItem*)&rSet.Get( nWhich );
+
+ if ( pPage )
+ SetUsage( pPage->GetPageUsage() );
+ }
+
+ nWhich = pPool->GetWhich( SID_ATTR_PAGE_SIZE );
+
+ if ( rSet.GetItemState( nWhich, FALSE ) == SFX_ITEM_SET )
+ {
+ // Orientation und Size aus dem PageItem
+ const SvxSizeItem& rSize = (const SvxSizeItem&)rSet.Get( nWhich );
+ SetSize( rSize.GetSize() );
+ }
+ nWhich = RES_LR_SPACE;
+ if ( rSet.GetItemState( nWhich, FALSE ) == SFX_ITEM_SET )
+ {
+ // linken und rechten Rand einstellen
+ const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)rSet.Get( nWhich );
+
+ SetLeft( rLRSpace.GetLeft() );
+ SetRight( rLRSpace.GetRight() );
+ }
+ else
+ {
+ SetLeft( 0 );
+ SetRight( 0 );
+ }
+
+ nWhich = RES_UL_SPACE;
+
+ if ( rSet.GetItemState( nWhich, FALSE ) == SFX_ITEM_SET )
+ {
+ // oberen und unteren Rand einstellen
+ const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)rSet.Get( nWhich );
+
+ SetTop( rULSpace.GetUpper() );
+ SetBottom( rULSpace.GetLower() );
+ }
+ else
+ {
+ SetTop( 0 );
+ SetBottom( 0 );
+ }
+
+
+ // Kopfzeilen-Attribute auswerten
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == rSet.GetItemState( pPool->GetWhich( SID_ATTR_PAGE_HEADERSET),
+ FALSE, &pItem ) )
+ {
+ const SfxItemSet& rHeaderSet = ((SvxSetItem*)pItem)->GetItemSet();
+ const SfxBoolItem& rHeaderOn =
+ (const SfxBoolItem&)rHeaderSet.Get( pPool->GetWhich( SID_ATTR_PAGE_ON ) );
+
+ if ( rHeaderOn.GetValue() )
+ {
+ const SvxSizeItem& rSize =
+ (const SvxSizeItem&)rHeaderSet.Get(pPool->GetWhich(SID_ATTR_PAGE_SIZE));
+
+ const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)rHeaderSet.Get(
+ pPool->GetWhich(SID_ATTR_ULSPACE));
+ const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)rHeaderSet.Get(
+ pPool->GetWhich(SID_ATTR_LRSPACE));
+
+ SetHdHeight( rSize.GetSize().Height() - rUL.GetLower());
+ SetHdDist( rUL.GetLower() );
+ SetHdLeft( rLR.GetLeft() );
+ SetHdRight( rLR.GetRight() );
+ SetHeader( TRUE );
+ if ( rHeaderSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET )
+ {
+ const SvxBrushItem& rItem =
+ (const SvxBrushItem&)rHeaderSet.Get( RES_BACKGROUND );
+ SetHdColor( rItem.GetColor() );
+ }
+ if ( rHeaderSet.GetItemState( RES_BOX ) == SFX_ITEM_SET )
+ {
+ const SvxBoxItem& rItem =
+ (const SvxBoxItem&)rHeaderSet.Get( RES_BOX );
+ SetHdBorder( rItem );
+ }
+ }
+ else
+ SetHeader( FALSE );
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState( pPool->GetWhich( SID_ATTR_PAGE_FOOTERSET),
+ FALSE, &pItem ) )
+ {
+ const SfxItemSet& rFooterSet = ((SvxSetItem*)pItem)->GetItemSet();
+ const SfxBoolItem& rFooterOn =
+ (const SfxBoolItem&)rFooterSet.Get( SID_ATTR_PAGE_ON );
+
+ if ( rFooterOn.GetValue() )
+ {
+ const SvxSizeItem& rSize =
+ (const SvxSizeItem&)rFooterSet.Get( pPool->GetWhich( SID_ATTR_PAGE_SIZE ) );
+
+ const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)rFooterSet.Get(
+ pPool->GetWhich( SID_ATTR_ULSPACE ) );
+ const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)rFooterSet.Get(
+ pPool->GetWhich( SID_ATTR_LRSPACE ) );
+
+ SetFtHeight( rSize.GetSize().Height() - rUL.GetUpper());
+ SetFtDist( rUL.GetUpper() );
+ SetFtLeft( rLR.GetLeft() );
+ SetFtRight( rLR.GetRight() );
+ SetFooter( TRUE );
+ if( rFooterSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET )
+ {
+ const SvxBrushItem& rItem =
+ (const SvxBrushItem&)rFooterSet.Get( RES_BACKGROUND );
+ SetFtColor( rItem.GetColor() );
+ }
+ if( rFooterSet.GetItemState( RES_BOX ) == SFX_ITEM_SET )
+ {
+ const SvxBoxItem& rItem =
+ (const SvxBoxItem&)rFooterSet.Get( RES_BOX );
+ SetFtBorder( rItem );
+ }
+ }
+ else
+ SetFooter( FALSE );
+ }
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_BACKGROUND,
+ FALSE, &pItem ) )
+ {
+ SetColor( ( (const SvxBrushItem*)pItem )->GetColor() );
+ const Graphic* pGrf = ( (const SvxBrushItem*)pItem )->GetGraphic();
+
+ if ( pGrf )
+ {
+ Bitmap aBitmap = pGrf->GetBitmap();
+ SetBitmap( &aBitmap );
+ }
+ else
+ SetBitmap( NULL );
+ }
+
+ Invalidate();
+}
+/*-----------------------------------------------------------------------
+ Beschreibung:
+ -----------------------------------------------------------------------*/
+
+
+void SwColExample::DrawPage( const Point& rOrg,
+ const BOOL bSecond,
+ const BOOL bEnabled )
+{
+ SwPageExample::DrawPage( rOrg, bSecond, bEnabled );
+ USHORT nColumnCount;
+ if( pColMgr && 0 != (nColumnCount = pColMgr->GetCount()))
+ {
+ long nL = GetLeft();
+ long nR = GetRight();
+
+ if ( GetUsage() == SVX_PAGE_MIRROR && !bSecond )
+ {
+ // fuer gespiegelt drehen
+ nL = GetRight();
+ nR = GetLeft();
+ }
+
+ SetFillColor( Color( COL_LIGHTGRAY ) );
+ Rectangle aRect;
+ aRect.Right() = rOrg.X() + GetSize().Width() - nR;
+ aRect.Left() = rOrg.X() + nL;
+ aRect.Top() = rOrg.Y() + GetTop()
+ + GetHdHeight() + GetHdDist();
+ aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom()
+ - GetFtHeight() - GetFtDist();
+ DrawRect(aRect);
+
+ if(GetColor() == Color(COL_TRANSPARENT))
+ {
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ const Color& rFieldColor = rStyleSettings.GetFieldColor();
+ SetFillColor( rFieldColor );
+ }
+ else
+ SetFillColor( GetColor() );
+
+ // #97495# make sure that the automatic column widht's are always equal
+ BOOL bAutoWidth = pColMgr->IsAutoWidth();
+ sal_Int32 nAutoColWidth = 0;
+ if(bAutoWidth)
+ {
+ sal_Int32 nColumnWidthSum = 0;
+ USHORT i;
+ for(i = 0; i < nColumnCount; ++i)
+ nColumnWidthSum += pColMgr->GetColWidth( i );
+ nAutoColWidth = nColumnWidthSum / nColumnCount;
+ }
+
+ USHORT i;
+ for( i = 0; i < nColumnCount; i++)
+ {
+ if(!bAutoWidth)
+ nAutoColWidth = pColMgr->GetColWidth( i );
+ aRect.Right() = aRect.Left() + nAutoColWidth;
+ DrawRect(aRect);
+ if(i < nColumnCount - 1)
+ aRect.Left() = aRect.Right() + pColMgr->GetGutterWidth(i);
+ }
+ if(pColMgr->HasLine())
+ {
+ Point aUp( rOrg.X() + nL, rOrg.Y() + GetTop() );
+ Point aDown( rOrg.X() + nL, rOrg.Y() + GetSize().Height()
+ - GetBottom() - GetFtHeight() - GetFtDist() );
+
+ if( pColMgr->GetLineHeightPercent() != 100 )
+ {
+ long nLength = aDown.Y() - aUp.Y();
+ nLength -= nLength * pColMgr->GetLineHeightPercent() / 100;
+ switch(pColMgr->GetAdjust())
+ {
+ case COLADJ_BOTTOM: aUp.Y() += nLength; break;
+ case COLADJ_TOP: aDown.Y() -= nLength; break;
+ case COLADJ_CENTER:
+ aUp.Y() += nLength / 2;
+ aDown.Y() -= nLength / 2;
+ break;
+ default:; // prevent warning
+ }
+ }
+
+ int nDist;
+ for( i = 0; i < nColumnCount - 1; i++)
+ {
+ int nGutter = pColMgr->GetGutterWidth(i);
+ nDist = pColMgr->GetColWidth( i ) + nGutter;
+ nDist -= (i == 0) ?
+ nGutter/2 :
+ 0;
+ aUp.X() += nDist;
+ aDown.X() += nDist;
+ DrawLine( aUp, aDown );
+
+ }
+ }
+ }
+}
+
+/*-----------------25.10.96 09.15-------------------
+
+--------------------------------------------------*/
+
+
+SwColumnOnlyExample::SwColumnOnlyExample( Window* pParent, const ResId& rResId) :
+ Window(pParent, rResId),
+ m_aFrmSize(1,1)
+{
+ SetMapMode( MapMode( MAP_TWIP ) );
+ m_aWinSize = GetOutputSizePixel();
+ m_aWinSize.Height() -= 4;
+ m_aWinSize.Width() -= 4;
+
+ m_aWinSize = PixelToLogic( m_aWinSize );
+
+ SetBorderStyle( WINDOW_BORDER_MONO );
+
+ m_aFrmSize = SvxPaperInfo::GetPaperSize(PAPER_A4);// DIN A4
+ ::FitToActualSize(m_aCols, (USHORT)m_aFrmSize.Width());
+
+ long nHeight = m_aFrmSize.Height();
+ Fraction aScale( m_aWinSize.Height(), nHeight );
+ MapMode aMapMode( GetMapMode() );
+ aMapMode.SetScaleX( aScale );
+ aMapMode.SetScaleY( aScale );
+ SetMapMode( aMapMode );
+}
+
+/*-----------------25.10.96 09.16-------------------
+
+--------------------------------------------------*/
+
+
+void SwColumnOnlyExample::Paint( const Rectangle& /*rRect*/ )
+{
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ const Color& rFieldColor = rStyleSettings.GetFieldColor();
+ const Color& rDlgColor = rStyleSettings.GetDialogColor();
+ const Color& rFieldTextColor = SwViewOption::GetFontColor();
+ Color aGrayColor(COL_LIGHTGRAY);
+ if(rFieldColor == aGrayColor)
+ aGrayColor.Invert();
+
+ Size aLogSize(PixelToLogic(GetOutputSizePixel()));
+ Rectangle aCompleteRect(Point(0,0), aLogSize);
+ SetLineColor(rDlgColor);
+ SetFillColor(rDlgColor);
+ DrawRect(aCompleteRect);
+
+ SetLineColor( rFieldTextColor );
+ Point aTL( (aLogSize.Width() - m_aFrmSize.Width()) / 2,
+ (aLogSize.Height() - m_aFrmSize.Height()) / 2);
+ Rectangle aRect(aTL, m_aFrmSize);
+
+ //draw a shadow rectangle
+ SetFillColor( Color(COL_GRAY) );
+ Rectangle aShadowRect(aRect);
+ aShadowRect.Move(aTL.Y(), aTL.Y());
+ DrawRect(aShadowRect);
+
+ SetFillColor( rFieldColor );
+ DrawRect(aRect);
+
+ SetFillColor( aGrayColor );
+
+ //Spaltentrenner?
+ long nLength = aLogSize.Height() - 2 * aTL.Y();
+ Point aUp( aTL );
+ Point aDown( aTL.X(), nLength );
+ BOOL bLines = FALSE;
+ if(m_aCols.GetLineAdj() != COLADJ_NONE)
+ {
+ bLines = TRUE;
+
+ USHORT nPercent = m_aCols.GetLineHeight();
+ if( nPercent != 100 )
+ {
+ nLength -= nLength * nPercent / 100;
+ switch(m_aCols.GetLineAdj())
+ {
+ case COLADJ_BOTTOM: aUp.Y() += nLength; break;
+ case COLADJ_TOP: aDown.Y() -= nLength; break;
+ case COLADJ_CENTER:
+ aUp.Y() += nLength / 2;
+ aDown.Y() -= nLength / 2;
+ break;
+ default:; //prevent warning
+ }
+ }
+
+ }
+ const SwColumns& rCols = m_aCols.GetColumns();
+ USHORT nColCount = rCols.Count();
+ if( nColCount )
+ {
+ DrawRect(aRect);
+ SetFillColor( rFieldColor );
+ Rectangle aFrmRect(aTL, m_aFrmSize);
+ long nSum = aTL.X();
+ for(USHORT i = 0; i < nColCount; i++)
+ {
+ SwColumn* pCol = rCols[i];
+ aFrmRect.Left() = nSum + pCol->GetLeft();//nSum + pCol->GetLeft() + aTL.X();
+ nSum += pCol->GetWishWidth();
+ aFrmRect.Right() = nSum - pCol->GetRight();
+ DrawRect(aFrmRect);
+ }
+ if(bLines )
+ {
+ nSum = aTL.X();
+ for(USHORT i = 0; i < nColCount - 1; i++)
+ {
+ nSum += rCols[i]->GetWishWidth();
+ aUp.X() = nSum;
+ aDown.X() = nSum;
+ DrawLine(aUp, aDown);
+ }
+ }
+ }
+}
+
+/*-----------------25.10.96 12.05-------------------
+
+--------------------------------------------------*/
+
+
+void SwColumnOnlyExample::SetColumns(const SwFmtCol& rCol)
+{
+ m_aCols = rCol;
+ USHORT nWishSum = m_aCols.GetWishWidth();
+ long nFrmWidth = m_aFrmSize.Width();
+ SwColumns& rCols = m_aCols.GetColumns();
+ USHORT nColCount = rCols.Count();
+
+ for(USHORT i = 0; i < nColCount; i++)
+ {
+ SwColumn* pCol = rCols[i];
+ long nWish = pCol->GetWishWidth();
+ nWish *= nFrmWidth;
+ nWish /= nWishSum;
+ pCol->SetWishWidth((USHORT)nWish);
+ long nLeft = pCol->GetLeft();
+ nLeft *= nFrmWidth;
+ nLeft /= nWishSum;
+ pCol->SetLeft((USHORT)nLeft);
+ long nRight = pCol->GetRight();
+ nRight *= nFrmWidth;
+ nRight /= nWishSum;
+ pCol->SetRight((USHORT)nRight);
+ }
+ // #97495# make sure that the automatic column width's are always equal
+ if(nColCount && m_aCols.IsOrtho())
+ {
+ sal_Int32 nColumnWidthSum = 0;
+ USHORT i;
+ for(i = 0; i < nColCount; ++i)
+ {
+ SwColumn* pCol = rCols[i];
+ nColumnWidthSum += pCol->GetWishWidth();
+ nColumnWidthSum -= (pCol->GetRight() + pCol->GetLeft());
+ }
+ nColumnWidthSum /= nColCount;
+ for(i = 0; i < nColCount; ++i)
+ {
+ SwColumn* pCol = rCols[i];
+ pCol->SetWishWidth( static_cast< USHORT >(nColumnWidthSum + pCol->GetRight() + pCol->GetLeft()));
+ }
+ }
+}
+/* -----------------------------08.02.2002 11:44------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwPageGridExample::~SwPageGridExample()
+{
+ delete pGridItem;
+}
+/* -----------------------------08.02.2002 11:48------------------------------
+
+ ---------------------------------------------------------------------------*/
+#define MAX_ROWS 10
+#define MAX_LINES 15
+void SwPageGridExample::DrawPage( const Point& rOrg,
+ const BOOL bSecond,
+ const BOOL bEnabled )
+{
+ SwPageExample::DrawPage(rOrg, bSecond, bEnabled);
+ if(pGridItem && pGridItem->GetGridType())
+ {
+ //paint the grid now
+ Color aLineColor = pGridItem->GetColor();
+ if(aLineColor.GetColor() == COL_AUTO)
+ {
+ aLineColor = GetFillColor();
+ aLineColor.Invert();
+ }
+ SetLineColor(aLineColor);
+ long nL = GetLeft();
+ long nR = GetRight();
+
+ if ( GetUsage() == SVX_PAGE_MIRROR && !bSecond )
+ {
+ // fuer gespiegelt drehen
+ nL = GetRight();
+ nR = GetLeft();
+ }
+
+ Rectangle aRect;
+ aRect.Right() = rOrg.X() + GetSize().Width() - nR;
+ aRect.Left() = rOrg.X() + nL;
+ aRect.Top() = rOrg.Y() + GetTop()
+ + GetHdHeight() + GetHdDist();
+ aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom()
+ - GetFtHeight() - GetFtDist();
+
+ //increase the values to get a 'viewable' preview
+ sal_Int32 nBaseHeight = pGridItem->GetBaseHeight() * 3;
+ sal_Int32 nRubyHeight = pGridItem->GetRubyHeight() * 3;
+
+ //detect height of rectangles
+ Rectangle aRubyRect(aRect.TopLeft(),
+ m_bVertical ?
+ Size(nRubyHeight, aRect.GetHeight()) :
+ Size(aRect.GetWidth(), nRubyHeight));
+ Rectangle aCharRect(aRect.TopLeft(),
+ m_bVertical ?
+ Size(nBaseHeight, aRect.GetHeight()) :
+ Size(aRect.GetWidth(), nBaseHeight));
+
+ sal_Int32 nLineHeight = nBaseHeight + nRubyHeight;
+
+ //detect count of rectangles
+ sal_Int32 nLines = (m_bVertical ? aRect.GetWidth(): aRect.GetHeight()) / nLineHeight;
+ if(nLines > pGridItem->GetLines())
+ nLines = pGridItem->GetLines();
+
+ // determine start position
+ if(m_bVertical)
+ {
+ sal_Int16 nXStart = static_cast< sal_Int16 >(aRect.GetWidth() / 2 - nLineHeight * nLines /2);
+ aRubyRect.Move(nXStart, 0);
+ aCharRect.Move(nXStart, 0);
+ }
+ else
+ {
+ sal_Int16 nYStart = static_cast< sal_Int16 >(aRect.GetHeight() / 2 - nLineHeight * nLines /2);
+ aRubyRect.Move(0, nYStart);
+ aCharRect.Move(0, nYStart);
+ }
+
+ if(pGridItem->IsRubyTextBelow())
+ m_bVertical ? aRubyRect.Move(nBaseHeight, 0) : aRubyRect.Move(0, nBaseHeight);
+ else
+ m_bVertical ? aCharRect.Move(nRubyHeight, 0) : aCharRect.Move(0, nRubyHeight);
+
+ //vertical lines
+ sal_Bool bBothLines = pGridItem->GetGridType() == GRID_LINES_CHARS;
+ SetFillColor( Color( COL_TRANSPARENT ) );
+ sal_Int32 nXMove = m_bVertical ? nLineHeight : 0;
+ sal_Int32 nYMove = m_bVertical ? 0 : nLineHeight;
+ for(sal_Int32 nLine = 0; nLine < nLines; nLine++)
+ {
+ DrawRect(aRubyRect);
+ DrawRect(aCharRect);
+ if(bBothLines)
+ {
+ Point aStart = aCharRect.TopLeft();
+ Point aEnd = m_bVertical ? aCharRect.TopRight() : aCharRect.BottomLeft();
+ while(m_bVertical ? aStart.Y() < aRect.Bottom(): aStart.X() < aRect.Right())
+ {
+ DrawLine(aStart, aEnd);
+ if(m_bVertical)
+ aStart.Y() = aEnd.Y() += nBaseHeight;
+ else
+ aStart.X() = aEnd.X() += nBaseHeight;
+ }
+ }
+ aRubyRect.Move(nXMove, nYMove);
+ aCharRect.Move(nXMove, nYMove);
+ }
+ }
+}
+/* -----------------------------08.02.2002 11:48------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwPageGridExample::UpdateExample( const SfxItemSet& rSet )
+{
+ DELETEZ(pGridItem);
+ //get the grid information
+ if(SFX_ITEM_AVAILABLE <= rSet.GetItemState(RES_TEXTGRID, TRUE))
+ pGridItem = (SwTextGridItem*)((const SwTextGridItem&)rSet.Get(RES_TEXTGRID)).Clone();
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( RES_FRAMEDIR, TRUE ))
+ {
+ const SvxFrameDirectionItem& rDirItem =
+ (const SvxFrameDirectionItem&)rSet.Get(RES_FRAMEDIR);
+ m_bVertical = rDirItem.GetValue() == FRMDIR_VERT_TOP_RIGHT||
+ rDirItem.GetValue() == FRMDIR_VERT_TOP_LEFT;
+ }
+ SwPageExample::UpdateExample(rSet);
+}
+
diff --git a/sw/source/ui/frmdlg/colmgr.cxx b/sw/source/ui/frmdlg/colmgr.cxx
new file mode 100644
index 000000000000..0e18946af778
--- /dev/null
+++ b/sw/source/ui/frmdlg/colmgr.cxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include "hintids.hxx"
+#include <editeng/lrspitem.hxx>
+
+#include "frmmgr.hxx"
+#include "frmfmt.hxx"
+#include "colmgr.hxx"
+
+
+// PRIVATE METHODES ------------------------------------------------------
+/*------------------------------------------------------------------------
+ Beschreibung: Spaltenbreite auf aktuelle Breite einstellen
+------------------------------------------------------------------------*/
+
+
+
+void FitToActualSize(SwFmtCol& rCol, USHORT nWidth)
+{
+ const USHORT nCount = rCol.GetColumns().Count();
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ const USHORT nTmp = rCol.CalcColWidth(i, nWidth);
+ rCol.GetColumns()[i]->SetWishWidth(nTmp);
+ }
+ rCol.SetWishWidth(nWidth);
+}
+
+
+// PUBLIC METHODES -------------------------------------------------------
+/*------------------------------------------------------------------------
+ Beschreibung: Setzen Spaltenanzahl und Gutterwidth
+------------------------------------------------------------------------*/
+
+
+
+void SwColMgr::SetCount(USHORT nCount, USHORT nGutterWidth)
+{
+ aFmtCol.Init(nCount, nGutterWidth, nWidth);
+ aFmtCol.SetWishWidth(nWidth);
+ aFmtCol.SetGutterWidth(nGutterWidth, nWidth);
+}
+
+
+
+USHORT SwColMgr::GetGutterWidth( USHORT nPos ) const
+{
+ USHORT nRet;
+ if(nPos == USHRT_MAX )
+ nRet = GetCount() > 1 ? aFmtCol.GetGutterWidth() : DEF_GUTTER_WIDTH;
+ else
+ {
+ DBG_ASSERT(nPos < GetCount() - 1, "Spalte ueberindiziert" );
+ const SwColumns& rCols = aFmtCol.GetColumns();
+ nRet = rCols.GetObject(nPos)->GetRight() + rCols.GetObject(nPos + 1)->GetLeft();
+ }
+ return nRet;
+}
+
+/*-----------------22.10.96 14.28-------------------
+
+--------------------------------------------------*/
+
+
+void SwColMgr::SetGutterWidth(USHORT nGutterWidth, USHORT nPos )
+{
+ if(nPos == USHRT_MAX)
+ aFmtCol.SetGutterWidth(nGutterWidth, nWidth);
+ else
+ {
+ DBG_ASSERT(nPos < GetCount() - 1, "Spalte ueberindiziert" );
+ SwColumns& rCols = aFmtCol.GetColumns();
+ USHORT nGutterWidth2 = nGutterWidth / 2;
+ rCols.GetObject(nPos)->SetRight(nGutterWidth2);
+ rCols.GetObject(nPos + 1)->SetLeft(nGutterWidth2);
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Hoehe Trennlinie
+------------------------------------------------------------------------*/
+
+
+
+short SwColMgr::GetLineHeightPercent() const
+{
+ return (short)aFmtCol.GetLineHeight();
+}
+
+
+
+void SwColMgr::SetLineHeightPercent(short nPercent)
+{
+ ASSERT(nPercent <= 100, LineHeight darf nur bis 100 % gross sein);
+ aFmtCol.SetLineHeight((BYTE)nPercent);
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Spaltenbreite
+------------------------------------------------------------------------*/
+
+
+
+USHORT SwColMgr::GetColWidth(USHORT nIdx) const
+{
+ ASSERT(nIdx < GetCount(), Spaltenarray ueberindiziert.);
+ return aFmtCol.CalcPrtColWidth(nIdx, nWidth);
+}
+
+
+
+void SwColMgr::SetColWidth(USHORT nIdx, USHORT nWd)
+{
+ ASSERT(nIdx < GetCount(), Spaltenarray ueberindiziert.);
+ aFmtCol.GetColumns()[nIdx]->SetWishWidth(nWd);
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Groesse neu setzen
+ --------------------------------------------------------------------*/
+
+
+
+void SwColMgr::SetActualWidth(USHORT nW)
+{
+ nWidth = nW;
+ ::FitToActualSize(aFmtCol, nW);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: ctor
+ --------------------------------------------------------------------*/
+
+
+
+SwColMgr::SwColMgr(const SfxItemSet& rSet, USHORT nActWidth) :
+ aFmtCol((const SwFmtCol&)rSet.Get(RES_COL)),
+ nWidth(nActWidth)
+{
+ if(nWidth == USHRT_MAX)
+ {
+ nWidth = (USHORT)((const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE)).GetWidth();
+ if (nWidth < MINLAY)
+ nWidth = USHRT_MAX;
+ const SvxLRSpaceItem &rLR = (const SvxLRSpaceItem&)rSet.Get(RES_LR_SPACE);
+ nWidth = nWidth - (USHORT)rLR.GetLeft();
+ nWidth = nWidth - (USHORT)rLR.GetRight();
+ }
+ ::FitToActualSize(aFmtCol, nWidth);
+}
+
+
+
+
+SwColMgr::~SwColMgr() {}
+
+
+
+
+
+
diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx
new file mode 100644
index 000000000000..0a3c8cc33623
--- /dev/null
+++ b/sw/source/ui/frmdlg/column.cxx
@@ -0,0 +1,1463 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include "column.hxx"
+
+#include "hintids.hxx"
+#include <svx/htmlmode.hxx>
+#include <editeng/borderline.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include "editeng/frmdiritem.hxx"
+#include <svl/ctloptions.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/msgbox.hxx>
+#include <swmodule.hxx>
+
+#include <helpid.h>
+#include "globals.hrc"
+#include "swtypes.hxx"
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "docsh.hxx"
+#include "uitool.hxx"
+#include "cmdid.h"
+#include "viewopt.hxx"
+#include "format.hxx"
+#include "frmmgr.hxx"
+#include "frmdlg.hxx"
+#include "colmgr.hxx"
+#include "prcntfld.hxx"
+#include "paratr.hxx"
+#include "frmui.hrc"
+#include "poolfmt.hrc"
+#include "column.hrc"
+#include <section.hxx>
+#include <docary.hxx>
+#include <pagedesc.hxx>
+
+#define FRAME_FORMAT_WIDTH 1000
+
+// sw/inc/fmtclds.hxx
+SV_IMPL_PTRARR( SwColumns, SwColumnPtr )
+
+/*--------------------------------------------------------------------
+ Beschreibung: Statische Daten
+ --------------------------------------------------------------------*/
+
+static const USHORT __FAR_DATA nLines[] = {
+ DEF_LINE_WIDTH_0,
+ DEF_LINE_WIDTH_1,
+ DEF_LINE_WIDTH_2,
+ DEF_LINE_WIDTH_3,
+ DEF_LINE_WIDTH_4
+};
+
+static const USHORT nLineCount = sizeof(nLines) / sizeof(nLines[0]);
+static const USHORT nVisCols = 3;
+
+inline BOOL IsMarkInSameSection( SwWrtShell& rWrtSh, const SwSection* pSect )
+{
+ rWrtSh.SwapPam();
+ BOOL bRet = pSect == rWrtSh.GetCurrSection();
+ rWrtSh.SwapPam();
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwColumnDlg::SwColumnDlg(Window* pParent, SwWrtShell& rSh) :
+ SfxModalDialog(pParent, SW_RES(DLG_COLUMN)),
+ aOK(this, SW_RES(PB_OK)),
+ aCancel(this, SW_RES(PB_CANCEL)),
+ aHelp(this, SW_RES(PB_HELP)),
+ aApplyToFT(this, SW_RES(FT_APPLY_TO)),
+ aApplyToLB(this, SW_RES(LB_APPLY_TO)),
+ rWrtShell(rSh),
+ pPageSet(0),
+ pSectionSet(0),
+ pSelectionSet(0),
+ pFrameSet(0),
+ nOldSelection(0),
+ nSelectionWidth(0),
+ bPageChanged(FALSE),
+ bSectionChanged(FALSE),
+ bSelSectionChanged(FALSE),
+ bFrameChanged(FALSE)
+{
+ FreeResource();
+
+ SwRect aRect;
+ rWrtShell.CalcBoundRect(aRect, FLY_AS_CHAR);
+
+ nSelectionWidth = aRect.Width();
+
+ SfxItemSet* pColPgSet = 0;
+ static USHORT __READONLY_DATA aSectIds[] = { RES_COL, RES_COL,
+ RES_FRM_SIZE, RES_FRM_SIZE,
+ RES_COLUMNBALANCE, RES_FRAMEDIR,
+ 0 };
+
+ const SwSection* pCurrSection = rWrtShell.GetCurrSection();
+ USHORT nFullSectCnt = rWrtShell.GetFullSelectedSectionCount();
+ if( pCurrSection && ( !rWrtShell.HasSelection() || 0 != nFullSectCnt ))
+ {
+ nSelectionWidth = rSh.GetSectionWidth(*pCurrSection->GetFmt());
+ if ( !nSelectionWidth )
+ nSelectionWidth = USHRT_MAX;
+ pSectionSet = new SfxItemSet( rWrtShell.GetAttrPool(), aSectIds );
+ pSectionSet->Put( pCurrSection->GetFmt()->GetAttrSet() );
+ pColPgSet = pSectionSet;
+ aApplyToLB.RemoveEntry( aApplyToLB.GetEntryPos(
+ (void*)( 1 >= nFullSectCnt
+ ? LISTBOX_SECTIONS
+ : LISTBOX_SECTION )));
+ }
+ else
+ {
+ aApplyToLB.RemoveEntry(aApplyToLB.GetEntryPos( (void*) LISTBOX_SECTION ));
+ aApplyToLB.RemoveEntry(aApplyToLB.GetEntryPos( (void*) LISTBOX_SECTIONS ));
+ }
+
+ if( rWrtShell.HasSelection() && rWrtShell.IsInsRegionAvailable() &&
+ ( !pCurrSection || ( 1 != nFullSectCnt &&
+ IsMarkInSameSection( rWrtShell, pCurrSection ) )))
+ {
+ pSelectionSet = new SfxItemSet( rWrtShell.GetAttrPool(), aSectIds );
+ pColPgSet = pSelectionSet;
+ }
+ else
+ aApplyToLB.RemoveEntry(aApplyToLB.GetEntryPos( (void*) LISTBOX_SELECTION ));
+
+ if( rWrtShell.GetFlyFrmFmt() )
+ {
+ const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt() ;
+ pFrameSet = new SfxItemSet(rWrtShell.GetAttrPool(), aSectIds );
+ pFrameSet->Put(pFmt->GetFrmSize());
+ pFrameSet->Put(pFmt->GetCol());
+ pColPgSet = pFrameSet;
+ }
+ else
+ aApplyToLB.RemoveEntry(aApplyToLB.GetEntryPos( (void*) LISTBOX_FRAME ));
+
+
+ USHORT nPagePos = aApplyToLB.GetEntryPos( (void*) LISTBOX_PAGE );
+ const SwPageDesc* pPageDesc = rWrtShell.GetSelectedPageDescs();
+ if( pPageDesc )
+ {
+ pPageSet = new SfxItemSet( rWrtShell.GetAttrPool(),
+ RES_COL, RES_COL,
+ RES_FRM_SIZE, RES_FRM_SIZE,
+ RES_LR_SPACE, RES_LR_SPACE,
+ 0 );
+
+ String sPageStr = aApplyToLB.GetEntry(nPagePos);
+ aApplyToLB.RemoveEntry( nPagePos );
+ sPageStr += pPageDesc->GetName();
+ aApplyToLB.InsertEntry( sPageStr, nPagePos );
+ aApplyToLB.SetEntryData( nPagePos, (void*) LISTBOX_PAGE);
+
+ const SwFrmFmt &rFmt = pPageDesc->GetMaster();
+ nPageWidth = rFmt.GetFrmSize().GetSize().Width();
+
+ const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)rFmt.GetLRSpace();
+ const SvxBoxItem& rBox = (const SvxBoxItem&) rFmt.GetBox();
+ nPageWidth -= rLRSpace.GetLeft() + rLRSpace.GetRight() + rBox.GetDistance();
+
+ pPageSet->Put(rFmt.GetCol());
+ pPageSet->Put(rFmt.GetLRSpace());
+ pColPgSet = pPageSet;
+ }
+ else
+ aApplyToLB.RemoveEntry( nPagePos );
+
+
+ ASSERT( pColPgSet, "" );
+ // TabPage erzeugen
+ SwColumnPage* pPage = (SwColumnPage*) SwColumnPage::Create( this,
+ *pColPgSet );
+ pTabPage = pPage;
+
+ //Groesse anpassen
+ Size aPageSize(pTabPage->GetSizePixel());
+ Size aDlgSize(GetOutputSizePixel());
+ aDlgSize.Height() = aPageSize.Height();
+ SetOutputSizePixel(aDlgSize);
+ pTabPage->Show();
+
+ aApplyToLB.SelectEntryPos(0);
+ ObjectHdl(0);
+
+ aApplyToLB.SetSelectHdl(LINK(this, SwColumnDlg, ObjectHdl));
+ aOK.SetClickHdl(LINK(this, SwColumnDlg, OkHdl));
+ //#i80458# if no columns can be set then disable OK
+ if( !aApplyToLB.GetEntryCount() )
+ aOK.Enable( sal_False );
+ //#i97810# set focus to the TabPage
+ pTabPage->ActivateColumnControl();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwColumnDlg::~SwColumnDlg()
+{
+ delete pTabPage;
+ delete pPageSet;
+ delete pSectionSet;
+ delete pSelectionSet;
+}
+
+/* -----------------26.05.99 11:40-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK(SwColumnDlg, ObjectHdl, ListBox*, pBox)
+{
+ SfxItemSet* pSet = 0;
+ switch(nOldSelection)
+ {
+ case LISTBOX_SELECTION :
+ pSet = pSelectionSet;
+ break;
+ case LISTBOX_SECTION :
+ pSet = pSectionSet;
+ bSectionChanged = TRUE;
+ break;
+ case LISTBOX_SECTIONS :
+ pSet = pSectionSet;
+ bSelSectionChanged = TRUE;
+ break;
+ case LISTBOX_PAGE :
+ pSet = pPageSet;
+ bPageChanged = TRUE;
+ break;
+ case LISTBOX_FRAME:
+ pSet = pFrameSet;
+ bFrameChanged = TRUE;
+ break;
+ }
+ if(pBox)
+ {
+ pTabPage->FillItemSet(*pSet);
+ }
+ nOldSelection = (long)aApplyToLB.GetEntryData(aApplyToLB.GetSelectEntryPos());
+ long nWidth = nSelectionWidth;
+ switch(nOldSelection)
+ {
+ case LISTBOX_SELECTION :
+ pSet = pSelectionSet;
+ if( pSelectionSet )
+ pSet->Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth, nWidth));
+ break;
+ case LISTBOX_SECTION :
+ case LISTBOX_SECTIONS :
+ pSet = pSectionSet;
+ pSet->Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth, nWidth));
+ break;
+ case LISTBOX_PAGE :
+ nWidth = nPageWidth;
+ pSet = pPageSet;
+ pSet->Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth, nWidth));
+ break;
+ case LISTBOX_FRAME:
+ pSet = pFrameSet;
+ break;
+ }
+
+ BOOL bIsSection = pSet == pSectionSet || pSet == pSelectionSet;
+ pTabPage->ShowBalance(bIsSection);
+ pTabPage->SetInSection(bIsSection);
+ pTabPage->SetFrmMode(TRUE);
+ pTabPage->SetPageWidth(nWidth);
+ if( pSet )
+ pTabPage->Reset(*pSet);
+ return 0;
+}
+/* -----------------26.05.99 12:32-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK(SwColumnDlg, OkHdl, OKButton*, EMPTYARG)
+{
+ //aktuelle Selektion auswerten
+ SfxItemSet* pSet = 0;
+ switch(nOldSelection)
+ {
+ case LISTBOX_SELECTION :
+ pSet = pSelectionSet;
+ break;
+ case LISTBOX_SECTION :
+ pSet = pSectionSet;
+ bSectionChanged = TRUE;
+ break;
+ case LISTBOX_SECTIONS :
+ pSet = pSectionSet;
+ bSelSectionChanged = TRUE;
+ break;
+ case LISTBOX_PAGE :
+ pSet = pPageSet;
+ bPageChanged = TRUE;
+ break;
+ case LISTBOX_FRAME:
+ pSet = pFrameSet;
+ bFrameChanged = TRUE;
+ break;
+ }
+ pTabPage->FillItemSet(*pSet);
+
+ if(pSelectionSet && SFX_ITEM_SET == pSelectionSet->GetItemState(RES_COL))
+ {
+ //Bereich mit Spalten einfuegen
+ const SwFmtCol& rColItem = (const SwFmtCol&)pSelectionSet->Get(RES_COL);
+ //nur, wenn es auch Spalten gibt!
+ if(rColItem.GetNumCols() > 1)
+ rWrtShell.GetView().GetViewFrame()->GetDispatcher()->Execute(
+ FN_INSERT_REGION, SFX_CALLMODE_ASYNCHRON, *pSelectionSet );
+ }
+
+ if(pSectionSet && pSectionSet->Count() && bSectionChanged )
+ {
+ const SwSection* pCurrSection = rWrtShell.GetCurrSection();
+ const SwSectionFmt* pFmt = pCurrSection->GetFmt();
+ USHORT nNewPos = rWrtShell.GetSectionFmtPos( *pFmt );
+ SwSectionData aData(*pCurrSection);
+ rWrtShell.UpdateSection( nNewPos, aData, pSectionSet );
+ }
+
+ if(pSectionSet && pSectionSet->Count() && bSelSectionChanged )
+ {
+ rWrtShell.SetSectionAttr( *pSectionSet );
+ }
+
+ if(pPageSet && SFX_ITEM_SET == pPageSet->GetItemState(RES_COL) && bPageChanged)
+ {
+ // aktuellen PageDescriptor ermitteln und damit den Set fuellen
+ const USHORT nCurIdx = rWrtShell.GetCurPageDesc();
+ SwPageDesc aPageDesc(rWrtShell.GetPageDesc(nCurIdx));
+ SwFrmFmt &rFmt = aPageDesc.GetMaster();
+ rFmt.SetFmtAttr(pPageSet->Get(RES_COL));
+ rWrtShell.ChgPageDesc(nCurIdx, aPageDesc);
+ }
+ if(pFrameSet && SFX_ITEM_SET == pFrameSet->GetItemState(RES_COL) && bFrameChanged)
+ {
+ SfxItemSet aTmp(*pFrameSet->GetPool(), RES_COL, RES_COL);
+ aTmp.Put(*pFrameSet);
+ rWrtShell.StartAction();
+ rWrtShell.Push();
+ rWrtShell.SetFlyFrmAttr( aTmp );
+ //die Rahmenselektion wieder aufheben
+ if(rWrtShell.IsFrmSelected())
+ {
+ rWrtShell.UnSelectFrm();
+ rWrtShell.LeaveSelFrmMode();
+ }
+ rWrtShell.Pop();
+ rWrtShell.EndAction();
+ }
+ EndDialog(RET_OK);
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+#if OSL_DEBUG_LEVEL < 2
+inline
+#endif
+USHORT GetMaxWidth( SwColMgr* pColMgr, USHORT nCols )
+{
+ USHORT nMax = pColMgr->GetActualSize();
+ if( --nCols )
+ nMax -= pColMgr->GetGutterWidth() * nCols;
+ return nMax;
+}
+
+static USHORT __FAR_DATA aPageRg[] = {
+ RES_COL, RES_COL,
+ 0
+};
+
+
+DBG_NAME(columnhdl)
+
+
+
+USHORT lcl_LineWidthToPos(ULONG nWidth)
+{
+ const USHORT nUShortWidth = (USHORT)nWidth;
+ for(USHORT i = 0; i < nLineCount; ++i)
+ if(nUShortWidth == nLines[i])
+ return i;
+ return 0;
+}
+
+
+
+void SwColumnPage::ResetColWidth()
+{
+ if( nCols )
+ {
+ USHORT nWidth = GetMaxWidth( pColMgr, nCols );
+ nWidth = nWidth / nCols;
+
+ for(USHORT i = 0; i < nCols; ++i)
+ nColWidth[i] = (long) nWidth;
+ }
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Jetzt als TabPage
+ --------------------------------------------------------------------*/
+
+
+
+SwColumnPage::SwColumnPage(Window *pParent, const SfxItemSet &rSet)
+
+ : SfxTabPage(pParent, SW_RES(TP_COLUMN), rSet),
+
+ aClNrLbl(this, SW_RES(FT_NUMBER )),
+ aCLNrEdt(this, SW_RES(ED_NUMBER )),
+ aDefaultVS(this, SW_RES(VS_DEFAULTS)),
+ aBalanceColsCB(this, SW_RES(CB_BALANCECOLS)),
+ aFLGroup(this, SW_RES(FL_COLUMNS )),
+
+ aBtnUp(this, SW_RES(BTN_DOWN)),
+ aColumnFT(this, SW_RES(FT_COLUMN)),
+ aWidthFT(this, SW_RES(FT_WIDTH)),
+ aDistFT(this, SW_RES(FT_DIST)),
+ aLbl1(this, SW_RES(FT_1)),
+ aEd1(this, SW_RES(ED_1)),
+ aDistEd1(this, SW_RES(ED_DIST1)),
+ aLbl2(this, SW_RES(FT_2)),
+ aEd2(this, SW_RES(ED_2)),
+ aDistEd2(this, SW_RES(ED_DIST2)),
+ aLbl3(this, SW_RES(FT_3)),
+ aEd3(this, SW_RES(ED_3)),
+ aBtnDown(this, SW_RES(BTN_UP)),
+ aAutoWidthBox(this, SW_RES(CB_AUTO_WIDTH)),
+
+ aFLLayout(this, SW_RES(FL_LAYOUT)),
+
+ aLineTypeLbl(this, SW_RES(FT_STYLE)),
+ aLineTypeDLB(this, SW_RES(LB_STYLE)),
+ aLineHeightLbl(this, SW_RES(FT_HEIGHT)),
+ aLineHeightEdit(this, SW_RES(ED_HEIGHT)),
+ aLinePosLbl(this, SW_RES(FT_POSITION)),
+ aLinePosDLB(this, SW_RES(LB_POSITION)),
+ aFLLineType(this, SW_RES(FL_LINETYPE)),
+
+ aVertFL(this, SW_RES(FL_VERT)),
+ aPropertiesFL( this, SW_RES( FL_PROPERTIES )),
+ aTextDirectionFT( this, SW_RES( FT_TEXTDIRECTION )),
+ aTextDirectionLB( this, SW_RES( LB_TEXTDIRECTION )),
+
+ aPgeExampleWN(this, SW_RES(WN_BSP)),
+ aFrmExampleWN(this, SW_RES(WN_BSP)),
+
+ pColMgr(0),
+
+ nFirstVis(0),
+ nMinWidth(MINLAY),
+ pModifiedField(0),
+ bFormat(FALSE),
+ bFrm(FALSE),
+ bHtmlMode(FALSE),
+ bLockUpdate(FALSE)
+{
+ USHORT i;
+
+ FreeResource();
+ SetExchangeSupport();
+
+ aDefaultVS.SetHelpId(HID_COLUMN_VALUESET);
+ aDefaultVS.SetColCount( 5 );
+ aDefaultVS.SetStyle( aDefaultVS.GetStyle()
+ | WB_ITEMBORDER
+ | WB_DOUBLEBORDER );
+
+ for( i = 0; i < 5; i++)
+ aDefaultVS.InsertItem( i + 1, i );
+
+ aDefaultVS.SetSelectHdl(LINK(this, SwColumnPage, SetDefaultsHdl));
+
+ // Controls fuer Zusaetzebereich beim MoreButton anmelden
+ Link aCLNrLk = LINK(this, SwColumnPage, ColModify);
+ aCLNrEdt.SetLoseFocusHdl(aCLNrLk);
+ aCLNrEdt.SetUpHdl(aCLNrLk);
+ aCLNrEdt.SetDownHdl(aCLNrLk);
+ Link aLk = LINK(this, SwColumnPage, GapModify);
+ aDistEd1.SetUpHdl(aLk);
+ aDistEd1.SetDownHdl(aLk);
+ aDistEd1.SetLoseFocusHdl(aLk);
+ aDistEd2.SetUpHdl(aLk);
+ aDistEd2.SetDownHdl(aLk);
+ aDistEd2.SetLoseFocusHdl(aLk);
+
+ aLk = LINK(this, SwColumnPage, EdModify);
+
+ aEd1.SetUpHdl(aLk);
+ aEd1.SetDownHdl(aLk);
+ aEd1.SetLoseFocusHdl(aLk);
+
+ aEd2.SetUpHdl(aLk);
+ aEd2.SetDownHdl(aLk);
+ aEd2.SetLoseFocusHdl(aLk);
+
+ aEd3.SetUpHdl(aLk);
+ aEd3.SetDownHdl(aLk);
+ aEd3.SetLoseFocusHdl(aLk);
+
+ aBtnUp.SetClickHdl(LINK(this, SwColumnPage, Up));
+ aBtnDown.SetClickHdl(LINK(this, SwColumnPage, Down));
+ aAutoWidthBox.SetClickHdl(LINK(this, SwColumnPage, AutoWidthHdl));
+
+ aLk = LINK( this, SwColumnPage, UpdateColMgr );
+ aLineTypeDLB.SetSelectHdl( aLk );
+ aLineHeightEdit.SetModifyHdl( aLk );
+ aLinePosDLB.SetSelectHdl( aLk );
+
+ // Trennlinie
+ aLineTypeDLB.SetUnit( FUNIT_POINT );
+ aLineTypeDLB.SetSourceUnit( FUNIT_TWIP );
+ for( i = 0; i < nLineCount; ++i )
+ aLineTypeDLB.InsertEntry( 100 * nLines[ i ] );
+}
+
+
+
+SwColumnPage::~SwColumnPage()
+{
+ delete pColMgr;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwColumnPage::SetPageWidth(long nPageWidth)
+{
+ long nNewMaxWidth = static_cast< long >(aEd1.NormalizePercent(nPageWidth));
+
+ aDistEd1.SetMax(nNewMaxWidth, FUNIT_TWIP);
+ aDistEd2.SetMax(nNewMaxWidth, FUNIT_TWIP);
+ aEd1.SetMax(nNewMaxWidth, FUNIT_TWIP);
+ aEd2.SetMax(nNewMaxWidth, FUNIT_TWIP);
+ aEd3.SetMax(nNewMaxWidth, FUNIT_TWIP);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+void SwColumnPage::Reset(const SfxItemSet &rSet)
+{
+ USHORT nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current());
+ if(nHtmlMode & HTMLMODE_ON)
+ {
+ bHtmlMode = TRUE;
+ aAutoWidthBox.Enable(FALSE);
+ }
+ FieldUnit aMetric = ::GetDfltMetric(bHtmlMode);
+ SetMetric(aEd1, aMetric);
+ SetMetric(aEd2, aMetric);
+ SetMetric(aEd3, aMetric);
+ SetMetric(aDistEd1, aMetric);
+ SetMetric(aDistEd2, aMetric);
+
+ delete pColMgr;
+ pColMgr = new SwColMgr(rSet);
+ nCols = pColMgr->GetCount() ;
+ aCLNrEdt.SetMax(Max((USHORT)aCLNrEdt.GetMax(), (USHORT)nCols));
+ aCLNrEdt.SetLast(Max(nCols,(USHORT)aCLNrEdt.GetMax()));
+
+ if(bFrm)
+ {
+ if(bFormat) // hier gibt es keine Size
+ pColMgr->SetActualWidth(FRAME_FORMAT_WIDTH);
+ else
+ {
+ const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE);
+ const SvxBoxItem& rBox = (const SvxBoxItem&) rSet.Get(RES_BOX);
+ pColMgr->SetActualWidth((USHORT)rSize.GetSize().Width() - rBox.GetDistance());
+ }
+ }
+ if(aBalanceColsCB.IsVisible())
+ {
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_COLUMNBALANCE, FALSE, &pItem ))
+ aBalanceColsCB.Check(!((const SwFmtNoBalancedColumns*)pItem)->GetValue());
+ else
+ aBalanceColsCB.Check( TRUE );
+ }
+
+ //text direction
+ if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( RES_FRAMEDIR ) )
+ {
+ const SvxFrameDirectionItem& rItem = (const SvxFrameDirectionItem&)rSet.Get(RES_FRAMEDIR);
+ sal_uInt32 nVal = rItem.GetValue();
+ USHORT nPos = aTextDirectionLB.GetEntryPos( (void*) nVal );
+ aTextDirectionLB.SelectEntryPos( nPos );
+ aTextDirectionLB.SaveValue();
+ }
+
+ Init();
+ ActivatePage( rSet );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: TabPage erzeugen
+ --------------------------------------------------------------------*/
+
+
+
+SfxTabPage* SwColumnPage::Create(Window *pParent, const SfxItemSet &rSet)
+{
+ return new SwColumnPage(pParent, rSet);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Attribute in den Set stopfen bei OK
+ --------------------------------------------------------------------*/
+
+
+
+BOOL SwColumnPage::FillItemSet(SfxItemSet &rSet)
+{
+ if(aCLNrEdt.HasChildPathFocus())
+ aCLNrEdt.GetDownHdl().Call(&aCLNrEdt);
+ // Im ItemSet setzen
+ // Die aktuellen Einstellungen sind
+ // schon vorhanden
+ //
+ const SfxPoolItem* pOldItem;
+ const SwFmtCol& rCol = pColMgr->GetColumns();
+ if(0 == (pOldItem = GetOldItem( rSet, RES_COL )) ||
+ rCol != *pOldItem )
+ rSet.Put(rCol);
+
+ if(aBalanceColsCB.IsVisible() )
+ {
+ rSet.Put(SwFmtNoBalancedColumns(!aBalanceColsCB.IsChecked() ));
+ }
+ USHORT nPos;
+ if( aTextDirectionLB.IsVisible() &&
+ ( nPos = aTextDirectionLB.GetSelectEntryPos() ) !=
+ aTextDirectionLB.GetSavedValue() )
+ {
+ sal_uInt32 nDirection = (sal_uInt32)(sal_IntPtr)aTextDirectionLB.GetEntryData( nPos );
+ rSet.Put( SvxFrameDirectionItem( (SvxFrameDirection)nDirection, RES_FRAMEDIR));
+ }
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: ColumnManager updaten
+ --------------------------------------------------------------------*/
+
+
+
+IMPL_LINK( SwColumnPage, UpdateColMgr, void *, /*pField*/ )
+{
+ long nGutterWidth = pColMgr->GetGutterWidth();
+ if(nCols > 1)
+ {
+ // Ermitteln, ob die schmalste Spalte zu schmal ist
+ // fuer den eingestellten Spaltenabstand
+ long nMin = nColWidth[0];
+ USHORT i;
+
+ for( i = 1; i < nCols; ++i)
+ nMin = Min(nMin, nColWidth[i]);
+
+ BOOL bAutoWidth = aAutoWidthBox.IsChecked();
+ if(!bAutoWidth)
+ {
+ pColMgr->SetAutoWidth(FALSE);
+ // falls der Benutzer nicht die Gesamtbreite vergeben hat,
+ // den fehlenden Betrag auf die letzte Spalte addieren.
+ long nSum = 0;
+ for(i = 0; i < nCols; ++i)
+ nSum += nColWidth[i];
+ nGutterWidth = 0;
+ for(i = 0; i < nCols - 1; ++i)
+ nGutterWidth += nColDist[i];
+ nSum += nGutterWidth;
+
+ long nMaxW = pColMgr->GetActualSize();
+
+ if( nSum < nMaxW )
+ nColWidth[nCols - 1] += nMaxW - nSum;
+
+ pColMgr->SetColWidth( 0, static_cast< USHORT >(nColWidth[0] + (USHORT)nColDist[0]/2) );
+ for( i = 1; i < nCols-1; ++i )
+ {
+ long nActDist = (nColDist[i] + nColDist[i - 1]) / 2;
+ pColMgr->SetColWidth( i, (USHORT)nColWidth[i] + (USHORT)nActDist );
+ }
+ pColMgr->SetColWidth( nCols-1, static_cast< USHORT >(nColWidth[nCols-1] + nColDist[nCols -2]/2) );
+
+ }
+
+ // keins ist ausgeschaltet
+ const USHORT nPos = aLineTypeDLB.GetSelectEntryPos();
+ BOOL bEnable = 0 != nPos;
+ aLineHeightEdit.Enable( bEnable );
+ aLineHeightLbl.Enable( bEnable );
+ if( !bEnable )
+ pColMgr->SetNoLine();
+ else if( LISTBOX_ENTRY_NOTFOUND != nPos )
+ {
+ pColMgr->SetLineWidthAndColor(nLines[nPos - 1], Color(COL_BLACK) );
+ pColMgr->SetAdjust( SwColLineAdj(
+ aLinePosDLB.GetSelectEntryPos() + 1) );
+ pColMgr->SetLineHeightPercent((short)aLineHeightEdit.GetValue());
+ bEnable = pColMgr->GetLineHeightPercent() != 100;
+ }
+ aLinePosLbl.Enable( bEnable );
+ aLinePosDLB.Enable( bEnable );
+ }
+ else
+ {
+ pColMgr->NoCols();
+ nCols = 0;
+ }
+
+ //Maximalwerte setzen
+ aCLNrEdt.SetMax(Max(1L,
+ Min(long(nMaxCols), long( pColMgr->GetActualSize() / (nGutterWidth + MINLAY)) )));
+ aCLNrEdt.SetLast(aCLNrEdt.GetMax());
+ aCLNrEdt.Reformat();
+
+ //Beispielfenster anregen
+ if(!bLockUpdate)
+ {
+ if(bFrm)
+ {
+ aFrmExampleWN.SetColumns( pColMgr->GetColumns() );
+ aFrmExampleWN.Invalidate();
+ }
+ else
+ aPgeExampleWN.Invalidate();
+ }
+
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Initialisierung
+------------------------------------------------------------------------*/
+
+
+
+void SwColumnPage::Init()
+{
+ aCLNrEdt.SetValue(nCols);
+
+ BOOL bAutoWidth = pColMgr->IsAutoWidth() || bHtmlMode;
+ aAutoWidthBox.Check( bAutoWidth );
+
+ sal_Int32 nColumnWidthSum = 0;
+ // Setzen der Breiten
+ USHORT i;
+ for(i = 0; i < nCols; ++i)
+ {
+ nColWidth[i] = pColMgr->GetColWidth(i);
+ nColumnWidthSum += nColWidth[i];
+ if(i < nCols - 1)
+ nColDist[i] = pColMgr->GetGutterWidth(i);
+ }
+
+ if( 1 < nCols )
+ {
+ // #97495# make sure that the automatic column widht's are always equal
+ if(bAutoWidth)
+ {
+ nColumnWidthSum /= nCols;
+ for(i = 0; i < nCols; ++i)
+ nColWidth[i] = nColumnWidthSum;
+ }
+ SwColLineAdj eAdj = pColMgr->GetAdjust();
+ if( COLADJ_NONE == eAdj ) // der Dialog kennt kein NONE!
+ {
+ eAdj = COLADJ_TOP;
+ //ohne Adjust auch kein Linientyp
+ aLineTypeDLB.SelectEntryPos( 0 );
+ aLineHeightEdit.SetValue( 100 );
+ }
+ else
+ {
+ aLineTypeDLB.SelectEntryPos( lcl_LineWidthToPos(( pColMgr->GetLineWidth() )) + 1);
+ aLineHeightEdit.SetValue( pColMgr->GetLineHeightPercent() );
+ }
+ aLinePosDLB.SelectEntryPos( static_cast< USHORT >(eAdj - 1) );
+ }
+ else
+ {
+ aLinePosDLB.SelectEntryPos( 0 );
+ aLineTypeDLB.SelectEntryPos( 0 );
+ aLineHeightEdit.SetValue( 100 );
+ }
+
+ UpdateCols();
+ Update();
+
+ // Maximale Spaltenzahl setzen
+ // Werte kleiner als 1 sind nicht erlaubt
+ aCLNrEdt.SetMax(Max(1L,
+ Min(long(nMaxCols), long( pColMgr->GetActualSize() / nMinWidth) )));
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Die Anzahl der Spalten hat sich veraendert -- hier werden
+ die Controls fuer die Bearbeitung der Spalten entsprechend
+ der Spaltenzahl en- oder disabled.
+ Falls es mehr als nVisCols (= 3) Spalten gibt, werden
+ alle Edit enabled und die Buttons fuer das Scrollen
+ ebenfalls.
+ Andernfalls werden die Edits jeweils fuer die entsprechenden
+ Spaltenzahl enabled; eine Spalte kann nicht bearbeitet werden.
+------------------------------------------------------------------------*/
+
+
+
+void SwColumnPage::UpdateCols()
+{
+ BOOL bEnableBtns= FALSE;
+ BOOL bEnable12 = FALSE;
+ BOOL bEnable3 = FALSE;
+ const BOOL bEdit = !aAutoWidthBox.IsChecked();
+ if ( nCols > nVisCols )
+ {
+ bEnableBtns = TRUE && !bHtmlMode;
+ bEnable12 = bEnable3 = bEdit;
+ }
+ else if( bEdit )
+ {
+ // hier gibt es absichtlich kaum noch breaks
+ switch(nCols)
+ {
+ case 3: bEnable3 = TRUE;
+ case 2: bEnable12= TRUE; break;
+ default: /* do nothing */;
+ }
+ }
+ aEd1.Enable( bEnable12 );
+ aDistEd1.Enable(nCols > 1);
+ aEd2.Enable( bEnable12 );
+ aDistEd2.Enable(bEnable3);
+ aEd3.Enable( bEnable3 );
+ aLbl1.Enable(bEnable12 );
+ aLbl2.Enable(bEnable12 );
+ aLbl3.Enable(bEnable3 );
+ aBtnUp.Enable( bEnableBtns );
+ aBtnDown.Enable( bEnableBtns );
+
+ const BOOL bEnable = nCols > 1;
+ if( !bEnable )
+ {
+ aLinePosDLB.Enable( FALSE );
+ aLinePosLbl.Enable( FALSE );
+ }
+ aLineHeightEdit.Enable( bEnable );
+ aLineHeightLbl.Enable( bEnable );
+ aLineTypeDLB.Enable( bEnable );
+ aLineTypeLbl.Enable( bEnable );
+ aAutoWidthBox.Enable( bEnable && !bHtmlMode );
+}
+
+void SwColumnPage::SetLabels( USHORT nVis )
+{
+ String sLbl( '~' );
+
+ String sLbl2( String::CreateFromInt32( nVis + 1 ));
+ sLbl2.Insert(sLbl, sLbl2.Len() - 1);
+ aLbl1.SetText(sLbl2);
+
+ sLbl2 = String::CreateFromInt32( nVis + 2 );
+ sLbl2.Insert(sLbl, sLbl2.Len() - 1);
+ aLbl2.SetText(sLbl2);
+
+ sLbl2 = String::CreateFromInt32( nVis + 3 );
+ sLbl2.Insert(sLbl, sLbl2.Len() - 1);
+ aLbl3.SetText(sLbl2);
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Handler, der bei einer Veraenderung der Spaltenzahl
+ gerufen wird.
+ Eine Aenderung der Spaltenzahl ueberschreibt eventuelle
+ Breiteneinstellungen des Benutzers; alle Spalten sind
+ gleich breit.
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwColumnPage, ColModify, NumericField *, pNF )
+{
+ nCols = (USHORT)aCLNrEdt.GetValue();
+ //#107890# the handler is also called from LoseFocus()
+ //then no change has been made and thus no action should be taken
+ // #i17816# changing the displayed types within the ValueSet
+ //from two columns to two columns with different settings doesn't invalidate the
+ // example windows in ::ColModify()
+ if(!pNF ||(pColMgr->GetCount() != nCols))
+ {
+ if(pNF)
+ aDefaultVS.SetNoSelection();
+ long nDist = static_cast< long >(aDistEd1.DenormalizePercent(aDistEd1.GetValue(FUNIT_TWIP)));
+ pColMgr->SetCount(nCols, (USHORT)nDist);
+ for(USHORT i = 0; i < nCols; i++)
+ nColDist[i] = nDist;
+ nFirstVis = 0;
+ SetLabels( nFirstVis );
+ UpdateCols();
+ ResetColWidth();
+ Update();
+ }
+
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Modify- Handler fuer eine Aenderung der Spaltenbreite
+ oder des Spaltenabstandes.
+ Diese Aenderungen wirken sich erst zeitversetzt aus.
+ Durch eine Aenderung der Spaltenbreite wird die automatische
+ Berechnung der Spaltenbreite ausser Kraft gesetzt; erst
+ eine Aenderung der Spaltenzahl kehrt wieder zu diesem
+ Default zurueck.
+------------------------------------------------------------------------*/
+
+
+
+IMPL_LINK( SwColumnPage, GapModify, PercentField *, pFld )
+{
+ long nActValue = static_cast< long >(pFld->DenormalizePercent(pFld->GetValue(FUNIT_TWIP)));
+ if(nCols < 2)
+ return 0;
+ if(aAutoWidthBox.IsChecked())
+ {
+ USHORT nMaxGap = pColMgr->GetActualSize() - nCols * MINLAY;
+ DBG_ASSERT(nCols, "Abstand kann nicht ohne Spalten eingestellt werden");
+ nMaxGap /= nCols - 1;
+ if(nActValue > nMaxGap)
+ {
+ nActValue = nMaxGap;
+ aDistEd1.SetPrcntValue(aDistEd1.NormalizePercent(nMaxGap), FUNIT_TWIP);
+ }
+ pColMgr->SetGutterWidth((USHORT)nActValue);
+ for(USHORT i = 0; i < nCols; i++)
+ nColDist[i] = nActValue;
+
+ ResetColWidth();
+ UpdateCols();
+ }
+ else
+
+ {
+ USHORT nOffset = 0;
+ if(pFld == &aDistEd2)
+ {
+ nOffset = 1;
+ }
+ long nDiff = nActValue - nColDist[nFirstVis + nOffset];
+ if(nDiff)
+ {
+ long nLeft = nColWidth[nFirstVis + nOffset];
+ long nRight = nColWidth[nFirstVis + nOffset + 1];
+ if(nLeft + nRight + 2 * MINLAY < nDiff)
+ nDiff = nLeft + nRight - 2 * MINLAY;
+ if(nDiff < nRight - MINLAY)
+ {
+ nRight -= nDiff;
+ }
+ else
+ {
+ long nTemp = nDiff - nRight + MINLAY;
+ nRight = MINLAY;
+ if(nLeft > nTemp - MINLAY)
+ {
+ nLeft -= nTemp;
+ nTemp = 0;
+ }
+ else
+ {
+ nTemp -= nLeft + MINLAY;
+ nLeft = MINLAY;
+ }
+ nDiff = nTemp;
+ }
+ nColWidth[nFirstVis + nOffset] = nLeft;
+ nColWidth[nFirstVis + nOffset + 1] = nRight;
+ nColDist[nFirstVis + nOffset] += nDiff;
+
+ pColMgr->SetColWidth( nFirstVis + nOffset, USHORT(nLeft) );
+ pColMgr->SetColWidth( nFirstVis + nOffset + 1, USHORT(nRight) );
+ pColMgr->SetGutterWidth( USHORT(nColDist[nFirstVis + nOffset]), nFirstVis + nOffset );
+ }
+
+ }
+ Update();
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+
+IMPL_LINK( SwColumnPage, EdModify, PercentField *, pField )
+{
+ pModifiedField = pField;
+ Timeout(0);
+ return 0;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Handler hinter der Checkbox fuer automatische Breite.
+ Ist die Box gecheckt, koennen keine expliziten Werte
+ fuer die Spaltenbreite eingegeben werden.
+------------------------------------------------------------------------*/
+
+
+
+IMPL_LINK( SwColumnPage, AutoWidthHdl, CheckBox *, pBox )
+{
+ long nDist = static_cast< long >(aDistEd1.DenormalizePercent(aDistEd1.GetValue(FUNIT_TWIP)));
+ pColMgr->SetCount(nCols, (USHORT)nDist);
+ for(USHORT i = 0; i < nCols; i++)
+ nColDist[i] = nDist;
+ if(pBox->IsChecked())
+ {
+ pColMgr->SetGutterWidth(USHORT(nDist));
+ ResetColWidth();
+ }
+ pColMgr->SetAutoWidth(pBox->IsChecked(), USHORT(nDist));
+ UpdateCols();
+ Update();
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Raufscrollen der Inhalte der Edits.
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwColumnPage, Up, Button *, EMPTYARG )
+{
+ if( nFirstVis )
+ {
+ --nFirstVis;
+ SetLabels( nFirstVis );
+ Update();
+ }
+ return 0;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Runterscrollen der Inhalte der Edits.
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwColumnPage, Down, Button *, EMPTYARG )
+{
+ if( nFirstVis + nVisCols < nCols )
+ {
+ ++nFirstVis;
+ SetLabels( nFirstVis );
+ Update();
+ }
+ return 0;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Relikt aus alten Zeiten - jetzt direkt ohne time
+ * Timer- Handler; angetriggert durch eine Aenderung der
+ Spaltenbreite oder des Spaltenabstandes.
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwColumnPage, Timeout, Timer *, EMPTYARG )
+{
+ DBG_PROFSTART(columnhdl) ;
+ if(pModifiedField)
+ {
+ // Finden der veraenderten Spalte
+ USHORT nChanged = nFirstVis;
+ if(pModifiedField == &aEd2)
+ ++nChanged;
+ else if(pModifiedField == &aEd3)
+ nChanged += 2;
+ /*else if(pModifiedField == &aEd4)
+ nChanged += 3;*/
+
+ long nNewWidth = (USHORT)
+ pModifiedField->DenormalizePercent(pModifiedField->GetValue(FUNIT_TWIP));
+ long nDiff = nNewWidth - nColWidth[nChanged];
+
+ // wenn es die letzte Spalte ist
+ if(nChanged == nCols - 1)
+ {
+ nColWidth[0] -= nDiff;
+ if(nColWidth[0] < (long)nMinWidth)
+ {
+ nNewWidth -= nMinWidth - nColWidth[0];
+ nColWidth[0] = nMinWidth;
+ }
+
+ }
+ else if(nDiff)
+ {
+ nColWidth[nChanged + 1] -= nDiff;
+ if(nColWidth[nChanged + 1] < (long) nMinWidth)
+ {
+ nNewWidth -= nMinWidth - nColWidth[nChanged + 1];
+ nColWidth[nChanged + 1] = nMinWidth;
+ }
+ }
+ nColWidth[nChanged] = nNewWidth;
+ pModifiedField = 0;
+ }
+ Update();
+ DBG_PROFSTOP(columnhdl) ;
+ return 0;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Aktualisierung der Anzeige
+------------------------------------------------------------------------*/
+
+
+
+void SwColumnPage::Update()
+{
+ aBalanceColsCB.Enable(nCols > 1);
+ if(nCols >= 2)
+ {
+ aEd1.SetPrcntValue(aEd1.NormalizePercent(nColWidth[nFirstVis]), FUNIT_TWIP);
+ aDistEd1.SetPrcntValue(aDistEd1.NormalizePercent(nColDist[nFirstVis]), FUNIT_TWIP);
+ aEd2.SetPrcntValue(aEd2.NormalizePercent(nColWidth[nFirstVis + 1]), FUNIT_TWIP);
+ if(nCols >= 3)
+ {
+ aDistEd2.SetPrcntValue(aDistEd2.NormalizePercent(nColDist[nFirstVis + 1]), FUNIT_TWIP);
+ aEd3.SetPrcntValue(aEd3.NormalizePercent(nColWidth[nFirstVis + 2]), FUNIT_TWIP);
+ }
+ else
+ {
+ aEd3.SetText(aEmptyStr);
+ aDistEd2.SetText(aEmptyStr);
+ }
+ }
+ else
+ {
+ aEd1.SetText(aEmptyStr);
+ aEd2.SetText(aEmptyStr);
+ aEd3.SetText(aEmptyStr);
+ aDistEd1.SetText(aEmptyStr);
+ aDistEd2.SetText(aEmptyStr);
+ }
+ UpdateColMgr(0);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Update Bsp
+ --------------------------------------------------------------------*/
+
+
+
+void SwColumnPage::ActivatePage(const SfxItemSet& rSet)
+{
+ if(!bFrm)
+ {
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_PAGE_SIZE ))
+ {
+ const SvxSizeItem& rSize = (const SvxSizeItem&)rSet.Get(
+ SID_ATTR_PAGE_SIZE);
+ const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)rSet.Get(
+ RES_LR_SPACE );
+ const SvxBoxItem& rBox = (const SvxBoxItem&) rSet.Get(RES_BOX);
+ USHORT nActWidth = static_cast< USHORT >(rSize.GetSize().Width()
+ - rLRSpace.GetLeft() - rLRSpace.GetRight() - rBox.GetDistance());
+
+ if( pColMgr->GetActualSize() != nActWidth)
+ {
+ pColMgr->SetActualWidth(nActWidth);
+ ColModify( 0 );
+ UpdateColMgr( 0 );
+ }
+ }
+ aFrmExampleWN.Hide();
+ aPgeExampleWN.UpdateExample( rSet, pColMgr );
+ aPgeExampleWN.Show();
+
+ }
+ else
+ {
+ aPgeExampleWN.Hide();
+ aFrmExampleWN.Show();
+
+ // Size
+ const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE);
+ const SvxBoxItem& rBox = (const SvxBoxItem&) rSet.Get(RES_BOX);
+
+ long nDistance = rBox.GetDistance();
+ const USHORT nTotalWish = bFormat ? FRAME_FORMAT_WIDTH : USHORT(rSize.GetWidth() - 2 * nDistance);
+
+ // Maximalwerte der Spaltenbreiten setzen
+ SetPageWidth(nTotalWish);
+
+ if(pColMgr->GetActualSize() != nTotalWish)
+ {
+ pColMgr->SetActualWidth(nTotalWish);
+ Init();
+ }
+ BOOL bPercent;
+ // im Rahmenformat nur relative Angaben
+ if ( bFormat || (rSize.GetWidthPercent() && rSize.GetWidthPercent() != 0xff) )
+ {
+ // Wert fuer 100% setzen
+ aEd1.SetRefValue(nTotalWish);
+ aEd2.SetRefValue(nTotalWish);
+ aEd3.SetRefValue(nTotalWish);
+ aDistEd1.SetRefValue(nTotalWish);
+ aDistEd2.SetRefValue(nTotalWish);
+
+ // Auf %-Darstellung umschalten
+ bPercent = TRUE;
+ }
+ else
+ bPercent = FALSE;
+
+ aEd1.ShowPercent(bPercent);
+ aEd2.ShowPercent(bPercent);
+ aEd3.ShowPercent(bPercent);
+ aDistEd1.ShowPercent(bPercent);
+ aDistEd2.ShowPercent(bPercent);
+ aDistEd1.MetricField::SetMin(0);
+ aDistEd2.MetricField::SetMin(0);
+ }
+ Update();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+int SwColumnPage::DeactivatePage(SfxItemSet *_pSet)
+{
+ if(_pSet)
+ FillItemSet(*_pSet);
+
+ return TRUE;
+}
+
+
+
+USHORT* SwColumnPage::GetRanges()
+{
+ return aPageRg;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+IMPL_LINK( SwColumnPage, SetDefaultsHdl, ValueSet *, pVS )
+{
+ USHORT nItem = pVS->GetSelectItemId();
+ if( nItem < 4 )
+ {
+ aCLNrEdt.SetValue( nItem );
+ aAutoWidthBox.Check();
+ aDistEd1.SetPrcntValue(0);
+ ColModify(0);
+ }
+ else
+ {
+ bLockUpdate = TRUE;
+ aCLNrEdt.SetValue( 2 );
+ aAutoWidthBox.Check(FALSE);
+ aDistEd1.SetPrcntValue(0);
+ ColModify(0);
+ // jetzt noch das Breitenverhaeltnisse auf 2 : 1 bzw. 1 : 2 stellen
+ USHORT nSmall = pColMgr->GetActualSize() / 3;
+ if(nItem == 4)
+ {
+ aEd2.SetPrcntValue(aEd2.NormalizePercent(long(nSmall)), FUNIT_TWIP);
+ pModifiedField = &aEd2;
+ }
+ else
+ {
+ aEd1.SetPrcntValue(aEd1.NormalizePercent(long(nSmall)), FUNIT_TWIP);
+ pModifiedField = &aEd1;
+ }
+ bLockUpdate = FALSE;
+ Timeout(0);
+
+ }
+ return 0;
+}
+
+/*-----------------25.10.96 11.41-------------------
+
+--------------------------------------------------*/
+
+
+void SwColumnPage::SetFrmMode(BOOL bMod)
+{
+ bFrm = bMod;
+}
+/* -----------------------------2002/06/19 13:08------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwColumnPage::SetInSection(BOOL bSet)
+{
+ if(!SW_MOD()->GetCTLOptions().IsCTLFontEnabled())
+ return;
+
+ aVertFL.Show(bSet);
+ aPropertiesFL.Show(bSet);
+ aTextDirectionFT.Show(bSet);
+ aTextDirectionLB.Show(bSet);
+ if(bSet)
+ {
+ //resize line type FixedLine
+ Point aLtPos = aFLLineType.GetPosPixel();
+ Point aPropPos = aPropertiesFL.GetPosPixel();
+ Size aSz = aFLLineType.GetSizePixel();
+ aSz.Width() = aPropPos.X() - aLtPos.X() - LogicToPixel(Size(8, 8), MAP_APPFONT).Width();
+ aFLLineType.SetSizePixel(aSz);
+ }
+ else
+ {
+ Size aSz = aFLLineType.GetSizePixel();
+ aSz.Width() = LogicToPixel(Size(248, 248), MAP_APPFONT).Width();
+ aFLLineType.SetSizePixel(aSz);
+ }
+}
+
+/*-----------------07.03.97 08.33-------------------
+
+--------------------------------------------------*/
+
+
+void ColumnValueSet::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ OutputDevice* pDev = rUDEvt.GetDevice();
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ Rectangle aRect = rUDEvt.GetRect();
+ USHORT nItemId = rUDEvt.GetItemId();
+ long nRectWidth = aRect.GetWidth();
+ long nRectHeight = aRect.GetHeight();
+
+ Point aBLPos = aRect.TopLeft();
+ Color aFillColor(pDev->GetFillColor());
+ Color aLineColor(pDev->GetLineColor());
+ pDev->SetFillColor(rStyleSettings.GetFieldColor());
+ pDev->SetLineColor(SwViewOption::GetFontColor());
+
+ long nStep = Abs(Abs(nRectHeight * 95 /100) / 11);
+ long nTop = (nRectHeight - 11 * nStep ) / 2;
+ USHORT nCols = 0;
+ long nStarts[3];
+ long nEnds[3];
+ nStarts[0] = nRectWidth * 10 / 100;
+ switch( nItemId )
+ {
+ case 1:
+ nEnds[0] = nRectWidth * 9 / 10;
+ nCols = 1;
+ break;
+ case 2: nCols = 2;
+ nEnds[0] = nRectWidth * 45 / 100;
+ nStarts[1] = nEnds[0] + nStep;
+ nEnds[1] = nRectWidth * 9 / 10;
+ break;
+ case 3: nCols = 3;
+ nEnds[0] = nRectWidth * 30 / 100;
+ nStarts[1] = nEnds[0] + nStep;
+ nEnds[1] = nRectWidth * 63 / 100;
+ nStarts[2] = nEnds[1] + nStep;
+ nEnds[2] = nRectWidth * 9 / 10;
+ break;
+ case 4: nCols = 2;
+ nEnds[0] = nRectWidth * 63 / 100;
+ nStarts[1] = nEnds[0] + nStep;
+ nEnds[1] = nRectWidth * 9 / 10;
+ break;
+ case 5: nCols = 2;
+ nEnds[0] = nRectWidth * 30 / 100;
+ nStarts[1] = nEnds[0] + nStep;
+ nEnds[1] = nRectWidth * 9 / 10;
+ break;
+ }
+ for(USHORT j = 0; j < nCols; j++ )
+ {
+ Point aStart(aBLPos.X() + nStarts[j], 0);
+ Point aEnd(aBLPos.X() + nEnds[j], 0);
+ for( USHORT i = 0; i < 12; i ++)
+ {
+ aStart.Y() = aEnd.Y() = aBLPos.Y() + nTop + i * nStep;
+ pDev->DrawLine(aStart, aEnd);
+ }
+ }
+ pDev->SetFillColor(aFillColor);
+ pDev->SetLineColor(aLineColor);
+}
+
+/*-----------------07.03.97 08.48-------------------
+
+--------------------------------------------------*/
+
+ColumnValueSet::~ColumnValueSet()
+{
+}
+/* -----------------------------02.04.2002 16:01------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ColumnValueSet::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ Format();
+ }
+ ValueSet::DataChanged( rDCEvt );
+}
+
diff --git a/sw/source/ui/frmdlg/column.hrc b/sw/source/ui/frmdlg/column.hrc
new file mode 100644
index 000000000000..dd8b81e0c91a
--- /dev/null
+++ b/sw/source/ui/frmdlg/column.hrc
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define FT_NUMBER 1
+#define ED_NUMBER 2
+#define FT_DISTANCE 3
+#define ED_DISTANCE 4
+#define CB_AUTO_WIDTH 4
+#define FL_COLUMNS 6
+
+#define FT_1 20
+#define FT_2 21
+#define FT_3 22
+
+
+#define ED_1 25
+#define ED_2 26
+#define ED_3 27
+
+
+#define BTN_UP 30
+#define BTN_DOWN 31
+#define FL_LAYOUT 32
+
+#define FT_STYLE 33
+#define LB_STYLE 34
+#define FT_HEIGHT 35
+#define ED_HEIGHT 36
+#define FT_POSITION 37
+#define LB_POSITION 38
+#define FL_LINETYPE 39
+
+#define WN_BSP 41
+
+#define LB_REFERENCE 42
+#define CB_REGISTER 43
+#define FL_REGISTER 44
+#define FT_REFERENCE 45
+
+#define ED_DIST1 46
+#define ED_DIST2 47
+
+#define FT_COLUMN 48
+#define FT_WIDTH 49
+#define FT_DIST 50
+#define VS_DEFAULTS 51
+#define IL_PRE_COLS 52
+
+#define FT_APPLY_TO 53
+#define LB_APPLY_TO 54
+#define PB_HELP 55
+#define PB_CANCEL 56
+#define PB_OK 57
+#define CB_BALANCECOLS 58
+#define FL_PROPERTIES 59
+#define FT_TEXTDIRECTION 60
+#define LB_TEXTDIRECTION 61
+#define FL_VERT 62
+
+#define LISTBOX_SELECTION 0
+#define LISTBOX_SECTION 1
+#define LISTBOX_SECTIONS 2
+#define LISTBOX_PAGE 3
+#define LISTBOX_FRAME 4
diff --git a/sw/source/ui/frmdlg/column.src b/sw/source/ui/frmdlg/column.src
new file mode 100644
index 000000000000..04e91ce3560a
--- /dev/null
+++ b/sw/source/ui/frmdlg/column.src
@@ -0,0 +1,419 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "column.hrc"
+#include "frmui.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ // #define TP_COLUMN 256
+TabPage TP_COLUMN
+{
+ HelpID = HID_COLUMN ;
+ Hide = TRUE;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Text [ en-US ] = "Columns" ;
+ FixedText FT_NUMBER
+ {
+ Pos = MAP_APPFONT ( 12 , 19 ) ;
+ Size = MAP_APPFONT ( 28 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Columns";
+ };
+ NumericField ED_NUMBER
+ {
+ HelpID = "sw:NumericField:TP_COLUMN:ED_NUMBER";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 24 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 20 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 20 ;
+ SpinSize = 1 ;
+ };
+ Control VS_DEFAULTS
+ {
+ Pos = MAP_APPFONT ( 50 , 14 ) ;
+ Size = MAP_APPFONT ( 110 , 28 ) ;
+ TabStop = TRUE ;
+ };
+ CheckBox CB_BALANCECOLS
+ {
+ HelpID = "sw:CheckBox:TP_COLUMN:CB_BALANCECOLS";
+ Pos = MAP_APPFONT ( 7 , 46 ) ;
+ Size = MAP_APPFONT ( 163 , 10 ) ;
+ Hide = TRUE;
+ Text [ en-US ] = "Evenly distribute contents ~to all columns";
+ };
+ FixedLine FL_COLUMNS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text [ en-US ] = "Settings";
+ };
+ FixedText FT_COLUMN
+ {
+ Pos = MAP_APPFONT ( 12 , 70 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Column";
+ };
+ Window WN_BSP
+ {
+ Pos = MAP_APPFONT ( 176 , 6 ) ;
+ Size = MAP_APPFONT ( 75 , 46 ) ;
+ };
+ ImageButton BTN_DOWN
+ {
+ HelpID = "sw:ImageButton:TP_COLUMN:BTN_DOWN";
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 62 , 69 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ SYMBOL = IMAGEBUTTON_ARROW_LEFT ;
+ };
+ FixedText FT_1
+ {
+ Pos = MAP_APPFONT ( 100 , 71 ) ;
+ Size = MAP_APPFONT ( 10 , 8 ) ;
+ Text = "~1" ;
+ Center = TRUE ;
+ };
+ FixedText FT_2
+ {
+ Pos = MAP_APPFONT ( 150 , 71 ) ;
+ Size = MAP_APPFONT ( 10 , 8 ) ;
+ Text = "~2" ;
+ Center = TRUE ;
+ };
+ FixedText FT_3
+ {
+ Pos = MAP_APPFONT ( 200 , 71 ) ;
+ Size = MAP_APPFONT ( 10 , 8 ) ;
+ Text = "~3" ;
+ Center = TRUE ;
+ };
+ ImageButton BTN_UP
+ {
+ HelpID = "sw:ImageButton:TP_COLUMN:BTN_UP";
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 238 , 69 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ SYMBOL = IMAGEBUTTON_ARROW_RIGHT ;
+ };
+ FixedText FT_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 85 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Width" ;
+ };
+ MetricField ED_1
+ {
+ HelpID = "sw:MetricField:TP_COLUMN:ED_1";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 87 , 83 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ MetricField ED_2
+ {
+ HelpID = "sw:MetricField:TP_COLUMN:ED_2";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 137 , 83 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ MetricField ED_3
+ {
+ HelpID = "sw:MetricField:TP_COLUMN:ED_3";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 187 , 83 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 101 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Spacing" ;
+ };
+ MetricField ED_DIST1
+ {
+ HelpID = "sw:MetricField:TP_COLUMN:ED_DIST1";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 112 , 99 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ MetricField ED_DIST2
+ {
+ HelpID = "sw:MetricField:TP_COLUMN:ED_DIST2";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 162 , 99 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ CheckBox CB_AUTO_WIDTH
+ {
+ HelpID = "sw:CheckBox:TP_COLUMN:CB_AUTO_WIDTH";
+ Pos = MAP_APPFONT ( 87 , 115 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ Text [ en-US ] = "Auto~Width" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_LAYOUT
+ {
+ Pos = MAP_APPFONT ( 6 , 58 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Width and spacing";
+ };
+
+ FixedText FT_STYLE
+ {
+ Pos = MAP_APPFONT ( 12 , 140 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "~Line" ;
+ Left = TRUE ;
+ };
+ ListBox LB_STYLE
+ {
+ HelpID = "sw:ListBox:TP_COLUMN:LB_STYLE";
+ Pos = MAP_APPFONT ( 50 , 138 ) ;
+ Size = MAP_APPFONT ( 60 , 66 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "None" ; Default ; > ;
+ };
+ };
+ FixedText FT_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 156 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "H~eight" ;
+ Left = TRUE ;
+ };
+ MetricField ED_HEIGHT
+ {
+ HelpID = "sw:MetricField:TP_COLUMN:ED_HEIGHT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 50 , 154 ) ;
+ Size = MAP_APPFONT ( 60 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 25 ;
+ Maximum = 100 ;
+ Value = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ First = 25 ;
+ Last = 100 ;
+ };
+ FixedText FT_POSITION
+ {
+ Pos = MAP_APPFONT ( 12 , 172 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Position" ;
+ };
+ ListBox LB_POSITION
+ {
+ HelpID = "sw:ListBox:TP_COLUMN:LB_POSITION";
+ Pos = MAP_APPFONT ( 50 , 170 ) ;
+ Size = MAP_APPFONT ( 60 , 40 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Top" ; Default ; > ;
+ < "Centered" ; Default ; > ;
+ < "Bottom" ; Default ; > ;
+ };
+ };
+ FixedLine FL_LINETYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 127 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Separator line" ;
+ };
+ FixedLine FL_VERT
+ {
+ Pos = MAP_APPFONT ( 116 , 138 ) ;
+ Size = MAP_APPFONT ( 4 , 43 ) ;
+ Hide = TRUE ;
+ Vert = TRUE;
+ };
+ FixedLine FL_PROPERTIES
+ {
+ Pos = MAP_APPFONT ( 121 , 127 ) ;
+ Size = MAP_APPFONT ( 133 , 8 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Properties";
+ };
+ FixedText FT_TEXTDIRECTION
+ {
+ Pos = MAP_APPFONT ( 127 , 138 ) ;
+ Size = MAP_APPFONT ( 127 , 8 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Text ~direction";
+ };
+ ListBox LB_TEXTDIRECTION
+ {
+ HelpID = "sw:ListBox:TP_COLUMN:LB_TEXTDIRECTION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 127 , 149 ) ;
+ Size = MAP_APPFONT ( 127 , 50 ) ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Left-to-right" ; 0; > ;
+ < "Right-to-left" ; 1; > ;
+ < "Use superordinate object settings" ; 4; > ;
+ };
+ };
+};
+
+ModalDialog DLG_COLUMN
+{
+ HelpID = HID_FORMAT_COLUMN;
+ Hide = TRUE;
+ Moveable = TRUE;
+ Size = MAP_APPFONT ( 316 , 135 ) ;
+ OKButton PB_OK
+ {
+ DefButton = TRUE ;
+ Pos = MAP_APPFONT ( 260 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 260 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 260 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_APPLY_TO
+ {
+ Pos = MAP_APPFONT ( 260 , 63 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Apply to";
+ };
+ ListBox LB_APPLY_TO
+ {
+ HelpID = "sw:ListBox:DLG_COLUMN:LB_APPLY_TO";
+ Pos = MAP_APPFONT ( 260 , 74 ) ;
+ Size = MAP_APPFONT ( 50 , 66 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Selection" ; LISTBOX_SELECTION; > ;
+ < "Current Section" ; LISTBOX_SECTION ; > ;
+ < "Selected section" ; LISTBOX_SECTIONS ; > ;
+ < "Frame" ; LISTBOX_FRAME ; > ;
+ < "Page Style: " ; LISTBOX_PAGE ; > ;
+ };
+ };
+ Text [ en-US ] = "Columns";
+};
+
+
diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
new file mode 100644
index 000000000000..e92cd4e0ae81
--- /dev/null
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -0,0 +1,652 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <cption.hxx>
+#include <fldmgr.hxx>
+#include <expfld.hxx>
+#include <numrule.hxx>
+#include <poolfmt.hxx>
+#include <docsh.hxx>
+#include <frmfmt.hxx>
+#include <calc.hxx>
+#include <uitool.hxx>
+#include <doc.hxx>
+#include <modcfg.hxx>
+#include <swmodule.hxx>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/text/GraphicCrop.hpp>
+#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
+#include <com/sun/star/text/XTextTableCursor.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <com/sun/star/text/TableColumnSeparator.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
+#include <com/sun/star/text/XTextEmbeddedObject.hpp>
+#include <com/sun/star/text/XTextFramesSupplier.hpp>
+#include <com/sun/star/text/XTextFrame.hpp>
+
+#ifndef _FRMUI_HRC
+#include <frmui.hrc>
+#endif
+#ifndef _CPTION_HRC
+#include <cption.hrc>
+#endif
+#include <SwStyleNameMapper.hxx>
+using namespace ::com::sun::star;
+
+extern String* GetOldGrfCat();
+extern String* GetOldTabCat();
+extern String* GetOldFrmCat();
+extern String* GetOldDrwCat();
+
+class SwSequenceOptionDialog : public SvxStandardDialog
+{
+ FixedLine aFlHeader;
+ FixedText aFtLevel;
+ ListBox aLbLevel;
+ FixedText aFtDelim;
+ Edit aEdDelim;
+
+ FixedLine aFlCatAndFrame;
+ FixedText aFtCharStyle;
+ ListBox aLbCharStyle;
+ CheckBox aApplyBorderAndShadowCB;
+
+ //#i61007# order of captions
+ FixedLine aFlCaptionOrder;
+ FixedText aFtCaptionOrder;
+ ListBox aLbCaptionOrder;
+
+ OKButton aOKButton;
+ CancelButton aCancelButton;
+ HelpButton aHelpButton;
+
+ SwView& rView;
+ String aFldTypeName;
+
+public:
+ SwSequenceOptionDialog( Window *pParent, SwView &rV,
+ const String& rSeqFldType );
+ virtual ~SwSequenceOptionDialog();
+ virtual void Apply();
+
+ bool IsApplyBorderAndShadow( void ) { return aApplyBorderAndShadowCB.IsChecked(); }
+ void SetApplyBorderAndShadow( bool bSet ) { aApplyBorderAndShadowCB.Check(bSet); }
+
+ //#i61007# order of captions
+ bool IsOrderNumberingFirst() const {return aLbCaptionOrder.GetSelectEntryPos() == 1;}
+ void SetOrderNumberingFirst(bool bSet) { aLbCaptionOrder.SelectEntryPos( bSet ? 1 : 0 ); }
+
+ void SetCharacterStyle(const String& rStyle);
+ String GetCharacterStyle() const;
+};
+
+SwCaptionDialog::SwCaptionDialog( Window *pParent, SwView &rV ) :
+
+ SvxStandardDialog( pParent, SW_RES(DLG_CAPTION) ),
+
+ aTextText (this, SW_RES(TXT_TEXT )),
+ aTextEdit (this, SW_RES(EDT_TEXT )),
+ aSettingsFL (this, SW_RES(FL_SETTINGS)),
+ aCategoryText (this, SW_RES(TXT_CATEGORY)),
+ aCategoryBox (this, SW_RES(BOX_CATEGORY)),
+ aFormatText (this, SW_RES(TXT_FORMAT )),
+ aFormatBox (this, SW_RES(BOX_FORMAT )),
+ aNumberingSeparatorFT(this, SW_RES(FT_NUM_SEP )),
+ aNumberingSeparatorED(this, SW_RES(ED_NUM_SEP )),
+ aSepText (this, SW_RES(TXT_SEP )),
+ aSepEdit (this, SW_RES(EDT_SEP )),
+ aPosText (this, SW_RES(TXT_POS )),
+ aPosBox (this, SW_RES(BOX_POS )),
+ aOKButton (this, SW_RES(BTN_OK )),
+ aCancelButton (this, SW_RES(BTN_CANCEL )),
+ aHelpButton (this, SW_RES(BTN_HELP )),
+ aAutoCaptionButton(this, SW_RES(BTN_AUTOCAPTION)),
+ aOptionButton (this, SW_RES(BTN_OPTION )),
+ sNone( SW_RES( STR_CATEGORY_NONE )),
+ aPrevWin (this, SW_RES(WIN_SAMPLE )),
+ rView( rV ),
+ pMgr( new SwFldMgr(rView.GetWrtShellPtr()) ),
+ bCopyAttributes( FALSE ),
+ bOrderNumberingFirst( SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst() )
+{
+ //#i61007# order of captions
+ if( bOrderNumberingFirst )
+ ApplyCaptionOrder();
+ SwWrtShell &rSh = rView.GetWrtShell();
+ uno::Reference< frame::XModel > xModel = rView.GetDocShell()->GetBaseModel();
+
+ eType = rSh.GetSelectionType();
+ if ( eType & nsSelectionType::SEL_OLE )
+ {
+ eType = nsSelectionType::SEL_GRF;
+ uno::Reference< text::XTextEmbeddedObjectsSupplier > xObjs(xModel, uno::UNO_QUERY);
+ xNameAccess = xObjs->getEmbeddedObjects();
+ }
+
+ Link aLk = LINK( this, SwCaptionDialog, ModifyHdl );
+ aCategoryBox.SetModifyHdl( aLk );
+ aTextEdit .SetModifyHdl( aLk );
+ aNumberingSeparatorED.SetModifyHdl ( aLk );
+ aSepEdit .SetModifyHdl( aLk );
+
+ aLk = LINK(this, SwCaptionDialog, SelectHdl);
+ aCategoryBox.SetSelectHdl( aLk );
+ aFormatBox .SetSelectHdl( aLk );
+ aOptionButton.SetClickHdl( LINK( this, SwCaptionDialog, OptionHdl ) );
+ aAutoCaptionButton.SetClickHdl(LINK(this, SwCaptionDialog, CaptionHdl));
+
+ aCategoryBox.InsertEntry( sNone );
+ sal_uInt16 i, nCount = pMgr->GetFldTypeCount();
+ for (i = 0; i < nCount; i++)
+ {
+ SwFieldType *pType = pMgr->GetFldType( USHRT_MAX, i );
+ if( pType->Which() == RES_SETEXPFLD &&
+ ((SwSetExpFieldType *) pType)->GetType() & nsSwGetSetExpType::GSE_SEQ )
+ aCategoryBox.InsertEntry(pType->GetName());
+ }
+
+ String* pString = 0;
+ sal_uInt16 nPoolId = 0;
+ if (eType & nsSelectionType::SEL_GRF)
+ {
+ nPoolId = RES_POOLCOLL_LABEL_ABB;
+ pString = ::GetOldGrfCat();
+ bCopyAttributes = TRUE;
+ sObjectName = rSh.GetFlyName();
+ //if not OLE
+ if(!xNameAccess.is())
+ {
+ uno::Reference< text::XTextGraphicObjectsSupplier > xGraphics(xModel, uno::UNO_QUERY);
+ xNameAccess = xGraphics->getGraphicObjects();
+ }
+
+ }
+ else if( eType & nsSelectionType::SEL_TBL )
+ {
+ nPoolId = RES_POOLCOLL_LABEL_TABLE;
+ pString = ::GetOldTabCat();
+ uno::Reference< text::XTextTablesSupplier > xTables(xModel, uno::UNO_QUERY);
+ xNameAccess = xTables->getTextTables();
+ sObjectName = rSh.GetTableFmt()->GetName();
+ }
+ else if( eType & nsSelectionType::SEL_FRM )
+ {
+ nPoolId = RES_POOLCOLL_LABEL_FRAME;
+ pString = ::GetOldFrmCat();
+ uno::Reference< text::XTextFramesSupplier > xFrms(xModel, uno::UNO_QUERY);
+ xNameAccess = xFrms->getTextFrames();
+ sObjectName = rSh.GetFlyName();
+ }
+ else if( eType == nsSelectionType::SEL_TXT )
+ {
+ nPoolId = RES_POOLCOLL_LABEL_FRAME;
+ pString = ::GetOldFrmCat();
+ }
+ else if( eType & nsSelectionType::SEL_DRW )
+ {
+ nPoolId = RES_POOLCOLL_LABEL_DRAWING;
+ pString = ::GetOldDrwCat();
+ }
+ if( nPoolId )
+ {
+ if( pString && pString->Len())
+ aCategoryBox.SetText( *pString );
+ else
+ aCategoryBox.SetText(
+ SwStyleNameMapper::GetUIName( nPoolId, aEmptyStr ));
+ }
+
+ // aFormatBox
+ sal_uInt16 nSelFmt = SVX_NUM_ARABIC;
+ nCount = pMgr->GetFldTypeCount();
+ SwFieldType* pFldType;
+ for ( i = nCount; i; )
+ if( ( pFldType = pMgr->GetFldType(USHRT_MAX, --i))->GetName() ==
+ aCategoryBox.GetText() )
+ {
+ nSelFmt = (sal_uInt16)((SwSetExpFieldType*)pFldType)->GetSeqFormat();
+ break;
+ }
+
+
+ nCount = pMgr->GetFormatCount(TYP_SEQFLD, sal_False);
+ for ( i = 0; i < nCount; ++i )
+ {
+ aFormatBox.InsertEntry( pMgr->GetFormatStr(TYP_SEQFLD, i) );
+ sal_uInt16 nFmtId = pMgr->GetFormatId(TYP_SEQFLD, i);
+ aFormatBox.SetEntryData( i, reinterpret_cast<void*>( nFmtId ) );
+ if( nFmtId == nSelFmt )
+ aFormatBox.SelectEntryPos( i );
+ }
+
+ // aPosBox
+ switch (eType)
+ {
+ case nsSelectionType::SEL_GRF:
+ case nsSelectionType::SEL_TBL:
+ case nsSelectionType::SEL_TBL | nsSelectionType::SEL_NUM:
+ case nsSelectionType::SEL_TBL | nsSelectionType::SEL_TXT:
+ case nsSelectionType::SEL_TBL | nsSelectionType::SEL_NUM | nsSelectionType::SEL_TXT:
+ case nsSelectionType::SEL_DRW:
+ case nsSelectionType::SEL_DRW | nsSelectionType::SEL_BEZ:
+ aPosBox.InsertEntry(SW_RESSTR(STR_ABOVE));
+ aPosBox.InsertEntry(SW_RESSTR(STR_CP_BELOW));
+ break;
+ case nsSelectionType::SEL_FRM:
+ case nsSelectionType::SEL_TXT:
+ aPosBox.InsertEntry(SW_RESSTR(STR_BEGINNING));
+ aPosBox.InsertEntry(SW_RESSTR(STR_END ));
+ break;
+ }
+ aPosBox.SelectEntryPos(1);
+ if (eType & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_DRW))
+ {
+ aPosText.Enable( sal_False );
+ aPosBox.Enable( sal_False );
+ }
+
+ aCategoryBox.GetModifyHdl().Call(&aCategoryBox);
+
+ FreeResource();
+
+ CheckButtonWidth();
+ aTextEdit.GrabFocus();
+ DrawSample();
+}
+
+void SwCaptionDialog::Apply()
+{
+ InsCaptionOpt aOpt;
+ aOpt.UseCaption() = sal_True;
+ String aName( aCategoryBox.GetText() );
+ if ( aName == sNone )
+ aOpt.SetCategory( aEmptyStr );
+ else
+ {
+ aName.EraseLeadingChars( ' ' );
+ aName.EraseTrailingChars( ' ' );
+ aOpt.SetCategory( aName );
+ }
+ aOpt.SetNumType( (sal_uInt16)(sal_uIntPtr)aFormatBox.GetEntryData( aFormatBox.GetSelectEntryPos() ) );
+ aOpt.SetSeparator( aSepEdit.IsEnabled() ? aSepEdit.GetText() : String() );
+ aOpt.SetNumSeparator( aNumberingSeparatorED.GetText() );
+ aOpt.SetCaption( aTextEdit.GetText() );
+ aOpt.SetPos( aPosBox.GetSelectEntryPos() );
+ aOpt.IgnoreSeqOpts() = sal_True;
+ aOpt.CopyAttributes() = bCopyAttributes;
+ aOpt.SetCharacterStyle( sCharacterStyle );
+ rView.InsertCaption( &aOpt );
+}
+
+IMPL_LINK_INLINE_START( SwCaptionDialog, OptionHdl, Button*, pButton )
+{
+ String sFldTypeName = aCategoryBox.GetText();
+ if(sFldTypeName == sNone)
+ sFldTypeName = aEmptyStr;
+ SwSequenceOptionDialog aDlg( pButton, rView, sFldTypeName );
+ aDlg.SetApplyBorderAndShadow(bCopyAttributes);
+ aDlg.SetCharacterStyle( sCharacterStyle );
+ aDlg.SetOrderNumberingFirst( bOrderNumberingFirst );
+ aDlg.Execute();
+ bCopyAttributes = aDlg.IsApplyBorderAndShadow();
+ sCharacterStyle = aDlg.GetCharacterStyle();
+ //#i61007# order of captions
+ if( bOrderNumberingFirst != aDlg.IsOrderNumberingFirst() )
+ {
+ bOrderNumberingFirst = aDlg.IsOrderNumberingFirst();
+ SW_MOD()->GetModuleConfig()->SetCaptionOrderNumberingFirst(bOrderNumberingFirst);
+ ApplyCaptionOrder();
+ }
+ DrawSample();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwCaptionDialog, OptionHdl, Button*, EMPTYARG )
+
+IMPL_LINK_INLINE_START( SwCaptionDialog, SelectHdl, ListBox *, EMPTYARG )
+{
+ DrawSample();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwCaptionDialog, SelectHdl, ListBox *, EMPTYARG )
+
+
+
+IMPL_LINK( SwCaptionDialog, ModifyHdl, Edit *, EMPTYARG )
+{
+ SwWrtShell &rSh = rView.GetWrtShell();
+ String sFldTypeName = aCategoryBox.GetText();
+ sal_Bool bCorrectFldName = sFldTypeName.Len() > 0;
+ sal_Bool bNone = sFldTypeName == sNone;
+ SwFieldType* pType = (bCorrectFldName && !bNone)
+ ? rSh.GetFldType( RES_SETEXPFLD, sFldTypeName )
+ : 0;
+ aOKButton.Enable( bCorrectFldName &&
+ (!pType ||
+ ((SwSetExpFieldType*)pType)->GetType() == nsSwGetSetExpType::GSE_SEQ)
+ && 0 != sFldTypeName.Len() );
+ aOptionButton.Enable( aOKButton.IsEnabled() && !bNone );
+ aFormatText.Enable( !bNone );
+ aFormatBox.Enable( !bNone );
+ aSepText.Enable( !bNone );
+ aSepEdit.Enable( !bNone );
+ DrawSample();
+ return 0;
+}
+
+IMPL_LINK(SwCaptionDialog, CaptionHdl, PushButton*, EMPTYARG)
+{
+ SfxItemSet aSet( rView.GetDocShell()->GetDoc()->GetAttrPool() );
+ SwCaptionOptDlg aDlg( this, aSet );
+ aDlg.Execute();
+
+ return 0;
+}
+
+void SwCaptionDialog::DrawSample()
+{
+ String aStr;
+ String sCaption = aTextEdit.GetText();
+
+ // Nummer
+ String sFldTypeName = aCategoryBox.GetText();
+ sal_Bool bNone = sFldTypeName == sNone;
+ if( !bNone )
+ {
+ sal_uInt16 nNumFmt = (sal_uInt16)(sal_uIntPtr)aFormatBox.GetEntryData(
+ aFormatBox.GetSelectEntryPos() );
+ if( SVX_NUM_NUMBER_NONE != nNumFmt )
+ {
+ // Kategorie
+ //#i61007# order of captions
+ if( !bOrderNumberingFirst )
+ {
+ aStr += sFldTypeName;
+ if ( aStr.Len() > 0 )
+ aStr += ' ';
+ }
+
+ SwWrtShell &rSh = rView.GetWrtShell();
+ SwSetExpFieldType* pFldType = (SwSetExpFieldType*)rSh.GetFldType(
+ RES_SETEXPFLD, sFldTypeName );
+ if( pFldType && pFldType->GetOutlineLvl() < MAXLEVEL )
+ {
+ sal_Int8 nLvl = pFldType->GetOutlineLvl();
+ SwNumberTree::tNumberVector aNumVector;
+ for( sal_Int8 i = 0; i <= nLvl; ++i )
+ aNumVector.push_back(1);
+
+ String sNumber( rSh.GetOutlineNumRule()->
+ MakeNumString(aNumVector, sal_False ));
+ if( sNumber.Len() )
+ (aStr += sNumber) += pFldType->GetDelimiter();
+ }
+
+ switch( nNumFmt )
+ {
+ case SVX_NUM_CHARS_UPPER_LETTER: aStr += 'A'; break;
+ case SVX_NUM_CHARS_UPPER_LETTER_N: aStr += 'A'; break;
+ case SVX_NUM_CHARS_LOWER_LETTER: aStr += 'a'; break;
+ case SVX_NUM_CHARS_LOWER_LETTER_N: aStr += 'a'; break;
+ case SVX_NUM_ROMAN_UPPER: aStr += 'I'; break;
+ case SVX_NUM_ROMAN_LOWER: aStr += 'i'; break;
+ //case ARABIC:
+ default: aStr += '1'; break;
+ }
+ //#i61007# order of captions
+ if( bOrderNumberingFirst )
+ {
+ aStr += aNumberingSeparatorED.GetText();
+ aStr += sFldTypeName;
+ }
+
+ }
+ if( sCaption.Len() > 0 )
+ {
+ aStr += aSepEdit.GetText();
+ }
+ }
+ aStr += sCaption;
+ // do preview!
+ aPrevWin.SetPreviewText( aStr );
+}
+
+void SwCaptionDialog::CheckButtonWidth()
+{
+ // check if the text of the AutoCaption button is to wide
+ const long nOffset = 10;
+ String sText = aAutoCaptionButton.GetText();
+ long nTxtW = aAutoCaptionButton.GetTextWidth( sText );
+ if ( sText.Search( '~' ) == STRING_NOTFOUND )
+ nTxtW += nOffset;
+ long nBtnW = aAutoCaptionButton.GetSizePixel().Width();
+ if ( nTxtW > nBtnW )
+ {
+ // then broaden all buttons
+ Size aNewSize;
+ long nDelta = Max( ( nTxtW - nBtnW ), nOffset );
+ Button* pBtns[] =
+ {
+ &aOKButton, &aCancelButton, &aHelpButton, &aAutoCaptionButton, &aOptionButton
+ };
+ Button** pCurrent = pBtns;
+ for ( sal_uInt32 i = 0; i < sizeof( pBtns ) / sizeof( pBtns[ 0 ] ); ++i, ++pCurrent )
+ {
+ aNewSize = (*pCurrent)->GetSizePixel();
+ aNewSize.Width() += nDelta;
+ (*pCurrent)->SetSizePixel( aNewSize );
+ }
+ // and the dialog
+ aNewSize = GetOutputSizePixel();
+ aNewSize.Width() += nDelta;
+ SetOutputSizePixel( aNewSize );
+ }
+}
+
+SwCaptionDialog::~SwCaptionDialog()
+{
+ delete pMgr;
+}
+/* */
+
+
+SwSequenceOptionDialog::SwSequenceOptionDialog( Window *pParent, SwView &rV,
+ const String& rSeqFldType )
+ : SvxStandardDialog( pParent, SW_RES(DLG_SEQUENCE_OPTION) ),
+ aFlHeader (this, SW_RES(FL_HEADER )),
+ aFtLevel (this, SW_RES(FT_LEVEL )),
+ aLbLevel (this, SW_RES(LB_LEVEL )),
+ aFtDelim (this, SW_RES(FT_SEPARATOR )),
+ aEdDelim (this, SW_RES(ED_SEPARATOR )),
+ aFlCatAndFrame (this, SW_RES(FL_CATANDFRAME)),
+ aFtCharStyle (this, SW_RES(FT_CHARSTYLE )),
+ aLbCharStyle (this, SW_RES(LB_CHARSTYLE )),
+ aApplyBorderAndShadowCB(this, SW_RES(CB_APPLYBAS)),
+ aFlCaptionOrder(this, SW_RES( FL_ORDER )), //#i61007# order of captions
+ aFtCaptionOrder(this, SW_RES( FT_ORDER )),
+ aLbCaptionOrder(this, SW_RES( LB_ORDER )),
+ aOKButton (this, SW_RES(BTN_OK )),
+ aCancelButton (this, SW_RES(BTN_CANCEL )),
+ aHelpButton (this, SW_RES(BTN_HELP )),
+
+ rView( rV ),
+ aFldTypeName( rSeqFldType )
+{
+ FreeResource();
+ SwWrtShell &rSh = rView.GetWrtShell();
+
+ for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
+ aLbLevel.InsertEntry( String::CreateFromInt32(n+1) );
+
+ SwSetExpFieldType* pFldType = (SwSetExpFieldType*)rSh.GetFldType(
+ RES_SETEXPFLD, aFldTypeName );
+
+ sal_Unicode nLvl = MAXLEVEL;
+ String sDelim( String::CreateFromAscii( ": " ) );
+ if( pFldType )
+ {
+ sDelim = pFldType->GetDelimiter();
+ nLvl = pFldType->GetOutlineLvl();
+ }
+
+ aLbLevel.SelectEntryPos( nLvl < MAXLEVEL ? nLvl + 1 : 0 );
+ aEdDelim.SetText( sDelim );
+
+ ::FillCharStyleListBox( aLbCharStyle, rView.GetDocShell(), TRUE, TRUE );
+ aLbCharStyle.SelectEntryPos( 0 );
+}
+
+SwSequenceOptionDialog::~SwSequenceOptionDialog()
+{
+}
+
+void SwSequenceOptionDialog::Apply()
+{
+ SwWrtShell &rSh = rView.GetWrtShell();
+ SwSetExpFieldType* pFldType = (SwSetExpFieldType*)rSh.GetFldType(
+ RES_SETEXPFLD, aFldTypeName );
+
+ sal_Int8 nLvl = (sal_Int8)( aLbLevel.GetSelectEntryPos() - 1);
+ sal_Unicode cDelim = aEdDelim.GetText().GetChar(0);
+
+ sal_Bool bUpdate = sal_True;
+ if( pFldType )
+ {
+ pFldType->SetDelimiter( cDelim );
+ pFldType->SetOutlineLvl( nLvl );
+ }
+ else if( aFldTypeName.Len() && nLvl < MAXLEVEL )
+ {
+ // dann muessen wir das mal einfuegen
+ SwSetExpFieldType aFldType( rSh.GetDoc(), aFldTypeName, nsSwGetSetExpType::GSE_SEQ );
+ aFldType.SetDelimiter( cDelim );
+ aFldType.SetOutlineLvl( nLvl );
+ rSh.InsertFldType( aFldType );
+ }
+ else
+ bUpdate = sal_False;
+
+ if( bUpdate )
+ rSh.UpdateExpFlds();
+}
+
+/*-- 24.08.2004 16:13:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+String SwSequenceOptionDialog::GetCharacterStyle() const
+{
+ String sRet;
+ if(aLbCharStyle.GetSelectEntryPos())
+ sRet = aLbCharStyle.GetSelectEntry();
+ return sRet;
+}
+
+/*-- 24.08.2004 16:14:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSequenceOptionDialog::SetCharacterStyle(const String& rStyle)
+{
+ aLbCharStyle.SelectEntryPos(0);
+ aLbCharStyle.SelectEntry(rStyle);
+}
+
+long SwCaptionDialog::CategoryBox::PreNotify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+ if( rNEvt.GetType() == EVENT_KEYINPUT &&
+ rNEvt.GetKeyEvent()->GetCharCode() )
+ {
+ const KeyEvent* pEvent = rNEvt.GetKeyEvent();
+ const KeyCode& rKeyCode = pEvent->GetKeyCode();
+ USHORT nTmpCode = rKeyCode.GetFullCode() & ~KEY_ALLMODTYPE;
+
+ if(nTmpCode != KEY_BACKSPACE && nTmpCode != KEY_RETURN
+ && nTmpCode != KEY_TAB && nTmpCode != KEY_ESCAPE)
+ {
+ String sKey( pEvent->GetCharCode() ), sName( GetText() );
+ Selection aSel( GetSelection() );
+ aSel.Justify();
+ if( aSel.Len() )
+ sName.Erase( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() );
+ sName.Insert( sKey, (xub_StrLen)aSel.Min() );
+ if( !SwCalc::IsValidVarName( sName ))
+ nHandled = 1;
+ }
+ }
+ if(!nHandled)
+ nHandled = ComboBox::PreNotify( rNEvt );
+ return nHandled;
+}
+/*-- 01.11.2007 10:45:51---------------------------------------------------
+ //#i61007# order of captions
+ -----------------------------------------------------------------------*/
+void lcl_MoveH( Window& rWin, sal_Int32 nMove )
+{
+ Point aPos( rWin.GetPosPixel() );
+ aPos.Y() += nMove;
+ rWin.SetPosPixel(aPos);
+}
+void SwCaptionDialog::ApplyCaptionOrder()
+{
+ //have the settings changed?
+ bool bVisible = aNumberingSeparatorED.IsVisible() != 0;
+ if( bOrderNumberingFirst != bVisible )
+ {
+ sal_Int32 nDiff = aPosBox.GetPosPixel().Y() - aSepEdit.GetPosPixel().Y();
+
+ aNumberingSeparatorFT.Show( bOrderNumberingFirst );
+ aNumberingSeparatorED.Show( bOrderNumberingFirst );
+ if( !bOrderNumberingFirst )
+ {
+ nDiff = -nDiff;
+ }
+ lcl_MoveH( aCategoryText, 2 * nDiff);
+ lcl_MoveH( aFormatText, -nDiff );
+ lcl_MoveH( aFormatBox, -nDiff );
+ lcl_MoveH( aCategoryBox, 2 * nDiff);
+ lcl_MoveH( aSepText, nDiff );
+ lcl_MoveH( aSepEdit, nDiff );
+ lcl_MoveH( aPosText, nDiff );
+ lcl_MoveH( aPosBox, nDiff );
+ lcl_MoveH( aPrevWin, nDiff );
+ Size aDlgSize( GetSizePixel() );
+ aDlgSize.Height() += nDiff;
+ SetSizePixel( aDlgSize );
+ }
+}
diff --git a/sw/source/ui/frmdlg/cption.hrc b/sw/source/ui/frmdlg/cption.hrc
new file mode 100644
index 000000000000..1487171f0c01
--- /dev/null
+++ b/sw/source/ui/frmdlg/cption.hrc
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CPTION_HRC
+#define _CPTION_HRC
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define TXT_SAMPLE 3
+#define TXT_CATEGORY 4
+#define BOX_CATEGORY 5
+#define TXT_FORMAT 6
+#define BOX_FORMAT 7
+#define TXT_TEXT 8
+#define EDT_TEXT 9
+#define TXT_POS 10
+#define BOX_POS 11
+#define FL_SETTINGS 12
+#define BTN_HELP 13
+#define BTN_OPTION 14
+#define FL_HEADER 15
+#define FT_LEVEL 16
+#define LB_LEVEL 17
+#define FT_SEPARATOR 18
+#define ED_SEPARATOR 19
+#define CB_COPY_ATTR 20
+#define FT_OBJECT_NAME 21
+#define ED_OBJECT_NAME 22
+#define BTN_AUTOCAPTION 23
+#define TXT_SEP 24
+#define EDT_SEP 25
+#define WIN_SAMPLE 26
+
+#define FL_CATANDFRAME 27
+#define FT_CHARSTYLE 28
+#define LB_CHARSTYLE 29
+#define CB_APPLYBAS 30
+#define FL_ORDER 31
+#define FT_ORDER 32
+#define LB_ORDER 33
+
+#define FT_NUM_SEP 34
+#define ED_NUM_SEP 35
+
+#define STR_BEGINNING 1
+#define STR_END 2
+#define STR_ABOVE 3
+#define STR_CP_BELOW 4
+#define STR_CATEGORY_NONE 5
+
+#endif
+
+// ********************************************************************** EOF
+
diff --git a/sw/source/ui/frmdlg/cption.src b/sw/source/ui/frmdlg/cption.src
new file mode 100644
index 000000000000..c93efab586f1
--- /dev/null
+++ b/sw/source/ui/frmdlg/cption.src
@@ -0,0 +1,342 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+ // #include *****************************************************************
+#include "helpid.h"
+#include "frmui.hrc"
+#include "cption.hrc"
+#include "cmdid.h"
+ // #pragma ******************************************************************
+
+ // ModalDialog **************************************************************
+ModalDialog DLG_CAPTION
+{
+ HelpID = HID_DLG_CAPTION ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 250 , 143 ) ;
+ Text [ en-US ] = "Caption" ;
+ Moveable = TRUE ;
+ OKButton BTN_OK
+ {
+ DefButton = TRUE ;
+ Pos = MAP_APPFONT ( 194 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 194 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 194 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_AUTOCAPTION
+ {
+ HelpID = "sw:PushButton:DLG_CAPTION:BTN_AUTOCAPTION";
+ Pos = MAP_APPFONT ( 194 , 63 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "AutoCaption..." ;
+ };
+ PushButton BTN_OPTION
+ {
+ HelpID = "sw:PushButton:DLG_CAPTION:BTN_OPTION";
+ Pos = MAP_APPFONT ( 194 , 80 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Options..." ;
+ };
+
+ FixedText TXT_TEXT
+ {
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 182 , 8 ) ;
+ Text [ en-US ] = "Caption" ;
+ Left = TRUE ;
+ };
+ Edit EDT_TEXT
+ {
+ HelpID = "sw:Edit:DLG_CAPTION:EDT_TEXT";
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 182 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedLine FL_SETTINGS
+ {
+ Pos = MAP_APPFONT ( 6 , 35 ) ;
+ Size = MAP_APPFONT ( 182 , 8 ) ;
+ Text [ en-US ] = "Properties";
+ };
+ FixedText TXT_CATEGORY
+ {
+ Pos = MAP_APPFONT ( 12 , 49 ) ;
+ Size = MAP_APPFONT ( 67 , 8 ) ;
+ Text [ en-US ] = "Category" ;
+ Left = TRUE ;
+ };
+ ComboBox BOX_CATEGORY
+ {
+ HelpID = "sw:ComboBox:DLG_CAPTION:BOX_CATEGORY";
+ Pos = MAP_APPFONT ( 82 , 46 ) ;
+ Size = MAP_APPFONT ( 106 , 61 ) ;
+ DropDown = TRUE ;
+ TabStop = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText TXT_FORMAT
+ {
+ Pos = MAP_APPFONT ( 12 , 66 ) ;
+ Size = MAP_APPFONT ( 67 , 8 ) ;
+ Text [ en-US ] = "Numbering" ;
+ Left = TRUE ;
+ };
+ ListBox BOX_FORMAT
+ {
+ HelpID = "sw:ListBox:DLG_CAPTION:BOX_FORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 82 , 63 ) ;
+ Size = MAP_APPFONT ( 106 , 83 ) ;
+ DropDown = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_NUM_SEP
+ {
+ Pos = MAP_APPFONT ( 12 , 66 ) ;
+ Size = MAP_APPFONT ( 67 , 8 ) ;
+ Text [ en-US ] = "Numbering separator" ;
+ Left = TRUE ;
+ Hide = TRUE;
+ };
+ Edit ED_NUM_SEP
+ {
+ HelpID = "sw:Edit:DLG_CAPTION:ED_NUM_SEP";
+ Pos = MAP_APPFONT ( 82 , 63 ) ;
+ Size = MAP_APPFONT ( 106 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Text = ". " ;
+ Hide = TRUE;
+ };
+ FixedText TXT_SEP
+ {
+ Pos = MAP_APPFONT ( 12 , 82 ) ;
+ Size = MAP_APPFONT ( 67 , 8 ) ;
+ Text [ en-US ] = "Separator" ;
+ Left = TRUE ;
+ };
+ Edit EDT_SEP
+ {
+ HelpID = "sw:Edit:DLG_CAPTION:EDT_SEP";
+ Pos = MAP_APPFONT ( 82 , 80 ) ;
+ Size = MAP_APPFONT ( 106 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Text [ en-US ] = ": " ;
+ };
+ FixedText TXT_POS
+ {
+ Pos = MAP_APPFONT ( 12 , 100 ) ;
+ Size = MAP_APPFONT ( 67 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Position" ;
+ };
+ ListBox BOX_POS
+ {
+ HelpID = "sw:ListBox:DLG_CAPTION:BOX_POS";
+ Pos = MAP_APPFONT ( 82 , 97 ) ;
+ Size = MAP_APPFONT ( 106 , 61 ) ;
+ DropDown = TRUE ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+ Window WIN_SAMPLE
+ {
+ Pos = MAP_APPFONT ( 6 , 117 ) ;
+ Size = MAP_APPFONT ( 182 , 20 ) ;
+ Border = TRUE ;
+ };
+
+ String STR_BEGINNING
+ {
+ Text [ en-US ] = "Above" ;
+ };
+ String STR_END
+ {
+ Text [ en-US ] = "Below" ;
+ };
+ String STR_ABOVE
+ {
+ Text [ en-US ] = "Above" ;
+ };
+ String STR_CP_BELOW
+ {
+ Text [ en-US ] = "Below" ;
+ };
+ String STR_CATEGORY_NONE
+ {
+ Text [ en-US ] = "<None>" ;
+ };
+};
+
+ModalDialog DLG_SEQUENCE_OPTION
+{
+ HelpID = HID_DLG_SEQUENCE_OPTION ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 200 , 132 ) ;
+ Moveable = TRUE ;
+ Text [ en-US ] = "Options" ;
+ OKButton BTN_OK
+ {
+ DefButton = TRUE ;
+ Pos = MAP_APPFONT ( 145 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 145 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 145 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_HEADER
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Text [ en-US ] = "Numbering captions by chapter" ;
+ };
+ FixedText FT_LEVEL
+ {
+ Pos = MAP_APPFONT ( 12 , 21 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Level" ;
+ };
+ ListBox LB_LEVEL
+ {
+ HelpID = "sw:ListBox:DLG_SEQUENCE_OPTION:LB_LEVEL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 65 , 18 ) ;
+ Size = MAP_APPFONT ( 72 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "<None>" ; > ;
+ };
+ };
+ FixedText FT_SEPARATOR
+ {
+ Pos = MAP_APPFONT ( 12 , 33 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "~Separator" ;
+ };
+ Edit ED_SEPARATOR
+ {
+ HelpID = "sw:Edit:DLG_SEQUENCE_OPTION:ED_SEPARATOR";
+ Pos = MAP_APPFONT ( 65 , 34 ) ;
+ Size = MAP_APPFONT ( 72 , 12 ) ;
+ Border = TRUE ;
+ MaxTextLength = 1 ;
+ TEXT = "." ;
+ };
+ FixedLine FL_CATANDFRAME
+ {
+ Pos = MAP_APPFONT ( 6 , 53 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Text [ en-US ] = "Category and frame format" ;
+ };
+ FixedText FT_CHARSTYLE
+ {
+ Pos = MAP_APPFONT ( 12 , 71 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Character style" ;
+ };
+ ListBox LB_CHARSTYLE
+ {
+ HelpID = "sw:ListBox:DLG_SEQUENCE_OPTION:LB_CHARSTYLE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 65 , 68 ) ;
+ Size = MAP_APPFONT ( 72 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "<None>" ; > ;
+ };
+ };
+ CheckBox CB_APPLYBAS
+ {
+ HelpID = "sw:CheckBox:DLG_SEQUENCE_OPTION:CB_APPLYBAS";
+ Pos = MAP_APPFONT ( 12 , 84 ) ;
+ Size = MAP_APPFONT ( 136 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Apply border and shadow";
+ };
+ FixedLine FL_ORDER
+ {
+ Pos = MAP_APPFONT ( 6 , 97 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Text [ en-US ] = "Caption" ;
+ };
+ FixedText FT_ORDER
+ {
+ Pos = MAP_APPFONT ( 12 , 115 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Text [ en-US ] = "Caption order" ;
+ };
+ ListBox LB_ORDER
+ {
+ HelpID = "sw:ListBox:DLG_SEQUENCE_OPTION:LB_ORDER";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 65 , 114 ) ;
+ Size = MAP_APPFONT ( 72 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Category first" ; > ;
+ < "Numbering first" ; > ;
+ };
+ };
+};
+ // ********************************************************************** EOF
+
diff --git a/sw/source/ui/frmdlg/frmdlg.cxx b/sw/source/ui/frmdlg/frmdlg.cxx
new file mode 100644
index 000000000000..54078db0f9a7
--- /dev/null
+++ b/sw/source/ui/frmdlg/frmdlg.cxx
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include <svx/dialogs.hrc>
+#include <hintids.hxx>
+#include <tools/list.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/htmlmode.hxx>
+#include <fmtfsize.hxx>
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <docsh.hxx>
+#include <viewopt.hxx>
+#include <frmdlg.hxx>
+#include <frmpage.hxx>
+#include <wrap.hxx>
+#include <column.hxx>
+#include <macassgn.hxx>
+
+#ifndef _FRMUI_HRC
+#include <frmui.hrc>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <svx/svxids.hrc>
+#include <svx/flagsdef.hxx>
+#include <svx/svxdlg.hxx>
+
+/*--------------------------------------------------------------------
+ Beschreibung: Der Traeger des Dialoges
+ --------------------------------------------------------------------*/
+
+SwFrmDlg::SwFrmDlg( SfxViewFrame* pViewFrame,
+ Window* pParent,
+ const SfxItemSet& rCoreSet,
+ BOOL bNewFrm,
+ USHORT nResType,
+ BOOL bFormat,
+ UINT16 nDefPage,
+ const String* pStr) :
+
+ SfxTabDialog(pViewFrame, pParent, SW_RES(nResType), &rCoreSet, pStr != 0),
+ m_bFormat(bFormat),
+ m_bNew(bNewFrm),
+ m_rSet(rCoreSet),
+ m_nDlgType(nResType),
+ m_pWrtShell(((SwView*)pViewFrame->GetViewShell())->GetWrtShellPtr())
+{
+ FreeResource();
+ USHORT nHtmlMode = ::GetHtmlMode(m_pWrtShell->GetView().GetDocShell());
+ m_bHTMLMode = static_cast< BOOL >(nHtmlMode & HTMLMODE_ON);
+
+ // BspFont fuer beide Bsp-TabPages
+ //
+ if(pStr)
+ {
+ String aTmp( GetText() );
+ aTmp += SW_RESSTR(STR_COLL_HEADER);
+ aTmp += *pStr;
+ aTmp += ')';
+ }
+
+ AddTabPage(TP_FRM_STD, SwFrmPage::Create, 0);
+ AddTabPage(TP_FRM_ADD, SwFrmAddPage::Create, 0);
+ AddTabPage(TP_FRM_WRAP, SwWrapTabPage::Create, 0);
+ AddTabPage(TP_FRM_URL, SwFrmURLPage::Create, 0);
+ if(m_nDlgType == DLG_FRM_GRF)
+ {
+ AddTabPage( TP_GRF_EXT, SwGrfExtPage::Create, 0 );
+ AddTabPage( RID_SVXPAGE_GRFCROP );
+ }
+ if (m_nDlgType == DLG_FRM_STD)
+ {
+ AddTabPage(TP_COLUMN, SwColumnPage::Create, 0);
+ }
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
+ AddTabPage( TP_MACRO_ASSIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0);
+ AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 );
+
+ if(m_bHTMLMode)
+ {
+ switch( m_nDlgType )
+ {
+ case DLG_FRM_STD:
+ if(0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS))
+ RemoveTabPage(TP_BORDER);
+ RemoveTabPage(TP_COLUMN);
+ // kein break
+ case DLG_FRM_OLE:
+ RemoveTabPage(TP_FRM_URL);
+ RemoveTabPage(TP_MACRO_ASSIGN);
+ break;
+ case DLG_FRM_GRF:
+ RemoveTabPage(RID_SVXPAGE_GRFCROP);
+ break;
+ }
+ if( 0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS) ||
+ m_nDlgType != DLG_FRM_STD )
+ RemoveTabPage(TP_BACKGROUND);
+ }
+
+ if (m_bNew)
+ SetCurPageId(TP_FRM_STD);
+
+ if (nDefPage)
+ SetCurPageId(nDefPage);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwFrmDlg::~SwFrmDlg()
+{
+}
+
+
+
+
+void SwFrmDlg::PageCreated( USHORT nId, SfxTabPage &rPage )
+{
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ switch ( nId )
+ {
+ case TP_FRM_STD:
+ ((SwFrmPage&)rPage).SetNewFrame(m_bNew);
+ ((SwFrmPage&)rPage).SetFormatUsed(m_bFormat);
+ ((SwFrmPage&)rPage).SetFrmType(m_nDlgType);
+ break;
+
+ case TP_FRM_ADD:
+ ((SwFrmAddPage&)rPage).SetFormatUsed(m_bFormat);
+ ((SwFrmAddPage&)rPage).SetFrmType(m_nDlgType);
+ ((SwFrmAddPage&)rPage).SetNewFrame(m_bNew);
+ ((SwFrmAddPage&)rPage).SetShell(m_pWrtShell);
+ break;
+
+ case TP_FRM_WRAP:
+ ((SwWrapTabPage&)rPage).SetNewFrame(m_bNew);
+ ((SwWrapTabPage&)rPage).SetFormatUsed(m_bFormat, FALSE);
+ ((SwWrapTabPage&)rPage).SetShell(m_pWrtShell);
+ break;
+
+ case TP_COLUMN:
+ {
+ ((SwColumnPage&)rPage).SetFrmMode(TRUE);
+ ((SwColumnPage&)rPage).SetFormatUsed(m_bFormat);
+
+ const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)
+ m_rSet.Get( RES_FRM_SIZE );
+ ((SwColumnPage&)rPage).SetPageWidth( rSize.GetWidth() );
+ }
+ break;
+
+ case TP_MACRO_ASSIGN:
+ {
+ SfxAllItemSet aNewSet(*aSet.GetPool());
+ aNewSet.Put( SwMacroAssignDlg::AddEvents(
+ DLG_FRM_GRF == m_nDlgType ? MACASSGN_GRAPHIC : DLG_FRM_OLE == m_nDlgType ? MACASSGN_OLE : MACASSGN_FRMURL ) );
+ if ( m_pWrtShell )
+ rPage.SetFrame( m_pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() );
+ rPage.PageCreated(aNewSet);
+ break;
+ }
+
+ case TP_BACKGROUND:
+ if( DLG_FRM_STD == m_nDlgType )
+ {
+ sal_Int32 nFlagType = SVX_SHOW_SELECTOR;
+ if(!m_bHTMLMode)
+ nFlagType |= SVX_ENABLE_TRANSPARENCY;
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
+ rPage.PageCreated(aSet);
+ }
+ break;
+
+ case TP_BORDER:
+ {
+ aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_FRAME));
+ rPage.PageCreated(aSet);
+ }
+ break;
+ }
+}
+
diff --git a/sw/source/ui/frmdlg/frmmgr.cxx b/sw/source/ui/frmdlg/frmmgr.cxx
new file mode 100644
index 000000000000..302baebd0362
--- /dev/null
+++ b/sw/source/ui/frmdlg/frmmgr.cxx
@@ -0,0 +1,623 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include "cmdid.h"
+#include "hintids.hxx"
+
+#include <svl/stritem.hxx>
+#include <editeng/protitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/opaqitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/shaditem.hxx>
+#include <svx/swframevalidation.hxx>
+#include <fmtclds.hxx>
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "viewopt.hxx"
+#include "uitool.hxx"
+#include "frmmgr.hxx"
+#include "format.hxx"
+#include "mdiexp.hxx"
+#include "poolfmt.hxx"
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/RelOrientation.hpp>
+
+using namespace ::com::sun::star;
+//using namespace text;
+
+static USHORT __FAR_DATA aFrmMgrRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ FN_SET_FRM_NAME, FN_SET_FRM_NAME,
+ 0};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Rahmen-Attribute ueber Shell ermitteln
+ --------------------------------------------------------------------*/
+
+SwFlyFrmAttrMgr::SwFlyFrmAttrMgr( BOOL bNew, SwWrtShell* pSh, BYTE nType ) :
+ aSet( (SwAttrPool&)pSh->GetAttrPool(), aFrmMgrRange ),
+ pOwnSh( pSh ),
+ bAbsPos( FALSE ),
+ bNewFrm( bNew ),
+ bIsInVertical( FALSE )
+{
+ if ( bNewFrm )
+ {
+ // Defaults einstellen:
+ USHORT nId = 0;
+ switch ( nType )
+ {
+ case FRMMGR_TYPE_TEXT: nId = RES_POOLFRM_FRAME; break;
+ case FRMMGR_TYPE_OLE: nId = RES_POOLFRM_OLE; break;
+ case FRMMGR_TYPE_GRF: nId = RES_POOLFRM_GRAPHIC; break;
+ }
+ aSet.SetParent( &pOwnSh->GetFmtFromPool( nId )->GetAttrSet());
+ aSet.Put( SwFmtFrmSize( ATT_MIN_SIZE, DFLT_WIDTH, DFLT_HEIGHT ));
+ if ( 0 != ::GetHtmlMode(pSh->GetView().GetDocShell()) )
+ aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::PRINT_AREA ) );
+ }
+ else if ( nType == FRMMGR_TYPE_NONE )
+ {
+ pOwnSh->GetFlyFrmAttr( aSet );
+ BOOL bRightToLeft;
+ bIsInVertical = pOwnSh->IsFrmVertical(TRUE, bRightToLeft);
+ }
+ ::PrepareBoxInfo( aSet, *pOwnSh );
+}
+
+SwFlyFrmAttrMgr::SwFlyFrmAttrMgr( BOOL bNew, SwWrtShell* pSh, const SfxItemSet &rSet ) :
+ aSet( rSet ),
+ pOwnSh( pSh ),
+ bAbsPos( FALSE ),
+ bNewFrm( bNew ),
+ bIsInVertical(FALSE)
+{
+ if(!bNew)
+ {
+ BOOL bRightToLeft;
+ bIsInVertical = pSh->IsFrmVertical(TRUE, bRightToLeft);
+ }
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Initialisieren
+ --------------------------------------------------------------------*/
+
+void SwFlyFrmAttrMgr::UpdateAttrMgr()
+{
+ if ( !bNewFrm && pOwnSh->IsFrmSelected() )
+ pOwnSh->GetFlyFrmAttr( aSet );
+ ::PrepareBoxInfo( aSet, *pOwnSh );
+}
+
+void SwFlyFrmAttrMgr::_UpdateFlyFrm()
+{
+ const SfxPoolItem* pItem = 0;
+
+ if (aSet.GetItemState(FN_SET_FRM_NAME, FALSE, &pItem) == SFX_ITEM_SET)
+ pOwnSh->SetFlyName(((SfxStringItem *)pItem)->GetValue());
+
+ pOwnSh->SetModified();
+
+ if ( bAbsPos )
+ {
+ pOwnSh->SetFlyPos( aAbsPos );
+ bAbsPos = FALSE;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bestehenden Fly-Frame aendern
+ --------------------------------------------------------------------*/
+
+void SwFlyFrmAttrMgr::UpdateFlyFrm()
+{
+ ASSERT( pOwnSh->IsFrmSelected(),
+ "Kein Rahmen selektiert oder keine Shell, Update nicht moeglich");
+
+ if( pOwnSh->IsFrmSelected() )
+ {
+ //JP 6.8.2001: set never an invalid anchor into the core.
+ const SfxPoolItem *pGItem, *pItem;
+ if( SFX_ITEM_SET == aSet.GetItemState( RES_ANCHOR, FALSE, &pItem ))
+ {
+ SfxItemSet aGetSet( *aSet.GetPool(), RES_ANCHOR, RES_ANCHOR );
+ if( pOwnSh->GetFlyFrmAttr( aGetSet ) && 1 == aGetSet.Count() &&
+ SFX_ITEM_SET == aGetSet.GetItemState( RES_ANCHOR, FALSE, &pGItem )
+ && ((SwFmtAnchor*)pGItem)->GetAnchorId() ==
+ ((SwFmtAnchor*)pItem)->GetAnchorId() )
+ aSet.ClearItem( RES_ANCHOR );
+ }
+
+ // return wg. BASIC
+ if( aSet.Count() )
+ {
+ pOwnSh->StartAllAction();
+ pOwnSh->SetFlyFrmAttr( aSet );
+ _UpdateFlyFrm();
+ pOwnSh->EndAllAction();
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Rahmen einfuegen
+ --------------------------------------------------------------------*/
+
+BOOL SwFlyFrmAttrMgr::InsertFlyFrm()
+{
+ pOwnSh->StartAllAction();
+
+ BOOL bRet = 0 != pOwnSh->NewFlyFrm( aSet );
+
+ // richtigen Mode an der Shell einschalten, Rahmen wurde aut. selektiert.
+ if ( bRet )
+ {
+ _UpdateFlyFrm();
+ pOwnSh->EnterSelFrmMode();
+ FrameNotify(pOwnSh, FLY_DRAG_START);
+ }
+ pOwnSh->EndAllAction();
+ return bRet;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Rahmen des Typs eAnchorType einfuegen. Position und
+ Groesse werden explizit angegeben.
+ Nicht erlaubte Werte des Aufzaehlungstypes werden
+ korrigiert.
+------------------------------------------------------------------------*/
+
+void SwFlyFrmAttrMgr::InsertFlyFrm(RndStdIds eAnchorType,
+ const Point &rPos,
+ const Size &rSize,
+ BOOL bAbs )
+{
+ ASSERT( eAnchorType == FLY_AT_PAGE ||
+ eAnchorType == FLY_AT_PARA ||
+ eAnchorType == FLY_AT_CHAR ||
+ eAnchorType == FLY_AT_FLY ||
+ eAnchorType == FLY_AS_CHAR, "invalid frame type" );
+
+ if ( bAbs )
+ SetAbsPos( rPos );
+ else
+ SetPos( rPos );
+
+ SetSize( rSize );
+ SetAnchor( eAnchorType );
+ InsertFlyFrm();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Anker setzen
+ --------------------------------------------------------------------*/
+
+void SwFlyFrmAttrMgr::SetAnchor( RndStdIds eId )
+{
+ USHORT nPhyPageNum, nVirtPageNum;
+ pOwnSh->GetPageNum( nPhyPageNum, nVirtPageNum );
+
+ aSet.Put( SwFmtAnchor( eId, nPhyPageNum ) );
+ if ((FLY_AT_PAGE == eId) || (FLY_AT_PARA == eId) || (FLY_AT_CHAR == eId)
+ || (FLY_AT_FLY == eId))
+ {
+ SwFmtVertOrient aVertOrient( GetVertOrient() );
+ SwFmtHoriOrient aHoriOrient( GetHoriOrient() );
+ aHoriOrient.SetRelationOrient( text::RelOrientation::FRAME );
+ aVertOrient.SetRelationOrient( text::RelOrientation::FRAME );
+ aSet.Put( aVertOrient );
+ aSet.Put( aHoriOrient );
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Setzen des Attributs fuer Spalten
+------------------------------------------------------------------------*/
+
+void SwFlyFrmAttrMgr::SetCol( const SwFmtCol &rCol )
+{
+ aSet.Put( rCol );
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Absolute Position setzen
+ --------------------------------------------------------------------*/
+
+void SwFlyFrmAttrMgr::SetAbsPos( const Point& rPoint )
+{
+ bAbsPos = TRUE;
+ aAbsPos = rPoint;
+
+ SwFmtVertOrient aVertOrient( GetVertOrient() );
+ SwFmtHoriOrient aHoriOrient( GetHoriOrient() );
+ aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE );
+ aVertOrient.SetVertOrient( text::VertOrientation::NONE );
+ aSet.Put( aVertOrient );
+ aSet.Put( aHoriOrient );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Metriken auf Korrektheit pruefen
+ --------------------------------------------------------------------*/
+void SwFlyFrmAttrMgr::ValidateMetrics( SvxSwFrameValidation& rVal,
+ const SwPosition* pToCharCntntPos,
+ BOOL bOnlyPercentRefValue )
+{
+ if (!bOnlyPercentRefValue)
+ {
+ rVal.nMinHeight = MINFLY + CalcTopSpace() + CalcBottomSpace();
+ rVal.nMinWidth = MINFLY + CalcLeftSpace()+ CalcRightSpace();
+ }
+
+ SwRect aBoundRect;
+
+ // OD 18.09.2003 #i18732# - adjustment for allowing vertical position
+ // aligned to page for fly frame anchored to paragraph or to character.
+ const RndStdIds eAnchorType = static_cast<RndStdIds >(rVal.nAnchorType);
+ pOwnSh->CalcBoundRect( aBoundRect, eAnchorType,
+ rVal.nHRelOrient,
+ rVal.nVRelOrient,
+ pToCharCntntPos,
+ rVal.bFollowTextFlow,
+ rVal.bMirror, NULL, &rVal.aPercentSize);
+
+ if (bOnlyPercentRefValue)
+ return;
+
+ if(bIsInVertical)
+ {
+ Point aPos(aBoundRect.Pos());
+ long nTmp = aPos.X();
+ aPos.X() = aPos.Y();
+ aPos.Y() = nTmp;
+ Size aSize(aBoundRect.SSize());
+ nTmp = aSize.Width();
+ aSize.Width() = aSize.Height();
+ aSize.Height() = nTmp;
+ aBoundRect.Chg( aPos, aSize );
+ //exchange width/height to enable correct values
+ nTmp = rVal.nWidth;
+ rVal.nWidth = rVal.nHeight;
+ rVal.nHeight = nTmp;
+ }
+ if ((eAnchorType == FLY_AT_PAGE) || (eAnchorType == FLY_AT_FLY))
+ {
+ // MinimalPosition
+ rVal.nMinHPos = aBoundRect.Left();
+ rVal.nMinVPos = aBoundRect.Top();
+ SwTwips nH = rVal.nHPos;
+ SwTwips nV = rVal.nVPos;
+
+ if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
+ {
+ if (rVal.nHoriOrient == text::HoriOrientation::NONE)
+ {
+ rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right());
+ nH = rVal.nHPos;
+ }
+ else
+ rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
+ }
+
+ if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
+ rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
+
+ if (rVal.nVPos + rVal.nHeight > aBoundRect.Bottom())
+ {
+ if (rVal.nVertOrient == text::VertOrientation::NONE)
+ {
+ rVal.nVPos -= ((rVal.nVPos + rVal.nHeight) - aBoundRect.Bottom());
+ nV = rVal.nVPos;
+ }
+ else
+ rVal.nHeight = aBoundRect.Bottom() - rVal.nVPos;
+ }
+
+ if (rVal.nVPos + rVal.nHeight > aBoundRect.Bottom())
+ rVal.nHeight = aBoundRect.Bottom() - rVal.nVPos;
+
+ if ( rVal.nVertOrient != text::VertOrientation::NONE )
+ nV = aBoundRect.Top();
+
+ if ( rVal.nHoriOrient != text::HoriOrientation::NONE )
+ nH = aBoundRect.Left();
+
+ rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth;
+ rVal.nMaxHeight = aBoundRect.Bottom() - nV;
+
+ rVal.nMaxVPos = aBoundRect.Bottom() - rVal.nHeight;
+ rVal.nMaxWidth = aBoundRect.Right() - nH;
+ }
+ // OD 12.11.2003 #i22341# - handle to character anchored objects vertical
+ // aligned at character or top of line in a special case
+ else if ((eAnchorType == FLY_AT_PARA) ||
+ ((eAnchorType == FLY_AT_CHAR) &&
+ !(rVal.nVRelOrient == text::RelOrientation::CHAR) &&
+ !(rVal.nVRelOrient == text::RelOrientation::TEXT_LINE) ) )
+ {
+ if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
+ {
+ if (rVal.nHoriOrient == text::HoriOrientation::NONE)
+ {
+ rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right());
+ }
+ else
+ rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
+ }
+
+ // OD 29.09.2003 #i17567#, #i18732# - consider following the text flow
+ // and alignment at page areas.
+ const bool bMaxVPosAtBottom = !rVal.bFollowTextFlow ||
+ rVal.nVRelOrient == text::RelOrientation::PAGE_FRAME ||
+ rVal.nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA;
+ {
+ SwTwips nTmpMaxVPos = ( bMaxVPosAtBottom
+ ? aBoundRect.Bottom()
+ : aBoundRect.Height() ) -
+ rVal.nHeight;
+ if ( rVal.nVPos > nTmpMaxVPos )
+ {
+ if (rVal.nVertOrient == text::VertOrientation::NONE)
+ {
+ rVal.nVPos = nTmpMaxVPos;
+ }
+ else
+ {
+ rVal.nHeight = ( bMaxVPosAtBottom
+ ? aBoundRect.Bottom()
+ : aBoundRect.Height() ) - rVal.nVPos;
+ }
+ }
+ }
+
+ rVal.nMinHPos = aBoundRect.Left();
+ rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth;
+
+ rVal.nMinVPos = aBoundRect.Top();
+ // OD 26.09.2003 #i17567#, #i18732# - determine maximum vertical position
+ if ( bMaxVPosAtBottom )
+ {
+ rVal.nMaxVPos = aBoundRect.Bottom() - rVal.nHeight;
+ }
+ else
+ {
+ rVal.nMaxVPos = aBoundRect.Height() - rVal.nHeight;
+ }
+
+ // Maximale Breite Hoehe
+ const SwTwips nH = ( rVal.nHoriOrient != text::HoriOrientation::NONE )
+ ? aBoundRect.Left()
+ : rVal.nHPos;
+ const SwTwips nV = ( rVal.nVertOrient != text::VertOrientation::NONE )
+ ? aBoundRect.Top()
+ : rVal.nVPos;
+ rVal.nMaxHeight = rVal.nMaxVPos + rVal.nHeight - nV;
+ rVal.nMaxWidth = rVal.nMaxHPos + rVal.nWidth - nH;
+ }
+ // OD 12.11.2003 #i22341# - special case for to character anchored objects
+ // vertical aligned at character or top of line.
+ // Note: (1) positive vertical values are positions above the top of line
+ // (2) negative vertical values are positions below the top of line
+ else if ( (eAnchorType == FLY_AT_CHAR) &&
+ ( rVal.nVRelOrient == text::RelOrientation::CHAR ||
+ rVal.nVRelOrient == text::RelOrientation::TEXT_LINE ) )
+ {
+ // determine horizontal values
+ rVal.nMinHPos = aBoundRect.Left();
+
+ rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth;
+ if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
+ {
+ if (rVal.nHoriOrient == text::HoriOrientation::NONE)
+ {
+ rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right());
+ }
+ else
+ rVal.nWidth = aBoundRect.Right() - rVal.nHPos;
+ }
+
+ const SwTwips nH = ( rVal.nHoriOrient != text::HoriOrientation::NONE )
+ ? aBoundRect.Left()
+ : rVal.nHPos;
+ rVal.nMaxWidth = rVal.nMaxHPos + rVal.nWidth - nH;
+
+ // determine vertical values
+ rVal.nMinVPos = -( aBoundRect.Bottom() - rVal.nHeight );
+ if ( rVal.nVPos < rVal.nMinVPos &&
+ rVal.nVertOrient == text::VertOrientation::NONE )
+ {
+ rVal.nVPos = rVal.nMinVPos;
+ }
+
+ rVal.nMaxVPos = -aBoundRect.Top();
+ if ( rVal.nVPos > rVal.nMaxVPos &&
+ rVal.nVertOrient == text::VertOrientation::NONE )
+ {
+ rVal.nVPos = rVal.nMaxVPos;
+ }
+
+ if ( rVal.nVertOrient == text::VertOrientation::NONE )
+ {
+ rVal.nMaxHeight = aBoundRect.Bottom() + rVal.nVPos;
+ }
+ else
+ {
+ rVal.nMaxHeight = aBoundRect.Height();
+ }
+ }
+ else if ( eAnchorType == FLY_AS_CHAR )
+ {
+ rVal.nMinHPos = 0;
+ rVal.nMaxHPos = 0;
+
+ rVal.nMaxHeight = aBoundRect.Height();
+ rVal.nMaxWidth = aBoundRect.Width();
+
+ rVal.nMaxVPos = aBoundRect.Height();
+ rVal.nMinVPos = -aBoundRect.Height() + rVal.nHeight;
+ if (rVal.nMaxVPos < rVal.nMinVPos)
+ {
+ rVal.nMinVPos = rVal.nMaxVPos;
+ rVal.nMaxVPos = -aBoundRect.Height();
+ }
+ }
+ if(bIsInVertical)
+ {
+ //restore width/height exchange
+ long nTmp = rVal.nWidth;
+ rVal.nWidth = rVal.nHeight;
+ rVal.nHeight = nTmp;
+ }
+
+ if (rVal.nMaxWidth < rVal.nWidth)
+ rVal.nWidth = rVal.nMaxWidth;
+ if (rVal.nMaxHeight < rVal.nHeight)
+ rVal.nHeight = rVal.nMaxHeight;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Korrektur fuer Umrandung
+ --------------------------------------------------------------------*/
+
+SwTwips SwFlyFrmAttrMgr::CalcTopSpace()
+{
+ const SvxShadowItem& rShadow = GetShadow();
+ const SvxBoxItem& rBox = GetBox();
+ return rShadow.CalcShadowSpace(SHADOW_TOP ) + rBox.CalcLineSpace(BOX_LINE_TOP);
+}
+
+SwTwips SwFlyFrmAttrMgr::CalcBottomSpace()
+{
+ const SvxShadowItem& rShadow = GetShadow();
+ const SvxBoxItem& rBox = GetBox();
+ return rShadow.CalcShadowSpace(SHADOW_BOTTOM) + rBox.CalcLineSpace(BOX_LINE_BOTTOM);
+}
+
+SwTwips SwFlyFrmAttrMgr::CalcLeftSpace()
+{
+ const SvxShadowItem& rShadow = GetShadow();
+ const SvxBoxItem& rBox = GetBox();
+ return rShadow.CalcShadowSpace(SHADOW_LEFT) + rBox.CalcLineSpace(BOX_LINE_LEFT);
+}
+
+SwTwips SwFlyFrmAttrMgr::CalcRightSpace()
+{
+ const SvxShadowItem& rShadow = GetShadow();
+ const SvxBoxItem& rBox = GetBox();
+ return rShadow.CalcShadowSpace(SHADOW_RIGHT) + rBox.CalcLineSpace(BOX_LINE_RIGHT);
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Attribut aus dem Set loeschen
+ --------------------------------------------------------------------*/
+void SwFlyFrmAttrMgr::DelAttr( USHORT nId )
+{
+ aSet.ClearItem( nId );
+}
+
+void SwFlyFrmAttrMgr::SetLRSpace( long nLeft, long nRight )
+{
+ ASSERT( LONG_MAX != nLeft && LONG_MAX != nRight, "Welchen Raend setzen?" );
+
+ SvxLRSpaceItem aTmp( (SvxLRSpaceItem&)aSet.Get( RES_LR_SPACE ) );
+ if( LONG_MAX != nLeft )
+ aTmp.SetLeft( USHORT(nLeft) );
+ if( LONG_MAX != nRight )
+ aTmp.SetRight( USHORT(nRight) );
+ aSet.Put( aTmp );
+}
+
+void SwFlyFrmAttrMgr::SetULSpace( long nTop, long nBottom )
+{
+ ASSERT(LONG_MAX != nTop && LONG_MAX != nBottom, "Welchen Raend setzen?" );
+
+ SvxULSpaceItem aTmp( (SvxULSpaceItem&)aSet.Get( RES_UL_SPACE ) );
+ if( LONG_MAX != nTop )
+ aTmp.SetUpper( USHORT(nTop) );
+ if( LONG_MAX != nBottom )
+ aTmp.SetLower( USHORT(nBottom) );
+ aSet.Put( aTmp );
+}
+
+void SwFlyFrmAttrMgr::SetPos( const Point& rPoint )
+{
+ SwFmtVertOrient aVertOrient( GetVertOrient() );
+ SwFmtHoriOrient aHoriOrient( GetHoriOrient() );
+
+ aHoriOrient.SetPos ( rPoint.X() );
+ aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE );
+
+ aVertOrient.SetPos ( rPoint.Y() );
+ aVertOrient.SetVertOrient( text::VertOrientation::NONE );
+
+ aSet.Put( aVertOrient );
+ aSet.Put( aHoriOrient );
+}
+
+void SwFlyFrmAttrMgr::SetHorzOrientation( sal_Int16 eOrient )
+{
+ SwFmtHoriOrient aHoriOrient( GetHoriOrient() );
+ aHoriOrient.SetHoriOrient( eOrient );
+ aSet.Put( aHoriOrient );
+}
+
+void SwFlyFrmAttrMgr::SetVertOrientation( sal_Int16 eOrient )
+{
+ SwFmtVertOrient aVertOrient( GetVertOrient() );
+ aVertOrient.SetVertOrient( eOrient );
+ aSet.Put( aVertOrient );
+}
+
+void SwFlyFrmAttrMgr::SetHeightSizeType( SwFrmSize eType )
+{
+ SwFmtFrmSize aSize( GetFrmSize() );
+ aSize.SetHeightSizeType( eType );
+ aSet.Put( aSize );
+}
+
+void SwFlyFrmAttrMgr::SetSize( const Size& rSize )
+{
+ SwFmtFrmSize aSize( GetFrmSize() );
+ aSize.SetSize(Size(Max(rSize.Width(), long(MINFLY)), Max(rSize.Height(), long(MINFLY))));
+ aSet.Put( aSize );
+}
+
+void SwFlyFrmAttrMgr::SetAttrSet(const SfxItemSet& rSet)
+{
+ aSet.ClearItem();
+ aSet.Put( rSet );
+}
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
new file mode 100644
index 000000000000..c1747efaa962
--- /dev/null
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -0,0 +1,3277 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/embed/EmbedMisc.hpp>
+
+#include <cmdid.h>
+#include <helpid.h>
+#include <hintids.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/mnemonic.hxx>
+#include <svl/urihelper.hxx>
+#include <svl/stritem.hxx>
+#include <svx/htmlmode.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/opaqitem.hxx>
+#include <editeng/protitem.hxx>
+#include <editeng/prntitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svx/swframevalidation.hxx>
+#include <sot/clsids.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <fmturl.hxx>
+#include <fmteiro.hxx>
+#include <fmtcnct.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <swmodule.hxx>
+#include <uitool.hxx>
+#include <docsh.hxx>
+#include <viewopt.hxx>
+#include <frmatr.hxx>
+#include <frmdlg.hxx>
+#include <frmmgr.hxx>
+#include <frmpage.hxx>
+#include <wrap.hxx>
+#include <colmgr.hxx>
+#include <grfatr.hxx>
+#include <uiitems.hxx>
+// OD 19.09.2003 #i18732#
+#include <fmtfollowtextflow.hxx>
+
+#include <frmui.hrc>
+#include <frmpage.hrc>
+#include <sfx2/filedlghelper.hxx>
+#include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
+#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
+#include <svtools/filter.hxx>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+using namespace ::sfx2;
+
+#define SwFPos SvxSwFramePosString
+
+struct FrmMap
+{
+ SvxSwFramePosString::StringId eStrId;
+ SvxSwFramePosString::StringId eMirrorStrId;
+ USHORT nAlign;
+ ULONG nLBRelations;
+};
+
+struct RelationMap
+{
+ SvxSwFramePosString::StringId eStrId;
+ SvxSwFramePosString::StringId eMirrorStrId;
+ ULONG nLBRelation;
+ USHORT nRelation;
+};
+
+struct StringIdPair_Impl
+{
+ SvxSwFramePosString::StringId eHori;
+ SvxSwFramePosString::StringId eVert;
+};
+
+#define MAX_PERCENT_WIDTH 254L
+#define MAX_PERCENT_HEIGHT 254L
+
+// OD 19.09.2003 #i18732# - change order of alignments
+#define LB_FRAME 0x00000001L // Textbereich des Absatzes
+#define LB_PRTAREA 0x00000002L // Textbereich des Absatzes + Einzuege
+#define LB_VERT_FRAME 0x00000004L // Vertikaler Textbereich des Absatzes
+#define LB_VERT_PRTAREA 0x00000008L // Vertikaler Textbereich des Absatzes + Einzuege
+#define LB_REL_FRM_LEFT 0x00000010L // Linker Absatzrand
+#define LB_REL_FRM_RIGHT 0x00000020L // Rechter Absatzrand
+
+#define LB_REL_PG_LEFT 0x00000040L // Linker Seitenrand
+#define LB_REL_PG_RIGHT 0x00000080L // Rechter Seitenrand
+#define LB_REL_PG_FRAME 0x00000100L // Gesamte Seite
+#define LB_REL_PG_PRTAREA 0x00000200L // Textbereich der Seite
+
+#define LB_FLY_REL_PG_LEFT 0x00000400L // Linker Rahmenrand
+#define LB_FLY_REL_PG_RIGHT 0x00000800L // Rechter Rahmenrand
+#define LB_FLY_REL_PG_FRAME 0x00001000L // Gesamte Rahmen
+#define LB_FLY_REL_PG_PRTAREA 0x00002000L // Rahmeninneres
+
+#define LB_REL_BASE 0x00010000L // Zeichenausrichtung Basis
+#define LB_REL_CHAR 0x00020000L // Zeichenausrichtung Zeichen
+#define LB_REL_ROW 0x00040000L // Zeichenausrichtung Zeile
+
+// OD 10.11.2003 #i22305#
+#define LB_FLY_VERT_FRAME 0x00100000L // vertical entire frame
+#define LB_FLY_VERT_PRTAREA 0x00200000L // vertical frame text area
+
+// OD 11.11.2003 #i22341#
+#define LB_VERT_LINE 0x00400000L // vertical text line
+
+static RelationMap __FAR_DATA aRelationMap[] =
+{
+ {SwFPos::FRAME, SwFPos::FRAME, LB_FRAME, text::RelOrientation::FRAME},
+ {SwFPos::PRTAREA, SwFPos::PRTAREA, LB_PRTAREA, text::RelOrientation::PRINT_AREA},
+ {SwFPos::REL_PG_LEFT, SwFPos::MIR_REL_PG_LEFT, LB_REL_PG_LEFT, text::RelOrientation::PAGE_LEFT},
+ {SwFPos::REL_PG_RIGHT, SwFPos::MIR_REL_PG_RIGHT, LB_REL_PG_RIGHT, text::RelOrientation::PAGE_RIGHT},
+ {SwFPos::REL_FRM_LEFT, SwFPos::MIR_REL_FRM_LEFT, LB_REL_FRM_LEFT, text::RelOrientation::FRAME_LEFT},
+ {SwFPos::REL_FRM_RIGHT, SwFPos::MIR_REL_FRM_RIGHT, LB_REL_FRM_RIGHT, text::RelOrientation::FRAME_RIGHT},
+ {SwFPos::REL_PG_FRAME, SwFPos::REL_PG_FRAME, LB_REL_PG_FRAME, text::RelOrientation::PAGE_FRAME},
+ {SwFPos::REL_PG_PRTAREA, SwFPos::REL_PG_PRTAREA, LB_REL_PG_PRTAREA, text::RelOrientation::PAGE_PRINT_AREA},
+ {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB_REL_CHAR, text::RelOrientation::CHAR},
+
+ {SwFPos::FLY_REL_PG_LEFT, SwFPos::FLY_MIR_REL_PG_LEFT, LB_FLY_REL_PG_LEFT, text::RelOrientation::PAGE_LEFT},
+ {SwFPos::FLY_REL_PG_RIGHT, SwFPos::FLY_MIR_REL_PG_RIGHT, LB_FLY_REL_PG_RIGHT, text::RelOrientation::PAGE_RIGHT},
+ {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB_FLY_REL_PG_FRAME, text::RelOrientation::PAGE_FRAME},
+ {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB_FLY_REL_PG_PRTAREA, text::RelOrientation::PAGE_PRINT_AREA},
+
+ {SwFPos::REL_BORDER, SwFPos::REL_BORDER, LB_VERT_FRAME, text::RelOrientation::FRAME},
+ {SwFPos::REL_PRTAREA, SwFPos::REL_PRTAREA, LB_VERT_PRTAREA, text::RelOrientation::PRINT_AREA},
+
+ // OD 10.11.2003 #i22305#
+ {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB_FLY_VERT_FRAME, text::RelOrientation::FRAME},
+ {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB_FLY_VERT_PRTAREA, text::RelOrientation::PRINT_AREA},
+
+ // OD 11.11.2003 #i22341#
+ {SwFPos::REL_LINE, SwFPos::REL_LINE, LB_VERT_LINE, text::RelOrientation::TEXT_LINE}
+};
+
+static RelationMap __FAR_DATA aAsCharRelationMap[] =
+{
+ {SwFPos::REL_BASE, SwFPos::REL_BASE, LB_REL_BASE, text::RelOrientation::FRAME},
+ {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB_REL_CHAR, text::RelOrientation::FRAME},
+ {SwFPos::REL_ROW, SwFPos::REL_ROW, LB_REL_ROW, text::RelOrientation::FRAME}
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Seite verankert
+ --------------------------------------------------------------------*/
+
+#define HORI_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_PG_LEFT| \
+ LB_REL_PG_RIGHT)
+
+static FrmMap __FAR_DATA aHPageMap[] =
+{
+ {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_PAGE_REL},
+ {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_PAGE_REL},
+ {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_PAGE_REL},
+ {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_PAGE_REL}
+};
+
+static FrmMap __FAR_DATA aHPageHtmlMap[] =
+{
+ {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB_REL_PG_FRAME}
+};
+
+#define VERT_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
+
+static FrmMap __FAR_DATA aVPageMap[] =
+{
+ {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_PAGE_REL},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_PAGE_REL},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_PAGE_REL},
+ {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_PAGE_REL}
+};
+
+static FrmMap __FAR_DATA aVPageHtmlMap[] =
+{
+ {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, LB_REL_PG_FRAME}
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Rahmen verankert
+ --------------------------------------------------------------------*/
+
+#define HORI_FRAME_REL (LB_FLY_REL_PG_FRAME|LB_FLY_REL_PG_PRTAREA| \
+ LB_FLY_REL_PG_LEFT|LB_FLY_REL_PG_RIGHT)
+
+static FrmMap __FAR_DATA aHFrameMap[] =
+{
+ {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_FRAME_REL},
+ {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_FRAME_REL},
+ {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_FRAME_REL},
+ {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_FRAME_REL}
+};
+
+static FrmMap __FAR_DATA aHFlyHtmlMap[] =
+{
+ {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, LB_FLY_REL_PG_FRAME},
+ {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB_FLY_REL_PG_FRAME}
+};
+
+// OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects
+// OD 10.11.2003 #i22305#
+#define VERT_FRAME_REL (LB_FLY_VERT_FRAME|LB_FLY_VERT_PRTAREA)
+
+static FrmMap __FAR_DATA aVFrameMap[] =
+{
+ {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_FRAME_REL},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_FRAME_REL},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_FRAME_REL},
+ {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_FRAME_REL}
+};
+
+static FrmMap __FAR_DATA aVFlyHtmlMap[] =
+{
+ // OD 10.11.2003 #i22305#
+ {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_FLY_VERT_FRAME},
+ {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, LB_FLY_VERT_FRAME}
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Absatz verankert
+ --------------------------------------------------------------------*/
+
+#define HORI_PARA_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \
+ LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \
+ LB_REL_FRM_RIGHT)
+
+static FrmMap __FAR_DATA aHParaMap[] =
+{
+ {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_PARA_REL},
+ {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_PARA_REL},
+ {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_PARA_REL},
+ {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_PARA_REL}
+};
+
+#define HTML_HORI_PARA_REL (LB_FRAME|LB_PRTAREA)
+
+static FrmMap __FAR_DATA aHParaHtmlMap[] =
+{
+ {SwFPos::LEFT, SwFPos::LEFT, text::HoriOrientation::LEFT, HTML_HORI_PARA_REL},
+ {SwFPos::RIGHT, SwFPos::RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_PARA_REL}
+};
+
+static FrmMap __FAR_DATA aHParaHtmlAbsMap[] =
+{
+ {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HTML_HORI_PARA_REL},
+ {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_PARA_REL}
+};
+
+// OD 19.09.2003 #i18732# - allow vertical alignment at page areas
+#define VERT_PARA_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \
+ LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
+
+static FrmMap __FAR_DATA aVParaMap[] =
+{
+ {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_PARA_REL},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_PARA_REL},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_PARA_REL},
+ {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_PARA_REL}
+};
+
+static FrmMap __FAR_DATA aVParaHtmlMap[] =
+{
+ {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_VERT_PRTAREA}
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Relativ zum Zeichen verankert
+ --------------------------------------------------------------------*/
+
+#define HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \
+ LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \
+ LB_REL_FRM_RIGHT|LB_REL_CHAR)
+
+static FrmMap __FAR_DATA aHCharMap[] =
+{
+ {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_CHAR_REL},
+ {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_CHAR_REL},
+ {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_CHAR_REL},
+ {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_CHAR_REL}
+};
+
+#define HTML_HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_CHAR)
+
+static FrmMap __FAR_DATA aHCharHtmlMap[] =
+{
+ {SwFPos::LEFT, SwFPos::LEFT, text::HoriOrientation::LEFT, HTML_HORI_CHAR_REL},
+ {SwFPos::RIGHT, SwFPos::RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_CHAR_REL}
+};
+
+static FrmMap __FAR_DATA aHCharHtmlAbsMap[] =
+{
+ {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, LB_PRTAREA|LB_REL_CHAR},
+ {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, LB_PRTAREA},
+ {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB_REL_PG_FRAME}
+};
+
+// OD 19.09.2003 #i18732# - allow vertical alignment at page areas
+// OD 12.11.2003 #i22341# - handle <LB_REL_CHAR> on its own
+#define VERT_CHAR_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \
+ LB_REL_PG_FRAME|LB_REL_PG_PRTAREA)
+
+static FrmMap __FAR_DATA aVCharMap[] =
+{
+ // OD 11.11.2003 #i22341#
+ // introduce mappings for new vertical alignment at top of line <LB_VERT_LINE>
+ // and correct mapping for vertical alignment at character for position <FROM_BOTTOM>
+ // Note: Because of these adjustments the map becomes ambigous in its values
+ // <eStrId>/<eMirrorStrId> and <nAlign>. These ambiguities are considered
+ // in the methods <SwFrmPage::FillRelLB(..)>, <SwFrmPage::GetAlignment(..)>
+ // and <SwFrmPage::FillPosLB(..)>
+ {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_CHAR_REL|LB_REL_CHAR},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_CHAR_REL|LB_REL_CHAR},
+ {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB_REL_CHAR},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_CHAR_REL|LB_REL_CHAR},
+ {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_CHAR_REL},
+ {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, text::VertOrientation::NONE, LB_REL_CHAR|LB_VERT_LINE},
+ {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB_VERT_LINE},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB_VERT_LINE},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB_VERT_LINE}
+};
+
+
+static FrmMap __FAR_DATA aVCharHtmlMap[] =
+{
+ {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB_REL_CHAR}
+};
+
+static FrmMap __FAR_DATA aVCharHtmlAbsMap[] =
+{
+ {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_REL_CHAR},
+ {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB_REL_CHAR}
+};
+/*--------------------------------------------------------------------
+ Beschreibung: Als Zeichen verankert
+ --------------------------------------------------------------------*/
+
+static FrmMap __FAR_DATA aVAsCharMap[] =
+{
+ {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_REL_BASE},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, LB_REL_BASE},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, LB_REL_BASE},
+
+ {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::CHAR_TOP, LB_REL_CHAR},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::CHAR_BOTTOM, LB_REL_CHAR},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CHAR_CENTER, LB_REL_CHAR},
+
+ {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB_REL_ROW},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB_REL_ROW},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB_REL_ROW},
+
+ {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, text::VertOrientation::NONE, LB_REL_BASE}
+};
+
+static FrmMap __FAR_DATA aVAsCharHtmlMap[] =
+{
+ {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_REL_BASE},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, LB_REL_BASE},
+
+ {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::CHAR_TOP, LB_REL_CHAR},
+
+ {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB_REL_ROW},
+ {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB_REL_ROW},
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB_REL_ROW}
+};
+
+static USHORT __FAR_DATA aPageRg[] = {
+ RES_FRM_SIZE, RES_FRM_SIZE,
+ RES_VERT_ORIENT, RES_ANCHOR,
+ RES_COL, RES_COL,
+ RES_FOLLOW_TEXT_FLOW, RES_FOLLOW_TEXT_FLOW,
+ 0
+};
+static USHORT __FAR_DATA aAddPgRg[] = {
+ RES_PROTECT, RES_PROTECT,
+ RES_PRINT, RES_PRINT,
+ FN_SET_FRM_NAME, FN_SET_FRM_NAME,
+ FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME,
+ 0
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+size_t lcl_GetFrmMapCount( const FrmMap* pMap)
+{
+ if ( pMap )
+ {
+ int aSizeOf = sizeof(FrmMap);
+ if( pMap == aVParaHtmlMap)
+ return sizeof(aVParaHtmlMap) / aSizeOf;
+ if( pMap == aVAsCharHtmlMap)
+ return sizeof(aVAsCharHtmlMap) / aSizeOf;
+ if( pMap == aHParaHtmlMap)
+ return sizeof(aHParaHtmlMap) / aSizeOf;
+ if( pMap == aHParaHtmlAbsMap)
+ return sizeof(aHParaHtmlAbsMap) / aSizeOf;
+ if ( pMap == aVPageMap )
+ return sizeof(aVPageMap) / aSizeOf;
+ if ( pMap == aVPageHtmlMap )
+ return sizeof(aVPageHtmlMap) / aSizeOf;
+ if ( pMap == aVAsCharMap )
+ return sizeof(aVAsCharMap) / aSizeOf;
+ if ( pMap == aVParaMap )
+ return sizeof(aVParaMap) / aSizeOf;
+ if ( pMap == aHParaMap )
+ return sizeof(aHParaMap) / aSizeOf;
+ if ( pMap == aHFrameMap )
+ return sizeof(aHFrameMap) / aSizeOf;
+ // OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects
+ if ( pMap == aVFrameMap )
+ return sizeof(aVFrameMap) / aSizeOf;
+ if ( pMap == aHCharMap )
+ return sizeof(aHCharMap) / aSizeOf;
+ if ( pMap == aHCharHtmlMap )
+ return sizeof(aHCharHtmlMap) / aSizeOf;
+ if ( pMap == aHCharHtmlAbsMap )
+ return sizeof(aHCharHtmlAbsMap) / aSizeOf;
+ if ( pMap == aVCharMap )
+ return sizeof(aVCharMap) / aSizeOf;
+ if ( pMap == aVCharHtmlMap )
+ return sizeof(aVCharHtmlMap) / aSizeOf;
+ if ( pMap == aVCharHtmlAbsMap )
+ return sizeof(aVCharHtmlAbsMap) / aSizeOf;
+ if ( pMap == aHPageHtmlMap )
+ return sizeof(aHPageHtmlMap) / aSizeOf;
+ if ( pMap == aHFlyHtmlMap )
+ return sizeof(aHFlyHtmlMap) / aSizeOf;
+ if ( pMap == aVFlyHtmlMap )
+ return sizeof(aVFlyHtmlMap) / aSizeOf;
+ return sizeof(aHPageMap) / aSizeOf;
+ }
+ return 0;
+}
+/* -----------------------------08.08.2002 14:45------------------------------
+
+ ---------------------------------------------------------------------------*/
+void lcl_InsertVectors(ListBox& rBox,
+ const ::std::vector< String >& rPrev, const ::std::vector< String >& rThis,
+ const ::std::vector< String >& rNext, const ::std::vector< String >& rRemain)
+{
+ ::std::vector< String >::const_iterator aIt;
+ USHORT nEntry = 0;
+ for(aIt = rPrev.begin(); aIt != rPrev.end(); aIt++)
+ nEntry = rBox.InsertEntry(*aIt);
+ for(aIt = rThis.begin(); aIt != rThis.end(); aIt++)
+ nEntry = rBox.InsertEntry(*aIt);
+ for(aIt = rNext.begin(); aIt != rNext.end(); aIt++)
+ nEntry = rBox.InsertEntry(*aIt);
+ rBox.SetSeparatorPos(nEntry);
+ //now insert all strings sorted
+ USHORT nStartPos = rBox.GetEntryCount();
+
+ for(aIt = rPrev.begin(); aIt != rPrev.end(); aIt++)
+ ::InsertStringSorted(*aIt, rBox, nStartPos );
+ for(aIt = rThis.begin(); aIt != rThis.end(); aIt++)
+ ::InsertStringSorted(*aIt, rBox, nStartPos );
+ for(aIt = rNext.begin(); aIt != rNext.end(); aIt++)
+ ::InsertStringSorted(*aIt, rBox, nStartPos );
+ for(aIt = rRemain.begin(); aIt != rRemain.end(); aIt++)
+ ::InsertStringSorted(*aIt, rBox, nStartPos );
+}
+
+/* -----------------------------20.08.2002 16:12------------------------------
+
+ ---------------------------------------------------------------------------*/
+SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(SvxSwFramePosString::StringId eStringId, BOOL bVertical, BOOL bRTL)
+{
+ //special handling of STR_FROMLEFT
+ if(SwFPos::FROMLEFT == eStringId)
+ {
+ eStringId = bVertical ?
+ bRTL ? SwFPos::FROMBOTTOM : SwFPos::FROMTOP :
+ bRTL ? SwFPos::FROMRIGHT : SwFPos::FROMLEFT;
+ return eStringId;
+ }
+ if(bVertical)
+ {
+ //exchange horizontal strings with vertical strings and vice versa
+ static const StringIdPair_Impl aHoriIds[] =
+ {
+ {SwFPos::LEFT, SwFPos::TOP},
+ {SwFPos::RIGHT, SwFPos::BOTTOM},
+ {SwFPos::CENTER_HORI, SwFPos::CENTER_VERT},
+ {SwFPos::FROMTOP, SwFPos::FROMRIGHT},
+ {SwFPos::REL_PG_LEFT, SwFPos::REL_PG_TOP},
+ {SwFPos::REL_PG_RIGHT, SwFPos::REL_PG_BOTTOM} ,
+ {SwFPos::REL_FRM_LEFT, SwFPos::REL_FRM_TOP},
+ {SwFPos::REL_FRM_RIGHT, SwFPos::REL_FRM_BOTTOM}
+ };
+ static const StringIdPair_Impl aVertIds[] =
+ {
+ {SwFPos::TOP, SwFPos::RIGHT},
+ {SwFPos::BOTTOM, SwFPos::LEFT },
+ {SwFPos::CENTER_VERT, SwFPos::CENTER_HORI},
+ {SwFPos::FROMTOP, SwFPos::FROMRIGHT },
+ {SwFPos::REL_PG_TOP, SwFPos::REL_PG_LEFT },
+ {SwFPos::REL_PG_BOTTOM, SwFPos::REL_PG_RIGHT } ,
+ {SwFPos::REL_FRM_TOP, SwFPos::REL_FRM_LEFT },
+ {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT }
+ };
+ USHORT nIndex;
+ for(nIndex = 0; nIndex < sizeof(aHoriIds) / sizeof(StringIdPair_Impl); ++nIndex)
+ {
+ if(aHoriIds[nIndex].eHori == eStringId)
+ {
+ eStringId = aHoriIds[nIndex].eVert;
+ return eStringId;
+ }
+ }
+ nIndex = 0;
+ for(nIndex = 0; nIndex < sizeof(aVertIds) / sizeof(StringIdPair_Impl); ++nIndex)
+ {
+ if(aVertIds[nIndex].eHori == eStringId)
+ {
+ eStringId = aVertIds[nIndex].eVert;
+ break;
+ }
+ }
+ }
+ return eStringId;
+}
+
+// OD 12.11.2003 #i22341# - helper method in order to determine all possible
+// listbox relations in a relation map for a given relation
+ULONG lcl_GetLBRelationsForRelations( const USHORT _nRel )
+{
+ ULONG nLBRelations = 0L;
+
+ sal_uInt16 nRelMapSize = sizeof(aRelationMap) / sizeof(RelationMap);
+ for ( sal_uInt16 nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos )
+ {
+ if ( aRelationMap[nRelMapPos].nRelation == _nRel )
+ {
+ nLBRelations |= aRelationMap[nRelMapPos].nLBRelation;
+ }
+ }
+
+ return nLBRelations;
+}
+
+// OD 14.11.2003 #i22341# - helper method on order to determine all possible
+// listbox relations in a relation map for a given string ID
+ULONG lcl_GetLBRelationsForStrID( const FrmMap* _pMap,
+ const SvxSwFramePosString::StringId _eStrId,
+ const bool _bUseMirrorStr )
+{
+ ULONG nLBRelations = 0L;
+
+ size_t nRelMapSize = lcl_GetFrmMapCount( _pMap );
+ for ( size_t nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos )
+ {
+ if ( ( !_bUseMirrorStr && _pMap[nRelMapPos].eStrId == _eStrId ) ||
+ ( _bUseMirrorStr && _pMap[nRelMapPos].eMirrorStrId == _eStrId ) )
+ {
+ nLBRelations |= _pMap[nRelMapPos].nLBRelations;
+ }
+ }
+
+ return nLBRelations;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: StandardRahmenTabPage
+ --------------------------------------------------------------------*/
+
+namespace
+{
+ void HandleAutoCB( BOOL _bChecked, FixedText& _rFT_man, FixedText& _rFT_auto )
+ {
+ _rFT_man.Show( !_bChecked );
+ _rFT_auto.Show( _bChecked );
+ }
+}
+
+
+SwFrmPage::SwFrmPage ( Window *pParent, const SfxItemSet &rSet ) :
+ SfxTabPage (pParent, SW_RES(TP_FRM_STD), rSet),
+
+ aWidthFT (this, SW_RES(FT_WIDTH)),
+ aWidthAutoFT (this, SW_RES(FT_WIDTH_AUTO)),
+ aWidthED (this, SW_RES(ED_WIDTH)),
+ aRelWidthCB (this, SW_RES(CB_REL_WIDTH)),
+ aAutoWidthCB (this, SW_RES(CB_AUTOWIDTH)),
+ aHeightFT (this, SW_RES(FT_HEIGHT)),
+ aHeightAutoFT (this, SW_RES(FT_HEIGHT_AUTO)),
+ aHeightED (this, SW_RES(ED_HEIGHT)),
+ aRelHeightCB (this, SW_RES(CB_REL_HEIGHT)),
+ aAutoHeightCB (this, SW_RES(CB_AUTOHEIGHT)),
+ aFixedRatioCB (this, SW_RES(CB_FIXEDRATIO)),
+ aRealSizeBT (this, SW_RES(BT_REALSIZE)),
+ aSizeFL (this, SW_RES(FL_SIZE)),
+
+ aTypeFL (this, SW_RES(FL_TYPE)),
+ aTypeSepFL (this, SW_RES(FL_TYPE_SEP)),
+ aAnchorAtPageRB (this, SW_RES(RB_ANCHOR_PAGE)),
+ aAnchorAtParaRB (this, SW_RES(RB_ANCHOR_PARA)),
+ aAnchorAtCharRB (this, SW_RES(RB_ANCHOR_AT_CHAR)),
+ aAnchorAsCharRB (this, SW_RES(RB_ANCHOR_AS_CHAR)),
+ aAnchorAtFrameRB(this, SW_RES(RB_ANCHOR_FRAME)),
+
+ aHorizontalFT (this, SW_RES(FT_HORIZONTAL)),
+ aHorizontalDLB (this, SW_RES(DLB_HORIZONTAL)),
+ aAtHorzPosFT (this, SW_RES(FT_AT_HORZ_POS)),
+ aAtHorzPosED (this, SW_RES(ED_AT_HORZ_POS)),
+ aHoriRelationFT (this, SW_RES(FT_HORI_RELATION)),
+ aHoriRelationLB (this, SW_RES(LB_HORI_RELATION)),
+ aMirrorPagesCB (this, SW_RES(CB_MIRROR)),
+ aVerticalFT (this, SW_RES(FT_VERTICAL)),
+ aVerticalDLB (this, SW_RES(DLB_VERTICAL)),
+ aAtVertPosFT (this, SW_RES(FT_AT_VERT_POS)),
+ aAtVertPosED (this, SW_RES(ED_AT_VERT_POS)),
+ aVertRelationFT (this, SW_RES(FT_VERT_RELATION)),
+ aVertRelationLB (this, SW_RES(LB_VERT_RELATION)),
+ // OD 19.09.2003 #i18732# - new checkbox
+ aFollowTextFlowCB(this, SW_RES(CB_FOLLOWTEXTFLOW)),
+ aPositionFL (this, SW_RES(FL_POSITION)),
+
+ aExampleWN (this, SW_RES(WN_BSP)),
+
+ bAtHorzPosModified( FALSE ),
+ bAtVertPosModified( FALSE ),
+
+ bFormat(FALSE),
+ bNew(TRUE),
+ bNoModifyHdl(TRUE),
+ bVerticalChanged(FALSE),
+ bIsVerticalFrame(FALSE),
+ bIsInRightToLeft(FALSE),
+ bHtmlMode(FALSE),
+ nHtmlMode(0),
+ nDlgType(0),
+ nUpperBorder(0),
+ nLowerBorder(0),
+ fWidthHeightRatio(1.0),
+ // OD 12.11.2003 #i22341#
+ mpToCharCntntPos( NULL ),
+
+ nOldH(text::HoriOrientation::CENTER),
+ nOldHRel(text::RelOrientation::FRAME),
+ nOldV(text::VertOrientation::TOP),
+ nOldVRel(text::RelOrientation::PRINT_AREA),
+ pVMap( 0 ),
+ pHMap( 0 ),
+ m_bAllowVertPositioning( true ),
+ m_bIsMathOLE( false ),
+ m_bIsMathBaselineAlignment( true )
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ Link aLk = LINK(this, SwFrmPage, RangeModifyHdl);
+ aWidthED. SetLoseFocusHdl( aLk );
+ aHeightED. SetLoseFocusHdl( aLk );
+ aAtHorzPosED.SetLoseFocusHdl( aLk );
+ aAtVertPosED.SetLoseFocusHdl( aLk );
+ // OD 25.09.2003 #i18732# - click handler for new checkbox
+ aFollowTextFlowCB.SetClickHdl( aLk );
+
+ aLk = LINK(this, SwFrmPage, ModifyHdl);
+ aWidthED. SetModifyHdl( aLk );
+ aHeightED. SetModifyHdl( aLk );
+ aAtHorzPosED.SetModifyHdl( aLk );
+ aAtVertPosED.SetModifyHdl( aLk );
+
+ aLk = LINK(this, SwFrmPage, AnchorTypeHdl);
+ aAnchorAtPageRB.SetClickHdl( aLk );
+ aAnchorAtParaRB.SetClickHdl( aLk );
+ aAnchorAtCharRB.SetClickHdl( aLk );
+ aAnchorAsCharRB.SetClickHdl( aLk );
+ aAnchorAtFrameRB.SetClickHdl( aLk );
+
+ aHorizontalDLB.SetSelectHdl(LINK(this, SwFrmPage, PosHdl));
+ aVerticalDLB. SetSelectHdl(LINK(this, SwFrmPage, PosHdl));
+
+ aHoriRelationLB.SetSelectHdl(LINK(this, SwFrmPage, RelHdl));
+ aVertRelationLB.SetSelectHdl(LINK(this, SwFrmPage, RelHdl));
+
+ aMirrorPagesCB.SetClickHdl(LINK(this, SwFrmPage, MirrorHdl));
+
+ aLk = LINK(this, SwFrmPage, RelSizeClickHdl);
+ aRelWidthCB.SetClickHdl( aLk );
+ aRelHeightCB.SetClickHdl( aLk );
+
+ aAutoWidthCB.SetClickHdl( LINK( this, SwFrmPage, AutoWidthClickHdl ) );
+ aAutoHeightCB.SetClickHdl( LINK( this, SwFrmPage, AutoHeightClickHdl ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Dtor
+ --------------------------------------------------------------------*/
+
+SwFrmPage::~SwFrmPage()
+{
+}
+
+SfxTabPage* SwFrmPage::Create(Window *pParent, const SfxItemSet &rSet)
+{
+ return new SwFrmPage( pParent, rSet );
+}
+
+namespace
+{
+ void MoveControl( Control& _rCtrl, long _nOffsetY )
+ {
+ Point aPt( _rCtrl.GetPosPixel() );
+ aPt.Move( 0, _nOffsetY );
+ _rCtrl.SetPosPixel( aPt );
+ }
+}
+
+void SwFrmPage::EnableGraficMode( void )
+{
+ // #i39692# mustn't be called more than once
+ if(!aRealSizeBT.IsVisible())
+ {
+ long nOffset1 = aRelWidthCB.GetPosPixel().Y() - aAutoWidthCB.GetPosPixel().Y();
+ long nOffset2 = nOffset1 + aRelHeightCB.GetPosPixel().Y() - aAutoHeightCB.GetPosPixel().Y();
+
+ MoveControl( aHeightFT, nOffset1 );
+ MoveControl( aHeightED, nOffset1 );
+ MoveControl( aRelHeightCB, nOffset1 );
+ MoveControl( aFixedRatioCB, nOffset2 );
+
+ aWidthFT.Show();
+ aWidthAutoFT.Hide();
+ aAutoHeightCB.Hide();
+
+ aHeightFT.Show();
+ aHeightAutoFT.Hide();
+ aAutoWidthCB.Hide();
+
+ aRealSizeBT.Show();
+ }
+}
+
+void SwFrmPage::Reset( const SfxItemSet &rSet )
+{
+
+ SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell() :
+ ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell();
+
+ nHtmlMode = ::GetHtmlMode(pSh->GetView().GetDocShell());
+ bHtmlMode = nHtmlMode & HTMLMODE_ON ? TRUE : FALSE;
+
+ FieldUnit aMetric = ::GetDfltMetric(bHtmlMode);
+ SetMetric( aWidthED, aMetric );
+ SetMetric( aHeightED, aMetric );
+ SetMetric( aAtHorzPosED, aMetric );
+ SetMetric( aAtVertPosED, aMetric );
+
+ const SfxPoolItem* pItem = NULL;
+
+ const SwFmtAnchor& rAnchor = (const SwFmtAnchor&)rSet.Get(RES_ANCHOR);
+
+ if (SFX_ITEM_SET == rSet.GetItemState(FN_OLE_IS_MATH, FALSE, &pItem))
+ m_bIsMathOLE = ((const SfxBoolItem*)pItem)->GetValue();
+ if (SFX_ITEM_SET == rSet.GetItemState(FN_MATH_BASELINE_ALIGNMENT, FALSE, &pItem))
+ m_bIsMathBaselineAlignment = ((const SfxBoolItem*)pItem)->GetValue();
+ EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment
+ && FLY_AS_CHAR == rAnchor.GetAnchorId()) );
+
+ if (bFormat)
+ {
+ // Bei Formaten keine Ankerbearbeitung
+ aAnchorAtPageRB.Enable( FALSE );
+ aAnchorAtParaRB.Enable( FALSE );
+ aAnchorAtCharRB.Enable( FALSE );
+ aAnchorAsCharRB.Enable( FALSE );
+ aAnchorAtFrameRB.Enable( FALSE );
+ aTypeFL.Enable( FALSE );
+ aFixedRatioCB.Enable(FALSE);
+ }
+ else
+ {
+ if (rAnchor.GetAnchorId() != FLY_AT_FLY && !pSh->IsFlyInFly())
+ aAnchorAtFrameRB.Hide();
+ if(!bVerticalChanged && pSh->IsFrmVertical(TRUE, bIsInRightToLeft))
+ {
+ String sHLabel = aHorizontalFT.GetText();
+ aHorizontalFT.SetText(aVerticalFT.GetText());
+ aVerticalFT.SetText(sHLabel);
+ bIsVerticalFrame = TRUE;
+ }
+ }
+
+ if ( nDlgType == DLG_FRM_GRF || nDlgType == DLG_FRM_OLE )
+ {
+ ASSERT(pSh , "shell not found");
+ //OS: nur fuer die Variante Einfuegen/Grafik/Eigenschaften
+ if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_GRF_REALSIZE, FALSE, &pItem))
+ aGrfSize = ((const SvxSizeItem*)pItem)->GetSize();
+ else
+ pSh->GetGrfSize( aGrfSize );
+
+ if ( !bNew )
+ {
+ aRealSizeBT.SetClickHdl(LINK(this, SwFrmPage, RealSizeHdl));
+ EnableGraficMode();
+ }
+// else
+// aTypeFL.SetSizePixel(Size(aTypeFL.GetSizePixel().Width(), aSizeFL.GetSizePixel().Height()));
+
+ if ( nDlgType == DLG_FRM_GRF )
+ aFixedRatioCB.Check( FALSE );
+ else
+ {
+ if ( bNew )
+ SetText( SW_RESSTR(STR_OLE_INSERT));
+ else
+ SetText( SW_RESSTR(STR_OLE_EDIT));
+ }
+ }
+ else
+ {
+// aTypeFL.SetSizePixel(Size(aTypeFL.GetSizePixel().Width(), aSizeFL.GetSizePixel().Height()));
+ aGrfSize = ((const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE)).GetSize();
+ }
+
+ //Prozenteingabe ermoeglichen.
+ aWidthED. SetBaseValue( aWidthED.Normalize(aGrfSize.Width()), FUNIT_TWIP );
+ aHeightED.SetBaseValue( aHeightED.Normalize(aGrfSize.Height()), FUNIT_TWIP );
+ //the available space is not yet known so the RefValue has to be calculated from size and relative size values
+ //this is needed only if relative values are already set
+
+ const SwFmtFrmSize& rFrmSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE);
+
+ if (rFrmSize.GetWidthPercent() != 0xff && rFrmSize.GetWidthPercent() != 0)
+ {
+ //calculate the rerference value from the with and relative width values
+ sal_Int32 nSpace = rFrmSize.GetWidth() * 100 / rFrmSize.GetWidthPercent();
+ aWidthED. SetRefValue( nSpace );
+ }
+
+ if (rFrmSize.GetHeightPercent() != 0xff && rFrmSize.GetHeightPercent() != 0)
+ {
+ //calculate the rerference value from the with and relative width values
+ sal_Int32 nSpace = rFrmSize.GetHeight() * 100 / rFrmSize.GetHeightPercent();
+ aHeightED.SetRefValue( nSpace );
+ }
+
+ // Allgemeiner Initialisierungteil
+ switch(rAnchor.GetAnchorId())
+ {
+ case FLY_AT_PAGE: aAnchorAtPageRB.Check(); break;
+ case FLY_AT_PARA: aAnchorAtParaRB.Check(); break;
+ case FLY_AT_CHAR: aAnchorAtCharRB.Check(); break;
+ case FLY_AS_CHAR: aAnchorAsCharRB.Check(); break;
+ case FLY_AT_FLY: aAnchorAtFrameRB.Check();break;
+ default:; //prevent warning
+ }
+
+ // OD 12.11.2003 #i22341# - determine content position of character
+ // Note: content position can be NULL
+ mpToCharCntntPos = rAnchor.GetCntntAnchor();
+
+ // OD 19.09.2003 #i18732# - init checkbox value
+ {
+ const bool bFollowTextFlow =
+ static_cast<const SwFmtFollowTextFlow&>(rSet.Get(RES_FOLLOW_TEXT_FLOW)).GetValue();
+ aFollowTextFlowCB.Check( bFollowTextFlow );
+ }
+
+ if(bHtmlMode)
+ {
+ if(nDlgType == DLG_FRM_STD &&
+ 0 == (nHtmlMode & HTMLMODE_FULL_ABS_POS))
+ {
+ aHeightFT .Enable( FALSE );
+ aHeightED .Enable( FALSE );
+ aRelHeightCB.Enable( FALSE );
+ }
+ if( 0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS))
+ {
+ if (GetAnchor() == FLY_AT_PAGE)
+ {
+ aAnchorAtParaRB.Check();
+ }
+ aAnchorAtPageRB.Enable(FALSE);
+ }
+ aAutoHeightCB.Enable(FALSE);
+ aAutoWidthCB.Enable(FALSE);
+ aMirrorPagesCB.Show(FALSE);
+ if(nDlgType == DLG_FRM_STD)
+ aFixedRatioCB.Enable(FALSE);
+ // OD 19.09.2003 #i18732# - hide checkbox in HTML mode
+ aFollowTextFlowCB.Show(FALSE);
+ }
+ else
+ {
+ // OD 06.11.2003 #i18732# correct enable/disable of check box 'Mirror on..'
+ aMirrorPagesCB.Enable(!aAnchorAsCharRB.IsChecked());
+
+ // OD 06.11.2003 #i18732# - enable/disable check box 'Follow text flow'.
+ // OD 10.11.2003 #i22305# - enable check box 'Follow text
+ // flow' also for anchor type to-frame.
+ aFollowTextFlowCB.Enable( aAnchorAtParaRB.IsChecked() ||
+ aAnchorAtCharRB.IsChecked() ||
+ aAnchorAtFrameRB.IsChecked() );
+ }
+
+ Init( rSet, TRUE );
+ aAtVertPosED.SaveValue();
+ aAtHorzPosED.SaveValue();
+ // OD 19.09.2003 #i18732#
+ aFollowTextFlowCB.SaveValue();
+
+ bNoModifyHdl = FALSE;
+ //lock PercentFields
+ aWidthED.LockAutoCalculation(sal_True);
+ aHeightED.LockAutoCalculation(sal_True);
+ RangeModifyHdl(&aWidthED); // Alle Maximalwerte initial setzen
+ aHeightED.LockAutoCalculation(sal_False);
+ aWidthED.LockAutoCalculation(sal_False);
+
+ aAutoHeightCB.SaveValue();
+ aAutoWidthCB.SaveValue();
+
+ SwTwips nWidth = static_cast< SwTwips >(aWidthED.DenormalizePercent(aWidthED.GetValue(FUNIT_TWIP)));
+ SwTwips nHeight = static_cast< SwTwips >(aHeightED.DenormalizePercent(aHeightED.GetValue(FUNIT_TWIP)));
+ fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Attribute in den Set stopfen bei OK
+ --------------------------------------------------------------------*/
+
+BOOL SwFrmPage::FillItemSet(SfxItemSet &rSet)
+{
+ BOOL bRet = FALSE;
+ SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell()
+ : ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell();
+ ASSERT( pSh , "shell not found");
+ const SfxItemSet& rOldSet = GetItemSet();
+ const SfxPoolItem* pOldItem = 0;
+
+ RndStdIds eAnchorId = (RndStdIds)GetAnchor();
+
+ if ( !bFormat )
+ {
+ pOldItem = GetOldItem(rSet, RES_ANCHOR);
+ if (bNew || !pOldItem || eAnchorId != ((const SwFmtAnchor*)pOldItem)->GetAnchorId())
+ {
+ SwFmtAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
+ bRet = 0 != rSet.Put( aAnc );
+ }
+ }
+
+ if ( pHMap )
+ {
+ SwFmtHoriOrient aHoriOrient( (const SwFmtHoriOrient&)
+ rOldSet.Get(RES_HORI_ORIENT) );
+
+ USHORT nMapPos = GetMapPos(pHMap, aHorizontalDLB);
+ short nAlign = GetAlignment(pHMap, nMapPos, aHorizontalDLB, aHoriRelationLB);
+ short nRel = GetRelation(pHMap, aHoriRelationLB);
+
+ const sal_Int16 eHOri = nAlign;
+ const sal_Int16 eRel = nRel;
+
+ aHoriOrient.SetHoriOrient( eHOri );
+ aHoriOrient.SetRelationOrient( eRel );
+ aHoriOrient.SetPosToggle(aMirrorPagesCB.IsChecked());
+
+ BOOL bMod = aAtHorzPosED.GetText() != aAtHorzPosED.GetSavedValue();
+ bMod |= aMirrorPagesCB.GetState() != aMirrorPagesCB.GetSavedValue();
+
+ if ( eHOri == text::HoriOrientation::NONE &&
+ (bNew || (bAtHorzPosModified || bMod) || nOldH != eHOri ) )
+ {
+ SwTwips nX = static_cast< SwTwips >(aAtHorzPosED.Denormalize(aAtHorzPosED.GetValue(FUNIT_TWIP)));
+ aHoriOrient.SetPos( nX );
+ }
+
+ pOldItem = GetOldItem(rSet, FN_HORI_ORIENT);
+ BOOL bSame = FALSE;
+ if ((bNew == bFormat) && pOldItem)
+ {
+ bSame = static_cast< BOOL >(aHoriOrient == (SwFmtHoriOrient&)*pOldItem);
+ }
+ if ((bNew && !bFormat) || ((bAtHorzPosModified || bMod) && !bSame))
+ {
+ bRet |= 0 != rSet.Put( aHoriOrient );
+ }
+ }
+
+ if ( pVMap )
+ {
+ // Ausrichtung Vertikal
+ SwFmtVertOrient aVertOrient( (const SwFmtVertOrient&)
+ rOldSet.Get(RES_VERT_ORIENT) );
+
+ USHORT nMapPos = GetMapPos(pVMap, aVerticalDLB);
+ short nAlign = GetAlignment(pVMap, nMapPos, aVerticalDLB, aVertRelationLB);
+ short nRel = GetRelation(pVMap, aVertRelationLB);
+
+ const sal_Int16 eVOri = nAlign;
+ const sal_Int16 eRel = nRel;
+
+ aVertOrient.SetVertOrient ( eVOri);
+ aVertOrient.SetRelationOrient( eRel );
+
+ BOOL bMod = aAtVertPosED.GetText() != aAtVertPosED.GetSavedValue();
+
+ if ( eVOri == text::VertOrientation::NONE &&
+ ( bNew || (bAtVertPosModified || bMod) || nOldV != eVOri) )
+ {
+ // Vertikale Position
+ // fuer zeichengebundene Rahmen Offset umrechenen
+ SwTwips nY = static_cast< SwTwips >(aAtVertPosED.Denormalize(aAtVertPosED.GetValue(FUNIT_TWIP)));
+ if (eAnchorId == FLY_AS_CHAR)
+ {
+ nY *= -1;
+ }
+ aVertOrient.SetPos( nY );
+ }
+ pOldItem = GetOldItem(rSet, FN_VERT_ORIENT);
+ BOOL bSame = FALSE;
+ if((bNew == bFormat) && pOldItem)
+ {
+ bSame = static_cast< BOOL >( bFormat ?
+ aVertOrient.GetVertOrient() == ((SwFmtVertOrient*)pOldItem)->GetVertOrient() &&
+ aVertOrient.GetRelationOrient() == ((SwFmtVertOrient*)pOldItem)->GetRelationOrient() &&
+ aVertOrient.GetPos() == ((SwFmtVertOrient*)pOldItem)->GetPos()
+
+ : aVertOrient == (SwFmtVertOrient&)*pOldItem );
+ }
+ if( ( bNew && !bFormat ) || ((bAtVertPosModified || bMod) && !bSame ))
+ {
+ bRet |= 0 != rSet.Put( aVertOrient );
+ }
+ }
+
+ //Size setzen
+ //Neuer Sonderfall: Ist die Groesse von pMgr(0, 0), so werden die
+ //Eigenschaften fuer eine Grafik festgelegt, die noch gar nicht geladen
+ //ist. Dann wird hier kein SetSize() gemacht, wenn die
+ //Groesseneinstellungen vom Anwender nicht veraendert wurden.
+ const SwFmtFrmSize& rOldSize = (const SwFmtFrmSize& )rOldSet.Get(RES_FRM_SIZE);
+ SwFmtFrmSize aSz( rOldSize );
+
+/* // Folgende Zeilen nur zum debuggen:
+ BOOL bModified = aWidthED.IsValueModified();
+ USHORT nOldWidth = rOldSize.GetWidth ();
+ USHORT nWidth = aWidthED .GetValue();
+ USHORT nMinWidth = aWidthED .GetMin();*/
+
+ BOOL bValueModified = (aWidthED.IsValueModified() || aHeightED.IsValueModified());
+ BOOL bCheckChanged = (aRelWidthCB.GetSavedValue() != aRelWidthCB.IsChecked()
+ || aRelHeightCB.GetSavedValue() != aRelHeightCB.IsChecked());
+
+ BOOL bLegalValue = !(!rOldSize.GetWidth () && !rOldSize.GetHeight() &&
+ aWidthED .GetValue() == aWidthED .GetMin() &&
+ aHeightED.GetValue() == aHeightED.GetMin());
+
+ if ((bNew && !bFormat) || ((bValueModified || bCheckChanged) && bLegalValue))
+ {
+ sal_Int64 nNewWidth = aWidthED.DenormalizePercent(aWidthED.GetRealValue(FUNIT_TWIP));
+ sal_Int64 nNewHeight = aHeightED.DenormalizePercent(aHeightED.GetRealValue(FUNIT_TWIP));
+ aSz.SetWidth (static_cast< SwTwips >(nNewWidth));
+ aSz.SetHeight(static_cast< SwTwips >(nNewHeight));
+
+ if (aRelWidthCB.IsChecked())
+ {
+ aSz.SetWidthPercent((BYTE)Min( static_cast< sal_Int64 >(MAX_PERCENT_WIDTH), aWidthED.Convert(aWidthED.NormalizePercent(nNewWidth), FUNIT_TWIP, FUNIT_CUSTOM)));
+ }
+ else
+ aSz.SetWidthPercent(0);
+ if (aRelHeightCB.IsChecked())
+ aSz.SetHeightPercent((BYTE)Min(static_cast< sal_Int64 >(MAX_PERCENT_HEIGHT), aHeightED.Convert(aHeightED.NormalizePercent(nNewHeight), FUNIT_TWIP, FUNIT_CUSTOM)));
+ else
+ aSz.SetHeightPercent(0);
+
+ if (aFixedRatioCB.IsChecked() && (aRelWidthCB.IsChecked() ^ aRelHeightCB.IsChecked()))
+ {
+ if (aRelWidthCB.IsChecked())
+ aSz.SetHeightPercent(0xff);
+ else
+ aSz.SetWidthPercent(0xff);
+ }
+ }
+ if( !IsInGraficMode() )
+ {
+ if( aAutoHeightCB.GetState() != aAutoHeightCB.GetSavedValue() )
+ {
+ SwFrmSize eFrmSize = (SwFrmSize) aAutoHeightCB.IsChecked()? ATT_MIN_SIZE : ATT_FIX_SIZE;
+ if( eFrmSize != aSz.GetHeightSizeType() )
+ aSz.SetHeightSizeType(eFrmSize);
+ }
+ if( aAutoWidthCB.GetState() != aAutoWidthCB.GetSavedValue() )
+ {
+ SwFrmSize eFrmSize = (SwFrmSize) aAutoWidthCB.IsChecked()? ATT_MIN_SIZE : ATT_FIX_SIZE;
+ if( eFrmSize != aSz.GetWidthSizeType() )
+ aSz.SetWidthSizeType( eFrmSize );
+ }
+ }
+ if( !bFormat && aFixedRatioCB.GetSavedValue() != aFixedRatioCB.IsChecked())
+ bRet |= 0 != rSet.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, aFixedRatioCB.IsChecked()));
+
+ pOldItem = GetOldItem(rSet, RES_FRM_SIZE);
+
+ if ((pOldItem && aSz != *pOldItem) || (!pOldItem && !bFormat) ||
+ (bFormat &&
+ (aSz.GetWidth() > 0 || aSz.GetWidthPercent() > 0) &&
+ (aSz.GetHeight() > 0 || aSz.GetHeightPercent() > 0)))
+ {
+ if (aSz.GetHeightSizeType() == ATT_VAR_SIZE) // VAR_SIZE gibts nicht bei Rahmen
+ aSz.SetHeightSizeType(ATT_MIN_SIZE); // Bug #45776 (Vorlagen ohne Breite/Hoehe)
+
+ bRet |= 0 != rSet.Put( aSz );
+ }
+ // OD 19.09.2003 #i18732#
+ if(aFollowTextFlowCB.IsChecked() != aFollowTextFlowCB.GetSavedValue())
+ {
+ bRet |= 0 != rSet.Put(SwFmtFollowTextFlow(aFollowTextFlowCB.IsChecked()));
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Horizontale und vertikale Pos initialisieren
+ --------------------------------------------------------------------*/
+
+void SwFrmPage::InitPos(RndStdIds eId,
+ USHORT nH,
+ USHORT nHRel,
+ USHORT nV,
+ USHORT nVRel,
+ long nX,
+ long nY)
+{
+ USHORT nPos = aVerticalDLB.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND && pVMap )
+ {
+ nOldV = pVMap[nPos].nAlign;
+
+ nPos = aVertRelationLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ nOldVRel = ((RelationMap *)aVertRelationLB.GetEntryData(nPos))->nRelation;
+ }
+
+ nPos = aHorizontalDLB.GetSelectEntryPos();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND && pHMap )
+ {
+ nOldH = pHMap[nPos].nAlign;
+
+ nPos = aHoriRelationLB.GetSelectEntryPos();
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ nOldHRel = ((RelationMap *)aHoriRelationLB.GetEntryData(nPos))->nRelation;
+ }
+
+ BOOL bEnable = TRUE;
+ if ( eId == FLY_AT_PAGE )
+ {
+ pVMap = bHtmlMode ? aVPageHtmlMap : aVPageMap;
+ pHMap = bHtmlMode ? aHPageHtmlMap : aHPageMap;
+ }
+ else if ( eId == FLY_AT_FLY )
+ {
+ // OD 19.09.2003 #i18732# - own vertical alignment map for to frame
+ // anchored objects.
+ pVMap = bHtmlMode ? aVFlyHtmlMap : aVFrameMap;
+ pHMap = bHtmlMode ? aHFlyHtmlMap : aHFrameMap;
+ }
+ else if ( eId == FLY_AT_PARA )
+ {
+ if(bHtmlMode)
+ {
+ pVMap = aVParaHtmlMap;
+ pHMap = nHtmlMode & HTMLMODE_SOME_ABS_POS ? aHParaHtmlAbsMap : aHParaHtmlMap;
+ }
+ else
+ {
+ pVMap = aVParaMap;
+ pHMap = aHParaMap;
+ }
+ }
+ else if ( eId == FLY_AT_CHAR )
+ {
+ if(bHtmlMode)
+ {
+ pVMap = nHtmlMode & HTMLMODE_SOME_ABS_POS ? aVCharHtmlAbsMap : aVCharHtmlMap;
+ pHMap = nHtmlMode & HTMLMODE_SOME_ABS_POS ? aHCharHtmlAbsMap : aHCharHtmlMap;
+ }
+ else
+ {
+ pVMap = aVCharMap;
+ pHMap = aHCharMap;
+ }
+ }
+ else if ( eId == FLY_AS_CHAR )
+ {
+ pVMap = bHtmlMode ? aVAsCharHtmlMap : aVAsCharMap;
+ pHMap = 0;
+ bEnable = FALSE;
+ }
+ aHorizontalDLB.Enable( bEnable );
+ aHorizontalFT.Enable( bEnable );
+
+ // aktuelle Pos selektieren
+ // Horizontal
+ if ( nH == USHRT_MAX )
+ {
+ nH = nOldH;
+ nHRel = nOldHRel;
+ }
+ // OD 12.11.2003 #i22341# - pass <nHRel> as 3rd parameter to method <FillPosLB>
+ USHORT nMapPos = FillPosLB(pHMap, nH, nHRel, aHorizontalDLB);
+ FillRelLB(pHMap, nMapPos, nH, nHRel, aHoriRelationLB, aHoriRelationFT);
+
+ // Vertikal
+ if ( nV == USHRT_MAX )
+ {
+ nV = nOldV;
+ nVRel = nOldVRel;
+ }
+ // OD 12.11.2003 #i22341# - pass <nVRel> as 3rd parameter to method <FillPosLB>
+ nMapPos = FillPosLB(pVMap, nV, nVRel, aVerticalDLB);
+ FillRelLB(pVMap, nMapPos, nV, nVRel, aVertRelationLB, aVertRelationFT);
+
+ // Edits init
+ bEnable = nH == text::HoriOrientation::NONE && eId != FLY_AS_CHAR;
+ if (!bEnable)
+ {
+ aAtHorzPosED.SetValue( 0, FUNIT_TWIP );
+ if (nX != LONG_MAX && bHtmlMode)
+ aAtHorzPosED.SetModifyFlag();
+ }
+ else
+ {
+ if (nX != LONG_MAX)
+ aAtHorzPosED.SetValue( aAtHorzPosED.Normalize(nX), FUNIT_TWIP );
+ }
+ aAtHorzPosFT.Enable( bEnable );
+ aAtHorzPosED.Enable( bEnable );
+
+ bEnable = nV == text::VertOrientation::NONE && !bFormat;
+ if ( !bEnable )
+ {
+ aAtVertPosED.SetValue( 0, FUNIT_TWIP );
+ if(nY != LONG_MAX && bHtmlMode)
+ aAtVertPosED.SetModifyFlag();
+ }
+ else
+ {
+ if ( eId == FLY_AS_CHAR )
+ {
+ if ( nY == LONG_MAX )
+ nY = 0;
+ else
+ nY *= -1;
+ }
+ if ( nY != LONG_MAX )
+ aAtVertPosED.SetValue( aAtVertPosED.Normalize(nY), FUNIT_TWIP );
+ }
+ aAtVertPosFT.Enable( bEnable && m_bAllowVertPositioning );
+ aAtVertPosED.Enable( bEnable && m_bAllowVertPositioning );
+ UpdateExample();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFrmPage::FillPosLB(const FrmMap* _pMap,
+ const USHORT _nAlign,
+ const USHORT _nRel,
+ ListBox& _rLB )
+{
+ String sSelEntry, sOldEntry;
+ sOldEntry = _rLB.GetSelectEntry();
+
+ _rLB.Clear();
+
+ // OD 12.11.2003 #i22341# - determine all possible listbox relations for
+ // given relation for map <aVCharMap>
+ const ULONG nLBRelations = (_pMap != aVCharMap)
+ ? 0L
+ : ::lcl_GetLBRelationsForRelations( _nRel );
+
+ // Listbox fuellen
+ size_t nCount = ::lcl_GetFrmMapCount(_pMap);
+ for (size_t i = 0; _pMap && i < nCount; ++i)
+ {
+// #61359# Warum nicht von links/von innen bzw. von oben?
+// if (!bFormat || (pMap[i].eStrId != SwFPos::FROMLEFT && pMap[i].eStrId != SwFPos::FROMTOP))
+ {
+ SvxSwFramePosString::StringId eStrId = aMirrorPagesCB.IsChecked() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId;
+ eStrId = lcl_ChangeResIdToVerticalOrRTL(eStrId, bIsVerticalFrame, bIsInRightToLeft);
+ String sEntry(aFramePosString.GetString(eStrId));
+ if (_rLB.GetEntryPos(sEntry) == LISTBOX_ENTRY_NOTFOUND)
+ {
+ // bei zeichengebundenen Rahmen keine doppelten Eintraege einfuegen
+ _rLB.InsertEntry(sEntry);
+ }
+ // OD 12.11.2003 #i22341# - add condition to handle map <aVCharMap>
+ // that is ambigous in the alignment.
+ if ( _pMap[i].nAlign == _nAlign &&
+ ( !(_pMap == aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) )
+ {
+ sSelEntry = sEntry;
+ }
+ }
+ }
+
+ _rLB.SelectEntry(sSelEntry);
+ if (!_rLB.GetSelectEntryCount())
+ _rLB.SelectEntry(sOldEntry);
+
+ if (!_rLB.GetSelectEntryCount())
+ _rLB.SelectEntryPos(0);
+
+ PosHdl(&_rLB);
+
+ return GetMapPos(_pMap, _rLB);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+ULONG SwFrmPage::FillRelLB( const FrmMap* _pMap,
+ const USHORT _nLBSelPos,
+ const USHORT _nAlign,
+ USHORT _nRel,
+ ListBox& _rLB,
+ FixedText& _rFT )
+{
+ String sSelEntry;
+ ULONG nLBRelations = 0;
+ size_t nMapCount = ::lcl_GetFrmMapCount(_pMap);
+
+ _rLB.Clear();
+
+ if (_nLBSelPos < nMapCount)
+ {
+ if (_pMap == aVAsCharHtmlMap || _pMap == aVAsCharMap)
+ {
+ String sOldEntry(_rLB.GetSelectEntry());
+ USHORT nRelCount = sizeof(aAsCharRelationMap) / sizeof(RelationMap);
+ SvxSwFramePosString::StringId eStrId = _pMap[_nLBSelPos].eStrId;
+
+ for (size_t nMapPos = 0; nMapPos < nMapCount; nMapPos++)
+ {
+ if (_pMap[nMapPos].eStrId == eStrId)
+ {
+ nLBRelations = _pMap[nMapPos].nLBRelations;
+ for (USHORT nRelPos = 0; nRelPos < nRelCount; nRelPos++)
+ {
+ if (nLBRelations & aAsCharRelationMap[nRelPos].nLBRelation)
+ {
+ SvxSwFramePosString::StringId sStrId1 = aAsCharRelationMap[nRelPos].eStrId;
+
+ sStrId1 = lcl_ChangeResIdToVerticalOrRTL(sStrId1, bIsVerticalFrame, bIsInRightToLeft);
+ String sEntry = aFramePosString.GetString(sStrId1);
+ USHORT nPos = _rLB.InsertEntry(sEntry);
+ _rLB.SetEntryData(nPos, &aAsCharRelationMap[nRelPos]);
+ if (_pMap[nMapPos].nAlign == _nAlign)
+ sSelEntry = sEntry;
+ break;
+ }
+ }
+ }
+ }
+ if (sSelEntry.Len())
+ _rLB.SelectEntry(sSelEntry);
+ else
+ {
+ _rLB.SelectEntry(sOldEntry);
+
+ if (!_rLB.GetSelectEntryCount())
+ {
+ for (USHORT i = 0; i < _rLB.GetEntryCount(); i++)
+ {
+ RelationMap *pEntry = (RelationMap *)_rLB.GetEntryData(i);
+ if (pEntry->nLBRelation == LB_REL_CHAR) // Default
+ {
+ _rLB.SelectEntryPos(i);
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ USHORT nRelCount = sizeof(aRelationMap) / sizeof(RelationMap);
+
+ // OD 14.11.2003 #i22341# - special handling for map <aVCharMap>,
+ // because its ambigous in its <eStrId>/<eMirrorStrId>.
+ if ( _pMap == aVCharMap )
+ {
+ nLBRelations = ::lcl_GetLBRelationsForStrID( _pMap,
+ ( aMirrorPagesCB.IsChecked()
+ ? _pMap[_nLBSelPos].eMirrorStrId
+ : _pMap[_nLBSelPos].eStrId),
+ aMirrorPagesCB.IsChecked() );
+ }
+ else
+ {
+ nLBRelations = _pMap[_nLBSelPos].nLBRelations;
+ }
+
+ for (ULONG nBit = 1; nBit < 0x80000000; nBit <<= 1)
+ {
+ if (nLBRelations & nBit)
+ {
+ for (USHORT nRelPos = 0; nRelPos < nRelCount; nRelPos++)
+ {
+ if (aRelationMap[nRelPos].nLBRelation == nBit)
+ {
+ SvxSwFramePosString::StringId eStrId1 = aMirrorPagesCB.IsChecked() ?
+ aRelationMap[nRelPos].eMirrorStrId : aRelationMap[nRelPos].eStrId;
+ eStrId1 = lcl_ChangeResIdToVerticalOrRTL(eStrId1, bIsVerticalFrame, bIsInRightToLeft);
+ String sEntry = aFramePosString.GetString(eStrId1);
+ USHORT nPos = _rLB.InsertEntry(sEntry);
+ _rLB.SetEntryData(nPos, &aRelationMap[nRelPos]);
+ if (!sSelEntry.Len() && aRelationMap[nRelPos].nRelation == _nRel)
+ sSelEntry = sEntry;
+ }
+ }
+ }
+ }
+ if (sSelEntry.Len())
+ _rLB.SelectEntry(sSelEntry);
+ else
+ {
+ // Warscheinlich Ankerwechsel. Daher aehnliche Relation suchen
+ switch (_nRel)
+ {
+ case text::RelOrientation::FRAME: _nRel = text::RelOrientation::PAGE_FRAME; break;
+ case text::RelOrientation::PRINT_AREA: _nRel = text::RelOrientation::PAGE_PRINT_AREA; break;
+ case text::RelOrientation::PAGE_LEFT: _nRel = text::RelOrientation::FRAME_LEFT; break;
+ case text::RelOrientation::PAGE_RIGHT: _nRel = text::RelOrientation::FRAME_RIGHT; break;
+ case text::RelOrientation::FRAME_LEFT: _nRel = text::RelOrientation::PAGE_LEFT; break;
+ case text::RelOrientation::FRAME_RIGHT: _nRel = text::RelOrientation::PAGE_RIGHT; break;
+ case text::RelOrientation::PAGE_FRAME: _nRel = text::RelOrientation::FRAME; break;
+ case text::RelOrientation::PAGE_PRINT_AREA: _nRel = text::RelOrientation::PRINT_AREA; break;
+
+ default:
+ if (_rLB.GetEntryCount())
+ {
+ RelationMap *pEntry = (RelationMap *)_rLB.GetEntryData(_rLB.GetEntryCount() - 1);
+ _nRel = pEntry->nRelation;
+ }
+ break;
+ }
+
+ for (USHORT i = 0; i < _rLB.GetEntryCount(); i++)
+ {
+ RelationMap *pEntry = (RelationMap *)_rLB.GetEntryData(i);
+ if (pEntry->nRelation == _nRel)
+ {
+ _rLB.SelectEntryPos(i);
+ break;
+ }
+ }
+
+ if (!_rLB.GetSelectEntryCount())
+ _rLB.SelectEntryPos(0);
+ }
+ }
+ }
+
+ const bool bEnable = _rLB.GetEntryCount() != 0
+ && (&_rLB != &aVertRelationLB || m_bAllowVertPositioning);
+ _rLB.Enable( bEnable );
+ _rFT.Enable( bEnable );
+
+ RelHdl(&_rLB);
+
+ return nLBRelations;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+short SwFrmPage::GetRelation(FrmMap * /*pMap*/, ListBox &rRelationLB)
+{
+ short nRel = 0;
+ USHORT nPos = rRelationLB.GetSelectEntryPos();
+
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ RelationMap *pEntry = (RelationMap *)rRelationLB.GetEntryData(nPos);
+ nRel = pEntry->nRelation;
+ }
+
+ return nRel;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+short SwFrmPage::GetAlignment(FrmMap *pMap, USHORT nMapPos,
+ ListBox &/*rAlignLB*/, ListBox &rRelationLB)
+{
+ short nAlign = 0;
+
+ // OD 14.11.2003 #i22341# - special handling also for map <aVCharMap>,
+ // because it contains ambigous items for alignment
+ if ( pMap == aVAsCharHtmlMap || pMap == aVAsCharMap ||
+ pMap == aVCharMap )
+ {
+ if (rRelationLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND)
+ {
+ ULONG nRel = ((RelationMap *)rRelationLB.GetEntryData(rRelationLB.GetSelectEntryPos()))->nLBRelation;
+ size_t nMapCount = ::lcl_GetFrmMapCount(pMap);
+ SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId;
+
+ for (size_t i = 0; i < nMapCount; i++)
+ {
+ if (pMap[i].eStrId == eStrId)
+ {
+ ULONG nLBRelations = pMap[i].nLBRelations;
+ if (nLBRelations & nRel)
+ {
+ nAlign = pMap[i].nAlign;
+ break;
+ }
+ }
+ }
+ }
+ }
+ else if (pMap)
+ nAlign = pMap[nMapPos].nAlign;
+
+ return nAlign;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwFrmPage::GetMapPos( const FrmMap *pMap, ListBox &rAlignLB )
+{
+ USHORT nMapPos = 0;
+ USHORT nLBSelPos = rAlignLB.GetSelectEntryPos();
+
+ if (nLBSelPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap)
+ {
+ size_t nMapCount = ::lcl_GetFrmMapCount(pMap);
+ String sSelEntry(rAlignLB.GetSelectEntry());
+
+ for (size_t i = 0; i < nMapCount; i++)
+ {
+ SvxSwFramePosString::StringId eResId = pMap[i].eStrId;
+
+ String sEntry = aFramePosString.GetString(eResId);
+ sEntry = MnemonicGenerator::EraseAllMnemonicChars( sEntry );
+
+ if (sEntry == sSelEntry)
+ {
+ nMapPos = static_cast< USHORT >(i);
+ break;
+ }
+ }
+ }
+ else
+ nMapPos = nLBSelPos;
+ }
+
+ return nMapPos;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+RndStdIds SwFrmPage::GetAnchor()
+{
+ RndStdIds nRet = FLY_AT_PAGE;
+ if(aAnchorAtParaRB.IsChecked())
+ {
+ nRet = FLY_AT_PARA;
+ }
+ else if(aAnchorAtCharRB.IsChecked())
+ {
+ nRet = FLY_AT_CHAR;
+ }
+ else if(aAnchorAsCharRB.IsChecked())
+ {
+ nRet = FLY_AS_CHAR;
+ }
+ else if(aAnchorAtFrameRB.IsChecked())
+ {
+ nRet = FLY_AT_FLY;
+ }
+ return nRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bsp - Update
+ --------------------------------------------------------------------*/
+
+void SwFrmPage::ActivatePage(const SfxItemSet& rSet)
+{
+ bNoModifyHdl = TRUE;
+ Init(rSet);
+ bNoModifyHdl = FALSE;
+ //lock PercentFields
+ aWidthED.LockAutoCalculation(sal_True);
+ aHeightED.LockAutoCalculation(sal_True);
+ RangeModifyHdl(&aWidthED); // Alle Maximalwerte initial setzen
+ aHeightED.LockAutoCalculation(sal_False);
+ aWidthED.LockAutoCalculation(sal_False);
+ aFollowTextFlowCB.SaveValue();
+}
+
+int SwFrmPage::DeactivatePage(SfxItemSet * _pSet)
+{
+ if ( _pSet )
+ {
+ FillItemSet( *_pSet );
+
+ //FillItemSet setzt den Anker nicht in den Set, wenn er mit dem
+ //Original uebereinstimmt. Fuer die anderen Pages brauchen wir aber
+ //den aktuellen Anker.
+ SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell()
+ : ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell();
+ RndStdIds eAnchorId = (RndStdIds)GetAnchor();
+ SwFmtAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
+ _pSet->Put( aAnc );
+ }
+
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Links/rechts mit Innen/aussen tauschen
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFrmPage, MirrorHdl, CheckBox *, EMPTYARG )
+{
+ RndStdIds eId = GetAnchor();
+ InitPos( eId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX);
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFrmPage, RelSizeClickHdl, CheckBox *, pBtn )
+{
+ if (pBtn == &aRelWidthCB)
+ {
+ aWidthED.ShowPercent(pBtn->IsChecked());
+ if(pBtn->IsChecked())
+ aWidthED.MetricField::SetMax(MAX_PERCENT_WIDTH);
+ }
+ else // pBtn == &aRelHeightCB
+ {
+ aHeightED.ShowPercent(pBtn->IsChecked());
+ if(pBtn->IsChecked())
+ aHeightED.MetricField::SetMax(MAX_PERCENT_HEIGHT);
+ }
+
+ if (pBtn) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde
+ RangeModifyHdl(&aWidthED); // Werte wieder korrigieren
+
+ if (pBtn == &aRelWidthCB)
+ ModifyHdl(&aWidthED);
+ else // pBtn == &aRelHeightCB
+ ModifyHdl(&aHeightED);
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bereichspruefung
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFrmPage, RangeModifyHdl, Edit *, EMPTYARG )
+{
+ if (bNoModifyHdl)
+ return 0;
+
+ SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell()
+ :((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell();
+ ASSERT(pSh , "shell not found");
+ SwFlyFrmAttrMgr aMgr( bNew, pSh, (const SwAttrSet&)GetItemSet() );
+ SvxSwFrameValidation aVal;
+
+ aVal.nAnchorType = static_cast< USHORT >(GetAnchor());
+ aVal.bAutoHeight = aAutoHeightCB.IsChecked();
+ aVal.bAutoWidth = aAutoWidthCB.IsChecked();
+ aVal.bMirror = aMirrorPagesCB.IsChecked();
+ // OD 18.09.2003 #i18732#
+ aVal.bFollowTextFlow = aFollowTextFlowCB.IsChecked();
+
+ if ( pHMap )
+ {
+ // Ausrichtung Horizontal
+ USHORT nMapPos = GetMapPos(pHMap, aHorizontalDLB);
+ short nAlign = GetAlignment(pHMap, nMapPos, aHorizontalDLB, aHoriRelationLB);
+ short nRel = GetRelation(pHMap, aHoriRelationLB);
+
+ aVal.nHoriOrient = nAlign;
+ aVal.nHRelOrient = nRel;
+ }
+ else
+ aVal.nHoriOrient = text::HoriOrientation::NONE;
+
+ if ( pVMap )
+ {
+ // Ausrichtung Vertikal
+ USHORT nMapPos = GetMapPos(pVMap, aVerticalDLB);
+ short nAlign = GetAlignment(pVMap, nMapPos, aVerticalDLB, aVertRelationLB);
+ short nRel = GetRelation(pVMap, aVertRelationLB);
+
+ aVal.nVertOrient = nAlign;
+ aVal.nVRelOrient = nRel;
+ }
+ else
+ aVal.nVertOrient = text::VertOrientation::NONE;
+
+ const long nAtHorzPosVal = static_cast< long >(
+ aAtHorzPosED.Denormalize(aAtHorzPosED.GetValue(FUNIT_TWIP)) );
+ const long nAtVertPosVal = static_cast< long >(
+ aAtVertPosED.Denormalize(aAtVertPosED.GetValue(FUNIT_TWIP)) );
+
+ aVal.nHPos = nAtHorzPosVal;
+ aVal.nVPos = nAtVertPosVal;
+
+ aMgr.ValidateMetrics(aVal, mpToCharCntntPos, TRUE); // Einmal, um Referenzwerte fuer prozentuale Werte zu erhalten
+
+ // Referenzwerte fuer fuer Prozentwerte setzen (100%) ...
+ aWidthED.SetRefValue(aVal.aPercentSize.Width());
+ aHeightED.SetRefValue(aVal.aPercentSize.Height());
+
+ // ... und damit Breite und Hoehe korrekt umrechnen
+ SwTwips nWidth = static_cast< SwTwips >(aWidthED. DenormalizePercent(aWidthED.GetValue(FUNIT_TWIP)));
+ SwTwips nHeight = static_cast< SwTwips >(aHeightED.DenormalizePercent(aHeightED.GetValue(FUNIT_TWIP)));
+ aVal.nWidth = nWidth;
+ aVal.nHeight = nHeight;
+
+ aMgr.ValidateMetrics(aVal, mpToCharCntntPos); // Nochmal um mit korrekter Breite und Hoehe alle restlichen Werte zu ermitteln
+
+ // alle Spalten muessen passen
+ if(GetTabDialog()->GetExampleSet() &&
+ SFX_ITEM_DEFAULT <= GetTabDialog()->GetExampleSet()->GetItemState(RES_COL))
+ {
+ const SwFmtCol& rCol = (const SwFmtCol&)GetTabDialog()->GetExampleSet()->Get(RES_COL);
+ if ( rCol.GetColumns().Count() > 1 )
+ {
+ for ( USHORT i = 0; i < rCol.GetColumns().Count(); ++i )
+ {
+ aVal.nMinWidth += rCol.GetColumns()[i]->GetLeft() +
+ rCol.GetColumns()[i]->GetRight() +
+ MINFLY;
+ }
+ aVal.nMinWidth -= MINFLY;//einen hatten wir schon mit drin!
+ }
+ }
+
+ nWidth = aVal.nWidth;
+ nHeight = aVal.nHeight;
+
+ // Mindestbreite auch fuer Vorlage
+ aHeightED.SetMin(aHeightED.NormalizePercent(aVal.nMinHeight), FUNIT_TWIP);
+ aWidthED. SetMin(aWidthED.NormalizePercent(aVal.nMinWidth), FUNIT_TWIP);
+
+ SwTwips nMaxWidth(aVal.nMaxWidth);
+ SwTwips nMaxHeight(aVal.nMaxHeight);
+
+ if (aVal.bAutoHeight && (nDlgType == DLG_FRM_GRF || nDlgType == DLG_FRM_OLE))
+ {
+ SwTwips nTmp = Min(nWidth * nMaxHeight / Max(nHeight, 1L), nMaxHeight);
+ aWidthED.SetMax(aWidthED.NormalizePercent(nTmp), FUNIT_TWIP);
+
+ nTmp = Min(nHeight * nMaxWidth / Max(nWidth, 1L), nMaxWidth);
+ aHeightED.SetMax(aWidthED.NormalizePercent(nTmp), FUNIT_TWIP);
+ }
+ else
+ {
+ SwTwips nTmp = static_cast< SwTwips >(aHeightED.NormalizePercent(nMaxHeight));
+ aHeightED.SetMax(nTmp, FUNIT_TWIP);
+
+ nTmp = static_cast< SwTwips >(aWidthED.NormalizePercent(nMaxWidth));
+ aWidthED.SetMax(nTmp, FUNIT_TWIP);
+ }
+
+ aAtHorzPosED.SetMin(aAtHorzPosED.Normalize(aVal.nMinHPos), FUNIT_TWIP);
+ aAtHorzPosED.SetMax(aAtHorzPosED.Normalize(aVal.nMaxHPos), FUNIT_TWIP);
+ if ( aVal.nHPos != nAtHorzPosVal )
+ aAtHorzPosED.SetValue(aAtHorzPosED.Normalize(aVal.nHPos), FUNIT_TWIP);
+
+ const SwTwips nUpperOffset = (aVal.nAnchorType == FLY_AS_CHAR)
+ ? nUpperBorder : 0;
+ const SwTwips nLowerOffset = (aVal.nAnchorType == FLY_AS_CHAR)
+ ? nLowerBorder : 0;
+
+ aAtVertPosED.SetMin(aAtVertPosED.Normalize(aVal.nMinVPos + nLowerOffset + nUpperOffset), FUNIT_TWIP);
+ aAtVertPosED.SetMax(aAtVertPosED.Normalize(aVal.nMaxVPos), FUNIT_TWIP);
+ if ( aVal.nVPos != nAtVertPosVal )
+ aAtVertPosED.SetValue(aAtVertPosED.Normalize(aVal.nVPos), FUNIT_TWIP);
+
+ return 0;
+}
+
+IMPL_LINK( SwFrmPage, AnchorTypeHdl, RadioButton *, EMPTYARG )
+{
+ aMirrorPagesCB.Enable(!aAnchorAsCharRB.IsChecked());
+
+ // OD 06.11.2003 #i18732# - enable check box 'Follow text flow' for anchor
+ // type to-paragraph' and to-character
+ // OD 10.11.2003 #i22305# - enable check box 'Follow text
+ // flow' also for anchor type to-frame.
+ aFollowTextFlowCB.Enable( aAnchorAtParaRB.IsChecked() ||
+ aAnchorAtCharRB.IsChecked() ||
+ aAnchorAtFrameRB.IsChecked() );
+
+ RndStdIds eId = GetAnchor();
+
+ InitPos( eId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX);
+ RangeModifyHdl(0);
+
+ if(bHtmlMode)
+ {
+ PosHdl(&aHorizontalDLB);
+ PosHdl(&aVerticalDLB);
+ }
+
+ EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment
+ && FLY_AS_CHAR == eId) );
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFrmPage, PosHdl, ListBox *, pLB )
+{
+ BOOL bHori = pLB == &aHorizontalDLB;
+ ListBox *pRelLB = bHori ? &aHoriRelationLB : &aVertRelationLB;
+ FixedText *pRelFT = bHori ? &aHoriRelationFT : &aVertRelationFT;
+ FrmMap *pMap = bHori ? pHMap : pVMap;
+
+ USHORT nMapPos = GetMapPos(pMap, *pLB);
+ short nAlign = GetAlignment(pMap, nMapPos, *pLB, *pRelLB);
+
+ if (bHori)
+ {
+ BOOL bEnable = text::HoriOrientation::NONE == nAlign;
+ aAtHorzPosED.Enable( bEnable );
+ aAtHorzPosFT.Enable( bEnable );
+ }
+ else
+ {
+ BOOL bEnable = text::VertOrientation::NONE == nAlign && m_bAllowVertPositioning;
+ aAtVertPosED.Enable( bEnable );
+ aAtVertPosFT.Enable( bEnable );
+ }
+
+ if (pLB) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde
+ RangeModifyHdl( 0 );
+
+ USHORT nRel = 0;
+ if (pLB->GetSelectEntryCount())
+ {
+
+ if (pRelLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND)
+ nRel = ((RelationMap *)pRelLB->GetEntryData(pRelLB->GetSelectEntryPos()))->nRelation;
+
+ FillRelLB(pMap, nMapPos, nAlign, nRel, *pRelLB, *pRelFT);
+ }
+ else
+ pRelLB->Clear();
+
+ UpdateExample();
+
+ if (bHori)
+ bAtHorzPosModified = TRUE;
+ else
+ bAtVertPosModified = TRUE;
+
+ // Sonderbehandlung fuer HTML-Mode mit horz-vert-Abhaengigkeiten
+ if(bHtmlMode && nHtmlMode&HTMLMODE_SOME_ABS_POS &&
+ (FLY_AT_CHAR == GetAnchor()))
+ {
+ BOOL bSet = FALSE;
+ if(bHori)
+ {
+ // rechts ist nur unterhalb erlaubt - von links nur oben
+ // von links am Zeichen -> unterhalb
+ if((text::HoriOrientation::LEFT == nAlign || text::HoriOrientation::RIGHT == nAlign) &&
+ 0 == aVerticalDLB.GetSelectEntryPos())
+ {
+ if(text::RelOrientation::FRAME == nRel)
+ aVerticalDLB.SelectEntryPos(1);
+ else
+ aVerticalDLB.SelectEntryPos(0);
+ bSet = TRUE;
+ }
+ else if(text::HoriOrientation::LEFT == nAlign && 1 == aVerticalDLB.GetSelectEntryPos())
+ {
+ aVerticalDLB.SelectEntryPos(0);
+ bSet = TRUE;
+ }
+ else if(text::HoriOrientation::NONE == nAlign && 1 == aVerticalDLB.GetSelectEntryPos())
+ {
+ aVerticalDLB.SelectEntryPos(0);
+ bSet = TRUE;
+ }
+ if(bSet)
+ PosHdl(&aVerticalDLB);
+ }
+ else
+ {
+ if(text::VertOrientation::TOP == nAlign)
+ {
+ if(1 == aHorizontalDLB.GetSelectEntryPos())
+ {
+ aHorizontalDLB.SelectEntryPos(0);
+ bSet = TRUE;
+ }
+ aHoriRelationLB.SelectEntryPos(1);
+ }
+ else if(text::VertOrientation::CHAR_BOTTOM == nAlign)
+ {
+ if(2 == aHorizontalDLB.GetSelectEntryPos())
+ {
+ aHorizontalDLB.SelectEntryPos(0);
+ bSet = TRUE;
+ }
+ aHoriRelationLB.SelectEntryPos(0) ;
+ }
+ if(bSet)
+ PosHdl(&aHorizontalDLB);
+ }
+
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Horizontale Pos
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwFrmPage, RelHdl, ListBox *, pLB )
+{
+ BOOL bHori = pLB == &aHoriRelationLB;
+
+ UpdateExample();
+
+ if (bHori)
+ bAtHorzPosModified = TRUE;
+ else
+ bAtVertPosModified = TRUE;
+
+ if (bHtmlMode && (FLY_AT_CHAR == GetAnchor()))
+ {
+ if(bHori)
+ {
+ USHORT nRel = GetRelation(pHMap, aHoriRelationLB);
+ if(text::RelOrientation::PRINT_AREA == nRel && 0 == aVerticalDLB.GetSelectEntryPos())
+ {
+ aVerticalDLB.SelectEntryPos(1);
+ }
+ else if(text::RelOrientation::CHAR == nRel && 1 == aVerticalDLB.GetSelectEntryPos())
+ {
+ aVerticalDLB.SelectEntryPos(0);
+ }
+ }
+ }
+ if (pLB) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde
+ RangeModifyHdl(0);
+
+ return 0;
+}
+
+
+IMPL_LINK_INLINE_START( SwFrmPage, RealSizeHdl, Button *, EMPTYARG )
+{
+ aWidthED.SetUserValue( aWidthED. NormalizePercent(aGrfSize.Width() ), FUNIT_TWIP);
+ aHeightED.SetUserValue(aHeightED.NormalizePercent(aGrfSize.Height()), FUNIT_TWIP);
+ fWidthHeightRatio = aGrfSize.Height() ? double(aGrfSize.Width()) / double(aGrfSize.Height()) : 1.0;
+ UpdateExample();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwFrmPage, RealSizeHdl, Button *, EMPTYARG )
+
+
+IMPL_LINK( SwFrmPage, AutoWidthClickHdl, void*, EMPTYARG )
+{
+ if( !IsInGraficMode() )
+ HandleAutoCB( aAutoWidthCB.IsChecked(), aWidthFT, aWidthAutoFT );
+ return 0;
+}
+
+IMPL_LINK( SwFrmPage, AutoHeightClickHdl, void*, EMPTYARG )
+{
+ if( !IsInGraficMode() )
+ HandleAutoCB( aAutoHeightCB.IsChecked(), aHeightFT, aHeightAutoFT );
+ return 0;
+}
+
+IMPL_LINK( SwFrmPage, ModifyHdl, Edit *, pEdit )
+{
+ SwTwips nWidth = static_cast< SwTwips >(aWidthED.DenormalizePercent(aWidthED.GetValue(FUNIT_TWIP)));
+ SwTwips nHeight = static_cast< SwTwips >(aHeightED.DenormalizePercent(aHeightED.GetValue(FUNIT_TWIP)));
+ if ( aFixedRatioCB.IsChecked() )
+ {
+ if ( pEdit == &aWidthED )
+ {
+ nHeight = SwTwips((double)nWidth / fWidthHeightRatio);
+ aHeightED.SetPrcntValue(aHeightED.NormalizePercent(nHeight), FUNIT_TWIP);
+ }
+ else if(pEdit == &aHeightED)
+ {
+ nWidth = SwTwips((double)nHeight * fWidthHeightRatio);
+ aWidthED.SetPrcntValue(aWidthED.NormalizePercent(nWidth), FUNIT_TWIP);
+ }
+ }
+ fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0;
+ UpdateExample();
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwFrmPage::UpdateExample()
+{
+ USHORT nPos = aHorizontalDLB.GetSelectEntryPos();
+ if ( pHMap && nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ USHORT nMapPos = GetMapPos(pHMap, aHorizontalDLB);
+ short nAlign = GetAlignment(pHMap, nMapPos, aHorizontalDLB, aHoriRelationLB);
+ short nRel = GetRelation(pHMap, aHoriRelationLB);
+
+ aExampleWN.SetHAlign(nAlign);
+ aExampleWN.SetHoriRel(nRel);
+ }
+
+ nPos = aVerticalDLB.GetSelectEntryPos();
+ if ( pVMap && nPos != LISTBOX_ENTRY_NOTFOUND )
+ {
+ USHORT nMapPos = GetMapPos(pVMap, aVerticalDLB);
+ short nAlign = GetAlignment(pVMap, nMapPos, aVerticalDLB, aVertRelationLB);
+ short nRel = GetRelation(pVMap, aVertRelationLB);
+
+ aExampleWN.SetVAlign(nAlign);
+ aExampleWN.SetVertRel(nRel);
+ }
+
+ // Size
+ long nXPos = static_cast< long >(aAtHorzPosED.Denormalize(aAtHorzPosED.GetValue(FUNIT_TWIP)));
+ long nYPos = static_cast< long >(aAtVertPosED.Denormalize(aAtVertPosED.GetValue(FUNIT_TWIP)));
+ aExampleWN.SetRelPos(Point(nXPos, nYPos));
+
+ aExampleWN.SetAnchor( static_cast< USHORT >(GetAnchor()) );
+ aExampleWN.Invalidate();
+}
+
+void SwFrmPage::Init(const SfxItemSet& rSet, BOOL bReset)
+{
+ if(!bFormat)
+ {
+ SwWrtShell* pSh = ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell();
+
+ // Size
+ const BOOL bSizeFixed = pSh->IsSelObjProtected( FLYPROTECT_FIXED );
+
+ aWidthED .Enable( !bSizeFixed );
+ aHeightED.Enable( !bSizeFixed );
+
+ // size controls for math OLE objects
+ if ( DLG_FRM_OLE == nDlgType && ! bNew )
+ {
+ // disable width and height for math objects
+ const SvGlobalName& rFactNm( pSh->GetOLEObject()->getClassID() );
+
+ struct _GlobalNameId {
+ UINT32 n1;
+ USHORT n2, n3;
+ BYTE b8, b9, b10, b11, b12, b13, b14, b15;
+ } aGlbNmIds[4] = { { SO3_SM_CLASSID_60 }, { SO3_SM_CLASSID_50 },
+ { SO3_SM_CLASSID_40 }, { SO3_SM_CLASSID_30 } };
+
+ for ( int i = 0; i < 4; ++i ) {
+ const _GlobalNameId& rId = aGlbNmIds[ i ];
+
+ SvGlobalName aGlbNm( rId.n1, rId.n2, rId.n3,
+ rId.b8, rId.b9, rId.b10, rId.b11,
+ rId.b12, rId.b13, rId.b14, rId.b15 );
+
+ if( rFactNm == aGlbNm )
+ {
+ // disable size controls for math OLE objects
+ aWidthFT.Disable();
+ aWidthED.Disable();
+ aRelWidthCB.Disable();
+ aHeightFT.Disable();
+ aHeightED.Disable();
+ aRelHeightCB.Disable();
+ aFixedRatioCB.Disable();
+ aRealSizeBT.Disable();
+ break;
+ }
+ }
+
+ // TODO/LATER: get correct aspect
+ if(0 != (pSh->GetOLEObject()->getStatus( embed::Aspects::MSOLE_CONTENT ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) )
+ aRealSizeBT.Disable();
+ }
+ }
+
+ const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE);
+ sal_Int64 nWidth = aWidthED.NormalizePercent(rSize.GetWidth());
+ sal_Int64 nHeight = aHeightED.NormalizePercent(rSize.GetHeight());
+
+ if (nWidth != aWidthED.GetValue(FUNIT_TWIP))
+ {
+ if(!bReset)
+ {
+ // Wert wurde von Umlauf-Tabpage geaendert und muss
+ // mit Modify-Flag gesetzt werden
+ aWidthED.SetUserValue(nWidth, FUNIT_TWIP);
+ }
+ else
+ aWidthED.SetPrcntValue(nWidth, FUNIT_TWIP);
+ }
+
+ if (nHeight != aHeightED.GetValue(FUNIT_TWIP))
+ {
+ if (!bReset)
+ {
+ // Wert wurde von Umlauf-Tabpage geaendert und muss
+ // mit Modify-Flag gesetzt werden
+ aHeightED.SetUserValue(nHeight, FUNIT_TWIP);
+ }
+ else
+ aHeightED.SetPrcntValue(nHeight, FUNIT_TWIP);
+ }
+
+ if (!IsInGraficMode())
+ {
+ SwFrmSize eSize = rSize.GetHeightSizeType();
+ BOOL bCheck = eSize != ATT_FIX_SIZE;
+ aAutoHeightCB.Check( bCheck );
+ HandleAutoCB( bCheck, aHeightFT, aHeightAutoFT );
+ if( eSize == ATT_VAR_SIZE )
+ aHeightED.SetValue( aHeightED.GetMin(), FUNIT_NONE );
+
+ eSize = rSize.GetWidthSizeType();
+ bCheck = eSize != ATT_FIX_SIZE;
+ aAutoWidthCB.Check( bCheck );
+ HandleAutoCB( bCheck, aWidthFT, aWidthAutoFT );
+ if( eSize == ATT_VAR_SIZE )
+ aWidthED.SetValue( aWidthED.GetMin(), FUNIT_NONE );
+
+ if ( !bFormat )
+ {
+ SwWrtShell* pSh = ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell();
+ const SwFrmFmt* pFmt = pSh->GetFlyFrmFmt();
+ if( pFmt && pFmt->GetChain().GetNext() )
+ aAutoHeightCB.Enable( FALSE );
+ }
+ }
+ else
+ aAutoHeightCB.Hide();
+
+ // Umlauf-Abstand fuer zeichengebundene Rahmen organisieren
+ const SvxULSpaceItem &rUL = (const SvxULSpaceItem &)rSet.Get(RES_UL_SPACE);
+ nUpperBorder = rUL.GetUpper();
+ nLowerBorder = rUL.GetLower();
+
+ if(SFX_ITEM_SET == rSet.GetItemState(FN_KEEP_ASPECT_RATIO))
+ {
+ aFixedRatioCB.Check(((const SfxBoolItem&)rSet.Get(FN_KEEP_ASPECT_RATIO)).GetValue());
+ aFixedRatioCB.SaveValue();
+ }
+
+ // Spalten
+ SwFmtCol aCol( (const SwFmtCol&)rSet.Get(RES_COL) );
+ ::FitToActualSize( aCol, (USHORT)rSize.GetWidth() );
+
+ RndStdIds eAnchorId = (RndStdIds)GetAnchor();
+
+ if ( bNew && !bFormat )
+ InitPos(eAnchorId, USHRT_MAX, 0, USHRT_MAX, USHRT_MAX, LONG_MAX, LONG_MAX);
+ else
+ {
+ const SwFmtHoriOrient& rHori = (const SwFmtHoriOrient&)rSet.Get(RES_HORI_ORIENT);
+ const SwFmtVertOrient& rVert = (const SwFmtVertOrient&)rSet.Get(RES_VERT_ORIENT);
+ nOldH = rHori.GetHoriOrient();
+ nOldHRel = rHori.GetRelationOrient();
+ nOldV = rVert.GetVertOrient(),
+ nOldVRel = rVert.GetRelationOrient();
+
+ if (eAnchorId == FLY_AT_PAGE)
+ {
+ if (nOldHRel == text::RelOrientation::FRAME)
+ nOldHRel = text::RelOrientation::PAGE_FRAME;
+ else if (nOldHRel == text::RelOrientation::PRINT_AREA)
+ nOldHRel = text::RelOrientation::PAGE_PRINT_AREA;
+ if (nOldVRel == text::RelOrientation::FRAME)
+ nOldVRel = text::RelOrientation::PAGE_FRAME;
+ else if (nOldVRel == text::RelOrientation::PRINT_AREA)
+ nOldVRel = text::RelOrientation::PAGE_PRINT_AREA;
+ }
+
+ aMirrorPagesCB.Check(rHori.IsPosToggle());
+ aMirrorPagesCB.SaveValue();
+
+ InitPos(eAnchorId,
+ nOldH,
+ nOldHRel,
+ nOldV,
+ nOldVRel,
+ rHori.GetPos(),
+ rVert.GetPos());
+ }
+
+ // Transparent fuers Bsp
+ // Umlauf fuers Bsp
+ const SwFmtSurround& rSurround = (const SwFmtSurround&)rSet.Get(RES_SURROUND);
+ aExampleWN.SetWrap ( static_cast< USHORT >(rSurround.GetSurround()) );
+
+ if ( rSurround.GetSurround() == SURROUND_THROUGHT )
+ {
+ const SvxOpaqueItem& rOpaque = (const SvxOpaqueItem&)rSet.Get(RES_OPAQUE);
+ aExampleWN.SetTransparent(!rOpaque.GetValue());
+ }
+
+ // ggf auf Prozent umschalten
+ RangeModifyHdl(&aWidthED); // Referenzwerte setzen (fuer 100%)
+
+ if (rSize.GetWidthPercent() == 0xff || rSize.GetHeightPercent() == 0xff)
+ aFixedRatioCB.Check(TRUE);
+ if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != 0xff &&
+ !aRelWidthCB.IsChecked())
+ {
+ aRelWidthCB.Check(TRUE);
+ RelSizeClickHdl(&aRelWidthCB);
+ aWidthED.SetPrcntValue(rSize.GetWidthPercent(), FUNIT_CUSTOM);
+ }
+ if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != 0xff &&
+ !aRelHeightCB.IsChecked())
+ {
+ aRelHeightCB.Check(TRUE);
+ RelSizeClickHdl(&aRelHeightCB);
+ aHeightED.SetPrcntValue(rSize.GetHeightPercent(), FUNIT_CUSTOM);
+ }
+ aRelWidthCB.SaveValue();
+ aRelHeightCB.SaveValue();
+}
+
+USHORT* SwFrmPage::GetRanges()
+{
+ return aPageRg;
+}
+/* -----------------------------03.11.00 10:52--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwFrmPage::SetFormatUsed(BOOL bFmt)
+{
+ bFormat = bFmt;
+ if(bFormat)
+ {
+ aAnchorAtPageRB.Hide();
+ aAnchorAtParaRB.Hide();
+ aAnchorAtCharRB.Hide();
+ aAnchorAsCharRB.Hide();
+ aAnchorAtFrameRB.Hide();
+ aTypeFL.Hide();
+ aTypeSepFL.Hide();
+
+// Point aSizePos = aSizeFL.GetPosPixel();
+// Size aSizeSize = aSizeFL.GetSizePixel();
+// aSizeSize.Width() = aTypeFL.GetPosPixel().X() +
+// aTypeFL.GetSizePixel().Width() - aSizePos.X();
+// aSizeFL.SetSizePixel(aSizeSize);
+ }
+}
+
+
+void SwFrmPage::EnableVerticalPositioning( bool bEnable )
+{
+ m_bAllowVertPositioning = bEnable;
+ aVerticalFT.Enable( bEnable );
+ aVerticalDLB.Enable( bEnable );
+ aAtVertPosFT.Enable( bEnable );
+ aAtVertPosED.Enable( bEnable );
+ aVertRelationFT.Enable( bEnable );
+ aVertRelationLB.Enable( bEnable );
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwGrfExtPage::SwGrfExtPage(Window *pParent, const SfxItemSet &rSet) :
+ SfxTabPage( pParent, SW_RES(TP_GRF_EXT), rSet ),
+ aMirrorFL (this, SW_RES( FL_MIRROR )),
+ aMirrorVertBox (this, SW_RES( CB_VERT )),
+ aMirrorHorzBox (this, SW_RES( CB_HOR )),
+ aAllPagesRB (this, SW_RES( RB_MIRROR_ALL_PAGES )),
+ aLeftPagesRB (this, SW_RES( RB_MIRROR_LEFT_PAGES )),
+ aRightPagesRB (this, SW_RES( RB_MIRROR_RIGHT_PAGES )),
+ aBmpWin (this, WN_BMP, Graphic(), BitmapEx(SW_RES(BMP_EXAMPLE)), BitmapEx(SW_RES(BMP_EXAMPLE_HC)) ),
+ aConnectFL (this, SW_RES( FL_CONNECT )),
+ aConnectFT (this, SW_RES( FT_CONNECT )),
+ aConnectED (this, SW_RES( ED_CONNECT )),
+ aBrowseBT (this, SW_RES( PB_BROWSE )),
+ pGrfDlg ( 0 )
+{
+ FreeResource();
+
+ SetExchangeSupport();
+ aMirrorHorzBox.SetClickHdl( LINK(this, SwGrfExtPage, MirrorHdl));
+ aMirrorVertBox.SetClickHdl( LINK(this, SwGrfExtPage, MirrorHdl));
+ aBrowseBT.SetClickHdl ( LINK(this, SwGrfExtPage, BrowseHdl));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwGrfExtPage::~SwGrfExtPage()
+{
+ delete pGrfDlg;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxTabPage* SwGrfExtPage::Create( Window *pParent, const SfxItemSet &rSet )
+{
+ return new SwGrfExtPage( pParent, rSet );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwGrfExtPage::Reset(const SfxItemSet &rSet)
+{
+ const SfxPoolItem* pItem;
+ USHORT nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current());
+ bHtmlMode = nHtmlMode & HTMLMODE_ON ? TRUE : FALSE;
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_GRF_CONNECT, TRUE, &pItem)
+ && ((const SfxBoolItem *)pItem)->GetValue() )
+ {
+ aBrowseBT.Enable();
+ aConnectED.SetReadOnly(FALSE);
+ }
+
+ ActivatePage(rSet);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwGrfExtPage::ActivatePage(const SfxItemSet& rSet)
+{
+ const SvxProtectItem& rProt = (const SvxProtectItem& )rSet.Get(RES_PROTECT);
+ BOOL bProtCntnt = rProt.IsCntntProtected();
+
+ const SfxPoolItem* pItem = 0;
+ BOOL bEnable = FALSE;
+ BOOL bEnableMirrorRB = FALSE;
+
+ SfxItemState eState = rSet.GetItemState(RES_GRFATR_MIRRORGRF, TRUE, &pItem);
+ if( SFX_ITEM_UNKNOWN != eState && !bProtCntnt && !bHtmlMode )
+ {
+ if( SFX_ITEM_SET != eState )
+ pItem = &rSet.Get( RES_GRFATR_MIRRORGRF );
+
+ bEnable = TRUE;
+
+ MirrorGraph eMirror = static_cast< MirrorGraph >(((const SwMirrorGrf* )pItem)->GetValue());
+ switch( eMirror )
+ {
+ case RES_MIRROR_GRAPH_DONT: break;
+ case RES_MIRROR_GRAPH_VERT: aMirrorHorzBox.Check(TRUE); break;
+ case RES_MIRROR_GRAPH_HOR: aMirrorVertBox.Check(TRUE); break;
+ case RES_MIRROR_GRAPH_BOTH: aMirrorHorzBox.Check(TRUE);
+ aMirrorVertBox.Check(TRUE);
+ break;
+ default:
+ ;
+ }
+
+ USHORT nPos = ((const SwMirrorGrf* )pItem)->IsGrfToggle() ? 1 : 0;
+ nPos += (eMirror == RES_MIRROR_GRAPH_VERT || eMirror == RES_MIRROR_GRAPH_BOTH)
+ ? 2 : 0;
+
+ bEnableMirrorRB = nPos != 0;
+
+ switch (nPos)
+ {
+ case 1: // Auf linken bzw geraden Seiten spiegeln
+ aLeftPagesRB.Check();
+ aMirrorHorzBox.Check(TRUE);
+ break;
+ case 2: // Auf allen Seiten spiegeln
+ aAllPagesRB.Check();
+ break;
+ case 3: // Auf rechten bzw ungeraden Seiten spiegeln
+ aRightPagesRB.Check();
+ break;
+ default:
+ aAllPagesRB.Check();
+ break;
+ }
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, FALSE, &pItem ) )
+ {
+ const SvxBrushItem& rBrush = *(SvxBrushItem*)pItem;
+ if( rBrush.GetGraphicLink() )
+ {
+ aGrfName = aNewGrfName = *rBrush.GetGraphicLink();
+ aConnectED.SetText( aNewGrfName );
+ }
+ const Graphic* pGrf = rBrush.GetGraphic();
+ if( pGrf )
+ aBmpWin.SetGraphic( *pGrf );
+ }
+
+ aAllPagesRB .Enable(bEnableMirrorRB);
+ aLeftPagesRB.Enable(bEnableMirrorRB);
+ aRightPagesRB.Enable(bEnableMirrorRB);
+ aMirrorHorzBox.Enable(bEnable);
+ aMirrorVertBox.Enable(bEnable);
+ aMirrorFL.Enable(bEnable);
+
+ aAllPagesRB .SaveValue();
+ aLeftPagesRB.SaveValue();
+ aRightPagesRB.SaveValue();
+ aMirrorHorzBox.SaveValue();
+ aMirrorVertBox.SaveValue();
+
+ aBmpWin.MirrorHorz( aMirrorVertBox.IsChecked() );
+ aBmpWin.MirrorVert( aMirrorHorzBox.IsChecked() );
+ aBmpWin.Invalidate();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL SwGrfExtPage::FillItemSet( SfxItemSet &rSet )
+{
+ BOOL bModified = FALSE;
+ if ( aMirrorHorzBox.GetSavedValue() != aMirrorHorzBox.IsChecked() ||
+ aMirrorVertBox.GetSavedValue() != aMirrorVertBox.IsChecked() ||
+ aAllPagesRB .GetSavedValue() != aAllPagesRB .IsChecked() ||
+ aLeftPagesRB.GetSavedValue() != aLeftPagesRB.IsChecked() ||
+ aRightPagesRB.GetSavedValue() != aRightPagesRB.IsChecked())
+ {
+ bModified = TRUE;
+
+ BOOL bHori = FALSE;
+
+ if (aMirrorHorzBox.IsChecked() &&
+ !aLeftPagesRB.IsChecked())
+ bHori = TRUE;
+
+ MirrorGraph eMirror;
+ eMirror = aMirrorVertBox.IsChecked() && bHori ?
+ RES_MIRROR_GRAPH_BOTH : bHori ?
+ RES_MIRROR_GRAPH_VERT : aMirrorVertBox.IsChecked() ?
+ RES_MIRROR_GRAPH_HOR : RES_MIRROR_GRAPH_DONT;
+
+ BOOL bMirror = !aAllPagesRB.IsChecked();
+ SwMirrorGrf aMirror( eMirror );
+ aMirror.SetGrfToggle(bMirror );
+ rSet.Put( aMirror );
+ }
+
+ if( aGrfName != aNewGrfName || aConnectED.IsModified() )
+ {
+ bModified = TRUE;
+ aGrfName = aConnectED.GetText();
+ rSet.Put( SvxBrushItem( aGrfName, aFilterName, GPOS_LT,
+ SID_ATTR_GRAF_GRAPHIC ));
+ }
+ return bModified;
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+int SwGrfExtPage::DeactivatePage(SfxItemSet *_pSet)
+{
+ if( _pSet )
+ FillItemSet( *_pSet );
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwGrfExtPage, BrowseHdl, Button *, EMPTYARG )
+{
+ if(!pGrfDlg)
+ {
+ pGrfDlg = new FileDialogHelper( SFXWB_GRAPHIC );
+ pGrfDlg->SetTitle(SW_RESSTR(STR_EDIT_GRF ));
+ }
+ pGrfDlg->SetDisplayDirectory( aConnectED.GetText() );
+ uno::Reference < ui::dialogs::XFilePicker > xFP = pGrfDlg->GetFilePicker();
+ uno::Reference < ui::dialogs::XFilePickerControlAccess > xCtrlAcc(xFP, uno::UNO_QUERY);
+ sal_Bool bTrue = sal_True;
+ uno::Any aVal(&bTrue, ::getBooleanCppuType());
+ xCtrlAcc->setValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, aVal);
+
+ if ( pGrfDlg->Execute() == ERRCODE_NONE )
+ { // ausgewaehlten Filter merken
+ aFilterName = pGrfDlg->GetCurrentFilter();
+ aNewGrfName = INetURLObject::decode( pGrfDlg->GetPath(),
+ INET_HEX_ESCAPE,
+ INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 );
+ aConnectED.SetModifyFlag();
+ aConnectED.SetText( aNewGrfName );
+ //Spiegeln zuruecksetzen, da u. U. eine Bitmap
+ //gegen eine andere Art von Grafik ausgetauscht worden ist,
+ //die nicht gespiegelt werden kann.
+ aMirrorVertBox.Check(FALSE);
+ aMirrorHorzBox.Check(FALSE);
+ aAllPagesRB .Enable(FALSE);
+ aLeftPagesRB.Enable(FALSE);
+ aRightPagesRB.Enable(FALSE);
+ aBmpWin.MirrorHorz(FALSE);
+ aBmpWin.MirrorVert(FALSE);
+
+ Graphic aGraphic;
+ GraphicFilter::LoadGraphic( pGrfDlg->GetPath(), aEmptyStr, aGraphic );
+ aBmpWin.SetGraphic(aGraphic);
+
+ BOOL bEnable = GRAPHIC_BITMAP == aGraphic.GetType() ||
+ GRAPHIC_GDIMETAFILE == aGraphic.GetType();
+ aMirrorVertBox.Enable(bEnable);
+ aMirrorHorzBox.Enable(bEnable);
+ aAllPagesRB .Enable(bEnable);
+ aLeftPagesRB.Enable(bEnable);
+ aRightPagesRB.Enable(bEnable);
+ }
+ return 0;
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwGrfExtPage, MirrorHdl, CheckBox *, EMPTYARG )
+{
+ BOOL bEnable = aMirrorHorzBox.IsChecked();
+
+ aBmpWin.MirrorHorz( aMirrorVertBox.IsChecked() );
+ aBmpWin.MirrorVert( bEnable );
+
+ aAllPagesRB .Enable(bEnable);
+ aLeftPagesRB.Enable(bEnable);
+ aRightPagesRB.Enable(bEnable);
+
+ if (!aAllPagesRB.IsChecked() && !aLeftPagesRB.IsChecked() && !aRightPagesRB.IsChecked())
+ aAllPagesRB.Check();
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: BeispielWindow
+ --------------------------------------------------------------------*/
+
+BmpWindow::BmpWindow( Window* pPar, USHORT nId,
+ const Graphic& rGraphic, const BitmapEx& rBmp, const BitmapEx& rBmpHC ) :
+ Window(pPar, SW_RES(nId)),
+ aGraphic(rGraphic),
+ aBmp(rBmp),
+ aBmpHC(rBmpHC),
+ bHorz(FALSE),
+ bVert(FALSE),
+ bGraphic(FALSE),
+ bLeftAlign(FALSE)
+{
+ SetBackground();
+}
+
+void BmpWindow::Paint( const Rectangle& )
+{
+ Point aPntPos;
+ Size aPntSz( GetSizePixel() );
+ Size aGrfSize;
+ if(bGraphic)
+ aGrfSize = ::GetGraphicSizeTwip(aGraphic, this);
+ //it should show the default bitmap also if no graphic can be found
+ if(!aGrfSize.Width() && !aGrfSize.Height())
+ aGrfSize = PixelToLogic(aBmp.GetSizePixel());
+
+ long nRelGrf = aGrfSize.Width() * 100L / aGrfSize.Height();
+ long nRelWin = aPntSz.Width() * 100L / aPntSz.Height();
+ if(nRelGrf < nRelWin)
+ {
+ const long nWidth = aPntSz.Width();
+ aPntSz.Width() = aPntSz.Height() * nRelGrf /100;
+ if(!bLeftAlign)
+ aPntPos.X() += nWidth - aPntSz.Width() ;
+ }
+
+ if ( bHorz )
+ {
+ aPntPos.Y() += aPntSz.Height();
+ aPntPos.Y() --;
+ aPntSz.Height() *= -1;
+ }
+ if ( bVert )
+ {
+ aPntPos.X() += aPntSz.Width();
+ aPntPos.X()--;
+ aPntSz.Width() *= -1;
+ }
+
+ if ( bGraphic )
+ aGraphic.Draw( this, aPntPos, aPntSz );
+ else
+ {
+ bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
+ DrawBitmapEx( aPntPos, aPntSz, bHC ? aBmpHC : aBmp );
+ }
+}
+
+BmpWindow::~BmpWindow()
+{
+}
+
+void BmpWindow::SetGraphic(const Graphic& rGrf)
+{
+ aGraphic = rGrf;
+ Size aGrfSize = ::GetGraphicSizeTwip(aGraphic, this);
+ bGraphic = aGrfSize.Width() && aGrfSize.Height();
+ Invalidate();
+}
+
+/***************************************************************************
+ Beschreibung: URL und ImageMap an Rahmen einstellen
+***************************************************************************/
+
+
+SwFrmURLPage::SwFrmURLPage( Window *pParent, const SfxItemSet &rSet ) :
+ SfxTabPage(pParent, SW_RES(TP_FRM_URL), rSet),
+ aHyperLinkFL (this, SW_RES( FL_HYPERLINK )),
+ aURLFT (this, SW_RES( FT_URL )),
+ aURLED (this, SW_RES( ED_URL )),
+ aSearchPB (this, SW_RES( PB_SEARCH )),
+ aNameFT (this, SW_RES( FT_NAME )),
+ aNameED (this, SW_RES( ED_NAME )),
+ aFrameFT (this, SW_RES( FT_FRAME )),
+ aFrameCB (this, SW_RES( CB_FRAME )),
+
+ aImageFL (this, SW_RES( FL_IMAGE )),
+ aServerCB (this, SW_RES( CB_SERVER )),
+ aClientCB (this, SW_RES( CB_CLIENT ))
+{
+ FreeResource();
+ aSearchPB.SetClickHdl(LINK(this, SwFrmURLPage, InsertFileHdl));
+}
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+SwFrmURLPage::~SwFrmURLPage()
+{
+}
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+void SwFrmURLPage::Reset( const SfxItemSet &rSet )
+{
+ const SfxPoolItem* pItem;
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_DOCFRAME, TRUE, &pItem))
+ {
+ TargetList* pList = new TargetList;
+ ((const SfxFrameItem*)pItem)->GetFrame()->GetTargetList(*pList);
+ USHORT nCount = (USHORT)pList->Count();
+ if( nCount )
+ {
+ USHORT i;
+ for ( i = 0; i < nCount; i++ )
+ {
+ aFrameCB.InsertEntry(*pList->GetObject(i));
+ }
+ for ( i = nCount; i; i-- )
+ {
+ delete pList->GetObject( i - 1 );
+ }
+ }
+ delete pList;
+ }
+
+ if ( SFX_ITEM_SET == rSet.GetItemState( RES_URL, TRUE, &pItem ) )
+ {
+ const SwFmtURL* pFmtURL = (const SwFmtURL*)pItem;
+ aURLED.SetText( INetURLObject::decode( pFmtURL->GetURL(),
+ INET_HEX_ESCAPE,
+ INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 ));
+ aNameED.SetText( pFmtURL->GetName());
+
+ aClientCB.Enable( pFmtURL->GetMap() != 0 );
+ aClientCB.Check ( pFmtURL->GetMap() != 0 );
+ aServerCB.Check ( pFmtURL->IsServerMap() );
+
+ aFrameCB.SetText(pFmtURL->GetTargetFrameName());
+ aFrameCB.SaveValue();
+ }
+ else
+ aClientCB.Enable( FALSE );
+
+ aServerCB.SaveValue();
+ aClientCB.SaveValue();
+}
+
+
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+BOOL SwFrmURLPage::FillItemSet(SfxItemSet &rSet)
+{
+ BOOL bModified = FALSE;
+ const SwFmtURL* pOldURL = (SwFmtURL*)GetOldItem(rSet, RES_URL);
+ SwFmtURL* pFmtURL;
+ if(pOldURL)
+ pFmtURL = (SwFmtURL*)pOldURL->Clone();
+ else
+ pFmtURL = new SwFmtURL();
+
+ {
+ String sText = aURLED.GetText();
+
+ if( pFmtURL->GetURL() != sText ||
+ pFmtURL->GetName() != aNameED.GetText() ||
+ aServerCB.IsChecked() != pFmtURL->IsServerMap() )
+ {
+ pFmtURL->SetURL( sText, aServerCB.IsChecked() );
+ pFmtURL->SetName( aNameED.GetText() );
+ bModified = TRUE;
+ }
+ }
+
+ if(!aClientCB.IsChecked() && pFmtURL->GetMap() != 0)
+ {
+ pFmtURL->SetMap(0);
+ bModified = TRUE;
+ }
+
+ if(pFmtURL->GetTargetFrameName() != aFrameCB.GetText())
+ {
+ pFmtURL->SetTargetFrameName(aFrameCB.GetText());
+ bModified = TRUE;
+ }
+ rSet.Put(*pFmtURL);
+ delete pFmtURL;
+ return bModified;
+}
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+SfxTabPage* SwFrmURLPage::Create(Window *pParent, const SfxItemSet &rSet)
+{
+ return new SwFrmURLPage( pParent, rSet );
+}
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+IMPL_LINK( SwFrmURLPage, InsertFileHdl, PushButton *, EMPTYARG )
+{
+ FileDialogHelper aDlgHelper( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 );
+ uno::Reference < ui::dialogs::XFilePicker > xFP = aDlgHelper.GetFilePicker();
+
+ try
+ {
+ String sTemp(aURLED.GetText());
+ if(sTemp.Len())
+ xFP->setDisplayDirectory(sTemp);
+ }
+ catch( const uno::Exception& rEx )
+ {
+ (void) rEx;
+ }
+ if( aDlgHelper.Execute() == ERRCODE_NONE )
+ {
+ aURLED.SetText( xFP->getFiles().getConstArray()[0] );
+ }
+
+ return 0;
+}
+
+/* -----------------------------03.11.00 10:56--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void lcl_Move(Window& rWin, sal_Int32 nDiff)
+{
+ Point aPos(rWin.GetPosPixel());
+ aPos.Y() -= nDiff;
+ rWin.SetPosPixel(aPos);
+}
+
+/*-----------------13.11.96 13.15-------------------
+
+--------------------------------------------------*/
+
+SwFrmAddPage::SwFrmAddPage(Window *pParent, const SfxItemSet &rSet ) :
+ SfxTabPage(pParent, SW_RES(TP_FRM_ADD), rSet),
+
+ aNameFT (this, SW_RES(FT_NAME)),
+ aNameED (this, SW_RES(ED_NAME)),
+ aAltNameFT (this, SW_RES(FT_ALT_NAME)),
+ aAltNameED (this, SW_RES(ED_ALT_NAME)),
+ aPrevFT (this, SW_RES(FT_PREV)),
+ aPrevLB (this, SW_RES(LB_PREV)),
+ aNextFT (this, SW_RES(FT_NEXT)),
+ aNextLB (this, SW_RES(LB_NEXT)),
+ aNamesFL (this, SW_RES(FL_NAME)),
+
+ aProtectContentCB (this, SW_RES(CB_PROTECT_CONTENT)),
+ aProtectFrameCB (this, SW_RES(CB_PROTECT_FRAME)),
+ aProtectSizeCB (this, SW_RES(CB_PROTECT_SIZE)),
+ aProtectFL (this, SW_RES(FL_PROTECT)),
+
+ aEditInReadonlyCB (this, SW_RES(CB_EDIT_IN_READONLY)),
+ aPrintFrameCB (this, SW_RES(CB_PRINT_FRAME)),
+ aTextFlowFT (this, SW_RES(FT_TEXTFLOW)),
+ aTextFlowLB (this, SW_RES(LB_TEXTFLOW)),
+
+ aExtFL (this, SW_RES(FL_EXT)),
+
+ pWrtSh(0),
+
+ nDlgType(0),
+ bHtmlMode(sal_False),
+ bFormat(sal_False),
+ bNew(sal_False)
+{
+ FreeResource();
+
+}
+
+/*-----------------13.11.96 13.15-------------------
+
+--------------------------------------------------*/
+
+SwFrmAddPage::~SwFrmAddPage()
+{
+}
+
+/*-----------------13.11.96 13.15-------------------
+
+--------------------------------------------------*/
+
+SfxTabPage* SwFrmAddPage::Create(Window *pParent, const SfxItemSet &rSet)
+{
+ return new SwFrmAddPage(pParent, rSet);
+}
+
+/*-----------------13.11.96 13.14-------------------
+
+--------------------------------------------------*/
+
+void SwFrmAddPage::Reset(const SfxItemSet &rSet )
+{
+ const SfxPoolItem* pItem;
+ USHORT nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current());
+ bHtmlMode = nHtmlMode & HTMLMODE_ON ? TRUE : FALSE;
+ if(bHtmlMode)
+ {
+ aProtectContentCB .Hide();
+ aProtectFrameCB .Hide();
+ aProtectSizeCB .Hide();
+ aEditInReadonlyCB .Hide();
+ aPrintFrameCB .Hide();
+ aExtFL .Hide();
+ aProtectFL.Hide();
+ }
+ if ( DLG_FRM_GRF == nDlgType || DLG_FRM_OLE == nDlgType )
+ {
+ aEditInReadonlyCB.Hide();
+ aPrintFrameCB.SetPosPixel(aEditInReadonlyCB.GetPosPixel());
+ }
+
+ if(SFX_ITEM_SET == rSet.GetItemState(FN_SET_FRM_ALT_NAME, FALSE, &pItem))
+ {
+ aAltNameED.SetText(((const SfxStringItem*)pItem)->GetValue());
+ aAltNameED.SaveValue();
+ }
+
+ if(!bFormat)
+ {
+ // Grafik einfuegen - Eigenschaften
+ // bNew ist nicht gesetzt, deswegen ueber Selektion erkennen
+ String aTmpName1;
+ if(SFX_ITEM_SET == rSet.GetItemState(FN_SET_FRM_NAME, FALSE, &pItem))
+ {
+ aTmpName1 = ((const SfxStringItem*)pItem)->GetValue();
+ }
+
+ DBG_ASSERT(pWrtSh, "keine Shell?");
+ if( bNew || !aTmpName1.Len() )
+
+ switch( nDlgType )
+ {
+ case DLG_FRM_GRF:
+ aTmpName1 = pWrtSh->GetUniqueGrfName();
+ break;
+ case DLG_FRM_OLE:
+ aTmpName1 = pWrtSh->GetUniqueOLEName();
+ break;
+ default:
+ aTmpName1 = pWrtSh->GetUniqueFrameName();
+ break;
+ }
+
+ aNameED.SetText( aTmpName1 );
+ aNameED.SaveValue();
+ }
+ else
+ {
+ aNameED.Enable( FALSE );
+ aAltNameED.Enable(FALSE);
+ aNameFT.Enable( FALSE );
+ aAltNameFT.Enable(FALSE);
+ aNamesFL.Enable(FALSE);
+ }
+ if(nDlgType == DLG_FRM_STD && aAltNameFT.IsVisible())
+ {
+ aAltNameFT.Hide();
+ aAltNameED.Hide();
+ //move all controls one step up
+ Window* aWindows[] =
+ {
+ &aPrevFT,
+ &aPrevLB,
+ &aNextFT,
+ &aNextLB,
+ &aNamesFL,
+ &aProtectContentCB,
+ &aProtectFrameCB,
+ &aProtectSizeCB,
+ &aProtectFL,
+ &aEditInReadonlyCB,
+ &aPrintFrameCB,
+ &aTextFlowFT,
+ &aTextFlowLB,
+ &aExtFL,
+ 0
+ };
+ sal_Int32 nOffset = aAltNameED.GetPosPixel().Y() - aNameED.GetPosPixel().Y();
+ sal_Int32 nIdx = 0;
+ while(aWindows[nIdx])
+ {
+ lcl_Move(*aWindows[nIdx++], nOffset);
+ }
+ }
+ else
+ {
+ aNameED.SetModifyHdl(LINK(this, SwFrmAddPage, EditModifyHdl));
+ }
+
+ if (!bNew)
+ {
+ SwFrmFmt* pFmt = pWrtSh->GetFlyFrmFmt();
+
+ if (pFmt)
+ {
+ const SwFmtChain &rChain = pFmt->GetChain();
+ const SwFlyFrmFmt* pFlyFmt;
+ String sNextChain, sPrevChain;
+ if ((pFlyFmt = rChain.GetPrev()) != 0)
+ {
+ sPrevChain = pFlyFmt->GetName();
+ }
+
+ if ((pFlyFmt = rChain.GetNext()) != 0)
+ {
+ sNextChain = pFlyFmt->GetName();
+ }
+ //determine chainable frames
+ ::std::vector< String > aPrevPageFrames;
+ ::std::vector< String > aThisPageFrames;
+ ::std::vector< String > aNextPageFrames;
+ ::std::vector< String > aRemainFrames;
+ pWrtSh->GetConnectableFrmFmts(*pFmt, sNextChain, FALSE,
+ aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
+ lcl_InsertVectors(aPrevLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
+ if(sPrevChain.Len())
+ {
+ if(LISTBOX_ENTRY_NOTFOUND == aPrevLB.GetEntryPos(sPrevChain))
+ aPrevLB.InsertEntry(sPrevChain, 1);
+ aPrevLB.SelectEntry(sPrevChain);
+ }
+ else
+ aPrevLB.SelectEntryPos(0);
+ aPrevPageFrames.erase(aPrevPageFrames.begin(), aPrevPageFrames.end());
+ aNextPageFrames.erase(aNextPageFrames.begin(), aNextPageFrames.end());
+ aThisPageFrames.erase(aThisPageFrames.begin(), aThisPageFrames.end());
+ aRemainFrames.erase(aRemainFrames.begin(), aRemainFrames.end());
+
+
+ pWrtSh->GetConnectableFrmFmts(*pFmt, sPrevChain, TRUE,
+ aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
+ lcl_InsertVectors(aNextLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
+ if(sNextChain.Len())
+ {
+ if(LISTBOX_ENTRY_NOTFOUND == aNextLB.GetEntryPos(sNextChain))
+ aNextLB.InsertEntry(sNextChain, 1);
+ aNextLB.SelectEntry(sNextChain);
+ }
+ else
+ aNextLB.SelectEntryPos(0);
+ Link aLink(LINK(this, SwFrmAddPage, ChainModifyHdl));
+ aPrevLB.SetSelectHdl(aLink);
+ aNextLB.SetSelectHdl(aLink);
+ }
+ }
+ // Pos Protected
+ const SvxProtectItem& rProt = (const SvxProtectItem& )rSet.Get(RES_PROTECT);
+ aProtectFrameCB.Check(rProt.IsPosProtected());
+ aProtectContentCB.Check(rProt.IsCntntProtected());
+ aProtectSizeCB.Check(rProt.IsSizeProtected());
+
+ const SwFmtEditInReadonly& rEdit = (const SwFmtEditInReadonly& )rSet.Get(RES_EDIT_IN_READONLY);
+ aEditInReadonlyCB.Check(rEdit.GetValue()); aEditInReadonlyCB.SaveValue();
+
+ // drucken
+ const SvxPrintItem& rPrt = (const SvxPrintItem&)rSet.Get(RES_PRINT);
+ aPrintFrameCB.Check(rPrt.GetValue()); aPrintFrameCB.SaveValue();
+
+ // textflow
+ SfxItemState eState;
+ if( (!bHtmlMode || (0 != (nHtmlMode&HTMLMODE_SOME_STYLES)))
+ && DLG_FRM_GRF != nDlgType && DLG_FRM_OLE != nDlgType &&
+ SFX_ITEM_UNKNOWN != ( eState = rSet.GetItemState(
+ RES_FRAMEDIR, TRUE )) )
+ {
+ aTextFlowFT.Show();
+ aTextFlowLB.Show();
+
+ //vertical text flow is not possible in HTML
+ if(bHtmlMode)
+ {
+ ULONG nData = FRMDIR_VERT_TOP_RIGHT;
+ aTextFlowLB.RemoveEntry(aTextFlowLB.GetEntryPos((void*)nData));
+ }
+ sal_uInt16 nPos, nVal = ((SvxFrameDirectionItem&)rSet.Get(RES_FRAMEDIR)).GetValue();
+ for( nPos = aTextFlowLB.GetEntryCount(); nPos; )
+ if( (sal_uInt16)(long)aTextFlowLB.GetEntryData( --nPos ) == nVal )
+ break;
+ aTextFlowLB.SelectEntryPos( nPos );
+ aTextFlowLB.SaveValue();
+ }
+ else
+ {
+ aTextFlowFT.Hide();
+ aTextFlowLB.Hide();
+ }
+}
+
+/*-----------------13.11.96 13.20-------------------
+
+--------------------------------------------------*/
+
+BOOL SwFrmAddPage::FillItemSet(SfxItemSet &rSet)
+{
+ BOOL bRet = FALSE;
+ if (aNameED.GetText() != aNameED.GetSavedValue())
+ bRet |= 0 != rSet.Put(SfxStringItem(FN_SET_FRM_NAME, aNameED.GetText()));
+ if (aAltNameED.GetText() != aAltNameED.GetSavedValue())
+ bRet |= 0 != rSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, aAltNameED.GetText()));
+
+ const SfxPoolItem* pOldItem;
+ SvxProtectItem aProt ( (const SvxProtectItem& )GetItemSet().Get(RES_PROTECT) );
+ aProt.SetCntntProtect( aProtectContentCB.IsChecked() );
+ aProt.SetSizeProtect ( aProtectSizeCB.IsChecked() );
+ aProt.SetPosProtect ( aProtectFrameCB.IsChecked() );
+ if ( 0 == (pOldItem = GetOldItem(rSet, FN_SET_PROTECT)) ||
+ aProt != *pOldItem )
+ bRet |= 0 != rSet.Put( aProt);
+
+ BOOL bChecked;
+ if ( (bChecked = aEditInReadonlyCB.IsChecked()) != aEditInReadonlyCB.GetSavedValue() )
+ bRet |= 0 != rSet.Put( SwFmtEditInReadonly( RES_EDIT_IN_READONLY, bChecked));
+
+ if ( (bChecked = aPrintFrameCB.IsChecked()) != aPrintFrameCB.GetSavedValue() )
+ bRet |= 0 != rSet.Put( SvxPrintItem( RES_PRINT, bChecked));
+
+ // textflow
+ if( aTextFlowLB.IsVisible() )
+ {
+ sal_uInt16 nPos = aTextFlowLB.GetSelectEntryPos();
+ if( nPos != aTextFlowLB.GetSavedValue() )
+ {
+ nPos = (sal_uInt16)(long)aTextFlowLB.GetEntryData( nPos );
+ bRet |= 0 != rSet.Put( SvxFrameDirectionItem(
+ (SvxFrameDirection)nPos, RES_FRAMEDIR ));
+ }
+ }
+ if(pWrtSh)
+ {
+ const SwFrmFmt* pFmt = pWrtSh->GetFlyFrmFmt();
+ if (pFmt)
+ {
+ String sCurrentPrevChain, sCurrentNextChain;
+ if(aPrevLB.GetSelectEntryPos())
+ sCurrentPrevChain = aPrevLB.GetSelectEntry();
+ if(aNextLB.GetSelectEntryPos())
+ sCurrentNextChain = aNextLB.GetSelectEntry();
+ const SwFmtChain &rChain = pFmt->GetChain();
+ const SwFlyFrmFmt* pFlyFmt;
+ String sNextChain, sPrevChain;
+ if ((pFlyFmt = rChain.GetPrev()) != 0)
+ sPrevChain = pFlyFmt->GetName();
+
+ if ((pFlyFmt = rChain.GetNext()) != 0)
+ sNextChain = pFlyFmt->GetName();
+ if(sPrevChain != sCurrentPrevChain)
+ bRet |= 0 != rSet.Put(SfxStringItem(FN_PARAM_CHAIN_PREVIOUS, sCurrentPrevChain));
+ if(sNextChain != sCurrentNextChain)
+ bRet |= 0 != rSet.Put(SfxStringItem(FN_PARAM_CHAIN_NEXT, sCurrentNextChain));
+ }
+ }
+ return bRet;
+}
+
+/*-----------------13.11.96 15.05-------------------
+
+--------------------------------------------------*/
+
+USHORT* SwFrmAddPage::GetRanges()
+{
+ return aAddPgRg;
+}
+
+/*-----------------13.11.96 16.12-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK(SwFrmAddPage, EditModifyHdl, Edit*, EMPTYARG)
+{
+ BOOL bEnable = 0 != aNameED.GetText().Len();
+ aAltNameED.Enable(bEnable);
+ aAltNameFT.Enable(bEnable);
+
+ return 0;
+}
+//-----------------------------------------------------------------------------
+void SwFrmAddPage::SetFormatUsed(BOOL bFmt)
+{
+ bFormat = bFmt;
+ if(bFormat)
+ {
+ aNameFT.Show(FALSE);
+ aNameED.Show(FALSE);
+ aAltNameFT.Show(FALSE);
+ aAltNameED.Show(FALSE);
+ aPrevFT.Show(FALSE);
+ aPrevLB.Show(FALSE);
+ aNextFT.Show(FALSE);
+ aNextLB.Show(FALSE);
+ aNamesFL.Show(FALSE);
+
+ sal_Int32 nDiff = aExtFL.GetPosPixel().Y() - aNamesFL.GetPosPixel().Y();
+ Window* aWindows[] =
+ {
+ &aProtectContentCB,
+ &aProtectFrameCB,
+ &aProtectSizeCB,
+ &aProtectFL,
+ &aEditInReadonlyCB,
+ &aPrintFrameCB,
+ &aExtFL,
+ &aTextFlowFT,
+ &aTextFlowLB,
+ 0
+ };
+ sal_Int32 nIdx = 0;
+ while(aWindows[nIdx])
+ lcl_Move(*aWindows[nIdx++], nDiff);
+ }
+}
+/* -----------------------------08.08.2002 16:24------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwFrmAddPage, ChainModifyHdl, ListBox*, pBox)
+{
+ String sCurrentPrevChain, sCurrentNextChain;
+ if(aPrevLB.GetSelectEntryPos())
+ sCurrentPrevChain = aPrevLB.GetSelectEntry();
+ if(aNextLB.GetSelectEntryPos())
+ sCurrentNextChain = aNextLB.GetSelectEntry();
+ SwFrmFmt* pFmt = pWrtSh->GetFlyFrmFmt();
+ if (pFmt)
+ {
+ BOOL bNextBox = &aNextLB == pBox;
+ ListBox& rChangeLB = bNextBox ? aPrevLB : aNextLB;
+ for(USHORT nEntry = rChangeLB.GetEntryCount(); nEntry > 1; nEntry--)
+ rChangeLB.RemoveEntry(nEntry - 1);
+ //determine chainable frames
+ ::std::vector< String > aPrevPageFrames;
+ ::std::vector< String > aThisPageFrames;
+ ::std::vector< String > aNextPageFrames;
+ ::std::vector< String > aRemainFrames;
+ pWrtSh->GetConnectableFrmFmts(*pFmt, bNextBox ? sCurrentNextChain : sCurrentPrevChain, !bNextBox,
+ aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
+ lcl_InsertVectors(rChangeLB,
+ aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
+ String sToSelect = bNextBox ? sCurrentPrevChain : sCurrentNextChain;
+ if(rChangeLB.GetEntryPos(sToSelect) != LISTBOX_ENTRY_NOTFOUND)
+ rChangeLB.SelectEntry(sToSelect);
+ else
+ rChangeLB.SelectEntryPos(0);
+
+ }
+ return 0;
+}
diff --git a/sw/source/ui/frmdlg/frmpage.hrc b/sw/source/ui/frmdlg/frmpage.hrc
new file mode 100644
index 000000000000..044d2fdd4e05
--- /dev/null
+++ b/sw/source/ui/frmdlg/frmpage.hrc
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svtools/controldims.hrc>
+
+#define RB_ANCHOR_PAGE 1
+#define RB_ANCHOR_PARA 2
+#define RB_ANCHOR_AT_CHAR 3
+#define RB_ANCHOR_AS_CHAR 4
+#define RB_ANCHOR_FRAME 5
+#define WN_BSP 21
+#define FT_BSP 22
+
+
+// SwFrmPage
+#define FL_TYPE 26
+#define FT_WIDTH 27
+#define ED_WIDTH 28
+#define FT_HEIGHT 29
+#define ED_HEIGHT 30
+#define CB_AUTOHEIGHT 31
+#define FL_SIZE 32
+#define FT_HORIZONTAL 33
+#define DLB_HORIZONTAL 34
+#define FT_AT_HORZ_POS 35
+#define ED_AT_HORZ_POS 36
+#define FT_HORI_RELATION 1
+#define LB_HORI_RELATION 2
+#define CB_MIRROR 37
+#define FT_VERTICAL 38
+#define DLB_VERTICAL 39
+#define FT_AT_VERT_POS 40
+#define ED_AT_VERT_POS 41
+#define FT_VERT_RELATION 3
+#define LB_VERT_RELATION 4
+#define FL_POSITION 43
+#define BT_REALSIZE 44
+#define BT_MANUAL 45
+#define CB_AUTOWIDTH 46
+#define FT_WIDTH_AUTO 47
+#define FT_HEIGHT_AUTO 48
+
+// metrics
+#define SWFRMPG_COL_0 RSC_SP_TBPG_INNERBORDER_LEFT
+#define SWFRMPG_COL_1 (SWFRMPG_COL_0+RSC_SP_FLGR_INNERBORDER_LEFT)
+#define SWFRMPG_COL_2 (SWFRMPG_COL_1+RSC_SP_FLGR_INNERBORDER_LEFT)
+#define SWFRMPG_COL_3 76
+#define SWFRMPG_COL_4 109
+
+#define SWFRMPG_ROW_CONDENSE 1
+#define SWFRMPG_ROW_0 RSC_SP_TBPG_INNERBORDER_TOP
+#define SWFRMPG_ROW_1 (SWFRMPG_ROW_0+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_INNERBORDER_TOP-SWFRMPG_ROW_CONDENSE)
+#define SWFRMPG_ROW_2 (SWFRMPG_ROW_1+((RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2))
+#define SWFRMPG_ROW_3 (SWFRMPG_ROW_1+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y-SWFRMPG_ROW_CONDENSE)
+#define SWFRMPG_ROW_4 (SWFRMPG_ROW_3+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y-SWFRMPG_ROW_CONDENSE)
+#define SWFRMPG_ROW_5 (SWFRMPG_ROW_4+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y-SWFRMPG_ROW_CONDENSE)
+#define SWFRMPG_ROW_6 (SWFRMPG_ROW_5+((RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2))
+#define SWFRMPG_ROW_7 (SWFRMPG_ROW_5+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y-SWFRMPG_ROW_CONDENSE)
+#define SWFRMPG_ROW_8 (SWFRMPG_ROW_7+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y-SWFRMPG_ROW_CONDENSE)
+#define SWFRMPG_ROW_9 (SWFRMPG_ROW_8+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define SWFRMPG_ROW_10 (SWFRMPG_ROW_9+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_Y-SWFRMPG_ROW_CONDENSE)
+#define SWFRMPG_ROW_11 (SWFRMPG_ROW_10+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_INNERBORDER_TOP)
+#define SWFRMPG_ROW_12 (SWFRMPG_ROW_11+((RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2))
+#define SWFRMPG_ROW_13 (SWFRMPG_ROW_11+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define SWFRMPG_ROW_14 (SWFRMPG_ROW_13+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+#define SWFRMPG_ROW_15 (SWFRMPG_ROW_14+((RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2))
+#define SWFRMPG_ROW_16 (SWFRMPG_ROW_14+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y)
+
+
+#define CB_HOR 46
+#define CB_VERT 47
+//#define LB_MIRROR_PAGES 49
+//#define FT_MIRROR_PAGES 50
+#define FL_MIRROR 51
+#define WN_BMP 52
+#define PB_BROWSE 53
+#define ED_CONNECT 54
+#define FL_CONNECT 55
+#define FT_CONNECT 57
+#define FT_URL 58
+#define ED_URL 59
+
+#define BMP_EXAMPLE 62
+#define BMP_EXAMPLE_HC 63
+#define RB_MIRROR_ALL_PAGES 64
+#define RB_MIRROR_LEFT_PAGES 65
+#define RB_MIRROR_RIGHT_PAGES 66
+
+#define FL_HYPERLINK 94
+#define FT_FRAME 95
+#define CB_FRAME 96
+#define FL_IMAGE 97
+#define CB_SERVER 98
+#define CB_CLIENT 99
+
+#define CB_REL_WIDTH 100
+#define CB_REL_HEIGHT 101
+#define CB_FIXEDRATIO 102
+#define PB_SEARCH 103
+
+#define CB_ANCHOR_ONLY 103
+
+#define FT_NAME 110
+#define ED_NAME 111
+#define FT_ALT_NAME 112
+#define ED_ALT_NAME 113
+#define FT_PREV 114
+#define LB_PREV 115
+#define FT_NEXT 116
+#define LB_NEXT 117
+#define FL_NAME 118
+#define CB_PROTECT_CONTENT 119
+#define CB_PROTECT_FRAME 120
+#define CB_PROTECT_SIZE 121
+#define FL_PROTECT 122
+#define CB_EDIT_IN_READONLY 123
+#define CB_PRINT_FRAME 124
+#define FL_EXT 125
+#define FL_TYPE_SEP 126
+#define FT_TEXTFLOW 127
+#define LB_TEXTFLOW 128
+#define CB_FOLLOWTEXTFLOW 129
diff --git a/sw/source/ui/frmdlg/frmpage.src b/sw/source/ui/frmdlg/frmpage.src
new file mode 100644
index 000000000000..782607000386
--- /dev/null
+++ b/sw/source/ui/frmdlg/frmpage.src
@@ -0,0 +1,884 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "frmui.hrc"
+#include "frmpage.hrc"
+#include "globals.hrc"
+#include "helpid.h"
+#include "svx/dialogs.hrc"
+
+TabDialog DLG_FRM_STD
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Frame" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_FRM_STD ;
+ PageResID = TP_FRM_STD ;
+ Text [ en-US ] = "Type" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FRM_ADD ;
+ PageResID = TP_FRM_ADD ;
+ Text [ en-US ] = "Options" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FRM_WRAP ;
+ PageResID = TP_FRM_WRAP ;
+ Text [ en-US ] = "Wrap" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FRM_URL ;
+ PageResID = TP_FRM_URL ;
+ Text [ en-US ] = "Hyperlink" ;
+ };
+ PageItem
+ {
+ Identifier = TP_BORDER ;
+ PageResID = TP_BORDER ;
+ Text [ en-US ] = "Borders" ;
+ };
+ PageItem
+ {
+ Identifier = TP_BACKGROUND ;
+ PageResID = TP_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ };
+ PageItem
+ {
+ Identifier = TP_COLUMN ;
+ PageResID = TP_COLUMN ;
+ Text [ en-US ] = "Columns" ;
+ };
+ PageItem
+ {
+ Identifier = TP_MACRO_ASSIGN ;
+ Text [ en-US ] = "Macro" ;
+ };
+ };
+ };
+};
+TabDialog DLG_FRM_GRF
+{
+ SVLook = TRUE ;
+ Text [ en-US ] = "Picture" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_FRM_STD ;
+ PageResID = TP_FRM_STD ;
+ Text [ en-US ] = "Type" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FRM_ADD ;
+ PageResID = TP_FRM_ADD ;
+ Text [ en-US ] = "Options" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FRM_WRAP ;
+ PageResID = TP_FRM_WRAP ;
+ Text [ en-US ] = "Wrap" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FRM_URL ;
+ PageResID = TP_FRM_URL ;
+ Text [ en-US ] = "Hyperlink" ;
+ };
+ PageItem
+ {
+ Identifier = TP_GRF_EXT ;
+ PageResID = TP_GRF_EXT ;
+ Text [ en-US ] = "Picture" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_GRFCROP;
+ PageResID = RID_SVXPAGE_GRFCROP;
+ Text [ en-US ] = "Crop" ;
+ };
+ PageItem
+ {
+ Identifier = TP_BORDER ;
+ PageResID = TP_BORDER ;
+ Text [ en-US ] = "Borders" ;
+ };
+ PageItem
+ {
+ Identifier = TP_BACKGROUND ;
+ PageResID = TP_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ };
+ PageItem
+ {
+ Identifier = TP_MACRO_ASSIGN ;
+ Text [ en-US ] = "Macro" ;
+ };
+ };
+ };
+};
+TabDialog DLG_FRM_OLE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Object" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_FRM_STD ;
+ PageResID = TP_FRM_STD ;
+ Text [ en-US ] = "Type" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FRM_ADD ;
+ PageResID = TP_FRM_ADD ;
+ Text [ en-US ] = "Options" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FRM_WRAP ;
+ PageResID = TP_FRM_WRAP ;
+ Text [ en-US ] = "Wrap" ;
+ };
+ PageItem
+ {
+ Identifier = TP_FRM_URL ;
+ PageResID = TP_FRM_URL ;
+ Text [ en-US ] = "Hyperlink" ;
+ };
+ PageItem
+ {
+ Identifier = TP_BORDER ;
+ PageResID = TP_BORDER ;
+ Text [ en-US ] = "Borders" ;
+ };
+ PageItem
+ {
+ Identifier = TP_BACKGROUND ;
+ PageResID = TP_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ };
+ /*
+ PageItem {
+ Identifier = TP_COLUMN ;
+ PageResID = TP_COLUMN;
+ Text [ en-US ] = "Columns" ;
+ };
+*/
+ PageItem
+ {
+ Identifier = TP_MACRO_ASSIGN ;
+ Text [ en-US ] = "Macro" ;
+ };
+ };
+ };
+};
+TabPage TP_FRM_STD
+{
+ HelpID = HID_FRM_STD ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedText FT_WIDTH
+ {
+ Pos = MAP_APPFONT ( SWFRMPG_COL_1 , SWFRMPG_ROW_2 ) ;
+ Size = MAP_APPFONT ( (SWFRMPG_COL_3-SWFRMPG_COL_1-1) , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Width" ;
+ };
+ FixedText FT_WIDTH_AUTO
+ {
+ Pos = MAP_APPFONT ( SWFRMPG_COL_1 , SWFRMPG_ROW_2 ) ;
+ Size = MAP_APPFONT ( (SWFRMPG_COL_3-SWFRMPG_COL_1-1) , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Width (at least)" ;
+ };
+ MetricField ED_WIDTH
+ {
+ HelpID = "sw:MetricField:TP_FRM_STD:ED_WIDTH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( SWFRMPG_COL_3 , SWFRMPG_ROW_1 ) ;
+ Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_3) , RSC_CD_TEXTBOX_HEIGHT ) ;
+ Text = "12,99" ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 5 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 5 ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ CheckBox CB_REL_WIDTH
+ {
+ HelpID = "sw:CheckBox:TP_FRM_STD:CB_REL_WIDTH";
+ Pos = MAP_APPFONT ( SWFRMPG_COL_2 , SWFRMPG_ROW_3 ) ;
+ Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_2) , RSC_CD_CHECKBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Relat~ive" ;
+ };
+ CheckBox CB_AUTOWIDTH
+ {
+ HelpID = "sw:CheckBox:TP_FRM_STD:CB_AUTOWIDTH";
+ Pos = MAP_APPFONT ( SWFRMPG_COL_2 , SWFRMPG_ROW_4 ) ;
+ Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_2) , RSC_CD_CHECKBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Automatic";
+ };
+ FixedText FT_HEIGHT
+ {
+ Pos = MAP_APPFONT ( SWFRMPG_COL_1 , SWFRMPG_ROW_6 ) ;
+ Size = MAP_APPFONT ( (SWFRMPG_COL_3-SWFRMPG_COL_1-1) , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "H~eight" ;
+ };
+ FixedText FT_HEIGHT_AUTO
+ {
+ Pos = MAP_APPFONT ( SWFRMPG_COL_1 , SWFRMPG_ROW_6 ) ;
+ Size = MAP_APPFONT ( (SWFRMPG_COL_3-SWFRMPG_COL_1-1) , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "H~eight (at least)" ;
+ };
+ MetricField ED_HEIGHT
+ {
+ HelpID = "sw:MetricField:TP_FRM_STD:ED_HEIGHT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( SWFRMPG_COL_3 , SWFRMPG_ROW_5 ) ;
+ Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_3) , RSC_CD_TEXTBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 5 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 5 ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ CheckBox CB_REL_HEIGHT
+ {
+ HelpID = "sw:CheckBox:TP_FRM_STD:CB_REL_HEIGHT";
+ Pos = MAP_APPFONT ( SWFRMPG_COL_2 , SWFRMPG_ROW_7 ) ;
+ Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_2) , RSC_CD_CHECKBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Re~lative" ;
+ };
+ CheckBox CB_AUTOHEIGHT
+ {
+ HelpID = "sw:CheckBox:TP_FRM_STD:CB_AUTOHEIGHT";
+ Pos = MAP_APPFONT ( SWFRMPG_COL_2 , SWFRMPG_ROW_8 ) ;
+ Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_2) , RSC_CD_CHECKBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "AutoSize";
+ };
+ CheckBox CB_FIXEDRATIO
+ {
+ HelpID = "sw:CheckBox:TP_FRM_STD:CB_FIXEDRATIO";
+ Pos = MAP_APPFONT ( SWFRMPG_COL_1 , SWFRMPG_ROW_9 ) ;
+ Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_1) , RSC_CD_CHECKBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Keep ratio" ;
+ };
+ PushButton BT_REALSIZE
+ {
+ HelpID = "sw:PushButton:TP_FRM_STD:BT_REALSIZE";
+ Pos = MAP_APPFONT ( 35 , 86 ) ;
+ Size = MAP_APPFONT ( 70 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Original Size" ;
+ };
+ FixedLine FL_SIZE
+ {
+ Pos = MAP_APPFONT ( SWFRMPG_COL_0 , SWFRMPG_ROW_0 ) ;
+ Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_0) , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Size" ;
+ };
+ FixedLine FL_TYPE_SEP
+ {
+ Pos = MAP_APPFONT ( 111 , 14 ) ;
+ Size = MAP_APPFONT ( 4 , (SWFRMPG_ROW_9+RSC_CD_CHECKBOX_HEIGHT-SWFRMPG_ROW_1) ) ;
+ Vert = TRUE;
+ };
+ RadioButton RB_ANCHOR_PAGE
+ {
+ HelpID = "sw:RadioButton:TP_FRM_STD:RB_ANCHOR_PAGE";
+ Pos = MAP_APPFONT ( 122 , 14 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "To ~page";
+ };
+ RadioButton RB_ANCHOR_PARA
+ {
+ HelpID = "sw:RadioButton:TP_FRM_STD:RB_ANCHOR_PARA";
+ Pos = MAP_APPFONT ( 122 , 28 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "To paragrap~h";
+ };
+ RadioButton RB_ANCHOR_AT_CHAR
+ {
+ HelpID = "sw:RadioButton:TP_FRM_STD:RB_ANCHOR_AT_CHAR";
+ Pos = MAP_APPFONT ( 122 , 42 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "To cha~racter";
+ };
+ RadioButton RB_ANCHOR_AS_CHAR
+ {
+ HelpID = "sw:RadioButton:TP_FRM_STD:RB_ANCHOR_AS_CHAR";
+ Pos = MAP_APPFONT ( 122 , 56 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~As character" ;
+ };
+ RadioButton RB_ANCHOR_FRAME
+ {
+ HelpID = "sw:RadioButton:TP_FRM_STD:RB_ANCHOR_FRAME";
+ Pos = MAP_APPFONT ( 122 , 70 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "To ~frame";
+ };
+ FixedLine FL_TYPE
+ {
+ Pos = MAP_APPFONT ( 116 , 3 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Anchor" ;
+ };
+ Window WN_BSP
+ {
+ Pos = MAP_APPFONT ( 202 , 14 ) ;
+ Size = MAP_APPFONT ( 52 , 86 ) ;
+ };
+ FixedText FT_HORIZONTAL
+ {
+ Pos = MAP_APPFONT ( 12 , SWFRMPG_ROW_12 ) ;
+ Size = MAP_APPFONT ( 35 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Hori~zontal" ;
+ };
+ ListBox DLB_HORIZONTAL
+ {
+ HelpID = "sw:ListBox:TP_FRM_STD:DLB_HORIZONTAL";
+ Pos = MAP_APPFONT ( 49 , SWFRMPG_ROW_11 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_AT_HORZ_POS
+ {
+ Pos = MAP_APPFONT ( 101 , SWFRMPG_ROW_12 ) ;
+ Size = MAP_APPFONT ( 20 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Center = TRUE ;
+ Text [ en-US ] = "b~y" ;
+ };
+ MetricField ED_AT_HORZ_POS
+ {
+ HelpID = "sw:MetricField:TP_FRM_STD:ED_AT_HORZ_POS";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 123 , SWFRMPG_ROW_11 ) ;
+ Size = MAP_APPFONT ( 35 , RSC_CD_TEXTBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -9999 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = -9999 ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_HORI_RELATION
+ {
+ Pos = MAP_APPFONT ( 160 , SWFRMPG_ROW_12 ) ;
+ Size = MAP_APPFONT ( 21 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Center = TRUE ;
+ Text [ en-US ] = "~to" ;
+ };
+ ListBox LB_HORI_RELATION
+ {
+ HelpID = "sw:ListBox:TP_FRM_STD:LB_HORI_RELATION";
+ Pos = MAP_APPFONT ( 183 , SWFRMPG_ROW_11 ) ;
+ Size = MAP_APPFONT ( 65 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ CheckBox CB_MIRROR
+ {
+ HelpID = "sw:CheckBox:TP_FRM_STD:CB_MIRROR";
+ Pos = MAP_APPFONT ( SWFRMPG_COL_2 , SWFRMPG_ROW_13 ) ;
+ Size = MAP_APPFONT ( (260-SWFRMPG_COL_2-1) , RSC_CD_CHECKBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Mirror on even pages" ;
+ };
+ FixedText FT_VERTICAL
+ {
+ Pos = MAP_APPFONT ( 12 , SWFRMPG_ROW_15 ) ;
+ Size = MAP_APPFONT ( 35 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Vertical" ;
+ };
+ ListBox DLB_VERTICAL
+ {
+ HelpID = "sw:ListBox:TP_FRM_STD:DLB_VERTICAL";
+ Pos = MAP_APPFONT ( 49 , SWFRMPG_ROW_14 ) ;
+ Size = MAP_APPFONT ( 50 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_AT_VERT_POS
+ {
+ Pos = MAP_APPFONT ( 101 , SWFRMPG_ROW_15 ) ;
+ Size = MAP_APPFONT ( 20 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Center = TRUE ;
+ Text [ en-US ] = "by" ;
+ };
+ MetricField ED_AT_VERT_POS
+ {
+ HelpID = "sw:MetricField:TP_FRM_STD:ED_AT_VERT_POS";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 123 , SWFRMPG_ROW_14 ) ;
+ Size = MAP_APPFONT ( 35 , RSC_CD_TEXTBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -9999 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = -9999 ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_VERT_RELATION
+ {
+ Pos = MAP_APPFONT ( 160 , SWFRMPG_ROW_15 ) ;
+ Size = MAP_APPFONT ( 21 , RSC_CD_FIXEDTEXT_HEIGHT ) ;
+ Center = TRUE ;
+ Text [ en-US ] = "t~o" ;
+ };
+ ListBox LB_VERT_RELATION
+ {
+ HelpID = "sw:ListBox:TP_FRM_STD:LB_VERT_RELATION";
+ Pos = MAP_APPFONT ( 183 , SWFRMPG_ROW_14 ) ;
+ Size = MAP_APPFONT ( 65 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ CheckBox CB_FOLLOWTEXTFLOW
+ {
+ HelpID = "sw:CheckBox:TP_FRM_STD:CB_FOLLOWTEXTFLOW";
+ Pos = MAP_APPFONT ( SWFRMPG_COL_2 , SWFRMPG_ROW_16 ) ;
+ Size = MAP_APPFONT ( (260-SWFRMPG_COL_2-1) , RSC_CD_CHECKBOX_HEIGHT ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Follow text flow" ;
+ };
+ FixedLine FL_POSITION
+ {
+ Pos = MAP_APPFONT ( 6 , SWFRMPG_ROW_10 ) ;
+ Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ;
+ Text [ en-US ] = "Position" ;
+ };
+};
+TabPage TP_GRF_EXT
+{
+ Hide = TRUE ;
+ HelpID = HID_GRF_EXT ;
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Bitmap BMP_EXAMPLE
+ {
+ File = "dog.bmp" ;
+ };
+ Bitmap BMP_EXAMPLE_HC
+ {
+ File = "dog_h.bmp" ;
+ };
+ FixedLine FL_CONNECT
+ {
+ Pos = MAP_APPFONT ( 6 , 87 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Link" ;
+ };
+ FixedText FT_CONNECT
+ {
+ Pos = MAP_APPFONT ( 13 , 98 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "~File name" ;
+ };
+ Edit ED_CONNECT
+ {
+ HelpID = "sw:Edit:TP_GRF_EXT:ED_CONNECT";
+ Pos = MAP_APPFONT ( 13 , 109 ) ;
+ Size = MAP_APPFONT ( 200 , 12 ) ;
+ Text [ en-US ] = "[None]" ;
+ Readonly = TRUE ;
+ Left = TRUE ;
+ Border = TRUE ;
+ };
+ PushButton PB_BROWSE
+ {
+ HelpID = "sw:PushButton:TP_GRF_EXT:PB_BROWSE";
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 230 , 109 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~..." ;
+ };
+ CheckBox CB_VERT
+ {
+ HelpID = "sw:CheckBox:TP_GRF_EXT:CB_VERT";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 48 , 10 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ Text [ en-US ] = "~Vertically" ;
+ };
+ CheckBox CB_HOR
+ {
+ HelpID = "sw:CheckBox:TP_GRF_EXT:CB_HOR";
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Hori~zontally";
+ };
+ RadioButton RB_MIRROR_ALL_PAGES
+ {
+ HelpID = "sw:RadioButton:TP_GRF_EXT:RB_MIRROR_ALL_PAGES";
+ Pos = MAP_APPFONT ( 18 , 42 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "On all pages" ;
+ };
+ RadioButton RB_MIRROR_LEFT_PAGES
+ {
+ HelpID = "sw:RadioButton:TP_GRF_EXT:RB_MIRROR_LEFT_PAGES";
+ Pos = MAP_APPFONT ( 18 , 56 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "On left pages" ;
+ };
+ RadioButton RB_MIRROR_RIGHT_PAGES
+ {
+ HelpID = "sw:RadioButton:TP_GRF_EXT:RB_MIRROR_RIGHT_PAGES";
+ Pos = MAP_APPFONT ( 18 , 70 ) ;
+ Size = MAP_APPFONT ( 100 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "On right pages" ;
+ };
+ Window WN_BMP
+ {
+ Pos = MAP_APPFONT ( 120 , 14 ) ;
+ Size = MAP_APPFONT ( 127 , 66 ) ;
+ };
+ FixedLine FL_MIRROR
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Flip" ;
+ };
+};
+String STR_EDIT_GRF
+{
+ Text [ en-US ] = "Link" ;
+};
+
+TabPage TP_FRM_URL
+{
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_FRM_URL ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_URL
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "~URL" ;
+ };
+ Edit ED_URL
+ {
+ HelpID = "sw:Edit:TP_FRM_URL:ED_URL";
+ Pos = MAP_APPFONT ( 45 , 14 ) ;
+ Size = MAP_APPFONT ( 149 , 12 ) ;
+ Left = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit ED_NAME
+ {
+ HelpID = "sw:Edit:TP_FRM_URL:ED_NAME";
+ Pos = MAP_APPFONT ( 45 , 30 ) ;
+ Size = MAP_APPFONT ( 149 , 12 ) ;
+ Left = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_FRAME
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Frame" ;
+ };
+ ComboBox CB_FRAME
+ {
+ HelpID = "sw:ComboBox:TP_FRM_URL:CB_FRAME";
+ Pos = MAP_APPFONT ( 45 , 46 ) ;
+ Size = MAP_APPFONT ( 89 , 50 ) ;
+ Left = TRUE ;
+ DropDown = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_SEARCH
+ {
+ HelpID = "sw:PushButton:TP_FRM_URL:PB_SEARCH";
+ Pos = MAP_APPFONT ( 198 , 13 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Browse..." ;
+ };
+ FixedLine FL_HYPERLINK
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Link to";
+ };
+ CheckBox CB_SERVER
+ {
+ HelpID = "sw:CheckBox:TP_FRM_URL:CB_SERVER";
+ Pos = MAP_APPFONT ( 12 , 75 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "~Server-side image map";
+ };
+ CheckBox CB_CLIENT
+ {
+ HelpID = "sw:CheckBox:TP_FRM_URL:CB_CLIENT";
+ Pos = MAP_APPFONT ( 12 , 89 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "~Client-side image map";
+ };
+ FixedLine FL_IMAGE
+ {
+ Pos = MAP_APPFONT ( 6 , 64 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Image map" ;
+ };
+};
+TabPage TP_FRM_ADD
+{
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_FRM_ADD ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 75 , 8 ) ;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit ED_NAME
+ {
+ HelpID = "sw:Edit:TP_FRM_ADD:ED_NAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 91 , 14 ) ;
+ Size = MAP_APPFONT ( 157 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_ALT_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 75 , 8 ) ;
+ Text [ en-US ] = "~Alternative (Text only)" ;
+ };
+ Edit ED_ALT_NAME
+ {
+ HelpID = "sw:Edit:TP_FRM_ADD:ED_ALT_NAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 91 , 30 ) ;
+ Size = MAP_APPFONT ( 157 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_PREV
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 75 , 8 ) ;
+ Text [ en-US ] = "~Previous link" ;
+ };
+ ListBox LB_PREV
+ {
+ HelpID = "sw:ListBox:TP_FRM_ADD:LB_PREV";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 91 , 46 ) ;
+ Size = MAP_APPFONT ( 157 , 50 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "<None>" ; > ;
+ };
+ };
+ FixedText FT_NEXT
+ {
+ Pos = MAP_APPFONT ( 12 , 64 ) ;
+ Size = MAP_APPFONT ( 75 , 8 ) ;
+ Text [ en-US ] = "~Next link" ;
+ };
+ ListBox LB_NEXT
+ {
+ HelpID = "sw:ListBox:TP_FRM_ADD:LB_NEXT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 91 , 62 ) ;
+ Size = MAP_APPFONT ( 157 , 50 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ StringList [ en-US ] =
+ {
+ < "<None>" ; > ;
+ };
+ };
+ FixedLine FL_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Names" ;
+ };
+ CheckBox CB_PROTECT_CONTENT
+ {
+ HelpID = "sw:CheckBox:TP_FRM_ADD:CB_PROTECT_CONTENT";
+ Pos = MAP_APPFONT ( 12 , 91 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Contents" ;
+ };
+ CheckBox CB_PROTECT_FRAME
+ {
+ HelpID = "sw:CheckBox:TP_FRM_ADD:CB_PROTECT_FRAME";
+ Pos = MAP_APPFONT ( 12 , 105 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "P~osition" ;
+ };
+ CheckBox CB_PROTECT_SIZE
+ {
+ HelpID = "sw:CheckBox:TP_FRM_ADD:CB_PROTECT_SIZE";
+ Pos = MAP_APPFONT ( 12 , 119 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Size" ;
+ };
+ FixedLine FL_PROTECT
+ {
+ Pos = MAP_APPFONT ( 6 , 80 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Protect" ;
+ };
+ CheckBox CB_EDIT_IN_READONLY
+ {
+ HelpID = "sw:CheckBox:TP_FRM_ADD:CB_EDIT_IN_READONLY";
+ Pos = MAP_APPFONT ( 12 , 146 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Editable in read-only document" ;
+ };
+ CheckBox CB_PRINT_FRAME
+ {
+ HelpID = "sw:CheckBox:TP_FRM_ADD:CB_PRINT_FRAME";
+ Pos = MAP_APPFONT ( 12 , 160 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Prin~t" ;
+ };
+ FixedLine FL_EXT
+ {
+ Pos = MAP_APPFONT ( 6 , 135 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Properties";
+ };
+
+ FixedText FT_TEXTFLOW
+ {
+ Pos = MAP_APPFONT ( 12 , 174 ) ;
+ Size = MAP_APPFONT ( 65 , 8 ) ;
+ Left = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Text direction";
+ };
+ ListBox LB_TEXTFLOW
+ {
+ HelpID = "sw:ListBox:TP_FRM_ADD:LB_TEXTFLOW";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 81 , 172 ) ;
+ Size = MAP_APPFONT ( 167 , 50 ) ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Left-to-right (horizontal)" ; 0; > ;
+ < "Right-to-left (horizontal)" ; 1; > ;
+ < "Right-to-left (vertical)" ; 2; > ;
+ < "Use superordinate object settings" ; 4; > ;
+ };
+ };
+};
+
diff --git a/sw/source/ui/frmdlg/frmui.src b/sw/source/ui/frmdlg/frmui.src
new file mode 100644
index 000000000000..5e3abb1286e4
--- /dev/null
+++ b/sw/source/ui/frmdlg/frmui.src
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "frmui.hrc"
+
+/*-----------------------------------------------------------------------
+ Beschreibung: V-Align
+ -----------------------------------------------------------------------*/
+String STR_TOP
+{
+ Text [ en-US ] = "~Top" ;
+};
+String STR_BOTTOM
+{
+ Text [ en-US ] = "~Bottom" ;
+};
+String STR_CENTER_VERT
+{
+ Text [ en-US ] = "C~enter" ;
+};
+String STR_CENTER_HORI
+{
+ Text [ en-US ] = "~Center" ;
+};
+/*-----------------------------------------------------------------------
+ Beschreibung: V-Rel
+ -----------------------------------------------------------------------*/
+String STR_TOPPRT
+{
+ Text [ en-US ] = "Upper Margin" ;
+};
+
+/*-----------------------------------------------------------------------
+ Beschreibung: H-Rel
+ -----------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------
+ Beschreibung: V-Rel Zeichenausrichtungen
+ -----------------------------------------------------------------------*/
+/*-----------------------------------------------------------------------
+ Beschreibung: Zeichenausrichtungen fuer frmsh.cxx - Kontextmenue
+ -----------------------------------------------------------------------*/
+String STR_TOP_BASE
+{
+ Text [ en-US ] = "Base line at ~top" ;
+};
+String STR_BOTTOM_BASE
+{
+ Text [ en-US ] = "~Base line at bottom" ;
+};
+String STR_CENTER_BASE
+{
+ Text [ en-US ] = "Base line ~centered" ;
+};
+String STR_LINE_TOP
+{
+ Text [ en-US ] = "Top of line" ;
+};
+String STR_LINE_BOTTOM
+{
+ Text [ en-US ] = "Bottom of line" ;
+};
+String STR_LINE_CENTER
+{
+ Text [ en-US ] = "Center of line" ;
+};
+String STR_CHAR_TOP
+{
+ Text [ en-US ] = "Top of character" ;
+};
+String STR_CHAR_BOTTOM
+{
+ Text [ en-US ] = "Bottom of character" ;
+};
+String STR_CHAR_CENTER
+{
+ Text [ en-US ] = "Center of character" ;
+};
+String STR_OLE_INSERT
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Objekt einfügen : Objekt einf³gen */
+ Text [ en-US ] = "Insert object" ;
+};
+String STR_OLE_EDIT
+{
+ Text [ en-US ] = "Edit object" ;
+};
+String STR_COLL_HEADER
+{
+ Text [ en-US ] = " (Template: " ;
+};
+String STR_FRMUI_BORDER
+{
+ Text [ en-US ] = "Borders" ;
+};
+String STR_FRMUI_PATTERN
+{
+ Text [ en-US ] = "Background" ;
+};
+String STR_FRMUI_WRAP
+{
+ Text [ en-US ] = "Wrap" ;
+};
+InfoBox MSG_COLUMN_ERR_BOUNDWIDTH
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ /* ### ACHTUNG: Neuer Text in Resource? Der Spaltenabstand ist zu groß für die Spaltenbreite. : Der Spaltenabstand ist zu gro˜ f³r die Spaltenbreite. */
+ Message [ en-US ] = "Column spacing exceeds the column width." ;
+};
+
diff --git a/sw/source/ui/frmdlg/pattern.cxx b/sw/source/ui/frmdlg/pattern.cxx
new file mode 100644
index 000000000000..9b2de83e8f59
--- /dev/null
+++ b/sw/source/ui/frmdlg/pattern.cxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include "swtypes.hxx"
+#include "pattern.hxx"
+#include "frmui.hrc"
+
+
+/****************************************************************************
+Ctor
+****************************************************************************/
+
+
+
+SwBackgroundDlg::SwBackgroundDlg(Window* pParent, const SfxItemSet& rSet) :
+
+ SfxSingleTabDialog(pParent, rSet, 0)
+
+{
+ SetText(SW_RESSTR(STR_FRMUI_PATTERN));
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND );
+ if ( fnCreatePage )
+ {
+ SetTabPage((*fnCreatePage)( this, rSet ));
+ }
+
+}
+
+/****************************************************************************
+Dtor
+****************************************************************************/
+
+
+
+SwBackgroundDlg::~SwBackgroundDlg()
+{
+}
+
diff --git a/sw/source/ui/frmdlg/pattern.hrc b/sw/source/ui/frmdlg/pattern.hrc
new file mode 100644
index 000000000000..f9eabe9bb3c5
--- /dev/null
+++ b/sw/source/ui/frmdlg/pattern.hrc
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define BRUSH_LBL 1
+#define BRUSH_LBOX 2
+
+#define COLOR_LBL 3
+#define COLOR_LBOX 4
+
+#define FILLIN_COLOR_LBL 5
+#define FILLIN_COLOR_LBOX 6
+
+#define NO_PATTERN_BOX 7
+
+#define PATTERN_FRM 8
+#define EXAMPLE_FRM 9
+#define EXAMPLE_WIN 10
+
+#define OK_BTN 11
+#define CANCEL_BTN 12
+#define RESET_BTN 13
+
diff --git a/sw/source/ui/frmdlg/uiborder.cxx b/sw/source/ui/frmdlg/uiborder.cxx
new file mode 100644
index 000000000000..2add324b61ee
--- /dev/null
+++ b/sw/source/ui/frmdlg/uiborder.cxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include <svx/svxdlg.hxx>
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include <svl/itemset.hxx>
+#include <svx/flagsdef.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svl/intitem.hxx>
+
+#include "swtypes.hxx"
+#include "uiborder.hxx"
+#include "frmui.hrc"
+
+
+
+
+SwBorderDlg::SwBorderDlg(Window* pParent, SfxItemSet& rSet, USHORT nType) :
+
+ SfxSingleTabDialog(pParent, rSet, 0)
+
+{
+ SetText(SW_RESSTR(STR_FRMUI_BORDER));
+
+ // TabPage erzeugen
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER );
+ if ( fnCreatePage )
+ {
+ SfxTabPage* pNewPage = (*fnCreatePage)( this, rSet );
+ SfxAllItemSet aSet(*(rSet.GetPool()));
+ aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,nType));
+ if(SW_BORDER_MODE_TABLE == nType)
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_HIDESHADOWCTL));
+ pNewPage->PageCreated(aSet);
+ SetTabPage(pNewPage);
+ }
+}
+
+
+
+SwBorderDlg::~SwBorderDlg()
+{
+}
+
+
diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx
new file mode 100644
index 000000000000..b313ebd530eb
--- /dev/null
+++ b/sw/source/ui/frmdlg/wrap.cxx
@@ -0,0 +1,785 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include "hintids.hxx"
+#include <vcl/graph.hxx>
+#include <svx/htmlmode.hxx>
+#include <sfx2/objsh.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/opaqitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+// OD 18.09.2003 #i18732#
+#include <fmtfollowtextflow.hxx>
+#include <svx/swframevalidation.hxx>
+
+
+#include "cmdid.h"
+#include "uitool.hxx"
+#include "wrtsh.hxx"
+#include "swmodule.hxx"
+#include "viewopt.hxx"
+#include "frmatr.hxx"
+#include "frmmgr.hxx"
+#include "globals.hrc"
+#include "frmui.hrc"
+#include "wrap.hrc"
+#include "wrap.hxx"
+
+using namespace ::com::sun::star;
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+static USHORT __FAR_DATA aWrapPageRg[] = {
+ RES_LR_SPACE, RES_UL_SPACE,
+ RES_PROTECT, RES_SURROUND,
+ RES_PRINT, RES_PRINT,
+ 0
+};
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+SwWrapDlg::SwWrapDlg(Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, BOOL bDrawMode) :
+ SfxSingleTabDialog(pParent, rSet, 0),
+ pWrtShell(pSh)
+
+{
+ // TabPage erzeugen
+ SwWrapTabPage* pNewPage = (SwWrapTabPage*) SwWrapTabPage::Create(this, rSet);
+ pNewPage->SetFormatUsed(FALSE, bDrawMode);
+ pNewPage->SetShell(pWrtShell);
+ SetTabPage(pNewPage);
+
+ String sTitle(SW_RES(STR_FRMUI_WRAP));
+ SetText(sTitle);
+}
+
+
+
+SwWrapDlg::~SwWrapDlg()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+SwWrapTabPage::SwWrapTabPage(Window *pParent, const SfxItemSet &rSet) :
+ SfxTabPage(pParent, SW_RES(TP_FRM_WRAP), rSet),
+
+ aWrapFLC (this, SW_RES(C_WRAP_FL)),
+ aNoWrapRB (this, SW_RES(RB_NO_WRAP)),
+ aWrapLeftRB (this, SW_RES(RB_WRAP_LEFT)),
+ aWrapRightRB (this, SW_RES(RB_WRAP_RIGHT)),
+ aWrapParallelRB (this, SW_RES(RB_WRAP_PARALLEL)),
+ aWrapThroughRB (this, SW_RES(RB_WRAP_THROUGH)),
+ aIdealWrapRB (this, SW_RES(RB_WRAP_IDEAL)),
+
+ aMarginFL (this, SW_RES(FL_MARGIN)),
+ aLeftMarginFT (this, SW_RES(FT_LEFT_MARGIN)),
+ aLeftMarginED (this, SW_RES(ED_LEFT_MARGIN)),
+ aRightMarginFT (this, SW_RES(FT_RIGHT_MARGIN)),
+ aRightMarginED (this, SW_RES(ED_RIGHT_MARGIN)),
+ aTopMarginFT (this, SW_RES(FT_TOP_MARGIN)),
+ aTopMarginED (this, SW_RES(ED_TOP_MARGIN)),
+ aBottomMarginFT (this, SW_RES(FT_BOTTOM_MARGIN)),
+ aBottomMarginED (this, SW_RES(ED_BOTTOM_MARGIN)),
+
+ aOptionsSepFL (this, SW_RES(FL_OPTION_SEP)),
+ aOptionsFL (this, SW_RES(FL_OPTION)),
+ aWrapAnchorOnlyCB (this, SW_RES(CB_ANCHOR_ONLY)),
+ aWrapTransparentCB (this, SW_RES(CB_TRANSPARENT)),
+ aWrapOutlineCB (this, SW_RES(CB_OUTLINE)),
+ aWrapOutsideCB (this, SW_RES(CB_ONLYOUTSIDE)),
+
+ aWrapIL (SW_RES(IL_WRAP)),
+ aWrapILH (SW_RES(ILH_WRAP)),
+
+ nAnchorId(FLY_AT_PARA),
+ nHtmlMode(0),
+
+ pWrtSh(0),
+
+ bFormat(FALSE),
+ bNew(TRUE),
+ bHtmlMode(FALSE),
+ bContourImage(FALSE)
+
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ Link aLk = LINK(this, SwWrapTabPage, RangeModifyHdl);
+ aLeftMarginED.SetUpHdl(aLk);
+ aLeftMarginED.SetDownHdl(aLk);
+ aLeftMarginED.SetFirstHdl(aLk);
+ aLeftMarginED.SetLastHdl(aLk);
+ aLeftMarginED.SetLoseFocusHdl(aLk);
+
+ aRightMarginED.SetUpHdl(aLk);
+ aRightMarginED.SetDownHdl(aLk);
+ aRightMarginED.SetFirstHdl(aLk);
+ aRightMarginED.SetLastHdl(aLk);
+ aRightMarginED.SetLoseFocusHdl(aLk);
+
+ aTopMarginED.SetUpHdl(aLk);
+ aTopMarginED.SetDownHdl(aLk);
+ aTopMarginED.SetFirstHdl(aLk);
+ aTopMarginED.SetLastHdl(aLk);
+ aTopMarginED.SetLoseFocusHdl(aLk);
+
+ aBottomMarginED.SetUpHdl(aLk);
+ aBottomMarginED.SetDownHdl(aLk);
+ aBottomMarginED.SetFirstHdl(aLk);
+ aBottomMarginED.SetLastHdl(aLk);
+ aBottomMarginED.SetLoseFocusHdl(aLk);
+
+ aLk = LINK(this, SwWrapTabPage, WrapTypeHdl);
+ aNoWrapRB.SetClickHdl(aLk);
+ aWrapLeftRB.SetClickHdl(aLk);
+ aWrapRightRB.SetClickHdl(aLk);
+ aWrapParallelRB.SetClickHdl(aLk);
+ aWrapThroughRB.SetClickHdl(aLk);
+ aIdealWrapRB.SetClickHdl(aLk);
+ ApplyImageList();
+ aWrapOutlineCB.SetClickHdl(LINK(this, SwWrapTabPage, ContourHdl));
+}
+
+
+
+SwWrapTabPage::~SwWrapTabPage()
+{
+}
+
+
+
+SfxTabPage* SwWrapTabPage::Create(Window *pParent, const SfxItemSet &rSet)
+{
+ return new SwWrapTabPage(pParent, rSet);
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+void SwWrapTabPage::Reset(const SfxItemSet &rSet)
+{
+ //Contour fuer Draw, Grafik und OLE (Einfuegen/Grafik/Eigenschaften fehlt noch!)
+ if( bDrawMode )
+ {
+ aWrapOutlineCB.Show();
+ aWrapOutsideCB.Show();
+
+ aWrapTransparentCB.Check( 0 == ((const SfxInt16Item&)rSet.Get(
+ FN_DRAW_WRAP_DLG)).GetValue() );
+ aWrapTransparentCB.SaveValue();
+ }
+ else
+ {
+ BOOL bShowCB = bFormat;
+ if( !bFormat )
+ {
+ int nSelType = pWrtSh->GetSelectionType();
+ if( ( nSelType & nsSelectionType::SEL_GRF ) ||
+ ( nSelType & nsSelectionType::SEL_OLE && GRAPHIC_NONE !=
+ pWrtSh->GetIMapGraphic().GetType() ))
+ bShowCB = TRUE;
+ }
+ if( bShowCB )
+ {
+ aWrapOutlineCB.Show();
+ aWrapOutsideCB.Show();
+ }
+ }
+
+ nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current());
+ bHtmlMode = nHtmlMode & HTMLMODE_ON ? TRUE : FALSE;
+
+ FieldUnit aMetric = ::GetDfltMetric(bHtmlMode);
+ SetMetric( aLeftMarginED , aMetric );
+ SetMetric( aRightMarginED , aMetric );
+ SetMetric( aTopMarginED , aMetric );
+ SetMetric( aBottomMarginED, aMetric );
+
+ const SwFmtSurround& rSurround = (const SwFmtSurround&)rSet.Get(RES_SURROUND);
+
+ SwSurround nSur = rSurround.GetSurround();
+ const SwFmtAnchor &rAnch = (const SwFmtAnchor&)rSet.Get(RES_ANCHOR);
+ nAnchorId = rAnch.GetAnchorId();
+
+ if (((nAnchorId == FLY_AT_PARA) || (nAnchorId == FLY_AT_CHAR))
+ && (nSur != SURROUND_NONE))
+ {
+ aWrapAnchorOnlyCB.Check( rSurround.IsAnchorOnly() );
+ }
+ else
+ {
+ aWrapAnchorOnlyCB.Enable( FALSE );
+ }
+
+ BOOL bContour = rSurround.IsContour();
+ aWrapOutlineCB.Check( bContour );
+ aWrapOutsideCB.Check( rSurround.IsOutside() );
+ aWrapThroughRB.Enable(!aWrapOutlineCB.IsChecked());
+ bContourImage = !bContour;
+
+ ImageRadioButton* pBtn = NULL;
+
+ switch (nSur)
+ {
+ case SURROUND_NONE:
+ {
+ pBtn = &aNoWrapRB;
+ break;
+ }
+
+ case SURROUND_THROUGHT:
+ {
+ // transparent ?
+ pBtn = &aWrapThroughRB;
+
+ if (!bDrawMode)
+ {
+ const SvxOpaqueItem& rOpaque = (const SvxOpaqueItem&)rSet.Get(RES_OPAQUE);
+ aWrapTransparentCB.Check(!rOpaque.GetValue());
+ }
+ break;
+ }
+
+ case SURROUND_PARALLEL:
+ {
+ pBtn = &aWrapParallelRB;
+ break;
+ }
+
+ case SURROUND_IDEAL:
+ {
+ pBtn = &aIdealWrapRB;
+ break;
+ }
+
+ default:
+ {
+ if (nSur == SURROUND_LEFT)
+ pBtn = &aWrapLeftRB;
+ else if (nSur == SURROUND_RIGHT)
+ pBtn = &aWrapRightRB;
+ }
+ }
+ if (pBtn)
+ {
+ pBtn->Check();
+ WrapTypeHdl(pBtn);
+ // Hier wird fuer Zeichenobjekte, die im Moment auf Durchlauf stehen,
+ // schon mal der Default "Kontur an" vorbereitet, falls man spaeter auf
+ // irgendeinen Umlauf umschaltet.
+ if (bDrawMode && !aWrapOutlineCB.IsEnabled())
+ aWrapOutlineCB.Check();
+ }
+ aWrapTransparentCB.Enable( pBtn == &aWrapThroughRB && !bHtmlMode );
+
+ const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)rSet.Get(RES_UL_SPACE);
+ const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)rSet.Get(RES_LR_SPACE);
+
+ // Abstand zum Text
+ aLeftMarginED.SetValue(aLeftMarginED.Normalize(rLR.GetLeft()), FUNIT_TWIP);
+ aRightMarginED.SetValue(aRightMarginED.Normalize(rLR.GetRight()), FUNIT_TWIP);
+ aTopMarginED.SetValue(aTopMarginED.Normalize(rUL.GetUpper()), FUNIT_TWIP);
+ aBottomMarginED.SetValue(aBottomMarginED.Normalize(rUL.GetLower()), FUNIT_TWIP);
+
+ ContourHdl(0);
+ ActivatePage( rSet );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Attribute in den Set stopfen bei OK
+ --------------------------------------------------------------------*/
+
+
+
+BOOL SwWrapTabPage::FillItemSet(SfxItemSet &rSet)
+{
+ BOOL bModified = FALSE;
+ const SfxPoolItem* pOldItem;
+
+ const SwFmtSurround& rOldSur = (const SwFmtSurround&)GetItemSet().Get(RES_SURROUND);
+ SwFmtSurround aSur( rOldSur );
+
+ SvxOpaqueItem aOp( RES_OPAQUE);
+
+ if (!bDrawMode)
+ {
+ const SvxOpaqueItem& rOpaque = (const SvxOpaqueItem&)GetItemSet().Get(RES_OPAQUE);
+ aOp = rOpaque;
+ aOp.SetValue(TRUE);
+ }
+
+ if (aNoWrapRB.IsChecked())
+ aSur.SetSurround(SURROUND_NONE);
+ else if (aWrapLeftRB.IsChecked())
+ aSur.SetSurround(SURROUND_LEFT);
+ else if (aWrapRightRB.IsChecked())
+ aSur.SetSurround(SURROUND_RIGHT);
+ else if (aWrapParallelRB.IsChecked())
+ aSur.SetSurround(SURROUND_PARALLEL);
+ else if (aWrapThroughRB.IsChecked())
+ {
+ aSur.SetSurround(SURROUND_THROUGHT);
+ if (aWrapTransparentCB.IsChecked() && !bDrawMode)
+ aOp.SetValue(FALSE);
+ }
+ else if (aIdealWrapRB.IsChecked())
+ aSur.SetSurround(SURROUND_IDEAL);
+
+ aSur.SetAnchorOnly( aWrapAnchorOnlyCB.IsChecked() );
+ BOOL bContour = aWrapOutlineCB.IsChecked() && aWrapOutlineCB.IsEnabled();
+ aSur.SetContour( bContour );
+
+ if ( bContour )
+ aSur.SetOutside(aWrapOutsideCB.IsChecked());
+
+ if(0 == (pOldItem = GetOldItem( rSet, RES_SURROUND )) ||
+ aSur != *pOldItem )
+ {
+ rSet.Put(aSur);
+ bModified = TRUE;
+ }
+
+ if (!bDrawMode)
+ {
+ if(0 == (pOldItem = GetOldItem( rSet, FN_OPAQUE )) ||
+ aOp != *pOldItem )
+ {
+ rSet.Put(aOp);
+ bModified = TRUE;
+ }
+ }
+
+ BOOL bTopMod = aTopMarginED.IsValueModified();
+ BOOL bBottomMod = aBottomMarginED.IsValueModified();
+
+ SvxULSpaceItem aUL( RES_UL_SPACE );
+ aUL.SetUpper((USHORT)aTopMarginED.Denormalize(aTopMarginED.GetValue(FUNIT_TWIP)));
+ aUL.SetLower((USHORT)aBottomMarginED.Denormalize(aBottomMarginED.GetValue(FUNIT_TWIP)));
+
+ if ( bTopMod || bBottomMod )
+ {
+ if(0 == (pOldItem = GetOldItem(rSet, RES_UL_SPACE)) ||
+ aUL != *pOldItem )
+ {
+ rSet.Put( aUL, RES_UL_SPACE );
+ bModified = TRUE;
+ }
+ }
+
+ BOOL bLeftMod = aLeftMarginED.IsValueModified();
+ BOOL bRightMod = aRightMarginED.IsValueModified();
+
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ aLR.SetLeft((USHORT)aLeftMarginED.Denormalize(aLeftMarginED.GetValue(FUNIT_TWIP)));
+ aLR.SetRight((USHORT)aRightMarginED.Denormalize(aRightMarginED.GetValue(FUNIT_TWIP)));
+
+ if ( bLeftMod || bRightMod )
+ {
+ if( 0 == (pOldItem = GetOldItem(rSet, RES_LR_SPACE)) ||
+ aLR != *pOldItem )
+ {
+ rSet.Put(aLR, RES_LR_SPACE);
+ bModified = TRUE;
+ }
+ }
+
+ if ( bDrawMode )
+ {
+ BOOL bChecked = aWrapTransparentCB.IsChecked() & aWrapTransparentCB.IsEnabled();
+ if (aWrapTransparentCB.GetSavedValue() != bChecked)
+ bModified |= 0 != rSet.Put(SfxInt16Item(FN_DRAW_WRAP_DLG, bChecked ? 0 : 1));
+ }
+
+ return bModified;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bsp - Update
+ --------------------------------------------------------------------*/
+
+
+
+void SwWrapTabPage::ActivatePage(const SfxItemSet& rSet)
+{
+ // Anchor
+ const SwFmtAnchor &rAnch = (const SwFmtAnchor&)rSet.Get(RES_ANCHOR);
+ nAnchorId = rAnch.GetAnchorId();
+ BOOL bEnable = (nAnchorId != FLY_AS_CHAR);
+
+ if (!bDrawMode)
+ {
+ SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell() : pWrtSh;
+ SwFlyFrmAttrMgr aMgr( bNew, pSh, (const SwAttrSet&)GetItemSet() );
+ SvxSwFrameValidation aVal;
+
+ // Size
+ const SwFmtFrmSize& rFrmSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE);
+ Size aSize = rFrmSize.GetSize();
+
+ // Rand
+ const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)rSet.Get(RES_UL_SPACE);
+ const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)rSet.Get(RES_LR_SPACE);
+ nOldLeftMargin = static_cast< USHORT >(rLR.GetLeft());
+ nOldRightMargin = static_cast< USHORT >(rLR.GetRight());
+ nOldUpperMargin = static_cast< USHORT >(rUL.GetUpper());
+ nOldLowerMargin = static_cast< USHORT >(rUL.GetLower());
+
+ // Position
+ const SwFmtHoriOrient& rHori = (const SwFmtHoriOrient&)rSet.Get(RES_HORI_ORIENT);
+ const SwFmtVertOrient& rVert = (const SwFmtVertOrient&)rSet.Get(RES_VERT_ORIENT);
+
+ aVal.nAnchorType = static_cast< sal_Int16 >(nAnchorId);
+ aVal.bAutoHeight = rFrmSize.GetHeightSizeType() == ATT_MIN_SIZE;
+ aVal.bAutoWidth = rFrmSize.GetWidthSizeType() == ATT_MIN_SIZE;
+ aVal.bMirror = rHori.IsPosToggle();
+ // OD 18.09.2003 #i18732#
+ aVal.bFollowTextFlow =
+ static_cast<const SwFmtFollowTextFlow&>(rSet.Get(RES_FOLLOW_TEXT_FLOW)).GetValue();
+
+ aVal.nHoriOrient = (short)rHori.GetHoriOrient();
+ aVal.nVertOrient = (short)rVert.GetVertOrient();
+
+ aVal.nHPos = rHori.GetPos();
+ aVal.nHRelOrient = rHori.GetRelationOrient();
+ aVal.nVPos = rVert.GetPos();
+ aVal.nVRelOrient = rVert.GetRelationOrient();
+
+ if (rFrmSize.GetWidthPercent() && rFrmSize.GetWidthPercent() != 0xff)
+ aSize.Width() = aSize.Width() * rFrmSize.GetWidthPercent() / 100;
+
+ if (rFrmSize.GetHeightPercent() && rFrmSize.GetHeightPercent() != 0xff)
+ aSize.Height() = aSize.Height() * rFrmSize.GetHeightPercent() / 100;
+
+ aVal.nWidth = aSize.Width();
+ aVal.nHeight = aSize.Height();
+ aFrmSize = aSize;
+
+ aMgr.ValidateMetrics(aVal, 0);
+
+ SwTwips nLeft;
+ SwTwips nRight;
+ SwTwips nTop;
+ SwTwips nBottom;
+
+ nLeft = aVal.nHPos - aVal.nMinHPos;
+ nRight = aVal.nMaxWidth - aVal.nWidth;
+ nTop = aVal.nVPos - aVal.nMinVPos;
+ nBottom = aVal.nMaxHeight - aVal.nHeight;
+
+ if (bHtmlMode && 0 == (nHtmlMode & HTMLMODE_FULL_ABS_POS))
+ {
+ nLeft = nRight = ( nLeft + nRight ) / 2;
+ nTop = nBottom = ( nTop + nBottom ) / 2;
+ }
+ else
+ {
+ if (aVal.nAnchorType == FLY_AS_CHAR)
+ {
+ nLeft = nRight;
+
+ if (aVal.nVPos < 0)
+ {
+ if (aVal.nVPos <= aVal.nMaxHeight)
+ nTop = aVal.nMaxVPos - aVal.nHeight;
+ else
+ nTop = nBottom = 0; // Kein Umlauf
+ }
+ else
+ nTop = aVal.nMaxVPos - aVal.nHeight - aVal.nVPos;
+ }
+ else
+ {
+ nLeft += nRight;
+ nTop += nBottom;
+ }
+
+ nBottom = nTop;
+ nRight = nLeft;
+ }
+
+ aLeftMarginED.SetMax(aLeftMarginED.Normalize(nLeft), FUNIT_TWIP);
+ aRightMarginED.SetMax(aRightMarginED.Normalize(nRight), FUNIT_TWIP);
+
+ aTopMarginED.SetMax(aTopMarginED.Normalize(nTop), FUNIT_TWIP);
+ aBottomMarginED.SetMax(aBottomMarginED.Normalize(nBottom), FUNIT_TWIP);
+
+ RangeModifyHdl(&aLeftMarginED);
+ RangeModifyHdl(&aTopMarginED);
+ }
+
+ const SwFmtSurround& rSurround = (const SwFmtSurround&)rSet.Get(RES_SURROUND);
+ SwSurround nSur = rSurround.GetSurround();
+
+ aWrapTransparentCB.Enable( bEnable && !bHtmlMode && nSur == SURROUND_THROUGHT );
+ if(bHtmlMode)
+ {
+ BOOL bSomeAbsPos = 0 != (nHtmlMode & HTMLMODE_SOME_ABS_POS);
+ const SwFmtHoriOrient& rHori = (const SwFmtHoriOrient&)rSet.Get(RES_HORI_ORIENT);
+ sal_Int16 eHOrient = rHori.GetHoriOrient();
+ sal_Int16 eHRelOrient = rHori.GetRelationOrient();
+ aWrapOutlineCB.Hide();
+ const bool bAllHtmlModes =
+ ((nAnchorId == FLY_AT_PARA) || (nAnchorId == FLY_AT_CHAR)) &&
+ (eHOrient == text::HoriOrientation::RIGHT || eHOrient == text::HoriOrientation::LEFT);
+ aWrapAnchorOnlyCB.Enable( bAllHtmlModes && nSur != SURROUND_NONE );
+ aWrapOutsideCB.Hide();
+ aIdealWrapRB.Enable( FALSE );
+
+
+ aWrapTransparentCB.Enable( FALSE );
+ aNoWrapRB.Enable( FLY_AT_PARA == nAnchorId );
+ aWrapParallelRB.Enable( FALSE );
+ aWrapLeftRB .Enable
+ ( (FLY_AT_PARA == nAnchorId)
+ || ( (FLY_AT_CHAR == nAnchorId)
+ && (eHOrient == text::HoriOrientation::RIGHT)
+ && (eHRelOrient == text::RelOrientation::PRINT_AREA)));
+ aWrapRightRB .Enable
+ ( (FLY_AT_PARA == nAnchorId)
+ || ( (FLY_AT_CHAR == nAnchorId)
+ && (eHOrient == text::HoriOrientation::LEFT)
+ && (eHRelOrient == text::RelOrientation::PRINT_AREA)));
+
+ aWrapThroughRB.Enable
+ ( ( (FLY_AT_PAGE == nAnchorId)
+ || ( (FLY_AT_CHAR == nAnchorId)
+ && (eHRelOrient != text::RelOrientation::PRINT_AREA))
+ || (FLY_AT_PARA == nAnchorId))
+ && bSomeAbsPos
+ && (eHOrient != text::HoriOrientation::RIGHT));
+ if(aNoWrapRB.IsChecked() && !aNoWrapRB.IsEnabled())
+ {
+ if(aWrapThroughRB.IsEnabled())
+ aWrapThroughRB.Check(TRUE);
+ else if(aWrapLeftRB.IsEnabled())
+ aWrapLeftRB.Check();
+ else if(aWrapRightRB.IsEnabled())
+ aWrapRightRB.Check();
+
+ }
+ if(aWrapLeftRB.IsChecked() && !aWrapLeftRB.IsEnabled())
+ {
+ if(aWrapRightRB.IsEnabled())
+ aWrapRightRB.Check();
+ else if(aWrapThroughRB.IsEnabled())
+ aWrapThroughRB.Check();
+ }
+ if(aWrapRightRB.IsChecked() && !aWrapRightRB.IsEnabled())
+ {
+ if(aWrapLeftRB.IsEnabled())
+ aWrapLeftRB.Check();
+ else if(aWrapThroughRB.IsEnabled())
+ aWrapThroughRB.Check();
+ }
+ if(aWrapThroughRB.IsChecked() && !aWrapThroughRB.IsEnabled())
+ if(aNoWrapRB.IsEnabled())
+ aNoWrapRB.Check();
+
+ if(aWrapParallelRB.IsChecked() && !aWrapParallelRB.IsEnabled())
+ aWrapThroughRB.Check();
+ }
+ else
+ {
+ aNoWrapRB.Enable( bEnable );
+ aWrapLeftRB.Enable( bEnable );
+ aWrapRightRB.Enable( bEnable );
+ aIdealWrapRB.Enable( bEnable );
+ aWrapThroughRB.Enable( bEnable );
+ aWrapParallelRB.Enable( bEnable );
+ aWrapAnchorOnlyCB.Enable(
+ ((nAnchorId == FLY_AT_PARA) || (nAnchorId == FLY_AT_CHAR))
+ && nSur != SURROUND_NONE );
+ }
+ ContourHdl(0);
+}
+
+
+
+int SwWrapTabPage::DeactivatePage(SfxItemSet* _pSet)
+{
+ if(_pSet)
+ FillItemSet(*_pSet);
+
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bereichspruefung
+ --------------------------------------------------------------------*/
+
+
+
+IMPL_LINK( SwWrapTabPage, RangeModifyHdl, MetricField *, pEdit )
+{
+ if(bHtmlMode && 0 == (nHtmlMode & HTMLMODE_FULL_ABS_POS))
+ {
+ sal_Int64 nValue = pEdit->GetValue();
+ if (pEdit == &aLeftMarginED)
+ aRightMarginED.SetUserValue(nValue, FUNIT_NONE);
+ else if (pEdit == &aRightMarginED)
+ aLeftMarginED.SetUserValue(nValue, FUNIT_NONE);
+ else if (pEdit == &aTopMarginED)
+ aBottomMarginED.SetUserValue(nValue, FUNIT_NONE);
+ else if (pEdit == &aBottomMarginED)
+ aTopMarginED.SetUserValue(nValue, FUNIT_NONE);
+ }
+ else
+ {
+ sal_Int64 nValue = pEdit->GetValue();
+ MetricField *pOpposite = 0;
+
+ if (pEdit == &aLeftMarginED)
+ pOpposite = &aRightMarginED;
+ else if (pEdit == &aRightMarginED)
+ pOpposite = &aLeftMarginED;
+ else if (pEdit == &aTopMarginED)
+ pOpposite = &aBottomMarginED;
+ else if (pEdit == &aBottomMarginED)
+ pOpposite = &aTopMarginED;
+
+ sal_Int64 nOpposite = pOpposite->GetValue();
+
+ if (nValue + nOpposite > Max(pEdit->GetMax(), pOpposite->GetMax()))
+ pOpposite->SetValue(pOpposite->GetMax() - nValue);
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+IMPL_LINK( SwWrapTabPage, WrapTypeHdl, ImageRadioButton *, pBtn )
+{
+ BOOL bWrapThrough = (pBtn == &aWrapThroughRB);
+ aWrapTransparentCB.Enable( bWrapThrough && !bHtmlMode );
+ bWrapThrough |= ( nAnchorId == FLY_AS_CHAR );
+ aWrapOutlineCB.Enable( !bWrapThrough && pBtn != &aNoWrapRB);
+ aWrapOutsideCB.Enable( !bWrapThrough && aWrapOutlineCB.IsChecked() );
+ aWrapAnchorOnlyCB.Enable(
+ ((nAnchorId == FLY_AT_PARA) || (nAnchorId == FLY_AT_CHAR)) &&
+ (pBtn != &aNoWrapRB) );
+
+ ContourHdl(0);
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+IMPL_LINK( SwWrapTabPage, ContourHdl, CheckBox *, EMPTYARG )
+{
+ BOOL bEnable = !(aWrapOutlineCB.IsChecked() && aWrapOutlineCB.IsEnabled());
+
+ aWrapOutsideCB.Enable(!bEnable);
+
+ bEnable = !aWrapOutlineCB.IsChecked();
+ if (bEnable == bContourImage) // damit es nicht immer flackert
+ {
+ bContourImage = !bEnable;
+ ApplyImageList();
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+USHORT* SwWrapTabPage::GetRanges()
+{
+ return aWrapPageRg;
+}
+/* -----------------------------08.05.2002 14:28------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwWrapTabPage::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ ApplyImageList();
+
+ SfxTabPage::DataChanged( rDCEvt );
+}
+/* -----------------------------08.05.2002 14:28------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwWrapTabPage::ApplyImageList()
+{
+ ImageList& rImgLst = GetSettings().GetStyleSettings().GetHighContrastMode() ?
+ aWrapILH : aWrapIL;
+
+ aWrapThroughRB.SetModeRadioImage(rImgLst.GetImage(IMG_THROUGH));
+ BOOL bWrapOutline = !aWrapOutlineCB.IsChecked();
+ if(bWrapOutline)
+ {
+ aNoWrapRB.SetModeRadioImage(rImgLst.GetImage(IMG_NONE));
+ aWrapLeftRB.SetModeRadioImage(rImgLst.GetImage(IMG_LEFT));
+ aWrapRightRB.SetModeRadioImage(rImgLst.GetImage(IMG_RIGHT));
+ aWrapParallelRB.SetModeRadioImage(rImgLst.GetImage(IMG_PARALLEL));
+ aIdealWrapRB.SetModeRadioImage(rImgLst.GetImage(IMG_IDEAL));
+ }
+ else
+ {
+ aNoWrapRB.SetModeRadioImage(rImgLst.GetImage( IMG_KON_NONE ));
+ aWrapLeftRB.SetModeRadioImage(rImgLst.GetImage( IMG_KON_LEFT ));
+ aWrapRightRB.SetModeRadioImage(rImgLst.GetImage( IMG_KON_RIGHT ));
+ aWrapParallelRB.SetModeRadioImage(rImgLst.GetImage(IMG_KON_PARALLEL ));
+ aIdealWrapRB.SetModeRadioImage(rImgLst.GetImage( IMG_KON_IDEAL ));
+ }
+}
diff --git a/sw/source/ui/frmdlg/wrap.hrc b/sw/source/ui/frmdlg/wrap.hrc
new file mode 100644
index 000000000000..be19dbe702c2
--- /dev/null
+++ b/sw/source/ui/frmdlg/wrap.hrc
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define RB_NO_WRAP 2
+#define RB_WRAP_LEFT 3
+#define RB_WRAP_RIGHT 4
+#define RB_WRAP_PARALLEL 5
+#define RB_WRAP_THROUGH 6
+#define RB_WRAP_IDEAL 7
+#define CB_ANCHOR_ONLY 8
+#define FT_LEFT_MARGIN 13
+#define ED_LEFT_MARGIN 14
+#define FT_RIGHT_MARGIN 15
+#define ED_RIGHT_MARGIN 16
+#define FT_TOP_MARGIN 17
+#define ED_TOP_MARGIN 18
+#define ED_BOTTOM_MARGIN 19
+#define FT_BOTTOM_MARGIN 20
+#define FL_MARGIN 21
+#define CB_TRANSPARENT 22
+#define CB_OUTLINE 23
+#define FL_OPTION 24
+#define CB_ONLYOUTSIDE 25
+#define FL_OPTION_SEP 26
+#define C_WRAP_FL 31
+
+#define IL_WRAP 32
+#define ILH_WRAP 33
+// nur fuer die ImageList
+#define IMG_BEGIN 1
+#define IMG_NONE (IMG_BEGIN)
+#define IMG_LEFT (IMG_BEGIN + 1)
+#define IMG_RIGHT (IMG_BEGIN + 2)
+#define IMG_PARALLEL (IMG_BEGIN + 3)
+#define IMG_THROUGH (IMG_BEGIN + 4)
+#define IMG_IDEAL (IMG_BEGIN + 5)
+#define IMG_KON_NONE (IMG_BEGIN + 6)
+#define IMG_KON_LEFT (IMG_BEGIN + 7)
+#define IMG_KON_RIGHT (IMG_BEGIN + 8)
+#define IMG_KON_PARALLEL (IMG_BEGIN + 9)
+#define IMG_KON_IDEAL (IMG_BEGIN + 10)
+
+
diff --git a/sw/source/ui/frmdlg/wrap.src b/sw/source/ui/frmdlg/wrap.src
new file mode 100644
index 000000000000..a3f23e79624b
--- /dev/null
+++ b/sw/source/ui/frmdlg/wrap.src
@@ -0,0 +1,271 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "frmui.hrc"
+#include "wrap.hrc"
+#include "globals.hrc"
+#include "helpid.h"
+TabPage TP_FRM_WRAP
+{
+ SVLook = TRUE ;
+ HelpID = HID_FRM_EXT ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ FixedLine C_WRAP_FL
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Settings";
+ };
+ ImageRadioButton RB_NO_WRAP
+ {
+ HelpID = "sw:ImageRadioButton:TP_FRM_WRAP:RB_NO_WRAP";
+ Pos = MAP_APPFONT ( 6 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 37 ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "~None" ;
+ TopImage = True ;
+ };
+ ImageRadioButton RB_WRAP_LEFT
+ {
+ HelpID = "sw:ImageRadioButton:TP_FRM_WRAP:RB_WRAP_LEFT";
+ Pos = MAP_APPFONT ( 65 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 37 ) ;
+ WordBreak = TRUE;
+ TopImage = True ;
+ Text [ en-US ] = "Before" ;
+ };
+ ImageRadioButton RB_WRAP_RIGHT
+ {
+ HelpID = "sw:ImageRadioButton:TP_FRM_WRAP:RB_WRAP_RIGHT";
+ Pos = MAP_APPFONT ( 121 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 37 ) ;
+ WordBreak = TRUE;
+ TopImage = True ;
+ Text [ en-US ] = "After" ;
+ };
+ ImageRadioButton RB_WRAP_PARALLEL
+ {
+ HelpID = "sw:ImageRadioButton:TP_FRM_WRAP:RB_WRAP_PARALLEL";
+ Pos = MAP_APPFONT ( 177 , 14 ) ;
+ Size = MAP_APPFONT ( 40 , 37 ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "~Parallel" ;
+ TopImage = True ;
+ };
+ ImageRadioButton RB_WRAP_THROUGH
+ {
+ HelpID = "sw:ImageRadioButton:TP_FRM_WRAP:RB_WRAP_THROUGH";
+ Pos = MAP_APPFONT ( 6 , 57 ) ;
+ Size = MAP_APPFONT ( 40 , 37 ) ;
+ WordBreak = TRUE;
+ Text [ en-US ] = "Thro~ugh" ;
+ TopImage = True ;
+ };
+ ImageRadioButton RB_WRAP_IDEAL
+ {
+ HelpID = "sw:ImageRadioButton:TP_FRM_WRAP:RB_WRAP_IDEAL";
+ Pos = MAP_APPFONT ( 65 , 57 ) ;
+ Size = MAP_APPFONT ( 40 , 37 ) ;
+ WordBreak = TRUE;
+ TopImage = True ;
+ Text [ en-US ] = "~Optimal" ;
+ };
+
+ CheckBox CB_ANCHOR_ONLY
+ {
+ HelpID = "sw:CheckBox:TP_FRM_WRAP:CB_ANCHOR_ONLY";
+ Pos = MAP_APPFONT ( 139 , 111 ) ;
+ Size = MAP_APPFONT ( 109 , 10 ) ;
+ Text [ en-US ] = "~First paragraph" ;
+ };
+ CheckBox CB_TRANSPARENT
+ {
+ HelpID = "sw:CheckBox:TP_FRM_WRAP:CB_TRANSPARENT";
+ Pos = MAP_APPFONT ( 139 , 125 ) ;
+ Size = MAP_APPFONT ( 109 , 10 ) ;
+ Text [ en-US ] = "In bac~kground" ;
+ };
+ CheckBox CB_OUTLINE
+ {
+ HelpID = "sw:CheckBox:TP_FRM_WRAP:CB_OUTLINE";
+ Pos = MAP_APPFONT ( 139 , 139 ) ;
+ Size = MAP_APPFONT ( 109 , 10 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "~Contour" ;
+ };
+ CheckBox CB_ONLYOUTSIDE
+ {
+ HelpID = "sw:CheckBox:TP_FRM_WRAP:CB_ONLYOUTSIDE";
+ Pos = MAP_APPFONT ( 139 , 153 ) ;
+ Size = MAP_APPFONT ( 109 , 10 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Outside only" ;
+ };
+ FixedLine FL_OPTION
+ {
+ Pos = MAP_APPFONT ( 133 , 100 ) ;
+ Size = MAP_APPFONT ( 121 , 8 ) ;
+ Text [ en-US ] = "Options" ;
+ };
+ FixedLine FL_OPTION_SEP
+ {
+ Pos = MAP_APPFONT ( 128 , 111 ) ;
+ Size = MAP_APPFONT ( 4 , 60 ) ;
+ Vert = TRUE;
+ };
+ FixedText FT_LEFT_MARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 113 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "L~eft" ;
+ Left = TRUE ;
+ };
+ MetricField ED_LEFT_MARGIN
+ {
+ HelpID = "sw:MetricField:TP_FRM_WRAP:ED_LEFT_MARGIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 81 , 111 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_RIGHT_MARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 129 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Right" ;
+ Left = TRUE ;
+ };
+ MetricField ED_RIGHT_MARGIN
+ {
+ HelpID = "sw:MetricField:TP_FRM_WRAP:ED_RIGHT_MARGIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 81 , 127 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_TOP_MARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 145 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Top" ;
+ Left = TRUE ;
+ };
+ MetricField ED_TOP_MARGIN
+ {
+ HelpID = "sw:MetricField:TP_FRM_WRAP:ED_TOP_MARGIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 81 , 143 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_BOTTOM_MARGIN
+ {
+ Pos = MAP_APPFONT ( 12 , 161 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Bottom" ;
+ Left = TRUE ;
+ };
+ MetricField ED_BOTTOM_MARGIN
+ {
+ HelpID = "sw:MetricField:TP_FRM_WRAP:ED_BOTTOM_MARGIN";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 81 , 159 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedLine FL_MARGIN
+ {
+ Pos = MAP_APPFONT ( 6 , 100 ) ;
+ Size = MAP_APPFONT ( 121 , 8 ) ;
+ Text [ en-US ] = "Spacing" ;
+ };
+#define WRAP_IDLIST \
+ IdList = \
+ { \
+ IMG_NONE ; \
+ IMG_LEFT ; \
+ IMG_RIGHT ; \
+ IMG_PARALLEL ; \
+ IMG_THROUGH ; \
+ IMG_IDEAL ; \
+ IMG_KON_NONE ; \
+ IMG_KON_LEFT ; \
+ IMG_KON_RIGHT ; \
+ IMG_KON_PARALLEL ;\
+ IMG_KON_IDEAL ;\
+ }; \
+ IdCount = { 11 ; };
+
+ ImageList IL_WRAP
+ {
+ Prefix = "wr";
+ MaskColor = IMAGE_MASK_COLOR ;
+ WRAP_IDLIST
+ };
+ ImageList ILH_WRAP
+ {
+ Prefix = "wrh";
+ MaskColor = IMAGE_MASK_COLOR ;
+ WRAP_IDLIST
+ };
+
+};
+
diff --git a/sw/source/ui/globdoc/globdoc.cxx b/sw/source/ui/globdoc/globdoc.cxx
new file mode 100644
index 000000000000..a4572f0a16da
--- /dev/null
+++ b/sw/source/ui/globdoc/globdoc.cxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include <sot/clsids.hxx>
+#include <unotools/moduleoptions.hxx>
+
+#include <unomid.h>
+
+#include "swtypes.hxx"
+#include "shellio.hxx"
+#include "globdoc.hxx"
+#include "globdoc.hrc"
+#include "cfgid.h"
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Alle Filter registrieren
+ --------------------------------------------------------------------*/
+
+TYPEINIT1(SwGlobalDocShell, SwDocShell);
+
+//-------------------------------------------------------------------------
+SFX_IMPL_OBJECTFACTORY( SwGlobalDocShell, SvGlobalName(SO3_SWGLOB_CLASSID), SFXOBJECTSHELL_STD_NORMAL|SFXOBJECTSHELL_HASMENU, "swriter/GlobalDocument" )
+
+SwGlobalDocShell::SwGlobalDocShell(SfxObjectCreateMode eMode ) :
+ SwDocShell(eMode)
+{
+}
+
+SwGlobalDocShell::~SwGlobalDocShell()
+{
+}
+
+void SwGlobalDocShell::FillClass( SvGlobalName * pClassName,
+ sal_uInt32 * pClipFormat,
+ String * /*pAppName*/,
+ String * pLongUserName,
+ String * pUserName,
+ sal_Int32 nVersion,
+ sal_Bool bTemplate /* = sal_False */) const
+{
+ (void)bTemplate;
+ DBG_ASSERT( bTemplate == sal_False, "No template for Writer Global" );
+
+ if (nVersion == SOFFICE_FILEFORMAT_60)
+ {
+ *pClassName = SvGlobalName( SO3_SWGLOB_CLASSID_60 );
+ *pClipFormat = SOT_FORMATSTR_ID_STARWRITERGLOB_60;
+ *pLongUserName = SW_RESSTR(STR_WRITER_GLOBALDOC_FULLTYPE);
+ }
+ else if (nVersion == SOFFICE_FILEFORMAT_8)
+ {
+ *pClassName = SvGlobalName( SO3_SWGLOB_CLASSID_60 );
+ *pClipFormat = SOT_FORMATSTR_ID_STARWRITERGLOB_8;
+ *pLongUserName = SW_RESSTR(STR_WRITER_GLOBALDOC_FULLTYPE);
+ }
+
+ *pUserName = SW_RESSTR(STR_HUMAN_SWGLOBDOC_NAME);
+}
+
+
+
diff --git a/sw/source/ui/globdoc/globdoc.src b/sw/source/ui/globdoc/globdoc.src
new file mode 100644
index 000000000000..80cd202da1d3
--- /dev/null
+++ b/sw/source/ui/globdoc/globdoc.src
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globdoc.hrc"
+String STR_HUMAN_SWGLOBDOC_NAME
+{
+ Text [ en-US ] = "Master Document" ;
+};
+String STR_WRITER_GLOBALDOC_FULLTYPE_40
+{
+ Text = "%PRODUCTNAME 4.0 Global Document" ;
+};
+String STR_WRITER_GLOBALDOC_FULLTYPE_50
+{
+ Text = "%PRODUCTNAME 5.0 Global Document" ;
+};
+String STR_WRITER_GLOBALDOC_FULLTYPE
+{
+ Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION Master Document";
+};
+
diff --git a/sw/source/ui/inc/DropDownFieldDialog.hxx b/sw/source/ui/inc/DropDownFieldDialog.hxx
new file mode 100644
index 000000000000..26b01ae4accb
--- /dev/null
+++ b/sw/source/ui/inc/DropDownFieldDialog.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_DROPDOWNFIELDDIALOG_HXX
+#define _SW_DROPDOWNFIELDDIALOG_HXX
+
+#include <svx/stddlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+class SwDropDownField;
+class SwField;
+class SwWrtShell;
+
+/*--------------------------------------------------------------------
+ Dialog to edit drop down field selection
+ --------------------------------------------------------------------*/
+namespace sw
+{
+class DropDownFieldDialog : public SvxStandardDialog
+{
+ FixedLine aItemsFL;
+ ListBox aListItemsLB;
+
+ OKButton aOKPB;
+ CancelButton aCancelPB;
+ PushButton aNextPB;
+ HelpButton aHelpPB;
+
+ PushButton aEditPB;
+
+ SwWrtShell &rSh;
+ SwDropDownField* pDropField;
+
+ DECL_LINK(ButtonHdl, PushButton*);
+ virtual void Apply();
+public:
+ DropDownFieldDialog( Window *pParent, SwWrtShell &rSh,
+ SwField* pField, BOOL bNextButton = FALSE );
+ ~DropDownFieldDialog();
+};
+} //namespace sw
+
+
+#endif
diff --git a/sw/source/ui/inc/SidebarWindowsConsts.hxx b/sw/source/ui/inc/SidebarWindowsConsts.hxx
new file mode 100644
index 000000000000..378b2be0790a
--- /dev/null
+++ b/sw/source/ui/inc/SidebarWindowsConsts.hxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: $
+ *
+ * $Revision: $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SIDEBARWINDOWSCONSTS_HXX
+#define _SIDEBARWINDOWSCONSTS_HXX
+
+namespace sw { namespace sidebarwindows {
+
+const sal_Int8 ANCHORLINE_WIDTH = 1;
+
+} } // end of namespace sw::sidebarwindows
+
+#endif
diff --git a/sw/source/ui/inc/SwSpellDialogChildWindow.hxx b/sw/source/ui/inc/SwSpellDialogChildWindow.hxx
new file mode 100644
index 000000000000..dd3e7e2dce9b
--- /dev/null
+++ b/sw/source/ui/inc/SwSpellDialogChildWindow.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_SPELL_DIALOG_CHILD_WINDOW_HXX
+#define SW_SPELL_DIALOG_CHILD_WINDOW_HXX
+
+#include <svx/SpellDialogChildWindow.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+
+class SwWrtShell;
+struct SpellState;
+class SwSpellDialogChildWindow
+ : public ::svx::SpellDialogChildWindow
+{
+ bool m_bIsGrammarCheckingOn;
+ SpellState* m_pSpellState;
+
+ SwWrtShell* GetWrtShell_Impl();
+ bool MakeTextSelection_Impl(SwWrtShell& rSh, ShellModes eSelMode);
+ bool FindNextDrawTextError_Impl(SwWrtShell& rSh);
+ bool SpellDrawText_Impl(SwWrtShell& rSh, ::svx::SpellPortions& rPortions);
+ void LockFocusNotification(bool bLock);
+
+protected:
+ virtual svx::SpellPortions GetNextWrongSentence(bool bRecheck);
+ virtual void ApplyChangedSentence(const svx::SpellPortions& rChanged, bool bRecheck);
+ virtual void AddAutoCorrection(const String& rOld, const String& rNew, LanguageType eLanguage);
+ virtual bool HasAutoCorrection();
+ virtual bool HasGrammarChecking();
+ virtual bool IsGrammarChecking();
+ virtual void SetGrammarChecking(bool bOn);
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+public:
+ SwSpellDialogChildWindow (
+ Window*pParent,
+ USHORT nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo);
+ ~SwSpellDialogChildWindow();
+
+ SFX_DECL_CHILDWINDOW(SwSpellDialogChildWindow);
+
+ void InvalidateSpellDialog();
+
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/SwXFilterOptions.hxx b/sw/source/ui/inc/SwXFilterOptions.hxx
new file mode 100644
index 000000000000..c1dcc3676447
--- /dev/null
+++ b/sw/source/ui/inc/SwXFilterOptions.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWXFILTEROPTIONS_HXX
+#define _SWXFILTEROPTIONS_HXX
+
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase5.hxx>
+
+namespace com { namespace sun { namespace star { namespace io {
+ class XInputStream;
+} } } }
+
+
+/* -----------------------------2002/06/21 12:07------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwXFilterOptions : public ::cppu::WeakImplHelper5<
+ ::com::sun::star::beans::XPropertyAccess,
+ ::com::sun::star::ui::dialogs::XExecutableDialog,
+ ::com::sun::star::document::XImporter,
+ ::com::sun::star::document::XExporter,
+ ::com::sun::star::lang::XServiceInfo >
+{
+ ::rtl::OUString sFilterName;
+ ::rtl::OUString sFilterOptions;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::io::XInputStream > xInputStream;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent > xModel;
+ sal_Bool bExport;
+
+public:
+ SwXFilterOptions();
+ virtual ~SwXFilterOptions();
+
+ static ::rtl::OUString getImplementationName_Static();
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString> getSupportedServiceNames_Static();
+
+ // XPropertyAccess
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ SAL_CALL getPropertyValues() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue >& aProps )
+ throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XExecutableDialog
+ virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL execute() throw (::com::sun::star::uno::RuntimeException);
+
+ // XImporter
+ virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent >& xDoc )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XExporter
+ virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XComponent >& xDoc )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw(::com::sun::star::uno::RuntimeException);
+
+};
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ SwXFilterOptions_createInstance(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory >& );
+
+#endif
+
+
diff --git a/sw/source/ui/inc/abstract.hxx b/sw/source/ui/inc/abstract.hxx
new file mode 100644
index 000000000000..6700212aa0c3
--- /dev/null
+++ b/sw/source/ui/inc/abstract.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ABSTRACT_HXX
+#define _ABSTRACT_HXX
+
+#include <sfx2/basedlgs.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+
+/*-----------------22.02.97 15.06-------------------
+
+--------------------------------------------------*/
+class SwInsertAbstractDlg : public SfxModalDialog
+{
+ FixedLine aFL;
+ FixedText aLevelFT;
+ NumericField aLevelNF;
+ FixedText aParaFT;
+ NumericField aParaNF;
+ FixedText aDescFT;
+ OKButton aOkPB;
+ CancelButton aCancelPB;
+ HelpButton aHelpPB;
+
+protected:
+
+public:
+ SwInsertAbstractDlg( Window* pParent );
+ ~SwInsertAbstractDlg();
+
+ BYTE GetLevel() const;
+ BYTE GetPara() const;
+};
+
+#endif
+
+
+
diff --git a/sw/source/ui/inc/actctrl.hxx b/sw/source/ui/inc/actctrl.hxx
new file mode 100644
index 000000000000..d1e9a3d82907
--- /dev/null
+++ b/sw/source/ui/inc/actctrl.hxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ACTCTRL_HXX
+#define _ACTCTRL_HXX
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#include "swdllapi.h"
+
+/*--------------------------------------------------------------------
+ Beschreibung: numerische Eingabe
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC NumEditAction: public NumericField
+{
+ Link aActionLink;
+
+protected:
+ virtual void Action();
+ virtual long Notify( NotifyEvent& rNEvt );
+public:
+ NumEditAction( Window* pParent, const ResId& rResId ) :
+ NumericField(pParent, rResId) {}
+
+ void SetActionHdl( const Link& rLink ) { aActionLink = rLink;}
+ const Link& GetActionHdl() const { return aActionLink; }
+};
+
+
+/* -----------------21.04.98 08:11-------------------
+ * Edit, dass keine Spaces akzeptiert
+ * --------------------------------------------------*/
+class SW_DLLPUBLIC NoSpaceEdit : public Edit
+{
+ String sForbiddenChars;
+protected:
+ virtual void KeyInput( const KeyEvent& );
+ virtual void Modify();
+
+public:
+ NoSpaceEdit( Window* pParent, const ResId& rResId);
+ virtual ~NoSpaceEdit();
+ void SetForbiddenChars(const String& rSet){sForbiddenChars = rSet;}
+ const String& GetForbiddenChars(){return sForbiddenChars;}
+};
+
+/* -----------------21.04.98 08:33-------------------
+ * Kein Space und kein Punkt
+ * --------------------------------------------------*/
+class TableNameEdit : public NoSpaceEdit
+{
+public:
+ TableNameEdit(Window* pWin, const ResId& rResId) :
+ NoSpaceEdit(pWin, rResId)
+ {SetForbiddenChars(String::CreateFromAscii(" .<>"));}
+};
+/* -----------------25.06.2003 15:55-----------------
+ call a link when KEY_RETURN is pressed
+ --------------------------------------------------*/
+class SW_DLLPUBLIC ReturnActionEdit : public Edit
+{
+ Link aReturnActionLink;
+public:
+ ReturnActionEdit( Window* pParent, const ResId& rResId)
+ : Edit(pParent, rResId){}
+ ~ReturnActionEdit();
+ virtual void KeyInput( const KeyEvent& );
+
+ void SetReturnActionLink(const Link& rLink)
+ { aReturnActionLink = rLink;}
+};
+
+#endif
diff --git a/sw/source/ui/inc/addrdlg.hxx b/sw/source/ui/inc/addrdlg.hxx
new file mode 100644
index 000000000000..9e8370d1e2fc
--- /dev/null
+++ b/sw/source/ui/inc/addrdlg.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ADDRDLG_HXX
+#define _ADDRDLG_HXX
+
+#include <sfx2/basedlgs.hxx>
+
+class SwAddrDlg : public SfxSingleTabDialog
+{
+public:
+
+ SwAddrDlg( Window* pParent, const SfxItemSet& rSet );
+ ~SwAddrDlg();
+};
+
+#endif
+
+
+
+
diff --git a/sw/source/ui/inc/annotsh.hxx b/sw/source/ui/inc/annotsh.hxx
new file mode 100755
index 000000000000..ad91eb1b4f52
--- /dev/null
+++ b/sw/source/ui/inc/annotsh.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWANNOTSH_HXX
+#define _SWANNOTSH_HXX
+
+#include <sfx2/shell.hxx>
+#include "shellid.hxx"
+#include "swmodule.hxx"
+
+class SwView;
+class SwAnnotationShell: public SfxShell
+{
+ SwView& rView;
+
+public:
+ SFX_DECL_INTERFACE(SW_ANNOTATIONSHELL)
+ TYPEINFO();
+
+ SwAnnotationShell(SwView&);
+ virtual ~SwAnnotationShell();
+
+ void StateDisableItems(SfxItemSet &);
+ void Exec(SfxRequest &);
+
+ void GetState(SfxItemSet &);
+ void StateInsert(SfxItemSet &rSet);
+
+ void NoteExec(SfxRequest &);
+ void GetNoteState(SfxItemSet &);
+
+ void ExecLingu(SfxRequest &rReq);
+ void GetLinguState(SfxItemSet &);
+
+ void ExecClpbrd(SfxRequest &rReq);
+ void StateClpbrd(SfxItemSet &rSet);
+
+ void ExecTransliteration(SfxRequest &);
+
+ void ExecUndo(SfxRequest &rReq);
+ void StateUndo(SfxItemSet &rSet);
+
+ void StateStatusLine(SfxItemSet &rSet);
+
+ void InsertSymbol(SfxRequest& rReq);
+
+ void ExecSearch(SfxRequest&, BOOL bNoMessage = FALSE);
+ void StateSearch(SfxItemSet &);
+
+
+ virtual ::svl::IUndoManager*
+ GetUndoManager();
+};
+
+#endif
diff --git a/sw/source/ui/inc/app.hrc b/sw/source/ui/inc/app.hrc
new file mode 100644
index 000000000000..edf7014a4e4f
--- /dev/null
+++ b/sw/source/ui/inc/app.hrc
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _APP_HRC
+#define _APP_HRC
+
+#include "rcid.hrc"
+
+// Default Bitmap fuer ToolBox
+#define BMP_FEHLT (RC_APP_BEGIN + 1)
+
+// Document-Icon
+#define RC_DOC_ICON (RC_APP_BEGIN + 2)
+
+//Soll das Clipboard fuer andere Applikationen...
+#define MSG_CLPBRD_CLEAR (RC_APP_BEGIN + 3)
+
+#define STR_CANTCREATE (RC_APP_BEGIN + 4)
+#define STR_CANTOPEN (RC_APP_BEGIN + 5)
+
+// Messages
+#define MSG_ERROR_SEND_MAIL ( RC_APP_BEGIN + 6)
+#define MSG_SAVE_HTML_QUERY ( RC_APP_BEGIN + 7)
+
+//Fuer das Interface, weil der RID_APP_BEGIN jetzt Desktop ist.
+#define RID_SW_NAME ( RC_APP_BEGIN + 8)
+#define MSG_SAVEAS_HTML_QUERY ( RC_APP_BEGIN + 9)
+
+
+#define STR_UNBENANNT (RC_APP_BEGIN + 13)
+#define STR_VERSION (RC_APP_BEGIN + 14)
+#define STR_PRINT_MERGE_MACRO (RC_APP_BEGIN + 15)
+#define STR_PAGE_COUNT_MACRO (RC_APP_BEGIN + 16)
+
+// Bitmap fuer die NumerierungsVorlagen im Organizer
+#define BMP_STYLES_FAMILY_NUM (RC_APP_BEGIN + 17)
+#define BMP_STYLES_FAMILY_NUM_HC (RC_APP_BEGIN + 18)
+
+// Strings fuer Bereiche in der Konfiguration
+#define STR_GRP_FILE (RC_APP_BEGIN + 56)
+#define STR_GRP_EDIT (RC_APP_BEGIN + 57)
+#define STR_GRP_TRAVELLING (RC_APP_BEGIN + 58)
+#define STR_GRP_VIEW (RC_APP_BEGIN + 59)
+#define STR_GRP_INSERT (RC_APP_BEGIN + 60)
+#define STR_GRP_FORMAT (RC_APP_BEGIN + 61)
+#define STR_GRP_STYLE (RC_APP_BEGIN + 62)
+#define STR_GRP_TEXT (RC_APP_BEGIN + 63)
+#define STR_GRP_FRAME (RC_APP_BEGIN + 64)
+#define STR_GRP_GRAPHIC (RC_APP_BEGIN + 65)
+#define STR_GRP_TABLE (RC_APP_BEGIN + 66)
+#define STR_GRP_TOOLS (RC_APP_BEGIN + 67)
+#define STR_GRP_NUMBERING (RC_APP_BEGIN + 68)
+#define STR_GRP_WINDOW (RC_APP_BEGIN + 69)
+#define STR_GRP_MISC (RC_APP_BEGIN + 70)
+#define STR_GRP_MACRO (RC_APP_BEGIN + 71)
+#define RES_EXT_HELP_STRING (RC_APP_BEGIN + 72)
+#define RES_STD_HELP_STRING (RC_APP_BEGIN + 73)
+#define STR_PAGEOFFSET (RC_APP_BEGIN + 74)
+#define STR_PAGEBREAK (RC_APP_BEGIN + 75)
+#define STR_REDLINE_UNKNOWN_AUTHOR (RC_APP_BEGIN + 76)
+#define STR_WESTERN_FONT (RC_APP_BEGIN + 77)
+#define STR_CJK_FONT (RC_APP_BEGIN + 78)
+//#define MSG_INS_MERGE_FIELDS (RC_APP_BEGIN + 79)
+#define MSG_PRINT_AS_MERGE (RC_APP_BEGIN + 80)
+#define MSG_DATA_SOURCES_UNAVAILABLE (RC_APP_BEGIN + 82)
+#define DLG_MERGE_SOURCE_UNAVAILABLE (RC_APP_BEGIN + 83)
+#define ST_MERGE_SOURCE_UNAVAILABLE 1
+#define PB_MERGE_OK 2
+#define PB_MERGE_CANCEL 3
+#define IMG_MERGE 4
+#define SID_TOGGLETOOLBOX (RC_APP_BEGIN + 89)
+
+#define STR_ENV_TITLE (RC_APP_BEGIN + 91)
+#define STR_LAB_TITLE (RC_APP_BEGIN + 92)
+
+#define STR_HUMAN_SWDOC_NAME (RC_APP_BEGIN + 93)
+
+#define RID_SW_ERRHDL (RC_APP_BEGIN + 95)
+
+#define STR_FDLG_TEMPLATE_BUTTON (RC_APP_BEGIN + 1)
+#define STR_FDLG_TEMPLATE_NAME (RC_APP_BEGIN + 2)
+
+
+// Ids fuer die einzelnen PopUpMenues
+//#define MN_WIZARD (RC_APP_BEGIN + 9)
+//#define MN_INDEX (RC_APP_BEGIN + 10)
+//#define MN_FILE (RC_APP_BEGIN + 11)
+//#define MN_EDIT (RC_APP_BEGIN + 12)
+//#define MN_VIEW (RC_APP_BEGIN + 13)
+//#define MN_INS (RC_APP_BEGIN + 14)
+//#define MN_TEXT (RC_APP_BEGIN + 15)
+//#define MN_FORMAT (RC_APP_BEGIN + 16)
+#define MN_FORMAT_STYLE (RC_APP_BEGIN + 17)
+#define MN_FORMAT_ALGN (RC_APP_BEGIN + 18)
+#define MN_FORMAT_LINESPACE (RC_APP_BEGIN + 19)
+//#define MN_EXTRA (RC_APP_BEGIN + 20)
+//#define MN_WIN (RC_APP_BEGIN + 21)
+//#define MN_HELP (RC_APP_BEGIN + 22)
+#define MN_FORMAT_FRM_HORZ (RC_APP_BEGIN + 23)
+//#define MN_FORMAT_FRM_VERT (RC_APP_BEGIN + 24)
+//#define MN_PICKLIST (RC_APP_BEGIN + 25)
+//#define MN_WINLIST (RC_APP_BEGIN + 26)
+//#define MN_MACRO (RC_APP_BEGIN + 27)
+//#define MN_FORMAT_HIERARCHY (RC_APP_BEGIN + 28)
+#define MN_CELL (RC_APP_BEGIN + 29)
+//#define MN_HELP_TIP (RC_APP_BEGIN + 30)
+//#define MN_HELP_SEARCH (RC_APP_BEGIN + 31)
+//#define MN_HELP_ACTIVE (RC_APP_BEGIN + 32)
+//#define MN_HELP_INDEX (RC_APP_BEGIN + 33)
+//#define MN_OBJECT (RC_APP_BEGIN + 34)
+//#define MN_DATABASE (RC_APP_BEGIN + 35)
+//#define MN_DIRSUBMENU (RC_APP_BEGIN + 36)
+//#define MN_MAIL (RC_APP_BEGIN + 37)
+#define MN_WRAP (RC_APP_BEGIN + 38)
+#define MN_SUB_TBLROW (RC_APP_BEGIN + 39)
+#define MN_SUB_TBLCOL (RC_APP_BEGIN + 40)
+//#define MN_SUB_AUTOFORMAT (RC_APP_BEGIN + 41)
+//#define MN_SUB_TOOLBAR (RC_APP_BEGIN + 42)
+//#define MN_SUB_FIELD (RC_APP_BEGIN + 43)
+//#define MN_SUB_GRAPHIC (RC_APP_BEGIN + 44)
+//#define MN_SUB_TEMPLATES (RC_APP_BEGIN + 45)
+#define MN_SUB_ARRANGE (RC_APP_BEGIN + 46)
+
+//#define MN_SUB_UPDATE (RC_APP_BEGIN + 48)
+//#define MN_SUB_MIRROR (RC_APP_BEGIN + 49)
+#define MN_SUB_ALIGN (RC_APP_BEGIN + 50)
+//#define MN_SUB_OPTIONS (RC_APP_BEGIN + 51)
+//#define MN_SUB_SENDTO (RC_APP_BEGIN + 52)
+//#define MN_SUB_REVISE (RC_APP_BEGIN + 53)
+//#define MN_TEMPLATES (RC_APP_BEGIN + 54)
+//#define MN_FILE_PORT (RC_APP_BEGIN + 55)
+//#define MN_EDIT_PORT (RC_APP_BEGIN + 56)
+//#define MN_VIEW_PORT (RC_APP_BEGIN + 57)
+//#define MN_INS_PORT (RC_APP_BEGIN + 58)
+//#define MN_FORMAT_PORT (RC_APP_BEGIN + 59)
+//#define MN_EXTRA_PORT (RC_APP_BEGIN + 60)
+//#define MN_WIN_PORT (RC_APP_BEGIN + 61)
+//#define MN_HELP_PORT (RC_APP_BEGIN + 62)
+//#define MN_SUB_TRANSLITERATE (RC_APP_BEGIN + 63)
+//#define MN_SUB_MACRO (RC_APP_BEGIN + 64)
+
+#define STR_WRITER_DOCUMENT_FULLTYPE (RC_APP_BEGIN + 100)
+#define STR_ABSTRACT_TITLE (RC_APP_BEGIN + 102)
+#define STR_DONT_ASK_AGAIN (RC_APP_BEGIN + 103)
+// --> OD 2008-04-14 #outlinelevel#
+#define STR_OUTLINE_NUMBERING (RC_APP_BEGIN + 104)
+// <--
+//#outline level,zhaojianwei
+#define STR_FDLG_OUTLINE_LEVEL (RC_APP_BEGIN + 105)
+#define STR_FDLG_STYLE (RC_APP_BEGIN + 106)
+//<-end,zhaojianwei
+
+#define APP_ACT_END STR_FDLG_STYLE
+
+#if APP_ACT_END > RC_APP_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#endif
diff --git a/sw/source/ui/inc/ascfldlg.hxx b/sw/source/ui/inc/ascfldlg.hxx
new file mode 100644
index 000000000000..18eb19228fee
--- /dev/null
+++ b/sw/source/ui/inc/ascfldlg.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ASCFLDLG_HXX
+#define _ASCFLDLG_HXX
+#include <vcl/fixed.hxx>
+
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svx/txencbox.hxx>
+#include <svx/langbox.hxx>
+
+class SwAsciiOptions;
+class SvStream;
+class SwDocShell;
+
+class SwAsciiFilterDlg : public SfxModalDialog
+{
+ FixedLine aFL;
+ FixedText aCharSetFT;
+ SvxTextEncodingBox aCharSetLB;
+ FixedText aFontFT;
+ ListBox aFontLB;
+ FixedText aLanguageFT;
+ SvxLanguageBox aLanguageLB;
+ FixedText aCRLF_FT;
+ RadioButton aCRLF_RB, aCR_RB, aLF_RB;
+ OKButton aOkPB;
+ CancelButton aCancelPB;
+ HelpButton aHelpPB;
+ String sSystemCharSet;
+ BOOL bSaveLineStatus;
+
+ DECL_LINK( CharSetSelHdl, SvxTextEncodingBox* );
+ DECL_LINK( LineEndHdl, RadioButton* );
+ void SetCRLF( LineEnd eEnd );
+ LineEnd GetCRLF() const;
+
+public:
+ // CTOR: for import - pStream is the inputstream
+ // for export - pStream must be 0
+ SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh,
+ SvStream* pStream );
+ virtual ~SwAsciiFilterDlg();
+
+ void FillOptions( SwAsciiOptions& rOptions );
+};
+
+
+
+#endif
+
diff --git a/sw/source/ui/inc/autoedit.hxx b/sw/source/ui/inc/autoedit.hxx
new file mode 100644
index 000000000000..535bc04bf9ca
--- /dev/null
+++ b/sw/source/ui/inc/autoedit.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _AUTOEDIT_HXX
+#define _AUTOEDIT_HXX
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+
+
+class AutoEdit : public Edit
+{
+public:
+ AutoEdit( Window* pParent, ResId aResId ) : Edit( pParent, aResId ){}
+
+protected:
+ virtual void KeyInput( const KeyEvent& rEvent );
+};
+
+// Implementieriung im autocorr.cxx
+
+
+
+#endif
+
+
diff --git a/sw/source/ui/inc/barcfg.hxx b/sw/source/ui/inc/barcfg.hxx
new file mode 100644
index 000000000000..6b88039eddbe
--- /dev/null
+++ b/sw/source/ui/inc/barcfg.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_BARCFG_HXX
+#define SW_BARCFG_HXX
+#include <unotools/configitem.hxx>
+
+class SwToolbarConfigItem : public utl::ConfigItem
+{
+ sal_Int32 aTbxIdArray[5];
+
+ com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
+
+public:
+ SwToolbarConfigItem( sal_Bool bWeb );
+ ~SwToolbarConfigItem();
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+
+ void SetTopToolbar( sal_Int32 nSelType, sal_Int32 nBarId );
+};
+
+#endif
diff --git a/sw/source/ui/inc/basesh.hxx b/sw/source/ui/inc/basesh.hxx
new file mode 100644
index 000000000000..8c8b6eb98b7a
--- /dev/null
+++ b/sw/source/ui/inc/basesh.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWBASESH_HXX
+#define _SWBASESH_HXX
+
+
+#include <shellid.hxx>
+
+#define _SVSTDARR_USHORTSSORT
+#define _SVSTDARR_USHORTS
+#include <tools/link.hxx>
+#include <vcl/timer.hxx>
+#include <sfx2/module.hxx>
+#include <sfx2/shell.hxx>
+#include <svl/svstdarr.hxx>
+
+#include <mdiexp.hxx>
+
+class SwWrtShell;
+class SwCrsrShell;
+class SwView;
+class SfxItemSet;
+class Graphic;
+
+struct DBTextStruct_Impl;
+class SwBaseShell: public SfxShell
+{
+ SwView &rView;
+
+ // DragModus
+ static FlyMode eFrameMode;
+
+ // Bug 75078 - if in GetState the asynch call of GetGraphic returns
+ // synch, the set the state directly into the itemset
+ SfxItemSet* pGetStateSet;
+
+ //Update-Timer fuer Graphic
+ SvUShortsSort aGrfUpdateSlots;
+
+ DECL_LINK( GraphicArrivedHdl, SwCrsrShell* );
+
+protected:
+ SwWrtShell& GetShell();
+ SwWrtShell* GetShellPtr();
+
+ inline SwView& GetView() { return rView; }
+ inline void SetGetStateSet( SfxItemSet* p ) { pGetStateSet = p; }
+ inline BOOL AddGrfUpdateSlot( USHORT nSlot ){ return aGrfUpdateSlots.Insert( nSlot ); }
+
+ DECL_STATIC_LINK( SwBaseShell, InsertDBTextHdl, DBTextStruct_Impl* );
+
+ void InsertURLButton( const String& rURL, const String& rTarget, const String& rTxt );
+ void InsertTable( SfxRequest& _rRequest );
+
+public:
+ SwBaseShell(SwView &rShell);
+ virtual ~SwBaseShell();
+
+ SFX_DECL_INTERFACE(SW_BASESHELL)
+ TYPEINFO();
+
+ void ExecDelete(SfxRequest &);
+
+ void ExecClpbrd(SfxRequest &);
+ void StateClpbrd(SfxItemSet &);
+
+ void ExecUndo(SfxRequest &);
+ void StateUndo(SfxItemSet &);
+
+ void Execute(SfxRequest &);
+ void GetState(SfxItemSet &);
+ void StateStyle(SfxItemSet &);
+
+ void ExecuteGallery(SfxRequest&);
+ void GetGalleryState(SfxItemSet&);
+
+ void ExecDlg(SfxRequest &);
+
+ void StateStatusLine(SfxItemSet &rSet);
+ void ExecTxtCtrl(SfxRequest& rReq);
+ void GetTxtFontCtrlState(SfxItemSet& rSet);
+ void GetTxtCtrlState(SfxItemSet& rSet);
+ void GetBorderState(SfxItemSet &rSet);
+ void GetBckColState(SfxItemSet &rSet);
+
+ void ExecBckCol(SfxRequest& rReq);
+ void SetWrapMode( USHORT nSlot );
+
+ void StateDisableItems(SfxItemSet &);
+
+ void EditRegionDialog(SfxRequest& rReq);
+ void InsertRegionDialog(SfxRequest& rReq);
+
+ void ExecField(SfxRequest& rReq);
+
+ static void SetFrmMode( FlyMode eMode, SwWrtShell *pShell ); //Mit Update!
+ static void _SetFrmMode( FlyMode eMode ) { eFrameMode = eMode; }
+ static FlyMode GetFrmMode() { return eFrameMode; }
+
+};
+
+
+#endif
diff --git a/sw/source/ui/inc/beziersh.hxx b/sw/source/ui/inc/beziersh.hxx
new file mode 100644
index 000000000000..c9c88adb441e
--- /dev/null
+++ b/sw/source/ui/inc/beziersh.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWBEZIERSH_HXX
+#define _SWBEZIERSH_HXX
+
+#include "basesh.hxx"
+
+class SwBezierShell: public SwBaseShell
+{
+public:
+ SFX_DECL_INTERFACE(SW_BEZIERSHELL)
+ TYPEINFO();
+
+ SwBezierShell(SwView &rView);
+
+ void GetState(SfxItemSet &);
+ void Execute(SfxRequest &);
+};
+
+#endif
diff --git a/sw/source/ui/inc/bmpwin.hxx b/sw/source/ui/inc/bmpwin.hxx
new file mode 100644
index 000000000000..e09ae625534d
--- /dev/null
+++ b/sw/source/ui/inc/bmpwin.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _BMPWIN_HXX
+#define _BMPWIN_HXX
+
+#ifndef _GRAPH_HXX //autogen
+#include <vcl/graph.hxx>
+#endif
+#ifndef _BITMAPEX_HXX
+#include <vcl/bitmapex.hxx>
+#endif
+#include <vcl/window.hxx>
+
+/*--------------------------------------------------------------------
+ Beschreibung: Extended Page fuer Grafiken
+ --------------------------------------------------------------------*/
+
+class BmpWindow : public Window
+{
+private:
+ Graphic aGraphic;
+ BitmapEx aBmp;
+ BitmapEx aBmpHC;
+
+ BOOL bHorz : 1;
+ BOOL bVert : 1;
+ BOOL bGraphic : 1;
+ BOOL bLeftAlign : 1;
+
+ void Paint(const Rectangle& rRect);
+
+public:
+ BmpWindow(Window* pPar, USHORT nId,
+ const Graphic& rGraphic, const BitmapEx& rBmp, const BitmapEx& rBmpHC);
+ BmpWindow(Window* pParent, const ResId rResId) :
+ Window(pParent, rResId),
+ bHorz(FALSE), bVert(FALSE),bGraphic(FALSE), bLeftAlign(TRUE) {}
+ ~BmpWindow();
+ void MirrorVert(BOOL bMirror) { bVert = bMirror; Invalidate(); }
+ void MirrorHorz(BOOL bMirror) { bHorz = bMirror; Invalidate(); }
+ void SetGraphic(const Graphic& rGrf);
+};
+
+#endif
diff --git a/sw/source/ui/inc/bookctrl.hxx b/sw/source/ui/inc/bookctrl.hxx
new file mode 100644
index 000000000000..a41fb5262e64
--- /dev/null
+++ b/sw/source/ui/inc/bookctrl.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BOOKCTRL_HXX
+#define _BOOKCTRL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/stbitem.hxx>
+#include <tools/string.hxx>
+
+// class BookmarkToolBoxControl -------------------------------------------
+
+class SwBookmarkControl : public SfxStatusBarControl
+{
+ virtual void Command( const CommandEvent& rCEvt );
+
+public:
+ virtual void StateChanged( USHORT nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual void Paint( const UserDrawEvent& rEvt );
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SwBookmarkControl( USHORT nSlotId, USHORT nId, StatusBar& rStb );
+ ~SwBookmarkControl();
+
+private:
+ String sPageNumber;
+};
+
+
+#endif
+
diff --git a/sw/source/ui/inc/bookmark.hxx b/sw/source/ui/inc/bookmark.hxx
new file mode 100644
index 000000000000..29c3173787a9
--- /dev/null
+++ b/sw/source/ui/inc/bookmark.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BOOKMARK_HXX
+#define _BOOKMARK_HXX
+
+#include <svx/stddlg.hxx>
+#include <vcl/fixed.hxx>
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#include "swlbox.hxx" // SwComboBox
+
+class SwWrtShell;
+class SfxRequest;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class BookmarkCombo : public SwComboBox
+{
+ USHORT GetFirstSelEntryPos() const;
+ USHORT GetNextSelEntryPos(USHORT nPos) const;
+ USHORT GetSelEntryPos(USHORT nPos) const;
+
+ virtual long PreNotify(NotifyEvent& rNEvt);
+public:
+ BookmarkCombo( Window* pWin, const ResId& rResId );
+
+ USHORT GetSelectEntryCount() const;
+ USHORT GetSelectEntryPos( USHORT nSelIndex = 0 ) const;
+
+ static const String aForbiddenChars;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwInsertBookmarkDlg: public SvxStandardDialog
+{
+ BookmarkCombo aBookmarkBox;
+ FixedLine aBookmarkFl;
+ OKButton aOkBtn;
+ CancelButton aCancelBtn;
+ PushButton aDeleteBtn;
+
+ String sRemoveWarning;
+ SwWrtShell &rSh;
+ SfxRequest& rReq;
+
+ DECL_LINK( ModifyHdl, BookmarkCombo * );
+ DECL_LINK( DeleteHdl, Button * );
+
+ virtual void Apply();
+
+public:
+ SwInsertBookmarkDlg( Window *pParent, SwWrtShell &rSh, SfxRequest& rReq );
+ ~SwInsertBookmarkDlg();
+};
+
+#endif
diff --git a/sw/source/ui/inc/break.hxx b/sw/source/ui/inc/break.hxx
new file mode 100644
index 000000000000..447afd8ca567
--- /dev/null
+++ b/sw/source/ui/inc/break.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _BREAK_HXX
+#define _BREAK_HXX
+
+#include <svx/stddlg.hxx>
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+
+class SwWrtShell;
+
+class SwBreakDlg: public SvxStandardDialog
+{
+ SwWrtShell &rSh;
+ RadioButton aLineBtn;
+ RadioButton aColumnBtn;
+ RadioButton aPageBtn;
+ FixedText aPageCollText;
+ ListBox aPageCollBox;
+ CheckBox aPageNumBox;
+ NumericField aPageNumEdit;
+ FixedLine aBreakFL;
+
+ OKButton aOkBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+ String aTemplate;
+ USHORT nKind;
+ USHORT nPgNum;
+
+ BOOL bHtmlMode;
+
+ DECL_LINK( ClickHdl, void * );
+ DECL_LINK( PageNumHdl, CheckBox * );
+ DECL_LINK( PageNumModifyHdl, Edit * );
+ DECL_LINK( OkHdl, Button * );
+
+ void CheckEnable();
+
+protected:
+ virtual void Apply();
+
+public:
+ SwBreakDlg( Window *pParent, SwWrtShell &rSh );
+ ~SwBreakDlg();
+
+ String GetTemplateName() { return aTemplate; }
+ USHORT GetKind() { return nKind; }
+ USHORT GetPageNumber() { return nPgNum; }
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/caption.hxx b/sw/source/ui/inc/caption.hxx
new file mode 100644
index 000000000000..c56f70364596
--- /dev/null
+++ b/sw/source/ui/inc/caption.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CAPTION_HXX
+#define _CAPTION_HXX
+
+#include <tools/string.hxx>
+//#ifndef _STREAM_HXX //autogen
+//#include <tools/stream.hxx>
+//#endif
+#include <tools/globname.hxx>
+#include <SwCapObjType.hxx>
+#include "swdllapi.h"
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC InsCaptionOpt
+{
+private:
+ BOOL bUseCaption;
+ SwCapObjType eObjType;
+ SvGlobalName aOleId;
+ String sCategory;
+ USHORT nNumType;
+ ::rtl::OUString sNumberSeparator;
+ String sCaption;
+ USHORT nPos;
+ USHORT nLevel;
+// sal_Unicode cSeparator;
+ String sSeparator;
+ String sCharacterStyle;
+
+ BOOL bIgnoreSeqOpts; // wird nicht gespeichert
+ BOOL bCopyAttributes; // -""-
+
+public:
+ InsCaptionOpt(const SwCapObjType eType = FRAME_CAP, const SvGlobalName* pOleId = 0);
+ InsCaptionOpt(const InsCaptionOpt&);
+ ~InsCaptionOpt();
+
+ inline BOOL& UseCaption() { return bUseCaption; }
+ inline BOOL UseCaption() const { return bUseCaption; }
+
+ inline SwCapObjType GetObjType() const { return eObjType; }
+ inline void SetObjType(const SwCapObjType eType) { eObjType = eType; }
+
+ inline const SvGlobalName& GetOleId() const { return aOleId; }
+ inline void SetOleId(const SvGlobalName &rId) { aOleId = rId; }
+
+ inline const String& GetCategory() const { return sCategory; }
+ inline void SetCategory(const String& rCat) { sCategory = rCat; }
+
+ inline USHORT GetNumType() const { return nNumType; }
+ inline void SetNumType(const USHORT nNT) { nNumType = nNT; }
+
+ const ::rtl::OUString& GetNumSeparator() const { return sNumberSeparator; }
+ void SetNumSeparator(const ::rtl::OUString& rSet) {sNumberSeparator = rSet;}
+
+ inline const String& GetCaption() const { return sCaption; }
+ inline void SetCaption(const String& rCap) { sCaption = rCap; }
+
+ inline USHORT GetPos() const { return nPos; }
+ inline void SetPos(const USHORT nP) { nPos = nP; }
+
+ inline USHORT GetLevel() const { return nLevel; }
+ inline void SetLevel(const USHORT nLvl) { nLevel = nLvl; }
+
+// inline sal_Unicode GetSeparator() const { return cSeparator; }
+// inline void SetSeparator(const sal_Unicode cSep){ cSeparator = cSep; }
+ inline const String& GetSeparator() const { return sSeparator; }
+ inline void SetSeparator(const String& rSep) { sSeparator = rSep; }
+
+ const String& GetCharacterStyle() const { return sCharacterStyle; }
+ void SetCharacterStyle(const String& rStyle)
+ { sCharacterStyle = rStyle; }
+
+ inline BOOL& IgnoreSeqOpts() { return bIgnoreSeqOpts; }
+ inline BOOL IgnoreSeqOpts() const { return bIgnoreSeqOpts; }
+
+ inline BOOL& CopyAttributes() { return bCopyAttributes; }
+ inline BOOL CopyAttributes() const { return bCopyAttributes; }
+
+ BOOL operator==( const InsCaptionOpt& rOpt ) const;
+ InsCaptionOpt& operator= ( const InsCaptionOpt& rOpt );
+ inline BOOL operator< ( const InsCaptionOpt & rObj ) const
+ { return aOleId < rObj.aOleId; }
+// friend SvStream& operator>>( SvStream& rIStream, InsCaptionOpt& rCapOpt );
+// friend SvStream& operator<<( SvStream& rOStream, const InsCaptionOpt& rCapOpt );
+};
+
+#endif
+
+
diff --git a/sw/source/ui/inc/cfgdesc.hxx b/sw/source/ui/inc/cfgdesc.hxx
new file mode 100644
index 000000000000..81732b05c208
--- /dev/null
+++ b/sw/source/ui/inc/cfgdesc.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CFGDESC_HXX
+#define _CFGDESC_HXX
+
+#include <tools/string.hxx>
+
+class SwCfgDesc
+{
+protected:
+ String aFuncText;
+ String aLibName;
+ USHORT nEvent;
+
+ SwCfgDesc(const String &rFuncName, USHORT nId);
+ SwCfgDesc(const String &rLib,const String &rMacro);
+ ~SwCfgDesc();
+
+public:
+ void SetEvent(USHORT nE); // inline
+ void SetFuncText(const String &rStr); // inline
+ void SetMacro(const String &rLib, const String &rMac);
+ BOOL IsMacro() const;
+ USHORT GetEvent() const; // inline
+ String GetFuncText() const; // inline
+ String GetMacro() const; // inline
+ String GetLib() const; // inline
+};
+
+// INLINE METHODE --------------------------------------------------------
+inline void SwCfgDesc::SetEvent(USHORT nE) {
+ nEvent = nE;
+}
+
+inline void SwCfgDesc::SetFuncText(const String &rStr) {
+ aFuncText = rStr;
+}
+
+inline USHORT SwCfgDesc::GetEvent() const { return nEvent; }
+inline String SwCfgDesc::GetFuncText() const { return aFuncText; }
+inline String SwCfgDesc::GetMacro() const { return aFuncText; }
+inline String SwCfgDesc::GetLib() const { return aLibName; }
+
+
+#endif
diff --git a/sw/source/ui/inc/cfgid.h b/sw/source/ui/inc/cfgid.h
new file mode 100644
index 000000000000..71f061e7b094
--- /dev/null
+++ b/sw/source/ui/inc/cfgid.h
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CFGID_H
+#define _CFGID_H
+
+#include <sfx2/sfx.hrc>
+
+#define CFG_STATUSBAR (SFX_ITEMTYPE_SW_BEGIN +13)
+#define CFG_SW_MENU (SFX_ITEMTYPE_SW_BEGIN +16)
+#define CFG_SW_ACCEL (SFX_ITEMTYPE_SW_BEGIN +17)
+#define CFG_SWWEB_MENU (SFX_ITEMTYPE_SW_BEGIN +19)
+#define CFG_SWWEB_ACCEL (SFX_ITEMTYPE_SW_BEGIN +20)
+#define CFG_INSERT_DBCOLUMN_ITEM (SFX_ITEMTYPE_SW_BEGIN +25)
+#define CFG_SWGLOBAL_MENU (SFX_ITEMTYPE_SW_BEGIN +29)
+
+#endif
diff --git a/sw/source/ui/inc/cfgitems.hxx b/sw/source/ui/inc/cfgitems.hxx
new file mode 100644
index 000000000000..d80df8672cfd
--- /dev/null
+++ b/sw/source/ui/inc/cfgitems.hxx
@@ -0,0 +1,242 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CFGITEMS_HXX
+#define _CFGITEMS_HXX
+
+#include <tools/color.hxx>
+#include <svl/poolitem.hxx>
+#include "swdllapi.h"
+#include <printdata.hxx>
+
+#include <cmdid.h>
+
+class SwWriterApp;
+class SwModule;
+#ifdef DBG_UTIL
+class SwTestTabPage;
+#endif
+class SwAddPrinterTabPage;
+class SfxPrinter;
+class ViewShell;
+class SwViewOption;
+class SwContentOptPage;
+class SwShdwCrsrOptionsTabPage;
+class SwDocEditDialog;
+
+SfxPrinter* GetPrt( ViewShell* );
+void SetPrt( SfxPrinter* );
+
+
+/*--------OS 12.01.95 -----------------------------------
+Item fuer Einstellungsdialog - Dokumentanzeige
+--------------------------------------------------------- */
+class SW_DLLPUBLIC SwDocDisplayItem : public SfxPoolItem
+{
+ friend class SwWriterApp;
+ friend class SwShdwCrsrOptionsTabPage;
+ friend class SwModule;
+
+ BOOL bParagraphEnd :1;
+ BOOL bTab :1;
+ BOOL bSpace :1;
+ BOOL bNonbreakingSpace :1;
+ BOOL bSoftHyphen :1;
+ BOOL bCharHiddenText :1;
+ BOOL bFldHiddenText :1;
+ BOOL bManualBreak :1;
+ BOOL bShowHiddenPara :1;
+
+ Color aIndexBackgrndCol;
+
+
+public:
+ TYPEINFO();
+ SwDocDisplayItem( USHORT nWhich = FN_PARAM_DOCDISP );
+ SwDocDisplayItem(
+ const SwDocDisplayItem& rSwDocDisplayItem );
+ SwDocDisplayItem( const SwViewOption& rVOpt,
+ USHORT nWhich );
+
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ void operator=( const SwDocDisplayItem& );
+ void FillViewOptions( SwViewOption& rVOpt) const;
+};
+/*--------OS 12.01.95 -----------------------------------
+Item fuer Einstellungsdialog, Elementeseite
+--------------------------------------------------------- */
+class SW_DLLPUBLIC SwElemItem : public SfxPoolItem
+{
+ //view
+ BOOL bHorzScrollbar :1;
+ BOOL bVertScrollbar :1;
+ BOOL bAnyRuler : 1;
+ BOOL bHorzRuler :1;
+ BOOL bVertRuler :1;
+ BOOL bVertRulerRight:1;
+ BOOL bSmoothScroll :1;
+ //visual aids
+ BOOL bCrosshair :1;
+ BOOL bHandles :1;
+ BOOL bBigHandles :1;
+ //display
+ BOOL bTable :1;
+ BOOL bGraphic :1;
+ BOOL bDrawing :1;
+ BOOL bFieldName :1;
+ BOOL bNotes :1;
+
+ friend class SwContentOptPage;
+
+public:
+ TYPEINFO();
+ SwElemItem( USHORT nWhich = FN_PARAM_ELEM );
+ SwElemItem(const SwElemItem& rElemItem);
+ SwElemItem(const SwViewOption& rVOpt, USHORT nWhich);
+
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ void operator=( const SwElemItem& );
+
+ void FillViewOptions( SwViewOption& rVOpt) const;
+
+};
+/*--------OS 12.01.95 -----------------------------------
+Item fuer Einstellungsdialog - Drucker/Zusaetze
+--------------------------------------------------------- */
+
+class SW_DLLPUBLIC SwAddPrinterItem : public SfxPoolItem, public SwPrintData
+{
+ friend class SwAddPrinterTabPage;
+
+ using SwPrintData::operator ==;
+
+public:
+ TYPEINFO();
+ SwAddPrinterItem( USHORT nWhich = FN_PARAM_ADDPRINTER );
+ SwAddPrinterItem( USHORT nWhich, const SwPrintData& rPrtData );
+ SwAddPrinterItem( const SwAddPrinterItem& rAddPrinterItem);
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ const rtl::OUString &GetFax() const { return sFaxName; }
+ void SetFax( const String& rFax) { sFaxName = rFax; }
+
+
+ BOOL IsPrintProspect() const { return bPrintProspect; }
+ BOOL IsPrintProspectRTL() const { return bPrintProspectRTL; }
+ void SetPrintProspect(BOOL bFlag ){ bPrintProspect = bFlag; }
+ void SetPrintProspectRTL(BOOL bFlag ){ bPrintProspectRTL = bFlag; }
+ BOOL IsPrintGraphic () const { return bPrintGraphic; }
+ BOOL IsPrintTable () const { return bPrintTable; }
+ BOOL IsPrintDraw () const { return bPrintDraw; }
+ BOOL IsPrintControl () const { return bPrintControl; }
+ BOOL IsPrintLeftPage () const { return bPrintLeftPages; }
+ BOOL IsPrintRightPage() const { return bPrintRightPages; }
+ BOOL IsPrintReverse () const { return bPrintReverse; }
+ BOOL IsPaperFromSetup() const { return bPaperFromSetup; }
+ BOOL IsPrintEmptyPages() const { return bPrintEmptyPages; }
+ BOOL IsPrintPageBackground() const { return bPrintPageBackground; }
+ BOOL IsPrintBlackFont() const { return bPrintBlackFont; }
+ //#i81434# - printing of hidden text
+ sal_Bool IsPrintHiddenText() const { return bPrintHiddenText; }
+ sal_Bool IsPrintTextPlaceholder() const { return bPrintTextPlaceholder; }
+
+ BOOL IsPrintSingleJobs() const { return bPrintSingleJobs; }
+ ULONG GetPrintPostIts () const { return nPrintPostIts; }
+
+};
+
+
+/*--------OS 12.01.95 -----------------------------------
+Item fuer Einstellungsdialog, ShadowCursorSeite
+--------------------------------------------------------- */
+
+class SW_DLLPUBLIC SwShadowCursorItem : public SfxPoolItem
+{
+ BYTE eMode;
+ BOOL bOn;
+public:
+ TYPEINFO();
+ SwShadowCursorItem( USHORT nWhich = FN_PARAM_SHADOWCURSOR );
+ SwShadowCursorItem( const SwShadowCursorItem& rElemItem );
+ SwShadowCursorItem( const SwViewOption& rVOpt, USHORT nWhich );
+
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ void operator=( const SwShadowCursorItem& );
+
+ void FillViewOptions( SwViewOption& rVOpt) const;
+
+ BYTE GetMode() const { return eMode; }
+ BOOL IsOn() const { return bOn; }
+
+ void SetMode( BYTE eM ) { eMode = eM; }
+ void SetOn( BOOL bFlag ) { bOn = bFlag; }
+};
+
+#ifdef DBG_UTIL
+/*--------OS 12.01.95 -----------------------------------
+Item fuer Einstellungsdialog - Testeinstellungen
+--------------------------------------------------------- */
+class SW_DLLPUBLIC SwTestItem : public SfxPoolItem
+{
+ friend class SwModule;
+ friend class SwWriterApp;
+ friend class SwTestTabPage;
+ friend class SwDocEditDialog;
+
+ BOOL bTest1:1;
+ BOOL bTest2:1;
+ BOOL bTest3:1;
+ BOOL bTest4:1;
+ BOOL bTest5:1;
+ BOOL bTest6:1;
+ BOOL bTest7:1;
+ BOOL bTest8:1;
+ BOOL bTest9:1;
+ BOOL bTest10:1;
+
+public:
+ SwTestItem( USHORT _nWhich):
+ SfxPoolItem(_nWhich){};
+ SwTestItem( const SwTestItem& pTestItem);
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+};
+#endif
+
+#endif
+
+
diff --git a/sw/source/ui/inc/changedb.hxx b/sw/source/ui/inc/changedb.hxx
new file mode 100644
index 000000000000..210f81907cc5
--- /dev/null
+++ b/sw/source/ui/inc/changedb.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHANGEDB_HXX
+#define _CHANGEDB_HXX
+
+
+#ifndef _BITMAP_HXX //autogen
+#include <vcl/bitmap.hxx>
+#endif
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+#include <svtools/svtreebx.hxx>
+#include <svx/stddlg.hxx>
+#include "dbtree.hxx"
+#include <vcl/fixed.hxx>
+
+class SwFldMgr;
+class SwView;
+class SwWrtShell;
+struct SwDBData;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Datenbank an Feldern austauschen
+ --------------------------------------------------------------------*/
+
+class SwChangeDBDlg: public SvxStandardDialog
+{
+ FixedLine aDBListFL;
+ FixedText aUsedDBFT;
+ FixedText aAvailDBFT;
+ SvTreeListBox aUsedDBTLB;
+ SwDBTreeList aAvailDBTLB;
+ PushButton aAddDBPB;
+ FixedInfo aDescFT;
+ FixedText aDocDBTextFT;
+ FixedText aDocDBNameFT;
+ OKButton aOKBT;
+ CancelButton aCancelBT;
+ HelpButton aHelpBT;
+// PushButton aChangeBT;
+
+ ImageList aImageList;
+ ImageList aImageListHC;
+
+ SwWrtShell *pSh;
+ SwFldMgr *pMgr;
+
+ DECL_LINK(TreeSelectHdl, SvTreeListBox* pBox = 0);
+ DECL_LINK(ButtonHdl, Button* pBtn);
+ DECL_LINK(AddDBHdl, PushButton*);
+
+ virtual void Apply();
+ void UpdateFlds();
+ void FillDBPopup();
+ SvLBoxEntry* Insert(const String& rDBName);
+ void ShowDBName(const SwDBData& rDBData);
+
+public:
+ SwChangeDBDlg(SwView& rVw);
+ ~SwChangeDBDlg();
+};
+
+#endif
diff --git a/sw/source/ui/inc/chartins.hxx b/sw/source/ui/inc/chartins.hxx
new file mode 100644
index 000000000000..15050f946227
--- /dev/null
+++ b/sw/source/ui/inc/chartins.hxx
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHARTINS_HXX
+#define _CHARTINS_HXX
+
+
+Point SwGetChartDialogPos( const Window *pParentWin, const Size& rDialogSize, const Rectangle& rLogicChart );
+void SwInsertChart( Window *pParent, SfxBindings *pBindings );
+
+#endif /*_CHARTINS_HXX*/
+
diff --git a/sw/source/ui/inc/chldwrap.hxx b/sw/source/ui/inc/chldwrap.hxx
new file mode 100644
index 000000000000..67009b0a8d2f
--- /dev/null
+++ b/sw/source/ui/inc/chldwrap.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CHLDWRAP_HXX
+#define _CHLDWRAP_HXX
+
+#include <sfx2/childwin.hxx>
+#include <vcl/timer.hxx>
+
+class SwDocShell;
+
+class SwChildWinWrapper : public SfxChildWindow
+{
+ Timer m_aUpdateTimer;
+ SwDocShell* m_pDocSh;
+
+ DECL_LINK( UpdateHdl, void* );
+
+ // Implementation in fldtdlg.cxx
+protected:
+ SwChildWinWrapper(Window *pParentWindow, USHORT nId);
+
+public:
+ virtual BOOL ReInitDlg(SwDocShell *pDocSh);
+
+ inline SwDocShell* GetOldDocShell() { return m_pDocSh; }
+ inline void SetOldDocShell(SwDocShell *pDcSh) { m_pDocSh = pDcSh; }
+};
+
+
+#endif
+
diff --git a/sw/source/ui/inc/chrdlg.hxx b/sw/source/ui/inc/chrdlg.hxx
new file mode 100644
index 000000000000..85248baeed8b
--- /dev/null
+++ b/sw/source/ui/inc/chrdlg.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWCHARDLG_HXX
+#define _SWCHARDLG_HXX
+#include <sfx2/tabdlg.hxx>
+
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+
+#ifndef _COMBOBOX_HXX //autogen
+#include <vcl/combobox.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+class SwView;
+class SvxMacroItem;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Der Tabdialog Traeger der TabPages
+ --------------------------------------------------------------------*/
+
+class SwCharDlg: public SfxTabDialog
+{
+ SwView& rView;
+ BOOL bIsDrwTxtMode;
+
+public:
+ SwCharDlg(Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet,
+ const String* pFmtStr = 0, BOOL bIsDrwTxtDlg = FALSE);
+
+ ~SwCharDlg();
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+};
+
+/*-----------------14.08.96 11.03-------------------
+ Beschreibung: Tabpage fuer URL-Attribut
+--------------------------------------------------*/
+
+class SwCharURLPage : public SfxTabPage
+{
+ FixedLine aURLFL;
+
+ FixedText aURLFT;
+ Edit aURLED;
+ FixedText aTextFT;
+ Edit aTextED;
+ FixedText aNameFT;
+ Edit aNameED;
+ FixedText aTargetFrmFT;
+ ComboBox aTargetFrmLB;
+ PushButton aURLPB;
+ PushButton aEventPB;
+ FixedLine aStyleFL;
+ FixedText aVisitedFT;
+ ListBox aVisitedLB;
+ FixedText aNotVisitedFT;
+ ListBox aNotVisitedLB;
+
+ SvxMacroItem* pINetItem;
+ BOOL bModified;
+
+ DECL_LINK( InsertFileHdl, PushButton * );
+ DECL_LINK( EventHdl, PushButton * );
+
+public:
+ SwCharURLPage( Window* pParent,
+ const SfxItemSet& rSet );
+
+ ~SwCharURLPage();
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/cnttab.hxx b/sw/source/ui/inc/cnttab.hxx
new file mode 100644
index 000000000000..852a2f705c68
--- /dev/null
+++ b/sw/source/ui/inc/cnttab.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CNTTAB_HXX
+#define _CNTTAB_HXX
+
+#include <svx/stddlg.hxx>
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+#include <sfx2/tabdlg.hxx>
+
+#include "tox.hxx"
+#include <tools/list.hxx>
+#include <toxmgr.hxx>
+#include <svx/checklbx.hxx>
+#include <tools/resary.hxx>
+#include <svtools/svtreebx.hxx>
+#include <vcl/menubtn.hxx>
+#include <svx/langbox.hxx>
+#define TOX_PAGE_SELECT 1
+#define TOX_PAGE_ENTRY 2
+#define TOX_PAGE_STYLES 3
+
+struct CurTOXType
+{
+ TOXTypes eType;
+ USHORT nIndex; //for TOX_USER only
+
+ BOOL operator==(const CurTOXType aCmp)
+ {
+ return eType == aCmp.eType && nIndex == aCmp.nIndex;
+ }
+ USHORT GetFlatIndex() const;
+
+ CurTOXType () : eType (TOX_INDEX), nIndex (0) {};
+
+ CurTOXType (TOXTypes t, USHORT i) : eType (t), nIndex (i) {};
+};
+
+class SwOLENames : public Resource
+{
+ ResStringArray aNamesAry;
+public:
+ SwOLENames(const ResId& rResId) :
+ Resource(rResId),
+ aNamesAry(ResId(1,*rResId.GetResMgr())){FreeResource();}
+
+ ResStringArray& GetNames() { return aNamesAry;}
+
+};
+
+#endif
diff --git a/sw/source/ui/inc/colex.hxx b/sw/source/ui/inc/colex.hxx
new file mode 100644
index 000000000000..39778f503d2a
--- /dev/null
+++ b/sw/source/ui/inc/colex.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _COLEX_HXX
+#define _COLEX_HXX
+
+#include <svx/pagectrl.hxx>
+#include <editeng/paperinf.hxx>
+#include "swdllapi.h"
+#include <fmtclds.hxx>
+#include "frmatr.hxx"
+
+class SwColMgr;
+class SfxItemSet;
+
+/* -----------------------------08.02.2002 11:32------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SW_DLLPUBLIC SwPageExample : public SvxPageWindow
+{
+public:
+ SwPageExample(Window* pPar, const ResId& rResId ) :
+ SvxPageWindow(pPar, rResId )
+ {SetSize(SvxPaperInfo::GetPaperSize(PAPER_A4));/*DIN A4*/}
+
+ void UpdateExample( const SfxItemSet& rSet );
+};
+/* -----------------------------08.02.2002 11:34------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwTextGridItem;
+class SW_DLLPUBLIC SwPageGridExample : public SwPageExample
+{
+ SwTextGridItem* pGridItem;
+ sal_Bool m_bVertical;
+protected:
+ virtual void DrawPage( const Point& rPoint,
+ const BOOL bSecond,
+ const BOOL bEnabled );
+public:
+ SwPageGridExample(Window* pPar, const ResId& rResId ) :
+ SwPageExample(pPar, rResId ),
+ pGridItem(0),
+ m_bVertical(sal_False){}
+ ~SwPageGridExample();
+ void UpdateExample( const SfxItemSet& rSet );
+};
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwColExample : public SwPageExample
+{
+ SwColMgr* pColMgr;
+
+ using SwPageExample::UpdateExample;
+
+protected:
+ virtual void DrawPage( const Point& rPoint,
+ const BOOL bSecond,
+ const BOOL bEnabled );
+
+public:
+ SwColExample(Window* pPar, const ResId& rResId ) :
+ SwPageExample(pPar, rResId ),
+ pColMgr(0){}
+
+ void UpdateExample( const SfxItemSet& rSet, SwColMgr* pMgr )
+ { pColMgr = pMgr;
+ SwPageExample::UpdateExample(rSet);
+ }
+};
+
+/*-----------------25.10.96 08.23-------------------
+
+--------------------------------------------------*/
+class SW_DLLPUBLIC SwColumnOnlyExample : public Window
+{
+private:
+ Size m_aWinSize;
+
+ Size m_aFrmSize;
+ SwFmtCol m_aCols;
+
+protected:
+ virtual void Paint( const Rectangle& rRect );
+
+public:
+ SwColumnOnlyExample( Window* , const ResId& );
+
+ void SetColumns(const SwFmtCol& rCol);
+
+};
+
+#endif // _COLEX_HXX
diff --git a/sw/source/ui/inc/colmgr.hxx b/sw/source/ui/inc/colmgr.hxx
new file mode 100644
index 000000000000..641c48e9bb66
--- /dev/null
+++ b/sw/source/ui/inc/colmgr.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _COLMGR_HXX
+#define _COLMGR_HXX
+
+#include "swdllapi.h"
+#include <fmtclds.hxx>
+
+SW_DLLPUBLIC void FitToActualSize(SwFmtCol& rCol, USHORT nWidth);
+
+class SW_DLLPUBLIC SwColMgr
+{
+public:
+ // lActWidth wird aus den Edits des Seitendialogs
+ // direkt uebergeben
+ SwColMgr(const SfxItemSet &rSet, USHORT nActWidth = USHRT_MAX);
+ ~SwColMgr();
+
+
+ inline USHORT GetCount() const;
+ void SetCount(USHORT nCount, USHORT nGutterWidth);
+ USHORT GetGutterWidth(USHORT nPos = USHRT_MAX) const;
+ void SetGutterWidth(USHORT nWidth, USHORT nPos = USHRT_MAX);
+
+ USHORT GetColWidth(USHORT nIdx) const;
+ void SetColWidth(USHORT nIdx, USHORT nWidth);
+
+ inline BOOL IsAutoWidth() const;
+ void SetAutoWidth(BOOL bOn = TRUE, USHORT lGutterWidth = 0);
+
+ inline BOOL HasLine() const;
+ inline void SetNoLine();
+
+ inline void SetLineWidthAndColor(ULONG nWidth, const Color& rCol);
+ inline ULONG GetLineWidth() const;
+ inline const Color& GetLineColor() const;
+
+ inline SwColLineAdj GetAdjust() const;
+ inline void SetAdjust(SwColLineAdj);
+
+ short GetLineHeightPercent() const;
+ void SetLineHeightPercent(short nPercent);
+
+ inline void NoCols();
+ void Update();
+
+ const SwFmtCol& GetColumns() const { return aFmtCol; }
+
+ void SetActualWidth(USHORT nW);
+ USHORT GetActualSize() const { return nWidth; }
+
+
+private:
+
+ SwFmtCol aFmtCol;
+ USHORT nWidth;
+};
+
+// INLINE METHODE --------------------------------------------------------
+
+inline USHORT SwColMgr::GetCount() const
+{
+ return aFmtCol.GetNumCols();
+}
+inline void SwColMgr::SetLineWidthAndColor(ULONG nLWidth, const Color& rCol)
+{
+ aFmtCol.SetLineWidth(nLWidth);
+ aFmtCol.SetLineColor(rCol);
+}
+inline ULONG SwColMgr::GetLineWidth() const
+{
+ return aFmtCol.GetLineWidth();
+}
+inline const Color& SwColMgr::GetLineColor() const
+{
+ return aFmtCol.GetLineColor();
+}
+inline SwColLineAdj SwColMgr::GetAdjust() const
+{
+ return aFmtCol.GetLineAdj();
+}
+inline void SwColMgr::SetAdjust(SwColLineAdj eAdj)
+{
+ aFmtCol.SetLineAdj(eAdj);
+}
+inline BOOL SwColMgr::IsAutoWidth() const
+{
+ return aFmtCol.IsOrtho();
+}
+inline void SwColMgr::SetAutoWidth(BOOL bOn, USHORT nGutterWidth)
+{
+ aFmtCol.SetOrtho(bOn, nGutterWidth, nWidth);
+}
+inline void SwColMgr::NoCols()
+{
+ aFmtCol.GetColumns().DeleteAndDestroy(0, aFmtCol.GetColumns().Count());
+}
+inline BOOL SwColMgr::HasLine() const
+{
+ return GetAdjust() != COLADJ_NONE;
+}
+inline void SwColMgr::SetNoLine()
+{
+ SetAdjust(COLADJ_NONE);
+}
+
+#endif
diff --git a/sw/source/ui/inc/column.hxx b/sw/source/ui/inc/column.hxx
new file mode 100644
index 000000000000..f2a5e37d283b
--- /dev/null
+++ b/sw/source/ui/inc/column.hxx
@@ -0,0 +1,227 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _COLUMN_HXX
+#define _COLUMN_HXX
+
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#ifndef _IMAGE_HXX //autogen
+#include <vcl/image.hxx>
+#endif
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/timer.hxx>
+#ifndef _IMAGEBTN_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <svtools/ctrlbox.hxx>
+#include <svtools/valueset.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <fmtclbl.hxx>
+#include <colex.hxx>
+#include <prcntfld.hxx>
+
+const int nMaxCols = 99;
+class SwColMgr;
+class SwWrtShell;
+class SwColumnPage;
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwColumnDlg : public SfxModalDialog
+{
+ OKButton aOK;
+ CancelButton aCancel;
+ HelpButton aHelp;
+
+ FixedText aApplyToFT;
+ ListBox aApplyToLB;
+
+ SwWrtShell& rWrtShell;
+ SwColumnPage* pTabPage;
+ SfxItemSet* pPageSet;
+ SfxItemSet* pSectionSet;
+ SfxItemSet* pSelectionSet;
+ SfxItemSet* pFrameSet;
+
+ long nOldSelection;
+ long nSelectionWidth;
+ long nPageWidth;
+
+ BOOL bPageChanged : 1;
+ BOOL bSectionChanged : 1;
+ BOOL bSelSectionChanged : 1;
+ BOOL bFrameChanged : 1;
+
+
+ DECL_LINK(ObjectHdl, ListBox*);
+ DECL_LINK(OkHdl, OKButton*);
+
+public:
+ SwColumnDlg(Window* pParent, SwWrtShell& rSh);
+ virtual ~SwColumnDlg();
+
+ SwWrtShell& GetWrtShell() { return rWrtShell; }
+};
+
+/*-----------------07.03.97 08.26-------------------
+
+--------------------------------------------------*/
+class ColumnValueSet : public ValueSet
+{
+ public:
+ ColumnValueSet(Window* pParent, const ResId& rResId) :
+ ValueSet(pParent, rResId){}
+ ~ColumnValueSet();
+
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Spaltendialog jetzt als TabPage
+ --------------------------------------------------------------------*/
+class SwColumnPage : public SfxTabPage
+{
+ FixedText aClNrLbl;
+ NumericField aCLNrEdt;
+ ColumnValueSet aDefaultVS;
+ ImageList aPreColsIL;
+ CheckBox aBalanceColsCB;
+ FixedLine aFLGroup;
+
+ ImageButton aBtnUp;
+ FixedText aColumnFT;
+ FixedText aWidthFT;
+ FixedText aDistFT;
+ FixedText aLbl1;
+ PercentField aEd1;
+ PercentField aDistEd1;
+ FixedText aLbl2;
+ PercentField aEd2;
+ PercentField aDistEd2;
+ FixedText aLbl3;
+ PercentField aEd3;
+ ImageButton aBtnDown;
+ CheckBox aAutoWidthBox;
+
+ FixedLine aFLLayout;
+
+ FixedText aLineTypeLbl;
+ LineListBox aLineTypeDLB;
+ FixedText aLineHeightLbl;
+ MetricField aLineHeightEdit;
+ FixedText aLinePosLbl;
+ ListBox aLinePosDLB;
+ FixedLine aFLLineType;
+
+ FixedLine aVertFL;
+ FixedLine aPropertiesFL;
+ FixedText aTextDirectionFT;
+ ListBox aTextDirectionLB;
+
+ // Example
+ SwColExample aPgeExampleWN;
+ SwColumnOnlyExample aFrmExampleWN;
+
+ SwColMgr* pColMgr;
+
+ USHORT nFirstVis;
+ USHORT nCols;
+ long nColWidth[nMaxCols];
+ long nColDist[nMaxCols];
+ USHORT nMinWidth;
+ PercentField *pModifiedField;
+ BOOL bFormat;
+ BOOL bFrm;
+ BOOL bHtmlMode;
+ BOOL bLockUpdate;
+
+ // Handler
+ DECL_LINK( ColModify, NumericField * );
+ DECL_LINK( GapModify, PercentField * );
+ DECL_LINK( EdModify, PercentField * );
+ DECL_LINK( AutoWidthHdl, CheckBox * );
+ DECL_LINK( Timeout, Timer * );
+ DECL_LINK( SetDefaultsHdl, ValueSet * );
+
+ DECL_LINK( Up, Button * );
+ DECL_LINK( Down, Button * );
+ void Apply(Button *);
+ DECL_LINK( UpdateColMgr, void* );
+
+ void Update();
+ void UpdateCols();
+ void Init();
+ void ResetColWidth();
+ void SetLabels( USHORT nVis );
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet *pSet);
+
+ SwColumnPage(Window *pParent, const SfxItemSet &rSet);
+
+public:
+ virtual ~SwColumnPage();
+
+ static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet(SfxItemSet &rSet);
+ virtual void Reset(const SfxItemSet &rSet);
+
+ void SetFrmMode(BOOL bMod);
+ void SetPageWidth(long nPageWidth);
+
+ void SetFormatUsed(BOOL bFmt) { bFormat = bFmt; }
+
+ void ShowBalance(BOOL bShow) {aBalanceColsCB.Show(bShow);}
+ void SetInSection(BOOL bSet);
+
+ void ActivateColumnControl() {aCLNrEdt.GrabFocus();}
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/conarc.hxx b/sw/source/ui/inc/conarc.hxx
new file mode 100644
index 000000000000..4b8d01f8d5c3
--- /dev/null
+++ b/sw/source/ui/inc/conarc.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONARC_HXX
+#define _CONARC_HXX
+
+#include "drawbase.hxx"
+
+/*************************************************************************
+|*
+|* Rechteck zeichnen
+|*
+\************************************************************************/
+
+class ConstArc : public SwDrawBase
+{
+ Point aStartPnt;
+ UINT16 nAnzButUp;
+
+public:
+ ConstArc(SwWrtShell* pSh, SwEditWin* pWin, SwView* pView);
+
+ // Mouse- & Key-Events
+ virtual BOOL MouseButtonUp(const MouseEvent& rMEvt);
+ virtual BOOL MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(const USHORT nSlotId); // Funktion aktivieren
+ virtual void Deactivate();
+};
+
+
+
+#endif // _CONARC_HXX
+
diff --git a/sw/source/ui/inc/concustomshape.hxx b/sw/source/ui/inc/concustomshape.hxx
new file mode 100644
index 000000000000..5ff08952f28d
--- /dev/null
+++ b/sw/source/ui/inc/concustomshape.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SW_CONCUSTOMSHAPE_HXX
+#define _SW_CONCUSTOMSHAPE_HXX
+
+#include <rtl/ustring.hxx>
+#include "drawbase.hxx"
+
+class SdrObject;
+class SfxRequest;
+
+/*************************************************************************
+|*
+|* Rechteck zeichnen
+|*
+\************************************************************************/
+
+class ConstCustomShape : public SwDrawBase
+{
+
+ rtl::OUString aCustomShape;
+
+ void SetAttributes( SdrObject* pObj );
+
+ public:
+
+ ConstCustomShape( SwWrtShell* pSh, SwEditWin* pWin, SwView* pView, SfxRequest& rReq );
+
+ // Mouse- & Key-Events
+ virtual BOOL MouseButtonUp(const MouseEvent& rMEvt);
+ virtual BOOL MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(const USHORT nSlotId); // Function aktivieren
+
+ rtl::OUString GetShapeType() const;
+ static rtl::OUString GetShapeTypeFromRequest( SfxRequest& rReq );
+
+ virtual void CreateDefaultObject();
+
+ // #i33136#
+ virtual bool doConstructOrthogonal() const;
+};
+
+
+
+#endif // _SW_CONRECT_HXX
+
diff --git a/sw/source/ui/inc/condedit.hxx b/sw/source/ui/inc/condedit.hxx
new file mode 100644
index 000000000000..bce44192ae68
--- /dev/null
+++ b/sw/source/ui/inc/condedit.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONDEDTI_HXX
+#define _CONDEDTI_HXX
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#include <svtools/transfer.hxx>
+#include "swdllapi.h"
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC ConditionEdit : public Edit, public DropTargetHelper
+{
+ BOOL bBrackets, bEnableDrop;
+
+ SW_DLLPRIVATE virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ SW_DLLPRIVATE virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+public:
+ ConditionEdit( Window* pParent, const ResId& rResId );
+
+ inline void ShowBrackets(BOOL bShow) { bBrackets = bShow; }
+
+ inline void SetDropEnable( BOOL bFlag ) { bEnableDrop = bFlag; }
+ inline BOOL IsDropEnable() const { return bEnableDrop; }
+};
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/inc/conform.hxx b/sw/source/ui/inc/conform.hxx
new file mode 100644
index 000000000000..1117da12dc25
--- /dev/null
+++ b/sw/source/ui/inc/conform.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONFORM_HXX
+#define _CONFORM_HXX
+
+#include "drawbase.hxx"
+
+class ConstFormControl : public SwDrawBase
+{
+public:
+ ConstFormControl(SwWrtShell* pSh, SwEditWin* pWin, SwView* pView);
+
+ // Mouse- & Key-Events
+ virtual BOOL MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(const USHORT nSlotId); // Function aktivieren
+ virtual void CreateDefaultObject();
+};
+
+
+
+#endif
+
diff --git a/sw/source/ui/inc/conpoly.hxx b/sw/source/ui/inc/conpoly.hxx
new file mode 100644
index 000000000000..7fc528fd4d93
--- /dev/null
+++ b/sw/source/ui/inc/conpoly.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONPOLY_HXX
+#define _CONPOLY_HXX
+
+#include "drawbase.hxx"
+
+/*************************************************************************
+|*
+|* Basisklasse fuer alle Funktionen
+|*
+\************************************************************************/
+
+class ConstPolygon : public SwDrawBase
+{
+ Point aLastPos;
+
+public:
+ ConstPolygon(SwWrtShell* pSh, SwEditWin* pWin, SwView* pView);
+
+ // Mouse- & Key-Events
+ virtual BOOL MouseMove(const MouseEvent& rMEvt);
+ virtual BOOL MouseButtonUp(const MouseEvent& rMEvt);
+ virtual BOOL MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(const USHORT nSlotId); // Function aktivieren
+};
+
+
+#endif // _CONPOLY_HXX
+
diff --git a/sw/source/ui/inc/conrect.hxx b/sw/source/ui/inc/conrect.hxx
new file mode 100644
index 000000000000..3490aa4d9faa
--- /dev/null
+++ b/sw/source/ui/inc/conrect.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SW_CONRECT_HXX
+#define _SW_CONRECT_HXX
+
+#include "drawbase.hxx"
+
+/*************************************************************************
+|*
+|* Rechteck zeichnen
+|*
+\************************************************************************/
+
+class ConstRectangle : public SwDrawBase
+{
+ BOOL bMarquee;
+ BOOL bCapVertical;
+
+ // #93382#
+ sal_Bool mbVertical;
+
+ public:
+ ConstRectangle(SwWrtShell* pSh, SwEditWin* pWin, SwView* pView);
+
+ // Mouse- & Key-Events
+ virtual BOOL MouseButtonUp(const MouseEvent& rMEvt);
+ virtual BOOL MouseButtonDown(const MouseEvent& rMEvt);
+
+ virtual void Activate(const USHORT nSlotId); // Function aktivieren
+};
+
+
+
+#endif // _SW_CONRECT_HXX
+
diff --git a/sw/source/ui/inc/content.hxx b/sw/source/ui/inc/content.hxx
new file mode 100644
index 000000000000..bfcd31dcba87
--- /dev/null
+++ b/sw/source/ui/inc/content.hxx
@@ -0,0 +1,225 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONTENT_HXX
+#define _CONTENT_HXX
+#include <limits.h> // USHRT_MAX
+#include "swcont.hxx"
+
+#ifndef _MENU_HXX //autogen
+#include <vcl/menu.hxx>
+#endif
+
+class SwWrtShell;
+class SwContentArr;
+class SwContentType;
+class SwFmtFld;
+class SwTxtINetFmt;
+class SwTOXBase;
+class SwRedline;
+
+//----------------------------------------------------------------------------
+// Hilfsklassen
+//----------------------------------------------------------------------------
+
+class SwPopup : public PopupMenu
+{
+ USHORT nCurId;
+ virtual void Select(){nCurId = GetCurItemId();}
+
+public:
+ SwPopup() :
+ PopupMenu(),
+ nCurId(USHRT_MAX){}
+
+ USHORT GetCurId() const { return nCurId; }
+
+};
+
+//----------------------------------------------------------------------------
+
+class SwOutlineContent : public SwContent
+{
+ USHORT nOutlinePos;
+ BYTE nOutlineLevel;
+ BOOL bIsMoveable;
+ public:
+ SwOutlineContent( const SwContentType* pCnt,
+ const String& rName,
+ USHORT nArrPos,
+ BYTE nLevel,
+ BOOL bMove,
+ long nYPos) :
+ SwContent(pCnt, rName, nYPos),
+ nOutlinePos(nArrPos), nOutlineLevel(nLevel), bIsMoveable(bMove) {}
+
+ USHORT GetPos(){return nOutlinePos;}
+ BYTE GetOutlineLevel(){return nOutlineLevel;}
+ BOOL IsMoveable(){return bIsMoveable;};
+};
+
+//----------------------------------------------------------------------------
+class SwRegionContent : public SwContent
+{
+
+ BYTE nRegionLevel;
+
+ public:
+ SwRegionContent( const SwContentType* pCnt,
+ const String& rName,
+ BYTE nLevel,
+ long nYPos) :
+ SwContent(pCnt, rName, nYPos),
+ nRegionLevel(nLevel){}
+ BYTE GetRegionLevel() const {return nRegionLevel;}
+};
+//----------------------------------------------------------------------------
+
+class SwURLFieldContent : public SwContent
+{
+ String sURL;
+ const SwTxtINetFmt* pINetAttr;
+
+public:
+ SwURLFieldContent( const SwContentType* pCnt,
+ const String& rName,
+ const String& rURL,
+ const SwTxtINetFmt* pAttr,
+ long nYPos )
+ : SwContent( pCnt, rName, nYPos ), sURL( rURL ), pINetAttr( pAttr )
+ {}
+
+ virtual BOOL IsProtect() const;
+ const String& GetURL() { return sURL; }
+ const SwTxtINetFmt* GetINetAttr() { return pINetAttr; }
+};
+
+//----------------------------------------------------------------------------
+class SwPostItContent : public SwContent
+{
+ const SwFmtFld* pFld;
+ SwRedline* pRedline;
+ bool mbPostIt;
+public:
+ SwPostItContent( const SwContentType* pCnt,
+ const String& rName,
+ const SwFmtFld* pField,
+ long nYPos )
+ : SwContent( pCnt, rName, nYPos ), pFld( pField ),mbPostIt(true)
+ {}
+ SwPostItContent( const SwContentType* pCnt,
+ const String& rName,
+ SwRedline* pRed,
+ long nYPos )
+ : SwContent( pCnt, rName, nYPos ), pRedline( pRed ),mbPostIt(false)
+ {}
+
+ const SwFmtFld* GetPostIt() { return pFld; }
+ SwRedline* GetRedline() { return pRedline; }
+ virtual BOOL IsProtect() const;
+ bool IsPostIt() {return mbPostIt; }
+};
+
+//----------------------------------------------------------------------------
+
+class SwGraphicContent : public SwContent
+{
+ String sLink;
+public:
+ SwGraphicContent(const SwContentType* pCnt, const String& rName, const String& rLink, long nYPos)
+ : SwContent( pCnt, rName, nYPos ), sLink( rLink )
+ {}
+ virtual ~SwGraphicContent();
+
+ const String& GetLink() const {return sLink;}
+};
+
+//----------------------------------------------------------------------------
+class SwTOXBaseContent : public SwContent
+{
+ const SwTOXBase* pBase;
+public:
+ SwTOXBaseContent(const SwContentType* pCnt, const String& rName, long nYPos, const SwTOXBase& rBase)
+ : SwContent( pCnt, rName, nYPos ), pBase(&rBase)
+ {}
+ virtual ~SwTOXBaseContent();
+
+ const SwTOXBase* GetTOXBase() const {return pBase;}
+};
+/*
+ class ContentType enthaelt Informationen zu einer Inhaltsform
+ Das MemberArray wird nur gefuellt, wenn der Inhalt mit GetMember
+ angefordert wird. Es wird nach Invalidate() nur dann neu geladen,
+ wenn der Inhalt erneut ausgelesen werden soll.
+*/
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+
+class SwContentType : public SwTypeNumber
+{
+ SwWrtShell* pWrtShell;
+ SwContentArr* pMember; // Array fuer Inhalte
+ String sContentTypeName; // Name der Inhaltsform
+ String sSingleContentTypeName; // Name der Inhaltsform, Singular
+ String sTypeToken; // Anhaengsel fuer URL
+ USHORT nMemberCount; // Inhaltsanzahl
+ USHORT nContentType; // Id der Inhaltsform
+ BYTE nOutlineLevel;
+ BOOL bMemberFilled : 1; // wurden die Inhalte bereits eingefuegt?
+ BOOL bIsInternalDrag:1; // koennen die Inhalte verschoben werden?
+ BOOL bDataValid : 1; //
+ BOOL bEdit: 1; // kann diese Type bearbeitet werden ?
+ BOOL bDelete: 1; // kann diese Type geloescht werden ?
+protected:
+ void RemoveNewline(String&);
+public:
+ SwContentType(SwWrtShell* pParent, USHORT nType, BYTE nLevel );
+ ~SwContentType();
+
+ void Init(BOOL* pbInvalidateWindow = 0);
+ void FillMemberList(BOOL* pbLevelChanged = NULL);
+ USHORT GetMemberCount() const
+ {return nMemberCount;};
+ USHORT GetType() const {return nContentType;}
+ const SwContent* GetMember(USHORT nIndex);
+ const String& GetName() {return sContentTypeName;}
+ const String& GetSingleName() const {return sSingleContentTypeName;}
+ const String& GetTypeToken() const{return sTypeToken;}
+
+ void SetOutlineLevel(BYTE nNew)
+ {
+ nOutlineLevel = nNew;
+ Invalidate();
+ }
+
+ void Invalidate(); // nur nMemberCount wird neu gelesen
+
+ BOOL IsEditable() const {return bEdit;}
+ BOOL IsDeletable() const {return bDelete;}
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/conttree.hxx b/sw/source/ui/inc/conttree.hxx
new file mode 100644
index 000000000000..d3a84b0bdb78
--- /dev/null
+++ b/sw/source/ui/inc/conttree.hxx
@@ -0,0 +1,334 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CONTTREE_HXX
+#define _CONTTREE_HXX
+
+#include <svtools/svtreebx.hxx>
+#include "swcont.hxx"
+
+class SwWrtShell;
+class SwContentType;
+class SwNavigationPI;
+class SwNavigationConfig;
+class Menu;
+class ToolBox;
+class SwGlblDocContents;
+class SwGlblDocContent;
+class SfxObjectShell;
+
+
+#define EDIT_MODE_EDIT 0
+#define EDIT_MODE_UPD_IDX 1
+#define EDIT_MODE_RMV_IDX 2
+#define EDIT_UNPROTECT_TABLE 3
+#define EDIT_MODE_DELETE 4
+#define EDIT_MODE_RENAME 5
+
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+
+class SwContentTree : public SvTreeListBox
+{
+ ImageList aEntryImages;
+ String sSpace;
+ AutoTimer aUpdTimer;
+
+ SwContentType* aActiveContentArr[CONTENT_TYPE_MAX];
+ SwContentType* aHiddenContentArr[CONTENT_TYPE_MAX];
+ String aContextStrings[CONTEXT_COUNT + 1];
+ String sRemoveIdx;
+ String sUpdateIdx;
+ String sUnprotTbl;
+ String sRename;
+ String sReadonlyIdx;
+ String sInvisible;
+ String sPostItShow;
+ String sPostItHide;
+ String sPostItDelete;
+
+ SwWrtShell* pHiddenShell; // gedropptes Doc
+ SwWrtShell* pActiveShell; // die aktive oder eine konst. offene View
+ SwNavigationConfig* pConfig;
+
+ sal_Int32 nActiveBlock;
+ USHORT nHiddenBlock;
+ USHORT nRootType;
+ USHORT nLastSelType;
+ BYTE nOutlineLevel;
+
+ BOOL bIsActive :1;
+ BOOL bIsConstant :1;
+ BOOL bIsHidden :1;
+ BOOL bDocChgdInDragging :1;
+ BOOL bIsInternalDrag :1;
+ BOOL bIsRoot :1;
+ BOOL bIsIdleClear :1;
+ BOOL bIsLastReadOnly :1;
+ BOOL bIsOutlineMoveable :1;
+ BOOL bViewHasChanged :1;
+ BOOL bIsImageListInitialized : 1;
+
+ static BOOL bIsInDrag;
+
+ void FindActiveTypeAndRemoveUserData();
+
+ using SvLBox::ExecuteDrop;
+ using SvTreeListBox::EditEntry;
+ using SvListView::Expand;
+ using SvListView::Collapse;
+ using SvListView::Select;
+
+protected:
+// virtual void Command( const CommandEvent& rCEvt );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ virtual void InitEntry(SvLBoxEntry*,const XubString&,const Image&,const Image&,SvLBoxButtonKind);
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ SwNavigationPI* GetParentWindow(){return
+ (SwNavigationPI*)Window::GetParent();}
+
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+ virtual void DragFinished( sal_Int8 );
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ sal_Bool FillTransferData( TransferDataContainer& rTransfer,
+ sal_Int8& rDragMode );
+ BOOL HasContentChanged();
+
+ virtual DragDropMode NotifyStartDrag( TransferDataContainer& rData,
+ SvLBoxEntry* );
+ virtual BOOL NotifyAcceptDrop( SvLBoxEntry* );
+
+ virtual BOOL NotifyMoving( SvLBoxEntry* pTarget,
+ SvLBoxEntry* pEntry,
+ SvLBoxEntry*& rpNewParent,
+ ULONG& rNewChildPos
+ );
+ virtual BOOL NotifyCopying( SvLBoxEntry* pTarget,
+ SvLBoxEntry* pEntry,
+ SvLBoxEntry*& rpNewParent,
+ ULONG& rNewChildPos
+ );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+
+ void EditEntry( SvLBoxEntry* pEntry, BYTE nMode );
+
+ void GotoContent(SwContent* pCnt);
+ static void SetInDrag(BOOL bSet) {bIsInDrag = bSet;}
+
+ virtual PopupMenu* CreateContextMenu( void );
+ virtual void ExcecuteContextMenuAction( USHORT nSelectedPopupEntry );
+
+public:
+ SwContentTree(Window* pParent, const ResId& rResId);
+ ~SwContentTree();
+
+ BOOL ToggleToRoot();
+ BOOL IsRoot() const {return bIsRoot;}
+ USHORT GetRootType() const {return nRootType;}
+ void SetRootType(USHORT nType);
+ void Display( BOOL bActiveView );
+ void Clear();
+ void SetHiddenShell(SwWrtShell* pSh);
+ void ShowHiddenShell();
+ void ShowActualView();
+ void SetActiveShell(SwWrtShell* pSh);
+ void SetConstantShell(SwWrtShell* pSh);
+
+ SwWrtShell* GetWrtShell()
+ {return bIsActive||bIsConstant ?
+ pActiveShell :
+ pHiddenShell;}
+
+ static BOOL IsInDrag() {return bIsInDrag;}
+ BOOL IsInternalDrag() const {return bIsInternalDrag != 0;}
+
+ sal_Int32 GetActiveBlock() const {return nActiveBlock;}
+
+ BYTE GetOutlineLevel()const {return nOutlineLevel;}
+ void SetOutlineLevel(BYTE nSet);
+
+ BOOL Expand( SvLBoxEntry* pParent );
+
+ BOOL Collapse( SvLBoxEntry* pParent );
+
+ void ExecCommand(USHORT nCmd, BOOL bModifier);
+
+ void ShowTree();
+ void HideTree();
+
+ BOOL IsConstantView() {return bIsConstant;}
+ BOOL IsActiveView() {return bIsActive;}
+ BOOL IsHiddenView() {return bIsHidden;}
+
+ const SwWrtShell* GetActiveWrtShell() {return pActiveShell;}
+ SwWrtShell* GetHiddenWrtShell() {return pHiddenShell;}
+
+ DECL_LINK( ContentDoubleClickHdl, SwContentTree * );
+// DECL_LINK( PopupHdl, Menu* );
+ DECL_LINK( TimerUpdate, Timer * );
+
+ virtual long GetTabPos( SvLBoxEntry*, SvLBoxTab* );
+ virtual void RequestingChilds( SvLBoxEntry* pParent );
+ virtual void GetFocus();
+ virtual void KeyInput(const KeyEvent& rKEvt);
+
+ virtual BOOL Select( SvLBoxEntry* pEntry, BOOL bSelect=TRUE );
+};
+
+
+//----------------------------------------------------------------------------
+// TreeListBox fuer Globaldokumente
+//----------------------------------------------------------------------------
+
+class SwLBoxString : public SvLBoxString
+{
+public:
+
+ SwLBoxString( SvLBoxEntry* pEntry, USHORT nFlags,
+ const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr)
+ {
+ }
+
+ virtual void Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags,
+ SvLBoxEntry* pEntry);
+};
+
+namespace sfx2 { class DocumentInserter; }
+namespace sfx2 { class FileDialogHelper; }
+
+class SwGlobalTree : public SvTreeListBox
+{
+private:
+ AutoTimer aUpdateTimer;
+ String aContextStrings[GLOBAL_CONTEXT_COUNT];
+
+ ImageList aEntryImages;
+
+ SwWrtShell* pActiveShell; //
+ SvLBoxEntry* pEmphasisEntry; // Drag'n Drop-Emphasis
+ SvLBoxEntry* pDDSource; // Quelle beim DnD
+ SwGlblDocContents* pSwGlblDocContents; // Array mit sortierten Inhalten
+
+ Window* pDefParentWin;
+ SwGlblDocContent* pDocContent;
+ sfx2::DocumentInserter* pDocInserter;
+
+ BOOL bIsInternalDrag :1;
+ BOOL bLastEntryEmphasis :1; // Drag'n Drop
+ BOOL bIsImageListInitialized : 1;
+
+ static const SfxObjectShell* pShowShell;
+
+ void InsertRegion( const SwGlblDocContent* _pContent,
+ const com::sun::star::uno::Sequence< ::rtl::OUString >& _rFiles );
+
+ DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper* );
+
+ using SvLBox::DoubleClickHdl;
+ using SvLBox::ExecuteDrop;
+ using Window::Update;
+
+protected:
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+
+ virtual long GetTabPos( SvLBoxEntry*, SvLBoxTab* );
+ virtual BOOL NotifyMoving( SvLBoxEntry* pTarget,
+ SvLBoxEntry* pEntry,
+ SvLBoxEntry*& rpNewParent,
+ ULONG& rNewChildPos
+ );
+ virtual BOOL NotifyCopying( SvLBoxEntry* pTarget,
+ SvLBoxEntry* pEntry,
+ SvLBoxEntry*& rpNewParent,
+ ULONG& rNewChildPos
+ );
+
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+ virtual void DragFinished( sal_Int8 );
+ virtual DragDropMode NotifyStartDrag( TransferDataContainer& rData,
+ SvLBoxEntry* );
+ virtual BOOL NotifyAcceptDrop( SvLBoxEntry* );
+
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void KeyInput(const KeyEvent& rKEvt);
+ virtual void GetFocus();
+ virtual void SelectHdl();
+ virtual void DeselectHdl();
+ virtual void InitEntry(SvLBoxEntry*,const XubString&,const Image&,const Image&,SvLBoxButtonKind);
+
+ void Clear();
+
+ DECL_LINK( PopupHdl, Menu* );
+ DECL_LINK( Timeout, Timer* );
+ DECL_LINK( DoubleClickHdl, SwGlobalTree * );
+
+ BOOL IsInternalDrag() const {return bIsInternalDrag != 0;}
+ SwNavigationPI* GetParentWindow()
+ { return (SwNavigationPI*)Window::GetParent(); }
+
+ void OpenDoc(const SwGlblDocContent*);
+ void GotoContent(const SwGlblDocContent*);
+ USHORT GetEnableFlags() const;
+
+ static const SfxObjectShell* GetShowShell() {return pShowShell;}
+ static void SetShowShell(const SfxObjectShell*pSet) {pShowShell = pSet;}
+ DECL_STATIC_LINK(SwGlobalTree, ShowFrameHdl, SwGlobalTree*);
+
+ virtual PopupMenu* CreateContextMenu( void );
+ virtual void ExcecuteContextMenuAction( USHORT nSelectedPopupEntry );
+
+public:
+ SwGlobalTree(Window* pParent, const ResId& rResId);
+ virtual ~SwGlobalTree();
+
+ void TbxMenuHdl(USHORT nTbxId, ToolBox* pBox);
+ void InsertRegion( const SwGlblDocContent* pCont,
+ const String* pFileName = 0 );
+ void EditContent(const SwGlblDocContent* pCont );
+
+ void ShowTree();
+ void HideTree();
+
+ void ExecCommand(USHORT nCmd);
+
+ void Display(BOOL bOnlyUpdateUserData = FALSE);
+
+ BOOL Update(BOOL bHard);
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/convert.hxx b/sw/source/ui/inc/convert.hxx
new file mode 100644
index 000000000000..fc1879bc4f2d
--- /dev/null
+++ b/sw/source/ui/inc/convert.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_CONVERT_HXX
+#define _SW_CONVERT_HXX
+
+#include <vcl/fixed.hxx>
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/edit.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <textcontrolcombo.hxx>
+
+class SwTableAutoFmt;
+class SwView;
+class SwWrtShell;
+class NumericField;
+struct SwInsertTableOptions;
+
+class SwConvertTableDlg: public SfxModalDialog
+{
+ RadioButton aTabBtn;
+ RadioButton aSemiBtn;
+ RadioButton aParaBtn;
+ RadioButton aOtherBtn;
+ Edit aOtherEd;
+ CheckBox aKeepColumn;
+ FixedLine aDelimFL;
+
+ CheckBox aHeaderCB;
+ CheckBox aRepeatHeaderCB;
+
+ FixedText aRepeatHeaderFT; // "dummy" to build before and after FT
+ FixedText aRepeatHeaderBeforeFT;
+ NumericField aRepeatHeaderNF;
+ FixedText aRepeatHeaderAfterFT;
+ TextControlCombo aRepeatHeaderCombo;
+
+ FixedLine aOptionsFL;
+ CheckBox aDontSplitCB;
+ CheckBox aBorderCB;
+ PushButton aAutoFmtBtn;
+
+ OKButton aOkBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+ String sConvertTextTable;
+ SwTableAutoFmt* pTAutoFmt;
+ SwWrtShell* pShell;
+
+ DECL_LINK( AutoFmtHdl, PushButton* );
+ DECL_LINK( BtnHdl, Button* );
+ DECL_LINK( CheckBoxHdl, CheckBox *pCB = 0 );
+ DECL_LINK( ReapeatHeaderCheckBoxHdl, void* p = 0 );
+
+public:
+ SwConvertTableDlg( SwView& rView, bool bToTable );
+ ~SwConvertTableDlg();
+
+ void GetValues( sal_Unicode& rDelim,
+ SwInsertTableOptions& rInsTblOpts,
+ SwTableAutoFmt *& prTAFmt );
+};
+
+
+#endif
diff --git a/sw/source/ui/inc/cption.hxx b/sw/source/ui/inc/cption.hxx
new file mode 100644
index 000000000000..edb8590d5c8f
--- /dev/null
+++ b/sw/source/ui/inc/cption.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _CPTION_HXX
+#define _CPTION_HXX
+
+#include <svx/stddlg.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <actctrl.hxx>
+
+
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XElementAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+
+class SwFldMgr;
+class SwView;
+
+#include <wrtsh.hxx>
+#include "optload.hxx"
+#include "swlbox.hxx"
+
+
+class SwCaptionDialog : public SvxStandardDialog
+{
+ class CategoryBox : public ComboBox
+ {
+ public:
+ CategoryBox( Window* pParent, const ResId& rResId )
+ : ComboBox( pParent, rResId )
+ {}
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ };
+
+ FixedText aTextText;
+ Edit aTextEdit;
+ FixedLine aSettingsFL;
+ FixedText aCategoryText;
+ CategoryBox aCategoryBox;
+ FixedText aFormatText;
+ ListBox aFormatBox;
+ //#i61007# order of captions
+ FixedText aNumberingSeparatorFT;
+ Edit aNumberingSeparatorED;
+ FixedText aSepText;
+ Edit aSepEdit;
+ FixedText aPosText;
+ ListBox aPosBox;
+ OKButton aOKButton;
+ CancelButton aCancelButton;
+ HelpButton aHelpButton;
+ PushButton aAutoCaptionButton;
+ PushButton aOptionButton;
+
+ String sNone;
+
+ SwCaptionPreview aPrevWin;
+
+ SwView &rView; //Suchen per aktive ::com::sun::star::sdbcx::View vermeiden.
+ SwFldMgr *pMgr; //Ptr um das include zu sparen
+ SelectionType eType;
+
+ String sCharacterStyle;
+ String sObjectName;
+ bool bCopyAttributes;
+ bool bOrderNumberingFirst; //#i61007# order of captions
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xNameAccess;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > xNamed;
+
+ DECL_LINK( SelectHdl, ListBox * );
+ DECL_LINK( ModifyHdl, Edit * );
+ DECL_LINK( OptionHdl, Button * );
+ DECL_LINK( CaptionHdl, PushButton*);
+
+ virtual void Apply();
+
+ void DrawSample();
+ void CheckButtonWidth();
+ void ApplyCaptionOrder(); //#i61007# order of captions
+
+public:
+ SwCaptionDialog( Window *pParent, SwView &rV );
+ ~SwCaptionDialog();
+};
+
+#endif
+
+
diff --git a/sw/source/ui/inc/dbconfig.hxx b/sw/source/ui/inc/dbconfig.hxx
new file mode 100644
index 000000000000..2e82249b84b9
--- /dev/null
+++ b/sw/source/ui/inc/dbconfig.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _DBCONFIG_HXX
+#define _DBCONFIG_HXX
+
+#include <unotools/configitem.hxx>
+#include "swdllapi.h"
+
+struct SwDBData;
+
+class SW_DLLPUBLIC SwDBConfig : public utl::ConfigItem
+{
+ SW_DLLPRIVATE const com::sun::star::uno::Sequence<rtl::OUString>& GetPropertyNames();
+
+ SwDBData* pAdrImpl;
+ SwDBData* pBibImpl;
+
+public:
+ SwDBConfig();
+ virtual ~SwDBConfig();
+
+ void Load();
+ const SwDBData& GetAddressSource();
+ const SwDBData& GetBibliographySource();
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/dbinsdlg.hxx b/sw/source/ui/inc/dbinsdlg.hxx
new file mode 100644
index 000000000000..c0a530de9f3a
--- /dev/null
+++ b/sw/source/ui/inc/dbinsdlg.hxx
@@ -0,0 +1,188 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _DBINSDLG_HXX
+#define _DBINSDLG_HXX
+
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+#include <svtools/svmedit.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svl/svarray.hxx>
+#include <unotools/configitem.hxx>
+#include <numfmtlb.hxx>
+#include <swdbdata.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+namespace com{namespace sun{namespace star{
+ namespace sdbcx{
+ class XColumnsSupplier;
+ }
+ namespace sdbc{
+ class XDataSource;
+ class XConnection;
+ class XResultSet;
+ }
+}}}
+
+class SwTableAutoFmt;
+class SwView;
+class SfxItemSet;
+class SwTableRep;
+class _DB_Columns;
+
+struct SwInsDBColumn
+{
+ rtl::OUString sColumn, sUsrNumFmt;
+ sal_Int32 nDBNumFmt;
+ sal_uInt32 nUsrNumFmt;
+ LanguageType eUsrNumFmtLng;
+ USHORT nCol;
+ BOOL bHasFmt : 1;
+ BOOL bIsDBFmt : 1;
+
+ SwInsDBColumn( const String& rStr, USHORT nColumn )
+ : sColumn( rStr ),
+ nDBNumFmt( 0 ),
+ nUsrNumFmt( 0 ),
+ eUsrNumFmtLng( LANGUAGE_SYSTEM ),
+ nCol( nColumn ),
+ bHasFmt(FALSE),
+ bIsDBFmt(TRUE)
+ {}
+
+ int operator==( const SwInsDBColumn& rCmp ) const
+ { return sColumn == rCmp.sColumn; }
+ int operator<( const SwInsDBColumn& rCmp ) const;
+};
+
+typedef SwInsDBColumn* SwInsDBColumnPtr;
+SV_DECL_PTRARR_SORT_DEL( SwInsDBColumns, SwInsDBColumnPtr, 32, 32 )
+
+
+class SwInsertDBColAutoPilot : public SfxModalDialog, public utl::ConfigItem
+{
+ FixedText aFtInsertData;
+ RadioButton aRbAsTable;
+ RadioButton aRbAsField;
+ RadioButton aRbAsText;
+
+ FixedLine aFlHead;
+ FixedText aFtDbColumn;
+
+ ListBox aLbTblDbColumn;
+ ListBox aLbTxtDbColumn;
+
+ FixedLine aFlFormat;
+ RadioButton aRbDbFmtFromDb;
+ RadioButton aRbDbFmtFromUsr;
+ NumFormatListBox aLbDbFmtFromUsr;
+
+ /* ----- Page Text/Field ------- */
+ ImageButton aIbDbcolToEdit;
+ MultiLineEdit aEdDbText;
+ FixedText aFtDbParaColl;
+ ListBox aLbDbParaColl;
+
+ /* ----- Page Table ------------ */
+ ImageButton aIbDbcolAllTo;
+ ImageButton aIbDbcolOneTo;
+ ImageButton aIbDbcolOneFrom;
+ ImageButton aIbDbcolAllFrom;
+ FixedText aFtTableCol;
+ ListBox aLbTableCol;
+ CheckBox aCbTableHeadon;
+ RadioButton aRbHeadlColnms;
+ RadioButton aRbHeadlEmpty;
+ PushButton aPbTblFormat;
+ PushButton aPbTblAutofmt;
+
+ OKButton aBtOk;
+ CancelButton aBtCancel;
+ HelpButton aBtHelp;
+
+ FixedLine aFlBottom;
+
+ SwInsDBColumns aDBColumns;
+ const SwDBData aDBData;
+
+ Link aOldNumFmtLnk;
+ String sNoTmpl;
+
+ SwView* pView;
+ SwTableAutoFmt* pTAutoFmt;
+
+ SfxItemSet* pTblSet;
+ SwTableRep* pRep;
+ USHORT nGBFmtLen;
+
+ DECL_LINK( PageHdl, Button* );
+ DECL_LINK( AutoFmtHdl, PushButton* );
+ DECL_LINK( TblFmtHdl, PushButton* );
+ DECL_LINK( DBFormatHdl, Button* );
+ DECL_LINK( TblToFromHdl, Button* );
+ DECL_LINK( SelectHdl, ListBox* );
+ DECL_LINK( DblClickHdl, ListBox* );
+ DECL_LINK( HeaderHdl, Button* );
+
+ BOOL SplitTextToColArr( const String& rTxt, _DB_Columns& rColArr, BOOL bInsField );
+ using SfxModalDialog::Notify;
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+ virtual void Commit();
+ void Load();
+
+ // setze die Tabellen - Eigenschaften
+ void SetTabSet();
+
+public:
+ SwInsertDBColAutoPilot( SwView& rView,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
+ com::sun::star::uno::Reference<com::sun::star::sdbcx::XColumnsSupplier>,
+ const SwDBData& rData );
+
+ virtual ~SwInsertDBColAutoPilot();
+
+ void DataToDoc( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConnection,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet);
+
+};
+
+#endif
diff --git a/sw/source/ui/inc/dbtree.hxx b/sw/source/ui/inc/dbtree.hxx
new file mode 100644
index 000000000000..d6c81e2e5ce8
--- /dev/null
+++ b/sw/source/ui/inc/dbtree.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _DBTREE_HXX
+#define _DBTREE_HXX
+
+#include <svtools/svtreebx.hxx>
+#include <com/sun/star/uno/Reference.h>
+
+namespace com{namespace sun{namespace star{namespace container{
+ class XNameAccess;
+}}}}
+#include "swdllapi.h"
+#include <swtypes.hxx>
+#include <swunodef.hxx>
+
+class SwDBTreeList_Impl;
+class SwWrtShell;
+
+class SW_DLLPUBLIC SwDBTreeList : public SvTreeListBox
+{
+ ImageList aImageList;
+ ImageList aImageListHC;
+ Image aDBBMP;
+ Image aTableBMP;
+ Image aQueryBMP;
+
+ String sDefDBName;
+ BOOL bInitialized;
+ BOOL bShowColumns;
+
+ SwDBTreeList_Impl* pImpl;
+
+ SW_DLLPRIVATE DECL_LINK( DBCompare, SvSortData* );
+
+ SW_DLLPRIVATE void InitTreeList();
+ SW_DLLPRIVATE virtual void RequestingChilds( SvLBoxEntry* pParent );
+
+ SW_DLLPRIVATE virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ SW_DLLPRIVATE virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ using SvTreeListBox::Select;
+
+public:
+ SwDBTreeList( Window* pParent, const ResId& rResId,
+ SwWrtShell* pSh,
+ const String& rDefDBName = aEmptyStr,
+ const BOOL bShowCol = FALSE );
+ virtual ~SwDBTreeList();
+
+ String GetDBName( String& rTableName, String& rColumnName, BOOL* pbIsTable = 0);
+
+ void Select( const String& rDBName, const String& rTableName,
+ const String& rColumnName );
+
+ void ShowColumns(BOOL bShowCol);
+ void SetWrtShell(SwWrtShell& rSh);
+
+ void AddDataSource(const String& rSource);
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/dbui.hxx b/sw/source/ui/inc/dbui.hxx
new file mode 100644
index 000000000000..2c8e9cdf02c7
--- /dev/null
+++ b/sw/source/ui/inc/dbui.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _DBUI_HXX
+#define _DBUI_HXX
+
+#include <svx/stddlg.hxx>
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/fixed.hxx>
+
+
+class SW_DLLPUBLIC PrintMonitor: public ModelessDialog
+{
+public:
+ enum PrintMonitorType
+ {
+ MONITOR_TYPE_PRINT,
+ MONITOR_TYPE_MAIL,
+ MONITOR_TYPE_SAVE
+ };
+ FixedText aDocName;
+ FixedText aPrinting;
+ FixedText aPrinter;
+ FixedText aPrintInfo;
+ CancelButton aCancel;
+
+ PrintMonitor( Window *pParent, PrintMonitorType eType );
+
+ void ResizeControls();
+};
+
+class CreateMonitor : public ModelessDialog
+{
+public:
+ CreateMonitor( Window *pParent );
+
+ void SetTotalCount( sal_Int32 nTotal );
+ void SetCurrentPosition( sal_Int32 nCurrent );
+
+ void SetCancelHdl( const Link& rLink );
+
+private: //methods
+ void UpdateCountingText();
+
+private: //member
+ FixedText m_aStatus;
+ FixedText m_aProgress;
+ FixedText m_aCreateDocuments;
+ FixedText m_aCounting;
+ CancelButton m_aCancelButton;
+
+ String m_sCountingPattern;
+ String m_sVariable_Total;
+ String m_sVariable_Position;
+ sal_Int32 m_nTotalCount;
+ sal_Int32 m_nCurrentPosition;
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/dialmgr.hxx b/sw/source/ui/inc/dialmgr.hxx
new file mode 100644
index 000000000000..ebd9731c5e0a
--- /dev/null
+++ b/sw/source/ui/inc/dialmgr.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_DIALMGR_HXX
+#define _SW_DIALMGR_HXX
+
+// include ---------------------------------------------------------------
+
+#include <tools/resid.hxx>
+
+// forward ---------------------------------------------------------------
+
+class ResMgr;
+struct SwDialogsResMgr
+{
+ static ResMgr* GetResMgr();
+};
+
+#define SWDIALOG_MGR() SwDialogsResMgr::GetResMgr()
+#define SW_RES(i) ResId(i,SWDIALOG_MGR())
+#define SW_RESSTR(i) UniString(ResId(i,SWDIALOG_MGR()))
+#define SW_RESSSTR(i) String(ResId(i,SWDIALOG_MGR()))
+
+#endif
+
diff --git a/sw/source/ui/inc/docfnote.hxx b/sw/source/ui/inc/docfnote.hxx
new file mode 100644
index 000000000000..b3ffde863596
--- /dev/null
+++ b/sw/source/ui/inc/docfnote.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _DOCFNOTE_HXX
+#define _DOCFNOTE_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+class SwWrtShell;
+
+class SwFootNoteOptionDlg :public SfxTabDialog
+{
+ SwWrtShell &rSh;
+ Link aOldOkHdl;
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+
+#ifdef _SOLAR__PRIVATE
+ DECL_LINK( OkHdl, Button * );
+#endif
+
+public:
+ SwFootNoteOptionDlg(Window *pParent, SwWrtShell &rSh );
+ ~SwFootNoteOptionDlg();
+};
+
+#endif
diff --git a/sw/source/ui/inc/docstdlg.hxx b/sw/source/ui/inc/docstdlg.hxx
new file mode 100644
index 000000000000..f269693975cc
--- /dev/null
+++ b/sw/source/ui/inc/docstdlg.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _DOCSTDLG_HXX
+#define _DOCSTDLG_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+
+#include "docstat.hxx"
+
+/*--------------------------------------------------------------------
+ Beschreibung: DocInfo jetzt als Page
+ --------------------------------------------------------------------*/
+
+class SwDocStatPage: public SfxTabPage
+{
+public:
+ SwDocStatPage(Window *pParent, const SfxItemSet &rSet);
+ ~SwDocStatPage();
+
+ static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
+
+protected:
+ virtual BOOL FillItemSet( SfxItemSet &rSet);
+ virtual void Reset (const SfxItemSet &rSet);
+
+ DECL_LINK( UpdateHdl, PushButton*);
+
+private:
+ FixedText aTableLbl;
+ FixedText aGrfLbl;
+ FixedText aOLELbl;
+ FixedText aPageLbl;
+ FixedText aParaLbl;
+ FixedText aWordLbl;
+ FixedText aCharLbl;
+ FixedText aLineLbl;
+
+ FixedInfo aTableNo;
+ FixedInfo aGrfNo;
+ FixedInfo aOLENo;
+ FixedInfo aPageNo;
+ FixedInfo aParaNo;
+ FixedInfo aWordNo;
+ FixedInfo aCharNo;
+ FixedInfo aLineNo;
+
+ PushButton aUpdatePB;
+ SwDocStat aDocStat;
+
+ void Update();
+
+ using Window::SetData;
+ void SetData(const SwDocStat &rStat);
+};
+
+#endif
diff --git a/sw/source/ui/inc/drawbase.hxx b/sw/source/ui/inc/drawbase.hxx
new file mode 100644
index 000000000000..783bd730a86d
--- /dev/null
+++ b/sw/source/ui/inc/drawbase.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_DRAWBASE_HXX
+#define _SW_DRAWBASE_HXX
+
+#include <tools/gen.hxx>
+
+class SwView;
+class SwWrtShell;
+class SwEditWin;
+class KeyEvent;
+class MouseEvent;
+
+#define MIN_FREEHAND_DISTANCE 10
+
+/*************************************************************************
+|*
+|* Basisklasse fuer alle Funktionen
+|*
+\************************************************************************/
+
+class SwDrawBase
+{
+protected:
+ SwView* m_pView;
+ SwWrtShell* m_pSh;
+ SwEditWin* m_pWin;
+ Point m_aStartPos; // Position von BeginCreate
+ Point m_aMDPos; // Position von MouseButtonDown
+ USHORT m_nSlotId;
+ BOOL m_bCreateObj :1;
+ BOOL m_bInsForm :1;
+
+ Point GetDefaultCenterPos();
+public:
+ SwDrawBase(SwWrtShell *pSh, SwEditWin* pWin, SwView* pView);
+ virtual ~SwDrawBase();
+
+ void SetDrawPointer();
+ void EnterSelectMode(const MouseEvent& rMEvt);
+ inline BOOL IsInsertForm() const { return m_bInsForm; }
+ inline BOOL IsCreateObj() const { return m_bCreateObj; }
+
+ // Mouse- & Key-Events; Returnwert=TRUE: Event wurde bearbeitet
+ virtual BOOL KeyInput(const KeyEvent& rKEvt);
+ virtual BOOL MouseMove(const MouseEvent& rMEvt);
+ virtual BOOL MouseButtonUp(const MouseEvent& rMEvt);
+ virtual BOOL MouseButtonDown(const MouseEvent& rMEvt);
+
+ void BreakCreate();
+ void SetSlotId(USHORT nSlot) {m_nSlotId = nSlot;}
+ USHORT GetSlotId() { return m_nSlotId;}
+
+ virtual void Activate(const USHORT nSlotId); // Function aktivieren
+ virtual void Deactivate(); // Function deaktivieren
+
+ virtual void CreateDefaultObject();
+
+ // #i33136#
+ virtual bool doConstructOrthogonal() const;
+};
+
+
+
+#endif // _SW_DRAWBASE_HXX
+
diff --git a/sw/source/ui/inc/drawsh.hxx b/sw/source/ui/inc/drawsh.hxx
new file mode 100644
index 000000000000..deb0849d66a0
--- /dev/null
+++ b/sw/source/ui/inc/drawsh.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWDRAWSH_HXX
+#define _SWDRAWSH_HXX
+
+#include "drwbassh.hxx"
+
+class SwDrawBaseShell;
+
+class SwDrawShell: public SwDrawBaseShell
+{
+public:
+ SFX_DECL_INTERFACE(SW_DRAWSHELL)
+ TYPEINFO();
+
+ SwDrawShell(SwView &rView);
+
+ void Execute(SfxRequest &);
+ void GetState(SfxItemSet &);
+ void ExecDrawDlg(SfxRequest& rReq);
+ void ExecDrawAttrArgs(SfxRequest& rReq);
+ void GetDrawAttrState(SfxItemSet &rSet);
+
+ void ExecFormText(SfxRequest& rReq);
+ void GetFormTextState(SfxItemSet& rSet);
+};
+
+#endif
diff --git a/sw/source/ui/inc/drformsh.hxx b/sw/source/ui/inc/drformsh.hxx
new file mode 100644
index 000000000000..8648742b1f99
--- /dev/null
+++ b/sw/source/ui/inc/drformsh.hxx
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWDRWFORMSH_HXX
+#define _SWDRWFORMSH_HXX
+
+#include "drwbassh.hxx"
+
+class SwDrawBaseShell;
+
+class SwDrawFormShell: public SwDrawBaseShell
+{
+public:
+ SFX_DECL_INTERFACE(SW_DRAWFORMSHELL)
+ TYPEINFO();
+
+ SwDrawFormShell(SwView &rView);
+ virtual ~SwDrawFormShell();
+
+ void Execute(SfxRequest &);
+ void GetState(SfxItemSet &);
+};
+
+#endif
diff --git a/sw/source/ui/inc/drpcps.hxx b/sw/source/ui/inc/drpcps.hxx
new file mode 100644
index 000000000000..50140443f726
--- /dev/null
+++ b/sw/source/ui/inc/drpcps.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _DRPCPS_HXX
+#define _DRPCPS_HXX
+
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/tabdlg.hxx>
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+class SwWrtShell;
+
+// class SwDropCapsDlg ******************************************************
+
+class SwDropCapsDlg : public SfxSingleTabDialog
+{
+
+public:
+
+ SwDropCapsDlg(Window *pParent, const SfxItemSet &rSet );
+ ~SwDropCapsDlg();
+
+};
+
+class SwDropCapsPict;
+
+// class SwDropCapsPage *****************************************************
+
+class SwDropCapsPage : public SfxTabPage
+{
+friend class SwDropCapsPict;
+
+ CheckBox aDropCapsBox;
+ CheckBox aWholeWordCB;
+ FixedText aSwitchText;
+ NumericField aDropCapsField;
+ FixedText aLinesText;
+ NumericField aLinesField;
+ FixedText aDistanceText;
+ MetricField aDistanceField;
+ FixedLine aSettingsFL;
+
+ FixedText aTextText;
+ Edit aTextEdit;
+ FixedText aTemplateText;
+ ListBox aTemplateBox;
+ FixedLine aContentFL;
+
+ SwDropCapsPict *pPict;
+
+ BOOL bModified;
+ BOOL bFormat;
+ BOOL bHtmlMode;
+
+ SwWrtShell &rSh;
+
+ SwDropCapsPage(Window *pParent, const SfxItemSet &rSet);
+ ~SwDropCapsPage();
+
+ virtual int DeactivatePage(SfxItemSet *pSet);
+ void FillSet( SfxItemSet &rSet );
+
+ DECL_LINK( ClickHdl, Button * );
+ DECL_LINK( ModifyHdl, Edit * );
+ DECL_LINK( SelectHdl, ListBox * );
+ DECL_LINK( WholeWordHdl, CheckBox * );
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+public:
+
+ static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet &rSet);
+ virtual void Reset (const SfxItemSet &rSet);
+
+ void SetFormat(BOOL bSet){bFormat = bSet;}
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/drwbassh.hxx b/sw/source/ui/inc/drwbassh.hxx
new file mode 100644
index 000000000000..dcdd1c1b427d
--- /dev/null
+++ b/sw/source/ui/inc/drwbassh.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWDRWBASSH_HXX
+#define _SWDRWBASSH_HXX
+#include "basesh.hxx"
+
+class SwView;
+class SfxItemSet;
+class SwDrawBase;
+class AbstractSvxNameDialog;
+struct SvxSwFrameValidation;
+
+class SwDrawBaseShell: public SwBaseShell
+{
+ SwDrawBase* pDrawActual;
+
+ UINT16 eDrawMode;
+ BOOL bRotate : 1;
+ BOOL bSelMove: 1;
+
+ DECL_LINK( CheckGroupShapeNameHdl, AbstractSvxNameDialog* );
+ DECL_LINK(ValidatePosition, SvxSwFrameValidation* );
+public:
+ SwDrawBaseShell(SwView &rShell);
+ virtual ~SwDrawBaseShell();
+
+ SFX_DECL_INTERFACE(SW_DRAWBASESHELL)
+ TYPEINFO();
+
+ void Execute(SfxRequest &);
+ void GetState(SfxItemSet &);
+ void DisableState(SfxItemSet &rSet) { Disable(rSet);}
+ BOOL Disable(SfxItemSet& rSet, USHORT nWhich = 0);
+
+ void StateStatusline(SfxItemSet &rSet);
+
+};
+
+
+#endif
diff --git a/sw/source/ui/inc/drwtxtsh.hxx b/sw/source/ui/inc/drwtxtsh.hxx
new file mode 100644
index 000000000000..1bbec5daafcb
--- /dev/null
+++ b/sw/source/ui/inc/drwtxtsh.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWDRWTXTSH_HXX
+#define _SWDRWTXTSH_HXX
+
+#include <sfx2/shell.hxx>
+#include "shellid.hxx"
+
+class SdrView;
+class SwView;
+class SwWrtShell;
+class SfxModule;
+
+class SwDrawTextShell: public SfxShell
+{
+ SwView &rView;
+
+ SdrView *pSdrView;
+
+ BOOL bRotate : 1;
+ BOOL bSelMove: 1;
+
+ void SetAttrToMarked(const SfxItemSet& rAttr);
+ void InsertSymbol(SfxRequest& rReq);
+ BOOL IsTextEdit();
+public:
+ SFX_DECL_INTERFACE(SW_DRWTXTSHELL)
+ TYPEINFO();
+
+ SwView &GetView() { return rView; }
+ SwWrtShell &GetShell();
+
+ SwDrawTextShell(SwView &rView);
+ virtual ~SwDrawTextShell();
+
+ virtual ::svl::IUndoManager*
+ GetUndoManager();
+
+ void StateDisableItems(SfxItemSet &);
+
+ void Execute(SfxRequest &);
+ void ExecDraw(SfxRequest &);
+ void GetState(SfxItemSet &);
+ void GetDrawTxtCtrlState(SfxItemSet&);
+
+ void ExecFontWork(SfxRequest& rReq);
+ void StateFontWork(SfxItemSet& rSet);
+ void ExecFormText(SfxRequest& rReq);
+ void GetFormTextState(SfxItemSet& rSet);
+ void ExecDrawLingu(SfxRequest &rReq);
+ void ExecUndo(SfxRequest &rReq);
+ void StateUndo(SfxItemSet &rSet);
+ void ExecClpbrd(SfxRequest &rReq);
+ void StateClpbrd(SfxItemSet &rSet);
+ void StateInsert(SfxItemSet &rSet);
+ void ExecTransliteration(SfxRequest &);
+
+ void Init();
+ void StateStatusline(SfxItemSet &rSet);
+};
+
+#endif
diff --git a/sw/source/ui/inc/dselect.hxx b/sw/source/ui/inc/dselect.hxx
new file mode 100644
index 000000000000..37d3d84832bb
--- /dev/null
+++ b/sw/source/ui/inc/dselect.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_DSELECT_HXX
+#define _SW_DSELECT_HXX
+
+#include "drawbase.hxx"
+
+/*************************************************************************
+|*
+|* Rechteck zeichnen
+|*
+\************************************************************************/
+
+class DrawSelection : public SwDrawBase
+{
+ public:
+ DrawSelection(SwWrtShell* pSh, SwEditWin* pWin, SwView* pView);
+
+ // Mouse- & Key-Events
+ virtual BOOL KeyInput(const KeyEvent& rKEvt);
+
+ virtual void Activate(const USHORT nSlotId); // Function aktivieren
+};
+
+
+
+#endif // _SW_DSELECT_HXX
+
diff --git a/sw/source/ui/inc/edtwin.hxx b/sw/source/ui/inc/edtwin.hxx
new file mode 100644
index 000000000000..b70a3f75aa96
--- /dev/null
+++ b/sw/source/ui/inc/edtwin.hxx
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _EDTWIN_HXX
+#define _EDTWIN_HXX
+
+#include <svx/svdobj.hxx>
+#include <tools/link.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/window.hxx>
+#include <svtools/transfer.hxx>
+#include <swevent.hxx>
+
+#define _SVSTDARR_STRINGSISORTDTOR
+#include <svl/svstdarr.hxx>
+
+class SwWrtShell;
+class SwView;
+class SwRect;
+class ViewShell;
+class SwAnchorMarker;
+class SdrObject;
+class SwShadowCursor;
+class DataChangedEvent;
+class SvxAutoCorrCfg;
+class SvxAutoCorrect;
+class SwPaM;
+struct SwApplyTemplate;
+struct QuickHelpData;
+class SdrDropMarkerOverlay;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Eingabe-Fenster
+ --------------------------------------------------------------------*/
+
+class SwEditWin: public Window,
+ public DropTargetHelper, public DragSourceHelper
+{
+friend void ScrollMDI(ViewShell* pVwSh, const SwRect&,
+ USHORT nRangeX, USHORT nRangeY);
+friend BOOL IsScrollMDI(ViewShell* pVwSh, const SwRect&);
+
+friend void SizeNotify(ViewShell* pVwSh, const Size &);
+
+friend void PageNumNotify( ViewShell* pVwSh,
+ USHORT nPhyNum,
+ USHORT nVirtNum,
+ const String& rPg );
+
+ static QuickHelpData* pQuickHlpData;
+
+ static BOOL bReplaceQuote;
+ static long nDDStartPosX, nDDStartPosY;
+
+ static Color aTextColor; //Textfarbe, fuer die Giesskanne
+ static BOOL bTransparentBackColor; // Hintergrund transparent
+ static Color aTextBackColor; //Texthintergrundfarbe, fuer die Giesskanne
+
+ /*
+ * Timer und Handler fuer das Weiterscrollen, wenn der
+ * Mauspointer innerhalb eines Drag-Vorgangs ausserhalb des
+ * EditWin stehen bleibt. In regelmaessigen Intervallen wird
+ * die Selektion in Richtung der Mausposition vergroessert.
+ */
+ AutoTimer aTimer;
+ // Timer fuer verschachtelte KeyInputs (z.B. fuer Tabellen)
+ Timer aKeyInputTimer;
+ // timer for ANY-KeyInut question without a following KeyInputEvent
+ Timer aKeyInputFlushTimer;
+
+ String aInBuffer;
+ LanguageType eBufferLanguage;
+ Point aStartPos;
+ Point aMovePos;
+ Point aRszMvHdlPt;
+ Timer aTemplateTimer;
+
+ // Type/Objecte ueber dem der MousePointer steht
+ SwCallMouseEvent aSaveCallEvent;
+
+ SwApplyTemplate *pApplyTempl;
+ SwAnchorMarker *pAnchorMarker; // zum Verschieben eines Ankers
+
+ SdrDropMarkerOverlay *pUserMarker;
+ SdrObject *pUserMarkerObj;
+ SwShadowCursor *pShadCrsr;
+ Point *pRowColumnSelectionStart; // save position where table row/column selection has been started
+
+ SwView &rView;
+
+ int aActHitType; // aktueller Mauspointer
+
+ ULONG m_nDropFormat; //Format aus dem letzten QueryDrop
+ USHORT m_nDropAction; //Action aus dem letzten QueryDrop
+ USHORT m_nDropDestination; //Ziel aus dem letzten QueryDrop
+
+ UINT16 eBezierMode;
+ UINT16 nInsFrmColCount; //Spaltenzahl fuer interaktiven Rahmen
+ SdrObjKind eDrawMode;
+ BOOL bLinkRemoved : 1,
+ bMBPressed : 1,
+ bInsDraw : 1,
+ bInsFrm : 1,
+ bIsInMove : 1,
+ bIsInDrag : 1, //StartExecuteDrag nich doppelt ausfuehren
+ bOldIdle : 1, //Zum abschalten des Idle'ns
+ bOldIdleSet : 1, //waehrend QeueryDrop
+ bTblInsDelMode : 1, //
+ bTblIsInsMode : 1, //
+ bTblIsColMode : 1, //
+ bChainMode : 1, //Rahmen verbinden
+ bWasShdwCrsr : 1, //ShadowCrsr war im MouseButtonDown an
+ bLockInput : 1, //Lock waehrend die Rechenleiste aktiv ist
+ bIsRowDrag : 1, //selection of rows is used, in combination with pRowColumnSelectionStart
+ /** #i42732# display status of font size/name depending on either the input language or the
+ selection position depending on what has changed lately
+ */
+ bUseInputLanguage: 1,
+ bObjectSelect : 1;
+
+
+ USHORT nKS_NUMDOWN_Count; // #i23725#
+ USHORT nKS_NUMINDENTINC_Count;
+
+ void LeaveArea(const Point &);
+ void JustifyAreaTimer();
+ inline void EnterArea();
+
+ void RstMBDownFlags();
+
+ void ChangeFly( BYTE nDir, BOOL bWeb = FALSE );
+ void ChangeDrawing( BYTE nDir );
+
+ BOOL EnterDrawMode(const MouseEvent& rMEvt, const Point& aDocPos);
+ BOOL RulerColumnDrag( const MouseEvent& rMEvt, BOOL bVerticalMode);
+
+ //Hilfsfunktionen fuer D&D
+ void DropCleanup();
+ void CleanupDropUserMarker();
+ USHORT GetDropDestination( const Point& rPixPnt,
+ SdrObject ** ppObj = 0 );
+ //select the object/cursor at the mouse position of the context menu request
+ BOOL SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos );
+
+ /*
+ * Handler fuer das Weiterscrollen, wenn der Mauspointer innerhalb eines
+ * Drag-Vorgangs ausserhalb des EditWin stehen bleibt. In regelmaessigen
+ * Intervallen wird die Selektion in Richtung der Mausposition
+ * vergroessert.
+ */
+ DECL_LINK( TimerHandler, Timer * );
+ void StartDDTimer();
+ void StopDDTimer(SwWrtShell *, const Point &);
+ DECL_LINK( DDHandler, Timer * );
+
+ // timer for ANY-KeyInut question without a following KeyInputEvent
+ DECL_LINK( KeyInputFlushHandler, Timer * );
+
+ // Timer fuer verschachtelte KeyInputs (z.B. fuer Tabellen)
+ DECL_LINK( KeyInputTimerHandler, Timer * );
+
+ // Timer fuer das ApplyTemplates per Maus (verkapptes Drag&Drop)
+ DECL_LINK( TemplateTimerHdl, Timer* );
+
+ using OutputDevice::GetTextColor;
+
+protected:
+
+ virtual void DataChanged( const DataChangedEvent& );
+ virtual void PrePaint();
+ virtual void Paint( const Rectangle& rRect );
+ virtual void KeyInput(const KeyEvent &rKEvt);
+
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+
+ virtual void MouseMove(const MouseEvent& rMEvt);
+ virtual void MouseButtonDown(const MouseEvent& rMEvt);
+ virtual void MouseButtonUp(const MouseEvent& rMEvt);
+ virtual void RequestHelp(const HelpEvent& rEvt);
+
+ virtual void Command( const CommandEvent& rCEvt );
+
+ // Drag & Drop Interface
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ virtual XubString GetSurroundingText() const;
+ virtual Selection GetSurroundingTextSelection() const;
+
+ void ShowAutoTextCorrectQuickHelp( const String& rWord, SvxAutoCorrCfg* pACfg,
+ SvxAutoCorrect* pACorr, sal_Bool bFromIME = sal_False );
+public:
+
+ void UpdatePointer(const Point &, USHORT nButtons = 0);
+
+ BOOL IsDrawSelMode();
+ BOOL IsDrawAction() { return (bInsDraw); }
+ void SetDrawAction(BOOL bFlag) { bInsDraw = bFlag; }
+
+ void SetObjectSelect( BOOL bVal ) { bObjectSelect = bVal; }
+ BOOL IsObjectSelect() const { return bObjectSelect; }
+
+ inline SdrObjKind GetSdrDrawMode(/*BOOL bBuf = FALSE*/) const { return eDrawMode; }
+ inline void SetSdrDrawMode( SdrObjKind eSdrObjectKind ) { eDrawMode = eSdrObjectKind; SetObjectSelect( FALSE ); }
+ void StdDrawMode( SdrObjKind eSdrObjectKind, BOOL bObjSelect );
+
+ BOOL IsFrmAction() { return (bInsFrm); }
+ inline UINT16 GetBezierMode() { return eBezierMode; }
+ void SetBezierMode(UINT16 eBezMode) { eBezierMode = eBezMode; }
+ void EnterDrawTextMode(const Point& aDocPos); // DrawTextEditMode einschalten
+ void InsFrm(USHORT nCols);
+ void StopInsFrm();
+ UINT16 GetFrmColCount() const {return nInsFrmColCount;} //Spaltenzahl fuer interaktiven Rahmen
+
+
+ void SetChainMode( BOOL bOn );
+ BOOL IsChainMode() const { return bChainMode; }
+
+ void FlushInBuffer();
+ BOOL IsInputSequenceCheckingRequired( const String &rText, const SwPaM& rCrsr ) const;
+
+
+ static void SetReplaceQuote(BOOL bOn = TRUE) { bReplaceQuote = bOn; }
+ static BOOL IsReplaceQuote() { return bReplaceQuote; }
+
+ void SetApplyTemplate(const SwApplyTemplate &);
+ SwApplyTemplate* GetApplyTemplate() const { return pApplyTempl; }
+
+ void StartExecuteDrag();
+ void DragFinished();
+ USHORT GetDropAction() const { return m_nDropAction; }
+ ULONG GetDropFormat() const { return m_nDropFormat; }
+
+ Color GetTextColor() { return aTextColor; }
+
+ void SetTextColor(const Color& rCol ) { aTextColor = rCol; }
+
+ Color GetTextBackColor()
+ { return aTextBackColor; }
+ void SetTextBackColor(const Color& rCol )
+ { aTextBackColor = rCol; }
+ void SetTextBackColorTransparent(BOOL bSet)
+ { bTransparentBackColor = bSet; }
+ BOOL IsTextBackColorTransparent()
+ { return bTransparentBackColor; }
+ void LockKeyInput(BOOL bSet){bLockInput = bSet;}
+
+ const SwView &GetView() const { return rView; }
+ SwView &GetView() { return rView; }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+
+ // Tipfenster loeschen
+ static void ClearTip();
+
+ static inline long GetDDStartPosX() { return nDDStartPosX; }
+ static inline long GetDDStartPosY() { return nDDStartPosY; }
+
+ static void _InitStaticData();
+ static void _FinitStaticData();
+
+ //#i3370# remove quick help to prevent saving of autocorrection suggestions
+ void StopQuickHelp();
+
+ // --> OD 2005-02-18 #i42921# - add parameter <bVerticalMode>
+ BOOL RulerMarginDrag( const MouseEvent& rMEvt,
+ const bool bVerticalMode );
+ // <--
+
+ /** #i42732# display status of font size/name depending on either the input
+ language or the selection position depending on what has changed lately
+ */
+ void SetUseInputLanguage( sal_Bool bNew );
+ sal_Bool IsUseInputLanguage() const { return bUseInputLanguage; }
+
+ SwEditWin(Window *pParent, SwView &);
+ virtual ~SwEditWin();
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/envimg.hxx b/sw/source/ui/inc/envimg.hxx
new file mode 100644
index 000000000000..a7cb66199100
--- /dev/null
+++ b/sw/source/ui/inc/envimg.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ENVIMG_HXX
+#define _ENVIMG_HXX
+
+#include <svl/poolitem.hxx>
+#include <unotools/configitem.hxx>
+#include "swdllapi.h"
+
+// MakeSender -----------------------------------------------------------------
+
+SW_DLLPUBLIC String MakeSender();
+
+// enum -----------------------------------------------------------------------
+
+enum SwEnvAlign
+{
+ ENV_HOR_LEFT = 0,
+ ENV_HOR_CNTR,
+ ENV_HOR_RGHT,
+ ENV_VER_LEFT,
+ ENV_VER_CNTR,
+ ENV_VER_RGHT
+};
+
+// class SwEnvItem ------------------------------------------------------------
+
+class SW_DLLPUBLIC SwEnvItem : public SfxPoolItem
+{
+public:
+
+ rtl::OUString aAddrText; // Text fuer Empfaenger
+ sal_Bool bSend; // Absender?
+ rtl::OUString aSendText; // Text fuer Absender
+ sal_Int32 lAddrFromLeft; // Linker Abstand fuer Empfaenger (twips)
+ sal_Int32 lAddrFromTop; // Oberer Abstand fuer Empfaenger (twips)
+ sal_Int32 lSendFromLeft; // Linker Abstand fuer Absender (twips)
+ sal_Int32 lSendFromTop; // Oberer Abstand fuer Absender (twips)
+ sal_Int32 lWidth; // Breite des Umschlags (twips)
+ sal_Int32 lHeight; // Hoehe des Umschlags (twips)
+ SwEnvAlign eAlign; // Ausrichtung beim Einzug
+ sal_Bool bPrintFromAbove; // Von oben drucken?
+ sal_Int32 lShiftRight; // Verschiebung nach rechts (twips)
+ sal_Int32 lShiftDown; // Verschiebung nach unten (twips)
+
+ SwEnvItem();
+ SwEnvItem(const SwEnvItem& rItem);
+
+ TYPEINFO();
+
+ SwEnvItem& operator =(const SwEnvItem& rItem);
+
+ virtual int operator ==(const SfxPoolItem& rItem) const;
+
+ virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
+ virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const;
+ virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 );
+};
+
+// class SwEnvCfgItem -------------------------------------------------------
+class SwEnvCfgItem : public utl::ConfigItem
+{
+ SwEnvItem aEnvItem;
+
+ com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
+public:
+ SwEnvCfgItem();
+ ~SwEnvCfgItem();
+
+ SwEnvItem& GetItem() {return aEnvItem;}
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+};
+#endif
+
diff --git a/sw/source/ui/inc/envlop.hxx b/sw/source/ui/inc/envlop.hxx
new file mode 100644
index 000000000000..849bb63b9d51
--- /dev/null
+++ b/sw/source/ui/inc/envlop.hxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ENVLOP_HXX
+#define _ENVLOP_HXX
+
+#ifndef _SV_MEDIT_HXX
+#include <svtools/svmedit.hxx>
+#endif
+#include <sfx2/tabdlg.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+#ifndef _IMAGEBTN_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#include "envimg.hxx"
+
+#define GetFldVal(rField) (rField).Denormalize((rField).GetValue(FUNIT_TWIP))
+#define SetFldVal(rField, lValue) (rField).SetValue((rField).Normalize(lValue), FUNIT_TWIP)
+
+class SwEnvPage;
+class SwEnvFmtPage;
+class SwWrtShell;
+class Printer;
+
+// class SwEnvPreview ---------------------------------------------------------
+
+class SwEnvPreview : public Window
+{
+ void Paint(const Rectangle&);
+
+public:
+
+ SwEnvPreview(SfxTabPage* pParent, const ResId& rResID);
+ ~SwEnvPreview();
+
+protected:
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+};
+
+// class SwEnvDlg -----------------------------------------------------------
+
+class SwEnvDlg : public SfxTabDialog
+{
+friend class SwEnvPage;
+friend class SwEnvFmtPage;
+friend class SwEnvPrtPage;
+friend class SwEnvPreview;
+
+ String sInsert;
+ String sChange;
+ SwEnvItem aEnvItem;
+ SwWrtShell *pSh;
+ Printer *pPrinter;
+ SfxItemSet *pAddresseeSet;
+ SfxItemSet *pSenderSet;
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+ virtual short Ok();
+
+public:
+ SwEnvDlg(Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, BOOL bInsert);
+ ~SwEnvDlg();
+};
+
+// class SwEnvPage ----------------------------------------------------------
+
+class SwEnvPage : public SfxTabPage
+{
+ FixedText aAddrText;
+ MultiLineEdit aAddrEdit;
+ FixedText aDatabaseFT;
+ ListBox aDatabaseLB;
+ FixedText aTableFT;
+ ListBox aTableLB;
+ ImageButton aInsertBT;
+ FixedText aDBFieldFT;
+ ListBox aDBFieldLB;
+ CheckBox aSenderBox;
+ MultiLineEdit aSenderEdit;
+ SwEnvPreview aPreview;
+
+ SwWrtShell* pSh;
+ String sActDBName;
+
+ SwEnvPage(Window* pParent, const SfxItemSet& rSet);
+ ~SwEnvPage();
+
+ DECL_LINK( DatabaseHdl, ListBox * );
+ DECL_LINK( FieldHdl, Button * );
+ DECL_LINK( SenderHdl, Button * );
+
+ void InitDatabaseBox();
+
+ using Window::GetParent;
+ SwEnvDlg* GetParent() {return (SwEnvDlg*) SfxTabPage::GetParent()->GetParent();}
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+public:
+
+ static SfxTabPage* Create(Window* pParent, const SfxItemSet& rSet);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet* pSet = 0);
+ void FillItem(SwEnvItem& rItem);
+ virtual BOOL FillItemSet(SfxItemSet& rSet);
+ virtual void Reset(const SfxItemSet& rSet);
+};
+
+#endif
+
+
diff --git a/sw/source/ui/inc/fldedt.hxx b/sw/source/ui/inc/fldedt.hxx
new file mode 100644
index 000000000000..83f4b5b758f3
--- /dev/null
+++ b/sw/source/ui/inc/fldedt.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FLDEDT_HXX
+#define _FLDEDT_HXX
+#include <sfx2/basedlgs.hxx>
+#include <vcl/button.hxx>
+
+class SwView;
+class SwWrtShell;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwFldEditDlg : public SfxSingleTabDialog
+{
+ SwWrtShell* pSh;
+ ImageButton aPrevBT;
+ ImageButton aNextBT;
+ PushButton aAddressBT;
+
+ DECL_LINK( AddressHdl, PushButton *pBt = 0 );
+ DECL_LINK( NextPrevHdl, Button *pBt = 0 );
+
+ void Init();
+ SfxTabPage* CreatePage(USHORT nGroup);
+
+public:
+
+ SwFldEditDlg(SwView& rVw);
+ ~SwFldEditDlg();
+
+ DECL_LINK( OKHdl, Button * );
+
+ virtual short Execute();
+
+ void EnableInsert(BOOL bEnable);
+ void InsertHdl();
+};
+
+
+#endif
diff --git a/sw/source/ui/inc/fldmgr.hxx b/sw/source/ui/inc/fldmgr.hxx
new file mode 100644
index 000000000000..33070131ae58
--- /dev/null
+++ b/sw/source/ui/inc/fldmgr.hxx
@@ -0,0 +1,234 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FLDMGR_HXX
+#define _FLDMGR_HXX
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#endif
+#include <tools/string.hxx>
+#include "swdllapi.h"
+#include "swtypes.hxx"
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Any.h>
+
+namespace com{namespace sun{namespace star{
+ namespace container{
+ class XNameAccess;
+ }
+ namespace text{
+ class XNumberingTypeInfo;
+ }
+}}}
+
+class SwWrtShell;
+class SwField;
+class SwFieldType;
+class SbModule;
+class SvxMacroItem;
+class SvNumberFormatter;
+class Window;
+/*--------------------------------------------------------------------
+ Beschreibung: Die Gruppen von Feldern
+ --------------------------------------------------------------------*/
+
+enum SwFldGroups
+{
+ GRP_DOC,
+ GRP_FKT,
+ GRP_REF,
+ GRP_REG,
+ GRP_DB,
+ GRP_VAR
+};
+
+struct SwFldGroupRgn
+{
+ USHORT nStart;
+ USHORT nEnd;
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Der FeldManager handelt das Einfuegen von Felder
+ ueber Command-Strings
+ --------------------------------------------------------------------*/
+struct SwInsertFld_Data
+{
+ USHORT nTypeId;
+ USHORT nSubType;
+ const String sPar1;
+ const String sPar2;
+ ULONG nFormatId;
+ SwWrtShell* pSh;
+ sal_Unicode cSeparator;
+ BOOL bIsAutomaticLanguage;
+ ::com::sun::star::uno::Any aDBDataSource;
+ ::com::sun::star::uno::Any aDBConnection;
+ ::com::sun::star::uno::Any aDBColumn;
+ Window* pParent; // parent dialog used for SwWrtShell::StartInputFldDlg()
+
+ SwInsertFld_Data(USHORT nType, USHORT nSub, const String& rPar1, const String& rPar2,
+ ULONG nFmtId, SwWrtShell* pShell = NULL, sal_Unicode cSep = ' ', BOOL bIsAutoLanguage = TRUE) :
+ nTypeId(nType),
+ nSubType(nSub),
+ sPar1(rPar1),
+ sPar2(rPar2),
+ nFormatId(nFmtId),
+ pSh(pShell),
+ cSeparator(cSep),
+ bIsAutomaticLanguage(bIsAutoLanguage),
+ pParent(0) {}
+
+ SwInsertFld_Data() :
+ pSh(0),
+ cSeparator(' '),
+ bIsAutomaticLanguage(TRUE){}
+
+};
+
+class SW_DLLPUBLIC SwFldMgr
+{
+private:
+ SwField* pCurFld;
+ SbModule* pModule;
+ const SvxMacroItem* pMacroItem;
+ SwWrtShell* pWrtShell; // darf auch NULL sein!
+ String aCurPar1;
+ String aCurPar2;
+ String sCurFrame;
+
+ String sMacroPath;
+ String sMacroName;
+
+ ULONG nCurFmt;
+ BOOL bEvalExp;
+
+ SW_DLLPRIVATE USHORT GetCurrLanguage() const;
+
+ com::sun::star::uno::Reference<com::sun::star::container::XNameAccess> xDBContext;
+ com::sun::star::uno::Reference<com::sun::star::text::XNumberingTypeInfo> xNumberingInfo;
+ SW_DLLPRIVATE com::sun::star::uno::Reference<com::sun::star::text::XNumberingTypeInfo> GetNumberingInfo()const;
+
+public:
+ SwFldMgr(SwWrtShell* pSh = 0);
+ ~SwFldMgr();
+
+ void SetWrtShell( SwWrtShell* pShell )
+ { pWrtShell = pShell; }
+
+ // Feld einfuegen ueber TypeId (TYP_ ...)
+ BOOL InsertFld( const SwInsertFld_Data& rData );
+
+ // Direkt das aktuelle Feld aendern
+ void UpdateCurFld(ULONG nFormat,
+ const String& rPar1,
+ const String& rPar2,
+ SwField * _pField = 0); // #111840#
+
+ inline const String& GetCurFldPar1() const;
+ inline const String& GetCurFldPar2() const;
+ inline ULONG GetCurFldFmt() const;
+
+ // Ein Feld ermitteln
+ SwField* GetCurFld();
+
+ void InsertFldType(SwFieldType& rType);
+
+ BOOL ChooseMacro(const String &rSelMacro = aEmptyStr);
+ void SetMacroPath(const String& rPath);
+ inline const String& GetMacroPath() const { return (sMacroPath); }
+ inline const String& GetMacroName() const { return (sMacroName); }
+ inline void SetMacroModule(SbModule* pMod) { pModule = pMod; }
+
+ // Vorheriger Naechster gleichen Typ
+ BOOL GoNextPrev( BOOL bNext = TRUE, SwFieldType* pTyp = 0 );
+ BOOL GoNext( SwFieldType* pTyp = 0 ) { return GoNextPrev( TRUE, pTyp ); }
+ BOOL GoPrev( SwFieldType* pTyp = 0 ) { return GoNextPrev( FALSE, pTyp ); }
+
+ // Erfragen von Werten aus Datenbankfeldern (BASIC )
+// String GetDataBaseFieldValue(const String &rDBName, const String &rFieldName, SwWrtShell* pSh);
+ BOOL IsDBNumeric(const String& rDBName, const String& rTblQryName,
+ BOOL bIsTable, const String& rFldName);
+
+ // RefMark mit Namen organisieren
+ BOOL CanInsertRefMark( const String& rStr );
+
+
+ // Zugriff ueber ResId auf Feldtypen
+ USHORT GetFldTypeCount(USHORT nResId = USHRT_MAX) const;
+ SwFieldType* GetFldType(USHORT nResId, USHORT nId = 0) const;
+ SwFieldType* GetFldType(USHORT nResId, const String& rName) const;
+
+ void RemoveFldType(USHORT nResId, const String& rName);
+
+ // Zugriff ueber TypeId aus dem Dialog
+ // Ids fuer einen Bereich von Feldern
+ const SwFldGroupRgn& GetGroupRange(BOOL bHtmlMode, USHORT nGrpId) const;
+ USHORT GetGroup(BOOL bHtmlMode, USHORT nTypeId, USHORT nSubType = 0) const;
+
+ // TypeId des aktuellen Feldes
+ USHORT GetCurTypeId() const;
+
+ // TypeId fuer einen konkrete Pos in der Liste
+ static USHORT GetTypeId(USHORT nPos);
+ // Name des Typen in der Liste der Felder
+ static const String& GetTypeStr(USHORT nPos);
+
+ // Pos in der Liste der Felder
+ static USHORT GetPos(USHORT nTypeId);
+
+ // Untertypen zu einem Typ
+ BOOL GetSubTypes(USHORT nId, SvStringsDtor& rToFill);
+
+ // Formate zu einem Typ
+ USHORT GetFormatCount(USHORT nTypeId, BOOL bIsText, BOOL bHtmlMode = FALSE) const;
+ String GetFormatStr(USHORT nTypeId, ULONG nFormatId) const;
+ USHORT GetFormatId(USHORT nTypeId, ULONG nFormatId) const;
+ ULONG GetDefaultFormat(USHORT nTypeId, BOOL bIsText, SvNumberFormatter* pFormatter, double* pVal = 0L);
+
+ // Evaluierung der ExpressionFelder ausschalten fuer das Einfuegen
+ // vieler Expressionfelder (siehe Etiketten)
+ //
+ inline void SetEvalExpFlds(BOOL bEval);
+ void EvalExpFlds(SwWrtShell* pSh = NULL);
+};
+
+inline void SwFldMgr::SetEvalExpFlds(BOOL bEval)
+ { bEvalExp = bEval; }
+
+inline const String& SwFldMgr::GetCurFldPar1() const
+ { return aCurPar1; }
+
+inline const String& SwFldMgr::GetCurFldPar2() const
+ { return aCurPar2; }
+
+inline ULONG SwFldMgr::GetCurFldFmt() const
+ { return nCurFmt; }
+
+
+#endif
+
diff --git a/sw/source/ui/inc/fldtdlg.hxx b/sw/source/ui/inc/fldtdlg.hxx
new file mode 100644
index 000000000000..cacc2e0a6183
--- /dev/null
+++ b/sw/source/ui/inc/fldtdlg.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWFLDTDLG_HXX
+#define _SWFLDTDLG_HXX
+#include <sfx2/tabdlg.hxx>
+
+class SfxBindings;
+class SfxTabPage;
+class SwChildWinWrapper;
+struct SfxChildWinInfo;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwFldDlg: public SfxTabDialog
+{
+ SwChildWinWrapper* m_pChildWin;
+ SfxBindings* m_pBindings;
+ BOOL m_bHtmlMode;
+ BOOL m_bDataBaseMode;
+
+ virtual BOOL Close();
+ virtual SfxItemSet* CreateInputItemSet( USHORT nId );
+ virtual void Activate();
+ virtual void PageCreated(USHORT nId, SfxTabPage& rPage);
+
+ void ReInitTabPage( USHORT nPageId,
+ BOOL bOnlyActivate = FALSE );
+
+public:
+ SwFldDlg(SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent);
+ virtual ~SwFldDlg();
+
+ DECL_LINK( OKHdl, Button * );
+
+ void Initialize(SfxChildWinInfo *pInfo);
+ void ReInitDlg();
+ void EnableInsert(BOOL bEnable);
+ void InsertHdl();
+ void ActivateDatabasePage();
+};
+
+#endif
diff --git a/sw/source/ui/inc/fldwrap.hxx b/sw/source/ui/inc/fldwrap.hxx
new file mode 100644
index 000000000000..12ed8743ccfd
--- /dev/null
+++ b/sw/source/ui/inc/fldwrap.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FLDWRAP_HXX
+#define _FLDWRAP_HXX
+
+#include "chldwrap.hxx"
+class AbstractSwFldDlg;
+
+class SwFldDlgWrapper : public SwChildWinWrapper
+{
+public:
+ AbstractSwFldDlg * pDlgInterface;
+ SwFldDlgWrapper( Window* pParent, USHORT nId,
+ SfxBindings* pBindings, SfxChildWinInfo* pInfo );
+
+ SFX_DECL_CHILDWINDOW(SwFldDlgWrapper);
+
+ virtual BOOL ReInitDlg(SwDocShell *pDocSh);
+ void ShowPage(USHORT nPage = 0);
+};
+/* -----------------04.02.2003 14:14-----------------
+ * field dialog only showing database page to support
+ * mail merge
+ * --------------------------------------------------*/
+class SwFldDataOnlyDlgWrapper : public SwChildWinWrapper
+{
+public:
+ AbstractSwFldDlg * pDlgInterface;
+ SwFldDataOnlyDlgWrapper( Window* pParent, USHORT nId,
+ SfxBindings* pBindings, SfxChildWinInfo* pInfo );
+
+ SFX_DECL_CHILDWINDOW(SwFldDataOnlyDlgWrapper);
+
+ virtual BOOL ReInitDlg(SwDocShell *pDocSh);
+};
+
+
+#endif
+
diff --git a/sw/source/ui/inc/fontcfg.hxx b/sw/source/ui/inc/fontcfg.hxx
new file mode 100644
index 000000000000..71cbdf3ad5d2
--- /dev/null
+++ b/sw/source/ui/inc/fontcfg.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FONTCFG_HXX
+#define _FONTCFG_HXX
+
+#include <unotools/configitem.hxx>
+#include <tools/string.hxx>
+#include <i18npool/lang.h>
+#include <tools/debug.hxx>
+#include "swdllapi.h"
+
+#define FONT_STANDARD 0
+#define FONT_OUTLINE 1
+#define FONT_LIST 2
+#define FONT_CAPTION 3
+#define FONT_INDEX 4
+#define FONT_STANDARD_CJK 5
+#define FONT_OUTLINE_CJK 6
+#define FONT_LIST_CJK 7
+#define FONT_CAPTION_CJK 8
+#define FONT_INDEX_CJK 9
+#define FONT_STANDARD_CTL 10
+#define FONT_OUTLINE_CTL 11
+#define FONT_LIST_CTL 12
+#define FONT_CAPTION_CTL 13
+#define FONT_INDEX_CTL 14
+#define DEF_FONT_COUNT 15
+
+#define FONT_PER_GROUP 5
+
+#define FONT_GROUP_DEFAULT 0
+#define FONT_GROUP_CJK 1
+#define FONT_GROUP_CTL 2
+
+//pt-size of fonts
+#define FONTSIZE_DEFAULT 240
+#define FONTSIZE_OUTLINE 280
+
+
+class SW_DLLPUBLIC SwStdFontConfig : public utl::ConfigItem
+{
+ String sDefaultFonts[DEF_FONT_COUNT];
+ sal_Int32 nDefaultFontHeight[DEF_FONT_COUNT];
+
+ SW_DLLPRIVATE com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
+
+ void ChangeString(USHORT nFontType, const String& rSet)
+ {
+ if(sDefaultFonts[nFontType] != rSet)
+ {
+ SetModified();
+ sDefaultFonts[nFontType] = rSet;
+ }
+ }
+
+ void ChangeInt( USHORT nFontType, sal_Int32 nHeight );
+
+public:
+ SwStdFontConfig();
+ ~SwStdFontConfig();
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+
+ const String& GetFontStandard(sal_uInt8 nFontGroup) const {return sDefaultFonts[FONT_STANDARD + FONT_PER_GROUP * nFontGroup];}
+ const String& GetFontOutline(sal_uInt8 nFontGroup) const {return sDefaultFonts[FONT_OUTLINE + FONT_PER_GROUP * nFontGroup];}
+ const String& GetFontList (sal_uInt8 nFontGroup) const {return sDefaultFonts[FONT_LIST + FONT_PER_GROUP * nFontGroup];}
+ const String& GetFontCaption(sal_uInt8 nFontGroup) const {return sDefaultFonts[FONT_CAPTION + FONT_PER_GROUP * nFontGroup];}
+ const String& GetFontIndex (sal_uInt8 nFontGroup) const {return sDefaultFonts[FONT_INDEX + FONT_PER_GROUP * nFontGroup];}
+
+ const String& GetFontFor(USHORT nFontType) const {return sDefaultFonts[nFontType];}
+ BOOL IsFontDefault(USHORT nFontType) const;
+
+ void SetFontStandard(const String& rSet, sal_uInt8 nFontGroup)
+ {ChangeString(FONT_STANDARD + FONT_PER_GROUP * nFontGroup, rSet);}
+
+ void SetFontOutline(const String& rSet, sal_uInt8 nFontGroup)
+ { ChangeString(FONT_OUTLINE + FONT_PER_GROUP * nFontGroup, rSet);}
+ void SetFontList (const String& rSet, sal_uInt8 nFontGroup)
+ { ChangeString(FONT_LIST + FONT_PER_GROUP * nFontGroup, rSet);}
+ void SetFontCaption(const String& rSet, sal_uInt8 nFontGroup)
+ { ChangeString(FONT_CAPTION + FONT_PER_GROUP * nFontGroup, rSet);}
+ void SetFontIndex (const String& rSet, sal_uInt8 nFontGroup)
+ { ChangeString(FONT_INDEX + FONT_PER_GROUP * nFontGroup, rSet);}
+
+ void SetFontHeight( sal_Int32 nHeight, sal_uInt8 nFont, sal_uInt8 nScriptType )
+ { ChangeInt(nFont + FONT_PER_GROUP * nScriptType, nHeight);}
+
+ sal_Int32 GetFontHeight( sal_uInt8 nFont, sal_uInt8 nScriptType, LanguageType eLang );
+
+ static String GetDefaultFor(USHORT nFontType, LanguageType eLang);
+ static sal_Int32 GetDefaultHeightFor(USHORT nFontType, LanguageType eLang);
+};
+#endif
+
+
diff --git a/sw/source/ui/inc/formatclipboard.hxx b/sw/source/ui/inc/formatclipboard.hxx
new file mode 100644
index 000000000000..ca35d7b5f8ab
--- /dev/null
+++ b/sw/source/ui/inc/formatclipboard.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SWFORMATCLIPBOARD_HXX
+#define _SWFORMATCLIPBOARD_HXX
+
+// header for class SwWrtShell
+#include <wrtsh.hxx>
+// header for class SfxItemSet
+#include <svl/itemset.hxx>
+// header for class SfxStyleSheetBasePool
+#include <svl/style.hxx>
+
+//-----------------------------------------------------------------------------
+/** This class acts as data container and execution class for the format paintbrush feature in writer.
+*/
+
+class SwFormatClipboard
+{
+public:
+ SwFormatClipboard();
+ ~SwFormatClipboard();
+
+ bool HasContent() const;
+ bool HasContentForThisType( int nSelectionType ) const;
+ bool CanCopyThisType( int nSelectionType ) const;
+
+ void Copy( SwWrtShell& rWrtShell, SfxItemPool& rPool, bool bPersistentCopy=false );
+ void Paste( SwWrtShell& rWrtShell, SfxStyleSheetBasePool* pPool
+ , bool bNoCharacterFormats=false, bool bNoParagraphFormats=false );
+ void Erase();
+
+private:
+ int m_nSelectionType;
+ SfxItemSet* m_pItemSet;
+ SfxItemSet* m_pTableItemSet;
+
+ String m_aCharStyle;
+ String m_aParaStyle;
+ //no frame style because it contains position information
+
+ bool m_bPersistentCopy;
+};
+
+#endif
diff --git a/sw/source/ui/inc/formedt.hxx b/sw/source/ui/inc/formedt.hxx
new file mode 100644
index 000000000000..c039fe512599
--- /dev/null
+++ b/sw/source/ui/inc/formedt.hxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FORMEDT_HXX
+#define _FORMEDT_HXX
+
+#include <svx/stddlg.hxx>
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+
+#include "toxe.hxx"
+
+class SwWrtShell;
+class SwForm;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Markierung fuer Verzeichniseintrag einfuegen
+ --------------------------------------------------------------------*/
+
+class SwIdxFormDlg : public SvxStandardDialog
+{
+ DECL_LINK( EntryHdl, Button * );
+ DECL_LINK( PageHdl, Button * );
+ DECL_LINK( TabHdl, Button * );
+ DECL_LINK( JumpHdl, Button * );
+ DECL_LINK( StdHdl, Button * );
+ DECL_LINK( SelectHdl, ListBox * );
+ DECL_LINK( EnableSelectHdl, ListBox * );
+ DECL_LINK( DoubleClickHdl, Button * );
+ DECL_LINK( ModifyHdl, Edit * );
+ DECL_LINK( AssignHdl, Button * );
+ void UpdatePattern();
+ void Apply();
+
+ ListBox aEntryLB;
+ OKButton aOKBtn;
+ CancelButton aCancelBT;
+ FixedText aLevelFT;
+ Edit aEntryED;
+ PushButton aEntryBT;
+ PushButton aTabBT;
+ PushButton aPageBT;
+ PushButton aJumpBT;
+ FixedLine aEntryFL;
+ FixedText aLevelFT2;
+ ListBox aLevelLB;
+ FixedText aTemplateFT;
+ ListBox aParaLayLB;
+ PushButton aStdBT;
+ PushButton aAssignBT;
+ FixedLine aFormatFL;
+
+ SwWrtShell &rSh;
+ SwForm *pForm;
+ USHORT nAktLevel;
+ BOOL bLastLinkIsEnd;
+
+public:
+ SwIdxFormDlg( Window* pParent, SwWrtShell &rShell, const SwForm& rForm );
+ ~SwIdxFormDlg();
+
+ static BOOL IsNoNum(SwWrtShell& rSh, const String& rName);
+ const SwForm& GetTOXForm();
+};
+
+inline const SwForm& SwIdxFormDlg::GetTOXForm()
+{
+ return *pForm;
+}
+
+#endif
diff --git a/sw/source/ui/inc/frmdlg.hxx b/sw/source/ui/inc/frmdlg.hxx
new file mode 100644
index 000000000000..decce61e2606
--- /dev/null
+++ b/sw/source/ui/inc/frmdlg.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _FRMDLG_HXX
+#define _FRMDLG_HXX
+
+#include "globals.hrc"
+#include <sfx2/tabdlg.hxx>
+class SwWrtShell;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Rahmendialog
+ --------------------------------------------------------------------*/
+
+class SwFrmDlg : public SfxTabDialog
+{
+ BOOL m_bFormat;
+ BOOL m_bNew;
+ BOOL m_bHTMLMode;
+ bool m_bEnableVertPos;
+ const SfxItemSet& m_rSet;
+ USHORT m_nDlgType;
+ SwWrtShell* m_pWrtShell;
+
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+
+public:
+ SwFrmDlg( SfxViewFrame *pFrame, Window *pParent,
+ const SfxItemSet& rCoreSet,
+ BOOL bNewFrm = TRUE,
+ USHORT nResType = DLG_FRM_STD,
+ BOOL bFmt = FALSE,
+ UINT16 nDefPage = 0,
+ const String* pFmtStr = 0);
+
+ ~SwFrmDlg();
+
+ inline SwWrtShell* GetWrtShell() { return m_pWrtShell; }
+};
+
+
+#endif // _FRMDLG_HXX
diff --git a/sw/source/ui/inc/frmmgr.hxx b/sw/source/ui/inc/frmmgr.hxx
new file mode 100644
index 000000000000..9664c484b0f3
--- /dev/null
+++ b/sw/source/ui/inc/frmmgr.hxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _FRMMGR_HXX
+#define _FRMMGR_HXX
+
+#include "swtypes.hxx"
+#include "frmatr.hxx"
+#include <editeng/svxenum.hxx>
+#include <tools/gen.hxx>
+#include <fmtfsize.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtornt.hxx>
+#include <fmtanchr.hxx>
+#include "swdllapi.h"
+
+class SwWrtShell;
+struct SvxSwFrameValidation;
+struct SwPosition;
+
+class SwFmt;
+class SwFmtCol;
+
+const SwTwips DFLT_WIDTH = MM50 * 4;
+const SwTwips DFLT_HEIGHT = MM50;
+
+#define FULL_ATTRSET 0xffff
+
+#define FRMMGR_TYPE_NONE 0x00
+#define FRMMGR_TYPE_TEXT 0x01
+#define FRMMGR_TYPE_GRF 0x02
+#define FRMMGR_TYPE_OLE 0x04
+#define FRMMGR_TYPE_LABEL 0x08
+#define FRMMGR_TYPE_ENVELP 0x10
+
+class SW_DLLPUBLIC SwFlyFrmAttrMgr
+{
+ SfxItemSet aSet;
+ Point aAbsPos;
+ SwWrtShell *pOwnSh;
+
+ BOOL bAbsPos,
+ bNewFrm;
+ BOOL bIsInVertical;
+
+ // interne Verrechnung fuer Umrandung
+ SW_DLLPRIVATE SwTwips CalcTopSpace();
+ SW_DLLPRIVATE SwTwips CalcBottomSpace();
+ SW_DLLPRIVATE SwTwips CalcLeftSpace();
+ SW_DLLPRIVATE SwTwips CalcRightSpace();
+
+ SW_DLLPRIVATE void _UpdateFlyFrm(); //Nacharbeit nach Einfuegen oder Update
+
+public:
+ SwFlyFrmAttrMgr( BOOL bNew, SwWrtShell* pSh, BYTE nType );
+
+ //CopyCtor fuer die Dialoge, zum Pruefen der Metrics
+ SwFlyFrmAttrMgr( BOOL bNew, SwWrtShell *pSh, const SfxItemSet &rSet );
+
+ inline SwWrtShell* GetShell() { return pOwnSh; }
+
+ void SetAnchor(RndStdIds eId);
+ inline RndStdIds GetAnchor() const;
+
+ void SetHorzOrientation(sal_Int16 eOrient);
+ void SetVertOrientation(sal_Int16 eOrient);
+
+ // Absolute Position
+ void SetAbsPos(const Point& rLPoint);
+
+ // Relative Position vom Anker
+ void SetPos(const Point& rLPoint);
+ inline Point GetPos() const;
+
+ // Groesse
+ void SetSize(const Size& rLSize);
+ inline const Size& GetSize() const;
+
+ inline USHORT GetHeightPercent() const;
+
+ void SetHeightSizeType(SwFrmSize eType);
+
+ // Abstand zum Inhalt
+ void SetLRSpace( long nLeft = LONG_MAX,
+ long nRight = LONG_MAX );
+ void SetULSpace( long nTop = LONG_MAX,
+ long nBottom= LONG_MAX );
+
+ void SetCol( const SwFmtCol &rCol);
+
+ // Attribute aendern und erfragen
+ void UpdateAttrMgr();
+ void UpdateFlyFrm();
+
+ // neuen Rahmen erzeugen
+ BOOL InsertFlyFrm();
+ void InsertFlyFrm(RndStdIds eAnchorType,
+ const Point &rPos,
+ const Size &rSize,
+ BOOL bAbsPos = FALSE);
+
+ // Metriken pruefen und aendern
+ void ValidateMetrics(SvxSwFrameValidation& rVal,
+ const SwPosition* pToCharCntntPos,
+ BOOL bOnlyPercentRefValue = FALSE);
+
+ void DelAttr(USHORT nId);
+
+ // Set rausreichen
+ inline const SfxItemSet &GetAttrSet() const { return aSet; }
+ inline SfxItemSet &GetAttrSet() { return aSet; }
+ void SetAttrSet(const SfxItemSet& rSet);
+
+ inline const SwFmtVertOrient &GetVertOrient() const;
+ inline const SwFmtHoriOrient &GetHoriOrient() const;
+ inline const SvxShadowItem &GetShadow() const;
+ inline const SvxBoxItem &GetBox() const;
+ inline const SwFmtSurround &GetSurround() const;
+ inline const SwFmtFrmSize &GetFrmSize() const;
+
+ long CalcWidthBorder() { return CalcLeftSpace()+CalcRightSpace(); }
+ long CalcHeightBorder() { return CalcTopSpace()+CalcBottomSpace(); }
+};
+
+inline const Size& SwFlyFrmAttrMgr::GetSize() const
+{
+ return ((SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE)).GetSize();
+}
+
+inline const SwFmtVertOrient &SwFlyFrmAttrMgr::GetVertOrient() const
+{
+ return ((SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT));
+}
+inline const SwFmtHoriOrient &SwFlyFrmAttrMgr::GetHoriOrient() const
+{
+ return ((SwFmtHoriOrient &)aSet.Get(RES_HORI_ORIENT));
+}
+inline const SwFmtFrmSize& SwFlyFrmAttrMgr::GetFrmSize() const
+{
+ return ((SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE));
+}
+inline const SvxShadowItem &SwFlyFrmAttrMgr::GetShadow() const
+{
+ return ((SvxShadowItem&)aSet.Get(RES_SHADOW));
+}
+inline const SvxBoxItem &SwFlyFrmAttrMgr::GetBox() const
+{
+ return ((SvxBoxItem&)aSet.Get(RES_BOX));
+}
+inline const SwFmtSurround &SwFlyFrmAttrMgr::GetSurround() const
+{
+ return ((SwFmtSurround&)aSet.Get(RES_SURROUND));
+}
+
+inline Point SwFlyFrmAttrMgr::GetPos() const
+{
+ return Point( GetHoriOrient().GetPos(), GetVertOrient().GetPos() );
+}
+
+inline RndStdIds SwFlyFrmAttrMgr::GetAnchor() const
+{
+ return ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
+}
+
+inline USHORT SwFlyFrmAttrMgr::GetHeightPercent() const
+{
+ return GetFrmSize().GetHeightPercent();
+}
+
+#endif
diff --git a/sw/source/ui/inc/frmpage.hxx b/sw/source/ui/inc/frmpage.hxx
new file mode 100644
index 000000000000..979f5cf12dd6
--- /dev/null
+++ b/sw/source/ui/inc/frmpage.hxx
@@ -0,0 +1,339 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _FRMPAGE_HXX
+#define _FRMPAGE_HXX
+
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <svx/swframeposstrings.hxx>
+#include <swtypes.hxx>
+#include <bmpwin.hxx>
+#include <svx/swframeexample.hxx>
+#include <prcntfld.hxx>
+#include <globals.hrc>
+
+
+namespace sfx2{class FileDialogHelper;}
+class SwWrtShell;
+struct FrmMap;
+// OD 12.11.2003 #i22341#
+struct SwPosition;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Rahmendialog
+ --------------------------------------------------------------------*/
+
+class SwFrmPage: public SfxTabPage
+{
+ // Size
+ FixedText aWidthFT;
+ FixedText aWidthAutoFT;
+ PercentField aWidthED;
+ CheckBox aRelWidthCB;
+ CheckBox aAutoWidthCB;
+ FixedText aHeightFT;
+ FixedText aHeightAutoFT;
+ PercentField aHeightED;
+ CheckBox aRelHeightCB;
+ CheckBox aAutoHeightCB;
+ CheckBox aFixedRatioCB;
+ PushButton aRealSizeBT;
+ FixedLine aSizeFL;
+
+ // Anker
+ FixedLine aTypeFL;
+ FixedLine aTypeSepFL;
+ RadioButton aAnchorAtPageRB;
+ RadioButton aAnchorAtParaRB;
+ RadioButton aAnchorAtCharRB;
+ RadioButton aAnchorAsCharRB;
+ RadioButton aAnchorAtFrameRB;
+
+ // Position
+ FixedText aHorizontalFT;
+ ListBox aHorizontalDLB;
+ FixedText aAtHorzPosFT;
+ MetricField aAtHorzPosED;
+ FixedText aHoriRelationFT;
+ ListBox aHoriRelationLB;
+ CheckBox aMirrorPagesCB;
+ FixedText aVerticalFT;
+ ListBox aVerticalDLB;
+ FixedText aAtVertPosFT;
+ MetricField aAtVertPosED;
+ FixedText aVertRelationFT;
+ ListBox aVertRelationLB;
+ // OD 02.10.2003 #i18732# - check box for new option 'FollowTextFlow'
+ CheckBox aFollowTextFlowCB;
+ FixedLine aPositionFL;
+
+ // Example
+ SvxSwFrameExample aExampleWN;
+
+ //'string provider'
+ SvxSwFramePosString aFramePosString;
+
+ BOOL bAtHorzPosModified;
+ BOOL bAtVertPosModified;
+
+ BOOL bFormat;
+ BOOL bNew;
+ BOOL bNoModifyHdl;
+ BOOL bVerticalChanged; //check done whether frame is in vertical environment
+ BOOL bIsVerticalFrame; //current frame is in vertical environment - strings are exchanged
+ BOOL bIsInRightToLeft; // current frame is in right-to-left environment - strings are exchanged
+ BOOL bHtmlMode;
+ USHORT nHtmlMode;
+ USHORT nDlgType;
+ Size aGrfSize;
+ Size aWrap;
+ SwTwips nUpperBorder;
+ SwTwips nLowerBorder;
+ double fWidthHeightRatio; //width-to-height ratio to support the KeepRatio button
+
+ // OD 12.11.2003 #i22341# - keep content position of character for
+ // to character anchored objects.
+ const SwPosition* mpToCharCntntPos;
+
+ // Die alten Ausrichtungen
+ short nOldH;
+ short nOldHRel;
+ short nOldV;
+ short nOldVRel;
+
+ FrmMap* pVMap;
+ FrmMap* pHMap;
+
+ bool m_bAllowVertPositioning;
+ bool m_bIsMathOLE;
+ bool m_bIsMathBaselineAlignment;
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet *pSet);
+
+
+ DECL_LINK( RangeModifyHdl, Edit * );
+ DECL_LINK( AnchorTypeHdl, RadioButton * );
+ DECL_LINK( PosHdl, ListBox * );
+ DECL_LINK( RelHdl, ListBox * );
+ void InitPos(RndStdIds eId, USHORT nH, USHORT nHRel,
+ USHORT nV, USHORT nVRel,
+ long nX, long nY);
+
+ DECL_LINK( RealSizeHdl, Button * );
+ DECL_LINK( RelSizeClickHdl, CheckBox * );
+ DECL_LINK( MirrorHdl, CheckBox * );
+
+ DECL_LINK( AutoWidthClickHdl, void* );
+ DECL_LINK( AutoHeightClickHdl, void* );
+
+ // Beispiel aktualisieren
+ void UpdateExample();
+ DECL_LINK( ModifyHdl, Edit * );
+
+ void Init(const SfxItemSet& rSet, BOOL bReset = FALSE);
+ // OD 12.11.2003 #i22341# - adjustment to handle maps, that are ambigous
+ // in the alignment.
+ USHORT FillPosLB( const FrmMap* _pMap,
+ const USHORT _nAlign,
+ const USHORT _nRel,
+ ListBox& _rLB );
+ // OD 14.11.2003 #i22341# - adjustment to handle maps, that are ambigous
+ // in their string entries.
+ ULONG FillRelLB( const FrmMap* _pMap,
+ const USHORT _nLBSelPos,
+ const USHORT _nAlign,
+ USHORT _nRel,
+ ListBox& _rLB,
+ FixedText& _rFT );
+ USHORT GetMapPos( const FrmMap *pMap, ListBox &rAlignLB );
+ short GetAlignment(FrmMap *pMap, USHORT nMapPos, ListBox &rAlignLB, ListBox &rRelationLB);
+ short GetRelation(FrmMap *pMap, ListBox &rRelationLB);
+ RndStdIds GetAnchor();
+
+ void EnableGraficMode( void ); // hides auto check boxes and re-org controls for "Real Size" button
+
+ SwFrmPage(Window *pParent, const SfxItemSet &rSet);
+ ~SwFrmPage();
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+public:
+
+ static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet(SfxItemSet &rSet);
+ virtual void Reset(const SfxItemSet &rSet);
+
+ void SetNewFrame(BOOL bNewFrame) { bNew = bNewFrame; }
+ void SetFormatUsed(BOOL bFmt);
+ void SetFrmType(USHORT nType) { nDlgType = nType; }
+ inline BOOL IsInGraficMode( void ) { return nDlgType == DLG_FRM_GRF || nDlgType == DLG_FRM_OLE; }
+ void EnableVerticalPositioning( bool bEnable );
+};
+
+class SwGrfExtPage: public SfxTabPage
+{
+ // Spiegeln
+ FixedLine aMirrorFL;
+ CheckBox aMirrorVertBox;
+ CheckBox aMirrorHorzBox;
+ RadioButton aAllPagesRB;
+ RadioButton aLeftPagesRB;
+ RadioButton aRightPagesRB;
+ BmpWindow aBmpWin;
+
+ FixedLine aConnectFL;
+ FixedText aConnectFT;
+ Edit aConnectED;
+ PushButton aBrowseBT;
+
+ String aFilterName;
+ String aGrfName, aNewGrfName;
+
+ ::sfx2::FileDialogHelper* pGrfDlg;
+
+ BOOL bHtmlMode;
+
+ // Handler fuer Spiegeln
+ DECL_LINK( MirrorHdl, CheckBox * );
+ DECL_LINK( BrowseHdl, Button * );
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ SwGrfExtPage(Window *pParent, const SfxItemSet &rSet);
+ ~SwGrfExtPage();
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+public:
+
+ static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
+
+ virtual BOOL FillItemSet(SfxItemSet &rSet);
+ virtual void Reset(const SfxItemSet &rSet);
+ virtual int DeactivatePage(SfxItemSet *pSet);
+};
+
+
+class SwFrmURLPage : public SfxTabPage
+{
+ //Hyperlink
+ FixedLine aHyperLinkFL;
+ FixedText aURLFT;
+ Edit aURLED;
+ PushButton aSearchPB;
+ FixedText aNameFT;
+ Edit aNameED;
+ FixedText aFrameFT;
+ ComboBox aFrameCB;
+
+ //Image map
+ FixedLine aImageFL;
+ CheckBox aServerCB;
+ CheckBox aClientCB;
+
+ DECL_LINK( InsertFileHdl, PushButton * );
+
+
+ SwFrmURLPage(Window *pParent, const SfxItemSet &rSet);
+ ~SwFrmURLPage();
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+public:
+
+ static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
+
+ virtual BOOL FillItemSet(SfxItemSet &rSet);
+ virtual void Reset(const SfxItemSet &rSet);
+};
+
+/*-----------------13.11.96 12.59-------------------
+
+--------------------------------------------------*/
+
+class SwFrmAddPage : public SfxTabPage
+{
+ FixedText aNameFT;
+ Edit aNameED;
+ FixedText aAltNameFT;
+ Edit aAltNameED;
+ FixedText aPrevFT;
+ ListBox aPrevLB;
+ FixedText aNextFT;
+ ListBox aNextLB;
+ FixedLine aNamesFL;
+
+ CheckBox aProtectContentCB;
+ CheckBox aProtectFrameCB;
+ CheckBox aProtectSizeCB;
+ FixedLine aProtectFL;
+
+ CheckBox aEditInReadonlyCB;
+ CheckBox aPrintFrameCB;
+ FixedText aTextFlowFT;
+ ListBox aTextFlowLB;
+
+ FixedLine aExtFL;
+
+ SwWrtShell* pWrtSh;
+
+ USHORT nDlgType;
+ BOOL bHtmlMode;
+ BOOL bFormat;
+ BOOL bNew;
+
+ DECL_LINK(EditModifyHdl, Edit*);
+ DECL_LINK(ChainModifyHdl, ListBox*);
+
+ SwFrmAddPage(Window *pParent, const SfxItemSet &rSet);
+ ~SwFrmAddPage();
+
+public:
+
+ static SfxTabPage* Create(Window *pParent, const SfxItemSet &rSet);
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet(SfxItemSet &rSet);
+ virtual void Reset(const SfxItemSet &rSet);
+
+ void SetFormatUsed(BOOL bFmt);
+ void SetFrmType(USHORT nType) { nDlgType = nType; }
+ void SetNewFrame(BOOL bNewFrame) { bNew = bNewFrame; }
+ void SetShell(SwWrtShell* pSh) { pWrtSh = pSh; }
+
+};
+
+#endif // _FRMPAGE_HXX
diff --git a/sw/source/ui/inc/frmsh.hxx b/sw/source/ui/inc/frmsh.hxx
new file mode 100644
index 000000000000..d4f4c546acf1
--- /dev/null
+++ b/sw/source/ui/inc/frmsh.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWFRMSH_HXX
+#define _SWFRMSH_HXX
+
+#include "basesh.hxx"
+
+class SwFrameShell: public SwBaseShell
+{
+
+public:
+ SFX_DECL_INTERFACE(SW_FRAMESHELL)
+
+ SwFrameShell(SwView &rView);
+ virtual ~SwFrameShell();
+
+ void Execute(SfxRequest &);
+ void GetState(SfxItemSet &);
+ void ExecFrameStyle(SfxRequest& rReq);
+ void GetLineStyleState(SfxItemSet &rSet);
+ void StateInsert(SfxItemSet &rSet);
+
+ void StateStatusline(SfxItemSet &rSet);
+};
+
+#endif
diff --git a/sw/source/ui/inc/frmui.hrc b/sw/source/ui/inc/frmui.hrc
new file mode 100644
index 000000000000..4c71fff51b40
--- /dev/null
+++ b/sw/source/ui/inc/frmui.hrc
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _FRMUI_HRC
+#define _FRMUI_HRC
+
+#include "rcid.hrc"
+#include "globals.hrc"
+
+#define DLG_FRMOPT (RC_FRMDLG_BEGIN + 1)
+#define DLG_PATTERN (RC_FRMDLG_BEGIN + 2)
+#define DLG_BORDER (RC_FRMDLG_BEGIN + 3)
+#define DLG_COLUMN (RC_FRMDLG_BEGIN + 4)
+#define DLG_FOOTNOTE (RC_FRMDLG_BEGIN + 5)
+#define DLG_INSERT_FOOTNOTE (RC_FRMDLG_BEGIN + 6)
+
+#define DLG_VIEW_HEADER (RC_FRMDLG_BEGIN + 8)
+#define DLG_FORMAT_COLUMN (RC_FRMDLG_BEGIN + 10)
+#define DLG_CAPTION (RC_FRMDLG_BEGIN + 11)
+#define DLG_SEQUENCE_OPTION (RC_FRMDLG_BEGIN + 12)
+
+#define TP_FOOTNOTEOPTION (RC_FRMDLG_BEGIN + 12)
+#define TP_ENDNOTEOPTION (RC_FRMDLG_BEGIN + 13)
+
+#define STR_PATTERN_BRD (RC_FRMDLG_BEGIN + 13)
+#define STR_SHPATTERN (RC_FRMDLG_BEGIN + 14)
+#define STR_LNPATTERN (RC_FRMDLG_BEGIN + 15)
+#define STR_FRMUI_BORDER (RC_FRMDLG_BEGIN + 16)
+#define STR_FRMUI_PATTERN (RC_FRMDLG_BEGIN + 17)
+#define STR_FRMUI_WRAP (RC_FRMDLG_BEGIN + 18)
+
+#define BMP_PORTRAIT (RC_FRMDLG_BEGIN + 16)
+#define BMP_LANDSCAPE (RC_FRMDLG_BEGIN + 17)
+#define BMP_BEGIN (RC_FRMDLG_BEGIN + 18)
+#define BMP_WRAP (BMP_BEGIN)
+#define BMP_LEFT (BMP_BEGIN+1)
+#define BMP_RIGHT (BMP_BEGIN+2)
+#define BMP_OPAQUE (BMP_BEGIN+3)
+#define BMP_OPAQUET (BMP_BEGIN+4)
+#define BMP_NOWRAP (BMP_BEGIN+5)
+
+#define BMP_END (BMP_NOWRAP)
+
+#define MN_OPTION (BMP_END + 1)
+#define MN_COLUMN (BMP_END + 2)
+#define MN_PAPERSZ (BMP_END + 3)
+#define MN_BACKGROUND (BMP_END + 4)
+
+#define STR_BACKGROUND (BMP_END + 6)
+#define MN_FOOTNOTE (BMP_END + 7)
+
+#define STR_FRMDLG_BEGIN (MN_FOOTNOTE + 1)
+
+#define STR_TOPPRT (STR_FRMDLG_BEGIN + 1)
+//#define STR_FROMBOTTOM (STR_FRMDLG_BEGIN + 2)
+//#define STR_FROMTOP (STR_FRMDLG_BEGIN + 3)
+//#define STR_BELOW (STR_FRMDLG_BEGIN + 4)
+/*
+#define STR_LEFT (STR_FRMDLG_BEGIN + 5)
+#define STR_RIGHT (STR_FRMDLG_BEGIN + 6)
+#define STR_FROMLEFT (STR_FRMDLG_BEGIN + 7)
+#define STR_MIR_LEFT (STR_FRMDLG_BEGIN + 8)
+#define STR_MIR_RIGHT (STR_FRMDLG_BEGIN + 9)
+#define STR_MIR_FROMLEFT (STR_FRMDLG_BEGIN + 10)
+*/
+
+#define STR_BORDER (STR_FRMDLG_BEGIN + 16)
+#define STR_COLUMN (STR_FRMDLG_BEGIN + 17)
+#define STR_PARA (STR_FRMDLG_BEGIN + 18)
+#define STR_CHAR (STR_FRMDLG_BEGIN + 19)
+
+/*
+#define STR_FRAME (STR_FRMDLG_BEGIN + 20)
+#define STR_PRTAREA (STR_FRMDLG_BEGIN + 21)
+#define STR_REL_PG_LEFT (STR_FRMDLG_BEGIN + 22)
+#define STR_REL_PG_RIGHT (STR_FRMDLG_BEGIN + 23)
+#define STR_REL_FRM_LEFT (STR_FRMDLG_BEGIN + 24)
+#define STR_REL_FRM_RIGHT (STR_FRMDLG_BEGIN + 25)
+#define STR_MIR_REL_PG_LEFT (STR_FRMDLG_BEGIN + 26)
+#define STR_MIR_REL_PG_RIGHT (STR_FRMDLG_BEGIN + 27)
+#define STR_MIR_REL_FRM_LEFT (STR_FRMDLG_BEGIN + 28)
+#define STR_MIR_REL_FRM_RIGHT (STR_FRMDLG_BEGIN + 29)
+#define STR_REL_PG_FRAME (STR_FRMDLG_BEGIN + 30)
+#define STR_REL_PG_PRTAREA (STR_FRMDLG_BEGIN + 31)
+#define STR_REL_BASE (STR_FRMDLG_BEGIN + 32)
+#define STR_REL_CHAR (STR_FRMDLG_BEGIN + 33)
+#define STR_REL_ROW (STR_FRMDLG_BEGIN + 34)
+#define STR_REL_BORDER (STR_FRMDLG_BEGIN + 35)
+#define STR_REL_PRTAREA (STR_FRMDLG_BEGIN + 36)
+#define STR_FLY_REL_PG_LEFT (STR_FRMDLG_BEGIN + 37)
+#define STR_FLY_REL_PG_RIGHT (STR_FRMDLG_BEGIN + 38)
+#define STR_FLY_REL_PG_FRAME (STR_FRMDLG_BEGIN + 39)
+#define STR_FLY_REL_PG_PRTAREA (STR_FRMDLG_BEGIN + 40)
+#define STR_FLY_MIR_REL_PG_LEFT (STR_FRMDLG_BEGIN + 41)
+#define STR_FLY_MIR_REL_PG_RIGHT (STR_FRMDLG_BEGIN + 42)
+#define STR_FLY_MIR_REL_PG_FRAME (STR_FRMDLG_BEGIN + 43)
+#define STR_FLY_MIR_REL_PG_PRTAREA (STR_FRMDLG_BEGIN + 44)*/
+
+#define STR_OLE_INSERT (STR_FRMDLG_BEGIN + 45)
+#define STR_OLE_EDIT (STR_FRMDLG_BEGIN + 46)
+#define STR_COLL_HEADER (STR_FRMDLG_BEGIN + 47)
+
+#define MSG_COLUMN_ERR_BOUNDWIDTH (STR_FRMDLG_BEGIN + 48)
+#define STR_EDIT_GRF (STR_FRMDLG_BEGIN + 49)
+
+#define STR_LINE_TOP (STR_FRMDLG_BEGIN + 50)
+#define STR_LINE_BOTTOM (STR_FRMDLG_BEGIN + 51)
+#define STR_LINE_CENTER (STR_FRMDLG_BEGIN + 52)
+#define STR_CHAR_TOP (STR_FRMDLG_BEGIN + 53)
+#define STR_CHAR_BOTTOM (STR_FRMDLG_BEGIN + 54)
+#define STR_CHAR_CENTER (STR_FRMDLG_BEGIN + 55)
+
+#define FRMDLG_ACT_END STR_CHAR_CENTER
+
+#if FRMDLG_ACT_END > RC_FRMDLG_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+
+#endif // FRMUI_HRC
diff --git a/sw/source/ui/inc/globals.h b/sw/source/ui/inc/globals.h
new file mode 100644
index 000000000000..46a2fba86397
--- /dev/null
+++ b/sw/source/ui/inc/globals.h
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _GLOBALS_H
+#define _GLOBALS_H
+
+enum SwChangeState
+{
+ STATE_OFF = 0,
+ STATE_ON = 1,
+ STATE_TOGGLE = 2
+};
+
+#endif
diff --git a/sw/source/ui/inc/globdoc.hrc b/sw/source/ui/inc/globdoc.hrc
new file mode 100644
index 000000000000..cf06e4de05ca
--- /dev/null
+++ b/sw/source/ui/inc/globdoc.hrc
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _GLOBDOC_HRC
+#define _GLOBDOC_HRC
+
+#include "rcid.hrc"
+
+#define STR_HUMAN_SWGLOBDOC_NAME (RC_GLOBDOC_BEGIN + 2)
+#define STR_WRITER_GLOBALDOC_FULLTYPE_40 (RC_GLOBDOC_BEGIN + 3)
+#define STR_WRITER_GLOBALDOC_FULLTYPE_50 (RC_GLOBDOC_BEGIN + 4)
+#define STR_WRITER_GLOBALDOC_FULLTYPE (RC_GLOBDOC_BEGIN + 5)
+
+#define MN_GLOBALFILE (RC_GLOBDOC_BEGIN + 30)
+#define MN_GLOBALEDIT (RC_GLOBDOC_BEGIN + 31)
+#define MN_GLOBALVIEW (RC_GLOBDOC_BEGIN + 32)
+#define MN_GLOBALINS (RC_GLOBDOC_BEGIN + 33)
+#define MN_GLOBALFORMAT (RC_GLOBDOC_BEGIN + 34)
+#define MN_GLOBALEXTRA (RC_GLOBDOC_BEGIN + 35)
+#define MN_GLOBALWIN (RC_GLOBDOC_BEGIN + 36)
+
+#define MN_GLOBALFILE_PORT (RC_GLOBDOC_BEGIN + 47)
+#define MN_GLOBALEDIT_PORT (RC_GLOBDOC_BEGIN + 48)
+#define MN_GLOBALVIEW_PORT (RC_GLOBDOC_BEGIN + 49)
+#define MN_GLOBALINS_PORT (RC_GLOBDOC_BEGIN + 50)
+#define MN_GLOBALFORMAT_PORT (RC_GLOBDOC_BEGIN + 51)
+#define MN_GLOBALEXTRA_PORT (RC_GLOBDOC_BEGIN + 52)
+#define MN_GLOBALWIN_PORT (RC_GLOBDOC_BEGIN + 53)
+
+#define MN_GLOBAL_TEXT_POPUPMENU (RC_GLOBDOC_BEGIN + 63)
+// ------------------------------------------------------------------------
+
+#define GLOBDOC_ACT_END MN_GLOBAL_TEXT_POPUPMENU
+
+
+#if GLOBDOC_ACT_END > RC_GLOBDOC_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#endif
diff --git a/sw/source/ui/inc/glosbib.hxx b/sw/source/ui/inc/glosbib.hxx
new file mode 100644
index 000000000000..c96e4177027b
--- /dev/null
+++ b/sw/source/ui/inc/glosbib.hxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _GLOSBIB_HXX
+#define _GLOSBIB_HXX
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#include <svx/stddlg.hxx>
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#include <svtools/svtabbx.hxx>
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/fixed.hxx>
+
+class SwGlossaryHdl;
+class SvStrings;
+
+class FEdit : public Edit
+{
+ public:
+ FEdit(Window * pParent, const ResId& rResId) :
+ Edit(pParent, rResId){}
+
+ virtual void KeyInput( const KeyEvent& rKEvent );
+};
+/* -----------------------------08.02.00 15:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+struct GlosBibUserData
+{
+ String sPath;
+ String sGroupName;
+ String sGroupTitle;
+};
+class SwGlossaryGroupTLB : public SvTabListBox
+{
+public:
+ SwGlossaryGroupTLB(Window* pParent, const ResId& rResId) :
+ SvTabListBox(pParent, rResId) {}
+
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+};
+
+class SwGlossaryGroupDlg : public SvxStandardDialog
+{
+
+ FEdit aNameED;
+ ListBox aPathLB;
+ SwGlossaryGroupTLB aGroupTLB;
+
+ OKButton aOkPB;
+ CancelButton aCancelPB;
+ HelpButton aHelpPB;
+ PushButton aNewPB;
+ PushButton aDelPB;
+ PushButton aRenamePB;
+ FixedText aBibFT;
+ FixedText aPathFT;
+ FixedText aSelectFT;
+
+ SvStrings* pRemovedArr;
+ SvStrings* pInsertedArr;
+ SvStrings* pRenamedArr;
+
+ SwGlossaryHdl *pGlosHdl;
+
+ String sCreatedGroup;
+
+ BOOL IsDeleteAllowed(const String &rGroup);
+
+protected:
+ virtual void Apply();
+ DECL_LINK( SelectHdl, SvTabListBox* );
+ DECL_LINK( NewHdl, Button* );
+ DECL_LINK( DeleteHdl, Button* );
+ DECL_LINK( ModifyHdl, Edit* );
+ DECL_LINK( RenameHdl, Button* );
+
+public:
+ SwGlossaryGroupDlg(Window * pParent,
+ const SvStrings* pPathArr,
+ SwGlossaryHdl *pGlosHdl);
+ ~SwGlossaryGroupDlg();
+
+ const String& GetCreatedGroupName() const {return sCreatedGroup;}
+};
+
+
+#endif
+
diff --git a/sw/source/ui/inc/glosdoc.hxx b/sw/source/ui/inc/glosdoc.hxx
new file mode 100644
index 000000000000..1436c7fe8db9
--- /dev/null
+++ b/sw/source/ui/inc/glosdoc.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _GLOSDOC_HXX
+#define _GLOSDOC_HXX
+
+#include <tools/string.hxx>
+#include <svl/svarray.hxx>
+#include <com/sun/star/text/XAutoTextGroup.hpp>
+
+class SwTextBlocks;
+class SvStrings;
+class SwDocShell;
+
+#ifndef SW_DECL_SWDOCSHELL_DEFINED
+#define SW_DECL_SWDOCSHELL_DEFINED
+#include <tools/ref.hxx>
+SV_DECL_REF( SwDocShell )
+#endif
+#include <cppuhelper/weakref.hxx>
+
+#ifndef INCLUDED_VECTOR
+#include <vector>
+#define INCLUDED_VECTOR
+#endif
+#include "swdllapi.h"
+
+typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextGroup > AutoTextGroupRef;
+typedef ::std::vector< AutoTextGroupRef > UnoAutoTextGroups;
+
+typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextEntry > AutoTextEntryRef;
+typedef ::std::vector< AutoTextEntryRef > UnoAutoTextEntries;
+
+#define GLOS_DELIM (sal_Unicode)'*'
+
+// CLASS -----------------------------------------------------------------
+class SW_DLLPUBLIC SwGlossaries
+{
+ UnoAutoTextGroups m_aGlossaryGroups;
+ UnoAutoTextEntries m_aGlossaryEntries;
+
+ String m_aPath;
+ String m_sOldErrPath;
+ String m_sErrPath;
+ SvStrings *m_pPathArr;
+ SvStrings *m_pGlosArr;
+ BOOL m_bError;
+
+ SW_DLLPRIVATE SwTextBlocks* GetGlosDoc(const String &rName, BOOL bCreate = TRUE) const;
+ SW_DLLPRIVATE SvStrings *GetNameList();
+
+ // implementation in unoatxt.cxx
+ SW_DLLPRIVATE void RemoveFileFromList( const String& rGroup );
+ SW_DLLPRIVATE void InvalidateUNOOjects();
+
+public:
+ SwGlossaries();
+ ~SwGlossaries();
+
+ /** returns the cached AutoTextGroup (if any) for the given group name
+
+ @precond
+ If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
+
+ @param _rGroupName
+ the name of the glossaries group
+ @param _bCreate
+ if <TRUE/>, the group is created if it does not yet exist
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextGroup >
+ GetAutoTextGroup(
+ const ::rtl::OUString& _rGroupName,
+ bool _bCreate = false
+ );
+
+ /** returns the cached AutoTextEntry (if any) for the given group/with the given name
+
+ @precond
+ If <arg>_bCreate</arg> is <TRUE/>, the SolarMutex must be locked when calling into this method.
+
+ @param _rGroupAccessName
+ the name to access the group
+ @param _rGroupName
+ the name of the glossaries group, as to be passed to the entry
+ @param _rEntryName
+ the name of the auto text entry
+ @param _bCreate
+ if <TRUE/>, the entry is created if it does not yet exist
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextEntry >
+ GetAutoTextEntry(
+ const String& _rCompleteGroupName,
+ const ::rtl::OUString& _rGroupName,
+ const ::rtl::OUString& _rEntryName,
+ bool _bCreate = false
+ );
+
+ USHORT GetGroupCnt();
+ String GetGroupName(USHORT );
+ String GetGroupTitle( const String& rGroupName );
+
+ BOOL FindGroupName(String & rGroup);
+
+ SwTextBlocks* GetGroupDoc(const String &rName,
+ BOOL bCreate = FALSE) const;
+ SwTextBlocks* GetDefGroupDoc() const {return GetGroupDoc(GetDefName());}
+ void PutGroupDoc(SwTextBlocks *pBlock);
+ static String GetDefName();
+ static String GetExtension();
+
+ String GetCompleteGroupName( const ::rtl::OUString& GroupName );
+
+ BOOL NewGroupDoc(String &rGroupName, const String& rTitle);
+ BOOL RenameGroupDoc(const String& sOldGroup, String& sNewGroup, const String& rNewTitle);
+ BOOL DelGroupDoc(const String &);
+ SwDocShellRef EditGroupDoc(const String &rGrpName, const String& rShortName, BOOL bShow = TRUE );
+ void SaveGroupDoc(const String &rGrpName, const String& rLongName );
+ void UpdateGlosPath(BOOL bFull);
+ void ShowError();
+ inline ULONG IsGlosPathErr() { return m_bError; }
+ const SvStrings* GetPathArray() const {return m_pPathArr;}
+};
+
+
+#endif // _GLOSDOC_HXX
diff --git a/sw/source/ui/inc/gloshdl.hxx b/sw/source/ui/inc/gloshdl.hxx
new file mode 100644
index 000000000000..df9e610f4b9a
--- /dev/null
+++ b/sw/source/ui/inc/gloshdl.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _GLOSHDL_HXX
+#define _GLOSHDL_HXX
+
+#include <tools/string.hxx>
+#include "swdllapi.h"
+
+class SwWrtShell;
+class SwTextBlocks;
+class SvxMacro;
+class SwGlossaries;
+class SfxViewFrame;
+
+// CLASS -----------------------------------------------------------------
+class SW_DLLPUBLIC SwGlossaryHdl
+{
+
+ SwGlossaries& rStatGlossaries;
+ String aCurGrp;
+ SfxViewFrame* pViewFrame;
+ SwWrtShell* pWrtShell;
+ SwTextBlocks* pCurGrp;
+
+ SW_DLLPRIVATE void _SetMacros(const String &rName,
+ const SvxMacro *pStart,
+ const SvxMacro *pEnd);
+
+ SW_DLLPRIVATE BOOL Expand( const String& rShortName,
+ SwGlossaries* pGlossaries,
+ SwTextBlocks *pGlossary );
+
+public:
+ BOOL ConvertToNew(SwTextBlocks& rOld);
+ void GlossaryDlg();
+
+ USHORT GetGroupCnt() const;
+ String GetGroupName( USHORT, String* pTitle = 0 );
+ BOOL NewGroup(String & rGroupName, const String& rTitle);
+ BOOL DelGroup(const String &);
+ BOOL RenameGroup(const String & rOld, String& rNew, const String& rNewTitle);
+ void SetCurGroup(const String &aGrp, BOOL bApi = FALSE, BOOL bAlwaysCreateNew = FALSE);
+
+ const String &GetCurGroup() const { return aCurGrp; }
+
+ USHORT GetGlossaryCnt();
+ String GetGlossaryName(USHORT);
+ String GetGlossaryShortName(const String &rName);
+ String GetGlossaryShortName(USHORT);
+
+ BOOL Rename( const String& rOldShortName, const String& rNewShortName,
+ const String& rNewName);
+ BOOL CopyOrMove( const String& rSourceGroupName, String& rSourceShortName,
+ const String& rDestGroupName, const String& rLongName, BOOL bMove );
+ BOOL HasShortName(const String &rShortName) const;
+ //wird NewGlossary vom Basic gerufen, dann soll dir zuvor eingestellte
+ //Gruppe ggf. neu erstellt werden
+ BOOL NewGlossary(const String &rName, const String &rShortName,
+ BOOL bApiCall = FALSE, BOOL bNoAttr = FALSE );
+ BOOL DelGlossary(const String&);
+ BOOL CopyToClipboard(SwWrtShell& rSh, const String& rShortName);
+
+ BOOL ExpandGlossary();
+ BOOL InsertGlossary(const String &rName);
+
+ void SetMacros(const String& rName,
+ const SvxMacro* pStart,
+ const SvxMacro* pEnd,
+ SwTextBlocks *pGlossary = 0 );
+ void GetMacros(const String& rShortName,
+ SvxMacro& rStart,
+ SvxMacro& rEnd,
+ SwTextBlocks* pGlossary = 0 );
+
+ BOOL IsReadOnly( const String* = 0 ) const;
+ BOOL IsOld() const;
+
+ BOOL FindGroupName(String & rGroup); // Gruppe ohne Pfadindex finden
+
+ BOOL ImportGlossaries( const String& rName );
+
+ SwGlossaryHdl(SfxViewFrame* pViewFrame, SwWrtShell *);
+ ~SwGlossaryHdl();
+};
+
+#endif // _GLOSHDL_HXX
diff --git a/sw/source/ui/inc/gloslst.hxx b/sw/source/ui/inc/gloslst.hxx
new file mode 100644
index 000000000000..52654c84b865
--- /dev/null
+++ b/sw/source/ui/inc/gloslst.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _GLOSLST_HXX
+#define _GLOSLST_HXX
+
+
+#include <tools/datetime.hxx>
+#include <tools/string.hxx>
+#include <vcl/timer.hxx>
+#include <svl/svarray.hxx>
+
+class SwGlossaries;
+class SvStringsISortDtor;
+
+struct AutoTextGroup
+{
+ USHORT nCount;
+ String sName;
+ String sTitle;
+ String sLongNames; // durch 0x0A getrennte Langnamen
+ String sShortNames; // durch 0x0A getrennte Kurznamen
+ DateTime aDateModified;
+};
+
+
+typedef AutoTextGroup* AutoTextGroupPtr;
+SV_DECL_PTRARR(AutoTextGroups, AutoTextGroupPtr, 4, 4)
+
+class SwGlossaryList : public AutoTimer
+{
+ AutoTextGroups aGroupArr;
+ String sPath;
+ BOOL bFilled;
+
+ AutoTextGroup* FindGroup(const String& rGroupName);
+ void FillGroup(AutoTextGroup* pGroup, SwGlossaries* pGloss);
+
+public:
+ SwGlossaryList();
+ ~SwGlossaryList();
+
+ BOOL HasLongName(const String& rBegin, SvStringsISortDtor* pLongNames );
+ BOOL GetShortName(const String& rLongName,
+ String& rShortName, String& rGroupName );
+
+ USHORT GetGroupCount();
+ String GetGroupName(USHORT nPos, BOOL bNoPath = TRUE, String* pTitle = 0);
+ USHORT GetBlockCount(USHORT nGroup);
+ String GetBlockName(USHORT nGroup, USHORT nBlock, String& rShortName);
+
+ void Update();
+
+ virtual void Timeout();
+
+ void ClearGroups();
+};
+
+#endif
+
+
+
+
+
+
diff --git a/sw/source/ui/inc/glossary.hxx b/sw/source/ui/inc/glossary.hxx
new file mode 100644
index 000000000000..3c6ce003ca8f
--- /dev/null
+++ b/sw/source/ui/inc/glossary.hxx
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _GLOSSARY_HXX
+#define _GLOSSARY_HXX
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#include <svtools/svtreebx.hxx>
+#include <svx/stddlg.hxx>
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <vcl/fixed.hxx>
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _COMBOBOX_HXX //autogen
+#include <vcl/combobox.hxx>
+#endif
+
+#ifndef _MENUBTN_HXX //autogen
+#include <vcl/menubtn.hxx>
+#endif
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XElementAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+
+#include <actctrl.hxx>
+
+class SwGlossaryHdl;
+class SwNewGlosNameDlg;
+class SwWrtShell;
+class SfxViewFrame;
+class PopupMenu;
+class Menu;
+
+const short RET_EDIT = 100;
+
+//------------------------------------------------------------------
+
+class SwGlTreeListBox : public SvTreeListBox
+{
+ const String sReadonly;
+
+ SvLBoxEntry* pDragEntry;
+
+ virtual DragDropMode NotifyStartDrag( TransferDataContainer& rContainer,
+ SvLBoxEntry* );
+ virtual sal_Bool NotifyAcceptDrop( SvLBoxEntry* );
+
+ virtual sal_Bool NotifyMoving( SvLBoxEntry* pTarget,
+ SvLBoxEntry* pEntry,
+ SvLBoxEntry*& rpNewParent,
+ ULONG& rNewChildPos
+ );
+ virtual sal_Bool NotifyCopying( SvLBoxEntry* pTarget,
+ SvLBoxEntry* pEntry,
+ SvLBoxEntry*& rpNewParent,
+ ULONG& rNewChildPos);
+public:
+ SwGlTreeListBox(Window* pParent, const ResId& rResId);
+
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ void Clear();
+};
+
+//------------------------------------------------------------------
+class SwOneExampleFrame;
+class SwGlossaryDlg : public SvxStandardDialog
+{
+ friend class SwNewGlosNameDlg;
+ friend class SwGlTreeListBox;
+
+ CheckBox aInsertTipCB;
+ FixedText aNameLbl;
+ Edit aNameED;
+ FixedText aShortNameLbl;
+ NoSpaceEdit aShortNameEdit;
+ SwGlTreeListBox aCategoryBox;
+ FixedLine aRelativeFL;
+ CheckBox aFileRelCB;
+ CheckBox aNetRelCB;
+ Window aExampleWIN;
+ Window aExampleDummyWIN;
+ CheckBox aShowExampleCB;
+ OKButton aInsertBtn;
+ CancelButton aCloseBtn;
+ HelpButton aHelpBtn;
+ MenuButton aEditBtn;
+ PushButton aBibBtn;
+ PushButton aPathBtn;
+
+ String sReadonlyPath;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > _xAutoText;
+ SwOneExampleFrame* pExampleFrame;
+
+ PopupMenu* pMenu;
+ SwGlossaryHdl* pGlossaryHdl;
+
+ String sResumeGroup;
+ String sResumeShortName;
+ BOOL bResume;
+
+
+ const sal_Bool bSelection : 1;
+ sal_Bool bReadOnly : 1;
+ sal_Bool bIsOld : 1;
+ sal_Bool bIsDocReadOnly:1;
+
+ SwWrtShell* pSh;
+
+ void EnableShortName(sal_Bool bOn = sal_True);
+
+ DECL_LINK( NameModify, Edit * );
+ DECL_LINK( NameDoubleClick, SvTreeListBox * );
+ DECL_LINK( GrpSelect, SvTreeListBox * );
+ DECL_LINK( MenuHdl, Menu * );
+ DECL_LINK( EnableHdl, Menu * );
+ DECL_LINK( BibHdl, Button * );
+ DECL_LINK( EditHdl, Button * );
+ DECL_LINK( PathHdl, Button * );
+ DECL_LINK( CheckBoxHdl, CheckBox * );
+ DECL_LINK( ShowPreviewHdl, CheckBox * );
+ DECL_LINK( PreviewLoadedHdl, void * );
+
+
+ virtual void Apply();
+ void Init();
+ SvLBoxEntry* DoesBlockExist(const String& sBlock, const String& rShort);
+ void ShowAutoText(const String& rGroup, const String& rShortName);
+ void ResumeShowAutoText();
+
+ BOOL GetResumeData(String& rGroup, String& rShortName)
+ {rGroup = sResumeGroup; rShortName = sResumeShortName; return bResume;}
+ void SetResumeData(const String& rGroup, const String& rShortName)
+ {sResumeGroup = rGroup; sResumeShortName = rShortName; bResume = TRUE;}
+ void ResetResumeData() {bResume = FALSE;}
+public:
+ SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell);
+ ~SwGlossaryDlg();
+ String GetCurrGrpName() const;
+ inline String GetCurrLongName() const;
+ inline String GetCurrShortName() const;
+ static String GetCurrGroup();
+ static void SetActGroup(const String& rNewGroup);
+ static String GetExtension();
+};
+
+inline String SwGlossaryDlg::GetCurrLongName() const
+{
+ return aNameED.GetText();
+}
+inline String SwGlossaryDlg::GetCurrShortName() const
+{
+ return aShortNameEdit.GetText();
+}
+
+
+#endif
+
diff --git a/sw/source/ui/inc/glshell.hxx b/sw/source/ui/inc/glshell.hxx
new file mode 100644
index 000000000000..ac97aa7a7f70
--- /dev/null
+++ b/sw/source/ui/inc/glshell.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _AUTODOC_HXX
+#define _AUTODOC_HXX
+#include "wdocsh.hxx"
+
+class SwGlosDocShell : public SwDocShell
+{
+ String aLongName;
+ String aShortName;
+ String aGroupName;
+ sal_Bool bShow;
+
+ using SotObject::GetInterface;
+
+protected:
+ virtual BOOL Save();
+
+public:
+
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SW_GLOSDOCSHELL)
+
+ SwGlosDocShell( sal_Bool bNewShow = sal_True);
+ virtual ~SwGlosDocShell();
+
+ void Execute( SfxRequest& );
+ void GetState( SfxItemSet& );
+ void SetLongName( const String& rLongName )
+ { aLongName = rLongName; }
+ void SetShortName( const String& rShortName )
+ { aShortName = rShortName; }
+ void SetGroupName( const String& rGroupName )
+ { aGroupName = rGroupName; }
+ const String& GetShortName(){return aShortName;}
+};
+
+
+class SwWebGlosDocShell : public SwWebDocShell
+{
+ String aLongName;
+ String aShortName;
+ String aGroupName;
+
+ using SotObject::GetInterface;
+
+protected:
+ virtual BOOL Save();
+
+public:
+
+ TYPEINFO();
+ SFX_DECL_INTERFACE(SW_WEBGLOSDOCSHELL)
+
+ SwWebGlosDocShell();
+ virtual ~SwWebGlosDocShell();
+
+ void Execute( SfxRequest& );
+ void GetState( SfxItemSet& );
+ void SetLongName( const String& rLongName )
+ { aLongName = rLongName; }
+ void SetShortName( const String& rShortName )
+ { aShortName = rShortName; }
+ void SetGroupName( const String& rGroupName )
+ { aGroupName = rGroupName; }
+ const String& GetShortName(){return aShortName;}
+};
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/inc/grfsh.hxx b/sw/source/ui/inc/grfsh.hxx
new file mode 100644
index 000000000000..f8448ae9bc68
--- /dev/null
+++ b/sw/source/ui/inc/grfsh.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWGRFSH_HXX
+#define _SWGRFSH_HXX
+
+#include "frmsh.hxx"
+
+class SwGrfShell: public SwBaseShell
+{
+public:
+ SFX_DECL_INTERFACE(SW_GRFSHELL)
+
+ void Execute(SfxRequest &);
+ void ExecAttr(SfxRequest &);
+ void GetAttrState(SfxItemSet &);
+
+ SwGrfShell(SwView &rView);
+};
+
+#endif
diff --git a/sw/source/ui/inc/hidfunc.h b/sw/source/ui/inc/hidfunc.h
new file mode 100644
index 000000000000..d5cff23e616b
--- /dev/null
+++ b/sw/source/ui/inc/hidfunc.h
@@ -0,0 +1,350 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define HID_EXIT 1017
+#define HID_NEW_WINDOW 1701
+#define HID_ARRANGE_CASCADE_WIN 1703
+#define HID_ARRANGE_HORZ_WIN 1704
+#define HID_ARRANGE_VERT_WIN 1705
+#define HID_ARRANGE_ALL_WIN 1702
+#define HID_SHOW_HELP_INDEX 1802
+#define HID_NEW_FILE 1005
+#define HID_NEW_FILE_DEFAULT 1024
+#define HID_CLOSE_FILE 1001
+#define HID_DOC_MGR_DLG 1032
+#define HID_CONFIG_TOOLBOX 1629
+#define HID_CONFIG_MENU 1630
+#define HID_CONFIG_KEY 1631
+#define HID_TEMPLATE_PI 1657
+#define HID_ADDR_PI 1658
+#define HID_AUTO_FORMAT 1651
+#define HID_NAVIGATION_PI 1656
+#define HID_NAVIGATION_PI_GOTO_PAGE 1659
+#define HID_HELP_PI 1655
+#define HID_FORMAT_DROPCAPS 1454
+#define HID_CONFIG_VIEWOPTIONS 1635
+#define HID_CONFIG_COLORS 1636
+#define HID_TOOLBOX 1213
+#define HID_RIBBON 1210
+#define HID_RULER 1211
+#define HID_VLINEAL 1216
+#define HID_VSCROLLBAR 1217
+#define HID_HSCROLLBAR 1218
+#define HID_SAVE_FILE 1013
+#define HID_SAVE_ALL 1023
+#define HID_SAVE_FILE_AS 1012
+#define HID_OPEN_LASTVERSION 1009
+#define HID_STATUSBAR 1212
+#define HID_ABOUT_DLG 1806
+#define HID_SEND_MAIL 1022
+#define HID_OPEN_FILE 1007
+#define HID_INSERT_FILE 1309
+#define HID_DOCSTAT_DLG 1020
+#define HID_LOAD_TEMPLATE_DLG 1021
+#define HID_ESCAPE 1941
+#define HID_PLAY_MACRO_DLG 1624
+#define HID_RECORD_MACRO_DLG 1622
+#define HID_ASSIGN_LOCAL_MACRO_DLG 1632
+#define HID_COMPILE_MACRO 1633
+#define HID_CREATE_DOCUMENT 1019
+#define HID_PAGEUP 1937
+#define HID_PAGEDOWN 1938
+#define HID_SET_LEFT_PARA 1418
+#define HID_SET_RIGHT_PARA 1419
+#define HID_SET_CENTER_PARA 1420
+#define HID_SET_JUSTIFY_PARA 1421
+#define HID_SET_ADJUST 1428
+#define HID_FORMAT_RESET 1469
+#define HID_INDENT_TO_TABSTOP 1417
+#define HID_UNINDENT_TO_TABSTOP 1431
+#define HID_SET_BOLD 1405
+#define HID_SET_ITALIC 1406
+#define HID_SET_UNDERLINE 1409
+#define HID_SET_STRIKEOUT 1410
+#define HID_SET_OUTLINE 1408
+#define HID_SET_SHADOW 1407
+#define HID_SET_SUPER_SCRIPT 1411
+#define HID_SET_SUB_SCRIPT 1412
+#define HID_SET_COLOR 1413
+#define HID_SET_CASEMAP 1414
+#define HID_SET_LANGUAGE 1415
+#define HID_SET_KERNING 1416
+#define HID_SET_FONT 1401
+#define HID_SET_FONT_SIZE 1402
+#define HID_GROW_FONT_SIZE 1403
+#define HID_SHRINK_FONT_SIZE 1404
+#define HID_SET_LINE_SPACE_1 1422
+#define HID_SET_LINE_SPACE_15 1423
+#define HID_SET_LINE_SPACE_2 1424
+#define HID_SET_PROP_LINE_SPACE 1540
+#define HID_SET_ABS_LINE_SPACE 1541
+#define HID_INSERT_SYMBOL 1328
+#define HID_INSERT_OBJECT_DLG 1322
+#define HID_EDIT_OBJECT 1110
+#define HID_EDIT_LINK_DLG 1109
+#define HID_EDIT_FILE_INFO_DLG 1107
+#define HID_EDIT_IDX_ENTRY_DLG 1123
+#define HID_NUM_BULLET_DOWN 1130
+#define HID_NUM_BULLET_MOVEUP 1134
+#define HID_NUM_BULLET_MOVEDOWN 1135
+#define HID_NUM_BULLET_UP 1131
+#define HID_NUM_BULLET_PREV 1132
+#define HID_NUM_BULLET_NEXT 1133
+#define HID_NUM_BULLET_OUTLINE_MOVEDOWN 1142
+#define HID_NUM_BULLET_OUTLINE_MOVEUP 1141
+#define HID_NUM_BULLET_OUTLINE_UP 1140
+#define HID_NUM_BULLET_OUTLINE_DOWN 1139
+#define HID_NUM_BULLET_NONUM 1136
+#define HID_NUM_NUMBERING_ON 1144
+#define HID_NUM_BULLET_ON 1138
+#define HID_NUM_BULLET_OFF 1137
+#define HID_INSERT_IDX_ENTRY_DLG 1335
+#define HID_POSTIT 1329
+#define HID_INSERT_CAPTION 1310
+#define HID_INSERT_IDX 1336
+#define HID_INSERT_USERIDX 1337
+#define HID_INSERT_CNTNTIDX 1338
+#define HID_INSERT_IDX_ENTRY 1340
+#define HID_INSERT_USERIDX_ENTRY 1341
+#define HID_INSERT_CNTNTIDX_ENTRY 1342
+#define HID_INSERT_FRAME 1334
+#define HID_INSERT_FRAME_INTERACT 1333
+#define HID_INSERT_SOFT_HYPHEN 1350
+#define HID_INSERT_HARD_SPACE 1351
+#define HID_FORMAT_FRAME_DLG 1456
+#define HID_FRAME_TO_TOP 1470
+#define HID_FRAME_TO_BOTTOM 1471
+#define HID_FRAME_NOWRAP 1472
+#define HID_FRAME_WRAP 1473
+#define HID_FRAME_WRAPTHRU 1474
+#define HID_FRAME_ALIGN_HORZ_LEFT 1475
+#define HID_FRAME_ALIGN_HORZ_RIGHT 1476
+#define HID_FRAME_ALIGN_HORZ_CENTER 1477
+#define HID_FRAME_ALIGN_VERT_TOP 1478
+#define HID_FRAME_ALIGN_VERT_BOTTOM 1479
+#define HID_FRAME_ALIGN_VERT_CENTER 1480
+#define HID_EDIT_FIELD 1104
+#define HID_SET_FIELD_VALUE 1112
+#define HID_INSERT_FIELD 1308
+#define HID_INSERT_MERGEFIELD_DLG 1320
+#define HID_EXECUTE_MACROFIELD 1127
+#define HID_UPDATE_FIELDS 1126
+#define HID_UPDATE_INPUTFIELDS 1143
+#define HID_CALC_TABLE 1129
+#define HID_INSERT_BREAK_DLG 1304
+#define HID_INSERT_BOOKMARK 1302
+#define HID_DELETE_BOOKMARK 1301
+#define HID_INSERT_GRAFIC 1315
+#define HID_FORMAT_TABLE_DLG 1460
+#define HID_INSERT_TABLE 1330
+#define HID_INSERT_COLS 1332
+#define HID_PAGE_STYLE_SET_COLS 1538
+#define HID_CONVERT_TEXT_TABLE 1500
+#define HID_TABLE_INSERT_ROW 1501
+#define HID_TABLE_INSERT_COL 1502
+#define HID_TABLE_DELETE_ROW 1503
+#define HID_TABLE_DELETE_COL 1504
+#define HID_TABLE_SPLIT_CELLS 1505
+#define HID_TABLE_MERGE_CELLS 1506
+#define HID_TABLE_SET_ROW_HEIGHT 1507
+#define HID_TABLE_SET_COL_WIDTH 1508
+#define HID_TABLE_SET_ULSPACE 1509
+#define HID_TABLE_SET_GRID 1510
+#define HID_TABLE_SET_SHADOW 1511
+#define HID_FORMAT_CHAR_DLG 1441
+#define HID_FORMAT_PAGE_DLG 1452
+#define HID_CHANGE_PAGENUM 1634
+#define HID_FORMAT_PARA_DLG 1443
+#define HID_FORMAT_TAB_DLG 1445
+#define HID_FORMAT_BORDER_DLG 1447
+#define HID_FORMAT_BORDER 1439
+#define HID_FORMAT_SHADOW 1438
+#define HID_FORMAT_BACKGROUND 1448
+#define HID_FORMAT_BACKGROUND_DLG 1450
+#define HID_SET_FRM_SIZE 1481
+#define HID_SET_FRM_POSITION 1482
+#define HID_SET_FRM_ANCHOR 1483
+#define HID_SET_FRM_WRAP 1484
+#define HID_SET_FRM_DIST 1485
+#define HID_SET_FRM_OPTIONS 1486
+#define HID_SET_FRM_MACRO 1494
+#define HID_SET_FRM_COLUMNS 1495
+#define HID_SET_FRM_COLUMN_WIDTH 1496
+#define HID_SET_GRF_MIRROR 1488
+#define HID_SET_TABLE_WIDTH 1489
+#define HID_SET_TABLE_ALIGN 1490
+#define HID_TABLE_SET_READ_ONLY_CELLS 1517
+#define HID_TABLE_UNSET_READ_ONLY_CELLS 1519
+#define HID_NEW_STYLE_BY_EXAMPLE 1462
+#define HID_UPDATE_STYLES_DIRECT 1497
+#define HID_UPDATE_STYLE_BY_EXAMPLE 1463
+#define HID_STYLE_SHEET_FRAME_DLG 1464
+#define HID_STYLE_SHEET_DOC_DLG 1465
+#define HID_SET_STANDARD_FONTS 1442
+#define HID_COPY 1102
+#define HID_PASTE 1113
+#define HID_PASTEUNFORMATTED 1115
+#define HID_PASTESPECIAL 1114
+#define HID_CUT 1103
+#define HID_FLIP_HORZ_GRAFIC 1425
+#define HID_FLIP_VERT_GRAFIC 1426
+#define HID_FORMAT_GRAFIC_DLG 1458
+#define HID_VIEW_BOUNDS 1214
+#define HID_VIEW_FIELDS 1215
+#define HID_VIEW_META_CHARS 1224
+#define HID_VIEW_MARKS 1225
+#define HID_VIEW_FIELDNAME 1226
+#define HID_VIEW_TABLEGRID 1227
+#define HID_SEARCH 1117
+#define HID_REPEAT_SEARCH 1150
+#define HID_REPLACE 1118
+#define HID_GOTO 1111
+#define HID_SETUP_PRINTER_DLG 1015
+#define HID_PRINT_FILE 1010
+#define HID_PRINT_FILE_DEFAULT 1025
+#define HID_FAX 1028
+#define HID_PRINT_FILE_OPTIONS 1011
+#define HID_THESAURUS_DLG 1604
+#define HID_SPELLING_DLG 1601
+#define HID_HYPHENATE_OPT_DLG 1607
+#define HID_MERGE_FILE_DLG 1004
+#define HID_SELECT_DATABASE 1030
+#define HID_DOC_INFO_DLG 1031
+#define HID_MERGE_FILE 1003
+#define HID_MERGE_RECORD 1327
+#define HID_INSERT_RECORD 1326
+#define HID_NUMBERING_OUTLINE_DLG 1612
+#define HID_NUMBER_BULLETS 1121
+#define HID_ZOOM 1231
+#define HID_SORTING 1613
+#define HID_SORTING_DLG 1614
+#define HID_CALCULATE 1615
+#define HID_REFRESH_VIEW 1201
+#define HID_CHAR_LEFT 1901
+#define HID_CHAR_RIGHT 1902
+#define HID_LINE_UP 1903
+#define HID_LINE_DOWN 1904
+#define HID_START_OF_LINE 1905
+#define HID_END_OF_LINE 1906
+#define HID_START_OF_DOCUMENT 1907
+#define HID_END_OF_DOCUMENT 1908
+#define HID_SELECT_WORD 1943
+#define HID_SELECT_ALL 1119
+#define HID_START_OF_NEXT_PAGE 1909
+#define HID_END_OF_NEXT_PAGE 1910
+#define HID_START_OF_PREV_PAGE 1911
+#define HID_END_OF_PREV_PAGE 1912
+#define HID_START_OF_PAGE 1913
+#define HID_END_OF_PAGE 1914
+#define HID_NEXT_WORD 1921
+#define HID_START_OF_PARA 1919
+#define HID_END_OF_PARA 1920
+#define HID_PREV_WORD 1922
+#define HID_NEXT_SENT 1923
+#define HID_PREV_SENT 1924
+#define HID_SET_INS_MODE 1936
+#define HID_SET_ADD_MODE 1939
+#define HID_SET_EXT_MODE 1940
+#define HID_START_TABLE 1947
+#define HID_END_TABLE 1948
+#define HID_NEXT_TABLE 1949
+#define HID_PREV_TABLE 1950
+#define HID_TABLE_SELECT_ALL 1515
+#define HID_TABLE_SELECT_COL 1514
+#define HID_TABLE_SELECT_ROW 1513
+#define HID_START_OF_COLUMN 1917
+#define HID_END_OF_COLUMN 1918
+#define HID_START_OF_NEXT_COLUMN 1951
+#define HID_END_OF_NEXT_COLUMN 1952
+#define HID_START_OF_PREV_COLUMN 1953
+#define HID_END_OF_PREV_COLUMN 1954
+#define HID_FOOTNOTE_TO_ANCHOR 1955
+#define HID_NEXT_FOOTNOTE 1956
+#define HID_PREV_FOOTNOTE 1957
+#define HID_CNTNT_TO_NEXT_FRAME 1958
+#define HID_FRAME_TO_ANCHOR 1959
+#define HID_TO_HEADER 1960
+#define HID_TO_FOOTER 1961
+#define HID_IDX_MARK_TO_IDX 1962
+#define HID_DELETE 1925
+#define HID_BACKSPACE 1926
+#define HID_DELETE_SENT 1927
+#define HID_DELETE_BACK_SENT 1928
+#define HID_DELETE_WORD 1929
+#define HID_DELETE_BACK_WORD 1930
+#define HID_DELETE_LINE 1931
+#define HID_DELETE_BACK_LINE 1932
+#define HID_DELETE_PARA 1933
+#define HID_DELETE_BACK_PARA 1934
+#define HID_DELETE_WHOLE_LINE 1935
+#define HID_INSERT_BREAK 1303
+#define HID_INSERT_PAGEBREAK 1323
+#define HID_INSERT_LINEBREAK 1318
+#define HID_INSERT_COLUMN_BREAK 1305
+#define HID_INSERT_FOOTNOTE 1311
+#define HID_INSERT_FOOTNOTE_DLG 1312
+#define HID_FORMAT_FOOTNOTE_DLG 1468
+#define HID_UNDO 1120
+#define HID_REDO 1116
+#define HID_REPEAT 1122
+#define HID_REPAGINATE 1161
+#define HID_SHOW_UPDATE_HELP 1805
+#define HID_SHOW_KEYBOARD_HELP 1803
+#define HID_SHOW_HELP_MANUAL 1804
+#define HID_GLOSSARY_DLG 1620
+#define HID_EXPAND_GLOSSARY 1628
+#define HID_INSERT_GLOSSARY 1640
+#define HID_AUTO_CORRECT_DLG 1650
+#define HID_AUTO_CORRECT 1649
+#define HID_CONFIG_DLG 1627
+#define HID_INSERT_STRING 1331
+#define HID_SET_CHAR_STYLE 1491
+#define HID_SET_PARA_STYLE 1492
+#define HID_SET_PAGE_STYLE 1493
+#define HID_SET_LRMARGIN 1429
+#define HID_SET_ULMARGIN 1430
+#define HID_SET_HYPHEN_ZONE 1432
+#define HID_SET_PAGE_BREAK 1433
+#define HID_FORMAT_PAGE 1451
+#define HID_SET_KEEP_TOGETHER 1434
+#define HID_SET_WIDOW 1436
+#define HID_SET_ORPHAN 1437
+#define HID_BUFFER_UPDATE 1124
+#define HID_FORMAT_TAB 1444
+#define HID_IS_END_OF_PARA 2000
+#define HID_IS_END_OF_WORD 2000
+#define HID_IS_END_OF_DOC 2000
+#define HID_IS_START_OF_PARA 2000
+#define HID_IS_START_OF_WORD 2000
+#define HID_IS_START_OF_DOC 2000
+#define HID_EDIT_FORMULA 1128
+#define HID_ENVELOP 2050
+#define HID_LABEL 2051
+#define HID_AGENDA_WIZZARD 1663
+#define HID_MEMO_WIZZARD 1662
+#define HID_FAX_WIZZARD 1661
+#define HID_LETTER_WIZZARD 1660
+#define HID_LAUNCH_REGISTRY 1002
diff --git a/sw/source/ui/inc/hyp.hxx b/sw/source/ui/inc/hyp.hxx
new file mode 100644
index 000000000000..330507024f3c
--- /dev/null
+++ b/sw/source/ui/inc/hyp.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _HYP_HXX
+#define _HYP_HXX
+
+#include <tools/link.hxx>
+#include <editeng/splwrap.hxx>
+#include <com/sun/star/linguistic2/XHyphenator.hpp>
+
+class SwView;
+
+class SwHyphWrapper : public SvxSpellWrapper {
+private:
+ SwView* pView;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > xHyph;
+ Link aOldLnk;
+ LanguageType nLangError; // nicht vorhandene Sprache
+ sal_uInt16 nPageCount; // Seitenanzahl fuer Progressanzeige
+ sal_uInt16 nPageStart; // 1. gepruefte Seite
+ sal_Bool bInSelection : 1; // Trennen von selektiertem Text
+ sal_Bool bShowError : 1; // nicht vorhandene Sprache melden
+ sal_Bool bAutomatic : 1; // Trennstellen ohne Rueckfrage einfuegen
+ sal_Bool bInfoBox : 1; // display info-box when ending
+ DECL_LINK( SpellError, LanguageType * );
+
+protected:
+ virtual void SpellStart( SvxSpellArea eSpell );
+ virtual sal_Bool SpellContinue();
+ virtual void SpellEnd( );
+ virtual sal_Bool SpellMore();
+ virtual void InsertHyphen( const sal_uInt16 nPos ); // Hyphen einfuegen
+
+public:
+ SwHyphWrapper( SwView* pVw,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > &rxHyph,
+ sal_Bool bStart, sal_Bool bOther, sal_Bool bSelect );
+ ~SwHyphWrapper();
+};
+
+#endif
diff --git a/sw/source/ui/inc/idxmrk.hxx b/sw/source/ui/inc/idxmrk.hxx
new file mode 100644
index 000000000000..6d569bb798dd
--- /dev/null
+++ b/sw/source/ui/inc/idxmrk.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _IDXMRK_HXX
+#define _IDXMRK_HXX
+
+#include <sfx2/childwin.hxx>
+
+#include "swabstdlg.hxx"
+
+class SwWrtShell;
+
+/* -----------------07.09.99 08:02-------------------
+
+ --------------------------------------------------*/
+class SwInsertIdxMarkWrapper : public SfxChildWindow
+{
+ AbstractMarkFloatDlg* pAbstDlg;
+protected:
+ SwInsertIdxMarkWrapper( Window *pParentWindow,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo );
+
+ SFX_DECL_CHILDWINDOW(SwInsertIdxMarkWrapper);
+
+public:
+ void ReInitDlg(SwWrtShell& rWrtShell);
+};
+
+/* -----------------07.09.99 08:02-------------------
+
+ --------------------------------------------------*/
+class SwInsertAuthMarkWrapper : public SfxChildWindow
+{
+ AbstractMarkFloatDlg* pAbstDlg;
+protected:
+ SwInsertAuthMarkWrapper( Window *pParentWindow,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo );
+
+ SFX_DECL_CHILDWINDOW(SwInsertAuthMarkWrapper);
+
+public:
+ void ReInitDlg(SwWrtShell& rWrtShell);
+};
+
+#endif // _IDXMRK_HXX
+
diff --git a/sw/source/ui/inc/imaildsplistener.hxx b/sw/source/ui/inc/imaildsplistener.hxx
new file mode 100644
index 000000000000..9cb7d11f2684
--- /dev/null
+++ b/sw/source/ui/inc/imaildsplistener.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_IMAILDSPLISTENER_HXX
+#define INCLUDED_IMAILDSPLISTENER_HXX
+
+#include "com/sun/star/mail/XMailMessage.hpp"
+#include <salhelper/refobj.hxx>
+
+
+class MailDispatcher;
+
+/**
+ MailDispatcher listener interface.
+ Clients may implement and register instances of the
+ mail dispatcher interface in order to get notifications
+ about the MailDispatcher status.
+
+ @see MailDispatcher
+*/
+class IMailDispatcherListener : public ::salhelper::ReferenceObject
+{
+public:
+ /**
+ Called when the MailDispatcher is started.
+ */
+ virtual void started(::rtl::Reference<MailDispatcher> xMailDispatcher) = 0;
+
+ /**
+ Called when the MailDispatcher is stopped.
+ */
+ virtual void stopped(::rtl::Reference<MailDispatcher> xMailDispatcher) = 0;
+
+ /**
+ Called when there are no more mail messages
+ to deliver.
+ */
+ virtual void idle(::rtl::Reference<MailDispatcher> xMailDispatcher) = 0;
+
+ /**
+ Called for every mail message that has been
+ successfully delivered.
+ */
+ virtual void mailDelivered(::rtl::Reference<MailDispatcher> xMailDispatcher, ::com::sun::star::uno::Reference< ::com::sun::star::mail::XMailMessage> xMailMessage) = 0;
+
+ /**
+ Called for every mail message whose delivery
+ failed.
+ */
+ virtual void mailDeliveryError(::rtl::Reference<MailDispatcher> xMailDispatcher, ::com::sun::star::uno::Reference< ::com::sun::star::mail::XMailMessage> xMailMessage, const rtl::OUString& sErrorMessage) = 0;
+};
+
+#endif // INCLUDED_IMAILDISPATCHERLISTENER_HXX
diff --git a/sw/source/ui/inc/initui.hxx b/sw/source/ui/inc/initui.hxx
new file mode 100644
index 000000000000..0a81e53f6149
--- /dev/null
+++ b/sw/source/ui/inc/initui.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _INITUI_HXX
+#define _INITUI_HXX
+
+#include "tools/solar.h"
+#include "swdllapi.h"
+
+/*
+ * Forward Declarations
+ */
+class String;
+class SwThesaurus;
+class SvStringsDtor;
+
+/*
+ * Extern Definitions
+ */
+extern SwThesaurus* pThes;
+
+extern String* pOldGrfCat;
+extern String* pOldTabCat;
+extern String* pOldFrmCat;
+
+extern String* pCurrGlosGroup;
+
+SW_DLLPUBLIC String* GetOldGrfCat();
+SW_DLLPUBLIC String* GetOldTabCat();
+SW_DLLPUBLIC String* GetOldFrmCat();
+SW_DLLPUBLIC String* GetOldDrwCat();
+
+SW_DLLPUBLIC String* GetCurrGlosGroup();
+SW_DLLPUBLIC void SetCurrGlosGroup(String* pStr);
+
+extern SvStringsDtor* pDBNameList;
+
+extern SvStringsDtor* pAuthFieldNameList;
+extern SvStringsDtor* pAuthFieldTypeList;
+
+// stellt die Textbausteinverwaltung zur Verfuegung
+class SwGlossaries;
+SW_DLLPUBLIC SwGlossaries* GetGlossaries();
+
+class SwGlossaryList;
+
+BOOL HasGlossaryList();
+SwGlossaryList* GetGlossaryList();
+
+extern void _InitUI();
+extern void _FinitUI();
+extern void _InitSpell();
+extern void _FinitSpell();
+
+
+#endif
diff --git a/sw/source/ui/inc/inpdlg.hxx b/sw/source/ui/inc/inpdlg.hxx
new file mode 100644
index 000000000000..f0c2f13cc6bc
--- /dev/null
+++ b/sw/source/ui/inc/inpdlg.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _INPDLG_HXX
+#define _INPDLG_HXX
+
+#include <svx/stddlg.hxx>
+
+#ifndef _SV_SVMEDIT_HXX //autogen
+#include <svtools/svmedit.hxx>
+#endif
+#include <vcl/fixed.hxx>
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+class SwInputField;
+class SwSetExpField;
+class SwUserFieldType;
+class SwField;
+class SwWrtShell;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Einfuegen Felder
+ --------------------------------------------------------------------*/
+
+class SwFldInputDlg: public SvxStandardDialog
+{
+ virtual void Apply();
+ virtual void StateChanged( StateChangedType );
+
+ SwWrtShell &rSh;
+ SwInputField* pInpFld;
+ SwSetExpField* pSetFld;
+ SwUserFieldType* pUsrType;
+
+ Edit aLabelED;
+
+ MultiLineEdit aEditED;
+ FixedLine aEditFL;
+
+ OKButton aOKBT;
+ CancelButton aCancelBT;
+ PushButton aNextBT;
+ HelpButton aHelpBT;
+
+ DECL_LINK(NextHdl, PushButton*);
+public:
+ SwFldInputDlg( Window *pParent, SwWrtShell &rSh,
+ SwField* pField, BOOL bNextButton = FALSE );
+ ~SwFldInputDlg();
+};
+
+
+#endif
diff --git a/sw/source/ui/inc/inputwin.hxx b/sw/source/ui/inc/inputwin.hxx
new file mode 100644
index 000000000000..c752b723937f
--- /dev/null
+++ b/sw/source/ui/inc/inputwin.hxx
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_INPUTWIN_HXX
+#define SW_INPUTWIN_HXX
+
+#include <vcl/edit.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/toolbox.hxx>
+
+#include <sfx2/childwin.hxx>
+
+class SwFldMgr;
+class SwWrtShell;
+class SwView;
+class SfxDispatcher;
+
+//========================================================================
+class InputEdit : public Edit
+{
+public:
+ InputEdit(Window* pParent, WinBits nStyle) :
+ Edit(pParent , nStyle){}
+
+ void UpdateRange(const String& aSel,
+ const String& aTblName );
+
+protected:
+ virtual void KeyInput( const KeyEvent& );
+};
+
+//========================================================================
+
+class SwInputWindow : public ToolBox
+{
+friend class InputEdit;
+
+ Edit aPos;
+ InputEdit aEdit;
+ PopupMenu aPopMenu;
+ SwFldMgr* pMgr;
+ SwWrtShell* pWrtShell;
+ SwView* pView;
+ SfxBindings* pBindings;
+ String aAktTableName, sOldFml;
+ sal_Int32 m_nActionCount;
+
+ BOOL bFirst : 1; //Initialisierungen beim ersten Aufruf
+ BOOL bActive : 1; //fuer Hide/Show beim Dokumentwechsel
+ BOOL bIsTable : 1;
+ BOOL bDelSel : 1;
+ bool m_bDoesUndo : 1;
+ bool m_bResetUndo : 1;
+ bool m_bCallUndo : 1;
+
+ void CleanupUglyHackWithUndo();
+
+ void DelBoxCntnt();
+ DECL_LINK( ModifyHdl, InputEdit* );
+
+ using Window::IsActive;
+
+protected:
+ virtual void Resize();
+ virtual void Click();
+ DECL_LINK( MenuHdl, Menu * );
+ DECL_LINK( DropdownClickHdl, ToolBox* );
+ void ApplyFormula();
+ void CancelFormula();
+
+public:
+ SwInputWindow( Window* pParent, SfxBindings* pBindings );
+ virtual ~SwInputWindow();
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ void SelectHdl( ToolBox*);
+
+ void ShowWin();
+
+ BOOL IsActive(){ return bActive; };
+
+ DECL_LINK( SelTblCellsNotify, SwWrtShell * );
+
+ void SetFormula( const String& rFormula, BOOL bDelSel = TRUE );
+ const SwView* GetView() const{return pView;}
+};
+
+class SwInputChild : public SfxChildWindow
+{
+ BOOL bObjVis;
+ SfxDispatcher* pDispatch;
+public:
+ SwInputChild( Window* ,
+ USHORT nId,
+ SfxBindings*,
+ SfxChildWinInfo* );
+ ~SwInputChild();
+ SFX_DECL_CHILDWINDOW( SwInputChild );
+ void SetFormula( const String& rFormula, BOOL bDelSel = TRUE )
+ { ((SwInputWindow*)pWindow)->SetFormula(
+ rFormula, bDelSel ); }
+ const SwView* GetView() const{return ((SwInputWindow*)pWindow)->GetView();}
+
+};
+
+//==================================================================
+
+#endif
+
diff --git a/sw/source/ui/inc/insfnote.hxx b/sw/source/ui/inc/insfnote.hxx
new file mode 100644
index 000000000000..c9c51301a100
--- /dev/null
+++ b/sw/source/ui/inc/insfnote.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _INSFNOTE_HXX
+#define _INSFNOTE_HXX
+
+#include <svx/stddlg.hxx>
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#include <vcl/fixed.hxx>
+
+class SwWrtShell;
+
+class SwInsFootNoteDlg: public SvxStandardDialog
+{
+ SwWrtShell &rSh;
+
+ //Alles fuer das/die Zeichen
+ String aFontName;
+ CharSet eCharSet;
+ char cExtChar;
+ BOOL bExtCharAvailable;
+ BOOL bEdit;
+ RadioButton aNumberAutoBtn;
+ RadioButton aNumberCharBtn;
+ Edit aNumberCharEdit;
+ PushButton aNumberExtChar;
+ FixedLine aNumberFL;
+
+ //Alles fuer die Auswahl Fussnote/Endnote
+ RadioButton aFtnBtn;
+ RadioButton aEndNoteBtn;
+ FixedLine aTypeFL;
+
+ OKButton aOkBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+ ImageButton aPrevBT;
+ ImageButton aNextBT;
+
+ DECL_LINK( NumberCharHdl, Button * );
+ DECL_LINK( NumberEditHdl, void * );
+ DECL_LINK( NumberAutoBtnHdl, Button *);
+ DECL_LINK( NumberExtCharHdl, Button *);
+ DECL_LINK( NextPrevHdl, Button * );
+
+ virtual void Apply();
+
+ void Init();
+
+public:
+ SwInsFootNoteDlg(Window * pParent, SwWrtShell &rSh, BOOL bEd = FALSE);
+ ~SwInsFootNoteDlg();
+
+ CharSet GetCharSet() { return eCharSet; }
+ BOOL IsExtCharAvailable() { return bExtCharAvailable; }
+ String GetFontName() { return aFontName; }
+ BOOL IsEndNote() { return aEndNoteBtn.IsChecked(); }
+ String GetStr()
+ {
+ if ( aNumberCharBtn.IsChecked() )
+ return aNumberCharEdit.GetText();
+ else
+ return String();
+ }
+};
+
+#endif
diff --git a/sw/source/ui/inc/insrule.hxx b/sw/source/ui/inc/insrule.hxx
new file mode 100644
index 000000000000..316a161d6c06
--- /dev/null
+++ b/sw/source/ui/inc/insrule.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _INSRULE_HXX
+#define _INSRULE_HXX
+#include "num.hxx"
+
+class SwRulerValueSet;
+class ValueSet;
+/*-----------------14.02.97 12.30-------------------
+
+--------------------------------------------------*/
+class SwInsertGrfRulerDlg : public SfxModalDialog
+{
+ FixedLine aSelectionFL;
+ OKButton aOkPB;
+ CancelButton aCancelPB;
+ HelpButton aHelpPB;
+
+ List aGrfNames;
+ String sSimple;
+ String sRulers;
+ USHORT nSelPos;
+
+ SwRulerValueSet* pExampleVS;
+
+protected:
+ DECL_LINK(SelectHdl, ValueSet*);
+ DECL_LINK(DoubleClickHdl, ValueSet*);
+
+public:
+ SwInsertGrfRulerDlg( Window* pParent );
+ ~SwInsertGrfRulerDlg();
+
+ String GetGraphicName();
+ BOOL IsSimpleLine() {return nSelPos == 1;}
+ BOOL HasImages() const {return 0 != aGrfNames.Count();}
+};
+
+#endif
+
+
+
diff --git a/sw/source/ui/inc/instable.hxx b/sw/source/ui/inc/instable.hxx
new file mode 100644
index 000000000000..e48eece78a9f
--- /dev/null
+++ b/sw/source/ui/inc/instable.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _INSTABLE_HXX
+#define _INSTABLE_HXX
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#include <sfx2/basedlgs.hxx>
+#include <actctrl.hxx>
+#include <textcontrolcombo.hxx>
+
+class SwWrtShell;
+class SwTableAutoFmt;
+class SwView;
+struct SwInsertTableOptions;
+
+
+class SwInsTableDlg : public SfxModalDialog
+{
+ FixedText aNameFT;
+ TableNameEdit aNameEdit;
+
+ FixedLine aFL;
+ FixedText aColLbl;
+ NumericField aColEdit;
+ FixedText aRowLbl;
+ NumericField aRowEdit;
+
+ FixedLine aOptionsFL;
+ CheckBox aHeaderCB;
+ CheckBox aRepeatHeaderCB;
+ FixedText aRepeatHeaderFT; // "dummy" to build before and after FT
+ FixedText aRepeatHeaderBeforeFT;
+ NumericField aRepeatHeaderNF;
+ FixedText aRepeatHeaderAfterFT;
+ TextControlCombo aRepeatHeaderCombo;
+
+ CheckBox aDontSplitCB;
+ CheckBox aBorderCB;
+
+ OKButton aOkBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+ PushButton aAutoFmtBtn;
+
+ SwWrtShell* pShell;
+ SwTableAutoFmt* pTAutoFmt;
+ sal_Int64 nEnteredValRepeatHeaderNF;
+
+ DECL_LINK( ModifyName, Edit * );
+ DECL_LINK( ModifyRowCol, NumericField * );
+ DECL_LINK( AutoFmtHdl, PushButton* );
+ DECL_LINK( CheckBoxHdl, CheckBox *pCB = 0 );
+ DECL_LINK( ReapeatHeaderCheckBoxHdl, void* p = 0 );
+ DECL_LINK( ModifyRepeatHeaderNF_Hdl, void* p = 0 );
+
+public:
+ SwInsTableDlg( SwView& rView );
+ ~SwInsTableDlg();
+
+ void GetValues( String& rName, USHORT& rRow, USHORT& rCol,
+ SwInsertTableOptions& rInsTblOpts, String& rTableAutoFmtName,
+ SwTableAutoFmt *& prTAFmt );
+};
+
+#endif
diff --git a/sw/source/ui/inc/javaedit.hxx b/sw/source/ui/inc/javaedit.hxx
new file mode 100644
index 000000000000..239c67185e07
--- /dev/null
+++ b/sw/source/ui/inc/javaedit.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_JAVAEDIT_HXX
+#define _SW_JAVAEDIT_HXX
+
+// include ---------------------------------------------------------------
+
+#include <svx/stddlg.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _SV_SVMEDIT_HXX //autogen
+#include <svtools/svmedit.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _IMAGEBTN_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+class SwWrtShell;
+class SwFldMgr;
+class SwScriptField;
+
+namespace sfx2 { class FileDialogHelper; }
+
+// class SwJavaEditDialog -------------------------------------------------
+
+class SwJavaEditDialog : public SvxStandardDialog
+{
+private:
+ FixedText aTypeFT;
+ Edit aTypeED;
+ RadioButton aUrlRB;
+ RadioButton aEditRB;
+ PushButton aUrlPB;
+ Edit aUrlED;
+ MultiLineEdit aEditED;
+ FixedLine aPostItFL;
+
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ ImageButton aPrevBtn;
+ ImageButton aNextBtn;
+ HelpButton aHelpBtn;
+
+ String aText;
+ String aType;
+
+ BOOL bNew;
+ BOOL bIsUrl;
+
+ SwScriptField* pFld;
+ SwFldMgr* pMgr;
+ SwWrtShell* pSh;
+ sfx2::FileDialogHelper* pFileDlg;
+ Window* pOldDefDlgParent;
+
+ DECL_LINK( OKHdl, Button* );
+ DECL_LINK( PrevHdl, Button* );
+ DECL_LINK( NextHdl, Button* );
+ DECL_LINK( RadioButtonHdl, RadioButton* pBtn );
+ DECL_LINK( InsertFileHdl, PushButton * );
+ DECL_LINK( DlgClosedHdl, sfx2::FileDialogHelper * );
+
+ virtual void Apply();
+
+ void CheckTravel();
+ void SetFld();
+
+ using Window::GetText;
+ using Window::GetType;
+
+public:
+ SwJavaEditDialog(Window* pParent, SwWrtShell* pWrtSh);
+ ~SwJavaEditDialog();
+
+ String GetText() { return aText; }
+
+ String GetType() { return aType; }
+
+ BOOL IsUrl() { return bIsUrl; }
+ BOOL IsNew() { return bNew; }
+ BOOL IsUpdate();
+};
+
+
+#endif
+
diff --git a/sw/source/ui/inc/label.hxx b/sw/source/ui/inc/label.hxx
new file mode 100644
index 000000000000..0717ef2b6bd2
--- /dev/null
+++ b/sw/source/ui/inc/label.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _LABEL_HXX
+#define _LABEL_HXX
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_STRINGSDTOR
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+#endif
+#include <sfx2/tabdlg.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include <labelcfg.hxx>
+class SwLabRec;
+class SwLabRecs;
+class SwLabItem;
+class SwLabPrtPage;
+class SwNewDBMgr;
+class Printer;
+
+class SwLabDlg : public SfxTabDialog
+{
+ SwLabelConfig aLabelsCfg;
+ SwNewDBMgr* pNewDBMgr;
+ SwLabPrtPage* pPrtPage;
+
+ SvUShorts aTypeIds;
+ SvStringsDtor aMakes;
+
+ SwLabRecs* pRecs;
+ String aLstGroup;
+ String sBusinessCardDlg;
+ String sFormat;
+ String sMedium;
+ BOOL m_bLabel;
+ void _ReplaceGroup( const String &rMake );
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+public:
+
+ SwLabDlg( Window* pParent, const SfxItemSet& rSet,
+ SwNewDBMgr* pNewDBMgr, BOOL bLabel);
+ ~SwLabDlg();
+
+ SwLabRec* GetRecord(const String &rRecName, BOOL bCont);
+ void GetLabItem(SwLabItem &rItem);
+
+ SwLabRecs &Recs() { return *pRecs; }
+ const SwLabRecs &Recs() const { return *pRecs; }
+
+ SvUShorts &TypeIds() { return aTypeIds; }
+ const SvUShorts &TypeIds() const { return aTypeIds; }
+
+ SvStringsDtor &Makes() { return aMakes; }
+ const SvStringsDtor &Makes() const { return aMakes; }
+
+ Printer *GetPrt();
+ inline void ReplaceGroup( const String &rMake );
+ void UpdateGroup( const String &rMake ) {_ReplaceGroup( rMake );}
+ static void UpdateFieldInformation(::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>& xModel,
+ const SwLabItem& rItem);
+ const String& GetBusinessCardStr() const {return sBusinessCardDlg;}
+
+ SwLabelConfig& GetLabelsConfig() {return aLabelsCfg;}
+
+};
+
+inline void SwLabDlg::ReplaceGroup( const String &rMake )
+{
+ if ( rMake != aLstGroup )
+ _ReplaceGroup( rMake );
+}
+
+#endif
+
diff --git a/sw/source/ui/inc/labelcfg.hxx b/sw/source/ui/inc/labelcfg.hxx
new file mode 100644
index 000000000000..ab01d365bbe1
--- /dev/null
+++ b/sw/source/ui/inc/labelcfg.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _LABELCFG_HXX
+#define _LABELCFG_HXX
+
+#include <unotools/configitem.hxx>
+#include "swdllapi.h"
+
+class SwLabRecs;
+class SwLabRec;
+
+class SW_DLLPUBLIC SwLabelConfig : public utl::ConfigItem
+{
+ com::sun::star::uno::Sequence<rtl::OUString> aNodeNames;
+
+ SW_DLLPRIVATE com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
+
+public:
+ SwLabelConfig();
+ virtual ~SwLabelConfig();
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+
+ void FillLabels(const rtl::OUString& rManufacturer, SwLabRecs& rLabArr);
+ const com::sun::star::uno::Sequence<rtl::OUString>&
+ GetManufacturers() const {return aNodeNames;}
+
+ sal_Bool HasLabel(const rtl::OUString& rManufacturer, const rtl::OUString& rType);
+ void SaveLabel(const rtl::OUString& rManufacturer, const rtl::OUString& rType,
+ const SwLabRec& rRec);
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/labimg.hxx b/sw/source/ui/inc/labimg.hxx
new file mode 100644
index 000000000000..cb435bd38925
--- /dev/null
+++ b/sw/source/ui/inc/labimg.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _LABIMG_HXX
+#define _LABIMG_HXX
+
+#include <svl/poolitem.hxx>
+#include <unotools/configitem.hxx>
+#include "swdllapi.h"
+
+// class SwLabItem ----------------------------------------------------------
+
+class SwLabCfgItem;
+class SW_DLLPUBLIC SwLabItem : public SfxPoolItem
+{
+
+public:
+
+ SwLabItem();
+ SwLabItem(const SwLabItem& rItem);
+
+ SwLabItem& operator =(const SwLabItem& rItem);
+
+ virtual int operator ==(const SfxPoolItem& rItem) const;
+
+ virtual SfxPoolItem* Clone(SfxItemPool* = 0) const;
+
+ rtl::OUString aLstMake; //Letzte Auswahl merken.
+ rtl::OUString aLstType;
+ rtl::OUString sDBName; // Verwendete Datenbank
+
+ rtl::OUString aWriting; // Aufschrift
+ rtl::OUString aMake; // Etikettenmarke
+ rtl::OUString aType; // Etikettentyp
+ rtl::OUString aBin; // Druckerschacht
+ sal_Int32 lHDist; // Horizontaler Abstand (Benutzer)
+ sal_Int32 lVDist; // Vertikaler Abstand (Benutzer)
+ sal_Int32 lWidth; // Breite (Benutzer)
+ sal_Int32 lHeight; // Hoehe (Benutzer)
+ sal_Int32 lLeft; // Rand links (Benutzer)
+ sal_Int32 lUpper; // Rand oben (Benutzer)
+ sal_Int32 nCols; // Anzahl Spalten (Benutzer)
+ sal_Int32 nRows; // Anzahl Zeilen (Benutzer)
+ sal_Int32 nCol; // Spalte fuer Einzeldruck
+ sal_Int32 nRow; // Zeile fuer Einzeldruck
+ sal_Bool bAddr;// Adresse als Aufschrift?
+ sal_Bool bCont;// Endlospapier?
+ sal_Bool bPage;// Ganze Seite oder einzelnes Etikett?
+ sal_Bool bSynchron;// Alle Etiketten synchronisieren
+
+ //parts of the business card
+ rtl::OUString aPrivFirstName;
+ rtl::OUString aPrivName;
+ rtl::OUString aPrivShortCut;
+ rtl::OUString aPrivFirstName2;
+ rtl::OUString aPrivName2;
+ rtl::OUString aPrivShortCut2;
+ rtl::OUString aPrivStreet;
+ rtl::OUString aPrivZip;
+ rtl::OUString aPrivCity;
+ rtl::OUString aPrivCountry;
+ rtl::OUString aPrivState;
+ rtl::OUString aPrivTitle;
+ rtl::OUString aPrivProfession;
+ rtl::OUString aPrivPhone;
+ rtl::OUString aPrivMobile;
+ rtl::OUString aPrivFax;
+ rtl::OUString aPrivWWW;
+ rtl::OUString aPrivMail;
+ rtl::OUString aCompCompany;
+ rtl::OUString aCompCompanyExt;
+ rtl::OUString aCompSlogan;
+ rtl::OUString aCompStreet;
+ rtl::OUString aCompZip;
+ rtl::OUString aCompCity;
+ rtl::OUString aCompCountry;
+ rtl::OUString aCompState;
+ rtl::OUString aCompPosition;
+ rtl::OUString aCompPhone;
+ rtl::OUString aCompMobile;
+ rtl::OUString aCompFax;
+ rtl::OUString aCompWWW;
+ rtl::OUString aCompMail;
+
+ rtl::OUString sGlossaryGroup;
+ rtl::OUString sGlossaryBlockName;
+};
+
+// class SwLabCfgItem -------------------------------------------------------
+
+class SwLabCfgItem : public utl::ConfigItem
+{
+ SwLabItem aItem;
+ sal_Bool bIsLabel;
+
+ com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
+public:
+ SwLabCfgItem(sal_Bool bLabel);
+
+ SwLabItem& GetItem() {return aItem;}
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/langhelper.hxx b/sw/source/ui/inc/langhelper.hxx
new file mode 100755
index 000000000000..3ff795d83f56
--- /dev/null
+++ b/sw/source/ui/inc/langhelper.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWLANGHELPER_HXX
+#define _SWLANGHELPER_HXX
+
+class SwWrtShell;
+class SwView;
+class EditEngine;
+class EditView;
+class OutlinerView;
+class SfxItemSet;
+struct ESelection;
+
+namespace SwLangHelper
+{
+ extern USHORT GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet );
+ extern bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView &rView, SwWrtShell &rSh );
+
+ extern void SetLanguage( SwWrtShell &rWrtSh, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet );
+// extern void SetLanguage( SwWrtShell &rWrtSh, EditEngine* pEditEngine, ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet );
+ extern void SetLanguage( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet );
+ extern void SetLanguage_None( SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet );
+// extern void SetLanguage_None( SwWrtShell &rWrtSh, EditEngine* pEditEngine, ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet );
+ extern void SetLanguage_None( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet );
+ extern void ResetLanguages( SwWrtShell &rWrtSh, bool bIsForSelection );
+// extern void ResetLanguages( SwWrtShell &rWrtSh, EditEngine* pEditEngine, ESelection aSelection, bool bIsForSelection );
+ extern void ResetLanguages( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection );
+
+ // document
+ extern void SelectCurrentPara( SwWrtShell &rWrtSh );
+ // EditView
+ extern void SelectPara( EditView &rEditView, const ESelection &rCurSel );
+
+ extern String GetTextForLanguageGuessing( EditEngine* rEditEngine, ESelection aDocSelection );
+ extern String GetTextForLanguageGuessing( SwWrtShell &rSh );
+
+ extern LanguageType GetLanguage( SfxItemSet aSet, USHORT nLangWhichId );
+ extern LanguageType GetLanguage( SwWrtShell &rSh, USHORT nLangWhichId );
+
+ extern LanguageType GetCurrentLanguage( SfxItemSet aSet, USHORT nScriptType );
+ extern LanguageType GetCurrentLanguage( SwWrtShell &rSh );
+}
+
+#endif
diff --git a/sw/source/ui/inc/linenum.hxx b/sw/source/ui/inc/linenum.hxx
new file mode 100644
index 000000000000..62da2e1925ef
--- /dev/null
+++ b/sw/source/ui/inc/linenum.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWLINENUM_HXX
+#define _SWLINENUM_HXX
+
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#include <numberingtypelistbox.hxx>
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+class Window;
+class SfxItemSet;
+class SwView;
+class SwWrtShell;
+
+/*--------------------------------------------------------------------
+ Beschreibung: SingleTabDialog
+ --------------------------------------------------------------------*/
+
+class SwLineNumberingDlg : public SfxSingleTabDialog
+{
+ SwWrtShell* pSh;
+
+ DECL_LINK( OKHdl, Button * );
+
+public:
+ inline SwWrtShell* GetWrtShell() const { return pSh; }
+
+ SwLineNumberingDlg(SwView *pVw);
+ ~SwLineNumberingDlg();
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: TabPage
+ --------------------------------------------------------------------*/
+
+class SwLineNumberingPage : public SfxTabPage
+{
+ CheckBox aNumberingOnCB;
+ FixedText aCharStyleFT;
+ ListBox aCharStyleLB;
+ FixedText aFormatFT;
+ SwNumberingTypeListBox aFormatLB;
+ FixedText aPosFT;
+ ListBox aPosLB;
+ FixedText aOffsetFT;
+ MetricField aOffsetMF;
+ FixedText aNumIntervalFT;
+ NumericField aNumIntervalNF;
+ FixedText aNumRowsFT;
+ FixedLine aDisplayFL;
+ FixedText aDivisorFT;
+ Edit aDivisorED;
+ FixedText aDivIntervalFT;
+ NumericField aDivIntervalNF;
+ FixedText aDivRowsFT;
+ FixedLine aDivisorFL;
+ CheckBox aCountEmptyLinesCB;
+ CheckBox aCountFrameLinesCB;
+ CheckBox aRestartEachPageCB;
+ FixedLine aCountFL;
+
+ SwWrtShell* pSh;
+
+ SwLineNumberingPage( Window* pParent, const SfxItemSet& rSet );
+ ~SwLineNumberingPage();
+
+ DECL_LINK( LineOnOffHdl, CheckBox *pCB = 0 );
+ DECL_LINK( ModifyHdl, Edit *pED = 0 );
+
+public:
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+#endif
+
+
diff --git a/sw/source/ui/inc/listsh.hxx b/sw/source/ui/inc/listsh.hxx
new file mode 100644
index 000000000000..61fea6ece214
--- /dev/null
+++ b/sw/source/ui/inc/listsh.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWLISTSH_HXX
+#define _SWLISTSH_HXX
+
+#include "basesh.hxx"
+
+class SwListShell: public SwBaseShell
+{
+public:
+ SFX_DECL_INTERFACE(SW_LISTSHELL)
+ TYPEINFO();
+
+ SwListShell(SwView &rView);
+
+ void Execute(SfxRequest &);
+ void GetState(SfxItemSet &);
+};
+
+#endif
diff --git a/sw/source/ui/inc/macassgn.hxx b/sw/source/ui/inc/macassgn.hxx
new file mode 100644
index 000000000000..6093a2a8cb51
--- /dev/null
+++ b/sw/source/ui/inc/macassgn.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MACASSGN_HXX
+#define _MACASSGN_HXX
+
+#include <sfx2/evntconf.hxx>
+
+class SwWrtShell;
+class SvxMacroItem;
+
+enum DlgEventType
+{
+ MACASSGN_TEXTBAUST,
+ MACASSGN_GRAPHIC,
+ MACASSGN_OLE,
+ MACASSGN_FRMURL,
+ MACASSGN_INETFMT,
+ MACASSGN_ALLFRM
+};
+
+class SwMacroAssignDlg
+{
+public:
+ static SfxEventNamesItem AddEvents( DlgEventType eType );
+ static BOOL INetFmtDlg( Window* pParent, SwWrtShell& rSh,
+ SvxMacroItem*& rpINetItem );
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/mailconfigpage.hxx b/sw/source/ui/inc/mailconfigpage.hxx
new file mode 100644
index 000000000000..e2717ebb17fa
--- /dev/null
+++ b/sw/source/ui/inc/mailconfigpage.hxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILCONFIGPAGE_HXX
+#define _MAILCONFIGPAGE_HXX
+
+#include <sfx2/tabdlg.hxx>
+#ifndef _BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#ifndef _LSTBOX_HXX
+#include <vcl/lstbox.hxx>
+#endif
+#ifndef _FIELD_HXX
+#include <vcl/field.hxx>
+#endif
+#ifndef _FIXED_HXX
+#include <vcl/fixed.hxx>
+#endif
+#include <sfx2/basedlgs.hxx>
+
+class SwTestAccountSettingsDialog;
+class SwMailMergeConfigItem;
+/*-- 05.05.2004 16:45:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailConfigPage : public SfxTabPage
+{
+ friend class SwTestAccountSettingsDialog;
+
+ FixedLine m_aIdentityFL;
+
+ FixedText m_aDisplayNameFT;
+ Edit m_aDisplayNameED;
+ FixedText m_aAddressFT;
+ Edit m_aAddressED;
+
+ CheckBox m_aReplyToCB;
+ FixedText m_aReplyToFT;
+ Edit m_aReplyToED;
+
+ FixedLine m_aSMTPFL;
+
+ FixedText m_aServerFT;
+ Edit m_aServerED;
+ FixedText m_aPortFT;
+ NumericField m_aPortNF;
+
+ CheckBox m_aSecureCB;
+
+ PushButton m_aServerAuthenticationPB;
+
+ FixedLine m_aSeparatorFL;
+ PushButton m_aTestPB;
+
+ SwMailMergeConfigItem* m_pConfigItem;
+
+ DECL_LINK(ReplyToHdl, CheckBox*);
+ DECL_LINK(AuthenticationHdl, PushButton*);
+ DECL_LINK(TestHdl, PushButton*);
+
+
+public:
+ SwMailConfigPage( Window* pParent, const SfxItemSet& rSet );
+ ~SwMailConfigPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+};
+
+/*-- 18.08.2004 12:02:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailConfigDlg : public SfxSingleTabDialog
+{
+public:
+
+ SwMailConfigDlg( Window* pParent, SfxItemSet& rSet );
+ ~SwMailConfigDlg();
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/maildispatcher.hxx b/sw/source/ui/inc/maildispatcher.hxx
new file mode 100644
index 000000000000..bc8afb829fdf
--- /dev/null
+++ b/sw/source/ui/inc/maildispatcher.hxx
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_MAILDISPATCHER_HXX
+#define INCLUDED_MAILDISPATCHER_HXX
+
+//#ifndef _COM_SUN_STAR_MAIL_XMAILSERVER_HPP_
+//#include "com/sun/star/mail/XMailServer.hpp"
+//#endif
+#include "com/sun/star/mail/XSmtpService.hpp"
+#include "com/sun/star/mail/XMailMessage.hpp"
+#include <osl/thread.hxx>
+#include <osl/conditn.hxx>
+#include <salhelper/refobj.hxx>
+
+#include <list>
+
+class IMailDispatcherListener;
+
+/**
+ A MailDispatcher should be used for sending a bunch a mail messages
+ asynchronously. Usually a client enqueues a number of mail messages
+ and then calls start to begin sending them. An instance of this class
+ must not be shared among different client threads. Instead each client
+ thread should create an own instance of this class.
+*/
+class MailDispatcher : public ::salhelper::ReferenceObject, private ::osl::Thread
+{
+public:
+ // bringing operator new/delete into scope
+ using osl::Thread::operator new;
+ using osl::Thread::operator delete;
+ using osl::Thread::join;
+
+public:
+
+ /**
+ @param xSmtpService
+ [in] a reference to a mail server. A user must be
+ connected to the mail server otherwise errors occur
+ during the delivery of mail messages.
+
+ @throws ::com::sun::star::uno::RuntimeException
+ on errors during construction of an instance of this class.
+ */
+ MailDispatcher(::com::sun::star::uno::Reference< ::com::sun::star::mail::XSmtpService> xMailService);
+
+ /**
+ Shutdown the mail dispatcher. Every mail messages
+ not yet sent will be discarded.
+ */
+ virtual ~MailDispatcher();
+
+ /**
+ Enqueue a mail message for delivery. A client must
+ start the mail dispatcher in order to send the
+ enqueued mail messages.
+
+ @param xMailMessage
+ [in] a mail message that should be send.
+ */
+ void enqueueMailMessage(::com::sun::star::uno::Reference< ::com::sun::star::mail::XMailMessage> xMailMessage);
+ /**
+ Dequeues a mail message.
+ This enables the caller to remove attachments when sending mails is to be cancelled.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::mail::XMailMessage> dequeueMailMessage();
+
+ /**
+ Start sending mail messages asynchronously. A client may register
+ a listener for mail dispatcher events. For every mail message sent
+ the notification will be sent. While handling such notification a
+ client may enqueue new mail messages. If there are no more mail
+ messages to send an respective notification is sent and the mail
+ dispatcher waits for more mail messages.
+
+ @precond not isStarted()
+ */
+ void start();
+
+ /**
+ Stop sending mail messages.
+
+ @precond isStarted()
+ */
+ void stop();
+
+ /**
+ Request shutdown of the mail dispatcher thread.
+ NOTE: You must call this method before you release
+ your last reference to this class otherwise the
+ mail dispatcher thread will never end.
+ */
+ void shutdown();
+
+ /**
+ Check whether the mail dispatcher is started or not.
+
+ @return
+ <TRUE/> if the sending thread is running.
+ */
+ bool isStarted() const;
+
+ /** returns if the thread is still running
+ */
+ using osl::Thread::isRunning;
+
+ /** returns if shutdown has already been called
+ */
+ bool isShutdownRequested() const
+ { return shutdown_requested_; }
+ /**
+ Register a listener for mail dispatcher events.
+ */
+ void addListener(::rtl::Reference<IMailDispatcherListener> listener);
+
+ /**
+ Unregister a listener for mail dispatcher events
+ */
+ void removeListener(::rtl::Reference<IMailDispatcherListener> listener);
+
+protected:
+ virtual void SAL_CALL run();
+ virtual void SAL_CALL onTerminated();
+
+private:
+ std::list< ::rtl::Reference<IMailDispatcherListener> > cloneListener();
+ void sendMailMessageNotifyListener(::com::sun::star::uno::Reference< ::com::sun::star::mail::XMailMessage> message);
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::mail::XSmtpService> mailserver_;
+ ::std::list< ::com::sun::star::uno::Reference< ::com::sun::star::mail::XMailMessage > > messages_;
+ ::std::list< ::rtl::Reference<IMailDispatcherListener> > listeners_;
+ ::osl::Mutex message_container_mutex_;
+ ::osl::Mutex listener_container_mutex_;
+ ::osl::Mutex thread_status_mutex_;
+ ::osl::Condition mail_dispatcher_active_;
+ ::osl::Condition wakening_call_;
+ ::rtl::Reference<MailDispatcher> m_xSelfReference;
+ bool run_;
+ bool shutdown_requested_;
+};
+
+#endif // INCLUDED_MAILDISPATCHER_HXX
diff --git a/sw/source/ui/inc/mailmergechildwindow.hxx b/sw/source/ui/inc/mailmergechildwindow.hxx
new file mode 100644
index 000000000000..21afff7aa8bb
--- /dev/null
+++ b/sw/source/ui/inc/mailmergechildwindow.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWMAILMERGECHILDWINDOW_HXX
+#define _SWMAILMERGECHILDWINDOW_HXX
+#include <sfx2/childwin.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <vcl/toolbox.hxx>
+#include "swdllapi.h"
+
+/*-- 25.05.2004 15:25:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailMergeChildWin : public SfxFloatingWindow
+{
+ ToolBox m_aBackTB;
+
+ DECL_LINK( BackHdl, ToolBox* );
+
+public:
+ SwMailMergeChildWin(SfxBindings*, SfxChildWindow*, Window *pParent);
+ ~SwMailMergeChildWin();
+
+ virtual void FillInfo(SfxChildWinInfo&) const;
+};
+
+/*-- 25.05.2004 15:25:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwSendMailDialog;
+class SwMailMergeChildWindow : public SfxChildWindow
+{
+public:
+ SwMailMergeChildWindow( Window* ,
+ USHORT nId,
+ SfxBindings*,
+ SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW( SwMailMergeChildWindow );
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/mailmergehelper.hxx b/sw/source/ui/inc/mailmergehelper.hxx
new file mode 100644
index 000000000000..954ce643d8e9
--- /dev/null
+++ b/sw/source/ui/inc/mailmergehelper.hxx
@@ -0,0 +1,349 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEHELPER_HXX
+#define _MAILMERGEHELPER_HXX
+
+#include <svtools/stdctrl.hxx>
+#include <unotools/configitem.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include "com/sun/star/mail/XAuthenticator.hpp"
+#include "com/sun/star/mail/XConnectionListener.hpp"
+#include "com/sun/star/uno/XCurrentContext.hpp"
+#include "com/sun/star/mail/XMailMessage.hpp"
+#include "com/sun/star/datatransfer/XTransferable.hpp"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <vcl/scrbar.hxx>
+#include "swdllapi.h"
+
+
+class SwMailMergeConfigItem;
+namespace com{ namespace sun{ namespace star{
+ namespace uno{
+ class XComponentContext;
+ }
+ namespace lang{
+ class XMultiServiceFactory;
+ }
+ namespace mail{
+ class XSmtpService;
+ class XMailService;
+ }
+}}}
+/*-- 14.06.2004 12:27:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+namespace SwMailMergeHelper
+{
+ SW_DLLPUBLIC String CallSaveAsDialog(String& rFilter);
+ SW_DLLPUBLIC bool CheckMailAddress( const ::rtl::OUString& rMailAddress );
+ SW_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::mail::XSmtpService >
+ ConnectToSmtpServer( SwMailMergeConfigItem& rConfigItem,
+ com::sun::star::uno::Reference< com::sun::star::mail::XMailService >& xInMailService,
+ const String& rInMailServerPassword,
+ const String& rOutMailServerPassword,
+ Window* pDialogParentWindow = 0 );
+}
+/* -----------------06.04.2004 10:29-----------------
+
+ --------------------------------------------------*/
+class SW_DLLPUBLIC SwBoldFixedInfo : public FixedInfo
+{
+public:
+ SwBoldFixedInfo(Window* pParent, const ResId& rResId);
+ ~SwBoldFixedInfo();
+};
+struct SwAddressPreview_Impl;
+namespace com{namespace sun{namespace star{
+ namespace container{
+ class XNameAccess;
+ }
+}}}
+
+/*-- 27.04.2004 13:20:00---------------------------------------------------
+ Preview window used to show the possible selection of address blocks
+ and also the resulting address filled with database data
+ -----------------------------------------------------------------------*/
+class SW_DLLPUBLIC SwAddressPreview : public Window
+{
+ ScrollBar aVScrollBar;
+ SwAddressPreview_Impl* pImpl;
+ Link m_aSelectHdl;
+
+ void DrawText_Impl( const ::rtl::OUString& rAddress, const Point& rTopLeft, const Size& rSize, bool bIsSelected);
+
+ virtual void Paint(const Rectangle&);
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void StateChanged( StateChangedType nStateChange );
+ void UpdateScrollBar();
+
+ DECL_LINK(ScrollHdl, ScrollBar*);
+
+public:
+ SwAddressPreview(Window* pParent, const ResId rResId);
+ ~SwAddressPreview();
+
+ /** The address string is a list of address elements separated by spaces
+ and breaks. The addresses fit into the given layout. If more addresses then
+ rows/columns should be used a scrollbar will be added.
+
+ AddAddress appends the new address to the already added ones.
+ Initially the first added address will be selected
+ */
+ void AddAddress(const ::rtl::OUString& rAddress);
+ // for preview mode - replaces the currently used address by the given one
+ void SetAddress(const ::rtl::OUString& rAddress);
+ // removes all addresses
+ void Clear();
+
+ // returns the selected address
+ sal_uInt16 GetSelectedAddress() const;
+ void SelectAddress(sal_uInt16 nSelect);
+ void ReplaceSelectedAddress(const ::rtl::OUString&);
+ void RemoveSelectedAddress();
+
+ // set the number of rows and columns of addresses
+ void SetLayout(sal_uInt16 nRows, sal_uInt16 nColumns);
+ void EnableScrollBar(bool bEnable = true);
+
+ // fill the actual data into a string (address block or greeting)
+ static String FillData(
+ const ::rtl::OUString& rAddress,
+ SwMailMergeConfigItem& rConfigItem,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString>* pAssignments = 0);
+
+ void SetSelectHdl (const Link& rLink) {m_aSelectHdl = rLink;}
+};
+
+/*-- 11.05.2004 15:39:59---------------------------------------------------
+ iterate over an address block or a greeting line
+ the iterator returns the parts either as pure string
+ or as column
+ -----------------------------------------------------------------------*/
+struct SwMergeAddressItem
+{
+ String sText;
+ bool bIsColumn;
+ bool bIsReturn;
+ SwMergeAddressItem() :
+ bIsColumn(false),
+ bIsReturn(false) {}
+};
+class SW_DLLPUBLIC SwAddressIterator
+{
+ String sAddress;
+public:
+ SwAddressIterator(const String& rAddress) :
+ sAddress(rAddress){}
+
+ SwMergeAddressItem Next();
+ bool HasMore() const{return sAddress.Len() > 0;}
+};
+
+/*-- 21.05.2004 10:31:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SW_DLLPUBLIC SwAuthenticator :
+ public cppu::WeakImplHelper1< ::com::sun::star::mail::XAuthenticator>
+{
+ ::rtl::OUString m_aUserName;
+ ::rtl::OUString m_aPassword;
+ Window* m_pParentWindow;
+public:
+ SwAuthenticator() : m_pParentWindow(0) {}
+ SwAuthenticator(const ::rtl::OUString& username, const ::rtl::OUString& password, Window* pParent) :
+ m_aUserName(username),
+ m_aPassword(password),
+ m_pParentWindow( pParent )
+ {}
+ ~SwAuthenticator();
+
+ virtual ::rtl::OUString SAL_CALL getUserName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getPassword( ) throw (::com::sun::star::uno::RuntimeException);
+
+};
+/*-- 25.08.2004 12:48:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SW_DLLPUBLIC SwConnectionContext :
+ public cppu::WeakImplHelper1< ::com::sun::star::uno::XCurrentContext >
+{
+ ::rtl::OUString m_sMailServer;
+ sal_Int16 m_nPort;
+ ::rtl::OUString m_sConnectionType;
+
+public:
+ SwConnectionContext(const ::rtl::OUString& rMailServer, sal_Int16 nPort, const ::rtl::OUString& rConnectionType);
+ ~SwConnectionContext();
+
+ virtual ::com::sun::star::uno::Any SAL_CALL getValueByName( const ::rtl::OUString& Name )
+ throw (::com::sun::star::uno::RuntimeException);
+};
+/*-- 21.05.2004 10:39:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMutexBase
+{
+public:
+ osl::Mutex m_aMutex;
+};
+/*-- 21.05.2004 10:39:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SW_DLLPUBLIC SwConnectionListener :
+ public SwMutexBase,
+ public cppu::WeakComponentImplHelper1< ::com::sun::star::mail::XConnectionListener >
+{
+ using cppu::WeakComponentImplHelperBase::disposing;
+
+public:
+ SwConnectionListener() :
+ cppu::WeakComponentImplHelper1< ::com::sun::star::mail::XConnectionListener>(m_aMutex)
+ {}
+ ~SwConnectionListener();
+
+ virtual void SAL_CALL connected(const ::com::sun::star::lang::EventObject& aEvent)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL disconnected(const ::com::sun::star::lang::EventObject& aEvent)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL disposing(const com::sun::star::lang::EventObject& aEvent)
+ throw(com::sun::star::uno::RuntimeException);
+};
+
+/*-- 13.07.2004 09:02:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailTransferable :
+ public SwMutexBase,
+ public cppu::WeakComponentImplHelper2
+ <
+ ::com::sun::star::datatransfer::XTransferable,
+ ::com::sun::star::beans::XPropertySet
+ >
+{
+ rtl::OUString m_aMimeType;
+ rtl::OUString m_sBody;
+ rtl::OUString m_aURL;
+ rtl::OUString m_aName;
+ bool m_bIsBody;
+
+ public:
+ SwMailTransferable(const rtl::OUString& rURL, const rtl::OUString& rName, const rtl::OUString& rMimeType);
+ SwMailTransferable(const rtl::OUString& rBody, const rtl::OUString& rMimeType);
+ ~SwMailTransferable();
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
+ throw (::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL
+ getTransferDataFlavors( )
+ throw (::com::sun::star::uno::RuntimeException) ;
+ virtual ::sal_Bool SAL_CALL
+ isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+};
+
+/*-- 22.06.2004 16:38:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+class SwMailMessage :
+ public SwMutexBase,
+ public cppu::WeakComponentImplHelper1< ::com::sun::star::mail::XMailMessage >
+{
+ ::rtl::OUString m_sSenderName;
+ ::rtl::OUString m_sSenderAddress;
+ ::rtl::OUString m_sReplyToAddress;
+ ::rtl::OUString m_sSubject;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable> m_xBody;
+// ::com::sun::star::mail::MailMessageBody m_aBody;
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aRecipients;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aCcRecipients;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aBccRecipients;
+// ::com::sun::star::uno::Sequence< ::com::sun::star::mail::MailAttachmentDescriptor > m_aAttachments;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::mail::MailAttachment > m_aAttachments;
+public:
+ SwMailMessage();
+ ~SwMailMessage();
+
+ // Attributes
+ virtual ::rtl::OUString SAL_CALL getSenderName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSenderAddress() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getReplyToAddress() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setReplyToAddress( const ::rtl::OUString& _replytoaddress ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSubject() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSubject( const ::rtl::OUString& _subject ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL
+ getBody()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setBody( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& _body )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // Methods
+ virtual void SAL_CALL addRecipient( const ::rtl::OUString& sRecipientAddress ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addCcRecipient( const ::rtl::OUString& sRecipientAddress ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addBccRecipient( const ::rtl::OUString& sRecipientAddress ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getRecipients( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getCcRecipients( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getBccRecipients( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addAttachment( const ::com::sun::star::mail::MailAttachment& aMailAttachment )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::mail::MailAttachment > SAL_CALL
+ getAttachments( ) throw (::com::sun::star::uno::RuntimeException);
+ void SetSenderName(const ::rtl::OUString& rSenderName)
+ {m_sSenderName = rSenderName;}
+ void SetSenderAddress(const ::rtl::OUString& rSenderAddress)
+ {m_sSenderAddress = rSenderAddress;}
+};
+/*-- 21.05.2004 10:17:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SW_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>
+ getCurrentCmpCtx(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XMultiServiceFactory> rSrvMgr);
+#endif
+
diff --git a/sw/source/ui/inc/mailmergewizard.hxx b/sw/source/ui/inc/mailmergewizard.hxx
new file mode 100644
index 000000000000..7a582693b013
--- /dev/null
+++ b/sw/source/ui/inc/mailmergewizard.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMERGEWIZARD_HXX
+#define _MAILMERGEWIZARD_HXX
+
+#include <svtools/roadmapwizard.hxx>
+
+class SwView;
+class SwMailMergeConfigItem;
+
+#define MM_DOCUMENTSELECTPAGE 0
+#define MM_OUTPUTTYPETPAGE 1
+#define MM_ADDRESSBLOCKPAGE 2
+#define MM_GREETINGSPAGE 3
+#define MM_LAYOUTPAGE 4
+#define MM_PREPAREMERGEPAGE 5
+#define MM_MERGEPAGE 6
+#define MM_OUTPUTPAGE 7
+
+class SwMailMergeWizard : public ::svt::RoadmapWizard
+{
+ SwView* m_pSwView;
+ String sDocumentURL;
+ bool m_bDocumentLoad;
+
+ SwMailMergeConfigItem& m_rConfigItem;
+
+ String m_sStarting;
+ String m_sDocumentType;
+ String m_sAddressBlock;
+ String m_sAddressList;
+ String m_sGreetingsLine;
+ String m_sLayout;
+ String m_sPrepareMerge;
+ String m_sMerge;
+ String m_sOutput;
+ String m_sFinish;
+
+ sal_uInt16 m_nRestartPage;
+
+ using svt::OWizardMachine::skipUntil;
+
+protected:
+ virtual svt::OWizardPage* createPage(WizardState _nState);
+ virtual void enterState( WizardState _nState );
+
+// roadmap feature ??
+// virtual sal_Bool prepareLeaveCurrentState( CommitPageReason _eReason );
+ virtual String getStateDisplayName( WizardState _nState ) const;
+
+public:
+ SwMailMergeWizard(SwView& rView, SwMailMergeConfigItem& rConfigItem);
+ ~SwMailMergeWizard();
+
+ SwView* GetSwView() {return m_pSwView;}
+ SwMailMergeConfigItem& GetConfigItem() { return m_rConfigItem;}
+
+ void SetReloadDocument(const String& rURL){sDocumentURL = rURL;}
+ const String& GetReloadDocument() const {return sDocumentURL;}
+
+ //next step requires loading of document
+ void SetDocumentLoad(bool bSet) {m_bDocumentLoad = bSet;}
+
+ void UpdateRoadmap();
+ void CreateTargetDocument();
+
+ sal_uInt16 GetRestartPage() const {return m_nRestartPage;}
+ void SetRestartPage(sal_uInt16 nPage) { m_nRestartPage = nPage;}
+
+ sal_Bool skipUntil( sal_uInt16 nPage)
+ {return ::svt::RoadmapWizard::skipUntil(WizardState(nPage));}
+
+ void updateRoadmapItemLabel( WizardState _nState );
+
+ virtual short Execute();
+ virtual void StartExecuteModal( const Link& rEndDialogHdl );
+};
+#endif
+
diff --git a/sw/source/ui/inc/mailmrge.hxx b/sw/source/ui/inc/mailmrge.hxx
new file mode 100644
index 000000000000..e1f9f355c96a
--- /dev/null
+++ b/sw/source/ui/inc/mailmrge.hxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MAILMRGE_HXX
+#define _MAILMRGE_HXX
+
+#include <svx/stddlg.hxx>
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/uno/Reference.h>
+
+class SwWrtShell;
+class SwModuleOptions;
+class SwXSelChgLstnr_Impl;
+struct SwMailMergeDlg_Impl;
+namespace com{namespace sun{namespace star{
+ namespace frame{
+ class XFrame;
+ }
+ namespace sdbc{
+ class XResultSet;
+ class XConnection;
+ }
+}}}
+
+class SwMailMergeDlg : public SvxStandardDialog
+{
+ friend class SwXSelChgLstnr_Impl;
+
+ Window* pBeamerWin;
+
+ RadioButton aAllRB;
+ RadioButton aMarkedRB;
+ RadioButton aFromRB;
+ NumericField aFromNF;
+ FixedText aBisFT;
+ NumericField aToNF;
+ FixedLine aRecordFL;
+
+ FixedLine aSeparatorFL;
+
+ RadioButton aPrinterRB;
+ RadioButton aMailingRB;
+ RadioButton aFileRB;
+
+ CheckBox aSingleJobsCB;
+
+ FixedLine aSaveMergedDocumentFL;
+ RadioButton aSaveSingleDocRB;
+ RadioButton aSaveIndividualRB;
+
+ CheckBox aGenerateFromDataBaseCB;
+
+ FixedText aColumnFT;
+ ListBox aColumnLB;
+ FixedText aPathFT;
+ Edit aPathED;
+ PushButton aPathPB;
+ FixedText aFilterFT;
+ ListBox aFilterLB;
+
+ ListBox aAddressFldLB;
+ FixedText aSubjectFT;
+ Edit aSubjectED;
+ FixedText aFormatFT;
+ FixedText aAttachFT;
+ Edit aAttachED;
+ PushButton aAttachPB;
+ CheckBox aFormatHtmlCB;
+ CheckBox aFormatRtfCB;
+ CheckBox aFormatSwCB;
+ FixedLine aDestFL;
+
+ FixedLine aBottomSeparatorFL;
+
+ OKButton aOkBTN;
+ CancelButton aCancelBTN;
+ HelpButton aHelpBTN;
+
+ SwMailMergeDlg_Impl* pImpl;
+
+ SwWrtShell& rSh;
+ SwModuleOptions* pModOpt;
+ const String& rDBName;
+ const String& rTableName;
+
+ USHORT nMergeType;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_aSelection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame;
+
+ Size m_aDialogSize;
+ ::rtl::OUString m_sSaveFilter;
+
+
+ DECL_LINK( ButtonHdl, Button* pBtn );
+ DECL_LINK( InsertPathHdl, PushButton * );
+ DECL_LINK( AttachFileHdl, PushButton * );
+ DECL_LINK( OutputTypeHdl, RadioButton* pBtn );
+ DECL_LINK( FilenameHdl, CheckBox* pBtn );
+ DECL_LINK( ModifyHdl, NumericField* pLB );
+ DECL_LINK( SaveTypeHdl, RadioButton* pBtn );
+
+ virtual void Apply();
+ virtual void Resize();
+ bool ExecQryShell();
+
+public:
+ SwMailMergeDlg(Window* pParent, SwWrtShell& rSh,
+ const String& rSourceName,
+ const String& rTblName,
+ sal_Int32 nCommandType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& xConnection,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >* pSelection = 0);
+ ~SwMailMergeDlg();
+
+ inline USHORT GetMergeType() { return nMergeType; }
+ const ::rtl::OUString& GetSaveFilter() const {return m_sSaveFilter;}
+ inline const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > GetSelection() const { return m_aSelection; }
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> GetResultSet() const;
+
+};
+/* -----------------27.11.2002 12:05-----------------
+ *
+ * --------------------------------------------------*/
+class SwMailMergeCreateFromDlg : public ModalDialog
+{
+ FixedLine aCreateFromFL;
+ RadioButton aThisDocRB;
+ RadioButton aUseTemplateRB;
+
+ OKButton aOK;
+ CancelButton aCancel;
+ HelpButton aHelp;
+public:
+ SwMailMergeCreateFromDlg(Window* pParent);
+ ~SwMailMergeCreateFromDlg();
+
+ BOOL IsThisDocument() const {return aThisDocRB.IsChecked();}
+};
+/* -----------------04.02.2003 13:41-----------------
+ *
+ * --------------------------------------------------*/
+class SwMailMergeFieldConnectionsDlg : public ModalDialog
+{
+ FixedLine aConnectionsFL;
+ RadioButton aUseExistingRB;
+ RadioButton aCreateNewRB;
+
+ FixedInfo aInfoFI;
+
+ OKButton aOK;
+ CancelButton aCancel;
+ HelpButton aHelp;
+public:
+ SwMailMergeFieldConnectionsDlg(Window* pParent);
+ ~SwMailMergeFieldConnectionsDlg();
+
+ BOOL IsUseExistingConnections() const {return aUseExistingRB.IsChecked();}
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/mediash.hxx b/sw/source/ui/inc/mediash.hxx
new file mode 100644
index 000000000000..035c03656119
--- /dev/null
+++ b/sw/source/ui/inc/mediash.hxx
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWMEDIASH_HXX
+#define _SWMEDIASH_HXX
+
+#include "frmsh.hxx"
+
+class SwMediaShell: public SwBaseShell
+{
+public:
+ SFX_DECL_INTERFACE(SW_MEDIASHELL)
+
+ void ExecMedia(SfxRequest &);
+ void GetMediaState(SfxItemSet &);
+
+ SwMediaShell(SwView &rView);
+};
+
+#endif
diff --git a/sw/source/ui/inc/mergetbl.hxx b/sw/source/ui/inc/mergetbl.hxx
new file mode 100644
index 000000000000..44916f5d3b1d
--- /dev/null
+++ b/sw/source/ui/inc/mergetbl.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MERGETBL_HXX
+#define _MERGETBL_HXX
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <svx/stddlg.hxx>
+
+
+class SwMergeTblDlg : public SvxStandardDialog
+{
+ OKButton aOKPB;
+ CancelButton aCancelPB;
+ HelpButton aHelpPB;
+ FixedLine aMergeFL;
+ RadioButton aMergePrevRB;
+ RadioButton aMergeNextRB;
+
+ BOOL& rMergePrev;
+protected:
+ virtual void Apply();
+
+public:
+ SwMergeTblDlg( Window *pParent, BOOL& rWithPrev );
+};
+
+#endif
+
+
diff --git a/sw/source/ui/inc/misc.hrc b/sw/source/ui/inc/misc.hrc
new file mode 100644
index 000000000000..f7c7cfcde9a0
--- /dev/null
+++ b/sw/source/ui/inc/misc.hrc
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _MISC_HRC
+#define _MISC_HRC
+
+#include "rcid.hrc"
+
+#define DLG_QUERY_DELETE (RC_MISC_BEGIN + 2)
+
+#define DLG_MASTERDOC_PAGE (RC_MISC_BEGIN + 3)
+#define DLG_QUERY_ADD (RC_MISC_BEGIN + 4)
+
+#define STR_GLOSSARY_BIB_DLG (RC_MISC_BEGIN + 5)
+#define STR_DOCUMENT_BIB_DLG (RC_MISC_BEGIN + 6)
+
+#define WIN_GLOBAL_DOC (RC_MISC_BEGIN + 7)
+#define DLG_GLOBAL_DOC_OPTION (RC_MISC_BEGIN + 8)
+#define DLG_NUMBERING (RC_MISC_BEGIN + 9)
+#define DLG_ZOOM (RC_MISC_BEGIN + 10)
+#define DLG_GLOSSARY (RC_MISC_BEGIN + 11)
+#define DLG_INS_FOOTNOTE (RC_MISC_BEGIN + 12)
+#define DLG_DOC_FOOTNOTE (RC_MISC_BEGIN + 13)
+#define DLG_PG_FOOTNOTE (RC_MISC_BEGIN + 14)
+#define DLG_NUMBERING_OUTLINE (RC_MISC_BEGIN + 15)
+#define DLG_BIB_BASE (RC_MISC_BEGIN + 16)
+#define DLG_INSERT_BOOKMARK (RC_MISC_BEGIN + 17)
+#define DLG_NUM_NAMES (RC_MISC_BEGIN + 18)
+#define DLG_SORTING (RC_MISC_BEGIN + 19)
+#define DLG_CHARMAP (RC_MISC_BEGIN + 20)
+#define DLG_AUTOCORR (RC_MISC_BEGIN + 23)
+#define DLG_AUTOFMT_OPT (RC_MISC_BEGIN + 24)
+#define DLG_RENAME_GLOS (RC_MISC_BEGIN + 25)
+#define DLG_AUTOFMT_TAB (RC_MISC_BEGIN + 26)
+#define DLG_PRCNT_SET (RC_MISC_BEGIN + 27)
+#define DLG_INSERT_RULER (RC_MISC_BEGIN + 28)
+#define DLG_REDLINE_ACCEPT (RC_MISC_BEGIN + 29)
+
+#define DLG_TAB_OUTLINE (RC_MISC_BEGIN + 31)
+#define DLG_MOD_REDLINE_ACCEPT (RC_MISC_BEGIN + 32)
+
+
+#define MSG_DOUBLE_SHORTNAME (RC_MISC_BEGIN + 30)
+#define MSG_QUERY_DELETE (RC_MISC_BEGIN + 31)
+#define STR_QUERY_DELETE_GROUP1 (RC_MISC_BEGIN + 32)
+#define STR_QUERY_DELETE_GROUP2 (RC_MISC_BEGIN + 33)
+#define MSG_NO_GLOSSARIES (RC_MISC_BEGIN + 34)
+
+#define MSG_BLOCK_CREATE_ERR (RC_MISC_BEGIN + 40)
+#define MSG_BLOCK_DELETE_ERR (RC_MISC_BEGIN + 41)
+#define MSG_SRTERR (RC_MISC_BEGIN + 42)
+
+#define STR_GLOSSARY (RC_MISC_BEGIN + 43)
+#define STR_CHANGE_START (RC_MISC_BEGIN + 44)
+#define STR_CHANGE_END (RC_MISC_BEGIN + 45)
+#define STR_SAVE_GLOSSARY (RC_MISC_BEGIN + 46)
+
+#define STR_FULLNUMS_START (RC_MISC_BEGIN + 47)
+#define STR_FULLNUMS_1 (STR_FULLNUMS_START )
+#define STR_FULLNUMS_2 (STR_FULLNUMS_START + 1)
+#define STR_FULLNUMS_3 (STR_FULLNUMS_START + 2)
+#define STR_FULLNUMS_4 (STR_FULLNUMS_START + 3)
+#define STR_FULLNUMS_5 (STR_FULLNUMS_START + 4)
+#define STR_FULLNUMS_6 (STR_FULLNUMS_START + 5)
+#define STR_FULLNUMS_7 (STR_FULLNUMS_START + 6)
+#define STR_FULLNUMS_8 (STR_FULLNUMS_START + 7)
+
+#define STR_BULLET_THEME (RC_MISC_BEGIN + 55)
+#define MSG_NO_BULLETS (RC_MISC_BEGIN + 56)
+
+#define STR_NUMRULE_UNKNOWN (RC_MISC_BEGIN + 60)
+#define MN_REDLINE_POPUP (RC_MISC_BEGIN + 61)
+#define STR_REMOVE_WARNING (RC_MISC_BEGIN + 62)
+#define STRRES_NUMTYPES (RC_MISC_BEGIN + 63)
+
+#define MISC_ACT_END STRRES_NUMTYPES
+
+#if MISC_ACT_END > RC_MISC_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#endif // _MISC_HRC
diff --git a/sw/source/ui/inc/mmconfigitem.hxx b/sw/source/ui/inc/mmconfigitem.hxx
new file mode 100644
index 000000000000..33454896627d
--- /dev/null
+++ b/sw/source/ui/inc/mmconfigitem.hxx
@@ -0,0 +1,279 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _MMCONFIGITEM_HXX
+#define _MMCONFIGITEM_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <tools/resary.hxx>
+#include <swdbdata.hxx>
+#include "swdllapi.h"
+#include "sharedconnection.hxx"
+
+namespace com{namespace sun{namespace star{
+ namespace sdbc{
+ class XDataSource;
+ class XConnection;
+ class XResultSet;
+ }
+ namespace sdbcx{
+ class XColumnsSupplier;
+ }
+}}}
+class SwMailMergeConfigItem_Impl;
+class SwView;
+
+/*-- 06.04.2004 10:43:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+struct SwDocMergeInfo
+{
+ long nStartPageInTarget;
+ long nEndPageInTarget;
+ long nDBRow;
+};
+class SW_DLLPUBLIC SwMailMergeConfigItem
+{
+// com::sun::star::uno::Sequence< ::rtl::OUString> m_aSavedDocuments;
+ SwMailMergeConfigItem_Impl* m_pImpl;
+ //session information - not stored in configuration
+ bool m_bAddressInserted;
+ bool m_bMergeDone;
+ bool m_bGreetingInserted;
+ sal_Int32 m_nGreetingMoves;
+ ::rtl::OUString m_rAddressBlockFrame;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> m_aSelection;
+
+ USHORT m_nStartPrint;
+ USHORT m_nEndPrint;
+
+ ::rtl::OUString m_sSelectedPrinter;
+
+ SwView* m_pSourceView;
+ SwView* m_pTargetView;
+public:
+ SwMailMergeConfigItem();
+ ~SwMailMergeConfigItem();
+
+ enum Gender
+ {
+ FEMALE,
+ MALE,
+ NEUTRAL
+ };
+
+ void Commit();
+
+ const ResStringArray& GetDefaultAddressHeaders() const;
+
+ void SetCurrentConnection(
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> xSource,
+ SharedConnection xConnection,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> xColumnsSupplier,
+ const SwDBData& rDBData);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>
+ GetSource();
+
+ SharedConnection GetConnection();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier>
+ GetColumnsSupplier();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>
+ GetResultSet() const;
+
+ void DisposeResultSet();
+
+ ::rtl::OUString& GetFilter() const;
+ void SetFilter(::rtl::OUString&);
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>
+ GetSelection()const;
+ void SetSelection(::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > rSelection);
+
+ void SetCurrentDBData( const SwDBData& rDBData);
+ const SwDBData& GetCurrentDBData() const;
+
+ // move absolute, nTarget == -1 -> goto last record
+ sal_Int32 MoveResultSet(sal_Int32 nTarget);
+ sal_Int32 GetResultSetPosition()const;
+ bool IsResultSetFirstLast(bool& bIsFirst, bool& bIsLast);
+
+ bool IsRecordExcluded(sal_Int32 nRecord);
+ void ExcludeRecord(sal_Int32 nRecord, bool bExclude);
+
+ const com::sun::star::uno::Sequence< ::rtl::OUString>&
+ GetSavedDocuments() const;
+ void AddSavedDocument(::rtl::OUString rName);
+
+ sal_Bool IsOutputToLetter()const;
+ void SetOutputToLetter(sal_Bool bSet);
+
+ sal_Bool IsAddressBlock()const;
+ void SetAddressBlock(sal_Bool bSet);
+
+ sal_Bool IsHideEmptyParagraphs() const;
+ void SetHideEmptyParagraphs(sal_Bool bSet);
+
+ const com::sun::star::uno::Sequence< ::rtl::OUString>
+ GetAddressBlocks() const;
+ void SetAddressBlocks(const com::sun::star::uno::Sequence< ::rtl::OUString>& rBlocks);
+
+ void SetCurrentAddressBlockIndex( sal_Int32 nSet );
+ sal_Int32 GetCurrentAddressBlockIndex() const;
+
+ sal_Bool IsIncludeCountry() const;
+ rtl::OUString& GetExcludeCountry() const;
+ void SetCountrySettings(sal_Bool bSet, const rtl::OUString& sCountry);
+
+ sal_Bool IsIndividualGreeting(sal_Bool bInEMail) const;
+ void SetIndividualGreeting(sal_Bool bSet, sal_Bool bInEMail);
+
+ sal_Bool IsGreetingLine(sal_Bool bInEMail) const;
+ void SetGreetingLine(sal_Bool bSet, sal_Bool bInEMail);
+
+ const com::sun::star::uno::Sequence< ::rtl::OUString>
+ GetGreetings(Gender eType) const;
+ void SetGreetings(Gender eType, const com::sun::star::uno::Sequence< ::rtl::OUString>& rBlocks);
+
+ sal_Int32 GetCurrentGreeting(Gender eType) const;
+ void SetCurrentGreeting(Gender eType, sal_Int32 nIndex);
+
+ //the content of the gender column that marks it as female
+ const ::rtl::OUString& GetFemaleGenderValue() const;
+ void SetFemaleGenderValue(const ::rtl::OUString rValue);
+
+ //returns the assignment in the order of the default headers (GetDefaultAddressHeaders())
+ com::sun::star::uno::Sequence< ::rtl::OUString >
+ GetColumnAssignment( const SwDBData& rDBData ) const;
+ void SetColumnAssignment(
+ const SwDBData& rDBData,
+ const com::sun::star::uno::Sequence< ::rtl::OUString>& );
+
+ bool IsAddressFieldsAssigned() const;
+ bool IsGreetingFieldsAssigned() const;
+
+ //e-Mail settings:
+ ::rtl::OUString GetMailDisplayName() const;
+ void SetMailDisplayName(const ::rtl::OUString& rName);
+
+ ::rtl::OUString GetMailAddress() const;
+ void SetMailAddress(const ::rtl::OUString& rAddress);
+
+ sal_Bool IsMailReplyTo() const;
+ void SetMailReplyTo(sal_Bool bSet);
+
+ ::rtl::OUString GetMailReplyTo() const;
+ void SetMailReplyTo(const ::rtl::OUString& rReplyTo);
+
+ ::rtl::OUString GetMailServer() const;
+ void SetMailServer(const ::rtl::OUString& rAddress);
+
+ sal_Int16 GetMailPort() const;
+ void SetMailPort(sal_Int16 nSet);
+
+ sal_Bool IsSecureConnection() const;
+ void SetSecureConnection(sal_Bool bSet);
+
+ sal_Bool IsAuthentication() const;
+ void SetAuthentication(sal_Bool bSet);
+
+ ::rtl::OUString GetMailUserName() const;
+ void SetMailUserName(const ::rtl::OUString& rName);
+
+ ::rtl::OUString GetMailPassword() const;
+ void SetMailPassword(const ::rtl::OUString& rPassword);
+
+ sal_Bool IsSMTPAfterPOP() const;
+ void SetSMTPAfterPOP(sal_Bool bSet);
+
+ ::rtl::OUString GetInServerName() const;
+ void SetInServerName(const ::rtl::OUString& rServer);
+
+ sal_Int16 GetInServerPort() const;
+ void SetInServerPort(sal_Int16 nSet);
+
+ sal_Bool IsInServerPOP() const;
+ void SetInServerPOP(sal_Bool bSet);
+
+ ::rtl::OUString GetInServerUserName() const;
+ void SetInServerUserName(const ::rtl::OUString& rName);
+
+ ::rtl::OUString GetInServerPassword() const;
+ void SetInServerPassword(const ::rtl::OUString& rPassword);
+
+ //session information
+ bool IsAddressInserted() const { return m_bAddressInserted; }
+ void SetAddressInserted(const ::rtl::OUString& rFrameName)
+ { m_bAddressInserted = true;
+ m_rAddressBlockFrame = rFrameName;
+ }
+
+ bool IsGreetingInserted() const { return m_bGreetingInserted; }
+ void SetGreetingInserted()
+ { m_bGreetingInserted = true; }
+
+ // counts the moves in the layout page
+ void MoveGreeting( sal_Int32 nMove) { m_nGreetingMoves += nMove;}
+ sal_Int32 GetGreetingMoves() const { return m_nGreetingMoves;}
+
+ bool IsMergeDone() const { return m_bMergeDone;}
+ void SetMergeDone( ) { m_bMergeDone = true; }
+
+ // new source document - reset some flags
+ void DocumentReloaded();
+
+ bool IsMailAvailable() const;
+
+ // notify a completed merge, provid the appropriate e-Mail address if available
+ void AddMergedDocument(SwDocMergeInfo& rInfo);
+ //returns the page and database cursor information of each merged document
+ SwDocMergeInfo& GetDocumentMergeInfo(sal_uInt32 nDocument);
+ sal_uInt32 GetMergedDocumentCount() const;
+
+ void SetPrintRange( USHORT nStartDocument, USHORT nEndDocument)
+ {m_nStartPrint = nStartDocument; m_nEndPrint = nEndDocument;}
+ USHORT GetPrintRangeStart() const {return m_nStartPrint;}
+ USHORT GetPrintRangeEnd() const {return m_nEndPrint;}
+
+ const ::rtl::OUString& GetSelectedPrinter() const {return m_sSelectedPrinter;}
+ void SetSelectedPrinter(const ::rtl::OUString& rSet )
+ {m_sSelectedPrinter = rSet;}
+
+
+ SwView* GetTargetView();
+ void SetTargetView(SwView* pView);
+
+ SwView* GetSourceView();
+ void SetSourceView(SwView* pView);
+
+ //helper methods
+ ::rtl::OUString GetAssignedColumn(sal_uInt32 nColumn)const;
+};
+#endif
+
diff --git a/sw/source/ui/inc/multmrk.hxx b/sw/source/ui/inc/multmrk.hxx
new file mode 100644
index 000000000000..7d5dae802e01
--- /dev/null
+++ b/sw/source/ui/inc/multmrk.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _MULTMRK_HXX
+#define _MULTMRK_HXX
+
+
+#include <svx/stddlg.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#include <vcl/fixed.hxx>
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+class SwTOXMgr;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Markierung fuer Verzeichniseintrag einfuegen
+ --------------------------------------------------------------------*/
+
+class SwMultiTOXMarkDlg : public SvxStandardDialog
+{
+ DECL_LINK( SelectHdl, ListBox * );
+
+ FixedLine aTOXFL;
+ FixedText aEntryFT;
+ FixedInfo aTextFT;
+ FixedText aTOXFT;
+ ListBox aTOXLB;
+ OKButton aOkBT;
+ CancelButton aCancelBT;
+
+ SwTOXMgr &rMgr;
+ USHORT nPos;
+
+ void Apply();
+public:
+ SwMultiTOXMarkDlg( Window* pParent, SwTOXMgr &rTOXMgr );
+ ~SwMultiTOXMarkDlg();
+};
+
+
+#endif // _MULTMRK_HXX
+
diff --git a/sw/source/ui/inc/navicfg.hxx b/sw/source/ui/inc/navicfg.hxx
new file mode 100644
index 000000000000..de400eca916e
--- /dev/null
+++ b/sw/source/ui/inc/navicfg.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _NAVICFG_HXX
+#define _NAVICFG_HXX
+
+#include <unotools/configitem.hxx>
+/* -----------------------------08.09.00 16:27--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwNavigationConfig : public utl::ConfigItem
+{
+ sal_Int32 nRootType; //RootType
+ sal_Int32 nSelectedPos; //SelectedPosition
+ sal_Int32 nOutlineLevel; //OutlineLevel
+ sal_Int32 nRegionMode; //InsertMode
+ sal_Int32 nActiveBlock; //ActiveBlock//Expand/CollapsState
+ sal_Bool bIsSmall; //ShowListBox
+ sal_Bool bIsGlobalActive; //GlobalDocMode// Globalansicht fuer GlobalDoc gueltig?
+
+ com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
+
+public:
+ SwNavigationConfig();
+ ~SwNavigationConfig();
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+
+ sal_Int32 GetRootType()const {return nRootType;}
+ void SetRootType(sal_Int32 nSet){
+ if(nRootType != nSet)
+ {
+ SetModified();
+ nRootType = nSet;
+ }
+ }
+
+ sal_Int32 GetSelectedPos()const {return nSelectedPos;}
+ void SetSelectedPos(sal_Int32 nSet){
+ if(nSelectedPos != nSet)
+ {
+ SetModified();
+ nSelectedPos = nSet;
+ }
+ }
+
+
+ sal_Int32 GetOutlineLevel()const {return nOutlineLevel;}
+ void SetOutlineLevel(sal_Int32 nSet){
+ if(nOutlineLevel != nSet)
+ {
+ SetModified();
+ nOutlineLevel = nSet;
+ }
+ }
+
+ sal_Int32 GetRegionMode()const {return nRegionMode;}
+ void SetRegionMode(sal_Int32 nSet){
+ if(nRegionMode != nSet)
+ {
+ SetModified();
+ nRegionMode = nSet;
+ }
+ }
+
+
+ sal_Int32 GetActiveBlock()const {return nActiveBlock;}
+ void SetActiveBlock(sal_Int32 nSet){
+ if(nActiveBlock != nSet)
+ {
+ SetModified();
+ nActiveBlock = nSet;
+ }
+ }
+
+ sal_Bool IsSmall() const {return bIsSmall;}
+ void SetSmall(sal_Bool bSet){
+ if(bIsSmall != bSet)
+ {
+ SetModified();
+ bIsSmall = bSet;
+ }
+ }
+
+ sal_Bool IsGlobalActive() const {return bIsGlobalActive;}
+ void SetGlobalActive(sal_Bool bSet){
+ if(bIsGlobalActive != bSet)
+ {
+ SetModified();
+ bIsGlobalActive = bSet;
+ }
+ }
+};
+#endif
+
diff --git a/sw/source/ui/inc/navicont.hxx b/sw/source/ui/inc/navicont.hxx
new file mode 100644
index 000000000000..124309057953
--- /dev/null
+++ b/sw/source/ui/inc/navicont.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _NAVICONT_HXX
+#define _NAVICONT_HXX
+
+#include <tools/string.hxx>
+
+class SwDocShell;
+class TransferDataContainer;
+class TransferableDataHelper;
+
+/* [Beschreibung]
+ Navigator-Bookmark zur eindeutigen Identifizierung im Sw
+*/
+
+class NaviContentBookmark
+{
+ String aUrl; // URL inkl. Sprungmarke
+ String aDescr; // Description
+ long nDocSh; // Adresse der DocShell
+ USHORT nDefDrag; // Description enthaelt defaultDragType
+
+public:
+ NaviContentBookmark();
+ NaviContentBookmark( const String &rUrl, const String& rDesc,
+ USHORT nDragType, const SwDocShell* );
+
+ const String& GetURL() const { return aUrl; }
+ const String& GetDescription() const { return aDescr; }
+ USHORT GetDefaultDragType() const { return nDefDrag; }
+ long GetDocShell() const { return nDocSh; }
+ void Copy( TransferDataContainer& rData ) const;
+ BOOL Paste( TransferableDataHelper& rData );
+};
+
+#endif
diff --git a/sw/source/ui/inc/navipi.hxx b/sw/source/ui/inc/navipi.hxx
new file mode 100644
index 000000000000..b2b457bdd5d4
--- /dev/null
+++ b/sw/source/ui/inc/navipi.hxx
@@ -0,0 +1,198 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _NAVIPI_HXX
+#define _NAVIPI_HXX
+
+// INCLUDE ---------------------------------------------------------------
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#include <svl/lstner.hxx>
+#include <svtools/transfer.hxx>
+#include <sfx2/childwin.hxx>
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/tbxctrl.hxx>
+#include <conttree.hxx>
+#include <popbox.hxx>
+
+class SwWrtShell;
+class SwNavigationPI;
+class SwNavigationChild;
+class SfxBindings;
+class NumEditAction;
+class SwView;
+class SwNavigationConfig;
+class SfxObjectShellLock;
+class SfxChildWindowContext;
+
+//-----------------------------------------------------------------------
+class SwNavigationPI;
+class SwNavHelpToolBox : public SwHelpToolBox
+{
+ virtual void MouseButtonDown(const MouseEvent &rEvt);
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ public:
+ SwNavHelpToolBox(SwNavigationPI* pParent, const ResId &rResId);
+};
+
+
+// CLASS -----------------------------------------------------------------
+class SwNavigationPI : public Window,
+ public SfxControllerItem, public SfxListener
+{
+ friend class SwNavigationChild;
+ friend class SwContentTree;
+ friend class SwGlobalTree;
+
+ // --------- members -----------------------------
+ SwNavHelpToolBox aContentToolBox;
+ SwHelpToolBox aGlobalToolBox;
+ ImageList aContentImageList;
+ ImageList aContentImageListH;
+ SwContentTree aContentTree;
+ SwGlobalTree aGlobalTree;
+ ListBox aDocListBox;
+ Timer aPageChgTimer;
+ String sContentFileName;
+ String aContextArr[3];
+ String aStatusArr[4];
+ Point aBoxBottomLeft; // Pos., wenn Box unten ist
+
+ SfxObjectShellLock *pxObjectShell;
+ SwView *pContentView;
+ SwWrtShell *pContentWrtShell;
+ SwView *pActContView;
+ SwView *pCreateView;
+ SfxPopupWindow *pPopupWindow;
+ SfxPopupWindow *pFloatingWindow;
+
+ SfxChildWindowContext* pContextWin;
+
+ SwNavigationConfig *pConfig;
+ SfxBindings &rBindings;
+
+ long nDocLBIniHeight;
+ long nWishWidth;
+ USHORT nAutoMarkIdx;
+ USHORT nRegionMode; // 0 - URL, 1 - Bereich mit Link 2 - B. ohne Link
+ short nZoomIn;
+ short nZoomOutInit;
+ short nZoomOut;
+
+ BOOL bSmallMode : 1;
+ BOOL bIsZoomedIn : 1;
+ BOOL bPageCtrlsVisible : 1;
+ BOOL bGlobalMode : 1;
+
+ // --------- methods -----------------------------
+ BOOL _IsZoomedIn() const {return bIsZoomedIn;}
+ void _ZoomOut();
+ void _ZoomIn();
+
+ void FillBox();
+ void MakeMark();
+
+ DECL_LINK( DocListBoxSelectHdl, ListBox * );
+ DECL_LINK( ToolBoxSelectHdl, ToolBox * );
+ DECL_LINK( ToolBoxClickHdl, ToolBox * );
+ DECL_LINK( ToolBoxDropdownClickHdl, ToolBox* );
+ DECL_LINK( EditAction, NumEditAction * );
+ DECL_LINK( EditGetFocus, NumEditAction * );
+ DECL_LINK( DoneLink, SfxPoolItem * );
+ DECL_LINK( MenuSelectHdl, Menu * );
+ DECL_LINK( ChangePageHdl, Timer* );
+ DECL_LINK( PageEditModifyHdl, Edit* );
+ DECL_LINK( PopupModeEndHdl, void * );
+ DECL_LINK( ClosePopupWindow, SfxPopupWindow * );
+ void UsePage(SwWrtShell *);
+
+ void MakeVisible();
+ void InitImageList();
+ virtual SfxChildAlignment
+ CheckAlignment(SfxChildAlignment,SfxChildAlignment);
+ void SetPopupWindow( SfxPopupWindow* );
+
+ using Window::Notify;
+ using Window::StateChanged;
+
+protected:
+
+ virtual BOOL Close();
+ virtual void Resize();
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+
+ // zum App-Ende rechtzeitig ObjectShellLock loslassen
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ NumEditAction& GetPageEdit();
+ BOOL ToggleTree();
+ void SetGlobalMode(BOOL bSet) {bGlobalMode = bSet;}
+
+public:
+
+ SwNavigationPI(SfxBindings*, SfxChildWindowContext*, Window*);
+ ~SwNavigationPI();
+
+ void GotoPage(); // Seite anspringen; bindbare Funktion
+
+ void Update() { FillBox(); }
+ void UpdateListBox();
+ void MoveOutline(USHORT nSource, USHORT nTarget, BOOL bWithCilds);
+
+ virtual void StateChanged( USHORT nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+
+ static String CreateDropFileName( TransferableDataHelper& rData );
+ static void CleanEntry( String& rEntry );
+
+ USHORT GetRegionDropMode() const {return nRegionMode;}
+ void SetRegionDropMode(USHORT nNewMode);
+
+ sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ BOOL IsGlobalDoc() const;
+ BOOL IsGlobalMode() const {return bGlobalMode;}
+
+ SwView* GetCreateView() const;
+ void CreateNavigationTool(const Rectangle& rRect, BOOL bSetFocus);
+};
+
+class SwNavigationChild : public SfxChildWindowContext
+{
+public:
+ SwNavigationChild( Window* ,
+ USHORT nId,
+ SfxBindings*,
+ SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW_CONTEXT( SwNavigationChild )
+};
+
+#endif
diff --git a/sw/source/ui/inc/num.hxx b/sw/source/ui/inc/num.hxx
new file mode 100644
index 000000000000..2233f9609fe4
--- /dev/null
+++ b/sw/source/ui/inc/num.hxx
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _NUM_HXX
+#define _NUM_HXX
+
+
+#include <sfx2/tabdlg.hxx>
+#ifndef _MENUBTN_HXX //autogen
+#include <vcl/menubtn.hxx>
+#endif
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#include <svx/stddlg.hxx>
+#include <numprevw.hxx>
+#include "numrule.hxx"
+
+class SwWrtShell;
+class SvxBrushItem;
+class SwOutlineTabDialog;
+
+
+/*-----------------13.02.97 14.02-------------------
+
+--------------------------------------------------*/
+
+struct SwBmpItemInfo
+{
+ SvxBrushItem* pBrushItem;
+ USHORT nItemId;
+};
+
+
+/*-----------------07.02.97 15.37-------------------
+
+--------------------------------------------------*/
+#define NUM_PAGETYPE_BULLET 0
+#define NUM_PAGETYPE_SINGLENUM 1
+#define NUM_PAGETYPE_NUM 2
+#define NUM_PAGETYPE_BMP 3
+#define PAGETYPE_USER_START 10
+
+/*-----------------03.12.97 10:18-------------------
+
+--------------------------------------------------*/
+class SwNumPositionTabPage : public SfxTabPage
+{
+ FixedLine aPositionFL;
+ FixedLine aLevelFL;
+ MultiListBox aLevelLB;
+
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ // former set of controls shown for numbering rules containing list level
+ // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_WIDTH_AND_POSITION
+ FixedText aDistBorderFT;
+ MetricField aDistBorderMF;
+ CheckBox aRelativeCB;
+ FixedText aIndentFT;
+ MetricField aIndentMF;
+ FixedText aDistNumFT;
+ MetricField aDistNumMF;
+ FixedText aAlignFT;
+ ListBox aAlignLB;
+ // <--
+
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ // new set of controls shown for numbering rules containing list level
+ // attributes in SvxNumberFormat::SvxNumPositionAndSpaceMode == LABEL_ALIGNMENT
+ FixedText aLabelFollowedByFT;
+ ListBox aLabelFollowedByLB;
+ FixedText aListtabFT;
+ MetricField aListtabMF;
+ FixedText aAlign2FT;
+ ListBox aAlign2LB;
+ FixedText aAlignedAtFT;
+ MetricField aAlignedAtMF;
+ FixedText aIndentAtFT;
+ MetricField aIndentAtMF;
+ // <--
+
+ PushButton aStandardPB;
+
+ NumberingPreview aPreviewWIN;
+
+ SwNumRule* pActNum;
+ SwNumRule* pSaveNum;
+ SwWrtShell* pWrtSh;
+
+ SwOutlineTabDialog* pOutlineDlg;
+ USHORT nActNumLvl;
+
+ BOOL bModified : 1;
+ BOOL bPreset : 1;
+ BOOL bInInintControl : 1; //Modify-Fehler umgehen, soll ab 391 behoben sein
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ bool bLabelAlignmentPosAndSpaceModeActive;
+ // <--
+
+ void InitControls();
+
+ DECL_LINK( LevelHdl, ListBox * );
+ DECL_LINK( EditModifyHdl, Edit*);
+ DECL_LINK( DistanceHdl, MetricField * );
+ DECL_LINK( RelativeHdl, CheckBox * );
+ DECL_LINK( StandardHdl, PushButton * );
+
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ void InitPosAndSpaceMode();
+ void ShowControlsDependingOnPosAndSpaceMode();
+
+ DECL_LINK( LabelFollowedByHdl_Impl, ListBox* );
+ DECL_LINK( ListtabPosHdl_Impl, MetricField* );
+ DECL_LINK( AlignAtHdl_Impl, MetricField* );
+ DECL_LINK( IndentAtHdl_Impl, MetricField* );
+ // <--
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+public:
+
+ SwNumPositionTabPage(Window* pParent,
+ const SfxItemSet& rSet);
+ ~SwNumPositionTabPage();
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet *pSet);
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ void SetOutlineTabDialog(SwOutlineTabDialog* pDlg){pOutlineDlg = pDlg;}
+ void SetWrtShell(SwWrtShell* pSh);
+#if OSL_DEBUG_LEVEL > 1
+ void SetModified(BOOL bRepaint = TRUE);
+#else
+ void SetModified(BOOL bRepaint = TRUE)
+ { bModified = TRUE;
+ if(bRepaint)
+ {
+ aPreviewWIN.SetLevel(nActNumLvl);
+ aPreviewWIN.Invalidate();
+ }
+ }
+#endif
+};
+
+class SwSvxNumBulletTabDialog : public SfxTabDialog
+{
+ SwWrtShell& rWrtSh;
+
+ String sRemoveText;
+ int nRetOptionsDialog;
+
+ protected:
+ virtual short Ok();
+ virtual void PageCreated(USHORT nPageId, SfxTabPage& rPage);
+ DECL_LINK(RemoveNumberingHdl, PushButton*);
+ public:
+ SwSvxNumBulletTabDialog(Window* pParent,
+ const SfxItemSet* pSwItemSet,
+ SwWrtShell &);
+ ~SwSvxNumBulletTabDialog();
+};
+#endif // _NUM_CXX
+
diff --git a/sw/source/ui/inc/numberingtypelistbox.hxx b/sw/source/ui/inc/numberingtypelistbox.hxx
new file mode 100644
index 000000000000..d70bbc9cc74c
--- /dev/null
+++ b/sw/source/ui/inc/numberingtypelistbox.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _NUMBERINGTYPELISTBOX_HXX
+#define _NUMBERINGTYPELISTBOX_HXX
+
+#include <vcl/lstbox.hxx>
+#include "swdllapi.h"
+
+#define INSERT_NUM_TYPE_NO_NUMBERING 0x01
+#define INSERT_NUM_TYPE_PAGE_STYLE_NUMBERING 0x02
+#define INSERT_NUM_TYPE_BITMAP 0x04
+#define INSERT_NUM_TYPE_BULLET 0x08
+#define INSERT_NUM_EXTENDED_TYPES 0x10
+
+struct SwNumberingTypeListBox_Impl;
+
+class SW_DLLPUBLIC SwNumberingTypeListBox : public ListBox
+{
+ SwNumberingTypeListBox_Impl* pImpl;
+
+public:
+ SwNumberingTypeListBox( Window* pWin, const ResId& rResId,
+ USHORT nTypeFlags = INSERT_NUM_TYPE_PAGE_STYLE_NUMBERING|INSERT_NUM_TYPE_NO_NUMBERING|INSERT_NUM_EXTENDED_TYPES );
+ ~SwNumberingTypeListBox();
+
+ void Reload(USHORT nTypeFlags);
+
+ sal_Int16 GetSelectedNumberingType();
+ sal_Bool SelectNumberingType(sal_Int16 nType);
+};
+
+
+#endif
+
diff --git a/sw/source/ui/inc/numfmtlb.hxx b/sw/source/ui/inc/numfmtlb.hxx
new file mode 100644
index 000000000000..50d762dc4419
--- /dev/null
+++ b/sw/source/ui/inc/numfmtlb.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWNUMFMTLB_HXX
+#define _SWNUMFMTLB_HXX
+
+#include <vcl/lstbox.hxx>
+#include <svl/zforlist.hxx>
+#include "swdllapi.h"
+
+class SwView;
+
+class SW_DLLPUBLIC NumFormatListBox : public ListBox
+{
+ short nCurrFormatType;
+ USHORT nStdEntry;
+ BOOL bOneArea;
+ ULONG nDefFormat;
+ SwView* pVw;
+ SvNumberFormatter* pOwnFormatter;
+ LanguageType eCurLanguage;
+ BOOL bShowLanguageControl; //determine whether the language control has
+ //to be shown in the number format dialog
+ BOOL bUseAutomaticLanguage;//determine whether language is automatically assigned
+
+ SW_DLLPRIVATE DECL_LINK( SelectHdl, ListBox * );
+
+ SW_DLLPRIVATE double GetDefValue(const short nFormatType) const;
+ SW_DLLPRIVATE void Init(short nFormatType, BOOL bUsrFmts);
+ SW_DLLPRIVATE SwView* GetView();
+
+public:
+ NumFormatListBox( Window* pWin, const ResId& rResId,
+ short nFormatType = NUMBERFORMAT_NUMBER, ULONG nDefFmt = 0,
+ BOOL bUsrFmts = TRUE );
+
+ NumFormatListBox( Window* pWin, SwView* pView, const ResId& rResId,
+ short nFormatType = NUMBERFORMAT_NUMBER, ULONG nDefFmt = 0,
+ BOOL bUsrFmts = TRUE );
+
+ ~NumFormatListBox();
+
+ void Clear();
+
+ inline void SetOneArea(BOOL bOnlyOne = TRUE) { bOneArea = bOnlyOne; }
+
+ void SetFormatType(const short nFormatType);
+ inline short GetFormatType() const { return nCurrFormatType; }
+ void SetDefFormat(const ULONG nDefFmt);
+ ULONG GetFormat() const;
+
+ inline LanguageType GetCurLanguage() const { return eCurLanguage;}
+ void SetLanguage(LanguageType eSet) { eCurLanguage = eSet;}
+
+ void SetAutomaticLanguage(BOOL bSet){bUseAutomaticLanguage = bSet;}
+ BOOL IsAutomaticLanguage()const {return bUseAutomaticLanguage;}
+
+ void SetShowLanguageControl(BOOL bSet){bShowLanguageControl = bSet;}
+
+};
+
+
+#endif
+
diff --git a/sw/source/ui/inc/numpara.hxx b/sw/source/ui/inc/numpara.hxx
new file mode 100644
index 000000000000..f8d748c4473c
--- /dev/null
+++ b/sw/source/ui/inc/numpara.hxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _NUMPARA_HXX
+#define _NUMPARA_HXX
+
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/field.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+
+/* --- class SwParagraphNumTabPage ----------------------------------------
+ Mit dieser TabPage werden Numerierungseinstellungen am Absatz bzw. der
+ Absatzvorlage vorgenommen.
+
+ ---------------------------------------------------------------------------*/
+class SwParagraphNumTabPage : public SfxTabPage
+{
+ FixedLine aOutlineStartFL;
+ FixedText aOutlineLvFT;
+ ListBox aOutlineLvLB;
+
+ FixedText aNumberStyleFT;
+ ListBox aNumberStyleLB;
+
+ FixedLine aNewStartFL;
+ TriStateBox aNewStartCB;
+ TriStateBox aNewStartNumberCB;
+ NumericField aNewStartNF;
+
+ FixedLine aCountParaFL;
+ TriStateBox aCountParaCB;
+ TriStateBox aRestartParaCountCB;
+ FixedText aRestartFT;
+ NumericField aRestartNF;
+
+ // --> OD 2008-04-14 #outlinelevel#
+ const String msOutlineNumbering;
+ // <--
+
+ BOOL bModified : 1;
+ BOOL bCurNumrule : 1;
+
+ DECL_LINK( NewStartHdl_Impl, CheckBox* );
+ DECL_LINK( StyleHdl_Impl, ListBox* );
+ DECL_LINK( LineCountHdl_Impl, CheckBox* );
+
+protected:
+ SwParagraphNumTabPage(Window* pParent, const SfxItemSet& rSet );
+
+public:
+ ~SwParagraphNumTabPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rSet );
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void EnableNewStart();
+ void DisableOutline();
+ void DisableNumbering();
+
+ ListBox& GetStyleBox() {return aNumberStyleLB;};
+};
+
+
+#endif
+
diff --git a/sw/source/ui/inc/numprevw.hxx b/sw/source/ui/inc/numprevw.hxx
new file mode 100644
index 000000000000..3ee9a2316103
--- /dev/null
+++ b/sw/source/ui/inc/numprevw.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _NUMPREVW_HXX
+#define _NUMPREVW_HXX
+
+
+#include <vcl/window.hxx>
+
+class SwNumRule;
+/*-----------------02.12.97 10:31-------------------
+
+--------------------------------------------------*/
+
+class NumberingPreview : public Window
+{
+ const SwNumRule* pActNum;
+ Font aStdFont;
+ long nPageWidth;
+ const String* pOutlineNames;
+ BOOL bPosition;
+ UINT16 nActLevel;
+
+ protected:
+ virtual void Paint( const Rectangle& rRect );
+
+ public:
+ NumberingPreview(Window* pParent, const ResId& rResId ) :
+ Window(pParent, rResId),
+ pActNum(0),nPageWidth(0), pOutlineNames(0), bPosition(FALSE), nActLevel(USHRT_MAX) {}
+ ~NumberingPreview();
+
+ void SetNumRule(const SwNumRule* pNum)
+ {pActNum = pNum; Invalidate();};
+ void SetPageWidth(long nPgWidth)
+ {nPageWidth = nPgWidth;}
+ void SetOutlineNames(const String* pNames)
+ {pOutlineNames = pNames;}
+ void SetPositionMode()
+ { bPosition = TRUE;}
+ void SetLevel(USHORT nSet) {nActLevel = nSet;}
+
+};
+
+#endif
+
+
diff --git a/sw/source/ui/inc/olesh.hxx b/sw/source/ui/inc/olesh.hxx
new file mode 100644
index 000000000000..32a413300f36
--- /dev/null
+++ b/sw/source/ui/inc/olesh.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWOLESH_HXX
+#define _SWOLESH_HXX
+
+#include "frmsh.hxx"
+
+class SwOleShell: public SwFrameShell
+{
+public:
+ SFX_DECL_INTERFACE(SW_OLESHELL)
+
+ SwOleShell(SwView &rView);
+
+};
+
+#endif
+
+
+
+
+
+
+
diff --git a/sw/source/ui/inc/olmenu.hxx b/sw/source/ui/inc/olmenu.hxx
new file mode 100644
index 000000000000..ef6a26e73f67
--- /dev/null
+++ b/sw/source/ui/inc/olmenu.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OLMENU_HXX
+#define _OLMENU_HXX
+
+#include <com/sun/star/linguistic2/XDictionary.hpp>
+#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
+#include <com/sun/star/linguistic2/ProofreadingResult.hpp>
+#include <com/sun/star/uno/Sequence.h>
+
+#include <rtl/ustring.hxx>
+#include <vcl/image.hxx>
+#include <vcl/menu.hxx>
+
+#include <map>
+#include <vector>
+
+
+class SwWrtShell;
+
+class SwSpellPopup : public PopupMenu
+{
+ SwWrtShell* pSh;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > > aDics;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellAlternatives > xSpellAlt;
+
+ ::com::sun::star::uno::Sequence< rtl::OUString > aSuggestions;
+
+ LanguageType nCheckedLanguage;
+ LanguageType nGuessLangWord;
+ LanguageType nGuessLangPara;
+
+ std::map< sal_Int16, ::rtl::OUString > aLangTable_Text;
+ std::map< sal_Int16, ::rtl::OUString > aLangTable_Paragraph;
+// std::map< sal_Int16, ::rtl::OUString > aLangTable_Document;
+
+ bool bGrammarResults; // show grammar results? Or show spellcheck results?
+
+ Image aInfo16;
+
+ void fillLangPopupMenu( PopupMenu *pPopupMenu, USHORT nLangStart,
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aSeq, SwWrtShell* pWrtSh,
+ std::map< sal_Int16, ::rtl::OUString > &rLangTable );
+
+ using PopupMenu::Execute;
+
+public:
+ SwSpellPopup( SwWrtShell *pWrtSh,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellAlternatives > &xAlt,
+ const String & rParaText );
+
+ SwSpellPopup( SwWrtShell *pWrtSh,
+ const ::com::sun::star::linguistic2::ProofreadingResult &rResult,
+ sal_Int32 nErrorInResult,
+ const ::com::sun::star::uno::Sequence< rtl::OUString > &rSuggestions,
+ const String & rParaText );
+
+ sal_uInt16 Execute( const Rectangle& rPopupPos, Window* pWin );
+ void Execute( USHORT nId );
+
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/optcomp.hxx b/sw/source/ui/inc/optcomp.hxx
new file mode 100644
index 000000000000..34de97517fd2
--- /dev/null
+++ b/sw/source/ui/inc/optcomp.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OPTCOMP_HXX
+#define _OPTCOMP_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <unotools/compatibility.hxx>
+#include <svx/checklbx.hxx>
+
+// class SwCompatibilityOptPage ------------------------------------------
+
+class SwWrtShell;
+struct SwCompatibilityOptPage_Impl;
+
+class SwCompatibilityOptPage : public SfxTabPage
+{
+private:
+ // controls
+ FixedLine m_aMainFL;
+ FixedText m_aFormattingFT;
+ ListBox m_aFormattingLB;
+ FixedText m_aOptionsFT;
+ SvxCheckListBox m_aOptionsLB;
+ PushButton m_aResetPB;
+ PushButton m_aDefaultPB;
+ // config item
+ SvtCompatibilityOptions m_aConfigItem;
+ // text of the user entry
+ String m_sUserEntry;
+ // text of the "use as default" querybox
+ String m_sUseAsDefaultQuery;
+ // shell of the current document
+ SwWrtShell* m_pWrtShell;
+ // impl object
+ SwCompatibilityOptPage_Impl* m_pImpl;
+ // saved options after "Reset"; used in "FillItemSet" for comparison
+ ULONG m_nSavedOptions;
+
+ // handler
+ DECL_LINK( SelectHdl, ListBox* );
+ DECL_LINK( UseAsDefaultHdl, PushButton* );
+
+ // private methods
+ void InitControls( const SfxItemSet& rSet );
+ void ReplaceFormatName( String& rEntry );
+ void SetCurrentOptions( ULONG nOptions );
+ ULONG GetDocumentOptions() const;
+ void WriteOptions();
+
+public:
+ SwCompatibilityOptPage( Window* pParent, const SfxItemSet& rSet );
+ ~SwCompatibilityOptPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/optload.hxx b/sw/source/ui/inc/optload.hxx
new file mode 100644
index 000000000000..abe43c00f0a3
--- /dev/null
+++ b/sw/source/ui/inc/optload.hxx
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OPTLOAD_HXX
+#define _OPTLOAD_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+#ifndef _GROUP_HXX
+#include <vcl/group.hxx>
+#endif
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/field.hxx>
+#include <svx/strarray.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <svx/checklbx.hxx>
+#include <swlbox.hxx>
+#include <caption.hxx>
+
+class SwFldMgr;
+class SvLBoxEntry;
+class SwWrtShell;
+
+/*-----------------31.08.96 10.09-------------------
+
+--------------------------------------------------*/
+
+class SwLoadOptPage : public SfxTabPage
+{
+private:
+ FixedLine aUpdateFL;
+ FixedText aLinkFT;
+ RadioButton aAlwaysRB;
+ RadioButton aRequestRB;
+ RadioButton aNeverRB;
+
+ FixedText aFieldFT;
+ CheckBox aAutoUpdateFields;
+ CheckBox aAutoUpdateCharts;
+
+ FixedLine aSettingsFL;
+ FixedText aMetricFT;
+ ListBox aMetricLB;
+ FixedText aTabFT;
+ MetricField aTabMF;
+ CheckBox aUseSquaredPageMode;
+
+ SwWrtShell* pWrtShell;
+ sal_Bool bHTMLMode;
+ UINT16 nLastTab;
+ sal_Int32 nOldLinkMode;
+
+ DECL_LINK(CaptionHdl, PushButton*);
+ DECL_LINK(MetricHdl, ListBox*);
+
+public:
+ SwLoadOptPage( Window* pParent, const SfxItemSet& rSet );
+ ~SwLoadOptPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+class SwCaptionOptDlg : public SfxSingleTabDialog
+{
+public:
+ SwCaptionOptDlg(Window* pParent, const SfxItemSet& rSet);
+ ~SwCaptionOptDlg();
+};
+/* -----------------23.10.98 13:19-------------------
+ *
+ * --------------------------------------------------*/
+
+class CaptionComboBox : public SwComboBox
+{
+protected:
+ virtual void KeyInput( const KeyEvent& );
+
+public:
+ CaptionComboBox( Window* pParent, const ResId& rResId)
+ : SwComboBox(pParent, rResId)
+ {}
+};
+
+/*-----------------31.08.96 10.09-------------------
+
+--------------------------------------------------*/
+
+class SwCaptionPreview : public Window
+{
+private:
+ String maText;
+ Point maDrawPos;
+public:
+ SwCaptionPreview( Window* pParent, const ResId& rResId );
+ void SetPreviewText( const String& rText );
+ virtual void Paint( const Rectangle& rRect );
+};
+
+class SwCaptionOptPage : public SfxTabPage
+{
+private:
+ FixedText aCheckFT;
+ SvxCheckListBox aCheckLB;
+
+ FixedText aFtCaptionOrder;
+ ListBox aLbCaptionOrder;
+
+ SwCaptionPreview aPreview;
+
+ FixedLine aSettingsGroupFL;
+ FixedText aCategoryText;
+ CaptionComboBox aCategoryBox;
+ FixedText aFormatText;
+ ListBox aFormatBox;
+ //#i61007# order of captions
+ FixedText aNumberingSeparatorFT;
+ Edit aNumberingSeparatorED;
+ FixedText aTextText;
+ Edit aTextEdit;
+ FixedText aPosText;
+ ListBox aPosBox;
+
+ FixedLine aNumCaptFL;
+ FixedText aFtLevel;
+ ListBox aLbLevel;
+ FixedText aFtDelim;
+ Edit aEdDelim;
+
+ FixedLine aCategoryFL;
+ FixedText aCharStyleFT;
+ ListBox aCharStyleLB;
+ CheckBox aApplyBorderCB;
+
+ String sSWTable;
+ String sSWFrame;
+ String sSWGraphic;
+ String sOLE;
+
+ String sIllustration;
+ String sTable;
+ String sText;
+ String sDrawing;
+
+ String sBegin;
+ String sEnd;
+ String sAbove;
+ String sBelow;
+
+ String sNone;
+
+ SwFldMgr *pMgr;
+ USHORT eType;
+ BOOL bHTMLMode;
+
+ DECL_LINK( SelectHdl, ListBox *pLB = 0 );
+ DECL_LINK( ModifyHdl, Edit *pEdt = 0 );
+ DECL_LINK( OrderHdl, ListBox* );
+ DECL_LINK( ShowEntryHdl, SvxCheckListBox *pLB = 0 );
+ DECL_LINK( SaveEntryHdl, SvxCheckListBox *pLB = 0 );
+
+ void DelUserData();
+ void SetOptions( const USHORT nPos,
+ const SwCapObjType eType,
+ const SvGlobalName *pOleId = 0);
+ void SaveEntry( SvLBoxEntry* pEntry );
+ void DrawSample();
+
+public:
+ SwCaptionOptPage( Window* pParent,
+ const SfxItemSet& rSet );
+ ~SwCaptionOptPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+#endif
+
+
diff --git a/sw/source/ui/inc/optpage.hxx b/sw/source/ui/inc/optpage.hxx
new file mode 100644
index 000000000000..61b8056aa309
--- /dev/null
+++ b/sw/source/ui/inc/optpage.hxx
@@ -0,0 +1,509 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OPTPAGE_HXX
+#define _OPTPAGE_HXX
+#include <sfx2/tabdlg.hxx>
+
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <svtools/ctrlbox.hxx>
+#include <svx/fntctrl.hxx>
+#include <fontcfg.hxx>
+class SvStringsDtor;
+class SfxPrinter;
+class SwStdFontConfig;
+class SwWrtShell;
+class FontList;
+
+/*-----------------31.08.96 10.09-------------------
+
+--------------------------------------------------*/
+
+class SwContentOptPage : public SfxTabPage
+{
+ //visual aids
+ FixedLine aLineFL;
+ CheckBox aCrossCB;
+ CheckBox aSolidHandleCB;
+ CheckBox aBigHandleCB;
+
+ //view
+ FixedLine aWindowFL;
+ CheckBox aHScrollBox;
+ CheckBox aVScrollBox;
+ CheckBox aAnyRulerCB;
+ CheckBox aHRulerCBox;
+ ListBox aHMetric;
+ CheckBox aVRulerCBox;
+ CheckBox aVRulerRightCBox;
+ ListBox aVMetric;
+ CheckBox aSmoothCBox;
+
+ //display
+ FixedLine aDispFL;
+ CheckBox aGrfCB;
+ CheckBox aTblCB;
+ CheckBox aDrwCB;
+ CheckBox aFldNameCB;
+ CheckBox aPostItCB;
+
+ FixedLine aSettingsFL;
+ FixedText aMetricFT;
+ ListBox aMetricLB;
+
+ DECL_LINK(VertRulerHdl, CheckBox*);
+ DECL_LINK(AnyRulerHdl, CheckBox*);
+public:
+ SwContentOptPage( Window* pParent,
+ const SfxItemSet& rSet );
+ ~SwContentOptPage();
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+};
+
+/*-------- OS 27.01.95 -----------------------------------
+ TabPage Druckereinstellungen Zusaetze
+--------------------------------------------------------- */
+
+
+class SwAddPrinterTabPage : public SfxTabPage
+{
+ FixedLine aFL1;
+ CheckBox aGrfCB;
+// CheckBox aTabCB;
+// CheckBox aDrawCB;
+ CheckBox aCtrlFldCB;
+ CheckBox aBackgroundCB;
+ CheckBox aBlackFontCB;
+ CheckBox aPrintHiddenTextCB;
+ CheckBox aPrintTextPlaceholderCB;
+
+ FixedLine aSeparatorLFL;
+
+ FixedLine aFL2;
+ CheckBox aLeftPageCB;
+ CheckBox aRightPageCB;
+// CheckBox aReverseCB;
+ CheckBox aProspectCB;
+ CheckBox aProspectCB_RTL;
+
+ FixedLine aSeparatorRFL;
+
+ RadioButton aNoRB;
+ RadioButton aOnlyRB;
+ RadioButton aEndRB;
+ RadioButton aEndPageRB;
+ FixedLine aFL3;
+ FixedLine aFL4;
+ CheckBox aPrintEmptyPagesCB;
+// CheckBox aSingleJobsCB;
+ CheckBox aPaperFromSetupCB;
+ FixedText aFaxFT;
+ ListBox aFaxLB;
+ String sNone;
+
+ BOOL bAttrModified;
+ BOOL bPreview;
+
+ void Init();
+ DECL_LINK( AutoClickHdl, CheckBox * );
+ DECL_LINK( SelectHdl, ListBox * );
+
+
+ SwAddPrinterTabPage( Window* pParent,
+ const SfxItemSet& rSet );
+public:
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ void SetFax( const SvStringsDtor& );
+ void SelectFax( const String& );
+ void SetPreview(BOOL bPrev);
+ virtual void PageCreated (SfxAllItemSet aSet);
+
+};
+
+/*-----------------03.09.96 11.50-------------------
+
+--------------------------------------------------*/
+
+class SwStdFontTabPage : public SfxTabPage
+{
+ FixedLine aStdChrFL ;
+
+ FixedText aTypeFT;
+
+ FixedText aStandardLbl;
+ ComboBox aStandardBox;
+
+ FixedText aHeightFT;
+ FontSizeBox aStandardHeightLB;
+
+ FixedText aTitleLbl ;
+ ComboBox aTitleBox ;
+ FontSizeBox aTitleHeightLB;
+
+ FixedText aListLbl ;
+ ComboBox aListBox ;
+ FontSizeBox aListHeightLB;
+
+ FixedText aLabelLbl ;
+ ComboBox aLabelBox ;
+ FontSizeBox aLabelHeightLB;
+
+ FixedText aIdxLbl ;
+ ComboBox aIdxBox ;
+ FontSizeBox aIndexHeightLB;
+
+ CheckBox aDocOnlyCB ;
+ PushButton aStandardPB;
+
+ String sShellStd;
+ String sShellTitle;
+ String sShellList;
+ String sShellLabel;
+ String sShellIndex;
+
+ SfxPrinter* pPrt;
+ FontList* pFontList;
+ SwStdFontConfig* pFontConfig;
+ SwWrtShell* pWrtShell;
+ LanguageType eLanguage;
+ // waren nur defaults vorhanden? wurden sie mit den Boxen ueberschrieben
+ BOOL bListDefault :1;
+ BOOL bSetListDefault :1;
+ BOOL bLabelDefault :1;
+ BOOL bSetLabelDefault :1;
+ BOOL bIdxDefault :1;
+ BOOL bSetIdxDefault :1;
+ BOOL bDeletePrinter :1;
+
+ BOOL bListHeightDefault :1;
+ BOOL bSetListHeightDefault :1;
+ BOOL bLabelHeightDefault :1;
+ BOOL bSetLabelHeightDefault :1;
+ BOOL bIndexHeightDefault :1;
+ BOOL bSetIndexHeightDefault :1;
+
+ sal_uInt8 nFontGroup; //fontcfg.hxx: FONT_GROUP_[STANDARD|CJK|CTL]
+
+ String sScriptWestern;
+ String sScriptAsian;
+ String sScriptComplex;
+
+ DECL_LINK( StandardHdl, PushButton * );
+ DECL_LINK( ModifyHdl, ComboBox * );
+ DECL_LINK( ModifyHeightHdl, FontSizeBox * );
+ DECL_LINK( LoseFocusHdl, ComboBox * );
+
+ SwStdFontTabPage( Window* pParent,
+ const SfxItemSet& rSet );
+ ~SwStdFontTabPage();
+
+public:
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void SetFontMode(sal_uInt8 nGroup) {nFontGroup = nGroup;}
+ virtual void PageCreated (SfxAllItemSet aSet);
+};
+
+/*-----------------18.01.97 12.10-------------------
+
+--------------------------------------------------*/
+
+class SwTableOptionsTabPage : public SfxTabPage
+{
+ FixedLine aTableFL;
+ CheckBox aHeaderCB;
+ CheckBox aRepeatHeaderCB;
+ CheckBox aDontSplitCB;
+ CheckBox aBorderCB;
+
+ FixedLine aSeparatorFL;
+
+ FixedLine aTableInsertFL;
+ CheckBox aNumFormattingCB;
+ CheckBox aNumFmtFormattingCB;
+ CheckBox aNumAlignmentCB;
+
+ FixedLine aMoveFL;
+ FixedText aMoveFT;
+ FixedText aRowMoveFT;
+ MetricField aRowMoveMF;
+ FixedText aColMoveFT;
+ MetricField aColMoveMF;
+
+ FixedText aInsertFT;
+ FixedText aRowInsertFT;
+ MetricField aRowInsertMF;
+ FixedText aColInsertFT;
+ MetricField aColInsertMF;
+
+ FixedText aHandlingFT;
+ RadioButton aFixRB;
+ RadioButton aFixPropRB;
+ RadioButton aVarRB;
+ FixedText aFixFT;
+ FixedText aFixPropFT;
+ FixedText aVarFT;
+
+ SwWrtShell* pWrtShell;
+ BOOL bHTMLMode;
+
+ DECL_LINK(CheckBoxHdl, CheckBox *pCB);
+
+
+ SwTableOptionsTabPage( Window* pParent,
+ const SfxItemSet& rSet );
+ ~SwTableOptionsTabPage();
+
+public:
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void SetWrtShell(SwWrtShell* pSh) {pWrtShell = pSh;}
+ virtual void PageCreated (SfxAllItemSet aSet);
+
+};
+/*-----------------31.10.97 17:55-------------------
+ TabPage fuer ShadowCrsr
+--------------------------------------------------*/
+class SwShdwCrsrOptionsTabPage : public SfxTabPage
+{
+ //nonprinting characters
+ FixedLine aUnprintFL;
+ CheckBox aParaCB;
+ CheckBox aSHyphCB;
+ CheckBox aSpacesCB;
+ CheckBox aHSpacesCB;
+ CheckBox aTabCB;
+ CheckBox aBreakCB;
+ CheckBox aCharHiddenCB;
+ CheckBox aFldHiddenCB;
+ CheckBox aFldHiddenParaCB;
+
+ FixedLine aSeparatorFL;
+
+ FixedLine aFlagFL;
+ CheckBox aOnOffCB;
+
+ FixedText aFillModeFT;
+ RadioButton aFillMarginRB;
+ RadioButton aFillIndentRB;
+ RadioButton aFillTabRB;
+ RadioButton aFillSpaceRB;
+
+ FixedLine aCrsrOptFL;
+ CheckBox aCrsrInProtCB;
+
+ FixedLine m_aLayoutOptionsFL;
+ CheckBox m_aMathBaselineAlignmentCB;
+
+ SwWrtShell * m_pWrtShell;
+
+
+ SwShdwCrsrOptionsTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~SwShdwCrsrOptionsTabPage();
+
+public:
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void SetWrtShell( SwWrtShell * pSh ) { m_pWrtShell = pSh; }
+ virtual void PageCreated( SfxAllItemSet aSet );
+};
+
+/*-----------------------------------------------------------------------
+ Beschreibung: Markierungsvorschau
+ -----------------------------------------------------------------------*/
+
+class SwMarkPreview : public Window
+{
+ Color m_aBgCol; // background
+ Color m_aTransCol; // transparency
+ Color m_aMarkCol; // marks
+ Color m_aLineCol; // general lines
+ Color m_aShadowCol; // shadow
+ Color m_aTxtCol; // text
+ Color m_aPrintAreaCol; // frame for print area
+
+ Rectangle aPage;
+ Rectangle aLeftPagePrtArea;
+ Rectangle aRightPagePrtArea;
+
+ USHORT nMarkPos;
+
+ using OutputDevice::DrawRect;
+ void DrawRect(const Rectangle &rRect, const Color &rFillColor, const Color &rLineColor);
+
+ void Paint(const Rectangle&);
+ void PaintPage(const Rectangle &rRect);
+ void InitColors( void );
+
+protected:
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+public:
+ SwMarkPreview(Window* pParent, const ResId& rResID);
+ virtual ~SwMarkPreview();
+
+ inline void SetColor(const Color& rCol) { m_aMarkCol = rCol; }
+ inline void SetMarkPos(USHORT nPos) { nMarkPos = nPos; }
+};
+
+/*-----------------------------------------------------------------------
+ Beschreibung: Redlining-Optionen
+ -----------------------------------------------------------------------*/
+
+class SwRedlineOptionsTabPage : public SfxTabPage
+{
+ FixedLine aInsertFL;
+
+ FixedText aInsertFT;
+ FixedText aInsertAttrFT;
+ ListBox aInsertLB;
+ FixedText aInsertColorFT;
+ ColorListBox aInsertColorLB;
+ SvxFontPrevWindow aInsertedPreviewWN;
+
+ FixedText aDeletedFT;
+ FixedText aDeletedAttrFT;
+ ListBox aDeletedLB;
+ FixedText aDeletedColorFT;
+ ColorListBox aDeletedColorLB;
+ SvxFontPrevWindow aDeletedPreviewWN;
+
+ FixedText aChangedFT;
+ FixedText aChangedAttrFT;
+ ListBox aChangedLB;
+ FixedText aChangedColorFT;
+ ColorListBox aChangedColorLB;
+ SvxFontPrevWindow aChangedPreviewWN;
+
+ FixedLine aChangedFL;
+
+ FixedText aMarkPosFT;
+ ListBox aMarkPosLB;
+ FixedText aMarkColorFT;
+ ColorListBox aMarkColorLB;
+ SwMarkPreview aMarkPreviewWN;
+
+ String sAuthor;
+ String sNone;
+
+ SwRedlineOptionsTabPage( Window* pParent, const SfxItemSet& rSet );
+ ~SwRedlineOptionsTabPage();
+
+ DECL_LINK( AttribHdl, ListBox *pLB );
+ DECL_LINK( ChangedMaskPrevHdl, ListBox *pLB = 0 );
+ DECL_LINK( ColorHdl, ColorListBox *pColorLB );
+
+ void InitFontStyle(SvxFontPrevWindow& rExampleWin);
+
+public:
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+};
+
+/*--------OS 11.01.95 -----------------------------------
+ TabPage Testeinstellungen fuer SW
+--------------------------------------------------------- */
+
+#ifdef DBG_UTIL
+
+class SwTestTabPage : public SfxTabPage
+{
+public:
+ SwTestTabPage( Window* pParent,
+ const SfxItemSet& rSet );
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet );
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+private:
+ FixedLine aTestFL;
+ CheckBox aTest1CBox;
+ CheckBox aTest2CBox;
+ CheckBox aTest3CBox;
+ CheckBox aTest4CBox;
+ CheckBox aTest5CBox;
+ CheckBox aTest6CBox;
+ CheckBox aTest7CBox;
+ CheckBox aTest8CBox;
+ CheckBox aTest9CBox;
+ CheckBox aTest10CBox;
+
+ BOOL bAttrModified;
+
+ void Init();
+ DECL_LINK( AutoClickHdl, CheckBox * );
+
+};
+#endif //PRODUCT
+#endif
diff --git a/sw/source/ui/inc/outline.hxx b/sw/source/ui/inc/outline.hxx
new file mode 100644
index 000000000000..65f57636c02d
--- /dev/null
+++ b/sw/source/ui/inc/outline.hxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _OUTLINE_HXX
+#define _OUTLINE_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+
+#include <vcl/menu.hxx>
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <svtools/stdctrl.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+
+#include "swtypes.hxx" //fuer MAXLEVEL
+#include <numprevw.hxx>
+#include <numberingtypelistbox.hxx>
+
+class SwWrtShell;
+class SwNumRule;
+class SwChapterNumRules;
+
+/* -----------------07.07.98 13:38-------------------
+ *
+ * --------------------------------------------------*/
+class SwOutlineTabDialog : public SfxTabDialog
+{
+ static USHORT nNumLevel;
+
+ String aNullStr;
+ String aCollNames[MAXLEVEL];
+ PopupMenu aFormMenu;
+
+ SwWrtShell& rWrtSh;
+ SwNumRule* pNumRule;
+ SwChapterNumRules* pChapterNumRules;
+
+ BOOL bModified : 1;
+
+ protected:
+ DECL_LINK( CancelHdl, Button * );
+ DECL_LINK( FormHdl, Button * );
+ DECL_LINK( MenuSelectHdl, Menu * );
+
+ virtual void PageCreated(USHORT nPageId, SfxTabPage& rPage);
+ virtual short Ok();
+
+ public:
+ SwOutlineTabDialog(Window* pParent,
+ const SfxItemSet* pSwItemSet,
+ SwWrtShell &);
+ ~SwOutlineTabDialog();
+
+ SwNumRule* GetNumRule() {return pNumRule;}
+ USHORT GetLevel(const String &rFmtName) const;
+ String* GetCollNames() {return aCollNames;}
+
+ static USHORT GetActNumLevel() {return nNumLevel;}
+ static void SetActNumLevel(USHORT nSet) {nNumLevel = nSet;}
+};
+/* -----------------07.07.98 13:47-------------------
+ *
+ * --------------------------------------------------*/
+class SwOutlineSettingsTabPage : public SfxTabPage
+{
+ ListBox aLevelLB;
+ FixedLine aLevelFL;
+
+ FixedText aCollLbl;
+ ListBox aCollBox;
+ FixedText aNumberLbl;
+ SwNumberingTypeListBox aNumberBox;
+ FixedText aCharFmtFT;
+ ListBox aCharFmtLB;
+ FixedText aAllLevelFT;
+ NumericField aAllLevelNF;
+ FixedText aDelim;
+ FixedText aPrefixFT;
+ Edit aPrefixED;
+ FixedText aSuffixFT;
+ Edit aSuffixED;
+ FixedText aStartLbl;
+ NumericField aStartEdit;
+ FixedLine aNumberFL;
+ NumberingPreview aPreviewWIN;
+
+ String aNoFmtName;
+ String aSaveCollNames[MAXLEVEL];
+ SwWrtShell* pSh;
+ SwNumRule* pNumRule;
+ String* pCollNames;
+ USHORT nActLevel;
+
+ DECL_LINK( LevelHdl, ListBox * );
+ DECL_LINK( ToggleComplete, NumericField * );
+ DECL_LINK( CollSelect, ListBox * );
+ DECL_LINK( CollSelectGetFocus, ListBox * );
+ DECL_LINK( NumberSelect, SwNumberingTypeListBox * );
+ DECL_LINK( DelimModify, Edit * );
+ DECL_LINK( StartModified, NumericField * );
+ DECL_LINK( CharFmtHdl, ListBox * );
+
+ void Update();
+
+ void SetModified(){aPreviewWIN.Invalidate();}
+ void CheckForStartValue_Impl(sal_uInt16 nNumberingType);
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+public:
+ SwOutlineSettingsTabPage(Window* pParent, const SfxItemSet& rSet);
+ ~SwOutlineSettingsTabPage();
+
+ void SetWrtShell(SwWrtShell* pShell);
+
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet *pSet);
+
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+};
+#endif
diff --git a/sw/source/ui/inc/pardlg.hxx b/sw/source/ui/inc/pardlg.hxx
new file mode 100644
index 000000000000..3946300dc248
--- /dev/null
+++ b/sw/source/ui/inc/pardlg.hxx
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_PARDLG_HXX
+#define _SW_PARDLG_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+class SwView;
+class SfxItemSet;
+
+//DialogModes:
+#define DLG_STD 0
+#define DLG_ENVELOP 2
+
+#endif
diff --git a/sw/source/ui/inc/pattern.hxx b/sw/source/ui/inc/pattern.hxx
new file mode 100644
index 000000000000..2ee7cb079afd
--- /dev/null
+++ b/sw/source/ui/inc/pattern.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _PATTERN_HXX
+#define _PATTERN_HXX
+
+#include <sfx2/basedlgs.hxx>
+class Window;
+class SfxItemSet;
+
+class SwBackgroundDlg : public SfxSingleTabDialog
+{
+public:
+
+ SwBackgroundDlg(Window* pParent, const SfxItemSet& rSet);
+ ~SwBackgroundDlg();
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/pgfnote.hxx b/sw/source/ui/inc/pgfnote.hxx
new file mode 100644
index 000000000000..31bb0c68fc22
--- /dev/null
+++ b/sw/source/ui/inc/pgfnote.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PGFNOTE_HXX
+#define _PGFNOTE_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+#include <svtools/ctrlbox.hxx>
+
+/*--------------------------------------------------------------------
+ Beschreibung: Fussnoteneinstellungs-TabPage
+ --------------------------------------------------------------------*/
+
+class SwFootNotePage: public SfxTabPage
+{
+public:
+ static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet(SfxItemSet &rSet);
+ virtual void Reset(const SfxItemSet &rSet);
+
+private:
+ SwFootNotePage(Window *pParent, const SfxItemSet &rSet);
+ ~SwFootNotePage();
+
+ RadioButton aMaxHeightPageBtn;
+ RadioButton aMaxHeightBtn;
+ MetricField aMaxHeightEdit;
+ FixedText aDistLbl;
+ MetricField aDistEdit;
+ FixedLine aPosHeader;
+
+ FixedText aLinePosLbl;
+ ListBox aLinePosBox;
+ FixedText aLineTypeLbl;
+ LineListBox aLineTypeBox;
+ FixedText aLineWidthLbl;
+ MetricField aLineWidthEdit;
+ FixedText aLineDistLbl;
+ MetricField aLineDistEdit;
+ FixedLine aLineHeader;
+
+ DECL_LINK( HeightPage, Button * );
+ DECL_LINK( HeightMetric, Button * );
+ DECL_LINK( HeightModify, MetricField * );
+
+ long lMaxHeight;
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+};
+
+#endif
diff --git a/sw/source/ui/inc/pggrid.hxx b/sw/source/ui/inc/pggrid.hxx
new file mode 100644
index 000000000000..92ba2fa2ebd4
--- /dev/null
+++ b/sw/source/ui/inc/pggrid.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PGGRID_HXX
+#define _PGGRID_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <colex.hxx>
+#ifndef _FIELD_HXX
+#include <vcl/field.hxx>
+#endif
+#ifndef _FIXED_HXX
+#include <vcl/fixed.hxx>
+#endif
+#include <svtools/ctrlbox.hxx>
+/*--------------------------------------------------------------------
+ Description: TabPage Format/(Styles/)Page/Text grid
+ --------------------------------------------------------------------*/
+
+class SwTextGridPage: public SfxTabPage
+{
+ FixedLine aGridTypeFL;
+ RadioButton aNoGridRB;
+ RadioButton aLinesGridRB;
+ RadioButton aCharsGridRB;
+ CheckBox aSnapToCharsCB;
+
+ SwPageGridExample aExampleWN;
+
+ FixedLine aLayoutFL;
+
+ FixedText aLinesPerPageFT;
+ NumericField aLinesPerPageNF;
+
+ FixedText aTextSizeFT;
+ MetricField aTextSizeMF;
+
+ FixedText aCharsPerLineFT;
+ NumericField aCharsPerLineNF;
+
+ FixedText aCharWidthFT;
+ MetricField aCharWidthMF;
+
+ FixedText aRubySizeFT;
+ MetricField aRubySizeMF;
+
+ CheckBox aRubyBelowCB;
+
+ FixedLine aDisplayFL;
+
+ CheckBox aDisplayCB;
+ CheckBox aPrintCB;
+ FixedText aColorFT;
+ ColorListBox aColorLB;
+
+ Window* aControls[18];
+
+ sal_Int32 m_nRubyUserValue;
+ sal_Bool m_bRubyUserValue;
+ Size m_aPageSize;
+ sal_Bool m_bVertical;
+ sal_Bool m_bSquaredMode;
+
+ SwTextGridPage(Window *pParent, const SfxItemSet &rSet);
+ ~SwTextGridPage();
+
+ void UpdatePageSize(const SfxItemSet& rSet);
+ void PutGridItem(SfxItemSet& rSet);
+
+ DECL_LINK(GridTypeHdl, RadioButton*);
+ DECL_LINK(CharorLineChangedHdl, SpinField*);
+ DECL_LINK(TextSizeChangedHdl, SpinField*);
+ DECL_LINK(GridModifyHdl, void*);
+ DECL_LINK(DisplayGridHdl, CheckBox*);
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+public:
+ static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet(SfxItemSet &rSet);
+ virtual void Reset(const SfxItemSet &rSet);
+
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+};
+
+#endif
diff --git a/sw/source/ui/inc/popbox.hxx b/sw/source/ui/inc/popbox.hxx
new file mode 100644
index 000000000000..bc9fa1855287
--- /dev/null
+++ b/sw/source/ui/inc/popbox.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _POPBOX_HXX
+#define _POPBOX_HXX
+
+
+#ifndef _TOOLBOX_HXX
+#include <vcl/toolbox.hxx>
+#endif
+#include <svtools/transfer.hxx>
+
+class SwNavigationPI;
+
+class SwHelpToolBox: public ToolBox, public DropTargetHelper
+{
+ Link aDoubleClickLink;
+ Link aRightClickLink; // Link bekommt MouseEvent als Parameter !!!
+
+ using ToolBox::DoubleClick;
+
+protected:
+ virtual void MouseButtonDown(const MouseEvent &rEvt);
+ virtual long DoubleClick(ToolBox *);
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+public:
+ SwHelpToolBox(SwNavigationPI* pParent, const ResId &);
+ ~SwHelpToolBox();
+ void SetDoubleClickLink(const Link &); // inline
+ void SetRightClickLink(const Link &); // inline
+};
+
+inline void SwHelpToolBox::SetDoubleClickLink(const Link &rLink) {
+ aDoubleClickLink = rLink;
+}
+
+inline void SwHelpToolBox::SetRightClickLink(const Link &rLink) {
+ aRightClickLink = rLink;
+}
+
+
+#endif
diff --git a/sw/source/ui/inc/popup.hrc b/sw/source/ui/inc/popup.hrc
new file mode 100644
index 000000000000..62f210938a36
--- /dev/null
+++ b/sw/source/ui/inc/popup.hrc
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _POPUP_HRC
+#define _POPUP_HRC
+
+#include "rcid.hrc"
+
+#define MN_TEXT_POPUPMENU (RC_POPUPS_BEGIN + 0)
+#define MN_TAB_POPUPMENU (RC_POPUPS_BEGIN + 1)
+#define MN_FRM_POPUPMENU (RC_POPUPS_BEGIN + 2)
+#define MN_DRAW_POPUPMENU (RC_POPUPS_BEGIN + 3)
+#define MN_DRWTXT_POPUPMENU (RC_POPUPS_BEGIN + 4)
+#define MN_GRF_POPUPMENU (RC_POPUPS_BEGIN + 5)
+#define MN_OLE_POPUPMENU (RC_POPUPS_BEGIN + 6)
+#define MN_PPREVIEW_POPUPMENU (RC_POPUPS_BEGIN + 7)
+#define MN_SRCVIEW_POPUPMENU (RC_POPUPS_BEGIN + 8)
+#define MN_DRAWFORM_POPUPMENU (RC_POPUPS_BEGIN + 9)
+#define MN_MEDIA_POPUPMENU (RC_POPUPS_BEGIN + 10)
+#define MN_LANGUAGE_FOR_TEXT (RC_POPUPS_BEGIN + 11)
+#define MN_LANGUAGE_FOR_PARAGRAPH (RC_POPUPS_BEGIN + 12)
+#define MN_LANGUAGE_FOR_DOCUMENT (RC_POPUPS_BEGIN + 13)
+#define MN_ANNOTATION_POPUPMENU (RC_POPUPS_BEGIN + 14)
+#define MN_ANNOTATION_BUTTON (RC_POPUPS_BEGIN + 15)
+#define MN_REDCOMMENT_POPUPMENU (RC_POPUPS_BEGIN + 16)
+#define MN_REDCOMMENT_BUTTON (RC_POPUPS_BEGIN + 17)
+
+#if MN_MEDIA_POPUPMENU > RC_POPUPS_END
+
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+
+#endif // _POPUP_HRC
diff --git a/sw/source/ui/inc/prcntfld.hxx b/sw/source/ui/inc/prcntfld.hxx
new file mode 100644
index 000000000000..e506f31de708
--- /dev/null
+++ b/sw/source/ui/inc/prcntfld.hxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _PRCNTFLD_HXX
+#define _PRCNTFLD_HXX
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#include "swdllapi.h"
+
+class SW_DLLPUBLIC PercentField : public MetricField
+{
+ sal_Int64 nRefValue; // 100%-Wert fuer Umrechnung (in Twips)
+ sal_Int64 nOldMax;
+ sal_Int64 nOldMin;
+ sal_Int64 nOldSpinSize;
+ sal_Int64 nOldBaseValue;
+ sal_Int64 nLastPercent;
+ sal_Int64 nLastValue;
+ USHORT nOldDigits;
+ FieldUnit eOldUnit;
+ sal_Bool bLockAutoCalculation; //prevent recalcution of percent values when the
+ //reference value is changed
+
+ SW_DLLPRIVATE sal_Int64 ImpPower10(USHORT n);
+
+ using MetricField::SetValue;
+ using MetricField::GetValue;
+ using MetricFormatter::SetUserValue;
+ using MetricFormatter::SetBaseValue;
+ using MetricFormatter::SetMax;
+ using MetricFormatter::SetMin;
+ using NumericFormatter::IsValueModified;
+
+public:
+
+ virtual void SetValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
+
+ PercentField( Window* pWin, const ResId& rResId );
+
+ void SetPrcntValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
+
+ void SetUserValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
+
+ void SetBaseValue(sal_Int64 nNewValue, FieldUnit eInUnit = FUNIT_NONE);
+
+ sal_Int64 GetValue(FieldUnit eOutUnit = FUNIT_NONE);
+
+ BOOL IsValueModified();
+
+ //using NumericFormatter::SetMax;
+ void SetMax(sal_Int64 nNewMax, FieldUnit eInUnit = FUNIT_NONE);
+
+ //using NumericFormatter::SetMin;
+ void SetMin(sal_Int64 nNewMin, FieldUnit eInUnit = FUNIT_NONE);
+
+ sal_Int64 NormalizePercent(sal_Int64 nValue);
+ sal_Int64 DenormalizePercent(sal_Int64 nValue);
+
+ void SetRefValue(sal_Int64 nValue);
+ inline sal_Int64 GetRefValue() const { return nRefValue; }
+ sal_Int64 GetRealValue(FieldUnit eOutUnit = FUNIT_NONE);
+
+ sal_Int64 Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit);
+
+ void ShowPercent(BOOL bPercent);
+
+ USHORT GetOldDigits() const {return nOldDigits;}
+
+ void LockAutoCalculation(sal_Bool bLock) {bLockAutoCalculation = bLock;}
+ sal_Bool IsAutoCalculationLocked()const {return bLockAutoCalculation;}
+};
+
+#endif // _PRCNTFLD_HXX
+
diff --git a/sw/source/ui/inc/pview.hxx b/sw/source/ui/inc/pview.hxx
new file mode 100644
index 000000000000..2b1c9366707e
--- /dev/null
+++ b/sw/source/ui/inc/pview.hxx
@@ -0,0 +1,336 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWPVIEW_HXX
+#define _SWPVIEW_HXX
+
+#include <tools/link.hxx>
+#include <vcl/window.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/viewfac.hxx>
+#include <sfx2/viewsh.hxx>
+#include <svx/zoomitem.hxx>
+#include "swdllapi.h"
+#include "shellid.hxx"
+
+class SwViewOption;
+class SwDocShell;
+class SwScrollbar;
+class ViewShell;
+class SwPagePreView;
+class ImageButton;
+class Button;
+class SwRect;
+class DataChangedEvent;
+class CommandEvent;
+class SvtAccessibilityOptions;
+// OD 12.12.2002 #103492#
+class SwPagePreviewLayout;
+
+// OD 24.03.2003 #108282# - delete member <mnVirtPage> and its accessor.
+class SwPagePreViewWin : public Window
+{
+ ViewShell* mpViewShell;
+ USHORT mnSttPage;
+ BYTE mnRow, mnCol;
+ Size maPxWinSize;
+ Fraction maScale;
+ SwPagePreView& mrView;
+ // OD 02.12.2002 #103492#
+ bool mbCalcScaleForPreviewLayout;
+ Rectangle maPaintedPreviewDocRect;
+ // OD 12.12.2002 #103492#
+ SwPagePreviewLayout* mpPgPrevwLayout;
+
+ void SetPagePreview( BYTE nRow, BYTE nCol );
+
+ using Window::Scroll;
+
+public:
+ SwPagePreViewWin( Window* pParent, SwPagePreView& rView );
+ ~SwPagePreViewWin();
+
+ //Ruft ViewShell::Paint
+ virtual void Paint( const Rectangle& rRect );
+ virtual void KeyInput( const KeyEvent & );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void MouseButtonDown(const MouseEvent& rMEvt);
+ virtual void DataChanged( const DataChangedEvent& );
+
+ void SetViewShell( ViewShell* pShell );
+
+ ViewShell* GetViewShell() const { return mpViewShell; }
+
+ BYTE GetRow() const { return mnRow; }
+ void SetRow( BYTE n ) { if( n ) mnRow = n; }
+
+ BYTE GetCol() const { return mnCol; }
+ void SetCol( BYTE n ) { if( n ) mnCol = n; }
+
+ USHORT GetSttPage() const { return mnSttPage; }
+ void SetSttPage( USHORT n ) { mnSttPage = n; }
+
+ /** get selected page number of document preview
+
+ OD 13.12.2002 #103492#
+
+ @author OD
+
+ @return selected page number
+ */
+ sal_uInt16 SelectedPage() const;
+
+ /** set selected page number in document preview
+
+ OD 13.12.2002 #103492#
+
+ @author OD
+
+ @param _nSelectedPageNum
+ input parameter - physical page number of page that will be the selected one.
+ */
+ void SetSelectedPage( sal_uInt16 _nSelectedPageNum );
+
+ //JP 19.08.98: bei Einspaltigkeit gibt es keine 0. Seite!
+ USHORT GetDefSttPage() const { return 1 == mnCol ? 1 : 0; }
+
+ void CalcWish( BYTE nNewRow, BYTE nNewCol );
+
+ const Size& GetWinSize() const { return maPxWinSize; }
+ void SetWinSize( const Size& rNewSize );
+
+ // OD 18.12.2002 #103492# - add <MV_SELPAGE>, <MV_SCROLL>
+ enum MoveMode{ MV_CALC, MV_PAGE_UP, MV_PAGE_DOWN, MV_DOC_STT, MV_DOC_END,
+ MV_SELPAGE, MV_SCROLL, MV_NEWWINSIZE };
+ int MovePage( int eMoveMode );
+
+ // erzeuge den String fuer die StatusLeiste
+ void GetStatusStr( String& rStr, USHORT nPageCount ) const;
+
+ void RepaintCoreRect( const SwRect& rRect );
+
+ /** method to adjust preview to a new zoom factor
+
+ OD 02.12.2002 #103492#
+ paint of preview is prepared for a new zoom factor
+ OD 24.09.2003 #i19975# - zoom type has also been considered.
+ Thus, add new parameter <_eZoomType>
+
+ @author OD
+ */
+ void AdjustPreviewToNewZoom( const sal_uInt16 _nZoomFactor,
+ const SvxZoomType _eZoomType );
+
+ const Rectangle& GetPaintedPreviewDocRect() const
+ {
+ return maPaintedPreviewDocRect;
+ }
+
+ void Scroll(long nXMove, long nYMove, USHORT nFlags = 0);
+
+ /** method to enable/disable book preview
+
+ OD 2004-03-05 #i18143#
+
+ @author OD
+
+ @param _bBookPreview
+ input parameter - boolean indicating, if book preview mode has to
+ switch on <TRUE> or of <FALSE>
+
+ @return boolean indicating, if book preview mode has changed.
+ */
+ bool SetBookPreviewMode( const bool _bBookPreview );
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>
+ CreateAccessible();
+};
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sicht auf ein Dokument
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwPagePreView: public SfxViewShell
+{
+ // ViewWindow und Henkel zur Core
+ // aktuelle Dispatcher-Shell
+ SwPagePreViewWin aViewWin;
+ //viewdata of the previous SwView and the new crsrposition
+ String sSwViewData,
+ //and the new cursor position if the user double click in the PagePreView
+ sNewCrsrPos;
+ // to support keyboard the number of the page to go to can be set too
+ USHORT nNewPage;
+ // Sichtbarer Bereich
+ String sPageStr;
+ Size aDocSz;
+ Rectangle aVisArea;
+
+ // MDI Bedienelemente
+ SwScrollbar *pHScrollbar;
+ SwScrollbar *pVScrollbar;
+ ImageButton *pPageUpBtn,
+ *pPageDownBtn;
+ // Dummy-Window zum F�llen der rechten unteren Ecke, wenn beide Scrollbars
+ // aktiv sind
+ Window *pScrollFill;
+
+ USHORT mnPageCount;
+ BOOL bNormalPrint;
+
+ // OD 09.01.2003 #106334#
+ // new members to reset design mode at draw view for form shell on switching
+ // back from writer page preview to normal view.
+ sal_Bool mbResetFormDesignMode:1;
+ sal_Bool mbFormDesignModeToReset:1;
+
+ SW_DLLPRIVATE void Init(const SwViewOption* = 0);
+ SW_DLLPRIVATE Point AlignToPixel(const Point& rPt) const;
+
+ SW_DLLPRIVATE int _CreateScrollbar( BOOL bHori );
+ SW_DLLPRIVATE DECL_LINK( ScrollHdl, SwScrollbar * );
+ SW_DLLPRIVATE DECL_LINK( EndScrollHdl, SwScrollbar * );
+ SW_DLLPRIVATE DECL_LINK( BtnPage, Button * );
+ SW_DLLPRIVATE int ChgPage( int eMvMode, int bUpdateScrollbar = TRUE );
+
+
+ SW_DLLPRIVATE virtual SfxPrinter* GetPrinter( BOOL bCreate = FALSE );
+ SW_DLLPRIVATE virtual USHORT SetPrinter( SfxPrinter *pNewPrinter, USHORT nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false );
+ SW_DLLPRIVATE virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent,
+ const SfxItemSet &rOptions );
+
+ SW_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill, BOOL bInner );
+
+ /** help method to execute SfxRequest FN_PAGE_UP and FN_PAGE_DOWN
+
+ OD 04.03.2003 #107369#
+
+ @param _bPgUp
+ input parameter - boolean that indicates, if FN_PAGE_UP or FN_PAGE_DOWN
+ has to be executed.
+
+ @param _pReq
+ optional input parameter - pointer to the <SfxRequest> instance, if existing.
+
+ @author OD
+ */
+ SW_DLLPRIVATE void _ExecPgUpAndPgDown( const bool _bPgUp,
+ SfxRequest* _pReq = 0 );
+
+protected:
+ virtual void InnerResizePixel( const Point &rOfs, const Size &rSize );
+ virtual void OuterResizePixel( const Point &rOfs, const Size &rSize );
+ virtual Size GetOptimalSizePixel() const;
+
+ void SetZoom(SvxZoomType eSet, USHORT nFactor);
+
+public:
+ SFX_DECL_VIEWFACTORY(SwPagePreView);
+ SFX_DECL_INTERFACE(SW_PAGEPREVIEW)
+ TYPEINFO();
+
+ inline Window* GetFrameWindow() const { return &(GetViewFrame())->GetWindow(); }
+ inline ViewShell* GetViewShell() const { return aViewWin.GetViewShell(); }
+ inline const Rectangle& GetVisArea() const { return aVisArea; }
+ inline void GrabFocusViewWin() { aViewWin.GrabFocus(); }
+ inline void RepaintCoreRect( const SwRect& rRect )
+ { aViewWin.RepaintCoreRect( rRect ); }
+
+ void DocSzChgd(const Size& rNewSize);
+ const Size& GetDocSz() const { return aDocSz; }
+
+ virtual void SetVisArea( const Rectangle&, BOOL bUpdateScrollbar = TRUE);
+
+ inline void AdjustEditWin();
+
+ void ScrollViewSzChg();
+ void ScrollDocSzChg();
+ void ShowHScrollbar(sal_Bool bShow);
+
+ void ShowVScrollbar(sal_Bool bShow);
+
+ USHORT GetPageCount() const { return mnPageCount; }
+
+ BOOL HandleWheelCommands( const CommandEvent& );
+
+ const String& GetPrevSwViewData() const { return sSwViewData; }
+ void SetNewCrsrPos( const String& rStr ) { sNewCrsrPos = rStr; }
+ const String& GetNewCrsrPos() const { return sNewCrsrPos; }
+
+ USHORT GetNewPage() const {return nNewPage;}
+ void SetNewPage(USHORT nSet) {nNewPage = nSet;}
+
+ // Handler
+ void Execute(SfxRequest&);
+ void GetState(SfxItemSet&);
+ void StateUndo(SfxItemSet&);
+
+ SwDocShell* GetDocShell();
+
+ //apply Accessiblity options
+ void ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions);
+
+ // OD 09.01.2003 #106334# - inline method to request values of new members
+ // <mbResetFormDesignMode> and <mbFormDesignModeToReset>
+ inline sal_Bool ResetFormDesignMode() const
+ {
+ return mbResetFormDesignMode;
+ }
+
+ inline sal_Bool FormDesignModeToReset() const
+ {
+ return mbFormDesignModeToReset;
+ }
+
+ /** adjust position of vertical scrollbar
+
+ OD 19.02.2003 #107369
+ Currently used, if the complete preview layout rows fit into to the given
+ window, if a new page is selected and this page is visible.
+
+ @author OD
+
+ @param _nNewThumbPos
+ input parameter - new position, which will be assigned to the vertical
+ scrollbar.
+ */
+ void SetVScrollbarThumbPos( const sal_uInt16 _nNewThumbPos );
+
+ SwPagePreView( SfxViewFrame* pFrame, SfxViewShell* );
+ ~SwPagePreView();
+};
+
+// ----------------- inline Methoden ----------------------
+
+
+inline void SwPagePreView::AdjustEditWin()
+{
+ OuterResizePixel( Point(), GetFrameWindow()->GetOutputSizePixel() );
+}
+
+#endif
diff --git a/sw/source/ui/inc/redlndlg.hxx b/sw/source/ui/inc/redlndlg.hxx
new file mode 100644
index 000000000000..152c17387072
--- /dev/null
+++ b/sw/source/ui/inc/redlndlg.hxx
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWREDLNDLG_HXX
+#define _SWREDLNDLG_HXX
+#include "swdllapi.h"
+#include "chldwrap.hxx"
+#include <redline.hxx>
+#include <tools/datetime.hxx>
+#include <vcl/msgbox.hxx>
+#ifndef _SVSTDARR_HXX
+#include <svl/svstdarr.hxx>
+#endif
+#include <svl/eitem.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/ctredlin.hxx>
+#include <svx/postattr.hxx>
+
+class SwChildWinWrapper;
+
+struct SwRedlineDataChild
+{
+ const SwRedlineData* pChild; // Verweis auf originale gestackte Daten
+ const SwRedlineDataChild* pNext; // Verweis auf gestackte Daten
+ SvLBoxEntry* pTLBChild; // zugehoeriger TreeListBox-Eintrag
+};
+
+struct SwRedlineDataParent
+{
+ const SwRedlineData* pData; // RedlineDataPtr
+ const SwRedlineDataChild* pNext; // Verweis auf gestackte Daten
+ SvLBoxEntry* pTLBParent; // zugehoeriger TreeListBox-Eintrag
+ String sComment; // Redline-Kommentar
+
+ inline BOOL operator==( const SwRedlineDataParent& rObj ) const
+ { return (pData && pData->GetSeqNo() == rObj.pData->GetSeqNo()); }
+ inline BOOL operator< ( const SwRedlineDataParent& rObj ) const
+ { return (pData && pData->GetSeqNo() < rObj.pData->GetSeqNo()); }
+};
+
+typedef SwRedlineDataParent* SwRedlineDataParentPtr;
+SV_DECL_PTRARR_DEL(SwRedlineDataParentArr, SwRedlineDataParentPtr, 10, 20)
+
+
+SV_DECL_PTRARR_SORT(SwRedlineDataParentSortArr, SwRedlineDataParentPtr, 10, 20)
+
+
+typedef SwRedlineDataChild* SwRedlineDataChildPtr;
+SV_DECL_PTRARR_DEL(SwRedlineDataChildArr, SwRedlineDataChildPtr, 4, 4)
+
+
+typedef SvLBoxEntry* SvLBoxEntryPtr;
+SV_DECL_PTRARR(SvLBoxEntryArr, SvLBoxEntryPtr, 100, 100)
+
+class SW_DLLPUBLIC SwRedlineAcceptDlg
+{
+ Dialog* pParentDlg;
+ SwRedlineDataParentArr aRedlineParents;
+ SwRedlineDataChildArr aRedlineChilds;
+ SwRedlineDataParentSortArr aUsedSeqNo;
+ SvxAcceptChgCtr aTabPagesCTRL;
+ PopupMenu aPopup;
+ Timer aDeselectTimer;
+ Timer aSelectTimer;
+ String sInserted;
+ String sDeleted;
+ String sFormated;
+ String sTableChgd;
+ String sFmtCollSet;
+ String sFilterAction;
+ String sAutoFormat;
+ Size aBorderSz;
+ SvxTPView* pTPView;
+ SvxRedlinTable* pTable; // PB 2006/02/02 #i48648 now SvHeaderTabListBox
+ Link aOldSelectHdl;
+ Link aOldDeselectHdl;
+ BOOL bOnlyFormatedRedlines;
+ BOOL bHasReadonlySel;
+ BOOL bRedlnAutoFmt;
+
+ // prevent update dialog data during longer operations (cf #102657#)
+ bool bInhibitActivate;
+
+ SW_DLLPRIVATE DECL_LINK( AcceptHdl, void* );
+ SW_DLLPRIVATE DECL_LINK( AcceptAllHdl, void* );
+ SW_DLLPRIVATE DECL_LINK( RejectHdl, void* );
+ SW_DLLPRIVATE DECL_LINK( RejectAllHdl, void* );
+ SW_DLLPRIVATE DECL_LINK( UndoHdl, void* );
+ SW_DLLPRIVATE DECL_LINK( DeselectHdl, void* );
+ SW_DLLPRIVATE DECL_LINK( SelectHdl, void* );
+ SW_DLLPRIVATE DECL_LINK( GotoHdl, void* );
+ SW_DLLPRIVATE DECL_LINK( CommandHdl, void* );
+
+ SW_DLLPRIVATE USHORT CalcDiff(USHORT nStart, BOOL bChild);
+ SW_DLLPRIVATE void InsertChilds(SwRedlineDataParent *pParent, const SwRedline& rRedln, const USHORT nAutoFmt);
+ SW_DLLPRIVATE void InsertParents(USHORT nStart, USHORT nEnd = USHRT_MAX);
+ SW_DLLPRIVATE void RemoveParents(USHORT nStart, USHORT nEnd);
+ SW_DLLPRIVATE void InitAuthors();
+
+ SW_DLLPRIVATE String GetRedlineText(const SwRedline& rRedln, DateTime &rDateTime, USHORT nStack = 0);
+ SW_DLLPRIVATE const String& GetActionText(const SwRedline& rRedln, USHORT nStack = 0);
+ SW_DLLPRIVATE USHORT GetRedlinePos( const SvLBoxEntry& rEntry) const;
+
+public:
+ SwRedlineAcceptDlg(Dialog *pParent, BOOL bAutoFmt = FALSE);
+ virtual ~SwRedlineAcceptDlg();
+
+ DECL_LINK( FilterChangedHdl, void *pDummy = 0 );
+
+ inline SvxAcceptChgCtr* GetChgCtrl() { return &aTabPagesCTRL; }
+ inline BOOL HasRedlineAutoFmt() const { return bRedlnAutoFmt; }
+
+ void Init(USHORT nStart = 0);
+ void CallAcceptReject( BOOL bSelect, BOOL bAccept );
+
+ void Initialize(const String &rExtraData);
+ void FillInfo(String &rExtraData) const;
+
+ virtual void Activate();
+ virtual void Resize();
+};
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+class SwModelessRedlineAcceptDlg : public SfxModelessDialog
+{
+ SwRedlineAcceptDlg* pImplDlg;
+ SwChildWinWrapper* pChildWin;
+
+ virtual void Resize();
+
+public:
+ SwModelessRedlineAcceptDlg(SfxBindings*, SwChildWinWrapper*, Window *pParent);
+ ~SwModelessRedlineAcceptDlg();
+
+ virtual void Activate();
+ virtual void FillInfo(SfxChildWinInfo&) const;
+ void Initialize (SfxChildWinInfo* pInfo);
+};
+
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+class SwRedlineAcceptChild : public SwChildWinWrapper
+{
+public:
+ SwRedlineAcceptChild( Window* ,
+ USHORT nId,
+ SfxBindings*,
+ SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW( SwRedlineAcceptChild );
+
+ virtual BOOL ReInitDlg(SwDocShell *pDocSh);
+};
+
+
+#endif
+
+
diff --git a/sw/source/ui/inc/regionsw.hxx b/sw/source/ui/inc/regionsw.hxx
new file mode 100644
index 000000000000..0237f560da09
--- /dev/null
+++ b/sw/source/ui/inc/regionsw.hxx
@@ -0,0 +1,336 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _REGIONSW_HXX
+#define _REGIONSW_HXX
+
+#include <hintids.hxx>
+#include <vcl/field.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/group.hxx>
+#include <svtools/svtreebx.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <sfx2/tabdlg.hxx>
+#include <editeng/brshitem.hxx>
+
+#include <condedit.hxx>
+#include <section.hxx>
+#include <fmtclds.hxx>
+#include <fmtftntx.hxx>
+#include <fmtclbl.hxx>
+#include <numberingtypelistbox.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <vcl/image.hxx>
+#include <svx/paraprev.hxx>
+#include <editeng/lrspitem.hxx>
+
+
+class SwWrtShell;
+class EditRegionDlg;
+
+namespace sfx2
+{
+ class DocumentInserter;
+ class FileDialogHelper;
+}
+
+/*************************************************************************
+ Dialog "Bereiche bearbeiten"
+*************************************************************************/
+
+class SectRepr;
+typedef SectRepr* SectReprPtr;
+SV_DECL_PTRARR_SORT( SectReprArr, SectReprPtr, 0, 4 )
+
+class SwEditRegionDlg : public SfxModalDialog
+{
+ FixedLine aNameFL;
+ Edit aCurName;
+ SvTreeListBox aTree;
+
+ FixedLine aLinkFL;
+ TriStateBox aFileCB;
+ CheckBox aDDECB;
+ FixedText aFileNameFT;
+ FixedText aDDECommandFT;
+ Edit aFileNameED;
+ PushButton aFilePB;
+ FixedText aSubRegionFT;
+ ComboBox aSubRegionED;
+ bool bSubRegionsFilled;
+
+ FixedLine aProtectFL;
+ TriStateBox aProtectCB;
+ CheckBox aPasswdCB;
+ PushButton aPasswdPB;
+
+ FixedLine aHideFL;
+ TriStateBox aHideCB;
+ FixedText aConditionFT;
+ ConditionEdit aConditionED;
+
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ FixedLine aPropertiesFL;
+ TriStateBox aEditInReadonlyCB;
+ // <--
+
+ OKButton aOK;
+ CancelButton aCancel;
+ PushButton aOptionsPB;
+ PushButton aDismiss;
+ HelpButton aHelp;
+ ImageList aImageIL;
+ ImageList aImageILH;
+
+ SwWrtShell& rSh;
+ SectReprArr aSectReprArr;
+ SvLBoxEntry* pAktEntry;
+ const SwSection* pCurrSect;
+ sfx2::DocumentInserter* m_pDocInserter;
+ Window* m_pOldDefDlgParent;
+
+ BOOL bDontCheckPasswd :1;
+ BOOL bWeb :1;
+
+
+ Image BuildBitmap(BOOL bProtect,BOOL bHidden,BOOL bHighContrast);
+
+ void RecurseList( const SwSectionFmt* pFmt, SvLBoxEntry* pEntry);
+ USHORT FindArrPos(const SwSectionFmt* pFmt);
+
+ DECL_LINK( GetFirstEntryHdl, SvTreeListBox * );
+ DECL_LINK( DeselectHdl, SvTreeListBox * );
+
+ DECL_LINK( OkHdl, CheckBox * );
+ DECL_LINK( NameEditHdl, Edit * );
+ DECL_LINK( ConditionEditHdl, Edit * );
+
+ DECL_LINK( ChangePasswdHdl, Button * );
+ DECL_LINK( ChangeProtectHdl, TriStateBox * );
+ DECL_LINK( ChangeHideHdl, TriStateBox * );
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ DECL_LINK( ChangeEditInReadonlyHdl, TriStateBox * );
+ // <--
+ DECL_LINK( ChangeDismissHdl, CheckBox * );
+ DECL_LINK( UseFileHdl, CheckBox* );
+ DECL_LINK( FileSearchHdl, PushButton* );
+ DECL_LINK( OptionsHdl, PushButton* );
+ DECL_LINK( FileNameHdl, Edit* );
+ DECL_LINK( DDEHdl, CheckBox* );
+ DECL_LINK( DlgClosedHdl, sfx2::FileDialogHelper* );
+ DECL_LINK( SubRegionEventHdl, VclWindowEvent * );
+
+ BOOL CheckPasswd(CheckBox* pBox = 0);
+
+public:
+ SwEditRegionDlg( Window* pParent, SwWrtShell& rWrtSh );
+ virtual ~SwEditRegionDlg();
+
+ void SelectSection(const String& rSectionName);
+
+};
+/*************************************************************************
+ Dialog "Bereich einfuegen"
+*************************************************************************/
+
+/* -----------------21.05.99 11:05-------------------
+ *
+ * --------------------------------------------------*/
+class SwInsertSectionTabPage : public SfxTabPage
+{
+ FixedLine aNameFL;
+ ComboBox aCurName;
+
+ FixedLine aLinkFL;
+ CheckBox aFileCB;
+ CheckBox aDDECB;
+ FixedText aDDECommandFT;
+ FixedText aFileNameFT;
+ Edit aFileNameED;
+ PushButton aFilePB;
+ FixedText aSubRegionFT;
+ ComboBox aSubRegionED;
+
+ FixedLine aProtectFL;
+ CheckBox aProtectCB;
+ CheckBox aPasswdCB;
+ PushButton aPasswdPB;
+
+ FixedLine aHideFL;
+ CheckBox aHideCB;
+ FixedText aConditionFT;
+ ConditionEdit aConditionED;
+
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ FixedLine aPropertiesFL;
+ CheckBox aEditInReadonlyCB;
+ // <--
+
+ String m_sFileName;
+ String m_sFilterName;
+ String m_sFilePasswd;
+
+// SwFmtCol* pCols;
+ ::com::sun::star::uno::Sequence <sal_Int8 > m_aNewPasswd;
+ SwWrtShell* m_pWrtSh;
+ sfx2::DocumentInserter* m_pDocInserter;
+ Window* m_pOldDefDlgParent;
+
+ DECL_LINK( ChangeHideHdl, CheckBox * );
+ // --> FME 2004-06-22 #114856# edit in readonly sections
+ DECL_LINK( ChangeEditInReadonlyHdl, CheckBox * );
+ // <--
+ DECL_LINK( ChangeProtectHdl, CheckBox * );
+ DECL_LINK( ChangePasswdHdl, Button * );
+ DECL_LINK( NameEditHdl, Edit * );
+ DECL_LINK( UseFileHdl, CheckBox* );
+ DECL_LINK( FileSearchHdl, PushButton* );
+ DECL_LINK( DDEHdl, CheckBox* );
+ DECL_LINK( DlgClosedHdl, sfx2::FileDialogHelper* );
+
+public:
+ SwInsertSectionTabPage(Window *pParent, const SfxItemSet &rAttrSet);
+ virtual ~SwInsertSectionTabPage();
+
+ void SetWrtShell(SwWrtShell& rSh);
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+};
+
+class SwSectionFtnEndTabPage : public SfxTabPage
+{
+ FixedLine aFtnFL;
+ CheckBox aFtnNtAtTextEndCB;
+
+ CheckBox aFtnNtNumCB;
+ FixedText aFtnOffsetLbl;
+ NumericField aFtnOffsetFld;
+
+ CheckBox aFtnNtNumFmtCB;
+ FixedText aFtnPrefixFT;
+ Edit aFtnPrefixED;
+ SwNumberingTypeListBox aFtnNumViewBox;
+ FixedText aFtnSuffixFT;
+ Edit aFtnSuffixED;
+
+ FixedLine aEndFL;
+ CheckBox aEndNtAtTextEndCB;
+
+ CheckBox aEndNtNumCB;
+ FixedText aEndOffsetLbl;
+ NumericField aEndOffsetFld;
+
+ CheckBox aEndNtNumFmtCB;
+ FixedText aEndPrefixFT;
+ Edit aEndPrefixED;
+ SwNumberingTypeListBox aEndNumViewBox;
+ FixedText aEndSuffixFT;
+ Edit aEndSuffixED;
+
+
+ DECL_LINK( FootEndHdl, CheckBox * );
+ void ResetState( BOOL bFtn, const SwFmtFtnEndAtTxtEnd& );
+
+public:
+ SwSectionFtnEndTabPage( Window *pParent, const SfxItemSet &rAttrSet );
+ virtual ~SwSectionFtnEndTabPage();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+};
+/* -----------------13.06.2003 09:51-----------------
+
+ --------------------------------------------------*/
+class SwSectionIndentTabPage : public SfxTabPage
+{
+ FixedLine aIndentFL;
+ FixedText aBeforeFT;
+ MetricField aBeforeMF;
+ FixedText aAfterFT;
+ MetricField aAfterMF;
+
+ SvxParaPrevWindow aPreviewWin;
+
+ DECL_LINK(IndentModifyHdl, MetricField*);
+public:
+ SwSectionIndentTabPage( Window *pParent, const SfxItemSet &rAttrSet );
+ virtual ~SwSectionIndentTabPage();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ void SetWrtShell(SwWrtShell& rSh);
+};
+
+/* -----------------21.05.99 13:07-------------------
+ *
+ * --------------------------------------------------*/
+class SwInsertSectionTabDialog : public SfxTabDialog
+{
+ SwWrtShell& rWrtSh;
+ ::std::auto_ptr<SwSectionData> m_pSectionData;
+
+protected:
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+ virtual short Ok();
+public:
+ SwInsertSectionTabDialog(Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh);
+ virtual ~SwInsertSectionTabDialog();
+
+ void SetSectionData(SwSectionData const& rSect);
+ SwSectionData * GetSectionData() { return m_pSectionData.get(); }
+};
+
+/* -----------------21.05.99 13:07-------------------
+ *
+ * --------------------------------------------------*/
+class SwSectionPropertyTabDialog : public SfxTabDialog
+{
+ SwWrtShell& rWrtSh;
+protected:
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+public:
+ SwSectionPropertyTabDialog(Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh);
+ virtual ~SwSectionPropertyTabDialog();
+};
+
+#endif
+
+
diff --git a/sw/source/ui/inc/ribbar.hrc b/sw/source/ui/inc/ribbar.hrc
new file mode 100644
index 000000000000..c9af820ba35b
--- /dev/null
+++ b/sw/source/ui/inc/ribbar.hrc
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _RIBBAR_HRC
+#define _RIBBAR_HRC
+
+#include "rcid.hrc"
+
+#define MN_FORM1 1 // Defines fuer NumNames-Popup
+#define MN_FORMBASE MN_FORM1
+#define MN_FORM2 2
+#define MN_FORM3 3
+#define MN_FORM4 4
+#define MN_FORM5 5
+
+#define WIN_RIBBAR RC_RIBBAR_BEGIN
+
+#define CB_FORMAT (RC_RIBBAR_BEGIN +1)
+#define CB_FONT (RC_RIBBAR_BEGIN +2)
+#define CB_SIZE (RC_RIBBAR_BEGIN +3)
+#define PB_FORMULA_OK (RC_RIBBAR_BEGIN +4)
+#define PB_FORMULA_CANCEL (RC_RIBBAR_BEGIN +5)
+#define BMP_OK PB_FORMULA_OK
+#define BMP_CANCEL PB_FORMULA_CANCEL
+#define RID_TBX_FORMULA (RC_RIBBAR_BEGIN +6)
+#define FT_POS (RC_RIBBAR_BEGIN +7)
+#define BT_FORMULA (RC_RIBBAR_BEGIN +8)
+#define STR_TBL_FORMULA (RC_RIBBAR_BEGIN +9)
+
+#define STR_BACKGROUND_PATTERN (RC_RIBBAR_BEGIN + 10)
+#define STR_BACKGROUND_COLOR (RC_RIBBAR_BEGIN + 11)
+#define STR_BORDER_COLOR (RC_RIBBAR_BEGIN + 12)
+#define STR_BORDER_STYLE (RC_RIBBAR_BEGIN + 13)
+#define STR_BORDER_LINE (RC_RIBBAR_BEGIN + 14)
+#define STR_TEXT_COLOR (RC_RIBBAR_BEGIN + 15)
+#define STR_NUMLIST (RC_RIBBAR_BEGIN + 16)
+
+#define STR_HELP_TOOLBOX_TOGGLE (RC_RIBBAR_BEGIN + 17)
+
+#define RID_DRAW_WIN (RC_RIBBAR_BEGIN + 18)
+#define RID_CNTRLR_WIN (RC_RIBBAR_BEGIN + 19)
+#define RID_ALIGNMENT_WIN (RC_RIBBAR_BEGIN + 20)
+
+//Resourcen fuer Inputwin (Rechenleiste)
+#define RID_WIN_FORMULA (RC_RIBBAR_BEGIN + 21)
+#define MN_CALC_POPUP (RC_RIBBAR_BEGIN + 22)
+
+#define MN_NUMNAMES_POPUP (RC_RIBBAR_BEGIN + 23)
+#define RID_INSERT_FIELD_CTRL (RC_RIBBAR_BEGIN + 26)
+#define RID_BEZIER_WIN (RC_RIBBAR_BEGIN + 28)
+#define RID_SCROLL_NAVI_TBX (RC_RIBBAR_BEGIN + 29)
+#define RID_SCROLL_NAVIGATION_WIN (RC_RIBBAR_BEGIN + 30)
+#define RID_PVIEW_ZOOM_LB (RC_RIBBAR_BEGIN + 31)
+
+#define STR_IMGBTN_START (RC_RIBBAR_BEGIN + 31)
+
+#define STR_IMGBTN_NEXT_DOWN (STR_IMGBTN_START + 0)
+#define STR_IMGBTN_PREV_DOWN (STR_IMGBTN_START + 1)
+#define STR_IMGBTN_TBL_DOWN (STR_IMGBTN_START + 2)
+#define STR_IMGBTN_FRM_DOWN (STR_IMGBTN_START + 3)
+#define STR_IMGBTN_PGE_DOWN (STR_IMGBTN_START + 4)
+#define STR_IMGBTN_DRW_DOWN (STR_IMGBTN_START + 5)
+#define STR_IMGBTN_CTRL_DOWN (STR_IMGBTN_START + 6)
+#define STR_IMGBTN_REG_DOWN (STR_IMGBTN_START + 7)
+#define STR_IMGBTN_BKM_DOWN (STR_IMGBTN_START + 8)
+#define STR_IMGBTN_GRF_DOWN (STR_IMGBTN_START + 9)
+#define STR_IMGBTN_OLE_DOWN (STR_IMGBTN_START +10)
+#define STR_IMGBTN_OUTL_DOWN (STR_IMGBTN_START +11)
+#define STR_IMGBTN_SEL_DOWN (STR_IMGBTN_START +12)
+#define STR_IMGBTN_FTN_DOWN (STR_IMGBTN_START +13)
+#define STR_IMGBTN_MARK_DOWN (STR_IMGBTN_START +14)
+#define STR_IMGBTN_POSTIT_DOWN (STR_IMGBTN_START +15)
+#define STR_IMGBTN_SRCH_REP_DOWN (STR_IMGBTN_START +16)
+#define STR_IMGBTN_INDEX_ENTRY_DOWN (STR_IMGBTN_START +17)
+#define STR_IMGBTN_TBLFML_DOWN (STR_IMGBTN_START +18)
+#define STR_IMGBTN_TBLFML_ERR_DOWN (STR_IMGBTN_START +19)
+
+#define STR_IMGBTN_NEXT_UP (STR_IMGBTN_START +20)
+#define STR_IMGBTN_PREV_UP (STR_IMGBTN_START +21)
+#define STR_IMGBTN_TBL_UP (STR_IMGBTN_START +22)
+#define STR_IMGBTN_FRM_UP (STR_IMGBTN_START +23)
+#define STR_IMGBTN_PGE_UP (STR_IMGBTN_START +24)
+#define STR_IMGBTN_DRW_UP (STR_IMGBTN_START +25)
+#define STR_IMGBTN_CTRL_UP (STR_IMGBTN_START +26)
+#define STR_IMGBTN_REG_UP (STR_IMGBTN_START +27)
+#define STR_IMGBTN_BKM_UP (STR_IMGBTN_START +28)
+#define STR_IMGBTN_GRF_UP (STR_IMGBTN_START +29)
+#define STR_IMGBTN_OLE_UP (STR_IMGBTN_START +30)
+#define STR_IMGBTN_OUTL_UP (STR_IMGBTN_START +31)
+#define STR_IMGBTN_SEL_UP (STR_IMGBTN_START +32)
+#define STR_IMGBTN_FTN_UP (STR_IMGBTN_START +33)
+#define STR_IMGBTN_MARK_UP (STR_IMGBTN_START +34)
+#define STR_IMGBTN_POSTIT_UP (STR_IMGBTN_START +35)
+#define STR_IMGBTN_SRCH_REP_UP (STR_IMGBTN_START +36)
+#define STR_IMGBTN_INDEX_ENTRY_UP (STR_IMGBTN_START +37)
+#define STR_IMGBTN_TBLFML_UP (STR_IMGBTN_START +38)
+#define STR_IMGBTN_TBLFML_ERR_UP (STR_IMGBTN_START +39)
+
+#define BTN_NAVI (STR_IMGBTN_START +40)
+
+#define MN_ANCHOR_POPUP (STR_IMGBTN_START +41)
+
+#define RC_RIBBAR_ACT_END MN_ANCHOR_POPUP
+
+#if RC_RIBBAR_ACT_END > RC_RIBBAR_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#endif
diff --git a/sw/source/ui/inc/rowht.hxx b/sw/source/ui/inc/rowht.hxx
new file mode 100644
index 000000000000..e4b497246cd7
--- /dev/null
+++ b/sw/source/ui/inc/rowht.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ROWHT_HXX
+#define _ROWHT_HXX
+
+#include <svx/stddlg.hxx>
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+class SwWrtShell;
+
+class SwTableHeightDlg : public SvxStandardDialog
+{
+ MetricField aHeightEdit;
+ CheckBox aAutoHeightCB;
+ FixedLine aHeightFL;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+ SwWrtShell &rSh;
+
+protected:
+ virtual void Apply();
+
+public:
+ SwTableHeightDlg( Window *pParent, SwWrtShell &rS );
+};
+
+#endif
diff --git a/sw/source/ui/inc/scroll.hxx b/sw/source/ui/inc/scroll.hxx
new file mode 100644
index 000000000000..80c57767fbe2
--- /dev/null
+++ b/sw/source/ui/inc/scroll.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SCROLL_HXX
+#define _SCROLL_HXX
+#ifndef _SCRBAR_HXX //autogen
+#include <vcl/scrbar.hxx>
+#endif
+
+class SwScrollbar: public ScrollBar
+{
+ Size aDocSz;
+ BOOL bHori :1; // Horizontal = TRUE, sonst Vertikal
+ BOOL bAuto :1; // fuer Scrollingmode
+ BOOL bThumbEnabled:1;
+ BOOL bVisible :1; // Show/Hide sollen nur noch dieses Flag setzen
+ BOOL bSizeSet :1; // wurde die Groesse bereits gesetzt?
+
+ void AutoShow();
+
+ using Window::Hide;
+ using Window::SetPosSizePixel;
+ using Window::IsVisible;
+
+public:
+
+ void ExtendedShow( BOOL bVisible = TRUE );
+ void Hide() { Show( FALSE ); }
+ void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize );
+ BOOL IsVisible(BOOL bReal) const { return bReal ? ScrollBar::IsVisible() : bVisible; }
+
+ // Aenderung der Dokumentgroesse
+ void DocSzChgd(const Size &rNewSize);
+ // Aenderung des sichtbaren Bereiches
+ void ViewPortChgd(const Rectangle &rRectangle);
+ // was fuer einer ist es denn ??
+ BOOL IsHoriScroll() const { return bHori; }
+
+ void SetAuto(BOOL bSet);
+ BOOL IsAuto() { return bAuto;}
+
+ SwScrollbar(Window *pParent, BOOL bHori = TRUE );
+ ~SwScrollbar();
+};
+
+
+
+#endif
diff --git a/sw/source/ui/inc/selglos.hxx b/sw/source/ui/inc/selglos.hxx
new file mode 100644
index 000000000000..1fa693691086
--- /dev/null
+++ b/sw/source/ui/inc/selglos.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SELGLOS_HXX
+#define _SELGLOS_HXX
+
+#ifndef _DIALOG_HXX //autogen
+#include <vcl/dialog.hxx>
+#endif
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#include <vcl/fixed.hxx>
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+class SwSelGlossaryDlg : public ModalDialog
+{
+protected:
+ ListBox aGlosBox;
+ FixedLine aGlosFL;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+ DECL_LINK(DoubleClickHdl, ListBox*);
+public:
+ SwSelGlossaryDlg(Window * pParent, const String &rShortName);
+ ~SwSelGlossaryDlg();
+ void InsertGlos(const String &rRegion, const String &rGlosName); // inline
+ USHORT GetSelectedIdx() const; // inline
+ void SelectEntryPos(USHORT nIdx); // inline
+};
+
+inline void SwSelGlossaryDlg::InsertGlos(const String &rRegion,
+ const String &rGlosName)
+{
+ String aTmp( rRegion );
+ aTmp += ':';
+ aTmp += rGlosName;
+ aGlosBox.InsertEntry( aTmp );
+}
+inline USHORT SwSelGlossaryDlg::GetSelectedIdx() const
+{ return aGlosBox.GetSelectEntryPos(); }
+inline void SwSelGlossaryDlg::SelectEntryPos(USHORT nIdx)
+{ aGlosBox.SelectEntryPos(nIdx); }
+
+#endif
diff --git a/sw/source/ui/inc/sharedconnection.hxx b/sw/source/ui/inc/sharedconnection.hxx
new file mode 100644
index 000000000000..cbb6f41d17ad
--- /dev/null
+++ b/sw/source/ui/inc/sharedconnection.hxx
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_UI_SHARED_CONNECTION_HXX
+#define SW_UI_SHARED_CONNECTION_HXX
+
+#include <unotools/sharedunocomponent.hxx>
+#include <com/sun/star/sdbc/XConnection.hpp>
+
+typedef ::utl::SharedUNOComponent< ::com::sun::star::sdbc::XConnection > SharedConnection;
+
+#endif // SW_UI_SHARED_CONNECTION_HXX
diff --git a/sw/source/ui/inc/shdwcrsr.hxx b/sw/source/ui/inc/shdwcrsr.hxx
new file mode 100644
index 000000000000..fc95e36de5e7
--- /dev/null
+++ b/sw/source/ui/inc/shdwcrsr.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SHDWCRSR_HXX
+#define _SHDWCRSR_HXX
+
+
+#include <tools/gen.hxx>
+#include <tools/color.hxx>
+#include <limits.h>
+
+class Window;
+
+class SwShadowCursor
+{
+ Window* pWin;
+ Color aCol;
+ Point aOldPt;
+ long nOldHeight;
+ USHORT nOldMode;
+
+ void DrawTri( const Point& rPt, long nHeight, BOOL bLeft );
+ void DrawCrsr( const Point& rPt, long nHeight, USHORT nMode );
+
+public:
+ SwShadowCursor( Window& rWin, const Color& rCol )
+ : pWin( &rWin ), aCol( rCol ), nOldHeight(0), nOldMode( USHRT_MAX ) {}
+ ~SwShadowCursor();
+
+ void SetPos( const Point& rPt, long nHeight, USHORT nMode );
+
+ void Paint();
+
+ const Point& GetPoint() const { return aOldPt; }
+ long GetHeight() const { return nOldHeight; }
+ USHORT GetMode() const { return nOldMode; }
+
+ Rectangle GetRect() const;
+};
+
+
+
+#endif
+
diff --git a/sw/source/ui/inc/shells.hrc b/sw/source/ui/inc/shells.hrc
new file mode 100644
index 000000000000..2058b6432ed8
--- /dev/null
+++ b/sw/source/ui/inc/shells.hrc
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SHELLS_HRC
+#define _SHELLS_HRC
+
+#include "rcid.hrc"
+
+#define STR_GRFILTER_OPENERROR (RC_SHELLS_BEGIN + 1)
+#define STR_GRFILTER_IOERROR (RC_SHELLS_BEGIN + 2)
+#define STR_GRFILTER_FORMATERROR (RC_SHELLS_BEGIN + 3)
+#define STR_GRFILTER_VERSIONERROR (RC_SHELLS_BEGIN + 4)
+#define STR_GRFILTER_FILTERERROR (RC_SHELLS_BEGIN + 5)
+#define STR_GRFILTER_TOOBIG (RC_SHELLS_BEGIN + 6)
+#define STR_INSERT_GRAPHIC (RC_SHELLS_BEGIN + 7)
+#define STR_NOTIZ_INSERT (RC_SHELLS_BEGIN + 8)
+#define DLG_IMPORT_DBNAME (RC_SHELLS_BEGIN + 9)
+#define STR_NO_ADDRESSBOOK (RC_SHELLS_BEGIN + 10)
+#define STR_REDLINE_COMMENT (RC_SHELLS_BEGIN + 11)
+#define STR_REDLINE_INSERTED (RC_SHELLS_BEGIN + 12)
+#define STR_REDLINE_DELETED (RC_SHELLS_BEGIN + 13)
+#define STR_REDLINE_FMTCOLLSET (RC_SHELLS_BEGIN + 14)
+
+#define RID_TEXT_TOOLBOX (RC_SHELLS_BEGIN + 15)
+#define RID_TABLE_TOOLBOX (RC_SHELLS_BEGIN + 16)
+#define RID_FRAME_TOOLBOX (RC_SHELLS_BEGIN + 17)
+#define RID_GRAFIK_TOOLBOX (RC_SHELLS_BEGIN + 18)
+#define RID_DRAW_TOOLBOX (RC_SHELLS_BEGIN + 19)
+#define RID_DRAW_TEXT_TOOLBOX (RC_SHELLS_BEGIN + 20)
+#define RID_NUM_TOOLBOX (RC_SHELLS_BEGIN + 21)
+#define RID_OLE_TOOLBOX (RC_SHELLS_BEGIN + 22)
+#define RID_TOOLS_TOOLBOX (RC_SHELLS_BEGIN + 23)
+
+#define STR_SHELLNAME_TEXT (RC_SHELLS_BEGIN + 24)
+#define STR_SHELLNAME_TABLE (RC_SHELLS_BEGIN + 25)
+#define STR_SHELLNAME_FRAME (RC_SHELLS_BEGIN + 26)
+#define STR_SHELLNAME_GRAPHIC (RC_SHELLS_BEGIN + 27)
+#define STR_SHELLNAME_OBJECT (RC_SHELLS_BEGIN + 28)
+#define STR_SHELLNAME_LIST (RC_SHELLS_BEGIN + 29)
+#define STR_SHELLNAME_DRAW (RC_SHELLS_BEGIN + 30)
+#define STR_SHELLNAME_DRAW_TEXT (RC_SHELLS_BEGIN + 31)
+#define STR_SHELLNAME_MEDIA (RC_SHELLS_BEGIN + 32)
+
+
+#define RID_BEZIER_TOOLBOX (RC_SHELLS_BEGIN + 33)
+#define STR_SHELLNAME_BEZIER (RC_SHELLS_BEGIN + 34)
+
+#define STR_SWBG_PARAGRAPH (RC_SHELLS_BEGIN + 37)
+#define STR_SWBG_GRAPHIC (RC_SHELLS_BEGIN + 38)
+#define STR_SWBG_OLE (RC_SHELLS_BEGIN + 39)
+#define STR_SWBG_FRAME (RC_SHELLS_BEGIN + 40)
+#define STR_SWBG_TABLE (RC_SHELLS_BEGIN + 41)
+#define STR_SWBG_TABLE_ROW (RC_SHELLS_BEGIN + 42)
+#define STR_SWBG_TABLE_CELL (RC_SHELLS_BEGIN + 43)
+#define STR_SWBG_PAGE (RC_SHELLS_BEGIN + 44)
+#define STR_SWBG_HEADER (RC_SHELLS_BEGIN + 45)
+#define STR_SWBG_FOOTER (RC_SHELLS_BEGIN + 46)
+#define MSG_NO_RULER (RC_SHELLS_BEGIN + 47)
+
+#define STR_SHELLNAME_DRAWFORM (RC_SHELLS_BEGIN + 48)
+ // FREE
+
+#define STR_REDLINE_FORMATED (RC_SHELLS_BEGIN + 50)
+#define STR_REDLINE_TABLECHG (RC_SHELLS_BEGIN + 51)
+
+#define STR_REDLINE_TITLE (RC_SHELLS_BEGIN + 52)
+#define STR_REDLINE_MSG (RC_SHELLS_BEGIN + 53)
+#define STR_REDLINE_ACCEPT_ALL (RC_SHELLS_BEGIN + 54)
+#define STR_REDLINE_REJECT_ALL (RC_SHELLS_BEGIN + 55)
+#define STR_REDLINE_EDIT (RC_SHELLS_BEGIN + 56)
+#define STR_REDLINE_AUTOFMT (RC_SHELLS_BEGIN + 57)
+
+// #i68101# no longer needed
+// #define STR_NAME_SHAPE_LABEL (RC_SHELLS_BEGIN + 58)
+// #define STR_NAME_SHAPE_DIALOG (RC_SHELLS_BEGIN + 59)
+
+#define RID_MODULE_TOOLBOX (RC_SHELLS_BEGIN + 60)
+
+#define RID_MEDIA_TOOLBOX (RC_SHELLS_BEGIN + 61)
+
+#define SHELLS_ACT_END RID_MEDIA_TOOLBOX
+
+#if SHELLS_ACT_END > RC_SHELLS_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#endif
+
diff --git a/sw/source/ui/inc/split.hxx b/sw/source/ui/inc/split.hxx
new file mode 100644
index 000000000000..eafe394d2b27
--- /dev/null
+++ b/sw/source/ui/inc/split.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TAB_SPLIT_HXX
+#define _TAB_SPLIT_HXX
+
+#include <svx/stddlg.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+
+#ifndef _IMAGEBTN_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+class SwWrtShell;
+
+class SwSplitTableDlg : public SvxStandardDialog
+{
+ FixedText aCountLbl;
+ NumericField aCountEdit;
+ FixedLine aCountFL;
+ ImageRadioButton aHorzBox;
+ ImageRadioButton aVertBox;
+ CheckBox aPropCB;
+ FixedLine aDirFL;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+ SwWrtShell& rSh;
+
+protected:
+ virtual void Apply();
+
+public:
+ SwSplitTableDlg(Window *pParent, SwWrtShell& rShell );
+ DECL_LINK( ClickHdl, Button * );
+
+ BOOL IsHorizontal() const { return aHorzBox.IsChecked(); }
+ BOOL IsProportional() const { return aPropCB.IsChecked() && aHorzBox.IsChecked(); }
+ long GetCount() const { return sal::static_int_cast< long >(aCountEdit.GetValue()); }
+};
+
+#endif
diff --git a/sw/source/ui/inc/splittbl.hxx b/sw/source/ui/inc/splittbl.hxx
new file mode 100644
index 000000000000..3e21b347651a
--- /dev/null
+++ b/sw/source/ui/inc/splittbl.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SPLITTBL_HXX
+#define _SPLITTBL_HXX
+
+#include <svx/stddlg.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+
+class SwWrtShell;
+
+class SwSplitTblDlg : public SvxStandardDialog
+{
+ OKButton aOKPB;
+ CancelButton aCancelPB;
+ HelpButton aHelpPB;
+ FixedLine aSplitFL;
+ RadioButton aCntntCopyRB;
+ RadioButton aBoxAttrCopyWithParaRB ;
+ RadioButton aBoxAttrCopyNoParaRB ;
+ RadioButton aBorderCopyRB;
+
+ SwWrtShell &rShell;
+ USHORT m_nSplit;
+
+protected:
+ virtual void Apply();
+
+public:
+ SwSplitTblDlg( Window *pParent, SwWrtShell &rSh );
+
+ USHORT GetSplitMode() const { return m_nSplit; }
+};
+
+#endif
+
+
diff --git a/sw/source/ui/inc/srcedtw.hxx b/sw/source/ui/inc/srcedtw.hxx
new file mode 100644
index 000000000000..c23ee997852d
--- /dev/null
+++ b/sw/source/ui/inc/srcedtw.hxx
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SRCEDTW_HXX
+#define _SRCEDTW_HXX
+
+#include <vcl/window.hxx>
+#include <svl/lstner.hxx>
+#include <unotools/options.hxx>
+#include <vcl/timer.hxx>
+
+#ifndef _TABLE_HXX //autogen
+#include <tools/table.hxx>
+#endif
+#include <svtools/xtextedt.hxx>
+
+class ScrollBar;
+class SwSrcView;
+class SwSrcEditWindow;
+class TextEngine;
+class ExtTextView;
+class DataChangedEvent;
+
+namespace utl
+{
+ class SourceViewConfig;
+}
+
+class TextViewOutWin : public Window
+{
+ ExtTextView* pTextView;
+
+protected:
+ virtual void Paint( const Rectangle& );
+ virtual void KeyInput( const KeyEvent& rKeyEvt );
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void DataChanged( const DataChangedEvent& );
+
+public:
+ TextViewOutWin(Window* pParent, WinBits nBits) :
+ Window(pParent, nBits), pTextView(0){}
+
+ void SetTextView( ExtTextView* pView ) {pTextView = pView;}
+
+};
+
+//------------------------------------------------------------
+namespace svt{ class SourceViewConfig;}
+class SwSrcEditWindow : public Window, public SfxListener, public utl::ConfigurationListener
+{
+private:
+ ExtTextView* pTextView;
+ ExtTextEngine* pTextEngine;
+
+ TextViewOutWin* pOutWin;
+ ScrollBar *pHScrollbar,
+ *pVScrollbar;
+
+ SwSrcView* pSrcView;
+ utl::SourceViewConfig* pSourceViewConfig;
+
+ long nCurTextWidth;
+ USHORT nStartLine;
+ rtl_TextEncoding eSourceEncoding;
+ BOOL bReadonly;
+ BOOL bDoSyntaxHighlight;
+ BOOL bHighlighting;
+
+ Timer aSyntaxIdleTimer;
+ Table aSyntaxLineTable;
+
+ void ImpDoHighlight( const String& rSource, USHORT nLineOff );
+
+ using OutputDevice::SetFont;
+ void SetFont();
+
+ DECL_LINK( SyntaxTimerHdl, Timer * );
+ DECL_LINK( TimeoutHdl, Timer * );
+
+ using Window::Notify;
+ using Window::Invalidate;
+
+protected:
+
+ virtual void Resize();
+ virtual void DataChanged( const DataChangedEvent& );
+ virtual void GetFocus();
+// virtual void LoseFocus();
+
+ void CreateTextEngine();
+ void DoSyntaxHighlight( USHORT nPara );
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+ virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
+
+ DECL_LINK(ScrollHdl, ScrollBar*);
+
+public:
+ SwSrcEditWindow( Window* pParent, SwSrcView* pParentView );
+ ~SwSrcEditWindow();
+
+ void SetScrollBarRanges();
+ void InitScrollBars();
+ ULONG Read( SvStream& rInput)
+ {return pTextEngine->Read(rInput);}
+ ULONG Write( SvStream& rOutput)
+ {return pTextEngine->Write(rOutput);}
+
+ ExtTextView* GetTextView()
+ {return pTextView;}
+ TextEngine* GetTextEngine()
+ {return pTextEngine;}
+ SwSrcView* GetSrcView() {return pSrcView;}
+
+ TextViewOutWin* GetOutWin() {return pOutWin;}
+
+ virtual void Invalidate( USHORT nFlags = 0 );
+
+ void ClearModifyFlag()
+ { pTextEngine->SetModified(FALSE); }
+ BOOL IsModified() const
+ { return pTextEngine->IsModified();}
+ void CreateScrollbars();
+
+ void SetReadonly(BOOL bSet){bReadonly = bSet;}
+ BOOL IsReadonly(){return bReadonly;}
+
+ void DoDelayedSyntaxHighlight( USHORT nPara );
+
+ void SetStartLine(USHORT nLine){nStartLine = nLine;}
+
+ virtual void Command( const CommandEvent& rCEvt );
+ void HandleWheelCommand( const CommandEvent& rCEvt );
+
+ void SetTextEncoding(rtl_TextEncoding eEncoding);
+};
+
+#endif
diff --git a/sw/source/ui/inc/srcview.hxx b/sw/source/ui/inc/srcview.hxx
new file mode 100644
index 000000000000..574696f1fd27
--- /dev/null
+++ b/sw/source/ui/inc/srcview.hxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SRCVIEW_HXX
+#define _SRCVIEW_HXX
+
+#include <sfx2/viewfac.hxx>
+#include <sfx2/viewsh.hxx>
+#include <vcl/outdev.hxx>
+
+#include "srcedtw.hxx"
+#include "shellid.hxx"
+
+class SwDocShell;
+class SvxSearchItem;
+class SfxMedium;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SwSrcView: public SfxViewShell
+{
+ SwSrcEditWindow aEditWin;
+
+ SvxSearchItem* pSearchItem;
+
+ BOOL bSourceSaved :1;
+ rtl_TextEncoding eLoadEncoding;
+ void Init();
+
+ // fuer Readonly-Umschaltung
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+
+protected:
+ USHORT StartSearchAndReplace(const SvxSearchItem& rItem,
+ BOOL bFromStart,
+ BOOL bApi,
+ BOOL bRecursive = FALSE);
+
+
+public:
+
+ SFX_DECL_VIEWFACTORY(SwSrcView);
+ SFX_DECL_INTERFACE(SW_SRC_VIEWSHELL)
+ TYPEINFO();
+
+
+ SwSrcView(SfxViewFrame* pFrame, SfxViewShell*);
+
+ ~SwSrcView();
+
+ SwDocShell* GetDocShell();
+ SwSrcEditWindow& GetEditWin() {return aEditWin;}
+ void SaveContent(const String& rTmpFile);
+ void SaveContentTo(SfxMedium& rMed);
+
+ BOOL IsModified() {return aEditWin.IsModified();}
+
+
+
+ void Execute(SfxRequest&);
+ void GetState(SfxItemSet&);
+
+ SvxSearchItem* GetSearchItem();
+ void SetSearchItem( const SvxSearchItem& rItem );
+
+ void Load(SwDocShell* pDocShell);
+
+ virtual USHORT SetPrinter( SfxPrinter* pNew, USHORT nDiff = SFX_PRINTER_ALL, bool bIsAPI=false );
+ virtual SfxPrinter* GetPrinter( BOOL bCreate = FALSE );
+
+ sal_Int32 PrintSource( OutputDevice *pOutDev, sal_Int32 nPage, bool bCalcNumPagesOnly );
+
+ void SourceSaved() {bSourceSaved = TRUE;}
+ BOOL HasSourceSaved() const {return bSourceSaved;}
+
+};
+
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/inc/srtdlg.hxx b/sw/source/ui/inc/srtdlg.hxx
new file mode 100644
index 000000000000..09d91cf64195
--- /dev/null
+++ b/sw/source/ui/inc/srtdlg.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SRTDLG_HXX
+#define _SRTDLG_HXX
+
+#ifndef _FIXED_HXX
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#ifndef _FIELD_HXX
+#include <vcl/field.hxx>
+#endif
+#ifndef _LSTBOX_HXX
+#include <vcl/lstbox.hxx>
+#endif
+#include <svx/stddlg.hxx>
+#include <svx/langbox.hxx>
+
+class SwWrtShell;
+class CollatorRessource;
+
+class SwSortDlg : public SvxStandardDialog
+{
+ FixedText aColLbl;
+ FixedText aTypLbl;
+ FixedText aDirLbl;
+
+ FixedLine aDirFL;
+
+ CheckBox aKeyCB1;
+ NumericField aColEdt1;
+ ListBox aTypDLB1;
+ RadioButton aSortUpRB;
+ RadioButton aSortDnRB;
+
+ CheckBox aKeyCB2;
+ NumericField aColEdt2;
+ ListBox aTypDLB2;
+ RadioButton aSortUp2RB;
+ RadioButton aSortDn2RB;
+
+ CheckBox aKeyCB3;
+ NumericField aColEdt3;
+ ListBox aTypDLB3;
+ RadioButton aSortUp3RB;
+ RadioButton aSortDn3RB;
+
+ FixedLine aSortFL;
+ RadioButton aColumnRB;
+ RadioButton aRowRB;
+
+ FixedLine aDelimFL;
+ RadioButton aDelimTabRB;
+ RadioButton aDelimFreeRB;
+ Edit aDelimEdt;
+ PushButton aDelimPB;
+
+ FixedLine aLangFL;
+ SvxLanguageBox aLangLB;
+
+ FixedLine aSortOptFL;
+ CheckBox aCaseCB;
+
+ OKButton aOkBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+ String aColTxt;
+ String aRowTxt;
+ String aNumericTxt;
+
+ SwWrtShell &rSh;
+ CollatorRessource* pColRes;
+
+ USHORT nX;
+ USHORT nY;
+
+ virtual void Apply();
+ sal_Unicode GetDelimChar() const;
+
+ DECL_LINK( CheckHdl, CheckBox * );
+ DECL_LINK( DelimHdl, RadioButton* );
+ DECL_LINK( LanguageHdl, ListBox* );
+ DECL_LINK( DelimCharHdl, PushButton* );
+
+public:
+ SwSortDlg(Window * pParent, SwWrtShell &rSh);
+ ~SwSortDlg();
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/stmenu.hxx b/sw/source/ui/inc/stmenu.hxx
new file mode 100644
index 000000000000..a761d60a12ed
--- /dev/null
+++ b/sw/source/ui/inc/stmenu.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// SMARTTAGS
+
+#ifndef _STMENU_HXX
+#define _STMENU_HXX
+
+#ifndef _MENU_HXX //autogen
+#include <vcl/menu.hxx>
+#endif
+
+#include <vector>
+#include <com/sun/star/smarttags/XSmartTagAction.hpp>
+
+#ifndef _COM_SUN_STAR_SMARTTAGS_XSTRINGKEYMAP_HPP_
+#include <com/sun/star/container/XStringKeyMap.hpp>
+#endif
+#include <com/sun/star/text/XTextRange.hpp>
+
+class SwView;
+
+/** Class: SwSmartTagPopup
+
+ This class contains the implementation of the smarttag popup
+ menu that is opened if a user clicks on an underlined word.
+
+ The menu is built in the constructor and the actions for each
+ menu entry are invoked in the excute-method.
+*/
+
+class SwSmartTagPopup : public PopupMenu
+{
+ SwView* mpSwView;
+ com::sun::star::uno::Reference< com::sun::star::text::XTextRange > mxTextRange;
+
+ struct InvokeAction
+ {
+ com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > mxAction;
+ com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > mxSmartTagProperties;
+ sal_uInt32 mnActionID;
+ InvokeAction( com::sun::star::uno::Reference< com::sun::star::smarttags::XSmartTagAction > xAction,
+ com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xSmartTagProperties,
+ sal_uInt32 nActionID ) : mxAction( xAction ), mxSmartTagProperties( xSmartTagProperties ), mnActionID( nActionID ) {}
+ };
+
+ std::vector< InvokeAction > maInvokeActions;
+
+ using PopupMenu::Execute;
+
+public:
+ SwSmartTagPopup( SwView* _pSwView,
+ ::com::sun::star::uno::Sequence< rtl::OUString >& rSmartTagTypes,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XStringKeyMap > >& rStringKeyMaps,
+ ::com::sun::star::uno::Reference< com::sun::star::text::XTextRange > xTextRange );
+
+ sal_uInt16 Execute( const Rectangle& rPopupPos, Window* pWin );
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/swcont.hxx b/sw/source/ui/inc/swcont.hxx
new file mode 100644
index 000000000000..f9d5dd049b1d
--- /dev/null
+++ b/sw/source/ui/inc/swcont.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SWCONT_HXX
+#define _SWCONT_HXX
+
+#include <tools/string.hxx>
+
+class SwContentType;
+
+//Reihenfolge und Anzahl mit ResIds abgleichen!!
+#define CONTENT_TYPE_OUTLINE 0
+#define CONTENT_TYPE_TABLE 1
+#define CONTENT_TYPE_FRAME 2
+#define CONTENT_TYPE_GRAPHIC 3
+#define CONTENT_TYPE_OLE 4
+#define CONTENT_TYPE_BOOKMARK 5
+#define CONTENT_TYPE_REGION 6
+#define CONTENT_TYPE_URLFIELD 7
+#define CONTENT_TYPE_REFERENCE 8
+#define CONTENT_TYPE_INDEX 9
+#define CONTENT_TYPE_POSTIT 10
+#define CONTENT_TYPE_DRAWOBJECT 11
+#define CONTENT_TYPE_MAX CONTENT_TYPE_DRAWOBJECT +1
+
+
+// Typen fuer das Globaldokument
+#define GLOBAL_CONTENT_REGION 100
+#define GLOBAL_CONTENT_INDEX 101
+#define GLOBAL_CONTENT_TEXT 102
+#define GLOBAL_CONTENT_MAX 3
+
+// Strings fuer Kontextmenue
+#define CONTEXT_COUNT 12
+#define GLOBAL_CONTEXT_COUNT 14
+
+// Modi fuer Drag 'n Drop
+#define REGION_MODE_NONE 0
+#define REGION_MODE_LINK 1
+#define REGION_MODE_EMBEDDED 2
+
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+
+//mini rtti
+class SwTypeNumber
+{
+ BYTE nTypeId;
+
+ public:
+ SwTypeNumber(BYTE nId) :nTypeId(nId){}
+ virtual ~SwTypeNumber();
+
+ virtual BYTE GetTypeId();
+};
+//----------------------------------------------------------------------------
+
+class SwContent : public SwTypeNumber
+{
+ const SwContentType* pParent;
+ String sContentName;
+ long nYPosition;
+ BOOL bInvisible;
+public:
+ SwContent(const SwContentType* pCnt, const String& rName, long nYPos );
+
+ virtual BOOL IsProtect() const;
+ const SwContentType* GetParent() const {return pParent;}
+ const String& GetName() const {return sContentName;}
+ int operator==(const SwContent& /*rCont*/) const
+ {
+ //gleich sind sie nie, sonst fallen sie aus dem Array
+ return FALSE;
+ }
+ int operator<(const SwContent& rCont) const
+ {
+ //zuerst nach Position dann nach Name sortieren
+ return nYPosition != rCont.nYPosition ?
+ nYPosition < rCont.nYPosition :
+ sContentName < rCont.sContentName;;
+ }
+
+ long GetYPos() const {return nYPosition;}
+
+ BOOL IsInvisible() const {return bInvisible;}
+ void SetInvisible(){ bInvisible = TRUE;}
+};
+
+#endif
diff --git a/sw/source/ui/inc/swdtflvr.hxx b/sw/source/ui/inc/swdtflvr.hxx
new file mode 100644
index 000000000000..452637a3e7f8
--- /dev/null
+++ b/sw/source/ui/inc/swdtflvr.hxx
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWDTFLVR_HXX
+#define _SWDTFLVR_HXX
+
+#include <sfx2/objsh.hxx>
+
+#include <svtools/transfer.hxx>
+#include <vcl/graph.hxx>
+#include <sfx2/lnkbase.hxx>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+
+class Graphic;
+class ImageMap;
+class INetBookmark;
+class INetImage;
+class SwDoc;
+class SwDocFac;
+class SwTextBlocks;
+class SwWrtShell;
+class SvxClipboardFmtItem;
+class ViewShell;
+class SwView_Impl;
+
+typedef sal_uInt16 TransferBufferType;
+namespace nsTransferBufferType
+{
+ const sal_uInt16 TRNSFR_NONE = 0x0000;
+ const sal_uInt16 TRNSFR_DOCUMENT = 0x0001;
+ const sal_uInt16 TRNSFR_DOCUMENT_WORD = 0x0002;
+ const sal_uInt16 TRNSFR_GRAPHIC = 0x0004;
+ const sal_uInt16 TRNSFR_TABELLE = 0x0008;
+ const sal_uInt16 TRNSFR_DDELINK = 0x0010;
+ const sal_uInt16 TRNSFR_OLE = 0x0020;
+ const sal_uInt16 TRNSFR_INETFLD = 0x0040;
+ const sal_uInt16 TRNSFR_DRAWING = 0x0081; //Drawing ist auch intern!
+}
+
+#define DATA_FLAVOR ::com::sun::star::datatransfer::DataFlavor
+
+class SwTransferable : public TransferableHelper
+{
+ friend class SwView_Impl;
+ SfxObjectShellLock aDocShellRef;
+ TransferableDataHelper aOleData;
+ TransferableObjectDescriptor aObjDesc;
+ ::sfx2::SvBaseLinkRef refDdeLink;
+
+ SwWrtShell *pWrtShell;
+ /* #96392# Added pCreatorView to distinguish SwFrameShell from
+ SwWrtShell. */
+ const ViewShell *pCreatorView;
+ SwDocFac *pClpDocFac;
+ Graphic *pClpGraphic, *pClpBitmap, *pOrigGrf;
+ INetBookmark *pBkmk; // URL und Beschreibung!
+ ImageMap *pImageMap;
+ INetImage *pTargetURL;
+
+ TransferBufferType eBufferType;
+
+ BOOL bOldIdle :1; //D&D Idle flag from the viewsettings
+ BOOL bCleanUp :1; //D&D cleanup after Drop (not by internal Drop)
+
+ // helper methods for the copy
+ com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > FindOLEObj( sal_Int64& nAspect ) const;
+ Graphic* FindOLEReplacementGraphic() const;
+ void DeleteSelection();
+
+ // helper methods for the paste
+ static SwTransferable* GetSwTransferable( const TransferableDataHelper& rData );
+ static void SetSelInShell( SwWrtShell& , BOOL , const Point* );
+ static BOOL _CheckForURLOrLNKFile( TransferableDataHelper& rData,
+ String& rFileName, String* pTitle = 0 );
+ static int _TestAllowedFormat( const TransferableDataHelper& rData,
+ ULONG nFormat, USHORT nDestination );
+
+ static int _PasteFileContent( TransferableDataHelper&,
+ SwWrtShell& rSh, ULONG nFmt, BOOL bMsg );
+ static int _PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh,
+ ULONG nFmt, BYTE nActionFlags, BOOL bMsg );
+ static int _PasteTargetURL( TransferableDataHelper& rData, SwWrtShell& rSh,
+ USHORT nAction, const Point* pPt, BOOL bInsertGRF );
+
+ static int _PasteDDE( TransferableDataHelper& rData, SwWrtShell& rWrtShell,
+ BOOL bReReadGrf, BOOL bMsg );
+
+ static int _PasteSdrFormat( TransferableDataHelper& rData,
+ SwWrtShell& rSh, USHORT nAction,
+ const Point* pPt, BYTE nActionFlags );
+
+ static int _PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
+ ULONG nFmt, USHORT nAction, const Point* pPt,
+ BYTE nActionFlags, BOOL bMsg );
+
+ static int _PasteImageMap( TransferableDataHelper& rData,
+ SwWrtShell& rSh );
+
+ static int _PasteAsHyperlink( TransferableDataHelper& rData,
+ SwWrtShell& rSh, ULONG nFmt );
+
+ static int _PasteFileName( TransferableDataHelper& rData,
+ SwWrtShell& rSh, ULONG nFmt, USHORT nAction,
+ const Point* pPt, BYTE nActionFlags, BOOL bMsg );
+
+ static int _PasteDBData( TransferableDataHelper& rData, SwWrtShell& rSh,
+ ULONG nFmt, BOOL bLink, const Point* pDragPt,
+ BOOL bMsg );
+
+ static int _PasteFileList( TransferableDataHelper& rData,
+ SwWrtShell& rSh, BOOL bLink,
+ const Point* pPt, BOOL bMsg );
+
+ int PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, BOOL bMove,
+ BOOL bIsXSelection );
+ int PrivatePaste( SwWrtShell& rShell );
+
+ void SetDataForDragAndDrop( const Point& rSttPos );
+
+ // not available
+ SwTransferable();
+ SwTransferable( const SwTransferable& );
+ SwTransferable& operator=( const SwTransferable& );
+
+protected:
+ virtual void AddSupportedFormats();
+ virtual sal_Bool GetData( const DATA_FLAVOR& rFlavor );
+ virtual sal_Bool WriteObject( SotStorageStreamRef& rxOStm,
+ void* pUserObject,
+ sal_uInt32 nUserObjectId,
+ const DATA_FLAVOR& rFlavor );
+ virtual void DragFinished( sal_Int8 nDropAction );
+ virtual void ObjectReleased();
+
+ using TransferableHelper::StartDrag;
+
+public:
+ SwTransferable( SwWrtShell& );
+ virtual ~SwTransferable();
+
+ static USHORT GetSotDestination( const SwWrtShell& rSh, const Point* = 0 );
+
+ // set properties on the document, like PageMargin, VisArea.
+ // And set real Size
+ static void InitOle( SfxObjectShell* pDoc, SwDoc& rDoc );
+
+ // copy - methods and helper methods for the copy
+ int Cut();
+ int Copy( BOOL bIsCut = FALSE );
+ int PrepareForCopy( BOOL bIsCut = FALSE );
+ int CalculateAndCopy(); // special for Calculator
+ int CopyGlossary( SwTextBlocks& rGlossary, const String& rStr );
+
+ // remove the DDE-Link format promise
+ void RemoveDDELinkFormat( const Window& rWin );
+
+ // paste - methods and helper methods for the paste
+ static BOOL IsPaste( const SwWrtShell&, const TransferableDataHelper& );
+ static int Paste( SwWrtShell&, TransferableDataHelper& );
+ static int PasteData( TransferableDataHelper& rData,
+ SwWrtShell& rSh, USHORT nAction, ULONG nFormat,
+ USHORT nDestination, BOOL bIsPasteFmt,
+ sal_Bool bIsDefault,
+ const Point* pDDPos = 0, sal_Int8 nDropAction = 0,
+ BOOL bPasteSelection = FALSE );
+
+ static BOOL IsPasteSpecial( const SwWrtShell& rWrtShell,
+ const TransferableDataHelper& );
+ static int PasteUnformatted( SwWrtShell& rSh, TransferableDataHelper& );
+ static int PasteSpecial( SwWrtShell& rSh, TransferableDataHelper&, ULONG& rFormatUsed );
+ static int PasteFormat( SwWrtShell& rSh, TransferableDataHelper& rData,
+ ULONG nFormat );
+
+ static void FillClipFmtItem( const SwWrtShell& rSh,
+ const TransferableDataHelper& rData,
+ SvxClipboardFmtItem & rToFill );
+
+ // Interfaces for Drag & Drop
+ void StartDrag( Window* pWin, const Point& rPos );
+
+ SwWrtShell* GetShell() { return pWrtShell; }
+ void SetCleanUp( BOOL bFlag ) { bCleanUp = bFlag; }
+
+ // Interfaces for Selection
+ /* #96392# Added pCreator to distinguish SwFrameShell from SwWrtShell. */
+ static void CreateSelection( SwWrtShell & rSh,
+ const ViewShell * pCreator = NULL );
+ static void ClearSelection( SwWrtShell& rSh,
+ const ViewShell * pCreator = NULL );
+
+ // the related SwView is being closed and the SwTransferable is invalid now
+ void Invalidate() {pWrtShell = 0;}
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
+
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
+};
+
+
+#endif
diff --git a/sw/source/ui/inc/swlbox.hxx b/sw/source/ui/inc/swlbox.hxx
new file mode 100644
index 000000000000..a0d7ebf03ca1
--- /dev/null
+++ b/sw/source/ui/inc/swlbox.hxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWLBOX_HXX
+#define _SWLBOX_HXX
+
+#include <svl/svarray.hxx>
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+#ifndef _COMBOBOX_HXX //autogen
+#include <vcl/combobox.hxx>
+#endif
+#include "swdllapi.h"
+
+class SwBoxEntry;
+class Window;
+
+SV_DECL_PTRARR_DEL(SwEntryLst, SwBoxEntry*, 10, 10)
+
+/*--------------------------------------------------------------------
+ Beschreibung: SwBoxEntry
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwBoxEntry
+{
+ friend class SwComboBox;
+
+ BOOL bModified : 1;
+ BOOL bNew : 1;
+
+ String aName;
+ USHORT nId;
+
+public:
+ SwBoxEntry(const String& aName, USHORT nId=0);
+ SwBoxEntry(const SwBoxEntry& rOrg);
+ SwBoxEntry();
+
+ const String& GetName() const { return aName;}
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: fuer ComboBoxen
+ --------------------------------------------------------------------*/
+
+typedef USHORT SwComboBoxStyle;
+namespace nsSwComboBoxStyle
+{
+ const SwComboBoxStyle CBS_UPPER = 0x01;
+ const SwComboBoxStyle CBS_LOWER = 0x02;
+ const SwComboBoxStyle CBS_ALL = 0x04;
+ const SwComboBoxStyle CBS_FILENAME = 0x08;
+ const SwComboBoxStyle CBS_SW_FILENAME = CBS_FILENAME;
+}
+
+class SW_DLLPUBLIC SwComboBox : public ComboBox
+{
+ SwEntryLst aEntryLst;
+ SwEntryLst aDelEntryLst;
+ SwBoxEntry aDefault;
+ USHORT nStyle;
+
+ SW_DLLPRIVATE void InitComboBox();
+ SW_DLLPRIVATE void InsertSorted(SwBoxEntry* pEntry);
+
+ using ComboBox::InsertEntry;
+ using ComboBox::RemoveEntry;
+ using Window::SetStyle;
+
+public:
+
+ using ComboBox::GetEntryPos;
+
+ SwComboBox(Window* pParent, const ResId& rId,
+ USHORT nStyleBits = nsSwComboBoxStyle::CBS_ALL);
+ ~SwComboBox();
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+
+ void InsertEntry(const SwBoxEntry&);
+ USHORT InsertEntry( const XubString& rStr, USHORT = 0)
+ { InsertEntry( SwBoxEntry( rStr ) ); return 0; }
+
+ void RemoveEntry(USHORT nPos);
+
+ USHORT GetEntryPos(const SwBoxEntry& rEntry) const;
+ const SwBoxEntry& GetEntry(USHORT) const;
+
+ USHORT GetRemovedCount() const;
+ const SwBoxEntry& GetRemovedEntry(USHORT nPos) const;
+
+ USHORT GetStyle() const { return nStyle; }
+ void SetStyle(const USHORT nSt) { nStyle = nSt; }
+
+ String GetText() const;
+};
+
+#endif /* _SWLBOX_HXX */
diff --git a/sw/source/ui/inc/swmodalredlineacceptdlg.hxx b/sw/source/ui/inc/swmodalredlineacceptdlg.hxx
new file mode 100644
index 000000000000..c3af65d764ff
--- /dev/null
+++ b/sw/source/ui/inc/swmodalredlineacceptdlg.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWMODALREDLINEACCEPTDLG_HXX
+#define _SWMODALREDLINEACCEPTDLG_HXX
+#include "chldwrap.hxx"
+#include <sfx2/basedlgs.hxx>
+
+class SwRedlineAcceptDlg;
+
+class SwModalRedlineAcceptDlg : public SfxModalDialog
+{
+ SwRedlineAcceptDlg* pImplDlg;
+
+ virtual void Resize();
+
+public:
+ SwModalRedlineAcceptDlg(Window *pParent);
+ ~SwModalRedlineAcceptDlg();
+
+ void AcceptAll( BOOL bAccept );
+ virtual void Activate();
+};
+
+#endif
diff --git a/sw/source/ui/inc/swrenamexnameddlg.hxx b/sw/source/ui/inc/swrenamexnameddlg.hxx
new file mode 100644
index 000000000000..16f3d56852e6
--- /dev/null
+++ b/sw/source/ui/inc/swrenamexnameddlg.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWRENAMEXNAMEDDLG_HXX
+#define _SWRENAMEXNAMEDDLG_HXX
+
+
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <actctrl.hxx>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <tools/resary.hxx>
+#include <swunodef.hxx>
+
+
+
+/* -----------------09.06.99 14:36-------------------
+ *
+ * --------------------------------------------------*/
+class SwRenameXNamedDlg : public ModalDialog
+{
+ FixedText aNewNameFT;
+ NoSpaceEdit aNewNameED;
+ FixedLine aNameFL;
+ OKButton aOk;
+ CancelButton aCancel;
+ HelpButton aHelp;
+
+ String sRemoveWarning;
+
+ STAR_REFERENCE( container::XNamed ) & xNamed;
+ STAR_REFERENCE( container::XNameAccess ) & xNameAccess;
+ STAR_REFERENCE( container::XNameAccess ) xSecondAccess;
+ STAR_REFERENCE( container::XNameAccess ) xThirdAccess;
+
+ DECL_LINK(OkHdl, OKButton*);
+ DECL_LINK(ModifyHdl, NoSpaceEdit*);
+
+public:
+ SwRenameXNamedDlg( Window* pParent,
+ STAR_REFERENCE( container::XNamed ) & xNamed,
+ STAR_REFERENCE( container::XNameAccess ) & xNameAccess );
+
+ void SetForbiddenChars( const String& rSet )
+ { aNewNameED.SetForbiddenChars( rSet ); }
+
+ void SetAlternativeAccess(
+ STAR_REFERENCE( container::XNameAccess ) & xSecond,
+ STAR_REFERENCE( container::XNameAccess ) & xThird )
+ {
+ xSecondAccess = xSecond;
+ xThirdAccess = xThird;
+ }
+};
+
+#endif
diff --git a/sw/source/ui/inc/swtablerep.hxx b/sw/source/ui/inc/swtablerep.hxx
new file mode 100644
index 000000000000..20af27911317
--- /dev/null
+++ b/sw/source/ui/inc/swtablerep.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWTABLEREP_HXX
+#define _SWTABLEREP_HXX
+
+
+#include <sfx2/tabdlg.hxx>
+#include "swdllapi.h"
+#include "swtypes.hxx"
+
+class SwTabCols;
+struct TColumn;
+class SW_DLLPUBLIC SwTableRep
+{
+ TColumn* pTColumns;
+
+ SwTwips nTblWidth;
+ SwTwips nSpace;
+ SwTwips nLeftSpace;
+ SwTwips nRightSpace;
+ USHORT nAlign;
+ USHORT nColCount;
+ USHORT nAllCols;
+ USHORT nWidthPercent;
+ BOOL bComplex : 1;
+ BOOL bLineSelected : 1;
+ BOOL bWidthChanged : 1;
+ BOOL bColsChanged : 1;
+
+public:
+ SwTableRep( const SwTabCols& rTabCol, BOOL bComplex );
+ ~SwTableRep();
+
+ BOOL FillTabCols( SwTabCols& rTabCol ) const;
+
+ SwTwips GetLeftSpace() const {return nLeftSpace;}
+ void SetLeftSpace(SwTwips nSet) {nLeftSpace = nSet;}
+
+ SwTwips GetRightSpace() const {return nRightSpace;}
+ void SetRightSpace(SwTwips nSet) {nRightSpace = nSet;}
+
+ SwTwips GetWidth() const {return nTblWidth;}
+ void SetWidth(SwTwips nSet) {nTblWidth = nSet;}
+
+ USHORT GetWidthPercent() const {return nWidthPercent;}
+ void SetWidthPercent(USHORT nSet) {nWidthPercent = nSet;}
+
+ USHORT GetAlign() const {return nAlign;}
+ void SetAlign(USHORT nSet) {nAlign = nSet;}
+
+ BOOL IsComplex() const {return bComplex;}
+ USHORT GetColCount() const {return nColCount;}
+ USHORT GetAllColCount() const {return nAllCols;}
+
+ BOOL HasColsChanged() const {return bColsChanged;}
+ void SetColsChanged() {bColsChanged = TRUE;}
+
+ BOOL HasWidthChanged() const {return bWidthChanged;}
+ void SetWidthChanged() {bWidthChanged = TRUE;}
+
+ BOOL IsLineSelected() const {return bLineSelected;}
+ void SetLineSelected(BOOL bSet) {bLineSelected = bSet;}
+
+ SwTwips GetSpace() const { return nSpace;}
+ void SetSpace(SwTwips nSet) {nSpace = nSet;}
+
+ TColumn* GetColumns() const {return pTColumns;}
+};
+#endif
+
diff --git a/sw/source/ui/inc/swuiccoll.hxx b/sw/source/ui/inc/swuiccoll.hxx
new file mode 100644
index 000000000000..5079d9ebda08
--- /dev/null
+++ b/sw/source/ui/inc/swuiccoll.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWUI_CCOLL_HXX
+#define _SWUI_CCOLL_HXX
+
+#include "ccoll.hxx"
+
+class SwWrtShell;
+class SwFmt;
+
+class SwCondCollPage : public SfxTabPage
+{
+ FixedLine aConditionFL;
+ CheckBox aConditionCB;
+
+ FixedText aContextFT;
+ FixedText aUsedFT;
+ SvTabListBox aTbLinks;
+
+ FixedText aStyleFT;
+ ListBox aStyleLB;
+ ListBox aFilterLB;
+
+ PushButton aRemovePB;
+ PushButton aAssignPB;
+
+ String sNoTmpl;
+ ResStringArray aStrArr;
+
+ SwWrtShell &rSh;
+ const CommandStruct*pCmds;
+ SwFmt* pFmt;
+
+ CollName* pNms;
+
+ BOOL bNewTemplate;
+
+
+ SwCondCollPage(Window *pParent, const SfxItemSet &rSet);
+ virtual ~SwCondCollPage();
+
+ virtual int DeactivatePage(SfxItemSet *pSet);
+
+ DECL_LINK( OnOffHdl, CheckBox* );
+ DECL_LINK( AssignRemoveHdl, PushButton*);
+ DECL_LINK( SelectHdl, ListBox* );
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+public:
+
+ static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
+ static USHORT* GetRanges();
+
+ virtual BOOL FillItemSet( SfxItemSet &rSet);
+ virtual void Reset (const SfxItemSet &rSet);
+
+ void SetCollection( SwFmt* pFormat, BOOL bNew );
+};
+
+
+
+#endif
+
diff --git a/sw/source/ui/inc/swuicnttab.hxx b/sw/source/ui/inc/swuicnttab.hxx
new file mode 100644
index 000000000000..4a1294187876
--- /dev/null
+++ b/sw/source/ui/inc/swuicnttab.hxx
@@ -0,0 +1,539 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWUI_CNTTAB_HXX
+#define _SWUI_CNTTAB_HXX
+
+#include <svx/stddlg.hxx>
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+#include <sfx2/tabdlg.hxx>
+
+#include "tox.hxx"
+#include <tools/list.hxx>
+#include <toxmgr.hxx>
+#include <svx/checklbx.hxx>
+#include <tools/resary.hxx>
+#include <svtools/svtreebx.hxx>
+#include <vcl/menubtn.hxx>
+#include <svx/langbox.hxx>
+#include <cnttab.hxx>
+class SwWrtShell;
+class SwTOXMgr;
+namespace com{namespace sun{namespace star{
+ namespace text{
+ class XTextSection;
+ class XDocumentIndex;
+ }
+}}}
+
+//-----------------------------------------------------------------------------
+struct SwIndexSections_Impl
+{
+ com::sun::star::uno::Reference< com::sun::star::text::XTextSection > xContainerSection;
+ com::sun::star::uno::Reference< com::sun::star::text::XDocumentIndex > xDocumentIndex;
+};
+
+//-----------------------------------------------------------------------------
+class SwOneExampleFrame;
+struct SwIndexSections_Impl;
+
+class SwMultiTOXTabDialog : public SfxTabDialog
+{
+ Window aExampleContainerWIN;
+ Window aExampleWIN;
+ CheckBox aShowExampleCB;
+ SwTOXMgr* pMgr;
+ SwWrtShell& rSh;
+
+ SwOneExampleFrame* pExampleFrame;
+
+ SwTOXDescription** pDescArr; //
+ SwForm** pFormArr; //
+ SwIndexSections_Impl** pxIndexSectionsArr;
+
+ SwTOXBase* pParamTOXBase;
+
+ CurTOXType eCurrentTOXType;
+
+ String sUserDefinedIndex;
+ USHORT nTypeCount;
+ USHORT nInitialTOXType;
+
+ BOOL bEditTOX;
+ BOOL bExampleCreated;
+ BOOL bGlobalFlag;
+
+ virtual short Ok();
+ SwTOXDescription* CreateTOXDescFromTOXBase(const SwTOXBase*pCurTOX);
+
+ DECL_LINK(CreateExample_Hdl, void* );
+ DECL_LINK(ShowPreviewHdl, CheckBox*);
+
+public:
+ SwMultiTOXTabDialog(Window* pParent, const SfxItemSet& rSet,
+ SwWrtShell &rShell,
+ SwTOXBase* pCurTOX, USHORT nToxType = USHRT_MAX,
+ BOOL bGlobal = FALSE);
+ ~SwMultiTOXTabDialog();
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+
+ SwForm* GetForm(CurTOXType eType);
+
+ CurTOXType GetCurrentTOXType() const { return eCurrentTOXType;}
+ void SetCurrentTOXType(CurTOXType eSet)
+ {
+ eCurrentTOXType = eSet;
+ }
+
+ void UpdateExample();
+ BOOL IsTOXEditMode() const { return bEditTOX;}
+
+ SwWrtShell& GetWrtShell() {return rSh;}
+
+ SwTOXDescription& GetTOXDescription(CurTOXType eTOXTypes);
+ void CreateOrUpdateExample(
+ TOXTypes nTOXIndex, USHORT nPage = 0, USHORT nCurLevel = USHRT_MAX);
+
+ static BOOL IsNoNum(SwWrtShell& rSh, const String& rName);
+};
+/* -----------------14.07.99 12:17-------------------
+
+ --------------------------------------------------*/
+class IndexEntryRessource;
+class IndexEntrySupplierWrapper;
+
+class SwTOXSelectTabPage : public SfxTabPage
+{
+ FixedLine aTypeTitleFL;
+ FixedText aTitleFT;
+ Edit aTitleED;
+ FixedText aTypeFT;
+ ListBox aTypeLB;
+ CheckBox aReadOnlyCB;
+
+ FixedLine aAreaFL;
+ FixedText aAreaFT;
+ ListBox aAreaLB;
+ FixedText aLevelFT; //content, user
+ NumericField aLevelNF; //content, user
+
+ //content
+ FixedLine aCreateFromFL; // content, user, illustration
+ CheckBox aFromHeadingsCB;
+// PushButton aChapterDlgPB; //#outline level,removed by zhaojianwei
+ CheckBox aAddStylesCB;
+ PushButton aAddStylesPB;
+ Point aAddStylesPosDef;
+ Point aAddStylesPosUser;
+ //user
+ CheckBox aFromTablesCB;
+ CheckBox aFromFramesCB;
+ CheckBox aFromGraphicsCB;
+ CheckBox aFromOLECB;
+ CheckBox aLevelFromChapterCB;
+
+ //illustration + table
+ RadioButton aFromCaptionsRB;
+ RadioButton aFromObjectNamesRB;
+
+ //illustration and tables
+ FixedText aCaptionSequenceFT;
+ ListBox aCaptionSequenceLB;
+ FixedText aDisplayTypeFT;
+ ListBox aDisplayTypeLB;
+
+ //all but illustration and table
+ CheckBox aTOXMarksCB;
+
+ //
+
+ //index only
+ CheckBox aCollectSameCB;
+ CheckBox aUseFFCB;
+ CheckBox aUseDashCB;
+ CheckBox aCaseSensitiveCB;
+ CheckBox aInitialCapsCB;
+ CheckBox aKeyAsEntryCB;
+ CheckBox aFromFileCB;
+ MenuButton aAutoMarkPB;
+ FixedLine aIdxOptionsFL; // index only
+
+ // object only
+ SwOLENames aFromNames;
+ SvxCheckListBox aFromObjCLB;
+ FixedLine aFromObjFL;
+
+ CheckBox aSequenceCB;
+ FixedText aBracketFT;
+ ListBox aBracketLB;
+ FixedLine aAuthorityFormatFL;
+
+ //all
+ FixedLine aSortOptionsFL;
+ FixedText aLanguageFT;
+ SvxLanguageBox aLanguageLB;
+ FixedText aSortAlgorithmFT;
+ ListBox aSortAlgorithmLB;
+
+ IndexEntryRessource* pIndexRes;
+
+ Point aCBLeftPos1;
+ Point aCBLeftPos2;
+ Point aCBLeftPos3;
+
+ String aStyleArr[MAXLEVEL];
+ String sAutoMarkURL;
+ String sAutoMarkType;
+ String sAddStyleUser;
+ String sAddStyleContent;
+
+ const IndexEntrySupplierWrapper* pIndexEntryWrapper;
+
+ BOOL bFirstCall;
+
+ DECL_LINK(TOXTypeHdl, ListBox* );
+ DECL_LINK(TOXAreaHdl, ListBox* );
+// DECL_LINK(ChapterHdl, PushButton* ); //#outline level,removed by zhaojianwei
+ DECL_LINK(AddStylesHdl, PushButton* );
+ DECL_LINK(MenuEnableHdl, Menu*);
+ DECL_LINK(MenuExecuteHdl, Menu*);
+ DECL_LINK(LanguageHdl, ListBox*);
+
+ DECL_LINK(CheckBoxHdl, CheckBox* );
+ DECL_LINK(RadioButtonHdl, RadioButton* );
+ DECL_LINK(ModifyHdl, void*);
+
+ void ApplyTOXDescription();
+ void FillTOXDescription();
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+public:
+ SwTOXSelectTabPage(Window* pParent, const SfxItemSet& rAttrSet);
+ ~SwTOXSelectTabPage();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+
+ virtual void ActivatePage( const SfxItemSet& );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+ void SelectType(TOXTypes eSet); //preset TOXType, GlobalDoc
+ void SetWrtShell(SwWrtShell& rSh);
+};
+/* -----------------16.06.99 08:33-------------------
+
+ --------------------------------------------------*/
+
+DECLARE_LIST(TOXControlList, Control*)
+
+class SwTOXEdit;
+class SwTOXButton;
+class SwTOXEntryTabPage;
+
+class SwTokenWindow : public Window
+{
+ ImageButton aLeftScrollWin;
+ Window aCtrlParentWin;
+ ImageButton aRightScrollWin;
+ TOXControlList aControlList;
+ SwForm* pForm;
+ USHORT nLevel;
+ BOOL bValid;
+ String aButtonTexts[TOKEN_END]; // Text of the buttons
+ String aButtonHelpTexts[TOKEN_END]; // QuickHelpText of the buttons
+ String sCharStyle;
+ Link aButtonSelectedHdl;
+ Control* pActiveCtrl;
+ Link aModifyHdl;
+
+ SwTOXEntryTabPage* m_pParent;
+
+ DECL_LINK(EditResize, Edit*);
+ DECL_LINK(NextItemHdl, SwTOXEdit* );
+ DECL_LINK(TbxFocusHdl, SwTOXEdit* );
+ DECL_LINK(NextItemBtnHdl, SwTOXButton* );
+ DECL_LINK(TbxFocusBtnHdl, SwTOXButton* );
+ DECL_LINK(ScrollHdl, ImageButton* );
+
+ void SetActiveControl(Control* pSet);
+
+ Control* InsertItem(const String& rText, const SwFormToken& aToken);
+ void AdjustPositions();
+ void AdjustScrolling();
+ void MoveControls(long nOffset);
+
+public:
+ SwTokenWindow(SwTOXEntryTabPage* pParent, const ResId& rResId);
+ ~SwTokenWindow();
+
+ void SetForm(SwForm& rForm, USHORT nLevel);
+ USHORT GetLastLevel()const {return nLevel;};
+
+ BOOL IsValid() const {return bValid;}
+
+ void SetInvalid() {bValid = FALSE;}
+
+ String GetPattern() const;
+
+ void SetButtonSelectedHdl(const Link& rLink)
+ { aButtonSelectedHdl = rLink;}
+
+ void SetModifyHdl(const Link& rLink){aModifyHdl = rLink;}
+
+ Control* GetActiveControl()
+ { return pActiveCtrl;}
+
+ void InsertAtSelection(const String& rText, const SwFormToken& aToken);
+ void RemoveControl(SwTOXButton* pDel, BOOL bInternalCall = FALSE);
+
+ BOOL Contains(FormTokenType) const;
+
+ BOOL DetermineLinkStart();
+
+ //helper for pattern buttons and edits
+ BOOL CreateQuickHelp(Control* pCtrl,
+ const SwFormToken& rToken, const HelpEvent& );
+
+ virtual void Resize();
+ virtual void GetFocus();
+};
+/* -----------------------------23.12.99 14:16--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwTOXEntryTabPage;
+class SwIdxTreeListBox : public SvTreeListBox
+{
+ SwTOXEntryTabPage* pParent;
+
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+public:
+ SwIdxTreeListBox(SwTOXEntryTabPage* pPar, const ResId& rResId);
+};
+
+/* -----------------16.06.99 12:49-------------------
+
+ --------------------------------------------------*/
+class SwTOXEntryTabPage : public SfxTabPage
+{
+ FixedText aLevelFT;
+ SwIdxTreeListBox aLevelLB;
+
+ FixedText aTokenFT;
+ SwTokenWindow aTokenWIN;
+ PushButton aAllLevelsPB;
+
+ PushButton aEntryNoPB;
+ PushButton aEntryPB;
+ PushButton aTabPB;
+ PushButton aChapterInfoPB;
+ PushButton aPageNoPB;
+ PushButton aHyperLinkPB;
+
+ ListBox aAuthFieldsLB;
+ PushButton aAuthInsertPB;
+ PushButton aAuthRemovePB;
+
+ FixedText aCharStyleFT;
+ ListBox aCharStyleLB; // character style of the current token
+ PushButton aEditStylePB;
+
+ FixedText aChapterEntryFT;
+ ListBox aChapterEntryLB; // type of chapter info
+
+ FixedText aNumberFormatFT;
+ ListBox aNumberFormatLB; //!< format for numbering (E#)
+
+ FixedText aEntryOutlineLevelFT; //!< Fixed text, for i53420
+ NumericField aEntryOutlineLevelNF; //!< level to evaluate outline level to, for i53420
+ FixedText aFillCharFT;
+ ComboBox aFillCharCB; // fill char for tab stop
+ FixedText aTabPosFT;
+ MetricField aTabPosMF; // tab stop position
+ CheckBox aAutoRightCB;
+ FixedLine aEntryFL;
+
+ CheckBox aRelToStyleCB; // position relative to the right margin of the para style
+ FixedText aMainEntryStyleFT;
+ ListBox aMainEntryStyleLB; // character style of main entries in indexes
+ CheckBox aAlphaDelimCB;
+ CheckBox aCommaSeparatedCB;
+ FixedLine aFormatFL;
+
+ RadioButton aSortDocPosRB;
+ RadioButton aSortContentRB;
+ FixedLine aSortingFL;
+
+ FixedText aFirstKeyFT;
+ ListBox aFirstKeyLB;
+ ImageRadioButton aFirstSortUpRB;
+ ImageRadioButton aFirstSortDownRB;
+
+ FixedText aSecondKeyFT;
+ ListBox aSecondKeyLB;
+ ImageRadioButton aSecondSortUpRB;
+ ImageRadioButton aSecondSortDownRB;
+
+ FixedText aThirdKeyFT;
+ ListBox aThirdKeyLB;
+ ImageRadioButton aThirdSortUpRB;
+ ImageRadioButton aThirdSortDownRB;
+
+ FixedLine aSortKeyFL;
+
+ String sDelimStr;
+ String sLevelStr;
+ String sAuthTypeStr;
+
+ String sNoCharStyle;
+ String sNoCharSortKey;
+ Point aButtonPositions[5];
+ SwForm* m_pCurrentForm;
+
+ Point aRelToStylePos;
+ Point aRelToStyleIdxPos;
+ Size aLevelFLSize;
+
+ CurTOXType aLastTOXType;
+ BOOL bInLevelHdl;
+
+ Point aChapterEntryFTPosition; //!< holds position of ChapterEntryFT control,
+ //to be used in moving the element among different tokens
+ Point aEntryOutlineLevelFTPosition;//!< holds position ofrEntryOutlineLevelFT control
+ sal_Int32 nBiasToEntryPoint;
+
+ DECL_LINK(StyleSelectHdl, ListBox*);
+ DECL_LINK(EditStyleHdl, PushButton*);
+ DECL_LINK(InsertTokenHdl, PushButton*);
+ DECL_LINK(LevelHdl, SvTreeListBox*);
+ DECL_LINK(AutoRightHdl, CheckBox*);
+ DECL_LINK(TokenSelectedHdl, SwFormToken*);
+ DECL_LINK(TabPosHdl, MetricField*);
+ DECL_LINK(FillCharHdl, ComboBox*);
+ DECL_LINK(RemoveInsertAuthHdl, PushButton*);
+ DECL_LINK(SortKeyHdl, RadioButton*);
+ DECL_LINK(ChapterInfoHdl, ListBox*);
+ DECL_LINK(ChapterInfoOutlineHdl, NumericField*);
+ DECL_LINK(NumberFormatHdl, ListBox*);
+
+ DECL_LINK(AllLevelsHdl, PushButton*);
+
+ void EnableButtons();
+ void WriteBackLevel();
+ void UpdateDescriptor();
+ DECL_LINK(ModifyHdl, void*);
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+public:
+ SwTOXEntryTabPage(Window* pParent, const SfxItemSet& rAttrSet);
+ ~SwTOXEntryTabPage();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+ virtual void ActivatePage( const SfxItemSet& );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+ void SetWrtShell(SwWrtShell& rSh);
+
+ String GetLevelHelp(USHORT nLevel) const;
+
+ void PreTokenButtonRemoved(const SwFormToken& rToken);
+};
+/* -----------------05.07.99 13:00-------------------
+
+ --------------------------------------------------*/
+class SwTOXStylesTabPage : public SfxTabPage
+{
+ FixedText aLevelFT2;
+ ListBox aLevelLB;
+ FixedText aTemplateFT;
+ ListBox aParaLayLB;
+ PushButton aStdBT;
+ ImageButton aAssignBT;
+ PushButton aEditStyleBT;
+ FixedLine aFormatFL;
+
+ SwForm* m_pCurrentForm;
+// void UpdatePattern();
+
+ DECL_LINK( EditStyleHdl, Button *);
+ DECL_LINK( StdHdl, Button * );
+ DECL_LINK( EnableSelectHdl, ListBox * );
+ DECL_LINK( DoubleClickHdl, Button * );
+ DECL_LINK( AssignHdl, Button * );
+ DECL_LINK( ModifyHdl, void*);
+
+ SwForm& GetForm()
+ {
+ SwMultiTOXTabDialog* pDlg = (SwMultiTOXTabDialog*)GetTabDialog();
+ return *pDlg->GetForm(pDlg->GetCurrentTOXType());
+ }
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+public:
+ SwTOXStylesTabPage(Window* pParent, const SfxItemSet& rAttrSet);
+ ~SwTOXStylesTabPage();
+
+ virtual BOOL FillItemSet( SfxItemSet& );
+ virtual void Reset( const SfxItemSet& );
+
+ virtual void ActivatePage( const SfxItemSet& );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+ static SfxTabPage* Create( Window* pParent,
+ const SfxItemSet& rAttrSet);
+
+};
+
+#endif // _SWUI_CNTTAB_HXX
+
diff --git a/sw/source/ui/inc/swuiidxmrk.hxx b/sw/source/ui/inc/swuiidxmrk.hxx
new file mode 100644
index 000000000000..3f529f91affe
--- /dev/null
+++ b/sw/source/ui/inc/swuiidxmrk.hxx
@@ -0,0 +1,295 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWUI_IDXMRK_HXX
+#define _SWUI_IDXMRK_HXX
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <sfx2/basedlgs.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+#ifndef _COMBOBOX_HXX //autogen
+#include <vcl/combobox.hxx>
+#endif
+#include <svx/stddlg.hxx>
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _IMAGEBTN_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <sfx2/childwin.hxx>
+#include "toxe.hxx"
+#include <svtools/stdctrl.hxx>
+#include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp>
+
+class SwWrtShell;
+class SwTOXMgr;
+class SwTOXMark;
+/*--------------------------------------------------------------------
+ Beschreibung: Markierung fuer Verzeichniseintrag einfuegen
+ --------------------------------------------------------------------*/
+class SwIndexMarkFloatDlg;
+class SwIndexMarkModalDlg;
+class SwIndexMarkDlg : public Window
+{
+ friend class SwIndexMarkFloatDlg;
+ friend class SwIndexMarkModalDlg;
+ FixedText aTypeFT;
+ ListBox aTypeDCB;
+ ImageButton aNewBT;
+
+ FixedText aEntryFT;
+ Edit aEntryED;
+ FixedText aPhoneticFT0;
+ Edit aPhoneticED0;
+
+ FixedText aKeyFT;
+ ComboBox aKeyDCB;
+ FixedText aPhoneticFT1;
+ Edit aPhoneticED1;
+
+ FixedText aKey2FT;
+ ComboBox aKey2DCB;
+ FixedText aPhoneticFT2;
+ Edit aPhoneticED2;
+
+ FixedText aLevelFT;
+ NumericField aLevelED;
+ CheckBox aMainEntryCB;
+ CheckBox aApplyToAllCB;
+ CheckBox aSearchCaseSensitiveCB;
+ CheckBox aSearchCaseWordOnlyCB;
+
+ FixedLine aIndexFL;
+
+ OKButton aOKBT;
+ CancelButton aCancelBT;
+ HelpButton aHelpBT;
+ PushButton aDelBT;
+ //PushButton aNewBT;
+
+ ImageButton aPrevSameBT;
+ ImageButton aNextSameBT;
+ ImageButton aPrevBT;
+ ImageButton aNextBT;
+
+ String aOrgStr;
+ sal_Int32 nOptionsId;
+ sal_Bool bDel;
+ sal_Bool bNewMark;
+ sal_Bool bSelected;
+
+ BOOL bPhoneticED0_ChangedByUser;
+ BOOL bPhoneticED1_ChangedByUser;
+ BOOL bPhoneticED2_ChangedByUser;
+ LanguageType nLangForPhoneticReading; //Language of current text used for phonetic reading proposal
+ BOOL bIsPhoneticReadingEnabled; //this value states wether phopentic reading is enabled in principle dependend of global cjk settings and language of current entry
+ com::sun::star::uno::Reference< com::sun::star::i18n::XExtendedIndexEntrySupplier >
+ xExtendedIndexEntrySupplier;
+
+ SwTOXMgr* pTOXMgr;
+ SwWrtShell* pSh;
+
+ void Apply();
+ void InitControls();
+ void InsertMark();
+ void UpdateMark();
+
+ DECL_LINK( InsertHdl, Button * );
+ DECL_LINK( CloseHdl, Button * );
+ DECL_LINK( DelHdl, Button * );
+ DECL_LINK( NextHdl, Button * );
+ DECL_LINK( NextSameHdl, Button * );
+ DECL_LINK( PrevHdl, Button * );
+ DECL_LINK( PrevSameHdl, Button * );
+ DECL_LINK( ModifyHdl, ListBox* pBox = 0 );
+ DECL_LINK( KeyDCBModifyHdl, ComboBox * );
+ DECL_LINK( NewUserIdxHdl, Button*);
+ DECL_LINK( SearchTypeHdl, CheckBox*);
+ DECL_LINK( PhoneticEDModifyHdl, Edit * );
+
+ //this method updates the values from 'nLangForPhoneticReading' and 'bIsPhoneticReadingEnabled'
+ //it needs to be called ones if this dialog is opened to create a new entry (in InitControls),
+ //or otherwise it has to be called for each changed TOXMark (in UpdateDialog)
+ void UpdateLanguageDependenciesForPhoneticReading();
+ String GetDefaultPhoneticReading( const String& rText );
+
+ void UpdateKeyBoxes();
+
+ void UpdateDialog();
+ void InsertUpdate();
+
+ virtual void Activate();
+
+public:
+
+ SwIndexMarkDlg( Window *pParent,
+ sal_Bool bNewDlg,
+ const ResId& rResId,
+ sal_Int32 _nOptionsId,
+ SwWrtShell& rWrtShell );
+
+
+ ~SwIndexMarkDlg();
+
+ void ReInitDlg(SwWrtShell& rWrtShell, SwTOXMark* pCurTOXMark = 0);
+ sal_Bool IsTOXType(const String& rName)
+ {return LISTBOX_ENTRY_NOTFOUND != aTypeDCB.GetEntryPos(rName);}
+};
+/* -----------------06.10.99 10:11-------------------
+
+ --------------------------------------------------*/
+class SwIndexMarkFloatDlg : public SfxModelessDialog
+{
+ SwIndexMarkDlg aDlg;
+ virtual void Activate();
+ public:
+ SwIndexMarkFloatDlg( SfxBindings* pBindings,
+ SfxChildWindow* pChild,
+ Window *pParent,
+ SfxChildWinInfo* pInfo,
+ sal_Bool bNew=sal_True);
+ void ReInitDlg(SwWrtShell& rWrtShell);
+};
+/* -----------------06.10.99 10:33-------------------
+
+ --------------------------------------------------*/
+class SwIndexMarkModalDlg : public SvxStandardDialog
+{
+ SwIndexMarkDlg aDlg;
+public:
+ SwIndexMarkModalDlg(Window *pParent, SwWrtShell& rSh, SwTOXMark* pCurTOXMark);
+
+ virtual void Apply();
+ void ReInitDlg(SwWrtShell& rWrtShell);
+};
+
+/* -----------------15.09.99 08:39-------------------
+
+ --------------------------------------------------*/
+class SwAuthMarkModalDlg;
+class SwAuthMarkDlg : public Window
+{
+ static sal_Bool bIsFromComponent;
+
+ friend class SwAuthMarkModalDlg;
+ friend class SwAuthMarkFloatDlg;
+
+ RadioButton aFromComponentRB;
+ RadioButton aFromDocContentRB;
+ FixedText aAuthorFT;
+ FixedInfo aAuthorFI;
+ FixedText aTitleFT;
+ FixedInfo aTitleFI;
+ FixedText aEntryFT;
+ Edit aEntryED;
+ ListBox aEntryLB;
+
+ FixedLine aEntryFL;
+
+ OKButton aOKBT;
+ CancelButton aCancelBT;
+ HelpButton aHelpBT;
+ PushButton aCreateEntryPB;
+ PushButton aEditEntryPB;
+
+ String sChangeST;
+ sal_Bool bNewEntry;
+ sal_Bool bBibAccessInitialized;
+
+ SwWrtShell* pSh;
+
+ String m_sColumnTitles[AUTH_FIELD_END];
+ String m_sFields[AUTH_FIELD_END];
+
+ String m_sCreatedEntry[AUTH_FIELD_END];
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xBibAccess;
+
+ DECL_LINK(InsertHdl, PushButton*);
+ DECL_LINK(CloseHdl, PushButton*);
+ DECL_LINK(CreateEntryHdl, PushButton*);
+ DECL_LINK(CompEntryHdl, ListBox*);
+ DECL_LINK(ChangeSourceHdl, RadioButton*);
+ DECL_LINK(IsEntryAllowedHdl, Edit*);
+ DECL_LINK(EditModifyHdl, Edit*);
+
+ void InitControls();
+ virtual void Activate();
+public:
+
+ SwAuthMarkDlg( Window *pParent,
+ const ResId& rResId,
+ sal_Bool bNew=sal_True);
+ ~SwAuthMarkDlg();
+
+ void ReInitDlg(SwWrtShell& rWrtShell);
+};
+/* -----------------06.10.99 10:11-------------------
+
+ --------------------------------------------------*/
+class SwAuthMarkFloatDlg : public SfxModelessDialog
+{
+ SwAuthMarkDlg aDlg;
+ virtual void Activate();
+ public:
+ SwAuthMarkFloatDlg( SfxBindings* pBindings,
+ SfxChildWindow* pChild,
+ Window *pParent,
+ SfxChildWinInfo* pInfo,
+ sal_Bool bNew=sal_True);
+ void ReInitDlg(SwWrtShell& rWrtShell);
+};
+/* -----------------06.10.99 10:33-------------------
+
+ --------------------------------------------------*/
+class SwAuthMarkModalDlg : public SvxStandardDialog
+{
+ SwAuthMarkDlg aDlg;
+public:
+ SwAuthMarkModalDlg(Window *pParent, SwWrtShell& rSh);
+
+ virtual void Apply();
+ void ReInitDlg(SwWrtShell& rWrtShell);
+};
+
+
+#endif // _SWUI_IDXMRK_HXX
+
diff --git a/sw/source/ui/inc/swuipardlg.hxx b/sw/source/ui/inc/swuipardlg.hxx
new file mode 100644
index 000000000000..d9460f62ad65
--- /dev/null
+++ b/sw/source/ui/inc/swuipardlg.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWUI_PARDLG_HXX
+#define _SWUI_PARDLG_HXX
+#include "pardlg.hxx"
+
+class SwParaDlg: public SfxTabDialog
+{
+ SwView& rView;
+ USHORT nHtmlMode;
+ BYTE nDlgMode;
+ BOOL bDrawParaDlg;
+
+ void PageCreated(USHORT nID, SfxTabPage& rPage);
+
+public:
+ SwParaDlg( Window *pParent,
+ SwView& rVw,
+ const SfxItemSet&,
+ BYTE nDialogMode,
+ const String *pCollName = 0,
+ BOOL bDraw = FALSE,
+ UINT16 nDefPage = 0);
+ ~SwParaDlg();
+};
+
+#endif
diff --git a/sw/source/ui/inc/swvset.hxx b/sw/source/ui/inc/swvset.hxx
new file mode 100644
index 000000000000..4e6b2a46f856
--- /dev/null
+++ b/sw/source/ui/inc/swvset.hxx
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWVSET_HXX
+#define _SWVSET_HXX
+#include <tools/list.hxx>
+#include <svx/numvset.hxx>
+
+class SwRulerValueSet : public SvxBmpNumValueSet
+{
+ public:
+ SwRulerValueSet( Window* pParent,
+ const ResId& rResId );
+ ~SwRulerValueSet();
+ virtual void UserDraw( const UserDrawEvent& rUDEvt );
+};
+#endif
+
diff --git a/sw/source/ui/inc/swwrtshitem.hxx b/sw/source/ui/inc/swwrtshitem.hxx
new file mode 100644
index 000000000000..3e33c3722f6b
--- /dev/null
+++ b/sw/source/ui/inc/swwrtshitem.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_WRTSHELLITEM_HXX
+#define _SW_WRTSHELLITEM_HXX
+#include <svl/poolitem.hxx>
+#include "swdllapi.h"
+
+class SwWrtShell;
+
+class SW_DLLPUBLIC SwWrtShellItem: public SfxPoolItem
+{
+ SwWrtShell* pWrtSh;
+
+public:
+ TYPEINFO();
+ SwWrtShellItem();
+ SwWrtShellItem( USHORT nWhich , SwWrtShell* pWrtSh);
+ SwWrtShellItem( const SwWrtShellItem& );
+
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ SwWrtShell* GetValue() const { return pWrtSh; }
+
+};
+
+#endif
diff --git a/sw/source/ui/inc/syncbtn.hxx b/sw/source/ui/inc/syncbtn.hxx
new file mode 100644
index 000000000000..0ae8c7009426
--- /dev/null
+++ b/sw/source/ui/inc/syncbtn.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWSYNCBTN_HXX
+#define _SWSYNCBTN_HXX
+#include <sfx2/childwin.hxx>
+
+#ifdef _SYNCDLG
+#include <sfx2/basedlgs.hxx>
+
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+class SwSyncBtnDlg : public SfxFloatingWindow
+{
+ PushButton aSyncBtn;
+
+ DECL_LINK( BtnHdl, PushButton* pBtn = 0 );
+
+public:
+ SwSyncBtnDlg(SfxBindings*, SfxChildWindow*, Window *pParent);
+ ~SwSyncBtnDlg();
+};
+#endif
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+class SwSyncChildWin : public SfxChildWindow
+{
+public:
+ SwSyncChildWin( Window* ,
+ USHORT nId,
+ SfxBindings*,
+ SfxChildWinInfo* );
+
+ SFX_DECL_CHILDWINDOW( SwSyncChildWin );
+};
+
+
+#endif
+
diff --git a/sw/source/ui/inc/table.hrc b/sw/source/ui/inc/table.hrc
new file mode 100644
index 000000000000..076028925804
--- /dev/null
+++ b/sw/source/ui/inc/table.hrc
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "rcid.hrc"
+
+#define DLG_INSERT_TABLE RC_TABLE_BEGIN
+#define DLG_FORMAT_TABLE (RC_TABLE_BEGIN + 1)
+#define DLG_CONV_TEXT_TABLE (RC_TABLE_BEGIN + 2)
+//#define DLG_INS_ROW_COL (RC_TABLE_BEGIN + 3) moved to svx
+#define DLG_ROW_HEIGHT (RC_TABLE_BEGIN + 4)
+#define DLG_SPLIT (RC_TABLE_BEGIN + 5)
+#define DLG_COL_WIDTH (RC_TABLE_BEGIN + 6)
+#define MSG_ERR_TABLE_MERGE (RC_TABLE_BEGIN + 7)
+#define DLG_AUTOFMT_TABLE (RC_TABLE_BEGIN + 9)
+#define DLG_SWDLG_STRINPUT (RC_TABLE_BEGIN + 10)
+#define TP_TABLE_COLUMN (RC_TABLE_BEGIN + 11)
+#define DLG_INSERT_CHART (RC_TABLE_BEGIN + 12)
+#define MSG_WRONG_TABLENAME (RC_TABLE_BEGIN + 13)
+#define DLG_SPLIT_TABLE (RC_TABLE_BEGIN + 14)
+#define DLG_MERGE_TABLE (RC_TABLE_BEGIN + 15)
+
+#define TABLE_ACT_END DLG_MERGE_TABLE
+
+#if TABLE_ACT_END > RC_TABLE_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
diff --git a/sw/source/ui/inc/tabledlg.hxx b/sw/source/ui/inc/tabledlg.hxx
new file mode 100644
index 000000000000..497d16449774
--- /dev/null
+++ b/sw/source/ui/inc/tabledlg.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TABLEDLG_HXX
+#define _TABLEDLG_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+
+#include "swtypes.hxx"
+#include "swtablerep.hxx"
+
+class SwWrtShell;
+class SwTabCols;
+struct TColumn;
+
+/*-------------------------------------------------------
+ Tabellendialog
+--------------------------------------------------------- */
+class SwTableTabDlg : public SfxTabDialog
+{
+ SwWrtShell* pShell;
+ USHORT nHtmlMode;
+
+ virtual void PageCreated(USHORT nId, SfxTabPage& rPage);
+public:
+ SwTableTabDlg( Window* pParent, SfxItemPool& Pool,
+ const SfxItemSet* pItemSet, SwWrtShell* pSh );
+};
+
+
+#endif
diff --git a/sw/source/ui/inc/tablemgr.hxx b/sw/source/ui/inc/tablemgr.hxx
new file mode 100644
index 000000000000..4256d4069fe2
--- /dev/null
+++ b/sw/source/ui/inc/tablemgr.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TABLEMGR_HXX
+#define _TABLEMGR_HXX
+
+#include "swdllapi.h"
+#include "swtypes.hxx"
+#include "tabcol.hxx"
+
+class SwFrmFmt;
+class SwWrtShell;
+class Window;
+class SfxItemSet;
+class SwFlyFrmFmt;
+
+namespace com { namespace sun { namespace star {
+ namespace frame {
+ class XModel; }
+ namespace chart2 {
+ namespace data {
+ class XDataProvider; } }
+}}}
+
+const SwTwips lAutoWidth = INVALID_TWIPS;
+const char cParaDelim = 0x0a;
+
+class SW_DLLPUBLIC SwTableFUNC
+{
+ SwFrmFmt *pFmt;
+ SwWrtShell *pSh;
+ BOOL bCopy;
+ SwTabCols aCols;
+
+private:
+ SW_DLLPRIVATE int GetRightSeparator(int nNum) const;
+
+public:
+ inline SwTableFUNC(SwFrmFmt &);
+ SwTableFUNC(SwWrtShell *pShell, BOOL bCopyFmt = FALSE);
+ ~SwTableFUNC();
+
+ void InitTabCols();
+ void ColWidthDlg(Window *pParent );
+ SwTwips GetColWidth(USHORT nNum) const;
+ SwTwips GetMaxColWidth(USHORT nNum) const;
+ void SetColWidth(USHORT nNum, SwTwips nWidth );
+ USHORT GetColCount() const;
+ USHORT GetCurColNum() const;
+
+ BOOL IsTableSelected() const { return pFmt != 0; }
+
+ const SwFrmFmt *GetTableFmt() const { return pFmt; }
+
+ SwWrtShell* GetShell() const { return pSh; }
+
+ // @deprecated
+ void UpdateChart();
+
+ /// @return the XModel of the newly inserted chart if successfull
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ InsertChart( ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > &rxDataProvider, sal_Bool bFillWithData, const rtl::OUString &rCellRange, SwFlyFrmFmt** ppFlyFrmFmt = 0 );
+};
+
+inline SwTableFUNC::SwTableFUNC(SwFrmFmt &rFmt) :
+ pFmt(&rFmt),
+ pSh(0),
+ bCopy(FALSE)
+{
+}
+
+#endif
diff --git a/sw/source/ui/inc/tabsh.hxx b/sw/source/ui/inc/tabsh.hxx
new file mode 100644
index 000000000000..3e3c1304b1ee
--- /dev/null
+++ b/sw/source/ui/inc/tabsh.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWTABSH_HXX
+#define _SWTABSH_HXX
+
+#include "basesh.hxx"
+#include "swdllapi.h"
+
+class SfxItemSet;
+class SwWrtShell;
+
+SW_DLLPUBLIC void ItemSetToTableParam( const SfxItemSet& rSet, SwWrtShell &rSh );
+
+extern const USHORT __FAR_DATA aUITableAttrRange[];
+SW_DLLPUBLIC const USHORT* SwuiGetUITableAttrRange();
+
+class SwTableShell: public SwBaseShell
+{
+public:
+ SFX_DECL_INTERFACE(SW_TABSHELL)
+ TYPEINFO();
+
+ void Execute(SfxRequest &);
+ void GetState(SfxItemSet &);
+ void GetFrmBorderState(SfxItemSet &rSet);
+ void GetLineStyleState(SfxItemSet &rSet);
+ void ExecTableStyle(SfxRequest& rReq);
+
+ void ExecNumberFormat(SfxRequest& rReq);
+
+ SwTableShell(SwView &rView);
+};
+
+#endif
diff --git a/sw/source/ui/inc/tautofmt.hxx b/sw/source/ui/inc/tautofmt.hxx
new file mode 100644
index 000000000000..9c35450eb208
--- /dev/null
+++ b/sw/source/ui/inc/tautofmt.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_TAUTOFMT_HXX
+#define SW_TAUTOFMT_HXX
+#include <sfx2/basedlgs.hxx>
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _MOREBTN_HXX //autogen
+#include <vcl/morebtn.hxx>
+#endif
+
+#ifndef _VIRDEV_HXX //autogen
+#include <vcl/virdev.hxx>
+#endif
+
+class SwTableAutoFmt;
+class AutoFmtPreview;
+class SwTableAutoFmtTbl;
+class SwWrtShell;
+
+//------------------------------------------------------------------------
+
+enum AutoFmtLine { TOP_LINE, BOTTOM_LINE, LEFT_LINE, RIGHT_LINE };
+
+//========================================================================
+
+class SwAutoFormatDlg : public SfxModalDialog
+{
+ FixedLine aFlFormat;
+ ListBox aLbFormat;
+ CheckBox aBtnNumFormat;
+ CheckBox aBtnBorder;
+ CheckBox aBtnFont;
+ CheckBox aBtnPattern;
+ CheckBox aBtnAlignment;
+ FixedLine aFlFormats;
+ OKButton aBtnOk;
+ CancelButton aBtnCancel;
+ HelpButton aBtnHelp;
+ PushButton aBtnAdd;
+ PushButton aBtnRemove;
+ PushButton aBtnRename;
+ MoreButton aBtnMore;
+ String aStrTitle;
+ String aStrLabel;
+ String aStrClose;
+ String aStrDelTitle;
+ String aStrDelMsg;
+ String aStrRenameTitle;
+ String aStrInvalidFmt;
+ AutoFmtPreview* pWndPreview;
+
+ //------------------------
+ SwWrtShell* pShell;
+ SwTableAutoFmtTbl* pTableTbl;
+ BYTE nIndex;
+ BYTE nDfltStylePos;
+ BOOL bCoreDataChanged : 1;
+ BOOL bSetAutoFmt : 1;
+
+
+ void Init( const SwTableAutoFmt* pSelFmt );
+ void UpdateChecks( const SwTableAutoFmt&, BOOL bEnableBtn );
+ //------------------------
+ DECL_LINK( CheckHdl, Button * );
+ DECL_LINK( OkHdl, Button * );
+ DECL_LINK( AddHdl, void * );
+ DECL_LINK( RemoveHdl, void * );
+ DECL_LINK( RenameHdl, void * );
+ DECL_LINK( SelFmtHdl, void * );
+
+public:
+ SwAutoFormatDlg( Window* pParent, SwWrtShell* pShell,
+ BOOL bSetAutoFmt = TRUE,
+ const SwTableAutoFmt* pSelFmt = 0 );
+ virtual ~SwAutoFormatDlg();
+
+ void FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const;
+};
+
+
+#endif // SW_AUTOFMT_HXX
+
diff --git a/sw/source/ui/inc/tblctrl.hxx b/sw/source/ui/inc/tblctrl.hxx
new file mode 100644
index 000000000000..f46103098278
--- /dev/null
+++ b/sw/source/ui/inc/tblctrl.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TBLCTRL_HXX
+#define _TBLCTRL_HXX
+
+
+#include <sfx2/tbxctrl.hxx>
+
+
+//----------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------
+
+class SwTableOptimizeCtrl : public SfxToolBoxControl
+{
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SwTableOptimizeCtrl( USHORT nSlotId, USHORT nId, ToolBox& rTbx );
+ ~SwTableOptimizeCtrl();
+
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+
+};
+
+//
+//----------------------------------------------------------------------------
+
+#endif
+
+
diff --git a/sw/source/ui/inc/tblnumfm.hxx b/sw/source/ui/inc/tblnumfm.hxx
new file mode 100644
index 000000000000..b6118f3943fe
--- /dev/null
+++ b/sw/source/ui/inc/tblnumfm.hxx
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TBLNUMFM_HXX
+#define _TBLNUMFM_HXX
+
+#include <sfx2/basedlgs.hxx>
+
+class Window;
+class SfxItemSet;
+
+class SwNumFmtDlg : public SfxSingleTabDialog
+{
+public:
+
+ SwNumFmtDlg(Window* pParent, const SfxItemSet& rSet);
+ ~SwNumFmtDlg();
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/tbxanchr.hxx b/sw/source/ui/inc/tbxanchr.hxx
new file mode 100644
index 000000000000..a2c378f15198
--- /dev/null
+++ b/sw/source/ui/inc/tbxanchr.hxx
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TBXANCHR_HXX
+#define _TBXANCHR_HXX
+
+#include <sfx2/tbxctrl.hxx>
+
+class SwTbxAnchor : public SfxToolBoxControl
+{
+ USHORT nActAnchorId;
+
+public:
+
+ virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual void Click();
+ virtual SfxPopupWindow* CreatePopupWindow();
+
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SwTbxAnchor( USHORT nSlotId, USHORT nId, ToolBox& rTbx );
+ ~SwTbxAnchor();
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/textcontrolcombo.hxx b/sw/source/ui/inc/textcontrolcombo.hxx
new file mode 100644
index 000000000000..dbf42d86d085
--- /dev/null
+++ b/sw/source/ui/inc/textcontrolcombo.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TEXTCONTROLCOMBO_HXX
+#define _TEXTCONTROLCOMBO_HXX
+
+#ifndef _FIXED_HXX
+#include <vcl/fixed.hxx>
+#endif
+
+#include <vcl/field.hxx>
+#include "swdllapi.h"
+
+class SW_DLLPUBLIC TextControlCombo : public Window
+{
+protected:
+
+ Control& mrCtrl;
+ FixedText& mrFTbefore;
+ FixedText& mrFTafter;
+
+public:
+
+ using Window::Enable;
+ using Window::Disable;
+
+ TextControlCombo( Window* _pParent, const ResId& _rResId,
+ Control& _rCtrl, FixedText& _rFTbefore, FixedText& _rFTafter );
+ virtual ~TextControlCombo();
+
+ void Arrange( FixedText& _rOrg, BOOL bShow = true );
+
+ // identical to window functionality
+ void Show( BOOL bVisible = TRUE, USHORT nFlags = 0 );
+ void Hide( USHORT nFlags = 0 ) { Show( FALSE, nFlags ); }
+
+ void Enable( BOOL bEnable = TRUE, BOOL bChild = TRUE );
+ void Disable( BOOL bChild = TRUE ) { Enable( FALSE, bChild ); }
+};
+
+
+#endif
diff --git a/sw/source/ui/inc/textsh.hxx b/sw/source/ui/inc/textsh.hxx
new file mode 100644
index 000000000000..d4ec7b99ed25
--- /dev/null
+++ b/sw/source/ui/inc/textsh.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SWTEXTSH_HXX
+#define _SWTEXTSH_HXX
+
+#include <basesh.hxx>
+
+class AbstractSvxPostItDialog;
+class SwFldMgr;
+class SvxHyperlinkItem;
+
+class SwTextShell: public SwBaseShell
+{
+ SwFldMgr* pPostItFldMgr;
+
+ void InsertSymbol( SfxRequest& );
+ void InsertHyperlink(const SvxHyperlinkItem& rHlnkItem);
+ bool InsertMediaDlg( SfxRequest& );
+ void ChangeHeaderOrFooter(const String& rStyleName, BOOL bHeader, BOOL bOn, BOOL bShowWarning);
+
+public:
+ SFX_DECL_INTERFACE(SW_TEXTSHELL)
+ TYPEINFO();
+
+//CHINA001 DECL_LINK( PostItNextHdl, Button * );
+//CHINA001 DECL_LINK( PostItPrevHdl, Button * );
+//CHINA001 DECL_LINK( RedlineNextHdl, Button * );
+//CHINA001 DECL_LINK( RedlinePrevHdl, Button * );
+ DECL_LINK( RedlineNextHdl, AbstractSvxPostItDialog * );
+ DECL_LINK( RedlinePrevHdl, AbstractSvxPostItDialog * );
+
+ void Execute(SfxRequest &);
+ void GetState(SfxItemSet &);
+
+ void ExecInsert(SfxRequest &);
+ void StateInsert(SfxItemSet&);
+ void ExecDelete(SfxRequest &);
+ void ExecEnterNum(SfxRequest &);
+ void ExecBasicMove(SfxRequest &);
+ void ExecMove(SfxRequest &);
+ void ExecMovePage(SfxRequest &);
+ void ExecMoveCol(SfxRequest &);
+ void ExecMoveLingu(SfxRequest &);
+ void ExecMoveMisc(SfxRequest &);
+ void ExecField(SfxRequest &rReq);
+ void StateField(SfxItemSet &);
+ void ExecIdx(SfxRequest &);
+ void GetIdxState(SfxItemSet &);
+ void ExecGlossary(SfxRequest &);
+
+ void ExecCharAttr(SfxRequest &);
+ void ExecCharAttrArgs(SfxRequest &);
+ void ExecParaAttr(SfxRequest &);
+ void ExecParaAttrArgs(SfxRequest &);
+ void ExecAttr(SfxRequest &);
+ void ExecDB(SfxRequest &);
+ void ExecTransliteration(SfxRequest &);
+
+ void GetAttrState(SfxItemSet &);
+
+ SwTextShell(SwView &rView);
+ virtual ~SwTextShell();
+};
+
+#endif
diff --git a/sw/source/ui/inc/tmpdlg.hxx b/sw/source/ui/inc/tmpdlg.hxx
new file mode 100644
index 000000000000..7971a6607915
--- /dev/null
+++ b/sw/source/ui/inc/tmpdlg.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWTMPDLG_HXX
+#define _SWTMPDLG_HXX
+
+#include <sfx2/styledlg.hxx>
+
+class SfxItemSet;
+class SwWrtShell;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Der Tabdialog Traeger der TabPages
+ --------------------------------------------------------------------*/
+
+class SwTemplateDlg: public SfxStyleDialog
+{
+
+ USHORT nType;
+ USHORT nHtmlMode;
+ SwWrtShell* pWrtShell;
+ BOOL bNewStyle;
+
+ DECL_LINK( NumOptionsHdl, PushButton* );
+
+public:
+ SwTemplateDlg( Window* pParent,
+ SfxStyleSheetBase& rBase,
+ USHORT nRegion,
+ BOOL bColumn = FALSE,
+ SwWrtShell* pActShell = 0,
+ BOOL bNew = FALSE );
+
+ ~SwTemplateDlg();
+ const SfxItemSet* GetRefreshedSet();
+
+ virtual void PageCreated( USHORT nId, SfxTabPage &rPage );
+ virtual short Ok();
+};
+
+
+#endif
+
diff --git a/sw/source/ui/inc/tmplctrl.hxx b/sw/source/ui/inc/tmplctrl.hxx
new file mode 100644
index 000000000000..206645d7fe83
--- /dev/null
+++ b/sw/source/ui/inc/tmplctrl.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TMPLCTRL_HXX
+#define _TMPLCTRL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/stbitem.hxx>
+#include <tools/string.hxx>
+
+
+// class BookmarkToolBoxControl -------------------------------------------
+
+class SwTemplateControl : public SfxStatusBarControl
+{
+protected:
+ virtual void Command( const CommandEvent& rCEvt );
+public:
+ virtual void StateChanged( USHORT nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual void Paint( const UserDrawEvent& rEvt );
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SwTemplateControl( USHORT nSlotId, USHORT nId, StatusBar& rStb );
+ ~SwTemplateControl();
+
+private:
+ String sTemplate;
+};
+
+
+#endif
+
diff --git a/sw/source/ui/inc/toolbox.hrc b/sw/source/ui/inc/toolbox.hrc
new file mode 100644
index 000000000000..73ab3059d705
--- /dev/null
+++ b/sw/source/ui/inc/toolbox.hrc
@@ -0,0 +1,563 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TOOLBOX_HRC
+#define _TOOLBOX_HRC
+#include "shells.hrc"
+#include "globals.hrc"
+#include "cmdid.h"
+#define MN_FONT\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_CHAR_FONT;\
+ HelpID = SID_ATTR_CHAR_FONT;\
+ };\
+ ToolBoxItem { Type = TOOLBOXITEM_SEPARATOR ; }; \
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_CHAR_FONTHEIGHT ; \
+ HelpID = SID_ATTR_CHAR_FONTHEIGHT ; \
+ };\
+ ToolBoxItem { Type = TOOLBOXITEM_SEPARATOR ; };
+
+#define MN_TEXT1( HIDE )\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_CHAR_WEIGHT ; \
+ HelpID = SID_ATTR_CHAR_WEIGHT ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_CHAR_POSTURE ; \
+ HelpID = SID_ATTR_CHAR_POSTURE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_CHAR_UNDERLINE ; \
+ HelpID = SID_ATTR_CHAR_UNDERLINE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_CHAR_OVERLINE ; \
+ HelpID = SID_ATTR_CHAR_OVERLINE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_SET_SUPER_SCRIPT;\
+ HelpID = FN_SET_SUPER_SCRIPT;\
+ Hide = HIDE;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_SET_SUB_SCRIPT;\
+ HelpID = FN_SET_SUB_SCRIPT;\
+ Hide = HIDE;\
+ };\
+ ToolBoxItem\
+ {\
+ Type = TOOLBOXITEM_SEPARATOR ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_PARA_ADJUST_LEFT ; \
+ HelpID = SID_ATTR_PARA_ADJUST_LEFT ; \
+ RadioCheck = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_PARA_ADJUST_CENTER ; \
+ HelpID = SID_ATTR_PARA_ADJUST_CENTER ; \
+ RadioCheck = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_PARA_ADJUST_RIGHT ; \
+ HelpID = SID_ATTR_PARA_ADJUST_RIGHT ; \
+ RadioCheck = TRUE ; \
+ };\
+
+#define MN_TEXT1_RTL( HIDE )\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_CHAR_WEIGHT ; \
+ HelpID = SID_ATTR_CHAR_WEIGHT ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_CHAR_POSTURE ; \
+ HelpID = SID_ATTR_CHAR_POSTURE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_CHAR_UNDERLINE ; \
+ HelpID = SID_ATTR_CHAR_UNDERLINE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_CHAR_OVERLINE ; \
+ HelpID = SID_ATTR_CHAR_OVERLINE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_SET_SUPER_SCRIPT;\
+ HelpID = FN_SET_SUPER_SCRIPT;\
+ Hide = HIDE;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_SET_SUB_SCRIPT;\
+ HelpID = FN_SET_SUB_SCRIPT;\
+ Hide = HIDE;\
+ };\
+ ToolBoxItem\
+ {\
+ Type = TOOLBOXITEM_SEPARATOR ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_PARA_ADJUST_RIGHT ; \
+ HelpID = SID_ATTR_PARA_ADJUST_RIGHT ; \
+ RadioCheck = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_PARA_ADJUST_CENTER ; \
+ HelpID = SID_ATTR_PARA_ADJUST_CENTER ; \
+ RadioCheck = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_PARA_ADJUST_LEFT ; \
+ HelpID = SID_ATTR_PARA_ADJUST_LEFT ; \
+ RadioCheck = TRUE ; \
+ };\
+
+#define MN_TEXT1_BLOCK \
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_PARA_ADJUST_BLOCK ; \
+ HelpID = SID_ATTR_PARA_ADJUST_BLOCK ; \
+ RadioCheck = TRUE ; \
+ };\
+
+#define MN_TEXT_LINESPACE \
+ ToolBoxItem\
+ {\
+ Type = TOOLBOXITEM_SEPARATOR ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_PARA_LINESPACE_10;\
+ HelpID = SID_ATTR_PARA_LINESPACE_10;\
+ RadioCheck = TRUE;\
+ Hide = TRUE;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_PARA_LINESPACE_15;\
+ HelpID = SID_ATTR_PARA_LINESPACE_15;\
+ RadioCheck = TRUE;\
+ Hide = TRUE;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_PARA_LINESPACE_20;\
+ HelpID = SID_ATTR_PARA_LINESPACE_20;\
+ RadioCheck = TRUE;\
+ Hide = TRUE;\
+ };\
+
+#define MN_TEXT_LTR_RTL \
+ ToolBoxItem\
+ {\
+ Type = TOOLBOXITEM_SEPARATOR ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_PARA_LEFT_TO_RIGHT;\
+ HelpID = SID_ATTR_PARA_LEFT_TO_RIGHT;\
+ RadioCheck = TRUE;\
+ Hide = TRUE;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_PARA_RIGHT_TO_LEFT;\
+ HelpID = SID_ATTR_PARA_RIGHT_TO_LEFT;\
+ RadioCheck = TRUE;\
+ Hide = TRUE;\
+ };\
+
+#define MN_TEXT_RTL_LTR \
+ ToolBoxItem\
+ {\
+ Type = TOOLBOXITEM_SEPARATOR ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_PARA_RIGHT_TO_LEFT;\
+ HelpID = SID_ATTR_PARA_RIGHT_TO_LEFT;\
+ RadioCheck = TRUE;\
+ Hide = TRUE;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_PARA_LEFT_TO_RIGHT;\
+ HelpID = SID_ATTR_PARA_LEFT_TO_RIGHT;\
+ RadioCheck = TRUE;\
+ Hide = TRUE;\
+ };\
+
+#define MN_TEXT2\
+ ToolBoxItem\
+ {\
+ Type = TOOLBOXITEM_SEPARATOR ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_NUM_NUMBERING_ON ; \
+ HelpID = FN_NUM_NUMBERING_ON ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_NUM_BULLET_ON ; \
+ HelpID = FN_NUM_BULLET_ON ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_DEC_INDENT ; \
+ HelpId = SID_DEC_INDENT ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_INC_INDENT ; \
+ HelpId = SID_INC_INDENT ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_GROW_FONT_SIZE;\
+ HelpID = FN_GROW_FONT_SIZE;\
+ Hide = TRUE;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_SHRINK_FONT_SIZE;\
+ HelpID = FN_SHRINK_FONT_SIZE;\
+ Hide = TRUE;\
+ };\
+
+#define MN_BACKGROUND_COLOR\
+ ToolBoxItem\
+ {\
+ ITEM_TOOLBAR_BACKGROUND_COLOR\
+ };
+
+#define MN_TEXT_BACKGROUND \
+ ToolBoxItem\
+ {\
+ Type = TOOLBOXITEM_SEPARATOR ; \
+ };\
+ ToolBoxItem\
+ {\
+ ITEM_TOOLBAR_ATTR_CHAR_COLOR\
+ Identifier = SID_ATTR_CHAR_COLOR2 ; \
+ Command = ".uno:FontColor"; \
+ DropDown = TRUE ;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_ATTR_CHAR_COLOR_BACKGROUND ; \
+ HelpID = SID_ATTR_CHAR_COLOR_BACKGROUND ; \
+ DropDown = TRUE ;\
+ };\
+ ToolBoxItem\
+ {\
+ ITEM_TOOLBAR_BACKGROUND_COLOR\
+ Text [ en-US ] = "Paragraph Background" ; \
+ Text [ x-comment ] = " ";\
+ };
+
+#define MN_TEXT_DIALOGS(HIDE)\
+ ToolBoxItem\
+ {\
+ Type = TOOLBOXITEM_SEPARATOR ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_SELECTALL;\
+ HelpId = SID_SELECTALL;\
+ Hide = HIDE;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_CHAR_DLG;\
+ HelpId = SID_CHAR_DLG;\
+ Hide = HIDE;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_PARA_DLG;\
+ HelpId = SID_PARA_DLG;\
+ Hide = HIDE;\
+ };
+
+
+#define MN_TEMPLATE\
+ ToolBoxItem\
+ {\
+ ITEM_TOOLBAR_TEMPLATE_APPLY\
+ };\
+ ToolBoxItem { Type = TOOLBOXITEM_SEPARATOR ; };
+
+#define MN_FRAME_WRAP\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_NOWRAP ; \
+ HelpID = FN_FRAME_NOWRAP ; \
+ RadioCheck = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_WRAP ; \
+ HelpID = FN_FRAME_WRAP ; \
+ RadioCheck = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_WRAP_IDEAL ; \
+ HelpID = FN_FRAME_WRAP_IDEAL ; \
+ RadioCheck = TRUE ; \
+ Hide = TRUE;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_WRAP_LEFT ; \
+ HelpID = FN_FRAME_WRAP_LEFT ; \
+ RadioCheck = TRUE ; \
+ Hide = TRUE;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_WRAP_RIGHT ; \
+ HelpID = FN_FRAME_WRAP_RIGHT ; \
+ RadioCheck = TRUE ; \
+ Hide = TRUE;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_WRAPTHRU ; \
+ HelpID = FN_FRAME_WRAPTHRU ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define MN_FRAME_WRAP_WEB\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_NOWRAP ; \
+ HelpID = FN_FRAME_NOWRAP ; \
+ RadioCheck = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_WRAP_LEFT ; \
+ HelpID = FN_FRAME_WRAP_LEFT ; \
+ RadioCheck = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_WRAP_RIGHT ; \
+ HelpID = FN_FRAME_WRAP_RIGHT ; \
+ RadioCheck = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Type = TOOLBOXITEM_SEPARATOR ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_IMAP ; \
+ HelpID = SID_IMAP ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define MN_CONTOUR\
+ ToolBoxItem\
+ {\
+ Type = TOOLBOXITEM_SEPARATOR ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_WRAP_CONTOUR ; \
+ HelpID = FN_FRAME_WRAP_CONTOUR ; \
+ Hide = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_CONTOUR_DLG ; \
+ HelpID = SID_CONTOUR_DLG ; \
+ Hide = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_IMAP ; \
+ HelpID = SID_IMAP ; \
+ Hide = TRUE ; \
+ };
+
+
+#define MN_FRAME1\
+ ToolBoxItem\
+ {\
+ Type = TOOLBOXITEM_SEPARATOR ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_HORZ_LEFT ; \
+ HelpID = FN_FRAME_ALIGN_HORZ_LEFT ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define MN_FRAME2\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_HORZ_CENTER ; \
+ HelpID = FN_FRAME_ALIGN_HORZ_CENTER ; \
+ RadioCheck = TRUE ; \
+ };
+
+#define MN_FRAME3\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_HORZ_RIGHT ; \
+ HelpID = FN_FRAME_ALIGN_HORZ_RIGHT ; \
+ RadioCheck = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Type = TOOLBOXITEM_SEPARATOR ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_VERT_TOP ; \
+ HelpID = FN_FRAME_ALIGN_VERT_TOP ; \
+ RadioCheck = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_VERT_CENTER ; \
+ HelpID = FN_FRAME_ALIGN_VERT_CENTER ; \
+ RadioCheck = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FRAME_ALIGN_VERT_BOTTOM ; \
+ HelpID = FN_FRAME_ALIGN_VERT_BOTTOM ; \
+ RadioCheck = TRUE ; \
+ };\
+ ToolBoxItem\
+ {\
+ Type = TOOLBOXITEM_SEPARATOR ; \
+ };
+
+#define MN_LAYER\
+ ToolBoxItem\
+ {\
+ Identifier = SID_FRAME_TO_TOP ; \
+ HelpID = SID_FRAME_TO_TOP ; \
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_FRAME_TO_BOTTOM ; \
+ HelpID = SID_FRAME_TO_BOTTOM ; \
+ };
+
+#define MN_LINESTYLE\
+ ToolBoxItem\
+ {\
+ ITEM_TOOLBAR_ATTR_BORDER\
+ };\
+ ToolBoxItem\
+ {\
+ ITEM_TOOLBAR_FRAME_LINESTYLE\
+ };\
+ ToolBoxItem\
+ {\
+ ITEM_TOOLBAR_FRAME_LINECOLOR\
+ };
+
+#define MN_ATTRIBUTES_FRAME\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FORMAT_FRAME_DLG ; \
+ HelpID = FN_FORMAT_FRAME_DLG ; \
+ };
+
+#define MN_ATTRIBUTES_GRAFIK\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FORMAT_FRAME_DLG;\
+ HelpID = FN_FORMAT_GRAFIC_DLG;\
+ Text [ en-US ] = "Graphics Properties";\
+ Text [ x-comment ] = " ";\
+ };
+
+
+#define MN_ATTRIBUTES_OLE\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FORMAT_FRAME_DLG;\
+ HelpID = FN_FORMAT_FRAME_DLG;\
+ Text [ en-US ] = "Object Properties";\
+ Text [ x-comment ] = " ";\
+ };
+
+#define MN_GRID(hide)\
+ ToolBoxItem\
+ {\
+ Type = TOOLBOXITEM_SEPARATOR;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_GRID_VISIBLE;\
+ HelpID = SID_GRID_VISIBLE;\
+ hide;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_GRID_USE;\
+ HelpID = SID_GRID_USE;\
+ hide;\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = SID_HELPLINES_MOVE;\
+ HelpID = SID_HELPLINES_MOVE;\
+ hide;\
+ };
+
+
+
+#endif // _TOOLBOX_HRC
+
diff --git a/sw/source/ui/inc/toxmgr.hxx b/sw/source/ui/inc/toxmgr.hxx
new file mode 100644
index 000000000000..38cc1e5398b3
--- /dev/null
+++ b/sw/source/ui/inc/toxmgr.hxx
@@ -0,0 +1,324 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TOXMGR_HXX
+#define _TOXMGR_HXX
+
+#include "swdllapi.h"
+#include "tox.hxx"
+#include <authfld.hxx>
+
+class SwWrtShell;
+class SwForm;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Manager fuer Verzeichnisfunktionalitaet
+ --------------------------------------------------------------------*/
+//one single method will be sufficient to insert AND upate indexes
+
+class SW_DLLPUBLIC SwTOXDescription
+{
+ TOXTypes eTOXType;
+ String aStyleNames[MAXLEVEL];
+ String sSequenceName;
+ String sMainEntryCharStyle;
+ String sAutoMarkURL;
+ String* pTitle;
+ String* pTOUName;
+ SwForm* pForm;
+ USHORT nContent;
+ USHORT nIndexOptions;
+ USHORT nOLEOptions;
+ LanguageType eLanguage;
+ String sSortAlgorithm;
+
+ String sAuthBrackets;
+ SwCaptionDisplay eCaptionDisplay;
+ SwTOXSortKey eSortKey1;
+ SwTOXSortKey eSortKey2;
+ SwTOXSortKey eSortKey3;
+ BYTE nLevel;
+ BOOL bFromObjectNames : 1;
+ BOOL bFromChapter : 1;
+ BOOL bReadonly: 1;
+ BOOL bLevelFromChapter : 1;
+ BOOL bIsAuthSequence :1;
+ BOOL bSortByDocument :1;
+
+ //TODO: TemplateNames
+ //const String* pTemplateName = 0, ???
+
+ // forbidden and not implemented.
+ SwTOXDescription();
+ SwTOXDescription(SwTOXDescription&);
+ SwTOXDescription & operator= (SwTOXDescription&);
+
+public:
+ // single argument ctors shall be explicit.
+ explicit SwTOXDescription(TOXTypes eType) :
+ eTOXType(eType),
+ pTitle(0),
+ pTOUName(0),
+ pForm(0),
+ nContent(nsSwTOXElement::TOX_MARK | nsSwTOXElement::TOX_OUTLINELEVEL),
+ nIndexOptions(nsSwTOIOptions::TOI_SAME_ENTRY|nsSwTOIOptions::TOI_FF|nsSwTOIOptions::TOI_CASE_SENSITIVE),
+ nOLEOptions(0),
+ eLanguage((LanguageType)::GetAppLanguage()),
+ eCaptionDisplay(CAPTION_COMPLETE),
+ nLevel(MAXLEVEL),
+ bFromObjectNames(FALSE),
+ bFromChapter(FALSE),
+ bReadonly(TRUE),
+ bLevelFromChapter(FALSE),
+ bIsAuthSequence(FALSE),
+ bSortByDocument(TRUE)
+ {}
+ ~SwTOXDescription()
+ {
+ delete pTitle;
+ delete pForm;
+ delete pTOUName;
+ }
+
+ void SetTOXType(TOXTypes eSet) { eTOXType = eSet;}
+ TOXTypes GetTOXType() const { return eTOXType;}
+
+ const String& GetStyleNames(USHORT nLvl) const
+ {return aStyleNames[nLvl];}
+ void SetStyleNames(const String& rSet, USHORT nLvl)
+ {aStyleNames[nLvl] = rSet; }
+
+ const String& GetAutoMarkURL() const { return sAutoMarkURL;}
+ void SetAutoMarkURL(const String& rSet) {sAutoMarkURL = rSet;}
+
+ void SetTitle(const String& pSet) {delete pTitle; pTitle = new String(pSet);}
+ const String* GetTitle() const {return pTitle; }
+
+ void SetTOUName(const String& pSet) {delete pTOUName; pTOUName = new String(pSet);}
+ const String* GetTOUName() const {return pTOUName; }
+
+ void SetForm(const SwForm& rSet) {delete pForm; pForm = new SwForm(rSet);}
+ const SwForm* GetForm() const {return pForm;}
+
+ void SetContentOptions(USHORT nSet) { nContent = nSet;}
+ USHORT GetContentOptions() const { return nContent;}
+
+ void SetIndexOptions(USHORT nSet) { nIndexOptions = nSet;}
+ USHORT GetIndexOptions() const { return nIndexOptions;}
+
+ const String& GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
+ void SetMainEntryCharStyle(const String& rSet) {sMainEntryCharStyle = rSet;}
+
+ void SetLevel(BYTE nSet) {nLevel = nSet;}
+ BYTE GetLevel()const {return nLevel; }
+
+ void SetCreateFromObjectNames(BOOL bSet) { bFromObjectNames = bSet;}
+ BOOL IsCreateFromObjectNames() const {return bFromObjectNames;}
+
+ const String& GetSequenceName() const {return sSequenceName;}
+ void SetSequenceName(const String& rSet) {sSequenceName = rSet;}
+
+ SwCaptionDisplay GetCaptionDisplay() const { return eCaptionDisplay;}
+ void SetCaptionDisplay(SwCaptionDisplay eSet) {eCaptionDisplay = eSet;}
+
+ void SetFromChapter(BOOL bSet) { bFromChapter = bSet;}
+ BOOL IsFromChapter() const {return bFromChapter;}
+
+ void SetReadonly(BOOL bSet){bReadonly = bSet;}
+ BOOL IsReadonly() const {return bReadonly;}
+
+ USHORT GetOLEOptions() const {return nOLEOptions;}
+ void SetOLEOptions(USHORT nOpt) {nOLEOptions = nOpt;}
+
+ BOOL IsLevelFromChapter() const {return bLevelFromChapter;}
+ void SetLevelFromChapter(BOOL bSet) {bLevelFromChapter = bSet;}
+
+ String GetAuthBrackets() const {return sAuthBrackets;}
+ void SetAuthBrackets(const String& rSet) {sAuthBrackets = rSet;}
+
+ BOOL IsAuthSequence() const {return bIsAuthSequence;}
+ void SetAuthSequence(BOOL bSet){bIsAuthSequence = bSet;}
+
+ BOOL IsSortByDocument()const {return bSortByDocument ;}
+ void SetSortByDocument(BOOL bSet) {bSortByDocument = bSet;}
+
+ void SetSortKeys(SwTOXSortKey eKey1,
+ SwTOXSortKey eKey2,
+ SwTOXSortKey eKey3);
+
+ SwTOXSortKey GetSortKey1() const {return eSortKey1;}
+ SwTOXSortKey GetSortKey2() const {return eSortKey2;}
+ SwTOXSortKey GetSortKey3() const {return eSortKey3;}
+
+ LanguageType GetLanguage() const {return eLanguage;}
+ void SetLanguage(LanguageType nLang) {eLanguage = nLang;}
+
+ const String& GetSortAlgorithm()const {return sSortAlgorithm;}
+ void SetSortAlgorithm(const String& rSet) {sSortAlgorithm = rSet;}
+
+ void ApplyTo(SwTOXBase& rTOXBase);
+
+};
+// --------------------------------------------------------------------------------
+class SwTOXMarkDescription
+{
+ TOXTypes eTOXType;
+ int nLevel;
+ BOOL bMainEntry;
+
+ String* pPrimKey;
+ String* pSecKey;
+ String* pAltStr;
+ String* pTOUName;
+
+ String* pPhoneticReadingOfAltStr;
+ String* pPhoneticReadingOfPrimKey;
+ String* pPhoneticReadingOfSecKey;
+
+ // forbidden and not implemented.
+ SwTOXMarkDescription();
+ SwTOXMarkDescription(SwTOXMarkDescription&);
+ SwTOXMarkDescription & operator= (SwTOXMarkDescription&);
+
+public:
+ // single argument ctors shall be explicit.
+ explicit SwTOXMarkDescription(TOXTypes eType) :
+ eTOXType(eType),
+ nLevel(0),
+ bMainEntry(FALSE),
+ pPrimKey(0),
+ pSecKey(0),
+ pAltStr(0),
+ pTOUName(0),
+ pPhoneticReadingOfAltStr(0),
+ pPhoneticReadingOfPrimKey(0),
+ pPhoneticReadingOfSecKey(0)
+ {
+ }
+ ~SwTOXMarkDescription()
+ {
+ delete pPrimKey;
+ delete pSecKey;
+ delete pAltStr;
+ delete pTOUName;
+ delete pPhoneticReadingOfAltStr;
+ delete pPhoneticReadingOfPrimKey;
+ delete pPhoneticReadingOfSecKey;
+ }
+
+ TOXTypes GetTOXType()const {return eTOXType;}
+
+ void SetLevel(int nSet) {nLevel = nSet;}
+ int GetLevel() const {return nLevel;}
+
+ void SetMainEntry(BOOL bSet) {bMainEntry = bSet;}
+ BOOL IsMainEntry() const {return bMainEntry;}
+
+ void SetPrimKey(const String& rSet)
+ {delete pPrimKey; pPrimKey = new String(rSet);}
+ const String* GetPrimKey() const {return pPrimKey;}
+
+ void SetSecKey(const String& rSet)
+ {delete pSecKey; pSecKey = new String(rSet);}
+ const String* GetSecKey() const { return pSecKey; }
+
+ void SetAltStr(const String& rSet)
+ {delete pAltStr; pAltStr = new String(rSet);}
+ const String* GetAltStr() const { return pAltStr; }
+
+ void SetTOUName(const String& rSet)
+ {delete pTOUName; pTOUName = new String(rSet);}
+ const String* GetTOUName() const {return pTOUName;}
+
+
+ void SetPhoneticReadingOfAltStr(const String& rSet)
+ {delete pPhoneticReadingOfAltStr; pPhoneticReadingOfAltStr = new String(rSet);}
+ const String* GetPhoneticReadingOfAltStr() const { return pPhoneticReadingOfAltStr; }
+
+ void SetPhoneticReadingOfPrimKey(const String& rSet)
+ {delete pPhoneticReadingOfPrimKey; pPhoneticReadingOfPrimKey = new String(rSet);}
+ const String* GetPhoneticReadingOfPrimKey() const { return pPhoneticReadingOfPrimKey; }
+
+ void SetPhoneticReadingOfSecKey(const String& rSet)
+ {delete pPhoneticReadingOfSecKey; pPhoneticReadingOfSecKey = new String(rSet);}
+ const String* GetPhoneticReadingOfSecKey() const { return pPhoneticReadingOfSecKey; }
+};
+
+class SW_DLLPUBLIC SwTOXMgr
+{
+ SwWrtShell* pSh;
+ SwTOXMark* pCurTOXMark;
+ SwTOXMarks aCurMarks;
+
+ SW_DLLPRIVATE USHORT GetUserTypeID(const String& rStr);
+
+public:
+ // single argument ctors shall be explicit.
+ explicit SwTOXMgr(SwWrtShell* pShell);
+
+ //
+ // Methoden fuer Verzeichnismarkierungen
+ //
+ void InsertTOXMark(const SwTOXMarkDescription& rDesc);
+
+ void UpdateTOXMark(const SwTOXMarkDescription& rDesc);
+
+
+ void DeleteTOXMark();
+ void NextTOXMark(BOOL bSame=FALSE);
+ void PrevTOXMark(BOOL bSame=FALSE);
+
+ // Aktuelle TOXmarks holen
+ USHORT GetTOXMarks();
+ USHORT GetTOXMarkCount();
+ SwTOXMark* GetTOXMark(USHORT nId);
+ SwTOXMark* GetCurTOXMark();
+ void SetCurTOXMark(USHORT nId);
+
+ //
+ // Methoden fuer Verzeichnisse
+ //
+ BOOL UpdateOrInsertTOX(const SwTOXDescription& rDesc, SwTOXBase** ppBase = 0, const SfxItemSet* pSet = 0);
+
+ const SwTOXType* GetTOXType(TOXTypes eTyp, USHORT nId) const;
+ const SwTOXBase* GetCurTOX();
+
+};
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Inlines
+ --------------------------------------------------------------------*/
+
+inline USHORT SwTOXMgr::GetTOXMarkCount()
+ { return aCurMarks.Count(); }
+
+
+inline SwTOXMark* SwTOXMgr::GetCurTOXMark()
+ { return pCurTOXMark; }
+
+#endif
diff --git a/sw/source/ui/inc/uiborder.hxx b/sw/source/ui/inc/uiborder.hxx
new file mode 100644
index 000000000000..a7688ac343ac
--- /dev/null
+++ b/sw/source/ui/inc/uiborder.hxx
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UIBORDER_HXX
+#define _UIBORDER_HXX
+
+
+#include <sfx2/basedlgs.hxx>
+class Window;
+class SfxItemSet;
+
+class SwBorderDlg : public SfxSingleTabDialog
+{
+public:
+
+ // nType may be:
+ // SW_BORDER_MODE_PARA
+ // SW_BORDER_MODE_TABLE
+ // SW_BORDER_MODE_FRAME
+
+ SwBorderDlg(Window* pParent, SfxItemSet& rSet, USHORT nType);
+ ~SwBorderDlg();
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/uiitems.hxx b/sw/source/ui/inc/uiitems.hxx
new file mode 100644
index 000000000000..d559a9ea3fb9
--- /dev/null
+++ b/sw/source/ui/inc/uiitems.hxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UIITEMS_HXX
+#define _UIITEMS_HXX
+
+#include <svl/intitem.hxx>
+#include "swdllapi.h"
+#include "cmdid.h"
+#include "pagedesc.hxx"
+
+class SwNumRule;
+class IntlWrapper;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Container fuer FootNote
+ --------------------------------------------------------------------*/
+class SW_DLLPUBLIC SwPageFtnInfoItem : public SfxPoolItem
+{
+ SwPageFtnInfo aFtnInfo;
+
+public:
+
+ SwPageFtnInfoItem(const USHORT nId, SwPageFtnInfo& rInfo);
+ SwPageFtnInfoItem(const SwPageFtnInfoItem& rItem );
+ ~SwPageFtnInfoItem();
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const;
+ virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 );
+
+ SwPageFtnInfo& GetPageFtnInfo() { return aFtnInfo; }
+ const SwPageFtnInfo& GetPageFtnInfo() const { return aFtnInfo; }
+ void SetPageFtnInfo(SwPageFtnInfo& rInf) { aFtnInfo = rInf; }
+};
+
+/*******************************************************************/
+
+class SW_DLLPUBLIC SwPtrItem : public SfxPoolItem
+{
+ void* pMisc;
+
+public:
+ SwPtrItem( const USHORT nId = FN_PARAM_GRF_DIALOG, void* pPtr = 0);
+ SwPtrItem( const SwPtrItem& rItem );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ void SetValue(void * pPtr) { pMisc= pPtr; }
+ void* GetValue() const { return pMisc; }
+};
+
+/*******************************************************************/
+
+class SW_DLLPUBLIC SwUINumRuleItem : public SfxPoolItem
+{
+ SwNumRule* pRule;
+
+public:
+ SwUINumRuleItem( const SwNumRule& rRule, const USHORT = FN_PARAM_ACT_NUMBER);
+ SwUINumRuleItem( const SwUINumRuleItem& rItem );
+ virtual ~SwUINumRuleItem();
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const;
+ virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 );
+
+ const SwNumRule* GetNumRule() const { return pRule; }
+ SwNumRule* GetNumRule() { return pRule; }
+};
+
+/* -----------------17.06.98 17:40-------------------
+ *
+ * --------------------------------------------------*/
+class SwBackgroundDestinationItem : public SfxUInt16Item
+{
+public:
+ SwBackgroundDestinationItem(USHORT nWhich, USHORT nValue);
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+};
+
+#endif // _UIITEMS_HXX
diff --git a/sw/source/ui/inc/uinums.hxx b/sw/source/ui/inc/uinums.hxx
new file mode 100644
index 000000000000..5ba9d6f4dfc1
--- /dev/null
+++ b/sw/source/ui/inc/uinums.hxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UINUMS_HXX
+#define _UINUMS_HXX
+
+#include <svl/svarray.hxx>
+#include <numrule.hxx>
+#include "swdllapi.h"
+
+class SfxPoolItem;
+class SwWrtShell;
+class SvStream;
+
+#define MAX_NUM_RULES 9
+
+typedef SfxPoolItem* SfxPoolItemPtr;
+SV_DECL_PTRARR_DEL( _SwNumFmtsAttrs, SfxPoolItemPtr, 5,0 )
+
+//------------------------------------------------------------------------
+class SW_DLLPUBLIC SwNumRulesWithName
+{
+ String aName;
+ // die Formate der NumRule muessen! unabhaengig von einem Document sein
+ // (Sie sollen immer vorhanden sein!)
+ class SW_DLLPRIVATE _SwNumFmtGlobal
+ {
+ SwNumFmt aFmt;
+ String sCharFmtName;
+ USHORT nCharPoolId;
+ _SwNumFmtsAttrs aItems;
+
+ _SwNumFmtGlobal& operator=( const _SwNumFmtGlobal& );
+
+ public:
+ _SwNumFmtGlobal( const SwNumFmt& rFmt );
+ _SwNumFmtGlobal( const _SwNumFmtGlobal& );
+ _SwNumFmtGlobal( SvStream&, USHORT nVersion );
+ ~_SwNumFmtGlobal();
+
+ void Store( SvStream& );
+ void ChgNumFmt( SwWrtShell& rSh, SwNumFmt& rChg ) const;
+ };
+
+ _SwNumFmtGlobal* aFmts[ MAXLEVEL ];
+
+protected:
+ void SetName(const String& rSet) {aName = rSet;}
+
+public:
+ SwNumRulesWithName(const SwNumRule &, const String &);
+ SwNumRulesWithName( const SwNumRulesWithName & );
+ SwNumRulesWithName(SvStream &, USHORT nVersion);
+ ~SwNumRulesWithName();
+
+ const SwNumRulesWithName &operator=(const SwNumRulesWithName &);
+
+ const String& GetName() const { return aName; }
+ void MakeNumRule( SwWrtShell& rSh, SwNumRule& rChg ) const;
+
+ void Store( SvStream& );
+};
+/********************************************************************
+
+********************************************************************/
+class SwBaseNumRules
+{
+public:
+ enum { nMaxRules = MAX_NUM_RULES }; // zur Zeit 9 definierte Forms
+protected:
+ SwNumRulesWithName *pNumRules[ MAX_NUM_RULES ];
+ String sFileName;
+ USHORT nVersion;
+ BOOL bModified;
+
+ virtual int Load(SvStream&);
+ virtual BOOL Store(SvStream&);
+
+ void Init();
+
+public:
+ SwBaseNumRules(const String& rFileName);
+ virtual ~SwBaseNumRules();
+
+ inline const SwNumRulesWithName* GetRules(USHORT nIdx) const;
+ virtual void ApplyNumRules(
+ const SwNumRulesWithName &rCopy,
+ USHORT nIdx);
+
+};
+
+/********************************************************************
+
+********************************************************************/
+class SwChapterNumRules : public SwBaseNumRules
+{
+
+public:
+ SwChapterNumRules();
+ virtual ~SwChapterNumRules();
+
+ virtual void ApplyNumRules( const SwNumRulesWithName &rCopy,
+ USHORT nIdx);
+};
+
+// INLINE METHODE --------------------------------------------------------
+inline const SwNumRulesWithName *SwBaseNumRules::GetRules(USHORT nIdx) const
+{
+ ASSERT(nIdx < nMaxRules, Array der NumRules ueberindiziert.);
+ return pNumRules[nIdx];
+}
+
+#endif
diff --git a/sw/source/ui/inc/uitool.hxx b/sw/source/ui/inc/uitool.hxx
new file mode 100644
index 000000000000..c3dfd0f07b2a
--- /dev/null
+++ b/sw/source/ui/inc/uitool.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UITOOL_HXX
+#define _UITOOL_HXX
+
+#include <tools/wintypes.hxx>
+#include <vcl/field.hxx>
+#include <swtypes.hxx>
+#include "swdllapi.h"
+
+class MetricFormatter;
+class SfxItemSet;
+class SfxMedium;
+class SwPageDesc;
+class SvxTabStopItem;
+class SwWrtShell;
+class ListBox;
+class SwDocShell;
+class SwFrmFmt;
+class SwTabCols;
+class DateTime;
+class SfxViewFrame;
+
+// Umschalten einer Metric
+SW_DLLPUBLIC void SetMetric(MetricFormatter& rCtrl, FieldUnit eUnit);
+
+// BoxInfoAttribut fuellen
+SW_DLLPUBLIC void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh);
+
+// SfxItemSets <-> PageDesc
+void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc );
+void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet);
+
+// Auffuellen der Tabs mit DefaultTabs
+SW_DLLPUBLIC void MakeDefTabs(SwTwips nDefDist, SvxTabStopItem& rTabs);
+
+// DefaultTabs loeschen aus dem TabStopArray
+//void EraseDefTabs(SvxTabStopItem& rTabs);
+
+// Abstand zwischen dem 1. und zweitem Element ermitteln
+SW_DLLPUBLIC USHORT GetTabDist(const SvxTabStopItem& rTabs);
+
+// erfrage ob im Set eine Sfx-PageDesc-Kombination vorliegt
+// und setze diesen im Set und loesche die Transport Items
+// (PageBreak & PageModel) aus dem Set
+void SwToSfxPageDescAttr( SfxItemSet& rSet );
+void SfxToSwPageDescAttr( const SwWrtShell& rShell, SfxItemSet& rSet );
+
+SW_DLLPUBLIC FieldUnit GetDfltMetric(BOOL bWeb);
+void SetDfltMetric(FieldUnit eMetric, BOOL bWeb);
+
+// ListBox mit allen Zeichenvorlagen fuellen - ausser Standard!
+SW_DLLPUBLIC void FillCharStyleListBox(ListBox& rToFill, SwDocShell* pDocSh, BOOL bSorted = FALSE, BOOL bWithDefault = FALSE);
+
+//inserts a string sorted into a ListBox,
+SW_DLLPUBLIC USHORT InsertStringSorted(const String& rEntry, ListBox& rToFill, USHORT nOffset);
+
+// Tabellenbreite und Ausrichtung ermitteln
+SwTwips GetTableWidth( SwFrmFmt* pFmt, SwTabCols& rCols, USHORT *pPercent,
+ SwWrtShell* pSh );
+
+String GetAppLangDateTimeString( const DateTime& );
+
+// search for a command string withing the menu structure and execute it
+// at the dispatcher if there is one, if executed return true
+bool ExecuteMenuCommand( PopupMenu& rMenu, SfxViewFrame& rViewFrame, USHORT nId );
+
+#endif // _UITOOL_HXX
diff --git a/sw/source/ui/inc/uivwimp.hxx b/sw/source/ui/inc/uivwimp.hxx
new file mode 100644
index 000000000000..509610500a3f
--- /dev/null
+++ b/sw/source/ui/inc/uivwimp.hxx
@@ -0,0 +1,188 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UIVWIMP_HXX
+#define _UIVWIMP_HXX
+
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <view.hxx>
+
+#include <sfx2/objsh.hxx>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#include <swunodef.hxx>
+#include <cppuhelper/weakref.hxx>
+
+class SwXTextView;
+class SfxRequest;
+class SwTransferable;
+class SfxRequest;
+
+namespace sfx2 { class DocumentInserter; }
+namespace com{ namespace sun{ namespace star {
+ namespace frame {
+ class XDispatchProviderInterceptor;
+ }
+ namespace lang {
+ class XUnoTunnel;
+ }
+}}}
+
+/* -----------------------------29.05.00 08:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwScannerEventListener : public ::cppu::WeakImplHelper1<
+ STAR_NMSPC::lang::XEventListener >
+{
+ SwView* pView;
+
+public:
+
+ SwScannerEventListener( SwView& rView ) : pView( &rView ) {}
+ virtual ~SwScannerEventListener();
+
+ // XEventListener
+ virtual void SAL_CALL disposing(
+ const ::com::sun::star::lang::EventObject& rEventObject ) throw(::com::sun::star::uno::RuntimeException);
+
+ void ViewDestroyed() { pView = 0; }
+};
+
+// --------------------------- Clipboard EventListener ------------------
+
+class SwClipboardChangeListener : public ::cppu::WeakImplHelper1<
+ CLIP_NMSPC::XClipboardListener >
+{
+ SwView* pView;
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const STAR_NMSPC::lang::EventObject& rEventObject )
+ throw ( com::sun::star::uno::RuntimeException );
+
+ // XClipboardListener
+ virtual void SAL_CALL changedContents( const CLIP_NMSPC::ClipboardEvent& rEventObject )
+ throw ( com::sun::star::uno::RuntimeException );
+
+public:
+ SwClipboardChangeListener( SwView& rView ) : pView( &rView ) {}
+ virtual ~SwClipboardChangeListener();
+
+ void ViewDestroyed() { pView = 0; }
+
+ void AddRemoveListener( BOOL bAdd );
+};
+
+
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwMailMergeConfigItem;
+class SwView_Impl
+{
+ STAR_REFERENCE( lang::XEventListener ) xScanEvtLstnr;
+ STAR_REFERENCE( lang::XEventListener ) xClipEvtLstnr;
+ STAR_REFERENCE( frame::XDispatchProviderInterceptor ) xDisProvInterceptor;
+ STAR_REFERENCE( view::XSelectionSupplier ) *pxXTextView; // UNO object
+ com::sun::star::uno::WeakReference< com::sun::star::lang::XUnoTunnel > xTransferable;
+
+ // temporary document for printing text of selection / multi selection
+ // in PDF export.
+ SfxObjectShellLock xTmpSelDocSh;
+
+ SwView* pView;
+ SwScannerEventListener* pScanEvtLstnr;
+ SwClipboardChangeListener* pClipEvtLstnr;
+ ShellModes eShellMode;
+
+ SwMailMergeConfigItem* pConfigItem;
+ sal_uInt16 nMailMergeRestartPage;
+ sal_Bool bMailMergeSourceView;
+
+ sfx2::DocumentInserter* m_pDocInserter;
+ SfxRequest* m_pRequest;
+ sal_Int16 m_nParam;
+
+ Point m_aEditingPosition;
+ bool m_bSelectObject;
+ bool m_bEditingPositionSet;
+
+public:
+ SwView_Impl(SwView* pShell);
+ ~SwView_Impl();
+
+ void SetShellMode(ShellModes eSet);
+
+ ::com::sun::star::view::XSelectionSupplier* GetUNOObject();
+ SwXTextView* GetUNOObject_Impl();
+ void Invalidate();
+
+ ShellModes GetShellMode() {return eShellMode;}
+
+ void ExecuteScan(SfxRequest& rReq);
+ SwScannerEventListener& GetScannerEventListener();
+
+ void AddClipboardListener();
+
+ SfxObjectShellLock& GetTmpSelectionDoc() { return xTmpSelDocSh; }
+
+ void AddTransferable(SwTransferable& rTransferable);
+
+ void SetMailMergeConfigItem(SwMailMergeConfigItem* pItem,
+ sal_uInt16 nRestart, sal_Bool bIsSource)
+ { pConfigItem = pItem;
+ nMailMergeRestartPage = nRestart;
+ bMailMergeSourceView = bIsSource;
+ }
+ SwMailMergeConfigItem* GetMailMergeConfigItem() {return pConfigItem;}
+ sal_uInt16 GetMailMergeRestartPage() const {return nMailMergeRestartPage;}
+ sal_Bool IsMailMergeSourceView() const { return bMailMergeSourceView; }
+
+ //#i33307# restore editing position
+ void SetRestorePosition(const Point& rCrsrPos, bool bSelectObj)
+ {
+ m_aEditingPosition = rCrsrPos;
+ m_bSelectObject = bSelectObj;
+ m_bEditingPositionSet = true;
+ }
+ bool GetRestorePosition(Point& rCrsrPos, bool& rbSelectObj)
+ {
+ rCrsrPos = m_aEditingPosition;
+ rbSelectObj = m_bSelectObject;
+ return m_bEditingPositionSet;
+ }
+
+
+ void StartDocumentInserter( const String& rFactory, const Link& rEndDialogHdl );
+ SfxMedium* CreateMedium();
+ void InitRequest( const SfxRequest& rRequest );
+
+ inline SfxRequest* GetRequest() const { return m_pRequest; }
+ inline sal_Int16 GetParam() const { return m_nParam; }
+ inline void SetParam( sal_Int16 nParam ) { m_nParam = nParam; }
+};
+#endif
+
diff --git a/sw/source/ui/inc/unodispatch.hxx b/sw/source/ui/inc/unodispatch.hxx
new file mode 100644
index 000000000000..884d647725e5
--- /dev/null
+++ b/sw/source/ui/inc/unodispatch.hxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNODISPATCH_HXX
+#define _UNODISPATCH_HXX
+
+#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
+#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <list>
+//#ifndef _OSL_MUTEX_HXX_
+//#include <osl/mutex.hxx>
+//#endif
+#include <vos/mutex.hxx>
+
+class SwView;
+//---------------------------------------------------------------------------------------------------------------------
+class SwXDispatchProviderInterceptor : public cppu::WeakImplHelper3
+<
+ ::com::sun::star::frame::XDispatchProviderInterceptor,
+ ::com::sun::star::lang::XEventListener,
+ ::com::sun::star::lang::XUnoTunnel
+>
+{
+ class DispatchMutexLock_Impl
+ {
+ //::osl::MutexGuard aGuard; #102295# solar mutex has to be used currently
+ vos::OGuard aGuard;
+ DispatchMutexLock_Impl();
+ public:
+ DispatchMutexLock_Impl(SwXDispatchProviderInterceptor&);
+ ~DispatchMutexLock_Impl();
+ };
+ friend class DispatchMutexLock_Impl;
+
+// ::osl::Mutex m_aMutex;#102295# solar mutex has to be used currently
+
+ // the component which's dispatches we're intercepting
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception> m_xIntercepted;
+
+ // chaining
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xSlaveDispatcher;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider> m_xMasterDispatcher;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch> m_xDispatch;
+
+ SwView* m_pView;
+
+public:
+ SwXDispatchProviderInterceptor(SwView& rView);
+ ~SwXDispatchProviderInterceptor();
+
+ //XDispatchProvider
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XDispatchProviderInterceptor
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewDispatchProvider ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSupplier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // view destroyed
+ void Invalidate();
+};
+//---------------------------------------------------------------------------------------------------------------------
+struct StatusStruct_Impl
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener> xListener;
+ ::com::sun::star::util::URL aURL;
+};
+typedef std::list< StatusStruct_Impl > StatusListenerList;
+class SwXDispatch : public cppu::WeakImplHelper2
+<
+ ::com::sun::star::frame::XDispatch,
+ ::com::sun::star::view::XSelectionChangeListener
+>
+{
+ SwView* m_pView;
+ StatusListenerList m_aListenerList;
+ sal_Bool m_bOldEnable;
+ sal_Bool m_bListenerAdded;
+public:
+ SwXDispatch(SwView& rView);
+ ~SwXDispatch();
+
+ virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& xControl, const ::com::sun::star::util::URL& aURL ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XSelectionChangeListener
+ virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ static const sal_Char* GetDBChangeURL();
+};
+
+#endif
diff --git a/sw/source/ui/inc/unotools.hxx b/sw/source/ui/inc/unotools.hxx
new file mode 100644
index 000000000000..6399e2acba9e
--- /dev/null
+++ b/sw/source/ui/inc/unotools.hxx
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNOTOOLS_HXX
+#define _UNOTOOLS_HXX
+
+
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/edit.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#include <actctrl.hxx>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <tools/resary.hxx>
+#include <swunodef.hxx>
+#include "swdllapi.h"
+
+/* -----------------------------15.12.99 09:55--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwOneExampleFrame;
+class SwFrmCtrlWindow : public Window
+{
+ SwOneExampleFrame* pExampleFrame;
+public:
+ SwFrmCtrlWindow(Window* pParent, WinBits nBits, SwOneExampleFrame* pFrame);
+
+ virtual void Command( const CommandEvent& rCEvt );
+};
+/* -----------------------------15.12.99 12:56--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class MenuResource : public Resource
+{
+ ResStringArray aMenuArray;
+
+public:
+ MenuResource(const ResId& rResId);
+
+ ResStringArray& GetMenuArray() {return aMenuArray;}
+};
+/* -----------------27.07.99 15:20-------------------
+
+ --------------------------------------------------*/
+#define EX_SHOW_ONLINE_LAYOUT 0x001
+
+// hard zoom value
+#define EX_SHOW_BUSINESS_CARDS 0x02
+//don't modify page size
+#define EX_SHOW_DEFAULT_PAGE 0x04
+
+class SwView;
+class SW_DLLPUBLIC SwOneExampleFrame
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > _xControl;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > _xModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > _xController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > _xCursor;
+
+ SwFrmCtrlWindow aTopWindow;
+ Window& rWindow;
+ Timer aLoadedTimer;
+ Link aInitializedLink;
+
+ MenuResource aMenuRes;
+ String sArgumentURL;
+
+ SwView* pModuleView;
+
+ sal_uInt32 nStyleFlags;
+
+ sal_Bool bIsInitialized;
+ sal_Bool bServiceAvailable;
+
+ static sal_Bool bShowServiceNotAvailableMessage;
+
+ SW_DLLPRIVATE DECL_LINK( TimeoutHdl, Timer* );
+ SW_DLLPRIVATE DECL_LINK( PopupHdl, Menu* );
+
+ SW_DLLPRIVATE void CreateControl();
+ SW_DLLPRIVATE void DisposeControl();
+
+public:
+ SwOneExampleFrame(Window& rWin,
+ sal_uInt32 nStyleFlags = EX_SHOW_ONLINE_LAYOUT,
+ const Link* pInitalizedLink = 0,
+ String* pURL = 0);
+ ~SwOneExampleFrame();
+
+ STAR_REFERENCE( awt::XControl ) & GetControl() {return _xControl; }
+ STAR_REFERENCE( frame::XModel ) & GetModel() {return _xModel;}
+ STAR_REFERENCE( frame::XController ) & GetController() {return _xController;}
+ STAR_REFERENCE( text::XTextCursor ) & GetTextCursor() {return _xCursor;}
+
+ void ClearDocument( BOOL bStartTimer = FALSE );
+
+ sal_Bool IsInitialized() const {return bIsInitialized;}
+ sal_Bool IsServiceAvailable() const {return bServiceAvailable;}
+
+ void CreatePopup(const Point& rPt);
+
+ static void CreateErrorMessage(Window* pParent);
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/unotxvw.hxx b/sw/source/ui/inc/unotxvw.hxx
new file mode 100644
index 000000000000..1c8ad77e2054
--- /dev/null
+++ b/sw/source/ui/inc/unotxvw.hxx
@@ -0,0 +1,274 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNOTXVW_HXX
+#define _UNOTXVW_HXX
+#include <sfx2/sfxbasecontroller.hxx>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/text/XTextViewCursor.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/text/XRubySelection.hpp>
+#include <com/sun/star/view/XFormLayerAccess.hpp>
+#include <com/sun/star/view/XScreenCursor.hpp>
+#include <com/sun/star/view/XViewSettingsSupplier.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/view/XLineCursor.hpp>
+#include <com/sun/star/view/XViewCursor.hpp>
+#include <com/sun/star/text/XPageCursor.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/datatransfer/XTransferableSupplier.hpp>
+#include <cppuhelper/implbase8.hxx> // helper for implementations
+#include <svl/itemprop.hxx>
+#include "calbck.hxx"
+#include "TextCursorHelper.hxx"
+#include <comphelper/uno3.hxx>
+
+#include <sfx2/objsh.hxx>
+
+class SdrObject;
+class SwView;
+
+typedef ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener > * XSelectionChangeListenerPtr;
+SV_DECL_PTRARR_DEL( SelectionChangeListenerArr, XSelectionChangeListenerPtr, 4, 4 )
+
+/******************************************************************************
+ *
+ ******************************************************************************/
+class SwXTextView :
+ public ::com::sun::star::view::XSelectionSupplier,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::view::XFormLayerAccess,
+ public ::com::sun::star::text::XTextViewCursorSupplier,
+ public ::com::sun::star::text::XRubySelection,
+ public ::com::sun::star::view::XViewSettingsSupplier,
+ public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::datatransfer::XTransferableSupplier,
+ public SfxBaseController
+{
+ SelectionChangeListenerArr aSelChangedListeners;
+
+ SwView* m_pView;
+ const SfxItemPropertySet* m_pPropSet; // property map for SwXTextView properties
+ // (not related to pxViewSettings!)
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > * pxViewSettings;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextViewCursor > * pxTextViewCursor;
+
+
+ SdrObject* GetControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & Model,
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& xToFill );
+
+protected:
+ virtual ~SwXTextView();
+public:
+ SwXTextView(SwView* pSwView);
+
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw();
+ virtual void SAL_CALL release( ) throw();
+
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XSelectionSupplier
+ virtual ::com::sun::star::uno::Any SAL_CALL getSelection(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL select(const ::com::sun::star::uno::Any& aInterface) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener > & xListener) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener > & xListener) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XFormLayerAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > SAL_CALL getFormController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& Form ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isFormDesignMode( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFormDesignMode( ::sal_Bool DesignMode ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XControlAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL getControl(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & Model) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException );
+
+ //XTextViewCursorSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextViewCursor > SAL_CALL getViewCursor(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XViewSettings
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getViewSettings(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XRubySelection
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > > SAL_CALL getRubyList( sal_Bool bAutomatic )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL setRubyList(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::PropertyValue > >& RubyList, sal_Bool bAutomatic )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XTransferableSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getTransferable( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertTransferable( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans ) throw (::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::uno::RuntimeException);
+
+ void NotifySelChanged();
+ void NotifyDBChanged();
+
+ SwView* GetView() {return m_pView;}
+ void Invalidate();
+
+ // temporary document used for PDF export of selections/multi-selections
+ SfxObjectShellLock BuildTmpSelectionDoc();
+};
+
+/* -----------------17.09.98 12:52-------------------
+ *
+ * --------------------------------------------------*/
+
+typedef cppu::WeakImplHelper8<
+ ::com::sun::star::text::XTextViewCursor,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::text::XPageCursor,
+ ::com::sun::star::view::XScreenCursor,
+ ::com::sun::star::view::XViewCursor,
+ ::com::sun::star::view::XLineCursor,
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::beans::XPropertyState
+ > SwXTextViewCursor_Base;
+
+class SwXTextViewCursor : public SwXTextViewCursor_Base,
+public SwClient,
+public OTextCursorHelper
+{
+ SwView* m_pView;
+ const SfxItemPropertySet* m_pPropSet;
+protected:
+ sal_Bool IsTextSelection( sal_Bool bAllowTables = sal_True ) const;
+ virtual ~SwXTextViewCursor();
+public:
+ SwXTextViewCursor(SwView* pVw);
+
+ DECLARE_XINTERFACE()
+
+ //XTextViewCursor
+ virtual sal_Bool SAL_CALL isVisible(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setVisible(sal_Bool bVisible) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XTextCursor - neu
+ virtual void SAL_CALL collapseToStart( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL collapseToEnd( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual BOOL SAL_CALL isCollapsed( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual BOOL SAL_CALL goLeft( sal_Int16 nCount, BOOL bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual BOOL SAL_CALL goRight( sal_Int16 nCount, BOOL bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoStart( BOOL bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoEnd( BOOL bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, BOOL bExpand ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XPageCursor
+ virtual sal_Bool SAL_CALL jumpToFirstPage(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL jumpToLastPage(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL jumpToPage(sal_Int16 nPage) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL jumpToNextPage(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL jumpToPreviousPage(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL jumpToEndOfPage(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL jumpToStartOfPage(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Int16 SAL_CALL getPage(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL getString(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL setString(const rtl::OUString& aString) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XScreenCursor
+ virtual sal_Bool SAL_CALL screenDown(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL screenUp(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XViewCursor
+ virtual sal_Bool SAL_CALL goDown(sal_Int16 nCount, sal_Bool bExpand) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL goUp(sal_Int16 nCount, sal_Bool bExpand) throw( ::com::sun::star::uno::RuntimeException );
+// virtual sal_Bool goLeft(sal_Int16 nCount, sal_Bool bExpand) throw( ::com::sun::star::uno::RuntimeException );
+// virtual sal_Bool goRight(sal_Int16 nCount, sal_Bool bExpand) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XLineCursor
+ virtual sal_Bool SAL_CALL isAtStartOfLine(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL isAtEndOfLine(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL gotoEndOfLine(sal_Bool bExpand) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL gotoStartOfLine(sal_Bool bExpand) throw( ::com::sun::star::uno::RuntimeException );
+
+ //XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XServiceInfo
+ virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
+ virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
+
+ //XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ void Invalidate(){m_pView = 0;}
+
+ // ITextCursorHelper
+ virtual const SwPaM* GetPaM() const;
+ virtual SwPaM* GetPaM();
+ virtual const SwDoc* GetDoc() const;
+ virtual SwDoc* GetDoc();
+};
+#endif
+
+
diff --git a/sw/source/ui/inc/usrpref.hxx b/sw/source/ui/inc/usrpref.hxx
new file mode 100644
index 000000000000..854b12d4f40e
--- /dev/null
+++ b/sw/source/ui/inc/usrpref.hxx
@@ -0,0 +1,286 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _USRPREF_HXX
+#define _USRPREF_HXX
+
+
+
+#include <unotools/configitem.hxx>
+#include <fldupde.hxx>
+#include "viewopt.hxx"
+#include <tools/fldunit.hxx>
+
+/* -----------------------------28.09.00 09:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwMasterUsrPref;
+class SwContentViewConfig : public utl::ConfigItem
+{
+ SwMasterUsrPref& rParent;
+ BOOL bWeb;
+
+ com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
+ public:
+ SwContentViewConfig(BOOL bWeb, SwMasterUsrPref& rParent);
+ ~SwContentViewConfig();
+
+ // utl::ConfigItem
+ virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames );
+ virtual void Commit();
+
+ void Load();
+ void SetModified(){ConfigItem::SetModified();}
+};
+/* -----------------------------28.09.00 09:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwLayoutViewConfig : public utl::ConfigItem
+{
+ SwMasterUsrPref& rParent;
+ BOOL bWeb;
+
+ com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
+ public:
+ SwLayoutViewConfig(BOOL bWeb, SwMasterUsrPref& rParent);
+ ~SwLayoutViewConfig();
+
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+ virtual void Commit();
+ void Load();
+ void SetModified(){ConfigItem::SetModified();}
+};
+/* -----------------------------19.01.01 13:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwGridConfig : public utl::ConfigItem
+{
+ SwMasterUsrPref& rParent;
+ BOOL bWeb;
+
+ com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
+ public:
+ SwGridConfig(BOOL bWeb, SwMasterUsrPref& rParent);
+ ~SwGridConfig();
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+ void Load();
+ void SetModified(){ConfigItem::SetModified();}
+};
+/* -----------------------------19.01.01 13:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwCursorConfig : public utl::ConfigItem
+{
+ SwMasterUsrPref& rParent;
+
+ com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames();
+ public:
+ SwCursorConfig(SwMasterUsrPref& rParent);
+ ~SwCursorConfig();
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+ void Load();
+ void SetModified(){ConfigItem::SetModified();}
+};
+/* -----------------------------28.09.00 09:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwWebColorConfig : public utl::ConfigItem
+{
+ SwMasterUsrPref& rParent;
+ com::sun::star::uno::Sequence<rtl::OUString> aPropNames;
+
+ public:
+ SwWebColorConfig(SwMasterUsrPref& rParent);
+ ~SwWebColorConfig();
+
+ virtual void Commit();
+ virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
+ void Load();
+ void SetModified(){ConfigItem::SetModified();}
+};
+/* -----------------------------28.09.00 09:45--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwMasterUsrPref : public SwViewOption
+{
+ friend class SwContentViewConfig;
+ friend class SwLayoutViewConfig;
+ friend class SwGridConfig;
+ friend class SwCursorConfig;
+ friend class SwWebColorConfig;
+
+ SwFldUpdateFlags eFldUpdateFlags; //udpate of fields and charts
+ sal_Int32 nLinkUpdateMode;
+ FieldUnit eUserMetric;
+ FieldUnit eHScrollMetric;
+ sal_Bool bIsHScrollMetricSet;
+ FieldUnit eVScrollMetric;
+ sal_Bool bIsVScrollMetricSet;
+
+ sal_Int32 nDefTab; //default tab stop distance
+
+ sal_Bool bIsSquaredPageMode; //default page mode for text grid
+ sal_Bool bIsAlignMathObjectsToBaseline;
+
+ SwContentViewConfig aContentConfig;
+ SwLayoutViewConfig aLayoutConfig;
+ SwGridConfig aGridConfig;
+ SwCursorConfig aCursorConfig;
+ SwWebColorConfig* pWebColorConfig;
+
+public:
+ SwMasterUsrPref(BOOL bWeb);
+ ~SwMasterUsrPref();
+
+ void SetUsrPref(const SwViewOption &rCopy);
+
+ void Commit()
+ {
+ aContentConfig.Commit();
+ aLayoutConfig.Commit();
+ aGridConfig.Commit();
+ aCursorConfig.Commit();
+ if(pWebColorConfig)
+ pWebColorConfig->Commit();
+ }
+ void SetModified()
+ {
+ aContentConfig.SetModified();
+ aLayoutConfig.SetModified();
+ aGridConfig.SetModified();
+ aCursorConfig.SetModified();
+ if(pWebColorConfig)
+ pWebColorConfig->SetModified();
+ }
+
+ void SetUpdateLinkMode(sal_Int32 nSet, sal_Bool bNoModify = sal_False)
+ {
+ nLinkUpdateMode = nSet;
+ if(!bNoModify)
+ aContentConfig.SetModified();
+ }
+ sal_Int32 GetUpdateLinkMode() const {return nLinkUpdateMode; }
+
+ void SetUpdateFields(BOOL bSet, sal_Bool bNoModify = sal_False)
+ {
+ if(bSet && eFldUpdateFlags == AUTOUPD_OFF)
+ {
+ eFldUpdateFlags = AUTOUPD_FIELD_ONLY;
+ if(!bNoModify)
+ aContentConfig.SetModified();
+ }
+ else if(!bSet)
+ {
+ eFldUpdateFlags = AUTOUPD_OFF;
+ if(!bNoModify)
+ aContentConfig.SetModified();
+ }
+ };
+ sal_Bool IsUpdateFields()const {return eFldUpdateFlags != AUTOUPD_OFF; }
+
+ SwFldUpdateFlags GetFldUpdateFlags()const {return eFldUpdateFlags;}
+ void SetFldUpdateFlags(SwFldUpdateFlags eSet, sal_Bool bNoModify = sal_False)
+ {
+ eFldUpdateFlags = eSet;
+ if(!bNoModify)
+ aContentConfig.SetModified();
+ }
+
+ void SetUpdateCharts(BOOL bSet, sal_Bool bNoModify = sal_False)
+ {
+ if(bSet)
+ {
+ eFldUpdateFlags = AUTOUPD_FIELD_AND_CHARTS;
+ if(!bNoModify)
+ aContentConfig.SetModified();
+ }
+ else if(eFldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS)
+ {
+ eFldUpdateFlags = AUTOUPD_FIELD_ONLY;
+ if(!bNoModify)
+ aContentConfig.SetModified();
+ }
+ };
+ sal_Bool IsUpdateCharts()const {return eFldUpdateFlags == AUTOUPD_FIELD_AND_CHARTS; }
+
+ FieldUnit GetMetric() const { return eUserMetric;}
+ void SetMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False)
+ {
+ eUserMetric = eSet;
+ if(!bNoModify)
+ aLayoutConfig.SetModified();
+ }
+
+ sal_Bool IsHScrollMetric()const {return bIsHScrollMetricSet;}
+ FieldUnit GetHScrollMetric() const { return bIsHScrollMetricSet ? eHScrollMetric : eUserMetric;}
+ void SetHScrollMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False)
+ {
+ eHScrollMetric = eSet; bIsHScrollMetricSet = sal_True;
+ if(!bNoModify)
+ aLayoutConfig.SetModified();
+ }
+
+ sal_Bool IsVScrollMetric()const {return bIsVScrollMetricSet;}
+ FieldUnit GetVScrollMetric() const { return bIsVScrollMetricSet ? eVScrollMetric : eUserMetric;}
+ void SetVScrollMetric(FieldUnit eSet, sal_Bool bNoModify = sal_False)
+ {
+ eVScrollMetric = eSet; bIsVScrollMetricSet = sal_True;
+ if(!bNoModify)
+ aLayoutConfig.SetModified();
+ }
+
+ sal_Int32 GetDefTab() const { return nDefTab;}
+ void SetDefTab( sal_Int32 nSet, sal_Bool bNoModify = sal_False )
+ {
+ nDefTab = nSet;
+ if(!bNoModify)
+ aLayoutConfig.SetModified();
+ }
+
+ //default page mode for text grid
+ sal_Bool IsSquaredPageMode() const {return bIsSquaredPageMode;}
+ void SetDefaultPageMode( sal_Bool bVal, sal_Bool bNoModify = sal_False )
+ {
+ bIsSquaredPageMode = bVal;
+ if(!bNoModify)
+ aLayoutConfig.SetModified();
+ }
+
+ sal_Bool IsAlignMathObjectsToBaseline() const { return bIsAlignMathObjectsToBaseline; }
+ void SetAlignMathObjectsToBaseline( sal_Bool bVal, sal_Bool bNoModify = sal_False )
+ {
+ bIsAlignMathObjectsToBaseline = bVal;
+ if(!bNoModify)
+ aLayoutConfig.SetModified();
+ }
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/utlui.hrc b/sw/source/ui/inc/utlui.hrc
new file mode 100644
index 000000000000..aa7dab24054a
--- /dev/null
+++ b/sw/source/ui/inc/utlui.hrc
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _UTLUI_HRC
+#define _UTLUI_HRC
+
+#include "rcid.hrc"
+
+
+#define RID_SW_SHELLRES (RC_UTLUI_BEGIN + 1)
+#define RID_STR_SYSTEM (RC_UTLUI_BEGIN + 2)
+
+// ------------------------------------------------------------------------
+
+// Strings in NumberFormatter-Listbox
+#define STR_DEFINE_NUMBERFORMAT (RC_UTLUI_BEGIN + 4)
+// hyperlink status bar control
+#define STR_HYPERCTRL_SEL (RC_UTLUI_BEGIN + 5)
+#define STR_HYPERCTRL_HYP (RC_UTLUI_BEGIN + 6)
+
+// Namene der Inhaltstypen (RC_UTLUI_BEGIN + 7)
+#define STR_CONTENT_TYPE_FIRST (RC_UTLUI_BEGIN + 8)
+#define STR_CONTENT_TYPE_OUTLINE STR_CONTENT_TYPE_FIRST
+#define STR_CONTENT_TYPE_TABLE (RC_UTLUI_BEGIN + 9)
+#define STR_CONTENT_TYPE_FRAME (RC_UTLUI_BEGIN + 10)
+#define STR_CONTENT_TYPE_GRAPHIC (RC_UTLUI_BEGIN + 11)
+#define STR_CONTENT_TYPE_OLE (RC_UTLUI_BEGIN + 12)
+#define STR_CONTENT_TYPE_BOOKMARK (RC_UTLUI_BEGIN + 13)
+#define STR_CONTENT_TYPE_REGION (RC_UTLUI_BEGIN + 14)
+#define STR_CONTENT_TYPE_URLFIELD (RC_UTLUI_BEGIN + 15)
+#define STR_CONTENT_TYPE_REFERENCE (RC_UTLUI_BEGIN + 16)
+#define STR_CONTENT_TYPE_INDEX (RC_UTLUI_BEGIN + 17)
+#define STR_CONTENT_TYPE_POSTIT (RC_UTLUI_BEGIN + 18)
+#define STR_CONTENT_TYPE_DRAWOBJECT (RC_UTLUI_BEGIN + 19)
+#define STR_CONTENT_END (RC_UTLUI_BEGIN + 19)
+
+#define STR_CONTENT_TYPE_SINGLE_FIRST (STR_CONTENT_END + 1)
+#define STR_CONTENT_TYPE_SINGLE_OUTLINE (STR_CONTENT_TYPE_SINGLE_FIRST + 0)
+#define STR_CONTENT_TYPE_SINGLE_TABLE (STR_CONTENT_TYPE_SINGLE_FIRST + 1)
+#define STR_CONTENT_TYPE_SINGLE_FRAME (STR_CONTENT_TYPE_SINGLE_FIRST + 2)
+#define STR_CONTENT_TYPE_SINGLE_GRAPHIC (STR_CONTENT_TYPE_SINGLE_FIRST + 3)
+#define STR_CONTENT_TYPE_SINGLE_OLE (STR_CONTENT_TYPE_SINGLE_FIRST + 4)
+#define STR_CONTENT_TYPE_SINGLE_BOOKMARK (STR_CONTENT_TYPE_SINGLE_FIRST + 5)
+#define STR_CONTENT_TYPE_SINGLE_REGION (STR_CONTENT_TYPE_SINGLE_FIRST + 6)
+#define STR_CONTENT_TYPE_SINGLE_URLFIELD (STR_CONTENT_TYPE_SINGLE_FIRST + 7)
+#define STR_CONTENT_TYPE_SINGLE_REFERENCE (STR_CONTENT_TYPE_SINGLE_FIRST + 8)
+#define STR_CONTENT_TYPE_SINGLE_INDEX (STR_CONTENT_TYPE_SINGLE_FIRST + 9)
+#define STR_CONTENT_TYPE_SINGLE_POSTIT (STR_CONTENT_TYPE_SINGLE_FIRST + 10)
+#define STR_CONTENT_TYPE_SINGLE_DRAWOBJECT (STR_CONTENT_TYPE_SINGLE_FIRST + 11)
+#define STR_CONTENT_SINGLE_END STR_CONTENT_TYPE_SINGLE_DRAWOBJECT
+
+#define FLD_DOCINFO_BEGIN STR_CONTENT_SINGLE_END
+#define FLD_DOCINFO_TITEL FLD_DOCINFO_BEGIN
+#define FLD_DOCINFO_THEMA (FLD_DOCINFO_BEGIN + 1)
+#define FLD_DOCINFO_KEYS (FLD_DOCINFO_BEGIN + 2)
+#define FLD_DOCINFO_COMMENT (FLD_DOCINFO_BEGIN + 3)
+#define FLD_DOCINFO_CREATE (FLD_DOCINFO_BEGIN + 4)
+#define FLD_DOCINFO_CHANGE (FLD_DOCINFO_BEGIN + 5)
+#define FLD_DOCINFO_PRINT (FLD_DOCINFO_BEGIN + 6)
+#define FLD_DOCINFO_DOCNO (FLD_DOCINFO_BEGIN + 7)
+#define FLD_DOCINFO_EDIT (FLD_DOCINFO_BEGIN + 8)
+#define FLD_DOCINFO_END (FLD_DOCINFO_BEGIN + 9)
+
+#define STR_SERVICE_UNAVAILABLE (FLD_DOCINFO_END + 1)
+
+#define STR_AUTH_TYPE_START (FLD_DOCINFO_END + 2)
+#define STR_AUTH_TYPE_ARTICLE (STR_AUTH_TYPE_START + 0)
+#define STR_AUTH_TYPE_BOOK (STR_AUTH_TYPE_START + 1)
+#define STR_AUTH_TYPE_BOOKLET (STR_AUTH_TYPE_START + 2)
+#define STR_AUTH_TYPE_CONFERENCE (STR_AUTH_TYPE_START + 3)
+#define STR_AUTH_TYPE_INBOOK (STR_AUTH_TYPE_START + 4)
+#define STR_AUTH_TYPE_INCOLLECTION (STR_AUTH_TYPE_START + 5)
+#define STR_AUTH_TYPE_INPROCEEDINGS (STR_AUTH_TYPE_START + 6)
+#define STR_AUTH_TYPE_JOURNAL (STR_AUTH_TYPE_START + 7)
+#define STR_AUTH_TYPE_MANUAL (STR_AUTH_TYPE_START + 8)
+#define STR_AUTH_TYPE_MASTERSTHESIS (STR_AUTH_TYPE_START + 9)
+#define STR_AUTH_TYPE_MISC (STR_AUTH_TYPE_START + 10)
+#define STR_AUTH_TYPE_PHDTHESIS (STR_AUTH_TYPE_START + 11)
+#define STR_AUTH_TYPE_PROCEEDINGS (STR_AUTH_TYPE_START + 12)
+#define STR_AUTH_TYPE_TECHREPORT (STR_AUTH_TYPE_START + 13)
+#define STR_AUTH_TYPE_UNPUBLISHED (STR_AUTH_TYPE_START + 14)
+#define STR_AUTH_TYPE_EMAIL (STR_AUTH_TYPE_START + 15)
+#define STR_AUTH_TYPE_WWW (STR_AUTH_TYPE_START + 16)
+#define STR_AUTH_TYPE_CUSTOM1 (STR_AUTH_TYPE_START + 17)
+#define STR_AUTH_TYPE_CUSTOM2 (STR_AUTH_TYPE_START + 18)
+#define STR_AUTH_TYPE_CUSTOM3 (STR_AUTH_TYPE_START + 19)
+#define STR_AUTH_TYPE_CUSTOM4 (STR_AUTH_TYPE_START + 20)
+#define STR_AUTH_TYPE_CUSTOM5 (STR_AUTH_TYPE_START + 21)
+#define STR_AUTH_TYPE_END (STR_AUTH_TYPE_CUSTOM5)
+
+#define STR_AUTH_FIELD_START (STR_AUTH_TYPE_END + 1)
+#define STR_AUTH_FIELD_IDENTIFIER (STR_AUTH_FIELD_START + 0)
+#define STR_AUTH_FIELD_AUTHORITY_TYPE (STR_AUTH_FIELD_START + 1)
+#define STR_AUTH_FIELD_ADDRESS (STR_AUTH_FIELD_START + 2)
+#define STR_AUTH_FIELD_ANNOTE (STR_AUTH_FIELD_START + 3)
+#define STR_AUTH_FIELD_AUTHOR (STR_AUTH_FIELD_START + 4)
+#define STR_AUTH_FIELD_BOOKTITLE (STR_AUTH_FIELD_START + 5)
+#define STR_AUTH_FIELD_CHAPTER (STR_AUTH_FIELD_START + 6)
+#define STR_AUTH_FIELD_EDITION (STR_AUTH_FIELD_START + 7)
+#define STR_AUTH_FIELD_EDITOR (STR_AUTH_FIELD_START + 8)
+#define STR_AUTH_FIELD_HOWPUBLISHED (STR_AUTH_FIELD_START + 9)
+#define STR_AUTH_FIELD_INSTITUTION (STR_AUTH_FIELD_START + 10)
+#define STR_AUTH_FIELD_JOURNAL (STR_AUTH_FIELD_START + 11)
+#define STR_AUTH_FIELD_MONTH (STR_AUTH_FIELD_START + 12)
+#define STR_AUTH_FIELD_NOTE (STR_AUTH_FIELD_START + 13)
+#define STR_AUTH_FIELD_NUMBER (STR_AUTH_FIELD_START + 14)
+#define STR_AUTH_FIELD_ORGANIZATIONS (STR_AUTH_FIELD_START + 15)
+#define STR_AUTH_FIELD_PAGES (STR_AUTH_FIELD_START + 16)
+#define STR_AUTH_FIELD_PUBLISHER (STR_AUTH_FIELD_START + 17)
+#define STR_AUTH_FIELD_SCHOOL (STR_AUTH_FIELD_START + 18)
+#define STR_AUTH_FIELD_SERIES (STR_AUTH_FIELD_START + 19)
+#define STR_AUTH_FIELD_TITLE (STR_AUTH_FIELD_START + 20)
+#define STR_AUTH_FIELD_TYPE (STR_AUTH_FIELD_START + 21)
+#define STR_AUTH_FIELD_VOLUME (STR_AUTH_FIELD_START + 22)
+#define STR_AUTH_FIELD_YEAR (STR_AUTH_FIELD_START + 23)
+#define STR_AUTH_FIELD_URL (STR_AUTH_FIELD_START + 24)
+#define STR_AUTH_FIELD_CUSTOM1 (STR_AUTH_FIELD_START + 25)
+#define STR_AUTH_FIELD_CUSTOM2 (STR_AUTH_FIELD_START + 26)
+#define STR_AUTH_FIELD_CUSTOM3 (STR_AUTH_FIELD_START + 27)
+#define STR_AUTH_FIELD_CUSTOM4 (STR_AUTH_FIELD_START + 28)
+#define STR_AUTH_FIELD_CUSTOM5 (STR_AUTH_FIELD_START + 29)
+#define STR_AUTH_FIELD_ISBN (STR_AUTH_FIELD_START + 30)
+#define STR_AUTH_FIELD_END (STR_AUTH_FIELD_ISBN)
+
+
+#define RES_FRMEX_MENU (STR_AUTH_FIELD_END + 1)
+
+#define DLG_NAVIGATION_PI (RC_UTLUI_BEGIN + 1)
+#define DLG_ADDR_PI (RC_UTLUI_BEGIN + 2)
+#define DLG_GLOSSARY_DECIDE_DLG (RC_UTLUI_BEGIN + 3)
+
+#define IMG_NAVI_ENTRYBMP (RC_UTLUI_BEGIN + 4)
+#define IMG_NAVI_ENTRYBMPH (RC_UTLUI_BEGIN + 5)
+#define ILIST_DB_DLG (RC_UTLUI_BEGIN + 6)
+#define ILIST_DB_DLG_HC (RC_UTLUI_BEGIN + 7)
+
+#define IMG_ONE_LEFT_HC (RC_UTLUI_BEGIN + 8)
+#define IMG_ONE_RIGHT_HC (RC_UTLUI_BEGIN + 9)
+#define IMG_ALL_LEFT_HC (RC_UTLUI_BEGIN + 10)
+#define IMG_ALL_RIGHT_HC (RC_UTLUI_BEGIN + 11)
+
+
+#define IMG_VIEWLAYOUT_AUTOMATIC (RC_UTLUI_BEGIN + 12)
+#define IMG_VIEWLAYOUT_AUTOMATIC_ACTIVE (RC_UTLUI_BEGIN + 13)
+#define IMG_VIEWLAYOUT_BOOKMODE (RC_UTLUI_BEGIN + 14)
+#define IMG_VIEWLAYOUT_BOOKMODE_ACTIVE (RC_UTLUI_BEGIN + 15)
+#define IMG_VIEWLAYOUT_SINGLECOLUMN (RC_UTLUI_BEGIN + 16)
+#define IMG_VIEWLAYOUT_SINGLECOLUMN_ACTIVE (RC_UTLUI_BEGIN + 17)
+#define IMG_VIEWLAYOUT_AUTOMATIC_HC (RC_UTLUI_BEGIN + 18)
+#define IMG_VIEWLAYOUT_AUTOMATIC_ACTIVE_HC (RC_UTLUI_BEGIN + 19)
+#define IMG_VIEWLAYOUT_BOOKMODE_HC (RC_UTLUI_BEGIN + 20)
+#define IMG_VIEWLAYOUT_BOOKMODE_ACTIVE_HC (RC_UTLUI_BEGIN + 21)
+#define IMG_VIEWLAYOUT_SINGLECOLUMN_HC (RC_UTLUI_BEGIN + 22)
+#define IMG_VIEWLAYOUT_SINGLECOLUMN_ACTIVE_HC (RC_UTLUI_BEGIN + 23)
+
+
+//local ids of the Database ImageLists
+#define IMG_COLLAPSE 18002 /*RID_SVXIMG_COLLAPSEDNODE*/
+#define IMG_EXPAND 18003 /*RID_SVXIMG_EXPANDEDNODE*/
+#define IMG_DB 1
+#define IMG_DBTABLE 2
+#define IMG_DBQUERY 3
+
+#define UTLUI_ACT_END RES_FRMEX_MENU
+
+#if UTLUI_ACT_END > RC_UTLUI_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#endif
diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx
new file mode 100644
index 000000000000..a462cd1deb6d
--- /dev/null
+++ b/sw/source/ui/inc/view.hxx
@@ -0,0 +1,695 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWVIEW_HXX
+#define _SWVIEW_HXX
+
+#include <vcl/timer.hxx>
+#include <vcl/field.hxx>
+#include <svtools/htmlcfg.hxx>
+#include <sfx2/viewfac.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/objsh.hxx>
+#include <editeng/svxenum.hxx>
+#include <svx/zoomitem.hxx>
+#include <editeng/editstat.hxx>
+#include "swdllapi.h"
+#include <swtypes.hxx>
+#include <shellid.hxx>
+#include <layout/layout.hxx>
+#include <IMark.hxx>
+
+class SwBaseShell;
+class Button;
+class ImageButton;
+class SwTxtFmtColl;
+class SwPageDesc;
+class SwFrmFmt;
+class SwCharFmt;
+class SwNumRule;
+class SwViewOption;
+class SwGlossaryHdl;
+class SwDrawBase;
+class SvxRuler;
+class SvxLRSpaceItem;
+class SwDocShell;
+class SwScrollbar;
+class SvxVCBrowser;
+class SvBorder;
+class Ruler;
+class OutlinerView;
+class SvxSearchItem;
+class SearchAttrItemList;
+class SvxSearchDialog;
+class SdrView;
+class Dialog;
+class SdrObject;
+class SdrPageView;
+class SwNaviImageButton;
+class SwHlpImageButton;
+class Outliner;
+class SwView;
+class SwEditWin;
+class SwWrtShell;
+class SwView_Impl;
+class XSelectionObject;
+struct SwSearchOptions;
+class FmFormShell;
+class CommandEvent;
+class InsCaptionOpt;
+class SvGlobalName;
+class SvtAccessibilityOptions;
+class SwTransferable;
+class SwMailMergeConfigItem;
+class SwTxtNode; // #i23726#
+class SwPrintData;
+class SwFormatClipboard;
+struct SwConversionArgs;
+class Graphic;
+class GraphicFilter;
+class SwPostItMgr;
+class SwFieldBookmark;
+
+namespace com{ namespace sun { namespace star {
+ namespace view{ class XSelectionSupplier; }
+}}}
+namespace sfx2 { class FileDialogHelper; }
+
+const long nLeftOfst = -370;
+const long nScrollX = 30;
+const long nScrollY = 30;
+
+#define MINZOOM 20
+#define MAXZOOM 600
+
+#define MAX_MARKS 5
+
+#define CHILDWIN_LABEL 1
+#define CHILDWIN_MAILMERGE 2
+
+enum ShellModes
+{
+ SHELL_MODE_TEXT,
+ SHELL_MODE_FRAME,
+ SHELL_MODE_GRAPHIC,
+ SHELL_MODE_OBJECT,
+ SHELL_MODE_DRAW,
+ SHELL_MODE_DRAW_CTRL,
+ SHELL_MODE_DRAW_FORM,
+ SHELL_MODE_DRAWTEXT,
+ SHELL_MODE_BEZIER,
+ SHELL_MODE_LIST_TEXT,
+ SHELL_MODE_TABLE_TEXT,
+ SHELL_MODE_TABLE_LIST_TEXT,
+ SHELL_MODE_MEDIA,
+ SHELL_MODE_EXTRUDED_CUSTOMSHAPE,
+ SHELL_MODE_FONTWORK,
+ SHELL_MODE_POSTIT
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung: Anwendung einer Vorlage
+ --------------------------------------------------------------------*/
+
+struct SwApplyTemplate
+{
+ union
+ {
+ SwTxtFmtColl* pTxtColl;
+ SwPageDesc* pPageDesc;
+ SwFrmFmt* pFrmFmt;
+ SwCharFmt* pCharFmt;
+ SwNumRule* pNumRule;
+ } aColl;
+
+ int eType;
+ USHORT nColor;
+ SwFormatClipboard* pFormatClipboard;
+ BOOL bUndo;
+
+ SwApplyTemplate() :
+ eType(0),
+ nColor(0),
+ pFormatClipboard(0),
+ bUndo(FALSE)
+ {
+ aColl.pTxtColl = 0;
+ }
+};
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sicht auf ein Dokument
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwView: public SfxViewShell
+{
+ //Messehack (MA,MBA)
+ friend void lcl_SelectShellForDrop( SwView &rView );
+
+ friend class TestTemplateItem;
+ friend class SwHHCWrapper;
+ friend class SwHyphWrapper;
+ friend class SwView_Impl;
+ friend class SwClipboardChangeListener;
+
+ //suchen & ersetzen
+ static SvxSearchDialog *pSrchDlg;
+ static SvxSearchItem *pSrchItem;
+
+ static USHORT nInsertCtrlState;
+ static USHORT nWebInsertCtrlState;
+ static USHORT nInsertObjectCtrlState;
+ static USHORT nInsertFieldCtrlState;
+ static USHORT nMoveType; // fuer Buttons unter dem Scrollbar (viewmdi)
+ static sal_Int32 nActMark; // aktuelle Sprungmarke fuer unbenannte Merker
+
+ static BOOL bExtra;
+ static BOOL bFound;
+ static BOOL bJustOpened;
+
+ static SearchAttrItemList* pSrchList;
+ static SearchAttrItemList* pReplList;
+
+
+ SvxHtmlOptions aHTMLOpt;
+ Timer aTimer; //Fuer verzoegerte ChgLnks waehrend
+ //einer Aktion
+ String aPageStr; //Statusanzeige, aktuelle Seite
+ String sSwViewData,
+ //and the new cursor position if the user double click in the PagePreView
+ sNewCrsrPos;
+ // to support keyboard the number of the page to go to can be set too
+ USHORT nNewPage;
+
+ Point aTabColFromDocPos; //Verschieben von Tabellenspalten aus
+ //aus dem Dokument heraus.
+ SwTxtNode * pNumRuleNodeFromDoc; // Moving indent of numrule #i23726#
+
+ Size aDocSz; // aktuelle Dokumentgroesse
+ Rectangle aVisArea; // sichtbarer Bereich
+
+ SwEditWin *pEditWin;
+ SwWrtShell *pWrtShell;
+
+ SfxShell *pShell; //aktuelle SubShell auf dem Dispatcher
+ FmFormShell *pFormShell; // DB-FormShell
+
+ SwView_Impl *pViewImpl; // Impl-Daten fuer UNO + Basic
+
+
+ SwScrollbar *pHScrollbar, // MDI Bedienelemente
+ *pVScrollbar;
+
+ Window *pScrollFill; // Dummy-Window zum Fuellen der rechten
+ // unteren Ecke, wenn beide Scrollbars
+ // aktiv sind
+
+ SvxRuler *pHRuler,
+ *pVRuler;
+ ImageButton *pTogglePageBtn;
+
+ SwHlpImageButton *pPageUpBtn,
+ *pPageDownBtn;
+
+ SwNaviImageButton *pNaviBtn;
+ SwGlossaryHdl *pGlosHdl; // Henkel Textbausteine
+ SwDrawBase *pDrawActual;
+
+ const SwFrmFmt *pLastTableFormat;
+
+ SwFormatClipboard *pFormatClipboard; //holds data for format paintbrush
+
+ SwPostItMgr *mpPostItMgr;
+
+ int nSelectionType;
+
+ static const int MASTERENUMCOMMANDS = 6;
+
+ String aCurrShapeEnumCommand[ MASTERENUMCOMMANDS ];
+
+ USHORT nPageCnt;
+
+ // Aktueller Drawmode
+ USHORT nDrawSfxId;
+ String sDrawCustom; //some drawing types are marked with strings!
+ USHORT nFormSfxId;
+ USHORT nLastPasteDestination;
+
+ // save the border distance status from SwView::StateTabWin to re-use it in SwView::ExecTabWin()
+ USHORT nLeftBorderDistance;
+ USHORT nRightBorderDistance;
+
+ BOOL bCenterCrsr : 1,
+ bTopCrsr : 1,
+ bAllwaysShowSel : 1,
+ bTabColFromDoc : 1,
+ bNumIndentFromDoc : 1, // #i23726#
+ bTabRowFromDoc : 1,
+ bSetTabColFromDoc : 1 ,
+ bSetTabRowFromDoc : 1,
+ bAttrChgNotified : 1,
+ bAttrChgNotifiedWithRegistrations : 1,
+ bVerbsActive : 1,
+ bDrawRotate : 1,
+ bDrawSelMode : 1,
+ bShowAtResize : 1,
+ bInOuterResizePixel : 1,
+ bInInnerResizePixel : 1,
+ bPasteState : 1,
+ bPasteSpecialState : 1,
+ bInMailMerge : 1,
+ bInDtor : 1, //detect destructor to prevent creating of sub shells while closing
+ bOldShellWasPagePreView : 1,
+ bMakeSelectionVisible : 1 // #b6330459# transport the bookmark selection
+ ;
+
+ // Methoden fuers Suchen
+ // Suchkontext setzen
+ SW_DLLPRIVATE BOOL SearchAndWrap(BOOL bApi = FALSE);
+ SW_DLLPRIVATE BOOL SearchAll(USHORT* pFound = 0);
+ SW_DLLPRIVATE ULONG FUNC_Search( const SwSearchOptions& rOptions );
+ SW_DLLPRIVATE void Replace();
+
+ BOOL IsDocumentBorder();
+
+ SW_DLLPRIVATE BOOL IsTextTool() const;
+
+ // Bedienelemente verwalten anlegen
+ SW_DLLPRIVATE void CreateBtns();
+ SW_DLLPRIVATE DECL_LINK( BtnPage, Button * );
+
+ SW_DLLPRIVATE DECL_LINK( TimeoutHdl, Timer * );
+ SW_DLLPRIVATE DECL_LINK( UpdatePercentHdl, GraphicFilter* );
+
+ SW_DLLPRIVATE DECL_LINK( HtmlOptionsHdl, void * );
+
+ inline long GetXScroll() const;
+ inline long GetYScroll() const;
+ SW_DLLPRIVATE Point AlignToPixel(const Point& rPt) const;
+ SW_DLLPRIVATE void CalcPt( Point* pPt,const Rectangle& rRect,
+ USHORT nRangeX = USHRT_MAX,
+ USHORT nRangeY = USHRT_MAX);
+
+ SW_DLLPRIVATE BOOL GetPageScrollUpOffset(SwTwips& rOff) const;
+ SW_DLLPRIVATE BOOL GetPageScrollDownOffset(SwTwips& rOff) const;
+
+ // Scrollbar Movements
+ SW_DLLPRIVATE long PageUp();
+ SW_DLLPRIVATE long PageDown();
+ SW_DLLPRIVATE long PageUpCrsr(BOOL bSelect);
+ SW_DLLPRIVATE long PageDownCrsr(BOOL bSelect);
+ SW_DLLPRIVATE long PhyPageUp();
+ SW_DLLPRIVATE long PhyPageDown();
+
+ SW_DLLPRIVATE int _CreateScrollbar( BOOL bHori );
+ SW_DLLPRIVATE DECL_LINK( ScrollHdl, SwScrollbar * );
+ SW_DLLPRIVATE DECL_LINK( EndScrollHdl, SwScrollbar * );
+ SW_DLLPRIVATE BOOL UpdateScrollbars();
+ SW_DLLPRIVATE void CalcVisArea( const Size &rPixelSz );
+
+ SW_DLLPRIVATE void CreatePageButtons(BOOL bShow);
+
+ // Linguistik-Funktionen
+ SW_DLLPRIVATE void HyphenateDocument();
+ SW_DLLPRIVATE BOOL IsDrawTextHyphenate();
+ SW_DLLPRIVATE void HyphenateDrawText();
+ SW_DLLPRIVATE void StartThesaurus();
+
+ // text conversion
+ SW_DLLPRIVATE void StartTextConversion( LanguageType nSourceLang, LanguageType nTargetLang, const Font *pTargetFont, sal_Int32 nOptions, sal_Bool bIsInteractive );
+
+ // used for spell checking and text conversion
+ SW_DLLPRIVATE void SpellStart( SvxSpellArea eSpell, BOOL bStartDone,
+ BOOL bEndDone, SwConversionArgs *pConvArgs = 0 );
+ SW_DLLPRIVATE void SpellEnd( SwConversionArgs *pConvArgs = 0 );
+
+ SW_DLLPRIVATE void HyphStart( SvxSpellArea eSpell );
+ SW_DLLPRIVATE BOOL CheckSpecialCntnt();
+ SW_DLLPRIVATE void SpellKontext(BOOL bOn = TRUE)
+ { bCenterCrsr = bOn; bAllwaysShowSel = bOn; }
+
+ // Methoden fuers Printing
+ SW_DLLPRIVATE virtual SfxPrinter* GetPrinter( BOOL bCreate = FALSE );
+ SfxTabPage* CreatePrintOptionsPage( Window* pParent,
+ const SfxItemSet& rSet);
+ // fuer Readonly-Umschaltung
+ SW_DLLPRIVATE virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+ SW_DLLPRIVATE void _CheckReadonlyState();
+ SW_DLLPRIVATE void _CheckReadonlySelection();
+
+ // Methode fuer PageDesc drehen
+ SW_DLLPRIVATE void SwapPageMargin(const SwPageDesc&, SvxLRSpaceItem& rLR);
+
+ SW_DLLPRIVATE void _SetZoom( const Size &rEditSz,
+ SvxZoomType eZoomType,
+ short nFactor = 100,
+ BOOL bViewOnly = FALSE);
+ SW_DLLPRIVATE void CalcAndSetBorderPixel( SvBorder &rToFill, BOOL bInner );
+
+ SW_DLLPRIVATE void ShowAtResize();
+
+ SW_DLLPRIVATE virtual void Move();
+
+ SW_DLLPRIVATE BOOL InsertGraphicDlg( SfxRequest& );
+
+protected:
+
+ SwView_Impl* GetViewImpl() {return pViewImpl;}
+
+ void ImpSetVerb( int nSelType );
+
+ int GetSelectionType() const { return nSelectionType; }
+ void SetSelectionType(int nSet) { nSelectionType = nSet;}
+
+ // fuer die SwWebView
+ void SetShell( SfxShell* pS ) { pShell = pS; }
+ void SetFormShell( FmFormShell* pSh ) { pFormShell = pSh; }
+
+ virtual void SelectShell();
+
+ virtual void Activate(BOOL);
+ virtual void Deactivate(BOOL);
+ virtual void InnerResizePixel( const Point &rOfs, const Size &rSize );
+ virtual void OuterResizePixel( const Point &rOfs, const Size &rSize );
+ virtual Size GetOptimalSizePixel() const;
+
+ void SetImageButtonColor(Color& rColor);
+
+ const SwFrmFmt* GetLastTblFrmFmt() const {return pLastTableFormat;}
+ void SetLastTblFrmFmt(const SwFrmFmt* pSet) {pLastTableFormat = pSet;}
+
+ // form letter execution
+ void GenerateFormLetter(BOOL bUseCurrentDocument);
+
+ using SfxShell::GetDispatcher;
+
+public:
+
+ SFX_DECL_VIEWFACTORY(SwView);
+ SFX_DECL_INTERFACE(SW_VIEWSHELL)
+ TYPEINFO();
+
+ SfxDispatcher &GetDispatcher();
+
+ void GotFocus() const;
+ virtual SdrView* GetDrawView() const;
+ virtual sal_Bool HasUIFeature( sal_uInt32 nFeature );
+ virtual void ShowCursor( FASTBOOL bOn = TRUE );
+ virtual ErrCode DoVerb( long nVerb );
+
+ virtual USHORT SetPrinter( SfxPrinter* pNew,
+ USHORT nDiff = SFX_PRINTER_ALL, bool bIsAPI=false);
+ ShellModes GetShellMode();
+
+ com::sun::star::view::XSelectionSupplier* GetUNOObject();
+
+ String GetSelectionTextParam( BOOL bCompleteWords,
+ BOOL bEraseTrail );
+ virtual BOOL HasSelection( BOOL bText ) const;
+ virtual String GetSelectionText( BOOL bCompleteWords = FALSE );
+ virtual USHORT PrepareClose( BOOL bUI = TRUE, BOOL bForBrowsing = FALSE );
+ virtual void MarginChanged();
+
+ // replace word/selection with text from the thesaurus
+ // (this code has special handling for "in word" character)
+ void InsertThesaurusSynonym( const String &rSynonmText, const String &rLookUpText, bool bValidSelection );
+ bool IsValidSelectionForThesaurus() const;
+ String GetThesaurusLookUpText( bool bSelection ) const;
+
+ // Shell sofort wechseln -> fuer GetSelectionObject
+ void StopShellTimer();
+
+ inline SwWrtShell& GetWrtShell () const { return *pWrtShell; }
+ inline SwWrtShell* GetWrtShellPtr() const { return pWrtShell; }
+
+ inline SwEditWin &GetEditWin() { return *pEditWin; }
+ inline const SwEditWin &GetEditWin () const { return *pEditWin; }
+
+#if defined WNT || defined UNX
+ void ScannerEventHdl( const ::com::sun::star::lang::EventObject& rEventObject );
+#endif
+
+ //Handler fuer Textbausteine an die Textshell rausreichen, gfs. anlegen
+ SwGlossaryHdl* GetGlosHdl();
+
+ inline const Rectangle& GetVisArea() const { return aVisArea; }
+
+ BOOL IsScroll(const Rectangle& rRect) const;
+ void Scroll( const Rectangle& rRect,
+ USHORT nRangeX = USHRT_MAX,
+ USHORT nRangeY = USHRT_MAX);
+
+ long SetVScrollMax(long lMax);
+ long SetHScrollMax(long lMax);
+
+ DECL_LINK( SpellError, LanguageType * );
+ BOOL ExecSpellPopup( const Point& rPt );
+ BOOL ExecFieldPopup( const Point& rPt, sw::mark::IFieldmark *fieldBM );
+ // SMARTTAGS
+ BOOL ExecSmartTagPopup( const Point& rPt );
+
+ DECL_LINK( OnlineSpellCallback, SpellCallbackInfo*);
+ BOOL ExecDrwTxtSpellPopup(const Point& rPt);
+
+ void SetTabColFromDocPos( const Point &rPt ) { aTabColFromDocPos = rPt; }
+ void SetTabColFromDoc( BOOL b ) { bTabColFromDoc = b; }
+ BOOL IsTabColFromDoc() const { return bTabColFromDoc; }
+ void SetTabRowFromDoc( BOOL b ) { bTabRowFromDoc = b; }
+ BOOL IsTabRowFromDoc() const { return bTabRowFromDoc; }
+
+ // -> #i23726#
+ void SetNumRuleNodeFromDoc( SwTxtNode * pNumRuleNode )
+ { pNumRuleNodeFromDoc = pNumRuleNode; }
+ void SetNumIndentFromDoc(BOOL b) { bNumIndentFromDoc = b; }
+ BOOL IsNumIndentFromDoc() const { return NULL != pNumRuleNodeFromDoc; }
+ // <- #i23726#
+
+ void DocSzChgd( const Size& rNewSize );
+ const Size& GetDocSz() const { return aDocSz; }
+ virtual void SetVisArea( const Rectangle&, BOOL bUpdateScrollbar = TRUE);
+ void SetVisArea( const Point&, BOOL bUpdateScrollbar = TRUE);
+ void CheckVisArea();
+
+ static LAYOUT_NS Dialog* GetSearchDialog();
+
+ static USHORT GetMoveType();
+ static void SetMoveType(USHORT nSet);
+ DECL_STATIC_LINK( SwView, MoveNavigationHdl, bool* ); // #i75416#
+ static void SetActMark(sal_Int32 nSet);
+
+ BOOL HandleWheelCommands( const CommandEvent& );
+
+ // Rahmen einfuegen
+ void InsFrmMode(USHORT nCols);
+
+ void SetZoom( SvxZoomType eZoomType, short nFactor = 100, BOOL bViewOnly = FALSE);
+ virtual void SetZoomFactor( const Fraction &rX, const Fraction & );
+
+ void SetViewLayout( USHORT nColumns, bool bBookMode, BOOL bViewOnly = FALSE );
+
+ void ShowHScrollbar(sal_Bool bShow);
+ sal_Bool IsHScrollbarVisible()const;
+
+ void ShowVScrollbar(sal_Bool bShow);
+ sal_Bool IsVScrollbarVisible()const;
+
+ int CreateVLineal();
+ int KillVLineal();
+ int CreateTab();
+ int KillTab();
+
+ int StatVLineal() const { return ((Window*)pVRuler)->IsVisible(); }
+ void ChangeVLinealMetric(FieldUnit eUnit);
+ void GetVLinealMetric(FieldUnit& rToFill) const;
+
+ int StatTab() const { return ((Window*)pHRuler)->IsVisible(); }
+ SvxRuler& GetHLineal() { return *pHRuler; }
+ SvxRuler& GetVLineal() { return *pVRuler; }
+ void InvalidateRulerPos();
+ void ChangeTabMetric(FieldUnit eUnit);
+ void GetHLinealMetric(FieldUnit& rToFill) const;
+
+ // Handler
+ void Execute(SfxRequest&);
+ void ExecPageMove(SfxRequest&);
+ void ExecStyle(SfxRequest&);
+ void ExecLingu(SfxRequest&);
+ void ExecDataBase(SfxRequest&);
+ void ExecDlg(SfxRequest&);
+ void ExecDlgExt(SfxRequest&);
+ void ExecDBDlg(SfxRequest &);
+ void ExecColl(SfxRequest&);
+ void ExecutePrint(SfxRequest&);
+ void ExecDraw(SfxRequest&);
+ void ExecTabWin(SfxRequest&);
+ void ExecuteStatusLine(SfxRequest&);
+ DECL_LINK( ExecRulerClick, Ruler * );
+ void ExecSearch(SfxRequest&, BOOL bNoMessage = FALSE);
+ void ExecViewOptions(SfxRequest &);
+
+ void StateViewOptions(SfxItemSet &);
+ void StateSearch(SfxItemSet &);
+ void GetState(SfxItemSet&);
+ void StateStatusLine(SfxItemSet&);
+
+
+ // Funktionen fuer Drawing
+ void SetDrawFuncPtr(SwDrawBase* pFuncPtr);
+ inline SwDrawBase* GetDrawFuncPtr(/*BOOL bBuf = FALSE*/) const { return pDrawActual; }
+ void GetDrawState(SfxItemSet &rSet);
+ void ExitDraw();
+ inline BOOL IsDrawRotate() { return bDrawRotate; }
+ inline void FlipDrawRotate() { bDrawRotate = !bDrawRotate; }
+ inline BOOL IsDrawSelMode() { return bDrawSelMode; }
+ void SetSelDrawSlot();
+ inline void FlipDrawSelMode() { bDrawSelMode = !bDrawSelMode; }
+ void NoRotate(); // Rotate-Mode abschalten
+ BOOL EnterDrawTextMode(const Point& aDocPos);
+ void LeaveDrawCreate() { nDrawSfxId = nFormSfxId = USHRT_MAX; sDrawCustom.Erase();}
+ BOOL IsDrawMode() { return (nDrawSfxId != USHRT_MAX || nFormSfxId != USHRT_MAX); }
+ BOOL IsFormMode() const;
+ BOOL IsBezierEditMode();
+ BOOL AreOnlyFormsSelected() const;
+ BOOL HasDrwObj(SdrObject *pSdrObj) const;
+ BOOL HasOnlyObj(SdrObject *pSdrObj, UINT32 eObjInventor) const;
+ BOOL BeginTextEdit( SdrObject* pObj, SdrPageView* pPV=NULL,
+ Window* pWin=NULL, bool bIsNewObj=false, bool bSetSelectionToStart=false );
+
+ void StateTabWin(SfxItemSet&);
+
+ // Attribute haben sich geaendert
+ DECL_LINK( AttrChangedNotify, SwWrtShell * );
+
+ // form control has been activated
+ DECL_LINK( FormControlActivated, FmFormShell* );
+
+ // Links bearbeiten
+ void EditLinkDlg();
+ void AutoCaption(const USHORT nType, const SvGlobalName *pOleId = 0);
+ void InsertCaption(const InsCaptionOpt *pOpt);
+
+ // Async Aufruf durch Core
+ void UpdatePageNums(USHORT nPhyNum, USHORT nVirtNum, const String& rPgStr);
+
+ String GetPageStr(USHORT nPhyNum, USHORT nVirtNum, const String& rPgStr);
+
+ // Shell rausreichen
+ SfxShell *GetCurShell() { return pShell; }
+ SwDocShell *GetDocShell();
+ inline const SwDocShell *GetDocShell() const;
+ inline FmFormShell *GetFormShell() { return pFormShell; }
+ inline const FmFormShell *GetFormShell() const { return pFormShell; }
+
+ //damit in DToren der SubShells ggf. pShell zurueckgesetzt werden kann
+ void ResetSubShell() { pShell = 0; }
+
+ virtual void WriteUserData(String &, BOOL bBrowse = FALSE );
+ virtual void ReadUserData(const String &, BOOL bBrowse = FALSE );
+ virtual void ReadUserDataSequence ( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse );
+ virtual void WriteUserDataSequence ( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse );
+
+ void SetCrsrAtTop( BOOL bFlag, BOOL bCenter = FALSE )
+ { bTopCrsr = bFlag, bCenterCrsr = bCenter; }
+ BOOL IsCrsrAtTop() const { return bTopCrsr; }
+ BOOL IsCrsrAtCenter() const { return bCenterCrsr; }
+
+ BOOL JumpToSwMark( const String& rMark );
+
+ long InsertDoc( USHORT nSlotId, const String& rFileName,
+ const String& rFilterName, INT16 nVersion = 0 );
+
+ void ExecuteInsertDoc( SfxRequest& rRequest, const SfxPoolItem* pItem );
+ long InsertMedium( USHORT nSlotId, SfxMedium* pMedium, INT16 nVersion );
+ DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper * );
+
+ // status methods for clipboard.
+ // Status changes now notified from the clipboard.
+ BOOL IsPasteAllowed();
+ BOOL IsPasteSpecialAllowed();
+
+ // Enable mail merge - mail merge field dialog enabled
+ void EnableMailMerge(BOOL bEnable = TRUE);
+ //apply Accessiblity options
+ void ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions);
+
+ SwView(SfxViewFrame* pFrame, SfxViewShell*);
+ ~SwView();
+
+ void NotifyDBChanged();
+
+ SfxObjectShellLock & GetTmpSelectionDoc();
+ SfxObjectShellLock & GetOrCreateTmpSelectionDoc();
+
+ void AddTransferable(SwTransferable& rTransferable);
+
+ // store MailMerge data while "Back to Mail Merge Wizard" FloatingWindow is active
+ // or to support printing
+ void SetMailMergeConfigItem(SwMailMergeConfigItem* pConfigItem, sal_uInt16 nRestart, sal_Bool bIsSource);
+ SwMailMergeConfigItem* GetMailMergeConfigItem();
+ sal_uInt16 GetMailMergeRestartPage() const;
+ sal_Bool IsMailMergeSourceView() const;
+
+ void ExecFormatPaintbrush(SfxRequest &);
+ void StateFormatPaintbrush(SfxItemSet &);
+
+ //public fuer D&D
+ int InsertGraphic( const String &rPath, const String &rFilter,
+ BOOL bLink = TRUE, GraphicFilter *pFlt = 0,
+ Graphic* pPreviewGrf = 0,
+ BOOL bRule = FALSE );
+
+ void ExecuteScan( SfxRequest& rReq );
+
+ SwPostItMgr* GetPostItMgr() { return mpPostItMgr;}
+ const SwPostItMgr* GetPostItMgr() const { return mpPostItMgr;}
+};
+
+// ----------------- inline Methoden ----------------------
+
+inline long SwView::GetXScroll() const
+{
+ return aVisArea.GetWidth() * nScrollX / 100L;
+}
+
+inline long SwView::GetYScroll() const
+{
+ return aVisArea.GetHeight() * nScrollY / 100L;
+}
+
+inline const SwDocShell *SwView::GetDocShell() const
+{
+ return ((SwView*)this)->GetDocShell();
+}
+
+//***********************************************************
+
+SfxTabPage* CreatePrintOptionsPage( Window *pParent,
+ const SfxItemSet &rOptions,
+ BOOL bPreview);
+
+#endif
+
diff --git a/sw/source/ui/inc/viewlayoutctrl.hxx b/sw/source/ui/inc/viewlayoutctrl.hxx
new file mode 100644
index 000000000000..60d05b63a79e
--- /dev/null
+++ b/sw/source/ui/inc/viewlayoutctrl.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _VIEWLAYOUTCTRL_HXX
+#define _VIEWLAYOUTCTRL_HXX
+
+// include ---------------------------------------------------------------
+
+#include <sfx2/stbitem.hxx>
+
+// class SwViewLayoutControl ----------------------------------------------
+
+class SwViewLayoutControl : public SfxStatusBarControl
+{
+private:
+
+ struct SwViewLayoutControl_Impl;
+ SwViewLayoutControl_Impl* mpImpl;
+
+public:
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SwViewLayoutControl( USHORT nSlotId, USHORT nId, StatusBar& rStb );
+ ~SwViewLayoutControl();
+
+ virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual void Paint( const UserDrawEvent& rEvt );
+ virtual BOOL MouseButtonDown( const MouseEvent & );
+};
+
+#endif
+
diff --git a/sw/source/ui/inc/web.hrc b/sw/source/ui/inc/web.hrc
new file mode 100644
index 000000000000..e9e446d62cdb
--- /dev/null
+++ b/sw/source/ui/inc/web.hrc
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _WEB_HRC
+#define _WEB_HRC
+
+#include "rcid.hrc"
+
+#define RC_WEB_ICON (RC_WEB_BEGIN + 1)
+#define RID_WEBTOOLS_TOOLBOX (RC_WEB_BEGIN + 2)
+#define RID_WEBTEXT_TOOLBOX (RC_WEB_BEGIN + 3)
+#define STR_HUMAN_SWWEBDOC_NAME (RC_WEB_BEGIN + 4)
+#define STR_WRITER_WEBDOC_FULLTYPE_40 (RC_WEB_BEGIN + 5)
+#define STR_SHELLNAME_WEBTEXT (RC_WEB_BEGIN + 6)
+#define STR_SHELLNAME_WEBFRAME (RC_WEB_BEGIN + 7)
+#define RID_WEBFRAME_TOOLBOX (RC_WEB_BEGIN + 8)
+#define STR_WRITER_WEBDOC_FULLTYPE_50 (RC_WEB_BEGIN + 9)
+#define RID_WEBGRAPHIC_TOOLBOX (RC_WEB_BEGIN + 10)
+#define RID_WEBOLE_TOOLBOX (RC_WEB_BEGIN + 11)
+#define STR_WRITER_WEBDOC_FULLTYPE (RC_WEB_BEGIN + 12)
+
+
+#define MN_WEBFILE (RC_WEB_BEGIN + 30)
+#define MN_WEBEDIT (RC_WEB_BEGIN + 31)
+#define MN_WEBVIEW (RC_WEB_BEGIN + 32)
+#define MN_WEBINS (RC_WEB_BEGIN + 33)
+#define MN_WEBFORMAT (RC_WEB_BEGIN + 34)
+#define MN_WEBEXTRA (RC_WEB_BEGIN + 35)
+#define MN_WEBWIN (RC_WEB_BEGIN + 36)
+
+#define MN_WEB_TEXT_POPUPMENU (RC_WEB_BEGIN + 46)
+
+#define MN_WEBFILE_PORT (RC_WEB_BEGIN + 47)
+#define MN_WEBEDIT_PORT (RC_WEB_BEGIN + 48)
+#define MN_WEBVIEW_PORT (RC_WEB_BEGIN + 49)
+#define MN_WEBINS_PORT (RC_WEB_BEGIN + 50)
+#define MN_WEBFORMAT_PORT (RC_WEB_BEGIN + 51)
+#define MN_WEBEXTRA_PORT (RC_WEB_BEGIN + 52)
+#define MN_WEBWIN_PORT (RC_WEB_BEGIN + 53)
+
+// ------------------------------------------------------------------------
+
+#define WEB_ACT_END MN_WEBWIN_PORT
+
+
+#if WEB_ACT_END > RC_WEB_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#endif
diff --git a/sw/source/ui/inc/wformsh.hxx b/sw/source/ui/inc/wformsh.hxx
new file mode 100644
index 000000000000..abd98d510e65
--- /dev/null
+++ b/sw/source/ui/inc/wformsh.hxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWWDRWFORMSH_HXX
+#define _SWWDRWFORMSH_HXX
+
+#include "drformsh.hxx"
+
+class SwWebDrawFormShell : public SwDrawFormShell
+{
+public:
+ SwWebDrawFormShell(SwView &rShell);
+ virtual ~SwWebDrawFormShell();
+
+ SFX_DECL_INTERFACE(SW_WEBDRAWFORMSHELL)
+ TYPEINFO();
+};
+
+
+#endif
+
+
diff --git a/sw/source/ui/inc/wfrmsh.hxx b/sw/source/ui/inc/wfrmsh.hxx
new file mode 100644
index 000000000000..dfe5bd5f422f
--- /dev/null
+++ b/sw/source/ui/inc/wfrmsh.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SWWFRMSH_HXX
+#define _SWWFRMSH_HXX
+
+#include "frmsh.hxx"
+
+
+class SwWebFrameShell: public SwFrameShell
+{
+
+public:
+ SFX_DECL_INTERFACE(SW_WEBFRAMESHELL)
+ TYPEINFO();
+
+ SwWebFrameShell(SwView &rView);
+ virtual ~SwWebFrameShell();
+};
+
+#endif
+
+
+
diff --git a/sw/source/ui/inc/wgrfsh.hxx b/sw/source/ui/inc/wgrfsh.hxx
new file mode 100644
index 000000000000..b53743885d66
--- /dev/null
+++ b/sw/source/ui/inc/wgrfsh.hxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWWGRFSH_HXX
+#define _SWWGRFSH_HXX
+
+#include "grfsh.hxx"
+
+class SwWebGrfShell: public SwGrfShell
+{
+public:
+ SwWebGrfShell(SwView &rShell);
+ virtual ~SwWebGrfShell();
+
+ SFX_DECL_INTERFACE(SW_WEBGRFSHELL)
+ TYPEINFO();
+};
+
+
+#endif
+
+
diff --git a/sw/source/ui/inc/wlistsh.hxx b/sw/source/ui/inc/wlistsh.hxx
new file mode 100644
index 000000000000..e3503a54e448
--- /dev/null
+++ b/sw/source/ui/inc/wlistsh.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWWLISTSH_HXX
+#define _SWWLISTSH_HXX
+
+#include "listsh.hxx"
+
+class SwWebListShell: public SwListShell
+{
+public:
+ SFX_DECL_INTERFACE(SW_WEBLISTSHELL)
+ TYPEINFO();
+
+ virtual ~SwWebListShell();
+ SwWebListShell(SwView &rView);
+};
+
+#endif
diff --git a/sw/source/ui/inc/wolesh.hxx b/sw/source/ui/inc/wolesh.hxx
new file mode 100644
index 000000000000..87b48db5593e
--- /dev/null
+++ b/sw/source/ui/inc/wolesh.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWWOLESH_HXX
+#define _SWWOLESH_HXX
+
+#include "olesh.hxx"
+
+class SwWebOleShell: public SwOleShell
+{
+public:
+ SFX_DECL_INTERFACE(SW_WEBOLESHELL)
+
+ virtual ~SwWebOleShell();
+ SwWebOleShell(SwView &rView);
+};
+
+#endif
+
+
+
+
+
+
+
diff --git a/sw/source/ui/inc/wordcountdialog.hxx b/sw/source/ui/inc/wordcountdialog.hxx
new file mode 100644
index 000000000000..a228b8bdea77
--- /dev/null
+++ b/sw/source/ui/inc/wordcountdialog.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_WORDCOUNTDIALOG_HXX
+#define SW_WORDCOUNTDIALOG_HXX
+#include <sfx2/basedlgs.hxx>
+#include <svtools/stdctrl.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <layout/layout.hxx>
+#include <layout/layout-pre.hxx>
+struct SwDocStat;
+class SwWordCountDialog : public SfxModalDialog
+{
+ FixedLine aCurrentFL;
+ FixedText aCurrentWordFT;
+ FixedInfo aCurrentWordFI;
+ FixedText aCurrentCharacterFT;
+ FixedInfo aCurrentCharacterFI;
+
+ FixedLine aDocFL;
+ FixedText aDocWordFT;
+ FixedInfo aDocWordFI;
+ FixedText aDocCharacterFT;
+ FixedInfo aDocCharacterFI;
+
+ FixedLine aBottomFL;
+
+ OKButton aOK;
+ HelpButton aHelp;
+
+public:
+ SwWordCountDialog(Window* pParent);
+ ~SwWordCountDialog();
+
+ void SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc);
+};
+
+#include <layout/layout-post.hxx>
+
+#endif
diff --git a/sw/source/ui/inc/workctrl.hxx b/sw/source/ui/inc/workctrl.hxx
new file mode 100644
index 000000000000..f6a6b19c3c73
--- /dev/null
+++ b/sw/source/ui/inc/workctrl.hxx
@@ -0,0 +1,225 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _WORKCTRL_HXX
+#define _WORKCTRL_HXX
+
+#include <sfx2/tbxctrl.hxx>
+#include <vcl/toolbox.hxx>
+#include <svtools/stdctrl.hxx>
+#ifndef _IMAGEBTN_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+class PopupMenu;
+class SwView;
+
+// doppelter Eintrag! hrc und hxx
+// diese Ids bestimmen, was die Buttons unter dem Scrollbar tun
+#define NID_START 20000
+#define NID_NEXT 20000
+#define NID_PREV 20001
+#define NID_TBL 20002
+#define NID_FRM 20003
+#define NID_PGE 20004
+#define NID_DRW 20005
+#define NID_CTRL 20006
+#define NID_REG 20007
+#define NID_BKM 20008
+#define NID_GRF 20009
+#define NID_OLE 20010
+#define NID_OUTL 20011
+#define NID_SEL 20012
+#define NID_FTN 20013
+#define NID_MARK 20014
+#define NID_POSTIT 20015
+#define NID_SRCH_REP 20016
+#define NID_INDEX_ENTRY 20017
+#define NID_TABLE_FORMULA 20018
+#define NID_TABLE_FORMULA_ERROR 20019
+#define NID_COUNT 20
+
+
+
+//----------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------
+
+class SwTbxInsertCtrl : public SfxToolBoxControl
+{
+ USHORT nLastSlotId;
+
+ using SfxToolBoxControl::Select;
+ virtual void Select( BOOL bMod1 = FALSE );
+
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SwTbxInsertCtrl( USHORT nSlotId, USHORT nId, ToolBox& rTbx );
+ ~SwTbxInsertCtrl();
+
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+ virtual void StateChanged( USHORT nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState );
+
+ virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
+};
+
+//----------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------
+
+class SwTbxAutoTextCtrl : public SfxToolBoxControl
+{
+ PopupMenu* pPopup;
+ SwView* pView;
+
+
+ void DelPopup();
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SwTbxAutoTextCtrl( USHORT nSlotId, USHORT nId, ToolBox& rTbx );
+ ~SwTbxAutoTextCtrl();
+
+ virtual SfxPopupWindowType GetPopupWindowType() const;
+ virtual SfxPopupWindow* CreatePopupWindow();
+ virtual void StateChanged( USHORT nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState );
+
+ DECL_LINK(PopupHdl, PopupMenu*);
+};
+
+
+//----------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------
+
+class SwScrollNaviToolBox : public ToolBox
+{
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+
+ public:
+ SwScrollNaviToolBox(Window* pParent, WinBits nWinStyle ) :
+ ToolBox(pParent, nWinStyle ) {}
+};
+
+class SwScrollNaviPopup : public SfxPopupWindow
+{
+ SwScrollNaviToolBox aToolBox;
+ FixedLine aSeparator;
+ FixedInfo aInfoField;
+ ImageList aIList;
+ ImageList aIListH;
+
+ String sQuickHelp[2 * NID_COUNT];
+
+ USHORT nFwdId;
+ USHORT nBackId;
+
+ void ApplyImageList();
+
+ using Window::GetQuickHelpText;
+
+protected:
+ DECL_LINK(SelectHdl, ToolBox*);
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+public:
+ SwScrollNaviPopup( USHORT nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+ ~SwScrollNaviPopup();
+
+ static String GetQuickHelpText(BOOL bNext);
+
+ virtual SfxPopupWindow* Clone() const;
+ void GrabFocus(){aToolBox.GrabFocus();}
+};
+
+//----------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------
+
+class SwNaviImageButton : public ImageButton
+{
+ SwScrollNaviPopup* pPopup;
+ Image aImage;
+ Image aImageH;
+ String sQuickText;
+ SfxPopupWindow* pPopupWindow;
+ SfxPopupWindow* pFloatingWindow;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+
+ protected:
+ DECL_LINK( PopupModeEndHdl, void * );
+ DECL_LINK( ClosePopupWindow, SfxPopupWindow * );
+
+ virtual void Click();
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ void SetPopupWindow( SfxPopupWindow* pWindow );
+
+ public:
+ SwNaviImageButton(Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+};
+
+//----------------------------------------------------------------------------
+// Die ImageButtons muessen sich bei Bedarf den HelpText selbst setzen
+//----------------------------------------------------------------------------
+
+class SwHlpImageButton : public ImageButton
+{
+ BOOL bUp;
+ public:
+ SwHlpImageButton(Window* pParent, const ResId& rResId, BOOL bUpBtn) :
+ ImageButton(pParent, rResId), bUp(bUpBtn){}
+
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+
+};
+/* -----------------26.11.2002 09:25-----------------
+ *
+ * --------------------------------------------------*/
+class SwPreviewZoomControl : public SfxToolBoxControl
+{
+public:
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ SwPreviewZoomControl( USHORT nSlotId, USHORT nId, ToolBox& rTbx );
+ ~SwPreviewZoomControl();
+
+ virtual void StateChanged( USHORT nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState );
+
+ virtual Window* CreateItemWindow( Window *pParent );
+};
+#endif
+
+
+
diff --git a/sw/source/ui/inc/wrap.hxx b/sw/source/ui/inc/wrap.hxx
new file mode 100644
index 000000000000..e0fc8a394c5f
--- /dev/null
+++ b/sw/source/ui/inc/wrap.hxx
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _WRAP_HXX
+#define _WRAP_HXX
+
+#include <sfx2/tabdlg.hxx>
+#include <sfx2/basedlgs.hxx>
+
+#ifndef _IMAGEBTN_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+
+class Window;
+class SfxItemSet;
+class SwWrtShell;
+
+class SwWrapDlg : public SfxSingleTabDialog
+{
+ SwWrtShell* pWrtShell;
+
+public:
+ SwWrapDlg(Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, BOOL bDrawMode);
+ ~SwWrapDlg();
+
+ inline SwWrtShell* GetWrtShell() { return pWrtShell; }
+};
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Umlauf-TabPage
+ --------------------------------------------------------------------*/
+
+class SwWrapTabPage: public SfxTabPage
+{
+ // WRAPPING
+ FixedLine aWrapFLC;
+ ImageRadioButton aNoWrapRB;
+ ImageRadioButton aWrapLeftRB;
+ ImageRadioButton aWrapRightRB;
+ ImageRadioButton aWrapParallelRB;
+ ImageRadioButton aWrapThroughRB;
+ ImageRadioButton aIdealWrapRB;
+
+ // MARGIN
+ FixedLine aMarginFL;
+ FixedText aLeftMarginFT;
+ MetricField aLeftMarginED;
+ FixedText aRightMarginFT;
+ MetricField aRightMarginED;
+ FixedText aTopMarginFT;
+ MetricField aTopMarginED;
+ FixedText aBottomMarginFT;
+ MetricField aBottomMarginED;
+
+ // OPTIONS
+ FixedLine aOptionsSepFL;
+ FixedLine aOptionsFL;
+ CheckBox aWrapAnchorOnlyCB;
+ CheckBox aWrapTransparentCB;
+ CheckBox aWrapOutlineCB;
+ CheckBox aWrapOutsideCB;
+
+ ImageList aWrapIL;
+ ImageList aWrapILH;
+
+ USHORT nOldLeftMargin;
+ USHORT nOldRightMargin;
+ USHORT nOldUpperMargin;
+ USHORT nOldLowerMargin;
+
+ RndStdIds nAnchorId;
+ USHORT nHtmlMode;
+
+ Size aFrmSize;
+ SwWrtShell* pWrtSh;
+
+ BOOL bFormat;
+ BOOL bNew;
+ BOOL bHtmlMode;
+ BOOL bDrawMode;
+ BOOL bContourImage;
+
+ SwWrapTabPage(Window *pParent, const SfxItemSet &rSet);
+ ~SwWrapTabPage();
+
+ void ApplyImageList();
+ void EnableModes(const SfxItemSet& rSet);
+ virtual void ActivatePage(const SfxItemSet& rSet);
+ virtual int DeactivatePage(SfxItemSet *pSet);
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ DECL_LINK( RangeModifyHdl, MetricField * );
+ DECL_LINK( WrapTypeHdl, ImageRadioButton * );
+ DECL_LINK( ContourHdl, CheckBox * );
+
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+
+public:
+
+ static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
+
+ virtual BOOL FillItemSet(SfxItemSet &rSet);
+ virtual void Reset(const SfxItemSet &rSet);
+
+ static USHORT* GetRanges();
+ inline void SetNewFrame(BOOL bNewFrame) { bNew = bNewFrame; }
+ inline void SetFormatUsed(BOOL bFmt, BOOL bDrw) { bFormat = bFmt;
+ bDrawMode = bDrw; }
+ inline void SetShell(SwWrtShell* pSh) { pWrtSh = pSh; }
+};
+
+#endif
+
+
diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx
new file mode 100644
index 000000000000..20d057ecf05a
--- /dev/null
+++ b/sw/source/ui/inc/wrtsh.hxx
@@ -0,0 +1,650 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _WRTSH_HXX
+#define _WRTSH_HXX
+
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include "swdllapi.h"
+#include <fesh.hxx>
+#include <sortopt.hxx>
+#include <swurl.hxx>
+#include <IMark.hxx>
+
+class Window;
+class OutputDevice;
+class SbxArray;
+class SwDoc;
+class SpellCheck;
+class SwViewOption;
+class SwFlyFrmAttrMgr;
+class SwField;
+class SwTOXBase;
+class SdrView;
+class SwView;
+class SvGlobalName;
+class SwInputFieldList;
+class SwSectionData;
+class Timer;
+class SvxMacro;
+class SwFmtINetFmt;
+class SvxINetBookmark;
+class SvxAutoCorrect;
+class NaviContentBookmark;
+struct SwCallMouseEvent;
+class DropEvent;
+struct ChartSelectionInfo;
+class SfxStringListItem;
+class SfxRequest;
+
+namespace com { namespace sun { namespace star { namespace util {
+ struct SearchOptions;
+} } } }
+
+
+typedef sal_Int32 SelectionType;
+namespace nsSelectionType
+{
+ const SelectionType SEL_TXT = CNT_TXT; // Text, niemals auch Rahmen 0x0001
+ const SelectionType SEL_GRF = CNT_GRF; // Grafik 0x0002
+ const SelectionType SEL_OLE = CNT_OLE; // OLE 0x0010
+ const SelectionType SEL_FRM = 0x000020; // Rahmen, keine Inhaltsform
+ const SelectionType SEL_NUM = 0x000040; // NumListe
+ const SelectionType SEL_TBL = 0x000080; // Cursor steht in Tabelle
+ const SelectionType SEL_TBL_CELLS = 0x000100; // Tabellenzellen sind selektiert
+ const SelectionType SEL_DRW = 0x000200; // Zeichenobjekte (Rechteck, Kreis...)
+ const SelectionType SEL_DRW_TXT = 0x000400; // Draw-Textobjekte im Editmode
+ const SelectionType SEL_BEZ = 0x000800; // Bezierobjekte editieren
+ const SelectionType SEL_DRW_FORM = 0x001000; // Zeichenobjekte: DB-Forms
+ const SelectionType SEL_FOC_FRM_CTRL = 0x002000; // a form control is focused. Neither set nor evaluated by the SwWrtShell itself, only by it's clients.
+ const SelectionType SEL_MEDIA = 0x004000; // Media object
+ const SelectionType SEL_EXTRUDED_CUSTOMSHAPE = 0x008000; // extruded custom shape
+ const SelectionType SEL_FONTWORK = 0x010000; // fontwork
+ const SelectionType SEL_POSTIT = 0x020000; //annotation
+}
+
+
+class SW_DLLPUBLIC SwWrtShell: public SwFEShell
+{
+private:
+ using SwCrsrShell::Left;
+ using SwCrsrShell::Right;
+ using SwCrsrShell::Up;
+ using SwCrsrShell::Down;
+ using SwCrsrShell::LeftMargin;
+ using SwCrsrShell::RightMargin;
+ using SwCrsrShell::SelectTxtAttr;
+ using SwCrsrShell::GotoPage;
+ using SwFEShell::InsertObject;
+ using SwEditShell::AutoCorrect;
+ using SwCrsrShell::GotoMark;
+
+public:
+
+ using SwEditShell::Insert;
+
+ typedef long (SwWrtShell::*SELECTFUNC)(const Point *, BOOL bProp );
+
+ SELECTFUNC fnDrag;
+ SELECTFUNC fnSetCrsr;
+ SELECTFUNC fnEndDrag;
+ SELECTFUNC fnKillSel;
+
+ // Alle Selektionen aufheben
+ long ResetSelect( const Point *, BOOL );
+
+ //setzt den Cursorstack nach dem Bewegen mit PageUp/-Down
+ //zurueck, falls ein Stack aufgebaut ist
+ inline void ResetCursorStack();
+ SelectionType GetSelectionType() const;
+
+ BOOL IsModePushed() const { return 0 != pModeStack; }
+ void PushMode();
+ void PopMode();
+
+ void SttSelect();
+ void EndSelect();
+ BOOL IsInSelect() const { return bInSelect; }
+ void SetInSelect(BOOL bSel = TRUE) { bInSelect = bSel; }
+ // Liegt eine Text- oder Rahmenselektion vor?
+ BOOL HasSelection() const { return SwCrsrShell::HasSelection() ||
+ IsMultiSelection() || IsSelFrmMode() || IsObjSelected(); }
+ BOOL Pop( BOOL bOldCrsr = TRUE );
+
+ void EnterStdMode();
+ BOOL IsStdMode() const { return !bExtMode && !bAddMode && !bBlockMode; }
+
+ void EnterExtMode();
+ void LeaveExtMode();
+ long ToggleExtMode();
+ BOOL IsExtMode() const { return bExtMode; }
+
+ void EnterAddMode();
+ void LeaveAddMode();
+ long ToggleAddMode();
+ BOOL IsAddMode() const { return bAddMode; }
+
+ void EnterBlockMode();
+ void LeaveBlockMode();
+ long ToggleBlockMode();
+ BOOL IsBlockMode() const { return bBlockMode; }
+
+ void SetInsMode( BOOL bOn = TRUE );
+ void ToggleInsMode() { SetInsMode( !bIns ); }
+ BOOL IsInsMode() const { return bIns; }
+ void SetRedlineModeAndCheckInsMode( USHORT eMode );
+
+ void EnterSelFrmMode(const Point *pStartDrag = 0);
+ void LeaveSelFrmMode();
+ BOOL IsSelFrmMode() const { return bLayoutMode; }
+ // Selektion von Rahmen aufheben
+ void UnSelectFrm();
+
+ void Invalidate();
+
+ // Tabellenzellen selektieren fuer Bearbeiten von Formeln in der Ribbonbar
+ inline void SelTblCells( const Link &rLink, BOOL bMark = TRUE );
+ inline void EndSelTblCells();
+
+ //Wortweisen oder zeilenweisen Selektionsmodus verlassen. Wird
+ //in der Regel in MB-Up gerufen.
+ BOOL IsExtSel() const { return bSelWrd || bSelLn; }
+
+ // erfrage, ob der akt. fnDrag - Pointer auf BeginDrag gesetzt ist
+ // Wird fuer MouseMove gebraucht, um die Bugs 55592/55931 zu umgehen.
+ inline BOOL Is_FnDragEQBeginDrag() const;
+
+ //Basisabfragen
+ BOOL IsInWrd() { return IsInWord(); }
+ BOOL IsSttWrd() { return IsStartWord(); }
+ BOOL IsEndWrd();
+ BOOL IsSttOfPara() const { return IsSttPara(); }
+ BOOL IsEndOfPara() const { return IsEndPara(); }
+
+ //Word bzw. Satz selektieren.
+ BOOL SelNearestWrd();
+ BOOL SelWrd (const Point * = 0, BOOL bProp=FALSE );
+ // --> FME 2004-07-30 #i32329# Enhanced selection
+ void SelSentence (const Point * = 0, BOOL bProp=FALSE );
+ void SelPara (const Point * = 0, BOOL bProp=FALSE );
+ // <--
+ long SelAll();
+
+ //Basiscursortravelling
+typedef BOOL (SwWrtShell:: *FNSimpleMove)();
+ BOOL SimpleMove( FNSimpleMove, BOOL bSelect );
+
+ BOOL Left ( USHORT nMode, BOOL bSelect,
+ USHORT nCount, BOOL bBasicCall, BOOL bVisual = FALSE );
+ BOOL Right ( USHORT nMode, BOOL bSelect,
+ USHORT nCount, BOOL bBasicCall, BOOL bVisual = FALSE );
+ BOOL Up ( BOOL bSelect = FALSE, USHORT nCount = 1,
+ BOOL bBasicCall = FALSE );
+ BOOL Down ( BOOL bSelect = FALSE, USHORT nCount = 1,
+ BOOL bBasicCall = FALSE );
+ BOOL NxtWrd ( BOOL bSelect = FALSE ) { return SimpleMove( &SwWrtShell::_NxtWrd, bSelect ); }
+ BOOL PrvWrd ( BOOL bSelect = FALSE ) { return SimpleMove( &SwWrtShell::_PrvWrd, bSelect ); }
+
+ BOOL LeftMargin ( BOOL bSelect, BOOL bBasicCall );
+ BOOL RightMargin( BOOL bSelect, BOOL bBasicCall );
+
+ BOOL SttDoc ( BOOL bSelect = FALSE );
+ BOOL EndDoc ( BOOL bSelect = FALSE );
+
+ BOOL SttNxtPg ( BOOL bSelect = FALSE );
+ BOOL SttPrvPg ( BOOL bSelect = FALSE );
+ BOOL EndNxtPg ( BOOL bSelect = FALSE );
+ BOOL EndPrvPg ( BOOL bSelect = FALSE );
+ BOOL SttPg ( BOOL bSelect = FALSE );
+ BOOL EndPg ( BOOL bSelect = FALSE );
+ BOOL SttPara ( BOOL bSelect = FALSE );
+ BOOL EndPara ( BOOL bSelect = FALSE );
+ BOOL FwdPara ( BOOL bSelect = FALSE )
+ { return SimpleMove( &SwWrtShell::_FwdPara, bSelect ); }
+ BOOL BwdPara ( BOOL bSelect = FALSE )
+ { return SimpleMove( &SwWrtShell::_BwdPara, bSelect ); }
+ BOOL FwdSentence( BOOL bSelect = FALSE )
+ { return SimpleMove( &SwWrtShell::_FwdSentence, bSelect ); }
+ BOOL BwdSentence( BOOL bSelect = FALSE )
+ { return SimpleMove( &SwWrtShell::_BwdSentence, bSelect ); }
+
+ // --> FME 2004-07-30 #i20126# Enhanced table selection
+ BOOL SelectTableRowCol( const Point& rPt, const Point* pEnd = 0, bool bRowDrag = false );
+ // <--
+ BOOL SelectTableRow();
+ BOOL SelectTableCol();
+ BOOL SelectTableCell();
+
+ BOOL SelectTxtAttr( USHORT nWhich, const SwTxtAttr* pAttr = 0 );
+
+ // Spaltenweise Spruenge
+ BOOL StartOfColumn ( BOOL bSelect = FALSE );
+ BOOL EndOfColumn ( BOOL bSelect = FALSE );
+ BOOL StartOfNextColumn ( BOOL bSelect = FALSE );
+ BOOL EndOfNextColumn ( BOOL bSelect = FALSE );
+ BOOL StartOfPrevColumn ( BOOL bSelect = FALSE );
+ BOOL EndOfPrevColumn ( BOOL bSelect = FALSE );
+
+ // setze den Cursor auf die Seite "nPage" an den Anfang
+ // zusaetzlich zu der gleichnamigen Implementierung in crsrsh.hxx
+ // werden hier alle bestehenden Selektionen vor dem Setzen des
+ // Cursors aufgehoben
+ BOOL GotoPage( USHORT nPage, BOOL bRecord );
+
+ //setzen des Cursors; merken der alten Position fuer Zurueckblaettern.
+ DECL_LINK( ExecFlyMac, void * );
+
+ BOOL PageCrsr(SwTwips lOffset, BOOL bSelect);
+
+ // Felder Update
+ void UpdateInputFlds( SwInputFieldList* pLst = 0, BOOL bOnlyInSel = FALSE );
+
+ void NoEdit(BOOL bHideCrsr = TRUE);
+ void Edit();
+ BOOL IsNoEdit() const { return bNoEdit; }
+
+ BOOL IsRetainSelection() const { return mbRetainSelection; }
+ void SetRetainSelection( BOOL bRet ) { mbRetainSelection = bRet; }
+
+ // change current data base and notify
+ void ChgDBData(const SwDBData& SwDBData);
+
+ // Loeschen
+ long DelToEndOfLine();
+ long DelToStartOfLine();
+ long DelLine();
+ long DelLeft();
+
+ // loescht auch Rahmen bzw. setzt den Cursor in den Rahmen,
+ // wenn bDelFrm == FALSE ist
+ long DelRight();
+ long DelToEndOfPara();
+ long DelToStartOfPara();
+ long DelToEndOfSentence();
+ long DelToStartOfSentence();
+ long DelNxtWord();
+ long DelPrvWord();
+
+ // Prueft, ob eine Wortselektion vorliegt.
+ // Gemaess den Regeln fuer intelligentes Cut / Paste
+ // werden umgebende Spaces rausgeschnitten.
+ // Liefert Art der Wortselektion zurueck (siehe enum)
+ enum word {
+ NO_WORD = 0,
+ WORD_SPACE_BEFORE = 1,
+ WORD_SPACE_AFTER = 2,
+ WORD_NO_SPACE = 3
+ };
+ int IntelligentCut(int nSelectionType, BOOL bCut = TRUE);
+
+ // Editieren
+ void Insert(SwField &);
+ void Insert(const String &);
+ // Graphic
+ void Insert( const String &rPath, const String &rFilter,
+ const Graphic &, SwFlyFrmAttrMgr * = 0,
+ BOOL bRule = FALSE );
+
+ void InsertByWord( const String & );
+ void InsertPageBreak(const String *pPageDesc = 0, USHORT nPgNum = 0 );
+ void InsertLineBreak();
+ void InsertColumnBreak();
+ void InsertFootnote(const String &, BOOL bEndNote = FALSE, BOOL bEdit = TRUE );
+ void SplitNode( BOOL bAutoFormat = FALSE, BOOL bCheckTableStart = TRUE );
+ BOOL CanInsert();
+
+ // Verzeichnisse
+ void InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
+ BOOL UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet = 0);
+
+ // Numerierung und Bullets
+ /**
+ Turns on numbering or bullets.
+
+ @param bNum TRUE: turn on numbering
+ FALSE: turn on bullets
+ */
+ void NumOrBulletOn(BOOL bNum); // #i29560#
+ void NumOrBulletOff(); // #i29560#
+ void NumOn();
+ void BulletOn();
+
+ //OLE
+ void InsertObject( /*SvInPlaceObjectRef *pObj, */ // != 0 fuer Clipboard
+ const svt::EmbeddedObjectRef&,
+ SvGlobalName *pName = 0, // != 0 entspr. Object erzeugen.
+ BOOL bActivate = TRUE,
+ USHORT nSlotId = 0); // SlotId fuer Dialog
+
+ BOOL InsertOleObject( const svt::EmbeddedObjectRef& xObj, SwFlyFrmFmt **pFlyFrmFmt = 0 );
+ void LaunchOLEObj( long nVerb = 0 ); // Server starten
+ BOOL IsOLEObj() const { return GetCntType() == CNT_OLE;}
+ virtual void MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset );
+ virtual void CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
+ const SwRect *pFlyPrtRect = 0,
+ const SwRect *pFlyFrmRect = 0 );
+ virtual void ConnectObj( svt::EmbeddedObjectRef& xIPObj, const SwRect &rPrt,
+ const SwRect &rFrm );
+
+ // Vorlagen und Formate
+
+ // enum gibt an, was geschehen soll, wenn das Style nicht gefunden wurde
+ enum GetStyle { GETSTYLE_NOCREATE, // keins anlegen
+ GETSTYLE_CREATESOME, // falls auf PoolId mapt anlegen
+ GETSTYLE_CREATEANY }; // ggfs Standard returnen
+
+ SwTxtFmtColl* GetParaStyle(const String &rCollName,
+ GetStyle eCreate = GETSTYLE_NOCREATE);
+ SwCharFmt* GetCharStyle(const String &rFmtName,
+ GetStyle eCreate = GETSTYLE_NOCREATE);
+ SwFrmFmt* GetTblStyle(const String &rFmtName);
+
+ void SetPageStyle(const String &rCollName);
+
+ String GetCurPageStyle( const BOOL bCalcFrm = TRUE ) const;
+
+ // Aktuelle Vorlage anhand der geltenden Attribute aendern
+ void QuickUpdateStyle();
+
+ enum DoType { UNDO, REDO, REPEAT };
+
+ void Do( DoType eDoType, USHORT nCnt = 1 );
+ String GetDoString( DoType eDoType ) const;
+ String GetRepeatString() const;
+ USHORT GetDoStrings( DoType eDoType, SfxStringListItem& rStrLstItem ) const;
+
+ //Suchen oder Ersetzen
+ ULONG SearchPattern(const com::sun::star::util::SearchOptions& rSearchOpt,
+ BOOL bSearchInNotes,
+ SwDocPositions eStart, SwDocPositions eEnde,
+ FindRanges eFlags = FND_IN_BODY,
+ int bReplace = FALSE );
+
+ ULONG SearchTempl (const String &rTempl,
+ SwDocPositions eStart, SwDocPositions eEnde,
+ FindRanges eFlags = FND_IN_BODY,
+ const String* pReplTempl = 0 );
+
+ ULONG SearchAttr (const SfxItemSet& rFindSet,
+ BOOL bNoColls,
+ SwDocPositions eStart,SwDocPositions eEnde,
+ FindRanges eFlags = FND_IN_BODY,
+ const com::sun::star::util::SearchOptions* pSearchOpt = 0,
+ const SfxItemSet* pReplaceSet = 0);
+
+ void AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar = ' ' );
+
+ // Aktion vor Cursorbewegung
+ // Hebt gfs. Selektionen auf, triggert Timer und GCAttr()
+ void MoveCrsr( BOOL bWithSelect = FALSE );
+
+ // Eingabefelder updaten
+ BOOL StartInputFldDlg(SwField*, BOOL bNextButton, Window* pParentWin = 0, ByteString* pWindowState = 0);
+ // update DropDown fields
+ BOOL StartDropDownFldDlg(SwField*, BOOL bNextButton, ByteString* pWindowState = 0);
+
+ //"Handler" fuer Anederungen an der DrawView - fuer Controls.
+ virtual void DrawSelChanged( );
+
+ // springe zum Bookmark und setze die "Selections-Flags" wieder richtig
+ BOOL GotoMark( const ::sw::mark::IMark* const pMark );
+ BOOL GotoMark( const ::sw::mark::IMark* const pMark, BOOL bSelect, BOOL bStart );
+ BOOL GotoMark( const ::rtl::OUString& rName );
+ BOOL GoNextBookmark(); // TRUE, wenn's noch eine gab
+ BOOL GoPrevBookmark();
+
+ bool GotoFieldmark(::sw::mark::IFieldmark const * const pMark);
+
+ BOOL GotoField( const SwFmtFld& rFld );
+
+ // jump to the next / previous hyperlink - inside text and also
+ // on graphics
+ BOOL SelectNextPrevHyperlink( BOOL bNext = TRUE );
+
+ // Zugehoerige SwView ermitteln
+ const SwView& GetView() const { return rView; }
+ SwView& GetView() { return rView; }
+
+ //Weil es sonst keiner macht, gibt es hier eine ExecMacro()
+ void ExecMacro( const SvxMacro& rMacro, String* pRet = 0, SbxArray* pArgs = 0 );
+ // rufe ins dunkle Basic/JavaScript
+ USHORT CallEvent( USHORT nEvent, const SwCallMouseEvent& rCallEvent,
+ BOOL bCheckPtr = FALSE, SbxArray* pArgs = 0,
+ const Link* pCallBack = 0 );
+
+ // ein Klick aus das angegebene Feld. Der Cursor steht auf diesem.
+ // Fuehre die vor definierten Aktionen aus.
+ void ClickToField( const SwField& rFld );
+ void ClickToINetAttr( const SwFmtINetFmt& rItem, USHORT nFilter = URLLOAD_NOFILTER );
+ BOOL ClickToINetGrf( const Point& rDocPt, USHORT nFilter = URLLOAD_NOFILTER );
+ inline BOOL IsInClickToEdit() const ;
+
+ // fall ein URL-Button selektiert ist, dessen URL returnen, ansonsten
+ // einen LeerString
+ BOOL GetURLFromButton( String& rURL, String& rDescr ) const;
+
+ void NavigatorPaste( const NaviContentBookmark& rBkmk,
+ const USHORT nAction );
+
+ // die Core erzeugt eine Selektion, das SttSelect muss gerufen werden
+ virtual void NewCoreSelection();
+
+ // autom. Update von Vorlagen
+ void AutoUpdateFrame(SwFrmFmt* pFmt, const SfxItemSet& rStyleSet);
+ void AutoUpdatePara(SwTxtFmtColl* pColl, const SfxItemSet& rStyleSet);
+
+ // Link fuers einfuegen von Bereichen uebers Drag&Drop/Clipboard
+ DECL_STATIC_LINK( SwWrtShell, InsertRegionDialog, SwSectionData* );
+
+
+ //ctoren, der erstere ist eine Art kontrollierter copy ctor fuer weitere
+ //Sichten auf ein Dokument
+ SwWrtShell( SwWrtShell&, Window *pWin, SwView &rShell);
+ SwWrtShell( SwDoc& rDoc, Window *pWin, SwView &rShell,
+ const SwViewOption *pViewOpt = 0);
+ virtual ~SwWrtShell();
+
+ BOOL TryRemoveIndent(); // #i23725#
+
+ String GetSelDescr() const;
+
+private:
+
+ SW_DLLPRIVATE void OpenMark();
+ SW_DLLPRIVATE void CloseMark( BOOL bOkFlag );
+
+ SW_DLLPRIVATE String GetWrdDelim();
+ SW_DLLPRIVATE String GetSDelim();
+ SW_DLLPRIVATE String GetBothDelim();
+
+ struct ModeStack
+ {
+ ModeStack *pNext;
+ BOOL bAdd,
+ bBlock,
+ bExt,
+ bIns;
+ ModeStack(ModeStack *pNextMode, BOOL _bIns, BOOL _bExt, BOOL _bAdd, BOOL _bBlock):
+ pNext(pNextMode),
+ bAdd(_bAdd),
+ bBlock(_bBlock),
+ bExt(_bExt),
+ bIns(_bIns)
+ {}
+ } *pModeStack;
+
+ // Cursor bei PageUp / -Down mitnehmen
+ enum PageMove
+ {
+ MV_NO,
+ MV_PAGE_UP,
+ MV_PAGE_DOWN
+ } ePageMove;
+
+ struct CrsrStack
+ {
+ Point aDocPos;
+ CrsrStack *pNext;
+ BOOL bValidCurPos : 1;
+ BOOL bIsFrmSel : 1;
+ SwTwips lOffset;
+
+ CrsrStack( BOOL bValid, BOOL bFrmSel, const Point &rDocPos,
+ SwTwips lOff, CrsrStack *pN )
+ : aDocPos(rDocPos),
+ pNext(pN),
+ bValidCurPos( bValid ),
+ bIsFrmSel( bFrmSel ),
+ lOffset(lOff)
+ {
+
+
+ }
+
+ } *pCrsrStack;
+
+ SwView &rView;
+
+ Point aDest;
+ BOOL bDestOnStack;
+ BOOL HasCrsrStack() const { return 0 != pCrsrStack; }
+ SW_DLLPRIVATE BOOL PushCrsr(SwTwips lOffset, BOOL bSelect);
+ SW_DLLPRIVATE BOOL PopCrsr(BOOL bUpdate, BOOL bSelect = FALSE);
+
+ // ENDE Cursor bei PageUp / -Down mitnehmen
+ SW_DLLPRIVATE BOOL _SttWrd();
+ SW_DLLPRIVATE BOOL _EndWrd();
+ SW_DLLPRIVATE BOOL _NxtWrd();
+ SW_DLLPRIVATE BOOL _PrvWrd();
+ // --> OD 2008-08-06 #i92468#
+ SW_DLLPRIVATE BOOL _NxtWrdForDelete();
+ SW_DLLPRIVATE BOOL _PrvWrdForDelete();
+ // <--
+ SW_DLLPRIVATE BOOL _FwdSentence();
+ SW_DLLPRIVATE BOOL _BwdSentence();
+ BOOL _FwdPara();
+ SW_DLLPRIVATE BOOL _BwdPara();
+
+ // Selektionen
+ BOOL bIns :1;
+ BOOL bInSelect :1;
+ BOOL bExtMode :1;
+ BOOL bAddMode :1;
+ BOOL bBlockMode :1;
+ BOOL bLayoutMode :1;
+ BOOL bNoEdit :1;
+ BOOL bCopy :1;
+ BOOL bSelWrd :1;
+ BOOL bSelLn :1;
+ BOOL bIsInClickToEdit:1;
+ BOOL bClearMark :1; // Selektion fuer ChartAutoPilot nicht loeschen
+ BOOL mbRetainSelection :1; // Do not remove selections
+
+ Point aStart;
+ Link aSelTblLink;
+
+ SELECTFUNC fnLeaveSelect;
+
+ //setzt den Cursorstack nach dem Bewegen mit PageUp/-Down zurueck.
+ SW_DLLPRIVATE void _ResetCursorStack();
+
+ SW_DLLPRIVATE void SttDragDrop(Timer *);
+
+ using SwCrsrShell::SetCrsr;
+ SW_DLLPRIVATE long SetCrsr(const Point *, BOOL bProp=FALSE );
+
+ SW_DLLPRIVATE long SetCrsrKillSel(const Point *, BOOL bProp=FALSE );
+
+ SW_DLLPRIVATE long StdSelect(const Point *, BOOL bProp=FALSE );
+ SW_DLLPRIVATE long BeginDrag(const Point *, BOOL bProp=FALSE );
+ SW_DLLPRIVATE long Drag(const Point *, BOOL bProp=FALSE );
+ SW_DLLPRIVATE long EndDrag(const Point *, BOOL bProp=FALSE );
+
+ SW_DLLPRIVATE long ExtSelWrd(const Point *, BOOL bProp=FALSE );
+ SW_DLLPRIVATE long ExtSelLn(const Point *, BOOL bProp=FALSE );
+
+ //Verschieben von Text aus Drag and Drop; Point ist
+ //Destination fuer alle Selektionen.
+ SW_DLLPRIVATE long MoveText(const Point *, BOOL bProp=FALSE );
+
+ SW_DLLPRIVATE long BeginFrmDrag(const Point *, BOOL bProp=FALSE );
+
+ //nach SSize/Move eines Frames Update; Point ist Destination.
+ SW_DLLPRIVATE long UpdateLayoutFrm(const Point *, BOOL bProp=FALSE );
+
+ SW_DLLPRIVATE long SttLeaveSelect(const Point *, BOOL bProp=FALSE );
+ SW_DLLPRIVATE long AddLeaveSelect(const Point *, BOOL bProp=FALSE );
+ SW_DLLPRIVATE long Ignore(const Point *, BOOL bProp=FALSE );
+
+ SW_DLLPRIVATE void LeaveExtSel() { bSelWrd = bSelLn = FALSE;}
+ SW_DLLPRIVATE BOOL _CanInsert();
+
+ SW_DLLPRIVATE BOOL GoStart(BOOL KeepArea = FALSE, BOOL * = 0,
+ BOOL bSelect = FALSE, BOOL bDontMoveRegion = FALSE);
+ SW_DLLPRIVATE BOOL GoEnd(BOOL KeepArea = FALSE, BOOL * = 0);
+
+ enum BookMarkMove
+ {
+ BOOKMARK_INDEX,
+ BOOKMARK_NEXT,
+ BOOKMARK_PREV,
+ BOOKMARK_LAST_LAST_ENTRY
+ };
+
+ SW_DLLPRIVATE BOOL MoveBookMark(BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark=NULL);
+};
+
+inline void SwWrtShell::ResetCursorStack()
+{
+ if ( HasCrsrStack() )
+ _ResetCursorStack();
+}
+
+inline void SwWrtShell::SelTblCells(const Link &rLink, BOOL bMark )
+{
+ SetSelTblCells( TRUE );
+ bClearMark = bMark;
+ aSelTblLink = rLink;
+}
+inline void SwWrtShell::EndSelTblCells()
+{
+ SetSelTblCells( FALSE );
+ bClearMark = TRUE;
+}
+
+inline BOOL SwWrtShell::IsInClickToEdit() const { return bIsInClickToEdit; }
+
+inline BOOL SwWrtShell::Is_FnDragEQBeginDrag() const
+{
+#ifdef GCC
+ SELECTFUNC fnTmp = &SwWrtShell::BeginDrag;
+ return fnDrag == fnTmp;
+#else
+ return sal::static_int_cast< BOOL >(fnDrag == &SwWrtShell::BeginDrag);
+#endif
+}
+
+#endif
diff --git a/sw/source/ui/inc/wtabsh.hxx b/sw/source/ui/inc/wtabsh.hxx
new file mode 100644
index 000000000000..5ab809821de8
--- /dev/null
+++ b/sw/source/ui/inc/wtabsh.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWWTABSH_HXX
+#define _SWWTABSH_HXX
+
+#include "tabsh.hxx"
+
+class SwWebTableShell: public SwTableShell
+{
+public:
+ SFX_DECL_INTERFACE(SW_WEBTABSHELL)
+ TYPEINFO();
+
+ virtual ~SwWebTableShell();
+ SwWebTableShell(SwView &rView);
+};
+
+#endif
diff --git a/sw/source/ui/inc/wtextsh.hxx b/sw/source/ui/inc/wtextsh.hxx
new file mode 100644
index 000000000000..cc03de602400
--- /dev/null
+++ b/sw/source/ui/inc/wtextsh.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SWWTEXTSH_HXX
+#define _SWWTEXTSH_HXX
+
+#include "textsh.hxx"
+
+
+class SwWebTextShell: public SwTextShell
+{
+
+public:
+ SFX_DECL_INTERFACE(SW_WEBTEXTSHELL)
+ TYPEINFO();
+
+ SwWebTextShell(SwView &rView);
+ virtual ~SwWebTextShell();
+};
+
+#endif
+
+
+
diff --git a/sw/source/ui/inc/wview.hxx b/sw/source/ui/inc/wview.hxx
new file mode 100644
index 000000000000..2b36bbf97dce
--- /dev/null
+++ b/sw/source/ui/inc/wview.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWWVIEW_HXX
+#define _SWWVIEW_HXX
+
+#include "swdllapi.h"
+#include "view.hxx"
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+class SW_DLLPUBLIC SwWebView: public SwView
+{
+protected:
+ virtual void SelectShell();
+public:
+
+ SFX_DECL_VIEWFACTORY(SwWebView);
+ SFX_DECL_INTERFACE(SW_WEBVIEWSHELL)
+ TYPEINFO();
+
+ SwWebView(SfxViewFrame* pFrame, SfxViewShell*);
+ ~SwWebView();
+};
+
+#endif
diff --git a/sw/source/ui/inc/zoomctrl.hxx b/sw/source/ui/inc/zoomctrl.hxx
new file mode 100644
index 000000000000..f2d1843828fb
--- /dev/null
+++ b/sw/source/ui/inc/zoomctrl.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _ZOOMCTRL_HXX
+#define _ZOOMCTRL_HXX
+
+#include <svx/zoomctrl.hxx>
+
+class SwZoomControl : public SvxZoomStatusBarControl
+{
+private:
+ String sPreviewZoom;
+public:
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual void StateChanged( USHORT nSID, SfxItemState eState,
+ const SfxPoolItem* pState );
+ virtual void Paint( const UserDrawEvent& rEvt );
+
+ SFX_DECL_STATUSBAR_CONTROL();
+
+ SwZoomControl( USHORT nSlotId, USHORT nId, StatusBar& rStb );
+ ~SwZoomControl();
+
+};
+
+
+#endif
+
+
diff --git a/sw/source/ui/index/cntex.cxx b/sw/source/ui/index/cntex.cxx
new file mode 100644
index 000000000000..40400f591753
--- /dev/null
+++ b/sw/source/ui/index/cntex.cxx
@@ -0,0 +1,516 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#include <rsc/rscsfx.hxx>
+#include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
+#include <com/sun/star/text/XDocumentIndex.hpp>
+#include <com/sun/star/text/XTextSectionsSupplier.hpp>
+#include <com/sun/star/style/BreakType.hpp>
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <com/sun/star/text/XDependentTextField.hpp>
+#include <com/sun/star/text/XParagraphCursor.hpp>
+#include <com/sun/star/text/XDocumentIndex.hpp>
+#include <com/sun/star/text/ChapterFormat.hpp>
+#include <com/sun/star/text/XTextSection.hpp>
+#include <com/sun/star/text/ControlCharacter.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <cnttab.hxx>
+#include <poolfmt.hxx>
+#include <unoprnms.hxx>
+#include <unotools.hxx>
+#include <unotxdoc.hxx>
+#include <docsh.hxx>
+#include <swmodule.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _UTLUI_HRC
+#include <utlui.hrc>
+#endif
+#ifndef _INDEX_HRC
+#include <index.hrc>
+#endif
+#ifndef _CNTTAB_HRC
+#include <cnttab.hrc>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <SwStyleNameMapper.hxx>
+#include <swuicnttab.hxx>
+#include <unomid.h>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ucb;
+using namespace ::com::sun::star::uno;
+using namespace com::sun::star::ui::dialogs;
+using ::rtl::OUString;
+
+
+#define INDEX_SECTION_NAME String::CreateFromAscii( \
+ RTL_CONSTASCII_STRINGPARAM( "IndexSection_" ))
+
+#ifdef SW_PROP_NAME_STR
+#undef SW_PROP_NAME_STR
+#endif
+#define SW_PROP_NAME_STR(nId) SwGetPropName((nId)).pName
+
+/* -----------------04.11.99 11:28-------------------
+
+ --------------------------------------------------*/
+void lcl_SetProp( uno::Reference< XPropertySetInfo > & xInfo,
+ uno::Reference< XPropertySet > & xProps,
+ const char* pPropName, const String& rValue)
+{
+ OUString uPropName(C2U(pPropName));
+ if(xInfo->hasPropertyByName(uPropName))
+ {
+ uno::Any aValue;
+ aValue <<= OUString(rValue);
+ xProps->setPropertyValue(uPropName, aValue);
+ }
+}
+void lcl_SetProp( uno::Reference< XPropertySetInfo > & xInfo,
+ uno::Reference< XPropertySet > & xProps,
+ USHORT nId, const String& rValue)
+{
+ lcl_SetProp( xInfo, xProps, SW_PROP_NAME_STR(nId), rValue);
+}
+void lcl_SetProp( uno::Reference< XPropertySetInfo > & xInfo,
+ uno::Reference< XPropertySet > & xProps,
+ USHORT nId, sal_Int16 nValue )
+{
+ OUString uPropName(C2U(SW_PROP_NAME_STR(nId)));
+ if(xInfo->hasPropertyByName(uPropName))
+ {
+ uno::Any aValue;
+ aValue <<= nValue;
+ xProps->setPropertyValue(uPropName, aValue);
+ }
+}
+
+void lcl_SetBOOLProp(
+ uno::Reference< beans::XPropertySetInfo > & xInfo,
+ uno::Reference< beans::XPropertySet > & xProps,
+ USHORT nId, sal_Bool bValue )
+{
+ OUString uPropName(C2U(SW_PROP_NAME_STR(nId)));
+ if(xInfo->hasPropertyByName(uPropName))
+ {
+ uno::Any aValue;
+ aValue.setValue(&bValue, ::getCppuBooleanType());
+ xProps->setPropertyValue(uPropName, aValue);
+ }
+}
+//-----------------------------------------------------------------------------
+IMPL_LINK( SwMultiTOXTabDialog, CreateExample_Hdl, void*, EMPTYARG )
+{
+ try
+ {
+ uno::Reference< frame::XModel > & xModel = pExampleFrame->GetModel();
+ uno::Reference< lang::XUnoTunnel > xDocTunnel(xModel, uno::UNO_QUERY);
+ SwXTextDocument* pDoc = reinterpret_cast<SwXTextDocument*>(xDocTunnel->getSomething(SwXTextDocument::getUnoTunnelId()));
+
+ if( pDoc )
+ pDoc->GetDocShell()->_LoadStyles( *rSh.GetView().GetDocShell(), TRUE );
+
+ uno::Reference< lang::XMultiServiceFactory > xFact(
+ xModel, uno::UNO_QUERY);
+
+ uno::Reference< text::XTextSectionsSupplier > xSectionSupplier(
+ xModel, uno::UNO_QUERY);
+ uno::Reference< container::XNameAccess > xSections =
+ xSectionSupplier->getTextSections();
+
+ String sSectionName( INDEX_SECTION_NAME );
+ for(int i = 0; i < 7; ++i )
+ {
+ String sTmp( sSectionName ); sTmp += String::CreateFromInt32(i);
+ uno::Any aSection = xSections->getByName( sTmp );
+ aSection >>= pxIndexSectionsArr[i]->xContainerSection;
+ }
+ uno::Reference< text::XDocumentIndexesSupplier > xIdxSupp(xModel, uno::UNO_QUERY);
+ uno::Reference< container::XIndexAccess > xIdxs = xIdxSupp->getDocumentIndexes();
+ int n = xIdxs->getCount();
+ while(n)
+ {
+ n--;
+ uno::Any aIdx = xIdxs->getByIndex(n);
+ uno::Reference< text::XDocumentIndex > xIdx;
+ aIdx >>= xIdx;
+ xIdx->dispose();
+ }
+ CreateOrUpdateExample(eCurrentTOXType.eType);
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("::CreateExample() - exception caught");
+ }
+ return 0;
+}
+
+/* --------------------------------------------------
+
+ --------------------------------------------------*/
+void SwMultiTOXTabDialog::CreateOrUpdateExample(
+ TOXTypes nTOXIndex, sal_uInt16 nPage, sal_uInt16 nCurrentLevel)
+{
+ if(!pExampleFrame || !pExampleFrame->IsInitialized())
+ return;
+
+ const char* __FAR_DATA IndexServiceNames[] =
+ {
+ "com.sun.star.text.DocumentIndex",
+ "com.sun.star.text.UserIndex",
+ "com.sun.star.text.ContentIndex",
+ "com.sun.star.text.IllustrationsIndex",
+ "com.sun.star.text.ObjectIndex",
+ "com.sun.star.text.TableIndex",
+ "com.sun.star.text.Bibliography"
+ };
+
+ try
+ {
+ DBG_ASSERT(pxIndexSectionsArr[nTOXIndex] &&
+ pxIndexSectionsArr[nTOXIndex]->xContainerSection.is(),
+ "Section not created");
+ uno::Reference< frame::XModel > & xModel = pExampleFrame->GetModel();
+ sal_Bool bInitialCreate = sal_True;
+ if(!pxIndexSectionsArr[nTOXIndex]->xDocumentIndex.is())
+ {
+ bInitialCreate = sal_True;
+ if(!pxIndexSectionsArr[nTOXIndex]->xContainerSection.is())
+ throw uno::RuntimeException();
+ uno::Reference< text::XTextRange > xAnchor = pxIndexSectionsArr[nTOXIndex]->xContainerSection->getAnchor();
+ xAnchor = xAnchor->getStart();
+ uno::Reference< text::XTextCursor > xCrsr = xAnchor->getText()->createTextCursorByRange(xAnchor);
+
+ uno::Reference< lang::XMultiServiceFactory > xFact(xModel, uno::UNO_QUERY);
+
+ String sIndexTypeName;
+ sIndexTypeName.AssignAscii( IndexServiceNames[
+ nTOXIndex <= TOX_AUTHORITIES ? nTOXIndex : TOX_USER] );
+ pxIndexSectionsArr[nTOXIndex]->xDocumentIndex = uno::Reference< text::XDocumentIndex > (xFact->createInstance(
+ sIndexTypeName), uno::UNO_QUERY);
+ uno::Reference< text::XTextContent > xContent(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
+ uno::Reference< text::XTextRange > xRg(xCrsr, uno::UNO_QUERY);
+ xCrsr->getText()->insertTextContent(xRg, xContent, sal_False);
+ }
+ OUString uIsVisible(C2U(SW_PROP_NAME_STR(UNO_NAME_IS_VISIBLE)));
+ for(sal_uInt16 i = 0 ; i <= TOX_AUTHORITIES; i++)
+ {
+ uno::Reference< beans::XPropertySet > xSectPr(pxIndexSectionsArr[i]->xContainerSection, uno::UNO_QUERY);
+ uno::Any aVal;
+
+ if(xSectPr.is())
+ {
+ BOOL bTemp = i == nTOXIndex;
+ aVal.setValue(&bTemp, ::getBooleanCppuType());
+ xSectPr->setPropertyValue(uIsVisible, aVal);
+ }
+ }
+ // set properties
+ uno::Reference< beans::XPropertySet > xIdxProps(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
+ uno::Reference< beans::XPropertySetInfo > xInfo = xIdxProps->getPropertySetInfo();
+ SwTOXDescription& rDesc = GetTOXDescription(eCurrentTOXType);
+ sal_uInt16 nIdxOptions = rDesc.GetIndexOptions();
+ if(bInitialCreate || !nPage || nPage == TOX_PAGE_SELECT)
+ {
+ //title
+ if(rDesc.GetTitle())
+ lcl_SetProp(xInfo, xIdxProps, UNO_NAME_TITLE, *rDesc.GetTitle());
+
+ //stylenames
+ sal_uInt16 nContentOptions = rDesc.GetContentOptions();
+ if(xInfo->hasPropertyByName(C2U(SW_PROP_NAME_STR(UNO_NAME_LEVEL_PARAGRAPH_STYLES))))
+ {
+ sal_Bool bOn = 0!=(nContentOptions&nsSwTOXElement::TOX_TEMPLATE );
+ uno::Any aStyleNames(xIdxProps->getPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LEVEL_PARAGRAPH_STYLES))));
+ uno::Reference< container::XIndexReplace > xAcc;
+ aStyleNames >>= xAcc;
+
+ for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
+ {
+ String sLevel;
+ if(bOn)
+ sLevel = rDesc.GetStyleNames(i);
+ sal_uInt16 nStyles = sLevel.GetTokenCount(TOX_STYLE_DELIMITER);
+ uno::Sequence<OUString> aStyles(nStyles);
+ OUString* pArr = aStyles.getArray();
+ for(sal_uInt16 nStyle = 0; nStyle < nStyles; nStyle++)
+ pArr[nStyle] = sLevel.GetToken(nStyle, TOX_STYLE_DELIMITER);
+ uno::Any aAny(&aStyles, ::getCppuType((uno::Sequence<OUString>*)0));
+ xAcc->replaceByIndex(i, aAny);
+ }
+ }
+ lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LEVEL, (sal_Int16)rDesc.GetLevel());
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_MARKS, 0!=(nContentOptions&nsSwTOXElement::TOX_MARK ));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_OUTLINE, 0!=(nContentOptions&nsSwTOXElement::TOX_OUTLINELEVEL));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_EMBEDDED_OBJECTS,0!=(nContentOptions&nsSwTOXElement::TOX_OLE ));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_TABLES , 0!=(nContentOptions&nsSwTOXElement::TOX_TABLE ));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_GRAPHIC_OBJECTS, 0!=(nContentOptions&nsSwTOXElement::TOX_GRAPHIC ));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_TEXT_FRAMES, 0!=(nContentOptions&nsSwTOXElement::TOX_FRAME ));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_LABELS, 0!=(nContentOptions&nsSwTOXElement::TOX_SEQUENCE ));
+
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_CHAPTER, rDesc.IsFromChapter());
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_PROTECTED, rDesc.IsReadonly());
+
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_COMBINED_ENTRIES, 0 != (nIdxOptions&nsSwTOIOptions::TOI_SAME_ENTRY ));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_P_P, 0 != (nIdxOptions&nsSwTOIOptions::TOI_FF ));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_CASE_SENSITIVE, 0 != (nIdxOptions&nsSwTOIOptions::TOI_CASE_SENSITIVE ));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_KEY_AS_ENTRY, 0 != (nIdxOptions&nsSwTOIOptions::TOI_KEY_AS_ENTRY ));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, 0 != (nIdxOptions&nsSwTOIOptions::TOI_ALPHA_DELIMITTER));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_DASH, 0 != (nIdxOptions&nsSwTOIOptions::TOI_DASH ));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_UPPER_CASE, 0 != (nIdxOptions&nsSwTOIOptions::TOI_INITIAL_CAPS ));
+
+ String aTmpName( SwStyleNameMapper::GetSpecialExtraProgName( rDesc.GetSequenceName() ) );
+ lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LABEL_CATEGORY, aTmpName );
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_LABELS, !rDesc.IsCreateFromObjectNames());
+
+ sal_Int16 nSet = text::ChapterFormat::NAME_NUMBER;
+ switch (rDesc.GetCaptionDisplay())
+ {
+ case CAPTION_COMPLETE: nSet = text::ChapterFormat::NAME_NUMBER;break;
+ case CAPTION_NUMBER : nSet = text::ChapterFormat::NUMBER; break;
+ case CAPTION_TEXT : nSet = text::ChapterFormat::NAME; break;
+ }
+ lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LABEL_DISPLAY_TYPE, nSet);
+
+ sal_uInt16 nOLEOptions = rDesc.GetOLEOptions();
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_MATH, 0 != (nsSwTOOElements::TOO_MATH &nOLEOptions ));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_CHART, 0 != (nsSwTOOElements::TOO_CHART &nOLEOptions ));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_CALC, 0 != (nsSwTOOElements::TOO_CALC &nOLEOptions ));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_STAR_DRAW, 0 != (nsSwTOOElements::TOO_DRAW_IMPRESS&nOLEOptions));
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_OTHER_EMBEDDED_OBJECTS, 0 != (nsSwTOOElements::TOO_OTHER|nOLEOptions ));
+
+ //lcl_SetBOOLProp(xInfo, xIdxProps, , rDesc.IsLevelFromChapter());
+ }
+ const SwForm* pForm = GetForm(eCurrentTOXType);
+ if(bInitialCreate || !nPage || nPage == TOX_PAGE_ENTRY)
+ {
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_COMMA_SEPARATED, pForm->IsCommaSeparated());
+ lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, 0 != (nIdxOptions&nsSwTOIOptions::TOI_ALPHA_DELIMITTER));
+ sal_uInt16 nStartLevel = USHRT_MAX;
+ sal_uInt16 nEndLevel = USHRT_MAX;
+ if(nCurrentLevel < pForm->GetFormMax())
+ nStartLevel = nEndLevel = nCurrentLevel;
+ else
+ {
+ nStartLevel = 0;
+ nEndLevel = pForm->GetFormMax() - 1;
+ }
+
+ if(xInfo->hasPropertyByName(C2U(SW_PROP_NAME_STR(UNO_NAME_LEVEL_FORMAT))))
+ {
+ for(sal_uInt16 nCurrLevel = nStartLevel; nCurrLevel <= nEndLevel; nCurrLevel++)
+ {
+ String sTokenType;
+ uno::Sequence< beans::PropertyValues> aSequPropVals(10);
+ long nTokenIndex = 0;
+ long nParamCount = 2;
+
+ // #i24377#
+ SwFormTokens aPattern = pForm->GetPattern(nCurrLevel);
+ SwFormTokens::iterator aIt = aPattern.begin();
+
+ while(aIt != aPattern.end())
+ {
+ if( aSequPropVals.getLength() <= nTokenIndex)
+ aSequPropVals.realloc(nTokenIndex + 10);
+
+ SwFormToken aToken = *aIt; // #i24377#
+ switch(aToken.eTokenType)
+ {
+ case TOKEN_ENTRY_NO :
+ sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
+ "TokenEntryNumber"));
+ // fuer Inhaltsverzeichnis Numerierung
+ break;
+ case TOKEN_ENTRY_TEXT :
+ case TOKEN_ENTRY :
+ sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
+ "TokenEntryText"));
+ break;
+ case TOKEN_TAB_STOP :
+ nParamCount += 3;
+ sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
+ "TokenTabStop"));
+ break;
+ case TOKEN_TEXT :
+ sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
+ "TokenText"));
+ nParamCount += 1;
+ break;
+ case TOKEN_PAGE_NUMS :
+ sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
+ "TokenPageNumber"));
+ break;
+ case TOKEN_CHAPTER_INFO :
+ sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
+ "TokenChapterInfo"));
+ break;
+ case TOKEN_LINK_START :
+ sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
+ "TokenHyperlinkStart"));
+ break;
+ case TOKEN_LINK_END :
+ sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
+ "TokenHyperlinkEnd"));
+ break;
+ case TOKEN_AUTHORITY :
+ {
+ sTokenType.AssignAscii(RTL_CONSTASCII_STRINGPARAM(
+ "TokenBibliographyDataField"));
+ }
+ break;
+ default:; //prevent warning
+ }
+ beans::PropertyValues aPropVals(nParamCount);
+ beans::PropertyValue* pPropValArr = aPropVals.getArray();
+ pPropValArr[0].Name = C2U("TokenType");
+ pPropValArr[0].Value <<= OUString(sTokenType);
+ pPropValArr[1].Name = C2U("CharacterStyleName");
+ pPropValArr[1].Value <<= OUString(aToken.sCharStyleName);
+ if(TOKEN_TAB_STOP == aToken.eTokenType)
+ {
+ pPropValArr[2].Name = C2U("TabStopRightAligned");
+ BOOL bTemp = SVX_TAB_ADJUST_END == aToken.eTabAlign;
+ pPropValArr[2].Value.setValue(&bTemp, ::getBooleanCppuType());
+ pPropValArr[3].Name = C2U("TabStopFillCharacter");
+ pPropValArr[3].Value <<= OUString(aToken.cTabFillChar);
+ pPropValArr[4].Name = C2U("TabStopPosition");
+ SwTwips nTempPos = aToken.nTabStopPosition >= 0 ?
+ aToken.nTabStopPosition : 0;
+ nTempPos = TWIP_TO_MM100(nTempPos);
+ pPropValArr[4].Value <<= (sal_Int32)nTempPos;
+ }
+ else if(TOKEN_TEXT == aToken.eTokenType)
+ {
+ pPropValArr[2].Name = C2U("Text");
+ pPropValArr[2].Value <<= OUString(aToken.sText);
+ }
+ beans::PropertyValues* pValues = aSequPropVals.getArray();
+ pValues[nTokenIndex] = aPropVals;
+ nTokenIndex++;
+
+ aIt++; // #i24377#
+ }
+ aSequPropVals.realloc(nTokenIndex);
+
+ uno::Any aFormatAccess = xIdxProps->getPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LEVEL_FORMAT)));
+ DBG_ASSERT(aFormatAccess.getValueType() == ::getCppuType((uno::Reference<container::XIndexReplace>*)0),
+ "wrong property type");
+
+
+ uno::Reference< container::XIndexReplace > xFormatAccess;
+ aFormatAccess >>= xFormatAccess;
+ uno::Any aLevelProp(&aSequPropVals, ::getCppuType((uno::Sequence<beans::PropertyValues>*)0));
+ xFormatAccess->replaceByIndex(nCurrLevel, aLevelProp);
+ }
+ }
+ }
+ if(bInitialCreate || !nPage || nPage == TOX_PAGE_STYLES)
+ {
+ lcl_SetProp(xInfo, xIdxProps, "ParaStyleHeading", pForm->GetTemplate(0));
+ sal_uInt16 nOffset = 0;
+ sal_uInt16 nEndLevel = 2;
+ switch(eCurrentTOXType.eType)
+ {
+ case TOX_INDEX:
+ {
+ nOffset = 1;
+ nEndLevel = 4;
+ lcl_SetProp(xInfo, xIdxProps, "ParaStyleSeparator", pForm->GetTemplate(1));
+ }
+ break;
+ case TOX_CONTENT :
+ nEndLevel = 11;
+ break;
+ default:; //prevent warning
+ }
+ for(sal_uInt16 i = 1; i < nEndLevel; i++)
+ {
+ String sPropName(C2S("ParaStyleLevel"));
+ sPropName += String::CreateFromInt32( i );
+ lcl_SetProp(xInfo,
+ xIdxProps,
+ ByteString(sPropName, RTL_TEXTENCODING_ASCII_US).GetBuffer(),
+ pForm->GetTemplate(i + nOffset));
+ }
+ }
+/*
+ const String& GetAutoMarkURL() const { return sAutoMarkURL;}
+ const String& GetMainEntryCharStyle() const {return sMainEntryCharStyle;}
+
+ String GetAuthBrackets() const {return sAuthBrackets;}
+ sal_Bool IsAuthSequence() const {return bIsAuthSequence;}
+ sal_Bool IsSortByDocument()const {return bSortByDocument ;}
+
+ SwTOXSortKey GetSortKey1() const {return eSortKey1;}
+ SwTOXSortKey GetSortKey2() const {return eSortKey2;}
+ SwTOXSortKey GetSortKey3() const {return eSortKey3;}
+*/
+ //
+ pxIndexSectionsArr[nTOXIndex]->xDocumentIndex->update();
+
+//#if OSL_DEBUG_LEVEL > 1
+// uno::Reference< frame::XStorable > xStor(xModel, uno::UNO_QUERY);
+// String sURL("file:///e|/temp/sw/idxexample.sdw");
+// uno::Sequence< beans::PropertyValue > aArgs(0);
+// xStor->storeToURL(S2U(sURL), aArgs);
+//#endif
+
+ }
+ catch(Exception&)
+ {
+ DBG_ERROR("::CreateExample() - exception caught");
+ }
+}
+
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
new file mode 100644
index 000000000000..a453a46988ee
--- /dev/null
+++ b/sw/source/ui/index/cnttab.cxx
@@ -0,0 +1,4525 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <rsc/rscsfx.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/help.hxx>
+#include <svl/stritem.hxx>
+#include <svl/urihelper.hxx>
+#include <unotools/pathoptions.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/docfile.hxx>
+#include <svx/dialogs.hrc>
+#include <svx/svxdlg.hxx>
+#include <svx/flagsdef.hxx>
+#include <svx/simptabl.hxx>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <svtools/indexentryres.hxx>
+#include <editeng/unolingu.hxx>
+#include <column.hxx>
+#include <fmtfsize.hxx>
+#include <shellio.hxx>
+#include <authfld.hxx>
+#include <swtypes.hxx>
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#ifndef _BASESH_HXX
+#include <basesh.hxx>
+#endif
+#include <outline.hxx>
+#include <cnttab.hxx>
+#include <swuicnttab.hxx>
+#include <formedt.hxx>
+#include <poolfmt.hxx>
+#ifndef _POOLFMT_HRC
+#include <poolfmt.hrc>
+#endif
+#include <uitool.hxx>
+#include <fmtcol.hxx>
+#include <fldbas.hxx>
+#include <expfld.hxx>
+#include <unotools.hxx>
+#include <unotxdoc.hxx>
+#include <docsh.hxx>
+#include <swmodule.hxx>
+#include <modcfg.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#ifndef _UTLUI_HRC
+#include <utlui.hrc>
+#endif
+#ifndef _INDEX_HRC
+#include <index.hrc>
+#endif
+#ifndef _CNTTAB_HRC
+#include <cnttab.hrc>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <SwStyleNameMapper.hxx>
+#include <sfx2/filedlghelper.hxx>
+#ifndef _TOXHLP_HXX
+#include <toxwrap.hxx>
+#endif
+#include <chpfld.hxx>
+
+#ifndef _UTLUI_HRC
+#include "utlui.hrc"
+#endif
+
+#include <sfx2/app.hxx>
+
+#include <unomid.h>
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace com::sun::star::ui::dialogs;
+using ::rtl::OUString;
+using namespace ::sfx2;
+#include <svtools/editbrowsebox.hxx>
+
+static const sal_Unicode aDeliStart = '['; //fuer die form
+static const sal_Unicode aDeliEnd = ']'; //fuer die form
+
+#define POS_GRF 0
+#define POS_OLE 1
+#define POS_TABLE 2
+#define POS_FRAME 3
+
+#define IDX_FILE_EXTENSION String::CreateFromAscii( \
+ RTL_CONSTASCII_STRINGPARAM( "*.sdi" ))
+
+
+/* -----------------14.06.99 13:10-------------------
+
+ --------------------------------------------------*/
+String lcl_CreateAutoMarkFileDlg( const String& rURL,
+ const String& rFileString, sal_Bool bOpen )
+{
+ String sRet;
+
+ FileDialogHelper aDlgHelper( bOpen ?
+ TemplateDescription::FILEOPEN_SIMPLE : TemplateDescription::FILESAVE_AUTOEXTENSION, 0 );
+ uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+
+ uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
+ String sCurFltr( IDX_FILE_EXTENSION );
+ xFltMgr->appendFilter( rFileString, sCurFltr );
+ xFltMgr->setCurrentFilter( rFileString ) ;
+
+ String& rLastSaveDir = (String&)SFX_APP()->GetLastSaveDirectory();
+ String sSaveDir = rLastSaveDir;
+
+ if( rURL.Len() )
+ xFP->setDisplayDirectory( rURL );
+ else
+ {
+ SvtPathOptions aPathOpt;
+ xFP->setDisplayDirectory( aPathOpt.GetUserConfigPath() );
+ }
+
+ if( aDlgHelper.Execute() == ERRCODE_NONE )
+ {
+ sRet = xFP->getFiles().getConstArray()[0];
+ }
+ rLastSaveDir = sSaveDir;
+ return sRet;
+}
+/* -----------------------------19.01.00 11:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+struct AutoMarkEntry
+{
+ String sSearch;
+ String sAlternative;
+ String sPrimKey;
+ String sSecKey;
+ String sComment;
+ sal_Bool bCase;
+ sal_Bool bWord;
+
+ AutoMarkEntry() :
+ bCase(sal_False),
+ bWord(sal_False){}
+};
+typedef AutoMarkEntry* AutoMarkEntryPtr;
+SV_DECL_PTRARR_DEL(AutoMarkEntryArr, AutoMarkEntryPtr, 0, 4)
+SV_IMPL_PTRARR(AutoMarkEntryArr, AutoMarkEntryPtr);
+
+typedef ::svt::EditBrowseBox SwEntryBrowseBox_Base;
+class SwEntryBrowseBox : public SwEntryBrowseBox_Base
+{
+ Edit aCellEdit;
+ ::svt::CheckBoxControl aCellCheckBox;
+
+ String sSearch;
+ String sAlternative;
+ String sPrimKey;
+ String sSecKey;
+ String sComment;
+ String sCaseSensitive;
+ String sWordOnly;
+ String sYes;
+ String sNo;
+
+ AutoMarkEntryArr aEntryArr;
+
+ ::svt::CellControllerRef xController;
+ ::svt::CellControllerRef xCheckController;
+
+ long nCurrentRow;
+ sal_Bool bModified;
+
+
+ void SetModified() {bModified = sal_True;}
+
+protected:
+ virtual sal_Bool SeekRow( long nRow );
+// virtual void PaintField( OutputDevice& rDev, const awt::Rectangle& rRect,
+// sal_uInt16 nColumnId ) const;
+ virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColId) const;
+ virtual void InitController(::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol);
+ virtual ::svt::CellController* GetController(long nRow, sal_uInt16 nCol);
+ virtual sal_Bool SaveModified();
+
+public:
+ SwEntryBrowseBox(Window* pParent, const ResId& rId,
+ BrowserMode nMode = 0 );
+ void ReadEntries(SvStream& rInStr);
+ void WriteEntries(SvStream& rOutStr);
+
+ sal_Bool IsModified()const;
+
+ virtual String GetCellText( long nRow, USHORT nColumn ) const;
+};
+
+class SwAutoMarkDlg_Impl : public ModalDialog
+{
+ OKButton aOKPB;
+ CancelButton aCancelPB;
+ HelpButton aHelpPB;
+
+ SwEntryBrowseBox aEntriesBB;
+ FixedLine aEntriesFL;
+
+ String sAutoMarkURL;
+ const String sAutoMarkType;
+
+ sal_Bool bCreateMode;
+
+ DECL_LINK(OkHdl, OKButton*);
+public:
+ SwAutoMarkDlg_Impl(Window* pParent, const String& rAutoMarkURL,
+ const String& rAutoMarkType, sal_Bool bCreate);
+ ~SwAutoMarkDlg_Impl();
+
+};
+/* -----------------04.11.99 11:02-------------------
+
+ --------------------------------------------------*/
+sal_uInt16 CurTOXType::GetFlatIndex() const
+{
+ sal_uInt16 nRet = static_cast< sal_uInt16 >(eType);
+ if(eType == TOX_USER && nIndex)
+ {
+ nRet = static_cast< sal_uInt16 >(TOX_AUTHORITIES + nIndex);
+ }
+ return nRet;
+}
+/*************************************************************************
+
+*************************************************************************/
+#define EDIT_MINWIDTH 15
+
+/* -----------------14.06.99 12:12-------------------
+
+ --------------------------------------------------*/
+SwMultiTOXTabDialog::SwMultiTOXTabDialog(Window* pParent, const SfxItemSet& rSet,
+ SwWrtShell &rShell,
+ SwTOXBase* pCurTOX,
+ sal_uInt16 nToxType, sal_Bool bGlobal) :
+ SfxTabDialog( pParent, SW_RES(DLG_MULTI_TOX), &rSet),
+ aExampleContainerWIN(this, SW_RES(WIN_EXAMPLE)),
+ aExampleWIN( &aExampleContainerWIN, 0 ),
+ aShowExampleCB( this, SW_RES(CB_SHOWEXAMPLE)),
+ pMgr( new SwTOXMgr( &rShell ) ),
+ rSh(rShell),
+ pExampleFrame(0),
+ pParamTOXBase(pCurTOX),
+ sUserDefinedIndex(SW_RES(ST_USERDEFINEDINDEX)),
+ nInitialTOXType(nToxType),
+
+ bEditTOX(sal_False),
+ bExampleCreated(sal_False),
+ bGlobalFlag(bGlobal)
+{
+ FreeResource();
+
+ aExampleWIN.SetPosSizePixel(aExampleContainerWIN.GetPosPixel(),
+ aExampleContainerWIN.GetSizePixel());
+
+ eCurrentTOXType.eType = TOX_CONTENT;
+ eCurrentTOXType.nIndex = 0;
+
+ sal_uInt16 nUserTypeCount = rSh.GetTOXTypeCount(TOX_USER);
+ nTypeCount = nUserTypeCount + 6;
+ pFormArr = new SwForm*[nTypeCount];
+ pDescArr = new SwTOXDescription*[nTypeCount];
+ pxIndexSectionsArr = new SwIndexSections_Impl*[nTypeCount];
+ //the standard user index is on position TOX_USER
+ //all user user indexes follow after position TOX_AUTHORITIES
+ if(pCurTOX)
+ {
+ bEditTOX = sal_True;
+ }
+ for(int i = nTypeCount - 1; i > -1; i--)
+ {
+ pFormArr[i] = 0;
+ pDescArr[i] = 0;
+ pxIndexSectionsArr[i] = new SwIndexSections_Impl;
+ if(pCurTOX)
+ {
+ eCurrentTOXType.eType = pCurTOX->GetType();
+ sal_uInt16 nArrayIndex = static_cast< sal_uInt16 >(eCurrentTOXType.eType);
+ if(eCurrentTOXType.eType == TOX_USER)
+ {
+ //which user type is it?
+ for(sal_uInt16 nUser = 0; nUser < nUserTypeCount; nUser++)
+ {
+ const SwTOXType* pTemp = rSh.GetTOXType(TOX_USER, nUser);
+ if(pCurTOX->GetTOXType() == pTemp)
+ {
+ eCurrentTOXType.nIndex = nUser;
+ nArrayIndex = static_cast< sal_uInt16 >(nUser > 0 ? TOX_AUTHORITIES + nUser : TOX_USER);
+ break;
+ }
+ }
+ }
+ pFormArr[nArrayIndex] = new SwForm(pCurTOX->GetTOXForm());
+ pDescArr[nArrayIndex] = CreateTOXDescFromTOXBase(pCurTOX);
+ if(TOX_AUTHORITIES == eCurrentTOXType.eType)
+ {
+ const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
+ rSh.GetFldType(RES_AUTHORITY, aEmptyStr);
+ if(pFType)
+ {
+ String sBrackets;
+ if(pFType->GetPrefix())
+ sBrackets += pFType->GetPrefix();
+ if(pFType->GetSuffix())
+ sBrackets += pFType->GetSuffix();
+ pDescArr[nArrayIndex]->SetAuthBrackets(sBrackets);
+ pDescArr[nArrayIndex]->SetAuthSequence(pFType->IsSequence());
+ }
+ else
+ {
+ pDescArr[nArrayIndex]->SetAuthBrackets(C2S("[]"));
+ }
+ }
+ }
+ }
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AddTabPage(TP_TOX_SELECT, SwTOXSelectTabPage::Create, 0);
+ AddTabPage(TP_TOX_STYLES, SwTOXStylesTabPage::Create, 0);
+ AddTabPage(TP_COLUMN, SwColumnPage::Create, 0);
+ AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
+ AddTabPage(TP_TOX_ENTRY, SwTOXEntryTabPage::Create, 0);
+ if(!pCurTOX)
+ SetCurPageId(TP_TOX_SELECT);
+
+ aShowExampleCB.SetClickHdl(LINK(this, SwMultiTOXTabDialog, ShowPreviewHdl));
+
+ aShowExampleCB.Check( SW_MOD()->GetModuleConfig()->IsShowIndexPreview());
+ SetViewAlign( WINDOWALIGN_LEFT );
+ // SetViewWindow does not work if the dialog is visible!
+
+ if(!aShowExampleCB.IsChecked())
+ SetViewWindow( &aExampleContainerWIN );
+
+ Point aOldPos = GetPosPixel();
+ ShowPreviewHdl(0);
+ Point aNewPos = GetPosPixel();
+ //72040: initial position may be left of the view - that has to be corrected
+ if(aNewPos.X() < 0)
+ SetPosPixel(aOldPos);
+}
+/*-- 14.06.99 13:11:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMultiTOXTabDialog::~SwMultiTOXTabDialog()
+{
+ SW_MOD()->GetModuleConfig()->SetShowIndexPreview(aShowExampleCB.IsChecked());
+
+ for(sal_uInt16 i = 0; i < nTypeCount; i++)
+ {
+ delete pFormArr[i];
+ delete pDescArr[i];
+ delete pxIndexSectionsArr[i];
+ }
+ delete[] pxIndexSectionsArr;
+
+ delete[] pFormArr;
+ delete[] pDescArr;
+ delete pMgr;
+ delete pExampleFrame;
+}
+/*-- 14.06.99 13:11:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwMultiTOXTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
+{
+ if( TP_BACKGROUND == nId )
+ {
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR));
+ rPage.PageCreated(aSet);
+ }
+ else if(TP_COLUMN == nId )
+ {
+ const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)GetInputSetImpl()->Get(RES_FRM_SIZE);
+
+ ((SwColumnPage&)rPage).SetPageWidth(rSize.GetWidth());
+ }
+ else if(TP_TOX_ENTRY == nId)
+ ((SwTOXEntryTabPage&)rPage).SetWrtShell(rSh);
+ if(TP_TOX_SELECT == nId)
+ {
+ ((SwTOXSelectTabPage&)rPage).SetWrtShell(rSh);
+ if(USHRT_MAX != nInitialTOXType)
+ ((SwTOXSelectTabPage&)rPage).SelectType((TOXTypes)nInitialTOXType);
+ }
+}
+/*-- 14.06.99 13:11:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+short SwMultiTOXTabDialog::Ok()
+{
+ short nRet = SfxTabDialog::Ok();
+ SwTOXDescription& rDesc = GetTOXDescription(eCurrentTOXType);
+ SwTOXBase aNewDef(*rSh.GetDefaultTOXBase( eCurrentTOXType.eType, sal_True ));
+
+ sal_uInt16 nIndex = static_cast< sal_uInt16 >(eCurrentTOXType.eType);
+ if(eCurrentTOXType.eType == TOX_USER && eCurrentTOXType.nIndex)
+ {
+ nIndex = static_cast< sal_uInt16 >(TOX_AUTHORITIES + eCurrentTOXType.nIndex);
+ }
+
+ if(pFormArr[nIndex])
+ {
+ rDesc.SetForm(*pFormArr[nIndex]);
+ aNewDef.SetTOXForm(*pFormArr[nIndex]);
+ }
+ rDesc.ApplyTo(aNewDef);
+ if(!bGlobalFlag)
+ pMgr->UpdateOrInsertTOX(
+ rDesc, 0, GetOutputItemSet());
+ else if(bEditTOX)
+ pMgr->UpdateOrInsertTOX(
+ rDesc, &pParamTOXBase, GetOutputItemSet());
+
+ if(!eCurrentTOXType.nIndex)
+ rSh.SetDefaultTOXBase(aNewDef);
+
+ return nRet;
+}
+/* -----------------16.06.99 11:59-------------------
+
+ --------------------------------------------------*/
+SwForm* SwMultiTOXTabDialog::GetForm(CurTOXType eType)
+{
+ sal_uInt16 nIndex = eType.GetFlatIndex();
+ if(!pFormArr[nIndex])
+ pFormArr[nIndex] = new SwForm(eType.eType);
+ return pFormArr[nIndex];
+}
+/* -----------------09.09.99 11:29-------------------
+
+ --------------------------------------------------*/
+SwTOXDescription& SwMultiTOXTabDialog::GetTOXDescription(CurTOXType eType)
+{
+ sal_uInt16 nIndex = eType.GetFlatIndex();
+ if(!pDescArr[nIndex])
+ {
+ const SwTOXBase* pDef = rSh.GetDefaultTOXBase( eType.eType );
+ if(pDef)
+ pDescArr[nIndex] = CreateTOXDescFromTOXBase(pDef);
+ else
+ {
+ pDescArr[nIndex] = new SwTOXDescription(eType.eType);
+ if(eType.eType == TOX_USER)
+ pDescArr[nIndex]->SetTitle(sUserDefinedIndex);
+ else
+ pDescArr[nIndex]->SetTitle(
+ rSh.GetTOXType(eType.eType, 0)->GetTypeName());
+ }
+ if(TOX_AUTHORITIES == eType.eType)
+ {
+ const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
+ rSh.GetFldType(RES_AUTHORITY, aEmptyStr);
+ if(pFType)
+ {
+ String sBrackets(pFType->GetPrefix());
+ sBrackets += pFType->GetSuffix();
+ pDescArr[nIndex]->SetAuthBrackets(sBrackets);
+ pDescArr[nIndex]->SetAuthSequence(pFType->IsSequence());
+ }
+ else
+ {
+ pDescArr[nIndex]->SetAuthBrackets(C2S("[]"));
+ }
+ }
+ else if(TOX_INDEX == eType.eType)
+ pDescArr[nIndex]->SetMainEntryCharStyle(SW_RESSTR(STR_POOLCHR_IDX_MAIN_ENTRY));
+
+ }
+ return *pDescArr[nIndex];
+}
+/* -----------------09.09.99 11:36-------------------
+
+ --------------------------------------------------*/
+SwTOXDescription* SwMultiTOXTabDialog::CreateTOXDescFromTOXBase(
+ const SwTOXBase*pCurTOX)
+{
+ SwTOXDescription * pDesc = new SwTOXDescription(pCurTOX->GetType());
+ for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
+ pDesc->SetStyleNames(pCurTOX->GetStyleNames(i), i);
+ pDesc->SetAutoMarkURL(rSh.GetTOIAutoMarkURL());
+ pDesc->SetTitle(pCurTOX->GetTitle());
+
+
+ pDesc->SetContentOptions(pCurTOX->GetCreateType());
+ if(pDesc->GetTOXType() == TOX_INDEX)
+ pDesc->SetIndexOptions(pCurTOX->GetOptions());
+ pDesc->SetMainEntryCharStyle(pCurTOX->GetMainEntryCharStyle());
+ if(pDesc->GetTOXType() != TOX_INDEX)
+ pDesc->SetLevel((BYTE)pCurTOX->GetLevel());
+ pDesc->SetCreateFromObjectNames(pCurTOX->IsFromObjectNames());
+ pDesc->SetSequenceName(pCurTOX->GetSequenceName());
+ pDesc->SetCaptionDisplay(pCurTOX->GetCaptionDisplay());
+ pDesc->SetFromChapter(pCurTOX->IsFromChapter());
+ pDesc->SetReadonly(pCurTOX->IsProtected());
+ pDesc->SetOLEOptions(pCurTOX->GetOLEOptions());
+ pDesc->SetLevelFromChapter(pCurTOX->IsLevelFromChapter());
+ pDesc->SetLanguage(pCurTOX->GetLanguage());
+ pDesc->SetSortAlgorithm(pCurTOX->GetSortAlgorithm());
+ return pDesc;
+}
+
+/* -----------------------------29.12.99 09:53--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+IMPL_LINK( SwMultiTOXTabDialog, ShowPreviewHdl, CheckBox *, pBox )
+{
+ if(aShowExampleCB.IsChecked())
+ {
+ if(!pExampleFrame && !bExampleCreated)
+ {
+ bExampleCreated = sal_True;
+ String sTemplate( String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM("internal")) );
+ sTemplate += INET_PATH_TOKEN;
+ sTemplate.AppendAscii( RTL_CONSTASCII_STRINGPARAM("idxexample") );
+ String sTemplateWithoutExt( sTemplate );
+#ifndef MAC_WITHOUT_EXT
+ sTemplate.AppendAscii( RTL_CONSTASCII_STRINGPARAM(".odt") );
+#endif
+
+ SvtPathOptions aOpt;
+ // 6.0 (extension .sxw)
+ BOOL bExist = aOpt.SearchFile( sTemplate, SvtPathOptions::PATH_TEMPLATE );
+
+#ifndef MAC_WITHOUT_EXT
+ if( !bExist )
+ {
+ // 6.0 (extension .sxw)
+ sTemplate = sTemplateWithoutExt;
+ sTemplate.AppendAscii( RTL_CONSTASCII_STRINGPARAM(".sxw") );
+ bExist = aOpt.SearchFile( sTemplate, SvtPathOptions::PATH_TEMPLATE );
+ }
+ if( !bExist )
+ {
+ // 5.0 (extension .vor)
+ sTemplate = sTemplateWithoutExt;
+ sTemplate.AppendAscii( RTL_CONSTASCII_STRINGPARAM(".sdw") );
+ bExist = aOpt.SearchFile( sTemplate, SvtPathOptions::PATH_TEMPLATE );
+ }
+#endif
+
+ if(!bExist)
+ {
+ String sInfo(SW_RES(STR_FILE_NOT_FOUND));
+ sInfo.SearchAndReplaceAscii( "%1", sTemplate );
+ sInfo.SearchAndReplaceAscii( "%2", aOpt.GetTemplatePath() );
+ InfoBox aInfo(GetParent(), sInfo);
+ aInfo.Execute();
+ }
+ else
+ {
+ Link aLink(LINK(this, SwMultiTOXTabDialog, CreateExample_Hdl));
+ pExampleFrame = new SwOneExampleFrame(
+ aExampleWIN, EX_SHOW_ONLINE_LAYOUT, &aLink, &sTemplate);
+
+ if(!pExampleFrame->IsServiceAvailable())
+ {
+ pExampleFrame->CreateErrorMessage(0);
+ }
+ }
+ aShowExampleCB.Show(pExampleFrame && pExampleFrame->IsServiceAvailable());
+ }
+ }
+ sal_Bool bSetViewWindow = aShowExampleCB.IsChecked()
+ && pExampleFrame && pExampleFrame->IsServiceAvailable();
+
+ aExampleContainerWIN.Show( bSetViewWindow );
+ SetViewWindow( bSetViewWindow ? &aExampleContainerWIN : 0 );
+
+ Window *pTopmostParent = this;
+ while(pTopmostParent->GetParent())
+ pTopmostParent = pTopmostParent->GetParent();
+ ::Rectangle aRect(GetClientWindowExtentsRelative(pTopmostParent));
+ ::Point aPos = aRect.TopLeft();
+ Size aSize = GetSizePixel();
+ if(pBox)
+ AdjustLayout();
+ long nDiffWidth = GetSizePixel().Width() - aSize.Width();
+ aPos.X() -= nDiffWidth;
+ SetPosPixel(aPos);
+
+ return 0;
+}
+
+
+/* -----------------05.07.99 09:49-------------------
+
+ --------------------------------------------------*/
+sal_Bool SwMultiTOXTabDialog::IsNoNum(SwWrtShell& rSh, const String& rName)
+{
+ SwTxtFmtColl* pColl = rSh.GetParaStyle(rName);
+ //if(pColl && pColl->GetOutlineLevel() == NO_NUMBERING) //#outline level,zhaojianwei
+ if(pColl && ! pColl->IsAssignedToListLevelOfOutlineStyle()) //<-end,zhaojianwei
+ return sal_True;
+
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL);
+ if(nId != USHRT_MAX &&
+ //rSh.GetTxtCollFromPool(nId)->GetOutlineLevel() == NO_NUMBERING) //#outline level,zhaojianwei
+ ! rSh.GetTxtCollFromPool(nId)->IsAssignedToListLevelOfOutlineStyle()) //<-end,zhaojianwei
+ return sal_True;
+
+ return sal_False;
+}
+/* -----------------14.07.99 16:01-------------------
+
+ --------------------------------------------------*/
+class SwIndexTreeLB : public SvTreeListBox
+{
+ const HeaderBar* pHeaderBar;
+public:
+ SwIndexTreeLB(Window* pWin, const ResId& rResId) :
+ SvTreeListBox(pWin, rResId), pHeaderBar(0){}
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual long GetTabPos( SvLBoxEntry*, SvLBoxTab* );
+ void SetHeaderBar(const HeaderBar* pHB) {pHeaderBar = pHB;}
+};
+/* -----------------14.07.99 16:03-------------------
+
+ --------------------------------------------------*/
+long SwIndexTreeLB::GetTabPos( SvLBoxEntry* pEntry, SvLBoxTab* pTab)
+{
+ long nData = (long)pEntry->GetUserData();
+ if(nData != USHRT_MAX)
+ {
+ long nPos = pHeaderBar->GetItemRect( static_cast< USHORT >(101 + nData) ).TopLeft().X();
+ nData = nPos;
+ }
+ else
+ nData = 0;
+ nData += pTab->GetPos();
+ return nData;
+}
+/* -----------------25.08.99 11:14-------------------
+
+ --------------------------------------------------*/
+void SwIndexTreeLB::KeyInput( const KeyEvent& rKEvt )
+{
+ SvLBoxEntry* pEntry = FirstSelected();
+ KeyCode aCode = rKEvt.GetKeyCode();
+ sal_Bool bChanged = sal_False;
+ if(pEntry)
+ {
+ long nLevel = (long)pEntry->GetUserData();
+ if(aCode.GetCode() == KEY_ADD )
+ {
+ if(nLevel < MAXLEVEL - 1)
+ nLevel++;
+ else if(nLevel == USHRT_MAX)
+ nLevel = 0;
+ bChanged = sal_True;
+ }
+ else if(aCode.GetCode() == KEY_SUBTRACT)
+ {
+ if(!nLevel)
+ nLevel = USHRT_MAX;
+ else if(nLevel != USHRT_MAX)
+ nLevel--;
+ bChanged = sal_True;
+ }
+ if(bChanged)
+ {
+ pEntry->SetUserData((void*)nLevel);
+ Invalidate();
+ }
+ }
+ if(!bChanged)
+ SvTreeListBox::KeyInput(rKEvt);
+}
+
+/* -----------------16.07.99 10:01-------------------
+
+ --------------------------------------------------*/
+class SwHeaderTree : public Control
+{
+ HeaderBar aStylesHB;
+ SwIndexTreeLB aStylesTLB;
+
+public:
+ SwHeaderTree(Window* pParent, const ResId rResId);
+
+ HeaderBar& GetHeaderBar() {return aStylesHB;}
+ SwIndexTreeLB& GetTreeListBox() { return aStylesTLB;}
+
+ virtual void GetFocus();
+};
+/* -----------------16.07.99 10:11-------------------
+
+ --------------------------------------------------*/
+SwHeaderTree::SwHeaderTree(Window* pParent, const ResId rResId) :
+ Control(pParent, rResId),
+ aStylesHB( this, ResId(HB_STYLES, *rResId.GetResMgr())),
+ aStylesTLB( this, ResId(TLB_STYLES, *rResId.GetResMgr()))
+{
+ FreeResource();
+ aStylesHB.SetStyle(aStylesHB.GetStyle()|WB_BUTTONSTYLE|WB_TABSTOP|WB_BORDER);
+ Size aHBSize(aStylesHB.GetSizePixel());
+ aHBSize.Height() = aStylesHB.CalcWindowSizePixel().Height();
+ aStylesHB.SetSizePixel(aHBSize);
+ aStylesTLB.SetPosPixel(Point(0, aHBSize.Height()));
+ Size aTLBSize(aStylesHB.GetSizePixel());
+ aTLBSize.Height() = GetOutputSizePixel().Height() - aHBSize.Height();
+ aStylesTLB.SetSizePixel(aTLBSize);
+ aStylesTLB.SetHeaderBar(&aStylesHB);
+}
+/* -----------------25.08.99 10:38-------------------
+
+ --------------------------------------------------*/
+void SwHeaderTree::GetFocus()
+{
+ Control::GetFocus();
+ aStylesTLB.GrabFocus();
+}
+/* -----------------13.07.99 15:29-------------------
+
+ --------------------------------------------------*/
+class SwAddStylesDlg_Impl : public SfxModalDialog
+{
+ OKButton aOk;
+ CancelButton aCancel;
+ HelpButton aHelp;
+
+ FixedLine aStylesFL;
+ SwHeaderTree aHeaderTree;
+ ImageButton aLeftPB;
+ ImageButton aRightPB;
+
+ String sHBFirst;
+ String* pStyleArr;
+
+ DECL_LINK(OkHdl, OKButton*);
+ DECL_LINK(LeftRightHdl, PushButton*);
+ DECL_LINK(HeaderDragHdl, HeaderBar*);
+
+public:
+ SwAddStylesDlg_Impl(Window* pParent, SwWrtShell& rWrtSh, String rStringArr[]);
+ ~SwAddStylesDlg_Impl();
+};
+/* -----------------13.07.99 15:39-------------------
+
+ --------------------------------------------------*/
+SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(Window* pParent,
+ SwWrtShell& rWrtSh, String rStringArr[]) :
+ SfxModalDialog(pParent, SW_RES(DLG_ADD_IDX_STYLES)),
+ aOk( this, SW_RES(PB_OK )),
+ aCancel( this, SW_RES(PB_CANCEL )),
+ aHelp( this, SW_RES(PB_HELP )),
+
+ aStylesFL( this, SW_RES(FL_STYLES )),
+ aHeaderTree(this, SW_RES(TR_HEADER )),
+ aLeftPB( this, SW_RES(PB_LEFT )),
+ aRightPB( this, SW_RES(PB_RIGHT )),
+
+ sHBFirst( SW_RES(ST_HB_FIRST)),
+ pStyleArr(rStringArr)
+{
+ FreeResource();
+
+ aLeftPB.SetModeImage( Image( SW_RES( IMG_ALL_LEFT_HC ) ), BMP_COLOR_HIGHCONTRAST );
+ aRightPB.SetModeImage( Image( SW_RES( IMG_ALL_RIGHT_HC ) ), BMP_COLOR_HIGHCONTRAST );
+
+ aOk.SetClickHdl(LINK(this, SwAddStylesDlg_Impl, OkHdl));
+ aLeftPB.SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl));
+ aRightPB.SetClickHdl(LINK(this, SwAddStylesDlg_Impl, LeftRightHdl));
+
+ HeaderBar& rHB = aHeaderTree.GetHeaderBar();
+ rHB.SetEndDragHdl(LINK(this, SwAddStylesDlg_Impl, HeaderDragHdl));
+
+ long nWidth = rHB.GetSizePixel().Width();
+ sal_uInt16 i;
+
+ nWidth /= 14;
+ nWidth--;
+ rHB.InsertItem( 100, sHBFirst, 4 * nWidth );
+ for( i = 1; i <= MAXLEVEL; i++)
+ rHB.InsertItem( 100 + i, String::CreateFromInt32(i), nWidth );
+ rHB.Show();
+
+ SwIndexTreeLB& rTLB = aHeaderTree.GetTreeListBox();
+ rTLB.SetStyle(rTLB.GetStyle()|WB_CLIPCHILDREN|WB_SORT);
+ //aStylesTLB.SetSelectHdl(LINK(this, SwAddStylesDlg_Impl, SelectHdl));
+ rTLB.GetModel()->SetSortMode(SortAscending);
+ for(i = 0; i < MAXLEVEL; ++i)
+ {
+ String sStyles(rStringArr[i]);
+ for(sal_uInt16 nToken = 0; nToken < sStyles.GetTokenCount(TOX_STYLE_DELIMITER); nToken++)
+ {
+ String sTmp(sStyles.GetToken(nToken, TOX_STYLE_DELIMITER));
+ SvLBoxEntry* pEntry = rTLB.InsertEntry(sTmp);
+ pEntry->SetUserData(reinterpret_cast<void*>(i));
+ }
+ }
+ // now the other styles
+ //
+ const SwTxtFmtColl *pColl = 0;
+ const sal_uInt16 nSz = rWrtSh.GetTxtFmtCollCount();
+
+ for ( sal_uInt16 j = 0;j < nSz; ++j )
+ {
+ pColl = &rWrtSh.GetTxtFmtColl(j);
+ if(pColl->IsDefault())
+ continue;
+
+ const String& rName = pColl->GetName();
+
+ if(rName.Len() > 0)
+ {
+ SvLBoxEntry* pEntry = rTLB.First();
+ sal_Bool bFound = sal_False;
+ while(pEntry && !bFound)
+ {
+ if(rTLB.GetEntryText(pEntry) == rName)
+ bFound = sal_True;
+ pEntry = rTLB.Next(pEntry);
+ }
+ if(!bFound)
+ {
+ rTLB.InsertEntry(rName)->SetUserData((void*)USHRT_MAX);
+ }
+ }
+ }
+ rTLB.GetModel()->Resort();
+}
+
+/* -----------------13.07.99 15:39-------------------
+
+ --------------------------------------------------*/
+SwAddStylesDlg_Impl::~SwAddStylesDlg_Impl()
+{
+}
+/* -----------------13.07.99 15:39-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwAddStylesDlg_Impl, OkHdl, OKButton*, EMPTYARG)
+{
+ for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
+ pStyleArr[i].Erase();
+
+ SwIndexTreeLB& rTLB = aHeaderTree.GetTreeListBox();
+ SvLBoxEntry* pEntry = rTLB.First();
+ while(pEntry)
+ {
+ long nLevel = (long)pEntry->GetUserData();
+ if(nLevel != USHRT_MAX)
+ {
+ String sName(rTLB.GetEntryText(pEntry));
+ if(pStyleArr[nLevel].Len())
+ pStyleArr[nLevel] += TOX_STYLE_DELIMITER;
+ pStyleArr[nLevel] += sName;
+ }
+ pEntry = rTLB.Next(pEntry);
+ }
+
+ //TODO write back style names
+ EndDialog(RET_OK);
+ return 0;
+}
+/* -----------------16.07.99 09:27-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwAddStylesDlg_Impl, HeaderDragHdl, HeaderBar*, EMPTYARG)
+{
+ aHeaderTree.GetTreeListBox().Invalidate();
+ return 0;
+}
+/* -----------------13.07.99 15:39-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwAddStylesDlg_Impl, LeftRightHdl, PushButton*, pBtn)
+{
+ sal_Bool bLeft = pBtn == &aLeftPB;
+ SvLBoxEntry* pEntry = aHeaderTree.GetTreeListBox().FirstSelected();
+ if(pEntry)
+ {
+ long nLevel = (long)pEntry->GetUserData();
+ if(bLeft)
+ {
+ if(!nLevel)
+ nLevel = USHRT_MAX;
+ else if(nLevel != USHRT_MAX)
+ nLevel--;
+ }
+ else
+ {
+ if(nLevel < MAXLEVEL - 1)
+ nLevel++;
+ else if(nLevel == USHRT_MAX)
+ nLevel = 0;
+ }
+ pEntry->SetUserData((void*)nLevel);
+ aHeaderTree.GetTreeListBox().Invalidate();
+ }
+ return 0;
+}
+
+/*-- 14.06.99 13:11:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwTOXSelectTabPage::SwTOXSelectTabPage(Window* pParent, const SfxItemSet& rAttrSet) :
+ SfxTabPage(pParent, SW_RES(TP_TOX_SELECT), rAttrSet),
+
+ aTypeTitleFL( this, SW_RES(FL_TYPETITLE )),
+ aTitleFT( this, SW_RES(FT_TITLE )),
+ aTitleED( this, SW_RES(ED_TITLE )),
+ aTypeFT( this, SW_RES(FT_TYPE )),
+ aTypeLB( this, SW_RES(LB_TYPE )),
+ aReadOnlyCB( this, SW_RES(CB_READONLY )),
+
+ aAreaFL( this, SW_RES(FL_AREA )),
+ aAreaFT( this, SW_RES(FT_AREA )),
+ aAreaLB( this, SW_RES(LB_AREA )),
+ aLevelFT( this, SW_RES(FT_LEVEL )),
+ aLevelNF( this, SW_RES(NF_LEVEL )),
+
+ aCreateFromFL( this, SW_RES(FL_CREATEFROM )),
+ aFromHeadingsCB( this, SW_RES(CB_FROMHEADINGS )),
+// aChapterDlgPB( this, SW_RES(PB_CHAPTERDLG )),//#outline level,removed by zhaojianwei
+ aAddStylesCB( this, SW_RES(CB_ADDSTYLES )),
+ aAddStylesPB( this, SW_RES(PB_ADDSTYLES )),
+
+ aFromTablesCB( this, SW_RES(CB_FROMTABLES )),
+ aFromFramesCB( this, SW_RES(CB_FROMFRAMES )),
+ aFromGraphicsCB( this, SW_RES(CB_FROMGRAPHICS )),
+ aFromOLECB( this, SW_RES(CB_FROMOLE )),
+ aLevelFromChapterCB(this, SW_RES(CB_LEVELFROMCHAPTER )),
+
+ aFromCaptionsRB( this, SW_RES(RB_FROMCAPTIONS )),
+ aFromObjectNamesRB( this, SW_RES(RB_FROMOBJECTNAMES )),
+
+ aCaptionSequenceFT( this, SW_RES(FT_CAPTIONSEQUENCE )),
+ aCaptionSequenceLB( this, SW_RES(LB_CAPTIONSEQUENCE )),
+ aDisplayTypeFT( this, SW_RES(FT_DISPLAYTYPE )),
+ aDisplayTypeLB( this, SW_RES(LB_DISPLAYTYPE )),
+
+ aTOXMarksCB( this, SW_RES(CB_TOXMARKS )),
+
+ aCollectSameCB( this, SW_RES(CB_COLLECTSAME )),
+ aUseFFCB( this, SW_RES(CB_USEFF )),
+ aUseDashCB( this, SW_RES(CB_USE_DASH )),
+ aCaseSensitiveCB( this, SW_RES(CB_CASESENSITIVE )),
+ aInitialCapsCB( this, SW_RES(CB_INITIALCAPS )),
+ aKeyAsEntryCB( this, SW_RES(CB_KEYASENTRY )),
+ aFromFileCB( this, SW_RES(CB_FROMFILE )),
+ aAutoMarkPB( this, SW_RES(MB_AUTOMARK )),
+ aIdxOptionsFL( this, SW_RES(FL_IDXOPTIONS )),
+
+ aFromNames( SW_RES(RES_SRCTYPES )),
+ aFromObjCLB( this, SW_RES(CLB_FROMOBJ )),
+ aFromObjFL( this, SW_RES(FL_FROMOBJ )),
+
+ aSequenceCB( this, SW_RES(CB_SEQUENCE )),
+ aBracketFT( this, SW_RES(FT_BRACKET )),
+ aBracketLB( this, SW_RES(LB_BRACKET )),
+ aAuthorityFormatFL( this, SW_RES(FL_AUTHORITY )),
+
+ aSortOptionsFL( this, SW_RES(FL_SORTOPTIONS )),
+ aLanguageFT( this, SW_RES(FT_LANGUAGE )),
+ aLanguageLB( this, SW_RES(LB_LANGUAGE )),
+ aSortAlgorithmFT( this, SW_RES(FT_SORTALG )),
+ aSortAlgorithmLB( this, SW_RES(LB_SORTALG )),
+
+ pIndexRes(0),
+
+ sAutoMarkType(SW_RES(ST_AUTOMARK_TYPE)),
+ sAddStyleUser(SW_RES(ST_USER_ADDSTYLE)),
+ bFirstCall(sal_True)
+{
+ aBracketLB.InsertEntry(String(SW_RES(ST_NO_BRACKET)), 0);
+ FreeResource();
+
+ pIndexEntryWrapper = new IndexEntrySupplierWrapper();
+
+ aLanguageLB.SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN,
+ FALSE, FALSE, FALSE );
+
+ sAddStyleContent = aAddStylesCB.GetText();
+
+ aCBLeftPos1 = aFromHeadingsCB.GetPosPixel();
+ aCBLeftPos2 = aAddStylesCB.GetPosPixel();
+ aCBLeftPos3 = aTOXMarksCB.GetPosPixel();
+
+ ResStringArray& rNames = aFromNames.GetNames();
+ for(sal_uInt16 i = 0; i < rNames.Count(); i++)
+ {
+ aFromObjCLB.InsertEntry(rNames.GetString(i));
+ aFromObjCLB.SetEntryData( i, (void*)rNames.GetValue(i) );
+ }
+ aFromObjCLB.SetHelpId(HID_OLE_CHECKLB);
+
+ SetExchangeSupport();
+ aTypeLB.SetSelectHdl(LINK(this, SwTOXSelectTabPage, TOXTypeHdl));
+
+ aAddStylesPB.SetClickHdl(LINK(this, SwTOXSelectTabPage, AddStylesHdl));
+ //aChapterDlgPB.SetClickHdl(LINK(this, SwTOXSelectTabPage, ChapterHdl));//#outline level,removed by zhaojianwei
+
+ PopupMenu* pMenu = aAutoMarkPB.GetPopupMenu();
+ pMenu->SetActivateHdl(LINK(this, SwTOXSelectTabPage, MenuEnableHdl));
+ pMenu->SetSelectHdl(LINK(this, SwTOXSelectTabPage, MenuExecuteHdl));
+
+ Link aLk = LINK(this, SwTOXSelectTabPage, CheckBoxHdl);
+ aAddStylesCB .SetClickHdl(aLk);
+ aFromHeadingsCB .SetClickHdl(aLk);
+ aTOXMarksCB .SetClickHdl(aLk);
+ aFromFileCB .SetClickHdl(aLk);
+ aCollectSameCB .SetClickHdl(aLk);
+ aUseFFCB .SetClickHdl(aLk);
+ aUseDashCB .SetClickHdl(aLk);
+ aInitialCapsCB .SetClickHdl(aLk);
+ aKeyAsEntryCB .SetClickHdl(aLk);
+
+ Link aModifyLk = LINK(this, SwTOXSelectTabPage, ModifyHdl);
+ aTitleED.SetModifyHdl(aModifyLk);
+ aLevelNF.SetModifyHdl(aModifyLk);
+ aSortAlgorithmLB.SetSelectHdl(aModifyLk);
+
+ aLk = LINK(this, SwTOXSelectTabPage, RadioButtonHdl);
+ aFromCaptionsRB.SetClickHdl(aLk);
+ aFromObjectNamesRB.SetClickHdl(aLk);
+ RadioButtonHdl(&aFromCaptionsRB);
+
+ aLanguageLB.SetSelectHdl(LINK(this, SwTOXSelectTabPage, LanguageHdl));
+ aTypeLB.SelectEntryPos(0);
+ aTitleED.SaveValue();
+}
+/*-- 14.06.99 13:11:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwTOXSelectTabPage::~SwTOXSelectTabPage()
+{
+ delete pIndexRes;
+ delete pIndexEntryWrapper;
+}
+/* -----------------21.10.99 17:03-------------------
+
+ --------------------------------------------------*/
+void SwTOXSelectTabPage::SetWrtShell(SwWrtShell& rSh)
+{
+ sal_uInt16 nUserTypeCount = rSh.GetTOXTypeCount(TOX_USER);
+ if(nUserTypeCount > 1)
+ {
+ //insert all new user indexes names after the standard user index
+ sal_uInt16 nPos = aTypeLB.GetEntryPos((void*)(sal_uInt32)TO_USER);
+ nPos++;
+ for(sal_uInt16 nUser = 1; nUser < nUserTypeCount; nUser++)
+ {
+ nPos = aTypeLB.InsertEntry(rSh.GetTOXType(TOX_USER, nUser)->GetTypeName(), nPos);
+ sal_uInt32 nEntryData = nUser << 8;
+ nEntryData |= TO_USER;
+ aTypeLB.SetEntryData(nPos, (void*)nEntryData);
+ }
+ }
+}
+/* -----------------14.06.99 13:10-------------------
+
+ --------------------------------------------------*/
+sal_Bool SwTOXSelectTabPage::FillItemSet( SfxItemSet& )
+{
+ return sal_True;
+}
+/* -----------------25.08.99 14:31-------------------
+
+ --------------------------------------------------*/
+long lcl_TOXTypesToUserData(CurTOXType eType)
+{
+ sal_uInt16 nRet = TOX_INDEX;
+ switch(eType.eType)
+ {
+ case TOX_INDEX : nRet = TO_INDEX; break;
+ case TOX_USER :
+ {
+ nRet = eType.nIndex << 8;
+ nRet |= TO_USER;
+ }
+ break;
+ case TOX_CONTENT : nRet = TO_CONTENT; break;
+ case TOX_ILLUSTRATIONS:nRet = TO_ILLUSTRATION; break;
+ case TOX_OBJECTS : nRet = TO_OBJECT; break;
+ case TOX_TABLES : nRet = TO_TABLE; break;
+ case TOX_AUTHORITIES : nRet = TO_AUTHORITIES; break;
+ }
+ return nRet;
+}
+//-----------------------------------------------------------------
+void SwTOXSelectTabPage::SelectType(TOXTypes eSet)
+{
+ CurTOXType eCurType (eSet, 0);
+
+ long nData = lcl_TOXTypesToUserData(eCurType);
+ aTypeLB.SelectEntryPos(aTypeLB.GetEntryPos((void*)nData));
+ aTypeFT.Enable(sal_False);
+ aTypeLB.Enable(sal_False);
+ TOXTypeHdl(&aTypeLB);
+}
+
+/*-- 14.06.99 13:10:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+//-----------------------------------------------------------------
+CurTOXType lcl_UserData2TOXTypes(sal_uInt16 nData)
+{
+ CurTOXType eRet;
+
+ switch(nData&0xff)
+ {
+ case TO_INDEX : eRet.eType = TOX_INDEX; break;
+ case TO_USER :
+ {
+ eRet.eType = TOX_USER;
+ eRet.nIndex = (nData&0xff00) >> 8;
+ }
+ break;
+ case TO_CONTENT : eRet.eType = TOX_CONTENT; break;
+ case TO_ILLUSTRATION: eRet.eType = TOX_ILLUSTRATIONS; break;
+ case TO_OBJECT : eRet.eType = TOX_OBJECTS; break;
+ case TO_TABLE : eRet.eType = TOX_TABLES; break;
+ case TO_AUTHORITIES : eRet.eType = TOX_AUTHORITIES; break;
+ default: DBG_ERROR("what a type?");
+ }
+ return eRet;
+}
+/* -----------------02.09.99 08:16-------------------
+
+ --------------------------------------------------*/
+void SwTOXSelectTabPage::ApplyTOXDescription()
+{
+ SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog();
+ const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
+ SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aCurType);
+ aReadOnlyCB.Check(rDesc.IsReadonly());
+ if(aTitleED.GetText() == aTitleED.GetSavedValue())
+ {
+ if(rDesc.GetTitle())
+ aTitleED.SetText(*rDesc.GetTitle());
+ else
+ aTitleED.SetText(aEmptyStr);
+ aTitleED.SaveValue();
+ }
+
+ aAreaLB.SelectEntryPos(rDesc.IsFromChapter() ? 1 : 0);
+
+ if(aCurType.eType != TOX_INDEX)
+ aLevelNF.SetValue(rDesc.GetLevel()); //content, user
+
+ sal_uInt16 nCreateType = rDesc.GetContentOptions();
+
+ //user + content
+ sal_Bool bHasStyleNames = sal_False;
+ sal_uInt16 i;
+
+ for( i = 0; i < MAXLEVEL; i++)
+ if(rDesc.GetStyleNames(i).Len())
+ {
+ bHasStyleNames = sal_True;
+ break;
+ }
+ aAddStylesCB.Check(bHasStyleNames && (nCreateType & nsSwTOXElement::TOX_TEMPLATE));
+
+ aFromOLECB. Check( 0 != (nCreateType & nsSwTOXElement::TOX_OLE) );
+ aFromTablesCB. Check( 0 != (nCreateType & nsSwTOXElement::TOX_TABLE) );
+ aFromGraphicsCB.Check( 0 != (nCreateType & nsSwTOXElement::TOX_GRAPHIC) );
+ aFromFramesCB. Check( 0 != (nCreateType & nsSwTOXElement::TOX_FRAME) );
+
+ aLevelFromChapterCB.Check(rDesc.IsLevelFromChapter());
+
+ //all but illustration and table
+ aTOXMarksCB.Check( 0 != (nCreateType & nsSwTOXElement::TOX_MARK) );
+
+ //content
+ if(TOX_CONTENT == aCurType.eType)
+ {
+ aFromHeadingsCB.Check( 0 != (nCreateType & nsSwTOXElement::TOX_OUTLINELEVEL) );
+ //aChapterDlgPB.Enable(aFromHeadingsCB.IsChecked());//#outline level,removed by zhaojianwei
+ aAddStylesCB.SetText(sAddStyleContent);
+ aAddStylesPB.Enable(aAddStylesCB.IsChecked());
+ }
+ //index only
+ else if(TOX_INDEX == aCurType.eType)
+ {
+ sal_uInt16 nIndexOptions = rDesc.GetIndexOptions();
+ aCollectSameCB. Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_SAME_ENTRY) );
+ aUseFFCB. Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_FF) );
+ aUseDashCB. Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_DASH) );
+ if(aUseFFCB.IsChecked())
+ aUseDashCB.Enable(sal_False);
+ else if(aUseDashCB.IsChecked())
+ aUseFFCB.Enable(sal_False);
+
+ aCaseSensitiveCB. Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_CASE_SENSITIVE) );
+ aInitialCapsCB. Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_INITIAL_CAPS) );
+ aKeyAsEntryCB. Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_KEY_AS_ENTRY) );
+ }
+ else if(TOX_ILLUSTRATIONS == aCurType.eType ||
+ TOX_TABLES == aCurType.eType)
+ {
+ aFromObjectNamesRB.Check(rDesc.IsCreateFromObjectNames());
+ aFromCaptionsRB.Check(!rDesc.IsCreateFromObjectNames());
+ aCaptionSequenceLB.SelectEntry(rDesc.GetSequenceName());
+ aDisplayTypeLB.SelectEntryPos( static_cast< USHORT >(rDesc.GetCaptionDisplay()) );
+ RadioButtonHdl(&aFromCaptionsRB);
+
+ }
+ else if(TOX_OBJECTS == aCurType.eType)
+ {
+ long nOLEData = rDesc.GetOLEOptions();
+ for(sal_uInt16 nFromObj = 0; nFromObj < aFromObjCLB.GetEntryCount(); nFromObj++)
+ {
+ long nData = (long)aFromObjCLB.GetEntryData(nFromObj);
+ aFromObjCLB.CheckEntryPos(nFromObj, 0 != (nData & nOLEData));
+ }
+ }
+ else if(TOX_AUTHORITIES == aCurType.eType)
+ {
+ String sBrackets(rDesc.GetAuthBrackets());
+ if(!sBrackets.Len() || sBrackets.EqualsAscii(" "))
+ aBracketLB.SelectEntryPos(0);
+ else
+ aBracketLB.SelectEntry(sBrackets);
+ aSequenceCB.Check(rDesc.IsAuthSequence());
+ }
+ aAutoMarkPB.Enable(aFromFileCB.IsChecked());
+
+ for(i = 0; i < MAXLEVEL; i++)
+ aStyleArr[i] = rDesc.GetStyleNames(i);
+
+ aLanguageLB.SelectLanguage(rDesc.GetLanguage());
+ LanguageHdl(0);
+ for( long nCnt = 0; nCnt < aSortAlgorithmLB.GetEntryCount(); ++nCnt )
+ {
+ const String* pEntryData = (const String*)aSortAlgorithmLB.GetEntryData( (USHORT)nCnt );
+ DBG_ASSERT(pEntryData, "no entry data available");
+ if( pEntryData && *pEntryData == rDesc.GetSortAlgorithm())
+ {
+ aSortAlgorithmLB.SelectEntryPos( (USHORT)nCnt );
+ break;
+ }
+ }
+}
+/* -----------------09.09.99 11:57-------------------
+
+ --------------------------------------------------*/
+void SwTOXSelectTabPage::FillTOXDescription()
+{
+ SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog();
+ CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
+ SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aCurType);
+ rDesc.SetTitle(aTitleED.GetText());
+ rDesc.SetFromChapter(1 == aAreaLB.GetSelectEntryPos());
+ sal_uInt16 nContentOptions = 0;
+ if(aTOXMarksCB.IsVisible() && aTOXMarksCB.IsChecked())
+ nContentOptions |= nsSwTOXElement::TOX_MARK;
+
+ sal_uInt16 nIndexOptions = rDesc.GetIndexOptions()&nsSwTOIOptions::TOI_ALPHA_DELIMITTER;
+ switch(rDesc.GetTOXType())
+ {
+ case TOX_CONTENT:
+ if(aFromHeadingsCB.IsChecked())
+ nContentOptions |= nsSwTOXElement::TOX_OUTLINELEVEL;
+ break;
+ case TOX_USER:
+ {
+ rDesc.SetTOUName(aTypeLB.GetSelectEntry());
+
+ if(aFromOLECB.IsChecked())
+ nContentOptions |= nsSwTOXElement::TOX_OLE;
+ if(aFromTablesCB.IsChecked())
+ nContentOptions |= nsSwTOXElement::TOX_TABLE;
+ if(aFromFramesCB.IsChecked())
+ nContentOptions |= nsSwTOXElement::TOX_FRAME;
+ if(aFromGraphicsCB.IsChecked())
+ nContentOptions |= nsSwTOXElement::TOX_GRAPHIC;
+ }
+ break;
+ case TOX_INDEX:
+ {
+ nContentOptions = nsSwTOXElement::TOX_MARK;
+
+ if(aCollectSameCB.IsChecked())
+ nIndexOptions |= nsSwTOIOptions::TOI_SAME_ENTRY;
+ if(aUseFFCB.IsChecked())
+ nIndexOptions |= nsSwTOIOptions::TOI_FF;
+ if(aUseDashCB.IsChecked())
+ nIndexOptions |= nsSwTOIOptions::TOI_DASH;
+ if(aCaseSensitiveCB.IsChecked())
+ nIndexOptions |= nsSwTOIOptions::TOI_CASE_SENSITIVE;
+ if(aInitialCapsCB.IsChecked())
+ nIndexOptions |= nsSwTOIOptions::TOI_INITIAL_CAPS;
+ if(aKeyAsEntryCB.IsChecked())
+ nIndexOptions |= nsSwTOIOptions::TOI_KEY_AS_ENTRY;
+ if(aFromFileCB.IsChecked())
+ rDesc.SetAutoMarkURL(sAutoMarkURL);
+ else
+ rDesc.SetAutoMarkURL(aEmptyStr);
+ }
+ break;
+ case TOX_ILLUSTRATIONS:
+ case TOX_TABLES :
+ rDesc.SetCreateFromObjectNames(aFromObjectNamesRB.IsChecked());
+ rDesc.SetSequenceName(aCaptionSequenceLB.GetSelectEntry());
+ rDesc.SetCaptionDisplay((SwCaptionDisplay)aDisplayTypeLB.GetSelectEntryPos());
+ break;
+ case TOX_OBJECTS:
+ {
+ long nOLEData = 0;
+ for(sal_uInt16 i = 0; i < aFromObjCLB.GetEntryCount(); i++)
+ {
+ if(aFromObjCLB.IsChecked(i))
+ {
+ long nData = (long)aFromObjCLB.GetEntryData(i);
+ nOLEData |= nData;
+ }
+ }
+ rDesc.SetOLEOptions((USHORT)nOLEData);
+ }
+ break;
+ case TOX_AUTHORITIES:
+ {
+ if(aBracketLB.GetSelectEntryPos())
+ rDesc.SetAuthBrackets(aBracketLB.GetSelectEntry());
+ else
+ rDesc.SetAuthBrackets(aEmptyStr);
+ rDesc.SetAuthSequence(aSequenceCB.IsChecked());
+ }
+ break;
+ }
+
+ rDesc.SetLevelFromChapter( aLevelFromChapterCB.IsVisible() &&
+ aLevelFromChapterCB.IsChecked());
+ if(aTOXMarksCB.IsChecked() && aTOXMarksCB.IsVisible())
+ nContentOptions |= nsSwTOXElement::TOX_MARK;
+ if(aFromHeadingsCB.IsChecked() && aFromHeadingsCB.IsVisible())
+ nContentOptions |= nsSwTOXElement::TOX_OUTLINELEVEL;
+ if(aAddStylesCB.IsChecked() && aAddStylesCB.IsVisible())
+ nContentOptions |= nsSwTOXElement::TOX_TEMPLATE;
+
+ rDesc.SetContentOptions(nContentOptions);
+ rDesc.SetIndexOptions(nIndexOptions);
+ rDesc.SetLevel( static_cast< BYTE >(aLevelNF.GetValue()) );
+
+ rDesc.SetReadonly(aReadOnlyCB.IsChecked());
+
+ for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
+ rDesc.SetStyleNames(aStyleArr[i], i);
+
+ rDesc.SetLanguage(aLanguageLB.GetSelectLanguage());
+ const String* pEntryData = (const String*)aSortAlgorithmLB.GetEntryData(
+ aSortAlgorithmLB.GetSelectEntryPos() );
+ DBG_ASSERT(pEntryData, "no entry data available");
+ if(pEntryData)
+ rDesc.SetSortAlgorithm(*pEntryData);
+}
+/* -----------------05.07.99 15:09-------------------
+
+ --------------------------------------------------*/
+void SwTOXSelectTabPage::Reset( const SfxItemSet& )
+{
+ SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog();
+ SwWrtShell& rSh = pTOXDlg->GetWrtShell();
+ const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
+ long nData = lcl_TOXTypesToUserData(aCurType);
+ aTypeLB.SelectEntryPos(aTypeLB.GetEntryPos((void*)nData));
+
+ sAutoMarkURL = INetURLObject::decode( rSh.GetTOIAutoMarkURL(),
+ INET_HEX_ESCAPE,
+ INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 );
+ aFromFileCB.Check( 0 != sAutoMarkURL.Len() );
+
+ aCaptionSequenceLB.Clear();
+ sal_uInt16 i, nCount = rSh.GetFldTypeCount(RES_SETEXPFLD);
+ for (i = 0; i < nCount; i++)
+ {
+ SwFieldType *pType = rSh.GetFldType( i, RES_SETEXPFLD );
+ if( pType->Which() == RES_SETEXPFLD &&
+ ((SwSetExpFieldType *) pType)->GetType() & nsSwGetSetExpType::GSE_SEQ )
+ aCaptionSequenceLB.InsertEntry(pType->GetName());
+ }
+
+ if(pTOXDlg->IsTOXEditMode())
+ {
+ aTypeFT.Enable(sal_False);
+ aTypeLB.Enable(sal_False);
+ }
+ TOXTypeHdl(&aTypeLB);
+ CheckBoxHdl(&aAddStylesCB);
+}
+/*-- 14.06.99 13:10:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwTOXSelectTabPage::ActivatePage( const SfxItemSet& )
+{
+ //nothing to do
+}
+/*-- 14.06.99 13:11:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+int SwTOXSelectTabPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if(_pSet)
+ _pSet->Put(SfxUInt16Item(FN_PARAM_TOX_TYPE,
+ (sal_uInt16)(long)aTypeLB.GetEntryData( aTypeLB.GetSelectEntryPos() )));
+ FillTOXDescription();
+ return LEAVE_PAGE;
+}
+/* -----------------14.06.99 13:10-------------------
+
+ --------------------------------------------------*/
+SfxTabPage* SwTOXSelectTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet)
+{
+ return new SwTOXSelectTabPage(pParent, rAttrSet);
+}
+/* -----------------14.06.99 13:10-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTOXSelectTabPage, TOXTypeHdl, ListBox*, pBox)
+{
+ SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog();
+ if(!bFirstCall)
+ {
+ // save current values into the proper TOXDescription
+ FillTOXDescription();
+ }
+ bFirstCall = sal_False;
+ const sal_uInt16 nType = sal::static_int_cast< sal_uInt16 >(reinterpret_cast< sal_uIntPtr >(
+ pBox->GetEntryData( pBox->GetSelectEntryPos() )));
+ CurTOXType eCurType = lcl_UserData2TOXTypes(nType);
+ pTOXDlg->SetCurrentTOXType(eCurType);
+
+ aAreaLB.Show( 0 != (nType & (TO_CONTENT|TO_ILLUSTRATION|TO_USER|TO_INDEX|TO_TABLE|TO_OBJECT)) );
+ aLevelFT.Show( 0 != (nType & (TO_CONTENT)) );
+ aLevelNF.Show( 0 != (nType & (TO_CONTENT)) );
+ aLevelFromChapterCB.Show( 0 != (nType & (TO_USER)) );
+ aAreaFT.Show( 0 != (nType & (TO_CONTENT|TO_ILLUSTRATION|TO_USER|TO_INDEX|TO_TABLE|TO_OBJECT)) );
+ aAreaFL.Show( 0 != (nType & (TO_CONTENT|TO_ILLUSTRATION|TO_USER|TO_INDEX|TO_TABLE|TO_OBJECT)) );
+
+ aFromHeadingsCB.Show( 0 != (nType & (TO_CONTENT)) );
+ // aChapterDlgPB.Show( 0 != (nType & (TO_CONTENT)) );//#outline level,removed by zhaojianwei
+ aAddStylesCB.Show( 0 != (nType & (TO_CONTENT|TO_USER)) );
+ aAddStylesPB.Show( 0 != (nType & (TO_CONTENT|TO_USER)) );
+
+ aFromTablesCB.Show( 0 != (nType & (TO_USER)) );
+ aFromFramesCB.Show( 0 != (nType & (TO_USER)) );
+ aFromGraphicsCB.Show( 0 != (nType & (TO_USER)) );
+ aFromOLECB.Show( 0 != (nType & (TO_USER)) );
+
+ aFromCaptionsRB.Show( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) );
+ aFromObjectNamesRB.Show( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) );
+
+ aTOXMarksCB.Show( 0 != (nType & (TO_CONTENT|TO_USER)) );
+
+ aCreateFromFL.Show( 0 != (nType & (TO_CONTENT|TO_ILLUSTRATION|TO_USER|TO_TABLE)) );
+ aCaptionSequenceFT.Show( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) );
+ aCaptionSequenceLB.Show( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) );
+ aDisplayTypeFT.Show( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) );
+ aDisplayTypeLB.Show( 0 != (nType & (TO_ILLUSTRATION|TO_TABLE)) );
+
+ aSequenceCB.Show( 0 != (nType & TO_AUTHORITIES) );
+ aBracketFT.Show( 0 != (nType & TO_AUTHORITIES) );
+ aBracketLB.Show( 0 != (nType & TO_AUTHORITIES) );
+ aAuthorityFormatFL.Show( 0 != (nType & TO_AUTHORITIES) );
+
+ sal_Bool bEnableSortLanguage = 0 != (nType & (TO_INDEX|TO_AUTHORITIES));
+ aSortOptionsFL.Show(bEnableSortLanguage);
+ aLanguageFT.Show(bEnableSortLanguage);
+ aLanguageLB.Show(bEnableSortLanguage);
+ aSortAlgorithmFT.Show(bEnableSortLanguage);
+ aSortAlgorithmLB.Show(bEnableSortLanguage);
+
+ //if(nType & TO_CONTENT) //#outline level,removed by zhaojianwei
+ //{
+ //Point aPos(aAddStylesPB.GetPosPixel());
+ //aPos.X() = aChapterDlgPB.GetPosPixel().X();
+ //aAddStylesPB.SetPosPixel(aPos);
+ //}
+ //else if( nType & TO_ILLUSTRATION )//<-removed end.
+ // initialize button positions
+
+ //#i111993# add styles button has two different positions
+ if( !aAddStylesPosDef.X() )
+ {
+ aAddStylesPosDef = ( aAddStylesPB.GetPosPixel() );
+ // move left!
+ Point aPos(aAddStylesPosDef);
+ aPos.X() -= 2 * aAddStylesPB.GetSizePixel().Width();
+ aAddStylesPosUser = aPos;
+ }
+
+ if( nType & TO_ILLUSTRATION ) //add by zhaojianwei
+ aCaptionSequenceLB.SelectEntry( SwStyleNameMapper::GetUIName(
+ RES_POOLCOLL_LABEL_ABB, aEmptyStr ));
+ else if( nType & TO_TABLE )
+ aCaptionSequenceLB.SelectEntry( SwStyleNameMapper::GetUIName(
+ RES_POOLCOLL_LABEL_TABLE, aEmptyStr ));
+ else if( nType & TO_USER )
+ {
+ aAddStylesCB.SetText(sAddStyleUser);
+ aAddStylesPB.SetPosPixel(aAddStylesPosUser);
+ }
+ else if( nType & TO_CONTENT )
+ {
+ aAddStylesPB.SetPosPixel(aAddStylesPosDef);
+ }
+
+ aCollectSameCB.Show( 0 != (nType & TO_INDEX) );
+ aUseFFCB.Show( 0 != (nType & TO_INDEX) );
+ aUseDashCB.Show( 0 != (nType & TO_INDEX) );
+ aCaseSensitiveCB.Show( 0 != (nType & TO_INDEX) );
+ aInitialCapsCB.Show( 0 != (nType & TO_INDEX) );
+ aKeyAsEntryCB.Show( 0 != (nType & TO_INDEX) );
+ aFromFileCB.Show( 0 != (nType & TO_INDEX) );
+ aAutoMarkPB.Show( 0 != (nType & TO_INDEX) );
+// aCreateAutoMarkPB.Show(nType &TO_INDEX);
+// aEditAutoMarkPB.Show(nType & TO_INDEX);
+
+ aIdxOptionsFL.Show( 0 != (nType & TO_INDEX) );
+
+ //object index
+ aFromObjCLB.Show( 0 != (nType & TO_OBJECT) );
+ aFromObjFL.Show( 0 != (nType & TO_OBJECT) );
+
+ //move controls
+ aAddStylesCB.SetPosPixel(nType & TO_USER ? aCBLeftPos1 : aCBLeftPos2);
+ Point aPBPos(aAddStylesPB.GetPosPixel());
+ aPBPos.Y() = nType & TO_USER ? aCBLeftPos1.Y() : aCBLeftPos2.Y();
+ aAddStylesPB.SetPosPixel(aPBPos);
+ aTOXMarksCB.SetPosPixel(nType & TO_USER ? aCBLeftPos2 : aCBLeftPos3);
+ //set control values from the proper TOXDescription
+ {
+ ApplyTOXDescription();
+ }
+ ModifyHdl(0);
+ return 0;
+}
+/* -----------------30.11.99 12:48-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTOXSelectTabPage, ModifyHdl, void*, EMPTYARG)
+{
+ SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog();
+ if(pTOXDlg)
+ {
+ FillTOXDescription();
+ pTOXDlg->CreateOrUpdateExample(pTOXDlg->GetCurrentTOXType().eType, TOX_PAGE_SELECT);
+ }
+ return 0;
+}
+/* -----------------05.07.99 10:13-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTOXSelectTabPage, CheckBoxHdl, CheckBox*, pBox )
+{
+ SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog();
+ const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
+ if(TOX_CONTENT == aCurType.eType)
+ {
+ //at least one of the three CheckBoxes must be checked
+ if(!aAddStylesCB.IsChecked() && !aFromHeadingsCB.IsChecked() && !aTOXMarksCB.IsChecked())
+ {
+ //TODO: InfoBox?
+ pBox->Check(sal_True);
+ }
+ aAddStylesPB.Enable(aAddStylesCB.IsChecked());
+ //aChapterDlgPB.Enable(aFromHeadingsCB.IsChecked());//#outline level,removed by zhaojianwei
+ }
+ if(TOX_USER == aCurType.eType)
+ {
+ aAddStylesPB.Enable(aAddStylesCB.IsChecked());
+ }
+ else if(TOX_INDEX == aCurType.eType)
+ {
+ aAutoMarkPB.Enable(aFromFileCB.IsChecked());
+ aUseFFCB.Enable(aCollectSameCB.IsChecked() && !aUseDashCB.IsChecked());
+ aUseDashCB.Enable(aCollectSameCB.IsChecked() && !aUseFFCB.IsChecked());
+ aCaseSensitiveCB.Enable(aCollectSameCB.IsChecked());
+ }
+ ModifyHdl(0);
+ return 0;
+};
+/* -----------------14.07.99 14:21-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTOXSelectTabPage, RadioButtonHdl, RadioButton*, EMPTYARG )
+{
+ sal_Bool bEnable = aFromCaptionsRB.IsChecked();
+ aCaptionSequenceFT.Enable(bEnable);
+ aCaptionSequenceLB.Enable(bEnable);
+ aDisplayTypeFT.Enable(bEnable);
+ aDisplayTypeLB.Enable(bEnable);
+ ModifyHdl(0);
+ return 0;
+}
+/* -----------------------------06.06.01 09:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwTOXSelectTabPage, LanguageHdl, ListBox*, pBox)
+{
+ Locale aLcl( SvxCreateLocale( aLanguageLB.GetSelectLanguage() ) );
+ Sequence< OUString > aSeq = pIndexEntryWrapper->GetAlgorithmList( aLcl );
+
+ if( !pIndexRes )
+ pIndexRes = new IndexEntryRessource();
+
+ String sOldString;
+ void* pUserData;
+ if( 0 != (pUserData = aSortAlgorithmLB.GetEntryData( aSortAlgorithmLB.GetSelectEntryPos())) )
+ sOldString = *(String*)pUserData;
+ void* pDel;
+ USHORT nEnd = aSortAlgorithmLB.GetEntryCount();
+ for( USHORT n = 0; n < nEnd; ++n )
+ if( 0 != ( pDel = aSortAlgorithmLB.GetEntryData( n )) )
+ delete (String*)pDel;
+ aSortAlgorithmLB.Clear();
+
+ USHORT nInsPos;
+ String sAlg, sUINm;
+ nEnd = static_cast< USHORT >(aSeq.getLength());
+ for( USHORT nCnt = 0; nCnt < nEnd; ++nCnt )
+ {
+ sUINm = pIndexRes->GetTranslation( sAlg = aSeq[ nCnt ] );
+ nInsPos = aSortAlgorithmLB.InsertEntry( sUINm );
+ aSortAlgorithmLB.SetEntryData( nInsPos, new String( sAlg ));
+ if( sAlg == sOldString )
+ aSortAlgorithmLB.SelectEntryPos( nInsPos );
+ }
+
+ if( LISTBOX_ENTRY_NOTFOUND == aSortAlgorithmLB.GetSelectEntryPos() )
+ aSortAlgorithmLB.SelectEntryPos( 0 );
+
+ if(pBox)
+ ModifyHdl(0);
+ return 0;
+};
+/* -----------------14.06.99 13:10-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTOXSelectTabPage, TOXAreaHdl, ListBox*, pBox)
+{
+ DBG_WARNING("not implemented");
+ switch((long)pBox->GetEntryData( pBox->GetSelectEntryPos() ))
+ {
+ case AREA_DOCUMENT : break;
+ case AREA_CHAPTER : break;
+ }
+ return 0;
+}
+
+//#outline level, removed by zhaojianwei
+//It is no longer used!
+///* -----------------14.06.99 13:10-------------------
+//
+// --------------------------------------------------*/
+//IMPL_LINK(SwTOXSelectTabPage, ChapterHdl, PushButton*, pButton)
+//{
+// SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog();
+// SwWrtShell& rSh = pTOXDlg->GetWrtShell();
+//
+// SfxItemSet aTmp(rSh.GetView().GetPool(), FN_PARAM_1, FN_PARAM_1);
+// SwOutlineTabDialog* pDlg = new SwOutlineTabDialog(pButton, &aTmp, rSh);
+//
+// if(RET_OK == pDlg->Execute())
+// {
+// CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
+// SwForm* pForm = ((SwMultiTOXTabDialog*)GetTabDialog())->GetForm(aCurType);
+// // jetzt muss ueberprueft werden, ob dem sdbcx::Index Ueberschriftenvorlagen
+// // zugewiesen wurden
+// String sStr;
+// for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
+// {
+// sal_Bool bNum = !SwMultiTOXTabDialog::IsNoNum(rSh, pForm->GetTemplate( i + 1 ));
+// if(bNum)
+// {
+// //es gibt getrennte Resourcebereiche fuer die Inhaltsverzeichnisse
+// if(i < 5)
+// SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(RES_POOLCOLL_TOX_CNTNT1 + i), sStr );
+// else
+// SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(RES_POOLCOLL_TOX_CNTNT6 + i - 5), sStr );
+// pForm->SetTemplate( i + 1, sStr );
+// }
+// }
+//
+// }
+// delete pDlg;
+// return 0;
+//}
+/* -----------------14.06.99 13:10-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTOXSelectTabPage, AddStylesHdl, PushButton*, pButton)
+{
+ SwAddStylesDlg_Impl* pDlg = new SwAddStylesDlg_Impl(pButton,
+ ((SwMultiTOXTabDialog*)GetTabDialog())->GetWrtShell(),
+ aStyleArr);
+ pDlg->Execute();
+ delete pDlg;
+ ModifyHdl(0);
+ return 0;
+}
+/* -----------------------------19.01.00 10:59--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+IMPL_LINK(SwTOXSelectTabPage, MenuEnableHdl, Menu*, pMenu)
+{
+ pMenu->EnableItem(MN_AUTOMARK_EDIT, sAutoMarkURL.Len() > 0);
+ return 0;
+}
+
+IMPL_LINK(SwTOXSelectTabPage, MenuExecuteHdl, Menu*, pMenu)
+{
+ const String sSaveAutoMarkURL = sAutoMarkURL;
+ switch(pMenu->GetCurItemId())
+ {
+ case MN_AUTOMARK_OPEN:
+ sAutoMarkURL = lcl_CreateAutoMarkFileDlg(
+ sAutoMarkURL, sAutoMarkType, sal_True);
+ break;
+ case MN_AUTOMARK_NEW :
+ sAutoMarkURL = lcl_CreateAutoMarkFileDlg(
+ sAutoMarkURL, sAutoMarkType, sal_False);
+ if( !sAutoMarkURL.Len() )
+ break;
+ //no break
+ case MN_AUTOMARK_EDIT:
+ {
+ sal_Bool bNew = pMenu->GetCurItemId()== MN_AUTOMARK_NEW;
+ SwAutoMarkDlg_Impl* pAutoMarkDlg = new SwAutoMarkDlg_Impl(
+ &aAutoMarkPB, sAutoMarkURL, sAutoMarkType, bNew );
+
+ if( RET_OK != pAutoMarkDlg->Execute() && bNew )
+ sAutoMarkURL = sSaveAutoMarkURL;
+ delete pAutoMarkDlg;
+
+ }
+ break;
+ }
+ return 0;
+}
+
+/* -----------------16.06.99 10:46-------------------
+
+ --------------------------------------------------*/
+class SwTOXEdit : public Edit
+{
+ SwFormToken aFormToken;
+ Link aPrevNextControlLink;
+ sal_Bool bNextControl;
+ SwTokenWindow* m_pParent;
+public:
+ SwTOXEdit( Window* pParent, SwTokenWindow* pTokenWin,
+ const SwFormToken& aToken)
+ : Edit( pParent, WB_BORDER|WB_TABSTOP|WB_CENTER),
+ aFormToken(aToken),
+ bNextControl(sal_False),
+ m_pParent( pTokenWin )
+ {
+ SetHelpId( HID_TOX_ENTRY_EDIT );
+ }
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+
+ sal_Bool IsNextControl() const {return bNextControl;}
+ void SetPrevNextLink( const Link& rLink ) {aPrevNextControlLink = rLink;}
+
+ const SwFormToken& GetFormToken()
+ {
+ aFormToken.sText = GetText();
+ return aFormToken;
+ }
+
+ void SetCharStyleName(const String& rSet, sal_uInt16 nPoolId)
+ {
+ aFormToken.sCharStyleName = rSet;
+ aFormToken.nPoolId = nPoolId;
+ }
+
+ void AdjustSize();
+};
+
+//---------------------------------------------------
+void SwTOXEdit::RequestHelp( const HelpEvent& rHEvt )
+{
+ if(!m_pParent->CreateQuickHelp(this, aFormToken, rHEvt))
+ Edit::RequestHelp(rHEvt);
+}
+//---------------------------------------------------
+void SwTOXEdit::KeyInput( const KeyEvent& rKEvt )
+{
+ const Selection& rSel = GetSelection();
+ sal_uInt16 nTextLen = GetText().Len();
+ if( (rSel.A() == rSel.B() &&
+ !rSel.A() ) || rSel.A() == nTextLen )
+ {
+ sal_Bool bCall = sal_False;
+ KeyCode aCode = rKEvt.GetKeyCode();
+ if(aCode.GetCode() == KEY_RIGHT && rSel.A() == nTextLen)
+ {
+ bNextControl = sal_True;
+ bCall = sal_True;
+ }
+ else if(aCode.GetCode() == KEY_LEFT && !rSel.A() )
+ {
+ bNextControl = sal_False;
+ bCall = sal_True;
+ }
+
+ if(bCall && aPrevNextControlLink.IsSet())
+ aPrevNextControlLink.Call(this);
+
+ }
+ Edit::KeyInput(rKEvt);
+}
+/* -----------------16.07.99 12:41-------------------
+
+ --------------------------------------------------*/
+void SwTOXEdit::AdjustSize()
+{
+ Size aSize(GetSizePixel());
+ Size aTextSize(GetTextWidth(GetText()), GetTextHeight());
+ aTextSize = LogicToPixel(aTextSize);
+ aSize.Width() = aTextSize.Width() + EDIT_MINWIDTH;
+ SetSizePixel(aSize);
+}
+
+//---------------------------------------------------
+//---------------------------------------------------
+class SwTOXButton : public PushButton
+{
+ SwFormToken aFormToken;
+ Link aPrevNextControlLink;
+ sal_Bool bNextControl;
+ SwTokenWindow* m_pParent;
+public:
+ SwTOXButton( Window* pParent, SwTokenWindow* pTokenWin,
+ const SwFormToken& rToken)
+ : PushButton(pParent, WB_BORDER|WB_TABSTOP),
+ aFormToken(rToken),
+ bNextControl(sal_False),
+ m_pParent(pTokenWin)
+ {
+ SetHelpId(HID_TOX_ENTRY_BUTTON);
+ }
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+
+ sal_Bool IsNextControl() const {return bNextControl;}
+ void SetPrevNextLink(const Link& rLink) {aPrevNextControlLink = rLink;}
+ const SwFormToken& GetFormToken() const {return aFormToken;}
+
+ void SetCharStyleName(const String& rSet, sal_uInt16 nPoolId)
+ {
+ aFormToken.sCharStyleName = rSet;
+ aFormToken.nPoolId = nPoolId;
+ }
+
+ void SetTabPosition(SwTwips nSet)
+ { aFormToken.nTabStopPosition = nSet; }
+
+ void SetFillChar( sal_Unicode cSet )
+ { aFormToken.cTabFillChar = cSet; }
+
+ void SetTabAlign(SvxTabAdjust eAlign)
+ { aFormToken.eTabAlign = eAlign;}
+
+//---> i89791
+ //used for entry number format, in TOC only
+ //needed for different UI dialog position
+ void SetEntryNumberFormat(sal_uInt16 nSet) {
+ switch(nSet)
+ {
+ default:
+ case 0:
+ aFormToken.nChapterFormat = CF_NUMBER;
+ break;
+ case 1:
+ aFormToken.nChapterFormat = CF_NUM_NOPREPST_TITLE;
+ break;
+ }
+ }
+
+ void SetChapterInfo(sal_uInt16 nSet) {
+ switch(nSet)
+ {
+ default:
+ case 0:
+ aFormToken.nChapterFormat = CF_NUM_NOPREPST_TITLE;
+ break;
+ case 1:
+ aFormToken.nChapterFormat = CF_TITLE;
+ break;
+ case 2:
+ aFormToken.nChapterFormat = CF_NUMBER_NOPREPST;
+ break;
+ }
+ }
+//<---
+ sal_uInt16 GetChapterInfo() const{ return aFormToken.nChapterFormat;}
+
+ void SetOutlineLevel( sal_uInt16 nSet ) { aFormToken.nOutlineLevel = nSet;}//i53420
+ sal_uInt16 GetOutlineLevel() const{ return aFormToken.nOutlineLevel;}
+
+ void SetLinkEnd()
+ {
+ DBG_ASSERT(TOKEN_LINK_START == aFormToken.eTokenType,
+ "call SetLinkEnd for link start only!");
+ aFormToken.eTokenType = TOKEN_LINK_END;
+ aFormToken.sText.AssignAscii(SwForm::aFormLinkEnd);
+ SetText(aFormToken.sText);
+ }
+ void SetLinkStart()
+ {
+ DBG_ASSERT(TOKEN_LINK_END == aFormToken.eTokenType,
+ "call SetLinkStart for link start only!");
+ aFormToken.eTokenType = TOKEN_LINK_START;
+ aFormToken.sText.AssignAscii(SwForm::aFormLinkStt);
+ SetText(aFormToken.sText);
+ }
+};
+
+//---------------------------------------------------
+void SwTOXButton::KeyInput( const KeyEvent& rKEvt )
+{
+ sal_Bool bCall = sal_False;
+ KeyCode aCode = rKEvt.GetKeyCode();
+ if(aCode.GetCode() == KEY_RIGHT)
+ {
+ bNextControl = sal_True;
+ bCall = sal_True;
+ }
+ else if(aCode.GetCode() == KEY_LEFT )
+ {
+ bNextControl = sal_False;
+ bCall = sal_True;
+ }
+ else if(aCode.GetCode() == KEY_DELETE)
+ {
+ m_pParent->RemoveControl(this, sal_True);
+ //this is invalid here
+ return;
+ }
+ if(bCall && aPrevNextControlLink.IsSet())
+ aPrevNextControlLink.Call(this);
+ else
+ PushButton::KeyInput(rKEvt);
+}
+//---------------------------------------------------
+void SwTOXButton::RequestHelp( const HelpEvent& rHEvt )
+{
+ if(!m_pParent->CreateQuickHelp(this, aFormToken, rHEvt))
+ Button::RequestHelp(rHEvt);
+}
+/* -----------------------------23.12.99 14:28--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwIdxTreeListBox::SwIdxTreeListBox(SwTOXEntryTabPage* pPar, const ResId& rResId) :
+ SvTreeListBox(pPar, rResId),
+ pParent(pPar)
+{
+}
+/* -----------------------------23.12.99 14:19--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwIdxTreeListBox::RequestHelp( const HelpEvent& rHEvt )
+{
+ if( rHEvt.GetMode() & HELPMODE_QUICK )
+ {
+ Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
+ SvLBoxEntry* pEntry = GetEntry( aPos );
+ if( pEntry )
+ {
+ USHORT nLevel = static_cast< USHORT >(GetModel()->GetAbsPos(pEntry));
+ String sEntry = pParent->GetLevelHelp(++nLevel);
+ if('*' == sEntry)
+ sEntry = GetEntryText(pEntry);
+ if(sEntry.Len())
+ {
+ SvLBoxTab* pTab;
+ SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab );
+ if( pItem && SV_ITEM_ID_LBOXSTRING == pItem->IsA())
+ {
+ aPos = GetEntryPosition( pEntry );
+
+ aPos.X() = GetTabPos( pEntry, pTab );
+ Size aSize( pItem->GetSize( this, pEntry ) );
+
+ if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
+ aSize.Width() = GetSizePixel().Width() - aPos.X();
+
+ aPos = OutputToScreenPixel(aPos);
+ Rectangle aItemRect( aPos, aSize );
+ Help::ShowQuickHelp( this, aItemRect, sEntry,
+ QUICKHELP_LEFT|QUICKHELP_VCENTER );
+ }
+ }
+ }
+ }
+ else
+ SvTreeListBox::RequestHelp(rHEvt);
+}
+//---------------------------------------------------
+SwTOXEntryTabPage::SwTOXEntryTabPage(Window* pParent, const SfxItemSet& rAttrSet) :
+ SfxTabPage(pParent, SW_RES(TP_TOX_ENTRY), rAttrSet),
+ aLevelFT(this, SW_RES(FT_LEVEL )),
+ aLevelLB(this, SW_RES(LB_LEVEL )),
+
+ aTokenFT(this, SW_RES(FT_TOKEN )),
+ aTokenWIN(this, SW_RES(WIN_TOKEN )),
+ aAllLevelsPB(this, SW_RES(PB_ALL_LEVELS )),
+
+ aEntryNoPB(this, SW_RES(PB_ENTRYNO )),
+ aEntryPB(this, SW_RES(PB_ENTRY )),
+ aTabPB(this, SW_RES(PB_TAB )),
+ aChapterInfoPB(this, SW_RES(PB_CHAPTERINFO )),
+ aPageNoPB(this, SW_RES(PB_PAGENO )),
+ aHyperLinkPB(this, SW_RES(PB_HYPERLINK )),
+
+ aAuthFieldsLB(this, SW_RES(LB_AUTHFIELD )),
+ aAuthInsertPB(this, SW_RES(PB_AUTHINSERT )),
+ aAuthRemovePB(this, SW_RES(PB_AUTHREMOVE )),
+
+ aCharStyleFT(this, SW_RES(FT_CHARSTYLE )),
+ aCharStyleLB(this, SW_RES(LB_CHARSTYLE )),
+ aEditStylePB(this, SW_RES(PB_EDITSTYLE )),
+
+ aChapterEntryFT(this, SW_RES(FT_CHAPTERENTRY )),
+ aChapterEntryLB(this, SW_RES(LB_CHAPTERENTRY )),
+
+ aNumberFormatFT(this, SW_RES(FT_ENTRY_NO )),//i53420
+ aNumberFormatLB(this, SW_RES(LB_ENTRY_NO )),
+ aEntryOutlineLevelFT(this, SW_RES(FT_LEVEL_OL )),//i53420
+ aEntryOutlineLevelNF(this, SW_RES(NF_LEVEL_OL )),
+
+ aFillCharFT(this, SW_RES(FT_FILLCHAR )),
+ aFillCharCB(this, SW_RES(CB_FILLCHAR )),
+ aTabPosFT(this, SW_RES(FT_TABPOS )),
+ aTabPosMF(this, SW_RES(MF_TABPOS )),
+ aAutoRightCB(this, SW_RES(CB_AUTORIGHT )),
+ aEntryFL(this, SW_RES(FL_ENTRY )),
+
+ aRelToStyleCB(this, SW_RES(CB_RELTOSTYLE )),
+ aMainEntryStyleFT(this, SW_RES(FT_MAIN_ENTRY_STYLE)),
+ aMainEntryStyleLB(this, SW_RES(LB_MAIN_ENTRY_STYLE)),
+ aAlphaDelimCB(this, SW_RES(CB_ALPHADELIM )),
+ aCommaSeparatedCB(this, SW_RES(CB_COMMASEPARATED )),
+ aFormatFL(this, SW_RES(FL_FORMAT )),
+
+ aSortDocPosRB(this, SW_RES(RB_DOCPOS )),
+ aSortContentRB(this, SW_RES(RB_SORTCONTENT )),
+ aSortingFL(this, SW_RES(FL_SORTING )),
+
+ aFirstKeyFT(this, SW_RES(FT_FIRSTKEY )),
+ aFirstKeyLB(this, SW_RES(LB_FIRSTKEY )),
+ aFirstSortUpRB(this, SW_RES(RB_SORTUP1 )),
+ aFirstSortDownRB(this, SW_RES(RB_SORTDOWN1 )),
+
+ aSecondKeyFT(this, SW_RES(FT_SECONDKEY )),
+ aSecondKeyLB(this, SW_RES(LB_SECONDKEY )),
+ aSecondSortUpRB(this, SW_RES(RB_SORTUP2 )),
+ aSecondSortDownRB(this, SW_RES(RB_SORTDOWN2 )),
+
+ aThirdKeyFT(this, SW_RES(FT_THIRDDKEY )),
+ aThirdKeyLB(this, SW_RES(LB_THIRDKEY )),
+ aThirdSortUpRB(this, SW_RES(RB_SORTUP3 )),
+ aThirdSortDownRB(this, SW_RES(RB_SORTDOWN3 )),
+
+ aSortKeyFL(this, SW_RES(FL_SORTKEY )),
+
+ sDelimStr( SW_RES(STR_DELIM)),
+ sAuthTypeStr( SW_RES(ST_AUTHTYPE)),
+
+ sNoCharStyle( SW_RES(STR_NO_CHAR_STYLE)),
+ sNoCharSortKey( SW_RES(STR_NOSORTKEY )),
+ m_pCurrentForm(0),
+ bInLevelHdl(sal_False)
+{
+ Image aSortUpHC(SW_RES(IMG_SORTUP_HC ));
+ aFirstSortUpRB.SetModeRadioImage(aSortUpHC,BMP_COLOR_HIGHCONTRAST);
+ aSecondSortUpRB.SetModeRadioImage(aSortUpHC,BMP_COLOR_HIGHCONTRAST);
+ aThirdSortUpRB.SetModeRadioImage(aSortUpHC,BMP_COLOR_HIGHCONTRAST);
+
+ Image aSortDownHC(SW_RES(IMG_SORTDOWN_HC ));
+ aFirstSortDownRB.SetModeRadioImage(aSortDownHC,BMP_COLOR_HIGHCONTRAST);
+ aSecondSortDownRB.SetModeRadioImage(aSortDownHC,BMP_COLOR_HIGHCONTRAST);
+ aThirdSortDownRB.SetModeRadioImage(aSortDownHC,BMP_COLOR_HIGHCONTRAST);
+ FreeResource();
+
+ sLevelStr = aLevelFT.GetText();
+ aLevelLB.SetStyle( aLevelLB.GetStyle() | WB_HSCROLL );
+ aLevelLB.SetSpaceBetweenEntries(0);
+ aLevelLB.SetSelectionMode( SINGLE_SELECTION );
+ aLevelLB.SetHighlightRange(); // select full width
+ aLevelLB.SetHelpId(HID_INSERT_INDEX_ENTRY_LEVEL_LB);
+ aLevelLB.Show();
+
+ aLastTOXType.eType = (TOXTypes)USHRT_MAX;
+ aLastTOXType.nIndex = 0;
+ //aLevelGBSize = aLevelGB.GetSizePixel();
+ aLevelFLSize = aLevelFT.GetSizePixel();
+
+ SetExchangeSupport();
+ aEntryNoPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, InsertTokenHdl));
+ aEntryPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, InsertTokenHdl));
+ aChapterInfoPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, InsertTokenHdl));
+ aPageNoPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, InsertTokenHdl));
+ aTabPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, InsertTokenHdl));
+ aHyperLinkPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, InsertTokenHdl));
+ aEditStylePB.SetClickHdl(LINK(this, SwTOXEntryTabPage, EditStyleHdl));
+ aLevelLB.SetSelectHdl(LINK(this, SwTOXEntryTabPage, LevelHdl));
+ aTokenWIN.SetButtonSelectedHdl(LINK(this, SwTOXEntryTabPage, TokenSelectedHdl));
+ aTokenWIN.SetModifyHdl(LINK(this, SwTOXEntryTabPage, ModifyHdl));
+ aCharStyleLB.SetSelectHdl(LINK(this, SwTOXEntryTabPage, StyleSelectHdl));
+ aCharStyleLB.InsertEntry(sNoCharStyle);
+ aChapterEntryLB.SetSelectHdl(LINK(this, SwTOXEntryTabPage, ChapterInfoHdl));
+ aEntryOutlineLevelNF.SetModifyHdl(LINK(this, SwTOXEntryTabPage, ChapterInfoOutlineHdl));
+ aNumberFormatLB.SetSelectHdl(LINK(this, SwTOXEntryTabPage, NumberFormatHdl));
+
+ aTabPosMF.SetModifyHdl(LINK(this, SwTOXEntryTabPage, TabPosHdl));
+ aFillCharCB.SetModifyHdl(LINK(this, SwTOXEntryTabPage, FillCharHdl));
+ aAutoRightCB.SetClickHdl(LINK(this, SwTOXEntryTabPage, AutoRightHdl));
+ aAuthInsertPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, RemoveInsertAuthHdl));
+ aAuthRemovePB.SetClickHdl(LINK(this, SwTOXEntryTabPage, RemoveInsertAuthHdl));
+ aSortDocPosRB.SetClickHdl(LINK(this, SwTOXEntryTabPage, SortKeyHdl));
+ aSortContentRB.SetClickHdl(LINK(this, SwTOXEntryTabPage, SortKeyHdl));
+ aAllLevelsPB.SetClickHdl(LINK(this, SwTOXEntryTabPage, AllLevelsHdl));
+
+ aAlphaDelimCB.SetClickHdl(LINK(this, SwTOXEntryTabPage, ModifyHdl));
+ aCommaSeparatedCB.SetClickHdl(LINK(this, SwTOXEntryTabPage, ModifyHdl));
+ aRelToStyleCB.SetClickHdl(LINK(this, SwTOXEntryTabPage, ModifyHdl));
+
+ FieldUnit aMetric = ::GetDfltMetric(FALSE);
+ SetMetric(aTabPosMF, aMetric);
+
+ aSortDocPosRB.Check();
+
+ aFillCharCB.SetMaxTextLen(1);
+ aFillCharCB.InsertEntry(' ');
+ aFillCharCB.InsertEntry('.');
+ aFillCharCB.InsertEntry('-');
+ aFillCharCB.InsertEntry('_');
+
+ aButtonPositions[0] = aEntryNoPB.GetPosPixel();
+ aButtonPositions[1] = aEntryPB.GetPosPixel();
+ aButtonPositions[2] = aChapterInfoPB.GetPosPixel();
+ aButtonPositions[3] = aPageNoPB.GetPosPixel();
+ aButtonPositions[4] = aTabPB.GetPosPixel();
+
+ aRelToStylePos = aRelToStyleCB.GetPosPixel();
+ aRelToStyleIdxPos = aCommaSeparatedCB.GetPosPixel();
+ aRelToStyleIdxPos.Y() +=
+ (aRelToStyleIdxPos.Y() - aAlphaDelimCB.GetPosPixel().Y());
+ aEditStylePB.Enable(sal_False);
+
+//get position for Numbering and other stuff
+ aChapterEntryFTPosition = aChapterEntryFT.GetPosPixel();
+ aEntryOutlineLevelFTPosition = aEntryOutlineLevelFT.GetPosPixel();
+ nBiasToEntryPoint = aEntryOutlineLevelNF.GetPosPixel().X() -
+ aEntryOutlineLevelFT.GetPosPixel().X();
+
+ //fill the types in
+ USHORT i;
+ for( i = 0; i < AUTH_FIELD_END; i++)
+ {
+ String sTmp(SW_RES(STR_AUTH_FIELD_START + i));
+ sal_uInt16 nPos = aAuthFieldsLB.InsertEntry(sTmp);
+ aAuthFieldsLB.SetEntryData(nPos, reinterpret_cast< void * >(sal::static_int_cast< sal_uIntPtr >(i)));
+ }
+ sal_uInt16 nPos = aFirstKeyLB.InsertEntry(sNoCharSortKey);
+ aFirstKeyLB.SetEntryData(nPos, reinterpret_cast< void * >(sal::static_int_cast< sal_uIntPtr >(USHRT_MAX)));
+ nPos = aSecondKeyLB.InsertEntry(sNoCharSortKey);
+ aSecondKeyLB.SetEntryData(nPos, reinterpret_cast< void * >(sal::static_int_cast< sal_uIntPtr >(USHRT_MAX)));
+ nPos = aThirdKeyLB.InsertEntry(sNoCharSortKey);
+ aThirdKeyLB.SetEntryData(nPos, reinterpret_cast< void * >(sal::static_int_cast< sal_uIntPtr >(USHRT_MAX)));
+
+ for( i = 0; i < AUTH_FIELD_END; i++)
+ {
+ String sTmp(aAuthFieldsLB.GetEntry(i));
+ void* pEntryData = aAuthFieldsLB.GetEntryData(i);
+ nPos = aFirstKeyLB.InsertEntry(sTmp);
+ aFirstKeyLB.SetEntryData(nPos, pEntryData);
+ nPos = aSecondKeyLB.InsertEntry(sTmp);
+ aSecondKeyLB.SetEntryData(nPos, pEntryData);
+ nPos = aThirdKeyLB.InsertEntry(sTmp);
+ aThirdKeyLB.SetEntryData(nPos, pEntryData);
+ }
+ aFirstKeyLB.SelectEntryPos(0);
+ aSecondKeyLB.SelectEntryPos(0);
+ aThirdKeyLB.SelectEntryPos(0);
+}
+/* -----------------30.11.99 13:37-------------------
+ pVoid is used as signal to change all levels of the example
+ --------------------------------------------------*/
+IMPL_LINK(SwTOXEntryTabPage, ModifyHdl, void*, pVoid)
+{
+ UpdateDescriptor();
+ SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog();
+
+ if(pTOXDlg)
+ {
+ sal_uInt16 nCurLevel = static_cast< sal_uInt16 >(aLevelLB.GetModel()->GetAbsPos(aLevelLB.FirstSelected()) + 1);
+ if(aLastTOXType.eType == TOX_CONTENT && pVoid)
+ nCurLevel = USHRT_MAX;
+ pTOXDlg->CreateOrUpdateExample(
+ pTOXDlg->GetCurrentTOXType().eType, TOX_PAGE_ENTRY, nCurLevel);
+ }
+ return 0;
+}
+
+/*-- 16.06.99 10:47:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwTOXEntryTabPage::~SwTOXEntryTabPage()
+{
+}
+/*-- 16.06.99 10:47:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwTOXEntryTabPage::FillItemSet( SfxItemSet& )
+{
+ // nothing to do
+ return sal_True;
+}
+/*-- 16.06.99 10:47:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwTOXEntryTabPage::Reset( const SfxItemSet& )
+{
+ SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog();
+ const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
+ m_pCurrentForm = pTOXDlg->GetForm(aCurType);
+ if(TOX_INDEX == aCurType.eType)
+ {
+ SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aCurType);
+ String sMainEntryCharStyle = rDesc.GetMainEntryCharStyle();
+ if(sMainEntryCharStyle.Len())
+ {
+ if( LISTBOX_ENTRY_NOTFOUND ==
+ aMainEntryStyleLB.GetEntryPos(sMainEntryCharStyle))
+ aMainEntryStyleLB.InsertEntry(
+ sMainEntryCharStyle);
+ aMainEntryStyleLB.SelectEntry(sMainEntryCharStyle);
+ }
+ else
+ aMainEntryStyleLB.SelectEntry(sNoCharStyle);
+ aAlphaDelimCB.Check( 0 != (rDesc.GetIndexOptions() & nsSwTOIOptions::TOI_ALPHA_DELIMITTER) );
+ }
+ aRelToStyleCB.Check(m_pCurrentForm->IsRelTabPos());
+ aCommaSeparatedCB.Check(m_pCurrentForm->IsCommaSeparated());
+}
+/*-- 16.06.99 10:47:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_ChgWidth(Window& rWin, long nDiff)
+{
+ Size aTempSz(rWin.GetSizePixel());
+ aTempSz.Width() += nDiff;
+ rWin.SetSizePixel(aTempSz);
+}
+/* ----------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void lcl_ChgXPos(Window& rWin, long nDiff)
+{
+ Point aTempPos(rWin.GetPosPixel());
+ aTempPos.X() += nDiff;
+ rWin.SetPosPixel(aTempPos);
+}
+/* ----------------------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwTOXEntryTabPage::ActivatePage( const SfxItemSet& /*rSet*/)
+{
+ SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog();
+ const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
+
+ m_pCurrentForm = pTOXDlg->GetForm(aCurType);
+ if( !( aLastTOXType == aCurType ))
+ {
+ BOOL bToxIsAuthorities = TOX_AUTHORITIES == aCurType.eType;
+ BOOL bToxIsIndex = TOX_INDEX == aCurType.eType;
+ BOOL bToxIsContent = TOX_CONTENT == aCurType.eType;
+
+ aLevelLB.Clear();
+ for(sal_uInt16 i = 1; i < m_pCurrentForm->GetFormMax(); i++)
+ {
+ if(bToxIsAuthorities)
+ aLevelLB.InsertEntry( SwAuthorityFieldType::GetAuthTypeName(
+ (ToxAuthorityType) (i - 1)) );
+ else if( bToxIsIndex )
+ {
+ if(i == 1)
+ aLevelLB.InsertEntry( sDelimStr );
+ else
+ aLevelLB.InsertEntry( String::CreateFromInt32(i - 1) );
+ }
+ else
+ aLevelLB.InsertEntry(String::CreateFromInt32(i));
+ }
+ if(bToxIsAuthorities)
+ {
+ //
+ SwWrtShell& rSh = pTOXDlg->GetWrtShell();
+ const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
+ rSh.GetFldType(RES_AUTHORITY, aEmptyStr);
+ if(pFType)
+ {
+ if(pFType->IsSortByDocument())
+ aSortDocPosRB.Check();
+ else
+ {
+ aSortContentRB.Check();
+ sal_uInt16 nKeyCount = pFType->GetSortKeyCount();
+ if(0 < nKeyCount)
+ {
+ const SwTOXSortKey* pKey = pFType->GetSortKey(0);
+ aFirstKeyLB.SelectEntryPos(
+ aFirstKeyLB.GetEntryPos((void*)(sal_uInt32)pKey->eField));
+ aFirstSortUpRB.Check(pKey->bSortAscending);
+ aFirstSortDownRB.Check(!pKey->bSortAscending);
+ }
+ if(1 < nKeyCount)
+ {
+ const SwTOXSortKey* pKey = pFType->GetSortKey(1);
+ aSecondKeyLB.SelectEntryPos(
+ aSecondKeyLB.GetEntryPos((void*)(sal_uInt32)pKey->eField));
+ aSecondSortUpRB.Check(pKey->bSortAscending);
+ aSecondSortDownRB.Check(!pKey->bSortAscending);
+ }
+ if(2 < nKeyCount)
+ {
+ const SwTOXSortKey* pKey = pFType->GetSortKey(2);
+ aThirdKeyLB.SelectEntryPos(
+ aThirdKeyLB.GetEntryPos((void*)(sal_uInt32)pKey->eField));
+ aThirdSortUpRB.Check(pKey->bSortAscending);
+ aThirdSortDownRB.Check(!pKey->bSortAscending);
+ }
+ }
+ }
+ SortKeyHdl(aSortDocPosRB.IsChecked() ? &aSortDocPosRB : &aSortContentRB);
+ aLevelFT.SetText(sAuthTypeStr);
+ }
+ else
+ aLevelFT.SetText(sLevelStr);
+
+ long nDiff = 0;
+ if( bToxIsAuthorities ? aLevelFT.GetSizePixel() == aLevelFLSize
+ : aLevelFT.GetSizePixel() != aLevelFLSize )
+ {
+ nDiff = aLevelFLSize.Width();
+ if( !bToxIsAuthorities )
+ nDiff *= -1;
+ }
+
+ if(nDiff)
+ {
+// lcl_ChgWidth(aLevelFL, nDiff);
+ lcl_ChgWidth(aLevelFT, nDiff);
+ lcl_ChgWidth(aLevelLB, nDiff);
+ lcl_ChgXPos(aCharStyleFT, nDiff);
+ lcl_ChgXPos(aCharStyleLB, nDiff);
+ lcl_ChgWidth(aCharStyleLB, -nDiff);
+ // lcl_ChgXPos(aEditStylePB, -nDiff);
+ lcl_ChgXPos(aFillCharFT, nDiff);
+ lcl_ChgXPos(aFillCharCB, nDiff);
+ lcl_ChgXPos(aTabPosFT, nDiff);
+ lcl_ChgXPos(aTabPosMF, nDiff);
+ lcl_ChgXPos(aAutoRightCB, nDiff);
+ lcl_ChgXPos(aAuthFieldsLB, nDiff);
+ lcl_ChgXPos(aAuthInsertPB, nDiff);
+ lcl_ChgXPos(aAuthRemovePB, nDiff);
+ lcl_ChgXPos(aTokenFT, nDiff);
+ lcl_ChgXPos(aTokenWIN, nDiff);
+ lcl_ChgWidth(aTokenWIN, -nDiff);
+ lcl_ChgXPos(aSortDocPosRB, nDiff);
+ lcl_ChgXPos(aSortContentRB, nDiff);
+ lcl_ChgXPos(aFormatFL, nDiff);
+ lcl_ChgWidth(aFormatFL, -nDiff);
+ lcl_ChgXPos(aSortingFL, nDiff);
+ lcl_ChgWidth(aSortingFL, -nDiff);
+ lcl_ChgXPos(aEntryFL, nDiff);
+ lcl_ChgWidth(aEntryFL, -nDiff);
+
+ lcl_ChgXPos(aFirstKeyFT, nDiff);
+ lcl_ChgXPos(aFirstKeyLB, nDiff);
+ lcl_ChgXPos(aSecondKeyFT, nDiff);
+ lcl_ChgXPos(aSecondKeyLB, nDiff);
+ lcl_ChgXPos(aThirdKeyFT, nDiff);
+ lcl_ChgXPos(aThirdKeyLB, nDiff);
+ lcl_ChgXPos(aSortKeyFL, nDiff);
+
+ lcl_ChgWidth(aFirstKeyLB, -nDiff);
+ lcl_ChgWidth(aSecondKeyLB, -nDiff);
+ lcl_ChgWidth(aThirdKeyLB, -nDiff);
+ lcl_ChgWidth(aSortKeyFL, -nDiff);
+ }
+ Link aLink = aLevelLB.GetSelectHdl();
+ aLevelLB.SetSelectHdl(Link());
+ aLevelLB.Select( aLevelLB.GetEntry( bToxIsIndex ? 1 : 0 ) );
+ aLevelLB.SetSelectHdl(aLink);
+
+ // sort token buttons
+ aEntryNoPB.SetPosPixel(aButtonPositions[0]);
+ aEntryPB.SetPosPixel(aButtonPositions[ bToxIsContent ? 1 : 0]);
+ aChapterInfoPB.SetPosPixel(aButtonPositions[2]);
+ aPageNoPB.SetPosPixel(aButtonPositions[3]);
+ sal_uInt16 nBtPos = 1;
+ if( bToxIsContent )
+ nBtPos = 2;
+ else if( bToxIsAuthorities )
+ nBtPos = 4;
+ aTabPB.SetPosPixel(aButtonPositions[nBtPos]);
+ aHyperLinkPB.SetPosPixel(aButtonPositions[4]);
+
+ //show or hide controls
+ aEntryNoPB.Show( bToxIsContent );
+ aHyperLinkPB.Show( bToxIsContent );
+ aRelToStyleCB.Show( !bToxIsAuthorities );
+ aChapterInfoPB.Show( !bToxIsContent && !bToxIsAuthorities);
+ aEntryPB.Show( !bToxIsAuthorities );
+ aPageNoPB.Show( !bToxIsAuthorities );
+ aAuthFieldsLB.Show( bToxIsAuthorities );
+ aAuthInsertPB.Show( bToxIsAuthorities );
+ aAuthRemovePB.Show( bToxIsAuthorities );
+ aFormatFL.Show( !bToxIsAuthorities );
+ aSortDocPosRB.Show( bToxIsAuthorities );
+ aSortContentRB.Show( bToxIsAuthorities );
+ aSortingFL.Show( bToxIsAuthorities );
+ aFirstKeyFT.Show( bToxIsAuthorities );
+ aFirstKeyLB.Show( bToxIsAuthorities );
+ aSecondKeyFT.Show( bToxIsAuthorities );
+ aSecondKeyLB.Show( bToxIsAuthorities );
+ aThirdKeyFT.Show( bToxIsAuthorities );
+ aThirdKeyLB.Show( bToxIsAuthorities );
+ aSortKeyFL.Show( bToxIsAuthorities );
+ aFirstSortUpRB.Show( bToxIsAuthorities );
+ aFirstSortDownRB.Show( bToxIsAuthorities );
+ aSecondSortUpRB.Show( bToxIsAuthorities );
+ aSecondSortDownRB.Show( bToxIsAuthorities );
+ aThirdSortUpRB.Show( bToxIsAuthorities );
+ aThirdSortDownRB.Show( bToxIsAuthorities );
+
+ aRelToStyleCB.SetPosPixel( bToxIsIndex ? aRelToStyleIdxPos
+ : aRelToStylePos );
+
+// aRecalcTabCB.Show( aCurType.eType == TOX_CONTENT);
+
+ aMainEntryStyleFT.Show( bToxIsIndex );
+ aMainEntryStyleLB.Show( bToxIsIndex );
+ aAlphaDelimCB.Show( bToxIsIndex );
+ aCommaSeparatedCB.Show( bToxIsIndex );
+ }
+ aLastTOXType = aCurType;
+
+ //invalidate PatternWindow
+ aTokenWIN.SetInvalid();
+ LevelHdl(&aLevelLB);
+}
+/* -----------------30.11.99 15:04-------------------
+
+ --------------------------------------------------*/
+void SwTOXEntryTabPage::UpdateDescriptor()
+{
+ WriteBackLevel();
+ SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog();
+ SwTOXDescription& rDesc = pTOXDlg->GetTOXDescription(aLastTOXType);
+ if(TOX_INDEX == aLastTOXType.eType)
+ {
+ String sTemp(aMainEntryStyleLB.GetSelectEntry());
+ rDesc.SetMainEntryCharStyle(sNoCharStyle == sTemp ? aEmptyStr : sTemp);
+ sal_uInt16 nIdxOptions = rDesc.GetIndexOptions() & ~nsSwTOIOptions::TOI_ALPHA_DELIMITTER;
+ if(aAlphaDelimCB.IsChecked())
+ nIdxOptions |= nsSwTOIOptions::TOI_ALPHA_DELIMITTER;
+ rDesc.SetIndexOptions(nIdxOptions);
+ }
+ else if(TOX_AUTHORITIES == aLastTOXType.eType)
+ {
+ rDesc.SetSortByDocument(aSortDocPosRB.IsChecked());
+ SwTOXSortKey aKey1, aKey2, aKey3;
+ aKey1.eField = (ToxAuthorityField)(sal_uIntPtr)aFirstKeyLB.GetEntryData(
+ aFirstKeyLB.GetSelectEntryPos());
+ aKey1.bSortAscending = aFirstSortUpRB.IsChecked();
+ aKey2.eField = (ToxAuthorityField)(sal_uIntPtr)aSecondKeyLB.GetEntryData(
+ aSecondKeyLB.GetSelectEntryPos());
+ aKey2.bSortAscending = aSecondSortUpRB.IsChecked();
+ aKey3.eField = (ToxAuthorityField)(sal_uIntPtr)aThirdKeyLB.GetEntryData(
+ aThirdKeyLB.GetSelectEntryPos());
+ aKey3.bSortAscending = aThirdSortUpRB.IsChecked();
+
+
+ rDesc.SetSortKeys(aKey1, aKey2, aKey3);
+ }
+ SwForm* pCurrentForm = pTOXDlg->GetForm(aLastTOXType);
+ if(aRelToStyleCB.IsVisible())
+ {
+ pCurrentForm->SetRelTabPos(aRelToStyleCB.IsChecked());
+ }
+ if(aCommaSeparatedCB.IsVisible())
+ pCurrentForm->SetCommaSeparated(aCommaSeparatedCB.IsChecked());
+}
+/*-- 16.06.99 10:47:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+int SwTOXEntryTabPage::DeactivatePage( SfxItemSet* /*pSet*/)
+{
+ UpdateDescriptor();
+ return LEAVE_PAGE;
+}
+/*-- 16.06.99 10:47:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxTabPage* SwTOXEntryTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet)
+{
+ return new SwTOXEntryTabPage(pParent, rAttrSet);
+}
+/*-- 16.06.99 10:47:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwTOXEntryTabPage, EditStyleHdl, PushButton*, pBtn)
+{
+ if( LISTBOX_ENTRY_NOTFOUND != aCharStyleLB.GetSelectEntryPos())
+ {
+ SfxStringItem aStyle(SID_STYLE_EDIT, aCharStyleLB.GetSelectEntry());
+ SfxUInt16Item aFamily(SID_STYLE_FAMILY, SFX_STYLE_FAMILY_CHAR);
+ // TODO: WrtShell?
+// SwPtrItem aShell(FN_PARAM_WRTSHELL, pWrtShell);
+ Window* pDefDlgParent = Application::GetDefDialogParent();
+ Application::SetDefDialogParent( pBtn );
+ ((SwMultiTOXTabDialog*)GetTabDialog())->GetWrtShell().
+ GetView().GetViewFrame()->GetDispatcher()->Execute(
+ SID_STYLE_EDIT, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_MODAL,
+ &aStyle, &aFamily/*, &aShell*/, 0L);
+ Application::SetDefDialogParent( pDefDlgParent );
+ }
+ return 0;
+}
+/* -----------------04.10.99 11:34-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTOXEntryTabPage, RemoveInsertAuthHdl, PushButton*, pButton)
+{
+ sal_Bool bInsert = pButton == &aAuthInsertPB;
+ if(bInsert)
+ {
+ sal_uInt16 nSelPos = aAuthFieldsLB.GetSelectEntryPos();
+ String sToInsert(aAuthFieldsLB.GetSelectEntry());
+ SwFormToken aInsert(TOKEN_AUTHORITY);
+ aInsert.nAuthorityField = (sal_uInt16)(sal_uIntPtr)aAuthFieldsLB.GetEntryData(nSelPos);
+ aTokenWIN.InsertAtSelection(String::CreateFromAscii(
+ SwForm::aFormAuth), aInsert);
+ aAuthFieldsLB.RemoveEntry(sToInsert);
+ aAuthFieldsLB.SelectEntryPos( nSelPos ? nSelPos - 1 : 0);
+ }
+ else
+ {
+ Control* pCtrl = aTokenWIN.GetActiveControl();
+ DBG_ASSERT(WINDOW_EDIT != pCtrl->GetType(), "Remove should be disabled");
+ if( WINDOW_EDIT != pCtrl->GetType() )
+ {
+ //fill it into the ListBox
+ const SwFormToken& rToken = ((SwTOXButton*)pCtrl)->GetFormToken();
+ PreTokenButtonRemoved(rToken);
+ aTokenWIN.RemoveControl((SwTOXButton*)pCtrl);
+ }
+ }
+ ModifyHdl(0);
+ return 0;
+}
+/* -----------------------------17.01.00 13:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwTOXEntryTabPage::PreTokenButtonRemoved(const SwFormToken& rToken)
+{
+ //fill it into the ListBox
+ sal_uInt32 nData = rToken.nAuthorityField;
+ String sTemp(SW_RES(STR_AUTH_FIELD_START + nData));
+ sal_uInt16 nPos = aAuthFieldsLB.InsertEntry(sTemp);
+ aAuthFieldsLB.SetEntryData(nPos, (void*)(nData));
+}
+/*-- 16.06.99 10:47:35---------------------------------------------------
+
+This function inizializes the default value in the Token
+put here the UI dependent initializations
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwTOXEntryTabPage, InsertTokenHdl, PushButton*, pBtn)
+{
+ String sText;
+ FormTokenType eTokenType = TOKEN_ENTRY_NO;
+ String sCharStyle;
+ USHORT nChapterFormat = CF_NUMBER; // i89791
+ if(pBtn == &aEntryNoPB)
+ {
+ sText.AssignAscii(SwForm::aFormEntryNum);
+ eTokenType = TOKEN_ENTRY_NO;
+ }
+ else if(pBtn == &aEntryPB)
+ {
+ if( TOX_CONTENT == m_pCurrentForm->GetTOXType() )
+ {
+ sText.AssignAscii( SwForm::aFormEntryTxt );
+ eTokenType = TOKEN_ENTRY_TEXT;
+ }
+ else
+ {
+ sText.AssignAscii( SwForm::aFormEntry);
+ eTokenType = TOKEN_ENTRY;
+ }
+ }
+ else if(pBtn == &aChapterInfoPB)
+ {
+ sText.AssignAscii( SwForm::aFormChapterMark);
+ eTokenType = TOKEN_CHAPTER_INFO;
+ nChapterFormat = CF_NUM_NOPREPST_TITLE; // i89791
+ }
+ else if(pBtn == &aPageNoPB)
+ {
+ sText.AssignAscii(SwForm::aFormPageNums);
+ eTokenType = TOKEN_PAGE_NUMS;
+ }
+ else if(pBtn == &aHyperLinkPB)
+ {
+ sText.AssignAscii(SwForm::aFormLinkStt);
+ eTokenType = TOKEN_LINK_START;
+ sCharStyle = String(SW_RES(STR_POOLCHR_INET_NORMAL));
+ }
+ else if(pBtn == &aTabPB)
+ {
+ sText.AssignAscii(SwForm::aFormTab);
+ eTokenType = TOKEN_TAB_STOP;
+ }
+ SwFormToken aInsert(eTokenType);
+ aInsert.sCharStyleName = sCharStyle;
+ aInsert.nTabStopPosition = 0;
+ aInsert.nChapterFormat = nChapterFormat; // i89791
+ aTokenWIN.InsertAtSelection(sText, aInsert);
+ ModifyHdl(0);
+ return 0;
+}
+/* -----------------------------14.01.00 11:53--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwTOXEntryTabPage, AllLevelsHdl, PushButton*, EMPTYARG)
+{
+ //get current level
+ //write it into all levels
+ if(aTokenWIN.IsValid())
+ {
+ String sNewToken = aTokenWIN.GetPattern();
+ for(sal_uInt16 i = 1; i < m_pCurrentForm->GetFormMax(); i++)
+ m_pCurrentForm->SetPattern(i, sNewToken);
+ //
+ ModifyHdl(this);
+ }
+ return 0;
+}
+
+/* -----------------02.12.99 12:40-------------------
+
+ --------------------------------------------------*/
+void SwTOXEntryTabPage::WriteBackLevel()
+{
+ if(aTokenWIN.IsValid())
+ {
+ String sNewToken = aTokenWIN.GetPattern();
+ sal_uInt16 nLastLevel = aTokenWIN.GetLastLevel();
+ if(nLastLevel != USHRT_MAX)
+ m_pCurrentForm->SetPattern(nLastLevel + 1, sNewToken );
+ }
+}
+/*-- 16.06.99 10:47:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwTOXEntryTabPage, LevelHdl, SvTreeListBox*, pBox)
+{
+ if(bInLevelHdl)
+ return 0;
+ bInLevelHdl = sal_True;
+ WriteBackLevel();
+
+ sal_uInt16 nLevel = static_cast< sal_uInt16 >(pBox->GetModel()->GetAbsPos(pBox->FirstSelected()));
+ aTokenWIN.SetForm(*m_pCurrentForm, nLevel);
+ if(TOX_AUTHORITIES == m_pCurrentForm->GetTOXType())
+ {
+ //fill the types in
+ aAuthFieldsLB.Clear();
+ for( sal_uInt32 i = 0; i < AUTH_FIELD_END; i++)
+ {
+ String sTmp(SW_RES(STR_AUTH_FIELD_START + i));
+ sal_uInt16 nPos = aAuthFieldsLB.InsertEntry(sTmp);
+ aAuthFieldsLB.SetEntryData(nPos, (void*)(i));
+ }
+
+ // #i21237#
+ SwFormTokens aPattern = m_pCurrentForm->GetPattern(nLevel + 1);
+ SwFormTokens::iterator aIt = aPattern.begin();;
+
+ while(aIt != aPattern.end())
+ {
+ SwFormToken aToken = *aIt; // #i21237#
+ if(TOKEN_AUTHORITY == aToken.eTokenType)
+ {
+ sal_uInt32 nSearch = aToken.nAuthorityField;
+ sal_uInt16 nLstBoxPos = aAuthFieldsLB.GetEntryPos( (void*) nSearch );
+ DBG_ASSERT(LISTBOX_ENTRY_NOTFOUND != nLstBoxPos, "Entry not found?");
+ aAuthFieldsLB.RemoveEntry(nLstBoxPos);
+ }
+
+ aIt++; // #i21237#
+ }
+ aAuthFieldsLB.SelectEntryPos(0);
+ }
+ bInLevelHdl = sal_False;
+ pBox->GrabFocus();
+ return 0;
+}
+/* -----------------20.10.99 13:16-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTOXEntryTabPage, SortKeyHdl, RadioButton*, pButton)
+{
+ sal_Bool bEnable = &aSortContentRB == pButton;
+ aFirstKeyFT.Enable(bEnable);
+ aFirstKeyLB.Enable(bEnable);
+ aSecondKeyFT.Enable(bEnable);
+ aSecondKeyLB.Enable(bEnable);
+ aThirdKeyFT.Enable(bEnable);
+ aThirdKeyLB.Enable(bEnable);
+ aSortKeyFL.Enable(bEnable);
+ aFirstSortUpRB.Enable(bEnable);
+ aFirstSortDownRB.Enable(bEnable);
+ aSecondSortUpRB.Enable(bEnable);
+ aSecondSortDownRB.Enable(bEnable);
+ aThirdSortUpRB.Enable(bEnable);
+ aThirdSortDownRB.Enable(bEnable);
+ return 0;
+}
+/* -----------------01.07.99 12:21-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTOXEntryTabPage, TokenSelectedHdl, SwFormToken*, pToken)
+{
+ if(pToken->sCharStyleName.Len())
+ aCharStyleLB.SelectEntry(pToken->sCharStyleName);
+ else
+ aCharStyleLB.SelectEntry(sNoCharStyle);
+ //StyleSelectHdl(&aCharStyleLB);
+
+ String sEntry = aCharStyleLB.GetSelectEntry();
+ aEditStylePB.Enable(sEntry != sNoCharStyle);
+
+ if(pToken->eTokenType == TOKEN_CHAPTER_INFO)
+ {
+//---> i89791
+ switch(pToken->nChapterFormat)
+ {
+ default:
+ aChapterEntryLB.SetNoSelection();//to alert the user
+ break;
+ case CF_NUM_NOPREPST_TITLE:
+ aChapterEntryLB.SelectEntryPos(0);
+ break;
+ case CF_TITLE:
+ aChapterEntryLB.SelectEntryPos(1);
+ break;
+ case CF_NUMBER_NOPREPST:
+ aChapterEntryLB.SelectEntryPos(2);
+ break;
+ }
+//<---
+//i53420
+//move into position the fixed text
+// aEntryOutlineLevelFT.SetPosPixel( aEntryOutlineLevelFTPosition );
+// // then the entry
+// Point aPoint;
+// aPoint.Y() = aEntryOutlineLevelFTPosition.Y();
+// aPoint.X() = aEntryOutlineLevelFTPosition.X() + nBiasToEntryPoint;
+// aEntryOutlineLevelNF.SetPosPixel( aPoint );
+
+ aEntryOutlineLevelNF.SetValue(pToken->nOutlineLevel);
+ }
+
+//i53420
+ if(pToken->eTokenType == TOKEN_ENTRY_NO)
+ {
+//move into position the fixed text
+// aEntryOutlineLevelFT.SetPosPixel( aChapterEntryFTPosition );
+// // then the entry
+// Point aPoint;
+// aPoint.Y() = aChapterEntryFTPosition.Y();
+// aPoint.X() = aChapterEntryFTPosition.X() + nBiasToEntryPoint;
+// aEntryOutlineLevelNF.SetPosPixel( aPoint );
+
+ aEntryOutlineLevelNF.SetValue(pToken->nOutlineLevel);
+ sal_uInt16 nFormat = 0;
+ if( pToken->nChapterFormat == CF_NUM_NOPREPST_TITLE )
+ nFormat = 1;
+ aNumberFormatLB.SelectEntryPos(nFormat);
+ }
+
+ sal_Bool bTabStop = TOKEN_TAB_STOP == pToken->eTokenType;
+ aFillCharFT.Show(bTabStop);
+ aFillCharCB.Show(bTabStop);
+ aTabPosFT.Show(bTabStop);
+ aTabPosMF.Show(bTabStop);
+ aAutoRightCB.Show(bTabStop);
+ aAutoRightCB.Enable(bTabStop);
+ if(bTabStop)
+ {
+ aTabPosMF.SetValue(aTabPosMF.Normalize(pToken->nTabStopPosition), FUNIT_TWIP);
+ aAutoRightCB.Check(SVX_TAB_ADJUST_END == pToken->eTabAlign);
+ aFillCharCB.SetText(pToken->cTabFillChar);
+ aTabPosFT.Enable(!aAutoRightCB.IsChecked());
+ aTabPosMF.Enable(!aAutoRightCB.IsChecked());
+ }
+ else
+ {
+ aTabPosMF.Enable(sal_False);
+ }
+
+ sal_Bool bIsChapterInfo = pToken->eTokenType == TOKEN_CHAPTER_INFO;
+ sal_Bool bIsEntryNumber = pToken->eTokenType == TOKEN_ENTRY_NO;
+ aChapterEntryFT.Show( bIsChapterInfo );
+ aChapterEntryLB.Show( bIsChapterInfo );
+ aEntryOutlineLevelFT.Show( bIsChapterInfo || bIsEntryNumber );
+ aEntryOutlineLevelNF.Show( bIsChapterInfo || bIsEntryNumber );
+ aNumberFormatFT.Show( bIsEntryNumber );
+ aNumberFormatLB.Show( bIsEntryNumber );
+
+
+ //now enable the visible buttons
+ //- inserting the same type of control is not allowed
+ //- some types of controls can only appear once (EntryText EntryNumber)
+
+ if(aEntryNoPB.IsVisible())
+ {
+ aEntryNoPB.Enable(TOKEN_ENTRY_NO != pToken->eTokenType );
+ }
+ if(aEntryPB.IsVisible())
+ {
+ aEntryPB.Enable(TOKEN_ENTRY_TEXT != pToken->eTokenType &&
+ !aTokenWIN.Contains(TOKEN_ENTRY_TEXT)
+ && !aTokenWIN.Contains(TOKEN_ENTRY));
+ }
+
+ if(aChapterInfoPB.IsVisible())
+ {
+ aChapterInfoPB.Enable(TOKEN_CHAPTER_INFO != pToken->eTokenType);
+ }
+ if(aPageNoPB.IsVisible())
+ {
+ aPageNoPB.Enable(TOKEN_PAGE_NUMS != pToken->eTokenType &&
+ !aTokenWIN.Contains(TOKEN_PAGE_NUMS));
+ }
+ if(aTabPB.IsVisible())
+ {
+ aTabPB.Enable(!bTabStop);
+ }
+ if(aHyperLinkPB.IsVisible())
+ {
+ aHyperLinkPB.Enable(TOKEN_LINK_START != pToken->eTokenType &&
+ TOKEN_LINK_END != pToken->eTokenType);
+ }
+ //table of authorities
+ if(aAuthInsertPB.IsVisible())
+ {
+ sal_Bool bText = TOKEN_TEXT == pToken->eTokenType;
+ aAuthInsertPB.Enable(bText && aAuthFieldsLB.GetSelectEntry().Len());
+ aAuthRemovePB.Enable(!bText);
+ }
+
+ return 0;
+}
+/* -----------------01.07.99 12:36-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTOXEntryTabPage, StyleSelectHdl, ListBox*, pBox)
+{
+ String sEntry = pBox->GetSelectEntry();
+ sal_uInt16 nId = (sal_uInt16)(long)pBox->GetEntryData(pBox->GetSelectEntryPos());
+ aEditStylePB.Enable(sEntry != sNoCharStyle);
+ if(sEntry == sNoCharStyle)
+ sEntry.Erase();
+ Control* pCtrl = aTokenWIN.GetActiveControl();
+ DBG_ASSERT(pCtrl, "no active control?");
+ if(pCtrl)
+ {
+ if(WINDOW_EDIT == pCtrl->GetType())
+ ((SwTOXEdit*)pCtrl)->SetCharStyleName(sEntry, nId);
+ else
+ ((SwTOXButton*)pCtrl)->SetCharStyleName(sEntry, nId);
+
+ }
+ ModifyHdl(0);
+ return 0;
+}
+/* -----------------------------11.01.00 12:54--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwTOXEntryTabPage, ChapterInfoHdl, ListBox*, pBox)
+{
+ sal_uInt16 nPos = pBox->GetSelectEntryPos();
+ if(LISTBOX_ENTRY_NOTFOUND != nPos)
+ {
+ Control* pCtrl = aTokenWIN.GetActiveControl();
+ DBG_ASSERT(pCtrl, "no active control?");
+ if(pCtrl && WINDOW_EDIT != pCtrl->GetType())
+ ((SwTOXButton*)pCtrl)->SetChapterInfo(nPos);
+
+ ModifyHdl(0);
+ }
+ return 0;
+}
+
+IMPL_LINK(SwTOXEntryTabPage, ChapterInfoOutlineHdl, NumericField*, pField)
+{
+ const sal_uInt16 nLevel = static_cast<BYTE>(pField->GetValue());
+
+ Control* pCtrl = aTokenWIN.GetActiveControl();
+ DBG_ASSERT(pCtrl, "no active control?");
+ if(pCtrl && WINDOW_EDIT != pCtrl->GetType())
+ ((SwTOXButton*)pCtrl)->SetOutlineLevel(nLevel);
+
+ ModifyHdl(0);
+ return 0;
+}
+
+IMPL_LINK(SwTOXEntryTabPage, NumberFormatHdl, ListBox*, pBox)
+{
+ const sal_uInt16 nPos = pBox->GetSelectEntryPos();
+
+ if(LISTBOX_ENTRY_NOTFOUND != nPos)
+ {
+ Control* pCtrl = aTokenWIN.GetActiveControl();
+ DBG_ASSERT(pCtrl, "no active control?");
+ if(pCtrl && WINDOW_EDIT != pCtrl->GetType())
+ {
+ ((SwTOXButton*)pCtrl)->SetEntryNumberFormat(nPos);//i89791
+ }
+ ModifyHdl(0);
+ }
+ return 0;
+}
+
+/* -----------------19.08.99 15:37-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTOXEntryTabPage, TabPosHdl, MetricField*, pField)
+{
+ Control* pCtrl = aTokenWIN.GetActiveControl();
+ DBG_ASSERT(pCtrl && WINDOW_EDIT != pCtrl->GetType() &&
+ TOKEN_TAB_STOP == ((SwTOXButton*)pCtrl)->GetFormToken().eTokenType,
+ "no active style::TabStop control?");
+ if( pCtrl && WINDOW_EDIT != pCtrl->GetType() )
+ {
+ ((SwTOXButton*)pCtrl)->SetTabPosition( static_cast< SwTwips >(
+ pField->Denormalize( pField->GetValue( FUNIT_TWIP ))));
+ }
+ ModifyHdl(0);
+ return 0;
+}
+/* -----------------09.09.99 15:37-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTOXEntryTabPage, FillCharHdl, ComboBox*, pBox)
+{
+ Control* pCtrl = aTokenWIN.GetActiveControl();
+ DBG_ASSERT(pCtrl && WINDOW_EDIT != pCtrl->GetType() &&
+ TOKEN_TAB_STOP == ((SwTOXButton*)pCtrl)->GetFormToken().eTokenType,
+ "no active style::TabStop control?");
+ if(pCtrl && WINDOW_EDIT != pCtrl->GetType())
+ {
+ sal_Unicode cSet;
+ if( pBox->GetText().Len() )
+ cSet = pBox->GetText().GetChar(0);
+ else
+ cSet = ' ';
+ ((SwTOXButton*)pCtrl)->SetFillChar( cSet );
+ }
+ ModifyHdl(0);
+ return 0;
+}
+
+/*-- 16.06.99 10:47:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwTOXEntryTabPage, AutoRightHdl, CheckBox*, pBox)
+{
+ //the most right style::TabStop is usually right aligned
+ Control* pCurCtrl = aTokenWIN.GetActiveControl();
+ DBG_ASSERT(WINDOW_EDIT != pCurCtrl->GetType() &&
+ ((SwTOXButton*)pCurCtrl)->GetFormToken().eTokenType == TOKEN_TAB_STOP,
+ "no style::TabStop selected!");
+
+ const SwFormToken& rToken = ((SwTOXButton*)pCurCtrl)->GetFormToken();
+ sal_Bool bChecked = pBox->IsChecked();
+ if(rToken.eTokenType == TOKEN_TAB_STOP)
+ ((SwTOXButton*)pCurCtrl)->SetTabAlign(
+ bChecked ? SVX_TAB_ADJUST_END : SVX_TAB_ADJUST_LEFT);
+ aTabPosFT.Enable(!bChecked);
+ aTabPosMF.Enable(!bChecked);
+ ModifyHdl(0);
+ return 0;
+}
+/* -----------------16.06.99 11:00-------------------
+
+ --------------------------------------------------*/
+void SwTOXEntryTabPage::SetWrtShell(SwWrtShell& rSh)
+{
+ SwDocShell* pDocSh = rSh.GetView().GetDocShell();
+ ::FillCharStyleListBox(aCharStyleLB, pDocSh, TRUE, TRUE);
+ const String sDefault(SW_RES(STR_POOLCOLL_STANDARD));
+ for(sal_uInt16 i = 0; i < aCharStyleLB.GetEntryCount(); i++)
+ {
+ String sEntry = aCharStyleLB.GetEntry(i);
+ if(sDefault != sEntry)
+ {
+ aMainEntryStyleLB.InsertEntry( sEntry );
+ aMainEntryStyleLB.SetEntryData(i, aCharStyleLB.GetEntryData(i));
+ }
+ }
+ aMainEntryStyleLB.SelectEntry( SwStyleNameMapper::GetUIName(
+ RES_POOLCHR_IDX_MAIN_ENTRY, aEmptyStr ));
+}
+/* -----------------------------23.12.99 14:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+String SwTOXEntryTabPage::GetLevelHelp(sal_uInt16 nLevel) const
+{
+ String sRet;
+ SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog();
+ const CurTOXType aCurType = pTOXDlg->GetCurrentTOXType();
+ if( TOX_INDEX == aCurType.eType )
+ SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(1 == nLevel ? RES_POOLCOLL_TOX_IDXBREAK
+ : RES_POOLCOLL_TOX_IDX1 + nLevel-2), sRet );
+
+ else if( TOX_AUTHORITIES == aCurType.eType )
+ {
+ //wildcard -> show entry text
+ sRet = '*';
+ }
+ return sRet;
+}
+/* -----------------16.06.99 15:18-------------------
+
+ --------------------------------------------------*/
+
+SwTokenWindow::SwTokenWindow(SwTOXEntryTabPage* pParent, const ResId& rResId) :
+ Window( pParent, rResId ),
+ aLeftScrollWin(this, ResId(WIN_LEFT_SCROLL, *rResId.GetResMgr() )),
+ aCtrlParentWin(this, ResId(WIN_CTRL_PARENT, *rResId.GetResMgr() )),
+ aRightScrollWin(this, ResId(WIN_RIGHT_SCROLL, *rResId.GetResMgr() )),
+ pForm(0),
+ nLevel(0),
+ bValid(sal_False),
+ sCharStyle(ResId(STR_CHARSTYLE, *rResId.GetResMgr())),
+ pActiveCtrl(0),
+ m_pParent(pParent)
+{
+ SetStyle(GetStyle()|WB_TABSTOP|WB_DIALOGCONTROL);
+ SetHelpId(HID_TOKEN_WINDOW);
+ for(sal_uInt16 i = 0; i < TOKEN_END; i++)
+ {
+ sal_uInt16 nTextId = STR_BUTTON_TEXT_START + i;
+ if( STR_TOKEN_ENTRY_TEXT == nTextId )
+ nTextId = STR_TOKEN_ENTRY;
+ aButtonTexts[i] = String(ResId(nTextId, *rResId.GetResMgr()));
+
+ sal_uInt16 nHelpId = STR_BUTTON_HELP_TEXT_START + i;
+ if(STR_TOKEN_HELP_ENTRY_TEXT == nHelpId)
+ nHelpId = STR_TOKEN_HELP_ENTRY;
+ aButtonHelpTexts[i] = String(ResId(nHelpId, *rResId.GetResMgr()));
+ }
+
+ FreeResource();
+
+ Link aLink(LINK(this, SwTokenWindow, ScrollHdl));
+ aLeftScrollWin.SetClickHdl(aLink);
+ aRightScrollWin.SetClickHdl(aLink);
+}
+/* -----------------01.07.99 12:17-------------------
+
+ --------------------------------------------------*/
+SwTokenWindow::~SwTokenWindow()
+{
+// for(sal_uInt16 i = GetItemCount(); i ; i--)
+// RemoveItem(i - 1);
+
+ for( sal_uInt32 n = 0; n < aControlList.Count(); ++n )
+ {
+ Control* pControl = aControlList.GetObject( n );
+ pControl->SetGetFocusHdl( Link() );
+ pControl->SetLoseFocusHdl( Link() );
+ }
+
+ for( ULONG i = aControlList.Count(); i; )
+ {
+ Control* pControl = aControlList.Remove( --i );
+ delete pControl;
+ }
+}
+/* -----------------16.06.99 13:56-------------------
+
+ --------------------------------------------------*/
+void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL)
+{
+ SetActiveControl(0);
+ bValid = sal_True;
+ if(pForm)
+ {
+ //apply current level settings to the form
+ for( ULONG i = aControlList.Count(); i; )
+ {
+ Control* pControl = aControlList.Remove( --i );
+ delete pControl;
+ }
+ }
+ nLevel = nL;
+ pForm = &rForm;
+ //now the display
+ if(nLevel < MAXLEVEL || rForm.GetTOXType() == TOX_AUTHORITIES)
+ {
+ Size aToolBoxSize = GetSizePixel();
+
+ // #i21237#
+ SwFormTokens aPattern = pForm->GetPattern(nLevel + 1);
+ SwFormTokens::iterator aIt = aPattern.begin();
+ sal_Bool bLastWasText = sal_False; //assure alternating text - code - text
+
+ Control* pSetActiveControl = 0;
+ while(aIt != aPattern.end()) // #i21237#
+ {
+ SwFormToken aToken(*aIt); // #i21237#
+
+ if(TOKEN_TEXT == aToken.eTokenType)
+ {
+ DBG_ASSERT(!bLastWasText, "text following text is invalid");
+ Control* pCtrl = InsertItem(aToken.sText, aToken);
+ bLastWasText = sal_True;
+ if(!GetActiveControl())
+ SetActiveControl(pCtrl);
+ }
+ else
+ {
+ if( !bLastWasText )
+ {
+ bLastWasText = sal_True;
+ SwFormToken aTemp(TOKEN_TEXT);
+ Control* pCtrl = InsertItem(aEmptyStr, aTemp);
+ if(!pSetActiveControl)
+ pSetActiveControl = pCtrl;
+ }
+ const sal_Char* pTmp = 0;
+ switch( aToken.eTokenType )
+ {
+ case TOKEN_ENTRY_NO: pTmp = SwForm::aFormEntryNum; break;
+ case TOKEN_ENTRY_TEXT: pTmp = SwForm::aFormEntryTxt; break;
+ case TOKEN_ENTRY: pTmp = SwForm::aFormEntry; break;
+ case TOKEN_TAB_STOP: pTmp = SwForm::aFormTab; break;
+ case TOKEN_PAGE_NUMS: pTmp = SwForm::aFormPageNums; break;
+ case TOKEN_CHAPTER_INFO:pTmp = SwForm::aFormChapterMark; break;
+ case TOKEN_LINK_START: pTmp = SwForm::aFormLinkStt; break;
+ case TOKEN_LINK_END: pTmp = SwForm::aFormLinkEnd; break;
+ case TOKEN_AUTHORITY: pTmp = SwForm::aFormAuth; break;
+ default:; //prevent warning
+ }
+
+ InsertItem( pTmp ? String::CreateFromAscii(pTmp)
+ : aEmptyStr, aToken );
+ bLastWasText = sal_False;
+ }
+
+ aIt++; // #i21237#
+ }
+ if(!bLastWasText)
+ {
+ bLastWasText = sal_True;
+ SwFormToken aTemp(TOKEN_TEXT);
+ Control* pCtrl = InsertItem(aEmptyStr, aTemp);
+ if(!pSetActiveControl)
+ pSetActiveControl = pCtrl;
+ }
+ SetActiveControl(pSetActiveControl);
+ }
+ AdjustScrolling();
+}
+/* -----------------19.08.99 13:00-------------------
+
+ --------------------------------------------------*/
+void SwTokenWindow::SetActiveControl(Control* pSet)
+{
+ if( pSet != pActiveCtrl )
+ {
+ pActiveCtrl = pSet;
+ if( pActiveCtrl )
+ {
+ pActiveCtrl->GrabFocus();
+ //it must be a SwTOXEdit
+ const SwFormToken* pFToken;
+ if( WINDOW_EDIT == pActiveCtrl->GetType() )
+ pFToken = &((SwTOXEdit*)pActiveCtrl)->GetFormToken();
+ else
+ pFToken = &((SwTOXButton*)pActiveCtrl)->GetFormToken();
+
+ SwFormToken aTemp( *pFToken );
+ aButtonSelectedHdl.Call( &aTemp );
+ }
+ }
+}
+
+/* -----------------17.06.99 09:53-------------------
+
+ --------------------------------------------------*/
+Control* SwTokenWindow::InsertItem(const String& rText, const SwFormToken& rToken)
+{
+ Control* pRet = 0;
+ Control* pLast = aControlList.Last();
+ Size aControlSize(GetOutputSizePixel());
+ Point aControlPos;
+ if( pLast )
+ {
+ aControlSize = pLast->GetSizePixel();
+ aControlPos = pLast->GetPosPixel();
+ aControlPos.X() += aControlSize.Width();
+ }
+ if(TOKEN_TEXT == rToken.eTokenType)
+ {
+ SwTOXEdit* pEdit = new SwTOXEdit(&aCtrlParentWin, this, rToken);
+ pEdit->SetPosPixel(aControlPos);
+ aControlList.Insert(pEdit, aControlList.Count());
+ pEdit->SetText(rText);
+ Size aEditSize(aControlSize);
+ aEditSize.Width() = pEdit->GetTextWidth(rText) + EDIT_MINWIDTH;
+ pEdit->SetSizePixel(aEditSize);
+ pEdit->SetModifyHdl(LINK(this, SwTokenWindow, EditResize ));
+ pEdit->SetPrevNextLink(LINK(this, SwTokenWindow, NextItemHdl));
+ pEdit->SetGetFocusHdl(LINK(this, SwTokenWindow, TbxFocusHdl));
+ pEdit->Show();
+ pRet = pEdit;
+ }
+ else
+ {
+ SwTOXButton* pButton = new SwTOXButton(&aCtrlParentWin, this, rToken);
+ pButton->SetPosPixel(aControlPos);
+ aControlList.Insert(pButton, aControlList.Count());
+ Size aEditSize(aControlSize);
+ aEditSize.Width() = pButton->GetTextWidth(rText) + 5;
+// pButton->SetControlBackground(aCtrlColor);
+// pButton->SetControlForeground(aTextColor);
+ pButton->SetSizePixel(aEditSize);
+ pButton->SetPrevNextLink(LINK(this, SwTokenWindow, NextItemBtnHdl));
+ pButton->SetGetFocusHdl(LINK(this, SwTokenWindow, TbxFocusBtnHdl));
+ if(TOKEN_AUTHORITY != rToken.eTokenType)
+ pButton->SetText(aButtonTexts[rToken.eTokenType]);
+ else
+ {
+ //use the first two chars as symbol
+ String sTmp(SwAuthorityFieldType::GetAuthFieldName(
+ (ToxAuthorityField)rToken.nAuthorityField));
+ pButton->SetText(sTmp.Copy(0, 2));
+ }
+ pButton->Show();
+ pRet = pButton;
+ }
+ return pRet;
+}
+/* -----------------16.07.99 11:50-------------------
+
+ --------------------------------------------------*/
+void SwTokenWindow::InsertAtSelection(
+ const String& rText,
+ const SwFormToken& rToken)
+{
+ DBG_ASSERT(pActiveCtrl, "no active control!");
+ if(!pActiveCtrl)
+ return;
+ SwFormToken aToInsertToken(rToken);
+ if(TOKEN_LINK_START == aToInsertToken.eTokenType)
+ {
+ //determine if start or end of hyperlink is appropriate
+ //eventually change a following link start into a link end
+ // groups of LS LE should be ignored
+ // <insert>
+ //LS <insert>
+ //LE <insert>
+ //<insert> LS
+ //<insert> LE
+ //<insert>
+ sal_Bool bPreStartLinkFound = sal_False; //
+ sal_Bool bPreEndLinkFound = sal_False;
+
+ const Control* pControl = aControlList.First();
+ const Control* pExchange = 0;
+ while( pControl && pActiveCtrl != pControl )
+ {
+ if( WINDOW_EDIT != pControl->GetType())
+ {
+ const SwFormToken& rNewToken =
+ ((SwTOXButton*)pControl)->GetFormToken();
+ if( TOKEN_LINK_START == rNewToken.eTokenType )
+ {
+ bPreStartLinkFound = sal_True;
+ pExchange = 0;
+ }
+ else if(TOKEN_LINK_END == rNewToken.eTokenType)
+ {
+ if( bPreStartLinkFound )
+ bPreStartLinkFound = sal_False;
+ else
+ {
+ bPreEndLinkFound = sal_False;
+ pExchange = pControl;
+ }
+ }
+ }
+ pControl = aControlList.Next();
+ }
+
+ sal_Bool bPostLinkEndFound = sal_False;
+ sal_Bool bPostLinkStartFound = sal_False;
+ if(!bPreStartLinkFound && !bPreEndLinkFound)
+ while(pControl)
+ {
+ if( pControl != pActiveCtrl &&
+ WINDOW_EDIT != pControl->GetType())
+ {
+ const SwFormToken& rNewToken =
+ ((SwTOXButton*)pControl)->GetFormToken();
+ if( TOKEN_LINK_START == rNewToken.eTokenType )
+ {
+ if(bPostLinkStartFound)
+ break;
+ bPostLinkStartFound = sal_True;
+ pExchange = pControl;
+ }
+ else if(TOKEN_LINK_END == rNewToken.eTokenType )
+ {
+ if(bPostLinkStartFound)
+ {
+ bPostLinkStartFound = sal_False;
+ pExchange = 0;
+ }
+ else
+ {
+ bPostLinkEndFound = sal_True;
+ }
+ break;
+ }
+ }
+ pControl = aControlList.Next();
+ }
+
+ if(bPreStartLinkFound)
+ {
+ aToInsertToken.eTokenType = TOKEN_LINK_END;
+ aToInsertToken.sText = aButtonTexts[TOKEN_LINK_END];
+ }
+
+ if(bPostLinkStartFound)
+ {
+ DBG_ASSERT(pExchange, "no control to exchange?");
+ if(pExchange)
+ {
+ ((SwTOXButton*)pExchange)->SetLinkEnd();
+ ((SwTOXButton*)pExchange)->SetText(aButtonTexts[TOKEN_LINK_END]);
+ }
+ }
+
+ if(bPreEndLinkFound)
+ {
+ DBG_ASSERT(pExchange, "no control to exchange?");
+ if(pExchange)
+ {
+ ((SwTOXButton*)pExchange)->SetLinkStart();
+ ((SwTOXButton*)pExchange)->SetText(aButtonTexts[TOKEN_LINK_START]);
+ }
+ }
+ }
+
+ //if the active control is text then insert a new button at the selection
+ //else replace the button
+ sal_uInt32 nActivePos = aControlList.GetPos(pActiveCtrl);
+ sal_uInt32 nInsertPos = nActivePos;
+
+ Size aControlSize(GetOutputSizePixel());
+ if( WINDOW_EDIT == pActiveCtrl->GetType())
+ {
+ nInsertPos++;
+ Selection aSel = ((SwTOXEdit*)pActiveCtrl)->GetSelection();
+ aSel.Justify();
+ String sEditText = ((SwTOXEdit*)pActiveCtrl)->GetText();
+ String sLeft = sEditText.Copy( 0, static_cast< USHORT >(aSel.A()) );
+ String sRight = sEditText.Copy( static_cast< USHORT >(aSel.B()),
+ static_cast< USHORT >(sEditText.Len() - aSel.B()));
+
+ ((SwTOXEdit*)pActiveCtrl)->SetText(sLeft);
+ ((SwTOXEdit*)pActiveCtrl)->AdjustSize();
+
+ SwFormToken aTmpToken(TOKEN_TEXT);
+ SwTOXEdit* pEdit = new SwTOXEdit(&aCtrlParentWin, this, aTmpToken);
+ aControlList.Insert(pEdit, nActivePos + 1);
+ pEdit->SetText(sRight);
+ pEdit->SetSizePixel(aControlSize);
+ pEdit->AdjustSize();
+ pEdit->SetModifyHdl(LINK(this, SwTokenWindow, EditResize ));
+ pEdit->SetPrevNextLink(LINK(this, SwTokenWindow, NextItemHdl));
+ pEdit->SetGetFocusHdl(LINK(this, SwTokenWindow, TbxFocusHdl));
+ pEdit->Show();
+ }
+ else
+ {
+ aControlList.Remove(pActiveCtrl);
+ pActiveCtrl->Hide();
+ delete pActiveCtrl;
+ }
+
+ //now the new button
+ SwTOXButton* pButton = new SwTOXButton(&aCtrlParentWin, this, aToInsertToken);
+ aControlList.Insert(pButton, nInsertPos);
+ pButton->SetPrevNextLink(LINK(this, SwTokenWindow, NextItemBtnHdl));
+ pButton->SetGetFocusHdl(LINK(this, SwTokenWindow, TbxFocusBtnHdl));
+ if(TOKEN_AUTHORITY != aToInsertToken.eTokenType)
+ pButton->SetText(aButtonTexts[aToInsertToken.eTokenType]);
+ else
+ {
+ //use the first two chars as symbol
+ String sTmp(SwAuthorityFieldType::GetAuthFieldName(
+ (ToxAuthorityField)aToInsertToken.nAuthorityField));
+ pButton->SetText(sTmp.Copy(0, 2));
+ }
+
+ Size aEditSize(GetOutputSizePixel());
+ aEditSize.Width() = pButton->GetTextWidth(rText) + 5;
+ pButton->SetSizePixel(aEditSize);
+ pButton->Check(sal_True);
+ pButton->Show();
+ SetActiveControl(pButton);
+
+ AdjustPositions();
+}
+/* -----------------19.08.99 12:42-------------------
+
+ --------------------------------------------------*/
+void SwTokenWindow::RemoveControl(SwTOXButton* pDel, sal_Bool bInternalCall )
+{
+ if(bInternalCall && TOX_AUTHORITIES == pForm->GetTOXType())
+ m_pParent->PreTokenButtonRemoved(pDel->GetFormToken());
+
+ sal_uInt32 nActivePos = aControlList.GetPos(pDel);
+ DBG_ASSERT(nActivePos != 0xffffffff, "Control does not exist!");
+ // the two neighbours of the box must be merged
+ // the properties of the right one will be lost
+ DBG_ASSERT(nActivePos && nActivePos < aControlList.Count() - 1,
+ "Button at first or last position?");
+ aControlList.Seek(nActivePos - 1);
+ Control* pLeftEdit = aControlList.GetCurObject();
+ aControlList.Seek(nActivePos + 1);
+ Control* pRightEdit = aControlList.GetCurObject();
+ String sTemp(((SwTOXEdit*)pLeftEdit)->GetText());
+ sTemp += ((SwTOXEdit*)pRightEdit)->GetText();
+ ((SwTOXEdit*)pLeftEdit)->SetText(sTemp);
+ ((SwTOXEdit*)pLeftEdit)->AdjustSize();
+
+ aControlList.Remove(pRightEdit);
+ delete pRightEdit;
+
+ aControlList.Remove(pDel);
+ pActiveCtrl->Hide();
+ delete pActiveCtrl;
+ SetActiveControl(pLeftEdit);
+ AdjustPositions();
+ if(aModifyHdl.IsSet())
+ aModifyHdl.Call(0);
+}
+
+/* -----------------16.07.99 12:39-------------------
+
+ --------------------------------------------------*/
+void SwTokenWindow::AdjustPositions()
+{
+ if(aControlList.Count() > 1)
+ {
+ Control* pCtrl = aControlList.First();
+ Point aNextPos = pCtrl->GetPosPixel();
+ aNextPos.X() += pCtrl->GetSizePixel().Width();
+ while(0 != (pCtrl = aControlList.Next()))
+ {
+ pCtrl->SetPosPixel(aNextPos);
+ aNextPos.X() += pCtrl->GetSizePixel().Width();
+ }
+ AdjustScrolling();
+ }
+};
+/* -----------------------------16.08.00 13:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwTokenWindow::MoveControls(long nOffset)
+{
+ // move the complete list
+ Control* pCtrl = aControlList.First();
+ do
+ {
+ Point aPos = pCtrl->GetPosPixel();
+ aPos.X() += nOffset;
+ pCtrl->SetPosPixel(aPos);
+ }while(0 != (pCtrl = aControlList.Next()));
+}
+/* -----------------------------14.01.00 13:03--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwTokenWindow::AdjustScrolling()
+{
+ if(aControlList.Count() > 1)
+ {
+ //validate scroll buttons
+ Control* pLastCtrl = aControlList.Last();
+ Control* pFirstCtrl = aControlList.First();
+ long nSpace = aCtrlParentWin.GetSizePixel().Width();
+ long nWidth = pLastCtrl->GetPosPixel().X() - pFirstCtrl->GetPosPixel().X()
+ + pLastCtrl->GetSizePixel().Width();
+ sal_Bool bEnable = nWidth > nSpace;
+ //the active control must be visible
+ if(bEnable && pActiveCtrl)
+ {
+ Point aActivePos(pActiveCtrl->GetPosPixel());
+ long nMove = 0;
+ if(aActivePos.X() < 0)
+ nMove = -aActivePos.X();
+ else if((aActivePos.X() + pActiveCtrl->GetSizePixel().Width()) > nSpace)
+ nMove = -(aActivePos.X() + pActiveCtrl->GetSizePixel().Width() - nSpace);
+ if(nMove)
+ MoveControls(nMove);
+ aLeftScrollWin.Enable(aControlList.First()->GetPosPixel().X() < 0);
+ Control* pCtrl = aControlList.Last();
+ aRightScrollWin.Enable((pCtrl->GetPosPixel().X() + pCtrl->GetSizePixel().Width()) > nSpace);
+ }
+ else
+ {
+ if(pFirstCtrl)
+ {
+ //if the control fits into the space then the first control must be at postion 0
+ long nFirstPos = pFirstCtrl->GetPosPixel().X();
+ if(nFirstPos != 0)
+ MoveControls(-nFirstPos);
+ }
+ aRightScrollWin.Enable(sal_False);
+ aLeftScrollWin.Enable(sal_False);
+ }
+ }
+}
+/* -----------------------------14.01.00 13:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwTokenWindow, ScrollHdl, ImageButton*, pBtn )
+{
+ if(aControlList.Count())
+ {
+ const long nSpace = aCtrlParentWin.GetSizePixel().Width();
+#if OSL_DEBUG_LEVEL > 1
+ //find all start/end positions and print it
+ String sMessage(String::CreateFromAscii("Space: "));
+ sMessage += String::CreateFromInt32(nSpace);
+ sMessage += String::CreateFromAscii(" | ");
+ Control* pDebugCtrl = aControlList.First();
+ do
+ {
+ long nDebugXPos = pDebugCtrl->GetPosPixel().X();
+ long nDebugWidth = pDebugCtrl->GetSizePixel().Width();
+ sMessage += String::CreateFromInt32( nDebugXPos );
+ sMessage += String::CreateFromAscii(" ");
+ sMessage += String::CreateFromInt32(nDebugXPos + nDebugWidth);
+ sMessage += String::CreateFromAscii(" | ");
+
+ }while(0 != (pDebugCtrl = aControlList.Next()));
+
+#endif
+
+ long nMove = 0;
+ if(pBtn == &aLeftScrollWin)
+ {
+ //find the first completely visible control (left edge visible)
+ for(sal_uInt16 i = 0; i < aControlList.Count(); i++ )
+ {
+ Control* pCtrl = aControlList.GetObject(i);
+ long nXPos = pCtrl->GetPosPixel().X();
+ if(nXPos >= 0)
+ {
+ if(!i)
+ //move the current control to the left edge
+ nMove = -nXPos;
+ else
+ //move the left neighbor to the start position
+ nMove = -aControlList.GetObject(i - 1)->GetPosPixel().X();
+ break;
+ }
+ }
+ }
+ else
+ {
+ //find the first completely visible control (left edge visible)
+ for(ULONG i = aControlList.Count(); i; i-- )
+ {
+ Control* pCtrl = aControlList.GetObject(i - 1);
+ long nCtrlWidth = pCtrl->GetSizePixel().Width();
+ long nXPos = pCtrl->GetPosPixel().X() + nCtrlWidth;
+ if(nXPos <= nSpace)
+ {
+ if( i < aControlList.Count())
+ {
+ //move the right neighbor to the right edge right aligned
+ Control* pRight = aControlList.GetObject(i);
+ nMove = nSpace - pRight->GetPosPixel().X() - pRight->GetSizePixel().Width();
+ }
+ break;
+ }
+ }
+
+ //move it left until it's completely visible
+ }
+ if(nMove)
+ {
+ // move the complete list
+ Control* pCtrl = aControlList.First();
+ do
+ {
+ Point aPos = pCtrl->GetPosPixel();
+ aPos.X() += nMove;
+ pCtrl->SetPosPixel(aPos);
+ }while(0 != (pCtrl = aControlList.Next()));
+ aLeftScrollWin.Enable(aControlList.First()->GetPosPixel().X() < 0);
+ pCtrl = aControlList.Last();
+ aRightScrollWin.Enable((pCtrl->GetPosPixel().X() + pCtrl->GetSizePixel().Width()) > nSpace);
+
+#if OSL_DEBUG_LEVEL > 1
+ sMessage.AppendAscii("Move: ");
+ sMessage += String::CreateFromInt32(nMove);
+ GetParent()->GetParent()->GetParent()->SetText(sMessage);
+#endif
+ }
+ }
+ return 0;
+}
+/* -----------------17.06.99 11:59-------------------
+
+ --------------------------------------------------*/
+String SwTokenWindow::GetPattern() const
+{
+ String sRet;
+ const Control* pControl = ((SwTokenWindow*)this)->aControlList.First();
+ while(pControl)
+ {
+ const SwFormToken& rNewToken = WINDOW_EDIT == pControl->GetType()
+ ? ((SwTOXEdit*)pControl)->GetFormToken()
+ : ((SwTOXButton*)pControl)->GetFormToken();
+
+ //TODO: prevent input of TOX_STYLE_DELIMITER in KeyInput
+ sRet += rNewToken.GetString();
+
+ pControl = ((SwTokenWindow*)this)->aControlList.Next();
+ }
+ return sRet;
+}
+/* -----------------19.08.99 11:27-------------------
+ Description: Check if a control of the specified
+ TokenType is already contained in the list
+ --------------------------------------------------*/
+sal_Bool SwTokenWindow::Contains(FormTokenType eSearchFor) const
+{
+ sal_Bool bRet = sal_False;
+ const Control* pControl = ((SwTokenWindow*)this)->aControlList.First();
+ while(pControl)
+ {
+ const SwFormToken& rNewToken = WINDOW_EDIT == pControl->GetType()
+ ? ((SwTOXEdit*)pControl)->GetFormToken()
+ : ((SwTOXButton*)pControl)->GetFormToken();
+
+ if(eSearchFor == rNewToken.eTokenType)
+ {
+ bRet = sal_True;
+ break;
+ }
+ pControl = ((SwTokenWindow*)this)->aControlList.Next();
+ }
+ return bRet;
+}
+//---------------------------------------------------
+BOOL SwTokenWindow::CreateQuickHelp(Control* pCtrl,
+ const SwFormToken& rToken,
+ const HelpEvent& rHEvt)
+{
+ BOOL bRet = FALSE;
+ if( rHEvt.GetMode() & HELPMODE_QUICK )
+ {
+ sal_Bool bBalloon = Help::IsBalloonHelpEnabled();
+ String sEntry;
+ if(bBalloon || rToken.eTokenType != TOKEN_AUTHORITY)
+ sEntry = (aButtonHelpTexts[rToken.eTokenType]);
+ if(rToken.eTokenType == TOKEN_AUTHORITY )
+ {
+ sEntry += SwAuthorityFieldType::GetAuthFieldName(
+ (ToxAuthorityField) rToken.nAuthorityField);
+ }
+
+ Point aPos = OutputToScreenPixel(pCtrl->GetPosPixel());
+ Rectangle aItemRect( aPos, pCtrl->GetSizePixel() );
+ if(rToken.eTokenType == TOKEN_TAB_STOP )
+ {
+// sEntry += '\n';
+// sEntry += rToken.nTabStopPosition;
+ }
+ else
+ {
+ if(rToken.sCharStyleName.Len())
+ {
+ if(bBalloon)
+ sEntry += '\n';
+ else
+ sEntry += ' ';
+ sEntry += sCharStyle;
+ sEntry += rToken.sCharStyleName;
+ }
+ }
+ if(bBalloon)
+ {
+ Help::ShowBalloon( this, aPos, aItemRect, sEntry );
+ }
+ else
+ Help::ShowQuickHelp( this, aItemRect, sEntry,
+ QUICKHELP_LEFT|QUICKHELP_VCENTER );
+ bRet = TRUE;
+ }
+ return bRet;
+}
+/* -----------------------------14.01.00 12:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwTokenWindow::Resize()
+{
+ Size aCompleteSize(GetOutputSizePixel());
+
+ Point aRightPos(aRightScrollWin.GetPosPixel());
+ Size aRightSize(aRightScrollWin.GetSizePixel());
+
+ Size aMiddleSize(aCtrlParentWin.GetSizePixel());
+
+ long nMove = aCompleteSize.Width() - aRightSize.Width() - aRightPos.X();
+
+ aRightPos.X() += nMove;
+ aRightScrollWin.SetPosPixel(aRightPos);
+ aMiddleSize.Width() += nMove;
+ aCtrlParentWin.SetSizePixel(aMiddleSize);
+}
+
+/* -----------------16.06.99 15:23-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTokenWindow, EditResize, Edit*, pEdit)
+{
+ ((SwTOXEdit*)pEdit)->AdjustSize();
+ AdjustPositions();
+ if(aModifyHdl.IsSet())
+ aModifyHdl.Call(0);
+ return 0;
+}
+/* -----------------16.06.99 15:56-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTokenWindow, NextItemHdl, SwTOXEdit*, pEdit)
+{
+ sal_uInt16 nPos = (sal_uInt16)aControlList.GetPos(pEdit);
+ if( (nPos && !pEdit->IsNextControl()) ||
+ (nPos < aControlList.Count() - 1 && pEdit->IsNextControl()))
+ {
+ aControlList.Seek(nPos);
+ Control* pNextPrev = pEdit->IsNextControl() ? aControlList.Next() : aControlList.Prev();
+ nPos += pEdit->IsNextControl() ? 1 : -1;
+ pNextPrev->GrabFocus();
+ ((SwTOXButton*)pNextPrev)->Check();
+ AdjustScrolling();
+ }
+ return 0;
+}
+/* -----------------17.06.99 08:58-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTokenWindow, TbxFocusHdl, SwTOXEdit*, pEdit)
+{
+ for(sal_uInt16 i = 0; i < aControlList.Count(); i++)
+ {
+ Control* pControl = aControlList.First();
+ while(pControl)
+ {
+ if(WINDOW_EDIT != pControl->GetType() )
+ ((SwTOXButton*)pControl)->Check(sal_False);
+ pControl = aControlList.Next();
+ }
+ }
+ SetActiveControl(pEdit);
+ return 0;
+}
+/* -----------------17.06.99 10:05-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTokenWindow, NextItemBtnHdl, SwTOXButton*, pBtn )
+{
+ sal_uInt16 nPos = (sal_uInt16)aControlList.GetPos(pBtn);
+ if( (nPos && !pBtn->IsNextControl()) ||
+ (nPos < aControlList.Count() - 1 && pBtn->IsNextControl()))
+ {
+ aControlList.Seek(nPos);
+ sal_Bool bNext = pBtn->IsNextControl();
+ Control* pNextPrev = bNext ? aControlList.Next() : aControlList.Prev();
+ pNextPrev->GrabFocus();
+ Selection aSel(0, 0);
+ if(!bNext)
+ {
+ sal_uInt16 nLen = ((SwTOXEdit*)pNextPrev)->GetText().Len();
+ aSel.A() = nLen;
+ aSel.B() = nLen;
+ }
+ ((SwTOXEdit*)pNextPrev)->SetSelection(aSel);
+ pBtn->Check(sal_False);
+ AdjustScrolling();
+ }
+ return 0;
+}
+
+/* -----------------17.06.99 10:04-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwTokenWindow, TbxFocusBtnHdl, SwTOXButton*, pBtn )
+{
+ for(sal_uInt16 i = 0; i < aControlList.Count(); i++)
+ {
+ Control* pControl = aControlList.First();
+ while(pControl)
+ {
+ if(WINDOW_EDIT != pControl->GetType() )
+ ((SwTOXButton*)pControl)->Check(pBtn == pControl);
+ pControl = aControlList.Next();
+ }
+ }
+ SetActiveControl(pBtn);
+ return 0;
+}
+/* -----------------------------28.01.2002 12:22------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwTokenWindow::GetFocus()
+{
+ if(GETFOCUS_TAB & GetGetFocusFlags())
+ {
+ Control* pFirst = aControlList.First();
+ if(pFirst)
+ {
+ pFirst->GrabFocus();
+ SetActiveControl(pFirst);
+ AdjustScrolling();
+ }
+ }
+}
+/* -----------------25.03.99 15:17-------------------
+ *
+ * --------------------------------------------------*/
+SwTOXStylesTabPage::SwTOXStylesTabPage(Window* pParent, const SfxItemSet& rAttrSet ) :
+ SfxTabPage(pParent, SW_RES(TP_TOX_STYLES), rAttrSet),
+ aLevelFT2(this, SW_RES(FT_LEVEL )),
+ aLevelLB(this, SW_RES(LB_LEVEL )),
+ aTemplateFT(this, SW_RES(FT_TEMPLATE)),
+ aParaLayLB(this, SW_RES(LB_PARALAY )),
+ aStdBT(this, SW_RES(BT_STD )),
+ aAssignBT(this, SW_RES(BT_ASSIGN )),
+ aEditStyleBT(this, SW_RES(BT_EDIT_STYLE )),
+ aFormatFL(this, SW_RES(FL_FORMAT )),
+ m_pCurrentForm(0)
+{
+ FreeResource();
+ SetExchangeSupport( sal_True );
+
+ aAssignBT.SetModeImage( Image( SW_RES( IMG_ONE_LEFT_HC ) ), BMP_COLOR_HIGHCONTRAST );
+
+ aEditStyleBT.SetClickHdl (LINK( this, SwTOXStylesTabPage, EditStyleHdl));
+ aAssignBT.SetClickHdl (LINK( this, SwTOXStylesTabPage, AssignHdl));
+ aStdBT.SetClickHdl (LINK( this, SwTOXStylesTabPage, StdHdl));
+ aParaLayLB.SetSelectHdl (LINK( this, SwTOXStylesTabPage, EnableSelectHdl));
+ aLevelLB.SetSelectHdl (LINK( this, SwTOXStylesTabPage, EnableSelectHdl));
+ aParaLayLB.SetDoubleClickHdl(LINK( this, SwTOXStylesTabPage, DoubleClickHdl));
+}
+/* -----------------25.03.99 15:17-------------------
+ *
+ * --------------------------------------------------*/
+SwTOXStylesTabPage::~SwTOXStylesTabPage()
+{
+ delete m_pCurrentForm;
+}
+/* -----------------25.03.99 15:17-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwTOXStylesTabPage::FillItemSet( SfxItemSet& )
+{
+ return sal_True;
+}
+/* -----------------25.03.99 15:17-------------------
+ *
+ * --------------------------------------------------*/
+void SwTOXStylesTabPage::Reset( const SfxItemSet& rSet )
+{
+ ActivatePage(rSet);
+}
+/* -----------------25.03.99 15:17-------------------
+ *
+ * --------------------------------------------------*/
+void SwTOXStylesTabPage::ActivatePage( const SfxItemSet& )
+{
+ m_pCurrentForm = new SwForm(GetForm());
+ aParaLayLB.Clear();
+ aLevelLB.Clear();
+
+ // kein Hyperlink fuer Benutzerverzeichnisse
+
+ sal_uInt16 i, nSize = m_pCurrentForm->GetFormMax();
+
+ // form-Pattern anzeigen ohne Titel
+
+ //1. TemplateEntry anzeigen
+ String aStr( SW_RES( STR_TITLE ));
+ if( m_pCurrentForm->GetTemplate( 0 ).Len() )
+ {
+ aStr += ' ';
+ aStr += aDeliStart;
+ aStr += m_pCurrentForm->GetTemplate( 0 );
+ aStr += aDeliEnd;
+ }
+ aLevelLB.InsertEntry(aStr);
+
+ for( i=1; i < nSize; ++i )
+ {
+ if( TOX_INDEX == m_pCurrentForm->GetTOXType() &&
+ FORM_ALPHA_DELIMITTER == i )
+ aStr = SW_RESSTR(STR_ALPHA);
+ else
+ {
+ aStr = SW_RESSTR(STR_LEVEL);
+ aStr += String::CreateFromInt32(
+ TOX_INDEX == m_pCurrentForm->GetTOXType() ? i - 1 : i );
+ }
+ String aCpy( aStr );
+
+ if( m_pCurrentForm->GetTemplate( i ).Len() )
+ {
+ aCpy += ' ';
+ aCpy += aDeliStart;
+ aCpy += m_pCurrentForm->GetTemplate( i );
+ aCpy += aDeliEnd;
+ }
+ aLevelLB.InsertEntry( aCpy );
+ }
+
+ // Templates initialisieren
+ const SwTxtFmtColl *pColl;
+ SwWrtShell& rSh = ((SwMultiTOXTabDialog*)GetTabDialog())->GetWrtShell();
+ const sal_uInt16 nSz = rSh.GetTxtFmtCollCount();
+
+ for( i = 0; i < nSz; ++i )
+ if( !(pColl = &rSh.GetTxtFmtColl( i ))->IsDefault() )
+ aParaLayLB.InsertEntry( pColl->GetName() );
+
+ // Pool-Collections abfragen und fuer das Verzeichnis setzen
+ for( i = 0; i < m_pCurrentForm->GetFormMax(); ++i )
+ {
+ aStr = m_pCurrentForm->GetTemplate( i );
+ if( aStr.Len() &&
+ LISTBOX_ENTRY_NOTFOUND == aParaLayLB.GetEntryPos( aStr ))
+ aParaLayLB.InsertEntry( aStr );
+ }
+
+ EnableSelectHdl(&aParaLayLB);
+}
+/* -----------------25.03.99 15:17-------------------
+ *
+ * --------------------------------------------------*/
+int SwTOXStylesTabPage::DeactivatePage( SfxItemSet* /*pSet*/ )
+{
+ GetForm() = *m_pCurrentForm;
+ return LEAVE_PAGE;
+}
+
+/* -----------------25.03.99 15:17-------------------
+ *
+ * --------------------------------------------------*/
+SfxTabPage* SwTOXStylesTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SwTOXStylesTabPage(pParent, rAttrSet);
+}
+/* -----------------26.03.99 12:47-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwTOXStylesTabPage, EditStyleHdl, Button *, pBtn )
+{
+ if( LISTBOX_ENTRY_NOTFOUND != aParaLayLB.GetSelectEntryPos())
+ {
+ SfxStringItem aStyle(SID_STYLE_EDIT, aParaLayLB.GetSelectEntry());
+ SfxUInt16Item aFamily(SID_STYLE_FAMILY, SFX_STYLE_FAMILY_PARA);
+// SwPtrItem aShell(FN_PARAM_WRTSHELL, pWrtShell);
+ Window* pDefDlgParent = Application::GetDefDialogParent();
+ Application::SetDefDialogParent( pBtn );
+ SwWrtShell& rSh = ((SwMultiTOXTabDialog*)GetTabDialog())->GetWrtShell();
+ rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(
+ SID_STYLE_EDIT, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_MODAL,
+ &aStyle, &aFamily/*, &aShell*/, 0L);
+ Application::SetDefDialogParent( pDefDlgParent );
+ }
+ return 0;
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Vorlagen zuweisen
+ --------------------------------------------------------------------*/
+IMPL_LINK( SwTOXStylesTabPage, AssignHdl, Button *, EMPTYARG )
+{
+ sal_uInt16 nLevPos = aLevelLB.GetSelectEntryPos();
+ sal_uInt16 nTemplPos = aParaLayLB.GetSelectEntryPos();
+ if(nLevPos != LISTBOX_ENTRY_NOTFOUND &&
+ nTemplPos != LISTBOX_ENTRY_NOTFOUND)
+ {
+ String aStr(aLevelLB.GetEntry(nLevPos));
+ sal_uInt16 nDelPos = aStr.Search(aDeliStart);
+ if(nDelPos != STRING_NOTFOUND)
+ aStr.Erase(nDelPos-1);
+ aStr += ' ';
+ aStr += aDeliStart;
+ aStr += aParaLayLB.GetSelectEntry();
+
+ m_pCurrentForm->SetTemplate(nLevPos, aParaLayLB.GetSelectEntry());
+
+ aStr += aDeliEnd;
+
+ aLevelLB.RemoveEntry(nLevPos);
+ aLevelLB.InsertEntry(aStr, nLevPos);
+ aLevelLB.SelectEntry(aStr);
+ ModifyHdl(0);
+ }
+ return 0;
+}
+/* -----------------26.03.99 09:10-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwTOXStylesTabPage, StdHdl, Button *, EMPTYARG )
+{
+ sal_uInt16 nPos = aLevelLB.GetSelectEntryPos();
+ if(nPos != LISTBOX_ENTRY_NOTFOUND)
+ { String aStr(aLevelLB.GetEntry(nPos));
+ sal_uInt16 nDelPos = aStr.Search(aDeliStart);
+ if(nDelPos != STRING_NOTFOUND)
+ aStr.Erase(nDelPos-1);
+ aLevelLB.RemoveEntry(nPos);
+ aLevelLB.InsertEntry(aStr, nPos);
+ aLevelLB.SelectEntry(aStr);
+ m_pCurrentForm->SetTemplate(nPos, aEmptyStr);
+ ModifyHdl(0);
+ }
+ return 0;
+}
+/* -----------------26.03.99 09:11-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK_INLINE_START( SwTOXStylesTabPage, DoubleClickHdl, Button *, EMPTYARG )
+{
+ String aTmpName( aParaLayLB.GetSelectEntry() );
+ SwWrtShell& rSh = ((SwMultiTOXTabDialog*)GetTabDialog())->GetWrtShell();
+
+ if(aParaLayLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND &&
+ (aLevelLB.GetSelectEntryPos() == 0 || SwMultiTOXTabDialog::IsNoNum(rSh, aTmpName)))
+ AssignHdl(&aAssignBT);
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwTOXStylesTabPage, DoubleClickHdl, Button *, EMPTYARG )
+/*--------------------------------------------------------------------
+ Beschreibung: nur wenn selektiert enable
+ --------------------------------------------------------------------*/
+IMPL_LINK( SwTOXStylesTabPage, EnableSelectHdl, ListBox *, EMPTYARG )
+{
+ //UpdatePattern();
+ aStdBT.Enable(aLevelLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND);
+
+ SwWrtShell& rSh = ((SwMultiTOXTabDialog*)GetTabDialog())->GetWrtShell();
+ String aTmpName(aParaLayLB.GetSelectEntry());
+ aAssignBT.Enable(aParaLayLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND &&
+ LISTBOX_ENTRY_NOTFOUND != aLevelLB.GetSelectEntryPos() &&
+ (aLevelLB.GetSelectEntryPos() == 0 || SwMultiTOXTabDialog::IsNoNum(rSh, aTmpName)));
+ aEditStyleBT.Enable(aParaLayLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND );
+ return 0;
+}
+/* -----------------------------18.01.00 16:54--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwTOXStylesTabPage, ModifyHdl, void*, EMPTYARG)
+{
+ SwMultiTOXTabDialog* pTOXDlg = (SwMultiTOXTabDialog*)GetTabDialog();
+ if(pTOXDlg)
+ {
+ GetForm() = *m_pCurrentForm;
+ pTOXDlg->CreateOrUpdateExample(pTOXDlg->GetCurrentTOXType().eType, TOX_PAGE_STYLES);
+ }
+ return 0;
+}
+/******************************************************************************
+
+******************************************************************************/
+#define ITEM_SEARCH 1
+#define ITEM_ALTERNATIVE 2
+#define ITEM_PRIM_KEY 3
+#define ITEM_SEC_KEY 4
+#define ITEM_COMMENT 5
+#define ITEM_CASE 6
+#define ITEM_WORDONLY 7
+
+
+SwEntryBrowseBox::SwEntryBrowseBox(Window* pParent, const ResId& rId,
+ BrowserMode nMode ) :
+ SwEntryBrowseBox_Base( pParent, rId, nMode,
+ BROWSER_KEEPSELECTION |
+ BROWSER_COLUMNSELECTION |
+ BROWSER_MULTISELECTION |
+ BROWSER_TRACKING_TIPS |
+ BROWSER_HLINESFULL |
+ BROWSER_VLINESFULL |
+ BROWSER_AUTO_VSCROLL|
+ BROWSER_HIDECURSOR ),
+ aCellEdit(&GetDataWindow(), 0),
+ aCellCheckBox(&GetDataWindow()),
+
+ sSearch( ResId(ST_SEARCH, *rId.GetResMgr() )),
+ sAlternative( ResId(ST_ALTERNATIVE, *rId.GetResMgr() )),
+ sPrimKey( ResId(ST_PRIMKEY, *rId.GetResMgr() )),
+ sSecKey( ResId(ST_SECKEY, *rId.GetResMgr() )),
+ sComment( ResId(ST_COMMENT, *rId.GetResMgr() )),
+ sCaseSensitive( ResId(ST_CASESENSITIVE, *rId.GetResMgr() )),
+ sWordOnly( ResId(ST_WORDONLY, *rId.GetResMgr() )),
+ sYes( ResId(ST_TRUE, *rId.GetResMgr() )),
+ sNo( ResId(ST_FALSE, *rId.GetResMgr() )),
+ bModified(sal_False)
+{
+ FreeResource();
+ aCellCheckBox.GetBox().EnableTriState(sal_False);
+ xController = new ::svt::EditCellController(&aCellEdit);
+ xCheckController = new ::svt::CheckBoxCellController(&aCellCheckBox);
+
+ //////////////////////////////////////////////////////////////////////
+ // HACK: BrowseBox invalidiert nicht ihre Childs, wie es eigentlich sein sollte.
+ // Deshalb wird WB_CLIPCHILDREN zurueckgesetzt, wodurch das Invalidieren
+ // der Childs erzwungen wird.
+ WinBits aStyle = GetStyle();
+ if( aStyle & WB_CLIPCHILDREN )
+ {
+ aStyle &= ~WB_CLIPCHILDREN;
+ SetStyle( aStyle );
+ }
+ const String* aTitles[7] =
+ {
+ &sSearch,
+ &sAlternative,
+ &sPrimKey,
+ &sSecKey,
+ &sComment,
+ &sCaseSensitive,
+ &sWordOnly
+ };
+
+ long nWidth = GetSizePixel().Width();
+ nWidth /=7;
+ --nWidth;
+ for(sal_uInt16 i = 1; i < 8; i++)
+ InsertDataColumn( i, *aTitles[i - 1], nWidth,
+ HIB_STDSTYLE, HEADERBAR_APPEND );
+
+}
+/* -----------------------------19.01.00 11:29--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwEntryBrowseBox::SeekRow( long nRow )
+{
+ nCurrentRow = nRow;
+ return TRUE;
+}
+/* -----------------------------19.01.00 15:32--------------------------------
+
+ ---------------------------------------------------------------------------*/
+String SwEntryBrowseBox::GetCellText(long nRow, USHORT nColumn) const
+{
+ const String* pRet = &aEmptyStr;
+ if(aEntryArr.Count() > nRow)
+ {
+ AutoMarkEntry* pEntry = aEntryArr[ static_cast< USHORT >(nRow) ];
+ switch(nColumn)
+ {
+ case ITEM_SEARCH :pRet = &pEntry->sSearch; break;
+ case ITEM_ALTERNATIVE :pRet = &pEntry->sAlternative; break;
+ case ITEM_PRIM_KEY :pRet = &pEntry->sPrimKey ; break;
+ case ITEM_SEC_KEY :pRet = &pEntry->sSecKey ; break;
+ case ITEM_COMMENT :pRet = &pEntry->sComment ; break;
+ case ITEM_CASE :pRet = pEntry->bCase ? &sYes : &sNo; break;
+ case ITEM_WORDONLY :pRet = pEntry->bWord ? &sYes : &sNo; break;
+ }
+ }
+ return *pRet;
+}
+
+/* -----------------------------19.01.00 11:29--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwEntryBrowseBox::PaintCell(OutputDevice& rDev,
+ const Rectangle& rRect, sal_uInt16 nColumnId) const
+{
+ String sPaint = GetCellText( nCurrentRow, nColumnId );
+ sal_uInt16 nStyle = TEXT_DRAW_CLIP | TEXT_DRAW_CENTER;
+ rDev.DrawText( rRect, sPaint, nStyle );
+}
+/* -----------------------------19.01.00 14:51--------------------------------
+
+ ---------------------------------------------------------------------------*/
+::svt::CellController* SwEntryBrowseBox::GetController(long /*nRow*/, sal_uInt16 nCol)
+{
+ return nCol < ITEM_CASE ? xController : xCheckController;
+}
+/* -----------------------------19.01.00 15:36--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwEntryBrowseBox::SaveModified()
+{
+ SetModified();
+ USHORT nRow = static_cast< USHORT >(GetCurRow());
+ sal_uInt16 nCol = GetCurColumnId();
+
+ String sNew;
+ sal_Bool bVal = sal_False;
+ ::svt::CellController* pController = 0;
+ if(nCol < ITEM_CASE)
+ {
+ pController = xController;
+ sNew = ((::svt::EditCellController*)pController)->GetEditImplementation()->GetText( LINEEND_LF );
+ }
+ else
+ {
+ pController = xCheckController;
+ bVal = ((::svt::CheckBoxCellController*)pController)->GetCheckBox().IsChecked();
+ }
+ AutoMarkEntry* pEntry = nRow >= aEntryArr.Count() ? new AutoMarkEntry
+ : aEntryArr[nRow];
+ switch(nCol)
+ {
+ case ITEM_SEARCH : pEntry->sSearch = sNew; break;
+ case ITEM_ALTERNATIVE : pEntry->sAlternative = sNew; break;
+ case ITEM_PRIM_KEY : pEntry->sPrimKey = sNew; break;
+ case ITEM_SEC_KEY : pEntry->sSecKey = sNew; break;
+ case ITEM_COMMENT : pEntry->sComment = sNew; break;
+ case ITEM_CASE : pEntry->bCase = bVal; break;
+ case ITEM_WORDONLY : pEntry->bWord = bVal; break;
+ }
+ if(nRow >= aEntryArr.Count())
+ {
+ aEntryArr.Insert( pEntry, aEntryArr.Count() );
+ RowInserted(nRow, 1, sal_True, sal_True);
+ if(nCol < ITEM_WORDONLY)
+ {
+ pController->ClearModified();
+ GoToRow( nRow );
+ }
+ }
+ return sal_True;
+}
+/* -----------------------------19.01.00 14:32--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwEntryBrowseBox::InitController(
+ ::svt::CellControllerRef& rController, long nRow, sal_uInt16 nCol)
+{
+ String rTxt = GetCellText( nRow, nCol );
+ if(nCol < ITEM_CASE)
+ {
+ rController = xController;
+ ::svt::CellController* pController = xController;
+ ((::svt::EditCellController*)pController)->GetEditImplementation()->SetText( rTxt );
+ }
+ else
+ {
+ rController = xCheckController;
+ ::svt::CellController* pController = xCheckController;
+ ((::svt::CheckBoxCellController*)pController)->GetCheckBox().Check(
+ rTxt == sYes );
+ }
+}
+/* -----------------------------19.01.00 12:19--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwEntryBrowseBox::ReadEntries(SvStream& rInStr)
+{
+ AutoMarkEntry* pToInsert = 0;
+ const String sZero('0');
+ rtl_TextEncoding eTEnc = gsl_getSystemTextEncoding();
+ while( !rInStr.GetError() && !rInStr.IsEof() )
+ {
+ String sLine;
+ rInStr.ReadByteStringLine( sLine, eTEnc );
+
+ // # -> comment
+ // ; -> delimiter between entries ->
+ // Format: TextToSearchFor;AlternativeString;PrimaryKey;SecondaryKey
+ // Leading and trailing blanks are ignored
+ if( sLine.Len() )
+ {
+ //comments are contained in separate lines but are put into the struct of the following data
+ //line (if available)
+ if( '#' != sLine.GetChar(0) )
+ {
+ if( !pToInsert )
+ pToInsert = new AutoMarkEntry;
+
+ USHORT nSttPos = 0;
+ pToInsert->sSearch = sLine.GetToken(0, ';', nSttPos );
+ pToInsert->sAlternative = sLine.GetToken(0, ';', nSttPos );
+ pToInsert->sPrimKey = sLine.GetToken(0, ';', nSttPos );
+ pToInsert->sSecKey = sLine.GetToken(0, ';', nSttPos );
+
+ String sStr = sLine.GetToken(0, ';', nSttPos );
+ pToInsert->bCase = sStr.Len() && sStr != sZero;
+
+ sStr = sLine.GetToken(0, ';', nSttPos );
+ pToInsert->bWord = sStr.Len() && sStr != sZero;
+
+ aEntryArr.Insert( pToInsert, aEntryArr.Count() );
+ pToInsert = 0;
+ }
+ else
+ {
+ if(pToInsert)
+ aEntryArr.Insert(pToInsert, aEntryArr.Count());
+ pToInsert = new AutoMarkEntry;
+ pToInsert->sComment = sLine;
+ pToInsert->sComment.Erase(0, 1);
+ }
+ }
+ }
+ if( pToInsert )
+ aEntryArr.Insert(pToInsert, aEntryArr.Count());
+ RowInserted(0, aEntryArr.Count() + 1, sal_True);
+}
+/* -----------------------------19.01.00 12:19--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwEntryBrowseBox::WriteEntries(SvStream& rOutStr)
+{
+ //check if the current controller is modified
+ sal_uInt16 nCol = GetCurColumnId();
+ ::svt::CellController* pController;
+ if(nCol < ITEM_CASE)
+ pController = xController;
+ else
+ pController = xCheckController;
+ if(pController ->IsModified())
+ GoToColumnId(nCol < ITEM_CASE ? ++nCol : --nCol );
+
+ rtl_TextEncoding eTEnc = gsl_getSystemTextEncoding();
+ for(sal_uInt16 i = 0; i < aEntryArr.Count();i++)
+ {
+ AutoMarkEntry* pEntry = aEntryArr[i];
+ if(pEntry->sComment.Len())
+ {
+ String sWrite('#');
+ sWrite += pEntry->sComment;
+ rOutStr.WriteByteStringLine( sWrite, eTEnc );
+ }
+
+ String sWrite( pEntry->sSearch );
+ sWrite += ';';
+ sWrite += pEntry->sAlternative;
+ sWrite += ';';
+ sWrite += pEntry->sPrimKey;
+ sWrite += ';';
+ sWrite += pEntry->sSecKey;
+ sWrite += ';';
+ sWrite += pEntry->bCase ? '1' : '0';
+ sWrite += ';';
+ sWrite += pEntry->bWord ? '1' : '0';
+
+ if( sWrite.Len() > 5 )
+ rOutStr.WriteByteStringLine( sWrite, eTEnc );
+ }
+}
+/* -----------------------------21.01.00 11:49--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwEntryBrowseBox::IsModified()const
+{
+ if(bModified)
+ return sal_True;
+
+
+ //check if the current controller is modified
+ sal_uInt16 nCol = GetCurColumnId();
+ ::svt::CellController* pController;
+ if(nCol < ITEM_CASE)
+ pController = xController;
+ else
+ pController = xCheckController;
+ return pController ->IsModified();
+}
+/* -----------------------------19.01.00 11:29--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwAutoMarkDlg_Impl::SwAutoMarkDlg_Impl(Window* pParent, const String& rAutoMarkURL,
+ const String& rAutoMarkType, sal_Bool bCreate) :
+ ModalDialog(pParent, SW_RES(DLG_CREATE_AUTOMARK)),
+ aOKPB( this, SW_RES(PB_OK )),
+ aCancelPB( this, SW_RES(PB_CANCEL )),
+ aHelpPB( this, SW_RES(PB_HELP )),
+ aEntriesBB( this, SW_RES(BB_ENTRIES )),
+ aEntriesFL( this, SW_RES(FL_ENTRIES )),
+ sAutoMarkURL(rAutoMarkURL),
+ sAutoMarkType(rAutoMarkType),
+ bCreateMode(bCreate)
+{
+ FreeResource();
+ aOKPB.SetClickHdl(LINK(this, SwAutoMarkDlg_Impl, OkHdl));
+
+ String sTitle = GetText();
+ sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM(": "));
+ sTitle += sAutoMarkURL;
+ SetText(sTitle);
+ sal_Bool bError = sal_False;
+ if( bCreateMode )
+ aEntriesBB.RowInserted(0, 1, sal_True);
+ else
+ {
+ SfxMedium aMed( sAutoMarkURL, STREAM_STD_READ, FALSE );
+ if( aMed.GetInStream() && !aMed.GetInStream()->GetError() )
+ aEntriesBB.ReadEntries( *aMed.GetInStream() );
+ else
+ bError = sal_True;
+ }
+
+ if(bError)
+ EndDialog(RET_CANCEL);
+}
+/* -----------------------------19.01.00 11:12--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwAutoMarkDlg_Impl::~SwAutoMarkDlg_Impl()
+{
+}
+/* -----------------------------19.01.00 16:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwAutoMarkDlg_Impl, OkHdl, OKButton*, EMPTYARG)
+{
+ sal_Bool bError = sal_False;
+ if(aEntriesBB.IsModified() || bCreateMode)
+ {
+ SfxMedium aMed( sAutoMarkURL,
+ bCreateMode ? STREAM_WRITE
+ : STREAM_WRITE| STREAM_TRUNC,
+ FALSE );
+ SvStream* pStrm = aMed.GetOutStream();
+ pStrm->SetStreamCharSet( RTL_TEXTENCODING_MS_1253 );
+ if( !pStrm->GetError() )
+ {
+ aEntriesBB.WriteEntries( *pStrm );
+ aMed.Commit();
+ }
+ else
+ bError = sal_True;
+ }
+ if( !bError )
+ EndDialog(RET_OK);
+ return 0;
+}
+
diff --git a/sw/source/ui/index/cnttab.hrc b/sw/source/ui/index/cnttab.hrc
new file mode 100644
index 000000000000..c544be2c7a2e
--- /dev/null
+++ b/sw/source/ui/index/cnttab.hrc
@@ -0,0 +1,284 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define CB_MARKS 4
+#define CB_OUTLN 5
+#define FT_LEVEL 6
+#define ED_LEVEL 7
+#define FL_CREATE 8
+#define ED_BSP 11
+#define FL_BSP 12
+#define BT_OUTLN 13
+#define FL_TITLE 14
+#define ED_TITLE 15
+#define BT_HELP 16
+#define ST_AUTHTYPE 17
+
+#define LB_ENTRY 20
+#define FT_NUM 21
+#define ED_ENTRY 22
+#define BT_ENTRY_NUMBER 23
+#define BT_ENTRY_TEXT 24
+#define BT_TAB 25
+#define BT_STD 26
+#define BT_PAGE 27
+#define FL_ENTRY 28
+//#define FT_LEVEL 28
+#define LB_LEVEL 29
+#define FT_TEMPLATE 30
+#define LB_PARALAY 31
+#define BT_ASSIGN 32
+#define FL_FORMAT 33
+#define BT_ENTRY 34
+//#define BT_EDIT 34
+#define BT_JUMP 35
+#define CB_RECALC_TABS 36
+#define CB_FIRST_TAB_POS 37
+#define MF_FIRST_TAB_POS 38
+#define CB_REL_TO_TEXT 39
+#define BT_EDIT_STYLE 40
+#define CB_SAME 41
+#define CB_FF 42
+#define CB_CASE 43
+#define CB_SEC 44
+#define CB_ALPHA 45
+#define FL_OPT 46
+#define CB_MAKRS 47
+#define DLB_TOD 48
+#define CB_TEMPL 49
+#define DLB_LAYOUT 50
+#define CB_OBJECT 51
+#define DLB_OBJECT 52
+#define FL_SOURCE 53
+#define CB_USER_MARKS 54
+#define BT_ALL_LEVEL 55
+#define FT_MAIN_ENTRY_STYLE 56
+#define LB_MAIN_ENTRY_STYLE 57
+
+//restart numbering
+#define FT_TYPE 1
+#define LB_TYPE 2
+#define CB_READONLY 3
+#define FT_TITLE 4
+
+#define FL_TYPETITLE 6
+#define LB_AREA 7
+
+#define NF_LEVEL 9
+#define FL_AREA 10
+#define CB_FROMHEADINGS 11
+#define PB_CHAPTERDLG 12
+#define CB_ADDSTYLES 13
+#define PB_ADDSTYLES 14
+
+
+#define CB_FROMOLE 17
+#define CB_LEVELFROMCHAPTER 18
+#define RB_FROMCAPTIONS 19
+#define RB_FROMOBJECTNAMES 20
+#define CB_TOXMARKS 21
+#define FL_CREATEFROM 22
+#define CB_COLLECTSAME 23
+#define CB_USEFF 24
+#define CB_CASESENSITIVE 25
+#define CB_INITIALCAPS 26
+#define CB_KEYASENTRY 27
+#define CB_FROMFILE 28
+
+#define MB_AUTOMARK 29
+#define FL_IDXOPTIONS 30
+
+#define FT_TOKEN 32
+#define CB_USE_DASH 33
+#define FL_LEVEL 34
+#define WIN_TOKEN 35
+#define PB_ENTRYNO 36
+#define PB_ENTRY 37
+#define PB_CHAPTERINFO 38
+#define PB_PAGENO 39
+#define PB_TAB 40
+#define PB_HYPERLINK 41
+#define FT_CHARSTYLE 42
+#define LB_CHARSTYLE 43
+#define PB_EDITSTYLE 44
+#define FT_FILLCHAR 45
+#define CB_FILLCHAR 46
+#define FT_CHAPTERENTRY 47
+#define LB_CHAPTERENTRY 48
+#define FT_SORTING 49
+#define LB_SORTING 50
+#define FT_TABPOS 51
+#define MF_TABPOS 52
+#define CB_AUTORIGHT 53
+#define CB_RELTOSTYLE 54
+#define CB_RECALCTAB 56
+#define CB_NUMSTYLEFROMPDESC 57
+#define CB_ALPHADELIM 58
+#define CB_COMMASEPARATED 59
+
+#define STR_NO_CHAR_STYLE 61
+#define CLB_FROMOBJ 62
+#define FL_FROMOBJ 63
+#define RES_SRCTYPES 64
+#define WIN_LEFT_SCROLL 65
+#define WIN_CTRL_PARENT 66
+#define WIN_RIGHT_SCROLL 67
+#define PB_ALL_LEVELS 68
+#define FT_AREA 69
+#define STR_BUTTON_TEXT_START 70
+#define STR_TOKEN_ENTRY_NO (STR_BUTTON_TEXT_START)
+#define STR_TOKEN_ENTRY_TEXT (STR_BUTTON_TEXT_START + 1)
+#define STR_TOKEN_ENTRY (STR_BUTTON_TEXT_START + 2)
+#define STR_TOKEN_TAB_STOP (STR_BUTTON_TEXT_START + 3)
+#define STR_TOKEN_TEXT (STR_BUTTON_TEXT_START + 4)
+#define STR_TOKEN_PAGE_NUMS (STR_BUTTON_TEXT_START + 5)
+#define STR_TOKEN_CHAPTER_INFO (STR_BUTTON_TEXT_START + 6)
+#define STR_TOKEN_LINK_START (STR_BUTTON_TEXT_START + 7)
+#define STR_TOKEN_LINK_END (STR_BUTTON_TEXT_START + 8)
+#define STR_TOKEN_AUTHORITY (STR_BUTTON_TEXT_START + 9)
+
+#define STR_BUTTON_HELP_TEXT_START (STR_TOKEN_AUTHORITY + 1)
+#define STR_TOKEN_HELP_ENTRY_NO (STR_BUTTON_HELP_TEXT_START)
+#define STR_TOKEN_HELP_ENTRY_TEXT (STR_BUTTON_HELP_TEXT_START + 1)
+#define STR_TOKEN_HELP_ENTRY (STR_BUTTON_HELP_TEXT_START + 2)
+#define STR_TOKEN_HELP_TAB_STOP (STR_BUTTON_HELP_TEXT_START + 3)
+#define STR_TOKEN_HELP_TEXT (STR_BUTTON_HELP_TEXT_START + 4)
+#define STR_TOKEN_HELP_PAGE_NUMS (STR_BUTTON_HELP_TEXT_START + 5)
+#define STR_TOKEN_HELP_CHAPTER_INFO (STR_BUTTON_HELP_TEXT_START + 6)
+#define STR_TOKEN_HELP_LINK_START (STR_BUTTON_HELP_TEXT_START + 7)
+#define STR_TOKEN_HELP_LINK_END (STR_BUTTON_HELP_TEXT_START + 8)
+#define STR_TOKEN_HELP_AUTHORITY (STR_BUTTON_HELP_TEXT_START + 9)
+
+#define STR_CHARSTYLE (STR_TOKEN_HELP_AUTHORITY + 1)
+#define TLB_STYLES 100
+#define FL_STYLES 101
+#define PB_OK 102
+#define PB_CANCEL 103
+#define PB_HELP 104
+#define FT_CAPTIONSEQUENCE 105
+#define LB_CAPTIONSEQUENCE 106
+#define FT_DISPLAYTYPE 107
+#define LB_DISPLAYTYPE 108
+#define TR_HEADER 109
+#define PB_LEFT 110
+#define PB_RIGHT 111
+#define HB_STYLES 112
+#define ST_HB_FIRST 113
+#define CB_FROMTABLES 114
+#define CB_FROMFRAMES 115
+#define CB_FROMGRAPHICS 116
+#define ST_USER_ADDSTYLE 117
+#define ST_AUTOMARK_TYPE 118
+#define LB_AUTHFIELD 119
+#define PB_AUTHINSERT 120
+#define PB_AUTHREMOVE 121
+#define CB_SEQUENCE 122
+#define FT_BRACKET 123
+#define LB_BRACKET 124
+#define FL_AUTHORITY 125
+#define RB_DOCPOS 126
+#define RB_SORTCONTENT 127
+#define FT_FIRSTKEY 128
+#define LB_FIRSTKEY 129
+#define FT_SECONDKEY 130
+#define LB_SECONDKEY 131
+#define FT_THIRDDKEY 132
+#define LB_THIRDKEY 133
+#define FL_SORTKEY 134
+#define FL_SORTING 135
+#define STR_NOSORTKEY 136
+#define RB_SORTUP1 137
+#define RB_SORTUP2 138
+#define RB_SORTUP3 139
+#define RB_SORTDOWN1 140
+#define RB_SORTDOWN2 141
+#define RB_SORTDOWN3 142
+#define STR_DELIM 143
+#define FL_SORTOPTIONS 144
+#define FT_LANGUAGE 145
+#define LB_LANGUAGE 146
+#define FT_SORTALG 147
+#define LB_SORTALG 148
+#define IMG_SORTUP_HC 149
+#define IMG_SORTDOWN_HC 150
+#define ST_NO_BRACKET 151
+
+#define FT_LEVEL_OL 152
+#define NF_LEVEL_OL 153
+#define FT_ENTRY_NO 154
+#define LB_ENTRY_NO 155
+
+#define TO_CONTENT 1
+#define TO_INDEX 2
+#define TO_ILLUSTRATION 4
+#define TO_TABLE 8
+#define TO_USER 16
+#define TO_OBJECT 32
+#define TO_AUTHORITIES 64
+
+#define AREA_DOCUMENT 1
+#define AREA_CHAPTER 2
+
+//TabDialog
+#define WIN_EXAMPLE 1
+#define RES_EXAMPLE_TEXT 2
+
+#define ST_HEADING_1 4
+#define ST_TEXT_1 5
+#define ST_HEADING_1_1 6
+#define ST_TEXT_1_1 7
+#define ST_HEADING_1_2 8
+#define ST_TEXT_1_2 9
+#define ST_TABLE_LABEL 10
+#define ST_FRAME_LABEL 11
+#define ST_GRAPHIC_LABEL 12
+#define ST_USERDEFINEDINDEX 13
+#define CB_SHOWEXAMPLE 14
+
+
+// AutoMark dialog
+#define BB_ENTRIES 1
+#define FL_ENTRIES 2
+
+#define ST_SEARCH 10
+#define ST_ALTERNATIVE 11
+#define ST_PRIMKEY 12
+#define ST_SECKEY 13
+#define ST_COMMENT 14
+#define ST_CASESENSITIVE 15
+#define ST_WORDONLY 16
+#define ST_TRUE 17
+#define ST_FALSE 18
+
+
+//ButtonMenu
+#define MN_AUTOMARK_OPEN 1
+#define MN_AUTOMARK_NEW 2
+#define MN_AUTOMARK_EDIT 3
+
+
+
+
diff --git a/sw/source/ui/index/cnttab.src b/sw/source/ui/index/cnttab.src
new file mode 100644
index 000000000000..9b97b8931b7f
--- /dev/null
+++ b/sw/source/ui/index/cnttab.src
@@ -0,0 +1,1350 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "index.hrc"
+#include "globals.hrc"
+#include "cnttab.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+
+String STR_TITLE
+{
+ Text [ en-US ] = "Title" ;
+};
+String STR_ALPHA
+{
+ Text [ en-US ] = "Separator" ;
+};
+String STR_LEVEL
+{
+ Text [ en-US ] = "Level " ;
+};
+String STR_FILE_NOT_FOUND
+{
+ Text [ en-US ] = "The file, \"%1\" in the \"%2\" path could not be found.";
+};
+/*************************************************************************
+
+*************************************************************************/
+TabDialog DLG_MULTI_TOX
+{
+ HelpID = HID_MULTI_TOX_DLG;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+
+ Moveable = TRUE ;
+
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_TOX_SELECT;
+ PageResID = TP_TOX_SELECT;
+ Text [ en-US ] = "Index/Table";
+ };
+ PageItem
+ {
+ Identifier = TP_TOX_ENTRY;
+ PageResID = TP_TOX_ENTRY;
+ Text [ en-US ] = "Entries";
+ };
+ PageItem
+ {
+ Identifier = TP_TOX_STYLES;
+ PageResID = TP_TOX_STYLES;
+ Text [ en-US ] = "Styles";
+ };
+ PageItem
+ {
+ Identifier = TP_COLUMN ;
+ PageResID = TP_COLUMN ;
+ Text [ en-US ] = "Columns" ;
+ };
+ PageItem
+ {
+ Identifier = TP_BACKGROUND ;
+ PageResID = TP_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ };
+ };
+ };
+ Window WIN_EXAMPLE
+ {
+ Pos = MAP_APPFONT ( 0 , 12 ) ;
+ Size = MAP_APPFONT ( 150, 188 ) ;
+ };
+ String ST_USERDEFINEDINDEX
+ {
+ Text [ en-US ] = "User-Defined Index";
+ };
+ CheckBox CB_SHOWEXAMPLE
+ {
+ Size = MAP_APPFONT ( 200, 10 ) ;
+ Text [ en-US ] = "Preview";
+ };
+ Text [ en-US ] = "Insert Index/Table";
+};
+//------------------------------------------------------------------
+TabPage TP_TOX_SELECT
+{
+ HelpID = HID_TP_TOX_SELECT;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+
+ FixedLine FL_TYPETITLE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248, 8 ) ;
+ Text [ en-US ] = "Type and title";
+ };
+ FixedText FT_TITLE
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 30 ,10 ) ;
+ Text [ en-US ] = "~Title";
+ };
+ Edit ED_TITLE
+ {
+ HelpID = "sw:Edit:TP_TOX_SELECT:ED_TITLE";
+ Pos = MAP_APPFONT ( 45 , 14 ) ;
+ Size = MAP_APPFONT ( 203 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedText FT_TYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 30, 10 ) ;
+ Text [ en-US ] = "Type";
+ };
+ ListBox LB_TYPE
+ {
+ HelpID = "sw:ListBox:TP_TOX_SELECT:LB_TYPE";
+ Pos = MAP_APPFONT ( 45 , 30 ) ;
+ Size = MAP_APPFONT ( 80 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Table of Contents" ; TO_CONTENT ;> ;
+ < "Alphabetical Index" ; TO_INDEX ;> ;
+ < "Illustration Index" ; TO_ILLUSTRATION ;> ;
+ < "Index of Tables" ; TO_TABLE ;> ;
+ < "User-Defined" ; TO_USER ;> ;
+ < "Table of Objects" ; TO_OBJECT ;> ;
+ < "Bibliography" ; TO_AUTHORITIES ;> ;
+ };
+ };
+ CheckBox CB_READONLY
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_READONLY";
+ Pos = MAP_APPFONT ( 51 , 46 ) ;
+ Size = MAP_APPFONT ( 200 , 10 ) ;
+ Check = TRUE;
+ Text [ en-US ] = "Protected against manual changes";
+ };
+ FixedLine FL_AREA
+ {
+ Pos = MAP_APPFONT ( 6 , 59 ) ;
+ Size = MAP_APPFONT ( 248, 8 ) ;
+ Text [ en-US ] = "Create index/table";
+ };
+ FixedText FT_AREA
+ {
+ Pos = MAP_APPFONT ( 12 , 72 ) ;
+ Size = MAP_APPFONT ( 30, 8 ) ;
+ Text [ en-US ] = "for";
+ };
+ ListBox LB_AREA
+ {
+ HelpID = "sw:ListBox:TP_TOX_SELECT:LB_AREA";
+ Pos = MAP_APPFONT ( 45 , 70 ) ;
+ Size = MAP_APPFONT ( 80 , 12 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Entire document" ; AREA_DOCUMENT ;> ;
+ < "Chapter" ; AREA_CHAPTER ;> ;
+ };
+ };
+ FixedText FT_LEVEL
+ {
+ Pos = MAP_APPFONT ( 130 , 70 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Evaluate up to level";
+ };
+ NumericField NF_LEVEL
+ {
+ HelpID = "sw:NumericField:TP_TOX_SELECT:NF_LEVEL";
+ Pos = MAP_APPFONT ( 231 , 72 ) ;
+ Size = MAP_APPFONT ( 20 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 10 ;
+ Value = 10 ;
+ SpinSize = 1 ;
+ };
+ FixedLine FL_CREATEFROM
+ {
+ Pos = MAP_APPFONT ( 6 , 87 ) ;
+ Size = MAP_APPFONT ( 248, 8 ) ;
+ Text [ en-US ] = "Create from";
+ };
+ CheckBox CB_FROMHEADINGS
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_FROMHEADINGS";
+ Pos = MAP_APPFONT ( 12 , 99 ) ;
+ Size = MAP_APPFONT ( 95 , 10 ) ;
+ Check = TRUE;
+ Text [ en-US ] = "Outline";
+ };
+// #outline level,removed by zhaojianwei
+/* PushButton PB_CHAPTERDLG
+ {
+ Pos = MAP_APPFONT ( 115 , 98 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ Text = "~..." ;
+ TabStop = TRUE ;
+ };
+*/
+ CheckBox CB_ADDSTYLES
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_ADDSTYLES";
+ Pos = MAP_APPFONT ( 12 , 115 ) ;
+ Size = MAP_APPFONT ( 75 , 10 ) ;
+ Text [ en-US ] = "~Additional Styles";
+ };
+ String ST_USER_ADDSTYLE
+ {
+ Text [ en-US ] = "Styl~es";
+ };
+ PushButton PB_ADDSTYLES
+ {
+ HelpID = "sw:PushButton:TP_TOX_SELECT:PB_ADDSTYLES";
+ Pos = MAP_APPFONT ( 115 , 114 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ Text = "..." ;
+ TabStop = TRUE ;
+ };
+ CheckBox CB_TOXMARKS
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_TOXMARKS";
+ Pos = MAP_APPFONT ( 12 , 131 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Text [ en-US ] = "Inde~x marks";
+ };
+
+ RadioButton RB_FROMCAPTIONS
+ {
+ HelpID = "sw:RadioButton:TP_TOX_SELECT:RB_FROMCAPTIONS";
+ Pos = MAP_APPFONT ( 12 , 98 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Text [ en-US ] = "Captions";
+ };
+ FixedText FT_CAPTIONSEQUENCE
+ {
+ Pos = MAP_APPFONT ( 12 , 114 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "Category";
+ };
+ ListBox LB_CAPTIONSEQUENCE
+ {
+ HelpID = "sw:ListBox:TP_TOX_SELECT:LB_CAPTIONSEQUENCE";
+ Pos = MAP_APPFONT ( 55 , 112 ) ;
+ Size = MAP_APPFONT ( 70 , 40 ) ;
+ DropDown = TRUE;
+ TabStop = TRUE;
+ };
+ FixedText FT_DISPLAYTYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 130 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "Display";
+ };
+ ListBox LB_DISPLAYTYPE
+ {
+ HelpID = "sw:ListBox:TP_TOX_SELECT:LB_DISPLAYTYPE";
+ Pos = MAP_APPFONT ( 55 , 128 ) ;
+ Size = MAP_APPFONT ( 70 , 40 ) ;
+ DropDown = TRUE;
+ TabStop = TRUE;
+ StringList [ en-US ] =
+ {
+ < "References" ; > ;
+ < "Category and Number" ; > ;
+ < "Caption Text" ; > ;
+ };
+ };
+ RadioButton RB_FROMOBJECTNAMES
+ {
+ HelpID = "sw:RadioButton:TP_TOX_SELECT:RB_FROMOBJECTNAMES";
+ Pos = MAP_APPFONT ( 156 , 98 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Text [ en-US ] = "Object names";
+ };
+ CheckBox CB_COLLECTSAME
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_COLLECTSAME";
+ Pos = MAP_APPFONT ( 12 , 98 ) ;
+ Size = MAP_APPFONT ( 121 , 10 ) ;
+ Text [ en-US ] = "Combine identical entries";
+ };
+ CheckBox CB_USEFF
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_USEFF";
+ Pos = MAP_APPFONT ( 18 , 111 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ Text [ en-US ] = "Combine identical entries with p or ~pp";
+ };
+ CheckBox CB_USE_DASH
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_USE_DASH";
+ Pos = MAP_APPFONT ( 18 , 124 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ Text [ en-US ] = "Combine with -";
+ };
+ CheckBox CB_CASESENSITIVE
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_CASESENSITIVE";
+ Pos = MAP_APPFONT ( 18 , 137 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ Text [ en-US ] = "Case sensitive";
+ };
+ CheckBox CB_INITIALCAPS
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_INITIALCAPS";
+ Pos = MAP_APPFONT ( 136 , 98 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ Text [ en-US ] = "AutoCapitalize entries";
+ };
+ CheckBox CB_KEYASENTRY
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_KEYASENTRY";
+ Pos = MAP_APPFONT ( 136, 111 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ Text [ en-US ] = "Keys as separate entries";
+ };
+ CheckBox CB_FROMFILE
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_FROMFILE";
+ Pos = MAP_APPFONT ( 136 , 124 ) ;
+ Size = MAP_APPFONT ( 115 , 10 ) ;
+ Text [ en-US ] = "~Concordance file";
+ };
+ MenuButton MB_AUTOMARK
+ {
+ HelpID = "sw:MenuButton:TP_TOX_SELECT:MB_AUTOMARK";
+ Pos = MAP_APPFONT ( 136 , 137 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ ButtonMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_AUTOMARK_OPEN ;
+ Text [ en-US ] = "Open";
+ };
+ MenuItem
+ {
+ Identifier = MN_AUTOMARK_NEW ;
+ Text [ en-US ] = "~New...";
+ };
+ MenuItem
+ {
+ Identifier = MN_AUTOMARK_EDIT ;
+ Text [ en-US ] = "~Edit...";
+ };
+ };
+ };
+ Text [ en-US ] = "~File";
+ };
+ CheckBox CB_FROMTABLES
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_FROMTABLES";
+ Pos = MAP_APPFONT ( 112 , 99 ) ;
+ Size = MAP_APPFONT ( 68 , 10 ) ;
+ Text [ en-US ] = "Tables";
+ };
+ CheckBox CB_FROMFRAMES
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_FROMFRAMES";
+ Pos = MAP_APPFONT ( 182 , 99 ) ;
+ Size = MAP_APPFONT ( 68 , 10 ) ;
+ Text [ en-US ] = "Te~xt frames";
+ };
+ CheckBox CB_FROMGRAPHICS
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_FROMGRAPHICS";
+ Pos = MAP_APPFONT ( 112 , 113 ) ;
+ Size = MAP_APPFONT ( 68 , 10 ) ;
+ Text [ en-US ] = "Graphics";
+ };
+ CheckBox CB_FROMOLE
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_FROMOLE";
+ Pos = MAP_APPFONT ( 182 , 113 ) ;
+ Size = MAP_APPFONT ( 68 , 10 ) ;
+ Text [ en-US ] = "OLE objects";
+ };
+ CheckBox CB_LEVELFROMCHAPTER
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_LEVELFROMCHAPTER";
+ Pos = MAP_APPFONT ( 118 , 127 ) ;
+ Size = MAP_APPFONT ( 103 , 10 ) ;
+ Text [ en-US ] = "Use level from source chapter";
+ };
+ FixedLine FL_IDXOPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 87 ) ;
+ Size = MAP_APPFONT ( 248, 8 ) ;
+ Text [ en-US ] = "Options";
+ };
+ Control CLB_FROMOBJ
+ {
+ Pos = MAP_APPFONT ( 12 , 98 ) ;
+ Size = MAP_APPFONT ( 236 ,49 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ Resource RES_SRCTYPES
+ {
+ StringArray 1
+ {
+/* ids from tox.hxx
+ TOO_MATH = 0x01,
+ TOO_CHART = 0x02,
+ TOO_IMAGE = 0x04,
+ TOO_CALC = 0x08,
+ TOO_DRAW_IMPRESS= 0x10,
+ TOO_OTHER = 0x80*/
+
+ ItemList [ en-US ] =
+ {
+ < "%PRODUCTNAME Math" ; 1;> ;
+ < "%PRODUCTNAME Chart" ; 2;> ;
+ < "%PRODUCTNAME Calc" ; 8;> ;
+ < "%PRODUCTNAME Draw/%PRODUCTNAME Impress" ; 16;> ;
+ < "Other OLE Objects"; 128;> ;
+ };
+ };
+ };
+ FixedLine FL_FROMOBJ
+ {
+ Pos = MAP_APPFONT ( 6 , 87) ;
+ Size = MAP_APPFONT ( 248, 8 ) ;
+ Text [ en-US ] = "Create from the following objects";
+ };
+ CheckBox CB_SEQUENCE
+ {
+ HelpID = "sw:CheckBox:TP_TOX_SELECT:CB_SEQUENCE";
+ Pos = MAP_APPFONT ( 12, 70) ;
+ Size = MAP_APPFONT ( 100, 10 ) ;
+ Text [ en-US ] = "~Number entries";
+ };
+ FixedText FT_BRACKET
+ {
+ Pos = MAP_APPFONT ( 12, 86) ;
+ Size = MAP_APPFONT ( 60, 8 ) ;
+ Text [ en-US ] = "~Brackets";
+ };
+ ListBox LB_BRACKET
+ {
+ HelpID = "sw:ListBox:TP_TOX_SELECT:LB_BRACKET";
+ Pos = MAP_APPFONT ( 75, 84) ;
+ Size = MAP_APPFONT ( 40, 50 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ StringList =
+ {
+ < "[]" ;> ;
+ < "()" ;> ;
+ < "{}" ;> ;
+ < "<>" ;> ;
+ };
+ };
+ String ST_NO_BRACKET
+ {
+ Text [ en-US ] = "[none]";
+ };
+ FixedLine FL_AUTHORITY
+ {
+ Pos = MAP_APPFONT ( 6 , 59) ;
+ Size = MAP_APPFONT ( 248, 8 ) ;
+ Text [ en-US ] = "Formatting of the entries";
+ };
+ String ST_AUTOMARK_TYPE
+ {
+ Text [ en-US ] = "Selection file for the alphabetical index (*.sdi)";
+ };
+ FixedLine FL_SORTOPTIONS
+ {
+ Pos = MAP_APPFONT ( 6, 153) ;
+ Size = MAP_APPFONT ( 248, 8 ) ;
+ Text [ en-US ] = "Sort";
+ };
+ FixedText FT_LANGUAGE
+ {
+ Pos = MAP_APPFONT ( 12, 166) ;
+ Size = MAP_APPFONT ( 33, 8 ) ;
+ Text [ en-US ] = "Language";
+ };
+ ListBox LB_LANGUAGE
+ {
+ HelpID = "sw:ListBox:TP_TOX_SELECT:LB_LANGUAGE";
+ Pos = MAP_APPFONT ( 47, 164) ;
+ Size = MAP_APPFONT ( 80, 50 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ };
+ FixedText FT_SORTALG
+ {
+ Pos = MAP_APPFONT ( 130, 166) ;
+ Size = MAP_APPFONT ( 50, 8 ) ;
+ Text [ en-US ] = "Key type";
+ };
+ ListBox LB_SORTALG
+ {
+ HelpID = "sw:ListBox:TP_TOX_SELECT:LB_SORTALG";
+ Pos = MAP_APPFONT ( 201, 164) ;
+ Size = MAP_APPFONT ( 50, 50 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ };
+};
+
+TabPage TP_TOX_ENTRY
+{
+ HelpID = HID_TP_TOX_ENTRY;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedText FT_LEVEL
+ {
+ Pos = MAP_APPFONT ( 6, 3 ) ;
+ Size = MAP_APPFONT ( 25, 8 ) ;
+ Text [ en-US ] = "~Level";
+ };
+ Control LB_LEVEL
+ {
+ Pos = MAP_APPFONT ( 6, 15 ) ;
+ Size = MAP_APPFONT ( 25, 167 ) ;
+ TabStop = TRUE ;
+ Border = TRUE;
+ };
+ String ST_AUTHTYPE
+ {
+ Text [ en-US ] = "~Type";
+ };
+ FixedText FT_TOKEN
+ {
+ Pos = MAP_APPFONT ( 37, 18 ) ;
+ Size = MAP_APPFONT ( 30, 8 ) ;
+ Text [ en-US ] = "~Structure";
+ };
+ Window WIN_TOKEN
+ {
+ Pos = MAP_APPFONT ( 70, 16 ) ;
+ Size = MAP_APPFONT ( 136, 12 ) ;
+ ImageButton WIN_LEFT_SCROLL
+ {
+ HelpID = "sw:ImageButton:TP_TOX_ENTRY:WIN_LEFT_SCROLL";
+ Pos = MAP_APPFONT ( 0, 0 ) ;
+ Size = MAP_APPFONT ( 10, 12 ) ;
+ Symbol = IMAGEBUTTON_ARROW_LEFT;
+ DialogControl = FALSE;
+ TabStop = FALSE;
+ };
+ Window WIN_CTRL_PARENT
+ {
+ Pos = MAP_APPFONT ( 11, 0 ) ;
+ Size = MAP_APPFONT ( 114, 12 ) ;
+ DialogControl = TRUE;
+ };
+ ImageButton WIN_RIGHT_SCROLL
+ {
+ HelpID = "sw:ImageButton:TP_TOX_ENTRY:WIN_RIGHT_SCROLL";
+ Pos = MAP_APPFONT ( 126, 0 ) ;
+ Size = MAP_APPFONT ( 10, 12 ) ;
+ Symbol = IMAGEBUTTON_ARROW_RIGHT;
+ DialogControl = FALSE;
+ TabStop = FALSE;
+ };
+ String STR_TOKEN_ENTRY_NO
+ {
+ Text [ en-US ] = "E#";
+ };
+ String STR_TOKEN_ENTRY
+ {
+ Text [ en-US ] = "E";
+ };
+ String STR_TOKEN_TAB_STOP
+ {
+ Text [ en-US ] = "T";
+ };
+ String STR_TOKEN_TEXT
+ {
+ Text = "";
+ //unused
+ };
+ String STR_TOKEN_PAGE_NUMS
+ {
+ Text [ en-US ] = "#";
+ };
+ String STR_TOKEN_CHAPTER_INFO
+ {
+ Text [ en-US ] = "CI";
+ };
+ String STR_TOKEN_LINK_START
+ {
+ Text [ en-US ] = "LS";
+ };
+ String STR_TOKEN_LINK_END
+ {
+ Text [ en-US ] = "LE";
+ };
+ String STR_TOKEN_AUTHORITY
+ {
+ Text [ en-US ] = "A";
+ };
+ String STR_TOKEN_HELP_ENTRY_NO
+ {
+ Text [ en-US ] = "Chapter number";
+ };
+ String STR_TOKEN_HELP_ENTRY
+ {
+ Text [ en-US ] = "Entry";
+ };
+ String STR_TOKEN_HELP_TAB_STOP
+ {
+ Text [ en-US ] = "Tab stop";
+ };
+ String STR_TOKEN_HELP_TEXT
+ {
+ Text [ en-US ] = "Text";
+ };
+ String STR_TOKEN_HELP_PAGE_NUMS
+ {
+ Text [ en-US ] = "Page number";
+ };
+ String STR_TOKEN_HELP_CHAPTER_INFO
+ {
+ Text [ en-US ] = "Chapter info";
+ };
+ String STR_TOKEN_HELP_LINK_START
+ {
+ Text [ en-US ] = "Hyperlink start";
+ };
+ String STR_TOKEN_HELP_LINK_END
+ {
+ Text [ en-US ] = "Hyperlink end";
+ };
+ String STR_TOKEN_HELP_AUTHORITY
+ {
+ Text [ en-US ] = "Bibliography entry: ";
+ };
+ String STR_CHARSTYLE
+ {
+ Text [ en-US ] = "Character Style: ";
+ };
+ };
+ PushButton PB_ALL_LEVELS
+ {
+ HelpID = "sw:PushButton:TP_TOX_ENTRY:PB_ALL_LEVELS";
+ Pos = MAP_APPFONT ( 209 , 14 ) ;
+ Size = MAP_APPFONT ( 40, 14 ) ;
+ Text [ en-US ] = "~All";
+ };
+ PushButton PB_ENTRYNO
+ {
+ HelpID = "sw:PushButton:TP_TOX_ENTRY:PB_ENTRYNO";
+ Pos = MAP_APPFONT ( 37 , 32 ) ;
+ Size = MAP_APPFONT ( 40, 14 ) ;
+ Text [ en-US ] = "Chapter no.";
+ };
+ PushButton PB_ENTRY
+ {
+ HelpID = "sw:PushButton:TP_TOX_ENTRY:PB_ENTRY";
+ Pos = MAP_APPFONT ( 80, 32 ) ;
+ Size = MAP_APPFONT ( 40, 14 ) ;
+ Text [ en-US ] = "Entry text";
+ };
+ PushButton PB_CHAPTERINFO
+ {
+ HelpID = "sw:PushButton:TP_TOX_ENTRY:PB_CHAPTERINFO";
+ Pos = MAP_APPFONT ( 123 , 32 ) ;
+ Size = MAP_APPFONT ( 40, 14) ;
+ Text [ en-US ] = "~Chapter info";
+ };
+ PushButton PB_PAGENO
+ {
+ HelpID = "sw:PushButton:TP_TOX_ENTRY:PB_PAGENO";
+ Pos = MAP_APPFONT ( 166 , 32 ) ;
+ Size = MAP_APPFONT ( 40, 14 ) ;
+ Text [ en-US ] = "Page no.";
+ };
+ PushButton PB_TAB
+ {
+ HelpID = "sw:PushButton:TP_TOX_ENTRY:PB_TAB";
+ Pos = MAP_APPFONT ( 209 ,32 ) ;
+ Size = MAP_APPFONT ( 40, 14 ) ;
+ Text [ en-US ] = "Tab stop";
+ };
+ PushButton PB_HYPERLINK
+ {
+ HelpID = "sw:PushButton:TP_TOX_ENTRY:PB_HYPERLINK";
+ Pos = MAP_APPFONT ( 209 , 32 ) ;
+ Size = MAP_APPFONT ( 40, 14 ) ;
+ Text [ en-US ] = "H~yperlink";
+ };
+ ListBox LB_AUTHFIELD
+ {
+ HelpID = "sw:ListBox:TP_TOX_ENTRY:LB_AUTHFIELD";
+ Pos = MAP_APPFONT ( 37 , 33 ) ;
+ Size = MAP_APPFONT ( 59, 60 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ Sort = TRUE;
+ };
+ PushButton PB_AUTHINSERT
+ {
+ HelpID = "sw:PushButton:TP_TOX_ENTRY:PB_AUTHINSERT";
+ Pos = MAP_APPFONT ( 99 , 32 ) ;
+ Size = MAP_APPFONT ( 39, 14 ) ;
+ Text [ en-US ] = "~Insert";
+ };
+ PushButton PB_AUTHREMOVE
+ {
+ HelpID = "sw:PushButton:TP_TOX_ENTRY:PB_AUTHREMOVE";
+ Pos = MAP_APPFONT ( 142 , 32 ) ;
+ Size = MAP_APPFONT ( 39, 14 ) ;
+ Text [ en-US ] = "~Remove";
+ };
+ FixedText FT_CHARSTYLE
+ {
+ Pos = MAP_APPFONT ( 37 , 55 ) ;
+ Size = MAP_APPFONT (60 , 8 ) ;
+ Text [ en-US ] = "Character Style";
+ };
+ ListBox LB_CHARSTYLE
+ {
+ HelpID = "sw:ListBox:TP_TOX_ENTRY:LB_CHARSTYLE";
+ Pos = MAP_APPFONT ( 100 , 53 ) ;
+ Size = MAP_APPFONT ( 93, 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ PushButton PB_EDITSTYLE
+ {
+ HelpID = "sw:PushButton:TP_TOX_ENTRY:PB_EDITSTYLE";
+ Pos = MAP_APPFONT ( 199 , 52 ) ;
+ Size = MAP_APPFONT ( 50, 14 ) ;
+ Text [ en-US ] = "~Edit...";
+ };
+ FixedText FT_FILLCHAR
+ {
+ Pos = MAP_APPFONT ( 37 , 71 ) ;
+ Size = MAP_APPFONT (60 , 8 ) ;
+ Text [ en-US ] = "Fill character";
+ };
+ ComboBox CB_FILLCHAR
+ {
+ HelpID = "sw:ComboBox:TP_TOX_ENTRY:CB_FILLCHAR";
+ Pos = MAP_APPFONT ( 100 , 69 ) ;
+ Size = MAP_APPFONT ( 40, 40 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_CHAPTERENTRY
+ {
+ Pos = MAP_APPFONT ( 37 , 71 ) ;
+ Size = MAP_APPFONT ( 60, 8 ) ;
+ Text [ en-US ] = "Chapter entry";
+ };
+ ListBox LB_CHAPTERENTRY
+ {
+ HelpID = "sw:ListBox:TP_TOX_ENTRY:LB_CHAPTERENTRY";
+ Pos = MAP_APPFONT ( 100 , 69 ) ;
+ Size = MAP_APPFONT ( 93, 40 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Number range only" ; > ;
+ < "Description only" ; > ;
+ < "Number range and description" ; > ;
+ };
+ };
+
+ FixedText FT_ENTRY_NO
+ {
+ Pos = MAP_APPFONT ( 37 , 71 ) ;
+ Size = MAP_APPFONT ( 60, 8 ) ;
+ Text [ en-US ] = "Format";
+ };
+ ListBox LB_ENTRY_NO
+ {
+ HelpID = "sw:ListBox:TP_TOX_ENTRY:LB_ENTRY_NO";
+ Pos = MAP_APPFONT ( 100 , 69 ) ;
+ Size = MAP_APPFONT ( 93, 40 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Number" ; > ;
+ < "Number without separator" ; > ;
+ };
+ };
+
+ FixedText FT_LEVEL_OL
+ {
+ Pos = MAP_APPFONT ( 37 , 87 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Evaluate up to level";
+ };
+ NumericField NF_LEVEL_OL
+ {
+ HelpID = "sw:NumericField:TP_TOX_ENTRY:NF_LEVEL_OL";
+ Pos = MAP_APPFONT ( 100 , 85 ) ;
+ Size = MAP_APPFONT ( 20 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 10 ;
+ Value = 10 ;
+ SpinSize = 1 ;
+ };
+
+ FixedText FT_TABPOS
+ {
+ Pos = MAP_APPFONT ( 37 , 87 ) ;
+ Size = MAP_APPFONT ( 60, 8 ) ;
+ Text [ en-US ] = "Tab stop position";
+ };
+ MetricField MF_TABPOS
+ {
+ HelpID = "sw:MetricField:TP_TOX_ENTRY:MF_TABPOS";
+ Pos = MAP_APPFONT ( 100 , 85 ) ;
+ Size = MAP_APPFONT ( 40, 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 1999 ;
+ DecimalDigits = 2 ;
+ Value = 0 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 1999 ;
+ SpinSize = 5 ;
+ };
+ CheckBox CB_AUTORIGHT
+ {
+ HelpID = "sw:CheckBox:TP_TOX_ENTRY:CB_AUTORIGHT";
+ Pos = MAP_APPFONT ( 143 , 86 ) ;
+ Size = MAP_APPFONT ( 100, 10 ) ;
+ Text [ en-US ] = "Align right";
+ };
+ FixedLine FL_ENTRY
+ {
+ Pos = MAP_APPFONT ( 34 , 3 ) ;
+ Size = MAP_APPFONT ( 220, 8 ) ;
+ Text [ en-US ] = "Structure and Formatting";
+ };
+ CheckBox CB_RELTOSTYLE
+ {
+ HelpID = "sw:CheckBox:TP_TOX_ENTRY:CB_RELTOSTYLE";
+ Pos = MAP_APPFONT ( 37 , 110 ) ;
+ Size = MAP_APPFONT ( 200, 10 ) ;
+ Text [ en-US ] = "Tab position relati~ve to Paragraph Style indent";
+ };
+ FixedText FT_MAIN_ENTRY_STYLE
+ {
+ Pos = MAP_APPFONT ( 37 , 112 ) ;
+ Size = MAP_APPFONT ( 116, 8 ) ;
+ Text [ en-US ] = "Character Style for main entries";
+ };
+ ListBox LB_MAIN_ENTRY_STYLE
+ {
+ HelpID = "sw:ListBox:TP_TOX_ENTRY:LB_MAIN_ENTRY_STYLE";
+ Pos = MAP_APPFONT ( 157 , 110 ) ;
+ Size = MAP_APPFONT ( 92, 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ AutoHScroll = TRUE;
+ };
+
+ CheckBox CB_ALPHADELIM
+ {
+ HelpID = "sw:CheckBox:TP_TOX_ENTRY:CB_ALPHADELIM";
+ Pos = MAP_APPFONT ( 37 , 126 ) ;
+ Size = MAP_APPFONT ( 105, 10 ) ;
+ Text [ en-US ] = "Alphabetical delimiter";
+ };
+ CheckBox CB_COMMASEPARATED
+ {
+ HelpID = "sw:CheckBox:TP_TOX_ENTRY:CB_COMMASEPARATED";
+ Pos = MAP_APPFONT ( 37 , 140 ) ;
+ Size = MAP_APPFONT ( 105, 10 ) ;
+ Text [ en-US ] = "Key separated by commas";
+ };
+ FixedLine FL_FORMAT
+ {
+ Pos = MAP_APPFONT ( 34 , 99 ) ;
+ Size = MAP_APPFONT ( 220, 8 ) ;
+ Text [ en-US ] = "Format";
+ };
+ RadioButton RB_DOCPOS
+ {
+ HelpID = "sw:RadioButton:TP_TOX_ENTRY:RB_DOCPOS";
+ Pos = MAP_APPFONT ( 40 , 113) ;
+ Size = MAP_APPFONT ( 94, 10 ) ;
+ Text [ en-US ] = "Document ~position ";
+ };
+ RadioButton RB_SORTCONTENT
+ {
+ HelpID = "sw:RadioButton:TP_TOX_ENTRY:RB_SORTCONTENT";
+ Pos = MAP_APPFONT ( 136 , 113 ) ;
+ Size = MAP_APPFONT ( 90, 10 ) ;
+ Text [ en-US ] = "~Content";
+ };
+ FixedLine FL_SORTING
+ {
+ Pos = MAP_APPFONT ( 34 , 102 ) ;
+ Size = MAP_APPFONT ( 220, 8 ) ;
+ Text [ en-US ] = "Sort by";
+ };
+ FixedText FT_FIRSTKEY
+ {
+ Pos = MAP_APPFONT ( 40 , 140 ) ;
+ Size = MAP_APPFONT ( 10, 8 ) ;
+ Text = "~1" ;
+ };
+ ListBox LB_FIRSTKEY
+ {
+ HelpID = "sw:ListBox:TP_TOX_ENTRY:LB_FIRSTKEY";
+ Pos = MAP_APPFONT ( 60 , 138 ) ;
+ Size = MAP_APPFONT ( 159, 50 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ };
+ Image IMG_SORTUP_HC
+ {
+ ImageBitmap = Bitmap{File = "sch10712.bmp"; };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ Image IMG_SORTDOWN_HC
+ {
+ ImageBitmap = Bitmap{File = "sch10713.bmp"; };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ ImageRadioButton RB_SORTUP1
+ {
+ HelpID = "sw:ImageRadioButton:TP_TOX_ENTRY:RB_SORTUP1";
+ Pos = MAP_APPFONT ( 222 , 138 ) ;
+ Size = MAP_APPFONT ( 12, 12 ) ;
+ RadioButtonImage =
+ Image
+ {
+ ImageBitmap = Bitmap{File = "sc10712.bmp"; };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ Check = TRUE;
+ QuickHelpText [ en-US ] = "Ascending";
+ };
+ ImageRadioButton RB_SORTDOWN1
+ {
+ HelpID = "sw:ImageRadioButton:TP_TOX_ENTRY:RB_SORTDOWN1";
+ Pos = MAP_APPFONT ( 237 , 138 ) ;
+ Size = MAP_APPFONT ( 12, 12 ) ;
+ RadioButtonImage =
+ Image
+ {
+ ImageBitmap = Bitmap{File = "sc10713.bmp"; };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ QuickHelpText [ en-US ] = "Descending";
+ };
+ ImageRadioButton RB_SORTUP2
+ {
+ HelpID = "sw:ImageRadioButton:TP_TOX_ENTRY:RB_SORTUP2";
+ Pos = MAP_APPFONT ( 222 , 153 ) ;
+ Size = MAP_APPFONT ( 12, 12 ) ;
+ RadioButtonImage =
+ Image
+ {
+ ImageBitmap = Bitmap{File = "sc10712.bmp"; };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ Check = TRUE;
+ QuickHelpText [ en-US ] = "Ascending";
+ };
+ ImageRadioButton RB_SORTDOWN2
+ {
+ HelpID = "sw:ImageRadioButton:TP_TOX_ENTRY:RB_SORTDOWN2";
+ Pos = MAP_APPFONT ( 237 , 153 ) ;
+ Size = MAP_APPFONT ( 12, 12 ) ;
+ RadioButtonImage =
+ Image
+ {
+ ImageBitmap = Bitmap{File = "sc10713.bmp"; };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ QuickHelpText [ en-US ] = "Descending";
+ };
+ ImageRadioButton RB_SORTUP3
+ {
+ HelpID = "sw:ImageRadioButton:TP_TOX_ENTRY:RB_SORTUP3";
+ Pos = MAP_APPFONT ( 222 , 168 ) ;
+ Size = MAP_APPFONT ( 12, 12 ) ;
+ RadioButtonImage =
+ Image
+ {
+ ImageBitmap = Bitmap{File = "sc10712.bmp"; };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ Check = TRUE;
+ QuickHelpText [ en-US ] = "Ascending";
+ };
+ ImageRadioButton RB_SORTDOWN3
+ {
+ HelpID = "sw:ImageRadioButton:TP_TOX_ENTRY:RB_SORTDOWN3";
+ Pos = MAP_APPFONT ( 237 ,168 ) ;
+ Size = MAP_APPFONT ( 12, 12 ) ;
+ RadioButtonImage =
+ Image
+ {
+ ImageBitmap = Bitmap{File = "sc10713.bmp"; };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ QuickHelpText [ en-US ] = "Descending";
+ };
+ FixedText FT_SECONDKEY
+ {
+ Pos = MAP_APPFONT ( 40 , 155 ) ;
+ Size = MAP_APPFONT ( 10, 8 ) ;
+ Text = "~2" ;
+ };
+ ListBox LB_SECONDKEY
+ {
+ HelpID = "sw:ListBox:TP_TOX_ENTRY:LB_SECONDKEY";
+ Pos = MAP_APPFONT ( 60 , 153 ) ;
+ Size = MAP_APPFONT ( 159, 50 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ };
+ FixedText FT_THIRDDKEY
+ {
+ Pos = MAP_APPFONT ( 40 , 170 ) ;
+ Size = MAP_APPFONT ( 10, 8 ) ;
+ Text = "~3" ;
+ };
+ ListBox LB_THIRDKEY
+ {
+ HelpID = "sw:ListBox:TP_TOX_ENTRY:LB_THIRDKEY";
+ Pos = MAP_APPFONT ( 60 , 168 ) ;
+ Size = MAP_APPFONT ( 159, 50 ) ;
+ Border = TRUE;
+ DropDown = TRUE;
+ };
+ FixedLine FL_SORTKEY
+ {
+ Pos = MAP_APPFONT ( 34 , 126) ;
+ Size = MAP_APPFONT ( 220, 8 ) ;
+ Text [ en-US ] = "Sort keys";
+ };
+
+ String STR_NOSORTKEY
+ {
+ Text [ en-US ] = "<None>";
+ };
+ String STR_NO_CHAR_STYLE
+ {
+ Text [ en-US ] = "<None>";
+ };
+ String STR_DELIM
+ {
+ Text [ en-US ] = "S";
+ };
+};
+TabPage TP_TOX_STYLES
+{
+ HelpID = HID_TOX_STYLES_PAGE;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE ;
+ FixedText FT_LEVEL
+ {
+ Pos = MAP_APPFONT ( 11 , 14 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ Text [ en-US ] = "~Levels" ;
+ Left = TRUE ;
+ };
+ ListBox LB_LEVEL
+ {
+ HelpID = "sw:ListBox:TP_TOX_STYLES:LB_LEVEL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 102 , 131 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ FixedText FT_TEMPLATE
+ {
+ Pos = MAP_APPFONT ( 142 , 14 ) ;
+ Size = MAP_APPFONT ( 102 , 8 ) ;
+ Text [ en-US ] = "Paragraph ~Styles" ;
+ Left = TRUE ;
+ };
+ ListBox LB_PARALAY
+ {
+ HelpID = "sw:ListBox:TP_TOX_STYLES:LB_PARALAY";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 142 , 25 ) ;
+ Size = MAP_APPFONT ( 101 , 131 ) ;
+ TabStop = TRUE ;
+ Sort = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ PushButton BT_STD
+ {
+ HelpID = "sw:PushButton:TP_TOX_STYLES:BT_STD";
+ Pos = MAP_APPFONT ( 64 , 162 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Default" ;
+ };
+ ImageButton BT_ASSIGN
+ {
+ HelpID = "sw:ImageButton:TP_TOX_STYLES:BT_ASSIGN";
+ Pos = MAP_APPFONT ( 118 , 28 ) ;
+ Size = MAP_APPFONT ( 20 , 12 ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "one_left.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ };
+ PushButton BT_EDIT_STYLE
+ {
+ HelpID = "sw:PushButton:TP_TOX_STYLES:BT_EDIT_STYLE";
+ Pos = MAP_APPFONT ( 193 , 162 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Edit";
+ };
+ FixedLine FL_FORMAT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Assignment";
+ };
+};
+ModalDialog DLG_ADD_IDX_STYLES
+{
+ HelpId = HID_DLG_ADD_IDX_STYLES;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 350 , 200 ) ;
+ Moveable = TRUE ;
+ Control TR_HEADER
+ {
+ Pos = MAP_APPFONT ( 12 , 15 ) ;
+ Size = MAP_APPFONT ( 273 , 164 ) ;
+ Border = TRUE;
+ TabStop = TRUE;
+ Window HB_STYLES
+ {
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 273 , 20 ) ;
+ };
+ Control TLB_STYLES
+ {
+ Pos = MAP_APPFONT ( 0 , 20 ) ;
+ Size = MAP_APPFONT ( 273 , 132 ) ;
+ Border = TRUE;
+ };
+ };
+ ImageButton PB_LEFT
+ {
+ HelpID = "sw:ImageButton:DLG_ADD_IDX_STYLES:PB_LEFT";
+ Pos = MAP_APPFONT ( 12 , 182 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "all_left.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ };
+ ImageButton PB_RIGHT
+ {
+ HelpID = "sw:ImageButton:DLG_ADD_IDX_STYLES:PB_RIGHT";
+ Pos = MAP_APPFONT ( 65 , 182 ) ;
+ Size = MAP_APPFONT ( 50 , 12 ) ;
+ TabStop = TRUE ;
+ ButtonImage = Image
+ {
+ ImageBitmap = Bitmap
+ {
+ File = "all_right.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ };
+ FixedLine FL_STYLES
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 285 , 8 ) ;
+ Text [ en-US ] = "Styl~es";
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 297 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 297 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 297 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ String ST_HB_FIRST
+ {
+ Text [ en-US ] = "Not applied";
+ };
+ Text [ en-US ] = "Assign Styles";
+};
+/*-----------------------------------------------------------
+
+-----------------------------------------------------------*/
+ModalDialog DLG_CREATE_AUTOMARK
+{
+ HelpId = HID_DLG_CREATE_AUTOMARK;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 350 , 200 ) ;
+ Moveable = TRUE ;
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 297 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 297 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 297 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ Control BB_ENTRIES
+ {
+ Pos = MAP_APPFONT ( 12 , 18 ) ;
+ Size = MAP_APPFONT ( 276 , 175 ) ;
+ TabStop = TRUE ;
+ Border = TRUE;
+ String ST_SEARCH
+ {
+ Text [ en-US ] = "Search term";
+ };
+ String ST_ALTERNATIVE
+ {
+ Text [ en-US ] = "Alternative entry";
+ };
+ String ST_PRIMKEY
+ {
+ Text [ en-US ] = "1st key";
+ };
+ String ST_SECKEY
+ {
+ Text [ en-US ] = "2nd key";
+ };
+ String ST_COMMENT
+ {
+ Text [ en-US ] = "Comment";
+ };
+ String ST_CASESENSITIVE
+ {
+ Text [ en-US ] = "Match case";
+ };
+ String ST_WORDONLY
+ {
+ Text [ en-US ] = "Word only";
+ };
+ String ST_TRUE
+ {
+ Text [ en-US ] = "Yes";
+ };
+ String ST_FALSE
+ {
+ Text [ en-US ] = "No";
+ };
+ };
+ FixedLine FL_ENTRIES
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 288, 8 ) ;
+ Text [ en-US ] = "Entries";
+ };
+
+ Text [ en-US ] = "Edit Concordance File";
+};
+// -----------------------------------------------------------------------------
+
diff --git a/sw/source/ui/index/idxmrk.cxx b/sw/source/ui/index/idxmrk.cxx
new file mode 100644
index 000000000000..24a3c7ddf91e
--- /dev/null
+++ b/sw/source/ui/index/idxmrk.cxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#define _SVSTDARR_STRINGSSORT
+#include <svl/svstdarr.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <svl/stritem.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <sfx2/dispatch.hxx>
+#include <svl/eitem.hxx>
+#include <svtools/txtcmp.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <svl/itemset.hxx>
+#include <editeng/langitem.hxx>
+#include <swtypes.hxx>
+#include <idxmrk.hxx>
+#include <txttxmrk.hxx>
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <multmrk.hxx>
+#include <swundo.hxx> // fuer Undo-Ids
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _INDEX_HRC
+#include <index.hrc>
+#endif
+#ifndef _IDXMRK_HRC
+#include <idxmrk.hrc>
+#endif
+#include <swmodule.hxx>
+#include <fldmgr.hxx>
+#include <fldbas.hxx>
+#include <utlui.hrc>
+#include <swcont.hxx>
+#include <svl/cjkoptions.hxx>
+#include <ndtxt.hxx>
+#include <breakit.hxx>
+
+
+/* -----------------07.09.99 08:15-------------------
+
+ --------------------------------------------------*/
+SFX_IMPL_CHILDWINDOW(SwInsertIdxMarkWrapper, FN_INSERT_IDX_ENTRY_DLG)
+
+SwInsertIdxMarkWrapper::SwInsertIdxMarkWrapper( Window *pParentWindow,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo ) :
+ SfxChildWindow(pParentWindow, nId)
+{
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+ pAbstDlg = pFact->CreateIndexMarkFloatDlg( DLG_INSIDXMARK , pBindings, this, pParentWindow, pInfo );
+ DBG_ASSERT(pAbstDlg, "Dialogdiet fail!");
+ pWindow = pAbstDlg->GetWindow();
+ pWindow->Show(); // at this point,because before pSh has to be initialized in ReInitDlg()
+ // -> Show() will invoke StateChanged() and save pos
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+}
+/* -----------------07.09.99 09:14-------------------
+
+ --------------------------------------------------*/
+SfxChildWinInfo SwInsertIdxMarkWrapper::GetInfo() const
+{
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
+
+ return aInfo;
+}
+
+void SwInsertIdxMarkWrapper::ReInitDlg(SwWrtShell& rWrtShell)
+{
+ pAbstDlg->ReInitDlg(rWrtShell);
+}
+
+
+/* -----------------07.09.99 08:15-------------------
+
+ --------------------------------------------------*/
+SFX_IMPL_CHILDWINDOW(SwInsertAuthMarkWrapper, FN_INSERT_AUTH_ENTRY_DLG)
+
+SwInsertAuthMarkWrapper::SwInsertAuthMarkWrapper( Window *pParentWindow,
+ sal_uInt16 nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo ) :
+ SfxChildWindow(pParentWindow, nId)
+{
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+ pAbstDlg = pFact->CreateAuthMarkFloatDlg( DLG_INSAUTHMARK, pBindings, this, pParentWindow, pInfo );
+ DBG_ASSERT(pAbstDlg, "Dialogdiet fail!");
+ pWindow = pAbstDlg->GetWindow();
+
+ eChildAlignment = SFX_ALIGN_NOALIGNMENT;
+}
+/* -----------------07.09.99 09:14-------------------
+
+ --------------------------------------------------*/
+SfxChildWinInfo SwInsertAuthMarkWrapper::GetInfo() const
+{
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
+ return aInfo;
+}
+/* -----------------19.10.99 11:16-------------------
+
+ --------------------------------------------------*/
+void SwInsertAuthMarkWrapper::ReInitDlg(SwWrtShell& rWrtShell)
+{
+ pAbstDlg->ReInitDlg(rWrtShell);
+}
+
diff --git a/sw/source/ui/index/idxmrk.hrc b/sw/source/ui/index/idxmrk.hrc
new file mode 100644
index 000000000000..859aeb25b3fa
--- /dev/null
+++ b/sw/source/ui/index/idxmrk.hrc
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_NXT 102
+#define BT_NXTSAME 103
+#define BT_PREV 104
+#define BT_PREVSAME 105
+#define BT_DEL 106
+#define BT_HELP 107
+#define LBL_INDEX 1
+#define DCB_INDEX 2
+#define LBL_ENTRY 3
+#define SL_ENTRY 4
+#define LBL_KEY 5
+#define DCB_KEY 6
+#define LBL_LEVEL 7
+#define SL_LEVEL 8
+#define FL_INDEX 10
+#define LBL_KEY2 11
+#define DCB_KEY2 12
+#define CB_APPLY_TO_ALL 13
+#define CB_MAIN_ENTRY 14
+#define FT_ENTRY 20
+#define ED_ENTRY 21
+#define PB_OK 22
+#define PB_CANCEL 23
+#define PB_HELP 24
+#define FL_ENTRIES 25
+#define PB_CREATEENTRY 26
+#define FL_ENTRY 27
+#define FT_TITLE 28
+#define FI_TITLE 29
+#define FT_AUTHOR 30
+#define FI_AUTHOR 31
+#define ST_CHANGE 32
+#define WIN_DLG 33
+#define BT_NEW 34
+#define FL_NAME 37
+#define FT_NAME 38
+#define ED_NAME 39
+#define LB_ENTRY 40
+#define RB_FROMCOMPONENT 41
+#define RB_FROMDOCCONTENT 42
+#define PB_EDITENTRY 43
+#define CB_CASESENSITIVE 44
+#define CB_WORDONLY 45
+#define FT_PHONETIC_1 46
+#define FT_PHONETIC_2 47
+#define FT_PHONETIC_3 48
+#define ED_PHONETIC_1 48
+#define ED_PHONETIC_2 49
+#define ED_PHONETIC_3 50
+
+//------------------------------------------------------
+// defines for positions and sizes for IDX_DIALOG_WINDOW
+
+#define IDX_COL1 12
+#define IDX_COL2 56
+
+#define IDX_COL2_FULLEND 150
+#define IDX_NEWIMAGE_WIDTH 12
+#define IDX_NEWIMAGE_XPOS (IDX_COL2_FULLEND-1-IDX_NEWIMAGE_WIDTH)
+
+#define IDX_PHONETIC_EDIT_WIDTH 62
+#define IDX_PHONETIC_TEXT_WIDTH 62
+
+#define IDX_COL_PHONETIC_TEXT (IDX_COL2+IDX_PHONETIC_EDIT_WIDTH+8)
+#define IDX_COL_PHONETIC_EDIT (IDX_COL_PHONETIC_TEXT+IDX_PHONETIC_TEXT_WIDTH+1)
+
+#define IDX_COL_BUTTONS_NORMAL 162
+#define IDX_COL_BUTTONS_CJK (IDX_COL_PHONETIC_EDIT+IDX_PHONETIC_EDIT_WIDTH+14)
+
+#define IDX_WIN_WIDTH_NORMAL 218
+#define IDX_WIN_WIDTH_CJK (IDX_WIN_WIDTH_NORMAL+IDX_COL_BUTTONS_CJK-IDX_COL_BUTTONS_NORMAL)
+
+#define IDX_ROW_2_TEXT 31
+#define IDX_ROW_2_LIST (IDX_ROW_2_TEXT-2)
+#define IDX_ROW_3_TEXT 46
+#define IDX_ROW_3_LIST (IDX_ROW_3_TEXT-2)
+#define IDX_ROW_4_TEXT 62
+#define IDX_ROW_4_LIST (IDX_ROW_4_TEXT-2)
+
+//------------------------------------------------------
diff --git a/sw/source/ui/index/idxmrk.src b/sw/source/ui/index/idxmrk.src
new file mode 100644
index 000000000000..5bd78240e5c5
--- /dev/null
+++ b/sw/source/ui/index/idxmrk.src
@@ -0,0 +1,636 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svtools/controldims.hrc>
+#include "index.hrc"
+#include "idxmrk.hrc"
+#include "helpid.h"
+#include "cmdid.h"
+
+#define IDX_PHONETIC_LISTBOX_DESCRIPTION \
+Text [ en-US ] = "Phonetic reading"; \
+
+#define IDX_DIALOG_WINDOW \
+ Window WIN_DLG \
+ { \
+ Pos = MAP_APPFONT ( 0 , 0 ) ; \
+ Size = MAP_APPFONT ( IDX_WIN_WIDTH , WINDOW_HEIGHT ) ; \
+ OKButton BT_OK \
+ { \
+ Pos = MAP_APPFONT ( COL_BUTTONS , 6 ) ; \
+ Size = MAP_APPFONT ( 50 , RSC_CD_PUSHBUTTON_HEIGHT ) ; \
+ TabStop = TRUE ; \
+ DefButton = TRUE ; \
+ Text [ en-US ] = "Insert";\
+ }; \
+ CancelButton BT_CANCEL \
+ { \
+ Pos = MAP_APPFONT ( COL_BUTTONS , 23 ) ; \
+ Size = MAP_APPFONT ( 50 , RSC_CD_PUSHBUTTON_HEIGHT ) ; \
+ Text [ en-US ] = "Close";\
+ }; \
+ HelpButton BT_HELP \
+ { \
+ Pos = MAP_APPFONT ( COL_BUTTONS , 43 ) ; \
+ Size = MAP_APPFONT ( 50 , RSC_CD_PUSHBUTTON_HEIGHT ) ; \
+ }; \
+ PushButton BT_DEL \
+ { \
+ Pos = MAP_APPFONT ( COL_BUTTONS , 63 ) ; \
+ Size = MAP_APPFONT ( 50 , RSC_CD_PUSHBUTTON_HEIGHT ) ; \
+ Text [ en-US ] = "~Delete" ; \
+ TabStop = TRUE ; \
+ }; \
+ ListBox DCB_INDEX \
+ { \
+ Pos = MAP_APPFONT ( IDX_COL2 , 14) ; \
+ Size = MAP_APPFONT ( DCB_INDEX_WIDTH , 56 ) ; \
+ TabStop = TRUE ; \
+ DropDown = TRUE ; \
+ }; \
+ ImageButton BT_NEW \
+ { \
+ Pos = MAP_APPFONT ( IDX_NEWIMAGE_XPOS , 13 ) ; \
+ Size = MAP_APPFONT ( IDX_NEWIMAGE_WIDTH , 15 ) ; \
+ QuickHelpText [ en-US ] = "New User-defined Index";\
+ }; \
+ ImageButton BT_PREVSAME \
+ { \
+ Hide = TRUE ; \
+ Pos = MAP_APPFONT ( COL_BUTTONS , 80 ) ; \
+ Size = MAP_APPFONT ( 24 , 14 ) ; \
+ TabStop = TRUE ; \
+ SYMBOL = IMAGEBUTTON_FIRST ; \
+ }; \
+ ImageButton BT_PREV \
+ { \
+ Hide = TRUE ; \
+ Pos = MAP_APPFONT ( COL_BUTTONS , 97 ) ; \
+ Size = MAP_APPFONT ( 24 , 14 ) ; \
+ TabStop = TRUE ; \
+ SYMBOL = IMAGEBUTTON_PREV ; \
+ }; \
+ ImageButton BT_NXT \
+ { \
+ Hide = TRUE ; \
+ Pos = MAP_APPFONT ( COL_BUTTONS_2 , 97 ) ; \
+ Size = MAP_APPFONT ( 24 , 14 ) ; \
+ TabStop = TRUE ; \
+ SYMBOL = IMAGEBUTTON_NEXT ; \
+ }; \
+ ImageButton BT_NXTSAME \
+ { \
+ Hide = TRUE ; \
+ Pos = MAP_APPFONT ( COL_BUTTONS_2 , 80 ) ; \
+ Size = MAP_APPFONT ( 24 , 14 ) ; \
+ TabStop = TRUE ; \
+ SYMBOL = IMAGEBUTTON_LAST ; \
+ }; \
+ FixedLine FL_INDEX \
+ { \
+ Pos = MAP_APPFONT ( 6 , 3 ) ; \
+ Size = MAP_APPFONT ( COL_BUTTONS-5-6 , RSC_CD_FIXEDLINE_HEIGHT ) ; \
+ Text [ en-US ] = "Selection" ; \
+ }; \
+ FixedText LBL_INDEX \
+ { \
+ Pos = MAP_APPFONT ( IDX_COL1 , 16 ) ; \
+ Size = MAP_APPFONT ( 40 , 10 ) ; \
+ Text [ en-US ] = "~Index" ; \
+ Left = TRUE ; \
+ }; \
+ Edit SL_ENTRY \
+ { \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( IDX_COL2 , IDX_ROW_2_LIST ) ; \
+ Size = MAP_APPFONT ( LIST_WIDTH , 12 ) ; \
+ TabStop = TRUE ; \
+ Left = TRUE ; \
+ }; \
+ FixedText LBL_ENTRY \
+ { \
+ Pos = MAP_APPFONT ( IDX_COL1 , IDX_ROW_2_TEXT ) ; \
+ Size = MAP_APPFONT ( 27 , RSC_CD_FIXEDTEXT_HEIGHT ) ; \
+ Text [ en-US ] = "~Entry" ; \
+ Left = TRUE ; \
+ }; \
+ FixedText LBL_KEY \
+ { \
+ Disable = TRUE ; \
+ Pos = MAP_APPFONT ( IDX_COL1 , IDX_ROW_3_TEXT ) ; \
+ Size = MAP_APPFONT ( 42 , RSC_CD_FIXEDTEXT_HEIGHT ) ; \
+ Text [ en-US ] = "~1st key" ; \
+ Left = TRUE ; \
+ }; \
+ ComboBox DCB_KEY \
+ { \
+ Disable = TRUE ; \
+ Pos = MAP_APPFONT ( IDX_COL2 , IDX_ROW_3_LIST ) ; \
+ Size = MAP_APPFONT ( LIST_WIDTH , 56 ) ; \
+ TabStop = TRUE ; \
+ DropDown = TRUE ; \
+ }; \
+ FixedText LBL_KEY2 \
+ { \
+ Disable = TRUE ; \
+ Pos = MAP_APPFONT ( IDX_COL1 , IDX_ROW_4_TEXT ) ; \
+ Size = MAP_APPFONT ( 42 , RSC_CD_FIXEDTEXT_HEIGHT ) ; \
+ Text [ en-US ] = "~2nd key" ; \
+ Left = TRUE ; \
+ }; \
+ ComboBox DCB_KEY2 \
+ { \
+ Disable = TRUE ; \
+ Pos = MAP_APPFONT ( IDX_COL2 , IDX_ROW_4_LIST ) ; \
+ Size = MAP_APPFONT ( LIST_WIDTH , 56 ) ; \
+ TabStop = TRUE ; \
+ DropDown = TRUE ; \
+ }; \
+ FixedText FT_PHONETIC_1 \
+ { \
+ Pos = MAP_APPFONT ( IDX_COL_PHONETIC_TEXT , IDX_ROW_2_TEXT ) ; \
+ Size = MAP_APPFONT ( IDX_PHONETIC_TEXT_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ; \
+ Hide = PHONETIC_HIDDEN; \
+ IDX_PHONETIC_LISTBOX_DESCRIPTION \
+ }; \
+ Edit ED_PHONETIC_1 \
+ { \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( IDX_COL_PHONETIC_EDIT , IDX_ROW_2_LIST ) ; \
+ Size = MAP_APPFONT ( IDX_PHONETIC_EDIT_WIDTH , 12 ) ; \
+ Hide = PHONETIC_HIDDEN; \
+ TabStop = TRUE ; \
+ Left = TRUE ; \
+ }; \
+ FixedText FT_PHONETIC_2 \
+ { \
+ Pos = MAP_APPFONT ( IDX_COL_PHONETIC_TEXT , IDX_ROW_3_TEXT ) ; \
+ Size = MAP_APPFONT ( IDX_PHONETIC_TEXT_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ; \
+ Hide = PHONETIC_HIDDEN; \
+ IDX_PHONETIC_LISTBOX_DESCRIPTION \
+ }; \
+ Edit ED_PHONETIC_2 \
+ { \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( IDX_COL_PHONETIC_EDIT , IDX_ROW_3_LIST ) ; \
+ Size = MAP_APPFONT ( IDX_PHONETIC_EDIT_WIDTH , 12 ) ; \
+ Hide = PHONETIC_HIDDEN; \
+ TabStop = TRUE ; \
+ Left = TRUE ; \
+ }; \
+ FixedText FT_PHONETIC_3 \
+ { \
+ Pos = MAP_APPFONT ( IDX_COL_PHONETIC_TEXT , IDX_ROW_4_TEXT ) ; \
+ Size = MAP_APPFONT ( IDX_PHONETIC_TEXT_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ; \
+ Hide = PHONETIC_HIDDEN; \
+ IDX_PHONETIC_LISTBOX_DESCRIPTION \
+ }; \
+ Edit ED_PHONETIC_3 \
+ { \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( IDX_COL_PHONETIC_EDIT , IDX_ROW_4_LIST ) ; \
+ Size = MAP_APPFONT ( IDX_PHONETIC_EDIT_WIDTH , 12 ) ; \
+ Hide = PHONETIC_HIDDEN; \
+ TabStop = TRUE ; \
+ Left = TRUE ; \
+ }; \
+ FixedText LBL_LEVEL \
+ { \
+ Pos = MAP_APPFONT ( IDX_COL1 , 76 ) ; \
+ Size = MAP_APPFONT ( 41 , RSC_CD_FIXEDTEXT_HEIGHT ) ; \
+ Text [ en-US ] = "~Level" ; \
+ Left = TRUE ; \
+ }; \
+ NumericField SL_LEVEL \
+ { \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( IDX_COL2 , 74 ) ; \
+ Size = MAP_APPFONT ( 18 , 12 ) ; \
+ TabStop = TRUE ; \
+ Left = TRUE ; \
+ Repeat = TRUE ; \
+ Spin = TRUE ; \
+ Minimum = 1 ; \
+ Maximum = 10 ; \
+ Value = 1 ; \
+ Last = 10 ; \
+ SpinSize = 1 ; \
+ }; \
+ CheckBox CB_MAIN_ENTRY \
+ { \
+ Pos = MAP_APPFONT ( IDX_COL1 , 76 ) ; \
+ Size = MAP_APPFONT ( 100 , 8 ) ; \
+ Text [ en-US ] = "~Main entry";\
+ }; \
+ CheckBox CB_APPLY_TO_ALL \
+ { \
+ Pos = MAP_APPFONT ( IDX_COL1 , 90 ) ; \
+ Size = MAP_APPFONT ( 140 , 12 ) ; \
+ Hide = TRUE; \
+ Text [ en-US ] = "~Apply to all similar texts."; \
+ }; \
+ CheckBox CB_CASESENSITIVE \
+ { \
+ Pos = MAP_APPFONT ( 21 , 104 ) ; \
+ Size = MAP_APPFONT ( 131 , 12 ) ; \
+ Hide = TRUE;\
+ Text [ en-US ] = "Ma~tch case";\
+ }; \
+ CheckBox CB_WORDONLY \
+ { \
+ Pos = MAP_APPFONT ( 21 , 118 ) ; \
+ Size = MAP_APPFONT ( 131 , 12 ) ; \
+ Hide = TRUE;\
+ Text [ en-US ] = "~Whole words only";\
+ }; \
+ };
+
+ModalDialog DLG_EDIT_IDXMARK
+{
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE;
+ Sizeable = FALSE ;
+ HelpId = CMD_FN_EDIT_IDX_ENTRY_DLG;
+ SVLook = TRUE ;
+ #define IDX_WIN_WIDTH IDX_WIN_WIDTH_NORMAL
+ Size = MAP_APPFONT ( IDX_WIN_WIDTH , 118 ) ;
+ #define GB_HEIGHT 109
+ #define DCB_INDEX_WIDTH 94
+ #define PHONETIC_HIDDEN TRUE
+ #define LIST_WIDTH 94
+ #define COL_BUTTONS IDX_COL_BUTTONS_NORMAL
+ #define COL_BUTTONS_2 (COL_BUTTONS+26)
+ #define WINDOW_HEIGHT 118
+ IDX_DIALOG_WINDOW
+};
+ModalDialog DLG_EDIT_IDXMARK_CJK
+{
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE;
+ Sizeable = FALSE ;
+ HelpId = CMD_FN_EDIT_IDX_ENTRY_DLG;
+ SVLook = TRUE ;
+ #define IDX_WIN_WIDTH IDX_WIN_WIDTH_CJK
+ Size = MAP_APPFONT ( IDX_WIN_WIDTH , 118 ) ;
+ #define GB_HEIGHT 109
+ #define DCB_INDEX_WIDTH 94
+ #define PHONETIC_HIDDEN FALSE
+ #define LIST_WIDTH IDX_PHONETIC_EDIT_WIDTH
+ #define COL_BUTTONS IDX_COL_BUTTONS_CJK
+ #define COL_BUTTONS_2 (COL_BUTTONS+26)
+ #define WINDOW_HEIGHT 118
+ IDX_DIALOG_WINDOW
+};
+ModelessDialog DLG_INSIDXMARK
+{
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE;
+ Sizeable = FALSE ;
+ Hide = TRUE ;
+// Zoomable = TRUE ;
+ HelpId = CMD_FN_INSERT_IDX_ENTRY_DLG;
+ SVLook = TRUE ;
+ #define IDX_WIN_WIDTH IDX_WIN_WIDTH_NORMAL
+ Size = MAP_APPFONT ( IDX_WIN_WIDTH , 138) ;
+// Moveable = TRUE ;
+ #define GB_HEIGHT 129
+ #define DCB_INDEX_WIDTH 79
+ #define PHONETIC_HIDDEN TRUE
+ #define LIST_WIDTH 94
+ #define COL_BUTTONS IDX_COL_BUTTONS_NORMAL
+ #define COL_BUTTONS_2 (COL_BUTTONS+26)
+ #define WINDOW_HEIGHT 138
+ IDX_DIALOG_WINDOW
+};
+ModelessDialog DLG_INSIDXMARK_CJK
+{
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE;
+ Sizeable = FALSE ;
+// Zoomable = TRUE ;
+ HelpId = CMD_FN_INSERT_IDX_ENTRY_DLG;
+ SVLook = TRUE ;
+ #define IDX_WIN_WIDTH IDX_WIN_WIDTH_CJK
+ Size = MAP_APPFONT ( IDX_WIN_WIDTH , 138) ;
+// Moveable = TRUE ;
+ #define GB_HEIGHT 129
+ #define DCB_INDEX_WIDTH 79
+ #define PHONETIC_HIDDEN FALSE
+ #define LIST_WIDTH IDX_PHONETIC_EDIT_WIDTH
+ #define COL_BUTTONS IDX_COL_BUTTONS_CJK
+ #define COL_BUTTONS_2 (COL_BUTTONS+26)
+ #define WINDOW_HEIGHT 138
+ IDX_DIALOG_WINDOW
+};
+ModalDialog DLG_NEW_USER_IDX
+{
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE;
+ Sizeable = FALSE ;
+ HelpID = HID_DLG_NEW_USER_IDX;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 194 , 60 ) ;
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 141 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 141 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 141 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ FixedLine FL_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 130 , 8 ) ;
+
+ Text [ en-US ] = "New user index";
+ };
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 17 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+
+ Text [ en-US ] = "~Name";
+ };
+ Edit ED_NAME
+ {
+ HelpID = "sw:Edit:DLG_NEW_USER_IDX:ED_NAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 55 , 15 ) ;
+ Size = MAP_APPFONT ( 78 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ Text [ en-US ] = "Create New User-defined Index";
+};
+
+String STR_IDXMRK_EDIT
+{
+ Text [ en-US ] = "Edit Index Entry" ;
+};
+String STR_IDXMRK_INSERT
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Verzeichniseintrag einfügen : Verzeichniseintrag einf³gen */
+ Text [ en-US ] = "Insert Index Entry" ;
+};
+
+#define AUTH_DIALOG_WINDOW \
+ Window WIN_DLG \
+ { \
+ Pos = MAP_APPFONT ( 0 , 0 ) ; \
+ Size = MAP_APPFONT ( 218 , 118 + RADIO_BUTTON_HEIGHT) ; \
+ RadioButton RB_FROMCOMPONENT \
+ { \
+ Pos = MAP_APPFONT ( 12 , 14 ) ; \
+ Size = MAP_APPFONT ( 147 , 12 ) ; \
+ Text [ en-US ] = "From bibliography ~database";\
+ }; \
+ RadioButton RB_FROMDOCCONTENT \
+ { \
+ Pos = MAP_APPFONT ( 12, 29 ) ; \
+ Size = MAP_APPFONT ( 147 , 12 ) ; \
+ Text [ en-US ] = "~From document content";\
+ }; \
+ FixedText FT_AUTHOR \
+ { \
+ Pos = MAP_APPFONT ( 12 , 14 + RADIO_BUTTON_HEIGHT) ; \
+ Size = MAP_APPFONT ( 60 , 8 ) ; \
+ Text [ en-US ] = "Author";\
+ }; \
+ FixedText FI_AUTHOR \
+ { \
+ Pos = MAP_APPFONT ( 12 , 25 + RADIO_BUTTON_HEIGHT) ; \
+ Size = MAP_APPFONT ( 140, 8 ) ; \
+ WordBreak = TRUE; \
+ }; \
+ FixedText FT_TITLE \
+ { \
+ Pos = MAP_APPFONT ( 12 , 37 + RADIO_BUTTON_HEIGHT) ; \
+ Size = MAP_APPFONT ( 60 , 8 ) ; \
+ Text [ en-US ] = "Title";\
+ }; \
+ FixedText FI_TITLE \
+ { \
+ Pos = MAP_APPFONT ( 12 , 48 + RADIO_BUTTON_HEIGHT) ; \
+ Size = MAP_APPFONT ( 140, 8 ) ; \
+ WordBreak = TRUE; \
+ }; \
+ FixedText FT_ENTRY \
+ { \
+ Pos = MAP_APPFONT ( 12 , 62 + RADIO_BUTTON_HEIGHT) ; \
+ Size = MAP_APPFONT ( 60 , 8 ) ; \
+ Text [ en-US ] = "Short ~name";\
+ }; \
+ Edit ED_ENTRY \
+ { \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( 12 , 73 + RADIO_BUTTON_HEIGHT) ; \
+ Size = MAP_APPFONT ( 140 , 12 ) ; \
+ TabStop = TRUE ; \
+ Left = TRUE ; \
+ }; \
+ ListBox LB_ENTRY \
+ { \
+ Border = TRUE ; \
+ Pos = MAP_APPFONT ( 12 , 73 + RADIO_BUTTON_HEIGHT) ; \
+ Size = MAP_APPFONT ( 140 , 50 ) ; \
+ TabStop = TRUE ; \
+ DropDown = TRUE ; \
+ }; \
+ FixedLine FL_ENTRY \
+ { \
+ Pos = MAP_APPFONT ( 6 , 3 ) ; \
+ Size = MAP_APPFONT ( 146 , 8 ) ; \
+ Text [ en-US ] = "Entry";\
+ }; \
+ OKButton PB_OK \
+ { \
+ Pos = MAP_APPFONT ( 162 , 6 ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ TabStop = TRUE ; \
+ DefButton = TRUE ; \
+ Text [ en-US ] = "Insert";\
+ }; \
+ CancelButton PB_CANCEL \
+ { \
+ Pos = MAP_APPFONT ( 162 , 23 ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ Text [ en-US ] = "Close";\
+ }; \
+ HelpButton PB_HELP \
+ { \
+ Pos = MAP_APPFONT ( 162 , 43 ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ }; \
+ PushButton PB_CREATEENTRY \
+ { \
+ Pos = MAP_APPFONT ( 162 , 60 ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ Text [ en-US ] = "~New";\
+ }; \
+ PushButton PB_EDITENTRY \
+ { \
+ Pos = MAP_APPFONT ( 162 , 77 ) ; \
+ Size = MAP_APPFONT ( 50 , 14 ) ; \
+ Text [ en-US ] = "Edit";\
+ }; \
+ String ST_CHANGE \
+ { \
+ Text [ en-US ] = "Modify";\
+ }; \
+ };
+
+ModalDialog DLG_EDIT_AUTHMARK
+{
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Sizeable = FALSE ;
+ HelpId = CMD_FN_EDIT_AUTH_ENTRY_DLG;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 218 , 118 ) ;
+ #define RADIO_BUTTON_HEIGHT 0
+ AUTH_DIALOG_WINDOW
+};
+ModelessDialog DLG_INSAUTHMARK
+{
+ OutputSize = TRUE ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Sizeable = FALSE ;
+// Zoomable = TRUE ;
+ HelpId = CMD_FN_INSERT_AUTH_ENTRY_DLG;
+ SVLook = TRUE ;
+ #define RADIO_BUTTON_HEIGHT 30
+ Size = MAP_APPFONT ( 218 , 118 + RADIO_BUTTON_HEIGHT) ;
+// Moveable = TRUE ;
+ AUTH_DIALOG_WINDOW
+};
+ModalDialog DLG_CREATE_AUTH_ENTRY
+{
+ HelpId = HID_DLG_CREATE_AUTH_ENTRY;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 365 , 203 ) ;
+ Moveable = TRUE ;
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 312 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 312 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 312 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ FixedLine FL_ENTRIES
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 300 , 8 ) ;
+ Text [ en-US ] = "Entry data";
+ };
+ Text [ en-US ] = "Define Bibliography Entry";
+};
+String STR_AUTHMRK_EDIT
+{
+
+ Text [ en-US ] = "Edit Bibliography Entry";
+};
+String STR_AUTHMRK_INSERT
+{
+
+ Text [ en-US ] = "Insert Bibliography Entry";
+};
+QueryBox DLG_CHANGE_AUTH_ENTRY
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+ Message [ en-US ] = "The document already contains the bibliography entry but with different data. Do you want to adjust the existing entries?";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/index/multmrk.cxx b/sw/source/ui/index/multmrk.cxx
new file mode 100644
index 000000000000..c17f4b683906
--- /dev/null
+++ b/sw/source/ui/index/multmrk.cxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#include "swtypes.hxx"
+
+#include "multmrk.hxx"
+#include "toxmgr.hxx"
+
+#include "index.hrc"
+#include "multmrk.hrc"
+
+
+SwMultiTOXMarkDlg::SwMultiTOXMarkDlg( Window* pParent, SwTOXMgr& rTOXMgr ) :
+
+ SvxStandardDialog(pParent, SW_RES(DLG_MULTMRK)),
+
+ aTOXFL(this, SW_RES(FL_TOX)),
+ aEntryFT(this, SW_RES(FT_ENTRY)),
+ aTextFT(this, SW_RES(FT_TEXT)),
+ aTOXFT(this, SW_RES(FT_TOX)),
+ aTOXLB(this, SW_RES(LB_TOX)),
+ aOkBT(this, SW_RES(OK_BT)),
+ aCancelBT(this, SW_RES(CANCEL_BT)),
+ rMgr( rTOXMgr ),
+ nPos(0)
+{
+ aTOXLB.SetSelectHdl(LINK(this, SwMultiTOXMarkDlg, SelectHdl));
+
+ USHORT nSize = rMgr.GetTOXMarkCount();
+ for(USHORT i=0; i < nSize; ++i)
+ aTOXLB.InsertEntry(rMgr.GetTOXMark(i)->GetText());
+
+ aTOXLB.SelectEntryPos(0);
+ aTextFT.SetText(rMgr.GetTOXMark(0)->GetTOXType()->GetTypeName());
+
+ FreeResource();
+}
+
+
+IMPL_LINK_INLINE_START( SwMultiTOXMarkDlg, SelectHdl, ListBox *, pBox )
+{
+ if(pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND)
+ { SwTOXMark* pMark = rMgr.GetTOXMark(pBox->GetSelectEntryPos());
+ aTextFT.SetText(pMark->GetTOXType()->GetTypeName());
+ nPos = pBox->GetSelectEntryPos();
+ }
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwMultiTOXMarkDlg, SelectHdl, ListBox *, pBox )
+
+
+void SwMultiTOXMarkDlg::Apply()
+{
+ rMgr.SetCurTOXMark(nPos);
+}
+
+/*-----------------25.02.94 22:06-------------------
+ dtor ueberladen
+--------------------------------------------------*/
+
+
+SwMultiTOXMarkDlg::~SwMultiTOXMarkDlg() {}
+
+
+
diff --git a/sw/source/ui/index/multmrk.hrc b/sw/source/ui/index/multmrk.hrc
new file mode 100644
index 000000000000..8a24f9c0336d
--- /dev/null
+++ b/sw/source/ui/index/multmrk.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define FT_ENTRY 1
+#define FT_TOX 2
+#define OK_BT 3
+#define LB_TOX 4
+#define FT_TEXT 5
+#define FL_TOX 6
+#define CANCEL_BT 7
+
diff --git a/sw/source/ui/index/multmrk.src b/sw/source/ui/index/multmrk.src
new file mode 100644
index 000000000000..5ecb1810d811
--- /dev/null
+++ b/sw/source/ui/index/multmrk.src
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "index.hrc"
+#include "multmrk.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ModalDialog DLG_MULTMRK
+{
+ HelpID = CMD_FN_EDIT_IDX_ENTRY_DLG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 220 , 95 ) ;
+ Text [ en-US ] = "Index Markings" ;
+ Moveable = TRUE ;
+ FixedLine FL_TOX
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 153 , 8 ) ;
+ Text [ en-US ] = "Selection" ;
+ };
+ FixedText FT_ENTRY
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 41 , 8 ) ;
+ Text [ en-US ] = "Index" ;
+ Left = TRUE ;
+ };
+ FixedText FT_TEXT
+ {
+ Pos = MAP_APPFONT ( 53 , 14 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Left = TRUE ;
+ };
+ FixedText FT_TOX
+ {
+ Pos = MAP_APPFONT ( 12 , 26 ) ;
+ Size = MAP_APPFONT ( 41 , 8 ) ;
+ Text [ en-US ] = "Entry" ;
+ Left = TRUE ;
+ };
+ ListBox LB_TOX
+ {
+ HelpID = "sw:ListBox:DLG_MULTMRK:LB_TOX";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 37 ) ;
+ Size = MAP_APPFONT ( 100 , 49 ) ;
+ TabStop = TRUE ;
+ AutoHScroll = TRUE ;
+ };
+ OKButton OK_BT
+ {
+ Pos = MAP_APPFONT ( 165 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton CANCEL_BT
+ {
+ Pos = MAP_APPFONT ( 165 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
new file mode 100644
index 000000000000..16ff3e4973d8
--- /dev/null
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -0,0 +1,1947 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include "swuiidxmrk.hxx"
+#include <hintids.hxx>
+#include <helpid.h>
+#define _SVSTDARR_STRINGSSORT
+#include <svl/svstdarr.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <svl/stritem.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/eitem.hxx>
+#include <svtools/txtcmp.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <svl/itemset.hxx>
+#include <editeng/langitem.hxx>
+#include "editeng/unolingu.hxx"
+#include <swtypes.hxx>
+#include <idxmrk.hxx>
+#include <txttxmrk.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <multmrk.hxx>
+#include <swundo.hxx> // fuer Undo-Ids
+#include <cmdid.h>
+#include <index.hrc>
+#include <idxmrk.hrc>
+#include <swmodule.hxx>
+#include <fldmgr.hxx>
+#include <fldbas.hxx>
+#include <utlui.hrc>
+#include <swcont.hxx>
+#include <svl/cjkoptions.hxx>
+#include <ndtxt.hxx>
+#include <breakit.hxx>
+#include <SwRewriter.hxx>
+
+#include "swuiidxmrk.hxx"
+#include <unomid.h>
+
+
+#define POS_CONTENT 0
+#define POS_INDEX 1
+#define POS_USER 2
+
+static sal_uInt16 nTypePos = 1; // TOX_INDEX as standard
+static sal_uInt16 nKey1Pos = USHRT_MAX;
+
+static sal_uInt16 nKey2Pos = USHRT_MAX;
+
+using namespace com::sun::star;
+using namespace com::sun::star::i18n;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::util;
+using namespace com::sun::star::i18n;
+using ::rtl::OUString;
+using namespace ::comphelper;
+using namespace ::com::sun::star;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Dialog zum Einfuegen einer Verzeichnismarkierung
+ --------------------------------------------------------------------*/
+SwIndexMarkDlg::SwIndexMarkDlg(Window *pParent,
+ sal_Bool bNewDlg,
+ const ResId& rResId,
+ sal_Int32 _nOptionsId, SwWrtShell& rWrtShell ) :
+ Window(pParent, rResId),
+ aTypeFT (this, SW_RES(LBL_INDEX )),
+ aTypeDCB(this, SW_RES(DCB_INDEX )),
+ aNewBT(this, SW_RES(BT_NEW )),
+
+ aEntryFT(this, SW_RES(LBL_ENTRY )),
+ aEntryED(this, SW_RES(SL_ENTRY )),
+ aPhoneticFT0(this, SW_RES(FT_PHONETIC_1 )),
+ aPhoneticED0(this, SW_RES(ED_PHONETIC_1 )),
+
+ aKeyFT(this, SW_RES(LBL_KEY )),
+ aKeyDCB(this, SW_RES(DCB_KEY )),
+ aPhoneticFT1(this, SW_RES(FT_PHONETIC_2 )),
+ aPhoneticED1(this, SW_RES(ED_PHONETIC_2 )),
+
+ aKey2FT(this, SW_RES(LBL_KEY2 )),
+ aKey2DCB(this, SW_RES(DCB_KEY2 )),
+ aPhoneticFT2(this, SW_RES(FT_PHONETIC_3 )),
+ aPhoneticED2(this, SW_RES(ED_PHONETIC_3 )),
+
+ aLevelFT(this, SW_RES(LBL_LEVEL )),
+ aLevelED(this, SW_RES(SL_LEVEL )),
+ aMainEntryCB(this, SW_RES(CB_MAIN_ENTRY )),
+ aApplyToAllCB(this,SW_RES(CB_APPLY_TO_ALL)),
+ aSearchCaseSensitiveCB(this, SW_RES(CB_CASESENSITIVE )),
+ aSearchCaseWordOnlyCB(this, SW_RES(CB_WORDONLY )),
+
+ aIndexFL(this, SW_RES(FL_INDEX )),
+
+ aOKBT(this, SW_RES(BT_OK )),
+ aCancelBT(this, SW_RES(BT_CANCEL )),
+ aHelpBT(this, SW_RES(BT_HELP )),
+ aDelBT(this, SW_RES(BT_DEL )),
+
+ aPrevSameBT(this,SW_RES(BT_PREVSAME)),
+ aNextSameBT(this,SW_RES(BT_NXTSAME)),
+ aPrevBT(this, SW_RES(BT_PREV )),
+ aNextBT(this, SW_RES(BT_NXT )),
+
+ nOptionsId( _nOptionsId ),
+ bDel(sal_False),
+ bNewMark(bNewDlg),
+ bSelected(sal_False),
+
+ bPhoneticED0_ChangedByUser(FALSE),
+ bPhoneticED1_ChangedByUser(FALSE),
+ bPhoneticED2_ChangedByUser(FALSE),
+ nLangForPhoneticReading(2052),
+ bIsPhoneticReadingEnabled(FALSE),
+ xExtendedIndexEntrySupplier(NULL),
+ pTOXMgr(0),
+ pSh(&rWrtShell)
+{
+ if( SvtCJKOptions().IsCJKFontEnabled() )
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory();
+
+ xExtendedIndexEntrySupplier =
+ uno::Reference< i18n::XExtendedIndexEntrySupplier > (
+ xMSF->createInstance( C2U("com.sun.star.i18n.IndexEntrySupplier") ),
+ uno::UNO_QUERY );
+ }
+
+ SetStyle(GetStyle()|WB_DIALOGCONTROL);
+ FreeResource();
+ aOKBT .SetHelpId(HID_INSERT_IDX_MRK_OK );
+ aCancelBT .SetHelpId(HID_INSERT_IDX_MRK_CLOSE );
+ aDelBT .SetHelpId(HID_INSERT_IDX_MRK_DELETE );
+ aNewBT .SetHelpId(HID_INSERT_IDX_MRK_NEW );
+ aPrevBT .SetHelpId(HID_INSERT_IDX_MRK_PREV );
+ aPrevSameBT .SetHelpId(HID_INSERT_IDX_MRK_PREV_SAME );
+ aNextBT .SetHelpId(HID_INSERT_IDX_MRK_NEXT );
+ aNextSameBT .SetHelpId(HID_INSERT_IDX_MRK_NEXT_SAME );
+ aTypeDCB .SetHelpId(HID_INSERT_IDX_MRK_TYPE );
+ aEntryED .SetHelpId(HID_INSERT_IDX_MRK_ENTRY );
+ aKeyDCB .SetHelpId(HID_INSERT_IDX_MRK_PRIM_KEY );
+ aKey2DCB .SetHelpId(HID_INSERT_IDX_MRK_SEC_KEY );
+ aLevelED .SetHelpId(HID_INSERT_IDX_MRK_LEVEL );
+ aMainEntryCB .SetHelpId(HID_INSERT_IDX_MRK_MAIN_ENTRY);
+ aApplyToAllCB .SetHelpId(HID_INSERT_IDX_MRK_APPLY_ALL );
+ aPhoneticED0 .SetHelpId(HID_INSERT_IDX_MRK_PHONETIC_READING );
+ aPhoneticED1 .SetHelpId(HID_INSERT_IDX_MRK_PHONETIC_READING );
+ aPhoneticED2 .SetHelpId(HID_INSERT_IDX_MRK_PHONETIC_READING );
+
+ aSearchCaseSensitiveCB.SetHelpId( HID_INSERT_IDX_MRK_SRCH_CASESENSITIVE );
+ aSearchCaseWordOnlyCB.SetHelpId( HID_INSERT_IDX_MRK_SRCH_WORDONLY );
+
+
+ GetParent()->SetText( SW_RESSTR( bNewMark ? STR_IDXMRK_INSERT : STR_IDXMRK_EDIT));
+
+ aDelBT.SetClickHdl(LINK(this,SwIndexMarkDlg, DelHdl));
+ aPrevBT.SetClickHdl(LINK(this,SwIndexMarkDlg, PrevHdl));
+ aPrevSameBT.SetClickHdl(LINK(this,SwIndexMarkDlg, PrevSameHdl));
+ aNextBT.SetClickHdl(LINK(this,SwIndexMarkDlg, NextHdl));
+ aNextSameBT.SetClickHdl(LINK(this,SwIndexMarkDlg, NextSameHdl));
+ //aTypeDCB.SetModifyHdl(LINK(this,SwIndexMarkDlg, ModifyHdl));
+ aTypeDCB.SetSelectHdl(LINK(this,SwIndexMarkDlg, ModifyHdl));
+ aKeyDCB.SetModifyHdl(LINK(this,SwIndexMarkDlg, KeyDCBModifyHdl));
+ aKey2DCB.SetModifyHdl(LINK(this,SwIndexMarkDlg, KeyDCBModifyHdl));
+ aOKBT.SetClickHdl(LINK(this,SwIndexMarkDlg, InsertHdl));
+ aCancelBT.SetClickHdl(LINK(this,SwIndexMarkDlg, CloseHdl));
+ aEntryED.SetModifyHdl(LINK(this,SwIndexMarkDlg, ModifyHdl));
+ aNewBT.SetClickHdl(LINK(this, SwIndexMarkDlg, NewUserIdxHdl));
+ aApplyToAllCB.SetClickHdl(LINK(this, SwIndexMarkDlg, SearchTypeHdl));
+ aPhoneticED0.SetModifyHdl(LINK(this,SwIndexMarkDlg, PhoneticEDModifyHdl));
+ aPhoneticED1.SetModifyHdl(LINK(this,SwIndexMarkDlg, PhoneticEDModifyHdl));
+ aPhoneticED2.SetModifyHdl(LINK(this,SwIndexMarkDlg, PhoneticEDModifyHdl));
+
+ if(bNewMark)
+ {
+ aDelBT.Hide();
+
+ {
+ ImageList aTempList( SW_RES( IMG_NAVI_ENTRYBMPH ) );
+ aNewBT.SetModeImage( aTempList.GetImage( SID_SW_START + CONTENT_TYPE_INDEX ), BMP_COLOR_HIGHCONTRAST );
+ }
+
+ {
+ ImageList aTempList( SW_RES( IMG_NAVI_ENTRYBMP ) );
+ aNewBT.SetModeImage( aTempList.GetImage( SID_SW_START + CONTENT_TYPE_INDEX ), BMP_COLOR_NORMAL );
+ }
+ }
+ else
+ {
+ aNewBT.Hide();
+ OKButton aTmp(this, WB_HIDE);
+ aOKBT.SetText( aTmp.GetText() );
+ }
+
+ aEntryED.GrabFocus();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Controls neu initialisieren mit der aktuellen
+ Markierung
+ --------------------------------------------------------------------*/
+
+
+void SwIndexMarkDlg::InitControls()
+{
+ DBG_ASSERT(pSh && pTOXMgr, "Shell nicht da?");
+ // Inhalts-Verzeichnis
+ const SwTOXType* pType = pTOXMgr->GetTOXType(TOX_CONTENT, 0);
+ ASSERT(pType, "Kein Verzeichnistyp !!");
+ String sTmpTypeSelection;
+ if(aTypeDCB.GetSelectEntryCount())
+ sTmpTypeSelection = aTypeDCB.GetSelectEntry();
+ aTypeDCB.Clear();
+ aTypeDCB.InsertEntry(pType->GetTypeName());
+
+ // Stichwort-Verzeichnis
+ pType = pTOXMgr->GetTOXType(TOX_INDEX, 0);
+ ASSERT(pType, "Kein Verzeichnistyp !!");
+ aTypeDCB.InsertEntry(pType->GetTypeName());
+
+ // Benutzerverzeichnisse
+ sal_uInt16 nCount = pSh->GetTOXTypeCount(TOX_USER);
+ sal_uInt16 i;
+ for( i = 0; i < nCount; ++i )
+ aTypeDCB.InsertEntry( pSh->GetTOXType(TOX_USER, i)->GetTypeName() );
+
+ // KeyWords Primary einlesen
+ SvStringsSort aArr;
+ nCount = pSh->GetTOIKeys( TOI_PRIMARY, aArr );
+ for(i=0; i < nCount; ++i)
+ aKeyDCB.InsertEntry( *aArr[ i ] );
+
+ // KeyWords Secondary einlesen
+ nCount = pSh->GetTOIKeys( TOI_SECONDARY, aArr );
+ for(i=0; i < nCount; ++i)
+ aKey2DCB.InsertEntry( *aArr[ i ] );
+
+ UpdateLanguageDependenciesForPhoneticReading();
+
+ // Aktueller Eintrag
+ const SwTOXMark* pMark = pTOXMgr->GetCurTOXMark();
+ if( pMark && !bNewMark)
+ {
+ // Controls-Handling
+
+ // nur wenn mehr als eins vorhanden
+ // wenn gleich landet es auf dem gleichen Eintrag
+ pSh->SttCrsrMove();
+
+ const SwTOXMark* pMoveMark;
+ sal_Bool bShow = sal_False;
+
+ pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_PRV );
+ if( pMoveMark != pMark )
+ pSh->GotoTOXMark( *pMoveMark, TOX_NXT ), bShow = sal_True;
+ aPrevBT.Enable( pMoveMark != pMark );
+ pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_NXT );
+ if( pMoveMark != pMark )
+ pSh->GotoTOXMark( *pMoveMark, TOX_PRV ), bShow = sal_True;
+ aNextBT.Enable( pMoveMark != pMark );
+ if( bShow )
+ {
+ aPrevBT.Show();
+ aNextBT.Show();
+ bShow = sal_False;
+ }
+
+ pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_SAME_PRV );
+ if( pMoveMark != pMark )
+ pSh->GotoTOXMark( *pMoveMark, TOX_SAME_NXT ), bShow = sal_True;
+ aPrevSameBT.Enable( pMoveMark != pMark );
+ pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_SAME_NXT );
+ if( pMoveMark != pMark )
+ pSh->GotoTOXMark( *pMoveMark, TOX_SAME_PRV ), bShow = sal_True;
+ aNextSameBT.Enable( pMoveMark != pMark );
+ if( bShow )
+ {
+ aNextSameBT.Show();
+ aPrevSameBT.Show();
+ }
+ pSh->EndCrsrMove();
+
+ aTypeFT.Show();
+
+ aTypeDCB.Enable(sal_False);
+ aTypeFT.Enable(sal_False);
+
+ UpdateDialog();
+ }
+ else
+ { // aktuelle Selektion (1.Element) anzeigen ????
+ sal_uInt16 nCnt = pSh->GetCrsrCnt();
+ if (nCnt < 2)
+ {
+ bSelected = !pSh->HasSelection();
+ aOrgStr = pSh->GetView().GetSelectionTextParam(sal_True, sal_False);
+ aEntryED.SetText(aOrgStr);
+
+ //alle gleichen Eintraege aufzunehmen darf nur im Body und auch da nur
+ //bei vorhandener einfacher Selektion erlaubt werden
+ const sal_uInt16 nFrmType = pSh->GetFrmType(0,sal_True);
+ aApplyToAllCB.Show();
+ aSearchCaseSensitiveCB.Show();
+ aSearchCaseWordOnlyCB.Show();
+ aApplyToAllCB.Enable(0 != aOrgStr.Len() &&
+ 0 == (nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FLY_ANY )));
+ SearchTypeHdl(&aApplyToAllCB);
+ }
+
+ // Verzeichnistyp ist default
+ if( sTmpTypeSelection.Len() &&
+ LISTBOX_ENTRY_NOTFOUND != aTypeDCB.GetEntryPos( sTmpTypeSelection ) )
+ aTypeDCB.SelectEntry(sTmpTypeSelection);
+ else
+ aTypeDCB.SelectEntry(aTypeDCB.GetEntry(nTypePos));
+ ModifyHdl(&aTypeDCB);
+ }
+}
+
+void SwIndexMarkDlg::UpdateLanguageDependenciesForPhoneticReading()
+{
+ //no phonetic reading if no global cjk support
+ if( !xExtendedIndexEntrySupplier.is() )
+ {
+ bIsPhoneticReadingEnabled = FALSE;
+ return;
+ }
+ bIsPhoneticReadingEnabled = TRUE;
+
+ //get the current language
+ if(!bNewMark) //if dialog is opened to iterate existing marks
+ {
+ ASSERT(pTOXMgr, "need TOXMgr")
+ if(!pTOXMgr)
+ return;
+ SwTOXMark* pMark = pTOXMgr->GetCurTOXMark();
+ ASSERT(pMark, "need current SwTOXMark");
+ if(!pMark)
+ return;
+ SwTxtTOXMark* pTxtTOXMark = pMark->GetTxtTOXMark();
+ ASSERT(pTxtTOXMark, "need current SwTxtTOXMark");
+ if(!pTxtTOXMark)
+ return;
+ const SwTxtNode* pTxtNode = pTxtTOXMark->GetpTxtNd();
+ ASSERT(pTxtNode, "need current SwTxtNode");
+ if(!pTxtNode)
+ return;
+ xub_StrLen nTextIndex = *pTxtTOXMark->GetStart();
+ nLangForPhoneticReading = pTxtNode->GetLang( nTextIndex );
+ }
+ else //if dialog is opened to create a new mark
+ {
+ USHORT nScriptType = pSh->GetScriptType();
+ USHORT nWhich;
+ switch(nScriptType)
+ {
+ case SCRIPTTYPE_ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break;
+ case SCRIPTTYPE_COMPLEX:nWhich = RES_CHRATR_CTL_LANGUAGE; break;
+ //case SCRIPTTYPE_LATIN:
+ default:nWhich = RES_CHRATR_LANGUAGE; break;
+ }
+ SfxItemSet aLangSet(pSh->GetAttrPool(), nWhich, nWhich);
+ pSh->GetCurAttr(aLangSet);
+ nLangForPhoneticReading = ((const SvxLanguageItem&)aLangSet.Get(nWhich)).GetLanguage();
+ }
+
+ /*
+ //enable phonetic reading dependent on the current language
+ {
+ lang::Locale aLocale( SvxCreateLocale( LanguageType( nLangForPhoneticReading ) ) );
+ bIsPhoneticReadingEnabled = xExtendedIndexEntrySupplier->usePhoneticEntry( aLocale );
+ }
+ */
+}
+
+String SwIndexMarkDlg::GetDefaultPhoneticReading( const String& rText )
+{
+ if( !bIsPhoneticReadingEnabled )
+ return aEmptyStr;
+
+ lang::Locale aLocale( SvxCreateLocale( LanguageType( nLangForPhoneticReading ) ) );
+ return xExtendedIndexEntrySupplier->getPhoneticCandidate(rText, aLocale);
+}
+
+/* -----------------07.09.99 10:43-------------------
+ Change the content of aEntryED if text is selected
+ --------------------------------------------------*/
+
+void SwIndexMarkDlg::Activate()
+{
+ // aktuelle Selektion (1.Element) anzeigen ????
+ if(bNewMark)
+ {
+ sal_uInt16 nCnt = pSh->GetCrsrCnt();
+ if (nCnt < 2)
+ {
+ bSelected = !pSh->HasSelection();
+ aOrgStr = pSh->GetView().GetSelectionTextParam(sal_True, sal_False);
+ aEntryED.SetText(aOrgStr);
+
+ //alle gleichen Eintraege aufzunehmen darf nur im Body und auch da nur
+ //bei vorhandener einfacher Selektion erlaubt werden
+ const sal_uInt16 nFrmType = pSh->GetFrmType(0,sal_True);
+ aApplyToAllCB.Show();
+ aSearchCaseSensitiveCB.Show();
+ aSearchCaseWordOnlyCB.Show();
+ aApplyToAllCB.Enable(0 != aOrgStr.Len() &&
+ 0 == (nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FLY_ANY )));
+ SearchTypeHdl(&aApplyToAllCB);
+ }
+ ModifyHdl(&aTypeDCB);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ok-Button auswerten
+ --------------------------------------------------------------------*/
+void SwIndexMarkDlg::Apply()
+{
+ InsertUpdate();
+ if(bSelected)
+ pSh->ResetSelect(0, sal_False);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aenderungen uebernehmen
+ --------------------------------------------------------------------*/
+
+
+void SwIndexMarkDlg::InsertUpdate()
+{
+ pSh->StartUndo(bDel ? UNDO_INDEX_ENTRY_DELETE : UNDO_INDEX_ENTRY_INSERT);
+ pSh->StartAllAction();
+
+ SwRewriter aRewriter;
+
+ if( bNewMark )
+ {
+ InsertMark();
+
+ if ( pTOXMgr->GetCurTOXMark())
+ aRewriter.AddRule(UNDO_ARG1, pTOXMgr->GetCurTOXMark()->GetText());
+ }
+ else if( !pSh->HasReadonlySel() )
+ {
+ if ( pTOXMgr->GetCurTOXMark())
+ aRewriter.AddRule(UNDO_ARG1,
+ pTOXMgr->GetCurTOXMark()->GetText());
+
+ if( bDel )
+ pTOXMgr->DeleteTOXMark();
+ else if( pTOXMgr->GetCurTOXMark() )
+ UpdateMark();
+ }
+
+ pSh->EndAllAction();
+ pSh->EndUndo(bDel ? UNDO_INDEX_ENTRY_DELETE : UNDO_INDEX_ENTRY_INSERT);
+
+ if((nTypePos = aTypeDCB.GetEntryPos(aTypeDCB.GetSelectEntry())) == LISTBOX_ENTRY_NOTFOUND)
+ nTypePos = 0;
+
+ nKey1Pos = aKeyDCB.GetEntryPos(aKeyDCB.GetText());
+ nKey2Pos = aKey2DCB.GetEntryPos(aKey2DCB.GetText());
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Marke einfuegen
+ --------------------------------------------------------------------*/
+static void lcl_SelectSameStrings(SwWrtShell& rSh, BOOL bWordOnly, BOOL bCaseSensitive)
+{
+ rSh.Push();
+
+ SearchOptions aSearchOpt(
+ SearchAlgorithms_ABSOLUTE,
+ ( bWordOnly ? SearchFlags::NORM_WORD_ONLY : 0 ),
+ rSh.GetSelTxt(), OUString(),
+ SvxCreateLocale( GetAppLanguage() ),
+ 0, 0, 0,
+ (bCaseSensitive
+ ? 0
+ : TransliterationModules_IGNORE_CASE) );
+
+ rSh.ClearMark();
+ BOOL bCancel;
+
+ //todo/mba: assuming that notes should not be searched
+ BOOL bSearchInNotes = FALSE;
+ rSh.Find( aSearchOpt, bSearchInNotes, DOCPOS_START, DOCPOS_END, bCancel,
+ (FindRanges)(FND_IN_SELALL|FND_IN_BODYONLY), FALSE );
+}
+
+
+void SwIndexMarkDlg::InsertMark()
+{
+ sal_uInt16 nPos = aTypeDCB.GetEntryPos(aTypeDCB.GetSelectEntry());
+ TOXTypes eType = nPos == POS_CONTENT ? TOX_CONTENT :
+ nPos == POS_INDEX ? TOX_INDEX : TOX_USER;
+
+ SwTOXMarkDescription aDesc(eType);
+
+ sal_uInt16 nLevel = (sal_uInt16)aLevelED.Denormalize(aLevelED.GetValue());
+ switch(nPos)
+ {
+ case POS_CONTENT : break;
+ case POS_INDEX: // Stichwortverzeichnismarke
+ {
+ UpdateKeyBoxes();
+ String aPrim(aKeyDCB.GetText());
+ String aSec(aKey2DCB.GetText());
+ aDesc.SetPrimKey(aPrim);
+ aDesc.SetSecKey(aSec);
+ aDesc.SetMainEntry(aMainEntryCB.IsChecked());
+ aDesc.SetPhoneticReadingOfAltStr(aPhoneticED0.GetText());
+ aDesc.SetPhoneticReadingOfPrimKey(aPhoneticED1.GetText());
+ aDesc.SetPhoneticReadingOfSecKey(aPhoneticED2.GetText());
+ }
+ break;
+ default: // Userdefinedverz.-Marke
+ {
+ String aName(aTypeDCB.GetSelectEntry());
+ aDesc.SetTOUName(aName);
+ }
+ }
+ if (aOrgStr != aEntryED.GetText())
+ aDesc.SetAltStr(aEntryED.GetText());
+ BOOL bApplyAll = aApplyToAllCB.IsChecked();
+ BOOL bWordOnly = aSearchCaseWordOnlyCB.IsChecked();
+ BOOL bCaseSensitive = aSearchCaseSensitiveCB.IsChecked();
+
+ pSh->StartAllAction();
+ // hier muessen alle gleichen Strings selektiert werden
+ // damit der Eintrag auf alle gleichen Strings angewandt wird
+ if(bApplyAll)
+ {
+ lcl_SelectSameStrings(*pSh, bWordOnly, bCaseSensitive);
+ }
+ aDesc.SetLevel(nLevel);
+ SwTOXMgr aMgr(pSh);
+ aMgr.InsertTOXMark(aDesc);
+ if(bApplyAll)
+ pSh->Pop(FALSE);
+
+ pSh->EndAllAction();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Marke Updaten
+ --------------------------------------------------------------------*/
+
+
+void SwIndexMarkDlg::UpdateMark()
+{
+ String aAltText(aEntryED.GetText());
+ String* pAltText = aOrgStr != aEntryED.GetText() ? &aAltText : 0;
+ //empty alternative texts are not allowed
+ if(pAltText && !pAltText->Len())
+ return;
+
+ UpdateKeyBoxes();
+
+ sal_uInt16 nPos = aTypeDCB.GetEntryPos(aTypeDCB.GetSelectEntry());
+ TOXTypes eType = TOX_USER;
+ if(POS_CONTENT == nPos)
+ eType = TOX_CONTENT;
+ else if(POS_INDEX == nPos)
+ eType = TOX_INDEX;
+
+ SwTOXMarkDescription aDesc(eType);
+ aDesc.SetLevel( static_cast< int >(aLevelED.GetValue()) );
+ if(pAltText)
+ aDesc.SetAltStr(*pAltText);
+
+ String aPrim(aKeyDCB.GetText());
+ if(aPrim.Len())
+ aDesc.SetPrimKey(aPrim);
+ String aSec(aKey2DCB.GetText());
+ if(aSec.Len())
+ aDesc.SetSecKey(aSec);
+
+ if(eType == TOX_INDEX)
+ {
+ aDesc.SetPhoneticReadingOfAltStr(aPhoneticED0.GetText());
+ aDesc.SetPhoneticReadingOfPrimKey(aPhoneticED1.GetText());
+ aDesc.SetPhoneticReadingOfSecKey(aPhoneticED2.GetText());
+ }
+ aDesc.SetMainEntry(aMainEntryCB.IsVisible() && aMainEntryCB.IsChecked());
+ pTOXMgr->UpdateTOXMark(aDesc);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Neue Keys eintragen
+ --------------------------------------------------------------------*/
+
+
+void SwIndexMarkDlg::UpdateKeyBoxes()
+{
+ String aKey(aKeyDCB.GetText());
+ sal_uInt16 nPos = aKeyDCB.GetEntryPos(aKey);
+
+ if(nPos == LISTBOX_ENTRY_NOTFOUND && aKey.Len() > 0)
+ { // neuen Key erzeugen
+ aKeyDCB.InsertEntry(aKey);
+ }
+
+ aKey = aKey2DCB.GetText();
+ nPos = aKey2DCB.GetEntryPos(aKey);
+
+ if(nPos == LISTBOX_ENTRY_NOTFOUND && aKey.Len() > 0)
+ { // neuen Key erzeugen
+ aKey2DCB.InsertEntry(aKey);
+ }
+}
+/* -----------------13.10.99 15:10-------------------
+
+ --------------------------------------------------*/
+class SwNewUserIdxDlg : public ModalDialog
+{
+ OKButton aOKPB;
+ CancelButton aCancelPB;
+ HelpButton aHelpPB;
+ FixedLine aNameFL;
+ FixedText aNameFT;
+ Edit aNameED;
+
+ SwIndexMarkDlg* pDlg;
+
+ DECL_LINK( ModifyHdl, Edit*);
+
+ public:
+ SwNewUserIdxDlg(SwIndexMarkDlg* pParent) :
+ ModalDialog(pParent, SW_RES(DLG_NEW_USER_IDX)),
+ aOKPB(this, SW_RES( PB_OK )),
+ aCancelPB(this, SW_RES( PB_CANCEL )),
+ aHelpPB(this, SW_RES( PB_HELP )),
+ aNameFL(this, SW_RES( FL_NAME )),
+ aNameFT(this, SW_RES( FT_NAME )),
+ aNameED(this, SW_RES( ED_NAME )),
+ pDlg(pParent)
+ {
+ FreeResource();
+ aNameED.SetModifyHdl(LINK(this, SwNewUserIdxDlg, ModifyHdl));
+ aOKPB.Enable(sal_False);
+ aNameED.GrabFocus();
+ }
+
+ virtual void Apply();
+ String GetName(){return aNameED.GetText();}
+};
+void SwNewUserIdxDlg::Apply()
+{
+}
+
+IMPL_LINK( SwNewUserIdxDlg, ModifyHdl, Edit*, pEdit)
+{
+ aOKPB.Enable(pEdit->GetText().Len() && !pDlg->IsTOXType(pEdit->GetText()));
+ return 0;
+}
+
+IMPL_LINK( SwIndexMarkDlg, NewUserIdxHdl, Button*, EMPTYARG)
+{
+ SwNewUserIdxDlg* pDlg = new SwNewUserIdxDlg(this);
+ if(RET_OK == pDlg->Execute())
+ {
+ String sNewName(pDlg->GetName());
+ aTypeDCB.InsertEntry(sNewName);
+ aTypeDCB.SelectEntry(sNewName);
+ }
+ delete pDlg;
+ return 0;
+}
+/* -----------------------------17.01.00 12:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SwIndexMarkDlg, SearchTypeHdl, CheckBox*, pBox)
+{
+ sal_Bool bEnable = pBox->IsChecked() && pBox->IsEnabled();
+ aSearchCaseWordOnlyCB.Enable(bEnable);
+ aSearchCaseSensitiveCB.Enable(bEnable);
+ return 0;
+}
+/* -----------------07.09.99 10:30-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK( SwIndexMarkDlg, InsertHdl, Button *, pButton )
+{
+ Apply();
+ //close the dialog if only one entry is available
+ if(!bNewMark && !aPrevBT.IsVisible() && !aNextBT.IsVisible())
+ CloseHdl(pButton);
+ return 0;
+}
+/* -----------------07.09.99 10:29-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK( SwIndexMarkDlg, CloseHdl, Button *, EMPTYARG )
+{
+ if(bNewMark)
+ {
+ sal_uInt16 nSlot = FN_INSERT_IDX_ENTRY_DLG;
+ SfxViewFrame::Current()->GetDispatcher()->Execute(nSlot,
+ SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD);
+ }
+ else
+ {
+ ((SwIndexMarkModalDlg*)GetParent())->EndDialog(RET_CANCEL);
+ }
+ return 0;
+}
+/*--------------------------------------------------------------------
+ Beschreibung: VerzeichnisTyp auswaehlen nur bei Einfuegen
+ --------------------------------------------------------------------*/
+IMPL_LINK( SwIndexMarkDlg, ModifyHdl, ListBox *, pBox )
+{
+ if(&aTypeDCB == pBox)
+ {
+ // Verzeichnistyp setzen
+ sal_uInt16 nPos = aTypeDCB.GetEntryPos(aTypeDCB.GetSelectEntry());
+ sal_Bool bLevelEnable = sal_False,
+ bKeyEnable = sal_False,
+ bSetKey2 = sal_False,
+ bKey2Enable = sal_False,
+ bEntryHasText = sal_False,
+ bKey1HasText = sal_False,
+ bKey2HasText = sal_False;
+ if(nPos == POS_INDEX)
+ {
+ if(aEntryED.GetText().Len())
+ bEntryHasText = sal_True;
+ aPhoneticED0.SetText(GetDefaultPhoneticReading(aEntryED.GetText()));
+
+ bKeyEnable = sal_True;
+ aKeyDCB.SetText(aKeyDCB.GetEntry(nKey1Pos));
+ aPhoneticED1.SetText(GetDefaultPhoneticReading(aKeyDCB.GetText()));
+ if(aKeyDCB.GetText().Len() > 0)
+ {
+ bKey1HasText = bSetKey2 = bKey2Enable = sal_True;
+ aKey2DCB.SetText(aKey2DCB.GetEntry(nKey2Pos));
+ aPhoneticED2.SetText(GetDefaultPhoneticReading(aKey2DCB.GetText()));
+ if(aKey2DCB.GetText().Len())
+ bKey2HasText = sal_True;
+ }
+ }
+ else
+ {
+ bLevelEnable = sal_True;
+ aLevelED.SetMax(MAXLEVEL);
+ aLevelED.SetValue(aLevelED.Normalize(0));
+ bSetKey2 = sal_True;
+ }
+ aLevelFT.Show(bLevelEnable);
+ aLevelED.Show(bLevelEnable);
+ aMainEntryCB.Show(nPos == POS_INDEX);
+
+ aKeyFT.Enable(bKeyEnable);
+ aKeyDCB.Enable(bKeyEnable);
+ if ( bSetKey2 )
+ {
+ aKey2DCB.Enable(bKey2Enable);
+ aKey2FT.Enable(bKey2Enable);
+ }
+ aPhoneticFT0.Enable(bKeyEnable&&bEntryHasText&&bIsPhoneticReadingEnabled);
+ aPhoneticED0.Enable(bKeyEnable&&bEntryHasText&&bIsPhoneticReadingEnabled);
+ aPhoneticFT1.Enable(bKeyEnable&&bKey1HasText&&bIsPhoneticReadingEnabled);
+ aPhoneticED1.Enable(bKeyEnable&&bKey1HasText&&bIsPhoneticReadingEnabled);
+ aPhoneticFT2.Enable(bKeyEnable&&bKey2HasText&&bIsPhoneticReadingEnabled);
+ aPhoneticED2.Enable(bKeyEnable&&bKey2HasText&&bIsPhoneticReadingEnabled);
+ }
+ else //aEntryED !!aEntryED is not a ListBox but a Edit
+ {
+ BOOL bHasText = (aEntryED.GetText().Len()>0);
+ if(!bHasText)
+ {
+ aPhoneticED0.SetText(aEmptyStr);
+ bPhoneticED0_ChangedByUser = FALSE;
+ }
+ else if(!bPhoneticED0_ChangedByUser)
+ aPhoneticED0.SetText(GetDefaultPhoneticReading(aEntryED.GetText()));
+
+ aPhoneticFT0.Enable(bHasText&&bIsPhoneticReadingEnabled);
+ aPhoneticED0.Enable(bHasText&&bIsPhoneticReadingEnabled);
+ }
+ aOKBT.Enable(!pSh->HasReadonlySel() &&
+ (aEntryED.GetText().Len() || pSh->GetCrsrCnt(sal_False)));
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+IMPL_LINK_INLINE_START( SwIndexMarkDlg, NextHdl, Button *, EMPTYARG )
+{
+ InsertUpdate();
+ pTOXMgr->NextTOXMark();
+ UpdateDialog();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwIndexMarkDlg, NextHdl, Button *, EMPTYARG )
+
+
+IMPL_LINK_INLINE_START( SwIndexMarkDlg, NextSameHdl, Button *, EMPTYARG )
+{
+ InsertUpdate();
+ pTOXMgr->NextTOXMark(sal_True);
+ UpdateDialog();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwIndexMarkDlg, NextSameHdl, Button *, EMPTYARG )
+
+
+IMPL_LINK_INLINE_START( SwIndexMarkDlg, PrevHdl, Button *, EMPTYARG )
+{
+ InsertUpdate();
+ pTOXMgr->PrevTOXMark();
+ UpdateDialog();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwIndexMarkDlg, PrevHdl, Button *, EMPTYARG )
+
+
+IMPL_LINK_INLINE_START( SwIndexMarkDlg, PrevSameHdl, Button *, EMPTYARG )
+{
+ InsertUpdate();
+ pTOXMgr->PrevTOXMark(sal_True);
+ UpdateDialog();
+
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwIndexMarkDlg, PrevSameHdl, Button *, EMPTYARG )
+
+
+IMPL_LINK( SwIndexMarkDlg, DelHdl, Button *, EMPTYARG )
+{
+ bDel = sal_True;
+ InsertUpdate();
+ bDel = sal_False;
+
+ if(pTOXMgr->GetCurTOXMark())
+ UpdateDialog();
+ else
+ {
+ CloseHdl(&aCancelBT);
+ SfxViewFrame::Current()->GetBindings().Invalidate(FN_EDIT_IDX_ENTRY_DLG);
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Dialoganzeige erneuern
+ --------------------------------------------------------------------*/
+
+
+void SwIndexMarkDlg::UpdateDialog()
+{
+ DBG_ASSERT(pSh && pTOXMgr, "Shell nicht da?");
+ SwTOXMark* pMark = pTOXMgr->GetCurTOXMark();
+ ASSERT(pMark, "Keine aktuelle Markierung");
+ if(!pMark)
+ return;
+
+ ViewShell::SetCareWin( GetParent() );
+
+ aOrgStr = pMark->GetText();
+ aEntryED.SetText(aOrgStr);
+
+ // Verzeichnistyp setzen
+ sal_Bool bLevelEnable = sal_True,
+ bKeyEnable = sal_False,
+ bKey2Enable = sal_False,
+ bEntryHasText = sal_False,
+ bKey1HasText = sal_False,
+ bKey2HasText = sal_False;
+
+ TOXTypes eCurType = pMark->GetTOXType()->GetType();
+ if(TOX_INDEX == eCurType)
+ {
+ bLevelEnable = sal_False;
+ bKeyEnable = sal_True;
+ bKey1HasText = bKey2Enable = 0 != pMark->GetPrimaryKey().Len();
+ bKey2HasText = 0 != pMark->GetSecondaryKey().Len();
+ bEntryHasText = 0 != pMark->GetText().Len();
+ aKeyDCB.SetText( pMark->GetPrimaryKey() );
+ aKey2DCB.SetText( pMark->GetSecondaryKey() );
+ aPhoneticED0.SetText( pMark->GetTextReading() );
+ aPhoneticED1.SetText( pMark->GetPrimaryKeyReading() );
+ aPhoneticED2.SetText( pMark->GetSecondaryKeyReading() );
+ aMainEntryCB.Check(pMark->IsMainEntry());
+ }
+ else if(TOX_CONTENT == eCurType || TOX_USER == eCurType)
+ {
+ aLevelED.SetValue(aLevelED.Normalize(pMark->GetLevel()));
+ }
+ aKeyFT.Enable(bKeyEnable);
+ aKeyDCB.Enable(bKeyEnable);
+ aLevelED.SetMax(MAXLEVEL);
+ aLevelFT.Show(bLevelEnable);
+ aLevelED.Show(bLevelEnable);
+ aMainEntryCB.Show(!bLevelEnable);
+ aKey2FT.Enable(bKey2Enable);
+ aKey2DCB.Enable(bKey2Enable);
+
+ UpdateLanguageDependenciesForPhoneticReading();
+ aPhoneticFT0.Enable(bKeyEnable&&bEntryHasText&&bIsPhoneticReadingEnabled);
+ aPhoneticED0.Enable(bKeyEnable&&bEntryHasText&&bIsPhoneticReadingEnabled);
+ aPhoneticFT1.Enable(bKeyEnable&&bKey1HasText&&bIsPhoneticReadingEnabled);
+ aPhoneticED1.Enable(bKeyEnable&&bKey1HasText&&bIsPhoneticReadingEnabled);
+ aPhoneticFT2.Enable(bKeyEnable&&bKey2HasText&&bIsPhoneticReadingEnabled);
+ aPhoneticED2.Enable(bKeyEnable&&bKey2HasText&&bIsPhoneticReadingEnabled);
+
+ // Verzeichnis-Typ setzen
+ aTypeDCB.SelectEntry(pMark->GetTOXType()->GetTypeName());
+
+ // Next - Prev - Buttons setzen
+ pSh->SttCrsrMove();
+ if( aPrevBT.IsVisible() )
+ {
+ const SwTOXMark* pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_PRV );
+ if( pMoveMark != pMark )
+ pSh->GotoTOXMark( *pMoveMark, TOX_NXT );
+ aPrevBT.Enable( pMoveMark != pMark );
+ pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_NXT );
+ if( pMoveMark != pMark )
+ pSh->GotoTOXMark( *pMoveMark, TOX_PRV );
+ aNextBT.Enable( pMoveMark != pMark );
+ }
+
+ if( aPrevSameBT.IsVisible() )
+ {
+ const SwTOXMark* pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_SAME_PRV );
+ if( pMoveMark != pMark )
+ pSh->GotoTOXMark( *pMoveMark, TOX_SAME_NXT );
+ aPrevSameBT.Enable( pMoveMark != pMark );
+ pMoveMark = &pSh->GotoTOXMark( *pMark, TOX_SAME_NXT );
+ if( pMoveMark != pMark )
+ pSh->GotoTOXMark( *pMoveMark, TOX_SAME_PRV );
+ aNextSameBT.Enable( pMoveMark != pMark );
+ }
+
+ sal_Bool bEnable = !pSh->HasReadonlySel();
+ aOKBT.Enable( bEnable );
+ aDelBT.Enable( bEnable );
+ aEntryED.SetReadOnly( !bEnable );
+ aLevelED.SetReadOnly( !bEnable );
+ aKeyDCB.SetReadOnly( !bEnable );
+ aKey2DCB.SetReadOnly( !bEnable );
+
+ pSh->SelectTxtAttr( RES_TXTATR_TOXMARK, pMark->GetTxtTOXMark() );
+ // we need the point at the start of the attribut
+ pSh->SwapPam();
+
+ pSh->EndCrsrMove();
+}
+
+/*--------------------------------------------------------------------
+ Remind wether the edit boxes for Phonetic reading are changed manually
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwIndexMarkDlg, PhoneticEDModifyHdl, Edit *, pEdit )
+{
+ if(&aPhoneticED0 == pEdit)
+ {
+ bPhoneticED0_ChangedByUser = pEdit->GetText().Len()>0;
+ }
+ else if(&aPhoneticED1 == pEdit)
+ {
+ bPhoneticED1_ChangedByUser = pEdit->GetText().Len()>0;
+ }
+ else if(&aPhoneticED2 == pEdit)
+ {
+ bPhoneticED2_ChangedByUser = pEdit->GetText().Len()>0;
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Enable Disable des 2. Schluessels
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwIndexMarkDlg, KeyDCBModifyHdl, ComboBox *, pBox )
+{
+ if(&aKeyDCB == pBox)
+ {
+ sal_Bool bEnable = pBox->GetText().Len() > 0;
+ if(!bEnable)
+ {
+ aKey2DCB.SetText(aEmptyStr);
+ aPhoneticED1.SetText(aEmptyStr);
+ aPhoneticED2.SetText(aEmptyStr);
+ bPhoneticED1_ChangedByUser = FALSE;
+ bPhoneticED2_ChangedByUser = FALSE;
+ }
+ else
+ {
+ if(pBox->IsInDropDown())
+ {
+ //reset bPhoneticED1_ChangedByUser if a completly new string is selected
+ bPhoneticED1_ChangedByUser = FALSE;
+ }
+ if(!bPhoneticED1_ChangedByUser)
+ aPhoneticED1.SetText(GetDefaultPhoneticReading(pBox->GetText()));
+ }
+ aKey2DCB.Enable(bEnable);
+ aKey2FT.Enable(bEnable);
+ }
+ else if(&aKey2DCB == pBox)
+ {
+ if(!(pBox->GetText().Len()>0))
+ {
+ aPhoneticED2.SetText(aEmptyStr);
+ bPhoneticED2_ChangedByUser = FALSE;
+ }
+ else
+ {
+ if(pBox->IsInDropDown())
+ {
+ //reset bPhoneticED1_ChangedByUser if a completly new string is selected
+ bPhoneticED2_ChangedByUser = FALSE;
+ }
+ if(!bPhoneticED2_ChangedByUser)
+ aPhoneticED2.SetText(GetDefaultPhoneticReading(pBox->GetText()));
+ }
+ }
+ sal_Bool bKey1HasText = (0 != aKeyDCB.GetText().Len());
+ sal_Bool bKey2HasText = (0 != aKey2DCB.GetText().Len());
+
+ aPhoneticFT1.Enable(bKey1HasText&&bIsPhoneticReadingEnabled);
+ aPhoneticED1.Enable(bKey1HasText&bIsPhoneticReadingEnabled);
+ aPhoneticFT2.Enable(bKey2HasText&bIsPhoneticReadingEnabled);
+ aPhoneticED2.Enable(bKey2HasText&bIsPhoneticReadingEnabled);
+
+ return 0;
+}
+
+/*-----------------25.02.94 21:19-------------------
+ dtor ueberladen
+--------------------------------------------------*/
+
+
+SwIndexMarkDlg::~SwIndexMarkDlg()
+{
+ delete pTOXMgr;
+ ViewShell::SetCareWin( 0 );
+}
+/* -----------------07.09.99 08:41-------------------
+
+ --------------------------------------------------*/
+void SwIndexMarkDlg::ReInitDlg(SwWrtShell& rWrtShell, SwTOXMark* pCurTOXMark)
+{
+ pSh = &rWrtShell;
+ delete pTOXMgr;
+ pTOXMgr = new SwTOXMgr(pSh);
+ if(pCurTOXMark)
+ {
+ for(USHORT i = 0; i < pTOXMgr->GetTOXMarkCount(); i++)
+ if(pTOXMgr->GetTOXMark(i) == pCurTOXMark)
+ {
+ pTOXMgr->SetCurTOXMark(i);
+ break;
+ }
+ }
+ InitControls();
+}
+/* -----------------06.10.99 10:00-------------------
+
+ --------------------------------------------------*/
+SwIndexMarkFloatDlg::SwIndexMarkFloatDlg(SfxBindings* _pBindings,
+ SfxChildWindow* pChild,
+ Window *pParent,
+ SfxChildWinInfo* pInfo,
+ sal_Bool bNew) :
+SfxModelessDialog(_pBindings, pChild, pParent, SvtCJKOptions().IsCJKFontEnabled()?SW_RES(DLG_INSIDXMARK_CJK):SW_RES(DLG_INSIDXMARK)),
+ aDlg(this, bNew, SW_RES(WIN_DLG), SvtCJKOptions().IsCJKFontEnabled()?DLG_INSIDXMARK_CJK:DLG_INSIDXMARK, *::GetActiveWrtShell())
+{
+ FreeResource();
+ aDlg.ReInitDlg(*::GetActiveWrtShell());
+ Initialize(pInfo);
+}
+/* -----------------06.10.99 10:27-------------------
+
+ --------------------------------------------------*/
+void SwIndexMarkFloatDlg::Activate()
+{
+ SfxModelessDialog::Activate();
+ aDlg.Activate();
+}
+
+void SwIndexMarkFloatDlg::ReInitDlg(SwWrtShell& rWrtShell)
+{
+ aDlg.ReInitDlg( rWrtShell );
+}
+
+/* -----------------06.10.99 10:35-------------------
+
+ --------------------------------------------------*/
+SwIndexMarkModalDlg::SwIndexMarkModalDlg(Window *pParent, SwWrtShell& rSh, SwTOXMark* pCurTOXMark) :
+SvxStandardDialog(pParent, SvtCJKOptions().IsCJKFontEnabled()?SW_RES(DLG_EDIT_IDXMARK_CJK):SW_RES(DLG_EDIT_IDXMARK)),
+ aDlg(this, sal_False, SW_RES(WIN_DLG), SvtCJKOptions().IsCJKFontEnabled()?DLG_EDIT_IDXMARK_CJK:DLG_EDIT_IDXMARK, rSh)
+{
+ FreeResource();
+ aDlg.ReInitDlg(rSh, pCurTOXMark);
+}
+/* -----------------06.10.99 10:46-------------------
+
+ --------------------------------------------------*/
+void SwIndexMarkModalDlg::Apply()
+{
+ aDlg.Apply();
+}
+/* -----------------16.09.99 14:19-------------------
+
+ --------------------------------------------------*/
+class SwCreateAuthEntryDlg_Impl : public ModalDialog
+{
+ FixedLine aEntriesFL;
+
+ FixedText* pFixedTexts[AUTH_FIELD_END];
+ ListBox* pTypeListBox;
+ ComboBox* pIdentifierBox;
+ Edit* pEdits[AUTH_FIELD_END];
+
+ OKButton aOKBT;
+ CancelButton aCancelBT;
+ HelpButton aHelpBT;
+
+ Link aShortNameCheckLink;
+
+ SwWrtShell& rWrtSh;
+
+ sal_Bool m_bNewEntryMode;
+ sal_Bool m_bNameAllowed;
+
+ DECL_LINK(IdentifierHdl, ComboBox*);
+ DECL_LINK(ShortNameHdl, Edit*);
+ DECL_LINK(EnableHdl, ListBox* pBox);
+
+public:
+ SwCreateAuthEntryDlg_Impl(Window* pParent,
+ const String pFields[],
+ SwWrtShell& rSh,
+ sal_Bool bNewEntry,
+ sal_Bool bCreate);
+ ~SwCreateAuthEntryDlg_Impl();
+
+ String GetEntryText(ToxAuthorityField eField) const;
+
+ void SetCheckNameHdl(const Link& rLink) {aShortNameCheckLink = rLink;}
+
+};
+/*-- 15.09.99 08:43:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+struct TextInfo
+{
+ sal_uInt16 nToxField;
+ const char* pHelpId;
+};
+
+static const TextInfo aTextInfoArr[] =
+{
+ {AUTH_FIELD_IDENTIFIER, HID_AUTH_FIELD_IDENTIFIER },
+ {AUTH_FIELD_AUTHORITY_TYPE, HID_AUTH_FIELD_AUTHORITY_TYPE },
+ {AUTH_FIELD_AUTHOR, HID_AUTH_FIELD_AUTHOR },
+ {AUTH_FIELD_TITLE, HID_AUTH_FIELD_TITLE },
+ {AUTH_FIELD_YEAR, HID_AUTH_FIELD_YEAR },
+ {AUTH_FIELD_PUBLISHER, HID_AUTH_FIELD_PUBLISHER },
+ {AUTH_FIELD_ADDRESS, HID_AUTH_FIELD_ADDRESS },
+ {AUTH_FIELD_ISBN, HID_AUTH_FIELD_ISBN },
+ {AUTH_FIELD_CHAPTER, HID_AUTH_FIELD_CHAPTER },
+ {AUTH_FIELD_PAGES, HID_AUTH_FIELD_PAGES },
+ {AUTH_FIELD_EDITOR, HID_AUTH_FIELD_EDITOR },
+ {AUTH_FIELD_EDITION, HID_AUTH_FIELD_EDITION },
+ {AUTH_FIELD_BOOKTITLE, HID_AUTH_FIELD_BOOKTITLE },
+ {AUTH_FIELD_VOLUME, HID_AUTH_FIELD_VOLUME },
+ {AUTH_FIELD_HOWPUBLISHED, HID_AUTH_FIELD_HOWPUBLISHED },
+ {AUTH_FIELD_ORGANIZATIONS, HID_AUTH_FIELD_ORGANIZATIONS },
+ {AUTH_FIELD_INSTITUTION, HID_AUTH_FIELD_INSTITUTION },
+ {AUTH_FIELD_SCHOOL, HID_AUTH_FIELD_SCHOOL },
+ {AUTH_FIELD_REPORT_TYPE, HID_AUTH_FIELD_REPORT_TYPE },
+ {AUTH_FIELD_MONTH, HID_AUTH_FIELD_MONTH },
+ {AUTH_FIELD_JOURNAL, HID_AUTH_FIELD_JOURNAL },
+ {AUTH_FIELD_NUMBER, HID_AUTH_FIELD_NUMBER },
+ {AUTH_FIELD_SERIES, HID_AUTH_FIELD_SERIES },
+ {AUTH_FIELD_ANNOTE, HID_AUTH_FIELD_ANNOTE },
+ {AUTH_FIELD_NOTE, HID_AUTH_FIELD_NOTE },
+ {AUTH_FIELD_URL, HID_AUTH_FIELD_URL },
+ {AUTH_FIELD_CUSTOM1, HID_AUTH_FIELD_CUSTOM1 },
+ {AUTH_FIELD_CUSTOM2, HID_AUTH_FIELD_CUSTOM2 },
+ {AUTH_FIELD_CUSTOM3, HID_AUTH_FIELD_CUSTOM3 },
+ {AUTH_FIELD_CUSTOM4, HID_AUTH_FIELD_CUSTOM4 },
+ {AUTH_FIELD_CUSTOM5, HID_AUTH_FIELD_CUSTOM5 }
+};
+
+sal_Bool SwAuthMarkDlg::bIsFromComponent = sal_True;
+
+SwAuthMarkDlg::SwAuthMarkDlg( Window *pParent,
+ const ResId& rResId,
+ sal_Bool bNewDlg) :
+ Window(pParent, rResId),
+ aFromComponentRB( this, ResId(RB_FROMCOMPONENT, *rResId.GetResMgr() )),
+ aFromDocContentRB( this, ResId(RB_FROMDOCCONTENT, *rResId.GetResMgr() )),
+
+ aAuthorFT( this, ResId(FT_AUTHOR, *rResId.GetResMgr() )),
+ aAuthorFI( this, ResId(FI_AUTHOR, *rResId.GetResMgr() )),
+ aTitleFT( this, ResId(FT_TITLE, *rResId.GetResMgr() )),
+ aTitleFI( this, ResId(FI_TITLE, *rResId.GetResMgr() )),
+ aEntryFT( this, ResId(FT_ENTRY, *rResId.GetResMgr() )),
+ aEntryED( this, ResId(ED_ENTRY, *rResId.GetResMgr() )),
+ aEntryLB( this, ResId(LB_ENTRY, *rResId.GetResMgr() )),
+
+ aEntryFL( this, ResId(FL_ENTRY, *rResId.GetResMgr() )),
+
+ aOKBT( this, ResId(PB_OK, *rResId.GetResMgr() )),
+ aCancelBT( this, ResId(PB_CANCEL, *rResId.GetResMgr() )),
+ aHelpBT( this, ResId(PB_HELP, *rResId.GetResMgr() )),
+ aCreateEntryPB(this,ResId(PB_CREATEENTRY, *rResId.GetResMgr())),
+ aEditEntryPB(this, ResId(PB_EDITENTRY, *rResId.GetResMgr())),
+
+ sChangeST( ResId(ST_CHANGE, *rResId.GetResMgr())),
+ bNewEntry(bNewDlg),
+ bBibAccessInitialized(sal_False),
+
+ pSh(0)
+{
+ SetStyle(GetStyle()|WB_DIALOGCONTROL);
+ FreeResource();
+
+ aFromComponentRB.SetHelpId(HID_AUTH_MARK_DLG_FROM_COMP_RB);
+ aFromDocContentRB.SetHelpId(HID_AUTH_MARK_DLG_FROM_DOC_RB );
+ aEntryED.SetHelpId(HID_AUTH_MARK_DLG_ID_LISTBOX );
+ aEntryLB.SetHelpId(HID_AUTH_MARK_DLG_ID_LISTBOX );
+
+ aFromComponentRB.Show(bNewEntry);
+ aFromDocContentRB.Show(bNewEntry);
+ aFromComponentRB.Check(bIsFromComponent);
+ aFromDocContentRB.Check(!bIsFromComponent);
+
+ aOKBT .SetHelpId(HID_INSERT_AUTH_MRK_OK );
+ aCancelBT .SetHelpId(HID_INSERT_AUTH_MRK_CLOSE);
+ aEntryED .SetHelpId(HID_INSERT_AUTH_MRK_ENTRY );
+ aCreateEntryPB .SetHelpId(HID_INSERT_AUTH_MRK_CREATE_ENTRY );
+ aEditEntryPB .SetHelpId(HID_INSERT_AUTH_MRK_EDIT_ENTRY );
+
+ aOKBT.SetClickHdl(LINK(this,SwAuthMarkDlg, InsertHdl));
+ aCancelBT.SetClickHdl(LINK(this,SwAuthMarkDlg, CloseHdl));
+ aCreateEntryPB.SetClickHdl(LINK(this,SwAuthMarkDlg, CreateEntryHdl));
+ aEditEntryPB.SetClickHdl(LINK(this,SwAuthMarkDlg, CreateEntryHdl));
+ aFromComponentRB.SetClickHdl(LINK(this,SwAuthMarkDlg, ChangeSourceHdl));
+ aFromDocContentRB.SetClickHdl(LINK(this,SwAuthMarkDlg, ChangeSourceHdl));
+ aEntryED.SetModifyHdl(LINK(this,SwAuthMarkDlg, EditModifyHdl));
+
+ GetParent()->SetText(String(SW_RES(
+ bNewEntry ? STR_AUTHMRK_INSERT : STR_AUTHMRK_EDIT)));
+ aEntryED.Show(!bNewEntry);
+ aEntryLB.Show(bNewEntry);
+ if(!bNewEntry)
+ {
+ aOKBT.SetText(sChangeST);
+ }
+ else
+ {
+ aEntryLB.SetSelectHdl(LINK(this, SwAuthMarkDlg, CompEntryHdl));
+ }
+}
+/*-- 15.09.99 08:43:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwAuthMarkDlg::~SwAuthMarkDlg()
+{
+}
+/*-- 15.09.99 08:43:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwAuthMarkDlg::ReInitDlg(SwWrtShell& rWrtShell)
+{
+ pSh = &rWrtShell;
+ InitControls();
+}
+/* -----------------15.09.99 08:57-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK( SwAuthMarkDlg, CloseHdl, PushButton *, EMPTYARG )
+{
+ if(bNewEntry)
+ {
+ sal_uInt16 nSlot = FN_INSERT_AUTH_ENTRY_DLG;
+ SfxViewFrame::Current()->GetDispatcher()->Execute(nSlot,
+ SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD);
+ }
+ else
+ {
+ ((SwAuthMarkModalDlg*)GetParent())->EndDialog(RET_CANCEL);
+ }
+ return 0;
+}
+/* -----------------06.12.99 13:54-------------------
+
+ --------------------------------------------------*/
+static String lcl_FindColumnEntry(const beans::PropertyValue* pFields, sal_Int32 nLen, const String& rColumnTitle)
+{
+ String sRet;
+ OUString uColumnTitle = rColumnTitle;
+ for(sal_uInt16 i = 0; i < nLen; i++)
+ {
+ OUString uTmp;
+ if(pFields[i].Name == uColumnTitle &&
+ (pFields[i].Value >>= uTmp))
+ {
+ sRet = String(uTmp);
+ break;
+ }
+ }
+ return sRet;
+}
+/* -----------------------------07.12.99 15:39--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SwAuthMarkDlg, CompEntryHdl, ListBox*, pBox)
+{
+ String sEntry(pBox->GetSelectEntry());
+ if(bIsFromComponent)
+ {
+ if(xBibAccess.is() && sEntry.Len())
+ {
+ OUString uEntry(sEntry);
+ if(xBibAccess->hasByName(uEntry))
+ {
+ uno::Any aEntry(xBibAccess->getByName(uEntry));
+ uno::Sequence<beans::PropertyValue> aFieldProps;
+ if(aEntry >>= aFieldProps)
+ {
+ const beans::PropertyValue* pProps = aFieldProps.getConstArray();
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END && i < aFieldProps.getLength(); i++)
+ {
+ m_sFields[i] = lcl_FindColumnEntry(
+ pProps, aFieldProps.getLength(), m_sColumnTitles[i]);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ if(sEntry.Len())
+ {
+ const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
+ pSh->GetFldType(RES_AUTHORITY, aEmptyStr);
+ const SwAuthEntry* pEntry = pFType ? pFType->GetEntryByIdentifier(sEntry) : 0;
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+ m_sFields[i] = pEntry ?
+ pEntry->GetAuthorField((ToxAuthorityField)i) : aEmptyStr;
+ }
+ }
+ if(!pBox->GetSelectEntry().Len())
+ {
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+ m_sFields[i] = aEmptyStr;
+ }
+ aAuthorFI.SetText(m_sFields[AUTH_FIELD_AUTHOR]);
+ aTitleFI.SetText(m_sFields[AUTH_FIELD_TITLE]);
+ return 0;
+}
+
+/* -----------------15.09.99 08:57-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK( SwAuthMarkDlg, InsertHdl, PushButton *, EMPTYARG )
+{
+ //insert or update the SwAuthorityField...
+ if(pSh)
+ {
+ sal_Bool bDifferent = sal_False;
+ DBG_ASSERT(m_sFields[AUTH_FIELD_IDENTIFIER].Len() , "No Id is set!");
+ DBG_ASSERT(m_sFields[AUTH_FIELD_AUTHORITY_TYPE].Len() , "No authority type is set!");
+ //check if the entry already exists with different content
+ const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
+ pSh->GetFldType(RES_AUTHORITY, aEmptyStr);
+ const SwAuthEntry* pEntry = pFType ?
+ pFType->GetEntryByIdentifier( m_sFields[AUTH_FIELD_IDENTIFIER])
+ : 0;
+ if(pEntry)
+ {
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END && !bDifferent; i++)
+ bDifferent |= m_sFields[i] != pEntry->GetAuthorField((ToxAuthorityField)i);
+ if(bDifferent)
+ {
+ QueryBox aQuery(this, SW_RES(DLG_CHANGE_AUTH_ENTRY));
+ if(RET_YES != aQuery.Execute())
+ return 0;
+ }
+ }
+
+ SwFldMgr aMgr(pSh);
+ String sFields;
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+ {
+ sFields += m_sFields[i];
+ sFields += TOX_STYLE_DELIMITER;
+ }
+ if(bNewEntry)
+ {
+ if(bDifferent)
+ {
+ SwAuthEntry aNewData;
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+ aNewData.SetAuthorField((ToxAuthorityField)i, m_sFields[i]);
+ pSh->ChangeAuthorityData(&aNewData);
+ }
+ SwInsertFld_Data aData(TYP_AUTHORITY, 0, sFields, aEmptyStr, 0 );
+ aMgr.InsertFld( aData );
+ }
+ else if(aMgr.GetCurFld())
+ {
+ aMgr.UpdateCurFld(0, sFields, aEmptyStr);
+ }
+ }
+ if(!bNewEntry)
+ CloseHdl(0);
+ return 0;
+}
+/* -----------------17.09.99 13:06-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwAuthMarkDlg, CreateEntryHdl, PushButton*, pButton)
+{
+ sal_Bool bCreate = pButton == &aCreateEntryPB;
+ String sOldId = m_sCreatedEntry[0];
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+ m_sCreatedEntry[i] = bCreate ? aEmptyStr : m_sFields[i];
+ SwCreateAuthEntryDlg_Impl aDlg(pButton,
+ bCreate ? m_sCreatedEntry : m_sFields,
+ *pSh, bNewEntry, bCreate);
+ if(bNewEntry)
+ {
+ aDlg.SetCheckNameHdl(LINK(this, SwAuthMarkDlg, IsEntryAllowedHdl));
+ }
+ if(RET_OK == aDlg.Execute())
+ {
+ if(bCreate && sOldId.Len())
+ {
+ aEntryLB.RemoveEntry(sOldId);
+ }
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+ {
+ m_sFields[i] = aDlg.GetEntryText((ToxAuthorityField)i);
+ m_sCreatedEntry[i] = m_sFields[i];
+ }
+ if(bNewEntry && !aFromDocContentRB.IsChecked())
+ {
+ aFromDocContentRB.Check(sal_True);
+ ChangeSourceHdl(&aFromDocContentRB);
+ }
+ if(bCreate)
+ {
+ DBG_ASSERT(LISTBOX_ENTRY_NOTFOUND ==
+ aEntryLB.GetEntryPos(m_sFields[AUTH_FIELD_IDENTIFIER]),
+ "entry exists!");
+ aEntryLB.InsertEntry(m_sFields[AUTH_FIELD_IDENTIFIER]);
+ aEntryLB.SelectEntry(m_sFields[AUTH_FIELD_IDENTIFIER]);
+ }
+ aEntryED.SetText(m_sFields[AUTH_FIELD_IDENTIFIER]);
+ aAuthorFI.SetText(m_sFields[AUTH_FIELD_AUTHOR]);
+ aTitleFI.SetText(m_sFields[AUTH_FIELD_TITLE]);
+ aOKBT.Enable();
+ }
+ return 0;
+}
+/* -----------------------------20.12.99 14:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwAuthMarkDlg, ChangeSourceHdl, RadioButton*, pButton)
+{
+ sal_Bool bFromComp = (pButton == &aFromComponentRB);
+ bIsFromComponent = bFromComp;
+ aCreateEntryPB.Enable(!bIsFromComponent);
+ aEntryLB.Clear();
+ if(bIsFromComponent)
+ {
+ if(!bBibAccessInitialized)
+ {
+ uno::Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory();
+ xBibAccess = uno::Reference< container::XNameAccess > (
+ xMSF->createInstance( C2U("com.sun.star.frame.Bibliography") ),
+ uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xPropSet(xBibAccess, uno::UNO_QUERY);
+ OUString uPropName(C2U("BibliographyDataFieldNames"));
+ if(xPropSet.is() && xPropSet->getPropertySetInfo()->hasPropertyByName(uPropName))
+ {
+ uno::Any aNames = xPropSet->getPropertyValue(uPropName);
+ uno::Sequence<beans::PropertyValue> aSeq;
+ if( aNames >>= aSeq)
+ {
+ const beans::PropertyValue* pArr = aSeq.getConstArray();
+ for(sal_uInt16 i = 0; i < aSeq.getLength(); i++)
+ {
+ String sTitle = pArr[i].Name;
+ sal_Int16 nField = 0;
+ pArr[i].Value >>= nField;
+ if(nField >= 0 && nField < AUTH_FIELD_END)
+ m_sColumnTitles[nField] = sTitle;
+ }
+ }
+ }
+ bBibAccessInitialized = sal_True;
+ }
+ if(xBibAccess.is())
+ {
+ uno::Sequence<OUString> aIdentifiers = xBibAccess->getElementNames();
+ const OUString* pNames = aIdentifiers.getConstArray();
+ for(sal_uInt16 i = 0; i < aIdentifiers.getLength(); i++)
+ {
+ aEntryLB.InsertEntry(pNames[i]);
+ }
+ }
+ }
+ else
+ {
+ const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
+ pSh->GetFldType(RES_AUTHORITY, aEmptyStr);
+ if(pFType)
+ {
+ SvStringsDtor aIds;
+ pFType->GetAllEntryIdentifiers( aIds );
+ for(sal_uInt16 n = 0; n < aIds.Count(); n++)
+ aEntryLB.InsertEntry(*aIds.GetObject(n));
+ }
+ if(m_sCreatedEntry[AUTH_FIELD_IDENTIFIER].Len())
+ aEntryLB.InsertEntry(m_sCreatedEntry[AUTH_FIELD_IDENTIFIER]);
+ }
+ aEntryLB.SelectEntryPos(0);
+ CompEntryHdl(&aEntryLB);
+ return 0;
+}
+/* -----------------15.10.2002 13:16-----------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK(SwAuthMarkDlg, EditModifyHdl, Edit*, pEdit)
+{
+ Link aAllowed = LINK(this, SwAuthMarkDlg, IsEntryAllowedHdl);
+ long nResult = aAllowed.Call(pEdit);
+ aOKBT.Enable(nResult > 0);
+ if(nResult)
+ {
+ String sEntry(pEdit->GetText());
+ m_sFields[AUTH_FIELD_IDENTIFIER] = sEntry;
+ m_sCreatedEntry[AUTH_FIELD_IDENTIFIER] = sEntry;
+ }
+ return 0;
+};
+/* -----------------------------20.12.99 15:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwAuthMarkDlg, IsEntryAllowedHdl, Edit*, pEdit)
+{
+ String sEntry = pEdit->GetText();
+ sal_Bool bAllowed = sal_False;
+ if(sEntry.Len())
+ {
+ if(aEntryLB.GetEntryPos(sEntry) != LISTBOX_ENTRY_NOTFOUND)
+ return 0;
+ else if(bIsFromComponent)
+ {
+ const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
+ pSh->GetFldType(RES_AUTHORITY, aEmptyStr);
+ bAllowed = !pFType || !pFType->GetEntryByIdentifier(sEntry);
+ }
+ else
+ {
+ bAllowed = !xBibAccess.is() || !xBibAccess->hasByName(sEntry);
+ }
+ }
+ return bAllowed;
+}
+/* -----------------21.09.99 14:19-------------------
+
+ --------------------------------------------------*/
+void SwAuthMarkDlg::InitControls()
+{
+ DBG_ASSERT(pSh, "Shell nicht da?");
+ SwField* pField = pSh->GetCurFld();
+ ASSERT(bNewEntry || pField, "Keine aktuelle Markierung");
+ if(bNewEntry)
+ {
+ ChangeSourceHdl(aFromComponentRB.IsChecked() ? &aFromComponentRB : &aFromDocContentRB);
+ aCreateEntryPB.Enable(!aFromComponentRB.IsChecked());
+ if(!aFromComponentRB.IsChecked() && m_sCreatedEntry[0].Len())
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+ m_sFields[i] = m_sCreatedEntry[i];
+ }
+ if(bNewEntry || !pField || pField->GetTyp()->Which() != RES_AUTHORITY)
+ return;
+
+ const SwAuthEntry* pEntry = ((SwAuthorityFieldType*)pField->GetTyp())->
+ GetEntryByHandle(((SwAuthorityField*)pField)->GetHandle());
+
+ DBG_ASSERT(pEntry, "No authority entry found");
+ if(!pEntry)
+ return;
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+ m_sFields[i] = pEntry->GetAuthorField((ToxAuthorityField)i);
+
+ aEntryED.SetText(pEntry->GetAuthorField(AUTH_FIELD_IDENTIFIER));
+ aAuthorFI.SetText(pEntry->GetAuthorField(AUTH_FIELD_AUTHOR));
+ aTitleFI.SetText(pEntry->GetAuthorField(AUTH_FIELD_TITLE));
+}
+/* -----------------------------05.09.2002 09:44------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwAuthMarkDlg::Activate()
+{
+ aOKBT.Enable(!pSh->HasReadonlySel());
+ Window::Activate();
+}
+/* -----------------16.09.99 14:27-------------------
+
+ --------------------------------------------------*/
+SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(Window* pParent,
+ const String pFields[],
+ SwWrtShell& rSh,
+ sal_Bool bNewEntry,
+ sal_Bool bCreate) :
+ ModalDialog(pParent, SW_RES(DLG_CREATE_AUTH_ENTRY)),
+ aEntriesFL(this, SW_RES(FL_ENTRIES )),
+ pTypeListBox(0),
+ pIdentifierBox(0),
+ aOKBT(this, SW_RES(PB_OK )),
+ aCancelBT(this, SW_RES(PB_CANCEL )),
+ aHelpBT(this, SW_RES(PB_HELP )),
+ rWrtSh(rSh),
+ m_bNewEntryMode(bNewEntry),
+ m_bNameAllowed(sal_True)
+{
+ FreeResource();
+ Point aFLPos(aEntriesFL.GetPosPixel());
+ Point aTL1(aFLPos);
+ Size aFLSz(aEntriesFL.GetSizePixel().Width(), GetSizePixel().Height());
+ long nControlSpace = aFLSz.Width() / 4;
+ long nControlWidth = nControlSpace - 2 * aTL1.X();
+ aTL1.X() *= 2;
+ aTL1.Y() *= 5;
+ Point aTR1(aTL1);
+ aTR1.X() += nControlSpace;
+ Point aTL2(aTR1);
+ aTL2.X() += nControlSpace;
+ Point aTR2(aTL2);
+ aTR2.X() += nControlSpace;
+ Size aFixedTextSize(aFLSz);
+ Size aTmpSz(8,10);
+ aTmpSz = LogicToPixel(aTmpSz, MAP_APPFONT);
+ aFixedTextSize.Height() = aTmpSz.Width();
+ Size aEditSize(aFixedTextSize);
+ aFixedTextSize.Width() = nControlWidth + aFLPos.X();
+ aEditSize.Height() = aTmpSz.Height();
+ aEditSize.Width() = nControlWidth;
+
+ sal_uInt16 nOffset = static_cast< sal_uInt16 >(aTmpSz.Width() * 3 / 2);
+ sal_Bool bLeft = sal_True;
+ Window* pRefWindow = 0;
+ for(sal_uInt16 nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
+ {
+ const TextInfo aCurInfo = aTextInfoArr[nIndex];
+
+ pFixedTexts[nIndex] = new FixedText(this);
+ if(nIndex)
+ pFixedTexts[nIndex]->SetZOrder( pRefWindow, WINDOW_ZORDER_BEHIND );
+ else
+ pFixedTexts[nIndex]->SetZOrder( 0, WINDOW_ZORDER_FIRST );
+
+ pRefWindow = pFixedTexts[nIndex];
+
+ pFixedTexts[nIndex]->SetSizePixel(aFixedTextSize);
+ pFixedTexts[nIndex]->SetPosPixel(bLeft ? aTL1 : aTL2);
+ pFixedTexts[nIndex]->SetText(SW_RES(STR_AUTH_FIELD_START + aCurInfo.nToxField));
+ pFixedTexts[nIndex]->Show();
+ pEdits[nIndex] = 0;
+ if( AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField )
+ {
+ pTypeListBox = new ListBox(this, WB_DROPDOWN|WB_BORDER);
+ pTypeListBox->SetZOrder( pRefWindow, WINDOW_ZORDER_BEHIND );
+ pRefWindow = pTypeListBox;
+ for(sal_uInt16 j = 0; j < AUTH_TYPE_END; j++)
+ pTypeListBox->InsertEntry(String(SW_RES(STR_AUTH_TYPE_START + j)));
+ if(pFields[aCurInfo.nToxField].Len())
+ {
+ sal_uInt16 nIndexPos = static_cast< sal_uInt16 >(pFields[aCurInfo.nToxField].ToInt32());
+ pTypeListBox->SelectEntryPos(nIndexPos);
+ }
+ Size aTmp(aEditSize);
+ aTmp.Height() *= 4;
+ pTypeListBox->SetSizePixel(aTmp);
+ pTypeListBox->SetPosPixel(bLeft ? aTR1 : aTR2);
+ pTypeListBox->Show();
+ pTypeListBox->SetSelectHdl(LINK(this, SwCreateAuthEntryDlg_Impl, EnableHdl));
+ pTypeListBox->SetHelpId(aCurInfo.pHelpId);
+
+ }
+ else if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField && !m_bNewEntryMode)
+ {
+ pIdentifierBox = new ComboBox(this, WB_BORDER|WB_DROPDOWN);
+ pIdentifierBox->SetZOrder( pRefWindow, WINDOW_ZORDER_BEHIND );
+ pRefWindow = pIdentifierBox;
+
+ pIdentifierBox->SetSelectHdl(LINK(this,
+ SwCreateAuthEntryDlg_Impl, IdentifierHdl));
+
+
+ const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
+ rSh.GetFldType(RES_AUTHORITY, aEmptyStr);
+ if(pFType)
+ {
+ SvStringsDtor aIds;
+ pFType->GetAllEntryIdentifiers( aIds );
+ for(sal_uInt16 n = 0; n < aIds.Count(); n++)
+ pIdentifierBox->InsertEntry(*aIds.GetObject(n));
+ }
+ pIdentifierBox->SetText(pFields[aCurInfo.nToxField]);
+ Size aTmp(aEditSize);
+ aTmp.Height() *= 4;
+ pIdentifierBox->SetSizePixel(aTmp);
+ pIdentifierBox->SetPosPixel(bLeft ? aTR1 : aTR2);
+ pIdentifierBox->Show();
+ pIdentifierBox->SetHelpId(aCurInfo.pHelpId);
+ }
+ else
+ {
+ pEdits[nIndex] = new Edit(this, WB_BORDER);
+ pEdits[nIndex]->SetZOrder( pRefWindow, WINDOW_ZORDER_BEHIND );
+ pRefWindow = pEdits[nIndex];
+ pEdits[nIndex]->SetSizePixel(aEditSize);
+ pEdits[nIndex]->SetPosPixel(bLeft ? aTR1 : aTR2);
+ pEdits[nIndex]->SetText(pFields[aCurInfo.nToxField]);
+ pEdits[nIndex]->Show();
+ pEdits[nIndex]->SetHelpId(aCurInfo.pHelpId);
+ if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField)
+ {
+ pEdits[nIndex]->SetModifyHdl(LINK(this, SwCreateAuthEntryDlg_Impl, ShortNameHdl));
+ m_bNameAllowed = pFields[nIndex].Len() > 0;
+ if(!bCreate)
+ {
+ pFixedTexts[nIndex]->Enable(sal_False);
+ pEdits[nIndex]->Enable(sal_False);
+ }
+ }
+ }
+ if(bLeft)
+ {
+ aTL1.Y() += nOffset;
+ aTR1.Y() += nOffset;
+ }
+ else
+ {
+ aTL2.Y() += nOffset;
+ aTR2.Y() += nOffset;
+ }
+ bLeft = !bLeft;
+ }
+ EnableHdl(pTypeListBox);
+
+ long nHeightDiff = - aFLSz.Height();
+ aFLSz.Height() = aTL1.Y();
+ nHeightDiff += aFLSz.Height();
+// aEntriesFL.SetSizePixel(aFLSz);
+ Size aDlgSize(GetSizePixel());
+ aDlgSize.Height() += nHeightDiff;
+ SetSizePixel(aDlgSize);
+
+}
+/* -----------------16.09.99 14:47-------------------
+
+ --------------------------------------------------*/
+SwCreateAuthEntryDlg_Impl::~SwCreateAuthEntryDlg_Impl()
+{
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+ {
+ delete pFixedTexts[i];
+ delete pEdits[i];
+ }
+ delete pTypeListBox;
+ delete pIdentifierBox;
+}
+/* -----------------16.09.99 14:27-------------------
+
+ --------------------------------------------------*/
+String SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) const
+{
+ String sRet;
+ if( AUTH_FIELD_AUTHORITY_TYPE == eField )
+ {
+ DBG_ASSERT(pTypeListBox, "No ListBox");
+ sRet = String::CreateFromInt32(pTypeListBox->GetSelectEntryPos());
+ }
+ else if( AUTH_FIELD_IDENTIFIER == eField && !m_bNewEntryMode)
+ {
+ DBG_ASSERT(pIdentifierBox, "No ComboBox");
+ sRet = pIdentifierBox->GetText();
+ }
+ else
+ {
+ for(sal_uInt16 nIndex = 0; nIndex < AUTH_FIELD_END; nIndex++)
+ {
+ const TextInfo aCurInfo = aTextInfoArr[nIndex];
+ if(aCurInfo.nToxField == eField)
+ {
+ sRet = pEdits[nIndex]->GetText();
+ break;
+ }
+ }
+ }
+ return sRet;
+}
+/* -----------------21.09.99 13:54-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK(SwCreateAuthEntryDlg_Impl, IdentifierHdl, ComboBox*, pBox)
+{
+ const SwAuthorityFieldType* pFType = (const SwAuthorityFieldType*)
+ rWrtSh.GetFldType(RES_AUTHORITY, aEmptyStr);
+ if(pFType)
+ {
+ const SwAuthEntry* pEntry = pFType->GetEntryByIdentifier(
+ pBox->GetText());
+ if(pEntry)
+ {
+ for(sal_uInt16 i = 0; i < AUTH_FIELD_END; i++)
+ {
+ if(AUTH_FIELD_IDENTIFIER == i)
+ continue;
+ if(AUTH_FIELD_AUTHORITY_TYPE == i)
+ pTypeListBox->SelectEntry(
+ pEntry->GetAuthorField((ToxAuthorityField)i));
+ else
+ pEdits[i]->SetText(
+ pEntry->GetAuthorField((ToxAuthorityField)i));
+ }
+ }
+ }
+ return 0;
+}
+/* -----------------------------20.12.99 15:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+IMPL_LINK(SwCreateAuthEntryDlg_Impl, ShortNameHdl, Edit*, pEdit)
+{
+ if(aShortNameCheckLink.IsSet())
+ {
+ sal_Bool bEnable = 0 != aShortNameCheckLink.Call(pEdit);
+ m_bNameAllowed |= bEnable;
+ aOKBT.Enable(pTypeListBox->GetSelectEntryCount() && bEnable);
+ }
+ return 0;
+}
+/* -----------------------------20.12.99 15:54--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwCreateAuthEntryDlg_Impl, EnableHdl, ListBox*, pBox)
+{
+ aOKBT.Enable(m_bNameAllowed && pBox->GetSelectEntryCount());
+ return 0;
+};
+/* -----------------06.10.99 10:00-------------------
+
+ --------------------------------------------------*/
+SwAuthMarkFloatDlg::SwAuthMarkFloatDlg(SfxBindings* _pBindings,
+ SfxChildWindow* pChild,
+ Window *pParent,
+ SfxChildWinInfo* pInfo,
+ sal_Bool bNew) :
+ SfxModelessDialog(_pBindings, pChild, pParent, SW_RES(DLG_INSAUTHMARK)),
+ aDlg(this, SW_RES(WIN_DLG), bNew)
+{
+ FreeResource();
+ Initialize(pInfo);
+ SwWrtShell* pWrtShell = ::GetActiveWrtShell();
+ DBG_ASSERT(pWrtShell, "No shell?");
+ aDlg.ReInitDlg(*pWrtShell);
+}
+/* -----------------06.10.99 10:27-------------------
+
+ --------------------------------------------------*/
+void SwAuthMarkFloatDlg::Activate()
+{
+ SfxModelessDialog::Activate();
+ aDlg.Activate();
+}
+
+void SwAuthMarkFloatDlg::ReInitDlg(SwWrtShell& rWrtShell)
+{
+ aDlg.ReInitDlg( rWrtShell );
+}
+
+/* -----------------06.10.99 10:35-------------------
+
+ --------------------------------------------------*/
+SwAuthMarkModalDlg::SwAuthMarkModalDlg(Window *pParent, SwWrtShell& rSh) :
+ SvxStandardDialog(pParent, SW_RES(DLG_EDIT_AUTHMARK)),
+ aDlg(this, SW_RES(WIN_DLG), sal_False)
+{
+ FreeResource();
+ aDlg.ReInitDlg(rSh);
+}
+/* -----------------06.10.99 10:46-------------------
+
+ --------------------------------------------------*/
+void SwAuthMarkModalDlg::Apply()
+{
+ aDlg.InsertHdl(0);
+}
+
diff --git a/sw/source/ui/index/toxmgr.cxx b/sw/source/ui/index/toxmgr.cxx
new file mode 100644
index 000000000000..e23073053e54
--- /dev/null
+++ b/sw/source/ui/index/toxmgr.cxx
@@ -0,0 +1,529 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <wrtsh.hxx>
+#include <shellres.hxx>
+#include <swwait.hxx>
+#include <view.hxx>
+#include <toxmgr.hxx>
+#include <crsskip.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <swundo.hxx>
+#include <globals.hrc>
+
+/*--------------------------------------------------------------------
+ Beschreibung: Handhabung der Verzeichnisse durch TOXMgr
+ --------------------------------------------------------------------*/
+
+
+SwTOXMgr::SwTOXMgr(SwWrtShell* pShell):
+ pSh(pShell)
+{
+ GetTOXMarks();
+ SetCurTOXMark(0);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Aktuelle TOXMarks behandeln
+ --------------------------------------------------------------------*/
+
+
+USHORT SwTOXMgr::GetTOXMarks()
+{
+ return pSh->GetCurTOXMarks(aCurMarks);
+}
+
+
+SwTOXMark* SwTOXMgr::GetTOXMark(USHORT nId)
+{
+ if(aCurMarks.Count() > 0)
+ return aCurMarks[nId];
+ return 0;
+}
+
+
+void SwTOXMgr::DeleteTOXMark()
+{
+ SwTOXMark* pNext = 0;
+ if( pCurTOXMark )
+ {
+ pNext = (SwTOXMark*)&pSh->GotoTOXMark( *pCurTOXMark, TOX_NXT );
+ if( pNext == pCurTOXMark )
+ pNext = 0;
+
+ pSh->DeleteTOXMark( pCurTOXMark );
+ pSh->SetModified();
+ }
+ // zur naechsten wandern
+ pCurTOXMark = pNext;
+}
+/* -----------------20.08.99 10:48-------------------
+
+ --------------------------------------------------*/
+void SwTOXMgr::InsertTOXMark(const SwTOXMarkDescription& rDesc)
+{
+ SwTOXMark* pMark = 0;
+ switch(rDesc.GetTOXType())
+ {
+ case TOX_CONTENT:
+ {
+ ASSERT(rDesc.GetLevel() > 0 && rDesc.GetLevel() <= MAXLEVEL,
+ ungueltiger Level InsertTOCMark);
+ pMark = new SwTOXMark(pSh->GetTOXType(TOX_CONTENT, 0));
+ pMark->SetLevel( static_cast< USHORT >(rDesc.GetLevel()) );
+
+ if(rDesc.GetAltStr())
+ pMark->SetAlternativeText(*rDesc.GetAltStr());
+ }
+ break;
+ case TOX_INDEX:
+ {
+ pMark = new SwTOXMark(pSh->GetTOXType(TOX_INDEX, 0));
+
+ if( rDesc.GetPrimKey() && rDesc.GetPrimKey()->Len() )
+ {
+ pMark->SetPrimaryKey( *rDesc.GetPrimKey() );
+ if(rDesc.GetPhoneticReadingOfPrimKey())
+ pMark->SetPrimaryKeyReading( *rDesc.GetPhoneticReadingOfPrimKey() );
+
+ if( rDesc.GetSecKey() && rDesc.GetSecKey()->Len() )
+ {
+ pMark->SetSecondaryKey( *rDesc.GetSecKey() );
+ if(rDesc.GetPhoneticReadingOfSecKey())
+ pMark->SetSecondaryKeyReading( *rDesc.GetPhoneticReadingOfSecKey() );
+ }
+ }
+ if(rDesc.GetAltStr())
+ pMark->SetAlternativeText(*rDesc.GetAltStr());
+ if(rDesc.GetPhoneticReadingOfAltStr())
+ pMark->SetTextReading( *rDesc.GetPhoneticReadingOfAltStr() );
+ pMark->SetMainEntry(rDesc.IsMainEntry());
+ }
+ break;
+ case TOX_USER:
+ {
+ ASSERT(rDesc.GetLevel() > 0 && rDesc.GetLevel() <= MAXLEVEL,
+ ungueltiger Level InsertTOCMark);
+ USHORT nId = rDesc.GetTOUName() ?
+ GetUserTypeID(*rDesc.GetTOUName()) : 0;
+ pMark = new SwTOXMark(pSh->GetTOXType(TOX_USER, nId));
+ pMark->SetLevel( static_cast< USHORT >(rDesc.GetLevel()) );
+
+ if(rDesc.GetAltStr())
+ pMark->SetAlternativeText(*rDesc.GetAltStr());
+ }
+ break;
+ default:; //prevent warning
+ }
+ pSh->StartAllAction();
+ pSh->SwEditShell::Insert(*pMark);
+ pSh->EndAllAction();
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Update eines TOXMarks
+ --------------------------------------------------------------------*/
+
+
+void SwTOXMgr::UpdateTOXMark(const SwTOXMarkDescription& rDesc)
+{
+ ASSERT(pCurTOXMark, "kein aktuelles TOXMark");
+
+ pSh->StartAllAction();
+ if(pCurTOXMark->GetTOXType()->GetType() == TOX_INDEX)
+ {
+ if(rDesc.GetPrimKey() && rDesc.GetPrimKey()->Len() )
+ {
+ pCurTOXMark->SetPrimaryKey( *rDesc.GetPrimKey() );
+ if(rDesc.GetPhoneticReadingOfPrimKey())
+ pCurTOXMark->SetPrimaryKeyReading( *rDesc.GetPhoneticReadingOfPrimKey() );
+ else
+ pCurTOXMark->SetPrimaryKeyReading( aEmptyStr );
+
+ if( rDesc.GetSecKey() && rDesc.GetSecKey()->Len() )
+ {
+ pCurTOXMark->SetSecondaryKey( *rDesc.GetSecKey() );
+ if(rDesc.GetPhoneticReadingOfSecKey())
+ pCurTOXMark->SetSecondaryKeyReading( *rDesc.GetPhoneticReadingOfSecKey() );
+ else
+ pCurTOXMark->SetSecondaryKeyReading( aEmptyStr );
+ }
+ else
+ {
+ pCurTOXMark->SetSecondaryKey( aEmptyStr );
+ pCurTOXMark->SetSecondaryKeyReading( aEmptyStr );
+ }
+ }
+ else
+ {
+ pCurTOXMark->SetPrimaryKey( aEmptyStr );
+ pCurTOXMark->SetPrimaryKeyReading( aEmptyStr );
+ pCurTOXMark->SetSecondaryKey( aEmptyStr );
+ pCurTOXMark->SetSecondaryKeyReading( aEmptyStr );
+ }
+ if(rDesc.GetPhoneticReadingOfAltStr())
+ pCurTOXMark->SetTextReading( *rDesc.GetPhoneticReadingOfAltStr() );
+ else
+ pCurTOXMark->SetTextReading( aEmptyStr );
+ pCurTOXMark->SetMainEntry(rDesc.IsMainEntry());
+ }
+ else
+ pCurTOXMark->SetLevel( static_cast< USHORT >(rDesc.GetLevel()) );
+
+ if(rDesc.GetAltStr())
+ {
+ // JP 26.08.96: Bug 30344 - entweder der Text aus dem Doc oder
+ // ein Alternativ-Text, beides gibts nicht!
+ BOOL bReplace = pCurTOXMark->IsAlternativeText();
+ if( bReplace )
+ pCurTOXMark->SetAlternativeText( *rDesc.GetAltStr() );
+ else
+ {
+ SwTOXMark aCpy( *pCurTOXMark );
+ aCurMarks.Remove(0, aCurMarks.Count());
+ pSh->DeleteTOXMark(pCurTOXMark);
+ aCpy.SetAlternativeText( *rDesc.GetAltStr() );
+ pSh->SwEditShell::Insert( aCpy );
+ pCurTOXMark = 0;
+ }
+ }
+ pSh->SetModified();
+ pSh->EndAllAction();
+ // Bug 36207 pCurTOXMark zeigt hier in den Wald!
+ if(!pCurTOXMark)
+ {
+ pSh->Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ pSh->GetCurTOXMarks(aCurMarks);
+ SetCurTOXMark(0);
+ }
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: UserTypeID ermitteln
+ --------------------------------------------------------------------*/
+
+
+USHORT SwTOXMgr::GetUserTypeID(const String& rStr)
+{
+ USHORT nSize = pSh->GetTOXTypeCount(TOX_USER);
+ for(USHORT i=0; i < nSize; ++i)
+ {
+ const SwTOXType* pTmp = pSh->GetTOXType(TOX_USER, i);
+ if(pTmp && pTmp->GetTypeName() == rStr)
+ return i;
+ }
+ SwTOXType aUserType(TOX_USER, rStr);
+ pSh->InsertTOXType(aUserType);
+ return nSize;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Traveling zwischen den TOXMarks
+ --------------------------------------------------------------------*/
+
+
+void SwTOXMgr::NextTOXMark(BOOL bSame)
+{
+ ASSERT(pCurTOXMark, "kein aktuelles TOXMark");
+ if( pCurTOXMark )
+ {
+ SwTOXSearch eDir = bSame ? TOX_SAME_NXT : TOX_NXT;
+ pCurTOXMark = (SwTOXMark*)&pSh->GotoTOXMark( *pCurTOXMark, eDir );
+ }
+}
+
+
+void SwTOXMgr::PrevTOXMark(BOOL bSame)
+{
+ ASSERT(pCurTOXMark, "kein aktuelles TOXMark");
+ if( pCurTOXMark )
+ {
+ SwTOXSearch eDir = bSame ? TOX_SAME_PRV : TOX_PRV;
+ pCurTOXMark = (SwTOXMark*)&pSh->GotoTOXMark(*pCurTOXMark, eDir );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Stichwortverzeichnis einfuegen
+ --------------------------------------------------------------------*/
+const SwTOXBase* SwTOXMgr::GetCurTOX()
+{
+ return pSh->GetCurTOX();
+}
+
+const SwTOXType* SwTOXMgr::GetTOXType(TOXTypes eTyp, USHORT nId) const
+{
+ return pSh->GetTOXType(eTyp, nId);
+}
+
+void SwTOXMgr::SetCurTOXMark(USHORT nId)
+{
+ pCurTOXMark = (nId < aCurMarks.Count()) ? aCurMarks[nId] : 0;
+}
+
+/* -----------------01.07.99 16:23-------------------
+
+ --------------------------------------------------*/
+
+BOOL SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& rDesc,
+ SwTOXBase** ppBase,
+ const SfxItemSet* pSet)
+{
+ SwWait aWait( *pSh->GetView().GetDocShell(), TRUE );
+ BOOL bRet = TRUE;
+ const SwTOXBase* pCurTOX = ppBase && *ppBase ? *ppBase : GetCurTOX();
+ SwTOXBase* pTOX = (SwTOXBase*)pCurTOX;
+
+ SwTOXBase * pNewTOX = NULL;
+
+ if (pTOX)
+ pNewTOX = new SwTOXBase(*pTOX);
+
+ TOXTypes eCurTOXType = rDesc.GetTOXType();
+ if(pCurTOX && !ppBase && pSh->HasSelection())
+ pSh->EnterStdMode();
+
+ switch(eCurTOXType)
+ {
+ case TOX_INDEX :
+ {
+ if(!pCurTOX || (ppBase && !(*ppBase)))
+ {
+ const SwTOXType* pType = pSh->GetTOXType(eCurTOXType, 0);
+ SwForm aForm(eCurTOXType);
+ pNewTOX = new SwTOXBase(pType, aForm, nsSwTOXElement::TOX_MARK, pType->GetTypeName());
+ }
+ pNewTOX->SetOptions(rDesc.GetIndexOptions());
+ pNewTOX->SetMainEntryCharStyle(rDesc.GetMainEntryCharStyle());
+ pSh->SetTOIAutoMarkURL(rDesc.GetAutoMarkURL());
+ pSh->ApplyAutoMark();
+ }
+ break;
+ case TOX_CONTENT :
+ {
+ if(!pCurTOX || (ppBase && !(*ppBase)))
+ {
+ const SwTOXType* pType = pSh->GetTOXType(eCurTOXType, 0);
+ SwForm aForm(eCurTOXType);
+ pNewTOX = new SwTOXBase(pType, aForm, rDesc.GetContentOptions(), pType->GetTypeName());
+ }
+ pNewTOX->SetCreate(rDesc.GetContentOptions());
+ pNewTOX->SetLevel(rDesc.GetLevel());
+ }
+ break;
+ case TOX_USER :
+ {
+ if(!pCurTOX || (ppBase && !(*ppBase)))
+ {
+ USHORT nPos = 0;
+ USHORT nSize = pSh->GetTOXTypeCount(eCurTOXType);
+ for(USHORT i=0; rDesc.GetTOUName() && i < nSize; ++i)
+ { const SwTOXType* pType = pSh->GetTOXType(TOX_USER, i);
+ if(pType->GetTypeName() == *rDesc.GetTOUName())
+ { nPos = i;
+ break;
+ }
+ }
+ const SwTOXType* pType = pSh->GetTOXType(eCurTOXType, nPos);
+
+ SwForm aForm(eCurTOXType);
+ pNewTOX = new SwTOXBase(pType, aForm, rDesc.GetContentOptions(), pType->GetTypeName());
+
+ }
+ else
+ {
+ const_cast<SwTOXBase*>( pCurTOX )->SetCreate(rDesc.GetContentOptions());
+ }
+ pNewTOX->SetLevelFromChapter(rDesc.IsLevelFromChapter());
+ }
+ break;
+ case TOX_OBJECTS:
+ case TOX_TABLES:
+ case TOX_AUTHORITIES:
+ case TOX_ILLUSTRATIONS:
+ {
+ //Special handling for TOX_AUTHORITY
+ if(TOX_AUTHORITIES == eCurTOXType)
+ {
+ SwAuthorityFieldType* pFType = (SwAuthorityFieldType*)
+ pSh->GetFldType(RES_AUTHORITY, aEmptyStr);
+ if(!pFType)
+ pFType = (SwAuthorityFieldType*)pSh->InsertFldType(
+ SwAuthorityFieldType(pSh->GetDoc()));
+ pFType->SetPreSuffix(rDesc.GetAuthBrackets().GetChar(0),
+ rDesc.GetAuthBrackets().GetChar(1));
+ pFType->SetSequence(rDesc.IsAuthSequence());
+ SwTOXSortKey rArr[3];
+ rArr[0] = rDesc.GetSortKey1();
+ rArr[1] = rDesc.GetSortKey2();
+ rArr[2] = rDesc.GetSortKey3();
+ pFType->SetSortKeys(3, rArr);
+ pFType->SetSortByDocument(rDesc.IsSortByDocument());
+ pFType->SetLanguage(rDesc.GetLanguage());
+ pFType->SetSortAlgorithm(rDesc.GetSortAlgorithm());
+
+ pFType->UpdateFlds();
+ }
+ // TODO: consider properties of the current TOXType
+ if(!pCurTOX || (ppBase && !(*ppBase)))
+ {
+ const SwTOXType* pType = pSh->GetTOXType(eCurTOXType, 0);
+ SwForm aForm(eCurTOXType);
+ pNewTOX = new SwTOXBase(
+ pType, aForm,
+ TOX_AUTHORITIES == eCurTOXType ? nsSwTOXElement::TOX_MARK : 0, pType->GetTypeName());
+ }
+ else
+ {
+ if((!ppBase || !(*ppBase)) && pSh->HasSelection())
+ pSh->DelRight();
+ pNewTOX = (SwTOXBase*)pCurTOX;
+ }
+// pTOX->SetOptions(rDesc.GetIndexOptions());
+ pNewTOX->SetFromObjectNames(rDesc.IsCreateFromObjectNames());
+ pNewTOX->SetOLEOptions(rDesc.GetOLEOptions());
+ }
+ break;
+ }
+
+
+ DBG_ASSERT(pNewTOX, "no TOXBase created!" );
+ if(!pNewTOX)
+ return FALSE;
+
+ pNewTOX->SetFromChapter(rDesc.IsFromChapter());
+ pNewTOX->SetSequenceName(rDesc.GetSequenceName());
+ pNewTOX->SetCaptionDisplay(rDesc.GetCaptionDisplay());
+ pNewTOX->SetProtected(rDesc.IsReadonly());
+
+ for(USHORT nLevel = 0; nLevel < MAXLEVEL; nLevel++)
+ pNewTOX->SetStyleNames(rDesc.GetStyleNames(nLevel), nLevel);
+
+ if(rDesc.GetTitle())
+ pNewTOX->SetTitle(*rDesc.GetTitle());
+ if(rDesc.GetForm())
+ pNewTOX->SetTOXForm(*rDesc.GetForm());
+ pNewTOX->SetLanguage(rDesc.GetLanguage());
+ pNewTOX->SetSortAlgorithm(rDesc.GetSortAlgorithm());
+
+ if(!pCurTOX || (ppBase && !(*ppBase)) )
+ {
+ // wird ppBase uebergeben, dann wird das TOXBase hier nur erzeugt
+ // und dann ueber den Dialog in ein Globaldokument eingefuegt
+ if(ppBase)
+ (*ppBase) = pNewTOX;
+ else
+ {
+ pSh->InsertTableOf(*pNewTOX, pSet);
+ delete pNewTOX;
+ }
+ }
+ else
+ {
+ SwDoc * pDoc = pSh->GetDoc();
+
+ if (pDoc->GetIDocumentUndoRedo().DoesUndo())
+ {
+ if (pNewTOX != NULL)
+ {
+ pDoc->GetIDocumentUndoRedo().DelAllUndoObj();
+ }
+
+ pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_TOXCHANGE, NULL);
+ }
+
+ if (pNewTOX != NULL) // => pTOX != NULL
+ pDoc->ChgTOX(*pTOX, *pNewTOX);
+
+ bRet = pSh->UpdateTableOf(*pTOX, pSet);
+
+ if (pDoc->GetIDocumentUndoRedo().DoesUndo())
+ {
+ pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_TOXCHANGE, NULL);
+
+ if (pNewTOX == NULL)
+ {
+ pDoc->GetIDocumentUndoRedo().DelAllUndoObj();
+ }
+ }
+ }
+
+ return bRet;
+}
+/* -----------------20.10.99 14:11-------------------
+
+ --------------------------------------------------*/
+void SwTOXDescription::SetSortKeys(SwTOXSortKey eKey1,
+ SwTOXSortKey eKey2,
+ SwTOXSortKey eKey3)
+{
+ SwTOXSortKey aArr[3];
+ USHORT nPos = 0;
+ if(AUTH_FIELD_END > eKey1.eField)
+ aArr[nPos++] = eKey1;
+ if(AUTH_FIELD_END > eKey2.eField)
+ aArr[nPos++] = eKey2;
+ if(AUTH_FIELD_END > eKey3.eField)
+ aArr[nPos++] = eKey3;
+
+ eSortKey1 = aArr[0];
+ eSortKey2 = aArr[1];
+ eSortKey3 = aArr[2];
+}
+
+/* -----------------10.09.99 10:02-------------------
+
+ --------------------------------------------------*/
+void SwTOXDescription::ApplyTo(SwTOXBase& rTOXBase)
+{
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ rTOXBase.SetStyleNames(GetStyleNames(i), i);
+ rTOXBase.SetTitle(GetTitle() ? *GetTitle() : aEmptyStr);
+ rTOXBase.SetCreate(GetContentOptions());
+
+ if(GetTOXType() == TOX_INDEX)
+ rTOXBase.SetOptions(GetIndexOptions());
+ if(GetTOXType() != TOX_INDEX)
+ rTOXBase.SetLevel(GetLevel());
+ rTOXBase.SetFromObjectNames(IsCreateFromObjectNames());
+ rTOXBase.SetSequenceName(GetSequenceName());
+ rTOXBase.SetCaptionDisplay(GetCaptionDisplay());
+ rTOXBase.SetFromChapter(IsFromChapter());
+ rTOXBase.SetProtected(IsReadonly());
+ rTOXBase.SetOLEOptions(GetOLEOptions());
+ rTOXBase.SetLevelFromChapter(IsLevelFromChapter());
+ rTOXBase.SetLanguage(eLanguage);
+ rTOXBase.SetSortAlgorithm(sSortAlgorithm);
+
+}
+
+
+
diff --git a/sw/source/ui/lingu/cvdata.mac b/sw/source/ui/lingu/cvdata.mac
new file mode 100644
index 000000000000..1f26c95fbe85
--- /dev/null
+++ b/sw/source/ui/lingu/cvdata.mac
@@ -0,0 +1,19 @@
+#############
+## Deutsch ##
+#############
+rename "GR_HYP.DAT" "German Hyph"
+setfile -c 'SW/g' -t 'Lexi' "German Hyph"
+rename "GR_SPL.DAT" "German Spell"
+setfile -c 'SW/g' -t 'Lexi' "German Spell"
+rename "GR_THE.DAT" "German Thes"
+setfile -c 'SW/g' -t 'Lexi' "German Thes"
+
+#############
+## English ##
+#############
+rename "EN_HYP.DAT" "English Hyph"
+setfile -c 'SW/g' -t 'Lexi' "English Hyph"
+rename "EN_SPL.DAT" "English Spell"
+setfile -c 'SW/g' -t 'Lexi' "English Spell"
+rename "EN_THE.DAT" "English Thes"
+setfile -c 'SW/g' -t 'Lexi' "English Thes"
diff --git a/sw/source/ui/lingu/hhcwrp.cxx b/sw/source/ui/lingu/hhcwrp.cxx
new file mode 100644
index 000000000000..da07c73f6c8e
--- /dev/null
+++ b/sw/source/ui/lingu/hhcwrp.cxx
@@ -0,0 +1,818 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef PRECOMPILED
+#include "ui_pch.hxx"
+#endif
+
+
+#include <hintids.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <swundo.hxx> // fuer Undo-Ids
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <splargs.hxx>
+
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <editeng/unolingu.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/text/RubyAdjust.hpp>
+#include <hhcwrp.hxx>
+#include <sdrhhcwrap.hxx>
+#include <doc.hxx>
+#include <docsh.hxx>
+#include <txatritr.hxx>
+#include <mdiexp.hxx> // Progress
+#include <edtwin.hxx>
+#include <crsskip.hxx>
+#include <index.hxx>
+#include <pam.hxx>
+#include <swcrsr.hxx>
+#include <viscrs.hxx>
+#include <ndtxt.hxx>
+#include <fmtruby.hxx>
+#include <breakit.hxx>
+#include <docsh.hxx>
+
+#ifndef _OLMENU_HRC
+#include <olmenu.hrc>
+#endif
+
+#include <unomid.h>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::com::sun::star::i18n;
+
+#define CHAR_PAR_BRK ((sal_Char) 0x0D)
+
+//////////////////////////////////////////////////////////////////////
+// Beschreibung: Ggf. Rahmen/Objektshell abschalten
+
+static void lcl_ActivateTextShell( SwWrtShell & rWrtSh )
+{
+ if( rWrtSh.IsSelFrmMode() || rWrtSh.IsObjSelected() )
+ rWrtSh.EnterStdMode();
+}
+
+//////////////////////////////////////////////////////////////////////
+
+class SwKeepConversionDirectionStateContext
+{
+public:
+ SwKeepConversionDirectionStateContext()
+ {
+ //!! hack to transport the current conversion direction state settings
+ //!! into the next incarnation that iterates over the drawing objets
+ //!! ( see SwHHCWrapper::~SwHHCWrapper() )
+ editeng::HangulHanjaConversion::SetUseSavedConversionDirectionState( sal_True );
+ }
+
+ ~SwKeepConversionDirectionStateContext()
+ {
+ editeng::HangulHanjaConversion::SetUseSavedConversionDirectionState( sal_False );
+ }
+};
+
+//////////////////////////////////////////////////////////////////////
+
+SwHHCWrapper::SwHHCWrapper(
+ SwView* pSwView,
+ const uno::Reference< lang::XMultiServiceFactory >& rxMSF,
+ LanguageType nSourceLanguage,
+ LanguageType nTargetLanguage,
+ const Font *pTargetFont,
+ sal_Int32 nConvOptions,
+ sal_Bool bIsInteractive,
+ sal_Bool bStart, sal_Bool bOther, sal_Bool bSelection ) :
+ editeng::HangulHanjaConversion( &pSwView->GetEditWin(), rxMSF,
+ SvxCreateLocale( nSourceLanguage ),
+ SvxCreateLocale( nTargetLanguage ),
+ pTargetFont,
+ nConvOptions,
+ bIsInteractive ),
+ rWrtShell( pSwView->GetWrtShell() )
+{
+ pConvArgs = 0;
+ nLastPos = 0;
+ nUnitOffset = 0;
+
+ pView = pSwView;
+ pWin = &pSwView->GetEditWin();
+ bIsDrawObj = sal_False;
+ bIsStart = bStart;
+ bIsOtherCntnt = bStartChk = bOther;
+ bIsConvSpecial = sal_True;
+ bIsSelection = bSelection;
+ bInfoBox = sal_False;
+ bStartDone = bOther || bStart;
+ bEndDone = sal_False;
+// bLastRet = sal_True;
+ nPageCount = nPageStart = 0;
+}
+
+
+SwHHCWrapper::~SwHHCWrapper()
+{
+ delete pConvArgs;
+
+ rWrtShell.SetCareWin( NULL );
+
+ // check for existence of a draw view which means that there are
+ // (or previously were) draw objects present in the document.
+ // I.e. we like to check those too.
+ if ( IsDrawObj() /*&& bLastRet*/ && pView->GetWrtShell().HasDrawView() )
+ {
+ Cursor *pSave = pView->GetWindow()->GetCursor();
+ {
+ SwKeepConversionDirectionStateContext aContext;
+
+ SdrHHCWrapper aSdrConvWrap( pView, GetSourceLanguage(),
+ GetTargetLanguage(), GetTargetFont(),
+ GetConversionOptions(), IsInteractive() );
+ aSdrConvWrap.StartTextConversion();
+ }
+ pView->GetWindow()->SetCursor( pSave );
+ }
+
+ if( nPageCount )
+ ::EndProgress( pView->GetDocShell() );
+
+ // finally for chinese translation we need to change the the documents
+ // default language and font to the new ones to be used.
+ LanguageType nTargetLang = GetTargetLanguage();
+ if (IsChinese( nTargetLang ))
+ {
+ SwDoc *pDoc = pView->GetDocShell()->GetDoc();
+
+ //!! Note: This also effects the default language of text boxes (EditEngine/EditView) !!
+ pDoc->SetDefault( SvxLanguageItem( nTargetLang, RES_CHRATR_CJK_LANGUAGE ) );
+ //
+ const Font *pFont = GetTargetFont();
+ if (pFont)
+ {
+ SvxFontItem aFontItem( pFont->GetFamily(), pFont->GetName(),
+ pFont->GetStyleName(), pFont->GetPitch(),
+ pFont->GetCharSet(), RES_CHRATR_CJK_FONT );
+ pDoc->SetDefault( aFontItem );
+ }
+
+ }
+
+/*
+ if( bInfoBox )
+ InfoBox(&pView->GetEditWin(), String(SW_RES(STR_SPELL_OK)) ).Execute();
+*/
+}
+
+
+void SwHHCWrapper::GetNextPortion(
+ ::rtl::OUString& rNextPortion,
+ LanguageType& rLangOfPortion,
+ sal_Bool bAllowChanges )
+{
+ pConvArgs->bAllowImplicitChangesForNotConvertibleText = bAllowChanges;
+
+ FindConvText_impl();
+ rNextPortion = pConvArgs->aConvText;
+ rLangOfPortion = pConvArgs->nConvTextLang;
+
+ nUnitOffset = 0;
+
+ // build last pos from currently selected text
+ SwPaM* pCrsr = rWrtShell.GetCrsr();
+ nLastPos = pCrsr->Start()->nContent.GetIndex();
+}
+
+
+void SwHHCWrapper::SelectNewUnit_impl( sal_Int32 nUnitStart, sal_Int32 nUnitEnd )
+{
+ SwPaM *pCrsr = rWrtShell.GetCrsr();
+ pCrsr->GetPoint()->nContent = nLastPos;
+ pCrsr->DeleteMark();
+
+ rWrtShell.Right( CRSR_SKIP_CHARS, /*bExpand*/ sal_False,
+ (USHORT) (nUnitOffset + nUnitStart), sal_True );
+ pCrsr->SetMark();
+ rWrtShell.Right( CRSR_SKIP_CHARS, /*bExpand*/ sal_True,
+ (USHORT) (nUnitEnd - nUnitStart), sal_True );
+ // end selection now. Otherwise SHIFT+HOME (extending the selection)
+ // won't work when the dialog is closed without any replacement.
+ // (see #116346#)
+ rWrtShell.EndSelect();
+}
+
+
+void SwHHCWrapper::HandleNewUnit(
+ const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd )
+{
+ DBG_ASSERT( nUnitStart >= 0 && nUnitEnd >= nUnitStart, "wrong arguments" );
+ if (!(0 <= nUnitStart && nUnitStart <= nUnitEnd))
+ return;
+
+ lcl_ActivateTextShell( rWrtShell );
+
+ rWrtShell.StartAllAction();
+
+ // select current unit
+ SelectNewUnit_impl( nUnitStart, nUnitEnd );
+
+ rWrtShell.EndAllAction();
+}
+
+
+void SwHHCWrapper::ChangeText( const String &rNewText,
+ const OUString& rOrigText,
+ const uno::Sequence< sal_Int32 > *pOffsets,
+ SwPaM *pCrsr )
+{
+ //!! please see also TextConvWrapper::ChangeText with is a modified
+ //!! copy of this code
+
+ DBG_ASSERT( rNewText.Len() != 0, "unexpected empty string" );
+ if (rNewText.Len() == 0)
+ return;
+
+ if (pOffsets && pCrsr) // try to keep as much attributation as possible ?
+ {
+ // remember cursor start position for later setting of the cursor
+ const SwPosition *pStart = pCrsr->Start();
+ const xub_StrLen nStartIndex = pStart->nContent.GetIndex();
+ const SwNodeIndex aStartNodeIndex = pStart->nNode;
+ SwTxtNode *pStartTxtNode = aStartNodeIndex.GetNode().GetTxtNode();
+
+ const sal_Int32 nIndices = pOffsets->getLength();
+ const sal_Int32 *pIndices = pOffsets->getConstArray();
+ xub_StrLen nConvTextLen = rNewText.Len();
+ xub_StrLen nPos = 0;
+ xub_StrLen nChgPos = STRING_NOTFOUND;
+ xub_StrLen nChgLen = 0;
+ xub_StrLen nConvChgPos = STRING_NOTFOUND;
+ xub_StrLen nConvChgLen = 0;
+
+ // offset to calculate the position in the text taking into
+ // account that text may have been replaced with new text of
+ // different length. Negative values allowed!
+ long nCorrectionOffset = 0;
+
+ DBG_ASSERT(nIndices == 0 || nIndices == nConvTextLen,
+ "mismatch between string length and sequence length!" );
+
+ // find all substrings that need to be replaced (and only those)
+ while (sal_True)
+ {
+ // get index in original text that matches nPos in new text
+ xub_StrLen nIndex;
+ if (nPos < nConvTextLen)
+ nIndex = (sal_Int32) nPos < nIndices ? (xub_StrLen) pIndices[nPos] : nPos;
+ else
+ {
+ nPos = nConvTextLen;
+ nIndex = static_cast< xub_StrLen >( rOrigText.getLength() );
+ }
+
+ if (rOrigText.getStr()[nIndex] == rNewText.GetChar(nPos) ||
+ nPos == nConvTextLen /* end of string also terminates non-matching char sequence */)
+ {
+ // substring that needs to be replaced found?
+ if (nChgPos != STRING_NOTFOUND && nConvChgPos != STRING_NOTFOUND)
+ {
+ nChgLen = nIndex - nChgPos;
+ nConvChgLen = nPos - nConvChgPos;
+#ifdef DEBUG
+ String aInOrig( rOrigText.copy( nChgPos, nChgLen ) );
+#endif
+ String aInNew( rNewText.Copy( nConvChgPos, nConvChgLen ) );
+
+ // set selection to sub string to be replaced in original text
+ xub_StrLen nChgInNodeStartIndex = static_cast< xub_StrLen >( nStartIndex + nCorrectionOffset + nChgPos );
+ DBG_ASSERT( rWrtShell.GetCrsr()->HasMark(), "cursor misplaced (nothing selected)" );
+ rWrtShell.GetCrsr()->GetMark()->nContent.Assign( pStartTxtNode, nChgInNodeStartIndex );
+ rWrtShell.GetCrsr()->GetPoint()->nContent.Assign( pStartTxtNode, nChgInNodeStartIndex + nChgLen );
+#ifdef DEBUG
+ String aSelTxt1( rWrtShell.GetSelTxt() );
+#endif
+
+ // replace selected sub string with the corresponding
+ // sub string from the new text while keeping as
+ // much from the attributes as possible
+ ChangeText_impl( aInNew, sal_True );
+
+ nCorrectionOffset += nConvChgLen - nChgLen;
+
+ nChgPos = STRING_NOTFOUND;
+ nConvChgPos = STRING_NOTFOUND;
+ }
+ }
+ else
+ {
+ // begin of non-matching char sequence found ?
+ if (nChgPos == STRING_NOTFOUND && nConvChgPos == STRING_NOTFOUND)
+ {
+ nChgPos = nIndex;
+ nConvChgPos = nPos;
+ }
+ }
+ if (nPos >= nConvTextLen)
+ break;
+ ++nPos;
+ }
+
+ // set cursor to the end of all the new text
+ // (as it would happen after ChangeText_impl (Delete and Insert)
+ // of the whole text in the 'else' branch below)
+ rWrtShell.ClearMark();
+ rWrtShell.GetCrsr()->Start()->nContent.Assign( pStartTxtNode, nStartIndex + nConvTextLen );
+ }
+ else
+ {
+ ChangeText_impl( rNewText, sal_False );
+ }
+}
+
+
+void SwHHCWrapper::ChangeText_impl( const String &rNewText, sal_Bool bKeepAttributes )
+{
+ if (bKeepAttributes)
+ {
+ // get item set with all relevant attributes
+ sal_uInt16 aRanges[] = {
+ RES_CHRATR_BEGIN, RES_FRMATR_END,
+ 0, 0, 0 };
+ SfxItemSet aItemSet( rWrtShell.GetAttrPool(), aRanges );
+ // get all attributes spanning the whole selection in order to
+ // restore those for the new text
+ rWrtShell.GetCurAttr( aItemSet );
+
+#ifdef DEBUG
+ String aSelTxt1( rWrtShell.GetSelTxt() );
+#endif
+ rWrtShell.Delete();
+ rWrtShell.Insert( rNewText );
+
+ // select new inserted text (currently the Point is right after the new text)
+ if (!rWrtShell.GetCrsr()->HasMark())
+ rWrtShell.GetCrsr()->SetMark();
+ SwPosition *pMark = rWrtShell.GetCrsr()->GetMark();
+ pMark->nContent = pMark->nContent.GetIndex() - rNewText.Len();
+#ifdef DEBUG
+ String aSelTxt2( rWrtShell.GetSelTxt() );
+#endif
+
+ // since 'SetAttr' below functions like merging with the attributes
+ // from the itemset with any existing ones we have to get rid of all
+ // all attributes now. (Those attributes that may take effect left
+ // to the position where the new text gets inserted after the old text
+ // was deleted)
+ rWrtShell.ResetAttr();
+ // apply previously saved attributes to new text
+ rWrtShell.SetAttr( aItemSet );
+ }
+ else
+ {
+ rWrtShell.Delete();
+ rWrtShell.Insert( rNewText );
+ }
+}
+
+
+void SwHHCWrapper::ReplaceUnit(
+ const sal_Int32 nUnitStart, const sal_Int32 nUnitEnd,
+ const ::rtl::OUString& rOrigText,
+ const OUString& rReplaceWith,
+ const uno::Sequence< sal_Int32 > &rOffsets,
+ ReplacementAction eAction,
+ LanguageType *pNewUnitLanguage )
+{
+ static OUString aBracketedStart( C2U( "(" ) );
+ static OUString aBracketedEnd( C2U( ")" ) );
+
+ DBG_ASSERT( nUnitStart >= 0 && nUnitEnd >= nUnitStart, "wrong arguments" );
+ if (!(nUnitStart >= 0 && nUnitEnd >= nUnitStart))
+ return;
+
+ lcl_ActivateTextShell( rWrtShell );
+
+ // Das aktuelle Wort austauschen
+ rWrtShell.StartAllAction();
+
+ // select current unit
+ SelectNewUnit_impl( nUnitStart, nUnitEnd );
+
+ OUString aOrigTxt( rWrtShell.GetSelTxt() );
+ OUString aNewTxt( rReplaceWith );
+ DBG_ASSERT( aOrigTxt == rOrigText, "!! text mismatch !!" );
+ SwFmtRuby *pRuby = 0;
+ sal_Bool bRubyBelow = sal_False;
+ String aNewOrigText;
+ switch (eAction)
+ {
+ case eExchange :
+ break;
+ case eReplacementBracketed :
+ {
+ (((aNewTxt = aOrigTxt) += aBracketedStart) += rReplaceWith) += aBracketedEnd;
+ }
+ break;
+ case eOriginalBracketed :
+ {
+ (((aNewTxt = rReplaceWith) += aBracketedStart) += aOrigTxt) += aBracketedEnd;
+ }
+ break;
+ case eReplacementAbove :
+ {
+ pRuby = new SwFmtRuby( rReplaceWith );
+ }
+ break;
+ case eOriginalAbove :
+ {
+ pRuby = new SwFmtRuby( aOrigTxt );
+ aNewOrigText = rReplaceWith;
+ }
+ break;
+ case eReplacementBelow :
+ {
+ pRuby = new SwFmtRuby( rReplaceWith );
+ bRubyBelow = sal_True;
+ }
+ break;
+ case eOriginalBelow :
+ {
+ pRuby = new SwFmtRuby( aOrigTxt );
+ aNewOrigText = rReplaceWith;
+ bRubyBelow = sal_True;
+ }
+ break;
+ default:
+ DBG_ERROR( "unexpected case" );
+ }
+ nUnitOffset += nUnitStart + aNewTxt.getLength();
+
+ if (pRuby)
+ {
+ rWrtShell.StartUndo( UNDO_SETRUBYATTR );
+ if (aNewOrigText.Len())
+ {
+ // according to FT we currently should not bother about keeping
+ // attributes in Hangul/Hanja conversion
+ ChangeText( aNewOrigText, rOrigText, NULL, NULL );
+
+ //!! since Delete, Insert in 'ChangeText' do not set the WrtShells
+ //!! bInSelect flag
+ //!! back to false we do it now manually in order for the selection
+ //!! to be done properly in the following call to Left.
+ // We didn't fix it in Delete and Insert since it is currently
+ // unclear if someone depends on this incorrect behvaiour
+ // of the flag.
+ rWrtShell.EndSelect();
+
+ rWrtShell.Left( 0, TRUE, aNewOrigText.Len(), TRUE, TRUE );
+ }
+
+ pRuby->SetPosition( bRubyBelow );
+ pRuby->SetAdjustment( RubyAdjust_CENTER );
+ //!! the following seem not to be needed
+ //pRuby->SetCharFmtName( const String& rNm );
+ //pRuby->SetCharFmtId( USHORT nNew );
+#ifdef DEBUG
+ SwPaM *pPaM = rWrtShell.GetCrsr();
+ (void)pPaM;
+#endif
+ rWrtShell.SetAttr(*pRuby);
+ delete pRuby;
+ rWrtShell.EndUndo( UNDO_SETRUBYATTR );
+ }
+ else
+ {
+ rWrtShell.StartUndo( UNDO_OVERWRITE );
+
+ // according to FT we should currently not bother about keeping
+ // attributes in Hangul/Hanja conversion and leave that untouched.
+ // Thus we do this only for Chinese translation...
+ sal_Bool bIsChineseConversion = IsChinese( GetSourceLanguage() );
+ if (bIsChineseConversion)
+ ChangeText( aNewTxt, rOrigText, &rOffsets, rWrtShell.GetCrsr() );
+ else
+ ChangeText( aNewTxt, rOrigText, NULL, NULL );
+
+ // change language and font if necessary
+ if (bIsChineseConversion)
+ {
+ rWrtShell.SetMark();
+ rWrtShell.GetCrsr()->GetMark()->nContent -= (xub_StrLen) aNewTxt.getLength();
+
+ DBG_ASSERT( GetTargetLanguage() == LANGUAGE_CHINESE_SIMPLIFIED || GetTargetLanguage() == LANGUAGE_CHINESE_TRADITIONAL,
+ "SwHHCWrapper::ReplaceUnit : unexpected target language" );
+
+ sal_uInt16 aRanges[] = {
+ RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
+ RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT,
+ 0, 0, 0 };
+
+ SfxItemSet aSet( rWrtShell.GetAttrPool(), aRanges );
+ if (pNewUnitLanguage)
+ {
+ //DBG_ASSERT(!IsSimilarChinese( *pNewUnitLanguage, nOldLang ),
+ // "similar language should not be changed!");
+ aSet.Put( SvxLanguageItem( *pNewUnitLanguage, RES_CHRATR_CJK_LANGUAGE ) );
+ }
+
+ const Font *pTargetFont = GetTargetFont();
+ DBG_ASSERT( pTargetFont, "target font missing?" );
+ if (pTargetFont && pNewUnitLanguage)
+ {
+ SvxFontItem aFontItem = (SvxFontItem&) aSet.Get( RES_CHRATR_CJK_FONT );
+ aFontItem.GetFamilyName() = pTargetFont->GetName();
+ aFontItem.GetFamily() = pTargetFont->GetFamily();
+ aFontItem.GetStyleName() = pTargetFont->GetStyleName();
+ aFontItem.GetPitch() = pTargetFont->GetPitch();
+ aFontItem.GetCharSet() = pTargetFont->GetCharSet();
+ aSet.Put( aFontItem );
+ }
+
+ rWrtShell.SetAttr( aSet );
+
+ rWrtShell.ClearMark();
+ }
+
+ rWrtShell.EndUndo( UNDO_OVERWRITE );
+ }
+
+ rWrtShell.EndAllAction();
+}
+
+
+sal_Bool SwHHCWrapper::HasRubySupport() const
+{
+ return sal_True;
+}
+
+
+void SwHHCWrapper::Convert()
+{
+ DBG_ASSERT( pConvArgs == 0, "NULL pointer expected" );
+ {
+ SwPaM *pCrsr = pView->GetWrtShell().GetCrsr();
+ SwPosition* pSttPos = pCrsr->Start();
+ SwPosition* pEndPos = pCrsr->End();
+
+
+ if (pSttPos->nNode.GetNode().IsTxtNode() &&
+ pEndPos->nNode.GetNode().IsTxtNode())
+ {
+ pConvArgs = new SwConversionArgs( GetSourceLanguage(),
+ pSttPos->nNode.GetNode().GetTxtNode(), pSttPos->nContent,
+ pEndPos->nNode.GetNode().GetTxtNode(), pEndPos->nContent );
+ }
+ else // we are not in the text (maybe a graphic or OLE object is selected) let's start from the top
+ {
+ // get PaM that points to the start of the document
+ SwNode& rNode = pView->GetDocShell()->GetDoc()->GetNodes().GetEndOfContent();
+ SwPaM aPam(rNode);
+ aPam.Move( fnMoveBackward, fnGoDoc ); // move to start of document
+
+ pSttPos = aPam.GetPoint(); //! using a PaM here makes sure we will get only text nodes
+ SwTxtNode *pTxtNode = pSttPos->nNode.GetNode().GetTxtNode();
+ // just in case we check anyway...
+ if (!pTxtNode || !pTxtNode->IsTxtNode())
+ return;
+ pConvArgs = new SwConversionArgs( GetSourceLanguage(),
+ pTxtNode, pSttPos->nContent,
+ pTxtNode, pSttPos->nContent );
+ }
+ DBG_ASSERT( pConvArgs->pStartNode && pConvArgs->pStartNode->IsTxtNode(),
+ "failed to get proper start text node" );
+ DBG_ASSERT( pConvArgs->pEndNode && pConvArgs->pEndNode->IsTxtNode(),
+ "failed to get proper end text node" );
+
+ // chinese conversion specific settings
+ DBG_ASSERT( IsChinese( GetSourceLanguage() ) == IsChinese( GetTargetLanguage() ),
+ "source and target language mismatch?" );
+ if (IsChinese( GetTargetLanguage() ))
+ {
+ pConvArgs->nConvTargetLang = GetTargetLanguage();
+ pConvArgs->pTargetFont = GetTargetFont();
+ pConvArgs->bAllowImplicitChangesForNotConvertibleText = sal_True;
+ }
+
+ // if it is not just a selection and we are about to begin
+ // with the current conversion for the very first time
+ // we need to find the start of the current (initial)
+ // convertible unit in order for the text conversion to give
+ // the correct result for that. Since it is easier to obtain
+ // the start of the word we use that though.
+ if (!pCrsr->HasMark()) // is not a selection?
+ {
+ // since #118246 / #117803 still occurs if the cursor is placed
+ // between the two chinese characters to be converted (because both
+ // of them are words on their own!) using the word boundary here does
+ // not work. Thus since chinese conversion is not interactive we start
+ // at the begin of the paragraph to solve the problem, i.e. have the
+ // TextConversion service get those charcters together in the same call.
+ xub_StrLen nStartIdx = STRING_MAXLEN;
+ if (editeng::HangulHanjaConversion::IsChinese( GetSourceLanguage() ) )
+ nStartIdx = 0;
+ else
+ {
+ OUString aText( pConvArgs->pStartNode->GetTxt() );
+ long nPos = pConvArgs->pStartIdx->GetIndex();
+ Boundary aBoundary( pBreakIt->GetBreakIter()->
+ getWordBoundary( aText, nPos, pBreakIt->GetLocale( pConvArgs->nConvSrcLang ),
+ WordType::DICTIONARY_WORD, sal_True ) );
+
+ // valid result found?
+ if (aBoundary.startPos < aText.getLength() &&
+ aBoundary.startPos != aBoundary.endPos)
+ {
+ nStartIdx = static_cast< xub_StrLen >(aBoundary.startPos );
+ }
+ }
+
+ if (STRING_MAXLEN != nStartIdx)
+ *pConvArgs->pStartIdx = nStartIdx;
+ }
+ }
+
+ if ( bIsOtherCntnt )
+ ConvStart_impl( pConvArgs, SVX_SPELL_OTHER );
+ else
+ {
+ bStartChk = sal_False;
+ ConvStart_impl( pConvArgs, SVX_SPELL_BODY_END );
+ }
+
+ ConvertDocument();
+
+ ConvEnd_impl( pConvArgs );
+}
+
+
+sal_Bool SwHHCWrapper::ConvNext_impl( )
+{
+ //! modified version of SvxSpellWrapper::SpellNext
+
+ // Keine Richtungsaenderung, also ist der gewuenschte Bereich ( bStartChk )
+ // vollstaendig abgearbeitet.
+ if( bStartChk )
+ bStartDone = sal_True;
+ else
+ bEndDone = sal_True;
+
+ if( bIsOtherCntnt && bStartDone && bEndDone ) // Dokument komplett geprueft?
+ {
+ bInfoBox = sal_True;
+ return sal_False;
+ }
+
+ //ResMgr* pMgr = DIALOG_MGR();
+ sal_Bool bGoOn = sal_False;
+
+ if ( bIsOtherCntnt )
+ {
+ bStartChk = sal_False;
+ ConvStart_impl( pConvArgs, SVX_SPELL_BODY );
+ bGoOn = sal_True;
+ }
+ else if ( bStartDone && bEndDone )
+ {
+ // Bodybereich erledigt, Frage nach Sonderbereich
+ if( bIsConvSpecial && HasOtherCnt_impl() )
+ {
+ ConvStart_impl( pConvArgs, SVX_SPELL_OTHER );
+ bIsOtherCntnt = bGoOn = sal_True;
+ }
+ else
+ bInfoBox = sal_True;
+ }
+ else
+ {
+ // Ein BODY_Bereich erledigt, Frage nach dem anderen BODY_Bereich
+/*
+ //pWin->LeaveWait();
+
+ sal_uInt16 nResId = RID_SVXQB_CONTINUE;
+ QueryBox aBox( pWin, ResId( nResId, pMgr ) );
+ if ( aBox.Execute() != RET_YES )
+ {
+ // Verzicht auf den anderen Bereich, ggf. Frage nach Sonderbereich
+ //pWin->EnterWait();
+ bStartDone = bEndDone = sal_True;
+ return SpellNext();
+ }
+ else
+ {
+*/
+ bStartChk = !bStartDone;
+ ConvStart_impl( pConvArgs, bStartChk ? SVX_SPELL_BODY_START : SVX_SPELL_BODY_END );
+ bGoOn = sal_True;
+/*
+ }
+ pWin->EnterWait();
+*/
+ }
+ return bGoOn;
+}
+
+
+sal_Bool SwHHCWrapper::FindConvText_impl()
+{
+ //! modified version of SvxSpellWrapper::FindSpellError
+
+ //ShowLanguageErrors();
+
+ sal_Bool bFound = sal_False;
+
+ pWin->EnterWait();
+ sal_Bool bConv = sal_True;
+
+ while ( bConv )
+ {
+ bFound = ConvContinue_impl( pConvArgs );
+ if (bFound)
+ {
+ bConv = sal_False;
+ }
+ else
+ {
+ ConvEnd_impl( pConvArgs );
+ bConv = ConvNext_impl();
+ }
+ }
+ pWin->LeaveWait();
+ return bFound;
+}
+
+
+sal_Bool SwHHCWrapper::HasOtherCnt_impl()
+{
+ return bIsSelection ? sal_False : rWrtShell.HasOtherCnt();
+}
+
+
+void SwHHCWrapper::ConvStart_impl( SwConversionArgs /* [out] */ *pConversionArgs, SvxSpellArea eArea )
+{
+ SetDrawObj( SVX_SPELL_OTHER == eArea );
+ pView->SpellStart( eArea, bStartDone, bEndDone, /* [out] */ pConversionArgs );
+}
+
+
+void SwHHCWrapper::ConvEnd_impl( SwConversionArgs *pConversionArgs )
+{
+ pView->SpellEnd( pConversionArgs );
+ //ShowLanguageErrors();
+}
+
+
+sal_Bool SwHHCWrapper::ConvContinue_impl( SwConversionArgs *pConversionArgs )
+{
+ sal_Bool bProgress = !bIsDrawObj && !bIsSelection;
+// bLastRet = aConvText.getLength() == 0;
+ pConversionArgs->aConvText = OUString();
+ pConversionArgs->nConvTextLang = LANGUAGE_NONE;
+ uno::Any aRet = bProgress ?
+ pView->GetWrtShell().SpellContinue( &nPageCount, &nPageStart, pConversionArgs ) :
+ pView->GetWrtShell().SpellContinue( &nPageCount, NULL, pConversionArgs );
+ //aRet >>= aConvText;
+ return pConversionArgs->aConvText.getLength() != 0;
+}
+
+//////////////////////////////////////////////////////////////////////
+
diff --git a/sw/source/ui/lingu/hyp.cxx b/sw/source/ui/lingu/hyp.cxx
new file mode 100644
index 000000000000..69c3db509fed
--- /dev/null
+++ b/sw/source/ui/lingu/hyp.cxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include "initui.hxx"
+#include "view.hxx"
+#include "edtwin.hxx"
+#include "wrtsh.hxx"
+#include "globals.hrc"
+#include <vcl/msgbox.hxx>
+#ifndef _WRKWIN_HXX //autogen
+#include <vcl/wrkwin.hxx>
+#endif
+#include <linguistic/lngprops.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <swwait.hxx>
+
+
+#include "hyp.hxx"
+#include "mdiexp.hxx"
+#include "olmenu.hrc"
+
+#include <unomid.h>
+
+#define HYPHHERE '-'
+#define PSH (&pView->GetWrtShell())
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Interaktive Trennung
+ --------------------------------------------------------------------*/
+
+SwHyphWrapper::SwHyphWrapper( SwView* pVw,
+ uno::Reference< linguistic2::XHyphenator > &rxHyph,
+ sal_Bool bStart, sal_Bool bOther, sal_Bool bSelect ) :
+ SvxSpellWrapper( &pVw->GetEditWin(), rxHyph, bStart, bOther ),
+ pView( pVw ),
+ xHyph( rxHyph ),
+ nLangError( 0 ),
+ nPageCount( 0 ),
+ nPageStart( 0 ),
+ bInSelection( bSelect ),
+ bShowError( sal_False ),
+ bInfoBox( sal_False )
+{
+ uno::Reference< beans::XPropertySet > xProp( GetLinguPropertySet() );
+ bAutomatic = xProp.is() ?
+ *(sal_Bool*)xProp->getPropertyValue( C2U(UPN_IS_HYPH_AUTO) ).getValue() : sal_False;
+ SetHyphen();
+}
+
+// -----------------------------------------------------------------------
+void SwHyphWrapper::SpellStart( SvxSpellArea eSpell )
+{
+ if( SVX_SPELL_OTHER == eSpell && nPageCount )
+ {
+ ::EndProgress( pView->GetDocShell() );
+ nPageCount = 0;
+ nPageStart = 0;
+ }
+ pView->HyphStart( eSpell );
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool SwHyphWrapper::SpellContinue()
+{
+ // Fuer autom. Trennung Aktionen erst am Ende sichtbar machen
+ SwWait *pWait = 0;
+ if( bAutomatic )
+ {
+ PSH->StartAllAction();
+ pWait = new SwWait( *pView->GetDocShell(), sal_True );
+ }
+
+ uno::Reference< uno::XInterface > xHyphWord = bInSelection ?
+ PSH->HyphContinue( NULL, NULL ) :
+ PSH->HyphContinue( &nPageCount, &nPageStart );
+ SetLast( xHyphWord );
+
+ // Fuer autom. Trennung Aktionen erst am Ende sichtbar machen
+ if( bAutomatic )
+ {
+ PSH->EndAllAction();
+ delete pWait;
+ }
+
+ if( bShowError )
+ {
+ bShowError = sal_False;
+ PSH->Push();
+ PSH->ClearMark();
+ pView->SpellError( &nLangError );
+ PSH->Combine();
+ }
+ return GetLast().is();
+}
+
+// -----------------------------------------------------------------------
+void SwHyphWrapper::SpellEnd()
+{
+ PSH->HyphEnd();
+ SvxSpellWrapper::SpellEnd();
+}
+
+IMPL_LINK( SwHyphWrapper, SpellError, LanguageType *, pLang )
+{
+ if (pLang && *pLang != nLangError )
+ {
+ nLangError = *pLang;
+ bShowError = sal_True;
+ }
+ return 0;
+}
+
+
+// -----------------------------------------------------------------------
+sal_Bool SwHyphWrapper::SpellMore()
+{
+ PSH->Push();
+ bInfoBox = sal_True;
+ PSH->Combine();
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------
+
+void SwHyphWrapper::InsertHyphen( const sal_uInt16 nPos )
+{
+ if( nPos)
+ PSH->InsertSoftHyph( nPos + 1); // does nPos == 1 really mean
+ // insert hyphen after first char?
+ // (instead of nPos == 0)
+ else
+ PSH->HyphIgnore();
+}
+
+// -----------------------------------------------------------------------
+SwHyphWrapper::~SwHyphWrapper()
+{
+ if( nPageCount )
+ ::EndProgress( pView->GetDocShell() );
+ if( bInfoBox )
+ InfoBox( &pView->GetEditWin(), SW_RESSTR(STR_HYP_OK) ).Execute();
+}
+
diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx
new file mode 100644
index 000000000000..352580707f74
--- /dev/null
+++ b/sw/source/ui/lingu/olmenu.cxx
@@ -0,0 +1,937 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include "SwRewriter.hxx"
+#include "chrdlg.hrc"
+#include "cmdid.h"
+#include "comcore.hrc"
+#include "crsskip.hxx"
+#include "doc.hxx"
+#include "docsh.hxx" //CheckSpellChanges
+#include "edtwin.hxx"
+#include "helpid.h"
+#include "hintids.hxx"
+#include "langhelper.hxx"
+#include "ndtxt.hxx"
+#include "olmenu.hrc"
+#include "olmenu.hxx"
+#include "swabstdlg.hxx"
+#include "swmodule.hxx"
+#include "swtypes.hxx"
+#include "swundo.hxx"
+#include "uitool.hxx"
+#include "unomid.h"
+#include "view.hxx"
+#include "viewopt.hxx"
+#include "wrtsh.hxx"
+#include "wview.hxx"
+#include "swabstdlg.hxx"
+#include "chrdlg.hrc"
+
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#endif
+
+#include <comphelper/processfactory.hxx>
+#include <editeng/acorrcfg.hxx>
+#include <editeng/svxacorr.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/splwrap.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/unolingu.hxx>
+#include <i18npool/mslangid.hxx>
+#include <linguistic/lngprops.hxx>
+#include <linguistic/misc.hxx>
+#include <osl/file.hxx>
+#include <rtl/string.hxx>
+#include <svtools/filter.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/imagemgr.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/sfxdlg.hxx>
+#include <svl/itemset.hxx>
+#include <svl/languageoptions.hxx>
+#include <svl/stritem.hxx>
+#include <svtools/filter.hxx>
+#include <svtools/langtab.hxx>
+#include <svx/dlgutil.hxx>
+#include <unotools/lingucfg.hxx>
+#include <unotools/linguprops.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/settings.hxx>
+#include <vcl/svapp.hxx>
+
+#include <map>
+
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/document/XDocumentLanguages.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/linguistic2/SingleProofreadingError.hpp>
+#include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
+#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
+#include <com/sun/star/uno/Any.hxx>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+extern void lcl_CharDialog( SwWrtShell &rWrtSh, BOOL bUseDialog, USHORT nSlot,const SfxItemSet *pArgs, SfxRequest *pReq );
+
+
+/*--------------------------------------------------------------------------
+
+---------------------------------------------------------------------------*/
+
+// tries to determine the language of 'rText'
+//
+LanguageType lcl_CheckLanguage(
+ const OUString &rText,
+ uno::Reference< linguistic2::XSpellChecker1 > xSpell,
+ uno::Reference< linguistic2::XLanguageGuessing > xLangGuess,
+ sal_Bool bIsParaText )
+{
+ LanguageType nLang = LANGUAGE_NONE;
+ if (bIsParaText) // check longer texts with language-guessing...
+ {
+ if (!xLangGuess.is())
+ return nLang;
+
+ lang::Locale aLocale( xLangGuess->guessPrimaryLanguage( rText, 0, rText.getLength()) );
+
+ // get language as from "Tools/Options - Language Settings - Languages: Locale setting"
+ LanguageType nTmpLang = Application::GetSettings().GetLanguage();
+
+ // if the result from language guessing does not provide a 'Country' part
+ // try to get it by looking up the locale setting of the office.
+ if (aLocale.Country.getLength() == 0)
+ {
+ lang::Locale aTmpLocale = SvxCreateLocale( nTmpLang );
+ if (aTmpLocale.Language == aLocale.Language)
+ nLang = nTmpLang;
+ }
+ if (nLang == LANGUAGE_NONE) // language not found by looking up the system language...
+ nLang = MsLangId::convertLocaleToLanguageWithFallback( aLocale );
+ if (nLang == LANGUAGE_SYSTEM)
+ nLang = nTmpLang;
+ if (nLang == LANGUAGE_DONTKNOW)
+ nLang = LANGUAGE_NONE;
+ }
+ else // check single word
+ {
+ if (!xSpell.is())
+ return nLang;
+
+ //
+ // build list of languages to check
+ //
+ LanguageType aLangList[4];
+ const AllSettings& rSettings = Application::GetSettings();
+ SvtLinguOptions aLinguOpt;
+ SvtLinguConfig().GetOptions( aLinguOpt );
+ // The default document language from "Tools/Options - Language Settings - Languages: Western"
+ aLangList[0] = MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN);
+ // The one from "Tools/Options - Language Settings - Languages: User interface"
+ aLangList[1] = rSettings.GetUILanguage();
+ // The one from "Tools/Options - Language Settings - Languages: Locale setting"
+ aLangList[2] = rSettings.GetLanguage();
+ // en-US
+ aLangList[3] = LANGUAGE_ENGLISH_US;
+#ifdef DEBUG
+ lang::Locale a0( SvxCreateLocale( aLangList[0] ) );
+ lang::Locale a1( SvxCreateLocale( aLangList[1] ) );
+ lang::Locale a2( SvxCreateLocale( aLangList[2] ) );
+ lang::Locale a3( SvxCreateLocale( aLangList[3] ) );
+#endif
+
+ INT32 nCount = sizeof(aLangList) / sizeof(aLangList[0]);
+ for (INT32 i = 0; i < nCount; i++)
+ {
+ INT16 nTmpLang = aLangList[i];
+ if (nTmpLang != LANGUAGE_NONE && nTmpLang != LANGUAGE_DONTKNOW)
+ {
+ if (xSpell->hasLanguage( nTmpLang ) &&
+ xSpell->isValid( rText, nTmpLang, uno::Sequence< beans::PropertyValue >() ))
+ {
+ nLang = nTmpLang;
+ break;
+ }
+ }
+ }
+ }
+
+ return nLang;
+}
+
+
+/// @returns : the language for the selected text that is set for the
+/// specified attribute (script type).
+/// If there are more than one languages used LANGUAGE_DONTKNOW will be returned.
+/// @param nLangWhichId : one of
+/// RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
+/// @returns: the language in use for the selected text.
+/// 'In use' means the language(s) matching the script type(s) of the
+/// selected text. Or in other words, the language a spell checker would use.
+/// If there is more than one language LANGUAGE_DONTKNOW will be returned.
+// check if nScriptType includes the script type associated to nLang
+inline bool lcl_checkScriptType( sal_Int16 nScriptType, LanguageType nLang )
+{
+ return 0 != (nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ));
+}
+
+void SwSpellPopup::fillLangPopupMenu(
+ PopupMenu *pPopupMenu,
+ USHORT nLangItemIdStart,
+ uno::Sequence< OUString > aSeq,
+ SwWrtShell* pWrtSh,
+ std::map< sal_Int16, ::rtl::OUString > &rLangTable )
+{
+ if (!pPopupMenu)
+ return;
+
+ SvtLanguageTable aLanguageTable;
+
+ // set of languages to be displayed in the sub menus
+ std::set< OUString > aLangItems;
+
+ OUString aCurLang( aSeq[0] );
+ USHORT nScriptType = static_cast< sal_Int16 >(aSeq[1].toInt32());
+ OUString aKeyboardLang( aSeq[2] );
+ OUString aGuessedTextLang( aSeq[3] );
+
+ if (aCurLang != OUString() &&
+ LANGUAGE_DONTKNOW != aLanguageTable.GetType( aCurLang ))
+ aLangItems.insert( aCurLang );
+
+ //2--System
+ const AllSettings& rAllSettings = Application::GetSettings();
+ LanguageType rSystemLanguage = rAllSettings.GetLanguage();
+ if (rSystemLanguage != LANGUAGE_DONTKNOW)
+ {
+ if (lcl_checkScriptType( nScriptType, rSystemLanguage ))
+ aLangItems.insert( aLanguageTable.GetString(rSystemLanguage) );
+ }
+
+ //3--UI
+ LanguageType rUILanguage = rAllSettings.GetUILanguage();
+ if (rUILanguage != LANGUAGE_DONTKNOW)
+ {
+ if (lcl_checkScriptType(nScriptType, rUILanguage ))
+ aLangItems.insert( aLanguageTable.GetString(rUILanguage) );
+ }
+
+ //4--guessed language
+ if (aGuessedTextLang.getLength() > 0)
+ {
+ if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(aGuessedTextLang)))
+ aLangItems.insert( aGuessedTextLang );
+ }
+
+ //5--keyboard language
+ if (aKeyboardLang.getLength() > 0)
+ {
+ if (lcl_checkScriptType(nScriptType, aLanguageTable.GetType(aKeyboardLang)))
+ aLangItems.insert( aKeyboardLang );
+ }
+
+ //6--all languages used in current document
+ uno::Reference< com::sun::star::frame::XModel > xModel;
+ uno::Reference< com::sun::star::frame::XController > xController( pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface()->getController(), uno::UNO_QUERY );
+ if ( xController.is() )
+ xModel = xController->getModel();
+ uno::Reference< document::XDocumentLanguages > xDocumentLanguages( xModel, uno::UNO_QUERY );
+ /*the description of nScriptType flags
+ LATIN : 0x0001
+ ASIAN : 0x0002
+ COMPLEX: 0x0004
+ */
+ const sal_Int16 nMaxCount = 7;
+ if (xDocumentLanguages.is())
+ {
+ uno::Sequence< lang::Locale > rLocales( xDocumentLanguages->getDocumentLanguages( nScriptType, nMaxCount ) );
+ if (rLocales.getLength() > 0)
+ {
+ for (USHORT i = 0; i < rLocales.getLength(); ++i)
+ {
+ if (aLangItems.size() == (size_t)nMaxCount)
+ break;
+ const lang::Locale& rLocale = rLocales[i];
+ if (lcl_checkScriptType( nScriptType, aLanguageTable.GetType( rLocale.Language )))
+ aLangItems.insert( rLocale.Language );
+ }
+ }
+ }
+
+
+ USHORT nItemId = nLangItemIdStart;
+ const OUString sAsterix(RTL_CONSTASCII_USTRINGPARAM("*")); // multiple languages in current selection
+ const OUString sEmpty; // 'no language found' from language guessing
+ std::set< OUString >::const_iterator it;
+ for (it = aLangItems.begin(); it != aLangItems.end(); ++it)
+ {
+ OUString aEntryTxt( *it );
+ if (aEntryTxt != OUString( aLanguageTable.GetString( LANGUAGE_NONE ) )&&
+ aEntryTxt != sAsterix &&
+ aEntryTxt != sEmpty)
+ {
+ DBG_ASSERT( nLangItemIdStart <= nItemId && nItemId <= nLangItemIdStart + MN_MAX_NUM_LANG,
+ "nItemId outside of expected range!" );
+ pPopupMenu->InsertItem( nItemId, aEntryTxt, MIB_RADIOCHECK );
+ if (aEntryTxt == aCurLang)
+ {
+ //make a check mark for the current language
+ pPopupMenu->CheckItem( nItemId, TRUE );
+ }
+ rLangTable[ nItemId ] = aEntryTxt;
+ ++nItemId;
+ }
+ }
+
+ pPopupMenu->InsertItem( nLangItemIdStart + MN_NONE_OFFSET, String(SW_RES( STR_LANGSTATUS_NONE )), MIB_RADIOCHECK );
+ pPopupMenu->InsertItem( nLangItemIdStart + MN_RESET_OFFSET, String(SW_RES( STR_RESET_TO_DEFAULT_LANGUAGE )), MIB_RADIOCHECK );
+ pPopupMenu->InsertItem( nLangItemIdStart + MN_MORE_OFFSET, String(SW_RES( STR_LANGSTATUS_MORE )), MIB_RADIOCHECK );
+}
+
+
+static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl )
+{
+ Image aRes;
+ OUString aTmp;
+ osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp );
+// ::rtl::OString aPath = OString( aTmp.getStr(), aTmp.getLength(), osl_getThreadTextEncoding() );
+#if defined(WNT)
+// aTmp = lcl_Win_GetShortPathName( aTmp );
+#endif
+ Graphic aGraphic;
+ const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) );
+ if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic ) )
+ {
+ aRes = Image( aGraphic.GetBitmapEx() );
+ }
+ return aRes;
+}
+
+
+OUString RetrieveLabelFromCommand( const OUString& aCmdURL )
+{
+ OUString aLabel;
+ if ( aCmdURL.getLength() )
+ {
+ try
+ {
+ uno::Reference< container::XNameAccess > xNameAccess( ::comphelper::getProcessServiceFactory()->createInstance( OUString::createFromAscii("com.sun.star.frame.UICommandDescription") ), uno::UNO_QUERY );
+ if ( xNameAccess.is() )
+ {
+ uno::Reference< container::XNameAccess > xUICommandLabels;
+ const OUString aModule( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextDocument" ) );
+ uno::Any a = xNameAccess->getByName( aModule );
+ uno::Reference< container::XNameAccess > xUICommands;
+ a >>= xUICommandLabels;
+ OUString aStr;
+ uno::Sequence< beans::PropertyValue > aPropSeq;
+ a = xUICommandLabels->getByName( aCmdURL );
+ if ( a >>= aPropSeq )
+ {
+ for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
+ {
+ if ( aPropSeq[i].Name.equalsAscii( "Name" ))
+ {
+ aPropSeq[i].Value >>= aStr;
+ break;
+ }
+ }
+ }
+ aLabel = aStr;
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+
+ return aLabel;
+}
+
+
+SwSpellPopup::SwSpellPopup(
+ SwWrtShell* pWrtSh,
+ const uno::Reference< linguistic2::XSpellAlternatives > &xAlt,
+ const String &rParaText ) :
+PopupMenu( SW_RES(MN_SPELL_POPUP) ),
+pSh( pWrtSh ),
+xSpellAlt(xAlt),
+bGrammarResults(false)
+{
+ DBG_ASSERT(xSpellAlt.is(), "no spelling alternatives available");
+
+// CreateAutoMnemonics();
+ SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS);
+
+ nCheckedLanguage = LANGUAGE_NONE;
+ if (xSpellAlt.is())
+ {
+ nCheckedLanguage = SvxLocaleToLanguage( xSpellAlt->getLocale() );
+ aSuggestions = xSpellAlt->getAlternatives();
+ }
+ sal_Int16 nStringCount = static_cast< sal_Int16 >( aSuggestions.getLength() );
+
+ SvtLinguConfig aCfg;
+ const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ PopupMenu *pMenu = GetPopupMenu(MN_AUTOCORR);
+ pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS);
+ sal_Bool bEnable = sal_False;
+ if( nStringCount )
+ {
+ Image aImage;
+ OUString aSuggestionImageUrl;
+ uno::Reference< container::XNamed > xNamed( xSpellAlt, uno::UNO_QUERY );
+ if (xNamed.is())
+ {
+ aSuggestionImageUrl = aCfg.GetSpellAndGrammarContextSuggestionImage( xNamed->getName(), bHC );
+ aImage = Image( lcl_GetImageFromPngUrl( aSuggestionImageUrl ) );
+ }
+
+ InsertSeparator(0);
+ bEnable = sal_True;
+ USHORT nAutoCorrItemId = MN_AUTOCORR_START;
+ USHORT nItemId = MN_SUGGESTION_START;
+ for (USHORT i = 0; i < nStringCount; ++i)
+ {
+ const String aEntry = aSuggestions[ i ];
+ InsertItem( nItemId, aEntry, 0, i );
+ SetHelpId( nItemId, HID_LINGU_REPLACE);
+ if (aSuggestionImageUrl.getLength() > 0)
+ SetItemImage( nItemId, aImage );
+
+ pMenu->InsertItem( nAutoCorrItemId, aEntry );
+ pMenu->SetHelpId( nAutoCorrItemId, HID_LINGU_AUTOCORR);
+
+ ++nAutoCorrItemId;
+ ++nItemId;
+ }
+ }
+
+ OUString aIgnoreSelection( String( SW_RES( STR_IGNORE_SELECTION ) ) );
+ OUString aSpellingAndGrammar = RetrieveLabelFromCommand( C2U(".uno:SpellingAndGrammarDialog") );
+ SetItemText( MN_SPELLING_DLG, aSpellingAndGrammar );
+ USHORT nItemPos = GetItemPos( MN_IGNORE_WORD );
+ InsertItem( MN_IGNORE_SELECTION, aIgnoreSelection, 0, nItemPos );
+ SetHelpId( MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION);
+
+ EnableItem( MN_AUTOCORR, bEnable );
+
+ uno::Reference< linguistic2::XLanguageGuessing > xLG = SW_MOD()->GetLanguageGuesser();
+ nGuessLangWord = LANGUAGE_NONE;
+ nGuessLangPara = LANGUAGE_NONE;
+ if (xSpellAlt.is() && xLG.is())
+ {
+ nGuessLangWord = lcl_CheckLanguage( xSpellAlt->getWord(), ::GetSpellChecker(), xLG, sal_False );
+ nGuessLangPara = lcl_CheckLanguage( rParaText, ::GetSpellChecker(), xLG, sal_True );
+ }
+ if (nGuessLangWord != LANGUAGE_NONE || nGuessLangPara != LANGUAGE_NONE)
+ {
+ // make sure LANGUAGE_NONE gets not used as menu entry
+ if (nGuessLangWord == LANGUAGE_NONE)
+ nGuessLangWord = nGuessLangPara;
+ if (nGuessLangPara == LANGUAGE_NONE)
+ nGuessLangPara = nGuessLangWord;
+ }
+
+ pMenu = GetPopupMenu(MN_ADD_TO_DIC);
+// pMenu->CreateAutoMnemonics();
+ pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS); //! necessary to retrieve the correct dictionary name in 'Execute' below
+ bEnable = FALSE; // enable MN_ADD_TO_DIC?
+ uno::Reference< linguistic2::XDictionaryList > xDicList( SvxGetDictionaryList() );
+ if (xDicList.is())
+ {
+ // add the default positive dictionary to dic-list (if not already done).
+ // This is to ensure that there is at least one dictionary to which
+ // words could be added.
+ uno::Reference< linguistic2::XDictionary > xDic( SvxGetOrCreatePosDic( xDicList ) );
+ if (xDic.is())
+ xDic->setActive( sal_True );
+
+ aDics = xDicList->getDictionaries();
+ const uno::Reference< linguistic2::XDictionary > *pDic = aDics.getConstArray();
+ USHORT nDicCount = static_cast< USHORT >(aDics.getLength());
+
+ USHORT nItemId = MN_DICTIONARIES_START;
+ for( USHORT i = 0; i < nDicCount; i++ )
+ {
+ uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY );
+ if (!xDicTmp.is() || SvxGetIgnoreAllList() == xDicTmp)
+ continue;
+
+ uno::Reference< frame::XStorable > xStor( xDicTmp, uno::UNO_QUERY );
+ LanguageType nActLanguage = SvxLocaleToLanguage( xDicTmp->getLocale() );
+ if( xDicTmp->isActive()
+ && xDicTmp->getDictionaryType() != linguistic2::DictionaryType_NEGATIVE
+ && (nCheckedLanguage == nActLanguage || LANGUAGE_NONE == nActLanguage )
+ && (!xStor.is() || !xStor->isReadonly()) )
+ {
+ // the extra 1 is because of the (possible) external
+ // linguistic entry above
+ pMenu->InsertItem( nItemId, xDicTmp->getName() );
+ bEnable = sal_True;
+
+ uno::Reference< lang::XServiceInfo > xSvcInfo( xDicTmp, uno::UNO_QUERY );
+ if (xSvcInfo.is())
+ {
+ OUString aDictionaryImageUrl( aCfg.GetSpellAndGrammarContextDictionaryImage(
+ xSvcInfo->getImplementationName(), bHC) );
+ if (aDictionaryImageUrl.getLength() > 0)
+ {
+ Image aImage( lcl_GetImageFromPngUrl( aDictionaryImageUrl ) );
+ pMenu->SetItemImage( nItemId, aImage );
+ }
+ }
+
+ ++nItemId;
+ }
+ }
+ }
+ EnableItem( MN_ADD_TO_DIC, bEnable );
+
+ //ADD NEW LANGUAGE MENU ITEM
+ ///////////////////////////////////////////////////////////////////////////
+ String aScriptTypesInUse( String::CreateFromInt32( pWrtSh->GetScriptType() ) );
+ SvtLanguageTable aLanguageTable;
+
+ // get keyboard language
+ String aKeyboardLang;
+ LanguageType nLang = LANGUAGE_DONTKNOW;
+ SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
+ nLang = rEditWin.GetInputLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aKeyboardLang = aLanguageTable.GetString( nLang );
+
+ // get the language that is in use
+ const String aMultipleLanguages = String::CreateFromAscii("*");
+ String aCurrentLang = aMultipleLanguages;
+ nLang = SwLangHelper::GetCurrentLanguage( *pWrtSh );
+ if (nLang != LANGUAGE_DONTKNOW)
+ aCurrentLang = aLanguageTable.GetString( nLang );
+
+ // build sequence for status value
+ uno::Sequence< OUString > aSeq( 4 );
+ aSeq[0] = aCurrentLang;
+ aSeq[1] = aScriptTypesInUse;
+ aSeq[2] = aKeyboardLang;
+ aSeq[3] = aLanguageTable.GetString(nGuessLangWord);
+
+ pMenu = GetPopupMenu(MN_SET_LANGUAGE_SELECTION);
+ fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_SELECTION_START, aSeq, pWrtSh, aLangTable_Text );
+ EnableItem( MN_SET_LANGUAGE_SELECTION, true );
+
+ pMenu = GetPopupMenu(MN_SET_LANGUAGE_PARAGRAPH);
+ fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_PARAGRAPH_START, aSeq, pWrtSh, aLangTable_Paragraph );
+ EnableItem( MN_SET_LANGUAGE_PARAGRAPH, true );
+/*
+ pMenu = GetPopupMenu(MN_SET_LANGUAGE_ALL_TEXT);
+ fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, aLangTable_Document );
+ EnableItem( MN_SET_LANGUAGE_ALL_TEXT, true );
+*/
+ uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface();
+ Image rImg = ::GetImage( xFrame,
+ OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False,
+ Application::GetSettings().GetStyleSettings().GetHighContrastMode() );
+ SetItemImage( MN_SPELLING_DLG, rImg );
+
+ //////////////////////////////////////////////////////////////////////////////////
+
+ RemoveDisabledEntries( TRUE, TRUE );
+}
+
+/*--------------------------------------------------------------------------
+
+---------------------------------------------------------------------------*/
+
+SwSpellPopup::SwSpellPopup(
+ SwWrtShell *pWrtSh,
+ const linguistic2::ProofreadingResult &rResult,
+ sal_Int32 nErrorInResult,
+ const uno::Sequence< OUString > &rSuggestions,
+ const String &rParaText ) :
+PopupMenu( SW_RES(MN_SPELL_POPUP) ),
+pSh( pWrtSh ),
+aSuggestions( rSuggestions ),
+bGrammarResults( true ),
+aInfo16( SW_RES(IMG_INFO_16) )
+{
+ nCheckedLanguage = SvxLocaleToLanguage( rResult.aLocale );
+
+ USHORT nPos = 0;
+ OUString aMessageText( rResult.aErrors[ nErrorInResult ].aShortComment );
+ InsertSeparator( nPos++ );
+ InsertItem( MN_SHORT_COMMENT, aMessageText, MIB_NOSELECT, nPos++ );
+ SetItemImage( MN_SHORT_COMMENT, aInfo16 );
+
+// CreateAutoMnemonics();
+ SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS);
+
+ InsertSeparator( nPos++ );
+ sal_Int32 nStringCount = aSuggestions.getLength();
+ if ( nStringCount ) // suggestions available...
+ {
+ Image aImage;
+ OUString aSuggestionImageUrl;
+ uno::Reference< lang::XServiceInfo > xInfo( rResult.xProofreader, uno::UNO_QUERY );
+ if (xInfo.is())
+ {
+ aSuggestionImageUrl = SvtLinguConfig().GetSpellAndGrammarContextSuggestionImage( xInfo->getImplementationName() );
+ aImage = Image( lcl_GetImageFromPngUrl( aSuggestionImageUrl ) );
+ }
+
+ USHORT nItemId = MN_SUGGESTION_START;
+ for (sal_uInt16 i = 0; i < nStringCount; ++i)
+ {
+ const String aEntry = aSuggestions[ i ];
+ InsertItem( nItemId, aEntry, 0, nPos++ );
+ SetHelpId( nItemId, HID_LINGU_REPLACE );
+ if (aSuggestionImageUrl.getLength() > 0)
+ SetItemImage( nItemId, aImage );
+
+ ++nItemId;
+ }
+ InsertSeparator( nPos++ );
+ }
+
+ OUString aIgnoreSelection( String( SW_RES( STR_IGNORE_SELECTION ) ) );
+ OUString aSpellingAndGrammar = RetrieveLabelFromCommand( C2U(".uno:SpellingAndGrammarDialog") );
+ SetItemText( MN_SPELLING_DLG, aSpellingAndGrammar );
+ USHORT nItemPos = GetItemPos( MN_IGNORE_WORD );
+ InsertItem( MN_IGNORE_SELECTION, aIgnoreSelection, 0, nItemPos );
+ SetHelpId( MN_IGNORE_SELECTION, HID_LINGU_IGNORE_SELECTION);
+
+ EnableItem( MN_AUTOCORR, false );
+
+ uno::Reference< linguistic2::XLanguageGuessing > xLG = SW_MOD()->GetLanguageGuesser();
+ nGuessLangWord = LANGUAGE_NONE;
+ nGuessLangPara = LANGUAGE_NONE;
+ if (xLG.is())
+ {
+// nGuessLangWord = lcl_CheckLanguage( xSpellAlt->getWord(), ::GetSpellChecker(), xLG, sal_False );
+ nGuessLangPara = lcl_CheckLanguage( rParaText, ::GetSpellChecker(), xLG, sal_True );
+ }
+ if (nGuessLangWord != LANGUAGE_NONE || nGuessLangPara != LANGUAGE_NONE)
+ {
+ // make sure LANGUAGE_NONE gets not used as menu entry
+ if (nGuessLangWord == LANGUAGE_NONE)
+ nGuessLangWord = nGuessLangPara;
+ if (nGuessLangPara == LANGUAGE_NONE)
+ nGuessLangPara = nGuessLangWord;
+ }
+
+ EnableItem( MN_IGNORE_WORD, false );
+ EnableItem( MN_ADD_TO_DIC, false );
+
+ //ADD NEW LANGUAGE MENU ITEM
+ ///////////////////////////////////////////////////////////////////////////
+ String aScriptTypesInUse( String::CreateFromInt32( pWrtSh->GetScriptType() ) );
+ SvtLanguageTable aLanguageTable;
+
+ // get keyboard language
+ String aKeyboardLang;
+ LanguageType nLang = LANGUAGE_DONTKNOW;
+ SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin();
+ nLang = rEditWin.GetInputLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aKeyboardLang = aLanguageTable.GetString( nLang );
+
+ // get the language that is in use
+ const String aMultipleLanguages = String::CreateFromAscii("*");
+ String aCurrentLang = aMultipleLanguages;
+ nLang = SwLangHelper::GetCurrentLanguage( *pWrtSh );
+ if (nLang != LANGUAGE_DONTKNOW)
+ aCurrentLang = aLanguageTable.GetString( nLang );
+
+ // build sequence for status value
+ uno::Sequence< OUString > aSeq( 4 );
+ aSeq[0] = aCurrentLang;
+ aSeq[1] = aScriptTypesInUse;
+ aSeq[2] = aKeyboardLang;
+ aSeq[3] = aLanguageTable.GetString(nGuessLangWord);
+
+ PopupMenu *pMenu = GetPopupMenu(MN_SET_LANGUAGE_SELECTION);
+ fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_SELECTION_START, aSeq, pWrtSh, aLangTable_Text );
+ EnableItem( MN_SET_LANGUAGE_SELECTION, true );
+
+ pMenu = GetPopupMenu(MN_SET_LANGUAGE_PARAGRAPH);
+ fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_PARAGRAPH_START, aSeq, pWrtSh, aLangTable_Paragraph );
+ EnableItem( MN_SET_LANGUAGE_PARAGRAPH, true );
+/*
+ pMenu = GetPopupMenu(MN_SET_LANGUAGE_ALL_TEXT);
+ fillLangPopupMenu( pMenu, MN_SET_LANGUAGE_ALL_TEXT_START, aSeq, pWrtSh, aLangTable_Document );
+ EnableItem( MN_SET_LANGUAGE_ALL_TEXT, true );
+*/
+ uno::Reference< frame::XFrame > xFrame = pWrtSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface();
+ Image rImg = ::GetImage( xFrame,
+ OUString::createFromAscii(".uno:SpellingAndGrammarDialog"), sal_False,
+ Application::GetSettings().GetStyleSettings().GetHighContrastMode() );
+ SetItemImage( MN_SPELLING_DLG, rImg );
+
+ //////////////////////////////////////////////////////////////////////////////////
+
+ RemoveDisabledEntries( TRUE, TRUE );
+}
+
+/*--------------------------------------------------------------------------
+
+---------------------------------------------------------------------------*/
+sal_uInt16 SwSpellPopup::Execute( const Rectangle& rWordPos, Window* pWin )
+{
+// SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS);
+ sal_uInt16 nRet = PopupMenu::Execute(pWin, pWin->LogicToPixel(rWordPos));
+ Execute( nRet );
+ return nRet;
+}
+/*-- 19.01.2006 08:15:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwSpellPopup::Execute( USHORT nId )
+{
+ if (nId == USHRT_MAX)
+ return;
+
+ if (/*bGrammarResults && */nId == MN_SHORT_COMMENT)
+ return; // nothing to do since it is the error message (short comment)
+
+ if ((MN_SUGGESTION_START <= nId && nId <= MN_SUGGESTION_END) ||
+ (MN_AUTOCORR_START <= nId && nId <= MN_AUTOCORR_END))
+ {
+ sal_Int32 nAltIdx = (MN_SUGGESTION_START <= nId && nId <= MN_SUGGESTION_END) ?
+ nId - MN_SUGGESTION_START : nId - MN_AUTOCORR_START;
+ DBG_ASSERT( 0 <= nAltIdx && nAltIdx < aSuggestions.getLength(), "index out of range" );
+ if (0 <= nAltIdx && nAltIdx < aSuggestions.getLength() && (bGrammarResults || xSpellAlt.is()))
+ {
+ sal_Bool bOldIns = pSh->IsInsMode();
+ pSh->SetInsMode( sal_True );
+
+ String aTmp( aSuggestions[ nAltIdx ] );
+ String aOrig( bGrammarResults ? OUString() : xSpellAlt->getWord() );
+
+ // if orginal word has a trailing . (likely the end of a sentence)
+ // and the replacement text hasn't, then add it to the replacement
+ if (aTmp.Len() && aOrig.Len() &&
+ '.' == aOrig.GetChar( aOrig.Len() - 1) && /* !IsAlphaNumeric ??*/
+ '.' != aTmp.GetChar( aTmp.Len() - 1))
+ {
+ aTmp += '.';
+ }
+
+ // #111827#
+ SwRewriter aRewriter;
+
+ aRewriter.AddRule(UNDO_ARG1, pSh->GetCrsrDescr());
+ aRewriter.AddRule(UNDO_ARG2, String(SW_RES(STR_YIELDS)));
+
+ String aTmpStr( SW_RES(STR_START_QUOTE) );
+ aTmpStr += aTmp;
+ aTmpStr += String(SW_RES(STR_END_QUOTE));
+ aRewriter.AddRule(UNDO_ARG3, aTmpStr);
+
+ pSh->StartUndo(UNDO_UI_REPLACE, &aRewriter);
+ pSh->StartAction();
+ pSh->DelLeft();
+
+ pSh->Insert( aTmp );
+
+ /* #102505# EndAction/EndUndo moved down since insertion
+ of temporary auto correction is now undoable two and
+ must reside in the same undo group.*/
+
+ // nur aufnehmen, wenn es NICHT schon in der Autokorrektur vorhanden ist
+ SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+
+ String aOrigWord( bGrammarResults ? OUString() : xSpellAlt->getWord() ) ;
+ String aNewWord( aSuggestions[ nAltIdx ] );
+ SvxPrepareAutoCorrect( aOrigWord, aNewWord );
+
+ if (MN_AUTOCORR_START <= nId && nId <= MN_AUTOCORR_END)
+ pACorr->PutText( aOrigWord, aNewWord, nCheckedLanguage );
+
+ /* #102505# EndAction/EndUndo moved down since insertion
+ of temporary auto correction is now undoable two and
+ must reside in the same undo group.*/
+ pSh->EndAction();
+ pSh->EndUndo();
+
+ pSh->SetInsMode( bOldIns );
+ }
+ }
+ else if (nId == MN_SPELLING_DLG)
+ {
+ if (bGrammarResults)
+ {
+ SvtLinguConfig().SetProperty( A2OU( UPN_IS_GRAMMAR_INTERACTIVE ), uno::makeAny( sal_True ));
+ }
+ pSh->Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ {
+ uno::Reference<linguistic2::XDictionaryList> xDictionaryList( SvxGetDictionaryList() );
+ SvxDicListChgClamp aClamp( xDictionaryList );
+ pSh->GetView().GetViewFrame()->GetDispatcher()->
+ Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON );
+ }
+ }
+ else if (nId == MN_IGNORE_SELECTION)
+ {
+ SwPaM *pPaM = pSh->GetCrsr();
+ if (pPaM)
+ pSh->IgnoreGrammarErrorAt( *pPaM );
+ }
+ else if (nId == MN_IGNORE_WORD)
+ {
+ uno::Reference< linguistic2::XDictionary > xDictionary( SvxGetIgnoreAllList(), uno::UNO_QUERY );
+ linguistic::AddEntryToDic( xDictionary,
+ xSpellAlt->getWord(), sal_False, aEmptyStr, LANGUAGE_NONE );
+ }
+ else if (MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END)
+ {
+ OUString aWord( xSpellAlt->getWord() );
+
+ PopupMenu *pMenu = GetPopupMenu(MN_ADD_TO_DIC);
+ String aDicName ( pMenu->GetItemText(nId) );
+
+ uno::Reference< linguistic2::XDictionary > xDic;
+ uno::Reference< linguistic2::XDictionaryList > xDicList( SvxGetDictionaryList() );
+ if (xDicList.is())
+ xDic = xDicList->getDictionaryByName( aDicName );
+
+ if (xDic.is())
+ {
+ INT16 nAddRes = linguistic::AddEntryToDic( xDic, aWord, FALSE, aEmptyStr, LANGUAGE_NONE );
+ // save modified user-dictionary if it is persistent
+ uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY );
+ if (xSavDic.is())
+ xSavDic->store();
+
+ if (DIC_ERR_NONE != nAddRes
+ && !xDic->getEntry( aWord ).is())
+ {
+ SvxDicError(
+ &pSh->GetView().GetViewFrame()->GetWindow(),
+ nAddRes );
+ }
+ }
+ }
+ else
+ {
+ // Set language for selection or for paragraph...
+
+ SfxItemSet aCoreSet( pSh->GetView().GetPool(),
+ RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
+ RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
+ RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
+ 0 );
+ String aNewLangTxt;
+
+ if (MN_SET_LANGUAGE_SELECTION_START <= nId && nId <= MN_SET_LANGUAGE_SELECTION_END)
+ {
+ //Set language for current selection
+ aNewLangTxt = aLangTable_Text[nId];
+ SwLangHelper::SetLanguage( *pSh, aNewLangTxt, true, aCoreSet );
+ }
+ else if (nId == MN_SET_SELECTION_NONE)
+ {
+ //Set Language_None for current selection
+ SwLangHelper::SetLanguage_None( *pSh, true, aCoreSet );
+ }
+ else if (nId == MN_SET_SELECTION_RESET)
+ {
+ //reset languages for current selection
+ SwLangHelper::ResetLanguages( *pSh, true );
+ }
+ else if (nId == MN_SET_SELECTION_MORE)
+ {
+ //Open Format/Character Dialog
+ lcl_CharDialog( *pSh, true, nId, 0, 0 );
+ }
+ else if (MN_SET_LANGUAGE_PARAGRAPH_START <= nId && nId <= MN_SET_LANGUAGE_PARAGRAPH_END)
+ {
+ //Set language for current paragraph
+ aNewLangTxt = aLangTable_Paragraph[nId];
+ pSh->Push(); // save cursor
+ SwLangHelper::SelectCurrentPara( *pSh );
+ SwLangHelper::SetLanguage( *pSh, aNewLangTxt, true, aCoreSet );
+ pSh->Pop( FALSE ); // restore cursor
+ }
+ else if (nId == MN_SET_PARA_NONE)
+ {
+ //Set Language_None for current paragraph
+ pSh->Push(); // save cursor
+ SwLangHelper::SelectCurrentPara( *pSh );
+ SwLangHelper::SetLanguage_None( *pSh, true, aCoreSet );
+ pSh->Pop( FALSE ); // restore cursor
+ }
+ else if (nId == MN_SET_PARA_RESET)
+ {
+ //reset languages for current paragraph
+ pSh->Push(); // save cursor
+ SwLangHelper::SelectCurrentPara( *pSh );
+ SwLangHelper::ResetLanguages( *pSh, true );
+ pSh->Pop( FALSE ); // restore cursor
+ }
+ else if (nId == MN_SET_PARA_MORE)
+ {
+ pSh->Push(); // save cursor
+ SwLangHelper::SelectCurrentPara( *pSh );
+ //Open Format/Character Dialog
+ lcl_CharDialog( *pSh, true, nId, 0, 0 );
+ pSh->Pop( FALSE ); // restore cursor
+ }
+#if 0
+ else if (nId == MN_SET_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries - 1)
+ {
+ //Set Language_None as the default language
+ SwLangHelper::SetLanguage_None( *pSh, false, aCoreSet );
+ }
+ else if (nId == MN_SET_LANGUAGE_ALL_TEXT_START + nNumLanguageDocEntries)
+ {
+ // open the dialog "Tools/Options/Language Settings - Language"
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ if (pFact)
+ {
+ VclAbstractDialog* pDlg = pFact->CreateVclDialog( pSh->GetView().GetWindow(), SID_LANGUAGE_OPTIONS );
+ pDlg->Execute();
+ delete pDlg;
+ }
+ }
+#endif
+ }
+
+ pSh->EnterStdMode();
+}
diff --git a/sw/source/ui/lingu/olmenu.hrc b/sw/source/ui/lingu/olmenu.hrc
new file mode 100644
index 000000000000..887f8a2ad3af
--- /dev/null
+++ b/sw/source/ui/lingu/olmenu.hrc
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _OLMENU_HRC
+#define _OLMENU_HRC
+
+#include "rcid.hrc"
+
+#define MN_SPELL_POPUP (RC_LINGU_BEGIN + 1)
+#define STR_SPELL_OK (RC_LINGU_BEGIN + 2)
+#define STR_HYP_OK (RC_LINGU_BEGIN + 3)
+#define STR_WORD (RC_LINGU_BEGIN + 4)
+#define STR_PARAGRAPH (RC_LINGU_BEGIN + 5)
+#define STR_LANGSTATUS_NONE (RC_LINGU_BEGIN + 6)
+#define STR_LANGSTATUS_MORE (RC_LINGU_BEGIN + 7)
+#define STR_IGNORE_SELECTION (RC_LINGU_BEGIN + 8)
+#define STR_RESET_TO_DEFAULT_LANGUAGE (RC_LINGU_BEGIN + 9)
+
+#define IMG_INFO_16 (RC_LINGU_BEGIN + 100)
+
+//! Don't change these values. You may break context menu modifying extensions!
+#define MN_SPELLING_DLG 200
+#define MN_IGNORE_SELECTION 201
+#define MN_IGNORE_WORD 202
+#define MN_ADD_TO_DIC 203
+#define MN_AUTOCORR 204
+#define MN_SET_LANGUAGE_SELECTION 205
+#define MN_SET_LANGUAGE_PARAGRAPH 206
+#define MN_SET_LANGUAGE_ALL_TEXT 207
+#define MN_SHORT_COMMENT 208
+
+// id range for dictionaries sub menu
+#define MN_DICTIONARIES_START 300
+#define MN_DICTIONARIES_END (MN_DICTIONARIES_START + 99)
+
+// id range for suggestions from spell and grammar checker
+#define MN_SUGGESTION_START 500
+#define MN_SUGGESTION_END (MN_SUGGESTION_START + MN_MAX_NUM_LANG)
+
+// id range for auto correction sub menu entries
+#define MN_AUTOCORR_START 700
+#define MN_AUTOCORR_END (MN_AUTOCORR_START + MN_MAX_NUM_LANG)
+
+// max number of language entries sub menus
+#define MN_MAX_NUM_LANG 99
+
+#define MN_NONE_OFFSET (MN_MAX_NUM_LANG + 1)
+#define MN_RESET_OFFSET (MN_MAX_NUM_LANG + 2)
+#define MN_MORE_OFFSET (MN_MAX_NUM_LANG + 3)
+
+// id range for 'set language for selection' sub menu entries
+#define MN_SET_LANGUAGE_SELECTION_START 900
+#define MN_SET_LANGUAGE_SELECTION_END (MN_SET_LANGUAGE_SELECTION_START + MN_MAX_NUM_LANG)
+#define MN_SET_SELECTION_NONE (MN_SET_LANGUAGE_SELECTION_START + MN_NONE_OFFSET)
+#define MN_SET_SELECTION_RESET (MN_SET_LANGUAGE_SELECTION_START + MN_RESET_OFFSET)
+#define MN_SET_SELECTION_MORE (MN_SET_LANGUAGE_SELECTION_START + MN_MORE_OFFSET)
+
+// id range for 'set language for paragraph' sub menu entries
+#define MN_SET_LANGUAGE_PARAGRAPH_START 1100
+#define MN_SET_LANGUAGE_PARAGRAPH_END (MN_SET_LANGUAGE_PARAGRAPH_START + MN_MAX_NUM_LANG)
+#define MN_SET_PARA_NONE (MN_SET_LANGUAGE_PARAGRAPH_START + MN_NONE_OFFSET)
+#define MN_SET_PARA_RESET (MN_SET_LANGUAGE_PARAGRAPH_START + MN_RESET_OFFSET)
+#define MN_SET_PARA_MORE (MN_SET_LANGUAGE_PARAGRAPH_START + MN_MORE_OFFSET)
+
+// id range for 'set language for all text' sub menu entries
+#define MN_SET_LANGUAGE_ALL_TEXT_START 1300
+#define MN_SET_LANGUAGE_ALL_TEXT_END (MN_SET_LANGUAGE_ALL_TEXT_START + MN_MAX_NUM_LANG)
+
+#endif
+
+
+
+
diff --git a/sw/source/ui/lingu/olmenu.src b/sw/source/ui/lingu/olmenu.src
new file mode 100644
index 000000000000..b8d9124d2e52
--- /dev/null
+++ b/sw/source/ui/lingu/olmenu.src
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* StarView ressource file */
+
+#include "olmenu.hrc"
+#include "helpid.h"
+
+#define MASKCOLOR MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
+#define SEPARATOR MenuItem { Separator = TRUE; };
+
+Menu MN_SPELL_POPUP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_IGNORE_WORD ;
+ HelpID = HID_LINGU_IGNORE_WORD ;
+ Text [ en-US ] = "Ignore All" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_ADD_TO_DIC ;
+ HelpID = HID_LINGU_ADD_WORD ;
+ SubMenu = Menu
+ {
+ };
+ Text [ en-US ] = "~Add" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_AUTOCORR ;
+ HelpID = HID_LINGU_AUTOCORR ;
+ SubMenu = Menu
+ {
+ };
+ Text [ en-US ] = "AutoCorrect" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_SPELLING_DLG ;
+ HelpID = HID_LINGU_SPELLING_DLG ;
+ Text [ en-US ] = "~Spellcheck..." ;
+ };
+ SEPARATOR
+ MenuItem
+ {
+ Identifier = MN_SET_LANGUAGE_SELECTION ;
+ SubMenu = Menu
+ {
+ };
+ Text [ en-US ] = "Set Language for Selection" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_SET_LANGUAGE_PARAGRAPH ;
+ SubMenu = Menu
+ {
+ };
+ Text [ en-US ] = "Set Language for Paragraph" ;
+ };
+/*
+ MenuItem
+ {
+ Identifier = MN_SET_LANGUAGE_ALL_TEXT ;
+ SubMenu = Menu
+ {
+ };
+ Text [ en-US ] = "Set Language for all Text" ;
+ };
+*/
+ };
+};
+String STR_WORD
+{
+ Text [ en-US ] = "Word is " ;
+};
+String STR_PARAGRAPH
+{
+ Text [ en-US ] = "Paragraph is " ;
+};
+String STR_SPELL_OK
+{
+ Text [ en-US ] = "The spellcheck is complete." ;
+};
+String STR_HYP_OK
+{
+ Text [ en-US ] = "Hyphenation completed" ;
+};
+String STR_LANGSTATUS_NONE
+{
+ Text [ en-US ] = "None (Do not check spelling)" ;
+};
+String STR_RESET_TO_DEFAULT_LANGUAGE
+{
+ Text [ en-US ] = "Reset to Default Language" ;
+ Text [ x-comment ] = " ";
+};
+String STR_LANGSTATUS_MORE
+{
+ Text [ en-US ] = "More..." ;
+};
+String STR_IGNORE_SELECTION
+{
+ Text [ en-US ] = "Ignore" ;
+};
+
+Image IMG_INFO_16
+{
+ ImageBitmap = Bitmap { File = "info_16.png" ; };
+ MASKCOLOR
+};
+
diff --git a/sw/source/ui/lingu/sdrhhcwrap.cxx b/sw/source/ui/lingu/sdrhhcwrap.cxx
new file mode 100644
index 000000000000..32127f413e1a
--- /dev/null
+++ b/sw/source/ui/lingu/sdrhhcwrap.cxx
@@ -0,0 +1,235 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <hintids.hxx>
+#include <svx/svditer.hxx>
+#include <svx/svdotext.hxx>
+#include <editeng/editdata.hxx>
+#include <svx/svdpagv.hxx>
+#include <svx/svdogrp.hxx>
+#include <sfx2/printer.hxx>
+#include <svx/svdmodel.hxx>
+#include <editeng/langitem.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <linguistic/lngprops.hxx>
+#include <sfx2/sfxuno.hxx>
+#include <svx/svdview.hxx>
+#include <editeng/unolingu.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <sdrhhcwrap.hxx>
+#include <frmfmt.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx> // " " "
+#endif
+#include <wrtsh.hxx> // MakeVisible
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <dcontact.hxx> // Spelling von DrawObj
+#include <doc.hxx> // " " "
+#include <docary.hxx>
+#include <edtwin.hxx>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+//////////////////////////////////////////////////////////////////////
+
+SdrHHCWrapper::SdrHHCWrapper( SwView* pVw,
+ LanguageType nSourceLanguage, LanguageType nTargetLanguage,
+ const Font* pTargetFnt,
+ sal_Int32 nConvOptions,
+ sal_Bool bInteractive ) :
+ SdrOutliner(pVw->GetDocShell()->GetDoc()->GetDrawModel()->
+ GetDrawOutliner().GetEmptyItemSet().GetPool(),
+ OUTLINERMODE_TEXTOBJECT ),
+ pView( pVw ),
+ pTextObj( NULL ),
+ pOutlView( NULL ),
+ pListIter( NULL ),
+ nOptions( nConvOptions ),
+ nDocIndex( 0 ),
+ nSourceLang( nSourceLanguage ),
+ nTargetLang( nTargetLanguage ),
+ pTargetFont( pTargetFnt ),
+ bIsInteractive( bInteractive )
+{
+ SetRefDevice( pView->GetDocShell()->GetDoc()->getPrinter( false ) );
+
+ MapMode aMapMode (MAP_TWIP);
+ SetRefMapMode(aMapMode);
+
+ Size aSize( 1, 1 );
+ SetPaperSize( aSize );
+
+ pOutlView = new OutlinerView( this, &(pView->GetEditWin()) );
+ pOutlView->GetOutliner()->SetRefDevice(pView->GetWrtShell().getIDocumentDeviceAccess()->getPrinter( false ));
+
+ // Hack: Es sollten alle SdrTextObj-Attribute an die EditEngine
+ // uebertragen werden.
+ pOutlView->SetBackgroundColor( Color( COL_WHITE ) );
+
+
+ InsertView( pOutlView );
+ Point aPoint( 0, 0 );
+ Rectangle aRect( aPoint, aSize );
+ pOutlView->SetOutputArea( aRect );
+// SetText( NULL );
+ ClearModifyFlag();
+}
+
+SdrHHCWrapper::~SdrHHCWrapper()
+{
+ if (pTextObj)
+ {
+ SdrView *pSdrView = pView->GetWrtShell().GetDrawView();
+ ASSERT( pSdrView, "SdrHHCWrapper without DrawView?" );
+ pSdrView->SdrEndTextEdit( sal_True );
+ SetUpdateMode(sal_False);
+ pOutlView->SetOutputArea( Rectangle( Point(), Size(1, 1) ) );
+// SetPaperSize( Size(1, 1) );
+// SetText(NULL);
+// pTextObj = NULL;
+ }
+ RemoveView( pOutlView );
+ delete pOutlView;
+}
+
+
+void SdrHHCWrapper::StartTextConversion()
+{
+ pOutlView->StartTextConversion( nSourceLang, nTargetLang, pTargetFont, nOptions, bIsInteractive, sal_True );
+}
+
+
+sal_Bool SdrHHCWrapper::ConvertNextDocument()
+{
+ sal_Bool bNextDoc = sal_False;
+
+ if ( pTextObj )
+ {
+ SdrView *pSdrView = pView->GetWrtShell().GetDrawView();
+ ASSERT( pSdrView, "SdrHHCWrapper without DrawView?" );
+ pSdrView->SdrEndTextEdit( sal_True );
+ SetUpdateMode(sal_False);
+ pOutlView->SetOutputArea( Rectangle( Point(), Size(1, 1) ) );
+ SetPaperSize( Size(1, 1) );
+ Clear();
+ pTextObj = NULL;
+ }
+
+ sal_uInt16 n = nDocIndex;
+
+ while( !bNextDoc && ( pListIter ||
+ n < pView->GetDocShell()->GetDoc()->GetSpzFrmFmts()->Count() ) )
+ {
+ while( !pTextObj && pListIter )
+ {
+ if( pListIter->IsMore() )
+ {
+ SdrObject* pSdrO = pListIter->Next();
+ if( pSdrO && pSdrO->IsA( TYPE(SdrTextObj) ) &&
+ ( (SdrTextObj*) pSdrO )->HasText() )
+ pTextObj = (SdrTextObj*) pSdrO;
+ }
+ else
+ {
+ delete pListIter;
+ pListIter = NULL;
+ }
+ }
+
+ if ( !pTextObj &&
+ n < pView->GetDocShell()->GetDoc()->GetSpzFrmFmts()->Count() )
+ {
+ SwFrmFmt* pFly = (*pView->GetDocShell()->GetDoc()->GetSpzFrmFmts())[ n ];
+ if( pFly->IsA( TYPE(SwDrawFrmFmt) ) )
+ {
+ SwClientIter aIter( (SwFmt&) *pFly );
+ if( aIter.First( TYPE(SwDrawContact) ) )
+ {
+ SdrObject* pSdrO = ((SwDrawContact*)aIter())->GetMaster();
+ if ( pSdrO )
+ {
+ if ( pSdrO->IsA( TYPE(SdrObjGroup) ) )
+ pListIter = new SdrObjListIter( *pSdrO, IM_DEEPNOGROUPS );
+ else if( pSdrO->IsA( TYPE(SdrTextObj) ) &&
+ ( (SdrTextObj*) pSdrO )->HasText() )
+ pTextObj = (SdrTextObj*) pSdrO;
+ }
+ }
+ }
+ ++n;
+ }
+ if ( pTextObj )
+ {
+ OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject();
+
+ if ( pParaObj )
+ {
+ SetPaperSize( pTextObj->GetLogicRect().GetSize() );
+ SetText( *pParaObj );
+
+ ClearModifyFlag();
+
+ //!! update mode needs to be set to true otherwise
+ //!! the call to 'HasConvertibleTextPortion' will not always
+ //!! work correctly because the document may not be properly
+ //!! formatted when some information is accessed, and thus
+ //!! incorrect results get returned.
+ SetUpdateMode(sal_True);
+ if (HasConvertibleTextPortion( nSourceLang ))
+ {
+ SdrView *pSdrView = pView->GetWrtShell().GetDrawView();
+ ASSERT( pSdrView, "SdrHHCWrapper without DrawView?" );
+ SdrPageView* pPV = pSdrView->GetSdrPageView();
+ nDocIndex = n;
+ bNextDoc = sal_True;
+ pOutlView->SetOutputArea( Rectangle( Point(), Size(1,1)));
+ SetPaperSize( pTextObj->GetLogicRect().GetSize() );
+ SetUpdateMode(sal_True);
+ pView->GetWrtShell().MakeVisible(pTextObj->GetLogicRect());
+
+ pSdrView->SdrBeginTextEdit(pTextObj, pPV, &pView->GetEditWin(), sal_False, this, pOutlView, sal_True, sal_True);
+ }
+ else
+ SetUpdateMode(sal_False);
+ }
+ if ( !bNextDoc )
+ pTextObj = NULL;
+ }
+ }
+
+ ClearModifyFlag();
+
+ return bNextDoc;
+}
+
+//////////////////////////////////////////////////////////////////////
+
diff --git a/sw/source/ui/lingu/sdrhhcwrap.hxx b/sw/source/ui/lingu/sdrhhcwrap.hxx
new file mode 100644
index 000000000000..795e357e28c3
--- /dev/null
+++ b/sw/source/ui/lingu/sdrhhcwrap.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SDRHHCWRAP_HXX_
+#define _SDRHHCWRAP_HXX_
+
+#include <svx/svdoutl.hxx>
+
+class SwView;
+class SdrTextObj;
+class OutlinerView;
+class SdrObjListIter;
+
+//////////////////////////////////////////////////////////////////////
+
+class SdrHHCWrapper : public SdrOutliner
+{
+ // modified version of SdrSpeller
+
+ SwView* pView;
+ SdrTextObj* pTextObj;
+ OutlinerView* pOutlView;
+ SdrObjListIter* pListIter;
+ sal_Int32 nOptions;
+ sal_uInt16 nDocIndex;
+ LanguageType nSourceLang;
+ LanguageType nTargetLang;
+ const Font* pTargetFont;
+ sal_Bool bIsInteractive;
+
+public:
+ SdrHHCWrapper( SwView* pVw,
+ LanguageType nSourceLanguage, LanguageType nTargetLanguage,
+ const Font* pTargetFnt,
+ sal_Int32 nConvOptions, sal_Bool bInteractive );
+
+ virtual ~SdrHHCWrapper();
+
+ virtual sal_Bool ConvertNextDocument();
+ void StartTextConversion();
+};
+
+//////////////////////////////////////////////////////////////////////
+
+#endif
+
diff --git a/sw/source/ui/misc/autocorr.src b/sw/source/ui/misc/autocorr.src
new file mode 100644
index 000000000000..1807d12744e4
--- /dev/null
+++ b/sw/source/ui/misc/autocorr.src
@@ -0,0 +1,29 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* StarView ressource file */
+
+
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
new file mode 100644
index 000000000000..feae6a64398a
--- /dev/null
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -0,0 +1,304 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <sfx2/request.hxx>
+#include <svl/stritem.hxx>
+#include <vcl/msgbox.hxx>
+
+
+#include "view.hxx"
+#include "basesh.hxx"
+#include "wrtsh.hxx" //
+#include "cmdid.h"
+#include "bookmark.hxx" // SwInsertBookmarkDlg
+#include "IMark.hxx"
+#include "bookmark.hrc"
+#include "misc.hrc"
+
+
+const String BookmarkCombo::aForbiddenChars = String::CreateFromAscii("/\\@:*?\";,.#");
+
+
+IMPL_LINK( SwInsertBookmarkDlg, ModifyHdl, BookmarkCombo *, pBox )
+{
+ BOOL bSelEntries = pBox->GetSelectEntryCount() != 0;
+ // if a string has been pasted from the clipboard then
+ // there may be illegal characters in the box
+ if(!bSelEntries)
+ {
+ String sTmp = pBox->GetText();
+ USHORT nLen = sTmp.Len();
+ String sMsg;
+ for(USHORT i = 0; i < BookmarkCombo::aForbiddenChars.Len(); i++)
+ {
+ USHORT nTmpLen = sTmp.Len();
+ sTmp.EraseAllChars(BookmarkCombo::aForbiddenChars.GetChar(i));
+ if(sTmp.Len() != nTmpLen)
+ sMsg += BookmarkCombo::aForbiddenChars.GetChar(i);
+ }
+ if(sTmp.Len() != nLen)
+ {
+ pBox->SetText(sTmp);
+ String sWarning(sRemoveWarning);
+ sWarning += sMsg;
+ InfoBox(this, sWarning).Execute();
+ }
+
+
+ }
+
+ aOkBtn.Enable(!bSelEntries); // neue Textmarke
+ aDeleteBtn.Enable(bSelEntries); // loeschbar?
+
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Callback zum Loeschen einer Textmarke
+ -----------------------------------------------------------------------*/
+
+IMPL_LINK( SwInsertBookmarkDlg, DeleteHdl, Button *, EMPTYARG )
+{
+ // Textmarken aus der ComboBox entfernen
+
+ for (USHORT i = aBookmarkBox.GetSelectEntryCount(); i; i-- )
+ aBookmarkBox.RemoveEntry(aBookmarkBox.GetSelectEntryPos(i - 1));
+
+ aBookmarkBox.SetText(aEmptyStr);
+ aDeleteBtn.Enable(FALSE); // keine weiteren Eintraege vorhanden
+ // aBookmarkBox.SetText(aEmptyStr);
+
+ aOkBtn.Enable(); // Im OK Handler wird geloescht
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Callback fuer OKButton. Fuegt eine neue Textmarke
+ an die akt. Position ein. Geloeschte Textmarken werden auch am Modell
+ entfernt.
+ -----------------------------------------------------------------------*/
+
+
+void SwInsertBookmarkDlg::Apply()
+{
+ //at first remove deleted bookmarks to prevent multiple bookmarks with the same
+ //name
+ for (USHORT nCount = aBookmarkBox.GetRemovedCount(); nCount > 0; nCount--)
+ {
+ String sRemoved = aBookmarkBox.GetRemovedEntry( nCount -1 ).GetName();
+ IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
+ pMarkAccess->deleteMark( pMarkAccess->findMark(sRemoved) );
+ SfxRequest aReq( rSh.GetView().GetViewFrame(), FN_DELETE_BOOKMARK );
+ aReq.AppendItem( SfxStringItem( FN_DELETE_BOOKMARK, sRemoved ) );
+ aReq.Done();
+ }
+
+ // Textmarke einfuegen
+ USHORT nLen = aBookmarkBox.GetText().Len();
+ SwBoxEntry aTmpEntry(aBookmarkBox.GetText(), 0 );
+
+ if ( nLen && (aBookmarkBox.GetEntryPos(aTmpEntry) == COMBOBOX_ENTRY_NOTFOUND) )
+ {
+ String sEntry(aBookmarkBox.GetText());
+ sEntry.EraseAllChars(aBookmarkBox.GetMultiSelectionSeparator());
+
+ rSh.SetBookmark( KeyCode(), sEntry, aEmptyStr );
+ rReq.AppendItem( SfxStringItem( FN_INSERT_BOOKMARK, sEntry ) );
+ rReq.Done();
+ }
+
+ if ( !rReq.IsDone() )
+ rReq.Ignore();
+
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: CTOR
+ -----------------------------------------------------------------------*/
+
+
+SwInsertBookmarkDlg::SwInsertBookmarkDlg( Window *pParent, SwWrtShell &rS, SfxRequest& rRequest ) :
+
+ SvxStandardDialog(pParent,SW_RES(DLG_INSERT_BOOKMARK)),
+
+ aBookmarkBox(this,SW_RES(CB_BOOKMARK)),
+ aBookmarkFl(this,SW_RES(FL_BOOKMARK)),
+ aOkBtn(this,SW_RES(BT_OK)),
+ aCancelBtn(this,SW_RES(BT_CANCEL)),
+ aDeleteBtn(this,SW_RES(BT_DELETE)),
+ rSh( rS ),
+ rReq( rRequest )
+{
+ aBookmarkBox.SetModifyHdl(LINK(this, SwInsertBookmarkDlg, ModifyHdl));
+ aBookmarkBox.EnableMultiSelection(TRUE);
+ aBookmarkBox.EnableAutocomplete( TRUE, TRUE );
+
+ aDeleteBtn.SetClickHdl(LINK(this, SwInsertBookmarkDlg, DeleteHdl));
+
+ // Combobox mit vorhandenen Bookmarks fuellen
+ IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
+ USHORT nId = 0;
+ for( IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin();
+ ppBookmark != pMarkAccess->getBookmarksEnd();
+ ppBookmark++)
+ {
+ if(IDocumentMarkAccess::BOOKMARK == IDocumentMarkAccess::GetType(**ppBookmark))
+ aBookmarkBox.InsertEntry( SwBoxEntry( ppBookmark->get()->GetName(), nId++ ) );
+ }
+ FreeResource();
+ sRemoveWarning = String(SW_RES(STR_REMOVE_WARNING));
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+ -----------------------------------------------------------------------*/
+
+SwInsertBookmarkDlg::~SwInsertBookmarkDlg()
+{
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+ -----------------------------------------------------------------------*/
+
+BookmarkCombo::BookmarkCombo( Window* pWin, const ResId& rResId ) :
+ SwComboBox(pWin, rResId)
+{
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+ -----------------------------------------------------------------------*/
+
+USHORT BookmarkCombo::GetFirstSelEntryPos() const
+{
+ return GetSelEntryPos(0);
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+ -----------------------------------------------------------------------*/
+
+USHORT BookmarkCombo::GetNextSelEntryPos(USHORT nPos) const
+{
+ return GetSelEntryPos(nPos + 1);
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+ -----------------------------------------------------------------------*/
+
+USHORT BookmarkCombo::GetSelEntryPos(USHORT nPos) const
+{
+ sal_Unicode cSep = GetMultiSelectionSeparator();
+
+ USHORT nCnt = GetText().GetTokenCount(cSep);
+
+ for (; nPos < nCnt; nPos++)
+ {
+ String sEntry(GetText().GetToken(nPos, cSep));
+ sEntry.EraseLeadingChars();
+ sEntry.EraseTrailingChars();
+ if (GetEntryPos(sEntry) != COMBOBOX_ENTRY_NOTFOUND)
+ return nPos;
+ }
+
+ return COMBOBOX_ENTRY_NOTFOUND;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+ -----------------------------------------------------------------------*/
+
+USHORT BookmarkCombo::GetSelectEntryCount() const
+{
+ USHORT nCnt = 0;
+
+ USHORT nPos = GetFirstSelEntryPos();
+ while (nPos != COMBOBOX_ENTRY_NOTFOUND)
+ {
+ nPos = GetNextSelEntryPos(nPos);
+ nCnt++;
+ }
+
+ return nCnt;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Position in der Listbox (der ComboBox)
+ -----------------------------------------------------------------------*/
+
+USHORT BookmarkCombo::GetSelectEntryPos( USHORT nSelIndex ) const
+{
+ USHORT nCnt = 0;
+ USHORT nPos = GetFirstSelEntryPos();
+
+ while (nPos != COMBOBOX_ENTRY_NOTFOUND)
+ {
+ if (nSelIndex == nCnt)
+ {
+ sal_Unicode cSep = GetMultiSelectionSeparator();
+ String sEntry(GetText().GetToken(nPos, cSep));
+ sEntry.EraseLeadingChars();
+ sEntry.EraseTrailingChars();
+
+ return GetEntryPos(sEntry);
+ }
+ nPos = GetNextSelEntryPos(nPos);
+ nCnt++;
+ }
+
+ return COMBOBOX_ENTRY_NOTFOUND;
+}
+/* -----------------05.02.99 08:39-------------------
+ *
+ * --------------------------------------------------*/
+long BookmarkCombo::PreNotify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+ if( EVENT_KEYINPUT == rNEvt.GetType() &&
+ rNEvt.GetKeyEvent()->GetCharCode() )
+ {
+ String sKey( rNEvt.GetKeyEvent()->GetCharCode() );
+ if(STRING_NOTFOUND != aForbiddenChars.Search(sKey))
+ nHandled = 1;
+ }
+ if(!nHandled)
+ nHandled = SwComboBox::PreNotify( rNEvt );
+ return nHandled;
+}
+
+
+
diff --git a/sw/source/ui/misc/bookmark.hrc b/sw/source/ui/misc/bookmark.hrc
new file mode 100644
index 000000000000..3320e3774516
--- /dev/null
+++ b/sw/source/ui/misc/bookmark.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#define CB_BOOKMARK 1
+#define FL_BOOKMARK 2
+
+#define BT_OK 20
+#define BT_CANCEL 21
+#define BT_DELETE 22
diff --git a/sw/source/ui/misc/bookmark.src b/sw/source/ui/misc/bookmark.src
new file mode 100644
index 000000000000..54e4bad5c5cf
--- /dev/null
+++ b/sw/source/ui/misc/bookmark.src
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "misc.hrc"
+#include "bookmark.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ModalDialog DLG_INSERT_BOOKMARK
+{
+ HelpID = CMD_FN_INSERT_BOOKMARK ;
+ OUTPUTSIZE = TRUE ;
+ Size = MAP_APPFONT ( 179 , 96 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Textmarke einfügen : Textmarke einf³gen */
+ Text [ en-US ] = "Insert Bookmark" ;
+ MOVEABLE = TRUE ;
+ SVLOOK = TRUE ;
+ OkButton BT_OK
+ {
+ DISABLE = TRUE ;
+ Pos = MAP_APPFONT ( 123 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TABSTOP = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 123 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TABSTOP = TRUE ;
+ };
+ ComboBox CB_BOOKMARK
+ {
+ HelpID = "sw:ComboBox:DLG_INSERT_BOOKMARK:CB_BOOKMARK";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 99 , 76 ) ;
+ TABSTOP = TRUE ;
+ AutoHScroll = TRUE ;
+ SORT = TRUE ;
+ };
+ PushButton BT_DELETE
+ {
+ HelpID = "sw:PushButton:DLG_INSERT_BOOKMARK:BT_DELETE";
+ Pos = MAP_APPFONT ( 123 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Löschen : ~L÷schen */
+ Text [ en-US ] = "~Delete" ;
+ TABSTOP = TRUE ;
+ DISABLE = TRUE ;
+ };
+ FixedLine FL_BOOKMARK
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 111 , 8 ) ;
+ Text [ en-US ] = "Bookmarks" ;
+ };
+};
+String STR_REMOVE_WARNING
+{
+ Text [ en-US ] = "The following characters are not valid and have been removed: ";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx
new file mode 100644
index 000000000000..67fc32bcf1c9
--- /dev/null
+++ b/sw/source/ui/misc/docfnote.cxx
@@ -0,0 +1,500 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <svl/style.hxx>
+#include <errhdl.hxx>
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <docfnote.hxx>
+#include <impfnote.hxx>
+#include <ftninfo.hxx>
+#include <fmtcol.hxx>
+#include <pagedesc.hxx>
+#include <charfmt.hxx>
+#include <docstyle.hxx>
+#include <wdocsh.hxx>
+#include <uitool.hxx>
+#include <poolfmt.hxx>
+#include <swstyle.h>
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#ifndef _MISC_HRC
+#include <misc.hrc>
+#endif
+#ifndef _DOCFNOTE_HRC
+#include <docfnote.hrc>
+#endif
+#ifndef _FRMUI_HRC
+#include <frmui.hrc>
+#endif
+#include <SwStyleNameMapper.hxx>
+
+SwFootNoteOptionDlg::SwFootNoteOptionDlg( Window *pParent, SwWrtShell &rS ) :
+ SfxTabDialog( pParent, SW_RES(DLG_DOC_FOOTNOTE) ),
+ rSh( rS )
+{
+ FreeResource();
+ RemoveResetButton();
+
+ aOldOkHdl = GetOKButton().GetClickHdl();
+ GetOKButton().SetClickHdl( LINK( this, SwFootNoteOptionDlg, OkHdl ) );
+
+ AddTabPage( TP_FOOTNOTEOPTION, SwFootNoteOptionPage::Create, 0 );
+ AddTabPage( TP_ENDNOTEOPTION, SwEndNoteOptionPage::Create, 0 );
+}
+
+void SwFootNoteOptionDlg::PageCreated( USHORT /*nId*/, SfxTabPage &rPage )
+{
+ ((SwEndNoteOptionPage&)rPage).SetShell( rSh );
+}
+
+SwFootNoteOptionDlg::~SwFootNoteOptionDlg()
+{
+}
+
+IMPL_LINK( SwFootNoteOptionDlg, OkHdl, Button *, pBtn )
+{
+ SfxItemSet aDummySet(rSh.GetAttrPool(), 1, 1 );
+ SfxTabPage *pPage = GetTabPage( TP_FOOTNOTEOPTION );
+ if ( pPage )
+ pPage->FillItemSet( aDummySet );
+ pPage = GetTabPage( TP_ENDNOTEOPTION );
+ if ( pPage )
+ pPage->FillItemSet( aDummySet );
+ aOldOkHdl.Call( pBtn );
+ return 0;
+}
+
+
+//----------------------------------------------------------------------
+
+
+SwEndNoteOptionPage::SwEndNoteOptionPage( Window *pParent, BOOL bEN,
+ const SfxItemSet &rSet ) :
+ SfxTabPage( pParent, SW_RES(bEN ? TP_ENDNOTEOPTION : TP_FOOTNOTEOPTION), rSet ),
+ aNumTypeFT (this, SW_RES( FT_NUMTYPE )),
+ aNumViewBox (this, SW_RES( LB_NUMVIEW ), INSERT_NUM_EXTENDED_TYPES),
+ aOffsetLbl (this, SW_RES( FT_OFFSET )),
+ aOffsetFld (this, SW_RES( FLD_OFFSET )),
+ aNumCountFT (this, SW_RES( FT_NUMCOUNT )),
+ aNumCountBox (this, SW_RES( LB_NUMCOUNT )),
+ aPrefixFT (this, SW_RES( FT_PREFIX )),
+ aPrefixED (this, SW_RES( ED_PREFIX )),
+ aSuffixFT (this, SW_RES( FT_SUFFIX )),
+ aSuffixED (this, SW_RES( ED_SUFFIX )),
+ aPosFT (this, SW_RES( FT_POS )),
+ aPosPageBox (this, SW_RES( RB_POS_PAGE )),
+ aPosChapterBox (this, SW_RES( RB_POS_CHAPTER)),
+ aNumFL (this, SW_RES( FL_NUM )),
+
+ aParaTemplLbl (this, SW_RES( FT_PARA_TEMPL)),
+ aParaTemplBox (this, SW_RES( LB_PARA_TEMPL)),
+ aPageTemplLbl (this, SW_RES( FT_PAGE_TEMPL)),
+ aPageTemplBox (this, SW_RES( LB_PAGE_TEMPL)),
+ aTemplFL (this, SW_RES( FL_TEMPL )),
+
+ aFtnCharAnchorTemplLbl( this, SW_RES( FT_ANCHR_CHARFMT)),
+ aFtnCharAnchorTemplBox( this, SW_RES( LB_ANCHR_CHARFMT)),
+ aFtnCharTextTemplLbl( this, SW_RES( FT_TEXT_CHARFMT)),
+ aFtnCharTextTemplBox( this, SW_RES( LB_TEXT_CHARFMT)),
+ aCharTemplFL( this, SW_RES(FL_CHAR_TEMPL)),
+
+ aContLbl (this, SW_RES( FT_CONT )),
+ aContEdit (this, SW_RES( ED_CONT )),
+ aContFromLbl (this, SW_RES( FT_CONT_FROM )),
+ aContFromEdit (this, SW_RES( ED_CONT_FROM )),
+ aContFL (this, SW_RES( FL_CONT )),
+
+ aNumDoc(aNumCountBox.GetEntry(FTNNUM_DOC)),
+ aNumPage(aNumCountBox.GetEntry(FTNNUM_PAGE)),
+ aNumChapter(aNumCountBox.GetEntry(FTNNUM_CHAPTER)),
+ pSh( 0 ),
+ bPosDoc(FALSE),
+ bEndNote( bEN )
+{
+ FreeResource();
+
+ aPosPageBox.SetClickHdl(LINK(this, SwEndNoteOptionPage, PosPageHdl));
+ aPosChapterBox.SetClickHdl(LINK(this, SwEndNoteOptionPage, PosChapterHdl));
+ aNumCountBox.SetSelectHdl(LINK(this, SwEndNoteOptionPage, NumCountHdl));
+
+}
+
+void SwEndNoteOptionPage::Reset( const SfxItemSet& )
+{
+ SwEndNoteInfo *pInf = bEndNote ? new SwEndNoteInfo( pSh->GetEndNoteInfo() )
+ : new SwFtnInfo( pSh->GetFtnInfo() );
+ SfxObjectShell * pDocSh = SfxObjectShell::Current();
+ USHORT i;
+
+ if(PTR_CAST(SwWebDocShell, pDocSh))
+ {
+ aParaTemplLbl .Hide();
+ aParaTemplBox .Hide();
+ aPageTemplLbl .Hide();
+ aPageTemplBox .Hide();
+ aFtnCharTextTemplLbl.Hide();
+ aFtnCharTextTemplBox.Hide();
+ aFtnCharAnchorTemplLbl.Hide();
+ aFtnCharAnchorTemplBox.Hide();
+ aCharTemplFL .Hide();
+ aTemplFL .Hide();
+ }
+ if ( bEndNote )
+ {
+ aPosPageBox.Hide();
+ aPosChapterBox.Hide();
+ aNumCountBox.Hide();
+ aContLbl.Hide();
+ aContEdit.Hide();
+ aContFromLbl.Hide();
+ aContFromEdit.Hide();
+ aContFL.Hide();
+ bPosDoc = TRUE;
+ }
+ else
+ {
+ const SwFtnInfo &rInf = pSh->GetFtnInfo();
+ // Position (Seite, Kapitel) setzen
+ if ( rInf.ePos == FTNPOS_PAGE )
+ {
+ aPosPageBox.Check();
+ aPageTemplLbl.Enable(FALSE);
+ aPageTemplBox.Enable(FALSE);
+ }
+ else // if ( rInf.ePos == FTNPOS_CHAPTER )
+ {
+ aPosChapterBox.Check();
+ aNumCountBox.RemoveEntry(aNumPage);
+ aNumCountBox.RemoveEntry(aNumChapter);
+ bPosDoc = TRUE;
+ }
+ // Verweistexte
+ aContEdit.SetText(rInf.aQuoVadis);
+ aContFromEdit.SetText(rInf.aErgoSum);
+
+ // gesammelt wo
+ SelectNumbering(rInf.eNum);
+ }
+
+ // Numerierung
+ // Art
+ aNumViewBox.SelectNumberingType( pInf->aFmt.GetNumberingType());
+ aOffsetFld.SetValue(pInf->nFtnOffset + 1);
+ aPrefixED.SetText(pInf->GetPrefix());
+ aSuffixED.SetText(pInf->GetSuffix());
+
+ const SwCharFmt* pCharFmt = pInf->GetCharFmt(
+ *pSh->GetView().GetDocShell()->GetDoc());
+ aFtnCharTextTemplBox.SelectEntry(pCharFmt->GetName());
+ aFtnCharTextTemplBox.SaveValue();
+
+ pCharFmt = pInf->GetAnchorCharFmt( *pSh->GetDoc() );
+ aFtnCharAnchorTemplBox.SelectEntry( pCharFmt->GetName() );
+ aFtnCharAnchorTemplBox.SaveValue();
+
+ // Vorlagen - Sonderbereiche
+ // Absatz
+ SfxStyleSheetBasePool* pStyleSheetPool = pSh->GetView().GetDocShell()->GetStyleSheetPool();
+ pStyleSheetPool->SetSearchMask(SFX_STYLE_FAMILY_PARA, SWSTYLEBIT_EXTRA);
+ SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
+ while(pStyle)
+ {
+ aParaTemplBox.InsertEntry(pStyle->GetName());
+ pStyle = pStyleSheetPool->Next();
+ }
+
+ String sStr;
+ SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(bEndNote ? RES_POOLCOLL_ENDNOTE
+ : RES_POOLCOLL_FOOTNOTE), sStr );
+ if(LISTBOX_ENTRY_NOTFOUND == aParaTemplBox.GetEntryPos( sStr ) )
+ aParaTemplBox.InsertEntry( sStr );
+
+ SwTxtFmtColl* pColl = pInf->GetFtnTxtColl();
+ if( !pColl )
+ aParaTemplBox.SelectEntry( sStr ); // Default
+ else
+ {
+ ASSERT(!pColl->IsDefault(), "Defaultvorlage fuer Fussnoten ist falsch.");
+ const USHORT nPos = aParaTemplBox.GetEntryPos(pColl->GetName());
+ if( LISTBOX_ENTRY_NOTFOUND != nPos )
+ aParaTemplBox.SelectEntryPos( nPos );
+ else
+ {
+ aParaTemplBox.InsertEntry(pColl->GetName());
+ aParaTemplBox.SelectEntry(pColl->GetName());
+ }
+ }
+
+ // Seite
+ for( i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i )
+ aPageTemplBox.InsertEntry(SwStyleNameMapper::GetUIName( i, aEmptyStr ));
+
+ USHORT nCount = pSh->GetPageDescCnt();
+ for(i = 0; i < nCount; ++i)
+ {
+ const SwPageDesc &rPageDesc = pSh->GetPageDesc(i);
+ if(LISTBOX_ENTRY_NOTFOUND == aPageTemplBox.GetEntryPos(rPageDesc.GetName()))
+ aPageTemplBox.InsertEntry(rPageDesc.GetName());
+ }
+
+ aPageTemplBox.SelectEntry( pInf->GetPageDesc( *pSh->GetDoc() )->GetName());
+ delete pInf;
+}
+
+SwEndNoteOptionPage::~SwEndNoteOptionPage()
+{
+}
+
+SfxTabPage *SwEndNoteOptionPage::Create( Window *pParent, const SfxItemSet &rSet )
+{
+ return new SwEndNoteOptionPage( pParent, TRUE, rSet );
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Unterschiedliche Arten der Numerierung; da die Listbox
+ unterschiedlich viele Eintraege hat, hier Funktionen
+ fuer das Setzen und Erfragen der gemeinten Art
+ der Numerierung.
+------------------------------------------------------------------------*/
+void SwEndNoteOptionPage::SelectNumbering(int eNum)
+{
+ String sSelect;
+ switch(eNum)
+ {
+ case FTNNUM_DOC:
+ sSelect = aNumDoc;
+ break;
+ case FTNNUM_PAGE:
+ sSelect = aNumPage;
+ break;
+ case FTNNUM_CHAPTER:
+ sSelect = aNumChapter;
+ break;
+#ifdef DBG_UTIL
+ default:
+ DBG_ERROR("Which numbering type?");
+#endif
+ }
+ aNumCountBox.SelectEntry(sSelect);
+ NumCountHdl( &aNumCountBox );
+}
+
+
+
+int SwEndNoteOptionPage::GetNumbering() const
+{
+ const USHORT nPos = aNumCountBox.GetSelectEntryPos();
+ return (int) bPosDoc? nPos + 1: nPos;
+}
+
+/*-----------------09.02.98 11:17-------------------
+
+--------------------------------------------------*/
+void SwEndNoteOptionPage::SetShell( SwWrtShell &rShell )
+{
+ pSh = &rShell;
+ // Zeichenvorlagen sammeln
+ aFtnCharTextTemplBox.Clear();
+ aFtnCharAnchorTemplBox.Clear();
+ ::FillCharStyleListBox(aFtnCharTextTemplBox,
+ pSh->GetView().GetDocShell());
+
+ ::FillCharStyleListBox(aFtnCharAnchorTemplBox,
+ pSh->GetView().GetDocShell());
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Handler hinter dem Button fuer Sammeln der Fussnote
+ auf der Seite.
+ In diesem Fall koennen alle Numerierungsarten verwendet
+ werden.
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwEndNoteOptionPage, PosPageHdl, Button *, EMPTYARG )
+{
+ const SwFtnNum eNum = (const SwFtnNum)GetNumbering();
+ bPosDoc = FALSE;
+ if(LISTBOX_ENTRY_NOTFOUND == aNumCountBox.GetEntryPos(aNumPage))
+ {
+ aNumCountBox.InsertEntry(aNumPage, FTNNUM_PAGE);
+ aNumCountBox.InsertEntry(aNumChapter, FTNNUM_CHAPTER);
+ SelectNumbering(eNum);
+ }
+ aPageTemplLbl.Enable(FALSE);
+ aPageTemplBox.Enable(FALSE);
+
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwEndNoteOptionPage, NumCountHdl, ListBox*, EMPTYARG )
+{
+ BOOL bEnable = TRUE;
+ if( aNumCountBox.GetEntryCount() - 1 != aNumCountBox.GetSelectEntryPos() )
+ {
+ bEnable = FALSE;
+ aOffsetFld.SetValue(1);
+ }
+ aOffsetLbl.Enable(bEnable);
+ aOffsetFld.Enable(bEnable);
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Handler hinter dem Button fuer Sammeln der Fussnote
+ am Kapitel oder Dokumentende.
+ In diesem Fall kann keine seitenweise Numerierung verwendet
+ werden.
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK_INLINE_START( SwEndNoteOptionPage, PosChapterHdl, Button *, EMPTYARG )
+{
+ if ( !bPosDoc )
+ SelectNumbering(FTNNUM_DOC);
+
+ bPosDoc = TRUE;
+ aNumCountBox.RemoveEntry(aNumPage);
+ aNumCountBox.RemoveEntry(aNumChapter);
+ aPageTemplLbl.Enable();
+ aPageTemplBox.Enable();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwEndNoteOptionPage, PosChapterHdl, Button *, EMPTYARG )
+
+SwCharFmt* lcl_GetCharFormat( SwWrtShell* pSh, const String& rCharFmtName )
+{
+ SwCharFmt* pFmt = 0;
+ USHORT nChCount = pSh->GetCharFmtCount();
+ for(USHORT i = 0; i< nChCount; i++)
+ {
+ SwCharFmt& rChFmt = pSh->GetCharFmt(i);
+ if(rChFmt.GetName() == rCharFmtName )
+ {
+ pFmt = &rChFmt;
+ break;
+ }
+ }
+ if(!pFmt)
+ {
+ SfxStyleSheetBasePool* pPool = pSh->GetView().GetDocShell()->GetStyleSheetPool();
+ SfxStyleSheetBase* pBase;
+ pBase = pPool->Find(rCharFmtName, SFX_STYLE_FAMILY_CHAR);
+ if(!pBase)
+ pBase = &pPool->Make(rCharFmtName, SFX_STYLE_FAMILY_CHAR);
+ pFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
+ }
+ return pFmt;
+}
+
+BOOL SwEndNoteOptionPage::FillItemSet( SfxItemSet & )
+{
+ SwEndNoteInfo *pInf = bEndNote ? new SwEndNoteInfo() : new SwFtnInfo();
+
+ pInf->nFtnOffset = static_cast< USHORT >(aOffsetFld.GetValue() -1);
+ pInf->aFmt.SetNumberingType(aNumViewBox.GetSelectedNumberingType() );
+ pInf->SetPrefix(aPrefixED.GetText());
+ pInf->SetSuffix(aSuffixED.GetText());
+
+ pInf->SetCharFmt( lcl_GetCharFormat( pSh,
+ aFtnCharTextTemplBox.GetSelectEntry() ) );
+ pInf->SetAnchorCharFmt( lcl_GetCharFormat( pSh,
+ aFtnCharAnchorTemplBox.GetSelectEntry() ) );
+
+ // Absatzvorlage
+ USHORT nPos = aParaTemplBox.GetSelectEntryPos();
+ if(LISTBOX_ENTRY_NOTFOUND != nPos)
+ {
+ const String aFmtName( aParaTemplBox.GetSelectEntry() );
+ SwTxtFmtColl *pColl = pSh->GetParaStyle(aFmtName, SwWrtShell::GETSTYLE_CREATEANY);
+ ASSERT(pColl, "Absatzvorlage nicht gefunden.");
+ pInf->SetFtnTxtColl(*pColl);
+ }
+
+ // Seitenvorlage
+ pInf->ChgPageDesc( pSh->FindPageDescByName(
+ aPageTemplBox.GetSelectEntry(), TRUE ) );
+
+ if ( bEndNote )
+ {
+ if ( !(*pInf == pSh->GetEndNoteInfo()) )
+ pSh->SetEndNoteInfo( *pInf );
+ }
+ else
+ {
+ SwFtnInfo *pI = (SwFtnInfo*)pInf;
+ pI->ePos = aPosPageBox.IsChecked() ? FTNPOS_PAGE : FTNPOS_CHAPTER;
+ pI->eNum = (SwFtnNum)GetNumbering();
+ pI->aQuoVadis = aContEdit.GetText();
+ pI->aErgoSum = aContFromEdit.GetText();
+ if ( !(*pI == pSh->GetFtnInfo()) )
+ pSh->SetFtnInfo( *pI );
+ }
+ delete pInf;
+ return TRUE;
+}
+
+SwFootNoteOptionPage::SwFootNoteOptionPage( Window *pParent, const SfxItemSet &rSet ) :
+ SwEndNoteOptionPage( pParent, FALSE, rSet )
+{
+}
+
+SwFootNoteOptionPage::~SwFootNoteOptionPage()
+{
+}
+
+SfxTabPage *SwFootNoteOptionPage::Create(Window *pParent, const SfxItemSet &rSet )
+{
+ return new SwFootNoteOptionPage( pParent, rSet );
+}
+
+
+
+
+
+
+
diff --git a/sw/source/ui/misc/docfnote.hrc b/sw/source/ui/misc/docfnote.hrc
new file mode 100644
index 000000000000..f826f276620e
--- /dev/null
+++ b/sw/source/ui/misc/docfnote.hrc
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define RB_POS_PAGE 1
+#define RB_POS_CHAPTER 2
+#define FT_POS 3
+#define FT_NUMTYPE 4
+#define FT_NUMCOUNT 5
+
+#define LB_NUMVIEW 10
+#define LB_NUMCOUNT 11
+#define FLD_OFFSET 12
+#define FT_OFFSET 13
+#define FL_NUM 14
+
+#define LB_PARA_TEMPL 30
+#define LB_PAGE_TEMPL 31
+#define FT_PARA_TEMPL 32
+#define FT_PAGE_TEMPL 33
+#define FL_TEMPL 34
+
+#define FT_CONT 40
+#define ED_CONT 41
+#define FT_CONT_FROM 42
+#define ED_CONT_FROM 43
+#define FL_CONT 44
+
+#define FT_PREFIX 45
+#define ED_PREFIX 46
+#define FT_SUFFIX 47
+#define ED_SUFFIX 48
+#define FT_TEXT_CHARFMT 49
+#define LB_TEXT_CHARFMT 50
+#define FT_ANCHR_CHARFMT 51
+#define FL_CHAR_TEMPL 52
+#define LB_ANCHR_CHARFMT 53
+
diff --git a/sw/source/ui/misc/docfnote.src b/sw/source/ui/misc/docfnote.src
new file mode 100644
index 000000000000..5e1b1e4ac71b
--- /dev/null
+++ b/sw/source/ui/misc/docfnote.src
@@ -0,0 +1,563 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "misc.hrc"
+#include "docfnote.hrc"
+#include "helpid.h"
+#include "cmdid.h"
+#include "frmui.hrc"
+TabDialog DLG_DOC_FOOTNOTE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Footnotes/Endnotes Settings" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_FOOTNOTEOPTION ;
+ PageResID = TP_FOOTNOTEOPTION ;
+ Text [ en-US ] = "Footnotes" ;
+ };
+ PageItem
+ {
+ Identifier = TP_ENDNOTEOPTION ;
+ PageResID = TP_ENDNOTEOPTION ;
+ Text [ en-US ] = "Endnotes" ;
+ };
+ };
+ };
+};
+TabPage TP_FOOTNOTEOPTION
+{
+ SVLook = TRUE ;
+ Hide = TRUE;
+ HelpID = HID_FOOTNOTE_OPTIONS ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_NUM
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "AutoNumbering" ;
+ Group = TRUE ;
+ };
+ FixedText FT_NUMTYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 51 , 8 ) ;
+ Text [ en-US ] = "Num~bering";
+ };
+ ListBox LB_NUMVIEW
+ {
+ HelpID = "sw:ListBox:TP_FOOTNOTEOPTION:LB_NUMVIEW";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 65 , 14 ) ;
+ Size = MAP_APPFONT ( 59 , 72 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_OFFSET
+ {
+ Pos = MAP_APPFONT ( 130 , 16 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Start at" ;
+ };
+ NumericField FLD_OFFSET
+ {
+ HelpID = "sw:NumericField:TP_FOOTNOTEOPTION:FLD_OFFSET";
+ Pos = MAP_APPFONT ( 189 , 14 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ First = 1 ;
+ Last = 9999 ;
+ Maximum = 9999 ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+ FixedText FT_NUMCOUNT
+ {
+ Pos = MAP_APPFONT ( 12 , 31 ) ;
+ Size = MAP_APPFONT ( 51 , 8 ) ;
+ Text [ en-US ] = "~Counting";
+ };
+ ListBox LB_NUMCOUNT
+ {
+ HelpID = "sw:ListBox:TP_FOOTNOTEOPTION:LB_NUMCOUNT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 65 , 29 ) ;
+ Size = MAP_APPFONT ( 59 , 50 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ StringList [ en-US ] =
+ {
+ < "Per page" ; > ;
+ < "Per chapter" ; > ;
+ < "Per document" ; > ;
+ };
+ };
+ FixedText FT_PREFIX
+ {
+ Pos = MAP_APPFONT ( 12 , 46 ) ;
+ Size = MAP_APPFONT ( 48 , 8 ) ;
+ Text [ en-US ] = "~Before" ;
+ Left = TRUE ;
+ };
+ Edit ED_PREFIX
+ {
+ HelpID = "sw:Edit:TP_FOOTNOTEOPTION:ED_PREFIX";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 65 , 44 ) ;
+ Size = MAP_APPFONT ( 59 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ MaxTextLength = 50 ;
+ };
+ FixedText FT_SUFFIX
+ {
+ Pos = MAP_APPFONT ( 130 , 46 ) ;
+ Size = MAP_APPFONT ( 48 , 8 ) ;
+ Text [ en-US ] = "~After" ;
+ Left = TRUE ;
+ };
+ Edit ED_SUFFIX
+ {
+ HelpID = "sw:Edit:TP_FOOTNOTEOPTION:ED_SUFFIX";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 189 , 44 ) ;
+ Size = MAP_APPFONT ( 59 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ MaxTextLength = 50 ;
+ };
+ FixedText FT_POS
+ {
+ Pos = MAP_APPFONT ( 12 , 63 ) ;
+ Size = MAP_APPFONT ( 36 , 8 ) ;
+ Text [ en-US ] = "Position" ;
+ };
+ RadioButton RB_POS_PAGE
+ {
+ HelpID = "sw:RadioButton:TP_FOOTNOTEOPTION:RB_POS_PAGE";
+ Pos = MAP_APPFONT ( 65 , 62 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text [ en-US ] = "~End of page" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ RadioButton RB_POS_CHAPTER
+ {
+ HelpID = "sw:RadioButton:TP_FOOTNOTEOPTION:RB_POS_CHAPTER";
+ Pos = MAP_APPFONT ( 65 , 75 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ Text [ en-US ] = "En~d of document" ;
+ };
+ FixedLine FL_TEMPL
+ {
+ Pos = MAP_APPFONT ( 6 , 89 ) ;
+ Size = MAP_APPFONT ( 103 , 8 ) ;
+ Text [ en-US ] = "Styles" ;
+ };
+ FixedText FT_PARA_TEMPL
+ {
+ Pos = MAP_APPFONT ( 12 , 102 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "Pa~ragraph" ;
+ Left = TRUE ;
+ };
+ ListBox LB_PARA_TEMPL
+ {
+ HelpID = "sw:ListBox:TP_FOOTNOTEOPTION:LB_PARA_TEMPL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 48 , 100 ) ;
+ Size = MAP_APPFONT ( 58 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ Sort = TRUE ;
+ };
+ FixedText FT_PAGE_TEMPL
+ {
+ Pos = MAP_APPFONT ( 12 , 118 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "~Page" ;
+ Left = TRUE ;
+ };
+ ListBox LB_PAGE_TEMPL
+ {
+ HelpID = "sw:ListBox:TP_FOOTNOTEOPTION:LB_PAGE_TEMPL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 48 , 116) ;
+ Size = MAP_APPFONT ( 58 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedLine FL_CHAR_TEMPL
+ {
+ Pos = MAP_APPFONT ( 113 , 89 ) ;
+ Size = MAP_APPFONT ( 141 , 8 ) ;
+
+ Text [ en-US ] = "Character Styles";
+ };
+ FixedText FT_ANCHR_CHARFMT
+ {
+ Pos = MAP_APPFONT ( 117 , 102 ) ;
+ Size = MAP_APPFONT ( 67 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Te~xt area" ;
+ };
+ ListBox LB_ANCHR_CHARFMT
+ {
+ HelpID = "sw:ListBox:TP_FOOTNOTEOPTION:LB_ANCHR_CHARFMT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 186 , 100 ) ;
+ Size = MAP_APPFONT ( 65 , 72 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_TEXT_CHARFMT
+ {
+ Pos = MAP_APPFONT ( 117 , 118 ) ;
+ Size = MAP_APPFONT ( 67 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Footnote area" ;
+ };
+ ListBox LB_TEXT_CHARFMT
+ {
+ HelpID = "sw:ListBox:TP_FOOTNOTEOPTION:LB_TEXT_CHARFMT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 186 , 116 ) ;
+ Size = MAP_APPFONT ( 65 , 72 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedLine FL_CONT
+ {
+ Pos = MAP_APPFONT ( 6 , 134 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Continuation notice" ;
+ };
+ FixedText FT_CONT
+ {
+ Pos = MAP_APPFONT ( 12 , 148 ) ;
+ Size = MAP_APPFONT ( 73 , 8 ) ;
+ Text [ en-US ] = "End ~of footnote" ;
+ Left = TRUE ;
+ };
+ Edit ED_CONT
+ {
+ HelpID = "sw:Edit:TP_FOOTNOTEOPTION:ED_CONT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88, 145 ) ;
+ Size = MAP_APPFONT ( 160 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ MaxTextLength = 30 ;
+ };
+ FixedText FT_CONT_FROM
+ {
+ Pos = MAP_APPFONT ( 12 , 163 ) ;
+ Size = MAP_APPFONT ( 73 , 8 ) ;
+ Text [ en-US ] = "Star~t of next page" ;
+ Left = TRUE ;
+ };
+ Edit ED_CONT_FROM
+ {
+ HelpID = "sw:Edit:TP_FOOTNOTEOPTION:ED_CONT_FROM";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 88 , 161 ) ;
+ Size = MAP_APPFONT ( 160 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ MaxTextLength = 30 ;
+ };
+};
+TabPage TP_ENDNOTEOPTION
+{
+ SVLook = TRUE ;
+ Hide = TRUE;
+ HelpID = HID_ENDNOTE_OPTIONS ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ FixedLine FL_NUM
+ {
+ Pos = MAP_APPFONT ( 6 , 2 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "AutoNumbering" ;
+ Group = TRUE ;
+ };
+ FixedText FT_NUMTYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 51 , 8 ) ;
+ Text [ en-US ] = "~Numbering";
+ };
+ ListBox LB_NUMVIEW
+ {
+ HelpID = "sw:ListBox:TP_ENDNOTEOPTION:LB_NUMVIEW";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 65 , 14 ) ;
+ Size = MAP_APPFONT ( 59 , 72 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ StringList =
+ {
+ "A, B, C" ;
+ "a, b, c" ;
+ "I, II, III" ;
+ "i, ii, iii" ;
+ "1, 2, 3" ;
+ "A, .., AA, .., AAA" ;
+ "a, .., aa, .., aaa" ;
+ };
+ };
+ FixedText FT_OFFSET
+ {
+ Pos = MAP_APPFONT ( 130 , 16 ) ;
+ Size = MAP_APPFONT ( 50 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Start at" ;
+ };
+ NumericField FLD_OFFSET
+ {
+ HelpID = "sw:NumericField:TP_ENDNOTEOPTION:FLD_OFFSET";
+ Pos = MAP_APPFONT ( 189 , 14 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ First = 1 ;
+ Last = 9999 ;
+ Maximum = 9999 ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+ FixedText FT_NUMCOUNT
+ {
+ Pos = MAP_APPFONT ( 82 , 14 ) ;
+ Size = MAP_APPFONT ( 36 , 8 ) ;
+ Hide = TRUE;
+ };
+ ListBox LB_NUMCOUNT
+ {
+ HelpID = "sw:ListBox:TP_ENDNOTEOPTION:LB_NUMCOUNT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 62 , 72 ) ;
+ Hide = TRUE;
+ };
+ FixedText FT_PREFIX
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 48 , 8 ) ;
+
+ Text [ en-US ] = "~Before" ;
+ Left = TRUE ;
+ };
+ Edit ED_PREFIX
+ {
+ HelpID = "sw:Edit:TP_ENDNOTEOPTION:ED_PREFIX";
+ Pos = MAP_APPFONT ( 65 , 30 ) ;
+ Size = MAP_APPFONT ( 59 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ MaxTextLength = 50 ;
+ };
+ FixedText FT_SUFFIX
+ {
+ Pos = MAP_APPFONT ( 130 , 32 ) ;
+ Size = MAP_APPFONT ( 48 , 8 ) ;
+ Text [ en-US ] = "~After" ;
+ Left = TRUE ;
+ };
+ Edit ED_SUFFIX
+ {
+ HelpID = "sw:Edit:TP_ENDNOTEOPTION:ED_SUFFIX";
+ Pos = MAP_APPFONT ( 189 , 30 ) ;
+ Size = MAP_APPFONT ( 59 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ MaxTextLength = 50 ;
+ };
+ FixedText FT_POS
+ {
+ Pos = MAP_APPFONT ( 82 , 14 ) ;
+ Size = MAP_APPFONT ( 36 , 8 ) ;
+ Hide = TRUE;
+ };
+ RadioButton RB_POS_PAGE
+ {
+ HelpID = "sw:RadioButton:TP_ENDNOTEOPTION:RB_POS_PAGE";
+ Pos = MAP_APPFONT ( 12 , 104 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "End ~of page" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ RadioButton RB_POS_CHAPTER
+ {
+ HelpID = "sw:RadioButton:TP_ENDNOTEOPTION:RB_POS_CHAPTER";
+ Pos = MAP_APPFONT ( 12 , 118 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "End of ~document" ;
+ };
+ FixedLine FL_TEMPL
+ {
+ Pos = MAP_APPFONT ( 6 , 46 ) ;
+ Size = MAP_APPFONT ( 115 , 8 ) ;
+ Text [ en-US ] = "Styles" ;
+ };
+ FixedText FT_PARA_TEMPL
+ {
+ Pos = MAP_APPFONT ( 12 , 58 ) ;
+ Size = MAP_APPFONT ( 38 , 8 ) ;
+ Text [ en-US ] = "Pa~ragraph" ;
+ Left = TRUE ;
+ };
+ ListBox LB_PARA_TEMPL
+ {
+ HelpID = "sw:ListBox:TP_ENDNOTEOPTION:LB_PARA_TEMPL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 51 , 56 ) ;
+ Size = MAP_APPFONT ( 67 , 72 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ Sort = TRUE ;
+ };
+ FixedText FT_PAGE_TEMPL
+ {
+ Pos = MAP_APPFONT ( 12 , 74 ) ;
+ Size = MAP_APPFONT ( 38 , 8 ) ;
+ Text [ en-US ] = "~Page" ;
+ Left = TRUE ;
+ };
+ ListBox LB_PAGE_TEMPL
+ {
+ HelpID = "sw:ListBox:TP_ENDNOTEOPTION:LB_PAGE_TEMPL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 51 , 72 ) ;
+ Size = MAP_APPFONT ( 67 , 72 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedLine FL_CHAR_TEMPL
+ {
+ Pos = MAP_APPFONT ( 125 , 46 ) ;
+ Size = MAP_APPFONT ( 129 , 8 ) ;
+ Text [ en-US ] = "Character Styles";
+ };
+ FixedText FT_ANCHR_CHARFMT
+ {
+ Pos = MAP_APPFONT ( 129 , 58 ) ;
+ Size = MAP_APPFONT ( 55 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "Te~xt area" ;
+ };
+ ListBox LB_ANCHR_CHARFMT
+ {
+ HelpID = "sw:ListBox:TP_ENDNOTEOPTION:LB_ANCHR_CHARFMT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 186 , 56 ) ;
+ Size = MAP_APPFONT ( 65 , 72 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_TEXT_CHARFMT
+ {
+ Pos = MAP_APPFONT ( 129 , 74 ) ;
+ Size = MAP_APPFONT ( 55 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Endnote area" ;
+ };
+ ListBox LB_TEXT_CHARFMT
+ {
+ HelpID = "sw:ListBox:TP_ENDNOTEOPTION:LB_TEXT_CHARFMT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 186 , 72 ) ;
+ Size = MAP_APPFONT ( 65 , 72 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedLine FL_CONT
+ {
+ Pos = MAP_APPFONT ( 80 , 91 ) ;
+ Size = MAP_APPFONT ( 174 , 8 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Hinweistext mehrseitige Fußnoten : Hinweistext mehrseitige Fu˜noten */
+ Text [ en-US ] = "Continuation notice" ;
+ };
+ FixedText FT_CONT
+ {
+ Pos = MAP_APPFONT ( 86 , 103 ) ;
+ Size = MAP_APPFONT ( 38 , 8 ) ;
+ Text [ en-US ] = "~Following page" ;
+ Left = TRUE ;
+ };
+ Edit ED_CONT
+ {
+ HelpID = "sw:Edit:TP_ENDNOTEOPTION:ED_CONT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 137 , 101 ) ;
+ Size = MAP_APPFONT ( 114 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ MaxTextLength = 30 ;
+ };
+ FixedText FT_CONT_FROM
+ {
+ Pos = MAP_APPFONT ( 86 , 118 ) ;
+ Size = MAP_APPFONT ( 38 , 8 ) ;
+ Text [ en-US ] = "~Start" ;
+ Left = TRUE ;
+ };
+ Edit ED_CONT_FROM
+ {
+ HelpID = "sw:Edit:TP_ENDNOTEOPTION:ED_CONT_FROM";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 137 , 116 ) ;
+ Size = MAP_APPFONT ( 114 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ MaxTextLength = 30 ;
+ };
+};
diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx
new file mode 100644
index 000000000000..e462eb7530b6
--- /dev/null
+++ b/sw/source/ui/misc/glosbib.cxx
@@ -0,0 +1,580 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#define _SVSTDARR_STRINGS
+#include <tools/urlobj.hxx>
+#include <tools/stream.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <vcl/help.hxx>
+#include <unotools/transliterationwrapper.hxx>
+#include <unotools/tempfile.hxx>
+
+#include <svl/svstdarr.hxx>
+#include <unotools/pathoptions.hxx>
+#include <swtypes.hxx>
+#include <glosbib.hxx>
+#include <gloshdl.hxx>
+#include <actctrl.hxx>
+#include <glossary.hxx>
+#include <glosdoc.hxx>
+#include <swunohelper.hxx>
+
+#ifndef _GLOSBIB_HRC
+#include <glosbib.hrc>
+#endif
+#ifndef _MISC_HRC
+#include <misc.hrc>
+#endif
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+
+
+#define PATH_CASE_SENSITIVE 0x01
+#define PATH_READONLY 0x02
+
+#define RENAME_TOKEN_DELIM (sal_Unicode)1
+
+/*-----------------09.06.97 13:05-------------------
+
+--------------------------------------------------*/
+SwGlossaryGroupDlg::SwGlossaryGroupDlg(Window * pParent,
+ const SvStrings* pPathArr,
+ SwGlossaryHdl *pHdl) :
+ SvxStandardDialog(pParent, SW_RES(DLG_BIB_BASE)),
+
+ aNameED( this, SW_RES(ED_NAME)),
+ aPathLB( this, SW_RES(LB_PATH)),
+ aGroupTLB( this, SW_RES(TLB_GROUPS)),
+
+ aOkPB( this, SW_RES(BT_OK)),
+ aCancelPB( this, SW_RES(BT_CANCEL)),
+ aHelpPB( this, SW_RES(BT_HELP)),
+ aNewPB( this, SW_RES(PB_NEW)),
+ aDelPB( this, SW_RES(PB_DELETE)),
+ aRenamePB( this, SW_RES(PB_RENAME)),
+ aBibFT( this, SW_RES(FT_BIB)),
+ aPathFT( this, SW_RES(FT_PATH)),
+ aSelectFT( this, SW_RES(FT_SELECT)),
+
+ pRemovedArr(0),
+ pInsertedArr(0),
+ pRenamedArr(0),
+ pGlosHdl(pHdl)
+{
+ USHORT i;
+
+ FreeResource();
+
+ long nTabs[] =
+ { 2, // Number of Tabs
+ 0, 160
+ };
+
+ aGroupTLB.SetHelpId(HID_GLOS_GROUP_TREE);
+ aGroupTLB.SetTabs( &nTabs[0], MAP_APPFONT );
+ aGroupTLB.SetStyle(aGroupTLB.GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN|WB_SORT);
+ aGroupTLB.SetSelectHdl(LINK(this, SwGlossaryGroupDlg, SelectHdl));
+ aGroupTLB.GetModel()->SetSortMode(SortAscending);
+ aNewPB.SetClickHdl(LINK(this, SwGlossaryGroupDlg, NewHdl));
+ aDelPB.SetClickHdl(LINK(this, SwGlossaryGroupDlg, DeleteHdl));
+ aNameED.SetModifyHdl(LINK(this, SwGlossaryGroupDlg, ModifyHdl));
+ aPathLB.SetSelectHdl(LINK(this, SwGlossaryGroupDlg, ModifyHdl));
+ aRenamePB.SetClickHdl(LINK(this, SwGlossaryGroupDlg, RenameHdl));
+ for( i = 0; i < pPathArr->Count(); i++)
+ {
+ String sPath(*(*pPathArr)[i]);
+ INetURLObject aTempURL(sPath);
+ sPath = aTempURL.GetMainURL(INetURLObject::DECODE_WITH_CHARSET );
+ aPathLB.InsertEntry(sPath);
+ ULONG nCaseReadonly = 0;
+ utl::TempFile aTempFile(&sPath);
+ aTempFile.EnableKillingFile();
+ if(!aTempFile.IsValid())
+ nCaseReadonly |= PATH_READONLY;
+ else if( SWUnoHelper::UCB_IsCaseSensitiveFileName( aTempFile.GetURL()))
+ nCaseReadonly |= PATH_CASE_SENSITIVE;
+ aPathLB.SetEntryData(i, (void*)nCaseReadonly);
+ }
+ aPathLB.SelectEntryPos(0);
+ aPathLB.Enable(TRUE);
+
+ const USHORT nCount = pHdl->GetGroupCnt();
+ for(i = 0; i < nCount; ++i)
+ {
+ String sTitle;
+ String sGroup = pHdl->GetGroupName(i, &sTitle);
+ if(!sGroup.Len())
+ continue;
+ GlosBibUserData* pData = new GlosBibUserData;
+ pData->sGroupName = sGroup;
+ pData->sGroupTitle = sTitle;
+ String sTemp(sTitle);
+ //sGroup.GetToken(0, GLOS_DELIM)
+ sTemp += '\t';
+ pData->sPath = aPathLB.GetEntry((USHORT)sGroup.GetToken(1, GLOS_DELIM).ToInt32());
+ sTemp += pData->sPath;
+ SvLBoxEntry* pEntry = aGroupTLB.InsertEntry(sTemp);
+ pEntry->SetUserData(pData);
+
+ }
+ aGroupTLB.GetModel()->Resort();
+}
+
+/*-----------------09.06.97 13:05-------------------
+
+--------------------------------------------------*/
+SwGlossaryGroupDlg::~SwGlossaryGroupDlg()
+{
+
+ if(pInsertedArr)
+ {
+ pInsertedArr->DeleteAndDestroy(0, pInsertedArr->Count());
+ delete pInsertedArr;
+ }
+ if(pRemovedArr)
+ {
+ pRemovedArr->DeleteAndDestroy(0, pRemovedArr->Count());
+ delete pRemovedArr;
+ }
+ if(pRenamedArr)
+ {
+ pRenamedArr->DeleteAndDestroy(0, pRenamedArr->Count());
+ delete pRenamedArr;
+ }
+
+}
+
+/*-----------------09.06.97 13:11-------------------
+
+--------------------------------------------------*/
+
+void __EXPORT SwGlossaryGroupDlg::Apply()
+{
+ if(aNewPB.IsEnabled())
+ NewHdl(&aNewPB);
+
+ String aActGroup = SwGlossaryDlg::GetCurrGroup();
+
+ if(pRemovedArr && pRemovedArr->Count())
+ {
+ USHORT nCount = pRemovedArr->Count();
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ const String* pDelEntry = (*pRemovedArr)[i];
+ const String sDelGroup = pDelEntry->GetToken(0, '\t');
+ if( sDelGroup == aActGroup )
+ {
+ //soll die aktuelle Gruppe geloescht werden, muss die akt. Gruppe
+ //umgesetzt werden
+ if(aGroupTLB.GetEntryCount())
+ {
+ SvLBoxEntry* pFirst = aGroupTLB.First();
+ GlosBibUserData* pUserData = (GlosBibUserData*)pFirst->GetUserData();
+ pGlosHdl->SetCurGroup(pUserData->sGroupName);
+ }
+ }
+ String sMsg(SW_RES(STR_QUERY_DELETE_GROUP1));
+ String sTitle(pDelEntry->GetToken(1, '\t'));
+ if(sTitle.Len())
+ sMsg += sTitle;
+ else
+ sDelGroup.GetToken(1, GLOS_DELIM);
+ sMsg += SW_RESSTR(STR_QUERY_DELETE_GROUP2);
+ QueryBox aQuery(this->GetParent(), WB_YES_NO|WB_DEF_NO, sMsg );
+ if(RET_YES == aQuery.Execute())
+ pGlosHdl->DelGroup( sDelGroup );
+ }
+
+ }
+ //erst umbenennen, falls es schon eins gab
+ if(pRenamedArr && pRenamedArr->Count())
+ {
+ USHORT nCount = pRenamedArr->Count();
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ String * pEntry = (*pRenamedArr)[i];
+ xub_StrLen nStrSttPos = 0;
+ String sOld( pEntry->GetToken(0, RENAME_TOKEN_DELIM, nStrSttPos ) );
+ String sNew( pEntry->GetToken(0, RENAME_TOKEN_DELIM, nStrSttPos) );
+ String sTitle( pEntry->GetToken(0, RENAME_TOKEN_DELIM, nStrSttPos) );
+ pGlosHdl->RenameGroup(sOld, sNew, sTitle);
+ if(!i)
+ sCreatedGroup = sNew;
+ }
+ }
+ if(pInsertedArr && pInsertedArr->Count())
+ {
+ USHORT nCount = pInsertedArr->Count();
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ String sNewGroup = *(*pInsertedArr)[i];
+ String sNewTitle = sNewGroup.GetToken(0, GLOS_DELIM);
+ if( *(*pInsertedArr)[i] != aActGroup )
+ {
+ pGlosHdl->NewGroup(sNewGroup, sNewTitle);
+ if(!sCreatedGroup.Len())
+ sCreatedGroup = sNewGroup;
+ }
+ }
+ }
+}
+/*-----------------09.06.97 13:12-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwGlossaryGroupDlg, SelectHdl, SvTabListBox*, EMPTYARG )
+{
+ aNewPB.Enable(FALSE);
+ SvLBoxEntry* pFirstEntry = aGroupTLB.FirstSelected();
+ if(pFirstEntry)
+ {
+ GlosBibUserData* pUserData = (GlosBibUserData*)pFirstEntry->GetUserData();
+ String sEntry(pUserData->sGroupName);
+ String sName(aNameED.GetText());
+ BOOL bExists = FALSE;
+ ULONG nPos = aGroupTLB.GetEntryPos(sName, 0);
+ if( 0xffffffff > nPos)
+ {
+ SvLBoxEntry* pEntry = aGroupTLB.GetEntry(nPos);
+ GlosBibUserData* pFoundData = (GlosBibUserData*)pEntry->GetUserData();
+ String sGroup = pFoundData->sGroupName;
+ bExists = sGroup == sEntry;
+ }
+
+ aRenamePB.Enable(!bExists && sName.Len());
+ aDelPB.Enable(IsDeleteAllowed(sEntry));
+ }
+ return 0;
+}
+
+/*-----------------09.06.97 13:22-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwGlossaryGroupDlg, NewHdl, Button*, EMPTYARG )
+{
+ String sGroup(aNameED.GetText());
+// sGroup.ToLower();
+ sGroup += GLOS_DELIM;
+ sGroup += String::CreateFromInt32(aPathLB.GetSelectEntryPos());
+ DBG_ASSERT(!pGlosHdl->FindGroupName(sGroup), "Gruppe bereits vorhanden!");
+ if(!pInsertedArr)
+ pInsertedArr = new SvStrings;
+ pInsertedArr->Insert(new String(sGroup), pInsertedArr->Count());
+ String sTemp(aNameED.GetText());
+// sTemp.ToLower();
+ sTemp += '\t';
+ sTemp += aPathLB.GetSelectEntry();
+ SvLBoxEntry* pEntry = aGroupTLB.InsertEntry(sTemp);
+ GlosBibUserData* pData = new GlosBibUserData;
+ pData->sPath = aPathLB.GetSelectEntry();
+ pData->sGroupName = sGroup;
+ pData->sGroupTitle = aNameED.GetText();
+ pEntry->SetUserData(pData);
+ aGroupTLB.Select(pEntry);
+ aGroupTLB.MakeVisible(pEntry);
+ aGroupTLB.GetModel()->Resort();
+
+ return 0;
+}
+/*-----------------09.06.97 13:22-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwGlossaryGroupDlg, DeleteHdl, Button*, pButton )
+{
+ SvLBoxEntry* pEntry = aGroupTLB.FirstSelected();
+ if(!pEntry)
+ {
+ pButton->Enable(FALSE);
+ return 0;
+ }
+ GlosBibUserData* pUserData = (GlosBibUserData*)pEntry->GetUserData();
+ String sEntry(pUserData->sGroupName);
+ // befindet sich der zu loeschende Name schon unter den
+ // den neuen - dann weg damit
+ BOOL bDelete = TRUE;
+ if(pInsertedArr && pInsertedArr->Count())
+ {
+ USHORT nCount = pInsertedArr->Count();
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ const String* pTemp = (*pInsertedArr)[i];
+ if(*pTemp == sEntry)
+ {
+ pInsertedArr->Remove(i);
+ bDelete = FALSE;
+ break;
+ }
+
+ }
+ }
+ // moeglicherweise sollte es schon umbenannt werden?
+ if(bDelete)
+ {
+ if(pRenamedArr && pRenamedArr->Count())
+ {
+ USHORT nCount = pRenamedArr->Count();
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ const String* pTemp = (*pRenamedArr)[i];
+ String sTemp( pTemp->GetToken(0, RENAME_TOKEN_DELIM ));
+ if(sTemp == sEntry)
+ {
+ pRenamedArr->Remove(i);
+ bDelete = FALSE;
+ break;
+ }
+ }
+ }
+ }
+ if(bDelete)
+ {
+ if(!pRemovedArr)
+ pRemovedArr = new SvStrings;
+ String sGroupEntry(pUserData->sGroupName);
+ sGroupEntry += '\t';
+ sGroupEntry += pUserData->sGroupTitle;
+ pRemovedArr->Insert(new String(sGroupEntry), pRemovedArr->Count());
+ }
+ delete pUserData;
+ aGroupTLB.GetModel()->Remove(pEntry);
+ if(!aGroupTLB.First())
+ pButton->Enable(FALSE);
+ //the content must be deleted - otherwise the new handler would be called in Apply()
+ aNameED.SetText(aEmptyStr);
+ return 0;
+}
+
+/* -----------------23.11.98 12:26-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwGlossaryGroupDlg, RenameHdl, Button *, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = aGroupTLB.FirstSelected();
+ GlosBibUserData* pUserData = (GlosBibUserData*)pEntry->GetUserData();
+ String sEntryText(aGroupTLB.GetEntryText(pEntry));
+ String sEntry(pUserData->sGroupName);
+
+ String sNewName(aNameED.GetText());
+ String sNewTitle(sNewName);
+
+ sNewName += GLOS_DELIM;
+ sNewName += String::CreateFromInt32(aPathLB.GetSelectEntryPos());
+ DBG_ASSERT(!pGlosHdl->FindGroupName(sNewName), "Gruppe bereits vorhanden!");
+
+ // befindet sich der umzubenennende Name unter den
+ // den neuen - dann austauschen
+ BOOL bDone = FALSE;
+ if(pInsertedArr && pInsertedArr->Count())
+ {
+ USHORT nCount = pInsertedArr->Count();
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ const String* pTemp = (*pInsertedArr)[i];
+ if(*pTemp == sEntry)
+ {
+ pInsertedArr->Remove(i);
+ pInsertedArr->Insert(new String(sNewName), pInsertedArr->Count());
+ bDone = TRUE;
+ break;
+ }
+ }
+ }
+ if(!bDone)
+ {
+ if(!pRenamedArr)
+ pRenamedArr = new SvStrings;
+ sEntry += RENAME_TOKEN_DELIM;
+ sEntry += sNewName;
+ sEntry += RENAME_TOKEN_DELIM;
+ sEntry += sNewTitle;
+ pRenamedArr->Insert(new String(sEntry), pRenamedArr->Count());
+ }
+ delete (GlosBibUserData*)pEntry->GetUserData();
+ aGroupTLB.GetModel()->Remove(pEntry);
+ String sTemp(aNameED.GetText());
+// sTemp.ToLower();
+ sTemp += '\t';
+ sTemp += aPathLB.GetSelectEntry();
+ pEntry = aGroupTLB.InsertEntry(sTemp);
+ GlosBibUserData* pData = new GlosBibUserData;
+ pData->sPath = aPathLB.GetSelectEntry();
+ pData->sGroupName = sNewName;
+ pData->sGroupTitle = sNewTitle;
+ pEntry->SetUserData(pData);
+ aGroupTLB.Select(pEntry);
+ aGroupTLB.MakeVisible(pEntry);
+ aGroupTLB.GetModel()->Resort();
+ return 0;
+}
+/*-----------------09.06.97 13:42-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwGlossaryGroupDlg, ModifyHdl, Edit*, EMPTYARG )
+{
+ String sEntry(aNameED.GetText());
+// sEntry.ToLower();
+ BOOL bEnableNew = TRUE;
+ BOOL bEnableDel = FALSE;
+ ULONG nCaseReadonly =
+ (ULONG)aPathLB.GetEntryData(aPathLB.GetSelectEntryPos());
+ BOOL bDirReadonly = 0 != (nCaseReadonly&PATH_READONLY);
+
+ if(!sEntry.Len() || bDirReadonly)
+ bEnableNew = FALSE;
+ else if(sEntry.Len())
+ {
+ ULONG nPos = 0xffffffff;
+
+
+ nPos = aGroupTLB.GetEntryPos(sEntry, 0);
+ //ist es nicht case sensitive muss man selbst suchen
+ if( 0xffffffff == nPos)
+ {
+ const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
+ for(USHORT i = 0; i < aGroupTLB.GetEntryCount(); i++)
+ {
+ String sTemp = aGroupTLB.GetEntryText( i, 0 );
+ nCaseReadonly = (ULONG)aPathLB.GetEntryData(
+ aPathLB.GetEntryPos(aGroupTLB.GetEntryText(i,1)));
+ BOOL bCase = 0 != (nCaseReadonly & PATH_CASE_SENSITIVE);
+
+ if( !bCase && rSCmp.isEqual( sTemp, sEntry ))
+ {
+ nPos = i;
+ break;
+ }
+ }
+ }
+ if( 0xffffffff > nPos)
+ {
+ bEnableNew = FALSE;
+ aGroupTLB.Select(aGroupTLB.GetEntry( nPos ));
+ aGroupTLB.MakeVisible(aGroupTLB.GetEntry( nPos ));
+ }
+ }
+ SvLBoxEntry* pEntry = aGroupTLB.FirstSelected();
+ if(pEntry)
+ {
+ GlosBibUserData* pUserData = (GlosBibUserData*)pEntry->GetUserData();
+ bEnableDel = IsDeleteAllowed(pUserData->sGroupName);
+
+// String sGroup = aGroupTLB.GetEntryText(pEntry, 0);
+// sGroup += GLOS_DELIM;
+// sGroup += String::CreateFromInt32(aPathLB.GetEntryPos(aGroupTLB.GetEntryText(pEntry, 1)));
+// bEnableDel = IsDeleteAllowed(sGroup);
+ }
+
+ aDelPB.Enable(bEnableDel);
+ aNewPB.Enable(bEnableNew);
+ aRenamePB.Enable(bEnableNew && pEntry);
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+BOOL SwGlossaryGroupDlg::IsDeleteAllowed(const String &rGroup)
+{
+ BOOL bDel = (!pGlosHdl->IsReadOnly(&rGroup));
+
+ // OM: befindet sich der Name unter den den neuen Bereichsnamen,
+ // dann ist er auch loeschbar! Bei noch nicht existenten Bereichsnamen
+ // liefert ReadOnly naemlich TRUE.
+
+ if(pInsertedArr && pInsertedArr->Count())
+ {
+ USHORT nCount = pInsertedArr->Count();
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ const String* pTemp = (*pInsertedArr)[i];
+ if(*pTemp == rGroup)
+ {
+ bDel = TRUE;
+ break;
+ }
+ }
+ }
+
+ return bDel;
+}
+
+/*-----------------18.07.97 19:06-------------------
+
+--------------------------------------------------*/
+void FEdit::KeyInput( const KeyEvent& rKEvent )
+{
+ KeyCode aCode = rKEvent.GetKeyCode();
+ if( KEYGROUP_CURSOR == aCode.GetGroup() ||
+ ( KEYGROUP_MISC == aCode.GetGroup() &&
+ KEY_DELETE >= aCode.GetCode() ) ||
+ SVT_SEARCHPATH_DELIMITER != rKEvent.GetCharCode() )
+ Edit::KeyInput( rKEvent );
+}
+/* -----------------------------08.02.00 15:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwGlossaryGroupTLB::RequestHelp( const HelpEvent& rHEvt )
+{
+ Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
+ SvLBoxEntry* pEntry = GetEntry( aPos );
+ if(pEntry)
+ {
+ SvLBoxTab* pTab;
+ SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab );
+ if(pItem)
+ {
+ aPos = GetEntryPosition( pEntry );
+ Size aSize(pItem->GetSize( this, pEntry ));
+ aPos.X() = GetTabPos( pEntry, pTab );
+
+ if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
+ aSize.Width() = GetSizePixel().Width() - aPos.X();
+ aPos = OutputToScreenPixel(aPos);
+ Rectangle aItemRect( aPos, aSize );
+ String sMsg;
+ GlosBibUserData* pData = (GlosBibUserData*)pEntry->GetUserData();
+ sMsg = pData->sPath;
+ sMsg += INET_PATH_TOKEN;
+ sMsg += pData->sGroupName.GetToken(0, GLOS_DELIM);
+ sMsg += SwGlossaries::GetExtension();
+
+ Help::ShowQuickHelp( this, aItemRect, sMsg,
+ QUICKHELP_LEFT|QUICKHELP_VCENTER );
+ }
+ }
+}
diff --git a/sw/source/ui/misc/glosbib.hrc b/sw/source/ui/misc/glosbib.hrc
new file mode 100644
index 000000000000..834163d52fe0
--- /dev/null
+++ b/sw/source/ui/misc/glosbib.hrc
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FT_BIB 1
+#define FT_PATH 2
+#define FT_SELECT 3
+#define CO_NAME 2
+#define PB_NEW 3
+#define PB_DELETE 4
+#define BT_OK 5
+#define BT_CANCEL 6
+#define BT_HELP 7
+#define LB_PATH 8
+#define TLB_GROUPS 9
+#define ED_NAME 10
+#define PB_RENAME 11
+
diff --git a/sw/source/ui/misc/glosbib.src b/sw/source/ui/misc/glosbib.src
new file mode 100644
index 000000000000..97d83c4fdd90
--- /dev/null
+++ b/sw/source/ui/misc/glosbib.src
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "glosbib.hrc"
+#include "misc.hrc"
+#include "helpid.h"
+ModalDialog DLG_BIB_BASE
+{
+ HelpID = HID_BIB_BASE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 349 , 121 ) ;
+ Moveable = TRUE ;
+ Text [ en-US ] = "Edit Categories" ;
+ PushButton PB_NEW
+ {
+ HelpID = "sw:PushButton:DLG_BIB_BASE:PB_NEW";
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 293 , 66 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~New" ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_DELETE
+ {
+ HelpID = "sw:PushButton:DLG_BIB_BASE:PB_DELETE";
+ Pos = MAP_APPFONT ( 293 , 83 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Löschen : ~L÷schen */
+ Text [ en-US ] = "~Delete" ;
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ };
+ PushButton PB_RENAME
+ {
+ HelpID = "sw:PushButton:DLG_BIB_BASE:PB_RENAME";
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 293 , 100 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Rename" ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_BIB
+ {
+ Pos = MAP_APPFONT ( 12 , 3 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Text [ en-US ] = "Category" ;
+ };
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 293 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 293 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 293 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ Edit ED_NAME
+ {
+ HelpID = "sw:Edit:DLG_BIB_BASE:ED_NAME";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 159 , 12 ) ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ MaxTextLength = 256 ;
+ };
+ FixedText FT_PATH
+ {
+ Pos = MAP_APPFONT ( 174 , 3 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "Path";
+ };
+ ListBox LB_PATH
+ {
+ HelpID = "sw:ListBox:DLG_BIB_BASE:LB_PATH";
+ Pos = MAP_APPFONT ( 174 , 14 ) ;
+ Size = MAP_APPFONT ( 107 , 50 ) ;
+ DropDown = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ DDExtraWidth = TRUE ;
+ };
+ FixedText FT_SELECT
+ {
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 100 , 8 ) ;
+ Text [ en-US ] = "Selection list";
+ };
+ Control TLB_GROUPS
+ {
+ Pos = MAP_APPFONT ( 12 , 41 ) ;
+ Size = MAP_APPFONT ( 269 , 73 ) ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+ /* ComboBox CO_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 89 , 76 ) ;
+ TabStop = TRUE ;
+#ifdef WIN
+ MaxTextLength = 8 ;
+#else
+ MaxTextLength = 32 ;
+#endif
+ Sort = TRUE ;
+ };*/
+};
+/*
+String STR_GLOSSARY_BIB_DLG
+{
+ Text [ en-US ] = "Edit Categories" ;
+};*/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx
new file mode 100644
index 000000000000..6ed886fb3974
--- /dev/null
+++ b/sw/source/ui/misc/glosdoc.cxx
@@ -0,0 +1,806 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <memory>
+
+#include <com/sun/star/container/XNamed.hpp>
+
+#define _SVSTDARR_STRINGS
+#include <unotools/transliterationwrapper.hxx>
+
+#include <svl/svstdarr.hxx>
+
+#ifndef __RSC //autogen
+#include <tools/errinf.hxx>
+#endif
+#include <tools/debug.hxx>
+#include <svl/urihelper.hxx>
+#ifndef SVTOOLS_FSTATHELPER_HXX
+#include <svl/fstathelper.hxx>
+#endif
+#include <unotools/pathoptions.hxx>
+#include <unotools/tempfile.hxx>
+#include <swtypes.hxx>
+#include <errhdl.hxx> // ASSERT
+#include <uitool.hxx>
+#include <glosdoc.hxx>
+#include <shellio.hxx>
+#include <swunohelper.hxx>
+
+#include <unoatxt.hxx>
+#include <swerror.h>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+
+// PUBLIC METHODES -------------------------------------------------------
+/* -----------------------------08.02.00 15:54--------------------------------
+
+ ---------------------------------------------------------------------------*/
+String lcl_CheckFileName( const String& rNewFilePath,
+ const String& rNewGroupName )
+{
+ String sRet;
+ //group name should contain only A-Z and a-z and spaces
+ for( xub_StrLen i = 0; i < rNewGroupName.Len(); i++ )
+ {
+ sal_Unicode cChar = rNewGroupName.GetChar(i);
+ if( (cChar >= 'A' && cChar <= 'Z') ||
+ (cChar >= 'a' && cChar <= 'z') ||
+ (cChar >= '0' && cChar <= '9') ||
+ cChar == '_' || cChar == 0x20 )
+ {
+ sRet += cChar;
+ }
+ }
+ sRet.EraseLeadingChars();
+ sRet.EraseTrailingChars();
+
+ BOOL bOk = FALSE;
+ if( sRet.Len() )
+ {
+ String sTmpDir(rNewFilePath);
+ sTmpDir += INET_PATH_TOKEN;
+ sTmpDir += sRet;
+ sTmpDir += SwGlossaries::GetExtension();
+ bOk = !FStatHelper::IsDocument( sTmpDir );
+ }
+
+ if( !bOk )
+ {
+ String rSG = SwGlossaries::GetExtension();
+ //generate generic name
+ utl::TempFile aTemp(
+ String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "group" )),
+ &rSG, &rNewFilePath );
+ aTemp.EnableKillingFile();
+
+ INetURLObject aTempURL( aTemp.GetURL() );
+ sRet = aTempURL.GetBase();
+ }
+ return sRet;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Liefert den Namen der Default-Gruppe
+------------------------------------------------------------------------*/
+
+
+String SwGlossaries::GetDefName()
+{
+ return String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "standard" ));
+
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Liefert die Anzahl der Textbausteingruppen
+------------------------------------------------------------------------*/
+
+
+sal_uInt16 SwGlossaries::GetGroupCnt()
+{
+ return GetNameList()->Count();
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Liefert den Gruppennamen
+------------------------------------------------------------------------*/
+sal_Bool SwGlossaries::FindGroupName(String & rGroup)
+{
+ // enthaelt der Gruppenname keinen Pfad, kann hier ein passender
+ // Gruppeneintrag gesucht werden;
+ sal_uInt16 nCount = GetGroupCnt();
+ sal_uInt16 i;
+ for(i= 0; i < nCount; i++)
+ {
+ String sTemp(GetGroupName(i));
+ if(rGroup.Equals( sTemp.GetToken(0, GLOS_DELIM)))
+ {
+ rGroup = sTemp;
+ return sal_True;
+ }
+ }
+ //man darf zweimal suchen, denn bei mehreren Verzeichnissen koennte
+ //der caseinsensitive Name mehrfach auftreten
+ const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
+ for(i = 0; i < nCount; i++)
+ {
+ String sTemp( GetGroupName( i ));
+ sal_uInt16 nPath = (sal_uInt16)sTemp.GetToken(1, GLOS_DELIM).ToInt32();
+
+ if( !SWUnoHelper::UCB_IsCaseSensitiveFileName( *(*m_pPathArr)[nPath] )
+ && rSCmp.isEqual( rGroup, sTemp.GetToken( 0, GLOS_DELIM) ) )
+ {
+ rGroup = sTemp;
+ return sal_True;
+ }
+ }
+ return sal_False;
+}
+/* ---------------------------------------------------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+String SwGlossaries::GetGroupName(sal_uInt16 nGroupId)
+{
+ ASSERT(nGroupId < m_pGlosArr->Count(), Textbausteinarray ueberindiziert);
+ return *(*m_pGlosArr)[nGroupId];
+}
+/* -----------------------------08.02.00 13:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+String SwGlossaries::GetGroupTitle( const String& rGroupName )
+{
+ String sRet;
+ String sGroup(rGroupName);
+ if(STRING_NOTFOUND == sGroup.Search(GLOS_DELIM))
+ FindGroupName(sGroup);
+ SwTextBlocks* pGroup = GetGroupDoc(sGroup, sal_False);
+ if(pGroup)
+ {
+ sRet = pGroup->GetName();
+ PutGroupDoc( pGroup );
+ }
+ return sRet;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Liefert das Textbaustein-Dokument der Gruppe rName
+------------------------------------------------------------------------*/
+
+SwTextBlocks* SwGlossaries::GetGroupDoc(const String &rName,
+ sal_Bool bCreate) const
+{
+ // gfs. in die Liste der Textbausteine eintragen
+ if(bCreate && m_pGlosArr)
+ {
+ const String aName(rName);
+ const sal_uInt16 nCount = m_pGlosArr->Count();
+ sal_uInt16 i;
+
+ for( i = 0; i < nCount; ++i)
+ {
+ const String *pName = (*m_pGlosArr)[i];
+ if(*pName == aName)
+ break;
+ }
+ if(i == nCount)
+ { // Baustein nicht in der Liste
+ String *pTmp = new String(aName);
+ m_pGlosArr->Insert(pTmp, m_pGlosArr->Count());
+ }
+ }
+ return GetGlosDoc( rName, bCreate );
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Loeschen Textblock
+------------------------------------------------------------------------*/
+
+void SwGlossaries::PutGroupDoc(SwTextBlocks *pBlock) {
+ delete pBlock;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Erzeugt ein neues Dokument mit dem Gruppenname
+ Wird temp. auch als File angelegt, damit die
+ Gruppen auch spaeter (ohne Zugriff) vorhanden sind.
+------------------------------------------------------------------------*/
+
+
+sal_Bool SwGlossaries::NewGroupDoc(String& rGroupName, const String& rTitle)
+{
+ sal_uInt16 nNewPath = (sal_uInt16)rGroupName.GetToken(1, GLOS_DELIM).ToInt32();
+ String sNewFilePath(*(*m_pPathArr)[nNewPath]);
+ String sNewGroup = lcl_CheckFileName(sNewFilePath, rGroupName.GetToken(0, GLOS_DELIM));
+ sNewGroup += GLOS_DELIM;
+ sNewGroup += rGroupName.GetToken(1, GLOS_DELIM);
+ SwTextBlocks *pBlock = GetGlosDoc( sNewGroup );
+ if(pBlock)
+ {
+ String *pTmp =
+ new String(sNewGroup);
+ SvStrings* pList = GetNameList();
+ pList->Insert(pTmp, pList->Count());
+ pBlock->SetName(rTitle);
+ PutGroupDoc(pBlock);
+ rGroupName = sNewGroup;
+ return sal_True;
+ }
+ return sal_False;
+}
+/* -----------------23.11.98 13:13-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwGlossaries::RenameGroupDoc(
+ const String& rOldGroup, String& rNewGroup, const String& rNewTitle )
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 nOldPath = (sal_uInt16)rOldGroup.GetToken(1, GLOS_DELIM).ToInt32();
+ if(nOldPath < m_pPathArr->Count())
+ {
+ String sOldFileURL(*(*m_pPathArr)[nOldPath]);
+ sOldFileURL += INET_PATH_TOKEN;
+ sOldFileURL += rOldGroup.GetToken(0, GLOS_DELIM);
+ sOldFileURL += SwGlossaries::GetExtension();
+ BOOL bExist = FStatHelper::IsDocument( sOldFileURL );
+ DBG_ASSERT(bExist, "Gruppe existiert nicht!");
+ if(bExist)
+ {
+ sal_uInt16 nNewPath = (sal_uInt16)rNewGroup.GetToken(1, GLOS_DELIM).ToInt32();
+ if( nNewPath < m_pPathArr->Count())
+ {
+ String sNewFilePath(*(*m_pPathArr)[nNewPath]);
+ String sNewFileName = lcl_CheckFileName(
+ sNewFilePath, rNewGroup.GetToken(0, GLOS_DELIM));
+ //String aTmp( rNewGroup.GetToken(0, GLOS_DELIM));
+ const sal_uInt16 nFileNameLen = sNewFileName.Len();
+ sNewFileName += SwGlossaries::GetExtension();
+ String sTempNewFilePath(sNewFilePath);
+ sTempNewFilePath += INET_PATH_TOKEN;
+ sTempNewFilePath += sNewFileName ;
+ bExist = FStatHelper::IsDocument( sTempNewFilePath );
+ DBG_ASSERT(!bExist, "Gruppe existiert bereits!");
+ if(!bExist)
+ {
+ BOOL bCopyCompleted = SWUnoHelper::UCB_CopyFile(
+ sOldFileURL, sTempNewFilePath, TRUE );
+ if(bCopyCompleted)
+ {
+ bRet = sal_True;
+ RemoveFileFromList( rOldGroup );
+
+ rNewGroup = sNewFileName.Copy(0, nFileNameLen);
+ rNewGroup += GLOS_DELIM;
+ rNewGroup += String::CreateFromInt32(nNewPath);
+ String *pTmp = new String(rNewGroup);
+ if(!m_pGlosArr)
+ GetNameList();
+ else
+ m_pGlosArr->Insert(pTmp, m_pGlosArr->Count());
+
+ sNewFilePath += INET_PATH_TOKEN;
+ sNewFilePath += sNewFileName ;
+ SwTextBlocks* pNewBlock = new SwTextBlocks( sNewFilePath );
+ pNewBlock->SetName(rNewTitle);
+ delete pNewBlock;
+ }
+ }
+ }
+ }
+ }
+ return bRet;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Loescht eine Textbausteingruppe
+------------------------------------------------------------------------*/
+
+
+sal_Bool SwGlossaries::DelGroupDoc(const String &rName)
+{
+ sal_uInt16 nPath = (sal_uInt16)rName.GetToken(1, GLOS_DELIM).ToInt32();
+ if(nPath >= m_pPathArr->Count())
+ return sal_False;
+ String sFileURL(*(*m_pPathArr)[nPath]);
+ String aTmp( rName.GetToken(0, GLOS_DELIM));
+ String aName(aTmp);
+ aName += GLOS_DELIM;
+ aName += String::CreateFromInt32(nPath);
+
+ aTmp += SwGlossaries::GetExtension();
+ sFileURL += INET_PATH_TOKEN;
+ sFileURL += aTmp;
+ // Auch, wenn das File nicht existiert, muss es aus der Liste
+ // der Textbausteinbereiche entfernt werden
+ // Kein && wegen CFfront
+ BOOL bRemoved = SWUnoHelper::UCB_DeleteFile( sFileURL );
+ DBG_ASSERT(bRemoved, "file has not been removed");
+ RemoveFileFromList( aName );
+ return bRemoved;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: DTOR
+------------------------------------------------------------------------*/
+
+
+SwGlossaries::~SwGlossaries()
+{
+ sal_uInt16 nCount = m_pGlosArr? m_pGlosArr->Count() : 0;
+ sal_uInt16 i;
+
+ for( i = 0; i < nCount; ++i)
+ {
+ String *pTmp = (*m_pGlosArr)[i];
+ delete pTmp;
+ }
+ nCount = m_pPathArr? m_pPathArr->Count() : 0;
+ for(i = 0; i < nCount; ++i)
+ {
+ String *pTmp = (*m_pPathArr)[i];
+ delete pTmp;
+ }
+ delete m_pGlosArr;
+ delete m_pPathArr;
+
+ InvalidateUNOOjects();
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Bausteindokument einlesen
+------------------------------------------------------------------------*/
+
+
+SwTextBlocks* SwGlossaries::GetGlosDoc( const String &rName, sal_Bool bCreate ) const
+{
+ sal_uInt16 nPath = (sal_uInt16)rName.GetToken(1, GLOS_DELIM).ToInt32();
+ SwTextBlocks *pTmp = 0;
+ if(nPath < m_pPathArr->Count())
+ {
+ String sFileURL(*(*m_pPathArr)[nPath]);
+ String aTmp( rName.GetToken(0, GLOS_DELIM));
+ aTmp += SwGlossaries::GetExtension();
+ sFileURL += INET_PATH_TOKEN;
+ sFileURL += aTmp;
+
+ BOOL bExist = FALSE;
+ if(!bCreate)
+ bExist = FStatHelper::IsDocument( sFileURL );
+
+ if (bCreate || bExist)
+ {
+ pTmp = new SwTextBlocks( sFileURL );
+ sal_Bool bOk = sal_True;
+ if( pTmp->GetError() )
+ {
+ ErrorHandler::HandleError( pTmp->GetError() );
+ bOk = !IsError( pTmp->GetError() );
+ }
+
+ if( bOk && !pTmp->GetName().Len() )
+ pTmp->SetName( rName );
+ }
+ }
+
+ return pTmp;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Zugriff auf die Liste der Name; diese wird gfs. eingelesen
+------------------------------------------------------------------------*/
+
+SvStrings* SwGlossaries::GetNameList()
+{
+ if( !m_pGlosArr )
+ {
+ m_pGlosArr = new SvStrings;
+ String sExt( SwGlossaries::GetExtension() );
+ for( sal_uInt16 i = 0; i < m_pPathArr->Count(); i++ )
+ {
+ SvStrings aFiles( 16, 16 );
+
+ SWUnoHelper::UCB_GetFileListOfFolder( *(*m_pPathArr)[i], aFiles,
+ &sExt );
+ for( USHORT nFiles = 0, nFEnd = aFiles.Count();
+ nFiles < nFEnd; ++nFiles )
+ {
+ String* pTitle = aFiles[ nFiles ];
+ String sName( pTitle->Copy( 0, pTitle->Len() - sExt.Len() ));
+ sName += GLOS_DELIM;
+ sName += String::CreateFromInt32( i );
+ m_pGlosArr->Insert( new String(sName), m_pGlosArr->Count() );
+
+ // don't need any more these pointers
+ delete pTitle;
+ }
+ }
+ if(!m_pGlosArr->Count())
+ {
+ // Der Standard-Baustein steht im ersten Teil des Pfades
+ String *pTmp = new String( SwGlossaries::GetDefName() );
+ (*pTmp) += GLOS_DELIM;
+ (*pTmp) += '0';
+ m_pGlosArr->Insert(pTmp, m_pGlosArr->Count());
+ }
+ }
+ return m_pGlosArr;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: CTOR
+------------------------------------------------------------------------*/
+
+
+SwGlossaries::SwGlossaries() :
+ m_pPathArr(0),
+ m_pGlosArr(0)
+{
+ m_pPathArr = new SvStrings;
+ UpdateGlosPath(sal_True);
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Neuen Pfad einstellen und internes Array neu aufbauen
+------------------------------------------------------------------------*/
+
+/* -----------------21.01.99 15:36-------------------
+* #61050# Doppelte Pfade fuehren zu Verwirrung - als raus damit
+ * --------------------------------------------------*/
+sal_Bool lcl_FindSameEntry(const SvStrings& rDirArr, const String& rEntryURL)
+{
+ for(sal_uInt16 i = 0; i < rDirArr.Count(); i++)
+ if(rEntryURL == (*rDirArr.GetObject(i)))
+ return sal_True;
+ return sal_False;
+}
+
+void SwGlossaries::UpdateGlosPath(sal_Bool bFull)
+{
+ SvtPathOptions aPathOpt;
+ String aNewPath( aPathOpt.GetAutoTextPath() );
+ sal_Bool bPathChanged = m_aPath != aNewPath;
+ if (bFull || bPathChanged)
+ {
+ m_aPath = aNewPath;
+ sal_uInt16 nCount = m_pPathArr? m_pPathArr->Count() : 0;
+ sal_uInt16 i;
+
+ for( i = nCount; i; --i)
+ {
+ String *pTmp = (*m_pPathArr)[i - 1];
+ m_pPathArr->Remove(i - 1);
+ delete pTmp;
+ }
+ sal_uInt16 nTokenCount = m_aPath.GetTokenCount(SVT_SEARCHPATH_DELIMITER);
+ SvStrings aDirArr;
+ for( i = 0; i < nTokenCount; i++ )
+ {
+ String sPth(m_aPath.GetToken(i, SVT_SEARCHPATH_DELIMITER));
+ sPth = URIHelper::SmartRel2Abs(
+ INetURLObject(), sPth, URIHelper::GetMaybeFileHdl());
+
+ if(i && lcl_FindSameEntry(aDirArr, sPth))
+ {
+ continue;
+ }
+ aDirArr.Insert(new String(sPth), aDirArr.Count());
+ if( !FStatHelper::IsFolder( sPth ) )
+ {
+ if( m_sErrPath.Len() )
+ m_sErrPath += SVT_SEARCHPATH_DELIMITER;
+ INetURLObject aTemp( sPth );
+ m_sErrPath += String(aTemp.GetFull());
+ }
+ else
+ m_pPathArr->Insert(new String(sPth), m_pPathArr->Count());
+ }
+ aDirArr.DeleteAndDestroy(0, aDirArr.Count());
+
+ if(!nTokenCount ||
+ (m_sErrPath.Len() && (bPathChanged || m_sOldErrPath != m_sErrPath)) )
+ {
+ m_sOldErrPath = m_sErrPath;
+ // Falscher Pfad, d.h. AutoText-Verzeichnis existiert nicht
+
+ ErrorHandler::HandleError( *new StringErrorInfo(
+ ERR_AUTOPATH_ERROR, m_sErrPath,
+ ERRCODE_BUTTON_OK | ERRCODE_MSG_ERROR ));
+ m_bError = sal_True;
+ }
+ else
+ m_bError = sal_False;
+
+ if(m_pGlosArr)
+ {
+ for(i = 0; i < m_pGlosArr->Count(); ++i)
+ {
+ delete (String *)(*m_pGlosArr)[i];
+ }
+ DELETEZ(m_pGlosArr);
+ GetNameList();
+ }
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+void SwGlossaries::ShowError()
+{
+ sal_uInt32 nPathError = *new StringErrorInfo(ERR_AUTOPATH_ERROR,
+ m_sErrPath, ERRCODE_BUTTON_OK );
+ ErrorHandler::HandleError( nPathError );
+}
+/* -----------------------------09.02.00 11:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+String SwGlossaries::GetExtension()
+{
+ return String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( ".bau" ));
+}
+
+
+
+void SwGlossaries::RemoveFileFromList( const String& rGroup )
+{
+ if(m_pGlosArr)
+ {
+ const sal_uInt16 nCount = m_pGlosArr->Count();
+ for(sal_uInt16 i = 0; i < nCount; ++i)
+ {
+ String *pTmp = (*m_pGlosArr)[i];
+ if(*pTmp == rGroup)
+ {
+ rtl::OUString aUName = rGroup;
+ {
+ // tell the UNO AutoTextGroup object that it's not valid anymore
+ for ( UnoAutoTextGroups::iterator aLoop = m_aGlossaryGroups.begin();
+ aLoop != m_aGlossaryGroups.end();
+ ++aLoop
+ )
+ {
+ Reference< container::XNamed > xNamed( aLoop->get(), UNO_QUERY );
+ if ( xNamed.is() && ( xNamed->getName() == aUName ) )
+ {
+ static_cast< SwXAutoTextGroup* >( xNamed.get() )->Invalidate();
+ // note that this static_cast works because we know that the array only
+ // contains SwXAutoTextGroup implementation
+ m_aGlossaryGroups.erase( aLoop );
+ break;
+ }
+ }
+ }
+
+ {
+ // tell all our UNO AutoTextEntry objects that they're not valid anymore
+ for ( UnoAutoTextEntries::iterator aLoop = m_aGlossaryEntries.begin();
+ aLoop != m_aGlossaryEntries.end();
+ )
+ {
+ Reference< lang::XUnoTunnel > xEntryTunnel( aLoop->get(), UNO_QUERY );
+
+ SwXAutoTextEntry* pEntry = NULL;
+ if ( xEntryTunnel.is() )
+ pEntry = reinterpret_cast< SwXAutoTextEntry* >(
+ xEntryTunnel->getSomething( SwXAutoTextEntry::getUnoTunnelId() ) );
+
+ if ( pEntry && ( pEntry->GetGroupName() == rGroup ) )
+ {
+ pEntry->Invalidate();
+ aLoop = m_aGlossaryEntries.erase( aLoop );
+ }
+ else
+ ++aLoop;
+ }
+ }
+
+ m_pGlosArr->Remove(i);
+ delete pTmp;
+ break;
+ }
+ }
+ }
+}
+
+
+String SwGlossaries::GetCompleteGroupName( const rtl::OUString& GroupName )
+{
+ sal_uInt16 nCount = GetGroupCnt();
+ //wenn der Gruppenname intern erzeugt wurde, dann steht auch hier der Pfad drin
+ String sGroup(GroupName);
+ String sGroupName(sGroup.GetToken(0, GLOS_DELIM));
+ String sPath = sGroup.GetToken(1, GLOS_DELIM);
+ sal_Bool bPathLen = sPath.Len() > 0;
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ String sGrpName = GetGroupName(i);
+ if(bPathLen ? sGroup == sGrpName : sGroupName == sGrpName.GetToken(0, GLOS_DELIM))
+ {
+ return sGrpName;
+ }
+ }
+ return aEmptyStr;
+}
+
+
+void SwGlossaries::InvalidateUNOOjects()
+{
+ // invalidate all the AutoTextGroup-objects
+ for ( UnoAutoTextGroups::iterator aGroupLoop = m_aGlossaryGroups.begin();
+ aGroupLoop != m_aGlossaryGroups.end();
+ ++aGroupLoop
+ )
+ {
+ Reference< text::XAutoTextGroup > xGroup( aGroupLoop->get(), UNO_QUERY );
+ if ( xGroup.is() )
+ static_cast< SwXAutoTextGroup* >( xGroup.get() )->Invalidate();
+ }
+ UnoAutoTextGroups aTmpg = UnoAutoTextGroups();
+ m_aGlossaryGroups.swap( aTmpg );
+
+ // invalidate all the AutoTextEntry-objects
+ for ( UnoAutoTextEntries::const_iterator aEntryLoop = m_aGlossaryEntries.begin();
+ aEntryLoop != m_aGlossaryEntries.end();
+ ++aEntryLoop
+ )
+ {
+ Reference< lang::XUnoTunnel > xEntryTunnel( aEntryLoop->get(), UNO_QUERY );
+ SwXAutoTextEntry* pEntry = NULL;
+ if ( xEntryTunnel.is() )
+ pEntry = reinterpret_cast< SwXAutoTextEntry* >(
+ xEntryTunnel->getSomething( SwXAutoTextEntry::getUnoTunnelId() ) );
+
+ if ( pEntry )
+ pEntry->Invalidate();
+ }
+ UnoAutoTextEntries aTmpe = UnoAutoTextEntries();
+ m_aGlossaryEntries.swap( aTmpe );
+}
+
+//-----------------------------------------------------------------------
+//--- 03.03.2003 14:15:32 -----------------------------------------------
+
+Reference< text::XAutoTextGroup > SwGlossaries::GetAutoTextGroup( const ::rtl::OUString& _rGroupName, bool _bCreate )
+{
+ // first, find the name with path-extension
+ String sCompleteGroupName = GetCompleteGroupName( _rGroupName );
+
+ Reference< text::XAutoTextGroup > xGroup;
+
+ // look up the group in the cache
+ UnoAutoTextGroups::iterator aSearch = m_aGlossaryGroups.begin();
+ for ( ; aSearch != m_aGlossaryGroups.end(); )
+ {
+ Reference< lang::XUnoTunnel > xGroupTunnel( aSearch->get(), UNO_QUERY );
+
+ SwXAutoTextGroup* pSwGroup = 0;
+ if ( xGroupTunnel.is() )
+ pSwGroup = reinterpret_cast< SwXAutoTextGroup* >( xGroupTunnel->getSomething( SwXAutoTextGroup::getUnoTunnelId() ) );
+
+ if ( !pSwGroup )
+ {
+ // the object is dead in the meantime -> remove from cache
+ aSearch = m_aGlossaryGroups.erase( aSearch );
+ continue;
+ }
+
+ if ( _rGroupName == pSwGroup->getName() )
+ { // the group is already cached
+ if ( sCompleteGroupName.Len() )
+ { // the group still exists -> return it
+ xGroup = pSwGroup;
+ break;
+ }
+ else
+ {
+ // this group does not exist (anymore) -> release the cached UNO object for it
+ aSearch = m_aGlossaryGroups.erase( aSearch );
+ // so it won't be created below
+ _bCreate = sal_False;
+ break;
+ }
+ }
+
+ ++aSearch;
+ }
+
+ if ( !xGroup.is() && _bCreate )
+ {
+ xGroup = new SwXAutoTextGroup( sCompleteGroupName, this );
+ // cache it
+ m_aGlossaryGroups.push_back( AutoTextGroupRef( xGroup ) );
+ }
+
+ return xGroup;
+}
+
+//-----------------------------------------------------------------------
+//--- 03.03.2003 13:46:06 -----------------------------------------------
+
+Reference< text::XAutoTextEntry > SwGlossaries::GetAutoTextEntry( const String& _rCompleteGroupName, const ::rtl::OUString& _rGroupName, const ::rtl::OUString& _rEntryName,
+ bool _bCreate )
+{
+ //standard must be created
+ sal_Bool bCreate = ( _rCompleteGroupName == GetDefName() );
+ ::std::auto_ptr< SwTextBlocks > pGlosGroup( GetGroupDoc( _rCompleteGroupName, bCreate ) );
+
+ if ( pGlosGroup.get() && !pGlosGroup->GetError() )
+ {
+ sal_uInt16 nIdx = pGlosGroup->GetIndex( _rEntryName );
+ if ( USHRT_MAX == nIdx )
+ throw container::NoSuchElementException();
+ }
+ else
+ throw lang::WrappedTargetException();
+
+ Reference< text::XAutoTextEntry > xReturn;
+ String sGroupName( _rGroupName );
+ String sEntryName( _rEntryName );
+
+ UnoAutoTextEntries::iterator aSearch( m_aGlossaryEntries.begin() );
+ for ( ; aSearch != m_aGlossaryEntries.end(); )
+ {
+ Reference< lang::XUnoTunnel > xEntryTunnel( aSearch->get(), UNO_QUERY );
+
+ SwXAutoTextEntry* pEntry = NULL;
+ if ( xEntryTunnel.is() )
+ pEntry = reinterpret_cast< SwXAutoTextEntry* >( xEntryTunnel->getSomething( SwXAutoTextEntry::getUnoTunnelId() ) );
+ else
+ {
+ // the object is dead in the meantime -> remove from cache
+ aSearch = m_aGlossaryEntries.erase( aSearch );
+ continue;
+ }
+
+ if ( pEntry
+ && ( COMPARE_EQUAL == pEntry->GetGroupName().CompareTo( sGroupName ) )
+ && ( COMPARE_EQUAL == pEntry->GetEntryName().CompareTo( sEntryName ) )
+ )
+ {
+ xReturn = pEntry;
+ break;
+ }
+
+ ++aSearch;
+ }
+
+ if ( !xReturn.is() && _bCreate )
+ {
+ xReturn = new SwXAutoTextEntry( this, sGroupName, sEntryName );
+ // cache it
+ m_aGlossaryEntries.push_back( AutoTextEntryRef( xReturn ) );
+ }
+
+ return xReturn;
+}
+
+
+
diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx
new file mode 100644
index 000000000000..2d2c1989d65c
--- /dev/null
+++ b/sw/source/ui/misc/glossary.cxx
@@ -0,0 +1,1305 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#define _SVSTDARR_STRINGSDTOR
+#define _SVSTDARR_STRINGS
+#include <hintids.hxx>
+
+#include <vcl/menu.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/help.hxx>
+#ifndef _SVSTDARR_HXX
+#include <svl/svstdarr.hxx>
+#endif
+#include <svl/stritem.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/lingucfg.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/fcontnr.hxx>
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <editeng/acorrcfg.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <unocrsr.hxx>
+#include <unotools.hxx>
+#include <comphelper/processfactory.hxx>
+#include <ucbhelper/content.hxx>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <svl/urihelper.hxx>
+#include <unotools/charclass.hxx>
+#include <swwait.hxx>
+#include <swtypes.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <basesh.hxx>
+#include <glossary.hxx>
+#include <gloshdl.hxx>
+#include <glosbib.hxx>
+#include <initui.hxx> // fuer ::GetGlossaries()
+#include <glosdoc.hxx>
+#include <macassgn.hxx>
+#include <swevent.hxx>
+#include <docsh.hxx>
+#include <shellio.hxx>
+
+#include <cmdid.h>
+#include <helpid.h>
+#include <swerror.h>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _MISC_HRC
+#include <misc.hrc>
+#endif
+#ifndef _GLOSSARY_HRC
+#include <glossary.hrc>
+#endif
+#include <swmodule.hxx>
+#include <sfx2/filedlghelper.hxx>
+
+#define LONG_LENGTH 60
+#define SHORT_LENGTH 30
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::ucb;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::comphelper;
+using namespace ::ucbhelper;
+using ::rtl::OUString;
+using namespace ::sfx2;
+
+String lcl_GetValidShortCut( const String& rName )
+{
+ const sal_uInt16 nSz = rName.Len();
+
+ if ( 0 == nSz )
+ return rName;
+
+ sal_uInt16 nStart = 1;
+ while( rName.GetChar( nStart-1 ) == ' ' && nStart < nSz )
+ nStart++;
+
+ String aBuf( rName.GetChar( nStart-1 ));
+
+ for( ; nStart < nSz; ++nStart )
+ {
+ if( rName.GetChar( nStart-1 ) == ' ' && rName.GetChar( nStart ) != ' ')
+ aBuf += rName.GetChar( nStart );
+ }
+ return aBuf;
+}
+
+/* -----------------------------08.02.00 10:28--------------------------------
+
+ ---------------------------------------------------------------------------*/
+struct GroupUserData
+{
+ String sGroupName;
+ sal_uInt16 nPathIdx;
+ BOOL bReadonly;
+
+ GroupUserData()
+ : nPathIdx(0),
+ bReadonly(FALSE) {}
+};
+
+/*------------------------------------------------------------------------
+ Beschreibung: Dialog fuer neuen Bausteinnamen
+------------------------------------------------------------------------*/
+class SwNewGlosNameDlg : public ModalDialog
+{
+ FixedText aNNFT;
+ Edit aNewName;
+ FixedText aNSFT;
+ NoSpaceEdit aNewShort;
+ OKButton aOk;
+ CancelButton aCancel;
+ FixedLine aFL;
+ FixedText aONFT;
+ Edit aOldName;
+ FixedText aOSFT;
+ Edit aOldShort;
+
+protected:
+ DECL_LINK( Modify, Edit * );
+ DECL_LINK( Rename, Button * );
+
+public:
+ SwNewGlosNameDlg( Window* pParent,
+ const String& rOldName,
+ const String& rOldShort );
+
+ String GetNewName() const { return aNewName.GetText(); }
+ String GetNewShort() const { return aNewShort.GetText(); }
+};
+
+SwNewGlosNameDlg::SwNewGlosNameDlg(Window* pParent,
+ const String& rOldName,
+ const String& rOldShort ) :
+ ModalDialog( pParent, SW_RES( DLG_RENAME_GLOS ) ),
+ aNNFT (this, SW_RES( FT_NN )),
+ aNewName(this, SW_RES( ED_NN )),
+ aNSFT (this, SW_RES( FT_NS )),
+ aNewShort(this,SW_RES( ED_NS )),
+ aOk (this, SW_RES( BT_OKNEW)),
+ aCancel (this, SW_RES( BT_CANCEL)),
+ aFL (this, SW_RES( FL_NN )),
+ aONFT (this, SW_RES( FT_ON )),
+ aOldName(this, SW_RES( ED_ON )),
+ aOSFT (this, SW_RES( FT_OS )),
+ aOldShort(this,SW_RES( ED_OS ))
+{
+ FreeResource();
+ aOldName.SetText( rOldName );
+ aOldShort.SetText( rOldShort );
+ aNewShort.SetMaxTextLen(SHORT_LENGTH);
+ aNewName.SetMaxTextLen(LONG_LENGTH);
+ aNewName.SetModifyHdl(LINK(this, SwNewGlosNameDlg, Modify ));
+ aNewShort.SetModifyHdl(LINK(this, SwNewGlosNameDlg, Modify ));
+ aOk.SetClickHdl(LINK(this, SwNewGlosNameDlg, Rename ));
+ aNewName.GrabFocus();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: aktuell eingestellte Gruppe erfragen / setzen
+------------------------------------------------------------------------*/
+
+String SwGlossaryDlg::GetCurrGroup()
+{
+ if( ::GetCurrGlosGroup() && ::GetCurrGlosGroup()->Len() )
+ return *(::GetCurrGlosGroup());
+ return SwGlossaries::GetDefName();
+}
+
+
+
+void SwGlossaryDlg::SetActGroup(const String &rGrp)
+{
+ if( !::GetCurrGlosGroup() )
+ ::SetCurrGlosGroup( new String );
+ *(::GetCurrGlosGroup()) = rGrp;
+}
+
+
+
+SwGlossaryDlg::SwGlossaryDlg(SfxViewFrame* pViewFrame,
+ SwGlossaryHdl * pGlosHdl, SwWrtShell *pWrtShell) :
+
+ SvxStandardDialog(&pViewFrame->GetWindow(), SW_RES(DLG_GLOSSARY)),
+
+ aInsertTipCB (this, SW_RES(CB_INSERT_TIP)),
+ aNameLbl (this, SW_RES(FT_NAME)),
+ aNameED (this, SW_RES(ED_NAME)),
+ aShortNameLbl (this, SW_RES(FT_SHORTNAME)),
+ aShortNameEdit(this, SW_RES(ED_SHORTNAME)),
+ aCategoryBox (this, SW_RES(LB_BIB)),
+ aRelativeFL (this, SW_RES(FL_RELATIVE)),
+ aFileRelCB (this, SW_RES(CB_FILE_REL)),
+ aNetRelCB (this, SW_RES(CB_NET_REL)),
+ aExampleWIN (this, SW_RES(WIN_EXAMPLE )),
+ aExampleDummyWIN(this, SW_RES(WIN_EXAMPLE_DUMMY )),
+ aShowExampleCB(this, SW_RES(CB_SHOW_EXAMPLE )),
+ aInsertBtn (this, SW_RES(PB_INSERT)),
+ aCloseBtn (this, SW_RES(PB_CLOSE)),
+ aHelpBtn (this, SW_RES(PB_HELP)),
+ aEditBtn (this, SW_RES(PB_EDIT)),
+ aBibBtn (this, SW_RES(PB_BIB)),
+ aPathBtn (this, SW_RES(PB_PATH)),
+
+ sReadonlyPath (SW_RES(ST_READONLY_PATH)),
+ pExampleFrame(0),
+
+ pMenu (new PopupMenu(SW_RES(MNU_EDIT))),
+ pGlossaryHdl (pGlosHdl),
+
+ bResume(sal_False),
+
+ bSelection( pWrtShell->IsSelection() ),
+ bReadOnly( sal_False ),
+ bIsOld( sal_False ),
+ bIsDocReadOnly(sal_False),
+
+ pSh (pWrtShell)
+{
+ SvtLinguConfig aLocalLinguConfig;
+
+ // Static-Pointer initialisieren
+ if( !::GetCurrGlosGroup() )
+ ::SetCurrGlosGroup(new String);//(SwGlossaries::GetDefName());
+
+ pMenu->SetActivateHdl(LINK(this,SwGlossaryDlg,EnableHdl));
+ pMenu->SetSelectHdl(LINK(this,SwGlossaryDlg,MenuHdl));
+ aEditBtn.SetPopupMenu(pMenu);
+ aEditBtn.SetSelectHdl(LINK(this,SwGlossaryDlg,EditHdl));
+ aPathBtn.SetClickHdl(LINK(this, SwGlossaryDlg, PathHdl));
+
+ aNameED.SetModifyHdl(LINK(this,SwGlossaryDlg,NameModify));
+ aShortNameEdit.SetModifyHdl(LINK(this,SwGlossaryDlg,NameModify));
+
+ aCategoryBox.SetDoubleClickHdl(LINK(this,SwGlossaryDlg, NameDoubleClick));
+ aCategoryBox.SetSelectHdl(LINK(this,SwGlossaryDlg,GrpSelect));
+ aBibBtn.SetClickHdl(LINK(this,SwGlossaryDlg,BibHdl));
+ aShowExampleCB.SetClickHdl(LINK(this, SwGlossaryDlg, ShowPreviewHdl));
+
+ aShortNameEdit.SetMaxTextLen(SHORT_LENGTH);
+ aNameED.SetMaxTextLen(LONG_LENGTH);
+ FreeResource();
+
+ const SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
+
+ aShowExampleCB.Check( pCfg->IsAutoTextPreview());
+ ShowPreviewHdl(&aShowExampleCB);
+
+ bIsDocReadOnly = pSh->GetView().GetDocShell()->IsReadOnly() ||
+ pSh->HasReadonlySel();
+ if( bIsDocReadOnly )
+ aInsertBtn.Enable(sal_False);
+ aNameED.GrabFocus();
+ aCategoryBox.SetHelpId(HID_MD_GLOS_CATEGORY);
+ aCategoryBox.SetStyle(aCategoryBox.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL|WB_VSCROLL|WB_CLIPCHILDREN|WB_SORT);
+ aCategoryBox.GetModel()->SetSortMode(SortAscending);
+ aCategoryBox.SetHighlightRange(); // ueber volle Breite selektieren
+ aCategoryBox.SetNodeDefaultImages( );
+
+ Init();
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwGlossaryDlg::~SwGlossaryDlg()
+{
+ SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
+ pCfg->SetAutoTextPreview(aShowExampleCB.IsChecked()) ;
+
+ aCategoryBox.Clear();
+ aEditBtn.SetPopupMenu(0);
+ delete pMenu;
+ delete pExampleFrame;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Auswahl neue Gruppe
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwGlossaryDlg, GrpSelect, SvTreeListBox *, pBox )
+{
+ SvLBoxEntry* pEntry = pBox->FirstSelected();
+ if(!pEntry)
+ return 0;
+ SvLBoxEntry* pParent = pBox->GetParent(pEntry) ? pBox->GetParent(pEntry) : pEntry;
+ GroupUserData* pGroupData = (GroupUserData*)pParent->GetUserData();
+ String *pGlosGroup = ::GetCurrGlosGroup();
+ (*pGlosGroup) = pGroupData->sGroupName;
+ (*pGlosGroup) += GLOS_DELIM;
+ (*pGlosGroup) += String::CreateFromInt32(pGroupData->nPathIdx);
+ pGlossaryHdl->SetCurGroup(*pGlosGroup);
+ // Aktuellen Textbaustein setzen
+ bReadOnly = pGlossaryHdl->IsReadOnly();
+ EnableShortName( !bReadOnly );
+ aEditBtn.Enable(!bReadOnly);
+ bIsOld = pGlossaryHdl->IsOld();
+ if( pParent != pEntry)
+ {
+ String aName(pBox->GetEntryText(pEntry));
+ aNameED.SetText(aName);
+ aShortNameEdit.SetText(*(String*)pEntry->GetUserData());
+ pEntry = pBox->GetParent(pEntry);
+ aInsertBtn.Enable( !bIsDocReadOnly);
+ ShowAutoText(*::GetCurrGlosGroup(), aShortNameEdit.GetText());
+ }
+ else
+ ShowAutoText(aEmptyStr, aEmptyStr);
+ //Controls aktualisieren
+ NameModify(&aShortNameEdit);
+ if( SfxRequest::HasMacroRecorder( pSh->GetView().GetViewFrame() ) )
+ {
+ SfxRequest aReq( pSh->GetView().GetViewFrame(), FN_SET_ACT_GLOSSARY );
+ String sTemp(*::GetCurrGlosGroup());
+ // der nullte Pfad wird nicht aufgezeichnet!
+ if('0' == sTemp.GetToken(1, GLOS_DELIM).GetChar(0))
+ sTemp = sTemp.GetToken(0, GLOS_DELIM);
+ aReq.AppendItem(SfxStringItem(FN_SET_ACT_GLOSSARY, sTemp));
+ aReq.Done();
+ }
+ return 0;
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwGlossaryDlg::Apply()
+{
+ const String aGlosName(aShortNameEdit.GetText());
+ if(aGlosName.Len()) pGlossaryHdl->InsertGlossary(aGlosName);
+ if( SfxRequest::HasMacroRecorder( pSh->GetView().GetViewFrame() ) )
+ {
+ SfxRequest aReq( pSh->GetView().GetViewFrame(), FN_INSERT_GLOSSARY );
+ String sTemp(*::GetCurrGlosGroup());
+ // der nullte Pfad wird nicht aufgezeichnet!
+ if('0' == sTemp.GetToken(1, GLOS_DELIM).GetChar(0))
+ sTemp = sTemp.GetToken(0, GLOS_DELIM);
+ aReq.AppendItem(SfxStringItem(FN_INSERT_GLOSSARY, sTemp));
+ aReq.AppendItem(SfxStringItem(FN_PARAM_1, aGlosName));
+ aReq.Done();
+ }
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+/* inline */ void SwGlossaryDlg::EnableShortName(sal_Bool bOn)
+{
+ aShortNameLbl.Enable(bOn);
+ aShortNameEdit.Enable(bOn);
+}
+
+/* -----------------26.11.98 16:15-------------------
+ * existiert der Titel in der ausgewaehlten Gruppe?
+ * --------------------------------------------------*/
+SvLBoxEntry* SwGlossaryDlg::DoesBlockExist(const String& rBlock,
+ const String& rShort)
+{
+ //evtl. vorhandenen Eintrag in der TreeListBox suchen
+ SvLBoxEntry* pEntry = aCategoryBox.FirstSelected();
+ if(pEntry)
+ {
+ if(aCategoryBox.GetParent(pEntry))
+ pEntry = aCategoryBox.GetParent(pEntry);
+ sal_uInt32 nChildCount = aCategoryBox.GetChildCount( pEntry );
+ for(sal_uInt32 i = 0; i < nChildCount; i++)
+ {
+ SvLBoxEntry* pChild = aCategoryBox.GetEntry( pEntry, i );
+ if(rBlock == aCategoryBox.GetEntryText(pChild) &&
+ (!rShort.Len() || rShort == *(String*)pChild->GetUserData()))
+ {
+ return pChild;
+ }
+ }
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwGlossaryDlg, NameModify, Edit *, pEdit )
+{
+ String aName(aNameED.GetText());
+ sal_Bool bNameED = pEdit == &aNameED;
+ if( !aName.Len() )
+ {
+ if(bNameED)
+ aShortNameEdit.SetText(aName);
+ aInsertBtn.Enable(sal_False);
+ return 0;
+ }
+ String sShortSearch;
+ if(!bNameED)
+ sShortSearch = pEdit->GetText();
+ sal_Bool bNotFound = !DoesBlockExist(aName, sShortSearch);
+ if(bNameED)
+ {
+ // ist der Text durch einen Klick in die Listbox in das
+ // Edit gekommem?
+ if(bNotFound)
+ {
+ aShortNameEdit.SetText( lcl_GetValidShortCut( aName ) );
+ EnableShortName();
+ }
+ else
+ {
+ aShortNameEdit.SetText(pGlossaryHdl->GetGlossaryShortName(aName));
+ EnableShortName(!bReadOnly);
+ }
+ aInsertBtn.Enable(!bNotFound && !bIsDocReadOnly);
+ }
+ else
+ {
+ //ShortNameEdit
+ if(!bNotFound)
+ {
+ sal_Bool bEnable = !bNotFound;
+ bEnable &= !bIsDocReadOnly;
+ aInsertBtn.Enable(bEnable);
+ }
+ }
+ return 0;
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+IMPL_LINK_INLINE_START( SwGlossaryDlg, NameDoubleClick, SvTreeListBox*, pBox )
+{
+ SvLBoxEntry* pEntry = pBox->FirstSelected();
+ if(pBox->GetParent(pEntry) && !bIsDocReadOnly)
+ EndDialog( RET_OK );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwGlossaryDlg, NameDoubleClick, SvTreeListBox*, EMPTYARG )
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwGlossaryDlg, EnableHdl, Menu *, pMn )
+{
+ const String aEditText(aNameED.GetText());
+ const sal_Bool bHasEntry = aEditText.Len() && aShortNameEdit.GetText().Len();
+ const sal_Bool bExists = 0 != DoesBlockExist(aEditText, aShortNameEdit.GetText());
+ pMn->EnableItem(FN_GL_DEFINE, bSelection && bHasEntry && !bExists);
+ pMn->EnableItem(FN_GL_DEFINE_TEXT, bSelection && bHasEntry && !bExists);
+ pMn->EnableItem(FN_GL_COPY_TO_CLIPBOARD, bExists);
+ pMn->EnableItem(FN_GL_REPLACE, bSelection && bExists && !bIsOld );
+ pMn->EnableItem(FN_GL_REPLACE_TEXT, bSelection && bExists && !bIsOld );
+ pMn->EnableItem(FN_GL_EDIT, bExists );
+ pMn->EnableItem(FN_GL_RENAME, bExists );
+ pMn->EnableItem(FN_GL_DELETE, bExists );
+ pMn->EnableItem(FN_GL_MACRO, bExists && !bIsOld &&
+ !pGlossaryHdl->IsReadOnly() );
+
+ SvLBoxEntry* pEntry = aCategoryBox.FirstSelected();
+ sal_Bool bEnable = sal_False;
+ if ( pEntry )
+ bEnable = !aCategoryBox.GetParent( pEntry ) && !bIsOld && !pGlossaryHdl->IsReadOnly();
+ pMn->EnableItem( FN_GL_IMPORT, bEnable );
+ return 1;
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn )
+{
+ sal_Bool bNoAttr = sal_False;
+
+ switch(pMn->GetCurItemId())
+ {
+ case FN_GL_REPLACE:
+ case FN_GL_REPLACE_TEXT:
+ pGlossaryHdl->NewGlossary( aNameED.GetText(),
+ aShortNameEdit.GetText(),
+ sal_False,
+ pMn->GetCurItemId() == FN_GL_REPLACE_TEXT);
+ break;
+ case FN_GL_DEFINE_TEXT:
+ bNoAttr = sal_True;
+ // Kein break!!!
+ case FN_GL_DEFINE:
+ {
+ const String aStr(aNameED.GetText());
+ const String aShortName(aShortNameEdit.GetText());
+ if(pGlossaryHdl->HasShortName(aShortName))
+ {
+ InfoBox(this, SW_RES(MSG_DOUBLE_SHORTNAME)).Execute();
+ aShortNameEdit.SetSelection(Selection(0, SELECTION_MAX));
+ aShortNameEdit.GrabFocus();
+ break;
+ }
+ if(pGlossaryHdl->NewGlossary(aStr, aShortName, sal_False, bNoAttr ))
+ {
+ SvLBoxEntry* pEntry = aCategoryBox.FirstSelected();
+ if(aCategoryBox.GetParent(pEntry))
+ pEntry = aCategoryBox.GetParent(pEntry);
+
+ SvLBoxEntry* pChild = aCategoryBox.InsertEntry(aStr, pEntry);
+ pChild->SetUserData(new String(aShortName));
+ aNameED.SetText(aStr);
+ aShortNameEdit.SetText(aShortName);
+ NameModify(&aNameED); // fuer Schalten der Buttons
+
+ if( SfxRequest::HasMacroRecorder( pSh->GetView().GetViewFrame() ) )
+ {
+ SfxRequest aReq(pSh->GetView().GetViewFrame(), FN_NEW_GLOSSARY);
+ String sTemp(*::GetCurrGlosGroup());
+ // der nullte Pfad wird nicht aufgezeichnet!
+ if('0' == sTemp.GetToken(1, GLOS_DELIM).GetChar(0))
+ sTemp = sTemp.GetToken(0, GLOS_DELIM);
+ aReq.AppendItem(SfxStringItem(FN_NEW_GLOSSARY, sTemp));
+ aReq.AppendItem(SfxStringItem(FN_PARAM_1, aShortName));
+ aReq.AppendItem(SfxStringItem(FN_PARAM_2, aStr));
+ aReq.Done();
+ }
+ }
+ }
+ break;
+ case FN_GL_COPY_TO_CLIPBOARD :
+ {
+ pGlossaryHdl->CopyToClipboard(*pSh, aShortNameEdit.GetText());
+ }
+ break;
+ case FN_GL_EDIT:
+ break;
+ case FN_GL_RENAME:
+ {
+ aShortNameEdit.SetText(pGlossaryHdl->GetGlossaryShortName(aNameED.GetText()));
+ SwNewGlosNameDlg* pNewNameDlg = new SwNewGlosNameDlg(this, aNameED.GetText(),
+ aShortNameEdit.GetText() );
+ if( RET_OK == pNewNameDlg->Execute() &&
+ pGlossaryHdl->Rename( aShortNameEdit.GetText(),
+ pNewNameDlg->GetNewShort(),
+ pNewNameDlg->GetNewName()))
+ {
+ SvLBoxEntry* pEntry = aCategoryBox.FirstSelected();
+ SvLBoxEntry* pNewEntry = aCategoryBox.InsertEntry(
+ pNewNameDlg->GetNewName(), aCategoryBox.GetParent(pEntry));
+ pNewEntry->SetUserData(new String(pNewNameDlg->GetNewShort()));
+ delete (String*)pEntry->GetUserData();
+ aCategoryBox.GetModel()->Remove(pEntry);
+ aCategoryBox.Select(pNewEntry);
+ aCategoryBox.MakeVisible(pNewEntry);
+ }
+ GrpSelect( &aCategoryBox );
+ delete pNewNameDlg;
+ }
+ break;
+ case FN_GL_DELETE:
+ {
+ QueryBox aQuery(this, SW_RES(MSG_QUERY_DELETE));
+ if(RET_YES == aQuery.Execute())
+ {
+ const String aShortName(aShortNameEdit.GetText());
+ const String aTitle(aNameED.GetText());
+ if(aTitle.Len() && pGlossaryHdl->DelGlossary(aShortName))
+ {
+ SvLBoxEntry* pChild = DoesBlockExist(aTitle, aShortName);
+ DBG_ASSERT(pChild, "Eintrag nicht gefunden!");
+ SvLBoxEntry* pParent = aCategoryBox.GetParent(pChild);
+ aCategoryBox.Select(pParent);
+
+ aCategoryBox.GetModel()->Remove(pChild);
+ aNameED.SetText( aEmptyStr );
+ NameModify(&aNameED);
+ }
+ }
+ }
+ break;
+ case FN_GL_MACRO:
+ {
+ SfxItemSet aSet( pSh->GetAttrPool(), RES_FRMMACRO, RES_FRMMACRO, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 );
+
+ SvxMacro aStart(aEmptyStr, aEmptyStr, STARBASIC);
+ SvxMacro aEnd(aEmptyStr, aEmptyStr, STARBASIC);
+ pGlossaryHdl->GetMacros(aShortNameEdit.GetText(), aStart, aEnd );
+
+ SvxMacroItem aItem(RES_FRMMACRO);
+ if( aStart.GetMacName().Len() )
+ aItem.SetMacro( SW_EVENT_START_INS_GLOSSARY, aStart );
+ if( aEnd.GetMacName().Len() )
+ aItem.SetMacro( SW_EVENT_END_INS_GLOSSARY, aEnd );
+
+ aSet.Put( aItem );
+ aSet.Put( SwMacroAssignDlg::AddEvents( MACASSGN_TEXTBAUST ) );
+
+ const SfxPoolItem* pItem;
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( this, aSet,
+ pSh->GetView().GetViewFrame()->GetFrame().GetFrameInterface(), SID_EVENTCONFIG );
+ if ( pMacroDlg && pMacroDlg->Execute() == RET_OK &&
+ SFX_ITEM_SET == pMacroDlg->GetOutputItemSet()->GetItemState( RES_FRMMACRO, sal_False, &pItem ) )
+ {
+ const SvxMacroTableDtor& rTbl = ((SvxMacroItem*)pItem)->GetMacroTable();
+ pGlossaryHdl->SetMacros( aShortNameEdit.GetText(),
+ rTbl.Get( SW_EVENT_START_INS_GLOSSARY ),
+ rTbl.Get( SW_EVENT_END_INS_GLOSSARY ) );
+ }
+
+ delete pMacroDlg;
+ }
+ break;
+
+ case FN_GL_IMPORT:
+ {
+ // call the FileOpenDialog do find WinWord - Files with templates
+ FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 );
+ uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+
+ SvtPathOptions aPathOpt;
+ xFP->setDisplayDirectory(aPathOpt.GetWorkPath() );
+ String sWW8( C2S( FILTER_WW8 ) );
+
+ uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
+ SfxFilterMatcher aMatcher( String::CreateFromAscii(SwDocShell::Factory().GetShortName()) );
+ SfxFilterMatcherIter aIter( &aMatcher );
+ const SfxFilter* pFilter = aIter.First();
+ while ( pFilter )
+ {
+ if( pFilter->GetUserData() == sWW8 )
+ {
+ xFltMgr->appendFilter( pFilter->GetUIName(),
+ ((WildCard&)pFilter->GetWildcard()).GetWildCard() );
+ xFltMgr->setCurrentFilter( pFilter->GetUIName() ) ;
+ }
+
+ pFilter = aIter.Next();
+ }
+
+ if( aDlgHelper.Execute() == ERRCODE_NONE )
+ {
+ if( pGlossaryHdl->ImportGlossaries( xFP->getFiles().getConstArray()[0] ))
+ Init();
+ else
+ {
+ InfoBox(this, SW_RES( MSG_NO_GLOSSARIES )).Execute();
+ }
+ }
+ }
+ break;
+
+ default:
+ return 0;
+ }
+ return 1;
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Dialog Verwaltung Bereiche
+ --------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwGlossaryDlg, BibHdl, Button *, EMPTYARG )
+{
+ SwGlossaries* pGloss = ::GetGlossaries();
+ if( pGloss->IsGlosPathErr() )
+ pGloss->ShowError();
+ else
+ {
+ //check if at least one glossary path is write enabled
+ SvtPathOptions aPathOpt;
+ String sGlosPath( aPathOpt.GetAutoTextPath() );
+ USHORT nPaths = sGlosPath.GetTokenCount(';');
+ BOOL bIsWritable = FALSE;
+ for(USHORT nPath = 0; nPath < nPaths; nPath++)
+ {
+ String sPath = URIHelper::SmartRel2Abs(
+ INetURLObject(), sGlosPath.GetToken(nPath, ';'),
+ URIHelper::GetMaybeFileHdl());
+ try
+ {
+ Content aTestContent( sPath,
+ uno::Reference< XCommandEnvironment >());
+ Any aAny = aTestContent.getPropertyValue( C2U("IsReadOnly") );
+ if(aAny.hasValue())
+ {
+ bIsWritable = !*(sal_Bool*)aAny.getValue();
+ }
+ }
+ catch(Exception&)
+ {}
+ if(bIsWritable)
+ break;
+ }
+ if(bIsWritable)
+ {
+
+ SwGlossaryGroupDlg *pDlg = new SwGlossaryGroupDlg( this, pGloss->GetPathArray(), pGlossaryHdl );
+ if ( RET_OK == pDlg->Execute() )
+ {
+ Init();
+ //if new groups were created - select one of them
+ String sNewGroup = pDlg->GetCreatedGroupName();
+ SvLBoxEntry* pEntry = aCategoryBox.First();
+ while(sNewGroup.Len() && pEntry)
+ {
+ if(!aCategoryBox.GetParent(pEntry))
+ {
+ GroupUserData* pGroupData = (GroupUserData*)pEntry->GetUserData();
+ String sGroup = pGroupData->sGroupName;
+ sGroup += GLOS_DELIM;
+ sGroup += String::CreateFromInt32(pGroupData->nPathIdx);
+ if(sGroup == sNewGroup)
+ {
+ aCategoryBox.Select(pEntry);
+ aCategoryBox.MakeVisible(pEntry);
+ GrpSelect(&aCategoryBox);
+ break;
+ }
+ }
+ pEntry = aCategoryBox.Next(pEntry);
+ }
+
+ }
+ delete pDlg;
+ }
+ else
+ {
+ QueryBox aBox(this, WB_YES_NO, sReadonlyPath);
+ if(RET_YES == aBox.Execute())
+ PathHdl(&aPathBtn);
+ }
+ }
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Initialisierung; aus Ctor und nach Bearbeiten Bereiche
+------------------------------------------------------------------------*/
+
+
+void SwGlossaryDlg::Init()
+{
+ aCategoryBox.SetUpdateMode( sal_False );
+ aCategoryBox.Clear();
+ // Textbausteinbereiche anzeigen
+ const sal_uInt16 nCnt = pGlossaryHdl->GetGroupCnt();
+ SvLBoxEntry* pSelEntry = 0;
+ const String sSelStr(::GetCurrGlosGroup()->GetToken(0, GLOS_DELIM));
+ const sal_uInt16 nSelPath = static_cast< sal_uInt16 >(::GetCurrGlosGroup()->GetToken(1, GLOS_DELIM).ToInt32());
+ for(sal_uInt16 nId = 0; nId < nCnt; ++nId )
+ {
+ String sTitle;
+ String sGroupName(pGlossaryHdl->GetGroupName(nId, &sTitle));
+ if(!sGroupName.Len())
+ continue;
+ if(!sTitle.Len())
+ sTitle = sGroupName.GetToken( 0, GLOS_DELIM );
+ SvLBoxEntry* pEntry = aCategoryBox.InsertEntry( sTitle );
+ sal_uInt16 nPath = static_cast< sal_uInt16 >(sGroupName.GetToken( 1, GLOS_DELIM ).ToInt32());
+
+ GroupUserData* pData = new GroupUserData;
+ pData->sGroupName = sGroupName.GetToken(0, GLOS_DELIM);
+ pData->nPathIdx = nPath;
+ pData->bReadonly = pGlossaryHdl->IsReadOnly(&sGroupName);
+
+ pEntry->SetUserData(pData);
+ if(sSelStr == pData->sGroupName && nSelPath == nPath)
+ pSelEntry = pEntry;
+
+ //Eintraege fuer die Gruppen auffuellen
+ {
+ pGlossaryHdl->SetCurGroup(sGroupName, sal_False, sal_True);
+ const sal_uInt16 nCount = pGlossaryHdl->GetGlossaryCnt();
+ for(sal_uInt16 i = 0; i < nCount; ++i)
+ {
+ String sGroupTitle(pGlossaryHdl->GetGlossaryName(i));
+ SvLBoxEntry* pChild = aCategoryBox.InsertEntry(
+ sGroupTitle, pEntry);
+ pChild->SetUserData(new String(pGlossaryHdl->GetGlossaryShortName(i)));
+ }
+ }
+ }
+ // Aktuelle Gruppe setzen und Textbausteine anzeigen
+ if(!pSelEntry)
+ {
+ //find a non-readonly group
+ SvLBoxEntry* pSearch = aCategoryBox.First();
+ while(pSearch)
+ {
+ if(!aCategoryBox.GetParent(pSearch))
+ {
+ GroupUserData* pData = (GroupUserData*)pSearch->GetUserData();
+ if(!pData->bReadonly)
+ {
+ pSelEntry = pSearch;
+ break;
+ }
+ }
+ pSearch = aCategoryBox.Next(pSearch);
+ }
+ if(!pSelEntry)
+ pSelEntry = aCategoryBox.GetEntry(0);
+ }
+ if(pSelEntry)
+ {
+ aCategoryBox.Expand(pSelEntry);
+ aCategoryBox.Select(pSelEntry);
+ aCategoryBox.MakeVisible(pSelEntry);
+ GrpSelect(&aCategoryBox);
+ }
+ //JP 16.11.99: the SvxTreeListBox has a Bug. The Box dont recalc the
+ // outputsize, when all entries are insertet. The result is, that
+ // the Focus/Highlight rectangle is to large and paintet over the
+ // HScrollbar. -> Fix: call the resize
+ aCategoryBox.Resize();
+
+ aCategoryBox.GetModel()->Resort();
+ aCategoryBox.SetUpdateMode( sal_True );
+ aCategoryBox.Update();
+
+ const SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
+ aFileRelCB.Check( pCfg->IsSaveRelFile() );
+ aFileRelCB.SetClickHdl(LINK(this, SwGlossaryDlg, CheckBoxHdl));
+ aNetRelCB.Check( pCfg->IsSaveRelNet() );
+ aNetRelCB.SetClickHdl(LINK(this, SwGlossaryDlg, CheckBoxHdl));
+ aInsertTipCB.Check( pCfg->IsAutoTextTip() );
+ aInsertTipCB.SetClickHdl(LINK(this, SwGlossaryDlg, CheckBoxHdl));
+}
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK_INLINE_START( SwGlossaryDlg, EditHdl, Button *, EMPTYARG )
+{
+//EndDialog darf nicht im MenuHdl aufgerufen werden
+ if(aEditBtn.GetCurItemId() == FN_GL_EDIT )
+ {
+ SwTextBlocks *pGroup = ::GetGlossaries()->GetGroupDoc ( GetCurrGrpName () );
+ BOOL bRet = pGlossaryHdl->ConvertToNew ( *pGroup );
+ delete pGroup;
+ if ( bRet )
+ EndDialog(RET_EDIT);
+ }
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwGlossaryDlg, EditHdl, Button *, EMPTYARG )
+
+/*------------------------------------------------------------------------
+ Beschreibung: KeyInput fuer ShortName - Edits ohne Spaces
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwNewGlosNameDlg, Modify, Edit *, pBox )
+{
+ String aName(aNewName.GetText());
+ SwGlossaryDlg* pDlg = (SwGlossaryDlg*)GetParent();
+
+ if( pBox == &aNewName )
+ aNewShort.SetText( lcl_GetValidShortCut( aName ) );
+
+ sal_Bool bEnable = aName.Len() && aNewShort.GetText().Len() &&
+ (!pDlg->DoesBlockExist(aName, aNewShort.GetText())
+ || aName == aOldName.GetText());
+ aOk.Enable(bEnable);
+ return 0;
+}
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwNewGlosNameDlg, Rename, Button *, EMPTYARG )
+{
+ SwGlossaryDlg* pDlg = (SwGlossaryDlg*)GetParent();
+ String sNew = aNewShort.GetText();
+ GetAppCharClass().toUpper(sNew);
+ if( pDlg->pGlossaryHdl->HasShortName(aNewShort.GetText())
+ && sNew != aOldShort.GetText() )
+ {
+ InfoBox(this, SW_RES(MSG_DOUBLE_SHORTNAME)).Execute();
+ aNewShort.GrabFocus();
+ }
+ else
+ EndDialog(sal_True);
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwGlossaryDlg, CheckBoxHdl, CheckBox *, pBox )
+{
+ SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
+ sal_Bool bCheck = pBox->IsChecked();
+ if( pBox == &aInsertTipCB )
+ pCfg->SetAutoTextTip(bCheck);
+ else if(pBox == &aFileRelCB)
+ pCfg->SetSaveRelFile(bCheck);
+ else
+ pCfg->SetSaveRelNet(bCheck);
+ return 0;
+}
+
+/* -----------------26.11.98 15:18-------------------
+ * TreeListBox fuer Gruppen und Bausteine
+ * --------------------------------------------------*/
+SwGlTreeListBox::SwGlTreeListBox(Window* pParent, const ResId& rResId) :
+ SvTreeListBox(pParent, rResId),
+ sReadonly (SW_RES(ST_READONLY)),
+ pDragEntry(0)
+{
+ FreeResource();
+ SetDragDropMode( SV_DRAGDROP_CTRL_MOVE|SV_DRAGDROP_CTRL_COPY );
+}
+/* -----------------30.11.98 10:49-------------------
+ *
+ * --------------------------------------------------*/
+void SwGlTreeListBox::Clear()
+{
+ SvLBoxEntry* pEntry = First();
+ while(pEntry)
+ {
+ if(GetParent(pEntry))
+ delete (String*)pEntry->GetUserData();
+ else
+ delete (GroupUserData*)pEntry->GetUserData();
+ pEntry = Next(pEntry);
+ }
+ SvTreeListBox::Clear();
+}
+
+/*-----------------10.06.97 14.52-------------------
+
+--------------------------------------------------*/
+void SwGlTreeListBox::RequestHelp( const HelpEvent& rHEvt )
+{
+ Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
+ SvLBoxEntry* pEntry = GetEntry( aPos );
+ // Hilfe gibt es nur fuer die Gruppennamen
+ if(pEntry)
+ {
+ SvLBoxTab* pTab;
+ SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab );
+ if(pItem)
+ {
+ aPos = GetEntryPosition( pEntry );
+ Size aSize(pItem->GetSize( this, pEntry ));
+ aPos.X() = GetTabPos( pEntry, pTab );
+
+ if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
+ aSize.Width() = GetSizePixel().Width() - aPos.X();
+ aPos = OutputToScreenPixel(aPos);
+ Rectangle aItemRect( aPos, aSize );
+ String sMsg;
+ if(!GetParent(pEntry))
+ {
+ GroupUserData* pData = (GroupUserData*)pEntry->GetUserData();
+ const SvStrings* pPathArr = ::GetGlossaries()->GetPathArray();
+ if(pPathArr->Count())
+ {
+ sMsg = (*(*pPathArr)[pData->nPathIdx]);
+ sMsg += INET_PATH_TOKEN;
+ sMsg += pData->sGroupName;
+ sMsg += SwGlossaries::GetExtension();
+ INetURLObject aTmp(sMsg);
+ sMsg = aTmp.GetPath();
+
+ if(pData->bReadonly)
+ {
+ sMsg += ' ';
+ sMsg += '(';
+ sMsg += sReadonly;
+ sMsg += ')';
+ }
+
+
+ }
+ }
+ else
+ sMsg = *(String*)pEntry->GetUserData();
+ Help::ShowQuickHelp( this, aItemRect, sMsg,
+ QUICKHELP_LEFT|QUICKHELP_VCENTER );
+ }
+ }
+}
+/* -----------------26.11.98 14:42-------------------
+ *
+ * --------------------------------------------------*/
+DragDropMode SwGlTreeListBox::NotifyStartDrag(
+ TransferDataContainer& /*rContainer*/,
+ SvLBoxEntry* pEntry )
+{
+ DragDropMode eRet;
+ pDragEntry = pEntry;
+ if(!GetParent(pEntry))
+ eRet = SV_DRAGDROP_NONE;
+ else
+ {
+ SwGlossaryDlg* pDlg = (SwGlossaryDlg*)Window::GetParent();
+ SvLBoxEntry* pParent = GetParent(pEntry);
+
+ GroupUserData* pGroupData = (GroupUserData*)pParent->GetUserData();
+ String sEntry(pGroupData->sGroupName);
+ sEntry += GLOS_DELIM;
+ sEntry += String::CreateFromInt32(pGroupData->nPathIdx);
+ sal_Int8 nDragOption = DND_ACTION_COPY;
+ eRet = SV_DRAGDROP_CTRL_COPY;
+ if(!pDlg->pGlossaryHdl->IsReadOnly(&sEntry))
+ {
+ eRet |= SV_DRAGDROP_CTRL_MOVE;
+ nDragOption |= DND_ACTION_MOVE;
+ }
+ SetDragOptions( nDragOption );
+ }
+ return eRet;
+}
+/* -----------------27.11.98 09:35-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwGlTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry)
+{
+ // TODO: Readonly - Ueberpruefung fehlt noch!
+ SvLBoxEntry* pSrcParent = GetParent(pEntry) ? GetParent(pEntry) : pEntry;
+ SvLBoxEntry* pDestParent =
+ GetParent(pDragEntry ) ? GetParent(pDragEntry ) : pDragEntry ;
+ return pDestParent != pSrcParent;
+
+}
+/* -----------------26.11.98 14:42-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwGlTreeListBox::NotifyMoving( SvLBoxEntry* pTarget,
+ SvLBoxEntry* pEntry,
+ SvLBoxEntry*& /*rpNewParent*/,
+ ULONG& /*rNewChildPos*/
+ )
+{
+ pDragEntry = 0;
+ if(!pTarget) //An den Anfang verschieben
+ {
+ pTarget = GetEntry(0);
+ }
+ // 1. wird in verschiedene Gruppen verschoben?
+ // 2. darf in beiden Gruppen geschrieben werden?
+ SvLBoxEntry* pSrcParent = GetParent(pEntry);
+ SvLBoxEntry* pDestParent =
+ GetParent(pTarget) ? GetParent(pTarget) : pTarget;
+ sal_Bool bRet = sal_False;
+ if(pDestParent != pSrcParent)
+ {
+ SwGlossaryDlg* pDlg = (SwGlossaryDlg*)Window::GetParent();
+ SwWait aWait( *pDlg->pSh->GetView().GetDocShell(), sal_True );
+
+ GroupUserData* pGroupData = (GroupUserData*)pSrcParent->GetUserData();
+ String sSourceGroup(pGroupData->sGroupName);
+ sSourceGroup += GLOS_DELIM;
+ sSourceGroup += String::CreateFromInt32(pGroupData->nPathIdx);
+ pDlg->pGlossaryHdl->SetCurGroup(sSourceGroup);
+ String sTitle(GetEntryText(pEntry));
+ String sShortName(*(String*)pEntry->GetUserData());
+
+ GroupUserData* pDestData = (GroupUserData*)pDestParent->GetUserData();
+ String sDestName = pDestData->sGroupName;
+ sDestName += GLOS_DELIM;
+ sDestName += String::CreateFromInt32(pDestData->nPathIdx);
+ bRet = pDlg->pGlossaryHdl->CopyOrMove( sSourceGroup, sShortName,
+ sDestName, sTitle, sal_True );
+ if(bRet)
+ {
+ SvLBoxEntry* pChild = InsertEntry(sTitle, pDestParent);
+ pChild->SetUserData(new String(sShortName));
+ GetModel()->Remove(pEntry);
+ }
+ }
+ return sal_False; //sonst wird der Eintrag automatisch vorgenommen
+}
+/* -----------------26.11.98 14:42-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwGlTreeListBox::NotifyCopying( SvLBoxEntry* pTarget,
+ SvLBoxEntry* pEntry,
+ SvLBoxEntry*& /*rpNewParent*/,
+ ULONG& /*rNewChildPos*/
+ )
+{
+ pDragEntry = 0;
+ // 1. wird in verschiedene Gruppen verschoben?
+ // 2. darf in beiden Gruppen geschrieben werden?
+ if(!pTarget) //An den Anfang verschieben
+ {
+ pTarget = GetEntry(0);
+ }
+ SvLBoxEntry* pSrcParent = GetParent(pEntry);
+ SvLBoxEntry* pDestParent =
+ GetParent(pTarget) ? GetParent(pTarget) : pTarget;
+ sal_Bool bRet = sal_False;
+ if(pDestParent != pSrcParent)
+ {
+ SwGlossaryDlg* pDlg = (SwGlossaryDlg*)Window::GetParent();
+ SwWait aWait( *pDlg->pSh->GetView().GetDocShell(), sal_True );
+
+ GroupUserData* pGroupData = (GroupUserData*)pSrcParent->GetUserData();
+ String sSourceGroup(pGroupData->sGroupName);
+ sSourceGroup += GLOS_DELIM;
+ sSourceGroup += String::CreateFromInt32(pGroupData->nPathIdx);
+
+ pDlg->pGlossaryHdl->SetCurGroup(sSourceGroup);
+ String sTitle(GetEntryText(pEntry));
+ String sShortName(*(String*)pEntry->GetUserData());
+
+ GroupUserData* pDestData = (GroupUserData*)pDestParent->GetUserData();
+ String sDestName = pDestData->sGroupName;
+ sDestName += GLOS_DELIM;
+ sDestName += String::CreateFromInt32(pDestData->nPathIdx);
+
+ bRet = pDlg->pGlossaryHdl->CopyOrMove( sSourceGroup, sShortName,
+ sDestName, sTitle, sal_False );
+ if(bRet)
+ {
+ SvLBoxEntry* pChild = InsertEntry(sTitle, pDestParent);
+ pChild->SetUserData(new String(sShortName));
+ }
+ }
+ return sal_False; //sonst wird der Eintrag automatisch vorgenommen
+}
+
+
+/*-----------------10.06.97 15.18-------------------
+
+--------------------------------------------------*/
+String SwGlossaryDlg::GetCurrGrpName() const
+{
+ SvLBoxEntry* pEntry = aCategoryBox.FirstSelected();
+ String sRet;
+ if(pEntry)
+ {
+ pEntry =
+ aCategoryBox.GetParent(pEntry) ? aCategoryBox.GetParent(pEntry) : pEntry;
+ GroupUserData* pGroupData = (GroupUserData*)pEntry->GetUserData();
+ sRet = pGroupData->sGroupName;
+ sRet += GLOS_DELIM;
+ sRet += String::CreateFromInt32(pGroupData->nPathIdx);
+ }
+ return sRet;
+}
+
+/*-----------------11.06.97 08.17-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwGlossaryDlg, PathHdl, Button *, pBtn )
+{
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ AbstractSvxMultiPathDialog* pDlg = pFact->CreateSvxMultiPathDialog( pBtn );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ SvtPathOptions aPathOpt;
+ String sGlosPath( aPathOpt.GetAutoTextPath() );
+ pDlg->SetPath(sGlosPath);
+ if(RET_OK == pDlg->Execute())
+ {
+ String sTmp(pDlg->GetPath());
+ if(sTmp != sGlosPath)
+ {
+ aPathOpt.SetAutoTextPath( sTmp );
+ ::GetGlossaries()->UpdateGlosPath( sal_True );
+ Init();
+ }
+ }
+ delete pDlg;
+ }
+ return 0;
+}
+/* -----------------28.07.99 13:48-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK( SwGlossaryDlg, ShowPreviewHdl, CheckBox *, pBox )
+{
+ sal_Bool bCreated = sal_False;
+ if(pBox->IsChecked())
+ {
+ //create example
+ if(!pExampleFrame)
+ {
+ Link aLink(LINK(this, SwGlossaryDlg, PreviewLoadedHdl));
+ pExampleFrame = new SwOneExampleFrame( aExampleWIN,
+ EX_SHOW_ONLINE_LAYOUT, &aLink );
+ bCreated = sal_True;
+ }
+ }
+
+ BOOL bShow = pBox->IsChecked() && !bCreated;
+ aExampleWIN.Show( bShow );
+ aExampleDummyWIN.Show(!bShow);
+ if( ::GetCurrGlosGroup() )
+ ShowAutoText(*::GetCurrGlosGroup(), aShortNameEdit.GetText());
+
+ return 0;
+};
+/* -----------------18.11.99 17:09-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK( SwGlossaryDlg, PreviewLoadedHdl, void *, EMPTYARG )
+{
+ BOOL bShow = aShowExampleCB.IsChecked();
+ aExampleWIN.Show( bShow );
+ aExampleDummyWIN.Show(!bShow);
+ ResumeShowAutoText();
+ return 0;
+}
+
+/* -----------------28.07.99 16:28-------------------
+
+ --------------------------------------------------*/
+void SwGlossaryDlg::ShowAutoText(const String& rGroup, const String& rShortName)
+{
+ if(aExampleWIN.IsVisible())
+ {
+ SetResumeData(rGroup, rShortName);
+ //try to make an Undo()
+ pExampleFrame->ClearDocument( TRUE );
+ }
+}
+/* -----------------------------21.12.00 11:33--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwGlossaryDlg::ResumeShowAutoText()
+{
+ String sGroup, sShortName;
+ if(GetResumeData(sGroup, sShortName) && aExampleWIN.IsVisible())
+ {
+ if(!_xAutoText.is())
+ {
+ uno::Reference< lang::XMultiServiceFactory >
+ xMgr = getProcessServiceFactory();
+ //now the AutoText ListBoxes have to be filled
+
+ uno::Reference< uno::XInterface > xAText = xMgr->createInstance( C2U("com.sun.star.text.AutoTextContainer") );
+ _xAutoText = uno::Reference< container::XNameAccess >(xAText, uno::UNO_QUERY);
+ }
+
+ uno::Reference< XTextCursor > & xCrsr = pExampleFrame->GetTextCursor();
+ if(xCrsr.is())
+ {
+ if(sShortName.Len())
+ {
+ uno::Any aGroup = _xAutoText->getByName(sGroup);
+ uno::Reference< XAutoTextGroup > xGroup;
+ OUString uShortName(sShortName);
+ if((aGroup >>= xGroup) && xGroup->hasByName(uShortName))
+ {
+ uno::Any aEntry(xGroup->getByName(uShortName));
+ uno::Reference< XAutoTextEntry > xEntry;
+ aEntry >>= xEntry;
+ uno::Reference< XTextRange > xRange(xCrsr, uno::UNO_QUERY);
+ xEntry->applyTo(xRange);
+ }
+ }
+ }
+ }
+ ResetResumeData();
+}
+
+
diff --git a/sw/source/ui/misc/glossary.hrc b/sw/source/ui/misc/glossary.hrc
new file mode 100644
index 000000000000..4ee5aaaa7ede
--- /dev/null
+++ b/sw/source/ui/misc/glossary.hrc
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+// Box Textbausteine
+#define FT_SHORTNAME 1
+#define ED_SHORTNAME 2
+#define FT_NAME 3
+//#define DCB_NAME 4
+#define ED_NAME 4
+#define CB_INSERT_TIP 5
+
+//#define FT_BIB 10
+
+#define PB_INSERT 50
+#define PB_EDIT 52
+#define PB_BIB 54
+#define PB_CLOSE 55
+#define PB_PATH 56
+#define PB_HELP 57
+
+#define MNU_EDIT 60
+#define FN_GL_DEFINE 61
+#define FN_GL_DEFINE_TEXT 62
+#define FN_GL_REPLACE 63
+#define FN_GL_EDIT 64
+#define FN_GL_DELETE 65
+#define FN_GL_RENAME 66
+#define FN_GL_MACRO 67
+#define CB_FILE_REL 68
+#define CB_NET_REL 69
+#define FL_RELATIVE 70
+#define WIN_EXAMPLE 72
+#define CB_SHOW_EXAMPLE 73
+#define FN_GL_COPY_TO_CLIPBOARD 74
+#define FN_GL_IMPORT 75
+#define ST_READONLY 76
+#define ST_READONLY_PATH 77
+#define FN_GL_REPLACE_TEXT 78
+#define WIN_EXAMPLE_DUMMY 79
+
+// Box Bibliothek Textbausteine
+#define FL_EDIT 1
+#define FL_BIB 2
+#define ED_BIB 3
+
+#define PB_NEW 10
+#define PB_DELETE 11
+
+#define BT_OK 100
+
+// beide
+#define LB_BIB 80
+
+// Dialog Namensaenderung
+#define FT_ON 1
+#define FT_OS 2
+#define FT_NN 3
+#define FT_NS 4
+#define ED_ON 5
+#define ED_OS 6
+#define ED_NN 7
+#define ED_NS 8
+#define FL_NN 9
+#define BT_CANCEL 10
+#define BT_OKNEW 11
+
diff --git a/sw/source/ui/misc/glossary.src b/sw/source/ui/misc/glossary.src
new file mode 100644
index 000000000000..3dddc5218398
--- /dev/null
+++ b/sw/source/ui/misc/glossary.src
@@ -0,0 +1,476 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "misc.hrc"
+#include "glossary.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ // #define DLG_GLOSSARY 256
+ModalDialog DLG_GLOSSARY
+{
+ HelpID = CMD_FN_GLOSSARY_DLG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 375 , 164 ) ;
+ Text [ en-US ] = "AutoText" ;
+ Moveable = TRUE ;
+ CheckBox CB_INSERT_TIP
+ {
+ HelpID = "sw:CheckBox:DLG_GLOSSARY:CB_INSERT_TIP";
+ Pos = MAP_APPFONT ( 12 , 12 ) ;
+ Size = MAP_APPFONT ( 200 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Display remainder of name as suggestion while typing" ;
+ };
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 31 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "~Name" ;
+ Left = TRUE ;
+ };
+ Edit ED_NAME
+ {
+ HelpID = "sw:Edit:DLG_GLOSSARY:ED_NAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 55 , 29 ) ;
+ Size = MAP_APPFONT ( 85 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_SHORTNAME
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 143 , 31 ) ;
+ Size = MAP_APPFONT ( 57 , 8 ) ;
+ Text [ en-US ] = "~Shortcut" ;
+ Right = TRUE ;
+ };
+ Edit ED_SHORTNAME
+ {
+ HelpID = "sw:Edit:DLG_GLOSSARY:ED_SHORTNAME";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 203 , 29 ) ;
+ Size = MAP_APPFONT ( 21 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ Control LB_BIB
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 44 ) ;
+ Size = MAP_APPFONT ( 212 , 84 ) ;
+ TabStop = TRUE ;
+ // Sort = TRUE ;
+ // CurPos = 0 ;
+ String ST_READONLY
+ {
+ Text [ en-US ] = "read-only";
+ };
+ };
+ FixedLine FL_RELATIVE
+ {
+ Pos = MAP_APPFONT ( 6 , 134 ) ;
+ Size = MAP_APPFONT ( 221 , 8 ) ;
+ Text [ en-US ] = "Save links relative to";
+ };
+ CheckBox CB_FILE_REL
+ {
+ HelpID = "sw:CheckBox:DLG_GLOSSARY:CB_FILE_REL";
+ Pos = MAP_APPFONT ( 14 , 145 ) ;
+ Size = MAP_APPFONT ( 90 , 12 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~File system" ;
+ };
+ CheckBox CB_NET_REL
+ {
+ HelpID = "sw:CheckBox:DLG_GLOSSARY:CB_NET_REL";
+ Pos = MAP_APPFONT ( 109 , 145 ) ;
+ Size = MAP_APPFONT ( 90 , 12 ) ;
+ Text [ en-US ] = "Inte~rnet" ;
+ };
+ Window WIN_EXAMPLE
+ {
+ Pos = MAP_APPFONT ( 231 , 14 ) ;
+ Size = MAP_APPFONT ( 82 , 124 ) ;
+ };
+ Window WIN_EXAMPLE_DUMMY
+ {
+ Pos = MAP_APPFONT ( 231 , 14 ) ;
+ Size = MAP_APPFONT ( 82 , 124 ) ;
+ Border = TRUE;
+ };
+ CheckBox CB_SHOW_EXAMPLE
+ {
+ HelpID = "sw:CheckBox:DLG_GLOSSARY:CB_SHOW_EXAMPLE";
+ Pos = MAP_APPFONT ( 231 , 145 ) ;
+ Size = MAP_APPFONT ( 82 , 12 ) ;
+ Text [ en-US ] = "Sho~w preview";
+ };
+ OKButton PB_INSERT
+ {
+ Pos = MAP_APPFONT ( 319 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Einfügen : ~Einf³gen */
+ Text [ en-US ] = "~Insert" ;
+ /* ### ACHTUNG: Neuer Text in Resource? Fügt den aktuellen Textblock ein und schließt das Dialogfeld : F³gt den aktuellen Textblock ein und schlie˜t das Dialogfeld */
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CLOSE
+ {
+ Pos = MAP_APPFONT ( 319 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Schließen : ~Schlie˜en */
+ Text [ en-US ] = "~Close" ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 319 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ };
+ MenuButton PB_EDIT
+ {
+ HelpID = "sw:MenuButton:DLG_GLOSSARY:PB_EDIT";
+ Pos = MAP_APPFONT ( 319 , 60 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "AutoTe~xt" ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_BIB
+ {
+ HelpID = "sw:PushButton:DLG_GLOSSARY:PB_BIB";
+ Pos = MAP_APPFONT ( 319 , 77 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "C~ategories..." ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_PATH
+ {
+ HelpID = "sw:PushButton:DLG_GLOSSARY:PB_PATH";
+ Pos = MAP_APPFONT ( 319 , 94 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Path..." ;
+ };
+ String ST_READONLY_PATH
+ {
+ Text [ en-US ] = "The 'AutoText' directories are read-only. Do you want to call the path settings dialog?";
+ };
+ Menu MNU_EDIT
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = FN_GL_DEFINE ;
+ HelpID = HID_MD_GLOS_DEFINE ;
+ Text [ en-US ] = "~New" ;
+ };
+ MenuItem
+ {
+ Identifier = FN_GL_DEFINE_TEXT ;
+ HelpID = HID_MD_GLOS_DEFINE_TEXT ;
+ Text [ en-US ] = "New (text only)" ;
+ };
+ MenuItem
+ {
+ Identifier = FN_GL_COPY_TO_CLIPBOARD;
+ HelpID = HID_MD_COPY_TO_CLIPBOARD;
+ Text [ en-US ] = "~Copy";
+ };
+ MenuItem
+ {
+ Identifier = FN_GL_REPLACE ;
+ HelpID = HID_MD_GLOS_REPLACE ;
+ Text [ en-US ] = "Replace" ;
+ };
+ MenuItem
+ {
+ Identifier = FN_GL_REPLACE_TEXT;
+ HelpID = HID_MD_GLOS_REPLACE;
+ Text [ en-US ] = "Rep~lace (text only)" ;
+ };
+ MenuItem
+ {
+ Identifier = FN_GL_RENAME ;
+ HelpID = HID_MD_GLOS_RENAME ;
+ Text [ en-US ] = "Rename..." ;
+ };
+ MenuItem
+ {
+ Identifier = FN_GL_DELETE ;
+ HelpID = HID_MD_GLOS_DELETE ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~Löschen : ~L÷schen */
+ Text [ en-US ] = "~Delete" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = FN_GL_EDIT ;
+ HelpID = HID_MD_GLOS_EDIT ;
+ Text [ en-US ] = "~Edit" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = FN_GL_MACRO ;
+ HelpID = HID_MD_GLOS_MACRO ;
+ Text [ en-US ] = "~Macro..." ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = FN_GL_IMPORT;
+ HelpID = HID_MD_GLOS_IMPORT ;
+ Text [ en-US ] = "~Import...";
+ };
+ };
+ };
+};
+InfoBox MSG_DOUBLE_SHORTNAME
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Kürzel wird bereits verwendet. Bitte einen anderen Namen vergeben! : K³rzel wird bereits verwendet. Bitte einen anderen Namen vergeben! */
+ Message [ en-US ] = "Shortcut name already exists. Please choose another name." ;
+};
+QueryBox MSG_QUERY_DELETE
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+ /* ### ACHTUNG: Neuer Text in Resource? Soll der AutoText gelöscht werden? : Soll der AutoText gel÷scht werden? */
+ Message [ en-US ] = "Delete AutoText?" ;
+};
+String STR_QUERY_DELETE_GROUP1
+{
+ Text [ en-US ] = "Delete the category " ;
+};
+String STR_QUERY_DELETE_GROUP2
+{
+ /* ### ACHTUNG: Neuer Text in Resource? gelöscht werden? : gel÷scht werden? */
+ Text [ en-US ] = "?" ;
+};
+String STR_GLOSSARY
+{
+ Text [ en-US ] = "AutoText :" ;
+};
+ModalDialog DLG_RENAME_GLOS
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 287 , 47 ) ;
+ Moveable = TRUE ;
+ HelpID = HID_RENAME_GLOSSARY ;
+ OKButton BT_OKNEW
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 231 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ DefButton = TRUE ;
+ TabStop = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 231 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_ON
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Na~me" ;
+ };
+ Edit ED_ON
+ {
+ HelpID = "sw:Edit:DLG_RENAME_GLOS:ED_ON";
+ ReadOnly = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 44 , 12 ) ;
+ Size = MAP_APPFONT ( 100 , 12 ) ;
+ Left = TRUE ;
+ };
+ FixedText FT_OS
+ {
+ Pos = MAP_APPFONT ( 147 , 14 ) ;
+ Size = MAP_APPFONT ( 52 , 8 ) ;
+ Text [ en-US ] = "Short~cut" ;
+ };
+ Edit ED_OS
+ {
+ HelpID = "sw:Edit:DLG_RENAME_GLOS:ED_OS";
+ ReadOnly = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 200 , 12 ) ;
+ Size = MAP_APPFONT ( 21 , 12 ) ;
+ Left = TRUE ;
+ };
+ FixedText FT_NN
+ {
+ Pos = MAP_APPFONT ( 12 , 29 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "~New" ;
+ };
+ Edit ED_NN
+ {
+ HelpID = "sw:Edit:DLG_RENAME_GLOS:ED_NN";
+ TabStop = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 44 , 27 ) ;
+ Size = MAP_APPFONT ( 100 , 12 ) ;
+ Left = TRUE ;
+ };
+ FixedText FT_NS
+ {
+ Pos = MAP_APPFONT ( 147 , 29 ) ;
+ Size = MAP_APPFONT ( 52 , 8 ) ;
+ Text [ en-US ] = "~Shortcut" ;
+ };
+ Edit ED_NS
+ {
+ HelpID = "sw:Edit:DLG_RENAME_GLOS:ED_NS";
+ TabStop = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 200 , 27 ) ;
+ Size = MAP_APPFONT ( 21 , 12 ) ;
+ Left = TRUE ;
+ };
+ FixedLine FL_NN
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 219 , 8 ) ;
+ };
+ Text [ en-US ] = "Rename AutoText" ;
+};
+String STR_SAVE_GLOSSARY
+{
+ Text[ en-US ] = "Save AutoText";
+};
+InfoBox MSG_NO_GLOSSARIES
+{
+ Message [ en-US ] = "There is no AutoText in this file.";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/misc/glshell.cxx b/sw/source/ui/misc/glshell.cxx
new file mode 100644
index 000000000000..9c70ef06e58a
--- /dev/null
+++ b/sw/source/ui/misc/glshell.cxx
@@ -0,0 +1,349 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <com/sun/star/frame/XTitle.hpp>
+
+#include <tools/list.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <svl/srchitem.hxx>
+#include <svl/macitem.hxx>
+#include <gloshdl.hxx>
+
+#include <editeng/acorrcfg.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <uitool.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <glshell.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <glosdoc.hxx>
+#include <shellio.hxx>
+#include <initui.hxx> // fuer ::GetGlossaries()
+#include <cmdid.h>
+#include <swerror.h>
+#include <misc.hrc>
+
+
+#define SwWebGlosDocShell
+#define SwGlosDocShell
+#include <sfx2/msg.hxx>
+#include <swslots.hxx>
+
+using namespace ::com::sun::star;
+
+SFX_IMPL_INTERFACE( SwGlosDocShell, SwDocShell, SW_RES(0) )
+{
+}
+
+SFX_IMPL_INTERFACE( SwWebGlosDocShell, SwWebDocShell, SW_RES(0) )
+{
+}
+
+
+TYPEINIT1( SwGlosDocShell, SwDocShell );
+TYPEINIT1( SwWebGlosDocShell, SwWebDocShell );
+
+
+void lcl_Execute( SwDocShell& rSh, SfxRequest& rReq )
+{
+ if ( rReq.GetSlot() == SID_SAVEDOC )
+ {
+ if( !rSh.HasName() )
+ {
+ rReq.SetReturnValue( SfxBoolItem( 0, rSh.Save() ) );
+ }
+ else
+ {
+ const SfxBoolItem* pRes = ( const SfxBoolItem* )
+ rSh.ExecuteSlot( rReq,
+ rSh.SfxObjectShell::GetInterface() );
+ if( pRes->GetValue() )
+ rSh.GetDoc()->ResetModified();
+ }
+ }
+}
+
+
+void lcl_GetState( SwDocShell& rSh, SfxItemSet& rSet )
+{
+ if( SFX_ITEM_AVAILABLE >= rSet.GetItemState( SID_SAVEDOC, FALSE ))
+ {
+ if( !rSh.GetDoc()->IsModified() )
+ rSet.DisableItem( SID_SAVEDOC );
+ else
+ rSet.Put( SfxStringItem( SID_SAVEDOC, SW_RESSTR(STR_SAVE_GLOSSARY)));
+ }
+}
+
+
+BOOL lcl_Save( SwWrtShell& rSh, const String& rGroupName,
+ const String& rShortNm, const String& rLongNm )
+{
+ const SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
+ SwTextBlocks * pBlock = ::GetGlossaries()->GetGroupDoc( rGroupName );
+
+ SvxMacro aStart(aEmptyStr, aEmptyStr);
+ SvxMacro aEnd(aEmptyStr, aEmptyStr);
+ SwGlossaryHdl* pGlosHdl;
+
+ pGlosHdl = rSh.GetView().GetGlosHdl();
+ pGlosHdl->GetMacros( rShortNm, aStart, aEnd, pBlock );
+
+ USHORT nRet = rSh.SaveGlossaryDoc( *pBlock, rLongNm, rShortNm,
+ pCfg->IsSaveRelFile(),
+ pBlock->IsOnlyTextBlock( rShortNm ) );
+
+ if(aStart.GetMacName().Len() || aEnd.GetMacName().Len() )
+ {
+ SvxMacro* pStart = aStart.GetMacName().Len() ? &aStart : 0;
+ SvxMacro* pEnd = aEnd.GetMacName().Len() ? &aEnd : 0;
+ pGlosHdl->SetMacros( rShortNm, pStart, pEnd, pBlock );
+ }
+
+ rSh.EnterStdMode();
+ if( USHRT_MAX != nRet )
+ rSh.ResetModified();
+ delete pBlock;
+ return nRet != USHRT_MAX;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwGlosDocShell::SwGlosDocShell(sal_Bool bNewShow)
+ : SwDocShell( (bNewShow)
+ ? SFX_CREATE_MODE_STANDARD : SFX_CREATE_MODE_INTERNAL )
+ , bShow ( bNewShow )
+{
+ SetHelpId(SW_GLOSDOCSHELL);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwGlosDocShell::~SwGlosDocShell( )
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwGlosDocShell::Execute( SfxRequest& rReq )
+{
+ ::lcl_Execute( *this, rReq );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwGlosDocShell::GetState( SfxItemSet& rSet )
+{
+ ::lcl_GetState( *this, rSet );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+BOOL SwGlosDocShell::Save()
+{
+ // In case of an API object which holds this document, it is possible that the WrtShell is already
+ // dead. For instance, if the doc is modified via this API object, and then, upon office shutdown,
+ // the document's view is closed (by the SFX framework) _before_ the API object is release and
+ // tries to save the doc, again.
+ // 96380 - 2002-03-03 - fs@openoffice.org
+ if ( GetWrtShell() )
+ return ::lcl_Save( *GetWrtShell(), aGroupName, aShortName, aLongName );
+ else
+ {
+ SetModified( FALSE );
+ return FALSE;
+ }
+}
+
+
+/* */
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwWebGlosDocShell::SwWebGlosDocShell()
+ : SwWebDocShell( SFX_CREATE_MODE_STANDARD )
+{
+ SetHelpId(SW_WEBGLOSDOCSHELL);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwWebGlosDocShell::~SwWebGlosDocShell( )
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwWebGlosDocShell::Execute( SfxRequest& rReq )
+{
+ ::lcl_Execute( *this, rReq );
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwWebGlosDocShell::GetState( SfxItemSet& rSet )
+{
+ ::lcl_GetState( *this, rSet );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+BOOL SwWebGlosDocShell::Save()
+{
+ // same comment as in SwGlosDocShell::Save - see there
+ if ( GetWrtShell() )
+ return ::lcl_Save( *GetWrtShell(), aGroupName, aShortName, aLongName );
+ else
+ {
+ SetModified( FALSE );
+ return FALSE;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SV_IMPL_REF ( SwDocShell )
+
+SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rShortName, BOOL bShow )
+{
+ SwDocShellRef xDocSh;
+
+ SwTextBlocks* pGroup = GetGroupDoc( rGroup );
+ if( pGroup && pGroup->GetCount() )
+ {
+ // erfrage welche View registriert ist. Im WebWriter gibts es keine
+ // normale View
+ USHORT nViewId = 0 != &SwView::Factory() ? 2 : 6;
+ String sLongName = pGroup->GetLongName(pGroup->GetIndex( rShortName ));
+
+ if( 6 == nViewId )
+ {
+ SwWebGlosDocShell* pDocSh = new SwWebGlosDocShell();
+ xDocSh = pDocSh;
+ pDocSh->DoInitNew( 0 );
+ pDocSh->SetLongName( sLongName );
+ pDocSh->SetShortName( rShortName);
+ pDocSh->SetGroupName( rGroup );
+ }
+ else
+ {
+ SwGlosDocShell* pDocSh = new SwGlosDocShell(bShow);
+ xDocSh = pDocSh;
+ pDocSh->DoInitNew( 0 );
+ pDocSh->SetLongName( sLongName );
+ pDocSh->SetShortName( rShortName );
+ pDocSh->SetGroupName( rGroup );
+ }
+
+ // Dokumenttitel setzen
+ SfxViewFrame* pFrame = bShow ? SfxViewFrame::LoadDocument( *xDocSh, nViewId ) : SfxViewFrame::LoadHiddenDocument( *xDocSh, nViewId );
+ String aDocTitle(SW_RES( STR_GLOSSARY ));
+ aDocTitle += ' ';
+ aDocTitle += sLongName;
+
+ bool const bDoesUndo =
+ xDocSh->GetDoc()->GetIDocumentUndoRedo().DoesUndo();
+ xDocSh->GetDoc()->GetIDocumentUndoRedo().DoUndo( false );
+
+ xDocSh->GetWrtShell()->InsertGlossary( *pGroup, rShortName );
+ if( !xDocSh->GetDoc()->getPrinter( false ) )
+ {
+ // wir erzeugen einen default SfxPrinter.
+ // Das ItemSet wird vom Sfx geloescht!
+ SfxItemSet *pSet = new SfxItemSet( xDocSh->GetDoc()->GetAttrPool(),
+ FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
+ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+ 0 );
+ SfxPrinter* pPrinter = new SfxPrinter( pSet );
+
+ // und haengen ihn ans Dokument.
+ xDocSh->GetDoc()->setPrinter( pPrinter, true, true );
+ }
+
+ xDocSh->SetTitle( aDocTitle );
+ try
+ {
+ // set the UI-title
+ uno::Reference< frame::XTitle > xTitle( xDocSh->GetModel(), uno::UNO_QUERY_THROW );
+ xTitle->setTitle( aDocTitle );
+ }
+ catch( uno::Exception& )
+ {}
+
+ xDocSh->GetDoc()->GetIDocumentUndoRedo().DoUndo( bDoesUndo );
+ xDocSh->GetDoc()->ResetModified();
+ if ( bShow )
+ pFrame->GetFrame().Appear();
+
+ delete pGroup;
+ }
+ return xDocSh;
+}
+
+
diff --git a/sw/source/ui/misc/impfnote.hxx b/sw/source/ui/misc/impfnote.hxx
new file mode 100644
index 000000000000..a1b305b3b7db
--- /dev/null
+++ b/sw/source/ui/misc/impfnote.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _IMPFNOTE_HXX
+#define _IMPFNOTE_HXX
+
+#include <sfx2/tabdlg.hxx>
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _FIELD_HXX //autogen
+#include <vcl/field.hxx>
+#endif
+#include <numberingtypelistbox.hxx>
+
+class SwWrtShell;
+
+class SwEndNoteOptionPage : public SfxTabPage
+{
+ FixedText aNumTypeFT;
+ SwNumberingTypeListBox aNumViewBox;
+ FixedText aOffsetLbl;
+ NumericField aOffsetFld;
+ FixedText aNumCountFT;
+ ListBox aNumCountBox;
+ FixedText aPrefixFT;
+ Edit aPrefixED;
+ FixedText aSuffixFT;
+ Edit aSuffixED;
+ FixedText aPosFT;
+ RadioButton aPosPageBox;
+ RadioButton aPosChapterBox;
+ FixedLine aNumFL;
+
+ FixedText aParaTemplLbl;
+ ListBox aParaTemplBox;
+ FixedText aPageTemplLbl;
+ ListBox aPageTemplBox;
+ FixedLine aTemplFL;
+
+ FixedText aFtnCharAnchorTemplLbl;
+ ListBox aFtnCharAnchorTemplBox;
+ FixedText aFtnCharTextTemplLbl;
+ ListBox aFtnCharTextTemplBox;
+ FixedLine aCharTemplFL;
+
+ FixedText aContLbl;
+ Edit aContEdit;
+ FixedText aContFromLbl;
+ Edit aContFromEdit;
+ FixedLine aContFL;
+
+ String aNumDoc;
+ String aNumPage;
+ String aNumChapter;
+ SwWrtShell *pSh;
+ BOOL bPosDoc;
+ BOOL bEndNote;
+
+ inline void SelectNumbering(int eNum);
+ int GetNumbering() const;
+
+ DECL_LINK( PosPageHdl, Button * );
+ DECL_LINK( PosChapterHdl, Button * );
+ DECL_LINK( NumCountHdl, ListBox * );
+
+
+public:
+ SwEndNoteOptionPage( Window *pParent, BOOL bEndNote,
+ const SfxItemSet &rSet );
+ ~SwEndNoteOptionPage();
+
+ static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
+ virtual BOOL FillItemSet(SfxItemSet &rSet);
+ virtual void Reset( const SfxItemSet& );
+
+ void SetShell( SwWrtShell &rShell );
+};
+
+class SwFootNoteOptionPage : public SwEndNoteOptionPage
+{
+ SwFootNoteOptionPage( Window *pParent, const SfxItemSet &rSet );
+ ~SwFootNoteOptionPage();
+
+public:
+ static SfxTabPage *Create(Window *pParent, const SfxItemSet &rSet);
+};
+
+
+
+#endif
diff --git a/sw/source/ui/misc/insfnote.cxx b/sw/source/ui/misc/insfnote.cxx
new file mode 100644
index 000000000000..5cc82f8473eb
--- /dev/null
+++ b/sw/source/ui/misc/insfnote.cxx
@@ -0,0 +1,353 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include <hintids.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/fontitem.hxx>
+#include <vcl/msgbox.hxx>
+#include <fmtftn.hxx>
+#include <swundo.hxx>
+#include <cmdid.h>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <basesh.hxx>
+#include <insfnote.hxx>
+#include <crsskip.hxx>
+#include <misc.hrc>
+#include <insfnote.hrc>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <sfx2/viewfrm.hxx>
+
+static BOOL bFootnote = TRUE;
+
+/*------------------------------------------------------------------------
+ Beschreibung: Einfuegen der Fussnote durch OK
+------------------------------------------------------------------------*/
+
+void __EXPORT SwInsFootNoteDlg::Apply()
+{
+ String aStr;
+
+ if ( aNumberCharBtn.IsChecked() )
+ aStr = aNumberCharEdit.GetText();
+
+ if ( bEdit )
+ {
+ rSh.StartAction();
+ rSh.Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ rSh.StartUndo( UNDO_START );
+ SwFmtFtn aNote( aEndNoteBtn.IsChecked() );
+ aNote.SetNumStr( aStr );
+
+ if( rSh.SetCurFtn( aNote ) && bExtCharAvailable )
+ {
+ rSh.Right(CRSR_SKIP_CHARS, TRUE, 1, FALSE );
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT );
+ rSh.GetCurAttr( aSet );
+ SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT );
+ SvxFontItem aFont( rFont.GetFamily(), aFontName,
+ rFont.GetStyleName(), rFont.GetPitch(),
+ eCharSet, RES_CHRATR_FONT );
+ aSet.Put( aFont );
+ rSh.SetAttr( aSet, nsSetAttrMode::SETATTR_DONTEXPAND );
+ rSh.ResetSelect(0, FALSE);
+ rSh.Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ }
+ rSh.EndUndo( UNDO_END );
+ rSh.EndAction();
+ }
+ else
+ {
+/*
+ rSh.StartUndo( UNDO_UI_INSERT_FOOTNOTE );
+ rSh.InsertFootnote( aStr, aEndNoteBtn.IsChecked(), !bExtCharAvailable );
+
+ if ( bExtCharAvailable )
+ {
+ rSh.Left( CRSR_SKIP_CHARS, TRUE, 1, FALSE );
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT );
+ rSh.GetAttr( aSet );
+ SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT );
+ SvxFontItem aFont( rFont.GetFamily(), aFontName,
+ rFont.GetStyleName(), rFont.GetPitch(),
+ eCharSet );
+ aSet.Put( aFont );
+ rSh.SetAttr( aSet, SETATTR_DONTEXPAND );
+ // zur Bearbeitung des Fussnotentextes
+ rSh.ResetSelect(0, FALSE);
+ rSh.GotoFtnTxt();
+ }
+ rSh.EndUndo( UNDO_UI_INSERT_FOOTNOTE );
+*/
+ }
+
+ bFootnote = aFtnBtn.IsChecked();
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK_INLINE_START( SwInsFootNoteDlg, NumberCharHdl, Button *, EMPTYARG )
+{
+ aNumberCharEdit.GrabFocus();
+ aOkBtn.Enable( aNumberCharEdit.GetText().Len() || bExtCharAvailable );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwInsFootNoteDlg, NumberCharHdl, Button *, EMPTYARG )
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK_INLINE_START( SwInsFootNoteDlg, NumberEditHdl, void *, EMPTYARG )
+{
+ aNumberCharBtn.Check( TRUE );
+ aOkBtn.Enable( 0 != aNumberCharEdit.GetText().Len() );
+
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwInsFootNoteDlg, NumberEditHdl, void *, EMPTYARG )
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK_INLINE_START( SwInsFootNoteDlg, NumberAutoBtnHdl, Button *, EMPTYARG )
+{
+ aOkBtn.Enable( TRUE );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwInsFootNoteDlg, NumberAutoBtnHdl, Button *, EMPTYARG )
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwInsFootNoteDlg, NumberExtCharHdl, Button *, EMPTYARG )
+{
+ aNumberCharBtn.Check( TRUE );
+
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT );
+ rSh.GetCurAttr( aSet );
+ const SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT );
+
+ SfxAllItemSet aAllSet( rSh.GetAttrPool() );
+ aAllSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) );
+ aAllSet.Put( rFont );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aAllSet,
+ rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
+ if (RET_OK == pDlg->Execute())
+ {
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pItem, SfxStringItem, SID_CHARMAP, FALSE );
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, FALSE );
+ if ( pItem )
+ {
+ String sExtChars(pItem->GetValue());
+ aNumberCharEdit.SetText( sExtChars );
+
+ if ( pFontItem )
+ {
+ aFontName = pFontItem->GetFamilyName();
+ eCharSet = pFontItem->GetCharSet();
+ Font aFont( aFontName, pFontItem->GetStyleName(), aNumberCharEdit.GetFont().GetSize() );
+ aFont.SetCharSet( pFontItem->GetCharSet() );
+ aFont.SetPitch( pFontItem->GetPitch() );
+ aNumberCharEdit.SetFont( aFont );
+ }
+
+ bExtCharAvailable = TRUE;
+ aOkBtn.Enable(0 != aNumberCharEdit.GetText().Len());
+ }
+ }
+ delete pDlg;
+
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwInsFootNoteDlg, NextPrevHdl, Button *, pBtn )
+{
+ Apply();
+
+ // Hier zur naechsten Fuss/Endnote wandern
+ rSh.ResetSelect(0, FALSE);
+ if (pBtn == &aNextBT)
+ rSh.GotoNextFtnAnchor();
+ else
+ rSh.GotoPrevFtnAnchor();
+
+ Init();
+
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwInsFootNoteDlg::SwInsFootNoteDlg(Window *pParent, SwWrtShell &rShell, BOOL bEd) :
+
+ SvxStandardDialog(pParent,SW_RES(DLG_INS_FOOTNOTE)),
+
+ rSh(rShell),
+ bExtCharAvailable(FALSE),
+ bEdit(bEd),
+ aNumberAutoBtn (this,SW_RES(RB_NUMBER_AUTO)),
+ aNumberCharBtn (this,SW_RES(RB_NUMBER_CHAR)),
+ aNumberCharEdit (this,SW_RES(ED_NUMBER_CHAR)),
+ aNumberExtChar (this,SW_RES(BT_NUMBER_CHAR)),
+ aNumberFL (this,SW_RES(FL_NUMBER)),
+
+ aFtnBtn (this,SW_RES(RB_TYPE_FTN)),
+ aEndNoteBtn (this,SW_RES(RB_TYPE_ENDNOTE)),
+ aTypeFL (this,SW_RES(FL_TYPE)),
+
+ aOkBtn (this,SW_RES(BT_OK)),
+ aCancelBtn (this,SW_RES(BT_CANCEL)),
+ aHelpBtn (this,SW_RES(BT_HELP)),
+ aPrevBT (this,SW_RES(BT_PREV)),
+ aNextBT (this,SW_RES(BT_NEXT))
+{
+ aNumberAutoBtn.SetClickHdl(LINK(this,SwInsFootNoteDlg,NumberAutoBtnHdl));
+ aNumberExtChar.SetClickHdl(LINK(this,SwInsFootNoteDlg,NumberExtCharHdl));
+ aNumberCharBtn.SetClickHdl(LINK(this,SwInsFootNoteDlg,NumberCharHdl));
+ aNumberCharEdit.SetModifyHdl(LINK(this,SwInsFootNoteDlg,NumberEditHdl));
+ aNumberCharEdit.SetMaxTextLen(10);
+ aNumberCharEdit.Enable();
+
+ aPrevBT.SetClickHdl(LINK(this, SwInsFootNoteDlg, NextPrevHdl));
+ aNextBT.SetClickHdl(LINK(this, SwInsFootNoteDlg, NextPrevHdl));
+
+ FreeResource();
+ rSh.SetCareWin(this);
+
+ if (bEdit)
+ {
+ Init();
+
+ aPrevBT.Show();
+ aNextBT.Show();
+ }
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwInsFootNoteDlg::~SwInsFootNoteDlg()
+{
+ rSh.SetCareWin(0);
+
+ if (bEdit)
+ rSh.ResetSelect(0, FALSE);
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwInsFootNoteDlg::Init()
+{
+ SwFmtFtn aFtnNote;
+ String sNumStr;
+ Font aFont;
+ bExtCharAvailable = FALSE;
+
+ rSh.StartAction();
+
+ if( rSh.GetCurFtn( &aFtnNote ))
+ {
+ if(aFtnNote.GetNumStr().Len())
+ {
+ sNumStr = aFtnNote.GetNumStr();
+
+ rSh.Right(CRSR_SKIP_CHARS, TRUE, 1, FALSE );
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT );
+ rSh.GetCurAttr( aSet );
+ const SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT );
+
+ aFont = aNumberCharEdit.GetFont();
+ aFontName = rFont.GetFamilyName();
+ eCharSet = rFont.GetCharSet();
+ aFont.SetName(aFontName);
+ aFont.SetCharSet(eCharSet);
+ bExtCharAvailable = TRUE;
+ rSh.Left( CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ }
+ bFootnote = !aFtnNote.IsEndNote();
+ }
+ aNumberCharEdit.SetFont(aFont);
+
+ BOOL bNumChar = sNumStr.Len() != 0;
+
+ aNumberCharEdit.SetText(sNumStr);
+ aNumberCharBtn.Check(bNumChar);
+ aNumberAutoBtn.Check(!bNumChar);
+ if (bNumChar)
+ aNumberCharEdit.GrabFocus();
+
+ if (bFootnote)
+ aFtnBtn.Check();
+ else
+ aEndNoteBtn.Check();
+
+ BOOL bNext = rSh.GotoNextFtnAnchor();
+
+ if (bNext)
+ rSh.GotoPrevFtnAnchor();
+
+ BOOL bPrev = rSh.GotoPrevFtnAnchor();
+
+ if (bPrev)
+ rSh.GotoNextFtnAnchor();
+
+ aPrevBT.Enable(bPrev);
+ aNextBT.Enable(bNext);
+
+ rSh.Right(CRSR_SKIP_CHARS, TRUE, 1, FALSE );
+
+ rSh.EndAction();
+}
+
diff --git a/sw/source/ui/misc/insfnote.hrc b/sw/source/ui/misc/insfnote.hrc
new file mode 100644
index 000000000000..8ac15b4f9fc3
--- /dev/null
+++ b/sw/source/ui/misc/insfnote.hrc
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define RB_NUMBER_AUTO 1
+#define RB_NUMBER_CHAR 2
+#define ED_NUMBER_CHAR 3
+#define BT_NUMBER_CHAR 4
+#define FL_NUMBER 5
+#define FL_TYPE 6
+#define RB_TYPE_FTN 7
+#define RB_TYPE_ENDNOTE 8
+
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_HELP 102
+#define BT_PREV 103
+#define BT_NEXT 104
diff --git a/sw/source/ui/misc/insfnote.src b/sw/source/ui/misc/insfnote.src
new file mode 100644
index 000000000000..265ee1e095f6
--- /dev/null
+++ b/sw/source/ui/misc/insfnote.src
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "misc.hrc"
+#include "insfnote.hrc"
+#include "helpid.h"
+ // #define DLG_INS_FOOTNOTE 257
+ModalDialog DLG_INS_FOOTNOTE
+{
+ HelpID = "sw:ModalDialog:DLG_INS_FOOTNOTE";
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 160 , 100 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Fußnote einfügen : Fu˜note einf³gen */
+ Text [ en-US ] = "Insert Footnote/Endnote" ;
+ Moveable = TRUE ;
+ Edit ED_NUMBER_CHAR
+ {
+ HelpID = "sw:Edit:DLG_INS_FOOTNOTE:ED_NUMBER_CHAR";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 69 , 27 ) ;
+ Size = MAP_APPFONT ( 23 , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ Left = TRUE ;
+ };
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 104 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 104 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 104 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ ImageButton BT_PREV
+ {
+ HelpID = "sw:ImageButton:DLG_INS_FOOTNOTE:BT_PREV";
+ Pos = MAP_APPFONT ( 104 , 82 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ SYMBOL = IMAGEBUTTON_PREV ;
+ };
+ ImageButton BT_NEXT
+ {
+ HelpID = "sw:ImageButton:DLG_INS_FOOTNOTE:BT_NEXT";
+ Pos = MAP_APPFONT ( 130 , 82 ) ;
+ Size = MAP_APPFONT ( 24 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ SYMBOL = IMAGEBUTTON_NEXT ;
+ };
+ RadioButton RB_NUMBER_AUTO
+ {
+ HelpID = "sw:RadioButton:DLG_INS_FOOTNOTE:RB_NUMBER_AUTO";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "~Automatic" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ Check = TRUE ;
+ };
+ RadioButton RB_NUMBER_CHAR
+ {
+ HelpID = "sw:RadioButton:DLG_INS_FOOTNOTE:RB_NUMBER_CHAR";
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 54 , 10 ) ;
+ Text [ en-US ] = "~Character" ;
+ };
+ FixedLine FL_NUMBER
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ Text [ en-US ] = "Numbering" ;
+ };
+ PushButton BT_NUMBER_CHAR
+ {
+ HelpID = "sw:PushButton:DLG_INS_FOOTNOTE:BT_NUMBER_CHAR";
+ Pos = MAP_APPFONT ( 69 , 42 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ Text = "..." ;
+ };
+ RadioButton RB_TYPE_FTN
+ {
+ HelpID = "sw:RadioButton:DLG_INS_FOOTNOTE:RB_TYPE_FTN";
+ Pos = MAP_APPFONT ( 12 , 70 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ Check = TRUE ;
+ Text [ en-US ] = "~Footnote" ;
+ };
+ RadioButton RB_TYPE_ENDNOTE
+ {
+ HelpID = "sw:RadioButton:DLG_INS_FOOTNOTE:RB_TYPE_ENDNOTE";
+ Pos = MAP_APPFONT ( 12 , 83 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "~Endnote" ;
+ };
+ FixedLine FL_TYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 60 ) ;
+ Size = MAP_APPFONT ( 92 , 8 ) ;
+ Text [ en-US ] = "Type" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/misc/insrule.cxx b/sw/source/ui/misc/insrule.cxx
new file mode 100644
index 000000000000..c053030201ad
--- /dev/null
+++ b/sw/source/ui/misc/insrule.cxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#include "hintids.hxx"
+#include <svx/gallery.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <editeng/brshitem.hxx>
+#include <svl/urihelper.hxx>
+#include <vcl/graph.hxx>
+
+#include "swtypes.hxx"
+#include "docsh.hxx"
+#include "insrule.hxx"
+#include "swvset.hxx"
+#include "insrule.hrc"
+#include "misc.hrc"
+#include "helpid.h"
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+SwInsertGrfRulerDlg::SwInsertGrfRulerDlg( Window* pParent ) :
+ SfxModalDialog(pParent, SW_RES(DLG_INSERT_RULER)),
+ aSelectionFL(this, SW_RES(FL_SEL )),
+ aOkPB (this, SW_RES(PB_OK )),
+ aCancelPB (this, SW_RES(PB_CANCEL )),
+ aHelpPB (this, SW_RES(PB_HELP )),
+
+ sSimple (SW_RES(ST_SIMPLE)),
+ nSelPos(USHRT_MAX),
+ pExampleVS (new SwRulerValueSet(this, SW_RES(VS_EXAMPLE )))
+{
+ FreeResource();
+ pExampleVS->SetLineCount(6);
+ pExampleVS->SetColCount(1);
+ pExampleVS->SetSelectHdl(LINK(this, SwInsertGrfRulerDlg, SelectHdl));
+ pExampleVS->SetDoubleClickHdl(LINK(this, SwInsertGrfRulerDlg, DoubleClickHdl));
+ pExampleVS->GrabFocus();
+
+ // Grafiknamen ermitteln
+ GalleryExplorer::BeginLocking(GALLERY_THEME_RULERS);
+ GalleryExplorer::FillObjList( GALLERY_THEME_RULERS, aGrfNames );
+ pExampleVS->SetHelpId(HID_VS_RULER);
+ Color aColor(COL_WHITE);
+ pExampleVS->InsertItem( 1, 1);
+ pExampleVS->SetItemText( 1, sSimple);
+
+ for(USHORT i = 1; i <= aGrfNames.Count(); i++)
+ {
+ pExampleVS->InsertItem( i + 1, i);
+ pExampleVS->SetItemText( i + 1, *((String*)aGrfNames.GetObject(i-1)));
+ }
+ pExampleVS->Show();
+
+}
+/*-----------------14.02.97 13.18-------------------
+
+--------------------------------------------------*/
+
+SwInsertGrfRulerDlg::~SwInsertGrfRulerDlg()
+{
+ GalleryExplorer::EndLocking(GALLERY_THEME_RULERS);
+ delete pExampleVS;
+}
+
+/*-----------------14.02.97 13.17-------------------
+
+--------------------------------------------------*/
+
+String SwInsertGrfRulerDlg::GetGraphicName()
+{
+ String sRet;
+ USHORT nSel = nSelPos - 2; //align selection position with ValueSet index
+ if(nSel < aGrfNames.Count())
+ sRet = URIHelper::SmartRel2Abs(
+ INetURLObject(), *(String*) aGrfNames.GetObject(nSel),
+ URIHelper::GetMaybeFileHdl());
+ return sRet;
+}
+
+/*-----------------14.02.97 13.20-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK(SwInsertGrfRulerDlg, SelectHdl, ValueSet*, pVS)
+{
+ nSelPos = pVS->GetSelectItemId();
+ aOkPB.Enable();
+ return 0;
+}
+
+/*-----------------14.02.97 14.17-------------------
+
+--------------------------------------------------*/
+SwRulerValueSet::SwRulerValueSet( Window* pParent, const ResId& rResId ) :
+ SvxBmpNumValueSet(pParent, rResId)
+{
+ SetStyle( GetStyle() & ~WB_ITEMBORDER );
+}
+/*-----------------14.02.97 14.17-------------------
+
+--------------------------------------------------*/
+SwRulerValueSet::~SwRulerValueSet()
+{
+}
+/*-----------------14.02.97 13.42-------------------
+
+--------------------------------------------------*/
+void __EXPORT SwRulerValueSet::UserDraw( const UserDrawEvent& rUDEvt )
+{
+ Rectangle aRect = rUDEvt.GetRect();
+ OutputDevice* pDev = rUDEvt.GetDevice();
+ USHORT nItemId = rUDEvt.GetItemId();
+ Point aBLPos = aRect.TopLeft();
+
+ // Itemzaehlung beginnt bei 1, und die 1. ist die einfache Linie
+ if(nItemId > 1)
+ {
+ Graphic aGraphic;
+ if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_RULERS, nItemId - 2,
+ &aGraphic))
+ {
+ Size aGrfSize = aGraphic.GetPrefSize();
+ if(aGrfSize.Width() && aGrfSize.Height())
+ {
+ int nRelGrf = aGrfSize.Height() * 100 / aGrfSize.Width();
+ Size aWinSize = aRect.GetSize();
+ Size aPaintSize = aWinSize;
+ int nRelWin = aWinSize.Height() * 100 / aWinSize.Width();
+ if(nRelGrf > nRelWin)
+ {
+ aPaintSize.Width() = aWinSize.Height() * 100 / nRelGrf;
+ aBLPos.X() += (aWinSize.Width() - aPaintSize.Width()) /2;
+ }
+ else
+ {
+ aPaintSize.Height() = aWinSize.Width() * nRelGrf/100;
+ aBLPos.Y() += (aWinSize.Height() - aPaintSize.Height()) /2;
+ }
+ aBLPos.X() -= aPaintSize.Width() /2;
+ aBLPos.Y() -= aPaintSize.Height() /2;
+
+ aPaintSize.Width() *= 2;
+ aPaintSize.Height() *= 2;
+ if(aPaintSize.Height() < 2)
+ aPaintSize.Height() = 2;
+ Region aRegion = pDev->GetClipRegion();
+ pDev->SetClipRegion(aRect);
+ aGraphic.Draw(pDev, aBLPos, aPaintSize);
+ pDev->SetClipRegion(aRegion);
+ }
+ }
+ else
+ {
+ SetGrfNotFound(TRUE);
+ }
+ }
+ else
+ {
+ // Text fuer einfache Linie painten
+ Font aOldFont = pDev->GetFont();
+ Font aFont = pDev->GetFont();
+ Size aSize = aFont.GetSize();
+ int nRectHeight = aRect.GetHeight();
+ aSize.Height() = nRectHeight * 2 / 3;
+ aFont.SetSize(aSize);
+ pDev->SetFont(aFont);
+ String aText(GetItemText(nItemId));
+ aSize.Width() = pDev->GetTextWidth(aText);
+ aSize.Height() = pDev->GetTextHeight();
+ Point aPos(aBLPos);
+ aPos.Y() += (nRectHeight - aSize.Height()) / 2;
+ aPos.X() += (aRect.GetWidth() - aSize.Width()) / 2;
+ pDev->DrawText(aPos, aText);
+
+ pDev->SetFont(aOldFont);
+ }
+}
+
+/*-----------------15.02.97 10.03-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK(SwInsertGrfRulerDlg, DoubleClickHdl, ValueSet*, EMPTYARG)
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+
diff --git a/sw/source/ui/misc/insrule.hrc b/sw/source/ui/misc/insrule.hrc
new file mode 100644
index 000000000000..47289f2c366a
--- /dev/null
+++ b/sw/source/ui/misc/insrule.hrc
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "misc.hrc"
+
+#define FL_SEL 1
+#define VS_EXAMPLE 2
+#define PB_OK 3
+#define PB_CANCEL 4
+#define PB_HELP 5
+#define ST_SIMPLE 6
diff --git a/sw/source/ui/misc/insrule.src b/sw/source/ui/misc/insrule.src
new file mode 100644
index 000000000000..89890e5904af
--- /dev/null
+++ b/sw/source/ui/misc/insrule.src
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "insrule.hrc"
+#include "helpid.h"
+ModalDialog DLG_INSERT_RULER
+{
+ HelpID = HID_RULER_DIALOG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 242 , 124 ) ;
+ Moveable = TRUE ;
+ FixedLine FL_SEL
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 174 , 8 ) ;
+ Text [ en-US ] = "Selection" ;
+ };
+ Control VS_EXAMPLE
+ {
+ Pos = MAP_APPFONT ( 9 , 14 ) ;
+ Size = MAP_APPFONT ( 168 , 104 ) ;
+ Hide = TRUE ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 186 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ Disable = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 186 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 186 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ String ST_SIMPLE
+ {
+ Text [ en-US ] = "Plain" ;
+ };
+ Text [ en-US ] = "Insert Horizontal Rule" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/misc/linenum.cxx b/sw/source/ui/misc/linenum.cxx
new file mode 100644
index 000000000000..213c0e99e413
--- /dev/null
+++ b/sw/source/ui/misc/linenum.cxx
@@ -0,0 +1,335 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <sfx2/viewfrm.hxx>
+#include <svl/style.hxx>
+#include <vcl/msgbox.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <charfmt.hxx>
+
+//#ifndef _FLDMGR_HXX //autogen
+//#include <fldmgr.hxx>
+//#endif
+
+
+#include <docstyle.hxx>
+
+#include "fldbas.hxx"
+#include "lineinfo.hxx"
+#include "globals.hrc"
+#include "linenum.hrc"
+#include "linenum.hxx"
+#include "uitool.hxx"
+
+#include <IDocumentStylePoolAccess.hxx>
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwLineNumberingDlg::SwLineNumberingDlg(SwView *pVw) :
+ SfxSingleTabDialog(&pVw->GetViewFrame()->GetWindow(), 0, 0),
+ pSh(pVw->GetWrtShellPtr())
+{
+ // TabPage erzeugen
+ SetTabPage(SwLineNumberingPage::Create(this, *(SfxItemSet*)0));
+
+ GetOKButton()->SetClickHdl(LINK(this, SwLineNumberingDlg, OKHdl));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+__EXPORT SwLineNumberingDlg::~SwLineNumberingDlg()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwLineNumberingDlg, OKHdl, Button *, EMPTYARG )
+{
+ if (GetOKButton()->IsEnabled())
+ {
+ SfxTabPage* pCurPage = GetTabPage();
+ if( pCurPage )
+ pCurPage->FillItemSet(*(SfxItemSet*)0);
+
+ EndDialog( RET_OK );
+ }
+
+ return 0;
+}
+
+/*-----------------------------------------------------------------------
+ Beschreibung:
+ -----------------------------------------------------------------------*/
+
+SwLineNumberingPage::SwLineNumberingPage( Window* pParent,
+ const SfxItemSet& rSet )
+ : SfxTabPage(pParent, SW_RES(TP_LINENUMBERING), rSet),
+ aNumberingOnCB ( this, SW_RES( CB_NUMBERING_ON )),
+ aCharStyleFT ( this, SW_RES( FT_CHAR_STYLE )),
+ aCharStyleLB ( this, SW_RES( LB_CHAR_STYLE )),
+ aFormatFT ( this, SW_RES( FT_FORMAT )),
+ aFormatLB ( this, SW_RES( LB_FORMAT ), INSERT_NUM_EXTENDED_TYPES),
+ aPosFT ( this, SW_RES( FT_POS )),
+ aPosLB ( this, SW_RES( LB_POS )),
+ aOffsetFT ( this, SW_RES( FT_OFFSET )),
+ aOffsetMF ( this, SW_RES( MF_OFFSET )),
+ aNumIntervalFT ( this, SW_RES( FT_NUM_INVERVAL )),
+ aNumIntervalNF ( this, SW_RES( NF_NUM_INVERVAL )),
+ aNumRowsFT ( this, SW_RES( FT_NUM_ROWS )),
+ aDisplayFL ( this, SW_RES( FL_DISPLAY )),
+ aDivisorFT ( this, SW_RES( FT_DIVISOR )),
+ aDivisorED ( this, SW_RES( ED_DIVISOR )),
+ aDivIntervalFT ( this, SW_RES( FT_DIV_INTERVAL )),
+ aDivIntervalNF ( this, SW_RES( NF_DIV_INTERVAL )),
+ aDivRowsFT ( this, SW_RES( FT_DIV_ROWS )),
+ aDivisorFL ( this, SW_RES( FL_DIVISOR )),
+ aCountEmptyLinesCB ( this, SW_RES( CB_COUNT_EMPTYLINES )),
+ aCountFrameLinesCB ( this, SW_RES( CB_COUNT_FRAMELINES )),
+ aRestartEachPageCB ( this, SW_RES( CB_RESTART_PAGE )),
+ aCountFL ( this, SW_RES( FL_COUNT ))
+
+{
+ FreeResource();
+ SwLineNumberingDlg *pDlg = (SwLineNumberingDlg *)GetParent();
+ pSh = pDlg->GetWrtShell();
+ // Zeichenvorlagen
+ ::FillCharStyleListBox(aCharStyleLB, pSh->GetView().GetDocShell());
+}
+
+/*-----------------------------------------------------------------------
+ Beschreibung:
+ -----------------------------------------------------------------------*/
+
+__EXPORT SwLineNumberingPage::~SwLineNumberingPage()
+{
+}
+
+/*-----------------------------------------------------------------------
+ Beschreibung:
+ -----------------------------------------------------------------------*/
+
+SfxTabPage* __EXPORT SwLineNumberingPage::Create( Window* pParent, const SfxItemSet& rSet )
+{
+ return new SwLineNumberingPage( pParent, rSet );
+}
+
+/*-----------------------------------------------------------------------
+ Beschreibung:
+ -----------------------------------------------------------------------*/
+
+void __EXPORT SwLineNumberingPage::Reset( const SfxItemSet& )
+{
+ const SwLineNumberInfo &rInf = pSh->GetLineNumberInfo();
+ IDocumentStylePoolAccess* pIDSPA = pSh->getIDocumentStylePoolAccess();
+
+ String sStyleName(rInf.GetCharFmt( *pIDSPA )->GetName());
+ const USHORT nPos = aCharStyleLB.GetEntryPos(sStyleName);
+
+ if (nPos != LISTBOX_ENTRY_NOTFOUND)
+ aCharStyleLB.SelectEntryPos(nPos);
+ else
+ {
+ if (sStyleName.Len())
+ {
+ aCharStyleLB.InsertEntry(sStyleName);
+ aCharStyleLB.SelectEntry(sStyleName);
+ }
+ }
+
+ // Format
+// SwFldMgr aMgr( pSh );
+ USHORT nSelFmt = rInf.GetNumType().GetNumberingType();
+// USHORT nCnt = aMgr.GetFormatCount( TYP_SEQFLD, FALSE );
+
+// for( USHORT i = 0; i < nCnt; i++)
+// {
+// aFormatLB.InsertEntry(aMgr.GetFormatStr( TYP_SEQFLD, i));
+// USHORT nFmtId = aMgr.GetFormatId( TYP_SEQFLD, i );
+// aFormatLB.SetEntryData( i, (void*)nFmtId );
+// if( nFmtId == nSelFmt )
+// aFormatLB.SelectEntryPos( i );
+// }
+ aFormatLB.SelectNumberingType(nSelFmt);
+
+// if ( !aFormatLB.GetSelectEntryCount() )
+// aFormatLB.SelectEntryPos(aFormatLB.GetEntryCount() - 1);
+
+ // Position
+ aPosLB.SelectEntryPos((USHORT)rInf.GetPos());
+
+ // Offset
+ USHORT nOffset = rInf.GetPosFromLeft();
+ if (nOffset == USHRT_MAX)
+ nOffset = 0;
+
+ aOffsetMF.SetValue(aOffsetMF.Normalize(nOffset), FUNIT_TWIP);
+
+ // Numerierungsoffset
+ aNumIntervalNF.SetValue(rInf.GetCountBy());
+
+ // Teiler
+ aDivisorED.SetText(rInf.GetDivider());
+
+ // Teileroffset
+ aDivIntervalNF.SetValue(rInf.GetDividerCountBy());
+
+ // Zaehlen
+ aCountEmptyLinesCB.Check(rInf.IsCountBlankLines());
+ aCountFrameLinesCB.Check(rInf.IsCountInFlys());
+ aRestartEachPageCB.Check(rInf.IsRestartEachPage());
+
+ aNumberingOnCB.Check(rInf.IsPaintLineNumbers());
+
+ aNumberingOnCB.SetClickHdl(LINK(this, SwLineNumberingPage, LineOnOffHdl));
+ aDivisorED.SetModifyHdl(LINK(this, SwLineNumberingPage, ModifyHdl));
+ ModifyHdl();
+ LineOnOffHdl();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Modify
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwLineNumberingPage, ModifyHdl, Edit *, EMPTYARG )
+{
+ BOOL bHasValue = aDivisorED.GetText().Len() != 0;
+
+ aDivIntervalFT.Enable(bHasValue);
+ aDivIntervalNF.Enable(bHasValue);
+ aDivRowsFT.Enable(bHasValue);
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: On/Off
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwLineNumberingPage, LineOnOffHdl, CheckBox *, EMPTYARG )
+{
+ BOOL bEnable = aNumberingOnCB.IsChecked();
+
+ aCharStyleFT.Enable(bEnable);
+ aCharStyleLB.Enable(bEnable);
+ aFormatFT.Enable(bEnable);
+ aFormatLB.Enable(bEnable);
+ aPosFT.Enable(bEnable);
+ aPosLB.Enable(bEnable);
+ aOffsetFT.Enable(bEnable);
+ aOffsetMF.Enable(bEnable);
+ aNumIntervalFT.Enable(bEnable);
+ aNumIntervalNF.Enable(bEnable);
+ aNumRowsFT.Enable(bEnable);
+ aDisplayFL.Enable(bEnable);
+ aDivisorFT.Enable(bEnable);
+ aDivisorED.Enable(bEnable);
+ aDivIntervalFT.Enable(bEnable);
+ aDivIntervalNF.Enable(bEnable);
+ aDivRowsFT.Enable(bEnable);
+ aDivisorFL.Enable(bEnable);
+ aCountEmptyLinesCB.Enable(bEnable);
+ aCountFrameLinesCB.Enable(bEnable);
+ aRestartEachPageCB.Enable(bEnable);
+ aCountFL.Enable(bEnable);
+
+ return 0;
+}
+
+/*-----------------------------------------------------------------------
+ Beschreibung:
+ -----------------------------------------------------------------------*/
+
+BOOL __EXPORT SwLineNumberingPage::FillItemSet( SfxItemSet& )
+{
+ SwLineNumberInfo aInf(pSh->GetLineNumberInfo());
+
+ // Zeichenvorlagen
+ String sCharFmtName(aCharStyleLB.GetSelectEntry());
+ SwCharFmt *pCharFmt = pSh->FindCharFmtByName(sCharFmtName);
+
+ if (!pCharFmt)
+ {
+ SfxStyleSheetBasePool* pPool = pSh->GetView().GetDocShell()->GetStyleSheetPool();
+ SfxStyleSheetBase* pBase;
+ pBase = pPool->Find(sCharFmtName, SFX_STYLE_FAMILY_CHAR);
+ if(!pBase)
+ pBase = &pPool->Make(sCharFmtName, SFX_STYLE_FAMILY_CHAR);
+ pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
+ }
+
+ if (pCharFmt)
+ aInf.SetCharFmt(pCharFmt);
+
+ // Format
+ SvxNumberType aType;
+ aType.SetNumberingType(aFormatLB.GetSelectedNumberingType());
+ aInf.SetNumType(aType);
+
+ // Position
+ aInf.SetPos((LineNumberPosition)aPosLB.GetSelectEntryPos());
+
+ // Offset
+ aInf.SetPosFromLeft((USHORT)aOffsetMF.Denormalize(aOffsetMF.GetValue(FUNIT_TWIP)));
+
+ // Numerierungsoffset
+ aInf.SetCountBy((USHORT)aNumIntervalNF.GetValue());
+
+ // Teiler
+ aInf.SetDivider(aDivisorED.GetText());
+
+ // Teileroffset
+ aInf.SetDividerCountBy((USHORT)aDivIntervalNF.GetValue());
+
+ // Zaehlen
+ aInf.SetCountBlankLines(aCountEmptyLinesCB.IsChecked());
+ aInf.SetCountInFlys(aCountFrameLinesCB.IsChecked());
+ aInf.SetRestartEachPage(aRestartEachPageCB.IsChecked());
+
+ aInf.SetPaintLineNumbers(aNumberingOnCB.IsChecked());
+
+ pSh->SetLineNumberInfo(aInf);
+
+ return FALSE;
+}
+
+
diff --git a/sw/source/ui/misc/linenum.hrc b/sw/source/ui/misc/linenum.hrc
new file mode 100644
index 000000000000..235d13576aa3
--- /dev/null
+++ b/sw/source/ui/misc/linenum.hrc
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define CB_NUMBERING_ON 1
+#define FT_CHAR_STYLE 2
+#define LB_CHAR_STYLE 3
+#define FT_FORMAT 4
+#define LB_FORMAT 5
+#define FT_POS 6
+#define LB_POS 7
+#define FT_OFFSET 8
+#define MF_OFFSET 9
+#define FT_NUM_INVERVAL 10
+#define NF_NUM_INVERVAL 11
+#define FT_NUM_ROWS 12
+#define FL_DISPLAY 13
+#define FT_DIVISOR 14
+#define ED_DIVISOR 15
+#define FT_DIV_INTERVAL 16
+#define NF_DIV_INTERVAL 17
+#define FT_DIV_ROWS 18
+#define FL_DIVISOR 19
+#define CB_COUNT_EMPTYLINES 20
+#define CB_COUNT_FRAMELINES 21
+#define FL_COUNT 22
+#define CB_RESTART_PAGE 23
+
diff --git a/sw/source/ui/misc/linenum.src b/sw/source/ui/misc/linenum.src
new file mode 100644
index 000000000000..1b2db408c761
--- /dev/null
+++ b/sw/source/ui/misc/linenum.src
@@ -0,0 +1,279 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* StarView ressource file */
+
+#ifndef _SFX_HRC
+#include <sfx2/sfx.hrc>
+#endif
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#include "globals.hrc"
+#include "misc.hrc"
+#include "linenum.hrc"
+#include "helpid.h"
+/**************************************************************************/
+/* */
+/**************************************************************************/
+TabPage TP_LINENUMBERING
+{
+ HelpID = HID_LINENUMBERING ;
+ SVLook = TRUE ;
+ Hide = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ CheckBox CB_NUMBERING_ON
+ {
+ HelpID = "sw:CheckBox:TP_LINENUMBERING:CB_NUMBERING_ON";
+ Pos = MAP_APPFONT ( 12 , 6 ) ;
+ Size = MAP_APPFONT ( 242 , 8 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Show numbering" ;
+ };
+ FixedText FT_CHAR_STYLE
+ {
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "~Character Style" ;
+ };
+ ListBox LB_CHAR_STYLE
+ {
+ HelpID = "sw:ListBox:TP_LINENUMBERING:LB_CHAR_STYLE";
+ Pos = MAP_APPFONT ( 100 , 30 ) ;
+ Size = MAP_APPFONT ( 148 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_FORMAT
+ {
+ Pos = MAP_APPFONT ( 12 , 46 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "F~ormat" ;
+ };
+ ListBox LB_FORMAT
+ {
+ HelpID = "sw:ListBox:TP_LINENUMBERING:LB_FORMAT";
+ Pos = MAP_APPFONT ( 100 , 44 ) ;
+ Size = MAP_APPFONT ( 148 , 80 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_POS
+ {
+ Pos = MAP_APPFONT ( 12 , 62 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Position" ;
+ };
+ ListBox LB_POS
+ {
+ HelpID = "sw:ListBox:TP_LINENUMBERING:LB_POS";
+ Pos = MAP_APPFONT ( 100 , 60 ) ;
+ Size = MAP_APPFONT ( 148 , 60 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Left" ; > ;
+ < "Right" ; > ;
+ < "Inner" ; > ;
+ < "Outer" ; > ;
+ };
+ };
+ FixedText FT_OFFSET
+ {
+ Pos = MAP_APPFONT ( 12 , 78 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Spacing" ;
+ };
+ MetricField MF_OFFSET
+ {
+ HelpID = "sw:MetricField:TP_LINENUMBERING:MF_OFFSET";
+ Pos = MAP_APPFONT ( 100 , 76 ) ;
+ Size = MAP_APPFONT ( 45 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_NUM_INVERVAL
+ {
+ Pos = MAP_APPFONT ( 12 , 94 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Interval" ;
+ };
+ NumericField NF_NUM_INVERVAL
+ {
+ HelpID = "sw:NumericField:TP_LINENUMBERING:NF_NUM_INVERVAL";
+ Pos = MAP_APPFONT ( 100 , 92 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 1000 ;
+ First = 1 ;
+ Last = 1000 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_NUM_ROWS
+ {
+ Pos = MAP_APPFONT ( 136 , 94 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ Text [ en-US ] = "lines" ;
+ };
+ FixedLine FL_DISPLAY
+ {
+ Pos = MAP_APPFONT ( 6 , 17 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "View" ;
+ };
+ FixedText FT_DIVISOR
+ {
+ Pos = MAP_APPFONT ( 12 , 123 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ Text [ en-US ] = "Text" ;
+ };
+ Edit ED_DIVISOR
+ {
+ HelpID = "sw:Edit:TP_LINENUMBERING:ED_DIVISOR";
+ Pos = MAP_APPFONT ( 45 , 121 ) ;
+ Size = MAP_APPFONT ( 76 , 12 ) ;
+ Left = TRUE ;
+ Border = TRUE ;
+ };
+ FixedText FT_DIV_INTERVAL
+ {
+ Pos = MAP_APPFONT ( 12 , 139 ) ;
+ Size = MAP_APPFONT ( 30 , 8 ) ;
+ // Disable = TRUE ;
+ Text [ en-US ] = "Every" ;
+ };
+ NumericField NF_DIV_INTERVAL
+ {
+ HelpID = "sw:NumericField:TP_LINENUMBERING:NF_DIV_INTERVAL";
+ Pos = MAP_APPFONT ( 45 , 137 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 1000 ;
+ First = 0 ;
+ Last = 1000 ;
+ SpinSize = 1 ;
+ // Disable = TRUE ;
+ };
+ FixedText FT_DIV_ROWS
+ {
+ Pos = MAP_APPFONT ( 78 , 139 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "Lines" ;
+ };
+ FixedLine FL_DIVISOR
+ {
+ Pos = MAP_APPFONT ( 6 , 110 ) ;
+ Size = MAP_APPFONT ( 121 , 8 ) ;
+ Text [ en-US ] = "Separator" ;
+ };
+ CheckBox CB_COUNT_EMPTYLINES
+ {
+ HelpID = "sw:CheckBox:TP_LINENUMBERING:CB_COUNT_EMPTYLINES";
+ Pos = MAP_APPFONT ( 139 , 121 ) ;
+ Size = MAP_APPFONT ( 110 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Blank lines" ;
+ };
+ CheckBox CB_COUNT_FRAMELINES
+ {
+ HelpID = "sw:CheckBox:TP_LINENUMBERING:CB_COUNT_FRAMELINES";
+ Pos = MAP_APPFONT ( 139 , 135 ) ;
+ Size = MAP_APPFONT ( 110 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Lines in text frames" ;
+ };
+ CheckBox CB_RESTART_PAGE
+ {
+ HelpID = "sw:CheckBox:TP_LINENUMBERING:CB_RESTART_PAGE";
+ Pos = MAP_APPFONT ( 139 , 149 );
+ Size = MAP_APPFONT ( 110 , 10 );
+ TabStop = TRUE;
+ Text [ en-US ] = "~Restart every new page";
+ };
+ FixedLine FL_COUNT
+ {
+ Pos = MAP_APPFONT ( 133 , 110 ) ;
+ Size = MAP_APPFONT ( 121 , 8 ) ;
+ Text [ en-US ] = "Count" ;
+ };
+ Text [ en-US ] = "Line Numbering" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
new file mode 100644
index 000000000000..43c92a72a3f7
--- /dev/null
+++ b/sw/source/ui/misc/num.cxx
@@ -0,0 +1,1173 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#define USE_NUMTABPAGES
+#define _NUM_CXX
+#include <hintids.hxx>
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <tools/urlobj.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/imgmgr.hxx>
+#include <svx/gallery.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/numitem.hxx>
+#include <swvset.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#ifndef _WVIEW_HXX
+#include <wview.hxx>
+#endif
+#include <uitool.hxx>
+#ifndef _WDOCSH_HXX
+#include <wdocsh.hxx>
+#endif
+#include <uiitems.hxx>
+#include <docstyle.hxx>
+#include <charfmt.hxx>
+#include <uinums.hxx>
+#include <poolfmt.hxx>
+#include <shellres.hxx>
+#include <outline.hxx>
+#include <num.hxx>
+#include <viewopt.hxx>
+#include <frmmgr.hxx>
+
+#ifndef _MISC_HRC
+#include <misc.hrc>
+#endif
+#ifndef _FRMUI_HRC
+#include <frmui.hrc>
+#endif
+#ifndef _NUM_HRC
+#include <num.hrc>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#include <SwStyleNameMapper.hxx>
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include <svl/stritem.hxx>
+#include <svl/aeitem.hxx>
+#include <svl/slstitm.hxx>
+
+static BOOL bLastRelative = FALSE;
+
+/*-----------------03.12.97 10:02-------------------
+
+--------------------------------------------------*/
+SwNumPositionTabPage::SwNumPositionTabPage(Window* pParent,
+ const SfxItemSet& rSet) :
+ SfxTabPage( pParent, SW_RES( TP_NUM_POSITION ), rSet ),
+ aPositionFL( this, SW_RES(FL_POSITION )),
+ aLevelFL( this, SW_RES(FL_LEVEL )),
+ aLevelLB( this, SW_RES(LB_LEVEL )),
+
+ aDistBorderFT( this, SW_RES(FT_BORDERDIST )),
+ aDistBorderMF( this, SW_RES(MF_BORDERDIST )),
+ aRelativeCB( this, SW_RES(CB_RELATIVE )),
+ aIndentFT( this, SW_RES(FT_INDENT )),
+ aIndentMF( this, SW_RES(MF_INDENT )),
+ aDistNumFT( this, SW_RES(FT_NUMDIST )),
+ aDistNumMF( this, SW_RES(MF_NUMDIST )),
+ aAlignFT( this, SW_RES(FT_ALIGN )),
+ aAlignLB( this, SW_RES(LB_ALIGN )),
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ aLabelFollowedByFT( this, SW_RES(FT_LABEL_FOLLOWED_BY) ),
+ aLabelFollowedByLB( this, SW_RES(LB_LABEL_FOLLOWED_BY) ),
+ aListtabFT( this, SW_RES(FT_LISTTAB) ),
+ aListtabMF( this, SW_RES(MF_LISTTAB) ),
+ aAlign2FT( this, SW_RES(FT_ALIGN_2) ),
+ aAlign2LB( this, SW_RES(LB_ALIGN_2) ),
+ aAlignedAtFT( this, SW_RES(FT_ALIGNED_AT) ),
+ aAlignedAtMF( this, SW_RES(MF_ALIGNED_AT) ),
+ aIndentAtFT( this, SW_RES(FT_INDENT_AT) ),
+ aIndentAtMF( this, SW_RES(MF_INDENT_AT) ),
+ // <--
+ aStandardPB( this, SW_RES(PB_STANDARD )),
+
+ aPreviewWIN( this, SW_RES(WIN_PREVIEW )),
+
+ pActNum(0),
+ pSaveNum(0),
+ pWrtSh(0),
+ pOutlineDlg(0),
+ bPreset( FALSE ),
+ bInInintControl(FALSE),
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ bLabelAlignmentPosAndSpaceModeActive( false )
+ // <--
+{
+ FreeResource();
+ SetExchangeSupport();
+ aPreviewWIN.SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
+
+ aRelativeCB.Check();
+ aAlignLB.SetSelectHdl(LINK(this, SwNumPositionTabPage, EditModifyHdl));
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ aAlign2LB.SetSelectHdl(LINK(this, SwNumPositionTabPage, EditModifyHdl));
+ for ( USHORT i = 0; i < aAlignLB.GetEntryCount(); ++i )
+ {
+ aAlign2LB.InsertEntry( aAlignLB.GetEntry( i ) );
+ }
+ aAlign2LB.SetDropDownLineCount( aAlign2LB.GetEntryCount() );
+ aAlign2FT.SetText( aAlignFT.GetText() );
+ // <--
+
+ Link aLk = LINK(this, SwNumPositionTabPage, DistanceHdl);
+ aDistBorderMF.SetUpHdl(aLk);
+ aDistNumMF.SetUpHdl(aLk);
+ aIndentMF.SetUpHdl(aLk);
+ aDistBorderMF.SetDownHdl(aLk);
+ aDistNumMF.SetDownHdl(aLk);
+ aIndentMF.SetDownHdl(aLk);
+ aDistBorderMF.SetLoseFocusHdl(aLk);
+ aDistNumMF.SetLoseFocusHdl(aLk);
+ aIndentMF.SetLoseFocusHdl(aLk);
+
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ aLabelFollowedByLB.SetDropDownLineCount( aLabelFollowedByLB.GetEntryCount() );
+ aLabelFollowedByLB.SetSelectHdl( LINK(this, SwNumPositionTabPage, LabelFollowedByHdl_Impl) );
+
+ aLk = LINK(this, SwNumPositionTabPage, ListtabPosHdl_Impl);
+ aListtabMF.SetUpHdl(aLk);
+ aListtabMF.SetDownHdl(aLk);
+ aListtabMF.SetLoseFocusHdl(aLk);
+
+ aLk = LINK(this, SwNumPositionTabPage, AlignAtHdl_Impl);
+ aAlignedAtMF.SetUpHdl(aLk);
+ aAlignedAtMF.SetDownHdl(aLk);
+ aAlignedAtMF.SetLoseFocusHdl(aLk);
+
+ aLk = LINK(this, SwNumPositionTabPage, IndentAtHdl_Impl);
+ aIndentAtMF.SetUpHdl(aLk);
+ aIndentAtMF.SetDownHdl(aLk);
+ aIndentAtMF.SetLoseFocusHdl(aLk);
+ // <--
+
+ aLevelLB.SetSelectHdl(LINK(this, SwNumPositionTabPage, LevelHdl));
+ aRelativeCB.SetClickHdl(LINK(this, SwNumPositionTabPage, RelativeHdl));
+ aStandardPB.SetClickHdl(LINK(this, SwNumPositionTabPage, StandardHdl));
+
+ // Ebenen einfuegen
+ for(USHORT i = 1; i <= MAXLEVEL; i++)
+ aLevelLB.InsertEntry(String::CreateFromInt32(i));
+ String sEntry(String::CreateFromAscii("1 - "));
+ sEntry += String::CreateFromInt32(MAXLEVEL);
+ aLevelLB.InsertEntry(sEntry);
+ aLevelLB.SelectEntry(sEntry);
+
+ aRelativeCB.Check(bLastRelative);
+ aPreviewWIN.SetPositionMode();
+}
+/*-----------------03.12.97 10:02-------------------
+
+--------------------------------------------------*/
+SwNumPositionTabPage::~SwNumPositionTabPage()
+{
+ delete pActNum;
+}
+/*-----------------03.12.97 10:06-------------------
+
+--------------------------------------------------*/
+void SwNumPositionTabPage::InitControls()
+{
+ bInInintControl = TRUE;
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ const bool bRelative = !bLabelAlignmentPosAndSpaceModeActive &&
+ aRelativeCB.IsEnabled() && aRelativeCB.IsChecked();
+ const bool bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 &&
+ USHRT_MAX != nActNumLvl;
+
+ aDistBorderMF.Enable( !bLabelAlignmentPosAndSpaceModeActive &&
+ ( bSingleSelection || bRelative || pOutlineDlg != 0 ) );
+ aDistBorderFT.Enable( !bLabelAlignmentPosAndSpaceModeActive &&
+ ( bSingleSelection || bRelative || pOutlineDlg != 0 ) );
+ // <--
+
+ bool bSetDistEmpty = false;
+ bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive;
+ bool bSameDist = !bLabelAlignmentPosAndSpaceModeActive;
+ bool bSameIndent = !bLabelAlignmentPosAndSpaceModeActive;
+ bool bSameAdjust = true;
+
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ bool bSameLabelFollowedBy = bLabelAlignmentPosAndSpaceModeActive;
+ bool bSameListtab = bLabelAlignmentPosAndSpaceModeActive;
+ bool bSameAlignAt = bLabelAlignmentPosAndSpaceModeActive;
+ bool bSameIndentAt = bLabelAlignmentPosAndSpaceModeActive;
+ // <--
+
+ const SwNumFmt* aNumFmtArr[MAXLEVEL];
+ const SwFmtVertOrient* pFirstOrient = 0;
+ USHORT nMask = 1;
+ USHORT nLvl = USHRT_MAX;
+ long nFirstBorderText = 0;
+ long nFirstBorderTextRelative = -1;
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ {
+ aNumFmtArr[i] = &pActNum->Get(i);
+ if(nActNumLvl & nMask)
+ {
+ if(USHRT_MAX == nLvl)
+ {
+ nLvl = i;
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ if ( !bLabelAlignmentPosAndSpaceModeActive )
+ {
+ pFirstOrient = aNumFmtArr[nLvl]->GetGraphicOrientation();
+ nFirstBorderText = nLvl > 0 ?
+ aNumFmtArr[nLvl]->GetAbsLSpace() + aNumFmtArr[nLvl]->GetFirstLineOffset() -
+ aNumFmtArr[nLvl - 1]->GetAbsLSpace() + aNumFmtArr[nLvl - 1]->GetFirstLineOffset():
+ aNumFmtArr[nLvl]->GetAbsLSpace() + aNumFmtArr[nLvl]->GetFirstLineOffset();
+ }
+ // <--
+ }
+
+ if( i > nLvl)
+ {
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust();
+ if ( !bLabelAlignmentPosAndSpaceModeActive )
+ {
+ if(bRelative)
+ {
+ if(nFirstBorderTextRelative == -1)
+ nFirstBorderTextRelative =
+ (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
+ aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
+ else
+ bSameDistBorderNum &= nFirstBorderTextRelative ==
+ (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
+ aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
+
+ }
+ else
+ {
+ bSameDistBorderNum &=
+ aNumFmtArr[i]->GetAbsLSpace() - aNumFmtArr[i]->GetFirstLineOffset() ==
+ aNumFmtArr[i - 1]->GetAbsLSpace() - aNumFmtArr[i - 1]->GetFirstLineOffset();
+ }
+
+ bSameDist &= aNumFmtArr[i]->GetCharTextDistance() == aNumFmtArr[nLvl]->GetCharTextDistance();
+ bSameIndent &= aNumFmtArr[i]->GetFirstLineOffset() == aNumFmtArr[nLvl]->GetFirstLineOffset();
+ }
+ else
+ {
+ bSameLabelFollowedBy &=
+ aNumFmtArr[i]->GetLabelFollowedBy() == aNumFmtArr[nLvl]->GetLabelFollowedBy();
+ bSameListtab &=
+ aNumFmtArr[i]->GetListtabPos() == aNumFmtArr[nLvl]->GetListtabPos();
+ bSameAlignAt &=
+ ( ( aNumFmtArr[i]->GetIndentAt() + aNumFmtArr[i]->GetFirstLineIndent() )
+ == ( aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent() ) );
+ bSameIndentAt &=
+ aNumFmtArr[i]->GetIndentAt() == aNumFmtArr[nLvl]->GetIndentAt();
+ }
+ // <--
+
+ }
+ }
+ nMask <<= 1;
+
+ }
+ if(bSameDistBorderNum)
+ {
+ long nDistBorderNum;
+ if(bRelative)
+ {
+ nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset();
+ if(nLvl)
+ nDistBorderNum -= (long)aNumFmtArr[nLvl - 1]->GetAbsLSpace()+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset();
+ }
+ else
+ {
+ nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset();
+ }
+ aDistBorderMF.SetValue(aDistBorderMF.Normalize(nDistBorderNum),FUNIT_TWIP);
+ }
+ else
+ bSetDistEmpty = TRUE;
+
+ if(bSameDist)
+ aDistNumMF .SetValue(aDistNumMF.Normalize(aNumFmtArr[nLvl]->GetCharTextDistance()), FUNIT_TWIP);
+ else
+ aDistNumMF.SetText(aEmptyStr);
+ if(bSameIndent)
+ aIndentMF.SetValue(aIndentMF.Normalize(-aNumFmtArr[nLvl]->GetFirstLineOffset()), FUNIT_TWIP);
+ else
+ aIndentMF.SetText(aEmptyStr);
+
+ if(bSameAdjust)
+ {
+ USHORT nPos = 1; // zentriert
+ if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT)
+ nPos = 0;
+ else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT)
+ nPos = 2;
+ aAlignLB.SelectEntryPos(nPos);
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ aAlign2LB.SelectEntryPos( nPos );
+ // <--
+ }
+ else
+ {
+ aAlignLB.SetNoSelection();
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ aAlign2LB.SetNoSelection();
+ // <--
+ }
+
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ if ( bSameLabelFollowedBy )
+ {
+ USHORT nPos = 0; // LISTTAB
+ if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::SPACE )
+ {
+ nPos = 1;
+ }
+ else if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::NOTHING )
+ {
+ nPos = 2;
+ }
+ aLabelFollowedByLB.SelectEntryPos( nPos );
+ }
+ else
+ {
+ aLabelFollowedByLB.SetNoSelection();
+ }
+
+ if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
+ {
+ aListtabFT.Enable( true );
+ aListtabMF.Enable( true );
+ if ( bSameListtab )
+ {
+ aListtabMF.SetValue(aListtabMF.Normalize(aNumFmtArr[nLvl]->GetListtabPos()),FUNIT_TWIP);
+ }
+ else
+ {
+ aListtabMF.SetText(aEmptyStr);
+ }
+ }
+ else
+ {
+ aListtabFT.Enable( false );
+ aListtabMF.Enable( false );
+ aListtabMF.SetText(aEmptyStr);
+ }
+
+ if ( bSameAlignAt )
+ {
+ aAlignedAtMF.SetValue(
+ aAlignedAtMF.Normalize( aNumFmtArr[nLvl]->GetIndentAt() +
+ aNumFmtArr[nLvl]->GetFirstLineIndent()),
+ FUNIT_TWIP );
+ }
+ else
+ {
+ aAlignedAtMF.SetText(aEmptyStr);
+ }
+
+ if ( bSameIndentAt )
+ {
+ aIndentAtMF.SetValue(
+ aIndentAtMF.Normalize( aNumFmtArr[nLvl]->GetIndentAt()), FUNIT_TWIP );
+ }
+ else
+ {
+ aIndentAtMF.SetText(aEmptyStr);
+ }
+ // <--
+
+ if(TRUE == bSetDistEmpty)
+ aDistBorderMF.SetText(aEmptyStr);
+
+ bInInintControl = FALSE;
+}
+
+/*-----------------03.12.97 10:02-------------------
+
+--------------------------------------------------*/
+void SwNumPositionTabPage::ActivatePage(const SfxItemSet& )
+{
+ const SfxPoolItem* pItem;
+ UINT16 nTmpNumLvl =
+ pOutlineDlg ? pOutlineDlg->GetActNumLevel() : 0;
+ const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
+ if(pExampleSet && pExampleSet->GetItemState(FN_PARAM_NUM_PRESET, FALSE, &pItem))
+ {
+ bPreset = ((const SfxBoolItem*)pItem)->GetValue();
+ }
+ //
+ bModified = (!pActNum->GetNumFmt( 0 ) || bPreset);
+ if(*pActNum != *pSaveNum ||
+ nActNumLvl != nTmpNumLvl )
+ {
+ *pActNum = *pSaveNum;
+ nActNumLvl = nTmpNumLvl;
+ USHORT nMask = 1;
+ aLevelLB.SetUpdateMode(FALSE);
+ aLevelLB.SetNoSelection();
+ aLevelLB.SelectEntryPos( MAXLEVEL, nActNumLvl == USHRT_MAX);
+ if(nActNumLvl != USHRT_MAX)
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ {
+ if(nActNumLvl & nMask)
+ aLevelLB.SelectEntryPos( i, TRUE);
+ nMask <<= 1 ;
+ }
+ aLevelLB.SetUpdateMode(TRUE);
+
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ InitPosAndSpaceMode();
+ ShowControlsDependingOnPosAndSpaceMode();
+ // <--
+
+ InitControls();
+ }
+ aRelativeCB.Enable(1 != nActNumLvl);
+ aPreviewWIN.Invalidate();
+}
+
+/*-----------------03.12.97 10:02-------------------
+
+--------------------------------------------------*/
+int SwNumPositionTabPage::DeactivatePage(SfxItemSet *_pSet)
+{
+ SwOutlineTabDialog::SetActNumLevel(nActNumLvl);
+ if(_pSet)
+ FillItemSet(*_pSet);
+ return TRUE;
+
+}
+
+/*-----------------03.12.97 10:02-------------------
+
+--------------------------------------------------*/
+BOOL SwNumPositionTabPage::FillItemSet( SfxItemSet& rSet )
+{
+ if(pOutlineDlg)
+ *pOutlineDlg->GetNumRule() = *pActNum;
+ else if(bModified && pActNum)
+ {
+ *pSaveNum = *pActNum;
+ rSet.Put(SwUINumRuleItem( *pSaveNum ));
+ rSet.Put(SfxBoolItem(FN_PARAM_NUM_PRESET, FALSE));
+ }
+ return bModified;
+}
+
+/*-----------------03.12.97 10:02-------------------
+
+--------------------------------------------------*/
+void SwNumPositionTabPage::Reset( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem;
+ if(pOutlineDlg)
+ {
+ pSaveNum = pOutlineDlg->GetNumRule();
+ aLevelLB.EnableMultiSelection(FALSE);
+ }
+ else if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_ACT_NUMBER, FALSE, &pItem))
+ pSaveNum = ((SwUINumRuleItem*)pItem)->GetNumRule();
+
+ nActNumLvl = SwOutlineTabDialog::GetActNumLevel();
+ USHORT nMask = 1;
+ aLevelLB.SetUpdateMode(FALSE);
+ aLevelLB.SetNoSelection();
+ if(nActNumLvl == USHRT_MAX)
+ {
+ aLevelLB.SelectEntryPos( MAXLEVEL, TRUE);
+ }
+ else
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ {
+ if(nActNumLvl & nMask)
+ aLevelLB.SelectEntryPos( i, TRUE);
+ nMask <<= 1;
+ }
+ aLevelLB.SetUpdateMode(TRUE);
+
+ if(!pActNum)
+ pActNum = new SwNumRule(*pSaveNum);
+ else if(*pSaveNum != *pActNum)
+ *pActNum = *pSaveNum;
+ aPreviewWIN.SetNumRule(pActNum);
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ InitPosAndSpaceMode();
+ ShowControlsDependingOnPosAndSpaceMode();
+ // <--
+ InitControls();
+ bModified = FALSE;
+}
+
+// --> OD 2008-01-11 #newlistlevelattrs#
+void SwNumPositionTabPage::InitPosAndSpaceMode()
+{
+ if ( pActNum == 0 )
+ {
+ DBG_ASSERT( false,
+ "<SwNumPositionTabPage::InitPosAndSpaceMode()> - misusage of method -> <pAktNum> has to be already set!" );
+ return;
+ }
+
+ SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode =
+ SvxNumberFormat::LABEL_ALIGNMENT;
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < MAXLEVEL; ++i )
+ {
+ if(nActNumLvl & nMask)
+ {
+ SvxNumberFormat aNumFmt( pActNum->Get(i) );
+ ePosAndSpaceMode = aNumFmt.GetPositionAndSpaceMode();
+ if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ break;
+ }
+ }
+ nMask <<= 1;
+ }
+
+ bLabelAlignmentPosAndSpaceModeActive =
+ ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT;
+}
+
+void SwNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode()
+{
+ aDistBorderFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
+ aDistBorderMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
+ aRelativeCB.Show( !bLabelAlignmentPosAndSpaceModeActive );
+ aIndentFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
+ aIndentMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
+ aDistNumFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
+ aDistNumMF.Show( !bLabelAlignmentPosAndSpaceModeActive );
+ aAlignFT.Show( !bLabelAlignmentPosAndSpaceModeActive );
+ aAlignLB.Show( !bLabelAlignmentPosAndSpaceModeActive );
+
+ aLabelFollowedByFT.Show( bLabelAlignmentPosAndSpaceModeActive );
+ aLabelFollowedByLB.Show( bLabelAlignmentPosAndSpaceModeActive );
+ aListtabFT.Show( bLabelAlignmentPosAndSpaceModeActive );
+ aListtabMF.Show( bLabelAlignmentPosAndSpaceModeActive );
+ aAlign2FT.Show( bLabelAlignmentPosAndSpaceModeActive );
+ aAlign2LB.Show( bLabelAlignmentPosAndSpaceModeActive );
+ aAlignedAtFT.Show( bLabelAlignmentPosAndSpaceModeActive );
+ aAlignedAtMF.Show( bLabelAlignmentPosAndSpaceModeActive );
+ aIndentAtFT.Show( bLabelAlignmentPosAndSpaceModeActive );
+ aIndentAtMF.Show( bLabelAlignmentPosAndSpaceModeActive );
+}
+// <--
+
+/*-----------------03.12.97 10:02-------------------
+
+--------------------------------------------------*/
+SfxTabPage* SwNumPositionTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SwNumPositionTabPage(pParent, rAttrSet);
+}
+
+/*-----------------04.12.97 12:51-------------------
+
+--------------------------------------------------*/
+void SwNumPositionTabPage::SetWrtShell(SwWrtShell* pSh)
+{
+ pWrtSh = pSh;
+
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ const SwTwips nWidth = pWrtSh->GetAnyCurRect(RECT_FRM).Width();
+
+ aDistBorderMF.SetMax(aDistBorderMF.Normalize( nWidth ), FUNIT_TWIP );
+ aDistNumMF .SetMax(aDistNumMF .Normalize( nWidth ), FUNIT_TWIP );
+ aIndentMF .SetMax(aIndentMF .Normalize( nWidth ), FUNIT_TWIP );
+ // --> OD 2008-02-18 #newlistlevelattrs#
+ aListtabMF.SetMax(aListtabMF.Normalize( nWidth ), FUNIT_TWIP );
+ aAlignedAtMF.SetMax(aAlignedAtMF.Normalize( nWidth ), FUNIT_TWIP );
+ aIndentAtMF.SetMax(aIndentAtMF.Normalize( nWidth ), FUNIT_TWIP );
+ // <--
+ const SwTwips nLast2 = nWidth /2;
+ aDistBorderMF.SetLast( aDistBorderMF.Normalize( nLast2 ), FUNIT_TWIP );
+ aDistNumMF .SetLast( aDistNumMF .Normalize( nLast2 ), FUNIT_TWIP );
+ aIndentMF .SetLast( aIndentMF .Normalize( nLast2 ), FUNIT_TWIP );
+ // --> OD 2008-02-18 #newlistlevelattrs#
+ aListtabMF.SetLast(aListtabMF.Normalize( nLast2 ), FUNIT_TWIP );
+ aAlignedAtMF.SetLast(aAlignedAtMF.Normalize( nLast2 ), FUNIT_TWIP );
+ aIndentAtMF.SetLast(aIndentAtMF.Normalize( nLast2 ), FUNIT_TWIP );
+ // <--
+ // <--
+
+ const SwRect& rPrtRect = pWrtSh->GetAnyCurRect(RECT_PAGE);
+ aPreviewWIN.SetPageWidth(rPrtRect.Width());
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &pWrtSh->GetView()));
+ if(eMetric == FUNIT_MM)
+ {
+ aDistBorderMF .SetDecimalDigits(1);
+ aDistNumMF .SetDecimalDigits(1);
+ aIndentMF .SetDecimalDigits(1);
+ // --> OD 2008-02-18 #newlistlevelattrs#
+ aListtabMF.SetDecimalDigits(1);
+ aAlignedAtMF.SetDecimalDigits(1);
+ aIndentAtMF.SetDecimalDigits(1);
+ // <--
+ }
+ aDistBorderMF .SetUnit( eMetric );
+ aDistNumMF .SetUnit( eMetric );
+ aIndentMF .SetUnit( eMetric );
+ // --> OD 2008-02-18 #newlistlevelattrs#
+ aListtabMF.SetUnit( eMetric );
+ aAlignedAtMF.SetUnit( eMetric );
+ aIndentAtMF.SetUnit( eMetric );
+ // <--
+}
+
+/*-----------------03.12.97 11:06-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwNumPositionTabPage, EditModifyHdl, Edit *, EMPTYARG )
+{
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SwNumFmt aNumFmt(pActNum->Get(i));
+
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ const USHORT nPos = aAlignLB.IsVisible()
+ ? aAlignLB.GetSelectEntryPos()
+ : aAlign2LB.GetSelectEntryPos();
+ // <--
+ SvxAdjust eAdjust = SVX_ADJUST_CENTER;
+ if(nPos == 0)
+ eAdjust = SVX_ADJUST_LEFT;
+ else if(nPos == 2)
+ eAdjust = SVX_ADJUST_RIGHT;
+ aNumFmt.SetNumAdjust( eAdjust );
+ pActNum->Set(i, aNumFmt);
+ }
+ nMask <<= 1;
+ }
+ SetModified();
+ return 0;
+}
+/*-----------------03.12.97 11:11-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwNumPositionTabPage, LevelHdl, ListBox *, pBox )
+{
+ USHORT nSaveNumLvl = nActNumLvl;
+ nActNumLvl = 0;
+ if(pBox->IsEntryPosSelected( MAXLEVEL ) &&
+ (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff))
+ {
+ nActNumLvl = 0xFFFF;
+ pBox->SetUpdateMode(FALSE);
+ for( USHORT i = 0; i < MAXLEVEL; i++ )
+ pBox->SelectEntryPos( i, FALSE );
+ pBox->SetUpdateMode(TRUE);
+ }
+ else if(pBox->GetSelectEntryCount())
+ {
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < MAXLEVEL; i++ )
+ {
+ if(pBox->IsEntryPosSelected( i ))
+ nActNumLvl |= nMask;
+ nMask <<= 1;
+ }
+ pBox->SelectEntryPos( MAXLEVEL, FALSE );
+ }
+ else
+ {
+ nActNumLvl = nSaveNumLvl;
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < MAXLEVEL; i++ )
+ {
+ if(nActNumLvl & nMask)
+ {
+ pBox->SelectEntryPos(i);
+ break;
+ }
+ nMask <<=1;
+ }
+ }
+ aRelativeCB.Enable(1 != nActNumLvl);
+ SetModified();
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ InitPosAndSpaceMode();
+ ShowControlsDependingOnPosAndSpaceMode();
+ // <--
+ InitControls();
+ return 0;
+}
+/*-----------------03.12.97 12:24-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwNumPositionTabPage, DistanceHdl, MetricField *, pFld )
+{
+ if(bInInintControl)
+ return 0;
+ long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SwNumFmt aNumFmt( pActNum->Get( i ) );
+ if(pFld == &aDistBorderMF)
+ {
+
+ if(aRelativeCB.IsChecked() && aRelativeCB.IsEnabled())
+ {
+ if(0 == i)
+ {
+ long nTmp = aNumFmt.GetFirstLineOffset();
+ aNumFmt.SetAbsLSpace( USHORT(nValue - nTmp));
+ }
+ else
+ {
+ long nTmp = pActNum->Get( i - 1 ).GetAbsLSpace() +
+ pActNum->Get( i - 1 ).GetFirstLineOffset() -
+ pActNum->Get( i ).GetFirstLineOffset();
+
+ aNumFmt.SetAbsLSpace( USHORT(nValue + nTmp));
+ }
+ }
+ else
+ {
+ aNumFmt.SetAbsLSpace( (short)nValue - aNumFmt.GetFirstLineOffset());
+ }
+ }
+ else if(pFld == &aDistNumMF)
+ {
+ aNumFmt.SetCharTextDistance( (short)nValue );
+ }
+ else if(pFld == &aIndentMF)
+ {
+ //jetzt muss mit dem FirstLineOffset auch der AbsLSpace veraendert werden
+ long nDiff = nValue + aNumFmt.GetFirstLineOffset();
+ long nAbsLSpace = aNumFmt.GetAbsLSpace();
+ aNumFmt.SetAbsLSpace(USHORT(nAbsLSpace + nDiff));
+ aNumFmt.SetFirstLineOffset( -(short)nValue );
+ }
+
+ pActNum->Set( i, aNumFmt );
+ }
+ nMask <<= 1;
+ }
+
+ SetModified();
+ if(!aDistBorderMF.IsEnabled())
+ aDistBorderMF.SetText(aEmptyStr);
+
+ return 0;
+}
+
+/*-----------------04.12.97 12:35-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwNumPositionTabPage, RelativeHdl, CheckBox *, pBox )
+{
+ BOOL bOn = pBox->IsChecked();
+ BOOL bSingleSelection = aLevelLB.GetSelectEntryCount() == 1 && USHRT_MAX != nActNumLvl;
+ BOOL bSetValue = FALSE;
+ long nValue = 0;
+ if(bOn || bSingleSelection)
+ {
+ USHORT nMask = 1;
+ BOOL bFirst = TRUE;
+ bSetValue = TRUE;
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ const SwNumFmt &rNumFmt = pActNum->Get(i);
+ if(bFirst)
+ {
+ nValue = rNumFmt.GetAbsLSpace();
+ if(bOn && i)
+ nValue -= pActNum->Get(i - 1).GetAbsLSpace();
+ }
+ else
+ bSetValue = nValue == rNumFmt.GetAbsLSpace() - pActNum->Get(i - 1).GetAbsLSpace();
+ bFirst = FALSE;
+ }
+ nMask <<= 1;
+ }
+
+ }
+ if(bSetValue)
+ aDistBorderMF.SetValue(aDistBorderMF.Normalize(nValue), FUNIT_TWIP);
+ else
+ aDistBorderMF.SetText(aEmptyStr);
+ aDistBorderMF.Enable(bOn || bSingleSelection||0 != pOutlineDlg);
+ bLastRelative = bOn;
+ return 0;
+}
+
+// --> OD 2008-02-01 #newlistlevelattrs#
+IMPL_LINK( SwNumPositionTabPage, LabelFollowedByHdl_Impl, ListBox*, EMPTYARG )
+{
+ // determine value to be set at the chosen list levels
+ SvxNumberFormat::SvxNumLabelFollowedBy eLabelFollowedBy =
+ SvxNumberFormat::LISTTAB;
+ {
+ const USHORT nPos = aLabelFollowedByLB.GetSelectEntryPos();
+ if ( nPos == 1 )
+ {
+ eLabelFollowedBy = SvxNumberFormat::SPACE;
+ }
+ else if ( nPos == 2 )
+ {
+ eLabelFollowedBy = SvxNumberFormat::NOTHING;
+ }
+ }
+
+ // set value at the chosen list levels
+ bool bSameListtabPos = true;
+ USHORT nFirstLvl = USHRT_MAX;
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < MAXLEVEL; ++i )
+ {
+ if ( nActNumLvl & nMask )
+ {
+ SwNumFmt aNumFmt( pActNum->Get(i) );
+ aNumFmt.SetLabelFollowedBy( eLabelFollowedBy );
+ pActNum->Set( i, aNumFmt );
+
+ if ( nFirstLvl == USHRT_MAX )
+ {
+ nFirstLvl = i;
+ }
+ else
+ {
+ bSameListtabPos &= aNumFmt.GetListtabPos() ==
+ pActNum->Get( nFirstLvl ).GetListtabPos();
+ }
+ }
+ nMask <<= 1;
+ }
+
+ // enable/disable metric field for list tab stop position depending on
+ // selected item following the list label.
+ aListtabFT.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
+ aListtabMF.Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
+ if ( bSameListtabPos && eLabelFollowedBy == SvxNumberFormat::LISTTAB )
+ {
+ aListtabMF.SetValue(
+ aListtabMF.Normalize( pActNum->Get( nFirstLvl ).GetListtabPos() ),
+ FUNIT_TWIP );
+ }
+ else
+ {
+ aListtabMF.SetText( String() );
+ }
+
+ SetModified();
+
+ return 0;
+}
+// <--
+
+// --> OD 2008-02-01 #newlistlevelattrs#
+IMPL_LINK( SwNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pFld )
+{
+ // determine value to be set at the chosen list levels
+ const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
+
+ // set value at the chosen list levels
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < MAXLEVEL; ++i )
+ {
+ if ( nActNumLvl & nMask )
+ {
+ SwNumFmt aNumFmt( pActNum->Get(i) );
+ aNumFmt.SetListtabPos( nValue );
+ pActNum->Set( i, aNumFmt );
+ }
+ nMask <<= 1;
+ }
+
+ SetModified();
+
+ return 0;
+}
+// <--
+
+// --> OD 2008-02-01 #newlistlevelattrs#
+IMPL_LINK( SwNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pFld )
+{
+ // determine value to be set at the chosen list levels
+ const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
+
+ // set value at the chosen list levels
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < MAXLEVEL; ++i )
+ {
+ if ( nActNumLvl & nMask )
+ {
+ SwNumFmt aNumFmt( pActNum->Get(i) );
+ const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt();
+ aNumFmt.SetFirstLineIndent( nFirstLineIndent );
+ pActNum->Set( i, aNumFmt );
+ }
+ nMask <<= 1;
+ }
+
+ SetModified();
+
+ return 0;
+}
+// <--
+
+// --> OD 2008-02-01 #newlistlevelattrs#
+IMPL_LINK( SwNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pFld )
+{
+ // determine value to be set at the chosen list levels
+ const long nValue = static_cast< long >(pFld->Denormalize(pFld->GetValue(FUNIT_TWIP)));
+
+ // set value at the chosen list levels
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < MAXLEVEL; ++i )
+ {
+ if ( nActNumLvl & nMask )
+ {
+ SwNumFmt aNumFmt( pActNum->Get(i) );
+ const long nAlignedAt = aNumFmt.GetIndentAt() +
+ aNumFmt.GetFirstLineIndent();
+ aNumFmt.SetIndentAt( nValue );
+ const long nNewFirstLineIndent = nAlignedAt - nValue;
+ aNumFmt.SetFirstLineIndent( nNewFirstLineIndent );
+ pActNum->Set( i, aNumFmt );
+ }
+ nMask <<= 1;
+ }
+
+ SetModified();
+
+ return 0;
+}
+// <--
+
+/*-----------------05.12.97 15:33-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwNumPositionTabPage, StandardHdl, PushButton *, EMPTYARG )
+{
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ {
+ if(nActNumLvl & nMask)
+ {
+ SwNumFmt aNumFmt( pActNum->Get( i ) );
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ SwNumRule aTmpNumRule( pWrtSh->GetUniqueNumRuleName(),
+ aNumFmt.GetPositionAndSpaceMode(),
+ pOutlineDlg ? OUTLINE_RULE : NUM_RULE );
+ // <--
+ SwNumFmt aTempFmt(aTmpNumRule.Get( i ));
+ // --> OD 2008-02-05 #newlistlevelattrs#
+ aNumFmt.SetPositionAndSpaceMode( aTempFmt.GetPositionAndSpaceMode() );
+ if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ aNumFmt.SetAbsLSpace( aTempFmt.GetAbsLSpace());
+ aNumFmt.SetCharTextDistance( aTempFmt.GetCharTextDistance() );
+ aNumFmt.SetFirstLineOffset( aTempFmt.GetFirstLineOffset() );
+ }
+ else if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ aNumFmt.SetNumAdjust( aTempFmt.GetNumAdjust() );
+ aNumFmt.SetLabelFollowedBy( aTempFmt.GetLabelFollowedBy() );
+ aNumFmt.SetListtabPos( aTempFmt.GetListtabPos() );
+ aNumFmt.SetFirstLineIndent( aTempFmt.GetFirstLineIndent() );
+ aNumFmt.SetIndentAt( aTempFmt.GetIndentAt() );
+ }
+ // <--
+
+ pActNum->Set( i, aNumFmt );
+ }
+ nMask <<= 1;
+ }
+
+ InitControls();
+ SetModified();
+ return 0;
+}
+
+#if OSL_DEBUG_LEVEL > 1
+void SwNumPositionTabPage::SetModified(BOOL bRepaint)
+{
+ bModified = TRUE;
+ if(bRepaint)
+ {
+ aPreviewWIN.SetLevel(nActNumLvl);
+ aPreviewWIN.Invalidate();
+ }
+}
+
+#endif
+
+/**************************************************************************/
+/* */
+/* */
+/**************************************************************************/
+
+
+SwSvxNumBulletTabDialog::SwSvxNumBulletTabDialog(Window* pParent,
+ const SfxItemSet* pSwItemSet, SwWrtShell & rSh) :
+ SfxTabDialog(pParent, SW_RES(DLG_SVXTEST_NUM_BULLET), pSwItemSet, FALSE, &aEmptyStr),
+ rWrtSh(rSh),
+ sRemoveText(SW_RES(ST_RESET)),
+ nRetOptionsDialog(USHRT_MAX)
+{
+ FreeResource();
+ GetUserButton()->SetText(sRemoveText);
+ GetUserButton()->SetHelpId(HID_NUM_RESET);
+ GetUserButton()->SetClickHdl(LINK(this, SwSvxNumBulletTabDialog, RemoveNumberingHdl));
+ if(!rWrtSh.GetCurNumRule())
+ GetUserButton()->Enable(FALSE);
+ AddTabPage( RID_SVXPAGE_PICK_SINGLE_NUM );
+ AddTabPage( RID_SVXPAGE_PICK_BULLET );
+ AddTabPage( RID_SVXPAGE_PICK_NUM );
+ AddTabPage( RID_SVXPAGE_PICK_BMP );
+ AddTabPage( RID_SVXPAGE_NUM_OPTIONS );
+ AddTabPage( RID_SVXPAGE_NUM_POSITION );
+
+}
+/*-----------------07.02.97 12.08-------------------
+
+--------------------------------------------------*/
+
+SwSvxNumBulletTabDialog::~SwSvxNumBulletTabDialog()
+{
+}
+
+/*-----------------07.02.97 14.48-------------------
+
+--------------------------------------------------*/
+
+void SwSvxNumBulletTabDialog::PageCreated(USHORT nPageId, SfxTabPage& rPage)
+{
+ //Namen der Vorlagen und Metric setzen
+ String sNumCharFmt, sBulletCharFmt;
+ SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, sNumCharFmt );
+ SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, sBulletCharFmt );
+
+ switch ( nPageId )
+ {
+ case RID_SVXPAGE_PICK_NUM:
+ {
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
+ aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
+ rPage.PageCreated(aSet);
+ }
+ break;
+ case RID_SVXPAGE_PICK_BULLET :
+ {
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
+ rPage.PageCreated(aSet);
+ }
+ break;
+
+ case RID_SVXPAGE_NUM_OPTIONS:
+ {
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt));
+ aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt));
+ // Zeichenvorlagen sammeln
+ ListBox rCharFmtLB(this);
+ rCharFmtLB.Clear();
+ rCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
+ SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell();
+ ::FillCharStyleListBox(rCharFmtLB, pDocShell);
+ List aList;
+ for(USHORT j = 0; j < rCharFmtLB.GetEntryCount(); j++)
+ {
+
+ aList.Insert( new XubString(rCharFmtLB.GetEntry(j)), LIST_APPEND );
+ }
+ aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
+
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
+ aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< USHORT >(eMetric) ) );
+ rPage.PageCreated(aSet);
+ for( USHORT i = (USHORT)aList.Count(); i; --i )
+ delete (XubString*)aList.Remove(i);
+ aList.Clear();
+ }
+ break;
+ case RID_SVXPAGE_NUM_POSITION:
+ {
+ SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell();
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< USHORT >(eMetric)) );
+ rPage.PageCreated(aSet);
+// ((SvxNumPositionTabPage&)rPage).SetWrtShell(&rWrtSh);
+ }
+ break;
+ }
+}
+/*-----------------17.02.97 16.52-------------------
+
+--------------------------------------------------*/
+short SwSvxNumBulletTabDialog::Ok()
+{
+ short nRet = SfxTabDialog::Ok();
+ pExampleSet->ClearItem(SID_PARAM_NUM_PRESET);
+ return nRet;
+}
+/* -----------------02.12.98 08:35-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK(SwSvxNumBulletTabDialog, RemoveNumberingHdl, PushButton*, EMPTYARG)
+{
+ EndDialog(RET_USER);
+ return 0;
+}
+
+
diff --git a/sw/source/ui/misc/num.hrc b/sw/source/ui/misc/num.hrc
new file mode 100644
index 000000000000..379c8cb3e56d
--- /dev/null
+++ b/sw/source/ui/misc/num.hrc
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#define FL_LEVEL 1
+#define LB_LEVEL 2
+#define FL_POSITION 3
+#define FT_BORDERDIST 4
+#define MF_BORDERDIST 5
+#define CB_RELATIVE 6
+#define FT_INDENT 7
+#define MF_INDENT 8
+#define FT_NUMDIST 9
+#define MF_NUMDIST 10
+#define FT_ALIGN 11
+#define LB_ALIGN 12
+#define PB_STANDARD 13
+#define WIN_PREVIEW 15
+#define ST_RESET 16
+
+#define FT_LABEL_FOLLOWED_BY 17
+#define LB_LABEL_FOLLOWED_BY 18
+#define FT_LISTTAB 19
+#define MF_LISTTAB 20
+#define FT_ALIGN_2 21
+#define LB_ALIGN_2 22
+#define FT_ALIGNED_AT 23
+#define MF_ALIGNED_AT 24
+#define FT_INDENT_AT 25
+#define MF_INDENT_AT 26
+
diff --git a/sw/source/ui/misc/num.src b/sw/source/ui/misc/num.src
new file mode 100644
index 000000000000..600175cc4c8d
--- /dev/null
+++ b/sw/source/ui/misc/num.src
@@ -0,0 +1,374 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* StarView ressource file */
+
+
+#include "globals.hrc"
+#include "misc.hrc"
+#include "num.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+#include "svx/dialogs.hrc"
+
+/**************************************************************************/
+/* */
+/* TabPage Positionen */
+/* */
+/**************************************************************************/
+TabPage TP_NUM_POSITION
+{
+ HelpID = HID_NUM_POSITION ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ FixedLine FL_LEVEL
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "Level" ;
+ };
+ MultiListBox LB_LEVEL
+ {
+ HelpID = "sw:MultiListBox:TP_NUM_POSITION:LB_LEVEL";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 26 , 163 ) ;
+ TabStop = TRUE ;
+ DropDown = FALSE ;
+ Border = TRUE ;
+ SimpleMode = TRUE ;
+ };
+ FixedLine FL_POSITION
+ {
+ Pos = MAP_APPFONT ( 47 , 3 ) ;
+ Size = MAP_APPFONT ( 207 , 8 ) ;
+ Group = TRUE ;
+ Text [ en-US ] = "Position and spacing" ;
+ };
+ FixedText FT_BORDERDIST
+ {
+ Pos = MAP_APPFONT ( 50 , 27 ) ;
+ Size = MAP_APPFONT ( 105 , 10 ) ;
+ Text [ en-US ] = "Indent" ;
+ };
+ MetricField MF_BORDERDIST
+ {
+ HelpID = "sw:MetricField:TP_NUM_POSITION:MF_BORDERDIST";
+ Pos = MAP_APPFONT ( 198 , 25 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -1999 ;
+ Maximum = 1999 ;
+ DecimalDigits = 2 ;
+ Value = 0 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 1999 ;
+ SpinSize = 5 ;
+ };
+ CheckBox CB_RELATIVE
+ {
+ HelpID = "sw:CheckBox:TP_NUM_POSITION:CB_RELATIVE";
+ Pos = MAP_APPFONT ( 198 , 41 ) ;
+ Size = MAP_APPFONT ( 52 , 10 ) ;
+ Text [ en-US ] = "Relati~ve" ;
+ };
+ FixedText FT_INDENT
+ {
+ Pos = MAP_APPFONT ( 50 , 59 ) ;
+ Size = MAP_APPFONT ( 105 , 8 ) ;
+ Text [ en-US ] = "Width of numbering" ;
+ };
+ MetricField MF_INDENT
+ {
+ HelpID = "sw:MetricField:TP_NUM_POSITION:MF_INDENT";
+ Pos = MAP_APPFONT ( 198 , 57 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 1999 ;
+ DecimalDigits = 2 ;
+ Value = 0 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 1999 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_NUMDIST
+ {
+ Pos = MAP_APPFONT ( 50 , 75 ) ;
+ Size = MAP_APPFONT ( 105 , 8 ) ;
+ Text [ en-US ] = "Minimum space numbering <-> text" ;
+ };
+ MetricField MF_NUMDIST
+ {
+ HelpID = "sw:MetricField:TP_NUM_POSITION:MF_NUMDIST";
+ Pos = MAP_APPFONT ( 198 , 73 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 1999 ;
+ DecimalDigits = 2 ;
+ Value = 0 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 1999 ;
+ SpinSize = 5 ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_ALIGN
+ {
+ Pos = MAP_APPFONT ( 50 , 91 ) ;
+ Size = MAP_APPFONT ( 105 , 8 ) ;
+ Text [ en-US ] = "N~umbering alignment" ;
+ };
+ ListBox LB_ALIGN
+ {
+ HelpID = "sw:ListBox:TP_NUM_POSITION:LB_ALIGN";
+ Pos = MAP_APPFONT ( 198 , 89 ) ;
+ Size = MAP_APPFONT ( 40 , 40 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Left" ; > ;
+ < "Centered" ; > ;
+ < "Right" ; > ;
+ };
+ };
+ FixedText FT_LABEL_FOLLOWED_BY
+ {
+ Pos = MAP_APPFONT ( 50 , 27 ) ;
+ Size = MAP_APPFONT ( 105 , 10 ) ;
+ Text [ en-US ] = "Numbering followed by" ;
+ };
+ ListBox LB_LABEL_FOLLOWED_BY
+ {
+ HelpID = "sw:ListBox:TP_NUM_POSITION:LB_LABEL_FOLLOWED_BY";
+ Pos = MAP_APPFONT ( 198 , 25 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Tab stop" ; > ;
+ < "Space" ; > ;
+ < "Nothing" ; > ;
+ };
+ };
+ FixedText FT_LISTTAB
+ {
+ Pos = MAP_APPFONT ( 50 , 43 ) ;
+ Size = MAP_APPFONT ( 143 , 10 ) ;
+ Right = TRUE ;
+ Text [ en-US ] = "at" ;
+ };
+ MetricField MF_LISTTAB
+ {
+ HelpID = "sw:MetricField:TP_NUM_POSITION:MF_LISTTAB";
+ Pos = MAP_APPFONT ( 198 , 41 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 1999 ;
+ DecimalDigits = 2 ;
+ Value = 0 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 1999 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_ALIGN_2
+ {
+ Pos = MAP_APPFONT ( 50 , 59 ) ;
+ Size = MAP_APPFONT ( 105 , 8 ) ;
+ };
+ ListBox LB_ALIGN_2
+ {
+ HelpID = "sw:ListBox:TP_NUM_POSITION:LB_ALIGN_2";
+ Pos = MAP_APPFONT ( 198 , 57 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_ALIGNED_AT
+ {
+ Pos = MAP_APPFONT ( 50 , 75 ) ;
+ Size = MAP_APPFONT ( 105 , 8 ) ;
+ Text [ en-US ] = "Aligned at" ;
+ };
+ MetricField MF_ALIGNED_AT
+ {
+ HelpID = "sw:MetricField:TP_NUM_POSITION:MF_ALIGNED_AT";
+ Pos = MAP_APPFONT ( 198 , 73 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -1999 ;
+ Maximum = 1999 ;
+ DecimalDigits = 2 ;
+ Value = 0 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 1999 ;
+ SpinSize = 5 ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_INDENT_AT
+ {
+ Pos = MAP_APPFONT ( 50 , 91 ) ;
+ Size = MAP_APPFONT ( 105 , 8 ) ;
+ Text [ en-US ] = "Indent at" ;
+ };
+ MetricField MF_INDENT_AT
+ {
+ HelpID = "sw:MetricField:TP_NUM_POSITION:MF_INDENT_AT";
+ Pos = MAP_APPFONT ( 198 , 89 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -1999 ;
+ Maximum = 1999 ;
+ DecimalDigits = 2 ;
+ Value = 0 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 1999 ;
+ SpinSize = 5 ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ };
+ PushButton PB_STANDARD
+ {
+ HelpID = "sw:PushButton:TP_NUM_POSITION:PB_STANDARD";
+ Pos = MAP_APPFONT ( 198 , 165 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "Default" ;
+ };
+ Window WIN_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 50 , 113 ) ;
+ Size = MAP_APPFONT ( 143 , 67 ) ;
+ Border = TRUE ;
+ };
+};
+
+/**************************************************************************/
+/* */
+/* Dialog fuer Test der Svx-Implementation */
+/* */
+/**************************************************************************/
+TabDialog DLG_SVXTEST_NUM_BULLET
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Bullets and Numbering";
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ SVLook = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PICK_BULLET ;
+ Text [ en-US ] = "Bullets" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PICK_SINGLE_NUM ;
+ Text [ en-US ] = "Numbering type" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PICK_NUM ;
+ Text [ en-US ] = "Outline" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_PICK_BMP ;
+ Text [ en-US ] = "Graphics" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_NUM_POSITION ;
+ Text [ en-US ] = "Position" ;
+ };
+ PageItem
+ {
+ Identifier = RID_SVXPAGE_NUM_OPTIONS ;
+ /* ### ACHTUNG: Neuer Text in Resource? Optionen : ~Optionen */
+ Text [ en-US ] = "Options" ;
+ };
+ };
+ };
+ String ST_RESET
+ {
+ Text [ en-US ] = "~Remove" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/misc/numberingtypelistbox.cxx b/sw/source/ui/misc/numberingtypelistbox.cxx
new file mode 100644
index 000000000000..964d04738755
--- /dev/null
+++ b/sw/source/ui/misc/numberingtypelistbox.cxx
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <numberingtypelistbox.hxx>
+#ifndef _MISC_HRC
+#include <misc.hrc>
+#endif
+#include <cnttab.hxx>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/text/XDefaultNumberingProvider.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/text/XNumberingTypeInfo.hpp>
+
+#include <unomid.h>
+
+using namespace com::sun::star;
+using namespace rtl;
+
+/* -----------------------------01.03.01 16:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+struct SwNumberingTypeListBox_Impl
+{
+ uno::Reference<text::XNumberingTypeInfo> xInfo;
+};
+/* -----------------------------01.03.01 14:46--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwNumberingTypeListBox::SwNumberingTypeListBox( Window* pWin, const ResId& rResId,
+ USHORT nTypeFlags ) :
+ ListBox(pWin, rResId),
+ pImpl(new SwNumberingTypeListBox_Impl)
+{
+ uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ uno::Reference < uno::XInterface > xI = xMSF->createInstance(
+ ::rtl::OUString::createFromAscii( "com.sun.star.text.DefaultNumberingProvider" ) );
+ uno::Reference<text::XDefaultNumberingProvider> xDefNum(xI, uno::UNO_QUERY);
+ DBG_ASSERT(xDefNum.is(), "service missing: \"com.sun.star.text.DefaultNumberingProvider\"");
+
+ pImpl->xInfo = uno::Reference<text::XNumberingTypeInfo>(xDefNum, uno::UNO_QUERY);
+ Reload(nTypeFlags);
+}
+/* -----------------------------01.03.01 14:46--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwNumberingTypeListBox::~SwNumberingTypeListBox()
+{
+ delete pImpl;
+}
+/* -----------------------------01.03.01 16:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNumberingTypeListBox::Reload(USHORT nTypeFlags)
+{
+ Clear();
+ uno::Sequence<sal_Int16> aTypes;
+ const sal_Int16* pTypes = NULL;
+ if(0 != (nTypeFlags&INSERT_NUM_EXTENDED_TYPES) )
+ {
+ if(pImpl->xInfo.is())
+ {
+ aTypes = pImpl->xInfo->getSupportedNumberingTypes();
+ pTypes = aTypes.getConstArray();
+ }
+ }
+ SwOLENames aNames(SW_RES(STRRES_NUMTYPES));
+ ResStringArray& rNames = aNames.GetNames();
+ for(sal_uInt16 i = 0; i < rNames.Count(); i++)
+ {
+ long nValue = rNames.GetValue(i);
+ sal_Bool bInsert = sal_True;
+ USHORT nPos = LISTBOX_APPEND;
+ switch(nValue)
+ {
+ case style::NumberingType::NUMBER_NONE:
+ bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_NO_NUMBERING);
+ nPos = 0;
+ break;
+ case style::NumberingType::CHAR_SPECIAL: bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_BULLET); break;
+ case style::NumberingType::PAGE_DESCRIPTOR:bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_PAGE_STYLE_NUMBERING); break;
+ case style::NumberingType::BITMAP:bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_BITMAP ); break;
+ default:
+ if (nValue > style::NumberingType::CHARS_LOWER_LETTER_N)
+ {
+ // Insert only if offered by i18n framework per configuration.
+ bInsert = sal_False;
+ if (pTypes)
+ {
+ for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
+ {
+ if (pTypes[nType] == nValue)
+ {
+ bInsert = sal_True;
+ break; // for
+ }
+ }
+ }
+ }
+ }
+ if(bInsert)
+ {
+ USHORT nEntry = InsertEntry(rNames.GetString(i), nPos);
+ SetEntryData( nEntry, (void*)nValue );
+ }
+ }
+ if(0 != (nTypeFlags&INSERT_NUM_EXTENDED_TYPES) )
+ {
+ if(pTypes)
+ {
+ for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
+ {
+ sal_Int16 nCurrent = pTypes[nType];
+ if(nCurrent > style::NumberingType::CHARS_LOWER_LETTER_N)
+ {
+ if(LISTBOX_ENTRY_NOTFOUND == GetEntryPos((void*)(ULONG)nCurrent))
+ {
+ OUString aIdent = pImpl->xInfo->getNumberingIdentifier( nCurrent );
+ USHORT nPos = InsertEntry(aIdent);
+ SetEntryData(nPos,(void*)(ULONG)nCurrent);
+ }
+ }
+ }
+ }
+ SelectEntryPos(0);
+ }
+}
+/* -----------------------------01.03.01 14:46--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int16 SwNumberingTypeListBox::GetSelectedNumberingType()
+{
+ sal_Int16 nRet = 0;
+ USHORT nSelPos = GetSelectEntryPos();
+ if(LISTBOX_ENTRY_NOTFOUND != nSelPos)
+ nRet = (sal_Int16)(ULONG)GetEntryData(nSelPos);
+#ifdef DBG_UTIL
+ else
+ DBG_ERROR("SwNumberingTypeListBox not selected");
+#endif
+ return nRet;
+}
+/* -----------------------------01.03.01 14:46--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwNumberingTypeListBox::SelectNumberingType(sal_Int16 nType)
+{
+ USHORT nPos = GetEntryPos((void*)(ULONG)nType);
+ SelectEntryPos( nPos );
+ return LISTBOX_ENTRY_NOTFOUND != nPos;
+}
+
diff --git a/sw/source/ui/misc/numberingtypelistbox.src b/sw/source/ui/misc/numberingtypelistbox.src
new file mode 100644
index 000000000000..8ca6e214e614
--- /dev/null
+++ b/sw/source/ui/misc/numberingtypelistbox.src
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "misc.hrc"
+
+Resource STRRES_NUMTYPES
+{
+ StringArray 1
+ {
+
+ ItemList [ en-US ] =
+ {
+ < "1, 2, 3, ..." ; 4/*SVX_NUM_ARABIC */; > ;
+ < "A, B, C, ..." ; 0/*SVX_NUM_CHARS_UPPER_LETTER */; > ;
+ < "a, b, c, ..." ; 1/*SVX_NUM_CHARS_LOWER_LETTER */; > ;
+ < "I, II, III, ..." ; 2/*SVX_NUM_ROMAN_UPPER */; > ;
+ < "i, ii, iii, ..." ; 3/*SVX_NUM_ROMAN_LOWER */; > ;
+ < "A, .., AA, .., AAA, ..." ; 9/*SVX_NUM_CHARS_UPPER_LETTER_N*/; > ;
+ < "a, .., aa, .., aaa, ..." ; 10/*SVX_NUM_CHARS_LOWER_LETTER_N*/; > ;
+ < "Bullet" ; 6/*SVX_NUM_CHAR_SPECIAL */; > ;
+ < "Graphics" ; 8/*SVX_NUM_BITMAP */; > ;
+ < "None" ; 5/*SVX_NUM_NUMBER_NONE */; > ;
+ < "Native Numbering" ; 12 /*NATIVE_NUMBERING */; > ;
+ < "Ð, Б, .., Ðа, Ðб, ... (Bulgarian)" ; 38 /*CHARS_CYRILLIC_UPPER_LETTER_BG */; > ;
+ < "а, б, .., аа, аб, ... (Bulgarian)" ; 39 /*CHARS_CYRILLIC_LOWER_LETTER_BG */; > ;
+ < "Ð, Б, .., Ðа, Бб, ... (Bulgarian)" ; 40 /*CHARS_CYRILLIC_UPPER_LETTER_N_BG */; > ;
+ < "а, б, .., аа, бб, ... (Bulgarian)" ; 41 /*CHARS_CYRILLIC_LOWER_LETTER_N_BG */; > ;
+ < "Ð, Б, .., Ðа, Ðб, ... (Russian)" ; 42 /*CHARS_CYRILLIC_UPPER_LETTER_RU */; > ;
+ < "а, б, .., аа, аб, ... (Russian)" ; 43 /*CHARS_CYRILLIC_LOWER_LETTER_RU */; > ;
+ < "Ð, Б, .., Ðа, Бб, ... (Russian)" ; 44 /*CHARS_CYRILLIC_UPPER_LETTER_N_RU */; > ;
+ < "а, б, .., аа, бб, ... (Russian)" ; 45 /*CHARS_CYRILLIC_LOWER_LETTER_N_RU */; > ;
+ < "Ð, Б, .., Ðа, Ðб, ... (Serbian)" ; 48 /*CHARS_CYRILLIC_UPPER_LETTER_SR */; > ;
+ < "а, б, .., аа, аб, ... (Serbian)" ; 49 /*CHARS_CYRILLIC_LOWER_LETTER_SR */; > ;
+ < "Ð, Б, .., Ðа, Бб, ... (Serbian)" ; 50 /*CHARS_CYRILLIC_UPPER_LETTER_N_SR */; > ;
+ < "а, б, .., аа, бб, ... (Serbian)" ; 51 /*CHARS_CYRILLIC_LOWER_LETTER_N_SR */; > ;
+ };
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
new file mode 100644
index 000000000000..5380a00afbaf
--- /dev/null
+++ b/sw/source/ui/misc/outline.cxx
@@ -0,0 +1,1343 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <hintids.hxx>
+#include <tools/shl.hxx>
+#ifndef _MENU_HXX //autogen
+#include <vcl/menu.hxx>
+#endif
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <sfx2/tabdlg.hxx>
+#include <editeng/brshitem.hxx>
+#include <unotools/configmgr.hxx>
+#include <SwStyleNameMapper.hxx>
+
+#ifndef _NUM_HXX //autogen
+#define USE_NUMTABPAGES
+#include <num.hxx>
+#endif
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <uitool.hxx>
+#include <errhdl.hxx>
+#include <wrtsh.hxx>
+#include <swmodule.hxx>
+#include <fmtcol.hxx>
+#include <outline.hxx>
+#include <uinums.hxx>
+#include <poolfmt.hxx>
+#include <shellres.hxx>
+#include <svl/style.hxx>
+#include <charfmt.hxx>
+#include <docstyle.hxx>
+#include <viewopt.hxx>
+#include <svtools/ctrlbox.hxx>
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc> // fuer Vorlagenname 'keins'
+#endif
+#ifndef _MISC_HRC
+#include <misc.hrc>
+#endif
+#ifndef _OUTLINE_HRC
+#include <outline.hrc>
+#endif
+#include <paratr.hxx>
+
+#include <unomid.h>
+
+#include <IDocumentOutlineNodes.hxx>
+// --> OD 2008-04-14 #outlinelevel#
+#include <app.hrc>
+// <--
+
+using namespace ::com::sun::star;
+
+/* -----------------------------31.01.01 10:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+DBG_NAME(outlinehdl)
+
+/*---------------------------------------------------------------------
+
+---------------------------------------------------------------------*/
+
+class SwNumNamesDlg: public ModalDialog
+{
+ Edit aFormEdit;
+ ListBox aFormBox;
+ FixedLine aFormFL;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+ DECL_LINK( ModifyHdl, Edit * );
+ DECL_LINK( SelectHdl, ListBox * );
+ DECL_LINK( DoubleClickHdl, ListBox * );
+
+public:
+ SwNumNamesDlg(Window *pParent);
+ ~SwNumNamesDlg();
+ void SetUserNames(const String *pList[]);
+ String GetName() const { return aFormEdit.GetText(); }
+ USHORT GetCurEntryPos() const { return aFormBox.GetSelectEntryPos(); }
+};
+
+/*------------------------------------------------------------------------
+ Beschreibung: selektierten Eintrag merken
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK_INLINE_START( SwNumNamesDlg, SelectHdl, ListBox *, pBox )
+{
+ aFormEdit.SetText(pBox->GetSelectEntry());
+ aFormEdit.SetSelection(Selection(0, SELECTION_MAX));
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwNumNamesDlg, SelectHdl, ListBox *, pBox )
+
+/*------------------------------------------------------------------------
+ Beschreibung: Setzen der vom Benutzer vergebenen Namen
+ Parameter: Liste der vom Benutzer vergebenen Namen;
+ nicht vom Benutzer benannte Positionen sind 0.
+------------------------------------------------------------------------*/
+
+
+void SwNumNamesDlg::SetUserNames(const String *pList[])
+{
+ USHORT nSelect = 0;
+ for(USHORT i = 0; i < SwBaseNumRules::nMaxRules; ++i)
+ {
+ if(pList[i])
+ {
+ aFormBox.RemoveEntry(i);
+ aFormBox.InsertEntry(*pList[i], i);
+ if(i == nSelect && nSelect < SwBaseNumRules::nMaxRules)
+ nSelect++;
+ }
+ }
+ aFormBox.SelectEntryPos(nSelect);
+ SelectHdl(&aFormBox);
+}
+/*------------------------------------------------------------------------
+ Beschreibung: OK-Button freischalten, wenn Text im Edit steht.
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK_INLINE_START( SwNumNamesDlg, ModifyHdl, Edit *, pBox )
+{
+ aOKBtn.Enable(0 != pBox->GetText().Len());
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwNumNamesDlg, ModifyHdl, Edit *, pBox )
+/*------------------------------------------------------------------------
+ Beschreibung: DoubleClickHdl
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK_INLINE_START( SwNumNamesDlg, DoubleClickHdl, ListBox *, EMPTYARG )
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwNumNamesDlg, DoubleClickHdl, ListBox *, EMPTYARG )
+
+/*--------------------------------------------------
+
+--------------------------------------------------*/
+
+SwNumNamesDlg::SwNumNamesDlg(Window *pParent)
+ : ModalDialog(pParent, SW_RES(DLG_NUM_NAMES)),
+ aFormEdit(this, SW_RES(ED_FORM)),
+ aFormBox(this, SW_RES(LB_FORM)),
+ aFormFL(this, SW_RES(FL_FORM)),
+ aOKBtn(this, SW_RES(BT_OK)),
+ aCancelBtn(this, SW_RES(BT_CANCEL)),
+ aHelpBtn(this, SW_RES(BT_HELP))
+{
+ FreeResource();
+ aFormEdit.SetModifyHdl(LINK(this, SwNumNamesDlg, ModifyHdl));
+ aFormBox.SetSelectHdl(LINK(this, SwNumNamesDlg, SelectHdl));
+ aFormBox.SetDoubleClickHdl(LINK(this, SwNumNamesDlg, DoubleClickHdl));
+ SelectHdl(&aFormBox);
+}
+
+/*--------------------------------------------------
+
+--------------------------------------------------*/
+
+__EXPORT SwNumNamesDlg::~SwNumNamesDlg() {}
+
+
+/* -----------------08.07.98 08:46-------------------
+ *
+ * --------------------------------------------------*/
+USHORT lcl_BitToLevel(USHORT nActLevel)
+{
+ USHORT nTmp = nActLevel;
+ USHORT nTmpLevel = 0;
+ while( 0 != (nTmp >>= 1) )
+ nTmpLevel++;
+ return nTmpLevel;
+}
+
+/* -----------------07.07.98 14:13-------------------
+ *
+ * --------------------------------------------------*/
+USHORT SwOutlineTabDialog::nNumLevel = 1;
+SwOutlineTabDialog::SwOutlineTabDialog(Window* pParent,
+ const SfxItemSet* pSwItemSet,
+ SwWrtShell &rSh) :
+ //der UserString wird danach richtig gesetzt
+ SfxTabDialog(pParent, SW_RES(DLG_TAB_OUTLINE), pSwItemSet, FALSE, &aEmptyStr),
+ aNullStr(C2S("____")),
+ aFormMenu(SW_RES(MN_FORM)),
+ rWrtSh(rSh),
+ pChapterNumRules(SW_MOD()->GetChapterNumRules()),
+ bModified(rWrtSh.IsModified())
+{
+ // --> OD 2008-04-14 #outlinelevel#
+ SetText( SW_RES( STR_OUTLINE_NUMBERING ) );
+ // <--
+ PushButton* pUserButton = GetUserButton();
+ pUserButton->SetText(SW_RES(ST_FORM));
+ pUserButton->SetHelpId(HID_OUTLINE_FORM);
+ pUserButton->SetClickHdl(LINK(this, SwOutlineTabDialog, FormHdl));
+
+ FreeResource();
+ pNumRule = new SwNumRule( *rSh.GetOutlineNumRule() );
+ GetCancelButton().SetClickHdl(LINK(this, SwOutlineTabDialog, CancelHdl));
+
+ AddTabPage(TP_NUM_POSITION , &SwNumPositionTabPage::Create, 0);
+ AddTabPage(TP_OUTLINE_NUM , &SwOutlineSettingsTabPage::Create, 0);
+
+ String sHeadline;
+ USHORT i;
+
+ for( i = 0; i < MAXLEVEL; ++i )
+ {
+ // wurde die Vorlage noch nicht angelegt, dann ist sie noch an dieserPosition
+ if( !rWrtSh.GetParaStyle( sHeadline =
+ SwStyleNameMapper::GetUIName( static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i),
+ sHeadline )) )
+ aCollNames[i] = sHeadline;
+ }
+
+ // Erfragen der Gliederungsebenen der Textvorlagen
+ const USHORT nCount = rWrtSh.GetTxtFmtCollCount();
+ for(i = 0; i < nCount; ++i )
+ {
+ SwTxtFmtColl &rTxtColl = rWrtSh.GetTxtFmtColl(i);
+ if(!rTxtColl.IsDefault())
+ {
+ //BYTE nOutLevel = rTxtColl.GetOutlineLevel(); //<-#outline level, removed out by zhaojianwei
+ //if(nOutLevel != NO_NUMBERING)
+ //->added by zhaojianwei
+ if(rTxtColl.IsAssignedToListLevelOfOutlineStyle())
+ {
+ int nOutLevel = rTxtColl.GetAssignedOutlineStyleLevel();
+ aCollNames[ nOutLevel ] = rTxtColl.GetName();
+ }
+ //<-end
+ }
+ }
+}
+
+/* -----------------07.07.98 14:13-------------------
+ *
+ * --------------------------------------------------*/
+SwOutlineTabDialog::~SwOutlineTabDialog()
+{
+ delete pNumRule;
+}
+
+/* -----------------07.07.98 14:13-------------------
+ *
+ * --------------------------------------------------*/
+void SwOutlineTabDialog::PageCreated(USHORT nPageId, SfxTabPage& rPage)
+{
+ switch ( nPageId )
+ {
+ case TP_NUM_POSITION:
+ ((SwNumPositionTabPage&)rPage).SetWrtShell(&rWrtSh);
+ ((SwNumPositionTabPage&)rPage).SetOutlineTabDialog(this);
+ break;
+ case TP_OUTLINE_NUM:
+ ((SwOutlineSettingsTabPage&)rPage).SetWrtShell(&rWrtSh);
+ break;
+ }
+}
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwOutlineTabDialog, CancelHdl, Button *, EMPTYARG )
+{
+ if (!bModified)
+ rWrtSh.ResetModified();
+ EndDialog(RET_CANCEL);
+ return 0;
+}
+/* -----------------08.07.98 12:14-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwOutlineTabDialog, FormHdl, Button *, pBtn )
+{
+ //PopupMenu auffuellen
+ for( USHORT i = 0; i < SwChapterNumRules::nMaxRules; ++i )
+ {
+ const SwNumRulesWithName *pRules = pChapterNumRules->GetRules(i);
+ if( pRules )
+ aFormMenu.SetItemText(i + MN_FORMBASE, pRules->GetName());
+ }
+ aFormMenu.SetSelectHdl(LINK(this, SwOutlineTabDialog, MenuSelectHdl));
+ aFormMenu.Execute(pBtn, Rectangle(Point(0,0), pBtn->GetSizePixel()), POPUPMENU_EXECUTE_DOWN);
+ return 0;
+}
+
+/* -----------------08.07.98 12:14-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwOutlineTabDialog, MenuSelectHdl, Menu *, pMenu )
+{
+ BYTE nLevelNo = 0;
+ switch(pMenu->GetCurItemId())
+ {
+ case MN_FORM1: nLevelNo = 1; break;
+ case MN_FORM2: nLevelNo = 2; break;
+ case MN_FORM3: nLevelNo = 3; break;
+ case MN_FORM4: nLevelNo = 4; break;
+ case MN_FORM5: nLevelNo = 5; break;
+ case MN_FORM6: nLevelNo = 6; break;
+ case MN_FORM7: nLevelNo = 7; break;
+ case MN_FORM8: nLevelNo = 8; break;
+ case MN_FORM9: nLevelNo = 9; break;
+
+ case MN_SAVE:
+ {
+ SwNumNamesDlg *pDlg = new SwNumNamesDlg(this);
+ const String *aStrArr[SwChapterNumRules::nMaxRules];
+ for(USHORT i = 0; i < SwChapterNumRules::nMaxRules; ++i)
+ {
+ const SwNumRulesWithName *pRules = pChapterNumRules->GetRules(i);
+ if(pRules)
+ aStrArr[i] = &pRules->GetName();
+ else
+ aStrArr[i] = 0;
+ }
+ pDlg->SetUserNames(aStrArr);
+ if(RET_OK == pDlg->Execute())
+ {
+ const String aName(pDlg->GetName());
+ pChapterNumRules->ApplyNumRules( SwNumRulesWithName(
+ *pNumRule, aName ), pDlg->GetCurEntryPos() );
+ pMenu->SetItemText(
+ pDlg->GetCurEntryPos() + MN_FORMBASE, aName);
+ }
+ delete pDlg;
+ return 0;
+
+ }
+
+ }
+ if( nLevelNo-- )
+ {
+ const SwNumRulesWithName *pRules = pChapterNumRules->GetRules( nLevelNo );
+ if( pRules )
+ {
+ pRules->MakeNumRule( rWrtSh, *pNumRule );
+ pNumRule->SetRuleType( OUTLINE_RULE );
+ }
+ else
+ *pNumRule = *rWrtSh.GetOutlineNumRule();
+ }
+
+ USHORT nPageId = GetCurPageId();
+ SfxTabPage* pPage = GetTabPage( nPageId );
+ pPage->Reset(*GetOutputItemSet());
+
+ return 0;
+}
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+USHORT SwOutlineTabDialog::GetLevel(const String &rFmtName) const
+{
+ for(USHORT i = 0; i < MAXLEVEL; ++i)
+ {
+ if(aCollNames[i] == rFmtName)
+ return i;
+ }
+ return MAXLEVEL;//NO_NUMBERING; //#outline level,zhaojianwei
+
+}
+/* -----------------07.07.98 16:30-------------------
+ *
+ * --------------------------------------------------*/
+short SwOutlineTabDialog::Ok()
+{
+ SfxTabDialog::Ok();
+ // bei allen erzeugten Vorlagen die Ebenen setzen, muss
+ // geschehen, um evtl. aufgehobene Zuordnungen
+ // auch wieder zu loeschen
+
+ // --> OD 2006-12-11 #130443#
+ // encapsulate changes into a action to avoid effects on the current cursor
+ // position during the changes.
+ rWrtSh.StartAction();
+ // <--
+
+ const SwNumRule * pOutlineRule = rWrtSh.GetOutlineNumRule();
+
+ USHORT i, nCount = rWrtSh.GetTxtFmtCollCount();
+ for( i = 0; i < nCount; ++i )
+ {
+ SwTxtFmtColl &rTxtColl = rWrtSh.GetTxtFmtColl(i);
+ if( !rTxtColl.IsDefault() )
+ {
+ //rTxtColl.SetOutlineLevel( (BYTE)GetLevel(rTxtColl.GetName()));//#outline level,removed by zhaojianwei
+
+ const SfxPoolItem & rItem =
+ rTxtColl.GetFmtAttr(RES_PARATR_NUMRULE, FALSE);
+
+ //if ((BYTE)GetLevel(rTxtColl.GetName()) == NO_NUMBERING) //#outline level,removed by zhaojianwei
+ //{
+ // if (static_cast<const SwNumRuleItem &>(rItem).GetValue() ==
+ // pOutlineRule->GetName())
+ // {
+ // rTxtColl.ResetFmtAttr(RES_PARATR_NUMRULE);
+ // }
+ //}
+ //else
+ //{
+ // if (static_cast<const SwNumRuleItem &>(rItem).GetValue() !=
+ // pOutlineRule->GetName())
+ // {
+ // SwNumRuleItem aItem(pOutlineRule->GetName());
+ // rTxtColl.SetFmtAttr(aItem);
+ // }
+ //}
+ if ((BYTE)GetLevel(rTxtColl.GetName()) == MAXLEVEL) //add by zhaojianwei
+ {
+ if(rTxtColl.IsAssignedToListLevelOfOutlineStyle())
+ {
+ rTxtColl.DeleteAssignmentToListLevelOfOutlineStyle();
+ }
+ if (static_cast<const SwNumRuleItem &>(rItem).GetValue() ==
+ pOutlineRule->GetName())
+ {
+ rTxtColl.ResetFmtAttr(RES_PARATR_NUMRULE);
+ }
+ }
+ else
+ {
+ rTxtColl.AssignToListLevelOfOutlineStyle(GetLevel(rTxtColl.GetName()));
+
+ if (static_cast<const SwNumRuleItem &>(rItem).GetValue() !=
+ pOutlineRule->GetName())
+ {
+ SwNumRuleItem aItem(pOutlineRule->GetName());
+ rTxtColl.SetFmtAttr(aItem);
+ }
+ } //<-end,zhaojianwei
+ }
+ }
+
+ for(i = 0; i < MAXLEVEL; ++i )
+ {
+ String sHeadline;
+ ::SwStyleNameMapper::FillUIName( static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i),
+ sHeadline );
+ SwTxtFmtColl* pColl = rWrtSh.FindTxtFmtCollByName( sHeadline );
+ if( !pColl )
+ {
+ //if( !aCollNames[i].Len() ) //#outline level,removed by zhaojianwei
+ //{
+ // SwTxtFmtColl* pTxtColl = rWrtSh.GetTxtCollFromPool(
+ // static_cast< USHORT >(RES_POOLCOLL_HEADLINE1 + i) );
+ // pTxtColl->SetOutlineLevel( NO_NUMBERING );
+ // pTxtColl->ResetFmtAttr(RES_PARATR_NUMRULE);
+ //}
+ //else if(aCollNames[i] != sHeadline)
+ //{
+ // SwTxtFmtColl* pTxtColl = rWrtSh.GetParaStyle(
+ // aCollNames[i], SwWrtShell::GETSTYLE_CREATESOME);
+ // if(pTxtColl)
+ // {
+ // pTxtColl->SetOutlineLevel( static_cast< BYTE >(i) );
+
+ // SwNumRuleItem aItem(pOutlineRule->GetName());
+ // pTxtColl->SetFmtAttr(aItem);
+ // }
+ //}
+ if(aCollNames[i] != sHeadline)//->added by zhaojianwei
+ {
+ SwTxtFmtColl* pTxtColl = rWrtSh.GetTxtCollFromPool(
+ static_cast< USHORT >(RES_POOLCOLL_HEADLINE1 + i) );
+ pTxtColl->DeleteAssignmentToListLevelOfOutlineStyle();
+ pTxtColl->ResetFmtAttr(RES_PARATR_NUMRULE);
+
+ if( aCollNames[i].Len() )
+ {
+ pTxtColl = rWrtSh.GetParaStyle(
+ aCollNames[i], SwWrtShell::GETSTYLE_CREATESOME);
+ if(pTxtColl)
+ {
+ pTxtColl->AssignToListLevelOfOutlineStyle(i);
+ SwNumRuleItem aItem(pOutlineRule->GetName());
+ pTxtColl->SetFmtAttr(aItem);
+ }
+ }
+ }//<--end,zhaojianwei
+ }
+ }
+
+ rWrtSh.SetOutlineNumRule( *pNumRule);
+
+ // --> OD 2006-12-11 #130443#
+ rWrtSh.EndAction();
+ // <--
+
+ return RET_OK;
+}
+
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+SwOutlineSettingsTabPage::SwOutlineSettingsTabPage(Window* pParent, const SfxItemSet& rSet) :
+ SfxTabPage(pParent, SW_RES(TP_OUTLINE_NUM), rSet),
+ aLevelLB( this, SW_RES(LB_LEVEL )),
+ aLevelFL( this, SW_RES(FL_LEVEL )),
+ aCollLbl(this, SW_RES(FT_COLL)),
+ aCollBox(this, SW_RES(LB_COLL)),
+ aNumberLbl(this, SW_RES(FT_NUMBER)),
+ aNumberBox(this, SW_RES(LB_NUMBER), INSERT_NUM_TYPE_NO_NUMBERING|INSERT_NUM_EXTENDED_TYPES),
+ aCharFmtFT(this, SW_RES(FT_CHARFMT)),
+ aCharFmtLB(this, SW_RES(LB_CHARFMT)),
+ aAllLevelFT( this, SW_RES(FT_ALL_LEVEL)),
+ aAllLevelNF( this, SW_RES(NF_ALL_LEVEL)),
+ aDelim(this, SW_RES(FT_DELIM)),
+ aPrefixFT(this, SW_RES(FT_PREFIX)),
+ aPrefixED(this, SW_RES(ED_PREFIX)),
+ aSuffixFT(this, SW_RES(FT_SUFFIX)),
+ aSuffixED(this, SW_RES(ED_SUFFIX)),
+ aStartLbl(this, SW_RES(FT_START)),
+ aStartEdit(this, SW_RES(ED_START)),
+ aNumberFL(this, SW_RES(FL_NUMBER)),
+ aPreviewWIN( this, SW_RES(WIN_PREVIEW )),
+
+ aNoFmtName(SW_RES(ST_NO_COLL)),
+ pSh(0),
+ pCollNames(0),
+ nActLevel(1)
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ aCollBox.InsertEntry(aNoFmtName);
+ aLevelLB.SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, LevelHdl));
+ aAllLevelNF.SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, ToggleComplete));
+ aCollBox.SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, CollSelect));
+ aCollBox.SetGetFocusHdl(LINK(this, SwOutlineSettingsTabPage, CollSelectGetFocus));
+ aNumberBox.SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, NumberSelect));
+ aPrefixED.SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, DelimModify));
+ aSuffixED.SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, DelimModify));
+ aStartEdit.SetModifyHdl(LINK(this, SwOutlineSettingsTabPage, StartModified));
+ aCharFmtLB.SetSelectHdl(LINK(this, SwOutlineSettingsTabPage, CharFmtHdl));
+
+}
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+void SwOutlineSettingsTabPage::Update()
+{
+ // falls eine Vorlage fuer diese Ebene bereits selektiert wurde,
+ // diese in der ListBox auswaehlean
+ aCollBox.Enable(USHRT_MAX != nActLevel);
+ if(USHRT_MAX == nActLevel)
+ {
+ BOOL bSamePrefix = TRUE;
+ BOOL bSameSuffix = TRUE;
+ BOOL bSameType = TRUE;
+ BOOL bSameComplete = TRUE;
+ BOOL bSameStart = TRUE;
+ BOOL bSameCharFmt = TRUE;
+
+ const SwNumFmt* aNumFmtArr[MAXLEVEL];
+ const SwCharFmt* pFirstFmt = 0;
+
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ {
+
+ aNumFmtArr[ i ] = &pNumRule->Get(i);
+ if(i == 0)
+ pFirstFmt = aNumFmtArr[i]->GetCharFmt();
+ else
+ {
+ bSameType &= aNumFmtArr[i]->GetNumberingType() == aNumFmtArr[0]->GetNumberingType();
+ bSameStart &= aNumFmtArr[i]->GetStart() == aNumFmtArr[0]->GetStart();
+ bSamePrefix &= aNumFmtArr[i]->GetPrefix() == aNumFmtArr[0]->GetPrefix();
+ bSameSuffix &= aNumFmtArr[i]->GetSuffix() == aNumFmtArr[0]->GetSuffix();
+ bSameComplete &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[0]->GetIncludeUpperLevels();
+ const SwCharFmt* pFmt = aNumFmtArr[i]->GetCharFmt();
+ bSameCharFmt &= (!pFirstFmt && !pFmt)
+ || (pFirstFmt && pFmt && pFmt->GetName() == pFirstFmt->GetName());
+ }
+ }
+ CheckForStartValue_Impl(aNumFmtArr[0]->GetNumberingType());
+ if(bSameType)
+ aNumberBox.SelectNumberingType( aNumFmtArr[0]->GetNumberingType() );
+ else
+ aNumberBox.SetNoSelection();
+ if(bSameStart)
+ aStartEdit.SetValue(aNumFmtArr[0]->GetStart());
+ else
+ aStartEdit.SetText(aEmptyStr);
+ if(bSamePrefix)
+ aPrefixED.SetText(aNumFmtArr[0]->GetPrefix());
+ else
+ aPrefixED.SetText(aEmptyStr);
+ if(bSameSuffix)
+ aSuffixED.SetText(aNumFmtArr[0]->GetSuffix());
+ else
+ aSuffixED.SetText(aEmptyStr);
+
+ if(bSameCharFmt)
+ {
+ if(pFirstFmt)
+ aCharFmtLB.SelectEntry(pFirstFmt->GetName());
+ else
+ aCharFmtLB.SelectEntry( ViewShell::GetShellRes()->aStrNone );
+ }
+ else
+ aCharFmtLB.SetNoSelection();
+
+ aAllLevelFT.Enable(TRUE);
+ aAllLevelNF.Enable(TRUE);
+ aAllLevelNF.SetMax(MAXLEVEL);
+ if(bSameComplete)
+ {
+ aAllLevelNF.SetValue(aNumFmtArr[0]->GetIncludeUpperLevels());
+ }
+ else
+ {
+ aAllLevelNF.SetText(aEmptyStr);
+ }
+ }
+ else
+ {
+ USHORT nTmpLevel = lcl_BitToLevel(nActLevel);
+ String aColl(pCollNames[nTmpLevel]);
+ if(aColl.Len())
+ aCollBox.SelectEntry(aColl);
+ else
+ aCollBox.SelectEntry(aNoFmtName);
+ const SwNumFmt &rFmt = pNumRule->Get(nTmpLevel);
+
+ aNumberBox.SelectNumberingType( rFmt.GetNumberingType() );
+ aPrefixED.SetText(rFmt.GetPrefix());
+ aSuffixED.SetText(rFmt.GetSuffix());
+ const SwCharFmt* pFmt = rFmt.GetCharFmt();
+ if(pFmt)
+ aCharFmtLB.SelectEntry(pFmt->GetName());
+ else
+ aCharFmtLB.SelectEntry( ViewShell::GetShellRes()->aStrNone );
+
+ if(nTmpLevel)
+ {
+ aAllLevelFT.Enable(TRUE);
+ aAllLevelNF.Enable(TRUE);
+ aAllLevelNF.SetMax(nTmpLevel + 1);
+ aAllLevelNF.SetValue(rFmt.GetIncludeUpperLevels());
+ }
+ else
+ {
+ aAllLevelNF.SetText(aEmptyStr);
+ aAllLevelNF.Enable(FALSE);
+ aAllLevelFT.Enable(FALSE);
+ }
+ CheckForStartValue_Impl(rFmt.GetNumberingType());
+ aStartEdit.SetValue( rFmt.GetStart() );
+ }
+ SetModified();
+}
+
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwOutlineSettingsTabPage, LevelHdl, ListBox *, pBox )
+{
+ nActLevel = 0;
+ if(pBox->IsEntryPosSelected( MAXLEVEL ))
+ {
+ nActLevel = 0xFFFF;
+ }
+ else
+ {
+ USHORT nMask = 1;
+ for( USHORT i = 0; i < MAXLEVEL; i++ )
+ {
+ if(pBox->IsEntryPosSelected( i ))
+ nActLevel |= nMask;
+ nMask <<= 1;
+ }
+ }
+ Update();
+ return 0;
+}
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwOutlineSettingsTabPage, ToggleComplete, NumericField *, pFld )
+{
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ {
+ if(nActLevel & nMask)
+ {
+ SwNumFmt aNumFmt(pNumRule->Get(i));
+ aNumFmt.SetIncludeUpperLevels( Min( (BYTE)pFld->GetValue(),
+ (BYTE)(i + 1)) );
+ pNumRule->Set(i, aNumFmt);
+ }
+ nMask <<= 1;
+ }
+ SetModified();
+ return 0;
+}
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwOutlineSettingsTabPage, CollSelect, ListBox *, pBox )
+{
+ BYTE i;
+
+ const String aCollName(pBox->GetSelectEntry());
+ //0xFFFF darf hier nicht sein (disable)
+ USHORT nTmpLevel = lcl_BitToLevel(nActLevel);
+ String sOldName( pCollNames[nTmpLevel] );
+
+ for( i = 0; i < MAXLEVEL; ++i)
+ pCollNames[i] = aSaveCollNames[i];
+
+ if(aCollName == aNoFmtName)
+ pCollNames[nTmpLevel] = aEmptyStr;
+ else
+ {
+ pCollNames[nTmpLevel] = aCollName;
+ // wird die Vorlage bereits verwendet ?
+ for( i = 0; i < MAXLEVEL; ++i)
+ if(i != nTmpLevel && pCollNames[i] == aCollName )
+ pCollNames[i] = aEmptyStr;
+ }
+
+ // search the oldname and put it into the current entries
+ if( sOldName.Len() )
+ for( i = 0; i < MAXLEVEL; ++i)
+ if( aSaveCollNames[ i ] == sOldName && i != nTmpLevel &&
+ !pCollNames[ i ].Len() )
+ {
+ BYTE n;
+ for( n = 0; n < MAXLEVEL; ++n )
+ if( pCollNames[ n ] == sOldName )
+ break;
+
+ if( MAXLEVEL == n )
+ // it was a outline leveld name and the current entries is zero.
+ pCollNames[ i ] = sOldName;
+ }
+
+ SetModified();
+ return 0;
+}
+
+IMPL_LINK( SwOutlineSettingsTabPage, CollSelectGetFocus, ListBox *, EMPTYARG )
+{
+ for( BYTE i = 0; i < MAXLEVEL; ++i)
+ aSaveCollNames[i] = pCollNames[i];
+ return 0;
+}
+
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwOutlineSettingsTabPage, NumberSelect, SwNumberingTypeListBox *, pBox )
+{
+ USHORT nMask = 1;
+ sal_Int16 nNumberType = pBox->GetSelectedNumberingType();//(sal_Int16)(ULONG)pBox->GetEntryData(pBox->GetSelectEntryPos());
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ {
+ if(nActLevel & nMask)
+ {
+ SwNumFmt aNumFmt(pNumRule->Get(i));
+ aNumFmt.SetNumberingType(nNumberType);
+ pNumRule->Set(i, aNumFmt);
+ CheckForStartValue_Impl(nNumberType);
+ }
+ nMask <<= 1;
+ }
+ SetModified();
+ return 0;
+}
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwOutlineSettingsTabPage, DelimModify, Edit *, EMPTYARG )
+{
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ {
+ if(nActLevel & nMask)
+ {
+ SwNumFmt aNumFmt(pNumRule->Get(i));
+ aNumFmt.SetPrefix( aPrefixED.GetText() );
+ aNumFmt.SetSuffix( aSuffixED.GetText() );
+ pNumRule->Set(i, aNumFmt);
+ }
+ nMask <<= 1;
+ }
+ SetModified();
+ return 0;
+}
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwOutlineSettingsTabPage, StartModified, NumericField *, pFld )
+{
+ USHORT nMask = 1;
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ {
+ if(nActLevel & nMask)
+ {
+ SwNumFmt aNumFmt(pNumRule->Get(i));
+ aNumFmt.SetStart( (USHORT)pFld->GetValue() );
+ pNumRule->Set(i, aNumFmt);
+ }
+ nMask <<= 1;
+ }
+ SetModified();
+ return 0;
+}
+/* -----------------21.09.98 12:21-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwOutlineSettingsTabPage, CharFmtHdl, ListBox *, EMPTYARG )
+{
+// bAutomaticCharStyles = FALSE;
+ String sEntry = aCharFmtLB.GetSelectEntry();
+ USHORT nMask = 1;
+ BOOL bFormatNone = sEntry == ViewShell::GetShellRes()->aStrNone;
+ SwCharFmt* pFmt = 0;
+ if(!bFormatNone)
+ {
+ USHORT nChCount = pSh->GetCharFmtCount();
+ for(USHORT i = 0; i < nChCount; i++)
+ {
+ SwCharFmt& rChFmt = pSh->GetCharFmt(i);
+ if(rChFmt.GetName() == sEntry)
+ {
+ pFmt = &rChFmt;
+ break;
+ }
+ }
+ if(!pFmt)
+ {
+ SfxStyleSheetBasePool* pPool = pSh->GetView().GetDocShell()->GetStyleSheetPool();
+ SfxStyleSheetBase* pBase;
+ pBase = pPool->Find(sEntry, SFX_STYLE_FAMILY_CHAR);
+ if(!pBase)
+ pBase = &pPool->Make(sEntry, SFX_STYLE_FAMILY_PAGE);
+ pFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
+
+ }
+ }
+
+ for(USHORT i = 0; i < MAXLEVEL; i++)
+ {
+ if(nActLevel & nMask)
+ {
+ SwNumFmt aNumFmt(pNumRule->Get(i));
+ if(bFormatNone)
+ aNumFmt.SetCharFmt(0);
+ else
+ aNumFmt.SetCharFmt(pFmt);
+ pNumRule->Set(i, aNumFmt);
+ }
+ nMask <<= 1;
+ }
+ return RET_OK;
+}
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+SwOutlineSettingsTabPage::~SwOutlineSettingsTabPage()
+{
+}
+/* -----------------07.07.98 16:27-------------------
+ *
+ * --------------------------------------------------*/
+void SwOutlineSettingsTabPage::SetWrtShell(SwWrtShell* pShell)
+{
+ pSh = pShell;
+ // Erfragen der NumRules dieses Dokumentes
+ pNumRule = ((SwOutlineTabDialog*)GetTabDialog())->GetNumRule();
+ pCollNames = ((SwOutlineTabDialog*)GetTabDialog())->GetCollNames();
+
+ //pNumRule = new SwNumRule( *rSh.GetOutlineNumRule() );
+
+ aPreviewWIN.SetNumRule(pNumRule);
+ aPreviewWIN.SetOutlineNames(pCollNames);
+ // Startwert setzen - nActLevel muss hier 1 sein
+ USHORT nTmpLevel = lcl_BitToLevel(nActLevel);
+ const SwNumFmt& rNumFmt = pNumRule->Get( nTmpLevel );
+ aStartEdit.SetValue( rNumFmt.GetStart() );
+
+ // Poolformate fuer Ueberschriften anlegen
+ String sStr;
+ USHORT i;
+ for( i = 0; i < MAXLEVEL; ++i )
+ {
+ aCollBox.InsertEntry( SwStyleNameMapper::GetUIName(
+ static_cast< sal_uInt16 >(RES_POOLCOLL_HEADLINE1 + i), aEmptyStr ));
+ aLevelLB.InsertEntry( String::CreateFromInt32(i + 1) );
+ }
+ sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "1 - " ));
+ sStr += String::CreateFromInt32(MAXLEVEL);
+ aLevelLB.InsertEntry( sStr );
+
+ // Erfragen der Gliederungsebenen der Textvorlagen
+ const USHORT nCount = pSh->GetTxtFmtCollCount();
+ for( i = 0; i < nCount; ++i )
+ {
+ SwTxtFmtColl &rTxtColl = pSh->GetTxtFmtColl(i);
+ if(!rTxtColl.IsDefault())
+ {
+ sStr = rTxtColl.GetName();
+ if(LISTBOX_ENTRY_NOTFOUND == aCollBox.GetEntryPos( sStr ))
+ aCollBox.InsertEntry( sStr );
+ }
+ }
+
+ aNumberBox.SelectNumberingType(rNumFmt.GetNumberingType());
+ USHORT nOutlinePos = pSh->GetOutlinePos(MAXLEVEL);
+ USHORT nTmp = 0;
+ if(nOutlinePos != USHRT_MAX)
+ {
+ nTmp = static_cast<USHORT>(pSh->getIDocumentOutlineNodesAccess()->getOutlineLevel(nOutlinePos));
+ }
+ aLevelLB.SelectEntryPos(nTmp-1);//nTmp);//#outline level,zhaojianwei
+
+ // Zeichenvorlagen sammeln
+ aCharFmtLB.Clear();
+ aCharFmtLB.InsertEntry( ViewShell::GetShellRes()->aStrNone );
+
+ // Zeichenvorlagen
+ ::FillCharStyleListBox(aCharFmtLB,
+ pSh->GetView().GetDocShell());
+ Update();
+}
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+void SwOutlineSettingsTabPage::ActivatePage(const SfxItemSet& )
+{
+ nActLevel = SwOutlineTabDialog::GetActNumLevel();
+ if(nActLevel != USHRT_MAX)
+ aLevelLB.SelectEntryPos(lcl_BitToLevel(nActLevel));
+ else
+ aLevelLB.SelectEntryPos(MAXLEVEL);
+ LevelHdl(&aLevelLB);
+}
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+int SwOutlineSettingsTabPage::DeactivatePage(SfxItemSet*)
+{
+ SwOutlineTabDialog::SetActNumLevel(nActLevel);
+ return LEAVE_PAGE;
+}
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+BOOL SwOutlineSettingsTabPage::FillItemSet( SfxItemSet& )
+{
+ return TRUE;
+}
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+void SwOutlineSettingsTabPage::Reset( const SfxItemSet& rSet )
+{
+ ActivatePage(rSet);
+}
+/* -----------------07.07.98 14:19-------------------
+ *
+ * --------------------------------------------------*/
+SfxTabPage* SwOutlineSettingsTabPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SwOutlineSettingsTabPage(pParent, rAttrSet);
+}
+/* -----------------07.11.2002 15:13-----------------
+ *
+ * --------------------------------------------------*/
+void SwOutlineSettingsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType)
+{
+ BOOL bIsNull = aStartEdit.GetValue() == 0;
+ BOOL bNoZeroAllowed = nNumberingType < SVX_NUM_ARABIC ||
+ SVX_NUM_CHARS_UPPER_LETTER_N == nNumberingType ||
+ SVX_NUM_CHARS_LOWER_LETTER_N == nNumberingType;
+ aStartEdit.SetMin(bNoZeroAllowed ? 1 : 0);
+ if(bIsNull && bNoZeroAllowed)
+ aStartEdit.GetModifyHdl().Call(&aStartEdit);
+}
+/*-----------------09.12.97 11:54-------------------
+
+--------------------------------------------------*/
+USHORT lcl_DrawBullet(VirtualDevice* pVDev,
+ const SwNumFmt& rFmt, USHORT nXStart,
+ USHORT nYStart, const Size& rSize)
+{
+ Font aTmpFont(pVDev->GetFont());
+
+ Font aFont(*rFmt.GetBulletFont());
+ aFont.SetSize(rSize);
+ aFont.SetTransparent(TRUE);
+ pVDev->SetFont( aFont );
+ String aText(rFmt.GetBulletChar());
+ pVDev->DrawText( Point(nXStart, nYStart), aText );
+ USHORT nRet = (USHORT)pVDev->GetTextWidth(aText);
+
+ pVDev->SetFont(aTmpFont);
+ return nRet;
+}
+/*-----------------09.12.97 11:49-------------------
+
+--------------------------------------------------*/
+USHORT lcl_DrawGraphic(VirtualDevice* pVDev, const SwNumFmt &rFmt, USHORT nXStart,
+ USHORT nYStart, USHORT nDivision)
+{
+ const SvxBrushItem* pBrushItem = rFmt.GetBrush();
+ USHORT nRet = 0;
+ if(pBrushItem)
+ {
+ const Graphic* pGrf = pBrushItem->GetGraphic();
+ if(pGrf)
+ {
+ Size aGSize( rFmt.GetGraphicSize());
+ aGSize.Width() /= nDivision;
+ nRet = (USHORT)aGSize.Width();
+ aGSize.Height() /= nDivision;
+ pGrf->Draw( pVDev, Point(nXStart,nYStart),
+ pVDev->PixelToLogic( aGSize ) );
+ }
+ }
+ return nRet;
+
+}
+/*-----------------02.12.97 10:34-------------------
+ Vorschau der Numerierung painten
+--------------------------------------------------*/
+void NumberingPreview::Paint( const Rectangle& /*rRect*/ )
+{
+ Size aSize(PixelToLogic(GetOutputSizePixel()));
+ Rectangle aRect(Point(0,0), aSize);
+
+ VirtualDevice* pVDev = new VirtualDevice(*this);
+ pVDev->SetMapMode(GetMapMode());
+ pVDev->SetOutputSize( aSize );
+
+ // #101524# OJ
+ pVDev->SetFillColor( GetSettings().GetStyleSettings().GetWindowColor() );
+ pVDev->SetLineColor( GetSettings().GetStyleSettings().GetButtonTextColor() );
+ pVDev->DrawRect(aRect);
+
+ if(pActNum)
+ {
+ USHORT nWidthRelation;
+ if(nPageWidth)
+ {
+ nWidthRelation = USHORT (nPageWidth / aSize.Width());
+ if(bPosition)
+ nWidthRelation = nWidthRelation * 2 / 3;
+ else
+ nWidthRelation = nWidthRelation / 4;
+ }
+ else
+ nWidthRelation = 30; // Kapiteldialog
+
+ //Hoehe pro Ebene
+ USHORT nXStep = USHORT(aSize.Width() / (3 * MAXLEVEL));
+ if(MAXLEVEL < 10)
+ nXStep /= 2;
+ USHORT nYStart = 4;
+ USHORT nYStep = USHORT((aSize.Height() - 6)/ MAXLEVEL);
+ aStdFont = OutputDevice::GetDefaultFont(
+ DEFAULTFONT_UI_SANS, (LanguageType)GetAppLanguage(),
+ DEFAULTFONT_FLAGS_ONLYONE, this );
+ // #101524# OJ
+ aStdFont.SetColor( SwViewOption::GetFontColor() );
+
+ //
+ USHORT nFontHeight = nYStep * 6 / 10;
+ if(bPosition)
+ nFontHeight = nYStep * 15 / 10;
+ aStdFont.SetSize(Size( 0, nFontHeight ));
+
+ USHORT nPreNum = pActNum->Get(0).GetStart();
+
+ if(bPosition)
+ {
+ USHORT nLineHeight = nFontHeight * 8 / 7;
+ BYTE nStart = 0;
+ while( !(nActLevel & (1<<nStart)) )
+ {
+ nStart++;
+ }
+ if(nStart) // damit moeglichs Vorgaenger und Nachfolger gezeigt werden
+ nStart--;
+
+ SwNumberTree::tNumberVector aNumVector;
+ BYTE nEnd = Min( (BYTE)(nStart + 3), MAXLEVEL );
+ for( BYTE nLevel = nStart; nLevel < nEnd; ++nLevel )
+ {
+ const SwNumFmt &rFmt = pActNum->Get(nLevel);
+ aNumVector.push_back(rFmt.GetStart());
+
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ USHORT nXStart( 0 );
+ short nTextOffset( 0 );
+ USHORT nNumberXPos( 0 );
+ if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
+ nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation;
+ nNumberXPos = nXStart;
+ USHORT nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation;
+
+ if(nFirstLineOffset <= nNumberXPos)
+ nNumberXPos = nNumberXPos - nFirstLineOffset;
+ else
+ nNumberXPos = 0;
+ }
+ else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ const long nTmpNumberXPos( ( rFmt.GetIndentAt() +
+ rFmt.GetFirstLineIndent() ) /
+ nWidthRelation );
+ if ( nTmpNumberXPos < 0 )
+ {
+ nNumberXPos = 0;
+ }
+ else
+ {
+ nNumberXPos = static_cast<USHORT>(nTmpNumberXPos);
+ }
+ }
+ // <--
+
+ USHORT nBulletWidth = 0;
+ if( SVX_NUM_BITMAP == rFmt.GetNumberingType() )
+ {
+ nBulletWidth = lcl_DrawGraphic(pVDev, rFmt,
+ nNumberXPos,
+ nYStart, nWidthRelation);
+ }
+ else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
+ {
+ nBulletWidth = lcl_DrawBullet(pVDev, rFmt, nNumberXPos, nYStart, aStdFont.GetSize());
+ }
+ else
+ {
+ pVDev->SetFont(aStdFont);
+ if(pActNum->IsContinusNum())
+ aNumVector[nLevel] = nPreNum;
+ // --> OD 2005-11-17 #128041#
+ String aText(pActNum->MakeNumString( aNumVector ));
+ // <--
+ pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
+ nBulletWidth = (USHORT)pVDev->GetTextWidth(aText);
+ nPreNum++;
+ }
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT &&
+ rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE )
+ {
+ pVDev->SetFont(aStdFont);
+ String aText(' ');
+ pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
+ nBulletWidth = nBulletWidth + (USHORT)pVDev->GetTextWidth(aText);
+ }
+ // <--
+
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ USHORT nTextXPos( 0 );
+ if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ nTextXPos = nXStart;
+ if(nTextOffset < 0)
+ nTextXPos = nTextXPos + nTextOffset;
+ if(nNumberXPos + nBulletWidth + nTextOffset > nTextXPos )
+ nTextXPos = nNumberXPos + nBulletWidth + nTextOffset;
+ }
+ else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ switch ( rFmt.GetLabelFollowedBy() )
+ {
+ case SvxNumberFormat::LISTTAB:
+ {
+ nTextXPos = static_cast<USHORT>(
+ rFmt.GetListtabPos() / nWidthRelation );
+ if ( nTextXPos < nNumberXPos + nBulletWidth )
+ {
+ nTextXPos = nNumberXPos + nBulletWidth;
+ }
+ }
+ break;
+ case SvxNumberFormat::SPACE:
+ case SvxNumberFormat::NOTHING:
+ {
+ nTextXPos = nNumberXPos + nBulletWidth;
+ }
+ break;
+ }
+
+ nXStart = static_cast<USHORT>( rFmt.GetIndentAt() / nWidthRelation );
+ }
+ // <--
+
+
+ Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2));
+ pVDev->SetFillColor( GetSettings().GetStyleSettings().GetWindowColor() ); // Color( COL_BLACK ) );
+ pVDev->DrawRect( aRect1 );
+
+ Rectangle aRect2(Point(nXStart, nYStart + nLineHeight + nFontHeight / 2 ), Size(aSize.Width() / 2, 2));
+ pVDev->DrawRect( aRect2 );
+ nYStart += 2 * nLineHeight;
+ }
+ }
+ else
+ {
+ SwNumberTree::tNumberVector aNumVector;
+ USHORT nLineHeight = nFontHeight * 3 / 2;
+ for( BYTE nLevel = 0; nLevel < MAXLEVEL;
+ ++nLevel, nYStart = nYStart + nYStep )
+ {
+ const SwNumFmt &rFmt = pActNum->Get(nLevel);
+ aNumVector.push_back(rFmt.GetStart());
+ // --> OD 2008-02-01 #newlistlevelattrs#
+ USHORT nXStart( 0 );
+ if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
+ }
+ else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ const long nTmpXStart( ( rFmt.GetIndentAt() +
+ rFmt.GetFirstLineIndent() ) /
+ nWidthRelation );
+ if ( nTmpXStart < 0 )
+ {
+ nXStart = 0;
+ }
+ else
+ {
+ nXStart = static_cast<USHORT>(nTmpXStart);
+ }
+ }
+ nXStart /= 2;
+ nXStart += 2;
+ // <--
+ USHORT nTextOffset = 2 * nXStep;
+ if( SVX_NUM_BITMAP == rFmt.GetNumberingType() )
+ {
+ lcl_DrawGraphic(pVDev, rFmt, nXStart, nYStart, nWidthRelation);
+ nTextOffset = nLineHeight + nXStep;
+ }
+ else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
+ {
+ nTextOffset = lcl_DrawBullet(pVDev, rFmt, nXStart, nYStart, aStdFont.GetSize());
+ nTextOffset = nTextOffset + nXStep;
+ }
+ else
+ {
+ pVDev->SetFont(aStdFont);
+ if(pActNum->IsContinusNum())
+ aNumVector[nLevel] = nPreNum;
+ // --> OD 2005-11-17 #128041#
+ String aText(pActNum->MakeNumString( aNumVector ));
+ // <--
+ pVDev->DrawText( Point(nXStart, nYStart), aText );
+ nTextOffset = (USHORT)pVDev->GetTextWidth(aText);
+ nTextOffset = nTextOffset + nXStep;
+ nPreNum++;
+ }
+ pVDev->SetFont(aStdFont);
+
+ // Changed as per BugID 79541 Branding/Configuration
+ uno::Any MyAny = ::utl::ConfigManager::GetConfigManager()->
+ GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME );
+ ::rtl::OUString aProductName;
+
+ MyAny >>= aProductName;
+ String sMsg(C2S("%PRODUCTNAME"));
+ sMsg.SearchAndReplaceAscii( "%PRODUCTNAME" , aProductName );
+
+ if(pOutlineNames)
+ sMsg = pOutlineNames[nLevel];
+ pVDev->DrawText( Point(nXStart + nTextOffset, nYStart), sMsg );
+ }
+ }
+ }
+ DrawOutDev( Point(0,0), aSize,
+ Point(0,0), aSize,
+ *pVDev );
+ delete pVDev;
+
+}
+
+/*-----------------02.12.97 10:34-------------------
+
+--------------------------------------------------*/
+NumberingPreview::~NumberingPreview()
+{
+}
+
+
diff --git a/sw/source/ui/misc/outline.hrc b/sw/source/ui/misc/outline.hrc
new file mode 100644
index 000000000000..2f8a4a469cb4
--- /dev/null
+++ b/sw/source/ui/misc/outline.hrc
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define RB_1 1
+#define RB_2 2
+#define RB_3 3
+#define RB_4 4
+#define RB_5 5
+#define FT_1 6
+#define FT_2 7
+#define FT_3 8
+#define FT_4 9
+#define FT_5 10
+#define FI_1 11
+#define FI_2 12
+#define FI_3 13
+#define FI_4 14
+#define FI_5 15
+//#define FL_LEVEL 16
+
+#define FT_COLL 20
+#define LB_COLL 21
+#define FT_NUMBER 22
+#define LB_NUMBER 23
+#define FT_DELIM 24
+#define FT_DELIM_BEVOR 25
+#define FT_DELIM_AFTER 26
+#define ED_DELIM_BEVOR 27
+#define ED_DELIM_AFTER 28
+#define CB_COMPLETE 29
+#define FL_NUMBER 30
+
+#define LB_ALIGN 31
+#define FL_ALIGN 33
+
+#define FT_START 40
+#define ED_START 41
+#define FL_START 42
+
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_HELP 102
+#define BT_FORM 103
+#define BT_RESET 104
+#define FL_FORM 105
+#define LB_FORM 106
+#define ED_FORM 107
+#define FT_ALL_LEVEL 108
+#define NF_ALL_LEVEL 109
+
+#define MN_FORM 110
+#define MN_FORM1 111
+#define MN_FORMBASE MN_FORM1
+#define MN_FORM2 112
+#define MN_FORM3 113
+#define MN_FORM4 114
+#define MN_FORM5 115
+#define MN_FORM6 116
+#define MN_FORM7 117
+#define MN_FORM8 118
+#define MN_FORM9 119
+#define MN_SAVE 120
+
+#define FL_LEVEL 130
+#define LB_LEVEL 131
+#define WIN_PREVIEW 132
+#define FT_SUFFIX 134
+#define ED_SUFFIX 135
+#define FT_PREFIX 136
+#define ED_PREFIX 137
+#define ST_NO_COLL 138
+
+#define ST_FORM 140
+#define FT_CHARFMT 141
+#define LB_CHARFMT 141
diff --git a/sw/source/ui/misc/outline.src b/sw/source/ui/misc/outline.src
new file mode 100644
index 000000000000..85ea42df4861
--- /dev/null
+++ b/sw/source/ui/misc/outline.src
@@ -0,0 +1,383 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "misc.hrc"
+#include "outline.hrc"
+#include "globals.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ModalDialog DLG_NUM_NAMES
+{
+ HelpID = HID_NUM_NAMES ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 164 , 82 ) ;
+ Text [ en-US ] = "Save As";
+ Moveable = TRUE ;
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 108 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 108 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 108 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_FORM
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 96 , 8 ) ;
+ Text [ en-US ] = "Format" ;
+ };
+ ListBox LB_FORM
+ {
+ HelpID = "sw:ListBox:DLG_NUM_NAMES:LB_FORM";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 29 ) ;
+ Size = MAP_APPFONT ( 84 , 42 ) ;
+ TabStop = TRUE ;
+ CurPos = 0 ;
+ StringList [ en-US ] =
+ {
+ < "Untitled 1" ; > ;
+ < "Untitled 2" ; > ;
+ < "Untitled 3" ; > ;
+ < "Untitled 4" ; > ;
+ < "Untitled 5" ; > ;
+ < "Untitled 6" ; > ;
+ < "Untitled 7" ; > ;
+ < "Untitled 8" ; > ;
+ < "Untitled 9" ; > ;
+ };
+ };
+ Edit ED_FORM
+ {
+ HelpID = "sw:Edit:DLG_NUM_NAMES:ED_FORM";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 84 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+};
+/**************************************************************************/
+/* */
+/* */
+/* */
+/**************************************************************************/
+TabDialog DLG_TAB_OUTLINE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ // --> OD 2008-04-14 #outlinelevel#
+ // dialog title is now given by resource STR_OUTLINE_NUMBERING
+// Text [ en-US ] = "Outline Numbering" ;
+ // <--
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ SVLook = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_OUTLINE_NUM ;
+ Text [ en-US ] = "Numbering" ;
+ };
+ PageItem
+ {
+ Identifier = TP_NUM_POSITION ;
+ Text [ en-US ] = "Position" ;
+ };
+ };
+ };
+ String ST_FORM
+ {
+ Text [ en-US ] = "~Format" ;
+ };
+ Menu MN_FORM
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_FORM1 ;
+ Text [ en-US ] = "Untitled 1" ;
+ HelpID = HID_NUM_OUTL_NAMED_NUMS ;
+ };
+ MenuItem
+ {
+ Identifier = MN_FORM2 ;
+ Text [ en-US ] = "Untitled 2" ;
+ HelpID = HID_NUM_OUTL_NAMED_NUMS ;
+ };
+ MenuItem
+ {
+ Identifier = MN_FORM3 ;
+ Text [ en-US ] = "Untitled 3" ;
+ HelpID = HID_NUM_OUTL_NAMED_NUMS ;
+ };
+ MenuItem
+ {
+ Identifier = MN_FORM4 ;
+ Text [ en-US ] = "Untitled 4" ;
+ HelpID = HID_NUM_OUTL_NAMED_NUMS ;
+ };
+ MenuItem
+ {
+ Identifier = MN_FORM5 ;
+ Text [ en-US ] = "Untitled 5" ;
+ HelpID = HID_NUM_OUTL_NAMED_NUMS ;
+ };
+ MenuItem
+ {
+ Identifier = MN_FORM6 ;
+ Text [ en-US ] = "Untitled 6" ;
+ HelpID = HID_NUM_OUTL_NAMED_NUMS ;
+ };
+ MenuItem
+ {
+ Identifier = MN_FORM7 ;
+ Text [ en-US ] = "Untitled 7" ;
+ HelpID = HID_NUM_OUTL_NAMED_NUMS ;
+ };
+ MenuItem
+ {
+ Identifier = MN_FORM8 ;
+ Text [ en-US ] = "Untitled 8" ;
+ HelpID = HID_NUM_OUTL_NAMED_NUMS ;
+ };
+ MenuItem
+ {
+ Identifier = MN_FORM9 ;
+ Text [ en-US ] = "Untitled 9" ;
+ HelpID = HID_NUM_OUTL_NAMED_NUMS ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = MN_SAVE ;
+ Text [ en-US ] = "Save ~As...";
+ HelpID = HID_NUM_OUTL_NUM_SAVEAS ;
+ };
+ };
+ };
+};
+/**************************************************************************/
+/* */
+/* TabPage */
+/* */
+/**************************************************************************/
+TabPage TP_OUTLINE_NUM
+{
+ HelpID = HID_TP_OUTLINE_NUM ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ ListBox LB_LEVEL
+ {
+ HelpID = "sw:ListBox:TP_OUTLINE_NUM:LB_LEVEL";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 23 , 129 ) ;
+ TabStop = TRUE ;
+ DropDown = FALSE ;
+ Border = TRUE ;
+ };
+ FixedLine FL_LEVEL
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 32 , 8 ) ;
+ Text [ en-US ] = "Level" ;
+ };
+ FixedText FT_COLL
+ {
+ Pos = MAP_APPFONT ( 50 , 14 ) ;
+ Size = MAP_APPFONT ( 120 , 8 ) ;
+ Text [ en-US ] = "~Paragraph Style" ;
+ Group = TRUE ;
+ Left = TRUE ;
+ };
+ ListBox LB_COLL
+ {
+ HelpID = "sw:ListBox:TP_OUTLINE_NUM:LB_COLL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 50 , 25 ) ;
+ Size = MAP_APPFONT ( 120 , 75 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ Sort = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ };
+ FixedText FT_NUMBER
+ {
+ Pos = MAP_APPFONT ( 50 , 43 ) ;
+ Size = MAP_APPFONT ( 52 , 8 ) ;
+ Text [ en-US ] = "~Number" ;
+ Left = TRUE ;
+ };
+ ListBox LB_NUMBER
+ {
+ HelpID = "sw:ListBox:TP_OUTLINE_NUM:LB_NUMBER";
+ Pos = MAP_APPFONT ( 104 , 41 ) ;
+ Size = MAP_APPFONT ( 66 , 65 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ };
+ FixedText FT_CHARFMT
+ {
+ Pos = MAP_APPFONT ( 50 , 59 ) ;
+ Size = MAP_APPFONT ( 52 , 8 ) ;
+ Text [ en-US ] = "~Character Style" ;
+ };
+ ListBox LB_CHARFMT
+ {
+ HelpID = "sw:ListBox:TP_OUTLINE_NUM:LB_CHARFMT";
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Pos = MAP_APPFONT ( 104 , 57 ) ;
+ Size = MAP_APPFONT ( 66 , 65 ) ;
+ };
+ FixedText FT_ALL_LEVEL
+ {
+ Pos = MAP_APPFONT ( 50 , 75 ) ;
+ Size = MAP_APPFONT ( 52 , 8 ) ;
+ Text [ en-US ] = "Sho~w sublevels" ;
+ };
+ NumericField NF_ALL_LEVEL
+ {
+ HelpID = "sw:NumericField:TP_OUTLINE_NUM:NF_ALL_LEVEL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 104 , 73 ) ;
+ Size = MAP_APPFONT ( 66 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 10 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 10 ;
+ };
+ FixedText FT_DELIM
+ {
+ Pos = MAP_APPFONT ( 50 , 89 ) ;
+ Size = MAP_APPFONT ( 52 , 8 ) ;
+ Text [ en-US ] = "Separator" ;
+ Left = TRUE ;
+ };
+ FixedText FT_PREFIX
+ {
+ Pos = MAP_APPFONT ( 56 , 102 ) ;
+ Size = MAP_APPFONT ( 46 , 8 ) ;
+ Text [ en-US ] = "~Before" ;
+ Left = TRUE ;
+ };
+ Edit ED_PREFIX
+ {
+ HelpID = "sw:Edit:TP_OUTLINE_NUM:ED_PREFIX";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 104 , 100 ) ;
+ Size = MAP_APPFONT ( 66 , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_SUFFIX
+ {
+ Pos = MAP_APPFONT ( 56 , 117 ) ;
+ Size = MAP_APPFONT ( 46 , 8 ) ;
+ Text [ en-US ] = "~After" ;
+ Left = TRUE ;
+ };
+ Edit ED_SUFFIX
+ {
+ HelpID = "sw:Edit:TP_OUTLINE_NUM:ED_SUFFIX";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 104 , 115 ) ;
+ Size = MAP_APPFONT ( 66 , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ Left = TRUE ;
+ };
+ FixedText FT_START
+ {
+ Pos = MAP_APPFONT ( 50 , 133 ) ;
+ Size = MAP_APPFONT ( 52 , 8 ) ;
+ Text [ en-US ] = "~Start at" ;
+ Left = TRUE ;
+ };
+ NumericField ED_START
+ {
+ HelpID = "sw:NumericField:TP_OUTLINE_NUM:ED_START";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 104 , 131 ) ;
+ Size = MAP_APPFONT ( 66 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ Repeat = TRUE ;
+ Maximum = 999 ;
+ Value = 0 ;
+ First = 0 ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ };
+ FixedLine FL_NUMBER
+ {
+ Pos = MAP_APPFONT ( 44 , 3 ) ;
+ Size = MAP_APPFONT ( 210 , 8 ) ;
+ Text [ en-US ] = "Numbering" ;
+ Group = TRUE ;
+ };
+ Window WIN_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 179 , 14 ) ;
+ Size = MAP_APPFONT ( 72 , 129 ) ;
+ };
+ String ST_NO_COLL
+ {
+ Text [ en-US ] = "(none)" ;
+ };
+};
+
diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx
new file mode 100644
index 000000000000..9d940b33d332
--- /dev/null
+++ b/sw/source/ui/misc/pgfnote.cxx
@@ -0,0 +1,373 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <hintids.hxx>
+#include <tools/ref.hxx>
+#ifndef _SVX_DIALOGS_HRC
+#include <svx/dialogs.hrc>
+#endif
+#include <vcl/field.hxx>
+#include <vcl/svapp.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/syslocale.hxx>
+#include <editeng/sizeitem.hxx>
+#include <svx/pageitem.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <uitool.hxx>
+#include <pagedesc.hxx>
+#include <pgfnote.hxx>
+#include <uiitems.hxx>
+
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _MISC_HRC
+#include <misc.hrc>
+#endif
+#ifndef _PGFNOTE_HRC
+#include <pgfnote.hrc>
+#endif
+
+#define TWIP_TO_LBOX 5
+/*-----------------------------------------------------#---------------
+ Beschreibung: vordefinierte Linien in Point
+ --------------------------------------------------------------------*/
+
+static const USHORT __FAR_DATA nLines[] = {
+ 0,
+ 50,
+ 100,
+ 150,
+ 200,
+ 500
+};
+
+static const USHORT nLineCount = sizeof(nLines) / sizeof(nLines[0]);
+
+static USHORT __FAR_DATA aPageRg[] = {
+ FN_PARAM_FTN_INFO, FN_PARAM_FTN_INFO,
+ 0
+};
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: liefert zurueck, ob die Linienbreite nWidth bereits
+ in der Listbox enthalten ist.
+------------------------------------------------------------------------*/
+
+
+BOOL lcl_HasLineWidth(USHORT nWidth)
+{
+ for(USHORT i = 0; i < nLineCount; ++i) {
+ if(nLines[i] == nWidth)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Handler fuer umschalten zwischen den unterschiedlichen
+ Arten, wie die Hoehe des Fussnotenbereiches angegeben
+ werden kann.
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK_INLINE_START( SwFootNotePage, HeightPage, Button *, EMPTYARG )
+{
+ aMaxHeightEdit.Enable(FALSE);
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwFootNotePage, HeightPage, Button *, EMPTYARG )
+
+
+IMPL_LINK_INLINE_START( SwFootNotePage, HeightMetric, Button *, EMPTYARG )
+{
+ aMaxHeightEdit.Enable();
+ aMaxHeightEdit.GrabFocus();
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwFootNotePage, HeightMetric, Button *, EMPTYARG )
+
+/*------------------------------------------------------------------------
+ Beschreibung: Handler Grenzwerte
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwFootNotePage, HeightModify, MetricField *, EMPTYARG )
+{
+ aMaxHeightEdit.SetMax(aMaxHeightEdit.Normalize(lMaxHeight -
+ (aDistEdit.Denormalize(aDistEdit.GetValue(FUNIT_TWIP)) +
+ aLineDistEdit.Denormalize(aLineDistEdit.GetValue(FUNIT_TWIP)))),
+ FUNIT_TWIP);
+ if(aMaxHeightEdit.GetValue() < 0)
+ aMaxHeightEdit.SetValue(0);
+ aDistEdit.SetMax(aDistEdit.Normalize(lMaxHeight -
+ (aMaxHeightEdit.Denormalize(aMaxHeightEdit.GetValue(FUNIT_TWIP)) +
+ aLineDistEdit.Denormalize(aLineDistEdit.GetValue(FUNIT_TWIP)))),
+ FUNIT_TWIP);
+ if(aDistEdit.GetValue() < 0)
+ aDistEdit.SetValue(0);
+ aLineDistEdit.SetMax(aLineDistEdit.Normalize(lMaxHeight -
+ (aMaxHeightEdit.Denormalize(aMaxHeightEdit.GetValue(FUNIT_TWIP)) +
+ aDistEdit.Denormalize(aDistEdit.GetValue(FUNIT_TWIP)))),
+ FUNIT_TWIP);
+ return 0;
+}
+
+// CTOR / DTOR -----------------------------------------------------------
+
+SwFootNotePage::SwFootNotePage(Window *pParent, const SfxItemSet &rSet) :
+
+ SfxTabPage(pParent, SW_RES(TP_FOOTNOTE_PAGE), rSet),
+
+ aMaxHeightPageBtn(this, SW_RES(RB_MAXHEIGHT_PAGE)),
+ aMaxHeightBtn(this, SW_RES(RB_MAXHEIGHT)),
+ aMaxHeightEdit(this, SW_RES(ED_MAXHEIGHT)),
+ aDistLbl(this, SW_RES(FT_DIST)),
+ aDistEdit(this, SW_RES(ED_DIST)),
+ aPosHeader(this, SW_RES(FL_FOOTNOTE_SIZE)),
+
+ aLinePosLbl(this, SW_RES(FT_LINEPOS)),
+ aLinePosBox(this, SW_RES(DLB_LINEPOS)),
+ aLineTypeLbl(this, SW_RES(FT_LINETYPE)),
+ aLineTypeBox(this, SW_RES(DLB_LINETYPE)),
+ aLineWidthLbl(this, SW_RES(FT_LINEWIDTH)),
+ aLineWidthEdit(this, SW_RES(ED_LINEWIDTH)),
+ aLineDistLbl(this, SW_RES(FT_LINEDIST)),
+ aLineDistEdit(this, SW_RES(ED_LINEDIST)),
+ aLineHeader(this, SW_RES(FL_LINE))
+{
+ FreeResource();
+
+ SetExchangeSupport();
+ FieldUnit aMetric = ::GetDfltMetric(FALSE);
+ SetMetric( aMaxHeightEdit, aMetric );
+ SetMetric( aDistEdit, aMetric );
+ SetMetric( aLineDistEdit, aMetric );
+ MeasurementSystem eSys = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum();
+ long nHeightValue = MEASURE_METRIC != eSys ? 1440 : 1134;
+ aMaxHeightEdit.SetValue(aMaxHeightEdit.Normalize(nHeightValue),FUNIT_TWIP);;
+}
+
+SwFootNotePage::~SwFootNotePage()
+{
+}
+
+
+SfxTabPage* SwFootNotePage::Create(Window *pParent, const SfxItemSet &rSet)
+{
+ return new SwFootNotePage(pParent, rSet);
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwFootNotePage::Reset(const SfxItemSet &rSet)
+{
+ // Falls noch kein Bsp vorhanden Init hier sonst im Activate
+ //
+ SwPageFtnInfo* pDefFtnInfo = 0;
+ const SwPageFtnInfo* pFtnInfo;
+ const SfxPoolItem* pItem = SfxTabPage::GetItem(rSet, FN_PARAM_FTN_INFO);
+ if( pItem )
+ {
+ pFtnInfo = &((const SwPageFtnInfoItem*)pItem)->GetPageFtnInfo();
+ }
+ else
+ {
+ // wenn "Standard" betaetigt wird, wird das Fussnotenitem geloescht,
+ // deswegen muss hier eine Fussnotenstruktur erzeugt werden
+ pDefFtnInfo = new SwPageFtnInfo();
+ pFtnInfo = pDefFtnInfo;
+ }
+ // Hoehe Fussnotenbereich
+ SwTwips lHeight = pFtnInfo->GetHeight();
+ if(lHeight)
+ {
+ aMaxHeightEdit.SetValue(aMaxHeightEdit.Normalize(lHeight),FUNIT_TWIP);
+ aMaxHeightBtn.Check(TRUE);
+ }
+ else
+ {
+ aMaxHeightPageBtn.Check(TRUE);
+ aMaxHeightEdit.Enable(FALSE);
+ }
+ aMaxHeightPageBtn.SetClickHdl(LINK(this,SwFootNotePage,HeightPage));
+ aMaxHeightBtn.SetClickHdl(LINK(this,SwFootNotePage,HeightMetric));
+ Link aLk = LINK(this, SwFootNotePage, HeightModify);
+ aMaxHeightEdit.SetLoseFocusHdl( aLk );
+ aDistEdit.SetLoseFocusHdl( aLk );
+ aLineDistEdit.SetLoseFocusHdl( aLk );
+
+ // Trennlinie
+ for(USHORT i = 0; i < nLineCount; ++i)
+ aLineTypeBox.InsertEntry(nLines[i]);
+
+ const USHORT nWidth = (USHORT)pFtnInfo->GetLineWidth() * TWIP_TO_LBOX;
+ if ( !lcl_HasLineWidth(nWidth) )
+ aLineTypeBox.InsertEntry(nWidth);
+ aLineTypeBox.SelectEntry(nWidth);
+
+ // Position
+ aLinePosBox.SelectEntryPos( static_cast< USHORT >(pFtnInfo->GetAdj()) );
+
+ // Breite
+ Fraction aTmp( 100, 1 );
+ aTmp *= pFtnInfo->GetWidth();
+ aLineWidthEdit.SetValue( static_cast<long>(aTmp) );
+
+ // Abstand Fussnotenbereich
+ aDistEdit.SetValue(aDistEdit.Normalize(pFtnInfo->GetTopDist()),FUNIT_TWIP);
+ aLineDistEdit.SetValue(
+ aLineDistEdit.Normalize(pFtnInfo->GetBottomDist()), FUNIT_TWIP);
+ ActivatePage( rSet );
+ delete pDefFtnInfo;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Attribute in den Set stopfen bei OK
+ --------------------------------------------------------------------*/
+
+
+BOOL SwFootNotePage::FillItemSet(SfxItemSet &rSet)
+{
+ SwPageFtnInfoItem aItem((const SwPageFtnInfoItem&)GetItemSet().Get(FN_PARAM_FTN_INFO));
+
+ // Das ist das Original
+ SwPageFtnInfo &rFtnInfo = aItem.GetPageFtnInfo();
+
+ // Hoehe Fussnotenbereich
+ if(aMaxHeightBtn.IsChecked())
+ rFtnInfo.SetHeight( static_cast< SwTwips >(
+ aMaxHeightEdit.Denormalize(aMaxHeightEdit.GetValue(FUNIT_TWIP))));
+ else
+ rFtnInfo.SetHeight(0);
+
+ // Abstand Fussnotenbereich
+ rFtnInfo.SetTopDist( static_cast< SwTwips >(
+ aDistEdit.Denormalize(aDistEdit.GetValue(FUNIT_TWIP))));
+ rFtnInfo.SetBottomDist( static_cast< SwTwips >(
+ aLineDistEdit.Denormalize(aLineDistEdit.GetValue(FUNIT_TWIP))));
+
+ // Trennlinie
+ const USHORT nPos = aLineTypeBox.GetSelectEntryPos();
+ if( LISTBOX_ENTRY_NOTFOUND != nPos )
+ rFtnInfo.SetLineWidth(nLines[nPos] / TWIP_TO_LBOX);
+
+ // Position
+ rFtnInfo.SetAdj((SwFtnAdj)aLinePosBox.GetSelectEntryPos());
+
+ // Breite
+ rFtnInfo.SetWidth(Fraction( static_cast< long >(aLineWidthEdit.GetValue()), 100));
+
+ const SfxPoolItem* pOldItem;
+ if(0 == (pOldItem = GetOldItem( rSet, FN_PARAM_FTN_INFO )) ||
+ aItem != *pOldItem )
+ rSet.Put(aItem);
+
+ return TRUE;
+}
+
+void SwFootNotePage::ActivatePage(const SfxItemSet& rSet)
+{
+ const SvxSizeItem& rSize = (const SvxSizeItem&)rSet.Get( RES_FRM_SIZE );
+ lMaxHeight = rSize.GetSize().Height();
+
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == rSet.GetItemState( rSet.GetPool()->GetWhich( SID_ATTR_PAGE_HEADERSET), FALSE, &pItem ) )
+ {
+ const SfxItemSet& rHeaderSet = ((SvxSetItem*)pItem)->GetItemSet();
+ const SfxBoolItem& rHeaderOn =
+ (const SfxBoolItem&)rHeaderSet.Get( rSet.GetPool()->GetWhich( SID_ATTR_PAGE_ON ) );
+
+ if ( rHeaderOn.GetValue() )
+ {
+ const SvxSizeItem& rSizeItem =
+ (const SvxSizeItem&)rHeaderSet.Get(rSet.GetPool()->GetWhich(SID_ATTR_PAGE_SIZE));
+ lMaxHeight -= rSizeItem.GetSize().Height();
+ }
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState( rSet.GetPool()->GetWhich( SID_ATTR_PAGE_FOOTERSET),
+ FALSE, &pItem ) )
+ {
+ const SfxItemSet& rFooterSet = ((SvxSetItem*)pItem)->GetItemSet();
+ const SfxBoolItem& rFooterOn =
+ (const SfxBoolItem&)rFooterSet.Get( SID_ATTR_PAGE_ON );
+
+ if ( rFooterOn.GetValue() )
+ {
+ const SvxSizeItem& rSizeItem =
+ (const SvxSizeItem&)rFooterSet.Get( rSet.GetPool()->GetWhich( SID_ATTR_PAGE_SIZE ) );
+ lMaxHeight -= rSizeItem.GetSize().Height();
+ }
+ }
+
+ if ( rSet.GetItemState( RES_UL_SPACE , FALSE ) == SFX_ITEM_SET )
+ {
+ const SvxULSpaceItem &rUL = (const SvxULSpaceItem&)rSet.Get( RES_UL_SPACE );
+ lMaxHeight -= rUL.GetUpper() + rUL.GetLower();
+ }
+
+ lMaxHeight *= 8;
+ lMaxHeight /= 10;
+
+ // Maximalwerte setzen
+ HeightModify(0);
+}
+
+int SwFootNotePage::DeactivatePage( SfxItemSet* _pSet)
+{
+ if(_pSet)
+ FillItemSet(*_pSet);
+
+ return TRUE;
+}
+
+USHORT* SwFootNotePage::GetRanges()
+{
+ return aPageRg;
+}
+
+
+
diff --git a/sw/source/ui/misc/pgfnote.hrc b/sw/source/ui/misc/pgfnote.hrc
new file mode 100644
index 000000000000..fe94849c6d66
--- /dev/null
+++ b/sw/source/ui/misc/pgfnote.hrc
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define RB_MAXHEIGHT_PAGE 1
+#define RB_MAXHEIGHT 2
+#define ED_MAXHEIGHT 3
+#define FT_DIST 4
+#define ED_DIST 5
+#define FL_FOOTNOTE_SIZE 10
+
+#define FT_LINETYPE 20
+#define DLB_LINETYPE 21
+#define FT_LINEPOS 22
+#define DLB_LINEPOS 23
+#define FT_LINEWIDTH 24
+#define ED_LINEWIDTH 25
+#define FT_LINEDIST 26
+#define ED_LINEDIST 27
+#define FL_LINE 30
+
diff --git a/sw/source/ui/misc/pgfnote.src b/sw/source/ui/misc/pgfnote.src
new file mode 100644
index 000000000000..7d74eeb567f3
--- /dev/null
+++ b/sw/source/ui/misc/pgfnote.src
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "globals.hrc"
+#include "pgfnote.hrc"
+#include "helpid.h"
+TabPage TP_FOOTNOTE_PAGE
+{
+ HelpID = HID_FOOTNOTE_PAGE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ RadioButton RB_MAXHEIGHT_PAGE
+ {
+ HelpID = "sw:RadioButton:TP_FOOTNOTE_PAGE:RB_MAXHEIGHT_PAGE";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 132 , 10 ) ;
+ Text [ en-US ] = "~Not larger than page area" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ RadioButton RB_MAXHEIGHT
+ {
+ HelpID = "sw:RadioButton:TP_FOOTNOTE_PAGE:RB_MAXHEIGHT";
+ Pos = MAP_APPFONT ( 12 , 28 ) ;
+ Size = MAP_APPFONT ( 132 , 10 ) ;
+ Text [ en-US ] = "Maximum footnote ~height" ;
+ };
+ MetricField ED_MAXHEIGHT
+ {
+ HelpID = "sw:MetricField:TP_FOOTNOTE_PAGE:ED_MAXHEIGHT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 148 , 26 ) ;
+ Size = MAP_APPFONT ( 42 , 12 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 50 ;
+ Maximum = 99999 ;
+ DecimalDigits = 2 ;
+ Value = 200 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 99999 ;
+ SpinSize = 10 ;
+ };
+ FixedText FT_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 44 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Text [ en-US ] = "Space to text" ;
+ Left = TRUE ;
+ };
+ MetricField ED_DIST
+ {
+ HelpID = "sw:MetricField:TP_FOOTNOTE_PAGE:ED_DIST";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 148 , 42 ) ;
+ Size = MAP_APPFONT ( 42 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 999 ;
+ DecimalDigits = 2 ;
+ Value = 10 ;
+ Unit = FUNIT_CM ;
+ First = 5 ;
+ Last = 99999 ;
+ SpinSize = 10 ;
+ };
+ FixedLine FL_FOOTNOTE_SIZE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Footnote area" ;
+ };
+ FixedText FT_LINEPOS
+ {
+ Pos = MAP_APPFONT ( 12 , 73 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Position" ;
+ };
+ ListBox DLB_LINEPOS
+ {
+ HelpID = "sw:ListBox:TP_FOOTNOTE_PAGE:DLB_LINEPOS";
+ Pos = MAP_APPFONT ( 148 , 71 ) ;
+ Size = MAP_APPFONT ( 57 , 40 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ StringList [ en-US ] =
+ {
+ < "Left" ; Default ; > ;
+ < "Centered" ; Default ; > ;
+ < "Right" ; Default ; > ;
+ };
+ };
+ FixedText FT_LINETYPE
+ {
+ Pos = MAP_APPFONT ( 12 , 89 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Group = TRUE ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Weight" ;
+ };
+ ListBox DLB_LINETYPE
+ {
+ HelpID = "sw:ListBox:TP_FOOTNOTE_PAGE:DLB_LINETYPE";
+ Pos = MAP_APPFONT ( 148 , 87 ) ;
+ Size = MAP_APPFONT ( 57 , 50 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ };
+
+ FixedText FT_LINEWIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 105 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Left = TRUE ;
+ Text [ en-US ] = "~Length" ;
+ };
+ MetricField ED_LINEWIDTH
+ {
+ HelpID = "sw:MetricField:TP_FOOTNOTE_PAGE:ED_LINEWIDTH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 148 , 103 ) ;
+ Size = MAP_APPFONT ( 42 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 100 ;
+ Value = 100 ;
+ Unit = FUNIT_CUSTOM ;
+ CustomUnitText = "%" ;
+ First = 10 ;
+ Last = 100 ;
+ };
+ FixedText FT_LINEDIST
+ {
+ Pos = MAP_APPFONT ( 12 , 121 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Text [ en-US ] = "~Spacing to footnote contents" ;
+ Left = TRUE ;
+ };
+ MetricField ED_LINEDIST
+ {
+ HelpID = "sw:MetricField:TP_FOOTNOTE_PAGE:ED_LINEDIST";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 148 , 119 ) ;
+ Size = MAP_APPFONT ( 42 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Maximum = 999 ;
+ DecimalDigits = 2 ;
+ Value = 10 ;
+ Unit = FUNIT_CM ;
+ First = 5 ;
+ Last = 99999 ;
+ SpinSize = 10 ;
+ };
+ FixedLine FL_LINE
+ {
+ Pos = MAP_APPFONT ( 6 , 60 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Separator line" ;
+ };
+};
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
new file mode 100644
index 000000000000..a6e20cc56dc3
--- /dev/null
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -0,0 +1,521 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#include <sfx2/app.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <hintids.hxx>
+#include <swtypes.hxx>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <svx/xtable.hxx>
+#include <uitool.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <pggrid.hxx>
+#include <tgrditem.hxx>
+#include <pggrid.hrc>
+
+#include "wrtsh.hxx"
+#include "doc.hxx"
+#include "uiitems.hxx"
+#include "swmodule.hxx"
+#include "view.hxx"
+/*-- 06.02.2002 15:25:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwTextGridPage::SwTextGridPage(Window *pParent, const SfxItemSet &rSet) :
+ SfxTabPage(pParent, SW_RES(TP_TEXTGRID_PAGE), rSet),
+ aGridTypeFL (this, SW_RES(FL_GRID_TYPE )),
+ aNoGridRB (this, SW_RES(RB_NOGRID )),
+ aLinesGridRB (this, SW_RES(RB_LINESGRID )),
+ aCharsGridRB (this, SW_RES(RB_CHARSGRID )),
+ aSnapToCharsCB (this, SW_RES(CB_SNAPTOCHARS )),
+ aExampleWN (this, SW_RES(WN_EXAMPLE )),
+ aLayoutFL (this, SW_RES(FL_LAYOUT )),
+ aLinesPerPageFT (this, SW_RES(FT_LINESPERPAGE )),
+ aLinesPerPageNF (this, SW_RES(NF_LINESPERPAGE )),
+ aTextSizeFT (this, SW_RES(FT_TEXTSIZE )),
+ aTextSizeMF (this, SW_RES(MF_TEXTSIZE )),
+ aCharsPerLineFT (this, SW_RES(FT_CHARSPERLINE )),
+ aCharsPerLineNF (this, SW_RES(NF_CHARSPERLINE )),
+ aCharWidthFT (this, SW_RES(FT_CHARWIDTH )),
+ aCharWidthMF (this, SW_RES(MF_CHARWIDTH )),
+ aRubySizeFT (this, SW_RES(FT_RUBYSIZE )),
+ aRubySizeMF (this, SW_RES(MF_RUBYSIZE )),
+ aRubyBelowCB (this, SW_RES(CB_RUBYBELOW )),
+ aDisplayFL (this, SW_RES(FL_DISPLAY )),
+ aDisplayCB (this, SW_RES(CB_DISPLAY )),
+ aPrintCB (this, SW_RES(CB_PRINT )),
+ aColorFT (this, SW_RES(FT_COLOR )),
+ aColorLB (this, SW_RES(LB_COLOR )),
+ m_nRubyUserValue(0),
+ m_bRubyUserValue(sal_False),
+ m_aPageSize(MM50, MM50),
+ m_bVertical(sal_False),
+ m_bSquaredMode(sal_False)
+{
+ FreeResource();
+
+ aControls[0] =&aLayoutFL;
+ aControls[1] =&aLinesPerPageFT;
+ aControls[2] =&aLinesPerPageNF;
+ aControls[3] =&aTextSizeFT;
+ aControls[4] =&aTextSizeMF;
+ aControls[5] =&aCharsPerLineFT;
+ aControls[6] =&aCharsPerLineNF;
+ aControls[7] =&aCharWidthFT;
+ aControls[8] =&aCharWidthMF;
+ aControls[9] =&aRubySizeFT;
+ aControls[10] =&aRubySizeMF;
+ aControls[11] =&aRubyBelowCB;
+ aControls[12] =&aDisplayFL;
+ aControls[13] =&aDisplayCB;
+ aControls[14] =&aPrintCB;
+ aControls[15] =&aColorFT;
+ aControls[16] =&aColorLB;
+ aControls[17] =0;
+
+ Link aLink = LINK(this, SwTextGridPage, CharorLineChangedHdl);
+ aCharsPerLineNF.SetUpHdl(aLink);
+ aCharsPerLineNF.SetDownHdl(aLink);
+ aCharsPerLineNF.SetLoseFocusHdl(aLink);
+ aLinesPerPageNF.SetUpHdl(aLink);
+ aLinesPerPageNF.SetDownHdl(aLink);
+ aLinesPerPageNF.SetLoseFocusHdl(aLink);
+
+ Link aSizeLink = LINK(this, SwTextGridPage, TextSizeChangedHdl);
+ aTextSizeMF.SetUpHdl(aSizeLink);
+ aTextSizeMF.SetDownHdl(aSizeLink);
+ aTextSizeMF.SetLoseFocusHdl(aSizeLink);
+ aRubySizeMF.SetUpHdl(aSizeLink);
+ aRubySizeMF.SetDownHdl(aSizeLink);
+ aRubySizeMF.SetLoseFocusHdl(aSizeLink);
+ aCharWidthMF.SetUpHdl(aSizeLink);
+ aCharWidthMF.SetDownHdl(aSizeLink);
+ aCharWidthMF.SetLoseFocusHdl(aSizeLink);
+
+ Link aGridTypeHdl = LINK(this, SwTextGridPage, GridTypeHdl);
+ aNoGridRB .SetClickHdl(aGridTypeHdl);
+ aLinesGridRB.SetClickHdl(aGridTypeHdl);
+ aCharsGridRB.SetClickHdl(aGridTypeHdl);
+
+ Link aModifyLk = LINK(this, SwTextGridPage, GridModifyHdl);
+ aColorLB.SetSelectHdl(aModifyLk);
+ aPrintCB.SetClickHdl(aModifyLk);
+ aRubyBelowCB.SetClickHdl(aModifyLk);
+
+
+ aDisplayCB.SetClickHdl(LINK(this, SwTextGridPage, DisplayGridHdl));
+
+ XColorTable* pColorTbl = XColorTable::GetStdColorTable();
+ aColorLB.InsertAutomaticEntry();
+ for( USHORT i = 0; i < pColorTbl->Count(); ++i )
+ {
+ XColorEntry* pEntry = pColorTbl->GetColor( i );
+ Color aColor = pEntry->GetColor();
+ String sName = pEntry->GetName();
+ aColorLB.InsertEntry( aColor, sName );
+ }
+ aColorLB.SetUpdateMode( TRUE );
+ //Get the default paper mode
+ SwView *pView = ::GetActiveView();
+ if( pView )
+ {
+ SwWrtShell* pSh = pView->GetWrtShellPtr();
+ if( pSh )
+ {
+ m_bSquaredMode = pSh->GetDoc()->IsSquaredPageMode();
+ }
+ }
+ if( m_bSquaredMode )
+ {
+ aRubySizeFT.Show();
+ aRubySizeMF.Show();
+ aRubyBelowCB.Show();
+ aSnapToCharsCB.Hide();
+ aCharWidthFT.Hide();
+ aCharWidthMF.Hide();
+ }
+ else
+ {
+ aRubySizeFT.Hide();
+ aRubySizeMF.Hide();
+ aRubyBelowCB.Hide();
+ aSnapToCharsCB.Show();
+ aCharWidthFT.Show();
+ aCharWidthMF.Show();
+ }
+}
+/*-- 06.02.2002 15:25:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwTextGridPage::~SwTextGridPage()
+{
+}
+/*-- 06.02.2002 15:25:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxTabPage *SwTextGridPage::Create(Window *pParent, const SfxItemSet &rSet)
+{
+ return new SwTextGridPage(pParent, rSet);
+}
+/*-- 06.02.2002 15:25:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+BOOL SwTextGridPage::FillItemSet(SfxItemSet &rSet)
+{
+ BOOL bRet = FALSE;
+ if(aNoGridRB.GetSavedValue() != aNoGridRB.IsChecked()||
+ aLinesGridRB.GetSavedValue() != aLinesGridRB.IsChecked()||
+ aLinesPerPageNF.GetSavedValue().ToInt32()
+ != aLinesPerPageNF.GetValue()||
+ aTextSizeMF.GetSavedValue().ToInt32() != aTextSizeMF.GetValue()||
+ aCharsPerLineNF.GetSavedValue().ToInt32()
+ != aCharsPerLineNF.GetValue()||
+ aSnapToCharsCB.GetSavedValue() != aSnapToCharsCB.IsChecked() ||
+ aRubySizeMF.GetSavedValue().ToInt32() != aRubySizeMF.GetValue()||
+ aCharWidthMF.GetSavedValue().ToInt32() != aCharWidthMF.GetValue()||
+ aRubyBelowCB.GetSavedValue() != aRubyBelowCB.IsChecked()||
+ aDisplayCB.GetSavedValue() != aDisplayCB.IsChecked()||
+ aPrintCB.GetSavedValue() != aPrintCB.IsChecked()||
+ aColorLB.GetSavedValue() != aColorLB.GetSelectEntryPos())
+ {
+ PutGridItem(rSet);
+ bRet = TRUE;
+ }
+
+ return bRet;
+}
+/*-- 06.02.2002 15:25:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwTextGridPage::Reset(const SfxItemSet &rSet)
+{
+ if(SFX_ITEM_AVAILABLE <= rSet.GetItemState(RES_TEXTGRID, TRUE))
+ {
+ const SwTextGridItem& rGridItem = (const SwTextGridItem&)rSet.Get(RES_TEXTGRID);
+ RadioButton* pButton = 0;
+ switch(rGridItem.GetGridType())
+ {
+ case GRID_NONE : pButton = &aNoGridRB; break;
+ case GRID_LINES_ONLY : pButton = &aLinesGridRB; break;
+ default: pButton = &aCharsGridRB;
+ }
+ pButton->Check();
+ aDisplayCB.Check(rGridItem.IsDisplayGrid());
+ GridTypeHdl(pButton);
+ aSnapToCharsCB.Check(rGridItem.IsSnapToChars());
+ aLinesPerPageNF.SetValue(rGridItem.GetLines());
+ m_nRubyUserValue = rGridItem.GetBaseHeight();
+ m_bRubyUserValue = sal_True;
+ aTextSizeMF.SetValue(aTextSizeMF.Normalize(m_nRubyUserValue), FUNIT_TWIP);
+ aRubySizeMF.SetValue(aRubySizeMF.Normalize(rGridItem.GetRubyHeight()), FUNIT_TWIP);
+ aCharWidthMF.SetValue(aCharWidthMF.Normalize(rGridItem.GetBaseWidth()), FUNIT_TWIP);
+ aRubyBelowCB.Check(rGridItem.IsRubyTextBelow());
+ aPrintCB.Check(rGridItem.IsPrintGrid());
+ aColorLB.SelectEntry(rGridItem.GetColor());
+ }
+ UpdatePageSize(rSet);
+
+ aNoGridRB.SaveValue();
+ aLinesGridRB.SaveValue();
+ aSnapToCharsCB.SaveValue();
+ aLinesPerPageNF.SaveValue();
+ aTextSizeMF.SaveValue();
+ aCharsPerLineNF.SaveValue();
+ aRubySizeMF.SaveValue();
+ aCharWidthMF.SaveValue();
+ aRubyBelowCB.SaveValue();
+ aDisplayCB.SaveValue();
+ aPrintCB.SaveValue();
+ aColorLB.SaveValue();
+}
+/*-- 06.02.2002 15:25:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwTextGridPage::ActivatePage( const SfxItemSet& rSet )
+{
+ aExampleWN.Hide();
+ aExampleWN.UpdateExample( rSet );
+ UpdatePageSize(rSet);
+ aExampleWN.Show();
+ aExampleWN.Invalidate();
+}
+/*-- 06.02.2002 15:25:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+int SwTextGridPage::DeactivatePage( SfxItemSet* )
+{
+ return LEAVE_PAGE;
+}
+/* -----------------------------08.02.2002 11:57------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwTextGridPage::PutGridItem(SfxItemSet& rSet)
+{
+ SwTextGridItem aGridItem;
+ aGridItem.SetGridType(aNoGridRB.IsChecked() ? GRID_NONE :
+ aLinesGridRB.IsChecked() ? GRID_LINES_ONLY : GRID_LINES_CHARS );
+ aGridItem.SetSnapToChars(aSnapToCharsCB.IsChecked());
+ aGridItem.SetLines( static_cast< sal_uInt16 >(aLinesPerPageNF.GetValue()) );
+ aGridItem.SetBaseHeight( static_cast< sal_uInt16 >(
+ m_bRubyUserValue ? m_nRubyUserValue :
+ aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP))) );
+ aGridItem.SetRubyHeight( static_cast< sal_uInt16 >(aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP))) );
+ aGridItem.SetBaseWidth( static_cast< sal_uInt16 >(aCharWidthMF.Denormalize(aCharWidthMF.GetValue(FUNIT_TWIP))) );
+ aGridItem.SetRubyTextBelow(aRubyBelowCB.IsChecked());
+ aGridItem.SetSquaredMode(m_bSquaredMode);
+ aGridItem.SetDisplayGrid(aDisplayCB.IsChecked());
+ aGridItem.SetPrintGrid(aPrintCB.IsChecked());
+ aGridItem.SetColor(aColorLB.GetSelectEntryColor());
+ rSet.Put(aGridItem);
+}
+/* -----------------------------08.02.2002 10:54------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwTextGridPage::UpdatePageSize(const SfxItemSet& rSet)
+{
+ if( SFX_ITEM_UNKNOWN != rSet.GetItemState( RES_FRAMEDIR, TRUE ))
+ {
+ const SvxFrameDirectionItem& rDirItem =
+ (const SvxFrameDirectionItem&)rSet.Get(RES_FRAMEDIR);
+ m_bVertical = rDirItem.GetValue() == FRMDIR_VERT_TOP_RIGHT||
+ rDirItem.GetValue() == FRMDIR_VERT_TOP_LEFT;
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_PAGE_SIZE ))
+ {
+ const SvxSizeItem& rSize = (const SvxSizeItem&)rSet.Get(
+ SID_ATTR_PAGE_SIZE);
+ const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)rSet.Get(
+ RES_LR_SPACE );
+ const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)rSet.Get(
+ RES_UL_SPACE );
+ const SvxBoxItem& rBox = (const SvxBoxItem&) rSet.Get(RES_BOX);
+ sal_Int32 nDistanceLR = rLRSpace.GetLeft() + rLRSpace.GetRight();
+ sal_Int32 nDistanceUL = rULSpace.GetUpper() + rULSpace.GetLower();
+
+ sal_Int32 nValue1 = rSize.GetSize().Height() - nDistanceUL -
+ rBox.GetDistance(BOX_LINE_TOP) -
+ rBox.GetDistance(BOX_LINE_BOTTOM);
+ sal_Int32 nValue2 = rSize.GetSize().Width() - nDistanceLR -
+ rBox.GetDistance(BOX_LINE_LEFT) -
+ rBox.GetDistance(BOX_LINE_RIGHT);
+ if(m_bVertical)
+ {
+ m_aPageSize.Width() = nValue1;
+ m_aPageSize.Height() = nValue2;
+ }
+ else
+ {
+ m_aPageSize.Width() = nValue2;
+ m_aPageSize.Height() = nValue1;
+ }
+
+ sal_Int32 nTextSize = static_cast< sal_Int32 >(m_bRubyUserValue ?
+ m_nRubyUserValue :
+ aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)));
+
+ if ( m_bSquaredMode )
+ {
+ aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextSize);
+ }
+ else
+ {
+ sal_Int32 nTextWidth = static_cast< sal_Int32 >(aCharWidthMF.Denormalize(aCharWidthMF.GetValue(FUNIT_TWIP)));
+ aLinesPerPageNF.SetValue(m_aPageSize.Height() / nTextSize);
+ if (nTextWidth)
+ aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextWidth);
+ else
+ aCharsPerLineNF.SetValue( 45 );
+ }
+ }
+}
+/* -----------------------------06.02.2002 15:24------------------------------
+
+ ---------------------------------------------------------------------------*/
+USHORT* SwTextGridPage::GetRanges()
+{
+ static USHORT __FAR_DATA aPageRg[] = {
+ RES_TEXTGRID, RES_TEXTGRID,
+ 0};
+ return aPageRg;
+}
+/* -----------------------------08.02.2002 10:56------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, SpinField*, pField)
+{
+ //if in squared mode
+ if ( m_bSquaredMode )
+ {
+ if(&aCharsPerLineNF == pField)
+ {
+ long nWidth = (long)(m_aPageSize.Width() / aCharsPerLineNF.GetValue());
+ aTextSizeMF.SetValue(aTextSizeMF.Normalize(nWidth), FUNIT_TWIP);
+ //prevent rounding errors in the MetricField by saving the used value
+ m_nRubyUserValue = nWidth;
+ m_bRubyUserValue = sal_True;
+
+ }
+ //set maximum line per page
+ {
+ sal_Int32 nMaxLines = static_cast< sal_Int32 >(m_aPageSize.Height() /
+ ( aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)) +
+ aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP))));
+ aLinesPerPageNF.SetMax(nMaxLines);
+ }
+ }
+ else//in normal mode
+ {
+ if(&aLinesPerPageNF == pField)
+ {
+ long nHeight = static_cast< sal_Int32 >(m_aPageSize.Height() / aLinesPerPageNF.GetValue());
+ aTextSizeMF.SetValue(aTextSizeMF.Normalize(nHeight), FUNIT_TWIP);
+ aRubySizeMF.SetValue(0, FUNIT_TWIP);
+
+ m_nRubyUserValue = nHeight;
+ m_bRubyUserValue = sal_True;
+ }
+ else if (&aCharsPerLineNF == pField)
+ {
+ long nWidth = static_cast< sal_Int32 >(m_aPageSize.Width() / aCharsPerLineNF.GetValue());
+ aCharWidthMF.SetValue(aCharWidthMF.Normalize(nWidth), FUNIT_TWIP);
+ }
+ }
+ GridModifyHdl(0);
+ return 0;
+}
+/* -----------------------------04.09.2006 15:46------------------------------
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField)
+{
+ //if in squared mode
+ if( m_bSquaredMode )
+ {
+ if (&aTextSizeMF == pField)
+ {
+ sal_Int32 nTextSize = static_cast< sal_Int32 >(aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)));
+ aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextSize);
+ m_bRubyUserValue = sal_False;
+ }
+ //set maximum line per page
+ {
+ sal_Int32 nMaxLines = static_cast< sal_Int32 >(m_aPageSize.Height() /
+ ( aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)) +
+ aRubySizeMF.Denormalize(aRubySizeMF.GetValue(FUNIT_TWIP))));
+ aLinesPerPageNF.SetMax(nMaxLines);
+ }
+ }
+ else
+ {
+ if (&aTextSizeMF == pField)
+ {
+ sal_Int32 nTextSize = static_cast< sal_Int32 >(aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP)));
+ aLinesPerPageNF.SetValue(m_aPageSize.Height() / nTextSize);
+ m_bRubyUserValue = sal_False;
+ }
+ else if (&aCharWidthMF == pField)
+ {
+ sal_Int32 nTextWidth = static_cast< sal_Int32 >(aCharWidthMF.Denormalize(aCharWidthMF.GetValue(FUNIT_TWIP)));
+ if (nTextWidth)
+ aCharsPerLineNF.SetValue(m_aPageSize.Width() / nTextWidth);
+ else
+ aCharsPerLineNF.SetValue( 45 );
+ }
+ //rubySize is disabled
+ }
+ GridModifyHdl(0);
+ return 0;
+}
+/* -----------------------------22.04.2002 14:53------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwTextGridPage, GridTypeHdl, RadioButton*, pButton)
+{
+ sal_Bool bEnable = &aNoGridRB != pButton;
+ sal_Int32 nIndex = 0;
+ while(aControls[nIndex])
+ aControls[nIndex++]->Enable(bEnable);
+ //one special case
+ if(bEnable)
+ DisplayGridHdl(&aDisplayCB);
+
+ bEnable = &aCharsGridRB == pButton;
+ aSnapToCharsCB.Enable(bEnable);
+
+ bEnable = &aLinesGridRB == pButton;
+ if(bEnable && !m_bSquaredMode )
+ {
+ aCharsPerLineFT.Enable(sal_False);
+ aCharsPerLineNF.Enable(sal_False);
+ aCharWidthFT.Enable(sal_False);
+ aCharWidthMF.Enable(sal_False);
+ }
+
+ GridModifyHdl(0);
+ return 0;
+}
+/* -----------------------------22.04.2002 15:46------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwTextGridPage, DisplayGridHdl, CheckBox*, EMPTYARG)
+{
+ aPrintCB.Enable(aDisplayCB.IsChecked());
+ return 0;
+}
+/* -----------------------------08.02.2002 11:54------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwTextGridPage, GridModifyHdl, void*, EMPTYARG)
+{
+ const SfxItemSet& rOldSet = GetItemSet();
+ SfxItemSet aSet(rOldSet);
+ const SfxItemSet* pExSet = GetTabDialog()->GetExampleSet();
+ if(pExSet)
+ aSet.Put(*pExSet);
+ PutGridItem(aSet);
+ aExampleWN.UpdateExample(aSet);
+ return 0;
+}
+
diff --git a/sw/source/ui/misc/pggrid.hrc b/sw/source/ui/misc/pggrid.hrc
new file mode 100644
index 000000000000..e156792c955d
--- /dev/null
+++ b/sw/source/ui/misc/pggrid.hrc
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FL_GRID_TYPE 1
+#define RB_NOGRID 2
+#define RB_LINESGRID 3
+#define RB_CHARSGRID 4
+#define WN_EXAMPLE 5
+#define FL_LAYOUT 6
+#define FT_LINESPERPAGE 7
+#define NF_LINESPERPAGE 8
+#define FT_LINESPERPAGEHINT 9
+#define FT_TEXTSIZE 10
+#define MF_TEXTSIZE 11
+#define FT_CHARSPERLINE 12
+#define NF_CHARSPERLINE 13
+#define FT_CHARSPERLINEHINT 14
+#define FT_RUBYSIZE 15
+#define MF_RUBYSIZE 16
+#define CB_RUBYBELOW 17
+#define FL_DISPLAY 18
+#define CB_DISPLAY 19
+#define CB_PRINT 20
+#define FT_COLOR 21
+#define LB_COLOR 22
+#define CB_SNAPTOCHARS 23
+#define FT_CHARWIDTH 24
+#define MF_CHARWIDTH 25
diff --git a/sw/source/ui/misc/pggrid.src b/sw/source/ui/misc/pggrid.src
new file mode 100644
index 000000000000..9fb24c12029f
--- /dev/null
+++ b/sw/source/ui/misc/pggrid.src
@@ -0,0 +1,244 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "globals.hrc"
+#include "pggrid.hrc"
+#include "helpid.h"
+TabPage TP_TEXTGRID_PAGE
+{
+ HelpID = HID_TEXTGRID_PAGE;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ FixedLine FL_GRID_TYPE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 164 , 8 ) ;
+ Text [ en-US ] = "Grid" ;
+ };
+ RadioButton RB_NOGRID
+ {
+ HelpID = "sw:RadioButton:TP_TEXTGRID_PAGE:RB_NOGRID";
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text [ en-US ] = "No grid" ;
+ };
+ RadioButton RB_LINESGRID
+ {
+ HelpID = "sw:RadioButton:TP_TEXTGRID_PAGE:RB_LINESGRID";
+ Pos = MAP_APPFONT ( 12 , 27 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text [ en-US ] = "Grid (lines only)" ;
+ };
+ RadioButton RB_CHARSGRID
+ {
+ HelpID = "sw:RadioButton:TP_TEXTGRID_PAGE:RB_CHARSGRID";
+ Pos = MAP_APPFONT ( 12 , 40 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text [ en-US ] = "Grid (lines and characters)" ;
+ };
+ CheckBox CB_SNAPTOCHARS
+ {
+ HelpID = "sw:CheckBox:TP_TEXTGRID_PAGE:CB_SNAPTOCHARS";
+ Pos = MAP_APPFONT ( 14 , 53 ) ;
+ Size = MAP_APPFONT ( 158 , 10 ) ;
+ Text [ en-US ] = "~Snap to characters" ;
+ Text [ zh-CN ] = "文字对é½å­—符网格" ;
+ };
+ Window WN_EXAMPLE
+ {
+ Pos = MAP_APPFONT ( 176 , 6 ) ;
+ Size = MAP_APPFONT ( 75 , 46 ) ;
+ };
+ FixedLine FL_LAYOUT
+ {
+ Pos = MAP_APPFONT ( 6 , 69 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Grid layout" ;
+ };
+ FixedText FT_LINESPERPAGE
+ {
+ Pos = MAP_APPFONT ( 12 , 82 ) ;
+ Size = MAP_APPFONT ( 59 , 8 ) ;
+ Text [ en-US ] = "Lines per page" ;
+ };
+ NumericField NF_LINESPERPAGE
+ {
+ HelpID = "sw:NumericField:TP_TEXTGRID_PAGE:NF_LINESPERPAGE";
+ Pos = MAP_APPFONT ( 74 , 80 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 154 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 154 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_TEXTSIZE
+ {
+ Pos = MAP_APPFONT ( 133 , 82 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Max. base text size" ;
+ };
+ MetricField MF_TEXTSIZE
+ {
+ HelpID = "sw:MetricField:TP_TEXTGRID_PAGE:MF_TEXTSIZE";
+ Pos = MAP_APPFONT ( 216 , 80 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 100 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_POINT ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_CHARSPERLINE
+ {
+ Pos = MAP_APPFONT ( 12 , 98 ) ;
+ Size = MAP_APPFONT ( 59 , 8 ) ;
+ Text [ en-US ] = "Characters per line" ;
+ };
+ NumericField NF_CHARSPERLINE
+ {
+ HelpID = "sw:NumericField:TP_TEXTGRID_PAGE:NF_CHARSPERLINE";
+ Pos = MAP_APPFONT ( 74 , 96 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 233 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 233 ;
+ SpinSize = 1 ;
+ };
+ FixedText FT_CHARWIDTH
+ {
+ Pos = MAP_APPFONT ( 133 , 98 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Character ~width" ;
+ Text [ zh-CN ] = "字符跨度" ;
+ };
+ MetricField MF_CHARWIDTH
+ {
+ HelpID = "sw:MetricField:TP_TEXTGRID_PAGE:MF_CHARWIDTH";
+ Pos = MAP_APPFONT ( 216 , 96 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 100 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_POINT;
+ First = 0 ;
+ Last = 5600 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_RUBYSIZE
+ {
+ Pos = MAP_APPFONT ( 133 , 98 ) ;
+ Size = MAP_APPFONT ( 80 , 8 ) ;
+ Text [ en-US ] = "Max. Ruby text size" ;
+ };
+ MetricField MF_RUBYSIZE
+ {
+ HelpID = "sw:MetricField:TP_TEXTGRID_PAGE:MF_RUBYSIZE";
+ Pos = MAP_APPFONT ( 216 , 96 ) ;
+ Size = MAP_APPFONT ( 35 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 100 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_POINT;
+ First = 0 ;
+ Last = 5600 ;
+ SpinSize = 5 ;
+ };
+ CheckBox CB_RUBYBELOW
+ {
+ HelpID = "sw:CheckBox:TP_TEXTGRID_PAGE:CB_RUBYBELOW";
+ Pos = MAP_APPFONT ( 14 , 112 ) ;
+ Size = MAP_APPFONT ( 237 , 10 ) ;
+ Text [ en-US ] = "Ruby text below/left from base text" ;
+ };
+ FixedLine FL_DISPLAY
+ {
+ Pos = MAP_APPFONT ( 6 , 128 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Grid display" ;
+ };
+ CheckBox CB_DISPLAY
+ {
+ HelpID = "sw:CheckBox:TP_TEXTGRID_PAGE:CB_DISPLAY";
+ Pos = MAP_APPFONT ( 12 , 139 ) ;
+ Size = MAP_APPFONT ( 118 , 10 ) ;
+ Text [ en-US ] = "Display grid" ;
+ };
+ CheckBox CB_PRINT
+ {
+ HelpID = "sw:CheckBox:TP_TEXTGRID_PAGE:CB_PRINT";
+ Pos = MAP_APPFONT ( 18 , 154 ) ;
+ Size = MAP_APPFONT ( 112 , 10 ) ;
+ Text [ en-US ] = "Print grid" ;
+ };
+ FixedText FT_COLOR
+ {
+ Pos = MAP_APPFONT ( 133 , 139 ) ;
+ Size = MAP_APPFONT ( 55 , 8 ) ;
+ Text [ en-US ] = "Grid color" ;
+ };
+ ListBox LB_COLOR
+ {
+ HelpID = "sw:ListBox:TP_TEXTGRID_PAGE:LB_COLOR";
+ Pos = MAP_APPFONT ( 191 , 137 ) ;
+ Size = MAP_APPFONT ( 60 , 50 ) ;
+ TabStop = TRUE;
+ Border = TRUE;
+ DropDown = TRUE;
+ };
+};
+
diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx
new file mode 100644
index 000000000000..19decf172798
--- /dev/null
+++ b/sw/source/ui/misc/redlndlg.cxx
@@ -0,0 +1,1405 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#define _SVSTDARR_STRINGSSORTDTOR
+#define _SVSTDARR_USHORTSSORT
+#define _SVSTDARR_USHORTS
+
+
+#include <redline.hxx>
+#include <tools/datetime.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/svstdarr.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/ctredlin.hxx>
+#include <svx/postattr.hxx>
+#include <swtypes.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <swmodule.hxx>
+#ifndef _REDLNDLG_HXX
+#define _REDLNACCEPTDLG
+#include <redlndlg.hxx>
+#endif
+#include <swwait.hxx>
+#include <uitool.hxx>
+
+#include <helpid.h>
+#include <cmdid.h>
+#include <misc.hrc>
+#include <redlndlg.hrc>
+#include <shells.hrc>
+
+// -> #111827#
+#include <comcore.hrc>
+#include <swundo.hxx>
+#include <SwRewriter.hxx>
+// <- #111827#
+
+#include <vector>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+#include <unomid.h>
+
+#include <docsh.hxx>
+
+#include <IDocumentRedlineAccess.hxx>
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SFX_IMPL_MODELESSDIALOG( SwRedlineAcceptChild, FN_REDLINE_ACCEPT )
+
+SV_IMPL_PTRARR(SwRedlineDataParentArr, SwRedlineDataParentPtr)
+SV_IMPL_OP_PTRARR_SORT(SwRedlineDataParentSortArr, SwRedlineDataParentPtr)
+SV_IMPL_PTRARR(SwRedlineDataChildArr, SwRedlineDataChildPtr)
+SV_IMPL_PTRARR(SvLBoxEntryArr, SvLBoxEntryPtr)
+
+static USHORT nSortMode = 0xffff;
+static BOOL bSortDir = TRUE;
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwRedlineAcceptChild::SwRedlineAcceptChild( Window* _pParent,
+ USHORT nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo ) :
+ SwChildWinWrapper( _pParent, nId )
+{
+ pWindow = new SwModelessRedlineAcceptDlg( pBindings, this, _pParent);
+
+ ((SwModelessRedlineAcceptDlg *)pWindow)->Initialize(pInfo);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nach Dok-Wechsel Dialog neu initialisieren
+ --------------------------------------------------------------------*/
+
+BOOL SwRedlineAcceptChild::ReInitDlg(SwDocShell *pDocSh)
+{
+ BOOL bRet;
+
+ if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh)) == TRUE) // Sofort aktualisieren, Dok-Wechsel
+ ((SwModelessRedlineAcceptDlg*)GetWindow())->Activate();
+
+ return bRet;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwModelessRedlineAcceptDlg::SwModelessRedlineAcceptDlg( SfxBindings* _pBindings,
+ SwChildWinWrapper* pChild,
+ Window *_pParent) :
+ SfxModelessDialog(_pBindings, pChild, _pParent, SW_RES(DLG_REDLINE_ACCEPT)),
+ pChildWin (pChild)
+{
+ pImplDlg = new SwRedlineAcceptDlg(this);
+
+ FreeResource();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwModelessRedlineAcceptDlg::Activate()
+{
+ SwView *pView = ::GetActiveView();
+
+ if (!pView) // Kann passieren, wenn man auf eine andere App umschaltet, wenn
+ return; // vorher eine Listbox im Dialog den Focus hatte (eigentlich THs Bug)
+
+ SwDocShell *pDocSh = pView->GetDocShell();
+
+ if (pChildWin->GetOldDocShell() != pDocSh)
+ { // Dok-Wechsel
+ SwWait aWait( *pDocSh, FALSE );
+ SwWrtShell* pSh = pView->GetWrtShellPtr();
+
+ pChildWin->SetOldDocShell(pDocSh); // Rekursion vermeiden (durch Modified-Hdl)
+
+ BOOL bMod = pSh->IsModified();
+ SfxBoolItem aShow(FN_REDLINE_SHOW, TRUE);
+ pSh->GetView().GetViewFrame()->GetDispatcher()->Execute(
+ FN_REDLINE_SHOW, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aShow, 0L);
+ if (!bMod)
+ pSh->ResetModified();
+ pImplDlg->Init();
+
+ return;
+ }
+
+ pImplDlg->Activate();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwModelessRedlineAcceptDlg::Initialize(SfxChildWinInfo *pInfo)
+{
+ String aStr;
+ if (pInfo != NULL)
+ pImplDlg->Initialize(pInfo->aExtraString);
+
+ SfxModelessDialog::Initialize(pInfo);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwModelessRedlineAcceptDlg::FillInfo(SfxChildWinInfo& rInfo) const
+{
+ SfxModelessDialog::FillInfo(rInfo);
+ pImplDlg->FillInfo(rInfo.aExtraString);
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwModelessRedlineAcceptDlg::Resize()
+{
+ pImplDlg->Resize();
+ SfxModelessDialog::Resize();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwModelessRedlineAcceptDlg::~SwModelessRedlineAcceptDlg()
+{
+ delete pImplDlg;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwRedlineAcceptDlg::SwRedlineAcceptDlg(Dialog *pParent, BOOL bAutoFmt) :
+ pParentDlg (pParent),
+ aTabPagesCTRL (pParent, SW_RES(CTRL_TABPAGES)),
+ aPopup (SW_RES(MN_REDLINE_POPUP)),
+ sInserted (SW_RES(STR_REDLINE_INSERTED)),
+ sDeleted (SW_RES(STR_REDLINE_DELETED)),
+ sFormated (SW_RES(STR_REDLINE_FORMATED)),
+ sTableChgd (SW_RES(STR_REDLINE_TABLECHG)),
+ sFmtCollSet (SW_RES(STR_REDLINE_FMTCOLLSET)),
+ sAutoFormat (SW_RES(STR_REDLINE_AUTOFMT)),
+ bOnlyFormatedRedlines( FALSE ),
+ bHasReadonlySel ( FALSE ),
+ bRedlnAutoFmt (bAutoFmt),
+ bInhibitActivate( false )
+{
+ aTabPagesCTRL.SetHelpId(HID_REDLINE_CTRL);
+ pTPView = aTabPagesCTRL.GetViewPage();
+ pTable = pTPView->GetTableControl();
+
+ pTPView->InsertWriterHeader();
+ pTPView->SetAcceptClickHdl(LINK(this, SwRedlineAcceptDlg, AcceptHdl));
+ pTPView->SetAcceptAllClickHdl(LINK(this, SwRedlineAcceptDlg, AcceptAllHdl));
+ pTPView->SetRejectClickHdl(LINK(this, SwRedlineAcceptDlg, RejectHdl));
+ pTPView->SetRejectAllClickHdl(LINK(this, SwRedlineAcceptDlg, RejectAllHdl));
+ pTPView->SetUndoClickHdl(LINK(this, SwRedlineAcceptDlg, UndoHdl));
+
+ aTabPagesCTRL.GetFilterPage()->SetReadyHdl(LINK(this, SwRedlineAcceptDlg, FilterChangedHdl));
+
+ ListBox *pActLB = aTabPagesCTRL.GetFilterPage()->GetLbAction();
+ pActLB->InsertEntry(sInserted);
+ pActLB->InsertEntry(sDeleted);
+ pActLB->InsertEntry(sFormated);
+ pActLB->InsertEntry(sTableChgd);
+
+ if (HasRedlineAutoFmt())
+ {
+ pActLB->InsertEntry(sFmtCollSet);
+ pActLB->InsertEntry(sAutoFormat);
+ pTPView->ShowUndo(TRUE);
+ pTPView->DisableUndo(); // Noch gibts keine UNDO-Events
+ }
+
+ pActLB->SelectEntryPos(0);
+
+ pTable->SetStyle(pTable->GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL);
+ pTable->SetNodeDefaultImages();
+ pTable->SetSelectionMode(MULTIPLE_SELECTION);
+ pTable->SetHighlightRange(1);
+
+ static long aStaticTabs[]=
+ {
+ 4,10,70,120,170
+ };
+
+ pTable->SetTabs(aStaticTabs);
+
+ // Minimalgroesse setzen
+ Size aMinSz(aTabPagesCTRL.GetMinSizePixel());
+ Point aPos(aTabPagesCTRL.GetPosPixel());
+
+ aMinSz.Width() += (aPos.X() * 2 - 1);
+ aMinSz.Height() += (aPos.Y() * 2 - 1);
+ pParentDlg->SetMinOutputSizePixel(aMinSz);
+
+ if (pParentDlg->GetOutputSizePixel().Width() < aMinSz.Width())
+ pParentDlg->SetOutputSizePixel(Size(aMinSz.Width(), pParentDlg->GetOutputSizePixel().Height()));
+ if (pParentDlg->GetOutputSizePixel().Height() < aMinSz.Height())
+ pParentDlg->SetOutputSizePixel(Size(pParentDlg->GetOutputSizePixel().Width(), aMinSz.Height()));
+
+ pTable->SortByCol(nSortMode, bSortDir);
+
+ aOldSelectHdl = pTable->GetSelectHdl();
+ aOldDeselectHdl = pTable->GetDeselectHdl();
+ pTable->SetSelectHdl(LINK(this, SwRedlineAcceptDlg, SelectHdl));
+ pTable->SetDeselectHdl(LINK(this, SwRedlineAcceptDlg, DeselectHdl));
+ pTable->SetCommandHdl(LINK(this, SwRedlineAcceptDlg, CommandHdl));
+
+ // Flackern der Buttons vermeiden:
+ aDeselectTimer.SetTimeout(100);
+ aDeselectTimer.SetTimeoutHdl(LINK(this, SwRedlineAcceptDlg, SelectHdl));
+
+ // Mehrfachselektion der selben Texte vermeiden:
+ aSelectTimer.SetTimeout(100);
+ aSelectTimer.SetTimeoutHdl(LINK(this, SwRedlineAcceptDlg, GotoHdl));
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwRedlineAcceptDlg::~SwRedlineAcceptDlg()
+{
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwRedlineAcceptDlg::Init(USHORT nStart)
+{
+ SwWait aWait( *::GetActiveView()->GetDocShell(), FALSE );
+ pTable->SetUpdateMode(FALSE);
+ aUsedSeqNo.Remove((USHORT)0, aUsedSeqNo.Count());
+
+ if (nStart)
+ RemoveParents(nStart, aRedlineParents.Count() - 1);
+ else
+ {
+ pTable->Clear();
+ aRedlineChilds.DeleteAndDestroy(0, aRedlineChilds.Count());
+ aRedlineParents.DeleteAndDestroy(nStart, aRedlineParents.Count() - nStart);
+ }
+
+ // Parents einfuegen
+ InsertParents(nStart);
+ InitAuthors();
+
+ pTable->SetUpdateMode(TRUE);
+ // #i69618# this moves the list box to the right position, visually
+ SvLBoxEntry* pSelEntry = pTable->FirstSelected();
+ if( pSelEntry )
+ pTable->MakeVisible( pSelEntry, sal_True ); //#i70937#, force the scroll
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwRedlineAcceptDlg::InitAuthors()
+{
+ SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
+
+ SvxTPFilter *pFilterPage = aTabPagesCTRL.GetFilterPage();
+
+ String sAuthor;
+ SvStringsSortDtor aStrings;
+ String sOldAuthor(pFilterPage->GetSelectedAuthor());
+ pFilterPage->ClearAuthors();
+
+ String sParent;
+ USHORT nCount = pSh->GetRedlineCount();
+
+ bOnlyFormatedRedlines = TRUE;
+ bHasReadonlySel = FALSE;
+ BOOL bIsNotFormated = FALSE;
+ USHORT i;
+
+ // Autoren ermitteln
+ for ( i = 0; i < nCount; i++)
+ {
+ const SwRedline& rRedln = pSh->GetRedline(i);
+
+ if( bOnlyFormatedRedlines && nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType() )
+ bOnlyFormatedRedlines = FALSE;
+
+//JP 27.9.2001: make no sense if we handle readonly sections
+// if( !bHasReadonlySel && rRedln.HasReadonlySel() )
+// bHasReadonlySel = TRUE;
+
+ String *pAuthor = new String(rRedln.GetAuthorString());
+ if (!aStrings.Insert(pAuthor))
+ delete pAuthor;
+
+ for (USHORT nStack = 1; nStack < rRedln.GetStackCount(); nStack++)
+ {
+ pAuthor = new String(rRedln.GetAuthorString(nStack));
+ if (!aStrings.Insert(pAuthor))
+ delete pAuthor;
+ }
+ }
+
+ for (i = 0; i < aStrings.Count(); i++)
+ pFilterPage->InsertAuthor(*aStrings[i]);
+
+ if (pFilterPage->SelectAuthor(sOldAuthor) == LISTBOX_ENTRY_NOTFOUND && aStrings.Count())
+ pFilterPage->SelectAuthor(*aStrings[0]);
+
+ BOOL bEnable = pTable->GetEntryCount() != 0 && !pSh->getIDocumentRedlineAccess()->GetRedlinePassword().getLength();
+ BOOL bSel = pTable->FirstSelected() != 0;
+
+ SvLBoxEntry* pSelEntry = pTable->FirstSelected();
+ while (pSelEntry)
+ {
+ USHORT nPos = GetRedlinePos(*pSelEntry);
+ const SwRedline& rRedln = pSh->GetRedline( nPos );
+
+ bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType();
+ pSelEntry = pTable->NextSelected(pSelEntry);
+ }
+
+ pTPView->EnableAccept( bEnable && bSel );
+ pTPView->EnableReject( bEnable && bIsNotFormated && bSel );
+ pTPView->EnableAcceptAll( bEnable && !bHasReadonlySel );
+ pTPView->EnableRejectAll( bEnable && !bHasReadonlySel &&
+ !bOnlyFormatedRedlines );
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+String SwRedlineAcceptDlg::GetRedlineText( const SwRedline& rRedln,
+ DateTime &rDateTime, USHORT nStack)
+{
+ String sEntry(GetActionText(rRedln, nStack));
+ sEntry += '\t';
+ sEntry += rRedln.GetAuthorString(nStack);
+ sEntry += '\t';
+
+ const DateTime &rDT = rRedln.GetTimeStamp(nStack);
+ rDateTime = rDT;
+
+ sEntry += GetAppLangDateTimeString( rDT );
+ sEntry += '\t';
+
+ sEntry += rRedln.GetComment(nStack);
+
+ return sEntry;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+const String &SwRedlineAcceptDlg::GetActionText(const SwRedline& rRedln, USHORT nStack)
+{
+ switch( rRedln.GetType(nStack) )
+ {
+ case nsRedlineType_t::REDLINE_INSERT: return sInserted;
+ case nsRedlineType_t::REDLINE_DELETE: return sDeleted;
+ case nsRedlineType_t::REDLINE_FORMAT: return sFormated;
+ case nsRedlineType_t::REDLINE_TABLE: return sTableChgd;
+ case nsRedlineType_t::REDLINE_FMTCOLL: return sFmtCollSet;
+ default:;//prevent warning
+ }
+
+ return aEmptyStr;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwRedlineAcceptDlg::Resize()
+{
+ Size aSz(pParentDlg->GetOutputSizePixel());
+
+ Point aPos(aTabPagesCTRL.GetPosPixel());
+
+ aSz.Width() -= (aPos.X() * 2 - 1);
+ aSz.Height() -= (aPos.Y() * 2 - 1);
+
+ aTabPagesCTRL.SetOutputSizePixel(aSz);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nach Aktivierung neu initialisieren
+ --------------------------------------------------------------------*/
+
+void SwRedlineAcceptDlg::Activate()
+{
+ // prevent update if flag is set (#102547#)
+ if( bInhibitActivate )
+ return;
+
+ SwView *pView = ::GetActiveView();
+ SwWait aWait( *pView->GetDocShell(), FALSE );
+
+ aUsedSeqNo.Remove((USHORT)0, aUsedSeqNo.Count());
+
+ if (!pView) // Kann passieren, wenn man auf eine andere App umschaltet, wenn
+ return; // vorher eine Listbox im Dialog den Focus hatte (eigentlich THs Bug)
+
+/* if (HasRedlineAutoFmt())
+ {
+ Init();
+ return;
+ }*/
+
+ // Hat sich was geaendert?
+ SwWrtShell* pSh = pView->GetWrtShellPtr();
+ USHORT nCount = pSh->GetRedlineCount();
+
+ // Anzahl und Pointer ueberpruefen
+ SwRedlineDataParent *pParent = 0;
+ USHORT i;
+
+ for ( i = 0; i < nCount; i++)
+ {
+ const SwRedline& rRedln = pSh->GetRedline(i);
+
+ if (i >= aRedlineParents.Count())
+ {
+ // Neue Eintraege wurden angehaengt
+ Init(i);
+ return;
+ }
+
+ pParent = aRedlineParents[i];
+ if (&rRedln.GetRedlineData() != pParent->pData)
+ {
+ // Redline-Parents wurden eingefuegt, geaendert oder geloescht
+ if ((i = CalcDiff(i, FALSE)) == USHRT_MAX)
+ return;
+ continue;
+ }
+
+ const SwRedlineData *pRedlineData = rRedln.GetRedlineData().Next();
+ const SwRedlineDataChild *pBackupData = pParent->pNext;
+
+ if (!pRedlineData && pBackupData)
+ {
+ // Redline-Childs wurden geloescht
+ if ((i = CalcDiff(i, TRUE)) == USHRT_MAX)
+ return;
+ continue;
+ }
+ else
+ {
+ while (pRedlineData)
+ {
+ if (pRedlineData != pBackupData->pChild)
+ {
+ // Redline-Childs wurden eingefuegt, geaendert oder geloescht
+ if ((i = CalcDiff(i, TRUE)) == USHRT_MAX)
+ return;
+ continue;
+ }
+ if (pBackupData)
+ pBackupData = pBackupData->pNext;
+ pRedlineData = pRedlineData->Next();
+ }
+ }
+ }
+
+ if (nCount != aRedlineParents.Count())
+ {
+ // Redlines wurden am Ende geloescht
+ Init(nCount);
+ return;
+ }
+
+ // Kommentar ueberpruefen
+ for (i = 0; i < nCount; i++)
+ {
+ const SwRedline& rRedln = pSh->GetRedline(i);
+ pParent = aRedlineParents[i];
+
+ if(!rRedln.GetComment().Equals(pParent->sComment))
+ {
+ if (pParent->pTLBParent)
+ {
+ // Nur Kommentar aktualisieren
+ String sComment(rRedln.GetComment());
+ sComment.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' ');
+ pTable->SetEntryText(sComment, pParent->pTLBParent, 3);
+ }
+ pParent->sComment = rRedln.GetComment();
+ }
+ }
+
+ InitAuthors();
+}
+
+/* -----------------05.06.98 13:06-------------------
+ *
+ * --------------------------------------------------*/
+
+USHORT SwRedlineAcceptDlg::CalcDiff(USHORT nStart, BOOL bChild)
+{
+ if (!nStart)
+ {
+ Init();
+ return USHRT_MAX;
+ }
+
+ pTable->SetUpdateMode(FALSE);
+ SwView *pView = ::GetActiveView();
+ SwWrtShell* pSh = pView->GetWrtShellPtr();
+ USHORT nAutoFmt = HasRedlineAutoFmt() ? nsRedlineType_t::REDLINE_FORM_AUTOFMT : 0;
+ SwRedlineDataParent *pParent = aRedlineParents[nStart];
+ const SwRedline& rRedln = pSh->GetRedline(nStart);
+
+ if (bChild) // Sollte eigentlich nie vorkommen, aber sicher ist sicher...
+ {
+ // Alle Childs des Eintrags wegwerfen und neu initialisieren
+ SwRedlineDataChildPtr pBackupData = (SwRedlineDataChildPtr)pParent->pNext;
+ SwRedlineDataChildPtr pNext;
+
+ while (pBackupData)
+ {
+ pNext = (SwRedlineDataChildPtr)pBackupData->pNext;
+ if (pBackupData->pTLBChild)
+ pTable->RemoveEntry(pBackupData->pTLBChild);
+
+ aRedlineChilds.DeleteAndDestroy(aRedlineChilds.GetPos(pBackupData), 1);
+ pBackupData = pNext;
+ }
+ pParent->pNext = 0;
+
+ // Neue Childs einfuegen
+ InsertChilds(pParent, rRedln, nAutoFmt);
+
+ pTable->SetUpdateMode(TRUE);
+ return nStart;
+ }
+
+ // Wurden Eintraege geloescht?
+ const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
+ USHORT i;
+ for ( i = nStart + 1; i < aRedlineParents.Count(); i++)
+ {
+ if (aRedlineParents[i]->pData == pRedlineData)
+ {
+ // Eintraege von nStart bis i-1 entfernen
+ RemoveParents(nStart, i - 1);
+ pTable->SetUpdateMode(TRUE);
+ return nStart - 1;
+ }
+ }
+
+ // Wurden Eintraege eingefuegt?
+ USHORT nCount = pSh->GetRedlineCount();
+ pRedlineData = aRedlineParents[nStart]->pData;
+
+ for (i = nStart + 1; i < nCount; i++)
+ {
+ if (&pSh->GetRedline(i).GetRedlineData() == pRedlineData)
+ {
+ // Eintraege von nStart bis i-1 einfuegen
+ InsertParents(nStart, i - 1);
+ pTable->SetUpdateMode(TRUE);
+ return nStart - 1;
+ }
+ }
+
+ pTable->SetUpdateMode(TRUE);
+ Init(nStart); // Alle Eintraege bis zum Ende abgleichen
+ return USHRT_MAX;
+}
+
+/* -----------------05.06.98 13:57-------------------
+ *
+ * --------------------------------------------------*/
+
+void SwRedlineAcceptDlg::InsertChilds(SwRedlineDataParent *pParent, const SwRedline& rRedln, const USHORT nAutoFmt)
+{
+ String sChild;
+ SwRedlineDataChild *pLastRedlineChild = 0;
+ const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
+ BOOL bAutoFmt = (rRedln.GetRealType() & nAutoFmt) != 0;
+
+ const String *pAction = &GetActionText(rRedln);
+ BOOL bValidParent = !sFilterAction.Len() || sFilterAction == *pAction;
+ bValidParent = bValidParent && pTable->IsValidEntry(&rRedln.GetAuthorString(), &rRedln.GetTimeStamp(), &rRedln.GetComment());
+ if (nAutoFmt)
+ {
+ USHORT nPos;
+
+ if (pParent->pData->GetSeqNo() && !aUsedSeqNo.Insert(pParent, nPos)) // Gibts schon
+ {
+ if (pParent->pTLBParent)
+ {
+ pTable->SetEntryText(sAutoFormat, aUsedSeqNo[nPos]->pTLBParent, 0);
+ pTable->RemoveEntry(pParent->pTLBParent);
+ pParent->pTLBParent = 0;
+ }
+ return;
+ }
+ bValidParent = bValidParent && bAutoFmt;
+ }
+ BOOL bValidTree = bValidParent;
+
+ for (USHORT nStack = 1; nStack < rRedln.GetStackCount(); nStack++)
+ {
+ pRedlineData = pRedlineData->Next();
+
+ SwRedlineDataChildPtr pRedlineChild = new SwRedlineDataChild;
+ pRedlineChild->pChild = pRedlineData;
+ aRedlineChilds.Insert(pRedlineChild, aRedlineChilds.Count());
+
+ if ( pLastRedlineChild )
+ pLastRedlineChild->pNext = pRedlineChild;
+ else
+ pParent->pNext = pRedlineChild;
+
+ pAction = &GetActionText(rRedln, nStack);
+ BOOL bValidChild = !sFilterAction.Len() || sFilterAction == *pAction;
+ bValidChild = bValidChild && pTable->IsValidEntry(&rRedln.GetAuthorString(nStack), &rRedln.GetTimeStamp(nStack), &rRedln.GetComment());
+ if (nAutoFmt)
+ bValidChild = bValidChild && bAutoFmt;
+ bValidTree |= bValidChild;
+
+ if (bValidChild)
+ {
+ RedlinData *pData = new RedlinData;
+ pData->pData = pRedlineChild;
+ pData->bDisabled = TRUE;
+ sChild = GetRedlineText(rRedln, pData->aDateTime, nStack);
+
+ SvLBoxEntry* pChild = pTable->InsertEntry(sChild, pData, pParent->pTLBParent);
+
+ pRedlineChild->pTLBChild = pChild;
+ if (!bValidParent)
+ pTable->Expand(pParent->pTLBParent);
+ }
+ else
+ pRedlineChild->pTLBChild = 0;
+
+ pLastRedlineChild = pRedlineChild;
+ }
+
+ if (pLastRedlineChild)
+ pLastRedlineChild->pNext = 0;
+
+ if (!bValidTree && pParent->pTLBParent)
+ {
+ pTable->RemoveEntry(pParent->pTLBParent);
+ pParent->pTLBParent = 0;
+ if (nAutoFmt)
+ aUsedSeqNo.Remove(pParent);
+ }
+}
+
+/* -----------------05.06.98 15:20-------------------
+ *
+ * --------------------------------------------------*/
+
+void SwRedlineAcceptDlg::RemoveParents(USHORT nStart, USHORT nEnd)
+{
+ SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
+ USHORT nCount = pSh->GetRedlineCount();
+
+ SvLBoxEntryArr aLBoxArr;
+
+ // Wegen Bug der TLB, die bei Remove den SelectHandler IMMER ruft:
+ pTable->SetSelectHdl(aOldSelectHdl);
+ pTable->SetDeselectHdl(aOldDeselectHdl);
+ BOOL bChildsRemoved = FALSE;
+ pTable->SelectAll(FALSE);
+
+ // Hinter dem letzten Eintrag Cursor setzen, da sonst Performance-Problem in TLB.
+ // TLB wuerde sonst bei jedem Remove den Cursor erneut umsetzen (teuer)
+ USHORT nPos = Min((USHORT)nCount, (USHORT)aRedlineParents.Count());
+ SvLBoxEntry *pCurEntry = NULL;
+ while( ( pCurEntry == NULL ) && ( nPos > 0 ) )
+ {
+ --nPos;
+ pCurEntry = aRedlineParents[nPos]->pTLBParent;
+ }
+
+ if (pCurEntry)
+ pTable->SetCurEntry(pCurEntry);
+
+ SvLBoxTreeList* pModel = pTable->GetModel();
+
+ for (USHORT i = nStart; i <= nEnd; i++)
+ {
+ if (!bChildsRemoved && aRedlineParents[i]->pNext)
+ {
+ SwRedlineDataChildPtr pChildPtr = (SwRedlineDataChildPtr)aRedlineParents[i]->pNext;
+ USHORT nChildPos = aRedlineChilds.GetPos(pChildPtr);
+
+ if (nChildPos != USHRT_MAX)
+ {
+ USHORT nChilds = 0;
+
+ while (pChildPtr)
+ {
+ pChildPtr = (SwRedlineDataChildPtr)pChildPtr->pNext;
+ nChilds++;
+ }
+
+ aRedlineChilds.DeleteAndDestroy(nChildPos, nChilds);
+ bChildsRemoved = TRUE;
+ }
+ }
+ SvLBoxEntry *pEntry = aRedlineParents[i]->pTLBParent;
+ if (pEntry)
+ {
+ long nIdx = aLBoxArr.Count() - 1L;
+ ULONG nAbsPos = pModel->GetAbsPos(pEntry);
+ while (nIdx >= 0 &&
+ pModel->GetAbsPos(aLBoxArr[ static_cast< USHORT >(nIdx) ]) > nAbsPos)
+ nIdx--;
+ aLBoxArr.Insert( pEntry, static_cast< USHORT >(++nIdx) );
+ }
+ }
+
+ // TLB von hinten abraeumen
+ long nIdx = (long)aLBoxArr.Count() - 1L;
+ while (nIdx >= 0)
+ pTable->RemoveEntry(aLBoxArr[ static_cast< USHORT >(nIdx--) ]);
+
+ pTable->SetSelectHdl(LINK(this, SwRedlineAcceptDlg, SelectHdl));
+ pTable->SetDeselectHdl(LINK(this, SwRedlineAcceptDlg, DeselectHdl));
+ // Durch Remove wurde leider wieder dauernd von der TLB selektiert...
+ pTable->SelectAll(FALSE);
+
+ aRedlineParents.DeleteAndDestroy( nStart, nEnd - nStart + 1);
+}
+
+/* -----------------05.06.98 15:20-------------------
+ *
+ * --------------------------------------------------*/
+
+void SwRedlineAcceptDlg::InsertParents(USHORT nStart, USHORT nEnd)
+{
+ SwView *pView = ::GetActiveView();
+ SwWrtShell* pSh = pView->GetWrtShellPtr();
+ USHORT nAutoFmt = HasRedlineAutoFmt() ? nsRedlineType_t::REDLINE_FORM_AUTOFMT : 0;
+
+ String sParent;
+ USHORT nCount = pSh->GetRedlineCount();
+ nEnd = Min((USHORT)nEnd, (USHORT)(nCount - 1)); // Handelt auch nEnd=USHRT_MAX (bis zum Ende) ab
+
+ if (nEnd == USHRT_MAX)
+ return; // Keine Redlines im Dokument
+
+ RedlinData *pData;
+ SvLBoxEntry *pParent;
+ SwRedlineDataParentPtr pRedlineParent;
+ const SwRedline* pCurrRedline;
+ if( !nStart && !pTable->FirstSelected() )
+ {
+ pCurrRedline = pSh->GetCurrRedline();
+ if( !pCurrRedline )
+ {
+ pSh->SwCrsrShell::Push();
+ if( 0 == (pCurrRedline = pSh->SelNextRedline()))
+ pCurrRedline = pSh->SelPrevRedline();
+ pSh->SwCrsrShell::Pop( FALSE );
+ }
+ }
+ else
+ pCurrRedline = 0;
+
+ for (USHORT i = nStart; i <= nEnd; i++)
+ {
+ const SwRedline& rRedln = pSh->GetRedline(i);
+ const SwRedlineData *pRedlineData = &rRedln.GetRedlineData();
+
+ pRedlineParent = new SwRedlineDataParent;
+ pRedlineParent->pData = pRedlineData;
+ pRedlineParent->pNext = 0;
+ String sComment(rRedln.GetComment());
+ sComment.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' ');
+ pRedlineParent->sComment = sComment;
+ aRedlineParents.Insert(pRedlineParent, i);
+
+ pData = new RedlinData;
+ pData->pData = pRedlineParent;
+ pData->bDisabled = FALSE;
+
+ sParent = GetRedlineText(rRedln, pData->aDateTime);
+ pParent = pTable->InsertEntry(sParent, pData, 0, i);
+ if( pCurrRedline == &rRedln )
+ {
+ pTable->SetCurEntry( pParent );
+ pTable->Select( pParent );
+ pTable->MakeVisible( pParent );
+ }
+
+ pRedlineParent->pTLBParent = pParent;
+
+ InsertChilds(pRedlineParent, rRedln, nAutoFmt);
+ }
+}
+
+/* -----------------05.06.98 13:06-------------------
+ *
+ * --------------------------------------------------*/
+
+void SwRedlineAcceptDlg::CallAcceptReject( BOOL bSelect, BOOL bAccept )
+{
+ SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
+ SvLBoxEntry* pEntry = bSelect ? pTable->FirstSelected() : pTable->First();
+ ULONG nPos = LONG_MAX;
+
+ typedef std::vector<SvLBoxEntry*> ListBoxEntries_t;
+ ListBoxEntries_t aRedlines;
+
+ // don't activate
+ DBG_ASSERT( bInhibitActivate == false,
+ "recursive call of CallAcceptReject?");
+ bInhibitActivate = true;
+
+ // collect redlines-to-be-accepted/rejected in aRedlines vector
+ while( pEntry )
+ {
+ if( !pTable->GetParent( pEntry ) )
+ {
+ if( bSelect && LONG_MAX == nPos )
+ nPos = pTable->GetModel()->GetAbsPos( pEntry );
+
+ RedlinData *pData = (RedlinData *)pEntry->GetUserData();
+
+ if( !pData->bDisabled )
+ aRedlines.push_back( pEntry );
+ }
+
+ pEntry = bSelect ? pTable->NextSelected(pEntry) : pTable->Next(pEntry);
+ }
+
+ BOOL (SwEditShell:: *FnAccRej)( USHORT ) = &SwEditShell::AcceptRedline;
+ if( !bAccept )
+ FnAccRej = &SwEditShell::RejectRedline;
+
+ SwWait aWait( *pSh->GetView().GetDocShell(), TRUE );
+ pSh->StartAction();
+
+ // #111827#
+ if (aRedlines.size() > 1)
+ {
+ String aTmpStr;
+ {
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1,
+ String::CreateFromInt32(aRedlines.size()));
+ aTmpStr = aRewriter.Apply(String(SW_RES(STR_N_REDLINES)));
+ }
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, aTmpStr);
+
+ pSh->StartUndo(bAccept? UNDO_ACCEPT_REDLINE : UNDO_REJECT_REDLINE,
+ &aRewriter);
+ }
+
+ // accept/reject the the redlines in aRedlines. The absolute
+ // position may change during the process (e.g. when two redlines
+ // are merged in result of another one being deleted), so the
+ // position must be resolved late and checked before using it.
+ // (cf #102547#)
+ ListBoxEntries_t::iterator aEnd = aRedlines.end();
+ for( ListBoxEntries_t::iterator aIter = aRedlines.begin();
+ aIter != aEnd;
+ aIter++ )
+ {
+ USHORT nPosition = GetRedlinePos( **aIter );
+ if( nPosition != USHRT_MAX )
+ (pSh->*FnAccRej)( nPosition );
+ }
+
+ // #111827#
+ if (aRedlines.size() > 1)
+ {
+ pSh->EndUndo();
+ }
+
+ pSh->EndAction();
+
+ bInhibitActivate = false;
+ Activate();
+
+ if( ULONG_MAX != nPos && pTable->GetEntryCount() )
+ {
+ if( nPos >= pTable->GetEntryCount() )
+ nPos = pTable->GetEntryCount() - 1;
+ pEntry = pTable->GetEntry( nPos );
+ if( !pEntry && nPos-- )
+ pEntry = pTable->GetEntry( nPos );
+ if( pEntry )
+ {
+ pTable->Select( pEntry );
+ pTable->MakeVisible( pEntry );
+ pTable->SetCurEntry(pEntry);
+ }
+ }
+ pTPView->EnableUndo();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwRedlineAcceptDlg::GetRedlinePos( const SvLBoxEntry& rEntry ) const
+{
+ SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
+ return pSh->FindRedlineOfData( *((SwRedlineDataParent*)((RedlinData *)
+ rEntry.GetUserData())->pData)->pData );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwRedlineAcceptDlg, AcceptHdl, void*, EMPTYARG)
+{
+ CallAcceptReject( TRUE, TRUE );
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwRedlineAcceptDlg, AcceptAllHdl, void*, EMPTYARG )
+{
+ CallAcceptReject( FALSE, TRUE );
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwRedlineAcceptDlg, RejectHdl, void*, EMPTYARG )
+{
+ CallAcceptReject( TRUE, FALSE );
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwRedlineAcceptDlg, RejectAllHdl, void*, EMPTYARG )
+{
+ CallAcceptReject( FALSE, FALSE );
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwRedlineAcceptDlg, UndoHdl, void*, EMPTYARG )
+{
+ SwView * pView = ::GetActiveView();
+ pView->GetViewFrame()->GetDispatcher()->
+ Execute(SID_UNDO, SFX_CALLMODE_SYNCHRON);
+ pTPView->EnableUndo(pView->GetSlotState(SID_UNDO) != 0);
+
+ Activate();
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwRedlineAcceptDlg, FilterChangedHdl, void*, EMPTYARG )
+{
+ SvxTPFilter *pFilterTP = aTabPagesCTRL.GetFilterPage();
+
+ if (pFilterTP->IsAction())
+ sFilterAction = pFilterTP->GetLbAction()->GetSelectEntry();
+ else
+ sFilterAction = aEmptyStr;
+
+ Init();
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwRedlineAcceptDlg, DeselectHdl, void*, EMPTYARG )
+{
+ // Flackern der Buttons vermeiden:
+ aDeselectTimer.Start();
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwRedlineAcceptDlg, SelectHdl, void*, EMPTYARG )
+{
+ aDeselectTimer.Stop();
+ aSelectTimer.Start();
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwRedlineAcceptDlg, GotoHdl, void*, EMPTYARG )
+{
+ SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
+ aSelectTimer.Stop();
+
+ BOOL bIsNotFormated = FALSE;
+ BOOL bSel = FALSE;
+// BOOL bReadonlySel = FALSE;
+
+ //#98883# don't select redlines while the dialog is not focussed
+ //#107938# But not only ask pTable if it has the focus. To move
+ // the selection to the selected redline any child of pParentDlg
+ // may the focus.
+ SvLBoxEntry* pSelEntry = 0;
+
+ if (pParentDlg->HasChildPathFocus())
+ pSelEntry = pTable->FirstSelected();
+
+ if( pSelEntry )
+ {
+ SvLBoxEntry* pActEntry = pSelEntry;
+ pSh->StartAction();
+ pSh->EnterStdMode();
+ pSh->SetCareWin(pParentDlg);
+
+ while (pSelEntry)
+ {
+ if (pTable->GetParent(pSelEntry))
+ {
+ pActEntry = pTable->GetParent(pSelEntry);
+
+ if (pTable->IsSelected(pActEntry))
+ {
+ pSelEntry = pActEntry = pTable->NextSelected(pSelEntry);
+ continue; // Nicht zweimal selektieren
+ }
+ }
+ else
+ bSel = TRUE;
+
+ // #98864# find the selected redline (ignore, if the redline is already gone)
+ USHORT nPos = GetRedlinePos(*pActEntry);
+ if( nPos != USHRT_MAX )
+ {
+
+ const SwRedline& rRedln = pSh->GetRedline( nPos );
+ bIsNotFormated |= nsRedlineType_t::REDLINE_FORMAT != rRedln.GetType();
+
+//JP 27.9.2001: make no sense if we handle readonly sections
+// if( !bReadonlySel && rRedln.HasReadonlySel() )
+// bReadonlySel = TRUE;
+
+ if (pSh->GotoRedline(nPos, TRUE))
+ {
+ pSh->SetInSelect();
+ pSh->EnterAddMode();
+ }
+ }
+
+ pSelEntry = pActEntry = pTable->NextSelected(pSelEntry);
+ }
+
+ pSh->LeaveAddMode();
+ pSh->EndAction();
+ pSh->SetCareWin(NULL);
+ }
+ BOOL bEnable = !pSh->getIDocumentRedlineAccess()->GetRedlinePassword().getLength();
+ pTPView->EnableAccept( bEnable && bSel /*&& !bReadonlySel*/ );
+ pTPView->EnableReject( bEnable && bSel && bIsNotFormated /*&& !bReadonlySel*/ );
+ pTPView->EnableRejectAll( bEnable && !bOnlyFormatedRedlines && !bHasReadonlySel );
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwRedlineAcceptDlg, CommandHdl, void*, EMPTYARG )
+{
+ const CommandEvent aCEvt(pTable->GetCommandEvent());
+
+ switch ( aCEvt.GetCommand() )
+ {
+ case COMMAND_CONTEXTMENU:
+ {
+ SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
+ SvLBoxEntry* pEntry = pTable->FirstSelected();
+ const SwRedline *pRed = 0;
+
+ if (pEntry)
+ {
+ SvLBoxEntry* pTopEntry = pEntry;
+
+ if (pTable->GetParent(pEntry))
+ pTopEntry = pTable->GetParent(pEntry);
+
+ USHORT nPos = GetRedlinePos(*pTopEntry);
+
+ // Bei geschuetzten Bereichen kommentieren disablen
+ if ((pRed = pSh->GotoRedline(nPos, TRUE)) != 0)
+ {
+ if( pSh->IsCrsrPtAtEnd() )
+ pSh->SwapPam();
+ pSh->SetInSelect();
+ }
+ }
+
+ aPopup.EnableItem( MN_EDIT_COMMENT, pEntry && pRed &&
+ !pTable->GetParent(pEntry) &&
+ !pTable->NextSelected(pEntry)
+//JP 27.9.2001: make no sense if we handle readonly sections
+// && pRed->HasReadonlySel()
+ );
+
+ aPopup.EnableItem( MN_SUB_SORT, pTable->First() != 0 );
+ USHORT nColumn = pTable->GetSortedCol();
+ if (nColumn == 0xffff)
+ nColumn = 4;
+
+ PopupMenu *pSubMenu = aPopup.GetPopupMenu(MN_SUB_SORT);
+ if (pSubMenu)
+ {
+ for (USHORT i = MN_SORT_ACTION; i < MN_SORT_ACTION + 5; i++)
+ pSubMenu->CheckItem(i, FALSE);
+
+ pSubMenu->CheckItem(nColumn + MN_SORT_ACTION);
+ }
+
+ USHORT nRet = aPopup.Execute(pTable, aCEvt.GetMousePosPixel());
+
+ switch( nRet )
+ {
+ case MN_EDIT_COMMENT:
+ {
+ String sComment;
+ if (pEntry)
+ {
+ if (pTable->GetParent(pEntry))
+ pEntry = pTable->GetParent(pEntry);
+
+ USHORT nPos = GetRedlinePos(*pEntry);
+ const SwRedline &rRedline = pSh->GetRedline(nPos);
+
+
+ /* enable again once we have redline comments in the margin
+ sComment = rRedline.GetComment();
+ if ( sComment == String(::rtl::OUString::createFromAscii("")) )
+ GetActiveView()->GetDocShell()->Broadcast(SwRedlineHint(&rRedline,SWREDLINE_INSERTED));
+ const_cast<SwRedline&>(rRedline).Broadcast(SwRedlineHint(&rRedline,SWREDLINE_FOCUS));
+ */
+
+ sComment = rRedline.GetComment();
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc( RID_SVXDLG_POSTIT );
+ DBG_ASSERT(fnGetRange, "Dialogdiet fail! GetRanges()");
+ SfxItemSet aSet( pSh->GetAttrPool(), fnGetRange() );
+
+ aSet.Put(SvxPostItTextItem(sComment.ConvertLineEnd(), SID_ATTR_POSTIT_TEXT));
+ aSet.Put(SvxPostItAuthorItem(rRedline.GetAuthorString(), SID_ATTR_POSTIT_AUTHOR));
+
+ aSet.Put(SvxPostItDateItem( GetAppLangDateTimeString(
+ rRedline.GetRedlineData().GetTimeStamp() ),
+ SID_ATTR_POSTIT_DATE ));
+
+ AbstractSvxPostItDialog* pDlg = pFact->CreateSvxPostItDialog( pParentDlg, aSet, FALSE );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+
+ pDlg->HideAuthor();
+
+ USHORT nResId = 0;
+ switch( rRedline.GetType() )
+ {
+ case nsRedlineType_t::REDLINE_INSERT:
+ nResId = STR_REDLINE_INSERTED;
+ break;
+ case nsRedlineType_t::REDLINE_DELETE:
+ nResId = STR_REDLINE_DELETED;
+ break;
+ case nsRedlineType_t::REDLINE_FORMAT:
+ nResId = STR_REDLINE_FORMATED;
+ break;
+ case nsRedlineType_t::REDLINE_TABLE:
+ nResId = STR_REDLINE_TABLECHG;
+ break;
+ default:;//prevent warning
+ }
+ String sTitle(SW_RES(STR_REDLINE_COMMENT));
+ if( nResId )
+ sTitle += SW_RESSTR( nResId );
+ pDlg->SetText(sTitle);
+
+ pSh->SetCareWin(pDlg->GetWindow());
+
+ if ( pDlg->Execute() == RET_OK )
+ {
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ String sMsg(((const SvxPostItTextItem&)pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue());
+
+ // Kommentar einfuegen bzw aendern
+ pSh->SetRedlineComment(sMsg);
+ sMsg.SearchAndReplaceAll((sal_Unicode)_LF,(sal_Unicode)' ');
+ pTable->SetEntryText(sMsg, pEntry, 3);
+ }
+
+ delete pDlg;
+ pSh->SetCareWin(NULL);
+ }
+
+ }
+ break;
+
+ case MN_SORT_ACTION:
+ case MN_SORT_AUTHOR:
+ case MN_SORT_DATE:
+ case MN_SORT_COMMENT:
+ case MN_SORT_POSITION:
+ {
+ bSortDir = TRUE;
+ if (nRet - MN_SORT_ACTION == 4 && pTable->GetSortedCol() == 0xffff)
+ break; // Haben wir schon
+
+ nSortMode = nRet - MN_SORT_ACTION;
+ if (nSortMode == 4)
+ nSortMode = 0xffff; // unsortiert bzw sortiert nach Position
+
+ if (pTable->GetSortedCol() == nSortMode)
+ bSortDir = !pTable->GetSortDirection();
+
+ SwWait aWait( *::GetActiveView()->GetDocShell(), FALSE );
+ pTable->SortByCol(nSortMode, bSortDir);
+ if (nSortMode == 0xffff)
+ Init(); // Alles neu fuellen
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwRedlineAcceptDlg::Initialize(const String& rExtraData)
+{
+ if (rExtraData.Len())
+ {
+ USHORT nPos = rExtraData.Search(C2S("AcceptChgDat:"));
+
+ // Versuche, den Alignment-String "ALIGN:(...)" einzulesen; wenn
+ // er nicht vorhanden ist, liegt eine "altere Version vor
+ if (nPos != STRING_NOTFOUND)
+ {
+ USHORT n1 = rExtraData.Search('(', nPos);
+ if (n1 != STRING_NOTFOUND)
+ {
+ USHORT n2 = rExtraData.Search(')', n1);
+ if (n2 != STRING_NOTFOUND)
+ {
+ // Alignment-String herausschneiden
+ String aStr = rExtraData.Copy(nPos, n2 - nPos + 1);
+ aStr.Erase(0, n1 - nPos + 1);
+
+ if (aStr.Len())
+ {
+ USHORT nCount = static_cast< USHORT >(aStr.ToInt32());
+
+ for (USHORT i = 0; i < nCount; i++)
+ {
+ USHORT n3 = aStr.Search(';');
+ aStr.Erase(0, n3 + 1);
+ pTable->SetTab(i, aStr.ToInt32(), MAP_PIXEL);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwRedlineAcceptDlg::FillInfo(String &rExtraData) const
+{
+ rExtraData.AppendAscii("AcceptChgDat:(");
+
+ USHORT nCount = pTable->TabCount();
+
+ rExtraData += String::CreateFromInt32(nCount);
+ rExtraData += ';';
+ for(USHORT i = 0; i < nCount; i++)
+ {
+ rExtraData += String::CreateFromInt32( pTable->GetTab(i) );
+ rExtraData += ';';
+ }
+ rExtraData += ')';
+}
diff --git a/sw/source/ui/misc/redlndlg.hrc b/sw/source/ui/misc/redlndlg.hrc
new file mode 100644
index 000000000000..838b79f37d48
--- /dev/null
+++ b/sw/source/ui/misc/redlndlg.hrc
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define CTRL_TABPAGES 1
+
+#define MN_EDIT_COMMENT 1
+#define MN_SUB_SORT 2
+#define MN_SORT_ACTION 3
+#define MN_SORT_AUTHOR 4
+#define MN_SORT_DATE 5
+#define MN_SORT_COMMENT 6
+#define MN_SORT_POSITION 7
+
+#define XBORDER 3
+#define YBORDER 3
diff --git a/sw/source/ui/misc/redlndlg.src b/sw/source/ui/misc/redlndlg.src
new file mode 100644
index 000000000000..39418495363c
--- /dev/null
+++ b/sw/source/ui/misc/redlndlg.src
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* StarView ressource file */
+
+#include "redlndlg.hrc"
+#include "misc.hrc"
+#include "helpid.h"
+
+#define WIDTH 297
+#define HEIGHT 169
+
+#define REDLNDLG \
+ OutputSize = TRUE ; \
+ SVLook = TRUE ; \
+ Size = MAP_APPFONT ( WIDTH , HEIGHT ) ; \
+ Moveable = TRUE ; \
+ Closeable = TRUE ; \
+ Sizeable = TRUE ; \
+ Hide = TRUE ; \
+ Control CTRL_TABPAGES\
+ {\
+ Pos = MAP_APPFONT ( XBORDER , YBORDER ) ; \
+ Size = MAP_APPFONT ( WIDTH - XBORDER * 2 , HEIGHT - YBORDER * 2 ) ; \
+ HelpID = HID_REDLINE_CTRL ; \
+ TabStop = TRUE ; \
+ };
+
+ModelessDialog DLG_REDLINE_ACCEPT
+{
+ HelpID = HID_REDLINE_ACCEPT ;
+ /* ### ACHTUNG: Neuer Text in Resource? Änderungen akzeptieren oder verwerfen : Redlining */
+ Text [ en-US ] = "Accept or Reject Changes" ;
+ REDLNDLG
+};
+
+ModalDialog DLG_MOD_REDLINE_ACCEPT
+{
+ HelpID = HID_REDLINE_AUTOFMT_ACCEPT ;
+ REDLNDLG
+ Text [ en-US ] = "Accept or Reject AutoCorrect Changes";
+};
+
+Menu MN_REDLINE_POPUP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_EDIT_COMMENT ;
+ HelpID = HID_EDIT_COMMENT ;
+ Text [ en-US ] = "Edit Comment..." ;
+ };
+ MenuItem
+ {
+ Identifier = MN_SUB_SORT ;
+ RadioCheck = TRUE ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_SORT_ACTION ;
+ HelpID = HID_SORT_ACTION ;
+ RadioCheck = TRUE ;
+ Text [ en-US ] = "Action" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_SORT_AUTHOR ;
+ HelpID = HID_SORT_AUTHOR ;
+ RadioCheck = TRUE ;
+ Text [ en-US ] = "Author" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_SORT_DATE ;
+ HelpID = HID_SORT_DATE ;
+ RadioCheck = TRUE ;
+ Text [ en-US ] = "Date" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_SORT_COMMENT ;
+ HelpID = HID_SORT_COMMENT ;
+ RadioCheck = TRUE ;
+ Text [ en-US ] = "Comment" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_SORT_POSITION ;
+ HelpID = HID_SW_SORT_POSITION ;
+ RadioCheck = TRUE ;
+ Text [ en-US ] = "Document position" ;
+ };
+ };
+ };
+ Text [ en-US ] = "Sort By" ;
+ };
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx
new file mode 100644
index 000000000000..be7622319626
--- /dev/null
+++ b/sw/source/ui/misc/srtdlg.cxx
@@ -0,0 +1,492 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+#include "srtdlg.hxx"
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svxids.hrc>
+#include <editeng/unolingu.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <unotools/collatorwrapper.hxx>
+#include <svtools/collatorres.hxx>
+#include <swwait.hxx>
+#include <view.hxx>
+#include <cmdid.h>
+#include <wrtsh.hxx>
+#include <misc.hrc>
+#include <srtdlg.hrc>
+#include <swtable.hxx>
+#include <node.hxx>
+#include <tblsel.hxx>
+#include <sfx2/request.hxx>
+
+// sw/inc/tblsel.hxx
+SV_IMPL_PTRARR( _FndBoxes, _FndBox* )
+SV_IMPL_PTRARR( _FndLines, _FndLine* )
+
+static BOOL bCheck1 = TRUE;
+static BOOL bCheck2 = FALSE;
+static BOOL bCheck3 = FALSE;
+
+static USHORT nCol1 = 1;
+static USHORT nCol2 = 1;
+static USHORT nCol3 = 1;
+
+static USHORT nType1 = 0;
+static USHORT nType2 = 0;
+static USHORT nType3 = 0;
+
+static USHORT nLang = LANGUAGE_NONE;
+
+static BOOL bAsc1 = TRUE;
+static BOOL bAsc2 = TRUE;
+static BOOL bAsc3 = TRUE;
+static BOOL bCol = FALSE;
+static BOOL bCsSens= FALSE;
+
+static sal_Unicode cDeli = '\t';
+
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+
+void lcl_ClearLstBoxAndDelUserData( ListBox& rLstBox )
+{
+ void* pDel;
+ for( USHORT n = 0, nEnd = rLstBox.GetEntryCount(); n < nEnd; ++n )
+ if( 0 != ( pDel = rLstBox.GetEntryData( n )) )
+ delete (String*)pDel;
+ rLstBox.Clear();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Fuer Tabellenselektion sel. Zeilen und Spalten
+ feststellen
+ --------------------------------------------------------------------*/
+
+
+BOOL lcl_GetSelTbl( SwWrtShell &rSh, USHORT& rX, USHORT& rY )
+{
+ const SwTableNode* pTblNd = rSh.IsCrsrInTbl();
+ if( !pTblNd )
+ return FALSE;
+
+ _FndBox aFndBox( 0, 0 );
+
+ // suche alle Boxen / Lines
+ {
+ SwSelBoxes aSelBoxes;
+ ::GetTblSel( rSh, aSelBoxes );
+ _FndPara aPara( aSelBoxes, &aFndBox );
+ const SwTable& rTbl = pTblNd->GetTable();
+ ((SwTableLines&)rTbl.GetTabLines()).ForEach( &_FndLineCopyCol, &aPara );
+ }
+ rX = aFndBox.GetLines().Count();
+ if( !rX )
+ return FALSE;
+
+ rY = aFndBox.GetLines()[0]->GetBoxes().Count();
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Init-Liste
+ --------------------------------------------------------------------*/
+
+SwSortDlg::SwSortDlg(Window* pParent, SwWrtShell &rShell) :
+
+ SvxStandardDialog(pParent, SW_RES(DLG_SORTING)),
+ aColLbl(this, SW_RES(FT_COL )),
+ aTypLbl(this, SW_RES(FT_KEYTYP)),
+ aDirLbl(this, SW_RES(FT_DIR )),
+
+ aDirFL(this, SW_RES(FL_DIR )),
+
+ aKeyCB1(this, SW_RES(CB_KEY1 )),
+ aColEdt1(this, SW_RES(ED_KEY1 )),
+ aTypDLB1(this, SW_RES(DLB_KEY1 )),
+ aSortUpRB(this, SW_RES(RB_UP )),
+ aSortDnRB(this, SW_RES(RB_DN )),
+
+ aKeyCB2(this, SW_RES(CB_KEY2 )),
+ aColEdt2(this, SW_RES(ED_KEY2 )),
+ aTypDLB2(this, SW_RES(DLB_KEY2 )),
+ aSortUp2RB(this, SW_RES(RB_UP2 )),
+ aSortDn2RB(this, SW_RES(RB_DN2 )),
+
+ aKeyCB3(this, SW_RES(CB_KEY3 )),
+ aColEdt3(this, SW_RES(ED_KEY3 )),
+ aTypDLB3(this, SW_RES(DLB_KEY3 )),
+ aSortUp3RB(this, SW_RES(RB_UP3 )),
+ aSortDn3RB(this, SW_RES(RB_DN3 )),
+
+ aSortFL(this, SW_RES(FL_SORT_2 )),
+ aColumnRB(this, SW_RES(RB_COL )),
+ aRowRB(this, SW_RES(RB_ROW )),
+
+ aDelimFL(this, SW_RES(FL_DELIM )),
+ aDelimTabRB(this, SW_RES(RB_TAB )),
+ aDelimFreeRB(this, SW_RES(RB_TABCH )),
+ aDelimEdt(this, SW_RES(ED_TABCH )),
+ aDelimPB(this, SW_RES( PB_DELIM)),
+
+ aLangFL(this, SW_RES( FL_LANG )),
+ aLangLB(this, SW_RES( LB_LANG )),
+
+ aSortOptFL(this, SW_RES( FL_SORT )),
+ aCaseCB(this, SW_RES( CB_CASE )),
+
+ aOkBtn(this, SW_RES(BT_OK )),
+ aCancelBtn(this, SW_RES(BT_CANCEL)),
+ aHelpBtn(this, SW_RES(BT_HELP )),
+
+ aColTxt( SW_RES(STR_COL)),
+ aRowTxt( SW_RES(STR_ROW)),
+ aNumericTxt( SW_RES(STR_NUMERIC)),
+ rSh(rShell),
+ pColRes( 0 ),
+ nX( 99 ),
+ nY( 99 )
+{
+ aDelimEdt.SetMaxTextLen( 1 );
+ if(rSh.GetSelectionType() &
+ (nsSelectionType::SEL_TBL|nsSelectionType::SEL_TBL_CELLS) )
+ {
+ aColumnRB.Check(bCol);
+ aColLbl.SetText(bCol ? aRowTxt : aColTxt);
+ aRowRB.Check(!bCol);
+ aDelimTabRB.Enable(FALSE);
+ aDelimFreeRB.Enable(FALSE);
+ aDelimEdt.Enable(FALSE);
+ }
+ else
+ {
+ aColumnRB.Enable(FALSE);
+ aRowRB.Check(TRUE);
+ aColLbl.SetText(aColTxt);
+ }
+
+ // Initialisieren
+ Link aLk = LINK(this,SwSortDlg, CheckHdl);
+ aKeyCB1.SetClickHdl( aLk );
+ aKeyCB2.SetClickHdl( aLk );
+ aKeyCB3.SetClickHdl( aLk );
+ aColumnRB.SetClickHdl( aLk );
+ aRowRB.SetClickHdl( aLk );
+
+ aLk = LINK(this,SwSortDlg, DelimHdl);
+ aDelimFreeRB.SetClickHdl(aLk);
+ aDelimTabRB.SetClickHdl(aLk);
+
+ aDelimPB.SetClickHdl( LINK( this, SwSortDlg, DelimCharHdl ));
+
+ aKeyCB1.Check(bCheck1);
+ aKeyCB2.Check(bCheck2);
+ aKeyCB3.Check(bCheck3);
+
+ aColEdt1.SetValue(nCol1);
+ aColEdt2.SetValue(nCol2);
+ aColEdt3.SetValue(nCol3);
+
+ // first initialise the language, then select the
+ if( LANGUAGE_NONE == nLang || LANGUAGE_DONTKNOW == nLang )
+ nLang = (USHORT)GetAppLanguage();
+
+ aLangLB.SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, TRUE, FALSE);
+ aLangLB.SelectLanguage( nLang );
+
+ LanguageHdl( 0 );
+ aLangLB.SetSelectHdl( LINK( this, SwSortDlg, LanguageHdl ));
+
+ aSortUpRB.Check(bAsc1);
+ aSortDnRB.Check(!bAsc1);
+ aSortUp2RB.Check(bAsc2);
+ aSortDn2RB.Check(!bAsc2);
+ aSortUp3RB.Check(bAsc3);
+ aSortDn3RB.Check(!bAsc3);
+
+ aCaseCB.Check( bCsSens );
+
+ aDelimTabRB.Check(cDeli == '\t');
+ if(!aDelimTabRB.IsChecked())
+ {
+ aDelimEdt.SetText(cDeli);
+ aDelimFreeRB.Check(TRUE);
+ DelimHdl(&aDelimFreeRB);
+ }
+ else
+ DelimHdl(&aDelimTabRB);
+
+ FreeResource();
+ if( ::lcl_GetSelTbl( rSh, nX, nY) )
+ {
+ USHORT nMax = aRowRB.IsChecked()? nY : nX;
+ aColEdt1.SetMax(nMax);
+ aColEdt2.SetMax(nMax);
+ aColEdt3.SetMax(nMax);
+ }
+}
+
+SwSortDlg::~SwSortDlg()
+{
+ ::lcl_ClearLstBoxAndDelUserData( aTypDLB1 );
+ ::lcl_ClearLstBoxAndDelUserData( aTypDLB2 );
+ ::lcl_ClearLstBoxAndDelUserData( aTypDLB3 );
+ delete pColRes;
+}
+
+sal_Unicode SwSortDlg::GetDelimChar() const
+{
+ sal_Unicode cRet = '\t';
+ if( !aDelimTabRB.IsChecked() )
+ {
+ String aTmp( aDelimEdt.GetText() );
+ if( aTmp.Len() )
+ cRet = aTmp.GetChar( 0 );
+ }
+ return cRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: An die Core weiterreichen
+ --------------------------------------------------------------------*/
+void SwSortDlg::Apply()
+{
+ // Alte Einstellung speichern
+ //
+ bCheck1 = aKeyCB1.IsChecked();
+ bCheck2 = aKeyCB2.IsChecked();
+ bCheck3 = aKeyCB3.IsChecked();
+
+ nCol1 = (USHORT)aColEdt1.GetValue();
+ nCol2 = (USHORT)aColEdt2.GetValue();
+ nCol3 = (USHORT)aColEdt3.GetValue();
+
+ nType1 = aTypDLB1.GetSelectEntryPos();
+ nType2 = aTypDLB2.GetSelectEntryPos();
+ nType3 = aTypDLB3.GetSelectEntryPos();
+
+ bAsc1 = aSortUpRB.IsChecked();
+ bAsc2 = aSortUp2RB.IsChecked();
+ bAsc3 = aSortUp3RB.IsChecked();
+ bCol = aColumnRB.IsChecked();
+ nLang = aLangLB.GetSelectLanguage();
+ cDeli = GetDelimChar();
+ bCsSens = aCaseCB.IsChecked();
+
+ void* pUserData;
+ SwSortOptions aOptions;
+ if( bCheck1 )
+ {
+ String sEntry( aTypDLB1.GetSelectEntry() );
+ if( sEntry == aNumericTxt )
+ sEntry.Erase();
+ else if( 0 != (pUserData = aTypDLB1.GetEntryData(
+ aTypDLB1.GetSelectEntryPos())) )
+ sEntry = *(String*)pUserData;
+
+ SwSortKey *pKey = new SwSortKey( nCol1, sEntry,
+ bAsc1 ? SRT_ASCENDING : SRT_DESCENDING );
+ aOptions.aKeys.C40_INSERT(SwSortKey, pKey, aOptions.aKeys.Count());
+ }
+
+ if( bCheck2 )
+ {
+ String sEntry( aTypDLB2.GetSelectEntry() );
+ if( sEntry == aNumericTxt )
+ sEntry.Erase();
+ else if( 0 != (pUserData = aTypDLB2.GetEntryData(
+ aTypDLB2.GetSelectEntryPos())) )
+ sEntry = *(String*)pUserData;
+
+ SwSortKey *pKey = new SwSortKey( nCol2, sEntry,
+ bAsc2 ? SRT_ASCENDING : SRT_DESCENDING );
+ aOptions.aKeys.C40_INSERT( SwSortKey, pKey, aOptions.aKeys.Count() );
+ }
+
+ if( bCheck3 )
+ {
+ String sEntry( aTypDLB3.GetSelectEntry() );
+ if( sEntry == aNumericTxt )
+ sEntry.Erase();
+ else if( 0 != (pUserData = aTypDLB3.GetEntryData(
+ aTypDLB3.GetSelectEntryPos())) )
+ sEntry = *(String*)pUserData;
+
+ SwSortKey *pKey = new SwSortKey( nCol3, sEntry,
+ bAsc3 ? SRT_ASCENDING : SRT_DESCENDING );
+ aOptions.aKeys.C40_INSERT( SwSortKey, pKey, aOptions.aKeys.Count() );
+ }
+
+ aOptions.eDirection = bCol ? SRT_COLUMNS : SRT_ROWS;
+ aOptions.cDeli = cDeli;
+ aOptions.nLanguage = nLang;
+ aOptions.bTable = rSh.IsTableMode();
+ aOptions.bIgnoreCase = !bCsSens;
+
+ BOOL bRet;
+ {
+ SwWait aWait( *rSh.GetView().GetDocShell(), TRUE );
+ rSh.StartAllAction();
+ if( 0 != (bRet = rSh.Sort( aOptions )))
+ rSh.SetModified();
+ rSh.EndAllAction();
+ }
+
+ if( !bRet )
+ InfoBox( this->GetParent(), SW_RES(MSG_SRTERR)).Execute();
+}
+
+/* -----------------30.09.98 10:03-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwSortDlg, DelimHdl, RadioButton*, pButton )
+{
+ BOOL bEnable = pButton == &aDelimFreeRB && aDelimFreeRB.IsEnabled();
+ aDelimEdt.Enable( bEnable );
+ aDelimPB.Enable( bEnable );
+ return 0;
+}
+
+IMPL_LINK( SwSortDlg, DelimCharHdl, PushButton*, EMPTYARG )
+{
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ SfxAllItemSet aSet( rSh.GetAttrPool() );
+ aSet.Put( SfxInt32Item( SID_ATTR_CHAR, GetDelimChar() ) );
+ SfxAbstractDialog* pMap = pFact->CreateSfxDialog( &aDelimPB, aSet,
+ rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
+ if( RET_OK == pMap->Execute() )
+ {
+ SFX_ITEMSET_ARG( pMap->GetOutputItemSet(), pItem, SfxInt32Item, SID_ATTR_CHAR, FALSE );
+ if ( pItem )
+ aDelimEdt.SetText( sal_Unicode ( pItem->GetValue() ) );
+ }
+
+ delete pMap;
+ }
+ return 0;
+}
+
+
+IMPL_LINK( SwSortDlg, CheckHdl, CheckBox *, pCheck )
+{
+ if( pCheck == ( CheckBox* ) &aRowRB)
+ {
+ aColLbl.SetText(aColTxt);
+ aColEdt1.SetMax(nY);
+ aColEdt2.SetMax(nY);
+ aColEdt3.SetMax(nY);
+
+ }
+ else if( pCheck == ( CheckBox* ) &aColumnRB)
+ {
+ aColLbl.SetText(aRowTxt);
+ aColEdt1.SetMax(nX);
+ aColEdt2.SetMax(nX);
+ aColEdt3.SetMax(nX);
+ }
+ else if(!aKeyCB1.IsChecked() &&
+ !aKeyCB2.IsChecked() &&
+ !aKeyCB3.IsChecked())
+ pCheck->Check(TRUE);
+ return 0;
+}
+
+IMPL_LINK( SwSortDlg, LanguageHdl, ListBox*, pLBox )
+{
+ Locale aLcl( SvxCreateLocale( aLangLB.GetSelectLanguage() ) );
+ Sequence < OUString > aSeq(
+ GetAppCollator().listCollatorAlgorithms( aLcl ));
+
+ if( !pColRes )
+ pColRes = new CollatorRessource();
+
+ const USHORT nLstBoxCnt = 3;
+ ListBox* aLstArr[ nLstBoxCnt ] = { &aTypDLB1, &aTypDLB2, &aTypDLB3 };
+ USHORT* aTypeArr[ nLstBoxCnt ] = { &nType1, &nType2, &nType3 };
+ String aOldStrArr[ nLstBoxCnt ];
+ USHORT n;
+
+ void* pUserData;
+ for( n = 0; n < nLstBoxCnt; ++n )
+ {
+ ListBox* pL = aLstArr[ n ];
+ if( 0 != (pUserData = pL->GetEntryData( pL->GetSelectEntryPos())) )
+ aOldStrArr[ n ] = *(String*)pUserData;
+ ::lcl_ClearLstBoxAndDelUserData( *pL );
+ }
+
+ USHORT nInsPos;
+ String sAlg, sUINm;
+ for( long nCnt = 0, nEnd = aSeq.getLength(); nCnt <= nEnd; ++nCnt )
+ {
+ if( nCnt < nEnd )
+ sUINm = pColRes->GetTranslation( sAlg = aSeq[ nCnt ] );
+ else
+ sUINm = sAlg = aNumericTxt;
+
+ for( n = 0; n < nLstBoxCnt; ++n )
+ {
+ ListBox* pL = aLstArr[ n ];
+ nInsPos = pL->InsertEntry( sUINm );
+ pL->SetEntryData( nInsPos, new String( sAlg ));
+ if( pLBox && sAlg == aOldStrArr[ n ] )
+ pL->SelectEntryPos( nInsPos );
+ }
+ }
+
+ for( n = 0; n < nLstBoxCnt; ++n )
+ {
+ ListBox* pL = aLstArr[ n ];
+ if( !pLBox )
+ pL->SelectEntryPos( *aTypeArr[n] );
+ else if( LISTBOX_ENTRY_NOTFOUND == pL->GetSelectEntryPos() )
+ pL->SelectEntryPos( 0 );
+ }
+ return 0;
+}
+
+
+
+
+
+
diff --git a/sw/source/ui/misc/srtdlg.hrc b/sw/source/ui/misc/srtdlg.hrc
new file mode 100644
index 000000000000..101f819b8739
--- /dev/null
+++ b/sw/source/ui/misc/srtdlg.hrc
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define BT_OK 1
+#define BT_CANCEL 2
+#define FT_COL 3
+#define FT_KEYTYP 4
+#define CB_KEY1 5
+#define ED_KEY1 6
+#define DLB_KEY1 7
+#define CB_KEY2 8
+#define ED_KEY2 9
+#define DLB_KEY2 10
+#define CB_KEY3 11
+#define ED_KEY3 12
+#define DLB_KEY3 13
+#define FL_SORT_2 14
+#define RB_COL 15
+#define RB_ROW 16
+#define FL_DIR 17
+#define RB_UP 18
+#define RB_DN 19
+#define FL_ORDER 20
+#define RB_TAB 21
+#define RB_TABCH 22
+#define ED_TABCH 23
+#define FL_DELIM 24
+#define STR_ROW 25
+#define STR_COL 26
+#define BT_HELP 27
+#define FT_DIR 28
+#define RB_UP2 29
+#define RB_DN2 30
+#define RB_UP3 31
+#define RB_DN3 32
+#define STR_NUMERIC 33
+#define PB_DELIM 34
+#define FL_LANG 35
+#define LB_LANG 36
+#define FL_SORT 37
+#define CB_CASE 38
+
diff --git a/sw/source/ui/misc/srtdlg.src b/sw/source/ui/misc/srtdlg.src
new file mode 100644
index 000000000000..5bfbc4600e10
--- /dev/null
+++ b/sw/source/ui/misc/srtdlg.src
@@ -0,0 +1,407 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "misc.hrc"
+#include "srtdlg.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+
+ModalDialog DLG_SORTING
+{
+ HelpID = CMD_FN_SORTING_DLG ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 268 , 193 ) ;
+ Text [ en-US ] = "Sort" ;
+ Moveable = TRUE ;
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 212 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 212 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 212 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_COL
+ {
+ Pos = MAP_APPFONT ( 68 , 12 ) ;
+ Size = MAP_APPFONT ( 25 , 8 ) ;
+ Text [ en-US ] = "Column" ;
+ Left = TRUE ;
+ };
+ FixedText FT_KEYTYP
+ {
+ Pos = MAP_APPFONT ( 101, 12 ) ;
+ Size = MAP_APPFONT ( 48 , 8 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Schlüsseltyp : Schl³sseltyp */
+ Text [ en-US ] = "Key type" ;
+ Left = TRUE ;
+ };
+ FixedText FT_DIR
+ {
+ Pos = MAP_APPFONT ( 155 , 12 ) ;
+ Size = MAP_APPFONT ( 49 , 10 ) ;
+ Text [ en-US ] = "Order" ;
+ };
+ CheckBox CB_KEY1
+ {
+ HelpID = "sw:CheckBox:DLG_SORTING:CB_KEY1";
+ Pos = MAP_APPFONT ( 12 , 25 ) ;
+ Size = MAP_APPFONT ( 49 , 8 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Schlüssel ~1 : Schl³ssel ~1 */
+ Text [ en-US ] = "Key ~1" ;
+ Check = TRUE ;
+ };
+ NumericField ED_KEY1
+ {
+ HelpID = "sw:NumericField:DLG_SORTING:ED_KEY1";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , 23 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ Text = "10" ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ };
+ String STR_NUMERIC
+ {
+ Text [ en-US ] = "Numeric";
+ };
+ ListBox DLB_KEY1
+ {
+ HelpID = "sw:ListBox:DLG_SORTING:DLB_KEY1";
+ Pos = MAP_APPFONT ( 96 , 23 ) ;
+ Size = MAP_APPFONT ( 55 , 45 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ Sort = TRUE;
+ };
+ RadioButton RB_UP
+ {
+ HelpID = "sw:RadioButton:DLG_SORTING:RB_UP";
+ Pos = MAP_APPFONT ( 155 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "~Ascending" ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ };
+ RadioButton RB_DN
+ {
+ HelpID = "sw:RadioButton:DLG_SORTING:RB_DN";
+ Pos = MAP_APPFONT ( 155 , 35 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "~Descending" ;
+ TabStop = TRUE ;
+ };
+ CheckBox CB_KEY2
+ {
+ HelpID = "sw:CheckBox:DLG_SORTING:CB_KEY2";
+ Pos = MAP_APPFONT ( 12 , 52 ) ;
+ Size = MAP_APPFONT ( 49 , 8 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Schlüssel ~2 : Schl³ssel ~2 */
+ Text [ en-US ] = "Key ~2" ;
+ };
+ NumericField ED_KEY2
+ {
+ HelpID = "sw:NumericField:DLG_SORTING:ED_KEY2";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , 50 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ };
+ ListBox DLB_KEY2
+ {
+ HelpID = "sw:ListBox:DLG_SORTING:DLB_KEY2";
+ Pos = MAP_APPFONT ( 96 , 50 ) ;
+ Size = MAP_APPFONT ( 55 , 45 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ Sort = TRUE;
+ };
+ RadioButton RB_UP2
+ {
+ HelpID = "sw:RadioButton:DLG_SORTING:RB_UP2";
+ Pos = MAP_APPFONT ( 155 , 50 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "Ascending" ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ };
+ RadioButton RB_DN2
+ {
+ HelpID = "sw:RadioButton:DLG_SORTING:RB_DN2";
+ Pos = MAP_APPFONT ( 155 , 62 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "Descending" ;
+ TabStop = TRUE ;
+ };
+ CheckBox CB_KEY3
+ {
+ HelpID = "sw:CheckBox:DLG_SORTING:CB_KEY3";
+ Pos = MAP_APPFONT ( 12 , 81 ) ;
+ Size = MAP_APPFONT ( 49 , 8 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Schlüssel ~3 : Schl³ssel ~3 */
+ Text [ en-US ] = "Key ~3" ;
+ };
+ NumericField ED_KEY3
+ {
+ HelpID = "sw:NumericField:DLG_SORTING:ED_KEY3";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 66 , 79 ) ;
+ Size = MAP_APPFONT ( 25 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Value = 1 ;
+ First = 1 ;
+ Last = 99 ;
+ SpinSize = 1 ;
+ };
+ ListBox DLB_KEY3
+ {
+ HelpID = "sw:ListBox:DLG_SORTING:DLB_KEY3";
+ Pos = MAP_APPFONT ( 96 , 79 ) ;
+ Size = MAP_APPFONT ( 55 , 45 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ CurPos = 0 ;
+ Sort = TRUE;
+ };
+ RadioButton RB_UP3
+ {
+ HelpID = "sw:RadioButton:DLG_SORTING:RB_UP3";
+ Pos = MAP_APPFONT ( 155 , 79 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "Ascending" ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ };
+ RadioButton RB_DN3
+ {
+ HelpID = "sw:RadioButton:DLG_SORTING:RB_DN3";
+ Pos = MAP_APPFONT ( 155 , 91 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "Descending" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SORT_2
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 200 , 8 ) ;
+ Text [ en-US ] = "Sort criteria" ;
+ };
+ RadioButton RB_COL
+ {
+ HelpID = "sw:RadioButton:DLG_SORTING:RB_COL";
+ Pos = MAP_APPFONT ( 12 , 120 ) ;
+ Size = MAP_APPFONT ( 38 , 10 ) ;
+ Text [ en-US ] = "Col~umns" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_ROW
+ {
+ HelpID = "sw:RadioButton:DLG_SORTING:RB_ROW";
+ Pos = MAP_APPFONT ( 12 , 133 ) ;
+ Size = MAP_APPFONT ( 34 , 10 ) ;
+ Text [ en-US ] = "~Rows" ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ };
+ FixedLine FL_DIR
+ {
+ Pos = MAP_APPFONT ( 6 , 108 ) ;
+ Size = MAP_APPFONT ( 95 , 8 ) ;
+ Text [ en-US ] = "Direction" ;
+ };
+ RadioButton RB_TAB
+ {
+ HelpID = "sw:RadioButton:DLG_SORTING:RB_TAB";
+ Pos = MAP_APPFONT ( 113 , 120 ) ;
+ Size = MAP_APPFONT ( 44 , 9 ) ;
+ Text [ en-US ] = "~Tabs" ;
+ TabStop = TRUE ;
+ Check = TRUE ;
+ };
+ RadioButton RB_TABCH
+ {
+ HelpID = "sw:RadioButton:DLG_SORTING:RB_TABCH";
+ Pos = MAP_APPFONT ( 113 , 133 ) ;
+ Size = MAP_APPFONT ( 38 , 10 ) ;
+ Text [ en-US ] = "~Character" ;
+ TabStop = TRUE ;
+ };
+ Edit ED_TABCH
+ {
+ HelpID = "sw:Edit:DLG_SORTING:ED_TABCH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 180 , 133 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ };
+ FixedLine FL_DELIM
+ {
+ Pos = MAP_APPFONT ( 107 , 108 ) ;
+ Size = MAP_APPFONT ( 99 , 8 ) ;
+ Text [ en-US ] = "Separator" ;
+ };
+ String STR_ROW
+ {
+ Text [ en-US ] = "Rows" ;
+ };
+ String STR_COL
+ {
+ Text [ en-US ] = "Column" ;
+ };
+ PushButton PB_DELIM
+ {
+ HelpID = "sw:PushButton:DLG_SORTING:PB_DELIM";
+ Pos = MAP_APPFONT ( 195 , 133 ) ;
+ Size = MAP_APPFONT ( 12 , 12 ) ;
+ TabStop = TRUE ;
+ Text = "...";
+ };
+ FixedLine FL_LANG
+ {
+ Pos = MAP_APPFONT ( 6 , 147 ) ;
+ Size = MAP_APPFONT ( 95 , 8 ) ;
+ Text [ en-US ] = "Language";
+ };
+ ListBox LB_LANG
+ {
+ HelpID = "sw:ListBox:DLG_SORTING:LB_LANG";
+ Pos = MAP_APPFONT ( 12 , 158 ) ;
+ Size = MAP_APPFONT ( 83 , 61 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedLine FL_SORT
+ {
+ Pos = MAP_APPFONT ( 107 , 147 ) ;
+ Size = MAP_APPFONT ( 99 , 8 ) ;
+ Text [ en-US ] = "Setting";
+ };
+ CheckBox CB_CASE
+ {
+ HelpID = "sw:CheckBox:DLG_SORTING:CB_CASE";
+ Pos = MAP_APPFONT ( 113 , 159 ) ;
+ Size = MAP_APPFONT ( 147 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Match case";
+ };
+
+};
+InfoBox MSG_SRTERR
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "Cannot sort selection" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/misc/swmodalredlineacceptdlg.cxx b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx
new file mode 100644
index 000000000000..954d1a017a77
--- /dev/null
+++ b/sw/source/ui/misc/swmodalredlineacceptdlg.cxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+#define _SVSTDARR_STRINGSSORTDTOR
+#define _SVSTDARR_USHORTSSORT
+#define _SVSTDARR_USHORTS
+
+
+#include <redline.hxx>
+#include <tools/datetime.hxx>
+#include <vcl/msgbox.hxx>
+#ifndef _SVSTDARR_HXX
+#include <svl/svstdarr.hxx>
+#endif
+#include <svl/eitem.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/ctredlin.hxx>
+#include <svx/postattr.hxx>
+#include <swtypes.hxx>
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <swmodule.hxx>
+#include <swwait.hxx>
+#include <uitool.hxx>
+
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _MISC_HRC
+#include <misc.hrc>
+#endif
+#ifndef _REDLNDLG_HRC
+#include <redlndlg.hrc>
+#endif
+#ifndef _SHELLS_HRC
+#include <shells.hrc>
+#endif
+
+#include <vector>
+#ifndef _REDLNDLG_HXX
+#define _REDLNACCEPTDLG
+#include <redlndlg.hxx>
+#endif
+#include "swmodalredlineacceptdlg.hxx"
+
+#include <unomid.h>
+
+
+SwModalRedlineAcceptDlg::SwModalRedlineAcceptDlg(Window *pParent) :
+ SfxModalDialog(pParent, SW_RES(DLG_MOD_REDLINE_ACCEPT))
+{
+ pImplDlg = new SwRedlineAcceptDlg(this, TRUE);
+
+ pImplDlg->Initialize(GetExtraData());
+ pImplDlg->Activate(); // Zur Initialisierung der Daten
+
+ FreeResource();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwModalRedlineAcceptDlg::~SwModalRedlineAcceptDlg()
+{
+ AcceptAll(FALSE); // Alles uebriggebliebene ablehnen
+ pImplDlg->FillInfo(GetExtraData());
+
+ delete pImplDlg;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwModalRedlineAcceptDlg::Activate()
+{
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwModalRedlineAcceptDlg::Resize()
+{
+ pImplDlg->Resize();
+ SfxModalDialog::Resize();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwModalRedlineAcceptDlg::AcceptAll( BOOL bAccept )
+{
+ SvxTPFilter* pFilterTP = pImplDlg->GetChgCtrl()->GetFilterPage();
+
+ if (pFilterTP->IsDate() || pFilterTP->IsAuthor() ||
+ pFilterTP->IsRange() || pFilterTP->IsAction())
+ {
+ pFilterTP->CheckDate(FALSE); // Alle Filter abschalten
+ pFilterTP->CheckAuthor(FALSE);
+ pFilterTP->CheckRange(FALSE);
+ pFilterTP->CheckAction(FALSE);
+ pImplDlg->FilterChangedHdl();
+ }
+
+ pImplDlg->CallAcceptReject( FALSE, bAccept );
+}
diff --git a/sw/source/ui/ribbar/conarc.cxx b/sw/source/ui/ribbar/conarc.cxx
new file mode 100644
index 000000000000..4b2fafbd6040
--- /dev/null
+++ b/sw/source/ui/ribbar/conarc.cxx
@@ -0,0 +1,161 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <svx/svdobj.hxx>
+
+
+#include "view.hxx"
+#include "edtwin.hxx"
+#include "wrtsh.hxx"
+#include "drawbase.hxx"
+#include "conarc.hxx"
+
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+
+
+ConstArc::ConstArc(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView)
+ : SwDrawBase(pWrtShell, pEditWin, pSwView), nAnzButUp(0)
+{
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+
+
+BOOL ConstArc::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ BOOL bReturn;
+
+ if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == TRUE)
+ {
+ if (!nAnzButUp)
+ aStartPnt = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
+ }
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+
+
+BOOL ConstArc::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ BOOL bReturn = FALSE;
+
+ if ((m_pSh->IsDrawCreate() || m_pWin->IsDrawAction()) && rMEvt.IsLeft())
+ {
+ Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
+ if (!nAnzButUp && aPnt == aStartPnt)
+ {
+ SwDrawBase::MouseButtonUp(rMEvt);
+ bReturn = TRUE;
+ }
+ else
+ { nAnzButUp++;
+
+ if (nAnzButUp == 3) // Kreisbogenerzeugung beendet
+ {
+ SwDrawBase::MouseButtonUp(rMEvt);
+ nAnzButUp = 0;
+ bReturn = TRUE;
+ }
+ else
+ m_pSh->EndCreate(SDRCREATE_NEXTPOINT);
+ }
+ }
+/* else if ( pView->IsCreateObj() && rMEvt.IsRight() )
+ {
+ pView->EndCreateObj( SDRCREATE_FORCEEND );
+ bReturn = TRUE;
+ }*/
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+
+
+void ConstArc::Activate(const USHORT nSlotId)
+{
+ switch (nSlotId)
+ {
+ case SID_DRAW_ARC:
+ m_pWin->SetSdrDrawMode(OBJ_CARC);
+ break;
+ case SID_DRAW_PIE:
+ m_pWin->SetSdrDrawMode(OBJ_SECT);
+ break;
+ case SID_DRAW_CIRCLECUT:
+ m_pWin->SetSdrDrawMode(OBJ_CCUT);
+ break;
+ default:
+ m_pWin->SetSdrDrawMode(OBJ_NONE);
+ break;
+ }
+
+ SwDrawBase::Activate(nSlotId);
+}
+
+/*************************************************************************
+|*
+|* Funktion deaktivieren
+|*
+\************************************************************************/
+
+void ConstArc::Deactivate()
+{
+ nAnzButUp = 0;
+
+ SwDrawBase::Deactivate();
+}
+
+
+
diff --git a/sw/source/ui/ribbar/concustomshape.cxx b/sw/source/ui/ribbar/concustomshape.cxx
new file mode 100644
index 000000000000..66ba929fae47
--- /dev/null
+++ b/sw/source/ui/ribbar/concustomshape.cxx
@@ -0,0 +1,252 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/bindings.hxx>
+#include <svx/htmlmode.hxx>
+#include <svx/sdtacitm.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/sdtagitm.hxx>
+#include <svx/sdtakitm.hxx>
+#include <svx/sdtaditm.hxx>
+#include <svx/sdtaaitm.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdocapt.hxx>
+#include <editeng/outlobj.hxx>
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <edtwin.hxx>
+#include <wrtsh.hxx>
+#include <viewopt.hxx>
+#ifndef _DRAWBASE_HXX
+#include <drawbase.hxx>
+#endif
+#include <concustomshape.hxx>
+#include <svx/gallery.hxx>
+#include <sfx2/request.hxx>
+#ifndef _FM_FMMODEL_HXX
+#include <svx/fmmodel.hxx>
+#endif
+#include <svl/itempool.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdoashp.hxx>
+#include <editeng/adjitem.hxx>
+
+#include <math.h>
+
+/*************************************************************************
+|*
+|* C'Tor
+|*
+\************************************************************************/
+ConstCustomShape::ConstCustomShape( SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView, SfxRequest& rReq )
+ : SwDrawBase( pWrtShell, pEditWin, pSwView )
+{
+ aCustomShape = ConstCustomShape::GetShapeTypeFromRequest( rReq );
+}
+
+/*************************************************************************
+|*
+\************************************************************************/
+
+rtl::OUString ConstCustomShape::GetShapeType() const
+{
+ return aCustomShape;
+}
+
+//static
+rtl::OUString ConstCustomShape::GetShapeTypeFromRequest( SfxRequest& rReq )
+{
+ rtl::OUString aRet;
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ if ( pArgs )
+ {
+ const SfxStringItem& rItm = (const SfxStringItem&)pArgs->Get( rReq.GetSlot() );
+ aRet = rItm.GetValue();
+ }
+ return aRet;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+BOOL ConstCustomShape::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = SwDrawBase::MouseButtonDown(rMEvt);
+ if ( bReturn )
+ {
+ SdrView *pSdrView = m_pSh->GetDrawView();
+ if ( pSdrView )
+ {
+ SdrObject* pObj = pSdrView->GetCreateObj();
+ if ( pObj )
+ {
+ SetAttributes( pObj );
+ sal_Bool bForceFillStyle = sal_True;
+ sal_Bool bForceNoFillStyle = sal_False;
+ if ( ((SdrObjCustomShape*)pObj)->UseNoFillStyle() )
+ {
+ bForceFillStyle = sal_False;
+ bForceNoFillStyle = sal_True;
+ }
+
+ SfxItemSet aAttr( m_pView->GetPool() );
+ if ( bForceNoFillStyle )
+ aAttr.Put( XFillStyleItem( XFILL_NONE ) );
+ pObj->SetMergedItemSet(aAttr);
+ }
+ }
+ }
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+BOOL ConstCustomShape::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ return SwDrawBase::MouseButtonUp(rMEvt);
+}
+
+/*************************************************************************
+|*
+|* activate function
+|*
+\************************************************************************/
+
+void ConstCustomShape::Activate(const USHORT nSlotId)
+{
+ m_pWin->SetSdrDrawMode( OBJ_CUSTOMSHAPE );
+
+ SwDrawBase::Activate(nSlotId);
+}
+
+/*************************************************************************
+|*
+|* applying attributes
+|*
+\************************************************************************/
+
+void ConstCustomShape::SetAttributes( SdrObject* pObj )
+{
+ sal_Bool bAttributesAppliedFromGallery = sal_False;
+
+ if ( GalleryExplorer::GetSdrObjCount( GALLERY_THEME_POWERPOINT ) )
+ {
+ std::vector< rtl::OUString > aObjList;
+ if ( GalleryExplorer::FillObjListTitle( GALLERY_THEME_POWERPOINT, aObjList ) )
+ {
+ sal_uInt16 i;
+ for ( i = 0; i < aObjList.size(); i++ )
+ {
+ if ( aObjList[ i ].equalsIgnoreAsciiCase( aCustomShape ) )
+ {
+ FmFormModel aFormModel;
+ SfxItemPool& rPool = aFormModel.GetItemPool();
+ rPool.FreezeIdRanges();
+ if ( GalleryExplorer::GetSdrObj( GALLERY_THEME_POWERPOINT, i, &aFormModel ) )
+ {
+ const SdrObject* pSourceObj = aFormModel.GetPage( 0 )->GetObj( 0 );
+ if( pSourceObj )
+ {
+ const SfxItemSet& rSource = pSourceObj->GetMergedItemSet();
+ SfxItemSet aDest( pObj->GetModel()->GetItemPool(), // ranges from SdrAttrObj
+ SDRATTR_START, SDRATTR_SHADOW_LAST,
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+ SDRATTR_TEXTDIRECTION, SDRATTR_TEXTDIRECTION,
+ // Graphic Attributes
+ SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST,
+ // 3d Properties
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
+ // CustomShape properties
+ SDRATTR_CUSTOMSHAPE_FIRST, SDRATTR_CUSTOMSHAPE_LAST,
+ // range from SdrTextObj
+ EE_ITEMS_START, EE_ITEMS_END,
+ // end
+ 0, 0);
+ aDest.Set( rSource );
+ pObj->SetMergedItemSet( aDest );
+ sal_Int32 nAngle = pSourceObj->GetRotateAngle();
+ if ( nAngle )
+ {
+ double a = nAngle * F_PI18000;
+ pObj->NbcRotate( pObj->GetSnapRect().Center(), nAngle, sin( a ), cos( a ) );
+ }
+ bAttributesAppliedFromGallery = sal_True;
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ if ( !bAttributesAppliedFromGallery )
+ {
+ pObj->SetMergedItem( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ) );
+ pObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
+ pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) );
+ pObj->SetMergedItem( SdrTextAutoGrowHeightItem( sal_False ) );
+ ((SdrObjCustomShape*)pObj)->MergeDefaultAttributes( &aCustomShape );
+ }
+}
+
+void ConstCustomShape::CreateDefaultObject()
+{
+ SwDrawBase::CreateDefaultObject();
+ SdrView *pSdrView = m_pSh->GetDrawView();
+ if ( pSdrView )
+ {
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ if ( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ if ( pObj && pObj->ISA( SdrObjCustomShape ) )
+ SetAttributes( pObj );
+ }
+ }
+}
+
+// #i33136#
+bool ConstCustomShape::doConstructOrthogonal() const
+{
+ return SdrObjCustomShape::doConstructOrthogonal(aCustomShape);
+}
+
+// eof
diff --git a/sw/source/ui/ribbar/conform.cxx b/sw/source/ui/ribbar/conform.cxx
new file mode 100644
index 000000000000..8682e1d34462
--- /dev/null
+++ b/sw/source/ui/ribbar/conform.cxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <svx/fmglob.hxx>
+#include <svx/svdview.hxx>
+#include <svx/fmshell.hxx>
+
+#include "view.hxx"
+#include "edtwin.hxx"
+#include "wrtsh.hxx"
+#include "drawbase.hxx"
+#include "conform.hxx"
+
+extern BOOL bNoInterrupt; // in mainwn.cxx
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+
+ConstFormControl::ConstFormControl(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) :
+ SwDrawBase(pWrtShell, pEditWin, pSwView)
+{
+ m_bInsForm = TRUE;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+
+BOOL ConstFormControl::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FALSE;
+
+ SdrView *pSdrView = m_pSh->GetDrawView();
+
+ pSdrView->SetOrtho(rMEvt.IsShift());
+ pSdrView->SetAngleSnapEnabled(rMEvt.IsShift());
+
+ if (rMEvt.IsMod2())
+ {
+ pSdrView->SetCreate1stPointAsCenter(TRUE);
+ pSdrView->SetResizeAtCenter(TRUE);
+ }
+ else
+ {
+ pSdrView->SetCreate1stPointAsCenter(FALSE);
+ pSdrView->SetResizeAtCenter(FALSE);
+ }
+
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ // Nur neues Objekt, wenn nicht im Basismode (bzw reinem Selektionsmode)
+ if (rMEvt.IsLeft() && !m_pWin->IsDrawAction() &&
+ (eHit == SDRHIT_UNMARKEDOBJECT || eHit == SDRHIT_NONE || m_pSh->IsDrawCreate()))
+ {
+ bNoInterrupt = TRUE;
+ m_pWin->CaptureMouse();
+
+ m_pWin->SetPointer(Pointer(POINTER_DRAW_RECT));
+
+ m_aStartPos = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
+ bReturn = m_pSh->BeginCreate( static_cast< UINT16 >(m_pWin->GetSdrDrawMode()), FmFormInventor, m_aStartPos);
+
+ if (bReturn)
+ m_pWin->SetDrawAction(TRUE);
+ }
+ else
+ bReturn = SwDrawBase::MouseButtonDown(rMEvt);
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+
+void ConstFormControl::Activate(const USHORT nSlotId)
+{
+ m_pWin->SetSdrDrawMode( static_cast<SdrObjKind>(nSlotId) );
+ SwDrawBase::Activate(nSlotId);
+ m_pSh->GetDrawView()->SetCurrentObj(nSlotId);
+
+ m_pWin->SetPointer(Pointer(POINTER_DRAW_RECT));
+}
+/* -----------------------------19.04.2002 12:42------------------------------
+
+ ---------------------------------------------------------------------------*/
+void ConstFormControl::CreateDefaultObject()
+{
+ Point aStartPos(GetDefaultCenterPos());
+ Point aEndPos(aStartPos);
+ aStartPos.X() -= 2 * MM50;
+ aStartPos.Y() -= MM50;
+ aEndPos.X() += 2 * MM50;
+ aEndPos.Y() += MM50;
+
+ if(!m_pSh->HasDrawView())
+ m_pSh->MakeDrawView();
+
+ SdrView *pSdrView = m_pSh->GetDrawView();
+ pSdrView->SetDesignMode(TRUE);
+ m_pSh->BeginCreate( static_cast< UINT16 >(m_pWin->GetSdrDrawMode()), FmFormInventor, aStartPos);
+ m_pSh->MoveCreate(aEndPos);
+ m_pSh->EndCreate(SDRCREATE_FORCEEND);
+}
+
diff --git a/sw/source/ui/ribbar/conpoly.cxx b/sw/source/ui/ribbar/conpoly.cxx
new file mode 100644
index 000000000000..0dbf109cc783
--- /dev/null
+++ b/sw/source/ui/ribbar/conpoly.cxx
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <svx/svdmark.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdopath.hxx>
+
+#include "view.hxx"
+#include "edtwin.hxx"
+#include "wrtsh.hxx"
+#include "drawbase.hxx"
+#include "conpoly.hxx"
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+
+
+ConstPolygon::ConstPolygon(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) :
+ SwDrawBase(pWrtShell, pEditWin, pSwView)
+{
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+
+
+BOOL ConstPolygon::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ BOOL bReturn;
+
+ if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == TRUE)
+ aLastPos = rMEvt.GetPosPixel();
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+
+
+BOOL ConstPolygon::MouseMove(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FALSE;
+
+ bReturn = SwDrawBase::MouseMove(rMEvt);
+
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+
+
+BOOL ConstPolygon::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FALSE;
+
+ if (m_pSh->IsDrawCreate())
+ {
+ if (rMEvt.IsLeft() && rMEvt.GetClicks() == 1 &&
+ m_pWin->GetSdrDrawMode() != OBJ_FREELINE)
+ {
+ if (!m_pSh->EndCreate(SDRCREATE_NEXTPOINT))
+ {
+ m_pSh->BreakCreate();
+ EnterSelectMode(rMEvt);
+ return TRUE;
+ }
+ }
+ else
+ {
+ Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
+ bReturn = SwDrawBase::MouseButtonUp(rMEvt);
+
+ // #i85045# removed double mechanism to check for AutoClose polygon
+ // after construction; the method here did not check for already closed and
+ // also worked only for a single polygon. Removing.
+ }
+ }
+ else
+ bReturn = SwDrawBase::MouseButtonUp(rMEvt);
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+
+
+void ConstPolygon::Activate(const USHORT nSlotId)
+{
+ switch (nSlotId)
+ {
+ case SID_DRAW_POLYGON_NOFILL:
+ m_pWin->SetSdrDrawMode(OBJ_PLIN);
+ break;
+
+ case SID_DRAW_BEZIER_NOFILL:
+ m_pWin->SetSdrDrawMode(OBJ_PATHLINE);
+ break;
+
+ case SID_DRAW_FREELINE_NOFILL:
+ m_pWin->SetSdrDrawMode(OBJ_FREELINE);
+ break;
+
+ default:
+ break;
+ }
+
+ SwDrawBase::Activate(nSlotId);
+}
+
+
+
diff --git a/sw/source/ui/ribbar/conrect.cxx b/sw/source/ui/ribbar/conrect.cxx
new file mode 100644
index 000000000000..3d77ae4829af
--- /dev/null
+++ b/sw/source/ui/ribbar/conrect.cxx
@@ -0,0 +1,229 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/bindings.hxx>
+#include <svx/htmlmode.hxx>
+#include <svx/sdtacitm.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/sdtagitm.hxx>
+#include <svx/sdtakitm.hxx>
+#include <svx/sdtaditm.hxx>
+#include <svx/sdtaaitm.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdocapt.hxx>
+#include <editeng/outlobj.hxx>
+#include <cmdid.h>
+#include <view.hxx>
+#include <edtwin.hxx>
+#include <wrtsh.hxx>
+#include <viewopt.hxx>
+#include <drawbase.hxx>
+#include <conrect.hxx>
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+ConstRectangle::ConstRectangle( SwWrtShell* pWrtShell, SwEditWin* pEditWin,
+ SwView* pSwView )
+ : SwDrawBase( pWrtShell, pEditWin, pSwView ),
+ bMarquee(FALSE),
+ // #93382#
+ mbVertical(sal_False)
+{
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+BOOL ConstRectangle::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ BOOL bReturn;
+
+ if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == TRUE
+ && m_pWin->GetSdrDrawMode() == OBJ_CAPTION)
+ {
+ m_pView->NoRotate();
+ if (m_pView->IsDrawSelMode())
+ {
+ m_pView->FlipDrawSelMode();
+ m_pSh->GetDrawView()->SetFrameDragSingles(m_pView->IsDrawSelMode());
+ }
+ }
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+BOOL ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
+
+ BOOL bRet = SwDrawBase::MouseButtonUp(rMEvt);
+ if( bRet )
+ {
+ SdrView *pSdrView = m_pSh->GetDrawView();
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ SdrObject* pObj = rMarkList.GetMark(0) ? rMarkList.GetMark(0)->GetMarkedSdrObj()
+ : 0;
+ switch( m_pWin->GetSdrDrawMode() )
+ {
+ case OBJ_TEXT:
+ if( bMarquee )
+ {
+ m_pSh->ChgAnchor(FLY_AS_CHAR);
+
+ if( pObj )
+ {
+ // die fuer das Scrollen benoetigten Attribute setzen
+ SfxItemSet aItemSet( pSdrView->GetModel()->GetItemPool(),
+ SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST);
+
+ aItemSet.Put( SdrTextAutoGrowWidthItem( FALSE ) );
+ aItemSet.Put( SdrTextAutoGrowHeightItem( FALSE ) );
+ aItemSet.Put( SdrTextAniKindItem( SDRTEXTANI_SCROLL ) );
+ aItemSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) );
+ aItemSet.Put( SdrTextAniCountItem( 0 ) );
+ aItemSet.Put( SdrTextAniAmountItem(
+ (INT16)m_pWin->PixelToLogic(Size(2,1)).Width()) );
+
+ pObj->SetMergedItemSetAndBroadcast(aItemSet);
+ }
+ }
+ else if(mbVertical && pObj && pObj->ISA(SdrTextObj))
+ {
+ // #93382#
+ SdrTextObj* pText = (SdrTextObj*)pObj;
+ SfxItemSet aSet(pSdrView->GetModel()->GetItemPool());
+
+ pText->SetVerticalWriting(TRUE);
+
+ aSet.Put(SdrTextAutoGrowWidthItem(TRUE));
+ aSet.Put(SdrTextAutoGrowHeightItem(FALSE));
+ aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
+ aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
+
+ pText->SetMergedItemSet(aSet);
+ }
+ if( pObj )
+ {
+ SdrPageView* pPV = pSdrView->GetSdrPageView();
+ m_pView->BeginTextEdit( pObj, pPV, m_pWin, sal_True );
+ }
+ m_pView->LeaveDrawCreate(); // In Selektionsmode wechseln
+ m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
+ break;
+
+ case OBJ_CAPTION:
+ {
+ SdrCaptionObj* pCaptObj = dynamic_cast<SdrCaptionObj*>(pObj);
+ if( bCapVertical && pCaptObj )
+ {
+ pCaptObj->ForceOutlinerParaObject();
+ OutlinerParaObject* pOPO = pCaptObj->GetOutlinerParaObject();
+ if( pOPO && !pOPO->IsVertical() )
+ pOPO->SetVertical( TRUE );
+ }
+ }
+ break;
+ default:; //prevent warning
+ }
+ }
+ return bRet;
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void ConstRectangle::Activate(const USHORT nSlotId)
+{
+ bMarquee = bCapVertical = FALSE;
+ mbVertical = sal_False;
+
+ switch (nSlotId)
+ {
+ case SID_DRAW_LINE:
+ m_pWin->SetSdrDrawMode(OBJ_LINE);
+ break;
+
+ case SID_DRAW_RECT:
+ m_pWin->SetSdrDrawMode(OBJ_RECT);
+ break;
+
+ case SID_DRAW_ELLIPSE:
+ m_pWin->SetSdrDrawMode(OBJ_CIRC);
+ break;
+
+ case SID_DRAW_TEXT_MARQUEE:
+ bMarquee = TRUE;
+ m_pWin->SetSdrDrawMode(OBJ_TEXT);
+ break;
+
+ case SID_DRAW_TEXT_VERTICAL:
+ // #93382#
+ mbVertical = sal_True;
+ m_pWin->SetSdrDrawMode(OBJ_TEXT);
+ break;
+
+ case SID_DRAW_TEXT:
+ m_pWin->SetSdrDrawMode(OBJ_TEXT);
+ break;
+
+ case SID_DRAW_CAPTION_VERTICAL:
+ bCapVertical = TRUE;
+ // no break
+ case SID_DRAW_CAPTION:
+ m_pWin->SetSdrDrawMode(OBJ_CAPTION);
+ break;
+
+ default:
+ m_pWin->SetSdrDrawMode(OBJ_NONE);
+ break;
+ }
+
+ SwDrawBase::Activate(nSlotId);
+}
+
+
+
diff --git a/sw/source/ui/ribbar/drawbase.cxx b/sw/source/ui/ribbar/drawbase.cxx
new file mode 100644
index 000000000000..fae2df9c0f4a
--- /dev/null
+++ b/sw/source/ui/ribbar/drawbase.cxx
@@ -0,0 +1,740 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <tools/list.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdobj.hxx>
+#include <svl/ptitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/bindings.hxx>
+#include <fmtclds.hxx>
+#include <frmfmt.hxx>
+#include "cmdid.h"
+#include "basesh.hxx"
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "drawbase.hxx"
+#include "edtwin.hxx"
+#include "caption.hxx"
+#include "swundo.hxx"
+#include <SwRewriter.hxx>
+#include "comcore.hrc"
+
+using namespace ::com::sun::star;
+
+extern BOOL bNoInterrupt; // in mainwn.cxx
+
+#define MINMOVE ((USHORT)m_pSh->GetOut()->PixelToLogic(Size(m_pSh->GetDrawView()->GetMarkHdlSizePixel()/2,0)).Width())
+
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+
+SwDrawBase::SwDrawBase(SwWrtShell* pSwWrtShell, SwEditWin* pWindow, SwView* pSwView) :
+ m_pView(pSwView),
+ m_pSh(pSwWrtShell),
+ m_pWin(pWindow),
+ m_nSlotId(USHRT_MAX),
+ m_bCreateObj(TRUE),
+ m_bInsForm(FALSE)
+{
+ if ( !m_pSh->HasDrawView() )
+ m_pSh->MakeDrawView();
+}
+
+/*************************************************************************
+|*
+|* Destruktor
+|*
+\************************************************************************/
+
+__EXPORT SwDrawBase::~SwDrawBase()
+{
+ if (m_pView->GetWrtShellPtr()) // Im view-Dtor koennte die wrtsh bereits geloescht worden sein...
+ m_pSh->GetDrawView()->SetEditMode(TRUE);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+
+BOOL SwDrawBase::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FALSE;
+
+ SdrView *pSdrView = m_pSh->GetDrawView();
+
+ // #i33136#
+ // pSdrView->SetOrtho(rMEvt.IsShift());
+ pSdrView->SetOrtho(doConstructOrthogonal() ? !rMEvt.IsShift() : rMEvt.IsShift());
+ pSdrView->SetAngleSnapEnabled(rMEvt.IsShift());
+
+ if (rMEvt.IsMod2())
+ {
+ pSdrView->SetCreate1stPointAsCenter(TRUE);
+ pSdrView->SetResizeAtCenter(TRUE);
+ }
+ else
+ {
+ pSdrView->SetCreate1stPointAsCenter(FALSE);
+ pSdrView->SetResizeAtCenter(FALSE);
+ }
+
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ // Nur neues Objekt, wenn nicht im Basismode (bzw reinem Selektionsmode)
+ if (rMEvt.IsLeft() && !m_pWin->IsDrawAction())
+ {
+ if (IsCreateObj() && (eHit == SDRHIT_UNMARKEDOBJECT || eHit == SDRHIT_NONE || m_pSh->IsDrawCreate()))
+ {
+ bNoInterrupt = TRUE;
+ m_pWin->CaptureMouse();
+
+ m_aStartPos = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
+
+ bReturn = m_pSh->BeginCreate( static_cast< UINT16 >(m_pWin->GetSdrDrawMode()), m_aStartPos);
+
+ SetDrawPointer();
+
+ if ( bReturn )
+ m_pWin->SetDrawAction(TRUE);
+ }
+ else if (!pSdrView->IsAction())
+ {
+ /**********************************************************************
+ * BEZIER-EDITOR
+ **********************************************************************/
+ m_pWin->CaptureMouse();
+ m_aStartPos = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
+ UINT16 nEditMode = m_pWin->GetBezierMode();
+
+ if (eHit == SDRHIT_HANDLE && aVEvt.pHdl->GetKind() == HDL_BWGT)
+ {
+ /******************************************************************
+ * Handle draggen
+ ******************************************************************/
+ bNoInterrupt = TRUE;
+ bReturn = pSdrView->BegDragObj(m_aStartPos, (OutputDevice*) NULL, aVEvt.pHdl);
+ m_pWin->SetDrawAction(TRUE);
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && nEditMode == SID_BEZIER_INSERT)
+ {
+ /******************************************************************
+ * Klebepunkt einfuegen
+ ******************************************************************/
+ bNoInterrupt = TRUE;
+ bReturn = pSdrView->BegInsObjPoint(m_aStartPos, rMEvt.IsMod1());
+ m_pWin->SetDrawAction(TRUE);
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && rMEvt.IsMod1())
+ {
+ /******************************************************************
+ * Klebepunkt selektieren
+ ******************************************************************/
+ if (!rMEvt.IsShift())
+ pSdrView->UnmarkAllPoints();
+
+ bReturn = pSdrView->BegMarkPoints(m_aStartPos);
+ m_pWin->SetDrawAction(TRUE);
+ }
+ else if (eHit == SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() && !rMEvt.IsMod2())
+ {
+ /******************************************************************
+ * Objekt verschieben
+ ******************************************************************/
+ return FALSE;
+ }
+ else if (eHit == SDRHIT_HANDLE)
+ {
+ /******************************************************************
+ * Klebepunkt selektieren
+ ******************************************************************/
+ if (pSdrView->HasMarkablePoints() && (!pSdrView->IsPointMarked(*aVEvt.pHdl) || rMEvt.IsShift()))
+ {
+ SdrHdl* pHdl = NULL;
+
+ if (!rMEvt.IsShift())
+ {
+ pSdrView->UnmarkAllPoints();
+ pHdl = pSdrView->PickHandle(m_aStartPos);
+ }
+ else
+ {
+ if (pSdrView->IsPointMarked(*aVEvt.pHdl))
+ {
+ bReturn = pSdrView->UnmarkPoint(*aVEvt.pHdl);
+ pHdl = NULL;
+ }
+ else
+ {
+ pHdl = pSdrView->PickHandle(m_aStartPos);
+ }
+ }
+
+ if (pHdl)
+ {
+ bNoInterrupt = TRUE;
+ pSdrView->MarkPoint(*pHdl);
+// bReturn = pSdrView->BegDragObj(m_aStartPos, (OutputDevice*) NULL, pHdl);
+// m_pWin->SetDrawAction(TRUE);
+ }
+ }
+ }
+ else
+ {
+ /******************************************************************
+ * Objekt selektieren oder draggen
+ ******************************************************************/
+ if (m_pSh->IsObjSelectable(m_aStartPos) && eHit == SDRHIT_UNMARKEDOBJECT)
+ {
+ if (pSdrView->HasMarkablePoints())
+ pSdrView->UnmarkAllPoints();
+
+ bNoInterrupt = FALSE;
+ // Drag im edtwin verwenden
+ return FALSE;
+ }
+
+ bNoInterrupt = TRUE;
+
+ if (m_pSh->IsObjSelected())
+ {
+ if (!rMEvt.IsShift())
+ {
+ if (!pSdrView->HasMarkablePoints())
+ {
+ //JP 10.10.2001: Bug 89619 - don't scroll the
+ // cursor into the visible area
+ BOOL bUnlockView = !m_pSh->IsViewLocked();
+ m_pSh->LockView( TRUE ); //lock visible section
+ m_pSh->SelectObj(Point(LONG_MAX, LONG_MAX)); // Alles deselektieren
+ if( bUnlockView )
+ m_pSh->LockView( FALSE );
+ }
+ else
+ pSdrView->UnmarkAllPoints();
+ }
+ }
+ if (!m_pSh->IsSelFrmMode())
+ m_pSh->EnterSelFrmMode(NULL);
+
+ if( 0 != (bReturn = m_pSh->BeginMark(m_aStartPos)) )
+ m_pWin->SetDrawAction(TRUE);
+
+ SetDrawPointer();
+ }
+ }
+ }
+ return bReturn;
+}
+
+/*************************************************************************
+|*
+|* MouseMove-event
+|*
+\************************************************************************/
+
+
+BOOL SwDrawBase::MouseMove(const MouseEvent& rMEvt)
+{
+ SdrView *pSdrView = m_pSh->GetDrawView();
+ Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
+ BOOL bRet = FALSE;
+
+ if (IsCreateObj() && !m_pWin->IsDrawSelMode() && pSdrView->IsCreateObj())
+ {
+ // #i33136#
+ // pSdrView->SetOrtho(rMEvt.IsShift());
+ pSdrView->SetOrtho(doConstructOrthogonal() ? !rMEvt.IsShift() : rMEvt.IsShift());
+ pSdrView->SetAngleSnapEnabled(rMEvt.IsShift());
+
+ m_pSh->MoveCreate(aPnt);
+ bRet = TRUE;
+ }
+ else if (pSdrView->IsAction() || pSdrView->IsInsObjPoint() || pSdrView->IsMarkPoints())
+ {
+ m_pSh->MoveMark(aPnt);
+ bRet = TRUE;
+ }
+
+ return (bRet);
+}
+
+/*************************************************************************
+|*
+|* MouseButtonUp-event
+|*
+\************************************************************************/
+
+
+BOOL SwDrawBase::MouseButtonUp(const MouseEvent& rMEvt)
+{
+ BOOL bReturn = FALSE;
+ BOOL bCheckShell = FALSE;
+ BOOL bAutoCap = FALSE;
+
+ Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
+
+ if (IsCreateObj() && m_pSh->IsDrawCreate() && !m_pWin->IsDrawSelMode())
+ {
+ const SdrObjKind nDrawMode = m_pWin->GetSdrDrawMode();
+ //objects with multiple point may end at the start position
+ BOOL bMultiPoint = OBJ_PLIN == nDrawMode ||
+ OBJ_PATHLINE == nDrawMode ||
+ OBJ_FREELINE == nDrawMode;
+ if(rMEvt.IsRight() || (aPnt == m_aStartPos && !bMultiPoint))
+ {
+ m_pSh->BreakCreate();
+ m_pView->LeaveDrawCreate();
+ }
+ else
+ {
+ if (OBJ_NONE == nDrawMode)
+ {
+ SwRewriter aRewriter;
+
+ aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_FRAME));
+ m_pSh->StartUndo(UNDO_INSERT, &aRewriter);
+ }
+
+ m_pSh->EndCreate(SDRCREATE_FORCEEND);
+ if (OBJ_NONE == nDrawMode) // Textrahmen eingefuegt
+ {
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ m_pSh->GetView().GetViewFrame()->GetBindings().GetRecorder();
+ if ( xRecorder.is() )
+ {
+ SfxRequest aReq(m_pSh->GetView().GetViewFrame(),FN_INSERT_FRAME);
+ aReq.AppendItem(SfxUInt16Item( FN_INSERT_FRAME,
+ static_cast<USHORT>(FLY_AT_PARA) ));
+ aReq.AppendItem(SfxPointItem( FN_PARAM_1, m_pSh->GetAnchorObjDiff()));
+ aReq.AppendItem(SvxSizeItem( FN_PARAM_2, m_pSh->GetObjSize()));
+ aReq.Done();
+ }
+ bAutoCap = TRUE;
+ if(m_pWin->GetFrmColCount() > 1)
+ {
+ SfxItemSet aSet(m_pView->GetPool(),RES_COL,RES_COL);
+ SwFmtCol aCol((const SwFmtCol&)aSet.Get(RES_COL));
+ aCol.Init(m_pWin->GetFrmColCount(), aCol.GetGutterWidth(), aCol.GetWishWidth());
+ aSet.Put(aCol);
+ // Vorlagen-AutoUpdate
+ SwFrmFmt* pFmt = m_pSh->GetCurFrmFmt();
+ if(pFmt && pFmt->IsAutoUpdateFmt())
+ m_pSh->AutoUpdateFrame(pFmt, aSet);
+ else
+ m_pSh->SetFlyFrmAttr( aSet );
+ }
+ }
+ if (m_pWin->GetSdrDrawMode() == OBJ_NONE)
+ {
+ m_pSh->EndUndo();
+ }
+ }
+
+ bReturn = TRUE;
+
+ EnterSelectMode(rMEvt);
+ }
+ else
+ {
+ SdrView *pSdrView = m_pSh->GetDrawView();
+
+ if (!pSdrView->HasMarkablePoints())
+ {
+ /**********************************************************************
+ * KEIN BEZIER_EDITOR
+ **********************************************************************/
+ if ((m_pSh->GetDrawView()->IsMarkObj() || m_pSh->GetDrawView()->IsMarkPoints())
+ && rMEvt.IsLeft())
+ {
+ bReturn = m_pSh->EndMark();
+
+ m_pWin->SetDrawAction(FALSE);
+
+ if (aPnt == m_aStartPos && m_pSh->IsObjSelectable(aPnt))
+ {
+ m_pSh->SelectObj(aPnt, ( rMEvt.IsShift() &&
+ m_pSh->IsSelFrmMode()) ? SW_ADD_SELECT : 0);
+
+ if (!m_pSh->IsObjSelected())
+ {
+ m_pView->LeaveDrawCreate(); // In Selektionsmode wechseln
+
+ m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
+
+ if (m_pSh->IsSelFrmMode())
+ m_pSh->LeaveSelFrmMode();
+ }
+ m_pView->NoRotate();
+
+ bCheckShell = TRUE; // ggf BezierShell anwerfen
+ }
+ else if (!m_pSh->IsObjSelected() && !m_pWin->IsDrawAction())
+ {
+ if (m_pSh->IsObjSelectable(aPnt))
+ m_pSh->SelectObj(aPnt, ( rMEvt.IsShift() &&
+ m_pSh->IsSelFrmMode() ) ? SW_ADD_SELECT : 0 );
+ else
+ {
+ m_pView->LeaveDrawCreate();
+ if (m_pSh->IsSelFrmMode())
+ m_pSh->LeaveSelFrmMode();
+ }
+ m_pView->NoRotate();
+
+ bReturn = TRUE;
+ }
+ }
+ }
+ else
+ {
+ /**********************************************************************
+ * BEZIER_EDITOR
+ **********************************************************************/
+ if ( pSdrView->IsAction() )
+ {
+ if ( pSdrView->IsInsObjPoint() )
+ bReturn = pSdrView->EndInsObjPoint(SDRCREATE_FORCEEND);
+ else if (pSdrView->IsMarkPoints() )
+ bReturn = pSdrView->EndMarkPoints();
+ else
+ {
+ pSdrView->EndAction();
+ bReturn = TRUE;
+ }
+ m_pWin->SetDrawAction(FALSE);
+
+ if (aPnt == m_aStartPos)
+ {
+ if (!m_pSh->IsObjSelectable(aPnt))
+ m_pSh->SelectObj(Point(LONG_MAX, LONG_MAX));
+ else if (!bReturn)
+ {
+ if (!rMEvt.IsShift())
+ pSdrView->UnmarkAllPoints();
+ m_pSh->SelectObj(aPnt, (rMEvt.IsShift() &&
+ m_pSh->IsSelFrmMode()) ? SW_ADD_SELECT :0);
+ }
+
+ if (!m_pSh->IsObjSelected())
+ {
+ m_pView->LeaveDrawCreate(); // In Selektionsmode wechseln
+
+ m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
+
+ if (m_pSh->IsSelFrmMode())
+ m_pSh->LeaveSelFrmMode();
+ }
+ m_pView->NoRotate();
+
+ bCheckShell = TRUE; // ggf BezierShell anwerfen
+ }
+ }
+
+ SetDrawPointer();
+
+ if (!m_pSh->IsObjSelected() && !m_pWin->IsDrawAction())
+ {
+ m_pView->LeaveDrawCreate();
+ if (m_pSh->IsSelFrmMode())
+ m_pSh->LeaveSelFrmMode();
+
+ m_pView->NoRotate();
+ bReturn = TRUE;
+ }
+ }
+ }
+
+ if (bCheckShell)
+ m_pView->AttrChangedNotify( m_pSh ); // ggf BezierShell anwerfen
+
+ //!!!!!!!!!! Achtung Suizid !!!!!!!!!!! Sollte alles mal erneuert werden
+ if ( bAutoCap )
+ m_pView->AutoCaption(FRAME_CAP); //Kann derzeit nur FRAME sein, sonst auf
+ //enums umstellen
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+
+void SwDrawBase::Activate(const USHORT nSlot)
+{
+ SetSlotId(nSlot);
+ SdrView *pSdrView = m_pSh->GetDrawView();
+
+ pSdrView->SetCurrentObj( static_cast< UINT16 >(m_pWin->GetSdrDrawMode()) );
+ pSdrView->SetEditMode(FALSE);
+
+ SetDrawPointer();
+ m_pSh->NoEdit();
+}
+
+/*************************************************************************
+|*
+|* Function deaktivieren
+|*
+\************************************************************************/
+
+
+void __EXPORT SwDrawBase::Deactivate()
+{
+ SdrView *pSdrView = m_pSh->GetDrawView();
+ pSdrView->SetOrtho(FALSE);
+ pSdrView->SetAngleSnapEnabled(FALSE);
+
+ if (m_pWin->IsDrawAction() && m_pSh->IsDrawCreate())
+ m_pSh->BreakCreate();
+
+ m_pWin->SetDrawAction(FALSE);
+
+ m_pWin->ReleaseMouse();
+ bNoInterrupt = FALSE;
+
+// if(!m_pSh->IsObjSelected())
+// m_pSh->Edit();
+
+ if(m_pWin->GetApplyTemplate())
+ m_pWin->SetApplyTemplate(SwApplyTemplate());
+ m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+
+
+BOOL SwDrawBase::KeyInput(const KeyEvent& rKEvt)
+{
+ BOOL bReturn = FALSE;
+ USHORT nCode = rKEvt.GetKeyCode().GetCode();
+
+ switch (nCode)
+ {
+ case KEY_ESCAPE:
+ {
+ if (m_pWin->IsDrawAction())
+ {
+ BreakCreate();
+ m_pView->LeaveDrawCreate();
+ }
+
+ bReturn = TRUE;
+ }
+ break;
+
+ case KEY_DELETE:
+ {
+ m_pSh->DelSelectedObj();
+ bReturn = TRUE;
+ }
+ break;
+
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_LEFT:
+ case KEY_RIGHT:
+ {
+ SdrView *pSdrView = m_pSh->GetDrawView();
+
+ if (!pSdrView->IsTextEdit())
+ {
+ long nX = 0;
+ long nY = 0;
+
+ if (nCode == KEY_UP)
+ {
+ // Scroll nach oben
+ nX = 0;
+ nY =-1;
+ }
+ else if (nCode == KEY_DOWN)
+ {
+ // Scroll nach unten
+ nX = 0;
+ nY = 1;
+ }
+ else if (nCode == KEY_LEFT)
+ {
+ // Scroll nach links
+ nX =-1;
+ nY = 0;
+ }
+ else if (nCode == KEY_RIGHT)
+ {
+ // Scroll nach rechts
+ nX = 1;
+ nY = 0;
+ }
+
+ if (pSdrView->AreObjectsMarked() && rKEvt.GetKeyCode().IsMod2())
+ {
+ // Objekte verschieben
+ nX *= 100;
+ nY *= 100;
+ pSdrView->MoveAllMarked(Size(nX, nY));
+ }
+
+ bReturn = TRUE;
+ }
+ }
+ break;
+ }
+
+ return (bReturn);
+}
+
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+
+
+void SwDrawBase::BreakCreate()
+{
+ m_pSh->BreakCreate();
+ m_pWin->SetDrawAction(FALSE);
+ m_pWin->ReleaseMouse();
+
+ Deactivate();
+// m_pView->LeaveDrawCreate();
+}
+
+/*************************************************************************
+|*
+|* Mauspointer umschalten
+|*
+\************************************************************************/
+
+
+void SwDrawBase::SetDrawPointer()
+{
+ SdrView *pSdrView = m_pSh->GetDrawView();
+ Point aPnt(m_pWin->OutputToScreenPixel(m_pWin->GetPointerPosPixel()));
+ aPnt = m_pWin->PixelToLogic(m_pWin->ScreenToOutputPixel(aPnt));
+ const Pointer aPointTyp = pSdrView->GetPreferedPointer(aPnt, m_pSh->GetOut());
+ const Pointer aDrawPt(aPointTyp);
+ m_pWin->SetPointer(aDrawPt);
+}
+
+/*************************************************************************
+|*
+|* Ggf in Selektionsmode wechseln
+|*
+\************************************************************************/
+
+void SwDrawBase::EnterSelectMode(const MouseEvent& rMEvt)
+{
+ m_pWin->SetDrawAction(FALSE);
+
+ if (!m_pSh->IsObjSelected() && !m_pWin->IsDrawAction())
+ {
+ Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
+
+ if (m_pSh->IsObjSelectable(aPnt))
+ {
+ m_pSh->SelectObj(aPnt);
+ if (rMEvt.GetModifier() == KEY_SHIFT || !m_pSh->IsObjSelected())
+ {
+ m_pView->LeaveDrawCreate(); // In Selektionsmode wechseln
+
+ m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
+ }
+ }
+ else
+ {
+ m_pView->LeaveDrawCreate();
+ if (m_pSh->IsSelFrmMode())
+ m_pSh->LeaveSelFrmMode();
+ }
+ m_pView->NoRotate();
+ }
+}
+/* -----------------------------03.04.2002 10:52------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwDrawBase::CreateDefaultObject()
+{
+ Point aStartPos = GetDefaultCenterPos();
+ Point aEndPos(aStartPos);
+ aStartPos.X() -= 8 * MM50;
+ aStartPos.Y() -= 4 * MM50;
+ aEndPos.X() += 8 * MM50;
+ aEndPos.Y() += 4 * MM50;
+ Rectangle aRect(aStartPos, aEndPos);
+ m_pSh->CreateDefaultShape( static_cast< UINT16 >(m_pWin->GetSdrDrawMode()), aRect, m_nSlotId);
+}
+/* -----------------25.10.2002 14:14-----------------
+ *
+ * --------------------------------------------------*/
+Point SwDrawBase::GetDefaultCenterPos()
+{
+ Size aDocSz(m_pSh->GetDocSize());
+ const SwRect& rVisArea = m_pSh->VisArea();
+ Point aStartPos = rVisArea.Center();
+ if(rVisArea.Width() > aDocSz.Width())
+ aStartPos.X() = aDocSz.Width() / 2 + rVisArea.Left();
+ if(rVisArea.Height() > aDocSz.Height())
+ aStartPos.Y() = aDocSz.Height() / 2 + rVisArea.Top();
+ return aStartPos;
+}
+
+// #i33136#
+bool SwDrawBase::doConstructOrthogonal() const
+{
+ return false;
+}
+
+// eof
diff --git a/sw/source/ui/ribbar/dselect.cxx b/sw/source/ui/ribbar/dselect.cxx
new file mode 100644
index 000000000000..b7651eba981e
--- /dev/null
+++ b/sw/source/ui/ribbar/dselect.cxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/bindings.hxx>
+#include "view.hxx"
+#include "edtwin.hxx"
+#include "wrtsh.hxx"
+#include "cmdid.h"
+#include "drawbase.hxx"
+#include "dselect.hxx"
+
+extern BOOL bNoInterrupt; // in mainwn.cxx
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+DrawSelection::DrawSelection(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) :
+ SwDrawBase(pWrtShell, pEditWin, pSwView)
+{
+ m_bCreateObj = FALSE;
+}
+
+/*************************************************************************
+|*
+|* Tastaturereignisse bearbeiten
+|*
+|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
+|* FALSE.
+|*
+\************************************************************************/
+
+BOOL DrawSelection::KeyInput(const KeyEvent& rKEvt)
+{
+ BOOL bReturn = FALSE;
+
+ switch (rKEvt.GetKeyCode().GetCode())
+ {
+ case KEY_ESCAPE:
+ {
+ if (m_pWin->IsDrawAction())
+ {
+ m_pSh->BreakMark();
+ m_pWin->ReleaseMouse();
+ }
+ bReturn = TRUE;
+ }
+ break;
+ }
+
+ if (!bReturn)
+ bReturn = SwDrawBase::KeyInput(rKEvt);
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+void DrawSelection::Activate(const USHORT nSlotId)
+{
+ m_pWin->SetSdrDrawMode(OBJ_NONE);
+ m_pWin->SetObjectSelect( TRUE );
+ SwDrawBase::Activate(nSlotId);
+
+ m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
+}
+
+
diff --git a/sw/source/ui/ribbar/inputwin.cxx b/sw/source/ui/ribbar/inputwin.cxx
new file mode 100755
index 000000000000..ec85bc2a3bf6
--- /dev/null
+++ b/sw/source/ui/ribbar/inputwin.cxx
@@ -0,0 +1,678 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <tools/gen.hxx>
+#include <sfx2/imgmgr.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/ruler.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/stritem.hxx>
+#include <unotools/undoopt.hxx>
+
+#include "swtypes.hxx"
+#include "cmdid.h"
+#include "swmodule.hxx"
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "calc.hxx"
+#include "inputwin.hxx"
+#include "fldbas.hxx"
+#include "fldmgr.hxx"
+#include "frmfmt.hxx"
+#include "cellatr.hxx"
+#include "edtwin.hxx"
+#include "helpid.h"
+
+// nur fuers UpdateRange - Box in dem der gestackte Cursor sthet loeschen
+#include "pam.hxx"
+
+#include "swundo.hxx"
+#include "ribbar.hrc"
+#include "inputwin.hrc"
+
+#include <IDocumentContentOperations.hxx>
+
+SFX_IMPL_POS_CHILDWINDOW( SwInputChild, FN_EDIT_FORMULA, SFX_OBJECTBAR_OBJECT )
+
+//==================================================================
+
+SwInputWindow::SwInputWindow( Window* pParent, SfxBindings* pBind )
+ : ToolBox( pParent , SW_RES( RID_TBX_FORMULA )),
+ aPos( this, SW_RES(ED_POS)),
+ aEdit( this, WB_3DLOOK|WB_TABSTOP|WB_BORDER|WB_NOHIDESELECTION),
+ aPopMenu( SW_RES(MN_CALC_POPUP)),
+ pMgr(0),
+ pWrtShell(0),
+ pView(0),
+ pBindings(pBind),
+ aAktTableName(aEmptyStr)
+ , m_nActionCount(0)
+ , m_bDoesUndo(true)
+ , m_bResetUndo(false)
+ , m_bCallUndo(false)
+{
+ bFirst = TRUE;
+ bActive = bIsTable = bDelSel = FALSE;
+
+ FreeResource();
+
+ aEdit.SetSizePixel( aEdit.CalcMinimumSize() );
+
+ SfxImageManager* pManager = SfxImageManager::GetImageManager( SW_MOD() );
+ pManager->RegisterToolBox(this);
+
+ pView = ::GetActiveView();
+ pWrtShell = pView ? pView->GetWrtShellPtr() : 0;
+
+ InsertWindow( ED_POS, &aPos, 0, 0);
+ InsertSeparator ( 1 );
+ InsertSeparator ();
+ InsertWindow( ED_FORMULA, &aEdit);
+ SetHelpId(ED_FORMULA, HID_EDIT_FORMULA);
+
+ BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
+ SetItemImage( FN_FORMULA_CALC, pManager->GetImage(FN_FORMULA_CALC, bHC ));
+ SetItemImage( FN_FORMULA_CANCEL, pManager->GetImage(FN_FORMULA_CANCEL, bHC ));
+ SetItemImage( FN_FORMULA_APPLY, pManager->GetImage(FN_FORMULA_APPLY, bHC ));
+
+ SetItemBits( FN_FORMULA_CALC, GetItemBits( FN_FORMULA_CALC ) | TIB_DROPDOWNONLY );
+ SetDropdownClickHdl( LINK( this, SwInputWindow, DropdownClickHdl ));
+
+ Size aSizeTbx = CalcWindowSizePixel();
+ Size aEditSize = aEdit.GetSizePixel();
+ Rectangle aItemRect( GetItemRect(FN_FORMULA_CALC) );
+ long nMaxHeight = (aEditSize.Height() > aItemRect.GetHeight()) ? aEditSize.Height() : aItemRect.GetHeight();
+ if( nMaxHeight+2 > aSizeTbx.Height() )
+ aSizeTbx.Height() = nMaxHeight+2;
+ Size aSize = GetSizePixel();
+ aSize.Height() = aSizeTbx.Height();
+ SetSizePixel( aSize );
+
+ // align edit and item vcentered
+ Size aPosSize = aPos.GetSizePixel();
+ aPosSize.Height() = nMaxHeight;
+ aEditSize.Height() = nMaxHeight;
+ Point aPosPos = aPos.GetPosPixel();
+ Point aEditPos = aEdit.GetPosPixel();
+ aPosPos.Y() = (aSize.Height() - nMaxHeight)/2 + 1;
+ aEditPos.Y() = (aSize.Height() - nMaxHeight)/2 + 1;
+ aPos.SetPosSizePixel( aPosPos, aPosSize );
+ aEdit.SetPosSizePixel( aEditPos, aEditSize );
+
+ aPopMenu.SetSelectHdl(LINK( this, SwInputWindow, MenuHdl ));
+}
+
+//==================================================================
+
+__EXPORT SwInputWindow::~SwInputWindow()
+{
+ SfxImageManager::GetImageManager( SW_MOD() )->ReleaseToolBox(this);
+
+ //Lineale aufwecken
+ if(pView)
+ {
+ pView->GetHLineal().SetActive( TRUE );
+ pView->GetVLineal().SetActive( TRUE );
+ }
+ if ( pMgr )
+ delete pMgr;
+ if(pWrtShell)
+ pWrtShell->EndSelTblCells();
+
+ CleanupUglyHackWithUndo();
+}
+
+void SwInputWindow::CleanupUglyHackWithUndo()
+{
+ if (m_bResetUndo)
+ {
+ DelBoxCntnt();
+ pWrtShell->DoUndo(m_bDoesUndo);
+ if (m_bCallUndo)
+ {
+ pWrtShell->Undo();
+ }
+ if (0 == m_nActionCount)
+ {
+ SW_MOD()->GetUndoOptions().SetUndoCount(0);
+ }
+ }
+}
+
+
+//==================================================================
+
+void SwInputWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( rDCEvt.GetType() == DATACHANGED_SETTINGS && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ // update item images
+ SwModule *pMod = SW_MOD();
+ SfxImageManager *pImgMgr = SfxImageManager::GetImageManager( pMod );
+ BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
+ //
+ SetItemImage( FN_FORMULA_CALC, pImgMgr->GetImage(FN_FORMULA_CALC, bHC ));
+ SetItemImage( FN_FORMULA_CANCEL, pImgMgr->GetImage(FN_FORMULA_CANCEL, bHC ));
+ SetItemImage( FN_FORMULA_APPLY, pImgMgr->GetImage(FN_FORMULA_APPLY, bHC ));
+ }
+
+ ToolBox::DataChanged( rDCEvt );
+}
+
+//==================================================================
+
+void __EXPORT SwInputWindow::Resize()
+{
+ ToolBox::Resize();
+
+ long nWidth = GetSizePixel().Width();
+ long nLeft = aEdit.GetPosPixel().X();
+ Size aEditSize = aEdit.GetSizePixel();
+
+ aEditSize.Width() = Max( ((long)(nWidth - nLeft - 5)), (long)0 );
+ aEdit.SetSizePixel( aEditSize );
+ aEdit.Invalidate();
+}
+
+//==================================================================
+
+void SwInputWindow::ShowWin()
+{
+ bIsTable = FALSE;
+ //Lineale anhalten
+ if(pView)
+ {
+ pView->GetHLineal().SetActive( FALSE );
+ pView->GetVLineal().SetActive( FALSE );
+
+ DBG_ASSERT(pWrtShell, "Keine WrtShell!");
+ // Cursor in Tabelle
+ bIsTable = pWrtShell->IsCrsrInTbl() ? TRUE : FALSE;
+
+ if( bFirst )
+ pWrtShell->SelTblCells( LINK( this, SwInputWindow,
+ SelTblCellsNotify) );
+ if( bIsTable )
+ {
+ const String& rPos = pWrtShell->GetBoxNms();
+ USHORT nPos = 0;
+ short nSrch = -1;
+ while( (nPos = rPos.Search( ':',nPos + 1 ) ) != STRING_NOTFOUND )
+ nSrch = (short) nPos;
+ aPos.SetText( rPos.Copy( ++nSrch ) );
+ aAktTableName = pWrtShell->GetTableFmt()->GetName();
+ }
+ else
+ aPos.SetText(SW_RESSTR(STR_TBL_FORMULA));
+
+ // Aktuelles Feld bearbeiten
+ ASSERT(pMgr == 0, FieldManager nicht geloescht.);
+ pMgr = new SwFldMgr;
+
+ // JP 13.01.97: Formel soll immer mit einem "=" beginnen, hier
+ // also setzen
+ String sEdit( '=' );
+ if( pMgr->GetCurFld() && TYP_FORMELFLD == pMgr->GetCurTypeId() )
+ {
+ sEdit += pMgr->GetCurFldPar2();
+ }
+ else if( bFirst )
+ {
+ if( bIsTable )
+ {
+ m_bResetUndo = true;
+ m_nActionCount = SW_MOD()->GetUndoOptions().GetUndoCount();
+ if (0 == m_nActionCount) { // deactivated? turn it on...
+ SW_MOD()->GetUndoOptions().SetUndoCount(1);
+ }
+
+ m_bDoesUndo = pWrtShell->DoesUndo();
+ if (!m_bDoesUndo)
+ {
+ pWrtShell->DoUndo(true);
+ }
+
+ if( !pWrtShell->SwCrsrShell::HasSelection() )
+ {
+ pWrtShell->MoveSection( fnSectionCurr, fnSectionStart );
+ pWrtShell->SetMark();
+ pWrtShell->MoveSection( fnSectionCurr, fnSectionEnd );
+ }
+ if( pWrtShell->SwCrsrShell::HasSelection() )
+ {
+ pWrtShell->StartUndo( UNDO_DELETE );
+ pWrtShell->Delete();
+ if( 0 != pWrtShell->EndUndo( UNDO_DELETE ))
+ {
+ m_bCallUndo = true;
+ }
+ }
+ pWrtShell->DoUndo(false);
+
+ SfxItemSet aSet( pWrtShell->GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
+ if( pWrtShell->GetTblBoxFormulaAttrs( aSet ))
+ sEdit += ((SwTblBoxFormula&)aSet.Get( RES_BOXATR_FORMULA )).GetFormula();
+ }
+ }
+
+ if( bFirst )
+ {
+ // WrtShell Flags richtig setzen
+ pWrtShell->SttSelect();
+ pWrtShell->EndSelect();
+ }
+
+ bFirst = FALSE;
+
+ aEdit.SetModifyHdl( LINK( this, SwInputWindow, ModifyHdl ));
+
+ aEdit.SetText( sEdit );
+ aEdit.SetSelection( Selection( sEdit.Len(), sEdit.Len() ) );
+ sOldFml = sEdit;
+
+ aEdit.Invalidate();
+ aEdit.Update();
+ aEdit.GrabFocus();
+ // UserInterface fuer die Eingabe abklemmen
+
+ pView->GetEditWin().LockKeyInput(TRUE);
+ pView->GetViewFrame()->GetDispatcher()->Lock(TRUE);
+ pWrtShell->Push();
+ }
+ ToolBox::Show();
+}
+//==================================================================
+
+IMPL_LINK( SwInputWindow, MenuHdl, Menu *, pMenu )
+{
+static const char * __READONLY_DATA aStrArr[] = {
+ sCalc_Phd,
+ sCalc_Sqrt,
+ sCalc_Or,
+ sCalc_Xor,
+ sCalc_And,
+ sCalc_Not,
+ sCalc_Eq,
+ sCalc_Neq,
+ sCalc_Leq,
+ sCalc_Geq,
+ sCalc_L,
+ sCalc_G,
+ sCalc_Sum,
+ sCalc_Mean,
+ sCalc_Min,
+ sCalc_Max,
+ sCalc_Sin,
+ sCalc_Cos,
+ sCalc_Tan,
+ sCalc_Asin,
+ sCalc_Acos,
+ sCalc_Atan,
+ sCalc_Pow,
+ "|",
+ sCalc_Round
+};
+
+ USHORT nId = pMenu->GetCurItemId();
+ if ( nId <= MN_CALC_ROUND )
+ {
+ String aTmp( String::CreateFromAscii(aStrArr[nId - 1]) );
+ aTmp += ' ';
+ aEdit.ReplaceSelected( aTmp );
+ }
+ return 0;
+}
+
+IMPL_LINK( SwInputWindow, DropdownClickHdl, ToolBox*, EMPTYARG )
+{
+ USHORT nCurID = GetCurItemId();
+ EndSelection(); // setzt CurItemId zurueck !
+ switch ( nCurID )
+ {
+ case FN_FORMULA_CALC :
+ {
+ aPopMenu.Execute( this, GetItemRect( FN_FORMULA_CALC ), POPUPMENU_NOMOUSEUPCLOSE );
+ break;
+ default:
+ break;
+ }
+ }
+
+ return TRUE;
+}
+
+//==================================================================
+
+
+void __EXPORT SwInputWindow::Click( )
+{
+ USHORT nCurID = GetCurItemId();
+ EndSelection(); // setzt CurItemId zurueck !
+ switch ( nCurID )
+ {
+ case FN_FORMULA_CANCEL:
+ {
+ CancelFormula();
+ }
+ break;
+ case FN_FORMULA_APPLY:
+ {
+ ApplyFormula();
+ }
+ break;
+ }
+}
+
+//==================================================================
+
+void SwInputWindow::ApplyFormula()
+{
+ pView->GetViewFrame()->GetDispatcher()->Lock(FALSE);
+ pView->GetEditWin().LockKeyInput(FALSE);
+ CleanupUglyHackWithUndo();
+ pWrtShell->Pop( FALSE );
+
+ // JP 13.01.97: Formel soll immer mit einem "=" beginnen, hier
+ // also wieder entfernen
+ String sEdit( aEdit.GetText() );
+ sEdit.EraseLeadingChars().EraseTrailingChars();
+ if( sEdit.Len() && '=' == sEdit.GetChar( 0 ) )
+ sEdit.Erase( 0, 1 );
+ SfxStringItem aParam(FN_EDIT_FORMULA, sEdit);
+
+ pWrtShell->EndSelTblCells();
+ pView->GetEditWin().GrabFocus();
+ const SfxPoolItem* aArgs[2];
+ aArgs[0] = &aParam;
+ aArgs[1] = 0;
+ pView->GetViewFrame()->GetBindings().Execute( FN_EDIT_FORMULA, aArgs, 0, SFX_CALLMODE_ASYNCHRON );
+}
+
+//==================================================================
+
+void SwInputWindow::CancelFormula()
+{
+ if(pView)
+ {
+ pView->GetViewFrame()->GetDispatcher()->Lock( FALSE );
+ pView->GetEditWin().LockKeyInput(FALSE);
+ CleanupUglyHackWithUndo();
+ pWrtShell->Pop( FALSE );
+
+ if( bDelSel )
+ pWrtShell->EnterStdMode();
+
+ pWrtShell->EndSelTblCells();
+
+ pView->GetEditWin().GrabFocus();
+ }
+ pView->GetViewFrame()->GetDispatcher()->Execute( FN_EDIT_FORMULA, SFX_CALLMODE_ASYNCHRON);
+}
+//==================================================================
+
+const xub_Unicode CH_LRE = 0x202a;
+const xub_Unicode CH_PDF = 0x202c;
+
+IMPL_LINK( SwInputWindow, SelTblCellsNotify, SwWrtShell *, pCaller )
+{
+ if(bIsTable)
+ {
+ SwFrmFmt* pTblFmt = pCaller->GetTableFmt();
+ String sBoxNms( pCaller->GetBoxNms() );
+ String sTblNm;
+ if( pTblFmt && aAktTableName != pTblFmt->GetName() )
+ sTblNm = pTblFmt->GetName();
+
+ aEdit.UpdateRange( sBoxNms, sTblNm );
+
+ String sNew;
+ sNew += CH_LRE;
+ sNew += aEdit.GetText();
+ sNew += CH_PDF;
+
+ if( sNew != sOldFml )
+ {
+ // Die WrtShell ist in der Tabellen Selektion
+ // dann die Tabellen Selektion wieder aufheben, sonst steht der
+ // Cursor "im Wald" und das LiveUpdate funktioniert nicht!
+ pWrtShell->StartAllAction();
+
+ SwPaM aPam( *pWrtShell->GetStkCrsr()->GetPoint() );
+ aPam.Move( fnMoveBackward, fnGoSection );
+ aPam.SetMark();
+ aPam.Move( fnMoveForward, fnGoSection );
+
+ IDocumentContentOperations* pIDCO = pWrtShell->getIDocumentContentOperations();
+ pIDCO->DeleteRange( aPam );
+ pIDCO->InsertString( aPam, sNew );
+ pWrtShell->EndAllAction();
+ sOldFml = sNew;
+ }
+ }
+ else
+ aEdit.GrabFocus();
+ return 0;
+}
+
+
+void SwInputWindow::SetFormula( const String& rFormula, BOOL bDelFlag )
+{
+ String sEdit( '=' );
+ if( rFormula.Len() )
+ {
+ if( '=' == rFormula.GetChar( 0 ) )
+ sEdit = rFormula;
+ else
+ sEdit += rFormula;
+ }
+ aEdit.SetText( sEdit );
+ aEdit.SetSelection( Selection( sEdit.Len(), sEdit.Len() ) );
+ aEdit.Invalidate();
+ bDelSel = bDelFlag;
+}
+
+IMPL_LINK( SwInputWindow, ModifyHdl, InputEdit*, EMPTYARG )
+{
+ if (bIsTable && m_bResetUndo)
+ {
+ pWrtShell->StartAllAction();
+ DelBoxCntnt();
+ String sNew;
+ sNew += CH_LRE;
+ sNew += aEdit.GetText();
+ sNew += CH_PDF;
+ pWrtShell->SwEditShell::Insert2( sNew );
+ pWrtShell->EndAllAction();
+ sOldFml = sNew;
+ }
+ return 0;
+}
+
+
+void SwInputWindow::DelBoxCntnt()
+{
+ if( bIsTable )
+ {
+ pWrtShell->StartAllAction();
+ pWrtShell->ClearMark();
+ pWrtShell->Pop( FALSE );
+ pWrtShell->Push();
+ pWrtShell->MoveSection( fnSectionCurr, fnSectionStart );
+ pWrtShell->SetMark();
+ pWrtShell->MoveSection( fnSectionCurr, fnSectionEnd );
+ pWrtShell->SwEditShell::Delete();
+ pWrtShell->EndAllAction();
+ }
+}
+
+//==================================================================
+
+void __EXPORT InputEdit::KeyInput(const KeyEvent& rEvent)
+{
+ const KeyCode aCode = rEvent.GetKeyCode();
+ if(aCode == KEY_RETURN || aCode == KEY_F2 )
+ ((SwInputWindow*)GetParent())->ApplyFormula();
+ else if(aCode == KEY_ESCAPE )
+ ((SwInputWindow*)GetParent())->CancelFormula();
+ else
+ Edit::KeyInput(rEvent);
+}
+
+//==================================================================
+
+void __EXPORT InputEdit::UpdateRange(const String& rBoxes,
+ const String& rName )
+{
+ if( !rBoxes.Len() )
+ {
+ GrabFocus();
+ return;
+ }
+ const sal_Unicode cOpen = '<', cClose = '>',
+ cOpenBracket = '(';
+ String aPrefix = rName;
+ if(rName.Len())
+ aPrefix += '.';
+ String aBoxes = aPrefix;
+ aBoxes += rBoxes;
+ Selection aSelection(GetSelection());
+ USHORT nSel = (USHORT) aSelection.Len();
+ //OS: mit dem folgenden Ausdruck wird sichergestellt, dass im overwrite-Modus
+ //die selektierte schliessende Klammer nicht geloescht wird
+ if( nSel && ( nSel > 1 ||
+ GetText().GetChar( (USHORT)aSelection.Min() ) != cClose ) )
+ Cut();
+ else
+ aSelection.Max() = aSelection.Min();
+ String aActText(GetText());
+ const USHORT nLen = aActText.Len();
+ if( !nLen )
+ {
+ String aStr(cOpen);
+ aStr += aBoxes;
+ aStr += cClose;
+ SetText(aStr);
+ USHORT nPos = aStr.Search( cClose );
+ ASSERT(nPos < aStr.Len(), Delimiter nicht gefunden.);
+ ++nPos;
+ SetSelection( Selection( nPos, nPos ));
+ }
+ else
+ {
+ BOOL bFound = FALSE;
+ sal_Unicode cCh;
+ USHORT nPos, nEndPos = 0, nStartPos = (USHORT) aSelection.Min();
+ if( nStartPos-- )
+ {
+ do {
+ if( cOpen == (cCh = aActText.GetChar( nStartPos ) ) ||
+ cOpenBracket == cCh )
+ {
+ bFound = cCh == cOpen;
+ break;
+ }
+ } while( nStartPos-- > 0 );
+ }
+ if( bFound )
+ {
+ bFound = FALSE;
+ nEndPos = nStartPos;
+ while( nEndPos < nLen )
+ {
+ if( cClose == (cCh = aActText.GetChar( nEndPos )) /*||
+ cCh == cCloseBracket*/ )
+ {
+ bFound = TRUE;
+ break;
+ }
+ ++nEndPos;
+ }
+ // nur wenn akt. Pos im Breich oder direkt dahinter liegt
+ if( bFound && !( nStartPos < (USHORT)aSelection.Max() &&
+ (USHORT)aSelection.Max() <= nEndPos + 1 ))
+ bFound = FALSE;
+ }
+ if( bFound )
+ {
+ nPos = ++nStartPos + 1; // wir wollen dahinter
+ aActText.Erase( nStartPos, nEndPos - nStartPos );
+ aActText.Insert( aBoxes, nStartPos );
+ nPos = nPos + aBoxes.Len();
+ }
+ else
+ {
+ String aTmp( (char)cOpen );
+ aTmp += aBoxes;
+ aTmp += (char)cClose;
+ nPos = (USHORT)aSelection.Min();
+ aActText.Insert( aTmp, nPos );
+ nPos = nPos + aTmp.Len();
+ }
+ if( GetText() != aActText )
+ {
+ SetText( aActText );
+ SetSelection( Selection( nPos, nPos ) );
+// GetModifyHdl().Call( this );
+ }
+ }
+ GrabFocus();
+
+}
+//==================================================================
+
+
+SwInputChild::SwInputChild(Window* _pParent,
+ USHORT nId,
+ SfxBindings* pBindings,
+ SfxChildWinInfo* ) :
+ SfxChildWindow( _pParent, nId )
+{
+ pDispatch = pBindings->GetDispatcher();
+ pWindow = new SwInputWindow( _pParent, pBindings );
+ ((SwInputWindow*)pWindow)->ShowWin();
+ eChildAlignment = SFX_ALIGN_LOWESTTOP;
+}
+
+
+__EXPORT SwInputChild::~SwInputChild()
+{
+ if(pDispatch)
+ pDispatch->Lock(FALSE);
+}
+
+
+SfxChildWinInfo __EXPORT SwInputChild::GetInfo() const
+{
+ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \
+ return aInfo;
+}
+
diff --git a/sw/source/ui/ribbar/inputwin.hrc b/sw/source/ui/ribbar/inputwin.hrc
new file mode 100644
index 000000000000..96e45ac38708
--- /dev/null
+++ b/sw/source/ui/ribbar/inputwin.hrc
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _INPUTWIN_HRC
+#define _INPUTWIN_HRC
+
+
+//PopupMenu Id's
+#define MN_CALC_PHD 1
+#define MN_CALC_SQRT 2
+#define MN_CALC_OR 3
+#define MN_CALC_XOR 4
+#define MN_CALC_AND 5
+#define MN_CALC_NOT 6
+#define MN_CALC_EQ 7
+#define MN_CALC_NEQ 8
+#define MN_CALC_LEQ 9
+#define MN_CALC_GEQ 10
+#define MN_CALC_LES 11
+#define MN_CALC_GRE 12
+#define MN_CALC_SUM 13
+#define MN_CALC_MEAN 14
+#define MN_CALC_MIN 15
+#define MN_CALC_MAX 16
+#define MN_CALC_SIN 17
+#define MN_CALC_COS 18
+#define MN_CALC_TAN 19
+#define MN_CALC_ASIN 20
+#define MN_CALC_ACOS 21
+#define MN_CALC_ATAN 22
+#define MN_CALC_POW 23
+#define MN_CALC_LISTSEP 24
+#define MN_CALC_ROUND 25
+
+#define MN_POP_OPS 29
+#define MN_POP_STATISTICS 30
+#define MN_POP_FUNC 31
+#define MN_RSC_END 32
+
+#define TBX_FORMULA 1
+#define ED_POS 2
+#define ED_FORMULA 3
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/ribbar/inputwin.src b/sw/source/ui/ribbar/inputwin.src
new file mode 100644
index 000000000000..5686fd7ae6c2
--- /dev/null
+++ b/sw/source/ui/ribbar/inputwin.src
@@ -0,0 +1,345 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* HelpID ressource file */
+/* HelpID ressource file */
+
+#include "cmdid.h"
+#include "helpid.h"
+#include "globals.hrc"
+#include "ribbar.hrc"
+#include "inputwin.hrc"
+ToolBox RID_TBX_FORMULA
+{
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 600 , 14 ) ;
+ HelpID = HID_CALC_TOOLBOX ;
+ SVLook = TRUE ;
+ Border = TRUE ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = FN_FORMULA_CALC ;
+ HelpId = HID_TBX_FORMULA_CALC ;
+ DropDown = TRUE ;
+ Text [ en-US ] = "Formula" ;
+ /* ### ACHTUNG: Neuer Text in Resource? Formel auswählen : Formel auswõhlen */
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_FORMULA_CANCEL ;
+ HelpId = HID_TBX_FORMULA_CANCEL ;
+ Text [ en-US ] = "Cancel" ;
+ /* ### ACHTUNG: Neuer Text in Resource? Formel nicht übenehmen : Formel nicht ³benehmen */
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_FORMULA_APPLY ;
+ HelpId = HID_TBX_FORMULA_APPLY ;
+ /* ### ACHTUNG: Neuer Text in Resource? Übernehmen : šbernehmen */
+ Text [ en-US ] = "Apply" ;
+ /* ### ACHTUNG: Neuer Text in Resource? Formel einfügen : Formel einf³gen */
+ };
+ };
+ Edit ED_POS
+ {
+ Border = TRUE ;
+ Size = MAP_APPFONT ( 45 , 11 ) ;
+ ReadOnly = TRUE ;
+ SVLook = TRUE ;
+ Center = TRUE ;
+ };
+ Edit ED_FORMULA
+ {
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Size = MAP_APPFONT ( 500 , 11 ) ;
+ SVLook = TRUE ;
+ };
+};
+Menu MN_CALC_POPUP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_CALC_SUM ;
+ HelpID = HID_MN_CALC_SUM ;
+ Text [ en-US ] = "Sum" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_ROUND ;
+ HelpID = HID_MN_CALC_ROUND ;
+ Text [ en-US ] = "Round" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_PHD ;
+ HelpID = HID_MN_CALC_PHD ;
+ Text [ en-US ] = "Percent" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_SQRT ;
+ HelpID = HID_MN_CALC_SQRT ;
+ Text [ en-US ] = "Square Root" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_POW ;
+ HelpID = HID_MN_CALC_POW ;
+ Text [ en-US ] = "Power" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_POP_OPS ;
+ HelpID = HID_MN_POP_OPS ;
+ Text [ en-US ] = "Operators" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_CALC_LISTSEP ;
+ HelpID = HID_MN_CALC_LISTSEP ;
+ Text [ en-US ] = "List Separator" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_EQ ;
+ HelpID = HID_MN_CALC_EQ ;
+ Text [ en-US ] = "Equal" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_NEQ ;
+ HelpID = HID_MN_CALC_NEQ ;
+ Text [ en-US ] = "Not Equal" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_LEQ ;
+ HelpID = HID_MN_CALC_LEQ ;
+ Text [ en-US ] = "Less Than or Equal" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_GEQ ;
+ HelpID = HID_MN_CALC_GEQ ;
+ /* ### ACHTUNG: Neuer Text in Resource? Gr~ößer Gleich : Gr~÷˜er Gleich */
+ Text [ en-US ] = "Greater Than or Equal" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_LES ;
+ HelpID = HID_MN_CALC_LES ;
+ Text [ en-US ] = "Less" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_GRE ;
+ HelpID = HID_MN_CALC_GRE ;
+ /* ### ACHTUNG: Neuer Text in Resource? G~rößer : G~r÷˜er */
+ Text [ en-US ] = "Greater" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_OR ;
+ HelpID = HID_MN_CALC_OR ;
+ Text [ en-US ] = "Boolean Or" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_XOR ;
+ HelpID = HID_MN_CALC_XOR ;
+ Text [ en-US ] = "Boolean Xor" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_AND ;
+ HelpID = HID_MN_CALC_AND ;
+ Text [ en-US ] = "Boolean And" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_NOT ;
+ HelpID = HID_MN_CALC_NOT ;
+ Text [ en-US ] = "Boolean Not" ;
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Identifier = MN_POP_STATISTICS ;
+ HelpID = HID_MN_POP_STATISTICS ;
+ Text [ en-US ] = "Statistical Functions" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_CALC_MEAN ;
+ HelpID = HID_MN_CALC_MEAN ;
+ Text [ en-US ] = "Mean" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_MIN ;
+ HelpID = HID_MN_CALC_MIN ;
+ Text [ en-US ] = "Minimum" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_MAX ;
+ HelpID = HID_MN_CALC_MAX ;
+ Text [ en-US ] = "Maximum" ;
+ };
+ };
+ };
+ };
+ MenuItem
+ {
+ Identifier = MN_POP_FUNC ;
+ HelpID = HID_MN_POP_FUNC ;
+ Text [ en-US ] = "Functions" ;
+ SubMenu = Menu
+ {
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_CALC_SIN ;
+ HelpID = HID_MN_CALC_SIN ;
+ Text [ en-US ] = "Sine" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_COS ;
+ HelpID = HID_MN_CALC_COS ;
+ Text [ en-US ] = "Cosine" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_TAN ;
+ HelpID = HID_MN_CALC_TAN ;
+ Text [ en-US ] = "Tangent" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_ASIN ;
+ HelpID = HID_MN_CALC_ASIN ;
+ Text [ en-US ] = "Arcsine" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_ACOS ;
+ HelpID = HID_MN_CALC_ACOS ;
+ Text [ en-US ] = "Arccosine" ;
+ };
+ MenuItem
+ {
+ Identifier = MN_CALC_ATAN ;
+ HelpID = HID_MN_CALC_ATAN ;
+ Text [ en-US ] = "Arctangent" ;
+ };
+ };
+ };
+ };
+ };
+};
+String STR_TBL_FORMULA
+{
+ Text [ en-US ] = "Text formula" ;
+};
+#define TB_INPUT \
+ ToolBoxItem\
+ {\
+ Identifier = FN_FORMULA_CALC ; \
+ HelpID = HID_TBX_FORMULA_CALC ; \
+ Text [ en-US ] = "Formula" ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Formel auswählen : Formel auswõhlen */\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FORMULA_CANCEL ; \
+ HelpId = HID_TBX_FORMULA_CANCEL ; \
+ Text [ en-US ] = "Cancel" ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Formel nicht übenehmen : Formel nicht ³benehmen */\
+ };\
+ ToolBoxItem\
+ {\
+ Identifier = FN_FORMULA_APPLY ; \
+ HelpID = HID_TBX_FORMULA_APPLY ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Übernehmen : šbernehmen */\
+ Text [ en-US ] = "Apply" ; \
+ /* ### ACHTUNG: Neuer Text in Resource? Formel einfügen : Formel einf³gen */\
+ };
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/ribbar/tblctrl.cxx b/sw/source/ui/ribbar/tblctrl.cxx
new file mode 100644
index 000000000000..ad5046af6b42
--- /dev/null
+++ b/sw/source/ui/ribbar/tblctrl.cxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <svl/intitem.hxx>
+
+#include <vcl/toolbox.hxx>
+#include <sfx2/app.hxx>
+
+#include "cmdid.h"
+#include "swtypes.hxx"
+#include "tblctrl.hxx"
+#include "tblctrl.hrc"
+
+
+
+SFX_IMPL_TOOLBOX_CONTROL( SwTableOptimizeCtrl, SfxUInt16Item );
+
+/**********************************************************************
+
+**********************************************************************/
+
+
+
+
+SwTableOptimizeCtrl::SwTableOptimizeCtrl(
+ USHORT nSlotId,
+ USHORT nId,
+ ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
+}
+/**********************************************************************
+
+**********************************************************************/
+
+
+
+SwTableOptimizeCtrl::~SwTableOptimizeCtrl()
+{
+}
+
+/**********************************************************************
+
+**********************************************************************/
+
+
+
+SfxPopupWindow* SwTableOptimizeCtrl::CreatePopupWindow()
+{
+ rtl::OUString aToolBarResStr( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/optimizetablebar" ));
+ createAndPositionSubToolBar( aToolBarResStr );
+ return NULL;
+}
+
+/**********************************************************************
+
+**********************************************************************/
+
+
+
+SfxPopupWindowType SwTableOptimizeCtrl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONCLICK;
+}
diff --git a/sw/source/ui/ribbar/tblctrl.hrc b/sw/source/ui/ribbar/tblctrl.hrc
new file mode 100644
index 000000000000..7cfa32d7bb5d
--- /dev/null
+++ b/sw/source/ui/ribbar/tblctrl.hrc
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _TBLCTRL_HRC
+#define _TBLCTRL_HRC
+#include "ribbar.hrc"
+
+#define TBX_OPTIMIZE_TABLE 1
+
+#endif
+
+
diff --git a/sw/source/ui/ribbar/tbxanchr.cxx b/sw/source/ui/ribbar/tbxanchr.cxx
new file mode 100644
index 000000000000..6c20f9dd818d
--- /dev/null
+++ b/sw/source/ui/ribbar/tbxanchr.cxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+#include <vcl/timer.hxx>
+#include <sfx2/app.hxx>
+#include <svx/htmlmode.hxx>
+#include <svl/intitem.hxx>
+#include <sfx2/dispatch.hxx>
+#ifndef _TOOLBOX_HXX //autogen
+#include <vcl/toolbox.hxx>
+#endif
+#include <sfx2/mnumgr.hxx>
+
+
+#include "cmdid.h"
+#include "docsh.hxx"
+#include "swtypes.hxx"
+#include "swmodule.hxx"
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "viewopt.hxx"
+#include "errhdl.hxx"
+#include "ribbar.hrc"
+#include "tbxanchr.hxx"
+
+
+
+SFX_IMPL_TOOLBOX_CONTROL(SwTbxAnchor, SfxUInt16Item);
+
+/******************************************************************************
+ * Beschreibung:
+ ******************************************************************************/
+
+SwTbxAnchor::SwTbxAnchor( USHORT nSlotId, USHORT nId, ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx ),
+ nActAnchorId(0)
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
+}
+
+/******************************************************************************
+ * Beschreibung:
+ ******************************************************************************/
+
+ SwTbxAnchor::~SwTbxAnchor()
+{
+}
+
+/******************************************************************************
+ * Beschreibung:
+ ******************************************************************************/
+
+void SwTbxAnchor::StateChanged( USHORT /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
+{
+ GetToolBox().EnableItem( GetId(), (GetItemState(pState) != SFX_ITEM_DISABLED) );
+
+ if( eState == SFX_ITEM_AVAILABLE )
+ {
+ const SfxUInt16Item* pItem = PTR_CAST( SfxUInt16Item, pState );
+ if(pItem)
+ nActAnchorId = pItem->GetValue();
+ }
+
+}
+
+/******************************************************************************
+ * Beschreibung:
+ ******************************************************************************/
+
+SfxPopupWindow* SwTbxAnchor::CreatePopupWindow()
+{
+ SwTbxAnchor::Click();
+ return 0;
+}
+
+/******************************************************************************
+ * Beschreibung:
+ ******************************************************************************/
+
+void SwTbxAnchor::Click()
+{
+ PopupMenu aPopMenu(SW_RES(MN_ANCHOR_POPUP));
+
+ SfxViewFrame* pViewFrame( 0 );
+ SfxDispatcher* pDispatch( 0 );
+ SfxViewShell* pCurSh( SfxViewShell::Current() );
+
+ if ( pCurSh )
+ {
+ pViewFrame = pCurSh->GetViewFrame();
+ if ( pViewFrame )
+ pDispatch = pViewFrame->GetDispatcher();
+ }
+
+// SfxDispatcher* pDispatch = GetBindings().GetDispatcher();
+// SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : 0;
+ SwView* pActiveView = 0;
+ if(pViewFrame)
+ {
+ const TypeId aTypeId = TYPE(SwView);
+ SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId);
+ while( pView )
+ {
+ if(pView->GetViewFrame() == pViewFrame)
+ {
+ pActiveView = pView;
+ break;
+ }
+ pView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId);
+ }
+ }
+ if(!pActiveView)
+ {
+ DBG_ERROR("No active view could be found");
+ return;
+ }
+ SwWrtShell* pWrtShell = pActiveView->GetWrtShellPtr();
+ aPopMenu.EnableItem( FN_TOOL_ANKER_FRAME, 0 != pWrtShell->IsFlyInFly() );
+
+ Rectangle aRect(GetToolBox().GetItemRect(GetId()));
+ USHORT nHtmlMode = ::GetHtmlMode((SwDocShell*)SfxObjectShell::Current());
+ BOOL bHtmlModeNoAnchor = ( nHtmlMode & HTMLMODE_ON) && 0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS);
+
+ if (bHtmlModeNoAnchor || pWrtShell->IsInHeaderFooter())
+ aPopMenu.RemoveItem(aPopMenu.GetItemPos(FN_TOOL_ANKER_PAGE));
+
+ if (nActAnchorId)
+ aPopMenu.CheckItem(nActAnchorId);
+
+
+ USHORT nSlotId = aPopMenu.Execute(&GetToolBox(), aRect);
+ GetToolBox().EndSelection();
+
+ if (nSlotId)
+ pDispatch->Execute(nSlotId, SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD);
+}
diff --git a/sw/source/ui/ribbar/tbxanchr.src b/sw/source/ui/ribbar/tbxanchr.src
new file mode 100644
index 000000000000..41067b18fb08
--- /dev/null
+++ b/sw/source/ui/ribbar/tbxanchr.src
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "ribbar.hrc"
+#include "cmdid.h"
+Menu MN_ANCHOR_POPUP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ _MenuItemFlags = MIB_RADIOCHECK ;
+ RadioCheck = TRUE ;
+ Identifier = FN_TOOL_ANKER_PAGE ;
+ Text [ en-US ] = "To Page" ;
+ };
+ MenuItem
+ {
+ _MenuItemFlags = MIB_RADIOCHECK ;
+ RadioCheck = TRUE ;
+ Identifier = FN_TOOL_ANKER_PARAGRAPH ;
+ Text [ en-US ] = "To Paragraph" ;
+ };
+ MenuItem
+ {
+ _MenuItemFlags = MIB_RADIOCHECK ;
+ RadioCheck = TRUE ;
+ Identifier = FN_TOOL_ANKER_AT_CHAR ;
+ Text [ en-US ] = "To Character" ;
+ };
+ MenuItem
+ {
+ _MenuItemFlags = MIB_RADIOCHECK ;
+ RadioCheck = TRUE ;
+ Identifier = FN_TOOL_ANKER_CHAR ;
+ Text [ en-US ] = "As Character" ;
+ };
+ MenuItem
+ {
+ _MenuItemFlags = MIB_RADIOCHECK ;
+ RadioCheck = TRUE ;
+ Identifier = FN_TOOL_ANKER_FRAME ;
+ Text [ en-US ] = "To Frame" ;
+ };
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/ribbar/workctrl.cxx b/sw/source/ui/ribbar/workctrl.cxx
new file mode 100644
index 000000000000..cf7f4b15a33a
--- /dev/null
+++ b/sw/source/ui/ribbar/workctrl.cxx
@@ -0,0 +1,943 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+#include <svl/eitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/bindings.hxx>
+#ifndef _SFX_IMAGEMGR_HXX
+#include <sfx2/imagemgr.hxx>
+#endif
+#include <swmodule.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <initui.hxx>
+#include <viewopt.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <gloshdl.hxx>
+#include <glosdoc.hxx>
+#include <gloslst.hxx>
+#include <workctrl.hxx>
+#ifndef _WORKCTRL_HRC
+#include <workctrl.hrc>
+#endif
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#include <wrtsh.hxx>
+#include <svl/imageitm.hxx>
+#include <vcl/lstbox.hxx>
+#include <rtl/ustring.hxx>
+#include "swabstdlg.hxx"
+#include <misc.hrc>
+
+#include <vcl/svapp.hxx>
+
+//JP 14.01.99: Size Abpruefung
+#define NAVI_ENTRIES 20
+#if NAVI_ENTRIES != NID_COUNT
+#error SwScrollNaviPopup-CTOR static Array falsche Size. Wurden neue IDs zugefuegt ??
+#endif
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::frame;
+
+SFX_IMPL_TOOLBOX_CONTROL( SwTbxInsertCtrl, SfxImageItem);
+SFX_IMPL_TOOLBOX_CONTROL( SwTbxAutoTextCtrl, SfxBoolItem );
+
+/**********************************************************************
+
+**********************************************************************/
+SwTbxInsertCtrl::SwTbxInsertCtrl(
+ USHORT nSlotId,
+ USHORT nId,
+ ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx ),
+ nLastSlotId(FN_INSERT_CTRL == nSlotId ? FN_INSERT_TABLE : SID_INSERT_DIAGRAM)
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
+}
+/**********************************************************************
+
+**********************************************************************/
+SwTbxInsertCtrl::~SwTbxInsertCtrl()
+{
+}
+
+void SAL_CALL SwTbxInsertCtrl::update() throw (uno::RuntimeException)
+{
+ ToolBox& rTbx = GetToolBox();
+ rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
+ aSlotURL += rtl::OUString::valueOf( sal_Int32( nLastSlotId ));
+ Image aImage = GetImage( m_xFrame,
+ aSlotURL,
+ hasBigImages(),
+ rTbx.GetSettings().GetStyleSettings().GetHighContrastMode() );
+
+ rTbx.SetItemImage(GetId(), aImage);
+ rTbx.Invalidate();
+
+ SfxToolBoxControl::update();
+}
+
+/**********************************************************************
+
+**********************************************************************/
+
+
+void SwTbxInsertCtrl::StateChanged( USHORT /*nSID*/,
+ SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ USHORT nId = GetId();
+ GetToolBox().EnableItem( nId, (GetItemState(pState) != SFX_ITEM_DISABLED) );
+
+ if( eState == SFX_ITEM_AVAILABLE )
+ {
+ const SfxImageItem* pItem = PTR_CAST( SfxImageItem, pState );
+ if(pItem)
+ {
+ nLastSlotId = pItem->GetValue();
+ if( nLastSlotId )
+ nId = nLastSlotId;
+
+ rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
+ aSlotURL += rtl::OUString::valueOf( sal_Int32( nId ));
+ ToolBox& rBox = GetToolBox();
+ Image aImage = GetImage( m_xFrame,
+ aSlotURL,
+ hasBigImages(),
+ rBox.GetSettings().GetStyleSettings().GetHighContrastMode() );
+ rBox.SetItemImage(GetId(), aImage);
+ rBox.SetItemImageMirrorMode( GetId(), FALSE );
+ rBox.SetItemImageAngle( GetId(), pItem->GetRotation() );
+ rBox.SetItemImageMirrorMode( GetId(), pItem->IsMirrored() );
+ }
+ }
+
+}
+/**********************************************************************
+
+**********************************************************************/
+
+
+SfxPopupWindow* SwTbxInsertCtrl::CreatePopupWindow()
+{
+ if(GetSlotId() == FN_INSERT_CTRL)
+ {
+ OUString aToolBarResStr( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/insertbar" ));
+ createAndPositionSubToolBar( aToolBarResStr );
+ }
+ else /* FN_INSERT_OBJ_CTRL */
+ {
+ OUString aToolBarResStr( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/insertobjectbar" ));
+ createAndPositionSubToolBar( aToolBarResStr );
+ }
+ return NULL;
+}
+
+/**********************************************************************
+
+**********************************************************************/
+
+
+SfxPopupWindowType SwTbxInsertCtrl::GetPopupWindowType() const
+{
+ return nLastSlotId ? SFX_POPUPWINDOW_ONTIMEOUT : SFX_POPUPWINDOW_ONCLICK;
+}
+
+
+/**********************************************************************
+
+**********************************************************************/
+
+
+void SwTbxInsertCtrl::Select( BOOL /*bMod1*/ )
+{
+ if( nLastSlotId )
+ {
+ SfxViewShell* pCurSh( SfxViewShell::Current() );
+ SfxDispatcher* pDispatch( 0 );
+
+ if ( pCurSh )
+ {
+ SfxViewFrame* pViewFrame = pCurSh->GetViewFrame();
+ if ( pViewFrame )
+ pDispatch = pViewFrame->GetDispatcher();
+ }
+
+ if ( pDispatch )
+ pDispatch->Execute(nLastSlotId);
+ }
+}
+
+/**********************************************************************
+
+**********************************************************************/
+
+
+SwTbxAutoTextCtrl::SwTbxAutoTextCtrl(
+ USHORT nSlotId,
+ USHORT nId,
+ ToolBox& rTbx ) :
+ SfxToolBoxControl( nSlotId, nId, rTbx ),
+ pPopup(0),
+ pView(0)
+{
+ rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
+}
+/**********************************************************************
+
+**********************************************************************/
+
+
+SwTbxAutoTextCtrl::~SwTbxAutoTextCtrl()
+{
+ DelPopup();
+}
+
+/**********************************************************************
+
+**********************************************************************/
+
+
+SfxPopupWindow* SwTbxAutoTextCtrl::CreatePopupWindow()
+{
+ pView = ::GetActiveView();
+ if(pView && !pView->GetDocShell()->IsReadOnly() &&
+ !pView->GetWrtShell().HasReadonlySel() )
+ {
+ ToolBox& rBox = GetToolBox();
+
+ Rectangle aItemRect( rBox.GetItemRect( GetId() ) );
+ Point aPt(rBox.OutputToScreenPixel(aItemRect.TopLeft()));
+ aPt.X() += aItemRect.GetWidth()/2;
+ aPt.Y() += aItemRect.GetHeight()/2;
+ if(pView)
+ {
+ Link aLnk = LINK(this, SwTbxAutoTextCtrl, PopupHdl);
+
+ if (GetSlotId() == FN_INSERT_FIELD_CTRL)
+ {
+ pPopup = new PopupMenu(SW_RES(RID_INSERT_FIELD_CTRL));
+ pPopup->SetSelectHdl(aLnk);
+
+ if (::GetHtmlMode(pView->GetDocShell()) & HTMLMODE_ON)
+ {
+ pPopup->RemoveItem(pPopup->GetItemPos(FN_INSERT_FLD_PGCOUNT));
+ pPopup->RemoveItem(pPopup->GetItemPos(FN_INSERT_FLD_TOPIC));
+ }
+ }
+ else
+ {
+ pPopup = new PopupMenu;
+ SwGlossaryList* pGlossaryList = ::GetGlossaryList();
+ USHORT nGroupCount = pGlossaryList->GetGroupCount();
+ for(USHORT i = 1; i <= nGroupCount; i++)
+ {
+ // Gruppenname mit Pfad-Extension besorgen
+ String sTitle;
+ String sGroupName = pGlossaryList->GetGroupName(i - 1, FALSE, &sTitle);
+ USHORT nBlockCount = pGlossaryList->GetBlockCount(i -1);
+ if(nBlockCount)
+ {
+ USHORT nIndex = 100 * (i);
+ // aber ohne extension einfuegen
+ pPopup->InsertItem( i, sTitle);//sGroupName.GetToken(0, GLOS_DELIM));
+ PopupMenu* pSub = new PopupMenu;
+ pSub->SetSelectHdl(aLnk);
+ pPopup->SetPopupMenu(i, pSub);
+ for(USHORT j = 0; j < nBlockCount; j++)
+ {
+ String sEntry;
+ String sLongName(pGlossaryList->GetBlockName(i - 1, j, sEntry));
+ sEntry.AppendAscii(" - ");
+ sEntry += sLongName;
+ pSub->InsertItem(++nIndex, sEntry);
+ }
+ }
+ }
+ }
+ }
+ ToolBox* pToolBox = &GetToolBox();
+ USHORT nId = GetId();
+ pToolBox->SetItemDown( nId, TRUE );
+
+ pPopup->Execute( pToolBox, pToolBox->GetItemRect( nId ),
+ (pToolBox->GetAlign() == WINDOWALIGN_TOP || pToolBox->GetAlign() == WINDOWALIGN_BOTTOM) ?
+ POPUPMENU_EXECUTE_DOWN : POPUPMENU_EXECUTE_RIGHT );
+
+ pToolBox->SetItemDown( nId, FALSE );
+ }
+ GetToolBox().EndSelection();
+ DelPopup();
+ return 0;
+
+}
+
+
+/**********************************************************************
+
+**********************************************************************/
+
+
+SfxPopupWindowType SwTbxAutoTextCtrl::GetPopupWindowType() const
+{
+ return SFX_POPUPWINDOW_ONTIMEOUT;
+}
+
+/**********************************************************************
+
+**********************************************************************/
+
+
+void SwTbxAutoTextCtrl::StateChanged( USHORT nSID,
+ SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ GetToolBox().EnableItem( GetId(), (GetItemState(pState) != SFX_ITEM_DISABLED) );
+ if(FN_INSERT_FIELD_CTRL == nSID && eState >= SFX_ITEM_DEFAULT)
+ {
+ GetToolBox().CheckItem( GetId(), ((SfxBoolItem*)pState)->GetValue() );
+ }
+}
+
+/**********************************************************************
+
+**********************************************************************/
+
+
+IMPL_LINK(SwTbxAutoTextCtrl, PopupHdl, PopupMenu*, pMenu)
+{
+ USHORT nId = pMenu->GetCurItemId();
+
+ if ( GetSlotId() == FN_INSERT_FIELD_CTRL)
+ {
+ Sequence< PropertyValue > aArgs;
+ const char* pChar = 0;
+ switch(nId)
+ {
+ case FN_INSERT_FLD_DATE:
+ pChar = ".uno:InsertDateField";
+ break;
+ case FN_INSERT_FLD_TIME:
+ pChar = ".uno:InsertTimeField";
+ break;
+ case FN_INSERT_FLD_PGNUMBER:
+ pChar = ".uno:InsertPageNumberField";
+ break;
+ case FN_INSERT_FLD_PGCOUNT:
+ pChar = ".uno:InsertPageCountField";
+ break;
+ case FN_INSERT_FLD_TOPIC:
+ pChar = ".uno:InsertTopicField";
+ break;
+ case FN_INSERT_FLD_TITLE:
+ pChar = ".uno:InsertTitleField";
+ break;
+ case FN_INSERT_FLD_AUTHOR:
+ pChar = ".uno:InsertAuthorField";
+ break;
+ default:
+ pChar = ".uno:InsertFieldCtrl";
+ }
+ Dispatch( rtl::OUString::createFromAscii( pChar ),aArgs );
+ }
+ else
+ {
+ USHORT nBlock = nId / 100;
+
+ SwGlossaryList* pGlossaryList = ::GetGlossaryList();
+ String sShortName;
+ String sGroup = pGlossaryList->GetGroupName(nBlock - 1, FALSE);
+ String sLongName(pGlossaryList->GetBlockName(nBlock - 1, nId - (100 * nBlock) - 1, sShortName));
+
+ SwGlossaryHdl* pGlosHdl = pView->GetGlosHdl();
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc( DLG_RENAME_GLOS );
+ if ( fnSetActGroup )
+ (*fnSetActGroup)( sGroup );
+ pGlosHdl->SetCurGroup(sGroup, TRUE);
+ pGlosHdl->InsertGlossary(sShortName);
+ }
+ return 0;
+}
+
+/**********************************************************************
+
+**********************************************************************/
+
+
+void SwTbxAutoTextCtrl::DelPopup()
+{
+ if(pPopup)
+ {
+ if (GetSlotId() != FN_INSERT_FIELD_CTRL)
+ {
+ for( USHORT i = 0; i < pPopup->GetItemCount(); i ++ )
+ {
+ PopupMenu* pSubPopup = pPopup->GetPopupMenu(pPopup->GetItemId(i));
+ delete pSubPopup;
+ }
+ }
+ delete pPopup;
+ pPopup = 0;
+ }
+}
+
+/*-----------------19.02.97 10.52-------------------
+ Navigations-Popup
+--------------------------------------------------*/
+// determine the order of the toolbox items
+static USHORT __READONLY_DATA aNavigationInsertIds[ NAVI_ENTRIES ] =
+{
+ // -- first line
+ NID_TBL,
+ NID_FRM,
+ NID_GRF,
+ NID_OLE,
+ NID_PGE,
+ NID_OUTL,
+ NID_MARK,
+ NID_DRW,
+ NID_CTRL,
+ NID_PREV,
+ // -- second line
+ NID_REG,
+ NID_BKM,
+ NID_SEL,
+ NID_FTN,
+ NID_POSTIT,
+ NID_SRCH_REP,
+ NID_INDEX_ENTRY,
+ NID_TABLE_FORMULA,
+ NID_TABLE_FORMULA_ERROR,
+ NID_NEXT
+};
+static const char* __READONLY_DATA aNavigationHelpIds[ NAVI_ENTRIES ] =
+{
+ // -- first line
+ HID_NID_TBL,
+ HID_NID_FRM,
+ HID_NID_GRF,
+ HID_NID_OLE,
+ HID_NID_PGE,
+ HID_NID_OUTL,
+ HID_NID_MARK,
+ HID_NID_DRW,
+ HID_NID_CTRL,
+ HID_NID_PREV,
+ // -- second line
+ HID_NID_REG,
+ HID_NID_BKM,
+ HID_NID_SEL,
+ HID_NID_FTN,
+ HID_NID_POSTIT,
+ HID_NID_SRCH_REP,
+ HID_NID_INDEX_ENTRY,
+ HID_NID_TABLE_FORMULA,
+ HID_NID_TABLE_FORMULA_ERROR,
+ HID_NID_NEXT
+};
+
+SwScrollNaviPopup::SwScrollNaviPopup( USHORT nId, const Reference< XFrame >& rFrame )
+ : SfxPopupWindow(nId, rFrame, SW_RES(RID_SCROLL_NAVIGATION_WIN) ),
+ aToolBox(this, 0),
+ aSeparator(this, SW_RES(FL_SEP)),
+ aInfoField(this, SW_RES(FI_INFO)),
+ aIList(SW_RES(IL_VALUES)),
+ aIListH(SW_RES(ILH_VALUES)),
+ nFwdId(FN_START_OF_NEXT_PAGE),
+ nBackId(FN_START_OF_PREV_PAGE)
+{
+ USHORT i;
+
+ aToolBox.SetHelpId(HID_NAVI_VS);
+ aToolBox.SetLineCount( 2 );
+ aToolBox.SetOutStyle(TOOLBOX_STYLE_FLAT);
+ for( i = 0; i < NID_COUNT; i++)
+ {
+ USHORT nNaviId = aNavigationInsertIds[i];
+ String sText;
+ ToolBoxItemBits nTbxBits = 0;
+ if((NID_PREV != nNaviId) && (NID_NEXT != nNaviId))
+ {
+ // -2, there's no string for Next/Prev
+ USHORT nResStr = ST_TBL - 2 + nNaviId - NID_START;
+ sText = String(SW_RES(nResStr));
+ nTbxBits = TIB_CHECKABLE;
+ }
+ aToolBox.InsertItem(nNaviId, sText, nTbxBits);
+ aToolBox.SetHelpId( nNaviId, aNavigationHelpIds[i] );
+ }
+ ApplyImageList();
+ aToolBox.InsertBreak(NID_COUNT/2);
+ // don't call it before!
+ FreeResource();
+
+ // these are global strings
+ for( i = 0; i < 2 * NID_COUNT; i++)
+ {
+ sQuickHelp[i] = String(SW_RES(STR_IMGBTN_START + i));
+ }
+
+ Size aImgSize = aIList.GetImageSize();
+ aImgSize.Width() += 5;
+ aImgSize.Height() += 5;
+ Size aSz = aToolBox.CalcWindowSizePixel(2);
+ aToolBox.SetPosSizePixel( Point(), aSz );
+ USHORT nItemId = SwView::GetMoveType();
+ aInfoField.SetText(aToolBox.GetItemText(nItemId));
+ aToolBox.CheckItem( nItemId, sal_True );
+ Size aFTSize(aInfoField.GetSizePixel());
+ Size aSepSize(aSeparator.GetSizePixel());
+ aSepSize.Width() = aSz.Width();
+
+ aSz.Height() += aFTSize.Height() + aSepSize.Height();
+ aInfoField.SetPosSizePixel(
+ Point(0, aSz.Height() - aFTSize.Height()), Size(aSz.Width(), aFTSize.Height()));
+
+ aSeparator.SetSizePixel(aSepSize);
+ aSeparator.SetPosPixel(Point(0, aSz.Height() - aFTSize.Height() - aSepSize.Height()));
+
+ SetOutputSizePixel(aSz);
+ aToolBox.SetSelectHdl(LINK(this, SwScrollNaviPopup, SelectHdl));
+ aToolBox.StartSelection();
+ aToolBox.Show();
+}
+/*-----------------19.02.97 12.45-------------------
+
+--------------------------------------------------*/
+
+SwScrollNaviPopup::~SwScrollNaviPopup()
+{
+}
+/* -----------------------------08.05.2002 14:00------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwScrollNaviPopup::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ ApplyImageList();
+
+ Window::DataChanged( rDCEvt );
+}
+/* -----------------------------08.05.2002 14:02------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwScrollNaviPopup::ApplyImageList()
+{
+ ImageList& rImgLst = aToolBox.GetSettings().GetStyleSettings().GetHighContrastMode() ?
+ aIListH : aIList;
+ for(USHORT i = 0; i < NID_COUNT; i++)
+ {
+ USHORT nNaviId = aNavigationInsertIds[i];
+ aToolBox.SetItemImage(nNaviId, rImgLst.GetImage(nNaviId));
+ }
+}
+/*-----------------19.02.97 13.58-------------------
+
+--------------------------------------------------*/
+
+SfxPopupWindow* SwScrollNaviPopup::Clone() const
+{
+ return new SwScrollNaviPopup( GetId(), GetFrame() );
+}
+
+/*-----------------19.02.97 14.10-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK(SwScrollNaviPopup, SelectHdl, ToolBox*, pSet)
+{
+ USHORT nSet = pSet->GetCurItemId();
+ if( nSet != NID_PREV && nSet != NID_NEXT )
+ {
+ SwView::SetMoveType(nSet);
+ aToolBox.SetItemText(NID_NEXT, sQuickHelp[nSet - NID_START]);
+ aToolBox.SetItemText(NID_PREV, sQuickHelp[nSet - NID_START + NID_COUNT]);
+ aInfoField.SetText(aToolBox.GetItemText(nSet));
+ //check the current button only
+ for(USHORT i = 0; i < NID_COUNT; i++)
+ {
+ USHORT nItemId = aToolBox.GetItemId( i );
+ aToolBox.CheckItem( nItemId, nItemId == nSet );
+ }
+ }
+ else
+ {
+ SfxBoolItem aNext(FN_SCROLL_NEXT_PREV, NID_NEXT == nSet);
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScrollNextPrev" ));
+ aNext.QueryValue( a );
+ aArgs[0].Value = a;
+ SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ScrollNextPrev" )),
+ aArgs );
+ }
+ return 0;
+}
+/*-----------------23.02.97 18.21-------------------
+
+--------------------------------------------------*/
+
+void SwScrollNaviToolBox::MouseButtonUp( const MouseEvent& rMEvt )
+{
+ ToolBox::MouseButtonUp(rMEvt);
+ if ( ((SwScrollNaviPopup*)GetParent())->IsInPopupMode() )
+ ((SwScrollNaviPopup*)GetParent())->EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL );
+}
+
+/*-----------------20.06.97 13:28-------------------
+
+--------------------------------------------------*/
+void SwScrollNaviToolBox::RequestHelp( const HelpEvent& rHEvt )
+{
+ SetItemText(NID_NEXT, SwScrollNaviPopup::GetQuickHelpText(TRUE));
+ SetItemText(NID_PREV, SwScrollNaviPopup::GetQuickHelpText(FALSE));
+ ToolBox::RequestHelp( rHEvt );
+
+}
+
+/*-----------------20.06.97 13:41-------------------
+
+--------------------------------------------------*/
+String SwScrollNaviPopup::GetQuickHelpText(BOOL bNext)
+{
+ USHORT nResId = STR_IMGBTN_START;
+ nResId += SwView::GetMoveType() - NID_START;
+ if(!bNext)
+ nResId += NID_COUNT;
+ return String(SW_RES(nResId));
+}
+/* -----------------------------05.09.2002 13:53------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNaviImageButton::Click()
+{
+// SfxBindings& rBind = SfxViewFrame::Current()->GetBindings();
+// rBind.ENTERREGISTRATIONS();
+ pPopup = new
+ SwScrollNaviPopup( FN_SCROLL_NAVIGATION,
+ m_xFrame );
+// rBind.LEAVEREGISTRATIONS();
+ Point aPos = OutputToScreenPixel(Point(0,0));
+ Rectangle aRect(aPos, GetSizePixel());
+ SetPopupWindow( pPopup );
+ pPopup->StartPopupMode(aRect, FLOATWIN_POPUPMODE_LEFT|FLOATWIN_POPUPMODE_ALLOWTEAROFF);
+}
+
+//--------------------------------------------------------------------
+
+void SwNaviImageButton::SetPopupWindow( SfxPopupWindow* pWindow )
+{
+ pPopupWindow = pWindow;
+ pPopupWindow->SetPopupModeEndHdl( LINK( this, SwNaviImageButton, PopupModeEndHdl ));
+ pPopupWindow->SetDeleteLink_Impl( LINK( this, SwNaviImageButton, ClosePopupWindow ));
+}
+
+//--------------------------------------------------------------------
+
+IMPL_LINK( SwNaviImageButton, PopupModeEndHdl, void *, EMPTYARG )
+{
+ if ( pPopupWindow->IsVisible() )
+ {
+ // Replace floating window with popup window and destroy
+ // floating window instance.
+ delete pFloatingWindow;
+ pFloatingWindow = pPopupWindow;
+ pPopupWindow = 0;
+ }
+ else
+ {
+ // Popup window has been closed by the user. No replacement, instance
+ // will destroy itself.
+ pPopupWindow = 0;
+ }
+
+ return 1;
+}
+
+//--------------------------------------------------------------------
+IMPL_LINK( SwNaviImageButton, ClosePopupWindow, SfxPopupWindow *, pWindow )
+{
+ if ( pWindow == pFloatingWindow )
+ pFloatingWindow = 0;
+ else
+ pPopupWindow = 0;
+
+ return 1;
+}
+
+/*-----------------21.02.97 09:41-------------------
+
+--------------------------------------------------*/
+
+void SwHlpImageButton::RequestHelp( const HelpEvent& rHEvt )
+{
+
+ SetQuickHelpText(SwScrollNaviPopup::GetQuickHelpText(!bUp));
+
+ ImageButton::RequestHelp(rHEvt);
+}
+
+/*-----------------25.02.97 12:38-------------------
+
+--------------------------------------------------*/
+
+SwNaviImageButton::SwNaviImageButton(
+ Window* pParent,
+ const Reference< XFrame >& rFrame ) :
+ ImageButton(pParent, SW_RES(BTN_NAVI)),
+ pPopup(0),
+ aImage(SW_RES(IMG_BTN)),
+ aImageH(SW_RES(IMG_BTN_H)),
+ sQuickText(SW_RES(ST_QUICK)),
+ pPopupWindow(0),
+ pFloatingWindow(0),
+ m_xFrame( rFrame )
+{
+ FreeResource();
+ SetStyle(GetStyle()|WB_NOPOINTERFOCUS);
+ SetQuickHelpText(sQuickText);
+ SetModeImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? aImageH : aImage);
+}
+/* -----------------------------2002/07/05 9:41-------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNaviImageButton::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ SetModeImage( GetSettings().GetStyleSettings().GetHighContrastMode() ? aImageH : aImage);
+
+ Window::DataChanged( rDCEvt );
+}
+/* -----------------26.11.2002 09:28-----------------
+ *
+ * --------------------------------------------------*/
+class SwZoomBox_Impl : public ComboBox
+{
+ USHORT nSlotId;
+ BOOL bRelease;
+ uno::Reference< frame::XDispatchProvider > m_xDispatchProvider;
+
+public:
+ SwZoomBox_Impl(
+ Window* pParent,
+ USHORT nSlot,
+ const Reference< XDispatchProvider >& rDispatchProvider );
+ ~SwZoomBox_Impl();
+
+protected:
+ virtual void Select();
+ virtual long Notify( NotifyEvent& rNEvt );
+
+ void ReleaseFocus();
+
+};
+/* -----------------26.11.2002 09:29-----------------
+ *
+ * --------------------------------------------------*/
+SwZoomBox_Impl::SwZoomBox_Impl(
+ Window* pParent,
+ USHORT nSlot,
+ const Reference< XDispatchProvider >& rDispatchProvider ):
+ ComboBox( pParent, SW_RES(RID_PVIEW_ZOOM_LB)),
+ nSlotId(nSlot),
+ bRelease(TRUE),
+ m_xDispatchProvider( rDispatchProvider )
+{
+ EnableAutocomplete( FALSE );
+ USHORT aZoomValues[] =
+ { 25, 50, 75, 100, 150, 200 };
+ for(USHORT i = 0; i < sizeof(aZoomValues)/sizeof(USHORT); i++)
+ {
+ String sEntry = String::CreateFromInt32(aZoomValues[i]);
+ sEntry += '%';
+ InsertEntry(sEntry);
+ }
+}
+/* -----------------26.11.2002 09:29-----------------
+ *
+ * --------------------------------------------------*/
+SwZoomBox_Impl::~SwZoomBox_Impl()
+{}
+/* -----------------26.11.2002 09:34-----------------
+ *
+ * --------------------------------------------------*/
+void SwZoomBox_Impl::Select()
+{
+ if ( !IsTravelSelect() )
+ {
+ String sEntry(GetText());
+ sEntry.EraseAllChars( '%' );
+ USHORT nZoom = (USHORT)sEntry.ToInt32();
+ if(nZoom < MINZOOM)
+ nZoom = MINZOOM;
+ if(nZoom > MAXZOOM)
+ nZoom = MAXZOOM;
+
+ SfxUInt16Item aItem( nSlotId, nZoom );
+ if ( FN_PREVIEW_ZOOM == nSlotId )
+ {
+ Any a;
+ Sequence< PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PreviewZoom" ));
+ aItem.QueryValue( a );
+ aArgs[0].Value = a;
+ SfxToolBoxControl::Dispatch(
+ m_xDispatchProvider,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PreviewZoom" )),
+ aArgs );
+ }
+
+ ReleaseFocus();
+ }
+}
+/* -----------------02.12.2002 07:49-----------------
+ *
+ * --------------------------------------------------*/
+long SwZoomBox_Impl::Notify( NotifyEvent& rNEvt )
+{
+ long nHandled = 0;
+
+ if ( rNEvt.GetType() == EVENT_KEYINPUT )
+ {
+ USHORT nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
+
+ switch ( nCode )
+ {
+ case KEY_RETURN:
+ case KEY_TAB:
+ {
+ if ( KEY_TAB == nCode )
+ bRelease = FALSE;
+ else
+ nHandled = 1;
+ Select();
+ break;
+ }
+
+ case KEY_ESCAPE:
+ SetText( GetSavedValue() );
+ ReleaseFocus();
+ break;
+ }
+ }
+ else if ( EVENT_LOSEFOCUS == rNEvt.GetType() )
+ {
+ Window* pFocusWin = Application::GetFocusWindow();
+ if ( !HasFocus() && GetSubEdit() != pFocusWin )
+ SetText( GetSavedValue() );
+ }
+
+ return nHandled ? nHandled : ComboBox::Notify( rNEvt );
+}
+/* -----------------02.12.2002 07:51-----------------
+ *
+ * --------------------------------------------------*/
+void SwZoomBox_Impl::ReleaseFocus()
+{
+ if ( !bRelease )
+ {
+ bRelease = TRUE;
+ return;
+ }
+ SfxViewShell* pCurSh = SfxViewShell::Current();
+
+ if ( pCurSh )
+ {
+ Window* pShellWnd = pCurSh->GetWindow();
+
+ if ( pShellWnd )
+ pShellWnd->GrabFocus();
+ }
+}
+
+/* -----------------26.11.2002 09:29-----------------
+ *
+ * --------------------------------------------------*/
+SFX_IMPL_TOOLBOX_CONTROL( SwPreviewZoomControl, SfxUInt16Item);
+
+SwPreviewZoomControl::SwPreviewZoomControl(
+ USHORT nSlotId,
+ USHORT nId,
+ ToolBox& rTbx) :
+ SfxToolBoxControl( nSlotId, nId, rTbx )
+{
+}
+/* -----------------26.11.2002 09:29-----------------
+ *
+ * --------------------------------------------------*/
+SwPreviewZoomControl::~SwPreviewZoomControl()
+{
+}
+/* -----------------26.11.2002 09:29-----------------
+ *
+ * --------------------------------------------------*/
+void SwPreviewZoomControl::StateChanged( USHORT /*nSID*/,
+ SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ USHORT nId = GetId();
+ GetToolBox().EnableItem( nId, (GetItemState(pState) != SFX_ITEM_DISABLED) );
+ SwZoomBox_Impl* pBox = (SwZoomBox_Impl*)GetToolBox().GetItemWindow( GetId() );
+ if(SFX_ITEM_AVAILABLE <= eState)
+ {
+ String sZoom(String::CreateFromInt32(((const SfxUInt16Item*)pState)->GetValue()));
+ sZoom += '%';
+ pBox->SetText(sZoom);
+ pBox->SaveValue();
+ }
+}
+/* -----------------26.11.2002 09:29-----------------
+ *
+ * --------------------------------------------------*/
+Window* SwPreviewZoomControl::CreateItemWindow( Window *pParent )
+{
+ SwZoomBox_Impl* pRet = new SwZoomBox_Impl( pParent, GetSlotId(), Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ));
+ return pRet;
+}
diff --git a/sw/source/ui/ribbar/workctrl.hrc b/sw/source/ui/ribbar/workctrl.hrc
new file mode 100644
index 000000000000..5e5180f363aa
--- /dev/null
+++ b/sw/source/ui/ribbar/workctrl.hrc
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _WORKCTRL_HRC
+#define _WORKCTRL_HRC
+#include "ribbar.hrc"
+
+#define TBX_INSERT 1
+#define TBX_OBJ_INSERT 2
+#define TBX_FIELD_INSERT 3
+#define TBX_NAVIGATION 4
+#define IL_VALUES 5
+#define IMG_BTN 6
+#define ST_QUICK 7
+#define FI_INFO 8
+#define FL_SEP 9
+#define ILH_VALUES 10
+#define IMG_BTN_H 11
+
+
+#define ST_TBL 12
+#define ST_FRM 13
+#define ST_PGE 14
+#define ST_DRW 15
+#define ST_CTRL 16
+#define ST_REG 17
+#define ST_BKM 18
+#define ST_GRF 19
+#define ST_OLE 20
+#define ST_OUTL 21
+#define ST_SEL 22
+#define ST_FTN 23
+#define ST_MARK 24
+#define ST_POSTIT 25
+#define ST_SRCH_REP 26
+#define ST_INDEX_ENTRY 27
+#define ST_TABLE_FORMULA 28
+#define ST_TABLE_FORMULA_ERROR 29
+
+// doppelter Eintrag! hrc und hxx
+// diese Ids bestimmen, was die Buttons unter dem Scrollbar tun
+#define NID_START 20000
+#define NID_NEXT 20000
+#define NID_PREV 20001
+#define NID_TBL 20002
+#define NID_FRM 20003
+#define NID_PGE 20004
+#define NID_DRW 20005
+#define NID_CTRL 20006
+#define NID_REG 20007
+#define NID_BKM 20008
+#define NID_GRF 20009
+#define NID_OLE 20010
+#define NID_OUTL 20011
+#define NID_SEL 20012
+#define NID_FTN 20013
+#define NID_MARK 20014
+#define NID_POSTIT 20015
+#define NID_SRCH_REP 20016
+#define NID_INDEX_ENTRY 20017
+#define NID_TABLE_FORMULA 20018
+#define NID_TABLE_FORMULA_ERROR 20019
+#define NID_COUNT 20
+
+#endif
diff --git a/sw/source/ui/ribbar/workctrl.src b/sw/source/ui/ribbar/workctrl.src
new file mode 100644
index 000000000000..4fff5c4a9260
--- /dev/null
+++ b/sw/source/ui/ribbar/workctrl.src
@@ -0,0 +1,467 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+#include "workctrl.hrc"
+#include "helpid.h"
+#include "cmdid.h"
+
+Menu RID_INSERT_FIELD_CTRL
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = FN_INSERT_FLD_DATE ;
+ HelpId = CMD_FN_INSERT_FLD_DATE ;
+ Text [ en-US ] = "Date" ;
+ };
+ MenuItem
+ {
+ Identifier = FN_INSERT_FLD_TIME ;
+ HelpId = CMD_FN_INSERT_FLD_TIME ;
+ Text [ en-US ] = "Time" ;
+ };
+ //#ifndef MN_SW_WEB
+ MenuItem
+ {
+ Identifier = FN_INSERT_FLD_PGNUMBER ;
+ HelpId = CMD_FN_INSERT_FLD_PGNUMBER ;
+ Text [ en-US ] = "Page Number" ;
+ };
+ MenuItem
+ {
+ Identifier = FN_INSERT_FLD_PGCOUNT ;
+ HelpId = CMD_FN_INSERT_FLD_PGCOUNT ;
+ Text [ en-US ] = "Page Count" ;
+ };
+ MenuItem
+ {
+ Identifier = FN_INSERT_FLD_TOPIC ;
+ HelpId = CMD_FN_INSERT_FLD_TOPIC ;
+ Text [ en-US ] = "Subject" ;
+ };
+ MenuItem
+ {
+ Identifier = FN_INSERT_FLD_TITLE ;
+ HelpId = CMD_FN_INSERT_FLD_TITLE ;
+ Text [ en-US ] = "Title" ;
+ };
+ //#endif
+ MenuItem
+ {
+ Identifier = FN_INSERT_FLD_AUTHOR ;
+ HelpId = CMD_FN_INSERT_FLD_AUTHOR ;
+ Text [ en-US ] = "Author" ;
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = FN_INSERT_FIELD ;
+ HelpId = CMD_FN_INSERT_FIELD ;
+ Text [ en-US ] = "Other..." ;
+ };
+ };
+};
+#define SCROLL_IMAGE_IDLIST \
+ IdList = \
+ { \
+ NID_NEXT ; \
+ NID_PREV ; \
+ NID_TBL ; \
+ NID_FRM ; \
+ NID_PGE ; \
+ NID_DRW ; \
+ NID_CTRL ; \
+ NID_REG ; \
+ NID_BKM ; \
+ NID_GRF ; \
+ NID_OLE ; \
+ NID_OUTL ; \
+ NID_SEL ; \
+ NID_FTN ; \
+ NID_MARK ; \
+ NID_POSTIT ; \
+ NID_SRCH_REP ; \
+ NID_INDEX_ENTRY; \
+ NID_TABLE_FORMULA; \
+ NID_TABLE_FORMULA_ERROR; \
+ }; \
+ IdCount = { 20 ; };
+
+FloatingWindow RID_SCROLL_NAVIGATION_WIN
+{
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_INSERT_CTRL ;
+ ImageList IL_VALUES
+ {
+ Prefix = "sr";
+ MaskColor = IMAGE_MASK_COLOR ;
+ SCROLL_IMAGE_IDLIST
+ };
+ ImageList ILH_VALUES
+ {
+ Prefix = "srh";
+ MaskColor = IMAGE_MASK_COLOR ;
+ SCROLL_IMAGE_IDLIST
+ };
+ FixedLine FL_SEP
+ {
+ //no position, no text
+ Size = MAP_APPFONT ( 20 , 4 ) ;
+ };
+ FixedText FI_INFO
+ {
+ //no position, no text
+ Size = MAP_APPFONT ( 20 , 8 ) ;
+ Center = TRUE;
+ };
+ String ST_TBL
+ {
+ Text [ en-US ] = "Table" ;
+ };
+ String ST_FRM
+ {
+ Text [ en-US ] = "Text Frame" ;
+ };
+ String ST_PGE
+ {
+ Text [ en-US ] = "Page" ;
+ };
+ String ST_DRW
+ {
+ Text [ en-US ] = "Drawing" ;
+ };
+ String ST_CTRL
+ {
+ Text [ en-US ] = "Control" ;
+ };
+ String ST_REG
+ {
+ Text [ en-US ] = "Section" ;
+ };
+ String ST_BKM
+ {
+ Text [ en-US ] = "Bookmark" ;
+ };
+ String ST_GRF
+ {
+ Text [ en-US ] = "Graphics" ;
+ };
+ String ST_OLE
+ {
+ Text [ en-US ] = "OLE object" ;
+ };
+ String ST_OUTL
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Überschrift : šberschrift */
+ Text [ en-US ] = "Headings" ;
+ };
+ String ST_SEL
+ {
+ Text [ en-US ] = "Selection" ;
+ };
+ String ST_FTN
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Fußnote : Fu˜note */
+ Text [ en-US ] = "Footnote" ;
+ };
+ String ST_MARK
+ {
+ Text [ en-US ] = "Reminder" ;
+ };
+ String ST_POSTIT
+ {
+ Text [ en-US ] = "Note" ;
+ };
+ String ST_SRCH_REP
+ {
+ Text [ en-US ] = "Repeat search" ;
+ };
+ String ST_INDEX_ENTRY
+ {
+ Text [ en-US ] = "Index entry";
+ };
+ String ST_TABLE_FORMULA
+ {
+ Text [ en-US ] = "Table formula";
+ };
+ String ST_TABLE_FORMULA_ERROR
+ {
+ Text [ en-US ] = "Wrong table formula";
+ };
+ Text [ en-US ] = "Navigation" ;
+};
+/*
+Noch ein paar Reserven
+ ToolBoxItem
+ {
+ Identifier = NID_NEXT;
+ Text = "Vorwärts" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = NID_PREV;
+ Text = "Rückwärts" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = NID_CTRL;
+ Text = "Control" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = NID_DRW;
+ Text = "Zeichenobjekt" ;
+ };
+
+
+*/
+/***************************************************************
+ Strings fuer die Quickhelp der View-PgUp/Down-Buttons
+***************************************************************/
+String STR_IMGBTN_NEXT_DOWN
+{
+ Text = "" ;
+};
+String STR_IMGBTN_PREV_DOWN
+{
+ Text = "" ;
+};
+String STR_IMGBTN_TBL_DOWN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Nächste Tabelle : Nõchste Tabelle */
+ Text [ en-US ] = "Next table" ;
+};
+String STR_IMGBTN_FRM_DOWN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Nächster Textrahmen : Nõchster Textrahmen */
+ Text [ en-US ] = "Next text frame" ;
+};
+String STR_IMGBTN_PGE_DOWN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Nächste Seite : Nõchste Seite */
+ Text [ en-US ] = "Next page" ;
+};
+String STR_IMGBTN_DRW_DOWN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Nächstes Zeichenobjekt : Nõchstes Zeichenobjekt */
+ Text [ en-US ] = "Next drawing" ;
+};
+String STR_IMGBTN_CTRL_DOWN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Nächstes Kontrollfeld : Nõchstes Kontrollfeld */
+ Text [ en-US ] = "Next control" ;
+};
+String STR_IMGBTN_REG_DOWN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Nächster Bereich : Nõchster Bereich */
+ Text [ en-US ] = "Next section" ;
+};
+String STR_IMGBTN_BKM_DOWN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Nächste Textmarke : Nõchste Textmarke */
+ Text [ en-US ] = "Next bookmark" ;
+};
+String STR_IMGBTN_GRF_DOWN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Nächste Grafik : Nõchste Grafik */
+ Text [ en-US ] = "Next graphic" ;
+};
+String STR_IMGBTN_OLE_DOWN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Nächstes OLE-Objekt : Nächstes OLE object */
+ /* ### ACHTUNG: Neuer Text in Resource? Nächstes OLE-Objekt : Nõchstes OLE-Objekt */
+ Text [ en-US ] = "Next OLE object" ;
+};
+String STR_IMGBTN_OUTL_DOWN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Nächste Überschrift : Nõchste šberschrift */
+ Text [ en-US ] = "Next heading" ;
+};
+String STR_IMGBTN_SEL_DOWN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Nächste Markierung : Nõchste Markierung */
+ Text [ en-US ] = "Next selection" ;
+};
+String STR_IMGBTN_FTN_DOWN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Nächste Fußnote : Nõchste Fu˜note */
+ Text [ en-US ] = "Next footnote" ;
+};
+String STR_IMGBTN_MARK_DOWN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Nächster Merker : Nõchster Merker */
+ Text [ en-US ] = "Next Reminder" ;
+};
+String STR_IMGBTN_POSTIT_DOWN
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Nächste Notiz : Nõchste Notiz */
+ Text [ en-US ] = "Next Note" ;
+};
+String STR_IMGBTN_SRCH_REP_DOWN
+{
+ Text [ en-US ] = "Continue search forward" ;
+};
+String STR_IMGBTN_INDEX_ENTRY_DOWN
+{
+ Text [ en-US ] = "Next index entry";
+};
+String STR_IMGBTN_NEXT_UP
+{
+ Text = "" ;
+};
+String STR_IMGBTN_PREV_UP
+{
+ Text = "" ;
+};
+String STR_IMGBTN_TBL_UP
+{
+ Text [ en-US ] = "Previous table" ;
+};
+String STR_IMGBTN_FRM_UP
+{
+ Text [ en-US ] = "Previous text frame" ;
+};
+String STR_IMGBTN_PGE_UP
+{
+ Text [ en-US ] = "Previous page" ;
+};
+String STR_IMGBTN_DRW_UP
+{
+ Text [ en-US ] = "Previous drawing" ;
+};
+String STR_IMGBTN_CTRL_UP
+{
+ Text [ en-US ] = "Previous control" ;
+};
+String STR_IMGBTN_REG_UP
+{
+ Text [ en-US ] = "Previous section" ;
+};
+String STR_IMGBTN_BKM_UP
+{
+ Text [ en-US ] = "Previous bookmark" ;
+};
+String STR_IMGBTN_GRF_UP
+{
+ Text [ en-US ] = "Previous graphic" ;
+};
+String STR_IMGBTN_OLE_UP
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Voriges OLE-Objekt : Voriges OLE object */
+ Text [ en-US ] = "Previous OLE object" ;
+};
+String STR_IMGBTN_OUTL_UP
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Vorige Überschrift : Vorige šberschrift */
+ Text [ en-US ] = "Previous heading" ;
+};
+String STR_IMGBTN_SEL_UP
+{
+ Text [ en-US ] = "Previous selection" ;
+};
+String STR_IMGBTN_FTN_UP
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Vorige Fußnote : Vorige Fu˜note */
+ Text [ en-US ] = "Previous footnote" ;
+};
+String STR_IMGBTN_MARK_UP
+{
+ Text [ en-US ] = "Previous Reminder" ;
+};
+String STR_IMGBTN_POSTIT_UP
+{
+ Text [ en-US ] = "Previous Note" ;
+};
+String STR_IMGBTN_SRCH_REP_UP
+{
+ Text [ en-US ] = "Continue search backwards" ;
+};
+String STR_IMGBTN_INDEX_ENTRY_UP
+{
+ Text [ en-US ] = "Previous index entry";
+};
+String STR_IMGBTN_TBLFML_UP
+{
+ Text [ en-US ] = "Previous table formula";
+};
+String STR_IMGBTN_TBLFML_DOWN
+{
+ Text [ en-US ] = "Next table formula";
+};
+String STR_IMGBTN_TBLFML_ERR_UP
+{
+ Text [ en-US ] = "Previous faulty table formula";
+};
+String STR_IMGBTN_TBLFML_ERR_DOWN
+{
+ Text [ en-US ] = "Next faulty table formula";
+};
+ImageButton BTN_NAVI
+{
+ HelpID = HID_NAVIGATION_IMGBTN ;
+ SVLOOK = TRUE ;
+ HIDE = TRUE ;
+ RectStyle = TRUE ;
+ SmallStyle = TRUE ;
+ Image IMG_BTN
+ {
+ ImageBitmap = Bitmap { File = "punkt.bmp" ; };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ Image IMG_BTN_H
+ {
+ ImageBitmap = Bitmap { File = "punkt_h.bmp" ; };
+ MaskColor = IMAGE_MASK_COLOR ;
+ };
+ String ST_QUICK
+ {
+ Text [ en-US ] = "Navigation" ;
+ };
+};
+ComboBox RID_PVIEW_ZOOM_LB
+{
+ HelpId = HID_PVIEW_ZOOM_LB;
+ Size = MAP_APPFONT ( 30 , 86 ) ;
+ DropDown = TRUE ;
+ AutoHScroll = TRUE ;
+ DDExtraWidth = TRUE ;
+ Border = TRUE ;
+ Hide = TRUE ;
+};
diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx
new file mode 100755
index 000000000000..f750447ed3fe
--- /dev/null
+++ b/sw/source/ui/shells/annotsh.cxx
@@ -0,0 +1,1682 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
+#include <com/sun/star/i18n/TextConversionOption.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+#include <tools/shl.hxx>
+#include <i18npool/mslangid.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/spltitem.hxx>
+#include <editeng/orphitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <editeng/widwitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <editeng/escpitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/hyznitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <svx/clipfmtitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/slstitm.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/cntritem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svx/svdoutl.hxx>
+#include <svl/whiter.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svl/ctloptions.hxx>
+#include <unotools/useroptions.hxx>
+#include <vcl/msgbox.hxx>
+#include <editeng/flditem.hxx>
+#include <editeng/editstat.hxx>
+#include <svx/hlnkitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/unolingu.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <editeng/writingmodeitem.hxx>
+#include <swundo.hxx>
+#include <doc.hxx>
+#include <viewopt.hxx>
+#include <wrtsh.hxx>
+#include <uitool.hxx>
+#include <popup.hrc>
+#include <pardlg.hxx>
+#include <swdtflvr.hxx>
+#include <drwtxtsh.hxx>
+#include <swmodule.hxx>
+#include <initui.hxx>
+#include <edtwin.hxx>
+#include <swwait.hxx>
+#include <docstat.hxx>
+
+#include <cmdid.h>
+#include <globals.hrc>
+#include <shells.hrc>
+#include <breakit.hxx>
+#include "annotsh.hxx"
+#include "view.hxx"
+#include <PostItMgr.hxx>
+#include <SidebarWin.hxx>
+
+#include "swtypes.hxx"
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+#include <svx/svxids.hrc>
+#include <svl/itempool.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editview.hxx>
+
+#include <svl/languageoptions.hxx>
+#include <editeng/langitem.hxx>
+#include <svtools/langtab.hxx>
+#include <svl/slstitm.hxx>
+
+#include <docsh.hxx>
+#include <svl/undo.hxx>
+#include "swabstdlg.hxx"
+#include "chrdlg.hrc"
+#include "misc.hrc"
+#include <app.hrc>
+
+#include <comphelper/processfactory.hxx>
+
+#include <cppuhelper/bootstrap.hxx>
+
+#include <langhelper.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::i18n;
+
+#define SwAnnotationShell
+
+#include <sfx2/msg.hxx>
+#include <swslots.hxx>
+
+SFX_IMPL_INTERFACE(SwAnnotationShell, SfxShell, SW_RES(STR_SHELLNAME_DRAW_TEXT))
+{
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TEXT_TOOLBOX));
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_ANNOTATION_POPUPMENU));
+}
+
+TYPEINIT1(SwAnnotationShell,SfxShell)
+
+SwAnnotationShell::SwAnnotationShell( SwView& r )
+: rView(r)
+{
+ SwWrtShell &rSh = rView.GetWrtShell();
+ SetPool(rSh.GetAttrPool().GetSecondaryPool());
+}
+
+SwAnnotationShell::~SwAnnotationShell()
+{
+}
+
+::svl::IUndoManager* SwAnnotationShell::GetUndoManager()
+{
+ SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
+ if ( !pPostItMgr ||
+ !pPostItMgr->HasActiveSidebarWin() )
+ {
+ DBG_ASSERT(pPostItMgr,"PostItMgr::Layout(): We are looping forever");
+ return 0;
+ }
+ return &pPostItMgr->GetActiveSidebarWin()->GetOutlinerView()->GetOutliner()->GetUndoManager();
+}
+
+void SwAnnotationShell::Exec( SfxRequest &rReq )
+{
+ //TODO: clean this up!!!!
+ SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
+ return;
+
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
+ SfxItemSet aEditAttr(pOLV->GetAttribs());
+ SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
+
+ sal_uInt16 nSlot = rReq.GetSlot();
+ sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
+ const SfxItemSet *pNewAttrs = rReq.GetArgs();
+ sal_uInt16 nEEWhich = 0;
+ switch (nSlot)
+ {
+ case SID_ATTR_CHAR_FONT:
+ case SID_ATTR_CHAR_FONTHEIGHT:
+ case SID_ATTR_CHAR_WEIGHT:
+ case SID_ATTR_CHAR_POSTURE:
+ {
+ SfxItemPool* pSecondPool = aEditAttr.GetPool()->GetSecondaryPool();
+ if( !pSecondPool )
+ pSecondPool = aEditAttr.GetPool();
+ SvxScriptSetItem aSetItem( nSlot, *pSecondPool );
+ aSetItem.PutItemForScriptType( pOLV->GetSelectedScriptType(), pNewAttrs->Get( nWhich ));
+ aNewAttr.Put( aSetItem.GetItemSet() );
+ rReq.Done();
+ break;
+ }
+ case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
+ case SID_ATTR_CHAR_UNDERLINE:
+ {
+ FontUnderline eFU = ((const SvxUnderlineItem&)aEditAttr.Get(EE_CHAR_UNDERLINE)).GetLineStyle();
+ aNewAttr.Put(SvxUnderlineItem(eFU == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE));
+ break;
+ }
+ case SID_ATTR_CHAR_OVERLINE:
+ {
+ FontUnderline eFO = ((const SvxOverlineItem&)aEditAttr.Get(EE_CHAR_OVERLINE)).GetLineStyle();
+ aNewAttr.Put(SvxOverlineItem(eFO == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_OVERLINE));
+ break;
+ }
+ case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
+ case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW; break;
+ case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT; break;
+ case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
+ case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break;
+ case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
+ case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break;
+ case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH; break;
+ case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
+ case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
+ case SID_ATTR_PARA_ADJUST_LEFT:
+ aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_LEFT, EE_PARA_JUST));
+ break;
+ case SID_ATTR_PARA_ADJUST_CENTER:
+ aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST));
+ break;
+ case SID_ATTR_PARA_ADJUST_RIGHT:
+ aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_RIGHT, EE_PARA_JUST));
+ break;
+ case SID_ATTR_PARA_ADJUST_BLOCK:
+ aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST));
+ break;
+
+ case SID_ATTR_PARA_LINESPACE_10:
+ {
+ SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_LINE, EE_PARA_SBL);
+ aItem.SetPropLineSpace(100);
+ aNewAttr.Put(aItem);
+ }
+ break;
+ case SID_ATTR_PARA_LINESPACE_15:
+ {
+ SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_POINT_FIVE_LINES, EE_PARA_SBL);
+ aItem.SetPropLineSpace(150);
+ aNewAttr.Put(aItem);
+ }
+ break;
+ case SID_ATTR_PARA_LINESPACE_20:
+ {
+ SvxLineSpacingItem aItem(SVX_LINESPACE_TWO_LINES, EE_PARA_SBL);
+ aItem.SetPropLineSpace(200);
+ aNewAttr.Put(aItem);
+ }
+ break;
+ case SID_SELECTALL:
+ {
+ Outliner * pOutliner = pOLV->GetOutliner();
+ if(pOutliner)
+ {
+ ULONG nParaCount = pOutliner->GetParagraphCount();
+ if (nParaCount > 0)
+ pOLV->SelectRange(0L, USHORT(nParaCount) );
+ }
+ break;
+ }
+ case FN_FORMAT_RESET:
+ {
+ pPostItMgr->GetActiveSidebarWin()->ResetAttributes();
+ rReq.Done();
+ break;
+ }
+ case FN_SET_SUPER_SCRIPT:
+ {
+ SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
+ SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
+ aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+
+ if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
+ aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
+ else
+ aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
+ aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
+ }
+ break;
+ case FN_SET_SUB_SCRIPT:
+ {
+ SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
+ SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
+ aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+
+ if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
+ aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
+ else
+ aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
+ aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
+ }
+ break;
+ case SID_HYPERLINK_SETLINK:
+ {
+ const SfxPoolItem* pItem = 0;
+ if(pNewAttrs)
+ pNewAttrs->GetItemState(nSlot, sal_False, &pItem);
+
+ if(pItem)
+ {
+ const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem;
+ SvxURLField aFld(rHLinkItem.GetURL(), rHLinkItem.GetName(), SVXURLFORMAT_APPDEFAULT);
+ aFld.SetTargetFrame(rHLinkItem.GetTargetFrame());
+
+ const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
+
+ if (pFieldItem && pFieldItem->GetField()->ISA(SvxURLField))
+ {
+ // Feld selektieren, so dass es beim Insert geloescht wird
+ ESelection aSel = pOLV->GetSelection();
+ aSel.nEndPos++;
+ pOLV->SetSelection(aSel);
+ }
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
+ pOLV->InsertField(SvxFieldItem(aFld, EE_FEATURE_FIELD));
+ }
+ break;
+ }
+ case FN_INSERT_SOFT_HYPHEN:
+ case FN_INSERT_HARDHYPHEN:
+ case FN_INSERT_HARD_SPACE:
+ case SID_INSERT_RLM :
+ case SID_INSERT_LRM :
+ case SID_INSERT_ZWNBSP :
+ case SID_INSERT_ZWSP:
+ {
+ sal_Unicode cIns = 0;
+ switch(rReq.GetSlot())
+ {
+ case FN_INSERT_SOFT_HYPHEN: cIns = CHAR_SOFTHYPHEN; break;
+ case FN_INSERT_HARDHYPHEN: cIns = CHAR_HARDHYPHEN; break;
+ case FN_INSERT_HARD_SPACE: cIns = CHAR_HARDBLANK; break;
+ case SID_INSERT_RLM : cIns = CHAR_RLM ; break;
+ case SID_INSERT_LRM : cIns = CHAR_LRM ; break;
+ case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break;
+ case SID_INSERT_ZWNBSP: cIns = CHAR_ZWNBSP; break;
+ }
+ pOLV->InsertText( String(cIns));
+ rReq.Done();
+ break;
+ }
+ case SID_CHARMAP:
+ {
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
+ InsertSymbol(rReq);
+ break;
+ }
+ case FN_INSERT_STRING:
+ {
+ const SfxPoolItem* pItem = 0;
+ if(pNewAttrs)
+ pNewAttrs->GetItemState(nSlot, FALSE, &pItem );
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
+ pOLV->InsertText(((const SfxStringItem *)pItem)->GetValue());
+ break;
+ }
+
+ case FN_FORMAT_FOOTNOTE_DLG:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( rView.GetWindow(), rView.GetWrtShell(), DLG_DOC_FOOTNOTE );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ break;
+ }
+ case FN_NUMBERING_OUTLINE_DLG:
+ {
+ SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
+ rView.GetWindow(), &aTmp, rView.GetWrtShell());
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ rReq.Done();
+ }
+ break;
+ case SID_OPEN_XML_FILTERSETTINGS:
+ {
+ try
+ {
+ uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY);
+ if( xDialog.is() )
+ {
+ xDialog->execute();
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ rReq.Ignore ();
+ }
+ break;
+ case FN_WORDCOUNT_DIALOG:
+ {
+ SwWrtShell &rSh = rView.GetWrtShell();
+ SwDocStat aCurr;
+ SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() );
+ {
+ SwWait aWait( *rView.GetDocShell(), TRUE );
+ rSh.StartAction();
+ rSh.CountWords( aCurr );
+ rSh.UpdateDocStat( aDocStat );
+ rSh.EndAction();
+ }
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( rView.GetWindow() );
+ pDialog->SetValues(aCurr, aDocStat );
+ pDialog->Execute();
+ delete pDialog;
+ }
+ break;
+ case SID_CHAR_DLG:
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ /* mod
+ SwView* pView = &GetView();
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric));
+ */
+ SfxItemSet aDlgAttr(GetPool(), EE_ITEMS_START, EE_ITEMS_END);
+
+ // util::Language gibts an der EditEngine nicht! Daher nicht im Set.
+
+ aDlgAttr.Put( aEditAttr );
+ aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) );
+
+ //CHINA001 SwCharDlg* pDlg = new SwCharDlg(pView->GetWindow(), *pView, aDlgAttr, 0, sal_True);
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();//CHINA001
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");//CHINA001
+
+ SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( rView.GetWindow(), rView, aDlgAttr, DLG_CHAR,0, sal_True );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ USHORT nRet = pDlg->Execute();
+ if(RET_OK == nRet )
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+ aNewAttr.Put(*pDlg->GetOutputItemSet());
+ }
+ delete( pDlg );
+ if(RET_OK != nRet)
+ return ;
+ }
+ else
+ aNewAttr.Put(*pArgs);
+ break;
+ }
+ case SID_PARA_DLG:
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if (!pArgs)
+ {
+ /* mod todo ???
+ SwView* pView = &GetView();
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric));
+ */
+ SfxItemSet aDlgAttr(GetPool(),
+ EE_ITEMS_START, EE_ITEMS_END,
+ SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
+ SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
+ SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
+ SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
+ 0);
+
+ aDlgAttr.Put(aEditAttr);
+
+
+ aDlgAttr.Put( SvxHyphenZoneItem( sal_False, RES_PARATR_HYPHENZONE) );
+ aDlgAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK ) );
+ aDlgAttr.Put( SvxFmtSplitItem( sal_True, RES_PARATR_SPLIT ) );
+ aDlgAttr.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
+ aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
+
+ //CHINA001 SwParaDlg* pDlg = new SwParaDlg(GetView().GetWindow(), GetView(), aDlgAttr, DLG_STD, 0, sal_True);
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();//CHINA001
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");//CHINA001
+
+ SfxAbstractTabDialog* pDlg = pFact->CreateSwParaDlg( rView.GetWindow(), rView, aDlgAttr,DLG_STD, DLG_PARA, 0, sal_True );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
+ USHORT nRet = pDlg->Execute();
+ if(RET_OK == nRet)
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+ aNewAttr.Put(*pDlg->GetOutputItemSet());
+ }
+ delete( pDlg );
+ if(RET_OK != nRet)
+ return;
+ }
+ else
+ aNewAttr.Put(*pArgs);
+ break;
+ }
+
+ case SID_AUTOSPELL_CHECK:
+ {
+ rView.ExecuteSlot(rReq);
+ break;
+ }
+ case SID_ATTR_PARA_LEFT_TO_RIGHT:
+ case SID_ATTR_PARA_RIGHT_TO_LEFT:
+ {
+ sal_Bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
+
+ const SfxPoolItem* pPoolItem;
+ if( pNewAttrs && SFX_ITEM_SET == pNewAttrs->GetItemState( nSlot, TRUE, &pPoolItem ) )
+ {
+ if( !( (SfxBoolItem*)pPoolItem)->GetValue() )
+ bLeftToRight = !bLeftToRight;
+ }
+ SfxItemSet aAttr( *aNewAttr.GetPool(),
+ EE_PARA_JUST, EE_PARA_JUST,
+ EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
+ 0 );
+
+ USHORT nAdjust = SVX_ADJUST_LEFT;
+ if( SFX_ITEM_ON == aEditAttr.GetItemState(EE_PARA_JUST, TRUE, &pPoolItem ) )
+ nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue();
+
+ if( bLeftToRight )
+ {
+ aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
+ if( nAdjust == SVX_ADJUST_RIGHT )
+ aAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
+ }
+ else
+ {
+ aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) );
+ if( nAdjust == SVX_ADJUST_LEFT )
+ aAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
+ }
+ pOLV->SetAttribs(aAttr);
+ break;
+ }
+ }
+
+ if(nEEWhich && pNewAttrs)
+ aNewAttr.Put(pNewAttrs->Get(nWhich), nEEWhich);
+
+ Rectangle aNullRect;
+ Rectangle aOutRect = pOLV->GetOutputArea();
+ if (aNullRect != aOutRect)
+ pOLV->SetAttribs(aNewAttr);
+
+ rView.GetViewFrame()->GetBindings().InvalidateAll(sal_False);
+ if ( pOLV->GetOutliner()->IsModified() )
+ rView.GetWrtShell().SetModified();
+
+}
+
+void SwAnnotationShell::GetState(SfxItemSet& rSet)
+{
+ //TODO: clean this up!!!
+ // FN_SET_SUPER_SCRIPT
+ //SID_ATTR_PARA_ADJUST
+ //SID_ATTR_PARA_ADJUST_BLOCK
+
+ SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
+ return;
+
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
+ SfxItemSet aEditAttr(pOLV->GetAttribs());
+
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ while(nWhich)
+ {
+ sal_uInt16 nEEWhich = 0;
+ USHORT nSlotId = GetPool().GetSlotId( nWhich );
+ switch( nSlotId )
+ {
+ case SID_ATTR_CHAR_FONT:
+ case SID_ATTR_CHAR_FONTHEIGHT:
+ case SID_ATTR_CHAR_WEIGHT:
+ case SID_ATTR_CHAR_POSTURE:
+ {
+ if ( pOLV )
+ {
+ USHORT nScriptType = pOLV->GetSelectedScriptType();
+ SfxItemPool* pSecondPool = aEditAttr.GetPool()->GetSecondaryPool();
+ if( !pSecondPool )
+ pSecondPool = aEditAttr.GetPool();
+ SvxScriptSetItem aSetItem( nSlotId, *pSecondPool );
+ aSetItem.GetItemSet().Put( aEditAttr, FALSE );
+ const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
+ if( pI )
+ rSet.Put( *pI, nWhich );
+ else
+ rSet.InvalidateItem( nWhich );
+ }
+ else
+ rSet.InvalidateItem( nWhich );
+ }
+ break;
+ case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
+ case SID_ATTR_CHAR_UNDERLINE: nEEWhich = EE_CHAR_UNDERLINE;break;
+ case SID_ATTR_CHAR_OVERLINE: nEEWhich = EE_CHAR_OVERLINE;break;
+ case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
+ case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW;break;
+ case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break;
+ case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
+ case FN_SET_SUPER_SCRIPT:
+ case FN_SET_SUB_SCRIPT:
+ {
+ USHORT nEsc = 0;
+ const SfxPoolItem *pEscItem = 0;
+ if (nWhich==FN_SET_SUPER_SCRIPT)
+ nEsc = SVX_ESCAPEMENT_SUPERSCRIPT;
+ else
+ nEsc = SVX_ESCAPEMENT_SUBSCRIPT;
+
+ if( !pEscItem )
+ pEscItem = &aEditAttr.Get( EE_CHAR_ESCAPEMENT );
+
+ if( nEsc == ((const SvxEscapementItem*)pEscItem)->GetEnumValue() )
+ rSet.Put( SfxBoolItem( nWhich, sal_True ));
+ else
+ rSet.InvalidateItem( nWhich );
+ break;
+ }
+ case SID_ATTR_PARA_ADJUST_LEFT:
+ case SID_ATTR_PARA_ADJUST_RIGHT:
+ case SID_ATTR_PARA_ADJUST_CENTER:
+ case SID_ATTR_PARA_ADJUST_BLOCK:
+ {
+ const SfxPoolItem *pAdjust = 0;
+ int eAdjust = 0;
+
+ if (nWhich==SID_ATTR_PARA_ADJUST_LEFT)
+ eAdjust = SVX_ADJUST_LEFT;
+ else
+ if (nWhich==SID_ATTR_PARA_ADJUST_RIGHT)
+ eAdjust = SVX_ADJUST_RIGHT;
+ else
+ if (nWhich==SID_ATTR_PARA_ADJUST_CENTER)
+ eAdjust = SVX_ADJUST_CENTER;
+ else
+ if (nWhich==SID_ATTR_PARA_ADJUST_BLOCK)
+ eAdjust = SVX_ADJUST_BLOCK;
+
+ if( !pAdjust )
+ aEditAttr.GetItemState( EE_PARA_JUST, sal_False, &pAdjust);
+
+ if( !pAdjust || IsInvalidItem( pAdjust ))
+ rSet.InvalidateItem( nSlotId ), nSlotId = 0;
+ else
+ {
+ if ( eAdjust == ((const SvxAdjustItem*)pAdjust)->GetAdjust())
+ rSet.Put( SfxBoolItem( nWhich, sal_True ));
+ else
+ rSet.InvalidateItem( nWhich );
+ }
+ break;
+ }
+ case SID_ATTR_PARA_LINESPACE_10:
+ case SID_ATTR_PARA_LINESPACE_15:
+ case SID_ATTR_PARA_LINESPACE_20:
+ {
+ const SfxPoolItem *pLSpace = 0;
+ int nLSpace = 0;
+
+ if (nWhich==SID_ATTR_PARA_LINESPACE_10)
+ nLSpace = 100;
+ else
+ if (nWhich==SID_ATTR_PARA_LINESPACE_15)
+ nLSpace = 150;
+ else
+ if (nWhich==SID_ATTR_PARA_LINESPACE_20)
+ nLSpace = 200;
+
+ if( !pLSpace )
+ aEditAttr.GetItemState( EE_PARA_SBL, sal_False, &pLSpace );
+
+ if( !pLSpace || IsInvalidItem( pLSpace ))
+ rSet.InvalidateItem( nSlotId ), nSlotId = 0;
+ else
+ {
+ if( nLSpace == ((const SvxLineSpacingItem*)pLSpace)->GetPropLineSpace() )
+ rSet.Put( SfxBoolItem( nWhich, sal_True ));
+ else
+ rSet.InvalidateItem( nWhich );
+ }
+ break;
+ }
+ case SID_AUTOSPELL_CHECK:
+ {
+ const SfxPoolItem* pState = rView.GetSlotState(nWhich);
+ if (pState)
+ rSet.Put(SfxBoolItem(nWhich, ((const SfxBoolItem*)pState)->GetValue()));
+ else
+ rSet.DisableItem( nWhich );
+ break;
+ }
+ case SID_ATTR_PARA_LEFT_TO_RIGHT:
+ case SID_ATTR_PARA_RIGHT_TO_LEFT:
+ {
+ if ( !SvtLanguageOptions().IsCTLFontEnabled() )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ if(pOLV->GetOutliner() && pOLV->GetOutliner()->IsVertical())
+ rSet.DisableItem( nWhich );
+ else
+ {
+ BOOL bFlag = FALSE;
+ switch( ( ( (SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() )
+ {
+ case FRMDIR_HORI_LEFT_TOP:
+ {
+ bFlag = nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT;
+ rSet.Put( SfxBoolItem( nWhich, bFlag ));
+ break;
+ }
+ case FRMDIR_HORI_RIGHT_TOP:
+ {
+ bFlag = nWhich != SID_ATTR_PARA_LEFT_TO_RIGHT;
+ rSet.Put( SfxBoolItem( nWhich, bFlag ));
+ break;
+ }
+ }
+ }
+ }
+ }
+ break;
+ case SID_INSERT_RLM :
+ case SID_INSERT_LRM :
+ case SID_INSERT_ZWNBSP :
+ case SID_INSERT_ZWSP:
+ {
+ SvtCTLOptions aCTLOptions;
+ sal_Bool bEnabled = aCTLOptions.IsCTLFontEnabled();
+ rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled );
+ if(!bEnabled)
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ default:
+ rSet.InvalidateItem( nWhich );
+ break;
+ }
+
+ if(nEEWhich)
+ rSet.Put(aEditAttr.Get(nEEWhich, sal_True), nWhich);
+
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
+ rSet.DisableItem( nWhich );
+
+ nWhich = aIter.NextWhich();
+ }
+}
+
+void SwAnnotationShell::ExecSearch(SfxRequest& rReq, BOOL bNoMessage)
+{
+ rView.ExecSearch(rReq,bNoMessage);
+}
+
+void SwAnnotationShell::StateSearch(SfxItemSet &rSet)
+{
+ rView.StateSearch(rSet);
+}
+
+void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq)
+{
+ SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
+ return;
+
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
+ SfxItemSet aEditAttr(pOLV->GetAttribs());
+ SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
+
+ long aOldHeight = pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight();
+ sal_uInt16 nSlot = rReq.GetSlot();
+ switch (nSlot)
+ {
+ case SID_CUT:
+ if ( (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) && pOLV->HasSelection() )
+ pOLV->Cut();
+ break;
+ case SID_COPY:
+ if( pOLV->HasSelection() )
+ pOLV->Copy();
+ break;
+ case SID_PASTE:
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
+ pOLV->Paste();
+ break;
+ case SID_PASTE_SPECIAL:
+ {
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( &rView.GetEditWin() );
+
+ pDlg->Insert( SOT_FORMAT_STRING, aEmptyStr );
+ pDlg->Insert( SOT_FORMAT_RTF, aEmptyStr );
+
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &rView.GetEditWin() ) );
+
+ ULONG nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
+
+ if (nFormat > 0)
+ {
+ if (nFormat == SOT_FORMAT_STRING)
+ pOLV->Paste();
+ else
+ pOLV->PasteSpecial();
+ }
+ delete pDlg;
+ }
+ break;
+ }
+ case SID_CLIPBOARD_FORMAT_ITEMS:
+ {
+ ULONG nFormat = 0;
+ const SfxPoolItem* pItem;
+ if ( rReq.GetArgs() && rReq.GetArgs()->GetItemState(nSlot, TRUE, &pItem) == SFX_ITEM_SET &&
+ pItem->ISA(SfxUInt32Item) )
+ {
+ nFormat = ((const SfxUInt32Item*)pItem)->GetValue();
+ }
+
+ if ( nFormat )
+ {
+ if (SOT_FORMAT_STRING == nFormat)
+ pOLV->Paste();
+ else
+ pOLV->PasteSpecial();
+ }
+ break;
+ }
+ }
+ pPostItMgr->GetActiveSidebarWin()->ResizeIfNeccessary(aOldHeight,pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight());
+}
+
+void SwAnnotationShell::StateClpbrd(SfxItemSet &rSet)
+{
+ SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
+ return;
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
+
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &rView.GetEditWin() ) );
+ bool bPastePossible = ( aDataHelper.HasFormat( SOT_FORMAT_STRING ) || aDataHelper.HasFormat( SOT_FORMAT_RTF ) );
+ bPastePossible = bPastePossible && (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED);
+
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while(nWhich)
+ {
+ switch(nWhich)
+ {
+ case SID_CUT:
+ {
+ if ( (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED) || !pOLV->HasSelection() )
+ rSet.DisableItem( nWhich );
+ }
+ case SID_COPY:
+ {
+ if( !pOLV->HasSelection() )
+ rSet.DisableItem( nWhich );
+ break;
+ }
+ case SID_PASTE:
+ case SID_PASTE_SPECIAL:
+ {
+ if( !bPastePossible )
+ rSet.DisableItem( nWhich );
+ break;
+ }
+ case SID_CLIPBOARD_FORMAT_ITEMS:
+ {
+ if ( bPastePossible )
+ {
+ SvxClipboardFmtItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS );
+ if ( aDataHelper.HasFormat( SOT_FORMAT_RTF ) )
+ aFormats.AddClipbrdFormat( SOT_FORMAT_RTF );
+ //if ( aDataHelper.HasFormat( SOT_FORMAT_STRING ) )
+ aFormats.AddClipbrdFormat( SOT_FORMAT_STRING );
+ rSet.Put( aFormats );
+ }
+ else
+ rSet.DisableItem( nWhich );
+ break;
+ }
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+void SwAnnotationShell::StateStatusLine(SfxItemSet &rSet)
+{
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+
+ while( nWhich )
+ {
+ switch( nWhich )
+ {
+ case FN_STAT_SELMODE:
+ {
+ rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 0));
+ rSet.DisableItem( nWhich );
+ break;
+ }
+ case FN_STAT_TEMPLATE:
+ {
+ rSet.DisableItem( nWhich );
+ break;
+ }
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+void SwAnnotationShell::StateInsert(SfxItemSet &rSet)
+{
+ SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
+ return;
+
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while(nWhich)
+ {
+ switch(nWhich)
+ {
+ case SID_HYPERLINK_GETLINK:
+ {
+ SvxHyperlinkItem aHLinkItem;
+ aHLinkItem.SetInsertMode(HLINK_FIELD);
+
+ const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
+
+ if (pFieldItem)
+ {
+ const SvxFieldData* pField = pFieldItem->GetField();
+
+ if (pField->ISA(SvxURLField))
+ {
+ aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
+ aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
+ aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
+ }
+ }
+ else
+ {
+ String sSel(pOLV->GetSelected());
+ sSel.Erase(255);
+ sSel.EraseTrailingChars();
+ aHLinkItem.SetName(sSel);
+ }
+
+ sal_uInt16 nHtmlMode = ::GetHtmlMode(rView.GetDocShell());
+ aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
+ ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
+
+ rSet.Put(aHLinkItem);
+ }
+ break;
+ }
+
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
+ rSet.DisableItem( nWhich );
+
+ nWhich = aIter.NextWhich();
+ }
+}
+
+
+void SwAnnotationShell::NoteExec(SfxRequest &rReq)
+{
+ SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
+ if ( !pPostItMgr )
+ return;
+
+ sal_uInt16 nSlot = rReq.GetSlot();
+ switch (nSlot)
+ {
+ case FN_REPLY:
+ case FN_POSTIT:
+ case FN_DELETE_COMMENT:
+ if ( pPostItMgr->HasActiveSidebarWin() )
+ pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot);
+ break;
+ case FN_DELETE_ALL_NOTES:
+ pPostItMgr->Delete();
+ break;
+ case FN_DELETE_NOTE_AUTHOR:
+ {
+ SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, nSlot, FALSE);
+ if ( pItem )
+ pPostItMgr->Delete( pItem->GetValue() );
+ break;
+ }
+ case FN_HIDE_NOTE:
+ /*
+ if ( Mgr()->GetActiveSidebarWin() == this )
+ {
+ Mgr()->SetActivePostIt(0);
+ // put the cursor back into the document
+ SwitchToFieldPos();
+ }
+ Mgr()->Hide(mpFld);
+ */
+ break;
+ case FN_HIDE_ALL_NOTES:
+ pPostItMgr->Hide();
+ break;
+ case FN_HIDE_NOTE_AUTHOR:
+ {
+ SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, nSlot, FALSE);
+ if ( pItem )
+ pPostItMgr->Hide( pItem->GetValue() );
+ }
+ }
+}
+
+void SwAnnotationShell::GetNoteState(SfxItemSet &rSet)
+{
+ SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ while(nWhich)
+ {
+ USHORT nSlotId = GetPool().GetSlotId( nWhich );
+ switch( nSlotId )
+ {
+ case FN_POSTIT:
+ case FN_DELETE_NOTE_AUTHOR:
+ case FN_DELETE_ALL_NOTES:
+ case FN_HIDE_NOTE:
+ case FN_HIDE_NOTE_AUTHOR:
+ case FN_HIDE_ALL_NOTES:
+ case FN_DELETE_COMMENT:
+ {
+ if ( !pPostItMgr ||
+ !pPostItMgr->HasActiveAnnotationWin() )
+ {
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ }
+ case FN_REPLY:
+ {
+ if ( !pPostItMgr ||
+ !pPostItMgr->HasActiveAnnotationWin() )
+ {
+ rSet.DisableItem(nWhich);
+ }
+ else
+ {
+ SvtUserOptions aUserOpt;
+ String sAuthor;
+ if( !(sAuthor = aUserOpt.GetFullName()).Len())
+ if( !(sAuthor = aUserOpt.GetID()).Len() )
+ sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
+ if (sAuthor == pPostItMgr->GetActiveSidebarWin()->GetAuthor())
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ }
+ default:
+ rSet.InvalidateItem( nWhich );
+ break;
+ }
+
+ if (pPostItMgr->HasActiveSidebarWin())
+ {
+ if ( (pPostItMgr->GetActiveSidebarWin()->IsProtected()) &&
+ ( (nSlotId==FN_DELETE_COMMENT) || (nSlotId==FN_REPLY) ) )
+ rSet.DisableItem( nWhich );
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+void SwAnnotationShell::ExecLingu(SfxRequest &rReq)
+{
+ SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
+ return;
+
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
+ SfxItemSet aEditAttr(pOLV->GetAttribs());
+ sal_uInt16 nSlot = rReq.GetSlot();
+ SwWrtShell &rSh = rView.GetWrtShell();
+ bool bRestoreSelection = false;
+ ESelection aOldSelection;
+
+ switch (nSlot)
+ {
+ case SID_LANGUAGE_STATUS:
+ {
+ aOldSelection = pOLV->GetSelection();
+ if (!pOLV->GetEditView().HasSelection())
+ {
+ bRestoreSelection = true;
+ pOLV->GetEditView().SelectCurrentWord();
+ }
+
+ bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,rView,rSh);
+ break;
+ }
+ case SID_THES:
+ {
+ String aReplaceText;
+ SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False );
+ if (pItem2)
+ aReplaceText = pItem2->GetValue();
+ if (aReplaceText.Len() > 0)
+ ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
+ break;
+ }
+ case SID_THESAURUS:
+ {
+ pOLV->StartThesaurus();
+ break;
+ }
+ case SID_HANGUL_HANJA_CONVERSION:
+ pOLV->StartTextConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL,
+ i18n::TextConversionOption::CHARACTER_BY_CHARACTER, sal_True, sal_False );
+ break;
+
+ case SID_CHINESE_CONVERSION:
+ {
+ //open ChineseTranslationDialog
+ Reference< XComponentContext > xContext(
+ ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
+ if(xContext.is())
+ {
+ Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
+ if(xMCF.is())
+ {
+ Reference< ui::dialogs::XExecutableDialog > xDialog(
+ xMCF->createInstanceWithContext(
+ rtl::OUString::createFromAscii("com.sun.star.linguistic2.ChineseTranslationDialog")
+ , xContext), UNO_QUERY);
+ Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY );
+ if( xInit.is() )
+ {
+ // initialize dialog
+ Reference< awt::XWindow > xDialogParentWindow(0);
+ Sequence<Any> aSeq(1);
+ Any* pArray = aSeq.getArray();
+ PropertyValue aParam;
+ aParam.Name = rtl::OUString::createFromAscii("ParentWindow");
+ aParam.Value <<= makeAny(xDialogParentWindow);
+ pArray[0] <<= makeAny(aParam);
+ xInit->initialize( aSeq );
+
+ //execute dialog
+ sal_Int16 nDialogRet = xDialog->execute();
+ if( RET_OK == nDialogRet )
+ {
+ //get some parameters from the dialog
+ sal_Bool bToSimplified = sal_True;
+ sal_Bool bUseVariants = sal_True;
+ sal_Bool bCommonTerms = sal_True;
+ Reference< beans::XPropertySet > xProp( xDialog, UNO_QUERY );
+ if( xProp.is() )
+ {
+ try
+ {
+ xProp->getPropertyValue( C2U("IsDirectionToSimplified") ) >>= bToSimplified;
+ xProp->getPropertyValue( C2U("IsUseCharacterVariants") ) >>= bUseVariants;
+ xProp->getPropertyValue( C2U("IsTranslateCommonTerms") ) >>= bCommonTerms;
+ }
+ catch( Exception& )
+ {
+ }
+ }
+
+ //execute translation
+ sal_Int16 nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
+ sal_Int16 nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
+ sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
+ if( !bCommonTerms )
+ nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
+
+ Font aTargetFont = pOLV->GetWindow()->GetDefaultFont( DEFAULTFONT_CJK_TEXT,
+ nTargetLang, DEFAULTFONT_FLAGS_ONLYONE );
+
+ pOLV->StartTextConversion( nSourceLang, nTargetLang, &aTargetFont, nOptions, sal_False, sal_False );
+ }
+ }
+ Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY );
+ if( xComponent.is() )
+ xComponent->dispose();
+ }
+ }
+ }
+ break;
+ }
+
+ if (bRestoreSelection)
+ {
+ // restore selection
+ pOLV->GetEditView().SetSelection( aOldSelection );
+ }
+}
+
+void SwAnnotationShell::GetLinguState(SfxItemSet &rSet)
+{
+ SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
+ return;
+
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
+ SfxItemSet aEditAttr(pOLV->GetAttribs());
+
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ while(nWhich)
+ {
+ switch (nWhich)
+ {
+ case SID_LANGUAGE_STATUS:
+ {
+ SwLangHelper::GetLanguageStatus(pOLV,rSet);
+ break;
+ }
+
+ case SID_THES:
+ {
+ String aStatusVal;
+ LanguageType nLang = LANGUAGE_NONE;
+ bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() );
+ rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
+
+ // disable "Thesaurus" context menu entry if there is nothing to look up
+ uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
+ lang::Locale aLocale( SvxCreateLocale( nLang ) );
+ if (!bIsLookUpWord ||
+ !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale ))
+ rSet.DisableItem( SID_THES );
+ break;
+ }
+
+ // disable "Thesaurus" if the language is not supported
+ case SID_THESAURUS:
+ {
+ const SfxPoolItem &rItem = rView.GetWrtShell().GetDoc()->GetDefault(
+ GetWhichOfScript( RES_CHRATR_LANGUAGE,
+ GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage())) );
+ LanguageType nLang = ((const SvxLanguageItem &)
+ rItem).GetLanguage();
+ uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
+ if (!xThes.is() || nLang == LANGUAGE_NONE ||
+ !xThes->hasLocale( SvxCreateLocale( nLang ) ))
+ rSet.DisableItem( SID_THESAURUS );
+ }
+ break;
+ case SID_HANGUL_HANJA_CONVERSION:
+ case SID_CHINESE_CONVERSION:
+ {
+ if (!SvtCJKOptions().IsAnyEnabled())
+ {
+ rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
+ rSet.DisableItem(nWhich);
+ }
+ else
+ rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
+ }
+ break;
+ }
+
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
+ rSet.DisableItem( nWhich );
+
+ nWhich = aIter.NextWhich();
+ }
+}
+
+void SwAnnotationShell::ExecTransliteration(SfxRequest &rReq)
+{
+ SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
+ return;
+
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
+
+ using namespace ::com::sun::star::i18n;
+ {
+ sal_uInt32 nMode = 0;
+
+ switch( rReq.GetSlot() )
+ {
+ case SID_TRANSLITERATE_SENTENCE_CASE:
+ nMode = TransliterationModulesExtra::SENTENCE_CASE;
+ break;
+ case SID_TRANSLITERATE_TITLE_CASE:
+ nMode = TransliterationModulesExtra::TITLE_CASE;
+ break;
+ case SID_TRANSLITERATE_TOGGLE_CASE:
+ nMode = TransliterationModulesExtra::TOGGLE_CASE;
+ break;
+ case SID_TRANSLITERATE_UPPER:
+ nMode = TransliterationModules_LOWERCASE_UPPERCASE;
+ break;
+ case SID_TRANSLITERATE_LOWER:
+ nMode = TransliterationModules_UPPERCASE_LOWERCASE;
+ break;
+ case SID_TRANSLITERATE_HALFWIDTH:
+ nMode = TransliterationModules_FULLWIDTH_HALFWIDTH;
+ break;
+ case SID_TRANSLITERATE_FULLWIDTH:
+ nMode = TransliterationModules_HALFWIDTH_FULLWIDTH;
+ break;
+ case SID_TRANSLITERATE_HIRAGANA:
+ nMode = TransliterationModules_KATAKANA_HIRAGANA;
+ break;
+ case SID_TRANSLITERATE_KATAGANA:
+ nMode = TransliterationModules_HIRAGANA_KATAKANA;
+ break;
+
+ default:
+ ASSERT(!this, "falscher Dispatcher");
+ }
+
+ if( nMode )
+ {
+ pOLV->TransliterateText( nMode );
+ }
+ }
+}
+
+void SwAnnotationShell::ExecUndo(SfxRequest &rReq)
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ ::svl::IUndoManager* pUndoManager = GetUndoManager();
+ SwWrtShell &rSh = rView.GetWrtShell();
+
+ long aOldHeight = rView.GetPostItMgr()->HasActiveSidebarWin()
+ ? rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight()
+ : 0;
+
+ USHORT nId = rReq.GetSlot();
+ sal_uInt16 nCnt = 1;
+ const SfxPoolItem* pItem=0;
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, FALSE, &pItem ) )
+ nCnt = ((SfxUInt16Item*)pItem)->GetValue();
+ switch( nId )
+ {
+ case SID_UNDO:
+ {
+ if ( pUndoManager )
+ {
+ sal_uInt16 nCount = pUndoManager->GetUndoActionCount();
+ sal_uInt16 nSteps = nCnt;
+ if ( nCount < nCnt )
+ {
+ nCnt = nCnt - nCount;
+ nSteps = nCount;
+ }
+ else
+ nCnt = 0;
+
+ while( nSteps-- )
+ pUndoManager->Undo();
+ }
+
+ if ( nCnt )
+ rSh.Do( SwWrtShell::UNDO, nCnt );
+
+ break;
+ }
+
+ case SID_REDO:
+ {
+ if ( pUndoManager )
+ {
+ sal_uInt16 nCount = pUndoManager->GetRedoActionCount();
+ sal_uInt16 nSteps = nCnt;
+ if ( nCount < nCnt )
+ {
+ nCnt = nCnt - nCount;
+ nSteps = nCount;
+ }
+ else
+ nCnt = 0;
+
+ while( nSteps-- )
+ pUndoManager->Redo();
+ }
+
+ if ( nCnt )
+ rSh.Do( SwWrtShell::REDO, nCnt );
+
+ break;
+ }
+ }
+
+ rView.GetViewFrame()->GetBindings().InvalidateAll(sal_False);
+
+ if (rView.GetPostItMgr()->HasActiveSidebarWin())
+ rView.GetPostItMgr()->GetActiveSidebarWin()->ResizeIfNeccessary(aOldHeight,rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight());
+}
+
+void SwAnnotationShell::StateUndo(SfxItemSet &rSet)
+{
+ SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
+ return;
+
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+ ::svl::IUndoManager* pUndoManager = GetUndoManager();
+ SfxViewFrame *pSfxViewFrame = rView.GetViewFrame();
+ SwWrtShell &rSh = rView.GetWrtShell();
+
+ while( nWhich )
+ {
+ switch ( nWhich )
+ {
+ case SID_UNDO:
+ {
+ sal_uInt16 nCount = pUndoManager->GetUndoActionCount();
+ if ( nCount )
+ pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet );
+ else if (rSh.GetLastUndoInfo(0, 0))
+ {
+ rSet.Put( SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::UNDO)) );
+ }
+ else
+ rSet.DisableItem(nWhich);
+ break;
+ }
+ case SID_REDO:
+ {
+ sal_uInt16 nCount = pUndoManager->GetRedoActionCount();
+ if ( nCount )
+ pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet );
+ else if (rSh.GetFirstRedoInfo(0))
+ {
+ rSet.Put(SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::REDO)) );
+ }
+ else
+ rSet.DisableItem(nWhich);
+ break;
+ }
+ case SID_GETUNDOSTRINGS:
+ case SID_GETREDOSTRINGS:
+ {
+ if( pUndoManager )
+ {
+ UniString (::svl::IUndoManager:: *fnGetComment)( size_t, bool const ) const;
+
+ sal_uInt16 nCount;
+ if( SID_GETUNDOSTRINGS == nWhich )
+ {
+ nCount = pUndoManager->GetUndoActionCount();
+ fnGetComment = &::svl::IUndoManager::GetUndoActionComment;
+ }
+ else
+ {
+ nCount = pUndoManager->GetRedoActionCount();
+ fnGetComment = &::svl::IUndoManager::GetRedoActionComment;
+ }
+
+ String sList;
+ if( nCount )
+ {
+ for( sal_uInt16 n = 0; n < nCount; ++n )
+ ( sList += (pUndoManager->*fnGetComment)( n, ::svl::IUndoManager::TopLevel ) )
+ += '\n';
+ }
+
+ SfxStringListItem aItem( nWhich );
+ if ((nWhich == SID_GETUNDOSTRINGS) &&
+ rSh.GetLastUndoInfo(0, 0))
+ {
+ rSh.GetDoStrings( SwWrtShell::UNDO, aItem );
+ }
+ else if ((nWhich == SID_GETREDOSTRINGS) &&
+ (rSh.GetFirstRedoInfo(0)))
+ {
+ rSh.GetDoStrings( SwWrtShell::UNDO, aItem );
+ }
+
+ sList += aItem.GetString();
+ aItem.SetString( sList );
+ rSet.Put( aItem );
+ }
+ else
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ default:
+ {
+ pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet );
+ break;
+ }
+
+ }
+
+ if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
+ rSet.DisableItem( nWhich );
+
+ nWhich = aIter.NextWhich();
+ }
+}
+
+void SwAnnotationShell::StateDisableItems( SfxItemSet &rSet )
+{
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+ while (nWhich)
+ {
+ rSet.DisableItem( nWhich );
+ nWhich = aIter.NextWhich();
+ }
+}
+
+void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
+{
+ SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
+ if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
+ return;
+
+ OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
+
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+ if( pArgs )
+ pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), FALSE, &pItem);
+
+ String sSym;
+ String sFontName;
+ if ( pItem )
+ {
+ sSym = ((const SfxStringItem*)pItem)->GetValue();
+ const SfxPoolItem* pFtItem = NULL;
+ pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), FALSE, &pFtItem);
+ const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
+ if ( pFontItem )
+ sFontName = pFontItem->GetValue();
+ }
+
+ SfxItemSet aSet(pOLV->GetAttribs());
+ USHORT nScript = pOLV->GetSelectedScriptType();
+ SvxFontItem aSetDlgFont( RES_CHRATR_FONT );
+ {
+ SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
+ aSetItem.GetItemSet().Put( aSet, FALSE );
+ const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
+ if( pI )
+ aSetDlgFont = *(SvxFontItem*)pI;
+ else
+ aSetDlgFont = (SvxFontItem&)aSet.Get( GetWhichOfScript(
+ SID_ATTR_CHAR_FONT,
+ GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ) ));
+ if (!sFontName.Len())
+ sFontName = aSetDlgFont.GetFamilyName();
+ }
+
+ Font aFont(sFontName, Size(1,1));
+ if( !sSym.Len() )
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+
+ SfxAllItemSet aAllSet( GetPool() );
+ aAllSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) );
+
+ SwViewOption aOpt(*rView.GetWrtShell().GetViewOptions());
+ String sSymbolFont = aOpt.GetSymbolFont();
+ if( sSymbolFont.Len() )
+ aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
+ else
+ aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) );
+
+ // Wenn Zeichen selektiert ist kann es angezeigt werden
+ SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet,
+ rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
+
+ USHORT nResult = pDlg->Execute();
+ if( nResult == RET_OK )
+ {
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, FALSE );
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, FALSE );
+ if ( pFontItem )
+ {
+ aFont.SetName( pFontItem->GetFamilyName() );
+ aFont.SetStyleName( pFontItem->GetStyleName() );
+ aFont.SetCharSet( pFontItem->GetCharSet() );
+ aFont.SetPitch( pFontItem->GetPitch() );
+ }
+
+ if ( pCItem )
+ {
+ sSym = pCItem->GetValue();
+ aOpt.SetSymbolFont(aFont.GetName());
+ SW_MOD()->ApplyUsrPref(aOpt, &rView);
+ }
+ }
+
+ delete( pDlg );
+ }
+
+ if( sSym.Len() )
+ {
+ // nicht flackern
+ pOLV->HideCursor();
+ Outliner * pOutliner = pOLV->GetOutliner();
+ pOutliner->SetUpdateMode(FALSE);
+
+ SfxItemSet aOldSet( pOLV->GetAttribs() );
+ SfxItemSet aFontSet( *aOldSet.GetPool(),
+ EE_CHAR_FONTINFO, EE_CHAR_FONTINFO,
+ EE_CHAR_FONTINFO_CJK, EE_CHAR_FONTINFO_CJK,
+ EE_CHAR_FONTINFO_CTL, EE_CHAR_FONTINFO_CTL,
+ 0 );
+ aFontSet.Set( aOldSet );
+
+ // String einfuegen
+ pOLV->InsertText( sSym);
+
+ // attributieren (Font setzen)
+ SfxItemSet aSetFont( *aFontSet.GetPool(), aFontSet.GetRanges() );
+ SvxFontItem aFontItem (aFont.GetFamily(), aFont.GetName(),
+ aFont.GetStyleName(), aFont.GetPitch(),
+ aFont.GetCharSet(),
+ EE_CHAR_FONTINFO );
+ USHORT nScriptBreak = pBreakIt->GetAllScriptsOfText( sSym );
+ if( SCRIPTTYPE_LATIN & nScriptBreak )
+ aSetFont.Put( aFontItem, EE_CHAR_FONTINFO );
+ if( SCRIPTTYPE_ASIAN & nScriptBreak )
+ aSetFont.Put( aFontItem, EE_CHAR_FONTINFO_CJK );
+ if( SCRIPTTYPE_COMPLEX & nScriptBreak )
+ aSetFont.Put( aFontItem, EE_CHAR_FONTINFO_CTL );
+ pOLV->SetAttribs(aSetFont);
+
+ // Selektion loeschen
+ ESelection aSel(pOLV->GetSelection());
+ aSel.nStartPara = aSel.nEndPara;
+ aSel.nStartPos = aSel.nEndPos;
+ pOLV->SetSelection(aSel);
+
+ // Alten Font restaurieren
+ pOLV->SetAttribs( aFontSet );
+
+ // ab jetzt wieder anzeigen
+ pOutliner->SetUpdateMode(TRUE);
+ pOLV->ShowCursor();
+
+ rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) );
+ if(aFont.GetName().Len())
+ rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetName() ) );
+ rReq.Done();
+ }
+}
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
new file mode 100644
index 000000000000..9b760ed1b596
--- /dev/null
+++ b/sw/source/ui/shells/basesh.cxx
@@ -0,0 +1,2937 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <sot/factory.hxx>
+#include <hintids.hxx>
+#include <svl/urihelper.hxx>
+#include <svl/languageoptions.hxx>
+
+#include <svx/svxids.hrc>
+#include <sfx2/linkmgr.hxx>
+#include <svx/htmlmode.hxx>
+#include <svx/imapdlg.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/request.hxx>
+#include <svl/whiter.hxx>
+#include <svl/visitem.hxx>
+#include <sfx2/objitem.hxx>
+#include <svtools/filter.hxx>
+#include <svx/gallery.hxx>
+#include <editeng/langitem.hxx>
+#include <svx/clipfmtitem.hxx>
+#include <svx/contdlg.hxx>
+#include <vcl/graph.hxx>
+#include <svl/slstitm.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/ptitem.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/stritem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/shaditem.hxx>
+#include <editeng/boxitem.hxx>
+#include <svl/srchitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/opaqitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <svx/flagsdef.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <sfx2/objface.hxx>
+#include <fmturl.hxx>
+#include <fmthdft.hxx>
+#include <fmtclds.hxx>
+#include <docsh.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <swmodule.hxx>
+#include <swundo.hxx>
+#include <fldbas.hxx>
+#include <uitool.hxx>
+#include <basesh.hxx>
+#include <viewopt.hxx>
+#include <fontcfg.hxx>
+#include <docstat.hxx>
+#include <usrfld.hxx>
+#include <expfld.hxx>
+#include <fldmgr.hxx>
+#include <frmmgr.hxx>
+#include <tablemgr.hxx>
+#include <mdiexp.hxx>
+#include <swdtflvr.hxx>
+#include <pagedesc.hxx>
+#include <convert.hxx>
+#include <fmtcol.hxx>
+#include <edtwin.hxx>
+#include <tblafmt.hxx>
+#include <caption.hxx>
+#include <swwait.hxx>
+#include <cmdid.h>
+#include <globals.hrc>
+#include <shells.hrc>
+#include <statstr.hrc>
+#include <globals.h>
+#include <unotxdoc.hxx>
+#include <crsskip.hxx>
+#include <fmtinfmt.hxx>
+#include <doc.hxx>
+
+#include "swabstdlg.hxx"
+#include "dialog.hrc"
+#include "fldui.hrc"
+#include "table.hrc"
+#include <modcfg.hxx>
+#include <instable.hxx>
+#include <svx/fmshell.hxx> // for FN_XFORMS_DESIGN_MODE
+#include <SwRewriter.hxx>
+#include <comcore.hrc>
+
+#include <unomid.h>
+
+FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END;
+
+
+//Fuer die Erkennung der Id, die variable von Gallery mit SID_GALLERY_BG_BRUSH
+//ankommt.
+static BYTE nParagraphPos;
+static BYTE nGraphicPos;
+static BYTE nOlePos;
+static BYTE nFramePos;
+static BYTE nTablePos;
+static BYTE nTableRowPos;
+static BYTE nTableCellPos;
+static BYTE nPagePos;
+static BYTE nHeaderPos;
+static BYTE nFooterPos;
+
+#define Interior
+#include <svx/svxslots.hxx>
+
+#define SwBaseShell
+#define Shadow
+#include <sfx2/msg.hxx>
+#include "swslots.hxx"
+
+#define SWCONTOURDLG(rView) ( (SvxContourDlg*) ( rView.GetViewFrame()->GetChildWindow( \
+ SvxContourDlgChildWindow::GetChildWindowId() )-> \
+ GetWindow() ) )
+
+#define SWIMAPDLG(rView) ( (SvxIMapDlg*) ( rView.GetViewFrame()->GetChildWindow( \
+ SvxIMapDlgChildWindow::GetChildWindowId() )-> \
+ GetWindow() ) )
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::lang;
+
+
+SFX_IMPL_INTERFACE(SwBaseShell, SfxShell, SW_RES(0))
+{
+ SFX_CHILDWINDOW_REGISTRATION(SvxIMapDlgChildWindow::GetChildWindowId());
+ SFX_CHILDWINDOW_REGISTRATION(SvxContourDlgChildWindow::GetChildWindowId());
+}
+
+TYPEINIT1(SwBaseShell,SfxShell)
+
+/*--------------------------------------------------------------------
+ Beschreibung: statics
+ --------------------------------------------------------------------*/
+
+
+void lcl_UpdateIMapDlg( SwWrtShell& rSh )
+{
+ Graphic aGrf( rSh.GetIMapGraphic() );
+ GraphicType nGrfType = aGrf.GetType();
+ void* pEditObj = GRAPHIC_NONE != nGrfType && GRAPHIC_DEFAULT != nGrfType
+ ? rSh.GetIMapInventor() : 0;
+ TargetList* pList = new TargetList;
+ rSh.GetView().GetViewFrame()->GetTopFrame().GetTargetList(*pList);
+
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
+ rSh.GetFlyFrmAttr( aSet );
+ const SwFmtURL &rURL = (SwFmtURL&)aSet.Get( RES_URL );
+ SvxIMapDlgChildWindow::UpdateIMapDlg(
+ aGrf, rURL.GetMap(), pList, pEditObj );
+
+ USHORT nCount = (USHORT)pList->Count();
+ if(nCount)
+ for( USHORT i = nCount; i; i-- )
+ {
+ delete pList->GetObject(i-1);
+ }
+ delete pList;
+}
+
+
+BOOL lcl_UpdateContourDlg( SwWrtShell &rSh, int nSel )
+{
+ Graphic aGraf( rSh.GetIMapGraphic() );
+ GraphicType nGrfType = aGraf.GetType();
+ BOOL bRet = GRAPHIC_NONE != nGrfType && GRAPHIC_DEFAULT != nGrfType;
+ if( bRet )
+ {
+ String aGrfName;
+ if ( nSel & nsSelectionType::SEL_GRF )
+ rSh.GetGrfNms( &aGrfName, 0 );
+
+ SvxContourDlg *pDlg = SWCONTOURDLG(rSh.GetView());
+ pDlg->Update( aGraf, aGrfName.Len() > 0,
+ rSh.GetGraphicPolygon(), rSh.GetIMapInventor() );
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: loeschen
+ --------------------------------------------------------------------*/
+
+void SwBaseShell::ExecDelete(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ SwEditWin& rTmpEditWin = GetView().GetEditWin();
+ switch(rReq.GetSlot())
+ {
+ case SID_DELETE:
+ rSh.DelRight();
+ break;
+
+ case FN_BACKSPACE:
+
+ if( rSh.IsNoNum() )
+ {
+ rSh.SttCrsrMove();
+ BOOL bLeft = rSh.Left( CRSR_SKIP_CHARS, TRUE, 1, FALSE );
+ if( bLeft )
+ {
+ // JP 28.03.96: ein Backspace im Absatz ohne Nummer wird zum Delete
+ //rSh.SwapPam();
+ //rSh.DelRight( FALSE );
+
+ rSh.DelLeft();
+ }
+ else
+ // JP 15.07.96: wenns nicht mehr nach vorne geht, die
+ // Numerierung aufheben. Z.B. am Doc-/
+ // Rahmen-/Tabellen-/Bereichs-Anfang
+ rSh.DelNumRules();
+
+ rSh.EndCrsrMove();
+ break;
+ }
+
+ // ansonsten DelLeft rufen
+ case FN_SHIFT_BACKSPACE:
+ rSh.DelLeft();
+ break;
+ default:
+ DBG_ERROR("falscher Dispatcher");
+ return;
+ }
+ rReq.Done();
+
+ //#i42732# - notify the edit window that from now on we do not use the input language
+ rTmpEditWin.SetUseInputLanguage( sal_False );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
+{
+ //Achtung: Suizid gefaehrdet! Nach Paste, Paste special kann der die
+ //Shell zerstoert sein.
+
+
+ SwWrtShell &rSh = GetShell();
+ USHORT nId = rReq.GetSlot();
+ sal_Bool bIgnore = sal_False;
+ switch( nId )
+ {
+ case SID_CUT:
+ case SID_COPY:
+ rView.GetEditWin().FlushInBuffer();
+ if ( rSh.HasSelection() )
+ {
+ SwTransferable* pTransfer = new SwTransferable( rSh );
+/*??*/ uno::Reference< datatransfer::XTransferable > xRef( pTransfer );
+
+ if ( nId == SID_CUT && !rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT) )
+ pTransfer->Cut();
+ else
+ {
+ const BOOL bLockedView = rSh.IsViewLocked();
+ rSh.LockView( TRUE ); //lock visible section
+ pTransfer->Copy();
+ rSh.LockView( bLockedView );
+ }
+ break;
+ }
+ return;
+
+ case SID_PASTE:
+ {
+ TransferableDataHelper aDataHelper(
+ TransferableDataHelper::CreateFromSystemClipboard(
+ &rSh.GetView().GetEditWin() ) );
+
+ if( aDataHelper.GetXTransferable().is() &&
+ SwTransferable::IsPaste( rSh, aDataHelper ))
+ {
+ // temp. Variablen, da die Shell nach dem Paste schon
+ // zerstoert sein kann
+ SwView* pView = &rView;
+ SwTransferable::Paste( rSh, aDataHelper );
+ if( rSh.IsFrmSelected() || rSh.IsObjSelected() )
+ rSh.EnterSelFrmMode();
+ pView->AttrChangedNotify( &rSh );
+ }
+ else
+ return;
+ }
+ break;
+
+ case SID_CLIPBOARD_FORMAT_ITEMS:
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pFmt;
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, FALSE, &pFmt ) )
+ {
+ TransferableDataHelper aDataHelper(
+ TransferableDataHelper::CreateFromSystemClipboard(
+ &rSh.GetView().GetEditWin()) );
+ if( aDataHelper.GetXTransferable().is()
+ /*&& SwTransferable::IsPaste( rSh, aDataHelper )*/ )
+ {
+ // temp. Variablen, da die Shell nach dem Paste schon
+ // zerstoert sein kann
+ SwView* pView = &rView;
+
+ SwTransferable::PasteFormat( rSh, aDataHelper,
+ ((SfxUInt32Item*)pFmt)->GetValue() );
+
+ //Done() has to be called before the shell has been removed
+ rReq.Done();
+ bIgnore = sal_True;
+ if( rSh.IsFrmSelected() || rSh.IsObjSelected())
+ rSh.EnterSelFrmMode();
+ pView->AttrChangedNotify( &rSh );
+ }
+ }
+ }
+ break;
+
+ case SID_PASTE_UNFORMATTED:
+ {
+ TransferableDataHelper aDataHelper(
+ TransferableDataHelper::CreateFromSystemClipboard(
+ &rSh.GetView().GetEditWin()) );
+ if( aDataHelper.GetXTransferable().is() &&
+ SwTransferable::IsPaste( rSh, aDataHelper ))
+ {
+ // temp. Variablen, da die Shell nach dem Paste schon
+ // zerstoert sein kann
+ SwView* pView = &rView;
+ rReq.Ignore();
+ bIgnore = sal_True;
+ int nRet = SwTransferable::PasteUnformatted( rSh, aDataHelper );
+ if(nRet)// && rReq.IsRecording() )
+ {
+ SfxViewFrame* pViewFrame = pView->GetViewFrame();
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ pViewFrame->GetBindings().GetRecorder();
+ if(xRecorder.is()) {
+ SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS );
+ aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, SOT_FORMAT_STRING ) );
+ aReq.Done();
+ }
+ }
+
+ if (rSh.IsFrmSelected() || rSh.IsObjSelected())
+ rSh.EnterSelFrmMode();
+ pView->AttrChangedNotify( &rSh );
+ }
+ else
+ return;
+ }
+ break;
+
+ case SID_PASTE_SPECIAL:
+ {
+ TransferableDataHelper aDataHelper(
+ TransferableDataHelper::CreateFromSystemClipboard(
+ &rSh.GetView().GetEditWin()) );
+ if( aDataHelper.GetXTransferable().is() &&
+ SwTransferable::IsPaste( rSh, aDataHelper ))
+ {
+ // temp. Variablen, da die Shell nach dem Paste schon
+ // zerstoert sein kann
+ SwView* pView = &rView;
+ ULONG nFormatId = 0;
+ rReq.Ignore();
+ bIgnore = sal_True;
+ int nRet = SwTransferable::PasteSpecial( rSh, aDataHelper, nFormatId );
+ if(nRet)// && rReq.IsRecording() )
+ {
+ SfxViewFrame* pViewFrame = pView->GetViewFrame();
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ pViewFrame->GetBindings().GetRecorder();
+ if(xRecorder.is()) {
+ SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS );
+ aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, nFormatId ) );
+ aReq.Done();
+ }
+ }
+
+ if (rSh.IsFrmSelected() || rSh.IsObjSelected())
+ rSh.EnterSelFrmMode();
+ pView->AttrChangedNotify( &rSh );
+ }
+ else
+ return;
+ }
+ break;
+ default:
+ DBG_ERROR("falscher Dispatcher");
+ return;
+ }
+ if(!bIgnore)
+ rReq.Done();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: ClipBoard-Status
+ --------------------------------------------------------------------*/
+
+void SwBaseShell::StateClpbrd(SfxItemSet &rSet)
+{
+ SwWrtShell &rSh = GetShell();
+ SfxWhichIter aIter(rSet);
+
+ const BOOL bCopy = rSh.HasSelection();
+
+ USHORT nWhich = aIter.FirstWhich();
+
+ while(nWhich)
+ {
+ switch(nWhich)
+ {
+ case SID_CUT:
+ if( 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) )
+ {
+ rSet.DisableItem( nWhich );
+ break;
+ }
+ case SID_COPY:
+ if( !bCopy )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case SID_PASTE:
+ if( !GetView().IsPasteAllowed() )
+ rSet.DisableItem( SID_PASTE );
+ break;
+
+ case SID_PASTE_SPECIAL:
+ if( !GetView().IsPasteSpecialAllowed() )
+ {
+ rSet.DisableItem( SID_PASTE_SPECIAL );
+ rSet.DisableItem( SID_PASTE_UNFORMATTED );
+ }
+ break;
+
+ case SID_CLIPBOARD_FORMAT_ITEMS:
+ {
+ TransferableDataHelper aDataHelper(
+ TransferableDataHelper::CreateFromSystemClipboard(
+ &rSh.GetView().GetEditWin()) );
+
+ SvxClipboardFmtItem aFmtItem( nWhich );
+ SwTransferable::FillClipFmtItem( rSh, aDataHelper, aFmtItem );
+ rSet.Put( aFmtItem );
+ }
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Undo ausfuehren
+ --------------------------------------------------------------------*/
+
+void SwBaseShell::ExecUndo(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+
+ USHORT nId = rReq.GetSlot(), nCnt = 1;
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, FALSE, &pItem ))
+ nCnt = ((SfxUInt16Item*)pItem)->GetValue();
+
+ // #i106349#: save pointer: undo/redo may delete the shell, i.e., this!
+ SfxViewFrame *const pViewFrame( GetView().GetViewFrame() );
+
+ switch( nId )
+ {
+ case SID_UNDO:
+ rSh.LockPaint();
+ rSh.Do( SwWrtShell::UNDO, nCnt );
+ rSh.UnlockPaint();
+ break;
+
+ case SID_REDO:
+ rSh.LockPaint();
+ rSh.Do( SwWrtShell::REDO, nCnt );
+ rSh.UnlockPaint();
+ break;
+
+ case SID_REPEAT:
+ rSh.Do( SwWrtShell::REPEAT );
+ break;
+ default:
+ DBG_ERROR("falscher Dispatcher");
+ }
+
+ if (pViewFrame) { pViewFrame->GetBindings().InvalidateAll(sal_False); }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zustand Undo
+ --------------------------------------------------------------------*/
+
+void SwBaseShell::StateUndo(SfxItemSet &rSet)
+{
+ SwWrtShell &rSh = GetShell();
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+ while(nWhich)
+ {
+ switch(nWhich)
+ {
+ case SID_UNDO:
+ {
+ if (rSh.GetLastUndoInfo(0, 0))
+ {
+ rSet.Put( SfxStringItem(nWhich,
+ rSh.GetDoString(SwWrtShell::UNDO)));
+ }
+ else
+ rSet.DisableItem(nWhich);
+ break;
+ }
+ case SID_REDO:
+ {
+ if (rSh.GetFirstRedoInfo(0))
+ {
+ rSet.Put(SfxStringItem(nWhich,
+ rSh.GetDoString(SwWrtShell::REDO)));
+ }
+ else
+ rSet.DisableItem(nWhich);
+ break;
+ }
+ case SID_REPEAT:
+ { // Repeat nur moeglich wenn kein REDO moeglich - UI-Restriktion
+ if ((!rSh.GetFirstRedoInfo(0)) &&
+ !rSh.IsSelFrmMode() &&
+ (UNDO_EMPTY != rSh.GetRepeatInfo(0)))
+ {
+ rSet.Put(SfxStringItem(nWhich, rSh.GetRepeatString()));
+ }
+ else
+ rSet.DisableItem(nWhich);
+ break;
+ }
+
+ case SID_GETUNDOSTRINGS:
+ if (rSh.GetLastUndoInfo(0, 0))
+ {
+ SfxStringListItem aStrLst( nWhich );
+ rSh.GetDoStrings( SwWrtShell::UNDO, aStrLst );
+ rSet.Put( aStrLst );
+ }
+ else
+ rSet.DisableItem( nWhich );
+ break;
+
+ case SID_GETREDOSTRINGS:
+ if (rSh.GetFirstRedoInfo(0))
+ {
+ SfxStringListItem aStrLst( nWhich );
+ rSh.GetDoStrings( SwWrtShell::REDO, aStrLst );
+ rSet.Put( aStrLst );
+ }
+ else
+ rSet.DisableItem( nWhich );
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Slot-Id auswerten bzw. Dispatchen
+ --------------------------------------------------------------------*/
+
+void SwBaseShell::Execute(SfxRequest &rReq)
+{
+ const SfxPoolItem *pItem;
+ SwWrtShell &rSh = GetShell();
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ BOOL bMore = FALSE;
+
+ USHORT nSlot = rReq.GetSlot();
+ switch(nSlot)
+ {
+ case FN_REPAGINATE:
+ {
+ Reference < XModel > xModel = GetView().GetDocShell()->GetModel();
+ Reference < XUnoTunnel > xDocTunnel ( xModel, UNO_QUERY );
+ SwXTextDocument *pDoc = reinterpret_cast < SwXTextDocument * > ( xDocTunnel->getSomething ( SwXTextDocument::getUnoTunnelId() ) );
+ pDoc->notifyRefreshListeners();
+ rSh.CalcLayout();
+ }
+ break;
+ case FN_UPDATE_FIELDS:
+ {
+ SwDocStat aDocStat;
+ rSh.UpdateDocStat(aDocStat);
+ rSh.EndAllTblBoxEdit();
+ rSh.ViewShell::UpdateFlds(TRUE);
+
+ if( rSh.IsCrsrInTbl() )
+ {
+ if( !rSh.IsTblComplexForChart() )
+ SwTableFUNC( &rSh, FALSE).UpdateChart();
+ rSh.ClearTblBoxCntnt();
+ rSh.SaveTblBoxCntnt();
+ }
+ }
+ break;
+ case FN_UPDATE_CHARTS:
+ {
+ SwWait aWait( *rView.GetDocShell(), TRUE );
+ rSh.UpdateAllCharts();
+ }
+ break;
+
+ case FN_UPDATE_ALL:
+ {
+ SwView& rTempView = GetView();
+ rSh.EnterStdMode();
+ if( rSh.GetLinkManager().GetLinks().Count() )
+ {
+ rSh.StartAllAction();
+ rSh.GetLinkManager().UpdateAllLinks( FALSE, TRUE, TRUE );
+ rSh.EndAllAction();
+ }
+ SfxDispatcher &rDis = *rTempView.GetViewFrame()->GetDispatcher();
+ rDis.Execute( FN_UPDATE_FIELDS );
+ rDis.Execute( FN_UPDATE_TOX );
+ rDis.Execute( FN_UPDATE_CHARTS );
+ rSh.CalcLayout();
+ }
+ break;
+
+ case FN_UPDATE_INPUTFIELDS:
+ rSh.UpdateInputFlds(NULL, FALSE);
+ break;
+ case FN_PREV_BOOKMARK:
+ rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoPrevBookmark()));
+ break;
+ case FN_NEXT_BOOKMARK:
+ rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoNextBookmark()));
+ break;
+
+ case FN_GOTO_NEXT_MARK:
+ case FN_GOTO_PREV_MARK:
+ {
+ SwFldMgr aFldMgr;
+ SwFieldType* pFldType = aFldMgr.GetFldType(RES_JUMPEDITFLD);
+
+ if (pFldType)
+ {
+ if (rSh.IsSelFrmMode())
+ {
+ rSh.UnSelectFrm();
+ rSh.LeaveSelFrmMode();
+ }
+
+ if (rSh.HasMark())
+ {
+ MV_KONTEXT(&rSh);
+ if (rSh.IsCrsrPtAtEnd())
+ rSh.SwapPam();
+ rSh.ClearMark();
+ rSh.EndSelect();
+ }
+ BOOL bRet = rSh.MoveFldType(pFldType, nSlot == FN_GOTO_NEXT_MARK);
+ SwField* pCurField = bRet ? rSh.GetCurFld() : 0;
+ if (pCurField)
+ rSh.ClickToField(*pCurField);
+ rReq.SetReturnValue(SfxBoolItem( nSlot, bRet));
+ }
+ }
+ break;
+
+ case FN_START_DOC_DIRECT:
+ case FN_END_DOC_DIRECT:
+ {
+ if (rSh.IsSelFrmMode())
+ {
+ rSh.UnSelectFrm();
+ rSh.LeaveSelFrmMode();
+ }
+ rSh.EnterStdMode();
+ nSlot == FN_START_DOC_DIRECT ?
+ rSh.SttEndDoc(TRUE) :
+ rSh.SttEndDoc(FALSE);
+ }
+ break;
+ case FN_GOTO_PREV_OBJ:
+ case FN_GOTO_NEXT_OBJ:
+ {
+ BOOL bSuccess = rSh.GotoObj(
+ nSlot == FN_GOTO_NEXT_OBJ ? TRUE : FALSE);
+ rReq.SetReturnValue(SfxBoolItem(nSlot, bSuccess));
+ if (bSuccess && !rSh.IsSelFrmMode())
+ {
+ rSh.HideCrsr();
+ rSh.EnterSelFrmMode();
+ GetView().AttrChangedNotify( &rSh );
+ }
+ }
+ break;
+ case SID_GALLERY_FORMATS:
+ {
+ const int nSelType = rSh.GetSelectionType();
+ if(SFX_ITEM_SET == pArgs->GetItemState( nSlot, TRUE, &pItem))
+ {
+ GalleryExplorer* pGal = 0;
+ if ( (!rSh.IsSelFrmMode() || nSelType & nsSelectionType::SEL_GRF) &&
+ 0!= (pGal = SVX_GALLERY())&&
+ 0 != (SGA_FORMAT_GRAPHIC & ((SfxUInt32Item*)pItem)->GetValue()))
+ {
+ SwWait aWait( *rView.GetDocShell(), TRUE );
+
+ String aGrfName, aFltName;
+ const Graphic aGrf( pGal->GetGraphic() );
+
+ if( pGal->IsLinkage() )
+ {
+ // Verknuepft
+ aGrfName = pGal->GetURL().GetMainURL(INetURLObject::NO_DECODE);
+ aFltName = pGal->GetFilterName();
+ }
+
+ if ( nSelType & nsSelectionType::SEL_GRF )
+ rSh.ReRead( aGrfName, aFltName, &aGrf );
+ else
+ rSh.Insert( aGrfName, aFltName, aGrf );
+
+ GetView().GetEditWin().GrabFocus();
+ }
+ else if(!rSh.IsSelFrmMode() && SGA_FORMAT_SOUND & ((SfxUInt32Item*)pItem)->GetValue())
+ {
+ const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ) );
+ GetView().GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L );
+/*
+ String sURL( pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ) );
+ String sLabel( pGal->GetURL().getBase() );
+ String sTarget; // empty string!
+
+ bool bIsHTMLMode =
+ 0 == ( HTMLMODE_ON &
+ ::GetHtmlMode( GetView().GetDocShell() ) );
+
+ // in Writer, we insert a button which plays the
+ // sound. In Writer/Web, we just insert a (text) link.
+ if( bIsHTMLMode )
+ InsertURLButton( sURL, sTarget, sLabel );
+ else
+ rSh.InsertURL( SwFmtINetFmt( sURL, sTarget ), sLabel );
+*/
+ }
+ }
+ }
+ break;
+ case FN_PAGE_STYLE_SET_COLS:
+ {
+ if (pArgs)
+ {
+ // aktuellen PageDescriptor ermitteln und damit den Set fuellen
+ const USHORT nCurIdx = rSh.GetCurPageDesc();
+ SwPageDesc aPageDesc(rSh.GetPageDesc(nCurIdx));
+
+ SwFrmFmt &rFmt = aPageDesc.GetMaster();
+
+ SwFmtCol aFmtCol = rFmt.GetCol();
+
+ USHORT nCount;
+ if(SFX_ITEM_SET == pArgs->GetItemState(nSlot))
+ nCount = ((SfxUInt16Item &)pArgs->Get(nSlot)).GetValue();
+ else
+ nCount = ((SfxUInt16Item &)pArgs->Get(SID_ATTR_COLUMNS)).GetValue();
+ USHORT nGutterWidth = DEF_GUTTER_WIDTH;
+
+ aFmtCol.Init(nCount ? nCount : 1, nGutterWidth, USHRT_MAX);
+ aFmtCol.SetWishWidth(USHRT_MAX);
+ aFmtCol.SetGutterWidth(nGutterWidth, USHRT_MAX);
+
+ rFmt.SetFmtAttr(aFmtCol);
+
+ rSh.ChgPageDesc(nCurIdx, aPageDesc);
+ }
+ else
+ GetView().GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_PAGE_COLUMN_DLG, FALSE);
+ }
+ break;
+ case FN_CONVERT_TABLE_TO_TEXT:
+ case FN_CONVERT_TEXT_TO_TABLE:
+ case FN_CONVERT_TEXT_TABLE:
+ {
+ sal_Unicode cDelim = 0;
+ bool bToTable = false;
+ if( nSlot == FN_CONVERT_TEXT_TO_TABLE ||
+ ( nSlot == FN_CONVERT_TEXT_TABLE && 0 == rSh.GetTableFmt() ))
+ bToTable = true;
+ SwInsertTableOptions aInsTblOpts( tabopts::ALL_TBL_INS_ATTR, 1 );
+ SwTableAutoFmt* pTAFmt = 0;
+ SwTableAutoFmtTbl* pAutoFmtTbl = 0;
+ bool bDeleteFormat = true;
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_1, TRUE, &pItem))
+ {
+ aInsTblOpts.mnInsMode = 0;
+ //Delimiter
+ String sDelim = static_cast< const SfxStringItem* >(pItem)->GetValue();
+ if(sDelim.Len())
+ cDelim = sDelim.GetChar(0);
+ //AutoFormat
+ if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_2, TRUE, &pItem))
+ {
+ String sAutoFmt = static_cast< const SfxStringItem* >(pItem)->GetValue();
+
+ pAutoFmtTbl = new SwTableAutoFmtTbl;
+ pAutoFmtTbl->Load();
+
+ for( USHORT i = 0, nCount = pAutoFmtTbl->Count(); i < nCount; i++ )
+ {
+ SwTableAutoFmt* pFmt = (*pAutoFmtTbl)[ i ];
+ if( pFmt->GetName() == sAutoFmt )
+ {
+ pTAFmt = pFmt;
+ bDeleteFormat = false;
+ break;
+ }
+ }
+ }
+ //WithHeader
+ if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_3, TRUE, &pItem) &&
+ static_cast< const SfxBoolItem* >(pItem)->GetValue())
+ aInsTblOpts.mnInsMode |= tabopts::HEADLINE;
+ // RepeatHeaderLines
+ if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_4, TRUE, &pItem))
+ aInsTblOpts.mnRowsToRepeat =
+ (USHORT)static_cast< const SfxInt16Item* >(pItem)->GetValue();
+ //WithBorder
+ if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_5, TRUE, &pItem) &&
+ static_cast< const SfxBoolItem* >(pItem)->GetValue())
+ aInsTblOpts.mnInsMode |= tabopts::DEFAULT_BORDER;
+ //DontSplitTable
+ if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_6, TRUE, &pItem) &&
+ !static_cast< const SfxBoolItem* >(pItem)->GetValue() )
+ aInsTblOpts.mnInsMode |= tabopts::SPLIT_LAYOUT;
+ }
+ else
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwConvertTableDlg* pDlg = pFact->CreateSwConvertTableDlg(
+ GetView(),DLG_CONV_TEXT_TABLE , bToTable);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if( RET_OK == pDlg->Execute() )
+ {
+ pDlg->GetValues( cDelim, aInsTblOpts, pTAFmt );
+
+ }
+ delete pDlg;
+ }
+
+ if( cDelim )
+ {
+ //Shellwechsel!
+ SwView& rSaveView = rView;
+ BOOL bInserted = FALSE;
+ //recording:
+
+ SfxViewFrame* pViewFrame = GetView().GetViewFrame();
+ if( SfxRequest::HasMacroRecorder(pViewFrame) )
+ {
+ SfxRequest aReq( pViewFrame, nSlot);
+ aReq.AppendItem( SfxStringItem( FN_PARAM_1, String(cDelim) ));
+ if(bToTable)
+ {
+ if(pTAFmt)
+ aReq.AppendItem( SfxStringItem( FN_PARAM_2, pTAFmt->GetName()));
+ aReq.AppendItem( SfxBoolItem ( FN_PARAM_3, 0 != (aInsTblOpts.mnInsMode & tabopts::HEADLINE)));
+ aReq.AppendItem( SfxInt16Item( FN_PARAM_4, (short)aInsTblOpts.mnRowsToRepeat ));
+ aReq.AppendItem( SfxBoolItem ( FN_PARAM_5, 0 != (aInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER) ));
+ aReq.AppendItem( SfxBoolItem ( FN_PARAM_6, !(aInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT)));
+ }
+ aReq.Done();
+ }
+
+ if( !bToTable )
+ rSh.TableToText( cDelim );
+ else
+ {
+ bInserted = rSh.TextToTable( aInsTblOpts, cDelim, text::HoriOrientation::FULL, pTAFmt );
+ }
+ rSh.EnterStdMode();
+
+ if( bInserted )
+ rSaveView.AutoCaption( TABLE_CAP );
+ }
+ if(bDeleteFormat)
+ delete pTAFmt;
+ delete pAutoFmtTbl;
+ }
+ break;
+ case SID_STYLE_WATERCAN:
+ case SID_STYLE_UPDATE_BY_EXAMPLE:
+ case SID_STYLE_NEW_BY_EXAMPLE:
+ case SID_STYLE_APPLY:
+ {
+ ShellModes eMode = GetView().GetShellMode();
+ if ( SHELL_MODE_DRAW != eMode &&
+ SHELL_MODE_DRAW_CTRL != eMode &&
+ SHELL_MODE_DRAW_FORM != eMode &&
+ SHELL_MODE_DRAWTEXT != eMode &&
+ SHELL_MODE_BEZIER != eMode )
+ {
+ // oj #107754#
+ if ( SID_STYLE_WATERCAN == nSlot )
+ {
+ const BOOL bLockedView = rSh.IsViewLocked();
+ rSh.LockView( TRUE ); //lock visible section
+
+ GetView().GetDocShell()->ExecStyleSheet(rReq);
+
+ rSh.LockView( bLockedView );
+ }
+ else
+ // wird von der DocShell aufgezeichnet
+ GetView().GetDocShell()->ExecStyleSheet(rReq);
+ }
+ }
+ break;
+ case FN_ESCAPE:
+ GetView().ExecuteSlot(rReq);
+ break;
+ case SID_IMAP:
+ {
+ USHORT nId = SvxIMapDlgChildWindow::GetChildWindowId();
+
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ pVFrame->ToggleChildWindow( nId );
+ pVFrame->GetBindings().Invalidate( SID_IMAP );
+
+ if ( pVFrame->HasChildWindow( nId ) && rSh.IsFrmSelected() )
+ lcl_UpdateIMapDlg( rSh );
+ }
+ break;
+ case SID_IMAP_EXEC:
+ {
+ SvxIMapDlg* pDlg = SWIMAPDLG(GetView());
+
+ // Kontrolle, ob Zuweisung ueberhaupt sinnvoll/erlaubt
+ if ( rSh.IsFrmSelected() &&
+ pDlg->GetEditingObject() == rSh.GetIMapInventor() )
+ {
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
+ rSh.GetFlyFrmAttr( aSet );
+ SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
+ aURL.SetMap( &pDlg->GetImageMap() );
+ aSet.Put( aURL );
+ rSh.SetFlyFrmAttr( aSet );
+ }
+ }
+ break;
+ case SID_CONTOUR_DLG:
+ {
+ USHORT nId = SvxContourDlgChildWindow::GetChildWindowId();
+
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ pVFrame->ToggleChildWindow( nId );
+ pVFrame->GetBindings().Invalidate( SID_CONTOUR_DLG );
+
+ int nSel = rSh.GetSelectionType();
+ if ( pVFrame->HasChildWindow( nId ) &&
+ (nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE)) )
+ {
+ lcl_UpdateContourDlg( rSh, nSel );
+ }
+ }
+ break;
+ case SID_CONTOUR_EXEC:
+ {
+ SvxContourDlg *pDlg = SWCONTOURDLG(GetView());
+
+ // Kontrolle, ob Zuweisung ueberhaupt sinnvoll/erlaubt
+ int nSel = rSh.GetSelectionType();
+ if ( nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE) )
+ {
+ if ( pDlg->GetEditingObject() == rSh.GetIMapInventor() )
+ {
+ rSh.StartAction();
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_SURROUND, RES_SURROUND);
+ rSh.GetFlyFrmAttr( aSet );
+ SwFmtSurround aSur( (SwFmtSurround&)aSet.Get( RES_SURROUND ) );
+ if ( !aSur.IsContour() )
+ {
+ aSur.SetContour( TRUE );
+ if ( aSur.GetSurround() == SURROUND_NONE )
+ aSur.SetSurround( SURROUND_PARALLEL );
+ aSet.Put( aSur );
+ rSh.SetFlyFrmAttr( aSet );
+ }
+ const PolyPolygon aPoly( pDlg->GetPolyPolygon() );
+ rSh.SetGraphicPolygon( &aPoly );
+ if ( pDlg->IsGraphicChanged() )
+ rSh.ReRead( aEmptyStr, aEmptyStr, &pDlg->GetGraphic());
+ rSh.EndAction();
+ }
+ }
+ }
+ break;
+ case FN_FRAME_TO_ANCHOR:
+ {
+ rSh.GotoFlyAnchor();
+ rSh.EnterStdMode();
+ rSh.CallChgLnk();
+ }
+ break;
+ case FN_TOOL_ANKER:
+ break;
+ case FN_TOOL_ANKER_PAGE:
+ case FN_TOOL_ANKER_PARAGRAPH:
+ case FN_TOOL_ANKER_CHAR:
+ case FN_TOOL_ANKER_AT_CHAR:
+ case FN_TOOL_ANKER_FRAME:
+ {
+ RndStdIds eSet = nSlot == FN_TOOL_ANKER_PAGE
+ ? FLY_AT_PAGE
+ : nSlot == FN_TOOL_ANKER_PARAGRAPH
+ ? FLY_AT_PARA
+ : nSlot == FN_TOOL_ANKER_FRAME
+ ? FLY_AT_FLY
+ : nSlot == FN_TOOL_ANKER_CHAR
+ ? FLY_AS_CHAR
+ : FLY_AT_CHAR;
+ rSh.StartUndo();
+ if( rSh.IsObjSelected() )
+ rSh.ChgAnchor( eSet );
+ else if( rSh.IsFrmSelected() )
+ {
+ // Der Set beinhaltet auch VERT/HORI_ORIENT, da in FEShell::
+ // SetFlyFrmAttr/SetFlyFrmAnchor ggf. als Folge des Umankerns
+ // die Ausrichtungen veraendert werden sollen.
+ SfxItemSet aSet( GetPool(), RES_VERT_ORIENT, RES_ANCHOR );
+ SwFmtAnchor aAnc( eSet, rSh.GetPhyPageNum() );
+ aSet.Put( aAnc );
+ rSh.SetFlyFrmAttr(aSet);
+ }
+
+ // if new anchor is 'as char' and it is a Math object and the usual
+ // pre-conditions are met then align the formula to the baseline of the text
+ const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() );
+ const bool bDoMathBaselineAlignment = xObj.is() && SotExchange::IsMath( xObj->getClassID() )
+ && FLY_AS_CHAR == eSet && rSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT );
+ if (bDoMathBaselineAlignment)
+ rSh.AlignFormulaToBaseline( xObj );
+
+ USHORT nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
+ if( nHtmlMode )
+ {
+ SfxItemSet aSet(GetPool(), RES_SURROUND, RES_HORI_ORIENT);
+ rSh.GetFlyFrmAttr(aSet);
+
+ const SwFmtSurround& rSurround = (const SwFmtSurround&)aSet.Get(RES_SURROUND);
+ const SwFmtVertOrient& rVert = (const SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT);
+ const SwFmtHoriOrient& rHori = (const SwFmtHoriOrient&)aSet.Get(RES_HORI_ORIENT);
+ sal_Int16 eVOrient = rVert.GetVertOrient();
+ sal_Int16 eHOrient = rHori.GetHoriOrient();
+ SwSurround eSurround = rSurround.GetSurround();
+
+ switch( eSet )
+ {
+ case FLY_AT_FLY:
+ case FLY_AT_PAGE:
+
+ //Durchlauf, links oder von links, oben, von oben
+ if(eSurround != SURROUND_THROUGHT)
+ aSet.Put(SwFmtSurround(SURROUND_THROUGHT));
+
+ if( eVOrient != text::VertOrientation::TOP && eVOrient != text::VertOrientation::NONE)
+ aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP));
+
+ if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT)
+ aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT));
+ break;
+
+ case FLY_AT_PARA:
+ //links, von links, rechts, oben, kein Uml, li+re Umlauf,
+ if(eSurround != SURROUND_LEFT || eSurround != SURROUND_RIGHT)
+ aSet.Put(SwFmtSurround(SURROUND_LEFT));
+
+ if( eVOrient != text::VertOrientation::TOP)
+ aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP));
+
+ if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT || eHOrient != text::HoriOrientation::RIGHT)
+ aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT));
+ break;
+
+ case FLY_AT_CHAR:
+ //links, von links, rechts, oben, Durchlauf
+ if(eSurround != SURROUND_THROUGHT)
+ aSet.Put(SwFmtSurround(SURROUND_THROUGHT));
+
+ if( eVOrient != text::VertOrientation::TOP)
+ aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP));
+
+ if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT || eHOrient != text::HoriOrientation::RIGHT)
+ aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT));
+ break;
+
+ default:
+ ;
+ }
+
+ if( aSet.Count() )
+ rSh.SetFlyFrmAttr( aSet );
+ }
+ rSh.EndUndo();
+
+ GetView().GetViewFrame()->GetBindings().Invalidate( FN_TOOL_ANKER );
+ }
+ break;
+
+ case FN_FRAME_NOWRAP:
+ case FN_FRAME_WRAP:
+ case FN_FRAME_WRAP_IDEAL:
+ case FN_FRAME_WRAPTHRU:
+ case FN_FRAME_WRAPTHRU_TRANSP:
+ case FN_FRAME_WRAP_CONTOUR:
+ case FN_WRAP_ANCHOR_ONLY:
+ case FN_FRAME_WRAP_LEFT:
+ case FN_FRAME_WRAP_RIGHT:
+ SetWrapMode( nSlot );
+ break;
+
+ case FN_UPDATE_ALL_LINKS:
+ {
+ if( rSh.GetLinkManager().GetLinks().Count() )
+ {
+ BOOL bUpdateGrf = FALSE, bCallErrHdl = FALSE;
+ rSh.EnterStdMode();
+ rSh.StartAllAction();
+ rSh.GetLinkManager().UpdateAllLinks( FALSE, bCallErrHdl, bUpdateGrf );
+ rSh.EndAllAction();
+ }
+ }
+ break;
+
+ case FN_XFORMS_DESIGN_MODE:
+ if( pArgs != NULL
+ && pArgs->GetItemState( nSlot, TRUE, &pItem ) == SFX_ITEM_SET
+ && pItem != NULL
+ && pItem->ISA( SfxBoolItem ) )
+ {
+ BOOL bDesignMode =
+ static_cast<const SfxBoolItem*>( pItem )->GetValue();
+
+ // set form design mode
+ DBG_ASSERT( GetView().GetFormShell() != NULL, "form shell?" );
+ SfxRequest aReq( GetView().GetViewFrame(), SID_FM_DESIGN_MODE );
+ aReq.AppendItem( SfxBoolItem( SID_FM_DESIGN_MODE, bDesignMode ) );
+ GetView().GetFormShell()->Execute( aReq );
+ aReq.Done();
+
+ // also set suitable view options
+ SwViewOption aViewOption = *rSh.GetViewOptions();
+ aViewOption.SetFormView( ! bDesignMode );
+ rSh.ApplyViewOptions( aViewOption );
+ }
+ break;
+
+ default:
+ bMore = TRUE;
+ }
+ if(bMore && pArgs)
+ {
+ pItem = 0;
+ pArgs->GetItemState(GetPool().GetWhich(nSlot), FALSE, &pItem);
+ if(pItem)
+ switch(nSlot)
+ {
+ case SID_ATTR_BRUSH:
+ case SID_ATTR_BORDER_SHADOW:
+ case RES_SHADOW:
+ {
+ rSh.StartAllAction();
+ SfxItemSet aSet( rSh.GetAttrPool(),
+ RES_SHADOW, RES_SHADOW,
+ RES_BACKGROUND, RES_BACKGROUND, 0 );
+
+ aSet.Put(*pItem);
+ // Tabellenzelle(n) selektiert?
+ if ( rSh.IsTableMode() )
+ {
+ SwFrmFmt *pFmt = rSh.GetTableFmt();
+ pFmt->SetFmtAttr( *pItem );
+ }
+ else if ( rSh.IsFrmSelected() )
+ {
+ // Umrandungsattribute ueber Frame-Manager setzen
+ SwFlyFrmAttrMgr aMgr( FALSE, &rSh, FRMMGR_TYPE_NONE );
+ aMgr.SetAttrSet( *pArgs );
+ aMgr.UpdateFlyFrm();
+ }
+ else
+ {
+ rSh.SetAttr( *pArgs );
+ }
+ rSh.EndAllAction();
+ }
+ break;
+ case FN_PAGE_STYLE_SET_LR_MARGIN:
+ case FN_PAGE_STYLE_SET_UL_MARGIN:
+ case FN_PAGE_STYLE_SET_NUMBER_FORMAT:
+ case FN_PAGE_STYLE_SET_PAPER_SIZE:
+ case FN_PAGE_STYLE_SET_PAPER_BIN:
+ {
+ DBG_ERROR("not implemented");
+ }
+ break;
+
+ case SID_ATTR_BORDER_OUTER:
+ {
+ // Tabellenzelle(n) selektiert?
+ if ( rSh.IsTableMode() )
+ {
+ // Umrandungattribute Get/SetTabBorders() setzen
+ rSh.SetTabBorders(*pArgs);
+ }
+ else if ( rSh.IsFrmSelected() )
+ {
+ // Umrandungsattribute ueber Frame-Manager setzen
+ SwFlyFrmAttrMgr aMgr( FALSE, &rSh, FRMMGR_TYPE_NONE );
+ aMgr.SetAttrSet(*pArgs);
+ aMgr.UpdateFlyFrm();
+ }
+ else
+ {
+ // Umrandungsattribute ganz normal ueber Shell setzen
+ rSh.SetAttr( *pItem );
+ }
+ }
+ break;
+ default:
+ DBG_ERROR("falscher Dispatcher");
+ }
+
+ }
+}
+
+/* -----------------14.04.99 15:10-------------------
+ * Hier wird der State fuer SID_IMAP / SID_CONTOUR behandelt,
+ * wenn die Grafik ausgeswappt ist
+ * --------------------------------------------------*/
+IMPL_LINK(SwBaseShell, GraphicArrivedHdl, SwCrsrShell* , EMPTYARG )
+{
+ USHORT nGrfType;
+ SwWrtShell &rSh = GetShell();
+ if( CNT_GRF == rSh.SwEditShell::GetCntType() &&
+ GRAPHIC_NONE != ( nGrfType = rSh.GetGraphicType() ) &&
+ aGrfUpdateSlots.Count() )
+ {
+ BOOL bProtect = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT);
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ USHORT nSlot;
+ for( USHORT n = 0; n < aGrfUpdateSlots.Count(); ++n )
+ {
+ BOOL bSetState = FALSE;
+ BOOL bState = FALSE;
+ switch( nSlot = aGrfUpdateSlots[ n ] )
+ {
+ case SID_IMAP:
+ case SID_IMAP_EXEC:
+ {
+ USHORT nId = SvxIMapDlgChildWindow::GetChildWindowId();
+ SvxIMapDlg *pDlg = pVFrame->HasChildWindow( nId ) ?
+ (SvxIMapDlg*) ( pVFrame->GetChildWindow( nId )
+ ->GetWindow()) : 0;
+
+ if( pDlg && ( SID_IMAP_EXEC == nSlot ||
+ ( SID_IMAP == nSlot && !bProtect)) &&
+ pDlg->GetEditingObject() != rSh.GetIMapInventor())
+ lcl_UpdateIMapDlg( rSh );
+
+ if( !bProtect && SID_IMAP == nSlot )
+ bSetState = TRUE, bState = 0 != pDlg;
+ }
+ break;
+
+ case SID_CONTOUR_DLG:
+ if( !bProtect )
+ {
+ USHORT nId = SvxContourDlgChildWindow::GetChildWindowId();
+ SvxIMapDlg *pDlg = pVFrame->HasChildWindow( nId ) ?
+ (SvxIMapDlg*) ( pVFrame->GetChildWindow( nId )
+ ->GetWindow()) : 0;
+ if( pDlg && pDlg->GetEditingObject() !=
+ rSh.GetIMapInventor() )
+ lcl_UpdateContourDlg( rSh, nsSelectionType::SEL_GRF );
+
+ bSetState = TRUE;
+ bState = 0 != pDlg;
+ }
+ break;
+
+ case FN_FRAME_WRAP_CONTOUR:
+ if( !bProtect )
+ {
+ SfxItemSet aSet(GetPool(), RES_SURROUND, RES_SURROUND);
+ rSh.GetFlyFrmAttr(aSet);
+ const SwFmtSurround& rWrap = (const SwFmtSurround&)aSet.Get(RES_SURROUND);
+ bSetState = TRUE;
+ bState = rWrap.IsContour();
+ }
+ break;
+
+ case SID_GRFFILTER:
+ case SID_GRFFILTER_INVERT:
+ case SID_GRFFILTER_SMOOTH:
+ case SID_GRFFILTER_SHARPEN:
+ case SID_GRFFILTER_REMOVENOISE:
+ case SID_GRFFILTER_SOBEL:
+ case SID_GRFFILTER_MOSAIC:
+ case SID_GRFFILTER_EMBOSS:
+ case SID_GRFFILTER_POSTER:
+ case SID_GRFFILTER_POPART:
+ case SID_GRFFILTER_SEPIA:
+ case SID_GRFFILTER_SOLARIZE:
+ bSetState = bState = GRAPHIC_BITMAP == nGrfType;
+ break;
+ }
+
+ if( bSetState )
+ {
+ SfxBoolItem aBool( nSlot, bState );
+ if( pGetStateSet )
+ pGetStateSet->Put( aBool );
+ else
+ pVFrame->GetBindings().SetState( aBool );
+ }
+ }
+ aGrfUpdateSlots.RemoveAt( 0, aGrfUpdateSlots.Count() );
+ }
+ return 0;
+}
+
+void SwBaseShell::GetState( SfxItemSet &rSet )
+{
+ SwWrtShell &rSh = GetShell();
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+ pGetStateSet = &rSet;
+ while ( nWhich )
+ {
+ switch ( nWhich )
+ {
+ case SID_GALLERY_FORMATS:
+ if ( rSh.IsObjSelected() ||
+ (rSh.IsSelFrmMode() &&
+ !(rSh.GetSelectionType() & nsSelectionType::SEL_GRF)) )
+ rSet.DisableItem( nWhich );
+ break;
+ case SID_GALLERY_ENABLE_ADDCOPY:
+ // #108230# allow copy from gallery in Writer AND Writer/Web!
+ rSet.Put( SfxBoolItem( SID_GALLERY_ENABLE_ADDCOPY, TRUE ) );
+ break;
+ case FN_EDIT_REGION:
+ if( !rSh.IsAnySectionInDoc() )
+ rSet.DisableItem(nWhich);
+ break;
+
+ case FN_INSERT_REGION:
+ if( rSh.IsSelFrmMode() ||
+ !rSh.IsInsRegionAvailable() )
+ rSet.DisableItem( nWhich );
+ break;
+ case FN_CONVERT_TABLE_TO_TEXT:
+ {
+ USHORT eFrmType = rSh.GetFrmType(0,TRUE);
+ if( (eFrmType & FRMTYPE_FOOTNOTE) ||
+ !rSh.GetTableFmt() )
+ rSet.DisableItem( nWhich );
+ }
+ break;
+ case FN_CONVERT_TEXT_TO_TABLE:
+ {
+ USHORT eFrmType = rSh.GetFrmType(0,TRUE);
+ if( (eFrmType & FRMTYPE_FOOTNOTE) ||
+ !rSh.IsTextToTableAvailable() )
+ rSet.DisableItem( nWhich );
+ }
+ break;
+ case FN_CONVERT_TEXT_TABLE:
+ {
+ USHORT eFrmType = rSh.GetFrmType(0,TRUE);
+ if( (eFrmType & FRMTYPE_FOOTNOTE) ||
+ (!rSh.GetTableFmt() && !rSh.IsTextToTableAvailable() ) )
+ rSet.DisableItem( nWhich );
+ }
+ break;
+ case RES_SHADOW:
+ {
+ SfxItemSet aSet( rSh.GetAttrPool(),
+ RES_SHADOW, RES_SHADOW );
+
+ // Tabellenzelle(n) selektiert?
+ if ( rSh.IsTableMode() )
+ {
+ SwFrmFmt *pFmt = rSh.GetTableFmt();
+ aSet.Put(pFmt->GetFmtAttr( nWhich, TRUE ));
+ }
+ else if( rSh.IsFrmSelected() )
+ {
+ SwFlyFrmAttrMgr aMgr( FALSE, &rSh, FRMMGR_TYPE_NONE );
+ aSet.Put( aMgr.GetAttrSet() );
+ }
+ else
+ rSh.GetCurAttr( aSet );
+#if OSL_DEBUG_LEVEL > 1
+
+ const SvxShadowItem& rShItem = (const SvxShadowItem&)aSet.Get(nWhich);
+ rSet.Put(rShItem);
+#else
+ rSet.Put((const SvxShadowItem&)aSet.Get(nWhich));
+#endif
+ }
+ break;
+ case SID_IMAP:
+ {
+ // --> OD 2006-11-08 #i59688#
+ // improve efficiency:
+ // If selected object is protected, item has to disabled.
+ const BOOL bProtect = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT);
+ if ( bProtect )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ else
+ {
+ const USHORT nId = SvxIMapDlgChildWindow::GetChildWindowId();
+ const BOOL bHas = pVFrame->HasChildWindow( nId );
+ const BOOL bFrmSel = rSh.IsFrmSelected();
+ const BOOL bIsGraphicSelection =
+ rSh.GetSelectionType() == nsSelectionType::SEL_GRF;
+
+ // --> OD 2006-11-08 #i59688#
+ // avoid unnecessary loading of selected graphic.
+ // The graphic is only needed, if the dialog is open.
+ //wenn die Grafik ausgeswappt ist, dann muss der
+ //Status asynchron ermittelt werden
+ //bis dahin wird der Slot disabled
+ if ( bHas && bIsGraphicSelection && rSh.IsGrfSwapOut( TRUE ) )
+ {
+ if( AddGrfUpdateSlot( nWhich ))
+ rSh.GetGraphic(FALSE); // start the loading
+ }
+ else
+ {
+ if ( !bHas &&
+ ( !bFrmSel ||
+ ( bIsGraphicSelection &&
+ rSh.GetGraphicType() == GRAPHIC_NONE ) ) )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ else
+ {
+ SfxBoolItem aBool(nWhich, bHas);
+ if ( bHas && bFrmSel )
+ lcl_UpdateIMapDlg( rSh );
+ rSet.Put(aBool);
+ }
+ }
+ // <--
+ }
+ // <--
+ }
+ break;
+ case SID_IMAP_EXEC:
+ {
+ BOOL bDisable = FALSE;
+ if( !rSh.IsFrmSelected())
+ bDisable = TRUE;
+ USHORT nId = SvxIMapDlgChildWindow::GetChildWindowId();
+ if(!bDisable && pVFrame->HasChildWindow( nId ))
+ {
+ if(rSh.GetSelectionType() == nsSelectionType::SEL_GRF
+ && rSh.IsGrfSwapOut(TRUE))
+ {
+ if( AddGrfUpdateSlot( nWhich ))
+ rSh.GetGraphic(FALSE); // start the loading
+ }
+ else
+ {
+ SvxIMapDlg *pDlg = SWIMAPDLG(GetView());
+ if( pDlg->GetEditingObject() != rSh.GetIMapInventor() )
+ lcl_UpdateIMapDlg( rSh );
+ }
+ }
+ rSet.Put(SfxBoolItem(nWhich, bDisable));
+ }
+ break;
+ case FN_BACKSPACE:
+ case SID_DELETE:
+ if (rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0)
+ rSet.DisableItem( nWhich );
+ break;
+ case SID_CONTOUR_DLG:
+ {
+ BOOL bParentCntProt = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT );
+
+ if( bParentCntProt || 0 != (HTMLMODE_ON & ::GetHtmlMode(
+ GetView().GetDocShell() )) )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ USHORT nId = SvxContourDlgChildWindow::GetChildWindowId();
+ BOOL bHas = GetView().GetViewFrame()->HasChildWindow( nId );
+ int nSel = rSh.GetSelectionType();
+ BOOL bOk = 0 != (nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE));
+
+ BOOL bDisable = FALSE;
+ if( !bHas && !bOk )
+ bDisable = TRUE;
+ // --> OD 2006-11-08 #i59688#
+ // avoid unnecessary loading of selected graphic.
+ // The graphic is only needed, if the dialog is open.
+ // wenn die Grafik ausgeswappt ist, dann muss der Status
+ // asynchron ermittelt werden bis dahin wird der Slot
+ // disabled
+ else if ( bHas && (nSel & nsSelectionType::SEL_GRF) &&
+ rSh.IsGrfSwapOut(TRUE) )
+ {
+ if( AddGrfUpdateSlot( nWhich ))
+ rSh.GetGraphic(FALSE); // start the loading
+ // --> OD 2007-07-04 #i75481#
+ bDisable = TRUE;
+ // <--
+ }
+ else if( bHas && bOk )
+ bDisable = !lcl_UpdateContourDlg( rSh, nSel );
+ else if( bOk )
+ {
+ // --> OD 2007-07-04 #i75481#
+ // apply fix #i59688# only for selected graphics
+ if ( nSel & nsSelectionType::SEL_GRF )
+ bDisable = GRAPHIC_NONE == rSh.GetGraphicType();
+ else
+ bDisable = GRAPHIC_NONE == rSh.GetIMapGraphic().GetType();
+ // <--
+ }
+ // <--
+
+ if( bDisable )
+ rSet.DisableItem( nWhich );
+ else
+ rSet.Put( SfxBoolItem(nWhich, bHas) );
+ }
+ }
+ break;
+ case SID_CONTOUR_EXEC:
+ {
+ BOOL bDisable = FALSE;
+ int nSel = rSh.GetSelectionType();
+ if( !(nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE)) )
+ bDisable = TRUE;
+ USHORT nId = SvxContourDlgChildWindow::GetChildWindowId();
+ if( !bDisable && GetView().GetViewFrame()->HasChildWindow( nId ))
+ {
+ SvxContourDlg *pDlg = SWCONTOURDLG(GetView());
+ if( pDlg->GetEditingObject() != rSh.GetIMapInventor() )
+ bDisable = TRUE;
+ }
+ rSet.Put(SfxBoolItem(nWhich, bDisable));
+ }
+ break;
+
+ case FN_TOOL_ANKER:
+ case FN_TOOL_ANKER_PAGE:
+ case FN_TOOL_ANKER_PARAGRAPH:
+ case FN_TOOL_ANKER_CHAR:
+ case FN_TOOL_ANKER_AT_CHAR:
+ case FN_TOOL_ANKER_FRAME:
+ {
+ BOOL bObj = 0 != rSh.IsObjSelected();
+ BOOL bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+
+ if( !bParentCntProt && (bObj || rSh.IsFrmSelected()))
+ {
+ SfxItemSet aSet(GetPool(), RES_ANCHOR, RES_ANCHOR);
+ if(bObj)
+ rSh.GetObjAttr(aSet);
+ else
+ rSh.GetFlyFrmAttr(aSet);
+ RndStdIds eSet = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
+ const BOOL bSet =
+ ((nWhich == FN_TOOL_ANKER_PAGE) &&
+ (eSet == FLY_AT_PAGE))
+ || ((nWhich == FN_TOOL_ANKER_PARAGRAPH) &&
+ (eSet == FLY_AT_PARA))
+ || ((nWhich == FN_TOOL_ANKER_FRAME) &&
+ (eSet == FLY_AT_FLY))
+ || ((nWhich == FN_TOOL_ANKER_AT_CHAR) &&
+ (eSet == FLY_AT_CHAR))
+ || ((nWhich == FN_TOOL_ANKER_CHAR) &&
+ (eSet == FLY_AS_CHAR));
+ if(nWhich != FN_TOOL_ANKER)
+ {
+ USHORT nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
+ if( ( nWhich == FN_TOOL_ANKER_PAGE &&
+ ((HTMLMODE_ON & nHtmlMode) && (0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS)))) ||
+ ( nWhich == FN_TOOL_ANKER_FRAME && !rSh.IsFlyInFly() ) )
+ rSet.DisableItem(nWhich);
+ else
+ rSet.Put(SfxBoolItem(nWhich, bSet));
+ }
+ else
+ {
+ USHORT nSlotId = 0;
+
+ switch (eSet)
+ {
+ case FLY_AT_PAGE:
+ nSlotId = FN_TOOL_ANKER_PAGE;
+ break;
+ case FLY_AT_PARA:
+ nSlotId = FN_TOOL_ANKER_PARAGRAPH;
+ break;
+ case FLY_AS_CHAR:
+ nSlotId = FN_TOOL_ANKER_CHAR;
+ break;
+ case FLY_AT_CHAR:
+ nSlotId = FN_TOOL_ANKER_AT_CHAR;
+ break;
+ case FLY_AT_FLY:
+ nSlotId = FN_TOOL_ANKER_FRAME;
+ break;
+ default:
+ ;
+ }
+ rSet.Put(SfxUInt16Item(nWhich, nSlotId));
+ }
+ }
+ else
+ rSet.DisableItem( nWhich );
+ }
+ break;
+ case FN_FRAME_NOWRAP:
+ case FN_FRAME_WRAP:
+ case FN_FRAME_WRAP_IDEAL:
+ case FN_FRAME_WRAPTHRU:
+ case FN_FRAME_WRAPTHRU_TRANSP:
+ case FN_FRAME_WRAP_CONTOUR:
+ case FN_WRAP_ANCHOR_ONLY:
+ case FN_FRAME_WRAP_LEFT:
+ case FN_FRAME_WRAP_RIGHT:
+ {
+ BOOL bObj = 0 != rSh.IsObjSelected();
+ BOOL bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+
+ if( !bParentCntProt && (bObj || rSh.IsFrmSelected()))
+ {
+ SfxItemSet aSet(GetPool(), RES_OPAQUE, RES_ANCHOR);
+ int nAnchorType;
+ if(bObj)
+ {
+ rSh.GetObjAttr(aSet);
+ nAnchorType = rSh.GetAnchorId();
+ }
+ else
+ {
+ rSh.GetFlyFrmAttr(aSet);
+ nAnchorType = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
+ }
+ const SwFmtSurround& rWrap = (const SwFmtSurround&)aSet.Get(RES_SURROUND);
+
+ const SvxOpaqueItem& rOpaque = (const SvxOpaqueItem&)aSet.Get(RES_OPAQUE);
+ BOOL bOpaque = rOpaque.GetValue();
+ SwSurround nSurround = rWrap.GetSurround();
+ BOOL bSet = FALSE;
+
+ bool bDisable =
+ (nAnchorType == - 1) || (nAnchorType == FLY_AS_CHAR);
+ const bool bHtmlMode =
+ 0 != ::GetHtmlMode(GetView().GetDocShell());
+
+ switch( nWhich )
+ {
+ case FN_FRAME_NOWRAP:
+ bDisable |=
+ ( (nAnchorType != FLY_AT_PARA)
+ && (nAnchorType != FLY_AT_CHAR)
+ && (nAnchorType != FLY_AT_PAGE));
+ bSet = nSurround == SURROUND_NONE;
+ break;
+ case FN_FRAME_WRAP:
+ bDisable |= bHtmlMode;
+ bSet = nSurround == SURROUND_PARALLEL;
+ break;
+ case FN_FRAME_WRAP_IDEAL:
+ bDisable |= bHtmlMode;
+ bSet = nSurround == SURROUND_IDEAL;
+ break;
+ case FN_FRAME_WRAPTHRU:
+ bDisable |= (bHtmlMode ||
+ ( (nAnchorType != FLY_AT_PARA)
+ && (nAnchorType != FLY_AT_CHAR)
+ && (nAnchorType != FLY_AT_PAGE)));
+ if(bObj)
+ bSet = nSurround == SURROUND_THROUGHT && rSh.GetLayerId();
+ else
+ bSet = nSurround == SURROUND_THROUGHT && bOpaque;
+ break;
+ case FN_FRAME_WRAPTHRU_TRANSP:
+ bDisable |= bHtmlMode;
+ if(bObj)
+ bSet = nSurround == SURROUND_THROUGHT && !rSh.GetLayerId();
+ else
+ bSet = nSurround == SURROUND_THROUGHT && !bOpaque;
+ break;
+ case FN_FRAME_WRAP_CONTOUR:
+ bDisable |= bHtmlMode;
+ //no contour available whenn no wrap or wrap through is set
+ bDisable |= (nSurround == SURROUND_NONE || nSurround == SURROUND_THROUGHT);
+ bSet = rWrap.IsContour();
+ if( !bDisable )
+ {
+ int nSel = rSh.GetSelectionType();
+ if( (nSel & nsSelectionType::SEL_GRF) &&
+ rSh.IsGrfSwapOut(TRUE))
+ {
+ if( AddGrfUpdateSlot( nWhich ))
+ rSh.GetGraphic(FALSE); // start the loading
+ }
+ else if( rSh.IsFrmSelected() )
+ {
+ // #i102253# applied patch from OD (see task)
+ bDisable =
+ nSel & nsSelectionType::SEL_FRM ||
+ GRAPHIC_NONE == rSh.GetIMapGraphic().GetType();
+ }
+ }
+ bSet = bDisable ? FALSE : rWrap.IsContour();
+
+ break;
+ case FN_WRAP_ANCHOR_ONLY:
+ bDisable |= (bHtmlMode ||
+ (nAnchorType != FLY_AT_PARA));
+ bSet = rWrap.IsAnchorOnly();
+ break;
+ case FN_FRAME_WRAP_LEFT:
+ bSet = nSurround == SURROUND_LEFT;
+ break;
+ case FN_FRAME_WRAP_RIGHT:
+ bSet = nSurround == SURROUND_RIGHT;
+ break;
+ }
+
+ if(bDisable)
+ rSet.DisableItem(nWhich);
+ else
+ rSet.Put(SfxBoolItem(nWhich, bSet));
+ }
+ else
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case FN_UPDATE_CHARTS:
+ if( !rSh.HasCharts() )
+ rSet.DisableItem( nWhich );
+ break;
+ case FN_UPDATE_ALL_LINKS:
+ if ( !rSh.GetLinkManager().GetLinks().Count() )
+ rSet.DisableItem(nWhich);
+ break;
+ case FN_XFORMS_DESIGN_MODE:
+ // enable if in XForms document
+ if( rSh.GetDoc()->isXForms() )
+ {
+ // determine current state from view options
+ sal_Bool bValue = ! rSh.GetViewOptions()->IsFormView();
+ rSet.Put( SfxBoolItem( nWhich, bValue ) );
+ }
+ else
+ rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+ pGetStateSet = 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Slots mit dieser Statusmethode disablen
+ --------------------------------------------------------------------*/
+
+
+void SwBaseShell::StateDisableItems( SfxItemSet &rSet )
+{
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+
+ while (nWhich)
+ {
+ rSet.DisableItem( nWhich );
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Slots mit dieser Statusmethode disablen
+ --------------------------------------------------------------------*/
+
+
+void SwBaseShell::StateStyle( SfxItemSet &rSet )
+{
+ BOOL bParentCntProt = GetShell().IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+ ShellModes eMode = GetView().GetShellMode();
+
+ if ( bParentCntProt ||
+ SHELL_MODE_DRAW == eMode ||
+ SHELL_MODE_DRAW_CTRL == eMode ||
+ SHELL_MODE_DRAW_FORM == eMode ||
+ SHELL_MODE_DRAWTEXT == eMode ||
+ SHELL_MODE_BEZIER == eMode )
+ {
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+ while ( nWhich )
+ {
+ rSet.DisableItem( nWhich );
+ nWhich = aIter.NextWhich();
+ }
+ }
+ else
+ GetView().GetDocShell()->StateStyleSheet(rSet, &GetShell());
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwBaseShell::SetWrapMode( USHORT nSlot )
+{
+ SwWrtShell &rSh = GetShell();
+ BOOL bObj = 0 != rSh.IsObjSelected();
+ if( bObj || rSh.IsFrmSelected())
+ {
+ SfxItemSet aSet(GetPool(), RES_OPAQUE, RES_SURROUND);
+ if(bObj)
+ rSh.GetObjAttr(aSet);
+ else
+ rSh.GetFlyFrmAttr(aSet);
+ SwFmtSurround aWrap( (SwFmtSurround&)aSet.Get(RES_SURROUND) );
+ SwSurround nOldSurround(aWrap.GetSurround());
+ SwSurround nSurround = SURROUND_PARALLEL;
+
+ switch (nSlot)
+ {
+ case FN_FRAME_NOWRAP:
+ nSurround = SURROUND_NONE;
+ if (aWrap.IsContour())
+ aWrap.SetContour(FALSE);
+ break;
+ case FN_FRAME_WRAP_IDEAL:
+ nSurround = SURROUND_IDEAL;
+ break;
+ case FN_WRAP_ANCHOR_ONLY:
+ aWrap.SetAnchorOnly(!aWrap.IsAnchorOnly());
+ // --> OD 2006-06-02 #b6432130#
+ // keep previous wrapping
+ // --> OD 2006-09-21 #138144# - adjust fix #b6432130#
+ // switch to wrap SURROUND_PARALLEL, if previous wrap is SURROUND_NONE
+ if ( nOldSurround != SURROUND_NONE )
+ {
+ nSurround = nOldSurround;
+ }
+ // <--
+ break;
+ case FN_FRAME_WRAP_CONTOUR:
+ aWrap.SetContour(!aWrap.IsContour());
+ if (nSurround == SURROUND_THROUGHT)
+ nSurround = SURROUND_PARALLEL;
+ break;
+ case FN_FRAME_WRAPTHRU_TRANSP:
+ if (aWrap.IsContour())
+ aWrap.SetContour(FALSE);
+ // kein break!!!
+ case FN_FRAME_WRAPTHRU:
+ nSurround = SURROUND_THROUGHT;
+ break;
+
+ case FN_FRAME_WRAP_LEFT:
+ nSurround = SURROUND_LEFT;
+ break;
+
+ case FN_FRAME_WRAP_RIGHT:
+ nSurround = SURROUND_RIGHT;
+ break;
+
+ default:
+ break;
+ }
+ aWrap.SetSurround(nSurround);
+
+ if (nSlot != FN_FRAME_WRAP_CONTOUR)
+ {
+ // Konturumfluss bei Draw-Objekten defaulten
+ if (bObj && nOldSurround != nSurround &&
+ (nOldSurround == SURROUND_NONE || nOldSurround == SURROUND_THROUGHT))
+ {
+ aWrap.SetContour(TRUE);
+ }
+ }
+
+ aSet.Put( aWrap );
+ aSet.Put(SvxOpaqueItem(RES_OPAQUE, nSlot != FN_FRAME_WRAPTHRU_TRANSP));
+ if(bObj)
+ {
+ rSh.SetObjAttr(aSet);
+ if (nSlot != FN_FRAME_WRAPTHRU_TRANSP)
+ rSh.SelectionToHeaven();
+ else
+ rSh.SelectionToHell();
+ }
+ else
+ rSh.SetFlyFrmAttr(aSet);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Update der Statuszeile erzwingen
+ --------------------------------------------------------------------*/
+
+void SwBaseShell::SetFrmMode(FlyMode eMode, SwWrtShell *pSh )
+{
+ eFrameMode = eMode;
+ SfxBindings &rBnd = pSh->GetView().GetViewFrame()->GetBindings();
+
+ if( eMode == FLY_DRAG ||
+ (pSh && (pSh->IsFrmSelected() || pSh->IsObjSelected())) )
+ {
+ const SfxPointItem aTmp1( SID_ATTR_POSITION, pSh->GetAnchorObjDiff());
+ const SvxSizeItem aTmp2( SID_ATTR_SIZE, pSh->GetObjSize());
+ rBnd.SetState( aTmp1 );
+ rBnd.SetState( aTmp2 );
+ }
+ else if( eMode == FLY_DRAG_END )
+ {
+ static USHORT __READONLY_DATA aInval[] =
+ {
+ SID_ATTR_POSITION, SID_ATTR_SIZE, 0
+ };
+ rBnd.Invalidate(aInval);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ctor
+ --------------------------------------------------------------------*/
+
+SwBaseShell::SwBaseShell(SwView& rVw) :
+ SfxShell( &rVw ),
+ rView(rVw),
+ pGetStateSet(0)
+{
+ SwWrtShell& rWrtSh = rView.GetWrtShell();
+
+ SetPool(&rWrtSh.GetAttrPool());
+ SetName(C2S("Base"));
+ rWrtSh.SetGrfArrivedLnk( LINK( this, SwBaseShell, GraphicArrivedHdl));
+}
+
+
+SwBaseShell::~SwBaseShell()
+{
+ if( rView.GetCurShell() == this )
+ rView.ResetSubShell();
+
+ Link aTmp( LINK( this, SwBaseShell, GraphicArrivedHdl));
+ if( aTmp == rView.GetWrtShell().GetGrfArrivedLnk() )
+ rView.GetWrtShell().SetGrfArrivedLnk( Link() );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwBaseShell::ExecTxtCtrl( SfxRequest& rReq )
+{
+ const SfxItemSet *pArgs = rReq.GetArgs();
+
+ if( pArgs)
+ {
+ SwWrtShell &rSh = GetShell();
+ SvxScriptSetItem* pSSetItem = 0;
+ USHORT nSlot = rReq.GetSlot();
+ SfxItemPool& rPool = rSh.GetAttrPool();
+ USHORT nWhich = rPool.GetWhich( nSlot );
+ USHORT nScripts = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
+ SfxItemSet aHeightSet( GetPool(), RES_CHRATR_FONTSIZE, RES_CHRATR_FONTSIZE,
+ RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CJK_FONTSIZE,
+ RES_CHRATR_CTL_FONTSIZE, RES_CHRATR_CTL_FONTSIZE,
+ 0L);
+
+ switch( nSlot )
+ {
+ case SID_ATTR_CHAR_FONT:
+ {
+ nScripts = rSh.GetScriptType();
+ // #i42732# input language should be preferred over
+ // current cursor position to detect script type
+ if(!rSh.HasSelection())
+ {
+ LanguageType nInputLang = GetView().GetEditWin().GetInputLanguage();
+ if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
+ nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
+ }
+ }
+ case SID_ATTR_CHAR_POSTURE:
+ case SID_ATTR_CHAR_WEIGHT:
+ {
+ pSSetItem = new SvxScriptSetItem( nSlot, rPool );
+ pSSetItem->PutItemForScriptType( nScripts, pArgs->Get( nWhich ));
+ pArgs = &pSSetItem->GetItemSet();
+ }
+ break;
+ case SID_ATTR_CHAR_FONTHEIGHT:
+ {
+ if(rSh.HasSelection())
+ {
+ pSSetItem = new SvxScriptSetItem( nSlot, rPool );
+ pSSetItem->PutItemForScriptType( nScripts, pArgs->Get( nWhich ));
+ pArgs = &pSSetItem->GetItemSet();
+ }
+ else
+ {
+ nScripts = rSh.GetScriptType();
+ LanguageType nInputLang = GetView().GetEditWin().GetInputLanguage();
+ if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
+ nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
+ UINT32 nHeight = static_cast< const SvxFontHeightItem& >(pArgs->Get( nWhich )).GetHeight();
+ SwStdFontConfig* pStdFont = SW_MOD()->GetStdFontConfig();
+
+ SfxItemSet aLangSet( GetPool(), RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
+ RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
+ RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
+ 0L);
+ rSh.GetCurAttr( aLangSet );
+
+ sal_Int32 nWesternSize =
+ pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_DEFAULT,
+ static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_LANGUAGE)).GetLanguage());
+ sal_Int32 nCJKSize =
+ pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_CJK,
+ static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_CJK_LANGUAGE)).GetLanguage());
+ sal_Int32 nCTLSize =
+ pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_CTL,
+ static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_CTL_LANGUAGE)).GetLanguage());
+
+ switch(nScripts)
+ {
+ case SCRIPTTYPE_LATIN:
+ nCJKSize = nHeight * nCJKSize / nWesternSize;
+ nCTLSize = nHeight * nCTLSize / nWesternSize;
+ nWesternSize = (sal_Int32) nHeight;
+ break;
+ case SCRIPTTYPE_ASIAN:
+ nCTLSize = nHeight* nCTLSize / nCJKSize;
+ nWesternSize = nHeight * nWesternSize / nCJKSize;
+ nCJKSize = (sal_Int32) nHeight;
+ break;
+ case SCRIPTTYPE_COMPLEX:
+ nCJKSize = nHeight * nCJKSize / nCTLSize;
+ nWesternSize = nHeight * nWesternSize / nCTLSize;
+ nCTLSize = (sal_Int32) nHeight;
+ break;
+ }
+ aHeightSet.Put( SvxFontHeightItem( (UINT32)nWesternSize, 100, RES_CHRATR_FONTSIZE ));
+ aHeightSet.Put( SvxFontHeightItem( (UINT32)nCJKSize, 100, RES_CHRATR_CJK_FONTSIZE ));
+ aHeightSet.Put( SvxFontHeightItem( (UINT32)nCTLSize, 100, RES_CHRATR_CTL_FONTSIZE ));
+ pArgs = &aHeightSet;
+ }
+ }
+ break;
+ }
+
+ if( pArgs )
+ {
+ bool bAuto = false;
+ if ( !isCHRATR(nWhich) ||
+ ( rSh.HasSelection() && rSh.IsSelFullPara() ) )
+ {
+ SwTxtFmtColl * pColl = rSh.GetCurTxtFmtColl();
+ if ( pColl && pColl->IsAutoUpdateFmt() )
+ {
+ rSh.AutoUpdatePara( pColl, *pArgs );
+ bAuto = true;
+ }
+ }
+
+ if (!bAuto)
+ {
+ rSh.SetAttr( *pArgs );
+ }
+ }
+ delete pSSetItem;
+ }
+ else
+ GetView().GetViewFrame()->GetDispatcher()->Execute( SID_CHAR_DLG, FALSE);
+ rReq.Done();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwBaseShell::GetTxtCtrlState( SfxItemSet& rSet )
+{
+ SwWrtShell &rSh = GetShell();
+ rSh.GetCurAttr( rSet );
+}
+
+void SwBaseShell::GetTxtFontCtrlState( SfxItemSet& rSet )
+{
+ SwWrtShell &rSh = GetShell();
+ BOOL bFirst = TRUE;
+ SfxItemSet* pFntCoreSet = 0;
+ USHORT nScriptType = SCRIPTTYPE_LATIN;
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+ while( nWhich )
+ {
+ switch( nWhich )
+ {
+ case RES_CHRATR_FONT:
+ case RES_CHRATR_FONTSIZE:
+ case RES_CHRATR_WEIGHT:
+ case RES_CHRATR_POSTURE:
+ {
+ if( !pFntCoreSet )
+ {
+ pFntCoreSet = new SfxItemSet( *rSet.GetPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1 );
+ rSh.GetCurAttr( *pFntCoreSet );
+ nScriptType = rSh.GetScriptType();
+ // #i42732# input language should be preferred over
+ // current cursor position to detect script type
+ SwEditWin& rEditWin = GetView().GetEditWin();
+ if( rEditWin.IsUseInputLanguage() )
+ {
+ if(!rSh.HasSelection() && (
+ nWhich == RES_CHRATR_FONT ||
+ nWhich == RES_CHRATR_FONTSIZE ))
+ {
+ LanguageType nInputLang = rEditWin.GetInputLanguage();
+ if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
+ nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
+ }
+ }
+ }
+ SfxItemPool& rPool = *rSet.GetPool();
+ SvxScriptSetItem aSetItem( rPool.GetSlotId( nWhich ), rPool );
+ aSetItem.GetItemSet().Put( *pFntCoreSet, FALSE );
+ const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
+ if( pI )
+ rSet.Put( *pI, nWhich );
+ else
+ rSet.InvalidateItem( nWhich );
+ //set input context of the SwEditWin according to the selected font and script type
+ if(RES_CHRATR_FONT == nWhich)
+ {
+ Font aFont;
+ if(pI && pI->ISA(SvxFontItem))
+ {
+ aFont.SetName( ((const SvxFontItem*)pI)->GetFamilyName());
+ aFont.SetStyleName(((const SvxFontItem*)pI)->GetStyleName());
+ aFont.SetFamily(((const SvxFontItem*)pI)->GetFamily());
+ aFont.SetPitch(((const SvxFontItem*)pI)->GetPitch());
+ aFont.SetCharSet(((const SvxFontItem*)pI)->GetCharSet());
+ }
+
+ BOOL bVertical = rSh.IsInVerticalText();
+ aFont.SetOrientation(bVertical ? 2700 : 0);
+ aFont.SetVertical(bVertical);
+ GetView().GetEditWin().SetInputContext( InputContext( aFont, INPUTCONTEXT_TEXT |
+ INPUTCONTEXT_EXTTEXTINPUT ) );
+ }
+ }
+ break;
+
+ default:
+ if( bFirst )
+ {
+ rSh.GetCurAttr( rSet );
+ bFirst = FALSE;
+ }
+ }
+ nWhich = aIter.NextWhich();
+ }
+ delete pFntCoreSet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwBaseShell::GetBckColState(SfxItemSet &rSet)
+{
+ SwWrtShell &rSh = GetShell();
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+ int nSelType = rSh.GetSelectionType();
+
+// if ( nSelType & nsSelectionType::SEL_GRF ||
+ if( nSelType & nsSelectionType::SEL_OLE )
+ {
+ rSet.DisableItem( SID_BACKGROUND_COLOR );
+ return;
+ }
+
+ if ( nSelType & nsSelectionType::SEL_FRM )
+ {
+ BOOL bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+ if (bParentCntProt)
+ {
+ rSet.DisableItem( SID_BACKGROUND_COLOR );
+ return;
+ }
+ }
+
+ SvxBrushItem aBrushItem( RES_BACKGROUND );
+
+ if( nsSelectionType::SEL_TBL_CELLS & nSelType )
+ rSh.GetBoxBackground( aBrushItem );
+ else
+ {
+ SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
+ if( nSelType & nsSelectionType::SEL_GRF || nsSelectionType::SEL_FRM & nSelType )
+ rSh.GetFlyFrmAttr( aCoreSet );
+ else
+ rSh.GetCurAttr( aCoreSet );
+ aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND);
+ }
+
+ while ( nWhich )
+ {
+ switch(nWhich)
+ {
+ case SID_BACKGROUND_COLOR :
+ {
+ SvxColorItem aColorItem(aBrushItem.GetColor(), SID_BACKGROUND_COLOR);
+ rSet.Put( aColorItem, SID_BACKGROUND_COLOR );
+ }
+ break;
+ case SID_ATTR_BRUSH:
+ case RES_BACKGROUND:
+ rSet.Put( aBrushItem, GetPool().GetWhich(nWhich) );
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwBaseShell::ExecBckCol(SfxRequest& rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ int nSelType = rSh.GetSelectionType();
+ if ( nSelType & nsSelectionType::SEL_OLE )
+ {
+ return;
+ }
+
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ USHORT nSlot = rReq.GetSlot();
+ if( !pArgs && nSlot != SID_BACKGROUND_COLOR)
+ return ;
+
+ SvxBrushItem aBrushItem( RES_BACKGROUND );
+
+ if( nsSelectionType::SEL_TBL_CELLS & nSelType )
+ {
+ rSh.GetBoxBackground( aBrushItem );
+ }
+ else
+ {
+ SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
+ if( (nsSelectionType::SEL_FRM & nSelType) || (nsSelectionType::SEL_GRF & nSelType) )
+ rSh.GetFlyFrmAttr( aCoreSet );
+ else
+ rSh.GetCurAttr( aCoreSet );
+ aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND);
+ }
+
+// BOOL bMsgOk = FALSE;
+
+ switch (nSlot)
+ {
+ // RES_BACKGROUND (=SID_ATTR_BRUSH) muss ueber zwei IDs
+ // gesetzt werden:
+ case SID_BACKGROUND_COLOR:
+ {
+ aBrushItem.SetGraphicPos(GPOS_NONE);
+
+ //Brush &rBrush = aBrushItem.GetBrush();
+ if(pArgs)
+ {
+ const SvxColorItem& rNewColorItem = (const SvxColorItem&)
+ pArgs->Get(SID_BACKGROUND_COLOR);
+ const Color& rNewColor = rNewColorItem.GetValue();
+ aBrushItem.SetColor( rNewColor );
+ GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem);
+ }
+ else
+ {
+ aBrushItem.SetColor( COL_TRANSPARENT );
+ rReq.AppendItem( SvxColorItem( Color( COL_TRANSPARENT ), nSlot ) );
+ }
+ }
+ break;
+
+ case SID_ATTR_BRUSH:
+ case RES_BACKGROUND:
+ {
+ const SvxBrushItem& rNewBrushItem = (const SvxBrushItem&)
+ pArgs->Get( GetPool().GetWhich(nSlot) );
+ aBrushItem = rNewBrushItem;
+ }
+ break;
+ default:
+// bMsgOk = FALSE;
+ rReq.Ignore();
+ DBG_ERROR( "Unbekannte Message bei ExecuteAttr!" );
+ return;
+ }
+
+ if( nsSelectionType::SEL_TBL_CELLS & nSelType )
+ {
+ rSh.SetBoxBackground( aBrushItem );
+ }
+ else if( (nsSelectionType::SEL_FRM & nSelType) ||
+ (nsSelectionType::SEL_GRF & nSelType) )
+ {
+ SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
+ aCoreSet.Put( aBrushItem );
+ // Vorlagen-AutoUpdate
+ SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
+ if(pFmt && pFmt->IsAutoUpdateFmt())
+ rSh.AutoUpdateFrame( pFmt, aCoreSet);
+ else
+ rSh.SetFlyFrmAttr( aCoreSet );
+ }
+ else
+ {
+ SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
+ if( pColl && pColl->IsAutoUpdateFmt())
+ {
+ SfxItemSet aSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND );
+ aSet.Put(aBrushItem);
+ rSh.AutoUpdatePara( pColl, aSet);
+ }
+ else
+ rSh.SetAttr( aBrushItem );
+ }
+
+ rReq.Done();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwBaseShell::GetBorderState(SfxItemSet &rSet)
+{
+ SwWrtShell &rSh = GetShell();
+ // Tabellenzelle(n) selektiert?
+ BOOL bPrepare = TRUE;
+ BOOL bTableMode = rSh.IsTableMode();
+ if ( bTableMode )
+ {
+ SfxItemSet aCoreSet( GetPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
+ SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+ aCoreSet.Put( aBoxInfo );
+ rSh.GetTabBorders( aCoreSet );
+ rSet.Put( aCoreSet );
+ }
+ else if ( rSh.IsFrmSelected() )
+ {
+ SwFlyFrmAttrMgr aMgr( FALSE, &rSh, FRMMGR_TYPE_NONE );
+ rSet.Put( aMgr.GetAttrSet() );
+ bPrepare = FALSE;
+ }
+ else
+ // Umrandungsattribute ganz normal ueber Shell holen
+ rSh.GetCurAttr( rSet );
+ if ( bPrepare )
+ ::PrepareBoxInfo( rSet, rSh );
+ // switch the border toolbox controller mode
+ rSet.Put( SfxBoolItem( SID_BORDER_REDUCED_MODE, !bTableMode ));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwBaseShell::ExecDlg(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ Window *pMDI = &GetView().GetViewFrame()->GetWindow();
+ //Damit aus dem Basic keine Dialoge fuer Hintergrund-Views aufgerufen werden:
+ BOOL bBackground = (&GetView() != GetActiveView());
+ const SfxPoolItem* pItem = 0;
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ USHORT nSlot = rReq.GetSlot();
+ const SfxItemSet* pOutSet = 0;
+ bool bDone = false;
+ if(pArgs)
+ pArgs->GetItemState( GetPool().GetWhich(nSlot), FALSE, &pItem );
+
+ switch ( nSlot )
+ {
+ case FN_FORMAT_PAGE_COLUMN_DLG:
+ case FN_FORMAT_PAGE_DLG:
+ {
+ if( !bBackground )
+ {
+ const USHORT nCurIdx = rSh.GetCurPageDesc();
+ const SwPageDesc& rPageDesc = rSh.GetPageDesc( nCurIdx );
+ //temp. View, weil die Shell nach dem Dialog nicht mehr gueltig sein muss
+ //z.B. Kopfzeile ausschalten
+ SwView& rTempView = GetView();
+ rTempView.GetDocShell()->FormatPage(rPageDesc.GetName(),
+ nSlot == FN_FORMAT_PAGE_COLUMN_DLG,
+ &rSh );
+ rTempView.InvalidateRulerPos();
+ }
+ }
+ break;
+ case FN_FORMAT_BORDER_DLG:
+ {
+ SfxItemSet aSet( rSh.GetAttrPool(),
+ RES_BOX , RES_SHADOW,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ 0 );
+ SfxAbstractDialog * pDlg = 0;
+ // Tabellenzelle(n) selektiert?
+ if ( rSh.IsTableMode() )
+ {
+ // Umrandungattribute Get/SetTabBorders() setzen
+ ::PrepareBoxInfo( aSet, rSh );
+ rSh.GetTabBorders( aSet );
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_TABLE, RC_DLG_SWBORDERDLG );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if ( pDlg->Execute() == RET_OK )
+ {
+ rSh.SetTabBorders( *pDlg->GetOutputItemSet() );
+ pOutSet = pDlg->GetOutputItemSet();
+ }
+ }
+ else if ( rSh.IsFrmSelected() )
+ {
+ // Umrandungsattribute ueber Frame-Manager setzen
+ SwFlyFrmAttrMgr aMgr( FALSE, &rSh, FRMMGR_TYPE_NONE );
+ aSet.Put( aMgr.GetAttrSet() );
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_FRAME, RC_DLG_SWBORDERDLG );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if ( pDlg->Execute() == RET_OK )
+ {
+ aMgr.SetAttrSet( *pDlg->GetOutputItemSet() );
+ aMgr.UpdateFlyFrm();
+ pOutSet = pDlg->GetOutputItemSet();
+ }
+ }
+ else
+ {
+ // Umrandungsattribute ganz normal ueber Shell setzen
+ rSh.GetCurAttr( aSet );
+ ::PrepareBoxInfo( aSet, rSh );
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_PARA, RC_DLG_SWBORDERDLG );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if ( pDlg->Execute() == RET_OK )
+ {
+ rSh.SetAttr( *pDlg->GetOutputItemSet() );
+ pOutSet = pDlg->GetOutputItemSet();
+ }
+ }
+ if(pOutSet)
+ {
+ rReq.Done(*pOutSet);
+ bDone = true;
+ }
+ delete pDlg;
+ }
+ break;
+ case FN_FORMAT_BACKGROUND_DLG:
+ {
+ SfxItemSet aSet( rSh.GetAttrPool(),
+ RES_BACKGROUND, RES_BACKGROUND );
+
+ SfxAbstractDialog * pDlg = 0;
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+
+ // Tabellenzelle(n) selektiert?
+ if ( rSh.IsTableMode() )
+ {
+ //Hintergrundattribute der Tabelle holen und in den Set packen
+ SvxBrushItem aBrush(RES_BACKGROUND);
+ rSh.GetBoxBackground( aBrush );
+ pDlg = pFact->CreateSfxDialog( pMDI, aSet,
+ rView.GetViewFrame()->GetFrame().GetFrameInterface(),
+ RC_SWDLG_BACKGROUND );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ aSet.Put( aBrush );
+ if ( pDlg->Execute() == RET_OK )
+ {
+ //aBrush = (SvxBrushItem) pDlg->GetOutputItemSet()->Get( RES_BACKGROUND );
+
+ rSh.SetBoxBackground( (SvxBrushItem&)
+ pDlg->GetOutputItemSet()->Get( RES_BACKGROUND ));
+ pOutSet = pDlg->GetOutputItemSet();
+ }
+ }
+ else if ( rSh.IsFrmSelected() )
+ {
+
+ rSh.GetFlyFrmAttr( aSet );
+
+ pDlg = pFact->CreateSfxDialog( pMDI, aSet,
+ rView.GetViewFrame()->GetFrame().GetFrameInterface(),
+ RC_SWDLG_BACKGROUND );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if ( pDlg->Execute() == RET_OK )
+ {
+ rSh.SetFlyFrmAttr((SfxItemSet &) *pDlg->GetOutputItemSet() );
+ pOutSet = pDlg->GetOutputItemSet();
+ }
+ }
+ else
+ {
+ // Umrandungsattribute ganz normal ueber Shell setzen
+ rSh.GetCurAttr( aSet );
+
+ pDlg = pFact->CreateSfxDialog( pMDI, aSet,
+ rView.GetViewFrame()->GetFrame().GetFrameInterface(),
+ RC_SWDLG_BACKGROUND );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if ( pDlg->Execute() == RET_OK )
+ {
+ rSh.SetAttr( *pDlg->GetOutputItemSet() );
+ pOutSet = pDlg->GetOutputItemSet();
+ }
+ }
+ if(pOutSet)
+ {
+ rReq.Done(*pOutSet);
+ bDone = true;
+ }
+ delete pDlg;
+
+ }
+ break;
+ default:DBG_ERROR("falscher Dispatcher (basesh.cxx)");
+ }
+ if(!bDone)
+ rReq.Done();
+}
+
+// ----------------------------------------------------------------------------
+
+
+SwWrtShell& SwBaseShell::GetShell()
+{
+ return rView.GetWrtShell();
+}
+
+// ----------------------------------------------------------------------------
+
+SwWrtShell* SwBaseShell::GetShellPtr()
+{
+ return rView.GetWrtShellPtr();
+}
+
+// ----------------------------------------------------------------------------
+
+void SwBaseShell::InsertTable( SfxRequest& _rRequest )
+{
+ const SfxItemSet* pArgs = _rRequest.GetArgs();
+ SwWrtShell& rSh = GetShell();
+
+ if ( !( rSh.GetFrmType( 0, TRUE ) & FRMTYPE_FOOTNOTE ) )
+ {
+ SwView &rTempView = GetView(); // Da GetView() nach Shellwechsel nicht mehr geht
+ BOOL bHTMLMode = 0 != (::GetHtmlMode(rTempView.GetDocShell())&HTMLMODE_ON);
+ BOOL bCallEndUndo = FALSE;
+
+ if( !pArgs && rSh.IsSelection() && !rSh.IsInClickToEdit() &&
+ !rSh.IsTableMode() )
+ {
+ const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+ SwInsertTableOptions aInsTblOpts = pModOpt->GetInsTblFlags(bHTMLMode);
+
+ rSh.StartUndo(UNDO_INSTABLE);
+ bCallEndUndo = TRUE;
+
+ BOOL bInserted = rSh.TextToTable( aInsTblOpts, '\t', text::HoriOrientation::FULL );
+ rSh.EnterStdMode();
+ if (bInserted)
+ rTempView.AutoCaption(TABLE_CAP);
+ _rRequest.Done();
+ }
+ else
+ {
+ USHORT nCols = 0;
+ USHORT nRows = 0;
+ SwInsertTableOptions aInsTblOpts( tabopts::ALL_TBL_INS_ATTR, 1 );
+ String aTableName, aAutoName;
+ SwTableAutoFmt* pTAFmt = 0;
+
+ if( pArgs && pArgs->Count() >= 2 )
+ {
+ SFX_REQUEST_ARG( _rRequest, pName, SfxStringItem, FN_INSERT_TABLE, sal_False );
+ SFX_REQUEST_ARG( _rRequest, pCols, SfxUInt16Item, SID_ATTR_TABLE_COLUMN, sal_False );
+ SFX_REQUEST_ARG( _rRequest, pRows, SfxUInt16Item, SID_ATTR_TABLE_ROW, sal_False );
+ SFX_REQUEST_ARG( _rRequest, pFlags, SfxInt32Item, FN_PARAM_1, sal_False );
+ SFX_REQUEST_ARG( _rRequest, pAuto, SfxStringItem, FN_PARAM_2, sal_False );
+
+ if ( pName )
+ aTableName = pName->GetValue();
+ if ( pCols )
+ nCols = pCols->GetValue();
+ if ( pRows )
+ nRows = pRows->GetValue();
+ if ( pAuto )
+ {
+ aAutoName = pAuto->GetValue();
+ if ( aAutoName.Len() )
+ {
+ SwTableAutoFmtTbl aTableTbl;
+ aTableTbl.Load();
+ for ( USHORT n=0; n<aTableTbl.Count(); n++ )
+ {
+ if ( aTableTbl[n]->GetName() == aAutoName )
+ {
+ pTAFmt = new SwTableAutoFmt( *aTableTbl[n] );
+ break;
+ }
+ }
+ }
+ }
+
+ if ( pFlags )
+ aInsTblOpts.mnInsMode = (USHORT) pFlags->GetValue();
+ else
+ {
+ const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+ aInsTblOpts = pModOpt->GetInsTblFlags(bHTMLMode);
+ }
+ }
+
+ if( !nCols || !nRows )
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractInsTableDlg* pDlg = pFact->CreateInsTableDlg( DLG_INSERT_TABLE, rTempView );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if( RET_OK == pDlg->Execute() )
+ {
+ pDlg->GetValues( aTableName, nRows, nCols, aInsTblOpts, aAutoName, pTAFmt );
+ }
+ else
+ _rRequest.Ignore();
+ delete pDlg;
+ }
+
+ if( nCols && nRows )
+ {
+ // record before shell change
+ _rRequest.AppendItem( SfxStringItem( FN_INSERT_TABLE, aTableName ) );
+ if ( aAutoName.Len() )
+ _rRequest.AppendItem( SfxStringItem( FN_PARAM_2, aAutoName ) );
+ _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN, nCols ) );
+ _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW, nRows ) );
+ _rRequest.AppendItem( SfxInt32Item( FN_PARAM_1, (sal_Int32) aInsTblOpts.mnInsMode ) );
+ _rRequest.Done();
+
+ rSh.StartUndo(UNDO_INSTABLE);
+ bCallEndUndo = TRUE;
+
+ rSh.StartAllAction();
+ if( rSh.HasSelection() )
+ rSh.DelRight();
+
+ rSh.InsertTable( aInsTblOpts, nRows, nCols, text::HoriOrientation::FULL, pTAFmt );
+ rSh.MoveTable( fnTablePrev, fnTableStart );
+
+ if( aTableName.Len() && !rSh.GetTblStyle( aTableName ) )
+ rSh.GetTableFmt()->SetName( aTableName );
+
+ rSh.EndAllAction();
+ rTempView.AutoCaption(TABLE_CAP);
+ }
+ delete pTAFmt;
+ }
+
+ if( bCallEndUndo )
+ {
+ SwRewriter aRewriter;
+
+ if (rSh.GetTableFmt())
+ {
+ aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_START_QUOTE));
+ aRewriter.AddRule(UNDO_ARG2, rSh.GetTableFmt()->GetName());
+ aRewriter.AddRule(UNDO_ARG3, SW_RES(STR_END_QUOTE));
+
+ }
+ rSh.EndUndo(UNDO_INSTABLE, &aRewriter); // wegen moegl. Shellwechsel
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+void SwBaseShell::GetGalleryState( SfxItemSet &rSet )
+{
+ SwWrtShell &rSh = GetShell();
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+ switch ( nWhich )
+ {
+ case SID_GALLERY_BG_BRUSH:
+ {
+ int nSel = rSh.GetSelectionType();
+ SfxStringListItem aLst( nWhich );
+ List *pLst = aLst.GetList();
+ nParagraphPos = nGraphicPos = nOlePos = nFramePos = nTablePos =
+ nTableRowPos = nTableCellPos = nPagePos =
+ nHeaderPos = nFooterPos = 0;
+ BYTE nPos = 1;
+ pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_PAGE ), pLst->Count() );
+ nPagePos = nPos++;
+ USHORT nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
+ BOOL bHtmlMode = 0 != (nHtmlMode & HTMLMODE_ON);
+
+ if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_FULL_STYLES)) &&
+ (nSel & nsSelectionType::SEL_TXT) )
+ {
+ pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_PARAGRAPH ), pLst->Count() );
+ nParagraphPos = nPos++;
+ }
+ if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_SOME_STYLES)) &&
+ nSel & (nsSelectionType::SEL_TBL|nsSelectionType::SEL_TBL_CELLS) )
+ {
+ pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE ), pLst->Count() );
+ nTablePos = nPos++;
+
+ if(!bHtmlMode)
+ {
+ pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE_ROW ), pLst->Count() );
+ nTableRowPos = nPos++;
+ }
+
+ pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_TABLE_CELL), pLst->Count() );
+ nTableCellPos = nPos++;
+ }
+ if(!bHtmlMode)
+ {
+ if ( nSel & nsSelectionType::SEL_FRM )
+ {
+ pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_FRAME ), pLst->Count() );
+ nFramePos = nPos++;
+ }
+ if ( nSel & nsSelectionType::SEL_GRF )
+ {
+ pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_GRAPHIC ), pLst->Count() );
+ nGraphicPos = nPos++;
+ }
+ if ( nSel & nsSelectionType::SEL_OLE )
+ {
+ pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_OLE ), pLst->Count() );
+ nOlePos = nPos++;
+ }
+ const USHORT nType = rSh.GetFrmType(0,TRUE);
+ if ( nType & FRMTYPE_HEADER )
+ {
+ pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_HEADER ), pLst->Count() );
+ nHeaderPos = nPos++;
+ }
+ if ( nType & FRMTYPE_FOOTER )
+ {
+ pLst->Insert( (void*) new SW_RESSTR( STR_SWBG_FOOTER ), pLst->Count() );
+ nFooterPos = nPos;
+ }
+ }
+ if ( pLst->Count() )
+ rSet.Put( aLst );
+ else
+ rSet.DisableItem( nWhich );
+ break;
+ }
+ }
+}
+
+
+void SwBaseShell::ExecuteGallery(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ rSh.StartAction();
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ USHORT nSlot = rReq.GetSlot();
+ switch(nSlot)
+ {
+ case SID_GALLERY_BG_BRUSH:
+ {
+ int nSel = rSh.GetSelectionType();
+ if ( nSel & nsSelectionType::SEL_DRW_TXT )
+ break;
+
+ BYTE nPos = (BYTE)((SfxUInt16Item &)pArgs->Get(SID_GALLERY_BG_POS)).GetValue();
+ ++nPos;
+
+ SvxBrushItem aBrush( (SvxBrushItem&)pArgs->Get(SID_GALLERY_BG_BRUSH));
+ aBrush.SetWhich( RES_BACKGROUND );
+ if ( nPos == nParagraphPos )
+ rSh.SetAttr( aBrush );
+ else if ( nPos == nTablePos )
+ rSh.SetTabBackground( aBrush );
+ else if ( nPos == nTableRowPos )
+ rSh.SetRowBackground( aBrush );
+ else if ( nPos == nTableCellPos )
+ rSh.SetBoxBackground( aBrush );
+ else if ( nPos == nFramePos || nPos == nGraphicPos || nPos == nOlePos )
+ {
+ SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
+ aCoreSet.Put( aBrush );
+ rSh.SetFlyFrmAttr( aCoreSet );
+ }
+ else if ( nPos == nPagePos || nPos == nHeaderPos || nPos == nFooterPos )
+ {
+ USHORT nDesc = rSh.GetCurPageDesc();
+ SwPageDesc aDesc( rSh.GetPageDesc( nDesc ) );
+ if ( nPos == nPagePos )
+ aDesc.GetMaster().SetFmtAttr( aBrush );
+ else if ( nPos == nHeaderPos )
+ {
+ SwFmtHeader aHead( aDesc.GetMaster().GetHeader() );
+ aHead.GetHeaderFmt()->SetFmtAttr( aBrush );
+ aDesc.GetMaster().SetFmtAttr( aHead );
+ }
+ else if ( nPos == nFooterPos )
+ {
+ SwFmtFooter aFoot( aDesc.GetMaster().GetFooter() );
+ aFoot.GetFooterFmt()->SetFmtAttr( aBrush );
+ aDesc.GetMaster().SetFmtAttr( aFoot );
+ }
+ rSh.ChgPageDesc( nDesc, aDesc );
+ }
+ break;
+ }
+ }
+ rSh.EndAction();
+ rReq.Done();
+}
+
+void SwBaseShell::ExecField( SfxRequest& rReq )
+{
+ USHORT nSlot = rReq.GetSlot();
+ switch( nSlot )
+ {
+ case FN_CHANGE_DBFIELD:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ VclAbstractDialog* pDlg = pFact->CreateSwChangeDBDlg(GetView(), DLG_CHANGE_DB );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ }
+ break;
+ default:
+ ASSERT(FALSE, falscher Dispatcher);
+ }
+}
+
diff --git a/sw/source/ui/shells/beziersh.cxx b/sw/source/ui/shells/beziersh.cxx
new file mode 100644
index 000000000000..cc6a3176643f
--- /dev/null
+++ b/sw/source/ui/shells/beziersh.cxx
@@ -0,0 +1,356 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include "cmdid.h"
+#include <svx/svdview.hxx>
+#include <svl/srchitem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/whiter.hxx>
+#include <svx/svdopath.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objface.hxx>
+
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "edtwin.hxx"
+#include "helpid.h"
+#include "globals.hrc"
+#include "drawbase.hxx"
+#include "beziersh.hxx"
+#include "popup.hrc"
+#include "shells.hrc"
+#define SwBezierShell
+#include <sfx2/msg.hxx>
+#include "swslots.hxx"
+
+#include <unomid.h>
+
+
+SFX_IMPL_INTERFACE(SwBezierShell, SwBaseShell, SW_RES(STR_SHELLNAME_BEZIER))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_DRAW_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_BEZIER_TOOLBOX));
+}
+
+TYPEINIT1(SwBezierShell,SwBaseShell)
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwBezierShell::SwBezierShell(SwView &_rView):
+ SwBaseShell( _rView )
+{
+ SetName(C2S("Bezier"));
+ SetHelpId(SW_BEZIERSHELL);
+
+ SwWrtShell *pSh = &GetShell();
+ SdrView* pSdrView = pSh->GetDrawView();
+ pSdrView->SetEliminatePolyPointLimitAngle(1500L);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwBezierShell::Execute(SfxRequest &rReq)
+{
+ SwWrtShell *pSh = &GetShell();
+ SdrView* pSdrView = pSh->GetDrawView();
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ USHORT nSlotId = rReq.GetSlot();
+ BOOL bChanged = pSdrView->GetModel()->IsChanged();
+ pSdrView->GetModel()->SetChanged(FALSE);
+ const SfxPoolItem* pItem;
+ if(pArgs)
+ pArgs->GetItemState(nSlotId, FALSE, &pItem);
+
+ switch (nSlotId)
+ {
+ case SID_DELETE:
+ case FN_BACKSPACE:
+ if (pSh->IsObjSelected())
+ {
+ if (pSdrView->HasMarkedPoints())
+ pSh->GetView().GetViewFrame()->GetDispatcher()->Execute(SID_BEZIER_DELETE, FALSE);
+ else
+ {
+ pSh->DelSelectedObj();
+ if (pSh->IsSelFrmMode())
+ {
+ pSh->LeaveSelFrmMode();
+ pSh->NoEdit();
+ }
+ GetView().AttrChangedNotify(pSh); // ggf Shellwechsel...
+ }
+ }
+ break;
+
+ case FN_ESCAPE:
+ if (pSdrView->HasMarkedPoints())
+ pSdrView->UnmarkAllPoints();
+ else
+ {
+ if ( pSh->IsDrawCreate() )
+ {
+ GetView().GetDrawFuncPtr()->BreakCreate();
+ GetView().AttrChangedNotify(pSh); // ggf Shellwechsel...
+ }
+ else if ( pSh->HasSelection() || GetView().IsDrawMode() )
+ {
+ GetView().LeaveDrawCreate();
+ pSh->EnterStdMode();
+ GetView().AttrChangedNotify(pSh); // ggf Shellwechsel...
+ }
+ }
+ break;
+
+ case SID_BEZIER_MOVE:
+ case SID_BEZIER_INSERT:
+ {
+ GetView().GetEditWin().SetBezierMode(nSlotId);
+ static USHORT __READONLY_DATA aInva[] =
+ {
+ SID_BEZIER_INSERT,
+ SID_BEZIER_MOVE,
+ 0
+ };
+ GetView().GetViewFrame()->GetBindings().Invalidate(aInva);
+ }
+ break;
+
+ case SID_BEZIER_DELETE:
+ case SID_BEZIER_CUTLINE:
+ case SID_BEZIER_CONVERT:
+ case SID_BEZIER_EDGE:
+ case SID_BEZIER_SMOOTH:
+ case SID_BEZIER_SYMMTR:
+ case SID_BEZIER_CLOSE:
+ case SID_BEZIER_ELIMINATE_POINTS:
+ {
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+
+ if (rMarkList.GetMark(0) && !pSdrView->IsAction())
+ {
+ switch (nSlotId)
+ {
+ case SID_BEZIER_DELETE:
+ pSdrView->DeleteMarkedPoints();
+ break;
+
+ case SID_BEZIER_CUTLINE:
+ {
+ pSdrView->RipUpAtMarkedPoints();
+ pSh->CheckUnboundObjects();
+ }
+ break;
+
+ case SID_BEZIER_CONVERT:
+ {
+ pSdrView->SetMarkedSegmentsKind(SDRPATHSEGMENT_TOGGLE);
+ break;
+ }
+
+ case SID_BEZIER_EDGE:
+ case SID_BEZIER_SMOOTH:
+ case SID_BEZIER_SYMMTR:
+ {
+ SdrPathSmoothKind eKind = SDRPATHSMOOTH_ASYMMETRIC;
+
+ switch (nSlotId)
+ {
+ case SID_BEZIER_EDGE: eKind = SDRPATHSMOOTH_ANGULAR; break;
+ case SID_BEZIER_SMOOTH: eKind = SDRPATHSMOOTH_ASYMMETRIC; break;
+ case SID_BEZIER_SYMMTR: eKind = SDRPATHSMOOTH_SYMMETRIC; break;
+ }
+
+ SdrPathSmoothKind eSmooth = pSdrView->GetMarkedPointsSmooth();
+ if (eKind != eSmooth)
+ {
+ pSdrView->SetMarkedPointsSmooth(eKind);
+
+ static USHORT __READONLY_DATA aInva[] =
+ {
+ SID_BEZIER_SMOOTH,
+ SID_BEZIER_EDGE,
+ SID_BEZIER_SYMMTR,
+ 0
+ };
+ GetView().GetViewFrame()->GetBindings().Invalidate(aInva);
+ }
+ break;
+ }
+
+ case SID_BEZIER_CLOSE:
+ {
+ SdrPathObj* pPathObj = (SdrPathObj*) rMarkList.GetMark(0)->GetMarkedSdrObj();
+ pSdrView->UnmarkAllPoints();
+ // Size aDist(GetView().GetEditWin().PixelToLogic(Size(8,8)));
+ pPathObj->ToggleClosed(); // aDist.Width());
+ break;
+ }
+
+ case SID_BEZIER_ELIMINATE_POINTS:
+ pSdrView->SetEliminatePolyPoints(!pSdrView->IsEliminatePolyPoints());
+ break;
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if (pSdrView->GetModel()->IsChanged())
+ GetShell().SetModified();
+ else if (bChanged)
+ pSdrView->GetModel()->SetChanged(TRUE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwBezierShell::GetState(SfxItemSet &rSet)
+{
+ SdrView* pSdrView = GetShell().GetDrawView();
+
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+
+ while( nWhich )
+ {
+ switch( nWhich )
+ {
+ case SID_BEZIER_MOVE:
+ case SID_BEZIER_INSERT:
+ {
+ USHORT nEditMode = GetView().GetEditWin().GetBezierMode();
+
+ rSet.Put(SfxBoolItem(nWhich, nEditMode == nWhich));
+ }
+ break;
+
+ case SID_BEZIER_CUTLINE:
+ if (!pSdrView->IsRipUpAtMarkedPointsPossible())
+ {
+ rSet.DisableItem(SID_BEZIER_CUTLINE);
+ }
+ break;
+
+ case SID_BEZIER_DELETE:
+ if (!pSdrView->IsDeleteMarkedPointsPossible())
+ {
+ rSet.DisableItem(SID_BEZIER_DELETE);
+ }
+ break;
+
+ case SID_BEZIER_CONVERT:
+ if (!pSdrView->IsSetMarkedSegmentsKindPossible())
+ {
+ rSet.DisableItem(SID_BEZIER_CONVERT);
+ }
+ else
+ {
+ SdrPathSegmentKind eSegm = pSdrView->GetMarkedSegmentsKind();
+ switch (eSegm)
+ {
+ case SDRPATHSEGMENT_DONTCARE: rSet.InvalidateItem(SID_BEZIER_CONVERT); break;
+ case SDRPATHSEGMENT_LINE : rSet.Put(SfxBoolItem(SID_BEZIER_CONVERT,FALSE)); break; // Button reingedrueckt = Kurve
+ case SDRPATHSEGMENT_CURVE : rSet.Put(SfxBoolItem(SID_BEZIER_CONVERT,TRUE)); break;
+ default:; //prevent warning
+ }
+ }
+ break;
+
+ case SID_BEZIER_EDGE:
+ case SID_BEZIER_SMOOTH:
+ case SID_BEZIER_SYMMTR:
+ if (!pSdrView->IsSetMarkedPointsSmoothPossible())
+ rSet.DisableItem(nWhich);
+ else
+ {
+ SdrPathSmoothKind eSmooth = pSdrView->GetMarkedPointsSmooth();
+ BOOL bEnable = FALSE;
+ switch (eSmooth)
+ {
+ case SDRPATHSMOOTH_DONTCARE :
+ break;
+ case SDRPATHSMOOTH_ANGULAR :
+ bEnable = nWhich == SID_BEZIER_EDGE;
+ break;
+ case SDRPATHSMOOTH_ASYMMETRIC:
+ bEnable = nWhich == SID_BEZIER_SMOOTH;
+ break;
+ case SDRPATHSMOOTH_SYMMETRIC :
+ bEnable = nWhich == SID_BEZIER_SYMMTR;
+ break;
+ }
+ rSet.Put(SfxBoolItem(nWhich, bEnable));
+ }
+ break;
+
+ case SID_BEZIER_CLOSE:
+ if (!pSdrView->IsOpenCloseMarkedObjectsPossible())
+ {
+ rSet.DisableItem(SID_BEZIER_CLOSE);
+ }
+ else
+ {
+ SdrObjClosedKind eClose = pSdrView->GetMarkedObjectsClosedState();
+ switch (eClose)
+ {
+ case SDROBJCLOSED_DONTCARE: rSet.InvalidateItem(SID_BEZIER_CLOSE); break;
+ case SDROBJCLOSED_OPEN : rSet.Put(SfxBoolItem(SID_BEZIER_CLOSE,FALSE)); break;
+ case SDROBJCLOSED_CLOSED : rSet.Put(SfxBoolItem(SID_BEZIER_CLOSE,TRUE)); break;
+ default:; //prevent warning
+ }
+ }
+ break;
+
+ case SID_BEZIER_ELIMINATE_POINTS:
+ rSet.Put(SfxBoolItem(SID_BEZIER_ELIMINATE_POINTS, pSdrView->IsEliminatePolyPoints()));
+ break;
+
+ default:
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+
+
diff --git a/sw/source/ui/shells/drawdlg.cxx b/sw/source/ui/shells/drawdlg.cxx
new file mode 100644
index 000000000000..56b783a25711
--- /dev/null
+++ b/sw/source/ui/shells/drawdlg.cxx
@@ -0,0 +1,259 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+
+
+#ifndef _SVX_SVXIDS_HRC //autogen
+#include <svx/svxids.hrc>
+#endif
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdview.hxx>
+#include <svx/tabarea.hxx>
+#include <svx/tabline.hxx>
+#include <svx/drawitem.hxx>
+
+#include <svx/xtable.hxx>
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "docsh.hxx"
+#include "cmdid.h"
+
+#include "drawsh.hxx"
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwDrawShell::ExecDrawDlg(SfxRequest& rReq)
+{
+ SwWrtShell* pSh = &GetShell();
+ SdrView* pView = pSh->GetDrawView();
+ SdrModel* pDoc = pView->GetModel();
+ BOOL bChanged = pDoc->IsChanged();
+ pDoc->SetChanged(FALSE);
+
+ SfxItemSet aNewAttr( pDoc->GetItemPool() );
+ pView->GetAttributes( aNewAttr );
+
+ GetView().NoRotate();
+
+ switch (rReq.GetSlot())
+ {
+ case FN_DRAWTEXT_ATTR_DLG:
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( NULL, &aNewAttr, pView );
+ USHORT nResult = pDlg->Execute();
+
+ if (nResult == RET_OK)
+ {
+ if (pView->AreObjectsMarked())
+ {
+ pSh->StartAction();
+ pView->SetAttributes(*pDlg->GetOutputItemSet());
+ rReq.Done(*(pDlg->GetOutputItemSet()));
+ pSh->EndAction();
+ }
+ }
+
+ delete( pDlg );
+ }
+ }
+ break;
+
+ case SID_ATTRIBUTES_AREA:
+ {
+ BOOL bHasMarked = pView->AreObjectsMarked();
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet Factory fail!");
+ AbstractSvxAreaTabDialog * pDlg = pFact->CreateSvxAreaTabDialog( NULL,
+ &aNewAttr,
+ pDoc,
+ pView);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ const SvxColorTableItem* pColorItem = (const SvxColorTableItem*)
+ GetView().GetDocShell()->GetItem(SID_COLOR_TABLE);
+ if(pColorItem->GetColorTable() == XColorTable::GetStdColorTable())
+ pDlg->DontDeleteColorTable();
+ if (pDlg->Execute() == RET_OK)
+ {
+ pSh->StartAction();
+ if (bHasMarked)
+ pView->SetAttributes(*pDlg->GetOutputItemSet());
+ else
+ pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), FALSE);
+ pSh->EndAction();
+
+ static USHORT __READONLY_DATA aInval[] =
+ {
+ SID_ATTR_FILL_STYLE, SID_ATTR_FILL_COLOR, 0
+ };
+ SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
+ rBnd.Invalidate(aInval);
+ rBnd.Update(SID_ATTR_FILL_STYLE);
+ rBnd.Update(SID_ATTR_FILL_COLOR);
+ }
+ delete pDlg;
+ }
+ break;
+
+ case SID_ATTRIBUTES_LINE:
+ {
+ BOOL bHasMarked = pView->AreObjectsMarked();
+
+ const SdrObject* pObj = NULL;
+ const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet Factory fail!");
+ SfxAbstractTabDialog * pDlg = pFact->CreateSvxLineTabDialog( NULL,
+ &aNewAttr,
+ pDoc,
+ pObj,
+ bHasMarked);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if (pDlg->Execute() == RET_OK)
+ {
+ pSh->StartAction();
+ if(bHasMarked)
+ pView->SetAttrToMarked(*pDlg->GetOutputItemSet(), FALSE);
+ else
+ pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), FALSE);
+ pSh->EndAction();
+
+ static USHORT __READONLY_DATA aInval[] =
+ {
+ SID_ATTR_LINE_STYLE, SID_ATTR_LINE_WIDTH,
+ SID_ATTR_LINE_COLOR, 0
+ };
+
+ GetView().GetViewFrame()->GetBindings().Invalidate(aInval);
+ }
+ delete pDlg;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+
+ if (pDoc->IsChanged())
+ GetShell().SetModified();
+ else
+ if (bChanged)
+ pDoc->SetChanged(TRUE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwDrawShell::ExecDrawAttrArgs(SfxRequest& rReq)
+{
+ SwWrtShell* pSh = &GetShell();
+ SdrView* pView = pSh->GetDrawView();
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ BOOL bChanged = pView->GetModel()->IsChanged();
+ pView->GetModel()->SetChanged(FALSE);
+
+ GetView().NoRotate();
+
+ if (pArgs)
+ {
+ if(pView->AreObjectsMarked())
+ pView->SetAttrToMarked(*rReq.GetArgs(), FALSE);
+ else
+ pView->SetDefaultAttr(*rReq.GetArgs(), FALSE);
+ }
+ else
+ {
+ SfxDispatcher* pDis = pSh->GetView().GetViewFrame()->GetDispatcher();
+ switch (rReq.GetSlot())
+ {
+ case SID_ATTR_FILL_STYLE:
+ case SID_ATTR_FILL_COLOR:
+ case SID_ATTR_FILL_GRADIENT:
+ case SID_ATTR_FILL_HATCH:
+ case SID_ATTR_FILL_BITMAP:
+ pDis->Execute(SID_ATTRIBUTES_AREA, FALSE);
+ break;
+ case SID_ATTR_LINE_STYLE:
+ case SID_ATTR_LINE_DASH:
+ case SID_ATTR_LINE_WIDTH:
+ case SID_ATTR_LINE_COLOR:
+ pDis->Execute(SID_ATTRIBUTES_LINE, FALSE);
+ break;
+ }
+ }
+ if (pView->GetModel()->IsChanged())
+ GetShell().SetModified();
+ else
+ if (bChanged)
+ pView->GetModel()->SetChanged(TRUE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwDrawShell::GetDrawAttrState(SfxItemSet& rSet)
+{
+ SdrView* pSdrView = GetShell().GetDrawView();
+
+ if (pSdrView->AreObjectsMarked())
+ {
+ BOOL bDisable = Disable( rSet );
+
+ if( !bDisable )
+ pSdrView->GetAttributes( rSet );
+ }
+ else
+ rSet.Put(pSdrView->GetDefaultAttr());
+}
+
+
+
diff --git a/sw/source/ui/shells/drawsh.cxx b/sw/source/ui/shells/drawsh.cxx
new file mode 100644
index 000000000000..eb571036e322
--- /dev/null
+++ b/sw/source/ui/shells/drawsh.cxx
@@ -0,0 +1,497 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <tools/shl.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdotext.hxx>
+#include <svl/whiter.hxx>
+#include <svx/fontwork.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/objface.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/srchitem.hxx>
+#include <svx/xftsfit.hxx>
+#include <svx/extrusionbar.hxx>
+#include <svx/fontworkbar.hxx>
+#include <svx/tbxcustomshapes.hxx>
+#include <uitool.hxx>
+#include <wview.hxx>
+#include <swmodule.hxx>
+#include <swwait.hxx>
+#include <docstat.hxx>
+#include <IDocumentStatistics.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+
+#include <svx/xtable.hxx>
+
+#include "swundo.hxx"
+#include "wrtsh.hxx"
+#include "cmdid.h"
+#include "globals.hrc"
+#include "helpid.h"
+#include "popup.hrc"
+#include "shells.hrc"
+#include "drwbassh.hxx"
+#include "drawsh.hxx"
+
+#define SwDrawShell
+#include <sfx2/msg.hxx>
+#include "swslots.hxx"
+#include "swabstdlg.hxx" //CHINA001
+#include "misc.hrc"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+SFX_IMPL_INTERFACE(SwDrawShell, SwDrawBaseShell, SW_RES(STR_SHELLNAME_DRAW))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_DRAW_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_DRAW_TOOLBOX));
+ SFX_CHILDWINDOW_REGISTRATION(SvxFontWorkChildWindow::GetChildWindowId());
+}
+
+TYPEINIT1(SwDrawShell,SwDrawBaseShell)
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwDrawShell::Execute(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ SdrView *pSdrView = rSh.GetDrawView();
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
+ USHORT nSlotId = rReq.GetSlot();
+ BOOL bChanged = pSdrView->GetModel()->IsChanged();
+
+ pSdrView->GetModel()->SetChanged(FALSE);
+
+ const SfxPoolItem* pItem;
+ if(pArgs)
+ pArgs->GetItemState(nSlotId, FALSE, &pItem);
+
+ BOOL bMirror = TRUE;
+
+ switch (nSlotId)
+ {
+ case SID_OBJECT_ROTATE:
+ if (rSh.IsObjSelected() && pSdrView->IsRotateAllowed())
+ {
+ if (GetView().IsDrawRotate())
+ rSh.SetDragMode(SDRDRAG_MOVE);
+ else
+ rSh.SetDragMode(SDRDRAG_ROTATE);
+
+ GetView().FlipDrawRotate();
+ }
+ break;
+
+ case SID_BEZIER_EDIT:
+ if (GetView().IsDrawRotate())
+ {
+ rSh.SetDragMode(SDRDRAG_MOVE);
+ GetView().FlipDrawRotate();
+ }
+ GetView().FlipDrawSelMode();
+ pSdrView->SetFrameDragSingles(GetView().IsDrawSelMode());
+ GetView().AttrChangedNotify(&rSh); // Shellwechsel...
+ break;
+
+ case SID_OBJECT_HELL:
+ if (rSh.IsObjSelected())
+ {
+ rSh.StartUndo( UNDO_START );
+ SetWrapMode(FN_FRAME_WRAPTHRU_TRANSP);
+ rSh.SelectionToHell();
+ rSh.EndUndo( UNDO_END );
+ rBnd.Invalidate(SID_OBJECT_HEAVEN);
+ }
+ break;
+
+ case SID_OBJECT_HEAVEN:
+ if (rSh.IsObjSelected())
+ {
+ rSh.StartUndo( UNDO_START );
+ SetWrapMode(FN_FRAME_WRAPTHRU);
+ rSh.SelectionToHeaven();
+ rSh.EndUndo( UNDO_END );
+ rBnd.Invalidate(SID_OBJECT_HELL);
+ }
+ break;
+
+ case FN_TOOL_HIERARCHIE:
+ if (rSh.IsObjSelected())
+ {
+ rSh.StartUndo( UNDO_START );
+ if (rSh.GetLayerId() == 0)
+ {
+ SetWrapMode(FN_FRAME_WRAPTHRU);
+ rSh.SelectionToHeaven();
+ }
+ else
+ {
+ SetWrapMode(FN_FRAME_WRAPTHRU_TRANSP);
+ rSh.SelectionToHell();
+ }
+ rSh.EndUndo( UNDO_END );
+ rBnd.Invalidate( SID_OBJECT_HELL );
+ rBnd.Invalidate( SID_OBJECT_HEAVEN );
+ }
+ break;
+
+ case FN_FLIP_HORZ_GRAFIC:
+ bMirror = FALSE;
+ /* no break */
+ case FN_FLIP_VERT_GRAFIC:
+ rSh.MirrorSelection( bMirror );
+ break;
+
+ case SID_FONTWORK:
+ {
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView()));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)) );
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ if (pArgs)
+ {
+ pVFrame->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
+ ((const SfxBoolItem&)(pArgs->Get(SID_FONTWORK))).GetValue());
+ }
+ else
+ pVFrame->ToggleChildWindow( SvxFontWorkChildWindow::GetChildWindowId() );
+ pVFrame->GetBindings().Invalidate(SID_FONTWORK);
+ }
+ break;
+ case FN_FORMAT_FOOTNOTE_DLG:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), GetView().GetWrtShell(), DLG_DOC_FOOTNOTE );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ break;
+ }
+ case FN_NUMBERING_OUTLINE_DLG:
+ {
+ SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
+ GetView().GetWindow(), &aTmp, GetView().GetWrtShell());
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ rReq.Done();
+ }
+ break;
+ case SID_OPEN_XML_FILTERSETTINGS:
+ {
+ try
+ {
+ uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY);
+ if( xDialog.is() )
+ {
+ xDialog->execute();
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ rReq.Ignore ();
+ }
+ break;
+ case FN_WORDCOUNT_DIALOG:
+ {
+ SwDocStat aCurr;
+ SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() );
+ {
+ SwWait aWait( *GetView().GetDocShell(), TRUE );
+ rSh.StartAction();
+ rSh.CountWords( aCurr );
+ rSh.UpdateDocStat( aDocStat );
+ rSh.EndAction();
+ }
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( GetView().GetWindow() );
+ pDialog->SetValues(aCurr, aDocStat );
+ pDialog->Execute();
+ delete pDialog;
+ }
+ break;
+ case SID_EXTRUSION_TOOGLE:
+ case SID_EXTRUSION_TILT_DOWN:
+ case SID_EXTRUSION_TILT_UP:
+ case SID_EXTRUSION_TILT_LEFT:
+ case SID_EXTRUSION_TILT_RIGHT:
+ case SID_EXTRUSION_3D_COLOR:
+ case SID_EXTRUSION_DEPTH:
+ case SID_EXTRUSION_DIRECTION:
+ case SID_EXTRUSION_PROJECTION:
+ case SID_EXTRUSION_LIGHTING_DIRECTION:
+ case SID_EXTRUSION_LIGHTING_INTENSITY:
+ case SID_EXTRUSION_SURFACE:
+ case SID_EXTRUSION_DEPTH_FLOATER:
+ case SID_EXTRUSION_DIRECTION_FLOATER:
+ case SID_EXTRUSION_LIGHTING_FLOATER:
+ case SID_EXTRUSION_SURFACE_FLOATER:
+ case SID_EXTRUSION_DEPTH_DIALOG:
+ svx::ExtrusionBar::execute( pSdrView, rReq, rBnd );
+ rReq.Ignore ();
+ break;
+
+ case SID_FONTWORK_SHAPE:
+ case SID_FONTWORK_SHAPE_TYPE:
+ case SID_FONTWORK_ALIGNMENT:
+ case SID_FONTWORK_SAME_LETTER_HEIGHTS:
+ case SID_FONTWORK_CHARACTER_SPACING:
+ case SID_FONTWORK_KERN_CHARACTER_PAIRS:
+ case SID_FONTWORK_CHARACTER_SPACING_FLOATER:
+ case SID_FONTWORK_ALIGNMENT_FLOATER:
+ case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
+ svx::FontworkBar::execute( pSdrView, rReq, rBnd );
+ rReq.Ignore ();
+ break;
+
+ default:
+ DBG_ASSERT(!this, "falscher Dispatcher");
+ return;
+ }
+ if (pSdrView->GetModel()->IsChanged())
+ rSh.SetModified();
+ else if (bChanged)
+ pSdrView->GetModel()->SetChanged(TRUE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+void SwDrawShell::GetState(SfxItemSet& rSet)
+{
+ SwWrtShell &rSh = GetShell();
+ SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+ BOOL bProtected = rSh.IsSelObjProtected(FLYPROTECT_CONTENT);
+
+ if (!bProtected) // Im Parent nachsehen
+ bProtected |= rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+
+ while( nWhich )
+ {
+ switch( nWhich )
+ {
+ case SID_OBJECT_HELL:
+ if ( !rSh.IsObjSelected() || rSh.GetLayerId() == 0 || bProtected )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case SID_OBJECT_HEAVEN:
+ if ( !rSh.IsObjSelected() || rSh.GetLayerId() == 1 || bProtected )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case FN_TOOL_HIERARCHIE:
+ if ( !rSh.IsObjSelected() || bProtected )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case SID_OBJECT_ROTATE:
+ {
+ const BOOL bIsRotate = GetView().IsDrawRotate();
+ if ( (!bIsRotate && !pSdrView->IsRotateAllowed()) || bProtected )
+ rSet.DisableItem( nWhich );
+ else
+ rSet.Put( SfxBoolItem( nWhich, bIsRotate ) );
+ }
+ break;
+
+ case SID_BEZIER_EDIT:
+ if (!Disable(rSet, nWhich))
+ rSet.Put( SfxBoolItem( nWhich, !GetView().IsDrawSelMode()));
+ break;
+
+ case FN_FLIP_HORZ_GRAFIC:
+ if ( !pSdrView->IsMirrorAllowed() || bProtected )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case FN_FLIP_VERT_GRAFIC:
+ if ( !pSdrView->IsMirrorAllowed() || bProtected )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case SID_FONTWORK:
+ {
+ if (bProtected)
+ rSet.DisableItem( nWhich );
+ else
+ {
+ const USHORT nId = SvxFontWorkChildWindow::GetChildWindowId();
+ rSet.Put(SfxBoolItem( nWhich , GetView().GetViewFrame()->HasChildWindow(nId)));
+ }
+ }
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+ svx::ExtrusionBar::getState( pSdrView, rSet );
+ svx::FontworkBar::getState( pSdrView, rSet );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+SwDrawShell::SwDrawShell(SwView &_rView) :
+ SwDrawBaseShell(_rView)
+{
+ SetHelpId(SW_DRAWSHELL);
+ SetName(String::CreateFromAscii("Draw"));
+}
+
+/*************************************************************************
+|*
+|* SfxRequests fuer FontWork bearbeiten
+|*
+\************************************************************************/
+
+
+
+void SwDrawShell::ExecFormText(SfxRequest& rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ SdrView* pDrView = rSh.GetDrawView();
+ BOOL bChanged = pDrView->GetModel()->IsChanged();
+ pDrView->GetModel()->SetChanged(FALSE);
+
+ const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
+
+ if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() )
+ {
+ const SfxItemSet& rSet = *rReq.GetArgs();
+ const SfxPoolItem* pItem;
+
+ if ( pDrView->IsTextEdit() )
+ {
+ pDrView->SdrEndTextEdit( TRUE );
+ GetView().AttrChangedNotify(&rSh);
+ }
+
+ if ( rSet.GetItemState(XATTR_FORMTXTSTDFORM, TRUE, &pItem) ==
+ SFX_ITEM_SET &&
+ ((const XFormTextStdFormItem*) pItem)->GetValue() != XFTFORM_NONE )
+ {
+
+ const USHORT nId = SvxFontWorkChildWindow::GetChildWindowId();
+
+ SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*)(GetView().GetViewFrame()->
+ GetChildWindow(nId)->GetWindow());
+
+ pDlg->CreateStdFormObj(*pDrView, *pDrView->GetSdrPageView(),
+ rSet, *rMarkList.GetMark(0)->GetMarkedSdrObj(),
+ ((const XFormTextStdFormItem*) pItem)->
+ GetValue());
+
+ }
+ else
+ pDrView->SetAttributes(rSet);
+ }
+ if (pDrView->GetModel()->IsChanged())
+ rSh.SetModified();
+ else
+ if (bChanged)
+ pDrView->GetModel()->SetChanged(TRUE);
+}
+
+/*************************************************************************
+|*
+|* Statuswerte fuer FontWork zurueckgeben
+|*
+\************************************************************************/
+
+
+
+void SwDrawShell::GetFormTextState(SfxItemSet& rSet)
+{
+ SwWrtShell &rSh = GetShell();
+ SdrView* pDrView = rSh.GetDrawView();
+ const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
+ const SdrObject* pObj = NULL;
+ SvxFontWorkDialog* pDlg = NULL;
+
+ const USHORT nId = SvxFontWorkChildWindow::GetChildWindowId();
+
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ if ( pVFrame->HasChildWindow(nId) )
+ pDlg = (SvxFontWorkDialog*)(pVFrame->GetChildWindow(nId)->GetWindow());
+
+ if ( rMarkList.GetMarkCount() == 1 )
+ pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+ if ( pObj == NULL || !pObj->ISA(SdrTextObj) ||
+ !((SdrTextObj*) pObj)->HasText() )
+ {
+#define XATTR_ANZ 12
+ static const USHORT nXAttr[ XATTR_ANZ ] =
+ {
+ XATTR_FORMTXTSTYLE, XATTR_FORMTXTADJUST, XATTR_FORMTXTDISTANCE,
+ XATTR_FORMTXTSTART, XATTR_FORMTXTMIRROR, XATTR_FORMTXTSTDFORM,
+ XATTR_FORMTXTHIDEFORM, XATTR_FORMTXTOUTLINE, XATTR_FORMTXTSHADOW,
+ XATTR_FORMTXTSHDWCOLOR, XATTR_FORMTXTSHDWXVAL, XATTR_FORMTXTSHDWYVAL
+ };
+ for( USHORT i = 0; i < XATTR_ANZ; )
+ rSet.DisableItem( nXAttr[ i++ ] );
+ }
+ else
+ {
+ if ( pDlg )
+ pDlg->SetColorTable(XColorTable::GetStdColorTable());
+
+ pDrView->GetAttributes( rSet );
+ }
+}
+
+
+
+
diff --git a/sw/source/ui/shells/drformsh.cxx b/sw/source/ui/shells/drformsh.cxx
new file mode 100644
index 000000000000..13b1f1059b8d
--- /dev/null
+++ b/sw/source/ui/shells/drformsh.cxx
@@ -0,0 +1,276 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include <hintids.hxx>
+#include <svx/hlnkitem.hxx>
+#include <svx/svdview.hxx>
+#include <svl/whiter.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/srchitem.hxx>
+#include <svx/fmglob.hxx>
+#include <svx/svdouno.hxx>
+#include <com/sun/star/form/FormButtonType.hpp>
+#include <svx/htmlmode.hxx>
+#include <tools/urlobj.hxx>
+
+#include "viewopt.hxx"
+#include "swmodule.hxx"
+#include "wrtsh.hxx"
+#include "cmdid.h"
+#include "globals.hrc"
+#include "helpid.h"
+#include "popup.hrc"
+#include "shells.hrc"
+#include "drwbassh.hxx"
+#include "drformsh.hxx"
+#include <svl/urihelper.hxx>
+#include <view.hxx>
+#include <sfx2/docfile.hxx>
+#include <docsh.hxx>
+
+#define SwDrawFormShell
+#include <sfx2/msg.hxx>
+#include "swslots.hxx"
+
+#include <unomid.h>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+SFX_IMPL_INTERFACE(SwDrawFormShell, SwDrawBaseShell, SW_RES(STR_SHELLNAME_DRAWFORM))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_DRAWFORM_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TEXT_TOOLBOX));
+}
+
+
+TYPEINIT1(SwDrawFormShell, SwDrawBaseShell)
+
+
+void SwDrawFormShell::Execute(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ const SfxPoolItem* pItem = 0;
+ const SfxItemSet *pArgs = rReq.GetArgs();
+
+ switch ( rReq.GetSlot() )
+ {
+ case SID_HYPERLINK_SETLINK:
+ {
+ if(pArgs)
+ pArgs->GetItemState(SID_HYPERLINK_SETLINK, sal_False, &pItem);
+ if(pItem)
+ {
+ SdrView *pSdrView = rSh.GetDrawView();
+ const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem;
+ bool bConvertToText = rHLinkItem.GetInsertMode() == HLINK_DEFAULT ||
+ rHLinkItem.GetInsertMode() == HLINK_FIELD;
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ if (rMarkList.GetMark(0))
+ {
+ SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj());
+ if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor())
+ {
+ if(bConvertToText)
+ {
+ //remove object -> results in destruction of this!
+ SwView& rTempView = GetView();
+ rTempView.GetViewFrame()->GetDispatcher()->Execute(SID_DELETE, SFX_CALLMODE_SYNCHRON );
+ rTempView.StopShellTimer();
+ //issue a new command to insert the link
+ rTempView.GetViewFrame()->GetDispatcher()->Execute(
+ SID_HYPERLINK_SETLINK, SFX_CALLMODE_ASYNCHRON, &rHLinkItem, 0);
+ }
+ else
+ {
+ uno::Reference< awt::XControlModel > xControlModel = pUnoCtrl->GetUnoControlModel();
+
+ ASSERT( xControlModel.is(), "UNO-Control ohne Model" );
+ if( !xControlModel.is() )
+ return;
+
+ uno::Reference< beans::XPropertySet > xPropSet(xControlModel, uno::UNO_QUERY);
+
+ // Darf man eine URL an dem Objekt setzen?
+ OUString sTargetURL( C2U( "TargetURL" ));
+ uno::Reference< beans::XPropertySetInfo > xPropInfoSet = xPropSet->getPropertySetInfo();
+ if( xPropInfoSet->hasPropertyByName( sTargetURL ))
+ {
+ beans::Property aProp = xPropInfoSet->getPropertyByName( sTargetURL );
+ if( aProp.Name.getLength() )
+ {
+ uno::Any aTmp;
+ // Ja!
+ ::rtl::OUString sLabel(C2U("Label"));
+ if( xPropInfoSet->hasPropertyByName(sLabel) )
+ {
+ aTmp <<= OUString(rHLinkItem.GetName());
+ xPropSet->setPropertyValue(sLabel, aTmp );
+ }
+
+ SfxMedium* pMedium = GetView().GetDocShell()->GetMedium();
+ INetURLObject aAbs;
+ if( pMedium )
+ aAbs = pMedium->GetURLObject();
+ aTmp <<= OUString(URIHelper::SmartRel2Abs(aAbs, rHLinkItem.GetURL()));
+ xPropSet->setPropertyValue( sTargetURL, aTmp );
+
+ if( rHLinkItem.GetTargetFrame().Len() )
+ {
+ aTmp <<= OUString(rHLinkItem.GetTargetFrame());
+ xPropSet->setPropertyValue( C2U("TargetFrame"), aTmp );
+ }
+
+
+ form::FormButtonType eButtonType = form::FormButtonType_URL;
+ aTmp.setValue( &eButtonType, ::getCppuType((const form::FormButtonType*)0));
+ xPropSet->setPropertyValue( C2U("ButtonType"), aTmp );
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ default:
+ DBG_ASSERT(!this, "falscher Dispatcher");
+ return;
+ }
+}
+
+void SwDrawFormShell::GetState(SfxItemSet& rSet)
+{
+ SwWrtShell &rSh = GetShell();
+ SfxWhichIter aIter( rSet );
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while( nWhich )
+ {
+ switch( nWhich )
+ {
+ case SID_HYPERLINK_GETLINK:
+ {
+ SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ SvxHyperlinkItem aHLinkItem;
+ if (rMarkList.GetMark(0))
+ {
+ SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj());
+ if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor())
+ {
+ uno::Reference< awt::XControlModel > xControlModel = pUnoCtrl->GetUnoControlModel();
+
+ ASSERT( xControlModel.is(), "UNO-Control ohne Model" );
+ if( !xControlModel.is() )
+ return;
+
+ uno::Reference< beans::XPropertySet > xPropSet(xControlModel, uno::UNO_QUERY);
+
+ uno::Any aTmp;
+ uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo();
+ if(xInfo->hasPropertyByName(C2U("ButtonType" )))
+ {
+ form::FormButtonType eButtonType = form::FormButtonType_URL;
+ aTmp = xPropSet->getPropertyValue( C2U("ButtonType") );
+ if( aTmp >>= eButtonType )
+ {
+ // Label
+ if(xInfo->hasPropertyByName( C2U("Label") ))
+ {
+ aTmp = xPropSet->getPropertyValue( C2U("Label") );
+ OUString sTmp;
+ if( (aTmp >>= sTmp) && sTmp.getLength())
+ {
+ aHLinkItem.SetName(sTmp);
+ }
+ }
+
+ // URL
+ if(xInfo->hasPropertyByName( C2U("TargetURL" )))
+ {
+ aTmp = xPropSet->getPropertyValue( C2U("TargetURL") );
+ OUString sTmp;
+ if( (aTmp >>= sTmp) && sTmp.getLength())
+ {
+ aHLinkItem.SetURL(sTmp);
+ }
+ }
+
+ // Target
+ if(xInfo->hasPropertyByName( C2U("TargetFrame") ))
+ {
+ aTmp = xPropSet->getPropertyValue( C2U("TargetFrame") );
+ OUString sTmp;
+ if( (aTmp >>= sTmp) && sTmp.getLength())
+ {
+ aHLinkItem.SetTargetFrame(sTmp);
+ }
+ }
+ aHLinkItem.SetInsertMode(HLINK_BUTTON);
+ }
+ }
+ }
+ }
+ sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
+ aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
+ ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
+
+ rSet.Put(aHLinkItem);
+ }
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+
+SwDrawFormShell::SwDrawFormShell(SwView &_rView) :
+ SwDrawBaseShell(_rView)
+{
+ SetHelpId(SW_DRAWFORMSHELL);
+ GetShell().NoEdit(sal_True);
+ SetName(String::CreateFromAscii("DrawForm"));
+}
+
+SwDrawFormShell::~SwDrawFormShell()
+{
+}
+
+
+
diff --git a/sw/source/ui/shells/drwbassh.cxx b/sw/source/ui/shells/drwbassh.cxx
new file mode 100644
index 000000000000..ba205e5fb313
--- /dev/null
+++ b/sw/source/ui/shells/drwbassh.cxx
@@ -0,0 +1,995 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <tools/shl.hxx>
+#include <hintids.hxx>
+#include <helpid.h>
+#include <swtypes.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/bindings.hxx>
+#include <svl/aeitem.hxx>
+#include <svx/svdview.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/srchitem.hxx>
+#include <svl/whiter.hxx>
+#include <svx/swframevalidation.hxx>
+#include <svx/anchorid.hxx>
+#include <svx/htmlmode.hxx>
+#include <uitool.hxx>
+#include <fmtornt.hxx>
+#include <cmdid.h>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <wview.hxx>
+#include <edtwin.hxx>
+#include <viewopt.hxx>
+#include <dcontact.hxx>
+#include <frmfmt.hxx>
+#include <wrap.hxx>
+#include <drawbase.hxx>
+#include <drwbassh.hxx>
+#include <swdtflvr.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svditer.hxx>
+
+#include <shells.hrc>
+#define SwDrawBaseShell
+#include <sfx2/msg.hxx>
+#include <swslots.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include "swabstdlg.hxx"
+#include "dialog.hrc"
+#include <swundo.hxx>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/VertOrientation.hpp>
+#include <com/sun/star/text/RelOrientation.hpp>
+
+#include <IDocumentDrawModelAccess.hxx>
+
+using namespace ::com::sun::star;
+
+SFX_IMPL_INTERFACE(SwDrawBaseShell, SwBaseShell, SW_RES(0))
+{
+}
+
+TYPEINIT1(SwDrawBaseShell,SwBaseShell)
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwDrawBaseShell::SwDrawBaseShell(SwView &_rView):
+ SwBaseShell( _rView )
+{
+ GetShell().NoEdit(TRUE);
+
+ SwEditWin& rWin = GetView().GetEditWin();
+
+ rWin.SetBezierMode(SID_BEZIER_MOVE);
+
+ if ( !_rView.GetDrawFuncPtr() )
+ _rView.GetEditWin().StdDrawMode( OBJ_NONE, TRUE );
+
+ SwTransferable::CreateSelection( GetShell() );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwDrawBaseShell::~SwDrawBaseShell()
+{
+ GetView().ExitDraw();
+ GetShell().Edit();
+ SwTransferable::ClearSelection( GetShell() );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwDrawBaseShell::Execute(SfxRequest &rReq)
+{
+ SwWrtShell *pSh = &GetShell();
+ SdrView* pSdrView = pSh->GetDrawView();
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ USHORT nSlotId = rReq.GetSlot();
+ BOOL bChanged = pSdrView->GetModel()->IsChanged();
+ pSdrView->GetModel()->SetChanged(FALSE);
+ const SfxPoolItem* pItem = 0;
+ if(pArgs)
+ pArgs->GetItemState(nSlotId, FALSE, &pItem);
+
+ //Sonderfall Align per Menue
+ if(pItem && nSlotId == SID_OBJECT_ALIGN)
+ {
+ DBG_ASSERT(PTR_CAST(SfxEnumItem, pItem),"SfxEnumItem erwartet");
+ nSlotId = nSlotId + ((const SfxEnumItem*)pItem)->GetValue();
+ nSlotId++;
+ }
+
+ BOOL bAlignPossible = pSh->IsAlignPossible();
+
+ BOOL bTopParam = TRUE, bBottomParam = TRUE;
+ BOOL bNotify = FALSE;
+ BOOL bDone = FALSE;
+ SfxBindings& rBind = GetView().GetViewFrame()->GetBindings();
+
+ switch (nSlotId)
+ {
+ case FN_DRAW_WRAP_DLG:
+ {
+ if(pSdrView->AreObjectsMarked())
+ {
+ if(!pArgs)
+ {
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ if( rMarkList.GetMark(0) != 0 )
+ {
+ SfxItemSet aSet(GetPool(), RES_SURROUND, RES_SURROUND,
+ RES_ANCHOR, RES_ANCHOR,
+ RES_LR_SPACE, RES_UL_SPACE,
+ SID_HTML_MODE, SID_HTML_MODE,
+ FN_DRAW_WRAP_DLG, FN_DRAW_WRAP_DLG,
+ 0);
+
+ aSet.Put(SfxBoolItem(SID_HTML_MODE,
+ 0 != ::GetHtmlMode(pSh->GetView().GetDocShell())));
+
+ aSet.Put(SfxInt16Item(FN_DRAW_WRAP_DLG, pSh->GetLayerId()));
+
+ pSh->GetObjAttr(aSet);
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ SfxAbstractDialog* pDlg = pFact->CreateSwWrapDlg( GetView().GetWindow(), aSet, pSh, TRUE, RC_DLG_SWWRAPDLG );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+
+ if (pDlg->Execute() == RET_OK)
+ {
+ const SfxPoolItem* pWrapItem;
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ if(SFX_ITEM_SET == pOutSet->GetItemState(FN_DRAW_WRAP_DLG, FALSE, &pWrapItem))
+ {
+ short nLayer = ((const SfxInt16Item*)pWrapItem)->GetValue();
+ if (nLayer == 1)
+ pSh->SelectionToHeaven();
+ else
+ pSh->SelectionToHell();
+ }
+
+ pSh->SetObjAttr(*pOutSet);
+ }
+ delete pDlg;
+ }
+ }
+ }
+ }
+ break;
+
+ case SID_ATTR_TRANSFORM:
+ {
+ if(pSdrView->AreObjectsMarked())
+ {
+ if(!pArgs)
+ {
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ if( rMarkList.GetMark(0) != 0 )
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ SfxAbstractTabDialog *pDlg=NULL;
+ BOOL bCaption = FALSE;
+
+ // Erlaubte Verankerungen:
+ short nAnchor = pSh->GetAnchorId();
+ USHORT nAllowedAnchors = SVX_OBJ_AT_CNTNT|SVX_OBJ_IN_CNTNT;
+ USHORT nHtmlMode = ::GetHtmlMode(pSh->GetView().GetDocShell());
+
+ if( !((HTMLMODE_ON & nHtmlMode) && (0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS))) )
+ nAllowedAnchors |= SVX_OBJ_PAGE;
+ if ( pSh->IsFlyInFly() )
+ nAllowedAnchors |= SVX_OBJ_AT_FLY;
+
+ if (pObj->GetObjIdentifier() == OBJ_CAPTION )
+ bCaption = TRUE;
+
+ if (bCaption)
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ AbstractSvxCaptionDialog* pCaptionDlg =
+ pFact->CreateCaptionDialog( NULL, pSdrView, nAllowedAnchors );
+ pCaptionDlg->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) );
+ pDlg = pCaptionDlg;
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ }
+ }
+ else
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+
+ AbstractSvxTransformTabDialog* pTransform =
+ pFact->CreateSvxTransformTabDialog( NULL, NULL, pSdrView, nAllowedAnchors );
+ pTransform->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) );
+ pDlg = pTransform;
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ }
+ }
+ SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked());
+
+ const USHORT* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() );
+ SfxItemSet aSet( *aNewAttr.GetPool(), pRange );
+ FieldUnit eMetric = ::GetDfltMetric(0 != dynamic_cast<SwWebView*>(&GetView()));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)) );
+
+ aSet.Put( aNewAttr, FALSE );
+
+ if (bCaption)
+ pSdrView->GetAttributes( aSet );
+
+ aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_ANCHOR, nAnchor));
+ BOOL bRTL;
+ aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT, pSh->IsFrmVertical(TRUE, bRTL)));
+ aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_IN_RTL_TEXT, bRTL));
+
+ SwFrmFmt* pFrmFmt = FindFrmFmt( pObj );
+
+ aSet.Put( pFrmFmt->GetFmtAttr(RES_FOLLOW_TEXT_FLOW) );
+
+ SwFmtVertOrient aVOrient((const SwFmtVertOrient&)pFrmFmt->GetFmtAttr(RES_VERT_ORIENT));
+ aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_ORIENT, aVOrient.GetVertOrient()));
+ aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_RELATION, aVOrient.GetRelationOrient() ));
+ aSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_VERT_POSITION, aVOrient.GetPos()));
+
+ SwFmtHoriOrient aHOrient((const SwFmtHoriOrient&)pFrmFmt->GetFmtAttr(RES_HORI_ORIENT));
+ aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_ORIENT, aHOrient.GetHoriOrient()));
+ aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_RELATION, aHOrient.GetRelationOrient() ));
+ aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_HORI_MIRROR, aHOrient.IsPosToggle()));
+ aSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_HORI_POSITION, aHOrient.GetPos()));
+
+ aSet.Put(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
+
+ pDlg->SetInputSet( &aSet );
+
+ if (pDlg->Execute() == RET_OK)
+ {
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ pSh->StartAllAction();
+
+ // --> OD 2004-07-14 #i30451#
+ pSh->StartUndo(UNDO_INSFMTATTR);
+
+ pSdrView->SetGeoAttrToMarked(*pOutSet);
+
+ if (bCaption)
+ pSdrView->SetAttributes(*pOutSet);
+
+ BOOL bPosCorr =
+ SFX_ITEM_SET != pOutSet->GetItemState(
+ SID_ATTR_TRANSFORM_POS_X, FALSE ) &&
+ SFX_ITEM_SET != pOutSet->GetItemState(
+ SID_ATTR_TRANSFORM_POS_Y, FALSE );
+
+ SfxItemSet aFrmAttrSet(GetPool(), RES_FRMATR_BEGIN, RES_FRMATR_END - 1);
+
+ bool bSingleSelection = rMarkList.GetMarkCount() == 1;
+
+ const SfxPoolItem* pAnchorItem;
+ if(SFX_ITEM_SET == pOutSet->GetItemState(
+ SID_ATTR_TRANSFORM_ANCHOR, FALSE, &pAnchorItem))
+ {
+ if(!bSingleSelection)
+ pSh->ChgAnchor(((const SfxInt16Item*)pAnchorItem)
+ ->GetValue(), FALSE, bPosCorr );
+ else
+ {
+ SwFmtAnchor aAnchor(pFrmFmt->GetAnchor());
+ aAnchor.SetType((RndStdIds)((const SfxInt16Item*)pAnchorItem)->GetValue());
+ aFrmAttrSet.Put( aAnchor );
+ }
+ }
+ const SfxPoolItem* pHoriOrient = 0;
+ const SfxPoolItem* pHoriRelation = 0;
+ const SfxPoolItem* pHoriPosition = 0;
+ const SfxPoolItem* pHoriMirror = 0;
+ pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_ORIENT, FALSE, &pHoriOrient);
+ pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_RELATION, FALSE, &pHoriRelation);
+ pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_POSITION, FALSE, &pHoriPosition);
+ pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_MIRROR, FALSE, &pHoriMirror);
+ if(pHoriOrient || pHoriRelation || pHoriPosition || pHoriMirror)
+ {
+ if(pHoriOrient)
+ aHOrient.SetHoriOrient(
+ static_cast<const SfxInt16Item*>(pHoriOrient)->GetValue());
+ if(pHoriRelation)
+ aHOrient.SetRelationOrient(
+ static_cast<const SfxInt16Item*>(pHoriRelation)->GetValue());
+ if(pHoriPosition)
+ aHOrient.SetPos( static_cast<const SfxInt32Item*>(pHoriPosition)->GetValue());
+ if(pHoriMirror)
+ aHOrient.SetPosToggle( static_cast<const SfxBoolItem*>(pHoriMirror)->GetValue());
+ aFrmAttrSet.Put(aHOrient);
+ }
+
+ const SfxPoolItem* pVertOrient = 0;
+ const SfxPoolItem* pVertRelation = 0;
+ const SfxPoolItem* pVertPosition = 0;
+ pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_ORIENT, FALSE, &pVertOrient);
+ pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_RELATION, FALSE, &pVertRelation);
+ pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_POSITION, FALSE, &pVertPosition);
+ if(pVertOrient || pVertRelation || pVertPosition )
+ {
+ if(pVertOrient)
+ aVOrient.SetVertOrient(
+ static_cast<const SfxInt16Item*>(pVertOrient)->GetValue());
+ if(pVertRelation)
+ aVOrient.SetRelationOrient(
+ static_cast<const SfxInt16Item*>(pVertRelation)->GetValue());
+ if(pVertPosition)
+ aVOrient.SetPos( static_cast<const SfxInt32Item*>(pVertPosition)->GetValue());
+ aFrmAttrSet.Put( aVOrient );
+ }
+ const SfxPoolItem* pFollowItem = 0;
+ pOutSet->GetItemState(RES_FOLLOW_TEXT_FLOW, FALSE, &pFollowItem);
+ if(pFollowItem)
+ aFrmAttrSet.Put(*pFollowItem);
+
+ if(aFrmAttrSet.Count())
+ pSh->SetDrawingAttr(aFrmAttrSet);
+
+ rBind.InvalidateAll(FALSE);
+
+ // --> OD 2004-07-14 #i30451#
+ pSh->EndUndo( UNDO_INSFMTATTR );
+
+ pSh->EndAllAction();
+ }
+ delete pDlg;
+
+ }
+ }
+ }
+ }
+ break;
+
+ case SID_DELETE:
+ case FN_BACKSPACE:
+ if (pSh->IsObjSelected() && !pSdrView->IsTextEdit())
+ {
+ bDone = TRUE;
+
+ if( GetView().IsDrawRotate() )
+ {
+ pSh->SetDragMode( SDRDRAG_MOVE );
+ GetView().FlipDrawRotate();
+ }
+
+ pSh->SetModified();
+ pSh->DelSelectedObj();
+
+ if (rReq.IsAPI() ||
+ GetView().GetEditWin().IsObjectSelect() )
+ {
+ // Wenn Basic-Aufruf, dann zurueck in die Textshell, da das
+ // Basic sonst keine Rueckkehrmoeglichkeit hat.
+ if (GetView().GetDrawFuncPtr())
+ {
+ GetView().GetDrawFuncPtr()->Deactivate();
+ GetView().SetDrawFuncPtr(NULL);
+ }
+ GetView().LeaveDrawCreate(); // In Selektionsmode wechseln
+ }
+
+ if (pSh->IsSelFrmMode())
+ {
+ pSh->LeaveSelFrmMode();
+ // #105852# FME
+// pSh->NoEdit();
+ }
+ bNotify = TRUE;
+ }
+ break;
+
+ case SID_GROUP:
+ if (pSh->IsObjSelected() > 1 && pSh->IsGroupAllowed())
+ {
+ pSh->GroupSelection(); // Objekt gruppieren
+ rBind.Invalidate(SID_UNGROUP);
+ }
+ break;
+
+ case SID_UNGROUP:
+ if (pSh->IsGroupSelected())
+ {
+ pSh->UnGroupSelection(); // Objektgruppierung aufheben
+ rBind.Invalidate(SID_GROUP);
+ }
+ break;
+
+ case SID_ENTER_GROUP:
+ if (pSh->IsGroupSelected())
+ {
+ pSdrView->EnterMarkedGroup();
+ rBind.InvalidateAll(FALSE);
+ }
+ break;
+
+ case SID_LEAVE_GROUP:
+ if (pSdrView->IsGroupEntered())
+ {
+ pSdrView->LeaveOneGroup();
+ rBind.Invalidate(SID_ENTER_GROUP);
+ rBind.Invalidate(SID_UNGROUP);
+ }
+ break;
+
+ case SID_OBJECT_ALIGN_LEFT:
+ case SID_OBJECT_ALIGN_CENTER:
+ case SID_OBJECT_ALIGN_RIGHT:
+ case SID_OBJECT_ALIGN_UP:
+ case SID_OBJECT_ALIGN_MIDDLE:
+ case SID_OBJECT_ALIGN_DOWN:
+ {
+ if ( bAlignPossible )
+ {
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 && bAlignPossible )
+ { // Objekte nicht aneinander ausrichten
+
+ USHORT nAnchor = pSh->GetAnchorId();
+ if (nAnchor == FLY_AS_CHAR)
+ {
+ sal_Int16 nVertOrient = -1;
+
+ switch (nSlotId)
+ {
+ case SID_OBJECT_ALIGN_UP:
+ nVertOrient = text::VertOrientation::TOP;
+ break;
+ case SID_OBJECT_ALIGN_MIDDLE:
+ nVertOrient = text::VertOrientation::CENTER;
+ break;
+ case SID_OBJECT_ALIGN_DOWN:
+ nVertOrient = text::VertOrientation::BOTTOM;
+ break;
+ default:
+ break;
+ }
+ if (nVertOrient != -1)
+ {
+ pSh->StartAction();
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ SwFrmFmt* pFrmFmt = FindFrmFmt( pObj );
+ SwFmtVertOrient aVOrient((SwFmtVertOrient&)pFrmFmt->GetFmtAttr(RES_VERT_ORIENT));
+ aVOrient.SetVertOrient( nVertOrient );
+ pFrmFmt->SetFmtAttr(aVOrient);
+ pSh->EndAction();
+ }
+ break;
+ }
+ if (nAnchor == FLY_AT_PARA)
+ break; // Absatzverankerte Rahmen nicht ausrichten
+ }
+
+ pSh->StartAction();
+ switch (nSlotId)
+ {
+ case SID_OBJECT_ALIGN_LEFT:
+ pSdrView->AlignMarkedObjects(SDRHALIGN_LEFT, SDRVALIGN_NONE);
+ break;
+ case SID_OBJECT_ALIGN_CENTER:
+ pSdrView->AlignMarkedObjects(SDRHALIGN_CENTER, SDRVALIGN_NONE);
+ break;
+ case SID_OBJECT_ALIGN_RIGHT:
+ pSdrView->AlignMarkedObjects(SDRHALIGN_RIGHT, SDRVALIGN_NONE);
+ break;
+ case SID_OBJECT_ALIGN_UP:
+ pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_TOP);
+ break;
+ case SID_OBJECT_ALIGN_MIDDLE:
+ pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_CENTER);
+ break;
+ case SID_OBJECT_ALIGN_DOWN:
+ pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_BOTTOM);
+ break;
+ }
+ pSh->EndAction();
+ }
+ }
+ break;
+
+ case FN_FRAME_UP:
+ bTopParam = FALSE;
+ /* no break */
+ case SID_FRAME_TO_TOP:
+ pSh->SelectionToTop( bTopParam );
+ break;
+
+ case FN_FRAME_DOWN:
+ bBottomParam = FALSE;
+ /* no break */
+ case SID_FRAME_TO_BOTTOM:
+ pSh->SelectionToBottom( bBottomParam );
+ break;
+
+ case FN_NAME_SHAPE:
+ {
+ bDone = TRUE;
+
+ if(1L == pSdrView->GetMarkedObjectCount())
+ {
+ // #i68101#
+ SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0L);
+ OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
+ String aName(pSelected->GetName());
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ OSL_ENSURE(pFact, "Dialogdiet fail!");
+ AbstractSvxObjectNameDialog* pDlg = pFact->CreateSvxObjectNameDialog(NULL, aName);
+ OSL_ENSURE(pDlg, "Dialogdiet fail!");
+
+ pDlg->SetCheckNameHdl(LINK(this, SwDrawBaseShell, CheckGroupShapeNameHdl));
+
+ if(RET_OK == pDlg->Execute())
+ {
+ pDlg->GetName(aName);
+ pSelected->SetName(aName);
+ pSh->SetModified();
+ }
+
+ delete pDlg;
+ }
+
+ break;
+ }
+
+ // #i68101#
+ case FN_TITLE_DESCRIPTION_SHAPE:
+ {
+ bDone = TRUE;
+
+ if(1L == pSdrView->GetMarkedObjectCount())
+ {
+ SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0L);
+ OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
+ String aTitle(pSelected->GetTitle());
+ String aDescription(pSelected->GetDescription());
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ OSL_ENSURE(pFact, "Dialogdiet fail!");
+ AbstractSvxObjectTitleDescDialog* pDlg = pFact->CreateSvxObjectTitleDescDialog(NULL, aTitle, aDescription);
+ OSL_ENSURE(pDlg, "Dialogdiet fail!");
+
+ if(RET_OK == pDlg->Execute())
+ {
+ pDlg->GetTitle(aTitle);
+ pDlg->GetDescription(aDescription);
+
+ pSelected->SetTitle(aTitle);
+ pSelected->SetDescription(aDescription);
+
+ pSh->SetModified();
+ }
+
+ delete pDlg;
+ }
+
+ break;
+ }
+
+ default:
+ DBG_ASSERT(!this, "falscher Dispatcher");
+ return;
+ }
+ if(!bDone)
+ {
+ if(nSlotId >= SID_OBJECT_ALIGN_LEFT && nSlotId <= SID_OBJECT_ALIGN_DOWN)
+ rBind.Invalidate(SID_ATTR_LONG_LRSPACE);
+ if (pSdrView->GetModel()->IsChanged())
+ pSh->SetModified();
+ else if (bChanged)
+ pSdrView->GetModel()->SetChanged(TRUE);
+ // 40220: Nach dem Loeschen von DrawObjekten ueber die API GPF durch Selbstzerstoerung
+ if(bNotify)
+ GetView().AttrChangedNotify(pSh); // ggf Shellwechsel...
+ }
+}
+/* -----------------------------27.02.2002 15:27------------------------------
+ Checks whether a given name is allowed for a group shape
+ ---------------------------------------------------------------------------*/
+IMPL_LINK( SwDrawBaseShell, CheckGroupShapeNameHdl, AbstractSvxNameDialog*, pNameDialog )
+{
+ SwWrtShell &rSh = GetShell();
+ SdrView *pSdrView = rSh.GetDrawView();
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ DBG_ASSERT(rMarkList.GetMarkCount() == 1, "wrong draw selection");
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ const String sCurrentName = pObj->GetName();
+ String sNewName;
+ pNameDialog->GetName(sNewName);
+ long nRet = 0;
+ if(!sNewName.Len() || sCurrentName == sNewName)
+ nRet = 1;
+ else
+ {
+ nRet = 1;
+ SdrModel* pModel = rSh.getIDocumentDrawModelAccess()->GetDrawModel();
+ // --> OD 2006-03-09 #i51726# - all drawing objects can be named now.
+ // consider also drawing objects inside group objects
+// SdrPage* pPage = pModel->GetPage(0);
+// sal_uInt32 nCount = pPage->GetObjCount();
+// for( sal_uInt32 i=0; i< nCount; i++ )
+// {
+// SdrObject* pTemp = pPage->GetObj(i);
+// if(pObj != pTemp && pTemp->ISA(SdrObjGroup) && pTemp->GetName() == sNewName)
+// {
+// nRet = 0;
+// break;
+// }
+// }
+ SdrObjListIter aIter( *(pModel->GetPage(0)), IM_DEEPWITHGROUPS );
+ while( aIter.IsMore() )
+ {
+ SdrObject* pTempObj = aIter.Next();
+ if ( pObj != pTempObj && pTempObj->GetName() == sNewName )
+ {
+ nRet = 0;
+ break;
+ }
+ }
+ // <--
+ }
+ return nRet;
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+void SwDrawBaseShell::GetState(SfxItemSet& rSet)
+{
+ SwWrtShell &rSh = GetShell();
+ SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+ BOOL bProtected = rSh.IsSelObjProtected(FLYPROTECT_CONTENT);
+
+ if (!bProtected) // Im Parent nachsehen
+ bProtected |= rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+
+ while( nWhich )
+ {
+ switch( nWhich )
+ {
+ case FN_DRAW_WRAP_DLG:
+ case SID_ATTR_TRANSFORM:
+ case SID_FRAME_TO_TOP:
+ case SID_FRAME_TO_BOTTOM:
+ case FN_FRAME_UP:
+ case FN_FRAME_DOWN:
+ case SID_DELETE:
+ case FN_BACKSPACE:
+ if( bProtected || !rSh.IsObjSelected() )
+ rSet.DisableItem( nWhich );
+ break;
+ case SID_GROUP:
+ if ( rSh.IsObjSelected() < 2 || bProtected || !rSh.IsGroupAllowed() )
+ rSet.DisableItem( nWhich );
+ break;
+ case SID_UNGROUP:
+ if ( !rSh.IsGroupSelected() || bProtected )
+ rSet.DisableItem( nWhich );
+ break;
+ case SID_ENTER_GROUP:
+ if ( !rSh.IsGroupSelected() )
+ rSet.DisableItem( nWhich );
+ break;
+ case SID_LEAVE_GROUP:
+ if ( !pSdrView->IsGroupEntered() )
+ rSet.DisableItem( nWhich );
+ break;
+ case SID_OBJECT_ALIGN_LEFT:
+ case SID_OBJECT_ALIGN_CENTER:
+ case SID_OBJECT_ALIGN_RIGHT:
+ case SID_OBJECT_ALIGN_UP:
+ case SID_OBJECT_ALIGN_MIDDLE:
+ case SID_OBJECT_ALIGN_DOWN:
+ case SID_OBJECT_ALIGN:
+ if ( !rSh.IsAlignPossible() || bProtected )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ SfxAllEnumItem aEnumItem(nWhich, USHRT_MAX);
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ //if only one object is selected it can only be vertically
+ // aligned because it is character bound
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ aEnumItem.DisableValue(SID_OBJECT_ALIGN_LEFT);
+ aEnumItem.DisableValue(SID_OBJECT_ALIGN_CENTER);
+ aEnumItem.DisableValue(SID_OBJECT_ALIGN_RIGHT);
+ }
+ rSet.Put(aEnumItem);
+ }
+ break;
+
+ case FN_NAME_SHAPE :
+ {
+ if(1L != pSdrView->GetMarkedObjectCount())
+ {
+ rSet.DisableItem( nWhich );
+ }
+ }
+ break;
+
+ // #i68101#
+ case FN_TITLE_DESCRIPTION_SHAPE:
+ {
+ const bool bIsWebView(NULL != dynamic_cast<SwWebView*>(&GetView()));
+
+ if(!bIsWebView && 1L != pSdrView->GetMarkedObjectCount())
+ {
+ rSet.DisableItem( nWhich );
+ }
+ }
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+BOOL SwDrawBaseShell::Disable(SfxItemSet& rSet, USHORT nWhich)
+{
+ BOOL bDisable = GetShell().IsSelObjProtected(FLYPROTECT_CONTENT);
+
+ if (bDisable)
+ {
+ if (nWhich)
+ rSet.DisableItem( nWhich );
+ else
+ {
+ SfxWhichIter aIter( rSet );
+ nWhich = aIter.FirstWhich();
+ while (nWhich)
+ {
+ rSet.DisableItem( nWhich );
+ nWhich = aIter.NextWhich();
+ }
+ }
+ }
+
+ return bDisable;
+}
+
+/*-- 09.03.2004 13:15:03---------------------------------------------------
+ Validate of drawing positions
+ -----------------------------------------------------------------------*/
+IMPL_LINK(SwDrawBaseShell, ValidatePosition, SvxSwFrameValidation*, pValidation )
+{
+ SwWrtShell *pSh = &GetShell();
+ pValidation->nMinHeight = MINFLY;
+ pValidation->nMinWidth = MINFLY;
+
+ SwRect aBoundRect;
+
+ // OD 18.09.2003 #i18732# - adjustment for allowing vertical position
+ // aligned to page for fly frame anchored to paragraph or to character.
+ const RndStdIds eAnchorType = static_cast<RndStdIds >(pValidation->nAnchorType);
+ const SwPosition* pCntntPos = 0;
+ SdrView* pSdrView = pSh->GetDrawView();
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ if( rMarkList.GetMarkCount() == 1 )
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ SwFrmFmt* pFrmFmt = FindFrmFmt( pObj );
+ pCntntPos = pFrmFmt->GetAnchor().GetCntntAnchor();
+ }
+
+ pSh->CalcBoundRect( aBoundRect, eAnchorType,
+ pValidation->nHRelOrient,
+ pValidation->nVRelOrient,
+ pCntntPos,
+ pValidation->bFollowTextFlow,
+ pValidation->bMirror, NULL, &pValidation->aPercentSize);
+
+ BOOL bRTL;
+ BOOL bIsInVertical = pSh->IsFrmVertical(TRUE, bRTL);
+ if(bIsInVertical)
+ {
+ Point aPos(aBoundRect.Pos());
+ long nTmp = aPos.X();
+ aPos.X() = aPos.Y();
+ aPos.Y() = nTmp;
+ Size aSize(aBoundRect.SSize());
+ nTmp = aSize.Width();
+ aSize.Width() = aSize.Height();
+ aSize.Height() = nTmp;
+ aBoundRect.Chg( aPos, aSize );
+ //exchange width/height to enable correct values
+ nTmp = pValidation->nWidth;
+ pValidation->nWidth = pValidation->nHeight;
+ pValidation->nHeight = nTmp;
+ }
+ if ((eAnchorType == FLY_AT_PAGE) || (eAnchorType == FLY_AT_FLY))
+ {
+ // MinimalPosition
+ pValidation->nMinHPos = aBoundRect.Left();
+ pValidation->nMinVPos = aBoundRect.Top();
+ SwTwips nH = pValidation->nHPos;
+ SwTwips nV = pValidation->nVPos;
+
+ if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right())
+ {
+ if (pValidation->nHoriOrient == text::HoriOrientation::NONE)
+ {
+ pValidation->nHPos -= ((pValidation->nHPos + pValidation->nWidth) - aBoundRect.Right());
+ nH = pValidation->nHPos;
+ }
+ else
+ pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos;
+ }
+
+ if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right())
+ pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos;
+
+ if (pValidation->nVPos + pValidation->nHeight > aBoundRect.Bottom())
+ {
+ if (pValidation->nVertOrient == text::VertOrientation::NONE)
+ {
+ pValidation->nVPos -= ((pValidation->nVPos + pValidation->nHeight) - aBoundRect.Bottom());
+ nV = pValidation->nVPos;
+ }
+ else
+ pValidation->nHeight = aBoundRect.Bottom() - pValidation->nVPos;
+ }
+
+ if (pValidation->nVPos + pValidation->nHeight > aBoundRect.Bottom())
+ pValidation->nHeight = aBoundRect.Bottom() - pValidation->nVPos;
+
+ if ( pValidation->nVertOrient != text::VertOrientation::NONE )
+ nV = aBoundRect.Top();
+
+ if ( pValidation->nHoriOrient != text::HoriOrientation::NONE )
+ nH = aBoundRect.Left();
+
+ pValidation->nMaxHPos = aBoundRect.Right() - pValidation->nWidth;
+ pValidation->nMaxHeight = aBoundRect.Bottom() - nV;
+
+ pValidation->nMaxVPos = aBoundRect.Bottom() - pValidation->nHeight;
+ pValidation->nMaxWidth = aBoundRect.Right() - nH;
+ }
+ else if ((eAnchorType == FLY_AT_PARA) || (eAnchorType == FLY_AT_CHAR))
+ {
+ if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right())
+ {
+ if (pValidation->nHoriOrient == text::HoriOrientation::NONE)
+ {
+ pValidation->nHPos -= ((pValidation->nHPos + pValidation->nWidth) - aBoundRect.Right());
+ }
+ else
+ pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos;
+ }
+
+ // OD 29.09.2003 #i17567#, #i18732# - consider following the text flow
+ // and alignment at page areas.
+ const bool bMaxVPosAtBottom = !pValidation->bFollowTextFlow ||
+ pValidation->nVRelOrient == text::RelOrientation::PAGE_FRAME ||
+ pValidation->nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA;
+ {
+ SwTwips nTmpMaxVPos = ( bMaxVPosAtBottom
+ ? aBoundRect.Bottom()
+ : aBoundRect.Height() ) -
+ pValidation->nHeight;
+ if ( pValidation->nVPos > nTmpMaxVPos )
+ {
+ if (pValidation->nVertOrient == text::VertOrientation::NONE)
+ {
+ pValidation->nVPos = nTmpMaxVPos;
+ }
+ else
+ {
+ pValidation->nHeight = ( bMaxVPosAtBottom
+ ? aBoundRect.Bottom()
+ : aBoundRect.Height() ) - pValidation->nVPos;
+ }
+ }
+ }
+
+ pValidation->nMinHPos = aBoundRect.Left();
+ pValidation->nMaxHPos = aBoundRect.Right() - pValidation->nWidth;
+
+ pValidation->nMinVPos = aBoundRect.Top();
+ // OD 26.09.2003 #i17567#, #i18732# - determine maximum vertical position
+ if ( bMaxVPosAtBottom )
+ {
+ pValidation->nMaxVPos = aBoundRect.Bottom() - pValidation->nHeight;
+ }
+ else
+ {
+ pValidation->nMaxVPos = aBoundRect.Height() - pValidation->nHeight;
+ }
+
+ // Maximale Breite Hoehe
+ const SwTwips nH = ( pValidation->nHoriOrient != text::HoriOrientation::NONE )
+ ? aBoundRect.Left()
+ : pValidation->nHPos;
+ const SwTwips nV = ( pValidation->nVertOrient != text::VertOrientation::NONE )
+ ? aBoundRect.Top()
+ : pValidation->nVPos;
+ pValidation->nMaxHeight = pValidation->nMaxVPos + pValidation->nHeight - nV;
+ pValidation->nMaxWidth = pValidation->nMaxHPos + pValidation->nWidth - nH;
+ }
+ else if (eAnchorType == FLY_AS_CHAR)
+ {
+ pValidation->nMinHPos = 0;
+ pValidation->nMaxHPos = 0;
+
+ pValidation->nMaxHeight = aBoundRect.Height();
+ pValidation->nMaxWidth = aBoundRect.Width();
+
+ pValidation->nMaxVPos = aBoundRect.Height();
+ pValidation->nMinVPos = -aBoundRect.Height() + pValidation->nHeight;
+ if (pValidation->nMaxVPos < pValidation->nMinVPos)
+ {
+ pValidation->nMinVPos = pValidation->nMaxVPos;
+ pValidation->nMaxVPos = -aBoundRect.Height();
+ }
+ }
+ if(bIsInVertical)
+ {
+ //restore width/height exchange
+ long nTmp = pValidation->nWidth;
+ pValidation->nWidth = pValidation->nHeight;
+ pValidation->nHeight = nTmp;
+ }
+
+ if (pValidation->nMaxWidth < pValidation->nWidth)
+ pValidation->nWidth = pValidation->nMaxWidth;
+ if (pValidation->nMaxHeight < pValidation->nHeight)
+ pValidation->nHeight = pValidation->nMaxHeight;
+ return 0;
+}
+
+
+
+
diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx
new file mode 100644
index 000000000000..c95ad7e64c1c
--- /dev/null
+++ b/sw/source/ui/shells/drwtxtex.cxx
@@ -0,0 +1,1012 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <i18npool/mslangid.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <tools/shl.hxx>
+#include <svx/svdview.hxx>
+#include <editeng/spltitem.hxx>
+#include <editeng/orphitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <editeng/widwitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <editeng/escpitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/hyznitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/cntritem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svx/svdoutl.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/whiter.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svl/ctloptions.hxx>
+#include <svtools/langtab.hxx>
+#include <svl/languageoptions.hxx>
+#include <sfx2/bindings.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/flditem.hxx>
+#include <editeng/editstat.hxx>
+#include <svx/hlnkitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <svl/languageoptions.hxx>
+#include <svl/slstitm.hxx>
+#include <editeng/langitem.hxx>
+#include <svtools/langtab.hxx>
+#include <editeng/unolingu.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <editeng/writingmodeitem.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editdata.hxx>
+#include <editeng/outliner.hxx>
+#include <vcl/window.hxx>
+#include <editeng/editview.hxx>
+#include <vcl/outdev.hxx>
+#include <editeng/hyznitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/orphitem.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/spltitem.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdview.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/unolingu.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/widwitem.hxx>
+#include <editeng/writingmodeitem.hxx>
+#include <tools/shl.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/window.hxx>
+
+#include <cmdid.h>
+#include <doc.hxx>
+#include <docstat.hxx>
+#include <drwtxtsh.hxx>
+#include <edtwin.hxx>
+#include <globals.hrc>
+#include <hintids.hxx>
+#include <initui.hxx> // fuer SpellPointer
+#include <langhelper.hxx>
+#include <pardlg.hxx>
+#include <shells.hrc>
+#include <string.h>
+#include <swdtflvr.hxx>
+#include <swmodule.hxx>
+#include <swwait.hxx>
+#include <uitool.hxx>
+#include <viewopt.hxx>
+#include <wrtsh.hxx>
+#include <wview.hxx>
+
+#include "swabstdlg.hxx"
+#include "chrdlg.hrc"
+#include "misc.hrc"
+
+
+#include <langhelper.hxx>
+
+using namespace ::com::sun::star;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDrawTextShell::Execute( SfxRequest &rReq )
+{
+ SwWrtShell &rSh = GetShell();
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ SfxItemSet aEditAttr(pOLV->GetAttribs());
+ SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
+
+ sal_uInt16 nSlot = rReq.GetSlot();
+
+ sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
+ const SfxItemSet *pNewAttrs = rReq.GetArgs();
+
+ bool bRestoreSelection = false;
+ ESelection aOldSelection;
+
+ sal_uInt16 nEEWhich = 0;
+ switch (nSlot)
+ {
+ case SID_LANGUAGE_STATUS:
+ {
+ aOldSelection = pOLV->GetSelection();
+ if (!pOLV->GetEditView().HasSelection())
+ {
+ bRestoreSelection = true;
+ pOLV->GetEditView().SelectCurrentWord();
+ }
+
+ bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,GetView(),rSh);
+ break;
+ }
+
+ case SID_THES:
+ {
+ String aReplaceText;
+ SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, sal_False );
+ if (pItem2)
+ aReplaceText = pItem2->GetValue();
+ if (aReplaceText.Len() > 0)
+ ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
+ break;
+ }
+
+ case SID_ATTR_CHAR_FONT:
+ case SID_ATTR_CHAR_FONTHEIGHT:
+ case SID_ATTR_CHAR_WEIGHT:
+ case SID_ATTR_CHAR_POSTURE:
+ {
+ SfxItemPool* pPool2 = aEditAttr.GetPool()->GetSecondaryPool();
+ if( !pPool2 )
+ pPool2 = aEditAttr.GetPool();
+ SvxScriptSetItem aSetItem( nSlot, *pPool2 );
+
+ // #i78017 establish the same behaviour as in Writer
+ USHORT nScriptTypes = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
+ if (nSlot == SID_ATTR_CHAR_FONT)
+ nScriptTypes = pOLV->GetSelectedScriptType();
+
+ aSetItem.PutItemForScriptType( nScriptTypes, pNewAttrs->Get( nWhich ) );
+ aNewAttr.Put( aSetItem.GetItemSet() );
+ }
+ break;
+
+ case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
+
+ case SID_ATTR_CHAR_UNDERLINE:
+ {
+ FontUnderline eFU = ((const SvxUnderlineItem&)aEditAttr.Get(EE_CHAR_UNDERLINE)).GetLineStyle();
+ aNewAttr.Put(SvxUnderlineItem(eFU == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE));
+ }
+ break;
+
+ case SID_ATTR_CHAR_OVERLINE:
+ {
+ FontUnderline eFO = ((const SvxOverlineItem&)aEditAttr.Get(EE_CHAR_OVERLINE)).GetLineStyle();
+ aNewAttr.Put(SvxOverlineItem(eFO == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_OVERLINE));
+ }
+ break;
+
+ case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
+ case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW; break;
+ case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT; break;
+ case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
+ case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break;
+ case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
+ case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break;
+ case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH; break;
+ case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
+ case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
+ case SID_ATTR_PARA_ADJUST_LEFT:
+ aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_LEFT, EE_PARA_JUST));
+ break;
+ case SID_ATTR_PARA_ADJUST_CENTER:
+ aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST));
+ break;
+ case SID_ATTR_PARA_ADJUST_RIGHT:
+ aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_RIGHT, EE_PARA_JUST));
+ break;
+ case SID_ATTR_PARA_ADJUST_BLOCK:
+ aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST));
+ break;
+
+ case SID_ATTR_PARA_LINESPACE_10:
+ {
+ SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_LINE, EE_PARA_SBL);
+ aItem.SetPropLineSpace(100);
+ aNewAttr.Put(aItem);
+ }
+ break;
+ case SID_ATTR_PARA_LINESPACE_15:
+ {
+ SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_POINT_FIVE_LINES, EE_PARA_SBL);
+ aItem.SetPropLineSpace(150);
+ aNewAttr.Put(aItem);
+ }
+ break;
+ case SID_ATTR_PARA_LINESPACE_20:
+ {
+ SvxLineSpacingItem aItem(SVX_LINESPACE_TWO_LINES, EE_PARA_SBL);
+ aItem.SetPropLineSpace(200);
+ aNewAttr.Put(aItem);
+ }
+ break;
+
+ case FN_SET_SUPER_SCRIPT:
+ {
+ SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
+ SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
+ aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+
+ if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
+ aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
+ else
+ aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
+ aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
+ }
+ break;
+ case FN_SET_SUB_SCRIPT:
+ {
+ SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
+ SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
+ aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
+
+ if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
+ aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
+ else
+ aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
+ aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
+ }
+ break;
+
+ case SID_CHAR_DLG:
+ case SID_CHAR_DLG_FOR_PARAGRAPH:
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if( !pArgs )
+ {
+ aOldSelection = pOLV->GetSelection();
+ if (nSlot == SID_CHAR_DLG_FOR_PARAGRAPH)
+ {
+ // select current paragraph (and restore selection later on...)
+ EditView & rEditView = pOLV->GetEditView();
+ SwLangHelper::SelectPara( rEditView, rEditView.GetSelection() );
+ bRestoreSelection = true;
+ }
+
+ SwView* pView = &GetView();
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)) );
+ SfxItemSet aDlgAttr(GetPool(), EE_ITEMS_START, EE_ITEMS_END);
+
+ // util::Language gibts an der EditEngine nicht! Daher nicht im Set.
+
+ aDlgAttr.Put( aEditAttr );
+ aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) );
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( pView->GetWindow(), *pView, aDlgAttr, DLG_CHAR,0, sal_True );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ USHORT nRet = pDlg->Execute();
+ if(RET_OK == nRet )
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+ aNewAttr.Put(*pDlg->GetOutputItemSet());
+ }
+ delete( pDlg );
+ if(RET_OK != nRet)
+ return ;
+ }
+ else
+ aNewAttr.Put(*pArgs);
+ }
+ break;
+ case FN_FORMAT_FOOTNOTE_DLG:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), rView.GetWrtShell(), DLG_DOC_FOOTNOTE );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ break;
+ }
+ case FN_NUMBERING_OUTLINE_DLG:
+ {
+ SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
+ GetView().GetWindow(), &aTmp, GetView().GetWrtShell());
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ rReq.Done();
+ }
+ break;
+ case SID_OPEN_XML_FILTERSETTINGS:
+ {
+ try
+ {
+ uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY);
+ if( xDialog.is() )
+ {
+ xDialog->execute();
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ rReq.Ignore ();
+ }
+ break;
+ case FN_WORDCOUNT_DIALOG:
+ {
+ SwDocStat aCurr;
+ SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() );
+ {
+ SwWait aWait( *GetView().GetDocShell(), TRUE );
+ rSh.StartAction();
+ rSh.CountWords( aCurr );
+ rSh.UpdateDocStat( aDocStat );
+ rSh.EndAction();
+ }
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( GetView().GetWindow() );
+ pDialog->SetValues(aCurr, aDocStat );
+ pDialog->Execute();
+ delete pDialog;
+ }
+ break;
+ case SID_PARA_DLG:
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ if (!pArgs)
+ {
+ SwView* pView = &GetView();
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)) );
+ SfxItemSet aDlgAttr(GetPool(),
+ EE_ITEMS_START, EE_ITEMS_END,
+ SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
+ SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
+ SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
+ SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
+ 0);
+
+ aDlgAttr.Put(aEditAttr);
+
+ // Die Werte sind erst einmal uebernommen worden, um den Dialog anzuzeigen.
+ // Muss natuerlich noch geaendert werden
+ // aDlgAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
+
+ aDlgAttr.Put( SvxHyphenZoneItem( sal_False, RES_PARATR_HYPHENZONE) );
+ aDlgAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK ) );
+ aDlgAttr.Put( SvxFmtSplitItem( sal_True, RES_PARATR_SPLIT ) );
+ aDlgAttr.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
+ aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ SfxAbstractTabDialog* pDlg = pFact->CreateSwParaDlg( GetView().GetWindow(), GetView(), aDlgAttr,DLG_STD, DLG_PARA, 0, sal_True );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ USHORT nRet = pDlg->Execute();
+ if(RET_OK == nRet)
+ {
+ rReq.Done( *( pDlg->GetOutputItemSet() ) );
+ aNewAttr.Put(*pDlg->GetOutputItemSet());
+ }
+ delete( pDlg );
+ if(RET_OK != nRet)
+ return;
+ }
+ else
+ aNewAttr.Put(*pArgs);
+ }
+ break;
+ case SID_AUTOSPELL_CHECK:
+ {
+//!! JP 16.03.2001: why?? pSdrView = rSh.GetDrawView();
+//!! JP 16.03.2001: why?? pOutliner = pSdrView->GetTextEditOutliner();
+ SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
+ sal_uInt32 nCtrl = pOutliner->GetControlWord();
+
+ sal_Bool bSet = ((const SfxBoolItem&)rReq.GetArgs()->Get(
+ nSlot)).GetValue();
+ if(bSet)
+ nCtrl |= EE_CNTRL_ONLINESPELLING|EE_CNTRL_ALLOWBIGOBJS;
+ else
+ nCtrl &= ~EE_CNTRL_ONLINESPELLING;
+ pOutliner->SetControlWord(nCtrl);
+
+ rView.ExecuteSlot(rReq);
+ }
+ break;
+ case SID_HYPERLINK_SETLINK:
+ {
+ const SfxPoolItem* pItem = 0;
+ if(pNewAttrs)
+ pNewAttrs->GetItemState(nSlot, sal_False, &pItem);
+
+ if(pItem)
+ {
+ const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem;
+ SvxURLField aFld(rHLinkItem.GetURL(), rHLinkItem.GetName(), SVXURLFORMAT_APPDEFAULT);
+ aFld.SetTargetFrame(rHLinkItem.GetTargetFrame());
+
+ const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
+
+ if (pFieldItem && pFieldItem->GetField()->ISA(SvxURLField))
+ {
+ // Feld selektieren, so dass es beim Insert geloescht wird
+ ESelection aSel = pOLV->GetSelection();
+ aSel.nEndPos++;
+ pOLV->SetSelection(aSel);
+ }
+ pOLV->InsertField(SvxFieldItem(aFld, EE_FEATURE_FIELD));
+ }
+ }
+ break;
+
+ case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
+ case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
+ // Shellwechsel!
+ {
+ SdrObject* pTmpObj = pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+ SdrPageView* pTmpPV = pSdrView->GetSdrPageView();
+ SdrView* pTmpView = pSdrView;
+
+ pSdrView->SdrEndTextEdit(sal_True);
+
+ SfxItemSet aAttr( *aNewAttr.GetPool(),
+ SDRATTR_TEXTDIRECTION,
+ SDRATTR_TEXTDIRECTION );
+
+ aAttr.Put( SvxWritingModeItem(
+ nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
+ text::WritingMode_LR_TB
+ : text::WritingMode_TB_RL, SDRATTR_TEXTDIRECTION ) );
+ pTmpView->SetAttributes( aAttr );
+
+ rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin(), sal_False);
+ rSh.GetView().AttrChangedNotify( &rSh );
+ }
+ return;
+
+ case SID_ATTR_PARA_LEFT_TO_RIGHT:
+ case SID_ATTR_PARA_RIGHT_TO_LEFT:
+ {
+ SdrObject* pTmpObj = pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
+ SdrPageView* pTmpPV = pSdrView->GetSdrPageView();
+ SdrView* pTmpView = pSdrView;
+
+ pSdrView->SdrEndTextEdit(sal_True);
+ sal_Bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
+
+ const SfxPoolItem* pPoolItem;
+ if( pNewAttrs && SFX_ITEM_SET == pNewAttrs->GetItemState( nSlot, TRUE, &pPoolItem ) )
+ {
+ if( !( (SfxBoolItem*)pPoolItem)->GetValue() )
+ bLeftToRight = !bLeftToRight;
+ }
+ SfxItemSet aAttr( *aNewAttr.GetPool(),
+ EE_PARA_JUST, EE_PARA_JUST,
+ EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
+ 0 );
+
+ USHORT nAdjust = SVX_ADJUST_LEFT;
+ if( SFX_ITEM_ON == aEditAttr.GetItemState(EE_PARA_JUST, TRUE, &pPoolItem ) )
+ nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue();
+
+ if( bLeftToRight )
+ {
+ aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
+ if( nAdjust == SVX_ADJUST_RIGHT )
+ aAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
+ }
+ else
+ {
+ aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) );
+ if( nAdjust == SVX_ADJUST_LEFT )
+ aAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
+ }
+ pTmpView->SetAttributes( aAttr );
+ rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin(), sal_False );
+ rSh.GetView().AttrChangedNotify( &rSh );
+ }
+ return;
+ default:
+ ASSERT(!this, falscher Dispatcher);
+ return;
+ }
+ if(nEEWhich && pNewAttrs)
+ aNewAttr.Put(pNewAttrs->Get(nWhich), nEEWhich);
+
+ SetAttrToMarked(aNewAttr);
+
+ GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
+
+ if (IsTextEdit() && pOLV->GetOutliner()->IsModified())
+ rSh.SetModified();
+
+ if (bRestoreSelection)
+ {
+ // restore selection
+ pOLV->GetEditView().SetSelection( aOldSelection );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwDrawTextShell::GetState(SfxItemSet& rSet)
+{
+ if (!IsTextEdit()) // Sonst manchmal Absturz!
+ return;
+
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ SfxItemSet aEditAttr( pOLV->GetAttribs() );
+ const SfxPoolItem *pAdjust = 0, *pLSpace = 0, *pEscItem = 0;
+ int eAdjust, nLSpace, nEsc;
+
+ while(nWhich)
+ {
+ USHORT nSlotId = GetPool().GetSlotId( nWhich );
+ BOOL bFlag = FALSE;
+ switch( nSlotId )
+ {
+ case SID_LANGUAGE_STATUS://20412:
+ {
+ nSlotId = SwLangHelper::GetLanguageStatus(pOLV,rSet);;
+ break;
+ }
+
+ case SID_THES:
+ {
+ String aStatusVal;
+ LanguageType nLang = LANGUAGE_NONE;
+ bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() );
+ rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
+
+ // disable "Thesaurus" context menu entry if there is nothing to look up
+ uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
+ lang::Locale aLocale( SvxCreateLocale( nLang ) );
+ if (!bIsLookUpWord ||
+ !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale ))
+ rSet.DisableItem( SID_THES );
+
+ //! avoid puting the same item as SfxBoolItem at the end of this function
+ nSlotId = 0;
+ break;
+ }
+
+ case SID_ATTR_PARA_ADJUST_LEFT: eAdjust = SVX_ADJUST_LEFT; goto ASK_ADJUST;
+ case SID_ATTR_PARA_ADJUST_RIGHT: eAdjust = SVX_ADJUST_RIGHT; goto ASK_ADJUST;
+ case SID_ATTR_PARA_ADJUST_CENTER: eAdjust = SVX_ADJUST_CENTER; goto ASK_ADJUST;
+ case SID_ATTR_PARA_ADJUST_BLOCK: eAdjust = SVX_ADJUST_BLOCK; goto ASK_ADJUST;
+ASK_ADJUST:
+ {
+ if( !pAdjust )
+ aEditAttr.GetItemState( EE_PARA_JUST, sal_False, &pAdjust);
+
+ if( !pAdjust || IsInvalidItem( pAdjust ))
+ rSet.InvalidateItem( nSlotId ), nSlotId = 0;
+ else
+ bFlag = eAdjust == ((SvxAdjustItem*)pAdjust)->GetAdjust();
+ }
+ break;
+
+ case SID_ATTR_PARA_LINESPACE_10: nLSpace = 100; goto ASK_LINESPACE;
+ case SID_ATTR_PARA_LINESPACE_15: nLSpace = 150; goto ASK_LINESPACE;
+ case SID_ATTR_PARA_LINESPACE_20: nLSpace = 200; goto ASK_LINESPACE;
+ASK_LINESPACE:
+ {
+ if( !pLSpace )
+ aEditAttr.GetItemState( EE_PARA_SBL, sal_False, &pLSpace );
+
+ if( !pLSpace || IsInvalidItem( pLSpace ))
+ rSet.InvalidateItem( nSlotId ), nSlotId = 0;
+ else if( nLSpace == ((const SvxLineSpacingItem*)pLSpace)->
+ GetPropLineSpace() )
+ bFlag = sal_True;
+ else
+ nSlotId = 0;
+ }
+ break;
+
+ case FN_SET_SUPER_SCRIPT: nEsc = SVX_ESCAPEMENT_SUPERSCRIPT;
+ goto ASK_ESCAPE;
+ case FN_SET_SUB_SCRIPT: nEsc = SVX_ESCAPEMENT_SUBSCRIPT;
+ goto ASK_ESCAPE;
+ASK_ESCAPE:
+ {
+ if( !pEscItem )
+ pEscItem = &aEditAttr.Get( EE_CHAR_ESCAPEMENT );
+
+ if( nEsc == ((const SvxEscapementItem*)
+ pEscItem)->GetEnumValue() )
+ bFlag = sal_True;
+ else
+ nSlotId = 0;
+ }
+ break;
+
+ case SID_THESAURUS:
+ {
+ // disable "Thesaurus" if the language is not supported
+ const SfxPoolItem &rItem = GetShell().GetDoc()->GetDefault(
+ GetWhichOfScript( RES_CHRATR_LANGUAGE,
+ GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage())) );
+ LanguageType nLang = ((const SvxLanguageItem &) rItem).GetLanguage();
+
+ uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
+ if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( SvxCreateLocale( nLang ) ))
+ rSet.DisableItem( SID_THESAURUS );
+ nSlotId = 0;
+ }
+ break;
+ case SID_HANGUL_HANJA_CONVERSION:
+ case SID_CHINESE_CONVERSION:
+ {
+ if (!SvtCJKOptions().IsAnyEnabled())
+ {
+ GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
+ rSet.DisableItem(nWhich);
+ }
+ else
+ GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
+ }
+ break;
+
+ case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
+ case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
+ if ( !SvtLanguageOptions().IsVerticalTextEnabled() )
+ {
+ rSet.DisableItem( nSlotId );
+ nSlotId = 0;
+ }
+ else
+ {
+ SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
+ if( pOutliner )
+ bFlag = pOutliner->IsVertical() ==
+ (SID_TEXTDIRECTION_TOP_TO_BOTTOM == nSlotId);
+ else
+ {
+ text::WritingMode eMode = (text::WritingMode)
+ ( (const SvxWritingModeItem&) aEditAttr.Get( SDRATTR_TEXTDIRECTION ) ).GetValue();
+
+ if( nSlotId == SID_TEXTDIRECTION_LEFT_TO_RIGHT )
+ {
+ bFlag = eMode == text::WritingMode_LR_TB;
+ }
+ else
+ {
+ bFlag = eMode != text::WritingMode_TB_RL;
+ }
+ }
+ }
+ break;
+ case SID_ATTR_PARA_LEFT_TO_RIGHT:
+ case SID_ATTR_PARA_RIGHT_TO_LEFT:
+ {
+ if ( !SvtLanguageOptions().IsCTLFontEnabled() )
+ {
+ rSet.DisableItem( nWhich );
+ nSlotId = 0;
+ }
+ else
+ {
+ SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
+ if(pOutliner && pOutliner->IsVertical())
+ {
+ rSet.DisableItem( nWhich );
+ nSlotId = 0;
+ }
+ else
+ {
+ switch( ( ( (SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() )
+ {
+ case FRMDIR_HORI_LEFT_TOP:
+ bFlag = nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT;
+ break;
+
+ case FRMDIR_HORI_RIGHT_TOP:
+ bFlag = nWhich != SID_ATTR_PARA_LEFT_TO_RIGHT;
+ break;
+ }
+ }
+ }
+ }
+ break;
+ case SID_TRANSLITERATE_HALFWIDTH:
+ case SID_TRANSLITERATE_FULLWIDTH:
+ case SID_TRANSLITERATE_HIRAGANA:
+ case SID_TRANSLITERATE_KATAGANA:
+ {
+ SvtCJKOptions aCJKOptions;
+ if(!aCJKOptions.IsChangeCaseMapEnabled())
+ {
+ rSet.DisableItem(nWhich);
+ GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
+ }
+ else
+ GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
+ }
+ break;
+ case SID_INSERT_RLM :
+ case SID_INSERT_LRM :
+ case SID_INSERT_ZWNBSP :
+ case SID_INSERT_ZWSP:
+ {
+ SvtCTLOptions aCTLOptions;
+ sal_Bool bEnabled = aCTLOptions.IsCTLFontEnabled();
+ GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled );
+ if(!bEnabled)
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ default:
+ nSlotId = 0; // don't know this slot
+ break;
+ }
+
+ if( nSlotId )
+ rSet.Put( SfxBoolItem( nWhich, bFlag ));
+
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+void SwDrawTextShell::GetDrawTxtCtrlState(SfxItemSet& rSet)
+{
+ if (!IsTextEdit()) // Sonst Absturz!
+ return;
+
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ SfxItemSet aEditAttr(pOLV->GetAttribs());
+
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ USHORT nScriptType = pOLV->GetSelectedScriptType();
+ while(nWhich)
+ {
+ sal_uInt16 nEEWhich = 0;
+ USHORT nSlotId = GetPool().GetSlotId( nWhich );
+ switch( nSlotId )
+ {
+ case SID_ATTR_CHAR_FONT:
+ case SID_ATTR_CHAR_FONTHEIGHT:
+ case SID_ATTR_CHAR_WEIGHT:
+ case SID_ATTR_CHAR_POSTURE:
+ {
+ SfxItemPool* pEditPool = aEditAttr.GetPool()->GetSecondaryPool();
+ if( !pEditPool )
+ pEditPool = aEditAttr.GetPool();
+ SvxScriptSetItem aSetItem( nSlotId, *pEditPool );
+ aSetItem.GetItemSet().Put( aEditAttr, FALSE );
+ const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
+ if( pI )
+ rSet.Put( *pI, nWhich );
+ else
+ rSet.InvalidateItem( nWhich );
+ }
+ break;
+ case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
+ case SID_ATTR_CHAR_UNDERLINE: nEEWhich = EE_CHAR_UNDERLINE;break;
+ case SID_ATTR_CHAR_OVERLINE: nEEWhich = EE_CHAR_OVERLINE;break;
+ case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
+ case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW;break;
+ case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break;
+ case SID_AUTOSPELL_CHECK:
+ {
+ const SfxPoolItem* pState = rView.GetSlotState(nWhich);
+ if (pState)
+ rSet.Put(SfxBoolItem(nWhich, ((const SfxBoolItem*)pState)->GetValue()));
+ else
+ rSet.DisableItem( nWhich );
+ break;
+ }
+ case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
+ case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break;
+ case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
+ case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break;
+ case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH;break;
+ case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
+ case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
+ }
+ if(nEEWhich)
+ rSet.Put(aEditAttr.Get(nEEWhich, sal_True), nWhich);
+
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+void SwDrawTextShell::ExecClpbrd(SfxRequest &rReq)
+{
+ if (!IsTextEdit()) // Sonst Absturz!
+ return;
+
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+
+ ESelection aSel(pOLV->GetSelection());
+ const sal_Bool bCopy = (aSel.nStartPara != aSel.nEndPara) || (aSel.nStartPos != aSel.nEndPos);
+ sal_uInt16 nId = rReq.GetSlot();
+ switch( nId )
+ {
+ case SID_CUT:
+ if (bCopy)
+ pOLV->Cut();
+ return;
+
+ case SID_COPY:
+ if (bCopy)
+ pOLV->Copy();
+ return;
+
+ case SID_PASTE:
+ pOLV->PasteSpecial();
+ break;
+
+ default:
+ DBG_ERROR("falscher Dispatcher");
+ return;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: ClipBoard-Status
+ --------------------------------------------------------------------*/
+void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet)
+{
+ if (!IsTextEdit()) // Sonst Absturz!
+ return;
+
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ ESelection aSel(pOLV->GetSelection());
+ const sal_Bool bCopy = (aSel.nStartPara != aSel.nEndPara) ||
+ (aSel.nStartPos != aSel.nEndPos);
+
+
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while(nWhich)
+ {
+ switch(nWhich)
+ {
+ case SID_CUT:
+ case SID_COPY:
+ if( !bCopy )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case SID_PASTE:
+ {
+ TransferableDataHelper aDataHelper(
+ TransferableDataHelper::CreateFromSystemClipboard(
+ &GetView().GetEditWin() ) );
+
+ if( !aDataHelper.GetXTransferable().is() ||
+ !SwTransferable::IsPaste( GetShell(), aDataHelper ))
+ rSet.DisableItem( SID_PASTE );
+ }
+ break;
+
+ case SID_PASTE_SPECIAL:
+ rSet.DisableItem( SID_PASTE_SPECIAL );
+ break;
+ // --> OD 2008-06-20 #151110#
+ case SID_CLIPBOARD_FORMAT_ITEMS:
+ rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
+ break;
+ // <--
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Hyperlink-Status
+ --------------------------------------------------------------------*/
+
+void SwDrawTextShell::StateInsert(SfxItemSet &rSet)
+{
+ if (!IsTextEdit()) // Sonst Absturz!
+ return;
+
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+
+ while(nWhich)
+ {
+ switch(nWhich)
+ {
+ case SID_HYPERLINK_GETLINK:
+ {
+ SvxHyperlinkItem aHLinkItem;
+ aHLinkItem.SetInsertMode(HLINK_FIELD);
+
+ const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
+
+ if (pFieldItem)
+ {
+ const SvxFieldData* pField = pFieldItem->GetField();
+
+ if (pField->ISA(SvxURLField))
+ {
+ aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
+ aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
+ aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
+ }
+ }
+ else
+ {
+ String sSel(pOLV->GetSelected());
+ sSel.Erase(255);
+ sSel.EraseTrailingChars();
+ aHLinkItem.SetName(sSel);
+ }
+
+ sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
+ aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
+ ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
+
+ rSet.Put(aHLinkItem);
+ }
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx
new file mode 100644
index 000000000000..afd69a492c71
--- /dev/null
+++ b/sw/source/ui/shells/drwtxtsh.cxx
@@ -0,0 +1,912 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <i18npool/lang.h>
+#include <svl/slstitm.hxx>
+#include <svl/cjkoptions.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/langitem.hxx>
+#include <svx/svdview.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/objface.hxx>
+#include <svx/svdotext.hxx>
+#include <svx/xftsfit.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editview.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <svx/fontwork.hxx>
+#include <sfx2/request.hxx>
+#include <svl/whiter.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/editstat.hxx>
+#include <svx/svdoutl.hxx>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
+#include <com/sun/star/i18n/TextConversionOption.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <swtypes.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <viewopt.hxx>
+#include <initui.hxx> // fuer SpellPointer
+#include <drwtxtsh.hxx>
+#include <swundo.hxx>
+#include <breakit.hxx>
+
+#include <cmdid.h>
+#include <helpid.h>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _SHELLS_HRC
+#include <shells.hrc>
+#endif
+
+#define SwDrawTextShell
+#include <sfx2/msg.hxx>
+#include <swslots.hxx>
+#ifndef _POPUP_HRC
+#include <popup.hrc>
+#endif
+#include <uitool.hxx>
+#include <wview.hxx>
+#include <swmodule.hxx>
+
+#include <svx/xtable.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+
+#include <cppuhelper/bootstrap.hxx>
+
+#include "swabstdlg.hxx" //CHINA001
+#include "misc.hrc"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::i18n;
+
+
+
+SFX_IMPL_INTERFACE(SwDrawTextShell, SfxShell, SW_RES(STR_SHELLNAME_DRAW_TEXT))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_DRWTXT_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_DRAW_TEXT_TOOLBOX));
+ SFX_CHILDWINDOW_REGISTRATION(SvxFontWorkChildWindow::GetChildWindowId());
+}
+
+TYPEINIT1(SwDrawTextShell,SfxShell)
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+void SwDrawTextShell::Init()
+{
+ SwWrtShell &rSh = GetShell();
+ pSdrView = rSh.GetDrawView();
+ SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
+ //#97471# mouse click _and_ key input at the same time
+ if( !pOutliner )
+ return ;
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ ULONG nCtrl = pOutliner->GetControlWord();
+ nCtrl |= EE_CNTRL_AUTOCORRECT;
+
+ SetUndoManager(&pOutliner->GetUndoManager());
+
+ // jetzt versuchen wir mal ein AutoSpell
+
+ const SwViewOption* pVOpt = rSh.GetViewOptions();
+ if(pVOpt->IsOnlineSpell())
+ {
+ nCtrl |= EE_CNTRL_ONLINESPELLING|EE_CNTRL_ALLOWBIGOBJS;
+ }
+ else
+ nCtrl &= ~(EE_CNTRL_ONLINESPELLING);
+
+ pOutliner->SetControlWord(nCtrl);
+ pOLV->ShowCursor();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwDrawTextShell::SwDrawTextShell(SwView &rV) :
+ SfxShell(&rV),
+ rView(rV)
+{
+ SwWrtShell &rSh = GetShell();
+ SetPool(rSh.GetAttrPool().GetSecondaryPool());
+
+ Init();
+
+ rSh.NoEdit(TRUE);
+ SetName(String::CreateFromAscii("ObjectText"));
+ SetHelpId(SW_DRWTXTSHELL);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+__EXPORT SwDrawTextShell::~SwDrawTextShell()
+{
+ if ( GetView().GetCurShell() == this )
+ rView.ResetSubShell();
+
+ //MA 13. Nov. 96: Das kommt durchaus vor #33141#:
+ //(doppel-)Klick von einem Texteditmode in ein anderes Objekt, zwischendurch
+ //wird eine andere (Draw-)Shell gepusht, die alte aber noch nicht deletet.
+ //Dann wird vor dem Flush wieder ein DrawTextShell gepusht und der Mode ist
+ //eingeschaltet. In diesem Moment wird der Dispatcher geflusht und die alte
+ //DrawTextShell zerstoert.
+// ASSERT( !pSdrView->IsTextEdit(), "TextEdit in DTor DrwTxtSh?" );
+// if (pSdrView->IsTextEdit())
+// GetShell().EndTextEdit(); // Danebengeklickt, Ende mit Edit
+
+// GetShell().Edit();
+}
+
+SwWrtShell& SwDrawTextShell::GetShell()
+{
+ return rView.GetWrtShell();
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Slots mit dieser Statusmethode disablen
+ --------------------------------------------------------------------*/
+
+void SwDrawTextShell::StateDisableItems( SfxItemSet &rSet )
+{
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+
+ while (nWhich)
+ {
+ rSet.DisableItem( nWhich );
+ nWhich = aIter.NextWhich();
+ }
+}
+
+
+/*************************************************************************
+|*
+|* Attribute setzen
+|*
+\************************************************************************/
+
+
+
+void SwDrawTextShell::SetAttrToMarked(const SfxItemSet& rAttr)
+{
+ Rectangle aNullRect;
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ Rectangle aOutRect = pOLV->GetOutputArea();
+
+ if (aNullRect != aOutRect)
+ {
+ GetShell().GetDrawView()->SetAttributes(rAttr);
+// Init();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+BOOL SwDrawTextShell::IsTextEdit()
+{
+ return pSdrView->IsTextEdit();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+void SwDrawTextShell::ExecFontWork(SfxRequest& rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView()));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)) );
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ if ( rReq.GetArgs() )
+ {
+ pVFrame->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
+ ((const SfxBoolItem&) (rReq.GetArgs()->
+ Get(SID_FONTWORK))).GetValue());
+ }
+ else
+ pVFrame->ToggleChildWindow(SvxFontWorkChildWindow::GetChildWindowId());
+
+ pVFrame->GetBindings().Invalidate(SID_FONTWORK);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+void SwDrawTextShell::StateFontWork(SfxItemSet& rSet)
+{
+ const USHORT nId = SvxFontWorkChildWindow::GetChildWindowId();
+ rSet.Put(SfxBoolItem(SID_FONTWORK, GetView().GetViewFrame()->HasChildWindow(nId)));
+}
+
+/*************************************************************************
+|*
+|* SfxRequests fuer FontWork bearbeiten
+|*
+\************************************************************************/
+
+
+
+void SwDrawTextShell::ExecFormText(SfxRequest& rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ SdrView* pDrView = rSh.GetDrawView();
+
+ const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
+
+ if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() )
+ {
+ const SfxItemSet& rSet = *rReq.GetArgs();
+ const SfxPoolItem* pItem;
+
+ //ask for the ViewFrame here - "this" may not be valid any longer!
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ if ( pDrView->IsTextEdit() )
+ {
+ //#111733# Sometimes SdrEndTextEdit() initiates the change in selection and
+ // 'this' is not valid anymore
+ SwView& rTempView = GetView();
+ pDrView->SdrEndTextEdit(sal_True);
+ //this removes the current shell from the dispatcher stack!!
+ rTempView.AttrChangedNotify(&rSh);
+ }
+
+ if ( rSet.GetItemState(XATTR_FORMTXTSTDFORM, TRUE, &pItem) ==
+ SFX_ITEM_SET &&
+ ((const XFormTextStdFormItem*) pItem)->GetValue() != XFTFORM_NONE )
+ {
+
+ const USHORT nId = SvxFontWorkChildWindow::GetChildWindowId();
+ SvxFontWorkDialog* pDlg = (SvxFontWorkDialog*)(
+ pVFrame->GetChildWindow(nId)->GetWindow());
+
+ pDlg->CreateStdFormObj(*pDrView, *pDrView->GetSdrPageView(),
+ rSet, *rMarkList.GetMark(0)->GetMarkedSdrObj(),
+ ((const XFormTextStdFormItem*) pItem)->
+ GetValue());
+ }
+ else
+ pDrView->SetAttributes(rSet);
+ }
+
+}
+
+/*************************************************************************
+|*
+|* Statuswerte fuer FontWork zurueckgeben
+|*
+\************************************************************************/
+
+
+
+void SwDrawTextShell::GetFormTextState(SfxItemSet& rSet)
+{
+ SwWrtShell &rSh = GetShell();
+ SdrView* pDrView = rSh.GetDrawView();
+ const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
+ const SdrObject* pObj = NULL;
+ SvxFontWorkDialog* pDlg = NULL;
+
+ const USHORT nId = SvxFontWorkChildWindow::GetChildWindowId();
+
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ if ( pVFrame->HasChildWindow(nId) )
+ pDlg = (SvxFontWorkDialog*)(pVFrame->GetChildWindow(nId)->GetWindow());
+
+ if ( rMarkList.GetMarkCount() == 1 )
+ pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+
+ if ( pObj == NULL || !pObj->ISA(SdrTextObj) ||
+ !((SdrTextObj*) pObj)->HasText() )
+ {
+#define XATTR_ANZ 12
+ static const USHORT nXAttr[ XATTR_ANZ ] =
+ { XATTR_FORMTXTSTYLE, XATTR_FORMTXTADJUST, XATTR_FORMTXTDISTANCE,
+ XATTR_FORMTXTSTART, XATTR_FORMTXTMIRROR, XATTR_FORMTXTSTDFORM,
+ XATTR_FORMTXTHIDEFORM, XATTR_FORMTXTOUTLINE, XATTR_FORMTXTSHADOW,
+ XATTR_FORMTXTSHDWCOLOR, XATTR_FORMTXTSHDWXVAL, XATTR_FORMTXTSHDWYVAL
+ };
+ for( USHORT i = 0; i < XATTR_ANZ; )
+ rSet.DisableItem( nXAttr[ i++ ] );
+ }
+ else
+ {
+ if ( pDlg )
+ pDlg->SetColorTable(XColorTable::GetStdColorTable());
+
+ pDrView->GetAttributes( rSet );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+void SwDrawTextShell::ExecDrawLingu(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ if( rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() )
+ {
+ switch(rReq.GetSlot())
+ {
+ case SID_THESAURUS:
+ pOLV->StartThesaurus();
+ break;
+
+ case SID_HANGUL_HANJA_CONVERSION:
+ pOLV->StartTextConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL,
+ i18n::TextConversionOption::CHARACTER_BY_CHARACTER, sal_True, sal_False );
+ break;
+
+ case SID_CHINESE_CONVERSION:
+ {
+ //open ChineseTranslationDialog
+ Reference< XComponentContext > xContext(
+ ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
+ if(xContext.is())
+ {
+ Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
+ if(xMCF.is())
+ {
+ Reference< ui::dialogs::XExecutableDialog > xDialog(
+ xMCF->createInstanceWithContext(
+ rtl::OUString::createFromAscii("com.sun.star.linguistic2.ChineseTranslationDialog")
+ , xContext), UNO_QUERY);
+ Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY );
+ if( xInit.is() )
+ {
+ // initialize dialog
+ Reference< awt::XWindow > xDialogParentWindow(0);
+ Sequence<Any> aSeq(1);
+ Any* pArray = aSeq.getArray();
+ PropertyValue aParam;
+ aParam.Name = rtl::OUString::createFromAscii("ParentWindow");
+ aParam.Value <<= makeAny(xDialogParentWindow);
+ pArray[0] <<= makeAny(aParam);
+ xInit->initialize( aSeq );
+
+ //execute dialog
+ sal_Int16 nDialogRet = xDialog->execute();
+ if( RET_OK == nDialogRet )
+ {
+ //get some parameters from the dialog
+ sal_Bool bToSimplified = sal_True;
+ sal_Bool bUseVariants = sal_True;
+ sal_Bool bCommonTerms = sal_True;
+ Reference< beans::XPropertySet > xProp( xDialog, UNO_QUERY );
+ if( xProp.is() )
+ {
+ try
+ {
+ xProp->getPropertyValue( C2U("IsDirectionToSimplified") ) >>= bToSimplified;
+ xProp->getPropertyValue( C2U("IsUseCharacterVariants") ) >>= bUseVariants;
+ xProp->getPropertyValue( C2U("IsTranslateCommonTerms") ) >>= bCommonTerms;
+ }
+ catch( Exception& )
+ {
+ }
+ }
+
+ //execute translation
+ sal_Int16 nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
+ sal_Int16 nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
+ sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
+ if( !bCommonTerms )
+ nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
+
+ Font aTargetFont = pOLV->GetWindow()->GetDefaultFont( DEFAULTFONT_CJK_TEXT,
+ nTargetLang, DEFAULTFONT_FLAGS_ONLYONE );
+
+ pOLV->StartTextConversion( nSourceLang, nTargetLang, &aTargetFont, nOptions, sal_False, sal_False );
+ }
+ }
+ Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY );
+ if( xComponent.is() )
+ xComponent->dispose();
+ }
+ }
+ }
+ break;
+
+ default:
+ ASSERT(!this, "unexpected slot-id");
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+void SwDrawTextShell::ExecDraw(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ pSdrView = rSh.GetDrawView();
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+
+ switch (rReq.GetSlot())
+ {
+ case FN_INSERT_SOFT_HYPHEN:
+ case FN_INSERT_HARDHYPHEN:
+ case FN_INSERT_HARD_SPACE:
+ case SID_INSERT_RLM :
+ case SID_INSERT_LRM :
+ case SID_INSERT_ZWNBSP :
+ case SID_INSERT_ZWSP:
+ {
+ sal_Unicode cIns = 0;
+ switch(rReq.GetSlot())
+ {
+ case FN_INSERT_SOFT_HYPHEN: cIns = CHAR_SOFTHYPHEN; break;
+ case FN_INSERT_HARDHYPHEN: cIns = CHAR_HARDHYPHEN; break;
+ case FN_INSERT_HARD_SPACE: cIns = CHAR_HARDBLANK; break;
+ case SID_INSERT_RLM : cIns = CHAR_RLM ; break;
+ case SID_INSERT_LRM : cIns = CHAR_LRM ; break;
+ case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break;
+ case SID_INSERT_ZWNBSP: cIns = CHAR_ZWNBSP; break;
+ }
+ pOLV->InsertText( String(cIns));
+ rReq.Done();
+ }
+ break;
+ case SID_CHARMAP:
+ { // Sonderzeichen einfuegen
+ InsertSymbol(rReq);
+ break;
+ }
+ case FN_INSERT_STRING:
+ {
+ const SfxItemSet *pNewAttrs = rReq.GetArgs();
+ sal_uInt16 nSlot = rReq.GetSlot();
+ const SfxPoolItem* pItem = 0;
+ if(pNewAttrs)
+ {
+ pNewAttrs->GetItemState(nSlot, FALSE, &pItem );
+ pOLV->InsertText(((const SfxStringItem *)pItem)->GetValue());
+ }
+ break;
+ }
+
+ case SID_SELECTALL:
+ {
+ SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
+ if(pOutliner)
+ {
+ ULONG nParaCount = pOutliner->GetParagraphCount();
+ if (nParaCount > 0)
+ pOLV->SelectRange(0L, USHORT(nParaCount) );
+ }
+ }
+ break;
+
+ case FN_FORMAT_RESET: // delete hard text attributes
+ {
+ pOLV->RemoveAttribsKeepLanguages( true );
+ pOLV->GetEditView().GetEditEngine()->RemoveFields(TRUE);
+ rReq.Done();
+ }
+ break;
+
+ case FN_ESCAPE:
+ if (pSdrView->IsTextEdit())
+ {
+ // Shellwechsel!
+ rSh.EndTextEdit();
+ SwView& rTempView = rSh.GetView();
+ rTempView.ExitDraw();
+ rSh.Edit();
+ rTempView.AttrChangedNotify(&rSh);
+ return;
+ }
+ break;
+ case FN_DRAWTEXT_ATTR_DLG:
+ {
+ SfxItemSet aNewAttr( pSdrView->GetModel()->GetItemPool() );
+ pSdrView->GetAttributes( aNewAttr );
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog(
+ &(GetView().GetViewFrame()->GetWindow()),
+ &aNewAttr, pSdrView );
+ USHORT nResult = pDlg->Execute();
+
+ if (nResult == RET_OK)
+ {
+ if (pSdrView->AreObjectsMarked())
+ {
+ pSdrView->SetAttributes(*pDlg->GetOutputItemSet());
+ rReq.Done(*(pDlg->GetOutputItemSet()));
+ }
+ }
+
+ delete( pDlg );
+ }
+ }
+ break;
+
+ default:
+ ASSERT(!this, "unexpected slot-id");
+ return;
+ }
+
+ GetView().GetViewFrame()->GetBindings().InvalidateAll(FALSE);
+
+ if (IsTextEdit() && pOLV->GetOutliner()->IsModified())
+ rSh.SetModified();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Undo ausfuehren
+ --------------------------------------------------------------------*/
+
+
+
+void SwDrawTextShell::ExecUndo(SfxRequest &rReq)
+{
+ if( IsTextEdit() )
+ {
+ BOOL bCallBase = TRUE;
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ if( pArgs )
+ {
+ USHORT nId = rReq.GetSlot(), nCnt = 1;
+ const SfxPoolItem* pItem;
+ switch( nId )
+ {
+ case SID_UNDO:
+ case SID_REDO:
+ if( SFX_ITEM_SET == pArgs->GetItemState( nId, FALSE, &pItem ) &&
+ 1 < (nCnt = ((SfxUInt16Item*)pItem)->GetValue()) )
+ {
+ // then we make by ourself.
+ ::svl::IUndoManager* pUndoManager = GetUndoManager();
+ if( pUndoManager )
+ {
+ if( SID_UNDO == nId )
+ while( nCnt-- )
+ pUndoManager->Undo();
+ else
+ while( nCnt-- )
+ pUndoManager->Redo();
+ }
+ bCallBase = FALSE;
+ GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
+ }
+ break;
+ }
+ }
+ if( bCallBase )
+ {
+ SfxViewFrame *pSfxViewFrame = GetView().GetViewFrame();
+ pSfxViewFrame->ExecuteSlot(rReq, pSfxViewFrame->GetInterface());
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Zustand Undo
+ --------------------------------------------------------------------*/
+
+
+
+void SwDrawTextShell::StateUndo(SfxItemSet &rSet)
+{
+ if ( !IsTextEdit() )
+ return;
+
+ SfxViewFrame *pSfxViewFrame = GetView().GetViewFrame();
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+ while( nWhich )
+ {
+ switch ( nWhich )
+ {
+ case SID_GETUNDOSTRINGS:
+ case SID_GETREDOSTRINGS:
+ {
+ ::svl::IUndoManager* pUndoManager = GetUndoManager();
+ if( pUndoManager )
+ {
+ UniString (::svl::IUndoManager:: *fnGetComment)( size_t, bool const ) const;
+
+ sal_uInt16 nCount;
+ if( SID_GETUNDOSTRINGS == nWhich )
+ {
+ nCount = pUndoManager->GetUndoActionCount();
+ fnGetComment = &::svl::IUndoManager::GetUndoActionComment;
+ }
+ else
+ {
+ nCount = pUndoManager->GetRedoActionCount();
+ fnGetComment = &::svl::IUndoManager::GetRedoActionComment;
+ }
+ if( nCount )
+ {
+ String sList;
+ for( sal_uInt16 n = 0; n < nCount; ++n )
+ ( sList += (pUndoManager->*fnGetComment)( n, ::svl::IUndoManager::TopLevel ) )
+ += '\n';
+
+ SfxStringListItem aItem( nWhich );
+ aItem.SetString( sList );
+ rSet.Put( aItem );
+ }
+ }
+ else
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ default:
+ pSfxViewFrame->GetSlotState( nWhich,
+ pSfxViewFrame->GetInterface(), &rSet );
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+}
+
+void SwDrawTextShell::ExecTransliteration( SfxRequest & rReq )
+{
+ using namespace i18n;
+ {
+ sal_uInt32 nMode = 0;
+
+ switch( rReq.GetSlot() )
+ {
+ case SID_TRANSLITERATE_SENTENCE_CASE:
+ nMode = TransliterationModulesExtra::SENTENCE_CASE;
+ break;
+ case SID_TRANSLITERATE_TITLE_CASE:
+ nMode = TransliterationModulesExtra::TITLE_CASE;
+ break;
+ case SID_TRANSLITERATE_TOGGLE_CASE:
+ nMode = TransliterationModulesExtra::TOGGLE_CASE;
+ break;
+ case SID_TRANSLITERATE_UPPER:
+ nMode = TransliterationModules_LOWERCASE_UPPERCASE;
+ break;
+ case SID_TRANSLITERATE_LOWER:
+ nMode = TransliterationModules_UPPERCASE_LOWERCASE;
+ break;
+
+ case SID_TRANSLITERATE_HALFWIDTH:
+ nMode = TransliterationModules_FULLWIDTH_HALFWIDTH;
+ break;
+ case SID_TRANSLITERATE_FULLWIDTH:
+ nMode = TransliterationModules_HALFWIDTH_FULLWIDTH;
+ break;
+
+ case SID_TRANSLITERATE_HIRAGANA:
+ nMode = TransliterationModules_KATAKANA_HIRAGANA;
+ break;
+ case SID_TRANSLITERATE_KATAGANA:
+ nMode = TransliterationModules_HIRAGANA_KATAKANA;
+ break;
+
+ default:
+ ASSERT(!this, "falscher Dispatcher");
+ }
+
+ if( nMode )
+ {
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ pOLV->TransliterateText( nMode );
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sonderzeichen einfuegen (siehe SDraw: FUBULLET.CXX)
+ --------------------------------------------------------------------*/
+
+void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
+{
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ if(!pOLV)
+ return;
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+ if( pArgs )
+ pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), FALSE, &pItem);
+
+ String sSym;
+ String sFontName;
+ if ( pItem )
+ {
+ sSym = ((const SfxStringItem*)pItem)->GetValue();
+ const SfxPoolItem* pFtItem = NULL;
+ pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), FALSE, &pFtItem);
+ const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
+ if ( pFontItem )
+ sFontName = pFontItem->GetValue();
+ }
+
+ SfxItemSet aSet(pOLV->GetAttribs());
+ USHORT nScript = pOLV->GetSelectedScriptType();
+ SvxFontItem aSetDlgFont( RES_CHRATR_FONT );
+ {
+ SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
+ aSetItem.GetItemSet().Put( aSet, FALSE );
+ const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
+ if( pI )
+ aSetDlgFont = *(SvxFontItem*)pI;
+ else
+ aSetDlgFont = (SvxFontItem&)aSet.Get( GetWhichOfScript(
+ SID_ATTR_CHAR_FONT,
+ GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ) ));
+ if (!sFontName.Len())
+ sFontName = aSetDlgFont.GetFamilyName();
+ }
+
+ Font aFont(sFontName, Size(1,1));
+ if(!sSym.Len())
+ {
+ SfxAllItemSet aAllSet( GetPool() );
+ aAllSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) );
+
+ SwViewOption aOpt(*rView.GetWrtShell().GetViewOptions());
+ String sSymbolFont = aOpt.GetSymbolFont();
+ if( sSymbolFont.Len() )
+ aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
+ else
+ aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) );
+
+ // Wenn Zeichen selektiert ist kann es angezeigt werden
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet,
+ rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
+ USHORT nResult = pDlg->Execute();
+ if( nResult == RET_OK )
+ {
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, FALSE );
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, FALSE );
+ if ( pFontItem )
+ {
+ aFont.SetName( pFontItem->GetFamilyName() );
+ aFont.SetStyleName( pFontItem->GetStyleName() );
+ aFont.SetCharSet( pFontItem->GetCharSet() );
+ aFont.SetPitch( pFontItem->GetPitch() );
+ }
+
+ if ( pCItem )
+ {
+ sSym = pCItem->GetValue();
+ aOpt.SetSymbolFont(aFont.GetName());
+ SW_MOD()->ApplyUsrPref(aOpt, &rView);
+ }
+ }
+
+ delete( pDlg );
+ }
+
+ if( sSym.Len() )
+ {
+ // nicht flackern
+ pOLV->HideCursor();
+ SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
+ pOutliner->SetUpdateMode(FALSE);
+
+ SfxItemSet aOldSet( pOLV->GetAttribs() );
+ SfxItemSet aFontSet( *aOldSet.GetPool(),
+ EE_CHAR_FONTINFO, EE_CHAR_FONTINFO,
+ EE_CHAR_FONTINFO_CJK, EE_CHAR_FONTINFO_CJK,
+ EE_CHAR_FONTINFO_CTL, EE_CHAR_FONTINFO_CTL,
+ 0 );
+ aFontSet.Set( aOldSet );
+
+ // String einfuegen
+ pOLV->InsertText( sSym );
+
+ // attributieren (Font setzen)
+ SfxItemSet aFontAttribSet( *aFontSet.GetPool(), aFontSet.GetRanges() );
+ SvxFontItem aFontItem (aFont.GetFamily(), aFont.GetName(),
+ aFont.GetStyleName(), aFont.GetPitch(),
+ aFont.GetCharSet(),
+ EE_CHAR_FONTINFO );
+ nScript = pBreakIt->GetAllScriptsOfText( sSym );
+ if( SCRIPTTYPE_LATIN & nScript )
+ aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO );
+ if( SCRIPTTYPE_ASIAN & nScript )
+ aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO_CJK );
+ if( SCRIPTTYPE_COMPLEX & nScript )
+ aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO_CTL );
+ pOLV->SetAttribs(aFontAttribSet);
+
+ // Selektion loeschen
+ ESelection aSel(pOLV->GetSelection());
+ aSel.nStartPara = aSel.nEndPara;
+ aSel.nStartPos = aSel.nEndPos;
+ pOLV->SetSelection(aSel);
+
+ // Alten Font restaurieren
+ pOLV->SetAttribs( aFontSet );
+
+ // ab jetzt wieder anzeigen
+ pOutliner->SetUpdateMode(TRUE);
+ pOLV->ShowCursor();
+
+ rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) );
+ if(aFont.GetName().Len())
+ rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetName() ) );
+ rReq.Done();
+ }
+}
+/*-- 22.10.2003 14:26:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::svl::IUndoManager* SwDrawTextShell::GetUndoManager()
+{
+ SwWrtShell &rSh = GetShell();
+ pSdrView = rSh.GetDrawView();
+ SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
+ pOutliner = pSdrView->GetTextEditOutliner();
+ return &pOutliner->GetUndoManager();
+}
+
+
+
diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx
new file mode 100644
index 000000000000..1bb2ae01ba6e
--- /dev/null
+++ b/sw/source/ui/shells/frmsh.cxx
@@ -0,0 +1,1155 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <svl/whiter.hxx>
+#include <svtools/imapobj.hxx>
+#include <svl/srchitem.hxx>
+#include <svtools/imap.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <basic/sbstar.hxx>
+#include <svl/rectitem.hxx>
+#include <svl/ptitem.hxx>
+#include <svl/stritem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/bolnitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/protitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/objface.hxx>
+#include <svx/hlnkitem.hxx>
+// --> OD 2009-07-07 #i73249#
+#include <svx/svdview.hxx>
+#include <vcl/msgbox.hxx>
+// <--
+
+#include <doc.hxx>
+#include <fmturl.hxx>
+#include <fmtclds.hxx>
+#include <fmtcnct.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <wview.hxx>
+#include <frmatr.hxx>
+#include <uitool.hxx>
+#include <frmfmt.hxx>
+#include <frmsh.hxx>
+#include <frmmgr.hxx>
+#include <frmdlg.hxx>
+#include <swevent.hxx>
+#include <usrpref.hxx>
+#include <edtwin.hxx>
+#include <swdtflvr.hxx>
+#include <swwait.hxx>
+#include <docstat.hxx>
+#include <IDocumentStatistics.hxx>
+
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+
+#include <helpid.h>
+#include <cmdid.h>
+#include <cfgitems.hxx>
+#include <globals.hrc>
+#include <popup.hrc>
+#include <shells.hrc>
+#include "swabstdlg.hxx"
+#include "misc.hrc"
+// --> OD 2009-07-14 #i73249#
+#include <svx/dialogs.hrc>
+// <--
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+// Prototypen ------------------------------------------------------------
+
+void lcl_FrmGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine);
+const SwFrmFmt* lcl_GetFrmFmtByName(SwWrtShell& rSh, const String& rName)
+{
+ sal_uInt16 nCount = rSh.GetFlyCount(FLYCNTTYPE_FRM);
+ for( sal_uInt16 i = 0; i < nCount; i++)
+ {
+ const SwFrmFmt* pFmt = rSh.GetFlyNum(i, FLYCNTTYPE_FRM);
+ if(pFmt->GetName() == rName)
+ return pFmt;
+ }
+ return 0;
+}
+
+#define SwFrameShell
+#include <sfx2/msg.hxx>
+#include "swslots.hxx"
+
+SFX_IMPL_INTERFACE(SwFrameShell, SwBaseShell, SW_RES(STR_SHELLNAME_FRAME))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_FRM_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_FRAME_TOOLBOX));
+}
+
+
+
+void SwFrameShell::Execute(SfxRequest &rReq)
+{
+ //Erstmal die, die keinen FrmMgr benoetigen.
+ SwWrtShell &rSh = GetShell();
+ BOOL bMore = FALSE;
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+ USHORT nSlot = rReq.GetSlot();
+
+ switch ( nSlot )
+ {
+ case FN_FRAME_TO_ANCHOR:
+ if ( rSh.IsFrmSelected() )
+ {
+ rSh.GotoFlyAnchor();
+ rSh.EnterStdMode();
+ rSh.CallChgLnk();
+ }
+ break;
+ case SID_FRAME_TO_TOP:
+ rSh.SelectionToTop();
+ break;
+
+ case SID_FRAME_TO_BOTTOM:
+ rSh.SelectionToBottom();
+ break;
+
+ case FN_FRAME_UP:
+ rSh.SelectionToTop( FALSE );
+ break;
+
+ case FN_FRAME_DOWN:
+ rSh.SelectionToBottom( FALSE );
+ break;
+ case FN_INSERT_FRAME:
+ if (!pArgs)
+ {
+ // Rahmen existiert bereits, Rahmendialog zur Bearbeitung oeffnen
+ SfxUInt16Item aDefPage(FN_FORMAT_FRAME_DLG, TP_COLUMN);
+ rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( FN_FORMAT_FRAME_DLG,
+ SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD,
+ &aDefPage, 0L );
+
+ }
+ else
+ {
+ // Rahmen existiert bereits, nur Spaltenanzahl wird geaendert
+ USHORT nCols = 1;
+ if(pArgs->GetItemState(SID_ATTR_COLUMNS, FALSE, &pItem) == SFX_ITEM_SET)
+ nCols = ((SfxUInt16Item *)pItem)->GetValue();
+
+ SfxItemSet aSet(GetPool(),RES_COL,RES_COL);
+ rSh.GetFlyFrmAttr( aSet );
+ SwFmtCol aCol((const SwFmtCol&)aSet.Get(RES_COL));
+ // GutterWidth wird nicht immer uebergeben, daher erst besorgen (siehe view2: Execute auf diesen Slot)
+ USHORT nGutterWidth = aCol.GetGutterWidth();
+ if(!nCols )
+ nCols++;
+ aCol.Init(nCols, nGutterWidth, aCol.GetWishWidth());
+ aSet.Put(aCol);
+ // Vorlagen-AutoUpdate
+ SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
+ if(pFmt && pFmt->IsAutoUpdateFmt())
+ {
+ rSh.AutoUpdateFrame(pFmt, aSet);
+ }
+ else
+ {
+ rSh.StartAllAction();
+ rSh.SetFlyFrmAttr( aSet );
+ rSh.SetModified();
+ rSh.EndAllAction();
+ }
+
+ }
+ return;
+
+ case SID_HYPERLINK_SETLINK:
+ {
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_HYPERLINK_SETLINK, FALSE, &pItem))
+ {
+ const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem;
+ const String& rURL = rHLinkItem.GetURL();
+ const String& rTarget = rHLinkItem.GetTargetFrame();
+
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
+ rSh.GetFlyFrmAttr( aSet );
+ SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
+
+ String sOldName(rHLinkItem.GetName());
+ String sFlyName(rSh.GetFlyName());
+ if (sOldName.ToUpperAscii() != sFlyName.ToUpperAscii())
+ {
+ String sName(sOldName);
+ USHORT i = 1;
+ while (rSh.FindFlyByName(sName))
+ {
+ sName = sOldName;
+ sName += '_';
+ sName += String::CreateFromInt32(i++);
+ }
+ rSh.SetFlyName(sName);
+ }
+ aURL.SetURL( rURL, FALSE );
+ aURL.SetTargetFrameName(rTarget);
+
+ aSet.Put( aURL );
+ rSh.SetFlyFrmAttr( aSet );
+ }
+ }
+ break;
+
+ case FN_FRAME_CHAIN:
+ rSh.GetView().GetEditWin().SetChainMode( !rSh.GetView().GetEditWin().IsChainMode() );
+ break;
+
+ case FN_FRAME_UNCHAIN:
+ rSh.Unchain( (SwFrmFmt&)*rSh.GetFlyFrmFmt() );
+ GetView().GetViewFrame()->GetBindings().Invalidate(FN_FRAME_CHAIN);
+ break;
+ case FN_FORMAT_FOOTNOTE_DLG:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), GetView().GetWrtShell(), DLG_DOC_FOOTNOTE );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ break;
+ }
+ case FN_NUMBERING_OUTLINE_DLG:
+ {
+ SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
+ GetView().GetWindow(), &aTmp, GetView().GetWrtShell());
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ rReq.Done();
+ break;
+ }
+ case SID_OPEN_XML_FILTERSETTINGS:
+ {
+ try
+ {
+ uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY);
+ if( xDialog.is() )
+ {
+ xDialog->execute();
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ rReq.Ignore ();
+ }
+ break;
+ case FN_WORDCOUNT_DIALOG:
+ {
+ SwDocStat aCurr;
+ SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() );
+ {
+ SwWait aWait( *GetView().GetDocShell(), TRUE );
+ rSh.StartAction();
+ rSh.CountWords( aCurr );
+ rSh.UpdateDocStat( aDocStat );
+ rSh.EndAction();
+ }
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( GetView().GetWindow() );
+ pDialog->SetValues(aCurr, aDocStat );
+ pDialog->Execute();
+ delete pDialog;
+ }
+ break;
+ default: bMore = TRUE;
+ }
+
+ if ( !bMore )
+ {
+ return;
+ }
+
+ SwFlyFrmAttrMgr aMgr( FALSE, &rSh, FRMMGR_TYPE_NONE );
+ BOOL bUpdateMgr = TRUE;
+ BOOL bCopyToFmt = FALSE;
+ switch ( nSlot )
+ {
+ case SID_OBJECT_ALIGN_MIDDLE:
+ case FN_FRAME_ALIGN_VERT_CENTER:
+ aMgr.SetVertOrientation( text::VertOrientation::CENTER );
+ break;
+ case SID_OBJECT_ALIGN_DOWN :
+ case FN_FRAME_ALIGN_VERT_BOTTOM:
+ aMgr.SetVertOrientation( text::VertOrientation::BOTTOM );
+ break;
+ case SID_OBJECT_ALIGN_UP :
+ case FN_FRAME_ALIGN_VERT_TOP:
+ aMgr.SetVertOrientation( text::VertOrientation::TOP );
+ break;
+
+ case FN_FRAME_ALIGN_VERT_CHAR_CENTER:
+ aMgr.SetVertOrientation( text::VertOrientation::CHAR_CENTER );
+ break;
+
+ case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM:
+ aMgr.SetVertOrientation( text::VertOrientation::CHAR_BOTTOM );
+ break;
+
+ case FN_FRAME_ALIGN_VERT_CHAR_TOP:
+ aMgr.SetVertOrientation( text::VertOrientation::CHAR_TOP );
+ break;
+
+ case FN_FRAME_ALIGN_VERT_ROW_CENTER:
+ aMgr.SetVertOrientation( text::VertOrientation::LINE_CENTER );
+ break;
+
+ case FN_FRAME_ALIGN_VERT_ROW_BOTTOM:
+ aMgr.SetVertOrientation( text::VertOrientation::LINE_BOTTOM );
+ break;
+
+ case FN_FRAME_ALIGN_VERT_ROW_TOP:
+ aMgr.SetVertOrientation( text::VertOrientation::LINE_TOP );
+ break;
+ case SID_OBJECT_ALIGN_CENTER :
+ case FN_FRAME_ALIGN_HORZ_CENTER:
+ aMgr.SetHorzOrientation( text::HoriOrientation::CENTER );
+ break;
+ case SID_OBJECT_ALIGN_RIGHT:
+ case FN_FRAME_ALIGN_HORZ_RIGHT:
+ aMgr.SetHorzOrientation( text::HoriOrientation::RIGHT );
+ break;
+ case SID_OBJECT_ALIGN_LEFT:
+ case FN_FRAME_ALIGN_HORZ_LEFT:
+ aMgr.SetHorzOrientation( text::HoriOrientation::LEFT );
+ break;
+
+ case FN_SET_FRM_POSITION:
+ {
+ aMgr.SetAbsPos(((SfxPointItem &)pArgs->Get
+ (FN_SET_FRM_POSITION)).GetValue());
+ }
+ break;
+ case SID_ATTR_BRUSH:
+ {
+ if(pArgs)
+ {
+ aMgr.SetAttrSet( *pArgs );
+ bCopyToFmt = TRUE;
+ }
+ }
+ break;
+ case SID_ATTR_ULSPACE:
+ case SID_ATTR_LRSPACE:
+ {
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(GetPool().GetWhich(nSlot), FALSE, &pItem))
+ {
+ aMgr.SetAttrSet( *pArgs );
+ if(SID_ATTR_ULSPACE == nSlot && SID_ATTR_ULSPACE == nSlot)
+ bCopyToFmt = TRUE;
+ }
+ }
+ break;
+ case FN_FORMAT_FRAME_DLG:
+ {
+ const int nSel = rSh.GetSelectionType();
+ if (nSel & nsSelectionType::SEL_GRF)
+ {
+ rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_GRAFIC_DLG);
+ bUpdateMgr = FALSE;
+ }
+ else
+ {
+ SfxItemSet aSet(GetPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ FN_GET_PRINT_AREA, FN_GET_PRINT_AREA,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ SID_ATTR_BRUSH, SID_ATTR_BRUSH,
+ SID_ATTR_LRSPACE, SID_ATTR_ULSPACE,
+ FN_SURROUND, FN_HORI_ORIENT,
+ FN_SET_FRM_NAME, FN_SET_FRM_NAME,
+ FN_KEEP_ASPECT_RATIO, FN_KEEP_ASPECT_RATIO,
+ SID_DOCFRAME, SID_DOCFRAME,
+ SID_HTML_MODE, SID_HTML_MODE,
+ FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME,
+ FN_PARAM_CHAIN_PREVIOUS, FN_PARAM_CHAIN_NEXT,
+ FN_OLE_IS_MATH, FN_OLE_IS_MATH,
+ FN_MATH_BASELINE_ALIGNMENT, FN_MATH_BASELINE_ALIGNMENT,
+ 0);
+
+ const SwViewOption* pVOpt = rSh.GetViewOptions();
+ if(nSel & nsSelectionType::SEL_OLE)
+ aSet.Put( SfxBoolItem(FN_KEEP_ASPECT_RATIO, pVOpt->IsKeepRatio()) );
+ aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
+ aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
+ if( nSel & nsSelectionType::SEL_OLE )
+ {
+ // --> OD 2009-07-13 #i73249#
+// aSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, rSh.GetAlternateText()));
+ aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
+ // <--
+ }
+
+ const SwRect &rPg = rSh.GetAnyCurRect(RECT_PAGE);
+ SwFmtFrmSize aFrmSize(ATT_VAR_SIZE, rPg.Width(), rPg.Height());
+ aFrmSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE));
+ aSet.Put(aFrmSize);
+
+ const SwRect &rPr = rSh.GetAnyCurRect(RECT_PAGE_PRT);
+ SwFmtFrmSize aPrtSize(ATT_VAR_SIZE, rPr.Width(), rPr.Height());
+ aPrtSize.SetWhich(GetPool().GetWhich(FN_GET_PRINT_AREA));
+ aSet.Put(aPrtSize);
+
+ aSet.Put(aMgr.GetAttrSet());
+ aSet.SetParent( aMgr.GetAttrSet().GetParent() );
+
+ // Bei %-Werten Groesse initialisieren
+ SwFmtFrmSize& rSize = (SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE);
+ if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != 0xff)
+ rSize.SetWidth(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width());
+ if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != 0xff)
+ rSize.SetHeight(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height());
+
+ // disable vertical positioning for Math Objects anchored 'as char' if baseline alignment is activated
+ aSet.Put( SfxBoolItem( FN_MATH_BASELINE_ALIGNMENT,
+ rSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) ) );
+ const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() );
+ aSet.Put( SfxBoolItem( FN_OLE_IS_MATH, xObj.is() && SotExchange::IsMath( xObj->getClassID() ) ) );
+
+ UINT16 nDefPage = 0;
+ if(pArgs && pArgs->GetItemState(FN_FORMAT_FRAME_DLG, FALSE, &pItem) == SFX_ITEM_SET)
+ nDefPage = ((SfxUInt16Item *)pItem)->GetValue();
+
+ aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame()));
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric) ));
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ SfxAbstractTabDialog* pDlg = pFact->CreateFrmTabDialog( DLG_FRM_STD,
+ GetView().GetViewFrame(),
+ GetView().GetWindow(),
+ aSet, FALSE,
+ nSel & nsSelectionType::SEL_GRF ? DLG_FRM_GRF :
+ nSel & nsSelectionType::SEL_OLE ? DLG_FRM_OLE :
+ DLG_FRM_STD,
+ FALSE,
+ nDefPage);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+
+ if ( pDlg->Execute() )
+ {
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ if(pOutSet)
+ {
+ rReq.Done(*pOutSet);
+ if(nSel & nsSelectionType::SEL_OLE &&
+ SFX_ITEM_SET == pOutSet->GetItemState(FN_KEEP_ASPECT_RATIO, TRUE, &pItem))
+ {
+ SwViewOption aUsrPref( *pVOpt );
+ aUsrPref.SetKeepRatio(((const SfxBoolItem*)pItem)->GetValue());
+ SW_MOD()->ApplyUsrPref(aUsrPref, &GetView());
+ }
+ if (SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_ALT_NAME, TRUE, &pItem))
+ {
+ // --> OD 2009-07-13 #i73249#
+// rSh.SetAlternateText(((const SfxStringItem*)pItem)->GetValue());
+ rSh.SetObjTitle(((const SfxStringItem*)pItem)->GetValue());
+ // <--
+ }
+ // Vorlagen-AutoUpdate
+ SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
+ if(pFmt && pFmt->IsAutoUpdateFmt())
+ {
+ rSh.AutoUpdateFrame(pFmt, *pOutSet);
+ // alles, dass das Format nicht kann, muss hart
+ // gesetzt werden
+ if(SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_NAME, FALSE, &pItem))
+ rSh.SetFlyName(((SfxStringItem*)pItem)->GetValue());
+ SfxItemSet aShellSet(GetPool(), RES_FRM_SIZE, RES_FRM_SIZE,
+ RES_SURROUND, RES_SURROUND,
+ RES_ANCHOR, RES_ANCHOR,
+ RES_VERT_ORIENT,RES_HORI_ORIENT,
+ 0);
+ aShellSet.Put(*pOutSet);
+ aMgr.SetAttrSet(aShellSet);
+ if(SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_NAME, FALSE, &pItem))
+ rSh.SetFlyName(((SfxStringItem*)pItem)->GetValue());
+ }
+ else
+ aMgr.SetAttrSet( *pOutSet );
+
+ const SwFrmFmt* pCurrFlyFmt = rSh.GetFlyFrmFmt();
+ if(SFX_ITEM_SET ==
+ pOutSet->GetItemState(FN_PARAM_CHAIN_PREVIOUS,
+ FALSE, &pItem))
+ {
+ rSh.HideChainMarker();
+
+ String sPrevName =
+ ((const SfxStringItem*)pItem)->GetValue();
+ const SwFmtChain &rChain = pCurrFlyFmt->GetChain();
+ //needs cast - no non-const method available
+ SwFlyFrmFmt* pFlyFmt =
+ (SwFlyFrmFmt*)rChain.GetPrev();
+ if(pFlyFmt)
+ {
+ if (pFlyFmt->GetName() != sPrevName)
+ {
+ rSh.Unchain(*pFlyFmt);
+ }
+ else
+ sPrevName.Erase();
+ }
+
+ if(sPrevName.Len())
+ {
+ //needs cast - no non-const method available
+ SwFrmFmt* pPrevFmt = (SwFrmFmt*)
+ lcl_GetFrmFmtByName(rSh, sPrevName);
+ DBG_ASSERT(pPrevFmt, "No frame found!");
+ if(pPrevFmt)
+ {
+ rSh.Chain(*pPrevFmt, *pCurrFlyFmt);
+ }
+ }
+ rSh.SetChainMarker();
+ }
+ if(SFX_ITEM_SET ==
+ pOutSet->GetItemState(FN_PARAM_CHAIN_NEXT, FALSE,
+ &pItem))
+ {
+ rSh.HideChainMarker();
+ String sNextName =
+ ((const SfxStringItem*)pItem)->GetValue();
+ const SwFmtChain &rChain = pCurrFlyFmt->GetChain();
+ //needs cast - no non-const method available
+ SwFlyFrmFmt* pFlyFmt =
+ (SwFlyFrmFmt*)rChain.GetNext();
+ if(pFlyFmt)
+ {
+ if (pFlyFmt->GetName() != sNextName)
+ {
+ rSh.Unchain(*((SwFlyFrmFmt*) pCurrFlyFmt));
+ }
+ else
+ sNextName.Erase();
+ }
+
+ if(sNextName.Len())
+ {
+ //needs cast - no non-const method available
+ SwFrmFmt* pNextFmt = (SwFrmFmt*)
+ lcl_GetFrmFmtByName(rSh, sNextName);
+ DBG_ASSERT(pNextFmt, "No frame found!");
+ if(pNextFmt)
+ {
+ rSh.Chain(*(SwFrmFmt*)
+ pCurrFlyFmt, *pNextFmt);
+ }
+ }
+ rSh.SetChainMarker();
+ }
+ }
+ }
+ else
+ bUpdateMgr = FALSE;
+ delete pDlg;
+ }
+ }
+ break;
+ case FN_FRAME_MIRROR_ON_EVEN_PAGES:
+ {
+ SwFmtHoriOrient aHori(aMgr.GetHoriOrient());
+ BOOL bMirror = !aHori.IsPosToggle();
+ aHori.SetPosToggle(bMirror);
+ SfxItemSet aSet(GetPool(), RES_HORI_ORIENT, RES_HORI_ORIENT);
+ aSet.Put(aHori);
+ aMgr.SetAttrSet(aSet);
+ bCopyToFmt = TRUE;
+ rReq.SetReturnValue(SfxBoolItem(nSlot, bMirror));
+ }
+ break;
+ // --> OD 2009-07-14 #i73249#
+ case FN_TITLE_DESCRIPTION_SHAPE:
+ {
+ bUpdateMgr = FALSE;
+ SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
+ if ( pSdrView &&
+ pSdrView->GetMarkedObjectCount() == 1 )
+ {
+ String aDescription(rSh.GetObjDescription());
+ String aTitle(rSh.GetObjTitle());
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ OSL_ENSURE(pFact, "Dialogdiet fail!");
+ AbstractSvxObjectTitleDescDialog* pDlg =
+ pFact->CreateSvxObjectTitleDescDialog( NULL,
+ aTitle,
+ aDescription );
+ OSL_ENSURE(pDlg, "Dialogdiet fail!");
+
+ if ( pDlg->Execute() == RET_OK )
+ {
+ pDlg->GetDescription(aDescription);
+ pDlg->GetTitle(aTitle);
+
+ rSh.SetObjDescription(aDescription);
+ rSh.SetObjTitle(aTitle);
+ }
+
+ delete pDlg;
+ }
+ }
+ break;
+ // <--
+ default:
+ ASSERT( !this, "falscher Dispatcher" );
+ return;
+ }
+ // Vorlagen-AutoUpdate
+ SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
+ if ( bUpdateMgr )
+ {
+ if(bCopyToFmt && pFmt && pFmt->IsAutoUpdateFmt())
+ {
+ rSh.AutoUpdateFrame(pFmt, aMgr.GetAttrSet());
+ }
+ else
+ aMgr.UpdateFlyFrm();
+ }
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwFrameShell::GetState(SfxItemSet& rSet)
+{
+ SwWrtShell &rSh = GetShell();
+ BOOL bHtmlMode = 0 != ::GetHtmlMode(rSh.GetView().GetDocShell());
+ if (rSh.IsFrmSelected())
+ {
+ SfxItemSet aSet( rSh.GetAttrPool(),
+ RES_LR_SPACE, RES_UL_SPACE,
+ RES_PROTECT, RES_HORI_ORIENT,
+ RES_OPAQUE, RES_OPAQUE,
+ RES_PRINT, RES_OPAQUE,
+ 0 );
+ rSh.GetFlyFrmAttr( aSet );
+
+ BOOL bProtect = rSh.IsSelObjProtected(FLYPROTECT_POS);
+ BOOL bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+
+ bProtect |= bParentCntProt;
+
+ const USHORT eFrmType = rSh.GetFrmType(0,TRUE);
+ SwFlyFrmAttrMgr aMgr( FALSE, &rSh, FRMMGR_TYPE_NONE );
+
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+ while ( nWhich )
+ {
+ switch ( nWhich )
+ {
+ case RES_FRM_SIZE:
+ {
+ SwFmtFrmSize aSz(aMgr.GetFrmSize());
+ rSet.Put(aSz);
+ }
+ break;
+ case RES_VERT_ORIENT:
+ case RES_HORI_ORIENT:
+ case SID_ATTR_ULSPACE:
+ case SID_ATTR_LRSPACE:
+ case RES_LR_SPACE:
+ case RES_UL_SPACE:
+ case RES_PROTECT:
+ case RES_OPAQUE:
+ case RES_PRINT:
+ case RES_SURROUND:
+ {
+ rSet.Put(aSet.Get(GetPool().GetWhich(nWhich), TRUE ));
+ }
+ break;
+ case SID_OBJECT_ALIGN_LEFT :
+ case SID_OBJECT_ALIGN_CENTER :
+ case SID_OBJECT_ALIGN_RIGHT :
+ case FN_FRAME_ALIGN_HORZ_CENTER:
+ case FN_FRAME_ALIGN_HORZ_RIGHT:
+ case FN_FRAME_ALIGN_HORZ_LEFT:
+ if ( (eFrmType & FRMTYPE_FLY_INCNT) ||
+ bProtect ||
+ ((nWhich == FN_FRAME_ALIGN_HORZ_CENTER || nWhich == SID_OBJECT_ALIGN_CENTER)&& bHtmlMode) )
+ rSet.DisableItem( nWhich );
+ break;
+ case FN_FRAME_ALIGN_VERT_ROW_TOP:
+ case FN_FRAME_ALIGN_VERT_ROW_CENTER:
+ case FN_FRAME_ALIGN_VERT_ROW_BOTTOM:
+ case FN_FRAME_ALIGN_VERT_CHAR_TOP:
+ case FN_FRAME_ALIGN_VERT_CHAR_CENTER:
+ case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM:
+ if ( !(eFrmType & FRMTYPE_FLY_INCNT) || bProtect
+ || (bHtmlMode && FN_FRAME_ALIGN_VERT_CHAR_BOTTOM == nWhich) )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case SID_OBJECT_ALIGN_UP :
+ case SID_OBJECT_ALIGN_MIDDLE :
+ case SID_OBJECT_ALIGN_DOWN :
+
+ case FN_FRAME_ALIGN_VERT_TOP:
+ case FN_FRAME_ALIGN_VERT_CENTER:
+ case FN_FRAME_ALIGN_VERT_BOTTOM:
+ if ( bProtect || (bHtmlMode && eFrmType & FRMTYPE_FLY_ATCNT) )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ USHORT nId = 0;
+ if (eFrmType & FRMTYPE_FLY_INCNT)
+ {
+ switch (nWhich)
+ {
+ case SID_OBJECT_ALIGN_UP :
+ case FN_FRAME_ALIGN_VERT_TOP:
+ nId = STR_TOP_BASE; break;
+ case SID_OBJECT_ALIGN_MIDDLE :
+ case FN_FRAME_ALIGN_VERT_CENTER:
+ nId = STR_CENTER_BASE; break;
+ case SID_OBJECT_ALIGN_DOWN :
+ case FN_FRAME_ALIGN_VERT_BOTTOM:
+ if(!bHtmlMode)
+ nId = STR_BOTTOM_BASE;
+ else
+ rSet.DisableItem( nWhich );
+ break;
+ }
+ }
+ else
+ {
+ if (nWhich != FN_FRAME_ALIGN_VERT_TOP &&
+ nWhich != SID_OBJECT_ALIGN_UP )
+ {
+ if (aMgr.GetAnchor() == FLY_AT_FLY)
+ {
+ const SwFrmFmt* pFmt = rSh.IsFlyInFly();
+ if (pFmt)
+ {
+ const SwFmtFrmSize& rFrmSz = pFmt->GetFrmSize();
+ if (rFrmSz.GetHeightSizeType() != ATT_FIX_SIZE)
+ {
+ rSet.DisableItem( nWhich );
+ break;
+ }
+ }
+ }
+ }
+ switch (nWhich)
+ {
+ case SID_OBJECT_ALIGN_UP :
+ case FN_FRAME_ALIGN_VERT_TOP:
+ nId = STR_TOP; break;
+ case SID_OBJECT_ALIGN_MIDDLE:
+ case FN_FRAME_ALIGN_VERT_CENTER:
+ nId = STR_CENTER_VERT; break;
+ case SID_OBJECT_ALIGN_DOWN:
+ case FN_FRAME_ALIGN_VERT_BOTTOM:
+ nId = STR_BOTTOM; break;
+ }
+ }
+ if ( nId )
+ rSet.Put( SfxStringItem( nWhich, SW_RES(nId) ));
+ }
+ break;
+ case SID_HYPERLINK_GETLINK:
+ {
+ String sURL;
+ SvxHyperlinkItem aHLinkItem;
+ const SfxPoolItem* pItem;
+
+ SfxItemSet aURLSet(GetPool(), RES_URL, RES_URL);
+ rSh.GetFlyFrmAttr( aURLSet );
+
+ if(SFX_ITEM_SET == aURLSet.GetItemState(RES_URL, TRUE, &pItem))
+ {
+ const SwFmtURL* pFmtURL = (const SwFmtURL*)pItem;
+ aHLinkItem.SetURL(pFmtURL->GetURL());
+ aHLinkItem.SetTargetFrame(pFmtURL->GetTargetFrameName());
+ aHLinkItem.SetName(rSh.GetFlyName());
+ }
+
+ aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
+ (bHtmlMode ? HLINK_HTMLMODE : 0)));
+
+ rSet.Put(aHLinkItem);
+ }
+ break;
+
+ case FN_FRAME_CHAIN:
+ {
+ const int nSel = rSh.GetSelectionType();
+ if (nSel & nsSelectionType::SEL_GRF || nSel & nsSelectionType::SEL_OLE)
+ rSet.DisableItem( FN_FRAME_CHAIN );
+ else
+ {
+ const SwFrmFmt *pFmt = rSh.GetFlyFrmFmt();
+ if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
+ !pFmt || pFmt->GetChain().GetNext() )
+ {
+ rSet.DisableItem( FN_FRAME_CHAIN );
+ }
+ else
+ {
+ BOOL bChainMode = rSh.GetView().GetEditWin().IsChainMode();
+ rSet.Put( SfxBoolItem( FN_FRAME_CHAIN, bChainMode ) );
+ }
+ }
+ }
+ break;
+ case FN_FRAME_UNCHAIN:
+ {
+ const int nSel = rSh.GetSelectionType();
+ if (nSel & nsSelectionType::SEL_GRF || nSel & nsSelectionType::SEL_OLE)
+ rSet.DisableItem( FN_FRAME_UNCHAIN );
+ else
+ {
+ const SwFrmFmt *pFmt = rSh.GetFlyFrmFmt();
+ if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
+ !pFmt || !pFmt->GetChain().GetNext() )
+ {
+ rSet.DisableItem( FN_FRAME_UNCHAIN );
+ }
+ }
+ }
+ break;
+ case SID_FRAME_TO_TOP:
+ case SID_FRAME_TO_BOTTOM:
+ case FN_FRAME_UP:
+ case FN_FRAME_DOWN:
+ if ( bParentCntProt )
+ rSet.DisableItem( nWhich );
+ break;
+ case FN_FORMAT_FRAME_DLG:
+ {
+ const int nSel = rSh.GetSelectionType();
+ if ( bParentCntProt || nSel & nsSelectionType::SEL_GRF)
+ rSet.DisableItem( nWhich );
+ }
+ break;
+ // --> OD 2009-07-07 #i73249#
+ case FN_TITLE_DESCRIPTION_SHAPE:
+ {
+ SwWrtShell &rWrtSh = GetShell();
+ SdrView* pSdrView = rWrtSh.GetDrawViewWithValidMarkList();
+ if ( !pSdrView ||
+ pSdrView->GetMarkedObjectCount() != 1 )
+ {
+ rSet.DisableItem( nWhich );
+ }
+
+ }
+ break;
+ // <--
+ default:
+ /* do nothing */;
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Ctor fuer FrameShell
+ --------------------------------------------------------------------*/
+
+
+SwFrameShell::SwFrameShell(SwView &_rView) :
+ SwBaseShell( _rView )
+{
+ SetName(String::CreateFromAscii("Frame"));
+ SetHelpId(SW_FRAMESHELL);
+
+ /* #96392# Use this to announce it is the frame shell who creates the
+ selection. */
+ SwTransferable::CreateSelection( _rView.GetWrtShell(), (ViewShell *) this );
+}
+
+SwFrameShell::~SwFrameShell()
+{
+ /* #96392# Only clear the selection if it was this frame shell who created
+ it. */
+ SwTransferable::ClearSelection( GetShell(), (ViewShell *) this );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+void SwFrameShell::ExecFrameStyle(SfxRequest& rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ BOOL bDefault = FALSE;
+ if (!rSh.IsFrmSelected())
+ return;
+
+ // Erst Default-BoxItem aus Pool holen. Wenn ungleich normalem Boxitem,
+ // dann ist es bereits geaendert worden (neues ist kein Default).
+ const SvxBoxItem* pPoolBoxItem = (const SvxBoxItem*)::GetDfltAttr(RES_BOX);
+
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ SfxItemSet aFrameSet(rSh.GetAttrPool(), RES_BOX, RES_BOX);
+
+ rSh.GetFlyFrmAttr( aFrameSet );
+ const SvxBoxItem& rBoxItem = (const SvxBoxItem&)aFrameSet.Get(RES_BOX);
+
+ if (pPoolBoxItem == &rBoxItem)
+ bDefault = TRUE;
+
+ SvxBoxItem aBoxItem(rBoxItem);
+
+ SvxBorderLine aBorderLine;
+ const SfxPoolItem *pItem = 0;
+
+ if(pArgs) //irgendein Controller kann auch mal nichts liefern #48169#
+ {
+ switch (rReq.GetSlot())
+ {
+ case SID_ATTR_BORDER:
+ {
+ if (pArgs->GetItemState(RES_BOX, TRUE, &pItem) == SFX_ITEM_SET)
+ {
+ SvxBoxItem aNewBox(*((SvxBoxItem *)pItem));
+ const SvxBorderLine* pBorderLine;
+
+ if ((pBorderLine = aBoxItem.GetTop()) != NULL)
+ lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
+ if ((pBorderLine = aBoxItem.GetBottom()) != NULL)
+ lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
+ if ((pBorderLine = aBoxItem.GetLeft()) != NULL)
+ lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
+ if ((pBorderLine = aBoxItem.GetRight()) != NULL)
+ lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
+
+ if(aBorderLine.GetOutWidth() == 0)
+ {
+ aBorderLine.SetInWidth(0);
+ aBorderLine.SetOutWidth(DEF_LINE_WIDTH_0);
+ aBorderLine.SetDistance(0);
+ }
+ //Distance nur setzen, wenn der Request vom Controller kommt
+
+ if(!StarBASIC::IsRunning())
+ {
+ aNewBox.SetDistance( rBoxItem.GetDistance() );
+ }
+
+ aBoxItem = aNewBox;
+ SvxBorderLine aDestBorderLine;
+
+ if ((pBorderLine = aBoxItem.GetTop()) != NULL)
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
+ if ((pBorderLine = aBoxItem.GetBottom()) != NULL)
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
+ if ((pBorderLine = aBoxItem.GetLeft()) != NULL)
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
+ if ((pBorderLine = aBoxItem.GetRight()) != NULL)
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
+ }
+ }
+ break;
+
+ case SID_FRAME_LINESTYLE:
+ {
+ if (pArgs->GetItemState(SID_FRAME_LINESTYLE, FALSE, &pItem) == SFX_ITEM_SET)
+ {
+ const SvxLineItem* pLineItem =
+ (const SvxLineItem*)pItem;
+
+ if ( pLineItem->GetLine() )
+ {
+ aBorderLine = *(pLineItem->GetLine());
+
+ if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() &&
+ !aBoxItem.GetLeft() && !aBoxItem.GetRight())
+ {
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
+ }
+ else
+ {
+ if( aBoxItem.GetTop() )
+ {
+ aBorderLine.SetColor( aBoxItem.GetTop()->GetColor() );
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
+ }
+ if( aBoxItem.GetBottom() )
+ {
+ aBorderLine.SetColor( aBoxItem.GetBottom()->GetColor());
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
+ }
+ if( aBoxItem.GetLeft() )
+ {
+ aBorderLine.SetColor( aBoxItem.GetLeft()->GetColor());
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
+ }
+ if( aBoxItem.GetRight() )
+ {
+ aBorderLine.SetColor(aBoxItem.GetRight()->GetColor());
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
+ }
+ }
+ }
+ else
+ {
+ aBoxItem.SetLine(0, BOX_LINE_TOP);
+ aBoxItem.SetLine(0, BOX_LINE_BOTTOM);
+ aBoxItem.SetLine(0, BOX_LINE_LEFT);
+ aBoxItem.SetLine(0, BOX_LINE_RIGHT);
+ }
+ }
+ }
+ break;
+
+ case SID_FRAME_LINECOLOR:
+ {
+ if (pArgs->GetItemState(SID_FRAME_LINECOLOR, FALSE, &pItem) == SFX_ITEM_SET)
+ {
+ const Color& rNewColor = ((const SvxColorItem*)pItem)->GetValue();
+
+ if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() &&
+ !aBoxItem.GetLeft() && !aBoxItem.GetRight())
+ {
+ aBorderLine.SetColor( rNewColor );
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
+ aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
+ }
+ else
+ {
+ if ( aBoxItem.GetTop() )
+ ((SvxBorderLine*)aBoxItem.GetTop())->SetColor( rNewColor );
+ if ( aBoxItem.GetBottom() )
+ ((SvxBorderLine*)aBoxItem.GetBottom())->SetColor( rNewColor );
+ if ( aBoxItem.GetLeft() )
+ ((SvxBorderLine*)aBoxItem.GetLeft())->SetColor( rNewColor );
+ if ( aBoxItem.GetRight() )
+ ((SvxBorderLine*)aBoxItem.GetRight())->SetColor( rNewColor );
+ }
+ }
+ }
+ break;
+ }
+ }
+ if (bDefault && (aBoxItem.GetTop() || aBoxItem.GetBottom() ||
+ aBoxItem.GetLeft() || aBoxItem.GetRight()))
+ {
+ aBoxItem.SetDistance(MIN_BORDER_DIST);
+ }
+ aFrameSet.Put( aBoxItem );
+ // Vorlagen-AutoUpdate
+ SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
+ if(pFmt && pFmt->IsAutoUpdateFmt())
+ {
+ rSh.AutoUpdateFrame(pFmt, aFrameSet);
+ }
+ else
+ rSh.SetFlyFrmAttr( aFrameSet );
+
+}
+
+
+
+void lcl_FrmGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine)
+{
+ if(pBorderLine->GetInWidth() > rBorderLine.GetInWidth())
+ rBorderLine.SetInWidth(pBorderLine->GetInWidth());
+
+ if(pBorderLine->GetOutWidth() > rBorderLine.GetOutWidth())
+ rBorderLine.SetOutWidth(pBorderLine->GetOutWidth());
+
+ if(pBorderLine->GetDistance() > rBorderLine.GetDistance())
+ rBorderLine.SetDistance(pBorderLine->GetDistance());
+
+ rBorderLine.SetColor(pBorderLine->GetColor());
+}
+
+
+
+void SwFrameShell::GetLineStyleState(SfxItemSet &rSet)
+{
+ SwWrtShell &rSh = GetShell();
+ BOOL bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+
+ if (bParentCntProt)
+ {
+ if (rSh.IsFrmSelected())
+ rSet.DisableItem( SID_FRAME_LINECOLOR );
+
+ rSet.DisableItem( SID_ATTR_BORDER );
+ rSet.DisableItem( SID_FRAME_LINESTYLE );
+ }
+ else
+ {
+ if (rSh.IsFrmSelected())
+ {
+ SfxItemSet aFrameSet( rSh.GetAttrPool(), RES_BOX, RES_BOX );
+
+ rSh.GetFlyFrmAttr(aFrameSet);
+
+ const SvxBorderLine* pLine = ((const SvxBoxItem&)aFrameSet.Get(RES_BOX)).GetTop();
+ rSet.Put(SvxColorItem(pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR));
+ }
+ }
+}
+
+void SwFrameShell::StateInsert(SfxItemSet &rSet)
+{
+ const int nSel = GetShell().GetSelectionType();
+
+ if ((nSel & nsSelectionType::SEL_GRF) || (nSel & nsSelectionType::SEL_OLE))
+ rSet.DisableItem(FN_INSERT_FRAME);
+}
+
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
new file mode 100644
index 000000000000..037758450081
--- /dev/null
+++ b/sw/source/ui/shells/grfsh.cxx
@@ -0,0 +1,707 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <hintids.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/stritem.hxx>
+#include <svl/whiter.hxx>
+#include <svl/urihelper.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <sfx2/objface.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/protitem.hxx>
+#include <sfx2/request.hxx>
+#include <svl/srchitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <svx/sdgluitm.hxx>
+#include <svx/sdgcoitm.hxx>
+#include <svx/sdggaitm.hxx>
+#include <svx/sdgtritm.hxx>
+#include <svx/sdginitm.hxx>
+#include <svx/sdgmoitm.hxx>
+#include <editeng/brshitem.hxx>
+#include <svx/grfflt.hxx>
+#include <svx/tbxcolor.hxx>
+#include <fmturl.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <viewopt.hxx>
+#include <swmodule.hxx>
+#include <frmatr.hxx>
+#include <swundo.hxx>
+#include <uitool.hxx>
+#include <docsh.hxx>
+#include <grfsh.hxx>
+#include <frmmgr.hxx>
+#include <frmdlg.hxx>
+#include <frmfmt.hxx>
+#include <grfatr.hxx>
+#include <usrpref.hxx>
+#include <edtwin.hxx>
+#include <swwait.hxx>
+#include <shells.hrc>
+#include <popup.hrc>
+
+#define SwGrfShell
+#include <sfx2/msg.hxx>
+#include "swslots.hxx"
+
+#include "swabstdlg.hxx"
+
+#define TOOLBOX_NAME ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "colorbar" ) )
+
+SFX_IMPL_INTERFACE(SwGrfShell, SwBaseShell, SW_RES(STR_SHELLNAME_GRAPHIC))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_GRF_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_GRAFIK_TOOLBOX));
+}
+
+void SwGrfShell::Execute(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+
+ USHORT nSlot = rReq.GetSlot();
+ switch(nSlot)
+ {
+ case SID_TWAIN_TRANSFER:
+ {
+ GetView().ExecuteScan( rReq );
+ break;
+ }
+ case FN_SAVE_GRAPHIC:
+ {
+ const Graphic *pGraphic;
+ if(0 != (pGraphic = rSh.GetGraphic()))
+ {
+ String sGrfNm, sFilterNm;
+ rSh.GetGrfNms( &sGrfNm, &sFilterNm );
+ ExportGraphic( *pGraphic, sGrfNm );
+ }
+ }
+ break;
+ case SID_INSERT_GRAPHIC:
+ case FN_FORMAT_GRAFIC_DLG:
+ {
+ SwFlyFrmAttrMgr aMgr( FALSE, &rSh, rSh.IsFrmSelected() ?
+ FRMMGR_TYPE_NONE : FRMMGR_TYPE_GRF);
+ const SwViewOption* pVOpt = rSh.GetViewOptions();
+ SwViewOption aUsrPref( *pVOpt );
+
+ SfxItemSet aSet(GetPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_GRFATR_MIRRORGRF, RES_GRFATR_CROPGRF,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ SID_ATTR_GRAF_KEEP_ZOOM, SID_ATTR_GRAF_KEEP_ZOOM,
+ SID_ATTR_GRAF_FRMSIZE, SID_ATTR_GRAF_FRMSIZE,
+ SID_ATTR_GRAF_FRMSIZE_PERCENT, SID_ATTR_GRAF_FRMSIZE_PERCENT,
+ SID_ATTR_GRAF_GRAPHIC, SID_ATTR_GRAF_GRAPHIC,
+ FN_PARAM_GRF_CONNECT, FN_PARAM_GRF_CONNECT,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ FN_GET_PRINT_AREA, FN_GET_PRINT_AREA,
+ FN_SET_FRM_NAME, FN_KEEP_ASPECT_RATIO,
+ FN_PARAM_GRF_DIALOG, FN_PARAM_GRF_DIALOG,
+ SID_DOCFRAME, SID_DOCFRAME,
+ SID_HTML_MODE, SID_HTML_MODE,
+ FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME,
+ 0);
+
+ USHORT nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
+ aSet.Put(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
+ FieldUnit eMetric = ::GetDfltMetric((0 != (nHtmlMode&HTMLMODE_ON)));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)) );
+
+ const SwRect* pRect = &rSh.GetAnyCurRect(RECT_PAGE);
+ SwFmtFrmSize aFrmSize( ATT_VAR_SIZE, pRect->Width(), pRect->Height());
+ aFrmSize.SetWhich( GetPool().GetWhich( SID_ATTR_PAGE_SIZE ) );
+ aSet.Put( aFrmSize );
+
+ aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
+ if ( nSlot == FN_FORMAT_GRAFIC_DLG )
+ {
+ // --> OD 2009-07-13 #i73249#
+// aSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, rSh.GetAlternateText()));
+ aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
+ // <--
+ }
+
+ pRect = &rSh.GetAnyCurRect(RECT_PAGE_PRT);
+ aFrmSize.SetWidth( pRect->Width() );
+ aFrmSize.SetHeight( pRect->Height() );
+ aFrmSize.SetWhich( GetPool().GetWhich(FN_GET_PRINT_AREA) );
+ aSet.Put( aFrmSize );
+
+ aSet.Put( aMgr.GetAttrSet() );
+ aSet.SetParent( aMgr.GetAttrSet().GetParent() );
+
+ // Bei %-Werten Groesse initialisieren
+ SwFmtFrmSize aSizeCopy = (const SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE);
+ if (aSizeCopy.GetWidthPercent() && aSizeCopy.GetWidthPercent() != 0xff)
+ aSizeCopy.SetWidth(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width());
+ if (aSizeCopy.GetHeightPercent() && aSizeCopy.GetHeightPercent() != 0xff)
+ aSizeCopy.SetHeight(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height());
+
+ // and now set the size for "external" tabpages
+ {
+ SvxSizeItem aSzItm( SID_ATTR_GRAF_FRMSIZE, aSizeCopy.GetSize() );
+ aSet.Put( aSzItm );
+
+ Size aSz( aSizeCopy.GetWidthPercent(), aSizeCopy.GetHeightPercent() );
+ if( 0xff == aSz.Width() ) aSz.Width() = 0;
+ if( 0xff == aSz.Height() ) aSz.Height() = 0;
+
+ aSzItm.SetSize( aSz );
+ aSzItm.SetWhich( SID_ATTR_GRAF_FRMSIZE_PERCENT );
+ aSet.Put( aSzItm );
+ }
+
+ String sGrfNm, sFilterNm;
+ rSh.GetGrfNms( &sGrfNm, &sFilterNm );
+ if( sGrfNm.Len() )
+ {
+ aSet.Put( SvxBrushItem( INetURLObject::decode( sGrfNm,
+ INET_HEX_ESCAPE,
+ INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 ),
+ sFilterNm, GPOS_LT,
+ SID_ATTR_GRAF_GRAPHIC ));
+ }
+ else
+ {
+ // --> OD 2005-02-09 #119353# - robust
+ const GraphicObject* pGrfObj = rSh.GetGraphicObj();
+ if ( pGrfObj )
+ {
+ aSet.Put( SvxBrushItem( *pGrfObj, GPOS_LT,
+ SID_ATTR_GRAF_GRAPHIC ) );
+ }
+ // <--
+ }
+ aSet.Put( SfxBoolItem( FN_PARAM_GRF_CONNECT, sGrfNm.Len() > 0 ) );
+
+ // get Mirror and Crop
+ {
+ SfxItemSet aTmpSet( rSh.GetAttrPool(),
+ RES_GRFATR_MIRRORGRF, RES_GRFATR_CROPGRF );
+
+ rSh.GetCurAttr( aTmpSet );
+ aSet.Put( aTmpSet );
+ }
+
+ aSet.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, aUsrPref.IsKeepRatio()));
+ aSet.Put(SfxBoolItem( SID_ATTR_GRAF_KEEP_ZOOM, aUsrPref.IsGrfKeepZoom()));
+
+ aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame()));
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ SfxAbstractTabDialog* pDlg = pFact->CreateFrmTabDialog( DLG_FRM_GRF,
+ GetView().GetViewFrame(),
+ GetView().GetWindow(),
+ aSet, FALSE, DLG_FRM_GRF);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if( pDlg->Execute() )
+ {
+ rSh.StartAllAction();
+ rSh.StartUndo(UNDO_START);
+ const SfxPoolItem* pItem;
+ SfxItemSet* pSet = (SfxItemSet*)pDlg->GetOutputItemSet();
+ rReq.Done(*pSet);
+ // change the 2 frmsize SizeItems to the correct SwFrmSizeItem
+ if( SFX_ITEM_SET == pSet->GetItemState(
+ SID_ATTR_GRAF_FRMSIZE, FALSE, &pItem ))
+ {
+ SwFmtFrmSize aSize;
+ const Size& rSz = ((SvxSizeItem*)pItem)->GetSize();
+ aSize.SetWidth( rSz.Width() );
+ aSize.SetHeight( rSz.Height() );
+
+ if( SFX_ITEM_SET == pSet->GetItemState(
+ SID_ATTR_GRAF_FRMSIZE_PERCENT, FALSE, &pItem ))
+ {
+ const Size& rRelativeSize = ((SvxSizeItem*)pItem)->GetSize();
+ aSize.SetWidthPercent( static_cast< BYTE >( rRelativeSize.Width() ) );
+ aSize.SetHeightPercent( static_cast< BYTE >( rRelativeSize.Height() ) );
+ }
+ pSet->Put( aSize );
+ }
+
+ // Vorlagen-AutoUpdate
+ SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
+ if(pFmt && pFmt->IsAutoUpdateFmt())
+ {
+ pFmt->SetFmtAttr(*pSet);
+ SfxItemSet aShellSet(GetPool(), RES_FRM_SIZE, RES_FRM_SIZE,
+ RES_SURROUND, RES_SURROUND,
+ RES_ANCHOR, RES_ANCHOR,
+ RES_VERT_ORIENT,RES_HORI_ORIENT,
+ 0);
+ aShellSet.Put(*pSet);
+ aMgr.SetAttrSet(aShellSet);
+ }
+ else
+ {
+ aMgr.SetAttrSet(*pSet);
+ }
+ aMgr.UpdateFlyFrm();
+
+ BOOL bApplyUsrPref = FALSE;
+ if (SFX_ITEM_SET == pSet->GetItemState(
+ FN_KEEP_ASPECT_RATIO, TRUE, &pItem ))
+ {
+ aUsrPref.SetKeepRatio(
+ ((const SfxBoolItem*)pItem)->GetValue() );
+ bApplyUsrPref = TRUE;
+ }
+ if( SFX_ITEM_SET == pSet->GetItemState(
+ SID_ATTR_GRAF_KEEP_ZOOM, TRUE, &pItem ))
+ {
+ aUsrPref.SetGrfKeepZoom(
+ ((const SfxBoolItem*)pItem)->GetValue() );
+ bApplyUsrPref = TRUE;
+ }
+
+ if( bApplyUsrPref )
+ SW_MOD()->ApplyUsrPref(aUsrPref, &GetView());
+
+ // and now set all the graphic attributes and other stuff
+ if( SFX_ITEM_SET == pSet->GetItemState(
+ SID_ATTR_GRAF_GRAPHIC, TRUE, &pItem ))
+ {
+ if( ((SvxBrushItem*)pItem)->GetGraphicLink() )
+ sGrfNm = *((SvxBrushItem*)pItem)->GetGraphicLink();
+ else
+ sGrfNm.Erase();
+
+ if( ((SvxBrushItem*)pItem)->GetGraphicFilter() )
+ sFilterNm = *((SvxBrushItem*)pItem)->GetGraphicFilter();
+ else
+ sFilterNm.Erase();
+
+ if( sGrfNm.Len() )
+ {
+ SwDocShell* pDocSh = GetView().GetDocShell();
+ SwWait aWait( *pDocSh, TRUE );
+ SfxMedium* pMedium = pDocSh->GetMedium();
+ INetURLObject aAbs;
+ if( pMedium )
+ aAbs = pMedium->GetURLObject();
+ rSh.ReRead( URIHelper::SmartRel2Abs(
+ aAbs, sGrfNm,
+ URIHelper::GetMaybeFileHdl() ),
+ sFilterNm, 0 );
+ }
+ }
+ if ( SFX_ITEM_SET == pSet->GetItemState(
+ FN_SET_FRM_ALT_NAME, TRUE, &pItem ))
+ {
+ // --> OD 2009-07-13 #i73249#
+// rSh.SetAlternateText(
+// ((const SfxStringItem*)pItem)->GetValue() );
+ rSh.SetObjTitle( ((const SfxStringItem*)pItem)->GetValue() );
+ // <--
+ }
+
+ SfxItemSet aGrfSet( rSh.GetAttrPool(), RES_GRFATR_BEGIN,
+ RES_GRFATR_END-1 );
+ aGrfSet.Put( *pSet );
+ if( aGrfSet.Count() )
+ rSh.SetAttr( aGrfSet );
+
+ rSh.EndUndo(UNDO_END);
+ rSh.EndAllAction();
+ }
+ delete pDlg;
+ }
+ break;
+
+ case FN_GRAPHIC_MIRROR_ON_EVEN_PAGES:
+ {
+ SfxItemSet aSet(rSh.GetAttrPool(), RES_GRFATR_MIRRORGRF, RES_GRFATR_MIRRORGRF);
+ rSh.GetCurAttr( aSet );
+ SwMirrorGrf aGrf((const SwMirrorGrf &)aSet.Get(RES_GRFATR_MIRRORGRF));
+ aGrf.SetGrfToggle(!aGrf.IsGrfToggle());
+ rSh.SetAttr(aGrf);
+ }
+ break;
+
+ default:
+ ASSERT(!this, falscher Dispatcher);
+ return;
+ }
+}
+
+
+void SwGrfShell::ExecAttr( SfxRequest &rReq )
+{
+ USHORT nGrfType;
+ if( CNT_GRF == GetShell().GetCntType() &&
+ ( GRAPHIC_BITMAP == ( nGrfType = GetShell().GetGraphicType()) ||
+ GRAPHIC_GDIMETAFILE == nGrfType ))
+ {
+ SfxItemSet aGrfSet( GetShell().GetAttrPool(), RES_GRFATR_BEGIN,
+ RES_GRFATR_END -1 );
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+ USHORT nSlot = rReq.GetSlot();
+ if( !pArgs || SFX_ITEM_SET != pArgs->GetItemState( nSlot, FALSE, &pItem ))
+ pItem = 0;
+
+ switch( nSlot )
+ {
+ case FN_FLIP_VERT_GRAFIC:
+ case FN_FLIP_HORZ_GRAFIC:
+ {
+ GetShell().GetCurAttr( aGrfSet );
+ SwMirrorGrf aMirror( (SwMirrorGrf&)aGrfSet.Get(
+ RES_GRFATR_MIRRORGRF ) );
+ USHORT nMirror = aMirror.GetValue();
+ if( FN_FLIP_VERT_GRAFIC == nSlot )
+ switch( nMirror )
+ {
+ case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_VERT;
+ break;
+ case RES_MIRROR_GRAPH_HOR: nMirror = RES_MIRROR_GRAPH_BOTH;
+ break;
+ case RES_MIRROR_GRAPH_VERT: nMirror = RES_MIRROR_GRAPH_DONT;
+ break;
+ case RES_MIRROR_GRAPH_BOTH: nMirror = RES_MIRROR_GRAPH_HOR;
+ break;
+ }
+ else
+ switch( nMirror )
+ {
+ case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_HOR;
+ break;
+ case RES_MIRROR_GRAPH_VERT: nMirror = RES_MIRROR_GRAPH_BOTH;
+ break;
+ case RES_MIRROR_GRAPH_HOR: nMirror = RES_MIRROR_GRAPH_DONT;
+ break;
+ case RES_MIRROR_GRAPH_BOTH: nMirror = RES_MIRROR_GRAPH_VERT;
+ break;
+ }
+ aMirror.SetValue( nMirror );
+ aGrfSet.ClearItem();
+ aGrfSet.Put( aMirror );
+ }
+ break;
+
+ case SID_ATTR_GRAF_LUMINANCE:
+ if( pItem )
+ aGrfSet.Put( SwLuminanceGrf(
+ ((SfxInt16Item*)pItem)->GetValue() ));
+ break;
+ case SID_ATTR_GRAF_CONTRAST:
+ if( pItem )
+ aGrfSet.Put( SwContrastGrf(
+ ((SfxInt16Item*)pItem)->GetValue() ));
+ break;
+ case SID_ATTR_GRAF_RED:
+ if( pItem )
+ aGrfSet.Put( SwChannelRGrf(
+ ((SfxInt16Item*)pItem)->GetValue() ));
+ break;
+ case SID_ATTR_GRAF_GREEN:
+ if( pItem )
+ aGrfSet.Put( SwChannelGGrf(
+ ((SfxInt16Item*)pItem)->GetValue() ));
+ break;
+ case SID_ATTR_GRAF_BLUE:
+ if( pItem )
+ aGrfSet.Put( SwChannelBGrf(
+ ((SfxInt16Item*)pItem)->GetValue() ));
+ break;
+ case SID_ATTR_GRAF_GAMMA:
+ if( pItem )
+ {
+ double fVal = ((SfxUInt32Item*)pItem)->GetValue();
+ aGrfSet.Put( SwGammaGrf(fVal/100. ));
+ }
+ break;
+ case SID_ATTR_GRAF_TRANSPARENCE:
+ if( pItem )
+ aGrfSet.Put( SwTransparencyGrf(
+ static_cast< sal_Int8 >( ( (SfxUInt16Item*)pItem )->GetValue() ) ) );
+ break;
+ case SID_ATTR_GRAF_INVERT:
+ if( pItem )
+ aGrfSet.Put( SwInvertGrf(
+ ((SfxBoolItem*)pItem)->GetValue() ));
+ break;
+
+ case SID_ATTR_GRAF_MODE:
+ if( pItem )
+ aGrfSet.Put( SwDrawModeGrf(
+ ((SfxUInt16Item*)pItem)->GetValue() ));
+ break;
+
+ case SID_COLOR_SETTINGS:
+ {
+ svx::ToolboxAccess aToolboxAccess( TOOLBOX_NAME );
+ aToolboxAccess.toggleToolbox();
+ break;
+ }
+ case SID_GRFFILTER:
+ case SID_GRFFILTER_INVERT:
+ case SID_GRFFILTER_SMOOTH:
+ case SID_GRFFILTER_SHARPEN:
+ case SID_GRFFILTER_REMOVENOISE:
+ case SID_GRFFILTER_SOBEL:
+ case SID_GRFFILTER_MOSAIC:
+ case SID_GRFFILTER_EMBOSS:
+ case SID_GRFFILTER_POSTER:
+ case SID_GRFFILTER_POPART:
+ case SID_GRFFILTER_SEPIA:
+ case SID_GRFFILTER_SOLARIZE:
+ if( GRAPHIC_BITMAP == nGrfType )
+ {
+ // --> OD 2005-02-09 #119353# - robust
+ const GraphicObject* pFilterObj( GetShell().GetGraphicObj() );
+ if ( pFilterObj )
+ {
+ GraphicObject aFilterObj( *pFilterObj );
+ if( SVX_GRAPHICFILTER_ERRCODE_NONE ==
+ SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ))
+ GetShell().ReRead( aEmptyStr, aEmptyStr,
+ &aFilterObj.GetGraphic() );
+ }
+ // <--
+ }
+ break;
+
+ default:
+ ASSERT(!this, falscher Dispatcher);
+ }
+ if( aGrfSet.Count() )
+ GetShell().SetAttr( aGrfSet );
+ }
+ GetView().GetViewFrame()->GetBindings().Invalidate(rReq.GetSlot());
+}
+
+void SwGrfShell::GetAttrState(SfxItemSet &rSet)
+{
+ SwWrtShell &rSh = GetShell();
+ SfxItemSet aCoreSet( GetPool(), aNoTxtNodeSetRange );
+ rSh.GetCurAttr( aCoreSet );
+ BOOL bParentCntProt = 0 != rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT );
+ BOOL bIsGrfCntnt = CNT_GRF == GetShell().GetCntType();
+ // --> OD 2006-11-03 #i59688#
+// BOOL bSwappedOut = rSh.IsGrfSwapOut( TRUE );
+// BOOL bBitmapType = !bSwappedOut && GRAPHIC_BITMAP == rSh.GetGraphicType();
+ // <--
+
+ SetGetStateSet( &rSet );
+
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+ while( nWhich )
+ {
+ BOOL bDisable = bParentCntProt;
+ switch( nWhich )
+ {
+ case SID_INSERT_GRAPHIC:
+ case FN_FORMAT_GRAFIC_DLG:
+ case SID_TWAIN_TRANSFER:
+ if( bParentCntProt || !bIsGrfCntnt )
+ bDisable = TRUE;
+ break;
+ case FN_SAVE_GRAPHIC:
+ if( rSh.GetGraphicType() == GRAPHIC_NONE )
+ bDisable = sal_True;
+ break;
+ case SID_COLOR_SETTINGS:
+ {
+ if ( bParentCntProt || !bIsGrfCntnt )
+ bDisable = TRUE;
+ else
+ {
+ svx::ToolboxAccess aToolboxAccess( TOOLBOX_NAME );
+ rSet.Put( SfxBoolItem( nWhich, aToolboxAccess.isToolboxVisible() ) );
+ }
+ break;
+ }
+
+ case FN_FLIP_VERT_GRAFIC:
+ if( !bParentCntProt )
+ {
+ MirrorGraph nState = static_cast< MirrorGraph >(((const SwMirrorGrf &) aCoreSet.Get(
+ RES_GRFATR_MIRRORGRF )).GetValue());
+
+ rSet.Put(SfxBoolItem( nWhich, nState == RES_MIRROR_GRAPH_VERT ||
+ nState == RES_MIRROR_GRAPH_BOTH));
+ }
+ break;
+
+ case FN_FLIP_HORZ_GRAFIC:
+ if( !bParentCntProt )
+ {
+ MirrorGraph nState = static_cast< MirrorGraph >(((const SwMirrorGrf &) aCoreSet.Get(
+ RES_GRFATR_MIRRORGRF )).GetValue());
+
+ rSet.Put(SfxBoolItem( nWhich, nState == RES_MIRROR_GRAPH_HOR ||
+ nState == RES_MIRROR_GRAPH_BOTH));
+ }
+ break;
+
+
+ case SID_ATTR_GRAF_LUMINANCE:
+ if( !bParentCntProt )
+ rSet.Put( SfxInt16Item( nWhich, ((SwLuminanceGrf&)
+ aCoreSet.Get(RES_GRFATR_LUMINANCE)).GetValue() ));
+ break;
+ case SID_ATTR_GRAF_CONTRAST:
+ if( !bParentCntProt )
+ rSet.Put( SfxInt16Item( nWhich, ((SwContrastGrf&)
+ aCoreSet.Get(RES_GRFATR_CONTRAST)).GetValue() ));
+ break;
+ case SID_ATTR_GRAF_RED:
+ if( !bParentCntProt )
+ rSet.Put( SfxInt16Item( nWhich, ((SwChannelRGrf&)
+ aCoreSet.Get(RES_GRFATR_CHANNELR)).GetValue() ));
+ break;
+ case SID_ATTR_GRAF_GREEN:
+ if( !bParentCntProt )
+ rSet.Put( SfxInt16Item( nWhich, ((SwChannelGGrf&)
+ aCoreSet.Get(RES_GRFATR_CHANNELG)).GetValue() ));
+ break;
+ case SID_ATTR_GRAF_BLUE:
+ if( !bParentCntProt )
+ rSet.Put( SfxInt16Item( nWhich, ((SwChannelBGrf&)
+ aCoreSet.Get(RES_GRFATR_CHANNELB)).GetValue() ));
+ break;
+
+ case SID_ATTR_GRAF_GAMMA:
+ if( !bParentCntProt )
+ rSet.Put( SfxUInt32Item( nWhich, static_cast< UINT32 >(
+ ( (SwGammaGrf&)aCoreSet.Get( RES_GRFATR_GAMMA ) ).GetValue() * 100 ) ) );
+ break;
+ case SID_ATTR_GRAF_TRANSPARENCE:
+ if( !bParentCntProt )
+ {
+ // --> OD 2005-02-09 #119353# - robust
+ const GraphicObject* pGrfObj = rSh.GetGraphicObj();
+ if ( pGrfObj )
+ {
+ if( pGrfObj->IsAnimated() ||
+ GRAPHIC_GDIMETAFILE == pGrfObj->GetType() )
+ bDisable = TRUE;
+ else
+ rSet.Put( SfxUInt16Item( nWhich, ((SwTransparencyGrf&)
+ aCoreSet.Get(RES_GRFATR_TRANSPARENCY)).GetValue() ));
+ }
+ }
+ break;
+ case SID_ATTR_GRAF_INVERT:
+ if( !bParentCntProt )
+ rSet.Put( SfxBoolItem( nWhich, ((SwInvertGrf&)
+ aCoreSet.Get(RES_GRFATR_INVERT)).GetValue() ));
+ break;
+
+ case SID_ATTR_GRAF_MODE:
+ if( !bParentCntProt )
+ rSet.Put( SfxUInt16Item( nWhich, ((SwDrawModeGrf&)
+ aCoreSet.Get(RES_GRFATR_DRAWMODE)).GetValue() ));
+ break;
+
+ case SID_GRFFILTER:
+ case SID_GRFFILTER_INVERT:
+ case SID_GRFFILTER_SMOOTH:
+ case SID_GRFFILTER_SHARPEN:
+ case SID_GRFFILTER_REMOVENOISE:
+ case SID_GRFFILTER_SOBEL:
+ case SID_GRFFILTER_MOSAIC:
+ case SID_GRFFILTER_EMBOSS:
+ case SID_GRFFILTER_POSTER:
+ case SID_GRFFILTER_POPART:
+ case SID_GRFFILTER_SEPIA:
+ case SID_GRFFILTER_SOLARIZE:
+ {
+ if( bParentCntProt || !bIsGrfCntnt )
+ bDisable = TRUE;
+ // --> OD 2006-11-03 #i59688#
+ // load graphic only if type is unknown
+// else if( bSwappedOut )
+// {
+// rSet.DisableItem( nWhich );
+// if( AddGrfUpdateSlot( nWhich ))
+// rSh.GetGraphic(FALSE); // start the loading
+// }
+// else
+// bDisable = !bBitmapType;
+ else
+ {
+ const USHORT eGraphicType( rSh.GetGraphicType() );
+ if ( ( eGraphicType == GRAPHIC_NONE ||
+ eGraphicType == GRAPHIC_DEFAULT ) &&
+ rSh.IsGrfSwapOut( TRUE ) )
+ {
+ rSet.DisableItem( nWhich );
+ if( AddGrfUpdateSlot( nWhich ))
+ rSh.GetGraphic(FALSE); // start the loading
+ }
+ else
+ {
+ bDisable = eGraphicType != GRAPHIC_BITMAP;
+ }
+ }
+ // <--
+ }
+ break;
+
+ default:
+ bDisable = FALSE;
+ }
+
+ if( bDisable )
+ rSet.DisableItem( nWhich );
+ nWhich = aIter.NextWhich();
+ }
+ SetGetStateSet( 0 );
+}
+
+
+SwGrfShell::SwGrfShell(SwView &_rView) :
+ SwBaseShell(_rView)
+
+{
+ SetName(String::CreateFromAscii("Graphic"));
+ SetHelpId(SW_GRFSHELL);
+}
+
+
+
+
diff --git a/sw/source/ui/shells/grfshex.cxx b/sw/source/ui/shells/grfshex.cxx
new file mode 100644
index 000000000000..8669c4e201c1
--- /dev/null
+++ b/sw/source/ui/shells/grfshex.cxx
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <docary.hxx>
+#include <grfsh.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <docary.hxx>
+#include <textsh.hxx>
+#include <viewopt.hxx>
+#include <swundo.hxx>
+#include <shells.hrc>
+#include <caption.hxx>
+#define _SVSTDARR_STRINGSSORTDTOR
+#include <svl/svstdarr.hxx>
+#include <svtools/filter.hxx>
+#include <svx/htmlmode.hxx>
+#include <docsh.hxx>
+#include <frmfmt.hxx>
+#include <frmmgr.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/svdomedia.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdpagv.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
+#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
+#include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
+#include <poolfmt.hrc>
+
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/stritem.hxx>
+#include <avmedia/mediawindow.hxx>
+#include <vcl/svapp.hxx>
+
+// -> #111827#
+#include <SwRewriter.hxx>
+#include <comcore.hrc>
+// <- #111827#
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::sfx2;
+using ::rtl::OUString;
+
+bool SwTextShell::InsertMediaDlg( SfxRequest& rReq )
+{
+ ::rtl::OUString aURL;
+ const SfxItemSet* pReqArgs = rReq.GetArgs();
+ Window* pWindow = &GetView().GetViewFrame()->GetWindow();
+ bool bAPI = false, bRet = false;
+
+ if( pReqArgs )
+ {
+ const SfxStringItem* pStringItem = PTR_CAST( SfxStringItem, &pReqArgs->Get( rReq.GetSlot() ) );
+
+ if( pStringItem )
+ {
+ aURL = pStringItem->GetValue();
+ bAPI = aURL.getLength();
+ }
+ }
+
+ if( bAPI || ::avmedia::MediaWindow::executeMediaURLDialog( pWindow, aURL ) )
+ {
+ Size aPrefSize;
+
+ if( pWindow )
+ pWindow->EnterWait();
+
+ if( !::avmedia::MediaWindow::isMediaURL( aURL, true, &aPrefSize ) )
+ {
+ if( pWindow )
+ pWindow->LeaveWait();
+
+ if( !bAPI )
+ ::avmedia::MediaWindow::executeFormatErrorBox( pWindow );
+ }
+ else
+ {
+ SwWrtShell& rSh = GetShell();
+
+ if( !rSh.HasDrawView() )
+ rSh.MakeDrawView();
+
+ Size aDocSz( rSh.GetDocSize() );
+ const SwRect& rVisArea = rSh.VisArea();
+ Point aPos( rVisArea.Center() );
+ Size aSize;
+
+ if( rVisArea.Width() > aDocSz.Width())
+ aPos.X() = aDocSz.Width() / 2 + rVisArea.Left();
+
+ if(rVisArea.Height() > aDocSz.Height())
+ aPos.Y() = aDocSz.Height() / 2 + rVisArea.Top();
+
+ if( aPrefSize.Width() && aPrefSize.Height() )
+ {
+ if( pWindow )
+ aSize = pWindow->PixelToLogic( aPrefSize, MAP_TWIP );
+ else
+ aSize = Application::GetDefaultDevice()->PixelToLogic( aPrefSize, MAP_TWIP );
+ }
+ else
+ aSize = Size( 2835, 2835 );
+
+ SdrMediaObj* pObj = new SdrMediaObj( Rectangle( aPos, aSize ) );
+
+ pObj->setURL( aURL );
+ rSh.EnterStdMode();
+ rSh.SwFEShell::InsertDrawObj( *pObj, aPos );
+ bRet = true;
+
+ if( pWindow )
+ pWindow->LeaveWait();
+ }
+ }
+
+ return bRet;
+}
diff --git a/sw/source/ui/shells/langhelper.cxx b/sw/source/ui/shells/langhelper.cxx
new file mode 100755
index 000000000000..fbdcd264c5d5
--- /dev/null
+++ b/sw/source/ui/shells/langhelper.cxx
@@ -0,0 +1,610 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <string.h>
+
+#include <vcl/window.hxx>
+
+#include <wrtsh.hxx>
+
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/editdata.hxx>
+#include <editeng/outliner.hxx>
+#include <editeng/editview.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <editeng/langitem.hxx>
+
+#include <svl/languageoptions.hxx>
+#include <svtools/langtab.hxx>
+#include <svl/slstitm.hxx>
+#include <svl/svstdarr.hxx>
+#include <svl/stritem.hxx>
+
+#include <ndtxt.hxx>
+#include <pam.hxx>
+#include <view.hxx>
+#include <viewopt.hxx>
+
+#include "swabstdlg.hxx"
+
+#include <vcl/msgbox.hxx>
+
+#include <langhelper.hxx>
+
+using namespace ::com::sun::star;
+
+namespace SwLangHelper
+{
+
+ USHORT GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet )
+ {
+ ESelection aSelection = pOLV->GetSelection();
+ EditView& rEditView=pOLV->GetEditView();
+ EditEngine* pEditEngine=rEditView.GetEditEngine();
+
+ // the value of used script types
+ const USHORT nScriptType =pOLV->GetSelectedScriptType();
+ String aScriptTypesInUse( String::CreateFromInt32( nScriptType ) );//pEditEngine->GetScriptType(aSelection)
+
+ SvtLanguageTable aLangTable;
+
+ // get keyboard language
+ String aKeyboardLang;
+ LanguageType nLang = LANGUAGE_DONTKNOW;
+
+ Window* pWin = rEditView.GetWindow();
+ if(pWin)
+ nLang = pWin->GetInputLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aKeyboardLang = aLangTable.GetString( nLang );
+
+ // get the language that is in use
+ const String aMultipleLanguages = String::CreateFromAscii("*");
+ String aCurrentLang = aMultipleLanguages;
+ SfxItemSet aSet(pOLV->GetAttribs());
+ nLang = SwLangHelper::GetCurrentLanguage( aSet,nScriptType );
+ if (nLang != LANGUAGE_DONTKNOW)
+ aCurrentLang = aLangTable.GetString( nLang );
+
+ // build sequence for status value
+ uno::Sequence< ::rtl::OUString > aSeq( 4 );
+ aSeq[0] = aCurrentLang;
+ aSeq[1] = aScriptTypesInUse;
+ aSeq[2] = aKeyboardLang;
+ aSeq[3] = SwLangHelper::GetTextForLanguageGuessing( pEditEngine, aSelection );
+
+ // set sequence as status value
+ SfxStringListItem aItem( SID_LANGUAGE_STATUS );
+ aItem.SetStringList( aSeq );
+ rSet.Put( aItem, SID_LANGUAGE_STATUS );
+ return 0;
+ }
+
+ bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView &rView, SwWrtShell &rSh )
+ {
+ bool bRestoreSelection = false;
+ SfxItemSet aEditAttr(pOLV->GetAttribs());
+ ESelection aSelection = pOLV->GetSelection();
+ EditView & rEditView = pOLV->GetEditView();
+ EditEngine * pEditEngine = rEditView.GetEditEngine();
+
+ // get the language
+ String aNewLangTxt;
+
+ SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, SID_LANGUAGE_STATUS , sal_False );
+ if (pItem)
+ aNewLangTxt = pItem->GetValue();
+
+ //!! Remember the view frame right now...
+ //!! (call to GetView().GetViewFrame() will break if the
+ //!! SwTextShell got destroyed meanwhile.)
+ SfxViewFrame *pViewFrame = rView.GetViewFrame();
+
+ if (aNewLangTxt.EqualsAscii( "*" ))
+ {
+ // open the dialog "Tools/Options/Language Settings - Language"
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ if (pFact)
+ {
+ VclAbstractDialog* pDlg = pFact->CreateVclDialog( rView.GetWindow(), SID_LANGUAGE_OPTIONS );
+ pDlg->Execute();
+ delete pDlg;
+ }
+ }
+ else
+ {
+ // setting the new language...
+ if (aNewLangTxt.Len() > 0)
+ {
+ const String aSelectionLangPrefix( String::CreateFromAscii("Current_") );
+ const String aParagraphLangPrefix( String::CreateFromAscii("Paragraph_") );
+ const String aDocumentLangPrefix( String::CreateFromAscii("Default_") );
+ const String aStrNone( String::CreateFromAscii("LANGUAGE_NONE") );
+ const String aStrResetLangs( String::CreateFromAscii("RESET_LANGUAGES") );
+
+ xub_StrLen nPos = 0;
+ bool bForSelection = true;
+ bool bForParagraph = false;
+ if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aSelectionLangPrefix, 0 )))
+ {
+ // ... for the current selection
+ aNewLangTxt = aNewLangTxt.Erase( nPos, aSelectionLangPrefix.Len() );
+ bForSelection = true;
+ }
+ else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aParagraphLangPrefix , 0 )))
+ {
+ // ... for the current paragraph language
+ aNewLangTxt = aNewLangTxt.Erase( nPos, aParagraphLangPrefix.Len() );
+ bForSelection = true;
+ bForParagraph = true;
+ }
+ else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aDocumentLangPrefix , 0 )))
+ {
+ // ... as default document language
+ aNewLangTxt = aNewLangTxt.Erase( nPos, aDocumentLangPrefix.Len() );
+ bForSelection = false;
+ }
+
+ if (bForParagraph)
+ {
+ bRestoreSelection = true;
+ SwLangHelper::SelectPara( rEditView, aSelection );
+ aSelection = pOLV->GetSelection();
+ }
+ if (!bForSelection) // document language to be changed...
+ {
+ rSh.StartAction();
+ rSh.LockView( TRUE );
+ rSh.Push();
+
+ // prepare to apply new language to all text in document
+ rSh.SelAll();
+ rSh.ExtendedSelectAll();
+ }
+
+ if (aNewLangTxt == aStrNone)
+ SwLangHelper::SetLanguage_None( rSh, pOLV, aSelection, bForSelection, aEditAttr );
+ else if (aNewLangTxt == aStrResetLangs)
+ SwLangHelper::ResetLanguages( rSh, pOLV, aSelection, bForSelection );
+ else
+ SwLangHelper::SetLanguage( rSh, pOLV, aSelection, aNewLangTxt, bForSelection, aEditAttr );
+
+ // ugly hack, as it seems that EditView/EditEngine does not update their spellchecking marks
+ // when setting a new language attribute
+ if (bForSelection)
+ {
+ const SwViewOption* pVOpt = rView.GetWrtShellPtr()->GetViewOptions();
+ ULONG nCntrl = pEditEngine->GetControlWord();
+ // turn off
+ if (!pVOpt->IsOnlineSpell())
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ pEditEngine->SetControlWord(nCntrl);
+
+ //turn back on
+ if (pVOpt->IsOnlineSpell())
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ pEditEngine->SetControlWord(nCntrl);
+
+ pEditEngine->CompleteOnlineSpelling();
+ rEditView.Invalidate();
+ }
+
+ if (!bForSelection)
+ {
+ // need to release view and restore selection...
+ rSh.Pop( FALSE );
+ rSh.LockView( FALSE );
+ rSh.EndAction();
+ }
+ }
+ }
+
+ // invalidate slot to get the new language displayed
+ pViewFrame->GetBindings().Invalidate( rReq.GetSlot() );
+
+ rReq.Done();
+ return bRestoreSelection;
+ }
+
+
+ void SetLanguage( SwWrtShell &rWrtSh, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet )
+ {
+ SetLanguage( rWrtSh, 0 , ESelection(), rLangText, bIsForSelection, rCoreSet );
+ }
+
+ void SetLanguage( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, const String &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet )
+ {
+ const LanguageType nLang = SvtLanguageTable().GetType( rLangText );
+ if (nLang != LANGUAGE_DONTKNOW)
+ {
+ USHORT nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLang );
+
+ EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : NULL;
+ DBG_ASSERT( !pOLV || pEditEngine, "OutlinerView without EditEngine???" );
+
+ //get ScriptType
+ USHORT nLangWhichId = 0;
+ bool bIsSingleScriptType = true;
+ switch (nScriptType)
+ {
+ case SCRIPTTYPE_LATIN : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE : RES_CHRATR_LANGUAGE; break;
+ case SCRIPTTYPE_ASIAN : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE_CJK : RES_CHRATR_CJK_LANGUAGE; break;
+ case SCRIPTTYPE_COMPLEX : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE_CTL : RES_CHRATR_CTL_LANGUAGE; break;
+ default:
+ bIsSingleScriptType = false;
+ DBG_ERROR( "unexpected case" );
+ }
+ if (bIsSingleScriptType)
+ {
+ // change language for selection or paragraph
+ // (for paragraph is handled by previosuly having set the selection to the
+ // whole paragraph)
+ if (bIsForSelection)
+ {
+ // apply language to current selection
+ if (pEditEngine)
+ {
+ rCoreSet.Put( SvxLanguageItem( nLang, nLangWhichId ));
+ pEditEngine->QuickSetAttribs( rCoreSet, aSelection);
+ }
+ else
+ {
+ rWrtSh.GetCurAttr( rCoreSet );
+ rCoreSet.Put( SvxLanguageItem( nLang, nLangWhichId ));
+ rWrtSh.SetAttr( rCoreSet );
+ }
+ }
+ else // change language for all text
+ {
+ // set document default language
+ switch (nLangWhichId)
+ {
+ case EE_CHAR_LANGUAGE : nLangWhichId = RES_CHRATR_LANGUAGE; break;
+ case EE_CHAR_LANGUAGE_CJK : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
+ case EE_CHAR_LANGUAGE_CTL : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
+ }
+ rWrtSh.SetDefault( SvxLanguageItem( nLang, nLangWhichId ) );
+
+ // #i102191: hard set respective language attribute in text document
+ // (for all text in the document - which should be selected by now...)
+ rWrtSh.SetAttr( SvxLanguageItem( nLang, nLangWhichId ) );
+ }
+ }
+ }
+ }
+
+ void SetLanguage_None( SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet )
+ {
+ SetLanguage_None( rWrtSh,0,ESelection(),bIsForSelection,rCoreSet );
+ }
+
+ void SetLanguage_None( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet )
+ {
+ // EditEngine IDs
+ const USHORT aLangWhichId_EE[3] =
+ {
+ EE_CHAR_LANGUAGE,
+ EE_CHAR_LANGUAGE_CJK,
+ EE_CHAR_LANGUAGE_CTL
+ };
+
+ // Writewr IDs
+ const USHORT aLangWhichId_Writer[3] =
+ {
+ RES_CHRATR_LANGUAGE,
+ RES_CHRATR_CJK_LANGUAGE,
+ RES_CHRATR_CTL_LANGUAGE
+ };
+
+ if (bIsForSelection)
+ {
+ // change language for selection or paragraph
+ // (for paragraph is handled by previosuly having set the selection to the
+ // whole paragraph)
+
+ EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : NULL;
+ DBG_ASSERT( !pOLV || pEditEngine, "OutlinerView without EditEngine???" );
+ if (pEditEngine)
+ {
+ for (sal_uInt16 i = 0; i < 3; ++i)
+ rCoreSet.Put( SvxLanguageItem( LANGUAGE_NONE, aLangWhichId_EE[i] ));
+ pEditEngine->QuickSetAttribs( rCoreSet, aSelection);
+ }
+ else
+ {
+ rWrtSh.GetCurAttr( rCoreSet );
+ for (sal_uInt16 i = 0; i < 3; ++i)
+ rCoreSet.Put( SvxLanguageItem( LANGUAGE_NONE, aLangWhichId_Writer[i] ));
+ rWrtSh.SetAttr( rCoreSet );
+ }
+ }
+ else // change language for all text
+ {
+ SvUShortsSort aAttribs;
+ for (sal_uInt16 i = 0; i < 3; ++i)
+ {
+ rWrtSh.SetDefault( SvxLanguageItem( LANGUAGE_NONE, aLangWhichId_Writer[i] ) );
+ aAttribs.Insert( aLangWhichId_Writer[i] );
+ }
+
+ // set all language attributes to default
+ // (for all text in the document - which should be selected by now...)
+ rWrtSh.ResetAttr( &aAttribs );
+ }
+ }
+
+ void ResetLanguages( SwWrtShell &rWrtSh, bool bIsForSelection )
+ {
+ ResetLanguages( rWrtSh, 0 , ESelection(), bIsForSelection );
+ }
+
+ void ResetLanguages( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection )
+ {
+ (void) bIsForSelection;
+ (void) aSelection;
+
+ // reset language for current selection.
+ // The selection should already have been expanded to the whole paragraph or
+ // to all text in the document if those are the ranges where to reset
+ // the language attributes
+
+ if (pOLV)
+ {
+ EditView &rEditView = pOLV->GetEditView();
+ rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE );
+ rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CJK );
+ rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CTL );
+ }
+ else
+ {
+ SvUShortsSort aAttribs;
+ aAttribs.Insert( RES_CHRATR_LANGUAGE );
+ aAttribs.Insert( RES_CHRATR_CJK_LANGUAGE );
+ aAttribs.Insert( RES_CHRATR_CTL_LANGUAGE );
+ rWrtSh.ResetAttr( &aAttribs );
+ }
+ }
+
+
+ /// @returns : the language for the selected text that is set for the
+ /// specified attribute (script type).
+ /// If there are more than one languages used LANGUAGE_DONTKNOW will be returned.
+ /// @param nLangWhichId : one of
+ /// RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
+ LanguageType GetLanguage( SwWrtShell &rSh, USHORT nLangWhichId )
+ {
+ SfxItemSet aSet( rSh.GetAttrPool(), nLangWhichId, nLangWhichId );
+ rSh.GetCurAttr( aSet );
+
+ return GetLanguage(aSet,nLangWhichId);
+ }
+
+ LanguageType GetLanguage( SfxItemSet aSet, USHORT nLangWhichId )
+ {
+
+ LanguageType nLang = LANGUAGE_SYSTEM;
+
+ const SfxPoolItem *pItem = 0;
+ SfxItemState nState = aSet.GetItemState( nLangWhichId, TRUE, &pItem );
+ if (nState > SFX_ITEM_DEFAULT && pItem)
+ {
+ // the item is set and can be used
+ nLang = (dynamic_cast< const SvxLanguageItem* >(pItem))->GetLanguage();
+ }
+ else if (nState == SFX_ITEM_DEFAULT)
+ {
+ // since the attribute is not set: retrieve the default value
+ nLang = (dynamic_cast< const SvxLanguageItem& >(aSet.GetPool()->GetDefaultItem( nLangWhichId ))).GetLanguage();
+ }
+ else if (nState == SFX_ITEM_DONTCARE)
+ {
+ // there is more than one language...
+ nLang = LANGUAGE_DONTKNOW;
+ }
+ DBG_ASSERT( nLang != LANGUAGE_SYSTEM, "failed to get the language?" );
+
+ return nLang;
+ }
+
+ /// @returns: the language in use for the selected text.
+ /// 'In use' means the language(s) matching the script type(s) of the
+ /// selected text. Or in other words, the language a spell checker would use.
+ /// If there is more than one language LANGUAGE_DONTKNOW will be returned.
+ LanguageType GetCurrentLanguage( SwWrtShell &rSh )
+ {
+ // get all script types used in current selection
+ const USHORT nScriptType = rSh.GetScriptType();
+
+ //set language attribute to use according to the script type
+ USHORT nLangWhichId = 0;
+ bool bIsSingleScriptType = true;
+ switch (nScriptType)
+ {
+ case SCRIPTTYPE_LATIN : nLangWhichId = RES_CHRATR_LANGUAGE; break;
+ case SCRIPTTYPE_ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
+ case SCRIPTTYPE_COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
+ default: bIsSingleScriptType = false; break;
+ }
+
+ // get language according to the script type(s) in use
+ LanguageType nCurrentLang = LANGUAGE_SYSTEM;
+ if (bIsSingleScriptType)
+ nCurrentLang = GetLanguage( rSh, nLangWhichId );
+ else
+ {
+ // check if all script types are set to LANGUAGE_NONE and return
+ // that if this is the case. Otherwise, having multiple script types
+ // in use always means there are several languages in use...
+ const USHORT aScriptTypes[3] =
+ {
+ RES_CHRATR_LANGUAGE,
+ RES_CHRATR_CJK_LANGUAGE,
+ RES_CHRATR_CTL_LANGUAGE
+ };
+ nCurrentLang = LANGUAGE_NONE;
+ for (sal_uInt16 i = 0; i < 3; ++i)
+ {
+ LanguageType nTmpLang = GetLanguage( rSh, aScriptTypes[i] );
+ if (nTmpLang != LANGUAGE_NONE)
+ {
+ nCurrentLang = LANGUAGE_DONTKNOW;
+ break;
+ }
+ }
+ }
+ DBG_ASSERT( nCurrentLang != LANGUAGE_SYSTEM, "failed to get the language?" );
+
+ return nCurrentLang;
+ }
+
+ /// @returns: the language in use for the selected text.
+ /// 'In use' means the language(s) matching the script type(s) of the
+ /// selected text. Or in other words, the language a spell checker would use.
+ /// If there is more than one language LANGUAGE_DONTKNOW will be returned.
+ LanguageType GetCurrentLanguage( SfxItemSet aSet, USHORT nScriptType )
+ {
+ //set language attribute to use according to the script type
+ USHORT nLangWhichId = 0;
+ bool bIsSingleScriptType = true;
+ switch (nScriptType)
+ {
+ case SCRIPTTYPE_LATIN : nLangWhichId = EE_CHAR_LANGUAGE; break;
+ case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
+ case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
+ default: bIsSingleScriptType = false;
+ }
+
+ // get language according to the script type(s) in use
+ LanguageType nCurrentLang = LANGUAGE_SYSTEM;
+ if (bIsSingleScriptType)
+ nCurrentLang = GetLanguage( aSet, nLangWhichId );
+ else
+ {
+ // check if all script types are set to LANGUAGE_NONE and return
+ // that if this is the case. Otherwise, having multiple script types
+ // in use always means there are several languages in use...
+ const USHORT aScriptTypes[3] =
+ {
+ EE_CHAR_LANGUAGE,
+ EE_CHAR_LANGUAGE_CJK,
+ EE_CHAR_LANGUAGE_CTL
+ };
+ nCurrentLang = LANGUAGE_NONE;
+ for (sal_uInt16 i = 0; i < 3; ++i)
+ {
+ LanguageType nTmpLang = GetLanguage( aSet, aScriptTypes[i] );
+ if (nTmpLang != LANGUAGE_NONE)
+ {
+ nCurrentLang = LANGUAGE_DONTKNOW;
+ break;
+ }
+ }
+ }
+ DBG_ASSERT( nCurrentLang != LANGUAGE_SYSTEM, "failed to get the language?" );
+
+ return nCurrentLang;
+ }
+
+ String GetTextForLanguageGuessing( SwWrtShell &rSh )
+ {
+ // string for guessing language
+ String aText;
+ SwPaM *pCrsr = rSh.GetCrsr();
+ SwTxtNode *pNode = pCrsr->GetNode()->GetTxtNode();
+ if (pNode)
+ {
+ aText = pNode->GetTxt();
+ if (aText.Len() > 0)
+ {
+ xub_StrLen nStt = 0;
+ xub_StrLen nEnd = pCrsr->GetPoint()->nContent.GetIndex();
+ // at most 100 chars to the left...
+ nStt = nEnd > 100 ? nEnd - 100 : 0;
+ // ... and 100 to the right of the cursor position
+ nEnd = aText.Len() - nEnd > 100 ? nEnd + 100 : aText.Len();
+ aText = aText.Copy( nStt, nEnd - nStt );
+ }
+ }
+ return aText;
+ }
+
+ String GetTextForLanguageGuessing( EditEngine* rEditEngine, ESelection aDocSelection )
+ {
+ // string for guessing language
+ String aText;
+
+ aText = rEditEngine->GetText(aDocSelection);
+ if (aText.Len() > 0)
+ {
+ xub_StrLen nStt = 0;
+ xub_StrLen nEnd = aDocSelection.nEndPos;
+ // at most 100 chars to the left...
+ nStt = nEnd > 100 ? nEnd - 100 : 0;
+ // ... and 100 to the right of the cursor position
+ nEnd = aText.Len() - nEnd > 100 ? nEnd + 100 : aText.Len();
+ aText = aText.Copy( nStt, nEnd - nStt );
+ }
+
+ return aText;
+ }
+
+
+ void SelectPara( EditView &rEditView, const ESelection &rCurSel )
+ {
+ ESelection aParaSel( rCurSel.nStartPara, 0, rCurSel.nStartPara, USHRT_MAX );
+ rEditView.SetSelection( aParaSel );
+ }
+
+ void SelectCurrentPara( SwWrtShell &rWrtSh )
+ {
+ // select current para
+ if (!rWrtSh.IsSttPara())
+ rWrtSh.MovePara( fnParaCurr, fnParaStart );
+ if (!rWrtSh.HasMark())
+ rWrtSh.SetMark();
+ rWrtSh.SwapPam();
+ if (!rWrtSh.IsEndPara())
+ rWrtSh.MovePara( fnParaCurr, fnParaEnd );
+ #if OSL_DEBUG_LEVEL > 1
+ String aSelTxt;
+ rWrtSh.GetSelectedText( aSelTxt );
+ (void) aSelTxt;
+ #endif
+ }
+}
+
diff --git a/sw/source/ui/shells/listsh.cxx b/sw/source/ui/shells/listsh.cxx
new file mode 100644
index 000000000000..24a8c12d992b
--- /dev/null
+++ b/sw/source/ui/shells/listsh.cxx
@@ -0,0 +1,295 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include "cmdid.h"
+#include "hintids.hxx"
+#include <editeng/sizeitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/bindings.hxx>
+#include <svl/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <tools/urlobj.hxx>
+#include <svl/whiter.hxx>
+#include <svl/intitem.hxx>
+#include <tools/shl.hxx>
+#include <svl/srchitem.hxx>
+
+// --> FME 2005-01-04 #i35572#
+#include <numrule.hxx>
+// <--
+#include <fmtornt.hxx>
+#include "wrtsh.hxx"
+#include "swmodule.hxx"
+#include "frmatr.hxx"
+#include "helpid.h"
+#include "globals.hrc"
+#include "shells.hrc"
+#include "uinums.hxx"
+#include "listsh.hxx"
+#include "poolfmt.hxx"
+#include "view.hxx"
+#include "edtwin.hxx"
+
+#define SwListShell
+#include <sfx2/msg.hxx>
+#include "swslots.hxx"
+
+#include <IDocumentOutlineNodes.hxx>
+
+SFX_IMPL_INTERFACE(SwListShell, SwBaseShell, SW_RES(STR_SHELLNAME_LIST))
+{
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_NUM_TOOLBOX));
+}
+
+
+TYPEINIT1(SwListShell,SwBaseShell)
+
+// --> FME 2005-01-04 #i35572# Functionality of Numbering/Bullet toolbar
+// for outline numbered paragraphs should match the functions for outlines
+// available in the navigator. Therefore the code in the following
+// function is quite similar the the code in SwContentTree::ExecCommand.
+void lcl_OutlineUpDownWithSubPoints( SwWrtShell& rSh, bool bMove, bool bUp )
+{
+ const sal_uInt16 nActPos = rSh.GetOutlinePos();
+ if ( nActPos < USHRT_MAX && rSh.IsOutlineMovable( nActPos ) )
+ {
+ rSh.Push();
+ rSh.MakeOutlineSel( nActPos, nActPos, TRUE );
+
+ if ( bMove )
+ {
+ const IDocumentOutlineNodes* pIDoc( rSh.getIDocumentOutlineNodesAccess() );
+ const sal_uInt16 nActLevel = static_cast<sal_uInt16>(pIDoc->getOutlineLevel( nActPos ));
+ sal_uInt16 nActEndPos = nActPos + 1;
+ sal_Int16 nDir = 0;
+
+ if ( !bUp )
+ {
+ // Move down with subpoints:
+ while ( nActEndPos < pIDoc->getOutlineNodesCount() &&
+ pIDoc->getOutlineLevel( nActEndPos ) > nActLevel )
+ ++nActEndPos;
+
+ if ( nActEndPos < pIDoc->getOutlineNodesCount() )
+ {
+ // The current subpoint which should be moved
+ // starts at nActPos and ends at nActEndPos - 1
+ --nActEndPos;
+ sal_uInt16 nDest = nActEndPos + 2;
+ while ( nDest < pIDoc->getOutlineNodesCount() &&
+ pIDoc->getOutlineLevel( nDest ) > nActLevel )
+ ++nDest;
+
+ nDir = nDest - 1 - nActEndPos;
+ }
+ }
+ else
+ {
+ // Move up with subpoints:
+ if ( nActPos > 0 )
+ {
+ --nActEndPos;
+ sal_uInt16 nDest = nActPos - 1;
+ while ( nDest > 0 && pIDoc->getOutlineLevel( nDest ) > nActLevel )
+ --nDest;
+
+ nDir = nDest - nActPos;
+ }
+ }
+
+ if ( nDir )
+ {
+ rSh.MoveOutlinePara( nDir );
+ rSh.GotoOutline( nActPos + nDir );
+ }
+ }
+ else
+ {
+ // Up/down with subpoints:
+ rSh.OutlineUpDown( bUp ? -1 : 1 );
+ }
+
+ rSh.ClearMark();
+ rSh.Pop( sal_False );
+ }
+}
+// <--
+
+void SwListShell::Execute(SfxRequest &rReq)
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ USHORT nSlot = rReq.GetSlot();
+ SwWrtShell& rSh = GetShell();
+
+ // --> FME 2005-01-04 #i35572#
+ const SwNumRule* pCurRule = rSh.GetCurNumRule();
+ ASSERT( pCurRule, "SwListShell::Execute without NumRule" )
+ bool bOutline = pCurRule && pCurRule->IsOutlineRule();
+ // <--
+
+ switch (nSlot)
+ {
+ case FN_NUM_BULLET_DOWN:
+ case FN_NUM_BULLET_UP:
+ {
+ SfxViewFrame * pFrame = GetView().GetViewFrame();
+
+ rReq.Done();
+ rSh.NumUpDown( ( nSlot == FN_NUM_BULLET_DOWN )
+ ? TRUE
+ : FALSE );
+ pFrame->GetBindings().Invalidate( SID_TABLE_CELL ); // StatusZeile updaten!
+ }
+ break;
+
+ case FN_NUM_BULLET_NEXT:
+ rSh.GotoNextNum();
+ rReq.Done();
+ break;
+
+ case FN_NUM_BULLET_NONUM:
+ rSh.NoNum();
+ rReq.Done();
+ break;
+
+ case FN_NUM_BULLET_OFF:
+ {
+ rReq.Ignore();
+ SfxRequest aReq( GetView().GetViewFrame(), FN_NUM_BULLET_ON );
+ aReq.AppendItem( SfxBoolItem( FN_PARAM_1, FALSE ) );
+ aReq.Done();
+ rSh.DelNumRules();
+ break;
+ }
+
+ case FN_NUM_BULLET_OUTLINE_DOWN:
+ if ( bOutline )
+ lcl_OutlineUpDownWithSubPoints( rSh, false, false );
+ else
+ rSh.MoveNumParas(FALSE, FALSE);
+ rReq.Done();
+ break;
+
+ case FN_NUM_BULLET_OUTLINE_MOVEDOWN:
+ if ( bOutline )
+ lcl_OutlineUpDownWithSubPoints( rSh, true, false );
+ else
+ rSh.MoveNumParas(TRUE, FALSE);
+ rReq.Done();
+ break;
+
+ case FN_NUM_BULLET_OUTLINE_MOVEUP:
+ if ( bOutline )
+ lcl_OutlineUpDownWithSubPoints( rSh, true, true );
+ else
+ rSh.MoveNumParas(TRUE, TRUE);
+ rReq.Done();
+ break;
+
+ case FN_NUM_BULLET_OUTLINE_UP:
+ if ( bOutline )
+ lcl_OutlineUpDownWithSubPoints( rSh, false, true );
+ else
+ rSh.MoveNumParas(FALSE, TRUE);
+ rReq.Done();
+ break;
+
+ case FN_NUM_BULLET_PREV:
+ rSh.GotoPrevNum();
+ rReq.Done();
+ break;
+
+ case FN_NUM_OR_NONUM:
+ {
+ BOOL bApi = rReq.IsAPI();
+ BOOL bDelete = !rSh.IsNoNum(!bApi);
+ if(pArgs )
+ bDelete = ((SfxBoolItem &)pArgs->Get(rReq.GetSlot())).GetValue();
+ rSh.NumOrNoNum( bDelete, !bApi );
+ rReq.AppendItem( SfxBoolItem( nSlot, bDelete ) );
+ rReq.Done();
+ }
+ break;
+ default:
+ ASSERT(!this, falscher Dispatcher);
+ return;
+ }
+}
+
+
+void SwListShell::GetState(SfxItemSet &rSet)
+{
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+ SwWrtShell& rSh = GetShell();
+ BYTE nCurrentNumLevel = rSh.GetNumLevel();
+ while ( nWhich )
+ {
+ switch( nWhich )
+ {
+ case FN_NUM_OR_NONUM:
+ rSet.Put(SfxBoolItem(nWhich, GetShell().IsNoNum(FALSE)));
+ break;
+ case FN_NUM_BULLET_OUTLINE_UP:
+ case FN_NUM_BULLET_UP:
+ if(!nCurrentNumLevel)
+ rSet.DisableItem(nWhich);
+ break;
+ case FN_NUM_BULLET_OUTLINE_DOWN :
+ {
+ sal_uInt8 nUpper = 0;
+ sal_uInt8 nLower = 0;
+ rSh.GetCurrentOutlineLevels( nUpper, nLower );
+ if(nLower == (MAXLEVEL - 1))
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case FN_NUM_BULLET_DOWN:
+ if(nCurrentNumLevel == (MAXLEVEL - 1))
+ rSet.DisableItem(nWhich);
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+
+SwListShell::SwListShell(SwView &_rView) :
+ SwBaseShell(_rView)
+{
+ SetName(String::CreateFromAscii("List"));
+ SetHelpId(SW_LISTSHELL);
+}
+
+
diff --git a/sw/source/ui/shells/mediash.cxx b/sw/source/ui/shells/mediash.cxx
new file mode 100644
index 000000000000..36aa18f2d01c
--- /dev/null
+++ b/sw/source/ui/shells/mediash.cxx
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <hintids.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/stritem.hxx>
+#include <svl/whiter.hxx>
+#include <svl/urihelper.hxx>
+#include <sfx2/dispatch.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/protitem.hxx>
+#include <sfx2/request.hxx>
+#include <svl/srchitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <svx/sdgluitm.hxx>
+#include <svx/sdgcoitm.hxx>
+#include <svx/sdggaitm.hxx>
+#include <svx/sdgtritm.hxx>
+#include <svx/sdginitm.hxx>
+#include <svx/sdgmoitm.hxx>
+#include <editeng/brshitem.hxx>
+#include <svx/grfflt.hxx>
+#include <fmturl.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <viewopt.hxx>
+#include <swmodule.hxx>
+#include <frmatr.hxx>
+#include <swundo.hxx>
+#include <uitool.hxx>
+#include <docsh.hxx>
+#include <mediash.hxx>
+#include <frmmgr.hxx>
+#include <frmdlg.hxx>
+#include <frmfmt.hxx>
+#include <grfatr.hxx>
+#include <usrpref.hxx>
+#include <edtwin.hxx>
+#include <swwait.hxx>
+#ifndef _SHELLS_HRC
+#include <shells.hrc>
+#endif
+#ifndef _POPUP_HRC
+#include <popup.hrc>
+#endif
+
+#include <sfx2/objface.hxx>
+#include <svx/svdomedia.hxx>
+#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
+#include <avmedia/mediaitem.hxx>
+
+#define SwMediaShell
+#include <sfx2/msg.hxx>
+#include "swslots.hxx"
+#include "swabstdlg.hxx"
+
+SFX_IMPL_INTERFACE(SwMediaShell, SwBaseShell, SW_RES(STR_SHELLNAME_MEDIA))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_MEDIA_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_MEDIA_TOOLBOX));
+}
+
+// ------------------------------------------------------------------------------
+
+void SwMediaShell::ExecMedia(SfxRequest &rReq)
+{
+ SwWrtShell* pSh = &GetShell();
+ SdrView* pSdrView = pSh->GetDrawView();
+
+ if( pSdrView )
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ USHORT nSlotId = rReq.GetSlot();
+ BOOL bChanged = pSdrView->GetModel()->IsChanged();
+
+ pSdrView->GetModel()->SetChanged( FALSE );
+
+ switch( nSlotId )
+ {
+ case SID_DELETE:
+ {
+ if( pSh->IsObjSelected() )
+ {
+ pSh->SetModified();
+ pSh->DelSelectedObj();
+
+ if( pSh->IsSelFrmMode() )
+ pSh->LeaveSelFrmMode();
+
+ GetView().AttrChangedNotify( pSh );
+ }
+ }
+ break;
+
+ case( SID_AVMEDIA_TOOLBOX ):
+ {
+ if( pSh->IsObjSelected() )
+ {
+ const SfxPoolItem* pItem;
+
+ if( !pArgs || ( SFX_ITEM_SET != pArgs->GetItemState( SID_AVMEDIA_TOOLBOX, FALSE, &pItem ) ) )
+ pItem = NULL;
+
+ if( pItem )
+ {
+ SdrMarkList* pMarkList = new SdrMarkList( pSdrView->GetMarkedObjectList() );
+
+ if( 1 == pMarkList->GetMarkCount() )
+ {
+ SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj && pObj->ISA( SdrMediaObj ) )
+ {
+ static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
+ static_cast< const ::avmedia::MediaItem& >( *pItem ) );
+ }
+ }
+
+ delete pMarkList;
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ if( pSdrView->GetModel()->IsChanged() )
+ GetShell().SetModified();
+ else if( bChanged )
+ pSdrView->GetModel()->SetChanged(TRUE);
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+void SwMediaShell::GetMediaState(SfxItemSet &rSet)
+{
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+
+ while( nWhich )
+ {
+ if( SID_AVMEDIA_TOOLBOX == nWhich )
+ {
+ SwWrtShell& rSh = GetShell();
+ SdrView* pView = rSh.GetDrawView();
+ bool bDisable = true;
+
+ if( pView )
+ {
+ SdrMarkList* pMarkList = new SdrMarkList( pView->GetMarkedObjectList() );
+
+ if( 1 == pMarkList->GetMarkCount() )
+ {
+ SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
+
+ if( pObj && pObj->ISA( SdrMediaObj ) )
+ {
+ ::avmedia::MediaItem aItem( SID_AVMEDIA_TOOLBOX );
+
+ static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).updateMediaItem( aItem );
+ rSet.Put( aItem );
+ bDisable = false;
+ }
+ }
+
+ if( bDisable )
+ rSet.DisableItem( SID_AVMEDIA_TOOLBOX );
+
+ delete pMarkList;
+ }
+ }
+
+ nWhich = aIter.NextWhich();
+ }
+}
+
+// ------------------------------------------------------------------------------
+
+SwMediaShell::SwMediaShell(SwView &_rView) :
+ SwBaseShell(_rView)
+
+{
+ SetName(String::CreateFromAscii("Media Playback"));
+ SetHelpId(SW_MEDIASHELL);
+}
diff --git a/sw/source/ui/shells/olesh.cxx b/sw/source/ui/shells/olesh.cxx
new file mode 100644
index 000000000000..a4eef5cdbf1d
--- /dev/null
+++ b/sw/source/ui/shells/olesh.cxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/app.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/objitem.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <frmsh.hxx>
+#ifndef _OLESH_HXX
+#include <olesh.hxx>
+#endif
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _POPUP_HRC
+#include <popup.hrc>
+#endif
+#ifndef _SHELLS_HRC
+#include <shells.hrc>
+#endif
+
+
+#define SwOleShell
+#include <sfx2/msg.hxx>
+#include <swslots.hxx>
+
+
+SFX_IMPL_INTERFACE(SwOleShell, SwFrameShell, SW_RES(STR_SHELLNAME_OBJECT))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_OLE_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_OLE_TOOLBOX));
+}
+
+
+SwOleShell::SwOleShell(SwView &_rView) :
+ SwFrameShell(_rView)
+
+{
+ SetName(String::CreateFromAscii("Object"));
+ SetHelpId(SW_OLESHELL);
+}
+
+
diff --git a/sw/source/ui/shells/shells.src b/sw/source/ui/shells/shells.src
new file mode 100644
index 000000000000..8e6527206d77
--- /dev/null
+++ b/sw/source/ui/shells/shells.src
@@ -0,0 +1,305 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <svx/svxids.hrc>
+#include <svx/globlmn.hrc>
+#include "toolbox.hrc"
+#include "helpid.h"
+InfoBox MSG_NO_RULER
+{
+ BUTTONS = WB_OK ;
+ DEFBUTTON = WB_DEF_OK ;
+ Message [ en-US ] = "There are no bitmaps in the Gallery theme 'Rulers'." ;
+};
+String STR_GRFILTER_OPENERROR
+{
+ Text [ en-US ] = "Graphics file cannot be opened" ;
+ Text [ x-comment ] = " ";
+};
+String STR_GRFILTER_IOERROR
+{
+ Text [ en-US ] = "Graphics file cannot be read" ;
+ Text [ x-comment ] = " ";
+};
+String STR_GRFILTER_FORMATERROR
+{
+ Text [ en-US ] = "Unknown graphic format" ;
+ Text [ x-comment ] = " ";
+};
+String STR_GRFILTER_VERSIONERROR
+{
+ Text [ en-US ] = "This graphic file version is not supported" ;
+ Text [ x-comment ] = " ";
+};
+String STR_GRFILTER_FILTERERROR
+{
+ Text [ en-US ] = "Graphics filter not found" ;
+ Text [ x-comment ] = " ";
+};
+String STR_GRFILTER_TOOBIG
+{
+ Text [ en-US ] = "Not enough memory to insert the picture." ;
+ Text [ x-comment ] = " ";
+};
+String STR_INSERT_GRAPHIC
+{
+ Text [ en-US ] = "Insert picture" ;
+};
+String STR_NO_ADDRESSBOOK
+{
+ Text [ en-US ] = "An Address Book does not exist" ;
+ Text [ x-comment ] = " ";
+};
+String STR_NOTIZ_INSERT
+{
+ Text [ en-US ] = "Insert Note" ;
+ Text [ x-comment ] = " ";
+};
+String STR_REDLINE_COMMENT
+{
+ Text [ en-US ] = "Comment: " ;
+ Text [ x-comment ] = " ";
+};
+String STR_REDLINE_INSERTED
+{
+ Text [ en-US ] = "Insertion" ;
+ Text [ x-comment ] = " ";
+};
+String STR_REDLINE_DELETED
+{
+ Text [ en-US ] = "Deletion" ;
+ Text [ x-comment ] = " ";
+};
+String STR_REDLINE_AUTOFMT
+{
+ Text [ en-US ] = "AutoCorrect";
+ Text [ x-comment ] = " ";
+};
+String STR_REDLINE_FORMATED
+{
+ Text [ en-US ] = "Formats" ;
+ Text [ x-comment ] = " ";
+};
+String STR_REDLINE_TABLECHG
+{
+ Text [ en-US ] = "Table Changes" ;
+ Text [ x-comment ] = " ";
+};
+String STR_REDLINE_FMTCOLLSET
+{
+ Text [ en-US ] = "Applied Paragraph Styles";
+ Text [ x-comment ] = " ";
+};
+String STR_REDLINE_TITLE
+{
+ Text [ en-US ] = "AutoCorrect";
+ Text [ x-comment ] = " ";
+};
+String STR_REDLINE_MSG
+{
+ Text [ en-US ] = "AutoCorrect completed.\nYou can accept or reject all changes,\nor accept or reject particular changes.";
+ Text [ x-comment ] = " ";
+};
+String STR_REDLINE_ACCEPT_ALL
+{
+ Text [ en-US ] = "Accept All";
+ Text [ x-comment ] = " ";
+};
+String STR_REDLINE_REJECT_ALL
+{
+ Text [ en-US ] = "Reject All";
+ Text [ x-comment ] = " ";
+};
+String STR_REDLINE_EDIT
+{
+ Text [ en-US ] = "Edit Changes";
+ Text [ x-comment ] = " ";
+};
+QueryBox DLG_IMPORT_DBNAME
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+ Message [ en-US ] = "Use database name as default database for the document?" ;
+ Message [ x-comment ] = " ";
+};
+String STR_PAGE
+{
+ Text [ en-US ] = "Page " ;
+ Text [ x-comment ] = " ";
+};
+String RID_TEXT_TOOLBOX
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Textobjektleiste : Textleiste */
+ Text [ en-US ] = "Text Object Bar" ;
+ Text [ x-comment ] = " ";
+};
+String RID_TABLE_TOOLBOX
+{
+ Text [ en-US ] = "Table Object Bar" ;
+ Text [ x-comment ] = " ";
+};
+String RID_FRAME_TOOLBOX
+{
+ Text [ en-US ] = "Frame Object Bar" ;
+ Text [ x-comment ] = " ";
+};
+String RID_GRAFIK_TOOLBOX
+{
+ Text [ en-US ] = "Graphics Object Bar" ;
+ Text [ x-comment ] = " ";
+};
+String RID_OLE_TOOLBOX
+{
+ Text [ en-US ] = "Object" ;
+ Text [ x-comment ] = " ";
+};
+String RID_DRAW_TOOLBOX
+{
+ Text [ en-US ] = "Draw Object Bar" ;
+ Text [ x-comment ] = " ";
+};
+String RID_BEZIER_TOOLBOX
+{
+ Text [ en-US ] = "Bézier Object Bar" ;
+ Text [ x-comment ] = " ";
+};
+String RID_DRAW_TEXT_TOOLBOX
+{
+ Text [ en-US ] = "Text Object Bar/Graphics" ;
+ Text [ x-comment ] = " ";
+};
+String RID_NUM_TOOLBOX
+{
+ Text [ en-US ] = "Numbering Object Bar" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SHELLNAME_TEXT
+{
+ Text [ en-US ] = "Text" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SHELLNAME_TABLE
+{
+ Text [ en-US ] = "Table" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SHELLNAME_FRAME
+{
+ Text [ en-US ] = "Frame" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SHELLNAME_GRAPHIC
+{
+ Text [ en-US ] = "Graphics" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SHELLNAME_OBJECT
+{
+ Text [ en-US ] = "Object" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SHELLNAME_LIST
+{
+ Text [ en-US ] = "List" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SHELLNAME_DRAW
+{
+ Text [ en-US ] = "Drawing" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SHELLNAME_DRAWFORM
+{
+ Text [ en-US ] = "Forms" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SHELLNAME_BEZIER
+{
+ Text [ en-US ] = "Bézier" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SHELLNAME_DRAW_TEXT
+{
+ Text [ en-US ] = "Draw text" ;
+ Text [ x-comment ] = " ";
+};
+ //Strings fuer Gallery/Hintergrund
+String STR_SWBG_PARAGRAPH
+{
+ Text [ en-US ] = "Paragraph" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SWBG_GRAPHIC
+{
+ Text [ en-US ] = "Graphics" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SWBG_OLE
+{
+ Text [ en-US ] = "OLE object" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SWBG_FRAME
+{
+ Text [ en-US ] = "Frame" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SWBG_TABLE
+{
+ Text [ en-US ] = "Table" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SWBG_TABLE_ROW
+{
+ Text [ en-US ] = "Table row" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SWBG_TABLE_CELL
+{
+ Text [ en-US ] = "Table cell" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SWBG_PAGE
+{
+ Text [ en-US ] = "Page" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SWBG_HEADER
+{
+ Text [ en-US ] = "Header" ;
+ Text [ x-comment ] = " ";
+};
+String STR_SWBG_FOOTER
+{
+ Text [ en-US ] = "Footer" ;
+ Text [ x-comment ] = " ";
+};
+ //Ende: Strings fuer Gallery/Hintergrund
+
+// #i68101# no longer needed:
+// String STR_NAME_SHAPE_LABEL {// String STR_NAME_SHAPE_DIALOG { Text [ de ] = "Objekt benennen" ; Text [ en-US ] = "Name Object"; };
+
+
diff --git a/sw/source/ui/shells/slotadd.cxx b/sw/source/ui/shells/slotadd.cxx
new file mode 100644
index 000000000000..9d162f57aa6f
--- /dev/null
+++ b/sw/source/ui/shells/slotadd.cxx
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include "hintids.hxx"
+#include "uiitems.hxx"
+#include "cmdid.h"
+
+#include <svl/globalnameitem.hxx>
+#include <editeng/memberids.hrc>
+#include <svl/imageitm.hxx>
+#include <svl/aeitem.hxx>
+#include <svl/rectitem.hxx>
+#include <sfx2/objitem.hxx>
+#include <sfx2/objsh.hxx>
+#include <svx/rulritem.hxx>
+#include <svx/zoomitem.hxx>
+#include <svx/viewlayoutitem.hxx>
+#include <svx/zoomslideritem.hxx>
+#include <svx/hlnkitem.hxx>
+#include <svx/SmartTagItem.hxx>
+#include <svl/ptitem.hxx>
+#include <svx/pageitem.hxx>
+#include <svl/srchitem.hxx>
+#include <sfx2/tplpitem.hxx>
+#include <editeng/wrlmitem.hxx>
+#include <editeng/protitem.hxx>
+#include <editeng/opaqitem.hxx>
+#ifndef _SVX_TSTPITEM_HXX //autogen
+#include <editeng/tstpitem.hxx>
+#endif
+#include <editeng/akrnitem.hxx>
+#include <editeng/keepitem.hxx>
+#include <editeng/kernitem.hxx>
+#include <editeng/spltitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/shaditem.hxx>
+#include <editeng/pbinitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/prntitem.hxx>
+#include <editeng/orphitem.hxx>
+#include <editeng/widwitem.hxx>
+#include <editeng/bolnitem.hxx>
+#include <editeng/pmdlitem.hxx>
+#include <editeng/cmapitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <editeng/hyznitem.hxx>
+#include <editeng/escpitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/crsditem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#ifndef _SVX_CNTRITEM_HXX //autogen
+#include <editeng/cntritem.hxx>
+#endif
+#include <editeng/colritem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <svx/xgrad.hxx>
+#include <svx/xlnstit.hxx>
+#include <svx/xlnedit.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflclit.hxx>
+#include <svx/xflgrit.hxx>
+#include <svx/xflhtit.hxx>
+#include <svx/xbtmpit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xtextit0.hxx>
+#include <svx/xftadit.hxx>
+#include <svx/xftdiit.hxx>
+#include <svx/xftstit.hxx>
+#include <svx/xftmrit.hxx>
+#include <svx/xftouit.hxx>
+#include <svx/xftshit.hxx>
+#include <svx/xftshcit.hxx>
+#include <svx/xftshxy.hxx>
+#include <svx/xftsfit.hxx>
+#include <svx/grafctrl.hxx>
+
+
+#include <fmtornt.hxx>
+#include <paratr.hxx>
+#include <fmtinfmt.hxx>
+#include <fmtfsize.hxx>
+#include <fmtsrnd.hxx>
+#include "envimg.hxx"
+#include "frmatr.hxx"
+#include "cfgitems.hxx"
+#include "grfatr.hxx"
+#include "fmtline.hxx"
+#include <svx/clipfmtitem.hxx>
+#include <editeng/blnkitem.hxx>
+#include <svl/slstitm.hxx>
+#include <editeng/paravertalignitem.hxx>
+#include <editeng/charreliefitem.hxx>
+#include <editeng/charrotateitem.hxx>
+#include <editeng/charscaleitem.hxx>
+#include <svx/postattr.hxx>
+#include <sfx2/frame.hxx>
+#include <svx/chrtitem.hxx>
+#include <svx/drawitem.hxx>
+#include <avmedia/mediaitem.hxx>
+
+#define SvxDrawToolItem SfxAllEnumItem
+#define SvxDrawAlignItem SfxAllEnumItem
+#define SvxDrawBezierItem SfxAllEnumItem
+#define avmedia_MediaItem ::avmedia::MediaItem
+
+#define SFX_TYPEMAP
+#include <sfx2/msg.hxx>
+#include "swslots.hxx"
+
+
+
diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx
new file mode 100644
index 000000000000..bb4f1c7fb609
--- /dev/null
+++ b/sw/source/ui/shells/tabsh.cxx
@@ -0,0 +1,1598 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <hintids.hxx>
+
+#ifndef _ZFORLIST_HXX
+#define _ZFORLIST_DECLARE_TABLE
+#include <svl/zforlist.hxx>
+#endif
+#include <svl/stritem.hxx>
+#include <svl/whiter.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <svx/rulritem.hxx>
+#include <svl/srchitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/shaditem.hxx>
+#include <editeng/spltitem.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/keepitem.hxx>
+#include <editeng/bolnitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svx/numinf.hxx>
+#include <svx/svddef.hxx>
+#include <svx/svxdlg.hxx>
+#include <svl/zformat.hxx>
+#include <sfx2/bindings.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objface.hxx>
+
+
+#include <fmtornt.hxx>
+#include <fmtclds.hxx>
+#include <fmtlsplt.hxx>
+#include <fmtrowsplt.hxx>
+#include <fmtfsize.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <wview.hxx>
+#include <frmatr.hxx>
+#include <uitool.hxx>
+#include <inputwin.hxx>
+#include <uiitems.hxx>
+#include <usrpref.hxx>
+#include <tabsh.hxx>
+#include "swtablerep.hxx"
+#include <tablemgr.hxx>
+#include <cellatr.hxx>
+#include <frmfmt.hxx>
+#include <swundo.hxx>
+#include <swtable.hxx>
+#include <docsh.hxx>
+#include <tblsel.hxx>
+
+#include <dialog.hrc>
+
+
+
+//!!! new: insert table
+/*
+#include <svx/htmlmode.hxx>
+#include <modcfg.hxx>
+#include <tblafmt.hxx>
+#include <instable.hxx>
+*/
+//!!!
+
+#ifndef _POPUP_HRC
+#include <popup.hrc>
+#endif
+#ifndef _SHELLS_HRC
+#include <shells.hrc>
+#endif
+#ifndef _TABLE_HRC
+#include <table.hrc>
+#endif
+#include <cmdid.h>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#include <helpid.h>
+#include <unobaseclass.hxx>
+
+#define SwTableShell
+#include <sfx2/msg.hxx>
+#include <swslots.hxx>
+
+#include "swabstdlg.hxx"
+#include <table.hrc>
+
+using namespace ::com::sun::star;
+
+//-----------------------------------------------------------------------------
+
+SFX_IMPL_INTERFACE(SwTableShell, SwBaseShell, SW_RES(STR_SHELLNAME_TABLE))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_TAB_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TABLE_TOOLBOX));
+}
+
+
+TYPEINIT1(SwTableShell,SwBaseShell)
+
+/************************************************************************/
+
+const USHORT __FAR_DATA aUITableAttrRange[] =
+{
+ FN_PARAM_TABLE_NAME, FN_PARAM_TABLE_NAME,
+ FN_PARAM_TABLE_HEADLINE, FN_PARAM_TABLE_HEADLINE,
+ FN_PARAM_TABLE_SPACE, FN_PARAM_TABLE_SPACE,
+ FN_TABLE_REP, FN_TABLE_REP,
+ SID_RULER_BORDERS, SID_RULER_BORDERS,
+ RES_LR_SPACE, RES_UL_SPACE,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW,
+ RES_BOX, RES_SHADOW,
+ RES_BACKGROUND, RES_BACKGROUND,
+ SID_BACKGRND_DESTINATION, SID_BACKGRND_DESTINATION,
+ SID_HTML_MODE, SID_HTML_MODE,
+ SID_ATTR_BRUSH_ROW, SID_ATTR_BRUSH_TABLE,
+ RES_PAGEDESC, RES_BREAK,
+ RES_KEEP, RES_KEEP,
+ RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT,
+ FN_TABLE_SET_VERT_ALIGN, FN_TABLE_SET_VERT_ALIGN,
+ RES_FRAMEDIR, RES_FRAMEDIR,
+ RES_ROW_SPLIT, RES_ROW_SPLIT,
+ FN_TABLE_BOX_TEXTDIRECTION, FN_TABLE_BOX_TEXTDIRECTION,
+// --> collapsing borders FME 2005-05-27 #i29550#
+ RES_COLLAPSING_BORDERS, RES_COLLAPSING_BORDERS,
+// <-- collapsing borders
+ 0
+};
+
+const USHORT* SwuiGetUITableAttrRange()
+{
+ return aUITableAttrRange;
+}
+
+static void lcl_SetAttr( SwWrtShell &rSh, const SfxPoolItem &rItem )
+{
+ SfxItemSet aSet( rSh.GetView().GetPool(), rItem.Which(), rItem.Which(), 0);
+ aSet.Put( rItem );
+ rSh.SetTblAttr( aSet );
+}
+
+/************************************************************************/
+
+
+static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
+{
+ SwFrmFmt *pFmt = rSh.GetTableFmt();
+ SwTabCols aCols;
+ rSh.GetTabCols( aCols );
+
+ //Ersteinmal die einfachen Attribute besorgen.
+ rSet.Put( SfxStringItem( FN_PARAM_TABLE_NAME, pFmt->GetName()));
+ rSet.Put( SfxUInt16Item( FN_PARAM_TABLE_HEADLINE, rSh.GetRowsToRepeat() ) );
+ rSet.Put( pFmt->GetShadow() );
+ rSet.Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, rSh.GetBoxAlign()));
+ rSet.Put( pFmt->GetFrmDir() );
+
+ SvxULSpaceItem aULSpace( pFmt->GetULSpace() );
+ rSet.Put( aULSpace );
+
+ USHORT nBackgroundDestination = rSh.GetViewOptions()->GetTblDest();
+ rSet.Put(SwBackgroundDestinationItem(SID_BACKGRND_DESTINATION, nBackgroundDestination ));
+ SvxBrushItem aBrush( RES_BACKGROUND );
+// rSh.GetBoxBackground(aBrush);
+// rSet.Put( aBrush );
+ if(rSh.GetRowBackground(aBrush))
+ rSet.Put( aBrush, SID_ATTR_BRUSH_ROW );
+ else
+ rSet.InvalidateItem(SID_ATTR_BRUSH_ROW);
+ rSh.GetTabBackground(aBrush);
+ rSet.Put( aBrush, SID_ATTR_BRUSH_TABLE );
+
+ // text direction in boxes
+ SvxFrameDirectionItem aBoxDirection( FRMDIR_ENVIRONMENT, RES_FRAMEDIR );
+ if(rSh.GetBoxDirection( aBoxDirection ))
+ rSet.Put(aBoxDirection, FN_TABLE_BOX_TEXTDIRECTION);
+
+ BOOL bTableSel = rSh.IsTableMode();
+ if(!bTableSel)
+ {
+ rSh.StartAllAction();
+ rSh.Push();
+ rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( FN_TABLE_SELECT_ALL, FALSE );
+ }
+ SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+
+ // Tabellenvariante, wenn mehrere Tabellenzellen selektiert
+ rSh.GetCrsr(); //Damit GetCrsrCnt() auch das Richtige liefert
+ aBoxInfo.SetTable ((rSh.IsTableMode() && rSh.GetCrsrCnt() > 1) ||
+ !bTableSel);
+ // Abstandsfeld immer anzeigen
+ aBoxInfo.SetDist ((BOOL) TRUE);
+ // Minimalgroesse in Tabellen und Absaetzen setzen
+ aBoxInfo.SetMinDist( !bTableSel || rSh.IsTableMode() ||
+ rSh.GetSelectionType() &
+ (nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL));
+ // Default-Abstand immer setzen
+ aBoxInfo.SetDefDist (MIN_BORDER_DIST);
+ // Einzelne Linien koennen nur in Tabellen DontCare-Status haben
+ aBoxInfo.SetValid( VALID_DISABLE, !bTableSel || !rSh.IsTableMode() );
+
+ rSet.Put(aBoxInfo);
+ rSh.GetTabBorders( rSet );
+
+ //row split
+ SwFmtRowSplit* pSplit = 0;
+ rSh.GetRowSplit(pSplit);
+ if(pSplit)
+ {
+ rSet.Put(*pSplit);
+ delete pSplit;
+ }
+
+ if(!bTableSel)
+ {
+ rSh.ClearMark();
+ rSh.Pop(FALSE);
+ rSh.EndAllAction();
+ }
+
+ SwTabCols aTabCols;
+ rSh.GetTabCols( aTabCols );
+ SvxColumnItem aColItem;
+
+
+ // Pointer wird nach der Dialogausfuehrung geloescht
+ SwTableRep* pRep = new SwTableRep( aTabCols, rSh.IsTblComplex());
+ pRep->SetSpace(aCols.GetRightMax());
+
+ USHORT nPercent = 0;
+ long nWidth = ::GetTableWidth(pFmt, aCols, &nPercent, &rSh );
+ // Die Tabellenbreite ist fuer relative Angaben nicht korrekt
+ if(nPercent)
+ nWidth = pRep->GetSpace() * nPercent / 100;
+ USHORT nAlign = pFmt->GetHoriOrient().GetHoriOrient();
+ pRep->SetAlign(nAlign);
+ SvxLRSpaceItem aLRSpace( pFmt->GetLRSpace() );
+ SwTwips nLeft = aLRSpace.GetLeft();
+ SwTwips nRight = aLRSpace.GetRight();
+ SwTwips nDiff = pRep->GetSpace() - nRight - nLeft - nWidth;
+ if(nAlign != text::HoriOrientation::FULL && Abs(nDiff) > 2)
+ {
+ SwTwips nLR = pRep->GetSpace() - nWidth;
+ switch ( nAlign )
+ {
+ case text::HoriOrientation::CENTER: nLeft = nRight = nLR / 2;
+ break;
+ case text::HoriOrientation::LEFT: nRight = nLR; nLeft = 0;
+ break;
+ case text::HoriOrientation::RIGHT: nLeft = nLR, nRight = 0;
+ break;
+ case text::HoriOrientation::LEFT_AND_WIDTH:
+ nRight = nLR - nLeft;
+ break;
+ case text::HoriOrientation::NONE:
+ if(!nPercent)
+ nWidth = pRep->GetSpace() - nLeft - nRight;
+ break;
+ }
+ }
+ pRep->SetLeftSpace(nLeft);
+ pRep->SetRightSpace(nRight);
+
+ pRep->SetWidth(nWidth);
+ pRep->SetWidthPercent(nPercent);
+ // sind einzelne Zeilen/Zellen selektiert, wird die Spaltenbearbeitung veraendert
+ pRep->SetLineSelected(bTableSel && ! rSh.HasWholeTabSelection());
+ rSet.Put(SwPtrItem(FN_TABLE_REP, pRep));
+ return pRep;
+}
+
+/************************************************************************/
+
+
+void ItemSetToTableParam( const SfxItemSet& rSet,
+ SwWrtShell &rSh )
+{
+ rSh.StartAllAction();
+ rSh.StartUndo( UNDO_TABLE_ATTR );
+ const SfxPoolItem* pItem = 0;
+
+ SwViewOption aUsrPref( *rSh.GetViewOptions() );
+ USHORT nBackgroundDestination = aUsrPref.GetTblDest();
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_BACKGRND_DESTINATION, FALSE, &pItem))
+ {
+ nBackgroundDestination = ((SfxUInt16Item*)pItem)->GetValue();
+ aUsrPref.SetTblDest((BYTE)nBackgroundDestination);
+ SW_MOD()->ApplyUsrPref(aUsrPref, &rSh.GetView());
+ }
+ BOOL bBorder = ( SFX_ITEM_SET == rSet.GetItemState( RES_BOX ) ||
+ SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER ) );
+ pItem = 0;
+ BOOL bBackground = SFX_ITEM_SET == rSet.GetItemState( RES_BACKGROUND, FALSE, &pItem );
+ const SfxPoolItem* pRowItem = 0, *pTableItem = 0;
+ bBackground |= SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BRUSH_ROW, FALSE, &pRowItem );
+ bBackground |= SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BRUSH_TABLE, FALSE, &pTableItem );
+ const SfxPoolItem* pSplit = 0;
+ BOOL bRowSplit = SFX_ITEM_SET == rSet.GetItemState( RES_ROW_SPLIT, FALSE, &pSplit );
+ const SfxPoolItem* pBoxDirection = 0;
+ BOOL bBoxDirection = SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_BOX_TEXTDIRECTION, FALSE, &pBoxDirection );
+ if( bBackground || bBorder || bRowSplit || bBoxDirection)
+ {
+ /*
+ Die Umrandung wird auf die vorliegende Selektion angewendet
+ Liegt keine Selektion vor, wird die Tabelle vollstaendig selektiert.
+ Der Hintergrund wird immer auf den aktuellen Zustand angewendet.
+ */
+
+ BOOL bTableSel = rSh.IsTableMode();
+ rSh.StartAllAction();
+
+ if(bBackground)
+ {
+ if(pItem)
+ rSh.SetBoxBackground( *(const SvxBrushItem*)pItem );
+ if(pRowItem)
+ {
+ SvxBrushItem aBrush(*(const SvxBrushItem*)pRowItem);
+ aBrush.SetWhich(RES_BACKGROUND);
+ rSh.SetRowBackground(aBrush);
+ }
+ if(pTableItem)
+ {
+ SvxBrushItem aBrush(*(const SvxBrushItem*)pTableItem);
+ aBrush.SetWhich(RES_BACKGROUND);
+ rSh.SetTabBackground( aBrush );
+ }
+ }
+
+ if(bBoxDirection)
+ {
+ SvxFrameDirectionItem aDirection( FRMDIR_ENVIRONMENT, RES_FRAMEDIR );
+ aDirection.SetValue(static_cast< const SvxFrameDirectionItem* >(pBoxDirection)->GetValue());
+ rSh.SetBoxDirection(aDirection);
+ }
+
+ if(bBorder || bRowSplit)
+ {
+ rSh.Push();
+ if(!bTableSel)
+ {
+ rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( FN_TABLE_SELECT_ALL );
+ }
+ if(bBorder)
+ rSh.SetTabBorders( rSet );
+
+ if(bRowSplit)
+ {
+ rSh.SetRowSplit(*static_cast<const SwFmtRowSplit*>(pSplit));
+ }
+
+ if(!bTableSel)
+ {
+ rSh.ClearMark();
+ }
+ rSh.Pop(FALSE);
+ }
+
+ rSh.EndAllAction();
+ }
+
+ SwTabCols aTabCols;
+ BOOL bTabCols = FALSE;
+ BOOL bSingleLine = FALSE;
+ SwTableRep* pRep = 0;
+ SwFrmFmt *pFmt = rSh.GetTableFmt();
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 );
+ if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP, FALSE, &pItem ))
+ {
+ pRep = (SwTableRep*)((const SwPtrItem*)pItem)->GetValue();
+
+ const SwTwips nWidth = pRep->GetWidth();
+ if ( text::HoriOrientation::FULL == pRep->GetAlign() )
+ {
+ SwFmtHoriOrient aAttr( pFmt->GetHoriOrient() );
+ aAttr.SetHoriOrient( text::HoriOrientation::FULL );
+ aSet.Put( aAttr );
+ }
+ else
+ {
+ SwFmtFrmSize aSz( ATT_VAR_SIZE, nWidth );
+ if(pRep->GetWidthPercent())
+ {
+ aSz.SetWidthPercent( (BYTE)pRep->GetWidthPercent() );
+ }
+ aSet.Put(aSz);
+ }
+
+ SvxLRSpaceItem aLRSpace( RES_LR_SPACE );
+ aLRSpace.SetLeft(pRep->GetLeftSpace());
+ aLRSpace.SetRight(pRep->GetRightSpace());
+ aSet.Put( aLRSpace );
+
+ sal_Int16 eOrient = pRep->GetAlign();
+ SwFmtHoriOrient aAttr( 0, eOrient );
+ aSet.Put( aAttr );
+ // Damit beim recording die Ausrichtung nicht durch die Abstaende ueberschrieben
+ // wird, darf das Item nur bei manueller Ausrichtung aufgez. werden
+ if(eOrient != text::HoriOrientation::NONE)
+ ((SfxItemSet&)rSet).ClearItem( SID_ATTR_LRSPACE );
+
+
+ if(pRep->HasColsChanged())
+ {
+ bTabCols = TRUE;
+ }
+ }
+
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, FALSE, &pItem))
+ rSh.SetRowsToRepeat( ((SfxUInt16Item*)pItem)->GetValue() );
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_SET_VERT_ALIGN, FALSE, &pItem))
+ rSh.SetBoxAlign(((SfxUInt16Item*)(pItem))->GetValue());
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_NAME, FALSE, &pItem ))
+ rSh.SetTableName( *pFmt, ((const SfxStringItem*)pItem)->GetValue() );
+
+ // kopiere die ausgesuchten Attribute in den ItemSet
+ static USHORT __READONLY_DATA aIds[] =
+ {
+ RES_PAGEDESC,
+ RES_BREAK,
+ RES_KEEP,
+ RES_LAYOUT_SPLIT,
+ RES_UL_SPACE,
+ RES_SHADOW,
+ RES_FRAMEDIR,
+ // --> collapsing borders FME 2005-05-27 #i29550#
+ RES_COLLAPSING_BORDERS,
+ // <-- collapsing borders
+ 0
+ };
+ for( const USHORT* pIds = aIds; *pIds; ++pIds )
+ if( SFX_ITEM_SET == rSet.GetItemState( *pIds, FALSE, &pItem))
+ aSet.Put( *pItem );
+
+ if( aSet.Count() )
+ rSh.SetTblAttr( aSet );
+
+ if(bTabCols)
+ {
+ rSh.GetTabCols( aTabCols );
+ bSingleLine = pRep->FillTabCols( aTabCols );
+ rSh.SetTabCols( aTabCols, bSingleLine );
+ }
+
+ rSh.EndUndo( UNDO_TABLE_ATTR );
+ rSh.EndAllAction();
+}
+
+/************************************************************************/
+
+
+static void lcl_TabGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine)
+{
+ if(pBorderLine->GetInWidth() > rBorderLine.GetInWidth())
+ rBorderLine.SetInWidth(pBorderLine->GetInWidth());
+
+ if(pBorderLine->GetOutWidth() > rBorderLine.GetOutWidth())
+ rBorderLine.SetOutWidth(pBorderLine->GetOutWidth());
+
+ if(pBorderLine->GetDistance() > rBorderLine.GetDistance())
+ rBorderLine.SetDistance(pBorderLine->GetDistance());
+
+ rBorderLine.SetColor(pBorderLine->GetColor());
+}
+
+
+void SwTableShell::Execute(SfxRequest &rReq)
+{
+ BOOL bUseDialog = TRUE;
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ SwWrtShell &rSh = GetShell();
+
+ //Erstmal die Slots, die keinen FrmMgr benoetigen.
+ BOOL bMore = FALSE;
+ const SfxPoolItem* pItem = 0;
+ USHORT nSlot = rReq.GetSlot();
+ if(pArgs)
+ pArgs->GetItemState(GetPool().GetWhich(nSlot), FALSE, &pItem);
+ BOOL bCallDone = FALSE;
+ switch ( nSlot )
+ {
+ case SID_ATTR_BORDER:
+ {
+/* BOOL bPopCrsr = FALSE;
+ if ( !rReq.IsAPI() )
+ {
+ //Keine Tabellenselektion -> Aenderung wird auf die gesamte
+ //Tabelle.
+ if ( !rSh.IsTableMode() )
+ {
+ rSh.StartAction();
+ bPopCrsr = TRUE;
+ rSh.Push();
+ rSh.EnterStdMode();
+ rSh.MoveTable( fnTableCurr, fnTableStart );
+ rSh.SttSelect();
+ rSh.MoveTable( fnTableCurr, fnTableEnd );
+ rSh.EndSelect();
+ }
+ }*/
+ if(!pArgs)
+ break;
+ //Items erzeugen, weil wir sowieso nacharbeiten muessen
+ SvxBoxItem aBox( RES_BOX );
+ SfxItemSet aCoreSet( GetPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ 0);
+ SvxBoxInfoItem aCoreInfo( SID_ATTR_BORDER_INNER );
+ aCoreSet.Put(aCoreInfo);
+ rSh.GetTabBorders( aCoreSet );
+ const SvxBoxItem& rCoreBox = (const SvxBoxItem&)
+ aCoreSet.Get(RES_BOX);
+ const SfxPoolItem *pBoxItem = 0;
+ if ( pArgs->GetItemState(RES_BOX, TRUE, &pBoxItem) == SFX_ITEM_SET )
+ {
+ aBox = *(SvxBoxItem*)pBoxItem;
+ if ( !rReq.IsAPI() )
+ aBox.SetDistance( Max(rCoreBox.GetDistance(),USHORT(55)) );
+ else if ( aBox.GetDistance() < MIN_BORDER_DIST )
+ aBox.SetDistance( Max(rCoreBox.GetDistance(),(USHORT)MIN_BORDER_DIST) );
+ }
+ else
+ {ASSERT( !this, "Wo ist das Box-Item?" )}
+
+ //since the drawing layer also supports borders the which id might be a different one
+ SvxBoxInfoItem aInfo( SID_ATTR_BORDER_INNER );
+ if (pArgs->GetItemState(SID_ATTR_BORDER_INNER, TRUE, &pBoxItem) == SFX_ITEM_SET)
+ aInfo = *(SvxBoxInfoItem*)pBoxItem;
+ else if( pArgs->GetItemState(SDRATTR_TABLE_BORDER_INNER, TRUE, &pBoxItem) == SFX_ITEM_SET )
+ {
+ aInfo = *(SvxBoxInfoItem*)pBoxItem;
+ aInfo.SetWhich(SID_ATTR_BORDER_INNER);
+ }
+
+ aInfo.SetTable( TRUE );
+ aInfo.SetValid( VALID_DISABLE, FALSE );
+
+
+// Die Attribute aller Linien werden gelesen und das staerkste gewinnt
+ const SvxBorderLine* pBorderLine;
+ SvxBorderLine aBorderLine;
+ if ((pBorderLine = rCoreBox.GetTop()) != NULL)
+ lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
+ if ((pBorderLine = rCoreBox.GetBottom()) != NULL)
+ lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
+ if ((pBorderLine = rCoreBox.GetLeft()) != NULL)
+ lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
+ if ((pBorderLine = rCoreBox.GetRight()) != NULL)
+ lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
+ if ((pBorderLine = aCoreInfo.GetHori()) != NULL)
+ lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
+ if ((pBorderLine = aCoreInfo.GetVert()) != NULL)
+ lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
+
+ if(aBorderLine.GetOutWidth() == 0)
+ {
+ aBorderLine.SetInWidth(0);
+ aBorderLine.SetOutWidth(DEF_LINE_WIDTH_0);
+ }
+
+ BOOL bLine = FALSE;
+ if ( (pBorderLine = aBox.GetTop()) != NULL)
+ aBox.SetLine(&aBorderLine, BOX_LINE_TOP), bLine |= TRUE;
+ if ((pBorderLine = aBox.GetBottom()) != NULL)
+ aBox.SetLine(&aBorderLine, BOX_LINE_BOTTOM), bLine |= TRUE;
+ if ((pBorderLine = aBox.GetLeft()) != NULL)
+ aBox.SetLine(&aBorderLine, BOX_LINE_LEFT), bLine |= TRUE;
+ if ((pBorderLine = aBox.GetRight()) != NULL)
+ aBox.SetLine(&aBorderLine, BOX_LINE_RIGHT), bLine |= TRUE;
+ if ((pBorderLine = aInfo.GetHori()) != NULL)
+ aInfo.SetLine(&aBorderLine, BOXINFO_LINE_HORI), bLine |= TRUE;
+ if ((pBorderLine = aInfo.GetVert()) != NULL)
+ aInfo.SetLine(&aBorderLine, BOXINFO_LINE_VERT), bLine |= TRUE;
+
+// if ( bPopCrsr && !bLine )
+// aBox.SetDistance( 0 );
+
+ aCoreSet.Put( aBox );
+ aCoreSet.Put( aInfo );
+ rSh.SetTabBorders( aCoreSet );
+
+ // we must record the "real" values because otherwise the lines can't be reconstructed on playtime
+ // the coding style of the controller (setting lines with width 0) is not transportable via Query/PutValue in
+ // the SvxBoxItem
+ rReq.AppendItem( aBox );
+ rReq.AppendItem( aInfo );
+ bCallDone = TRUE;
+
+/* if ( bPopCrsr )
+ {
+ rSh.KillPams();
+ rSh.Pop(FALSE);
+ rSh.EndAction();
+ }*/
+ }
+ break;
+ case FN_INSERT_TABLE:
+ InsertTable( rReq );
+ break;
+ case FN_FORMAT_TABLE_DLG:
+ {
+ //#127012# get the bindings before the dialog is called
+ // it might happen that this shell is removed after closing the dialog
+ SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings();
+ SfxItemSet aCoreSet( GetPool(), aUITableAttrRange);
+
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView()));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)));
+ SwTableRep* pTblRep = ::lcl_TableParamToItemSet( aCoreSet, rSh );
+ SfxAbstractTabDialog * pDlg = NULL;
+ if ( bUseDialog )
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ pDlg = pFact->CreateSwTableTabDlg( GetView().GetWindow(), GetPool(), &aCoreSet, &rSh, DLG_FORMAT_TABLE );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ }
+ aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
+ rSh.GetTblAttr(aCoreSet);
+ // GetTblAttr buegelt den Background ueber!
+ SvxBrushItem aBrush( RES_BACKGROUND );
+ if(rSh.GetBoxBackground(aBrush))
+ aCoreSet.Put( aBrush );
+ else
+ aCoreSet.InvalidateItem( RES_BACKGROUND );
+
+ if ( (!pDlg && rReq.GetArgs()) || pDlg->Execute() == RET_OK )
+ {
+ const SfxItemSet* pOutSet = pDlg ? pDlg->GetOutputItemSet() : rReq.GetArgs();
+ if ( pDlg )
+ {
+ //to record FN_INSERT_TABLE correctly
+ rReq.SetSlot(FN_FORMAT_TABLE_DLG);
+ rReq.Done( *pOutSet );
+ }
+ ItemSetToTableParam( *pOutSet, rSh );
+ }
+
+ delete pDlg;
+ delete pTblRep;
+ rBindings.Update(SID_RULER_BORDERS);
+ rBindings.Update(SID_ATTR_TABSTOP);
+ rBindings.Update(SID_RULER_BORDERS_VERTICAL);
+ rBindings.Update(SID_ATTR_TABSTOP_VERTICAL);
+ }
+ break;
+ case SID_ATTR_BRUSH:
+ case SID_ATTR_BRUSH_ROW :
+ case SID_ATTR_BRUSH_TABLE :
+ if(rReq.GetArgs())
+ ItemSetToTableParam(*rReq.GetArgs(), rSh);
+ break;
+ case FN_NUM_FORMAT_TABLE_DLG:
+ {
+ SwView* pView = GetActiveView();
+ if(pView)
+ {
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)));
+ SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
+ SfxItemSet aCoreSet( GetPool(),
+ SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_VALUE,
+ SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO,
+ 0 );
+
+ SfxItemSet aBoxSet( *aCoreSet.GetPool(),
+ RES_BOXATR_FORMAT, RES_BOXATR_FORMAT,
+ RES_BOXATR_VALUE, RES_BOXATR_VALUE,
+ 0 );
+ rSh.GetTblBoxFormulaAttrs( aBoxSet );
+
+ SfxItemState eState = aBoxSet.GetItemState(RES_BOXATR_FORMAT);
+ if(eState == SFX_ITEM_DEFAULT)
+ {
+ aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
+ pFormatter->GetFormatIndex(NF_TEXT, LANGUAGE_SYSTEM)));
+ }
+ else
+ aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
+ ((SwTblBoxNumFormat&)aBoxSet.Get(
+ RES_BOXATR_FORMAT )).GetValue() ));
+
+ String sCurText( rSh.GetTableBoxText() );
+ aCoreSet.Put( SvxNumberInfoItem( pFormatter,
+ ((SwTblBoxValue&)aBoxSet.Get(
+ RES_BOXATR_VALUE)).GetValue(),
+ sCurText, SID_ATTR_NUMBERFORMAT_INFO ));
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(),aCoreSet,
+ pView->GetViewFrame()->GetFrame().GetFrameInterface(),
+ RC_DLG_SWNUMFMTDLG );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+
+ if (RET_OK == pDlg->Execute())
+ {
+ const SfxPoolItem* pNumberFormatItem = GetView().GetDocShell()->
+ GetItem( SID_ATTR_NUMBERFORMAT_INFO );
+
+ if( pNumberFormatItem && 0 != ((SvxNumberInfoItem*)pNumberFormatItem)->GetDelCount() )
+ {
+ const sal_uInt32* pDelArr = ((SvxNumberInfoItem*)
+ pNumberFormatItem)->GetDelArray();
+
+ for ( USHORT i = 0; i < ((SvxNumberInfoItem*)pNumberFormatItem)->GetDelCount(); i++ )
+ ((SvxNumberInfoItem*)pNumberFormatItem)->
+ GetNumberFormatter()->DeleteEntry( pDelArr[i] );
+ }
+
+ if( SFX_ITEM_SET == pDlg->GetOutputItemSet()->GetItemState(
+ SID_ATTR_NUMBERFORMAT_VALUE, FALSE, &pNumberFormatItem ))
+ {
+ SfxItemSet aBoxFormatSet( *aCoreSet.GetPool(),
+ RES_BOXATR_FORMAT, RES_BOXATR_FORMAT );
+ aBoxFormatSet.Put( SwTblBoxNumFormat(
+ ((SfxUInt32Item*)pNumberFormatItem)->GetValue() ));
+ rSh.SetTblBoxFormulaAttrs( aBoxFormatSet );
+
+ }
+ }
+ delete pDlg;
+ }
+ }
+ break;
+ case FN_CALC_TABLE:
+ rSh.UpdateTable();
+ bCallDone = TRUE;
+ break;
+ case FN_TABLE_OPTIMAL_HEIGHT:
+ {
+ const SwFmtFrmSize aSz;
+ rSh.SetRowHeight( aSz );
+ bCallDone = TRUE;
+ }
+ break;
+ case FN_TABLE_DELETE_COL:
+ if ( rSh.DeleteCol() && rSh.HasSelection() )
+ rSh.EnterStdMode();
+ bCallDone = TRUE;
+ break;
+ case FN_END_TABLE:
+ rSh.MoveTable( fnTableCurr, fnTableEnd );
+ bCallDone = TRUE;
+ break;
+ case FN_START_TABLE:
+ rSh.MoveTable( fnTableCurr, fnTableStart );
+ bCallDone = TRUE;
+ break;
+ case FN_GOTO_NEXT_CELL:
+ {
+ BOOL bAppendLine = TRUE;
+ if( pItem )
+ bAppendLine = ((SfxBoolItem*)pItem)->GetValue();
+ rReq.SetReturnValue( SfxBoolItem( nSlot,
+ rSh.GoNextCell( bAppendLine ) ) );
+ bCallDone = TRUE;
+ }
+ break;
+ case FN_GOTO_PREV_CELL:
+ rReq.SetReturnValue( SfxBoolItem( nSlot, rSh.GoPrevCell() ) );
+ bCallDone = TRUE;
+ break;
+ case FN_TABLE_DELETE_ROW:
+ if ( rSh.DeleteRow() && rSh.HasSelection() )
+ rSh.EnterStdMode();
+ bCallDone = TRUE;
+ break;
+ case FN_TABLE_MERGE_CELLS:
+ if ( rSh.IsTableMode() )
+ switch ( rSh.MergeTab() )
+ {
+ case TBLMERGE_OK:
+ bCallDone = TRUE;
+ //no break;
+ case TBLMERGE_NOSELECTION: break;
+ case TBLMERGE_TOOCOMPLEX:
+ {
+ InfoBox aInfoBox( GetView().GetWindow(),
+ SW_RES( MSG_ERR_TABLE_MERGE ) );
+ aInfoBox.Execute();
+ break;
+ }
+ default: ASSERT( !this, "unbekannter Returnwert MergeTab.");
+ }
+ break;
+ case FN_TABLE_ADJUST_CELLS:
+ case FN_TABLE_BALANCE_CELLS:
+ {
+ BOOL bBalance = (FN_TABLE_BALANCE_CELLS == nSlot);
+ if ( rSh.IsAdjustCellWidthAllowed(bBalance) )
+ {
+ {
+ // remove actions to make a valid table selection
+ UnoActionRemoveContext aRemoveContext(rSh.GetDoc());
+ }
+ rSh.AdjustCellWidth(bBalance);
+ }
+ bCallDone = TRUE;
+ }
+ break;
+ case FN_TABLE_BALANCE_ROWS:
+ if ( rSh.BalanceRowHeight(TRUE) )
+ rSh.BalanceRowHeight(FALSE);
+ bCallDone = TRUE;
+ break;
+ case FN_TABLE_SELECT_ALL:
+ rSh.EnterStdMode();
+ rSh.MoveTable( fnTableCurr, fnTableStart );
+ rSh.SttSelect();
+ rSh.MoveTable( fnTableCurr, fnTableEnd );
+ rSh.EndSelect();
+ bCallDone = TRUE;
+ break;
+ case FN_TABLE_SELECT_COL:
+ rSh.EnterStdMode();
+ rSh.SelectTableCol();
+ bCallDone = TRUE;
+ break;
+ case FN_TABLE_SELECT_ROW:
+ rSh.EnterStdMode();
+ rSh.SelectTableRow();
+ bCallDone = TRUE;
+ break;
+ case FN_TABLE_SET_READ_ONLY_CELLS:
+ rSh.ProtectCells();
+ rSh.ResetSelect( 0, FALSE );
+ bCallDone = TRUE;
+ break;
+ case FN_TABLE_UNSET_READ_ONLY_CELLS:
+ rSh.UnProtectCells();
+ bCallDone = TRUE;
+ break;
+ case SID_AUTOFORMAT:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(&GetView().GetViewFrame()->GetWindow(), &rSh , DLG_AUTOFMT_TABLE );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ }
+ break;
+ case FN_TABLE_SET_ROW_HEIGHT:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ VclAbstractDialog* pDlg = pFact->CreateVclAbstractDialog( GetView().GetWindow(), rSh, DLG_ROW_HEIGHT );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ }
+ break;
+ case FN_NUMBER_BULLETS:
+ case FN_NUM_BULLET_ON:
+ ASSERT( !this, "Funktion darf zur Zeit nicht gerufen werden." );
+ break;
+
+ case FN_TABLE_INSERT_COL:
+ case FN_TABLE_INSERT_ROW:
+ {
+ BOOL bColumn = rReq.GetSlot() == FN_TABLE_INSERT_COL;
+ USHORT nCount = 0;
+ BOOL bAfter = TRUE;
+ if (pItem)
+ {
+ nCount = ((const SfxInt16Item* )pItem)->GetValue();
+ if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_INSERT_AFTER, TRUE, &pItem))
+ bAfter = ((const SfxBoolItem* )pItem)->GetValue();
+ }
+ else if( !rReq.IsAPI() )
+ ++nCount;
+
+ if( nCount )
+ {
+ // i74180: Table border patch submitted by chensuchun:
+ // -->get the SvxBoxInfoItem of the table before insert
+ SfxItemSet aCoreSet( GetPool(), aUITableAttrRange);
+ ::lcl_TableParamToItemSet( aCoreSet, rSh );
+ bool bSetInnerBorders = false;
+ SwUndoId nUndoId = UNDO_EMPTY;
+ // <--End
+
+ if( bColumn )
+ {
+ rSh.StartUndo( UNDO_TABLE_INSCOL );
+ rSh.InsertCol( nCount, bAfter );
+ bSetInnerBorders = true;
+ nUndoId = UNDO_TABLE_INSCOL;
+ }
+ else if ( !rSh.IsInRepeatedHeadline() )
+ {
+ rSh.StartUndo( UNDO_TABLE_INSROW );
+ rSh.InsertRow( nCount, bAfter );
+ bSetInnerBorders = true;
+ nUndoId = UNDO_TABLE_INSROW;
+ }
+
+ // -->after inserting,reset the inner table borders
+ if ( bSetInnerBorders )
+ {
+ const SvxBoxInfoItem aBoxInfo((const SvxBoxInfoItem&)
+ aCoreSet.Get(SID_ATTR_BORDER_INNER));
+ SfxItemSet aSet( GetPool(), SID_ATTR_BORDER_INNER,
+ SID_ATTR_BORDER_INNER, 0);
+ aSet.Put( aBoxInfo );
+ ItemSetToTableParam( aSet, rSh );
+ rSh.EndUndo( nUndoId );
+ }
+ // <--
+
+ bCallDone = TRUE;
+ break;
+ }
+
+ nSlot = bColumn ? FN_TABLE_INSERT_COL_DLG : FN_TABLE_INSERT_ROW_DLG;
+ }
+ // kein break; bei Count = 0 kommt der Dialog
+ case FN_TABLE_INSERT_COL_DLG:
+ case FN_TABLE_INSERT_ROW_DLG:
+ {
+ const SfxSlot* pSlot = GetStaticInterface()->GetSlot(nSlot);
+ if ( FN_TABLE_INSERT_ROW_DLG != nSlot || !rSh.IsInRepeatedHeadline())
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ ::std::auto_ptr<SvxAbstractInsRowColDlg> pDlg( pFact ? pFact->CreateSvxInsRowColDlg( GetView().GetWindow(), nSlot == FN_TABLE_INSERT_COL_DLG, pSlot->GetCommand() ) : 0);
+
+ if( pDlg.get() && (pDlg->Execute() == 1) )
+ {
+ USHORT nDispatchSlot = (nSlot == FN_TABLE_INSERT_COL_DLG) ? FN_TABLE_INSERT_COL : FN_TABLE_INSERT_ROW;
+ SfxUInt16Item aCountItem( nDispatchSlot, static_cast< UINT16 >(pDlg->getInsertCount()) );
+ SfxBoolItem aAfter( FN_PARAM_INSERT_AFTER, !pDlg->isInsertBefore() );
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ if( pVFrame )
+ pVFrame->GetDispatcher()->Execute( nDispatchSlot, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aCountItem, &aAfter, 0L);
+ }
+ }
+ }
+ break;
+ case FN_TABLE_SPLIT_CELLS:
+ {
+ long nCount=0;
+ BOOL bHorizontal=TRUE;
+ BOOL bProportional = FALSE;
+ SFX_REQUEST_ARG( rReq, pSplit, SfxInt32Item, FN_TABLE_SPLIT_CELLS, sal_False );
+ SFX_REQUEST_ARG( rReq, pHor, SfxBoolItem, FN_PARAM_1, sal_False );
+ SFX_REQUEST_ARG( rReq, pProp, SfxBoolItem, FN_PARAM_2, sal_False );
+ if ( pSplit )
+ {
+ nCount = pSplit->GetValue();
+ if ( pHor )
+ bHorizontal = pHor->GetValue();
+ if ( pProp )
+ bProportional = pProp->GetValue();
+ }
+ else
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if( pFact )
+ {
+ const long nMaxVert = rSh.GetAnyCurRect( RECT_FRM ).Width() / MINLAY;
+ SvxAbstractSplittTableDialog* pDlg = pFact->CreateSvxSplittTableDialog( GetView().GetWindow(), rSh.IsTableVertical(), nMaxVert, 99 );
+ if( pDlg && (pDlg->Execute() == RET_OK) )
+ {
+ nCount = pDlg->GetCount();
+ bHorizontal = pDlg->IsHorizontal();
+ bProportional = pDlg->IsProportional();
+ rReq.AppendItem( SfxInt32Item( FN_TABLE_SPLIT_CELLS, nCount ) );
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bHorizontal ) );
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_2, bProportional ) );
+ }
+ delete pDlg;
+ }
+ }
+
+ if ( nCount>1 )
+ {
+ rSh.SplitTab(!bHorizontal, static_cast< USHORT >( nCount-1 ), bProportional );
+ bCallDone = TRUE;
+ }
+ else
+ rReq.Ignore();
+ }
+ break;
+
+ case FN_TABLE_SPLIT_TABLE:
+ {
+ SFX_REQUEST_ARG( rReq, pType, SfxUInt16Item, FN_PARAM_1, sal_False );
+ if( pType )
+ {
+ switch( pType->GetValue() )
+ {
+ case HEADLINE_NONE :
+ case HEADLINE_BORDERCOPY:
+ case HEADLINE_CNTNTCOPY:
+ case HEADLINE_BOXATTRCOPY:
+ case HEADLINE_BOXATRCOLLCOPY:
+ rSh.SplitTable(pType->GetValue()) ;
+ default: ;//wrong parameter, do nothing
+ }
+ }
+ else
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSplitTableDialog* pDlg = pFact->CreateSplitTblDialog( GetView().GetWindow(), rSh );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, pDlg->GetSplitMode() ) );
+ delete pDlg;
+ bCallDone = sal_True;
+ }
+ }
+ break;
+
+ case FN_TABLE_MERGE_TABLE:
+ {
+ BOOL bPrev = rSh.CanMergeTable( TRUE );
+ BOOL bNext = rSh.CanMergeTable( FALSE );
+
+ if( bPrev && bNext )
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+ VclAbstractDialog* pDlg = pFact->CreateSwVclDialog( DLG_MERGE_TABLE, GetView().GetWindow(), bPrev );
+ DBG_ASSERT(pDlg, "dialogdiet pDlg fail!");
+ if( RET_OK != pDlg->Execute())
+ bPrev = bNext = FALSE;
+ delete pDlg;
+ }
+
+ if( bPrev || bNext )
+ rSh.MergeTable( bPrev );
+ }
+ break;
+
+ case FN_TABLE_MODE_FIX :
+ case FN_TABLE_MODE_FIX_PROP :
+ case FN_TABLE_MODE_VARIABLE :
+ {
+ rSh.SetTblChgMode( ( FN_TABLE_MODE_FIX == nSlot ? TBLFIX_CHGABS
+ : FN_TABLE_MODE_FIX_PROP == nSlot
+ ? TBLFIX_CHGPROP
+ : TBLVAR_CHGABS ) );
+
+ SfxBindings& rBind = GetView().GetViewFrame()->GetBindings();
+ static USHORT __READONLY_DATA aInva[] =
+ { FN_TABLE_MODE_FIX,
+ FN_TABLE_MODE_FIX_PROP,
+ FN_TABLE_MODE_VARIABLE,
+ 0
+ };
+ rBind.Invalidate( aInva );
+ bCallDone = TRUE;
+ }
+ break;
+ case FN_TABLE_AUTOSUM:
+ {
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ pVFrame->GetDispatcher()->Execute(FN_EDIT_FORMULA, SFX_CALLMODE_SYNCHRON);
+ const USHORT nId = SwInputChild::GetChildWindowId();
+ SwInputChild* pChildWin = (SwInputChild*)pVFrame->
+ GetChildWindow( nId );
+ String sSum;
+ GetShell().GetAutoSum(sSum);
+ if( pChildWin )
+ pChildWin->SetFormula( sSum );
+
+ }
+ break;
+ case FN_TABLE_HEADLINE_REPEAT:
+ if(0 != rSh.GetRowsToRepeat())
+ rSh.SetRowsToRepeat( 0 );
+ else
+ rSh.SetRowsToRepeat(rSh.GetRowSelectionFromTop());
+ break;
+ case FN_TABLE_SELECT_CELL :
+ rSh.SelectTableCell();
+ break;
+ case FN_TABLE_DELETE_TABLE :
+ {
+ rSh.StartAction();
+ rSh.StartUndo();
+ rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(FN_TABLE_SELECT_ALL);
+ rSh.DeleteRow();
+ rSh.EndUndo();
+ rSh.EndAction();
+ }
+ //'this' is already destroyed
+ return;
+ //break;
+ default:
+ bMore = TRUE;
+ }
+
+ if ( !bMore )
+ {
+ if(bCallDone)
+ rReq.Done();
+ return;
+ }
+ else
+ bMore = FALSE;
+ //Jetzt die Slots, die direkt auf dem TableFmt arbeiten.
+ SwFrmFmt *pFmt = rSh.GetTableFmt();
+ switch ( nSlot )
+ {
+ case SID_ATTR_ULSPACE:
+ {
+ if(pItem)
+ {
+ SvxULSpaceItem aULSpace( *(const SvxULSpaceItem*)pItem );
+ aULSpace.SetWhich( RES_UL_SPACE );
+ ::lcl_SetAttr( rSh, aULSpace );
+ }
+ }
+ break;
+
+ case SID_ATTR_LRSPACE:
+ {
+ if(pItem)
+ {
+ SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE,
+ RES_HORI_ORIENT, RES_HORI_ORIENT, 0 );
+ SvxLRSpaceItem aLRSpace( *(const SvxLRSpaceItem*)pItem );
+ aLRSpace.SetWhich( RES_LR_SPACE );
+ aSet.Put( aLRSpace );
+ SwFmtHoriOrient aHori( pFmt->GetHoriOrient() );
+ aHori.SetHoriOrient( text::HoriOrientation::NONE );
+ aSet.Put( aLRSpace );
+ rSh.SetTblAttr( aSet );
+ }
+ }
+ break;
+// der letzte case-Zweig der noch einen TabellenManager braucht!!
+ case FN_TABLE_SET_COL_WIDTH:
+ {
+ SwTableFUNC aMgr( &rSh, FALSE);
+ aMgr.ColWidthDlg(GetView().GetWindow());
+ }
+ break;
+ case FN_TABLE_VERT_NONE:
+ case FN_TABLE_VERT_CENTER:
+ case FN_TABLE_VERT_BOTTOM:
+ {
+ USHORT nAlign = nSlot == FN_TABLE_VERT_NONE ?
+ text::VertOrientation::NONE :
+ nSlot == FN_TABLE_VERT_CENTER ?
+ text::VertOrientation::CENTER : text::VertOrientation::BOTTOM;
+ rSh.SetBoxAlign(nAlign);
+ bCallDone = TRUE;
+ }
+ break;
+
+ case SID_ATTR_PARA_SPLIT:
+ if ( pItem )
+ {
+ SwFmtLayoutSplit aSplit( ((const SvxFmtSplitItem*)pItem)->GetValue());
+ SfxItemSet aSet(GetPool(), RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT, 0 );
+ aSet.Put(aSplit);
+ rSh.SetTblAttr(aSet);
+ }
+ break;
+
+ case SID_ATTR_PARA_KEEP:
+ if ( pItem )
+ {
+ SvxFmtKeepItem aKeep( *(const SvxFmtKeepItem*)pItem );
+ aKeep.SetWhich( RES_KEEP );
+ SfxItemSet aSet(GetPool(), RES_KEEP, RES_KEEP, 0 );
+ aSet.Put(aKeep);
+ rSh.SetTblAttr(aSet);
+ }
+ break;
+ case FN_TABLE_ROW_SPLIT :
+ {
+ const SfxBoolItem* pBool = static_cast<const SfxBoolItem*>(pItem);
+ SwFmtRowSplit* pSplit = 0;
+ if(!pBool)
+ {
+ rSh.GetRowSplit(pSplit);
+ if(pSplit)
+ pSplit->SetValue(!pSplit->GetValue());
+ else
+ pSplit = new SwFmtRowSplit(TRUE);
+ }
+ else
+ {
+ pSplit = new SwFmtRowSplit(pBool->GetValue());
+ }
+ rSh.SetRowSplit( *pSplit );
+ delete pSplit;
+ }
+ break;
+
+ default:
+ ASSERT( !this, "falscher Dispatcher" );
+ return;
+ }
+ if(bCallDone)
+ rReq.Done();
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwTableShell::GetState(SfxItemSet &rSet)
+{
+ SfxWhichIter aIter( rSet );
+ SwWrtShell &rSh = GetShell();
+ SwFrmFmt *pFmt = rSh.GetTableFmt();
+ // os #124829# crash report: in case of an invalid shell selection return immediately
+ if(!pFmt)
+ return;
+ USHORT nSlot = aIter.FirstWhich();
+ while ( nSlot )
+ {
+ switch ( nSlot )
+ {
+ case FN_TABLE_MERGE_CELLS:
+ if ( !rSh.IsTableMode() )
+ rSet.DisableItem(FN_TABLE_MERGE_CELLS);
+ break;
+ case FN_TABLE_ADJUST_CELLS:
+ if ( !rSh.IsAdjustCellWidthAllowed() )
+ rSet.DisableItem(FN_TABLE_ADJUST_CELLS);
+ break;
+
+ case FN_TABLE_BALANCE_CELLS:
+ if ( !rSh.IsAdjustCellWidthAllowed(TRUE) )
+ rSet.DisableItem(FN_TABLE_BALANCE_CELLS);
+ break;
+
+ case FN_TABLE_BALANCE_ROWS:
+ if ( !rSh.BalanceRowHeight(TRUE) )
+ rSet.DisableItem(FN_TABLE_BALANCE_ROWS);
+ break;
+ case FN_OPTIMIZE_TABLE:
+ if ( !rSh.IsTableMode() &&
+ !rSh.IsAdjustCellWidthAllowed() &&
+ !rSh.IsAdjustCellWidthAllowed(TRUE) &&
+ !rSh.BalanceRowHeight(TRUE) )
+ rSet.DisableItem(FN_OPTIMIZE_TABLE);
+ break;
+ case SID_INSERT_DIAGRAM:
+ {
+ SvtModuleOptions aMOpt;
+ if ( !aMOpt.IsMath() || rSh.IsTblComplexForChart() )
+ rSet.DisableItem(nSlot);
+ }
+ break;
+
+ case FN_INSERT_TABLE:
+ // Irgendeinen Wert "putten", damit Controller enabled bleibt.
+ // Statt "Insert:Table" erscheint dann "Format:Table".
+// rSet.Put(SfxUInt16Item(nSlot, 1));
+ break;
+
+ case FN_TABLE_OPTIMAL_HEIGHT:
+ {
+ //Disablen wenn bereits auto-Hoehe eingestellt ist.
+ SwFmtFrmSize *pSz;
+ rSh.GetRowHeight( pSz );
+ if ( pSz )
+ {
+ if ( ATT_VAR_SIZE == pSz->GetHeightSizeType() )
+ rSet.DisableItem( nSlot );
+ delete pSz;
+ }
+ }
+ break;
+ case FN_TABLE_INSERT_ROW:
+ case FN_TABLE_INSERT_ROW_DLG:
+ {
+ if ( rSh.IsInRepeatedHeadline() )
+ rSet.DisableItem( nSlot );
+ }
+ break;
+ case RES_LR_SPACE:
+ rSet.Put(pFmt->GetLRSpace());
+ break;
+ case RES_UL_SPACE:
+ rSet.Put(pFmt->GetULSpace());
+ break;
+ case FN_TABLE_VERT_NONE:
+ case FN_TABLE_VERT_CENTER:
+ case FN_TABLE_VERT_BOTTOM:
+ {
+ USHORT nAlign = rSh.GetBoxAlign();
+ BOOL bSet = (nSlot == FN_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE) ||
+ (nSlot == FN_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER) ||
+ (nSlot == FN_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM);
+ rSet.Put(SfxBoolItem(nSlot, bSet));
+ }
+ break;
+
+ case FN_TABLE_MODE_FIX :
+ case FN_TABLE_MODE_FIX_PROP :
+ case FN_TABLE_MODE_VARIABLE :
+ {
+ TblChgMode nMode = rSh.GetTblChgMode();
+ BOOL bSet = (nSlot == FN_TABLE_MODE_FIX && nMode == TBLFIX_CHGABS) ||
+ (nSlot == FN_TABLE_MODE_FIX_PROP && nMode == TBLFIX_CHGPROP) ||
+ (nSlot == FN_TABLE_MODE_VARIABLE && nMode == TBLVAR_CHGABS);
+ rSet.Put(SfxBoolItem(nSlot, bSet));
+ }
+ break;
+
+ case SID_ATTR_PARA_SPLIT:
+ rSet.Put( pFmt->GetKeep() );
+ break;
+
+ case SID_ATTR_PARA_KEEP:
+ rSet.Put( pFmt->GetLayoutSplit() );
+ break;
+ case FN_TABLE_SPLIT_TABLE:
+ {
+ if ( rSh.IsInHeadline() )
+ rSet.DisableItem( nSlot );
+ }
+ break;
+ case FN_TABLE_MERGE_TABLE:
+ {
+ BOOL bAsk;
+ if( !rSh.CanMergeTable( TRUE, &bAsk ))
+ rSet.DisableItem( nSlot );
+ }
+ break;
+
+ case FN_TABLE_DELETE_ROW:
+ {
+ SwSelBoxes aBoxes;
+ ::GetTblSel( rSh, aBoxes, nsSwTblSearchType::TBLSEARCH_ROW );
+ if( ::HasProtectedCells( aBoxes ))
+ rSet.DisableItem( nSlot );
+ }
+ break;
+ case FN_TABLE_DELETE_COL:
+ {
+ SwSelBoxes aBoxes;
+ ::GetTblSel( rSh, aBoxes, nsSwTblSearchType::TBLSEARCH_COL );
+ if( ::HasProtectedCells( aBoxes ))
+ rSet.DisableItem( nSlot );
+ }
+ break;
+
+ case FN_TABLE_UNSET_READ_ONLY_CELLS:
+ // disable in readonly sections, but enable in protected cells
+ if( !rSh.CanUnProtectCells() )
+ rSet.DisableItem( nSlot );
+ break;
+ case RES_ROW_SPLIT:
+ {
+ const SwFmtLayoutSplit& rTabSplit = pFmt->GetLayoutSplit();
+ if ( 0 == rTabSplit.GetValue() )
+ {
+ rSet.DisableItem( nSlot );
+ }
+ else
+ {
+ SwFmtRowSplit* pSplit = 0;
+ rSh.GetRowSplit(pSplit);
+ if(pSplit)
+ rSet.Put(*pSplit);
+ else
+ rSet.InvalidateItem( nSlot );
+ delete pSplit;
+ }
+ }
+ break;
+ case FN_TABLE_HEADLINE_REPEAT:
+ if(0 != rSh.GetRowsToRepeat())
+ rSet.Put(SfxBoolItem(nSlot, sal_True));
+ else if(!rSh.GetRowSelectionFromTop())
+ rSet.DisableItem( nSlot );
+ else
+ rSet.Put(SfxBoolItem(nSlot, sal_False));
+ break;
+ case FN_TABLE_SELECT_CELL :
+ if(rSh.HasBoxSelection())
+ rSet.DisableItem( nSlot );
+ break;
+ }
+ nSlot = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwTableShell::SwTableShell(SwView &_rView) :
+ SwBaseShell(_rView)
+{
+ SetName(String::CreateFromAscii("Table"));
+ SetHelpId(SW_TABSHELL);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwTableShell::GetFrmBorderState(SfxItemSet &rSet)
+{
+ SfxItemSet aCoreSet( GetPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
+ SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+ aCoreSet.Put( aBoxInfo );
+ GetShell().GetTabBorders( aCoreSet );
+ rSet.Put( aCoreSet );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwTableShell::ExecTableStyle(SfxRequest& rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ if(pArgs)
+ switch ( rReq.GetSlot() )
+ {
+ case SID_FRAME_LINESTYLE:
+ case SID_FRAME_LINECOLOR:
+ {
+/* Tabellenselektion ist abgeschafft
+ BOOL bPopCrsr = FALSE;
+ if ( !rReq.IsAPI() )
+ {
+ //Keine Tabellenselektion -> Aenderung wird auf die gesamte
+ //Tabelle.
+ if ( !rSh.IsTableMode() )
+ {
+ bPopCrsr = TRUE;
+ rSh.Push();
+ rSh.StartAction();
+ rSh.EnterStdMode();
+ rSh.MoveTable( fnTableCurr, fnTableStart );
+ rSh.SttSelect();
+ rSh.MoveTable( fnTableCurr, fnTableEnd );
+ rSh.EndSelect();
+ }
+ }*/
+ if ( rReq.GetSlot() == SID_FRAME_LINESTYLE )
+ {
+ const SvxLineItem &rLineItem = (const SvxLineItem&)pArgs->
+ Get( SID_FRAME_LINESTYLE );
+ const SvxBorderLine* pBorderLine = rLineItem.GetLine();
+ rSh.SetTabLineStyle( 0, TRUE, pBorderLine);
+ }
+ else
+ {
+ const SvxColorItem &rNewColorItem = (const SvxColorItem&)pArgs->
+ Get( SID_FRAME_LINECOLOR );
+ rSh.SetTabLineStyle( &rNewColorItem.GetValue() );
+ }
+
+ rReq.Done();
+/* if ( bPopCrsr )
+ {
+ rSh.KillPams();
+ rSh.Pop(FALSE);
+ rSh.EndAction();
+ }*/
+ break;
+ }
+ }
+}
+
+
+void SwTableShell::GetLineStyleState(SfxItemSet &rSet)
+{
+ SfxItemSet aCoreSet( GetPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0);
+ SvxBoxInfoItem aCoreInfo( SID_ATTR_BORDER_INNER );
+ aCoreSet.Put(aCoreInfo);
+ GetShell().GetTabBorders( aCoreSet );
+
+ const SvxBoxItem& rBoxItem = (const SvxBoxItem&)aCoreSet.Get( RES_BOX );
+ const SvxBorderLine* pLine = rBoxItem.GetTop();
+
+ rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) );
+ SvxLineItem aLine( SID_FRAME_LINESTYLE );
+ aLine.SetLine(pLine);
+ rSet.Put( aLine );
+}
+
+void SwTableShell::ExecNumberFormat(SfxRequest& rReq)
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ SwWrtShell &rSh = GetShell();
+
+ //Erstmal die Slots, die keinen FrmMgr benoetigen.
+ const SfxPoolItem* pItem = 0;
+ USHORT nSlot = rReq.GetSlot();
+ if(pArgs)
+ pArgs->GetItemState(GetPool().GetWhich(nSlot), FALSE, &pItem);
+
+ // Sprache immer von Cursorposition besorgen
+ LanguageType eLang = rSh.GetCurLang();
+ SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
+ sal_uInt32 nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
+ USHORT nFmtType = 0, nOffset = 0;
+
+ switch ( nSlot )
+ {
+ case FN_NUMBER_FORMAT:
+ if( pItem )
+ {
+ // Index fuer String bestimmen
+ String aCode( ((const SfxStringItem*)pItem)->GetValue() );
+ nNumberFormat = pFormatter->GetEntryKey( aCode, eLang );
+ if( NUMBERFORMAT_ENTRY_NOT_FOUND == nNumberFormat )
+ {
+ // neu eintragen
+ xub_StrLen nErrPos;
+ short nType;
+ if( !pFormatter->PutEntry( aCode, nErrPos, nType,
+ nNumberFormat, eLang ))
+ nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
+ }
+ }
+ break;
+ case FN_NUMBER_STANDARD: nFmtType = NUMBERFORMAT_NUMBER; break;
+ case FN_NUMBER_SCIENTIFIC: nFmtType = NUMBERFORMAT_SCIENTIFIC; break;
+ case FN_NUMBER_DATE: nFmtType = NUMBERFORMAT_DATE; break;
+ case FN_NUMBER_TIME: nFmtType = NUMBERFORMAT_TIME; break;
+ case FN_NUMBER_CURRENCY: nFmtType = NUMBERFORMAT_CURRENCY; break;
+ case FN_NUMBER_PERCENT: nFmtType = NUMBERFORMAT_PERCENT; break;
+
+ case FN_NUMBER_TWODEC: // #.##0,00
+ nFmtType = NUMBERFORMAT_NUMBER;
+ nOffset = NF_NUMBER_1000DEC2;
+ break;
+
+ default:
+ ASSERT(FALSE, falscher Dispatcher);
+ return;
+ }
+
+ if( nFmtType )
+ nNumberFormat = pFormatter->GetStandardFormat( nFmtType, eLang ) + nOffset;
+
+ if( NUMBERFORMAT_ENTRY_NOT_FOUND != nNumberFormat )
+ {
+ SfxItemSet aBoxSet( GetPool(), RES_BOXATR_FORMAT, RES_BOXATR_FORMAT );
+ aBoxSet.Put( SwTblBoxNumFormat( nNumberFormat ));
+ rSh.SetTblBoxFormulaAttrs( aBoxSet );
+ }
+
+}
+
diff --git a/sw/source/ui/shells/textdrw.cxx b/sw/source/ui/shells/textdrw.cxx
new file mode 100644
index 000000000000..e4d1bc817940
--- /dev/null
+++ b/sw/source/ui/shells/textdrw.cxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <svx/svdview.hxx>
+#include <tools/urlobj.hxx>
+#include <svx/fmglob.hxx>
+#include <svx/svdouno.hxx>
+#include <com/sun/star/form/FormButtonType.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <edtwin.hxx>
+#include <swundo.hxx>
+#include <basesh.hxx>
+
+#ifndef _POOLFMT_HRC
+#include <poolfmt.hrc>
+#endif
+
+#include <docsh.hxx>
+#include <sfx2/docfile.hxx>
+#include <svl/urihelper.hxx>
+#include <avmedia/mediawindow.hxx>
+
+#include <unomid.h>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+/*---------------------------------------------------------------------------
+ Beschreibung:
+ ----------------------------------------------------------------------------*/
+
+void SwBaseShell::InsertURLButton(const String& rURL, const String& rTarget, const String& rTxt)
+{
+ SwWrtShell& rSh = GetShell();
+
+ if (!rSh.HasDrawView())
+ rSh.MakeDrawView();
+ SdrView *pSdrView = rSh.GetDrawView();
+
+ // OBJ_FM_BUTTON
+ pSdrView->SetDesignMode(TRUE);
+ pSdrView->SetCurrentObj(OBJ_FM_BUTTON);
+ pSdrView->SetEditMode(sal_False);
+
+ Point aStartPos(rSh.GetCharRect().Pos() + Point(0, 1));
+
+ rSh.StartAction();
+ rSh.StartUndo( UNDO_UI_INSERT_URLBTN );
+ if (rSh.BeginCreate(OBJ_FM_BUTTON, FmFormInventor, aStartPos))
+ {
+ pSdrView->SetOrtho(sal_False);
+ Size aSz(GetView().GetEditWin().PixelToLogic(Size(140, 20)));
+ Point aEndPos(aSz.Width(), aSz.Height());
+
+ rSh.MoveCreate(aStartPos + aEndPos);
+ rSh.EndCreate(SDRCREATE_FORCEEND);
+
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ if (rMarkList.GetMark(0))
+ {
+ SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj());
+ uno::Reference< awt::XControlModel > xControlModel = pUnoCtrl->GetUnoControlModel();
+
+ ASSERT( xControlModel.is(), "UNO-Control ohne Model" );
+ if( !xControlModel.is() )
+ return;
+
+ uno::Reference< beans::XPropertySet > xPropSet(xControlModel, uno::UNO_QUERY);
+
+
+ uno::Any aTmp;
+
+ aTmp <<= OUString(rTxt);
+ xPropSet->setPropertyValue( C2U("Label"), aTmp );
+
+ SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium();
+ INetURLObject aAbs;
+ if( pMedium )
+ aAbs = pMedium->GetURLObject();
+
+ aTmp <<= OUString(URIHelper::SmartRel2Abs(aAbs, rURL));
+ xPropSet->setPropertyValue( C2U("TargetURL"), aTmp );
+
+ if( rTarget.Len() )
+ {
+ aTmp <<= OUString(rTarget);
+ xPropSet->setPropertyValue( C2U("TargetFrame"), aTmp );
+ }
+
+
+ form::FormButtonType eButtonType = form::FormButtonType_URL;
+ aTmp.setValue( &eButtonType, ::getCppuType((const form::FormButtonType*)0));
+ xPropSet->setPropertyValue( C2U("ButtonType"), aTmp );
+
+ if ( ::avmedia::MediaWindow::isMediaURL( rURL ) )
+ {
+ // #105638# OJ
+ aTmp <<= sal_True;
+ xPropSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DispatchURLInternal" )), aTmp );
+ }
+ }
+
+ if (rSh.IsObjSelected())
+ {
+ rSh.UnSelectFrm();
+ }
+ }
+ rSh.EndUndo( UNDO_UI_INSERT_URLBTN );
+ rSh.EndAction();
+}
+
+
diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx
new file mode 100644
index 000000000000..5ac611fed854
--- /dev/null
+++ b/sw/source/ui/shells/textfld.cxx
@@ -0,0 +1,894 @@
+/************ *************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <crsskip.hxx>
+#include <hintids.hxx> //_immer_ vor den solar-Items
+
+#include <sfx2/lnkbase.hxx>
+#include <fmtfld.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/itempool.hxx>
+#include <unotools/useroptions.hxx>
+#include <svl/whiter.hxx>
+#include <svl/eitem.hxx>
+#include <svl/macitem.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/request.hxx>
+#include <svx/postattr.hxx>
+#include <svx/hlnkitem.hxx>
+
+#include <svx/svxdlg.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <sfx2/dispatch.hxx>
+#include <fmtinfmt.hxx>
+#include <fldwrap.hxx>
+#include <redline.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <basesh.hxx>
+#include <wrtsh.hxx>
+#include <flddat.hxx>
+#include <numrule.hxx>
+#include <textsh.hxx>
+#include <docsh.hxx>
+#include <docufld.hxx>
+#include <usrfld.hxx>
+#include <ddefld.hxx>
+#include <expfld.hxx>
+#include <fldmgr.hxx>
+#include <uitool.hxx>
+
+#include <cmdid.h>
+#include <shells.hrc>
+
+#include <sfx2/app.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include "swabstdlg.hxx"
+#include "dialog.hrc"
+#include <fldui.hrc>
+#include <doc.hxx>
+
+#include <app.hrc>
+
+#include <PostItMgr.hxx>
+
+using namespace nsSwDocInfoSubType;
+
+
+extern BOOL bNoInterrupt; // in mainwn.cxx
+
+String& lcl_AppendRedlineStr( String& rStr, USHORT nRedlId )
+{
+ USHORT nResId = 0;
+ switch( nRedlId )
+ {
+ case nsRedlineType_t::REDLINE_INSERT: nResId = STR_REDLINE_INSERTED; break;
+ case nsRedlineType_t::REDLINE_DELETE: nResId = STR_REDLINE_DELETED; break;
+ case nsRedlineType_t::REDLINE_FORMAT: nResId = STR_REDLINE_FORMATED; break;
+ case nsRedlineType_t::REDLINE_TABLE: nResId = STR_REDLINE_TABLECHG; break;
+ case nsRedlineType_t::REDLINE_FMTCOLL: nResId = STR_REDLINE_FMTCOLLSET; break;
+ }
+ if( nResId )
+ rStr += SW_RESSTR( nResId );
+ return rStr;
+}
+
+// STATIC DATA -----------------------------------------------------------
+
+void SwTextShell::ExecField(SfxRequest &rReq)
+{
+ SwWrtShell& rSh = GetShell();
+ const SfxPoolItem* pItem = 0;
+
+ USHORT nSlot = rReq.GetSlot();
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ if(pArgs)
+ pArgs->GetItemState(GetPool().GetWhich(nSlot), FALSE, &pItem);
+
+ Window *pMDI = &GetView().GetViewFrame()->GetWindow();
+ BOOL bMore = FALSE;
+ BOOL bIsText = TRUE;
+ USHORT nInsertType = 0;
+ USHORT nInsertSubType = 0;
+ ULONG nInsertFormat = 0;
+
+ switch(nSlot)
+ {
+ case FN_EDIT_FIELD:
+ {
+ SwField* pFld = rSh.GetCurFld();
+ if( pFld )
+ {
+ switch ( pFld->GetTypeId() )
+ {
+ case TYP_DDEFLD:
+ {
+ ::sfx2::SvBaseLink& rLink = ((SwDDEFieldType*)pFld->GetTyp())->
+ GetBaseLink();
+ if(rLink.IsVisible())
+ {
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractLinksDialog* pDlg = pFact->CreateLinksDialog( pMDI, &rSh.GetLinkManager(), FALSE, &rLink );
+ if ( pDlg )
+ {
+ pDlg->Execute();
+ delete pDlg;
+ }
+ }
+ break;
+ }
+ default:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ SfxAbstractDialog* pDlg = pFact->CreateSwFldEditDlg( GetView(),RC_DLG_SWFLDEDITDLG );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ }
+ }
+ }
+ break;
+ }
+ case FN_EXECUTE_MACROFIELD:
+ {
+ SwField* pFld = rSh.GetCurFld();
+ if(pFld && pFld->GetTyp()->Which() == RES_MACROFLD)
+ {
+
+ const String& rMacro = ((SwMacroField*)pFld)->GetMacro();
+ USHORT nPos = rMacro.Search('.', 0);
+ if(nPos != STRING_NOTFOUND)
+ {
+ SvxMacro aMacro( rMacro.Copy(nPos + 1), rMacro.Copy(0,nPos), STARBASIC );
+ rSh.ExecMacro(aMacro);
+ }
+ }
+ }
+ break;
+
+ case FN_GOTO_NEXT_INPUTFLD:
+ case FN_GOTO_PREV_INPUTFLD:
+ {
+ BOOL bRet = FALSE;
+ SwFieldType* pFld = rSh.GetFldType( 0, RES_INPUTFLD );
+ if( pFld && rSh.MoveFldType( pFld,
+ FN_GOTO_NEXT_INPUTFLD == nSlot ))
+ {
+ rSh.ClearMark();
+ rSh.StartInputFldDlg( rSh.GetCurFld(), FALSE );
+ bRet = TRUE;
+ }
+
+ rReq.SetReturnValue( SfxBoolItem( nSlot, bRet ));
+ }
+ break;
+
+ default:
+ bMore = TRUE;
+ }
+ if(bMore)
+ {
+ // hier kommen die Slots mit FldMgr
+ SwFldMgr aFldMgr(GetShellPtr());
+ switch(nSlot)
+ {
+ case FN_INSERT_DBFIELD:
+ {
+ BOOL bRes = FALSE;
+ if( pItem )
+ {
+ ULONG nFormat = 0;
+ USHORT nType = 0;
+ String aPar1 = ((SfxStringItem *)pItem)->GetValue();
+ String aPar2;
+ sal_Int32 nCommand = 0;
+
+ if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE,
+ FALSE, &pItem ))
+ nType = ((SfxUInt16Item *)pItem)->GetValue();
+ aPar1 += DB_DELIM;
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_1, FALSE, &pItem ))
+ {
+ aPar1 += ((SfxStringItem *)pItem)->GetValue();
+ }
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_3, FALSE, &pItem ))
+ nCommand = ((SfxInt32Item*)pItem)->GetValue();
+ aPar1 += DB_DELIM;
+ aPar1 += String::CreateFromInt32(nCommand);
+ aPar1 += DB_DELIM;
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_2, FALSE, &pItem ))
+ {
+ aPar1 += ((SfxStringItem *)pItem)->GetValue();
+ }
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_FIELD_CONTENT, FALSE, &pItem ))
+ aPar2 = ((SfxStringItem *)pItem)->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_FIELD_FORMAT, FALSE, &pItem ))
+ nFormat = ((SfxUInt32Item *)pItem)->GetValue();
+ DBG_WARNING("Command is not yet used");
+ sal_Unicode cSeparator = ' ';
+ SwInsertFld_Data aData(nType, 0, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator );
+ bRes = aFldMgr.InsertFld(aData);
+ }
+ rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
+ }
+ break;
+ case FN_INSERT_FIELD_CTRL:
+ case FN_INSERT_FIELD:
+ {
+ BOOL bRes = FALSE;
+ if( pItem && nSlot != FN_INSERT_FIELD_CTRL)
+ {
+ ULONG nFormat = 0;
+ USHORT nType = 0;
+ USHORT nSubType = 0;
+ String aPar1 = ((SfxStringItem *)pItem)->GetValue();
+ String aPar2;
+ sal_Unicode cSeparator = ' ';
+
+ if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE,
+ FALSE, &pItem ))
+ nType = ((SfxUInt16Item *)pItem)->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_SUBTYPE,
+ FALSE, &pItem ))
+ nSubType = ((SfxUInt16Item *)pItem)->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_FIELD_CONTENT, FALSE, &pItem ))
+ aPar2 = ((SfxStringItem *)pItem)->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_FIELD_FORMAT, FALSE, &pItem ))
+ nFormat = ((SfxUInt32Item *)pItem)->GetValue();
+ if( SFX_ITEM_SET == pArgs->GetItemState(
+ FN_PARAM_3, FALSE, &pItem ))
+ {
+ String sTmp = ((SfxStringItem *)pItem)->GetValue();
+ if(sTmp.Len())
+ cSeparator = sTmp.GetChar(0);
+ }
+ SwInsertFld_Data aData(nType, nSubType, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator );
+ bRes = aFldMgr.InsertFld( aData );
+ }
+ else
+ //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
+ if(!GetView().GetViewFrame()->IsInModalMode())
+ {
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ pVFrame->ToggleChildWindow(FN_INSERT_FIELD);
+ bRes = pVFrame->GetChildWindow( nSlot ) != 0;
+ Invalidate(rReq.GetSlot());
+ Invalidate(FN_INSERT_FIELD_CTRL);
+ rReq.Ignore();
+ }
+ rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
+ }
+ break;
+
+ case FN_INSERT_REF_FIELD:
+ {
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ if (!pVFrame->HasChildWindow(FN_INSERT_FIELD))
+ pVFrame->ToggleChildWindow(FN_INSERT_FIELD); // Dialog anzeigen
+
+ // Flddlg auf neue TabPage umschalten
+ USHORT nId = SwFldDlgWrapper::GetChildWindowId();
+ SwFldDlgWrapper *pWrp = (SwFldDlgWrapper*)pVFrame->GetChildWindow(nId);
+ if (pWrp)
+ pWrp->ShowPage();
+ rReq.Ignore();
+ }
+ break;
+ case FN_DELETE_COMMENT:
+ if ( GetView().GetPostItMgr() &&
+ GetView().GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ GetView().GetPostItMgr()->DeleteActiveSidebarWin();
+ }
+ break;
+ case FN_DELETE_ALL_NOTES:
+ if ( GetView().GetPostItMgr() )
+ GetView().GetPostItMgr()->Delete();
+ break;
+ case FN_DELETE_NOTE_AUTHOR:
+ {
+ SFX_REQUEST_ARG( rReq, pNoteItem, SfxStringItem, nSlot, FALSE);
+ if ( pNoteItem && GetView().GetPostItMgr() )
+ GetView().GetPostItMgr()->Delete( pNoteItem->GetValue() );
+ }
+ break;
+ case FN_HIDE_NOTE:
+ if ( GetView().GetPostItMgr() &&
+ GetView().GetPostItMgr()->HasActiveSidebarWin() )
+ {
+ GetView().GetPostItMgr()->HideActiveSidebarWin();
+ }
+ break;
+ case FN_HIDE_ALL_NOTES:
+ if ( GetView().GetPostItMgr() )
+ GetView().GetPostItMgr()->Hide();
+ break;
+ case FN_HIDE_NOTE_AUTHOR:
+ {
+ SFX_REQUEST_ARG( rReq, pNoteItem, SfxStringItem, nSlot, FALSE);
+ if ( pNoteItem && GetView().GetPostItMgr() )
+ GetView().GetPostItMgr()->Hide( pNoteItem->GetValue() );
+ }
+ break;
+ case FN_POSTIT:
+ {
+ SwPostItField* pPostIt = (SwPostItField*)aFldMgr.GetCurFld();
+ BOOL bNew = !(pPostIt && pPostIt->GetTyp()->Which() == RES_POSTITFLD);
+ if (bNew || GetView().GetPostItMgr()->IsAnswer())
+ {
+ SvtUserOptions aUserOpt;
+ String sAuthor;
+ if( !(sAuthor = aUserOpt.GetFullName()).Len())
+ if( !(sAuthor = aUserOpt.GetID()).Len() )
+ sAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
+ if( rSh.HasSelection() )
+ {
+ rSh.NormalizePam(true);
+ rSh.KillPams();
+ rSh.ClearMark();
+ }
+ SwInsertFld_Data aData(TYP_POSTITFLD, 0, sAuthor, aEmptyStr, 0);
+ aFldMgr.InsertFld(aData);
+ rSh.Push();
+ rSh.SwCrsrShell::Left(1, CRSR_SKIP_CHARS, FALSE);
+ pPostIt = (SwPostItField*)aFldMgr.GetCurFld();
+ rSh.Pop(FALSE); // Cursorpos restaurieren
+ }
+
+ if (pPostIt)
+ {
+ SwFieldType* pType = rSh.GetDoc()->GetFldType(RES_POSTITFLD, aEmptyStr,false);
+ SwClientIter aIter( *pType );
+ SwClient* pFirst = aIter.GoStart();
+ while( pFirst )
+ {
+ SwFmtFld* pSwFmtFld = static_cast<SwFmtFld*>(pFirst);
+ if ( pSwFmtFld->GetFld() == pPostIt )
+ {
+ pSwFmtFld->Broadcast( SwFmtFldHint( 0, SWFMTFLD_FOCUS, &GetView() ) );
+ break;
+ }
+ pFirst = aIter++;
+ }
+ }
+ }
+ break;
+ case FN_REDLINE_COMMENT:
+ {
+ /* this code can be used once we want redline comments in the margin, all other stuff can
+ then be deleted
+ String sComment;
+ const SwRedline *pRedline = rSh.GetCurrRedline();
+
+ if (pRedline)
+ {
+ sComment = pRedline->GetComment();
+ if ( sComment == String(rtl::OUString::createFromAscii("")) )
+ GetView().GetDocShell()->Broadcast(SwRedlineHint(pRedline,SWREDLINE_INSERTED));
+ const_cast<SwRedline*>(pRedline)->Broadcast(SwRedlineHint(pRedline,SWREDLINE_FOCUS,&GetView()));
+ }
+ */
+
+ String sComment;
+ const SwRedline *pRedline = rSh.GetCurrRedline();
+
+ if (pRedline)
+ {
+ sComment = pRedline->GetComment();
+
+
+ BOOL bTravel = FALSE;
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc( RID_SVXDLG_POSTIT );
+ DBG_ASSERT(fnGetRange, "Dialogdiet fail! GetRanges()");
+ SfxItemSet aSet(GetPool(), fnGetRange());
+ aSet.Put(SvxPostItTextItem(sComment.ConvertLineEnd(), SID_ATTR_POSTIT_TEXT));
+ aSet.Put(SvxPostItAuthorItem(pRedline->GetAuthorString(), SID_ATTR_POSTIT_AUTHOR));
+
+ aSet.Put( SvxPostItDateItem( GetAppLangDateTimeString(
+ pRedline->GetRedlineData().GetTimeStamp() ),
+ SID_ATTR_POSTIT_DATE ));
+
+ // Traveling nur bei mehr als einem Feld
+ rSh.StartAction();
+
+ rSh.Push();
+ const SwRedline *pActRed = rSh.SelPrevRedline();
+
+ if (pActRed == pRedline)
+ { // Neuer Cursor steht am Anfang des Current Redlines
+ rSh.Pop(); // Alten Cursor wegwerfen
+ rSh.Push();
+ pActRed = rSh.SelPrevRedline();
+ }
+
+ BOOL bPrev = pActRed != 0;
+ rSh.Pop(FALSE);
+ rSh.EndAction();
+
+ rSh.ClearMark();
+ rSh.SelNextRedline(); // Aktueller Redline wird selektiert
+
+ rSh.StartAction();
+ rSh.Push();
+ pActRed = rSh.SelNextRedline();
+ BOOL bNext = pActRed != 0;
+ rSh.Pop(FALSE); // Cursorpos restaurieren
+
+ if( rSh.IsCrsrPtAtEnd() )
+ rSh.SwapPam();
+
+ rSh.EndAction();
+
+ bTravel |= bNext|bPrev;
+
+ SvxAbstractDialogFactory* pFact2 = SvxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact2, "Dialogdiet fail!");
+ AbstractSvxPostItDialog* pDlg = pFact2->CreateSvxPostItDialog( pMDI, aSet, bTravel, TRUE );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->HideAuthor();
+
+ String sTitle(SW_RES(STR_REDLINE_COMMENT));
+ ::lcl_AppendRedlineStr( sTitle, pRedline->GetType() );
+
+ pDlg->SetText(sTitle);
+
+ if (bTravel)
+ {
+ pDlg->EnableTravel(bNext, bPrev);
+ pDlg->SetPrevHdl(LINK(this, SwTextShell, RedlinePrevHdl));
+ pDlg->SetNextHdl(LINK(this, SwTextShell, RedlineNextHdl));
+ }
+
+ rSh.SetCareWin(pDlg->GetWindow());
+ bNoInterrupt = TRUE;
+
+ if ( pDlg->Execute() == RET_OK )
+ {
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ String sMsg(((const SvxPostItTextItem&)pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue());
+
+ // Kommentar einfuegen bzw aendern
+ rSh.SetRedlineComment(sMsg);
+ }
+
+ delete pDlg;
+ rSh.SetCareWin(NULL);
+ bNoInterrupt = FALSE;
+ rSh.ClearMark();
+ GetView().AttrChangedNotify(GetShellPtr());
+ }
+ }
+ break;
+
+ case FN_JAVAEDIT:
+ {
+ String aType, aText;
+ BOOL bIsUrl=FALSE;
+ BOOL bNew=FALSE, bUpdate=FALSE;
+ SwFldMgr* pMgr = new SwFldMgr;
+ if ( pItem )
+ {
+ aText = ((SfxStringItem*)pItem)->GetValue();
+ SFX_REQUEST_ARG( rReq, pType, SfxStringItem, FN_PARAM_2 , sal_False );
+ SFX_REQUEST_ARG( rReq, pIsUrl, SfxBoolItem, FN_PARAM_1 , sal_False );
+ if ( pType )
+ aType = pType->GetValue();
+ if ( pIsUrl )
+ bIsUrl = pIsUrl->GetValue();
+
+ SwScriptField* pFld = (SwScriptField*)pMgr->GetCurFld();
+ bNew = !pFld || !(pFld->GetTyp()->Which() == RES_SCRIPTFLD);
+ bUpdate = pFld && ( bIsUrl != pFld->GetFormat() || pFld->GetPar2() != aType || pFld->GetPar1() != aText );
+ }
+ else
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractJavaEditDialog* pDlg = pFact->CreateJavaEditDialog( DLG_JAVAEDIT,
+ pMDI, &rSh);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if ( pDlg->Execute() )
+ {
+ aType = pDlg->GetType();
+ aText = pDlg->GetText();
+ bIsUrl = pDlg->IsUrl();
+ bNew = pDlg->IsNew();
+ bUpdate = pDlg->IsUpdate();
+ rReq.AppendItem( SfxStringItem( FN_JAVAEDIT, aText ) );
+ rReq.AppendItem( SfxStringItem( FN_PARAM_2, aType ) );
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bIsUrl ) );
+ }
+
+ delete pDlg;
+ }
+
+ if( bNew )
+ {
+ SwInsertFld_Data aData(TYP_SCRIPTFLD, 0, aType, aText, bIsUrl);
+ pMgr->InsertFld(aData);
+ rReq.Done();
+ }
+ else if( bUpdate )
+ {
+ pMgr->UpdateCurFld( bIsUrl, aType, aText );
+ rSh.SetUndoNoResetModified();
+ rReq.Done();
+ }
+ else
+ rReq.Ignore();
+ }
+ break;
+
+ case FN_INSERT_FLD_DATE :
+ nInsertType = TYP_DATEFLD;
+ bIsText = FALSE;
+ goto FIELD_INSERT;
+ case FN_INSERT_FLD_TIME :
+ nInsertType = TYP_TIMEFLD;
+ bIsText = FALSE;
+ goto FIELD_INSERT;
+ case FN_INSERT_FLD_PGNUMBER:
+ nInsertType = TYP_PAGENUMBERFLD;
+ nInsertFormat = SVX_NUM_PAGEDESC; // wie Seitenvorlage
+ bIsText = FALSE;
+ goto FIELD_INSERT;
+ case FN_INSERT_FLD_PGCOUNT :
+ nInsertType = TYP_DOCSTATFLD;
+ nInsertSubType = 0;
+ bIsText = FALSE;
+ nInsertFormat = SVX_NUM_PAGEDESC;
+ goto FIELD_INSERT;
+ case FN_INSERT_FLD_TOPIC :
+ nInsertType = TYP_DOCINFOFLD;
+ nInsertSubType = DI_THEMA;
+ goto FIELD_INSERT;
+ case FN_INSERT_FLD_TITLE :
+ nInsertType = TYP_DOCINFOFLD;
+ nInsertSubType = DI_TITEL;
+ goto FIELD_INSERT;
+ case FN_INSERT_FLD_AUTHOR :
+ nInsertType = TYP_DOCINFOFLD;
+ nInsertSubType = DI_CREATE|DI_SUB_AUTHOR;
+
+FIELD_INSERT:
+ {
+ //format conversion should only be done for number formatter formats
+ if(!nInsertFormat)
+ nInsertFormat = aFldMgr.GetDefaultFormat(nInsertType, bIsText, rSh.GetNumberFormatter());
+ SwInsertFld_Data aData(nInsertType, nInsertSubType,
+ aEmptyStr, aEmptyStr, nInsertFormat);
+ aFldMgr.InsertFld(aData);
+ rReq.Done();
+ }
+ break;
+ default:
+ ASSERT(FALSE, falscher Dispatcher);
+ return;
+ }
+ }
+}
+
+void SwTextShell::StateField( SfxItemSet &rSet )
+{
+ SwWrtShell& rSh = GetShell();
+ SfxWhichIter aIter( rSet );
+ const SwField* pField = 0;
+ int bGetField = FALSE;
+ USHORT nWhich = aIter.FirstWhich();
+
+ while (nWhich)
+ {
+ switch (nWhich)
+ {
+ case FN_DELETE_COMMENT:
+ case FN_DELETE_NOTE_AUTHOR:
+ case FN_DELETE_ALL_NOTES:
+ case FN_HIDE_NOTE:
+ case FN_HIDE_NOTE_AUTHOR:
+ case FN_HIDE_ALL_NOTES:
+ {
+ SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
+ if ( !pPostItMgr )
+ rSet.InvalidateItem( nWhich );
+ else if ( !pPostItMgr->HasActiveSidebarWin() )
+ {
+ rSet.InvalidateItem( FN_DELETE_COMMENT );
+ rSet.InvalidateItem( FN_HIDE_NOTE );
+ }
+ }
+ break;
+ case FN_EDIT_FIELD:
+ {
+ /* #108536# Fields can be selected, too now. Removed
+
+ if( rSh.HasSelection() )
+ rSet.DisableItem(nWhich);
+ else ...
+ */
+
+ if( !bGetField )
+ {
+ pField = rSh.GetCurFld();
+ bGetField = TRUE;
+ }
+
+ USHORT nTempWhich = pField ? pField->GetTyp()->Which() : USHRT_MAX;
+ if( USHRT_MAX == nTempWhich ||
+ RES_POSTITFLD == nTempWhich ||
+ RES_SCRIPTFLD == nTempWhich ||
+ RES_AUTHORITY == nTempWhich )
+ rSet.DisableItem( nWhich );
+ else if( RES_DDEFLD == nTempWhich &&
+ !((SwDDEFieldType*)pField->GetTyp())->GetBaseLink().IsVisible())
+ {
+ // nested links cannot be edited
+ rSet.DisableItem( nWhich );
+ }
+ }
+ break;
+ case FN_EXECUTE_MACROFIELD:
+ {
+ if(!bGetField)
+ {
+ pField = rSh.GetCurFld();
+ bGetField = TRUE;
+ }
+ if(!pField || pField->GetTyp()->Which() != RES_MACROFLD)
+ rSet.DisableItem(nWhich);
+ }
+ break;
+
+ case FN_INSERT_FIELD:
+ {
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
+ if(!pVFrame->IsInModalMode() &&
+ pVFrame->KnowsChildWindow(FN_INSERT_FIELD) && !pVFrame->HasChildWindow(FN_INSERT_FIELD_DATA_ONLY) )
+ rSet.Put(SfxBoolItem( FN_INSERT_FIELD, pVFrame->HasChildWindow(nWhich)));
+ else
+ rSet.DisableItem(FN_INSERT_FIELD);
+ }
+ break;
+ case FN_INSERT_REF_FIELD:
+ {
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ if (!pVFrame->KnowsChildWindow(FN_INSERT_FIELD))
+ rSet.DisableItem(FN_INSERT_REF_FIELD);
+ }
+ break;
+ case FN_INSERT_FIELD_CTRL:
+ rSet.Put(SfxBoolItem( nWhich, GetView().GetViewFrame()->HasChildWindow(FN_INSERT_FIELD)));
+ break;
+ case FN_REDLINE_COMMENT:
+ if (!rSh.GetCurrRedline())
+ rSet.DisableItem(nWhich);
+ break;
+ case FN_POSTIT :
+ case FN_JAVAEDIT :
+ BOOL bCurField = FALSE;
+ pField = rSh.GetCurFld();
+ if(nWhich == FN_POSTIT)
+ bCurField = pField && pField->GetTyp()->Which() == RES_POSTITFLD;
+ else
+ bCurField = pField && pField->GetTyp()->Which() == RES_SCRIPTFLD;
+
+ if(!bCurField && rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() )
+ rSet.DisableItem(nWhich);
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*---------------------------------------------------------------------------
+ Beschreibung:
+ ----------------------------------------------------------------------------*/
+
+
+void SwTextShell::InsertHyperlink(const SvxHyperlinkItem& rHlnkItem)
+{
+ const String& rName = rHlnkItem.GetName();
+ const String& rURL = rHlnkItem.GetURL();
+ const String& rTarget = rHlnkItem.GetTargetFrame();
+ USHORT nType = (USHORT)rHlnkItem.GetInsertMode();
+ nType &= ~HLINK_HTMLMODE;
+ const SvxMacroTableDtor* pMacroTbl = rHlnkItem.GetMacroTbl();
+
+ SwWrtShell& rSh = GetShell();
+
+ if( rSh.GetSelectionType() & nsSelectionType::SEL_TXT )
+ {
+ rSh.StartAction();
+ SfxItemSet aSet(GetPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT);
+ rSh.GetCurAttr( aSet );
+
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == aSet.GetItemState(RES_TXTATR_INETFMT, FALSE, &pItem))
+ {
+ // Links selektieren
+ rSh.SwCrsrShell::SelectTxtAttr(RES_TXTATR_INETFMT, FALSE);
+ }
+ switch (nType)
+ {
+ case HLINK_DEFAULT:
+ case HLINK_FIELD:
+ {
+ SwFmtINetFmt aINetFmt( rURL, rTarget );
+ aINetFmt.SetName(rHlnkItem.GetIntName());
+ if(pMacroTbl)
+ {
+ SvxMacro *pMacro = pMacroTbl->Get( SFX_EVENT_MOUSEOVER_OBJECT );
+ if( pMacro )
+ aINetFmt.SetMacro(SFX_EVENT_MOUSEOVER_OBJECT, *pMacro);
+ pMacro = pMacroTbl->Get( SFX_EVENT_MOUSECLICK_OBJECT );
+ if( pMacro )
+ aINetFmt.SetMacro(SFX_EVENT_MOUSECLICK_OBJECT, *pMacro);
+ pMacro = pMacroTbl->Get( SFX_EVENT_MOUSEOUT_OBJECT );
+ if( pMacro )
+ aINetFmt.SetMacro(SFX_EVENT_MOUSEOUT_OBJECT, *pMacro);
+ }
+ rSh.SttSelect();
+ rSh.InsertURL( aINetFmt, rName, TRUE );
+ rSh.EndSelect();
+ }
+ break;
+
+ case HLINK_BUTTON:
+ BOOL bSel = rSh.HasSelection();
+ if(bSel)
+ rSh.DelRight();
+ InsertURLButton( rURL, rTarget, rName );
+ rSh.EnterStdMode();
+ break;
+ }
+ rSh.EndAction();
+ }
+}
+
+IMPL_LINK( SwTextShell, RedlineNextHdl, AbstractSvxPostItDialog *, pBtn )
+{
+ SwWrtShell* pSh = GetShellPtr();
+ AbstractSvxPostItDialog *pDlg = (AbstractSvxPostItDialog*)pBtn;
+
+ // Kommentar einfuegen bzw aendern
+ pSh->SetRedlineComment(pDlg->GetNote());
+
+ const SwRedline *pRedline = pSh->GetCurrRedline();
+
+ String sComment;
+
+ if (pRedline)
+ {
+ // Traveling nur bei mehr als einem Feld
+ if( !pSh->IsCrsrPtAtEnd() )
+ pSh->SwapPam(); // Cursor hinter den Redline stellen
+
+ pSh->Push();
+ const SwRedline *pActRed = pSh->SelNextRedline();
+ pSh->Pop(pActRed != 0);
+
+ BOOL bEnable = FALSE;
+
+ if (pActRed)
+ {
+ pSh->StartAction();
+ pSh->Push();
+ bEnable = pSh->SelNextRedline() != 0;
+ pSh->Pop(FALSE);
+ pSh->EndAction();
+ }
+
+ pDlg->EnableTravel(bEnable, TRUE);
+
+ if( pSh->IsCrsrPtAtEnd() )
+ pSh->SwapPam();
+
+ pRedline = pSh->GetCurrRedline();
+ sComment = pRedline->GetComment();
+
+ pDlg->SetNote( sComment.ConvertLineEnd() );
+ pDlg->ShowLastAuthor( pRedline->GetAuthorString(),
+ GetAppLangDateTimeString(
+ pRedline->GetRedlineData().GetTimeStamp() ));
+
+ String sTitle(SW_RES(STR_REDLINE_COMMENT));
+ ::lcl_AppendRedlineStr( sTitle, pRedline->GetType() );
+
+ pDlg->SetText(sTitle);
+ }
+
+ return 0;
+}
+
+IMPL_LINK( SwTextShell, RedlinePrevHdl, AbstractSvxPostItDialog *, pBtn )
+{
+ SwWrtShell* pSh = GetShellPtr();
+ AbstractSvxPostItDialog *pDlg = (AbstractSvxPostItDialog*)pBtn;
+
+ // Kommentar einfuegen bzw aendern
+ pSh->SetRedlineComment(pDlg->GetNote());
+
+ const SwRedline *pRedline = pSh->GetCurrRedline();
+
+ String sComment;
+
+ if (pRedline)
+ {
+ // Traveling nur bei mehr als einem Feld
+ pSh->Push();
+ const SwRedline *pActRed = pSh->SelPrevRedline();
+ pSh->Pop(pActRed != 0);
+
+ BOOL bEnable = FALSE;
+
+ if (pActRed)
+ {
+ pSh->StartAction();
+ pSh->Push();
+ bEnable = pSh->SelPrevRedline() != 0;
+ pSh->Pop(FALSE);
+ pSh->EndAction();
+ }
+
+ pDlg->EnableTravel(TRUE, bEnable);
+
+ pRedline = pSh->GetCurrRedline();
+ sComment = pRedline->GetComment();
+
+ pDlg->SetNote(sComment.ConvertLineEnd());
+ pDlg->ShowLastAuthor(pRedline->GetAuthorString(),
+ GetAppLangDateTimeString(
+ pRedline->GetRedlineData().GetTimeStamp() ));
+
+ String sTitle(SW_RES(STR_REDLINE_COMMENT));
+ ::lcl_AppendRedlineStr( sTitle, pRedline->GetType() );
+
+ pDlg->SetText(sTitle);
+ }
+
+ return 0;
+}
+
+
diff --git a/sw/source/ui/shells/textglos.cxx b/sw/source/ui/shells/textglos.cxx
new file mode 100644
index 000000000000..a1a9f87ca918
--- /dev/null
+++ b/sw/source/ui/shells/textglos.cxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/request.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+
+#include "errhdl.hxx"
+#include "view.hxx"
+#include "initui.hxx"
+#include "cmdid.h"
+#include "textsh.hxx"
+#include "initui.hxx"
+#include "gloshdl.hxx"
+#include "glosdoc.hxx"
+#include "gloslst.hxx"
+#include "swabstdlg.hxx"
+#include <misc.hrc>
+
+// STATIC DATA -----------------------------------------------------------
+
+void SwTextShell::ExecGlossary(SfxRequest &rReq)
+{
+ USHORT nSlot = rReq.GetSlot();
+ ::GetGlossaries()->UpdateGlosPath(!rReq.IsAPI() ||
+ FN_GLOSSARY_DLG == nSlot );
+ SwGlossaryHdl* pGlosHdl = GetView().GetGlosHdl();
+ // SwGlossaryList updaten?
+ BOOL bUpdateList = FALSE;
+
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+ if(pArgs)
+ pArgs->GetItemState(nSlot, FALSE, &pItem );
+
+ switch( nSlot )
+ {
+ case FN_GLOSSARY_DLG:
+ pGlosHdl->GlossaryDlg();
+ bUpdateList = TRUE;
+ rReq.Ignore();
+ break;
+ case FN_EXPAND_GLOSSARY:
+ {
+ BOOL bReturn;
+ bReturn = pGlosHdl->ExpandGlossary();
+ rReq.SetReturnValue( SfxBoolItem( nSlot, bReturn ) );
+ rReq.Done();
+ }
+ break;
+ case FN_NEW_GLOSSARY:
+ if(pItem && pArgs->Count() == 3 )
+ {
+ String aGroup = (( const SfxStringItem *)pItem)->GetValue();
+ String aName;
+ if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_1, FALSE, &pItem ))
+ aName = (( const SfxStringItem *)pItem)->GetValue();
+ String aShortName;
+ if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_2, FALSE, &pItem ))
+ aShortName = (( const SfxStringItem *)pItem)->GetValue();
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc( DLG_RENAME_GLOS );
+ if ( fnSetActGroup )
+ (*fnSetActGroup)( aGroup );
+ pGlosHdl->SetCurGroup(aGroup, TRUE);
+ //eingestellte Gruppe muss in NewGlossary ggf. erzeugt werden!
+ pGlosHdl->NewGlossary( aName, aShortName, TRUE );
+ rReq.Done();
+ }
+ bUpdateList = TRUE;
+ break;
+ case FN_SET_ACT_GLOSSARY:
+ if(pItem)
+ {
+ String aGroup = (( const SfxStringItem *)pItem)->GetValue();
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc( DLG_RENAME_GLOS );
+ if ( fnSetActGroup )
+ (*fnSetActGroup)( aGroup );
+ rReq.Done();
+ }
+ break;
+ case FN_INSERT_GLOSSARY:
+ {
+ if(pItem && pArgs->Count() > 1)
+ {
+ String aGroup = (( const SfxStringItem *)pItem)->GetValue();
+ String aName;
+ if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_1, FALSE, &pItem ))
+ aName = (( const SfxStringItem *)pItem)->GetValue();
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc( DLG_RENAME_GLOS );
+ if ( fnSetActGroup )
+ (*fnSetActGroup)( aGroup );
+ pGlosHdl->SetCurGroup(aGroup, TRUE);
+ rReq.SetReturnValue(SfxBoolItem(nSlot, pGlosHdl->InsertGlossary( aName )));
+ rReq.Done();
+ }
+ }
+ break;
+ default:
+ ASSERT(FALSE, falscher Dispatcher);
+ return;
+ }
+ if(bUpdateList)
+ {
+ SwGlossaryList* pList = ::GetGlossaryList();
+ if(pList->IsActive())
+ pList->Update();
+ }
+}
+
+
diff --git a/sw/source/ui/shells/textidx.cxx b/sw/source/ui/shells/textidx.cxx
new file mode 100644
index 000000000000..135a3435ca31
--- /dev/null
+++ b/sw/source/ui/shells/textidx.cxx
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <fmtfsize.hxx>
+#include <fldbas.hxx>
+#include <uiitems.hxx>
+#include "viewopt.hxx"
+#include "cmdid.h"
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "swundo.hxx" // fuer Undo-Ids
+#include "textsh.hxx"
+#include "idxmrk.hxx"
+#include "cnttab.hxx"
+#include "toxmgr.hxx"
+#include "swabstdlg.hxx"
+#include <index.hrc>
+#include <globals.hrc>
+
+
+// STATIC DATA -----------------------------------------------------------
+
+void SwTextShell::ExecIdx(SfxRequest &rReq)
+{
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+ USHORT nSlot = rReq.GetSlot();
+ if(pArgs)
+ pArgs->GetItemState(nSlot, FALSE, &pItem );
+
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ Window *pMDI = &pVFrame->GetWindow();
+
+ switch( nSlot )
+ {
+ case FN_EDIT_AUTH_ENTRY_DLG :
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ VclAbstractDialog* pDlg = pFact->CreateVclAbstractDialog( pMDI, GetShell(), DLG_EDIT_AUTHMARK);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ }
+ break;
+ case FN_INSERT_AUTH_ENTRY_DLG:
+ {
+ // no BASIC support
+ pVFrame->ToggleChildWindow(FN_INSERT_AUTH_ENTRY_DLG);
+ Invalidate(rReq.GetSlot());
+ }
+ break;
+ case FN_INSERT_IDX_ENTRY_DLG:
+ {
+ pVFrame->ToggleChildWindow(FN_INSERT_IDX_ENTRY_DLG);
+ Invalidate(rReq.GetSlot());
+ }
+ break;
+ case FN_EDIT_IDX_ENTRY_DLG:
+ {
+ SwTOXMgr aMgr(GetShellPtr());
+ USHORT nRet = RET_OK;
+ if(aMgr.GetTOXMarkCount() > 1)
+ { // Mehrere Marken, welche solls denn sein ?
+ //
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ VclAbstractDialog* pMultDlg = pFact->CreateMultiTOXMarkDlg( DLG_MULTMRK,
+ pMDI, aMgr);
+ DBG_ASSERT(pMultDlg, "Dialogdiet fail!");
+ nRet = pMultDlg->Execute();
+ delete pMultDlg;
+ }
+ if( nRet == RET_OK)
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ VclAbstractDialog* pDlg = pFact->CreateIndexMarkModalDlg( DLG_EDIT_IDXMARK, pMDI, GetShell(), aMgr.GetCurTOXMark() );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ }
+ break;
+ }
+ case FN_IDX_MARK_TO_IDX:
+ {
+ GetShell().GotoTOXMarkBase();
+ break;
+ }
+ case FN_INSERT_MULTI_TOX:
+ {
+ SfxItemSet aSet(GetPool(),
+ RES_COL, RES_COL,
+ RES_BACKGROUND, RES_BACKGROUND,
+ RES_FRM_SIZE, RES_FRM_SIZE,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ RES_LR_SPACE, RES_LR_SPACE,
+ FN_PARAM_TOX_TYPE, FN_PARAM_TOX_TYPE,
+ 0 );
+ SwWrtShell& rSh = GetShell();
+ SwRect aRect;
+ rSh.CalcBoundRect(aRect, FLY_AS_CHAR);
+
+ long nWidth = aRect.Width();
+ aSet.Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth));
+ // Hoehe=Breite fuer konsistentere Vorschau (analog zu Bereich bearbeiten)
+ aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
+ const SwTOXBase* pCurTOX = 0;
+ BOOL bGlobal = FALSE;
+ if(pItem)
+ {
+ pCurTOX = (const SwTOXBase* )((SwPtrItem*)pItem)->GetValue();
+ bGlobal = TRUE;
+ }
+ else
+ pCurTOX = rSh.GetCurTOX();
+ if(pCurTOX)
+ {
+ const SfxItemSet* pSet = pCurTOX->GetAttrSet();
+ if(pSet)
+ aSet.Put(*pSet);
+ }
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractMultiTOXTabDialog* pDlg = pFact->CreateMultiTOXTabDialog( DLG_MULTI_TOX,
+ pMDI, aSet, rSh, (SwTOXBase* )pCurTOX,
+ USHRT_MAX, bGlobal);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ }
+ break;
+ case FN_REMOVE_CUR_TOX:
+ {
+ SwWrtShell& rSh = GetShell();
+ const SwTOXBase* pBase = rSh.GetCurTOX();
+ DBG_ASSERT(pBase, "no TOXBase to remove");
+ if( pBase )
+ rSh.DeleteTOX(*pBase, TRUE);
+ }
+ break;
+ default:
+ ASSERT(!this, falscher Dispatcher);
+ return;
+ }
+}
+
+
+void SwTextShell::GetIdxState(SfxItemSet &rSet)
+{
+ SwWrtShell& rSh = GetShell();
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ SwInsertIdxMarkWrapper *pIdxMrk = (SwInsertIdxMarkWrapper*)
+ pVFrame->GetChildWindow(FN_INSERT_IDX_ENTRY_DLG);
+
+ SfxChildWindow* pAuthMark = pVFrame->GetChildWindow(FN_INSERT_AUTH_ENTRY_DLG);
+
+ const BOOL bHtmlMode = 0 != ::GetHtmlMode( GetView().GetDocShell() );
+ const SwTOXBase* pBase = 0;
+ if( bHtmlMode || 0 != ( pBase = rSh.GetCurTOX()) )
+ {
+ if( pBase )
+ {
+ if(pBase->IsTOXBaseInReadonly())
+ {
+ rSet.DisableItem( FN_INSERT_MULTI_TOX );
+ }
+ }
+
+ rSet.DisableItem( FN_EDIT_IDX_ENTRY_DLG );
+ rSet.DisableItem( FN_EDIT_AUTH_ENTRY_DLG );
+
+ if(!pIdxMrk)
+ rSet.DisableItem( FN_INSERT_IDX_ENTRY_DLG );
+ else
+ rSet.Put(SfxBoolItem(FN_INSERT_IDX_ENTRY_DLG, TRUE));
+
+ if(!pAuthMark)
+ rSet.DisableItem( FN_INSERT_AUTH_ENTRY_DLG );
+ else
+ rSet.Put(SfxBoolItem(FN_INSERT_AUTH_ENTRY_DLG, TRUE));
+
+ }
+ else //if( SFX_ITEM_UNKNOWN != rSet.GetItemState( FN_EDIT_IDX_ENTRY_DLG ))
+ {
+
+ BOOL bEnableEdit = TRUE;
+ BOOL bInReadonly = rSh.HasReadonlySel();
+ if( rSh.HasSelection() || bInReadonly)
+ bEnableEdit = FALSE;
+ else
+ {
+ SwTOXMarks aArr;
+ rSh.GetCurTOXMarks( aArr );
+ if( !aArr.Count())
+ bEnableEdit = FALSE;
+ }
+
+ if(!bEnableEdit)
+ rSet.DisableItem( FN_EDIT_IDX_ENTRY_DLG );
+
+ if(bInReadonly)
+ {
+ rSet.DisableItem(FN_INSERT_IDX_ENTRY_DLG);
+ rSet.DisableItem( FN_INSERT_MULTI_TOX );
+ }
+ else
+ rSet.Put(SfxBoolItem(FN_INSERT_IDX_ENTRY_DLG,
+ 0 != pIdxMrk));
+
+
+ SwField* pField = rSh.GetCurFld();
+
+ if(bInReadonly)
+ rSet.DisableItem(FN_INSERT_AUTH_ENTRY_DLG);
+ else
+ rSet.Put(SfxBoolItem(FN_INSERT_AUTH_ENTRY_DLG, 0 != pAuthMark));
+
+ if( bInReadonly || !pField ||
+ pField->GetTyp()->Which() != RES_AUTHORITY)
+ rSet.DisableItem(FN_EDIT_AUTH_ENTRY_DLG);
+ rSet.DisableItem(FN_REMOVE_CUR_TOX);
+ }
+}
+
+// -----------------------------------------------------------------------
+
diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx
new file mode 100644
index 000000000000..b7795172e55f
--- /dev/null
+++ b/sw/source/ui/shells/textsh.cxx
@@ -0,0 +1,1222 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#define _SW_FRMVALID_HXX
+#include <hintids.hxx>
+
+#include <svl/globalnameitem.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/lnkbase.hxx>
+
+#include <tools/errinf.hxx>
+#include <svx/svdview.hxx>
+#include <svl/ptitem.hxx>
+#include <svl/stritem.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <svx/hlnkitem.hxx>
+#include <svl/srchitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/docfile.hxx>
+#include <svl/urihelper.hxx>
+#include <basic/sbxvar.hxx>
+#include <svl/whiter.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/opaqitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/svxacorr.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <svtools/filter.hxx>
+#include <svx/htmlmode.hxx>
+#include <svx/pfiledlg.hxx>
+#include <svtools/htmlcfg.hxx>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
+
+#include <sot/clsids.hxx>
+#include <editeng/acorrcfg.hxx>
+#include <wdocsh.hxx>
+#include <fmtinfmt.hxx>
+#include <fmtclds.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtfsize.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <docsh.hxx>
+#include <doc.hxx>
+#include <uitool.hxx>
+#include <cmdid.h>
+#include <globals.hrc>
+#include <frmmgr.hxx>
+#include <textsh.hxx>
+#include <frmfmt.hxx>
+#include <tablemgr.hxx>
+#include <swundo.hxx> // fuer Undo-IDs
+#include <shellio.hxx>
+#include <frmdlg.hxx>
+#include <usrpref.hxx>
+#include <swtable.hxx>
+#include <tblafmt.hxx>
+#include <caption.hxx>
+#include <idxmrk.hxx>
+#include <poolfmt.hxx>
+#include <breakit.hxx>
+#include <crsskip.hxx>
+#include <modcfg.hxx>
+#include <column.hxx>
+#include <edtwin.hxx>
+#include <shells.hrc>
+#include <popup.hrc>
+#include <swerror.h>
+#include <SwAppletImpl.hxx>
+#include <unochart.hxx>
+
+#include <chartins.hxx>
+
+#define SwTextShell
+#define Paragraph
+#define HyphenZone
+#define TextFont
+#define DropCap
+#include <sfx2/msg.hxx>
+#include <swslots.hxx>
+#include <SwRewriter.hxx>
+#include <comcore.hrc>
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include "swabstdlg.hxx"
+#include <misc.hrc>
+#include <table.hrc>
+#include <frmui.hrc>
+#include <unomid.h>
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SFX_IMPL_INTERFACE(SwTextShell, SwBaseShell, SW_RES(STR_SHELLNAME_TEXT))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_TEXT_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TEXT_TOOLBOX));
+ SFX_CHILDWINDOW_REGISTRATION(FN_EDIT_FORMULA);
+ SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_FIELD);
+ SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_IDX_ENTRY_DLG);
+ SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_AUTH_ENTRY_DLG);
+ SFX_CHILDWINDOW_REGISTRATION(SID_RUBY_DIALOG);
+}
+
+
+
+TYPEINIT1(SwTextShell,SwBaseShell)
+
+
+
+void SwTextShell::ExecInsert(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+
+ ASSERT( !rSh.IsObjSelected() && !rSh.IsFrmSelected(),
+ "Falsche Shell auf dem Dispatcher" );
+
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+ USHORT nSlot = rReq.GetSlot();
+ if(pArgs)
+ pArgs->GetItemState(nSlot, FALSE, &pItem );
+
+ switch( nSlot )
+ {
+ case FN_INSERT_STRING:
+ if( pItem )
+ rSh.InsertByWord(((const SfxStringItem *)pItem)->GetValue());
+ break;
+ case FN_INSERT_SOFT_HYPHEN:
+ if( CHAR_SOFTHYPHEN != rSh.SwCrsrShell::GetChar( TRUE, 0 ) &&
+ CHAR_SOFTHYPHEN != rSh.SwCrsrShell::GetChar( TRUE, -1 ))
+ rSh.Insert( String( CHAR_SOFTHYPHEN ) );
+ break;
+
+ case FN_INSERT_HARDHYPHEN:
+ case FN_INSERT_HARD_SPACE:
+ {
+ sal_Unicode cIns = FN_INSERT_HARD_SPACE == nSlot ? CHAR_HARDBLANK
+ : CHAR_HARDHYPHEN;
+
+ SvxAutoCorrCfg* pACfg = SvxAutoCorrCfg::Get();
+ SvxAutoCorrect* pACorr = pACfg->GetAutoCorrect();
+ if( pACorr && pACfg->IsAutoFmtByInput() &&
+ pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd |
+ AddNonBrkSpace | ChgOrdinalNumber |
+ ChgToEnEmDash | SetINetAttr | Autocorrect ))
+ rSh.AutoCorrect( *pACorr, cIns );
+ else
+ rSh.Insert( String( cIns ) );
+ }
+ break;
+ case SID_INSERT_RLM :
+ case SID_INSERT_LRM :
+ case SID_INSERT_ZWNBSP :
+ case SID_INSERT_ZWSP:
+ {
+ sal_Unicode cIns = 0;
+ switch(nSlot)
+ {
+ case SID_INSERT_RLM : cIns = CHAR_RLM ; break;
+ case SID_INSERT_LRM : cIns = CHAR_LRM ; break;
+ case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break;
+ case SID_INSERT_ZWNBSP: cIns = CHAR_ZWNBSP; break;
+ }
+ rSh.Insert( String( cIns ) );
+ }
+ break;
+ case FN_INSERT_BREAK:
+ rSh.SplitNode();
+ rReq.Done();
+ break;
+ case FN_INSERT_PAGEBREAK:
+ rSh.InsertPageBreak();
+ rReq.Done();
+ break;
+ case FN_INSERT_LINEBREAK:
+ rSh.InsertLineBreak();
+ rReq.Done();
+ break;
+ case FN_INSERT_COLUMN_BREAK:
+ rSh.InsertColumnBreak();
+ rReq.Done();
+ break;
+ case SID_HYPERLINK_SETLINK:
+ if (pItem)
+ InsertHyperlink(*((const SvxHyperlinkItem *)pItem));
+ rReq.Done();
+ break;
+ case SID_INSERT_AVMEDIA:
+ rReq.SetReturnValue(SfxBoolItem(nSlot, InsertMediaDlg( rReq )));
+ break;
+ case SID_INSERT_SOUND:
+ case SID_INSERT_VIDEO:
+ {
+ SvxPluginFileDlg aDlg( &GetView().GetViewFrame()->GetWindow(), nSlot );
+ aDlg.SetContext( nSlot == SID_INSERT_SOUND? sfx2::FileDialogHelper::SW_INSERT_SOUND : sfx2::FileDialogHelper::SW_INSERT_VIDEO );
+
+ if ( ERRCODE_NONE == aDlg.Execute() )
+ {
+ // URL ermitteln
+ String aStrURL( aDlg.GetPath() );
+ aStrURL = URIHelper::SmartRel2Abs(
+ INetURLObject(), aStrURL, URIHelper::GetMaybeFileHdl() );
+
+ INetURLObject* pURL = new INetURLObject();
+ pURL->SetSmartProtocol( INET_PROT_FILE );
+
+ if ( pURL->SetURL( aStrURL, INetURLObject::WAS_ENCODED ) )
+ {
+ ::rtl::OUString aName;
+ comphelper::EmbeddedObjectContainer aCnt;
+ svt::EmbeddedObjectRef xObj( aCnt.CreateEmbeddedObject( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence(), aName ), embed::Aspects::MSOLE_CONTENT );
+ if ( xObj.is() )
+ {
+ svt::EmbeddedObjectRef::TryRunningState( xObj.GetObject() );
+
+ // set properties from dialog
+ uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
+ if ( xSet.is() )
+ {
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("PluginURL"),
+ uno::makeAny( ::rtl::OUString( pURL->GetMainURL( INetURLObject::NO_DECODE ) ) ) );
+ }
+ }
+
+ rSh.InsertObject( xObj, 0, TRUE, nSlot);
+ }
+ }
+ }
+ break;
+ case SID_INSERT_OBJECT:
+ case SID_INSERT_PLUGIN:
+ {
+ SFX_REQUEST_ARG( rReq, pNameItem, SfxGlobalNameItem, SID_INSERT_OBJECT, sal_False );
+ SvGlobalName *pName = NULL;
+ SvGlobalName aName;
+ if ( pNameItem )
+ {
+ aName = pNameItem->GetValue();
+ pName = &aName;
+ }
+
+ SFX_REQUEST_ARG( rReq, pClassLocationItem, SfxStringItem, FN_PARAM_2, sal_False );
+ SFX_REQUEST_ARG( rReq, pCommandsItem, SfxStringItem, FN_PARAM_3, sal_False );
+ //TODO/LATER: recording currently not working, need code for Commandlist
+ svt::EmbeddedObjectRef xObj;
+ if( nSlot == SID_INSERT_PLUGIN && ( pClassLocationItem || pCommandsItem ) )
+ {
+ String sClassLocation;
+ if(pClassLocationItem)
+ sClassLocation = pClassLocationItem->GetValue();
+
+ SvCommandList aCommandList;
+ if(pCommandsItem)
+ {
+ USHORT nTemp;
+ aCommandList.AppendCommands( pCommandsItem->GetValue(), &nTemp );
+ }
+
+ {
+ comphelper::EmbeddedObjectContainer aCnt;
+ ::rtl::OUString sName;
+ xObj.Assign( aCnt.CreateEmbeddedObject( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence(), sName ),
+ embed::Aspects::MSOLE_CONTENT );
+ svt::EmbeddedObjectRef::TryRunningState( xObj.GetObject() );
+ uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
+ if ( xSet.is() )
+ {
+ try
+ {
+ if ( sClassLocation.Len() )
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("PluginURL"),
+ uno::makeAny(
+ ::rtl::OUString(
+ URIHelper::SmartRel2Abs(
+ INetURLObject(), sClassLocation,
+ URIHelper::GetMaybeFileHdl()) ) ) );
+ uno::Sequence< beans::PropertyValue > aSeq;
+ if ( aCommandList.Count() )
+ {
+ aCommandList.FillSequence( aSeq );
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("PluginCommands"), uno::makeAny( aSeq ) );
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+ }
+
+ if(xObj.is())
+ rSh.InsertOleObject( xObj );
+ }
+ else
+ {
+ DBG_ASSERT( !pNameItem || nSlot == SID_INSERT_OBJECT, "Superfluous argument!" );
+ rSh.InsertObject( xObj, pName, TRUE, nSlot);
+ rReq.Done();
+ }
+ break;
+ }
+ case SID_INSERT_FLOATINGFRAME:
+ {
+ svt::EmbeddedObjectRef xObj;
+ SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, FN_PARAM_1, sal_False );
+ SFX_REQUEST_ARG( rReq, pURLItem, SfxStringItem, FN_PARAM_2, sal_False );
+ SFX_REQUEST_ARG( rReq, pMarginItem, SvxSizeItem, FN_PARAM_3, sal_False );
+ SFX_REQUEST_ARG( rReq, pScrollingItem, SfxByteItem, FN_PARAM_4, sal_False );
+ SFX_REQUEST_ARG( rReq, pBorderItem, SfxBoolItem, FN_PARAM_5, sal_False );
+
+ if(pURLItem) // URL is a _must_
+ {
+ comphelper::EmbeddedObjectContainer aCnt;
+ ::rtl::OUString aName;
+ xObj.Assign( aCnt.CreateEmbeddedObject( SvGlobalName( SO3_IFRAME_CLASSID ).GetByteSequence(), aName ),
+ embed::Aspects::MSOLE_CONTENT );
+ svt::EmbeddedObjectRef::TryRunningState( xObj.GetObject() );
+ uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
+ if ( xSet.is() )
+ {
+ try
+ {
+ ScrollingMode eScroll = ScrollingAuto;
+ if( pScrollingItem && pScrollingItem->GetValue() <= ScrollingAuto )
+ eScroll = (ScrollingMode) pScrollingItem->GetValue();
+
+ Size aMargin;
+ if ( pMarginItem )
+ aMargin = pMarginItem->GetSize();
+
+ if ( pURLItem )
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameURL"), uno::makeAny( ::rtl::OUString( pURLItem->GetValue() ) ) );
+ if ( pNameItem )
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameName"), uno::makeAny( ::rtl::OUString( pNameItem->GetValue() ) ) );
+
+ if ( eScroll == ScrollingAuto )
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoScroll"),
+ uno::makeAny( sal_True ) );
+ else
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsScrollingMode"),
+ uno::makeAny( (sal_Bool) ( eScroll == ScrollingYes) ) );
+
+ //if ( aFrmDescr.IsFrameBorderSet() )
+ if ( pBorderItem )
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsBorder"),
+ uno::makeAny( (sal_Bool) pBorderItem->GetValue() ) );
+ /*else
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameIsAutoBorder"),
+ makeAny( sal_True ) );*/
+
+ if ( pMarginItem )
+ {
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginWidth"),
+ uno::makeAny( sal_Int32( aMargin.Width() ) ) );
+
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("FrameMarginHeight"),
+ uno::makeAny( sal_Int32( aMargin.Height() ) ) );
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+
+ rSh.InsertOleObject( xObj );
+ }
+ else
+ {
+ rSh.InsertObject( xObj, 0, TRUE, nSlot);
+ rReq.Done();
+ }
+ }
+ break;
+ case SID_INSERT_DIAGRAM:
+ {
+ SvtModuleOptions aMOpt;
+ if ( !aMOpt.IsChart() )
+ break;
+ if(!rReq.IsAPI())
+ {
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ SwInsertChart( &GetView().GetEditWin(), &pVFrame->GetBindings() );
+ }
+ else
+ {
+ uno::Reference< chart2::data::XDataProvider > xDataProvider;
+ sal_Bool bFillWithData = sal_True;
+ OUString aRangeString;
+ if (!GetShell().IsTblComplexForChart())
+ {
+ SwFrmFmt* pTblFmt = GetShell().GetTableFmt();
+ String aCurrentTblName = pTblFmt->GetName();
+ // String aText( String::CreateFromAscii("<.>") ); // was used for UI
+ // aText.Insert( rWrtShell.GetBoxNms(), 2);
+ // aText.Insert( aCurrentTblName, 1 );
+ aRangeString = aCurrentTblName;
+ aRangeString += OUString::valueOf( sal_Unicode('.') );
+ aRangeString += GetShell().GetBoxNms();
+
+ // get table data provider
+ xDataProvider.set( GetView().GetDocShell()->getIDocumentChartDataProviderAccess()->GetChartDataProvider() );
+ }
+ else
+ bFillWithData = sal_False; // will create chart with only it's default image
+
+ SwTableFUNC( &rSh, FALSE ).InsertChart( xDataProvider, bFillWithData, aRangeString );
+ rSh.LaunchOLEObj();
+
+ svt::EmbeddedObjectRef& xObj = rSh.GetOLEObject();
+ if(pItem && xObj.is())
+ {
+ Size aSize(((SvxSizeItem*)pItem)->GetSize());
+ aSize = OutputDevice::LogicToLogic
+ ( aSize, MapMode( MAP_TWIP ), MapMode( MAP_100TH_MM ) );
+
+ if(aSize.Width() > MINLAY&& aSize.Height()> MINLAY)
+ {
+ awt::Size aSz;
+ aSz.Width = aSize.Width();
+ aSz.Height = aSize.Height();
+ xObj->setVisualAreaSize( xObj.GetViewAspect(), aSz );
+ }
+ }
+ }
+ }
+ break;
+
+ case FN_INSERT_SMA:
+ {
+ // #i34343# Inserting a math object into an autocompletion crashes
+ // the suggestion has to be removed before
+ GetView().GetEditWin().StopQuickHelp();
+ SvGlobalName aGlobalName( SO3_SM_CLASSID );
+ rSh.InsertObject( svt::EmbeddedObjectRef(), &aGlobalName, TRUE, 0 );
+ }
+ break;
+
+ case FN_INSERT_TABLE:
+ InsertTable( rReq );
+ break;
+
+ case FN_INSERT_FRAME_INTERACT_NOCOL:
+ case FN_INSERT_FRAME_INTERACT:
+ {
+ USHORT nCols = 1;
+ BOOL bModifier1 = rReq.GetModifier() == KEY_MOD1;
+ if(pArgs)
+ {
+ if(FN_INSERT_FRAME_INTERACT_NOCOL != nSlot &&
+ pArgs->GetItemState(SID_ATTR_COLUMNS, FALSE, &pItem) == SFX_ITEM_SET)
+ nCols = ((SfxUInt16Item *)pItem)->GetValue();
+ if(pArgs->GetItemState(SID_MODIFIER, FALSE, &pItem) == SFX_ITEM_SET)
+ bModifier1 |= KEY_MOD1 == ((SfxUInt16Item *)pItem)->GetValue();
+ }
+ if(bModifier1 )
+ {
+ SwEditWin& rEdtWin = GetView().GetEditWin();
+ Size aWinSize = rEdtWin.GetSizePixel();
+ Point aStartPos(aWinSize.Width()/2, aWinSize.Height() / 2);
+ aStartPos = rEdtWin.PixelToLogic(aStartPos);
+ aStartPos.X() -= 8 * MM50;
+ aStartPos.Y() -= 4 * MM50;
+ Size aSize(16 * MM50, 8 * MM50);
+ GetShell().LockPaint();
+ GetShell().StartAllAction();
+ SwFlyFrmAttrMgr aMgr( TRUE, GetShellPtr(), FRMMGR_TYPE_TEXT );
+ if(nCols > 1)
+ {
+ SwFmtCol aCol;
+ aCol.Init( nCols, aCol.GetGutterWidth(), aCol.GetWishWidth() );
+ aMgr.SetCol( aCol );
+ }
+ aMgr.InsertFlyFrm(FLY_AT_PARA, aStartPos, aSize);
+ GetShell().EndAllAction();
+ GetShell().UnlockPaint();
+ }
+ else
+ {
+ GetView().InsFrmMode(nCols);
+ }
+ rReq.Ignore();
+ }
+ break;
+ case FN_INSERT_FRAME:
+ {
+ BOOL bSingleCol = FALSE;
+ if( 0!= dynamic_cast< SwWebDocShell*>( GetView().GetDocShell()) )
+ {
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ USHORT nExport = pHtmlOpt->GetExportMode();
+ if( HTML_CFG_MSIE == nExport ||
+ HTML_CFG_HTML32 == nExport ||
+ HTML_CFG_MSIE_40 == nExport ||
+ HTML_CFG_HTML32 == nExport )
+ {
+ bSingleCol = TRUE;
+ }
+
+ }
+ // Rahmen neu anlegen
+ SwFlyFrmAttrMgr aMgr( TRUE, GetShellPtr(), FRMMGR_TYPE_TEXT );
+ if(pArgs)
+ {
+ Size aSize(aMgr.GetSize());
+ aSize.Width() = GetShell().GetAnyCurRect(RECT_PAGE_PRT).Width();
+ Point aPos = aMgr.GetPos();
+ RndStdIds eAnchor = FLY_AT_PARA;
+ if(pArgs->GetItemState(nSlot, FALSE, &pItem) == SFX_ITEM_SET)
+ eAnchor = (RndStdIds)((SfxUInt16Item *)pItem)->GetValue();
+ if(pArgs->GetItemState(FN_PARAM_1, FALSE, &pItem) == SFX_ITEM_SET)
+ aPos = ((SfxPointItem *)pItem)->GetValue();
+ if(pArgs->GetItemState(FN_PARAM_2, FALSE, &pItem) == SFX_ITEM_SET)
+ aSize = ((SvxSizeItem *)pItem)->GetSize();
+ if(pArgs->GetItemState(SID_ATTR_COLUMNS, FALSE, &pItem) == SFX_ITEM_SET)
+ {
+ USHORT nCols = ((SfxUInt16Item *)pItem)->GetValue();
+ if( !bSingleCol && 1 < nCols )
+ {
+ SwFmtCol aFmtCol;
+ aFmtCol.Init( nCols , (rReq.IsAPI() ? 0
+ : DEF_GUTTER_WIDTH), USHRT_MAX );
+ aMgr.SetCol(aFmtCol);
+ }
+ }
+
+ GetShell().LockPaint();
+ GetShell().StartAllAction();
+
+ aMgr.InsertFlyFrm(eAnchor, aPos, aSize);
+
+ GetShell().EndAllAction();
+ GetShell().UnlockPaint();
+ }
+ else
+ {
+ static USHORT __READONLY_DATA aFrmAttrRange[] =
+ {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ FN_GET_PRINT_AREA, FN_GET_PRINT_AREA,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ FN_SET_FRM_NAME, FN_SET_FRM_NAME,
+ SID_HTML_MODE, SID_HTML_MODE,
+ 0
+ };
+
+ SfxItemSet aSet(GetPool(), aFrmAttrRange );
+ aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
+ const SwRect &rPg = GetShell().GetAnyCurRect(RECT_PAGE);
+ SwFmtFrmSize aFrmSize(ATT_VAR_SIZE, rPg.Width(), rPg.Height());
+ aFrmSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE));
+ aSet.Put(aFrmSize);
+
+ const SwRect &rPr = GetShell().GetAnyCurRect(RECT_PAGE_PRT);
+ SwFmtFrmSize aPrtSize(ATT_VAR_SIZE, rPr.Width(), rPr.Height());
+ aPrtSize.SetWhich(GetPool().GetWhich(FN_GET_PRINT_AREA));
+ aSet.Put(aPrtSize);
+
+ aSet.Put(aMgr.GetAttrSet());
+ aSet.SetParent( aMgr.GetAttrSet().GetParent() );
+
+ // Minimalgroesse in Spalten loeschen
+ SvxBoxInfoItem aBoxInfo((SvxBoxInfoItem &)aSet.Get(SID_ATTR_BORDER_INNER));
+ const SvxBoxItem& rBox = (const SvxBoxItem&)aSet.Get(RES_BOX);
+ aBoxInfo.SetMinDist(FALSE);
+ aBoxInfo.SetDefDist(rBox.GetDistance(BOX_LINE_LEFT));
+ aSet.Put(aBoxInfo);
+
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, GetView().GetDocShell()));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)));
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ SfxAbstractTabDialog* pDlg = pFact->CreateFrmTabDialog( DLG_FRM_STD,
+ GetView().GetViewFrame(), &GetView().GetViewFrame()->GetWindow(), aSet, TRUE);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if(pDlg->Execute() && pDlg->GetOutputItemSet())
+ {
+ //local variable necessary at least after call of .AutoCaption() because this could be deleted at this point
+ SwWrtShell& rShell = GetShell();
+ rShell.LockPaint();
+ rShell.StartAllAction();
+ rShell.StartUndo(UNDO_INSERT);
+
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ aMgr.SetAttrSet(*pOutSet);
+
+ // beim ClickToEditFeld erst die Selektion loeschen
+ if( rShell.IsInClickToEdit() )
+ rShell.DelRight();
+
+ aMgr.InsertFlyFrm();
+
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ GetView().GetViewFrame()->GetBindings().GetRecorder();
+ if ( xRecorder.is() )
+ {
+ //FN_INSERT_FRAME
+ USHORT nAnchor = (USHORT)aMgr.GetAnchor();
+ rReq.AppendItem(SfxUInt16Item(nSlot, nAnchor));
+ rReq.AppendItem(SfxPointItem(FN_PARAM_1, rShell.GetObjAbsPos()));
+ rReq.AppendItem(SvxSizeItem(FN_PARAM_2, rShell.GetObjSize()));
+ rReq.Done();
+ }
+
+ GetView().AutoCaption(FRAME_CAP);
+
+ {
+ SwRewriter aRewriter;
+
+ aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_FRAME));
+
+ rShell.EndUndo(UNDO_INSERT, &aRewriter);
+ }
+ rShell.EndAllAction();
+ rShell.UnlockPaint();
+ }
+
+ DELETEZ(pDlg);
+ }
+ break;
+ }
+ case FN_INSERT_HRULER:
+ {
+ String sPath;
+ BOOL bSimpleLine = FALSE;
+ BOOL bRet = FALSE;
+ Window* pParent = GetView().GetWindow();
+ if ( pItem )
+ {
+ sPath = ((SfxStringItem*)pItem)->GetValue();
+ SFX_REQUEST_ARG( rReq, pSimple, SfxBoolItem, FN_PARAM_1 , sal_False );
+ if ( pSimple )
+ bSimpleLine = pSimple->GetValue();
+ }
+ else
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractInsertGrfRulerDlg* pDlg = pFact->CreateInsertGrfRulerDlg( DLG_INSERT_RULER,
+ pParent );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ // MessageBox fuer fehlende Grafiken
+ if(!pDlg->HasImages())
+ InfoBox( pParent, SW_RES(MSG_NO_RULER)).Execute();
+ if(RET_OK == pDlg->Execute())
+ {
+ sPath = pDlg->GetGraphicName();
+ bSimpleLine = pDlg->IsSimpleLine();
+ }
+
+ delete pDlg;
+ rReq.AppendItem( SfxStringItem( FN_INSERT_HRULER, sPath ) );
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bSimpleLine ) );
+ }
+
+ rSh.StartAllAction();
+ rSh.StartUndo(UNDO_UI_INSERT_RULER);
+ if(bSimpleLine)
+ {
+ if(!(rSh.IsSttOfPara() && rSh.IsEndOfPara())) // kein leerer Absatz?
+ rSh.SplitNode( FALSE, FALSE ); // dann Platz schaffen
+ rSh.SplitNode( FALSE, FALSE );
+ rSh.Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ rSh.SetTxtFmtColl( rSh.GetTxtCollFromPool( RES_POOLCOLL_HTML_HR ));
+ rSh.Right(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ bRet = TRUE;
+ }
+ else if(sPath.Len())
+ {
+ SwFlyFrmAttrMgr aFrmMgr( TRUE, &rSh, FRMMGR_TYPE_GRF );
+ // am FrmMgr muessen die richtigen Parameter eingestellt werden
+
+ aFrmMgr.SetAnchor(FLY_AS_CHAR);
+
+ rSh.SplitNode( FALSE, FALSE );
+ rSh.SplitNode( FALSE, FALSE );
+ rSh.Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ rSh.SetAttr(SvxAdjustItem(SVX_ADJUST_CENTER,RES_PARATR_ADJUST ));
+ if(GRFILTER_OK == GetView().InsertGraphic(sPath, aEmptyStr, TRUE, 0, 0 ))
+ bRet = TRUE;
+ rSh.EnterStdMode();
+ rSh.Right(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ }
+ rSh.EndAllAction();
+ rSh.EndUndo(UNDO_UI_INSERT_RULER);
+ rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
+ rReq.Done();
+ }
+ break;
+ case FN_FORMAT_COLUMN :
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ VclAbstractDialog* pColDlg = pFact->CreateVclAbstractDialog( GetView().GetWindow(), rSh, DLG_COLUMN);
+ DBG_ASSERT(pColDlg, "Dialogdiet fail!");
+ pColDlg->Execute();
+ delete pColDlg;
+ }
+ break;
+
+ default:
+ ASSERT( !this, "falscher Dispatcher" );
+ return;
+ }
+}
+
+bool lcl_IsMarkInSameSection( SwWrtShell& rWrtSh, const SwSection* pSect )
+{
+ rWrtSh.SwapPam();
+ bool bRet = pSect == rWrtSh.GetCurrSection();
+ rWrtSh.SwapPam();
+ return bRet;
+}
+
+
+void SwTextShell::StateInsert( SfxItemSet &rSet )
+{
+ USHORT nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
+ SfxWhichIter aIter( rSet );
+ SwWrtShell &rSh = GetShell();
+ USHORT nWhich = aIter.FirstWhich();
+ SvtModuleOptions aMOpt;
+ SfxObjectCreateMode eCreateMode =
+ GetView().GetDocShell()->GetCreateMode();
+
+ rSh.Push();
+ const BOOL bCrsrInHidden = rSh.SelectHiddenRange();
+ // --> OD 2009-08-05 #i103839#, #b6855246#
+ // Do not call method <SwCrsrShell::Pop(..)> with 1st parameter = <FALSE>
+ // in order to avoid that the view jumps to the visible cursor.
+ rSh.Pop();
+ // <--
+
+ while ( nWhich )
+ {
+ switch ( nWhich )
+ {
+ case SID_INSERT_SOUND:
+ case SID_INSERT_VIDEO:
+ /*!SvxPluginFileDlg::IsAvailable( nWhich ) ||
+
+ discussed with mba: for performance reasons we skip the IsAvailable call here
+ */
+ if ( GetShell().IsSelFrmMode() ||
+ SFX_CREATE_MODE_EMBEDDED == eCreateMode || bCrsrInHidden )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ case SID_INSERT_DIAGRAM:
+ if( !aMOpt.IsChart() || eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ case FN_INSERT_SMA:
+ if( !aMOpt.IsMath() || eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ case SID_INSERT_FLOATINGFRAME:
+ case SID_INSERT_OBJECT:
+ case SID_INSERT_PLUGIN:
+ {
+ if( eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
+ {
+ rSet.DisableItem( nWhich );
+ }
+ else if( GetShell().IsSelFrmMode())
+ rSet.DisableItem( nWhich );
+ else if(SID_INSERT_FLOATINGFRAME == nWhich && nHtmlMode&HTMLMODE_ON)
+ {
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ USHORT nExport = pHtmlOpt->GetExportMode();
+ if(HTML_CFG_MSIE_40 != nExport && HTML_CFG_WRITER != nExport )
+ rSet.DisableItem(nWhich);
+ }
+ }
+ break;
+ case FN_INSERT_FRAME_INTERACT_NOCOL :
+ case FN_INSERT_FRAME_INTERACT:
+ {
+ if ( GetShell().IsSelFrmMode() ||
+ (0 != (nHtmlMode & HTMLMODE_ON) && 0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS)) || bCrsrInHidden )
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case SID_HYPERLINK_GETLINK:
+ {
+ SfxItemSet aSet(GetPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT);
+ rSh.GetCurAttr( aSet );
+
+ SvxHyperlinkItem aHLinkItem;
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == aSet.GetItemState(RES_TXTATR_INETFMT, FALSE, &pItem))
+ {
+ const SwFmtINetFmt* pINetFmt = (const SwFmtINetFmt*)pItem;
+ aHLinkItem.SetURL(pINetFmt->GetValue());
+ aHLinkItem.SetTargetFrame(pINetFmt->GetTargetFrame());
+ aHLinkItem.SetIntName(pINetFmt->GetName());
+ const SvxMacro *pMacro = pINetFmt->GetMacro( SFX_EVENT_MOUSEOVER_OBJECT );
+ if( pMacro )
+ aHLinkItem.SetMacro(HYPERDLG_EVENT_MOUSEOVER_OBJECT, *pMacro);
+
+ pMacro = pINetFmt->GetMacro( SFX_EVENT_MOUSECLICK_OBJECT );
+ if( pMacro )
+ aHLinkItem.SetMacro(HYPERDLG_EVENT_MOUSECLICK_OBJECT, *pMacro);
+
+ pMacro = pINetFmt->GetMacro( SFX_EVENT_MOUSEOUT_OBJECT );
+ if( pMacro )
+ aHLinkItem.SetMacro(HYPERDLG_EVENT_MOUSEOUT_OBJECT, *pMacro);
+
+ // Text des Links besorgen
+ rSh.StartAction();
+ rSh.CreateCrsr();
+ rSh.SwCrsrShell::SelectTxtAttr(RES_TXTATR_INETFMT,TRUE);
+ String sLinkName = rSh.GetSelTxt();
+ aHLinkItem.SetName(sLinkName);
+ aHLinkItem.SetInsertMode(HLINK_FIELD);
+ rSh.DestroyCrsr();
+ rSh.EndAction();
+ }
+ else
+ {
+ String sReturn = rSh.GetSelTxt();
+ sReturn.Erase(255);
+ sReturn.EraseTrailingChars();
+ aHLinkItem.SetName(sReturn);
+ }
+
+ aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
+ ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
+ aHLinkItem.SetMacroEvents ( HYPERDLG_EVENT_MOUSEOVER_OBJECT|
+ HYPERDLG_EVENT_MOUSECLICK_OBJECT | HYPERDLG_EVENT_MOUSEOUT_OBJECT );
+
+ rSet.Put(aHLinkItem);
+ }
+ break;
+
+ case FN_INSERT_FRAME:
+ if(rSh.IsSelFrmMode())
+ {
+ const int nSel = rSh.GetSelectionType();
+ if( ((nsSelectionType::SEL_GRF | nsSelectionType::SEL_OLE ) & nSel ) || bCrsrInHidden )
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case FN_INSERT_HRULER :
+ if((rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel()) || bCrsrInHidden )
+ rSet.DisableItem(nWhich);
+ break;
+ case FN_FORMAT_COLUMN :
+ {
+ //#i80458# column dialog cannot work if the selection contains different page styles and different sections
+ bool bDisable = true;
+ if( rSh.GetFlyFrmFmt() || rSh.GetSelectedPageDescs() )
+ bDisable = false;
+ if( bDisable )
+ {
+ const SwSection* pCurrSection = rSh.GetCurrSection();
+ USHORT nFullSectCnt = rSh.GetFullSelectedSectionCount();
+ if( pCurrSection && ( !rSh.HasSelection() || 0 != nFullSectCnt ))
+ bDisable = false;
+ else if(
+ rSh.HasSelection() && rSh.IsInsRegionAvailable() &&
+ ( !pCurrSection || ( 1 != nFullSectCnt &&
+ lcl_IsMarkInSameSection( rSh, pCurrSection ) )))
+ bDisable = false;
+ }
+ if(bDisable)
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwTextShell::ExecDelete(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ switch( rReq.GetSlot() )
+ {
+ case FN_DELETE_SENT:
+ if( rSh.IsTableMode() )
+ {
+ rSh.DeleteRow();
+ rSh.EnterStdMode();
+ }
+ else
+ rSh.DelToEndOfSentence();
+ break;
+ case FN_DELETE_BACK_SENT:
+ rSh.DelToStartOfSentence();
+ break;
+ case FN_DELETE_WORD:
+ rSh.DelNxtWord();
+ break;
+ case FN_DELETE_BACK_WORD:
+ rSh.DelPrvWord();
+ break;
+ case FN_DELETE_LINE:
+ rSh.DelToEndOfLine();
+ break;
+ case FN_DELETE_BACK_LINE:
+ rSh.DelToStartOfLine();
+ break;
+ case FN_DELETE_PARA:
+ rSh.DelToEndOfPara();
+ break;
+ case FN_DELETE_BACK_PARA:
+ rSh.DelToStartOfPara();
+ break;
+ case FN_DELETE_WHOLE_LINE:
+ rSh.DelLine();
+ break;
+ default:
+ ASSERT(!this, "falscher Dispatcher");
+ return;
+ }
+ rReq.Done();
+}
+
+void SwTextShell::ExecTransliteration( SfxRequest & rReq )
+{
+ using namespace ::com::sun::star::i18n;
+ {
+ sal_uInt32 nMode = 0;
+
+ switch( rReq.GetSlot() )
+ {
+ case SID_TRANSLITERATE_SENTENCE_CASE:
+ nMode = TransliterationModulesExtra::SENTENCE_CASE;
+ break;
+ case SID_TRANSLITERATE_TITLE_CASE:
+ nMode = TransliterationModulesExtra::TITLE_CASE;
+ break;
+ case SID_TRANSLITERATE_TOGGLE_CASE:
+ nMode = TransliterationModulesExtra::TOGGLE_CASE;
+ break;
+ case SID_TRANSLITERATE_UPPER:
+ nMode = TransliterationModules_LOWERCASE_UPPERCASE;
+ break;
+ case SID_TRANSLITERATE_LOWER:
+ nMode = TransliterationModules_UPPERCASE_LOWERCASE;
+ break;
+
+ case SID_TRANSLITERATE_HALFWIDTH:
+ nMode = TransliterationModules_FULLWIDTH_HALFWIDTH;
+ break;
+ case SID_TRANSLITERATE_FULLWIDTH:
+ nMode = TransliterationModules_HALFWIDTH_FULLWIDTH;
+ break;
+
+ case SID_TRANSLITERATE_HIRAGANA:
+ nMode = TransliterationModules_KATAKANA_HIRAGANA;
+ break;
+ case SID_TRANSLITERATE_KATAGANA:
+ nMode = TransliterationModules_HIRAGANA_KATAKANA;
+ break;
+
+ default:
+ ASSERT(!this, "falscher Dispatcher");
+ }
+
+ if( nMode )
+ GetShell().TransliterateText( nMode );
+ }
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+SwTextShell::SwTextShell(SwView &_rView) :
+ SwBaseShell(_rView), pPostItFldMgr( 0 )
+{
+ SetName(String::CreateFromAscii("Text"));
+ SetHelpId(SW_TEXTSHELL);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwTextShell::~SwTextShell()
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwTextShell::InsertSymbol( SfxRequest& rReq )
+{
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+ if( pArgs )
+ pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), FALSE, &pItem);
+
+ String aChars, aFontName;
+ if ( pItem )
+ {
+ aChars = ((const SfxStringItem*)pItem)->GetValue();
+ const SfxPoolItem* pFtItem = NULL;
+ pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), FALSE, &pFtItem);
+ const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
+ if ( pFontItem )
+ aFontName = pFontItem->GetValue();
+ }
+
+ SwWrtShell &rSh = GetShell();
+ SfxItemSet aSet( GetPool(), RES_CHRATR_FONT, RES_CHRATR_FONT,
+ RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT,
+ RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONT,
+ 0 );
+ rSh.GetCurAttr( aSet );
+ USHORT nScript = rSh.GetScriptType();
+
+ SvxFontItem aFont( RES_CHRATR_FONT );
+ {
+ SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
+ aSetItem.GetItemSet().Put( aSet, FALSE );
+ const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
+ if( pI )
+ aFont = *(SvxFontItem*)pI;
+ else
+ aFont = (SvxFontItem&)aSet.Get( GetWhichOfScript(
+ RES_CHRATR_FONT,
+ GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ) ));
+ if (!aFontName.Len())
+ aFontName = aFont.GetFamilyName();
+ }
+
+ Font aNewFont(aFontName, Size(1,1)); // Size nur wg. CTOR
+ if( !aChars.Len() )
+ {
+ // Eingestellten Font als Default
+ SfxAllItemSet aAllSet( rSh.GetAttrPool() );
+ aAllSet.Put( SfxBoolItem( FN_PARAM_1, FALSE ) );
+
+ SwViewOption aOpt(*GetShell().GetViewOptions());
+ String sSymbolFont = aOpt.GetSymbolFont();
+ if( !aFontName.Len() && sSymbolFont.Len() )
+ aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
+ else
+ aAllSet.Put( SfxStringItem( SID_FONT_NAME, aFont.GetFamilyName() ) );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aAllSet,
+ GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
+ if( RET_OK == pDlg->Execute() )
+ {
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, FALSE );
+ SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, FALSE );
+ if ( pFontItem )
+ {
+ aNewFont.SetName( pFontItem->GetFamilyName() );
+ aNewFont.SetStyleName( pFontItem->GetStyleName() );
+ aNewFont.SetCharSet( pFontItem->GetCharSet() );
+ aNewFont.SetPitch( pFontItem->GetPitch() );
+ }
+
+ if ( pCItem )
+ {
+ aChars = pCItem->GetValue();
+ aOpt.SetSymbolFont(aNewFont.GetName());
+ SW_MOD()->ApplyUsrPref(aOpt, &GetView());
+ }
+ }
+
+ delete pDlg;
+ }
+
+ BOOL bFontChanged = FALSE;
+ if( aChars.Len() )
+ {
+ rSh.StartAllAction();
+
+ // Selektierten Inhalt loeschen
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_SPECIALCHAR));
+
+ rSh.StartUndo( UNDO_INSERT, &aRewriter );
+ if ( rSh.HasSelection() )
+ {
+ rSh.DelRight();
+ aSet.ClearItem();
+ rSh.GetCurAttr( aSet );
+
+ SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
+ aSetItem.GetItemSet().Put( aSet, FALSE );
+ const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
+ if( pI )
+ aFont = *(SvxFontItem*)pI;
+ else
+ aFont = (SvxFontItem&)aSet.Get( GetWhichOfScript(
+ RES_CHRATR_FONT,
+ GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ) ));
+ }
+
+ // Zeichen einfuegen
+ rSh.Insert( aChars );
+
+ // #108876# a font attribute has to be set always due to a guessed script type
+ if( aNewFont.GetName().Len() )
+ {
+ bFontChanged = TRUE;
+ SvxFontItem aNewFontItem( aFont );
+ aNewFontItem.GetFamilyName() = aNewFont.GetName();
+ aNewFontItem.GetFamily() = aNewFont.GetFamily();
+ aNewFontItem.GetPitch() = aNewFont.GetPitch();
+ aNewFontItem.GetCharSet() = aNewFont.GetCharSet();
+
+ SfxItemSet aRestoreSet( GetPool(), RES_CHRATR_FONT, RES_CHRATR_FONT,
+ RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT,
+ RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONT, 0 );
+
+ nScript = pBreakIt->GetAllScriptsOfText( aChars );
+ if( SCRIPTTYPE_LATIN & nScript )
+ {
+ aRestoreSet.Put( aSet.Get( RES_CHRATR_FONT, TRUE ) );
+ aSet.Put( aNewFontItem, RES_CHRATR_FONT);
+ }
+ if( SCRIPTTYPE_ASIAN & nScript )
+ {
+ aRestoreSet.Put( aSet.Get( RES_CHRATR_CJK_FONT, TRUE ) );
+ aSet.Put( aNewFontItem, RES_CHRATR_CJK_FONT );
+ }
+ if( SCRIPTTYPE_COMPLEX & nScript )
+ {
+ aRestoreSet.Put( aSet.Get( RES_CHRATR_CTL_FONT, TRUE ) );
+ aSet.Put( aNewFontItem, RES_CHRATR_CTL_FONT );
+ }
+
+ rSh.SetMark();
+ rSh.ExtendSelection( FALSE, aChars.Len() );
+ rSh.SetAttr( aSet, nsSetAttrMode::SETATTR_DONTEXPAND | nsSetAttrMode::SETATTR_NOFORMATATTR );
+ if( !rSh.IsCrsrPtAtEnd() )
+ rSh.SwapPam();
+
+ rSh.ClearMark();
+
+ // --> FME 2007-07-09 #i75891#
+ // SETATTR_DONTEXPAND does not work if there are already hard attributes.
+ // Therefore we have to restore the font attributes.
+ rSh.SetMark();
+ rSh.SetAttr( aRestoreSet );
+ rSh.ClearMark();
+ // <--
+
+ rSh.UpdateAttr();
+ aFont = aNewFontItem;
+ }
+
+ rSh.EndAllAction();
+ rSh.EndUndo();
+
+ if ( aChars.Len() )
+ {
+ rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), aChars ) );
+ rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aNewFont.GetName() ) );
+ rReq.Done();
+ }
+ }
+}
+
+
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
new file mode 100644
index 000000000000..e084c539da19
--- /dev/null
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -0,0 +1,1790 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <com/sun/star/i18n/WordType.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <svx/dialogs.hrc>
+#include <hintids.hxx>
+#include <cmdid.h>
+#include <helpid.h>
+
+#include <i18npool/mslangid.hxx>
+#include <svl/languageoptions.hxx>
+#include <editeng/langitem.hxx>
+#include <svtools/langtab.hxx>
+#include <svl/slstitm.hxx>
+#include <string.h>
+#include <svl/stritem.hxx>
+#include <svx/htmlmode.hxx>
+#include <svl/whiter.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/objitem.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/unohelp2.hxx>
+#include <sfx2/request.hxx>
+#include <svl/eitem.hxx>
+#include <svl/macitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <editeng/svxacorr.hxx>
+#include <svl/cjkoptions.hxx>
+#include <svl/ctloptions.hxx>
+#include <IDocumentSettingAccess.hxx>
+#include <charfmt.hxx>
+#include <editeng/fontitem.hxx>
+#include <svx/SmartTagItem.hxx>
+#include <svx/dialmgr.hxx>
+#include <fmtinfmt.hxx>
+#include <swwait.hxx>
+#include <wrtsh.hxx>
+#include <wview.hxx>
+#include <swmodule.hxx>
+#include <viewopt.hxx>
+#include <uitool.hxx>
+#include <swevent.hxx>
+#include <fmthdft.hxx>
+#include <pagedesc.hxx>
+#include <textsh.hxx>
+#include <IMark.hxx>
+#include <swdtflvr.hxx>
+#include <docstat.hxx>
+#include <outline.hxx>
+#include <tablemgr.hxx>
+#include <swundo.hxx> // fuer Undo-IDs
+#include <reffld.hxx>
+#include <docsh.hxx>
+#include <mdiexp.hxx>
+#include <inputwin.hxx>
+#include <pardlg.hxx>
+#include <frmatr.hxx>
+#include <fmtcol.hxx>
+#include <cellatr.hxx>
+#include <edtwin.hxx>
+#include <redlndlg.hxx>
+#include "fldmgr.hxx"
+
+#include <globals.hrc>
+#include <shells.hrc>
+#include <app.hrc>
+#include <web.hrc>
+#include "paratr.hxx"
+#include <crsskip.hxx>
+#include <docstat.hxx>
+#include <vcl/svapp.hxx>
+#include <sfx2/app.hxx>
+#include <breakit.hxx>
+
+#include <SwSmartTagMgr.hxx>
+
+#include <editeng/acorrcfg.hxx>
+#include "swabstdlg.hxx"
+#include "misc.hrc"
+#include "chrdlg.hrc"
+#include <IDocumentStatistics.hxx>
+
+#include <sfx2/sfxdlg.hxx>
+#include <svl/languageoptions.hxx>
+#include <unotools/lingucfg.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <editeng/unolingu.hxx>
+#include <unotools/syslocaleoptions.hxx>
+#include <doc.hxx>
+#include <view.hxx>
+#include <ndtxt.hxx>
+#include <pam.hxx>
+#include <sfx2/objface.hxx>
+#include <langhelper.hxx>
+
+using namespace ::com::sun::star;
+
+
+void lcl_CharDialog( SwWrtShell &rWrtSh, BOOL bUseDialog, USHORT nSlot,const SfxItemSet *pArgs, SfxRequest *pReq )
+{
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rWrtSh.GetView()));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)));
+ SfxItemSet aCoreSet( rWrtSh.GetView().GetPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
+ RES_BACKGROUND, RES_BACKGROUND,
+ FN_PARAM_SELECTION, FN_PARAM_SELECTION,
+ SID_HTML_MODE, SID_HTML_MODE,
+ SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
+ 0 );
+ rWrtSh.GetCurAttr( aCoreSet );
+ BOOL bSel = rWrtSh.HasSelection();
+ BOOL bSelectionPut = FALSE;
+ if(bSel || rWrtSh.IsInWord())
+ {
+ if(!bSel)
+ {
+ rWrtSh.StartAction();
+ rWrtSh.Push();
+ if(!rWrtSh.SelectTxtAttr( RES_TXTATR_INETFMT ))
+ rWrtSh.SelWrd();
+ }
+ aCoreSet.Put(SfxStringItem(FN_PARAM_SELECTION, rWrtSh.GetSelTxt()));
+ bSelectionPut = TRUE;
+ if(!bSel)
+ {
+ rWrtSh.Pop(FALSE);
+ rWrtSh.EndAction();
+ }
+ }
+ aCoreSet.Put( SfxUInt16Item( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
+ rWrtSh.GetScalingOfSelectedText() ) );
+ // Das CHRATR_BACKGROUND-Attribut wird fuer den Dialog in
+ // ein RES_BACKGROUND verwandelt und wieder zurueck ...
+ const SfxPoolItem *pTmpBrush;
+ if( SFX_ITEM_SET == aCoreSet.GetItemState( RES_CHRATR_BACKGROUND, TRUE, &pTmpBrush ) )
+ {
+ SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
+ aTmpBrush.SetWhich( RES_BACKGROUND );
+ aCoreSet.Put( aTmpBrush );
+ }
+
+ aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(rWrtSh.GetView().GetDocShell())));
+ SfxAbstractTabDialog* pDlg = NULL;
+ if ( bUseDialog && GetActiveView() )
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ pDlg = pFact->CreateSwCharDlg( rWrtSh.GetView().GetWindow(), rWrtSh.GetView(), aCoreSet, DLG_CHAR );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if( FN_INSERT_HYPERLINK == nSlot )
+ pDlg->SetCurPageId(TP_CHAR_URL);
+ }
+
+ const SfxItemSet* pSet = NULL;
+ if ( !bUseDialog )
+ pSet = pArgs;
+ else if ( NULL != pDlg && pDlg->Execute() == RET_OK ) /* #110771# pDlg can be NULL */
+ {
+ pSet = pDlg->GetOutputItemSet();
+ }
+
+ if ( pSet)
+ {
+ SfxItemSet aTmpSet( *pSet );
+ if( SFX_ITEM_SET == aTmpSet.GetItemState( RES_BACKGROUND, FALSE, &pTmpBrush ) )
+ {
+ SvxBrushItem aTmpBrush( *((SvxBrushItem*)pTmpBrush) );
+ aTmpBrush.SetWhich( RES_CHRATR_BACKGROUND );
+ aTmpSet.Put( aTmpBrush );
+ }
+
+ aTmpSet.ClearItem( RES_BACKGROUND );
+
+ const SfxPoolItem* pSelectionItem;
+ BOOL bInsert = FALSE;
+ xub_StrLen nInsert = 0;
+
+ // aus ungeklaerter Ursache ist das alte Item wieder im Set
+ if( !bSelectionPut && SFX_ITEM_SET == aTmpSet.GetItemState(FN_PARAM_SELECTION, FALSE, &pSelectionItem) )
+ {
+ String sInsert = ((const SfxStringItem*)pSelectionItem)->GetValue();
+ bInsert = sInsert.Len() != 0;
+ if(bInsert)
+ {
+ nInsert = sInsert.Len();
+ rWrtSh.StartAction();
+ rWrtSh.Insert( sInsert );
+ rWrtSh.SetMark();
+ rWrtSh.ExtendSelection(FALSE, sInsert.Len());
+ SfxRequest aReq( rWrtSh.GetView().GetViewFrame(), FN_INSERT_STRING );
+ aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, sInsert ) );
+ aReq.Done();
+ SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_LEFT );
+ aReq1.AppendItem( SfxInt16Item(FN_PARAM_MOVE_COUNT, nInsert) );
+ aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, TRUE) );
+ aReq1.Done();
+ }
+ }
+ aTmpSet.ClearItem(FN_PARAM_SELECTION);
+
+ SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl();
+ if(bSel && rWrtSh.IsSelFullPara() && pColl && pColl->IsAutoUpdateFmt())
+ {
+ rWrtSh.AutoUpdatePara(pColl, aTmpSet);
+ }
+ else
+ rWrtSh.SetAttr( aTmpSet );
+ if (pReq)
+ pReq->Done(aTmpSet);
+ if(bInsert)
+ {
+ SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_RIGHT );
+ aReq1.AppendItem( SfxInt16Item(FN_PARAM_MOVE_COUNT, nInsert) );
+ aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, FALSE) );
+ aReq1.Done();
+ rWrtSh.SwapPam();
+ rWrtSh.ClearMark();
+ rWrtSh.DontExpandFmt();
+ rWrtSh.EndAction();
+ }
+ }
+
+ delete pDlg;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+short lcl_AskRedlineMode(Window *pWin)
+{
+ MessBox aQBox( pWin, 0,
+ String( SW_RES( STR_REDLINE_TITLE ) ),
+ String( SW_RES( STR_REDLINE_MSG ) ) );
+ aQBox.SetImage( QueryBox::GetStandardImage() );
+ USHORT nBtnFlags = BUTTONDIALOG_DEFBUTTON |
+ BUTTONDIALOG_OKBUTTON |
+ BUTTONDIALOG_FOCUSBUTTON;
+
+ aQBox.AddButton(String(SW_RES(STR_REDLINE_ACCEPT_ALL)), RET_OK, nBtnFlags);
+ aQBox.GetPushButton( RET_OK )->SetHelpId(HID_AUTOFORMAT_ACCEPT);
+ aQBox.AddButton(String(SW_RES(STR_REDLINE_REJECT_ALL)), RET_CANCEL, BUTTONDIALOG_CANCELBUTTON);
+ aQBox.GetPushButton( RET_CANCEL )->SetHelpId(HID_AUTOFORMAT_REJECT );
+ aQBox.AddButton(String(SW_RES(STR_REDLINE_EDIT)), 2, 0);
+ aQBox.GetPushButton( 2 )->SetHelpId(HID_AUTOFORMAT_EDIT_CHG);
+ aQBox.SetButtonHelpText( RET_OK, aEmptyStr );
+
+ return aQBox.Execute();
+}
+
+void SwTextShell::Execute(SfxRequest &rReq)
+{
+ BOOL bUseDialog = TRUE;
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ SwWrtShell& rWrtSh = GetShell();
+ const SfxPoolItem* pItem = 0;
+ USHORT nSlot = rReq.GetSlot();
+ if(pArgs)
+ pArgs->GetItemState(GetPool().GetWhich(nSlot), FALSE, &pItem);
+ switch( nSlot )
+ {
+ case SID_LANGUAGE_STATUS:
+ {
+ // get the language
+ String aNewLangTxt;
+ SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_LANGUAGE_STATUS , sal_False );
+ if (pItem2)
+ aNewLangTxt = pItem2->GetValue();
+
+ //!! Remember the view frame right now...
+ //!! (call to GetView().GetViewFrame() will break if the
+ //!! SwTextShell got destroyed meanwhile.)
+ SfxViewFrame *pViewFrame = GetView().GetViewFrame();
+
+ if (aNewLangTxt.EqualsAscii( "*" ))
+ {
+ // open the dialog "Tools/Options/Language Settings - Language"
+ // to set the documents default language
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ if (pFact)
+ {
+ VclAbstractDialog* pDlg = pFact->CreateVclDialog( GetView().GetWindow(), SID_LANGUAGE_OPTIONS );
+ pDlg->Execute();
+ delete pDlg;
+ }
+ }
+ else
+ {
+ //!! We have to use StartAction / EndAction bracketing in
+ //!! order to prevent possible destruction of the SwTextShell
+ //!! due to the selection changes coming below.
+ rWrtSh.StartAction();
+ // prevent view from jumping because of (temporary) selection changes
+ rWrtSh.LockView( TRUE );
+ // save selection for later restoration
+ rWrtSh.Push();
+
+ // setting the new language...
+ if (aNewLangTxt.Len() > 0)
+ {
+ const String aSelectionLangPrefix( String::CreateFromAscii("Current_") );
+ const String aParagraphLangPrefix( String::CreateFromAscii("Paragraph_") );
+ const String aDocumentLangPrefix( String::CreateFromAscii("Default_") );
+ const String aStrNone( String::CreateFromAscii("LANGUAGE_NONE") );
+ const String aStrResetLangs( String::CreateFromAscii("RESET_LANGUAGES") );
+
+ SfxItemSet aCoreSet( GetPool(),
+ RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
+ RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
+ RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
+ 0 );
+
+ xub_StrLen nPos = 0;
+ bool bForSelection = true;
+ bool bForParagraph = false;
+ if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aSelectionLangPrefix, 0 )))
+ {
+ // ... for the current selection
+ aNewLangTxt = aNewLangTxt.Erase( nPos, aSelectionLangPrefix.Len() );
+ bForSelection = true;
+ }
+ else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aParagraphLangPrefix , 0 )))
+ {
+ // ... for the current paragraph language
+ aNewLangTxt = aNewLangTxt.Erase( nPos, aParagraphLangPrefix.Len() );
+ bForSelection = true;
+ bForParagraph = true;
+ }
+ else if (STRING_NOTFOUND != (nPos = aNewLangTxt.Search( aDocumentLangPrefix , 0 )))
+ {
+ // ... as default document language
+ aNewLangTxt = aNewLangTxt.Erase( nPos, aDocumentLangPrefix.Len() );
+ bForSelection = false;
+ }
+
+ if (bForParagraph)
+ SwLangHelper::SelectCurrentPara( rWrtSh );
+
+ if (!bForSelection) // document language to be changed...
+ {
+ rWrtSh.SelAll();
+ rWrtSh.ExtendedSelectAll();
+ }
+ if (aNewLangTxt == aStrNone)
+ SwLangHelper::SetLanguage_None( rWrtSh, bForSelection, aCoreSet );
+ else if (aNewLangTxt == aStrResetLangs)
+ SwLangHelper::ResetLanguages( rWrtSh, bForSelection );
+ else
+ SwLangHelper::SetLanguage( rWrtSh, aNewLangTxt, bForSelection, aCoreSet );
+ }
+
+ // restore selection...
+ rWrtSh.Pop( FALSE );
+
+ rWrtSh.LockView( FALSE );
+ rWrtSh.EndAction();
+ }
+
+ // invalidate slot to get the new language displayed
+ pViewFrame->GetBindings().Invalidate( nSlot );
+
+ rReq.Done();
+ break;
+ }
+
+ case SID_THES:
+ {
+ // replace word/selection with text from selected sub menu entry
+ String aReplaceText;
+ SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES , sal_False );
+ if (pItem2)
+ aReplaceText = pItem2->GetValue();
+ if (aReplaceText.Len() > 0)
+ {
+ SwView &rView2 = rWrtSh.GetView();
+ const bool bSelection = rWrtSh.HasSelection();
+ const String aLookUpText = rView2.GetThesaurusLookUpText( bSelection );
+ rView2.InsertThesaurusSynonym( aReplaceText, aLookUpText, bSelection );
+ }
+ }
+ break;
+
+ case SID_CHARMAP:
+ {
+ InsertSymbol( rReq );
+ }
+ break;
+ case FN_INSERT_FOOTNOTE:
+ case FN_INSERT_ENDNOTE:
+ {
+ String aStr;
+ SFX_REQUEST_ARG( rReq, pFont, SfxStringItem, FN_PARAM_1 , sal_False );
+// SFX_REQUEST_ARG( rReq, pCharset, SfxInt16Item, FN_PARAM_2 , sal_False );
+ SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, nSlot , sal_False );
+ if ( pNameItem )
+ aStr = pNameItem->GetValue();
+ BOOL bFont = pFont && pFont->GetValue().Len();
+ rWrtSh.StartUndo( UNDO_UI_INSERT_FOOTNOTE );
+ rWrtSh.InsertFootnote( aStr, nSlot == FN_INSERT_ENDNOTE, !bFont );
+ if ( bFont )
+ {
+ rWrtSh.Left( CRSR_SKIP_CHARS, TRUE, 1, FALSE );
+ SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT );
+ rWrtSh.GetCurAttr( aSet );
+ SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT );
+ SvxFontItem aFont( rFont.GetFamily(), pFont->GetValue(),
+ rFont.GetStyleName(), rFont.GetPitch(), RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT );
+ //pCharset ? (CharSet) pCharset->GetValue() : RTL_TEXTENCODING_DONTKNOW );
+ rWrtSh.SetAttr( aSet, nsSetAttrMode::SETATTR_DONTEXPAND );
+ rWrtSh.ResetSelect(0, FALSE);
+ rWrtSh.EndSelect();
+ rWrtSh.GotoFtnTxt();
+ }
+ rWrtSh.EndUndo( UNDO_UI_INSERT_FOOTNOTE );
+ rReq.Done();
+ }
+ break;
+ case FN_INSERT_FOOTNOTE_DLG:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractInsFootNoteDlg* pDlg = pFact->CreateInsFootNoteDlg( DLG_INS_FOOTNOTE,
+ GetView().GetWindow(), rWrtSh, FALSE );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->SetHelpId(GetStaticInterface()->GetSlot(nSlot)->GetCommand());
+ if ( pDlg->Execute() == RET_OK )
+ {
+ USHORT nId = pDlg->IsEndNote() ? FN_INSERT_ENDNOTE : FN_INSERT_FOOTNOTE;
+ SfxRequest aReq( GetView().GetViewFrame(), nId );
+ if ( pDlg->GetStr().Len() )
+ aReq.AppendItem( SfxStringItem( nId, pDlg->GetStr() ) );
+ if ( pDlg->GetFontName().Len() )
+ aReq.AppendItem( SfxStringItem( FN_PARAM_1, pDlg->GetFontName() ) );
+ //aReq.AppendItem( SfxStringItem( FN_PARAM_2, pDlg->GetCharSet() ) );
+ ExecuteSlot( aReq );
+ }
+
+ rReq.Ignore();
+ delete pDlg;
+ }
+ break;
+ case FN_FORMAT_FOOTNOTE_DLG:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg( GetView().GetWindow(), rWrtSh, DLG_DOC_FOOTNOTE );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ break;
+ }
+ case SID_INSERTDOC:
+ {
+ GetView().ExecuteInsertDoc( rReq, pItem );
+ break;
+ }
+ case FN_FORMAT_RESET:
+ {
+ // #i78856, reset all attributes but not the language attributes
+ // (for this build an array of all relevant attributes and
+ // remove the languages from that)
+ SvUShortsSort aAttribs;
+
+ USHORT __FAR_DATA aResetableSetRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_CHRATR_BEGIN, RES_CHRATR_LANGUAGE - 1,
+ RES_CHRATR_LANGUAGE + 1, RES_CHRATR_CJK_LANGUAGE - 1,
+ RES_CHRATR_CJK_LANGUAGE + 1, RES_CHRATR_CTL_LANGUAGE - 1,
+ RES_CHRATR_CTL_LANGUAGE + 1, RES_CHRATR_END-1,
+ RES_PARATR_BEGIN, RES_PARATR_END-1,
+ RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
+ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+ RES_TXTATR_CJK_RUBY, RES_TXTATR_CJK_RUBY,
+ RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0
+ };
+ USHORT __FAR_DATA *pUShorts = aResetableSetRange;
+ while (*pUShorts)
+ {
+ USHORT nL = pUShorts[1] - pUShorts[0] + 1;
+ USHORT nE = pUShorts[0];
+ for (USHORT i = 0; i < nL; ++i)
+ aAttribs.Insert( nE++ );
+ pUShorts += 2;
+ }
+
+ rWrtSh.ResetAttr( &aAttribs );
+ rReq.Done();
+ break;
+ }
+ case FN_INSERT_BREAK_DLG:
+ {
+ USHORT nKind=0, nPageNumber=0;
+ String aTemplateName;
+ if ( pItem )
+ {
+ nKind = ((SfxInt16Item*)pItem)->GetValue();
+ SFX_REQUEST_ARG( rReq, pTemplate, SfxStringItem, FN_PARAM_1 , sal_False );
+ SFX_REQUEST_ARG( rReq, pNumber, SfxUInt16Item, FN_PARAM_2 , sal_False );
+ if ( pTemplate )
+ aTemplateName = pTemplate->GetValue();
+ if ( pNumber )
+ nPageNumber = pNumber->GetValue();
+ }
+ else
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwBreakDlg* pDlg = pFact->CreateSwBreakDlg( GetView().GetWindow(), rWrtSh, DLG_BREAK );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if ( pDlg->Execute() == RET_OK )
+ {
+ nKind = pDlg->GetKind();
+ aTemplateName = pDlg->GetTemplateName();
+ nPageNumber = pDlg->GetPageNumber();
+ rReq.AppendItem( SfxInt16Item( FN_INSERT_BREAK_DLG, nKind ) );
+ rReq.AppendItem( SfxUInt16Item( FN_PARAM_2, nPageNumber ) );
+ rReq.AppendItem( SfxStringItem( FN_PARAM_1, aTemplateName ) );
+ rReq.Done();
+ }
+ else
+ rReq.Ignore();
+ delete pDlg;
+ }
+
+ switch ( nKind )
+ {
+ case 1 :
+ rWrtSh.InsertLineBreak(); break;
+ case 2 :
+ rWrtSh.InsertColumnBreak(); break;
+ case 3 :
+ {
+ rWrtSh.StartAllAction();
+ if( aTemplateName.Len() )
+ rWrtSh.InsertPageBreak( &aTemplateName, nPageNumber );
+ else
+ rWrtSh.InsertPageBreak();
+ rWrtSh.EndAllAction();
+ }
+ }
+
+ break;
+ }
+ case FN_INSERT_BOOKMARK:
+ {
+ if ( pItem )
+ {
+ ::rtl::OUString sName = ((SfxStringItem*)pItem)->GetValue();
+ rWrtSh.SetBookmark( KeyCode(), sName, aEmptyStr );
+ }
+ else
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ VclAbstractDialog* pDlg = pFact->CreateSwInsertBookmarkDlg( GetView().GetWindow(), rWrtSh, rReq, DLG_INSERT_BOOKMARK );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ }
+
+ break;
+ }
+ case FN_DELETE_BOOKMARK:
+ {
+ if ( pItem )
+ {
+ IDocumentMarkAccess* const pMarkAccess = rWrtSh.getIDocumentMarkAccess();
+ pMarkAccess->deleteMark( pMarkAccess->findMark(((SfxStringItem*)pItem)->GetValue()) );
+ }
+ break;
+ }
+ case FN_AUTOFORMAT_REDLINE_APPLY:
+ {
+ SvxSwAutoFmtFlags aFlags(SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags());
+ // das muss fuer die Nachbearbeitung immer FALSE sein
+ aFlags.bAFmtByInput = FALSE;
+ aFlags.bWithRedlining = TRUE;
+ rWrtSh.AutoFormat( &aFlags );
+ aFlags.bWithRedlining = FALSE;
+
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ if (pVFrame->HasChildWindow(FN_REDLINE_ACCEPT))
+ pVFrame->ToggleChildWindow(FN_REDLINE_ACCEPT);
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwModalRedlineAcceptDlg* pDlg = pFact->CreateSwModalRedlineAcceptDlg( &GetView().GetEditWin(), DLG_MOD_REDLINE_ACCEPT );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+
+ switch (lcl_AskRedlineMode(&GetView().GetEditWin()))
+ {
+ case RET_OK:
+ {
+ pDlg->AcceptAll(TRUE);
+ SfxRequest aReq( pVFrame, FN_AUTOFORMAT_APPLY );
+ aReq.Done();
+ rReq.Ignore();
+ break;
+ }
+
+ case RET_CANCEL:
+ pDlg->AcceptAll(FALSE);
+ rReq.Ignore();
+ break;
+
+ case 2:
+ pDlg->Execute();
+ rReq.Done();
+ break;
+ }
+ delete pDlg;
+ }
+ break;
+
+ case FN_AUTOFORMAT_APPLY:
+ {
+ SvxSwAutoFmtFlags aFlags(SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags());
+ // das muss fuer die Nachbearbeitung immer FALSE sein
+ aFlags.bAFmtByInput = FALSE;
+ rWrtSh.AutoFormat( &aFlags );
+ rReq.Done();
+ }
+ break;
+ case FN_AUTOFORMAT_AUTO:
+ {
+ SvxAutoCorrCfg* pACfg = SvxAutoCorrCfg::Get();
+ BOOL bSet = pItem ? ((const SfxBoolItem*)pItem)->GetValue() : !pACfg->IsAutoFmtByInput();
+ if( bSet != pACfg->IsAutoFmtByInput() )
+ {
+ pACfg->SetAutoFmtByInput( bSet );
+ GetView().GetViewFrame()->GetBindings().Invalidate( nSlot );
+ if ( !pItem )
+ rReq.AppendItem( SfxBoolItem( GetPool().GetWhich(nSlot), bSet ) );
+ rReq.Done();
+ }
+ }
+ break;
+ case FN_AUTO_CORRECT:
+ {
+ // erstmal auf Blank defaulten
+ sal_Unicode cChar = ' ';
+ rWrtSh.AutoCorrect( *SvxAutoCorrCfg::Get()->GetAutoCorrect(), cChar );
+ rReq.Done();
+ }
+ break;
+ case FN_TABLE_SORT_DIALOG:
+ case FN_SORTING_DLG:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ VclAbstractDialog* pDlg = pFact->CreateVclAbstractDialog( GetView().GetWindow(), rWrtSh, DLG_SORTING );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ rReq.Done();
+ }
+ break;
+ case FN_NUMBERING_OUTLINE_DLG:
+ {
+ SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
+ GetView().GetWindow(), &aTmp, rWrtSh);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ rReq.Done();
+ }
+ break;
+ case FN_CALCULATE:
+ {
+ SwTransferable* pTransfer = new SwTransferable( rWrtSh );
+/*??*/ uno::Reference<
+ datatransfer::XTransferable > xRef(
+ pTransfer );
+ pTransfer->CalculateAndCopy();
+ rReq.Done();
+ }
+ break;
+ case FN_GOTO_REFERENCE:
+ {
+ SwField *pFld = rWrtSh.GetCurFld();
+ if(pFld && pFld->GetTypeId() == TYP_GETREFFLD)
+ {
+ rWrtSh.StartAllAction();
+ rWrtSh.SwCrsrShell::GotoRefMark( ((SwGetRefField*)pFld)->GetSetRefName(),
+ ((SwGetRefField*)pFld)->GetSubType(),
+ ((SwGetRefField*)pFld)->GetSeqNo() );
+ rWrtSh.EndAllAction();
+ rReq.Done();
+ }
+ }
+ break;
+ case FN_EDIT_FORMULA:
+ {
+ const USHORT nId = SwInputChild::GetChildWindowId();
+ SfxViewFrame* pVFrame = GetView().GetViewFrame();
+ if(pItem)
+ {
+ //if the ChildWindow is active it has to be removed
+ if( pVFrame->HasChildWindow( nId ) )
+ {
+ pVFrame->ToggleChildWindow( nId );
+ pVFrame->GetBindings().InvalidateAll( TRUE );
+ }
+
+ String sFormula(((const SfxStringItem*)pItem)->GetValue());
+ SwFldMgr aFldMgr;
+ rWrtSh.StartAllAction();
+ BOOL bDelSel;
+ if( 0 != (bDelSel = rWrtSh.HasSelection()) )
+ {
+ rWrtSh.StartUndo( UNDO_START );
+ rWrtSh.DelRight();
+ }
+ else
+ {
+ rWrtSh.EnterStdMode();
+ }
+
+ if( !bDelSel && aFldMgr.GetCurFld() && TYP_FORMELFLD == aFldMgr.GetCurTypeId() )
+ aFldMgr.UpdateCurFld( aFldMgr.GetCurFld()->GetFormat(), aEmptyStr, sFormula );
+ else if( sFormula.Len() )
+ {
+ if( rWrtSh.IsCrsrInTbl() )
+ {
+ SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
+ aSet.Put( SwTblBoxFormula( sFormula ));
+ rWrtSh.SetTblBoxFormulaAttrs( aSet );
+ rWrtSh.UpdateTable();
+ }
+ else
+ {
+ SvNumberFormatter* pFormatter = rWrtSh.GetNumberFormatter();
+ ULONG nSysNumFmt = pFormatter->GetFormatIndex( NF_NUMBER_STANDARD, LANGUAGE_SYSTEM);
+ SwInsertFld_Data aData(TYP_FORMELFLD, nsSwGetSetExpType::GSE_FORMULA, aEmptyStr, sFormula, nSysNumFmt);
+ aFldMgr.InsertFld(aData);
+ }
+ }
+
+ if( bDelSel )
+ rWrtSh.EndUndo( UNDO_END );
+ rWrtSh.EndAllAction();
+ rReq.Done();
+ }
+ else
+ {
+ rWrtSh.EndAllTblBoxEdit();
+ pVFrame->ToggleChildWindow( nId );
+ if( !pVFrame->HasChildWindow( nId ) )
+ pVFrame->GetBindings().InvalidateAll( TRUE );
+ rReq.Ignore();
+ }
+ }
+
+ break;
+ case FN_TABLE_UNSET_READ_ONLY:
+ {
+ rWrtSh.UnProtectTbls();
+ }
+ break;
+ case FN_EDIT_HYPERLINK:
+ GetView().GetViewFrame()->ToggleChildWindow(SID_HYPERLINK_DIALOG);
+ break;
+ case FN_REMOVE_HYPERLINK:
+ {
+ BOOL bSel = rWrtSh.HasSelection();
+ if(!bSel)
+ {
+ rWrtSh.StartAction();
+ rWrtSh.Push();
+ if(!rWrtSh.SelectTxtAttr( RES_TXTATR_INETFMT ))
+ rWrtSh.SelWrd();
+ }
+ //now remove the attribute
+ SvUShortsSort aAttribs;
+ aAttribs.Insert( RES_TXTATR_INETFMT );
+ rWrtSh.ResetAttr( &aAttribs );
+ if(!bSel)
+ {
+ rWrtSh.Pop(FALSE);
+ rWrtSh.EndAction();
+ }
+ }
+ break;
+ case SID_ATTR_BRUSH_CHAR :
+ case SID_ATTR_CHAR_SCALEWIDTH :
+ case SID_ATTR_CHAR_ROTATED :
+ case FN_TXTATR_INET :
+ case FN_INSERT_HYPERLINK:
+ {
+ USHORT nWhich = GetPool().GetWhich( nSlot );
+ if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET )
+ bUseDialog = FALSE;
+ // intentionally no break
+ }
+ case SID_CHAR_DLG:
+ {
+ lcl_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
+ }
+ break;
+ case SID_CHAR_DLG_FOR_PARAGRAPH:
+ {
+ rWrtSh.Push(); //save current cursor
+ SwLangHelper::SelectCurrentPara( rWrtSh );
+ lcl_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
+ rWrtSh.Pop( FALSE ); //restore old cursor
+ }
+ break;
+ case SID_ATTR_LRSPACE :
+ case SID_ATTR_ULSPACE :
+ case SID_ATTR_BRUSH :
+ case SID_PARA_VERTALIGN :
+ case SID_ATTR_PARA_NUMRULE :
+ case SID_ATTR_PARA_REGISTER :
+ case SID_ATTR_PARA_PAGENUM :
+ case FN_FORMAT_LINENUMBER :
+ case FN_NUMBER_NEWSTART :
+ case FN_NUMBER_NEWSTART_AT :
+ case FN_FORMAT_DROPCAPS :
+ case FN_DROP_TEXT:
+ {
+ USHORT nWhich = GetPool().GetWhich( nSlot );
+ if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET )
+ bUseDialog = FALSE;
+ // intentionally no break
+
+ }
+ case SID_PARA_DLG:
+ {
+ FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
+ SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< UINT16 >(eMetric)));
+ SfxItemSet aCoreSet( GetPool(),
+ RES_PARATR_BEGIN, RES_PARATR_END - 1,
+ // --> OD 2008-02-25 #refactorlists#
+ RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
+ // <--
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
+ SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS,
+ SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS,
+ SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
+ SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
+ SID_HTML_MODE, SID_HTML_MODE,
+ FN_PARAM_1, FN_PARAM_1,
+ FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART_AT,
+ FN_DROP_TEXT, FN_DROP_CHAR_STYLE_NAME,
+ 0);
+ // --> OD 2008-01-16 #newlistlevelattrs#
+ // get also the list level indent values merged as LR-SPACE item, if needed.
+ rWrtSh.GetCurAttr( aCoreSet, true );
+ // <--
+ aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE,
+ ::GetHtmlMode(GetView().GetDocShell())));
+
+ // Tabulatoren, DefaultTabs ins ItemSet Stecken
+ const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&)
+ GetPool().GetDefaultItem(RES_PARATR_TABSTOP);
+
+ USHORT nDefDist = ::GetTabDist( rDefTabs );
+ SfxUInt16Item aDefDistItem( SID_ATTR_TABSTOP_DEFAULTS, nDefDist );
+ aCoreSet.Put( aDefDistItem );
+
+ // Aktueller Tab
+ SfxUInt16Item aTabPos( SID_ATTR_TABSTOP_POS, 0 );
+ aCoreSet.Put( aTabPos );
+
+ // linker Rand als Offset
+ //#i24363# tab stops relative to indent
+ const long nOff = rWrtSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) ?
+ ((SvxLRSpaceItem&)aCoreSet.Get( RES_LR_SPACE )).GetTxtLeft() : 0;
+ SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
+ aCoreSet.Put( aOff );
+
+ // BoxInfo setzen
+ ::PrepareBoxInfo( aCoreSet, rWrtSh );
+
+ //aktuelles Seitenformat
+ ::SwToSfxPageDescAttr( aCoreSet );
+
+ UINT16 nDefPage = 0;
+ if( pItem )
+ nDefPage = ((SfxUInt16Item *)pItem)->GetValue();
+
+ // Numerierungseigenschaften
+ if(rWrtSh.GetCurNumRule())
+ {
+ SfxBoolItem aStart( FN_NUMBER_NEWSTART, rWrtSh.IsNumRuleStart() );
+ aCoreSet.Put(aStart);
+ // --> OD 2008-02-29 #refactorlists#
+// SfxUInt16Item aStartAt(FN_NUMBER_NEWSTART_AT,
+// rWrtSh.IsNodeNumStart());
+ SfxUInt16Item aStartAt( FN_NUMBER_NEWSTART_AT,
+ rWrtSh.GetNodeNumStart() );
+ // <--
+ aCoreSet.Put(aStartAt);
+ }
+ SfxAbstractTabDialog* pDlg = NULL;
+
+ if ( bUseDialog && GetActiveView() )
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ pDlg = pFact->CreateSwParaDlg( GetView().GetWindow(),GetView(), aCoreSet,DLG_STD, DLG_PARA,NULL, FALSE, nDefPage );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ }
+ SfxItemSet* pSet = NULL;
+ if ( !bUseDialog )
+ {
+ pSet = (SfxItemSet*) pArgs;
+
+ }
+ else if ( NULL != pDlg && pDlg->Execute() == RET_OK )
+ {
+ // Defaults evtl umsetzen
+ pSet = (SfxItemSet*)pDlg->GetOutputItemSet();
+ USHORT nNewDist;
+ if( SFX_ITEM_SET == pSet->GetItemState( SID_ATTR_TABSTOP_DEFAULTS, FALSE, &pItem ) &&
+ nDefDist != (nNewDist = ((SfxUInt16Item*)pItem)->GetValue()) )
+ {
+ SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
+ MakeDefTabs( nNewDist, aDefTabs );
+ rWrtSh.SetDefault( aDefTabs );
+ pSet->ClearItem( SID_ATTR_TABSTOP_DEFAULTS );
+ }
+
+ if ( SFX_ITEM_SET == pSet->GetItemState(FN_PARAM_1,FALSE,&pItem) )
+ {
+ pSet->Put(SfxStringItem(FN_DROP_TEXT, ((const SfxStringItem*)pItem)->GetValue()));
+ pSet->ClearItem(FN_PARAM_1);
+ }
+
+ if( SFX_ITEM_SET == pSet->GetItemState( RES_PARATR_DROP, FALSE, &pItem ))
+ {
+ String sCharStyleName;
+ if(((const SwFmtDrop*)pItem)->GetCharFmt())
+ sCharStyleName = ((const SwFmtDrop*)pItem)->GetCharFmt()->GetName();
+ pSet->Put(SfxStringItem(FN_DROP_CHAR_STYLE_NAME, sCharStyleName));
+ }
+ }
+
+ if ( pSet )
+ {
+ rReq.Done( *pSet );
+ ::SfxToSwPageDescAttr( rWrtSh, *pSet );
+ // --> OD 2006-12-06 #i56253#
+ // enclose all undos.
+ // Thus, check conditions, if actions will be performed.
+ const bool bUndoNeeded( pSet->Count() ||
+ SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART) ||
+ SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) );
+ if ( bUndoNeeded )
+ {
+ rWrtSh.StartUndo( UNDO_INSATTR );
+ }
+ // <--
+ if( pSet->Count() )
+ {
+ rWrtSh.StartAction();
+// rWrtSh.StartUndo( UNDO_START );
+ if ( SFX_ITEM_SET == pSet->GetItemState(FN_DROP_TEXT, FALSE, &pItem) )
+ {
+ if ( ((SfxStringItem*)pItem)->GetValue().Len() )
+ rWrtSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue());
+ }
+ rWrtSh.SetAttr( *pSet );
+// rWrtSh.EndUndo( UNDO_END );
+ rWrtSh.EndAction();
+ SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl();
+ if(pColl && pColl->IsAutoUpdateFmt())
+ {
+ rWrtSh.AutoUpdatePara(pColl, *pSet);
+ }
+ }
+
+ if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART) )
+ {
+ //SetNumRuleStart(TRUE) restarts the numbering at the value
+ //that is defined at the starting point of the numbering level
+ //otherwise the SetNodeNumStart() value determines the start
+ //if it's set to something different than USHRT_MAX
+
+ BOOL bStart = ((SfxBoolItem&)pSet->Get(FN_NUMBER_NEWSTART)).GetValue();
+ // --> OD 2007-06-11 #b6560525#
+ // Default value for restart value has to be USHRT_MAX
+ // in order to indicate that the restart value of the list
+ // style has to be used on restart.
+ USHORT nNumStart = USHRT_MAX;
+ // <--
+ if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
+ {
+ nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
+ }
+ rWrtSh.SetNumRuleStart(bStart);
+ rWrtSh.SetNodeNumStart(nNumStart);
+ }
+ else if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
+ {
+ USHORT nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
+ rWrtSh.SetNodeNumStart(nNumStart);
+ rWrtSh.SetNumRuleStart(FALSE);
+ }
+ // --> OD 2006-12-06 #i56253#
+ if ( bUndoNeeded )
+ {
+ rWrtSh.EndUndo( UNDO_INSATTR );
+ }
+ // <--
+ }
+
+ delete pDlg;
+ }
+ break;
+ case FN_NUM_CONTINUE:
+ {
+ // --> OD 2008-03-18 #refactorlists#
+ String sContinuedListId;
+ const SwNumRule* pRule =
+ rWrtSh.SearchNumRule( false, true, false, -1, sContinuedListId );
+ // --> OD 2009-08-26 #i86492#
+ // Search also for bullet list
+ if ( !pRule )
+ {
+ pRule = rWrtSh.SearchNumRule( false, false, false, -1, sContinuedListId );
+ }
+ // <--
+ if ( pRule )
+ {
+ rWrtSh.SetCurNumRule( *pRule, false, sContinuedListId );
+ }
+ // <--
+ }
+ break;
+ case FN_SELECT_PARA:
+ {
+ if(!rWrtSh.IsSttOfPara())
+ rWrtSh.SttPara(FALSE);
+ else
+ rWrtSh.EnterStdMode();
+ rWrtSh.EndPara(TRUE);
+ }
+ break;
+
+ case SID_DEC_INDENT:
+ case SID_INC_INDENT:
+ rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot,
+ rReq.GetModifier() != KEY_MOD1 );
+ rReq.Done();
+ break;
+ case FN_DEC_INDENT_OFFSET:
+ case FN_INC_INDENT_OFFSET:
+ rWrtSh.MoveLeftMargin( FN_INC_INDENT_OFFSET == nSlot,
+ rReq.GetModifier() == KEY_MOD1 );
+ rReq.Done();
+ break;
+
+ case SID_ATTR_CHAR_COLOR2:
+ {
+ if(pItem)
+ {
+ Color aSet = ((const SvxColorItem*)pItem)->GetValue();
+ SwEditWin& rEditWin = GetView().GetEditWin();
+ rEditWin.SetTextColor(aSet);
+ SwApplyTemplate* pApply = rEditWin.GetApplyTemplate();
+ SvxColorItem aItem(aSet, RES_CHRATR_COLOR);
+
+ // besteht eine Selektion, wird sie gleich gefaerbt
+ if(!pApply && rWrtSh.HasSelection())
+ {
+ rWrtSh.SetAttr(SvxColorItem (aSet, RES_CHRATR_COLOR));
+ }
+ else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT)
+ {
+ GetView().GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR_EXT);
+ }
+
+ rReq.Done();
+/* OS 22.02.97 18:40 Das alte Verhalten ist unerwuenscht
+ SwEditWin& rEdtWin = GetView().GetEditWin();
+
+ SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
+ SvxColorItem aItem(aSet, RES_CHRATR_COLOR);
+
+ if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT)
+ {
+ GetShell().SetAttr(aItem);
+ }
+*/
+ }
+ }
+ break;
+ case SID_ATTR_CHAR_COLOR_BACKGROUND:
+ {
+ SwEditWin& rEdtWin = GetView().GetEditWin();
+ SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
+ rEdtWin.SetTextBackColorTransparent(0 == pItem);
+ Color aSet;
+ if(pItem)
+ {
+ aSet = ((const SvxColorItem*)pItem)->GetValue();
+ rEdtWin.SetTextBackColor(aSet);
+ }
+ if(!pApply && (rWrtSh.HasSelection() || rReq.IsAPI()))
+ {
+ SvxBrushItem aBrushItem(RES_CHRATR_BACKGROUND);
+ if(pItem)
+ aBrushItem.SetColor(aSet);
+ else
+ aBrushItem.SetColor(Color(COL_TRANSPARENT));
+ rWrtSh.SetAttr( aBrushItem );
+ }
+ else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
+ {
+ GetView().GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR_BACKGROUND_EXT);
+ }
+
+ rReq.Done();
+
+/* OS 22.02.97 18:40 Das alte Verhalten ist unerwuenscht
+ if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
+ {
+ Brush aBrush(pItem ? BRUSH_SOLID : BRUSH_NULL);
+ if(pItem)
+ aBrush.SetColor( aSet );
+ GetShell().SetAttr( SvxBrushItem(aBrush, RES_CHRATR_BACKGROUND) );
+ }
+*/
+ }
+ break;
+ case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
+ case SID_ATTR_CHAR_COLOR_EXT:
+ {
+ SwEditWin& rEdtWin = GetView().GetEditWin();
+ SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
+ SwApplyTemplate aTempl;
+ BOOL bSelection = rWrtSh.HasSelection();
+ if(bSelection)
+ {
+
+ if(nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
+ {
+ rWrtSh.SetAttr( SvxBrushItem(
+ rEdtWin.GetTextBackColor(), RES_CHRATR_BACKGROUND) );
+ }
+ else
+ rWrtSh.SetAttr( SvxColorItem( rEdtWin.GetTextColor(),
+ RES_CHRATR_COLOR) );
+ }
+ else
+ {
+ if(!pApply || pApply->nColor != nSlot)
+ aTempl.nColor = nSlot;
+ rEdtWin.SetApplyTemplate(aTempl);
+ }
+
+ rReq.Done();
+ }
+ break;
+
+ case FN_NUM_BULLET_MOVEDOWN:
+ if (!rWrtSh.IsAddMode())
+ rWrtSh.MoveParagraph(1);
+ rReq.Done();
+ break;
+
+ case FN_NUM_BULLET_MOVEUP:
+ if (!rWrtSh.IsAddMode())
+ rWrtSh.MoveParagraph(-1);
+ rReq.Done();
+ break;
+ case SID_RUBY_DIALOG:
+ case SID_HYPERLINK_DIALOG:
+ {
+ SfxRequest aReq(nSlot, SFX_CALLMODE_SLOT, SFX_APP()->GetPool());
+ GetView().GetViewFrame()->ExecuteSlot( aReq);
+ rReq.Ignore();
+ }
+ break;
+ case FN_INSERT_PAGEHEADER:
+ case FN_INSERT_PAGEFOOTER:
+ if(pArgs && pArgs->Count())
+ {
+ String sStyleName;
+ if(pItem)
+ sStyleName = ((const SfxStringItem*)pItem)->GetValue();
+ BOOL bOn = TRUE;
+ if( SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_1, FALSE, &pItem))
+ bOn = ((const SfxBoolItem*)pItem)->GetValue();
+ ChangeHeaderOrFooter(sStyleName, FN_INSERT_PAGEHEADER == nSlot, bOn, !rReq.IsAPI());
+ rReq.Done();
+ }
+ break;
+ case FN_READONLY_SELECTION_MODE :
+ if(GetView().GetDocShell()->IsReadOnly())
+ {
+ rWrtSh.SetReadonlySelectionOption(
+ !rWrtSh.GetViewOptions()->IsSelectionInReadonly());
+ rWrtSh.ShowCrsr();
+ }
+ break;
+ case FN_SELECTION_MODE_DEFAULT:
+ case FN_SELECTION_MODE_BLOCK :
+ {
+ bool bSetBlockMode = !rWrtSh.IsBlockMode();
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(nSlot, FALSE, &pItem))
+ bSetBlockMode = ((const SfxBoolItem*)pItem)->GetValue();
+ if( ( nSlot == FN_SELECTION_MODE_DEFAULT ) ^ bSetBlockMode )
+ rWrtSh.EnterBlockMode();
+ else
+ rWrtSh.EnterStdMode();
+ SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
+ rBnd.Invalidate(FN_STAT_SELMODE);
+ rBnd.Update(FN_STAT_SELMODE);
+ }
+ break;
+ case SID_OPEN_HYPERLINK:
+ case FN_COPY_HYPERLINK_LOCATION:
+ {
+ SfxItemSet aSet(GetPool(),
+ RES_TXTATR_INETFMT,
+ RES_TXTATR_INETFMT);
+ rWrtSh.GetCurAttr(aSet);
+ if(SFX_ITEM_SET <= aSet.GetItemState( RES_TXTATR_INETFMT, TRUE ))
+ {
+ const SwFmtINetFmt& rINetFmt = dynamic_cast<const SwFmtINetFmt&>( aSet.Get(RES_TXTATR_INETFMT, TRUE) );
+ if( nSlot == FN_COPY_HYPERLINK_LOCATION )
+ {
+ ::uno::Reference< datatransfer::clipboard::XClipboard > xClipboard = GetView().GetEditWin().GetClipboard();
+ vcl::unohelper::TextDataObject::CopyStringTo(
+ rINetFmt.GetValue(),
+ xClipboard );
+ }
+ else
+ rWrtSh.ClickToINetAttr(rINetFmt, URLLOAD_NOFILTER);
+ }
+ }
+ break;
+ case SID_OPEN_XML_FILTERSETTINGS:
+ {
+ try
+ {
+ uno::Reference < ui::dialogs::XExecutableDialog > xDialog(::comphelper::getProcessServiceFactory()->createInstance(rtl::OUString::createFromAscii("com.sun.star.comp.ui.XSLTFilterDialog")), uno::UNO_QUERY);
+ if( xDialog.is() )
+ {
+ xDialog->execute();
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ rReq.Ignore ();
+ }
+ break;
+ case FN_FORMAT_APPLY_HEAD1:
+ {
+ }
+ break;
+ case FN_FORMAT_APPLY_HEAD2:
+ {
+ }
+ break;
+ case FN_FORMAT_APPLY_HEAD3:
+ {
+ }
+ break;
+ case FN_FORMAT_APPLY_DEFAULT:
+ {
+ }
+ break;
+ case FN_FORMAT_APPLY_TEXTBODY:
+ {
+ }
+ break;
+ case FN_WORDCOUNT_DIALOG:
+ {
+ SwWrtShell &rSh = GetShell();
+ SwDocStat aCurr;
+ SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() );
+ {
+ SwWait aWait( *GetView().GetDocShell(), TRUE );
+ rSh.StartAction();
+ rSh.CountWords( aCurr );
+ rSh.UpdateDocStat( aDocStat );
+ rSh.EndAction();
+ }
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractSwWordCountDialog* pDialog = pFact->CreateSwWordCountDialog( GetView().GetWindow() );
+ pDialog->SetValues(aCurr, aDocStat );
+ pDialog->Execute();
+ delete pDialog;
+ }
+ break;
+ default:
+ ASSERT(!this, falscher Dispatcher);
+ return;
+ }
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwTextShell::GetState( SfxItemSet &rSet )
+{
+ SwWrtShell &rSh = GetShell();
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+ while ( nWhich )
+ {
+ switch ( nWhich )
+ {
+ case SID_LANGUAGE_STATUS:
+ {
+ // the value of used script types
+ String aScriptTypesInUse( String::CreateFromInt32( rSh.GetScriptType() ) );
+
+ SvtLanguageTable aLangTable;
+
+ // get keyboard language
+ String aKeyboardLang;
+ LanguageType nLang = LANGUAGE_DONTKNOW;
+ SwEditWin& rEditWin = GetView().GetEditWin();
+ nLang = rEditWin.GetInputLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aKeyboardLang = aLangTable.GetString( nLang );
+
+ // get the language that is in use
+ const String aMultipleLanguages = String::CreateFromAscii("*");
+ String aCurrentLang = aMultipleLanguages;
+ nLang = SwLangHelper::GetCurrentLanguage( rSh );
+ if (nLang != LANGUAGE_DONTKNOW)
+ aCurrentLang = aLangTable.GetString( nLang );
+
+ // build sequence for status value
+ uno::Sequence< ::rtl::OUString > aSeq( 4 );
+ aSeq[0] = aCurrentLang;
+ aSeq[1] = aScriptTypesInUse;
+ aSeq[2] = aKeyboardLang;
+ aSeq[3] = SwLangHelper::GetTextForLanguageGuessing( rSh );
+
+ // set sequence as status value
+ SfxStringListItem aItem( SID_LANGUAGE_STATUS );
+ aItem.SetStringList( aSeq );
+ rSet.Put( aItem, SID_LANGUAGE_STATUS );
+ }
+ break;
+
+ case SID_THES:
+ {
+ // is there a valid selection to get text from?
+ String aText;
+ sal_Bool bValid = !rSh.HasSelection() ||
+ (rSh.IsSelOnePara() && !rSh.IsMultiSelection());
+ // prevent context menu from showing when cursor is not in or at the end of a word
+ // (GetCurWord will return the next word if there is none at the current position...)
+ const sal_Int16 nWordType = ::i18n::WordType::DICTIONARY_WORD;
+ bool bWord = rSh.IsInWord( nWordType ) || rSh.IsStartWord( nWordType ) || rSh.IsEndWord( nWordType );
+ if (bValid && bWord)
+ aText = rSh.HasSelection()? rSh.GetSelTxt() : rSh.GetCurWord();
+
+ LanguageType nLang = rSh.GetCurLang();
+ lang::Locale aLocale = SvxCreateLocale( nLang );
+ String aLangText( MsLangId::convertLanguageToIsoString( nLang ) );
+
+ // set word and locale to look up as status value
+ String aStatusVal( aText );
+ aStatusVal.AppendAscii( "#" );
+ aStatusVal += aLangText;
+
+ rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
+
+ // disable "Thesaurus" context menu entry if there is nothing to look up
+ uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
+ if (aText.Len() == 0 ||
+ !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale ))
+ rSet.DisableItem( SID_THES );
+ }
+ break;
+
+ case FN_NUMBER_NEWSTART :
+ if(!rSh.GetCurNumRule())
+ rSet.DisableItem(nWhich);
+ else
+ rSet.Put(SfxBoolItem(FN_NUMBER_NEWSTART,
+ rSh.IsNumRuleStart()));
+ break;
+ case FN_EDIT_FORMULA:
+ case SID_CHARMAP:
+ {
+ const int nType = rSh.GetSelectionType();
+ if (!(nType & nsSelectionType::SEL_TXT) &&
+ !(nType & nsSelectionType::SEL_TBL) &&
+ !(nType & nsSelectionType::SEL_NUM))
+ rSet.DisableItem(nWhich);
+ }
+ break;
+
+ case FN_INSERT_ENDNOTE:
+ case FN_INSERT_FOOTNOTE:
+ case FN_INSERT_FOOTNOTE_DLG:
+ {
+ const USHORT nNoType = FRMTYPE_FLY_ANY | FRMTYPE_HEADER |
+ FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE;
+ if ( (rSh.GetFrmType(0,TRUE) & nNoType) )
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case FN_INSERT_TABLE:
+ if ( rSh.GetTableFmt() ||
+ (rSh.GetFrmType(0,TRUE) & FRMTYPE_FOOTNOTE) )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case FN_CALCULATE:
+ if ( !rSh.IsSelection() )
+ rSet.DisableItem(nWhich);
+ break;
+ case FN_GOTO_REFERENCE:
+ {
+ SwField *pFld = rSh.GetCurFld();
+ if ( !pFld || (pFld && pFld->GetTypeId() != TYP_GETREFFLD) )
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case FN_AUTOFORMAT_AUTO:
+ {
+ rSet.Put( SfxBoolItem( nWhich, SvxAutoCorrCfg::Get()->IsAutoFmtByInput() ));
+ }
+ break;
+ case FN_GLOSSARY_DLG:
+ {
+ rSet.Put(SfxBoolItem(nWhich), TRUE);
+ }
+ break;
+
+ case SID_DEC_INDENT:
+ case SID_INC_INDENT:
+ {
+ USHORT nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
+ nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
+ if( (nHtmlMode == HTMLMODE_ON) || !rSh.IsMoveLeftMargin(
+ SID_INC_INDENT == nWhich, TRUE ))
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ case FN_DEC_INDENT_OFFSET:
+ case FN_INC_INDENT_OFFSET:
+ {
+ USHORT nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
+ nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
+ if( (nHtmlMode == HTMLMODE_ON) ||
+ !rSh.IsMoveLeftMargin( FN_INC_INDENT_OFFSET == nWhich,
+ FALSE ))
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ case SID_ATTR_CHAR_COLOR2:
+ {
+ rSet.Put(SvxColorItem(GetView().GetEditWin().GetTextColor(), SID_ATTR_CHAR_COLOR2));
+ }
+ break;
+ case SID_ATTR_CHAR_COLOR_BACKGROUND:
+ {
+ if(GetView().GetEditWin().IsTextBackColorTransparent())
+ rSet.Put(SvxColorItem(Color(COL_TRANSPARENT), SID_ATTR_CHAR_COLOR_BACKGROUND));
+ else
+ rSet.Put(SvxColorItem(GetView().GetEditWin().GetTextBackColor(), SID_ATTR_CHAR_COLOR_BACKGROUND));
+ }
+ break;
+ case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
+ case SID_ATTR_CHAR_COLOR_EXT:
+ {
+ SwEditWin& rEdtWin = GetView().GetEditWin();
+ SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
+ rSet.Put(SfxBoolItem(nWhich, pApply && pApply->nColor == nWhich));
+ }
+ break;
+ case FN_INSERT_BOOKMARK:
+ if( rSh.IsTableMode() )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case FN_INSERT_PAGEHEADER:
+ case FN_INSERT_PAGEFOOTER:
+ {
+#ifndef CHECK_MENU
+ rSet.Put( SfxObjectShellItem( nWhich, GetView().GetDocShell() ));
+#else
+ // Seitenvorlagen besorgen
+ BOOL bFound = FALSE;
+ USHORT n, nCnt = rSh.GetPageDescCnt();
+ for( n = 0; n < nCnt; ++n )
+ {
+ const SwPageDesc& rDesc = rSh.GetPageDesc( n );
+ if( FN_INSERT_PAGEHEADER == nWhich
+ ? !rDesc.GetMaster().GetHeader().IsActive()
+ : !rDesc.GetMaster().GetFooter().IsActive() )
+ {
+ bFound = TRUE;
+ break;
+ }
+ }
+
+ if( bFound )
+ rSet.Put( SfxObjectShellItem( nWhich, GetView().GetDocShell() ));
+ else
+ rSet.DisableItem( nWhich );
+#endif
+ }
+ break;
+ case FN_TABLE_SORT_DIALOG:
+ case FN_SORTING_DLG:
+ if(!rSh.HasSelection() ||
+ (FN_TABLE_SORT_DIALOG == nWhich && !rSh.GetTableFmt()))
+ rSet.DisableItem( nWhich );
+ break;
+ case SID_RUBY_DIALOG:
+ {
+ SvtCJKOptions aCJKOptions;
+ if(!aCJKOptions.IsRubyEnabled())
+ {
+ GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
+ rSet.DisableItem(nWhich);
+ }
+ else
+ GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
+ break;
+ }
+ //no break!
+ case SID_HYPERLINK_DIALOG:
+ if( GetView().GetDocShell()->IsReadOnly() ||
+ (!GetView().GetViewFrame()->HasChildWindow(nWhich) &&
+ rSh.HasReadonlySel()) )
+ rSet.DisableItem(nWhich);
+ else
+ rSet.Put(SfxBoolItem( nWhich, 0 != GetView().
+ GetViewFrame()->GetChildWindow( nWhich ) ));
+ break;
+ case FN_EDIT_HYPERLINK:
+ case FN_REMOVE_HYPERLINK:
+ case FN_COPY_HYPERLINK_LOCATION:
+ {
+ SfxItemSet aSet(GetPool(),
+ RES_TXTATR_INETFMT,
+ RES_TXTATR_INETFMT);
+ rSh.GetCurAttr(aSet);
+ if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, TRUE ) || rSh.HasReadonlySel())
+ {
+ rSet.DisableItem(nWhich);
+ }
+ }
+ break;
+ case SID_TRANSLITERATE_HALFWIDTH:
+ case SID_TRANSLITERATE_FULLWIDTH:
+ case SID_TRANSLITERATE_HIRAGANA:
+ case SID_TRANSLITERATE_KATAGANA:
+ {
+ SvtCJKOptions aCJKOptions;
+ if(!aCJKOptions.IsChangeCaseMapEnabled())
+ {
+ GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
+ rSet.DisableItem(nWhich);
+ }
+ else
+ GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
+ }
+ break;
+ case FN_READONLY_SELECTION_MODE :
+ if(!GetView().GetDocShell()->IsReadOnly())
+ rSet.DisableItem( nWhich );
+ else
+ {
+ rSet.Put(SfxBoolItem(nWhich, rSh.GetViewOptions()->IsSelectionInReadonly()));
+ }
+ break;
+ case FN_SELECTION_MODE_DEFAULT:
+ case FN_SELECTION_MODE_BLOCK :
+ rSet.Put(SfxBoolItem(nWhich, (nWhich == FN_SELECTION_MODE_DEFAULT) != rSh.IsBlockMode()));
+ break;
+ case SID_OPEN_HYPERLINK:
+ {
+ SfxItemSet aSet(GetPool(),
+ RES_TXTATR_INETFMT,
+ RES_TXTATR_INETFMT);
+ rSh.GetCurAttr(aSet);
+ if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, FALSE ))
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case SID_OPEN_SMARTTAGMENU:
+ {
+ uno::Sequence< rtl::OUString > aSmartTagTypes;
+ uno::Sequence< uno::Reference< container::XStringKeyMap > > aStringKeyMaps;
+ uno::Reference<text::XTextRange> xRange;
+
+ rSh.GetSmartTagTerm( aSmartTagTypes, aStringKeyMaps, xRange );
+
+ if ( xRange.is() && aSmartTagTypes.getLength() )
+ {
+ uno::Sequence < uno::Sequence< uno::Reference< smarttags::XSmartTagAction > > > aActionComponentsSequence;
+ uno::Sequence < uno::Sequence< sal_Int32 > > aActionIndicesSequence;
+
+ const SmartTagMgr& rSmartTagMgr = SwSmartTagMgr::Get();
+ rSmartTagMgr.GetActionSequences( aSmartTagTypes,
+ aActionComponentsSequence,
+ aActionIndicesSequence );
+
+ uno::Reference <frame::XController> xController = GetView().GetController();
+ const lang::Locale aLocale( SW_BREAKITER()->GetLocale( (LanguageType)GetAppLanguage() ) );
+ const rtl::OUString aApplicationName( rSmartTagMgr.GetApplicationName() );
+ const rtl::OUString aRangeText = xRange->getString();
+
+ const SvxSmartTagItem aItem( nWhich,
+ aActionComponentsSequence,
+ aActionIndicesSequence,
+ aStringKeyMaps,
+ xRange,
+ xController,
+ aLocale,
+ aApplicationName,
+ aRangeText );
+
+ rSet.Put( aItem );
+ }
+ else
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case FN_NUM_CONTINUE:
+ {
+ // --> OD 2009-08-26 #i86492#
+ // Allow continuation of previous list, even if at current cursor
+ // a list is active.
+// if ( rSh.GetCurNumRule() )
+// rSet.DisableItem(nWhich);
+// else
+ // <--
+ {
+ // --> OD 2009-08-26 #i86492#
+ // Search also for bullet list
+ String aDummy;
+ const SwNumRule* pRule =
+ rSh.SearchNumRule( false, true, false, -1, aDummy );
+ if ( !pRule )
+ {
+ pRule = rSh.SearchNumRule( false, false, false, -1, aDummy );
+ }
+ // <--
+ if ( !pRule )
+ rSet.DisableItem(nWhich);
+ }
+ }
+ break;
+ case SID_INSERT_RLM :
+ case SID_INSERT_LRM :
+ case SID_INSERT_ZWNBSP :
+ case SID_INSERT_ZWSP:
+ {
+ SvtCTLOptions aCTLOptions;
+ sal_Bool bEnabled = aCTLOptions.IsCTLFontEnabled();
+ GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled );
+ if(!bEnabled)
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+/* -----------------------------2002/07/05 10:31------------------------------
+ Switch on/off header of footer of a page style - if an empty name is
+ given all styles are changed
+ ---------------------------------------------------------------------------*/
+void SwTextShell::ChangeHeaderOrFooter(
+ const String& rStyleName, BOOL bHeader, BOOL bOn, BOOL bShowWarning)
+{
+ SwWrtShell& rSh = GetShell();
+ rSh.StartAllAction();
+ rSh.StartUndo( UNDO_HEADER_FOOTER ); // #i7983#
+ BOOL bExecute = TRUE;
+ BOOL bCrsrSet = FALSE;
+ for( USHORT nFrom = 0, nTo = rSh.GetPageDescCnt();
+ nFrom < nTo; ++nFrom )
+ {
+ int bChgd = FALSE;
+ SwPageDesc aDesc( rSh.GetPageDesc( nFrom ));
+ String sTmp(aDesc.GetName());
+ if( !rStyleName.Len() || rStyleName == sTmp )
+ {
+ if( bShowWarning && !bOn && GetActiveView() && GetActiveView() == &GetView() &&
+ ((bHeader && aDesc.GetMaster().GetHeader().IsActive()) ||
+ (!bHeader && aDesc.GetMaster().GetFooter().IsActive())))
+ {
+ bShowWarning = FALSE;
+ //Actions have to be closed while the dialog is showing
+ rSh.EndAllAction();
+
+ Window* pParent = &GetView().GetViewFrame()->GetWindow();
+ BOOL bRet = RET_YES == QueryBox( pParent, ResId( RID_SVXQBX_DELETE_HEADFOOT,
+ DIALOG_MGR() ) ).Execute();
+ bExecute = bRet;
+ rSh.StartAllAction();
+ }
+ if( bExecute )
+ {
+ bChgd = TRUE;
+ SwFrmFmt &rMaster = aDesc.GetMaster();
+ if(bHeader)
+ rMaster.SetFmtAttr( SwFmtHeader( bOn ));
+ else
+ rMaster.SetFmtAttr( SwFmtFooter( bOn ));
+ if( bOn )
+ {
+ SvxULSpaceItem aUL(bHeader ? 0 : MM50, bHeader ? MM50 : 0, RES_UL_SPACE );
+ SwFrmFmt* pFmt = bHeader ?
+ (SwFrmFmt*)rMaster.GetHeader().GetHeaderFmt() :
+ (SwFrmFmt*)rMaster.GetFooter().GetFooterFmt();
+ pFmt->SetFmtAttr( aUL );
+ }
+ }
+ if( bChgd )
+ {
+ rSh.ChgPageDesc( nFrom, aDesc );
+
+ if( !bCrsrSet && bOn )
+ bCrsrSet = rSh.SetCrsrInHdFt(
+ !rStyleName.Len() ? USHRT_MAX : nFrom,
+ bHeader );
+ }
+ }
+ }
+ rSh.EndUndo( UNDO_HEADER_FOOTER ); // #i7983#
+ rSh.EndAllAction();
+}
+
diff --git a/sw/source/ui/shells/textsh2.cxx b/sw/source/ui/shells/textsh2.cxx
new file mode 100644
index 000000000000..2d267e926fc8
--- /dev/null
+++ b/sw/source/ui/shells/textsh2.cxx
@@ -0,0 +1,312 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#include <svtools/svmedit.hxx>
+#include <svl/eitem.hxx>
+#include <svl/whiter.hxx>
+#include <sfx2/event.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/viewfrm.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <svl/stritem.hxx>
+#include <svl/itemset.hxx>
+#include <sfx2/request.hxx>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
+#include <com/sun/star/sdb/XDatabaseAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <sfx2/frame.hxx>
+#include <fldmgr.hxx>
+#include <fldbas.hxx>
+#include "dbmgr.hxx"
+#include <comphelper/uno3.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#include <memory>
+
+#include <vcl/svapp.hxx>
+
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "swtypes.hxx"
+#include "cmdid.h"
+#include "swevent.hxx"
+#include "shells.hrc"
+#include "textsh.hxx"
+#include "swabstdlg.hxx"
+#include "dbui.hrc"
+
+#include <unomid.h>
+
+using namespace ::svx;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::beans;
+
+
+#define DB_DD_DELIM 0x0b
+
+struct DBTextStruct_Impl
+{
+ SwDBData aDBData;
+ Sequence<Any> aSelection;
+ Reference<XResultSet> xCursor;
+ Reference<XConnection> xConnection;
+};
+inline void AddSelList( List& rLst, long nRow )
+{
+ rLst.Insert( (void*)nRow , LIST_APPEND );
+}
+void SwTextShell::ExecDB(SfxRequest &rReq)
+{
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ SwNewDBMgr* pNewDBMgr = GetShell().GetNewDBMgr();
+ USHORT nSlot = rReq.GetSlot();
+ ::rtl::OUString sSourceArg, sCommandArg;
+ sal_Int32 nCommandTypeArg = 0;
+
+ const SfxPoolItem* pSourceItem = 0;
+ const SfxPoolItem* pCursorItem = 0;
+ const SfxPoolItem* pConnectionItem = 0;
+ const SfxPoolItem* pCommandItem = 0;
+ const SfxPoolItem* pCommandTypeItem = 0;
+ const SfxPoolItem* pSelectionItem = 0;
+
+ // first get the selection of rows to be inserted
+ pArgs->GetItemState(FN_DB_DATA_SELECTION_ANY, FALSE, &pSelectionItem);
+
+ Sequence<Any> aSelection;
+ if(pSelectionItem)
+ ((SfxUsrAnyItem*)pSelectionItem)->GetValue() >>= aSelection;
+
+ // get the data source name
+ pArgs->GetItemState(FN_DB_DATA_SOURCE_ANY, FALSE, &pSourceItem);
+ if(pSourceItem)
+ ((const SfxUsrAnyItem*)pSourceItem)->GetValue() >>= sSourceArg;
+
+ // get the command
+ pArgs->GetItemState(FN_DB_DATA_COMMAND_ANY, FALSE, &pCommandItem);
+ if(pCommandItem)
+ ((const SfxUsrAnyItem*)pCommandItem)->GetValue() >>= sCommandArg;
+
+ // get the command type
+ pArgs->GetItemState(FN_DB_DATA_COMMAND_TYPE_ANY, FALSE, &pCommandTypeItem);
+ if(pCommandTypeItem)
+ ((const SfxUsrAnyItem*)pCommandTypeItem)->GetValue() >>= nCommandTypeArg;
+
+ Reference<XConnection> xConnection;
+ pArgs->GetItemState(FN_DB_CONNECTION_ANY, FALSE, &pConnectionItem);
+ if ( pConnectionItem )
+ ((const SfxUsrAnyItem*)pConnectionItem)->GetValue() >>= xConnection;
+ // may be we even get no connection
+ if ( !xConnection.is() )
+ {
+ Reference<XDataSource> xSource;
+ xConnection = pNewDBMgr->GetConnection(sSourceArg, xSource);
+ }
+ if(!xConnection.is())
+ return ;
+
+ // get the cursor, we use to travel, may be NULL
+ Reference<XResultSet> xCursor;
+ pArgs->GetItemState(FN_DB_DATA_CURSOR_ANY, FALSE, &pCursorItem);
+ if ( pCursorItem )
+ ((const SfxUsrAnyItem*)pCursorItem)->GetValue() >>= xCursor;
+
+ switch (nSlot)
+ {
+ case FN_QRY_INSERT:
+ {
+ if(pSourceItem && pCommandItem && pCommandTypeItem)
+ {
+ DBTextStruct_Impl* pNew = new DBTextStruct_Impl;
+ pNew->aDBData.sDataSource = sSourceArg;
+ pNew->aDBData.sCommand = sCommandArg;
+ pNew->aDBData.nCommandType = nCommandTypeArg;
+ pNew->aSelection = aSelection;
+ //if the cursor is NULL, it must be created inside InsertDBTextHdl
+ // because it called via a PostUserEvent
+ pNew->xCursor = xCursor;
+ pNew->xConnection = xConnection;
+
+ Application::PostUserEvent( STATIC_LINK( this, SwBaseShell,
+ InsertDBTextHdl ), pNew );
+ // the pNew will be removed in InsertDBTextHdl !!
+ }
+ }
+ break;
+
+ case FN_QRY_MERGE_FIELD:
+ {
+ // we don't get any cursor, so we must create our own
+ BOOL bDisposeResultSet = FALSE;
+ if ( !xCursor.is() )
+ {
+ xCursor = SwNewDBMgr::createCursor(sSourceArg,sCommandArg,nCommandTypeArg,xConnection);
+ bDisposeResultSet = xCursor.is();
+ }
+
+ ODataAccessDescriptor aDescriptor;
+ aDescriptor.setDataSource(sSourceArg);
+ aDescriptor[daCommand] <<= sCommandArg;
+ aDescriptor[daCursor] <<= xCursor;
+ aDescriptor[daSelection] <<= aSelection;
+ aDescriptor[daCommandType] <<= nCommandTypeArg;
+
+ SwMergeDescriptor aMergeDesc( DBMGR_MERGE, *GetShellPtr(), aDescriptor );
+ pNewDBMgr->MergeNew(aMergeDesc);
+
+ if ( bDisposeResultSet )
+ ::comphelper::disposeComponent(xCursor);
+ }
+ break;
+
+ case FN_QRY_INSERT_FIELD:
+ {
+ const SfxPoolItem* pColumnItem = 0;
+ const SfxPoolItem* pColumnNameItem = 0;
+
+ pArgs->GetItemState(FN_DB_COLUMN_ANY, FALSE, &pColumnItem);
+ pArgs->GetItemState(FN_DB_DATA_COLUMN_NAME_ANY, FALSE, &pColumnNameItem);
+
+ ::rtl::OUString sColumnName;
+ if(pColumnNameItem)
+ ((SfxUsrAnyItem*)pColumnNameItem)->GetValue() >>= sColumnName;
+ String sDBName = sSourceArg;
+ sDBName += DB_DELIM;
+ sDBName += (String)sCommandArg;
+ sDBName += DB_DELIM;
+ sDBName += String::CreateFromInt32(nCommandTypeArg);
+ sDBName += DB_DELIM;
+ sDBName += (String)sColumnName;
+
+ SwFldMgr aFldMgr(GetShellPtr());
+ SwInsertFld_Data aData(TYP_DBFLD, 0, sDBName, aEmptyStr, 0, FALSE, TRUE);
+ if(pConnectionItem)
+ aData.aDBConnection = ((SfxUsrAnyItem*)pConnectionItem)->GetValue();
+ if(pColumnItem)
+ aData.aDBColumn = ((SfxUsrAnyItem*)pColumnItem)->GetValue();
+ aFldMgr.InsertFld(aData);
+ SfxViewFrame* pViewFrame = GetView().GetViewFrame();
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ pViewFrame->GetBindings().GetRecorder();
+ if ( xRecorder.is() )
+ {
+ SfxRequest aReq( pViewFrame, FN_INSERT_DBFIELD );
+ aReq.AppendItem( SfxUInt16Item(FN_PARAM_FIELD_TYPE, TYP_DBFLD));
+ aReq.AppendItem( SfxStringItem( FN_INSERT_DBFIELD, sDBName ));
+ aReq.AppendItem( SfxStringItem( FN_PARAM_1, sCommandArg ));
+ aReq.AppendItem( SfxStringItem( FN_PARAM_2, sColumnName ));
+ aReq.AppendItem( SfxInt32Item( FN_PARAM_3, nCommandTypeArg));
+ aReq.Done();
+ }
+ }
+ break;
+
+ default:
+ ASSERT(!this, falscher Dispatcher);
+ return;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_STATIC_LINK( SwBaseShell, InsertDBTextHdl, DBTextStruct_Impl*, pDBStruct )
+{
+ if( pDBStruct )
+ {
+ sal_Bool bDispose = sal_False;
+ Reference< sdbc::XConnection> xConnection = pDBStruct->xConnection;
+ Reference<XDataSource> xSource = SwNewDBMgr::getDataSourceAsParent(xConnection,pDBStruct->aDBData.sDataSource);
+ // #111987# the connection is disposed an so no parent has been found
+ if(xConnection.is() && !xSource.is())
+ return 0;
+
+ if ( !xConnection.is() )
+ {
+ xConnection = SwNewDBMgr::GetConnection(pDBStruct->aDBData.sDataSource, xSource);
+ bDispose = sal_True;
+ }
+
+ Reference< XColumnsSupplier> xColSupp;
+ if(xConnection.is())
+ xColSupp = SwNewDBMgr::GetColumnSupplier(xConnection,
+ pDBStruct->aDBData.sCommand,
+ pDBStruct->aDBData.nCommandType == CommandType::QUERY ?
+ SW_DB_SELECT_QUERY : SW_DB_SELECT_TABLE);
+
+ if( xColSupp.is() )
+ {
+ SwDBData aDBData = pDBStruct->aDBData;
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+ ::std::auto_ptr<AbstractSwInsertDBColAutoPilot>pDlg (pFact->CreateSwInsertDBColAutoPilot( pThis->GetView(),
+ xSource,
+ xColSupp,
+ aDBData,
+ DLG_AP_INSERT_DB_SEL ));
+ if( RET_OK == pDlg->Execute() )
+ {
+ Reference <XResultSet> xResSet = pDBStruct->xCursor;
+ pDlg->DataToDoc( pDBStruct->aSelection, xSource, xConnection, xResSet);
+ }
+ }
+ if ( bDispose )
+ ::comphelper::disposeComponent(xConnection);
+ }
+
+ delete pDBStruct;
+ return 0;
+}
+
+
+
diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx
new file mode 100644
index 000000000000..9d90ac5d5b26
--- /dev/null
+++ b/sw/source/ui/shells/txtattr.cxx
@@ -0,0 +1,847 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <svl/whiter.hxx>
+#include <svl/stritem.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/ctloptions.hxx>
+#include <swmodule.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/adjitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/escpitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include "paratr.hxx"
+
+#include <fmtinfmt.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <viewopt.hxx>
+#include <uitool.hxx>
+#ifndef _TEXTSH_HXX
+#include <textsh.hxx>
+#endif
+#include <num.hxx>
+#include <swundo.hxx>
+#include <fmtcol.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <globals.h>
+#ifndef _SHELLS_HRC
+#include <shells.hrc>
+#endif
+#include <SwStyleNameMapper.hxx>
+#include "swabstdlg.hxx"
+#include "chrdlg.hrc"
+const SwTwips lFontInc = 2 * 20; // ==> PointToTwips(2)
+const SwTwips lFontMaxSz = 72 * 20; // ==> PointToTwips(72)
+
+
+
+
+void SwTextShell::ExecCharAttr(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ int eState = STATE_TOGGLE;
+ USHORT nWhich = rReq.GetSlot();
+
+ if(pArgs )
+ {
+ const SfxPoolItem* pItem;
+ pArgs->GetItemState(nWhich, FALSE, &pItem);
+ eState = ((const SfxBoolItem &) pArgs->
+ Get( nWhich )).GetValue() ? STATE_ON : STATE_OFF;
+ }
+
+
+ SfxItemSet aSet( GetPool(), RES_CHRATR_BEGIN, RES_CHRATR_END-1 );
+ if (STATE_TOGGLE == eState)
+ rSh.GetCurAttr( aSet );
+
+ switch ( nWhich )
+ {
+ case FN_SET_SUB_SCRIPT:
+ case FN_SET_SUPER_SCRIPT:
+ {
+ SvxEscapement eEscape = SVX_ESCAPEMENT_SUBSCRIPT;
+ switch (eState)
+ {
+ case STATE_TOGGLE:
+ {
+ short nTmpEsc = ((const SvxEscapementItem&)
+ aSet.Get( RES_CHRATR_ESCAPEMENT )).GetEsc();
+ eEscape = nWhich == FN_SET_SUPER_SCRIPT ?
+ SVX_ESCAPEMENT_SUPERSCRIPT:
+ SVX_ESCAPEMENT_SUBSCRIPT;
+ if( (nWhich == FN_SET_SUB_SCRIPT && nTmpEsc < 0) ||
+ (nWhich == FN_SET_SUPER_SCRIPT && nTmpEsc > 0) )
+ eEscape = SVX_ESCAPEMENT_OFF;
+
+ SfxBindings& rBind = GetView().GetViewFrame()->GetBindings();
+ if( nWhich == FN_SET_SUB_SCRIPT )
+ rBind.SetState( SfxBoolItem( FN_SET_SUPER_SCRIPT,
+ FALSE ) );
+ else
+ rBind.SetState( SfxBoolItem( FN_SET_SUB_SCRIPT,
+ FALSE ) );
+
+ }
+ break;
+ case STATE_ON:
+ eEscape = nWhich == FN_SET_SUPER_SCRIPT ?
+ SVX_ESCAPEMENT_SUPERSCRIPT:
+ SVX_ESCAPEMENT_SUBSCRIPT;
+ break;
+ case STATE_OFF:
+ eEscape = SVX_ESCAPEMENT_OFF;
+ break;
+ }
+ SvxEscapementItem aEscape( eEscape, RES_CHRATR_ESCAPEMENT );
+ if(eEscape == SVX_ESCAPEMENT_SUPERSCRIPT)
+ aEscape.GetEsc() = DFLT_ESC_AUTO_SUPER;
+ else if(eEscape == SVX_ESCAPEMENT_SUBSCRIPT)
+ aEscape.GetEsc() = DFLT_ESC_AUTO_SUB;
+ if(eState != STATE_OFF )
+ {
+ if(eEscape == FN_SET_SUPER_SCRIPT)
+ aEscape.GetEsc() *= -1;
+ }
+ rSh.SetAttr( aEscape );
+ rReq.AppendItem( aEscape );
+ rReq.Done();
+ }
+ break;
+
+ case FN_UPDATE_STYLE_BY_EXAMPLE:
+ rSh.QuickUpdateStyle();
+ rReq.Done();
+ break;
+ case FN_UNDERLINE_DOUBLE:
+ {
+ FontUnderline eUnderline = ((const SvxUnderlineItem&)
+ aSet.Get(RES_CHRATR_UNDERLINE)).GetLineStyle();
+ switch( eState )
+ {
+ case STATE_TOGGLE:
+ eUnderline = eUnderline == UNDERLINE_DOUBLE ?
+ UNDERLINE_NONE :
+ UNDERLINE_DOUBLE;
+ break;
+ case STATE_ON:
+ eUnderline = UNDERLINE_DOUBLE;
+ break;
+ case STATE_OFF:
+ eUnderline = UNDERLINE_NONE;
+ break;
+ }
+ SvxUnderlineItem aUnderline(eUnderline, RES_CHRATR_UNDERLINE );
+ rSh.SetAttr( aUnderline );
+ rReq.AppendItem( aUnderline );
+ rReq.Done();
+ }
+ break;
+ case FN_REMOVE_DIRECT_CHAR_FORMATS:
+ if( !rSh.HasReadonlySel() && rSh.IsEndPara())
+ rSh.DontExpandFmt();
+ break;
+ default:
+ ASSERT(FALSE, falscher Dispatcher);
+ return;
+ }
+}
+
+
+void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
+{
+ USHORT nSlot = rReq.GetSlot();
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ BOOL bArgs = pArgs != 0 && pArgs->Count() > 0;
+ int bGrow = FALSE;
+ SwWrtShell& rWrtSh = GetShell();
+ SwTxtFmtColl* pColl = 0;
+
+ // nur gesetzt, wenn gesamter Absatz selektiert ist und AutoUpdateFmt gesetzt ist
+ if( rWrtSh.HasSelection() && rWrtSh.IsSelFullPara() )
+ {
+ pColl = rWrtSh.GetCurTxtFmtColl();
+ if(pColl && !pColl->IsAutoUpdateFmt())
+ pColl = 0;
+ }
+ SfxItemPool& rPool = GetPool();
+ USHORT nWhich = rPool.GetWhich(nSlot);
+ switch ( nSlot )
+ {
+ case FN_TXTATR_INET:
+ // Sonderbehandlung der PoolId des SwFmtInetFmt
+ if(bArgs)
+ {
+ const SfxPoolItem& rItem = pArgs->Get(nWhich );
+
+ SwFmtINetFmt aINetFmt((const SwFmtINetFmt&)rItem);
+ if( USHRT_MAX == aINetFmt.GetVisitedFmtId() )
+ {
+ aINetFmt.SetVisitedFmtId(
+ SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt.GetVisitedFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT));
+ }
+ if( USHRT_MAX == aINetFmt.GetINetFmtId() )
+ {
+ aINetFmt.SetINetFmtId(
+ SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt.GetINetFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT));
+ }
+
+ if ( pColl )
+ pColl->SetFmtAttr( aINetFmt );
+ else rWrtSh.SetAttr( aINetFmt );
+ rReq.Done();
+ }
+ break;
+
+ case FN_GROW_FONT_SIZE:
+ bGrow = TRUE;
+ // kein break !!
+ case FN_SHRINK_FONT_SIZE:
+ {
+ SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, rPool );
+ rWrtSh.GetCurAttr( aSetItem.GetItemSet() );
+ SfxItemSet aAttrSet( rPool, aSetItem.GetItemSet().GetRanges() );
+
+ const SfxPoolItem* pI;
+ static const USHORT aScrTypes[] = {
+ SCRIPTTYPE_LATIN, SCRIPTTYPE_ASIAN, SCRIPTTYPE_COMPLEX, 0 };
+ USHORT nScriptType = rWrtSh.GetScriptType();
+ for( const USHORT* pScrpTyp = aScrTypes; *pScrpTyp; ++pScrpTyp )
+ if( ( nScriptType & *pScrpTyp ) &&
+ 0 != ( pI = aSetItem.GetItemOfScript( *pScrpTyp )))
+ {
+ SvxFontHeightItem aSize( *(const SvxFontHeightItem*)pI );
+ SwTwips lSize = (SwTwips) aSize.GetHeight();
+
+ if (bGrow)
+ {
+ if( lSize == lFontMaxSz )
+ break; // das wars, hoeher gehts nicht
+ if( ( lSize += lFontInc ) > lFontMaxSz )
+ lSize = lFontMaxSz;
+ }
+ else
+ {
+ if( 4 == lSize )
+ break;
+ if( ( lSize -= lFontInc ) < 4 )
+ lSize = 4;
+ }
+ aSize.SetHeight( lSize );
+ aAttrSet.Put( aSize );
+ }
+ if( aAttrSet.Count() )
+ {
+ if( pColl )
+ pColl->SetFmtAttr( aAttrSet );
+ else
+ rWrtSh.SetAttr( aAttrSet );
+ }
+ rReq.Done();
+ }
+ break;
+
+ default:
+ ASSERT(FALSE, falscher Dispatcher);
+ return;
+ }
+}
+
+
+
+#ifdef CFRONT
+
+void lcl_SetAdjust(SvxAdjust eAdjst, SfxItemSet& rSet)
+{
+ rSet.Put(SvxAdjustItem(eAdjst,RES_PARATR_ADJUST ));
+}
+
+
+
+void lcl_SetLineSpace(BYTE ePropL,SfxItemSet& rSet)
+{
+ SvxLineSpacingItem aLineSpacing(ePropL, RES_PARATR_LINESPACING );
+ aLineSpacing.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+ if( 100 == ePropL )
+ aLineSpacing.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
+ else
+ aLineSpacing.SetPropLineSpace(ePropL);
+ rSet.Put( aLineSpacing );
+}
+
+
+
+void SwTextShell::ExecParaAttr(SfxRequest &rReq)
+{
+ // gleiche beide Attribute holen, ist nicht teuerer !!
+ SfxItemSet aSet( GetPool(), RES_PARATR_LINESPACING, RES_PARATR_ADJUST );
+
+ switch (rReq.GetSlot())
+ {
+ case FN_SET_LEFT_PARA: lcl_SetAdjust(ADJLEFT,aSet); break;
+ case FN_SET_RIGHT_PARA: lcl_SetAdjust(ADJRIGHT,aSet); break;
+ case FN_SET_CENTER_PARA: lcl_SetAdjust(ADJCENTER,aSet); break;
+ case SID_ATTR_PARA_ADJUST_BLOCK:lcl_SetAdjust(ADJBLOCK,aSet); break;
+
+ case FN_SET_LINE_SPACE_1: lcl_SetLineSpace(100,aSet); break;
+ case FN_SET_LINE_SPACE_15: lcl_SetLineSpace(150,aSet); break;
+ case FN_SET_LINE_SPACE_2: lcl_SetLineSpace(200,aSet); break;
+
+ default:
+ DBG_ERROR("SwTextShell::ExecParaAttr falscher Dispatcher");
+ return;
+ }
+ SwWrtShell& rWrtSh = GetShell();
+ SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl();
+ if(pColl && pColl->IsAutoUpdateFmt())
+ {
+ rWrtSh.AutoUpdatePara(pColl, *pSet);
+ }
+ else
+ {
+ rWrtSh.SetAttr( aSet );
+ rReq.Done( aSet );
+ }
+}
+
+#else
+
+
+
+void SwTextShell::ExecParaAttr(SfxRequest &rReq)
+{
+ SvxAdjust eAdjst;
+ BYTE ePropL;
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ // gleich beide Attribute holen, ist nicht teuerer !!
+ SfxItemSet aSet( GetPool(),
+ RES_PARATR_LINESPACING, RES_PARATR_ADJUST,
+ RES_FRAMEDIR, RES_FRAMEDIR,
+ 0 );
+
+ USHORT nSlot = rReq.GetSlot();
+ switch (nSlot)
+ {
+ case SID_ATTR_PARA_ADJUST:
+ {
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(RES_PARATR_ADJUST) )
+ {
+ const SvxAdjustItem& rAdj = (const SvxAdjustItem&) pArgs->Get(RES_PARATR_ADJUST);
+ SvxAdjustItem aAdj( rAdj.GetAdjust(), RES_PARATR_ADJUST );
+ if ( rAdj.GetAdjust() == SVX_ADJUST_BLOCK )
+ {
+ aAdj.SetLastBlock( rAdj.GetLastBlock() );
+ aAdj.SetOneWord( rAdj.GetOneWord() );
+ }
+
+ aSet.Put(aAdj);
+ }
+ }
+ break;
+ case SID_ATTR_PARA_ADJUST_LEFT: eAdjst = SVX_ADJUST_LEFT; goto SET_ADJUST;
+ case SID_ATTR_PARA_ADJUST_RIGHT: eAdjst = SVX_ADJUST_RIGHT; goto SET_ADJUST;
+ case SID_ATTR_PARA_ADJUST_CENTER: eAdjst = SVX_ADJUST_CENTER; goto SET_ADJUST;
+ case SID_ATTR_PARA_ADJUST_BLOCK: eAdjst = SVX_ADJUST_BLOCK; goto SET_ADJUST;
+SET_ADJUST:
+ {
+ aSet.Put(SvxAdjustItem(eAdjst,RES_PARATR_ADJUST));
+ rReq.AppendItem( SfxBoolItem( GetPool().GetWhich(nSlot), TRUE ) );
+ }
+ break;
+
+ case SID_ATTR_PARA_LINESPACE:
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState( GetPool().GetWhich(nSlot) ))
+ {
+ SvxLineSpacingItem aLineSpace = (const SvxLineSpacingItem&)pArgs->Get(
+ GetPool().GetWhich(nSlot));
+ aSet.Put( aLineSpace );
+ }
+ break;
+ case SID_ATTR_PARA_LINESPACE_10: ePropL = 100; goto SET_LINESPACE;
+ case SID_ATTR_PARA_LINESPACE_15: ePropL = 150; goto SET_LINESPACE;
+ case SID_ATTR_PARA_LINESPACE_20: ePropL = 200; goto SET_LINESPACE;
+
+SET_LINESPACE:
+ {
+
+ SvxLineSpacingItem aLineSpacing(ePropL, RES_PARATR_LINESPACING );
+ aLineSpacing.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
+ if( 100 == ePropL )
+ aLineSpacing.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
+ else
+ aLineSpacing.SetPropLineSpace(ePropL);
+ aSet.Put( aLineSpacing );
+ }
+ break;
+
+ case SID_ATTR_PARA_LEFT_TO_RIGHT :
+ case SID_ATTR_PARA_RIGHT_TO_LEFT :
+ {
+ BOOL bSet = TRUE;
+ int eState = pArgs ? pArgs->GetItemState(nSlot) : SFX_ITEM_DISABLED;
+ if (pArgs && SFX_ITEM_SET == eState)
+ bSet = ((const SfxBoolItem&)pArgs->Get(nSlot)).GetValue();
+/*
+// toggling of the slots not used anymore
+
+ if(!bSet)
+ nSlot = SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot ?
+ SID_ATTR_PARA_RIGHT_TO_LEFT :
+ SID_ATTR_PARA_LEFT_TO_RIGHT;
+*/
+ SfxItemSet aAdjustSet( GetPool(),
+ RES_PARATR_ADJUST, RES_PARATR_ADJUST );
+ GetShell().GetCurAttr(aAdjustSet);
+ BOOL bChgAdjust = FALSE;
+ SfxItemState eAdjustState = aAdjustSet.GetItemState(RES_PARATR_ADJUST, FALSE);
+ if(eAdjustState >= SFX_ITEM_DEFAULT)
+ {
+ int eAdjust = (int)(( const SvxAdjustItem& )
+ aAdjustSet.Get(RES_PARATR_ADJUST)).GetAdjust();
+// bChgAdjust = SVX_ADJUST_CENTER != eAdjust && SVX_ADJUST_BLOCK != eAdjust;
+ bChgAdjust = (SVX_ADJUST_LEFT == eAdjust && SID_ATTR_PARA_RIGHT_TO_LEFT == nSlot) ||
+ (SVX_ADJUST_RIGHT == eAdjust && SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot);
+ }
+ else
+ bChgAdjust = TRUE;
+
+ SvxFrameDirection eFrmDirection =
+ (SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot) ?
+ FRMDIR_HORI_LEFT_TOP : FRMDIR_HORI_RIGHT_TOP;
+ aSet.Put( SvxFrameDirectionItem( eFrmDirection, RES_FRAMEDIR ) );
+
+ if (bChgAdjust)
+ {
+ SvxAdjust eAdjust = (SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot) ?
+ SVX_ADJUST_LEFT : SVX_ADJUST_RIGHT;
+ SvxAdjustItem aAdjust( eAdjust, RES_PARATR_ADJUST );
+ aSet.Put( aAdjust );
+ aAdjust.SetWhich(SID_ATTR_PARA_ADJUST);
+ GetView().GetViewFrame()->GetBindings().SetState( aAdjust );
+ // Toggle numbering alignment
+ const SwNumRule* pCurRule = GetShell().GetCurNumRule();
+ if( pCurRule )
+ {
+ SvxNumRule aRule = pCurRule->MakeSvxNumRule();
+
+ for(USHORT i = 0; i < aRule.GetLevelCount(); i++)
+ {
+ SvxNumberFormat aFmt(aRule.GetLevel(i));
+ if(SVX_ADJUST_LEFT == aFmt.GetNumAdjust())
+ aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
+
+ else if(SVX_ADJUST_RIGHT == aFmt.GetNumAdjust())
+ aFmt.SetNumAdjust( SVX_ADJUST_LEFT );
+
+ aRule.SetLevel(i, aFmt, aRule.Get(i) != 0);
+ }
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ SwNumRule aSetRule( pCurRule->GetName(),
+ pCurRule->Get( 0 ).GetPositionAndSpaceMode() );
+ // <--
+ aSetRule.SetSvxRule( aRule, GetShell().GetDoc());
+ aSetRule.SetAutoRule( TRUE );
+ // --> OD 2008-03-17 #refactorlists#
+ // no start or continuation of a list - list style is only changed
+ GetShell().SetCurNumRule( aSetRule, false );
+ // <--
+ }
+ }
+ }
+ break;
+
+ default:
+ ASSERT(FALSE, falscher Dispatcher);
+ return;
+ }
+ SwWrtShell& rWrtSh = GetShell();
+ SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl();
+ if(pColl && pColl->IsAutoUpdateFmt())
+ {
+ rWrtSh.AutoUpdatePara(pColl, aSet);
+ }
+ else
+ rWrtSh.SetAttr( aSet );
+ rReq.Done();
+}
+
+#endif
+
+
+
+void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem *pItem = 0;
+
+ USHORT nSlot = rReq.GetSlot();
+ if(pArgs)
+ pArgs->GetItemState(GetPool().GetWhich(nSlot), FALSE, &pItem);
+ switch ( nSlot )
+ {
+ case FN_DROP_CHAR_STYLE_NAME:
+ if( pItem )
+ {
+ String sCharStyleName = ((const SfxStringItem*)pItem)->GetValue();
+ SfxItemSet aSet(GetPool(), RES_PARATR_DROP, RES_PARATR_DROP, 0L);
+ rSh.GetCurAttr(aSet);
+ SwFmtDrop aDropItem((const SwFmtDrop&)aSet.Get(RES_PARATR_DROP));
+ SwCharFmt* pFmt = 0;
+ if(sCharStyleName.Len())
+ pFmt = rSh.FindCharFmtByName( sCharStyleName );
+ aDropItem.SetCharFmt( pFmt );
+ aSet.Put(aDropItem);
+ rSh.SetAttr(aSet);
+ }
+ break;
+ case FN_FORMAT_DROPCAPS:
+ {
+ if(pItem)
+ {
+ rSh.SetAttr(*pItem);
+ rReq.Done();
+ }
+ else
+ {
+ SfxItemSet aSet(GetPool(), RES_PARATR_DROP, RES_PARATR_DROP,
+ HINT_END, HINT_END, 0);
+ rSh.GetCurAttr(aSet);
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aSet,
+ rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), DLG_SWDROPCAPS );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if (pDlg->Execute() == RET_OK)
+ {
+ rSh.StartAction();
+ rSh.StartUndo( UNDO_START );
+ if ( SFX_ITEM_SET == aSet.GetItemState(HINT_END,FALSE,&pItem) )
+ {
+ if ( ((SfxStringItem*)pItem)->GetValue().Len() )
+ rSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue());
+ }
+ rSh.SetAttr(*pDlg->GetOutputItemSet());
+ rSh.StartUndo( UNDO_END );
+ rSh.EndAction();
+ rReq.Done(*pDlg->GetOutputItemSet());
+ }
+ delete pDlg;
+ }
+ }
+ break;
+ case SID_ATTR_PARA_PAGEBREAK:
+ if(pItem)
+ {
+ rSh.SetAttr( *pItem );
+ rReq.Done();
+ }
+ break;
+ case SID_ATTR_PARA_MODEL:
+ {
+ if(pItem)
+ {
+ SfxItemSet aCoreSet( GetPool(),
+ RES_PAGEDESC, RES_PAGEDESC,
+ SID_ATTR_PARA_MODEL, SID_ATTR_PARA_MODEL, 0);
+ aCoreSet.Put(*pItem);
+ SfxToSwPageDescAttr( rSh, aCoreSet);
+ rSh.SetAttr(aCoreSet);
+ rReq.Done();
+ }
+ }
+ break;
+
+ default:
+ ASSERT(FALSE, falscher Dispatcher);
+ return;
+ }
+}
+
+
+
+void SwTextShell::GetAttrState(SfxItemSet &rSet)
+{
+ SwWrtShell &rSh = GetShell();
+ SfxItemPool& rPool = GetPool();
+ SfxItemSet aCoreSet(rPool, aTxtFmtCollSetRange);
+ rSh.GetCurAttr(aCoreSet); // *alle* Textattribute von der Core erfragen
+
+ SfxWhichIter aIter(rSet);
+ USHORT nSlot = aIter.FirstWhich();
+ sal_Bool bFlag = sal_False;
+ SfxBoolItem aFlagItem;
+ const SfxPoolItem* pItem = 0;
+ int eAdjust = -1; // Illegaler Wert, um DONTCARE zu erkennen
+ SfxItemState eState = aCoreSet.GetItemState(RES_PARATR_ADJUST, FALSE, &pItem);
+
+ if( SFX_ITEM_DEFAULT == eState )
+ pItem = &rPool.GetDefaultItem(RES_PARATR_ADJUST);
+ if( SFX_ITEM_DEFAULT <= eState )
+ eAdjust = (int)(( SvxAdjustItem* ) pItem)->GetAdjust();
+
+ short nEsc = 0;
+ eState = aCoreSet.GetItemState(RES_CHRATR_ESCAPEMENT, FALSE, &pItem);
+ if( SFX_ITEM_DEFAULT == eState )
+ pItem = &rPool.GetDefaultItem(RES_CHRATR_ESCAPEMENT);
+ if( eState >= SFX_ITEM_DEFAULT )
+ nEsc = ((SvxEscapementItem* )pItem)->GetEsc();
+
+ USHORT nLineSpace = 0;
+ eState = aCoreSet.GetItemState(RES_PARATR_LINESPACING, FALSE, &pItem);
+ if( SFX_ITEM_DEFAULT == eState )
+ pItem = &rPool.GetDefaultItem(RES_PARATR_LINESPACING);
+ if( SFX_ITEM_DEFAULT <= eState &&
+ ((SvxLineSpacingItem* )pItem)->GetLineSpaceRule() == SVX_LINE_SPACE_AUTO )
+ {
+ if(SVX_INTER_LINE_SPACE_OFF ==
+ ((SvxLineSpacingItem* )pItem)->GetInterLineSpaceRule())
+ nLineSpace = 100;
+ else
+ nLineSpace = ((SvxLineSpacingItem* )pItem)->GetPropLineSpace();
+ }
+
+ while (nSlot)
+ {
+ switch(nSlot)
+ {
+ case FN_SET_SUPER_SCRIPT:
+ bFlag = 0 < nEsc;
+ break;
+ case FN_SET_SUB_SCRIPT:
+ bFlag = 0 > nEsc;
+ break;
+ case SID_ATTR_PARA_ADJUST_LEFT:
+ if (eAdjust == -1)
+ {
+ rSet.InvalidateItem( nSlot );
+ nSlot = 0;
+ }
+ else
+ bFlag = SVX_ADJUST_LEFT == eAdjust;
+ break;
+ case SID_ATTR_PARA_ADJUST_RIGHT:
+ if (eAdjust == -1)
+ {
+ rSet.InvalidateItem( nSlot );
+ nSlot = 0;
+ }
+ else
+ bFlag = SVX_ADJUST_RIGHT == eAdjust;
+ break;
+ case SID_ATTR_PARA_ADJUST_CENTER:
+ if (eAdjust == -1)
+ {
+ rSet.InvalidateItem( nSlot );
+ nSlot = 0;
+ }
+ else
+ bFlag = SVX_ADJUST_CENTER == eAdjust;
+ break;
+ case SID_ATTR_PARA_ADJUST_BLOCK:
+ {
+ if (eAdjust == -1)
+ {
+ rSet.InvalidateItem( nSlot );
+ nSlot = 0;
+ }
+ else
+ {
+ bFlag = SVX_ADJUST_BLOCK == eAdjust;
+ USHORT nHtmlMode = GetHtmlMode(rSh.GetView().GetDocShell());
+ if((nHtmlMode & HTMLMODE_ON) && !(nHtmlMode & (HTMLMODE_FULL_STYLES|HTMLMODE_FIRSTLINE) ))
+ {
+ rSet.DisableItem( nSlot );
+ nSlot = 0;
+ }
+ }
+ }
+ break;
+ case SID_ATTR_PARA_LINESPACE_10:
+ bFlag = nLineSpace == 100;
+ break;
+ case SID_ATTR_PARA_LINESPACE_15:
+ bFlag = nLineSpace == 150;
+ break;
+ case SID_ATTR_PARA_LINESPACE_20:
+ bFlag = nLineSpace == 200;
+ break;
+ case FN_GROW_FONT_SIZE:
+ case FN_SHRINK_FONT_SIZE:
+ {
+ SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT,
+ *rSet.GetPool() );
+ aSetItem.GetItemSet().Put( aCoreSet, FALSE );
+ if( !aSetItem.GetItemOfScript( rSh.GetScriptType() ))
+ rSet.DisableItem( nSlot );
+ nSlot = 0;
+ }
+ break;
+ case FN_UNDERLINE_DOUBLE:
+ {
+ eState = aCoreSet.GetItemState(RES_CHRATR_UNDERLINE);
+ if( eState >= SFX_ITEM_DEFAULT )
+ {
+ FontUnderline eUnderline = ((const SvxUnderlineItem&)
+ aCoreSet.Get(RES_CHRATR_UNDERLINE)).GetLineStyle();
+ rSet.Put(SfxBoolItem(nSlot, eUnderline == UNDERLINE_DOUBLE));
+ }
+ else
+ rSet.InvalidateItem(nSlot);
+ nSlot = 0;
+ }
+ break;
+ case SID_ATTR_PARA_ADJUST:
+ if (eAdjust == -1)
+ rSet.InvalidateItem( nSlot );
+ else
+ rSet.Put(SvxAdjustItem((SvxAdjust)eAdjust, SID_ATTR_PARA_ADJUST ));
+ nSlot = 0;
+ break;
+
+ case SID_ATTR_PARA_LEFT_TO_RIGHT :
+ case SID_ATTR_PARA_RIGHT_TO_LEFT :
+ {
+ if ( !SW_MOD()->GetCTLOptions().IsCTLFontEnabled() )
+ {
+ rSet.DisableItem( nSlot );
+ nSlot = 0;
+ }
+ else
+ {
+ // is the item set?
+ USHORT nHtmlMode = GetHtmlMode(rSh.GetView().GetDocShell());
+ if((!(nHtmlMode & HTMLMODE_ON) || (0 != (nHtmlMode & HTMLMODE_SOME_STYLES))) &&
+ aCoreSet.GetItemState( RES_FRAMEDIR, FALSE ) >= SFX_ITEM_DEFAULT)
+ {
+ SvxFrameDirection eFrmDir = (SvxFrameDirection)
+ ((const SvxFrameDirectionItem& )aCoreSet.Get(RES_FRAMEDIR)).GetValue();
+ if (FRMDIR_ENVIRONMENT == eFrmDir)
+ {
+ eFrmDir = rSh.IsInRightToLeftText() ?
+ FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP;
+ }
+ bFlag = (SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot &&
+ FRMDIR_HORI_LEFT_TOP == eFrmDir) ||
+ (SID_ATTR_PARA_RIGHT_TO_LEFT == nSlot &&
+ FRMDIR_HORI_RIGHT_TOP == eFrmDir);
+ }
+ else
+ {
+ rSet.InvalidateItem(nSlot);
+ nSlot = 0;
+ }
+ }
+ }
+ break;
+
+ case SID_ATTR_CHAR_LANGUAGE:
+ case SID_ATTR_CHAR_KERNING:
+ case RES_PARATR_DROP:
+ {
+#if OSL_DEBUG_LEVEL > 1
+ const SfxPoolItem& rItem = aCoreSet.Get(GetPool().GetWhich(nSlot), TRUE);
+ rSet.Put(rItem);
+#else
+ rSet.Put(aCoreSet.Get( GetPool().GetWhich(nSlot), TRUE));
+#endif
+ nSlot = 0;
+ }
+ break;
+ case SID_ATTR_PARA_MODEL:
+ {
+ SfxItemSet aTemp(GetPool(),
+ RES_PAGEDESC,RES_PAGEDESC,
+ SID_ATTR_PARA_MODEL,SID_ATTR_PARA_MODEL,
+ 0L);
+ aTemp.Put(aCoreSet);
+ ::SwToSfxPageDescAttr(aTemp);
+ rSet.Put(aTemp.Get(SID_ATTR_PARA_MODEL));
+ nSlot = 0;
+ }
+ break;
+ case RES_TXTATR_INETFMT:
+ {
+ SfxItemSet aSet(GetPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT);
+ rSh.GetCurAttr(aSet);
+#if OSL_DEBUG_LEVEL > 1
+ const SfxPoolItem& rItem = aSet.Get(RES_TXTATR_INETFMT, TRUE);
+ rSet.Put(rItem);
+#else
+ rSet.Put(aSet.Get( RES_TXTATR_INETFMT, TRUE));
+#endif
+ nSlot = 0;
+ }
+ break;
+
+ default:
+ // Nichts tun
+ nSlot = 0;
+ break;
+
+ }
+ if( nSlot )
+ {
+ aFlagItem.SetWhich( nSlot );
+ aFlagItem.SetValue( bFlag );
+ rSet.Put( aFlagItem );
+ }
+ nSlot = aIter.NextWhich();
+ }
+
+ rSet.Put(aCoreSet,FALSE);
+}
+
+
+
diff --git a/sw/source/ui/shells/txtcrsr.cxx b/sw/source/ui/shells/txtcrsr.cxx
new file mode 100644
index 000000000000..69f82ebf902d
--- /dev/null
+++ b/sw/source/ui/shells/txtcrsr.cxx
@@ -0,0 +1,370 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/request.hxx>
+#include <svl/eitem.hxx>
+#ifndef __SBX_SBXVARIABLE_HXX //autogen
+#include <basic/sbxvar.hxx>
+#endif
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#ifndef _TEXTSH_HXX
+#include <textsh.hxx>
+#endif
+#include <num.hxx>
+#include <edtwin.hxx>
+#include <crsskip.hxx>
+#include <doc.hxx>
+#include <docsh.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <globals.h>
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+
+#include <svx/svdouno.hxx>
+#include <svx/fmshell.hxx>
+#include <svx/sdrobjectfilter.hxx>
+
+using namespace ::com::sun::star;
+
+void SwTextShell::ExecBasicMove(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ GetView().GetEditWin().FlushInBuffer();
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ BOOL bSelect = FALSE;
+ USHORT nCount = 1;
+ if(pArgs)
+ {
+ const SfxPoolItem *pItem;
+ if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_MOVE_COUNT, TRUE, &pItem))
+ nCount = ((const SfxInt16Item *)pItem)->GetValue();
+ if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_MOVE_SELECTION, TRUE, &pItem))
+ bSelect = ((const SfxBoolItem *)pItem)->GetValue();
+ }
+ switch(rReq.GetSlot())
+ {
+ case FN_CHAR_LEFT_SEL: rReq.SetSlot( FN_CHAR_LEFT ); bSelect = TRUE; break;
+ case FN_CHAR_RIGHT_SEL: rReq.SetSlot( FN_CHAR_RIGHT ); bSelect = TRUE; break;
+ case FN_LINE_UP_SEL: rReq.SetSlot( FN_LINE_UP ); bSelect = TRUE; break;
+ case FN_LINE_DOWN_SEL: rReq.SetSlot( FN_LINE_DOWN ); bSelect = TRUE; break;
+ }
+
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ GetView().GetViewFrame()->GetBindings().GetRecorder();
+ if ( xRecorder.is() )
+ {
+ rReq.AppendItem( SfxInt16Item(FN_PARAM_MOVE_COUNT, nCount) );
+ rReq.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, bSelect) );
+ }
+ USHORT nSlot = rReq.GetSlot();
+ rReq.Done();
+ // Get EditWin before calling the move functions (shell change may occur!)
+ SwEditWin& rTmpEditWin = GetView().GetEditWin();
+ for( USHORT i = 0; i < nCount; i++ )
+ {
+ switch(nSlot)
+ {
+ case FN_CHAR_LEFT: rSh.Left( CRSR_SKIP_CELLS, bSelect, 1, FALSE, TRUE ); break;
+ case FN_CHAR_RIGHT: rSh.Right( CRSR_SKIP_CELLS, bSelect, 1, FALSE, TRUE ); break;
+ case FN_LINE_UP: rSh.Up ( bSelect, 1 ); break;
+ case FN_LINE_DOWN: rSh.Down ( bSelect, 1 ); break;
+ default: ASSERT(FALSE, falscher Dispatcher); return;
+ }
+ }
+
+ //#i42732# - notify the edit window that from now on we do not use the input language
+ rTmpEditWin.SetUseInputLanguage( sal_False );
+}
+
+void SwTextShell::ExecMove(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ SwEditWin& rTmpEditWin = GetView().GetEditWin();
+ rTmpEditWin.FlushInBuffer();
+
+ USHORT nSlot = rReq.GetSlot();
+ BOOL bRet = FALSE;
+ switch ( nSlot )
+ {
+ case FN_START_OF_LINE_SEL:
+ case FN_START_OF_LINE: bRet = rSh.LeftMargin ( FN_START_OF_LINE_SEL == nSlot, FALSE );
+ break;
+
+ case FN_END_OF_LINE_SEL:
+ case FN_END_OF_LINE: bRet = rSh.RightMargin( FN_END_OF_LINE_SEL == nSlot, FALSE );
+ break;
+
+ case FN_START_OF_DOCUMENT_SEL:
+ case FN_START_OF_DOCUMENT: bRet = rSh.SttDoc ( FN_START_OF_DOCUMENT_SEL == nSlot);
+ break;
+
+ case FN_END_OF_DOCUMENT_SEL:
+ case FN_END_OF_DOCUMENT: bRet = rSh.EndDoc( FN_END_OF_DOCUMENT_SEL == nSlot );
+ break;
+
+ case FN_SELECT_WORD: bRet = rSh.SelNearestWrd(); break;
+
+ case SID_SELECTALL: bRet = 0 != rSh.SelAll(); break;
+ default: ASSERT(FALSE, falscher Dispatcher); return;
+ }
+
+ if ( bRet )
+ rReq.Done();
+ else
+ rReq.Ignore();
+
+ //#i42732# - notify the edit window that from now on we do not use the input language
+ rTmpEditWin.SetUseInputLanguage( sal_False );
+}
+
+void SwTextShell::ExecMovePage(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ GetView().GetEditWin().FlushInBuffer();
+
+ USHORT nSlot = rReq.GetSlot();
+ switch( nSlot )
+ {
+ case FN_START_OF_NEXT_PAGE_SEL :
+ case FN_START_OF_NEXT_PAGE: rSh.SttNxtPg( FN_START_OF_NEXT_PAGE_SEL == nSlot ); break;
+
+ case FN_END_OF_NEXT_PAGE_SEL:
+ case FN_END_OF_NEXT_PAGE: rSh.EndNxtPg( FN_END_OF_NEXT_PAGE_SEL == nSlot ); break;
+
+ case FN_START_OF_PREV_PAGE_SEL:
+ case FN_START_OF_PREV_PAGE: rSh.SttPrvPg( FN_START_OF_PREV_PAGE_SEL == nSlot ); break;
+
+ case FN_END_OF_PREV_PAGE_SEL:
+ case FN_END_OF_PREV_PAGE: rSh.EndPrvPg( FN_END_OF_PREV_PAGE_SEL == nSlot ); break;
+
+ case FN_START_OF_PAGE_SEL:
+ case FN_START_OF_PAGE: rSh.SttPg ( FN_START_OF_PAGE_SEL == nSlot ); break;
+
+ case FN_END_OF_PAGE_SEL:
+ case FN_END_OF_PAGE: rSh.EndPg ( FN_END_OF_PAGE_SEL == nSlot ); break;
+ default: ASSERT(FALSE, falscher Dispatcher); return;
+ }
+ rReq.Done();
+}
+
+
+void SwTextShell::ExecMoveCol(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ switch ( rReq.GetSlot() )
+ {
+ case FN_START_OF_COLUMN: rSh.StartOfColumn ( FALSE ); break;
+ case FN_END_OF_COLUMN: rSh.EndOfColumn ( FALSE ); break;
+ case FN_START_OF_NEXT_COLUMN: rSh.StartOfNextColumn( FALSE ) ; break;
+ case FN_END_OF_NEXT_COLUMN: rSh.EndOfNextColumn ( FALSE ); break;
+ case FN_START_OF_PREV_COLUMN: rSh.StartOfPrevColumn( FALSE ); break;
+ case FN_END_OF_PREV_COLUMN: rSh.EndOfPrevColumn ( FALSE ); break;
+ default: ASSERT(FALSE, falscher Dispatcher); return;
+ }
+ rReq.Done();
+}
+
+void SwTextShell::ExecMoveLingu(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ GetView().GetEditWin().FlushInBuffer();
+
+ USHORT nSlot = rReq.GetSlot();
+ BOOL bRet = FALSE;
+ switch ( nSlot )
+ {
+ case FN_NEXT_WORD_SEL:
+ case FN_NEXT_WORD: bRet = rSh.NxtWrd( FN_NEXT_WORD_SEL == nSlot );
+ break;
+
+ case FN_START_OF_PARA_SEL:
+ case FN_START_OF_PARA: bRet = rSh.SttPara( FN_START_OF_PARA_SEL == nSlot );
+ break;
+
+ case FN_END_OF_PARA_SEL:
+ case FN_END_OF_PARA: bRet = rSh.EndPara( FN_END_OF_PARA_SEL == nSlot );
+ break;
+
+ case FN_PREV_WORD_SEL:
+ case FN_PREV_WORD: bRet = rSh.PrvWrd( FN_PREV_WORD_SEL == nSlot );
+ break;
+
+ case FN_NEXT_SENT_SEL:
+ case FN_NEXT_SENT: bRet = rSh.FwdSentence( FN_NEXT_SENT_SEL == nSlot );
+ break;
+
+ case FN_PREV_SENT_SEL:
+ case FN_PREV_SENT: bRet = rSh.BwdSentence( FN_PREV_SENT_SEL == nSlot );
+ break;
+
+ case FN_NEXT_PARA: bRet = rSh.FwdPara ( FALSE );
+ break;
+
+ case FN_PREV_PARA: bRet = rSh.BwdPara ( FALSE );
+ break;
+ default: ASSERT(FALSE, falscher Dispatcher); return;
+ }
+ rReq.Done();
+}
+
+void SwTextShell::ExecMoveMisc(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetShell();
+ USHORT nSlot = rReq.GetSlot();
+ BOOL bSetRetVal = TRUE, bRet = TRUE;
+ switch ( nSlot )
+ {
+ case SID_FM_TOGGLECONTROLFOCUS:
+ {
+ const SwDoc* pDoc = rSh.GetDoc();
+ const SwDocShell* pDocShell = pDoc ? pDoc->GetDocShell() : NULL;
+ const SwView* pView = pDocShell ? pDocShell->GetView() : NULL;
+ const FmFormShell* pFormShell = pView ? pView->GetFormShell() : NULL;
+ SdrView* pDrawView = pView ? pView->GetDrawView() : NULL;
+ Window* pWindow = pView ? pView->GetWrtShell().GetWin() : NULL;
+
+ OSL_ENSURE( pFormShell && pDrawView && pWindow, "SwXTextView::ExecMoveMisc: no chance!" );
+ if ( !pFormShell || !pDrawView || !pWindow )
+ break;
+
+ ::std::auto_ptr< ::svx::ISdrObjectFilter > pFilter( pFormShell->CreateFocusableControlFilter(
+ *pDrawView, *pWindow ) );
+ if ( !pFilter.get() )
+ break;
+
+ const SdrObject* pNearestControl = rSh.GetBestObject( TRUE, GOTOOBJ_DRAW_CONTROL, FALSE, pFilter.get() );
+ if ( !pNearestControl )
+ break;
+
+ const SdrUnoObj* pUnoObject = dynamic_cast< const SdrUnoObj* >( pNearestControl );
+ OSL_ENSURE( pUnoObject, "SwTextShell::ExecMoveMisc: GetBestObject returned nonsense!" );
+ if ( !pUnoObject )
+ break;
+
+ pFormShell->ToggleControlFocus( *pUnoObject, *pDrawView, *pWindow );
+ }
+ break;
+ case FN_CNTNT_TO_NEXT_FRAME:
+ bRet = rSh.GotoObj(TRUE, GOTOOBJ_GOTO_ANY);
+ if(bRet)
+ {
+ rSh.HideCrsr();
+ rSh.EnterSelFrmMode();
+ }
+ break;
+ case FN_NEXT_FOOTNOTE:
+ rSh.MoveCrsr();
+ bRet = rSh.GotoNextFtnAnchor();
+ break;
+ case FN_PREV_FOOTNOTE:
+ rSh.MoveCrsr();
+ bRet = rSh.GotoPrevFtnAnchor();
+ break;
+ case FN_TO_HEADER:
+ rSh.MoveCrsr();
+ if ( FRMTYPE_HEADER & rSh.GetFrmType(0,FALSE) )
+ rSh.SttPg();
+ else
+ rSh.GotoHeaderTxt();
+ bSetRetVal = FALSE;
+ break;
+ case FN_TO_FOOTER:
+ rSh.MoveCrsr();
+ if ( FRMTYPE_FOOTER & rSh.GetFrmType(0,FALSE) )
+ rSh.EndPg();
+ else
+ rSh.GotoFooterTxt();
+ bSetRetVal = FALSE;
+ break;
+ case FN_FOOTNOTE_TO_ANCHOR:
+ rSh.MoveCrsr();
+ if ( FRMTYPE_FOOTNOTE & rSh.GetFrmType(0,FALSE) )
+ rSh.GotoFtnAnchor();
+ else
+ rSh.GotoFtnTxt();
+ bSetRetVal = FALSE;
+ break;
+ case FN_TO_FOOTNOTE_AREA :
+ rSh.GotoFtnTxt();
+ break;
+ case FN_PREV_TABLE:
+ bRet = rSh.MoveTable( fnTablePrev, fnTableStart);
+ break;
+ case FN_NEXT_TABLE:
+ bRet = rSh.MoveTable(fnTableNext, fnTableStart);
+ break;
+ case FN_GOTO_NEXT_REGION :
+ bRet = rSh.MoveRegion(fnRegionNext, fnRegionStart);
+ break;
+ case FN_GOTO_PREV_REGION :
+ bRet = rSh.MoveRegion(fnRegionPrev, fnRegionStart);
+ break;
+
+ case FN_NEXT_TOXMARK:
+ bRet = rSh.GotoNxtPrvTOXMark( TRUE );
+ break;
+ case FN_PREV_TOXMARK:
+ bRet = rSh.GotoNxtPrvTOXMark( FALSE );
+ break;
+ case FN_NEXT_TBLFML:
+ bRet = rSh.GotoNxtPrvTblFormula( TRUE, FALSE );
+ break;
+ case FN_PREV_TBLFML:
+ bRet = rSh.GotoNxtPrvTblFormula( FALSE, FALSE );
+ break;
+ case FN_NEXT_TBLFML_ERR:
+ bRet = rSh.GotoNxtPrvTblFormula( TRUE, TRUE );
+ break;
+ case FN_PREV_TBLFML_ERR:
+ bRet = rSh.GotoNxtPrvTblFormula( FALSE, TRUE );
+ break;
+
+ default:
+ ASSERT(FALSE, falscher Dispatcher);
+ return;
+ }
+
+ if( bSetRetVal )
+ rReq.SetReturnValue(SfxBoolItem( nSlot, bRet ));
+ rReq.Done();
+
+}
+
diff --git a/sw/source/ui/shells/txtnum.cxx b/sw/source/ui/shells/txtnum.cxx
new file mode 100644
index 000000000000..0e89b96a8d6a
--- /dev/null
+++ b/sw/source/ui/shells/txtnum.cxx
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <sfx2/request.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <numrule.hxx>
+
+#include "cmdid.h"
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "viewopt.hxx"
+#include "wdocsh.hxx"
+#include "textsh.hxx"
+#include "uiitems.hxx"
+#include "swabstdlg.hxx"
+#include <globals.hrc>
+#include <sfx2/tabdlg.hxx>
+
+void SwTextShell::ExecEnterNum(SfxRequest &rReq)
+{
+ //wg. Aufzeichnung schon vor dem evtl. Shellwechsel
+ switch(rReq.GetSlot())
+ {
+ case FN_NUM_NUMBERING_ON:
+ {
+ SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False );
+ BOOL bMode = !GetShell().HasNumber(); // #i29560#
+ if ( pItem )
+ bMode = pItem->GetValue();
+ else
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) );
+
+ if ( bMode != (GetShell().HasNumber()) ) // #i29560#
+ {
+ rReq.Done();
+ if( bMode )
+ GetShell().NumOn();
+ else
+ GetShell().NumOrBulletOff(); // #i29560#
+ }
+ }
+ break;
+ case FN_NUM_BULLET_ON:
+ {
+ SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , sal_False );
+ BOOL bMode = !GetShell().HasBullet(); // #i29560#
+ if ( pItem )
+ bMode = pItem->GetValue();
+ else
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) );
+
+ if ( bMode != (GetShell().HasBullet()) ) // #i29560#
+ {
+ rReq.Done();
+ if( bMode )
+ GetShell().BulletOn();
+ else
+ GetShell().NumOrBulletOff(); // #i29560#
+ }
+ }
+ break;
+ case FN_NUMBER_BULLETS:
+ {
+ // --> OD 2008-02-29 #refactorlists#
+// // per default TRUE, damit die Schleife im Dialog richtig arbeitet!
+// BOOL bHasChild = TRUE;
+ // <--
+ SfxItemSet aSet(GetPool(),
+ SID_HTML_MODE, SID_HTML_MODE,
+ SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
+ 0 );
+ SwDocShell* pDocSh = GetView().GetDocShell();
+ BOOL bHtml = 0 != PTR_CAST(SwWebDocShell, pDocSh);
+ const SwNumRule* pCurRule = GetShell().GetCurNumRule();
+ if( pCurRule )
+ {
+ SvxNumRule aRule = pCurRule->MakeSvxNumRule();
+
+ //convert type of linked bitmaps from SVX_NUM_BITMAP to (SVX_NUM_BITMAP|LINK_TOKEN)
+ for(USHORT i = 0; i < aRule.GetLevelCount(); i++)
+ {
+ SvxNumberFormat aFmt(aRule.GetLevel(i));
+ if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
+ {
+ const SvxBrushItem* pBrush = aFmt.GetBrush();
+ const String* pLinkStr;
+ if(pBrush &&
+ 0 != (pLinkStr = pBrush->GetGraphicLink()) &&
+ pLinkStr->Len())
+ aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN));
+ aRule.SetLevel(i, aFmt, aRule.Get(i) != 0);
+ }
+ }
+ if(bHtml)
+ aRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, FALSE);
+
+ aSet.Put(SvxNumBulletItem(aRule));
+ // --> OD 2008-02-29 #refactorlists# - removed <bHasChild>
+ ASSERT( GetShell().GetNumLevel() < MAXLEVEL,
+ "<SwTextShell::ExecEnterNum()> - numbered node without valid list level. Serious defect -> please inform OD." );
+ USHORT nLevel = GetShell().GetNumLevel();
+ // <--
+ if( nLevel < MAXLEVEL )
+ {
+ nLevel = 1<<nLevel;
+ aSet.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ));
+ }
+ }
+ else
+ {
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ SwNumRule aRule( GetShell().GetUniqueNumRuleName(),
+ // --> OD 2008-06-06 #i89178#
+ numfunc::GetDefaultPositionAndSpaceMode() );
+ // <--
+ // <--
+ SvxNumRule aSvxRule = aRule.MakeSvxNumRule();
+ const bool bRightToLeft = GetShell().IsInRightToLeftText( 0 );
+
+ if( bHtml || bRightToLeft )
+ {
+ for( BYTE n = 0; n < MAXLEVEL; ++n )
+ {
+ SvxNumberFormat aFmt( aSvxRule.GetLevel( n ) );
+ if ( n && bHtml )
+ {
+ // 1/2" fuer HTML
+ aFmt.SetLSpace(720);
+ aFmt.SetAbsLSpace(n * 720);
+ }
+ // --> FME 2005-01-21 #i38904# Default alignment for
+ // numbering/bullet should be rtl in rtl paragraph:
+ if ( bRightToLeft )
+ {
+ aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
+ }
+ // <--
+ aSvxRule.SetLevel( n, aFmt, FALSE );
+ }
+ aSvxRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, FALSE);
+ }
+ aSet.Put(SvxNumBulletItem(aSvxRule));
+ }
+
+ aSet.Put( SfxBoolItem( SID_PARAM_NUM_PRESET,FALSE ));
+
+ // vor dem Dialog wird der HtmlMode an der DocShell versenkt
+ pDocSh->PutItem(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(pDocSh)));
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_SVXTEST_NUM_BULLET,
+ GetView().GetWindow(), &aSet, GetShell());
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ USHORT nRet = pDlg->Execute();
+ const SfxPoolItem* pItem;
+ if( RET_OK == nRet )
+ {
+ if( SFX_ITEM_SET == pDlg->GetOutputItemSet()->GetItemState( SID_ATTR_NUMBERING_RULE, FALSE, &pItem ))
+ {
+ rReq.AppendItem(*pItem);
+ rReq.Done();
+ SvxNumRule* pSetRule = ((SvxNumBulletItem*)pItem)->GetNumRule();
+ pSetRule->UnLinkGraphics();
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ SwNumRule aSetRule( pCurRule
+ ? pCurRule->GetName()
+ : GetShell().GetUniqueNumRuleName(),
+ // --> OD 2008-06-06 #i89178#
+ numfunc::GetDefaultPositionAndSpaceMode() );
+ // <--
+ // <--
+ aSetRule.SetSvxRule( *pSetRule, GetShell().GetDoc());
+ aSetRule.SetAutoRule( TRUE );
+ // --> OD 2008-03-17 #refactorlists#
+ // No start of new list, if an existing list style is edited.
+ // Otherwise start a new list.
+ const bool bCreateList = (pCurRule == 0);
+ GetShell().SetCurNumRule( aSetRule, bCreateList );
+ // <--
+ }
+ // wenn der Dialog mit OK verlassen wurde, aber nichts ausgewaehlt
+ // wurde dann muss die Numerierung zumindest eingeschaltet werden,
+ // wenn sie das noch nicht ist
+ else if( !pCurRule && SFX_ITEM_SET == aSet.GetItemState( SID_ATTR_NUMBERING_RULE, FALSE, &pItem ))
+ {
+ rReq.AppendItem( *pItem );
+ rReq.Done();
+ SvxNumRule* pSetRule = ((SvxNumBulletItem*)pItem)->GetNumRule();
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ SwNumRule aSetRule( GetShell().GetUniqueNumRuleName(),
+ // --> OD 2008-06-06 #i89178#
+ numfunc::GetDefaultPositionAndSpaceMode() );
+ // <--
+ // <--
+ aSetRule.SetSvxRule(*pSetRule, GetShell().GetDoc());
+ aSetRule.SetAutoRule( TRUE );
+ // --> OD 2008-03-17 #refactorlists#
+ // start new list
+ GetShell().SetCurNumRule( aSetRule, true );
+ // <--
+ }
+ }
+ else if(RET_USER == nRet)
+ GetShell().DelNumRules();
+
+ delete pDlg;
+ }
+ break;
+ default:
+ ASSERT(FALSE, falscher Dispatcher);
+ return;
+ }
+}
+
+
diff --git a/sw/source/ui/smartmenu/stmenu.cxx b/sw/source/ui/smartmenu/stmenu.cxx
new file mode 100644
index 000000000000..4c7b473dfc50
--- /dev/null
+++ b/sw/source/ui/smartmenu/stmenu.cxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// SMARTTAGS
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <stmenu.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/dispatch.hxx>
+
+#include <SwSmartTagMgr.hxx>
+
+#ifndef _STMENU_HRC
+#include <stmenu.hrc>
+#endif
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <breakit.hxx>
+
+#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+SwSmartTagPopup::SwSmartTagPopup( SwView* pSwView,
+ Sequence< rtl::OUString >& rSmartTagTypes,
+ Sequence< Reference< container::XStringKeyMap > >& rStringKeyMaps,
+ Reference< text::XTextRange > xTextRange ) :
+ PopupMenu( SW_RES(MN_SMARTTAG_POPUP) ),
+ mpSwView ( pSwView ),
+ mxTextRange( xTextRange )
+{
+ //CreateAutoMnemonics();
+
+ Reference <frame::XController> xController = mpSwView->GetController();
+ const lang::Locale aLocale( SW_BREAKITER()->GetLocale( (LanguageType)GetAppLanguage() ) );
+
+ USHORT nMenuPos = 0;
+ USHORT nSubMenuPos = 0;
+ USHORT nMenuId = 1;
+ USHORT nSubMenuId = MN_ST_INSERT_START;
+
+ const rtl::OUString aRangeText = mxTextRange->getString();
+
+ SmartTagMgr& rSmartTagMgr = SwSmartTagMgr::Get();
+ const rtl::OUString aApplicationName( rSmartTagMgr.GetApplicationName() );
+
+ Sequence < Sequence< Reference< smarttags::XSmartTagAction > > > aActionComponentsSequence;
+ Sequence < Sequence< sal_Int32 > > aActionIndicesSequence;
+
+ rSmartTagMgr.GetActionSequences( rSmartTagTypes,
+ aActionComponentsSequence,
+ aActionIndicesSequence );
+
+ InsertSeparator(0);
+
+ for ( USHORT j = 0; j < aActionComponentsSequence.getLength(); ++j )
+ {
+ Reference< container::XStringKeyMap > xSmartTagProperties = rStringKeyMaps[j];
+
+ // Get all actions references associated with the current smart tag type:
+ const Sequence< Reference< smarttags::XSmartTagAction > >& rActionComponents = aActionComponentsSequence[j];
+ const Sequence< sal_Int32 >& rActionIndices = aActionIndicesSequence[j];
+
+ if ( 0 == rActionComponents.getLength() || 0 == rActionIndices.getLength() )
+ continue;
+
+ // Ask first entry for the smart tag type caption:
+ Reference< smarttags::XSmartTagAction > xAction = rActionComponents[0];
+
+ if ( !xAction.is() )
+ continue;
+
+ const sal_Int32 nSmartTagIndex = rActionIndices[0];
+ const rtl::OUString aSmartTagType = xAction->getSmartTagName( nSmartTagIndex );
+ const rtl::OUString aSmartTagCaption = xAction->getSmartTagCaption( nSmartTagIndex, aLocale );
+
+ // no sub-menues if there's only one smart tag type listed:
+ PopupMenu* pSbMenu = this;
+ if ( 1 < aActionComponentsSequence.getLength() )
+ {
+ InsertItem( nMenuId, aSmartTagCaption, 0, nMenuPos++);
+ pSbMenu = new PopupMenu;
+ SetPopupMenu( nMenuId++, pSbMenu );
+ }
+
+ // sub-menu starts with smart tag caption and separator
+ const rtl::OUString aSmartTagCaption2 = aSmartTagCaption + C2U(": ") + aRangeText;
+ nSubMenuPos = 0;
+ pSbMenu->InsertItem( nMenuId++, aSmartTagCaption2, MIB_NOSELECT, nSubMenuPos++ );
+ pSbMenu->InsertSeparator( nSubMenuPos++ );
+
+ // Add subitem for every action reference for the current smart tag type:
+ for ( USHORT i = 0; i < rActionComponents.getLength(); ++i )
+ {
+ xAction = rActionComponents[i];
+
+ for ( sal_Int32 k = 0; k < xAction->getActionCount( aSmartTagType, xController ); ++k )
+ {
+ const sal_uInt32 nActionID = xAction->getActionID( aSmartTagType, k, xController );
+ rtl::OUString aActionCaption = xAction->getActionCaptionFromID( nActionID,
+ aApplicationName,
+ aLocale,
+ xSmartTagProperties,
+ aRangeText,
+ rtl::OUString(),
+ xController,
+ mxTextRange );
+
+ pSbMenu->InsertItem( nSubMenuId++, aActionCaption, 0, nSubMenuPos++ );
+ InvokeAction aEntry( xAction, xSmartTagProperties, nActionID );
+ maInvokeActions.push_back( aEntry );
+ }
+ }
+ }
+}
+
+/** Function: Execute
+
+ executes actions by calling the invoke function of the appropriate
+ smarttag library.
+
+*/
+sal_uInt16 SwSmartTagPopup::Execute( const Rectangle& rWordPos, Window* pWin )
+{
+ sal_uInt16 nId = PopupMenu::Execute(pWin, pWin->LogicToPixel(rWordPos));
+
+ if ( nId == MN_SMARTTAG_OPTIONS )
+ {
+ SfxBoolItem aBool(SID_OPEN_SMARTTAGOPTIONS, TRUE);
+ mpSwView->GetViewFrame()->GetDispatcher()->Execute( SID_AUTO_CORRECT_DLG, SFX_CALLMODE_ASYNCHRON, &aBool, 0L );
+ }
+
+ if ( nId < MN_ST_INSERT_START) return nId;
+ nId -= MN_ST_INSERT_START;
+
+ // compute smarttag lib index and action index
+ if ( nId < maInvokeActions.size() )
+ {
+ Reference< smarttags::XSmartTagAction > xSmartTagAction = maInvokeActions[ nId ].mxAction;
+
+ // execute action
+ if ( xSmartTagAction.is() )
+ {
+ SmartTagMgr& rSmartTagMgr = SwSmartTagMgr::Get();
+
+ xSmartTagAction->invokeAction( maInvokeActions[ nId ].mnActionID,
+ rSmartTagMgr.GetApplicationName(),
+ mpSwView->GetController(),
+ mxTextRange,
+ maInvokeActions[ nId ].mxSmartTagProperties,
+ mxTextRange->getString(),
+ rtl::OUString(),
+ SW_BREAKITER()->GetLocale( (LanguageType)GetAppLanguage() ) );
+ }
+ }
+
+ return nId;
+}
diff --git a/sw/source/ui/smartmenu/stmenu.hrc b/sw/source/ui/smartmenu/stmenu.hrc
new file mode 100644
index 000000000000..56afc5752f79
--- /dev/null
+++ b/sw/source/ui/smartmenu/stmenu.hrc
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _STMENU_HRC
+#define _STMENU_HRC
+
+#include "rcid.hrc"
+
+#define MN_SMARTTAG_POPUP (RC_SMARTTAG_BEGIN + 1)
+
+#define MN_SMARTTAG 104
+#define MN_SMARTTAG_OPTIONS 105
+
+#define MN_ST_INSERT_START 500
+
+#endif
+
diff --git a/sw/source/ui/smartmenu/stmenu.src b/sw/source/ui/smartmenu/stmenu.src
new file mode 100644
index 000000000000..9775b829e7a0
--- /dev/null
+++ b/sw/source/ui/smartmenu/stmenu.src
@@ -0,0 +1,44 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* StarView ressource file */
+
+#include "stmenu.hrc"
+#include "helpid.h"
+
+Menu MN_SMARTTAG_POPUP
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ Identifier = MN_SMARTTAG_OPTIONS ;
+ HelpID = HID_SMARTTAG_MAIN ;
+ Text [ en-US ] = "Smart Tag Options..." ;
+ };
+ };
+};
+
diff --git a/sw/source/ui/table/chartins.cxx b/sw/source/ui/table/chartins.cxx
new file mode 100644
index 000000000000..50d22e2d7804
--- /dev/null
+++ b/sw/source/ui/table/chartins.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/viewfrm.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/basedlgs.hxx>
+#include <IDocumentUndoRedo.hxx>
+
+#include <sfx2/app.hxx>
+#include <swtypes.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <view.hxx>
+#include <chartins.hxx>
+#include <tablemgr.hxx>
+#include <frmfmt.hxx>
+#include <swtable.hxx>
+#include <tblsel.hxx>
+#include <unochart.hxx>
+#include <autoedit.hxx>
+#include <doc.hxx>
+
+#include <edtwin.hxx>
+
+#include <cmdid.h>
+#include <chartins.hrc>
+#include <anchoredobject.hxx>
+
+#include <sot/clsids.hxx>
+
+#include <cppuhelper/bootstrap.hxx>
+#include <cppuhelper/component_context.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+
+
+Point SwGetChartDialogPos( const Window *pParentWin, const Size& rDialogSize, const Rectangle& rLogicChart )
+{
+ // !! positioning code according to spepc; similar to Calc fuins2.cxx
+
+ Point aRet;
+
+ DBG_ASSERT( pParentWin, "Window not found" );
+ if (pParentWin)
+ {
+ Rectangle aObjPixel = pParentWin->LogicToPixel( rLogicChart, pParentWin->GetMapMode() );
+ Rectangle aObjAbs( pParentWin->OutputToAbsoluteScreenPixel( aObjPixel.TopLeft() ),
+ pParentWin->OutputToAbsoluteScreenPixel( aObjPixel.BottomRight() ) );
+
+ Rectangle aDesktop = pParentWin->GetDesktopRectPixel();
+ Size aSpace = pParentWin->LogicToPixel( Size( 8, 12 ), MAP_APPFONT );
+
+ BOOL bLayoutRTL = ::GetActiveView()->GetWrtShell().IsTableRightToLeft();
+ bool bCenterHor = false;
+
+ if ( aDesktop.Bottom() - aObjAbs.Bottom() >= rDialogSize.Height() + aSpace.Height() )
+ {
+ // first preference: below the chart
+ aRet.Y() = aObjAbs.Bottom() + aSpace.Height();
+ bCenterHor = true;
+ }
+ else if ( aObjAbs.Top() - aDesktop.Top() >= rDialogSize.Height() + aSpace.Height() )
+ {
+ // second preference: above the chart
+ aRet.Y() = aObjAbs.Top() - rDialogSize.Height() - aSpace.Height();
+ bCenterHor = true;
+ }
+ else
+ {
+ bool bFitLeft = ( aObjAbs.Left() - aDesktop.Left() >= rDialogSize.Width() + aSpace.Width() );
+ bool bFitRight = ( aDesktop.Right() - aObjAbs.Right() >= rDialogSize.Width() + aSpace.Width() );
+
+ if ( bFitLeft || bFitRight )
+ {
+ // if both fit, prefer right in RTL mode, left otherwise
+ bool bPutRight = bFitRight && ( bLayoutRTL || !bFitLeft );
+ if ( bPutRight )
+ aRet.X() = aObjAbs.Right() + aSpace.Width();
+ else
+ aRet.X() = aObjAbs.Left() - rDialogSize.Width() - aSpace.Width();
+
+ // center vertically
+ aRet.Y() = aObjAbs.Top() + ( aObjAbs.GetHeight() - rDialogSize.Height() ) / 2;
+ }
+ else
+ {
+ // doesn't fit on any edge - put at the bottom of the screen
+ aRet.Y() = aDesktop.Bottom() - rDialogSize.Height();
+ bCenterHor = true;
+ }
+ }
+ if ( bCenterHor )
+ aRet.X() = aObjAbs.Left() + ( aObjAbs.GetWidth() - rDialogSize.Width() ) / 2;
+
+ // limit to screen (centering might lead to invalid positions)
+ if ( aRet.X() + rDialogSize.Width() - 1 > aDesktop.Right() )
+ aRet.X() = aDesktop.Right() - rDialogSize.Width() + 1;
+ if ( aRet.X() < aDesktop.Left() )
+ aRet.X() = aDesktop.Left();
+ if ( aRet.Y() + rDialogSize.Height() - 1 > aDesktop.Bottom() )
+ aRet.Y() = aDesktop.Bottom() - rDialogSize.Height() + 1;
+ if ( aRet.Y() < aDesktop.Top() )
+ aRet.Y() = aDesktop.Top();
+ }
+
+ return aRet;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+
+void SwInsertChart(Window* pParent, SfxBindings* pBindings )
+{
+ (void) pParent;
+ (void) pBindings;
+ SwView *pView = ::GetActiveView();
+
+ // get range string of marked data
+ SwWrtShell &rWrtShell = pView->GetWrtShell();
+ uno::Reference< chart2::data::XDataProvider > xDataProvider;
+ uno::Reference< frame::XModel > xChartModel;
+ OUString aRangeString;
+
+ if( rWrtShell.IsCrsrInTbl())
+ {
+ if (!rWrtShell.IsTableMode())
+ {
+ // select whole table
+ rWrtShell.GetView().GetViewFrame()->GetDispatcher()->
+ Execute(FN_TABLE_SELECT_ALL, SFX_CALLMODE_SYNCHRON);
+ }
+ if( ! rWrtShell.IsTblComplexForChart())
+ {
+ SwFrmFmt* pTblFmt = rWrtShell.GetTableFmt();
+ String aCurrentTblName = pTblFmt->GetName();
+// String aText( String::CreateFromAscii("<.>") ); // was used for UI
+// aText.Insert( rWrtShell.GetBoxNms(), 2);
+// aText.Insert( aCurrentTblName, 1 );
+ aRangeString = aCurrentTblName;
+ aRangeString += OUString::valueOf( sal_Unicode('.') );
+ aRangeString += rWrtShell.GetBoxNms();
+
+ // get table data provider
+ xDataProvider.set( pView->GetDocShell()->getIDocumentChartDataProviderAccess()->GetChartDataProvider( true ) );
+ }
+ }
+
+ SwFlyFrmFmt *pFlyFrmFmt = 0;
+ xChartModel.set( SwTableFUNC( &rWrtShell, FALSE ).InsertChart( xDataProvider, (sal_True == xDataProvider.is()), aRangeString, &pFlyFrmFmt ));
+
+ //open wizard
+ //@todo get context from writer if that has one
+ uno::Reference< uno::XComponentContext > xContext(
+ ::cppu::defaultBootstrap_InitialComponentContext() );
+ if( xContext.is() && xChartModel.is() && xDataProvider.is())
+ {
+ uno::Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
+ if(xMCF.is())
+ {
+ uno::Reference< ui::dialogs::XExecutableDialog > xDialog(
+ xMCF->createInstanceWithContext(
+ C2U("com.sun.star.comp.chart2.WizardDialog")
+ , xContext), uno::UNO_QUERY);
+ uno::Reference< lang::XInitialization > xInit( xDialog, uno::UNO_QUERY );
+ if( xInit.is() )
+ {
+ uno::Reference< awt::XWindow > xDialogParentWindow(0);
+ // initialize dialog
+ uno::Sequence<uno::Any> aSeq(2);
+ uno::Any* pArray = aSeq.getArray();
+ beans::PropertyValue aParam1;
+ aParam1.Name = C2U("ParentWindow");
+ aParam1.Value <<= uno::makeAny(xDialogParentWindow);
+ beans::PropertyValue aParam2;
+ aParam2.Name = C2U("ChartModel");
+ aParam2.Value <<= uno::makeAny(xChartModel);
+ pArray[0] <<= uno::makeAny(aParam1);
+ pArray[1] <<= uno::makeAny(aParam2);
+ xInit->initialize( aSeq );
+
+ // try to set the dialog's position so it doesn't hide the chart
+ uno::Reference < beans::XPropertySet > xDialogProps( xDialog, uno::UNO_QUERY );
+ if ( xDialogProps.is() )
+ {
+ try
+ {
+ //get dialog size:
+ awt::Size aDialogAWTSize;
+ if( xDialogProps->getPropertyValue( ::rtl::OUString::createFromAscii("Size") )
+ >>= aDialogAWTSize )
+ {
+ Size aDialogSize( aDialogAWTSize.Width, aDialogAWTSize.Height );
+ if ( aDialogSize.Width() > 0 && aDialogSize.Height() > 0 )
+ {
+ //calculate and set new position
+ SwRect aSwRect;
+ if (pFlyFrmFmt)
+ aSwRect = pFlyFrmFmt->GetAnchoredObj()->GetObjRectWithSpaces();
+ Rectangle aRect( aSwRect.SVRect() );
+ Point aDialogPos = SwGetChartDialogPos( &rWrtShell.GetView().GetEditWin(), aDialogSize, aRect );
+ xDialogProps->setPropertyValue( ::rtl::OUString::createFromAscii("Position"),
+ uno::makeAny( awt::Point(aDialogPos.getX(),aDialogPos.getY()) ) );
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ DBG_ERROR( "Chart wizard couldn't be positioned automatically\n" );
+ }
+ }
+
+ sal_Int16 nDialogRet = xDialog->execute();
+ if( nDialogRet == ui::dialogs::ExecutableDialogResults::CANCEL )
+ {
+ rWrtShell.Undo();
+ rWrtShell.GetIDocumentUndoRedo().ClearRedo();
+ }
+ else
+ {
+ DBG_ASSERT( nDialogRet == ui::dialogs::ExecutableDialogResults::OK,
+ "dialog execution failed" );
+ }
+ }
+ uno::Reference< lang::XComponent > xComponent( xDialog, uno::UNO_QUERY );
+ if( xComponent.is())
+ xComponent->dispose();
+ }
+ }
+}
+
+
+void __EXPORT AutoEdit::KeyInput( const KeyEvent& rEvt )
+{
+ USHORT nCode = rEvt.GetKeyCode().GetCode();
+ if( nCode != KEY_SPACE )
+ Edit::KeyInput( rEvt );
+}
+
+
+
+
diff --git a/sw/source/ui/table/chartins.hrc b/sw/source/ui/table/chartins.hrc
new file mode 100644
index 000000000000..91bbb0f424c6
--- /dev/null
+++ b/sw/source/ui/table/chartins.hrc
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _CHARTINS_HRC
+#define _CHARTINS_HRC
+
+#include "rcid.hrc"
+#include "table.hrc"
+
+#define ED_RANGE 1
+#define FT_RANGE 2
+#define BT_NEXT 3
+#define BT_FINISH 4
+#define BT_HELP 5
+#define BT_CANCEL 6
+#define CB_FIRST_ROW 7
+#define CB_FIRST_COL 8
+#define BT_PREV 9
+#define FL_HLINE 10
+#define FT_TEXT 11
+#define FL_1 12
+
+#endif
diff --git a/sw/source/ui/table/chartins.src b/sw/source/ui/table/chartins.src
new file mode 100644
index 000000000000..b4cd8fdbeff0
--- /dev/null
+++ b/sw/source/ui/table/chartins.src
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+/* StarView ressource file */
+#include "chartins.hrc"
+#include "helpid.h"
+ModelessDialog DLG_INSERT_CHART
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 297 , 169 ) ;
+ Moveable = TRUE ;
+ HelpID = HID_INSERT_CHART ;
+ Hide = TRUE ;
+ Text [ en-US ] = "AutoFormat Chart (1-4)" ;
+ FixedLine FL_1
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 285 , 8 ) ;
+ Text [ en-US ] = "Selection" ;
+ };
+ FixedText FT_RANGE
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
+ Text [ en-US ] = "A~rea" ;
+ };
+ Edit ED_RANGE
+ {
+ HelpID = "sw:Edit:DLG_INSERT_CHART:ED_RANGE";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 56 , 14 ) ;
+ Size = MAP_APPFONT ( 229 , 12 ) ;
+ };
+ CheckBox CB_FIRST_ROW
+ {
+ HelpID = "sw:CheckBox:DLG_INSERT_CHART:CB_FIRST_ROW";
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~First row as caption" ;
+ Check = TRUE ;
+ };
+ CheckBox CB_FIRST_COL
+ {
+ HelpID = "sw:CheckBox:DLG_INSERT_CHART:CB_FIRST_COL";
+ Pos = MAP_APPFONT ( 12 , 46 ) ;
+ Size = MAP_APPFONT ( 150 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "First ~column as caption" ;
+ Check = TRUE ;
+ };
+ FixedText FT_TEXT
+ {
+ Pos = MAP_APPFONT ( 6 , 72 ) ;
+ Size = MAP_APPFONT ( 285 , 62 ) ;
+ Text [ en-US ] = "If the selected cells do not contain the desired data, select the data range now.\n\nInclude the cells containing column and row labels if you want them to be included in your chart." ;
+ WordBreak = TRUE ;
+ };
+ FixedLine FL_HLINE
+ {
+ Pos = MAP_APPFONT ( 0 , 140 ) ;
+ Size = MAP_APPFONT ( 297 , 8 ) ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 6 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 60 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton BT_PREV
+ {
+ HelpID = "sw:PushButton:DLG_INSERT_CHART:BT_PREV";
+ Pos = MAP_APPFONT ( 130 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ // ### ACHTUNG: Neuer Text in Resource? << ~Zurück : << Zurück
+ /* ### ACHTUNG: Neuer Text in Resource? << ~Zurück : << ~Zur³ck */
+ TabStop = TRUE ;
+ Disable = TRUE ;
+ Text [ en-US ] = "<< ~Back" ;
+ };
+ PushButton BT_NEXT
+ {
+ HelpID = "sw:PushButton:DLG_INSERT_CHART:BT_NEXT";
+ Pos = MAP_APPFONT ( 185 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Disable = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Next >>" ;
+ };
+ PushButton BT_FINISH
+ {
+ HelpID = "sw:PushButton:DLG_INSERT_CHART:BT_FINISH";
+ Pos = MAP_APPFONT ( 240 , 151 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Cre~ate" ;
+ };
+};
+
+
diff --git a/sw/source/ui/table/colwd.cxx b/sw/source/ui/table/colwd.cxx
new file mode 100644
index 000000000000..dc28f6331566
--- /dev/null
+++ b/sw/source/ui/table/colwd.cxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <sfx2/dispatch.hxx>
+#include <svx/dlgutil.hxx>
+#include <colwd.hxx>
+#include <tablemgr.hxx>
+#include <wrtsh.hxx>
+#ifndef _WDOCSH_HXX
+#include <wdocsh.hxx>
+#endif
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <swmodule.hxx>
+#ifndef _MODCFG_HXX
+#include <modcfg.hxx>
+#endif
+#include <usrpref.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _COLWD_HRC
+#include <colwd.hrc>
+#endif
+#ifndef _TABLE_HRC
+#include <table.hrc>
+#endif
+
+
+IMPL_LINK_INLINE_START( SwTableWidthDlg, LoseFocusHdl, Edit *, EMPTYARG )
+{
+ USHORT nId = (USHORT)aColEdit.GetValue()-1;
+ const SwTwips lWidth = rFnc.GetColWidth(nId);
+ aWidthEdit.SetValue(aWidthEdit.Normalize(lWidth), FUNIT_TWIP);
+ aWidthEdit.SetMax(aWidthEdit.Normalize(rFnc.GetMaxColWidth(nId)), FUNIT_TWIP);
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwTableWidthDlg, LoseFocusHdl, Edit *, EMPTYARG )
+
+
+
+SwTableWidthDlg::SwTableWidthDlg(Window *pParent, SwTableFUNC &rTableFnc ) :
+
+ SvxStandardDialog( pParent, SW_RES(DLG_COL_WIDTH) ),
+
+ aColFT(this, SW_RES(FT_COL)),
+ aColEdit(this, SW_RES(ED_COL)),
+ aWidthFT(this, SW_RES(FT_WIDTH)),
+ aWidthEdit(this, SW_RES(ED_WIDTH)),
+ aWidthFL(this, SW_RES(FL_WIDTH)),
+ aOKBtn(this, SW_RES(BT_OK)),
+ aCancelBtn(this, SW_RES(BT_CANCEL)),
+ aHelpBtn(this, SW_RES(BT_HELP)),
+ rFnc(rTableFnc)
+{
+ FreeResource();
+
+ BOOL bIsWeb = rTableFnc.GetShell()
+ ? static_cast< BOOL >(0 != PTR_CAST( SwWebDocShell,
+ rTableFnc.GetShell()->GetView().GetDocShell()) )
+ : FALSE;
+ FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( bIsWeb )->GetMetric();
+ ::SetFieldUnit(aWidthEdit, eFieldUnit );
+
+ aColEdit.SetValue( rFnc.GetCurColNum() +1 );
+ aWidthEdit.SetMin(aWidthEdit.Normalize(MINLAY), FUNIT_TWIP);
+ if(!aWidthEdit.GetMin())
+ aWidthEdit.SetMin(1);
+
+ if(rFnc.GetColCount() == 0)
+ aWidthEdit.SetMin(aWidthEdit.Normalize(rFnc.GetColWidth(0)), FUNIT_TWIP);
+ aColEdit.SetMax(rFnc.GetColCount() +1 );
+ aColEdit.SetModifyHdl(LINK(this,SwTableWidthDlg, LoseFocusHdl));
+ LoseFocusHdl();
+}
+
+
+
+void SwTableWidthDlg::Apply()
+{
+ rFnc.InitTabCols();
+ rFnc.SetColWidth(
+ static_cast< USHORT >(aColEdit.GetValue() - 1),
+ static_cast< USHORT >(aWidthEdit.Denormalize(aWidthEdit.GetValue(FUNIT_TWIP))));
+}
+
+
+
+
diff --git a/sw/source/ui/table/colwd.hrc b/sw/source/ui/table/colwd.hrc
new file mode 100644
index 000000000000..4ac7358a65a9
--- /dev/null
+++ b/sw/source/ui/table/colwd.hrc
@@ -0,0 +1,36 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define FT_COL 1
+#define ED_COL 2
+#define FT_WIDTH 3
+#define ED_WIDTH 4
+#define FL_WIDTH 5
+
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_HELP 102
+
diff --git a/sw/source/ui/table/colwd.src b/sw/source/ui/table/colwd.src
new file mode 100644
index 000000000000..fb1505c1cabe
--- /dev/null
+++ b/sw/source/ui/table/colwd.src
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+#include "colwd.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ // #define DLG_COL_WIDTH 256
+ModalDialog DLG_COL_WIDTH
+{
+ HelpID = CMD_FN_TABLE_SET_COL_WIDTH ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 159 , 60 ) ;
+ Text [ en-US ] = "Column Width" ;
+ Moveable = TRUE ;
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 104 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 104 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 104 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 31 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "~Width" ;
+ Left = TRUE ;
+ };
+ MetricField ED_WIDTH
+ {
+ HelpID = "sw:MetricField:DLG_COL_WIDTH:ED_WIDTH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 51 , 30 ) ;
+ Size = MAP_APPFONT ( 38 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 50 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ SpinSize = 10 ;
+ Value = 10 ;
+ Unit = FUNIT_CM ;
+ First = 100 ;
+ Last = 9999 ;
+ };
+ FixedLine FL_WIDTH
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 91 , 8 ) ;
+ Text [ en-US ] = "Width" ;
+ };
+ FixedText FT_COL
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 35 , 8 ) ;
+ Text [ en-US ] = "~Column" ;
+ Left = TRUE ;
+ };
+ NumericField ED_COL
+ {
+ HelpID = "sw:NumericField:DLG_COL_WIDTH:ED_COL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 51 , 14 ) ;
+ Size = MAP_APPFONT ( 38 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Repeat = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx
new file mode 100644
index 000000000000..8be2bbdbb498
--- /dev/null
+++ b/sw/source/ui/table/convert.cxx
@@ -0,0 +1,279 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <vcl/msgbox.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <modcfg.hxx>
+#include <svx/htmlmode.hxx>
+#include <viewopt.hxx>
+#include "swmodule.hxx"
+#include "cmdid.h"
+#include "convert.hxx"
+#include "tablemgr.hxx"
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "tblafmt.hxx"
+
+#include "table.hrc"
+#include "convert.hrc"
+#include "swabstdlg.hxx"
+
+namespace swui
+{
+ SwAbstractDialogFactory * GetFactory();
+}
+
+//keep the state of the buttons on runtime
+static int nSaveButtonState = -1; // 0: tab, 1: semicolon, 2: paragraph, 3: other, -1: not yet used
+static sal_Bool bIsKeepColumn = sal_True;
+static sal_Unicode uOther = ',';
+
+void SwConvertTableDlg::GetValues( sal_Unicode& rDelim,
+ SwInsertTableOptions& rInsTblOpts,
+ SwTableAutoFmt *& prTAFmt )
+{
+ if( aTabBtn.IsChecked() )
+ {
+ //0x0b mustn't be set when re-converting table into text
+ bIsKeepColumn = !aKeepColumn.IsVisible() || aKeepColumn.IsChecked();
+ rDelim = bIsKeepColumn ? 0x09 : 0x0b;
+ nSaveButtonState = 0;
+ }
+ else if( aSemiBtn.IsChecked() )
+ {
+ rDelim = ';';
+ nSaveButtonState = 1;
+ }
+ else if( aOtherBtn.IsChecked() && aOtherEd.GetText().Len() )
+ {
+ uOther = aOtherEd.GetText().GetChar( 0 );
+ rDelim = uOther;
+ nSaveButtonState = 3;
+ }
+ else
+ {
+ nSaveButtonState = 2;
+ rDelim = cParaDelim;
+ if(aOtherBtn.IsChecked())
+ {
+ nSaveButtonState = 3;
+ uOther = 0;
+ }
+ }
+
+
+ USHORT nInsMode = 0;
+ if (aBorderCB.IsChecked())
+ nInsMode |= tabopts::DEFAULT_BORDER;
+ if (aHeaderCB.IsChecked())
+ nInsMode |= tabopts::HEADLINE;
+ if (aRepeatHeaderCB.IsEnabled() && aRepeatHeaderCB.IsChecked())
+ rInsTblOpts.mnRowsToRepeat = USHORT( aRepeatHeaderNF.GetValue() );
+ else
+ rInsTblOpts.mnRowsToRepeat = 0;
+ if (!aDontSplitCB.IsChecked())
+ nInsMode |= tabopts::SPLIT_LAYOUT;
+
+ if( pTAutoFmt )
+ prTAFmt = new SwTableAutoFmt( *pTAutoFmt );
+
+ rInsTblOpts.mnInsMode = nInsMode;
+}
+
+
+SwConvertTableDlg::SwConvertTableDlg( SwView& rView, bool bToTable )
+
+ : SfxModalDialog( &rView.GetViewFrame()->GetWindow(), SW_RES(DLG_CONV_TEXT_TABLE)),
+#ifdef MSC
+#pragma warning (disable : 4355)
+#endif
+ aTabBtn (this, SW_RES(CB_TAB)),
+ aSemiBtn (this, SW_RES(CB_SEMI)),
+ aParaBtn (this, SW_RES(CB_PARA)),
+ aOtherBtn (this, SW_RES(RB_OTHER)),
+ aOtherEd (this, SW_RES(ED_OTHER)),
+ aKeepColumn (this, SW_RES(CB_KEEPCOLUMN)),
+ aDelimFL (this, SW_RES(FL_DELIM)),
+
+ aHeaderCB (this, SW_RES(CB_HEADER)),
+ aRepeatHeaderCB (this, SW_RES(CB_REPEAT_HEADER)),
+
+ aRepeatHeaderFT (this, SW_RES(FT_REPEAT_HEADER)),
+ aRepeatHeaderBeforeFT (this),
+ aRepeatHeaderNF (this, SW_RES(NF_REPEAT_HEADER)),
+ aRepeatHeaderAfterFT (this),
+ aRepeatHeaderCombo (this, SW_RES(WIN_REPEAT_HEADER), aRepeatHeaderNF, aRepeatHeaderBeforeFT, aRepeatHeaderAfterFT),
+
+ aOptionsFL (this, SW_RES(FL_OPTIONS)),
+ aDontSplitCB (this, SW_RES(CB_DONT_SPLIT)),
+ aBorderCB (this, SW_RES(CB_BORDER)),
+ aAutoFmtBtn(this,SW_RES(BT_AUTOFORMAT)),
+
+ aOkBtn(this,SW_RES(BT_OK)),
+ aCancelBtn(this,SW_RES(BT_CANCEL)),
+ aHelpBtn(this, SW_RES(BT_HELP)),
+#ifdef MSC
+#pragma warning (default : 4355)
+#endif
+ sConvertTextTable(SW_RES(STR_CONVERT_TEXT_TABLE)),
+ pTAutoFmt( 0 ),
+ pShell( &rView.GetWrtShell() )
+{
+ FreeResource();
+ if(nSaveButtonState > -1)
+ {
+ switch (nSaveButtonState)
+ {
+ case 0:
+ aTabBtn.Check();
+ aKeepColumn.Check(bIsKeepColumn);
+ break;
+ case 1: aSemiBtn.Check();break;
+ case 2: aParaBtn.Check();break;
+ case 3:
+ aOtherBtn.Check();
+ if(uOther)
+ aOtherEd.SetText(uOther);
+ break;
+ }
+
+ }
+ if( bToTable )
+ {
+ SetText( sConvertTextTable );
+ aAutoFmtBtn.SetClickHdl(LINK(this, SwConvertTableDlg, AutoFmtHdl));
+ aAutoFmtBtn.Show();
+ aKeepColumn.Show();
+ aKeepColumn.Enable( aTabBtn.IsChecked() );
+ aRepeatHeaderCombo.Arrange( aRepeatHeaderFT );
+ }
+ else
+ {
+ //Einfuege-Optionen verstecken
+ aHeaderCB .Show(FALSE);
+ aRepeatHeaderCB .Show(FALSE);
+ aDontSplitCB .Show(FALSE);
+ aBorderCB .Show(FALSE);
+ aOptionsFL .Show(FALSE);
+ aRepeatHeaderCombo.Show(FALSE);
+
+ //Groesse anpassen
+ Size aSize(GetSizePixel());
+ aSize.Height() = 8 + aHelpBtn.GetSizePixel().Height() + aHelpBtn.GetPosPixel().Y();
+ SetOutputSizePixel(aSize);
+ }
+ aKeepColumn.SaveValue();
+
+ Link aLk( LINK(this, SwConvertTableDlg, BtnHdl) );
+ aTabBtn.SetClickHdl( aLk );
+ aSemiBtn.SetClickHdl( aLk );
+ aParaBtn.SetClickHdl( aLk );
+ aOtherBtn.SetClickHdl(aLk );
+ aOtherEd.Enable( aOtherBtn.IsChecked() );
+
+ const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+
+ BOOL bHTMLMode = 0 != (::GetHtmlMode(rView.GetDocShell())&HTMLMODE_ON);
+
+ SwInsertTableOptions aInsOpts = pModOpt->GetInsTblFlags(bHTMLMode);
+ USHORT nInsTblFlags = aInsOpts.mnInsMode;
+
+ aHeaderCB.Check( 0 != (nInsTblFlags & tabopts::HEADLINE) );
+ aRepeatHeaderCB.Check(aInsOpts.mnRowsToRepeat > 0);
+ aDontSplitCB.Check( 0 == (nInsTblFlags & tabopts::SPLIT_LAYOUT));
+ aBorderCB.Check( 0!= (nInsTblFlags & tabopts::DEFAULT_BORDER) );
+
+ aHeaderCB.SetClickHdl(LINK(this, SwConvertTableDlg, CheckBoxHdl));
+ aRepeatHeaderCB.SetClickHdl(LINK(this, SwConvertTableDlg, ReapeatHeaderCheckBoxHdl));
+ ReapeatHeaderCheckBoxHdl();
+ CheckBoxHdl();
+}
+
+SwConvertTableDlg:: ~SwConvertTableDlg()
+{
+ delete pTAutoFmt;
+}
+
+IMPL_LINK( SwConvertTableDlg, AutoFmtHdl, PushButton*, pButton )
+{
+ SwAbstractDialogFactory* pFact = swui::GetFactory();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton, pShell, DLG_AUTOFMT_TABLE, FALSE, pTAutoFmt);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if( RET_OK == pDlg->Execute())
+ pDlg->FillAutoFmtOfIndex( pTAutoFmt );
+ delete pDlg;
+ return 0;
+}
+
+IMPL_LINK( SwConvertTableDlg, BtnHdl, Button*, pButton )
+{
+ if( pButton == &aTabBtn )
+ aKeepColumn.SetState( aKeepColumn.GetSavedValue() );
+ else
+ {
+ if( aKeepColumn.IsEnabled() )
+ aKeepColumn.SaveValue();
+ aKeepColumn.Check( TRUE );
+ }
+ aKeepColumn.Enable( aTabBtn.IsChecked() );
+ aOtherEd.Enable( aOtherBtn.IsChecked() );
+ return 0;
+}
+
+/*********************************************************************/
+/* */
+/*********************************************************************/
+
+IMPL_LINK(SwConvertTableDlg, CheckBoxHdl, CheckBox*, EMPTYARG)
+{
+ aRepeatHeaderCB.Enable(aHeaderCB.IsChecked());
+ ReapeatHeaderCheckBoxHdl();
+
+ return 0;
+}
+
+IMPL_LINK(SwConvertTableDlg, ReapeatHeaderCheckBoxHdl, void*, EMPTYARG)
+{
+ sal_Bool bEnable = aHeaderCB.IsChecked() && aRepeatHeaderCB.IsChecked();
+ aRepeatHeaderBeforeFT.Enable(bEnable);
+ aRepeatHeaderAfterFT.Enable(bEnable);
+ aRepeatHeaderNF.Enable(bEnable);
+
+ return 0;
+}
diff --git a/sw/source/ui/table/convert.hrc b/sw/source/ui/table/convert.hrc
new file mode 100644
index 000000000000..7f7cbbec768f
--- /dev/null
+++ b/sw/source/ui/table/convert.hrc
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define CB_TAB 1
+#define CB_SEMI 3
+#define CB_PARA 4
+#define FL_DELIM 5
+#define RB_OTHER 6
+#define ED_OTHER 7
+#define CB_KEEPCOLUMN 8
+#define STR_CONVERT_TEXT_TABLE 9
+#define CB_HEADER 13
+#define CB_REPEAT_HEADER 14
+#define CB_DONT_SPLIT 15
+#define CB_BORDER 16
+#define FL_OPTIONS 17
+#define FT_REPEAT_HEADER 18
+#define NF_REPEAT_HEADER 19
+
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_AUTOFORMAT 102
+#define BT_HELP 103
+#define WIN_REPEAT_HEADER 104
diff --git a/sw/source/ui/table/convert.src b/sw/source/ui/table/convert.src
new file mode 100644
index 000000000000..c15b4ad4456c
--- /dev/null
+++ b/sw/source/ui/table/convert.src
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+#include "convert.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ModalDialog DLG_CONV_TEXT_TABLE
+{
+ HelpID = CMD_FN_CONVERT_TEXT_TABLE ;
+ OUTPUTSIZE = TRUE ;
+ Size = MAP_APPFONT ( 203 , 169 ) ;
+ Text [ en-US ] = "Convert Table to Text" ;
+ MOVEABLE = TRUE ;
+ SVLOOK = TRUE ;
+ RadioButton CB_TAB
+ {
+ HelpID = "sw:RadioButton:DLG_CONV_TEXT_TABLE:CB_TAB";
+ Pos = MAP_APPFONT ( 12 , 17 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Tabs" ;
+ TABSTOP = TRUE ;
+ Group = TRUE ;
+ Check = TRUE ;
+ };
+ RadioButton CB_SEMI
+ {
+ HelpID = "sw:RadioButton:DLG_CONV_TEXT_TABLE:CB_SEMI";
+ Pos = MAP_APPFONT ( 75 , 17 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Semicolons" ;
+ TABSTOP = TRUE ;
+ };
+ RadioButton CB_PARA
+ {
+ HelpID = "sw:RadioButton:DLG_CONV_TEXT_TABLE:CB_PARA";
+ Pos = MAP_APPFONT ( 12 , 33 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Paragraph" ;
+ TABSTOP = TRUE ;
+ };
+ RadioButton RB_OTHER
+ {
+ HelpID = "sw:RadioButton:DLG_CONV_TEXT_TABLE:RB_OTHER";
+ Pos = MAP_APPFONT ( 75 , 33 ) ;
+ Size = MAP_APPFONT ( 45 , 10 ) ;
+ Text [ en-US ] = "~Other: " ;
+ };
+ Edit ED_OTHER
+ {
+ HelpID = "sw:Edit:DLG_CONV_TEXT_TABLE:ED_OTHER";
+ Border = TRUE ;
+ Left = TRUE ;
+ Pos = MAP_APPFONT ( 123 , 32 ) ;
+ Size = MAP_APPFONT ( 9 , 12 ) ;
+ Text = "," ;
+ MaxTextLength = 1 ;
+ };
+ CheckBox CB_KEEPCOLUMN
+ {
+ HelpID = "sw:CheckBox:DLG_CONV_TEXT_TABLE:CB_KEEPCOLUMN";
+ Pos = MAP_APPFONT ( 12 , 49 ) ;
+ Size = MAP_APPFONT ( 128 , 10 ) ;
+ Check = TRUE;
+ Hide = TRUE ;
+ Text [ en-US ] = "Equal width for all columns" ;
+ };
+ FixedLine FL_DELIM
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 135 , 8 ) ;
+ Text [ en-US ] = "Separate text at" ;
+ Group = TRUE ;
+ };
+ CheckBox CB_HEADER
+ {
+ HelpID = "sw:CheckBox:DLG_CONV_TEXT_TABLE:CB_HEADER";
+ Pos = MAP_APPFONT ( 12 , 84 ) ;
+ Size = MAP_APPFONT ( 123 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Heading";
+ };
+ CheckBox CB_REPEAT_HEADER
+ {
+ HelpID = "sw:CheckBox:DLG_CONV_TEXT_TABLE:CB_REPEAT_HEADER";
+ Pos = MAP_APPFONT ( 22 , 97 ) ;
+ Size = MAP_APPFONT ( 113 , 10 ) ;
+ Text [ en-US ] = "Repeat heading";
+ TabStop = TRUE ;
+ };
+ FixedText FT_REPEAT_HEADER
+ {
+ Pos = MAP_APPFONT ( 125 , 113 ) ;
+ Size = MAP_APPFONT ( 66 , 10 ) ;
+ Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ;
+ };
+ NumericField NF_REPEAT_HEADER
+ {
+ HelpID = "sw:NumericField:DLG_CONV_TEXT_TABLE:NF_REPEAT_HEADER";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 191 , 112 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 1000 ;
+ First = 1 ;
+ };
+ Window WIN_REPEAT_HEADER
+ {
+ Pos = MAP_APPFONT ( 30 , 110 ) ;
+ Size = MAP_APPFONT ( 2 , 1 ) ;
+ };
+ CheckBox CB_DONT_SPLIT
+ {
+ HelpID = "sw:CheckBox:DLG_CONV_TEXT_TABLE:CB_DONT_SPLIT";
+ Pos = MAP_APPFONT ( 12 , 126 ) ;
+ Size = MAP_APPFONT ( 123 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Don't split table";
+ };
+ CheckBox CB_BORDER
+ {
+ HelpID = "sw:CheckBox:DLG_CONV_TEXT_TABLE:CB_BORDER";
+ Pos = MAP_APPFONT ( 12 , 139 ) ;
+ Size = MAP_APPFONT ( 123 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Border";
+ };
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 71 ) ;
+ Size = MAP_APPFONT ( 135 , 8 ) ;
+ Text [ en-US ] = "Options";
+ };
+ String STR_CONVERT_TEXT_TABLE
+ {
+ Text [ en-US ] = "Convert Text to Table" ;
+ };
+ OkButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 147 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TABSTOP = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 147 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TABSTOP = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 147 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TABSTOP = TRUE ;
+ };
+ PushButton BT_AUTOFORMAT
+ {
+ HelpID = "sw:PushButton:DLG_CONV_TEXT_TABLE:BT_AUTOFORMAT";
+ Pos = MAP_APPFONT ( 12 , 152 ) ;
+ Size = MAP_APPFONT ( 86 , 14 ) ;
+ TabStop = TRUE ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Auto~Format..." ;
+ };
+};
+
+
+
diff --git a/sw/source/ui/table/instable.cxx b/sw/source/ui/table/instable.cxx
new file mode 100644
index 000000000000..40c9f5a220f7
--- /dev/null
+++ b/sw/source/ui/table/instable.cxx
@@ -0,0 +1,253 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <vcl/msgbox.hxx>
+
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "itabenum.hxx"
+#include "instable.hxx"
+#include "tblafmt.hxx"
+#include "modcfg.hxx"
+#include "swmodule.hxx"
+#include <svx/htmlmode.hxx>
+#include <viewopt.hxx>
+
+#include "table.hrc"
+#include "instable.hrc"
+
+#include "swabstdlg.hxx"
+
+namespace swui
+{
+ SwAbstractDialogFactory * GetFactory();
+}
+
+#define ROW_COL_PROD 16384
+
+void SwInsTableDlg::GetValues( String& rName, USHORT& rRow, USHORT& rCol,
+ SwInsertTableOptions& rInsTblOpts, String& rAutoName,
+ SwTableAutoFmt *& prTAFmt )
+{
+ USHORT nInsMode = 0;
+ rName = aNameEdit.GetText();
+ rRow = (USHORT)aRowEdit.GetValue();
+ rCol = (USHORT)aColEdit.GetValue();
+
+ if (aBorderCB.IsChecked())
+ nInsMode |= tabopts::DEFAULT_BORDER;
+ if (aHeaderCB.IsChecked())
+ nInsMode |= tabopts::HEADLINE;
+ if (aRepeatHeaderCB.IsEnabled() && aRepeatHeaderCB.IsChecked())
+ rInsTblOpts.mnRowsToRepeat = USHORT( aRepeatHeaderNF.GetValue() );
+ else
+ rInsTblOpts.mnRowsToRepeat = 0;
+ if (!aDontSplitCB.IsChecked())
+ nInsMode |= tabopts::SPLIT_LAYOUT;
+ if( pTAutoFmt )
+ {
+ prTAFmt = new SwTableAutoFmt( *pTAutoFmt );
+ rAutoName = prTAFmt->GetName();
+ }
+
+ rInsTblOpts.mnInsMode = nInsMode;
+}
+
+// CTOR / DTOR -----------------------------------------------------------
+
+
+SwInsTableDlg::SwInsTableDlg( SwView& rView )
+ : SfxModalDialog( rView.GetWindow(), SW_RES(DLG_INSERT_TABLE) ),
+ aNameFT (this, SW_RES(FT_NAME)),
+ aNameEdit (this, SW_RES(ED_NAME)),
+
+ aFL (this, SW_RES(FL_TABLE)),
+ aColLbl (this, SW_RES(FT_COL)),
+ aColEdit (this, SW_RES(ED_COL)),
+ aRowLbl (this, SW_RES(FT_ROW)),
+ aRowEdit (this, SW_RES(ED_ROW)),
+
+ aOptionsFL (this, SW_RES(FL_OPTIONS)),
+ aHeaderCB (this, SW_RES(CB_HEADER)),
+ aRepeatHeaderCB (this, SW_RES(CB_REPEAT_HEADER)),
+ aRepeatHeaderFT (this, SW_RES(FT_REPEAT_HEADER)),
+ aRepeatHeaderBeforeFT (this),
+ aRepeatHeaderNF (this, SW_RES(NF_REPEAT_HEADER)),
+ aRepeatHeaderAfterFT (this),
+ aRepeatHeaderCombo (this, SW_RES(WIN_REPEAT_HEADER), aRepeatHeaderNF, aRepeatHeaderBeforeFT, aRepeatHeaderAfterFT),
+
+ aDontSplitCB (this, SW_RES(CB_DONT_SPLIT)),
+ aBorderCB (this, SW_RES(CB_BORDER)),
+
+ aOkBtn (this, SW_RES(BT_OK)),
+ aCancelBtn (this, SW_RES(BT_CANCEL)),
+ aHelpBtn (this, SW_RES(BT_HELP)),
+ aAutoFmtBtn (this, SW_RES(BT_AUTOFORMAT)),
+
+ pShell(&rView.GetWrtShell()),
+ pTAutoFmt( 0 ),
+ nEnteredValRepeatHeaderNF( -1 )
+{
+ FreeResource();
+ aNameEdit.SetText(pShell->GetUniqueTblName());
+ aNameEdit.SetModifyHdl(LINK(this, SwInsTableDlg, ModifyName));
+ aColEdit.SetModifyHdl(LINK(this, SwInsTableDlg, ModifyRowCol));
+ aRowEdit.SetModifyHdl(LINK(this, SwInsTableDlg, ModifyRowCol));
+
+ aRowEdit.SetMax(ROW_COL_PROD/aColEdit.GetValue());
+ aColEdit.SetMax(ROW_COL_PROD/aRowEdit.GetValue());
+ aAutoFmtBtn.SetClickHdl(LINK(this, SwInsTableDlg, AutoFmtHdl));
+
+ BOOL bHTMLMode = 0 != (::GetHtmlMode(rView.GetDocShell())&HTMLMODE_ON);
+ const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+
+ SwInsertTableOptions aInsOpts = pModOpt->GetInsTblFlags(bHTMLMode);
+ USHORT nInsTblFlags = aInsOpts.mnInsMode;
+
+ aHeaderCB.Check( 0 != (nInsTblFlags & tabopts::HEADLINE) );
+ aRepeatHeaderCB.Check(aInsOpts.mnRowsToRepeat > 0);
+ if(bHTMLMode)
+ {
+ aDontSplitCB.Hide();
+ aBorderCB.SetPosPixel(aDontSplitCB.GetPosPixel());
+ }
+ else
+ {
+ aDontSplitCB.Check( 0 == (nInsTblFlags & tabopts::SPLIT_LAYOUT) );
+ }
+ aBorderCB.Check( 0 != (nInsTblFlags & tabopts::DEFAULT_BORDER) );
+
+ aRepeatHeaderNF.SetModifyHdl( LINK( this, SwInsTableDlg, ModifyRepeatHeaderNF_Hdl ) );
+ aHeaderCB.SetClickHdl(LINK(this, SwInsTableDlg, CheckBoxHdl));
+ aRepeatHeaderCB.SetClickHdl(LINK(this, SwInsTableDlg, ReapeatHeaderCheckBoxHdl));
+ ReapeatHeaderCheckBoxHdl();
+ CheckBoxHdl();
+
+ sal_Int64 nMax = aRowEdit.GetValue();
+ if( nMax <= 1 )
+ nMax = 1;
+ else
+ --nMax;
+ aRepeatHeaderNF.SetMax( nMax );
+
+ aRepeatHeaderCombo.Arrange( aRepeatHeaderFT );
+}
+
+SwInsTableDlg::~SwInsTableDlg()
+{
+ delete pTAutoFmt;
+}
+
+IMPL_LINK_INLINE_START( SwInsTableDlg, ModifyName, Edit *, pEdit )
+{
+ String sTblName = pEdit->GetText();
+ if(sTblName.Search(' ') != STRING_NOTFOUND)
+ {
+ sTblName.EraseAllChars( );
+ pEdit->SetText(sTblName);
+ }
+
+ aOkBtn.Enable(pShell->GetTblStyle( sTblName ) == 0);
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwInsTableDlg, ModifyName, Edit *, EMPTYARG )
+
+/*-----------------15.04.98 11:36-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwInsTableDlg, ModifyRowCol, NumericField *, pField )
+{
+ if(pField == &aColEdit)
+ {
+ sal_Int64 nCol = aColEdit.GetValue();
+ if(!nCol)
+ nCol = 1;
+ aRowEdit.SetMax(ROW_COL_PROD/nCol);
+ }
+ else
+ {
+ sal_Int64 nRow = aRowEdit.GetValue();
+ if(!nRow)
+ nRow = 1;
+ aColEdit.SetMax(ROW_COL_PROD/nRow);
+
+ // adjust depending NF for repeated rows
+ sal_Int64 nMax = ( nRow == 1 )? 1 : nRow - 1 ;
+ sal_Int64 nActVal = aRepeatHeaderNF.GetValue();
+
+ aRepeatHeaderNF.SetMax( nMax );
+
+ if( nActVal > nMax )
+ aRepeatHeaderNF.SetValue( nMax );
+ else if( nActVal < nEnteredValRepeatHeaderNF )
+ aRepeatHeaderNF.SetValue( ( nEnteredValRepeatHeaderNF < nMax )? nEnteredValRepeatHeaderNF : nMax );
+ }
+ return 0;
+}
+
+IMPL_LINK( SwInsTableDlg, AutoFmtHdl, PushButton*, pButton )
+{
+ SwAbstractDialogFactory* pFact = swui::GetFactory();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(pButton,pShell, DLG_AUTOFMT_TABLE, FALSE, pTAutoFmt );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if( RET_OK == pDlg->Execute())
+ pDlg->FillAutoFmtOfIndex( pTAutoFmt );
+ delete pDlg;
+ return 0;
+}
+
+IMPL_LINK(SwInsTableDlg, CheckBoxHdl, CheckBox*, EMPTYARG)
+{
+ aRepeatHeaderCB.Enable(aHeaderCB.IsChecked());
+ ReapeatHeaderCheckBoxHdl();
+
+ return 0;
+}
+
+IMPL_LINK(SwInsTableDlg, ReapeatHeaderCheckBoxHdl, void*, EMPTYARG)
+{
+ aRepeatHeaderCombo.Enable(aHeaderCB.IsChecked() && aRepeatHeaderCB.IsChecked());
+
+ return 0;
+}
+
+IMPL_LINK(SwInsTableDlg, ModifyRepeatHeaderNF_Hdl, void*, EMPTYARG)
+{
+ nEnteredValRepeatHeaderNF = aRepeatHeaderNF.GetValue();
+ return 0;
+}
+
diff --git a/sw/source/ui/table/instable.hrc b/sw/source/ui/table/instable.hrc
new file mode 100644
index 000000000000..6077541a3c01
--- /dev/null
+++ b/sw/source/ui/table/instable.hrc
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define FT_COL 1
+#define FT_ROW 2
+#define ED_COL 4
+#define ED_ROW 5
+#define FL_TABLE 10
+#define ED_NAME 11
+#define FT_NAME 12
+#define CB_HEADER 13
+#define CB_REPEAT_HEADER 14
+#define CB_DONT_SPLIT 15
+#define CB_BORDER 16
+#define FL_OPTIONS 17
+#define FT_REPEAT_HEADER 18
+#define NF_REPEAT_HEADER 19
+
+#define BT_OK 20
+#define BT_CANCEL 21
+#define BT_HELP 22
+#define BT_AUTOFORMAT 23
+
+#define WIN_REPEAT_HEADER 25
+
diff --git a/sw/source/ui/table/instable.src b/sw/source/ui/table/instable.src
new file mode 100644
index 000000000000..d83ba3402e72
--- /dev/null
+++ b/sw/source/ui/table/instable.src
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+#include "instable.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ // #define DLG_INSERT_TABLE 256
+ModalDialog DLG_INSERT_TABLE
+{
+ HelpID = CMD_FN_INSERT_TABLE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 280 , 166 ) ;
+ Text [ en-US ] = "Insert Table" ;
+ Moveable = TRUE ;
+ Edit ED_NAME
+ {
+ HelpID = "sw:Edit:DLG_INSERT_TABLE:ED_NAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 53 , 6 ) ;
+ Size = MAP_APPFONT ( 158, 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 8 ) ;
+ Size = MAP_APPFONT ( 45, 8 ) ;
+ Text [ en-US ] = "Name";
+ };
+ FixedText FT_COL
+ {
+ Pos = MAP_APPFONT ( 12 , 34 ) ;
+ Size = MAP_APPFONT ( 39 , 8 ) ;
+ Text [ en-US ] = "~Columns" ;
+ Left = TRUE ;
+ };
+ NumericField ED_COL
+ {
+ HelpID = "sw:NumericField:DLG_INSERT_TABLE:ED_COL";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 53 , 32 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Value = 2 ;
+ First = 1 ;
+ Last = 99 ;
+ };
+ FixedText FT_ROW
+ {
+ Pos = MAP_APPFONT ( 12 , 50 ) ;
+ Size = MAP_APPFONT ( 39 , 8 ) ;
+ Text [ en-US ] = "~Rows" ;
+ Left = TRUE ;
+ };
+ NumericField ED_ROW
+ {
+ HelpID = "sw:NumericField:DLG_INSERT_TABLE:ED_ROW";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 53 , 48 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 99 ;
+ Value = 2 ;
+ First = 1 ;
+ Last = 99 ;
+ };
+ FixedLine FL_TABLE
+ {
+ Pos = MAP_APPFONT ( 6 , 21 ) ;
+ Size = MAP_APPFONT ( 212 , 8 ) ;
+ Text [ en-US ] = "Size";
+ };
+ CheckBox CB_HEADER
+ {
+ HelpID = "sw:CheckBox:DLG_INSERT_TABLE:CB_HEADER";
+ Pos = MAP_APPFONT ( 12 , 74 ) ;
+ Size = MAP_APPFONT (113 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Heading";
+ };
+ CheckBox CB_REPEAT_HEADER
+ {
+ HelpID = "sw:CheckBox:DLG_INSERT_TABLE:CB_REPEAT_HEADER";
+ Pos = MAP_APPFONT ( 21 , 88 ) ;
+ Size = MAP_APPFONT ( 104 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Repeat heading";
+ };
+ FixedText FT_REPEAT_HEADER
+ {
+ Pos = MAP_APPFONT ( 30 , 105 ) ;
+ Size = MAP_APPFONT ( 95 , 10 ) ;
+ Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ;
+ };
+ NumericField NF_REPEAT_HEADER
+ {
+ HelpID = "sw:NumericField:DLG_INSERT_TABLE:NF_REPEAT_HEADER";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 130 , 104 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 1000 ;
+ First = 1 ;
+ };
+ Window WIN_REPEAT_HEADER
+ {
+ Pos = MAP_APPFONT ( 30 , 102 ) ;
+ Size = MAP_APPFONT ( 2 , 1 ) ;
+ };
+ CheckBox CB_DONT_SPLIT
+ {
+ HelpID = "sw:CheckBox:DLG_INSERT_TABLE:CB_DONT_SPLIT";
+ Pos = MAP_APPFONT ( 12 , 118 ) ;
+ Size = MAP_APPFONT ( 113 , 10 ) ;
+ Text [ en-US ] = "Don't split table";
+ TabStop = TRUE ;
+ };
+ CheckBox CB_BORDER
+ {
+ HelpID = "sw:CheckBox:DLG_INSERT_TABLE:CB_BORDER";
+ Pos = MAP_APPFONT ( 12 , 132 ) ;
+ Size = MAP_APPFONT ( 113 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Border";
+ };
+ PushButton BT_AUTOFORMAT
+ {
+ HelpID = "sw:PushButton:DLG_INSERT_TABLE:BT_AUTOFORMAT";
+ Pos = MAP_APPFONT ( 12 , 146 ) ;
+ Size = MAP_APPFONT ( 86 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Auto~Format..." ;
+ };
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 63 ) ;
+ Size = MAP_APPFONT ( 212 , 8 ) ;
+ Text [ en-US ] = "Options";
+ };
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 224 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 224 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 224 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+
diff --git a/sw/source/ui/table/mergetbl.cxx b/sw/source/ui/table/mergetbl.cxx
new file mode 100644
index 000000000000..486bb0af87b7
--- /dev/null
+++ b/sw/source/ui/table/mergetbl.cxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <swtypes.hxx>
+#include <mergetbl.hxx>
+#ifndef _MERGETBL_HRC
+#include <mergetbl.hrc>
+#endif
+#ifndef _TABLE_HRC
+#include <table.hrc>
+#endif
+
+
+SwMergeTblDlg::SwMergeTblDlg( Window *pParent, BOOL& rWithPrev )
+ : SvxStandardDialog(pParent, SW_RES(DLG_MERGE_TABLE)),
+ aOKPB( this, SW_RES(PB_OK )),
+ aCancelPB( this, SW_RES(PB_CANCEL )),
+ aHelpPB( this, SW_RES(PB_HELP )),
+ aMergeFL( this, SW_RES(FL_MERGE )),
+ aMergePrevRB( this, SW_RES(RB_MERGE_PREV)),
+ aMergeNextRB( this, SW_RES(RB_MERGE_NEXT)),
+ rMergePrev( rWithPrev )
+{
+ FreeResource();
+ aMergePrevRB.Check();
+}
+
+void SwMergeTblDlg::Apply()
+{
+ rMergePrev = aMergePrevRB.IsChecked();
+}
+
+
+
diff --git a/sw/source/ui/table/mergetbl.hrc b/sw/source/ui/table/mergetbl.hrc
new file mode 100644
index 000000000000..cee06b6ef20d
--- /dev/null
+++ b/sw/source/ui/table/mergetbl.hrc
@@ -0,0 +1,32 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define PB_OK 1
+#define PB_CANCEL 2
+#define PB_HELP 3
+#define FL_MERGE 4
+#define RB_MERGE_PREV 5
+#define RB_MERGE_NEXT 6
diff --git a/sw/source/ui/table/mergetbl.src b/sw/source/ui/table/mergetbl.src
new file mode 100644
index 000000000000..f88ec62923f4
--- /dev/null
+++ b/sw/source/ui/table/mergetbl.src
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+#include "mergetbl.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ModalDialog DLG_MERGE_TABLE
+{
+ HelpID = CMD_FN_TABLE_MERGE_TABLE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 207 , 57 ) ;
+ Moveable = TRUE ;
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 151 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 151 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 151 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_MERGE
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 139 , 8 ) ;
+ Text [ en-US ] = "Mode" ;
+ };
+ RadioButton RB_MERGE_PREV
+ {
+ HelpID = "sw:RadioButton:DLG_MERGE_TABLE:RB_MERGE_PREV";
+ Pos = MAP_APPFONT ( 12 , 15 ) ;
+ Size = MAP_APPFONT ( 130 , 10 ) ;
+ Check = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Join with ~previous table";
+ };
+ RadioButton RB_MERGE_NEXT
+ {
+ HelpID = "sw:RadioButton:DLG_MERGE_TABLE:RB_MERGE_NEXT";
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 130 , 10 ) ;
+ Text [ en-US ] = "Join with ~next table";
+ };
+ Text [ en-US ] = "Merge Tables";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/table/rowht.cxx b/sw/source/ui/table/rowht.cxx
new file mode 100644
index 000000000000..1fb108276bc1
--- /dev/null
+++ b/sw/source/ui/table/rowht.cxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <svl/intitem.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/dlgutil.hxx>
+
+
+#include <fmtfsize.hxx>
+#include <swtypes.hxx>
+#include <rowht.hxx>
+#include <wrtsh.hxx>
+#include <frmatr.hxx>
+#ifndef _WDOCSH_HXX
+#include <wdocsh.hxx>
+#endif
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <swmodule.hxx>
+#include <usrpref.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _ROWHT_HRC
+#include <rowht.hrc>
+#endif
+#ifndef _TABLE_HRC
+#include <table.hrc>
+#endif
+
+
+
+
+void SwTableHeightDlg::Apply()
+{
+ SwTwips nHeight = static_cast< SwTwips >(aHeightEdit.Denormalize(aHeightEdit.GetValue(FUNIT_TWIP)));
+ SwFmtFrmSize aSz(ATT_FIX_SIZE, 0, nHeight);
+
+ SwFrmSize eFrmSize = (SwFrmSize) aAutoHeightCB.IsChecked() ?
+ ATT_MIN_SIZE : ATT_FIX_SIZE;
+ if(eFrmSize != aSz.GetHeightSizeType())
+ {
+ aSz.SetHeightSizeType(eFrmSize);
+ }
+ rSh.SetRowHeight( aSz );
+}
+
+// CTOR / DTOR -----------------------------------------------------------
+
+
+SwTableHeightDlg::SwTableHeightDlg( Window *pParent, SwWrtShell &rS ) :
+
+ SvxStandardDialog(pParent, SW_RES(DLG_ROW_HEIGHT)),
+
+ aHeightEdit(this, SW_RES(ED_HEIGHT)),
+ aAutoHeightCB(this, SW_RES(CB_AUTOHEIGHT)),
+ aHeightFL(this, SW_RES(FL_HEIGHT)),
+ aOKBtn(this, SW_RES(BT_OK)),
+ aCancelBtn(this, SW_RES(BT_CANCEL)),
+ aHelpBtn( this, SW_RES( BT_HELP ) ),
+ rSh( rS )
+{
+ FreeResource();
+
+ FieldUnit eFieldUnit = SW_MOD()->GetUsrPref( 0 != PTR_CAST( SwWebDocShell,
+ rSh.GetView().GetDocShell() ) )->GetMetric();
+ ::SetFieldUnit( aHeightEdit, eFieldUnit );
+
+ aHeightEdit.SetMin(MINLAY, FUNIT_TWIP);
+ if(!aHeightEdit.GetMin())
+ aHeightEdit.SetMin(1);
+ SwFmtFrmSize *pSz;
+ rSh.GetRowHeight( pSz );
+ if ( pSz )
+ {
+ long nHeight = pSz->GetHeight();
+ aAutoHeightCB.Check(pSz->GetHeightSizeType() != ATT_FIX_SIZE);
+ aHeightEdit.SetValue(aHeightEdit.Normalize(nHeight), FUNIT_TWIP);
+
+ delete pSz;
+ }
+}
+
+
+
diff --git a/sw/source/ui/table/rowht.hrc b/sw/source/ui/table/rowht.hrc
new file mode 100644
index 000000000000..e844f3c65a8d
--- /dev/null
+++ b/sw/source/ui/table/rowht.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define ED_HEIGHT 1
+#define CB_AUTOHEIGHT 2
+#define FL_HEIGHT 3
+
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_HELP 102
+
diff --git a/sw/source/ui/table/rowht.src b/sw/source/ui/table/rowht.src
new file mode 100644
index 000000000000..b9abcd05ce94
--- /dev/null
+++ b/sw/source/ui/table/rowht.src
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+#include "rowht.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ModalDialog DLG_ROW_HEIGHT
+{
+ HelpID = CMD_FN_TABLE_SET_ROW_HEIGHT ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 157 , 60 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? Zeilenhöhe : Zellenhöhe */
+ Text [ en-US ] = "Row Height" ;
+ Moveable = TRUE ;
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 101 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 101 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 101 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ MetricField ED_HEIGHT
+ {
+ HelpID = "sw:MetricField:DLG_ROW_HEIGHT:ED_HEIGHT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 38 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 5 ;
+ Maximum = 990 ;
+ DecimalDigits = 1 ;
+ Value = 10 ;
+ Unit = FUNIT_CM ;
+ First = 100 ;
+ Last = 9999 ;
+ };
+ CheckBox CB_AUTOHEIGHT
+ {
+ HelpID = "sw:CheckBox:DLG_ROW_HEIGHT:CB_AUTOHEIGHT";
+ Pos = MAP_APPFONT ( 12 , 34 ) ;
+ Size = MAP_APPFONT ( 80 , 10 ) ;
+ /* ### ACHTUNG: Neuer Text in Resource? ~dynamisch anpassen : auto. H~öhe */
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Fit to size" ;
+ };
+ FixedLine FL_HEIGHT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 89 , 8 ) ;
+ Text [ en-US ] = "Height" ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/table/splittbl.cxx b/sw/source/ui/table/splittbl.cxx
new file mode 100644
index 000000000000..7037e2b0aa05
--- /dev/null
+++ b/sw/source/ui/table/splittbl.cxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <wrtsh.hxx>
+#include <splittbl.hxx>
+#include <splittbl.hrc>
+#include <table.hrc>
+#include <tblenum.hxx>
+/*-----------------17.03.98 10:56-------------------
+
+--------------------------------------------------*/
+SwSplitTblDlg::SwSplitTblDlg( Window *pParent, SwWrtShell &rSh ) :
+ SvxStandardDialog(pParent, SW_RES(DLG_SPLIT_TABLE)),
+ aOKPB( this, SW_RES(PB_OK )),
+ aCancelPB( this, SW_RES(PB_CANCEL )),
+ aHelpPB( this, SW_RES(PB_HELP )),
+ aSplitFL( this, SW_RES(FL_SPLIT )),
+ aCntntCopyRB( this, SW_RES(RB_CNTNT )),
+ aBoxAttrCopyWithParaRB( this, SW_RES(RB_BOX_PARA )),
+ aBoxAttrCopyNoParaRB( this, SW_RES(RB_BOX_NOPARA)),
+ aBorderCopyRB( this, SW_RES(RB_BORDER )),
+ rShell(rSh),
+ m_nSplit( HEADLINE_CNTNTCOPY )
+{
+ FreeResource();
+ aCntntCopyRB.Check();
+}
+
+/*-----------------17.03.98 10:56-------------------
+
+--------------------------------------------------*/
+void SwSplitTblDlg::Apply()
+{
+ m_nSplit = HEADLINE_CNTNTCOPY;
+ if(aBoxAttrCopyWithParaRB.IsChecked())
+ m_nSplit = HEADLINE_BOXATRCOLLCOPY;
+ if(aBoxAttrCopyNoParaRB.IsChecked())
+ m_nSplit = HEADLINE_BOXATTRCOPY;
+ else if(aBorderCopyRB.IsChecked())
+ m_nSplit = HEADLINE_BORDERCOPY;
+
+ rShell.SplitTable( m_nSplit );
+
+}
+
+
+
diff --git a/sw/source/ui/table/splittbl.hrc b/sw/source/ui/table/splittbl.hrc
new file mode 100644
index 000000000000..83882b374ecb
--- /dev/null
+++ b/sw/source/ui/table/splittbl.hrc
@@ -0,0 +1,34 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define PB_OK 1
+#define PB_CANCEL 2
+#define PB_HELP 3
+#define FL_SPLIT 4
+#define RB_CNTNT 5
+#define RB_BOX_NOPARA 6
+#define RB_BOX_PARA 7
+#define RB_BORDER 8
diff --git a/sw/source/ui/table/splittbl.src b/sw/source/ui/table/splittbl.src
new file mode 100644
index 000000000000..0ba49f00a271
--- /dev/null
+++ b/sw/source/ui/table/splittbl.src
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+#include "splittbl.hrc"
+#include "cmdid.h"
+#include "helpid.h"
+ModalDialog DLG_SPLIT_TABLE
+{
+ HelpID = CMD_FN_TABLE_SPLIT_TABLE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 207 , 76 ) ;
+ Moveable = TRUE ;
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 151 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 151 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 151 , 40 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SPLIT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 139 , 8 ) ;
+ Text [ en-US ] = "Mode" ;
+ };
+ RadioButton RB_CNTNT
+ {
+ HelpID = "sw:RadioButton:DLG_SPLIT_TABLE:RB_CNTNT";
+ Pos = MAP_APPFONT ( 12 , 15 ) ;
+ Size = MAP_APPFONT ( 130 , 10 ) ;
+ Check = TRUE ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Copy heading" ;
+ };
+ RadioButton RB_BOX_PARA
+ {
+ HelpID = "sw:RadioButton:DLG_SPLIT_TABLE:RB_BOX_PARA";
+ Pos = MAP_APPFONT ( 12 , 30 ) ;
+ Size = MAP_APPFONT ( 130 , 10 ) ;
+ Text [ en-US ] = "C~ustom heading (apply Style)" ;
+ };
+ RadioButton RB_BOX_NOPARA
+ {
+ HelpID = "sw:RadioButton:DLG_SPLIT_TABLE:RB_BOX_NOPARA";
+ Pos = MAP_APPFONT ( 12 , 45 ) ;
+ Size = MAP_APPFONT ( 130 , 10 ) ;
+ Text [ en-US ] = "Cu~stom heading" ;
+ };
+ RadioButton RB_BORDER
+ {
+ HelpID = "sw:RadioButton:DLG_SPLIT_TABLE:RB_BORDER";
+ Pos = MAP_APPFONT ( 12 , 60 ) ;
+ Size = MAP_APPFONT ( 130 , 10 ) ;
+ Text [ en-US ] = "~No heading" ;
+ };
+ Text [ en-US ] = "Split Table" ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/table/swtablerep.cxx b/sw/source/ui/table/swtablerep.cxx
new file mode 100644
index 000000000000..ab7df943e201
--- /dev/null
+++ b/sw/source/ui/table/swtablerep.cxx
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <tools/list.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <editeng/keepitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svl/ctloptions.hxx>
+#include <swmodule.hxx>
+#include <fmtornt.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtlsplt.hxx>
+
+#include <svtools/htmlcfg.hxx>
+#include <fmtrowsplt.hxx>
+#include <svx/htmlmode.hxx>
+
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <viewopt.hxx>
+#include <uitool.hxx>
+#include <frmatr.hxx>
+
+#ifndef _TABLEPG_HXX
+#include <tablepg.hxx>
+#endif
+#include <tablemgr.hxx>
+#include <pagedesc.hxx>
+#include <poolfmt.hxx>
+#include <SwStyleNameMapper.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _TABLEDLG_HRC
+#include <tabledlg.hrc>
+#endif
+#ifndef _TABLE_HRC
+#include <table.hrc>
+#endif
+#include "swtablerep.hxx"
+
+#ifdef DEBUG_TBLDLG
+
+void DbgTColumn(TColumn* pTColumn, USHORT nCount)
+{
+ for(USHORT i = 0; i < nCount; i++)
+ {
+ String sMsg(i);
+ sMsg += pTColumn[i].bVisible ? " v " : " h ";
+ sMsg += pTColumn[i].nWidth;
+ DBG_ERROR(sMsg)
+ }
+}
+#endif
+
+
+/*-----------------20.08.96 09.43-------------------
+--------------------------------------------------*/
+SwTableRep::SwTableRep( const SwTabCols& rTabCol, BOOL bCplx )
+ :
+ nTblWidth(0),
+ nSpace(0),
+ nLeftSpace(0),
+ nRightSpace(0),
+ nAlign(0),
+ nWidthPercent(0),
+ bComplex(bCplx),
+ bLineSelected(FALSE),
+ bWidthChanged(FALSE),
+ bColsChanged(FALSE)
+{
+ nAllCols = nColCount = rTabCol.Count();
+ pTColumns = new TColumn[ nColCount + 1 ];
+ SwTwips nStart = 0,
+ nEnd;
+ for( USHORT i = 0; i < nAllCols; ++i )
+ {
+ nEnd = rTabCol[ i ] - rTabCol.GetLeft();
+ pTColumns[ i ].nWidth = nEnd - nStart;
+ pTColumns[ i ].bVisible = !rTabCol.IsHidden(i);
+ if(!pTColumns[ i ].bVisible)
+ nColCount --;
+ nStart = nEnd;
+ }
+ pTColumns[ nAllCols ].nWidth = rTabCol.GetRight() - rTabCol.GetLeft() - nStart;
+ pTColumns[ nAllCols ].bVisible = TRUE;
+ nColCount++;
+ nAllCols++;
+}
+
+/*-----------------20.08.96 09.43-------------------
+--------------------------------------------------*/
+SwTableRep::~SwTableRep()
+{
+ delete[] pTColumns;
+}
+
+/*-----------------20.08.96 13.33-------------------
+--------------------------------------------------*/
+BOOL SwTableRep::FillTabCols( SwTabCols& rTabCols ) const
+{
+ long nOldLeft = rTabCols.GetLeft(),
+ nOldRight = rTabCols.GetRight();
+
+ BOOL bSingleLine = FALSE;
+ USHORT i;
+
+ for ( i = 0; i < rTabCols.Count(); ++i )
+ if(!pTColumns[i].bVisible)
+ {
+ bSingleLine = TRUE;
+ break;
+ }
+
+#ifdef DEBUG_TBLDLG
+#define DbgTColumn(pTColumns, nAllCols);
+#endif
+
+ SwTwips nPos = 0;
+ SwTwips nLeft = GetLeftSpace();
+ rTabCols.SetLeft(nLeft);
+ if(bSingleLine)
+ {
+ // die unsichtbaren Trenner werden aus den alten TabCols genommen
+ // die sichtbaren kommen aus pTColumns
+ TColumn* pOldTColumns = new TColumn[nAllCols + 1];
+ SwTwips nStart = 0,
+ nEnd;
+ for(i = 0; i < nAllCols - 1; i++)
+ {
+ nEnd = rTabCols[i] - rTabCols.GetLeft();
+ pOldTColumns[i].nWidth = nEnd - nStart;
+ pOldTColumns[i].bVisible = !rTabCols.IsHidden(i);
+ nStart = nEnd;
+ }
+ pOldTColumns[nAllCols - 1].nWidth = rTabCols.GetRight() - rTabCols.GetLeft() - nStart;
+ pOldTColumns[nAllCols - 1].bVisible = TRUE;
+
+#ifdef DEBUG_TBLDLG
+#define DbgTColumn(pOldTColumns, nAllCols);
+#endif
+
+ USHORT nOldPos = 0;
+ USHORT nNewPos = 0;
+ SwTwips nOld = 0;
+ SwTwips nNew = 0;
+ BOOL bOld = FALSE;
+ BOOL bFirst = TRUE;
+ i = 0;
+
+ while ( i < nAllCols -1 )
+ {
+ while((bFirst || bOld ) && nOldPos < nAllCols )
+ {
+ nOld += pOldTColumns[nOldPos].nWidth;
+ nOldPos++;
+ if(!pOldTColumns[nOldPos - 1].bVisible)
+ break;
+ }
+ while((bFirst || !bOld ) && nNewPos < nAllCols )
+ {
+ nNew += pTColumns[nNewPos].nWidth;
+ nNewPos++;
+ if(pOldTColumns[nNewPos - 1].bVisible)
+ break;
+ }
+ bFirst = FALSE;
+ // sie muessen sortiert eingefuegt werden
+ bOld = nOld < nNew;
+ nPos = USHORT(bOld ? nOld : nNew);
+ rTabCols[i] = nPos + nLeft;
+ rTabCols.SetHidden( i, bOld );
+ i++;
+ }
+ rTabCols.SetRight(nLeft + nTblWidth);
+
+ delete[] pOldTColumns;
+ }
+ else
+ {
+ for ( i = 0; i < nAllCols - 1; ++i )
+ {
+ nPos += pTColumns[i].nWidth;
+ rTabCols[i] = nPos + rTabCols.GetLeft();
+ rTabCols.SetHidden( i, !pTColumns[i].bVisible );
+ rTabCols.SetRight(nLeft + pTColumns[nAllCols - 1].nWidth + nPos);
+ }
+ }
+
+// Rundungsfehler abfangen
+ if(Abs((long)nOldLeft - (long)rTabCols.GetLeft()) < 3)
+ rTabCols.SetLeft(nOldLeft);
+
+ if(Abs((long)nOldRight - (long)rTabCols.GetRight()) < 3)
+ rTabCols.SetRight(nOldRight);
+
+ if(GetRightSpace() >= 0 &&
+ rTabCols.GetRight() > rTabCols.GetRightMax())
+ rTabCols.SetRight(rTabCols.GetRightMax());
+ return bSingleLine;
+}
diff --git a/sw/source/ui/table/table.src b/sw/source/ui/table/table.src
new file mode 100644
index 000000000000..7a0ab5472347
--- /dev/null
+++ b/sw/source/ui/table/table.src
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+InfoBox MSG_ERR_TABLE_MERGE
+{
+ Message [ en-US ] = "Selected table cells are too complex to merge." ;
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
new file mode 100644
index 000000000000..5b26b99d012f
--- /dev/null
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -0,0 +1,1981 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <hintids.hxx>
+#include <tools/list.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <editeng/keepitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svl/ctloptions.hxx>
+#include <swmodule.hxx>
+#include <fmtornt.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtlsplt.hxx>
+
+#include <svtools/htmlcfg.hxx>
+#include <fmtrowsplt.hxx>
+#include <svx/htmlmode.hxx>
+
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <viewopt.hxx>
+#include <uitool.hxx>
+#include <frmatr.hxx>
+#include <tabledlg.hxx>
+#ifndef _TABLEPG_HXX
+#include <tablepg.hxx>
+#endif
+#include <tablemgr.hxx>
+#include <pagedesc.hxx>
+#include <uiitems.hxx>
+#include <poolfmt.hxx>
+#include <SwStyleNameMapper.hxx>
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _TABLEDLG_HRC
+#include <tabledlg.hrc>
+#endif
+#ifndef _TABLE_HRC
+#include <table.hrc>
+#endif
+#include <svx/svxids.hrc>
+#include <svx/dialogs.hrc>
+#include <svx/flagsdef.hxx>
+#include <svx/svxdlg.hxx>
+
+using namespace ::com::sun::star;
+
+
+#ifdef DEBUG_TBLDLG
+void DbgTblRep(SwTableRep* pRep)
+{
+ DBG_ERROR(String(pRep->GetColCount()))
+ DBG_ERROR(String(pRep->GetAllColCount()))
+ SwTwips nSum = 0;
+ for(USHORT i = 0; i < pRep->GetAllColCount(); i++)
+ {
+ String sMsg(i);
+ sMsg += pRep->GetColumns()[i].bVisible ? " v " : " h ";
+ sMsg += pRep->GetColumns()[i].nWidth;
+ nSum +=pRep->GetColumns()[i].nWidth;
+ DBG_ERROR(sMsg)
+ }
+ String sMsg("Spaltensumme: ");
+ sMsg += nSum;
+ sMsg += " Tblbreite: ";
+ sMsg += pRep->GetWidth();
+ DBG_ERROR(sMsg)
+ sMsg = "Gesamt/Links/Rechts: ";
+ sMsg += pRep->GetSpace();
+ sMsg += '/';
+ sMsg += pRep->GetLeftSpace();
+ sMsg += '/';
+ sMsg += pRep->GetRightSpace();
+ DBG_ERROR(sMsg)
+ sMsg = "Align: ";
+ sMsg += pRep->GetAlign();
+ DBG_ERROR(sMsg)
+
+};
+
+#endif
+
+
+SwFormatTablePage::SwFormatTablePage( Window* pParent, const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SW_RES( TP_FORMAT_TABLE ), rSet ),
+ aOptionsFL(this, SW_RES( FL_OPTIONS )),
+ aNameFT(this, SW_RES( FT_NAME )),
+ aNameED(this, SW_RES( ED_NAME )),
+ aWidthFT(this, SW_RES( FT_WIDTH )),
+ aWidthMF(this, SW_RES( ED_WIDTH )),
+ aRelWidthCB(this, SW_RES( CB_REL_WIDTH )),
+
+ aPosFL(this, SW_RES( FL_POS )),
+ aFullBtn(this, SW_RES( RB_FULL )),
+ aLeftBtn(this, SW_RES( RB_LEFT )),
+ aFromLeftBtn(this, SW_RES( RB_FROM_LEFT )),
+ aRightBtn(this, SW_RES( RB_RIGHT )),
+ aCenterBtn(this, SW_RES( RB_CENTER )),
+ aFreeBtn(this, SW_RES( RB_FREE )),
+
+ aDistFL(this, SW_RES( FL_DIST )),
+ aLeftFT(this, SW_RES( FT_LEFT_DIST )),
+ aLeftMF(this, SW_RES( ED_LEFT_DIST )),
+ aRightFT(this, SW_RES( FT_RIGHT_DIST )),
+ aRightMF(this, SW_RES( ED_RIGHT_DIST )),
+ aTopFT (this, SW_RES( FT_TOP_DIST )),
+ aTopMF(this, SW_RES( ED_TOP_DIST )),
+ aBottomFT(this, SW_RES( FT_BOTTOM_DIST )),
+ aBottomMF(this, SW_RES( ED_BOTTOM_DIST )),
+
+ aPropertiesFL(this, SW_RES( FL_PROPERTIES )),
+ aTextDirectionFT(this, SW_RES( FT_TEXTDIRECTION )),
+ aTextDirectionLB(this, SW_RES( LB_TEXTDIRECTION )),
+
+ pTblData(0),
+ nSaveWidth(0),
+ nMinTableWidth(MINLAY),
+ bModified(FALSE),
+ bFull(0),
+ bHtmlMode(sal_False)
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, FALSE, &pItem))
+ bHtmlMode = 0 != (((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON);
+
+ sal_Bool bCTL = SW_MOD()->GetCTLOptions().IsCTLFontEnabled();
+ if( !bHtmlMode && bCTL )
+ {
+ aPropertiesFL.Show();
+ aTextDirectionFT.Show();
+ aTextDirectionLB.Show();
+ }
+
+ Init();
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwFormatTablePage::Init()
+{
+ aLeftMF.MetricField::SetMin(-999999);
+ aRightMF.MetricField::SetMin(-999999);
+
+ // handler
+ Link aLk = LINK( this, SwFormatTablePage, AutoClickHdl );
+ aFullBtn.SetClickHdl( aLk );
+ aFreeBtn.SetClickHdl( aLk );
+ aLeftBtn.SetClickHdl( aLk );
+ aFromLeftBtn.SetClickHdl( aLk );
+ aRightBtn.SetClickHdl( aLk );
+ aCenterBtn.SetClickHdl( aLk );
+
+ aLk = LINK( this, SwFormatTablePage, UpDownLoseFocusHdl );
+ aTopMF.SetUpHdl( aLk );
+ aBottomMF.SetUpHdl( aLk );
+ aRightMF.SetUpHdl( aLk );
+ aLeftMF.SetUpHdl( aLk );
+ aWidthMF.SetUpHdl( aLk );
+
+ aTopMF.SetDownHdl( aLk );
+ aBottomMF.SetDownHdl( aLk );
+ aRightMF.SetDownHdl( aLk );
+ aLeftMF.SetDownHdl( aLk );
+ aWidthMF.SetDownHdl( aLk );
+
+ aTopMF.SetLoseFocusHdl( aLk );
+ aBottomMF.SetLoseFocusHdl( aLk );
+ aRightMF.SetLoseFocusHdl( aLk );
+ aLeftMF.SetLoseFocusHdl( aLk );
+ aWidthMF.SetLoseFocusHdl( aLk );
+
+ aRelWidthCB.SetClickHdl(LINK( this, SwFormatTablePage, RelWidthClickHdl ));
+}
+
+/*------------------------------------------------------------------------*/
+
+IMPL_LINK( SwFormatTablePage, RelWidthClickHdl, CheckBox *, pBtn )
+{
+ DBG_ASSERT(pTblData, "Tabellendaten nicht da?");
+ BOOL bIsChecked = pBtn->IsChecked();
+ sal_Int64 nLeft = aLeftMF.DenormalizePercent(aLeftMF.GetValue(FUNIT_TWIP ));
+ sal_Int64 nRight = aRightMF.DenormalizePercent(aRightMF.GetValue(FUNIT_TWIP ));
+ aWidthMF.ShowPercent(bIsChecked);
+ aLeftMF.ShowPercent(bIsChecked);
+ aRightMF.ShowPercent(bIsChecked);
+
+ if (bIsChecked)
+ {
+ aWidthMF.SetRefValue(pTblData->GetSpace());
+ aLeftMF.SetRefValue(pTblData->GetSpace());
+ aRightMF.SetRefValue(pTblData->GetSpace());
+ aLeftMF.MetricField::SetMin(0); // wird vom Percentfield ueberschrieben
+ aRightMF.MetricField::SetMin(0);// -""-
+ aLeftMF.MetricField::SetMax(99); //
+ aRightMF.MetricField::SetMax(99);//
+ aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent(nLeft ), FUNIT_TWIP );
+ aRightMF.SetPrcntValue(aRightMF.NormalizePercent(nRight ), FUNIT_TWIP );
+ }
+ else
+ ModifyHdl(&aLeftMF); // Werte wieder korrigieren
+
+ if(aFreeBtn.IsChecked())
+ {
+ BOOL bEnable = !pBtn->IsChecked();
+ aRightMF.Enable(bEnable);
+ aRightFT.Enable(bEnable);
+ }
+ bModified = TRUE;
+
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+IMPL_LINK( SwFormatTablePage, AutoClickHdl, CheckBox *, pBox )
+{
+ BOOL bRestore = TRUE,
+ bLeftEnable = FALSE,
+ bRightEnable= FALSE,
+ bWidthEnable= FALSE,
+ bOthers = TRUE;
+ if( (RadioButton *) pBox == &aFullBtn )
+ {
+ aLeftMF.SetPrcntValue(0);
+ aRightMF.SetPrcntValue(0);
+ nSaveWidth = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue(FUNIT_TWIP )));
+ aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(pTblData->GetSpace() ), FUNIT_TWIP );
+ bFull = TRUE;
+ bRestore = FALSE;
+ }
+ else if( (RadioButton *) pBox == &aLeftBtn )
+ {
+ bRightEnable = bWidthEnable = TRUE;
+ aLeftMF.SetPrcntValue(0);
+ }
+ else if( (RadioButton *) pBox == &aFromLeftBtn )
+ {
+ bLeftEnable = bWidthEnable = TRUE;
+ aRightMF.SetPrcntValue(0);
+ }
+ else if( (RadioButton *) pBox == &aRightBtn )
+ {
+ bLeftEnable = bWidthEnable = TRUE;
+ aRightMF.SetPrcntValue(0);
+ }
+ else if( ( RadioButton * ) pBox == &aCenterBtn )
+ {
+ bLeftEnable = bWidthEnable = TRUE;
+ }
+ else if( ( RadioButton * ) pBox == &aFreeBtn )
+ {
+ RightModifyHdl(&aRightMF);
+ bLeftEnable = TRUE;
+ bWidthEnable = TRUE;
+ bOthers = FALSE;
+ }
+ aLeftMF.Enable(bLeftEnable);
+ aLeftFT.Enable(bLeftEnable);
+ aWidthMF.Enable(bWidthEnable);
+ aWidthFT.Enable(bWidthEnable);
+ if ( bOthers )
+ {
+ aRightMF.Enable(bRightEnable);
+ aRightFT.Enable(bRightEnable);
+ aRelWidthCB.Enable(bWidthEnable);
+ }
+
+ if(bFull && bRestore)
+ {
+ // nachdem auf autom. geschaltet wurde, wurde die Breite gemerkt,
+ // um sie beim Zurueckschalten restaurieren zu koennen
+ bFull = FALSE;
+ aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(nSaveWidth ), FUNIT_TWIP );
+ }
+ ModifyHdl(&aWidthMF);
+ bModified = TRUE;
+ return 0;
+}
+
+/*----------------------------------------------------------------------*/
+IMPL_LINK( SwFormatTablePage, RightModifyHdl, MetricField *, EMPTYARG )
+{
+ if(aFreeBtn.IsChecked())
+ {
+ BOOL bEnable = aRightMF.GetValue() == 0;
+// aWidthMF.Enable(bEnable);
+ aRelWidthCB.Enable(bEnable);
+// aWidthFT.Enable(bEnable);
+ if ( !bEnable )
+ {
+ aRelWidthCB.Check(FALSE);
+ RelWidthClickHdl(&aRelWidthCB);
+ }
+ bEnable = aRelWidthCB.IsChecked();
+ aRightMF.Enable(!bEnable);
+ aRightFT.Enable(!bEnable);
+ }
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+IMPL_LINK_INLINE_START( SwFormatTablePage, UpDownLoseFocusHdl, MetricField *, pEdit )
+{
+ if( &aRightMF == pEdit)
+ RightModifyHdl(pEdit);
+ ModifyHdl( pEdit );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwFormatTablePage, UpDownLoseFocusHdl, MetricField *, pEdit )
+
+void SwFormatTablePage::ModifyHdl( Edit* pEdit )
+{
+
+ SwTwips nCurWidth = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue( FUNIT_TWIP )));
+ SwTwips nPrevWidth = nCurWidth;
+ SwTwips nRight = static_cast< SwTwips >(aRightMF.DenormalizePercent(aRightMF.GetValue( FUNIT_TWIP )));
+ SwTwips nLeft = static_cast< SwTwips >(aLeftMF.DenormalizePercent(aLeftMF.GetValue( FUNIT_TWIP )));
+ SwTwips nDiff;
+
+ if( pEdit == &aWidthMF )
+ {
+ if( nCurWidth < MINLAY )
+ nCurWidth = MINLAY;
+ nDiff = nRight + nLeft + nCurWidth - pTblData->GetSpace() ;
+ //rechtsbuendig nur linken Rand veraendern
+ if(aRightBtn.IsChecked())
+ nLeft -= nDiff;
+ //linksbuendig nur rechten Rand veraendern
+ else if(aLeftBtn.IsChecked())
+ nRight -= nDiff;
+ //linker Rand und Breite erlaubt - erst rechts - dann links
+ else if(aFromLeftBtn.IsChecked())
+ {
+ if( nRight >= nDiff )
+ nRight -= nDiff;
+ else
+ {
+ nDiff -= nRight;
+ nRight = 0;
+ if(nLeft >= nDiff)
+ nLeft -= nDiff;
+ else
+ {
+ nRight += nLeft - nDiff;
+ nLeft = 0;
+ nCurWidth = pTblData->GetSpace();
+ }
+
+ }
+ }
+ //zentriert beide Seiten gleichmaessig veraendern
+ else if(aCenterBtn.IsChecked())
+ {
+ if((nLeft != nRight))
+ {
+ nDiff += nLeft + nRight;
+ nLeft = nDiff/2;
+ nRight = nDiff/2;
+ }
+ else
+ {
+ nLeft -= nDiff/2;
+ nRight -= nDiff/2;
+ }
+ }
+ //freie Ausrichtung: beide Raender verkleinern
+ else if(aFreeBtn.IsChecked())
+ {
+ nLeft -= nDiff/2;
+ nRight -= nDiff/2;
+ }
+ }
+ if( pEdit == &aRightMF )
+ {
+
+ if( nRight + nLeft > pTblData->GetSpace() - MINLAY )
+ nRight = pTblData->GetSpace() -nLeft - MINLAY;
+
+ nCurWidth = pTblData->GetSpace() - nLeft - nRight;
+ }
+ if( pEdit == &aLeftMF )
+ {
+ if(!aFromLeftBtn.IsChecked())
+ {
+ BOOL bCenter = aCenterBtn.IsChecked();
+ if( bCenter )
+ nRight = nLeft;
+ if(nRight + nLeft > pTblData->GetSpace() - MINLAY )
+ {
+ nLeft = bCenter ? (pTblData->GetSpace() - MINLAY) /2 :
+ (pTblData->GetSpace() - MINLAY) - nRight;
+ nRight = bCenter ? (pTblData->GetSpace() - MINLAY) /2 : nRight;
+ }
+ nCurWidth = pTblData->GetSpace() - nLeft - nRight;
+ }
+ else
+ {
+ //hier wird bei Aenderung an der linken Seite zuerst der
+ //rechte Rand veraendert, dann die Breite
+ nDiff = nRight + nLeft + nCurWidth - pTblData->GetSpace() ;
+
+ nRight -= nDiff;
+ nCurWidth = pTblData->GetSpace() - nLeft - nRight;
+ }
+ }
+ if (nCurWidth != nPrevWidth )
+ aWidthMF.SetPrcntValue( aWidthMF.NormalizePercent( nCurWidth ), FUNIT_TWIP );
+ aRightMF.SetPrcntValue( aRightMF.NormalizePercent( nRight ), FUNIT_TWIP );
+ aLeftMF.SetPrcntValue( aLeftMF.NormalizePercent( nLeft ), FUNIT_TWIP );
+ bModified = TRUE;
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+SfxTabPage* SwFormatTablePage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SwFormatTablePage( pParent, rAttrSet );
+}
+
+/*------------------------------------------------------------------------
+-------------------------------------------------------------------------*/
+BOOL SwFormatTablePage::FillItemSet( SfxItemSet& rCoreSet )
+{
+ // Testen, ob eins der Control noch den Focus hat
+ if(aWidthMF.HasFocus())
+ ModifyHdl(&aWidthMF);
+ else if(aLeftMF.HasFocus())
+ ModifyHdl(&aLeftMF);
+ else if(aRightMF.HasFocus())
+ ModifyHdl(&aRightMF);
+ else if(aTopMF.HasFocus())
+ ModifyHdl(&aTopMF);
+ else if(aBottomMF.HasFocus())
+ ModifyHdl(&aBottomMF);
+
+ if(bModified)
+ {
+ if( aBottomMF.GetText() != aBottomMF.GetSavedValue() ||
+ aTopMF.GetText() != aTopMF.GetSavedValue() )
+ {
+ SvxULSpaceItem aULSpace(RES_UL_SPACE);
+ aULSpace.SetUpper( (USHORT) aTopMF.Denormalize(
+ aTopMF.GetValue( FUNIT_TWIP )));
+ aULSpace.SetLower( (USHORT) aBottomMF.Denormalize(
+ aBottomMF.GetValue( FUNIT_TWIP )));
+ rCoreSet.Put(aULSpace);
+ }
+
+ }
+ if(aNameED.GetText() != aNameED.GetSavedValue())
+ {
+ rCoreSet.Put(SfxStringItem( FN_PARAM_TABLE_NAME, aNameED.GetText()));
+ bModified = TRUE;
+ }
+
+ USHORT nPos;
+ if( aTextDirectionLB.IsVisible() &&
+ ( nPos = aTextDirectionLB.GetSelectEntryPos() ) !=
+ aTextDirectionLB.GetSavedValue() )
+ {
+ sal_uInt32 nDirection = (sal_uInt32)(sal_uIntPtr)aTextDirectionLB.GetEntryData( nPos );
+ rCoreSet.Put( SvxFrameDirectionItem( (SvxFrameDirection)nDirection, RES_FRAMEDIR));
+ bModified = TRUE;
+ }
+
+ return bModified;
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwFormatTablePage::Reset( const SfxItemSet& )
+{
+ const SfxItemSet& rSet = GetItemSet();
+ const SfxPoolItem* pItem;
+
+ if(bHtmlMode)
+ {
+ aNameED .Disable();
+ aTopFT .Hide();
+ aTopMF .Hide();
+ aBottomFT.Hide();
+ aBottomMF.Hide();
+ aFreeBtn.Enable(FALSE);
+ }
+ FieldUnit aMetric = ::GetDfltMetric(bHtmlMode);
+ SetMetric( aWidthMF, aMetric );
+ SetMetric( aRightMF, aMetric );
+ SetMetric( aLeftMF, aMetric );
+ SetMetric( aTopMF, aMetric );
+ SetMetric( aBottomMF, aMetric );
+
+ //Name
+ if(SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_NAME, FALSE, &pItem ))
+ {
+ aNameED.SetText(((const SfxStringItem*)pItem)->GetValue());
+ aNameED.SaveValue();
+ }
+
+ if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP, FALSE, &pItem ))
+ {
+ pTblData = (SwTableRep*)((const SwPtrItem*) pItem)->GetValue();
+ nMinTableWidth = pTblData->GetColCount() * MINLAY;
+
+ if(pTblData->GetWidthPercent())
+ {
+ aRelWidthCB.Check(TRUE);
+ RelWidthClickHdl(&aRelWidthCB);
+ aWidthMF.SetPrcntValue(pTblData->GetWidthPercent(), FUNIT_CUSTOM);
+
+ aWidthMF.SaveValue();
+ nSaveWidth = static_cast< SwTwips >(aWidthMF.GetValue(FUNIT_CUSTOM));
+ }
+ else
+ {
+ aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(
+ pTblData->GetWidth()), FUNIT_TWIP);
+ aWidthMF.SaveValue();
+ nSaveWidth = pTblData->GetWidth();
+ nMinTableWidth = Min( nSaveWidth, nMinTableWidth );
+ }
+
+ aWidthMF.SetRefValue(pTblData->GetSpace());
+ aWidthMF.SetLast(aWidthMF.NormalizePercent( pTblData->GetSpace() ));
+ aLeftMF.SetLast(aLeftMF.NormalizePercent( pTblData->GetSpace() ));
+ aRightMF.SetLast(aRightMF.NormalizePercent( pTblData->GetSpace() ));
+
+ aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent(
+ pTblData->GetLeftSpace()), FUNIT_TWIP);
+ aRightMF.SetPrcntValue(aRightMF.NormalizePercent(
+ pTblData->GetRightSpace()), FUNIT_TWIP);
+ aLeftMF.SaveValue();
+ aRightMF.SaveValue();
+
+ nOldAlign = pTblData->GetAlign();
+
+ BOOL bSetRight = FALSE, bRightEnable = FALSE,
+ bSetLeft = FALSE, bLeftEnable = FALSE;
+ switch( nOldAlign )
+ {
+ case text::HoriOrientation::NONE:
+ aFreeBtn.Check();
+ if(aRelWidthCB.IsChecked())
+ bSetRight = TRUE;
+ break;
+ case text::HoriOrientation::FULL:
+ {
+ bSetRight = bSetLeft = TRUE;
+ aFullBtn.Check();
+ aWidthMF.Enable(FALSE);
+ aRelWidthCB.Enable(FALSE);
+ aWidthFT.Enable(FALSE);
+ }
+ break;
+ case text::HoriOrientation::LEFT:
+ {
+ bSetLeft = TRUE;
+ aLeftBtn.Check();
+ }
+ break;
+ case text::HoriOrientation::LEFT_AND_WIDTH :
+ {
+ bSetRight = TRUE;
+ aFromLeftBtn.Check();
+ }
+ break;
+ case text::HoriOrientation::RIGHT:
+ {
+ bSetRight = TRUE;
+ aRightBtn.Check();
+ }
+ break;
+ case text::HoriOrientation::CENTER:
+ {
+ bSetRight = TRUE;
+ aCenterBtn.Check();
+ }
+ break;
+ }
+ if ( bSetRight )
+ {
+ aRightMF.Enable(bRightEnable);
+ aRightFT.Enable(bRightEnable);
+ }
+ if ( bSetLeft )
+ {
+ aLeftMF.Enable(bLeftEnable);
+ aLeftFT.Enable(bLeftEnable);
+ }
+
+ }
+
+ //Raender
+ if(SFX_ITEM_SET == rSet.GetItemState( RES_UL_SPACE, FALSE,&pItem ))
+ {
+ aTopMF.SetValue(aTopMF.Normalize(
+ ((const SvxULSpaceItem*)pItem)->GetUpper()), FUNIT_TWIP);
+ aBottomMF.SetValue(aBottomMF.Normalize(
+ ((const SvxULSpaceItem*)pItem)->GetLower()), FUNIT_TWIP);
+ aTopMF.SaveValue();
+ aBottomMF.SaveValue();
+ }
+
+ //text direction
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_FRAMEDIR, TRUE, &pItem ) )
+ {
+ sal_uInt32 nVal = ((SvxFrameDirectionItem*)pItem)->GetValue();
+ USHORT nPos = aTextDirectionLB.GetEntryPos( (void*) nVal );
+ aTextDirectionLB.SelectEntryPos( nPos );
+ aTextDirectionLB.SaveValue();
+ }
+
+ aWidthMF.SetMax( 2*aWidthMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP );
+ aRightMF.SetMax( aRightMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP );
+ aLeftMF.SetMax( aLeftMF.NormalizePercent( pTblData->GetSpace() ), FUNIT_TWIP );
+ aWidthMF.SetMin( aWidthMF.NormalizePercent( nMinTableWidth ), FUNIT_TWIP );
+
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwFormatTablePage::ActivatePage( const SfxItemSet& rSet )
+{
+ DBG_ASSERT(pTblData, "Tabellendaten nicht da?");
+ if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP ))
+ {
+ SwTwips nCurWidth = text::HoriOrientation::FULL != pTblData->GetAlign() ?
+ pTblData->GetWidth() :
+ pTblData->GetSpace();
+ if(pTblData->GetWidthPercent() == 0 &&
+ nCurWidth != aWidthMF.DenormalizePercent(aWidthMF.GetValue(FUNIT_TWIP )))
+ {
+ aWidthMF.SetPrcntValue(aWidthMF.NormalizePercent(
+ nCurWidth), FUNIT_TWIP);
+ aWidthMF.SaveValue();
+ nSaveWidth = nCurWidth;
+ aLeftMF.SetPrcntValue(aLeftMF.NormalizePercent(
+ pTblData->GetLeftSpace()), FUNIT_TWIP);
+ aLeftMF.SaveValue();
+ aRightMF.SetPrcntValue(aRightMF.NormalizePercent(
+ pTblData->GetRightSpace()), FUNIT_TWIP);
+ aRightMF.SaveValue();
+ }
+ }
+
+}
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+int SwFormatTablePage::DeactivatePage( SfxItemSet* _pSet )
+{
+ // os: VCL sorgt nicht dafuer, dass das aktive Control im
+ // dialog bei OK den focus verliert
+ aNameED.GrabFocus();
+ // Test des Tabellennamens auf Leerzeichen
+ String sTblName = aNameED.GetText();
+ if(sTblName.Search(' ') != STRING_NOTFOUND)
+ {
+ InfoBox(this, SW_RES(MSG_WRONG_TABLENAME)).Execute();
+ aNameED.GrabFocus();
+ return KEEP_PAGE;
+ }
+ if(_pSet)
+ {
+ FillItemSet(*_pSet);
+ if(bModified)
+ {
+ SwTwips lLeft = static_cast< SwTwips >(aLeftMF.DenormalizePercent(aLeftMF.GetValue( FUNIT_TWIP )));
+ SwTwips lRight = static_cast< SwTwips >(aRightMF.DenormalizePercent(aRightMF.GetValue( FUNIT_TWIP )));
+
+
+ if( aLeftMF.GetText() != aLeftMF.GetSavedValue() ||
+ aRightMF.GetText() != aRightMF.GetSavedValue() )
+ {
+ pTblData->SetWidthChanged();
+ pTblData->SetLeftSpace( lLeft);
+ pTblData->SetRightSpace( lRight);
+ }
+
+ SwTwips lWidth;
+ if (aRelWidthCB.IsChecked() && aRelWidthCB.IsEnabled())
+ {
+ lWidth = pTblData->GetSpace() - lRight - lLeft;
+ USHORT nPercentWidth = (USHORT)aWidthMF.GetValue(FUNIT_CUSTOM);
+ if(pTblData->GetWidthPercent() != nPercentWidth)
+ {
+ pTblData->SetWidthPercent(nPercentWidth);
+ pTblData->SetWidthChanged();
+ }
+ }
+ else
+ {
+ pTblData->SetWidthPercent(0);
+ lWidth = static_cast< SwTwips >(aWidthMF.DenormalizePercent(aWidthMF.GetValue( FUNIT_TWIP )));
+ }
+ pTblData->SetWidth(lWidth);
+
+ SwTwips nColSum = 0;
+ USHORT i;
+
+ for( i = 0; i < pTblData->GetColCount(); i++)
+ {
+ nColSum += pTblData->GetColumns()[i].nWidth;
+ }
+ if(nColSum != pTblData->GetWidth())
+ {
+ SwTwips nMinWidth = Min( (long)MINLAY,
+ (long) (pTblData->GetWidth() /
+ pTblData->GetColCount() - 1));
+ SwTwips nDiff = nColSum - pTblData->GetWidth();
+ while ( Abs(nDiff) > pTblData->GetColCount() + 1 )
+ {
+ SwTwips nSub = nDiff / pTblData->GetColCount();
+ for( i = 0; i < pTblData->GetColCount(); i++)
+ {
+ if(pTblData->GetColumns()[i].nWidth - nMinWidth > nSub)
+ {
+ pTblData->GetColumns()[i].nWidth -= nSub;
+ nDiff -= nSub;
+ }
+ else
+ {
+ nDiff -= pTblData->GetColumns()[i].nWidth - nMinWidth;
+ pTblData->GetColumns()[i].nWidth = nMinWidth;
+ }
+
+ }
+ }
+ }
+
+ sal_Int16 nAlign = 0;
+ if(aRightBtn.IsChecked())
+ nAlign = text::HoriOrientation::RIGHT;
+ else if(aLeftBtn.IsChecked())
+ nAlign = text::HoriOrientation::LEFT;
+ else if(aFromLeftBtn.IsChecked())
+ nAlign = text::HoriOrientation::LEFT_AND_WIDTH;
+ else if(aCenterBtn.IsChecked())
+ nAlign = text::HoriOrientation::CENTER;
+ else if(aFreeBtn.IsChecked())
+ nAlign = text::HoriOrientation::NONE;
+ else if(aFullBtn.IsChecked())
+ {
+ nAlign = text::HoriOrientation::FULL;
+ lWidth = lAutoWidth;
+ }
+ if(nAlign != pTblData->GetAlign())
+ {
+ pTblData->SetWidthChanged();
+ pTblData->SetAlign(nAlign);
+ }
+
+
+ // if( text::HoriOrientation::CENTER && lWidth != (SwTwips)aWidthMF.GetSavedValue())
+ if(pTblData->GetWidth() != lWidth )
+ {
+ pTblData->SetWidthChanged();
+ pTblData->SetWidth(
+ nAlign == text::HoriOrientation::FULL ? pTblData->GetSpace() : lWidth );
+ }
+ if(pTblData->HasWidthChanged())
+ _pSet->Put(SwPtrItem(FN_TABLE_REP, pTblData));
+ }
+#ifdef DEBUG_TBLDLG
+DbgTblRep(pTblData)
+#endif
+ }
+ return TRUE;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Seite Spaltenkonfiguration
+------------------------------------------------------------------------*/
+SwTableColumnPage::SwTableColumnPage( Window* pParent,
+ const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SW_RES( TP_TABLE_COLUMN ), rSet ),
+ aModifyTableCB(this, SW_RES(CB_MOD_TBL)),
+ aProportionalCB(this, SW_RES(CB_PROP)),
+ aSpaceFT(this, SW_RES(FT_SPACE)),
+ aSpaceED(this, SW_RES(ED_SPACE)),
+
+ aUpBtn(this, SW_RES(COL_BTN_UP)),
+ aFT1(this, SW_RES(COL_FT_1)),
+ aMF1(this, SW_RES(COL_MF_1)),
+ aFT2(this, SW_RES(COL_FT_2)),
+ aMF2(this, SW_RES(COL_MF_2)),
+ aFT3(this, SW_RES(COL_FT_3)),
+ aMF3(this, SW_RES(COL_MF_3)),
+ aFT4(this, SW_RES(COL_FT_4)),
+ aMF4(this, SW_RES(COL_MF_4)),
+ aFT5(this, SW_RES(COL_FT_5)),
+ aMF5(this, SW_RES(COL_MF_5)),
+ aFT6(this, SW_RES(COL_FT_6)),
+ aMF6(this, SW_RES(COL_MF_6)),
+ aDownBtn(this, SW_RES(COL_BTN_DOWN)),
+ aColFL(this, SW_RES(COL_FL_LAYOUT)),
+
+ nTableWidth(0),
+ nMinWidth( MINLAY ),
+ nNoOfCols( 0 ),
+ nNoOfVisibleCols( 0 ),
+ bModified(FALSE),
+ bModifyTbl(FALSE),
+ bPercentMode(FALSE)
+{
+ FreeResource();
+ SetExchangeSupport();
+
+ pFieldArr[0] = &aMF1;
+ pFieldArr[1] = &aMF2;
+ pFieldArr[2] = &aMF3;
+ pFieldArr[3] = &aMF4;
+ pFieldArr[4] = &aMF5;
+ pFieldArr[5] = &aMF6;
+
+ pTextArr[0] = &aFT1;
+ pTextArr[1] = &aFT2;
+ pTextArr[2] = &aFT3;
+ pTextArr[3] = &aFT4;
+ pTextArr[4] = &aFT5;
+ pTextArr[5] = &aFT6;
+
+ const SfxPoolItem* pItem;
+ Init((SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, FALSE,&pItem )
+ && ((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON));
+
+};
+/*------------------------------------------------------------------------
+ Beschreibung: Seite Spaltenkonfiguration
+------------------------------------------------------------------------*/
+ SwTableColumnPage::~SwTableColumnPage()
+{
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+SfxTabPage* SwTableColumnPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SwTableColumnPage( pParent, rAttrSet );
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwTableColumnPage::Reset( const SfxItemSet& )
+{
+ const SfxItemSet& rSet = GetItemSet();
+
+ const SfxPoolItem* pItem;
+ if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP, FALSE, &pItem ))
+ {
+ pTblData = (SwTableRep*)((const SwPtrItem*) pItem)->GetValue();
+ nNoOfVisibleCols = pTblData->GetColCount();
+ nNoOfCols = pTblData->GetAllColCount();
+ nTableWidth = pTblData->GetAlign() != text::HoriOrientation::FULL &&
+ pTblData->GetAlign() != text::HoriOrientation::LEFT_AND_WIDTH?
+ pTblData->GetWidth() : pTblData->GetSpace();
+
+ USHORT i;
+ for( i = 0; i < nNoOfCols; i++ )
+ {
+ if( pTblData->GetColumns()[i].nWidth < nMinWidth )
+ nMinWidth = pTblData->GetColumns()[i].nWidth;
+ }
+ sal_Int64 nMinTwips = pFieldArr[0]->NormalizePercent( nMinWidth );
+ sal_Int64 nMaxTwips = pFieldArr[0]->NormalizePercent( nTableWidth );
+ for( i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ )
+ {
+ pFieldArr[i]->SetPrcntValue( pFieldArr[i]->NormalizePercent(
+ GetVisibleWidth(i) ), FUNIT_TWIP );
+ pFieldArr[i]->SetMin( nMinTwips , FUNIT_TWIP );
+ pFieldArr[i]->SetMax( nMaxTwips , FUNIT_TWIP );
+ pFieldArr[i]->Enable();
+ pTextArr[i]->Enable();
+ }
+
+ if( nNoOfVisibleCols > MET_FIELDS )
+ aUpBtn.Enable();
+ i = nNoOfVisibleCols;
+ while( i < MET_FIELDS )
+ {
+ pFieldArr[i]->SetText( aEmptyStr );
+ pTextArr[i]->Hide();
+ i++;
+ }
+ }
+ ActivatePage(rSet);
+
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwTableColumnPage::Init(BOOL bWeb)
+{
+ FieldUnit aMetric = ::GetDfltMetric(bWeb);
+ Link aLkUp = LINK( this, SwTableColumnPage, UpHdl );
+ Link aLkDown = LINK( this, SwTableColumnPage, DownHdl );
+ Link aLkLF = LINK( this, SwTableColumnPage, LoseFocusHdl );
+ for( USHORT i = 0; i < MET_FIELDS; i++ )
+ {
+ aValueTbl[i] = i;
+ SetMetric(*pFieldArr[i], aMetric);
+ pFieldArr[i]->SetUpHdl( aLkUp );
+ pFieldArr[i]->SetDownHdl( aLkDown );
+ pFieldArr[i]->SetLoseFocusHdl( aLkLF );
+
+ }
+ SetMetric(aSpaceED, aMetric);
+
+ Link aLk = LINK( this, SwTableColumnPage, AutoClickHdl );
+ aUpBtn.SetClickHdl( aLk );
+ aDownBtn.SetClickHdl( aLk );
+
+ aLk = LINK( this, SwTableColumnPage, ModeHdl );
+ aModifyTableCB .SetClickHdl( aLk );
+ aProportionalCB.SetClickHdl( aLk );
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+IMPL_LINK( SwTableColumnPage, AutoClickHdl, CheckBox *, pBox )
+{
+ //Anzeigefenster verschieben
+ if(pBox == (CheckBox *)&aDownBtn)
+ {
+ if(aValueTbl[0] > 0)
+ {
+ for( USHORT i=0; i < MET_FIELDS; i++ )
+ aValueTbl[i] -= 1;
+ }
+ }
+ if(pBox == (CheckBox *)&aUpBtn)
+ {
+ if( aValueTbl[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 )
+ {
+ for(USHORT i=0;i < MET_FIELDS;i++)
+ aValueTbl[i] += 1;
+ }
+ }
+ for( USHORT i = 0; (i < nNoOfVisibleCols ) && ( i < MET_FIELDS); i++ )
+ {
+ String sEntry('~');
+ sEntry += String::CreateFromInt32( aValueTbl[i] + 1 );
+ pTextArr[i]->SetText( sEntry );
+ }
+
+ aDownBtn.Enable(aValueTbl[0] > 0);
+ aUpBtn.Enable(aValueTbl[ MET_FIELDS -1 ] < nNoOfVisibleCols -1 );
+ UpdateCols(0);
+ return 0;
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+IMPL_LINK_INLINE_START( SwTableColumnPage, UpHdl, PercentField *, pEdit )
+{
+ bModified = TRUE;
+ ModifyHdl( pEdit );
+ return 0;
+};
+IMPL_LINK_INLINE_END( SwTableColumnPage, UpHdl, PercentField *, pEdit )
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+IMPL_LINK_INLINE_START( SwTableColumnPage, DownHdl, PercentField *, pEdit )
+{
+ bModified = TRUE;
+ ModifyHdl( pEdit );
+ return 0;
+};
+IMPL_LINK_INLINE_END( SwTableColumnPage, DownHdl, PercentField *, pEdit )
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+IMPL_LINK_INLINE_START( SwTableColumnPage, LoseFocusHdl, PercentField *, pEdit )
+{
+ if(pEdit->IsModified())
+ {
+ bModified = TRUE;
+ ModifyHdl( pEdit );
+ }
+ return 0;
+};
+IMPL_LINK_INLINE_END( SwTableColumnPage, LoseFocusHdl, PercentField *, pEdit )
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+IMPL_LINK( SwTableColumnPage, ModeHdl, CheckBox*, pBox )
+{
+ BOOL bCheck = pBox->IsChecked();
+ if(pBox == &aProportionalCB)
+ {
+ if(bCheck)
+ aModifyTableCB.Check();
+ aModifyTableCB.Enable(!bCheck && bModifyTbl);
+ }
+ return 0;
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+BOOL SwTableColumnPage::FillItemSet( SfxItemSet& )
+{
+ for( USHORT i = 0; i < MET_FIELDS; i++ )
+ {
+ if(pFieldArr[i]->HasFocus())
+ {
+ LoseFocusHdl(pFieldArr[i]);
+ break;
+ }
+ }
+
+ if(bModified)
+ {
+ pTblData->SetColsChanged();
+ }
+ return bModified;
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwTableColumnPage::ModifyHdl( PercentField* pEdit )
+{
+ USHORT nAktPos;
+ USHORT i;
+
+ for( i = 0; i < MET_FIELDS; i++)
+ if(pEdit == pFieldArr[i])
+ break;
+
+ SetVisibleWidth(aValueTbl[i], static_cast< SwTwips >(pEdit->DenormalizePercent(pEdit->GetValue( FUNIT_TWIP ))) );
+ nAktPos = aValueTbl[i];
+
+ UpdateCols( nAktPos );
+};
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwTableColumnPage::UpdateCols( USHORT nAktPos )
+{
+ SwTwips nSum = 0;
+ USHORT i;
+
+ for( i = 0; i < nNoOfCols; i++ )
+ {
+ nSum += (pTblData->GetColumns())[i].nWidth;
+ }
+ SwTwips nDiff = nSum - nTableWidth;
+
+ BOOL bModifyTable = aModifyTableCB.IsChecked();
+ BOOL bProp = aProportionalCB.IsChecked();
+
+ if(!bModifyTable && !bProp )
+ {
+// Tabellenbreite bleibt, Differenz wird mit der/den
+// naechsten Zellen ausgeglichen
+ while( nDiff )
+ {
+ if( ++nAktPos == nNoOfVisibleCols)
+ nAktPos = 0;
+ if( nDiff < 0 )
+ {
+ SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff);
+ nDiff = 0;
+ }
+ else if( GetVisibleWidth(nAktPos) >= nDiff + nMinWidth )
+ {
+ SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff);
+ nDiff = 0;
+ }
+ if( nDiff > 0 && GetVisibleWidth(nAktPos) > nMinWidth )
+ {
+ if( nDiff >= (GetVisibleWidth(nAktPos) - nMinWidth) )
+ {
+ nDiff -= (GetVisibleWidth(nAktPos) - nMinWidth);
+ SetVisibleWidth(nAktPos, nMinWidth);
+ }
+ else
+ {
+ nDiff = 0;
+ SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) -nDiff);
+ }
+ DBG_ASSERT(nDiff >= 0, "nDiff < 0 kann hier nicht sein!");
+ }
+ }
+ }
+ else if(bModifyTable && !bProp)
+ {
+// Differenz wird ueber die Tabellenbreite ausgeglichen,
+// andere Spalten bleiben unveraendert
+ DBG_ASSERT(nDiff <= pTblData->GetSpace() - nTableWidth, "Maximum falsch eingestellt" );
+ SwTwips nActSpace = pTblData->GetSpace() - nTableWidth;
+ if(nDiff > nActSpace)
+ {
+ nTableWidth = pTblData->GetSpace();
+ SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) - nDiff + nActSpace );
+ }
+ else
+ {
+ nTableWidth += nDiff;
+ }
+ }
+ else if(bModifyTable & bProp)
+ {
+// Alle Spalten werden proportional mitveraendert, die Tabellenbreite wird
+// entsprechend angepasst
+ DBG_ASSERT(nDiff * nNoOfVisibleCols <= pTblData->GetSpace() - nTableWidth, "Maximum falsch eingestellt" );
+ long nAdd = nDiff;
+ if(nDiff * nNoOfVisibleCols > pTblData->GetSpace() - nTableWidth)
+ {
+ nAdd = (pTblData->GetSpace() - nTableWidth) / nNoOfVisibleCols;
+ SetVisibleWidth(nAktPos, GetVisibleWidth(nAktPos) - nDiff + nAdd );
+ nDiff = nAdd;
+ }
+ if(nAdd)
+ for(i = 0; i < nNoOfVisibleCols; i++ )
+ {
+ if(i == nAktPos)
+ continue;
+ SwTwips nVisWidth;
+ if((nVisWidth = GetVisibleWidth(i)) + nDiff < MINLAY)
+ {
+ nAdd += nVisWidth - MINLAY;
+ SetVisibleWidth(i, MINLAY);
+ }
+ else
+ {
+ SetVisibleWidth(i, nVisWidth + nDiff);
+ nAdd += nDiff;
+ }
+
+ }
+ nTableWidth += nAdd;
+
+ }
+ else
+ {
+// Die Differenz wird gleichmaessig auf alle anderen Spalten aufgeteilt
+// die Tabellenbreite bleibt konstant
+/*
+ SwTwips nDiffn = nDiff/(nNoOfVisibleCols - 1);
+ if(nDiff < 0 && (nNoOfVisibleCols - 1) * nDiffn != nDiff)
+ nDiffn-- ;
+ USHORT nStart = nAktPos++;
+ if(nAktPos == nNoOfVisibleCols)
+ nStart = 0;
+ for(USHORT i = 0; i < nNoOfVisibleCols; i++ )
+ {
+ if((nVisWidth = GetVisibleWidth(i)) + nDiff < MINLAY)
+ {
+ nAdd += nVisWidth - MINLAY;
+ SetVisibleWidth(i, MINLAY);
+ }
+ }
+*/
+
+ }
+
+#ifdef DEBUG_TBLDLG
+DbgTblRep(pTblData)
+#endif
+
+ if(!bPercentMode)
+ aSpaceED.SetValue(aSpaceED.Normalize( pTblData->GetSpace() - nTableWidth) , FUNIT_TWIP);
+
+ for( i = 0; ( i < nNoOfVisibleCols ) && ( i < MET_FIELDS ); i++)
+ {
+ pFieldArr[i]->SetPrcntValue(pFieldArr[i]->NormalizePercent(
+ GetVisibleWidth(aValueTbl[i]) ), FUNIT_TWIP);
+ pFieldArr[i]->ClearModifyFlag();
+ }
+
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwTableColumnPage::ActivatePage( const SfxItemSet& )
+{
+ bPercentMode = pTblData->GetWidthPercent() != 0;
+ for( USHORT i = 0; (i < MET_FIELDS) && (i < nNoOfVisibleCols); i++ )
+ {
+ pFieldArr[i]->SetRefValue(pTblData->GetWidth());
+ pFieldArr[i]->ShowPercent( bPercentMode );
+ }
+
+ USHORT nTblAlign = pTblData->GetAlign();
+ if((text::HoriOrientation::FULL != nTblAlign && nTableWidth != pTblData->GetWidth()) ||
+ (text::HoriOrientation::FULL == nTblAlign && nTableWidth != pTblData->GetSpace()))
+ {
+ nTableWidth = text::HoriOrientation::FULL == nTblAlign ?
+ pTblData->GetSpace() :
+ pTblData->GetWidth();
+ UpdateCols(0);
+ }
+ bModifyTbl = TRUE;
+ if(pTblData->GetWidthPercent() ||
+ text::HoriOrientation::FULL == nTblAlign ||
+ pTblData->IsLineSelected() )
+ bModifyTbl = FALSE;
+ if(bPercentMode)
+ {
+ aModifyTableCB .Check(FALSE);
+ aProportionalCB .Check(FALSE);
+ }
+ else if( !bModifyTbl )
+ {
+ aProportionalCB.Check(FALSE);
+ aModifyTableCB.Check(FALSE);
+ }
+ aSpaceFT.Enable(!bPercentMode);
+ aSpaceED.Enable(!bPercentMode);
+ aModifyTableCB.Enable( !bPercentMode && bModifyTbl );
+ aProportionalCB.Enable(!bPercentMode && bModifyTbl );
+
+/* if(pTblData->IsLineSelected() && pTblData->IsComplex())
+ {
+
+ }*/
+ aSpaceED.SetValue(aSpaceED.Normalize(
+ pTblData->GetSpace() - nTableWidth) , FUNIT_TWIP);
+
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+int SwTableColumnPage::DeactivatePage( SfxItemSet* _pSet )
+{
+ if(_pSet)
+ {
+ FillItemSet(*_pSet);
+ if(text::HoriOrientation::FULL != pTblData->GetAlign() && pTblData->GetWidth() != nTableWidth)
+ {
+ pTblData->SetWidth(nTableWidth);
+ SwTwips nDiff = pTblData->GetSpace() - pTblData->GetWidth() -
+ pTblData->GetLeftSpace() - pTblData->GetRightSpace();
+ switch( pTblData->GetAlign() )
+ {
+ case text::HoriOrientation::RIGHT:
+ pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff);
+ break;
+ case text::HoriOrientation::LEFT:
+ pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff);
+ break;
+ case text::HoriOrientation::NONE:
+ {
+ SwTwips nDiff2 = nDiff/2;
+ if( nDiff > 0 ||
+ (-nDiff2 < pTblData->GetRightSpace() && - nDiff2 < pTblData->GetLeftSpace()))
+ {
+ pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff2);
+ pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff2);
+ }
+ else
+ {
+ if(pTblData->GetRightSpace() > pTblData->GetLeftSpace())
+ {
+ pTblData->SetLeftSpace(0);
+ pTblData->SetRightSpace(pTblData->GetSpace() - pTblData->GetWidth());
+ }
+ else
+ {
+ pTblData->SetRightSpace(0);
+ pTblData->SetLeftSpace(pTblData->GetSpace() - pTblData->GetWidth());
+ }
+ }
+ }
+ break;
+ case text::HoriOrientation::CENTER:
+ pTblData->SetRightSpace(pTblData->GetRightSpace() + nDiff/2);
+ pTblData->SetLeftSpace(pTblData->GetLeftSpace() + nDiff/2);
+ break;
+ case text::HoriOrientation::LEFT_AND_WIDTH :
+ if(nDiff > pTblData->GetRightSpace())
+ {
+ pTblData->SetLeftSpace(pTblData->GetSpace() - pTblData->GetWidth());
+ }
+ pTblData->SetRightSpace(
+ pTblData->GetSpace() - pTblData->GetWidth() - pTblData->GetLeftSpace());
+ break;
+ }
+ pTblData->SetWidthChanged();
+ }
+#ifdef DEBUG_TBLDLG
+DbgTblRep(pTblData)
+#endif
+ _pSet->Put(SwPtrItem( FN_TABLE_REP, pTblData ));
+ }
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+SwTwips SwTableColumnPage::GetVisibleWidth(USHORT nPos)
+{
+ USHORT i=0;
+
+ while( nPos )
+ {
+ if(pTblData->GetColumns()[i].bVisible && nPos)
+ nPos--;
+ i++;
+ }
+ SwTwips nReturn = pTblData->GetColumns()[i].nWidth;
+ DBG_ASSERT(i < nNoOfCols, "Array index out of range");
+ while(!pTblData->GetColumns()[i].bVisible && (i + 1) < nNoOfCols)
+ nReturn += pTblData->GetColumns()[++i].nWidth;
+
+// return (*ppTableColumns)[i].nWidth;
+ return nReturn;
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwTableColumnPage::SetVisibleWidth(USHORT nPos, SwTwips nNewWidth)
+{
+ USHORT i=0;
+ while( nPos )
+ {
+ if(pTblData->GetColumns()[i].bVisible && nPos)
+ nPos--;
+ i++;
+ }
+ DBG_ASSERT(i < nNoOfCols, "Array index out of range");
+ pTblData->GetColumns()[i].nWidth = nNewWidth;
+ while(!pTblData->GetColumns()[i].bVisible && (i + 1) < nNoOfCols)
+ pTblData->GetColumns()[++i].nWidth = 0;
+
+}
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+SwTableTabDlg::SwTableTabDlg(Window* pParent, SfxItemPool& ,
+ const SfxItemSet* pItemSet, SwWrtShell* pSh ) :
+ SfxTabDialog(pParent, SW_RES(DLG_FORMAT_TABLE), pItemSet,0),
+ pShell(pSh),
+ nHtmlMode(::GetHtmlMode(pSh->GetView().GetDocShell()))
+{
+ FreeResource();
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AddTabPage(TP_FORMAT_TABLE, &SwFormatTablePage::Create, 0 );
+ AddTabPage(TP_TABLE_TEXTFLOW, &SwTextFlowPage::Create, 0 );
+ AddTabPage(TP_TABLE_COLUMN, &SwTableColumnPage::Create, 0 );
+ AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
+ AddTabPage(TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 );
+}
+
+
+/*------------------------------------------------------------------------
+------------------------------------------------------------------------*/
+void SwTableTabDlg::PageCreated(USHORT nId, SfxTabPage& rPage)
+{
+ SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
+ if( TP_BACKGROUND == nId )
+ {
+ sal_Int32 nFlagType = SVX_SHOW_TBLCTL;
+ if(!( nHtmlMode & HTMLMODE_ON ) ||
+ nHtmlMode & HTMLMODE_SOME_STYLES)
+ nFlagType |= SVX_SHOW_SELECTOR;
+ aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType));
+ rPage.PageCreated(aSet);
+ }
+ else if(TP_BORDER == nId)
+ {
+ aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_TABLE));
+ rPage.PageCreated(aSet);
+ }
+ else if(TP_TABLE_TEXTFLOW == nId)
+ {
+ ((SwTextFlowPage&)rPage).SetShell(pShell);
+ const USHORT eType = pShell->GetFrmType(0,TRUE);
+ if( !(FRMTYPE_BODY & eType) )
+ ((SwTextFlowPage&)rPage).DisablePageBreak();
+ }
+}
+
+/*-----------------12.12.96 12.22-------------------
+--------------------------------------------------*/
+SwTextFlowPage::SwTextFlowPage( Window* pParent,
+ const SfxItemSet& rSet ) :
+ SfxTabPage(pParent, SW_RES( TP_TABLE_TEXTFLOW ), rSet ),
+ aFlowFL (this, SW_RES(FL_FLOW )),
+ aPgBrkCB (this, SW_RES(CB_PAGEBREAK )),
+ aPgBrkRB (this, SW_RES(RB_BREAKPAGE )),
+ aColBrkRB (this, SW_RES(RB_BREAKCOLUMN )),
+ aPgBrkBeforeRB (this, SW_RES(RB_PAGEBREAKBEFORE)),
+ aPgBrkAfterRB (this, SW_RES(RB_PAGEBREAKAFTER )),
+ aPageCollCB (this, SW_RES(CB_PAGECOLL )),
+ aPageCollLB (this, SW_RES(LB_PAGECOLL )),
+ aPageNoFT (this, SW_RES(FT_PAGENUM )),
+ aPageNoNF (this, SW_RES(NF_PAGENUM )),
+ aSplitCB (this, SW_RES(CB_SPLIT )),
+ aSplitRowCB (this, SW_RES(CB_SPLIT_ROW )),
+ aKeepCB (this, SW_RES(CB_KEEP )),
+ aHeadLineCB (this, SW_RES(CB_HEADLINE )),
+ aRepeatHeaderFT (this, SW_RES(FT_REPEAT_HEADER )),
+ aRepeatHeaderBeforeFT (this),
+ aRepeatHeaderNF (this, SW_RES(NF_REPEAT_HEADER )),
+ aRepeatHeaderAfterFT (this),
+ aRepeatHeaderCombo (this, SW_RES(WIN_REPEAT_HEADER), aRepeatHeaderNF, aRepeatHeaderBeforeFT, aRepeatHeaderAfterFT),
+ aTextDirectionFT(this, SW_RES(FT_TEXTDIRECTION )),
+ aTextDirectionLB(this, SW_RES(LB_TEXTDIRECTION )),
+
+ aVertOrientFL (this, SW_RES(FL_VERT_ORIENT )),
+ aVertOrientFT(this, SW_RES(FT_VERTORIENT )),
+ aVertOrientLB(this, SW_RES(LB_VERTORIENT )),
+
+ pShell(0),
+
+ bPageBreak(TRUE),
+ bHtmlMode(FALSE)
+{
+ FreeResource();
+
+ aPgBrkCB.SetClickHdl(LINK(this, SwTextFlowPage, PageBreakHdl_Impl));
+ aPgBrkBeforeRB.SetClickHdl(
+ LINK( this, SwTextFlowPage, PageBreakPosHdl_Impl ) );
+ aPgBrkAfterRB.SetClickHdl(
+ LINK( this, SwTextFlowPage, PageBreakPosHdl_Impl ) );
+ aPageCollCB.SetClickHdl(
+ LINK( this, SwTextFlowPage, ApplyCollClickHdl_Impl ) );
+ aColBrkRB.SetClickHdl(
+ LINK( this, SwTextFlowPage, PageBreakTypeHdl_Impl ) );
+ aPgBrkRB.SetClickHdl(
+ LINK( this, SwTextFlowPage, PageBreakTypeHdl_Impl ) );
+ aSplitCB.SetClickHdl(
+ LINK( this, SwTextFlowPage, SplitHdl_Impl));
+ aSplitRowCB.SetClickHdl(
+ LINK( this, SwTextFlowPage, SplitRowHdl_Impl));
+ aHeadLineCB.SetClickHdl( LINK( this, SwTextFlowPage, HeadLineCBClickHdl ) );
+
+#ifndef SW_FILEFORMAT_40
+ const SfxPoolItem *pItem;
+ if(SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, FALSE,&pItem )
+ && ((const SfxUInt16Item*)pItem)->GetValue() & HTMLMODE_ON)
+#endif
+ {
+ aKeepCB.Hide();
+ aSplitCB.Hide();
+ aSplitRowCB.Hide();
+ }
+
+ aRepeatHeaderCombo.Arrange( aRepeatHeaderFT );
+
+ HeadLineCBClickHdl();
+}
+
+/*-----------------12.12.96 12.22-------------------
+--------------------------------------------------*/
+ SwTextFlowPage::~SwTextFlowPage()
+{
+}
+
+/*-----------------12.12.96 12.22-------------------
+--------------------------------------------------*/
+SfxTabPage* SwTextFlowPage::Create( Window* pParent,
+ const SfxItemSet& rAttrSet)
+{
+ return new SwTextFlowPage(pParent, rAttrSet);
+}
+
+/*-----------------12.12.96 12.22-------------------
+--------------------------------------------------*/
+BOOL SwTextFlowPage::FillItemSet( SfxItemSet& rSet )
+{
+ BOOL bModified = FALSE;
+
+ //Ueberschrift wiederholen
+ if(aHeadLineCB.IsChecked() != aHeadLineCB.GetSavedValue() ||
+ String::CreateFromInt32( static_cast< INT32 >(aRepeatHeaderNF.GetValue()) ) != aRepeatHeaderNF.GetSavedValue() )
+ {
+ bModified |= 0 != rSet.Put(
+ SfxUInt16Item(FN_PARAM_TABLE_HEADLINE, aHeadLineCB.IsChecked()? USHORT(aRepeatHeaderNF.GetValue()) : 0 ));
+ }
+ if(aKeepCB.IsChecked() != aKeepCB.GetSavedValue())
+ bModified |= 0 != rSet.Put( SvxFmtKeepItem( aKeepCB.IsChecked(), RES_KEEP));
+
+ if(aSplitCB.IsChecked() != aSplitCB.GetSavedValue())
+ bModified |= 0 != rSet.Put( SwFmtLayoutSplit( aSplitCB.IsChecked()));
+
+ if(aSplitRowCB.IsChecked() != aSplitRowCB.GetSavedValue())
+ bModified |= 0 != rSet.Put( SwFmtRowSplit( aSplitRowCB.IsChecked()));
+
+
+ const SvxFmtBreakItem* pBreak = (const SvxFmtBreakItem*)GetOldItem( rSet, RES_BREAK );
+ const SwFmtPageDesc* pDesc = (const SwFmtPageDesc*) GetOldItem( rSet, RES_PAGEDESC );
+
+
+ BOOL bState = aPageCollCB.IsChecked();
+
+ //Wenn Seitenvorlage, dann kein Break
+ BOOL bPageItemPut = FALSE;
+ if ( bState != aPageCollCB.GetSavedValue() ||
+ ( bState &&
+ aPageCollLB.GetSelectEntryPos() != aPageCollLB.GetSavedValue() )
+ || (aPageNoNF.IsEnabled() && aPageNoNF.IsValueModified()) )
+ {
+ String sPage;
+
+ if ( bState )
+ {
+ sPage = aPageCollLB.GetSelectEntry();
+ }
+ USHORT nPgNum = static_cast< USHORT >(aPageNoNF.GetValue());
+ if ( !pDesc || !pDesc->GetPageDesc() ||
+ ( pDesc->GetPageDesc() && ((pDesc->GetPageDesc()->GetName() != sPage) ||
+ aPageNoNF.GetSavedValue() != (String)nPgNum)))
+ {
+ SwFmtPageDesc aFmt( pShell->FindPageDescByName( sPage, TRUE ) );
+ aFmt.SetNumOffset(bState ? nPgNum : 0);
+ bModified |= 0 != rSet.Put( aFmt );
+ bPageItemPut = bState;
+ }
+ }
+ BOOL bIsChecked = aPgBrkCB.IsChecked();
+ if ( !bPageItemPut &&
+ ( bState != aPageCollCB.GetSavedValue() ||
+ bIsChecked != aPgBrkCB.GetSavedValue() ||
+ aPgBrkBeforeRB.IsChecked() != aPgBrkBeforeRB.GetSavedValue() ||
+ aPgBrkRB.IsChecked() != aPgBrkRB.GetSavedValue() ))
+ {
+ SvxFmtBreakItem aBreak(
+ (const SvxFmtBreakItem&)GetItemSet().Get( RES_BREAK ) );
+
+ if(bIsChecked)
+ {
+ BOOL bBefore = aPgBrkBeforeRB.IsChecked();
+
+ if ( aPgBrkRB.IsChecked() )
+ {
+ if ( bBefore )
+ aBreak.SetValue( SVX_BREAK_PAGE_BEFORE );
+ else
+ aBreak.SetValue( SVX_BREAK_PAGE_AFTER );
+ }
+ else
+ {
+ if ( bBefore )
+ aBreak.SetValue( SVX_BREAK_COLUMN_BEFORE );
+ else
+ aBreak.SetValue( SVX_BREAK_COLUMN_AFTER );
+ }
+ }
+ else
+ {
+ aBreak.SetValue( SVX_BREAK_NONE );
+ }
+
+ if ( !pBreak || !( *(const SvxFmtBreakItem*)pBreak == aBreak ) )
+ {
+ bModified |= 0 != rSet.Put( aBreak );
+ }
+ }
+
+ if(aTextDirectionLB.GetSelectEntryPos() != aTextDirectionLB.GetSavedValue())
+ {
+ bModified |= 0 != rSet.Put(
+ SvxFrameDirectionItem(
+ (SvxFrameDirection)(ULONG)aTextDirectionLB.GetEntryData(aTextDirectionLB.GetSelectEntryPos())
+ , FN_TABLE_BOX_TEXTDIRECTION));
+ }
+
+ if(aVertOrientLB.GetSelectEntryPos() != aVertOrientLB.GetSavedValue())
+ {
+ USHORT nOrient = USHRT_MAX;
+ switch(aVertOrientLB.GetSelectEntryPos())
+ {
+ case 0 : nOrient = text::VertOrientation::NONE; break;
+ case 1 : nOrient = text::VertOrientation::CENTER; break;
+ case 2 : nOrient = text::VertOrientation::BOTTOM; break;
+ }
+ if(nOrient != USHRT_MAX)
+ bModified |= 0 != rSet.Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, nOrient));
+ }
+
+ return bModified;
+
+}
+
+/*-----------------12.12.96 12.22-------------------
+--------------------------------------------------*/
+void SwTextFlowPage::Reset( const SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem;
+ SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get();
+ BOOL bFlowAllowed = !bHtmlMode || pHtmlOpt->IsPrintLayoutExtension();
+ if(bFlowAllowed)
+ {
+ // Einfuegen der vorhandenen Seitenvorlagen in die Listbox
+ const USHORT nCount = pShell->GetPageDescCnt();
+ USHORT i;
+
+ for( i = 0; i < nCount; ++i)
+ {
+ const SwPageDesc &rPageDesc = pShell->GetPageDesc(i);
+ aPageCollLB.InsertEntry(rPageDesc.GetName());
+ }
+
+ String aFmtName;
+ for(i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i)
+ if( LISTBOX_ENTRY_NOTFOUND == aPageCollLB.GetEntryPos(
+ aFmtName = SwStyleNameMapper::GetUIName( i, aFmtName ) ))
+ aPageCollLB.InsertEntry( aFmtName );
+
+ if(SFX_ITEM_SET == rSet.GetItemState( RES_KEEP, FALSE, &pItem ))
+ {
+ aKeepCB.Check( ((const SvxFmtKeepItem*)pItem)->GetValue() );
+ aKeepCB.SaveValue();
+ }
+ if(SFX_ITEM_SET == rSet.GetItemState( RES_LAYOUT_SPLIT, FALSE, &pItem ))
+ {
+ aSplitCB.Check( ((const SwFmtLayoutSplit*)pItem)->GetValue() );
+ }
+ else
+ aSplitCB.Check();
+
+ aSplitCB.SaveValue();
+ SplitHdl_Impl(&aSplitCB);
+
+ if(SFX_ITEM_SET == rSet.GetItemState( RES_ROW_SPLIT, FALSE, &pItem ))
+ {
+ aSplitRowCB.Check( ((const SwFmtRowSplit*)pItem)->GetValue() );
+ }
+ else
+ aSplitRowCB.SetState(STATE_DONTKNOW);
+ aSplitRowCB.SaveValue();
+
+ if(bPageBreak)
+ {
+ if(SFX_ITEM_SET == rSet.GetItemState( RES_PAGEDESC, FALSE, &pItem ))
+ {
+ String sPageDesc;
+ const SwPageDesc* pDesc = ((const SwFmtPageDesc*)pItem)->GetPageDesc();
+ aPageNoNF.SetValue(((const SwFmtPageDesc*)pItem)->GetNumOffset());
+ if(pDesc)
+ sPageDesc = pDesc->GetName();
+ if ( sPageDesc.Len() &&
+ aPageCollLB.GetEntryPos( sPageDesc ) != LISTBOX_ENTRY_NOTFOUND )
+ {
+ aPageCollLB.SelectEntry( sPageDesc );
+ aPageCollCB.Check();
+
+ aPgBrkCB.Enable();
+ aPgBrkRB.Enable();
+ aColBrkRB.Enable();
+ aPgBrkBeforeRB.Enable();
+ aPgBrkAfterRB.Enable();
+ aPageCollCB.Enable();
+ aPgBrkCB.Check();
+
+ aPgBrkCB.Check( TRUE );
+ aColBrkRB.Check( FALSE );
+ aPgBrkBeforeRB.Check( TRUE );
+ aPgBrkAfterRB.Check( FALSE );
+ }
+ else
+ {
+ aPageCollLB.SetNoSelection();
+ aPageCollCB.Check(FALSE);
+ }
+ }
+
+ if(SFX_ITEM_SET == rSet.GetItemState( RES_BREAK, FALSE, &pItem ))
+ {
+ const SvxFmtBreakItem* pPageBreak = (const SvxFmtBreakItem*)pItem;
+ SvxBreak eBreak = (SvxBreak)pPageBreak->GetValue();
+
+ if ( eBreak != SVX_BREAK_NONE )
+ {
+ aPgBrkCB.Check();
+ aPageCollCB.Enable(FALSE);
+ aPageCollLB.Enable(FALSE);
+ aPageNoFT.Enable(FALSE);
+ aPageNoNF.Enable(FALSE);
+ }
+ switch ( eBreak )
+ {
+ case SVX_BREAK_PAGE_BEFORE:
+ aPgBrkRB.Check( TRUE );
+ aColBrkRB.Check( FALSE );
+ aPgBrkBeforeRB.Check( TRUE );
+ aPgBrkAfterRB.Check( FALSE );
+ break;
+ case SVX_BREAK_PAGE_AFTER:
+ aPgBrkRB.Check( TRUE );
+ aColBrkRB.Check( FALSE );
+ aPgBrkBeforeRB.Check( FALSE );
+ aPgBrkAfterRB.Check( TRUE );
+ break;
+ case SVX_BREAK_COLUMN_BEFORE:
+ aPgBrkRB.Check( FALSE );
+ aColBrkRB.Check( TRUE );
+ aPgBrkBeforeRB.Check( TRUE );
+ aPgBrkAfterRB.Check( FALSE );
+ break;
+ case SVX_BREAK_COLUMN_AFTER:
+ aPgBrkRB.Check( FALSE );
+ aColBrkRB.Check( TRUE );
+ aPgBrkBeforeRB.Check( FALSE );
+ aPgBrkAfterRB.Check( TRUE );
+ break;
+ default:; //prevent warning
+ }
+
+ }
+ if ( aPgBrkBeforeRB.IsChecked() )
+ PageBreakPosHdl_Impl( &aPgBrkBeforeRB );
+ else if ( aPgBrkAfterRB.IsChecked() )
+ PageBreakPosHdl_Impl( &aPgBrkAfterRB );
+ PageBreakHdl_Impl( &aPgBrkCB );
+ }
+ }
+ else
+ {
+ aPgBrkRB.Enable(FALSE);
+ aColBrkRB.Enable(FALSE);
+ aPgBrkBeforeRB.Enable(FALSE);
+ aPgBrkAfterRB.Enable(FALSE);
+ aKeepCB .Enable(FALSE);
+ aSplitCB.Enable(FALSE);
+ aPgBrkCB.Enable(FALSE);
+ aPageCollCB.Enable(FALSE);
+ aPageCollLB.Enable(FALSE);
+ }
+
+ if(SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, FALSE, &pItem ))
+ {
+ USHORT nRep = ((const SfxUInt16Item*)pItem)->GetValue();
+ aHeadLineCB.Check( nRep > 0 );
+ aHeadLineCB.SaveValue();
+ aRepeatHeaderNF.SetValue( nRep );
+ aRepeatHeaderNF.SaveValue();
+ }
+ if ( rSet.GetItemState(FN_TABLE_BOX_TEXTDIRECTION) > SFX_ITEM_AVAILABLE )
+ {
+ ULONG nDirection = ((const SvxFrameDirectionItem&)rSet.Get(FN_TABLE_BOX_TEXTDIRECTION)).GetValue();
+ aTextDirectionLB.SelectEntryPos(aTextDirectionLB.GetEntryPos( (const void*)nDirection ));
+ }
+
+ if ( rSet.GetItemState(FN_TABLE_SET_VERT_ALIGN) > SFX_ITEM_AVAILABLE )
+ {
+ USHORT nVert = ((const SfxUInt16Item&)rSet.Get(FN_TABLE_SET_VERT_ALIGN)).GetValue();
+ USHORT nPos = 0;
+ switch(nVert)
+ {
+ case text::VertOrientation::NONE: nPos = 0; break;
+ case text::VertOrientation::CENTER: nPos = 1; break;
+ case text::VertOrientation::BOTTOM: nPos = 2; break;
+ }
+ aVertOrientLB.SelectEntryPos(nPos);
+ }
+
+ aPageCollCB.SaveValue();
+ aPageCollLB.SaveValue();
+ aPgBrkCB.SaveValue();
+ aPgBrkRB.SaveValue();
+ aColBrkRB.SaveValue();
+ aPgBrkBeforeRB.SaveValue();
+ aPgBrkAfterRB.SaveValue();
+ aPageNoNF.SaveValue();
+ aTextDirectionLB.SaveValue();
+ aVertOrientLB.SaveValue();
+
+ HeadLineCBClickHdl();
+}
+/*-----------------16.04.98 14:48-------------------
+
+--------------------------------------------------*/
+
+void SwTextFlowPage::SetShell(SwWrtShell* pSh)
+{
+ pShell = pSh;
+ bHtmlMode = 0 != (::GetHtmlMode(pShell->GetView().GetDocShell()) & HTMLMODE_ON);
+ if(bHtmlMode)
+ {
+ aPageNoNF.Enable(FALSE);
+ aPageNoFT.Enable(FALSE);
+ }
+}
+
+/*-----------------12.12.96 16.18-------------------
+--------------------------------------------------*/
+IMPL_LINK( SwTextFlowPage, PageBreakHdl_Impl, CheckBox*, EMPTYARG )
+{
+ if( aPgBrkCB.IsChecked() )
+ {
+ aPgBrkRB. Enable();
+ aColBrkRB. Enable();
+ aPgBrkBeforeRB. Enable();
+ aPgBrkAfterRB. Enable();
+
+ if ( aPgBrkRB.IsChecked() && aPgBrkBeforeRB.IsChecked() )
+ {
+ aPageCollCB.Enable();
+
+ BOOL bEnable = aPageCollCB.IsChecked() &&
+ aPageCollLB.GetEntryCount();
+ aPageCollLB.Enable(bEnable);
+ if(!bHtmlMode)
+ {
+ aPageNoFT.Enable(bEnable);
+ aPageNoNF.Enable(bEnable);
+ }
+ }
+ }
+ else
+ {
+ aPageCollCB.Check( FALSE );
+ aPageCollCB.Enable(FALSE);
+ aPageCollLB.Enable(FALSE);
+ aPageNoFT.Enable(FALSE);
+ aPageNoNF.Enable(FALSE);
+ aPgBrkRB. Enable(FALSE);
+ aColBrkRB. Enable(FALSE);
+ aPgBrkBeforeRB. Enable(FALSE);
+ aPgBrkAfterRB. Enable(FALSE);
+ }
+ return 0;
+}
+
+/*-----------------12.12.96 16.18-------------------
+--------------------------------------------------*/
+IMPL_LINK( SwTextFlowPage, ApplyCollClickHdl_Impl, CheckBox*, EMPTYARG )
+{
+ BOOL bEnable = FALSE;
+ if ( aPageCollCB.IsChecked() &&
+ aPageCollLB.GetEntryCount() )
+ {
+ bEnable = TRUE;
+ aPageCollLB.SelectEntryPos( 0 );
+ }
+ else
+ {
+ aPageCollLB.SetNoSelection();
+ }
+ aPageCollLB.Enable(bEnable);
+ if(!bHtmlMode)
+ {
+ aPageNoFT.Enable(bEnable);
+ aPageNoNF.Enable(bEnable);
+ }
+ return 0;
+}
+
+/*-----------------12.12.96 16.18-------------------
+--------------------------------------------------*/
+IMPL_LINK( SwTextFlowPage, PageBreakPosHdl_Impl, RadioButton*, pBtn )
+{
+ if ( aPgBrkCB.IsChecked() )
+ {
+ if ( pBtn == &aPgBrkBeforeRB && aPgBrkRB.IsChecked() )
+ {
+ aPageCollCB.Enable();
+
+ BOOL bEnable = aPageCollCB.IsChecked() &&
+ aPageCollLB.GetEntryCount();
+
+ aPageCollLB.Enable(bEnable);
+ if(!bHtmlMode)
+ {
+ aPageNoFT.Enable(bEnable);
+ aPageNoNF.Enable(bEnable);
+ }
+ }
+ else if ( pBtn == &aPgBrkAfterRB )
+ {
+ aPageCollCB .Check( FALSE );
+ aPageCollCB .Enable(FALSE);
+ aPageCollLB .Enable(FALSE);
+ aPageNoFT .Enable(FALSE);
+ aPageNoNF .Enable(FALSE);
+ }
+ }
+ return 0;
+}
+
+/*-----------------12.12.96 16.18-------------------
+--------------------------------------------------*/
+IMPL_LINK( SwTextFlowPage, PageBreakTypeHdl_Impl, RadioButton*, pBtn )
+{
+ if ( pBtn == &aColBrkRB || aPgBrkAfterRB.IsChecked() )
+ {
+ aPageCollCB .Check(FALSE);
+ aPageCollCB .Enable(FALSE);
+ aPageCollLB .Enable(FALSE);
+ aPageNoFT .Enable(FALSE);
+ aPageNoNF .Enable(FALSE);
+ }
+ else if ( aPgBrkBeforeRB.IsChecked() )
+ PageBreakPosHdl_Impl( &aPgBrkBeforeRB );
+ return 0;
+}
+/*-----------------17.11.2003 11:30-----------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwTextFlowPage, SplitHdl_Impl, CheckBox*, pBox )
+{
+ aSplitRowCB.Enable(pBox->IsChecked());
+ return 0;
+}
+/*-----------------17.11.2003 11:30-----------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwTextFlowPage, SplitRowHdl_Impl, TriStateBox*, pBox )
+{
+ pBox->EnableTriState(FALSE);
+ return 0;
+}
+
+IMPL_LINK( SwTextFlowPage, HeadLineCBClickHdl, void*, EMPTYARG )
+{
+ aRepeatHeaderCombo.Enable(aHeadLineCB.IsChecked());
+
+ return 0;
+}
+
+/*-----------------30.05.97 07:37-------------------
+
+--------------------------------------------------*/
+void SwTextFlowPage::DisablePageBreak()
+{
+ bPageBreak = FALSE;
+ aPgBrkCB .Disable();
+ aPgBrkRB .Disable();
+ aColBrkRB .Disable();
+ aPgBrkBeforeRB .Disable();
+ aPgBrkAfterRB .Disable();
+ aPageCollCB .Disable();
+ aPageCollLB .Disable();
+ aPageNoFT .Disable();
+ aPageNoNF .Disable();
+}
+
+
+
diff --git a/sw/source/ui/table/tabledlg.hrc b/sw/source/ui/table/tabledlg.hrc
new file mode 100644
index 000000000000..843bec591d9e
--- /dev/null
+++ b/sw/source/ui/table/tabledlg.hrc
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "globals.hrc"
+
+#define ED_WIDTH 1
+#define FL_WIDTH 3
+#define CB_REL_WIDTH 4
+#define RB_LEFT 10
+#define RB_RIGHT 11
+#define RB_CENTER 12
+#define RB_FREE 13
+#define RB_FULL 14
+#define FL_POS 15
+#define ED_LEFT_DIST 51
+#define ED_RIGHT_DIST 52
+#define FT_RIGHT_DIST 53
+#define FT_LEFT_DIST 54
+#define FT_TOP_DIST 20
+#define ED_TOP_DIST 21
+#define FT_BOTTOM_DIST 22
+#define ED_BOTTOM_DIST 23
+#define FL_DIST 24
+#define FT_WIDTH 25
+#define FT_SCOL 30
+#define DLB_SCOL 31
+#define FT_POS 32
+#define DLB_SPOS 33
+#define FT_SSZ 34
+#define ED_SSZ 36
+#define FL_SHADE 37
+#define CB_HEADLINE 40
+#define FT_REPEAT_HEADER 40
+#define NF_REPEAT_HEADER 40
+#define WIN_REPEAT_HEADER 40
+#define FL_HEADLINE 41
+#define FL_PROPERTIES 42
+#define FT_TEXTDIRECTION 43
+#define LB_TEXTDIRECTION 44
+
+#define BT_OK 100
+#define BT_CANCEL 101
+#define BT_MORE 102
+#define ED_NAME 103
+#define FT_NAME 104
+#define FL_OPTIONS 105
+#define FL_NAME 106
+#define COL_FT_1 107
+#define COL_MF_1 108
+#define COL_FT_2 109
+#define COL_MF_2 110
+#define COL_FT_3 111
+#define COL_MF_3 112
+#define COL_FT_4 113
+#define COL_MF_4 114
+#define COL_FT_5 115
+#define COL_MF_5 116
+#define COL_FT_6 117
+#define COL_MF_6 118
+#define COL_FL_LAYOUT 119
+#define COL_BTN_UP 120
+#define COL_BTN_DOWN 121
+#define CB_MOD_TBL 122
+#define CB_PROP 123
+
+#define FT_SPACE 125
+#define ED_SPACE 126
+
+#define FL_FLOW 130
+#define CB_PAGEBREAK 131
+#define RB_BREAKPAGE 132
+#define RB_BREAKCOLUMN 133
+#define RB_PAGEBREAKBEFORE 134
+#define RB_PAGEBREAKAFTER 135
+#define CB_PAGECOLL 136
+#define LB_PAGECOLL 137
+#define FT_PAGENUM 138
+#define NF_PAGENUM 139
+#define CB_KEEP 144
+#define CB_SPLIT 145
+#define CB_SPLIT_ROW 146
+
+#define FL_VERT_ORIENT 140
+#define RB_FROM_LEFT 144
+
+#define FT_VERTORIENT 150
+#define LB_VERTORIENT 151
diff --git a/sw/source/ui/table/tabledlg.src b/sw/source/ui/table/tabledlg.src
new file mode 100644
index 000000000000..79300699bd33
--- /dev/null
+++ b/sw/source/ui/table/tabledlg.src
@@ -0,0 +1,789 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "table.hrc"
+#include "tabledlg.hrc"
+#include "helpid.h"
+#define TEXT_TEXTFLOW \
+ Text [ en-US ] = "Text Flow" ; \
+
+/**************************************************************************/
+/* */
+/* */
+/* */
+/**************************************************************************/
+TabDialog DLG_FORMAT_TABLE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Text [ en-US ] = "Table Format" ;
+ Moveable = TRUE ;
+ TabControl 1
+ {
+ SVLook = TRUE ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_FORMAT_TABLE ;
+ Text [ en-US ] = "Table" ;
+ PageResID = TP_FORMAT_TABLE ;
+ };
+ PageItem
+ {
+ Identifier = TP_TABLE_TEXTFLOW ;
+ TEXT_TEXTFLOW
+ };
+ PageItem
+ {
+ Identifier = TP_TABLE_COLUMN ;
+ Text [ en-US ] = "Columns" ;
+ PageResID = TP_TABLE_COLUMN ;
+ };
+ PageItem
+ {
+ Identifier = TP_BORDER ;
+ Text [ en-US ] = "Borders" ;
+ PageResID = TP_BORDER ;
+ };
+ PageItem
+ {
+ Identifier = TP_BACKGROUND ;
+ Text [ en-US ] = "Background" ;
+ PageResID = TP_BACKGROUND ;
+ };
+ };
+ };
+};
+/**************************************************************************/
+/* */
+/* */
+/* */
+/**************************************************************************/
+TabPage TP_FORMAT_TABLE
+{
+ HelpID = HID_FORMAT_TABLE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ FixedText FT_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 16 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Text [ en-US ] = "~Name" ;
+ };
+ Edit ED_NAME
+ {
+ HelpID = "sw:Edit:TP_FORMAT_TABLE:ED_NAME";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 14 ) ;
+ Size = MAP_APPFONT ( 112 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_WIDTH
+ {
+ Pos = MAP_APPFONT ( 12 , 32 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "W~idth" ;
+ };
+ MetricField ED_WIDTH
+ {
+ HelpID = "sw:MetricField:TP_FORMAT_TABLE:ED_WIDTH";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 30 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Value = 0 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 5 ;
+ };
+ CheckBox CB_REL_WIDTH
+ {
+ HelpID = "sw:CheckBox:TP_FORMAT_TABLE:CB_REL_WIDTH";
+ Pos = MAP_APPFONT ( 118 , 32 ) ;
+ Size = MAP_APPFONT ( 69 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Relati~ve" ;
+ };
+ FixedLine FL_OPTIONS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 184 , 8 ) ;
+ Text [ en-US ] = "Properties" ;
+ };
+ RadioButton RB_FULL
+ {
+ HelpID = "sw:RadioButton:TP_FORMAT_TABLE:RB_FULL";
+ Pos = MAP_APPFONT ( 202 , 14 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "A~utomatic" ;
+ };
+ RadioButton RB_LEFT
+ {
+ HelpID = "sw:RadioButton:TP_FORMAT_TABLE:RB_LEFT";
+ Pos = MAP_APPFONT ( 202 , 28 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "~Left" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_FROM_LEFT
+ {
+ HelpID = "sw:RadioButton:TP_FORMAT_TABLE:RB_FROM_LEFT";
+ Pos = MAP_APPFONT ( 202 , 42 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~From left";
+ };
+ RadioButton RB_RIGHT
+ {
+ HelpID = "sw:RadioButton:TP_FORMAT_TABLE:RB_RIGHT";
+ Pos = MAP_APPFONT ( 202 , 56 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "R~ight" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_CENTER
+ {
+ HelpID = "sw:RadioButton:TP_FORMAT_TABLE:RB_CENTER";
+ Pos = MAP_APPFONT ( 202 , 70 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "~Center" ;
+ TabStop = TRUE ;
+ };
+ RadioButton RB_FREE
+ {
+ HelpID = "sw:RadioButton:TP_FORMAT_TABLE:RB_FREE";
+ Pos = MAP_APPFONT ( 202 , 84 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Manual" ;
+ };
+ FixedLine FL_POS
+ {
+ Pos = MAP_APPFONT ( 196 , 3 ) ;
+ Size = MAP_APPFONT ( 58 , 8 ) ;
+ Text [ en-US ] = "Alignment" ;
+ };
+ FixedLine FL_DIST
+ {
+ Pos = MAP_APPFONT ( 6 , 48 ) ;
+ Size = MAP_APPFONT ( 184 , 8 ) ;
+ Text [ en-US ] = "Spacing" ;
+ };
+ FixedText FT_LEFT_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 61 ) ;
+ Size = MAP_APPFONT ( 130 , 8 ) ;
+ Text [ en-US ] = "Lef~t" ;
+ };
+ MetricField ED_LEFT_DIST
+ {
+ HelpID = "sw:MetricField:TP_FORMAT_TABLE:ED_LEFT_DIST";
+ Pos = MAP_APPFONT ( 147 , 59 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -9999 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_RIGHT_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 77 ) ;
+ Size = MAP_APPFONT ( 130 , 8 ) ;
+ Text [ en-US ] = "Ri~ght" ;
+ };
+
+ MetricField ED_RIGHT_DIST
+ {
+ HelpID = "sw:MetricField:TP_FORMAT_TABLE:ED_RIGHT_DIST";
+ Pos = MAP_APPFONT ( 147 , 75 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = -9999 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_TOP_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 93 ) ;
+ Size = MAP_APPFONT ( 130 , 8 ) ;
+ Text [ en-US ] = "~Above" ;
+ };
+ MetricField ED_TOP_DIST
+ {
+ HelpID = "sw:MetricField:TP_FORMAT_TABLE:ED_TOP_DIST";
+ Pos = MAP_APPFONT ( 147 , 91 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ Border = TRUE ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 5 ;
+ };
+ FixedText FT_BOTTOM_DIST
+ {
+ Pos = MAP_APPFONT ( 12 , 109 ) ;
+ Size = MAP_APPFONT ( 130 , 8 ) ;
+ Text [ en-US ] = "~Below" ;
+ };
+ MetricField ED_BOTTOM_DIST
+ {
+ HelpID = "sw:MetricField:TP_FORMAT_TABLE:ED_BOTTOM_DIST";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 147 , 107 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 1000 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 0 ;
+ Last = 9999 ;
+ SpinSize = 5 ;
+ };
+ FixedLine FL_PROPERTIES
+ {
+ Pos = MAP_APPFONT ( 6 , 125 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Properties";
+ };
+ FixedText FT_TEXTDIRECTION
+ {
+ Pos = MAP_APPFONT ( 12 , 138 ) ;
+ Size = MAP_APPFONT ( 60 , 8 ) ;
+ Hide = TRUE ;
+ Text [ en-US ] = "Text ~direction";
+ };
+ ListBox LB_TEXTDIRECTION
+ {
+ HelpID = "sw:ListBox:TP_FORMAT_TABLE:LB_TEXTDIRECTION";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 75 , 136 ) ;
+ Size = MAP_APPFONT ( 176 , 50 ) ;
+ DropDown = TRUE ;
+ Hide = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Left-to-right" ; 0; > ;
+ < "Right-to-left" ; 1; > ;
+ < "Use superordinate object settings" ; 4; > ;
+ };
+ };
+};
+/**************************************************************************/
+/* */
+/* */
+/* */
+/**************************************************************************/
+TabPage TP_TABLE_COLUMN
+{
+ HelpID = HID_TABLE_COLUMN ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ Hide = TRUE;
+ CheckBox CB_MOD_TBL
+ {
+ HelpID = "sw:CheckBox:TP_TABLE_COLUMN:CB_MOD_TBL";
+ Pos = MAP_APPFONT ( 6 , 6 ) ;
+ Size = MAP_APPFONT ( 180 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Adapt table ~width" ;
+ };
+ CheckBox CB_PROP
+ {
+ HelpID = "sw:CheckBox:TP_TABLE_COLUMN:CB_PROP";
+ Pos = MAP_APPFONT ( 6 , 20 ) ;
+ Size = MAP_APPFONT ( 180 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Ad~just columns proportionally" ;
+ };
+ FixedText FT_SPACE
+ {
+ Pos = MAP_APPFONT ( 6 , 36 ) ;
+ Size = MAP_APPFONT ( 85 , 8 ) ;
+ Text [ en-US ] = "Remaining space" ;
+ };
+ MetricField ED_SPACE
+ {
+ HelpID = "sw:MetricField:TP_TABLE_COLUMN:ED_SPACE";
+ ReadOnly = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 95 , 34 ) ;
+ Size = MAP_APPFONT ( 30 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Minimum = 0 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ ImageButton COL_BTN_DOWN
+ {
+ HelpID = "sw:ImageButton:TP_TABLE_COLUMN:COL_BTN_DOWN";
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 65 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ SYMBOL = IMAGEBUTTON_ARROW_LEFT ;
+ };
+ ImageButton COL_BTN_UP
+ {
+ HelpID = "sw:ImageButton:TP_TABLE_COLUMN:COL_BTN_UP";
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 234 , 65 ) ;
+ Size = MAP_APPFONT ( 10 , 10 ) ;
+ TabStop = TRUE ;
+ SYMBOL = IMAGEBUTTON_ARROW_RIGHT ;
+ };
+ FixedText COL_FT_1
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 30 , 65 ) ;
+ Size = MAP_APPFONT ( 9 , 8 ) ;
+ Text = "~1" ;
+ Left = TRUE ;
+ Center = TRUE ;
+ Right = TRUE ;
+ };
+ MetricField COL_MF_1
+ {
+ HelpID = "sw:MetricField:TP_TABLE_COLUMN:COL_MF_1";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 13 , 81 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ FixedText COL_FT_2
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 68 , 65 ) ;
+ Size = MAP_APPFONT ( 9 , 8 ) ;
+ Text = "~2" ;
+ Left = TRUE ;
+ Right = TRUE ;
+ };
+ MetricField COL_MF_2
+ {
+ HelpID = "sw:MetricField:TP_TABLE_COLUMN:COL_MF_2";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 52 , 81 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ FixedText COL_FT_3
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 107 , 65 ) ;
+ Size = MAP_APPFONT ( 9 , 8 ) ;
+ Text = "~3" ;
+ Left = TRUE ;
+ Right = TRUE ;
+ };
+ MetricField COL_MF_3
+ {
+ HelpID = "sw:MetricField:TP_TABLE_COLUMN:COL_MF_3";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 91 , 81 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ FixedText COL_FT_4
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 146 , 65 ) ;
+ Size = MAP_APPFONT ( 9 , 8 ) ;
+ Text = "~4" ;
+ Left = TRUE ;
+ Right = TRUE ;
+ };
+ MetricField COL_MF_4
+ {
+ HelpID = "sw:MetricField:TP_TABLE_COLUMN:COL_MF_4";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 130 , 81 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ FixedText COL_FT_5
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 185 , 65 ) ;
+ Size = MAP_APPFONT ( 9 , 8 ) ;
+ Text = "~5" ;
+ Left = TRUE ;
+ Right = TRUE ;
+ };
+ MetricField COL_MF_5
+ {
+ HelpID = "sw:MetricField:TP_TABLE_COLUMN:COL_MF_5";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 169 , 81 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ FixedText COL_FT_6
+ {
+ Disable = TRUE ;
+ Pos = MAP_APPFONT ( 204 , 65 ) ;
+ Size = MAP_APPFONT ( 9 , 8 ) ;
+ Text = "~6" ;
+ Left = TRUE ;
+ Right = TRUE ;
+ };
+ MetricField COL_MF_6
+ {
+ HelpID = "sw:MetricField:TP_TABLE_COLUMN:COL_MF_6";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 208 , 81 ) ;
+ Size = MAP_APPFONT ( 36 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 5600 ;
+ DecimalDigits = 2 ;
+ Unit = FUNIT_CM ;
+ First = 10 ;
+ Last = 5600 ;
+ SpinSize = 10 ;
+ };
+ FixedLine COL_FL_LAYOUT
+ {
+ Pos = MAP_APPFONT ( 6 , 50 ) ;
+ Size = MAP_APPFONT ( 240 , 8 ) ;
+ Text [ en-US ] = "Column width" ;
+ };
+};
+/**************************************************************************/
+/* */
+/* Textfluss */
+/* */
+/**************************************************************************/
+TabPage TP_TABLE_TEXTFLOW
+{
+ HelpId = HID_TABLE_TEXTFLOW ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ TEXT_TEXTFLOW
+ Hide = TRUE;
+ FixedLine FL_FLOW
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ TEXT_TEXTFLOW
+ };
+ CheckBox CB_PAGEBREAK
+ {
+ HelpID = "sw:CheckBox:TP_TABLE_TEXTFLOW:CB_PAGEBREAK";
+ // Disable = TRUE;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 90 , 8 ) ;
+ Text [ en-US ] = "~Break" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ RadioButton RB_BREAKPAGE
+ {
+ HelpID = "sw:RadioButton:TP_TABLE_TEXTFLOW:RB_BREAKPAGE";
+ Pos = MAP_APPFONT ( 105 , 14 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~Page" ;
+ Group = TRUE ;
+ Check = TRUE ;
+ };
+ RadioButton RB_BREAKCOLUMN
+ {
+ HelpID = "sw:RadioButton:TP_TABLE_TEXTFLOW:RB_BREAKCOLUMN";
+ // Disable = TRUE;
+ Pos = MAP_APPFONT ( 178 , 14 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ // ### ACHTUNG: Neuer Text in Resource? S~palte : ~Spalte
+ Text [ en-US ] = "Col~umn" ;
+ };
+ RadioButton RB_PAGEBREAKBEFORE
+ {
+ HelpID = "sw:RadioButton:TP_TABLE_TEXTFLOW:RB_PAGEBREAKBEFORE";
+ // Disable = TRUE;
+ Pos = MAP_APPFONT ( 105 , 28 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Be~fore" ;
+ Group = TRUE ;
+ Check = TRUE ;
+ };
+ RadioButton RB_PAGEBREAKAFTER
+ {
+ HelpID = "sw:RadioButton:TP_TABLE_TEXTFLOW:RB_PAGEBREAKAFTER";
+ // Disable = TRUE;
+ Pos = MAP_APPFONT ( 178 , 28 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~After" ;
+ };
+ CheckBox CB_PAGECOLL
+ {
+ HelpID = "sw:CheckBox:TP_TABLE_TEXTFLOW:CB_PAGECOLL";
+ // Disable = TRUE;
+ Pos = MAP_APPFONT ( 12 , 44 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Text [ en-US ] = "With Page St~yle" ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ ListBox LB_PAGECOLL
+ {
+ HelpID = "sw:ListBox:TP_TABLE_TEXTFLOW:LB_PAGECOLL";
+ Pos = MAP_APPFONT ( 105 , 42 ) ;
+ Size = MAP_APPFONT ( 61 , 50 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_PAGENUM
+ {
+ Pos = MAP_APPFONT ( 171 , 44 ) ;
+ Size = MAP_APPFONT ( 47 , 10 ) ;
+ Text [ en-US ] = "Page ~number" ;
+ };
+ NumericField NF_PAGENUM
+ {
+ HelpID = "sw:NumericField:TP_TABLE_TEXTFLOW:NF_PAGENUM";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 222 , 42 ) ;
+ Size = MAP_APPFONT ( 26 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 0 ;
+ Maximum = 9999 ;
+ Value = 0 ;
+ First = 0 ;
+ Last = 9999 ;
+ };
+ CheckBox CB_SPLIT
+ {
+ HelpID = "sw:CheckBox:TP_TABLE_TEXTFLOW:CB_SPLIT";
+ Pos = MAP_APPFONT ( 12 , 58 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Allow ~table to split across pages and columns" ;
+ };
+ TriStateBox CB_SPLIT_ROW
+ {
+ HelpID = "sw:TriStateBox:TP_TABLE_TEXTFLOW:CB_SPLIT_ROW";
+ Pos = MAP_APPFONT ( 21 , 71 ) ;
+ Size = MAP_APPFONT ( 227 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "Allow row to break a~cross pages and columns" ;
+ };
+ CheckBox CB_KEEP
+ {
+ HelpID = "sw:CheckBox:TP_TABLE_TEXTFLOW:CB_KEEP";
+ Pos = MAP_APPFONT ( 12 , 85 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "~Keep with next paragraph" ;
+ TabStop = TRUE ;
+ };
+ CheckBox CB_HEADLINE
+ {
+ HelpID = "sw:CheckBox:TP_TABLE_TEXTFLOW:CB_HEADLINE";
+ Pos = MAP_APPFONT ( 12 , 99 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "R~epeat heading" ;
+ };
+ FixedText FT_REPEAT_HEADER
+ {
+ Pos = MAP_APPFONT ( 31 , 114 ) ;
+ Size = MAP_APPFONT ( 95 , 10 ) ;
+ Text [ en-US ] = "The first %POSITION_OF_CONTROL rows" ;
+ };
+ NumericField NF_REPEAT_HEADER
+ {
+ HelpID = "sw:NumericField:TP_TABLE_TEXTFLOW:NF_REPEAT_HEADER";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 131 , 113 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ Maximum = 1000 ;
+ First = 1 ;
+ };
+ Window WIN_REPEAT_HEADER
+ {
+ Pos = MAP_APPFONT ( 21 , 113 ) ;
+ Size = MAP_APPFONT ( 2 , 1 ) ;
+ };
+ FixedText FT_TEXTDIRECTION
+ {
+ Pos = MAP_APPFONT ( 12 , 132 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "Text ~direction" ;
+ };
+ ListBox LB_TEXTDIRECTION
+ {
+ HelpID = "sw:ListBox:TP_TABLE_TEXTFLOW:LB_TEXTDIRECTION";
+ Pos = MAP_APPFONT ( 85 , 130 ) ;
+ Size = MAP_APPFONT ( 163 , 50 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ StringList [ en-US ] =
+ {
+ < "Left-to-right" ; 0; > ;
+ < "Right-to-left (vertical)" ; 2; > ;
+ < "Use superordinate object settings" ; 4; > ;
+ };
+ };
+ FixedLine FL_VERT_ORIENT
+ {
+ Pos = MAP_APPFONT ( 6 , 149 ) ;
+ Size = MAP_APPFONT ( 251 , 8 ) ;
+ Text [ en-US ] = "Alignment" ;
+ };
+
+ FixedText FT_VERTORIENT
+ {
+ Pos = MAP_APPFONT ( 12 , 164 ) ;
+ Size = MAP_APPFONT ( 70 , 10 ) ;
+ Text [ en-US ] = "~Vertical alignment" ;
+ };
+ ListBox LB_VERTORIENT
+ {
+ HelpID = "sw:ListBox:TP_TABLE_TEXTFLOW:LB_VERTORIENT";
+ Pos = MAP_APPFONT ( 85 , 162 ) ;
+ Size = MAP_APPFONT ( 61 , 50 ) ;
+ DropDown = TRUE;
+ Border = TRUE;
+ StringList [ en-US ] =
+ {
+ < "Top" ; 0; > ;
+ < "Centered" ; 1; > ;
+ < "Bottom" ; 2; > ;
+ };
+ };
+};
+InfoBox MSG_WRONG_TABLENAME
+{
+ Message [ en-US ] = "The name of the table must not contain spaces." ;
+};
+
diff --git a/sw/source/ui/table/tablemgr.cxx b/sw/source/ui/table/tablemgr.cxx
new file mode 100644
index 000000000000..c0f325862d82
--- /dev/null
+++ b/sw/source/ui/table/tablemgr.cxx
@@ -0,0 +1,382 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+
+#include <sot/storage.hxx>
+#include <sot/clsids.hxx>
+
+#include "edtwin.hxx"
+#include "errhdl.hxx"
+#include "wrtsh.hxx"
+#include "cmdid.h"
+#include "frmatr.hxx"
+#include "view.hxx"
+#include "basesh.hxx"
+#include "swundo.hxx"
+#include "tablemgr.hxx"
+#include "frmfmt.hxx"
+#include "instable.hxx"
+#include "swerror.h"
+#include "table.hrc"
+#include "swabstdlg.hxx"
+#include "swcli.hxx"
+#include "docsh.hxx"
+#include "unotbl.hxx"
+#include "unochart.hxx"
+
+using namespace ::com::sun::star;
+
+/*------------------------------------------------------------------------
+ Beschreibung: Zeilenhoehe einstellen (Dialog)
+------------------------------------------------------------------------*/
+
+
+void SwTableFUNC::ColWidthDlg( Window *pParent )
+{
+ InitTabCols();
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ VclAbstractDialog* pDlg = pFact->CreateSwTableWidthDlg( pParent, *this ,DLG_COL_WIDTH );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Breite ermitteln
+ --------------------------------------------------------------------*/
+
+
+SwTwips SwTableFUNC::GetColWidth(USHORT nNum) const
+{
+ SwTwips nWidth = 0;
+
+ if( aCols.Count() > 0 )
+ {
+ if(aCols.Count() == GetColCount())
+ {
+ nWidth = (SwTwips)((nNum == aCols.Count()) ?
+ aCols.GetRight() - aCols[nNum-1] :
+ nNum == 0 ? aCols[nNum] - aCols.GetLeft() :
+ aCols[nNum] - aCols[nNum-1]);
+ }
+ else
+ {
+ SwTwips nRValid = nNum < GetColCount() ?
+ aCols[(USHORT)GetRightSeparator((int)nNum)]:
+ aCols.GetRight();
+ SwTwips nLValid = nNum ?
+ aCols[(USHORT)GetRightSeparator((int)nNum - 1)]:
+ aCols.GetLeft();
+ nWidth = nRValid - nLValid;
+ }
+ }
+ else
+ nWidth = aCols.GetRight();
+
+ return nWidth;
+}
+
+
+
+SwTwips SwTableFUNC::GetMaxColWidth( USHORT nNum ) const
+{
+ ASSERT(nNum <= aCols.Count(), "Index out of Area");
+
+ if ( GetColCount() > 0 )
+ {
+ // Die max. Breite ergibt sich aus der eigenen Breite und
+ // der Breite der Nachbarzellen um je MINLAY verringert
+ SwTwips nMax = nNum == 0 ?
+ GetColWidth(1) - MINLAY :
+ nNum == GetColCount() ?
+ GetColWidth( nNum-1 ) - MINLAY :
+ GetColWidth(nNum - 1) + GetColWidth( nNum + 1 ) - 2 * MINLAY;
+
+ return nMax + GetColWidth(nNum) ;
+ }
+ else
+ return GetColWidth(nNum);
+}
+
+
+
+void SwTableFUNC::SetColWidth(USHORT nNum, SwTwips nNewWidth )
+{
+ // aktuelle Breite setzen
+ // alle folgenden Verschieben
+ BOOL bCurrentOnly = FALSE;
+ SwTwips nWidth = 0;
+
+ if ( aCols.Count() > 0 )
+ {
+ if(aCols.Count() != GetColCount())
+ bCurrentOnly = TRUE;
+ nWidth = GetColWidth(nNum);
+
+ int nDiff = (int)(nNewWidth - nWidth);
+ if( !nNum )
+ aCols[ static_cast< USHORT >(GetRightSeparator(0)) ] += nDiff;
+ else if( nNum < GetColCount() )
+ {
+ if(nDiff < GetColWidth(nNum + 1) - MINLAY)
+ aCols[ static_cast< USHORT >(GetRightSeparator(nNum)) ] += nDiff;
+ else
+ {
+ int nDiffLeft = nDiff - (int)GetColWidth(nNum + 1) + (int)MINLAY;
+ aCols[ static_cast< USHORT >(GetRightSeparator(nNum)) ] += (nDiff - nDiffLeft);
+ aCols[ static_cast< USHORT >(GetRightSeparator(nNum - 1)) ] -= nDiffLeft;
+ }
+ }
+ else
+ aCols[ static_cast< USHORT >(GetRightSeparator(nNum-1)) ] -= nDiff;
+ }
+ else
+ aCols.SetRight( Min( nNewWidth, aCols.GetRightMax()) );
+
+ pSh->StartAllAction();
+ pSh->SetTabCols( aCols, bCurrentOnly );
+ pSh->EndAllAction();
+}
+
+
+
+void SwTableFUNC::InitTabCols()
+{
+ ASSERT(pSh, keine Shell);
+
+ if( pFmt && pSh)
+ pSh->GetTabCols( aCols );
+}
+
+
+
+SwTableFUNC::SwTableFUNC(SwWrtShell *pShell, BOOL bCopyFmt)
+ : pFmt(pShell->GetTableFmt()),
+ pSh(pShell),
+ bCopy(bCopyFmt)
+{
+ // gfs. das Format fuer die Bearbeitung kopieren
+ if( pFmt && bCopy )
+ pFmt = new SwFrmFmt( *pFmt );
+}
+
+
+
+SwTableFUNC::~SwTableFUNC()
+{
+ if(bCopy)
+ delete pFmt;
+}
+
+void SwTableFUNC::UpdateChart()
+{
+ //Update der Felder in der Tabelle vom User ausgeloesst, alle
+ //Charts zu der Tabelle werden auf den neuesten Stand gebracht.
+ SwFrmFmt *pFmt2 = pSh->GetTableFmt();
+ if ( pFmt2 && pSh->HasOLEObj( pFmt2->GetName() ) )
+ {
+ pSh->StartAllAction();
+ pSh->UpdateCharts( pFmt2->GetName() );
+ pSh->EndAllAction();
+ }
+}
+
+uno::Reference< frame::XModel > SwTableFUNC::InsertChart(
+ uno::Reference< chart2::data::XDataProvider > &rxDataProvider,
+ sal_Bool bFillWithData,
+ const rtl::OUString &rCellRange,
+ SwFlyFrmFmt** ppFlyFrmFmt )
+{
+ uno::Reference< frame::XModel > xChartModel;
+ pSh->StartUndo( UNDO_UI_INSERT_CHART );
+ pSh->StartAllAction();
+
+ String aName;
+ if (pSh->IsCrsrInTbl())
+ {
+ aName = pSh->GetTableFmt()->GetName();
+ // insert node before table
+ pSh->MoveTable( fnTableCurr, fnTableStart );
+ pSh->Up( FALSE, 1, FALSE );
+ if ( pSh->IsCrsrInTbl() )
+ {
+ if ( aName != pSh->GetTableFmt()->GetName() )
+ pSh->Down( FALSE, 1, FALSE ); // two adjacent tables
+ }
+ pSh->SplitNode();
+ }
+
+ // insert chart
+ ::rtl::OUString aObjName;
+ comphelper::EmbeddedObjectContainer aCnt;
+ uno::Reference < embed::XEmbeddedObject > xObj =
+ aCnt.CreateEmbeddedObject( SvGlobalName( SO3_SCH_CLASSID ).GetByteSequence(), aObjName );
+
+ ::svt::EmbeddedObjectRef aEmbObjRef( xObj, ::com::sun::star::embed::Aspects::MSOLE_CONTENT );
+ if ( xObj.is() )
+ {
+
+ SwFlyFrmFmt* pTmp = 0;
+ pSh->InsertOleObject( aEmbObjRef, &pTmp );
+ if (ppFlyFrmFmt)
+ *ppFlyFrmFmt = pTmp;
+
+ uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY );
+ if( xCompSupp.is())
+ {
+ xChartModel.set( xCompSupp->getComponent(), uno::UNO_QUERY );
+ if( xChartModel.is() )
+ xChartModel->lockControllers(); //#i79578# don't request a new replacement image for charts to often - block change notifications
+ }
+
+ // set the table name at the OLE-node
+ if (aName.Len())
+ pSh->SetChartName( aName );
+ }
+ pSh->EndAllAction();
+
+ if ( xObj.is() )
+ {
+ // Let the chart be activated after the inserting
+ SfxInPlaceClient* pClient = pSh->GetView().FindIPClient( xObj, &pSh->GetView().GetEditWin() );
+ if ( !pClient )
+ {
+ pClient = new SwOleClient( &pSh->GetView(), &pSh->GetView().GetEditWin(), aEmbObjRef );
+ pSh->SetCheckForOLEInCaption( TRUE );
+ }
+ pSh->CalcAndSetScale( aEmbObjRef );
+ //#50270# Error brauchen wir nicht handeln, das erledigt das
+ //DoVerb in der SfxViewShell
+ ErrCode nErr = pClient->DoVerb( SVVERB_SHOW );
+ (void) nErr;
+ }
+
+ uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xChartModel, uno::UNO_QUERY );
+ if (bFillWithData && xDataReceiver.is() && rxDataProvider.is())
+ {
+ xDataReceiver->attachDataProvider( rxDataProvider );
+
+ uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( pSh->GetView().GetDocShell()->GetModel(), uno::UNO_QUERY );
+ xDataReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier );
+
+ // default values for ranges that do not consist of a single row or column
+ bool bHasCategories = true;
+ bool bFirstCellAsLabel = true;
+ chart::ChartDataRowSource eDataRowSource = chart::ChartDataRowSource_COLUMNS;
+
+ SwRangeDescriptor aDesc;
+ FillRangeDescriptor( aDesc, rCellRange );
+ bool bSingleRowCol = aDesc.nTop == aDesc.nBottom || aDesc.nLeft == aDesc.nRight;
+ if (bSingleRowCol)
+ {
+ aDesc.Normalize();
+ sal_Int32 nRowLen = aDesc.nRight - aDesc.nLeft + 1;
+ sal_Int32 nColLen = aDesc.nBottom - aDesc.nTop + 1;
+
+ bHasCategories = false;
+ if (nRowLen == 1 && nColLen == 1)
+ bFirstCellAsLabel = false;
+ else if (nRowLen > 1)
+ eDataRowSource = chart::ChartDataRowSource_ROWS;
+ else if (nColLen > 1)
+ eDataRowSource = chart::ChartDataRowSource_COLUMNS;
+ else {
+ DBG_ERROR( "unexpected state" );
+ }
+ }
+
+ uno::Sequence< beans::PropertyValue > aArgs( 4 );
+ aArgs[0] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("CellRangeRepresentation"), -1,
+ uno::makeAny( rCellRange ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[1] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("HasCategories"), -1,
+ uno::makeAny( bHasCategories ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[2] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("FirstCellAsLabel"), -1,
+ uno::makeAny( bFirstCellAsLabel ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[3] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("DataRowSource"), -1,
+ uno::makeAny( eDataRowSource ), beans::PropertyState_DIRECT_VALUE );
+ xDataReceiver->setArguments( aArgs );
+ }
+
+ pSh->EndUndo( UNDO_UI_INSERT_CHART );
+
+ if( xChartModel.is() )
+ xChartModel->unlockControllers(); //#i79578# don't request a new replacement image for charts to often
+ return xChartModel;
+}
+
+USHORT SwTableFUNC::GetCurColNum() const
+{
+ USHORT nPos = pSh->GetCurTabColNum();
+ USHORT nCount = 0;
+ for(USHORT i = 0; i < nPos; i++ )
+ if(aCols.IsHidden(i))
+ nCount ++;
+ return nPos - nCount;
+}
+
+
+
+
+USHORT SwTableFUNC::GetColCount() const
+{
+ USHORT nCount = 0;
+ for(USHORT i = 0; i < aCols.Count(); i++ )
+ if(aCols.IsHidden(i))
+ nCount ++;
+ return aCols.Count() - nCount;
+}
+
+
+
+int SwTableFUNC::GetRightSeparator(int nNum) const
+{
+ DBG_ASSERT( nNum < (int)GetColCount() ,"Index out of range");
+ int i = 0;
+ while( nNum >= 0 )
+ {
+ if( !aCols.IsHidden( static_cast< USHORT >(i)) )
+ nNum--;
+ i++;
+ }
+ return i - 1;
+}
+
+
+
diff --git a/sw/source/ui/table/tablepg.hxx b/sw/source/ui/table/tablepg.hxx
new file mode 100644
index 000000000000..86eff4a23f08
--- /dev/null
+++ b/sw/source/ui/table/tablepg.hxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SWTABLEPG_HXX
+#define _SWTABLEPG_HXX
+#include <sfx2/tabdlg.hxx>
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#ifndef _IMAGEBTN_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#include <actctrl.hxx>
+#include "prcntfld.hxx"
+#include "swtypes.hxx"
+#include "textcontrolcombo.hxx"
+
+class SwWrtShell;
+class SwTableRep;
+
+struct TColumn
+{
+ SwTwips nWidth;
+ BOOL bVisible;
+};
+
+class SwFormatTablePage : public SfxTabPage
+{
+ FixedLine aOptionsFL;
+ FixedText aNameFT;
+ TableNameEdit aNameED;
+ FixedText aWidthFT;
+ PercentField aWidthMF;
+ CheckBox aRelWidthCB;
+
+ FixedLine aPosFL;
+ RadioButton aFullBtn;
+ RadioButton aLeftBtn;
+ RadioButton aFromLeftBtn;
+ RadioButton aRightBtn;
+ RadioButton aCenterBtn;
+ RadioButton aFreeBtn;
+
+ FixedLine aDistFL;
+ FixedText aLeftFT;
+ PercentField aLeftMF;
+ FixedText aRightFT;
+ PercentField aRightMF;
+ FixedText aTopFT;
+ MetricField aTopMF;
+ FixedText aBottomFT;
+ MetricField aBottomMF;
+
+ FixedLine aPropertiesFL;
+ FixedText aTextDirectionFT;
+ ListBox aTextDirectionLB;
+
+ SwTableRep* pTblData;
+ SwTwips nSaveWidth;
+ SwTwips nMinTableWidth;
+ USHORT nOldAlign;
+ BOOL bModified;
+ BOOL bFull:1;
+ BOOL bHtmlMode : 1;
+
+ void Init();
+ void ModifyHdl( Edit* pEdit );
+
+ DECL_LINK( AutoClickHdl, CheckBox * );
+ DECL_LINK( RelWidthClickHdl, CheckBox * );
+ DECL_LINK( RightModifyHdl, MetricField * );
+ DECL_LINK( UpDownLoseFocusHdl, MetricField * );
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+public:
+ SwFormatTablePage( Window* pParent, const SfxItemSet& rSet );
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+};
+
+/*-------------------------------------------------------
+ TabPage Format/Tabelle/Spalten
+--------------------------------------------------------- */
+#define MET_FIELDS 6 //Anzahl der verwendeten MetricFields
+
+class SwTableColumnPage : public SfxTabPage
+{
+ CheckBox aModifyTableCB;
+ CheckBox aProportionalCB;
+ FixedText aSpaceFT;
+ MetricField aSpaceED;
+
+ ImageButton aUpBtn;
+ FixedText aFT1;
+ PercentField aMF1;
+ FixedText aFT2;
+ PercentField aMF2;
+ FixedText aFT3;
+ PercentField aMF3;
+ FixedText aFT4;
+ PercentField aMF4;
+ FixedText aFT5;
+ PercentField aMF5;
+ FixedText aFT6;
+ PercentField aMF6;
+ ImageButton aDownBtn;
+ FixedLine aColFL;
+
+ SwTableRep* pTblData;
+ PercentField* pFieldArr[MET_FIELDS];
+ FixedText* pTextArr[MET_FIELDS];
+ SwTwips nTableWidth;
+ SwTwips nMinWidth;
+ USHORT nNoOfCols;
+ USHORT nNoOfVisibleCols;
+ //Breite merken, wenn auf autom. Ausrichtung gestellt wird
+ USHORT aValueTbl[MET_FIELDS];//primaere Zuordnung der MetricFields
+ BOOL bModified:1;
+ BOOL bModifyTbl:1;
+ BOOL bPercentMode:1;
+
+ void Init(BOOL bWeb);
+ DECL_LINK( AutoClickHdl, CheckBox * );
+ void ModifyHdl( PercentField* pEdit );
+ DECL_LINK( UpHdl, PercentField * );
+ DECL_LINK( DownHdl, PercentField * );
+ DECL_LINK( LoseFocusHdl, PercentField * );
+ DECL_LINK( ModeHdl, CheckBox * );
+ void UpdateCols( USHORT nAktPos );
+ SwTwips GetVisibleWidth(USHORT nPos);
+ void SetVisibleWidth(USHORT nPos, SwTwips nNewWidth);
+
+ using TabPage::ActivatePage;
+ using TabPage::DeactivatePage;
+
+public:
+ SwTableColumnPage( Window* pParent, const SfxItemSet& rSet );
+ ~SwTableColumnPage();
+
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+ virtual void ActivatePage( const SfxItemSet& rSet );
+ virtual int DeactivatePage( SfxItemSet* pSet = 0 );
+
+};
+
+/*-----------------12.12.96 11.48-------------------
+ Textfluss
+--------------------------------------------------*/
+class SwTextFlowPage : public SfxTabPage
+{
+ FixedLine aFlowFL;
+ CheckBox aPgBrkCB;
+ RadioButton aPgBrkRB;
+ RadioButton aColBrkRB;
+ RadioButton aPgBrkBeforeRB;
+ RadioButton aPgBrkAfterRB;
+ CheckBox aPageCollCB;
+ ListBox aPageCollLB;
+ FixedText aPageNoFT;
+ NumericField aPageNoNF;
+ CheckBox aSplitCB;
+ TriStateBox aSplitRowCB;
+ CheckBox aKeepCB;
+ CheckBox aHeadLineCB;
+ FixedText aRepeatHeaderFT; // "dummy" to build before and after FT
+ FixedText aRepeatHeaderBeforeFT;
+ NumericField aRepeatHeaderNF;
+ FixedText aRepeatHeaderAfterFT;
+ TextControlCombo aRepeatHeaderCombo;
+ FixedText aTextDirectionFT;
+ ListBox aTextDirectionLB;
+
+ FixedLine aVertOrientFL;
+ FixedText aVertOrientFT;
+ ListBox aVertOrientLB;
+
+ SwWrtShell* pShell;
+
+ BOOL bPageBreak;
+ BOOL bHtmlMode;
+
+
+ DECL_LINK( PageBreakHdl_Impl, CheckBox* );
+ DECL_LINK( ApplyCollClickHdl_Impl, CheckBox* );
+ DECL_LINK( PageBreakPosHdl_Impl, RadioButton* );
+ DECL_LINK( PageBreakTypeHdl_Impl, RadioButton* );
+ DECL_LINK( SplitHdl_Impl, CheckBox* );
+ DECL_LINK( SplitRowHdl_Impl, TriStateBox* );
+ DECL_LINK( HeadLineCBClickHdl, void* p = 0 );
+
+
+ SwTextFlowPage( Window* pParent, const SfxItemSet& rSet );
+ ~SwTextFlowPage();
+
+public:
+ static SfxTabPage* Create( Window* pParent, const SfxItemSet& rAttrSet);
+ virtual BOOL FillItemSet( SfxItemSet& rSet );
+ virtual void Reset( const SfxItemSet& rSet );
+
+ void SetShell(SwWrtShell* pSh);
+
+ void DisablePageBreak();
+};
+
+#endif
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
new file mode 100644
index 000000000000..d097d5afeba5
--- /dev/null
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -0,0 +1,1057 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+#ifndef _MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+#include <vcl/svapp.hxx>
+#include <svl/zforlist.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <comphelper/processfactory.hxx>
+#include <svtools/scriptedtext.hxx>
+#include <svtools/accessibilityoptions.hxx>
+#include <svx/framelinkarray.hxx>
+#include "swmodule.hxx"
+#include "swtypes.hxx"
+#ifndef _VIEW_HXX
+#include "view.hxx"
+#endif
+#include "wrtsh.hxx"
+#include "tblafmt.hxx"
+#ifndef _TAUTOFMT_HXX
+#include "tautofmt.hxx"
+#endif
+#include "shellres.hxx"
+#ifndef _TAUTOFMT_HRC
+#include "tautofmt.hrc"
+#endif
+
+using namespace com::sun::star;
+
+#define FRAME_OFFSET 4
+
+//========================================================================
+
+class AutoFmtPreview : public Window
+{
+public:
+ AutoFmtPreview( Window* pParent, const ResId& rRes, SwWrtShell* pWrtShell );
+ ~AutoFmtPreview();
+
+ void NotifyChange( const SwTableAutoFmt& rNewData );
+
+protected:
+ virtual void Paint( const Rectangle& rRect );
+
+private:
+ SwTableAutoFmt aCurData;
+ VirtualDevice aVD;
+ SvtScriptedTextHelper aScriptedText;
+ svx::frame::Array maArray; /// Implementation to draw the frame borders.
+ BOOL bFitWidth;
+ bool mbRTL;
+ Size aPrvSize;
+ long nLabelColWidth;
+ long nDataColWidth1;
+ long nDataColWidth2;
+ long nRowHeight;
+ const String aStrJan;
+ const String aStrFeb;
+ const String aStrMar;
+ const String aStrNorth;
+ const String aStrMid;
+ const String aStrSouth;
+ const String aStrSum;
+ SvNumberFormatter* pNumFmt;
+
+ uno::Reference< lang::XMultiServiceFactory > m_xMSF;
+ uno::Reference< i18n::XBreakIterator > m_xBreak;
+
+ //-------------------------------------------
+ void Init ();
+ void DoPaint ( const Rectangle& rRect );
+ void CalcCellArray ( BOOL bFitWidth );
+ void CalcLineMap ();
+ void PaintCells ();
+
+ BYTE GetFormatIndex( size_t nCol, size_t nRow ) const;
+ const SvxBoxItem& GetBoxItem( size_t nCol, size_t nRow ) const;
+
+ void DrawString( size_t nCol, size_t nRow );
+ void DrawStrings();
+ void DrawBackground();
+
+ void MakeFonts ( BYTE nIndex, Font& rFont, Font& rCJKFont, Font& rCTLFont );
+ String MakeNumberString( String cellString, BOOL bAddDec );
+};
+
+//========================================================================
+
+class SwStringInputDlg : public ModalDialog
+{
+public:
+ SwStringInputDlg( Window* pParent,
+ const String& rTitle,
+ const String& rEditTitle,
+ const String& rDefault );
+ ~SwStringInputDlg();
+
+ void GetInputString( String& rString ) const;
+
+private:
+ Edit aEdInput; // Edit erhaelt so den Focus
+ FixedText aFtEditTitle;
+ OKButton aBtnOk;
+ CancelButton aBtnCancel;
+};
+
+
+SwStringInputDlg::SwStringInputDlg( Window* pParent,
+ const String& rTitle,
+ const String& rEditTitle,
+ const String& rDefault ) :
+ ModalDialog ( pParent, SW_RES( DLG_SWDLG_STRINPUT ) ),
+ //
+ aEdInput ( this, SW_RES( ED_INPUT ) ),
+ aFtEditTitle ( this, SW_RES( FT_LABEL ) ),
+ aBtnOk ( this, SW_RES( BTN_OK ) ),
+ aBtnCancel ( this, SW_RES( BTN_CANCEL ) )
+{
+ SetText( rTitle );
+ aFtEditTitle.SetText( rEditTitle );
+ aEdInput.SetText( rDefault );
+ //-------------
+ FreeResource();
+}
+
+//------------------------------------------------------------------------
+
+void SwStringInputDlg::GetInputString( String& rString ) const
+{
+ rString = aEdInput.GetText();
+}
+
+
+__EXPORT SwStringInputDlg::~SwStringInputDlg()
+{
+}
+
+//========================================================================
+// AutoFormat-Dialog:
+
+
+SwAutoFormatDlg::SwAutoFormatDlg( Window* pParent, SwWrtShell* pWrtShell,
+ BOOL bSetAutoFormat, const SwTableAutoFmt* pSelFmt )
+ : SfxModalDialog( pParent, SW_RES( DLG_AUTOFMT_TABLE ) ),
+ //
+ aFlFormat ( this, SW_RES( FL_FORMAT ) ),
+ aLbFormat ( this, SW_RES( LB_FORMAT ) ),
+
+ aBtnNumFormat ( this, SW_RES( BTN_NUMFORMAT ) ),
+ aBtnBorder ( this, SW_RES( BTN_BORDER ) ),
+ aBtnFont ( this, SW_RES( BTN_FONT ) ),
+ aBtnPattern ( this, SW_RES( BTN_PATTERN ) ),
+ aBtnAlignment ( this, SW_RES( BTN_ALIGNMENT ) ),
+ aFlFormats ( this, SW_RES( FL_FORMATS ) ),
+ aBtnOk ( this, SW_RES( BTN_OK ) ),
+ aBtnCancel ( this, SW_RES( BTN_CANCEL ) ),
+ aBtnHelp ( this, SW_RES( BTN_HELP ) ),
+ aBtnAdd ( this, SW_RES( BTN_ADD ) ),
+ aBtnRemove ( this, SW_RES( BTN_REMOVE ) ),
+ aBtnRename ( this, SW_RES( BTN_RENAME ) ),
+ aBtnMore ( this, SW_RES( BTN_MORE ) ),
+ aStrTitle ( SW_RES( STR_ADD_TITLE ) ),
+ aStrLabel ( SW_RES( STR_ADD_LABEL ) ),
+ aStrClose ( SW_RES( STR_BTN_CLOSE ) ),
+ aStrDelTitle ( SW_RES( STR_DEL_TITLE ) ),
+ aStrDelMsg ( SW_RES( STR_DEL_MSG ) ),
+ aStrRenameTitle ( SW_RES( STR_RENAME_TITLE ) ),
+ aStrInvalidFmt ( SW_RES( STR_INVALID_AFNAME )),
+ pWndPreview ( new AutoFmtPreview( this, SW_RES( WND_PREVIEW ), pWrtShell )),
+ //
+ pShell ( pWrtShell ),
+ nIndex ( 0 ),
+ nDfltStylePos ( 0 ),
+ bCoreDataChanged( FALSE ),
+ bSetAutoFmt ( bSetAutoFormat )
+{
+ pTableTbl = new SwTableAutoFmtTbl;
+ pTableTbl->Load();
+
+ Init( pSelFmt );
+ //------------- >
+ FreeResource();
+}
+
+//------------------------------------------------------------------------
+
+
+__EXPORT SwAutoFormatDlg::~SwAutoFormatDlg()
+{
+ delete pWndPreview;
+
+ if( bCoreDataChanged )
+ pTableTbl->Save();
+ delete pTableTbl;
+}
+
+//------------------------------------------------------------------------
+
+
+void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt )
+{
+ Link aLk( LINK( this, SwAutoFormatDlg, CheckHdl ) );
+ aBtnBorder.SetClickHdl( aLk );
+ aBtnFont.SetClickHdl( aLk );
+ aBtnPattern.SetClickHdl( aLk );
+ aBtnAlignment.SetClickHdl( aLk );
+ aBtnNumFormat.SetClickHdl( aLk );
+
+ aBtnAdd.SetClickHdl ( LINK( this, SwAutoFormatDlg, AddHdl ) );
+ aBtnRemove.SetClickHdl ( LINK( this, SwAutoFormatDlg, RemoveHdl ) );
+ aBtnRename.SetClickHdl ( LINK( this, SwAutoFormatDlg, RenameHdl ) );
+ aBtnOk.SetClickHdl ( LINK( this, SwAutoFormatDlg, OkHdl ) );
+ aLbFormat.SetSelectHdl( LINK( this, SwAutoFormatDlg, SelFmtHdl ) );
+
+ aBtnMore.AddWindow( &aBtnNumFormat );
+ aBtnMore.AddWindow( &aBtnBorder );
+ aBtnMore.AddWindow( &aBtnFont );
+ aBtnMore.AddWindow( &aBtnPattern );
+ aBtnMore.AddWindow( &aBtnAlignment );
+ aBtnMore.AddWindow( &aFlFormats );
+ aBtnMore.AddWindow( &aBtnRename );
+
+ aBtnAdd.Enable( bSetAutoFmt );
+
+ nIndex = 0;
+ if( !bSetAutoFmt )
+ {
+ // dann muss die Liste um den Eintrag <Keins> erweitert werden.
+ aLbFormat.InsertEntry( ViewShell::GetShellRes()->aStrNone );
+ nDfltStylePos = 1;
+ nIndex = 255;
+ }
+
+ for( BYTE i = 0, nCount = (BYTE)pTableTbl->Count(); i < nCount; i++ )
+ {
+ SwTableAutoFmt* pFmt = (*pTableTbl)[ i ];
+ aLbFormat.InsertEntry( pFmt->GetName() );
+ if( pSelFmt && pFmt->GetName() == pSelFmt->GetName() )
+ nIndex = i;
+ }
+
+ aLbFormat.SelectEntryPos( 255 != nIndex ? (nDfltStylePos + nIndex) : 0 );
+ SelFmtHdl( 0 );
+}
+
+//------------------------------------------------------------------------
+
+
+void SwAutoFormatDlg::UpdateChecks( const SwTableAutoFmt& rFmt, BOOL bEnable )
+{
+ aBtnNumFormat.Enable( bEnable );
+ aBtnNumFormat.Check( rFmt.IsValueFormat() );
+
+ aBtnBorder.Enable( bEnable );
+ aBtnBorder.Check( rFmt.IsFrame() );
+
+ aBtnFont.Enable( bEnable );
+ aBtnFont.Check( rFmt.IsFont() );
+
+ aBtnPattern.Enable( bEnable );
+ aBtnPattern.Check( rFmt.IsBackground() );
+
+ aBtnAlignment.Enable( bEnable );
+ aBtnAlignment.Check( rFmt.IsJustify() );
+}
+
+void SwAutoFormatDlg::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const
+{
+ if( 255 != nIndex )
+ {
+ if( rToFill )
+ *rToFill = *(*pTableTbl)[ nIndex ];
+ else
+ rToFill = new SwTableAutoFmt( *(*pTableTbl)[ nIndex ] );
+ }
+ else if( rToFill )
+ delete rToFill, rToFill = 0;
+}
+
+
+/*------------------------------------------------------------------------
+ Handler:
+ ---------*/
+
+
+IMPL_LINK( SwAutoFormatDlg, CheckHdl, Button *, pBtn )
+{
+ SwTableAutoFmtPtr pData = (*pTableTbl)[nIndex];
+ BOOL bCheck = ((CheckBox*)pBtn)->IsChecked(), bDataChgd = TRUE;
+
+ if( pBtn == &aBtnNumFormat )
+ pData->SetValueFormat( bCheck );
+ else if ( pBtn == &aBtnBorder )
+ pData->SetFrame( bCheck );
+ else if ( pBtn == &aBtnFont )
+ pData->SetFont( bCheck );
+ else if ( pBtn == &aBtnPattern )
+ pData->SetBackground( bCheck );
+ else if ( pBtn == &aBtnAlignment )
+ pData->SetJustify( bCheck );
+// else if ( pBtn == &aBtnAdjust )
+// pData->SetIncludeWidthHeight( bCheck );
+ else
+ bDataChgd = FALSE;
+
+ if( bDataChgd )
+ {
+ if( !bCoreDataChanged )
+ {
+ aBtnCancel.SetText( aStrClose );
+ bCoreDataChanged = TRUE;
+ }
+
+ pWndPreview->NotifyChange( *pData );
+ }
+ return 0;
+}
+
+/*------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwAutoFormatDlg, AddHdl, void *, EMPTYARG )
+{
+ BOOL bOk = FALSE, bFmtInserted = FALSE;
+ while( !bOk )
+ {
+ SwStringInputDlg* pDlg = new SwStringInputDlg( this,
+ aStrTitle,
+ aStrLabel,
+ aEmptyStr );
+ if( RET_OK == pDlg->Execute() )
+ {
+ String aFormatName;
+ pDlg->GetInputString( aFormatName );
+
+ if( aFormatName.Len() > 0 )
+ {
+ USHORT n;
+ for( n = 0; n < pTableTbl->Count(); ++n )
+ if( (*pTableTbl)[n]->GetName() == aFormatName )
+ break;
+
+ if( n >= pTableTbl->Count() )
+ {
+ // Format mit dem Namen noch nicht vorhanden, also
+ // aufnehmen
+ SwTableAutoFmtPtr pNewData = new
+ SwTableAutoFmt( aFormatName );
+ pShell->GetTableAutoFmt( *pNewData );
+
+ // Sortiert einfuegen!!
+ for( n = 1; n < pTableTbl->Count(); ++n )
+ if( (*pTableTbl)[ n ]->GetName() > aFormatName )
+ break;
+
+ pTableTbl->Insert( pNewData, n );
+ aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n );
+ aLbFormat.SelectEntryPos( nDfltStylePos + n );
+ bFmtInserted = TRUE;
+ aBtnAdd.Enable( FALSE );
+ if ( !bCoreDataChanged )
+ {
+ aBtnCancel.SetText( aStrClose );
+ bCoreDataChanged = TRUE;
+ }
+
+ SelFmtHdl( 0 );
+ bOk = TRUE;
+ }
+ }
+
+ if( !bFmtInserted )
+ {
+ bOk = RET_CANCEL == ErrorBox( this,
+ WinBits( WB_OK_CANCEL | WB_DEF_OK),
+ aStrInvalidFmt
+ ).Execute();
+ }
+ }
+ else
+ bOk = TRUE;
+ delete pDlg;
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SwAutoFormatDlg, RemoveHdl, void *, EMPTYARG )
+{
+ String aMessage = aStrDelMsg ;
+ aMessage.AppendAscii("\n\n");
+ aMessage += aLbFormat.GetSelectEntry() ;
+ aMessage += '\n';
+
+ MessBox* pBox = new MessBox( this, WinBits( WB_OK_CANCEL ),
+ aStrDelTitle, aMessage);
+
+ if ( pBox->Execute() == RET_OK )
+ {
+ aLbFormat.RemoveEntry( nDfltStylePos + nIndex );
+ aLbFormat.SelectEntryPos( nDfltStylePos + nIndex-1 );
+
+ pTableTbl->DeleteAndDestroy( nIndex );
+ nIndex--;
+
+ if( !nIndex )
+ {
+ aBtnRemove.Enable(FALSE);
+ aBtnRename.Enable(FALSE);
+ }
+
+ if( !bCoreDataChanged )
+ {
+ aBtnCancel.SetText( aStrClose );
+ bCoreDataChanged = TRUE;
+ }
+ }
+ delete pBox;
+
+ SelFmtHdl( 0 );
+
+ return 0;
+}
+
+IMPL_LINK( SwAutoFormatDlg, RenameHdl, void *, EMPTYARG )
+{
+ BOOL bOk = FALSE;
+ while( !bOk )
+ {
+ SwStringInputDlg* pDlg = new SwStringInputDlg( this,
+ aStrRenameTitle, aLbFormat.GetSelectEntry(),
+ aEmptyStr );
+ if( pDlg->Execute() == RET_OK )
+ {
+ BOOL bFmtRenamed = FALSE;
+ String aFormatName;
+ pDlg->GetInputString( aFormatName );
+
+ if ( aFormatName.Len() > 0 )
+ {
+ USHORT n;
+ for( n = 0; n < pTableTbl->Count(); ++n )
+ if ((*pTableTbl)[n]->GetName() == aFormatName)
+ break;
+
+ if( n >= pTableTbl->Count() )
+ {
+ // Format mit dem Namen noch nicht vorhanden, also
+ // umbenennen
+
+ aLbFormat.RemoveEntry( nDfltStylePos + nIndex );
+ SwTableAutoFmtPtr p = (*pTableTbl)[ nIndex ];
+ pTableTbl->Remove( nIndex );
+
+ p->SetName( aFormatName );
+
+ // Sortiert einfuegen!!
+ for( n = 1; n < pTableTbl->Count(); ++n )
+ if( (*pTableTbl)[ n ]->GetName() > aFormatName )
+ break;
+
+ pTableTbl->Insert( p, n );
+ aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n );
+ aLbFormat.SelectEntryPos( nDfltStylePos + n );
+
+ if ( !bCoreDataChanged )
+ {
+ aBtnCancel.SetText( aStrClose );
+ bCoreDataChanged = TRUE;
+ }
+
+ SelFmtHdl( 0 );
+ bOk = TRUE;
+ bFmtRenamed = TRUE;
+ }
+ }
+
+ if( !bFmtRenamed )
+ {
+ bOk = RET_CANCEL == ErrorBox( this,
+ WinBits( WB_OK_CANCEL | WB_DEF_OK),
+ aStrInvalidFmt
+ ).Execute();
+ }
+ }
+ else
+ bOk = TRUE;
+ delete pDlg;
+ }
+ return 0;
+}
+
+//------------------------------------------------------------------------
+
+IMPL_LINK( SwAutoFormatDlg, SelFmtHdl, void *, EMPTYARG )
+{
+ BOOL bBtnEnable = FALSE;
+ BYTE nSelPos = (BYTE) aLbFormat.GetSelectEntryPos(), nOldIdx = nIndex;
+ if( nSelPos >= nDfltStylePos )
+ {
+ nIndex = nSelPos - nDfltStylePos;
+ pWndPreview->NotifyChange( *(*pTableTbl)[nIndex] );
+ bBtnEnable = 0 != nIndex;
+ UpdateChecks( *(*pTableTbl)[nIndex], TRUE );
+ }
+ else
+ {
+ nIndex = 255;
+
+ SwTableAutoFmt aTmp( ViewShell::GetShellRes()->aStrNone );
+ aTmp.SetFont( FALSE );
+ aTmp.SetJustify( FALSE );
+ aTmp.SetFrame( FALSE );
+ aTmp.SetBackground( FALSE );
+ aTmp.SetValueFormat( FALSE );
+ aTmp.SetWidthHeight( FALSE );
+
+ if( nOldIdx != nIndex )
+ pWndPreview->NotifyChange( aTmp );
+ UpdateChecks( aTmp, FALSE );
+ }
+
+ aBtnRemove.Enable( bBtnEnable );
+ aBtnRename.Enable( bBtnEnable );
+
+ return 0;
+}
+//------------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( SwAutoFormatDlg, OkHdl, Button *, EMPTYARG )
+{
+ if( bSetAutoFmt )
+ pShell->SetTableAutoFmt( *(*pTableTbl)[ nIndex ] );
+ EndDialog( RET_OK );
+ return TRUE;
+}
+IMPL_LINK_INLINE_END( SwAutoFormatDlg, OkHdl, Button *, EMPTYARG )
+
+//========================================================================
+// AutoFmtPreview
+
+//------------------------------------------------------------------------
+
+AutoFmtPreview::AutoFmtPreview( Window* pParent, const ResId& rRes, SwWrtShell* pWrtShell ) :
+ Window ( pParent, rRes ),
+
+ aCurData ( aEmptyStr ),
+ aVD ( *this ),
+ aScriptedText ( aVD ),
+ bFitWidth ( FALSE ),
+ mbRTL ( false ),
+ aPrvSize ( GetSizePixel().Width() - 6, GetSizePixel().Height() - 30 ),
+ nLabelColWidth ( (aPrvSize.Width() - 4) / 4 - 12 ),
+ nDataColWidth1 ( (aPrvSize.Width() - 4 - 2 * nLabelColWidth) / 3 ),
+ nDataColWidth2 ( (aPrvSize.Width() - 4 - 2 * nLabelColWidth) / 4 ),
+ nRowHeight ( (aPrvSize.Height() - 4) / 5 ),
+ aStrJan ( SW_RES( STR_JAN ) ),
+ aStrFeb ( SW_RES( STR_FEB ) ),
+ aStrMar ( SW_RES( STR_MAR ) ),
+ aStrNorth ( SW_RES( STR_NORTH ) ),
+ aStrMid ( SW_RES( STR_MID ) ),
+ aStrSouth ( SW_RES( STR_SOUTH ) ),
+ aStrSum ( SW_RES( STR_SUM ) ),
+ m_xMSF ( comphelper::getProcessServiceFactory() )
+{
+ if (!pWrtShell->IsCrsrInTbl()) // We haven't created the table yet
+ mbRTL = Application::GetSettings().GetLayoutRTL();
+ else
+ mbRTL = pWrtShell->IsTableRightToLeft();
+
+ DBG_ASSERT( m_xMSF.is(), "AutoFmtPreview: no MultiServiceFactory");
+ if ( m_xMSF.is() )
+ {
+ m_xBreak = uno::Reference< i18n::XBreakIterator >(
+ m_xMSF->createInstance (
+ rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ),
+ uno::UNO_QUERY);
+ }
+ pNumFmt = new SvNumberFormatter( m_xMSF, LANGUAGE_SYSTEM );
+
+ Init();
+}
+
+//------------------------------------------------------------------------
+
+__EXPORT AutoFmtPreview::~AutoFmtPreview()
+{
+ delete pNumFmt;
+}
+
+//------------------------------------------------------------------------
+
+static void lcl_SetFontProperties(
+ Font& rFont,
+ const SvxFontItem& rFontItem,
+ const SvxWeightItem& rWeightItem,
+ const SvxPostureItem& rPostureItem )
+{
+ rFont.SetFamily ( rFontItem.GetFamily() );
+ rFont.SetName ( rFontItem.GetFamilyName() );
+ rFont.SetStyleName ( rFontItem.GetStyleName() );
+ rFont.SetCharSet ( rFontItem.GetCharSet() );
+ rFont.SetPitch ( rFontItem.GetPitch() );
+ rFont.SetWeight ( (FontWeight)rWeightItem.GetValue() );
+ rFont.SetItalic ( (FontItalic)rPostureItem.GetValue() );
+}
+
+#define SETONALLFONTS( MethodName, Value ) \
+rFont.MethodName( Value ); \
+rCJKFont.MethodName( Value ); \
+rCTLFont.MethodName( Value );
+
+void AutoFmtPreview::MakeFonts( BYTE nIndex, Font& rFont, Font& rCJKFont, Font& rCTLFont )
+{
+ const SwBoxAutoFmt& rBoxFmt = aCurData.GetBoxFmt( nIndex );
+
+ rFont = rCJKFont = rCTLFont = GetFont();
+ Size aFontSize( rFont.GetSize().Width(), 10 );
+
+ lcl_SetFontProperties( rFont, rBoxFmt.GetFont(), rBoxFmt.GetWeight(), rBoxFmt.GetPosture() );
+ lcl_SetFontProperties( rCJKFont, rBoxFmt.GetCJKFont(), rBoxFmt.GetCJKWeight(), rBoxFmt.GetCJKPosture() );
+ lcl_SetFontProperties( rCTLFont, rBoxFmt.GetCTLFont(), rBoxFmt.GetCTLWeight(), rBoxFmt.GetCTLPosture() );
+
+ SETONALLFONTS( SetUnderline, (FontUnderline)rBoxFmt.GetUnderline().GetValue() );
+ SETONALLFONTS( SetOverline, (FontUnderline)rBoxFmt.GetOverline().GetValue() );
+ SETONALLFONTS( SetStrikeout, (FontStrikeout)rBoxFmt.GetCrossedOut().GetValue() );
+ SETONALLFONTS( SetOutline, rBoxFmt.GetContour().GetValue() );
+ SETONALLFONTS( SetShadow, rBoxFmt.GetShadowed().GetValue() );
+ SETONALLFONTS( SetColor, rBoxFmt.GetColor().GetValue() );
+ SETONALLFONTS( SetSize, aFontSize );
+ SETONALLFONTS( SetTransparent, TRUE );
+}
+
+//------------------------------------------------------------------------
+
+BYTE AutoFmtPreview::GetFormatIndex( size_t nCol, size_t nRow ) const
+{
+ static const BYTE pnFmtMap[] =
+ {
+ 0, 1, 2, 1, 3,
+ 4, 5, 6, 5, 7,
+ 8, 9, 10, 9, 11,
+ 4, 5, 6, 5, 7,
+ 12, 13, 14, 13, 15
+ };
+ return pnFmtMap[ maArray.GetCellIndex( nCol, nRow, mbRTL ) ];
+}
+
+const SvxBoxItem& AutoFmtPreview::GetBoxItem( size_t nCol, size_t nRow ) const
+{
+ return aCurData.GetBoxFmt( GetFormatIndex( nCol, nRow ) ).GetBox();
+}
+
+//------------------------------------------------------------------------
+
+void AutoFmtPreview::DrawString( size_t nCol, size_t nRow )
+{
+ //------------------------
+ // Ausgabe des Zelltextes:
+ //------------------------
+ ULONG nNum;
+ double nVal;
+ String cellString;
+ BYTE nIndex = static_cast< BYTE >( maArray.GetCellIndex( nCol, nRow, mbRTL ) );
+
+ switch( nIndex )
+ {
+ case 1: cellString = aStrJan; break;
+ case 2: cellString = aStrFeb; break;
+ case 3: cellString = aStrMar; break;
+ case 5: cellString = aStrNorth; break;
+ case 10: cellString = aStrMid; break;
+ case 15: cellString = aStrSouth; break;
+ case 4:
+ case 20: cellString = aStrSum; break;
+
+ case 6:
+ case 8:
+ case 16:
+ case 18: nVal = nIndex;
+ nNum = 5;
+ goto MAKENUMSTR;
+ case 17:
+ case 7: nVal = nIndex;
+ nNum = 6;
+ goto MAKENUMSTR;
+ case 11:
+ case 12:
+ case 13: nVal = nIndex;
+ nNum = 12 == nIndex ? 10 : 9;
+ goto MAKENUMSTR;
+
+ case 9: nVal = 21; nNum = 7; goto MAKENUMSTR;
+ case 14: nVal = 36; nNum = 11; goto MAKENUMSTR;
+ case 19: nVal = 51; nNum = 7; goto MAKENUMSTR;
+ case 21: nVal = 33; nNum = 13; goto MAKENUMSTR;
+ case 22: nVal = 36; nNum = 14; goto MAKENUMSTR;
+ case 23: nVal = 39; nNum = 13; goto MAKENUMSTR;
+ case 24: nVal = 108; nNum = 15; goto MAKENUMSTR;
+MAKENUMSTR:
+ if( aCurData.IsValueFormat() )
+ {
+ String sFmt; LanguageType eLng, eSys;
+ aCurData.GetBoxFmt( (BYTE)nNum ).GetValueFormat( sFmt, eLng, eSys );
+
+ short nType;
+ BOOL bNew;
+ xub_StrLen nCheckPos;
+ sal_uInt32 nKey = pNumFmt->GetIndexPuttingAndConverting( sFmt, eLng,
+ eSys, nType, bNew, nCheckPos);
+ Color* pDummy;
+ pNumFmt->GetOutputString( nVal, nKey, cellString, &pDummy );
+ }
+ else
+ cellString = String::CreateFromInt32((sal_Int32)nVal);
+ break;
+
+ }
+
+ if( cellString.Len() )
+ {
+ Size aStrSize;
+ BYTE nFmtIndex = GetFormatIndex( nCol, nRow );
+ Rectangle cellRect = maArray.GetCellRect( nCol, nRow );
+ Point aPos = cellRect.TopLeft();
+ USHORT nRightX = 0;
+// BOOL bJustify = aCurData.IsJustify();
+// ScHorJustifyAttr aHorJustifyItem;
+// CellHorJustify eJustification;
+
+ Size theMaxStrSize( cellRect.GetWidth() - FRAME_OFFSET,
+ cellRect.GetHeight() - FRAME_OFFSET );
+ if( aCurData.IsFont() )
+ {
+ Font aFont, aCJKFont, aCTLFont;
+ MakeFonts( nFmtIndex, aFont, aCJKFont, aCTLFont );
+ aScriptedText.SetFonts( &aFont, &aCJKFont, &aCTLFont );
+ }
+ else
+ aScriptedText.SetDefaultFont();
+
+ aScriptedText.SetText( cellString, m_xBreak );
+ aStrSize = aScriptedText.GetTextSize();
+
+ if( aCurData.IsFont() &&
+ theMaxStrSize.Height() < aStrSize.Height() )
+ {
+ // wenn der String in diesem Font nicht
+ // in die Zelle passt, wird wieder der
+ // Standard-Font genommen:
+ aScriptedText.SetDefaultFont();
+ aStrSize = aScriptedText.GetTextSize();
+ }
+
+ while( theMaxStrSize.Width() <= aStrSize.Width() &&
+ cellString.Len() > 1 )
+ {
+// if( eJustification == SVX_HOR_JUSTIFY_RIGHT )
+// cellString.Erase( 0, 1 );
+// else
+ cellString.Erase( cellString.Len() - 1 );
+ aScriptedText.SetText( cellString, m_xBreak );
+ aStrSize = aScriptedText.GetTextSize();
+ }
+
+ nRightX = (USHORT)( cellRect.GetWidth()
+ - aStrSize.Width()
+ - FRAME_OFFSET );
+ //-------------
+ // Ausrichtung:
+ //-------------
+ /* if ( bJustify )
+ {
+ aCurData.GetHorJustify( nFmtIndex, aHorJustifyItem );
+ eJustification = (CellHorJustify)aHorJustifyItem.GetValue();
+ }
+ else
+ {
+ eJustification = SC_HOR_JUSTIFY_STANDARD;
+ }*/
+
+ //-----------------------------
+ // vertikal (immer zentrieren):
+ //-----------------------------
+ aPos.Y() += (nRowHeight - (USHORT)aStrSize.Height()) / 2;
+
+ //-----------
+ // horizontal
+ //-----------
+/* if ( eJustification != SC_HOR_JUSTIFY_STANDARD )*/
+ if( mbRTL )
+ aPos.X() += nRightX;
+ else if (aCurData.IsJustify())
+ {
+ USHORT nHorPos = (USHORT)
+ ((cellRect.GetWidth()-aStrSize.Width())/2);
+ const SvxAdjustItem& rAdj = aCurData.GetBoxFmt(nFmtIndex).GetAdjust();
+ switch ( rAdj.GetAdjust() )
+ {
+ case SVX_ADJUST_LEFT:
+ aPos.X() += FRAME_OFFSET;
+ break;
+ case SVX_ADJUST_RIGHT:
+ aPos.X() += nRightX;
+ break;
+ default:
+ aPos.X() += nHorPos;
+ break;
+ }
+ }
+ else
+ {
+ //---------------------
+ // Standardausrichtung:
+ //---------------------
+ if ( (nCol == 0) || (nIndex == 4) )
+ {
+ // Text-Label links oder Summe linksbuendig
+ aPos.X() += FRAME_OFFSET;
+ }
+ else
+ {
+ // Zahlen/Datum rechtsbuendig
+ aPos.X() += nRightX;
+ }
+ }
+
+ //-------------------------------
+ aScriptedText.DrawText( aPos );
+ //-------------------------------
+ }
+}
+
+#undef FRAME_OFFSET
+
+//------------------------------------------------------------------------
+
+void AutoFmtPreview::DrawStrings()
+{
+ for( size_t nRow = 0; nRow < 5; ++nRow )
+ for( size_t nCol = 0; nCol < 5; ++nCol )
+ DrawString( nCol, nRow );
+}
+
+//------------------------------------------------------------------------
+
+
+void AutoFmtPreview::DrawBackground()
+{
+ for( size_t nRow = 0; nRow < 5; ++nRow )
+ {
+ for( size_t nCol = 0; nCol < 5; ++nCol )
+ {
+ SvxBrushItem aBrushItem( aCurData.GetBoxFmt( GetFormatIndex( nCol, nRow ) ).GetBackground() );
+
+ aVD.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
+ aVD.SetLineColor();
+ aVD.SetFillColor( aBrushItem.GetColor() );
+ aVD.DrawRect( maArray.GetCellRect( nCol, nRow ) );
+ aVD.Pop();
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+
+void AutoFmtPreview::PaintCells()
+{
+ // 1) background
+ if ( aCurData.IsBackground() )
+ DrawBackground();
+
+ // 2) values
+ DrawStrings();
+
+ // 3) border
+ if ( aCurData.IsFrame() )
+ maArray.DrawArray( aVD );
+}
+
+//------------------------------------------------------------------------
+
+
+void __EXPORT AutoFmtPreview::Init()
+{
+ SetBorderStyle( GetBorderStyle() | WINDOW_BORDER_MONO );
+ maArray.Initialize( 5, 5 );
+ maArray.SetUseDiagDoubleClipping( false );
+ CalcCellArray( FALSE );
+ CalcLineMap();
+}
+
+//------------------------------------------------------------------------
+
+
+void AutoFmtPreview::CalcCellArray( BOOL _bFitWidth )
+{
+ maArray.SetXOffset( 2 );
+ maArray.SetAllColWidths( _bFitWidth ? nDataColWidth2 : nDataColWidth1 );
+ maArray.SetColWidth( 0, nLabelColWidth );
+ maArray.SetColWidth( 4, nLabelColWidth );
+
+ maArray.SetYOffset( 2 );
+ maArray.SetAllRowHeights( nRowHeight );
+
+ aPrvSize.Width() = maArray.GetWidth() + 4;
+ aPrvSize.Height() = maArray.GetHeight() + 4;
+}
+
+//------------------------------------------------------------------------
+
+inline void lclSetStyleFromBorder( svx::frame::Style& rStyle, const SvxBorderLine* pBorder )
+{
+ rStyle.Set( pBorder, 0.05, 5 );
+}
+
+void AutoFmtPreview::CalcLineMap()
+{
+ for( size_t nRow = 0; nRow < 5; ++nRow )
+ {
+ for( size_t nCol = 0; nCol < 5; ++nCol )
+ {
+ svx::frame::Style aStyle;
+
+ const SvxBoxItem& rItem = GetBoxItem( nCol, nRow );
+ lclSetStyleFromBorder( aStyle, rItem.GetLeft() );
+ maArray.SetCellStyleLeft( nCol, nRow, aStyle );
+ lclSetStyleFromBorder( aStyle, rItem.GetRight() );
+ maArray.SetCellStyleRight( nCol, nRow, aStyle );
+ lclSetStyleFromBorder( aStyle, rItem.GetTop() );
+ maArray.SetCellStyleTop( nCol, nRow, aStyle );
+ lclSetStyleFromBorder( aStyle, rItem.GetBottom() );
+ maArray.SetCellStyleBottom( nCol, nRow, aStyle );
+
+// FIXME - uncomment to draw diagonal borders
+// lclSetStyleFromBorder( aStyle, GetDiagItem( nCol, nRow, true ).GetLine() );
+// maArray.SetCellStyleTLBR( nCol, nRow, aStyle );
+// lclSetStyleFromBorder( aStyle, GetDiagItem( nCol, nRow, false ).GetLine() );
+// maArray.SetCellStyleBLTR( nCol, nRow, aStyle );
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+
+void AutoFmtPreview::NotifyChange( const SwTableAutoFmt& rNewData )
+{
+ aCurData = rNewData;
+ bFitWidth = aCurData.IsJustify();//TRUE; //???
+ CalcCellArray( bFitWidth );
+ CalcLineMap();
+ DoPaint( Rectangle( Point(0,0), GetSizePixel() ) );
+}
+
+//------------------------------------------------------------------------
+
+
+void AutoFmtPreview::DoPaint( const Rectangle& /*rRect*/ )
+{
+ sal_uInt32 nOldDrawMode = aVD.GetDrawMode();
+ if( GetSettings().GetStyleSettings().GetHighContrastMode() &&
+ SW_MOD()->GetAccessibilityOptions().GetIsForBorders() )
+ aVD.SetDrawMode( DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
+
+ Bitmap thePreview;
+ Point aCenterPos;
+ Size theWndSize = GetSizePixel();
+ Size thePrevSize;
+ Color oldColor;
+ Font aFont;
+
+ aFont = aVD.GetFont();
+ aFont.SetTransparent( TRUE );
+
+ aVD.SetFont ( aFont );
+ aVD.SetLineColor ();
+ const Color& rWinColor = GetSettings().GetStyleSettings().GetWindowColor();
+ aVD.SetBackground ( Wallpaper(rWinColor) );
+ aVD.SetFillColor ( rWinColor );
+ aVD.SetOutputSizePixel ( aPrvSize );
+
+ //--------------------------------
+ // Zellen auf virtual Device malen
+ // und Ergebnis sichern
+ //--------------------------------
+ PaintCells();
+ thePreview = aVD.GetBitmap( Point(0,0), aPrvSize );
+
+ //--------------------------------------
+ // Rahmen malen und Vorschau zentrieren:
+ // (virtual Device fuer Fensterausgabe)
+ //--------------------------------------
+ aVD.SetOutputSizePixel( theWndSize );
+ oldColor = aVD.GetLineColor();
+ aVD.SetLineColor();
+ aVD.DrawRect( Rectangle( Point(0,0), theWndSize ) );
+ SetLineColor( oldColor );
+ aCenterPos = Point( (theWndSize.Width() - aPrvSize.Width() ) / 2,
+ (theWndSize.Height() - aPrvSize.Height()) / 2 );
+ aVD.DrawBitmap( aCenterPos, thePreview );
+
+ //----------------------------
+ // Ausgabe im Vorschaufenster:
+ //----------------------------
+ DrawBitmap( Point(0,0), aVD.GetBitmap( Point(0,0), theWndSize ) );
+
+ aVD.SetDrawMode( nOldDrawMode );
+}
+
+//------------------------------------------------------------------------
+
+void __EXPORT AutoFmtPreview::Paint( const Rectangle& rRect )
+{
+ DoPaint( rRect );
+}
diff --git a/sw/source/ui/table/tautofmt.hrc b/sw/source/ui/table/tautofmt.hrc
new file mode 100644
index 000000000000..5ffd2d3eb8d3
--- /dev/null
+++ b/sw/source/ui/table/tautofmt.hrc
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_TAUTOFMT_HRC
+#define SW_TAUTOFMT_HRC
+
+#include "table.hrc"
+// allgemein
+#define BTN_OK 100
+#define BTN_CANCEL 102
+#define BTN_HELP 103
+#define BTN_MORE 104
+#define BTN_ADD 105
+#define BTN_REMOVE 106
+#define BTN_RENAME 107
+#define FT_LABEL 110
+#define FL_FRAME 111
+#define STR_BTN_CLOSE 200
+
+// Autoformat
+#define LB_FORMAT 1
+#define FL_FORMAT 9
+#define FL_FORMATS 29
+#define WND_PREVIEW 19
+#define BTN_NUMFORMAT 20
+#define BTN_BORDER 21
+#define BTN_FONT 23
+#define BTN_PATTERN 24
+#define BTN_ALIGNMENT 25
+//#define BTN_ADJUST 26
+#define STR_ADD_TITLE 100
+#define STR_ADD_LABEL 101
+#define STR_DEL_TITLE 102
+#define STR_DEL_MSG 103
+#define STR_INVALID_AFNAME 104
+#define STR_RENAME_TITLE 105
+ // Autoformat-Preview:
+#define STR_JAN 121
+#define STR_FEB 122
+#define STR_MAR 123
+#define STR_NORTH 124
+#define STR_MID 125
+#define STR_SOUTH 126
+#define STR_SUM 127
+
+// Gruppierung setzen/aufheben:
+#define BTN_GROUP_COLS 1
+#define BTN_GROUP_ROWS 3
+#define STR_GROUP 1
+#define STR_UNGROUP 2
+
+
+#define ED_INPUT 1
+
+#endif
diff --git a/sw/source/ui/table/tautofmt.src b/sw/source/ui/table/tautofmt.src
new file mode 100644
index 000000000000..e338dc9a4b73
--- /dev/null
+++ b/sw/source/ui/table/tautofmt.src
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "tautofmt.hrc"
+#include "helpid.h"
+ModalDialog DLG_AUTOFMT_TABLE
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ HelpID = HID_AUTOFMT_TABLE ;
+ Size = MAP_APPFONT ( 312 , 120 ) ;
+ Text [ en-US ] = "AutoFormat" ;
+ Moveable = TRUE ;
+ FixedLine FL_FORMAT
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 243 , 8 ) ;
+ Text [ en-US ] = "Format" ;
+ };
+ ListBox LB_FORMAT
+ {
+ HelpID = "sw:ListBox:DLG_AUTOFMT_TABLE:LB_FORMAT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 65 , 100 ) ;
+ TabStop = TRUE ;
+ };
+ Window WND_PREVIEW
+ {
+ Pos = MAP_APPFONT ( 83 , 14 ) ;
+ Size = MAP_APPFONT ( 161 , 100 ) ;
+ Border = TRUE;
+ };
+ CheckBox BTN_NUMFORMAT
+ {
+ HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_NUMFORMAT";
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 131 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Number format" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_BORDER
+ {
+ HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_BORDER";
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 147 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Borders" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_FONT
+ {
+ HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_FONT";
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 85 , 131 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "F~ont" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_PATTERN
+ {
+ HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_PATTERN";
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 85 , 147 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "~Pattern" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_ALIGNMENT
+ {
+ HelpID = "sw:CheckBox:DLG_AUTOFMT_TABLE:BTN_ALIGNMENT";
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 150 , 131 ) ;
+ Size = MAP_APPFONT ( 60 , 10 ) ;
+ Text [ en-US ] = "Alignmen~t" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_FORMATS
+ {
+ Hide = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 120 ) ;
+ Size = MAP_APPFONT ( 243 , 8 ) ;
+ Text [ en-US ] = "Formatting" ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 255 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 255 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ MoreButton BTN_MORE
+ {
+ HelpID = "sw:MoreButton:DLG_AUTOFMT_TABLE:BTN_MORE";
+ Pos = MAP_APPFONT ( 255 , 101 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~More" ;
+ TabStop = TRUE ;
+ MapUnit = MAP_APPFONT ;
+ Delta = 48 ;
+ };
+ PushButton BTN_ADD
+ {
+ HelpID = "sw:PushButton:DLG_AUTOFMT_TABLE:BTN_ADD";
+ Pos = MAP_APPFONT ( 255 , 64 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Add" ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_REMOVE
+ {
+ HelpID = "sw:PushButton:DLG_AUTOFMT_TABLE:BTN_REMOVE";
+ Pos = MAP_APPFONT ( 255 , 81 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ Text [ en-US ] = "~Delete" ;
+ TabStop = TRUE ;
+ };
+ PushButton BTN_RENAME
+ {
+ HelpID = "sw:PushButton:DLG_AUTOFMT_TABLE:BTN_RENAME";
+ Pos = MAP_APPFONT ( 255 , 123 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Text [ en-US ] = "~Rename" ;
+ };
+ HelpButton BTN_HELP
+ {
+ Pos = MAP_APPFONT ( 255 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ String STR_ADD_TITLE
+ {
+ Text [ en-US ] = "Add AutoFormat" ;
+ };
+ String STR_ADD_LABEL
+ {
+ Text [ en-US ] = "Name" ;
+ };
+ String STR_DEL_TITLE
+ {
+ Text [ en-US ] = "Delete AutoFormat" ;
+ };
+ String STR_DEL_MSG
+ {
+ Text [ en-US ] = "The following AutoFormat entry will be deleted:" ;
+ };
+ String STR_RENAME_TITLE
+ {
+ Text [ en-US ] = "Rename AutoFormat" ;
+ };
+ String STR_BTN_CLOSE
+ {
+ Text [ en-US ] = "~Close" ;
+ };
+ String STR_JAN
+ {
+ Text [ en-US ] = "Jan" ;
+ };
+ String STR_FEB
+ {
+ Text [ en-US ] = "Feb" ;
+ };
+ String STR_MAR
+ {
+ Text [ en-US ] = "Mar" ;
+ };
+ String STR_NORTH
+ {
+ Text [ en-US ] = "North" ;
+ };
+ String STR_MID
+ {
+ Text [ en-US ] = "Mid" ;
+ };
+ String STR_SOUTH
+ {
+ Text [ en-US ] = "South" ;
+ };
+ String STR_SUM
+ {
+ Text [ en-US ] = "Sum" ;
+ };
+ String STR_INVALID_AFNAME
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Sie haben einen ungültigen Namen angegeben.\nDas AutoFormat konnte nicht angelegt werden.\nWählen Sie einen anderen Namen. : Sie haben einen ungültigen Namen angegeben.\nDas Autoformat konnte nicht angelegt werden.\nWählen Sie einen anderen Namen. */
+ /* ### ACHTUNG: Neuer Text in Resource? Sie haben einen ungültigen Namen angegeben.\nDas AutoFormat konnte nicht angelegt werden.\nWählen Sie einen anderen Namen. : Sie haben einen ungültigen Namen angegeben.\nDas Autoformat konnte nicht angelegt werden.\nWählen Sie einen anderen Namen. */
+ Text [ en-US ] = "You have entered an invalid name.\nThe desired AutoFormat could not be created. \nTry again using a different name." ;
+ };
+};
+ModalDialog DLG_SWDLG_STRINPUT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 172 , 63 ) ;
+ Moveable = TRUE ;
+ Closeable = TRUE ;
+ HelpID = HID_SWDLG_STRINPUT ;
+ Edit ED_INPUT
+ {
+ HelpID = "sw:Edit:DLG_SWDLG_STRINPUT:ED_INPUT";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 6 , 24 ) ;
+ Size = MAP_APPFONT ( 104 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ FixedText FT_LABEL
+ {
+ Pos = MAP_APPFONT ( 6 , 13 ) ;
+ Size = MAP_APPFONT ( 90 , 10 ) ;
+ Text = "Label" ;
+ };
+ OKButton BTN_OK
+ {
+ Pos = MAP_APPFONT ( 116 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BTN_CANCEL
+ {
+ Pos = MAP_APPFONT ( 116 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/uiview/formatclipboard.cxx b/sw/source/ui/uiview/formatclipboard.cxx
new file mode 100644
index 000000000000..3c77dc41d4d6
--- /dev/null
+++ b/sw/source/ui/uiview/formatclipboard.cxx
@@ -0,0 +1,617 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include "formatclipboard.hxx"
+
+
+#include <hintids.hxx>
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <format.hxx>
+#include <charfmt.hxx>
+#include <fmtcol.hxx>
+#include <frmfmt.hxx>
+#include <docstyle.hxx>
+#include <fchrfmt.hxx>
+#include <pam.hxx>
+// header for class SdrView
+#include <svx/svdview.hxx>
+//SvxBrushItem
+#include <editeng/brshitem.hxx>
+#include <editeng/shaditem.hxx>
+#include <frmatr.hxx>
+// header for class SvxBoxInfoItem
+#include <editeng/boxitem.hxx>
+// header for class SvxFmtBreakItem
+#include <editeng/brkitem.hxx>
+// header for class SwFmtLayoutSplit
+#include <fmtlsplt.hxx>
+// header for class SvxFmtKeepItem
+#include <editeng/keepitem.hxx>
+// header for class SvxFrameDirectionItem
+#include <editeng/frmdiritem.hxx>
+#include <paratr.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtrowsplt.hxx>
+#include <swundo.hxx> // fuer die UndoIds
+#include <boost/shared_ptr.hpp>
+
+//#define FORMAT_PAINTBRUSH_ALSO_COPY_NUMBERFORMAT_FOR_TABLES 1
+
+#ifdef FORMAT_PAINTBRUSH_ALSO_COPY_NUMBERFORMAT_FOR_TABLES
+#include <cellatr.hxx>
+#endif
+
+/*--------------------------------------------------------------------
+ --------------------------------------------------------------------*/
+
+namespace
+{
+#define FORMAT_PAINTBRUSH_FRAME_IDS \
+RES_FRMATR_BEGIN, RES_FILL_ORDER, \
+/* no RES_FRM_SIZE */ \
+RES_PAPER_BIN, RES_SURROUND, \
+/* no RES_VERT_ORIENT */ \
+/* no RES_HORI_ORIENT */ \
+/* no RES_ANCHOR */ \
+RES_BACKGROUND, RES_SHADOW, \
+/* no RES_FRMMACRO */ \
+RES_COL, RES_KEEP, \
+/* no RES_URL */ \
+RES_EDIT_IN_READONLY, RES_LAYOUT_SPLIT, \
+/* no RES_CHAIN */ \
+RES_TEXTGRID, RES_FRMATR_END-1,
+
+#define FORMAT_PAINTBRUSH_PARAGRAPH_IDS \
+RES_PARATR_BEGIN, RES_PARATR_END -1, \
+RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END -1, \
+FORMAT_PAINTBRUSH_FRAME_IDS \
+FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART, \
+FN_NUMBER_NEWSTART_AT, FN_NUMBER_NEWSTART_AT,
+
+SfxItemSet* lcl_CreateEmptyItemSet( int nSelectionType, SfxItemPool& rPool
+ , bool bNoCharacterFormats = false, bool bNoParagraphFormats = false )
+{
+ SfxItemSet* pItemSet = 0;
+ if( nSelectionType & (nsSelectionType::SEL_FRM | nsSelectionType::SEL_OLE | nsSelectionType::SEL_GRF) )
+ {
+ pItemSet = new SfxItemSet(rPool,
+ FORMAT_PAINTBRUSH_FRAME_IDS
+ 0);
+ }
+ else if( nSelectionType & nsSelectionType::SEL_DRW )
+ {
+ //is handled different
+ }
+ else if( nSelectionType == nsSelectionType::SEL_TBL )
+ {
+ pItemSet = new SfxItemSet(rPool,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW, //SID_ATTR_BORDER_OUTER is inbetween
+ RES_BACKGROUND, RES_SHADOW, //RES_BOX is inbetween
+ SID_ATTR_BRUSH_ROW, SID_ATTR_BRUSH_TABLE,
+ RES_BREAK, RES_BREAK,
+ RES_PAGEDESC, RES_PAGEDESC,
+ RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT,
+ RES_ROW_SPLIT, RES_ROW_SPLIT,
+ RES_KEEP, RES_KEEP,
+ RES_FRAMEDIR, RES_FRAMEDIR,
+ FN_PARAM_TABLE_HEADLINE, FN_PARAM_TABLE_HEADLINE,
+ FN_TABLE_BOX_TEXTDIRECTION, FN_TABLE_BOX_TEXTDIRECTION,
+ FN_TABLE_SET_VERT_ALIGN, FN_TABLE_SET_VERT_ALIGN,
+#ifdef FORMAT_PAINTBRUSH_ALSO_COPY_NUMBERFORMAT_FOR_TABLES
+ RES_BOXATR_FORMAT, RES_BOXATR_FORMAT,
+#endif
+ 0);
+ }
+ else if( nSelectionType & nsSelectionType::SEL_TXT )
+ {
+ if( bNoCharacterFormats )
+ pItemSet = new SfxItemSet(rPool,
+ FORMAT_PAINTBRUSH_PARAGRAPH_IDS
+ 0);
+ else if( bNoParagraphFormats )
+ pItemSet = new SfxItemSet(rPool,
+ RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
+ 0);
+ else
+ pItemSet = new SfxItemSet(rPool,
+ RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
+ FORMAT_PAINTBRUSH_PARAGRAPH_IDS
+ 0);
+ }
+ return pItemSet;
+}
+
+void lcl_getTableAttributes( SfxItemSet& rSet, SwWrtShell &rSh )
+{
+ SvxBrushItem aBrush( RES_BACKGROUND );
+ rSh.GetBoxBackground(aBrush);
+ rSet.Put( aBrush );
+ if(rSh.GetRowBackground(aBrush))
+ rSet.Put( aBrush, SID_ATTR_BRUSH_ROW );
+ else
+ rSet.InvalidateItem(SID_ATTR_BRUSH_ROW);
+ rSh.GetTabBackground(aBrush);
+ rSet.Put( aBrush, SID_ATTR_BRUSH_TABLE );
+
+ SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+ rSet.Put(aBoxInfo);
+ rSh.GetTabBorders( rSet );
+
+ SvxFrameDirectionItem aBoxDirection( FRMDIR_ENVIRONMENT, RES_FRAMEDIR );
+ if(rSh.GetBoxDirection( aBoxDirection ))
+ rSet.Put(aBoxDirection, FN_TABLE_BOX_TEXTDIRECTION);
+
+ rSet.Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, rSh.GetBoxAlign()));
+
+ rSet.Put( SfxUInt16Item( FN_PARAM_TABLE_HEADLINE, rSh.GetRowsToRepeat() ) );
+
+ SwFrmFmt *pFrmFmt = rSh.GetTableFmt();
+ if(pFrmFmt)
+ {
+ rSet.Put( pFrmFmt->GetShadow() );
+ rSet.Put( pFrmFmt->GetBreak() );
+ rSet.Put( pFrmFmt->GetPageDesc() );
+ rSet.Put( pFrmFmt->GetLayoutSplit() );
+ rSet.Put( pFrmFmt->GetKeep() );
+ rSet.Put( pFrmFmt->GetFrmDir() );
+ }
+
+ SwFmtRowSplit* pSplit = 0;
+ rSh.GetRowSplit(pSplit);
+ if(pSplit)
+ rSet.Put(*pSplit);
+
+ //-- numberformat in cells
+#ifdef FORMAT_PAINTBRUSH_ALSO_COPY_NUMBERFORMAT_FOR_TABLES
+ rSh.GetTblBoxFormulaAttrs( rSet ); //RES_BOXATR_FORMAT
+#endif
+}
+
+void lcl_setTableAttributes( const SfxItemSet& rSet, SwWrtShell &rSh )
+{
+ const SfxPoolItem* pItem = 0;
+ BOOL bBorder = ( SFX_ITEM_SET == rSet.GetItemState( RES_BOX ) ||
+ SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER ) );
+ pItem = 0;
+ BOOL bBackground = SFX_ITEM_SET == rSet.GetItemState( RES_BACKGROUND, FALSE, &pItem );
+ const SfxPoolItem* pRowItem = 0, *pTableItem = 0;
+ bBackground |= SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BRUSH_ROW, FALSE, &pRowItem );
+ bBackground |= SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BRUSH_TABLE, FALSE, &pTableItem );
+
+ if(bBackground)
+ {
+ if(pItem)
+ rSh.SetBoxBackground( *(const SvxBrushItem*)pItem );
+ if(pRowItem)
+ {
+ SvxBrushItem aBrush(*(const SvxBrushItem*)pRowItem);
+ aBrush.SetWhich(RES_BACKGROUND);
+ rSh.SetRowBackground(aBrush);
+ }
+ if(pTableItem)
+ {
+ SvxBrushItem aBrush(*(const SvxBrushItem*)pTableItem);
+ aBrush.SetWhich(RES_BACKGROUND);
+ rSh.SetTabBackground( aBrush );
+ }
+ }
+ if(bBorder)
+ rSh.SetTabBorders( rSet );
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, FALSE, &pItem) )
+ rSh.SetRowsToRepeat( ((SfxUInt16Item*)pItem)->GetValue() );
+
+ SwFrmFmt* pFrmFmt = rSh.GetTableFmt();
+ if(pFrmFmt)
+ {
+ //RES_SHADOW
+ pItem=0;
+ rSet.GetItemState(rSet.GetPool()->GetWhich(RES_SHADOW), FALSE, &pItem);
+ if(pItem)
+ pFrmFmt->SetFmtAttr( *pItem );
+
+ //RES_BREAK
+ pItem=0;
+ rSet.GetItemState(rSet.GetPool()->GetWhich(RES_BREAK), FALSE, &pItem);
+ if(pItem)
+ pFrmFmt->SetFmtAttr( *pItem );
+
+ //RES_PAGEDESC
+ pItem=0;
+ rSet.GetItemState(rSet.GetPool()->GetWhich(RES_PAGEDESC), FALSE, &pItem);
+ if(pItem)
+ pFrmFmt->SetFmtAttr( *pItem );
+
+ //RES_LAYOUT_SPLIT
+ pItem=0;
+ rSet.GetItemState(rSet.GetPool()->GetWhich(RES_LAYOUT_SPLIT), FALSE, &pItem);
+ if(pItem)
+ pFrmFmt->SetFmtAttr( *pItem );
+
+ //RES_KEEP
+ pItem=0;
+ rSet.GetItemState(rSet.GetPool()->GetWhich(RES_KEEP), FALSE, &pItem);
+ if(pItem)
+ pFrmFmt->SetFmtAttr( *pItem );
+
+ //RES_FRAMEDIR
+ pItem=0;
+ rSet.GetItemState(rSet.GetPool()->GetWhich(RES_FRAMEDIR), FALSE, &pItem);
+ if(pItem)
+ pFrmFmt->SetFmtAttr( *pItem );
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_BOX_TEXTDIRECTION, FALSE, &pItem) )
+ {
+ SvxFrameDirectionItem aDirection( FRMDIR_ENVIRONMENT, RES_FRAMEDIR );
+ aDirection.SetValue(static_cast< const SvxFrameDirectionItem* >(pItem)->GetValue());
+ rSh.SetBoxDirection(aDirection);
+ }
+
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_SET_VERT_ALIGN, FALSE, &pItem))
+ rSh.SetBoxAlign(((SfxUInt16Item*)(pItem))->GetValue());
+
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_ROW_SPLIT, FALSE, &pItem) )
+ rSh.SetRowSplit(*static_cast<const SwFmtRowSplit*>(pItem));
+
+ //-- numberformat in cells
+#ifdef FORMAT_PAINTBRUSH_ALSO_COPY_NUMBERFORMAT_FOR_TABLES
+ if( SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMAT, FALSE, &pItem ))
+ {
+ SfxItemSet aBoxSet( *rSet.GetPool(), RES_BOXATR_FORMAT, RES_BOXATR_FORMAT );
+ aBoxSet.Put( SwTblBoxNumFormat( ((SfxUInt32Item*)pItem)->GetValue() ));
+ rSh.SetTblBoxFormulaAttrs( aBoxSet );
+
+ }
+#endif
+}
+}//end anonymous namespace
+
+SwFormatClipboard::SwFormatClipboard()
+ : m_nSelectionType(0)
+ , m_pItemSet(0)
+ , m_pTableItemSet(0)
+ , m_bPersistentCopy(false)
+{
+}
+SwFormatClipboard::~SwFormatClipboard()
+{
+ if(m_pItemSet)
+ delete m_pItemSet;
+ if(m_pTableItemSet)
+ delete m_pTableItemSet;
+}
+
+bool SwFormatClipboard::HasContent() const
+{
+ return m_pItemSet!=0
+ || m_pTableItemSet != 0
+ || m_aCharStyle.Len()
+ || m_aParaStyle.Len()
+ ;
+}
+bool SwFormatClipboard::HasContentForThisType( int nSelectionType ) const
+{
+ if( !HasContent() )
+ return false;
+
+ if( m_nSelectionType == nSelectionType )
+ return true;
+
+ if( ( nSelectionType & (nsSelectionType::SEL_FRM | nsSelectionType::SEL_OLE | nsSelectionType::SEL_GRF) )
+ &&
+ ( m_nSelectionType & (nsSelectionType::SEL_FRM | nsSelectionType::SEL_OLE | nsSelectionType::SEL_GRF) )
+ )
+ return true;
+
+ if( nSelectionType & nsSelectionType::SEL_TXT && m_nSelectionType & nsSelectionType::SEL_TXT )
+ return true;
+
+ return false;
+}
+
+bool SwFormatClipboard::CanCopyThisType( int nSelectionType ) const
+{
+ if( nSelectionType & (nsSelectionType::SEL_FRM | nsSelectionType::SEL_OLE | nsSelectionType::SEL_GRF
+ | nsSelectionType::SEL_TXT | nsSelectionType::SEL_DRW | nsSelectionType::SEL_TBL | nsSelectionType::SEL_TBL_CELLS ) )
+ return true;
+ return false;
+}
+
+void SwFormatClipboard::Copy( SwWrtShell& rWrtShell, SfxItemPool& rPool, bool bPersistentCopy )
+{
+ this->Erase();
+ m_bPersistentCopy = bPersistentCopy;
+
+ int nSelectionType = rWrtShell.GetSelectionType();
+ SfxItemSet* pItemSet = lcl_CreateEmptyItemSet( nSelectionType, rPool );
+
+ rWrtShell.StartAction();
+ rWrtShell.Push();
+ if( nSelectionType == nsSelectionType::SEL_TXT )
+ {
+ SwPaM* pCrsr = rWrtShell.GetCrsr();
+ //select one character only to get the attributes of this single character only
+ BOOL bHasSelection = pCrsr->HasMark();
+ BOOL bForwardSelection = FALSE;
+
+ if(!bHasSelection) //check for and handle multiselections
+ {
+ if( pCrsr->GetPrev() != pCrsr && pCrsr->GetPrev() != 0)
+ {
+ pCrsr = (SwPaM*)pCrsr->GetPrev();
+ bForwardSelection = (*pCrsr->GetPoint()) > (*pCrsr->GetMark());
+ bHasSelection = true;
+ pCrsr->DeleteMark();
+ pCrsr->SetMark();
+ rWrtShell.KillPams();
+ pCrsr = rWrtShell.GetCrsr();
+ }
+ }
+ else
+ bForwardSelection = (*pCrsr->GetPoint()) > (*pCrsr->GetMark());
+ pCrsr->DeleteMark();
+ pCrsr->SetMark();
+
+ if( !bHasSelection && rWrtShell.IsInRightToLeftText() )
+ bForwardSelection = !bForwardSelection;
+
+ if( !( !bHasSelection && rWrtShell.IsEndPara() ) )
+ pCrsr->Move( bForwardSelection ? fnMoveBackward : fnMoveForward );
+ }
+
+ if(pItemSet)
+ {
+ if( nSelectionType & (nsSelectionType::SEL_FRM | nsSelectionType::SEL_OLE | nsSelectionType::SEL_GRF) )
+ rWrtShell.GetFlyFrmAttr(*pItemSet);
+ else
+ {
+ rWrtShell.GetCurAttr(*pItemSet);
+
+ // additional numbering properties for paragraph styles
+ if( nSelectionType & nsSelectionType::SEL_TXT && rWrtShell.GetCurNumRule() )
+ {
+ SfxBoolItem aStart(FN_NUMBER_NEWSTART, rWrtShell.IsNumRuleStart());
+ pItemSet->Put(aStart);
+ SfxUInt16Item aStartAt(FN_NUMBER_NEWSTART_AT, rWrtShell.GetNodeNumStart());
+ pItemSet->Put(aStartAt);
+ }
+ }
+ }
+ else if ( nSelectionType & nsSelectionType::SEL_DRW )
+ {
+ SdrView* pDrawView = rWrtShell.GetDrawView();
+ if(pDrawView)
+ {
+ BOOL bOnlyHardAttr = TRUE;
+ if( pDrawView->AreObjectsMarked() )
+ {
+ pItemSet = new SfxItemSet( pDrawView->GetAttrFromMarked(bOnlyHardAttr) );
+ //remove attributes defining the type/data of custom shapes
+ pItemSet->ClearItem(SDRATTR_CUSTOMSHAPE_ENGINE);
+ pItemSet->ClearItem(SDRATTR_CUSTOMSHAPE_DATA);
+ pItemSet->ClearItem(SDRATTR_CUSTOMSHAPE_GEOMETRY);
+ pItemSet->ClearItem(SDRATTR_CUSTOMSHAPE_REPLACEMENT_URL);
+ }
+ }
+ }
+ if( nSelectionType & nsSelectionType::SEL_TBL_CELLS )//only copy table attributes if really cells are selected (not only text in tables)
+ {
+ m_pTableItemSet = lcl_CreateEmptyItemSet( nsSelectionType::SEL_TBL, rPool );
+ lcl_getTableAttributes( *m_pTableItemSet, rWrtShell );
+ }
+
+ m_nSelectionType = nSelectionType;
+ m_pItemSet = pItemSet;
+
+ if( nSelectionType & nsSelectionType::SEL_TXT )
+ {
+ SwFmt* pFmt = rWrtShell.GetCurCharFmt();
+ if( pFmt )
+ m_aCharStyle = pFmt->GetName();
+
+ pFmt = rWrtShell.GetCurTxtFmtColl();
+ if( pFmt )
+ m_aParaStyle = pFmt->GetName();
+ }
+ rWrtShell.Pop(FALSE);
+ rWrtShell.EndAction();
+}
+typedef boost::shared_ptr< SfxPoolItem > SfxPoolItemSharedPtr;
+typedef std::vector< SfxPoolItemSharedPtr > ItemVector;
+// #144857# collect all PoolItems from the applied styles
+void lcl_AppendSetItems( ItemVector& rItemVector, const SfxItemSet& rStyleAttrSet )
+{
+ const USHORT* pRanges = rStyleAttrSet.GetRanges();
+ while( *pRanges )
+ {
+ for ( USHORT nWhich = *pRanges; nWhich <= *(pRanges+1); ++nWhich )
+ {
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == rStyleAttrSet.GetItemState( nWhich, sal_False, &pItem ) )
+ {
+ rItemVector.push_back( SfxPoolItemSharedPtr( pItem->Clone() ) );
+ }
+ }
+ pRanges += 2;
+ }
+}
+// #144857# remove all items that are inherited from the styles
+void lcl_RemoveEqualItems( SfxItemSet& rTemplateItemSet, ItemVector& rItemVector )
+{
+ ItemVector::iterator aEnd = rItemVector.end();
+ ItemVector::iterator aIter = rItemVector.begin();
+ while( aIter != aEnd )
+ {
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == rTemplateItemSet.GetItemState( (*aIter)->Which(), sal_True, &pItem ) &&
+ *pItem == *(*aIter) )
+ {
+ rTemplateItemSet.ClearItem( (*aIter)->Which() );
+ }
+ ++aIter;
+ }
+}
+
+void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, SfxStyleSheetBasePool* pPool
+ , bool bNoCharacterFormats, bool bNoParagraphFormats )
+{
+ int nSelectionType = rWrtShell.GetSelectionType();
+ if( !this->HasContentForThisType(nSelectionType) )
+ {
+ if(!m_bPersistentCopy)
+ this->Erase();
+ return;
+ }
+
+ rWrtShell.StartAction();
+ rWrtShell.StartUndo(UNDO_INSATTR);
+
+ ItemVector aItemVector;
+ if(pPool) //to find the styles we need the pool
+ {
+ if( nSelectionType & nsSelectionType::SEL_TXT )
+ {
+ if(m_aCharStyle.Len() && !bNoCharacterFormats )
+ {
+ SwDocStyleSheet* pStyle = (SwDocStyleSheet*)pPool->Find(m_aCharStyle, SFX_STYLE_FAMILY_CHAR);
+ if( pStyle )
+ {
+ SwFmtCharFmt aFmt(pStyle->GetCharFmt());
+ // #144857# collect items from character style
+ lcl_AppendSetItems( aItemVector, aFmt.GetCharFmt()->GetAttrSet());
+ USHORT nFlags=0; //(nMode & KEY_SHIFT) ? SETATTR_DONTREPLACE : SETATTR_DEFAULT;
+ rWrtShell.SetAttr( aFmt, nFlags );
+ }
+ }
+ if(m_aParaStyle.Len() && !bNoParagraphFormats )
+ {
+ SwDocStyleSheet* pStyle = (SwDocStyleSheet*)pPool->Find(m_aParaStyle, SFX_STYLE_FAMILY_PARA);
+ if( pStyle )
+ {
+ // #144857# collect items from paragraph style
+ lcl_AppendSetItems( aItemVector, pStyle->GetCollection()->GetAttrSet());
+ rWrtShell.SetTxtFmtColl( pStyle->GetCollection() );
+ }
+ }
+ }
+ }
+ if(m_pItemSet)
+ {
+ if( nSelectionType & nsSelectionType::SEL_DRW )
+ {
+ SdrView* pDrawView = rWrtShell.GetDrawView();
+ if(pDrawView)
+ {
+ BOOL bReplaceAll = TRUE;
+ pDrawView->SetAttrToMarked(*m_pItemSet, bReplaceAll);
+ }
+ }
+ else
+ {
+ SfxItemSet* pTemplateItemSet = lcl_CreateEmptyItemSet(
+ nSelectionType, *m_pItemSet->GetPool()
+ , bNoCharacterFormats, bNoParagraphFormats );
+ if(pTemplateItemSet)
+ {
+ pTemplateItemSet->Put( *m_pItemSet );
+ // #144857# only _set_ attributes that differ from style attributes should be applied - the style is applied anyway
+ lcl_RemoveEqualItems( *pTemplateItemSet, aItemVector );
+
+ if( nSelectionType & (nsSelectionType::SEL_FRM | nsSelectionType::SEL_OLE | nsSelectionType::SEL_GRF) )
+ rWrtShell.SetFlyFrmAttr(*pTemplateItemSet);
+ else
+ {
+ rWrtShell.SetAttr(*pTemplateItemSet);
+
+ // additional numbering properties for paragraph styles
+ if( nSelectionType & nsSelectionType::SEL_TXT && rWrtShell.GetCurNumRule() )
+ {
+ if( SFX_ITEM_SET == pTemplateItemSet->GetItemState(FN_NUMBER_NEWSTART) )
+ {
+ BOOL bStart = ((SfxBoolItem&)pTemplateItemSet->Get(FN_NUMBER_NEWSTART)).GetValue();
+ USHORT nNumStart = USHRT_MAX;
+ if( SFX_ITEM_SET == pTemplateItemSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
+ {
+ nNumStart = ((SfxUInt16Item&)pTemplateItemSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
+ if(USHRT_MAX != nNumStart)
+ bStart = FALSE;
+ }
+ rWrtShell.SetNumRuleStart(bStart);
+ rWrtShell.SetNodeNumStart(nNumStart);
+ }
+ else if( SFX_ITEM_SET == pTemplateItemSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
+ {
+ USHORT nNumStart = ((SfxUInt16Item&)pTemplateItemSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
+ rWrtShell.SetNodeNumStart(nNumStart);
+ rWrtShell.SetNumRuleStart(FALSE);
+ }
+ }
+ }
+ delete pTemplateItemSet;
+ }
+ }
+ }
+
+ if( m_pTableItemSet && nSelectionType & (nsSelectionType::SEL_TBL | nsSelectionType::SEL_TBL_CELLS) )
+ lcl_setTableAttributes( *m_pTableItemSet, rWrtShell );
+
+ rWrtShell.EndUndo(UNDO_INSATTR);
+ rWrtShell.EndAction();
+
+ if(!m_bPersistentCopy)
+ this->Erase();
+}
+
+void SwFormatClipboard::Erase()
+{
+ m_nSelectionType = 0;
+ if(m_pItemSet)
+ {
+ delete m_pItemSet;
+ m_pItemSet = 0;
+ }
+ if(m_pTableItemSet)
+ {
+ delete m_pTableItemSet;
+ m_pTableItemSet = 0;
+ }
+ if( m_aCharStyle.Len() )
+ m_aCharStyle.Erase();
+ if( m_aParaStyle.Len() )
+ m_aParaStyle.Erase();
+
+ m_bPersistentCopy = false;
+}
diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx
new file mode 100644
index 000000000000..fd5d57ae35c0
--- /dev/null
+++ b/sw/source/ui/uiview/pview.cxx
@@ -0,0 +1,2199 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <sfx2/objface.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/help.hxx>
+#include <vcl/cmdevt.hxx>
+#include <vcl/button.hxx>
+#include <svl/whiter.hxx>
+#include <svl/stritem.hxx>
+#include <svl/eitem.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/progress.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/stddlg.hxx>
+#include <editeng/paperinf.hxx>
+#include <svl/srchitem.hxx>
+#include <svx/svdview.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/zoomslideritem.hxx>
+#include <svx/svxids.hrc>
+
+#include <swwait.hxx>
+#include <globdoc.hxx>
+#include <wdocsh.hxx>
+#include <pvprtdat.hxx>
+#include <swmodule.hxx>
+#include <modcfg.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <viewopt.hxx>
+#include <doc.hxx>
+#include <pview.hxx>
+#include <view.hxx>
+#include <textsh.hxx>
+#include <scroll.hxx>
+#include <prtopt.hxx>
+#include <docstat.hxx>
+#include <usrpref.hxx>
+#include <viewfunc.hxx>
+
+#include <helpid.h>
+#include <cmdid.h>
+#include <globals.hrc>
+#include <popup.hrc>
+#include <pview.hrc>
+
+#define SwPagePreView
+#include <sfx2/msg.hxx>
+#include <swslots.hxx>
+// OD 12.12.2002 #103492#
+#include <pagepreviewlayout.hxx>
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include <vos/mutex.hxx>
+
+
+using namespace ::com::sun::star;
+
+SFX_IMPL_NAMED_VIEWFACTORY(SwPagePreView, "PrintPreview")
+{
+ SFX_VIEW_REGISTRATION(SwDocShell);
+ SFX_VIEW_REGISTRATION(SwWebDocShell);
+ SFX_VIEW_REGISTRATION(SwGlobalDocShell);
+}
+
+SFX_IMPL_INTERFACE(SwPagePreView, SfxViewShell, SW_RES(RID_PVIEW_TOOLBOX))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_PPREVIEW_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT|SFX_VISIBILITY_STANDARD|
+ SFX_VISIBILITY_CLIENT|SFX_VISIBILITY_FULLSCREEN|
+ SFX_VISIBILITY_READONLYDOC,
+ SW_RES(RID_PVIEW_TOOLBOX));
+}
+
+
+TYPEINIT1(SwPagePreView,SfxViewShell)
+
+#define SWVIEWFLAGS ( SFX_VIEW_CAN_PRINT|SFX_VIEW_HAS_PRINTOPTIONS )
+
+#define MIN_PREVIEW_ZOOM 25
+#define MAX_PREVIEW_ZOOM 600
+/* */
+/* -----------------26.11.2002 10:41-----------------
+ *
+ * --------------------------------------------------*/
+USHORT lcl_GetNextZoomStep(USHORT nCurrentZoom, BOOL bZoomIn)
+{
+ static USHORT aZoomArr[] =
+ {
+ 25, 50, 75, 100, 150, 200, 400, 600
+ };
+ const sal_uInt16 nZoomArrSize = sizeof(aZoomArr)/sizeof(USHORT);
+ if(bZoomIn)
+ for(int i = nZoomArrSize - 1; i >= 0; --i)
+ {
+ if(nCurrentZoom > aZoomArr[i] || !i)
+ return aZoomArr[i];
+ }
+ else
+ for(int i = 0; i < nZoomArrSize; ++i)
+ {
+ if(nCurrentZoom < aZoomArr[i])
+ return aZoomArr[i];
+ }
+ return bZoomIn ? MAX_PREVIEW_ZOOM : MIN_PREVIEW_ZOOM;
+};
+/* -----------------02.12.2002 09:11-----------------
+ *
+ * --------------------------------------------------*/
+void lcl_InvalidateZoomSlots(SfxBindings& rBindings)
+{
+ static USHORT __READONLY_DATA aInval[] =
+ {
+ SID_ATTR_ZOOM, SID_ZOOM_OUT, SID_ZOOM_IN, SID_ATTR_ZOOMSLIDER, FN_PREVIEW_ZOOM, FN_STAT_ZOOM,
+ 0
+ };
+ rBindings.Invalidate( aInval );
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+// erstmal der Zoom-Dialog
+
+class SwPreViewZoomDlg : public SvxStandardDialog
+{
+ FixedText aRowLbl;
+ NumericField aRowEdit;
+ FixedText aColLbl;
+ NumericField aColEdit;
+
+ OKButton aOkBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+ virtual void Apply();
+
+public:
+ SwPreViewZoomDlg( SwPagePreViewWin& rParent );
+ ~SwPreViewZoomDlg();
+};
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwPreViewZoomDlg::SwPreViewZoomDlg( SwPagePreViewWin& rParent ) :
+ SvxStandardDialog( &rParent, SW_RES(DLG_PAGEPREVIEW_ZOOM) ),
+ aRowLbl(this,SW_RES(FT_ROW)),
+ aRowEdit(this,SW_RES(ED_ROW)),
+ aColLbl(this,SW_RES(FT_COL)),
+ aColEdit(this,SW_RES(ED_COL)),
+ aOkBtn(this,SW_RES(BT_OK)),
+ aCancelBtn(this,SW_RES(BT_CANCEL)),
+ aHelpBtn(this,SW_RES(BT_HELP))
+{
+ FreeResource();
+
+ aRowEdit.SetValue( rParent.GetRow() );
+ aColEdit.SetValue( rParent.GetCol() );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwPreViewZoomDlg::~SwPreViewZoomDlg() {}
+
+
+void SwPreViewZoomDlg::Apply()
+{
+ ((SwPagePreViewWin*)GetParent())->CalcWish(
+ BYTE(aRowEdit.GetValue()),
+ BYTE(aColEdit.GetValue()) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+// alles fuers SwPagePreViewWin
+
+
+SwPagePreViewWin::SwPagePreViewWin( Window *pParent, SwPagePreView& rPView )
+ : Window( pParent, WinBits( WB_CLIPCHILDREN) ),
+ mpViewShell( 0 ),
+ mrView( rPView ),
+ mbCalcScaleForPreviewLayout( true ),
+ maPaintedPreviewDocRect( Rectangle(0,0,0,0) )
+{
+ SetOutDevViewType( OUTDEV_VIEWTYPE_PRINTPREVIEW ); //#106611#
+ SetHelpId(HID_PAGEPREVIEW);
+ SetFillColor( GetBackground().GetColor() );
+ SetLineColor( GetBackground().GetColor());
+ SetMapMode( MapMode(MAP_TWIP) );
+
+ const SwMasterUsrPref *pUsrPref = SW_MOD()->GetUsrPref(FALSE);
+ mnRow = pUsrPref->GetPagePrevRow(); // 1 Zeile
+ mnCol = pUsrPref->GetPagePrevCol(); // 1 Spalte
+ // OD 24.03.2003 #108282# - member <mnVirtPage> no longer exists.
+ mnSttPage = USHRT_MAX;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwPagePreViewWin::~SwPagePreViewWin()
+{
+ if( mpViewShell )
+ delete mpViewShell;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwPagePreViewWin::Paint( const Rectangle& rRect )
+{
+ if( !mpViewShell || !mpViewShell->GetLayout() )
+ return;
+
+ if( USHRT_MAX == mnSttPage ) // wurde noch nie berechnet ? (Init-Phase!)
+ {
+ // das ist die Size, auf die ich mich immer beziehe
+ if( !maPxWinSize.Height() || !maPxWinSize.Width() )
+ maPxWinSize = GetOutputSizePixel();
+
+ Rectangle aRect( LogicToPixel( rRect ));
+ mpPgPrevwLayout->Prepare( 1, Point(0,0), maPxWinSize,
+ mnSttPage, maPaintedPreviewDocRect );
+ SetSelectedPage( 1 );
+ mpPgPrevwLayout->Paint( PixelToLogic( aRect ) );
+ SetPagePreview(mnRow, mnCol);
+ }
+ else
+ {
+ MapMode aMM( GetMapMode() );
+ aMM.SetScaleX( maScale );
+ aMM.SetScaleY( maScale );
+ SetMapMode( aMM );
+ mpPgPrevwLayout->Paint( rRect );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+void SwPagePreViewWin::CalcWish( BYTE nNewRow, BYTE nNewCol )
+{
+ if( !mpViewShell || !mpViewShell->GetLayout() )
+ return;
+
+ USHORT nOldCol = mnCol;
+ // OD 02.12.2002 #103492# - update <mnRow> and <mnCol>.
+ mnRow = nNewRow;
+ mnCol = nNewCol;
+ USHORT nPages = mnRow * mnCol,
+ nLastSttPg = mrView.GetPageCount()+1 > nPages
+ ? mrView.GetPageCount()+1 - nPages : 0;
+ if( mnSttPage > nLastSttPg )
+ mnSttPage = nLastSttPg;
+
+ mpPgPrevwLayout->Init( mnCol, mnRow, maPxWinSize, true );
+ mpPgPrevwLayout->Prepare( mnSttPage, Point(0,0), maPxWinSize,
+ mnSttPage, maPaintedPreviewDocRect );
+ SetSelectedPage( mnSttPage );
+ SetPagePreview(mnRow, mnCol);
+ maScale = GetMapMode().GetScaleX();
+
+ // falls an der Spaltigkeit gedreht wurde, so muss der Sonderfall
+ // Einspaltig beachtet und ggfs. der Scrollbar korrigiert werden
+ if( (1 == nOldCol) ^ (1 == mnCol) )
+ mrView.ScrollDocSzChg();
+
+ // Sortierung muss eingehalten werden!!
+ // OD 24.03.2003 #108282# - additional invalidate page status.
+ static USHORT __READONLY_DATA aInval[] =
+ {
+ SID_ATTR_ZOOM, SID_ZOOM_OUT, SID_ZOOM_IN,
+ FN_PREVIEW_ZOOM,
+ FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN,
+ FN_STAT_PAGE, FN_STAT_ZOOM,
+ FN_SHOW_TWO_PAGES, FN_SHOW_MULTIPLE_PAGES,
+ 0
+ };
+ SfxBindings& rBindings = mrView.GetViewFrame()->GetBindings();
+ rBindings.Invalidate( aInval );
+ rBindings.Update( FN_SHOW_TWO_PAGES );
+ rBindings.Update( FN_SHOW_MULTIPLE_PAGES );
+ // OD 18.12.2002 #103492# - adjust scrollbars
+ mrView.ScrollViewSzChg();
+}
+/*--------------------------------------------------------------------
+ Beschreibung:, mnSttPage is Absolute
+ --------------------------------------------------------------------*/
+
+
+int SwPagePreViewWin::MovePage( int eMoveMode )
+{
+ // soviele Seiten hoch
+ USHORT nPages = mnRow * mnCol;
+ USHORT nNewSttPage = mnSttPage;
+ // OD 04.12.2002 #103492#
+ USHORT nPageCount = mrView.GetPageCount();
+ USHORT nDefSttPg = GetDefSttPage();
+ // OD 06.12.2002 #103492#
+ bool bPaintPageAtFirstCol = true;
+
+ switch( eMoveMode )
+ {
+ case MV_PAGE_UP:
+ {
+ const sal_uInt16 nRelSttPage = mpPgPrevwLayout->ConvertAbsoluteToRelativePageNum( mnSttPage );
+ const sal_uInt16 nNewAbsSttPage = nRelSttPage - nPages > 0 ?
+ mpPgPrevwLayout->ConvertRelativeToAbsolutePageNum( nRelSttPage - nPages ) :
+ nDefSttPg;
+ nNewSttPage = nNewAbsSttPage;
+
+ const sal_uInt16 nRelSelPage = mpPgPrevwLayout->ConvertAbsoluteToRelativePageNum( SelectedPage() );
+ const sal_uInt16 nNewRelSelPage = nRelSelPage - nPages > 0 ?
+ nRelSelPage - nPages :
+ 1;
+ SetSelectedPage( mpPgPrevwLayout->ConvertRelativeToAbsolutePageNum( nNewRelSelPage ) );
+
+ break;
+ }
+ case MV_PAGE_DOWN:
+ {
+ const sal_uInt16 nRelSttPage = mpPgPrevwLayout->ConvertAbsoluteToRelativePageNum( mnSttPage );
+ const sal_uInt16 nNewAbsSttPage = mpPgPrevwLayout->ConvertRelativeToAbsolutePageNum( nRelSttPage + nPages );
+ nNewSttPage = nNewAbsSttPage < nPageCount ? nNewAbsSttPage : nPageCount;
+
+ const sal_uInt16 nRelSelPage = mpPgPrevwLayout->ConvertAbsoluteToRelativePageNum( SelectedPage() );
+ const sal_uInt16 nNewAbsSelPage = mpPgPrevwLayout->ConvertRelativeToAbsolutePageNum( nRelSelPage + nPages );
+ SetSelectedPage( nNewAbsSelPage < nPageCount ? nNewAbsSelPage : nPageCount );
+
+ break;
+ }
+ case MV_DOC_STT:
+ nNewSttPage = nDefSttPg;
+ SetSelectedPage( mpPgPrevwLayout->ConvertRelativeToAbsolutePageNum( nNewSttPage ? nNewSttPage : 1 ) );
+ break;
+ case MV_DOC_END:
+ // OD 03.12.2002 #103492# - correct calculation of new start page.
+ nNewSttPage = nPageCount;
+ SetSelectedPage( nPageCount );
+ break;
+ // OD 12.12.2002 #103492# - add new move mode
+ case MV_SELPAGE:
+ // <nNewSttPage> and <SelectedPage()> are already set.
+ // OD 20.02.2003 #107369# - not start at first column, only if the
+ // complete preview layout columns doesn't fit into window.
+ if ( !mpPgPrevwLayout->DoesPreviewLayoutColsFitIntoWindow() )
+ bPaintPageAtFirstCol = false;
+ break;
+ case MV_SCROLL:
+ // OD 17.01.2003 #103492# - check, if paint page at first column
+ // has to be avoided
+ if ( !mpPgPrevwLayout->DoesPreviewLayoutRowsFitIntoWindow() ||
+ !mpPgPrevwLayout->DoesPreviewLayoutColsFitIntoWindow() )
+ bPaintPageAtFirstCol = false;
+ break;
+ case MV_NEWWINSIZE:
+ // OD 18.12.2002 #103492# - nothing special to do.
+ break;
+ case MV_CALC:
+ // OD 18.12.2002 #103492# - re-init page preview layout.
+ mpPgPrevwLayout->ReInit();
+
+ // OD 03.12.2002 #103492# - correct calculation of new start page.
+ if( nNewSttPage > nPageCount )
+ nNewSttPage = nPageCount;
+
+ // OD 18.12.2002 #103492# - correct selected page number
+ if( SelectedPage() > nPageCount )
+ SetSelectedPage( nNewSttPage ? nNewSttPage : 1 );
+ }
+
+ mpPgPrevwLayout->Prepare( nNewSttPage, Point(0,0), maPxWinSize,
+ nNewSttPage,
+ maPaintedPreviewDocRect, bPaintPageAtFirstCol );
+ if( nNewSttPage == mnSttPage &&
+ eMoveMode != MV_SELPAGE )
+ return FALSE;
+
+ SetPagePreview(mnRow, mnCol);
+ mnSttPage = nNewSttPage;
+
+ // OD 24.03.2003 #108282# - additional invalidate page status.
+ static USHORT __READONLY_DATA aInval[] =
+ {
+ FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN,
+ FN_STAT_PAGE, 0
+ };
+
+ SfxBindings& rBindings = mrView.GetViewFrame()->GetBindings();
+ rBindings.Invalidate( aInval );
+
+ return TRUE;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwPagePreViewWin::SetWinSize( const Size& rNewSize )
+{
+ // die Size wollen wir aber immer in Pixel-Einheiten haben
+ maPxWinSize = LogicToPixel( rNewSize );
+
+ if( USHRT_MAX == mnSttPage )
+ {
+ mnSttPage = GetDefSttPage();
+ SetSelectedPage( GetDefSttPage() );
+ }
+
+ if ( mbCalcScaleForPreviewLayout )
+ {
+ mpPgPrevwLayout->Init( mnCol, mnRow, maPxWinSize, true );
+ maScale = GetMapMode().GetScaleX();
+ }
+ mpPgPrevwLayout->Prepare( mnSttPage, Point(0,0), maPxWinSize,
+ mnSttPage, maPaintedPreviewDocRect );
+ if ( mbCalcScaleForPreviewLayout )
+ {
+ SetSelectedPage( mnSttPage );
+ mbCalcScaleForPreviewLayout = false;
+ }
+ SetPagePreview(mnRow, mnCol);
+ maScale = GetMapMode().GetScaleX();
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwPagePreViewWin::GetStatusStr( String& rStr, USHORT nPageCnt ) const
+{
+ // OD 24.03.2003 #108282# - show physical and virtual page number of
+ // selected page, if it's visible.
+ sal_uInt16 nPageNum;
+ if ( mpPgPrevwLayout->IsPageVisible( mpPgPrevwLayout->SelectedPage() ) )
+ {
+ nPageNum = mpPgPrevwLayout->SelectedPage();
+ }
+ else
+ {
+ nPageNum = mnSttPage > 1 ? mnSttPage : 1;
+ }
+ sal_uInt16 nVirtPageNum = mpPgPrevwLayout->GetVirtPageNumByPageNum( nPageNum );
+ if( nVirtPageNum && nVirtPageNum != nPageNum )
+ {
+ rStr += String::CreateFromInt32( nVirtPageNum );
+ rStr += ' ';
+ }
+ rStr += String::CreateFromInt32( nPageNum );
+ rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" / "));
+ rStr += String::CreateFromInt32( nPageCnt );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwPagePreViewWin::KeyInput( const KeyEvent &rKEvt )
+{
+ const KeyCode& rKeyCode = rKEvt.GetKeyCode();
+ USHORT nKey = rKeyCode.GetCode();
+ BOOL bHandled = FALSE;
+ if(!rKeyCode.GetModifier())
+ {
+ USHORT nSlot = 0;
+ switch(nKey)
+ {
+ case KEY_ADD : nSlot = SID_ZOOM_OUT; break;
+ case KEY_ESCAPE: nSlot = FN_CLOSE_PAGEPREVIEW; break;
+ case KEY_SUBTRACT : nSlot = SID_ZOOM_IN; break;
+ }
+ if(nSlot)
+ {
+ bHandled = TRUE;
+ mrView.GetViewFrame()->GetDispatcher()->Execute(
+ nSlot, SFX_CALLMODE_ASYNCHRON );
+ }
+ }
+ if( !bHandled && !mrView.KeyInput( rKEvt ) )
+ Window::KeyInput( rKEvt );
+}
+
+/******************************************************************************
+ * Beschreibung:
+ ******************************************************************************/
+
+void SwPagePreViewWin::Command( const CommandEvent& rCEvt )
+{
+ BOOL bCallBase = TRUE;
+ switch( rCEvt.GetCommand() )
+ {
+ case COMMAND_CONTEXTMENU:
+ mrView.GetViewFrame()->GetDispatcher()->ExecutePopup();
+ bCallBase = FALSE;
+ break;
+
+ case COMMAND_WHEEL:
+ case COMMAND_STARTAUTOSCROLL:
+ case COMMAND_AUTOSCROLL:
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if( pData )
+ {
+ const CommandWheelData aDataNew(pData->GetDelta(),pData->GetNotchDelta(),COMMAND_WHEEL_PAGESCROLL,
+ pData->GetMode(),pData->GetModifier(),pData->IsHorz(), pData->IsDeltaPixel());
+ const CommandEvent aEvent( rCEvt.GetMousePosPixel(),rCEvt.GetCommand(),rCEvt.IsMouseEvent(),&aDataNew);
+ bCallBase = !mrView.HandleWheelCommands( aEvent );
+ }
+ else
+ bCallBase = !mrView.HandleWheelCommands( rCEvt );
+ }
+ break;
+ default:
+ // OD 17.12.2002 #103492# - delete assertion
+ ;
+ }
+
+ if( bCallBase )
+ Window::Command( rCEvt );
+}
+
+void SwPagePreViewWin::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ // OD 17.12.2002 #103492# - consider single-click to set selected page
+ if( MOUSE_LEFT == ( rMEvt.GetModifier() + rMEvt.GetButtons() ) )
+ {
+ Point aPrevwPos( PixelToLogic( rMEvt.GetPosPixel() ) );
+ Point aDocPos;
+ bool bPosInEmptyPage;
+ sal_uInt16 nNewSelectedPage;
+ bool bIsDocPos =
+ mpPgPrevwLayout->IsPrevwPosInDocPrevwPage( aPrevwPos,
+ aDocPos, bPosInEmptyPage, nNewSelectedPage );
+ if ( bIsDocPos && rMEvt.GetClicks() == 2 )
+ {
+ // close page preview, set new cursor position and switch to
+ // normal view.
+ String sNewCrsrPos( String::CreateFromInt32( aDocPos.X() ));
+ ((( sNewCrsrPos += ';' )
+ += String::CreateFromInt32( aDocPos.Y() )) )
+ += ';';
+ mrView.SetNewCrsrPos( sNewCrsrPos );
+
+ SfxViewFrame *pTmpFrm = mrView.GetViewFrame();
+ pTmpFrm->GetBindings().Execute( SID_VIEWSHELL0, NULL, 0,
+ SFX_CALLMODE_ASYNCHRON );
+ }
+ else if ( bIsDocPos || bPosInEmptyPage )
+ // OD 2004-03-04 #i20684# - add missing parenthesis
+ {
+ // show clicked page as the selected one
+ mpPgPrevwLayout->MarkNewSelectedPage( nNewSelectedPage );
+ GetViewShell()->ShowPreViewSelection( nNewSelectedPage );
+ // OD 19.02.2003 #107369# - adjust position at vertical scrollbar.
+ if ( mpPgPrevwLayout->DoesPreviewLayoutRowsFitIntoWindow() )
+ {
+ mrView.SetVScrollbarThumbPos( nNewSelectedPage );
+ }
+ // OD 24.03.2003 #108282# - invalidate page status.
+ static USHORT __READONLY_DATA aInval[] =
+ {
+ FN_STAT_PAGE, 0
+ };
+ SfxBindings& rBindings = mrView.GetViewFrame()->GetBindings();
+ rBindings.Invalidate( aInval );
+ }
+ }
+}
+
+/******************************************************************************
+ * Beschreibung: Userprefs bzw Viewoptions setzen
+ ******************************************************************************/
+
+
+void SwPagePreViewWin::SetPagePreview( BYTE nRow, BYTE nCol )
+{
+ SwMasterUsrPref *pOpt = (SwMasterUsrPref *)SW_MOD()->GetUsrPref(FALSE);
+
+ if (nRow != pOpt->GetPagePrevRow() || nCol != pOpt->GetPagePrevCol())
+ {
+ pOpt->SetPagePrevRow( nRow );
+ pOpt->SetPagePrevCol( nCol );
+ pOpt->SetModified();
+
+ //Scrollbar updaten!
+ mrView.ScrollViewSzChg();
+ }
+}
+
+/** get selected page in document preview
+
+ OD 13.12.2002 #103492#
+
+ @author OD
+*/
+sal_uInt16 SwPagePreViewWin::SelectedPage() const
+{
+ return mpPgPrevwLayout->SelectedPage();
+}
+
+/** set selected page number in document preview
+
+ OD 13.12.2002 #103492#
+
+ @author OD
+*/
+void SwPagePreViewWin::SetSelectedPage( sal_uInt16 _nSelectedPageNum )
+{
+ mpPgPrevwLayout->SetSelectedPage( _nSelectedPageNum );
+}
+
+/** method to enable/disable book preview
+
+ OD 2004-03-05 #i18143#
+
+ @author OD
+*/
+bool SwPagePreViewWin::SetBookPreviewMode( const bool _bBookPreview )
+{
+ return mpPgPrevwLayout->SetBookPreviewMode( _bBookPreview,
+ mnSttPage,
+ maPaintedPreviewDocRect );
+}
+
+void SwPagePreViewWin::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+
+ switch( rDCEvt.GetType() )
+ {
+ case DATACHANGED_SETTINGS:
+ // ScrollBars neu anordnen bzw. Resize ausloesen, da sich
+ // ScrollBar-Groesse geaendert haben kann. Dazu muss dann im
+ // Resize-Handler aber auch die Groesse der ScrollBars aus
+ // den Settings abgefragt werden.
+ if( rDCEvt.GetFlags() & SETTINGS_STYLE )
+ mrView.InvalidateBorder(); //Scrollbarbreiten
+ //#106746# zoom has to be disabled if Accessibility support is switched on
+ lcl_InvalidateZoomSlots(mrView.GetViewFrame()->GetBindings());
+ break;
+
+ case DATACHANGED_PRINTER:
+ case DATACHANGED_DISPLAY:
+ case DATACHANGED_FONTS:
+ case DATACHANGED_FONTSUBSTITUTION:
+ mrView.GetDocShell()->UpdateFontList(); //Fontwechsel
+ if ( mpViewShell->GetWin() )
+ mpViewShell->GetWin()->Invalidate();
+ break;
+ }
+}
+
+/** help method to execute SfxRequest FN_PAGEUP and FN_PAGEDOWN
+
+ OD 04.03.2003 #107369#
+
+ @author OD
+*/
+void SwPagePreView::_ExecPgUpAndPgDown( const bool _bPgUp,
+ SfxRequest* _pReq )
+{
+ SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout();
+ // check, if top/bottom of preview is *not* already visible.
+ if( pPagePrevwLay->GetWinPagesScrollAmount( _bPgUp ? -1 : 1 ) != 0 )
+ {
+ if ( pPagePrevwLay->DoesPreviewLayoutRowsFitIntoWindow() &&
+ pPagePrevwLay->DoesPreviewLayoutColsFitIntoWindow() )
+ {
+ const int eMvMode = _bPgUp ?
+ SwPagePreViewWin::MV_PAGE_UP :
+ SwPagePreViewWin::MV_PAGE_DOWN;
+ if ( ChgPage( eMvMode, TRUE ) )
+ aViewWin.Invalidate();
+ }
+ else
+ {
+ SwTwips nScrollAmount;
+ sal_uInt16 nNewSelectedPageNum = 0;
+ const sal_uInt16 nVisPages = aViewWin.GetRow() * aViewWin.GetCol();
+ if( _bPgUp )
+ {
+ if ( pPagePrevwLay->DoesPreviewLayoutRowsFitIntoWindow() )
+ {
+ nScrollAmount = pPagePrevwLay->GetWinPagesScrollAmount( -1 );
+ if ( (aViewWin.SelectedPage() - nVisPages) > 0 )
+ nNewSelectedPageNum = aViewWin.SelectedPage() - nVisPages;
+ else
+ nNewSelectedPageNum = 1;
+ }
+ else
+ nScrollAmount = - Min( aViewWin.GetOutputSize().Height(),
+ aViewWin.GetPaintedPreviewDocRect().Top() );
+ }
+ else
+ {
+ if ( pPagePrevwLay->DoesPreviewLayoutRowsFitIntoWindow() )
+ {
+ nScrollAmount = pPagePrevwLay->GetWinPagesScrollAmount( 1 );
+ if ( (aViewWin.SelectedPage() + nVisPages) <= mnPageCount )
+ nNewSelectedPageNum = aViewWin.SelectedPage() + nVisPages;
+ else
+ nNewSelectedPageNum = mnPageCount;
+ }
+ else
+ nScrollAmount = Min( aViewWin.GetOutputSize().Height(),
+ ( pPagePrevwLay->GetPrevwDocSize().Height() -
+ aViewWin.GetPaintedPreviewDocRect().Bottom() ) );
+ }
+ aViewWin.Scroll( 0, nScrollAmount );
+ if ( nNewSelectedPageNum != 0 )
+ {
+ aViewWin.SetSelectedPage( nNewSelectedPageNum );
+ }
+ ScrollViewSzChg();
+ // OD 24.03.2003 #108282# - additional invalidate page status.
+ static USHORT __READONLY_DATA aInval[] =
+ {
+ FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN,
+ FN_STAT_PAGE, 0
+ };
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( aInval );
+ aViewWin.Invalidate();
+ }
+ }
+
+ if ( _pReq )
+ _pReq->Done();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+// dann mal alles fuer die SwPagePreView
+void SwPagePreView::Execute( SfxRequest &rReq )
+{
+ int eMvMode;
+ BYTE nRow = 1;
+ BOOL bRetVal = FALSE;
+ bool bRefresh = true;
+
+ switch(rReq.GetSlot())
+ {
+ case FN_REFRESH_VIEW:
+ case FN_STAT_PAGE:
+ case FN_STAT_ZOOM:
+ break;
+
+ case FN_SHOW_MULTIPLE_PAGES:
+ {
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ if( pArgs && pArgs->Count() >= 2 )
+ {
+ BYTE nCols = (BYTE)((SfxUInt16Item &)pArgs->Get(
+ SID_ATTR_TABLE_COLUMN)).GetValue();
+ BYTE nRows = (BYTE)((SfxUInt16Item &)pArgs->Get(
+ SID_ATTR_TABLE_ROW)).GetValue();
+ aViewWin.CalcWish( nRows, nCols );
+
+ }
+ else
+ SwPreViewZoomDlg( aViewWin ).Execute();
+
+ }
+ break;
+ case FN_SHOW_BOOKVIEW:
+ {
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+ bool bBookPreview = GetViewShell()->GetViewOptions()->IsPagePrevBookview();
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_SHOW_BOOKVIEW, FALSE, &pItem ) )
+ {
+ bBookPreview = static_cast< const SfxBoolItem* >( pItem )->GetValue();
+ ( ( SwViewOption* ) GetViewShell()->GetViewOptions() )->SetPagePrevBookview( bBookPreview );
+ // cast is not gentleman like, but it's common use in writer and in this case
+ }
+ if ( aViewWin.SetBookPreviewMode( bBookPreview ) )
+ {
+ // book preview mode changed. Thus, adjust scrollbars and
+ // invalidate corresponding states.
+ ScrollViewSzChg();
+ static USHORT __READONLY_DATA aInval[] =
+ {
+ FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN,
+ FN_STAT_PAGE, FN_SHOW_BOOKVIEW, 0
+ };
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( aInval );
+ aViewWin.Invalidate();
+ }
+
+ }
+ break;
+ case FN_SHOW_TWO_PAGES:
+ aViewWin.CalcWish( nRow, 2 );
+ break;
+
+ case FN_PREVIEW_ZOOM:
+ case SID_ATTR_ZOOM:
+ {
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+ AbstractSvxZoomDialog *pDlg = 0;
+ if(!pArgs)
+ {
+ SfxItemSet aCoreSet(GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM);
+ const SwViewOption* pVOpt = GetViewShell()->GetViewOptions();
+ SvxZoomItem aZoom( (SvxZoomType)pVOpt->GetZoomType(),
+ pVOpt->GetZoom() );
+ aZoom.SetValueSet(
+ SVX_ZOOM_ENABLE_50|
+ SVX_ZOOM_ENABLE_75|
+ SVX_ZOOM_ENABLE_100|
+ SVX_ZOOM_ENABLE_150|
+ SVX_ZOOM_ENABLE_200|
+ SVX_ZOOM_ENABLE_WHOLEPAGE);
+ aCoreSet.Put( aZoom );
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aCoreSet);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ }
+
+ pDlg->SetLimits( MINZOOM, MAXZOOM );
+
+ if( pDlg->Execute() != RET_CANCEL )
+ pArgs = pDlg->GetOutputItemSet();
+ }
+ if( pArgs )
+ {
+ enum SvxZoomType eType = SVX_ZOOM_PERCENT;
+ USHORT nZoomFactor = USHRT_MAX;
+ if(SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_ZOOM, TRUE, &pItem))
+ {
+ eType = ((const SvxZoomItem *)pItem)->GetType();
+ nZoomFactor = ((const SvxZoomItem *)pItem)->GetValue();
+ }
+ else if(SFX_ITEM_SET == pArgs->GetItemState(FN_PREVIEW_ZOOM, TRUE, &pItem))
+ nZoomFactor = ((const SfxUInt16Item *)pItem)->GetValue();
+ if(USHRT_MAX != nZoomFactor)
+ SetZoom(eType, nZoomFactor);
+ }
+ delete pDlg;
+ }
+ break;
+ case SID_ATTR_ZOOMSLIDER :
+ {
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+
+ if ( pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_ZOOMSLIDER, TRUE, &pItem ) )
+ {
+ const USHORT nCurrentZoom = ((const SvxZoomSliderItem *)pItem)->GetValue();
+ SetZoom( SVX_ZOOM_PERCENT, nCurrentZoom );
+ }
+ }
+ break;
+ case SID_ZOOM_IN:
+ case SID_ZOOM_OUT:
+ {
+ enum SvxZoomType eType = SVX_ZOOM_PERCENT;
+ const SwViewOption* pVOpt = GetViewShell()->GetViewOptions();
+ SetZoom(eType,
+ lcl_GetNextZoomStep(pVOpt->GetZoom(), SID_ZOOM_IN == rReq.GetSlot()));
+ }
+ break;
+ case FN_CHAR_LEFT:
+ case FN_CHAR_RIGHT:
+ case FN_LINE_UP:
+ case FN_LINE_DOWN:
+ {
+ SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout();
+ sal_uInt16 nNewSelectedPage;
+ sal_uInt16 nNewStartPage;
+ Point aNewStartPos;
+ sal_Int16 nHoriMove = 0;
+ sal_Int16 nVertMove = 0;
+ switch(rReq.GetSlot())
+ {
+ case FN_CHAR_LEFT: nHoriMove = -1; break;
+ case FN_CHAR_RIGHT: nHoriMove = 1; break;
+ case FN_LINE_UP: nVertMove = -1; break;
+ case FN_LINE_DOWN: nVertMove = 1; break;
+ }
+ pPagePrevwLay->CalcStartValuesForSelectedPageMove( nHoriMove, nVertMove,
+ nNewSelectedPage, nNewStartPage, aNewStartPos );
+ if ( aViewWin.SelectedPage() != nNewSelectedPage )
+ {
+ if ( pPagePrevwLay->IsPageVisible( nNewSelectedPage ) )
+ {
+ pPagePrevwLay->MarkNewSelectedPage( nNewSelectedPage );
+ // OD 19.02.2003 #107369# - adjust position at vertical scrollbar.
+ SetVScrollbarThumbPos( nNewSelectedPage );
+ bRefresh = false;
+ }
+ else
+ {
+ aViewWin.SetSelectedPage( nNewSelectedPage );
+ aViewWin.SetSttPage( nNewStartPage );
+ int nRet = ChgPage( SwPagePreViewWin::MV_SELPAGE, TRUE );
+ bRefresh = 0 != nRet;
+ }
+ GetViewShell()->ShowPreViewSelection( nNewSelectedPage );
+ // OD 24.03.2003 #108282# - invalidate page status.
+ static USHORT __READONLY_DATA aInval[] =
+ {
+ FN_STAT_PAGE, 0
+ };
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( aInval );
+ rReq.Done();
+ }
+ else
+ {
+ bRefresh = false;
+ }
+ break;
+ }
+ case FN_PAGEUP:
+ case FN_PAGEDOWN:
+ {
+ _ExecPgUpAndPgDown( rReq.GetSlot() == FN_PAGEUP, &rReq );
+ break;
+ }
+ case FN_START_OF_LINE:
+ case FN_START_OF_DOCUMENT:
+ aViewWin.SetSelectedPage( 1 );
+ eMvMode = SwPagePreViewWin::MV_DOC_STT; bRetVal = TRUE; goto MOVEPAGE;
+ case FN_END_OF_LINE:
+ case FN_END_OF_DOCUMENT:
+ aViewWin.SetSelectedPage( mnPageCount );
+ eMvMode = SwPagePreViewWin::MV_DOC_END; bRetVal = TRUE; goto MOVEPAGE;
+MOVEPAGE:
+ {
+ int nRet = ChgPage( eMvMode, TRUE );
+ // return value fuer Basic
+ if(bRetVal)
+ rReq.SetReturnValue(SfxBoolItem(rReq.GetSlot(), nRet == 0));
+
+ bRefresh = 0 != nRet;
+ rReq.Done();
+ }
+ break;
+
+ case FN_PRINT_PAGEPREVIEW:
+ {
+ const SwPagePreViewPrtData* pPPVPD = aViewWin.GetViewShell()->GetDoc()->GetPreViewPrtData();
+ // die Sache mit der Orientation
+ if(pPPVPD)
+ {
+ SfxPrinter* pPrinter = GetPrinter( TRUE );
+ if((pPrinter->GetOrientation() == ORIENTATION_LANDSCAPE)
+ != pPPVPD->GetLandscape())
+ pPrinter->SetOrientation(pPPVPD->GetLandscape() ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT);
+ }
+ ::SetAppPrintOptions( aViewWin.GetViewShell(), FALSE );
+ bNormalPrint = FALSE;
+ USHORT nPrtSlot = SID_PRINTDOC;
+ rReq.SetSlot( nPrtSlot );
+ SfxViewShell::ExecuteSlot( rReq, SfxViewShell::GetInterface() );
+ rReq.SetSlot( FN_PRINT_PAGEPREVIEW );
+ return;
+ }
+ case SID_PRINTDOCDIRECT:
+ case SID_PRINTDOC:
+ ::SetAppPrintOptions( aViewWin.GetViewShell(), FALSE );
+ bNormalPrint = TRUE;
+ SfxViewShell::ExecuteSlot( rReq, SfxViewShell::GetInterface() );
+ return;
+ case FN_CLOSE_PAGEPREVIEW:
+ case SID_PRINTPREVIEW:
+ // print preview is now always in the same frame as the tab view
+ // -> always switch this frame back to normal view
+ // (ScTabViewShell ctor reads stored view data)
+ GetViewFrame()->GetDispatcher()->Execute( SID_VIEWSHELL0, 0, 0, SFX_CALLMODE_ASYNCHRON );
+ break;
+ case FN_INSERT_BREAK:
+ {
+ USHORT nSelPage = aViewWin.SelectedPage();
+ //if a dummy page is selected (e.g. a non-existing right/left page)
+ //the direct neighbor is used
+ if(GetViewShell()->IsDummyPage( nSelPage ) && GetViewShell()->IsDummyPage( --nSelPage ))
+ nSelPage +=2;
+ SetNewPage( nSelPage );
+ SfxViewFrame *pTmpFrm = GetViewFrame();
+ pTmpFrm->GetBindings().Execute( SID_VIEWSHELL0, NULL, 0,
+ SFX_CALLMODE_ASYNCHRON );
+ }
+ break;
+ default:
+ ASSERT(!this, falscher Dispatcher);
+ return;
+ }
+
+ if( bRefresh )
+ aViewWin.Invalidate();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwPagePreView::GetState( SfxItemSet& rSet )
+{
+ SfxWhichIter aIter(rSet);
+ BYTE nRow = 1;
+ USHORT nWhich = aIter.FirstWhich();
+ ASSERT(nWhich, leeres Set);
+ SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout();
+ //#106746# zoom has to be disabled if Accessibility support is switched on
+ // MT 2010/01, see #110498#
+ BOOL bZoomEnabled = TRUE; // !Application::GetSettings().GetMiscSettings().GetEnableATToolSupport();
+
+ while(nWhich)
+ {
+ switch(nWhich)
+ {
+ case SID_BROWSER_MODE:
+ case FN_PRINT_LAYOUT:
+ rSet.DisableItem(nWhich);
+ break;
+ case FN_START_OF_DOCUMENT:
+ {
+ if ( pPagePrevwLay->IsPageVisible( 1 ) )
+ rSet.DisableItem(nWhich);
+ break;
+ }
+ case FN_END_OF_DOCUMENT:
+ {
+ if ( pPagePrevwLay->IsPageVisible( mnPageCount ) )
+ rSet.DisableItem(nWhich);
+ break;
+ }
+ case FN_PAGEUP:
+ {
+ if( pPagePrevwLay->GetWinPagesScrollAmount( -1 ) == 0 )
+ rSet.DisableItem(nWhich);
+ break;
+ }
+ case FN_PAGEDOWN:
+ {
+ if( pPagePrevwLay->GetWinPagesScrollAmount( 1 ) == 0 )
+ rSet.DisableItem(nWhich);
+ break;
+ }
+
+ case FN_STAT_PAGE:
+ {
+ String aStr( sPageStr );
+ aViewWin.GetStatusStr( aStr, mnPageCount );
+ rSet.Put( SfxStringItem( nWhich, aStr) );
+ }
+ break;
+
+ case SID_ATTR_ZOOM:
+ case FN_STAT_ZOOM:
+ {
+ if(bZoomEnabled)
+ {
+ const SwViewOption* pVOpt = GetViewShell()->GetViewOptions();
+ SvxZoomItem aZoom((SvxZoomType)pVOpt->GetZoomType(),
+ pVOpt->GetZoom());
+ aZoom.SetValueSet(
+ SVX_ZOOM_ENABLE_50|
+ SVX_ZOOM_ENABLE_75|
+ SVX_ZOOM_ENABLE_100|
+ SVX_ZOOM_ENABLE_150|
+ SVX_ZOOM_ENABLE_200);
+ rSet.Put( aZoom );
+ }
+ else
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case SID_ATTR_ZOOMSLIDER :
+ {
+ if(bZoomEnabled)
+ {
+ const SwViewOption* pVOpt = GetViewShell()->GetViewOptions();
+ const USHORT nCurrentZoom = pVOpt->GetZoom();
+ SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM, MAXZOOM );
+ aZoomSliderItem.AddSnappingPoint( 100 );
+ rSet.Put( aZoomSliderItem );
+ }
+ else
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case FN_PREVIEW_ZOOM:
+ {
+ if(bZoomEnabled)
+ {
+ const SwViewOption* pVOpt = GetViewShell()->GetViewOptions();
+ rSet.Put(SfxUInt16Item(nWhich, pVOpt->GetZoom()));
+ }
+ else
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case SID_ZOOM_IN:
+ case SID_ZOOM_OUT:
+ {
+ const SwViewOption* pVOpt = GetViewShell()->GetViewOptions();
+ if(!bZoomEnabled || (SID_ZOOM_OUT == nWhich && pVOpt->GetZoom() >= MAX_PREVIEW_ZOOM)||
+ (SID_ZOOM_IN == nWhich && pVOpt->GetZoom() <= MIN_PREVIEW_ZOOM))
+ {
+ rSet.DisableItem(nWhich);
+ }
+ }
+ break;
+ case FN_SHOW_MULTIPLE_PAGES:
+ //should never be disabled
+ break;
+ case FN_SHOW_BOOKVIEW:
+ {
+ BOOL b = GetViewShell()->GetViewOptions()->IsPagePrevBookview();
+ rSet.Put(SfxBoolItem(nWhich, b));
+ }
+ break;
+
+ case FN_SHOW_TWO_PAGES:
+ if( 2 == aViewWin.GetCol() && nRow == aViewWin.GetRow() )
+ rSet.DisableItem( nWhich );
+ break;
+
+ case FN_PRINT_PAGEPREVIEW:
+ // hat den gleichen Status wie das normale Drucken
+ {
+ const SfxPoolItem* pItem;
+ SfxItemSet aSet( *rSet.GetPool(), SID_PRINTDOC, SID_PRINTDOC );
+ GetSlotState( SID_PRINTDOC, SfxViewShell::GetInterface(), &aSet );
+ if( SFX_ITEM_DISABLED == aSet.GetItemState( SID_PRINTDOC,
+ FALSE, &pItem ))
+ rSet.DisableItem( nWhich );
+ else if( SFX_ITEM_SET == aSet.GetItemState( SID_PRINTDOC,
+ FALSE, &pItem ))
+ {
+ ((SfxPoolItem*)pItem)->SetWhich( FN_PRINT_PAGEPREVIEW );
+ rSet.Put( *pItem );
+ }
+ }
+ break;
+
+ case SID_PRINTPREVIEW:
+ rSet.Put( SfxBoolItem( nWhich, TRUE ) );
+ break;
+
+ case SID_PRINTDOC:
+ case SID_PRINTDOCDIRECT:
+ GetSlotState( nWhich, SfxViewShell::GetInterface(), &rSet );
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwPagePreView::StateUndo(SfxItemSet& rSet)
+{
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+
+ while (nWhich)
+ {
+ rSet.DisableItem(nWhich);
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwPagePreView::Init(const SwViewOption * pPrefs)
+{
+ if ( GetViewShell()->HasDrawView() )
+ GetViewShell()->GetDrawView()->SetAnimationEnabled( FALSE );
+
+ bNormalPrint = TRUE;
+
+ // Die DocSize erfragen und verarbeiten. Ueber die Handler konnte
+ // die Shell nicht gefunden werden, weil die Shell innerhalb CTOR-Phase
+ // nicht in der SFX-Verwaltung bekannt ist.
+
+ if( !pPrefs )
+ pPrefs = SW_MOD()->GetUsrPref(FALSE);
+
+ // die Felder aktualisieren
+ // ACHTUNG: hochcasten auf die EditShell, um die SS zu nutzen.
+ // In den Methoden wird auf die akt. Shell abgefragt!
+ SwEditShell* pESh = (SwEditShell*)GetViewShell();
+ BOOL bIsModified = pESh->IsModified();
+
+
+ SwViewOption aOpt( *pPrefs );
+ aOpt.SetPagePreview(TRUE);
+ aOpt.SetTab( FALSE );
+ aOpt.SetBlank( FALSE );
+ aOpt.SetHardBlank( FALSE );
+ aOpt.SetParagraph( FALSE );
+ aOpt.SetLineBreak( FALSE );
+ aOpt.SetPageBreak( FALSE );
+ aOpt.SetColumnBreak( FALSE );
+ aOpt.SetSoftHyph( FALSE );
+ aOpt.SetFldName( FALSE );
+ aOpt.SetPostIts( FALSE );
+ aOpt.SetShowHiddenChar( FALSE );
+ aOpt.SetShowHiddenField( FALSE );
+ aOpt.SetShowHiddenPara( FALSE );
+ aOpt.SetViewHRuler( FALSE );
+ aOpt.SetViewVRuler( FALSE );
+ aOpt.SetGraphic( TRUE );
+ aOpt.SetTable( TRUE );
+ aOpt.SetSnap( FALSE );
+ aOpt.SetGridVisible( FALSE );
+ GetViewShell()->ApplyViewOptions( aOpt );
+ GetViewShell()->ApplyAccessiblityOptions(SW_MOD()->GetAccessibilityOptions());
+
+ // OD 09.01.2003 #i6467# - adjust view shell option to the same as for print
+ SwPrintData const aPrintOptions = *SW_MOD()->GetPrtOptions(false);
+ GetViewShell()->AdjustOptionsForPagePreview( aPrintOptions );
+
+ IDocumentSettingAccess* pIDSA = pESh->getIDocumentSettingAccess();
+ if( pIDSA->get(IDocumentSettingAccess::BROWSE_MODE))
+ {
+ pIDSA->set(IDocumentSettingAccess::BROWSE_MODE, false);
+ pESh->CheckBrowseView( TRUE );
+ }
+
+ GetViewShell()->CalcLayout();
+ DocSzChgd( GetViewShell()->GetDocSize() );
+
+ if( !bIsModified )
+ pESh->ResetModified();
+
+ pVScrollbar->ExtendedShow(pPrefs->IsViewVScrollBar());
+ pHScrollbar->ExtendedShow(pPrefs->IsViewHScrollBar());
+ pScrollFill->Show(pPrefs->IsViewVScrollBar() && pPrefs->IsViewHScrollBar());
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwPagePreView::SwPagePreView(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
+ SfxViewShell( pViewFrame, SWVIEWFLAGS ),
+ aViewWin( &pViewFrame->GetWindow(), *this ),
+ nNewPage(USHRT_MAX),
+ pHScrollbar(0),
+ pVScrollbar(0),
+ pPageUpBtn(0),
+ pPageDownBtn(0),
+ pScrollFill(new ScrollBarBox( &pViewFrame->GetWindow(),
+ pViewFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )),
+ mnPageCount( 0 ),
+ // OD 09.01.2003 #106334#
+ mbResetFormDesignMode( false ),
+ mbFormDesignModeToReset( false )
+{
+ SetName(String::CreateFromAscii("PageView" ));
+ SetWindow( &aViewWin );
+ SetHelpId(SW_PAGEPREVIEW);
+ _CreateScrollbar( TRUE );
+ _CreateScrollbar( FALSE );
+
+ SfxObjectShell* pObjShell = pViewFrame->GetObjectShell();
+ if ( !pOldSh )
+ {
+ //Gibt es schon eine Sicht auf das Dokument?
+ SfxViewFrame *pF = SfxViewFrame::GetFirst( pObjShell );
+ if ( pF == pViewFrame )
+ pF = SfxViewFrame::GetNext( *pF, pObjShell );
+ if ( pF )
+ pOldSh = pF->GetViewShell();
+ }
+
+ ViewShell *pVS, *pNew;
+
+ if( pOldSh && pOldSh->IsA( TYPE( SwPagePreView ) ) )
+ pVS = ((SwPagePreView*)pOldSh)->GetViewShell();
+ else
+ {
+ if( pOldSh && pOldSh->IsA( TYPE( SwView ) ) )
+ {
+ pVS = ((SwView*)pOldSh)->GetWrtShellPtr();
+ // save the current ViewData of the previous SwView
+ pOldSh->WriteUserData( sSwViewData, FALSE );
+ }
+ else
+ pVS = GetDocShell()->GetWrtShell();
+ if( pVS )
+ {
+ // setze die akt. Seite als die erste
+ USHORT nPhysPg, nVirtPg;
+ ((SwCrsrShell*)pVS)->GetPageNum( nPhysPg, nVirtPg, /*FALSE*/TRUE, FALSE );
+ if( 1 != aViewWin.GetCol() && 1 == nPhysPg )
+ --nPhysPg;
+ aViewWin.SetSttPage( nPhysPg );
+ }
+ }
+
+ // OD 09.01.2003 #106334# - for form shell remember design mode of draw view
+ // of previous view shell
+ if ( pVS && pVS->HasDrawView() )
+ {
+ mbResetFormDesignMode = true;
+ mbFormDesignModeToReset = pVS->GetDrawView()->IsDesignMode();
+ }
+
+ if( pVS )
+ pNew = new ViewShell( *pVS, &aViewWin, 0, VSHELLFLAG_ISPREVIEW );
+ else
+ pNew = new ViewShell(
+ *((SwDocShell*)pViewFrame->GetObjectShell())->GetDoc(),
+ &aViewWin, 0, 0, VSHELLFLAG_ISPREVIEW );
+
+ aViewWin.SetViewShell( pNew );
+ pNew->SetSfxViewShell( this );
+ Init();
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+ SwPagePreView::~SwPagePreView()
+{
+ SetWindow( 0 );
+
+ delete pScrollFill;
+ delete pHScrollbar;
+ delete pVScrollbar;
+ delete pPageUpBtn;
+ delete pPageDownBtn;
+
+/* SfxObjectShell* pDocSh = GetDocShell();
+ for( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocSh );
+ pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pDocSh ) )
+ if( pFrame != GetViewFrame() )
+ {
+ // es gibt noch eine weitere Sicht auf unser Dokument, also
+ // aktiviere dieses
+ pFrame->GetFrame().Appear();
+ break;
+ }
+*/}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwDocShell* SwPagePreView::GetDocShell()
+{
+ return PTR_CAST(SwDocShell, GetViewFrame()->GetObjectShell());
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+int SwPagePreView::_CreateScrollbar( BOOL bHori )
+{
+ Window *pMDI = &GetViewFrame()->GetWindow();
+ SwScrollbar** ppScrollbar = bHori ? &pHScrollbar : &pVScrollbar;
+
+ ASSERT( !*ppScrollbar, "vorher abpruefen!" )
+
+ if( !bHori )
+ {
+
+ pPageUpBtn = new ImageButton(pMDI, SW_RES( BTN_PAGEUP ) );
+ pPageUpBtn->SetHelpId(GetStaticInterface()->GetSlot(FN_PAGEUP)->GetCommand());
+ pPageDownBtn = new ImageButton(pMDI, SW_RES( BTN_PAGEDOWN ) );
+ pPageDownBtn->SetHelpId(GetStaticInterface()->GetSlot(FN_PAGEDOWN)->GetCommand());
+ Link aLk( LINK( this, SwPagePreView, BtnPage ) );
+ pPageUpBtn->SetClickHdl( aLk );
+ pPageDownBtn->SetClickHdl( aLk );
+ pPageUpBtn->Show();
+ pPageDownBtn->Show();
+ }
+
+ *ppScrollbar = new SwScrollbar( pMDI, bHori );
+
+ ScrollDocSzChg();
+ (*ppScrollbar)->EnableDrag( TRUE );
+ (*ppScrollbar)->SetEndScrollHdl( LINK( this, SwPagePreView, EndScrollHdl ));
+
+
+ (*ppScrollbar)->SetScrollHdl( LINK( this, SwPagePreView, ScrollHdl ));
+
+ InvalidateBorder();
+ (*ppScrollbar)->ExtendedShow();
+ return 1;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+/*
+ * Button-Handler
+ */
+IMPL_LINK_INLINE_START( SwPagePreView, BtnPage, Button *, pButton )
+{
+ // OD 04.03.2003 #107369# - use new helper method to perform page up
+ // respectively page down.
+ _ExecPgUpAndPgDown( pButton == pPageUpBtn );
+ return 0;
+}
+IMPL_LINK_INLINE_END( SwPagePreView, BtnPage, Button *, pButton )
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+int SwPagePreView::ChgPage( int eMvMode, int bUpdateScrollbar )
+{
+ Rectangle aPixVisArea( aViewWin.LogicToPixel( aVisArea ) );
+ int bChg = aViewWin.MovePage( eMvMode ) ||
+ eMvMode == SwPagePreViewWin::MV_CALC ||
+ eMvMode == SwPagePreViewWin::MV_NEWWINSIZE;
+ aVisArea = aViewWin.PixelToLogic( aPixVisArea );
+
+ if( bChg )
+ {
+ // Statusleiste updaten
+ String aStr( sPageStr );
+ aViewWin.GetStatusStr( aStr, mnPageCount );
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+
+ if( bUpdateScrollbar )
+ {
+ ScrollViewSzChg();
+
+ static USHORT __READONLY_DATA aInval[] =
+ {
+ FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT,
+ FN_PAGEUP, FN_PAGEDOWN, 0
+ };
+ rBindings.Invalidate( aInval );
+ }
+ rBindings.SetState( SfxStringItem( FN_STAT_PAGE, aStr ) );
+ }
+ return bChg;
+}
+
+
+/* */
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+// ab hier alles aus der SwView uebernommen
+
+
+void SwPagePreView::CalcAndSetBorderPixel( SvBorder &rToFill, BOOL /*bInner*/ )
+{
+// const long nAdd = bInner ? 0 : ScrollBar::GetWindowOverlapPixel();
+ const StyleSettings &rSet = aViewWin.GetSettings().GetStyleSettings();
+ const long nTmp = rSet.GetScrollBarSize();// - nAdd;
+ if ( pVScrollbar->IsVisible( FALSE ))
+ rToFill.Right() = nTmp;
+ if ( pHScrollbar->IsVisible( FALSE ) )
+ rToFill.Bottom() = nTmp;
+ SetBorderPixel( rToFill );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwPagePreView::InnerResizePixel( const Point &rOfst, const Size &rSize )
+{
+ SvBorder aBorder;
+ CalcAndSetBorderPixel( aBorder, TRUE );
+ Rectangle aRect( rOfst, rSize );
+ aRect += aBorder;
+ ViewResizePixel( aViewWin, aRect.TopLeft(), aRect.GetSize(),
+ aViewWin.GetOutputSizePixel(),
+ TRUE,
+ *pVScrollbar, *pHScrollbar, pPageUpBtn, pPageDownBtn, 0,
+ *pScrollFill );
+
+ //EditWin niemals einstellen!
+ //VisArea niemals einstellen!
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwPagePreView::OuterResizePixel( const Point &rOfst, const Size &rSize )
+{
+ SvBorder aBorder;
+ CalcAndSetBorderPixel( aBorder, FALSE );
+ ViewResizePixel( aViewWin, rOfst, rSize, aViewWin.GetOutputSizePixel(),
+ FALSE, *pVScrollbar,
+ *pHScrollbar, pPageUpBtn, pPageDownBtn, 0, *pScrollFill );
+
+ //EditWin niemals einstellen!
+
+ Size aTmpSize( aViewWin.GetOutputSizePixel() );
+ Point aBottomRight( aViewWin.PixelToLogic( Point( aTmpSize.Width(), aTmpSize.Height() ) ) );
+ SetVisArea( Rectangle( Point(), aBottomRight ) );
+
+ //Aufruf der DocSzChgd-Methode der Scrollbars ist noetig, da vom maximalen
+ //Scrollrange immer die halbe Hoehe der VisArea abgezogen wird.
+ if ( pVScrollbar &&
+ aTmpSize.Width() > 0 && aTmpSize.Height() > 0 )
+ {
+ ScrollDocSzChg();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwPagePreView::SetVisArea( const Rectangle &rRect, BOOL bUpdateScrollbar )
+{
+ const Point aTopLeft(AlignToPixel(rRect.TopLeft()));
+ const Point aBottomRight(AlignToPixel(rRect.BottomRight()));
+ Rectangle aLR(aTopLeft,aBottomRight);
+
+ if(aLR == aVisArea)
+ return;
+ // keine negative Position, keine neg. Groesse
+
+ if(aLR.Top() < 0)
+ {
+ aLR.Bottom() += Abs(aLR.Top());
+ aLR.Top() = 0;
+ }
+
+ if(aLR.Left() < 0)
+ {
+ aLR.Right() += Abs(aLR.Left());
+ aLR.Left() = 0;
+ }
+ if(aLR.Right() < 0) aLR.Right() = 0;
+ if(aLR.Bottom() < 0) aLR.Bottom() = 0;
+ if(aLR == aVisArea ||
+ // JP 29.10.97: Bug 45173 - Leeres Rechteck nicht beachten
+ ( 0 == aLR.Bottom() - aLR.Top() && 0 == aLR.Right() - aLR.Left() ) )
+ return;
+
+ if( aLR.Left() > aLR.Right() || aLR.Top() > aLR.Bottom() )
+ return;
+
+ //Bevor die Daten veraendert werden ggf. ein Update rufen. Dadurch wird
+ //sichergestellt, da? anliegende Paints korrekt in Dokumentkoordinaten
+ //umgerechnet werden.
+ //Vorsichtshalber tun wir das nur wenn an der Shell eine Action laeuft,
+ //denn dann wir nicht wirklich gepaintet sondern die Rechtecke werden
+ //lediglich (in Dokumentkoordinaten) vorgemerkt.
+ if( GetViewShell()->ActionPend() )
+ aViewWin.Update();
+
+ // setze am View-Win die aktuelle Size
+ aVisArea = aLR;
+ aViewWin.SetWinSize( aLR.GetSize() );
+ // OD 18.12.2002 #103492# - use new mode
+ ChgPage( SwPagePreViewWin::MV_NEWWINSIZE, bUpdateScrollbar );
+
+ aViewWin.Invalidate();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwPagePreView, ScrollHdl, SwScrollbar *, pScrollbar )
+{
+ if(!GetViewShell())
+ return 0;
+ if( !pScrollbar->IsHoriScroll() &&
+ pScrollbar->GetType() == SCROLL_DRAG &&
+ Help::IsQuickHelpEnabled() &&
+ GetViewShell()->PagePreviewLayout()->DoesPreviewLayoutRowsFitIntoWindow())
+ {
+ // wieviele Seiten scrollen ??
+ String sStateStr(sPageStr);
+ USHORT nThmbPos = (USHORT)pScrollbar->GetThumbPos();
+ if( 1 == aViewWin.GetCol() || !nThmbPos )
+ ++nThmbPos;
+ sStateStr += String::CreateFromInt32( nThmbPos );
+ Point aPos = pScrollbar->GetParent()->OutputToScreenPixel(
+ pScrollbar->GetPosPixel());
+ aPos.Y() = pScrollbar->OutputToScreenPixel(pScrollbar->GetPointerPosPixel()).Y();
+ Size aSize = pScrollbar->GetSizePixel();
+ Rectangle aRect;
+ aRect.Left() = aPos.X() -8;
+ aRect.Right() = aRect.Left();
+ aRect.Top() = aPos.Y();
+ aRect.Bottom() = aRect.Top();
+
+ Help::ShowQuickHelp(pScrollbar, aRect, sStateStr,
+ QUICKHELP_RIGHT|QUICKHELP_VCENTER);
+
+ }
+ else
+ EndScrollHdl( pScrollbar );
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwPagePreView, EndScrollHdl, SwScrollbar *, pScrollbar )
+{
+ if(!GetViewShell())
+ return 0;
+
+ // OD 04.03.2003 #107369# - boolean to avoid unnecessary invalidation of the window.
+ bool bInvalidateWin = true;
+
+ if( !pScrollbar->IsHoriScroll() ) // scroll vertically
+ {
+ if ( Help::IsQuickHelpEnabled() )
+ Help::ShowQuickHelp(pScrollbar, Rectangle(), aEmptyStr, 0);
+ if ( GetViewShell()->PagePreviewLayout()->DoesPreviewLayoutRowsFitIntoWindow() )
+ {
+ // wieviele Seiten scrollen ??
+ USHORT nThmbPos = (USHORT)pScrollbar->GetThumbPos();
+ // OD 05.12.2002 #103492# - adjust to new preview functionality
+ if( nThmbPos != aViewWin.SelectedPage() )
+ {
+ // OD 17.01.2003 #103492# - consider case that page <nThmbPos>
+ // is already visible
+ SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout();
+ if ( pPagePrevwLay->IsPageVisible( nThmbPos ) )
+ {
+ pPagePrevwLay->MarkNewSelectedPage( nThmbPos );
+ // OD 04.03.2003 #107369# - invalidation of window is unnecessary
+ bInvalidateWin = false;
+ }
+ else
+ {
+ // OD 17.01.2003 #103492# - consider whether layout columns
+ // fit or not.
+ if ( !pPagePrevwLay->DoesPreviewLayoutColsFitIntoWindow() )
+ {
+ aViewWin.SetSttPage( nThmbPos );
+ aViewWin.SetSelectedPage( nThmbPos );
+ ChgPage( SwPagePreViewWin::MV_SCROLL, FALSE );
+ // OD 20.01.2003 #103492# - update scrollbars
+ ScrollViewSzChg();
+ }
+ else
+ {
+ // OD 04.03.2003 #107369# - correct scroll amount
+ const sal_Int16 nPageDiff = nThmbPos - aViewWin.SelectedPage();
+ const sal_uInt16 nVisPages = aViewWin.GetRow() * aViewWin.GetCol();
+ sal_Int16 nWinPagesToScroll = nPageDiff / nVisPages;
+ if ( nPageDiff % nVisPages )
+ {
+ // decrease/increase number of preview pages to scroll
+ nPageDiff < 0 ? --nWinPagesToScroll : ++nWinPagesToScroll;
+ }
+ aViewWin.SetSelectedPage( nThmbPos );
+ aViewWin.Scroll( 0, pPagePrevwLay->GetWinPagesScrollAmount( nWinPagesToScroll ) );
+ }
+ }
+ // OD 17.01.2003 #103492# - update accessibility
+ GetViewShell()->ShowPreViewSelection( nThmbPos );
+ }
+ else
+ {
+ // OD 04.03.2003 #107369# - invalidation of window is unnecessary
+ bInvalidateWin = false;
+ }
+ }
+ else
+ {
+ long nThmbPos = pScrollbar->GetThumbPos();
+ aViewWin.Scroll(0, nThmbPos - aViewWin.GetPaintedPreviewDocRect().Top());
+ }
+ }
+ else
+ {
+ long nThmbPos = pScrollbar->GetThumbPos();
+ aViewWin.Scroll(nThmbPos - aViewWin.GetPaintedPreviewDocRect().Left(), 0);
+ }
+ // OD 24.03.2003 #108282# - additional invalidate page status.
+ static USHORT __READONLY_DATA aInval[] =
+ {
+ FN_START_OF_DOCUMENT, FN_END_OF_DOCUMENT, FN_PAGEUP, FN_PAGEDOWN,
+ FN_STAT_PAGE, 0
+ };
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate( aInval );
+ // OD 04.03.2003 #107369# - control invalidation of window
+ if ( bInvalidateWin )
+ {
+ aViewWin.Invalidate();
+ }
+ return 0;
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+Point SwPagePreView::AlignToPixel(const Point &rPt) const
+{
+ return aViewWin.PixelToLogic( aViewWin.LogicToPixel( rPt ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwPagePreView::DocSzChgd( const Size &rSz )
+{
+ if( aDocSz == rSz )
+ return;
+
+ aDocSz = rSz;
+
+ // --> OD 2009-08-20 #i96726#
+ // Due to the multiple page layout it is needed to trigger recalculation
+ // of the page preview layout, even if the count of pages is not changing.
+ mnPageCount = GetViewShell()->GetNumPages();
+
+ if( aVisArea.GetWidth() )
+ {
+ ChgPage( SwPagePreViewWin::MV_CALC, TRUE );
+ ScrollDocSzChg();
+
+ aViewWin.Invalidate();
+ }
+ // <--
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwPagePreView::ScrollViewSzChg()
+{
+ if(!GetViewShell())
+ return ;
+ if(pVScrollbar)
+ {
+ if(GetViewShell()->PagePreviewLayout()->DoesPreviewLayoutRowsFitIntoWindow())
+ {
+ //vertical scrolling by row
+ // OD 04.12.2002 #103492# - adjust to new preview functionality
+ USHORT nVisPages = aViewWin.GetRow() * aViewWin.GetCol();
+ pVScrollbar->SetVisibleSize( nVisPages );
+ // OD 19.02.2003 #107369# - set selected page as scroll bar position,
+ // if it is visible.
+ SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout();
+ if ( pPagePrevwLay->IsPageVisible( aViewWin.SelectedPage() ) )
+ {
+ pVScrollbar->SetThumbPos( aViewWin.SelectedPage() );
+ }
+ else
+ {
+ pVScrollbar->SetThumbPos( aViewWin.GetSttPage() );
+ }
+ pVScrollbar->SetLineSize( aViewWin.GetCol() );
+ pVScrollbar->SetPageSize( nVisPages );
+ // calculate and set scrollbar range
+ Range aScrollbarRange( 1, mnPageCount );
+ // increase range by one, because left-top-corner is left blank.
+ ++aScrollbarRange.Max();
+ // OD 17.01.2003 #103492# - increase range in order to access all pages
+ aScrollbarRange.Max() += ( nVisPages - 1 );
+ pVScrollbar->SetRange( aScrollbarRange );
+ }
+ else //vertical scrolling by pixel
+ {
+ const Rectangle& rDocRect = aViewWin.GetPaintedPreviewDocRect();
+ const Size& rPreviewSize =
+ GetViewShell()->PagePreviewLayout()->GetPrevwDocSize();
+ pVScrollbar->SetRangeMax(rPreviewSize.Height()) ;
+ long nVisHeight = rDocRect.GetHeight();
+ pVScrollbar->SetVisibleSize( nVisHeight );
+ pVScrollbar->SetThumbPos( rDocRect.Top() );
+ pVScrollbar->SetLineSize( nVisHeight / 10 );
+ pVScrollbar->SetPageSize( nVisHeight / 2 );
+ }
+ }
+ if(pHScrollbar)
+ {
+ const Rectangle& rDocRect = aViewWin.GetPaintedPreviewDocRect();
+ const Size& rPreviewSize =
+ GetViewShell()->PagePreviewLayout()->GetPrevwDocSize();
+ long nVisWidth = 0;
+ long nThumb = 0;
+ Range aRange(0,0);
+
+ if(rDocRect.GetWidth() < rPreviewSize.Width())
+ {
+ nVisWidth = rDocRect.GetWidth();
+ nThumb = rDocRect.Left();
+ aRange = Range(0, rPreviewSize.Width());
+ }
+ pHScrollbar->SetRange( aRange );
+ pHScrollbar->SetVisibleSize( nVisWidth );
+ pHScrollbar->SetThumbPos( nThumb );
+ pHScrollbar->SetLineSize( nVisWidth / 10 );
+ pHScrollbar->SetPageSize( nVisWidth / 2 );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwPagePreView::ScrollDocSzChg()
+{
+ ScrollViewSzChg();
+}
+
+
+/* */
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+// alles zum Thema Drucken
+
+SfxPrinter* SwPagePreView::GetPrinter( BOOL bCreate )
+{
+ return aViewWin.GetViewShell()->getIDocumentDeviceAccess()->getPrinter( bCreate );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+USHORT SwPagePreView::SetPrinter( SfxPrinter *pNew, USHORT nDiffFlags, bool )
+{
+ ViewShell &rSh = *GetViewShell();
+ SfxPrinter* pOld = rSh.getIDocumentDeviceAccess()->getPrinter( false );
+ if ( pOld && pOld->IsPrinting() )
+ return SFX_PRINTERROR_BUSY;
+
+ SwEditShell &rESh = (SwEditShell&)rSh; //Buh...
+ if( ( SFX_PRINTER_PRINTER | SFX_PRINTER_JOBSETUP ) & nDiffFlags )
+ {
+ rSh.getIDocumentDeviceAccess()->setPrinter( pNew, true, true );
+ if( nDiffFlags & SFX_PRINTER_PRINTER )
+ rESh.SetModified();
+ }
+ if ( ( nDiffFlags & SFX_PRINTER_OPTIONS ) == SFX_PRINTER_OPTIONS )
+ ::SetPrinter( rSh.getIDocumentDeviceAccess(), pNew, FALSE );
+
+ const BOOL bChgOri = nDiffFlags & SFX_PRINTER_CHG_ORIENTATION ? TRUE : FALSE;
+ const BOOL bChgSize= nDiffFlags & SFX_PRINTER_CHG_SIZE ? TRUE : FALSE;
+ if ( bChgOri || bChgSize )
+ {
+ rESh.StartAllAction();
+ if ( bChgOri )
+ rSh.ChgAllPageOrientation( USHORT(pNew->GetOrientation()) );
+ if ( bChgSize )
+ {
+ Size aSz( SvxPaperInfo::GetPaperSize( pNew ) );
+ rSh.ChgAllPageSize( aSz );
+ }
+ if( !bNormalPrint )
+ aViewWin.CalcWish( aViewWin.GetRow(), aViewWin.GetCol() );
+ rESh.SetModified();
+ rESh.EndAllAction();
+
+ static USHORT __READONLY_DATA aInval[] =
+ {
+ SID_ATTR_LONG_ULSPACE, SID_ATTR_LONG_LRSPACE,
+ SID_RULER_BORDERS, SID_RULER_PAGE_POS, 0
+ };
+#ifdef DBG_UTIL
+ {
+ const USHORT* pPtr = aInval + 1;
+ do {
+ ASSERT( *(pPtr - 1) < *pPtr, "falsche Sortierung!" );
+ } while( *++pPtr );
+ }
+#endif
+
+ GetViewFrame()->GetBindings().Invalidate(aInval);
+ }
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SfxTabPage* SwPagePreView::CreatePrintOptionsPage( Window *pParent,
+ const SfxItemSet &rOptions )
+{
+ return ::CreatePrintOptionsPage( pParent, rOptions, !bNormalPrint );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+// OD 18.12.2002 #103492# - no longer needed ??
+Size SwPagePreView::GetOptimalSizePixel() const
+{
+ ASSERT( false, "overloaded virtual method <SwPagePreView::GetOptimalSizePixel()> needed ??" )
+ return Size( -1, -1 );
+/*
+ //JP 09.06.99: was wird hier errechnet ?????
+// ALT:
+// SfxApplicationWindow* pWin = SFX_APPWINDOW ;
+// Rectangle aRect = pWin->GetClientAreaPixel();
+
+ Window& rWin = GetViewFrame()->GetWindow();
+ Rectangle aRect( Point(0, 0), rWin.GetOutputSizePixel() );
+ Size aMaxSize( aRect.GetWidth(), aRect.GetHeight() );
+ Size aInSize = rWin.GetOutputSizePixel();
+ Size aOutSize = rWin.GetSizePixel();
+ USHORT nXBorder = USHORT(aOutSize.Width() - aInSize.Width());
+ USHORT nYBorder = USHORT(aOutSize.Height() - aInSize.Height());
+ aMaxSize.Width() -= nXBorder;
+ //'auf Verdacht' etwas vom Border abziehen (Menue)
+ nYBorder -= (nYBorder - nXBorder) / 2;
+ aMaxSize.Height() -= nYBorder;
+ //mit der max. moeglichen Outputsize guenstigstes Verhaeltnis ausrechnen
+ aViewWin.GetOptimalSize(aMaxSize);
+ // Border wieder dazuzaehlen
+ aMaxSize.Height() += nYBorder;
+ aMaxSize.Width() += nXBorder;
+ return aMaxSize;
+*/
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+// OD 12.12.2002 #103492#
+void SwPagePreViewWin::SetViewShell( ViewShell* pShell )
+{
+ mpViewShell = pShell;
+ if ( mpViewShell && mpViewShell->IsPreView() )
+ {
+ mpPgPrevwLayout = mpViewShell->PagePreviewLayout();
+ }
+}
+
+void SwPagePreViewWin::RepaintCoreRect( const SwRect& rRect )
+{
+ // OD 2004-03-04 #i24183#
+ if ( mpPgPrevwLayout->PreviewLayoutValid() )
+ {
+ mpPgPrevwLayout->Repaint( Rectangle( rRect.Pos(), rRect.SSize() ) );
+ }
+}
+
+/** method to adjust preview to a new zoom factor
+
+ OD 02.12.2002 #103492#
+ OD 24.09.2003 #i19975# - also consider zoom type - adding parameter <_eZoomType>
+*/
+void SwPagePreViewWin::AdjustPreviewToNewZoom( const sal_uInt16 _nZoomFactor,
+ const SvxZoomType _eZoomType )
+{
+ // OD 24.09.2003 #i19975# - consider zoom type
+ if ( _eZoomType == SVX_ZOOM_WHOLEPAGE )
+ {
+ mnRow = 1;
+ mnCol = 1;
+ mpPgPrevwLayout->Init( mnCol, mnRow, maPxWinSize, true );
+ mpPgPrevwLayout->Prepare( mnSttPage, Point(0,0), maPxWinSize,
+ mnSttPage, maPaintedPreviewDocRect );
+ SetSelectedPage( mnSttPage );
+ SetPagePreview(mnRow, mnCol);
+ maScale = GetMapMode().GetScaleX();
+ }
+ else if ( _nZoomFactor != 0 )
+ {
+ // calculate new scaling and set mapping mode appropriately.
+ Fraction aNewScale( _nZoomFactor, 100 );
+ MapMode aNewMapMode = GetMapMode();
+ aNewMapMode.SetScaleX( aNewScale );
+ aNewMapMode.SetScaleY( aNewScale );
+ SetMapMode( aNewMapMode );
+
+ // calculate new start position for preview paint
+ Size aNewWinSize = PixelToLogic( maPxWinSize );
+ Point aNewPaintStartPos =
+ mpPgPrevwLayout->GetPreviewStartPosForNewScale( aNewScale, maScale, aNewWinSize );
+
+ // remember new scaling and prepare preview paint
+ // Note: paint of preview will be performed by a corresponding invalidate
+ // due to property changes.
+ maScale = aNewScale;
+ mpPgPrevwLayout->Prepare( 0, aNewPaintStartPos, maPxWinSize,
+ mnSttPage, maPaintedPreviewDocRect );
+ }
+
+}
+/* -----------------04.12.2002 10:46-----------------
+ * pixel scrolling - horizontally always or vertically
+ * when less than the desired number of rows fits into
+ * the view
+ * --------------------------------------------------*/
+void SwPagePreViewWin::Scroll(long nXMove, long nYMove, USHORT /*nFlags*/)
+{
+ maPaintedPreviewDocRect.Move(nXMove, nYMove);
+ mpPgPrevwLayout->Prepare( 0, maPaintedPreviewDocRect.TopLeft(),
+ maPxWinSize, mnSttPage,
+ maPaintedPreviewDocRect );
+
+}
+
+BOOL SwPagePreView::HandleWheelCommands( const CommandEvent& rCEvt )
+{
+ BOOL bOk = FALSE;
+ const CommandWheelData* pWData = rCEvt.GetWheelData();
+ if( pWData && COMMAND_WHEEL_ZOOM == pWData->GetMode() )
+ {
+ if(!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport())
+ {
+ USHORT nFactor = GetViewShell()->GetViewOptions()->GetZoom();
+ const USHORT nOffset = 10;
+ if( 0L > pWData->GetDelta() )
+ {
+ nFactor -= nOffset;
+ if(nFactor < MIN_PREVIEW_ZOOM)
+ nFactor = MIN_PREVIEW_ZOOM;
+ }
+ else
+ {
+ nFactor += nOffset;
+ if(nFactor > MAX_PREVIEW_ZOOM)
+ nFactor = MAX_PREVIEW_ZOOM;
+ }
+ SetZoom(SVX_ZOOM_PERCENT, nFactor);
+ }
+ bOk = TRUE;
+ }
+ else
+ bOk = aViewWin.HandleScrollCommand( rCEvt, pHScrollbar, pVScrollbar );
+ return bOk;
+}
+
+
+uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ SwPagePreViewWin::CreateAccessible()
+{
+ vos::OGuard aGuard(Application::GetSolarMutex()); // this should have
+ // happend already!!!
+
+ DBG_ASSERT( GetViewShell() != NULL, "We need a view shell" );
+ return GetViewShell()->CreateAccessiblePreview();
+}
+
+/* -----------------------------06.05.2002 13:18------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwPagePreView::ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions)
+{
+ GetViewShell()->ApplyAccessiblityOptions(rAccessibilityOptions);
+}
+/* -----------------------------2002/06/26 14:30------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwPagePreView::ShowHScrollbar(sal_Bool bShow)
+{
+ pHScrollbar->Show(bShow);
+ InvalidateBorder();
+}
+
+/* -----------------------------2002/06/26 14:30------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwPagePreView::ShowVScrollbar(sal_Bool bShow)
+{
+ pVScrollbar->Show(bShow);
+ InvalidateBorder();
+}
+
+/* -----------------25.11.2002 16:36-----------------
+ *
+ * --------------------------------------------------*/
+void SwPagePreView::SetZoom(SvxZoomType eType, USHORT nFactor)
+{
+ ViewShell& rSh = *GetViewShell();
+ SwViewOption aOpt(*rSh.GetViewOptions());
+ // OD 16.12.2002 #103492# - perform action only on changes of zoom or zoom type.
+ if ( aOpt.GetZoom() != nFactor ||
+ aOpt.GetZoomType() != eType )
+ {
+ aOpt.SetZoom(nFactor);
+ aOpt.SetZoomType(eType);
+ rSh.ApplyViewOptions( aOpt );
+ lcl_InvalidateZoomSlots(GetViewFrame()->GetBindings());
+ // OD 02.12.2002 #103492#
+ // OD 24.09.2003 #i19975# - also consider zoom type
+ aViewWin.AdjustPreviewToNewZoom( nFactor, eType );
+ ScrollViewSzChg();
+ }
+}
+
+/** adjust position of vertical scrollbar
+
+ OD 19.02.2003 #107369
+
+ @author OD
+*/
+void SwPagePreView::SetVScrollbarThumbPos( const sal_uInt16 _nNewThumbPos )
+{
+ if ( pVScrollbar )
+ {
+ pVScrollbar->SetThumbPos( _nNewThumbPos );
+ }
+}
diff --git a/sw/source/ui/uiview/pview.hrc b/sw/source/ui/uiview/pview.hrc
new file mode 100644
index 000000000000..3724789431ed
--- /dev/null
+++ b/sw/source/ui/uiview/pview.hrc
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "view.hrc"
+
+#define FT_COL 1
+#define FT_ROW 2
+#define ED_COL 4
+#define ED_ROW 5
+
+#define BT_OK 20
+#define BT_CANCEL 21
+#define BT_HELP 22
+
+// Grenzwerte fuers Zooming (werden auch im piew.cxx benutzt!)
+#define PVIEW_MIN_ROW 1
+#define PVIEW_MAX_ROW 10
+#define PVIEW_MIN_COL 1
+#define PVIEW_MAX_COL 20
+
+//Dialog Druckoptionen
+#define FL_ROWCOL 1
+#define FT_ROWS 2
+#define NF_ROWS 3
+#define FT_COLS 4
+#define NF_COLS 5
+#define FL_MARGINS 6
+#define FL_DISTANCE 7
+#define FL_ORIENTATION 8
+
+#define WIN_PREVIEW 11
+
+
+#define FT_LMARGIN 12
+#define MF_LMARGIN 13
+#define FT_RMARGIN 14
+#define MF_RMARGIN 15
+#define FT_TMARGIN 16
+#define MF_TMARGIN 17
+#define FT_BMARGIN 18
+#define MF_BMARGIN 19
+#define FT_HMARGIN 20
+#define MF_HMARGIN 21
+#define FT_VMARGIN 22
+#define MF_VMARGIN 23
+#define PB_STANDARD 24
+
+#define RB_LANDSCAPE 24
+#define RB_PORTRAIT 25
diff --git a/sw/source/ui/uiview/pview.src b/sw/source/ui/uiview/pview.src
new file mode 100644
index 000000000000..f2fd88d6d754
--- /dev/null
+++ b/sw/source/ui/uiview/pview.src
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/svxids.hrc>
+#include "pview.hrc"
+#include "helpid.h"
+#include "cmdid.h"
+
+ModalDialog DLG_PAGEPREVIEW_ZOOM
+{
+ HelpID = HID_PPREV_ZOOM ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 141 , 69 ) ;
+ Text [ en-US ] = "Multiple Pages" ;
+ Moveable = TRUE ;
+ FixedText FT_COL
+ {
+ Pos = MAP_APPFONT ( 12 , 34 ) ;
+ Size = MAP_APPFONT ( 27 , 10 ) ;
+ Text [ en-US ] = "~Columns" ;
+ Left = TRUE ;
+ };
+ FixedText FT_ROW
+ {
+ Pos = MAP_APPFONT ( 12 , 14 ) ;
+ Size = MAP_APPFONT ( 27 , 10 ) ;
+ Text [ en-US ] = "~Rows" ;
+ Left = TRUE ;
+ };
+ NumericField ED_COL
+ {
+ HelpID = "sw:NumericField:DLG_PAGEPREVIEW_ZOOM:ED_COL";
+ Border = TRUE ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ Pos = MAP_APPFONT ( 48 , 34 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = PVIEW_MIN_COL ;
+ Maximum = PVIEW_MAX_COL ;
+ Value = 1 ;
+ First = PVIEW_MIN_COL ;
+ Last = PVIEW_MAX_COL ;
+ };
+ NumericField ED_ROW
+ {
+ HelpID = "sw:NumericField:DLG_PAGEPREVIEW_ZOOM:ED_ROW";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 48 , 13 ) ;
+ Size = MAP_APPFONT ( 28 , 12 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = PVIEW_MIN_ROW ;
+ Maximum = PVIEW_MAX_ROW ;
+ Value = 1 ;
+ First = PVIEW_MIN_ROW ;
+ Last = PVIEW_MAX_ROW ;
+ };
+ OKButton BT_OK
+ {
+ Pos = MAP_APPFONT ( 88 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton BT_CANCEL
+ {
+ Pos = MAP_APPFONT ( 88 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton BT_HELP
+ {
+ Pos = MAP_APPFONT ( 88 , 49 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ };
+};
+String RID_PVIEW_TOOLBOX
+{
+ Text [ en-US ] = "Page Preview" ;
+};
+
diff --git a/sw/source/ui/uiview/scroll.cxx b/sw/source/ui/uiview/scroll.cxx
new file mode 100644
index 000000000000..c8ecc2d92607
--- /dev/null
+++ b/sw/source/ui/uiview/scroll.cxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include "swtypes.hxx"
+#include "swrect.hxx"
+#include "scroll.hxx"
+
+#define SCROLL_LINE_SIZE 250
+
+
+SwScrollbar::SwScrollbar( Window *pWin, BOOL bHoriz ) :
+ ScrollBar( pWin,
+ WinBits( WB_3DLOOK | WB_HIDE | ( bHoriz ? WB_HSCROLL : WB_VSCROLL) ) ),
+ bHori( bHoriz ),
+ bAuto( FALSE ),
+ bThumbEnabled( TRUE ),
+ bVisible(FALSE),
+ bSizeSet(FALSE)
+{
+ // SSA: --- RTL --- no mirroring for horizontal scrollbars
+ if( bHoriz )
+ EnableRTL( FALSE );
+}
+
+
+ SwScrollbar::~SwScrollbar() {}
+
+/*------------------------------------------------------------------------
+ Beschreibung: wird nach einer Aenderung der Dokumentgroesse gerufen, um den
+ Range des Scrollbars neu einzustellen.
+------------------------------------------------------------------------*/
+
+void SwScrollbar::DocSzChgd( const Size &rSize )
+{
+ aDocSz = rSize;
+ SetRange( Range( 0, bHori ? rSize.Width() : rSize.Height()) );
+ const ULONG nVisSize = GetVisibleSize();
+ SetLineSize( SCROLL_LINE_SIZE );
+// SetLineSize( nVisSize * 10 / 100 );
+ SetPageSize( nVisSize * 77 / 100 );
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: wird nach einer Veraenderung des sichtbaren Ausschnittes
+ gerufen.
+------------------------------------------------------------------------*/
+
+
+void SwScrollbar::ViewPortChgd( const Rectangle &rRect )
+{
+ long nThumb, nVisible;
+ if( bHori )
+ {
+ nThumb = rRect.Left();
+ nVisible = rRect.GetWidth();
+ }
+ else
+ {
+ nThumb = rRect.Top();
+ nVisible = rRect.GetHeight();
+ }
+
+ SetVisibleSize( nVisible );
+ DocSzChgd(aDocSz);
+ if ( bThumbEnabled )
+ SetThumbPos( nThumb );
+ if(bAuto)
+ AutoShow();
+}
+
+/*-----------------10/21/97 02:48pm-----------------
+
+--------------------------------------------------*/
+void SwScrollbar::ExtendedShow( BOOL bSet )
+{
+ bVisible = bSet;
+ if( (!bSet || !bAuto) && IsUpdateMode() && bSizeSet)
+ ScrollBar::Show(bSet);
+}
+
+/*-----------------10/21/97 03:23pm-----------------
+
+--------------------------------------------------*/
+void SwScrollbar::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize )
+{
+ ScrollBar::SetPosSizePixel(rNewPos, rNewSize);
+ bSizeSet = TRUE;
+ if(bVisible)
+ ExtendedShow();
+
+}
+
+
+/*-----------------14.04.98 11:38-------------------
+
+--------------------------------------------------*/
+void SwScrollbar::SetAuto(BOOL bSet)
+{
+ if(bAuto != bSet)
+ {
+ bAuto = bSet;
+
+ // automatisch versteckt - dann anzeigen
+ if(!bAuto && bVisible && !ScrollBar::IsVisible())
+ ExtendedShow(TRUE);
+ else if(bAuto)
+ AutoShow(); // oder automatisch verstecken
+ }
+}
+/*-----------------14.04.98 11:43-------------------
+
+--------------------------------------------------*/
+void SwScrollbar::AutoShow()
+{
+ long nVis = GetVisibleSize();
+ long nLen = GetRange().Len();
+ {
+ if( nVis >= nLen - 1)
+ {
+ if(ScrollBar::IsVisible())
+ ScrollBar::Show(FALSE);
+ }
+ else if ( !ScrollBar::IsVisible() &&
+ (!bHori || nVis) ) //Optimierung fuer Browser.
+ //Horizontaler Scrollbar per
+ //default aus.
+ {
+ ScrollBar::Show(TRUE);
+ }
+ }
+}
diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx
new file mode 100644
index 000000000000..1f223350ed70
--- /dev/null
+++ b/sw/source/ui/uiview/srcview.cxx
@@ -0,0 +1,959 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <unotools/tempfile.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/print.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/metric.hxx>
+#include <svtools/ctrltool.hxx>
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+#include <unotools/pathoptions.hxx>
+#include <svl/undo.hxx>
+#include <svtools/txtcmp.hxx>
+#include <svl/eitem.hxx>
+#include <svl/whiter.hxx>
+#include <unotools/saveopt.hxx>
+#include <svtools/transfer.hxx>
+#include <svtools/svtools.hrc>
+#include <svtools/svtdata.hxx>
+#include <svx/svxids.hrc>
+#include <svtools/htmlcfg.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objface.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/prnmon.hxx>
+#include <sfx2/docfile.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <svx/srchdlg.hxx>
+#include <svl/srchitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/flstitem.hxx>
+#include "editeng/unolingu.hxx"
+#include <sfx2/sfxhtml.hxx>
+#include <swtypes.hxx>
+#include <swmodule.hxx>
+#include <docsh.hxx>
+#include <wdocsh.hxx>
+#include <srcview.hxx>
+#include <viewfunc.hxx>
+#include <doc.hxx>
+#include <sfx2/msg.hxx>
+#include <shellio.hxx>
+
+#include <cmdid.h> // FN_ ...
+#include <helpid.h>
+#include <globals.hrc>
+#include <shells.hrc>
+#include <popup.hrc>
+#include <web.hrc>
+#include <view.hrc>
+#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
+#include <sfx2/filedlghelper.hxx>
+#define SwSrcView
+#define SearchSettings
+#define _ExecSearch Execute
+#define _StateSearch GetState
+#include <svx/svxslots.hxx>
+#include "swslots.hxx"
+
+#include <unomid.h>
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::lang;
+using namespace ::sfx2;
+using ::rtl::OUString;
+using ::com::sun::star::util::SearchOptions;
+
+
+#define SWSRCVIEWFLAGS ( SFX_VIEW_CAN_PRINT|\
+ SFX_VIEW_NO_NEWWINDOW )
+
+#define SRC_SEARCHOPTIONS (0xFFFF & ~(SEARCH_OPTIONS_FORMAT|SEARCH_OPTIONS_FAMILIES|SEARCH_OPTIONS_SEARCH_ALL))
+
+// Druckraender -> wie Basic - Ide
+#define LMARGPRN 1700
+#define RMARGPRN 900
+#define TMARGPRN 2000
+#define BMARGPRN 1000
+#define BORDERPRN 300
+
+SFX_IMPL_NAMED_VIEWFACTORY(SwSrcView, "SourceView")
+{
+ SFX_VIEW_REGISTRATION(SwWebDocShell);
+}
+
+SFX_IMPL_INTERFACE( SwSrcView, SfxViewShell, SW_RES(0) )
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_SRCVIEW_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS|
+ SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_SERVER,
+ SW_RES(RID_WEBTOOLS_TOOLBOX) );
+ SFX_CHILDWINDOW_REGISTRATION(SvxSearchDialogWrapper::GetChildWindowId());
+}
+
+TYPEINIT1(SwSrcView, SfxViewShell)
+
+/*-----------------18.11.96 08.05-------------------
+
+--------------------------------------------------*/
+
+
+void lcl_PrintHeader( OutputDevice &rOutDev, USHORT nPages, USHORT nCurPage, const String& rTitle )
+{
+ short nLeftMargin = LMARGPRN;
+ Size aSz = rOutDev.GetOutputSize();
+ short nBorder = BORDERPRN;
+
+ Color aOldFillColor( rOutDev.GetFillColor() );
+ Font aOldFont( rOutDev.GetFont() );
+
+ rOutDev.SetFillColor( Color(COL_TRANSPARENT) );
+
+ Font aFont( aOldFont );
+ aFont.SetWeight( WEIGHT_BOLD );
+ aFont.SetAlign( ALIGN_BOTTOM );
+ rOutDev.SetFont( aFont );
+
+ long nFontHeight = rOutDev.GetTextHeight();
+
+ // 1.Border => Strich, 2+3 Border = Freiraum.
+ long nYTop = TMARGPRN-3*nBorder-nFontHeight;
+
+ long nXLeft = nLeftMargin-nBorder;
+ long nXRight = aSz.Width()-RMARGPRN+nBorder;
+
+ rOutDev.DrawRect( Rectangle(
+ Point( nXLeft, nYTop ),
+ Size( nXRight-nXLeft, aSz.Height() - nYTop - BMARGPRN + nBorder ) ) );
+
+
+ long nY = TMARGPRN-2*nBorder;
+ Point aPos( nLeftMargin, nY );
+ rOutDev.DrawText( aPos, rTitle );
+ if ( nPages != 1 )
+ {
+ aFont.SetWeight( WEIGHT_NORMAL );
+ rOutDev.SetFont( aFont );
+ String aPageStr( C2S(" [") );
+ aPageStr += String( SW_RES( STR_PAGE ) );
+ aPageStr += ' ';
+ aPageStr += String::CreateFromInt32( nCurPage );
+ aPageStr += ']';
+ aPos.X() += rOutDev.GetTextWidth( rTitle );
+ rOutDev.DrawText( aPos, aPageStr );
+ }
+
+
+ nY = TMARGPRN-nBorder;
+
+ rOutDev.DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) );
+
+ rOutDev.SetFont( aOldFont );
+ rOutDev.SetFillColor( aOldFillColor );
+}
+/* -----------------13.11.2003 16:24-----------------
+
+ --------------------------------------------------*/
+rtl_TextEncoding lcl_GetStreamCharSet(rtl_TextEncoding eLoadEncoding)
+{
+ rtl_TextEncoding eRet = eLoadEncoding;
+ if(RTL_TEXTENCODING_DONTKNOW == eRet)
+ {
+ SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get();
+ const sal_Char *pCharSet =
+ rtl_getBestMimeCharsetFromTextEncoding( pHtmlOptions->GetTextEncoding() );
+ eRet = rtl_getTextEncodingFromMimeCharset( pCharSet );
+ }
+ return eRet;
+}
+/*-----------------18.11.96 08.21-------------------
+
+--------------------------------------------------*/
+
+void lcl_ConvertTabsToSpaces( String& rLine )
+{
+ if ( rLine.Len() )
+ {
+ USHORT nPos = 0;
+ USHORT nMax = rLine.Len();
+ while ( nPos < nMax )
+ {
+ if ( rLine.GetChar(nPos) == '\t' )
+ {
+ // Nicht 4 Blanks, sondern an 4er TabPos:
+ String aBlanker;
+ aBlanker.Fill( ( 4 - ( nPos % 4 ) ), ' ' );
+ rLine.Erase( nPos, 1 );
+ rLine.Insert( aBlanker, nPos );
+ nMax = rLine.Len();
+ }
+ nPos++; // Nicht optimal, falls Tab, aber auch nicht verkehrt...
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwSrcView::SwSrcView(SfxViewFrame* pViewFrame, SfxViewShell*) :
+ SfxViewShell( pViewFrame, SWSRCVIEWFLAGS ),
+ aEditWin( &pViewFrame->GetWindow(), this ),
+ pSearchItem(0),
+ bSourceSaved(FALSE),
+ eLoadEncoding(RTL_TEXTENCODING_DONTKNOW)
+{
+ Init();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwSrcView::~SwSrcView()
+{
+ SwDocShell* pDocShell = GetDocShell();
+ DBG_ASSERT(PTR_CAST(SwWebDocShell, pDocShell), "Wieso keine WebDocShell?");
+ const TextSelection& rSel = aEditWin.GetTextView()->GetSelection();
+ ((SwWebDocShell*)pDocShell)->SetSourcePara( static_cast< USHORT >( rSel.GetStart().GetPara() ) );
+
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ pDocShell->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps
+ = xDPS->getDocumentProperties();
+ ::rtl::OUString url = xDocProps->getAutoloadURL();
+ sal_Int32 delay = xDocProps->getAutoloadSecs();
+ pDocShell->SetAutoLoad(INetURLObject(url), delay,
+ (delay != 0) || !url.equalsAscii(""));
+// EndListening(*GetViewFrame());
+ EndListening(*pDocShell);
+ delete pSearchItem;
+}
+
+/*-----------------24.04.97 10:37-------------------
+
+--------------------------------------------------*/
+void SwSrcView::SaveContentTo(SfxMedium& rMed)
+{
+ SvStream* pOutStream = rMed.GetOutStream();
+ pOutStream->SetStreamCharSet(lcl_GetStreamCharSet(eLoadEncoding));
+ aEditWin.Write( *pOutStream );//, EE_FORMAT_TEXT);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwSrcView::Init()
+{
+ SetHelpId(SW_SRC_VIEWSHELL);
+ SetName(C2S("Source"));
+ SetWindow( &aEditWin );
+ SwDocShell* pDocShell = GetDocShell();
+ // wird das Doc noch geladen, dann muss die DocShell das Load
+ // anwerfen, wenn das Laden abgeschlossen ist
+ if(!pDocShell->IsLoading())
+ Load(pDocShell);
+ else
+ {
+ aEditWin.SetReadonly(TRUE);
+ }
+
+// StartListening(*GetViewFrame());
+ StartListening(*pDocShell,TRUE);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwDocShell* SwSrcView::GetDocShell()
+{
+ SfxObjectShell* pObjShell = GetViewFrame()->GetObjectShell();
+ return PTR_CAST(SwDocShell, pObjShell);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwSrcView::SaveContent(const String& rTmpFile)
+{
+ SfxMedium aMedium( rTmpFile, STREAM_WRITE, TRUE);
+ SvStream* pOutStream = aMedium.GetOutStream();
+ pOutStream->SetStreamCharSet( lcl_GetStreamCharSet(eLoadEncoding) );
+ aEditWin.Write(*pOutStream);//, EE_FORMAT_TEXT);
+ aMedium.Commit();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwSrcView::Execute(SfxRequest& rReq)
+{
+ USHORT nSlot = rReq.GetSlot();
+ TextView* pTextView = aEditWin.GetTextView();
+ switch( nSlot )
+ {
+ case SID_SAVEASDOC:
+ {
+ SvtPathOptions aPathOpt;
+ // filesave dialog with autoextension
+ FileDialogHelper aDlgHelper(
+ TemplateDescription::FILESAVE_AUTOEXTENSION,
+ TemplateDescription::FILESAVE_SIMPLE );
+ uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+// pFileDlg->SetHelpId(HID_FILEDLG_SRCVIEW);
+ uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
+
+ // search for an html filter for export
+ SfxFilterContainer* pFilterCont = GetObjectShell()->GetFactory().GetFilterContainer();
+ const SfxFilter* pFilter =
+ pFilterCont->GetFilter4Extension( C2S("html"), SFX_FILTER_EXPORT );
+ if ( pFilter )
+ {
+ // filter found -> use its uiname and wildcard
+ const String& rUIName = pFilter->GetUIName();
+ const WildCard& rCard = pFilter->GetWildcard();
+ xFltMgr->appendFilter( rUIName, rCard() );
+ xFltMgr->setCurrentFilter( rUIName ) ;
+ }
+ else
+ {
+ // filter not found
+ String sHtml(C2S("HTML"));
+ xFltMgr->appendFilter( sHtml, C2S("*.html;*.htm") );
+ xFltMgr->setCurrentFilter( sHtml ) ;
+ }
+
+ xFP->setDisplayDirectory( aPathOpt.GetWorkPath() );
+ if( aDlgHelper.Execute() == ERRCODE_NONE)
+ {
+ SfxMedium aMedium( xFP->getFiles().getConstArray()[0],
+ STREAM_WRITE | STREAM_SHARE_DENYNONE,
+ FALSE );
+ SvStream* pOutStream = aMedium.GetOutStream();
+ pOutStream->SetStreamCharSet(lcl_GetStreamCharSet(eLoadEncoding));
+ aEditWin.Write( *pOutStream );
+ aMedium.Commit();
+ }
+ }
+ break;
+ case SID_SAVEDOC:
+ {
+ SwDocShell* pDocShell = GetDocShell();
+ SfxMedium* pMed = 0;
+ if(pDocShell->HasName())
+ pMed = pDocShell->GetMedium();
+ else
+ {
+ SfxBoolItem* pItem = (SfxBoolItem*)pDocShell->ExecuteSlot(rReq, pDocShell->GetInterface());
+ if(pItem && pItem->GetValue())
+ pMed = pDocShell->GetMedium();
+ }
+ if(pMed)
+ {
+ SvStream* pOutStream = pMed->GetOutStream();
+ pOutStream->Seek(0);
+ pOutStream->SetStreamSize(0);
+ pOutStream->SetStreamCharSet(lcl_GetStreamCharSet(eLoadEncoding));
+ aEditWin.Write( *pOutStream );
+ pMed->CloseOutStream();
+ pMed->Commit();
+ pDocShell->GetDoc()->ResetModified();
+ SourceSaved();
+ aEditWin.ClearModifyFlag();
+ }
+ }
+ break;
+ case FID_SEARCH_NOW:
+ {
+ const SfxItemSet* pTmpArgs = rReq.GetArgs();
+
+ USHORT nWhich = pTmpArgs->GetWhichByPos( 0 );
+ DBG_ASSERT( nWhich, "Wich fuer SearchItem ?" );
+ const SfxPoolItem& rItem = pTmpArgs->Get( nWhich );
+ SetSearchItem( (const SvxSearchItem&)rItem);
+ StartSearchAndReplace( (const SvxSearchItem&)rItem, FALSE, rReq.IsAPI() );
+ if(aEditWin.IsModified())
+ GetDocShell()->GetDoc()->SetModified();
+ }
+ break;
+ case FN_REPEAT_SEARCH:
+ {
+ SvxSearchItem* pSrchItem = GetSearchItem();
+ if(pSrchItem)
+ {
+ StartSearchAndReplace( *pSrchItem, FALSE, rReq.IsAPI() );
+ if(aEditWin.IsModified())
+ GetDocShell()->GetDoc()->SetModified();
+ }
+ }
+ break;
+ case SID_PRINTDOC:
+ case SID_PRINTDOCDIRECT:
+ {
+ SfxViewShell::ExecuteSlot( rReq, SfxViewShell::GetInterface() );
+ }
+ break;
+ case SID_UNDO:
+ pTextView->Undo();
+ GetViewFrame()->GetBindings().InvalidateAll(FALSE);
+ break;
+ case SID_REDO:
+ pTextView->Redo();
+ GetViewFrame()->GetBindings().InvalidateAll(FALSE);
+ break;
+ case SID_REPEAT:
+ break;
+ case SID_CUT:
+ if(pTextView->HasSelection())
+ pTextView->Cut();
+ break;
+ case SID_COPY:
+ if(pTextView->HasSelection())
+ pTextView->Copy();
+ break;
+ case SID_PASTE:
+ pTextView->Paste();
+ break;
+ case SID_SELECTALL:
+ pTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) );
+ break;
+ }
+ aEditWin.Invalidate();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwSrcView::GetState(SfxItemSet& rSet)
+{
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+ TextView* pTextView = aEditWin.GetTextView();
+
+ while(nWhich)
+ {
+ switch(nWhich)
+ {
+ case SID_SAVEASDOC:
+ rSet.Put(SfxStringItem(nWhich, String(SW_RES(STR_SAVEAS_SRC))));
+ break;
+ case SID_SAVEDOC:
+ {
+ SwDocShell* pDocShell = GetDocShell();
+ if(!pDocShell->IsModified())
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case SID_PRINTDOC:
+ case SID_PRINTDOCDIRECT:
+ break;
+ case SID_TABLE_CELL:
+ {
+ String aPos( SW_RES(STR_SRCVIEW_ROW) );
+ TextSelection aSel = pTextView->GetSelection();
+ aPos += String::CreateFromInt32( aSel.GetEnd().GetPara()+1 );
+ aPos +=C2S(" : ");
+ aPos += String(SW_RES(STR_SRCVIEW_COL));
+ aPos += String::CreateFromInt32( aSel.GetEnd().GetIndex()+1 );
+ SfxStringItem aItem( nWhich, aPos );
+ rSet.Put( aItem );
+ }
+ break;
+ case SID_SEARCH_OPTIONS:
+ {
+ USHORT nOpt = SRC_SEARCHOPTIONS;
+ if(GetDocShell()->IsReadOnly())
+ nOpt &= ~(SEARCH_OPTIONS_REPLACE|SEARCH_OPTIONS_REPLACE_ALL);
+
+ rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS, nOpt) );
+ }
+ break;
+ case SID_SEARCH_ITEM:
+ {
+ String sSelected;
+ if ( !pTextView->HasSelection() )
+ {
+ const TextSelection& rSel = pTextView->GetSelection();
+ sSelected = aEditWin.GetTextEngine()->GetWord( rSel.GetStart());
+ }
+ else
+ {
+ sSelected = pTextView->GetSelected();
+ }
+ SvxSearchItem * pSrchItem = GetSearchItem();
+ pSrchItem->SetSearchString( sSelected );
+ rSet.Put( *pSrchItem );
+ }
+ break;
+ case FN_REPEAT_SEARCH:
+ {
+ if(!GetSearchItem())
+ rSet.DisableItem(nWhich);
+ };
+ break;
+ case SID_UNDO:
+ case SID_REDO:
+ {
+ ::svl::IUndoManager& rMgr = pTextView->GetTextEngine()->GetUndoManager();
+ USHORT nCount = 0;
+ if(nWhich == SID_UNDO)
+ {
+ nCount = rMgr.GetUndoActionCount();
+ if(nCount)
+ {
+ String aStr(SvtResId( STR_UNDO));;
+ aStr += rMgr.GetUndoActionComment(--nCount);
+ rSet.Put(SfxStringItem(nWhich, aStr));
+ }
+ else
+ rSet.DisableItem(nWhich);
+ }
+ else
+ {
+ nCount = rMgr.GetRedoActionCount();
+ if(nCount)
+ {
+ String aStr(SvtResId( STR_REDO));;
+ aStr += rMgr.GetRedoActionComment(--nCount);
+ rSet.Put(SfxStringItem(nWhich,aStr));
+ }
+ else
+ rSet.DisableItem(nWhich);
+ }
+ }
+ break;
+ case SID_MAIL_SENDDOCASPDF:
+ case SID_MAIL_SENDDOC :
+ case SID_EXPORTDOCASPDF:
+ case SID_DIRECTEXPORTDOCASPDF:
+ case SID_EXPORTDOC:
+ case SID_REPEAT:
+ case SID_BROWSER_MODE:
+ case FN_PRINT_LAYOUT:
+ rSet.DisableItem(nWhich);
+ break;
+ case SID_CUT:
+ case SID_COPY:
+ if(!pTextView->HasSelection())
+ rSet.DisableItem(nWhich);
+ break;
+ case SID_PASTE:
+ {
+ TransferableDataHelper aDataHelper(
+ TransferableDataHelper::CreateFromSystemClipboard(
+ &aEditWin) );
+ BOOL bDisable = !aDataHelper.GetXTransferable().is() ||
+ 0 == aDataHelper.GetFormatCount();
+ if( bDisable )
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SvxSearchItem* SwSrcView::GetSearchItem()
+{
+ if(!pSearchItem)
+ {
+ pSearchItem = new SvxSearchItem(SID_SEARCH_ITEM);
+ }
+ return pSearchItem;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwSrcView::SetSearchItem( const SvxSearchItem& rItem )
+{
+ delete pSearchItem;
+ pSearchItem = (SvxSearchItem*)rItem.Clone();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
+ BOOL bFromStart,
+ BOOL bApi,
+ BOOL bRecursive)
+{
+ ExtTextView* pTextView = aEditWin.GetTextView();
+ TextSelection aSel;
+ TextPaM aPaM;
+
+ BOOL bForward = !rSearchItem.GetBackward();
+ BOOL bAtStart = pTextView->GetSelection() == TextSelection( aPaM, aPaM );
+
+ if( !bForward )
+ aPaM = TextPaM( (ULONG)-1, (USHORT)-1 );
+
+ if( bFromStart )
+ {
+ aSel = pTextView->GetSelection();
+ pTextView->SetSelection( TextSelection( aPaM, aPaM ));
+ }
+
+ util::SearchOptions aSearchOpt( rSearchItem.GetSearchOptions() );
+ aSearchOpt.Locale = SvxCreateLocale(
+ static_cast< LanguageType >( GetAppLanguage() ) );
+
+ USHORT nFound;
+ BOOL bAll = FALSE;
+ switch( rSearchItem.GetCommand() )
+ {
+ case SVX_SEARCHCMD_FIND:
+ case SVX_SEARCHCMD_FIND_ALL:
+ nFound = pTextView->Search( aSearchOpt, bForward );
+ break;
+
+ case SVX_SEARCHCMD_REPLACE_ALL: bAll = TRUE;
+ case SVX_SEARCHCMD_REPLACE:
+ nFound = pTextView->Replace( aSearchOpt, bAll, bForward );
+ break;
+
+ default:
+ nFound = 0;
+ }
+
+ if( !nFound )
+ {
+ BOOL bNotFoundMessage = FALSE;
+ if(!bRecursive)
+ {
+ if(!bFromStart)
+ {
+ bNotFoundMessage = bAtStart;
+ }
+ else
+ {
+ bNotFoundMessage = TRUE;
+ pTextView->SetSelection( aSel );
+ }
+ }
+ else if(bAtStart)
+ {
+ bNotFoundMessage = TRUE;
+ }
+
+
+ if(!bApi)
+ {
+ if(bNotFoundMessage)
+ {
+ InfoBox( 0, SW_RES(MSG_NOT_FOUND)).Execute();
+ }
+ else if(!bRecursive && RET_YES ==
+ QueryBox(0, SW_RES( bForward ? MSG_SEARCH_END
+ : MSG_SEARCH_START)).Execute())
+ {
+ pTextView->SetSelection( TextSelection( aPaM, aPaM ) );
+ StartSearchAndReplace( rSearchItem, FALSE, FALSE, TRUE );
+ }
+ }
+ }
+ return nFound;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+USHORT SwSrcView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool )
+{
+ SwDocShell* pDocSh = GetDocShell();
+ if ( (SFX_PRINTER_JOBSETUP | SFX_PRINTER_PRINTER) & nDiffFlags )
+ {
+ pDocSh->GetDoc()->setPrinter( pNew, true, true );
+ if ( nDiffFlags & SFX_PRINTER_PRINTER )
+ pDocSh->SetModified();
+ }
+ if ( nDiffFlags & SFX_PRINTER_OPTIONS )
+ ::SetPrinter( pDocSh->getIDocumentDeviceAccess(), pNew, TRUE );
+
+ const BOOL bChgOri = nDiffFlags & SFX_PRINTER_CHG_ORIENTATION ? TRUE : FALSE;
+ const BOOL bChgSize= nDiffFlags & SFX_PRINTER_CHG_SIZE ? TRUE : FALSE;
+ if ( bChgOri || bChgSize )
+ {
+ pDocSh->SetModified();
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SfxPrinter* SwSrcView::GetPrinter( BOOL bCreate )
+{
+ return GetDocShell()->GetDoc()->getPrinter( bCreate );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+sal_Int32 SwSrcView::PrintSource(
+ OutputDevice *pOutDev,
+ sal_Int32 nPage,
+ bool bCalcNumPagesOnly )
+{
+ if (!pOutDev || nPage <= 0)
+ return 0;
+
+ //! this a lgorithm for printing the n-th page is very poor since it
+ //! needs to go over the text of all previous pages to get to the correct one.
+ //! But since HTML source code is expected to be just a small number of pages
+ //! even this poor algorithm should be enough...
+
+ pOutDev->Push();
+
+ TextEngine* pTextEngine = aEditWin.GetTextEngine();
+ pOutDev->SetMapMode( MAP_100TH_MM );
+ Font aFont( aEditWin.GetOutWin()->GetFont() );
+ Size aSize( aFont.GetSize() );
+ aSize = aEditWin.GetOutWin()->PixelToLogic( aSize, MAP_100TH_MM );
+ aFont.SetSize( aSize );
+ aFont.SetColor( COL_BLACK );
+ pOutDev->SetFont( aFont );
+
+ String aTitle( GetViewFrame()->GetWindow().GetText() );
+
+ USHORT nLineHeight = (USHORT) pOutDev->GetTextHeight(); // etwas mehr.
+ USHORT nParaSpace = 10;
+
+ Size aPaperSz = pOutDev->GetOutputSize();
+ aPaperSz.Width() -= (LMARGPRN + RMARGPRN);
+ aPaperSz.Height() -= (TMARGPRN + BMARGPRN);
+
+ // nLinepPage stimmt nicht, wenn Zeilen umgebrochen werden muessen...
+ USHORT nLinespPage = (USHORT) (aPaperSz.Height() / nLineHeight);
+ USHORT nCharspLine = (USHORT) (aPaperSz.Width() / pOutDev->GetTextWidth( 'X' ));
+ USHORT nParas = static_cast< USHORT >( pTextEngine->GetParagraphCount() );
+
+ USHORT nPages = (USHORT) (nParas / nLinespPage + 1 );
+ USHORT nCurPage = 1;
+
+ // Header drucken...
+ if (!bCalcNumPagesOnly && nPage == nCurPage)
+ lcl_PrintHeader( *pOutDev, nPages, nCurPage, aTitle );
+ const Point aStartPos( LMARGPRN, TMARGPRN );
+ Point aPos( aStartPos );
+ for ( USHORT nPara = 0; nPara < nParas; ++nPara )
+ {
+ String aLine( pTextEngine->GetText( nPara ) );
+ lcl_ConvertTabsToSpaces( aLine );
+ USHORT nLines = aLine.Len() / nCharspLine + 1;
+ for ( USHORT nLine = 0; nLine < nLines; ++nLine )
+ {
+ String aTmpLine( aLine, nLine * nCharspLine, nCharspLine );
+ aPos.Y() += nLineHeight;
+ if ( aPos.Y() > ( aPaperSz.Height() + TMARGPRN - nLineHeight/2 ) )
+ {
+ ++nCurPage;
+ if (!bCalcNumPagesOnly && nPage == nCurPage)
+ lcl_PrintHeader( *pOutDev, nPages, nCurPage, aTitle );
+ aPos = aStartPos;
+ }
+ if (!bCalcNumPagesOnly && nPage == nCurPage)
+ pOutDev->DrawText( aPos, aTmpLine );
+ }
+ aPos.Y() += nParaSpace;
+ }
+
+ pOutDev->Pop();
+
+ DBG_ASSERT( bCalcNumPagesOnly || nPage <= nCurPage, "page number out of range" );
+ return nCurPage;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwSrcView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ if ( rHint.ISA(SfxSimpleHint) &&
+ (
+ ((SfxSimpleHint&) rHint).GetId() == SFX_HINT_MODECHANGED ||
+ (
+ ((SfxSimpleHint&) rHint).GetId() == SFX_HINT_TITLECHANGED &&
+ !GetDocShell()->IsReadOnly() && aEditWin.IsReadonly()
+ )
+ )
+ )
+ {
+ // Broadcast kommt nur einmal!
+ const SwDocShell* pDocSh = GetDocShell();
+ const BOOL bReadonly = pDocSh->IsReadOnly();
+ aEditWin.SetReadonly(bReadonly);
+ }
+ SfxViewShell::Notify(rBC, rHint);
+}
+
+/*-----------------19.04.97 10:19-------------------
+
+--------------------------------------------------*/
+void SwSrcView::Load(SwDocShell* pDocShell)
+{
+ SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get();
+ const sal_Char *pCharSet =
+ rtl_getBestMimeCharsetFromTextEncoding( pHtmlOptions->GetTextEncoding() );
+ rtl_TextEncoding eDestEnc = rtl_getTextEncodingFromMimeCharset( pCharSet );
+
+ aEditWin.SetReadonly(pDocShell->IsReadOnly());
+ aEditWin.SetTextEncoding(eDestEnc);
+ SfxMedium* pMedium = pDocShell->GetMedium();
+
+ const SfxFilter* pFilter = pMedium->GetFilter();
+ BOOL bHtml = pFilter && pFilter->GetUserData().EqualsAscii("HTML");
+ BOOL bDocModified = pDocShell->IsModified();
+ if(bHtml && !bDocModified && pDocShell->HasName())
+ {
+ SvStream* pStream = pMedium->GetInStream();
+ if(pStream && 0 == pStream->GetError() )
+ {
+ rtl_TextEncoding eHeaderEnc =
+ SfxHTMLParser::GetEncodingByHttpHeader(
+ pDocShell->GetHeaderAttributes() );
+ if( RTL_TEXTENCODING_DONTKNOW == eHeaderEnc )
+ {
+ const sal_Char *pTmpCharSet =
+ rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_ISO_8859_1 );
+ eHeaderEnc = rtl_getTextEncodingFromMimeCharset( pTmpCharSet );
+ }
+ if( RTL_TEXTENCODING_DONTKNOW != eHeaderEnc &&
+ eDestEnc != eHeaderEnc )
+ {
+ eDestEnc = eHeaderEnc;
+ aEditWin.SetTextEncoding(eDestEnc);
+ }
+ pStream->SetStreamCharSet( eDestEnc );
+ pStream->Seek(0);
+ TextEngine* pTextEngine = aEditWin.GetTextEngine();
+ pTextEngine->EnableUndo(FALSE);
+ aEditWin.Read(*pStream);//, EE_FORMAT_TEXT);
+ pTextEngine->EnableUndo(TRUE);
+ }
+ else
+ {
+ Window *pTmpWindow = &GetViewFrame()->GetWindow();
+ InfoBox(pTmpWindow, SW_RES(MSG_ERR_SRCSTREAM)).Execute();
+ }
+ }
+ else
+ {
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ String sFileURL( aTempFile.GetURL() );
+ SvtSaveOptions aOpt;
+
+ {
+ SfxMedium aMedium( sFileURL,STREAM_READWRITE, TRUE );
+ SwWriter aWriter( aMedium, *pDocShell->GetDoc() );
+ WriterRef xWriter;
+ ::GetHTMLWriter(aEmptyStr, aMedium.GetBaseURL( true ), xWriter);
+ String sWriteName = pDocShell->HasName() ?
+ pMedium->GetName() :
+ (const String&) sFileURL;
+ ULONG nRes = aWriter.Write(xWriter, &sWriteName);
+ if(nRes)
+ {
+ ErrorHandler::HandleError(ErrCode(nRes));
+ aEditWin.SetReadonly(TRUE);
+ }
+ aMedium.Commit();
+ SvStream* pInStream = aMedium.GetInStream();
+ pInStream->Seek(0);
+ pInStream->SetStreamCharSet( eDestEnc );
+
+
+ aEditWin.Read(*pInStream);//, EE_FORMAT_TEXT);
+ }
+ }
+ aEditWin.ClearModifyFlag();
+
+ eLoadEncoding = eDestEnc;
+
+ if(bDocModified)
+ pDocShell->SetModified();// das Flag wird zwischendurch zurueckgesetzt
+ // AutoLoad abschalten
+ pDocShell->SetAutoLoad(INetURLObject(), 0, FALSE);
+ DBG_ASSERT(PTR_CAST(SwWebDocShell, pDocShell), "Wieso keine WebDocShell?");
+ USHORT nLine = ((SwWebDocShell*)pDocShell)->GetSourcePara();
+ aEditWin.SetStartLine(nLine);
+ aEditWin.GetTextEngine()->ResetUndo();
+ aEditWin.GetOutWin()->GrabFocus();
+}
+
+
diff --git a/sw/source/ui/uiview/swcli.cxx b/sw/source/ui/uiview/swcli.cxx
new file mode 100644
index 000000000000..4265f3cf8cd0
--- /dev/null
+++ b/sw/source/ui/uiview/swcli.cxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+
+#include <wrtsh.hxx>
+#include <doc.hxx>
+#include <swtypes.hxx>
+#include <view.hxx>
+#include <edtwin.hxx>
+#include <swcli.hxx>
+#include <cmdid.h>
+#include <cfgitems.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+
+using namespace com::sun::star;
+
+SwOleClient::SwOleClient( SwView *pView, SwEditWin *pWin, const svt::EmbeddedObjectRef& xObj ) :
+ SfxInPlaceClient( pView, pWin, xObj.GetViewAspect() ), bInDoVerb( FALSE ),
+ bOldCheckForOLEInCaption( pView->GetWrtShell().IsCheckForOLEInCaption() )
+{
+ SetObject( xObj.GetObject() );
+}
+
+void SwOleClient::RequestNewObjectArea( Rectangle& aLogRect )
+{
+ //Der Server moechte die Clientgrosse verandern.
+ //Wir stecken die Wunschgroesse in die Core. Die Attribute des Rahmens
+ //werden auf den Wunschwert eingestellt. Dieser Wert wird also auch an
+ //den InPlaceClient weitergegeben.
+ //Die Core aktzeptiert bzw. formatiert die eingestellten Werte nicht
+ //zwangslaeufig. Wenn der Ole-Frm formatiert wurde wird das CalcAndSetScale()
+ //der WrtShell gerufen. Dort wird ggf. die Scalierung des SwOleClient
+ //eingestellt.
+
+ SwWrtShell &rSh = ((SwView*)GetViewShell())->GetWrtShell();
+
+ rSh.StartAllAction();
+
+ // the aLogRect will get the preliminary size now
+ aLogRect.SetSize( rSh.RequestObjectResize( SwRect( aLogRect ), GetObject() ) );
+
+ // the EndAllAction() call will trigger CalcAndSetScale() call,
+ // so the embedded object must get the correct size before
+ if ( aLogRect.GetSize() != GetScaledObjArea().GetSize() )
+ {
+ // size has changed, so first change visual area of the object before we resize its view
+ // without this the object always would be scaled - now it has the choice
+
+ // TODO/LEAN: getMapUnit can switch object to running state
+ MapMode aObjectMap( VCLUnoHelper::UnoEmbed2VCLMapUnit( GetObject()->getMapUnit( GetAspect() ) ) );
+ MapMode aClientMap( GetEditWin()->GetMapMode().GetMapUnit() );
+
+ Size aNewObjSize( Fraction( aLogRect.GetWidth() ) / GetScaleWidth(),
+ Fraction( aLogRect.GetHeight() ) / GetScaleHeight() );
+
+ // convert to logical coordinates of the embedded object
+ Size aNewSize = GetEditWin()->LogicToLogic( aNewObjSize, &aClientMap, &aObjectMap );
+ GetObject()->setVisualAreaSize( GetAspect(), awt::Size( aNewSize.Width(), aNewSize.Height() ) );
+ }
+
+ rSh.EndAllAction();
+
+ SwRect aFrm( rSh.GetAnyCurRect( RECT_FLY_EMBEDDED, 0, GetObject() )),
+ aPrt( rSh.GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, GetObject() ));
+ aLogRect.SetPos( aPrt.Pos() + aFrm.Pos() );
+ aLogRect.SetSize( aPrt.SSize() );
+}
+
+void SwOleClient::ObjectAreaChanged()
+{
+ SwWrtShell &rSh = ((SwView*)GetViewShell())->GetWrtShell();
+ SwRect aFrm( rSh.GetAnyCurRect( RECT_FLY_EMBEDDED, 0, GetObject() )),
+ aPrt( rSh.GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, GetObject() ));
+ if ( !aFrm.IsOver( rSh.VisArea() ) )
+ rSh.MakeVisible( aFrm );
+}
+
+void SwOleClient::ViewChanged()
+{
+ if ( bInDoVerb )
+ return;
+
+ if ( GetAspect() == embed::Aspects::MSOLE_ICON )
+ {
+ // the iconified object seems not to need such a scaling handling
+ // since the replacement image and the size a completely controlled by the container
+ // TODO/LATER: when the icon exchange is implemented the scaling handling might be required again here
+ return;
+ }
+
+ SwWrtShell &rSh = ((SwView*)GetViewShell())->GetWrtShell();
+
+ //Einstellen der Groesse des Objektes in der Core. Die Scalierung muss
+ //beruecksichtigt werden. Rueckwirkung auf das Objekt werden von
+ //CalcAndSetScale() der WrtShell beruecksichtig, wenn die Groesse/Pos des
+ //Rahmens in der Core sich veraendert.
+
+ // TODO/LEAN: getMapUnit can switch object to running state
+ awt::Size aSz;
+ try
+ {
+ aSz = GetObject()->getVisualAreaSize( GetAspect() );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {
+ // Nothing will be done
+ }
+ catch( uno::Exception& )
+ {
+ // this is an error
+ OSL_ENSURE( sal_False, "Something goes wrong on requesting object size!\n" );
+ }
+
+ Size aVisSize( aSz.Width, aSz.Height );
+
+ // Bug 24833: solange keine vernuenftige Size vom Object kommt,
+ // kann nichts skaliert werden
+ if( !aVisSize.Width() || !aVisSize.Height() )
+ return;
+
+ // first convert to TWIPS before scaling, because scaling factors are calculated for
+ // the TWIPS mapping and so they will produce the best results if applied to TWIPS based
+ // coordinates
+ const MapMode aMyMap ( MAP_TWIP );
+ const MapMode aObjMap( VCLUnoHelper::UnoEmbed2VCLMapUnit( GetObject()->getMapUnit( GetAspect() ) ) );
+ aVisSize = OutputDevice::LogicToLogic( aVisSize, aObjMap, aMyMap );
+
+ aVisSize.Width() = Fraction( aVisSize.Width() ) * GetScaleWidth();
+ aVisSize.Height()= Fraction( aVisSize.Height() ) * GetScaleHeight();
+
+ SwRect aRect( Point( LONG_MIN, LONG_MIN ), aVisSize );
+ rSh.LockView( TRUE ); //Scrollen im EndAction verhindern
+ rSh.StartAllAction();
+ rSh.RequestObjectResize( aRect, GetObject() );
+ rSh.EndAllAction();
+ rSh.LockView( FALSE );
+}
+
+void SwOleClient::MakeVisible()
+{
+ const SwWrtShell &rSh = ((SwView*)GetViewShell())->GetWrtShell();
+ rSh.MakeObjVisible( GetObject() );
+}
+
+// --> #i972#
+void SwOleClient::FormatChanged()
+{
+ const uno::Reference < embed::XEmbeddedObject >& xObj( GetObject() );
+ SwView * pView = dynamic_cast< SwView * >( GetViewShell() );
+ if ( pView && xObj.is() && SotExchange::IsMath( xObj->getClassID() ) )
+ {
+ SwWrtShell & rWrtSh = pView->GetWrtShell();
+ if (rWrtSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ))
+ rWrtSh.AlignFormulaToBaseline( xObj );
+ }
+}
+// <--
+
diff --git a/sw/source/ui/uiview/uivwimp.cxx b/sw/source/ui/uiview/uivwimp.cxx
new file mode 100644
index 000000000000..73ec9ab71dd4
--- /dev/null
+++ b/sw/source/ui/uiview/uivwimp.cxx
@@ -0,0 +1,345 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <cmdid.h>
+#include "globals.hrc"
+
+#include <tools/shl.hxx>
+#include <com/sun/star/scanner/XScannerManager.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/msgbox.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+
+#include <sfx2/docinsert.hxx>
+#include <sfx2/request.hxx>
+#include <uivwimp.hxx>
+#include <wview.hxx>
+#include <unotxvw.hxx>
+#include <unodispatch.hxx>
+#include <swmodule.hxx>
+#include <swdtflvr.hxx>
+#include <edtwin.hxx>
+#include <mmconfigitem.hxx>
+
+#include <view.hrc>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::scanner;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::datatransfer::clipboard;
+
+/* -----------------02.06.98 15:31-------------------
+ *
+ * --------------------------------------------------*/
+SwView_Impl::SwView_Impl(SwView* pShell) :
+ pxXTextView(new uno::Reference<view::XSelectionSupplier>),
+ pView(pShell),
+ eShellMode(SHELL_MODE_TEXT),
+ pConfigItem(0),
+ nMailMergeRestartPage(0),
+ bMailMergeSourceView(sal_True),
+ m_pDocInserter(NULL),
+ m_pRequest(NULL),
+ m_bSelectObject(false),
+ m_bEditingPositionSet(false)
+{
+ *pxXTextView = new SwXTextView(pView);
+ xDisProvInterceptor = new SwXDispatchProviderInterceptor(*pView);
+}
+
+/*-----------------13.12.97 09:51-------------------
+
+--------------------------------------------------*/
+SwView_Impl::~SwView_Impl()
+{
+ Reference<XUnoTunnel> xDispTunnel(xDisProvInterceptor, UNO_QUERY);
+ SwXDispatchProviderInterceptor* pInterceptor = 0;
+ if(xDispTunnel.is() &&
+ 0 != (pInterceptor = reinterpret_cast< SwXDispatchProviderInterceptor * >(
+ sal::static_int_cast< sal_IntPtr >(
+ xDispTunnel->getSomething(SwXDispatchProviderInterceptor::getUnoTunnelId())))))
+ {
+ pInterceptor->Invalidate();
+ }
+ view::XSelectionSupplier* pTextView = pxXTextView->get();
+ ((SwXTextView*)pTextView)->Invalidate();
+ delete pxXTextView;
+ if( xScanEvtLstnr.is() )
+ pScanEvtLstnr->ViewDestroyed();
+ if( xClipEvtLstnr.is() )
+ {
+ pClipEvtLstnr->AddRemoveListener( FALSE );
+ pClipEvtLstnr->ViewDestroyed();
+ }
+ delete pConfigItem;
+
+ delete m_pDocInserter;
+ delete m_pRequest;
+}
+
+/*-----------------13.12.97 09:54-------------------
+
+--------------------------------------------------*/
+void SwView_Impl::SetShellMode(ShellModes eSet)
+{
+ eShellMode = eSet;
+}
+/*-----------------13.12.97 09:59-------------------
+
+--------------------------------------------------*/
+view::XSelectionSupplier* SwView_Impl::GetUNOObject()
+{
+ return pxXTextView->get();
+}
+/* -----------------02.06.98 15:29-------------------
+ *
+ * --------------------------------------------------*/
+SwXTextView* SwView_Impl::GetUNOObject_Impl()
+{
+ view::XSelectionSupplier* pTextView = pxXTextView->get();
+ return ((SwXTextView*)pTextView);
+}
+/* -----------------------------29.05.00 09:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwView_Impl::ExecuteScan( SfxRequest& rReq )
+{
+ USHORT nSlot = rReq.GetSlot();
+ switch(nSlot)
+ {
+ case SID_TWAIN_SELECT:
+ {
+ BOOL bDone = FALSE;
+ Reference< XScannerManager > xScanMgr = SW_MOD()->GetScannerManager();
+
+ if( xScanMgr.is() )
+ {
+ try
+ {
+ const Sequence< ScannerContext >
+ aContexts( xScanMgr->getAvailableScanners() );
+
+ if( aContexts.getLength() )
+ {
+ ScannerContext aContext( aContexts.getConstArray()[ 0 ] );
+ bDone = xScanMgr->configureScanner( aContext );
+ }
+ }
+ catch(...)
+ {
+ }
+
+ }
+ if( bDone )
+ rReq.Done();
+ else
+ {
+ rReq.Ignore();
+// KA 04.07.2002
+// InfoBox( 0, SW_RES(MSG_SCAN_NOSOURCE) ).Execute();
+ }
+ }
+ break;
+
+ case SID_TWAIN_TRANSFER:
+ {
+ BOOL bDone = FALSE;
+
+ Reference< XScannerManager > xScanMgr = SW_MOD()->GetScannerManager();
+ if( xScanMgr.is() )
+ {
+ SwScannerEventListener& rListener = GetScannerEventListener();
+ try
+ {
+ const Sequence< scanner::ScannerContext >aContexts( xScanMgr->getAvailableScanners() );
+ if( aContexts.getLength() )
+ {
+ Reference< XEventListener > xLstner = &rListener;
+ xScanMgr->startScan( aContexts.getConstArray()[ 0 ], xLstner );
+ bDone = TRUE;
+ }
+ }
+ catch(...)
+ {
+ }
+ }
+
+ if( !bDone )
+ {
+ InfoBox( 0, SW_RES(MSG_SCAN_NOSOURCE) ).Execute();
+ rReq.Ignore();
+ }
+ else
+ {
+ rReq.Done();
+ SfxBindings& rBind = pView->GetViewFrame()->GetBindings();
+ rBind.Invalidate( SID_TWAIN_SELECT );
+ rBind.Invalidate( SID_TWAIN_TRANSFER );
+ }
+ }
+ break;
+ }
+}
+
+/* -----------------------------29.05.00 08:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwScannerEventListener& SwView_Impl::GetScannerEventListener()
+{
+ if(!xScanEvtLstnr.is())
+ xScanEvtLstnr = pScanEvtLstnr = new SwScannerEventListener(*pView);
+ return *pScanEvtLstnr;
+}
+
+
+void SwView_Impl::AddClipboardListener()
+{
+ if(!xClipEvtLstnr.is())
+ {
+ xClipEvtLstnr = pClipEvtLstnr = new SwClipboardChangeListener( *pView );
+ pClipEvtLstnr->AddRemoveListener( TRUE );
+ }
+}
+/* -----------------3/31/2003 11:42AM----------------
+
+ --------------------------------------------------*/
+void SwView_Impl::Invalidate()
+{
+ GetUNOObject_Impl()->Invalidate();
+ Reference< XUnoTunnel > xTunnel(xTransferable.get(), UNO_QUERY);
+ if(xTunnel.is())
+
+ {
+ SwTransferable* pTransferable = reinterpret_cast< SwTransferable * >(
+ sal::static_int_cast< sal_IntPtr >(
+ xTunnel->getSomething(SwTransferable::getUnoTunnelId())));
+ if(pTransferable)
+ pTransferable->Invalidate();
+ }
+}
+/* -----------------3/31/2003 12:40PM----------------
+
+ --------------------------------------------------*/
+void SwView_Impl::AddTransferable(SwTransferable& rTransferable)
+{
+ //prevent removing of the non-referenced SwTransferable
+ rTransferable.m_refCount++;;
+ {
+ xTransferable = Reference<XUnoTunnel> (&rTransferable);
+ }
+ rTransferable.m_refCount--;
+}
+
+void SwView_Impl::StartDocumentInserter( const String& rFactory, const Link& rEndDialogHdl )
+{
+ delete m_pDocInserter;
+ m_pDocInserter = new ::sfx2::DocumentInserter( 0, rFactory );
+ m_pDocInserter->StartExecuteModal( rEndDialogHdl );
+}
+
+SfxMedium* SwView_Impl::CreateMedium()
+{
+ return m_pDocInserter->CreateMedium();
+}
+
+void SwView_Impl::InitRequest( const SfxRequest& rRequest )
+{
+ delete m_pRequest;
+ m_pRequest = new SfxRequest( rRequest );
+}
+
+// ------------------------- SwScannerEventListener ---------------------
+
+SwScannerEventListener::~SwScannerEventListener()
+{
+}
+
+void SAL_CALL SwScannerEventListener::disposing( const EventObject& rEventObject) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+#if defined WNT || defined UNX
+ if( pView )
+ pView->ScannerEventHdl( rEventObject );
+#endif
+}
+
+// ------------------------- SwClipboardChangeListener ---------------------
+
+SwClipboardChangeListener::~SwClipboardChangeListener()
+{
+}
+
+void SAL_CALL SwClipboardChangeListener::disposing( const EventObject& /*rEventObject*/ )
+ throw ( RuntimeException )
+{
+}
+
+void SAL_CALL SwClipboardChangeListener::changedContents( const CLIP_NMSPC::ClipboardEvent& rEventObject )
+ throw ( RuntimeException )
+
+{
+ const ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if( pView )
+ {
+ {
+ TransferableDataHelper aDataHelper( rEventObject.Contents );
+ SwWrtShell& rSh = pView->GetWrtShell();
+
+ pView->nLastPasteDestination = SwTransferable::GetSotDestination( rSh );
+ pView->bPasteState = aDataHelper.GetXTransferable().is() &&
+ SwTransferable::IsPaste( rSh, aDataHelper );
+
+ pView->bPasteSpecialState = aDataHelper.GetXTransferable().is() &&
+ SwTransferable::IsPasteSpecial( rSh, aDataHelper );
+ }
+
+ SfxBindings& rBind = pView->GetViewFrame()->GetBindings();
+ rBind.Invalidate( SID_PASTE );
+ rBind.Invalidate( SID_PASTE_SPECIAL );
+ rBind.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
+ }
+}
+
+void SwClipboardChangeListener::AddRemoveListener( BOOL bAdd )
+{
+ pView->AddRemoveClipboardListener( Reference< XClipboardListener >( this ), bAdd );
+}
+
+
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
new file mode 100644
index 000000000000..2c4a556f6bca
--- /dev/null
+++ b/sw/source/ui/uiview/view.cxx
@@ -0,0 +1,1933 @@
+ /*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+#include <stdlib.h>
+#include <hintids.hxx>
+#include <rtl/logfile.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/inputctx.hxx>
+#include <basic/sbxobj.hxx>
+#include <svl/eitem.hxx>
+#include <unotools/undoopt.hxx>
+#include <unotools/lingucfg.hxx>
+#include <unotools/useroptions.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/app.hxx>
+#include <svx/ruler.hxx>
+#include <editeng/protitem.hxx>
+#include <svx/fmshell.hxx>
+#include <svx/extrusionbar.hxx>
+#include <svx/fontworkbar.hxx>
+#include <unotxvw.hxx>
+#include <cmdid.h>
+#include <swhints.hxx>
+#include <swmodule.hxx>
+#include <inputwin.hxx>
+#include <chartins.hxx>
+#include <uivwimp.hxx>
+#include <uitool.hxx>
+#include <edtwin.hxx>
+#include <textsh.hxx>
+#include <listsh.hxx>
+#include <tabsh.hxx>
+#include <grfsh.hxx>
+#include <mediash.hxx>
+#include <docsh.hxx>
+#include <frmsh.hxx>
+#include <olesh.hxx>
+#include <drawsh.hxx>
+#include <drawbase.hxx>
+#include <drformsh.hxx>
+#include <drwtxtsh.hxx>
+#include <beziersh.hxx>
+#include <globdoc.hxx>
+#include <scroll.hxx>
+#include <navipi.hxx>
+#include <gloshdl.hxx>
+#include <usrpref.hxx>
+#include <srcview.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <drawdoc.hxx>
+#include <wdocsh.hxx>
+#include <wview.hxx>
+#include <workctrl.hxx>
+#include <wrtsh.hxx>
+#include <barcfg.hxx>
+#include <pview.hxx>
+#include <swdtflvr.hxx>
+#include <view.hrc>
+#include <globdoc.hrc>
+#include <frmui.hrc>
+#include <cfgitems.hxx>
+#include <prtopt.hxx>
+#include <linguistic/lngprops.hxx>
+#include <editeng/unolingu.hxx>
+//#include <sfx2/app.hxx>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/scanner/ScannerContext.hpp>
+#include <com/sun/star/scanner/XScannerManager.hpp>
+#include <toolkit/unohlp.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <xmloff/xmluconv.hxx>
+
+#include "formatclipboard.hxx"
+#include <PostItMgr.hxx>
+#include <annotsh.hxx>
+
+#include <fldbas.hxx>
+
+#include <unomid.h>
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::scanner;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+
+extern sal_Bool bNoInterrupt; // in mainwn.cxx
+
+#define SWVIEWFLAGS ( SFX_VIEW_CAN_PRINT| \
+ SFX_VIEW_HAS_PRINTOPTIONS)
+
+/*--------------------------------------------------------------------
+ Beschreibung: Statics
+ --------------------------------------------------------------------*/
+
+int bDocSzUpdated = 1;
+
+SvxSearchItem* SwView::pSrchItem = 0;
+
+sal_uInt16 SwView::nInsertCtrlState = FN_INSERT_TABLE;
+sal_uInt16 SwView::nWebInsertCtrlState = FN_INSERT_TABLE;
+sal_uInt16 SwView::nInsertObjectCtrlState = SID_INSERT_DIAGRAM;
+
+sal_Bool SwView::bExtra = sal_False;
+sal_Bool SwView::bFound = sal_False;
+sal_Bool SwView::bJustOpened = sal_False;
+
+
+SvxSearchDialog* SwView::pSrchDlg = 0;
+SearchAttrItemList* SwView::pSrchList = 0;
+SearchAttrItemList* SwView::pReplList = 0;
+
+DBG_NAME(viewhdl)
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+inline SfxDispatcher &SwView::GetDispatcher()
+{
+ return *GetViewFrame()->GetDispatcher();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwView::ImpSetVerb( int nSelType )
+{
+ sal_Bool bResetVerbs = bVerbsActive;
+ if ( !GetViewFrame()->GetFrame().IsInPlace() &&
+ (nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF) & nSelType )
+ {
+ if ( !pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT) )
+ {
+ if ( nSelType & nsSelectionType::SEL_OLE )
+ {
+ SetVerbs( GetWrtShell().GetOLEObject()->getSupportedVerbs() );
+ bVerbsActive = sal_True;
+ bResetVerbs = sal_False;
+ }
+ }
+ }
+ if ( bResetVerbs )
+ {
+ SetVerbs( Sequence< embed::VerbDescriptor >() );
+ bVerbsActive = sal_False;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Description:
+ called by the SwEditWin when it gets the focus
+ --------------------------------------------------------------------*/
+
+void SwView::GotFocus() const
+{
+ // if we got the focus, and the form shell *is* on the top of the dispatcher
+ // stack, then we need to rebuild the stack (the form shell doesn't belong to
+ // the top then)
+ const SfxDispatcher& rDispatcher = const_cast< SwView* >( this )->GetDispatcher();
+ SfxShell* pTopShell = rDispatcher.GetShell( 0 );
+ FmFormShell* pAsFormShell = PTR_CAST( FmFormShell, pTopShell );
+ if ( pAsFormShell )
+ {
+ pAsFormShell->ForgetActiveControl();
+ const_cast< SwView* >( this )->AttrChangedNotify( pWrtShell );
+ }
+ else if ( mpPostItMgr )
+ {
+ SwAnnotationShell* pAsAnnotationShell = PTR_CAST( SwAnnotationShell, pTopShell );
+ if ( pAsAnnotationShell )
+ {
+ mpPostItMgr->SetActiveSidebarWin(0);
+ const_cast< SwView* >( this )->AttrChangedNotify( pWrtShell );
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Description:
+ called by the FormShell when a form control is focused. This is
+ a request to put the form shell on the top of the dispatcher
+ stack
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwView, FormControlActivated, FmFormShell*, EMPTYARG )
+{
+ // if a form control has been activated, and the form shell is not on the top
+ // of the dispatcher stack, then we need to activate it
+ const SfxDispatcher& rDispatcher = GetDispatcher();
+ const SfxShell* pTopShell = rDispatcher.GetShell( 0 );
+ const FmFormShell* pAsFormShell = PTR_CAST( FmFormShell, pTopShell );
+ if ( !pAsFormShell )
+ {
+ // if we're editing text currently, cancel this
+ SdrView *pSdrView = pWrtShell ? pWrtShell->GetDrawView() : NULL;
+ if ( pSdrView && pSdrView->IsTextEdit() )
+ pSdrView->SdrEndTextEdit( sal_True );
+
+ const_cast< SwView* >( this )->AttrChangedNotify( pWrtShell );
+ }
+
+ return 0L;
+}
+
+void SwView::SelectShell()
+{
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+//
+// Achtung: SelectShell fuer die WebView mitpflegen
+//
+//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ if(bInDtor)
+ return;
+ // Entscheidung, ob UpdateTable gerufen werden muss
+ sal_Bool bUpdateTable = sal_False;
+ const SwFrmFmt* pCurTableFmt = pWrtShell->GetTableFmt();
+ if(pCurTableFmt && pCurTableFmt != pLastTableFormat)
+ {
+ bUpdateTable = sal_True; // kann erst spaeter ausgefuehrt werden
+ }
+ pLastTableFormat = pCurTableFmt;
+
+ //SEL_TBL und SEL_TBL_CELLS koennen verodert sein!
+ int nNewSelectionType = (pWrtShell->GetSelectionType()
+ & ~nsSelectionType::SEL_TBL_CELLS);
+
+ if ( pFormShell && pFormShell->IsActiveControl() )
+ nNewSelectionType |= nsSelectionType::SEL_FOC_FRM_CTRL;
+
+ if ( nNewSelectionType == nSelectionType )
+ {
+ GetViewFrame()->GetBindings().InvalidateAll( sal_False );
+ if ( nSelectionType & nsSelectionType::SEL_OLE ||
+ nSelectionType & nsSelectionType::SEL_GRF )
+ //Fuer Grafiken und OLE kann sich natuerlich das Verb aendern!
+ ImpSetVerb( nNewSelectionType );
+ }
+ else
+ {
+
+ SfxDispatcher &rDispatcher = GetDispatcher();
+ SwToolbarConfigItem *pBarCfg = SW_MOD()->GetToolbarConfig();
+
+ // DELETEZ(pxSelectionObj); //Selektionsobjekt loeschen
+ if ( pShell )
+ {
+ rDispatcher.Flush(); // alle gecachten Shells wirklich loeschen
+
+ //Zur alten Selektion merken welche Toolbar sichtbar war
+ USHORT nId = static_cast< USHORT >( rDispatcher.GetObjectBarId( SFX_OBJECTBAR_OBJECT ));
+ if ( nId )
+ pBarCfg->SetTopToolbar( nSelectionType, nId );
+
+ SfxShell *pSfxShell;
+ for ( sal_uInt16 i = 0; sal_True; ++i )
+ {
+ pSfxShell = rDispatcher.GetShell( i );
+ if ( pSfxShell->ISA( SwBaseShell )
+ || pSfxShell->ISA( SwDrawTextShell )
+ || pSfxShell->ISA( svx::ExtrusionBar )
+ || pSfxShell->ISA( svx::FontworkBar )
+ || pSfxShell->ISA( SwAnnotationShell )
+ )
+ {
+ rDispatcher.Pop( *pSfxShell, SFX_SHELL_POP_DELETE );
+ }
+ else if ( pSfxShell->ISA( FmFormShell ) )
+ {
+ rDispatcher.Pop( *pSfxShell );
+ }
+ else
+ break;
+ }
+ }
+
+ BOOL bInitFormShell = sal_False;
+ if (!pFormShell)
+ {
+ bInitFormShell = sal_True;
+ pFormShell = new FmFormShell( this );
+ pFormShell->SetControlActivationHandler( LINK( this, SwView, FormControlActivated ) );
+ StartListening(*pFormShell);
+ }
+
+ BOOL bSetExtInpCntxt = sal_False;
+ nSelectionType = nNewSelectionType;
+ ShellModes eShellMode;
+
+ if ( !( nSelectionType & nsSelectionType::SEL_FOC_FRM_CTRL ) )
+ rDispatcher.Push( *pFormShell );
+
+ if ( nSelectionType & nsSelectionType::SEL_OLE )
+ {
+ eShellMode = SHELL_MODE_OBJECT;
+ pShell = new SwOleShell( *this );
+ rDispatcher.Push( *pShell );
+ }
+ else if ( nSelectionType & nsSelectionType::SEL_FRM
+ || nSelectionType & nsSelectionType::SEL_GRF)
+ {
+ eShellMode = SHELL_MODE_FRAME;
+ pShell = new SwFrameShell( *this );
+ rDispatcher.Push( *pShell );
+ if(nSelectionType & nsSelectionType::SEL_GRF )
+ {
+ eShellMode = SHELL_MODE_GRAPHIC;
+ pShell = new SwGrfShell( *this );
+ rDispatcher.Push( *pShell );
+ }
+ }
+ else if ( nSelectionType & nsSelectionType::SEL_DRW )
+ {
+ eShellMode = SHELL_MODE_DRAW;
+ pShell = new SwDrawShell( *this );
+ rDispatcher.Push( *pShell );
+
+ if ( nSelectionType & nsSelectionType::SEL_BEZ )
+ {
+ eShellMode = SHELL_MODE_BEZIER;
+ pShell = new SwBezierShell( *this );
+ rDispatcher.Push( *pShell );
+ }
+ else if( nSelectionType & nsSelectionType::SEL_MEDIA )
+ {
+ eShellMode = SHELL_MODE_MEDIA;
+ pShell = new SwMediaShell( *this );
+ rDispatcher.Push( *pShell );
+ }
+
+ if (nSelectionType & nsSelectionType::SEL_EXTRUDED_CUSTOMSHAPE)
+ {
+ eShellMode = SHELL_MODE_EXTRUDED_CUSTOMSHAPE;
+ pShell = new svx::ExtrusionBar(this);
+ rDispatcher.Push( *pShell );
+ }
+ if (nSelectionType & nsSelectionType::SEL_FONTWORK)
+ {
+ eShellMode = SHELL_MODE_FONTWORK;
+ pShell = new svx::FontworkBar(this);
+ rDispatcher.Push( *pShell );
+ }
+ }
+ else if ( nSelectionType & nsSelectionType::SEL_DRW_FORM )
+ {
+ eShellMode = SHELL_MODE_DRAW_FORM;
+ pShell = new SwDrawFormShell( *this );
+
+ rDispatcher.Push( *pShell );
+ }
+ else if ( nSelectionType & nsSelectionType::SEL_DRW_TXT )
+ {
+ bSetExtInpCntxt = sal_True;
+ eShellMode = SHELL_MODE_DRAWTEXT;
+ rDispatcher.Push( *(new SwBaseShell( *this )) );
+ pShell = new SwDrawTextShell( *this );
+ rDispatcher.Push( *pShell );
+ }
+ else if ( nSelectionType & nsSelectionType::SEL_POSTIT )
+ {
+ eShellMode = SHELL_MODE_POSTIT;
+ pShell = new SwAnnotationShell( *this );
+ rDispatcher.Push( *pShell );
+ }
+ else
+ {
+ bSetExtInpCntxt = sal_True;
+ eShellMode = SHELL_MODE_TEXT;
+ sal_uInt32 nHelpId = 0;
+ if ( nSelectionType & nsSelectionType::SEL_NUM )
+ {
+ eShellMode = SHELL_MODE_LIST_TEXT;
+ pShell = new SwListShell( *this );
+ nHelpId = pShell->GetHelpId();
+ rDispatcher.Push( *pShell );
+ }
+ pShell = new SwTextShell(*this);
+ if(nHelpId)
+ pShell->SetHelpId(nHelpId);
+ rDispatcher.Push( *pShell );
+ if ( nSelectionType & nsSelectionType::SEL_TBL )
+ {
+ eShellMode = eShellMode == SHELL_MODE_LIST_TEXT ? SHELL_MODE_TABLE_LIST_TEXT
+ : SHELL_MODE_TABLE_TEXT;
+ pShell = new SwTableShell( *this );
+ rDispatcher.Push( *pShell );
+ }
+ }
+
+ if ( nSelectionType & nsSelectionType::SEL_FOC_FRM_CTRL )
+ rDispatcher.Push( *pFormShell );
+
+ pViewImpl->SetShellMode(eShellMode);
+ ImpSetVerb( nSelectionType );
+
+ if( !GetDocShell()->IsReadOnly() )
+ {
+ if( bSetExtInpCntxt && GetWrtShell().HasReadonlySel() )
+ bSetExtInpCntxt = sal_False;
+
+ InputContext aCntxt( GetEditWin().GetInputContext() );
+ aCntxt.SetOptions( bSetExtInpCntxt
+ ? (aCntxt.GetOptions() |
+ ( INPUTCONTEXT_TEXT |
+ INPUTCONTEXT_EXTTEXTINPUT ))
+ : (aCntxt.GetOptions() & ~
+ ( INPUTCONTEXT_TEXT |
+ INPUTCONTEXT_EXTTEXTINPUT )) );
+ GetEditWin().SetInputContext( aCntxt );
+ }
+
+ //Zur neuen Selektion die Toolbar aktivieren, die auch beim letzten Mal
+ //aktiviert war
+ //Vorher muss ein Flush() sein, betrifft aber lt. MBA nicht das UI und ist
+ //kein Performance-Problem
+ // TODO/LATER: maybe now the Flush() command is superfluous?!
+ rDispatcher.Flush();
+
+ Point aPnt = GetEditWin().OutputToScreenPixel(GetEditWin().GetPointerPosPixel());
+ aPnt = GetEditWin().PixelToLogic(aPnt);
+ GetEditWin().UpdatePointer(aPnt);
+
+ SdrView* pDView = GetWrtShell().GetDrawView();
+ if ( bInitFormShell && pDView )
+ pFormShell->SetView(PTR_CAST(FmFormView, pDView));
+
+ }
+ //Guenstiger Zeitpunkt fuer die Kommunikation mit OLE-Objekten?
+ if ( GetDocShell()->GetDoc()->IsOLEPrtNotifyPending() )
+ GetDocShell()->GetDoc()->PrtOLENotify( sal_False );
+
+ //jetzt das Tabellen-Update
+ if(bUpdateTable)
+ pWrtShell->UpdateTable();
+
+ GetViewImpl()->GetUNOObject_Impl()->NotifySelChanged();
+}
+
+//Zusammenspiel: AttrChangedNotify() und TimeoutHdl.
+//Falls noch Actions offen sind keine Aktualisierung, da der
+//Cursor auf der Core-Seite im Wald stehen kann.
+//Da wir aber keine Stati mehr liefern koennen und wollen locken wir
+//stattdessen den Dispatcher.
+
+
+
+extern "C"
+{
+ int lcl_CmpIds( const void *pFirst, const void *pSecond)
+ {
+ return (*(sal_uInt16*)pFirst) - (*(sal_uInt16*)pSecond);
+ }
+}
+
+
+
+IMPL_LINK( SwView, AttrChangedNotify, SwWrtShell *, EMPTYARG )
+{
+ if ( GetEditWin().IsChainMode() )
+ GetEditWin().SetChainMode( sal_False );
+
+ //Opt: Nicht wenn PaintLocked. Beim Unlock wird dafuer nocheinmal ein
+ //Notify ausgeloest.
+ if( !pWrtShell->IsPaintLocked() && !bNoInterrupt &&
+ GetDocShell()->IsReadOnly() )
+ _CheckReadonlyState();
+
+ // JP 19.01.99: Cursor in Readonly Bereichen
+ if( !pWrtShell->IsPaintLocked() && !bNoInterrupt )
+ _CheckReadonlySelection();
+
+ if( !bAttrChgNotified )
+ {
+ if ( pWrtShell->BasicActionPend() || bNoInterrupt ||
+ GetDispatcher().IsLocked() || //do not confuse the SFX
+ GetViewFrame()->GetBindings().IsInUpdate() )//do not confuse the SFX
+ {
+ bAttrChgNotified = sal_True;
+ aTimer.Start();
+
+ const SfxPoolItem *pItem;
+ if ( SFX_ITEM_SET != GetObjectShell()->GetMedium()->GetItemSet()->
+ GetItemState( SID_HIDDEN, sal_False, &pItem ) ||
+ !((SfxBoolItem*)pItem)->GetValue() )
+ {
+ GetViewFrame()->GetBindings().ENTERREGISTRATIONS();
+ bAttrChgNotifiedWithRegistrations = sal_True;
+ }
+
+ }
+ else
+ SelectShell();
+
+ }
+
+ //#i6193#, change ui if cursor is at a SwPostItField
+ if (mpPostItMgr)
+ {
+ // --> OD 2008-06-19 #i90516#
+ // only perform the code that is needed to determine, if at the
+ // actual cursor position is a post-it field
+// SwRect aFldRect;
+// SwContentAtPos aCntntAtPos( SwContentAtPos::SW_FIELD);
+// if( pWrtShell->GetContentAtPos( pWrtShell->GetCrsrDocPos(), aCntntAtPos, FALSE, &aFldRect ) )
+// {
+// const SwField* pFld = aCntntAtPos.aFnd.pFld;
+// if (pFld->Which()== RES_POSTITFLD)
+// {
+// mpPostItMgr->SetShadowState(reinterpret_cast<const SwPostItField*>(pFld));
+// }
+// else
+// mpPostItMgr->SetShadowState(0);
+// }
+// else
+// mpPostItMgr->SetShadowState(0);
+ mpPostItMgr->SetShadowState( pWrtShell->GetPostItFieldAtCursor() );
+ }
+
+ return 0;
+}
+
+
+
+IMPL_LINK( SwView, TimeoutHdl, Timer *, EMPTYARG )
+{
+ DBG_PROFSTART(viewhdl);
+
+ if( pWrtShell->BasicActionPend() || bNoInterrupt )
+ {
+ aTimer.Start();
+ DBG_PROFSTOP(viewhdl);
+ return 0;
+ }
+
+ if ( bAttrChgNotifiedWithRegistrations )
+ {
+ GetViewFrame()->GetBindings().LEAVEREGISTRATIONS();
+ bAttrChgNotifiedWithRegistrations = sal_False;
+ }
+
+ _CheckReadonlyState();
+ _CheckReadonlySelection();
+
+ BOOL bOldUndo = pWrtShell->DoesUndo();
+ pWrtShell->DoUndo( FALSE );
+ SelectShell();
+ pWrtShell->DoUndo( bOldUndo );
+ bAttrChgNotified = sal_False;
+ GetViewImpl()->GetUNOObject_Impl()->NotifySelChanged();
+
+ DBG_PROFSTOP(viewhdl);
+ return 0;
+}
+
+void SwView::_CheckReadonlyState()
+{
+ SfxDispatcher &rDis = GetDispatcher();
+ //Um erkennen zu koennen ob bereits disabled ist!
+ SfxItemState eStateRO, eStateProtAll;
+ const SfxPoolItem *pItem;
+ // JP 29.04.97: von einem nur uns bekannten Slot den Status abfragen.
+ // Ansonsten kennen andere den Slot; wie z.B. die BasidIde
+ eStateRO = rDis.QueryState( FN_INSERT_BOOKMARK, pItem );
+ eStateProtAll = rDis.QueryState( FN_EDIT_REGION, pItem );
+ sal_Bool bChgd = sal_False;
+
+ if ( !pWrtShell->IsCrsrReadonly() )
+ {
+ static sal_uInt16 aROIds[] =
+ {
+ SID_DELETE, FN_BACKSPACE, FN_SHIFT_BACKSPACE,
+ SID_UNDO,
+ SID_REDO, SID_REPEAT, SID_PASTE,
+ SID_PASTE_UNFORMATTED,
+ SID_PASTE_SPECIAL, SID_SBA_BRW_INSERT,
+ SID_BACKGROUND_COLOR, FN_INSERT_BOOKMARK,
+ SID_CHARMAP, FN_INSERT_SOFT_HYPHEN,
+ FN_INSERT_HARDHYPHEN, FN_INSERT_HARD_SPACE, FN_INSERT_BREAK,
+ FN_INSERT_LINEBREAK, FN_INSERT_COLUMN_BREAK, FN_INSERT_BREAK_DLG,
+ FN_DELETE_SENT, FN_DELETE_BACK_SENT, FN_DELETE_WORD,
+ FN_DELETE_BACK_WORD, FN_DELETE_LINE, FN_DELETE_BACK_LINE,
+ FN_DELETE_PARA, FN_DELETE_BACK_PARA, FN_DELETE_WHOLE_LINE,
+ FN_CALCULATE, FN_FORMAT_RESET,
+ FN_POSTIT, FN_JAVAEDIT, SID_ATTR_PARA_ADJUST_LEFT,
+ SID_ATTR_PARA_ADJUST_RIGHT, SID_ATTR_PARA_ADJUST_CENTER,SID_ATTR_PARA_ADJUST_BLOCK,
+ SID_ATTR_PARA_LINESPACE_10, SID_ATTR_PARA_LINESPACE_15, SID_ATTR_PARA_LINESPACE_20,
+ SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_FONTHEIGHT, SID_ATTR_CHAR_COLOR_BACKGROUND,
+ SID_ATTR_CHAR_COLOR_BACKGROUND_EXT, SID_ATTR_CHAR_COLOR_EXT,
+ SID_ATTR_CHAR_COLOR, SID_ATTR_CHAR_WEIGHT, SID_ATTR_CHAR_POSTURE,
+ SID_ATTR_CHAR_OVERLINE,
+ SID_ATTR_CHAR_UNDERLINE, SID_ATTR_FLASH, SID_ATTR_CHAR_STRIKEOUT,
+ FN_UNDERLINE_DOUBLE, SID_ATTR_CHAR_CONTOUR, SID_ATTR_CHAR_SHADOWED,
+ SID_ATTR_CHAR_AUTOKERN, SID_ATTR_CHAR_ESCAPEMENT, FN_SET_SUPER_SCRIPT,
+ FN_SET_SUB_SCRIPT, SID_ATTR_CHAR_CASEMAP, SID_ATTR_CHAR_LANGUAGE,
+ SID_ATTR_CHAR_KERNING, SID_CHAR_DLG, SID_ATTR_CHAR_WORDLINEMODE,
+ FN_GROW_FONT_SIZE, FN_SHRINK_FONT_SIZE, FN_TXTATR_INET,
+ FN_FORMAT_DROPCAPS, SID_ATTR_PARA_ADJUST, SID_ATTR_PARA_LINESPACE,
+ SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_KEEP, SID_ATTR_PARA_WIDOWS,
+ SID_ATTR_PARA_ORPHANS,
+ SID_ATTR_PARA_MODEL, SID_PARA_DLG,
+ FN_SELECT_PARA, SID_DEC_INDENT,
+ SID_INC_INDENT
+ };
+ static sal_Bool bFirst = sal_True;
+ if ( bFirst )
+ {
+ qsort( (void*)aROIds, sizeof(aROIds)/sizeof(sal_uInt16), sizeof(sal_uInt16), lcl_CmpIds );
+ bFirst = sal_False;
+ }
+ if ( SFX_ITEM_DISABLED == eStateRO )
+ {
+ rDis.SetSlotFilter( sal_Bool(2), sizeof(aROIds)/sizeof(sal_uInt16), aROIds );
+ bChgd = sal_True;
+ }
+ }
+ else if( pWrtShell->IsAllProtect() )
+ {
+ if ( SFX_ITEM_DISABLED == eStateProtAll )
+ {
+ static sal_uInt16 aAllProtIds[] = { SID_SAVEDOC, FN_EDIT_REGION };
+ static sal_Bool bAllProtFirst = sal_True;
+ if ( bAllProtFirst )
+ {
+ qsort( (void*)aAllProtIds, sizeof(aAllProtIds)/sizeof(sal_uInt16), sizeof(sal_uInt16), lcl_CmpIds );
+ bAllProtFirst = sal_False;
+ }
+ rDis.SetSlotFilter( sal_Bool(2),
+ sizeof(aAllProtIds)/sizeof(sal_uInt16),
+ aAllProtIds );
+ bChgd = sal_True;
+ }
+ }
+ else if ( SFX_ITEM_DISABLED != eStateRO ||
+ SFX_ITEM_DISABLED != eStateProtAll )
+ {
+ bChgd = sal_True;
+ rDis.SetSlotFilter();
+ }
+ if ( bChgd )
+ GetViewFrame()->GetBindings().InvalidateAll(sal_True);
+}
+
+void SwView::_CheckReadonlySelection()
+{
+ sal_uInt32 nDisableFlags = 0;
+ SfxDispatcher &rDis = GetDispatcher();
+
+ if( pWrtShell->HasReadonlySel() &&
+ ( !pWrtShell->GetDrawView() ||
+ !pWrtShell->GetDrawView()->GetMarkedObjectList().GetMarkCount() ))
+ nDisableFlags |= SW_DISABLE_ON_PROTECTED_CURSOR;
+
+ if( (SW_DISABLE_ON_PROTECTED_CURSOR & nDisableFlags ) !=
+ (SW_DISABLE_ON_PROTECTED_CURSOR & rDis.GetDisableFlags() ) )
+ {
+ // zusaetzlich am Window den InputContext umsetzen, damit in
+ // japanischen / chinesischen Versionen die externe Eingabe
+ // ab-/angeschaltet wird. Das aber nur wenn auch die richtige
+ // Shell auf dem Stack steht.
+ switch( pViewImpl->GetShellMode() )
+ {
+ case SHELL_MODE_TEXT:
+ case SHELL_MODE_LIST_TEXT:
+ case SHELL_MODE_TABLE_TEXT:
+ case SHELL_MODE_TABLE_LIST_TEXT:
+ {
+//JP 22.01.99: temporaere Loesung!!! Sollte bei jeder Cursorbewegung
+// den Font von der akt. Einfuegeposition setzen, also ausserhalb
+// dieses if's. Aber TH wertet den Font zur Zeit nicht aus und
+// das besorgen erscheint mir hier zu teuer zu sein.
+// Ausserdem haben wir keinen Font, sondern nur Attribute aus denen
+// die Textformatierung dann den richtigen Font zusammen baut.
+
+ InputContext aCntxt( GetEditWin().GetInputContext() );
+ aCntxt.SetOptions( SW_DISABLE_ON_PROTECTED_CURSOR & nDisableFlags
+ ? (aCntxt.GetOptions() & ~
+ ( INPUTCONTEXT_TEXT |
+ INPUTCONTEXT_EXTTEXTINPUT ))
+ : (aCntxt.GetOptions() |
+ ( INPUTCONTEXT_TEXT |
+ INPUTCONTEXT_EXTTEXTINPUT )) );
+ GetEditWin().SetInputContext( aCntxt );
+ }
+ break;
+ default:
+ ;
+ }
+
+ }
+
+ if( nDisableFlags != rDis.GetDisableFlags() )
+ {
+ rDis.SetDisableFlags( nDisableFlags );
+ GetViewFrame()->GetBindings().InvalidateAll( sal_True );
+ }
+}
+
+
+SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
+ : SfxViewShell( _pFrame, SWVIEWFLAGS ),
+
+ aPageStr( SW_RES( STR_PAGE )),
+ nNewPage(USHRT_MAX),
+ pNumRuleNodeFromDoc(0), // #i23726#
+ pEditWin( new SwEditWin( &_pFrame->GetWindow(), *this ) ),
+ pWrtShell(0),
+ pShell(0),
+ pFormShell(0),
+ pHScrollbar(0),
+ pVScrollbar(0),
+ pScrollFill(new ScrollBarBox( &_pFrame->GetWindow(), _pFrame->GetFrame().GetParentFrame() ? 0 : WB_SIZEABLE )),
+ pHRuler( new SvxRuler(&GetViewFrame()->GetWindow(), pEditWin,
+ SVXRULER_SUPPORT_TABS |
+ SVXRULER_SUPPORT_PARAGRAPH_MARGINS |
+ SVXRULER_SUPPORT_BORDERS |
+ SVXRULER_SUPPORT_NEGATIVE_MARGINS|
+ SVXRULER_SUPPORT_REDUCED_METRIC,
+ GetViewFrame()->GetBindings(),
+ WB_STDRULER | WB_EXTRAFIELD | WB_BORDER)),
+ pVRuler(new SvxRuler(&GetViewFrame()->GetWindow(), pEditWin,
+ SVXRULER_SUPPORT_TABS | SVXRULER_SUPPORT_PARAGRAPH_MARGINS_VERTICAL|
+ SVXRULER_SUPPORT_BORDERS | SVXRULER_SUPPORT_REDUCED_METRIC,
+ GetViewFrame()->GetBindings(),
+ WB_VSCROLL | WB_EXTRAFIELD | WB_BORDER )),
+ pTogglePageBtn(0),
+ pPageUpBtn(0),
+ pPageDownBtn(0),
+ pNaviBtn(0),
+ pGlosHdl(0),
+ pDrawActual(0),
+ pLastTableFormat(0),
+ pFormatClipboard(new SwFormatClipboard()),
+ mpPostItMgr(0),
+ nSelectionType( INT_MAX ),
+ nPageCnt(0),
+ nDrawSfxId( USHRT_MAX ),
+ nFormSfxId( USHRT_MAX ),
+ nLastPasteDestination( 0xFFFF ),
+ nLeftBorderDistance( 0 ),
+ nRightBorderDistance( 0 ),
+ bInMailMerge(FALSE),
+ bInDtor(FALSE),
+ bOldShellWasPagePreView(FALSE)
+{
+ // OD 18.12.2002 #103492# - According to discussion with MBA and further
+ // investigations, no old SfxViewShell will be set as parameter <pOldSh>,
+ // if function "New Window" is performed to open an additional view beside
+ // an already existing one.
+ // If the view is switch from one to another, the 'old' view is given by
+ // parameter <pOldSh>.
+
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwView::SwView" );
+
+ bCenterCrsr = bTopCrsr = bAllwaysShowSel = bTabColFromDoc = bTabRowFromDoc =
+ bSetTabColFromDoc = bSetTabRowFromDoc = bAttrChgNotified = bAttrChgNotifiedWithRegistrations =
+ bVerbsActive = bDrawRotate = bInOuterResizePixel = bInInnerResizePixel =
+ bPasteState = bPasteSpecialState = bMakeSelectionVisible = sal_False;
+
+ bShowAtResize = bDrawSelMode = bDocSzUpdated = sal_True;
+
+ _CreateScrollbar( TRUE );
+ _CreateScrollbar( FALSE );
+
+ pViewImpl = new SwView_Impl(this);
+ SetName(C2S("View"));
+ SetWindow( pEditWin );
+
+ aTimer.SetTimeout( 120 );
+
+ SwDocShell* pDocSh = PTR_CAST( SwDocShell, _pFrame->GetObjectShell() );
+ BOOL bOldModifyFlag = pDocSh->IsEnableSetModified();
+ if(bOldModifyFlag)
+ pDocSh->EnableSetModified( sal_False );
+ ASSERT( pDocSh, "View ohne DocShell." );
+ SwWebDocShell* pWebDShell = PTR_CAST( SwWebDocShell, pDocSh );
+
+ const SwMasterUsrPref *pUsrPref = SW_MOD()->GetUsrPref(0 != pWebDShell);
+ SwViewOption aUsrPref( *pUsrPref);
+
+ //! get lingu options without loading lingu DLL
+ SvtLinguOptions aLinguOpt;
+
+ SvtLinguConfig().GetOptions( aLinguOpt );
+
+ aUsrPref.SetOnlineSpell( aLinguOpt.bIsSpellAuto );
+
+ sal_Bool bOldShellWasSrcView = FALSE;
+
+ // OD 18.12.2002 #103492# - determine, if there is an existing view for
+ // document
+ SfxViewShell* pExistingSh = 0;
+ if ( pOldSh )
+ pExistingSh = pOldSh;
+ else
+ {
+ SfxViewFrame *pF = SfxViewFrame::GetFirst( pDocSh );
+ if( pF == _pFrame )
+ pF = SfxViewFrame::GetNext( *pF, pDocSh );
+ if( pF )
+ pExistingSh = pF->GetViewShell();
+ }
+
+ // determine type of existing view
+ if( pExistingSh &&
+ pExistingSh->IsA( TYPE( SwPagePreView ) ) )
+ {
+ sSwViewData = ((SwPagePreView*)pExistingSh)->GetPrevSwViewData();
+ sNewCrsrPos = ((SwPagePreView*)pExistingSh)->GetNewCrsrPos();
+ nNewPage = ((SwPagePreView*)pExistingSh)->GetNewPage();
+ bOldShellWasPagePreView = TRUE;
+ }
+ else if( pExistingSh &&
+ pExistingSh->IsA( TYPE( SwSrcView ) ) )
+ bOldShellWasSrcView = TRUE;
+
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "before create WrtShell" );
+ if(PTR_CAST( SwView, pExistingSh))
+ {
+ pWrtShell = new SwWrtShell( *((SwView*)pExistingSh)->pWrtShell,
+ pEditWin, *this);
+//MA: Das kann doch nur zu einem GPF fuehren!
+// nSelectionType = ((SwView*)pOldSh)->nSelectionType;
+ }
+ else
+ {
+ SwDoc& rDoc = *((SwDocShell*)pDocSh)->GetDoc();
+
+ if( !bOldShellWasSrcView && pWebDShell && !bOldShellWasPagePreView )
+ rDoc.set(IDocumentSettingAccess::BROWSE_MODE, true);
+
+ //Fuer den BrowseMode wollen wir keinen Factor uebernehmen.
+ if( rDoc.get(IDocumentSettingAccess::BROWSE_MODE) && aUsrPref.GetZoomType() != SVX_ZOOM_PERCENT )
+ {
+ aUsrPref.SetZoomType( SVX_ZOOM_PERCENT );
+ aUsrPref.SetZoom( 100 );
+ }
+ if(pDocSh->IsPreview())
+ {
+ aUsrPref.SetZoomType( SVX_ZOOM_WHOLEPAGE );
+ aUsrPref.SetViewLayoutBookMode( false );
+ aUsrPref.SetViewLayoutColumns( 1 );
+ }
+ pWrtShell = new SwWrtShell( rDoc, pEditWin, *this, &aUsrPref );
+ //#97610# creating an SwView from a SwPagePreView needs to
+ // add the ViewShell to the ring of the other ViewShell(s)
+ if(bOldShellWasPagePreView)
+ {
+ ViewShell& rPreviewViewShell = *((SwPagePreView*)pExistingSh)->GetViewShell();
+ pWrtShell->MoveTo(&rPreviewViewShell);
+ //#95521# to update the field command et.al. if necessary
+ const SwViewOption* pPreViewOpt = rPreviewViewShell.GetViewOptions();
+ if( pPreViewOpt->IsFldName() != aUsrPref.IsFldName() ||
+ pPreViewOpt->IsShowHiddenField() != aUsrPref.IsShowHiddenField() ||
+ pPreViewOpt->IsShowHiddenPara() != aUsrPref.IsShowHiddenPara() ||
+ pPreViewOpt->IsShowHiddenChar() != aUsrPref.IsShowHiddenChar() )
+ rPreviewViewShell.ApplyViewOptions(aUsrPref);
+ // OD 09.01.2003 #106334# - reset design mode at draw view for form
+ // shell, if needed.
+ if ( ((SwPagePreView*)pExistingSh)->ResetFormDesignMode() &&
+ pWrtShell->HasDrawView() )
+ {
+ SdrView* pDrawView = pWrtShell->GetDrawView();
+ pDrawView->SetDesignMode( ((SwPagePreView*)pExistingSh)->FormDesignModeToReset() );
+ }
+ }
+ }
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "after create WrtShell" );
+
+ // --> OD 2005-02-11 #i38810# - assure that modified state of document
+ // isn't reset, if document is already modified.
+ const bool bIsDocModified = pWrtShell->GetDoc()->IsModified();
+ // <--
+
+ // JP 05.02.99: Bug 61495 - damit unter anderem das HLineal im
+ // ReadonlyFall nicht angezeigt wird
+ aUsrPref.SetReadonly( pWrtShell->GetViewOptions()->IsReadonly() );
+
+ //Kein Margin fuer OLE!
+ Size aBrwsBorder;
+ if( SFX_CREATE_MODE_EMBEDDED != pDocSh->GetCreateMode() )
+ aBrwsBorder = GetMargin();
+
+ pWrtShell->SetBrowseBorder( aBrwsBorder );
+
+ // Im CTOR duerfen keine Shell wechsel erfolgen, die muessen ueber
+ // den Timer "zwischen gespeichert" werden. Sonst raeumt der SFX
+ // sie wieder vom Stack!
+ sal_Bool bOld = bNoInterrupt;
+ bNoInterrupt = sal_True;
+
+ pHRuler->SetActive( sal_True );
+ pVRuler->SetActive( sal_True );
+
+ SfxViewFrame* pViewFrame = GetViewFrame();
+ if( pViewFrame->GetFrame().GetParentFrame())
+ {
+ aUsrPref.SetViewHRuler(sal_False);
+ aUsrPref.SetViewVRuler(sal_False);
+ }
+
+ StartListening( *pViewFrame, TRUE );
+ StartListening( *pDocSh, TRUE );
+
+ // Vom HLineal den ZOOM-Faktor einstellen
+ Fraction aZoomFract( aUsrPref.GetZoom(), 100 );
+ pHRuler->SetZoom( aZoomFract );
+ pVRuler->SetZoom( aZoomFract );
+ pHRuler->SetDoubleClickHdl(LINK( this, SwView, ExecRulerClick ));
+ FieldUnit eMetric = pUsrPref->GetHScrollMetric();
+ pHRuler->SetUnit( eMetric );
+ eMetric = pUsrPref->GetVScrollMetric();
+ pVRuler->SetUnit( eMetric );
+
+ // DocShell setzen
+ pDocSh->SetView( this );
+ SW_MOD()->SetView( this );
+
+ mpPostItMgr = new SwPostItMgr(this);
+
+ // Die DocSize erfragen und verarbeiten. Ueber die Handler konnte
+ // die Shell nicht gefunden werden, weil die Shell innerhalb CTOR-Phase
+ // nicht in der SFX-Verwaltung bekannt ist.
+ DocSzChgd( pWrtShell->GetDocSize() );
+
+ // AttrChangedNotify Link setzen
+ pWrtShell->SetChgLnk(LINK(this, SwView, AttrChangedNotify));
+
+ if( pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED &&
+ //TODO/LATER: why a cast here?
+ //!((SvEmbeddedObject *)pDocSh)->GetVisArea().IsEmpty() )
+ //SetVisArea( ((SvEmbeddedObject *)pDocSh)->GetVisArea(),sal_False);
+ !pDocSh->GetVisArea(ASPECT_CONTENT).IsEmpty() )
+ SetVisArea( pDocSh->GetVisArea(ASPECT_CONTENT),sal_False);
+
+ pWrtShell->DoUndo( 0 != SW_MOD()->GetUndoOptions().GetUndoCount() );
+
+ const BOOL bBrowse = pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE);
+ SetNewWindowAllowed(!bBrowse);
+
+ ShowVScrollbar(aUsrPref.IsViewVScrollBar());
+ ShowHScrollbar(aUsrPref.IsViewHScrollBar());
+ pHScrollbar->SetAuto(bBrowse);
+ if( aUsrPref.IsViewHRuler() )
+ CreateTab();
+ if( aUsrPref.IsViewVRuler() )
+ CreateVLineal();
+
+ pWrtShell->SetUIOptions( aUsrPref );
+ pWrtShell->SetReadOnlyAvailable( aUsrPref.IsCursorInProtectedArea() );
+ pWrtShell->ApplyAccessiblityOptions(SW_MOD()->GetAccessibilityOptions());
+
+ if( pWrtShell->GetDoc()->IsUpdateExpFld() )
+ {
+ SET_CURR_SHELL( pWrtShell );
+ pWrtShell->StartAction();
+ pWrtShell->CalcLayout();
+ pWrtShell->GetDoc()->UpdateFlds(NULL, false);
+ pWrtShell->EndAction();
+ pWrtShell->GetDoc()->SetUpdateExpFldStat( sal_False );
+ }
+
+ // ggfs. alle Verzeichnisse updaten:
+ if( pWrtShell->GetDoc()->IsUpdateTOX() )
+ {
+ SfxRequest aSfxRequest( FN_UPDATE_TOX, SFX_CALLMODE_SLOT, GetPool() );
+ Execute( aSfxRequest );
+ pWrtShell->GetDoc()->SetUpdateTOX( sal_False ); // wieder zurueck setzen
+ pWrtShell->SttEndDoc(TRUE);
+ }
+
+ // kein ResetModified, wenn es schone eine View auf dieses Doc gibt
+ SfxViewFrame* pVFrame = GetViewFrame();
+ SfxViewFrame* pFirst = SfxViewFrame::GetFirst(pDocSh);
+ // zur Zeit(360) wird die View erst nach dem Ctor eingetragen
+ // der folgende Ausdruck funktioniert auch, wenn sich das aendert
+ //JP 27.07.98: wenn per Undo nicht mehr die Modifizierung aufhebar ist,
+ // so setze das Modified NICHT zurueck.
+ // --> OD 2005-02-11 #i38810# - no reset of modified state, if document
+ // was already modified.
+ if (!pWrtShell->GetDoc()->GetIDocumentUndoRedo().IsUndoNoResetModified() &&
+ ( !pFirst || pFirst == pVFrame ) &&
+ !bIsDocModified )
+ // <--
+ {
+ pWrtShell->ResetModified();
+ }
+
+ bNoInterrupt = bOld;
+
+ // wird ein GlobalDoc neu angelegt, soll auch der Navigator erzeugt werden
+ if( pDocSh->IsA(SwGlobalDocShell::StaticType()) &&
+ !pVFrame->GetChildWindow( SID_NAVIGATOR ))
+ {
+ SfxBoolItem aNavi(SID_NAVIGATOR, sal_True);
+ GetDispatcher().Execute(SID_NAVIGATOR, SFX_CALLMODE_ASYNCHRON, &aNavi, 0L);
+ }
+
+
+ /*uno::Reference< awt::XWindow > aTmpRef;
+ _pFrame->GetFrame().GetFrameInterface()->setComponent( aTmpRef,
+ pViewImpl->GetUNOObject_Impl());*/
+
+ uno::Reference< frame::XFrame > xFrame = pVFrame->GetFrame().GetFrameInterface();
+
+ uno::Reference< frame::XFrame > xBeamerFrame = xFrame->findFrame(
+ OUString::createFromAscii("_beamer"), frame::FrameSearchFlag::CHILDREN);
+ if(xBeamerFrame.is())
+ {
+ SwDBData aData = pWrtShell->GetDBData();
+ SW_MOD()->ShowDBObj( *this, aData );
+ }
+
+ // has anybody calls the attrchanged handler in the constructor?
+ if( bAttrChgNotifiedWithRegistrations )
+ {
+ GetViewFrame()->GetBindings().LEAVEREGISTRATIONS();
+ if( aTimer.IsActive() )
+ aTimer.Stop();
+ }
+
+ aTimer.SetTimeoutHdl(LINK(this, SwView, TimeoutHdl));
+ bAttrChgNotified = bAttrChgNotifiedWithRegistrations = sal_False;
+ if(bOldModifyFlag)
+ pDocSh->EnableSetModified( sal_True );
+ InvalidateBorder();
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwView::~SwView()
+{
+ delete mpPostItMgr;
+ // --> OD 2009-03-10 #i100035#
+ mpPostItMgr = 0;
+ // <--
+
+ bInDtor = TRUE;
+ pEditWin->Hide(); // damit kein Paint Aerger machen kann!
+ // An der SwDocShell den Pointer auf die View ruecksetzen
+ SwDocShell* pDocSh = GetDocShell();
+ if( pDocSh && pDocSh->GetView() == this )
+ pDocSh->SetView( 0 );
+ if ( SW_MOD()->GetView() == this )
+ SW_MOD()->SetView( 0 );
+
+ if( aTimer.IsActive() && bAttrChgNotifiedWithRegistrations )
+ GetViewFrame()->GetBindings().LEAVEREGISTRATIONS();
+
+ //JP 27.11.00: Bug 80631 - the last view must end the text edit
+ SdrView *pSdrView = pWrtShell ? pWrtShell->GetDrawView() : 0;
+ if( pSdrView && pSdrView->IsTextEdit() )
+ pSdrView->SdrEndTextEdit( sal_True );
+
+ SetWindow( 0 );
+
+ pViewImpl->Invalidate();
+ EndListening(*GetViewFrame());
+ EndListening(*GetDocShell());
+ delete pScrollFill;
+ delete pWrtShell;
+ pWrtShell = 0; // Auf 0 setzen, damit folgende DToren nicht drauf zugreifen
+ pShell = 0;
+ delete pHScrollbar;
+ delete pVScrollbar;
+ delete pHRuler;
+ delete pVRuler;
+ delete pTogglePageBtn;
+ delete pPageUpBtn;
+ delete pNaviBtn;
+ delete pPageDownBtn;
+ delete pGlosHdl;
+ delete pViewImpl;
+ delete pEditWin;
+ delete pFormatClipboard;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: DocShell rausgrabbeln ueber das FrameWindow
+ --------------------------------------------------------------------*/
+
+
+SwDocShell* SwView::GetDocShell()
+{
+ SfxObjectShell* pDocShell = GetViewFrame()->GetObjectShell();
+ return PTR_CAST(SwDocShell, pDocShell);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: CursorPos merken
+ --------------------------------------------------------------------*/
+
+
+void SwView::WriteUserData( String &rUserData, sal_Bool bBrowse )
+{
+ //Das Browse-Flag wird vom Sfx durchgereicht, wenn Dokumente gebrowsed
+ //werden (nicht zu verwechseln mit dem BrowseMode).
+ //Die dann gespeicherten Daten sind nicht persistent!!
+
+ const SwRect& rRect = pWrtShell->GetCharRect();
+ const Rectangle& rVis = GetVisArea();
+
+ rUserData = String::CreateFromInt32( rRect.Left() );
+ rUserData += ';';
+ rUserData += String::CreateFromInt32( rRect.Top() );
+ rUserData += ';';
+ rUserData += String::CreateFromInt32( pWrtShell->GetViewOptions()->GetZoom() );
+ rUserData += ';';
+ rUserData += String::CreateFromInt32( rVis.Left() );
+ rUserData += ';';
+ rUserData += String::CreateFromInt32( rVis.Top() );
+ rUserData += ';';
+ rUserData += String::CreateFromInt32( bBrowse ? LONG_MIN : rVis.Right());
+ rUserData += ';';
+ rUserData += String::CreateFromInt32( bBrowse ? LONG_MIN : rVis.Bottom());
+ rUserData += ';';
+ rUserData += String::CreateFromInt32(
+ (sal_uInt16)pWrtShell->GetViewOptions()->GetZoomType());//eZoom;
+ rUserData += ';';
+ rUserData += FRMTYPE_NONE == pWrtShell->GetSelFrmType() ? '0' : '1';
+}
+/*--------------------------------------------------------------------
+ Beschreibung: CursorPos setzen
+ --------------------------------------------------------------------*/
+//#i43146# go to the last editing position when opening own files
+bool lcl_IsOwnDocument( SwView& rView )
+{
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ rView.GetDocShell()->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps
+ = xDPS->getDocumentProperties();
+ String Created = xDocProps->getAuthor();
+ String Changed = xDocProps->getModifiedBy();
+ String FullName = SW_MOD()->GetUserOptions().GetFullName();
+ return (FullName.Len() &&
+ (Changed.Len() && Changed == FullName )) ||
+ (!Changed.Len() && Created.Len() && Created == FullName );
+}
+
+
+void SwView::ReadUserData( const String &rUserData, sal_Bool bBrowse )
+{
+ if ( rUserData.GetTokenCount() > 1 &&
+ //Fuer Dokumente ohne Layout nur im OnlineLayout oder beim
+ //Forward/Backward
+ (!pWrtShell->IsNewLayout() || pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) || bBrowse) )
+ {
+ //#i43146# go to the last editing position when opening own files
+ bool bIsOwnDocument = lcl_IsOwnDocument( *this );
+
+ SET_CURR_SHELL(pWrtShell);
+
+ sal_uInt16 nPos = 0;
+
+ // Nein, es ist *keine* gute Idee GetToken gleich im Point-Konstr.
+ // aufzurufen, denn welcher Parameter wird zuerst ausgewertet?
+ long nX = rUserData.GetToken( 0, ';', nPos ).ToInt32(),
+ nY = rUserData.GetToken( 0, ';', nPos ).ToInt32();
+ Point aCrsrPos( nX, nY );
+
+ sal_uInt16 nZoomFactor =
+ static_cast< sal_uInt16 >( rUserData.GetToken(0, ';', nPos ).ToInt32() );
+
+ long nLeft = rUserData.GetToken(0, ';', nPos ).ToInt32(),
+ nTop = rUserData.GetToken(0, ';', nPos ).ToInt32(),
+ nRight = rUserData.GetToken(0, ';', nPos ).ToInt32(),
+ nBottom= rUserData.GetToken(0, ';', nPos ).ToInt32();
+
+ const long nAdd = pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ? DOCUMENTBORDER : DOCUMENTBORDER*2;
+ if ( nBottom <= (pWrtShell->GetDocSize().Height()+nAdd) )
+ {
+ pWrtShell->EnableSmooth( sal_False );
+
+ const Rectangle aVis( nLeft, nTop, nRight, nBottom );
+
+ sal_uInt16 nOff = 0;
+ SvxZoomType eZoom;
+ if( !pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) )
+ eZoom = (SvxZoomType) (sal_uInt16)rUserData.GetToken(nOff, ';', nPos ).ToInt32();
+ else
+ {
+ eZoom = SVX_ZOOM_PERCENT;
+ ++nOff;
+ }
+
+ sal_Bool bSelectObj = (0 != rUserData.GetToken( nOff, ';', nPos ).ToInt32())
+ && pWrtShell->IsObjSelectable( aCrsrPos );
+
+ //#i33307# restore editing position
+ pViewImpl->SetRestorePosition(aCrsrPos, bSelectObj);
+ // OD 11.02.2003 #100556# - set flag value to avoid macro execution.
+ bool bSavedFlagValue = pWrtShell->IsMacroExecAllowed();
+ pWrtShell->SetMacroExecAllowed( false );
+//!!! pb (11.08.2004): #i32536#
+// os: changed: The user data has to be read if the view is switched back from page preview
+//#i43146# go to the last editing position when opening own files
+ if(bOldShellWasPagePreView || bIsOwnDocument)
+ {
+ pWrtShell->SwCrsrShell::SetCrsr( aCrsrPos, !bSelectObj );
+ if( bSelectObj )
+ {
+ pWrtShell->SelectObj( aCrsrPos );
+ pWrtShell->EnterSelFrmMode( &aCrsrPos );
+ }
+ }
+
+ // OD 11.02.2003 #100556# - reset flag value
+ pWrtShell->SetMacroExecAllowed( bSavedFlagValue );
+
+ // OD 08.04.2003 #108693# - set visible area before applying
+ // information from print preview. Otherwise, the applied information
+ // is lost.
+//!!! pb (11.08.2004): #i32536#
+// os: changed: The user data has to be read if the view is switched back from page preview
+//#i43146# go to the last editing position when opening own files
+ if(bOldShellWasPagePreView || bIsOwnDocument )
+ {
+ if ( bBrowse )
+ SetVisArea( aVis.TopLeft() );
+ else
+ SetVisArea( aVis );
+ }
+
+ //apply information from print preview - if available
+ if( sNewCrsrPos.Len() )
+ {
+ long nXTmp = sNewCrsrPos.GetToken( 0, ';' ).ToInt32(),
+ nYTmp = sNewCrsrPos.GetToken( 1, ';' ).ToInt32();
+ Point aCrsrPos2( nXTmp, nYTmp );
+ bSelectObj = pWrtShell->IsObjSelectable( aCrsrPos2 );
+
+ pWrtShell->SwCrsrShell::SetCrsr( aCrsrPos2, FALSE );
+ if( bSelectObj )
+ {
+ pWrtShell->SelectObj( aCrsrPos2 );
+ pWrtShell->EnterSelFrmMode( &aCrsrPos2 );
+ }
+ pWrtShell->MakeSelVisible();
+ sNewCrsrPos.Erase();
+ }
+ else if(USHRT_MAX != nNewPage)
+ {
+ pWrtShell->GotoPage(nNewPage, TRUE);
+ nNewPage = USHRT_MAX;
+ }
+
+ SelectShell();
+
+ pWrtShell->StartAction();
+ const SwViewOption* pVOpt = pWrtShell->GetViewOptions();
+ if( pVOpt->GetZoom() != nZoomFactor || pVOpt->GetZoomType() != eZoom )
+ SetZoom( eZoom, nZoomFactor);
+
+ pWrtShell->LockView( sal_True );
+ pWrtShell->EndAction();
+ pWrtShell->LockView( sal_False );
+ pWrtShell->EnableSmooth( sal_True );
+ }
+ }
+}
+
+void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >& rSequence, sal_Bool bBrowse )
+{
+ if(GetDocShell()->IsPreview())
+ return;
+ //#i43146# go to the last editing position when opening own files
+ bool bIsOwnDocument = lcl_IsOwnDocument( *this );
+ sal_Int32 nLength = rSequence.getLength();
+ if (nLength && (!pWrtShell->IsNewLayout() || pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) || bBrowse) )
+ {
+ SET_CURR_SHELL(pWrtShell);
+ const beans::PropertyValue *pValue = rSequence.getConstArray();
+ const SwRect& rRect = pWrtShell->GetCharRect();
+ const Rectangle &rVis = GetVisArea();
+ const SwViewOption* pVOpt = pWrtShell->GetViewOptions();
+
+ long nX = rRect.Left(), nY = rRect.Top(), nLeft = rVis.Left(), nTop = rVis.Top();
+ long nRight = bBrowse ? LONG_MIN : rVis.Right(), nBottom = bBrowse ? LONG_MIN : rVis.Bottom();
+ sal_Int16 nZoomType = static_cast< sal_Int16 >(pVOpt->GetZoomType());
+ sal_Int16 nZoomFactor = static_cast < sal_Int16 > (pVOpt->GetZoom());
+ bool bViewLayoutBookMode = pVOpt->IsViewLayoutBookMode();
+ sal_Int16 nViewLayoutColumns = pVOpt->GetViewLayoutColumns();
+
+ sal_Bool bSelectedFrame = ( pWrtShell->GetSelFrmType() != FRMTYPE_NONE ),
+ bGotViewLeft = sal_False, bGotViewTop = sal_False, bGotVisibleLeft = sal_False,
+ bGotVisibleTop = sal_False, bGotVisibleRight = sal_False,
+ bGotVisibleBottom = sal_False, bGotZoomType = sal_False,
+ bGotZoomFactor = sal_False, bGotIsSelectedFrame = sal_False,
+ bGotViewLayoutColumns = sal_False, bGotViewLayoutBookMode = sal_False;
+
+ for (sal_Int16 i = 0 ; i < nLength; i++)
+ {
+ if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ViewLeft" ) ) )
+ {
+ pValue->Value >>= nX;
+ nX = MM100_TO_TWIP( nX );
+ bGotViewLeft = sal_True;
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ViewTop" ) ) )
+ {
+ pValue->Value >>= nY;
+ nY = MM100_TO_TWIP( nY );
+ bGotViewTop = sal_True;
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VisibleLeft" ) ) )
+ {
+ pValue->Value >>= nLeft;
+ nLeft = MM100_TO_TWIP( nLeft );
+ bGotVisibleLeft = sal_True;
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VisibleTop" ) ) )
+ {
+ pValue->Value >>= nTop;
+ nTop = MM100_TO_TWIP( nTop );
+ bGotVisibleTop = sal_True;
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VisibleRight" ) ) )
+ {
+ pValue->Value >>= nRight;
+ nRight = MM100_TO_TWIP( nRight );
+ bGotVisibleRight = sal_True;
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VisibleBottom" ) ) )
+ {
+ pValue->Value >>= nBottom;
+ nBottom = MM100_TO_TWIP( nBottom );
+ bGotVisibleBottom = sal_True;
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ZoomType" ) ) )
+ {
+ pValue->Value >>= nZoomType;
+ bGotZoomType = sal_True;
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ZoomFactor" ) ) )
+ {
+ pValue->Value >>= nZoomFactor;
+ bGotZoomFactor = sal_True;
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ViewLayoutColumns" ) ) )
+ {
+ pValue->Value >>= nViewLayoutColumns;
+ bGotViewLayoutColumns = sal_True;
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ViewLayoutBookMode" ) ) )
+ {
+ bViewLayoutBookMode = * (sal_Bool *) pValue->Value.getValue();
+ bGotViewLayoutBookMode = sal_True;
+ }
+ else if (pValue->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsSelectedFrame" ) ) )
+ {
+ pValue->Value >>= bSelectedFrame;
+ bGotIsSelectedFrame = sal_True;
+ }
+ pValue++;
+ }
+ if (bGotVisibleBottom)
+ {
+ Point aCrsrPos( nX, nY );
+ const long nAdd = pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ? DOCUMENTBORDER : DOCUMENTBORDER*2;
+ if (nBottom <= (pWrtShell->GetDocSize().Height()+nAdd) )
+ {
+ pWrtShell->EnableSmooth( sal_False );
+ const Rectangle aVis( nLeft, nTop, nRight, nBottom );
+
+ sal_uInt16 nOff = 0;
+ SvxZoomType eZoom;
+ if ( !pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) )
+ eZoom = static_cast < SvxZoomType > ( nZoomType );
+ else
+ {
+ eZoom = SVX_ZOOM_PERCENT;
+ ++nOff;
+ }
+ if (bGotIsSelectedFrame)
+ {
+ sal_Bool bSelectObj = (sal_False != bSelectedFrame )
+ && pWrtShell->IsObjSelectable( aCrsrPos );
+
+ // OD 11.02.2003 #100556# - set flag value to avoid macro execution.
+ bool bSavedFlagValue = pWrtShell->IsMacroExecAllowed();
+ pWrtShell->SetMacroExecAllowed( false );
+//!!! pb (11.08.2004): #i32536#
+// os: changed: The user data has to be read if the view is switched back from page preview
+//#i43146# go to the last editing position when opening own files
+ //#i33307# restore editing position
+ pViewImpl->SetRestorePosition(aCrsrPos, bSelectObj);
+ if(bOldShellWasPagePreView|| bIsOwnDocument)
+ {
+ pWrtShell->SwCrsrShell::SetCrsr( aCrsrPos, !bSelectObj );
+ if( bSelectObj )
+ {
+ pWrtShell->SelectObj( aCrsrPos );
+ pWrtShell->EnterSelFrmMode( &aCrsrPos );
+ }
+ }
+
+ // OD 11.02.2003 #100556# - reset flag value
+ pWrtShell->SetMacroExecAllowed( bSavedFlagValue );
+ }
+ SelectShell();
+
+ // Set ViewLayoutSettings
+ const bool bSetViewLayoutSettings = bGotViewLayoutColumns && bGotViewLayoutBookMode &&
+ ( pVOpt->GetViewLayoutColumns() != nViewLayoutColumns || pVOpt->IsViewLayoutBookMode() != bViewLayoutBookMode );
+
+ const bool bSetViewSettings = bGotZoomType && bGotZoomFactor &&
+ ( pVOpt->GetZoom() != nZoomFactor || pVOpt->GetZoomType() != eZoom );
+
+ // In case we have a 'fixed' view layout of 2 or more columns,
+ // we have to apply the view options *before* starting the action.
+ // Otherwsie the SetZoom function cannot work correctly, because
+ // the view layout hasn't been calculated.
+ const bool bZoomNeedsViewLayout = bSetViewLayoutSettings &&
+ 1 < nViewLayoutColumns &&
+ bSetViewSettings &&
+ eZoom != SVX_ZOOM_PERCENT;
+
+
+ if ( !bZoomNeedsViewLayout )
+ pWrtShell->StartAction();
+
+ if ( bSetViewLayoutSettings )
+ SetViewLayout( nViewLayoutColumns, bViewLayoutBookMode, sal_True );
+
+ if ( bZoomNeedsViewLayout )
+ pWrtShell->StartAction();
+
+ if ( bSetViewSettings )
+ SetZoom( eZoom, nZoomFactor, sal_True );
+
+//!!! pb (11.08.2004): #i32536#
+// os: changed: The user data has to be read if the view is switched back from page preview
+//#i43146# go to the last editing position when opening own files
+ if(bOldShellWasPagePreView||bIsOwnDocument)
+ {
+ if ( bBrowse && bGotVisibleLeft && bGotVisibleTop )
+ {
+ Point aTopLeft(aVis.TopLeft());
+ //#i76699# make sure the document is still centered
+ const SwTwips lBorder = IsDocumentBorder() ? DOCUMENTBORDER : 2 * DOCUMENTBORDER;
+ SwTwips nEditWidth = GetEditWin().GetOutputSize().Width();
+ if(nEditWidth > (aDocSz.Width() + lBorder ))
+ aTopLeft.X() = ( aDocSz.Width() + lBorder - nEditWidth ) / 2;
+ else
+ {
+ //check if the values are possible
+ long nXMax = pHScrollbar->GetRangeMax() - pHScrollbar->GetVisibleSize();
+ if( aTopLeft.X() > nXMax )
+ aTopLeft.X() = nXMax < 0 ? 0 : nXMax;
+ }
+ SetVisArea( aTopLeft );
+ }
+ else if (bGotVisibleLeft && bGotVisibleTop && bGotVisibleRight && bGotVisibleBottom )
+ SetVisArea( aVis );
+ }
+
+ pWrtShell->LockView( sal_True );
+ pWrtShell->EndAction();
+ pWrtShell->LockView( sal_False );
+ pWrtShell->EnableSmooth( sal_True );
+ }
+ }
+ }
+}
+#define NUM_VIEW_SETTINGS 12
+void SwView::WriteUserDataSequence ( uno::Sequence < beans::PropertyValue >& rSequence, sal_Bool bBrowse )
+{
+ const SwRect& rRect = pWrtShell->GetCharRect();
+ const Rectangle& rVis = GetVisArea();
+ Any aAny;
+
+ rSequence.realloc ( NUM_VIEW_SETTINGS );
+ sal_Int16 nIndex = 0;
+ beans::PropertyValue *pValue = rSequence.getArray();
+
+ sal_uInt16 nViewID( GetViewFrame()->GetCurViewId());
+ pValue->Name = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "ViewId" ) );
+ OUStringBuffer sBuffer ( OUString(RTL_CONSTASCII_USTRINGPARAM( "view" ) ) );
+ SvXMLUnitConverter::convertNumber(sBuffer, static_cast<sal_Int32>(nViewID));
+ pValue->Value <<= sBuffer.makeStringAndClear();
+ pValue++;nIndex++;
+
+ pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ViewLeft" ) );
+ pValue->Value <<= TWIP_TO_MM100 ( rRect.Left() );
+ pValue++;nIndex++;
+
+ pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ViewTop" ) );
+ pValue->Value <<= TWIP_TO_MM100 ( rRect.Top() );
+ pValue++;nIndex++;
+
+ pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "VisibleLeft" ) );
+ pValue->Value <<= TWIP_TO_MM100 ( rVis.Left() );
+ pValue++;nIndex++;
+
+ pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "VisibleTop" ) );
+ pValue->Value <<= TWIP_TO_MM100 ( rVis.Top() );
+ pValue++;nIndex++;
+
+ pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "VisibleRight" ) );
+ pValue->Value <<= TWIP_TO_MM100 ( bBrowse ? LONG_MIN : rVis.Right() );
+ pValue++;nIndex++;
+
+ pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "VisibleBottom" ) );
+ pValue->Value <<= TWIP_TO_MM100 ( bBrowse ? LONG_MIN : rVis.Bottom() );
+ pValue++;nIndex++;
+
+ pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ZoomType" ) );
+ const sal_Int16 nZoomType = static_cast< sal_Int16 >(pWrtShell->GetViewOptions()->GetZoomType());
+ pValue->Value <<= nZoomType;
+ pValue++;nIndex++;
+
+ pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ViewLayoutColumns" ) );
+ const sal_Int16 nViewLayoutColumns = static_cast< sal_Int16 >(pWrtShell->GetViewOptions()->GetViewLayoutColumns());
+ pValue->Value <<= nViewLayoutColumns;
+ pValue++;nIndex++;
+
+ pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ViewLayoutBookMode" ) );
+ const sal_Bool bIsViewLayoutBookMode = pWrtShell->GetViewOptions()->IsViewLayoutBookMode();
+ pValue->Value.setValue( &bIsViewLayoutBookMode, ::getBooleanCppuType() );
+ pValue++;nIndex++;
+
+ pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "ZoomFactor" ) );
+ pValue->Value <<= static_cast < sal_Int16 > (pWrtShell->GetViewOptions()->GetZoom());
+ pValue++;nIndex++;
+
+ pValue->Name = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "IsSelectedFrame" ) );
+ const sal_Bool bIsSelected = FRMTYPE_NONE == pWrtShell->GetSelFrmType() ? sal_False : sal_True;
+ pValue->Value.setValue ( &bIsSelected, ::getBooleanCppuType() );
+ nIndex++;
+
+ if ( nIndex < NUM_VIEW_SETTINGS )
+ rSequence.realloc ( nIndex );
+}
+#undef NUM_VIEW_SETTINGS
+
+
+
+void SwView::ShowCursor( FASTBOOL bOn )
+{
+ //JP 10.10.2001: Bug 90461 - don't scroll the cursor into the visible area
+ BOOL bUnlockView = !pWrtShell->IsViewLocked();
+ pWrtShell->LockView( TRUE ); //lock visible section
+
+ if( !bOn )
+ pWrtShell->HideCrsr();
+ else if( !pWrtShell->IsFrmSelected() && !pWrtShell->IsObjSelected() )
+ pWrtShell->ShowCrsr();
+
+ if( bUnlockView )
+ pWrtShell->LockView( FALSE );
+}
+
+
+
+ErrCode SwView::DoVerb( long nVerb )
+{
+ if ( !GetViewFrame()->GetFrame().IsInPlace() )
+ {
+ SwWrtShell &rSh = GetWrtShell();
+ const int nSel = rSh.GetSelectionType();
+ if ( nSel & nsSelectionType::SEL_OLE )
+ rSh.LaunchOLEObj( nVerb );
+ }
+ return ERRCODE_NONE;
+}
+
+/*-----------------17.02.98 13:33-------------------
+ nur sal_True fuer eine Textselektion zurueck geben
+--------------------------------------------------*/
+sal_Bool SwView::HasSelection( sal_Bool bText ) const
+{
+ return bText ? GetWrtShell().SwCrsrShell::HasSelection()
+ : GetWrtShell().HasSelection();
+}
+
+/*-----------------09/16/97 09:50am-----------------
+
+--------------------------------------------------*/
+
+String SwView::GetSelectionText( sal_Bool bCompleteWrds )
+{
+ return GetSelectionTextParam( bCompleteWrds, sal_True );
+}
+
+/*-----------------09/16/97 09:50am-----------------
+
+--------------------------------------------------*/
+String SwView::GetSelectionTextParam( sal_Bool bCompleteWrds,
+ sal_Bool bEraseTrail )
+{
+ String sReturn;
+ if( bCompleteWrds && !GetWrtShell().HasSelection() )
+ GetWrtShell().SelWrd();
+
+ GetWrtShell().GetSelectedText( sReturn );
+ if( bEraseTrail )
+ sReturn.EraseTrailingChars();
+ return sReturn;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+SwGlossaryHdl* SwView::GetGlosHdl()
+{
+ if(!pGlosHdl)
+ pGlosHdl = new SwGlossaryHdl(GetViewFrame(), pWrtShell);
+ return pGlosHdl;
+}
+
+/*-----------------05.09.96 15.50-------------------
+
+--------------------------------------------------*/
+
+
+
+void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ BOOL bCallBase = sal_True;
+ if ( rHint.ISA(SfxSimpleHint) )
+ {
+ sal_uInt32 nId = ((SfxSimpleHint&)rHint).GetId();
+ switch ( nId )
+ {
+ // --> OD 2005-03-03 #i43775# - sub shells will be destroyed by the
+ // dispatcher, if the view frame is dying. Thus, reset member <pShell>.
+ case SFX_HINT_DYING:
+ {
+ if ( &rBC == GetViewFrame() )
+ {
+ ResetSubShell();
+ }
+ }
+ break;
+ // <--
+ case SFX_HINT_MODECHANGED:
+ {
+ // Modalmodus-Umschaltung?
+ sal_Bool bModal = GetDocShell()->IsInModalMode();
+ pHRuler->SetActive( !bModal );
+ pVRuler->SetActive( !bModal );
+ }
+
+ /* kein break hier */
+
+ case SFX_HINT_TITLECHANGED:
+ if ( GetDocShell()->IsReadOnly() != GetWrtShell().GetViewOptions()->IsReadonly() )
+ {
+ SwWrtShell &rSh = GetWrtShell();
+ rSh.SetReadonlyOption( GetDocShell()->IsReadOnly() );
+
+ if ( rSh.GetViewOptions()->IsViewVRuler() )
+ CreateVLineal();
+ else
+ KillVLineal();
+ if ( rSh.GetViewOptions()->IsViewHRuler() )
+ CreateTab();
+ else
+ KillTab();
+ bool bReadonly = GetDocShell()->IsReadOnly();
+ //#i76332# if document is to be opened in alive-mode then this has to be regarded while switching from readonly-mode to edit-mode
+ if( !bReadonly )
+ {
+ SwDrawDocument * pDrawDoc = 0;
+ if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (GetDocShell()->GetDoc()->GetDrawModel() ) ) )
+ {
+ if( !pDrawDoc->GetOpenInDesignMode() )
+ break;// don't touch the design mode
+ }
+ }
+ SfxBoolItem aItem( SID_FM_DESIGN_MODE, !bReadonly);
+ GetDispatcher().Execute( SID_FM_DESIGN_MODE, SFX_CALLMODE_ASYNCHRON,
+ &aItem, 0L );
+ }
+ break;
+
+ case SW_BROADCAST_DRAWVIEWS_CREATED:
+ {
+ bCallBase = sal_False;
+ if ( GetFormShell() )
+ {
+ GetFormShell()->SetView(
+ PTR_CAST(FmFormView, GetWrtShell().GetDrawView()) );
+ SfxBoolItem aItem( SID_FM_DESIGN_MODE, !GetDocShell()->IsReadOnly());
+ GetDispatcher().Execute( SID_FM_DESIGN_MODE, SFX_CALLMODE_SYNCHRON,
+ &aItem, 0L );
+ }
+ }
+ break;
+ }
+ }
+ else if(rHint.ISA(FmDesignModeChangedHint))
+ {
+ sal_Bool bDesignMode = ((FmDesignModeChangedHint&)rHint).GetDesignMode();
+ if (!bDesignMode && GetDrawFuncPtr())
+ {
+ GetDrawFuncPtr()->Deactivate();
+ SetDrawFuncPtr(NULL);
+ LeaveDrawCreate();
+ AttrChangedNotify(pWrtShell);
+ }
+ }
+
+ if ( bCallBase )
+ SfxViewShell::Notify(rBC, rHint);
+}
+
+/*-----------------02.12.96 12:36-------------------
+
+--------------------------------------------------*/
+#if defined WNT || defined UNX
+
+void SwView::ScannerEventHdl( const EventObject& /*rEventObject*/ )
+{
+ uno::Reference< XScannerManager > xScanMgr = SW_MOD()->GetScannerManager();
+ if( xScanMgr.is() )
+ {
+ const ScannerContext aContext( xScanMgr->getAvailableScanners().getConstArray()[ 0 ] );
+ const ScanError eError = xScanMgr->getError( aContext );
+
+ if( ScanError_ScanErrorNone == eError )
+ {
+ const uno::Reference< awt::XBitmap > xBitmap( xScanMgr->getBitmap( aContext ) );
+
+ if( xBitmap.is() )
+ {
+ const BitmapEx aScanBmp( VCLUnoHelper::GetBitmap( xBitmap ) );
+
+ if( !!aScanBmp )
+ {
+ Graphic aGrf(aScanBmp);
+ pWrtShell->Insert( aEmptyStr, aEmptyStr, aGrf );
+ }
+ }
+ }
+ }
+ SfxBindings& rBind = GetViewFrame()->GetBindings();
+ rBind.Invalidate( SID_TWAIN_SELECT );
+ rBind.Invalidate( SID_TWAIN_TRANSFER );
+}
+#endif
+
+/*-----------------04.03.97 15:07-------------------
+
+--------------------------------------------------*/
+
+
+void SwView::StopShellTimer()
+{
+ if(aTimer.IsActive())
+ {
+ aTimer.Stop();
+ if ( bAttrChgNotifiedWithRegistrations )
+ {
+ GetViewFrame()->GetBindings().LEAVEREGISTRATIONS();
+ bAttrChgNotifiedWithRegistrations = sal_False;
+ }
+ SelectShell();
+ bAttrChgNotified = sal_False;
+ }
+}
+
+/*-----------------09/03/97 04:12pm-----------------
+
+--------------------------------------------------*/
+sal_uInt16 SwView::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
+{
+ SfxViewFrame* pVFrame = GetViewFrame();
+ pVFrame->SetChildWindow( SwInputChild::GetChildWindowId(), sal_False );
+ if( pVFrame->GetDispatcher()->IsLocked() )
+ pVFrame->GetDispatcher()->Lock(sal_False);
+
+ sal_uInt16 nRet;
+ if ( pFormShell &&
+ sal_True != (nRet = pFormShell->PrepareClose( bUI, bForBrowsing )) )
+
+ {
+ return nRet;
+ }
+ return SfxViewShell::PrepareClose( bUI, bForBrowsing );
+}
+
+
+
+ // status methods for clipboard.
+ // Status changes now notified from the clipboard.
+BOOL SwView::IsPasteAllowed()
+{
+ USHORT nPasteDestination = SwTransferable::GetSotDestination( *pWrtShell );
+ if( nLastPasteDestination != nPasteDestination )
+ {
+ TransferableDataHelper aDataHelper(
+ TransferableDataHelper::CreateFromSystemClipboard(
+ &GetEditWin()) );
+ if( aDataHelper.GetXTransferable().is() )
+ {
+ bPasteState = SwTransferable::IsPaste( *pWrtShell, aDataHelper );
+ bPasteSpecialState = SwTransferable::IsPasteSpecial(
+ *pWrtShell, aDataHelper );
+ }
+ else
+ bPasteState = bPasteSpecialState = FALSE;
+
+ if( 0xFFFF == nLastPasteDestination ) // the init value
+ pViewImpl->AddClipboardListener();
+ nLastPasteDestination = nPasteDestination;
+ }
+ return bPasteState;
+}
+
+BOOL SwView::IsPasteSpecialAllowed()
+{
+ if ( pFormShell && pFormShell->IsActiveControl() )
+ return FALSE;
+
+ USHORT nPasteDestination = SwTransferable::GetSotDestination( *pWrtShell );
+ if( nLastPasteDestination != nPasteDestination )
+ {
+ TransferableDataHelper aDataHelper(
+ TransferableDataHelper::CreateFromSystemClipboard(
+ &GetEditWin()) );
+ if( aDataHelper.GetXTransferable().is() )
+ {
+ bPasteState = SwTransferable::IsPaste( *pWrtShell, aDataHelper );
+ bPasteSpecialState = SwTransferable::IsPasteSpecial(
+ *pWrtShell, aDataHelper );
+ }
+ else
+ bPasteState = bPasteSpecialState = FALSE;
+
+ if( 0xFFFF == nLastPasteDestination ) // the init value
+ pViewImpl->AddClipboardListener();
+ }
+ return bPasteSpecialState;
+}
+/* -----------------------------12.07.01 13:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwView::NotifyDBChanged()
+{
+ GetViewImpl()->GetUNOObject_Impl()->NotifyDBChanged();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Drucken
+ --------------------------------------------------------------------*/
+
+/* -----------------------------28.10.02 13:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SfxObjectShellLock & SwView::GetTmpSelectionDoc()
+{
+ return GetViewImpl()->GetTmpSelectionDoc();
+}
+/* -----------------------------31.10.02 13:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SfxObjectShellLock & SwView::GetOrCreateTmpSelectionDoc()
+{
+ SfxObjectShellLock &rxTmpDoc = GetViewImpl()->GetTmpSelectionDoc();
+ if (!rxTmpDoc.Is())
+ {
+ SwXTextView *pImpl = GetViewImpl()->GetUNOObject_Impl();
+ rxTmpDoc = pImpl->BuildTmpSelectionDoc();
+ }
+ return rxTmpDoc;
+}
+/* -----------------3/31/2003 12:39PM----------------
+
+ --------------------------------------------------*/
+void SwView::AddTransferable(SwTransferable& rTransferable)
+{
+ GetViewImpl()->AddTransferable(rTransferable);
+}
+
+/* --------------------------------------------------*/
+
+namespace sw {
+
+void InitPrintOptionsFromApplication(SwPrintData & o_rData, bool const bWeb)
+{
+ o_rData = *SW_MOD()->GetPrtOptions(bWeb);
+}
+
+} // namespace sw
+
diff --git a/sw/source/ui/uiview/view.hrc b/sw/source/ui/uiview/view.hrc
new file mode 100644
index 000000000000..d2aa60494801
--- /dev/null
+++ b/sw/source/ui/uiview/view.hrc
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _VIEW_HRC
+#define _VIEW_HRC
+
+#include "rcid.hrc"
+
+// BTN -------------------------------------------------------------------
+
+#define BTN_PAGEDOWN (RC_VIEW_BEGIN)
+#define BTN_PAGEUP (RC_VIEW_BEGIN + 1)
+
+// STR -------------------------------------------------------------------
+
+#define STR_NUM_LEVEL (RC_VIEW_BEGIN + 3)
+#define STR_NUM_OUTLINE (RC_VIEW_BEGIN + 4)
+
+#define STR_ERROR_NOLANG (RC_VIEW_BEGIN + 6)
+
+#define STR_EDIT_FOOTNOTE (RC_VIEW_BEGIN + 14)
+
+//#define RID_PVIEW_TOOLBOX (RC_VIEW_BEGIN + 15)
+#define MSG_NOT_FOUND (RC_VIEW_BEGIN + 16)
+#define MSG_SEARCH_START (RC_VIEW_BEGIN + 17)
+#define MSG_SEARCH_END (RC_VIEW_BEGIN + 18)
+#define MSG_INDEX_OVERFLOW (RC_VIEW_BEGIN + 19)
+#define STR_NB_REPLACED (RC_VIEW_BEGIN + 20)
+#define MSG_SCAN_NOSOURCE (RC_VIEW_BEGIN + 21)
+
+#define STR_SRCVIEW_ROW (RC_VIEW_BEGIN + 22)
+#define STR_SRCVIEW_COL (RC_VIEW_BEGIN + 23)
+#define STR_SAVEAS_SRC (RC_VIEW_BEGIN + 24)
+
+#define MSG_NO_MERGE_ENTRY (RC_VIEW_BEGIN + 25)
+
+#define STR_PRINT_TITLE (RC_VIEW_BEGIN + 26)
+#define STR_PRINT_MSG (RC_VIEW_BEGIN + 27)
+#define STR_PRINT_ALL (RC_VIEW_BEGIN + 28)
+#define STR_PRINT_SELECTION (RC_VIEW_BEGIN + 29)
+#define STR_READONLY_SEL (RC_VIEW_BEGIN + 30)
+
+#define RID_PVIEW_TOOLBOX (RC_VIEW_BEGIN + 31)
+#define STR_WEBOPTIONS (RC_VIEW_BEGIN + 32)
+#define STR_TEXTOPTIONS (RC_VIEW_BEGIN + 33)
+// MSG -------------------------------------------------------------------
+
+#define MSG_ERR_INSERT_GLOS (RC_VIEW_BEGIN)
+
+#define MSG_ERR_NO_FAX (RC_VIEW_BEGIN + 5)
+#define MSG_ERR_SRCSTREAM (RC_VIEW_BEGIN + 6)
+
+// DLG -------------------------------------------------------------------
+
+#define DLG_SPECIAL_FORCED (RC_VIEW_BEGIN)
+#define DLG_PAGEPREVIEW_ZOOM (RC_VIEW_BEGIN + 1)
+
+// Ueberlaufpruefung -----------------------------------------------------
+
+#define VIEW_ACT_END STR_EDIT_FOOTNOTE
+
+#if VIEW_ACT_END > RC_VIEW_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#endif
+
diff --git a/sw/source/ui/uiview/view.src b/sw/source/ui/uiview/view.src
new file mode 100644
index 000000000000..11543c0ac8f3
--- /dev/null
+++ b/sw/source/ui/uiview/view.src
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/svxids.hrc>
+#include <svx/globlmn.hrc>
+#include "view.hrc"
+#include "shells.hrc"
+#include "globals.hrc"
+#include "popup.hrc"
+#include "helpid.h"
+#include "cmdid.h"
+ImageButton BTN_PAGEUP
+{
+ SVLOOK = TRUE ;
+ HIDE = TRUE ;
+ RectStyle = TRUE ;
+ SmallStyle = TRUE ;
+ SYMBOL = IMAGEBUTTON_PAGEUP ;
+};
+ImageButton BTN_PAGEDOWN
+{
+ SVLOOK = TRUE ;
+ HIDE = TRUE ;
+ RectStyle = TRUE ;
+ SmallStyle = TRUE ;
+ SYMBOL = IMAGEBUTTON_PAGEDOWN ;
+};
+QueryBox DLG_WRAP
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_YES ;
+ Message [ en-US ] = "Do you want to continue checking at the beginning of the document?" ;
+};
+QueryBox DLG_BODY
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+ Message [ en-US ] = "Do you want to check the main text?" ;
+};
+QueryBox DLG_PRT_FIELDNAME
+{
+ BUTTONS = WB_YES_NO_CANCEL ;
+ DEFBUTTON = WB_DEF_CANCEL ;
+ Message [ en-US ] = "Show field commands option is checked.\nDo you want to print the document with field names?" ;
+};
+QueryBox DLG_SPECIAL
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+ Message [ en-US ] = "Do you want check the special regions?" ;
+};
+QueryBox DLG_THESAURUS
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+ Message [ en-US ] = "This word appears in the list of words you want to avoid! Start thesaurus?" ;
+};
+QueryBox DLG_SPECIAL_FORCED
+{
+ BUTTONS = WB_YES_NO ;
+ DEFBUTTON = WB_DEF_NO ;
+ Message [ en-US ] = "Check special regions is deactivated. Check anyway?" ;
+};
+QueryBox MSG_SEARCH_END
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_YES ;
+ Message [ en-US ] = "%PRODUCTNAME Writer has searched to the end of the document. Do you want to continue at the beginning?" ;
+};
+QueryBox MSG_SEARCH_START
+{
+ Buttons = WB_YES_NO ;
+ DefButton = WB_DEF_YES ;
+ Message [ en-US ] = "%PRODUCTNAME Writer has searched to the beginning of the document. Do you want to continue at the end?" ;
+};
+InfoBox MSG_NO_MERGE_ENTRY
+{
+ Message [ en-US ] = "Could not merge documents." ;
+};
+InfoBox MSG_ERR_INSERT_GLOS
+{
+ Message [ en-US ] = "AutoText could not be created." ;
+};
+InfoBox MSG_ERR_SRCSTREAM
+{
+ Message [ en-US ] = "The source cannot be loaded." ;
+};
+InfoBox MSG_ERR_NO_FAX
+{
+ Message [ en-US ] = "No fax printer has been set under Tools/Options/%1/Print." ;
+};
+String STR_WEBOPTIONS
+{
+ Text [ en-US ] = "HTML document";
+};
+String STR_TEXTOPTIONS
+{
+ Text [ en-US ] = "Text document";
+};
+InfoBox MSG_NOT_FOUND
+{
+ Message [ en-US ] = "Search key not found." ;
+};
+InfoBox MSG_INDEX_OVERFLOW
+{
+ Message [ en-US ] = "found." ;
+};
+InfoBox MSG_SCAN_NOSOURCE
+{
+ Message [ en-US ] = "Source not specified." ;
+};
+String STR_NUM_LEVEL
+{
+ Text [ en-US ] = "Level " ;
+};
+//#outline level,zhaojianwei
+String STR_NUM_OUTLINE
+{
+ Text [ en-US ] = "Outline ";
+};//<-end,zhaojianwei
+// <--
+String STR_ERROR_NOLANG
+{
+ Text [ en-US ] = "No language is selected in the proofed section." ;
+};
+String STR_EDIT_FOOTNOTE
+{
+ Text [ en-US ] = "Edit Footnote/Endnote" ;
+};
+String STR_NB_REPLACED
+{
+ Text [ en-US ] = "Search key replaced XX times." ;
+};
+String RID_TOOLS_TOOLBOX
+{
+ Text [ en-US ] = "Main Toolbar" ;
+};
+String STR_SRCVIEW_ROW
+{
+ Text [ en-US ] = "Row " ;
+};
+String STR_SRCVIEW_COL
+{
+ Text [ en-US ] = "Column " ;
+};
+String STR_PRINT_TITLE
+{
+ Text [ en-US ] = "Printing selection";
+};
+String STR_PRINT_MSG
+{
+ Text [ en-US ] = "Do you want to print the selection or the entire document?";
+};
+String STR_PRINT_ALL
+{
+ Text [ en-US ] = "All";
+};
+String STR_PRINT_SELECTION
+{
+ Text [ en-US ] = "Selection";
+};
+String STR_READONLY_SEL
+{
+ Text [ en-US ] = "read-only";
+};
+String STR_SAVEAS_SRC
+{
+ Text [ en-US ] = "~Export source..." ;
+};
+String MN_SRCVIEW_POPUPMENU
+{
+ Text [ en-US ] = "HTML source" ;
+};
+
+Menu MN_SRCVIEW_POPUPMENU
+{
+ ItemList =
+ {
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_FONT
+ };
+ MenuItem
+ {
+ ITEM_FORMAT_ATTR_CHAR_FONTHEIGHT
+ };
+ MenuItem
+ {
+ Separator = TRUE ;
+ };
+ MenuItem
+ {
+ Identifier = SID_SOURCEVIEW ;
+ HelpID = HID_SOURCEVIEW ;
+ Text [ en-US ] = "HTML Source" ;
+ };
+ };
+};
diff --git a/sw/source/ui/uiview/view0.cxx b/sw/source/ui/uiview/view0.cxx
new file mode 100644
index 000000000000..84000c3ae049
--- /dev/null
+++ b/sw/source/ui/uiview/view0.cxx
@@ -0,0 +1,561 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include "hintids.hxx"
+#include <vcl/graph.hxx>
+#include <svx/galbrws.hxx>
+#include <svl/srchitem.hxx>
+#include <SwSpellDialogChildWindow.hxx>
+#include <svl/eitem.hxx>
+#include <unotools/linguprops.hxx>
+#include <unotools/lingucfg.hxx>
+#include <viewopt.hxx>
+#include <globals.h>
+#include <sfx2/app.hxx>
+#include <sfx2/request.hxx>
+#include <svl/whiter.hxx>
+#include <svx/srchdlg.hxx>
+#include <sfx2/templdlg.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
+#include <uivwimp.hxx>
+#include <avmedia/mediaplayer.hxx>
+#include <swmodule.hxx>
+
+#include <sfx2/objface.hxx>
+#include <navipi.hxx>
+#include <wrtsh.hxx>
+#include "doc.hxx"
+#include "view.hxx"
+#include "basesh.hxx"
+#include "docsh.hxx"
+#include "globals.hrc"
+#include "cmdid.h" // FN_ ...
+#include "globdoc.hxx"
+#include "wview.hxx"
+#include "shells.hrc"
+
+#define OLEObjects
+#define SwView
+#define SearchAttributes
+#define ReplaceAttributes
+#define SearchSettings
+#define _ExecSearch ExecSearch
+#define _StateSearch StateSearch
+#define Frames
+#define Graphics
+#define Tables
+#define Controls
+#define GlobalContents
+#define Text
+#define Frame
+#define Graphic
+#define Object
+#define Draw
+#define TextDrawText
+#define TextInTable
+#define ListInText
+#define ListInTable
+#define WebTextInTable
+#define WebListInText
+#define WebListInTable
+#define TextPage
+#include <sfx2/msg.hxx>
+#include <svx/svxslots.hxx>
+#include "swslots.hxx"
+#include <PostItMgr.hxx>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+#include <unotools/moduleoptions.hxx>
+
+#include <IDocumentSettingAccess.hxx>
+
+#include <unomid.h>
+
+SFX_IMPL_NAMED_VIEWFACTORY(SwView, "Default")
+{
+ if ( SvtModuleOptions().IsWriter() )
+ {
+ SFX_VIEW_REGISTRATION(SwDocShell);
+ SFX_VIEW_REGISTRATION(SwGlobalDocShell);
+ }
+}
+
+SFX_IMPL_INTERFACE( SwView, SfxViewShell, SW_RES(RID_TOOLS_TOOLBOX) )
+{
+ SFX_CHILDWINDOW_CONTEXT_REGISTRATION(SID_NAVIGATOR);
+ SFX_CHILDWINDOW_REGISTRATION(SID_TASKPANE);
+ SFX_CHILDWINDOW_REGISTRATION(SfxTemplateDialogWrapper::GetChildWindowId());
+ SFX_CHILDWINDOW_REGISTRATION(SvxSearchDialogWrapper::GetChildWindowId());
+ SFX_CHILDWINDOW_REGISTRATION(SwSpellDialogChildWindow::GetChildWindowId());
+ SFX_CHILDWINDOW_REGISTRATION(FN_REDLINE_ACCEPT);
+ SFX_CHILDWINDOW_REGISTRATION(SID_HYPERLINK_DIALOG);
+ SFX_CHILDWINDOW_REGISTRATION(GalleryChildWindow::GetChildWindowId());
+ SFX_CHILDWINDOW_REGISTRATION(::avmedia::MediaPlayer::GetChildWindowId());
+ SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_FIELD_DATA_ONLY);
+ SFX_FEATURED_CHILDWINDOW_REGISTRATION(FN_SYNC_LABELS, CHILDWIN_LABEL );
+ SFX_FEATURED_CHILDWINDOW_REGISTRATION(FN_MAILMERGE_CHILDWINDOW, CHILDWIN_MAILMERGE);
+// SFX_CHILDWINDOW_REGISTRATION(FN_MAILMERGE_SENDMAIL_CHILDWINDOW);
+ SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS|
+ SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_SERVER,
+ SW_RES(RID_TOOLS_TOOLBOX) );
+}
+
+TYPEINIT1(SwView,SfxViewShell)
+
+/*-----------------13.12.97 11:06-------------------
+
+--------------------------------------------------*/
+ShellModes SwView::GetShellMode()
+{
+ return pViewImpl->GetShellMode();
+}
+
+/*-----------------13.12.97 11:28-------------------
+
+--------------------------------------------------*/
+view::XSelectionSupplier* SwView::GetUNOObject()
+{
+ return pViewImpl->GetUNOObject();
+}
+/* -----------------------------06.05.2002 13:18------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwView::ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions)
+{
+ pWrtShell->ApplyAccessiblityOptions(rAccessibilityOptions);
+ //to enable the right state of the selection cursor in readonly documents
+ if(GetDocShell()->IsReadOnly())
+ pWrtShell->ShowCrsr();
+
+}
+/*-- 26.05.2004 09:14:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwView::SetMailMergeConfigItem(SwMailMergeConfigItem* pConfigItem,
+ sal_uInt16 nRestart, sal_Bool bIsSource)
+{
+ pViewImpl->SetMailMergeConfigItem(pConfigItem, nRestart, bIsSource);
+ UIFeatureChanged();
+}
+/*-- 26.05.2004 09:14:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwMailMergeConfigItem* SwView::GetMailMergeConfigItem()
+{
+ return pViewImpl->GetMailMergeConfigItem();
+}
+/*-- 26.05.2004 09:14:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_uInt16 SwView::GetMailMergeRestartPage() const
+{
+ return pViewImpl->GetMailMergeRestartPage();
+}
+/*-- 03.09.2004 11:56:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwView::IsMailMergeSourceView() const
+{
+ return pViewImpl->IsMailMergeSourceView();
+}
+/*-- 12.04.2006 11:51:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool lcl_IsViewMarks( const SwViewOption& rVOpt )
+{
+ return rVOpt.IsHardBlank() &&
+ rVOpt.IsSoftHyph() &&
+ SwViewOption::IsFieldShadings();
+}
+void lcl_SetViewMarks(SwViewOption& rVOpt, sal_Bool bOn )
+{
+ rVOpt.SetHardBlank(bOn);
+ rVOpt.SetSoftHyph(bOn);
+ SwViewOption::SetAppearanceFlag(
+ VIEWOPT_FIELD_SHADINGS, bOn, TRUE);
+}
+
+void lcl_SetViewMetaChars( SwViewOption& rVOpt, sal_Bool bOn)
+{
+ rVOpt.SetViewMetaChars( bOn );
+ if(bOn && !(rVOpt.IsParagraph() ||
+ rVOpt.IsTab() ||
+ rVOpt.IsLineBreak() ||
+ rVOpt.IsShowHiddenChar() ||
+ rVOpt.IsBlank()))
+ {
+ rVOpt.SetParagraph(bOn);
+ rVOpt.SetTab(bOn);
+ rVOpt.SetLineBreak(bOn);
+ rVOpt.SetBlank(bOn);
+ rVOpt.SetShowHiddenChar(bOn);
+ }
+}
+
+/*--------------------------------------------------------------------
+ State of view options
+ --------------------------------------------------------------------*/
+void SwView::StateViewOptions(SfxItemSet &rSet)
+{
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ SfxBoolItem aBool;
+ const SwViewOption* pOpt = GetWrtShell().GetViewOptions();
+ const IDocumentSettingAccess* pIDSA = GetDocShell()->getIDocumentSettingAccess();
+
+ while(nWhich)
+ {
+ sal_Bool bReadonly = GetDocShell()->IsReadOnly();
+ sal_Bool bBrowse = pIDSA ? pIDSA->get( IDocumentSettingAccess::BROWSE_MODE ) : sal_False;
+ if ( bReadonly && nWhich != FN_VIEW_GRAPHIC )
+ {
+ rSet.DisableItem(nWhich);
+ nWhich = 0;
+ }
+ switch(nWhich)
+ {
+ case FN_RULER:
+ {
+ if(!pOpt->IsViewHRuler(TRUE) && !pOpt->IsViewVRuler(TRUE))
+ {
+ rSet.DisableItem(nWhich);
+ nWhich = 0;
+ }
+ else
+ aBool.SetValue( pOpt->IsViewAnyRuler());
+ }
+ break;
+ case FN_VIEW_BOUNDS:
+ aBool.SetValue( SwViewOption::IsDocBoundaries()); break;
+ case FN_VIEW_GRAPHIC:
+ aBool.SetValue( !pOpt->IsGraphic() ); break;
+ case FN_VIEW_FIELDS:
+ aBool.SetValue( SwViewOption::IsFieldShadings() ); break;
+ case FN_VIEW_FIELDNAME:
+ aBool.SetValue( pOpt->IsFldName() ); break;
+ case FN_VIEW_MARKS:
+ aBool.SetValue( lcl_IsViewMarks(*pOpt) ); break;
+ case FN_VIEW_META_CHARS:
+ aBool.SetValue( pOpt->IsViewMetaChars() ); break;
+ case FN_VIEW_TABLEGRID:
+ aBool.SetValue( SwViewOption::IsTableBoundaries() ); break;
+ case FN_VIEW_NOTES:
+ {
+ aBool.SetValue( pOpt->IsPostIts());
+ if (!GetPostItMgr()->HasNotes())
+ {
+ aBool.SetWhich( nWhich );
+ rSet.Put( aBool );
+ rSet.DisableItem(nWhich);
+ nWhich = 0;
+ }
+ break;
+ }
+ case FN_VIEW_HIDDEN_PARA:
+ aBool.SetValue( pOpt->IsShowHiddenPara()); break;
+ case SID_GRID_VISIBLE:
+ aBool.SetValue( pOpt->IsGridVisible() ); break;
+ case SID_GRID_USE:
+ aBool.SetValue( pOpt->IsSnap() ); break;
+ case SID_HELPLINES_MOVE:
+ aBool.SetValue( pOpt->IsCrossHair() ); break;
+ case FN_VIEW_SMOOTH_SCROLL:
+ aBool.SetValue( pOpt->IsSmoothScroll()); break;
+ case FN_VLINEAL:
+ aBool.SetValue( 0 != StatVLineal() ); break;
+ case FN_HSCROLLBAR:
+ if(bBrowse)
+ {
+ rSet.DisableItem(nWhich);
+ nWhich = 0;
+ }
+ else
+ aBool.SetValue( IsHScrollbarVisible() ); break;
+ case FN_VSCROLLBAR:
+ aBool.SetValue( IsVScrollbarVisible() ); break;
+ case SID_AUTOSPELL_CHECK:
+ aBool.SetValue( pOpt->IsOnlineSpell() );
+ break;
+ case FN_SHADOWCURSOR:
+ if (pIDSA == 0 || pIDSA->get( IDocumentSettingAccess::BROWSE_MODE ))
+ {
+ rSet.DisableItem( nWhich );
+ nWhich = 0;
+ }
+ else
+ aBool.SetValue( pOpt->IsShadowCursor() );
+ break;
+
+ }
+
+ if( nWhich )
+ {
+ aBool.SetWhich( nWhich );
+ rSet.Put( aBool );
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ execute view options
+ --------------------------------------------------------------------*/
+void SwView::ExecViewOptions(SfxRequest &rReq)
+{
+ SwViewOption* pOpt = new SwViewOption( *GetWrtShell().GetViewOptions() );
+ sal_Bool bModified = GetWrtShell().IsModified();
+
+ int eState = STATE_TOGGLE;
+ sal_Bool bSet = sal_False;
+
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ sal_uInt16 nSlot = rReq.GetSlot();
+ const SfxPoolItem* pAttr=NULL;
+
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nSlot , sal_False, &pAttr ))
+ {
+ bSet = ((SfxBoolItem*)pAttr)->GetValue();
+ eState = bSet ? STATE_ON : STATE_OFF;
+ }
+
+ BOOL bFlag = STATE_ON == eState;
+ uno::Reference< beans::XPropertySet > xLngProp( ::GetLinguPropertySet() );
+
+ switch ( nSlot )
+ {
+ case FN_VIEW_GRAPHIC:
+
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsGraphic();
+ pOpt->SetGraphic( bFlag );
+ break;
+
+ case FN_VIEW_FIELDS:
+ if( STATE_TOGGLE == eState )
+ bFlag = !SwViewOption::IsFieldShadings() ;
+ SwViewOption::SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS, bFlag, TRUE );
+ break;
+
+ case FN_VIEW_BOUNDS:
+ if( STATE_TOGGLE == eState )
+ bFlag = !SwViewOption::IsDocBoundaries();
+ SwViewOption::SetAppearanceFlag(VIEWOPT_DOC_BOUNDARIES, bFlag, TRUE );
+ break;
+
+ case SID_GRID_VISIBLE:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsGridVisible();
+
+ pOpt->SetGridVisible( bFlag );
+ break;
+
+ case SID_GRID_USE:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsSnap();
+
+ pOpt->SetSnap( bFlag );
+ break;
+
+ case SID_HELPLINES_MOVE:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsCrossHair();
+
+ pOpt->SetCrossHair( bFlag );
+ break;
+
+ case FN_VIEW_NOTES:
+ if ( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsPostIts();
+
+ GetPostItMgr()->SetLayout();
+ pOpt->SetPostIts( bFlag );
+ if (pOpt->IsPostIts())
+ GetPostItMgr()->CheckMetaText();
+ break;
+
+ case FN_VIEW_HIDDEN_PARA:
+ if ( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsShowHiddenPara();
+
+ pOpt->SetShowHiddenPara( bFlag );
+ break;
+
+ case FN_VIEW_SMOOTH_SCROLL:
+
+ if ( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsSmoothScroll();
+
+ pOpt->SetSmoothScroll( bFlag );
+ break;
+
+
+ case FN_VLINEAL:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsViewVRuler();
+
+ pOpt->SetViewVRuler( bFlag );
+ break;
+
+ case FN_VSCROLLBAR:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsViewVScrollBar();
+
+ pOpt->SetViewVScrollBar( bFlag );
+ break;
+
+ case FN_HSCROLLBAR:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsViewHScrollBar();
+
+ pOpt->SetViewHScrollBar( bFlag );
+ break;
+ case FN_RULER:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsViewAnyRuler();
+
+ pOpt->SetViewAnyRuler( bFlag );
+ break;
+
+ case FN_VIEW_TABLEGRID:
+ if( STATE_TOGGLE == eState )
+ bFlag = !SwViewOption::IsTableBoundaries();
+ SwViewOption::SetAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES, bFlag, TRUE );
+ break;
+
+ case FN_VIEW_FIELDNAME:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsFldName() ;
+
+ pOpt->SetFldName( bFlag );
+ break;
+ case FN_VIEW_MARKS:
+ if( STATE_TOGGLE == eState )
+ bFlag = !lcl_IsViewMarks(*pOpt) ;
+
+ lcl_SetViewMarks( *pOpt, bFlag );
+ break;
+ case FN_VIEW_META_CHARS:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsViewMetaChars();
+
+ lcl_SetViewMetaChars( *pOpt, bFlag );
+ break;
+ case SID_AUTOSPELL_CHECK:
+ if( STATE_TOGGLE == eState )
+ bFlag = bSet = !pOpt->IsOnlineSpell();
+
+ pOpt->SetOnlineSpell(bSet);
+ {
+ uno::Any aVal( &bSet, ::getCppuBooleanType() );
+ String aPropName( C2S(UPN_IS_SPELL_AUTO) );
+
+ SvtLinguConfig aCfg;
+ aCfg.SetProperty( aPropName, aVal );
+
+ if (xLngProp.is())
+ xLngProp->setPropertyValue( aPropName, aVal );
+
+ // for the time being we do not have a specific option for grammarchecking.
+ // thus we'll use the one for spell checking...
+ if (bSet)
+ {
+ SwDocShell *pDocSh = GetDocShell();
+ SwDoc *pDoc = pDocSh? pDocSh->GetDoc() : NULL;
+
+ // right now we don't have view options for automatic grammar checking. Thus...
+ sal_Bool bIsAutoGrammar = sal_False;
+ aCfg.GetProperty( C2U( UPN_IS_GRAMMAR_AUTO ) ) >>= bIsAutoGrammar;
+
+ if (pDoc && bIsAutoGrammar)
+ StartGrammarChecking( *pDoc );
+ }
+ }
+ break;
+ case FN_SHADOWCURSOR:
+ if( STATE_TOGGLE == eState )
+ bFlag = bSet = !pOpt->IsShadowCursor();
+
+ pOpt->SetShadowCursor(bSet);
+ break;
+
+ default:
+ ASSERT(sal_False, Falsche Request-Methode);
+ return;
+ }
+
+ // UserPrefs setzen Request als bearbeitet kennzeichnen
+ sal_Bool bWebView = 0 != dynamic_cast<const SwWebView*>(this);
+ SwWrtShell &rSh = GetWrtShell();
+ rSh.StartAction();
+ SwModule* pModule = SW_MOD();
+ if( !(*rSh.GetViewOptions() == *pOpt ))
+ {
+ rSh.ApplyViewOptions( *pOpt );
+
+ //Die UsrPref muessen als Modified gekennzeichnet werden.
+ //call for initialization
+ pModule->GetUsrPref(bWebView);
+ pModule->CheckSpellChanges( pOpt->IsOnlineSpell(), sal_False, sal_False, sal_False );
+ }
+ //OS: Modified wieder zuruecksetzen, weil Ansicht/Felder
+ // das Doc modified setzt.
+ if( !bModified )
+ rSh.ResetModified();
+
+ pModule->ApplyUsrPref( *pOpt, this, bWebView ? VIEWOPT_DEST_WEB : VIEWOPT_DEST_TEXT );
+
+ //mod #i6193# let postits know about new spellcheck setting
+ if ( nSlot == SID_AUTOSPELL_CHECK )
+ GetPostItMgr()->SetSpellChecking();
+
+ const BOOL bLockedView = rSh.IsViewLocked();
+ rSh.LockView( TRUE ); //lock visible section
+ GetWrtShell().EndAction();
+ rSh.LockView( bLockedView );
+
+ delete pOpt;
+ Invalidate(rReq.GetSlot());
+ if(!pArgs)
+ rReq.AppendItem(SfxBoolItem(nSlot, (BOOL)bFlag));
+ rReq.Done();
+}
+
+IMPL_LINK( SwView, HtmlOptionsHdl, void*, EMPTYARG )
+{
+ // Invalidierung, falls blinkender Text erlaubt/verboten wurde
+ GetViewFrame()->GetBindings().Invalidate(SID_DRAW_TEXT_MARQUEE);
+ return 0;
+}
diff --git a/sw/source/ui/uiview/view1.cxx b/sw/source/ui/uiview/view1.cxx
new file mode 100644
index 000000000000..208a9c27ebdc
--- /dev/null
+++ b/sw/source/ui/uiview/view1.cxx
@@ -0,0 +1,219 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <svx/svdpagv.hxx>
+#include <svx/svdview.hxx>
+#include <svx/ruler.hxx>
+#include <idxmrk.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <swmodule.hxx>
+#include <viewopt.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#ifndef _GLOBDOC_HXX
+#include <globdoc.hxx>
+#endif
+#include <navipi.hxx>
+#include <fldwrap.hxx>
+#ifndef _REDLNDLG_HXX
+#include <redlndlg.hxx>
+#endif
+#include <dpage.hxx>
+#include <edtwin.hxx>
+#include "formatclipboard.hxx"
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+// header for class SfxRequest
+#include <sfx2/request.hxx>
+
+#include <sfx2/viewfrm.hxx>
+
+extern int bDocSzUpdated;
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwView::Activate(BOOL bMDIActivate)
+{
+ // aktuelle View anmelden an der DocShell
+ // die View bleibt solange an der DocShell
+ // aktiv bis Sie zerstoert wird oder durch Activate eine
+ // neue gesetzt wird
+ SwDocShell* pDocSh = GetDocShell();
+ if(pDocSh)
+ pDocSh->SetView(this);
+ SwModule* pSwMod = SW_MOD();
+ pSwMod->SetView(this);
+
+ // Dokumentgroesse hat sich geaendert
+ if(!bDocSzUpdated)
+ DocSzChgd(aDocSz);
+
+ // #b6330459# make selection visible
+ if(bMakeSelectionVisible)
+ {
+ pWrtShell->MakeSelVisible();
+ bMakeSelectionVisible = sal_False;
+ }
+ pHRuler->SetActive( TRUE );
+ pVRuler->SetActive( TRUE );
+
+ if ( bMDIActivate )
+ {
+ pWrtShell->ShGetFcs(FALSE); // Selektionen sichtbar
+
+ if( sSwViewData.Len() )
+ {
+ ReadUserData( sSwViewData, FALSE );
+ sSwViewData.Erase();
+ }
+
+ AttrChangedNotify(pWrtShell);
+
+ // Flddlg ggf neu initialisieren (z.B. fuer TYP_SETVAR)
+ USHORT nId = SwFldDlgWrapper::GetChildWindowId();
+ SfxViewFrame* pVFrame = GetViewFrame();
+ SwFldDlgWrapper *pWrp = (SwFldDlgWrapper*)pVFrame->GetChildWindow(nId);
+ if (pWrp)
+ pWrp->ReInitDlg(GetDocShell());
+
+ // RedlineDlg ggf neu initialisieren
+ nId = SwRedlineAcceptChild::GetChildWindowId();
+ SwRedlineAcceptChild *pRed = (SwRedlineAcceptChild*)pVFrame->GetChildWindow(nId);
+ if (pRed)
+ pRed->ReInitDlg(GetDocShell());
+
+ // reinit IdxMarkDlg
+ nId = SwInsertIdxMarkWrapper::GetChildWindowId();
+ SwInsertIdxMarkWrapper *pIdxMrk = (SwInsertIdxMarkWrapper*)pVFrame->GetChildWindow(nId);
+ if (pIdxMrk)
+ pIdxMrk->ReInitDlg(*pWrtShell);
+
+ // reinit AuthMarkDlg
+ nId = SwInsertAuthMarkWrapper::GetChildWindowId();
+ SwInsertAuthMarkWrapper *pAuthMrk = (SwInsertAuthMarkWrapper*)pVFrame->
+ GetChildWindow(nId);
+ if (pAuthMrk)
+ pAuthMrk->ReInitDlg(*pWrtShell);
+ }
+ else
+ //Wenigstens das Notify rufen (vorsichtshalber wegen der SlotFilter
+ AttrChangedNotify(pWrtShell);
+
+ SfxViewShell::Activate(bMDIActivate);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void SwView::Deactivate(BOOL bMDIActivate)
+{
+ extern BOOL bFlushCharBuffer ;
+ // Befinden sich noch Zeichen im Input Buffer?
+ if( bFlushCharBuffer )
+ GetEditWin().FlushInBuffer();
+
+ if( bMDIActivate )
+ {
+ pWrtShell->ShLooseFcs(); // Selektionen unsichtbar
+
+ pHRuler->SetActive( FALSE );
+ pVRuler->SetActive( FALSE );
+ }
+ SfxViewShell::Deactivate(bMDIActivate);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwView::MarginChanged()
+{
+ GetWrtShell().SetBrowseBorder( GetMargin() );
+}
+
+/*--------------------------------------------------------------------
+ --------------------------------------------------------------------*/
+
+void SwView::ExecFormatPaintbrush(SfxRequest& rReq)
+{
+ if(!pFormatClipboard)
+ return;
+
+ if( pFormatClipboard->HasContent() )
+ {
+ pFormatClipboard->Erase();
+
+ SwApplyTemplate aTemplate;
+ GetEditWin().SetApplyTemplate(aTemplate);
+ }
+ else
+ {
+ bool bPersistentCopy = false;
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ if( pArgs && pArgs->Count() >= 1 )
+ {
+ bPersistentCopy = static_cast<bool>(((SfxBoolItem &)pArgs->Get(
+ SID_FORMATPAINTBRUSH)).GetValue());
+ }
+
+ pFormatClipboard->Copy( GetWrtShell(), GetPool(), bPersistentCopy );
+
+ SwApplyTemplate aTemplate;
+ aTemplate.pFormatClipboard = pFormatClipboard;
+ GetEditWin().SetApplyTemplate(aTemplate);
+ }
+ GetViewFrame()->GetBindings().Invalidate(SID_FORMATPAINTBRUSH);
+}
+
+void SwView::StateFormatPaintbrush(SfxItemSet &rSet)
+{
+ if(!pFormatClipboard)
+ return;
+
+ bool bHasContent = pFormatClipboard && pFormatClipboard->HasContent();
+ rSet.Put(SfxBoolItem(SID_FORMATPAINTBRUSH, bHasContent));
+ if(!bHasContent)
+ {
+ if( !pFormatClipboard->CanCopyThisType( GetWrtShell().GetSelectionType() ) )
+ rSet.DisableItem( SID_FORMATPAINTBRUSH );
+ }
+}
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
new file mode 100644
index 000000000000..960478c925dd
--- /dev/null
+++ b/sw/source/ui/uiview/view2.cxx
@@ -0,0 +1,2455 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/util/SearchFlags.hpp>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <svtools/filter.hxx>
+#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
+#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
+#include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
+
+#define _SVSTDARR_STRINGSSORTDTOR
+#include <svl/svstdarr.hxx>
+#include <svl/aeitem.hxx>
+
+#include <SwStyleNameMapper.hxx>
+#include <docary.hxx>
+#include <hintids.hxx>
+#include <SwRewriter.hxx>
+#include <numrule.hxx>
+#include <swundo.hxx>
+#include <caption.hxx>
+#include <svl/PasswordHelper.hxx>
+#include <svl/urihelper.hxx>
+#include <sfx2/passwd.hxx>
+#include <sfx2/sfxdlg.hxx>
+#include <sfx2/filedlghelper.hxx>
+#include <sfx2/sfxhelp.hxx>
+#include <editeng/langitem.hxx>
+#include <svx/viewlayoutitem.hxx>
+#include <svx/zoomslideritem.hxx>
+#include <svtools/xwindowitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/bindings.hxx>
+#include <editeng/lrspitem.hxx>
+#include <svtools/txtcmp.hxx>
+#include "editeng/unolingu.hxx"
+#include <vcl/msgbox.hxx>
+#include <editeng/tstpitem.hxx>
+#include <sfx2/event.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <editeng/sizeitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/whiter.hxx>
+#include <svl/ptitem.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <tools/errinf.hxx>
+#include <tools/urlobj.hxx>
+#include <svx/svdview.hxx>
+#include <swtypes.hxx>
+#include <swwait.hxx>
+#include <redlndlg.hxx>
+#include <view.hxx>
+#include <uivwimp.hxx>
+#include <docsh.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <wrtsh.hxx>
+#include <viewopt.hxx>
+#include <basesh.hxx>
+#include <swmodule.hxx>
+#include <uitool.hxx>
+#include <shellio.hxx>
+#include <fmtinfmt.hxx>
+#include <mdiexp.hxx>
+#include <drawbase.hxx>
+#include <frmmgr.hxx>
+#include <pagedesc.hxx>
+#include <section.hxx>
+#include <usrpref.hxx>
+#include <IMark.hxx>
+#include <navipi.hxx>
+#include <tox.hxx>
+#include <workctrl.hxx>
+#include <scroll.hxx>
+#include <edtwin.hxx>
+#include <wview.hxx>
+#include <textsh.hxx>
+#include <tabsh.hxx>
+#include <listsh.hxx>
+#include <cmdid.h>
+#include <comcore.hrc>
+#include <poolfmt.hrc>
+#include <statstr.hrc>
+#include <swerror.h>
+#include <globals.hrc>
+#include <shells.hrc>
+#include <web.hrc>
+#include <view.hrc>
+#include <app.hrc>
+#include <fmtclds.hxx>
+#include <helpid.h>
+#include <svtools/templdlg.hxx>
+#include <dbconfig.hxx>
+#include <dbmgr.hxx>
+
+#include <PostItMgr.hxx>
+
+#include <ndtxt.hxx> //#outline level,added by zhaojianwei
+
+#include <comphelper/processfactory.hxx>
+
+#include <svx/svxdlg.hxx>
+#include <svx/dialogs.hrc>
+#include "swabstdlg.hxx"
+#include "globals.hrc"
+#include <envelp.hrc>
+#include <fmthdft.hxx>
+#include <svx/ofaitem.hxx>
+#include <unomid.h>
+
+const char __FAR_DATA sStatusDelim[] = " : ";
+const char __FAR_DATA sStatusComma[] = " , ";//#outlinelevel, define a Variable for "," add by zhaojianwei
+
+using ::rtl::OUString;
+using namespace sfx2;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::scanner;
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::ui::dialogs;
+
+
+static void lcl_SetAllTextToDefaultLanguage( SwWrtShell &rWrtSh, USHORT nWhichId )
+{
+ if (nWhichId == RES_CHRATR_LANGUAGE ||
+ nWhichId == RES_CHRATR_CJK_LANGUAGE ||
+ nWhichId == RES_CHRATR_CTL_LANGUAGE)
+ {
+ rWrtSh.StartAction();
+ rWrtSh.LockView( TRUE );
+ rWrtSh.Push();
+
+ // prepare to apply new language to all text in document
+ rWrtSh.SelAll();
+ rWrtSh.ExtendedSelectAll();
+
+ // set language attribute to default for all text
+ SvUShortsSort aAttribs;
+ aAttribs.Insert( nWhichId );
+ rWrtSh.ResetAttr( &aAttribs );
+
+ rWrtSh.Pop( FALSE );
+ rWrtSh.LockView( FALSE );
+ rWrtSh.EndAction();
+ }
+}
+
+/*---------------------------------------------------------------------------
+ Beschreibung: String fuer die Seitenanzeige in der Statusbar basteln.
+ ----------------------------------------------------------------------------*/
+
+String SwView::GetPageStr( USHORT nPg, USHORT nLogPg,
+ const String& rDisplay )
+{
+ String aStr( aPageStr );
+ if( rDisplay.Len() )
+ aStr += rDisplay;
+ else
+ aStr += String::CreateFromInt32(nLogPg);
+
+ if( nLogPg && nLogPg != nPg )
+ {
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" "));
+ aStr += String::CreateFromInt32(nPg);
+ }
+ aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" / "));
+ aStr += String::CreateFromInt32( GetWrtShell().GetPageCnt() );
+
+ return aStr;
+}
+
+
+int SwView::InsertGraphic( const String &rPath, const String &rFilter,
+ BOOL bLink, GraphicFilter *pFlt,
+ Graphic* pPreviewGrf, BOOL bRule )
+{
+ SwWait aWait( *GetDocShell(), TRUE );
+
+ Graphic aGrf;
+ int nRes = GRFILTER_OK;
+ if ( pPreviewGrf )
+ aGrf = *pPreviewGrf;
+ else
+ {
+ if( !pFlt )
+ pFlt = GraphicFilter::GetGraphicFilter();
+ nRes = GraphicFilter::LoadGraphic( rPath, rFilter, aGrf, pFlt /*, nFilter*/ );
+ }
+
+ if( GRFILTER_OK == nRes )
+ {
+ SwFlyFrmAttrMgr aFrmMgr( TRUE, GetWrtShellPtr(), FRMMGR_TYPE_GRF );
+
+ SwWrtShell &rSh = GetWrtShell();
+ rSh.StartAction();
+ if( bLink )
+ {
+ SwDocShell* pDocSh = GetDocShell();
+ INetURLObject aTemp(
+ pDocSh->HasName() ?
+ pDocSh->GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) :
+ rtl::OUString());
+
+ String sURL = URIHelper::SmartRel2Abs(
+ aTemp, rPath, URIHelper::GetMaybeFileHdl() );
+
+ rSh.Insert( sURL,
+ rFilter, aGrf, &aFrmMgr, bRule );
+ }
+ else
+ rSh.Insert( aEmptyStr, aEmptyStr, aGrf, &aFrmMgr );
+ // nach dem EndAction ist es zu spaet, weil die Shell dann schon zerstoert sein kann
+ rSh.EndAction();
+ }
+ return nRes;
+}
+
+
+BOOL SwView::InsertGraphicDlg( SfxRequest& rReq )
+{
+#ifndef ENABLE_PROP_WITHOUTLINK
+#define ENABLE_PROP_WITHOUTLINK 0x08
+#endif
+
+ BOOL bReturn = FALSE;
+ SwDocShell* pDocShell = GetDocShell();
+ USHORT nHtmlMode = ::GetHtmlMode(pDocShell);
+ // im HTML-Mode nur verknuepft einfuegen
+ FileDialogHelper* pFileDlg = new FileDialogHelper( SFXWB_GRAPHIC | SFXWB_SHOWSTYLES );
+ pFileDlg->SetTitle(SW_RESSTR(STR_INSERT_GRAPHIC ));
+ pFileDlg->SetContext( FileDialogHelper::SW_INSERT_GRAPHIC );
+ uno::Reference < XFilePicker > xFP = pFileDlg->GetFilePicker();
+ uno::Reference < XFilePickerControlAccess > xCtrlAcc(xFP, UNO_QUERY);
+ if(nHtmlMode & HTMLMODE_ON)
+ {
+ sal_Bool bTrue = sal_True;
+ Any aVal(&bTrue, ::getBooleanCppuType());
+ xCtrlAcc->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, aVal);
+ xCtrlAcc->enableControl( ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False);
+ }
+
+ SvStringsSortDtor aFormats;
+ SwDoc* pDoc = pDocShell->GetDoc();
+ const USHORT nArrLen = pDoc->GetFrmFmts()->Count();
+ USHORT i;
+ for( i = 0; i < nArrLen; i++ )
+ {
+ SwFrmFmt* pFmt = (*pDoc->GetFrmFmts())[ i ];
+ if(pFmt->IsDefault() || pFmt->IsAuto())
+ continue;
+ String *pFormat = new String(pFmt->GetName());
+ aFormats.Insert(pFormat);
+ }
+
+ // pool formats
+ //
+ const SvStringsDtor& rFrmPoolArr = SwStyleNameMapper::GetFrmFmtUINameArray();
+ for( i = 0; i < rFrmPoolArr.Count(); i++ )
+ {
+ String *pFormat = new String(*rFrmPoolArr[i]);
+ if (!aFormats.Insert(pFormat))
+ delete pFormat;
+ }
+
+ Sequence<OUString> aListBoxEntries(aFormats.Count());
+ OUString* pEntries = aListBoxEntries.getArray();
+ sal_Int16 nSelect = 0;
+ String sGraphicFormat = SW_RESSTR(STR_POOLFRM_GRAPHIC);
+ for(i = 0; i < aFormats.Count(); ++i)
+ {
+ pEntries[i] = *aFormats[i];
+ if(pEntries[i].equals(sGraphicFormat))
+ nSelect = i;
+ }
+ try
+ {
+ Any aTemplates(&aListBoxEntries, ::getCppuType(&aListBoxEntries));
+
+ xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
+ ListboxControlActions::ADD_ITEMS , aTemplates );
+
+ Any aSelectPos(&nSelect, ::getCppuType(&nSelect));
+ xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
+ ListboxControlActions::SET_SELECT_ITEM, aSelectPos );
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("control acces failed");
+ }
+
+ SFX_REQUEST_ARG( rReq, pName, SfxStringItem, SID_INSERT_GRAPHIC , sal_False );
+ BOOL bShowError = !pName;
+ if( pName || ERRCODE_NONE == pFileDlg->Execute() )
+ {
+
+ String aFileName, aFilterName;
+ if ( pName )
+ {
+ aFileName = pName->GetValue();
+ SFX_REQUEST_ARG( rReq, pFilter, SfxStringItem, FN_PARAM_FILTER , sal_False );
+ if ( pFilter )
+ aFilterName = pFilter->GetValue();
+ }
+ else
+ {
+ aFileName = pFileDlg->GetPath();
+ aFilterName = pFileDlg->GetCurrentFilter();
+ rReq.AppendItem( SfxStringItem( SID_INSERT_GRAPHIC, aFileName ) );
+ rReq.AppendItem( SfxStringItem( FN_PARAM_FILTER, aFilterName ) );
+
+ sal_Bool bAsLink = sal_False;
+ if(nHtmlMode & HTMLMODE_ON)
+ bAsLink = sal_True;
+ else
+ {
+ try
+ {
+ Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0);
+ DBG_ASSERT(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found");
+ bAsLink = aVal.hasValue() ? *(sal_Bool*) aVal.getValue() : sal_True;
+ Any aTemplateValue = xCtrlAcc->getValue(
+ ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
+ ListboxControlActions::GET_SELECTED_ITEM );
+ OUString sTmpl;
+ aTemplateValue >>= sTmpl;
+ rReq.AppendItem( SfxStringItem( FN_PARAM_2, sTmpl) );
+ }
+ catch(Exception& )
+ {
+ DBG_ERROR("control acces failed");
+ }
+ }
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bAsLink ) );
+ }
+
+ SFX_REQUEST_ARG( rReq, pAsLink, SfxBoolItem, FN_PARAM_1 , sal_False );
+ SFX_REQUEST_ARG( rReq, pStyle, SfxStringItem, FN_PARAM_2 , sal_False );
+
+ sal_Bool bAsLink = sal_False;
+ if( nHtmlMode & HTMLMODE_ON )
+ bAsLink = sal_True;
+ else
+ {
+ if ( rReq.GetArgs() )
+ {
+ if ( pAsLink )
+ bAsLink = pAsLink->GetValue();
+ if ( pStyle && pStyle->GetValue().Len() )
+ sGraphicFormat = pStyle->GetValue();
+ }
+ else
+ {
+ Any aVal = xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0);
+ DBG_ASSERT(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found");
+ bAsLink = aVal.hasValue() ? *(sal_Bool*) aVal.getValue() : sal_True;
+ Any aTemplateValue = xCtrlAcc->getValue(
+ ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE,
+ ListboxControlActions::GET_SELECTED_ITEM );
+ OUString sTmpl;
+ aTemplateValue >>= sTmpl;
+ if( sTmpl.getLength() )
+ sGraphicFormat = sTmpl;
+ rReq.AppendItem( SfxStringItem( FN_PARAM_2, sGraphicFormat ) );
+ rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bAsLink ) );
+ }
+ }
+
+ SwWrtShell& rSh = GetWrtShell();
+ rSh.LockPaint();
+ rSh.StartAction();
+
+ /// #111827#
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, String(SW_RES(STR_GRAPHIC_DEFNAME)));
+
+ rSh.StartUndo(UNDO_INSERT, &aRewriter);
+
+ int nError = InsertGraphic( aFileName, aFilterName, bAsLink, GraphicFilter::GetGraphicFilter() );
+
+ // Format ist ungleich Current Filter, jetzt mit auto. detection
+ if( nError == GRFILTER_FORMATERROR )
+ nError = InsertGraphic( aFileName, aEmptyStr, bAsLink, GraphicFilter::GetGraphicFilter() );
+ if ( rSh.IsFrmSelected() )
+ {
+ SwFrmFmt* pFmt = pDoc->FindFrmFmtByName( sGraphicFormat );
+ if(!pFmt)
+ pFmt = pDoc->MakeFrmFmt(sGraphicFormat,
+ pDocShell->GetDoc()->GetDfltFrmFmt(),
+ TRUE, FALSE);
+ rSh.SetFrmFmt( pFmt );
+ }
+
+ RESOURCE_TYPE nResId = 0;
+ switch( nError )
+ {
+ case GRFILTER_OPENERROR:
+ nResId = STR_GRFILTER_OPENERROR;
+ break;
+ case GRFILTER_IOERROR:
+ nResId = STR_GRFILTER_IOERROR;
+ break;
+ case GRFILTER_FORMATERROR:
+ nResId = STR_GRFILTER_FORMATERROR;
+ break;
+ case GRFILTER_VERSIONERROR:
+ nResId = STR_GRFILTER_VERSIONERROR;
+ break;
+ case GRFILTER_FILTERERROR:
+ nResId = STR_GRFILTER_FILTERERROR;
+ break;
+ case GRFILTER_TOOBIG:
+ nResId = STR_GRFILTER_TOOBIG;
+ break;
+ }
+
+ rSh.EndAction();
+ rSh.UnlockPaint();
+ if( nResId )
+ {
+ if( bShowError )
+ {
+ InfoBox aInfoBox( GetWindow(), SW_RESSTR( nResId ));
+ aInfoBox.Execute();
+ }
+ rReq.Ignore();
+ }
+ else
+ {
+ // set the specific graphic attrbutes to the graphic
+ bReturn = TRUE;
+ AutoCaption( GRAPHIC_CAP );
+ rReq.Done();
+ }
+
+ rSh.EndUndo(); // due to possible change of Shell
+ }
+
+ delete pFileDlg;
+
+ return bReturn;
+}
+
+
+void __EXPORT SwView::Execute(SfxRequest &rReq)
+{
+ USHORT nSlot = rReq.GetSlot();
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+ BOOL bIgnore = FALSE;
+ switch( nSlot )
+ {
+ case SID_CREATE_SW_DRAWVIEW:
+ // --> OD 2005-08-08 #i52858# - method name changed
+ pWrtShell->getIDocumentDrawModelAccess()->GetOrCreateDrawModel();
+ // <--
+ break;
+
+ case FN_LINE_NUMBERING_DLG:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ VclAbstractDialog* pDlg = pFact->CreateVclSwViewDialog( DLG_LINE_NUMBERING, *this);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ pDlg->Execute();
+ delete pDlg;
+ break;
+ }
+ case FN_EDIT_LINK_DLG:
+ EditLinkDlg();
+ break;
+ case FN_REFRESH_VIEW:
+ GetEditWin().Invalidate();
+ break;
+ case FN_PAGEUP:
+ case FN_PAGEUP_SEL:
+ case FN_PAGEDOWN:
+ case FN_PAGEDOWN_SEL:
+ {
+ Rectangle aVis( GetVisArea() );
+ SwEditWin& rTmpWin = GetEditWin();
+ if ( FN_PAGEUP == nSlot || FN_PAGEUP_SEL == nSlot )
+ PageUpCrsr(FN_PAGEUP_SEL == nSlot);
+ else
+ PageDownCrsr(FN_PAGEDOWN_SEL == nSlot);
+
+ rReq.SetReturnValue(SfxBoolItem(nSlot,
+ aVis != GetVisArea()));
+ //#i42732# - notify the edit window that from now on we do not use the input language
+ rTmpWin.SetUseInputLanguage( sal_False );
+ }
+ break;
+ case FN_REDLINE_ON:
+ {
+ if( pArgs &&
+ SFX_ITEM_SET == pArgs->GetItemState(nSlot, FALSE, &pItem ))
+ {
+ IDocumentRedlineAccess* pIDRA = pWrtShell->getIDocumentRedlineAccess();
+ Sequence <sal_Int8> aPasswd = pIDRA->GetRedlinePassword();
+ if( aPasswd.getLength() )
+ {
+ DBG_ASSERT( !((const SfxBoolItem*)pItem)->GetValue(), "SwView::Execute(): password set an redlining off doesn't match!" );
+ // xmlsec05: new password dialog
+ Window* pParent;
+ const SfxPoolItem* pParentItem;
+ if( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_XWINDOW, FALSE, &pParentItem ) )
+ pParent = ( ( const XWindowItem* ) pParentItem )->GetWindowPtr();
+ else
+ pParent = &GetViewFrame()->GetWindow();
+ SfxPasswordDialog aPasswdDlg( pParent );
+ aPasswdDlg.SetMinLen( 1 );
+ //#i69751# the result of Execute() can be ignored
+ aPasswdDlg.Execute();
+ String sNewPasswd( aPasswdDlg.GetPassword() );
+ Sequence <sal_Int8> aNewPasswd = pIDRA->GetRedlinePassword();
+ SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
+ if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd))
+ pIDRA->SetRedlinePassword(Sequence <sal_Int8> ());
+ else
+ { // xmlsec05: message box for wrong password
+ break;
+ }
+ }
+
+ USHORT nOn = ((const SfxBoolItem*)pItem)->GetValue() ? nsRedlineMode_t::REDLINE_ON : 0;
+ USHORT nMode = pWrtShell->GetRedlineMode();
+ pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn);
+ }
+ }
+ break;
+ case FN_REDLINE_PROTECT :
+ {
+ IDocumentRedlineAccess* pIDRA = pWrtShell->getIDocumentRedlineAccess();
+ Sequence <sal_Int8> aPasswd = pIDRA->GetRedlinePassword();
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(nSlot, FALSE, &pItem )
+ && ((SfxBoolItem*)pItem)->GetValue() == ( aPasswd.getLength() != 0 ) )
+ break;
+
+ // xmlsec05: new password dialog
+ // message box for wrong password
+ Window* pParent;
+ const SfxPoolItem* pParentItem;
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_XWINDOW, FALSE, &pParentItem ) )
+ pParent = ( ( const XWindowItem* ) pParentItem )->GetWindowPtr();
+ else
+ pParent = &GetViewFrame()->GetWindow();
+ SfxPasswordDialog aPasswdDlg( pParent );
+ aPasswdDlg.SetMinLen( 1 );
+ if(!aPasswd.getLength())
+ aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM);
+ if (aPasswdDlg.Execute())
+ {
+ USHORT nOn = nsRedlineMode_t::REDLINE_ON;
+ String sNewPasswd( aPasswdDlg.GetPassword() );
+ Sequence <sal_Int8> aNewPasswd =
+ pIDRA->GetRedlinePassword();
+ SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd );
+ if(!aPasswd.getLength())
+ {
+ pIDRA->SetRedlinePassword(aNewPasswd);
+ }
+ else if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd))
+ {
+ pIDRA->SetRedlinePassword(Sequence <sal_Int8> ());
+ nOn = 0;
+ }
+ USHORT nMode = pIDRA->GetRedlineMode();
+ pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn);
+ rReq.AppendItem( SfxBoolItem( FN_REDLINE_PROTECT, ((nMode&nsRedlineMode_t::REDLINE_ON)==0) ) );
+ }
+ else
+ bIgnore = TRUE;
+ }
+ break;
+ case FN_REDLINE_SHOW:
+
+ if( pArgs &&
+ SFX_ITEM_SET == pArgs->GetItemState(nSlot, FALSE, &pItem))
+ {
+ USHORT nMode = ( ~(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)
+ & pWrtShell->GetRedlineMode() ) | nsRedlineMode_t::REDLINE_SHOW_INSERT;
+ if( ((const SfxBoolItem*)pItem)->GetValue() )
+ nMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE;
+
+ pWrtShell->SetRedlineModeAndCheckInsMode( nMode );
+ }
+ break;
+ case FN_MAILMERGE_SENDMAIL_CHILDWINDOW:
+ case FN_REDLINE_ACCEPT:
+ GetViewFrame()->ToggleChildWindow(nSlot);
+ break;
+ case FN_REDLINE_ACCEPT_DIRECT:
+ case FN_REDLINE_REJECT_DIRECT:
+ {
+ SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE );
+ Point aCrsrPos = pWrtShell->GetCrsrDocPos( sal_True );
+ if( pWrtShell->GetContentAtPos( aCrsrPos, aCntntAtPos ) )
+ {
+ USHORT nCount = pWrtShell->GetRedlineCount();
+ for( USHORT nRedline = 0; nRedline < nCount; ++nRedline )
+ {
+ const SwRedline& rRedline = pWrtShell->GetRedline( nRedline );
+ if( *aCntntAtPos.aFnd.pRedl == rRedline )
+ {
+ if( FN_REDLINE_ACCEPT_DIRECT == nSlot )
+ pWrtShell->AcceptRedline( nRedline );
+ else
+ pWrtShell->RejectRedline( nRedline );
+ break;
+ }
+ }
+ }
+ }
+ break;
+ case SID_DOCUMENT_COMPARE:
+ case SID_DOCUMENT_MERGE:
+ {
+ String sFileName, sFilterName;
+ INT16 nVersion = 0;
+ bool bHasFileName = false;
+ pViewImpl->SetParam( 0 );
+
+ if( pArgs )
+ {
+ if( SFX_ITEM_SET == pArgs->GetItemState( SID_FILE_NAME, FALSE, &pItem ))
+ sFileName = ((const SfxStringItem*)pItem)->GetValue();
+ bHasFileName = ( sFileName.Len() > 0 );
+
+ if( SFX_ITEM_SET == pArgs->GetItemState( SID_FILTER_NAME, FALSE, &pItem ))
+ sFilterName = ((const SfxStringItem*)pItem)->GetValue();
+
+ if( SFX_ITEM_SET == pArgs->GetItemState( SID_VERSION, FALSE, &pItem ))
+ {
+ nVersion = ((const SfxInt16Item *)pItem)->GetValue();
+ pViewImpl->SetParam( nVersion );
+ }
+ }
+
+ pViewImpl->InitRequest( rReq );
+ long nFound = InsertDoc( nSlot, sFileName, sFilterName, nVersion );
+
+ if ( bHasFileName )
+ {
+ rReq.SetReturnValue( SfxInt32Item( nSlot, nFound ));
+
+ if (nFound > 0) // Redline-Browser anzeigen
+ {
+ SfxViewFrame* pVFrame = GetViewFrame();
+ pVFrame->ShowChildWindow(FN_REDLINE_ACCEPT);
+
+ // RedlineDlg neu initialisieren
+ USHORT nId = SwRedlineAcceptChild::GetChildWindowId();
+ SwRedlineAcceptChild *pRed = (SwRedlineAcceptChild*)
+ pVFrame->GetChildWindow(nId);
+ if (pRed)
+ pRed->ReInitDlg(GetDocShell());
+ }
+ }
+ else
+ bIgnore = TRUE;
+ }
+ break;
+ case FN_SYNC_LABELS:
+ case FN_MAILMERGE_CHILDWINDOW:
+ GetViewFrame()->ShowChildWindow(nSlot, TRUE);
+ break;
+ case FN_ESCAPE:
+ {
+ if ( pWrtShell->HasDrawView() && pWrtShell->GetDrawView()->IsDragObj() )
+ {
+ pWrtShell->BreakDrag();
+ pWrtShell->EnterSelFrmMode();
+ }
+ else if ( pWrtShell->IsDrawCreate() )
+ {
+ GetDrawFuncPtr()->BreakCreate();
+ AttrChangedNotify(pWrtShell); // ggf Shellwechsel...
+ }
+ else if ( pWrtShell->HasSelection() || IsDrawMode() )
+ {
+ SdrView *pSdrView = pWrtShell->HasDrawView() ? pWrtShell->GetDrawView() : 0;
+ if(pSdrView && pSdrView->AreObjectsMarked() &&
+ pSdrView->GetHdlList().GetFocusHdl())
+ {
+ ((SdrHdlList&)pSdrView->GetHdlList()).ResetFocusHdl();
+ }
+ else
+ {
+ if(pSdrView)
+ {
+ LeaveDrawCreate();
+ Point aPt(LONG_MIN, LONG_MIN);
+ //go out of the frame
+ pWrtShell->SelectObj(aPt, SW_LEAVE_FRAME);
+ SfxBindings& rBind = GetViewFrame()->GetBindings();
+ rBind.Invalidate( SID_ATTR_SIZE );
+ }
+ pWrtShell->EnterStdMode();
+ AttrChangedNotify(pWrtShell); // ggf Shellwechsel...
+ }
+ }
+ else if ( GetEditWin().GetApplyTemplate() )
+ {
+ GetEditWin().SetApplyTemplate(SwApplyTemplate());
+ }
+ else if( ((SfxObjectShell*)GetDocShell())->IsInPlaceActive() )
+ {
+ Escape();
+ }
+ else if ( GetEditWin().IsChainMode() )
+ {
+ GetEditWin().SetChainMode( FALSE );
+ }
+ else if( pWrtShell->GetFlyFrmFmt() )
+ {
+ const SwFrmFmt* pFmt = pWrtShell->GetFlyFrmFmt();
+ if(pWrtShell->GotoFly( pFmt->GetName(), FLYCNTTYPE_FRM ))
+ {
+ pWrtShell->HideCrsr();
+ pWrtShell->EnterSelFrmMode();
+ }
+ }
+ else
+ {
+ SfxBoolItem aItem( SID_WIN_FULLSCREEN, FALSE );
+ GetViewFrame()->GetDispatcher()->Execute( SID_WIN_FULLSCREEN, SFX_CALLMODE_RECORD, &aItem, 0L );
+ bIgnore = TRUE;
+ }
+ }
+ break;
+ case SID_ATTR_BORDER_INNER:
+ case SID_ATTR_BORDER_OUTER:
+ case SID_ATTR_BORDER_SHADOW:
+ if(pArgs)
+ pWrtShell->SetAttr(*pArgs);
+ break;
+
+ case SID_ATTR_PAGE:
+ case SID_ATTR_PAGE_SIZE:
+ case SID_ATTR_PAGE_MAXSIZE:
+ case SID_ATTR_PAGE_PAPERBIN:
+ case SID_ATTR_PAGE_EXT1:
+ case FN_PARAM_FTN_INFO:
+ {
+ if(pArgs)
+ {
+ const USHORT nCurIdx = pWrtShell->GetCurPageDesc();
+ SwPageDesc aPageDesc( pWrtShell->GetPageDesc( nCurIdx ) );
+ ::ItemSetToPageDesc( *pArgs, aPageDesc );
+ // Den Descriptor der Core veraendern.
+ pWrtShell->ChgPageDesc( nCurIdx, aPageDesc );
+ }
+ }
+ break;
+ case FN_NAVIGATION_PI_GOTO_PAGE:
+ {
+ SfxViewFrame* pVFrame = GetViewFrame();
+ SfxChildWindow* pCh = pVFrame->GetChildWindow( SID_NAVIGATOR );
+ if(!pCh)
+ {
+ pVFrame->ToggleChildWindow( SID_NAVIGATOR );
+ pCh = pVFrame->GetChildWindow( SID_NAVIGATOR );
+
+ }
+ ((SwNavigationPI*) pCh->GetContextWindow(SW_MOD()))->GotoPage();
+ }
+ break;
+ case FN_EDIT_CURRENT_TOX:
+ {
+ GetViewFrame()->GetDispatcher()->Execute(
+ FN_INSERT_MULTI_TOX, SFX_CALLMODE_ASYNCHRON);
+ }
+ break;
+ case FN_UPDATE_CUR_TOX:
+ {
+ const SwTOXBase* pBase = pWrtShell->GetCurTOX();
+ if(pBase)
+ {
+ pWrtShell->StartAction();
+ if(TOX_INDEX == pBase->GetType())
+ pWrtShell->ApplyAutoMark();
+ pWrtShell->UpdateTableOf( *pBase );
+ pWrtShell->EndAction();
+ }
+ }
+ break;
+ case FN_UPDATE_TOX:
+ {
+ pWrtShell->StartAction();
+ pWrtShell->EnterStdMode();
+ BOOL bOldCrsrInReadOnly = pWrtShell->IsReadOnlyAvailable();
+ pWrtShell->SetReadOnlyAvailable( TRUE );
+
+ for( USHORT i = 0; i < 2; ++i )
+ {
+ USHORT nCount = pWrtShell->GetTOXCount();
+ if( 1 == nCount )
+ ++i;
+
+ while( pWrtShell->GotoPrevTOXBase() )
+ ; // aufs erste Verzeichnis springen
+
+ // falls wir nicht mehr in einem stehen, dann zum naechsten
+ // springen.
+ const SwTOXBase* pBase = pWrtShell->GetCurTOX();
+ if( !pBase )
+ {
+ pWrtShell->GotoNextTOXBase();
+ pBase = pWrtShell->GetCurTOX();
+ }
+
+ BOOL bAutoMarkApplied = FALSE;
+ while( pBase )
+ {
+ if(TOX_INDEX == pBase->GetType() && !bAutoMarkApplied)
+ {
+ pWrtShell->ApplyAutoMark();
+ bAutoMarkApplied = TRUE;
+ }
+ // JP 15.07.96: das pBase wird nur fuer die Schnittstelle
+ // benoetigt. Muss mal umgetstellt werden!!!
+ pWrtShell->UpdateTableOf( *pBase );
+
+ if( pWrtShell->GotoNextTOXBase() )
+ pBase = pWrtShell->GetCurTOX();
+ else
+ pBase = 0;
+ }
+ }
+ pWrtShell->SetReadOnlyAvailable( bOldCrsrInReadOnly );
+ pWrtShell->EndAction();
+ }
+ break;
+ case SID_ATTR_BRUSH:
+ {
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(RES_BACKGROUND, FALSE, &pItem))
+ {
+ const USHORT nCurIdx = pWrtShell->GetCurPageDesc();
+ SwPageDesc aDesc( pWrtShell->GetPageDesc( nCurIdx ));
+ SwFrmFmt& rMaster = aDesc.GetMaster();
+ rMaster.SetFmtAttr(*pItem);
+ pWrtShell->ChgPageDesc( nCurIdx, aDesc);
+ }
+ }
+ break;
+ case SID_CLEARHISTORY:
+ {
+ pWrtShell->DelAllUndoObj();
+ }
+ break;
+ case SID_UNDO:
+ {
+ pShell->ExecuteSlot(rReq);
+ }
+ break;
+ case FN_INSERT_CTRL:
+ case FN_INSERT_OBJ_CTRL:
+ {
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(nSlot, FALSE, &pItem))
+ {
+ USHORT nValue = ((SfxUInt16Item*)pItem)->GetValue();
+ switch ( nSlot )
+ {
+ case FN_INSERT_CTRL:
+ {
+ BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
+ if(bWeb)
+ SwView::nWebInsertCtrlState = nValue;
+ else
+ SwView::nInsertCtrlState = nValue;
+ }
+ break;
+ case FN_INSERT_OBJ_CTRL: SwView::nInsertObjectCtrlState = nValue ;break;
+ }
+
+ }
+ GetViewFrame()->GetBindings().Invalidate( nSlot );
+ }
+ break;
+#if defined WNT || defined UNX
+ case SID_TWAIN_SELECT:
+ case SID_TWAIN_TRANSFER:
+ GetViewImpl()->ExecuteScan( rReq );
+ break;
+#endif
+
+ case SID_ATTR_DEFTABSTOP:
+ {
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_DEFTABSTOP, FALSE, &pItem))
+ {
+ SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
+ USHORT nTab = ((const SfxUInt16Item*)pItem)->GetValue();
+ MakeDefTabs( nTab, aDefTabs );
+ pWrtShell->SetDefault( aDefTabs );
+ }
+ }
+ break;
+ case SID_ATTR_LANGUAGE :
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_LANGUAGE, FALSE, &pItem))
+ {
+ SvxLanguageItem aLang(((SvxLanguageItem*)pItem)->GetLanguage(), RES_CHRATR_LANGUAGE);
+ pWrtShell->SetDefault( aLang );
+ lcl_SetAllTextToDefaultLanguage( *pWrtShell, RES_CHRATR_LANGUAGE );
+ }
+ break;
+ case SID_ATTR_CHAR_CTL_LANGUAGE:
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(RES_CHRATR_CTL_LANGUAGE, FALSE, &pItem))
+ {
+ pWrtShell->SetDefault( *pItem );
+ lcl_SetAllTextToDefaultLanguage( *pWrtShell, RES_CHRATR_CTL_LANGUAGE );
+ }
+ break;
+ case SID_ATTR_CHAR_CJK_LANGUAGE:
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(RES_CHRATR_CJK_LANGUAGE, FALSE, &pItem))
+ {
+ pWrtShell->SetDefault( *pItem );
+ lcl_SetAllTextToDefaultLanguage( *pWrtShell, RES_CHRATR_CJK_LANGUAGE );
+ }
+ break;
+ case FN_SCROLL_NEXT_PREV:
+ if(pArgs && pArgs->GetItemState(FN_SCROLL_NEXT_PREV, FALSE, &pItem))
+ {
+ // call the handlers of PageUp/DownButtons, only
+ bool* pbNext = new bool ( ((const SfxBoolItem*)pItem)->GetValue() );
+ // #i75416# move the execution of the search to an asynchronously called static link
+ Application::PostUserEvent( STATIC_LINK(this, SwView, MoveNavigationHdl), pbNext );
+ }
+ break;
+ case SID_JUMPTOMARK:
+ if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_JUMPTOMARK, FALSE, &pItem))
+ JumpToSwMark( (( const SfxStringItem*)pItem)->GetValue() );
+ break;
+ case SID_GALLERY :
+ GetViewFrame()->ChildWindowExecute(rReq);//ToggleChildWindow(SID_GALLERY);
+ break;
+ case SID_AVMEDIA_PLAYER :
+ GetViewFrame()->ChildWindowExecute(rReq);//ToggleChildWindow(SID_AVMEDIA_PLAYER);
+ break;
+ case SID_VIEW_DATA_SOURCE_BROWSER:
+ {
+ SfxViewFrame* pVFrame = GetViewFrame();
+ pVFrame->ChildWindowExecute(rReq);
+ if(pVFrame->HasChildWindow(SID_BROWSER))
+ {
+ const SwDBData& rData = GetWrtShell().GetDBDesc();
+ SW_MOD()->ShowDBObj(*this, rData, FALSE);
+ }
+ }
+ break;
+ case FN_INSERT_FIELD_DATA_ONLY :
+ {
+ BOOL bShow = FALSE;
+ if( pArgs &&
+ SFX_ITEM_SET == pArgs->GetItemState(nSlot, FALSE, &pItem ))
+ bShow = ((const SfxBoolItem*)pItem)->GetValue();
+ //GetViewFrame()->ShowChildWindow(nSlot, bShow && bInMailMerge);
+ if((bShow && bInMailMerge) != GetViewFrame()->HasChildWindow(nSlot))
+ GetViewFrame()->ToggleChildWindow(nSlot);
+ //if fields have been succesfully inserted call the "real"
+ //mail merge dialog
+ SwWrtShell &rSh = GetWrtShell();
+ if(bInMailMerge && rSh.IsAnyDatabaseFieldInDoc())
+ {
+ SwNewDBMgr* pNewDBMgr = rSh.GetNewDBMgr();
+ if (pNewDBMgr)
+ {
+ SwDBData aData;
+ aData = rSh.GetDBData();
+ rSh.EnterStdMode(); // Wechsel in Textshell erzwingen; ist fuer
+ // das Mischen von DB-Feldern notwendig.
+ AttrChangedNotify( &rSh );
+ pNewDBMgr->SetMergeType( DBMGR_MERGE );
+
+ Sequence<PropertyValue> aProperties(3);
+ PropertyValue* pValues = aProperties.getArray();
+ pValues[0].Name = C2U("DataSourceName");
+ pValues[1].Name = C2U("Command");
+ pValues[2].Name = C2U("CommandType");
+ pValues[0].Value <<= aData.sDataSource;
+ pValues[1].Value <<= aData.sCommand;
+ pValues[2].Value <<= aData.nCommandType;
+ pNewDBMgr->ExecuteFormLetter(rSh, aProperties, TRUE);
+ }
+ }
+ bInMailMerge &= bShow;
+ GetViewFrame()->GetBindings().Invalidate(FN_INSERT_FIELD);
+ }
+ break;
+ case FN_QRY_MERGE:
+ {
+ BOOL bUseCurrentDocument = TRUE;
+ BOOL bQuery = !pArgs||SFX_ITEM_SET != pArgs->GetItemState(nSlot);
+ if(bQuery)
+ {
+ SfxViewFrame* pTmpFrame = GetViewFrame();
+ SfxHelp::OpenHelpAgent( &pTmpFrame->GetFrame(), HID_MAIL_MERGE_SELECT );
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractMailMergeCreateFromDlg* pDlg = pFact->CreateMailMergeCreateFromDlg( DLG_MERGE_CREATE,
+ &pTmpFrame->GetWindow());
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if(RET_OK == pDlg->Execute())
+ bUseCurrentDocument = pDlg->IsThisDocument();
+ else
+ break;
+ }
+ GenerateFormLetter(bUseCurrentDocument);
+ }
+ break;
+ case SID_RECHECK_DOCUMENT:
+ {
+ SwDocShell* pDocShell = GetDocShell();
+ SwDoc* pDoc = pDocShell->GetDoc();
+ uno::Reference< linguistic2::XProofreadingIterator > xGCIterator( pDoc->GetGCIterator() );
+ if( xGCIterator.is() )
+ {
+ xGCIterator->resetIgnoreRules();
+ }
+ // reset ignore lists
+ pDoc->SpellItAgainSam( sal_True, sal_False, sal_False );
+ // clear ignore dictionary
+ uno::Reference< linguistic2::XDictionary > xDictionary( SvxGetIgnoreAllList(), uno::UNO_QUERY );
+ if( xDictionary.is() )
+ xDictionary->clear();
+ // put cursor to the start of the document
+ pWrtShell->SttDoc();
+ }
+ // no break; - but call spell/grammar dialog
+ case FN_SPELL_GRAMMAR_DIALOG:
+ {
+ SfxViewFrame* pViewFrame = GetViewFrame();
+ if (rReq.GetArgs() != NULL)
+ pViewFrame->SetChildWindow (FN_SPELL_GRAMMAR_DIALOG,
+ ((const SfxBoolItem&) (rReq.GetArgs()->
+ Get(FN_SPELL_GRAMMAR_DIALOG))).GetValue());
+ else
+ pViewFrame->ToggleChildWindow(FN_SPELL_GRAMMAR_DIALOG);
+
+ pViewFrame->GetBindings().Invalidate(FN_SPELL_GRAMMAR_DIALOG);
+ rReq.Ignore ();
+ }
+ break;
+ case SID_ALIGN_ANY_LEFT :
+ case SID_ALIGN_ANY_HCENTER :
+ case SID_ALIGN_ANY_RIGHT :
+ case SID_ALIGN_ANY_JUSTIFIED:
+ case SID_ALIGN_ANY_TOP :
+ case SID_ALIGN_ANY_VCENTER :
+ case SID_ALIGN_ANY_BOTTOM :
+ case SID_ALIGN_ANY_HDEFAULT :
+ case SID_ALIGN_ANY_VDEFAULT :
+ {
+ USHORT nAlias = 0;
+ if( nSelectionType & (nsSelectionType::SEL_DRW_TXT|nsSelectionType::SEL_TXT) )
+ {
+ switch( nSlot )
+ {
+ case SID_ALIGN_ANY_LEFT : nAlias = SID_ATTR_PARA_ADJUST_LEFT; break;
+ case SID_ALIGN_ANY_HCENTER : nAlias = SID_ATTR_PARA_ADJUST_CENTER; break;
+ case SID_ALIGN_ANY_RIGHT : nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break;
+ case SID_ALIGN_ANY_JUSTIFIED: nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break;
+ case SID_ALIGN_ANY_TOP : nAlias = FN_TABLE_VERT_NONE; break;
+ case SID_ALIGN_ANY_VCENTER : nAlias = FN_TABLE_VERT_CENTER; break;
+ case SID_ALIGN_ANY_BOTTOM : nAlias = FN_TABLE_VERT_BOTTOM; break;
+ }
+ }
+ else
+ {
+ switch( nSlot )
+ {
+ case SID_ALIGN_ANY_LEFT : nAlias = SID_OBJECT_ALIGN_LEFT ; break;
+ case SID_ALIGN_ANY_HCENTER : nAlias = SID_OBJECT_ALIGN_CENTER ; break;
+ case SID_ALIGN_ANY_RIGHT : nAlias = SID_OBJECT_ALIGN_RIGHT ; break;
+ case SID_ALIGN_ANY_TOP : nAlias = SID_OBJECT_ALIGN_UP ; break;
+ case SID_ALIGN_ANY_VCENTER : nAlias = SID_OBJECT_ALIGN_MIDDLE ; break;
+ case SID_ALIGN_ANY_BOTTOM : nAlias = SID_OBJECT_ALIGN_DOWN ; break;
+ }
+ }
+ //special handling for the draw shell
+ if(nAlias && (nSelectionType & (nsSelectionType::SEL_DRW)))
+ {
+ SfxAllEnumItem aEnumItem(SID_OBJECT_ALIGN, nAlias - SID_OBJECT_ALIGN_LEFT);
+ GetViewFrame()->GetDispatcher()->Execute(
+ SID_OBJECT_ALIGN, SFX_CALLMODE_ASYNCHRON, &aEnumItem, 0L);
+ }
+ else if(nAlias)
+ //these slots are either re-mapped to text or object alignment
+ GetViewFrame()->GetDispatcher()->Execute(
+ nAlias, SFX_CALLMODE_ASYNCHRON);
+ }
+ break;
+ case SID_RESTORE_EDITING_VIEW:
+ {
+ //#i33307# restore editing position
+ Point aCrsrPos;
+ bool bSelectObj;
+ if(pViewImpl->GetRestorePosition(aCrsrPos, bSelectObj))
+ {
+ pWrtShell->SwCrsrShell::SetCrsr( aCrsrPos, !bSelectObj );
+ if( bSelectObj )
+ {
+ pWrtShell->SelectObj( aCrsrPos );
+ pWrtShell->EnterSelFrmMode( &aCrsrPos );
+ }
+ }
+ }
+ break;
+ case SID_INSERT_GRAPHIC:
+ {
+ rReq.SetReturnValue(SfxBoolItem(nSlot, InsertGraphicDlg( rReq )));
+ }
+ break;
+
+
+ default:
+ ASSERT(!this, falscher Dispatcher);
+ return;
+ }
+ if(!bIgnore)
+ rReq.Done();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: SeitenNr-Feld invalidieren
+ --------------------------------------------------------------------*/
+
+void SwView::UpdatePageNums(USHORT nPhyNum, USHORT nVirtNum, const String& rPgStr)
+{
+ String sTemp(GetPageStr( nPhyNum, nVirtNum, rPgStr ));
+ const SfxStringItem aTmp( FN_STAT_PAGE, sTemp );
+ SfxBindings &rBnd = GetViewFrame()->GetBindings();
+ rBnd.SetState( aTmp );
+ rBnd.Update( FN_STAT_PAGE );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Status der Stauszeile
+ --------------------------------------------------------------------*/
+
+
+void SwView::StateStatusLine(SfxItemSet &rSet)
+{
+ SwWrtShell& rShell = GetWrtShell();
+
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+ ASSERT( nWhich, "leeres Set");
+
+ while( nWhich )
+ {
+ switch( nWhich )
+ {
+ case FN_STAT_PAGE:
+/*
+//JP 07.01.00: is a nice feature - show the selektion of DrawObjects
+ if( rShell.IsObjSelected()
+//??? || rShell.IsFrmSelected()
+ )
+ {
+ String sDisplay( rShell.GetDrawView()->GetMarkedObjectList().
+ GetDescriptionOfMarkedObjects() );
+ rSet.Put( SfxStringItem( FN_STAT_PAGE, sDisplay ));
+ }
+ else
+*/ {
+ // Anzahl der Seiten, log. SeitenNr. SeitenNr ermitteln
+ USHORT nPage, nLogPage;
+ String sDisplay;
+ rShell.GetPageNumber( -1, rShell.IsCrsrVisible(), nPage, nLogPage, sDisplay );
+ rSet.Put( SfxStringItem( FN_STAT_PAGE,
+ GetPageStr( nPage, nLogPage, sDisplay) ));
+
+ USHORT nCnt = GetWrtShell().GetPageCnt();
+ if (nPageCnt != nCnt) // Basic benachrichtigen
+ {
+ nPageCnt = nCnt;
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_PAGE_COUNT, SwDocShell::GetEventName(STR_SW_EVENT_PAGE_COUNT), GetViewFrame()->GetObjectShell()), FALSE);
+ }
+ }
+ break;
+ case FN_STAT_TEMPLATE:
+ {
+ rSet.Put(SfxStringItem( FN_STAT_TEMPLATE,
+ rShell.GetCurPageStyle(FALSE)));
+
+ }
+ break;
+ case SID_ATTR_ZOOM:
+ {
+ if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
+ {
+ const SwViewOption* pVOpt = rShell.GetViewOptions();
+ SvxZoomType eZoom = (SvxZoomType) pVOpt->GetZoomType();
+ SvxZoomItem aZoom(eZoom, pVOpt->GetZoom());
+ if(pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE))
+ {
+ aZoom.SetValueSet(
+ SVX_ZOOM_ENABLE_50|
+ SVX_ZOOM_ENABLE_75|
+ SVX_ZOOM_ENABLE_100|
+ SVX_ZOOM_ENABLE_150|
+ SVX_ZOOM_ENABLE_200);
+ }
+ rSet.Put( aZoom );
+ }
+ else
+ rSet.DisableItem( SID_ATTR_ZOOM );
+ }
+ break;
+ case SID_ATTR_VIEWLAYOUT:
+ {
+ if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
+ {
+ const SwViewOption* pVOpt = rShell.GetViewOptions();
+ const USHORT nColumns = pVOpt->GetViewLayoutColumns();
+ const bool bBookMode = pVOpt->IsViewLayoutBookMode();
+ SvxViewLayoutItem aViewLayout(nColumns, bBookMode);
+ rSet.Put( aViewLayout );
+ }
+ else
+ rSet.DisableItem( SID_ATTR_VIEWLAYOUT );
+ }
+ break;
+ case SID_ATTR_ZOOMSLIDER:
+ {
+ if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
+ {
+ const SwViewOption* pVOpt = rShell.GetViewOptions();
+ const USHORT nCurrentZoom = pVOpt->GetZoom();
+ SvxZoomSliderItem aZoomSliderItem( nCurrentZoom, MINZOOM, MAXZOOM );
+ aZoomSliderItem.AddSnappingPoint( 100 );
+
+ if ( !pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) )
+ {
+ const USHORT nColumns = pVOpt->GetViewLayoutColumns();
+ const bool bAutomaticViewLayout = 0 == nColumns;
+ const SwPostItMgr* pMgr = GetPostItMgr();
+
+ // snapping points:
+ // automatic mode: 1 Page, 2 Pages, 100%
+ // n Columns mode: n Pages, 100%
+ // n Columns book mode: nPages without gaps, 100%
+ const SwRect aPageRect( pWrtShell->GetAnyCurRect( RECT_PAGE_CALC ) );
+ const SwRect aRootRect( pWrtShell->GetAnyCurRect( RECT_PAGES_AREA ) ); // width of columns
+ Size aPageSize( aPageRect.SSize() );
+ aPageSize.Width() += pMgr->HasNotes() && pMgr->ShowNotes() ?
+ pMgr->GetSidebarWidth() + pMgr->GetSidebarBorderWidth() :
+ 0;
+
+ Size aRootSize( aRootRect.SSize() );
+
+ const MapMode aTmpMap( MAP_TWIP );
+ const Size& rEditSize = GetEditWin().GetOutputSizePixel();
+ const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) );
+
+ const long nOf = DOCUMENTBORDER * 2L;
+ long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
+ nTmpWidth += nOf;
+ aPageSize.Height() += nOf;
+ long nFac = aWindowSize.Width() * 100 / nTmpWidth;
+
+ long nVisPercent = aWindowSize.Height() * 100 / aPageSize.Height();
+ nFac = Min( nFac, nVisPercent );
+
+ aZoomSliderItem.AddSnappingPoint( nFac );
+
+ if ( bAutomaticViewLayout )
+ {
+ nTmpWidth += aPageSize.Width() + GAPBETWEENPAGES;
+ nFac = aWindowSize.Width() * 100 / nTmpWidth;
+ nFac = Min( nFac, nVisPercent );
+ aZoomSliderItem.AddSnappingPoint( nFac );
+ }
+ }
+
+ rSet.Put( aZoomSliderItem );
+ }
+ else
+ rSet.DisableItem( SID_ATTR_ZOOMSLIDER );
+ }
+ break;
+ case SID_ATTR_POSITION:
+ case SID_ATTR_SIZE:
+ {
+ if( !rShell.IsFrmSelected() && !rShell.IsObjSelected() )
+ SwBaseShell::_SetFrmMode( FLY_DRAG_END );
+ else
+ {
+ FlyMode eFrameMode = SwBaseShell::GetFrmMode();
+ if ( eFrameMode == FLY_DRAG_START || eFrameMode == FLY_DRAG )
+ {
+ if ( nWhich == SID_ATTR_POSITION )
+ rSet.Put( SfxPointItem( SID_ATTR_POSITION,
+ rShell.GetAnchorObjDiff()));
+ else
+ rSet.Put( SvxSizeItem( SID_ATTR_SIZE,
+ rShell.GetObjSize()));
+ }
+ }
+ }
+ break;
+ case SID_TABLE_CELL:
+
+ if( rShell.IsFrmSelected() || rShell.IsObjSelected() )
+ {
+ // #i39171# Don't put a SvxSizeItem into a slot which is defined as SfxStringItem.
+ // SvxPosSizeStatusBarControl no longer resets to empty display if only one slot
+ // has no item, so SID_TABLE_CELL can remain empty (the SvxSizeItem is supplied
+ // in SID_ATTR_SIZE).
+ }
+ else
+ {
+ String sStr;
+ if( rShell.IsCrsrInTbl() )
+ {
+ // table name + cell coordinate
+ sStr = rShell.GetTableFmt()->GetName();
+ sStr += ':';
+ sStr += rShell.GetBoxNms();
+ }
+ else
+ {
+ const SwSection* pCurrSect = rShell.GetCurrSection();
+ if( pCurrSect )
+ {
+ switch( pCurrSect->GetType() )
+ {
+ case TOX_HEADER_SECTION:
+ case TOX_CONTENT_SECTION:
+ {
+ const SwTOXBase* pTOX = pWrtShell->GetCurTOX();
+ if( pTOX )
+ sStr = pTOX->GetTOXName();
+ else
+ {
+ ASSERT( !this,
+ "was ist das fuer ein Verzeichnis?" );
+ sStr = pCurrSect->GetSectionName();
+ }
+ }
+ break;
+ default:
+ sStr = pCurrSect->GetSectionName();
+ break;
+ }
+ }
+ }
+
+ //#outline level, removed by zhaojianwei
+ //const SwNumRule* pNumRule = rShell.GetCurNumRule();
+ //if (pNumRule) // Cursor in Numerierung
+ //{
+ // BYTE nNumLevel = rShell.GetNumLevel();
+ // if( IsShowNum(nNumLevel) && MAXLEVEL >
+ // ( nNumLevel = GetRealLevel( nNumLevel )) )
+ // {
+ // if( sStr.Len() )
+ // sStr.AppendAscii(sStatusDelim);
+ // sStr += SW_RESSTR(STR_NUM_LEVEL);
+ // sStr += String::CreateFromInt32( nNumLevel + 1 );
+ // if(!pNumRule->IsAutoRule())
+ // {
+ // SfxItemSet aSet(GetPool(),
+ // RES_PARATR_NUMRULE, RES_PARATR_NUMRULE);
+ // rShell.GetCurAttr(aSet);
+ // /* const SfxPoolItem* pItem; */
+ // if(SFX_ITEM_AVAILABLE <=
+ // aSet.GetItemState(RES_PARATR_NUMRULE, TRUE
+ // /*, &pItem */ ))
+ // {
+ // const String& rNumStyle =
+ // ((const SfxStringItem &)
+ // aSet.Get(RES_PARATR_NUMRULE)).GetValue();
+ // /* #i5116# GetItemState does not necessarily
+ // change pItem */
+ // // ((const SfxStringItem*)pItem)->GetValue();
+ // if(rNumStyle.Len())
+ // {
+ // sStr.AppendAscii(sStatusDelim);
+ // sStr += rNumStyle;
+ // }
+ // }
+ // }
+ // }
+ //}//<-removed end ,zhaojianwei
+
+ //-->#outline level,added by zhaojianwei
+ const SwNumRule* pNumRule = rShell.GetCurNumRule();
+ const bool bOutlineNum = pNumRule ? pNumRule->IsOutlineRule() : 0;
+ //((SwTxtFmtColl*)rShell.GetCrsr()->GetNode()->GetTxtNode()->GetFmtColl())->IsAssignedToListLevelOfOutlineStyle();
+
+ if (pNumRule && !bOutlineNum ) // Cursor in Numerierung
+ {
+ BYTE nNumLevel = rShell.GetNumLevel();
+ // --> OD 2008-04-02 #refactorlists#
+// if( IsShowNum(nNumLevel) && MAXLEVEL >
+// ( nNumLevel = GetRealLevel( nNumLevel )) )
+ if ( nNumLevel < MAXLEVEL )
+ // <--
+ {
+ if(!pNumRule->IsAutoRule())
+ {
+ SfxItemSet aSet(GetPool(),
+ RES_PARATR_NUMRULE, RES_PARATR_NUMRULE);
+ rShell.GetCurAttr(aSet);
+ /* const SfxPoolItem* pItem; */
+ if(SFX_ITEM_AVAILABLE <=
+ aSet.GetItemState(RES_PARATR_NUMRULE, TRUE
+ /*, &pItem */ ))
+ {
+ const String& rNumStyle =
+ ((const SfxStringItem &)
+ aSet.Get(RES_PARATR_NUMRULE)).GetValue();
+ /* #i5116# GetItemState does not necessarily
+ change pItem */
+ // ((const SfxStringItem*)pItem)->GetValue();
+ if(rNumStyle.Len())
+ {
+ if( sStr.Len() )
+ sStr.AppendAscii(sStatusDelim);
+ sStr += rNumStyle;
+ }
+ }
+ }
+ if( sStr.Len() )
+ sStr.AppendAscii(sStatusDelim);
+ sStr += SW_RESSTR(STR_NUM_LEVEL);
+ sStr += String::CreateFromInt32( nNumLevel + 1 );
+
+ }
+ }
+ const int nOutlineLevel = rShell.GetCurrentParaOutlineLevel();
+ if( nOutlineLevel != 0 )
+ {
+ if( sStr.Len() )
+ sStr.AppendAscii(sStatusComma);
+ if( bOutlineNum )
+ {
+ sStr += SW_RESSTR(STR_OUTLINE_NUMBERING);
+ sStr.AppendAscii(sStatusDelim);
+ sStr += SW_RESSTR(STR_NUM_LEVEL);
+ }
+ else
+ sStr += SW_RESSTR(STR_NUM_OUTLINE);
+ sStr += String::CreateFromInt32( nOutlineLevel);
+ }
+ //<-end ,zhaojianwei
+
+ if( rShell.HasReadonlySel() )
+ {
+ if( sStr.Len() )
+ sStr.InsertAscii( sStatusDelim, 0 );
+ sStr.Insert( SW_RESSTR( STR_READONLY_SEL ), 0 );
+ }
+ if( sStr.Len() )
+ rSet.Put( SfxStringItem( SID_TABLE_CELL, sStr ));
+ }
+ break;
+ case FN_STAT_SELMODE:
+ {
+ if(rShell.IsStdMode())
+ rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 0));
+ else if(rShell.IsAddMode())
+ rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 2));
+ else if(rShell.IsBlockMode())
+ rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 3));
+ else
+ rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 1));
+ break;
+ }
+ case SID_ATTR_INSERT:
+ if( rShell.IsRedlineOn() )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ rSet.Put(SfxBoolItem(SID_ATTR_INSERT,rShell.IsInsMode()));
+ }
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Execute fuer die Stauszeile
+ --------------------------------------------------------------------*/
+
+
+void SwView::ExecuteStatusLine(SfxRequest &rReq)
+{
+ SwWrtShell &rSh = GetWrtShell();
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem=NULL;
+ BOOL bUp = FALSE;
+ USHORT nWhich = rReq.GetSlot();
+ switch( nWhich )
+ {
+ case FN_STAT_PAGE:
+ {
+ GetViewFrame()->GetDispatcher()->Execute( SID_NAVIGATOR,
+ SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
+ }
+ break;
+
+ case FN_STAT_BOOKMARK:
+ if ( pArgs )
+ {
+ if (SFX_ITEM_SET == pArgs->GetItemState( nWhich, TRUE, &pItem))
+ {
+ const IDocumentMarkAccess* pMarkAccess = rSh.getIDocumentMarkAccess();
+ const sal_Int32 nIdx = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+ if(nIdx < pMarkAccess->getBookmarksCount())
+ {
+ const IDocumentMarkAccess::const_iterator_t ppBookmark = rSh.getIDocumentMarkAccess()->getBookmarksBegin() + nIdx;
+ rSh.EnterStdMode();
+ rSh.GotoMark( ppBookmark->get() );
+ }
+ else
+ OSL_ENSURE(false,
+ "SwView::ExecuteStatusLine(..)"
+ " - Ignoring out of range bookmark index");
+ }
+ }
+ break;
+
+ case FN_STAT_TEMPLATE:
+ {
+ GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_PAGE_DLG,
+ SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
+ }
+ break;
+ case SID_ATTR_ZOOM:
+ {
+ if ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
+ {
+ const SfxItemSet *pSet = 0;
+ AbstractSvxZoomDialog *pDlg = 0;
+ if ( pArgs )
+ pSet = pArgs;
+ else
+ {
+ const SwViewOption& rViewOptions = *rSh.GetViewOptions();
+ SfxItemSet aCoreSet(pShell->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM, SID_ATTR_VIEWLAYOUT, SID_ATTR_VIEWLAYOUT, 0 );
+ SvxZoomItem aZoom( (SvxZoomType)rViewOptions.GetZoomType(), rViewOptions.GetZoom() );
+
+ const bool bBrowseMode = rSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE);
+ if( bBrowseMode )
+ {
+ aZoom.SetValueSet(
+ SVX_ZOOM_ENABLE_50|
+ SVX_ZOOM_ENABLE_75|
+ SVX_ZOOM_ENABLE_100|
+ SVX_ZOOM_ENABLE_150|
+ SVX_ZOOM_ENABLE_200);
+ }
+ aCoreSet.Put( aZoom );
+
+ // PAGES01
+ if ( !bBrowseMode )
+ {
+ const SvxViewLayoutItem aViewLayout( rViewOptions.GetViewLayoutColumns(), rViewOptions.IsViewLayoutBookMode() );
+ aCoreSet.Put( aViewLayout );
+ }
+
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ if(pFact)
+ {
+ pDlg = pFact->CreateSvxZoomDialog(&GetViewFrame()->GetWindow(), aCoreSet);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ }
+
+ pDlg->SetLimits( MINZOOM, MAXZOOM );
+
+ if( pDlg->Execute() != RET_CANCEL )
+ pSet = pDlg->GetOutputItemSet();
+ }
+
+ // PAGES01
+ const SfxPoolItem* pViewLayoutItem = 0;
+ if ( pSet && SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_VIEWLAYOUT, TRUE, &pViewLayoutItem))
+ {
+ const USHORT nColumns = ((const SvxViewLayoutItem *)pViewLayoutItem)->GetValue();
+ const bool bBookMode = ((const SvxViewLayoutItem *)pViewLayoutItem)->IsBookMode();
+ SetViewLayout( nColumns, bBookMode );
+ }
+
+ if ( pSet && SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_ZOOM, TRUE, &pItem))
+ {
+ enum SvxZoomType eType = ((const SvxZoomItem *)pItem)->GetType();
+ SetZoom( eType, ((const SvxZoomItem *)pItem)->GetValue() );
+ }
+ bUp = TRUE;
+ if ( pItem )
+ rReq.AppendItem( *pItem );
+ rReq.Done();
+
+ delete pDlg;
+ }
+ }
+ break;
+
+ case SID_ATTR_VIEWLAYOUT:
+ {
+ if ( pArgs && !rSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) &&
+ ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) )
+ {
+ // PAGES01
+ if ( SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_VIEWLAYOUT, TRUE, &pItem ))
+ {
+ const USHORT nColumns = ((const SvxViewLayoutItem *)pItem)->GetValue();
+ const bool bBookMode = (0 == nColumns || 0 != (nColumns % 2)) ?
+ false :
+ ((const SvxViewLayoutItem *)pItem)->IsBookMode();
+
+ SetViewLayout( nColumns, bBookMode );
+ }
+
+ bUp = TRUE;
+ rReq.Done();
+
+ InvalidateRulerPos();
+ }
+ }
+ break;
+
+ case SID_ATTR_ZOOMSLIDER:
+ {
+ if ( pArgs && ( ( GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) || !GetDocShell()->IsInPlaceActive() ) )
+ {
+ // PAGES01
+ if ( SFX_ITEM_SET == pArgs->GetItemState(SID_ATTR_ZOOMSLIDER, TRUE, &pItem ))
+ {
+ const USHORT nCurrentZoom = ((const SvxZoomSliderItem *)pItem)->GetValue();
+ SetZoom( SVX_ZOOM_PERCENT, nCurrentZoom );
+ }
+
+ bUp = TRUE;
+ rReq.Done();
+ }
+ }
+ break;
+
+ case SID_ATTR_SIZE:
+ {
+ ULONG nId = FN_INSERT_FIELD;
+ if( rSh.IsCrsrInTbl() )
+ nId = FN_FORMAT_TABLE_DLG;
+ else if( rSh.GetCurTOX() )
+ nId = FN_INSERT_MULTI_TOX;
+ else if( rSh.GetCurrSection() )
+ nId = FN_EDIT_REGION;
+ else
+ {
+ const SwNumRule* pNumRule = rSh.GetCurNumRule();
+ if( pNumRule ) // Cursor in Numerierung
+ {
+ if( pNumRule->IsAutoRule() )
+ nId = FN_NUMBER_BULLETS;
+ else
+ {
+ // Dialog vom Gestalter starten ;-)
+ nId = 0;
+ }
+ }
+ else if( rSh.IsFrmSelected() )
+ nId = FN_FORMAT_FRAME_DLG;
+ else if( rSh.IsObjSelected() )
+ nId = SID_ATTR_TRANSFORM;
+ }
+ if( nId )
+ GetViewFrame()->GetDispatcher()->Execute(
+ static_cast< USHORT >( nId ), SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
+ }
+ break;
+
+ case FN_STAT_SELMODE:
+ {
+ if ( pArgs )
+ {
+ if (SFX_ITEM_SET == pArgs->GetItemState( nWhich, TRUE, &pItem))
+ {
+ switch ( ((const SfxUInt16Item *)pItem)->GetValue() )
+ {
+ case 0: rSh.EnterStdMode(); break;
+ case 1: rSh.EnterExtMode(); break;
+ case 2: rSh.EnterAddMode(); break;
+ case 3: rSh.EnterBlockMode(); break;
+ }
+ }
+ }
+ else
+ {
+
+ if( !rSh.IsAddMode() && !rSh.IsExtMode() && !rSh.IsBlockMode() )
+ rSh.ToggleExtMode();
+ else if ( rSh.IsExtMode() )
+ {
+ rSh.ToggleExtMode();
+ rSh.ToggleAddMode();
+ }
+ else if ( rSh.IsAddMode() )
+ {
+ rSh.ToggleAddMode();
+ rSh.ToggleBlockMode();
+ }
+ else
+ rSh.ToggleBlockMode();
+ }
+ bUp = TRUE;
+ break;
+ }
+ case FN_SET_ADD_MODE:
+ rSh.ToggleAddMode();
+ nWhich = FN_STAT_SELMODE;
+ bUp = TRUE;
+ break;
+ case FN_SET_BLOCK_MODE:
+ rSh.ToggleBlockMode();
+ nWhich = FN_STAT_SELMODE;
+ bUp = TRUE;
+ break;
+ case FN_SET_EXT_MODE:
+ rSh.ToggleExtMode();
+ nWhich = FN_STAT_SELMODE;
+ bUp = TRUE;
+ break;
+ case SID_ATTR_INSERT:
+ SwPostItMgr* pMgr = GetPostItMgr();
+ if ( pMgr && pMgr->HasActiveSidebarWin() )
+ {
+ pMgr->ToggleInsModeOnActiveSidebarWin();
+ }
+ else
+ rSh.ToggleInsMode();
+ bUp = TRUE;
+ break;
+
+ }
+ if ( bUp )
+ {
+ SfxBindings &rBnd = GetViewFrame()->GetBindings();
+ rBnd.Invalidate(nWhich);
+ rBnd.Update(nWhich);
+ }
+}
+
+void SwView::InsFrmMode(USHORT nCols)
+{
+ if ( pWrtShell->HasWholeTabSelection() )
+ {
+ SwFlyFrmAttrMgr aMgr( TRUE, pWrtShell, FRMMGR_TYPE_TEXT );
+
+ const SwFrmFmt &rPageFmt =
+ pWrtShell->GetPageDesc(pWrtShell->GetCurPageDesc()).GetMaster();
+ SwTwips lWidth = rPageFmt.GetFrmSize().GetWidth();
+ const SvxLRSpaceItem &rLR = rPageFmt.GetLRSpace();
+ lWidth -= rLR.GetLeft() + rLR.GetRight();
+ aMgr.SetSize(Size(lWidth, aMgr.GetSize().Height()));
+ if(nCols > 1)
+ {
+ SwFmtCol aCol;
+ aCol.Init( nCols, aCol.GetGutterWidth(), aCol.GetWishWidth() );
+ aMgr.SetCol( aCol );
+ }
+ aMgr.InsertFlyFrm();
+ }
+ else
+ GetEditWin().InsFrm(nCols);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Links bearbeiten
+ --------------------------------------------------------------------*/
+
+void SwView::EditLinkDlg()
+{
+ BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractLinksDialog* pDlg = pFact->CreateLinksDialog( &GetViewFrame()->GetWindow(), &GetWrtShell().GetLinkManager(), bWeb );
+ if ( pDlg )
+ {
+ pDlg->Execute();
+ delete pDlg;
+ }
+/*
+ SwLinkDlg* pDlg = new SwLinkDlg(GetFrameWindow());
+ pDlg->SetShell(&GetWrtShell());
+ pDlg->Execute();
+
+ DELETEZ(pDlg);
+*/
+}
+
+BOOL SwView::JumpToSwMark( const String& rMark )
+{
+ BOOL bRet = FALSE;
+ if( rMark.Len() )
+ {
+ // wir wollen den Bookmark aber am oberen Rand haben
+ BOOL bSaveCC = IsCrsrAtCenter();
+ BOOL bSaveCT = IsCrsrAtTop();
+ SetCrsrAtTop( TRUE );
+
+ //JP 27.04.98: Bug 49786
+ // Damit in FrameSet auch gescrollt werden kann, muss die
+ // entsprechende Shell auch das Focus-Flag gesetzt haben!
+ BOOL bHasShFocus = pWrtShell->HasShFcs();
+ if( !bHasShFocus )
+ pWrtShell->ShGetFcs( FALSE );
+
+ const SwFmtINetFmt* pINet;
+ String sCmp, sMark( INetURLObject::decode( rMark, INET_HEX_ESCAPE,
+ INetURLObject::DECODE_WITH_CHARSET,
+ RTL_TEXTENCODING_UTF8 ));
+
+ xub_StrLen nLastPos, nPos = sMark.Search( cMarkSeperator );
+ if( STRING_NOTFOUND != nPos )
+ while( STRING_NOTFOUND != ( nLastPos =
+ sMark.Search( cMarkSeperator, nPos + 1 )) )
+ nPos = nLastPos;
+
+ IDocumentMarkAccess::const_iterator_t ppMark;
+ IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess();
+ if( STRING_NOTFOUND != nPos &&
+ ( sCmp = sMark.Copy( nPos + 1 ) ).EraseAllChars().Len() )
+ {
+ String sName( sMark.Copy( 0, nPos ) );
+ sCmp.ToLowerAscii();
+ FlyCntType eFlyType = FLYCNTTYPE_ALL;
+
+ if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToRegion ) )
+ {
+ pWrtShell->EnterStdMode();
+ bRet = pWrtShell->GotoRegion( sName );
+ }
+ else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToOutline ) )
+ {
+ pWrtShell->EnterStdMode();
+ bRet = pWrtShell->GotoOutline( sName );
+ }
+ else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToFrame ) )
+ eFlyType = FLYCNTTYPE_FRM;
+ else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToGraphic ) )
+ eFlyType = FLYCNTTYPE_GRF;
+ else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToOLE ) )
+ eFlyType = FLYCNTTYPE_OLE;
+ else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToTable ) )
+ {
+ pWrtShell->EnterStdMode();
+ bRet = pWrtShell->GotoTable( sName );
+ }
+ else if( COMPARE_EQUAL == sCmp.CompareToAscii( pMarkToText ) )
+ {
+ // Normale Textsuche
+ pWrtShell->EnterStdMode();
+
+ SearchOptions aSearchOpt(
+ SearchAlgorithms_ABSOLUTE, 0,
+ sName, rtl::OUString(),
+ SvxCreateLocale( LANGUAGE_SYSTEM ),
+ 0,0,0,
+ TransliterationModules_IGNORE_CASE );
+
+ //todo/mba: assuming that notes shouldn't be searched
+ BOOL bSearchInNotes = FALSE;
+ if( pWrtShell->SearchPattern( aSearchOpt, bSearchInNotes, DOCPOS_START, DOCPOS_END ))
+ {
+ pWrtShell->EnterStdMode(); // Selektion wieder aufheben
+ bRet = TRUE;
+ }
+ }
+ else if( pMarkAccess->getMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)) )
+ pWrtShell->GotoMark( ppMark->get(), FALSE, TRUE ), bRet = TRUE;
+ else if( 0 != ( pINet = pWrtShell->FindINetAttr( sMark ) ))
+ bRet = pWrtShell->GotoINetAttr( *pINet->GetTxtINetFmt() );
+
+ // fuer alle Arten von Flys
+ if( FLYCNTTYPE_ALL != eFlyType && pWrtShell->GotoFly( sName, eFlyType ))
+ {
+ bRet = TRUE;
+ if( FLYCNTTYPE_FRM == eFlyType )
+ {
+ // TextFrames: Cursor in den Frame setzen
+ pWrtShell->UnSelectFrm();
+ pWrtShell->LeaveSelFrmMode();
+ }
+ else
+ {
+ pWrtShell->HideCrsr();
+ pWrtShell->EnterSelFrmMode();
+ }
+ }
+ }
+ else if( pMarkAccess->getMarksEnd() != (ppMark = pMarkAccess->findMark(sMark)))
+ pWrtShell->GotoMark( ppMark->get(), FALSE, TRUE ), bRet = TRUE;
+ else if( 0 != ( pINet = pWrtShell->FindINetAttr( sMark ) ))
+ bRet = pWrtShell->GotoINetAttr( *pINet->GetTxtINetFmt() );
+
+ // #b6330459# make selection visible later
+ if ( aVisArea.IsEmpty() )
+ bMakeSelectionVisible = sal_True;
+
+ // ViewStatus wieder zurueck setzen
+ SetCrsrAtTop( bSaveCT, bSaveCC );
+
+ if( !bHasShFocus )
+ pWrtShell->ShLooseFcs();
+ }
+ return bRet;
+}
+
+// #i67305, #1367991: Undo after insert from file:
+// Undo "Insert form file" crashes with documents imported from binary filter (.sdw) => disabled
+// Undo "Insert form file" crashes with (.odt) documents crashes if these documents contains
+// page styles with active header/footer => disabled for those documents
+
+sal_uInt16 lcl_PageDescWithHeader( const SwDoc& rDoc )
+{
+ sal_uInt16 nRet = 0;
+ sal_uInt16 nCnt = rDoc.GetPageDescCnt();
+ for( sal_uInt16 i = 0; i < nCnt; ++i )
+ {
+ const SwPageDesc& rPageDesc = rDoc.GetPageDesc( i );
+ const SwFrmFmt& rMaster = rPageDesc.GetMaster();
+ const SfxPoolItem* pItem;
+ if( ( SFX_ITEM_SET == rMaster.GetAttrSet().GetItemState( RES_HEADER, FALSE, &pItem ) &&
+ ((SwFmtHeader*)pItem)->IsActive() ) ||
+ ( SFX_ITEM_SET == rMaster.GetAttrSet().GetItemState( RES_FOOTER, FALSE, &pItem ) &&
+ ((SwFmtFooter*)pItem)->IsActive()) )
+ ++nRet;
+ }
+ return nRet; // number of page styles with active header/footer
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Links bearbeiten
+ --------------------------------------------------------------------*/
+
+void SwView::ExecuteInsertDoc( SfxRequest& rRequest, const SfxPoolItem* pItem )
+{
+ pViewImpl->InitRequest( rRequest );
+ pViewImpl->SetParam( pItem ? 1 : 0 );
+ USHORT nSlot = rRequest.GetSlot();
+
+ if ( !pItem )
+ {
+ String sEmpty;
+ InsertDoc( nSlot, sEmpty, sEmpty );
+ }
+ else
+ {
+ String sFile, sFilter;
+ sFile = ( (const SfxStringItem *)pItem )->GetValue();
+ if ( SFX_ITEM_SET == rRequest.GetArgs()->GetItemState( FN_PARAM_1, TRUE, &pItem ) )
+ sFilter = ( (const SfxStringItem *)pItem )->GetValue();
+
+ bool bHasFileName = ( sFile.Len() > 0 );
+ long nFound = InsertDoc( nSlot, sFile, sFilter );
+
+ if ( bHasFileName )
+ {
+ rRequest.SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) );
+ rRequest.Done();
+ }
+ }
+}
+
+long SwView::InsertDoc( USHORT nSlotId, const String& rFileName, const String& rFilterName, INT16 nVersion )
+{
+ SfxMedium* pMed = 0;
+ SwDocShell* pDocSh = GetDocShell();
+
+ if( rFileName.Len() )
+ {
+ SfxObjectFactory& rFact = pDocSh->GetFactory();
+ const SfxFilter* pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( rFilterName );
+ if ( !pFilter )
+ {
+ pMed = new SfxMedium(rFileName, STREAM_READ, TRUE, 0, 0 );
+ SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() );
+ pMed->UseInteractionHandler( TRUE );
+ ErrCode nErr = aMatcher.GuessFilter( *pMed, &pFilter, FALSE );
+ if ( nErr )
+ DELETEZ(pMed);
+ else
+ pMed->SetFilter( pFilter );
+ }
+ else
+ pMed = new SfxMedium(rFileName, STREAM_READ, TRUE, pFilter, 0);
+ }
+ else
+ {
+ String sFactory = String::CreateFromAscii( pDocSh->GetFactory().GetShortName() );
+ pViewImpl->StartDocumentInserter( sFactory, LINK( this, SwView, DialogClosedHdl ) );
+ return -1;
+ }
+
+ if( !pMed )
+ return -1;
+
+ return InsertMedium( nSlotId, pMed, nVersion );
+}
+
+long SwView::InsertMedium( USHORT nSlotId, SfxMedium* pMedium, INT16 nVersion )
+{
+ BOOL bInsert = FALSE, bCompare = FALSE, bMerge = FALSE;
+ long nFound = 0;
+ SwDocShell* pDocSh = GetDocShell();
+
+ switch( nSlotId )
+ {
+ case SID_DOCUMENT_MERGE: bMerge = TRUE; break;
+ case SID_DOCUMENT_COMPARE: bCompare = TRUE; break;
+ case SID_INSERTDOC: bInsert = TRUE; break;
+
+ default:
+ ASSERT( !this, "Unbekannte SlotId!" );
+ bInsert = TRUE;
+ nSlotId = SID_INSERTDOC;
+ break;
+ }
+
+ if( bInsert )
+ {
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ GetViewFrame()->GetBindings().GetRecorder();
+ if ( xRecorder.is() )
+ {
+ SfxRequest aRequest(GetViewFrame(), SID_INSERTDOC);
+ aRequest.AppendItem(SfxStringItem(SID_INSERTDOC, pMedium->GetOrigURL()));
+ if(pMedium->GetFilter())
+ aRequest.AppendItem(SfxStringItem(FN_PARAM_1, pMedium->GetFilter()->GetName()));
+ aRequest.Done();
+ }
+
+ SfxObjectShellRef aRef( pDocSh );
+
+ sal_uInt32 nError = SfxObjectShell::HandleFilter( pMedium, pDocSh );
+ // #i16722# aborted?
+ if(nError != ERRCODE_NONE)
+ {
+ delete pMedium;
+ return -1;
+ }
+ pDocSh->RegisterTransfer( *pMedium );
+ pMedium->DownLoad(); // ggfs. den DownLoad anstossen
+ if( aRef.Is() && 1 < aRef->GetRefCount() ) // noch gueltige Ref?
+ {
+ SwReader* pRdr;
+ Reader *pRead = pDocSh->StartConvertFrom( *pMedium, &pRdr, pWrtShell );
+ if( pRead ||
+ (pMedium->GetFilter()->GetFilterFlags() & SFX_FILTER_STARONEFILTER) != 0 )
+ {
+ sal_uInt16 nUndoCheck = 0;
+ SwDoc *pDoc = pDocSh->GetDoc();
+ if( pRead && pDocSh->GetDoc() )
+ nUndoCheck = lcl_PageDescWithHeader( *pDoc );
+ ULONG nErrno;
+ { //Scope for SwWait-Object, to be able to execute slots
+ //outside this scope.
+ SwWait aWait( *GetDocShell(), TRUE );
+ pWrtShell->StartAllAction();
+ if ( pWrtShell->HasSelection() )
+ pWrtShell->DelRight(); // Selektionen loeschen
+ if( pRead )
+ {
+ nErrno = pRdr->Read( *pRead ); // und Dokument einfuegen
+ delete pRdr;
+ }
+ else
+ {
+ ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
+ nErrno = pDocSh->InsertFrom( *pMedium ) ? 0 : ERR_SWG_READ_ERROR;
+ }
+
+ }
+
+ // ggfs. alle Verzeichnisse updaten:
+ if( pWrtShell->IsUpdateTOX() )
+ {
+ SfxRequest aReq( FN_UPDATE_TOX, SFX_CALLMODE_SLOT, GetPool() );
+ Execute( aReq );
+ pWrtShell->SetUpdateTOX( FALSE ); // wieder zurueck setzen
+ }
+
+ if( pDoc )
+ { // Disable Undo for .sdw (136991) or
+ // if the number of page styles with header/footer has changed (#i67305)
+ if( !pRead || nUndoCheck != lcl_PageDescWithHeader( *pDoc ) )
+ {
+ pDoc->GetIDocumentUndoRedo().DelAllUndoObj();
+ }
+ }
+
+ pWrtShell->EndAllAction();
+ if( nErrno )
+ {
+ ErrorHandler::HandleError( nErrno );
+ nFound = IsError( nErrno ) ? -1 : 0;
+ }
+ else
+ nFound = 0;
+ }
+ }
+ }
+ else
+ {
+ SfxObjectShellRef xDocSh;
+ SfxObjectShellLock xLockRef;
+
+extern int lcl_FindDocShell( SfxObjectShellRef& xDocSh, SfxObjectShellLock& xLockRef,
+ const String& rFileName, const String& rPasswd,
+ String& rFilter, INT16 nVersion,
+ SwDocShell* pDestSh );
+
+ String sFltNm;
+ int nRet = lcl_FindDocShell( xDocSh, xLockRef, pMedium->GetName(), aEmptyStr,
+ sFltNm, nVersion, pDocSh );
+ if( nRet )
+ {
+ SwWait aWait( *GetDocShell(), TRUE );
+ pWrtShell->StartAllAction();
+
+ pWrtShell->EnterStdMode(); // Selektionen loeschen
+
+ if( bCompare )
+ nFound = pWrtShell->CompareDoc( *((SwDocShell*)&xDocSh)->GetDoc() );
+ else
+ nFound = pWrtShell->MergeDoc( *((SwDocShell*)&xDocSh)->GetDoc() );
+
+ pWrtShell->EndAllAction();
+
+ if (!bCompare && !nFound)
+ {
+ Window* pWin = &GetEditWin();
+ InfoBox(pWin, SW_RES(MSG_NO_MERGE_ENTRY)).Execute();
+ }
+ }
+ if( 2 == nRet && xDocSh.Is() )
+ xDocSh->DoClose();
+ }
+
+ delete pMedium;
+ return nFound;
+}
+/* -----------------05.02.2003 12:06-----------------
+ *
+ * --------------------------------------------------*/
+void SwView::EnableMailMerge(BOOL bEnable )
+{
+ bInMailMerge = bEnable;
+ SfxBindings& rBind = GetViewFrame()->GetBindings();
+ rBind.Invalidate(FN_INSERT_FIELD_DATA_ONLY);
+ rBind.Update(FN_INSERT_FIELD_DATA_ONLY);
+}
+/*
+*/
+namespace
+{
+ sal_Bool lcl_NeedAdditionalDataSource( const uno::Reference< XNameAccess >& _rDatasourceContext )
+ {
+ Sequence < OUString > aNames = _rDatasourceContext->getElementNames();
+
+ return ( !aNames.getLength()
+ || ( ( 1 == aNames.getLength() )
+ && aNames.getConstArray()[0] == SW_MOD()->GetDBConfig()->GetBibliographySource().sDataSource
+ )
+ );
+ }
+}
+
+/* -----------------27.11.2002 12:12-----------------
+ *
+ * --------------------------------------------------*/
+
+class SwMergeSourceWarningBox_Impl : public ModalDialog
+{
+ FixedInfo aMessageFI;
+ OKButton aOK;
+ CancelButton aCancel;
+
+ FixedImage aWarnImage;
+ public:
+ SwMergeSourceWarningBox_Impl( Window* pParent ) :
+ ModalDialog( pParent, SW_RES( DLG_MERGE_SOURCE_UNAVAILABLE ) ),
+ aMessageFI( this, SW_RES( ST_MERGE_SOURCE_UNAVAILABLE ) ),
+ aOK( this, SW_RES( PB_MERGE_OK ) ),
+ aCancel( this, SW_RES( PB_MERGE_CANCEL ) ),
+ aWarnImage( this, SW_RES( IMG_MERGE ) )
+ {
+ FreeResource();
+ SetText( Application::GetDisplayName() );
+ const Image& rImg = WarningBox::GetStandardImage();
+ aWarnImage.SetImage( rImg );
+ Size aImageSize( rImg.GetSizePixel() );
+ aImageSize.Width() += 4;
+ aImageSize.Height() += 4;
+ aWarnImage.SetSizePixel( aImageSize );
+
+ aImageSize.Width() += aWarnImage.GetPosPixel().X();
+ Size aSz(GetSizePixel());
+ aSz.Width() += aImageSize.Width();
+ SetSizePixel(aSz);
+
+ Point aPos(aMessageFI.GetPosPixel());
+ aPos.X() += aImageSize.Width();
+ aMessageFI.SetPosPixel( aPos );
+
+ aPos = aOK.GetPosPixel();
+ aPos.X() += aImageSize.Width();
+ aOK.SetPosPixel( aPos );
+ aPos = aCancel.GetPosPixel();
+ aPos.X() += aImageSize.Width();
+ aCancel.SetPosPixel( aPos );
+
+ }
+
+ String GetMessText() const { return aMessageFI.GetText(); }
+ void SetMessText( const String& rText ) { aMessageFI.SetText( rText ); }
+};
+
+
+
+
+void SwView::GenerateFormLetter(BOOL bUseCurrentDocument)
+{
+ if(bUseCurrentDocument)
+ {
+ if(!GetWrtShell().IsAnyDatabaseFieldInDoc())
+ {
+ //check availability of data sources (except biblio source)
+ uno::Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ uno::Reference<XNameAccess> xDBContext;
+ if( xMgr.is() )
+ {
+ uno::Reference<XInterface> xInstance = xMgr->createInstance(
+ OUString::createFromAscii( "com.sun.star.sdb.DatabaseContext" ));
+ xDBContext = uno::Reference<XNameAccess>(xInstance, UNO_QUERY) ;
+ }
+ if(!xDBContext.is())
+ return ;
+ BOOL bCallAddressPilot = FALSE;
+ if ( lcl_NeedAdditionalDataSource( xDBContext ) )
+ {
+ // no data sources are available - create a new one
+ WarningBox aWarning(
+ &GetViewFrame()->GetWindow(),
+ SW_RES(MSG_DATA_SOURCES_UNAVAILABLE));
+ // no cancel allowed
+ if ( RET_OK != aWarning.Execute() )
+ return;
+ bCallAddressPilot = TRUE;
+ }
+ else
+ {
+ //take an existing data source or create a new one?
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractMailMergeFieldConnectionsDlg* pConnectionsDlg = pFact->CreateMailMergeFieldConnectionsDlg(
+ DLG_MERGE_FIELD_CONNECTIONS,
+ &GetViewFrame()->GetWindow());
+ DBG_ASSERT(pConnectionsDlg, "Dialogdiet fail!");
+ if(RET_OK == pConnectionsDlg->Execute())
+ bCallAddressPilot = !pConnectionsDlg->IsUseExistingConnections();
+ else
+ return;
+
+ }
+ if(bCallAddressPilot)
+ {
+ GetViewFrame()->GetDispatcher()->Execute(
+ SID_ADDRESS_DATA_SOURCE, SFX_CALLMODE_SYNCHRON);
+ if ( lcl_NeedAdditionalDataSource( xDBContext ) )
+ // no additional data source has been created
+ // -> assume that the user has cancelled the pilot
+ return;
+ }
+
+ //call insert fields with database field page available, only
+ SfxViewFrame* pVFrame = GetViewFrame();
+ //at first hide the default field dialog if currently visible
+ pVFrame->SetChildWindow(FN_INSERT_FIELD, FALSE);
+ //enable the status of the db field dialog - it is disabled in the status method
+ //to prevent creation of the dialog without mail merge active
+ EnableMailMerge();
+ //then show the "Data base only" field dialog
+ SfxBoolItem aOn(FN_INSERT_FIELD_DATA_ONLY, TRUE);
+ pVFrame->GetDispatcher()->Execute(FN_INSERT_FIELD_DATA_ONLY,
+ SFX_CALLMODE_SYNCHRON, &aOn, 0L);
+ return;
+ }
+ else
+ {
+ // check whether the
+ String sSource;
+ if(!GetWrtShell().IsFieldDataSourceAvailable(sSource))
+ {
+ SwMergeSourceWarningBox_Impl aWarning( &GetViewFrame()->GetWindow());
+ String sTmp(aWarning.GetMessText());
+ sTmp.SearchAndReplaceAscii("%1", sSource);
+ aWarning.SetMessText(sTmp);
+ if(RET_OK == aWarning.Execute())
+ {
+ SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ VclAbstractDialog* pDlg = pFact->CreateVclDialog( NULL, SID_OPTIONS_DATABASES );
+ pDlg->Execute();
+ delete pDlg;
+ }
+ }
+ return ;
+ }
+ }
+ SwNewDBMgr* pNewDBMgr = GetWrtShell().GetNewDBMgr();
+
+ SwDBData aData;
+ SwWrtShell &rSh = GetWrtShell();
+ aData = rSh.GetDBData();
+ rSh.EnterStdMode(); // Wechsel in Textshell erzwingen; ist fuer
+ // das Mischen von DB-Feldern notwendig.
+ AttrChangedNotify( &rSh );
+ pNewDBMgr->SetMergeType( DBMGR_MERGE );
+
+ if (pNewDBMgr)
+ {
+ Sequence<PropertyValue> aProperties(3);
+ PropertyValue* pValues = aProperties.getArray();
+ pValues[0].Name = C2U("DataSourceName");
+ pValues[1].Name = C2U("Command");
+ pValues[2].Name = C2U("CommandType");
+ pValues[0].Value <<= aData.sDataSource;
+ pValues[1].Value <<= aData.sCommand;
+ pValues[2].Value <<= aData.nCommandType;
+ pNewDBMgr->ExecuteFormLetter(GetWrtShell(), aProperties, TRUE);
+ }
+ }
+ else
+ {
+ //call documents and template dialog
+ SfxApplication* pSfxApp = SFX_APP();
+ Window* pTopWin = pSfxApp->GetTopWindow();
+ SvtDocumentTemplateDialog* pDocTemplDlg = new SvtDocumentTemplateDialog( pTopWin );
+ pDocTemplDlg->SelectTemplateFolder();
+
+ int nRet = pDocTemplDlg->Execute();
+ sal_Bool bNewWin = sal_False;
+ if ( nRet == RET_OK )
+ {
+ if ( pTopWin != pSfxApp->GetTopWindow() )
+ {
+ // the dialogue opens a document -> a new TopWindow appears
+ pTopWin = pSfxApp->GetTopWindow();
+ bNewWin = sal_True;
+ }
+ }
+
+ delete pDocTemplDlg;
+ if ( bNewWin )
+ // after the destruction of the dialogue its parent comes to top,
+ // but we want that the new document is on top
+ pTopWin->ToTop();
+
+// return;
+ }
+}
+
+IMPL_LINK( SwView, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg )
+{
+ if ( ERRCODE_NONE == _pFileDlg->GetError() )
+ {
+ SfxMedium* pMed = pViewImpl->CreateMedium();
+ if ( pMed )
+ {
+ USHORT nSlot = pViewImpl->GetRequest()->GetSlot();
+ long nFound = InsertMedium( nSlot, pMed, pViewImpl->GetParam() );
+
+ if ( SID_INSERTDOC == nSlot )
+ {
+ if ( pViewImpl->GetParam() == 0 )
+ {
+ pViewImpl->GetRequest()->SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) );
+ pViewImpl->GetRequest()->Ignore();
+ }
+ else
+ {
+ pViewImpl->GetRequest()->SetReturnValue( SfxBoolItem( nSlot, nFound != -1 ) );
+ pViewImpl->GetRequest()->Done();
+ }
+ }
+ else if ( SID_DOCUMENT_COMPARE == nSlot || SID_DOCUMENT_MERGE == nSlot )
+ {
+ pViewImpl->GetRequest()->SetReturnValue( SfxInt32Item( nSlot, nFound ) );
+
+ if ( nFound > 0 ) // Redline-Browser anzeigen
+ {
+ SfxViewFrame* pVFrame = GetViewFrame();
+ pVFrame->ShowChildWindow(FN_REDLINE_ACCEPT);
+
+ // RedlineDlg neu initialisieren
+ USHORT nId = SwRedlineAcceptChild::GetChildWindowId();
+ SwRedlineAcceptChild* pRed = (SwRedlineAcceptChild*)pVFrame->GetChildWindow( nId );
+ if ( pRed )
+ pRed->ReInitDlg( GetDocShell() );
+ }
+ }
+ }
+ }
+ return 0;
+}
+
+void SwView::ExecuteScan( SfxRequest& rReq )
+{
+ if (pViewImpl)
+ pViewImpl->ExecuteScan(rReq) ;
+}
+
diff --git a/sw/source/ui/uiview/viewcoll.cxx b/sw/source/ui/uiview/viewcoll.cxx
new file mode 100644
index 000000000000..e5f9350277ee
--- /dev/null
+++ b/sw/source/ui/uiview/viewcoll.cxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include "cmdid.h"
+#include "uiitems.hxx"
+#include <tools/list.hxx>
+#include <vcl/window.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svl/stritem.hxx>
+#include <rsc/rscsfx.hxx>
+
+
+#include "errhdl.hxx"
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "basesh.hxx"
+
+
+void SwView::ExecColl(SfxRequest &rReq)
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+ USHORT nWhich = rReq.GetSlot();
+ switch( nWhich )
+ {
+ case FN_SET_PAGE:
+ {
+ DBG_ASSERT(!this, "Not implemented");
+ }
+ break;
+ case FN_SET_PAGE_STYLE:
+ {
+ if( pArgs )
+ {
+ if (pArgs &&
+ SFX_ITEM_SET == pArgs->GetItemState( nWhich , TRUE, &pItem ))
+ {
+ if( ((SfxStringItem*)pItem)->GetValue() !=
+ GetWrtShell().GetCurPageStyle(FALSE) )
+ {
+ SfxStringItem aName(SID_STYLE_APPLY,
+ ((SfxStringItem*)pItem)->GetValue());
+ SfxUInt16Item aFamItem( SID_STYLE_FAMILY,
+ SFX_STYLE_FAMILY_PAGE);
+ SwPtrItem aShell(FN_PARAM_WRTSHELL, GetWrtShellPtr());
+ SfxRequest aReq(SID_STYLE_APPLY, 0, GetPool());
+ aReq.AppendItem(aName);
+ aReq.AppendItem(aFamItem);
+ aReq.AppendItem(aShell);
+ GetCurShell()->ExecuteSlot(aReq);
+ }
+ }
+ }
+ else
+ {
+ SfxRequest aReq(FN_FORMAT_PAGE_DLG, 0, GetPool());
+ GetCurShell()->ExecuteSlot(aReq);
+ }
+ }
+ break;
+ default:
+ ASSERT(FALSE, falscher CommandProcessor fuer Dispatch);
+ return;
+ }
+}
+
+
+
diff --git a/sw/source/ui/uiview/viewdlg.cxx b/sw/source/ui/uiview/viewdlg.cxx
new file mode 100644
index 000000000000..8c19c454b6ac
--- /dev/null
+++ b/sw/source/ui/uiview/viewdlg.cxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include "hintids.hxx"
+#include <sfx2/viewfrm.hxx>
+#include <editeng/tstpitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/request.hxx>
+
+
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "basesh.hxx"
+#include "viewopt.hxx"
+#include "uitool.hxx"
+#include "cmdid.h"
+#include <sfx2/tabdlg.hxx>
+
+#include "pagedesc.hxx"
+
+
+void SwView::ExecDlg(SfxRequest &rReq)
+{
+ ModalDialog *pDialog = 0;
+ //Damit aus dem Basic keine Dialoge fuer Hintergrund-Views aufgerufen werden:
+ const SfxPoolItem* pItem = 0;
+ const SfxItemSet* pArgs = rReq.GetArgs();
+
+ USHORT nSlot = rReq.GetSlot();
+ if(pArgs)
+ pArgs->GetItemState( GetPool().GetWhich(nSlot), FALSE, &pItem );
+
+ switch ( nSlot )
+ {
+ case FN_CHANGE_PAGENUM:
+ {
+ if ( pItem )
+ {
+ USHORT nValue = ((SfxUInt16Item *)pItem)->GetValue();
+ USHORT nOldValue = pWrtShell->GetPageOffset();
+ USHORT nPage, nLogPage;
+ pWrtShell->GetPageNum( nPage, nLogPage,
+ pWrtShell->IsCrsrVisible(), FALSE);
+
+ if(nValue != nOldValue || nValue != nLogPage)
+ {
+ if(!nOldValue)
+ pWrtShell->SetNewPageOffset( nValue );
+ else
+ pWrtShell->SetPageOffset( nValue );
+ }
+ }
+ }
+ break;
+
+ default:
+ ASSERT(!this, falscher Dispatcher);
+ return;
+ }
+
+ if( pDialog )
+ {
+ pDialog->Execute();
+ delete pDialog;
+ }
+}
+
+
+
diff --git a/sw/source/ui/uiview/viewdlg2.cxx b/sw/source/ui/uiview/viewdlg2.cxx
new file mode 100644
index 000000000000..a6a64078840d
--- /dev/null
+++ b/sw/source/ui/uiview/viewdlg2.cxx
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/request.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/objface.hxx>
+
+#include <fldmgr.hxx>
+#include <expfld.hxx>
+#include <modcfg.hxx>
+
+#include <tools/shl.hxx>
+
+#include "swmodule.hxx"
+#include "view.hxx"
+#include "wview.hxx"
+#include "wrtsh.hxx"
+#include "cmdid.h"
+#include "caption.hxx"
+#include "poolfmt.hxx"
+#include "edtwin.hxx"
+#include <SwStyleNameMapper.hxx>
+
+#include "swabstdlg.hxx"
+#include "frmui.hrc"
+#include "misc.hrc"
+
+#include "view.hrc"
+
+extern String* pOldGrfCat;
+extern String* pOldTabCat;
+extern String* pOldFrmCat;
+extern String* pOldDrwCat;
+
+/* -----------------06.11.98 13:45-------------------
+ *
+ * --------------------------------------------------*/
+
+void SwView::ExecDlgExt(SfxRequest &rReq)
+{
+ Window *pMDI = &GetViewFrame()->GetWindow();
+
+ switch ( rReq.GetSlot() )
+ {
+ case FN_INSERT_CAPTION:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ VclAbstractDialog* pDialog = pFact->CreateSwCaptionDialog( pMDI, *this, DLG_CAPTION );
+ DBG_ASSERT(pDialog, "Dialogdiet fail!");
+ if ( pDialog )
+ {
+ pDialog->Execute();
+ delete pDialog;
+ }
+ break;
+ }
+ case FN_EDIT_FOOTNOTE:
+ {
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractInsFootNoteDlg* pDlg = pFact->CreateInsFootNoteDlg( DLG_INS_FOOTNOTE,
+ pMDI, *pWrtShell, TRUE );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+
+ pDlg->SetHelpId(GetStaticInterface()->GetSlot(FN_EDIT_FOOTNOTE)->GetCommand());
+ pDlg->SetText( SW_RESSTR(STR_EDIT_FOOTNOTE) );
+ pDlg->Execute();
+ delete pDlg;
+ break;
+ }
+ }
+}
+
+/* -----------------06.11.98 14:53-------------------
+ *
+ * --------------------------------------------------*/
+
+void SwView::AutoCaption(const USHORT nType, const SvGlobalName *pOleId)
+{
+ SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+
+ BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
+ if (pModOpt->IsInsWithCaption(bWeb))
+ {
+ const InsCaptionOpt *pOpt = pModOpt->GetCapOption(bWeb, (SwCapObjType)nType, pOleId);
+ if (pOpt && pOpt->UseCaption() == TRUE)
+ InsertCaption(pOpt);
+ }
+}
+
+/* -----------------06.11.98 12:58-------------------
+ *
+ * --------------------------------------------------*/
+
+void SwView::InsertCaption(const InsCaptionOpt *pOpt)
+{
+ if (!pOpt)
+ return;
+
+ const String &rName = pOpt->GetCategory();
+
+ // Existiert Pool-Vorlage gleichen Namens?
+ SwWrtShell &rSh = GetWrtShell();
+ if(rName.Len())
+ {
+ USHORT nPoolId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL);
+ if( USHRT_MAX != nPoolId )
+ rSh.GetTxtCollFromPool(nPoolId);
+ // Pool-Vorlage existiert nicht: Existiert sie am Dokument?
+ else if( !rSh.GetParaStyle(rName) )
+ {
+ // Sie existiert auch nicht am Dokument: erzeugen
+ SwTxtFmtColl* pDerivedFrom = rSh.GetTxtCollFromPool(RES_POOLCOLL_LABEL);
+ rSh.MakeTxtFmtColl(rName, pDerivedFrom);
+ }
+ }
+
+ SelectionType eType = rSh.GetSelectionType();
+ if (eType & nsSelectionType::SEL_OLE)
+ eType = nsSelectionType::SEL_GRF;
+
+ // SwLabelType
+ const SwLabelType eT = eType & nsSelectionType::SEL_TBL ? LTYPE_TABLE :
+ eType & nsSelectionType::SEL_FRM ? LTYPE_FLY :
+ eType == nsSelectionType::SEL_TXT ? LTYPE_FLY :
+ eType & nsSelectionType::SEL_DRW ? LTYPE_DRAW :
+ LTYPE_OBJECT;
+
+ SwFldMgr aMgr(&rSh);
+ SwSetExpFieldType* pFldType =
+ (SwSetExpFieldType*)aMgr.GetFldType(RES_SETEXPFLD, rName);
+ if (!pFldType && rName.Len() )
+ {
+ // Neuen Feldtypen erzeugen
+ SwSetExpFieldType aSwSetExpFieldType(rSh.GetDoc(), rName, nsSwGetSetExpType::GSE_SEQ);
+ aMgr.InsertFldType(aSwSetExpFieldType);
+ pFldType = (SwSetExpFieldType*)aMgr.GetFldType(RES_SETEXPFLD, rName);
+ }
+
+ if (!pOpt->IgnoreSeqOpts())
+ {
+ if (pFldType)
+ {
+ pFldType->SetDelimiter(pOpt->GetSeparator());
+ pFldType->SetOutlineLvl( static_cast< BYTE >(pOpt->GetLevel()) );
+ }
+ }
+
+ USHORT nID = USHRT_MAX;
+ SwFieldType* pType = 0;
+ const USHORT nCount = aMgr.GetFldTypeCount();
+ if( rName.Len() )
+ {
+ for (USHORT i = 0; i < nCount; ++i)
+ {
+ pType = aMgr.GetFldType(USHRT_MAX, i);
+ String aTmpName( pType->GetName() );
+ if (aTmpName == rName && pType->Which() == RES_SETEXPFLD)
+ {
+ nID = i;
+ break;
+ }
+ }
+ }
+ rSh.StartAllAction();
+
+ GetWrtShell().InsertLabel( eT,
+ pOpt->GetCaption(),
+ !pOpt->IgnoreSeqOpts() ? aEmptyStr : pOpt->GetSeparator(),
+ pOpt->GetNumSeparator(),
+ !pOpt->GetPos(),
+ nID,
+ pOpt->GetCharacterStyle(),
+ pOpt->CopyAttributes() );
+ // Nummernformat setzen
+ if(pType)
+ ((SwSetExpFieldType*)pType)->SetSeqFormat(pOpt->GetNumType());
+
+ rSh.UpdateExpFlds( TRUE );
+
+ rSh.EndAllAction();
+
+ if ( rSh.IsFrmSelected() )
+ {
+ GetEditWin().StopInsFrm();
+ rSh.EnterSelFrmMode();
+ }
+
+ // Kategorie merken
+ String** ppStr = 0;
+ if (eType & nsSelectionType::SEL_GRF)
+ ppStr = &pOldGrfCat;
+ else if( eType & nsSelectionType::SEL_TBL)
+ ppStr = &pOldTabCat;
+ else if( eType & nsSelectionType::SEL_FRM)
+ ppStr = &pOldFrmCat;
+ else if( eType == nsSelectionType::SEL_TXT)
+ ppStr = &pOldFrmCat;
+ else if( eType & nsSelectionType::SEL_DRW)
+ ppStr = &pOldDrwCat;
+
+ if( ppStr )
+ {
+ if( !*ppStr )
+ *ppStr = new String( rName );
+ else
+ **ppStr = rName;
+ }
+}
+
+
diff --git a/sw/source/ui/uiview/viewdraw.cxx b/sw/source/ui/uiview/viewdraw.cxx
new file mode 100644
index 000000000000..abae753c1b56
--- /dev/null
+++ b/sw/source/ui/uiview/viewdraw.cxx
@@ -0,0 +1,849 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include "hintids.hxx"
+#include <svl/aeitem.hxx>
+#include <svl/itempool.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdpage.hxx>
+#include <editeng/editview.hxx>
+#include <editeng/editeng.hxx>
+#include <editeng/outliner.hxx>
+#include <svx/fmview.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <doc.hxx>
+#include <editeng/langitem.hxx>
+#include <linguistic/lngprops.hxx>
+#include <editeng/unolingu.hxx>
+#include <svx/fontworkbar.hxx>
+#include <svx/fontworkgallery.hxx>
+#include <editeng/eeitem.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdetc.hxx>
+#include <editeng/editstat.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/printer.hxx>
+#include <svx/fmglob.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/svdoutl.hxx>
+
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "viewopt.hxx"
+#include "cmdid.h"
+#include "drawsh.hxx"
+#include "drwbassh.hxx"
+#include "beziersh.hxx"
+#include "conrect.hxx"
+#include "conpoly.hxx"
+#include "conarc.hxx"
+#include "conform.hxx"
+#include "concustomshape.hxx"
+#include "dselect.hxx"
+#include "edtwin.hxx"
+
+// #108784#
+#include <dcontact.hxx>
+
+// #108784#
+#include <svx/svdpagv.hxx>
+#include <svx/extrusionbar.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+/*--------------------------------------------------------------------
+ Beschreibung: Drawing-Ids ausfuehren
+ --------------------------------------------------------------------*/
+
+void SwView::ExecDraw(SfxRequest& rReq)
+{
+ const SfxItemSet *pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem;
+ const SfxAllEnumItem* pEItem = 0;
+ const SfxStringItem* pStringItem = 0;
+ SdrView *pSdrView = pWrtShell->GetDrawView();
+ sal_Bool bDeselect = sal_False;
+
+ sal_uInt16 nSlotId = rReq.GetSlot();
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(GetPool().GetWhich(nSlotId), sal_False, &pItem))
+ {
+ pEItem = dynamic_cast< const SfxAllEnumItem*>(pItem);
+ pStringItem = dynamic_cast< const SfxStringItem*>(pItem);
+ }
+
+ if (SID_INSERT_DRAW == nSlotId && pEItem)
+ switch ( pEItem->GetValue() )
+ {
+ case SVX_SNAP_DRAW_SELECT: nSlotId = SID_OBJECT_SELECT; break;
+ case SVX_SNAP_DRAW_LINE: nSlotId = SID_DRAW_LINE; break;
+ case SVX_SNAP_DRAW_RECT: nSlotId = SID_DRAW_RECT; break;
+ case SVX_SNAP_DRAW_ELLIPSE: nSlotId = SID_DRAW_ELLIPSE; break;
+ case SVX_SNAP_DRAW_POLYGON_NOFILL: nSlotId = SID_DRAW_POLYGON_NOFILL; break;
+ case SVX_SNAP_DRAW_BEZIER_NOFILL: nSlotId = SID_DRAW_BEZIER_NOFILL; break;
+ case SVX_SNAP_DRAW_FREELINE_NOFILL: nSlotId = SID_DRAW_FREELINE_NOFILL; break;
+ case SVX_SNAP_DRAW_ARC: nSlotId = SID_DRAW_ARC; break;
+ case SVX_SNAP_DRAW_PIE: nSlotId = SID_DRAW_PIE; break;
+ case SVX_SNAP_DRAW_CIRCLECUT: nSlotId = SID_DRAW_CIRCLECUT; break;
+ case SVX_SNAP_DRAW_TEXT: nSlotId = SID_DRAW_TEXT; break;
+ case SVX_SNAP_DRAW_TEXT_VERTICAL: nSlotId = SID_DRAW_TEXT_VERTICAL; break;
+ case SVX_SNAP_DRAW_TEXT_MARQUEE: nSlotId = SID_DRAW_TEXT_MARQUEE; break;
+ case SVX_SNAP_DRAW_CAPTION: nSlotId = SID_DRAW_CAPTION; break;
+ case SVX_SNAP_DRAW_CAPTION_VERTICAL: nSlotId = SID_DRAW_CAPTION_VERTICAL; break;
+ }
+
+ if (nSlotId == SID_OBJECT_SELECT && nFormSfxId == nSlotId)
+ {
+ bDeselect = sal_True;
+ }
+ else if (nSlotId == SID_FM_CREATE_CONTROL)
+ {
+ SFX_REQUEST_ARG( rReq, pIdentifierItem, SfxUInt16Item, SID_FM_CONTROL_IDENTIFIER, sal_False );
+ if( pIdentifierItem )
+ {
+ sal_uInt16 nNewId = pIdentifierItem->GetValue();
+ if (nNewId == nFormSfxId)
+ {
+ bDeselect = sal_True;
+ GetViewFrame()->GetDispatcher()->Execute(SID_FM_LEAVE_CREATE); // Button soll rauspoppen
+ }
+ }
+ }
+ else if( nSlotId == SID_FM_CREATE_FIELDCONTROL)
+ {
+ FmFormView* pFormView = PTR_CAST( FmFormView, pSdrView );
+ if ( pFormView )
+ {
+ SFX_REQUEST_ARG( rReq, pDescriptorItem, SfxUnoAnyItem, SID_FM_DATACCESS_DESCRIPTOR, sal_False );
+ DBG_ASSERT( pDescriptorItem, "SwView::ExecDraw(SID_FM_CREATE_FIELDCONTROL): invalid request args!" );
+ if( pDescriptorItem )
+ {
+ ::svx::ODataAccessDescriptor aDescriptor( pDescriptorItem->GetValue() );
+ SdrObject* pObj = pFormView->CreateFieldControl( aDescriptor );
+
+ if ( pObj )
+ {
+ Size aDocSize(pWrtShell->GetDocSize());
+ const SwRect& rVisArea = pWrtShell->VisArea();
+ Point aStartPos = rVisArea.Center();
+ if(rVisArea.Width() > aDocSize.Width())
+ aStartPos.X() = aDocSize.Width() / 2 + rVisArea.Left();
+ if(rVisArea.Height() > aDocSize.Height())
+ aStartPos.Y() = aDocSize.Height() / 2 + rVisArea.Top();
+
+ //determine the size of the object
+ if(pObj->IsGroupObject())
+ {
+ const Rectangle& rBoundRect = ((SdrObjGroup*)pObj)->GetCurrentBoundRect();
+ aStartPos.X() -= rBoundRect.GetWidth()/2;
+ aStartPos.Y() -= rBoundRect.GetHeight()/2;
+ }
+
+ // TODO: unmark all other
+ pWrtShell->EnterStdMode();
+ pWrtShell->SwFEShell::InsertDrawObj( *pObj, aStartPos );
+ }
+ }
+ }
+ }
+ else if ( nSlotId == SID_FONTWORK_GALLERY_FLOATER )
+ {
+ Window* pWin = &( pWrtShell->GetView().GetViewFrame()->GetWindow() );
+
+ if ( pWin )
+ pWin->EnterWait();
+
+ if( !pWrtShell->HasDrawView() )
+ pWrtShell->MakeDrawView();
+
+ pSdrView = pWrtShell->GetDrawView();
+ if ( pSdrView )
+ {
+ SdrObject* pObj = NULL;
+ svx::FontWorkGalleryDialog aDlg( pSdrView, pWin, nSlotId );
+ aDlg.SetSdrObjectRef( &pObj, pSdrView->GetModel() );
+ aDlg.Execute();
+ if ( pObj )
+ {
+ Size aDocSize( pWrtShell->GetDocSize() );
+ const SwRect& rVisArea = pWrtShell->VisArea();
+ Point aPos( rVisArea.Center() );
+ Size aSize;
+ Size aPrefSize( pObj->GetSnapRect().GetSize() );
+
+ if( rVisArea.Width() > aDocSize.Width())
+ aPos.X() = aDocSize.Width() / 2 + rVisArea.Left();
+
+ if(rVisArea.Height() > aDocSize.Height())
+ aPos.Y() = aDocSize.Height() / 2 + rVisArea.Top();
+
+ if( aPrefSize.Width() && aPrefSize.Height() )
+ {
+ if( pWin )
+ aSize = pWin->PixelToLogic( aPrefSize, MAP_TWIP );
+ else
+ aSize = Application::GetDefaultDevice()->PixelToLogic( aPrefSize, MAP_TWIP );
+ }
+ else
+ aSize = Size( 2835, 2835 );
+
+ pWrtShell->EnterStdMode();
+ pWrtShell->SwFEShell::InsertDrawObj( *pObj, aPos );
+ rReq.Ignore ();
+ }
+ }
+ if( pWin )
+ pWin->LeaveWait();
+ }
+
+ if( nSlotId == SID_DRAW_CS_ID )
+ {
+ //deselect if same custom shape is selected again
+ SwDrawBase* pFuncPtr = GetDrawFuncPtr();
+ if( pFuncPtr && pFuncPtr->GetSlotId() == SID_DRAW_CS_ID )
+ {
+ ConstCustomShape* pConstCustomShape = (ConstCustomShape*)(pFuncPtr);
+ rtl::OUString aNew = ConstCustomShape::GetShapeTypeFromRequest( rReq );
+ rtl::OUString aOld = pConstCustomShape->GetShapeType();
+ if( aNew == aOld )
+ {
+ bDeselect = true;
+ }
+ }
+ }
+
+ //deselect if same shape is selected again (but different custom shapes do have same slot id)
+ if ( bDeselect || (nSlotId == nDrawSfxId &&
+ (!pStringItem || (pStringItem->GetValue() == sDrawCustom))
+ && (nSlotId != SID_DRAW_CS_ID) ) )
+ {
+ if (GetDrawFuncPtr())
+ {
+ GetDrawFuncPtr()->Deactivate();
+ SetDrawFuncPtr(NULL);
+ }
+
+ if (pWrtShell->IsObjSelected() && !pWrtShell->IsSelFrmMode())
+ pWrtShell->EnterSelFrmMode(NULL);
+ LeaveDrawCreate();
+
+ GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
+
+ AttrChangedNotify(pWrtShell);
+ return;
+ }
+
+ LeaveDrawCreate();
+
+ if (pWrtShell->IsFrmSelected())
+ pWrtShell->EnterStdMode(); // wegen Bug #45639
+
+ SwDrawBase* pFuncPtr = NULL;
+
+ switch (nSlotId)
+ {
+ case SID_OBJECT_SELECT:
+ case SID_DRAW_SELECT:
+ pFuncPtr = new DrawSelection(pWrtShell, pEditWin, this);
+ nDrawSfxId = nFormSfxId = SID_OBJECT_SELECT;
+ sDrawCustom.Erase();
+ break;
+
+ case SID_DRAW_LINE:
+ case SID_DRAW_RECT:
+ case SID_DRAW_ELLIPSE:
+ case SID_DRAW_TEXT:
+ case SID_DRAW_TEXT_VERTICAL:
+ case SID_DRAW_TEXT_MARQUEE:
+ case SID_DRAW_CAPTION:
+ case SID_DRAW_CAPTION_VERTICAL:
+ pFuncPtr = new ConstRectangle(pWrtShell, pEditWin, this);
+ nDrawSfxId = nSlotId;
+ sDrawCustom.Erase();
+ break;
+
+ case SID_DRAW_POLYGON_NOFILL:
+ case SID_DRAW_BEZIER_NOFILL:
+ case SID_DRAW_FREELINE_NOFILL:
+ pFuncPtr = new ConstPolygon(pWrtShell, pEditWin, this);
+ nDrawSfxId = nSlotId;
+ sDrawCustom.Erase();
+ break;
+
+ case SID_DRAW_ARC:
+ case SID_DRAW_PIE:
+ case SID_DRAW_CIRCLECUT:
+ pFuncPtr = new ConstArc(pWrtShell, pEditWin, this);
+ nDrawSfxId = nSlotId;
+ sDrawCustom.Erase();
+ break;
+
+ case SID_FM_CREATE_CONTROL:
+ {
+ SFX_REQUEST_ARG( rReq, pIdentifierItem, SfxUInt16Item, SID_FM_CONTROL_IDENTIFIER, sal_False );
+ if( pIdentifierItem )
+ nSlotId = pIdentifierItem->GetValue();
+ pFuncPtr = new ConstFormControl(pWrtShell, pEditWin, this);
+ nFormSfxId = nSlotId;
+ }
+ break;
+
+ case SID_DRAWTBX_CS_BASIC :
+ case SID_DRAWTBX_CS_SYMBOL :
+ case SID_DRAWTBX_CS_ARROW :
+ case SID_DRAWTBX_CS_FLOWCHART :
+ case SID_DRAWTBX_CS_CALLOUT :
+ case SID_DRAWTBX_CS_STAR :
+ case SID_DRAW_CS_ID :
+ {
+ pFuncPtr = new ConstCustomShape(pWrtShell, pEditWin, this, rReq );
+ nDrawSfxId = nSlotId;
+ if ( nSlotId != SID_DRAW_CS_ID )
+ {
+ if ( pStringItem )
+ {
+ sDrawCustom = pStringItem->GetValue();
+ aCurrShapeEnumCommand[ nSlotId - SID_DRAWTBX_CS_BASIC ] = sDrawCustom;
+ SfxBindings& rBind = GetViewFrame()->GetBindings();
+ rBind.Invalidate( nSlotId );
+ rBind.Update( nSlotId );
+ }
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ static sal_uInt16 __READONLY_DATA aInval[] =
+ {
+ // Slot-Ids muessen beim Aufruf von Invalidate sortiert sein!
+ SID_ATTRIBUTES_AREA,
+ SID_INSERT_DRAW,
+ 0
+ };
+ GetViewFrame()->GetBindings().Invalidate(aInval);
+
+ BOOL bEndTextEdit = TRUE;
+ if (pFuncPtr)
+ {
+ if (GetDrawFuncPtr())
+ {
+ GetDrawFuncPtr()->Deactivate();
+ SetDrawFuncPtr(NULL);
+ }
+
+ SetDrawFuncPtr(pFuncPtr);
+ AttrChangedNotify(pWrtShell);
+
+ pFuncPtr->Activate(nSlotId);
+ NoRotate();
+ if(rReq.GetModifier() == KEY_MOD1)
+ {
+ if(SID_OBJECT_SELECT == nDrawSfxId )
+ {
+ pWrtShell->GotoObj(TRUE);
+ }
+ else
+ {
+ pFuncPtr->CreateDefaultObject();
+ pFuncPtr->Deactivate();
+ SetDrawFuncPtr(NULL);
+ LeaveDrawCreate();
+ pWrtShell->EnterStdMode();
+ SdrView *pTmpSdrView = pWrtShell->GetDrawView();
+ const SdrMarkList& rMarkList = pTmpSdrView->GetMarkedObjectList();
+ if(rMarkList.GetMarkCount() == 1 &&
+ (SID_DRAW_TEXT == nSlotId || SID_DRAW_TEXT_VERTICAL == nSlotId ||
+ SID_DRAW_TEXT_MARQUEE == nSlotId ))
+ {
+ SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+ BeginTextEdit(pObj);
+ bEndTextEdit = FALSE;
+ }
+ }
+ }
+ }
+ else
+ {
+ if (pWrtShell->IsObjSelected() && !pWrtShell->IsSelFrmMode())
+ pWrtShell->EnterSelFrmMode(NULL);
+ }
+
+ if(bEndTextEdit && pSdrView && pSdrView->IsTextEdit())
+ pSdrView->SdrEndTextEdit( sal_True );
+
+ AttrChangedNotify(pWrtShell);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Drawing beenden
+ --------------------------------------------------------------------*/
+
+
+
+void SwView::ExitDraw()
+{
+ NoRotate();
+
+ if(pShell)
+ {
+ //#126062 # the shell may be invalid at close/reload/SwitchToViewShell
+ SfxDispatcher* pDispatch = GetViewFrame()->GetDispatcher();
+ USHORT nIdx = 0;
+ SfxShell* pTest = 0;
+ do
+ {
+ pTest = pDispatch->GetShell(nIdx++);
+ }
+ while( pTest && pTest != this && pTest != pShell);
+ if(pTest == pShell &&
+ // don't call LeaveSelFrmMode() etc. for the below,
+ // because objects may still be selected:
+ !pShell->ISA(SwDrawBaseShell) &&
+ !pShell->ISA(SwBezierShell) &&
+ !pShell->ISA(svx::ExtrusionBar) &&
+ !pShell->ISA(svx::FontworkBar))
+ {
+ SdrView *pSdrView = pWrtShell->GetDrawView();
+
+ if (pSdrView && pSdrView->IsGroupEntered())
+ {
+ pSdrView->LeaveOneGroup();
+ pSdrView->UnmarkAll();
+ GetViewFrame()->GetBindings().Invalidate(SID_ENTER_GROUP);
+ }
+
+ if (GetDrawFuncPtr())
+ {
+ if (pWrtShell->IsSelFrmMode())
+ pWrtShell->LeaveSelFrmMode();
+ GetDrawFuncPtr()->Deactivate();
+
+ SetDrawFuncPtr(NULL);
+ LeaveDrawCreate();
+
+ GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
+ }
+ GetEditWin().SetPointer(Pointer(POINTER_TEXT));
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Rotate-Mode abschalten
+ --------------------------------------------------------------------*/
+
+
+
+void SwView::NoRotate()
+{
+ if (IsDrawRotate())
+ {
+ pWrtShell->SetDragMode(SDRDRAG_MOVE);
+ FlipDrawRotate();
+
+ const SfxBoolItem aTmp( SID_OBJECT_ROTATE, sal_False );
+ GetViewFrame()->GetBindings().SetState( aTmp );
+ }
+}
+
+/******************************************************************************
+ * Beschreibung: DrawTextEditMode einschalten
+ ******************************************************************************/
+
+sal_Bool SwView::EnterDrawTextMode(const Point& aDocPos)
+{
+ SdrObject* pObj;
+ SdrPageView* pPV;
+ SwWrtShell *pSh = &GetWrtShell();
+ SdrView *pSdrView = pSh->GetDrawView();
+ ASSERT( pSdrView, "EnterDrawTextMode without DrawView?" );
+
+ sal_Bool bReturn = sal_False;
+
+ sal_uInt16 nOld = pSdrView->GetHitTolerancePixel();
+ pSdrView->SetHitTolerancePixel( 2 );
+
+ if( pSdrView->IsMarkedHit( aDocPos ) &&
+ !pSdrView->PickHandle( aDocPos ) && IsTextTool() &&
+ pSdrView->PickObj( aDocPos, pSdrView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKTEXTEDIT ) &&
+
+ // #108784#
+ // To allow SwDrawVirtObj text objects to be activated, allow their type, too.
+ //pObj->ISA( SdrTextObj ) &&
+ ( pObj->ISA( SdrTextObj ) ||
+ ( pObj->ISA(SwDrawVirtObj) &&
+ ((SwDrawVirtObj*)pObj)->GetReferencedObj().ISA(SdrTextObj) ) ) &&
+
+ !pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT))
+ {
+ bReturn = BeginTextEdit( pObj, pPV, pEditWin, sal_False );
+ }
+
+ pSdrView->SetHitTolerancePixel( nOld );
+
+ return bReturn;
+}
+
+/******************************************************************************
+ * Beschreibung: DrawTextEditMode einschalten
+ ******************************************************************************/
+sal_Bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, Window* pWin,
+ bool bIsNewObj, bool bSetSelectionToStart)
+{
+ SwWrtShell *pSh = &GetWrtShell();
+ SdrView *pSdrView = pSh->GetDrawView();
+ SdrOutliner* pOutliner = ::SdrMakeOutliner(OUTLINERMODE_TEXTOBJECT, pSdrView->GetModel());
+ uno::Reference< linguistic2::XSpellChecker1 > xSpell( ::GetSpellChecker() );
+ if (pOutliner)
+ {
+ pOutliner->SetRefDevice(pSh->getIDocumentDeviceAccess()->getReferenceDevice(false));
+ pOutliner->SetSpeller(xSpell);
+ uno::Reference<linguistic2::XHyphenator> xHyphenator( ::GetHyphenator() );
+ pOutliner->SetHyphenator( xHyphenator );
+ pSh->SetCalcFieldValueHdl(pOutliner);
+
+ sal_uInt32 nCntrl = pOutliner->GetControlWord();
+ nCntrl |= EE_CNTRL_ALLOWBIGOBJS;
+ nCntrl |= EE_CNTRL_URLSFXEXECUTE;
+
+ const SwViewOption *pOpt = pSh->GetViewOptions();
+
+ if (SwViewOption::IsFieldShadings())
+ nCntrl |= EE_CNTRL_MARKFIELDS;
+ else
+ nCntrl &= ~EE_CNTRL_MARKFIELDS;
+
+ if (pOpt->IsOnlineSpell())
+ nCntrl |= EE_CNTRL_ONLINESPELLING;
+ else
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+
+ pOutliner->SetControlWord(nCntrl);
+ const SfxPoolItem& rItem = pSh->GetDoc()->GetDefault(RES_CHRATR_LANGUAGE);
+ pOutliner->SetDefaultLanguage(((const SvxLanguageItem&)rItem).GetLanguage());
+
+ if( bIsNewObj )
+ pOutliner->SetVertical( SID_DRAW_TEXT_VERTICAL == nDrawSfxId ||
+ SID_DRAW_CAPTION_VERTICAL == nDrawSfxId );
+ // #i7672#
+ // No longer necessary, see text below
+ // Color aBackground(pSh->GetShapeBackgrd());
+ // pOutliner->SetBackgroundColor(aBackground);
+
+ // OD 09.12.2002 #103045# - set default horizontal text direction at outliner
+ EEHorizontalTextDirection aDefHoriTextDir =
+ pSh->IsShapeDefaultHoriTextDirR2L() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
+ pOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir );
+ }
+
+ // #108784#
+ // To allow editing the referenced object from a SwDrawVirtObj here
+ // the original needs to be fetched evenually. This ATM activates the
+ // text edit mode for the original object.
+ SdrObject* pToBeActivated = pObj;
+
+ // #108784#
+ // Always the original object is edited. To allow the TextEdit to happen
+ // where the VirtObj is positioned, on demand a occurring offset is set at
+ // the TextEdit object. That offset is used for creating and managing the
+ // OutlinerView.
+ Point aNewTextEditOffset(0, 0);
+
+ if(pObj->ISA(SwDrawVirtObj))
+ {
+ SwDrawVirtObj* pVirtObj = (SwDrawVirtObj*)pObj;
+ pToBeActivated = &((SdrObject&)pVirtObj->GetReferencedObj());
+ aNewTextEditOffset = pVirtObj->GetOffset();
+ }
+
+ // set in each case, thus it will be correct for all objects
+ ((SdrTextObj*)pToBeActivated)->SetTextEditOffset(aNewTextEditOffset);
+
+ sal_Bool bRet(pSdrView->SdrBeginTextEdit( pToBeActivated, pPV, pWin, sal_True, pOutliner, 0, sal_False, sal_False, sal_False ));
+
+ // #i7672#
+ // Since SdrBeginTextEdit actually creates the OutlinerView and thus also
+ // sets the background color, an own background color needs to be set
+ // after TextEditing was started. This is now done here.
+ if(bRet)
+ {
+ OutlinerView* pView = pSdrView->GetTextEditOutlinerView();
+
+ if(pView)
+ {
+ Color aBackground(pSh->GetShapeBackgrd());
+ pView->SetBackgroundColor(aBackground);
+ }
+
+ // editing should start at the end of text, spell checking at the beginning ...
+ ESelection aNewSelection(EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND, EE_PARA_NOT_FOUND, EE_INDEX_NOT_FOUND);
+ if (bSetSelectionToStart)
+ aNewSelection = ESelection();
+ pView->SetSelection(aNewSelection);
+ }
+
+ return bRet;
+}
+
+/******************************************************************************
+ * Beschreibung: Ist ein DrawTextObjekt selektiert?
+ ******************************************************************************/
+
+
+
+sal_Bool SwView::IsTextTool() const
+{
+ sal_uInt16 nId;
+ sal_uInt32 nInvent;
+ SdrView *pSdrView = GetWrtShell().GetDrawView();
+ ASSERT( pSdrView, "IsTextTool without DrawView?" );
+
+ if (pSdrView->IsCreateMode())
+ pSdrView->SetCreateMode(sal_False);
+
+ pSdrView->TakeCurrentObj(nId,nInvent);
+ return (nInvent==SdrInventor);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+SdrView* SwView::GetDrawView() const
+{
+ return GetWrtShell().GetDrawView();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+sal_Bool SwView::IsBezierEditMode()
+{
+ return (!IsDrawSelMode() && GetWrtShell().GetDrawView()->HasMarkablePoints());
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Bool SwView::IsFormMode() const
+{
+ if (GetDrawFuncPtr() && GetDrawFuncPtr()->IsCreateObj())
+ {
+ return (GetDrawFuncPtr()->IsInsertForm());
+ }
+
+ return AreOnlyFormsSelected();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+void SwView::SetDrawFuncPtr(SwDrawBase* pFuncPtr)
+{
+ if (pDrawActual)
+ delete pDrawActual;
+ pDrawActual = pFuncPtr;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwView::SetSelDrawSlot()
+{
+ nDrawSfxId = SID_OBJECT_SELECT;
+ sDrawCustom.Erase();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Bool SwView::AreOnlyFormsSelected() const
+{
+ if ( GetWrtShell().IsFrmSelected() )
+ return sal_False;
+
+ sal_Bool bForm = sal_True;
+
+ SdrView* pSdrView = GetWrtShell().GetDrawView();
+
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ sal_uInt32 nCount = rMarkList.GetMarkCount();
+
+ if (nCount)
+ {
+ for (sal_uInt32 i = 0; i < nCount; i++)
+ {
+ // Sind ausser Controls noch normale Draw-Objekte selektiert?
+ SdrObject *pSdrObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+
+ if (!HasOnlyObj(pSdrObj, FmFormInventor))
+ {
+ bForm = sal_False;
+ break;
+ }
+ }
+ }
+ else
+ bForm = sal_False;
+
+ return bForm;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Bool SwView::HasDrwObj(SdrObject *pSdrObj) const
+{
+ sal_Bool bRet = sal_False;
+
+ if (pSdrObj->IsGroupObject())
+ {
+ SdrObjList* pList = pSdrObj->GetSubList();
+ sal_uInt32 nCnt = pList->GetObjCount();
+
+ for (sal_uInt32 i = 0; i < nCnt; i++)
+ if ((bRet = HasDrwObj(pList->GetObj(i))) == sal_True)
+ break;
+ }
+ else if (SdrInventor == pSdrObj->GetObjInventor() || pSdrObj->Is3DObj())
+ return sal_True;
+
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Bool SwView::HasOnlyObj(SdrObject *pSdrObj, sal_uInt32 eObjInventor) const
+{
+ sal_Bool bRet = sal_False;
+
+ if (pSdrObj->IsGroupObject())
+ {
+ SdrObjList* pList = pSdrObj->GetSubList();
+ sal_uInt32 nCnt = pList->GetObjCount();
+
+ for (sal_uInt32 i = 0; i < nCnt; i++)
+ if ((bRet = HasOnlyObj(pList->GetObj(i), eObjInventor)) == sal_False)
+ break;
+ }
+ else if (eObjInventor == pSdrObj->GetObjInventor())
+ return sal_True;
+
+ return bRet;
+}
+
+
+//#i87414# mod
+IMPL_LINK(SwView, OnlineSpellCallback, SpellCallbackInfo*, pInfo)
+{
+ if (pInfo->nCommand == SPELLCMD_STARTSPELLDLG)
+ GetViewFrame()->GetDispatcher()->Execute( FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON);
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+sal_Bool SwView::ExecDrwTxtSpellPopup(const Point& rPt)
+{
+ sal_Bool bRet = sal_False;
+ SdrView *pSdrView = pWrtShell->GetDrawView();
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ Point aPos( GetEditWin().LogicToPixel( rPt ) );
+
+ if (pOLV->IsWrongSpelledWordAtPos( aPos ))
+ {
+ bRet = sal_True;
+ Link aLink = LINK(this, SwView, OnlineSpellCallback);
+ pOLV->ExecuteSpellPopup( aPos,&aLink );
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+sal_Bool SwView::IsDrawTextHyphenate()
+{
+ SdrView *pSdrView = pWrtShell->GetDrawView();
+ sal_Bool bHyphenate = sal_False;
+
+ SfxItemSet aNewAttr( pSdrView->GetModel()->GetItemPool(),
+ EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
+ if( pSdrView->GetAttributes( aNewAttr ) &&
+ aNewAttr.GetItemState( EE_PARA_HYPHENATE ) >= SFX_ITEM_AVAILABLE )
+ bHyphenate = ((const SfxBoolItem&)aNewAttr.Get( EE_PARA_HYPHENATE )).
+ GetValue();
+
+ return bHyphenate;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+void SwView::HyphenateDrawText()
+{
+ SdrView *pSdrView = pWrtShell->GetDrawView();
+ sal_Bool bHyphenate = IsDrawTextHyphenate();
+
+ SfxItemSet aSet( GetPool(), EE_PARA_HYPHENATE, EE_PARA_HYPHENATE );
+ aSet.Put( SfxBoolItem( EE_PARA_HYPHENATE, !bHyphenate ) );
+ pSdrView->SetAttributes( aSet );
+ GetViewFrame()->GetBindings().Invalidate(FN_HYPHENATE_OPT_DLG);
+}
+
+
+
diff --git a/sw/source/ui/uiview/viewfunc.hxx b/sw/source/ui/uiview/viewfunc.hxx
new file mode 100644
index 000000000000..6da6c01bbda4
--- /dev/null
+++ b/sw/source/ui/uiview/viewfunc.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _VIEWFUNC_HXX
+#define _VIEWFUNC_HXX
+#include <tools/solar.h>
+
+class ImageButton;
+class Point;
+class SfxItemSet;
+class SfxPrinter;
+class SfxTabPage;
+class Size;
+class SvxRuler;
+class SwScrollbar;
+class ViewShell;
+class Window;
+class SwWrtShell;
+
+// folgende Funktionen stehen im viewprt.cxx
+void SetPrinter( IDocumentDeviceAccess*, SfxPrinter*, BOOL bWeb );
+SfxTabPage* CreatePrintOptionsPage( Window*, const SfxItemSet& );
+void SetAppPrintOptions( ViewShell* pSh, BOOL bWeb );
+
+// folgende Funktionen stehen im viewport.cxx
+void ViewResizePixel( const Window &rRef,
+ const Point &rOfst,
+ const Size &rSize,
+ const Size &rEditSz,
+ const BOOL bInner,
+ SwScrollbar& rVScrollbar,
+ SwScrollbar& rHScrollbar,
+ ImageButton* pPageUpBtn,
+ ImageButton* pPageDownBtn,
+ ImageButton* pNaviBtn,
+ Window& rScrollBarBox,
+ SvxRuler* pVLineal = 0,
+ SvxRuler* pHLineal = 0,
+ BOOL bWebView = FALSE,
+ BOOL bVRulerRight = FALSE );
+
+
+#endif
diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx
new file mode 100755
index 000000000000..b3f73f7c38e4
--- /dev/null
+++ b/sw/source/ui/uiview/viewling.cxx
@@ -0,0 +1,1005 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#endif
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/linguistic2/XThesaurus.hpp>
+#include <com/sun/star/linguistic2/ProofreadingResult.hpp>
+#include <com/sun/star/i18n/TextConversionOption.hpp>
+#include <linguistic/lngprops.hxx>
+#include <comphelper/processfactory.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/msgbox.hxx>
+#include <svtools/ehdl.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/request.hxx>
+#include <svx/dlgutil.hxx>
+#include <svx/dialmgr.hxx>
+#include <editeng/langitem.hxx>
+#include <svx/svxerr.hxx>
+#include <editeng/unolingu.hxx>
+#include <svx/svxdlg.hxx>
+#include <editeng/SpellPortions.hxx>
+#include <swmodule.hxx>
+#include <swwait.hxx>
+#include <initui.hxx> // fuer SpellPointer
+#include <uitool.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <basesh.hxx>
+#include <docsh.hxx> // CheckSpellChanges
+#include <viewopt.hxx> // Viewoptions
+#include <swundo.hxx> // fuer Undo-Ids
+#include <hyp.hxx> // Trennung
+#include <olmenu.hxx> // PopupMenu fuer OnlineSpelling
+#include <pam.hxx> // Spelling: Multiselektion
+#include <edtwin.hxx>
+#include <crsskip.hxx>
+#include <ndtxt.hxx>
+#include <vcl/lstbox.hxx>
+#include <cmdid.h>
+#include <globals.hrc>
+#include <comcore.hrc> // STR_MULT_INTERACT_SPELL_WARN
+#include <view.hrc>
+#include <hhcwrp.hxx>
+#include <com/sun/star/frame/XStorable.hpp>
+
+#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/util/URL.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+
+#include <unotools/processfactory.hxx>
+
+#include <vcl/svapp.hxx>
+#include <rtl/ustring.hxx>
+
+#include <cppuhelper/bootstrap.hxx>
+#include "stmenu.hxx" // PopupMenu for smarttags
+#include <svx/dialogs.hrc>
+#include <svtools/langtab.hxx>
+#include <unomid.h>
+#include <IMark.hxx>
+#include <xmloff/odffields.hxx>
+
+#include <memory>
+#include <editeng/editerr.hxx>
+
+using namespace sw::mark;
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::com::sun::star::smarttags;
+
+/*--------------------------------------------------------------------
+ Beschreibung: Lingu-Dispatcher
+ --------------------------------------------------------------------*/
+
+
+void SwView::ExecLingu(SfxRequest &rReq)
+{
+ switch(rReq.GetSlot())
+ {
+ case SID_THESAURUS:
+ StartThesaurus();
+ rReq.Ignore();
+ break;
+ case SID_HANGUL_HANJA_CONVERSION:
+ StartTextConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL,
+ i18n::TextConversionOption::CHARACTER_BY_CHARACTER, sal_True );
+ break;
+ case SID_CHINESE_CONVERSION:
+ {
+ //open ChineseTranslationDialog
+ Reference< XComponentContext > xContext(
+ ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
+ if(xContext.is())
+ {
+ Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
+ if(xMCF.is())
+ {
+ Reference< ui::dialogs::XExecutableDialog > xDialog(
+ xMCF->createInstanceWithContext(
+ rtl::OUString::createFromAscii("com.sun.star.linguistic2.ChineseTranslationDialog")
+ , xContext), UNO_QUERY);
+ Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY );
+ if( xInit.is() )
+ {
+ // initialize dialog
+ Reference< awt::XWindow > xDialogParentWindow(0);
+ Sequence<Any> aSeq(1);
+ Any* pArray = aSeq.getArray();
+ PropertyValue aParam;
+ aParam.Name = rtl::OUString::createFromAscii("ParentWindow");
+ aParam.Value <<= makeAny(xDialogParentWindow);
+ pArray[0] <<= makeAny(aParam);
+ xInit->initialize( aSeq );
+
+ //execute dialog
+ sal_Int16 nDialogRet = xDialog->execute();
+ if( RET_OK == nDialogRet )
+ {
+ //get some parameters from the dialog
+ sal_Bool bToSimplified = sal_True;
+ sal_Bool bUseVariants = sal_True;
+ sal_Bool bCommonTerms = sal_True;
+ Reference< beans::XPropertySet > xProp( xDialog, UNO_QUERY );
+ if( xProp.is() )
+ {
+ try
+ {
+ xProp->getPropertyValue( C2U("IsDirectionToSimplified") ) >>= bToSimplified;
+ xProp->getPropertyValue( C2U("IsUseCharacterVariants") ) >>= bUseVariants;
+ xProp->getPropertyValue( C2U("IsTranslateCommonTerms") ) >>= bCommonTerms;
+ }
+ catch( Exception& )
+ {
+ }
+ }
+
+ //execute translation
+ sal_Int16 nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
+ sal_Int16 nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
+ sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
+ if( !bCommonTerms )
+ nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
+
+ Font aTargetFont = GetEditWin().GetDefaultFont( DEFAULTFONT_CJK_TEXT,
+ nTargetLang, DEFAULTFONT_FLAGS_ONLYONE );
+
+ // disallow formatting, updating the view, ... while
+ // converting the document. (saves time)
+ // Also remember the current view and cursor position for later
+ pWrtShell->StartAction();
+
+ // remember cursor position data for later restoration of the cursor
+ const SwPosition *pPoint = pWrtShell->GetCrsr()->GetPoint();
+ sal_Bool bRestoreCursor = pPoint->nNode.GetNode().IsTxtNode();
+ const SwNodeIndex aPointNodeIndex( pPoint->nNode );
+ xub_StrLen nPointIndex = pPoint->nContent.GetIndex();;
+
+ // since this conversion is not interactive the whole converted
+ // document should be undone in a single undo step.
+ pWrtShell->StartUndo( UNDO_OVERWRITE );
+
+ StartTextConversion( nSourceLang, nTargetLang, &aTargetFont, nOptions, sal_False );
+
+ pWrtShell->EndUndo( UNDO_OVERWRITE );
+
+ if (bRestoreCursor)
+ {
+ SwTxtNode *pTxtNode = aPointNodeIndex.GetNode().GetTxtNode();
+ // check for unexpected error case
+ DBG_ASSERT( pTxtNode && pTxtNode->GetTxt().Len() >= nPointIndex,
+ "text missing: corrupted node?" );
+ if (!pTxtNode || pTxtNode->GetTxt().Len() < nPointIndex)
+ nPointIndex = 0;
+ // restore cursor to its original position
+ pWrtShell->GetCrsr()->GetPoint()->nContent.Assign( pTxtNode, nPointIndex );
+ }
+
+ // enable all, restore view and cursor position
+ pWrtShell->EndAction();
+ }
+ }
+ Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY );
+ if( xComponent.is() )
+ xComponent->dispose();
+ }
+ }
+ break;
+ }
+ case FN_HYPHENATE_OPT_DLG:
+ HyphenateDocument();
+ break;
+ default:
+ ASSERT(!this, falscher Dispatcher);
+ return;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Description: start language specific text conversion
+ --------------------------------------------------------------------*/
+
+void SwView::StartTextConversion(
+ LanguageType nSourceLang,
+ LanguageType nTargetLang,
+ const Font *pTargetFont,
+ sal_Int32 nOptions,
+ sal_Bool bIsInteractive )
+{
+ // do not do text conversion if it is active elsewhere
+ if (GetWrtShell().HasConvIter())
+ {
+ return;
+ }
+
+ SpellKontext(sal_True);
+
+ const SwViewOption* pVOpt = pWrtShell->GetViewOptions();
+ const sal_Bool bOldIdle = pVOpt->IsIdle();
+ pVOpt->SetIdle( sal_False );
+
+ sal_Bool bOldIns = pWrtShell->IsInsMode();
+ pWrtShell->SetInsMode( sal_True );
+
+ sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection() ||
+ pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext();
+
+ sal_Bool bStart = bSelection || pWrtShell->IsStartOfDoc();
+ sal_Bool bOther = !bSelection && !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY);
+
+ {
+ const uno::Reference< lang::XMultiServiceFactory > xMgr(
+ comphelper::getProcessServiceFactory() );
+ SwHHCWrapper aWrap( this, xMgr, nSourceLang, nTargetLang, pTargetFont,
+ nOptions, bIsInteractive,
+ bStart, bOther, bSelection );
+ aWrap.Convert();
+ }
+
+ pWrtShell->SetInsMode( bOldIns );
+ pVOpt->SetIdle( bOldIdle );
+ SpellKontext(sal_False);
+}
+
+/*--------------------------------------------------------------------
+ spellcheck and text conversion related stuff
+ --------------------------------------------------------------------*/
+
+void SwView::SpellStart( SvxSpellArea eWhich,
+ sal_Bool bStartDone, sal_Bool bEndDone,
+ SwConversionArgs *pConvArgs )
+{
+ Reference< beans::XPropertySet > xProp( ::GetLinguPropertySet() );
+ sal_Bool bIsWrapReverse = (!pConvArgs && xProp.is()) ?
+ *(sal_Bool*)xProp->getPropertyValue( C2U(UPN_IS_WRAP_REVERSE) ).getValue() : sal_False;
+
+ SwDocPositions eStart = DOCPOS_START;
+ SwDocPositions eEnde = DOCPOS_END;
+ SwDocPositions eCurr = DOCPOS_CURR;
+ switch ( eWhich )
+ {
+ case SVX_SPELL_BODY:
+ if( bIsWrapReverse )
+ eCurr = DOCPOS_END;
+ else
+ eCurr = DOCPOS_START;
+ break;
+ case SVX_SPELL_BODY_END:
+ if( bIsWrapReverse )
+ {
+ if( bStartDone )
+ eStart = DOCPOS_CURR;
+ eCurr = DOCPOS_END;
+ }
+ else if( bStartDone )
+ eCurr = DOCPOS_START;
+ break;
+ case SVX_SPELL_BODY_START:
+ if( !bIsWrapReverse )
+ {
+ if( bEndDone )
+ eEnde = DOCPOS_CURR;
+ eCurr = DOCPOS_START;
+ }
+ else if( bEndDone )
+ eCurr = DOCPOS_END;
+ break;
+ case SVX_SPELL_OTHER:
+ if( bIsWrapReverse )
+ {
+ eStart = DOCPOS_OTHERSTART;
+ eEnde = DOCPOS_OTHEREND;
+ eCurr = DOCPOS_OTHEREND;
+ }
+ else
+ {
+ eStart = DOCPOS_OTHERSTART;
+ eEnde = DOCPOS_OTHEREND;
+ eCurr = DOCPOS_OTHERSTART;
+ }
+ break;
+ default:
+ ASSERT( !this, "SpellStart with unknown Area" );
+ }
+ pWrtShell->SpellStart( eStart, eEnde, eCurr, pConvArgs );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Fehlermeldung beim Spelling
+ --------------------------------------------------------------------*/
+
+
+// Der uebergebene Pointer nLang ist selbst der Wert
+IMPL_LINK( SwView, SpellError, LanguageType *, pLang )
+{
+#if OSL_DEBUG_LEVEL > 1
+ sal_Bool bFocus = GetEditWin().HasFocus();
+#endif
+ sal_uInt16 nPend = 0;
+
+ if ( pWrtShell->ActionPend() )
+ {
+ pWrtShell->Push();
+ pWrtShell->ClearMark();
+ do
+ {
+ pWrtShell->EndAction();
+ ++nPend;
+ }
+ while( pWrtShell->ActionPend() );
+ }
+ LanguageType eLang = pLang ? *pLang : LANGUAGE_NONE;
+ String aErr(SvtLanguageTable::GetLanguageString( eLang ) );
+
+ SwEditWin &rEditWin = GetEditWin();
+#if OSL_DEBUG_LEVEL > 1
+ bFocus = rEditWin.HasFocus();
+#endif
+ sal_uInt16 nWaitCnt = 0;
+ while( rEditWin.IsWait() )
+ {
+ rEditWin.LeaveWait();
+ ++nWaitCnt;
+ }
+ if ( LANGUAGE_NONE == eLang )
+ ErrorHandler::HandleError( ERRCODE_SVX_LINGU_NOLANGUAGE );
+ else
+ ErrorHandler::HandleError( *new StringErrorInfo( ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS, aErr ) );
+
+ while( nWaitCnt )
+ {
+ rEditWin.EnterWait();
+ --nWaitCnt;
+ }
+#if OSL_DEBUG_LEVEL > 1
+ bFocus = GetEditWin().HasFocus();
+#endif
+
+ if ( nPend )
+ {
+ while( nPend-- )
+ pWrtShell->StartAction();
+ pWrtShell->Combine();
+ }
+#if OSL_DEBUG_LEVEL > 1
+ if( !bFocus )
+ GetEditWin().GrabFocus();
+#endif
+
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Spelling beenden und Cursor wiederherstellen
+ --------------------------------------------------------------------*/
+
+
+void SwView::SpellEnd( SwConversionArgs *pConvArgs )
+{
+ pWrtShell->SpellEnd( pConvArgs );
+ if( pWrtShell->IsExtMode() )
+ pWrtShell->SetMark();
+}
+
+
+void SwView::HyphStart( SvxSpellArea eWhich )
+{
+ switch ( eWhich )
+ {
+ case SVX_SPELL_BODY:
+ pWrtShell->HyphStart( DOCPOS_START, DOCPOS_END );
+ break;
+ case SVX_SPELL_BODY_END:
+ pWrtShell->HyphStart( DOCPOS_CURR, DOCPOS_END );
+ break;
+ case SVX_SPELL_BODY_START:
+ pWrtShell->HyphStart( DOCPOS_START, DOCPOS_CURR );
+ break;
+ case SVX_SPELL_OTHER:
+ pWrtShell->HyphStart( DOCPOS_OTHERSTART, DOCPOS_OTHEREND );
+ break;
+ default:
+ ASSERT( !this, "HyphStart with unknown Area" );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Interaktive Trennung
+ --------------------------------------------------------------------*/
+
+
+void SwView::HyphenateDocument()
+{
+ // do not hyphenate if interactive hyphenationg is active elsewhere
+ if (GetWrtShell().HasHyphIter())
+ {
+ MessBox( 0, WB_OK, String( SW_RES( STR_HYPH_TITLE ) ),
+ String( SW_RES( STR_MULT_INTERACT_HYPH_WARN ) ) ).Execute();
+ return;
+ }
+
+ SfxErrorContext aContext( ERRCTX_SVX_LINGU_HYPHENATION, aEmptyStr, pEditWin,
+ RID_SVXERRCTX, &DIALOG_MGR() );
+
+ Reference< XHyphenator > xHyph( ::GetHyphenator() );
+ if (!xHyph.is())
+ {
+ ErrorHandler::HandleError( ERRCODE_SVX_LINGU_LINGUNOTEXISTS );
+ return;
+ }
+
+ if (pWrtShell->GetSelectionType() & (nsSelectionType::SEL_DRW_TXT|nsSelectionType::SEL_DRW))
+ {
+ // Silbentrennung in einem Draw-Objekt
+ HyphenateDrawText();
+ }
+ else
+ {
+ SwViewOption* pVOpt = (SwViewOption*)pWrtShell->GetViewOptions();
+ sal_Bool bOldIdle = pVOpt->IsIdle();
+ pVOpt->SetIdle( sal_False );
+
+ Reference< beans::XPropertySet > xProp( ::GetLinguPropertySet() );
+
+
+ pWrtShell->StartUndo(UNDO_INSATTR); // spaeter gueltig
+
+ sal_Bool bHyphSpecial = xProp.is() ?
+ *(sal_Bool*)xProp->getPropertyValue( C2U(UPN_IS_HYPH_SPECIAL) ).getValue() : sal_False;
+ sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection() ||
+ pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext();
+ sal_Bool bOther = pWrtShell->HasOtherCnt() && bHyphSpecial && !bSelection;
+ sal_Bool bStart = bSelection || ( !bOther && pWrtShell->IsStartOfDoc() );
+ sal_Bool bStop = sal_False;
+ if( !bOther && !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY) && !bSelection )
+ // kein Sonderbereich eingeschaltet
+ {
+ // Ich will auch in Sonderbereichen trennen
+ QueryBox aBox( &GetEditWin(), SW_RES( DLG_SPECIAL_FORCED ) );
+ if( aBox.Execute() == RET_YES )
+ {
+ bOther = sal_True;
+ if (xProp.is())
+ {
+ sal_Bool bTrue = sal_True;
+ Any aTmp(&bTrue, ::getBooleanCppuType());
+ xProp->setPropertyValue( C2U(UPN_IS_HYPH_SPECIAL), aTmp );
+ }
+ }
+ else
+ bStop = sal_True; // Nein Es wird nicht getrennt
+ }
+
+ if( !bStop )
+ {
+ SwHyphWrapper aWrap( this, xHyph, bStart, bOther, bSelection );
+ aWrap.SpellDocument();
+ pWrtShell->EndUndo(UNDO_INSATTR);
+ }
+ pVOpt->SetIdle( bOldIdle );
+ }
+}
+
+/*--------------------------------------------------------------------
+ --------------------------------------------------------------------*/
+
+bool SwView::IsValidSelectionForThesaurus() const
+{
+ // must not be a multi-selection, and if it is a selection it needs
+ // to be within a single paragraph
+
+ const bool bMultiSel = pWrtShell->GetCrsr() != pWrtShell->GetCrsr()->GetNext();
+ const sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection();
+ return !bMultiSel && (!bSelection || pWrtShell->IsSelOnePara() );
+}
+
+
+String SwView::GetThesaurusLookUpText( bool bSelection ) const
+{
+ return bSelection ? pWrtShell->GetSelTxt() : pWrtShell->GetCurWord();
+}
+
+
+void SwView::InsertThesaurusSynonym( const String &rSynonmText, const String &rLookUpText, bool bSelection )
+{
+ sal_Bool bOldIns = pWrtShell->IsInsMode();
+ pWrtShell->SetInsMode( sal_True );
+
+ pWrtShell->StartAllAction();
+ pWrtShell->StartUndo(UNDO_DELETE);
+
+ if( !bSelection )
+ {
+ if(pWrtShell->IsEndWrd())
+ pWrtShell->Left(CRSR_SKIP_CELLS, FALSE, 1, FALSE );
+
+ pWrtShell->SelWrd();
+
+ // make sure the selection build later from the
+ // data below does not include footnotes and other
+ // "in word" character to the left and right in order
+ // to preserve those. Therefore count those "in words"
+ // in order to modify the selection accordingly.
+ const sal_Unicode* pChar = rLookUpText.GetBuffer();
+ xub_StrLen nLeft = 0;
+ while (pChar && *pChar++ == CH_TXTATR_INWORD)
+ ++nLeft;
+ pChar = rLookUpText.Len() ? rLookUpText.GetBuffer() + rLookUpText.Len() - 1 : 0;
+ xub_StrLen nRight = 0;
+ while (pChar && *pChar-- == CH_TXTATR_INWORD)
+ ++nRight;
+
+ // adjust existing selection
+ SwPaM *pCrsr = pWrtShell->GetCrsr();
+ pCrsr->GetPoint()->nContent/*.nIndex*/ -= nRight;
+ pCrsr->GetMark()->nContent/*.nIndex*/ += nLeft;
+ }
+
+ pWrtShell->Insert( rSynonmText );
+
+ pWrtShell->EndUndo(UNDO_DELETE);
+ pWrtShell->EndAllAction();
+
+ pWrtShell->SetInsMode( bOldIns );
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Thesaurus starten
+ --------------------------------------------------------------------*/
+
+
+void SwView::StartThesaurus()
+{
+ if (!IsValidSelectionForThesaurus())
+ return;
+
+ SfxErrorContext aContext( ERRCTX_SVX_LINGU_THESAURUS, aEmptyStr, pEditWin,
+ RID_SVXERRCTX, &DIALOG_MGR() );
+
+ // Sprache rausholen
+ //
+ LanguageType eLang = pWrtShell->GetCurLang();
+ if( LANGUAGE_SYSTEM == eLang )
+ eLang = GetAppLanguage();
+
+ if( eLang == LANGUAGE_DONTKNOW || eLang == LANGUAGE_NONE )
+ {
+ LanguageType nLanguage = LANGUAGE_NONE;
+ SpellError( &nLanguage );
+ return;
+ }
+
+ SwViewOption* pVOpt = (SwViewOption*)pWrtShell->GetViewOptions();
+ sal_Bool bOldIdle = pVOpt->IsIdle();
+ pVOpt->SetIdle( sal_False );
+
+ // get initial LookUp text
+ const sal_Bool bSelection = ((SwCrsrShell*)pWrtShell)->HasSelection();
+ String aTmp = GetThesaurusLookUpText( bSelection );
+
+ Reference< XThesaurus > xThes( ::GetThesaurus() );
+ AbstractThesaurusDialog *pDlg = NULL;
+
+ if ( !xThes.is() || !xThes->hasLocale( SvxCreateLocale( eLang ) ) )
+ SpellError( &eLang );
+ else
+ {
+ // create dialog
+ { //Scope for SwWait-Object
+ SwWait aWait( *GetDocShell(), sal_True );
+ // load library with dialog only on demand ...
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ pDlg = pFact->CreateThesaurusDialog( &GetEditWin(), xThes, aTmp, eLang );
+ }
+
+ if ( pDlg->Execute()== RET_OK )
+ InsertThesaurusSynonym( pDlg->GetWord(), aTmp, bSelection );
+ }
+
+ delete pDlg;
+
+ pVOpt->SetIdle( bOldIdle );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Online-Vorschlaege anbieten
+ *--------------------------------------------------------------------*/
+
+//!! Start of extra code for context menu modifying extensions
+struct ExecuteInfo
+{
+ uno::Reference< frame::XDispatch > xDispatch;
+ util::URL aTargetURL;
+ uno::Sequence< PropertyValue > aArgs;
+};
+
+class AsyncExecute
+{
+public:
+ DECL_STATIC_LINK( AsyncExecute, ExecuteHdl_Impl, ExecuteInfo* );
+};
+
+IMPL_STATIC_LINK_NOINSTANCE( AsyncExecute, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo )
+{
+ const sal_uInt32 nRef = Application::ReleaseSolarMutex();
+ try
+ {
+ // Asynchronous execution as this can lead to our own destruction!
+ // Framework can recycle our current frame and the layout manager disposes all user interface
+ // elements if a component gets detached from its frame!
+ pExecuteInfo->xDispatch->dispatch( pExecuteInfo->aTargetURL, pExecuteInfo->aArgs );
+ }
+ catch ( Exception& )
+ {
+ }
+
+ Application::AcquireSolarMutex( nRef );
+ delete pExecuteInfo;
+ return 0;
+}
+//!! End of extra code for context menu modifying extensions
+
+sal_Bool SwView::ExecSpellPopup(const Point& rPt)
+{
+ sal_Bool bRet = sal_False;
+ const SwViewOption* pVOpt = pWrtShell->GetViewOptions();
+ if( pVOpt->IsOnlineSpell() &&
+ !pWrtShell->IsSelection())
+ {
+ if (pWrtShell->GetSelectionType() & nsSelectionType::SEL_DRW_TXT)
+ bRet = ExecDrwTxtSpellPopup(rPt);
+ else if (!pWrtShell->IsSelFrmMode())
+ {
+ const sal_Bool bOldViewLock = pWrtShell->IsViewLocked();
+ pWrtShell->LockView( sal_True );
+ pWrtShell->Push();
+ SwRect aToFill;
+
+ // decide which variant of the context menu to use...
+ // if neither spell checking nor grammar checking provides suggestions use the
+ // default context menu.
+ bool bUseGrammarContext = false;
+ Reference< XSpellAlternatives > xAlt( pWrtShell->GetCorrection(&rPt, aToFill) );
+ /*linguistic2::*/ProofreadingResult aGrammarCheckRes;
+ sal_Int32 nErrorPosInText = -1;
+ sal_Int32 nErrorInResult = -1;
+ uno::Sequence< rtl::OUString > aSuggestions;
+ bool bCorrectionRes = false;
+ if (!xAlt.is() || xAlt->getAlternatives().getLength() == 0)
+ {
+ bCorrectionRes = pWrtShell->GetGrammarCorrection( aGrammarCheckRes, nErrorPosInText, nErrorInResult, aSuggestions, &rPt, aToFill );
+ ::rtl::OUString aMessageText;
+ if (nErrorInResult >= 0)
+ aMessageText = aGrammarCheckRes.aErrors[ nErrorInResult ].aShortComment;
+ // we like to use the grammar checking context menu if we either get
+ // some suggestions or at least a comment about the error found...
+ bUseGrammarContext = bCorrectionRes &&
+ (aSuggestions.getLength() > 0 || aMessageText.getLength() > 0);
+ }
+
+ // open respective context menu for spell check or grammar errors with correction suggestions...
+ if ((!bUseGrammarContext && xAlt.is()) ||
+ (bUseGrammarContext && bCorrectionRes && aGrammarCheckRes.aErrors.getLength() > 0))
+ {
+ // get paragraph text
+ String aParaText;
+ SwPosition aPoint( *pWrtShell->GetCrsr()->GetPoint() );
+ const SwTxtNode *pNode = dynamic_cast< const SwTxtNode * >(
+ &aPoint.nNode.GetNode() );
+ if (pNode)
+ aParaText = pNode->GetTxt(); // this may include hidden text but that should be Ok
+ else
+ {
+ DBG_ERROR( "text node expected but not found" );
+ }
+
+ bRet = sal_True;
+ pWrtShell->SttSelect();
+ std::auto_ptr< SwSpellPopup > pPopup;
+ if (bUseGrammarContext)
+ {
+ sal_Int32 nPos = aPoint.nContent.GetIndex();
+ (void) nPos;
+ pPopup = std::auto_ptr< SwSpellPopup >(new SwSpellPopup( pWrtShell, aGrammarCheckRes, nErrorInResult, aSuggestions, aParaText ));
+ }
+ else
+ pPopup = std::auto_ptr< SwSpellPopup >(new SwSpellPopup( pWrtShell, xAlt, aParaText ));
+ ui::ContextMenuExecuteEvent aEvent;
+ const Point aPixPos = GetEditWin().LogicToPixel( rPt );
+
+ aEvent.SourceWindow = VCLUnoHelper::GetInterface( pEditWin );
+ aEvent.ExecutePosition.X = aPixPos.X();
+ aEvent.ExecutePosition.Y = aPixPos.Y();
+ Menu* pMenu = 0;
+
+ ::rtl::OUString sMenuName = ::rtl::OUString::createFromAscii(
+ bUseGrammarContext ? "private:resource/GrammarContextMenu" : "private:resource/SpellContextMenu");
+ if(TryContextMenuInterception( *pPopup, sMenuName, pMenu, aEvent ))
+ {
+
+ //! happy hacking for context menu modifying extensions of this
+ //! 'custom made' menu... *sigh* (code copied from sfx2 and framework)
+ if ( pMenu )
+ {
+ OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
+ USHORT nId = ((PopupMenu*)pMenu)->Execute(pEditWin, aPixPos);
+ OUString aCommand = ((PopupMenu*)pMenu)->GetItemCommand(nId);
+ if (aCommand.getLength() == 0 )
+ {
+ if(!ExecuteMenuCommand( *dynamic_cast<PopupMenu*>(pMenu), *GetViewFrame(), nId ))
+ pPopup->Execute(nId);
+ }
+ else
+ {
+ SfxViewFrame *pSfxViewFrame = GetViewFrame();
+ uno::Reference< frame::XFrame > xFrame;
+ if ( pSfxViewFrame )
+ xFrame = pSfxViewFrame->GetFrame().GetFrameInterface();
+ com::sun::star::util::URL aURL;
+ uno::Reference< frame::XDispatchProvider > xDispatchProvider( xFrame, UNO_QUERY );
+ uno::Reference< lang::XMultiServiceFactory > xMgr( utl::getProcessServiceFactory(), uno::UNO_QUERY );
+
+ try
+ {
+ uno::Reference< frame::XDispatch > xDispatch;
+ uno::Reference< util::XURLTransformer > xURLTransformer;
+ if (xMgr.is())
+ {
+ xURLTransformer = uno::Reference< util::XURLTransformer >( xMgr->createInstance(
+ C2U("com.sun.star.util.URLTransformer")), UNO_QUERY);
+ }
+
+ aURL.Complete = aCommand;
+ xURLTransformer->parseStrict(aURL);
+ uno::Sequence< beans::PropertyValue > aArgs;
+ xDispatch = xDispatchProvider->queryDispatch( aURL, rtl::OUString(), 0 );
+
+
+ if (xDispatch.is())
+ {
+ // Execute dispatch asynchronously
+ ExecuteInfo* pExecuteInfo = new ExecuteInfo;
+ pExecuteInfo->xDispatch = xDispatch;
+ pExecuteInfo->aTargetURL = aURL;
+ pExecuteInfo->aArgs = aArgs;
+ Application::PostUserEvent( STATIC_LINK(0, AsyncExecute , ExecuteHdl_Impl), pExecuteInfo );
+ }
+ }
+ catch (Exception &)
+ {
+ }
+ }
+ }
+ else
+ {
+ pPopup->Execute( aToFill.SVRect(), pEditWin );
+ }
+ }
+ }
+
+ pWrtShell->Pop( sal_False );
+ pWrtShell->LockView( bOldViewLock );
+ }
+ }
+ return bRet;
+}
+
+/** Function: ExecSmartTagPopup
+
+ This function shows the popup menu for smarttag
+ actions.
+*/
+
+sal_Bool SwView::ExecSmartTagPopup( const Point& rPt )
+{
+ sal_Bool bRet = sal_False;
+ const sal_Bool bOldViewLock = pWrtShell->IsViewLocked();
+ pWrtShell->LockView( sal_True );
+ pWrtShell->Push();
+
+
+ // get word that was clicked on
+ // This data structure maps a smart tag type string to the property bag
+ SwRect aToFill;
+ Sequence< rtl::OUString > aSmartTagTypes;
+ Sequence< Reference< container::XStringKeyMap > > aStringKeyMaps;
+ Reference<text::XTextRange> xRange;
+
+ pWrtShell->GetSmartTagTerm( rPt, aToFill, aSmartTagTypes, aStringKeyMaps, xRange);
+ if ( xRange.is() && aSmartTagTypes.getLength() )
+ {
+ bRet = sal_True;
+ pWrtShell->SttSelect();
+ SwSmartTagPopup aPopup( this, aSmartTagTypes, aStringKeyMaps, xRange );
+ aPopup.Execute( aToFill.SVRect(), pEditWin );
+ }
+
+ pWrtShell->Pop( sal_False );
+ pWrtShell->LockView( bOldViewLock );
+
+ return bRet;
+}
+
+
+
+class SwFieldPopup : public PopupMenu
+{
+public:
+ SwFieldPopup() {
+ InsertItem(1, ::rtl::OUString::createFromAscii("Hello"));
+ }
+};
+
+class SwFieldListBox : public ListBox
+{
+public:
+ SwFieldListBox(Window* pParent) : ListBox(pParent /*, WB_DROPDOWN*/) {
+ }
+
+ void *GetImplWin() {
+ return NULL; //FIXME!!!
+// return mpImplWin;
+ }
+
+protected:
+ virtual void LoseFocus() {
+// printf("ListBox: lose focus!!\n");
+ ListBox::LoseFocus();
+ }
+
+ virtual void Select() {
+// printf("SELECT!!! IsTravelSelect=%i\n", IsTravelSelect());
+ ListBox::Select();
+ }
+};
+
+class SwFieldDialog : public Dialog
+{
+private:
+ SwFieldListBox aListBox;
+ Edit aText;
+ int selection;
+
+ DECL_LINK( MyListBoxHandler, ListBox * );
+
+public:
+ SwFieldDialog(Window* parent, IFieldmark *fieldBM) : Dialog(parent, WB_BORDER | WB_SYSTEMWINDOW | WB_NOSHADOW ), aListBox(this), aText(this, WB_RIGHT | WB_READONLY), selection(-1) {
+
+ assert(fieldBM!=NULL);
+ if (fieldBM!=NULL) {
+ const IFieldmark::parameter_map_t* const pParameters = fieldBM->GetParameters();
+ IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN_LISTENTRY));
+ if(pListEntries != pParameters->end())
+ {
+ Sequence< ::rtl::OUString> vListEntries;
+ pListEntries->second >>= vListEntries;
+ for( ::rtl::OUString* pCurrent = vListEntries.getArray();
+ pCurrent != vListEntries.getArray() + vListEntries.getLength();
+ ++pCurrent)
+ {
+ aListBox.InsertEntry(*pCurrent);
+ }
+ }
+ }
+ Size lbSize=aListBox.GetOptimalSize(WINDOWSIZE_PREFERRED);
+ lbSize.Width()+=50;
+ lbSize.Height()+=20;
+ aListBox.SetSizePixel(lbSize);
+ aListBox.SetSelectHdl( LINK( this, SwFieldDialog, MyListBoxHandler ) );
+ aListBox.Show();
+ aText.SetText(rtl::OUString::createFromAscii("Cancel"));
+ Size tSize=aText.GetOptimalSize(WINDOWSIZE_PREFERRED);
+ aText.SetSizePixel(Size(lbSize.Width(), tSize.Height()));
+ aText.SetPosPixel(Point(0, lbSize.Height()));
+ aText.Show();
+ SetSizePixel(Size(lbSize.Width(), lbSize.Height()+tSize.Height()));
+// SetSizePixel(Size(200, 200));
+ }
+
+ int getSelection() {
+ return selection;
+ }
+protected:
+ /*
+ virtual void LoseFocus() {
+ printf("lose focus!!\n");
+ Dialog::LoseFocus();
+ printf("close:\n");
+ EndDialog(8);
+ }
+ */
+
+ virtual long PreNotify( NotifyEvent& rNEvt ) {
+ if (rNEvt.GetType() == EVENT_LOSEFOCUS && aListBox.GetImplWin()==rNEvt.GetWindow()) {
+ EndDialog(8);
+ return 1;
+ }
+ if (rNEvt.GetType() == EVENT_KEYINPUT) {
+// printf("PreNotify::KEYINPUT\n");
+ }
+ return Dialog::PreNotify(rNEvt);
+ }
+};
+
+IMPL_LINK( SwFieldDialog, MyListBoxHandler, ListBox *, pBox )
+{
+// printf("### DROP DOWN SELECT... IsTravelSelect=%i\n", pBox->IsTravelSelect());
+ if (pBox->IsTravelSelect()) {
+ return 0;
+ } else {
+ this->selection=pBox->GetSelectEntryPos();
+ EndDialog(9); //@TODO have meaningfull returns...
+ return 1;
+ }
+}
+
+
+BOOL SwView::ExecFieldPopup( const Point& rPt, IFieldmark *fieldBM )
+{
+ sal_Bool bRet = sal_False;
+ const sal_Bool bOldViewLock = pWrtShell->IsViewLocked();
+ pWrtShell->LockView( sal_True );
+ pWrtShell->Push();
+
+ bRet=sal_True;
+ const Point aPixPos = GetEditWin().LogicToPixel( rPt );
+
+ SwFieldDialog aFldDlg(pEditWin, fieldBM);
+ aFldDlg.SetPosPixel(pEditWin->OutputToScreenPixel(aPixPos));
+
+ /*short ret=*/aFldDlg.Execute();
+ sal_Int32 selection=aFldDlg.getSelection();
+ if (selection>=0) {
+ (*fieldBM->GetParameters())[::rtl::OUString::createFromAscii(ODF_FORMDROPDOWN_RESULT)] = makeAny(selection);
+ }
+
+ pWrtShell->Pop( sal_False );
+ pWrtShell->LockView( bOldViewLock );
+
+ return bRet;
+}
+
diff --git a/sw/source/ui/uiview/viewmdi.cxx b/sw/source/ui/uiview/viewmdi.cxx
new file mode 100644
index 000000000000..9dfa8e79ecfa
--- /dev/null
+++ b/sw/source/ui/uiview/viewmdi.cxx
@@ -0,0 +1,754 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+
+#include "hintids.hxx"
+#include <vcl/svapp.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/ruler.hxx>
+#include <editeng/lrspitem.hxx>
+#include <svl/srchitem.hxx>
+#include <sfx2/request.hxx>
+#include <swmodule.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <viewopt.hxx>
+#include <frmatr.hxx>
+#ifndef _WDOCSH_HXX
+#include <wdocsh.hxx>
+#endif
+#include <uitool.hxx>
+#include <edtwin.hxx>
+#include <pagedesc.hxx>
+#include <IMark.hxx>
+#include <fldbas.hxx>
+#include <workctrl.hxx>
+#include <usrpref.hxx>
+#include <scroll.hxx>
+#ifndef _WVIEW_HXX
+#include <wview.hxx>
+#endif
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _VIEW_HRC
+#include <view.hrc>
+#endif
+#ifndef _RIBBAR_HRC
+#include <ribbar.hrc>
+#endif
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+
+#include <IDocumentSettingAccess.hxx>
+#include <PostItMgr.hxx>
+
+USHORT SwView::nMoveType = NID_PGE;
+sal_Int32 SwView::nActMark = 0;
+
+
+#define VIEW_IMAGECOLOR COL_LIGHTBLUE
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+
+void SwView::SetZoom( SvxZoomType eZoomType, short nFactor, BOOL bViewOnly )
+{
+ _SetZoom( GetEditWin().GetOutputSizePixel(), eZoomType, nFactor, bViewOnly );
+}
+
+void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
+ short nFactor, BOOL bViewOnly )
+{
+ BOOL bUnLockView = !pWrtShell->IsViewLocked();
+ pWrtShell->LockView( TRUE );
+ pWrtShell->LockPaint();
+
+ {
+ ACT_KONTEXT(pWrtShell);
+
+ long nFac = nFactor;
+
+ BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
+ SwMasterUsrPref *pUsrPref = (SwMasterUsrPref*)SW_MOD()->GetUsrPref(bWeb);
+
+ const SwPageDesc &rDesc = pWrtShell->GetPageDesc( pWrtShell->GetCurPageDesc() );
+ const SvxLRSpaceItem &rLRSpace = rDesc.GetMaster().GetLRSpace();
+ const SwViewOption *pOpt = pWrtShell->GetViewOptions();
+ long lLeftMargin = 0;
+
+ if( eZoomType != SVX_ZOOM_PERCENT )
+ {
+ const bool bAutomaticViewLayout = 0 == pOpt->GetViewLayoutColumns();
+
+ const SwRect aPageRect( pWrtShell->GetAnyCurRect( RECT_PAGE_CALC ) );
+ const SwRect aRootRect( pWrtShell->GetAnyCurRect( RECT_PAGES_AREA ) );
+ Size aPageSize( aPageRect.SSize() );
+ Size aRootSize( aRootRect.SSize() );
+
+ //mod #i6193# added sidebar width
+ SwPostItMgr* pPostItMgr = GetPostItMgr();
+ if (pPostItMgr->HasNotes() && pPostItMgr->ShowNotes())
+ aPageSize.Width() += pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth();
+
+ const MapMode aTmpMap( MAP_TWIP );
+ const Size aWindowSize( GetEditWin().PixelToLogic( rEditSize, aTmpMap ) );
+
+ if( nsUseOnPage::PD_MIRROR == rDesc.GetUseOn() ) // gespiegelte Seiten
+ {
+ const SvxLRSpaceItem &rLeftLRSpace = rDesc.GetLeft().GetLRSpace();
+ aPageSize.Width() += Abs( long(rLeftLRSpace.GetLeft()) - long(rLRSpace.GetLeft()) );
+ }
+
+ if( SVX_ZOOM_OPTIMAL == eZoomType )
+ {
+ if (pPostItMgr->HasNotes() && pPostItMgr->ShowNotes())
+ {
+ lLeftMargin = long(rLRSpace.GetLeft()) + aPageRect.Left() + nLeftOfst;
+ }
+ else
+ {
+ aPageSize.Width() -= ( rLRSpace.GetLeft() + rLRSpace.GetRight() + nLeftOfst * 2 );
+ lLeftMargin = long(rLRSpace.GetLeft()) + aPageRect.Left() + nLeftOfst;
+ }
+ nFac = aWindowSize.Width() * 100 / aPageSize.Width();
+ }
+ else if(SVX_ZOOM_WHOLEPAGE == eZoomType || SVX_ZOOM_PAGEWIDTH == eZoomType )
+ {
+ const long nOf = DOCUMENTBORDER * 2L;
+ long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
+ nTmpWidth += nOf;
+ aPageSize.Height() += nOf;
+ nFac = aWindowSize.Width() * 100 / nTmpWidth;
+
+ if ( SVX_ZOOM_WHOLEPAGE == eZoomType )
+ {
+ long nVisPercent = aWindowSize.Height() * 100 / aPageSize.Height();
+ nFac = Min( nFac, nVisPercent );
+ }
+ }
+ else /*if( SVX_ZOOM_PAGEWIDTH_NOBORDER == eZoomType )*/
+ {
+ const long nTmpWidth = bAutomaticViewLayout ? aPageSize.Width() : aRootSize.Width();
+ nFac = aWindowSize.Width() * 100 / nTmpWidth;
+ }
+ }
+
+ nFac = Max( long( MINZOOM ), nFac );
+
+ SwViewOption aOpt( *pOpt );
+ if ( !GetViewFrame()->GetFrame().IsInPlace() )
+ {
+ //MasterUsrPrefs updaten UND DANACH die ViewOptions der aktuellen
+ //View updaten.
+ if ( !bViewOnly &&
+ (USHORT(nFac) != pUsrPref->GetZoom() ||
+ BYTE (eZoomType) != pUsrPref->GetZoomType()) )
+ {
+ pUsrPref->SetZoom ( USHORT(nFac) );
+ pUsrPref->SetZoomType( eZoomType );
+ SW_MOD()->ApplyUsrPref( *pUsrPref,
+ bViewOnly ? this: 0,
+ bViewOnly ? VIEWOPT_DEST_VIEW_ONLY : 0 );
+ pUsrPref->SetModified();
+ }
+ if ( pOpt->GetZoom() != (USHORT) nFac )
+ {
+ aOpt.SetZoom ( USHORT(nFac) );
+ aOpt.SetReadonly(pOpt->IsReadonly());
+ pWrtShell->ApplyViewOptions( aOpt );
+ }
+ if ( eZoomType != SVX_ZOOM_PERCENT )
+ {
+ Point aPos;
+
+ if ( eZoomType == SVX_ZOOM_WHOLEPAGE )
+ aPos.Y() = pWrtShell->GetAnyCurRect(RECT_PAGE).Top() - DOCUMENTBORDER;
+ else
+ {
+ //sicherstellen, dass sich der Cursor im sichtbaren
+ //Bereich befindet, damit nur 1x gescrollt wird
+ aPos.X() = lLeftMargin;
+ const SwRect &rCharRect = pWrtShell->GetCharRect();
+ if ( rCharRect.Top() > GetVisArea().Bottom() ||
+ rCharRect.Bottom() < aPos.Y() )
+ aPos.Y() = rCharRect.Top() - rCharRect.Height();
+ else
+ aPos.Y() = GetVisArea().Top();
+ }
+ SetVisArea( aPos );
+ }
+ // OS: Notloesung - in CalcVisArea wird u.U. wieder SetZoom gerufen und
+ // dann werden falsche Werte eingestellt
+ ((SwViewOption*)pWrtShell->GetViewOptions())->SetZoomType( eZoomType );
+ CalcVisArea( rEditSize ); //fuer das Neuberechnen des sichtbaren Bereiches
+ }
+ else if ( USHORT(nFac) != pOpt->GetZoom() )
+ {
+ aOpt.SetZoom ( USHORT(nFac) );
+ pWrtShell->ApplyViewOptions( aOpt );
+ }
+
+ const Fraction aFrac( nFac, 100 );
+ pVRuler->SetZoom( aFrac );
+ pVRuler->ForceUpdate();
+ pHRuler->SetZoom( aFrac );
+ pHRuler->ForceUpdate();
+ ((SwViewOption*)pWrtShell->GetViewOptions())->SetZoomType( eZoomType );
+ }
+ pWrtShell->UnlockPaint();
+ if( bUnLockView )
+ pWrtShell->LockView( FALSE );
+
+// if ( mpPostItMgr )
+// {
+// mpPostItMgr->Rescale();
+// mpPostItMgr->CalcRects();
+// mpPostItMgr->LayoutPostIts();
+// }
+
+// eZoom = eZoomType;
+}
+
+void SwView::SetViewLayout( USHORT nColumns, bool bBookMode, BOOL bViewOnly )
+{
+ const BOOL bUnLockView = !pWrtShell->IsViewLocked();
+ pWrtShell->LockView( TRUE );
+ pWrtShell->LockPaint();
+
+ {
+
+ ACT_KONTEXT(pWrtShell);
+
+ if ( !GetViewFrame()->GetFrame().IsInPlace() && !bViewOnly )
+ {
+ const BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
+ SwMasterUsrPref *pUsrPref = (SwMasterUsrPref*)SW_MOD()->GetUsrPref(bWeb);
+
+ //MasterUsrPrefs updaten UND DANACH die ViewOptions der aktuellen
+ //View updaten.
+ if ( nColumns != pUsrPref->GetViewLayoutColumns() ||
+ bBookMode != pUsrPref->IsViewLayoutBookMode() )
+ {
+ pUsrPref->SetViewLayoutColumns( nColumns );
+ pUsrPref->SetViewLayoutBookMode( bBookMode );
+ SW_MOD()->ApplyUsrPref( *pUsrPref,
+ bViewOnly ? this: 0,
+ bViewOnly ? VIEWOPT_DEST_VIEW_ONLY : 0 );
+ pUsrPref->SetModified();
+ }
+ }
+
+ const SwViewOption *pOpt = pWrtShell->GetViewOptions();
+
+ if ( nColumns != pOpt->GetViewLayoutColumns() ||
+ bBookMode != pOpt->IsViewLayoutBookMode() )
+ {
+ SwViewOption aOpt( *pOpt );
+ aOpt.SetViewLayoutColumns( nColumns );
+ aOpt.SetViewLayoutBookMode( bBookMode );
+ pWrtShell->ApplyViewOptions( aOpt );
+ }
+
+ pVRuler->ForceUpdate();
+ pHRuler->ForceUpdate();
+
+ }
+
+ pWrtShell->UnlockPaint();
+ if( bUnLockView )
+ pWrtShell->LockView( FALSE );
+
+ SfxBindings& rBnd = GetViewFrame()->GetBindings();
+ rBnd.Invalidate( SID_ATTR_VIEWLAYOUT );
+ rBnd.Invalidate( SID_ATTR_ZOOMSLIDER);
+}
+
+/*
+ * Scrollbar - Handler
+ */
+
+int SwView::_CreateScrollbar( BOOL bHori )
+{
+ Window *pMDI = &GetViewFrame()->GetWindow();
+ SwScrollbar** ppScrollbar = bHori ? &pHScrollbar : &pVScrollbar;
+
+ ASSERT( !*ppScrollbar, "vorher abpruefen!" )
+
+ if( !bHori )
+ CreatePageButtons( !bShowAtResize );
+
+ *ppScrollbar = new SwScrollbar( pMDI, bHori );
+ UpdateScrollbars();
+ if(bHori)
+ (*ppScrollbar)->SetScrollHdl( LINK( this, SwView, EndScrollHdl ));
+ else
+ (*ppScrollbar)->SetScrollHdl( LINK( this, SwView, ScrollHdl ));
+ (*ppScrollbar)->SetEndScrollHdl( LINK( this, SwView, EndScrollHdl ));
+
+ (*ppScrollbar)->EnableDrag( TRUE );
+
+ if(GetWindow())
+ InvalidateBorder();
+
+ // Scrollbar muss nochmals getestet werden, da im InvalidateBorder u.U. der
+ // Scrollbar wieder geloescht wurde
+ if ( !bShowAtResize && (*ppScrollbar))
+ (*ppScrollbar)->ExtendedShow();
+
+ return 1;
+}
+
+void SwView::CreatePageButtons(BOOL bShow)
+{
+ Window *pMDI = &GetViewFrame()->GetWindow();
+ pPageUpBtn = new SwHlpImageButton(pMDI, SW_RES( BTN_PAGEUP ), TRUE );
+ pPageUpBtn->SetHelpId(HID_SCRL_PAGEUP);
+ pPageDownBtn = new SwHlpImageButton(pMDI, SW_RES( BTN_PAGEDOWN ), FALSE );
+ pPageDownBtn->SetHelpId(HID_SCRL_PAGEDOWN);
+ Reference< XFrame > xFrame = GetViewFrame()->GetFrame().GetFrameInterface();
+ pNaviBtn = new SwNaviImageButton(pMDI, xFrame );
+ pNaviBtn->SetHelpId(HID_SCRL_NAVI);
+ Link aLk( LINK( this, SwView, BtnPage ) );
+ pPageUpBtn->SetClickHdl( aLk );
+ pPageDownBtn->SetClickHdl( aLk );
+ if(nMoveType != NID_PGE)
+ {
+ Color aColor(VIEW_IMAGECOLOR);
+ SetImageButtonColor(aColor);
+ }
+
+ if(bShow)
+ {
+ pPageUpBtn->Show();
+ pPageDownBtn->Show();
+ pNaviBtn->Show();
+ }
+};
+
+/*
+ * Button-Handler
+ */
+IMPL_LINK( SwView, BtnPage, Button *, pButton )
+{
+ // #i75416# move the execution of the search to an asynchronously called static link
+ bool* pbNext = new bool( (pButton == pPageDownBtn) );
+ Application::PostUserEvent( STATIC_LINK(this, SwView, MoveNavigationHdl), pbNext );
+ return 0;
+}
+/*-----------------20.06.97 10:46-------------------
+
+--------------------------------------------------*/
+IMPL_STATIC_LINK( SwView, MoveNavigationHdl, bool *, pbNext )
+{
+ if ( !pbNext )
+ return 0;
+ bool bNext = *pbNext;
+ SwWrtShell& rSh = pThis->GetWrtShell();
+ switch( nMoveType )
+ {
+ case NID_PGE:
+ bNext ? pThis->PhyPageDown() : pThis->PhyPageUp();
+ break;
+ case NID_TBL :
+ rSh.EnterStdMode();
+ if(bNext)
+ rSh.MoveTable(fnTableNext, fnTableStart);
+ else
+ rSh.MoveTable(fnTablePrev, fnTableStart);
+ break;
+ case NID_FRM :
+ case NID_GRF:
+ case NID_OLE:
+ {
+ USHORT eType = GOTOOBJ_FLY_FRM;
+ if(nMoveType == NID_GRF)
+ eType = GOTOOBJ_FLY_GRF;
+ else if(nMoveType == NID_OLE)
+ eType = GOTOOBJ_FLY_OLE;
+ BOOL bSuccess = bNext ?
+ rSh.GotoNextFly(eType) :
+ rSh.GotoPrevFly(eType);
+ if(bSuccess)
+ {
+ rSh.HideCrsr();
+ rSh.EnterSelFrmMode();
+ }
+ }
+ break;
+ case NID_DRW :
+ case NID_CTRL:
+ rSh.GotoObj(bNext,
+ nMoveType == NID_DRW ?
+ GOTOOBJ_DRAW_SIMPLE :
+ GOTOOBJ_DRAW_CONTROL);
+ break;
+ case NID_REG :
+ rSh.EnterStdMode();
+ if(bNext)
+ rSh.MoveRegion(fnRegionNext, fnRegionStart);
+ else
+ rSh.MoveRegion(fnRegionPrev, fnRegionStart);
+
+ break;
+ case NID_BKM :
+ rSh.EnterStdMode();
+ pThis->GetViewFrame()->GetDispatcher()->Execute(bNext ?
+ FN_NEXT_BOOKMARK :
+ FN_PREV_BOOKMARK);
+ break;
+ case NID_OUTL:
+ rSh.EnterStdMode();
+ bNext ? rSh.GotoNextOutline() : rSh.GotoPrevOutline();
+ break;
+ case NID_SEL :
+ bNext ? rSh.GoNextCrsr() : rSh.GoPrevCrsr();
+ break;
+ case NID_FTN:
+ rSh.EnterStdMode();
+ bNext ?
+ rSh.GotoNextFtnAnchor() :
+ rSh.GotoPrevFtnAnchor();
+ break;
+ case NID_MARK:
+ {
+ // unselect
+ rSh.MoveCrsr();
+ rSh.EnterStdMode();
+
+ // collect navigator reminders
+ IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
+ ::std::vector< const ::sw::mark::IMark* > vNavMarks;
+ for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
+ ppMark != pMarkAccess->getMarksEnd();
+ ppMark++)
+ {
+ if( IDocumentMarkAccess::GetType(**ppMark) == IDocumentMarkAccess::NAVIGATOR_REMINDER )
+ vNavMarks.push_back(ppMark->get());
+ }
+
+ // move
+ if(vNavMarks.size())
+ {
+ if(bNext)
+ {
+ nActMark++;
+ if (nActMark >= MAX_MARKS || nActMark >= static_cast<sal_Int32>(vNavMarks.size()))
+ nActMark = 0;
+ }
+ else
+ {
+ nActMark--;
+ if (nActMark < 0 || nActMark >= static_cast<sal_Int32>(vNavMarks.size()))
+ nActMark = vNavMarks.size()-1;
+ }
+ rSh.GotoMark(vNavMarks[nActMark]);
+ }
+ }
+ break;
+ case NID_POSTIT:
+ {
+ sw::sidebarwindows::SwSidebarWin* pPostIt = pThis->GetPostItMgr()->GetActiveSidebarWin();
+ if (pPostIt)
+ pThis->GetPostItMgr()->SetActiveSidebarWin(0);
+ SwFieldType* pFldType = rSh.GetFldType(0, RES_POSTITFLD);
+ if (rSh.MoveFldType(pFldType, bNext))
+ pThis->GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT);
+ else
+ //first/last item
+ pThis->GetPostItMgr()->SetActiveSidebarWin(pPostIt);
+ }
+ break;
+ case NID_SRCH_REP:
+ if(pSrchItem)
+ {
+ BOOL bBackward = pSrchItem->GetBackward();
+ if(rSh.HasSelection() && !bNext == rSh.IsCrsrPtAtEnd())
+ rSh.SwapPam();
+ pSrchItem->SetBackward(!bNext);
+ SfxRequest aReq(FN_REPEAT_SEARCH, SFX_CALLMODE_SLOT, pThis->GetPool());
+ pThis->ExecSearch(aReq);
+ pSrchItem->SetBackward(bBackward);
+ }
+ break;
+ case NID_INDEX_ENTRY:
+ rSh.GotoNxtPrvTOXMark(bNext);
+ break;
+
+ case NID_TABLE_FORMULA:
+ rSh.GotoNxtPrvTblFormula( bNext );
+ break;
+
+ case NID_TABLE_FORMULA_ERROR:
+ rSh.GotoNxtPrvTblFormula( bNext, TRUE );
+ break;
+ }
+ pThis->pEditWin->GrabFocus();
+ delete pbNext;
+ return 0;
+}
+
+/*************************************************************************
+|*
+|* SwView::CreateTab()
+|*
+|* Beschreibung
+|* Ersterstellung VB 29.05.91
+|* Letzte Aenderung OS 09.05.96
+|*
+*************************************************************************/
+
+int SwView::CreateTab()
+{
+ pHRuler->SetActive(GetFrame() && IsActive());
+
+ pHRuler->Show();
+ InvalidateBorder();
+ return 1;
+}
+
+/*************************************************************************
+|*
+|* SwView::KillTab()
+|*
+|* Beschreibung
+|* Ersterstellung VB 29.05.91
+|* Letzte Aenderung OS 09.05.96
+|*
+*************************************************************************/
+
+int SwView::KillTab()
+{
+ pHRuler->Hide();
+ InvalidateBorder();
+ return 1;
+}
+
+void SwView::ChangeTabMetric( FieldUnit eUnit )
+{
+ if(pHRuler->GetUnit() != eUnit )
+ {
+ pHRuler->SetUnit( eUnit );
+ pHRuler->Invalidate();
+ }
+}
+
+void SwView::ChangeVLinealMetric( FieldUnit eUnit )
+{
+ if(pVRuler->GetUnit() != eUnit)
+ {
+ pVRuler->SetUnit( eUnit );
+ pVRuler->Invalidate();
+ }
+}
+/* -----------------------------07.04.01 17:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwView::GetVLinealMetric(FieldUnit& eToFill) const
+{
+ eToFill = pVRuler->GetUnit();
+}
+/* -----------------------------07.04.01 17:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwView::GetHLinealMetric(FieldUnit& eToFill) const
+{
+ eToFill = pHRuler->GetUnit();
+}
+/*************************************************************************
+|*
+|* SwView::CreateVLineal()
+|*
+|* Beschreibung
+|* Ersterstellung VB 29.05.91
+|*
+*************************************************************************/
+
+int SwView::CreateVLineal()
+{
+ pHRuler->SetBorderPos( pVRuler->GetSizePixel().Width()-1 );
+
+ pVRuler->SetActive(GetFrame() && IsActive());
+ pVRuler->Show();
+ InvalidateBorder();
+ return 1;
+}
+
+/*************************************************************************
+|*
+|* SwView::KillVLineal()
+|*
+|* Beschreibung
+|* Ersterstellung VB 29.05.91
+|*
+*************************************************************************/
+
+int SwView::KillVLineal()
+{
+ pVRuler->Hide();
+ pHRuler->SetBorderPos( 0 );
+ InvalidateBorder();
+ return 1;
+}
+/*************************************************************************
+|*
+|* SwView::ExecRulerClick()
+|*
+|* Beschreibung
+|* Ersterstellung OS 15.06.95
+|* Letzte Aenderung
+|*
+*************************************************************************/
+
+IMPL_LINK( SwView, ExecRulerClick, Ruler *, pRuler )
+{
+ USHORT nDefPage = 0;
+ switch( pRuler->GetClickType() )
+ {
+ case RULER_TYPE_DONTKNOW:
+ case RULER_TYPE_OUTSIDE:
+ case RULER_TYPE_INDENT:
+ case RULER_TYPE_MARGIN1:
+ case RULER_TYPE_MARGIN2:
+ nDefPage = TP_PARA_STD;
+ break;
+ default:
+ nDefPage = TP_TABULATOR;
+
+ }
+
+ SfxUInt16Item aDefPage(SID_PARA_DLG, nDefPage);
+ GetViewFrame()->GetDispatcher()->Execute( SID_PARA_DLG,
+ SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD,
+ &aDefPage, 0L );
+ return 0;
+}
+
+
+/*-----------------20.02.97 09:11-------------------
+
+--------------------------------------------------*/
+
+USHORT SwView::GetMoveType()
+{
+ return nMoveType;
+}
+/*-----------------20.02.97 09:11-------------------
+
+--------------------------------------------------*/
+
+void SwView::SetMoveType(USHORT nSet)
+{
+ BOOL bLastPage = nMoveType == NID_PGE;
+ nMoveType = nSet;
+ BOOL bNewPage = nMoveType == NID_PGE;
+ if(bNewPage != bLastPage)
+ {
+ Color aColor(bNewPage ? COL_BLACK : VIEW_IMAGECOLOR);
+ const TypeId aTypeId = TYPE(SwView);
+ SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId);
+ while( pView )
+ {
+ pView->SetImageButtonColor(aColor);
+ pView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId);
+ }
+ }
+}
+
+/*-----------------20.06.97 11:18-------------------
+
+--------------------------------------------------*/
+void SwView::SetActMark(sal_Int32 nSet)
+{
+ nActMark = nSet;
+}
+
+/*-----------------15.03.97 10:53-------------------
+
+--------------------------------------------------*/
+
+void SwView::SetImageButtonColor(Color& rColor)
+{
+ if(pPageUpBtn)
+ {
+ pPageUpBtn->SetControlForeground(rColor);
+ pPageDownBtn->SetControlForeground(rColor);
+ }
+}
+/* -----------------------------2002/06/26 13:57------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwView::ShowHScrollbar(sal_Bool bShow)
+{
+ DBG_ASSERT(pHScrollbar, "Scrollbar invalid");
+ pHScrollbar->ExtendedShow(bShow);
+}
+/* -----------------------------2002/06/26 13:57------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwView::IsHScrollbarVisible()const
+{
+ DBG_ASSERT(pHScrollbar, "Scrollbar invalid");
+ return pHScrollbar->IsVisible( FALSE ) || pHScrollbar->IsAuto();
+}
+/* -----------------------------2002/06/26 13:57------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwView::ShowVScrollbar(sal_Bool bShow)
+{
+ DBG_ASSERT(pVScrollbar, "Scrollbar invalid");
+ pVScrollbar->ExtendedShow(bShow);
+ pPageUpBtn->Show(bShow);
+ pPageDownBtn->Show(bShow);
+ pNaviBtn->Show(bShow);
+}
+/* -----------------------------2002/06/26 13:57------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwView::IsVScrollbarVisible()const
+{
+ DBG_ASSERT(pVScrollbar, "Scrollbar invalid");
+ return pVScrollbar->IsVisible( FALSE );
+}
+
+
diff --git a/sw/source/ui/uiview/viewport.cxx b/sw/source/ui/uiview/viewport.cxx
new file mode 100644
index 000000000000..b343619f2ea8
--- /dev/null
+++ b/sw/source/ui/uiview/viewport.cxx
@@ -0,0 +1,1384 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include "hintids.hxx"
+#include <vcl/help.hxx>
+#include <svx/ruler.hxx>
+#include <editeng/paperinf.hxx>
+#include <editeng/lrspitem.hxx>
+#include <sfx2/bindings.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <swmodule.hxx>
+#include <viewopt.hxx>
+#include <frmatr.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#include <edtwin.hxx>
+#include <scroll.hxx>
+#ifndef _WVIEW_HXX
+#include <wview.hxx>
+#endif
+#include <usrpref.hxx>
+#include <pagedesc.hxx>
+#include <workctrl.hxx>
+#include <crsskip.hxx>
+
+#include <PostItMgr.hxx>
+
+#include <IDocumentSettingAccess.hxx>
+
+//Das SetVisArea der DocShell darf nicht vom InnerResizePixel gerufen werden.
+//Unsere Einstellungen muessen aber stattfinden.
+#ifndef WB_RIGHT_ALIGNED
+#define WB_RIGHT_ALIGNED ((WinBits)0x00008000)
+#endif
+
+static BOOL bProtectDocShellVisArea = FALSE;
+
+static USHORT nPgNum = 0;
+
+BOOL SwView::IsDocumentBorder()
+{
+ return GetDocShell()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ||
+ pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) ||
+ SVX_ZOOM_PAGEWIDTH_NOBORDER == (SvxZoomType)pWrtShell->GetViewOptions()->GetZoomType();
+}
+
+inline long GetLeftMargin( SwView &rView )
+{
+ SvxZoomType eType = (SvxZoomType)rView.GetWrtShell().GetViewOptions()->GetZoomType();
+ long lRet = rView.GetWrtShell().GetAnyCurRect(RECT_PAGE_PRT).Left();
+ return eType == SVX_ZOOM_PERCENT ? lRet + DOCUMENTBORDER :
+ eType == SVX_ZOOM_PAGEWIDTH || eType == SVX_ZOOM_PAGEWIDTH_NOBORDER ? 0 :
+ lRet + DOCUMENTBORDER + nLeftOfst;
+}
+
+//-------------------------------------------------------------------------
+
+void lcl_GetPos(SwView* pView,
+ Point& rPos,
+ SwScrollbar* pScrollbar,
+ BOOL bBorder)
+{
+ SwWrtShell &rSh = pView->GetWrtShell();
+ const Size aDocSz( rSh.GetDocSize() );
+
+ const long lBorder = bBorder ? DOCUMENTBORDER : DOCUMENTBORDER * 2;
+ BOOL bHori = pScrollbar->IsHoriScroll();
+
+ const long lPos = pScrollbar->GetThumbPos() + (bBorder ? DOCUMENTBORDER : 0);
+ long Point:: *pPt = bHori ? &Point::nA : &Point::nB;
+ long Size:: *pSz = bHori ? &Size::nA : &Size::nB;
+
+ long lDelta = lPos - rSh.VisArea().Pos().*pPt;
+ const long lSize = aDocSz.*pSz + lBorder;
+ // Bug 11693: sollte rechts oder unten zuviel Wiese sein, dann muss
+ // diese von der VisArea herausgerechnet werden!
+ long nTmp = pView->GetVisArea().Right()+lDelta;
+ if ( bHori && nTmp > lSize )
+ lDelta -= nTmp - lSize;
+ nTmp = pView->GetVisArea().Bottom()+lDelta;
+ if ( !bHori && nTmp > lSize )
+ lDelta -= nTmp - lSize;
+
+ rPos.*pPt += lDelta;
+ if ( bBorder && rPos.*pPt < DOCUMENTBORDER )
+ rPos.*pPt = DOCUMENTBORDER;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Nullpunkt Lineal setzen
+ --------------------------------------------------------------------*/
+
+void SwView::InvalidateRulerPos()
+{
+ static USHORT __READONLY_DATA aInval[] =
+ {
+ SID_ATTR_PARA_LRSPACE, SID_RULER_BORDERS, SID_RULER_PAGE_POS,
+ SID_RULER_LR_MIN_MAX, SID_ATTR_LONG_ULSPACE, SID_ATTR_LONG_LRSPACE,
+ SID_RULER_BORDER_DISTANCE,
+ SID_ATTR_PARA_LRSPACE_VERTICAL, SID_RULER_BORDERS_VERTICAL,
+ SID_RULER_TEXT_RIGHT_TO_LEFT,
+ SID_RULER_ROWS, SID_RULER_ROWS_VERTICAL, FN_STAT_PAGE,
+ 0
+ };
+
+ GetViewFrame()->GetBindings().Invalidate(aInval);
+
+ DBG_ASSERT(pHRuler, "warum ist das Lineal nicht da?");
+ pHRuler->ForceUpdate();
+ pVRuler->ForceUpdate();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: begrenzt das Scrollen soweit, dass jeweils nur einen
+ viertel Bildschirm bis vor das Ende des Dokumentes
+ gescrollt werden kann.
+ --------------------------------------------------------------------*/
+
+long SwView::SetHScrollMax( long lMax )
+{
+ const long lBorder = IsDocumentBorder() ? DOCUMENTBORDER : DOCUMENTBORDER * 2;
+ const long lSize = GetDocSz().Width() + lBorder - aVisArea.GetWidth();
+
+ // bei negativen Werten ist das Dokument vollstaendig sichtbar;
+ // in diesem Fall kein Scrollen
+ return Max( Min( lMax, lSize ), 0L );
+}
+
+
+long SwView::SetVScrollMax( long lMax )
+{
+ const long lBorder = IsDocumentBorder() ? DOCUMENTBORDER : DOCUMENTBORDER * 2;
+ long lSize = GetDocSz().Height() + lBorder - aVisArea.GetHeight();
+ return Max( Min( lMax, lSize), 0L ); // siehe horz.
+}
+
+
+Point SwView::AlignToPixel(const Point &rPt) const
+{
+ return GetEditWin().PixelToLogic( GetEditWin().LogicToPixel( rPt ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Dokumentgroesse hat sich geaendert
+ --------------------------------------------------------------------*/
+
+void SwView::DocSzChgd(const Size &rSz)
+{
+
+extern int bDocSzUpdated;
+
+
+aDocSz = rSz;
+
+ if( !pWrtShell || aVisArea.IsEmpty() ) // keine Shell -> keine Aenderung
+ {
+ bDocSzUpdated = FALSE;
+ return;
+ }
+
+ //Wenn Text geloescht worden ist, kann es sein, dass die VisArea hinter
+ //den sichtbaren Bereich verweist
+ Rectangle aNewVisArea( aVisArea );
+ BOOL bModified = false;
+ SwTwips lGreenOffset = IsDocumentBorder() ? DOCUMENTBORDER : DOCUMENTBORDER * 2;
+ SwTwips lTmp = aDocSz.Width() + lGreenOffset;
+
+ if ( aNewVisArea.Right() >= lTmp )
+ {
+ lTmp = aNewVisArea.Right() - lTmp;
+ aNewVisArea.Right() -= lTmp;
+ aNewVisArea.Left() -= lTmp;
+ bModified = TRUE;
+ }
+
+ lTmp = aDocSz.Height() + lGreenOffset;
+ if ( aNewVisArea.Bottom() >= lTmp )
+ {
+ lTmp = aNewVisArea.Bottom() - lTmp;
+ aNewVisArea.Bottom() -= lTmp;
+ aNewVisArea.Top() -= lTmp;
+ bModified = TRUE;
+ }
+
+ if ( bModified )
+ SetVisArea( aNewVisArea, FALSE );
+
+ if ( UpdateScrollbars() && !bInOuterResizePixel && !bInInnerResizePixel &&
+ !GetViewFrame()->GetFrame().IsInPlace())
+ OuterResizePixel( Point(),
+ GetViewFrame()->GetWindow().GetOutputSizePixel() );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Visarea neu setzen
+ --------------------------------------------------------------------*/
+
+void SwView::SetVisArea( const Rectangle &rRect, BOOL bUpdateScrollbar )
+{
+ const Size aOldSz( aVisArea.GetSize() );
+
+ const Point aTopLeft( AlignToPixel( rRect.TopLeft() ));
+ const Point aBottomRight( AlignToPixel( rRect.BottomRight() ));
+ Rectangle aLR( aTopLeft, aBottomRight );
+
+ if( aLR == aVisArea )
+ return;
+
+ const SwTwips lMin = IsDocumentBorder() ? DOCUMENTBORDER : 0;
+
+ // keine negative Position, keine neg. Groesse
+ if( aLR.Top() < lMin )
+ {
+ aLR.Bottom() += lMin - aLR.Top();
+ aLR.Top() = lMin;
+ }
+ if( aLR.Left() < lMin )
+ {
+ aLR.Right() += lMin - aLR.Left();
+ aLR.Left() = lMin;
+ }
+ if( aLR.Right() < 0 )
+ aLR.Right() = 0;
+ if( aLR.Bottom() < 0 )
+ aLR.Bottom() = 0;
+
+ if( aLR == aVisArea )
+ return;
+
+ const Size aSize( aLR.GetSize() );
+ if( aSize.Width() < 0 || aSize.Height() < 0 )
+ return;
+
+ //Bevor die Daten veraendert werden ggf. ein Update rufen. Dadurch wird
+ //sichergestellt, da? anliegende Paints korrekt in Dokumentkoordinaten
+ //umgerechnet werden.
+ //Vorsichtshalber tun wir das nur wenn an der Shell eine Action laeuft,
+ //denn dann wir nicht wirklich gepaintet sondern die Rechtecke werden
+ //lediglich (in Dokumentkoordinaten) vorgemerkt.
+ if ( pWrtShell && pWrtShell->ActionPend() )
+ pWrtShell->GetWin()->Update();
+
+ aVisArea = aLR;
+
+ const BOOL bOuterResize = bUpdateScrollbar && UpdateScrollbars();
+
+ if ( pWrtShell )
+ {
+ pWrtShell->VisPortChgd( aVisArea );
+ if ( aOldSz != pWrtShell->VisArea().SSize() &&
+ ( Abs(aOldSz.Width() - pWrtShell->VisArea().Width()) > 2 ||
+ Abs(aOldSz.Height() - pWrtShell->VisArea().Height()) > 2 ) )
+ pWrtShell->CheckBrowseView( FALSE );
+ }
+
+ if ( !bProtectDocShellVisArea )
+ {
+ //Wenn die Groesse der VisArea unveraendert ist, reichen wir die
+ //Groesse der VisArea vom InternalObject weiter. Damit soll der
+ //Transport von Fehlern vermieden werden.
+ Rectangle aVis( aVisArea );
+ if ( aVis.GetSize() == aOldSz )
+ aVis.SetSize( GetDocShell()->SfxObjectShell::GetVisArea(ASPECT_CONTENT).GetSize() );
+ // TODO/LATER: why casting?!
+ //GetDocShell()->SfxInPlaceObject::GetVisArea().GetSize() );
+
+ //Bei embedded immer mit Modify...
+ // TODO/LATER: why casting?!
+ GetDocShell()->SfxObjectShell::SetVisArea( aVis );
+ /*
+ if ( GetDocShell()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
+ GetDocShell()->SfxInPlaceObject::SetVisArea( aVis );
+ else
+ GetDocShell()->SvEmbeddedObject::SetVisArea( aVis );*/
+ }
+
+ SfxViewShell::VisAreaChanged( aVisArea );
+
+ InvalidateRulerPos();
+
+ SwEditWin::ClearTip();
+
+ if ( bOuterResize && !bInOuterResizePixel && !bInInnerResizePixel)
+ OuterResizePixel( Point(),
+ GetViewFrame()->GetWindow().GetOutputSizePixel() );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Pos VisArea setzen
+ --------------------------------------------------------------------*/
+
+void SwView::SetVisArea( const Point &rPt, BOOL bUpdateScrollbar )
+{
+ //einmal alignen, damit Brushes korrekt angesetzt werden.
+ //MA 31. May. 96: Das geht in der BrowseView schief, weil evlt.
+ //nicht das ganze Dokument sichtbar wird. Da der Inhalt in Frames
+ //passgenau ist, kann nicht aligned werden (bessere Idee?!?!)
+ //MA 29. Oct. 96 (fix: Bild.de, 200%) ganz ohne Alignment geht es nicht
+ //mal sehen wie weit wir mit der halben BrushSize kommen.
+ //TODO: why BRUSH_SIZE?
+ Point aPt( rPt );
+// const long nTmp = GetWrtShell().IsFrameView() ? BRUSH_SIZE/2 : BRUSH_SIZE;
+ const long nTmp = GetWrtShell().IsFrameView() ? 4 : 8;
+ aPt = GetEditWin().LogicToPixel( aPt );
+ aPt.X() -= aPt.X() % nTmp;
+ aPt.Y() -= aPt.Y() % nTmp;
+ aPt = GetEditWin().PixelToLogic( aPt );
+
+ if ( aPt == aVisArea.TopLeft() )
+ return;
+
+ const long lXDiff = aVisArea.Left() - aPt.X();
+ const long lYDiff = aVisArea.Top() - aPt.Y();
+ SetVisArea( Rectangle( aPt,
+ Point( aVisArea.Right() - lXDiff, aVisArea.Bottom() - lYDiff ) ),
+ bUpdateScrollbar);
+}
+
+
+void SwView::CheckVisArea()
+{
+ pHScrollbar->SetAuto( pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) &&
+ !GetViewFrame()->GetFrame().IsInPlace() );
+ if ( IsDocumentBorder() )
+ {
+ if ( aVisArea.Left() != DOCUMENTBORDER ||
+ aVisArea.Top() != DOCUMENTBORDER )
+ {
+ Rectangle aNewVisArea( aVisArea );
+ aNewVisArea.Move( DOCUMENTBORDER - aVisArea.Left(),
+ DOCUMENTBORDER - aVisArea.Top() );
+ SetVisArea( aNewVisArea, TRUE );
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Sichtbaren Bereich berechnen
+
+ OUT Point *pPt: neue Position des sichtbaren
+ Bereiches
+ IN Rectangle &rRect: Rechteck, das sich innerhalb des neuen
+ sichtbaren Bereiches befinden soll
+ USHORT nRange optional exakte Angabe des Bereiches,
+ um den ggfs. gescrollt werden soll
+ --------------------------------------------------------------------*/
+
+void SwView::CalcPt( Point *pPt, const Rectangle &rRect,
+ USHORT nRangeX, USHORT nRangeY)
+{
+
+ const SwTwips lMin = IsDocumentBorder() ? DOCUMENTBORDER : 0;
+
+ long nYScroll = GetYScroll();
+ long nDesHeight = rRect.GetHeight();
+ long nCurHeight = aVisArea.GetHeight();
+ nYScroll = Min(nYScroll, nCurHeight - nDesHeight); // wird es knapp, dann nicht zuviel scrollen
+ if(nDesHeight > nCurHeight) // die Hoehe reicht nicht aus, dann interessiert nYScroll nicht mehr
+ {
+ pPt->Y() = rRect.Top();
+ pPt->Y() = Max( lMin, pPt->Y() );
+ }
+ else if ( rRect.Top() < aVisArea.Top() ) //Verschiebung nach oben
+ {
+ pPt->Y() = rRect.Top() - (nRangeY != USHRT_MAX ? nRangeY : nYScroll);
+ pPt->Y() = Max( lMin, pPt->Y() );
+ }
+ else if( rRect.Bottom() > aVisArea.Bottom() ) //Verschiebung nach unten
+ {
+ pPt->Y() = rRect.Bottom() -
+ (aVisArea.GetHeight()) + ( nRangeY != USHRT_MAX ?
+ nRangeY : nYScroll );
+ pPt->Y() = SetVScrollMax( pPt->Y() );
+ }
+ long nXScroll = GetXScroll();
+ if ( rRect.Right() > aVisArea.Right() ) //Verschiebung nach rechts
+ {
+ pPt->X() = rRect.Right() -
+ (aVisArea.GetWidth()) +
+ (nRangeX != USHRT_MAX ? nRangeX : nXScroll);
+ pPt->X() = SetHScrollMax( pPt->X() );
+ }
+ else if ( rRect.Left() < aVisArea.Left() ) //Verschiebung nach links
+ {
+ pPt->X() = rRect.Left() - (nRangeX != USHRT_MAX ? nRangeX : nXScroll);
+ pPt->X() = Max( ::GetLeftMargin( *this ) + nLeftOfst, pPt->X() );
+ pPt->X() = Min( rRect.Left() - nScrollX, pPt->X() );
+ pPt->X() = Max( 0L, pPt->X() );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Scrolling
+ --------------------------------------------------------------------*/
+
+BOOL SwView::IsScroll( const Rectangle &rRect ) const
+{
+ return bCenterCrsr || bTopCrsr || !aVisArea.IsInside(rRect);
+}
+
+
+void SwView::Scroll( const Rectangle &rRect, USHORT nRangeX, USHORT nRangeY )
+{
+ if ( aVisArea.IsEmpty() )
+ return;
+
+ Rectangle aOldVisArea( aVisArea );
+ long nDiffY = 0;
+
+ Window* pCareWn = ViewShell::GetCareWin(GetWrtShell());
+ if ( pCareWn )
+ {
+ Rectangle aDlgRect( GetEditWin().PixelToLogic(
+ pCareWn->GetWindowExtentsRelative( &GetEditWin() ) ) );
+ // Nur, wenn der Dialog nicht rechts oder links der VisArea liegt:
+ if ( aDlgRect.Left() < aVisArea.Right() &&
+ aDlgRect.Right() > aVisArea.Left() )
+ {
+ // Falls wir nicht zentriert werden sollen, in der VisArea liegen
+ // und nicht vom Dialog ueberdeckt werden ...
+ if ( !bCenterCrsr && aOldVisArea.IsInside( rRect )
+ && ( rRect.Left() > aDlgRect.Right()
+ || rRect.Right() < aDlgRect.Left()
+ || rRect.Top() > aDlgRect.Bottom()
+ || rRect.Bottom() < aDlgRect.Top() ) )
+ return;
+
+ // Ist oberhalb oder unterhalb der Dialogs mehr Platz?
+ long nTopDiff = aDlgRect.Top() - aVisArea.Top();
+ long nBottomDiff = aVisArea.Bottom() - aDlgRect.Bottom();
+ if ( nTopDiff < nBottomDiff )
+ {
+ if ( nBottomDiff > 0 ) // Ist unterhalb ueberhaupt Platz?
+ { // dann verschieben wir die Oberkante und merken uns dies
+ nDiffY = aDlgRect.Bottom() - aVisArea.Top();
+ aVisArea.Top() += nDiffY;
+ }
+ }
+ else
+ {
+ if ( nTopDiff > 0 ) // Ist oberhalb ueberhaupt Platz?
+ aVisArea.Bottom() = aDlgRect.Top(); // Unterkante aendern
+ }
+ }
+ }
+
+ //s.o. !IsScroll()
+ if( !(bCenterCrsr || bTopCrsr) && aVisArea.IsInside( rRect ) )
+ {
+ aVisArea = aOldVisArea;
+ return;
+ }
+ //falls das Rechteck groesser als der sichtbare Bereich -->
+ //obere linke Ecke
+ Size aSize( rRect.GetSize() );
+ const Size aVisSize( aVisArea.GetSize() );
+ if( !aVisArea.IsEmpty() && (
+ aSize.Width() + GetXScroll() > aVisSize.Width() ||
+ aSize.Height()+ GetYScroll() > aVisSize.Height() ))
+ {
+ Point aPt( aVisArea.TopLeft() );
+ aSize.Width() = Min( aSize.Width(), aVisSize.Width() );
+ aSize.Height()= Min( aSize.Height(),aVisSize.Height());
+
+ CalcPt( &aPt, Rectangle( rRect.TopLeft(), aSize ),
+ static_cast< USHORT >((aVisSize.Width() - aSize.Width()) / 2),
+ static_cast< USHORT >((aVisSize.Height()- aSize.Height())/ 2) );
+
+ if( bTopCrsr )
+ {
+ const long nBorder = IsDocumentBorder() ? DOCUMENTBORDER : 0;
+ aPt.Y() = Min( Max( nBorder, rRect.Top() ),
+ aDocSz.Height() + nBorder -
+ aVisArea.GetHeight() );
+ }
+ aPt.Y() -= nDiffY;
+ aVisArea = aOldVisArea;
+ SetVisArea( aPt );
+ return;
+ }
+ if( !bCenterCrsr )
+ {
+ Point aPt( aVisArea.TopLeft() );
+ CalcPt( &aPt, rRect, nRangeX, nRangeY );
+
+ if( bTopCrsr )
+ {
+ const long nBorder = IsDocumentBorder() ? DOCUMENTBORDER : 0;
+ aPt.Y() = Min( Max( nBorder, rRect.Top() ),
+ aDocSz.Height() + nBorder -
+ aVisArea.GetHeight() );
+ }
+
+ aPt.Y() -= nDiffY;
+ aVisArea = aOldVisArea;
+ SetVisArea( aPt );
+ return;
+ }
+
+ //Cursor zentrieren
+ Point aPnt( aVisArea.TopLeft() );
+ // ... in Y-Richtung auf jeden Fall
+ aPnt.Y() += ( rRect.Top() + rRect.Bottom()
+ - aVisArea.Top() - aVisArea.Bottom() ) / 2 - nDiffY;
+ // ... in X-Richtung nur, wenn das Rechteck rechts oder links aus der
+ // VisArea hinausragt.
+ if ( rRect.Right() > aVisArea.Right() || rRect.Left() < aVisArea.Left() )
+ {
+ aPnt.X() += ( rRect.Left() + rRect.Right()
+ - aVisArea.Left() - aVisArea.Right() ) / 2;
+ aPnt.X() = SetHScrollMax( aPnt.X() );
+ const SwTwips lMin = IsDocumentBorder() ? DOCUMENTBORDER : 0;
+ aPnt.X() = Max( (GetLeftMargin( *this ) - lMin) + nLeftOfst, aPnt.X() );
+ }
+ aVisArea = aOldVisArea;
+ if( pCareWn )
+ { // Wenn wir nur einem Dialog ausweichen wollen, wollen wir nicht ueber
+ // das Ende des Dokument hinausgehen.
+ aPnt.Y() = SetVScrollMax( aPnt.Y() );
+ }
+ SetVisArea( aPnt );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Seitenweises Scrollen
+ Liefern den Wert, um den bei PageUp / -Down gescrollt werden soll
+ --------------------------------------------------------------------*/
+
+BOOL SwView::GetPageScrollUpOffset( SwTwips &rOff ) const
+{
+ if ( !aVisArea.Top() || !aVisArea.GetHeight() )
+ return FALSE;
+ long nYScrl = GetYScroll() / 2;
+ rOff = -(aVisArea.GetHeight() - nYScrl);
+ //nicht vor den Dokumentanfang scrollen
+ if( aVisArea.Top() - rOff < 0 )
+ rOff = rOff - aVisArea.Top();
+ else if( GetWrtShell().GetCharRect().Top() < (aVisArea.Top() + nYScrl))
+ rOff += nYScrl;
+ return TRUE;
+}
+
+
+BOOL SwView::GetPageScrollDownOffset( SwTwips &rOff ) const
+{
+ if ( !aVisArea.GetHeight() ||
+ (aVisArea.GetHeight() > aDocSz.Height()) )
+ return FALSE;
+ long nYScrl = GetYScroll() / 2;
+ rOff = aVisArea.GetHeight() - nYScrl;
+ //nicht hinter das Dokumentende scrollen
+ if ( aVisArea.Top() + rOff > aDocSz.Height() )
+ rOff = aDocSz.Height() - aVisArea.Bottom();
+ else if( GetWrtShell().GetCharRect().Bottom() >
+ ( aVisArea.Bottom() - nYScrl ))
+ rOff -= nYScrl;
+ return rOff > 0;
+}
+
+// Seitenweises Blaettern
+
+long SwView::PageUp()
+{
+ if (!aVisArea.GetHeight())
+ return 0;
+
+ Point aPos(aVisArea.TopLeft());
+ aPos.Y() -= aVisArea.GetHeight() - (GetYScroll() / 2);
+ aPos.Y() = Max(0L, aPos.Y());
+ SetVisArea( aPos );
+ return 1;
+}
+
+
+long SwView::PageDown()
+{
+ if ( !aVisArea.GetHeight() )
+ return 0;
+ Point aPos( aVisArea.TopLeft() );
+ aPos.Y() += aVisArea.GetHeight() - (GetYScroll() / 2);
+ aPos.Y() = SetVScrollMax( aPos.Y() );
+ SetVisArea( aPos );
+ return 1;
+}
+
+
+long SwView::PhyPageUp()
+{
+ //aktuell sichtbare Seite erfragen, nicht formatieren
+ USHORT nActPage = pWrtShell->GetNextPrevPageNum( FALSE );
+
+ if( USHRT_MAX != nActPage )
+ {
+ const Point aPt( aVisArea.Left(),
+ pWrtShell->GetPagePos( nActPage ).Y() );
+ Point aAlPt( AlignToPixel( aPt ) );
+ // falls ein Unterschied besteht, wurde abgeschnitten --> dann
+ // einen Pixel addieren, damit kein Rest der Vorgaengerseite
+ // sichtbar ist
+ if( aPt.Y() != aAlPt.Y() )
+ aAlPt.Y() += 3 * GetEditWin().PixelToLogic( Size( 0, 1 ) ).Height();
+ SetVisArea( aAlPt );
+ }
+ return 1;
+}
+
+
+long SwView::PhyPageDown()
+{
+ //aktuell sichtbare Seite erfragen, nicht formatieren
+ USHORT nActPage = pWrtShell->GetNextPrevPageNum( TRUE );
+ // falls die letzte Dokumentseite sichtbar ist, nichts tun
+ if( USHRT_MAX != nActPage )
+ {
+ const Point aPt( aVisArea.Left(),
+ pWrtShell->GetPagePos( nActPage ).Y() );
+ Point aAlPt( AlignToPixel( aPt ) );
+ // falls ein Unterschied besteht, wurde abgeschnitten --> dann
+ // einen Pixel addieren, damit kein Rest der Vorgaengerseite sichtbar ist
+ if( aPt.Y() != aAlPt.Y() )
+ aAlPt.Y() += 3 * GetEditWin().PixelToLogic( Size( 0, 1 ) ).Height();
+ SetVisArea( aAlPt );
+ }
+ return 1;
+}
+
+
+long SwView::PageUpCrsr( BOOL bSelect )
+{
+ if ( !bSelect )
+ {
+ const USHORT eType = pWrtShell->GetFrmType(0,TRUE);
+ if ( eType & FRMTYPE_FOOTNOTE )
+ {
+ pWrtShell->MoveCrsr();
+ pWrtShell->GotoFtnAnchor();
+ pWrtShell->Right(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ return 1;
+ }
+ }
+
+ SwTwips lOff = 0;
+ if ( GetPageScrollUpOffset( lOff ) &&
+ (pWrtShell->IsCrsrReadonly() ||
+ !pWrtShell->PageCrsr( lOff, bSelect )) &&
+ PageUp() )
+ {
+ pWrtShell->ResetCursorStack();
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+long SwView::PageDownCrsr(BOOL bSelect)
+{
+ SwTwips lOff = 0;
+ if ( GetPageScrollDownOffset( lOff ) &&
+ (pWrtShell->IsCrsrReadonly() ||
+ !pWrtShell->PageCrsr( lOff, bSelect )) &&
+ PageDown() )
+ {
+ pWrtShell->ResetCursorStack();
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Handler der Scrollbars
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwView, ScrollHdl, SwScrollbar *, pScrollbar )
+{
+ if ( GetWrtShell().ActionPend() )
+ return 0;
+
+ if ( pScrollbar->GetType() == SCROLL_DRAG )
+ pWrtShell->EnableSmooth( FALSE );
+
+ if(!pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) &&
+ pScrollbar->GetType() == SCROLL_DRAG)
+ {
+ //Hier wieder auskommentieren wenn das mitscrollen nicht gewuenscht ist.
+ // JP 21.07.00: the end scrollhandler invalidate the FN_STAT_PAGE,
+ // so we dont must do it agin.
+ EndScrollHdl(pScrollbar);
+
+ Point aPos( aVisArea.TopLeft() );
+ lcl_GetPos(this, aPos, pScrollbar, IsDocumentBorder());
+
+ USHORT nPhNum = 1;
+ USHORT nVirtNum = 1;
+
+ String sDisplay;
+ if(pWrtShell->GetPageNumber( aPos.Y(), FALSE, nPhNum, nVirtNum, sDisplay ))
+ {
+ // JP 21.07.00: the end scrollhandler invalidate the FN_STAT_PAGE,
+ // so we dont must do it agin.
+// if(!GetViewFrame()->GetFrame().IsInPlace())
+// S F X_BINDINGS().Update(FN_STAT_PAGE);
+
+ //QuickHelp:
+ if( pWrtShell->GetPageCnt() > 1 && Help::IsQuickHelpEnabled() )
+ {
+ if( !nPgNum || nPgNum != nPhNum )
+ {
+ Rectangle aRect;
+ aRect.Left() = pScrollbar->GetParent()->OutputToScreenPixel(
+ pScrollbar->GetPosPixel() ).X() -8;
+ aRect.Top() = pScrollbar->OutputToScreenPixel(
+ pScrollbar->GetPointerPosPixel() ).Y();
+ aRect.Right() = aRect.Left();
+ aRect.Bottom() = aRect.Top();
+
+ String sPageStr( GetPageStr( nPhNum, nVirtNum, sDisplay ));
+ SwContentAtPos aCnt( SwContentAtPos::SW_OUTLINE );
+ pWrtShell->GetContentAtPos( aPos, aCnt );
+ if( aCnt.sStr.Len() )
+ {
+ sPageStr += String::CreateFromAscii(
+ RTL_CONSTASCII_STRINGPARAM( " - " ));
+ sPageStr.Insert( aCnt.sStr, 0, 80 );
+ sPageStr.SearchAndReplaceAll( '\t', ' ' );
+ sPageStr.SearchAndReplaceAll( 0x0a, ' ' );
+ }
+
+ Help::ShowQuickHelp( pScrollbar, aRect, sPageStr,
+ QUICKHELP_RIGHT|QUICKHELP_VCENTER);
+ }
+ nPgNum = nPhNum;
+ }
+ }
+ }
+ else
+ EndScrollHdl(pScrollbar);
+
+ if ( pScrollbar->GetType() == SCROLL_DRAG )
+ pWrtShell->EnableSmooth( TRUE );
+
+ return 0;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Handler der Scrollbars
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwView, EndScrollHdl, SwScrollbar *, pScrollbar )
+{
+ if ( !GetWrtShell().ActionPend() )
+ {
+ if(nPgNum)
+ {
+ nPgNum = 0;
+ Help::ShowQuickHelp(pScrollbar, Rectangle(), aEmptyStr, 0);
+ }
+ Point aPos( aVisArea.TopLeft() );
+ BOOL bBorder = IsDocumentBorder();
+ lcl_GetPos(this, aPos, pScrollbar, bBorder);
+ if ( bBorder && aPos == aVisArea.TopLeft() )
+ UpdateScrollbars();
+ else
+ SetVisArea( aPos, FALSE );
+
+ GetViewFrame()->GetBindings().Update(FN_STAT_PAGE);
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+
+ berechnet die Groesse von aVisArea abhaengig von der Groesse
+ des EditWin auf dem Schirm.
+
+ --------------------------------------------------------------------*/
+
+void SwView::CalcVisArea( const Size &rOutPixel )
+{
+ Point aTopLeft;
+ Rectangle aRect( aTopLeft, rOutPixel );
+ aTopLeft = GetEditWin().PixelToLogic( aTopLeft );
+ Point aBottomRight( GetEditWin().PixelToLogic( aRect.BottomRight() ) );
+
+ aRect.Left() = aTopLeft.X();
+ aRect.Top() = aTopLeft.Y();
+ aRect.Right() = aBottomRight.X();
+ aRect.Bottom() = aBottomRight.Y();
+
+ //Die Verschiebungen nach rechts und/oder unten koennen jetzt falsch
+ //sein (z.B. Zoom aendern, Viewgroesse aendern.
+ const long lBorder = IsDocumentBorder() ? DOCUMENTBORDER : DOCUMENTBORDER*2;
+ if ( aRect.Left() )
+ {
+ const long lWidth = GetWrtShell().GetDocSize().Width() + lBorder;
+ if ( aRect.Right() > lWidth )
+ {
+ long lDelta = aRect.Right() - lWidth;
+ aRect.Left() -= lDelta;
+ aRect.Right() -= lDelta;
+ }
+ }
+ if ( aRect.Top() )
+ {
+ const long lHeight = GetWrtShell().GetDocSize().Height() + lBorder;
+ if ( aRect.Bottom() > lHeight )
+ {
+ long lDelta = aRect.Bottom() - lHeight;
+ aRect.Top() -= lDelta;
+ aRect.Bottom() -= lDelta;
+ }
+ }
+ SetVisArea( aRect );
+ GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
+ GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER ); // for snapping points
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Bedienelemente neu anordnen
+ --------------------------------------------------------------------*/
+
+
+void SwView::CalcAndSetBorderPixel( SvBorder &rToFill, BOOL /*bInner*/ )
+{
+ BOOL bRightVRuler = pWrtShell->GetViewOptions()->IsVRulerRight();
+ if ( pVRuler->IsVisible() )
+ {
+ long nWidth = pVRuler->GetSizePixel().Width();
+ if(bRightVRuler)
+ rToFill.Right() = nWidth;
+ else
+ rToFill.Left() = nWidth;
+ }
+
+ DBG_ASSERT(pHRuler, "warum ist das Lineal nicht da?");
+ if ( pHRuler->IsVisible() )
+ rToFill.Top() = pHRuler->GetSizePixel().Height();
+
+ const StyleSettings &rSet = GetEditWin().GetSettings().GetStyleSettings();
+ const long nTmp = rSet.GetScrollBarSize();
+ if( pVScrollbar->IsVisible(FALSE) )
+ {
+ if(bRightVRuler)
+ rToFill.Left() = nTmp;
+ else
+ rToFill.Right() = nTmp;
+ }
+ //#i32913# in browse mode the visibility of the horizontal scrollbar
+ // depends on the content (fixed width tables may require a scrollbar)
+ if ( pHScrollbar->IsVisible(pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE)) )
+ rToFill.Bottom() = nTmp;
+
+ SetBorderPixel( rToFill );
+}
+
+
+void ViewResizePixel( const Window &rRef,
+ const Point &rOfst,
+ const Size &rSize,
+ const Size &rEditSz,
+ const BOOL /*bInner*/,
+ SwScrollbar& rVScrollbar,
+ SwScrollbar& rHScrollbar,
+ ImageButton* pPageUpBtn,
+ ImageButton* pPageDownBtn,
+ ImageButton* pNaviBtn,
+ Window& rScrollBarBox,
+ SvxRuler* pVLineal,
+ SvxRuler* pHLineal,
+ BOOL bWebView,
+ BOOL bVRulerRight )
+{
+// ViewResizePixel wird auch von der PreView benutzt!!!
+
+ const BOOL bHLineal = pHLineal && pHLineal->IsVisible();
+ const long nHLinSzHeight = bHLineal ?
+ pHLineal->GetSizePixel().Height() : 0;
+ const BOOL bVLineal = pVLineal && pVLineal->IsVisible();
+ const long nVLinSzWidth = bVLineal ?
+ pVLineal->GetSizePixel().Width() : 0;
+ long nHBSzHeight2= rHScrollbar.IsVisible( FALSE ) || !rHScrollbar.IsAuto() ?
+ rRef.GetSettings().GetStyleSettings().GetScrollBarSize() : 0;
+ long nHBSzHeight =
+ rHScrollbar.IsVisible(TRUE) || (rHScrollbar.IsVisible( FALSE ) && !rHScrollbar.IsAuto()) ?
+ nHBSzHeight2:0;
+ long nVBSzWidth = rVScrollbar.IsVisible(TRUE) || (rVScrollbar.IsVisible( FALSE ) && !rVScrollbar.IsAuto()) ?
+ rRef.GetSettings().GetStyleSettings().GetScrollBarSize() : 0;
+
+ if(pVLineal)
+ {
+ WinBits nStyle = pVLineal->GetStyle()&~WB_RIGHT_ALIGNED;
+ Point aPos( rOfst.X(), rOfst.Y()+nHLinSzHeight );
+ if(bVRulerRight)
+ {
+ aPos.X() += rSize.Width() - nVLinSzWidth;
+ nStyle |= WB_RIGHT_ALIGNED;
+ }
+ Size aSize( nVLinSzWidth, rEditSz.Height() );
+ if(!aSize.Width())
+ aSize.Width() = pVLineal->GetSizePixel().Width();
+ pVLineal->SetStyle(nStyle);
+ pVLineal->SetPosSizePixel( aPos, aSize );
+ if(!pVLineal->IsVisible())
+ pVLineal->Resize();
+ }
+// Lineal braucht ein Resize, sonst funktioniert es nicht im unischtbaren Zustand
+ if(pHLineal)
+ {
+ Size aSize( rSize.Width(), nHLinSzHeight );
+ if ( nVBSzWidth && !bVRulerRight)
+ aSize.Width() -= nVBSzWidth;
+ if(!aSize.Height())
+ aSize.Height() = pHLineal->GetSizePixel().Height();
+ pHLineal->SetPosSizePixel( rOfst, aSize );
+// #46802 VCL ruft an unsichtbaren Fenstern kein Resize
+// fuer das Lineal ist das aber keine gute Idee
+ if(!pHLineal->IsVisible())
+ pHLineal->Resize();
+ }
+
+ // Scrollbars und SizeBox anordnen
+ Point aScrollFillPos;
+ {
+ Point aPos( rOfst.X(),
+ rOfst.Y()+rSize.Height()-nHBSzHeight );
+ if(bVRulerRight)
+ {
+ aPos.X() += nVBSzWidth;
+ }
+
+ Size aSize( rSize.Width(), nHBSzHeight2 );
+ if ( nVBSzWidth )
+ aSize.Width() -= nVBSzWidth;
+ rHScrollbar.SetPosSizePixel( aPos, aSize );
+ aScrollFillPos.Y() = aPos.Y();
+ }
+ {
+ Point aPos( rOfst.X()+rSize.Width()-nVBSzWidth,
+ rOfst.Y() );
+ Size aSize( nVBSzWidth, rSize.Height() );
+ if(bVRulerRight)
+ {
+ aPos.X() = rOfst.X();
+ if(bHLineal)
+ {
+ aPos.Y() += nHLinSzHeight;
+ aSize.Height() -= nHLinSzHeight;
+ }
+ }
+
+ Size aImgSz( nVBSzWidth, nVBSzWidth );
+
+ //#55949# wenn der Platz fuer Scrollbar und Page-Buttons zu klein wird, dann
+ // werden die Buttons versteckt
+ USHORT nCnt = pNaviBtn ? 3 : 2;
+ long nSubSize = (aImgSz.Width() * nCnt );
+ //
+ BOOL bHidePageButtons = aSize.Height() < ((bWebView ? 3 : 2) * nSubSize);
+ if(!bHidePageButtons)
+ aSize.Height() -= nSubSize;
+ else
+ aImgSz.Width() = 0; // kein Hide, weil das im Update Scrollbar missverstanden wird
+
+ if ( nHBSzHeight )
+ aSize.Height() -= nHBSzHeight;
+ rVScrollbar.SetPosSizePixel( aPos, aSize );
+
+ aPos.Y() += aSize.Height();
+ pPageUpBtn->SetPosSizePixel( aPos, aImgSz );
+ if(pNaviBtn)
+ {
+ aPos.Y() += aImgSz.Height();
+ pNaviBtn->SetPosSizePixel(aPos, aImgSz);
+ }
+
+ aPos.Y() += aImgSz.Height();
+ pPageDownBtn->SetPosSizePixel( aPos, aImgSz );
+
+
+ if( rHScrollbar.IsVisible( FALSE ) )
+ {
+ aScrollFillPos.X() = aPos.X();
+
+ rScrollBarBox.SetPosSizePixel( aScrollFillPos,
+ Size( nHBSzHeight, nVBSzWidth) );
+ }
+ }
+}
+
+
+void SwView::ShowAtResize()
+{
+ bShowAtResize = FALSE;
+ if ( pWrtShell->GetViewOptions()->IsViewHRuler() )
+ pHRuler->Show();
+}
+
+
+void SwView::InnerResizePixel( const Point &rOfst, const Size &rSize )
+{
+ Size aObjSize = GetObjectShell()->GetVisArea().GetSize();
+ if ( aObjSize.Width() > 0 && aObjSize.Height() > 0 )
+ {
+ SvBorder aBorder( GetBorderPixel() );
+ Size aSize( rSize );
+ aSize.Width() -= (aBorder.Left() + aBorder.Right());
+ aSize.Height() -= (aBorder.Top() + aBorder.Bottom());
+ Size aObjSizePixel = GetWindow()->LogicToPixel( aObjSize, MAP_TWIP );
+ SfxViewShell::SetZoomFactor( Fraction( aSize.Width(), aObjSizePixel.Width() ),
+ Fraction( aSize.Height(), aObjSizePixel.Height() ) );
+ }
+
+ bInInnerResizePixel = TRUE;
+ const BOOL bHScrollVisible = pHScrollbar->IsVisible(TRUE);
+ const BOOL bVScrollVisible = pVScrollbar->IsVisible(TRUE);
+ BOOL bRepeat = FALSE;
+ do
+ {
+ Size aSz( rSize );
+ SvBorder aBorder;
+ CalcAndSetBorderPixel( aBorder, TRUE );
+ if ( GetViewFrame()->GetFrame().IsInPlace() )
+ {
+ Size aViewSize( aSz );
+ Point aViewPos( rOfst );
+ aViewSize.Height() -= (aBorder.Top() + aBorder.Bottom());
+ aViewSize.Width() -= (aBorder.Left() + aBorder.Right());
+ aViewPos.X() += aBorder.Left();
+ aViewPos.Y() += aBorder.Top();
+ GetEditWin().SetPosSizePixel( aViewPos, aViewSize );
+ }
+ else
+ {
+ aSz.Height() += aBorder.Top() + aBorder.Bottom();
+ aSz.Width() += aBorder.Left() + aBorder.Right();
+ }
+
+ Size aEditSz( GetEditWin().GetOutputSizePixel() );
+ ViewResizePixel( GetEditWin(), rOfst, aSz, aEditSz, TRUE, *pVScrollbar,
+ *pHScrollbar, pPageUpBtn, pPageDownBtn,
+ pNaviBtn,
+ *pScrollFill, pVRuler, pHRuler,
+ 0 != PTR_CAST(SwWebView, this),
+ pWrtShell->GetViewOptions()->IsVRulerRight());
+ if ( bShowAtResize )
+ ShowAtResize();
+
+ if( pHRuler->IsVisible() || pVRuler->IsVisible() )
+ {
+ const Fraction& rFrac = GetEditWin().GetMapMode().GetScaleX();
+ USHORT nZoom = 100;
+ if (0 != rFrac.GetDenominator())
+ nZoom = USHORT(rFrac.GetNumerator() * 100L / rFrac.GetDenominator());
+
+ const Fraction aFrac( nZoom, 100 );
+ pVRuler->SetZoom( aFrac );
+ pHRuler->SetZoom( aFrac );
+ InvalidateRulerPos(); //Inhalt invalidieren.
+ }
+ //CursorStack zuruecksetzen, da die Cursorpositionen fuer PageUp/-Down
+ //nicht mehr zum aktuell sichtbaren Bereich passen
+ pWrtShell->ResetCursorStack();
+
+ //EditWin niemals einstellen!
+
+ //VisArea einstellen, aber dort nicht das SetVisArea der DocShell rufen!
+ bProtectDocShellVisArea = TRUE;
+ CalcVisArea( aEditSz );
+ //visibility changes of the automatic horizontal scrollbar
+ //require to repeat the ViewResizePixel() call - but only once!
+ if(bRepeat)
+ bRepeat = FALSE;
+ else if(bHScrollVisible != pHScrollbar->IsVisible(TRUE) ||
+ bVScrollVisible != pVScrollbar->IsVisible(TRUE))
+ bRepeat = TRUE;
+ }while( bRepeat );
+ bProtectDocShellVisArea = FALSE;
+ bInInnerResizePixel = FALSE;
+}
+
+
+void SwView::OuterResizePixel( const Point &rOfst, const Size &rSize )
+{
+ // FME 22.08.2003 #i16909# - return, if no size (caused by minimize window).
+ if ( bInOuterResizePixel || ( !rSize.Width() && !rSize.Height() ) )
+ return;
+ bInOuterResizePixel = TRUE;
+
+// feststellen, ob Scrollbars angezeigt werden duerfen
+ BOOL bBrowse = pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE);
+ BOOL bShowH = FALSE,
+ bShowV = FALSE,
+ bAuto = FALSE,
+ bHAuto = bBrowse;
+ switch( GetScrollingMode() )
+ {
+ case SCROLLING_DEFAULT:
+ {
+ const SwViewOption *pVOpt = pWrtShell->GetViewOptions();
+ if ( !pVOpt->IsReadonly() || pVOpt->IsStarOneSetting() )
+ {
+ bShowH = pVOpt->IsViewHScrollBar();
+ bShowV = pVOpt->IsViewVScrollBar();
+ break;
+ }
+ }
+ /* kein break hier */
+ case SCROLLING_AUTO:
+ bAuto = bHAuto = TRUE;
+ bShowH = bShowV = TRUE;
+ break;
+ case SCROLLING_YES:
+ bShowH = bShowV = TRUE;
+ break;
+ case SCROLLING_NO:
+ bShowH = bShowV = bHAuto = FALSE;
+ break;
+ }
+ SwDocShell* pDocSh = GetDocShell();
+ BOOL bIsPreview = pDocSh->IsPreview();
+ if( bIsPreview )
+ {
+ bShowH = bShowV = bHAuto = bAuto = FALSE;
+ }
+ if(pHScrollbar->IsVisible(FALSE) != bShowH)
+ ShowHScrollbar(bShowH);
+ pHScrollbar->SetAuto( bHAuto );
+ if(pVScrollbar->IsVisible(FALSE) != bShowV)
+ ShowVScrollbar(bShowV);
+ pVScrollbar->SetAuto(bAuto);
+
+ SET_CURR_SHELL( pWrtShell );
+ BOOL bRepeat = FALSE;
+ long nCnt = 0;
+
+ BOOL bUnLockView = !pWrtShell->IsViewLocked();
+ pWrtShell->LockView( TRUE );
+ pWrtShell->LockPaint();
+
+ do {
+ ++nCnt;
+ const BOOL bScroll1 = pVScrollbar->IsVisible(TRUE);
+ const BOOL bScroll2 = pHScrollbar->IsVisible(TRUE);
+ SvBorder aBorder;
+ CalcAndSetBorderPixel( aBorder, FALSE );
+ const Size aEditSz( GetEditWin().GetOutputSizePixel() );
+ ViewResizePixel( GetEditWin(), rOfst, rSize, aEditSz, FALSE, *pVScrollbar,
+ *pHScrollbar, pPageUpBtn, pPageDownBtn,
+ pNaviBtn,
+ *pScrollFill, pVRuler, pHRuler,
+ 0 != PTR_CAST(SwWebView, this),
+ pWrtShell->GetViewOptions()->IsVRulerRight() );
+ if ( bShowAtResize )
+ ShowAtResize();
+
+ if( pHRuler->IsVisible() || pVRuler->IsVisible() )
+ InvalidateRulerPos(); //Inhalt invalidieren.
+
+ //CursorStack zuruecksetzen, da die Cursorpositionen fuer PageUp/-Down
+ //nicht mehr zum aktuell sichtbaren Bereich passen
+ pWrtShell->ResetCursorStack();
+
+ ASSERT( !GetEditWin().IsVisible() ||
+ (( aEditSz.Width() > 0 && aEditSz.Height() > 0 )
+ || !aVisArea.IsEmpty()), "Small world, isn't it?" );
+
+ //EditWin niemals einstellen!
+
+ //Die VisArea muss aber natuerlich eingestellt werden.
+ //jetzt ist auch der richtige Zeitpunkt den Zoom neu zu berechnen wenn
+ //es kein einfacher Faktor ist.
+ pWrtShell->StartAction();
+ CalcVisArea( aEditSz );
+
+ //Damit auch beim outplace editing die Seitenbreite sofort
+ //angepasst wird.
+ //TODO/LATER: is that still necessary?!
+ /*
+ if ( pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED )
+ pDocSh->SetVisArea(
+ pDocSh->SfxInPlaceObject::GetVisArea() );*/
+ if ( pWrtShell->GetViewOptions()->GetZoomType() != SVX_ZOOM_PERCENT &&
+ !pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) )
+ _SetZoom( aEditSz, (SvxZoomType)pWrtShell->GetViewOptions()->GetZoomType(), 100, TRUE );
+ pWrtShell->EndAction();
+
+ bRepeat = bScroll1 != pVScrollbar->IsVisible(TRUE);
+ if ( !bRepeat )
+ bRepeat = bScroll2 != pHScrollbar->IsVisible(TRUE);
+
+ //Nicht endlosschleifen. Moeglichst dann stoppen wenn die
+ //(Auto-)Scrollbars sichtbar sind.
+ if ( bRepeat &&
+ ( nCnt > 10 || ( nCnt > 3 && bHAuto && bAuto ) )
+ )
+ {
+ bRepeat = FALSE;
+ }
+
+ }while ( bRepeat );
+
+ if( pVScrollbar->IsVisible(FALSE) || pVScrollbar->IsAuto())
+ {
+ BOOL bShowButtons = pVScrollbar->IsVisible(TRUE);
+ if(pPageUpBtn && pPageUpBtn->IsVisible() != bShowButtons)
+ {
+ pPageUpBtn->Show(bShowButtons);
+ if(pPageDownBtn)
+ pPageDownBtn->Show(bShowButtons);
+ if(pNaviBtn)
+ pNaviBtn->Show(bShowButtons);
+ }
+ }
+
+ pWrtShell->UnlockPaint();
+ if( bUnLockView )
+ pWrtShell->LockView( FALSE );
+
+ bInOuterResizePixel = FALSE;
+
+ if ( mpPostItMgr )
+ {
+ mpPostItMgr->CalcRects();
+ mpPostItMgr->LayoutPostIts();
+ }
+}
+
+
+void SwView::SetZoomFactor( const Fraction &rX, const Fraction &rY )
+{
+ const Fraction &rFrac = rX < rY ? rX : rY;
+ SetZoom( SVX_ZOOM_PERCENT, (short) long(rFrac * Fraction( 100, 1 )) );
+
+ //Um Rundungsfehler zu minimieren lassen wir von der Basisklasse ggf.
+ //auch die krummen Werte einstellen
+ SfxViewShell::SetZoomFactor( rX, rY );
+}
+
+
+Size SwView::GetOptimalSizePixel() const
+{
+ Size aPgSize;
+ if ( pWrtShell->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) )
+ aPgSize = SvxPaperInfo::GetPaperSize(PAPER_A4);
+ else
+ {
+ aPgSize = GetWrtShell().GetAnyCurRect(RECT_PAGE).SSize();
+ aPgSize.Width() += DOCUMENTBORDER * 2;
+
+ const SwPageDesc &rDesc = pWrtShell->GetPageDesc( pWrtShell->GetCurPageDesc() );
+ if( nsUseOnPage::PD_MIRROR == rDesc.GetUseOn() )
+ {
+ const SvxLRSpaceItem &rLRSpace = rDesc.GetMaster().GetLRSpace();
+ const SvxLRSpaceItem &rLeftLRSpace = rDesc.GetLeft().GetLRSpace();
+ aPgSize.Width() += Abs( long(rLeftLRSpace.GetLeft()) - long(rLRSpace.GetLeft()) );
+ }
+ }
+ return GetEditWin().LogicToPixel( aPgSize );
+}
+
+
+BOOL SwView::UpdateScrollbars()
+{
+ BOOL bRet = FALSE;
+ if ( !aVisArea.IsEmpty() )
+ {
+ const BOOL bBorder = IsDocumentBorder();
+ Rectangle aTmpRect( aVisArea );
+ if ( bBorder )
+ {
+ Point aPt( DOCUMENTBORDER, DOCUMENTBORDER );
+ aPt = AlignToPixel( aPt );
+ aTmpRect.Move( -aPt.X(), -aPt.Y() );
+ }
+
+ Size aTmpSz( aDocSz );
+ const long lOfst = bBorder ? 0 : DOCUMENTBORDER * 2L;
+ aTmpSz.Width() += lOfst; aTmpSz.Height() += lOfst;
+
+ {
+ const BOOL bVScrollVisible = pVScrollbar->IsVisible(TRUE);
+ pVScrollbar->DocSzChgd( aTmpSz );
+ pVScrollbar->ViewPortChgd( aTmpRect );
+
+ BOOL bShowButtons = pVScrollbar->IsVisible(TRUE);
+ if(pPageUpBtn && pPageUpBtn->IsVisible() != bShowButtons)
+ {
+ pPageUpBtn->Show(bShowButtons);
+ if(pPageDownBtn)
+ pPageDownBtn->Show(bShowButtons);
+ if(pNaviBtn)
+ pNaviBtn->Show(bShowButtons);
+ }
+
+ if ( bVScrollVisible != pVScrollbar->IsVisible(TRUE) )
+ bRet = TRUE;
+ }
+ {
+ const BOOL bHScrollVisible = pHScrollbar->IsVisible(TRUE);
+ pHScrollbar->DocSzChgd( aTmpSz );
+ pHScrollbar->ViewPortChgd( aTmpRect );
+ if ( bHScrollVisible != pHScrollbar->IsVisible(TRUE) )
+ bRet = TRUE;
+ pScrollFill->Show(pHScrollbar->IsVisible(TRUE) && pVScrollbar->IsVisible(TRUE) );
+ }
+ }
+ return bRet;
+}
+
+
+void SwView::Move()
+{
+ if ( GetWrtShell().IsInSelect() )
+ GetWrtShell().EndSelect(); //#32427#
+ SfxViewShell::Move();
+}
+
+BOOL SwView::HandleWheelCommands( const CommandEvent& rCEvt )
+{
+ BOOL bOk = FALSE;
+ const CommandWheelData* pWData = rCEvt.GetWheelData();
+ if( pWData && COMMAND_WHEEL_ZOOM == pWData->GetMode() )
+ {
+ USHORT nFact = pWrtShell->GetViewOptions()->GetZoom();
+ if( 0L > pWData->GetDelta() )
+ nFact = static_cast< USHORT >(Max( 20, nFact - 10 ));
+ else
+ nFact = static_cast< USHORT >(Min( 600, nFact + 10 ));
+
+ SetZoom( SVX_ZOOM_PERCENT, nFact );
+ bOk = TRUE;
+ }
+ else
+ {
+ if (pWData && (COMMAND_WHEEL_SCROLL==pWData->GetMode()) && (((ULONG)0xFFFFFFFF) == pWData->GetScrollLines()))
+ {
+ if (pWData->GetDelta()<0)
+ PhyPageDown();
+ else
+ PhyPageUp();
+ bOk = TRUE;
+ }
+ else
+ bOk = pEditWin->HandleScrollCommand( rCEvt,
+ pHScrollbar, pVScrollbar);
+ }
+ return bOk;
+}
+
+
diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx
new file mode 100644
index 000000000000..64e0d5142db7
--- /dev/null
+++ b/sw/source/ui/uiview/viewprt.cxx
@@ -0,0 +1,333 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <com/sun/star/text/NotePrintMode.hpp>
+
+#if STLPORT_VERSION>=321
+#include <cstdarg>
+#endif
+
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#endif
+#include <sfx2/request.hxx>
+
+#include <sfx2/progress.hxx>
+#include <sfx2/app.hxx>
+#include <svl/flagitem.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/oldprintadaptor.hxx>
+#include <sfx2/printer.hxx>
+#include <sfx2/prnmon.hxx>
+#include <editeng/paperinf.hxx>
+#include <sfx2/dispatch.hxx>
+#include <unotools/misccfg.hxx>
+#include <svx/prtqry.hxx>
+#include <svx/svdview.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <svl/flagitem.hxx>
+#include <sfx2/linkmgr.hxx>
+
+#include <modcfg.hxx>
+#include <edtwin.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <viewopt.hxx>
+#include <prtopt.hxx>
+#include <fontcfg.hxx>
+#include <cfgitems.hxx>
+#include <dbmgr.hxx>
+#include <docstat.hxx>
+#include <viewfunc.hxx>
+#include <swmodule.hxx>
+#include <wview.hxx>
+#include <doc.hxx>
+#include <fldbas.hxx>
+
+#include <globals.hrc>
+#include <view.hrc>
+#include <app.hrc>
+#include <svl/eitem.hxx>
+#include <swwrtshitem.hxx>
+#include "swabstdlg.hxx"
+#include <svl/slstitm.hxx>
+
+#include <unomid.h>
+
+using namespace ::com::sun::star;
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Drucker an Sfx uebergeben
+ --------------------------------------------------------------------*/
+
+
+SfxPrinter* __EXPORT SwView::GetPrinter( BOOL bCreate )
+{
+ const IDocumentDeviceAccess* pIDDA = GetWrtShell().getIDocumentDeviceAccess();
+ SfxPrinter *pOld = pIDDA->getPrinter( false );
+ SfxPrinter *pPrt = pIDDA->getPrinter( bCreate );
+ if ( pOld != pPrt )
+ {
+ BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
+ ::SetAppPrintOptions( &GetWrtShell(), bWeb );
+ }
+ return pPrt;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Druckerwechsel weitermelden
+ --------------------------------------------------------------------*/
+
+void SetPrinter( IDocumentDeviceAccess* pIDDA, SfxPrinter* pNew, BOOL bWeb )
+{
+ SwPrintOptions* pOpt = SW_MOD()->GetPrtOptions(bWeb);
+ if( !pOpt)
+ return;
+
+ // Applikationseigene Druckoptionen aus SfxPrinter auslesen
+ const SfxItemSet& rSet = pNew->GetOptions();
+
+ const SwAddPrinterItem* pAddPrinterAttr;
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ADDPRINTER, FALSE,
+ (const SfxPoolItem**)&pAddPrinterAttr ) )
+ {
+ if( pIDDA )
+ pIDDA->setPrintData( *pAddPrinterAttr );
+ if( pAddPrinterAttr->GetFax().getLength() )
+ pOpt->SetFaxName(pAddPrinterAttr->GetFax());
+ }
+}
+
+
+USHORT __EXPORT SwView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool )
+{
+ SwWrtShell &rSh = GetWrtShell();
+ SfxPrinter* pOld = rSh.getIDocumentDeviceAccess()->getPrinter( false );
+ if ( pOld && pOld->IsPrinting() )
+ return SFX_PRINTERROR_BUSY;
+
+ if ( (SFX_PRINTER_JOBSETUP | SFX_PRINTER_PRINTER) & nDiffFlags )
+ {
+ rSh.getIDocumentDeviceAccess()->setPrinter( pNew, true, true );
+ if ( nDiffFlags & SFX_PRINTER_PRINTER )
+ rSh.SetModified();
+ }
+ BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
+ if ( nDiffFlags & SFX_PRINTER_OPTIONS )
+ ::SetPrinter( rSh.getIDocumentDeviceAccess(), pNew, bWeb );
+
+ const BOOL bChgOri = nDiffFlags & SFX_PRINTER_CHG_ORIENTATION ? TRUE : FALSE;
+ const BOOL bChgSize= nDiffFlags & SFX_PRINTER_CHG_SIZE ? TRUE : FALSE;
+ if ( bChgOri || bChgSize )
+ {
+ rSh.StartAllAction();
+ if ( bChgOri )
+ rSh.ChgAllPageOrientation( USHORT(pNew->GetOrientation()) );
+ if ( bChgSize )
+ {
+ Size aSz( SvxPaperInfo::GetPaperSize( pNew ) );
+ rSh.ChgAllPageSize( aSz );
+ }
+ rSh.SetModified();
+ rSh.EndAllAction();
+ InvalidateRulerPos();
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: TabPage fuer applikationsspezifische Druckoptionen
+ --------------------------------------------------------------------*/
+
+SfxTabPage* __EXPORT SwView::CreatePrintOptionsPage(Window* pParent,
+ const SfxItemSet& rSet)
+{
+ return ::CreatePrintOptionsPage( pParent, rSet, FALSE );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Print-Dispatcher
+ --------------------------------------------------------------------*/
+
+void __EXPORT SwView::ExecutePrint(SfxRequest& rReq)
+{
+ BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
+ ::SetAppPrintOptions( &GetWrtShell(), bWeb );
+ switch (rReq.GetSlot())
+ {
+ case FN_FAX:
+ {
+ SwPrintOptions* pPrintOptions = SW_MOD()->GetPrtOptions(bWeb);
+ String sFaxName(pPrintOptions->GetFaxName());
+ if (sFaxName.Len())
+ {
+ SfxStringItem aPrinterName(SID_PRINTER_NAME, sFaxName);
+ SfxBoolItem aSilent( SID_SILENT, TRUE );
+ GetViewFrame()->GetDispatcher()->Execute( SID_PRINTDOC,
+ SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD,
+ &aPrinterName, &aSilent, 0L );
+ }
+ else
+ {
+ InfoBox aInfoBox(&GetEditWin(), SW_RES(MSG_ERR_NO_FAX));
+ String sMsg = aInfoBox.GetMessText();
+ USHORT nResNo = bWeb ? STR_WEBOPTIONS : STR_TEXTOPTIONS;
+ sMsg.SearchAndReplace(String::CreateFromAscii("%1"), String(SW_RES(nResNo)));
+ aInfoBox.SetMessText(sMsg);
+ aInfoBox.Execute();
+ SfxUInt16Item aDefPage(SID_SW_EDITOPTIONS, TP_OPTPRINT_PAGE);
+ GetViewFrame()->GetDispatcher()->Execute(SID_SW_EDITOPTIONS,
+ SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD,
+ &aDefPage, 0L );
+ }
+ }
+ break;
+ case SID_PRINTDOC:
+ case SID_PRINTDOCDIRECT:
+ {
+ SwWrtShell* pSh = &GetWrtShell();
+ SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, FALSE);
+ BOOL bSilent = pSilentItem ? pSilentItem->GetValue() : FALSE;
+ SFX_REQUEST_ARG(rReq, pPrintFromMergeItem, SfxBoolItem, FN_QRY_MERGE, FALSE);
+ if(pPrintFromMergeItem)
+ rReq.RemoveItem(FN_QRY_MERGE);
+ BOOL bFromMerge = pPrintFromMergeItem ? pPrintFromMergeItem->GetValue() : FALSE;
+ SwMiscConfig aMiscConfig;
+ bool bPrintSelection = false;
+ if(!bSilent && !bFromMerge &&
+ SW_MOD()->GetModuleConfig()->IsAskForMailMerge() && pSh->IsAnyDatabaseFieldInDoc())
+ {
+ QueryBox aBox( &GetEditWin(), SW_RES( MSG_PRINT_AS_MERGE ));
+ short nRet = aBox.Execute();
+ if(RET_YES == nRet)
+ {
+ SfxBoolItem aBool(FN_QRY_MERGE, TRUE);
+ GetViewFrame()->GetDispatcher()->Execute(
+ FN_QRY_MERGE, SFX_CALLMODE_ASYNCHRON, &aBool, 0L);
+ rReq.Ignore();
+ return;
+ }
+ }
+ else if( rReq.GetSlot() == SID_PRINTDOCDIRECT && ! bSilent )
+ {
+ if( /*!bIsAPI && */
+ ( pSh->IsSelection() || pSh->IsFrmSelected() || pSh->IsObjSelected() ) )
+ {
+ short nBtn = SvxPrtQryBox(&GetEditWin()).Execute();
+ if( RET_CANCEL == nBtn )
+ return;;
+
+ if( RET_OK == nBtn )
+ bPrintSelection = true;
+ }
+ }
+
+ //#i61455# if master documentes are printed silently without loaded links then update the links now
+ if( bSilent && pSh->IsGlobalDoc() && !pSh->IsGlblDocSaveLinks() )
+ {
+ pSh->GetLinkManager().UpdateAllLinks( sal_False, sal_False, sal_False, 0 );
+ }
+ SfxRequest aReq( rReq );
+ SfxBoolItem aBool(SID_SELECTION, bPrintSelection);
+ aReq.AppendItem( aBool );
+ SfxViewShell::ExecuteSlot( aReq, SfxViewShell::GetInterface() );
+ return;
+ }
+ default:
+ ASSERT(!this, falscher Dispatcher);
+ return;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Page Drucker/Zusaetze erzeugen fuer SwView und
+ SwPagePreview
+ --------------------------------------------------------------------*/
+
+SfxTabPage* CreatePrintOptionsPage( Window *pParent,
+ const SfxItemSet &rOptions, BOOL bPreview )
+{
+ SfxTabPage* pPage = NULL;
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ if ( pFact )
+ {
+ ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( TP_OPTPRINT_PAGE );
+ if ( fnCreatePage )
+ pPage = (*fnCreatePage)( pParent, rOptions );
+ }
+ SfxAllItemSet aSet(*(rOptions.GetPool()));
+ aSet.Put (SfxBoolItem(SID_PREVIEWFLAG_TYPE, bPreview));
+ aSet.Put (SfxBoolItem(SID_FAX_LIST, sal_True));
+ pPage->PageCreated(aSet);
+ return pPage;
+}
+
+
+void SetAppPrintOptions( ViewShell* pSh, BOOL bWeb )
+{
+ const IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess();
+ SwPrintData aPrtData = pIDDA->getPrintData();
+
+ if( pIDDA->getPrinter( false ) )
+ {
+ // Applikationseigene Druckoptionen in SfxPrinter schiessen
+ SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, aPrtData);
+ SfxItemSet aSet( pSh->GetAttrPool(),
+ FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
+ SID_HTML_MODE, SID_HTML_MODE,
+ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+ 0 );
+
+ utl::MiscCfg aMisc;
+
+ if(bWeb)
+ aSet.Put(SfxUInt16Item(SID_HTML_MODE,
+ ::GetHtmlMode(((SwWrtShell*)pSh)->GetView().GetDocShell())));
+ aSet.Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN,
+ aMisc.IsNotFoundWarning() ));
+ aSet.Put(aAddPrinterItem);
+ aSet.Put( SfxFlagItem( SID_PRINTER_CHANGESTODOC,
+ (aMisc.IsPaperSizeWarning() ? SFX_PRINTER_CHG_SIZE : 0) |
+ (aMisc.IsPaperOrientationWarning() ? SFX_PRINTER_CHG_ORIENTATION : 0 )));
+
+ pIDDA->getPrinter( true )->SetOptions( aSet );
+ }
+
+}
diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx
new file mode 100644
index 000000000000..dd2db26a58e8
--- /dev/null
+++ b/sw/source/ui/uiview/viewsrch.cxx
@@ -0,0 +1,808 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+#include <hintids.hxx>
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <svl/cjkoptions.hxx>
+#include <svl/ctloptions.hxx>
+#include <svx/pageitem.hxx>
+#include <svl/whiter.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/stritem.hxx>
+#include <svtools/txtcmp.hxx>
+#include <svl/itempool.hxx>
+#include <svl/eitem.hxx>
+#include <svl/srchitem.hxx>
+#include <sfx2/request.hxx>
+#include <svx/srchdlg.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/wrkwin.hxx>
+#include "editeng/unolingu.hxx"
+#include <swmodule.hxx>
+#include <swwait.hxx>
+#include <workctrl.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <swundo.hxx> // fuer Undo-Ids
+#include <uitool.hxx>
+#include <cmdid.h>
+#include <docsh.hxx>
+
+#include <view.hrc>
+#include <SwRewriter.hxx>
+#include <comcore.hrc>
+
+#include "PostItMgr.hxx"
+
+using namespace com::sun::star;
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::i18n;
+
+#define SRCH_ATTR_OFF 0
+#define SRCH_ATTR_ON 1
+#define SRCH_ATTR_SET 2
+
+/*--------------------------------------------------------------------
+ Beschreibung: Search Parameter
+ --------------------------------------------------------------------*/
+
+struct SwSearchOptions
+{
+ SwDocPositions eStart, eEnd;
+ BOOL bDontWrap;
+
+ SwSearchOptions( SwWrtShell* pSh, BOOL bBackward );
+};
+
+
+inline Window* GetParentWindow( SvxSearchDialog* pSrchDlg )
+{
+ Window* pWin;
+ if( pSrchDlg && pSrchDlg->IsVisible() )
+ pWin = LAYOUT_THIS_WINDOW (pSrchDlg);
+ else
+ pWin = 0;
+ return pWin;
+}
+
+
+/*-----------------12.04.97 13:04-------------------
+
+--------------------------------------------------*/
+
+
+void SwView::ExecSearch(SfxRequest& rReq, BOOL bNoMessage)
+{
+ const SfxItemSet* pArgs = rReq.GetArgs();
+ const SfxPoolItem* pItem = 0;
+ const USHORT nId = SvxSearchDialogWrapper::GetChildWindowId();
+ SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nId);
+ BOOL bQuiet = FALSE;
+ if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_SEARCH_QUIET, FALSE, &pItem))
+ bQuiet = ((const SfxBoolItem*) pItem)->GetValue();
+
+ BOOL bApi = bQuiet | bNoMessage;
+
+ USHORT nSlot = rReq.GetSlot();
+ if (nSlot == FN_REPEAT_SEARCH && !pSrchItem)
+ {
+ if(bApi)
+ {
+ rReq.SetReturnValue(SfxBoolItem(nSlot, FALSE));
+ nSlot = 0;
+ }
+ }
+ if( pWrtShell->IsBlockMode() )
+ pWrtShell->LeaveBlockMode();
+ switch (nSlot)
+ {
+ // erstmal Nichts tun
+ case SID_SEARCH_ITEM:
+ {
+ delete pSrchItem;
+ pSrchItem = (SvxSearchItem*) pArgs->Get(SID_SEARCH_ITEM).Clone();
+ }
+ break;
+
+ case FID_SEARCH_ON:
+ bJustOpened = TRUE;
+ GetViewFrame()->GetBindings().Invalidate(SID_SEARCH_ITEM);
+ break;
+
+ case FID_SEARCH_OFF:
+ if(pArgs)
+ {
+ // Dialog abmelden
+ delete pSrchItem;
+ pSrchItem = (SvxSearchItem*) pArgs->Get(SID_SEARCH_ITEM).Clone();
+
+ DELETEZ( pSrchList );
+ DELETEZ( pReplList );
+
+ if ( pWrp )
+ {
+ pSrchDlg = static_cast <SvxSearchDialog*> (pWrp->getDialog ());
+ // die Search / Replace -Items merken wir uns
+ const SearchAttrItemList* pList = pSrchDlg->GetSearchItemList();
+ if( pList && pList->Count() )
+ pSrchList = new SearchAttrItemList( *pList );
+
+ if( 0 != (pList = pSrchDlg->GetReplaceItemList() ) &&
+ pList->Count() )
+ pReplList = new SearchAttrItemList( *pList );
+ }
+ }
+ break;
+
+ case FN_REPEAT_SEARCH:
+ case FID_SEARCH_NOW:
+ {
+ {
+ if(FID_SEARCH_NOW == nSlot && !rReq.IsAPI())
+ SwView::SetMoveType(NID_SRCH_REP);
+ if ( pWrp )
+ {
+ pSrchDlg = static_cast <SvxSearchDialog*> (pWrp->getDialog ());
+ }
+ else
+ pSrchDlg = 0;
+ }
+
+ if (pSrchDlg)
+ {
+ DELETEZ( pSrchList );
+ DELETEZ( pReplList );
+
+ const SearchAttrItemList* pList = pSrchDlg->GetSearchItemList();
+ if( pList && pList->Count() )
+ pSrchList = new SearchAttrItemList( *pList );
+
+ if( 0 != (pList = pSrchDlg->GetReplaceItemList() ) &&
+ pList->Count() )
+ pReplList = new SearchAttrItemList( *pList );
+ }
+
+ if (nSlot == FN_REPEAT_SEARCH)
+ {
+ ASSERT(pSrchItem, "Search-Item fehlt");
+ if( !pSrchItem )
+ pSrchItem = new SvxSearchItem(SID_SEARCH_ITEM);
+ }
+ else
+ {
+ // SearchItem aus Request besorgen
+ ASSERT(pArgs, "Args fehlen");
+ if ( pArgs )
+ {
+ delete pSrchItem;
+ pSrchItem = (SvxSearchItem*) pArgs->Get(SID_SEARCH_ITEM).Clone();
+ }
+ }
+ switch (pSrchItem->GetCommand())
+ {
+ case SVX_SEARCHCMD_FIND:
+ {
+ BOOL bRet = SearchAndWrap(bApi);
+ if( bRet )
+ Scroll(pWrtShell->GetCharRect().SVRect());
+ rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
+ }
+ break;
+ case SVX_SEARCHCMD_FIND_ALL:
+ {
+ BOOL bRet = SearchAll();
+ if( !bRet )
+ {
+ if( !bApi )
+ {
+ Window* pParentWindow = GetParentWindow( pSrchDlg );
+ InfoBox( pParentWindow, SW_RES(MSG_NOT_FOUND)).Execute();
+ }
+ bFound = FALSE;
+ }
+ rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
+ }
+ break;
+ case SVX_SEARCHCMD_REPLACE:
+ {
+
+ // 1) Selektion ersetzen (nicht. wenn nur Attribute ersetzt
+ // werden sollen)
+//JP 27.04.95: warum ?
+// was ist, wenn man das gefundene nur attributieren will??
+
+ USHORT nCmd = SVX_SEARCHCMD_FIND;
+ if( pSrchItem->GetReplaceString().Len() ||
+ !pReplList )
+ {
+ // Verhindern, dass - falls der Suchstring im
+ // Ersetzungsstring enthalten ist - der ersetzte String
+ // noch einmal gefunden wird.
+
+ BOOL bBack = pSrchItem->GetBackward();
+ if (bBack)
+ pWrtShell->Push();
+ String aReplace( pSrchItem->GetReplaceString() );
+ SearchOptions aTmp( pSrchItem->GetSearchOptions() );
+ String *pBackRef = ReplaceBackReferences( aTmp, pWrtShell->GetCrsr() );
+ if( pBackRef )
+ pSrchItem->SetReplaceString( *pBackRef );
+ Replace();
+ if( pBackRef )
+ {
+ pSrchItem->SetReplaceString( aReplace );
+ delete pBackRef;
+ }
+ if (bBack)
+ {
+ pWrtShell->Pop();
+ pWrtShell->SwapPam();
+ }
+ }
+ else if( pReplList )
+ nCmd = SVX_SEARCHCMD_REPLACE;
+
+ // 2) Weiter suchen (ohne zu ersetzen!)
+
+ USHORT nOldCmd = pSrchItem->GetCommand();
+ pSrchItem->SetCommand( nCmd );
+ BOOL bRet = SearchAndWrap(bApi);
+ if( bRet )
+ Scroll( pWrtShell->GetCharRect().SVRect());
+ pSrchItem->SetCommand( nOldCmd );
+ rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
+ }
+ break;
+
+ case SVX_SEARCHCMD_REPLACE_ALL:
+ {
+ SwSearchOptions aOpts( pWrtShell, pSrchItem->GetBackward() );
+
+
+ if( !pSrchItem->GetSelection() )
+ {
+ // bestehende Selektionen aufheben,
+ // wenn nicht in selektierten Bereichen gesucht werden soll
+ (pWrtShell->*pWrtShell->fnKillSel)(0, FALSE);
+ if( DOCPOS_START == aOpts.eEnd )
+ pWrtShell->EndDoc();
+ else
+ pWrtShell->SttDoc();
+ }
+
+ bExtra = FALSE;
+ ULONG nFound;
+
+ { //Scope for SwWait-Object
+ SwWait aWait( *GetDocShell(), TRUE );
+ pWrtShell->StartAllAction();
+ nFound = FUNC_Search( aOpts );
+ pWrtShell->EndAllAction();
+ }
+ rReq.SetReturnValue(SfxBoolItem(nSlot, nFound != 0 && ULONG_MAX != nFound));
+ if( !nFound )
+ {
+ if( !bApi )
+ {
+ Window* pParentWindow = GetParentWindow( pSrchDlg );
+ InfoBox( pParentWindow, SW_RES(MSG_NOT_FOUND)).Execute();
+ }
+ bFound = FALSE;
+ return;
+ }
+
+ if( !bApi && ULONG_MAX != nFound)
+ {
+ String aText( SW_RES( STR_NB_REPLACED ) );
+ const xub_StrLen nPos = aText.Search( String::CreateFromAscii("XX") );
+ aText.Erase( nPos, 2 );
+ aText.Insert( String::CreateFromInt32( nFound ), nPos );
+ Window* pParentWindow = GetParentWindow( pSrchDlg );
+ InfoBox( pParentWindow, aText ).Execute();
+ }
+ }
+ break;
+ }
+
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ GetViewFrame()->GetBindings().GetRecorder();
+ //prevent additional dialogs in recorded macros
+ if ( xRecorder.is() )
+ rReq.AppendItem(SfxBoolItem(SID_SEARCH_QUIET, sal_True));
+
+ rReq.Done();
+ }
+ break;
+ case FID_SEARCH_SEARCHSET:
+ case FID_SEARCH_REPLACESET:
+ {
+ static const USHORT aNormalAttr[] =
+ {
+/* 0 */ RES_CHRATR_CASEMAP, RES_CHRATR_CASEMAP,
+/* 2 */ RES_CHRATR_COLOR, RES_CHRATR_POSTURE,
+/* 4 */ RES_CHRATR_SHADOWED, RES_CHRATR_WORDLINEMODE,
+/* 6 */ RES_CHRATR_BLINK, RES_CHRATR_BLINK,
+/* 8 */ RES_CHRATR_BACKGROUND, RES_CHRATR_BACKGROUND,
+/*10 */ RES_CHRATR_ROTATE, RES_CHRATR_ROTATE,
+/*12 */ RES_CHRATR_SCALEW, RES_CHRATR_RELIEF,
+// insert position for CJK/CTL attributes!
+/*14 */ RES_PARATR_LINESPACING, RES_PARATR_HYPHENZONE,
+/*16 */ RES_PARATR_REGISTER, RES_PARATR_REGISTER,
+/*18 */ RES_PARATR_VERTALIGN, RES_PARATR_VERTALIGN,
+/*20 */ RES_LR_SPACE, RES_UL_SPACE,
+/*22 */ SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
+/*24 */ 0
+ };
+
+ static const USHORT aCJKAttr[] =
+ {
+ RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_WEIGHT,
+ RES_CHRATR_EMPHASIS_MARK, RES_CHRATR_TWO_LINES,
+ RES_PARATR_SCRIPTSPACE, RES_PARATR_FORBIDDEN_RULES
+ };
+ static const USHORT aCTLAttr[] =
+ {
+ RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_WEIGHT
+ };
+
+ SvUShorts aArr( 0, 16 );
+ aArr.Insert( aNormalAttr,
+ sizeof( aNormalAttr ) / sizeof( aNormalAttr[0] ),
+ 0 );
+ if( SW_MOD()->GetCTLOptions().IsCTLFontEnabled() )
+ aArr.Insert( aCTLAttr,
+ sizeof( aCTLAttr ) / sizeof( aCTLAttr[0] ),
+ 14 );
+ SvtCJKOptions aCJKOpt;
+ if( aCJKOpt.IsAnyEnabled() )
+ aArr.Insert( aCJKAttr,
+ sizeof( aCJKAttr ) / sizeof( aCJKAttr[0] ),
+ 14 );
+
+ SfxItemSet aSet( pWrtShell->GetAttrPool(), aArr.GetData() );
+ USHORT nWhich = SID_SEARCH_SEARCHSET;
+
+ if ( FID_SEARCH_REPLACESET == nSlot )
+ {
+ nWhich = SID_SEARCH_REPLACESET;
+
+ if ( pReplList )
+ {
+ pReplList->Get( aSet );
+ DELETEZ( pReplList );
+ }
+ }
+ else if ( pSrchList )
+ {
+ pSrchList->Get( aSet );
+ DELETEZ( pSrchList );
+ }
+ rReq.SetReturnValue( SvxSetItem( nWhich, aSet ) );
+ }
+ break;
+ default:
+#ifdef DBG_UTIL
+ if(nSlot)
+ {
+ ByteString sStr( "nSlot: " );
+ sStr += ByteString::CreateFromInt32( nSlot );
+ sStr += " falscher Dispatcher (viewsrch.cxx)";
+ DBG_ERROR( sStr.GetBuffer() );
+ }
+#endif
+ return;
+ }
+}
+
+
+BOOL SwView::SearchAndWrap(BOOL bApi)
+{
+ SwSearchOptions aOpts( pWrtShell, pSrchItem->GetBackward() );
+
+ // Startposition der Suche fuer WrapAround merken
+ // Start- / EndAction wegen vielleicht bestehender Selektionen
+ // aus 'Suche alle'
+ pWrtShell->StartAllAction();
+ pWrtShell->Push();
+ // falls in selektierten Bereichen gesucht werden soll, duerfen sie
+ // nicht aufgehoben werden
+ if (!pSrchItem->GetSelection())
+ (pWrtShell->*pWrtShell->fnKillSel)(0, FALSE);
+
+ SwWait *pWait = new SwWait( *GetDocShell(), TRUE );
+ if( FUNC_Search( aOpts ) )
+ {
+ bFound = TRUE;
+ if(pWrtShell->IsSelFrmMode())
+ {
+ pWrtShell->UnSelectFrm();
+ pWrtShell->LeaveSelFrmMode();
+ }
+ pWrtShell->Pop();
+ pWrtShell->EndAllAction();
+ delete pWait;
+ return TRUE;
+ }
+ delete pWait, pWait = 0;
+
+ // Suchen in den Sonderbereichen, wenn keine
+ // Suche in Selektionen vorliegt. Bei Suche in Selektionen
+ // wird ohnehin in diesen Sonderbereichen gesucht
+ BOOL bHasSrchInOther = bExtra;
+ if (!pSrchItem->GetSelection() && !bExtra )
+ {
+ bExtra = TRUE;
+ if( FUNC_Search( aOpts ) )
+ {
+ bFound = TRUE;
+ pWrtShell->Pop();
+ pWrtShell->EndAllAction();
+ return TRUE;
+ }
+ bExtra = FALSE;
+ }
+ else
+ bExtra = !bExtra;
+
+ const USHORT nId = SvxSearchDialogWrapper::GetChildWindowId();
+ SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nId);
+ pSrchDlg = pWrp ? static_cast <SvxSearchDialog*> (pWrp->getDialog ()) : 0;
+
+ // falls Startposition am Dokumentende / -anfang
+ if (aOpts.bDontWrap)
+ {
+ pWrtShell->EndAllAction();
+ if( !bApi )
+ {
+ Window* pParentWindow = GetParentWindow( pSrchDlg );
+ InfoBox( pParentWindow, SW_RES(MSG_NOT_FOUND)).Execute();
+ }
+ bFound = FALSE;
+ pWrtShell->Pop();
+ return FALSE;
+ }
+ pWrtShell->EndAllAction();
+ // noch mal mit WrapAround versuchen?
+
+ if( bApi || RET_NO == QueryBox( GetParentWindow( pSrchDlg ),
+ SW_RES( DOCPOS_START == aOpts.eEnd
+ ? MSG_SEARCH_START
+ : MSG_SEARCH_END )
+ ).Execute() )
+ {
+ bFound = FALSE;
+ pWrtShell->Pop();
+ return FALSE;
+ }
+ pWrtShell->StartAllAction();
+ pWrtShell->Pop(FALSE);
+ pWait = new SwWait( *GetDocShell(), TRUE );
+
+ BOOL bSrchBkwrd = DOCPOS_START == aOpts.eEnd;
+
+ aOpts.eEnd = bSrchBkwrd ? DOCPOS_START : DOCPOS_END;
+ aOpts.eStart = bSrchBkwrd ? DOCPOS_END : DOCPOS_START;
+
+ if (bHasSrchInOther)
+ {
+ pWrtShell->ClearMark();
+ if (bSrchBkwrd)
+ pWrtShell->EndDoc();
+ else
+ pWrtShell->SttDoc();
+ }
+
+ bFound = 0 != FUNC_Search( aOpts );
+ pWrtShell->EndAllAction();
+ delete pWait;
+ if ( bFound )
+ return bFound;
+ if(!bApi)
+ {
+ Window* pParentWindow = GetParentWindow( pSrchDlg );
+ InfoBox( pParentWindow, SW_RES(MSG_NOT_FOUND)).Execute();
+ }
+ return bFound = FALSE;
+}
+
+
+BOOL SwView::SearchAll(USHORT* pFound)
+{
+ SwWait aWait( *GetDocShell(), TRUE );
+ pWrtShell->StartAllAction();
+
+ SwSearchOptions aOpts( pWrtShell, pSrchItem->GetBackward() );
+
+ if (!pSrchItem->GetSelection())
+ {
+ // bestehende Selektionen aufheben,
+ // wenn nicht in selektierten Bereichen gesucht werden soll
+ (pWrtShell->*pWrtShell->fnKillSel)(0, FALSE);
+
+ if( DOCPOS_START == aOpts.eEnd )
+ pWrtShell->EndDoc();
+ else
+ pWrtShell->SttDoc();
+ }
+ bExtra = FALSE;
+ USHORT nFound = (USHORT)FUNC_Search( aOpts );
+ if(pFound)
+ *pFound = nFound;
+ bFound = 0 != nFound;
+
+ pWrtShell->EndAllAction();
+ return bFound;
+}
+
+
+void SwView::Replace()
+{
+ SwWait aWait( *GetDocShell(), TRUE );
+
+ pWrtShell->StartAllAction();
+
+ if( pSrchItem->GetPattern() ) // Vorlagen?
+ {
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, pSrchItem->GetSearchString());
+ aRewriter.AddRule(UNDO_ARG2, SW_RES(STR_YIELDS));
+ aRewriter.AddRule(UNDO_ARG3, pSrchItem->GetReplaceString());
+
+ pWrtShell->StartUndo(UNDO_UI_REPLACE_STYLE, &aRewriter); // #111827#
+
+ pWrtShell->SetTxtFmtColl( pWrtShell->GetParaStyle(
+ pSrchItem->GetReplaceString(),
+ SwWrtShell::GETSTYLE_CREATESOME ));
+
+ pWrtShell->EndUndo(); // #111827#
+ }
+ else
+ {
+ if (GetPostItMgr()->HasActiveSidebarWin())
+ GetPostItMgr()->Replace(pSrchItem);
+ sal_Bool bReplaced = pWrtShell->SwEditShell::Replace( pSrchItem->GetReplaceString(),
+ pSrchItem->GetRegExp());
+
+ if( bReplaced && pReplList && pReplList->Count() && pWrtShell->HasSelection() )
+ {
+ SfxItemSet aReplSet( pWrtShell->GetAttrPool(),
+ aTxtFmtCollSetRange );
+ if( pReplList->Get( aReplSet ).Count() )
+ {
+ ::SfxToSwPageDescAttr( *pWrtShell, aReplSet );
+ pWrtShell->SwEditShell::SetAttr( aReplSet );
+ }
+ }
+ }
+
+ pWrtShell->EndAllAction();
+}
+
+
+
+SwSearchOptions::SwSearchOptions( SwWrtShell* pSh, BOOL bBackward )
+{
+ eStart = DOCPOS_CURR;
+ if( bBackward )
+ {
+ eEnd = DOCPOS_START;
+ bDontWrap = pSh->IsEndOfDoc();
+ }
+ else
+ {
+ eEnd = DOCPOS_END;
+ bDontWrap = pSh->IsStartOfDoc();
+ }
+}
+
+ULONG SwView::FUNC_Search( const SwSearchOptions& rOptions )
+{
+ BOOL bDoReplace = pSrchItem->GetCommand() == SVX_SEARCHCMD_REPLACE ||
+ pSrchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL;
+
+ int eRanges = pSrchItem->GetSelection() ?
+ FND_IN_SEL : bExtra ? FND_IN_OTHER : FND_IN_BODY;
+ if (pSrchItem->GetCommand() == SVX_SEARCHCMD_FIND_ALL ||
+ pSrchItem->GetCommand() == SVX_SEARCHCMD_REPLACE_ALL)
+ eRanges |= FND_IN_SELALL;
+
+ pWrtShell->SttSelect();
+
+ static USHORT __READONLY_DATA aSearchAttrRange[] = {
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_PARATR_BEGIN, RES_PARATR_END-1,
+ SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
+ 0 };
+
+ SfxItemSet aSrchSet( pWrtShell->GetAttrPool(), aSearchAttrRange);
+ if( pSrchList && pSrchList->Count() )
+ {
+ pSrchList->Get( aSrchSet );
+
+ /* -- Seitenumbruch mit Seitenvorlage */
+ ::SfxToSwPageDescAttr( *pWrtShell, aSrchSet );
+ }
+
+ SfxItemSet* pReplSet = 0;
+ if( bDoReplace && pReplList && pReplList->Count() )
+ {
+ pReplSet = new SfxItemSet( pWrtShell->GetAttrPool(),
+ aSearchAttrRange );
+ pReplList->Get( *pReplSet );
+
+ /* -- Seitenumbruch mit Seitenvorlage */
+ ::SfxToSwPageDescAttr( *pWrtShell, *pReplSet );
+
+ if( !pReplSet->Count() ) // schade, die Attribute
+ DELETEZ( pReplSet ); // kennen wir nicht
+ }
+
+ //
+ // build SearchOptions to be used
+ //
+ SearchOptions aSearchOpt( pSrchItem->GetSearchOptions() );
+ aSearchOpt.Locale = SvxCreateLocale( (USHORT)GetAppLanguage() );
+ if( !bDoReplace )
+ aSearchOpt.replaceString = aEmptyStr;
+
+ ULONG nFound;
+ if( aSrchSet.Count() || ( pReplSet && pReplSet->Count() ))
+ {
+ nFound = pWrtShell->SearchAttr(
+ aSrchSet,
+ !pSrchItem->GetPattern(),
+ rOptions.eStart,
+ rOptions.eEnd,
+ FindRanges(eRanges),
+ pSrchItem->GetSearchString().Len() ? &aSearchOpt : 0,
+ pReplSet );
+ }
+ else if( pSrchItem->GetPattern() )
+ {
+ // Suchen (und ersetzen) von Vorlagen
+ const String sRplStr( pSrchItem->GetReplaceString() );
+ nFound = pWrtShell->SearchTempl( pSrchItem->GetSearchString(),
+ rOptions.eStart,
+ rOptions.eEnd,
+ FindRanges(eRanges),
+ bDoReplace ? &sRplStr : 0 );
+ }
+ else
+ {
+ // Normale Suche
+ nFound = pWrtShell->SearchPattern(aSearchOpt, pSrchItem->GetNotes(),
+ rOptions.eStart,
+ rOptions.eEnd,
+ FindRanges(eRanges),
+ bDoReplace );
+ }
+ pWrtShell->EndSelect();
+ return nFound;
+}
+
+LAYOUT_NS Dialog* SwView::GetSearchDialog()
+{
+ const USHORT nId = SvxSearchDialogWrapper::GetChildWindowId();
+ SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)SfxViewFrame::Current()->GetChildWindow(nId);
+ if ( pWrp )
+ pSrchDlg = pWrp->getDialog ();
+ else
+ pSrchDlg = 0;
+ return pSrchDlg;
+}
+
+void SwView::StateSearch(SfxItemSet &rSet)
+{
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+
+ while(nWhich)
+ {
+ switch(nWhich)
+ {
+ case SID_SEARCH_OPTIONS:
+ {
+ UINT16 nOpt = 0xFFFF;
+ if( GetDocShell()->IsReadOnly() )
+ nOpt &= ~( SEARCH_OPTIONS_REPLACE |
+ SEARCH_OPTIONS_REPLACE_ALL );
+ rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS, nOpt));
+ }
+ break;
+ case SID_SEARCH_ITEM:
+ {
+ if ( !pSrchItem )
+ {
+ pSrchItem = new SvxSearchItem( SID_SEARCH_ITEM );
+ pSrchItem->SetFamily(SFX_STYLE_FAMILY_PARA);
+ pSrchItem->SetSearchString( pWrtShell->GetSelTxt() );
+ }
+
+ if( bJustOpened && pWrtShell->IsSelection() )
+ {
+ String aTxt;
+ if( 1 == pWrtShell->GetCrsrCnt() &&
+ ( aTxt = pWrtShell->SwCrsrShell::GetSelTxt() ).Len() )
+ {
+ pSrchItem->SetSearchString( aTxt );
+ pSrchItem->SetSelection( FALSE );
+ }
+ else
+ pSrchItem->SetSelection( TRUE );
+ }
+
+ bJustOpened = FALSE;
+ rSet.Put( *pSrchItem );
+ }
+ break;
+
+/* case SID_SEARCH_REPLACESET:
+ case SID_SEARCH_SEARCHSET:
+ {
+ static USHORT __READONLY_DATA aSearchAttrRange[] =
+ {
+ RES_CHRATR_CASEMAP, RES_CHRATR_POSTURE,
+ RES_CHRATR_SHADOWED, RES_CHRATR_WORDLINEMODE,
+ RES_PARATR_LINESPACING, RES_PARATR_HYPHENZONE,
+ RES_LR_SPACE, RES_UL_SPACE,
+ SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
+ 0
+ };
+
+ SfxItemSet aSet(pWrtShell->GetAttrPool(), aSearchAttrRange );
+ if( SID_SEARCH_REPLACESET==nWhich )
+ {
+ if( pReplList )
+ {
+ pReplList->Get( aSet );
+ DELETEZ( pReplList );
+ }
+ }
+ else if( pSrchList )
+ {
+ pSrchList->Get( aSet );
+ DELETEZ( pSrchList );
+ }
+ rSet.Put( SvxSetItem( nWhich, aSet ));
+ }
+ break;
+*/
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+
+
diff --git a/sw/source/ui/uiview/viewstat.cxx b/sw/source/ui/uiview/viewstat.cxx
new file mode 100644
index 000000000000..d0b9d2a06827
--- /dev/null
+++ b/sw/source/ui/uiview/viewstat.cxx
@@ -0,0 +1,523 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx>
+#include <com/sun/star/linguistic2/XThesaurus.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <svl/aeitem.hxx>
+#include <svl/whiter.hxx>
+#include <svl/cjkoptions.hxx>
+
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/objitem.hxx>
+#include <svl/imageitm.hxx>
+#include <svl/languageoptions.hxx>
+#include <editeng/protitem.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <editeng/langitem.hxx>
+#include <editeng/brshitem.hxx>
+#include <svx/htmlmode.hxx>
+#include <editeng/unolingu.hxx>
+#include <sfx2/msgpool.hxx>
+#include <swmodule.hxx>
+#include <tox.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/app.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <basesh.hxx>
+#include <uitool.hxx>
+#include <viewopt.hxx>
+#include <tablemgr.hxx>
+#include <pagedesc.hxx>
+#include <wview.hxx>
+#include <globdoc.hxx>
+#include <svl/stritem.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <svl/visitem.hxx>
+
+#include <cmdid.h>
+
+#include <IDocumentRedlineAccess.hxx>
+
+using namespace ::com::sun::star;
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwView::GetState(SfxItemSet &rSet)
+{
+ SfxWhichIter aIter(rSet);
+ sal_uInt16 nWhich = aIter.FirstWhich();
+ sal_uInt16 eFrmType = FRMTYPE_NONE;
+ int bGetFrmType = sal_False;
+ sal_Bool bWeb = 0 != PTR_CAST(SwWebView, this);
+
+ while(nWhich)
+ {
+ switch(nWhich)
+ {
+ case FN_EDIT_LINK_DLG:
+ if( !pWrtShell->GetLinkManager().GetLinks().Count() )
+ rSet.DisableItem(nWhich);
+ else if( pWrtShell->IsSelFrmMode() &&
+ pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT))
+ rSet.DisableItem(nWhich);
+ break;
+
+ case FN_INSERT_CAPTION:
+ {
+ // Captions gibt's fuer Grafiken, OLE-Objekte, Rahmen und Tabellen
+ if( !bGetFrmType )
+ eFrmType = pWrtShell->GetFrmType(0,sal_True), bGetFrmType = sal_True;
+ if (! ( ((eFrmType & FRMTYPE_FLY_ANY) && nSelectionType != nsSelectionType::SEL_DRW_TXT)||
+ nSelectionType & nsSelectionType::SEL_TBL ||
+ nSelectionType & nsSelectionType::SEL_DRW) )
+ rSet.DisableItem(nWhich);
+ else if((pWrtShell->IsObjSelected()||pWrtShell->IsFrmSelected()) &&
+ (pWrtShell->IsSelObjProtected( FLYPROTECT_PARENT)||
+ pWrtShell->IsSelObjProtected( FLYPROTECT_CONTENT )))
+ rSet.DisableItem(nWhich);
+ else if( pWrtShell->IsTableMode() )
+ rSet.DisableItem(nWhich);
+ }
+ break;
+
+ case FN_EDIT_FOOTNOTE:
+ {
+ if( !pWrtShell->GetCurFtn() )
+ rSet.DisableItem(nWhich);
+ }
+ break;
+
+ case FN_CHANGE_PAGENUM:
+ {
+ sal_uInt16 nType = pWrtShell->GetFrmType(0,sal_True);
+ if( ( FRMTYPE_FLY_ANY | FRMTYPE_HEADER | FRMTYPE_FOOTER |
+ FRMTYPE_FOOTNOTE | FRMTYPE_DRAWOBJ ) & nType )
+ rSet.DisableItem(nWhich);
+ else
+ rSet.Put(SfxUInt16Item(nWhich, pWrtShell->GetPageOffset()));
+ }
+ break;
+ case SID_PRINTDOC:
+ case SID_PRINTDOCDIRECT:
+ GetSlotState( nWhich, SfxViewShell::GetInterface(), &rSet );
+ break;
+ case SID_ATTR_PAGE:
+ case SID_ATTR_PAGE_SIZE:
+ case SID_ATTR_PAGE_PAPERBIN:
+ case RES_PAPER_BIN:
+ case FN_PARAM_FTN_INFO:
+ {
+ const sal_uInt16 nCurIdx = pWrtShell->GetCurPageDesc();
+ const SwPageDesc& rDesc = pWrtShell->GetPageDesc( nCurIdx );
+ ::PageDescToItemSet( rDesc, rSet);
+ }
+ break;
+ case RES_BACKGROUND:
+ case SID_ATTR_BRUSH:
+ {
+ const sal_uInt16 nCurIdx = pWrtShell->GetCurPageDesc();
+ const SwPageDesc& rDesc = pWrtShell->GetPageDesc( nCurIdx );
+ const SwFrmFmt& rMaster = rDesc.GetMaster();
+ const SvxBrushItem& rBrush = (const SvxBrushItem&)
+ rMaster.GetFmtAttr(RES_BACKGROUND, sal_True);
+ rSet.Put(rBrush);
+ }
+ break;
+ case SID_CLEARHISTORY:
+ {
+ rSet.Put(SfxBoolItem(nWhich, pWrtShell->GetLastUndoInfo(0, 0)));
+ }
+ break;
+ case SID_UNDO:
+ {
+ //JP 21.07.98: Bug 53429 - die muss noch nicht vorhanden sein
+ // also lasse sie mal anlegen:
+ if( !pShell )
+ SelectShell();
+
+ const SfxPoolItem* pState = pShell->GetSlotState(SID_UNDO);
+ if(pState)
+ rSet.Put(*pState);
+ else
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case FN_INSERT_CTRL:
+ {
+ SfxImageItem aImgItem(nWhich, bWeb ? SwView::nWebInsertCtrlState : SwView::nInsertCtrlState);
+ SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( GetViewFrame() );
+ const SfxSlot* pSlot = rPool.GetSlot( aImgItem.GetValue() );
+ if(pSlot && pSlot->IsMode( SFX_SLOT_IMAGEROTATION ))
+ {
+ if(pWrtShell->IsInVerticalText())
+ aImgItem.SetRotation(2700);
+ if(pWrtShell->IsInRightToLeftText())
+ aImgItem.SetMirrored(TRUE);
+ }
+ rSet.Put(aImgItem);
+ }
+ break;
+ case FN_INSERT_OBJ_CTRL:
+ if(bWeb)
+ rSet.DisableItem(nWhich);
+ else
+ {
+ SfxImageItem aImgItem(nWhich, SwView::nInsertObjectCtrlState);
+ SfxSlotPool& rPool = SfxSlotPool::GetSlotPool( GetViewFrame() );
+ const SfxSlot* pSlot = rPool.GetSlot( aImgItem.GetValue() );
+ if(pSlot && pSlot->IsMode( SFX_SLOT_IMAGEROTATION ))
+ {
+ if(pWrtShell->IsInVerticalText())
+ aImgItem.SetRotation(2700);
+ if(pWrtShell->IsInRightToLeftText())
+ aImgItem.SetMirrored(TRUE);
+ }
+ rSet.Put(aImgItem);
+ }
+ break;
+ case FN_UPDATE_TOX:
+ if(!pWrtShell->GetTOXCount())
+ rSet.DisableItem(nWhich);
+ break;
+ case FN_EDIT_CURRENT_TOX:
+ case FN_UPDATE_CUR_TOX:
+ {
+ const SwTOXBase* pBase = 0;
+ if(0 == (pBase = pWrtShell->GetCurTOX()) ||
+ (FN_EDIT_CURRENT_TOX == nWhich && pBase->IsTOXBaseInReadonly()))
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case SID_TWAIN_SELECT:
+ case SID_TWAIN_TRANSFER:
+#if defined WNT || defined UNX
+ {
+ if(!SW_MOD()->GetScannerManager().is())
+ rSet.DisableItem(nWhich);
+ }
+#endif
+ break;
+ case RES_PARATR_TABSTOP:
+ case SID_ATTR_DEFTABSTOP:
+ {
+ const SvxTabStopItem& rDefTabs =
+ (const SvxTabStopItem&)pWrtShell->
+ GetDefault(RES_PARATR_TABSTOP);
+ rSet.Put( SfxUInt16Item( nWhich,
+ (sal_uInt16)::GetTabDist(rDefTabs)));
+ }
+ break;
+ case SID_ATTR_LANGUAGE:
+ {
+ rSet.Put((const SvxLanguageItem&)
+ pWrtShell->GetDefault(RES_CHRATR_LANGUAGE), SID_ATTR_LANGUAGE);
+ }
+ break;
+ case RES_CHRATR_CJK_LANGUAGE:
+ rSet.Put((const SvxLanguageItem&)
+ pWrtShell->GetDefault(RES_CHRATR_CJK_LANGUAGE), RES_CHRATR_CJK_LANGUAGE);
+ break;
+ case RES_CHRATR_CTL_LANGUAGE:
+ rSet.Put((const SvxLanguageItem&)
+ pWrtShell->GetDefault(RES_CHRATR_CTL_LANGUAGE), RES_CHRATR_CTL_LANGUAGE);
+ break;
+ case FN_HYPHENATE_OPT_DLG:
+ {
+ sal_Bool bCheck = sal_False;
+
+ if (pWrtShell->GetSelectionType() & (nsSelectionType::SEL_DRW_TXT|nsSelectionType::SEL_DRW))
+ bCheck = IsDrawTextHyphenate();
+ rSet.Put(SfxBoolItem(nWhich, bCheck));
+ }
+ break;
+ case FN_REDLINE_ON:
+ rSet.Put( SfxBoolItem( nWhich, GetDocShell()->IsChangeRecording() ) );
+ break;
+ case FN_REDLINE_PROTECT :
+ rSet.Put( SfxBoolItem( nWhich, GetDocShell()->HasChangeRecordProtection() ) );
+ break;
+ case FN_REDLINE_SHOW:
+ {
+ sal_uInt16 nMask = nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE;
+ rSet.Put( SfxBoolItem( nWhich,
+ (pWrtShell->GetRedlineMode() & nMask) == nMask ));
+ }
+ break;
+ case SID_GALLERY :
+ case SID_AVMEDIA_PLAYER :
+ case FN_REDLINE_ACCEPT :
+ {
+ SfxViewFrame* pVFrame = GetViewFrame();
+ if (pVFrame->KnowsChildWindow(nWhich))
+ rSet.Put(SfxBoolItem( nWhich, pVFrame->HasChildWindow(nWhich)));
+ else
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case FN_REDLINE_ACCEPT_DIRECT:
+ case FN_REDLINE_REJECT_DIRECT:
+ {
+ SwContentAtPos aCntntAtPos( SwContentAtPos::SW_REDLINE );
+ Point aCrsrPos = pWrtShell->GetCrsrDocPos( sal_True );
+ if( !pWrtShell->GetContentAtPos( aCrsrPos, aCntntAtPos ) )
+ rSet.DisableItem( nWhich );
+ }
+ break;
+ case SID_THESAURUS:
+ {
+ SwWrtShell &rSh = GetWrtShell();
+ if (2 <= rSh.GetCrsrCnt()) // multi selection?
+ rSet.DisableItem(nWhich);
+ else
+ {
+ LanguageType nLang = rSh.GetCurLang();
+
+ // disable "Thesaurus" (menu entry and key shortcut) if the
+ // language is not supported (by default it is enabled)
+ uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
+ if (!xThes.is() || nLang == LANGUAGE_NONE ||
+ !xThes->hasLocale( SvxCreateLocale( nLang ) ))
+ rSet.DisableItem(nWhich);
+ }
+ }
+ break;
+ case SID_HANGUL_HANJA_CONVERSION:
+ case SID_CHINESE_CONVERSION:
+ {
+ if (!SvtCJKOptions().IsAnyEnabled())
+ {
+ GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
+ rSet.DisableItem(nWhich);
+ }
+ else
+ GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
+ }
+ break;
+ case SID_MAIL_SCROLLBODY_PAGEDOWN:
+ {
+ const long nBottom = pWrtShell->GetDocSize().Height() + DOCUMENTBORDER;
+ const long nAct = GetVisArea().Bottom();
+ rSet.Put(SfxBoolItem(SID_MAIL_SCROLLBODY_PAGEDOWN, nAct < nBottom ));
+ }
+ break;
+
+ case SID_DOCUMENT_COMPARE:
+ case SID_DOCUMENT_MERGE:
+ if( GetDocShell()->IsA( SwGlobalDocShell::StaticType() ) ||
+// pWrtShell->IsAnySectionInDoc( sal_True, sal_True, sal_True )||
+ (SID_DOCUMENT_MERGE == nWhich && pWrtShell->getIDocumentRedlineAccess()->GetRedlinePassword().getLength()))
+ rSet.DisableItem(nWhich);
+ break;
+ case SID_VIEW_DATA_SOURCE_BROWSER:
+ if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::E_SDATABASE ) )
+ rSet.Put( SfxVisibilityItem( nWhich, sal_False ) );
+ else
+ rSet.Put( SfxBoolItem( nWhich, GetViewFrame()->HasChildWindow( SID_BROWSER ) ) );
+ break;
+ case SID_READONLY_MODE:
+ rSet.Put(SfxBoolItem(nWhich,
+ pWrtShell->HasReadonlySel()||GetDocShell()->IsReadOnly()));
+ break;
+ case SID_IMAGE_ORIENTATION:
+ {
+ SfxImageItem aImageItem(nWhich);
+ if(pWrtShell->IsInVerticalText())
+ aImageItem.SetRotation( 2700 );
+ if(pWrtShell->IsInRightToLeftText())
+ aImageItem.SetMirrored( TRUE );
+ rSet.Put(aImageItem);
+ }
+ break;
+ case FN_INSERT_FIELD_DATA_ONLY :
+ if(!bInMailMerge && !GetViewFrame()->HasChildWindow(nWhich))
+ rSet.DisableItem(nWhich);
+ break;
+ case FN_MAILMERGE_SENDMAIL_CHILDWINDOW:
+ break;
+ case FN_MAILMERGE_CHILDWINDOW:
+ {
+ if(!GetMailMergeConfigItem())
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case SID_ALIGN_ANY_LEFT :
+ case SID_ALIGN_ANY_HCENTER :
+ case SID_ALIGN_ANY_RIGHT :
+ case SID_ALIGN_ANY_JUSTIFIED:
+ case SID_ALIGN_ANY_TOP :
+ case SID_ALIGN_ANY_VCENTER :
+ case SID_ALIGN_ANY_BOTTOM :
+ case SID_ALIGN_ANY_HDEFAULT :
+ case SID_ALIGN_ANY_VDEFAULT :
+ {
+ if( !pShell )
+ SelectShell();
+ USHORT nAlias = 0;
+ bool bDraw = false;
+ if( nSelectionType & (nsSelectionType::SEL_DRW_TXT|nsSelectionType::SEL_TXT) )
+ {
+ switch( nWhich )
+ {
+ case SID_ALIGN_ANY_LEFT : nAlias = SID_ATTR_PARA_ADJUST_LEFT; break;
+ case SID_ALIGN_ANY_HCENTER : nAlias = SID_ATTR_PARA_ADJUST_CENTER; break;
+ case SID_ALIGN_ANY_RIGHT : nAlias = SID_ATTR_PARA_ADJUST_RIGHT; break;
+ case SID_ALIGN_ANY_JUSTIFIED: nAlias = SID_ATTR_PARA_ADJUST_BLOCK; break;
+ case SID_ALIGN_ANY_TOP : nAlias = FN_TABLE_VERT_NONE; break;
+ case SID_ALIGN_ANY_VCENTER : nAlias = FN_TABLE_VERT_CENTER; break;
+ case SID_ALIGN_ANY_BOTTOM : nAlias = FN_TABLE_VERT_BOTTOM; break;
+ }
+ }
+ else if(nSelectionType & (nsSelectionType::SEL_DRW))
+ {
+ //the draw shell cannot provide a status per item - only one for SID_OBJECT_ALIGN
+ if(nWhich != SID_ALIGN_ANY_JUSTIFIED)
+ {
+ const SfxPoolItem* pItem = 0;
+ GetViewFrame()->GetDispatcher()->QueryState( SID_OBJECT_ALIGN, pItem );
+ if(pItem)
+ bDraw = true;
+ }
+ }
+ else
+ {
+ switch( nWhich )
+ {
+ case SID_ALIGN_ANY_LEFT : nAlias = SID_OBJECT_ALIGN_LEFT ; break;
+ case SID_ALIGN_ANY_HCENTER : nAlias = SID_OBJECT_ALIGN_CENTER ; break;
+ case SID_ALIGN_ANY_RIGHT : nAlias = SID_OBJECT_ALIGN_RIGHT ; break;
+ case SID_ALIGN_ANY_TOP : nAlias = SID_OBJECT_ALIGN_UP ; break;
+ case SID_ALIGN_ANY_VCENTER : nAlias = SID_OBJECT_ALIGN_MIDDLE ; break;
+ case SID_ALIGN_ANY_BOTTOM : nAlias = SID_OBJECT_ALIGN_DOWN ; break;
+ }
+ }
+ //these slots are either re-mapped to text or object alignment
+ const SfxPoolItem* pState = 0;
+ if(nAlias)
+ GetViewFrame()->GetDispatcher()->QueryState( nAlias, pState );
+ if(pState)
+ rSet.Put(*pState, nWhich);
+ else if(!bDraw)
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwView::GetDrawState(SfxItemSet &rSet)
+{
+ SfxWhichIter aIter(rSet);
+ sal_Bool bWeb = 0 != PTR_CAST(SwWebView, this);
+
+ for( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich;
+ nWhich = aIter.NextWhich() )
+ switch(nWhich)
+ {
+ case SID_INSERT_DRAW:
+ if ( bWeb )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ SfxAllEnumItem aEnum(SID_INSERT_DRAW, nDrawSfxId);
+ if ( !SvtLanguageOptions().IsVerticalTextEnabled() )
+ {
+ aEnum.DisableValue( SID_DRAW_CAPTION_VERTICAL );
+ aEnum.DisableValue( SID_DRAW_TEXT_VERTICAL );
+ }
+ rSet.Put(aEnum);
+ }
+ break;
+
+ case SID_SHOW_HIDDEN:
+ case SID_SHOW_FORMS:
+ rSet.DisableItem( nWhich );
+ // rSet.Put( SfxBoolItem(nWhich,sal_True ));
+ break;
+
+ case SID_DRAW_TEXT_MARQUEE:
+ if (::GetHtmlMode(GetDocShell()) & HTMLMODE_SOME_STYLES)
+ rSet.Put( SfxBoolItem(nWhich, nDrawSfxId == nWhich));
+ else
+ rSet.DisableItem(nWhich);
+ break;
+ case SID_OBJECT_SELECT:
+ rSet.Put( SfxBoolItem(nWhich, nDrawSfxId == nWhich ||
+ nFormSfxId == nWhich));
+ break;
+
+ case SID_FONTWORK_GALLERY_FLOATER :
+ {
+ if ( bWeb )
+ rSet.DisableItem( nWhich );
+ }
+ break;
+
+ case SID_DRAWTBX_CS_BASIC :
+ case SID_DRAWTBX_CS_SYMBOL :
+ case SID_DRAWTBX_CS_ARROW :
+ case SID_DRAWTBX_CS_FLOWCHART :
+ case SID_DRAWTBX_CS_CALLOUT :
+ case SID_DRAWTBX_CS_STAR :
+ {
+ if ( bWeb )
+ rSet.DisableItem( nWhich );
+ else
+ rSet.Put(SfxStringItem(nWhich, aCurrShapeEnumCommand[ nWhich - SID_DRAWTBX_CS_BASIC ] ));
+ }
+ break;
+
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Bool SwView::HasUIFeature( sal_uInt32 nFeature )
+{
+ sal_Bool bRet = sal_False;
+ switch(nFeature)
+ {
+ case CHILDWIN_LABEL : bRet = pWrtShell->IsLabelDoc(); break;
+ case CHILDWIN_MAILMERGE : bRet = 0 != GetMailMergeConfigItem(); break;
+ }
+ return bRet;
+}
+
diff --git a/sw/source/ui/uiview/viewtab.cxx b/sw/source/ui/uiview/viewtab.cxx
new file mode 100644
index 000000000000..ca65184c74e6
--- /dev/null
+++ b/sw/source/ui/uiview/viewtab.cxx
@@ -0,0 +1,1848 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <tools/list.hxx>
+
+#include <hintids.hxx>
+#include "uitool.hxx"
+#include <sfx2/app.hxx>
+#include <svx/rulritem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <sfx2/request.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <svl/eitem.hxx>
+#include <svl/whiter.hxx>
+#include <svx/ruler.hxx>
+#include <editeng/protitem.hxx>
+#include <svl/rectitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <fmtfsize.hxx>
+#include <fmthdft.hxx>
+#include <fmtclds.hxx>
+#include <fmtornt.hxx>
+#include <frmatr.hxx>
+#include <edtwin.hxx>
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "basesh.hxx"
+#include "cmdid.h"
+#include "viewopt.hxx"
+#include "tabcol.hxx"
+#include "frmfmt.hxx" // FrameFormat
+#include "pagedesc.hxx" // Aktuelles Seitenformat
+#include "wview.hxx"
+#include "fmtcol.hxx"
+#include "section.hxx"
+
+// -> #i23726#
+#include "ndtxt.hxx"
+#include "pam.hxx"
+// <- #i23726#
+
+#include <IDocumentSettingAccess.hxx>
+
+using namespace ::com::sun::star;
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Debug-Methode
+ --------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Columns eintueten
+ --------------------------------------------------------------------*/
+
+
+void lcl_FillSvxColumn(const SwFmtCol& rCol,
+ USHORT nTotalWidth,
+ SvxColumnItem& rColItem,
+ long nDistance)
+{
+ const SwColumns& rCols = rCol.GetColumns();
+ USHORT nWidth = 0;
+
+ BOOL bOrtho = rCol.IsOrtho() && rCols.Count();
+ long nInnerWidth = 0;
+ if( bOrtho )
+ {
+ nInnerWidth = nTotalWidth;
+ for ( USHORT i = 0; i < rCols.Count(); ++i )
+ {
+ SwColumn* pCol = rCols[i];
+ nInnerWidth -= pCol->GetLeft() + pCol->GetRight();
+ }
+ if( nInnerWidth < 0 )
+ nInnerWidth = 0;
+ else
+ nInnerWidth /= rCols.Count();
+ }
+ for ( USHORT i = 0; i < rCols.Count(); ++i )
+ {
+ SwColumn* pCol = rCols[i];
+ const USHORT nStart = USHORT(pCol->GetLeft() + nWidth + nDistance);
+ if( bOrtho )
+ nWidth = static_cast< USHORT >(nWidth + nInnerWidth + pCol->GetLeft() + pCol->GetRight());
+ else
+ nWidth = static_cast< USHORT >(nWidth + rCol.CalcColWidth(i, nTotalWidth));
+ const USHORT nEnd = USHORT(nWidth - pCol->GetRight() + nDistance);
+
+ SvxColumnDescription aColDesc(nStart, nEnd, TRUE);
+ rColItem.Append(aColDesc);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: ColumnItem in ColumnInfo ueberfuehren
+ --------------------------------------------------------------------*/
+
+
+void lcl_ConvertToCols(const SvxColumnItem& rColItem,
+ USHORT nTotalWidth,
+ SwFmtCol& rCols)
+{
+ ASSERT( rCols.GetNumCols() == rColItem.Count(), "Column count mismatch" );
+ // #126939# ruler executes that change the columns shortly after the selection has changed
+ // can result in a crash
+ if(rCols.GetNumCols() != rColItem.Count())
+ return;
+
+ USHORT nLeft = 0;
+ SwTwips nSumAll= 0; // Summiere alle Spalten und Raender auf
+
+ SwColumns& rArr = rCols.GetColumns();
+
+ // Tabcols der Reihe nach
+ for( USHORT i=0; i < rColItem.Count()-1; ++i )
+ {
+ DBG_ASSERT(rColItem[i+1].nStart >= rColItem[i].nEnd,"\201berlappende Spalten" );
+ USHORT nStart = static_cast< USHORT >(rColItem[i+1].nStart);
+ USHORT nEnd = static_cast< USHORT >(rColItem[i].nEnd);
+ if(nStart < nEnd)
+ nStart = nEnd;
+ const USHORT nDiff = nStart - nEnd;
+ const USHORT nRight = nDiff / 2;
+
+ USHORT nWidth = static_cast< USHORT >(rColItem[i].nEnd - rColItem[i].nStart);
+ nWidth += nLeft + nRight;
+
+ SwColumn* pCol = rArr[i];
+ pCol->SetWishWidth( USHORT(long(rCols.GetWishWidth()) * long(nWidth) /
+ long(nTotalWidth) ));
+ pCol->SetLeft( nLeft );
+ pCol->SetRight( nRight );
+ nSumAll += pCol->GetWishWidth();
+
+ nLeft = nRight;
+ }
+ rArr[rColItem.Count()-1]->SetLeft( nLeft );
+
+ //Die Differenz aus der Gesamtwunschbreite und der Summe der bisher berechneten
+ // Spalten und Raender sollte die Breite der letzten Spalte ergeben.
+ rArr[rColItem.Count()-1]->SetWishWidth( rCols.GetWishWidth() - (USHORT)nSumAll );
+
+ rCols.SetOrtho(FALSE, 0, 0 );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Tabs loeschen
+ --------------------------------------------------------------------*/
+
+
+void lcl_EraseDefTabs(SvxTabStopItem& rTabStops)
+{
+ // Def Tabs loeschen
+ for ( USHORT i = 0; i < rTabStops.Count(); )
+ {
+ // Hier auch den DefTab auf Null rausschmeissen
+ if ( SVX_TAB_ADJUST_DEFAULT == rTabStops[i].GetAdjustment() ||
+ rTabStops[i].GetTabPos() == 0 )
+ {
+ rTabStops.Remove(i);
+ continue;
+ }
+ ++i;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Seitenrand umdrehen
+ --------------------------------------------------------------------*/
+
+
+void SwView::SwapPageMargin(const SwPageDesc& rDesc, SvxLRSpaceItem& rLRSpace)
+{
+ USHORT nPhyPage, nVirPage;
+ GetWrtShell().GetPageNum( nPhyPage, nVirPage );
+
+ if ( rDesc.GetUseOn() == nsUseOnPage::PD_MIRROR && (nPhyPage % 2) == 0 )
+ {
+ long nTmp = rLRSpace.GetRight();
+ rLRSpace.SetRight( rLRSpace.GetLeft() );
+ rLRSpace.SetLeft( nTmp );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Wenn der Rahmenrand verschoben wird, sollen die
+ Spaltentrenner an der gleichen absoluten Position bleiben
+ --------------------------------------------------------------------*/
+
+
+void lcl_Scale(long& nVal, long nScale)
+{
+ nVal *= nScale;
+ nVal >>= 8;
+}
+
+void ResizeFrameCols(SwFmtCol& rCol,
+ long nOldWidth,
+ long nNewWidth,
+ long nLeftDelta )
+{
+ SwColumns& rArr = rCol.GetColumns();
+ long nWishSum = (long)rCol.GetWishWidth();
+ long nWishDiff = (nWishSum * 100/nOldWidth * nNewWidth) / 100 - nWishSum;
+ long nNewWishWidth = nWishSum + nWishDiff;
+ if(nNewWishWidth > 0xffffl)
+ {
+ // wenn die Wunschbreite zu gross wird, dann muessen alle Werte passend skaliert werden
+ long nScale = (0xffffl << 8)/ nNewWishWidth;
+ for(USHORT i = 0; i < rArr.Count(); i++)
+ {
+ SwColumn* pCol = rArr.GetObject(i);
+ long nVal = pCol->GetWishWidth();
+ lcl_Scale(nVal, nScale);
+ pCol->SetWishWidth((USHORT) nVal);
+ nVal = pCol->GetLeft();
+ lcl_Scale(nVal, nScale);
+ pCol->SetLeft((USHORT) nVal);
+ nVal = pCol->GetRight();
+ lcl_Scale(nVal, nScale);
+ pCol->SetRight((USHORT) nVal);
+ }
+ lcl_Scale(nNewWishWidth, nScale);
+ lcl_Scale(nWishDiff, nScale);
+ }
+ rCol.SetWishWidth( (USHORT) (nNewWishWidth) );
+
+ if( nLeftDelta >= 2 || nLeftDelta <= -2)
+ rArr[0]->SetWishWidth(rArr[0]->GetWishWidth() + (USHORT)nWishDiff);
+ else
+ rArr[rArr.Count()-1]->SetWishWidth(rArr[rArr.Count()-1]->GetWishWidth() + (USHORT)nWishDiff);
+ //reset auto width
+ rCol.SetOrtho(FALSE, 0, 0 );
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Hier werden alle Aenderungen der Tableiste
+ wieder in das Modell geschossen
+ --------------------------------------------------------------------*/
+
+
+void SwView::ExecTabWin( SfxRequest& rReq )
+{
+ SwWrtShell &rSh = GetWrtShell();
+ const USHORT nFrmType = rSh.IsObjSelected() ?
+ FRMTYPE_DRAWOBJ :
+ rSh.GetFrmType(0,TRUE);
+ const BOOL bFrmSelection = rSh.IsFrmSelected();
+ const BOOL bBrowse = rSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE);
+
+
+ const USHORT nSlot = rReq.GetSlot();
+ const USHORT nDescId = rSh.GetCurPageDesc();
+ const SwPageDesc& rDesc = rSh.GetPageDesc( nDescId );
+
+ const BOOL bVerticalWriting = rSh.IsInVerticalText();
+ const SwFmtHeader& rHeaderFmt = rDesc.GetMaster().GetHeader();
+ SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt();
+
+ const SwFmtFooter& rFooterFmt = rDesc.GetMaster().GetFooter();
+ SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt();
+
+ const SwFmtFrmSize &rFrmSize = rDesc.GetMaster().GetFrmSize();
+
+ const SwRect& rPageRect = rSh.GetAnyCurRect(RECT_PAGE);
+ const long nPageWidth = bBrowse ? rPageRect.Width() : rFrmSize.GetWidth();
+ const long nPageHeight = bBrowse ? rPageRect.Height() : rFrmSize.GetHeight();
+
+ BOOL bUnlockView = FALSE;
+ rSh.StartAllAction();
+ BOOL bSect = 0 != (nFrmType & FRMTYPE_COLSECT);
+
+ switch ( nSlot )
+ {
+ case SID_ATTR_LONG_LRSPACE:
+ {
+ SvxLongLRSpaceItem aLongLR( (const SvxLongLRSpaceItem&)rReq.GetArgs()->
+ Get( SID_ATTR_LONG_LRSPACE ) );
+ SvxLRSpaceItem aLR(RES_LR_SPACE);
+ if ( !bSect && (bFrmSelection || nFrmType & FRMTYPE_FLY_ANY) )
+ {
+ SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt());
+ const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED);
+
+ BOOL bRTL;
+ BOOL bVerticalFrame = (bFrmSelection && rSh.IsFrmVertical(TRUE, bRTL))|| (!bFrmSelection && bVerticalWriting);
+ long nDeltaX = bVerticalFrame ?
+ rRect.Right() - rPageRect.Right() + aLongLR.GetRight() :
+ rPageRect.Left() + aLongLR.GetLeft() - rRect.Left();
+
+ SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE,
+ RES_VERT_ORIENT, RES_HORI_ORIENT,
+ RES_COL, RES_COL, 0 );
+
+ if(bVerticalFrame)
+ {
+ SwFmtVertOrient aVertOrient(pFmt->GetVertOrient());
+ aVertOrient.SetVertOrient(text::VertOrientation::NONE);
+ aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaX );
+ aSet.Put( aVertOrient );
+ }
+ else
+ {
+ SwFmtHoriOrient aHoriOrient( pFmt->GetHoriOrient() );
+ aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE );
+ aHoriOrient.SetPos( aHoriOrient.GetPos() + nDeltaX );
+ aSet.Put( aHoriOrient );
+ }
+
+ SwFmtFrmSize aSize( pFmt->GetFrmSize() );
+ long nOldWidth = (long) aSize.GetWidth();
+
+ if(aSize.GetWidthPercent())
+ {
+ SwRect aRect;
+ rSh.CalcBoundRect(aRect, FLY_AS_CHAR);
+ long nPrtWidth = aRect.Width();
+ aSize.SetWidthPercent(BYTE((nPageWidth - aLongLR.GetLeft() - aLongLR.GetRight()) * 100 /nPrtWidth));
+ }
+ else
+ aSize.SetWidth( nPageWidth -
+ (aLongLR.GetLeft() + aLongLR.GetRight()));
+
+ if( nFrmType & FRMTYPE_COLUMN )
+ {
+ SwFmtCol aCol(pFmt->GetCol());
+
+ ::ResizeFrameCols(aCol, nOldWidth, (long)aSize.GetWidth(), nDeltaX );
+ aSet.Put(aCol);
+ }
+
+ aSet.Put( aSize );
+
+ rSh.StartAction();
+ rSh.Push();
+ rSh.SetFlyFrmAttr( aSet );
+ //die Rahmenselektion wieder aufheben
+ if(!bFrmSelection && rSh.IsFrmSelected())
+ {
+ rSh.UnSelectFrm();
+ rSh.LeaveSelFrmMode();
+ }
+ rSh.Pop();
+ rSh.EndAction();
+ }
+ else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER ))
+ {
+ // Seitenraender rausrechnen
+ long nOld = rDesc.GetMaster().GetLRSpace().GetLeft();
+ aLongLR.SetLeft( nOld > aLongLR.GetLeft() ? 0 : aLongLR.GetLeft() - nOld );
+
+ nOld = rDesc.GetMaster().GetLRSpace().GetRight();
+ aLongLR.SetRight( nOld > (USHORT)aLongLR.GetRight() ? 0 : aLongLR.GetRight() - nOld );
+ aLR.SetLeft((USHORT)aLongLR.GetLeft());
+ aLR.SetRight((USHORT)aLongLR.GetRight());
+
+ if ( nFrmType & FRMTYPE_HEADER && pHeaderFmt )
+ pHeaderFmt->SetFmtAttr( aLR );
+ else if( nFrmType & FRMTYPE_FOOTER && pFooterFmt )
+ pFooterFmt->SetFmtAttr( aLR );
+ }
+ else if( nFrmType == FRMTYPE_DRAWOBJ)
+ {
+ SwRect aRect( rSh.GetObjRect() );
+ aRect.Left( aLongLR.GetLeft() + rPageRect.Left() );
+ aRect.Right( rPageRect.Right() - aLongLR.GetRight());
+ rSh.SetObjRect( aRect );
+ }
+ else if(bSect || rSh.IsDirectlyInSection())
+ {
+ //change the section indents and the columns if available
+ //at first determine the changes
+ SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0);
+ const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0);
+ aSectRect.Pos() += aTmpRect.Pos();
+ long nLeftDiff = aLongLR.GetLeft() - (long)(aSectRect.Left() - rPageRect.Left() );
+ long nRightDiff = aLongLR.GetRight() - (long)( rPageRect.Right() - aSectRect.Right());
+ //change the LRSpaceItem of the section accordingly
+ const SwSection* pCurrSect = rSh.GetCurrSection();
+ const SwSectionFmt* pSectFmt = pCurrSect->GetFmt();
+ SvxLRSpaceItem aLRTmp = pSectFmt->GetLRSpace();
+ aLRTmp.SetLeft(aLRTmp.GetLeft() + nLeftDiff);
+ aLRTmp.SetRight(aLRTmp.GetRight() + nRightDiff);
+ SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L);
+ aSet.Put(aLRTmp);
+ //change the first/last column
+ if(bSect)
+ {
+ SwFmtCol aCols( pSectFmt->GetCol() );
+ long nDiffWidth = nLeftDiff + nRightDiff;
+ ::ResizeFrameCols(aCols, aSectRect.Width(), aSectRect.Width() - nDiffWidth, nLeftDiff );
+ aSet.Put( aCols );
+ }
+ SwSectionData aData(*pCurrSect);
+ rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet);
+ }
+ else
+ { // Seitenraender einstellen
+ aLR.SetLeft((USHORT)aLongLR.GetLeft());
+ aLR.SetRight((USHORT)aLongLR.GetRight());
+ SwapPageMargin( rDesc, aLR );
+ SwPageDesc aDesc( rDesc );
+ aDesc.GetMaster().SetFmtAttr( aLR );
+ rSh.ChgPageDesc( nDescId, aDesc );
+ }
+ }
+ break;
+ case SID_ATTR_LONG_ULSPACE:
+ {
+ SvxLongULSpaceItem aLongULSpace( (const SvxLongULSpaceItem&)rReq.GetArgs()->
+ Get( SID_ATTR_LONG_ULSPACE ));
+
+ if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
+ {
+ SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt());
+ const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED);
+ const long nDeltaY = rPageRect.Top() + aLongULSpace.GetUpper() - rRect.Top();
+ const long nHeight = nPageHeight - (aLongULSpace.GetUpper() + aLongULSpace.GetLower());
+
+ SfxItemSet aSet( GetPool(), RES_FRM_SIZE, RES_FRM_SIZE,
+ RES_VERT_ORIENT, RES_HORI_ORIENT, 0 );
+ //which of the orientation attributes is to be put depends on the frame's environment
+ BOOL bRTL;
+ if((bFrmSelection && rSh.IsFrmVertical(TRUE, bRTL))|| (!bFrmSelection && bVerticalWriting))
+ {
+ SwFmtHoriOrient aHoriOrient(pFmt->GetHoriOrient());
+ aHoriOrient.SetHoriOrient(text::HoriOrientation::NONE);
+ aHoriOrient.SetPos(aHoriOrient.GetPos() + nDeltaY );
+ aSet.Put( aHoriOrient );
+ }
+ else
+ {
+ SwFmtVertOrient aVertOrient(pFmt->GetVertOrient());
+ aVertOrient.SetVertOrient(text::VertOrientation::NONE);
+ aVertOrient.SetPos(aVertOrient.GetPos() + nDeltaY );
+ aSet.Put( aVertOrient );
+ }
+ SwFmtFrmSize aSize(pFmt->GetFrmSize());
+ if(aSize.GetHeightPercent())
+ {
+ SwRect aRect;
+ rSh.CalcBoundRect(aRect, FLY_AS_CHAR);
+ long nPrtHeight = aRect.Height();
+ aSize.SetHeightPercent(BYTE(nHeight * 100 /nPrtHeight));
+ }
+ else
+ aSize.SetHeight(nHeight );
+
+ aSet.Put( aSize );
+ rSh.SetFlyFrmAttr( aSet );
+ }
+ else if( nFrmType == FRMTYPE_DRAWOBJ )
+ {
+ SwRect aRect( rSh.GetObjRect() );
+ aRect.Top( aLongULSpace.GetUpper() + rPageRect.Top() );
+ aRect.Bottom( rPageRect.Bottom() - aLongULSpace.GetLower() );
+ rSh.SetObjRect( aRect ) ;
+ }
+ else if(bVerticalWriting && (bSect || rSh.IsDirectlyInSection()))
+ {
+ //change the section indents and the columns if available
+ //at first determine the changes
+ SwRect aSectRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, 0);
+ const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, 0);
+ aSectRect.Pos() += aTmpRect.Pos();
+ const long nLeftDiff = aLongULSpace.GetUpper() - (long)(aSectRect.Top() - rPageRect.Top());
+ const long nRightDiff = aLongULSpace.GetLower() - (long)(nPageHeight - aSectRect.Bottom() + rPageRect.Top());
+ //change the LRSpaceItem of the section accordingly
+ const SwSection* pCurrSect = rSh.GetCurrSection();
+ const SwSectionFmt* pSectFmt = pCurrSect->GetFmt();
+ SvxLRSpaceItem aLR = pSectFmt->GetLRSpace();
+ aLR.SetLeft(aLR.GetLeft() + nLeftDiff);
+ aLR.SetRight(aLR.GetRight() + nRightDiff);
+ SfxItemSet aSet(rSh.GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE, RES_COL, RES_COL, 0L);
+ aSet.Put(aLR);
+ //change the first/last column
+ if(bSect)
+ {
+ SwFmtCol aCols( pSectFmt->GetCol() );
+ long nDiffWidth = nLeftDiff + nRightDiff;
+ ::ResizeFrameCols(aCols, aSectRect.Height(), aSectRect.Height() - nDiffWidth, nLeftDiff );
+ aSet.Put( aCols );
+ }
+ SwSectionData aData(*pCurrSect);
+ rSh.UpdateSection(rSh.GetSectionFmtPos(*pSectFmt), aData, &aSet);
+ }
+ else
+ { SwPageDesc aDesc( rDesc );
+
+ if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER ))
+ {
+
+ const BOOL bHead = nFrmType & FRMTYPE_HEADER ? TRUE : FALSE;
+ SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
+ if ( bHead )
+ aUL.SetUpper( (USHORT)aLongULSpace.GetUpper() );
+ else
+ aUL.SetLower( (USHORT)aLongULSpace.GetLower() );
+ aDesc.GetMaster().SetFmtAttr( aUL );
+
+ if( (bHead && pHeaderFmt) || (!bHead && pFooterFmt) )
+ {
+ SwFmtFrmSize aSz( bHead ? pHeaderFmt->GetFrmSize() :
+ pFooterFmt->GetFrmSize() );
+ aSz.SetHeightSizeType( ATT_FIX_SIZE );
+ aSz.SetHeight(nPageHeight - aLongULSpace.GetLower() -
+ aLongULSpace.GetUpper() );
+ if ( bHead )
+ pHeaderFmt->SetFmtAttr( aSz );
+ else
+ pFooterFmt->SetFmtAttr( aSz );
+ }
+ }
+ else
+ {
+ SvxULSpaceItem aUL(RES_UL_SPACE);
+ aUL.SetUpper((USHORT)aLongULSpace.GetUpper());
+ aUL.SetLower((USHORT)aLongULSpace.GetLower());
+ aDesc.GetMaster().SetFmtAttr(aUL);
+ }
+
+ rSh.ChgPageDesc( nDescId, aDesc );
+ }
+ }
+ break;
+ case SID_ATTR_TABSTOP_VERTICAL:
+ case SID_ATTR_TABSTOP:
+ {
+ USHORT nWhich = GetPool().GetWhich(nSlot);
+ SvxTabStopItem aTabStops( (const SvxTabStopItem&)rReq.GetArgs()->
+ Get( nWhich ));
+ aTabStops.SetWhich(RES_PARATR_TABSTOP);
+ const SvxTabStopItem& rDefTabs =
+ (const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP);
+
+ // Default-Tab an Pos 0
+ SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE );
+ rSh.GetCurAttr( aSet );
+ const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)aSet.Get(RES_LR_SPACE);
+
+ if ( rLR.GetTxtFirstLineOfst() < 0 )
+ {
+ SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT );
+ aTabStops.Insert( aSwTabStop );
+ }
+
+ // auffuellen mit Default-Tabs
+ USHORT nDef = ::GetTabDist( rDefTabs );
+ ::MakeDefTabs( nDef, aTabStops );
+
+ SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
+ if( pColl && pColl->IsAutoUpdateFmt() )
+ {
+ SfxItemSet aTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP);
+ aTmp.Put(aTabStops);
+ rSh.AutoUpdatePara( pColl, aTmp );
+ }
+ else
+ rSh.SetAttr( aTabStops );
+ break;
+ }
+ case SID_ATTR_PARA_LRSPACE_VERTICAL:
+ case SID_ATTR_PARA_LRSPACE:
+ {
+ SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq.
+ GetArgs()->Get(nSlot));
+ if(nFrmType & FRMTYPE_FLY_ANY)
+ {
+ sal_Bool bFirstColumn = sal_True;
+ sal_Bool bLastColumn = sal_True;
+ if(nFrmType & FRMTYPE_COLUMN)
+ {
+ USHORT nCurFrameCol = rSh.GetCurColNum() - 1;
+ bFirstColumn = !nCurFrameCol;
+ const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt();
+ const SwFmtCol* pCols = &pFmt->GetCol();
+ const SwColumns& rCols = pCols->GetColumns();
+ USHORT nColumnCount = rCols.Count();
+ bLastColumn = nColumnCount == nCurFrameCol + 1;
+ }
+ }
+ aParaMargin.SetRight( aParaMargin.GetRight() - nRightBorderDistance );
+ aParaMargin.SetTxtLeft(aParaMargin.GetTxtLeft() - nLeftBorderDistance );
+
+ aParaMargin.SetWhich( RES_LR_SPACE );
+ SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
+
+ // #i23726#
+ if (pNumRuleNodeFromDoc)
+ {
+ // --> FME 2005-02-22 #i42922# Mouse move of numbering label
+ // has to consider the left indent of the paragraph
+ SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE );
+ rSh.GetCurAttr( aSet );
+ const SvxLRSpaceItem& rLR =
+ static_cast<const SvxLRSpaceItem&>(aSet.Get(RES_LR_SPACE));
+ // <--
+
+ SwPosition aPos(*pNumRuleNodeFromDoc);
+ // --> OD 2008-06-09 #i90078#
+ rSh.SetIndent( static_cast< short >(aParaMargin.GetTxtLeft() - rLR.GetTxtLeft()), aPos);
+ // <--
+ // --> OD 2005-02-18 #i42921# - invalidate state of indent in order
+ // to get a ruler update.
+ aParaMargin.SetWhich( nSlot );
+ GetViewFrame()->GetBindings().SetState( aParaMargin );
+ // <--
+ }
+ else if( pColl && pColl->IsAutoUpdateFmt() )
+ {
+ SfxItemSet aSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE);
+ aSet.Put(aParaMargin);
+ rSh.AutoUpdatePara( pColl, aSet);
+ }
+ else
+ rSh.SetAttr( aParaMargin );
+
+ if ( aParaMargin.GetTxtFirstLineOfst() < 0 )
+ {
+ SfxItemSet aSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP );
+
+ rSh.GetCurAttr( aSet );
+ const SvxTabStopItem& rTabStops = (const SvxTabStopItem&)aSet.Get(RES_PARATR_TABSTOP);
+
+ // Haben wir einen Tab an Stelle Null
+ USHORT i;
+
+ for ( i = 0; i < rTabStops.Count(); ++i )
+ if ( rTabStops[i].GetTabPos() == 0 )
+ break;
+
+ if ( i >= rTabStops.Count() )
+ {
+ // Kein DefTab
+ SvxTabStopItem aTabStops( RES_PARATR_TABSTOP );
+ aTabStops = rTabStops;
+
+ ::lcl_EraseDefTabs(aTabStops);
+
+ SvxTabStop aSwTabStop( 0, SVX_TAB_ADJUST_DEFAULT );
+ aTabStops.Insert(aSwTabStop);
+
+ const SvxTabStopItem& rDefTabs =
+ (const SvxTabStopItem&)rSh.GetDefault(RES_PARATR_TABSTOP);
+ USHORT nDef = ::GetTabDist(rDefTabs);
+ ::MakeDefTabs( nDef, aTabStops );
+
+ if( pColl && pColl->IsAutoUpdateFmt())
+ {
+ SfxItemSet aSetTmp(GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP);
+ aSetTmp.Put(aTabStops);
+ rSh.AutoUpdatePara( pColl, aSetTmp );
+ }
+ else
+ rSh.SetAttr( aTabStops );
+ }
+ }
+ }
+ break;
+ case SID_RULER_BORDERS_VERTICAL:
+ case SID_RULER_BORDERS:
+ {
+ SvxColumnItem aColItem((const SvxColumnItem&)rReq.
+ GetArgs()->Get(nSlot));
+
+ if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) )
+ {
+ ASSERT(aColItem.Count(), "ColDesc ist leer!!");
+
+ const BOOL bSingleLine = ((const SfxBoolItem&)rReq.
+ GetArgs()->Get(SID_RULER_ACT_LINE_ONLY)).GetValue();
+
+ SwTabCols aTabCols;
+ if ( bSetTabColFromDoc )
+ rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos );
+ else
+ rSh.GetTabCols(aTabCols);
+
+ // linker Tabellenrand
+ long nBorder = (long)(aColItem.GetLeft() - aTabCols.GetLeftMin());
+ aTabCols.SetLeft( nBorder );
+
+ nBorder = (bVerticalWriting ? nPageHeight : nPageWidth) - aTabCols.GetLeftMin() - aColItem.GetRight();
+
+#ifdef DEBUG
+ long nTmp1 = nPageWidth;
+ long nTmp2 = aTabCols.GetLeftMin() + nBorder;
+ (void)nTmp1;
+ (void)nTmp2;
+#endif
+
+ if ( aColItem.GetRight() > 0 )
+ aTabCols.SetRight( nBorder );
+
+ // Tabcols der Reihe nach
+ // Die letzte Col wird durch den Rand definiert
+ //columns in right-to-left tables need to be mirrored
+ BOOL bIsTableRTL =
+ IsTabColFromDoc() ?
+ rSh.IsMouseTableRightToLeft(aTabColFromDocPos)
+ : rSh.IsTableRightToLeft();
+ if(bIsTableRTL)
+ {
+ USHORT nColCount = aColItem.Count() - 1;
+ for ( USHORT i = 0; i < nColCount; ++i )
+ {
+ const SvxColumnDescription& rCol = aColItem[nColCount - i];
+ aTabCols[i] = aTabCols.GetRight() - rCol.nStart;
+ aTabCols.SetHidden( i, !rCol.bVisible );
+ }
+ }
+ else
+ {
+ for ( USHORT i = 0; i < aColItem.Count()-1; ++i )
+ {
+ const SvxColumnDescription& rCol = aColItem[i];
+ aTabCols[i] = rCol.nEnd + aTabCols.GetLeft();
+ aTabCols.SetHidden( i, !rCol.bVisible );
+ }
+ }
+
+ if ( bSetTabColFromDoc )
+ {
+ if( !rSh.IsViewLocked() )
+ {
+ bUnlockView = TRUE;
+ rSh.LockView( TRUE );
+ }
+ rSh.SetMouseTabCols( aTabCols, bSingleLine,
+ aTabColFromDocPos );
+ }
+ else
+ rSh.SetTabCols(aTabCols, bSingleLine);
+
+ }
+ else
+ {
+ if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY || bSect)
+ {
+ SwSectionFmt *pSectFmt = 0;
+ SfxItemSet aSet( GetPool(), RES_COL, RES_COL );
+ if(bSect)
+ {
+ const SwSection *pSect = rSh.GetAnySection();
+ ASSERT( pSect, "Welcher Bereich?");
+ pSectFmt = pSect->GetFmt();
+ }
+ else
+ {
+ rSh.GetFlyFrmAttr( aSet );
+ }
+ SwFmtCol aCols(
+ bSect ?
+ pSectFmt->GetCol() :
+ (const SwFmtCol&)aSet.Get( RES_COL, FALSE ));
+ SwRect aCurRect = rSh.GetAnyCurRect(bSect ? RECT_SECTION_PRT : RECT_FLY_PRT_EMBEDDED);
+ const long lWidth = bVerticalWriting ? aCurRect.Height() : aCurRect.Width();
+ ::lcl_ConvertToCols( aColItem, USHORT(lWidth), aCols );
+ aSet.Put( aCols );
+ if(bSect)
+ rSh.SetSectionAttr( aSet, pSectFmt );
+ else
+ {
+ rSh.StartAction();
+ rSh.Push();
+ rSh.SetFlyFrmAttr( aSet );
+ //die Rahmenselektion wieder aufheben
+ if(!bFrmSelection && rSh.IsFrmSelected())
+ {
+ rSh.UnSelectFrm();
+ rSh.LeaveSelFrmMode();
+ }
+ rSh.Pop();
+ rSh.EndAction();
+ }
+ }
+ else
+ {
+ SwFmtCol aCols( rDesc.GetMaster().GetCol() );
+ const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT);
+ ::lcl_ConvertToCols( aColItem,
+ USHORT(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width()),
+ aCols );
+ SwPageDesc aDesc( rDesc );
+ aDesc.GetMaster().SetFmtAttr( aCols );
+ rSh.ChgPageDesc( rSh.GetCurPageDesc(), aDesc );
+ }
+ }
+ }
+ break;
+
+ case SID_RULER_ROWS :
+ case SID_RULER_ROWS_VERTICAL:
+ {
+ SvxColumnItem aColItem((const SvxColumnItem&)rReq.
+ GetArgs()->Get(nSlot));
+
+ if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) )
+ {
+ ASSERT(aColItem.Count(), "ColDesc ist leer!!");
+
+ SwTabCols aTabCols;
+ if ( bSetTabRowFromDoc )
+ rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos );
+ else
+ rSh.GetTabRows(aTabCols);
+
+ if ( bVerticalWriting )
+ {
+ aTabCols.SetRight(nPageWidth - aColItem.GetRight() - aColItem.GetLeft());
+ aTabCols.SetLeftMin(aColItem.GetLeft());
+ }
+ else
+ {
+ long nBorder = nPageHeight - aTabCols.GetLeftMin() - aColItem.GetRight();
+ aTabCols.SetRight( nBorder );
+ }
+
+ if(bVerticalWriting)
+ {
+ for ( USHORT i = aColItem.Count() - 1; i; --i )
+ {
+ const SvxColumnDescription& rCol = aColItem[i - 1];
+ long nColumnPos = aTabCols.GetRight() - rCol.nEnd ;
+ aTabCols[i - 1] = nColumnPos;
+ aTabCols.SetHidden( i - 1, !rCol.bVisible );
+ }
+ }
+ else
+ {
+ for ( USHORT i = 0; i < aColItem.Count()-1; ++i )
+ {
+ const SvxColumnDescription& rCol = aColItem[i];
+ aTabCols[i] = rCol.nEnd + aTabCols.GetLeft();
+ aTabCols.SetHidden( i, !rCol.bVisible );
+ }
+ }
+ BOOL bSingleLine = FALSE;
+ const SfxPoolItem* pSingleLine;
+ if( SFX_ITEM_SET == rReq.GetArgs()->GetItemState(SID_RULER_ACT_LINE_ONLY, FALSE, &pSingleLine))
+ bSingleLine = ((const SfxBoolItem*)pSingleLine)->GetValue();
+ if ( bSetTabRowFromDoc )
+ {
+ if( !rSh.IsViewLocked() )
+ {
+ bUnlockView = TRUE;
+ rSh.LockView( TRUE );
+ }
+ rSh.SetMouseTabRows( aTabCols, bSingleLine, aTabColFromDocPos );
+ }
+ else
+ rSh.SetTabRows(aTabCols, bSingleLine);
+ }
+ }
+ break;
+
+ default:
+ ASSERT( !this, "Falsche SlotId");
+ }
+ rSh.EndAllAction();
+
+ if( bUnlockView )
+ rSh.LockView( FALSE );
+
+ bSetTabColFromDoc = bSetTabRowFromDoc = bTabColFromDoc = bTabRowFromDoc = FALSE;
+ SetNumRuleNodeFromDoc(NULL);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Hier wird der Status der Tableiste ermittelt
+ sprich alle relevanten Attribute an der CursorPos
+ werden der Tableiste uebermittelt
+ --------------------------------------------------------------------*/
+
+
+void SwView::StateTabWin(SfxItemSet& rSet)
+{
+ SwWrtShell &rSh = GetWrtShell();
+
+ const Point* pPt = IsTabColFromDoc() || IsTabRowFromDoc() ? &aTabColFromDocPos : 0;
+ const USHORT nFrmType = rSh.IsObjSelected()
+ ? FRMTYPE_DRAWOBJ
+ : rSh.GetFrmType( pPt, TRUE );
+
+ const BOOL bFrmSelection = rSh.IsFrmSelected();
+
+ const BOOL bBrowse = rSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE);
+ // PageOffset/Begrenzer
+ const SwRect& rPageRect = rSh.GetAnyCurRect( RECT_PAGE, pPt );
+ const SwRect& rPagePrtRect = rSh.GetAnyCurRect( RECT_PAGE_PRT, pPt );
+ const long nPageWidth = rPageRect.Width();
+ const long nPageHeight = rPageRect.Height();
+
+ const SwPageDesc& rDesc = rSh.GetPageDesc(
+ IsTabColFromDoc() || bTabRowFromDoc ?
+ rSh.GetMousePageDesc(aTabColFromDocPos) : rSh.GetCurPageDesc() );
+
+ const SvxFrameDirectionItem& rFrameDir = rDesc.GetMaster().GetFrmDir();
+ const BOOL bVerticalWriting = rSh.IsInVerticalText();
+
+ //enable tab stop display on the rulers depending on the writing direction
+ WinBits nRulerStyle = pHRuler->GetStyle() & ~WB_EXTRAFIELD;
+ pHRuler->SetStyle(bVerticalWriting||bBrowse ? nRulerStyle : nRulerStyle|WB_EXTRAFIELD);
+ nRulerStyle = pVRuler->GetStyle() & ~WB_EXTRAFIELD;
+ pVRuler->SetStyle(bVerticalWriting ? nRulerStyle|WB_EXTRAFIELD : nRulerStyle);
+
+ //#i24363# tab stops relative to indent
+ bool bRelative = rSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT);
+ pHRuler->SetTabsRelativeToIndent( bRelative );
+ pVRuler->SetTabsRelativeToIndent( bRelative );
+
+ SvxLRSpaceItem aPageLRSpace( rDesc.GetMaster().GetLRSpace() );
+ SwapPageMargin( rDesc, aPageLRSpace );
+
+ SfxItemSet aCoreSet( GetPool(), RES_PARATR_TABSTOP, RES_PARATR_TABSTOP,
+ RES_LR_SPACE, RES_UL_SPACE, 0 );
+ // --> OD 2008-01-17 #newlistlevelattrs#
+ // get also the list level indent values merged as LR-SPACE item, if needed.
+ rSh.GetCurAttr( aCoreSet, true );
+ // <--
+ SelectionType nSelType = rSh.GetSelectionType();
+
+ SfxWhichIter aIter( rSet );
+ USHORT nWhich = aIter.FirstWhich();
+ sal_Bool bPutContentProtection = sal_False;
+
+ while ( nWhich )
+ {
+ switch ( nWhich )
+ {
+// case RES_LR_SPACE:
+// case SID_ATTR_LRSPACE:
+ case SID_ATTR_LONG_LRSPACE:
+ {
+ SvxLongLRSpaceItem aLongLR( (long)aPageLRSpace.GetLeft(),
+ (long)aPageLRSpace.GetRight(),
+ SID_ATTR_LONG_LRSPACE);
+ if(bBrowse)
+ {
+ aLongLR.SetLeft(rPagePrtRect.Left());
+ aLongLR.SetRight(nPageWidth - rPagePrtRect.Right());
+ }
+ if ( ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER ) &&
+ !(nFrmType & FRMTYPE_COLSECT) )
+ {
+ SwFrmFmt *pFmt = (SwFrmFmt*) (nFrmType & FRMTYPE_HEADER ?
+ rDesc.GetMaster().GetHeader().GetHeaderFmt() :
+ rDesc.GetMaster().GetFooter().GetFooterFmt());
+ if( pFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
+ {
+ SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt));
+ aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos();
+ const SvxLRSpaceItem& aLR = pFmt->GetLRSpace();
+ aLongLR.SetLeft ( (long)aLR.GetLeft() + (long)aRect.Left() );
+ aLongLR.SetRight( (nPageWidth -
+ (long)aRect.Right() + (long)aLR.GetRight()));
+ }
+ }
+ else
+ {
+ SwRect aRect;
+ if( !bFrmSelection && ((nFrmType & FRMTYPE_COLSECT) || rSh.IsDirectlyInSection()) )
+ {
+ aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt);
+ const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt);
+ aRect.Pos() += aTmpRect.Pos();
+ }
+
+ else if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
+ aRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt);
+ else if( nFrmType & FRMTYPE_DRAWOBJ)
+ aRect = rSh.GetObjRect();
+
+ if( aRect.Width() )
+ {
+ // PAGES01
+ // make relative to page position:
+ aLongLR.SetLeft ((long)( aRect.Left() - rPageRect.Left() ));
+ aLongLR.SetRight((long)( rPageRect.Right() - aRect.Right()));
+ }
+ }
+ if( nWhich == SID_ATTR_LONG_LRSPACE )
+ rSet.Put( aLongLR );
+ else
+ {
+ SvxLRSpaceItem aLR( aLongLR.GetLeft(),
+ aLongLR.GetRight(),
+ 0, 0,
+ nWhich);
+ rSet.Put(aLR);
+ }
+ break;
+ }
+ case SID_ATTR_LONG_ULSPACE:
+// case SID_ATTR_ULSPACE:
+// case RES_UL_SPACE:
+ {
+ // Rand Seite Oben Unten
+ SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() );
+ SvxLongULSpaceItem aLongUL( (long)aUL.GetUpper(),
+ (long)aUL.GetLower(),
+ SID_ATTR_LONG_ULSPACE);
+
+ if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
+ {
+ // Dokumentkoordinaten Frame auf Seitenkoordinaten umbrechen
+ const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt);
+ aLongUL.SetUpper((USHORT)(rRect.Top() - rPageRect.Top() ));
+ aLongUL.SetLower((USHORT)(rPageRect.Bottom() - rRect.Bottom() ));
+ }
+ else if ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER )
+ {
+ SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt));
+ aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos();
+ aLongUL.SetUpper( (USHORT)aRect.Top() );
+ aLongUL.SetLower( (USHORT)(nPageHeight - aRect.Bottom()) );
+ }
+ else if( nFrmType & FRMTYPE_DRAWOBJ)
+ {
+ const SwRect &rRect = rSh.GetObjRect();
+ aLongUL.SetUpper((rRect.Top() - rPageRect.Top()));
+ aLongUL.SetLower((rPageRect.Bottom() - rRect.Bottom()));
+ }
+ else if(bBrowse)
+ {
+ aLongUL.SetUpper(rPagePrtRect.Top());
+ aLongUL.SetLower(nPageHeight - rPagePrtRect.Bottom());
+ }
+ if( nWhich == SID_ATTR_LONG_ULSPACE )
+ rSet.Put( aLongUL );
+ else
+ {
+ SvxULSpaceItem aULTmp((USHORT)aLongUL.GetUpper(),
+ (USHORT)aLongUL.GetLower(),
+ nWhich);
+ rSet.Put(aULTmp);
+ }
+ break;
+ }
+ case SID_ATTR_TABSTOP_VERTICAL :
+ case RES_PARATR_TABSTOP:
+ {
+ if ( ISA( SwWebView ) ||
+ IsTabColFromDoc() ||
+ IsTabRowFromDoc() ||
+ ( nSelType & nsSelectionType::SEL_GRF) ||
+ (nSelType & nsSelectionType::SEL_FRM) ||
+ (nSelType & nsSelectionType::SEL_OLE) ||
+ SFX_ITEM_AVAILABLE > aCoreSet.GetItemState(RES_LR_SPACE)||
+ (!bVerticalWriting && (SID_ATTR_TABSTOP_VERTICAL == nWhich))||
+ (bVerticalWriting && (RES_PARATR_TABSTOP == nWhich))
+ )
+ rSet.DisableItem( nWhich );
+ else
+ {
+ SvxTabStopItem aTabStops((const SvxTabStopItem&)
+ aCoreSet.Get( RES_PARATR_TABSTOP ));
+
+ const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&)
+ rSh.GetDefault(RES_PARATR_TABSTOP);
+
+ DBG_ASSERT(pHRuler, "warum ist das Lineal nicht da?");
+ long nDefTabDist = ::GetTabDist(rDefTabs);
+ pHRuler->SetDefTabDist( nDefTabDist );
+ pVRuler->SetDefTabDist( nDefTabDist );
+ ::lcl_EraseDefTabs(aTabStops);
+ rSet.Put(aTabStops, nWhich);
+ }
+ break;
+ }
+ case SID_ATTR_PARA_LRSPACE_VERTICAL:
+ case SID_ATTR_PARA_LRSPACE:
+ {
+ if ( nSelType & nsSelectionType::SEL_GRF ||
+ nSelType & nsSelectionType::SEL_FRM ||
+ nSelType & nsSelectionType::SEL_OLE ||
+ nFrmType == FRMTYPE_DRAWOBJ ||
+ (!bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich))||
+ (bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich))
+ )
+ {
+ rSet.DisableItem(nWhich);
+ }
+ else
+ {
+ SvxLRSpaceItem aLR( RES_LR_SPACE );
+ if ( !IsTabColFromDoc() )
+ {
+ aLR = (const SvxLRSpaceItem&)aCoreSet.Get(RES_LR_SPACE);
+
+ // #i23726#
+ if (pNumRuleNodeFromDoc)
+ {
+ short nOffset = static_cast< short >(aLR.GetTxtLeft() +
+ // --> FME 2005-02-22 #i42922# Mouse move of numbering label
+ // has to consider the left indent of the paragraph
+ pNumRuleNodeFromDoc->GetLeftMarginWithNum( TRUE ) );
+ // <--
+
+ short nFLOffset;
+ pNumRuleNodeFromDoc->GetFirstLineOfsWithNum( nFLOffset );
+
+ aLR.SetLeft( nOffset + nFLOffset );
+ }
+ }
+ aLR.SetWhich(nWhich);
+ rSet.Put(aLR);
+ }
+ break;
+ }
+ case SID_RULER_BORDER_DISTANCE:
+ {
+ nLeftBorderDistance = 0;
+ nRightBorderDistance = 0;
+ if ( nSelType & nsSelectionType::SEL_GRF ||
+ nSelType & nsSelectionType::SEL_FRM ||
+ nSelType & nsSelectionType::SEL_OLE ||
+ nFrmType == FRMTYPE_DRAWOBJ )
+ rSet.DisableItem(SID_RULER_BORDER_DISTANCE);
+ else
+ {
+ SvxLRSpaceItem aDistLR(SID_RULER_BORDER_DISTANCE);
+ if(nFrmType & FRMTYPE_FLY_ANY)
+ {
+ if( IsTabColFromDoc() )
+ {
+ const SwRect& rFlyPrtRect = rSh.GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, pPt );
+ aDistLR.SetLeft(rFlyPrtRect.Left());
+ aDistLR.SetRight(rFlyPrtRect.Left());
+ }
+ else
+ {
+ SfxItemSet aCoreSet2( GetPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
+ SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+ aCoreSet.Put( aBoxInfo );
+ rSh.GetFlyFrmAttr( aCoreSet );
+ const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet.Get(RES_BOX);
+ aDistLR.SetLeft((USHORT)rBox.GetDistance(BOX_LINE_LEFT ));
+ aDistLR.SetRight((USHORT)rBox.GetDistance(BOX_LINE_RIGHT));
+
+ //add the paragraph border distance
+ SfxItemSet aCoreSet1( GetPool(),
+ RES_BOX, RES_BOX,
+ 0 );
+ rSh.GetCurAttr( aCoreSet1 );
+ const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSet1.Get(RES_BOX);
+ aDistLR.SetLeft(aDistLR.GetLeft() + (USHORT)rParaBox.GetDistance(BOX_LINE_LEFT ));
+ aDistLR.SetRight(aDistLR.GetRight() + (USHORT)rParaBox.GetDistance(BOX_LINE_RIGHT));
+ }
+ rSet.Put(aDistLR);
+ nLeftBorderDistance = static_cast< USHORT >(aDistLR.GetLeft());
+ nRightBorderDistance = static_cast< USHORT >(aDistLR.GetRight());
+ }
+ else if ( IsTabColFromDoc() ||
+ ( rSh.GetTableFmt() && !bFrmSelection &&
+ !(nFrmType & FRMTYPE_COLSECT ) ) )
+ {
+ SfxItemSet aCoreSet2( GetPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
+ SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+ aBoxInfo.SetTable(FALSE);
+ aBoxInfo.SetDist((BOOL) TRUE);
+ aCoreSet2.Put(aBoxInfo);
+ rSh.GetTabBorders( aCoreSet2 );
+ const SvxBoxItem& rBox = (const SvxBoxItem&)aCoreSet2.Get(RES_BOX);
+ aDistLR.SetLeft((USHORT)rBox.GetDistance(BOX_LINE_LEFT ));
+ aDistLR.SetRight((USHORT)rBox.GetDistance(BOX_LINE_RIGHT));
+
+ //add the border distance of the paragraph
+ SfxItemSet aCoreSet1( GetPool(),
+ RES_BOX, RES_BOX,
+ 0 );
+ rSh.GetCurAttr( aCoreSet1 );
+ const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSet1.Get(RES_BOX);
+ aDistLR.SetLeft(aDistLR.GetLeft() + (USHORT)rParaBox.GetDistance(BOX_LINE_LEFT ));
+ aDistLR.SetRight(aDistLR.GetRight() + (USHORT)rParaBox.GetDistance(BOX_LINE_RIGHT));
+ rSet.Put(aDistLR);
+ nLeftBorderDistance = static_cast< USHORT >(aDistLR.GetLeft());
+ nRightBorderDistance = static_cast< USHORT >(aDistLR.GetRight());
+ }
+ else if ( !rSh.IsDirectlyInSection() )
+ {
+ //get the page/header/footer border distance
+ const SwFrmFmt& rMaster = rDesc.GetMaster();
+ const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetAttrSet().Get(RES_BOX);
+ aDistLR.SetLeft((USHORT)rBox.GetDistance(BOX_LINE_LEFT ));
+ aDistLR.SetRight((USHORT)rBox.GetDistance(BOX_LINE_RIGHT));
+
+ const SvxBoxItem* pBox = 0;
+ if(nFrmType & FRMTYPE_HEADER)
+ {
+ rMaster.GetHeader();
+ const SwFmtHeader& rHeaderFmt = rMaster.GetHeader();
+ SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt();
+ if( pHeaderFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
+ pBox = & (const SvxBoxItem&)pHeaderFmt->GetBox();
+ }
+ else if(nFrmType & FRMTYPE_FOOTER )
+ {
+ const SwFmtFooter& rFooterFmt = rMaster.GetFooter();
+ SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt();
+ if( pFooterFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
+ pBox = & (const SvxBoxItem&)pFooterFmt->GetBox();
+ }
+ if(pBox)
+ {
+ aDistLR.SetLeft((USHORT)pBox->GetDistance(BOX_LINE_LEFT ));
+ aDistLR.SetRight((USHORT)pBox->GetDistance(BOX_LINE_RIGHT));
+ }
+
+ //add the border distance of the paragraph
+ SfxItemSet aCoreSetTmp( GetPool(),
+ RES_BOX, RES_BOX,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
+ rSh.GetCurAttr( aCoreSetTmp );
+ const SvxBoxItem& rParaBox = (const SvxBoxItem&)aCoreSetTmp.Get(RES_BOX);
+ aDistLR.SetLeft(aDistLR.GetLeft() + (USHORT)rParaBox.GetDistance(BOX_LINE_LEFT ));
+ aDistLR.SetRight(aDistLR.GetRight() + (USHORT)rParaBox.GetDistance(BOX_LINE_RIGHT));
+ rSet.Put(aDistLR);
+ nLeftBorderDistance = static_cast< USHORT >(aDistLR.GetLeft());
+ nRightBorderDistance = static_cast< USHORT >(aDistLR.GetRight());
+ }
+ }
+ }
+ break;
+ case SID_RULER_TEXT_RIGHT_TO_LEFT:
+ {
+ if ( nSelType & nsSelectionType::SEL_GRF ||
+ nSelType & nsSelectionType::SEL_FRM ||
+ nSelType & nsSelectionType::SEL_OLE ||
+ nFrmType == FRMTYPE_DRAWOBJ)
+ rSet.DisableItem(nWhich);
+ else
+ {
+ BOOL bFlag = rSh.IsInRightToLeftText();
+ rSet.Put(SfxBoolItem(nWhich, bFlag));
+ }
+ }
+ break;
+ case SID_RULER_BORDERS_VERTICAL:
+ case SID_RULER_BORDERS:
+ {
+ BOOL bFrameRTL;
+ BOOL bFrameHasVerticalColumns = rSh.IsFrmVertical(FALSE, bFrameRTL) && bFrmSelection;
+ BOOL bHasTable = ( IsTabColFromDoc() ||
+ ( rSh.GetTableFmt() && !bFrmSelection &&
+ !(nFrmType & FRMTYPE_COLSECT ) ) );
+
+ BOOL bTableVertical = bHasTable && rSh.IsTableVertical();
+
+ if( ( (SID_RULER_BORDERS_VERTICAL == nWhich) &&
+ ((bHasTable && !bTableVertical)||
+ (!bVerticalWriting && !bFrmSelection && !bHasTable ) || (bFrmSelection && !bFrameHasVerticalColumns)) ) ||
+ ((SID_RULER_BORDERS == nWhich) &&
+ ((bHasTable && bTableVertical)||
+ (bVerticalWriting && !bFrmSelection&& !bHasTable) || bFrameHasVerticalColumns)))
+ rSet.DisableItem(nWhich);
+ else if ( bHasTable )
+ {
+ SwTabCols aTabCols;
+ USHORT nNum;
+ if ( 0 != ( bSetTabColFromDoc = IsTabColFromDoc() ) )
+ {
+ rSh.GetMouseTabCols( aTabCols, aTabColFromDocPos );
+ nNum = rSh.GetCurMouseTabColNum( aTabColFromDocPos );
+ }
+ else
+ {
+ rSh.GetTabCols( aTabCols );
+ nNum = rSh.GetCurTabColNum();
+ if(rSh.IsTableRightToLeft())
+ nNum = aTabCols.Count() - nNum;
+ }
+
+ ASSERT(nNum <= aTabCols.Count(), "TabCol not found");
+ const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
+ const int nRgt = (USHORT)(bTableVertical ? nPageHeight : nPageWidth) -
+ (aTabCols.GetLeftMin() +
+ aTabCols.GetRight());
+
+ const USHORT nL = static_cast< USHORT >(nLft > 0 ? nLft : 0);
+ const USHORT nR = static_cast< USHORT >(nRgt > 0 ? nRgt : 0);
+
+ SvxColumnItem aColItem(nNum, nL, nR);
+
+ USHORT nStart = 0,
+ nEnd;
+
+ //columns in right-to-left tables need to be mirrored
+ BOOL bIsTableRTL =
+ IsTabColFromDoc() ?
+ rSh.IsMouseTableRightToLeft(aTabColFromDocPos)
+ : rSh.IsTableRightToLeft();
+ if(bIsTableRTL)
+ {
+ for ( USHORT i = aTabCols.Count(); i ; --i )
+ {
+ const SwTabColsEntry& rEntry = aTabCols.GetEntry( i - 1 );
+ nEnd = (USHORT)aTabCols.GetRight();
+ nEnd = nEnd - (USHORT)rEntry.nPos;
+ SvxColumnDescription aColDesc( nStart, nEnd,
+ (USHORT(aTabCols.GetRight() - rEntry.nMax)),
+ (USHORT(aTabCols.GetRight() - rEntry.nMin)),
+ !aTabCols.IsHidden(i - 1) );
+ aColItem.Append(aColDesc);
+ nStart = nEnd;
+ }
+ SvxColumnDescription aColDesc(nStart,
+ aTabCols.GetRight() - aTabCols.GetLeft(), TRUE);
+ aColItem.Append(aColDesc);
+ }
+ else
+ {
+ for ( USHORT i = 0; i < aTabCols.Count(); ++i )
+ {
+ const SwTabColsEntry& rEntry = aTabCols.GetEntry( i );
+ nEnd = static_cast< USHORT >(rEntry.nPos - aTabCols.GetLeft());
+ SvxColumnDescription aColDesc( nStart, nEnd,
+ rEntry.nMin - aTabCols.GetLeft(), rEntry.nMax - aTabCols.GetLeft(),
+ !aTabCols.IsHidden(i) );
+ aColItem.Append(aColDesc);
+ nStart = nEnd;
+ }
+ SvxColumnDescription aColDesc(nStart, aTabCols.GetRight() - aTabCols.GetLeft(),
+ 0, 0,
+ TRUE);
+ aColItem.Append(aColDesc);
+ }
+ rSet.Put(aColItem, nWhich);
+ }
+ else if ( bFrmSelection || nFrmType & ( FRMTYPE_COLUMN | FRMTYPE_COLSECT ) )
+ {
+ // Aus Rahmen oder Seite ?
+ USHORT nNum = 0;
+ if(bFrmSelection)
+ {
+ const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt();
+ if(pFmt)
+ nNum = pFmt->GetCol().GetNumCols();
+ }
+ else
+ nNum = rSh.GetCurColNum();
+
+ if(
+ //eigentlich sollte FRMTYPE_COLSECT nicht enthalten sein, wenn der Rahmen selektiert ist!
+ !bFrmSelection &&
+ nFrmType & FRMTYPE_COLSECT )
+ {
+ const SwSection *pSect = rSh.GetAnySection(FALSE, pPt);
+ ASSERT( pSect, "Welcher Bereich?");
+ if( pSect )
+ {
+ SwSectionFmt *pFmt = pSect->GetFmt();
+ const SwFmtCol& rCol = pFmt->GetCol();
+ if(rSh.IsInRightToLeftText())
+ nNum = rCol.GetColumns().Count() - nNum;
+ else
+ --nNum;
+ SvxColumnItem aColItem(nNum);
+ SwRect aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt);
+ const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt);
+
+ ::lcl_FillSvxColumn(rCol, USHORT(bVerticalWriting ? aRect.Height() : aRect.Width()), aColItem, 0);
+
+ if(bVerticalWriting)
+ {
+ aRect.Pos() += Point(aTmpRect.Left(), aTmpRect.Top());
+ aRect.Pos().Y() -= rPageRect.Top();
+ aColItem.SetLeft ((USHORT)(aRect.Top()));
+ aColItem.SetRight((USHORT)(nPageHeight - aRect.Bottom() ));
+ }
+ else
+ {
+ aRect.Pos() += aTmpRect.Pos();
+
+ // PAGES01
+ // make relative to page position:
+ aColItem.SetLeft ((USHORT)( aRect.Left() - rPageRect.Left() ));
+ aColItem.SetRight((USHORT)( rPageRect.Right() - aRect.Right()));
+ }
+ aColItem.SetOrtho(aColItem.CalcOrtho());
+
+ rSet.Put(aColItem, nWhich);
+ }
+ }
+ else if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
+ {
+ // Spalten in Rahmen
+ if ( nNum )
+ {
+ const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt() ;
+
+ const SwFmtCol& rCol = pFmt->GetCol();
+ if(rSh.IsInRightToLeftText())
+ nNum = rCol.GetColumns().Count() - nNum;
+ else
+ nNum--;
+ SvxColumnItem aColItem(nNum);
+ const SwRect &rSizeRect = rSh.GetAnyCurRect(RECT_FLY_PRT_EMBEDDED, pPt);
+
+ BOOL bUseVertical = bFrameHasVerticalColumns || (!bFrmSelection && bVerticalWriting);
+ const long lWidth = bUseVertical ? rSizeRect.Height() : rSizeRect.Width();
+ const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt);
+ long nDist2 = ((bUseVertical ? rRect.Height() : rRect.Width()) - lWidth) /2;
+ ::lcl_FillSvxColumn(rCol, USHORT(lWidth), aColItem, nDist2);
+
+ SfxItemSet aFrameSet(GetPool(), RES_LR_SPACE, RES_LR_SPACE);
+ rSh.GetFlyFrmAttr( aFrameSet );
+
+ if(bUseVertical)
+ {
+ aColItem.SetLeft ((USHORT)(rRect.Top()- rPageRect.Top()));
+ aColItem.SetRight((USHORT)(nPageHeight + rPageRect.Top() - rRect.Bottom() ));
+ }
+ else
+ {
+ aColItem.SetLeft ((USHORT)(rRect.Left() - rPageRect.Left() ));
+ aColItem.SetRight((USHORT)(rPageRect.Right() - rRect.Right() ));
+ }
+
+ aColItem.SetOrtho(aColItem.CalcOrtho());
+
+ rSet.Put(aColItem, nWhich);
+ }
+ else
+ rSet.DisableItem(nWhich);
+ }
+ else
+ { // Spalten auf der Seite
+ const SwFrmFmt& rMaster = rDesc.GetMaster();
+ SwFmtCol aCol(rMaster.GetCol());
+ if(rFrameDir.GetValue() == FRMDIR_HORI_RIGHT_TOP)
+ nNum = aCol.GetColumns().Count() - nNum;
+ else
+ nNum--;
+
+ SvxColumnItem aColItem(nNum);
+ const SwRect aPrtRect = rSh.GetAnyCurRect(RECT_PAGE_PRT, pPt);
+ const SvxBoxItem& rBox = (const SvxBoxItem&)rMaster.GetFmtAttr(RES_BOX);
+ long nDist = rBox.GetDistance();
+ ::lcl_FillSvxColumn(aCol,
+ USHORT(bVerticalWriting ? aPrtRect.Height() : aPrtRect.Width() ),
+ aColItem, nDist);
+
+ if(bBrowse)
+ {
+ aColItem.SetLeft((USHORT)rPagePrtRect.Left());
+ aColItem.SetRight(USHORT(nPageWidth - rPagePrtRect.Right()));
+ }
+ else
+ {
+ aColItem.SetLeft (aPageLRSpace.GetLeft());
+ aColItem.SetRight(aPageLRSpace.GetRight());
+ }
+ aColItem.SetOrtho(aColItem.CalcOrtho());
+
+ rSet.Put(aColItem, nWhich);
+ }
+ }
+ else
+ rSet.DisableItem(nWhich);
+ break;
+ }
+ case SID_RULER_ROWS :
+ case SID_RULER_ROWS_VERTICAL:
+ {
+ BOOL bFrameRTL;
+ BOOL bFrameHasVerticalColumns = rSh.IsFrmVertical(FALSE, bFrameRTL) && bFrmSelection;
+
+ if( ( (SID_RULER_ROWS == nWhich) &&
+ ((!bVerticalWriting && !bFrmSelection) || (bFrmSelection && !bFrameHasVerticalColumns)) ) ||
+ ((SID_RULER_ROWS_VERTICAL == nWhich) &&
+ ((bVerticalWriting && !bFrmSelection) || bFrameHasVerticalColumns)))
+ rSet.DisableItem(nWhich);
+ else if ( IsTabRowFromDoc() ||
+ ( rSh.GetTableFmt() && !bFrmSelection &&
+ !(nFrmType & FRMTYPE_COLSECT ) ) )
+ {
+ SwTabCols aTabCols;
+ //no current value necessary
+ USHORT nNum = 0;
+ if ( 0 != ( bSetTabRowFromDoc = IsTabRowFromDoc() ) )
+ {
+ rSh.GetMouseTabRows( aTabCols, aTabColFromDocPos );
+ }
+ else
+ {
+ rSh.GetTabRows( aTabCols );
+ }
+
+// ASSERT(nNum <= aTabCols.Count(), "TabCol not found");
+ const int nLft = aTabCols.GetLeftMin();
+ const int nRgt = (USHORT)(bVerticalWriting ? nPageWidth : nPageHeight) -
+ (aTabCols.GetLeftMin() +
+ aTabCols.GetRight());
+
+ const USHORT nL = static_cast< USHORT >(nLft > 0 ? nLft : 0);
+ const USHORT nR = static_cast< USHORT >(nRgt > 0 ? nRgt : 0);
+
+ SvxColumnItem aColItem(nNum, nL, nR);
+
+ USHORT nStart = 0,
+ nEnd;
+
+ for ( USHORT i = 0; i < aTabCols.Count(); ++i )
+ {
+ const SwTabColsEntry& rEntry = aTabCols.GetEntry( i );
+ if(bVerticalWriting)
+ {
+ nEnd = USHORT(aTabCols.GetRight() - rEntry.nPos);
+ SvxColumnDescription aColDesc( nStart, nEnd,
+ aTabCols.GetRight() - rEntry.nMax, aTabCols.GetRight() - rEntry.nMin,
+ !aTabCols.IsHidden(i) );
+ aColItem.Append(aColDesc);
+ }
+ else
+ {
+ nEnd = USHORT(rEntry.nPos - aTabCols.GetLeft());
+ SvxColumnDescription aColDesc( nStart, nEnd,
+ USHORT(rEntry.nMin - aTabCols.GetLeft()), USHORT(rEntry.nMax - aTabCols.GetLeft()),
+ !aTabCols.IsHidden(i) );
+ aColItem.Append(aColDesc);
+ }
+ nStart = nEnd;
+ }
+ if(bVerticalWriting)
+ nEnd = static_cast< USHORT >(aTabCols.GetRight());
+ else
+ nEnd = static_cast< USHORT >(aTabCols.GetLeft());
+ // put a position protection when the last row cannot be moved
+ // due to a page break inside of a row
+ if(!aTabCols.IsLastRowAllowedToChange())
+ bPutContentProtection = sal_True;
+
+ SvxColumnDescription aColDesc( nStart, nEnd,
+ aTabCols.GetRight(), aTabCols.GetRight(),
+ FALSE );
+ aColItem.Append(aColDesc);
+
+ rSet.Put(aColItem, nWhich);
+ }
+ else
+ rSet.DisableItem(nWhich);
+ }
+ break;
+ case SID_RULER_PAGE_POS:
+ {
+ // PAGES01
+ SvxPagePosSizeItem aPagePosSize(
+ Point( rPageRect.Left(), rPageRect.Top()) , nPageWidth, nPageHeight);
+
+ rSet.Put(aPagePosSize);
+ break;
+ }
+ case SID_RULER_LR_MIN_MAX:
+ {
+ Rectangle aRectangle;
+ if( ( nFrmType & FRMTYPE_COLSECT ) && !IsTabColFromDoc() &&
+ ( nFrmType & ( FRMTYPE_TABLE|FRMTYPE_COLUMN ) ) )
+ {
+ if( nFrmType & FRMTYPE_TABLE )
+ {
+ const USHORT nNum = rSh.GetCurTabColNum();
+ SwTabCols aTabCols;
+ rSh.GetTabCols( aTabCols );
+
+ const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
+ const int nRgt = (USHORT)nPageWidth -(aTabCols.GetLeftMin() + aTabCols.GetRight());
+
+ const USHORT nL = static_cast< USHORT >(nLft > 0 ? nLft : 0);
+ const USHORT nR = static_cast< USHORT >(nRgt > 0 ? nRgt : 0);
+
+ aRectangle.Left() = nL;
+ if(nNum > 1)
+ aRectangle.Left() += aTabCols[nNum - 2];
+ if(nNum)
+ aRectangle.Left() += MINLAY;
+ if(aTabCols.Count() <= nNum + 1 )
+ aRectangle.Right() = nR;
+ else
+ aRectangle.Right() = nPageWidth - (nL + aTabCols[nNum + 1]);
+
+ if(nNum < aTabCols.Count())
+ aRectangle.Right() += MINLAY;
+ }
+ else
+ {
+ const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt();
+ const SwFmtCol* pCols = pFmt ? &pFmt->GetCol():
+ &rDesc.GetMaster().GetCol();
+ const SwColumns& rCols = pCols->GetColumns();
+ USHORT nNum = rSh.GetCurOutColNum();
+ USHORT nCount = Min(USHORT(nNum + 1), rCols.Count());
+ const SwRect aRect( rSh.GetAnyCurRect( pFmt
+ ? RECT_FLY_PRT_EMBEDDED
+ : RECT_PAGE_PRT, pPt ));
+ const SwRect aAbsRect( rSh.GetAnyCurRect( pFmt
+ ? RECT_FLY_EMBEDDED
+ : RECT_PAGE, pPt ));
+
+ //die Breite im Rahmen bzw. innerhalbe der Seitenraender
+ const USHORT nTotalWidth = (USHORT)aRect.Width();
+ //die gesamte Rahmenbreite - die Differenz ist der doppelte Abstand zum Rand
+ const USHORT nOuterWidth = (USHORT)aAbsRect.Width();
+ int nWidth = 0,
+ nStart = 0,
+ nEnd = 0;
+ aRectangle.Left() = 0;
+ for ( USHORT i = 0; i < nCount; ++i )
+ {
+ SwColumn* pCol = rCols[i];
+ nStart = pCol->GetLeft() + nWidth;
+ if(i == nNum - 2)
+ aRectangle.Left() = nStart;
+ nWidth += pCols->CalcColWidth( i, nTotalWidth );
+ nEnd = nWidth - pCol->GetRight();
+ }
+ aRectangle.Right() = rPageRect.Right() - nEnd;
+ aRectangle.Left() -= rPageRect.Left();
+
+ if(nNum > 1)
+ {
+ aRectangle.Left() += MINLAY;
+ aRectangle.Left() += aRect.Left();
+ }
+ if(pFmt) //Bereich in Rahmen - hier darf man bis zum Rand
+ aRectangle.Left() = aRectangle.Right() = 0;
+ else
+ {
+ // das Rechteck an die richtige absolute Position verschieben
+ aRectangle.Left() += aAbsRect.Left();
+ aRectangle.Right() -= aAbsRect.Left();
+ // Abstand zur Umrandung mit einbeziehen
+ aRectangle.Right() -= (nOuterWidth - nTotalWidth) / 2;
+ }
+
+ if(nNum < rCols.Count())
+ {
+ aRectangle.Right() += MINLAY;
+ }
+ else
+ // rechts ist jetzt nur noch der Seitenrand
+ aRectangle.Right() = 0;
+
+
+ }
+ }
+ else if ( ((nFrmType & FRMTYPE_TABLE) || IsTabColFromDoc()) &&
+ !bFrmSelection )
+ {
+ BOOL bColumn;
+ if ( IsTabColFromDoc() )
+ bColumn = rSh.GetCurMouseColNum( aTabColFromDocPos ) != 0;
+ else
+ bColumn = (nFrmType & (FRMTYPE_COLUMN|FRMTYPE_FLY_ANY|
+ FRMTYPE_COLSECTOUTTAB)) ?
+ TRUE : FALSE;
+ if ( !bColumn )
+ {
+ if( nFrmType & FRMTYPE_FLY_ANY && IsTabColFromDoc() )
+ {
+ SwRect aRect( rSh.GetAnyCurRect(
+ RECT_FLY_PRT_EMBEDDED, pPt ) );
+ aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED,
+ pPt ).Pos();
+
+ aRectangle.Left() = aRect.Left() - rPageRect.Left();
+ aRectangle.Right() = rPageRect.Right() - aRect.Right();
+ }
+ else if( bBrowse )
+ {
+ aRectangle.Left() = rPagePrtRect.Left();
+ aRectangle.Right() = nPageWidth - rPagePrtRect.Right();
+ }
+ else
+ {
+ aRectangle.Left() = aPageLRSpace.GetLeft();
+ aRectangle.Right() = aPageLRSpace.GetRight();
+ }
+ }
+ else
+ { //hier nur fuer Tabelle in mehrspaltigen Seiten und Rahmen
+ BOOL bSectOutTbl = (nFrmType & FRMTYPE_TABLE) ? TRUE : FALSE;
+ BOOL bFrame = (nFrmType & FRMTYPE_FLY_ANY) ? TRUE : FALSE;
+ BOOL bColSct = (nFrmType & ( bSectOutTbl
+ ? FRMTYPE_COLSECTOUTTAB
+ : FRMTYPE_COLSECT )
+ ) ? TRUE : FALSE;
+ //Damit man auch mit der Mouse ziehen kann,
+ //ohne in der Tabelle zu stehen
+ CurRectType eRecType = RECT_PAGE_PRT;
+ USHORT nNum = IsTabColFromDoc() ?
+ rSh.GetCurMouseColNum( aTabColFromDocPos ):
+ rSh.GetCurOutColNum();
+ const SwFrmFmt* pFmt = NULL;
+ if( bColSct )
+ {
+ eRecType = bSectOutTbl ? RECT_OUTTABSECTION
+ : RECT_SECTION;
+ const SwSection *pSect = rSh.GetAnySection( bSectOutTbl, pPt );
+ ASSERT( pSect, "Welcher Bereich?");
+ pFmt = pSect->GetFmt();
+ }
+ else if( bFrame )
+ {
+ pFmt = rSh.GetFlyFrmFmt();
+ eRecType = RECT_FLY_PRT_EMBEDDED;
+ }
+
+ const SwFmtCol* pCols = pFmt ? &pFmt->GetCol():
+ &rDesc.GetMaster().GetCol();
+ const SwColumns& rCols = pCols->GetColumns();
+ const USHORT nBorder = pFmt ? pFmt->GetBox().GetDistance() :
+ rDesc.GetMaster().GetBox().GetDistance();
+
+ /* RECT_FLY_PRT_EMBEDDED returns the relative position to
+ RECT_FLY_EMBEDDED
+ the absolute position must be added here
+ */
+ SwRect aRect( rSh.GetAnyCurRect( eRecType, pPt ) );
+ if(RECT_FLY_PRT_EMBEDDED == eRecType)
+ aRect.Pos() += rSh.GetAnyCurRect( RECT_FLY_EMBEDDED,
+ pPt ).Pos();
+
+ const USHORT nTotalWidth = (USHORT)aRect.Width();
+ //nStart und nEnd initialisieren fuer nNum == 0
+ int nWidth = 0,
+ nStart = 0,
+ nEnd = nTotalWidth;
+
+ if( nNum > rCols.Count() )
+ {
+ ASSERT( !this, "es wird auf dem falschen FmtCol gearbeitet!" );
+ nNum = rCols.Count();
+ }
+
+ for( USHORT i = 0; i < nNum; ++i )
+ {
+ SwColumn* pCol = rCols[i];
+ nStart = pCol->GetLeft() + nWidth;
+ nWidth += pCols->CalcColWidth( i, nTotalWidth );
+ nEnd = nWidth - pCol->GetRight();
+ }
+ if( bFrame | bColSct )
+ {
+ aRectangle.Left() = aRect.Left() - rPageRect.Left() + nStart;
+ aRectangle.Right() = nPageWidth - aRectangle.Left() - nEnd + nStart;
+ }
+ else if(!bBrowse)
+ {
+ aRectangle.Left() = aPageLRSpace.GetLeft() + nStart;
+ aRectangle.Right() = nPageWidth - nEnd - aPageLRSpace.GetLeft();
+ }
+ else
+ {
+ long nLeft = rPagePrtRect.Left();
+ aRectangle.Left() = nStart + nLeft;
+ aRectangle.Right() = nPageWidth - nEnd - nLeft;
+ }
+ if(!bFrame)
+ {
+ aRectangle.Left() += nBorder;
+ aRectangle.Right() -= nBorder;
+ }
+ }
+ }
+ else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER ))
+ {
+ aRectangle.Left() = aPageLRSpace.GetLeft();
+ aRectangle.Right() = aPageLRSpace.GetRight();
+ }
+ else
+ aRectangle.Left() = aRectangle.Right() = 0;
+
+ SfxRectangleItem aLR( SID_RULER_LR_MIN_MAX , aRectangle);
+ rSet.Put(aLR);
+ }
+ break;
+ case SID_RULER_PROTECT:
+ {
+ if(bFrmSelection)
+ {
+ BYTE nProtect = pWrtShell->IsSelObjProtected( FLYPROTECT_SIZE|FLYPROTECT_POS|FLYPROTECT_CONTENT );
+
+ SvxProtectItem aProt(SID_RULER_PROTECT);
+ aProt.SetCntntProtect((nProtect & FLYPROTECT_CONTENT) != 0);
+ aProt.SetSizeProtect ((nProtect & FLYPROTECT_SIZE) != 0);
+ aProt.SetPosProtect ((nProtect & FLYPROTECT_POS) != 0);
+ rSet.Put(aProt);
+ }
+ else
+ {
+ SvxProtectItem aProtect(SID_RULER_PROTECT);
+ if(bBrowse && !(nFrmType & (FRMTYPE_DRAWOBJ|FRMTYPE_COLUMN)) && !rSh.GetTableFmt())
+ {
+ aProtect.SetSizeProtect(TRUE);
+ aProtect.SetPosProtect(TRUE);
+ }
+ rSet.Put(aProtect);
+ }
+ }
+ break;
+ }
+ nWhich = aIter.NextWhich();
+ }
+ if(bPutContentProtection)
+ {
+ SvxProtectItem aProtect(SID_RULER_PROTECT);
+ aProtect.SetCntntProtect(TRUE);
+ rSet.Put(aProtect);
+ }
+}
+
+
diff --git a/sw/source/ui/uno/RefreshListenerContainer.cxx b/sw/source/ui/uno/RefreshListenerContainer.cxx
new file mode 100644
index 000000000000..39d28a6347c1
--- /dev/null
+++ b/sw/source/ui/uno/RefreshListenerContainer.cxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <RefreshListenerContainer.hxx>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/util/XRefreshListener.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+
+SwRefreshListenerContainer::SwRefreshListenerContainer( uno::XInterface* pxParent2 )
+: SwEventListenerContainer ( pxParent2 )
+{
+}
+
+void SwRefreshListenerContainer::Refreshed ()
+{
+ if(!pListenerArr)
+ return;
+
+ lang::EventObject aObj(pxParent);
+ for(sal_uInt16 i = 0, nEnd = pListenerArr->Count(); i < nEnd ; i++)
+ {
+ Reference < XRefreshListener > xRefreshListener = Reference < XRefreshListener > ( *pListenerArr->GetObject(i), UNO_QUERY );
+ xRefreshListener->refreshed(aObj);
+ }
+}
diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx
new file mode 100644
index 000000000000..64f904b61c87
--- /dev/null
+++ b/sw/source/ui/uno/SwXDocumentSettings.cxx
@@ -0,0 +1,1076 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <vos/mutex.hxx>
+#include <sfx2/sfxbasecontroller.hxx>
+#include <SwXDocumentSettings.hxx>
+#include <comphelper/MasterPropertySetInfo.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <com/sun/star/document/PrinterIndependentLayout.hpp>
+#include <doc.hxx>
+#include <docsh.hxx>
+#include <fldupde.hxx>
+#include <linkenum.hxx>
+#include <sfx2/printer.hxx>
+#include <editsh.hxx>
+#include <drawdoc.hxx>
+#include <svl/zforlist.hxx>
+#include <unotxdoc.hxx>
+#include <cmdid.h>
+#include <svx/zoomitem.hxx>
+#include <unomod.hxx>
+#include <vcl/svapp.hxx>
+
+#include "swmodule.hxx"
+#include "cfgitems.hxx"
+#include "prtopt.hxx"
+
+
+#include "swmodule.hxx"
+#include "cfgitems.hxx"
+#include "prtopt.hxx"
+
+using rtl::OUString;
+
+using namespace comphelper;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::i18n;
+
+enum SwDocumentSettingsPropertyHandles
+{
+ HANDLE_FORBIDDEN_CHARS,
+ HANDLE_LINK_UPDATE_MODE,
+ HANDLE_FIELD_AUTO_UPDATE,
+ HANDLE_CHART_AUTO_UPDATE,
+ HANDLE_ADD_PARA_TABLE_SPACING,
+ HANDLE_ADD_PARA_TABLE_SPACING_AT_START,
+ HANDLE_ALIGN_TAB_STOP_POSITION,
+ HANDLE_PRINTER_NAME,
+ HANDLE_PRINTER_SETUP,
+ HANDLE_IS_KERN_ASIAN_PUNCTUATION,
+ HANDLE_CHARACTER_COMPRESSION_TYPE,
+ HANDLE_APPLY_USER_DATA,
+ HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS,
+ HANDLE_CURRENT_DATABASE_DATA_SOURCE,
+ HANDLE_CURRENT_DATABASE_COMMAND,
+ HANDLE_CURRENT_DATABASE_COMMAND_TYPE,
+ HANDLE_SAVE_VERSION_ON_CLOSE,
+ HANDLE_IS_GRID_VISIBLE,
+ HANDLE_IS_SNAP_TO_GRID,
+ HANDLE_IS_SYNCHRONISE_AXES,
+ HANDLE_HORIZONTAL_GRID_RESOLUTION,
+ HANDLE_HORIZONTAL_GRID_SUBDIVISION,
+ HANDLE_VERTICAL_GRID_RESOLUTION,
+ HANDLE_VERTICAL_GRID_SUBDIVISION,
+ HANDLE_UPDATE_FROM_TEMPLATE,
+ HANDLE_PRINTER_INDEPENDENT_LAYOUT,
+ HANDLE_IS_LABEL_DOC,
+ HANDLE_IS_ADD_FLY_OFFSET,
+ HANDLE_IS_ADD_EXTERNAL_LEADING,
+ HANDLE_OLD_NUMBERING, // #111955#
+ HANDLE_OUTLINELEVEL_YIELDS_NUMBERING,
+ /* Stampit It disable the print cancel button of the shown progress dialog. */
+ HANDLE_ALLOW_PRINTJOB_CANCEL,
+ HANDLE_USE_FORMER_LINE_SPACING,
+ HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS,
+ HANDLE_USE_FORMER_OBJECT_POSITIONING,
+ HANDLE_USE_FORMER_TEXT_WRAPPING,
+ HANDLE_CHANGES_PASSWORD,
+ HANDLE_CONSIDER_WRAP_ON_OBJPOS,
+ HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING,
+ HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK,
+ HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT,
+ HANDLE_TABLE_ROW_KEEP,
+ HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION,
+ HANDLE_LOAD_READONLY,
+ HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE,
+ HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES,
+ HANDLE_UNIX_FORCE_ZERO_EXT_LEADING,
+ HANDLE_USE_OLD_PRINTER_METRICS,
+ HANDLE_PROTECT_FORM,
+ HANDLE_TABS_RELATIVE_TO_INDENT,
+ // --> OD 2008-06-05 #i89181#
+ HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST,
+ // <--
+ HANDLE_MODIFYPASSWORDINFO,
+ HANDLE_MATH_BASELINE_ALIGNMENT
+};
+
+MasterPropertySetInfo * lcl_createSettingsInfo()
+{
+ static PropertyInfo aWriterSettingsInfoMap[] =
+ {
+ { RTL_CONSTASCII_STRINGPARAM("ForbiddenCharacters"), HANDLE_FORBIDDEN_CHARS, CPPUTYPE_REFFORBCHARS, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("LinkUpdateMode"), HANDLE_LINK_UPDATE_MODE, CPPUTYPE_INT16, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("FieldAutoUpdate"), HANDLE_FIELD_AUTO_UPDATE, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ChartAutoUpdate"), HANDLE_CHART_AUTO_UPDATE, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("AddParaTableSpacing"), HANDLE_ADD_PARA_TABLE_SPACING, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("AddParaTableSpacingAtStart"), HANDLE_ADD_PARA_TABLE_SPACING_AT_START, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("AlignTabStopPosition"), HANDLE_ALIGN_TAB_STOP_POSITION, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("PrinterName"), HANDLE_PRINTER_NAME, CPPUTYPE_OUSTRING, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("PrinterSetup"), HANDLE_PRINTER_SETUP, CPPUTYPE_SEQINT8, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("IsKernAsianPunctuation"), HANDLE_IS_KERN_ASIAN_PUNCTUATION, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("CharacterCompressionType"), HANDLE_CHARACTER_COMPRESSION_TYPE, CPPUTYPE_INT16, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ApplyUserData"), HANDLE_APPLY_USER_DATA, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("SaveGlobalDocumentLinks"), HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("CurrentDatabaseDataSource"), HANDLE_CURRENT_DATABASE_DATA_SOURCE, CPPUTYPE_OUSTRING, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("CurrentDatabaseCommand"), HANDLE_CURRENT_DATABASE_COMMAND, CPPUTYPE_OUSTRING, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("CurrentDatabaseCommandType"), HANDLE_CURRENT_DATABASE_COMMAND_TYPE, CPPUTYPE_INT32, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("SaveVersionOnClose"), HANDLE_SAVE_VERSION_ON_CLOSE, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("UpdateFromTemplate"), HANDLE_UPDATE_FROM_TEMPLATE, CPPUTYPE_BOOLEAN, 0, 0},
+
+ { RTL_CONSTASCII_STRINGPARAM("PrinterIndependentLayout"), HANDLE_PRINTER_INDEPENDENT_LAYOUT, CPPUTYPE_INT16, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("IsLabelDocument"), HANDLE_IS_LABEL_DOC, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("UseOldNumbering"), HANDLE_OLD_NUMBERING, CPPUTYPE_BOOLEAN, 0, 0}, // #111955#
+ { RTL_CONSTASCII_STRINGPARAM("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, CPPUTYPE_BOOLEAN, 0, 0},
+ /* Stampit It disable the print cancel button of the shown progress dialog. */
+ { RTL_CONSTASCII_STRINGPARAM("AllowPrintJobCancel"), HANDLE_ALLOW_PRINTJOB_CANCEL, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("UseFormerLineSpacing"), HANDLE_USE_FORMER_LINE_SPACING, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("AddParaSpacingToTableCells"), HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("UseFormerObjectPositioning"), HANDLE_USE_FORMER_OBJECT_POSITIONING, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("UseFormerTextWrapping"), HANDLE_USE_FORMER_TEXT_WRAPPING, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("RedlineProtectionKey"), HANDLE_CHANGES_PASSWORD, CPPUTYPE_SEQINT8, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ConsiderTextWrapOnObjPos"), HANDLE_CONSIDER_WRAP_ON_OBJPOS, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("IgnoreFirstLineIndentInNumbering"), HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("DoNotJustifyLinesWithManualBreak"), HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("DoNotResetParaAttrsForNumFont"), HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("TableRowKeep"), HANDLE_TABLE_ROW_KEEP, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("IgnoreTabsAndBlanksForLineCalculation"), HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("LoadReadonly"), HANDLE_LOAD_READONLY, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("DoNotCaptureDrawObjsOnPage"), HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ClipAsCharacterAnchoredWriterFlyFrames"), HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("UnxForceZeroExtLeading"), HANDLE_UNIX_FORCE_ZERO_EXT_LEADING, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("UseOldPrinterMetrics"), HANDLE_USE_OLD_PRINTER_METRICS, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("TabsRelativeToIndent"), HANDLE_TABS_RELATIVE_TO_INDENT, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ProtectForm"), HANDLE_PROTECT_FORM, CPPUTYPE_BOOLEAN, 0, 0},
+ // --> OD 2008-06-05 #i89181#
+ { RTL_CONSTASCII_STRINGPARAM("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, CPPUTYPE_PROPERTYVALUE, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, CPPUTYPE_BOOLEAN, 0, 0},
+
+/*
+ * As OS said, we don't have a view when we need to set this, so I have to
+ * find another solution before adding them to this property set - MTG
+ { RTL_CONSTASCII_STRINGPARAM("IsGridVisible"), HANDLE_IS_GRID_VISIBLE, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("IsSnapToGrid"), HANDLE_IS_SNAP_TO_GRID, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("IsSynchroniseAxes"), HANDLE_IS_SYNCHRONISE_AXES, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("HorizontalGridResolution"), HANDLE_HORIZONTAL_GRID_RESOLUTION, CPPUTYPE_INT32, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("HorizontalGridSubdivision"), HANDLE_HORIZONTAL_GRID_SUBDIVISION, CPPUTYPE_INT16, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("VerticalGridResolution"), HANDLE_VERTICAL_GRID_RESOLUTION, CPPUTYPE_INT32, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("VerticalGridSubdivision"), HANDLE_VERTICAL_GRID_SUBDIVISION, CPPUTYPE_INT16, 0, 0},
+
+ { RTL_CONSTASCII_STRINGPARAM("ShowParagraphEnd"), HANDLE_SHOW_PARAGRAPH_END, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ShowOptionalHyphens"), HANDLE_SHOW_OPTIONAL_HYPHENS, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ShowSpaces"), HANDLE_SHOW_SPACES, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ShowTabs"), HANDLE_SHOW_TABS, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ShowBreaks"), HANDLE_SHOW_BREAKS, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ShowHiddenText"), HANDLE_SHOW_HIDDEN_TEXT, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ShowHiddenParagraphs"), HANDLE_SHOW_HIDDEN_PARAGRAPHS, CPPUTYPE_BOOLEAN, 0, 0},
+
+ { RTL_CONSTASCII_STRINGPARAM("ShowTextLimitGuide"), HANDLE_SHOW_TEXT_LIMIT_GUIDE, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ShowTableLimitGuide"), HANDLE_SHOW_TABLE_LIMIT_GUIDE, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ShowSectionLimitGuide"), HANDLE_SHOW_SECTION_LIMIT_GUIDE, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ShowGuidesWhileMoving"), HANDLE_SHOW_GUIDES_WHILE_MOVING, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ShowSimpleHandles"), HANDLE_SHOW_SIMPLE_HANDLES, CPPUTYPE_BOOLEAN, 0, 0},
+ { RTL_CONSTASCII_STRINGPARAM("ShowLargeHandles"), HANDLE_SHOW_LARGE_HANDLES, CPPUTYPE_BOOLEAN, 0, 0},
+*/
+ { NULL, 0, 0, CPPUTYPE_UNKNOWN, 0, 0 }
+ };
+ return new MasterPropertySetInfo ( aWriterSettingsInfoMap );
+}
+
+SwXDocumentSettings::SwXDocumentSettings ( SwXTextDocument * pModel )
+: MasterPropertySet ( lcl_createSettingsInfo (),
+ &Application::GetSolarMutex () )
+, mxModel ( pModel )
+, mpModel ( pModel )
+, mpDocSh ( NULL )
+, mpDoc ( NULL )
+, mpPrinter( NULL )
+{
+ registerSlave ( new SwXPrintSettings ( PRINT_SETTINGS_DOCUMENT, mpModel->GetDocShell()->GetDoc() ) );
+}
+
+SwXDocumentSettings::~SwXDocumentSettings()
+ throw()
+{
+}
+
+Any SAL_CALL SwXDocumentSettings::queryInterface( const Type& rType )
+ throw(RuntimeException)
+{
+ return ::cppu::queryInterface ( rType,
+ // OWeakObject interfaces
+ dynamic_cast< XInterface* > ( dynamic_cast< OWeakObject* >(this) ),
+ dynamic_cast< XWeak* > ( this ),
+ // my own interfaces
+ dynamic_cast< XPropertySet* > ( this ),
+ dynamic_cast< XPropertyState* > ( this ),
+ dynamic_cast< XMultiPropertySet* > ( this ),
+ dynamic_cast< XServiceInfo* > ( this ),
+ dynamic_cast< XTypeProvider* > ( this ) );
+}
+void SwXDocumentSettings::acquire ()
+ throw ()
+{
+ OWeakObject::acquire();
+}
+void SwXDocumentSettings::release ()
+ throw ()
+{
+ OWeakObject::release();
+}
+
+uno::Sequence< uno::Type > SAL_CALL SwXDocumentSettings::getTypes( )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Sequence< uno::Type > aBaseTypes( 5 );
+ uno::Type* pBaseTypes = aBaseTypes.getArray();
+
+ // from MasterPropertySet
+ pBaseTypes[0] = ::getCppuType((Reference< XPropertySet >*)0);
+ pBaseTypes[1] = ::getCppuType((Reference< XPropertyState >*)0);
+ pBaseTypes[2] = ::getCppuType((Reference< XMultiPropertySet >*)0);
+ //
+ pBaseTypes[3] = ::getCppuType((Reference< XServiceInfo >*)0);
+ pBaseTypes[4] = ::getCppuType((Reference< XTypeProvider >*)0);
+
+ return aBaseTypes;
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL SwXDocumentSettings::getImplementationId( )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+
+void SwXDocumentSettings::_preSetValues ()
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
+{
+ mpDocSh = mpModel->GetDocShell();
+ mpDoc = mpDocSh->GetDoc();
+
+ if( NULL == mpDoc || NULL == mpDocSh )
+ throw UnknownPropertyException();
+}
+
+
+void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, const uno::Any &rValue )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
+{
+ if (rInfo.mnAttributes & PropertyAttribute::READONLY)
+ throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + C2U(rInfo.mpName), static_cast < cppu::OWeakObject * > ( 0 ) );
+
+ switch( rInfo.mnHandle )
+ {
+ case HANDLE_FORBIDDEN_CHARS:
+ break;
+ case HANDLE_LINK_UPDATE_MODE:
+ {
+ sal_Int16 nMode = 0;
+ rValue >>= nMode;
+ switch (nMode)
+ {
+ case NEVER:
+ case MANUAL:
+ case AUTOMATIC:
+ case GLOBALSETTING:
+ break;
+ default:
+ throw IllegalArgumentException();
+ }
+ mpDoc->setLinkUpdateMode(nMode);
+ }
+ break;
+ case HANDLE_FIELD_AUTO_UPDATE:
+ {
+ sal_Bool bUpdateField = *(sal_Bool*)rValue.getValue();
+ SwFldUpdateFlags nFlag = mpDoc->getFieldUpdateFlags(true);
+ mpDoc->setFieldUpdateFlags( bUpdateField ?
+ nFlag == AUTOUPD_FIELD_AND_CHARTS ?
+ AUTOUPD_FIELD_AND_CHARTS :
+ AUTOUPD_FIELD_ONLY :
+ AUTOUPD_OFF );
+ }
+ break;
+ case HANDLE_CHART_AUTO_UPDATE:
+ {
+ sal_Bool bUpdateChart = *(sal_Bool*)rValue.getValue();
+ SwFldUpdateFlags nFlag = mpDoc->getFieldUpdateFlags(true);
+ mpDoc->setFieldUpdateFlags( (nFlag == AUTOUPD_FIELD_ONLY || nFlag == AUTOUPD_FIELD_AND_CHARTS ) ?
+ bUpdateChart ?
+ AUTOUPD_FIELD_AND_CHARTS :
+ AUTOUPD_FIELD_ONLY :
+ AUTOUPD_OFF );
+ }
+ break;
+ case HANDLE_ADD_PARA_TABLE_SPACING:
+ {
+ sal_Bool bParaSpace = sal_False;
+ rValue >>= bParaSpace;
+ mpDoc->set(IDocumentSettingAccess::PARA_SPACE_MAX, bParaSpace );
+ }
+ break;
+ case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
+ {
+ sal_Bool bParaSpacePage = sal_False;
+ rValue >>= bParaSpacePage;
+ mpDoc->set(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES, bParaSpacePage );
+ }
+ break;
+ case HANDLE_ALIGN_TAB_STOP_POSITION:
+ {
+ sal_Bool bAlignTab = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::TAB_COMPAT, bAlignTab);
+ }
+ break;
+ case HANDLE_PRINTER_NAME:
+ {
+ //the printer must be created
+ OUString sPrinterName;
+ if( rValue >>= sPrinterName )
+ {
+ if( !mpPrinter && sPrinterName.getLength() > 0 && mpDocSh->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED )
+ {
+ SfxPrinter* pPrinter = mpDoc->getPrinter( true );
+ if ( OUString ( pPrinter->GetName()) != sPrinterName )
+ {
+ SfxPrinter *pNewPrinter = new SfxPrinter ( pPrinter->GetOptions().Clone(), sPrinterName );
+ if( pNewPrinter->IsKnown() )
+ {
+ // set printer only once; in _postSetValues
+ mpPrinter = pNewPrinter;
+ }
+ else
+ {
+ delete pNewPrinter;
+ }
+ }
+ }
+ }
+ else
+ throw IllegalArgumentException();
+ }
+ break;
+ case HANDLE_PRINTER_SETUP:
+ {
+ Sequence < sal_Int8 > aSequence;
+ if ( rValue >>= aSequence )
+ {
+ sal_uInt32 nSize = aSequence.getLength();
+ if( nSize > 0 )
+ {
+ SvMemoryStream aStream (aSequence.getArray(), nSize,
+ STREAM_READ );
+ aStream.Seek ( STREAM_SEEK_TO_BEGIN );
+ static sal_uInt16 __READONLY_DATA nRange[] =
+ {
+ FN_PARAM_ADDPRINTER, FN_PARAM_ADDPRINTER,
+ SID_HTML_MODE, SID_HTML_MODE,
+ SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN,
+ SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
+ 0
+ };
+ SfxItemSet *pItemSet = new SfxItemSet( mpDoc->GetAttrPool(), nRange );
+ SfxPrinter *pPrinter = SfxPrinter::Create ( aStream, pItemSet );
+
+ // set printer only once; in _postSetValues
+ delete mpPrinter;
+ mpPrinter = pPrinter;
+ }
+ }
+ else
+ throw IllegalArgumentException();
+ }
+ break;
+ case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
+ {
+ sal_Bool bIsKern = *(sal_Bool*)(rValue).getValue();
+ mpDoc->set(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION, bIsKern);
+ SwEditShell* pEditSh = mpDoc->GetEditShell();
+ if(pEditSh)
+ pEditSh->ChgHyphenation();
+ }
+ break;
+ case HANDLE_CHARACTER_COMPRESSION_TYPE:
+ {
+ sal_Int16 nMode = 0;
+ rValue >>= nMode;
+ switch (nMode)
+ {
+ case CHARCOMPRESS_NONE:
+ case CHARCOMPRESS_PUNCTUATION:
+ case CHARCOMPRESS_PUNCTUATION_KANA:
+ break;
+ default:
+ throw IllegalArgumentException();
+ }
+ mpDoc->setCharacterCompressionType(static_cast < SwCharCompressType > (nMode) );
+ }
+ break;
+ case HANDLE_APPLY_USER_DATA:
+ {
+ mpDocSh->SetUseUserData( *(sal_Bool*)rValue.getValue() );
+ }
+ break;
+ case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
+ {
+ sal_Bool bSaveGlobal = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, bSaveGlobal );
+ }
+ break;
+ case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
+ {
+ SwDBData aData = mpDoc->GetDBData();
+ if ( rValue >>= aData.sDataSource )
+ mpDoc->ChgDBData( aData );
+ }
+ break;
+ case HANDLE_CURRENT_DATABASE_COMMAND:
+ {
+ SwDBData aData = mpDoc->GetDBData();
+ if ( rValue >>= aData.sCommand )
+ mpDoc->ChgDBData( aData );
+ }
+ break;
+ case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
+ {
+ SwDBData aData = mpDoc->GetDBData();
+ if ( rValue >>= aData.nCommandType )
+ mpDoc->ChgDBData( aData );
+ }
+ break;
+ case HANDLE_SAVE_VERSION_ON_CLOSE:
+ {
+ mpDocSh->SetSaveVersionOnClose( *(sal_Bool*)rValue.getValue() );
+ }
+ break;
+ case HANDLE_UPDATE_FROM_TEMPLATE:
+ {
+ mpDocSh->SetQueryLoadTemplate( *(sal_Bool*)rValue.getValue() );
+ }
+ break;
+ case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
+ {
+ sal_Int16 nTmp = 0;
+ rValue >>= nTmp;
+
+ bool bUseVirDev = true;
+ bool bHiResVirDev = true;
+ if( nTmp == document::PrinterIndependentLayout::DISABLED )
+ bUseVirDev = false;
+ else if ( nTmp == document::PrinterIndependentLayout::LOW_RESOLUTION )
+ bHiResVirDev = false;
+ else if ( nTmp != document::PrinterIndependentLayout::HIGH_RESOLUTION )
+ throw IllegalArgumentException();
+
+ mpDoc->setReferenceDeviceType( bUseVirDev, bHiResVirDev );
+ }
+ break;
+ case HANDLE_IS_LABEL_DOC :
+ {
+ sal_Bool bSet = sal_False;
+ if(!(rValue >>= bSet))
+ throw IllegalArgumentException();
+ mpDoc->set(IDocumentSettingAccess::LABEL_DOCUMENT, bSet);
+ }
+ break;
+ case HANDLE_IS_ADD_FLY_OFFSET:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::ADD_FLY_OFFSETS, bTmp);
+ }
+ break;
+ case HANDLE_IS_ADD_EXTERNAL_LEADING:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::ADD_EXT_LEADING, bTmp);
+ }
+ break;
+ case HANDLE_OLD_NUMBERING: // #111955#
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::OLD_NUMBERING, bTmp);
+ }
+ case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE, bTmp);
+ }
+ break;
+ case HANDLE_ALLOW_PRINTJOB_CANCEL:
+ {
+ sal_Bool bState = sal_False;
+ if (!(rValue >>= bState))
+ throw IllegalArgumentException();
+ mpDocSh->Stamp_SetPrintCancelState(bState);
+ }
+ break;
+ case HANDLE_USE_FORMER_LINE_SPACING:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::OLD_LINE_SPACING, bTmp);
+ }
+ break;
+ case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS, bTmp);
+ }
+ break;
+ case HANDLE_USE_FORMER_OBJECT_POSITIONING:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::USE_FORMER_OBJECT_POS, bTmp);
+ }
+ break;
+ case HANDLE_USE_FORMER_TEXT_WRAPPING:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING, bTmp);
+ }
+ break;
+ case HANDLE_CHANGES_PASSWORD:
+ {
+ Sequence <sal_Int8> aNew;
+ if(rValue >>= aNew)
+ {
+ mpDoc->SetRedlinePassword(aNew);
+ if(aNew.getLength())
+ {
+ sal_uInt16 eMode = mpDoc->GetRedlineMode();
+ eMode = eMode|nsRedlineMode_t::REDLINE_ON;
+ mpDoc->SetRedlineMode((RedlineMode_t)( eMode ));
+ }
+ }
+ }
+ break;
+ case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION, bTmp );
+ }
+ break;
+ case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING, bTmp);
+ }
+ break;
+ case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, bTmp);
+ }
+ break;
+ case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT, bTmp);
+ }
+ break;
+ case HANDLE_TABLE_ROW_KEEP:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::TABLE_ROW_KEEP, bTmp);
+ }
+ break;
+ case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION, bTmp);
+ }
+ break;
+ case HANDLE_LOAD_READONLY:
+ {
+ mpDocSh->SetLoadReadonly( *(sal_Bool*)rValue.getValue() );
+ }
+ break;
+ case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, bTmp);
+ }
+ break;
+ case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME, bTmp);
+ }
+ break;
+ case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::UNIX_FORCE_ZERO_EXT_LEADING, bTmp);
+ }
+ break;
+ case HANDLE_USE_OLD_PRINTER_METRICS:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::USE_OLD_PRINTER_METRICS, bTmp);
+ }
+ break;
+ case HANDLE_TABS_RELATIVE_TO_INDENT:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT, bTmp);
+ }
+ break;
+ case HANDLE_PROTECT_FORM:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::PROTECT_FORM, bTmp);
+ }
+ break;
+ // --> OD 2008-06-05 #i89181#
+ case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set(IDocumentSettingAccess::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, bTmp);
+ }
+ break;
+ // <--
+ case HANDLE_MODIFYPASSWORDINFO:
+ {
+ uno::Sequence< beans::PropertyValue > aInfo;
+ if ( !( rValue >>= aInfo ) )
+ throw lang::IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Value of type Sequence<PropertyValue> expected!" ) ),
+ uno::Reference< uno::XInterface >(),
+ 2 );
+
+ if ( !mpDocSh->SetModifyPasswordInfo( aInfo ) )
+ throw beans::PropertyVetoException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The hash is not allowed to be changed now!" ) ),
+ uno::Reference< uno::XInterface >() );
+ }
+ break;
+ case HANDLE_MATH_BASELINE_ALIGNMENT:
+ {
+ sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
+ mpDoc->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT, bTmp );
+ }
+ break;
+ default:
+ throw UnknownPropertyException();
+ }
+}
+
+void SwXDocumentSettings::_postSetValues ()
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
+{
+ // set printer only once, namely here!
+ if( mpPrinter != NULL )
+ {
+ // #i86352# the printer is also used as container for options by sfx
+ // when setting a printer it should have decent default options
+ SfxItemSet aOptions( mpPrinter->GetOptions() );
+ SwPrintData aPrtData( mpDoc->getPrintData() );
+ SwAddPrinterItem aAddPrinterItem (FN_PARAM_ADDPRINTER, aPrtData);
+ aOptions.Put(aAddPrinterItem);
+ mpPrinter->SetOptions( aOptions );
+
+ mpDoc->setPrinter( mpPrinter, true, true );
+ }
+
+ mpPrinter = 0;
+ mpDocSh = 0;
+ mpDoc = 0;
+}
+
+void SwXDocumentSettings::_preGetValues ()
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
+{
+ mpDocSh = mpModel->GetDocShell();
+ mpDoc = mpDocSh->GetDoc();
+ if( NULL == mpDoc || NULL == mpDocSh )
+ throw UnknownPropertyException();
+}
+
+void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException )
+{
+ switch( rInfo.mnHandle )
+ {
+ case HANDLE_FORBIDDEN_CHARS:
+ {
+ Reference<XForbiddenCharacters> xRet(*mpModel->GetPropertyHelper(), UNO_QUERY);
+ rValue <<= xRet;
+ }
+ break;
+ case HANDLE_LINK_UPDATE_MODE:
+ {
+ rValue <<= static_cast < sal_Int16 > ( mpDoc->getLinkUpdateMode(true) );
+ }
+ break;
+ case HANDLE_FIELD_AUTO_UPDATE:
+ {
+ SwFldUpdateFlags nFlags = mpDoc->getFieldUpdateFlags(true);
+ BOOL bFieldUpd = (nFlags == AUTOUPD_FIELD_ONLY || nFlags == AUTOUPD_FIELD_AND_CHARTS );
+ rValue.setValue(&bFieldUpd, ::getBooleanCppuType());
+ }
+ break;
+ case HANDLE_CHART_AUTO_UPDATE:
+ {
+ SwFldUpdateFlags nFlags = mpDoc->getFieldUpdateFlags(true);
+ BOOL bChartUpd = nFlags == AUTOUPD_FIELD_AND_CHARTS;
+ rValue.setValue(&bChartUpd, ::getBooleanCppuType());
+ }
+ break;
+ case HANDLE_ADD_PARA_TABLE_SPACING:
+ {
+ sal_Bool bParaSpace = mpDoc->get(IDocumentSettingAccess::PARA_SPACE_MAX);
+ rValue.setValue(&bParaSpace, ::getBooleanCppuType());
+ }
+ break;
+ case HANDLE_ADD_PARA_TABLE_SPACING_AT_START:
+ {
+ sal_Bool bParaSpace = mpDoc->get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES);
+ rValue.setValue(&bParaSpace, ::getBooleanCppuType());
+ }
+ break;
+ case HANDLE_ALIGN_TAB_STOP_POSITION:
+ {
+ sal_Bool bAlignTab = mpDoc->get(IDocumentSettingAccess::TAB_COMPAT);
+ rValue.setValue(&bAlignTab, ::getBooleanCppuType());
+ }
+ break;
+ case HANDLE_PRINTER_NAME:
+ {
+ SfxPrinter *pPrinter = mpDoc->getPrinter( sal_False );
+ rValue <<= pPrinter ? OUString ( pPrinter->GetName()) : OUString();
+ }
+ break;
+ case HANDLE_PRINTER_SETUP:
+ {
+ SfxPrinter *pPrinter = mpDocSh->GetDoc()->getPrinter( sal_False );
+ if (pPrinter)
+ {
+ SvMemoryStream aStream;
+ pPrinter->Store( aStream );
+ aStream.Seek ( STREAM_SEEK_TO_END );
+ sal_uInt32 nSize = aStream.Tell();
+ aStream.Seek ( STREAM_SEEK_TO_BEGIN );
+ Sequence < sal_Int8 > aSequence( nSize );
+ aStream.Read ( aSequence.getArray(), nSize );
+ rValue <<= aSequence;
+ }
+ else
+ {
+ Sequence < sal_Int8 > aSequence ( 0 );
+ rValue <<= aSequence;
+ }
+ }
+ break;
+ case HANDLE_IS_KERN_ASIAN_PUNCTUATION:
+ {
+ //sal_Bool bParaSpace = mpDoc->IsKernAsianPunctuation();
+ sal_Bool bParaSpace = mpDoc->get(IDocumentSettingAccess::KERN_ASIAN_PUNCTUATION);
+ rValue.setValue(&bParaSpace, ::getBooleanCppuType());
+ }
+ break;
+ case HANDLE_APPLY_USER_DATA:
+ {
+ rValue <<= mpDocSh->IsUseUserData();
+ }
+ break;
+ case HANDLE_CHARACTER_COMPRESSION_TYPE:
+ {
+ rValue <<= static_cast < sal_Int16 > (mpDoc->getCharacterCompressionType());
+ }
+ break;
+ case HANDLE_SAVE_GLOBAL_DOCUMENT_LINKS:
+ {
+ sal_Bool bSaveGlobal = mpDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS);
+ rValue.setValue(&bSaveGlobal, ::getBooleanCppuType());
+ }
+ break;
+ case HANDLE_CURRENT_DATABASE_DATA_SOURCE:
+ {
+ const SwDBData& rData = mpDoc->GetDBDesc();
+ rValue <<= rData.sDataSource;
+ }
+ break;
+ case HANDLE_CURRENT_DATABASE_COMMAND:
+ {
+ const SwDBData& rData = mpDoc->GetDBDesc();
+ rValue <<= rData.sCommand;
+ }
+ break;
+ case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
+ {
+ const SwDBData& rData = mpDoc->GetDBDesc();
+ rValue <<= rData.nCommandType;
+ }
+ break;
+ case HANDLE_SAVE_VERSION_ON_CLOSE:
+ {
+ rValue <<= mpDocSh->IsSaveVersionOnClose();
+ }
+ break;
+ case HANDLE_UPDATE_FROM_TEMPLATE:
+ {
+ rValue <<= mpDocSh->IsQueryLoadTemplate();
+ }
+ break;
+ case HANDLE_PRINTER_INDEPENDENT_LAYOUT:
+ {
+ // returns short (see css.document.PrinterIndependentLayout)
+ sal_Int16 nVirDevType = mpDoc->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) ?
+ ( mpDoc->get(IDocumentSettingAccess::USE_HIRES_VIRTUAL_DEVICE) ?
+ document::PrinterIndependentLayout::HIGH_RESOLUTION :
+ document::PrinterIndependentLayout::LOW_RESOLUTION ) :
+ document::PrinterIndependentLayout::DISABLED;
+ rValue <<= nVirDevType;
+ }
+ break;
+ case HANDLE_IS_LABEL_DOC:
+ {
+ sal_Bool bLabel = mpDoc->get(IDocumentSettingAccess::LABEL_DOCUMENT);
+ rValue <<= bLabel;
+ }
+ break;
+ case HANDLE_IS_ADD_FLY_OFFSET:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::ADD_FLY_OFFSETS);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_IS_ADD_EXTERNAL_LEADING:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::ADD_EXT_LEADING);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_OLD_NUMBERING: // #111955#
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::OLD_NUMBERING);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_OUTLINELEVEL_YIELDS_NUMBERING: // #111955#
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_ALLOW_PRINTJOB_CANCEL:
+ {
+ sal_Bool bPrintCancelState = mpDocSh->Stamp_GetPrintCancelState();
+ rValue.setValue(&bPrintCancelState, ::getBooleanCppuType());
+ }
+ break;
+ case HANDLE_USE_FORMER_LINE_SPACING:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::OLD_LINE_SPACING);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_ADD_PARA_SPACING_TO_TABLE_CELLS:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_USE_FORMER_OBJECT_POSITIONING:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_USE_FORMER_TEXT_WRAPPING:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_CHANGES_PASSWORD:
+ {
+ rValue <<= mpDoc->GetRedlinePassword();
+ }
+ break;
+ case HANDLE_CONSIDER_WRAP_ON_OBJPOS:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_IGNORE_FIRST_LINE_INDENT_IN_NUMBERING:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_TABLE_ROW_KEEP :
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::TABLE_ROW_KEEP);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::IGNORE_TABS_AND_BLANKS_FOR_LINE_CALCULATION);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_LOAD_READONLY:
+ {
+ rValue <<= mpDocSh->IsLoadReadonly();
+ }
+ break;
+ case HANDLE_DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAMES:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::UNIX_FORCE_ZERO_EXT_LEADING);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_USE_OLD_PRINTER_METRICS:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::USE_OLD_PRINTER_METRICS);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_TABS_RELATIVE_TO_INDENT:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ case HANDLE_PROTECT_FORM:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::PROTECT_FORM);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ // --> OD 2008-06-05 #i89181#
+ case HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST:
+ {
+ sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST);
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+ // <--
+ case HANDLE_MODIFYPASSWORDINFO:
+ {
+ rValue <<= mpDocSh->GetModifyPasswordInfo();
+ }
+ break;
+ case HANDLE_MATH_BASELINE_ALIGNMENT:
+ {
+ sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT );
+ rValue.setValue( &bTmp, ::getBooleanCppuType() );
+ }
+ break;
+
+ default:
+ throw UnknownPropertyException();
+ }
+}
+
+void SwXDocumentSettings::_postGetValues ()
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException )
+{
+ mpDocSh = 0;
+ mpDoc = 0;
+}
+
+// XServiceInfo
+OUString SAL_CALL SwXDocumentSettings::getImplementationName( )
+ throw(RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.DocumentSettings"));
+}
+
+sal_Bool SAL_CALL SwXDocumentSettings::supportsService( const OUString& ServiceName )
+ throw(RuntimeException)
+{
+ const Sequence< OUString > aSeq( getSupportedServiceNames() );
+ sal_Int32 nCount = aSeq.getLength();
+ const OUString* pServices = aSeq.getConstArray();
+ while( nCount-- )
+ {
+ if( *pServices++ == ServiceName )
+ return sal_True;
+ }
+ return sal_True;
+}
+
+Sequence< OUString > SAL_CALL SwXDocumentSettings::getSupportedServiceNames( )
+ throw(RuntimeException)
+{
+ Sequence< OUString > aSeq( 4 );
+ aSeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings") );
+ aSeq[1] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.DocumentSettings") );
+ aSeq[2] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.PrintSettings") );
+ aSeq[3] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.PrintPreviewSettings") );
+ return aSeq;
+}
+
+
diff --git a/sw/source/ui/uno/SwXDocumentSettings.hxx b/sw/source/ui/uno/SwXDocumentSettings.hxx
new file mode 100644
index 000000000000..6ea168716e40
--- /dev/null
+++ b/sw/source/ui/uno/SwXDocumentSettings.hxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SW_XDOCUMENT_SETTINGS_HXX
+#define _SW_XDOCUMENT_SETTINGS_HXX
+
+#ifdef PRECOMPILED
+#include "ui_pch.hxx"
+#endif
+
+#ifndef _COMPHELPER_MASTERPROPERTYSET_HXX_
+#include <comphelper/MasterPropertySet.hxx>
+#endif
+#ifndef _COM_SUN_STAR_TEXT_XTEXTDOCUMENT_HPP
+#include <com/sun/star/text/XTextDocument.hpp>
+#endif
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase5.hxx>
+
+
+class SwXTextDocument;
+class SwDocShell;
+class SwDoc;
+class SfxPrinter;
+
+class SwXDocumentSettings :
+ public comphelper::MasterPropertySet,
+ public com::sun::star::lang::XServiceInfo,
+ public com::sun::star::lang::XTypeProvider,
+ public cppu::OWeakObject
+{
+protected:
+ com::sun::star::uno::Reference< com::sun::star::text::XTextDocument > mxModel;
+ SwXTextDocument* mpModel;
+ SwDocShell* mpDocSh;
+ SwDoc* mpDoc;
+
+ /** the printer should be set only once; since there are several
+ * printer-related properties, remember the last printer and set it in
+ * _postSetValues */
+ SfxPrinter* mpPrinter;
+
+ virtual void _preSetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _postSetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+
+ virtual void _preGetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _postGetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+protected:
+ virtual ~SwXDocumentSettings()
+ throw();
+public:
+ SwXDocumentSettings( SwXTextDocument* pModel );
+
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( )
+ throw ();
+ virtual void SAL_CALL release( )
+ throw ();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ throw(com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ throw(com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ throw(com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
+};
+#endif
diff --git a/sw/source/ui/uno/SwXFilterOptions.cxx b/sw/source/ui/uno/SwXFilterOptions.cxx
new file mode 100644
index 000000000000..015a75de2ab0
--- /dev/null
+++ b/sw/source/ui/uno/SwXFilterOptions.cxx
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include <SwXFilterOptions.hxx>
+#include <shellio.hxx>
+#include <swdll.hxx>
+#include <unoprnms.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/msgbox.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+#include <unotools/ucbstreamhelper.hxx>
+#include <unotxdoc.hxx>
+
+#include "swabstdlg.hxx"
+#include "dialog.hrc"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::ui::dialogs;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::lang;
+
+#define SWFILTEROPTIONSOBJ_SERVICE RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.FilterOptionsDialog")
+#define SWFILTEROPTIONSOBJ_IMPLNAME RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.FilterOptionsDialog")
+#define FILTER_OPTIONS_NAME RTL_CONSTASCII_USTRINGPARAM("FilterOptions")
+/*-- 2002/06/21 11:01:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFilterOptions::SwXFilterOptions() :
+ bExport( sal_False )
+{
+}
+/*-- 2002/06/21 11:01:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXFilterOptions::~SwXFilterOptions()
+{
+}
+/*-- 2002/06/21 11:01:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwXFilterOptions::getImplementationName_Static()
+{
+ return ::rtl::OUString(SWFILTEROPTIONSOBJ_IMPLNAME);
+}
+/*-- 2002/06/21 11:01:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< ::rtl::OUString> SwXFilterOptions::getSupportedServiceNames_Static()
+{
+ ::rtl::OUString sService(SWFILTEROPTIONSOBJ_SERVICE);
+ return uno::Sequence< ::rtl::OUString> (&sService, 1);
+}
+/*-- 2002/06/21 11:01:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyValue > SwXFilterOptions::getPropertyValues() throw (uno::RuntimeException)
+{
+ uno::Sequence<beans::PropertyValue> aRet(1);
+ beans::PropertyValue* pArray = aRet.getArray();
+
+ pArray[0].Name = rtl::OUString( FILTER_OPTIONS_NAME );
+ pArray[0].Value <<= sFilterOptions;
+
+ return aRet;
+}
+/*-- 2002/06/21 11:01:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFilterOptions::setPropertyValues( const uno::Sequence<beans::PropertyValue >& aProps )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, uno::RuntimeException)
+{
+ const beans::PropertyValue* pPropArray = aProps.getConstArray();
+ long nPropCount = aProps.getLength();
+ for (long i = 0; i < nPropCount; i++)
+ {
+ const beans::PropertyValue& rProp = pPropArray[i];
+ ::rtl::OUString aPropName = rProp.Name;
+
+ if ( aPropName.equalsAscii( SW_PROP_NAME_STR(UNO_NAME_FILTER_NAME) ) )
+ rProp.Value >>= sFilterName;
+ else if ( aPropName == ::rtl::OUString(FILTER_OPTIONS_NAME) )
+ rProp.Value >>= sFilterOptions;
+ else if ( aPropName.equalsAscii( "InputStream" ) )
+ rProp.Value >>= xInputStream;
+ }
+}
+/*-- 2002/06/21 11:01:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFilterOptions::setTitle( const ::rtl::OUString& /*rTitle*/ )
+ throw (uno::RuntimeException)
+{
+}
+/*-- 2002.06.21 11:01:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int16 SwXFilterOptions::execute() throw (uno::RuntimeException)
+{
+ sal_Int16 nRet = ui::dialogs::ExecutableDialogResults::CANCEL;
+
+ SvStream* pInStream = NULL;
+ if ( xInputStream.is() )
+ pInStream = utl::UcbStreamHelper::CreateStream( xInputStream );
+
+ uno::Reference< XUnoTunnel > xTunnel(xModel, uno::UNO_QUERY);
+ SwDocShell* pDocShell = 0;
+ if(xTunnel.is())
+ {
+ SwXTextDocument* pXDoc = reinterpret_cast< SwXTextDocument * >(
+ sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextDocument::getUnoTunnelId())));
+ pDocShell = pXDoc ? pXDoc->GetDocShell() : 0;
+ }
+ if(pDocShell)
+ {
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwAsciiFilterDlg* pAsciiDlg = pFact->CreateSwAsciiFilterDlg( NULL, *pDocShell,pInStream, DLG_ASCII_FILTER );
+ DBG_ASSERT(pAsciiDlg, "Dialogdiet fail!");
+ if(RET_OK == pAsciiDlg->Execute())
+ {
+ SwAsciiOptions aOptions;
+ pAsciiDlg->FillOptions( aOptions );
+ String sTmp;
+ aOptions.WriteUserData(sTmp);
+ sFilterOptions = sTmp;
+ nRet = ui::dialogs::ExecutableDialogResults::OK;
+ }
+ delete pAsciiDlg;
+ }
+
+ if( pInStream )
+ delete pInStream;
+
+ return nRet;
+}
+/*-- 2002/06/21 11:01:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFilterOptions::setTargetDocument( const uno::Reference< XComponent >& xDoc )
+ throw (IllegalArgumentException, uno::RuntimeException)
+{
+ bExport = sal_False;
+ xModel = xDoc;
+}
+/*-- 2002/06/21 11:01:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXFilterOptions::setSourceDocument( const uno::Reference<XComponent >& xDoc )
+ throw (IllegalArgumentException,uno::RuntimeException)
+{
+ bExport = sal_True;
+ xModel = xDoc;
+}
+/*-- 2002/06/21 11:01:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::rtl::OUString SwXFilterOptions::getImplementationName() throw(uno::RuntimeException)
+{
+ return ::rtl::OUString(SWFILTEROPTIONSOBJ_IMPLNAME);
+}
+/*-- 2002/06/21 11:01:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXFilterOptions::supportsService( const ::rtl::OUString& rServiceName )
+ throw(uno::RuntimeException)
+{
+ return rServiceName == ::rtl::OUString(SWFILTEROPTIONSOBJ_SERVICE);
+}
+/*-- 2002/06/21 11:01:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< ::rtl::OUString > SwXFilterOptions::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ return SwXFilterOptions::getSupportedServiceNames_Static();
+}
+
+
+uno::Reference<uno::XInterface> SAL_CALL SwXFilterOptions_createInstance(
+ const uno::Reference<lang::XMultiServiceFactory>& )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ SwDLL::Init();
+ return (::cppu::OWeakObject*) new SwXFilterOptions;
+}
+
diff --git a/sw/source/ui/uno/detreg.cxx b/sw/source/ui/uno/detreg.cxx
new file mode 100644
index 000000000000..65f4e6379a17
--- /dev/null
+++ b/sw/source/ui/uno/detreg.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include "swdetect.hxx"
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+extern "C" {
+
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char** ppEnvironmentTypeName,
+ uno_Environment** /*ppEnvironment*/ )
+{
+ *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ;
+}
+
+SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
+ const sal_Char* pImplementationName,
+ void* pServiceManager,
+ void* /*pRegistryKey*/ )
+{
+ // Set default return value for this operation - if it failed.
+ void* pReturn = NULL ;
+
+ if (
+ ( pImplementationName != NULL ) &&
+ ( pServiceManager != NULL )
+ )
+ {
+ // Define variables which are used in following macros.
+ Reference< XSingleServiceFactory > xFactory ;
+ Reference< XMultiServiceFactory > xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
+
+ if( SwFilterDetect::impl_getStaticImplementationName().equalsAscii( pImplementationName ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xServiceManager,
+ SwFilterDetect::impl_getStaticImplementationName(),
+ SwFilterDetect::impl_createInstance,
+ SwFilterDetect::impl_getStaticSupportedServiceNames() );
+ }
+
+ // Factory is valid - service was found.
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pReturn = xFactory.get();
+ }
+ }
+
+ // Return with result of this operation.
+ return pReturn ;
+}
+} // extern "C"
+
+
+
diff --git a/sw/source/ui/uno/dlelstnr.cxx b/sw/source/ui/uno/dlelstnr.cxx
new file mode 100644
index 000000000000..c163feda46b5
--- /dev/null
+++ b/sw/source/ui/uno/dlelstnr.cxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+
+#include <com/sun/star/linguistic2/DictionaryListEventFlags.hpp>
+#include <com/sun/star/linguistic2/XDictionaryList.hpp>
+#include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
+#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
+#include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
+#include <com/sun/star/linguistic2/LinguServiceEventFlags.hpp>
+
+#include <unotools/lingucfg.hxx>
+
+#include <com/sun/star/uno/Reference.h>
+#include <comphelper/processfactory.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <tools/shl.hxx>
+#include "dlelstnr.hxx"
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::linguistic2;
+using namespace ::com::sun::star::linguistic2::LinguServiceEventFlags;
+
+#define A2OU(x) OUString::createFromAscii(x)
+
+/* -----------------------------17.03.00 09:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwLinguServiceEventListener::SwLinguServiceEventListener()
+{
+ Reference< XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory() );
+ if (xMgr.is())
+ {
+ try
+ {
+ OUString aSvcName( A2OU( "com.sun.star.frame.Desktop" ) );
+ xDesktop = Reference< frame::XDesktop >(
+ xMgr->createInstance( aSvcName ), UNO_QUERY );
+ if (xDesktop.is())
+ xDesktop->addTerminateListener( this );
+
+ aSvcName = A2OU( "com.sun.star.linguistic2.LinguServiceManager" );
+ xLngSvcMgr = Reference< XLinguServiceManager >( xMgr->createInstance( aSvcName ), UNO_QUERY );
+ if (xLngSvcMgr.is())
+ xLngSvcMgr->addLinguServiceManagerListener( (XLinguServiceEventListener *) this );
+
+ if (SvtLinguConfig().HasGrammarChecker())
+ {
+ aSvcName = A2OU( "com.sun.star.linguistic2.ProofreadingIterator" );
+ xGCIterator = Reference< XProofreadingIterator >( xMgr->createInstance( aSvcName ), UNO_QUERY );
+ Reference< XLinguServiceEventBroadcaster > xBC( xGCIterator, UNO_QUERY );
+ if (xBC.is())
+ xBC->addLinguServiceEventListener( (XLinguServiceEventListener *) this );
+ }
+ }
+ catch (uno::Exception &)
+ {
+ DBG_ASSERT(0, "exception caught in SwLinguServiceEventListener c-tor" );
+ }
+ }
+}
+/* -----------------------------17.03.00 09:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwLinguServiceEventListener::~SwLinguServiceEventListener()
+{
+}
+
+/* -----------------------------17.03.00 09:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+void SwLinguServiceEventListener::processDictionaryListEvent(
+ const DictionaryListEvent& rDicListEvent)
+ throw( RuntimeException )
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ sal_Int16 nEvt = rDicListEvent.nCondensedEvent;
+
+ sal_Int16 nSpellWrongFlags =
+ DictionaryListEventFlags::ADD_POS_ENTRY |
+ DictionaryListEventFlags::DEL_NEG_ENTRY |
+ DictionaryListEventFlags::ACTIVATE_POS_DIC |
+ DictionaryListEventFlags::DEACTIVATE_NEG_DIC;
+ sal_Bool bIsSpellWrong = 0 != (nEvt & nSpellWrongFlags);
+ sal_Int16 nSpellAllFlags =
+ DictionaryListEventFlags::ADD_NEG_ENTRY |
+ DictionaryListEventFlags::DEL_POS_ENTRY |
+ DictionaryListEventFlags::ACTIVATE_NEG_DIC |
+ DictionaryListEventFlags::DEACTIVATE_POS_DIC;
+ sal_Bool bIsSpellAll = 0 != (nEvt & nSpellAllFlags);
+
+ if (bIsSpellWrong || bIsSpellAll)
+ SW_MOD()->CheckSpellChanges( sal_False, bIsSpellWrong, bIsSpellAll, sal_False );
+}
+
+
+void SAL_CALL SwLinguServiceEventListener::processLinguServiceEvent(
+ const LinguServiceEvent& rLngSvcEvent )
+ throw(RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ sal_Bool bIsSpellWrong = 0 != (rLngSvcEvent.nEvent & SPELL_WRONG_WORDS_AGAIN);
+ sal_Bool bIsSpellAll = 0 != (rLngSvcEvent.nEvent & SPELL_CORRECT_WORDS_AGAIN);
+ if (0 != (rLngSvcEvent.nEvent & PROOFREAD_AGAIN))
+ bIsSpellWrong = bIsSpellAll = sal_True; // have all spelling and grammar checked...
+ if (bIsSpellWrong || bIsSpellAll)
+ {
+ SW_MOD()->CheckSpellChanges( sal_False, bIsSpellWrong, bIsSpellAll, sal_False );
+ }
+ if (rLngSvcEvent.nEvent & HYPHENATE_AGAIN)
+ {
+ SwView *pSwView = SW_MOD()->GetFirstView();
+
+ //!! since this function may be called within the ctor of
+ //!! SwView (during formatting) where the WrtShell is not yet
+ //!! created, we have to check for the WrtShellPtr to see
+ //!! if it is already availbale
+ while (pSwView && pSwView->GetWrtShellPtr())
+ {
+ pSwView->GetWrtShell().ChgHyphenation();
+ pSwView = SW_MOD()->GetNextView( pSwView );
+ }
+ }
+}
+
+
+void SAL_CALL SwLinguServiceEventListener::disposing(
+ const EventObject& rEventObj )
+ throw(RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (xLngSvcMgr.is() && rEventObj.Source == xLngSvcMgr)
+ xLngSvcMgr = 0;
+ if (xLngSvcMgr.is() && rEventObj.Source == xGCIterator)
+ xGCIterator = 0;
+}
+
+
+void SAL_CALL SwLinguServiceEventListener::queryTermination(
+ const EventObject& /*rEventObj*/ )
+ throw(TerminationVetoException, RuntimeException)
+{
+ //vos::OGuard aGuard(Application::GetSolarMutex());
+}
+
+
+void SAL_CALL SwLinguServiceEventListener::notifyTermination(
+ const EventObject& rEventObj )
+ throw(RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if (xDesktop.is() && rEventObj.Source == xDesktop)
+ {
+ if (xLngSvcMgr.is())
+ xLngSvcMgr = 0;
+ if (xGCIterator.is())
+ xGCIterator = 0;
+ xDesktop = NULL;
+ }
+}
+
diff --git a/sw/source/ui/uno/swdet2.cxx b/sw/source/ui/uno/swdet2.cxx
new file mode 100644
index 000000000000..cf27027148a7
--- /dev/null
+++ b/sw/source/ui/uno/swdet2.cxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#define _SWLIB_CXX
+#include <sfx2/docfac.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/app.hxx>
+#include <svtools/sfxecode.hxx>
+#include <vcl/msgbox.hxx>
+#include <svtools/parhtml.hxx>
+#include <sot/clsids.hxx>
+#include <iodetect.hxx>
+
+#include <swdetect.hxx>
+
+#include <app.hrc>
+#include <web.hrc>
+#include <globdoc.hrc>
+
+#include <unotools/moduleoptions.hxx>
+
+#include <unomid.h>
+
+bool IsDocShellRegistered()
+{
+ return SvtModuleOptions().IsWriter();
+}
+
+//-------------------------------------------------------------------------
+
+ULONG SwFilterDetect::DetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter )
+{
+ ULONG nRet = ERRCODE_NONE;
+ if( *ppFilter )
+ {
+ // verify the given filter
+ String aPrefFlt = (*ppFilter)->GetUserData();
+
+ // detection for TextFilter needs an additional checking
+ BOOL bDetected = SwIoSystem::IsFileFilter( rMedium, aPrefFlt );
+ return bDetected ? nRet : ERRCODE_ABORT;
+ }
+
+ // mba: without preselection there is no PrefFlt
+ String aPrefFlt;
+ const SfxFilter* pTmp = SwIoSystem::GetFileFilter( rMedium.GetPhysicalName(), aPrefFlt, &rMedium );
+ if( !pTmp )
+ return ERRCODE_ABORT;
+ /*
+ else if( *ppFilter && (*ppFilter)->GetUserData().EqualsAscii( "W4W", 0, 3 )
+ && pTmp->GetUserData().EqualsAscii( FILTER_TEXT, 0, 4 ) )
+ {
+ // Bug 95262 - if the user (or short detect) select a
+ // Word 4 Word filter, but the autodect of mastersoft
+ // can't detect it, we normally return the ascii filter
+ // But the user may have a change to use the W4W filter,
+ // so the SFX must show now a dialog with the 2 filters
+ nRet = ERRCODE_SFX_CONSULTUSER;
+ *ppFilter = pTmp;
+ } */
+
+ // sollte der voreingestellte Filter ASCII sein und wir haben
+ // ASCII erkannt, dann ist das ein gultiger Filter, ansonsten ist das
+ // ein Fehler und wir wollen die Filterbox sehen
+ /*
+ else if( pTmp->GetUserData().EqualsAscii( FILTER_TEXT ) )
+ {
+ // Bug 28974: "Text" erkannt, aber "Text Dos" "Text ..." eingestellt
+ // -> keine FilterBox, sondern den eingestellten Filter benutzen
+ if( *ppFilter && (*ppFilter)->GetUserData().EqualsAscii( FILTER_TEXT, 0, 4 ) )
+ ;
+ else
+// if( !*ppFilter || COMPARE_EQUAL != pTmp->GetUserData().Compare((*ppFilter)->GetUserData(), 4 ))
+ {
+// nRet = ERRCODE_ABORT;
+ *ppFilter = pTmp;
+ }
+ } */
+ else
+ {
+ //Bug 41417: JP 09.07.97: HTML documents should be loaded by WebWriter
+ SfxFilterContainer aFilterContainer( String::CreateFromAscii("swriter/web") );
+ if( pTmp->GetUserData() != C2S(sHTML) ||
+ String::CreateFromAscii( "com.sun.star.text.WebDocument" ) ==
+ String( pTmp->GetServiceName() ) ||
+ 0 == ( (*ppFilter) = SwIoSystem::GetFilterOfFormat( C2S(sHTML),
+ &aFilterContainer ) ) )
+ *ppFilter = pTmp;
+ }
+
+ return nRet;
+}
+
diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx
new file mode 100644
index 000000000000..aa54b4707935
--- /dev/null
+++ b/sw/source/ui/uno/swdetect.cxx
@@ -0,0 +1,488 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include "swdetect.hxx"
+
+#include <framework/interaction.hxx>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#ifndef _UNOTOOLS_PROCESSFACTORY_HXX
+#include <comphelper/processfactory.hxx>
+#endif
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <com/sun/star/ucb/CommandAbortedException.hpp>
+#include <com/sun/star/ucb/InteractiveAppException.hpp>
+#include <com/sun/star/ucb/XContent.hpp>
+#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#ifndef _TOOLKIT_UNOHLP_HXX
+#include <toolkit/helper/vclunohelper.hxx>
+#endif
+#include <ucbhelper/simpleinteractionrequest.hxx>
+#include <rtl/ustring.h>
+#include <rtl/logfile.hxx>
+#include <svl/itemset.hxx>
+#include <vcl/window.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <tools/urlobj.hxx>
+#include <vos/mutex.hxx>
+#include <svtools/sfxecode.hxx>
+#include <svtools/ehdl.hxx>
+#include <sot/storinfo.hxx>
+#include <vcl/svapp.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/sfxsids.hrc>
+#include <sfx2/request.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/brokenpackageint.hxx>
+#include <svtools/FilterConfigItem.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <com/sun/star/util/XArchiver.hpp>
+#include <comphelper/ihwrapnofilter.hxx>
+
+#include <swdll.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::task;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ucb;
+using ::rtl::OUString;
+
+SwFilterDetect::SwFilterDetect( const REFERENCE < lang::XMultiServiceFactory >& /*xFactory*/ )
+{
+}
+
+SwFilterDetect::~SwFilterDetect()
+{
+}
+
+::rtl::OUString SAL_CALL SwFilterDetect::detect( uno::Sequence< beans::PropertyValue >& lDescriptor ) throw( uno::RuntimeException )
+{
+ REFERENCE< XInputStream > xStream;
+ REFERENCE< XContent > xContent;
+ REFERENCE< XInteractionHandler > xInteraction;
+ String aURL;
+ ::rtl::OUString sTemp;
+ String aTypeName; // a name describing the type (from MediaDescriptor, usually from flat detection)
+ String aPreselectedFilterName; // a name describing the filter to use (from MediaDescriptor, usually from UI action)
+
+ ::rtl::OUString aDocumentTitle; // interesting only if set in this method
+
+ // opening as template is done when a parameter tells to do so and a template filter can be detected
+ // (otherwise no valid filter would be found) or if the detected filter is a template filter and
+ // there is no parameter that forbids to open as template
+ sal_Bool bOpenAsTemplate = sal_False;
+ sal_Bool bWasReadOnly = sal_False, bReadOnly = sal_False;
+
+ sal_Bool bRepairPackage = sal_False;
+ sal_Bool bRepairAllowed = sal_False;
+
+ // now some parameters that can already be in the array, but may be overwritten or new inserted here
+ // remember their indices in the case new values must be added to the array
+ sal_Int32 nPropertyCount = lDescriptor.getLength();
+ sal_Int32 nIndexOfFilterName = -1;
+ sal_Int32 nIndexOfInputStream = -1;
+ sal_Int32 nIndexOfContent = -1;
+ sal_Int32 nIndexOfReadOnlyFlag = -1;
+ sal_Int32 nIndexOfTemplateFlag = -1;
+ sal_Int32 nIndexOfDocumentTitle = -1;
+ sal_Int32 nIndexOfInteractionHandler = -1;
+
+ for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
+ {
+ // extract properties
+ if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("URL")) )
+ {
+ lDescriptor[nProperty].Value >>= sTemp;
+ aURL = sTemp;
+ }
+ else if( !aURL.Len() && lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("FileName")) )
+ {
+ lDescriptor[nProperty].Value >>= sTemp;
+ aURL = sTemp;
+ }
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("TypeName")) )
+ {
+ lDescriptor[nProperty].Value >>= sTemp;
+ aTypeName = sTemp;
+ }
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName")) )
+ {
+ lDescriptor[nProperty].Value >>= sTemp;
+ aPreselectedFilterName = sTemp;
+
+ // if the preselected filter name is not correct, it must be erased after detection
+ // remember index of property to get access to it later
+ nIndexOfFilterName = nProperty;
+ }
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("InputStream")) )
+ nIndexOfInputStream = nProperty;
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")) )
+ nIndexOfReadOnlyFlag = nProperty;
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("UCBContent")) )
+ nIndexOfContent = nProperty;
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate")) )
+ {
+ lDescriptor[nProperty].Value >>= bOpenAsTemplate;
+ nIndexOfTemplateFlag = nProperty;
+ }
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")) )
+ {
+ lDescriptor[nProperty].Value >>= xInteraction;
+ nIndexOfInteractionHandler = nProperty;
+ }
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("RepairPackage")) )
+ lDescriptor[nProperty].Value >>= bRepairPackage;
+ else if( lDescriptor[nProperty].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentTitle")) )
+ nIndexOfDocumentTitle = nProperty;
+ }
+
+ // can't check the type for external filters, so set the "dont" flag accordingly
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ //SfxFilterFlags nMust = SFX_FILTER_IMPORT, nDont = SFX_FILTER_NOTINSTALLED;
+
+ SfxApplication* pApp = SFX_APP();
+ SfxAllItemSet *pSet = new SfxAllItemSet( pApp->GetPool() );
+ TransformParameters( SID_OPENDOC, lDescriptor, *pSet );
+ SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, SID_DOC_READONLY, FALSE );
+
+ bWasReadOnly = pItem && pItem->GetValue();
+
+ const SfxFilter* pFilter = 0;
+ String aPrefix = String::CreateFromAscii( "private:factory/" );
+ if( aURL.Match( aPrefix ) == aPrefix.Len() )
+ {
+ if( SvtModuleOptions().IsWriter() )
+ {
+ String aPattern( aPrefix );
+ aPattern += String::CreateFromAscii("swriter");
+ if ( aURL.Match( aPattern ) >= aPattern.Len() )
+ //pFilter = SfxFilter::GetDefaultFilterFromFactory( aURL );
+ return aTypeName;
+ }
+ }
+ else
+ {
+ // ctor of SfxMedium uses owner transition of ItemSet
+ SfxMedium aMedium( aURL, bWasReadOnly ? STREAM_STD_READ : STREAM_STD_READWRITE, FALSE, NULL, pSet );
+ aMedium.UseInteractionHandler( TRUE );
+ if ( aMedium.GetErrorCode() == ERRCODE_NONE )
+ {
+ // remember input stream and content and put them into the descriptor later
+ // should be done here since later the medium can switch to a version
+ xStream = aMedium.GetInputStream();
+ xContent = aMedium.GetContent();
+ bReadOnly = aMedium.IsReadOnly();
+
+ BOOL bIsStorage = aMedium.IsStorage();
+ if ( bIsStorage )
+ {
+ uno::Reference< embed::XStorage > xStorage = aMedium.GetStorage( sal_False );
+ if ( aMedium.GetLastStorageCreationState() != ERRCODE_NONE )
+ {
+ // error during storage creation means _here_ that the medium
+ // is broken, but we can not handle it in medium since impossibility
+ // to create a storage does not _always_ means that the medium is broken
+ aMedium.SetError( aMedium.GetLastStorageCreationState(), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ if ( xInteraction.is() )
+ {
+ OUString empty;
+ try
+ {
+ InteractiveAppException xException( empty,
+ REFERENCE< XInterface >(),
+ InteractionClassification_ERROR,
+ aMedium.GetError() );
+
+ REFERENCE< XInteractionRequest > xRequest(
+ new ucbhelper::SimpleInteractionRequest( makeAny( xException ),
+ ucbhelper::CONTINUATION_APPROVE ) );
+ xInteraction->handle( xRequest );
+ }
+ catch ( Exception & ) {};
+ }
+ }
+ else
+ {
+ DBG_ASSERT( xStorage.is(), "At this point storage must exist!" );
+
+ try
+ {
+ const SfxFilter* pPreFilter = aPreselectedFilterName.Len() ?
+ SfxFilterMatcher().GetFilter4FilterName( aPreselectedFilterName ) : aTypeName.Len() ?
+ SfxFilterMatcher(String::CreateFromAscii("swriter")).GetFilter4EA( aTypeName ) : 0;
+ if (!pPreFilter)
+ pPreFilter = SfxFilterMatcher(String::CreateFromAscii("sweb")).GetFilter4EA( aTypeName );
+ String aFilterName;
+ if ( pPreFilter )
+ {
+ aFilterName = pPreFilter->GetName();
+ aTypeName = pPreFilter->GetTypeName();
+ }
+
+ aTypeName = SfxFilter::GetTypeFromStorage( xStorage, pPreFilter ? pPreFilter->IsOwnTemplateFormat() : FALSE, &aFilterName );
+ }
+ catch( lang::WrappedTargetException& aWrap )
+ {
+ packages::zip::ZipIOException aZipException;
+
+ // repairing is done only if this type is requested from outside
+ // we don't do any type detection on broken packages (f.e. because it might be impossible), so any requested
+ // type will be accepted if the user allows to repair the file
+ if ( ( aWrap.TargetException >>= aZipException ) && ( aTypeName.Len() || aPreselectedFilterName.Len() ) )
+ {
+ if ( xInteraction.is() )
+ {
+ // the package is a broken one
+ aDocumentTitle = aMedium.GetURLObject().getName(
+ INetURLObject::LAST_SEGMENT,
+ true,
+ INetURLObject::DECODE_WITH_CHARSET );
+
+ if ( !bRepairPackage )
+ {
+ // ask the user whether he wants to try to repair
+ RequestPackageReparation aRequest( aDocumentTitle );
+ xInteraction->handle( aRequest.GetRequest() );
+ bRepairAllowed = aRequest.isApproved();
+ }
+
+ if ( !bRepairAllowed )
+ {
+ // repair either not allowed or not successful
+ // repair either not allowed or not successful
+ NotifyBrokenPackage aNotifyRequest( aDocumentTitle );
+ xInteraction->handle( aNotifyRequest.GetRequest() );
+
+ rtl::Reference< ::comphelper::OIHWrapNoFilterDialog > xHandler = new ::comphelper::OIHWrapNoFilterDialog( xInteraction );
+ if ( nIndexOfInteractionHandler != -1 )
+ lDescriptor[nIndexOfInteractionHandler].Value <<= uno::Reference< XInteractionHandler >( static_cast< task::XInteractionHandler* >( xHandler.get() ) );
+
+ aMedium.SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ }
+ }
+ else
+ // no interaction, error handling as usual
+ aMedium.SetError( ERRCODE_IO_BROKENPACKAGE, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+
+ if ( !bRepairAllowed )
+ {
+ aTypeName.Erase();
+ aPreselectedFilterName.Erase();
+ }
+ }
+ }
+ catch( uno::RuntimeException& )
+ {
+ throw;
+ }
+ catch( uno::Exception& )
+ {
+ aTypeName.Erase();
+ aPreselectedFilterName.Erase();
+ }
+ }
+ }
+ else
+ {
+ aMedium.GetInStream();
+ if ( aMedium.GetErrorCode() == ERRCODE_NONE )
+ {
+ if ( aPreselectedFilterName.Len() )
+ pFilter = SfxFilter::GetFilterByName( aPreselectedFilterName );
+ else
+ pFilter = SfxFilterMatcher().GetFilter4EA( aTypeName );
+
+ BOOL bTestWriter = !pFilter || pFilter->GetServiceName().EqualsAscii("com.sun.star.text.TextDocument") ||
+ pFilter->GetServiceName().EqualsAscii("com.sun.star.text.WebDocument");
+ BOOL bTestGlobal = !pFilter || pFilter->GetServiceName().EqualsAscii("com.sun.star.text.GlobalDocument");
+
+ const SfxFilter* pOrigFilter = NULL;
+ if ( !bTestWriter && !bTestGlobal && pFilter )
+ {
+ // cross filter; now this should be a type detection only, not a filter detection
+ // we can simulate it by preserving the preselected filter if the type matches
+ // example: HTML filter for Calc
+ pOrigFilter = pFilter;
+ pFilter = SfxFilterMatcher().GetFilter4EA( pFilter->GetTypeName() );
+ bTestWriter = TRUE;
+ }
+
+ ULONG nErr = ERRCODE_NONE;
+ if ( pFilter || bTestWriter )
+ nErr = DetectFilter( aMedium, &pFilter );
+ if ( nErr != ERRCODE_NONE )
+ pFilter = NULL;
+ else if ( pOrigFilter && pFilter && pFilter->GetTypeName() == pOrigFilter->GetTypeName() )
+ // cross filter, see above
+ pFilter = pOrigFilter;
+ }
+
+ if ( pFilter )
+ aTypeName = pFilter->GetTypeName();
+ else
+ aTypeName.Erase();
+ }
+ }
+ }
+
+ if ( nIndexOfInputStream == -1 && xStream.is() )
+ {
+ // if input stream wasn't part of the descriptor, now it should be, otherwise the content would be opend twice
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("InputStream");
+ lDescriptor[nPropertyCount].Value <<= xStream;
+ nPropertyCount++;
+ }
+
+ if ( nIndexOfContent == -1 && xContent.is() )
+ {
+ // if input stream wasn't part of the descriptor, now it should be, otherwise the content would be opend twice
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("UCBContent");
+ lDescriptor[nPropertyCount].Value <<= xContent;
+ nPropertyCount++;
+ }
+
+ if ( bReadOnly != bWasReadOnly )
+ {
+ if ( nIndexOfReadOnlyFlag == -1 )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("ReadOnly");
+ lDescriptor[nPropertyCount].Value <<= bReadOnly;
+ nPropertyCount++;
+ }
+ else
+ lDescriptor[nIndexOfReadOnlyFlag].Value <<= bReadOnly;
+ }
+
+ if ( !bRepairPackage && bRepairAllowed )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("RepairPackage");
+ lDescriptor[nPropertyCount].Value <<= bRepairAllowed;
+ nPropertyCount++;
+ bOpenAsTemplate = sal_True;
+ // TODO/LATER: set progress bar that should be used
+ }
+
+ if ( bOpenAsTemplate )
+ {
+ if ( nIndexOfTemplateFlag == -1 )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("AsTemplate");
+ lDescriptor[nPropertyCount].Value <<= bOpenAsTemplate;
+ nPropertyCount++;
+ }
+ else
+ lDescriptor[nIndexOfTemplateFlag].Value <<= bOpenAsTemplate;
+ }
+
+ if ( aDocumentTitle.getLength() )
+ {
+ // the title was set here
+ if ( nIndexOfDocumentTitle == -1 )
+ {
+ lDescriptor.realloc( nPropertyCount + 1 );
+ lDescriptor[nPropertyCount].Name = ::rtl::OUString::createFromAscii("DocumentTitle");
+ lDescriptor[nPropertyCount].Value <<= aDocumentTitle;
+ nPropertyCount++;
+ }
+ else
+ lDescriptor[nIndexOfDocumentTitle].Value <<= aDocumentTitle;
+ }
+
+
+ return aTypeName;
+}
+
+SFX_IMPL_SINGLEFACTORY( SwFilterDetect )
+
+/* XServiceInfo */
+UNOOUSTRING SAL_CALL SwFilterDetect::getImplementationName() throw( UNORUNTIMEEXCEPTION )
+{
+ return impl_getStaticImplementationName();
+}
+ \
+/* XServiceInfo */
+sal_Bool SAL_CALL SwFilterDetect::supportsService( const UNOOUSTRING& sServiceName ) throw( UNORUNTIMEEXCEPTION )
+{
+ UNOSEQUENCE< UNOOUSTRING > seqServiceNames = getSupportedServiceNames();
+ const UNOOUSTRING* pArray = seqServiceNames.getConstArray();
+ for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ )
+ {
+ if ( pArray[nCounter] == sServiceName )
+ {
+ return sal_True ;
+ }
+ }
+ return sal_False ;
+}
+
+/* XServiceInfo */
+UNOSEQUENCE< UNOOUSTRING > SAL_CALL SwFilterDetect::getSupportedServiceNames() throw( UNORUNTIMEEXCEPTION )
+{
+ return impl_getStaticSupportedServiceNames();
+}
+
+/* Helper for XServiceInfo */
+UNOSEQUENCE< UNOOUSTRING > SwFilterDetect::impl_getStaticSupportedServiceNames()
+{
+ UNOMUTEXGUARD aGuard( UNOMUTEX::getGlobalMutex() );
+ UNOSEQUENCE< UNOOUSTRING > seqServiceNames( 3 );
+ seqServiceNames.getArray() [0] = UNOOUSTRING::createFromAscii( "com.sun.star.frame.ExtendedTypeDetection" );
+ seqServiceNames.getArray() [1] = UNOOUSTRING::createFromAscii( "com.sun.star.text.FormatDetector" );
+ seqServiceNames.getArray() [2] = UNOOUSTRING::createFromAscii( "com.sun.star.text.W4WFormatDetector" );
+ return seqServiceNames ;
+}
+
+/* Helper for XServiceInfo */
+UNOOUSTRING SwFilterDetect::impl_getStaticImplementationName()
+{
+ return UNOOUSTRING::createFromAscii( "com.sun.star.comp.writer.FormatDetector" );
+}
+
+/* Helper for registry */
+UNOREFERENCE< UNOXINTERFACE > SAL_CALL SwFilterDetect::impl_createInstance( const UNOREFERENCE< UNOXMULTISERVICEFACTORY >& xServiceManager ) throw( UNOEXCEPTION )
+{
+ return UNOREFERENCE< UNOXINTERFACE >( *new SwFilterDetect( xServiceManager ) );
+}
+
diff --git a/sw/source/ui/uno/swdetect.hxx b/sw/source/ui/uno/swdetect.hxx
new file mode 100644
index 000000000000..d3c65df67ce5
--- /dev/null
+++ b/sw/source/ui/uno/swdetect.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SW_TYPEDETECT_HXX
+#define _SW_TYPEDETECT_HXX
+
+#include <rtl/ustring.hxx>
+#include <tools/debug.hxx>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <cppuhelper/implbase2.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <cppuhelper/factory.hxx>
+#include <tools/link.hxx>
+#include <tools/string.hxx>
+
+class SfxMedium;
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace uno
+ {
+ class Any;
+ }
+ namespace lang
+ {
+ class XMultiServiceFactory;
+ }
+ namespace frame
+ {
+ class XFrame;
+ }
+ namespace beans
+ {
+ struct PropertyValue;
+ }
+ }
+ }
+}
+
+#include <sfx2/sfxuno.hxx>
+class SfxMedium;
+class SfxFilter;
+
+#define REFERENCE ::com::sun::star::uno::Reference
+#define SEQUENCE ::com::sun::star::uno::Sequence
+#define RUNTIME_EXCEPTION ::com::sun::star::uno::RuntimeException
+
+class SwFilterDetect : public ::cppu::WeakImplHelper2< ::com::sun::star::document::XExtendedFilterDetection, ::com::sun::star::lang::XServiceInfo >
+{
+ static ULONG DetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter );
+ static ULONG GlobDetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter );
+public:
+ SwFilterDetect( const REFERENCE < ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ virtual ~SwFilterDetect();
+
+ SFX_DECL_XSERVICEINFO
+
+ //----------------------------------------------------------------------------------
+ // XExtendedFilterDetect
+ //----------------------------------------------------------------------------------
+ virtual ::rtl::OUString SAL_CALL detect( SEQUENCE< ::com::sun::star::beans::PropertyValue >& lDescriptor ) throw( RUNTIME_EXCEPTION );
+};
+
+#endif
diff --git a/sw/source/ui/uno/unoatxt.cxx b/sw/source/ui/uno/unoatxt.cxx
new file mode 100644
index 000000000000..4578ef27c2ea
--- /dev/null
+++ b/sw/source/ui/uno/unoatxt.cxx
@@ -0,0 +1,1308 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#define _SVSTDARR_STRINGS
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <vos/mutex.hxx>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+#include <svl/svstdarr.hxx>
+#include <svtools/unoevent.hxx>
+#include <svl/urihelper.hxx>
+#include <sfx2/event.hxx>
+#include <swtypes.hxx>
+#include <glosdoc.hxx>
+#include <shellio.hxx>
+#include <initui.hxx>
+#include <gloslst.hxx>
+#include <unoatxt.hxx>
+#include <unomap.hxx>
+#include <unomid.h>
+#include <unotextbodyhf.hxx>
+#include <unotextrange.hxx>
+#include <TextCursorHelper.hxx>
+#include <swevent.hxx>
+#include <doc.hxx>
+#include <unocrsr.hxx>
+#include <IMark.hxx>
+#include <unoprnms.hxx>
+#include <docsh.hxx>
+#include <swunodef.hxx>
+#include <swmodule.hxx>
+#include <svl/smplhint.hxx>
+#include <svl/macitem.hxx>
+
+#include <editeng/acorrcfg.hxx>
+
+#include <memory>
+
+
+SV_IMPL_REF ( SwDocShell )
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+/******************************************************************
+ *
+ ******************************************************************/
+/* -----------------30.03.99 14:31-------------------
+ *
+ * --------------------------------------------------*/
+uno::Reference< uno::XInterface > SAL_CALL SwXAutoTextContainer_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & ) throw( uno::Exception )
+{
+ //the module may not be loaded
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ SwDLL::Init();
+ static uno::Reference< uno::XInterface > xAText = (cppu::OWeakObject*)new SwXAutoTextContainer();;
+ return xAText;
+}
+/* -----------------------------17.04.01 13:17--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SAL_CALL SwXAutoTextContainer_getSupportedServiceNames() throw()
+{
+ OUString sService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.AutoTextContainer"));
+ const uno::Sequence< OUString > aSeq( &sService, 1 );
+ return aSeq;
+}
+/* -----------------------------17.04.01 13:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL SwXAutoTextContainer_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SwXAutoTextContainer" ) );
+}
+
+/*-- 21.12.98 12:42:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXAutoTextContainer::SwXAutoTextContainer()
+{
+ pGlossaries = ::GetGlossaries();
+
+}
+/*-- 21.12.98 12:42:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXAutoTextContainer::~SwXAutoTextContainer()
+{
+
+}
+/*-- 21.12.98 12:42:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXAutoTextContainer::getCount(void) throw( uno::RuntimeException )
+{
+ return pGlossaries->GetGroupCnt();
+}
+/*-- 21.12.98 12:42:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXAutoTextContainer::getByIndex(sal_Int32 nIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ sal_uInt16 nCount = pGlossaries->GetGroupCnt();
+ if ( 0 <= nIndex && nIndex < nCount )
+ aRet = getByName(pGlossaries->GetGroupName( static_cast< USHORT >(nIndex) ));
+ else
+ throw lang::IndexOutOfBoundsException();
+ return aRet;
+}
+/*-- 21.12.98 12:42:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXAutoTextContainer::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((const uno::Reference<text::XAutoTextGroup>*)0);
+
+}
+/*-- 21.12.98 12:42:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXAutoTextContainer::hasElements(void) throw( uno::RuntimeException )
+{
+ //zumindest Standard sollte es immer geben!
+ return sal_True;
+}
+/*-- 21.12.98 12:42:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXAutoTextContainer::getByName(const OUString& GroupName)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+
+ uno::Reference< text::XAutoTextGroup > xGroup;
+ if ( pGlossaries && hasByName( GroupName ) ) // group name already known?
+ // TRUE = create group if not already available
+ xGroup = pGlossaries->GetAutoTextGroup( GroupName, TRUE );
+
+ if ( !xGroup.is() )
+ throw container::NoSuchElementException();
+
+ return makeAny( xGroup );
+}
+/*-- 21.12.98 12:42:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXAutoTextContainer::getElementNames(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_uInt16 nCount = pGlossaries->GetGroupCnt();
+
+ uno::Sequence< OUString > aGroupNames(nCount);
+ OUString *pArr = aGroupNames.getArray();
+
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ // Die Namen werden ohne Pfad-Extension weitergegeben
+ String sGroupName(pGlossaries->GetGroupName(i));
+ pArr[i] = sGroupName.GetToken(0, GLOS_DELIM);
+ }
+ return aGroupNames;
+}
+/*-- 21.12.98 12:42:19---------------------------------------------------
+ findet Gruppennamen mit und ohne Pfadindex
+ -----------------------------------------------------------------------*/
+sal_Bool SwXAutoTextContainer::hasByName(const OUString& Name)
+ throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ String sGroupName( pGlossaries->GetCompleteGroupName( Name ) );
+ if(sGroupName.Len())
+ return sal_True;
+ return sal_False;
+}
+/*-- 21.12.98 12:42:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XAutoTextGroup > SwXAutoTextContainer::insertNewByName(
+ const OUString& aGroupName)
+ throw( lang::IllegalArgumentException, container::ElementExistException, uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(hasByName(aGroupName))
+ throw container::ElementExistException();
+ //check for non-ASCII characters
+ if(!aGroupName.getLength())
+ {
+ lang::IllegalArgumentException aIllegal;
+ aIllegal.Message = C2U("group name must not be empty");
+ throw aIllegal;
+ }
+ for(sal_Int32 nPos = 0; nPos < aGroupName.getLength(); nPos++)
+ {
+ sal_Unicode cChar = aGroupName[nPos];
+ if( ((cChar >= 'A') && (cChar <= 'Z')) ||
+ ((cChar >= 'a') && (cChar <= 'z')) ||
+ ((cChar >= '0') && (cChar <= '9')) ||
+ (cChar == '_') ||
+ (cChar == 0x20) ||
+ (cChar == GLOS_DELIM) )
+ {
+ continue;
+ }
+ lang::IllegalArgumentException aIllegal;
+ aIllegal.Message = C2U("group name must contain a-z, A-z, '_', ' ' only");
+ throw aIllegal;
+ }
+ String sGroup(aGroupName);
+ if(STRING_NOTFOUND == sGroup.Search(GLOS_DELIM))
+ {
+ sGroup += GLOS_DELIM;
+ sGroup += UniString::CreateFromInt32(0);
+ }
+ pGlossaries->NewGroupDoc(sGroup, sGroup.GetToken(0, GLOS_DELIM));
+
+ uno::Reference< text::XAutoTextGroup > xGroup = pGlossaries->GetAutoTextGroup( sGroup, true );
+ DBG_ASSERT( xGroup.is(), "SwXAutoTextContainer::insertNewByName: no UNO object created? How this?" );
+ // we just inserted the group into the glossaries, so why doesn't it exist?
+
+ return xGroup;
+}
+/*-- 21.12.98 12:42:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextContainer::removeByName(const OUString& aGroupName)
+ throw( container::NoSuchElementException, uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ //zunaechst den Namen mit Pfad-Extension finden
+ String sGroupName = pGlossaries->GetCompleteGroupName( aGroupName );
+ if(!sGroupName.Len())
+ throw container::NoSuchElementException();
+ pGlossaries->DelGroupDoc(sGroupName);
+}
+/* -----------------------------06.04.00 11:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXAutoTextContainer::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return SwXAutoTextContainer_getImplementationName();
+}
+/* -----------------------------06.04.00 11:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXAutoTextContainer::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ const uno::Sequence< OUString > aNames = SwXAutoTextContainer_getSupportedServiceNames();
+ for(sal_Int32 nService = 0; nService < aNames.getLength(); nService++)
+ {
+ if(aNames.getConstArray()[nService] == rServiceName)
+ return TRUE;
+ }
+ return FALSE;
+}
+/* -----------------------------06.04.00 11:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXAutoTextContainer::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ return SwXAutoTextContainer_getSupportedServiceNames();
+}
+/******************************************************************
+ *
+ ******************************************************************/
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXAutoTextGroup::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXAutoTextGroup::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ));
+ }
+ return 0;
+}
+
+/*-- 21.12.98 12:42:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXAutoTextGroup::SwXAutoTextGroup(const OUString& rName,
+ SwGlossaries* pGlos) :
+ pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_AUTO_TEXT_GROUP)),
+ pGlossaries(pGlos),
+ sName(rName),
+ m_sGroupName(rName)
+{
+ DBG_ASSERT( -1 != rName.indexOf( GLOS_DELIM ),
+ "SwXAutoTextGroup::SwXAutoTextGroup: to be constructed with a complete name only!" );
+}
+
+/*-- 21.12.98 12:42:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXAutoTextGroup::~SwXAutoTextGroup()
+{
+}
+/*-- 21.12.98 12:42:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+/*-- 21.12.98 12:42:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXAutoTextGroup::getTitles(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_uInt16 nCount = 0;
+ SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName, sal_False) : 0;
+ if(pGlosGroup && !pGlosGroup->GetError())
+ nCount = pGlosGroup->GetCount();
+ else
+ throw uno::RuntimeException();
+
+ uno::Sequence< OUString > aEntryTitles(nCount);
+ OUString *pArr = aEntryTitles.getArray();
+
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
+ pArr[i] = pGlosGroup->GetLongName(i);
+ delete pGlosGroup;
+ return aEntryTitles;
+}
+/*-- 21.12.98 12:42:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextGroup::renameByName(const OUString& aElementName,
+ const OUString& aNewElementName, const OUString& aNewElementTitle)
+ throw( lang::IllegalArgumentException, container::ElementExistException, io::IOException,
+ uno::RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ // throw exception only if the programmatic name is to be changed into an existing name
+ if(aNewElementName != aElementName && hasByName(aNewElementName))
+ throw container::ElementExistException();
+ SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName, sal_False) : 0;
+ if(pGlosGroup && !pGlosGroup->GetError())
+ {
+ sal_uInt16 nIdx = pGlosGroup->GetIndex( aElementName);
+ if(USHRT_MAX == nIdx)
+ throw lang::IllegalArgumentException();
+ String aNewShort( aNewElementName);
+ String aNewName( aNewElementTitle);
+ sal_uInt16 nOldLongIdx = pGlosGroup->GetLongIndex( aNewShort );
+ sal_uInt16 nOldIdx = pGlosGroup->GetIndex( aNewName );
+
+ if( nIdx != USHRT_MAX &&
+ (nOldLongIdx == USHRT_MAX || nOldLongIdx == nIdx )&&
+ (nOldIdx == USHRT_MAX || nOldIdx == nIdx ))
+ {
+ pGlosGroup->Rename( nIdx, &aNewShort, &aNewName );
+ if(pGlosGroup->GetError() != 0)
+ throw io::IOException();
+ }
+ delete pGlosGroup;
+ }
+ else
+ throw uno::RuntimeException();
+}
+
+sal_Bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTextRange* pxRange)
+{
+ ASSERT( pInsDoc, "kein Ins.Dokument" );
+
+ SwNodes& rNds = pInsDoc->GetNodes();
+
+ SwNodeIndex aIdx( rNds.GetEndOfContent(), -1 );
+ SwCntntNode * pNd = aIdx.GetNode().GetCntntNode();
+ SwPosition aPos( aIdx, SwIndex( pNd, pNd->Len() ));
+
+ bool bRet = false;
+ pInsDoc->LockExpFlds();
+ {
+ SwDoc *const pDoc((pxCursor) ? pxCursor->GetDoc() : pxRange->GetDoc());
+ SwPaM aPam(pDoc->GetNodes());
+ SwPaM * pPam(0);
+ if(pxCursor)
+ {
+ pPam = pxCursor->GetPaM();
+ }
+ else
+ {
+ if (pxRange->GetPositions(aPam))
+ {
+ pPam = & aPam;
+ }
+ }
+ if (!pPam) { return false; }
+ bRet = pDoc->CopyRange( *pPam, aPos, false ) || bRet;
+ }
+
+ pInsDoc->UnlockExpFlds();
+ if( !pInsDoc->IsExpFldsLocked() )
+ pInsDoc->UpdateExpFlds(NULL, true);
+
+ return bRet;
+}
+/*-- 21.12.98 12:42:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XAutoTextEntry > SwXAutoTextGroup::insertNewByName(const OUString& aName,
+ const OUString& aTitle, const uno::Reference< text::XTextRange > & xTextRange)
+ throw( container::ElementExistException, uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(hasByName(aName))
+ throw container::ElementExistException();
+ if(!xTextRange.is())
+ throw uno::RuntimeException();
+
+ SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName, sal_False) : 0;
+ String sShortName(aName);
+ String sLongName(aTitle);
+ if(pGlosGroup && !pGlosGroup->GetError())
+ {
+ /*if( pGlosGroup->IsOld() && pGlosGroup->ConvertToNew())
+ {
+ throw uno::RuntimeException();
+ } */
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pxRange = 0;
+ OTextCursorHelper* pxCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pxRange = reinterpret_cast<SwXTextRange*>(xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId()));
+ pxCursor = reinterpret_cast<OTextCursorHelper*>(xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId()));
+ }
+
+ String sOnlyTxt;
+ String* pOnlyTxt = 0;
+ sal_Bool bNoAttr = !pxCursor && !pxRange;
+ if(bNoAttr)
+ {
+ sOnlyTxt = UniString(xTextRange->getString());
+ pOnlyTxt = &sOnlyTxt;
+ }
+
+ const SvxAutoCorrCfg* pCfg = SvxAutoCorrCfg::Get();
+
+ SwDoc* pGDoc = pGlosGroup->GetDoc();
+
+ // Bis es eine Option dafuer gibt, base util::URL loeschen
+ if(pCfg->IsSaveRelFile())
+ {
+ INetURLObject aTemp(pGlosGroup->GetFileName());
+ pGlosGroup->SetBaseURL( aTemp.GetMainURL(INetURLObject::NO_DECODE));
+ }
+ else
+ pGlosGroup->SetBaseURL( aEmptyStr );
+
+ sal_uInt16 nRet;
+ if( pOnlyTxt )
+ nRet = pGlosGroup->PutText( sShortName, sLongName, *pOnlyTxt );
+ else
+ {
+ pGlosGroup->ClearDoc();
+ if( pGlosGroup->BeginPutDoc( sShortName, sLongName ) )
+ {
+ pGDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_DELETE_REDLINES );
+ lcl_CopySelToDoc( pGDoc, pxCursor, pxRange );
+ pGDoc->SetRedlineMode_intern((RedlineMode_t)( 0 ));
+ nRet = pGlosGroup->PutDoc();
+ }
+ else
+ nRet = (sal_uInt16) -1;
+ }
+
+ if(nRet == (sal_uInt16) -1 )
+ {
+ throw uno::RuntimeException();
+ }
+ pGlossaries->PutGroupDoc( pGlosGroup );
+ }
+
+ uno::Reference< text::XAutoTextEntry > xEntry = pGlossaries->GetAutoTextEntry( m_sGroupName, sName, sShortName, true );
+ DBG_ASSERT( xEntry.is(), "SwXAutoTextGroup::insertNewByName: no UNO object created? How this?" );
+ // we just inserted the entry into the group, so why doesn't it exist?
+
+ return xEntry;
+}
+/*-- 21.12.98 12:42:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextGroup::removeByName(const OUString& aEntryName) throw( container::NoSuchElementException, uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName, sal_False) : 0;
+ if(pGlosGroup && !pGlosGroup->GetError())
+ {
+ sal_uInt16 nIdx = pGlosGroup->GetIndex(aEntryName);
+ if ( nIdx != USHRT_MAX )
+ pGlosGroup->Delete(nIdx);
+ delete pGlosGroup;
+ }
+ else
+ throw container::NoSuchElementException();
+}
+/*-- 21.12.98 12:42:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXAutoTextGroup::getName(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ return sName;
+}
+/*-- 21.12.98 12:42:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextGroup::setName(const OUString& rName) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if( !pGlossaries )
+ throw uno::RuntimeException();
+
+ sal_Int32 nNewDelimPos = rName.lastIndexOf( GLOS_DELIM );
+ sal_Int32 nOldDelimPos = sName.lastIndexOf( GLOS_DELIM );
+
+ OUString aNewSuffix;
+ if (nNewDelimPos > -1)
+ aNewSuffix = rName.copy( nNewDelimPos + 1 );
+ OUString aOldSuffix;
+ if (nOldDelimPos > -1)
+ aOldSuffix = sName.copy( nOldDelimPos + 1 );
+
+ sal_Int32 nNewNumeric = aNewSuffix.toInt32();
+ sal_Int32 nOldNumeric = aOldSuffix.toInt32();
+
+ OUString aNewPrefix( (nNewDelimPos > 1) ? rName.copy( 0, nNewDelimPos ) : rName );
+ OUString aOldPrefix( (nOldDelimPos > 1) ? sName.copy( 0, nOldDelimPos ) : sName );
+
+ if ( sName == rName ||
+ ( nNewNumeric == nOldNumeric && aNewPrefix == aOldPrefix ) )
+ return;
+ String sNewGroup(rName);
+ if(STRING_NOTFOUND == sNewGroup.Search(GLOS_DELIM))
+ {
+ sNewGroup += GLOS_DELIM;
+ sNewGroup += UniString::CreateFromInt32(0);
+ }
+
+ //the name must be saved, the group may be invalidated while in RenameGroupDoc()
+ SwGlossaries* pTempGlossaries = pGlossaries;
+
+ String sPreserveTitle( pGlossaries->GetGroupTitle( sName ) );
+ if ( !pGlossaries->RenameGroupDoc( sName, sNewGroup, sPreserveTitle ) )
+ throw uno::RuntimeException();
+ else
+ {
+ sName = rName;
+ m_sGroupName = sNewGroup;
+ pGlossaries = pTempGlossaries;
+ }
+}
+/*-- 21.12.98 12:42:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXAutoTextGroup::getCount(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ int nCount = 0;
+ SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName, sal_False) : 0;
+ if(pGlosGroup && !pGlosGroup->GetError())
+ nCount = pGlosGroup->GetCount();
+ else
+ throw uno::RuntimeException();
+ delete pGlosGroup;
+ return nCount;
+}
+/*-- 21.12.98 12:42:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXAutoTextGroup::getByIndex(sal_Int32 nIndex)
+ throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Any aRet;
+ sal_uInt16 nCount = 0;
+ SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName, sal_False) : 0;
+ if(pGlosGroup && !pGlosGroup->GetError())
+ nCount = pGlosGroup->GetCount();
+ else
+ throw uno::RuntimeException();
+ if(0 <= nIndex && nIndex < nCount)
+ aRet = getByName(pGlosGroup->GetShortName((sal_uInt16) nIndex));
+ else
+ throw lang::IndexOutOfBoundsException();
+ delete pGlosGroup;
+ return aRet;
+}
+/*-- 21.12.98 12:42:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXAutoTextGroup::getElementType(void) throw( uno::RuntimeException )
+{
+ return ::getCppuType((uno::Reference<text::XAutoTextEntry>*)0);
+
+}
+/*-- 21.12.98 12:42:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXAutoTextGroup::hasElements(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName, sal_False) : 0;
+ sal_uInt16 nCount = 0;
+ if(pGlosGroup && !pGlosGroup->GetError())
+ nCount = pGlosGroup->GetCount();
+ else
+ throw uno::RuntimeException();
+ delete pGlosGroup;
+ return nCount > 0;
+
+}
+/*-- 21.12.98 12:42:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXAutoTextGroup::getByName(const OUString& _rName)
+ throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XAutoTextEntry > xEntry = pGlossaries->GetAutoTextEntry( m_sGroupName, sName, _rName, true );
+ DBG_ASSERT( xEntry.is(), "SwXAutoTextGroup::getByName: GetAutoTextEntry is fractious!" );
+ // we told it to create the object, so why didn't it?
+ return makeAny( xEntry );
+}
+/*-- 21.12.98 12:42:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXAutoTextGroup::getElementNames(void)
+ throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_uInt16 nCount = 0;
+ SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName, sal_False) : 0;
+ if(pGlosGroup && !pGlosGroup->GetError())
+ nCount = pGlosGroup->GetCount();
+ else
+ throw uno::RuntimeException();
+
+ uno::Sequence< OUString > aEntryNames(nCount);
+ OUString *pArr = aEntryNames.getArray();
+
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
+ pArr[i] = pGlosGroup->GetShortName(i);
+ delete pGlosGroup;
+ return aEntryNames;
+}
+/*-- 21.12.98 12:42:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXAutoTextGroup::hasByName(const OUString& rName)
+ throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ sal_uInt16 nCount = 0;
+ SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName, sal_False) : 0;
+ if(pGlosGroup && !pGlosGroup->GetError())
+ nCount = pGlosGroup->GetCount();
+ else
+ throw uno::RuntimeException();
+
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ String sCompare(pGlosGroup->GetShortName(i));
+ if(COMPARE_EQUAL == sCompare.CompareIgnoreCaseToAscii(String(rName)))
+ {
+ bRet = sal_True;
+ break;
+ }
+ }
+ delete pGlosGroup;
+ return bRet;
+}
+
+/*-- 09.02.00 15:33:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySetInfo > SwXAutoTextGroup::getPropertySetInfo(void)
+ throw( uno::RuntimeException )
+{
+ static uno::Reference< beans::XPropertySetInfo > xRet = pPropSet->getPropertySetInfo();
+ return xRet;
+}
+/*-- 09.02.00 15:33:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextGroup::setPropertyValue(
+ const OUString& rPropertyName, const uno::Any& aValue)
+ throw( beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName );
+
+ if(!pEntry)
+ throw beans::UnknownPropertyException();
+
+ SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName, sal_False) : 0;
+ if(!pGlosGroup || pGlosGroup->GetError())
+ throw uno::RuntimeException();
+ switch(pEntry->nWID)
+ {
+ case WID_GROUP_TITLE:
+ {
+ OUString sNewTitle;
+ aValue >>= sNewTitle;
+ if(!sNewTitle.getLength())
+ throw lang::IllegalArgumentException();
+ sal_Bool bChanged = !sNewTitle.equals(pGlosGroup->GetName());
+ pGlosGroup->SetName(sNewTitle);
+ if(bChanged && HasGlossaryList())
+ GetGlossaryList()->ClearGroups();
+ }
+ break;
+ }
+ delete pGlosGroup;
+}
+/*-- 09.02.00 15:33:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXAutoTextGroup::getPropertyValue(const OUString& rPropertyName)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName);
+
+ if(!pEntry)
+ throw beans::UnknownPropertyException();
+ SwTextBlocks* pGlosGroup = pGlossaries ? pGlossaries->GetGroupDoc(m_sGroupName, sal_False) : 0;
+ if(!pGlosGroup || pGlosGroup->GetError())
+ throw uno::RuntimeException();
+
+ uno::Any aAny;
+ switch(pEntry->nWID)
+ {
+ case WID_GROUP_PATH:
+ aAny <<= OUString(pGlosGroup->GetFileName());
+ break;
+ case WID_GROUP_TITLE:
+ aAny <<= OUString(pGlosGroup->GetName());
+ break;
+ }
+ delete pGlosGroup;
+ return aAny;
+}
+/*-- 09.02.00 15:33:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextGroup::addPropertyChangeListener(
+ const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+}
+/*-- 09.02.00 15:33:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextGroup::removePropertyChangeListener(
+ const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+}
+/*-- 09.02.00 15:33:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextGroup::addVetoableChangeListener(
+ const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+}
+/*-- 09.02.00 15:33:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextGroup::removeVetoableChangeListener(
+ const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
+ throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
+{
+}
+/*-- 21.12.98 12:42:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextGroup::Invalidate()
+{
+ pGlossaries = 0;
+ sName = aEmptyStr;
+ m_sGroupName = aEmptyStr;
+}
+/* -----------------------------06.04.00 11:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXAutoTextGroup::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXAutoTextGroup");
+}
+/* -----------------------------06.04.00 11:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXAutoTextGroup::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return C2U("com.sun.star.text.AutoTextGroup") == rServiceName;
+}
+/* -----------------------------06.04.00 11:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXAutoTextGroup::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.AutoTextGroup");
+ return aRet;
+}
+/******************************************************************
+ *
+ ******************************************************************/
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXAutoTextEntry::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXAutoTextEntry::getSomething( const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ));
+ }
+ return 0;
+}
+/*-- 21.12.98 12:42:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXAutoTextEntry::SwXAutoTextEntry(SwGlossaries* pGlss, const String& rGroupName,
+ const String& rEntryName) :
+ pGlossaries(pGlss),
+ sGroupName(rGroupName),
+ sEntryName(rEntryName),
+ pBodyText ( NULL )
+{
+}
+/*-- 21.12.98 12:42:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXAutoTextEntry::~SwXAutoTextEntry()
+{
+ {
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // ensure that any pending modifications are written
+ implFlushDocument( true );
+
+ //! Bug #96559
+ // DocShell must be cleared before mutex is lost.
+ // Needs to be done explicitly since xDocSh is a class member.
+ // Thus, an own block here, guarded by the SolarMutex
+ }
+}
+
+//---------------------------------------------------------------------
+//--- 03.03.2003 13:24:58 -----------------------------------------------
+
+void SwXAutoTextEntry::implFlushDocument( bool _bCloseDoc )
+{
+ if ( xDocSh.Is() )
+ {
+ if ( xDocSh->GetDoc()->IsModified () )
+ xDocSh->Save();
+
+ if ( _bCloseDoc )
+ {
+ // stop listening at the document
+ EndListening( *&xDocSh );
+
+ xDocSh->DoClose();
+ xDocSh.Clear();
+ }
+ }
+}
+
+//-----------------------------------------------------------------------
+//--- 03.03.2003 15:51:52 -----------------------------------------------
+
+void SwXAutoTextEntry::Notify( SfxBroadcaster& _rBC, const SfxHint& _rHint )
+{
+ if ( &_rBC == &xDocSh )
+ { // it's our document
+ if ( _rHint.ISA( SfxSimpleHint ) )
+ {
+ if ( SFX_HINT_DEINITIALIZING == static_cast< const SfxSimpleHint& >( _rHint ).GetId() )
+ {
+ // our document is dying (possibly because we're shuting down, and the document was notified
+ // earlier than we are?)
+ // stop listening at the docu
+ EndListening( *&xDocSh );
+ // and release our reference
+ xDocSh.Clear();
+ }
+ }
+ else if(_rHint.ISA(SfxEventHint))
+ {
+ if(SFX_EVENT_PREPARECLOSEDOC == static_cast< const SfxEventHint& >( _rHint ).GetEventId())
+ {
+ implFlushDocument( sal_False );
+ xBodyText = 0;
+ xDocSh.Clear();
+ }
+ }
+ }
+}
+
+void SwXAutoTextEntry::GetBodyText ()
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+
+ xDocSh = pGlossaries->EditGroupDoc ( sGroupName, sEntryName, FALSE );
+ DBG_ASSERT( xDocSh.Is(), "SwXAutoTextEntry::GetBodyText: unexpected: no doc returned by EditGroupDoc!" );
+
+ // start listening at the document
+ StartListening( *&xDocSh );
+
+ pBodyText = new SwXBodyText ( xDocSh->GetDoc() );
+ xBodyText = uno::Reference < lang::XServiceInfo > ( *pBodyText, uno::UNO_QUERY);
+}
+
+uno::Reference< text::XTextCursor > SwXAutoTextEntry::createTextCursor(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ EnsureBodyText();
+ return pBodyText->createTextCursor();
+}
+/*-- 21.12.98 12:42:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextCursor > SwXAutoTextEntry::createTextCursorByRange(
+ const uno::Reference< text::XTextRange > & aTextPosition) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ EnsureBodyText();
+ return pBodyText->createTextCursorByRange ( aTextPosition );
+}
+/*-- 21.12.98 12:42:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextEntry::insertString(const uno::Reference< text::XTextRange > & xRange, const OUString& aString, sal_Bool bAbsorb) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ EnsureBodyText();
+ pBodyText->insertString ( xRange, aString, bAbsorb );
+}
+/*-- 21.12.98 12:42:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextEntry::insertControlCharacter(const uno::Reference< text::XTextRange > & xRange,
+ sal_Int16 nControlCharacter, sal_Bool bAbsorb)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ EnsureBodyText();
+ pBodyText->insertControlCharacter ( xRange, nControlCharacter, bAbsorb );
+}
+/*-- 21.12.98 12:42:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextEntry::insertTextContent(
+ const uno::Reference< text::XTextRange > & xRange,
+ const uno::Reference< text::XTextContent > & xContent, sal_Bool bAbsorb)
+ throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ EnsureBodyText();
+ pBodyText->insertTextContent ( xRange, xContent, bAbsorb );
+}
+/*-- 21.12.98 12:42:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextEntry::removeTextContent(
+ const uno::Reference< text::XTextContent > & xContent)
+ throw( container::NoSuchElementException, uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ EnsureBodyText();
+ pBodyText->removeTextContent ( xContent );
+}
+/*-- 21.12.98 12:42:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XText > SwXAutoTextEntry::getText(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XText > xRet = (text::XText*)this;
+ return xRet;
+}
+/*-- 21.12.98 12:42:35---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXAutoTextEntry::getStart(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ EnsureBodyText();
+ return pBodyText->getStart();
+}
+/*-- 21.12.98 12:42:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXAutoTextEntry::getEnd(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ EnsureBodyText();
+ return pBodyText->getEnd();
+}
+/*-- 21.12.98 12:42:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXAutoTextEntry::getString(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ EnsureBodyText();
+ return pBodyText->getString();
+}
+/*-- 21.12.98 12:42:36---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXAutoTextEntry::setString(const OUString& aString) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ EnsureBodyText();
+ pBodyText->setString( aString );
+}
+/* -----------------15.07.99 10:11-------------------
+
+ --------------------------------------------------*/
+void SwXAutoTextEntry::applyTo(const uno::Reference< text::XTextRange > & xTextRange)throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // ensure that any pending modifications are written
+ // reason is that we're holding the _copy_ of the auto text, while the real auto text
+ // is stored somewhere. And below, we're not working with our copy, but only tell the target
+ // TextRange to work with the stored version.
+ // #96380# - 2003-03-03 - fs@openoffice.org
+ implFlushDocument( false );
+ // TODO: think about if we should pass "true" here
+ // The difference would be that when the next modification is made to this instance here, then
+ // we would be forced to open the document again, instead of working on our current copy.
+ // This means that we would reflect any changes which were done to the AutoText by foreign instances
+ // in the meantime
+
+ uno::Reference<lang::XUnoTunnel> xTunnel( xTextRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ OTextCursorHelper* pCursor = 0;
+ SwXText *pText = 0;
+
+ if(xTunnel.is())
+ {
+ pRange = reinterpret_cast < SwXTextRange* >
+ ( xTunnel->getSomething( SwXTextRange::getUnoTunnelId() ) );
+ pCursor = reinterpret_cast < OTextCursorHelper*>
+ ( xTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ) );
+ pText = reinterpret_cast < SwXText* >
+ ( xTunnel->getSomething( SwXText::getUnoTunnelId() ) );
+ }
+
+ SwDoc* pDoc = 0;
+ if (pRange)
+ pDoc = pRange->GetDoc();
+ else if ( pCursor )
+ pDoc = pCursor->GetDoc();
+ else if ( pText && pText->GetDoc() )
+ {
+ xTunnel = uno::Reference < lang::XUnoTunnel > (pText->getStart(), uno::UNO_QUERY);
+ if (xTunnel.is())
+ {
+ pCursor = reinterpret_cast < OTextCursorHelper* >
+ ( xTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() ) );
+ if (pCursor)
+ pDoc = pText->GetDoc();
+ }
+ }
+
+ if(!pDoc)
+ throw uno::RuntimeException();
+
+ SwPaM InsertPaM(pDoc->GetNodes());
+ if (pRange)
+ {
+ if (!pRange->GetPositions(InsertPaM))
+ {
+ throw uno::RuntimeException();
+ }
+ }
+ else
+ {
+ InsertPaM = *pCursor->GetPaM();
+ }
+
+ ::std::auto_ptr<SwTextBlocks> pBlock(pGlossaries->GetGroupDoc(sGroupName));
+ const bool bResult = pBlock.get() && !pBlock->GetError()
+ && pDoc->InsertGlossary( *pBlock, sEntryName, InsertPaM);
+
+ if(!bResult)
+ throw uno::RuntimeException();
+}
+/* -----------------------------06.04.00 11:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXAutoTextEntry::getImplementationName(void) throw( uno::RuntimeException )
+{
+ return C2U("SwXAutoTextEntry");
+}
+/* -----------------------------06.04.00 11:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXAutoTextEntry::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
+{
+ return C2U("com.sun.star.text.AutoTextEntry") == rServiceName;
+}
+/* -----------------------------06.04.00 11:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< OUString > SwXAutoTextEntry::getSupportedServiceNames(void) throw( uno::RuntimeException )
+{
+ uno::Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.AutoTextEntry");
+ return aRet;
+}
+/* -----------------------------06.04.00 11:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference< container::XNameReplace > SwXAutoTextEntry::getEvents()
+ throw( uno::RuntimeException )
+{
+ return new SwAutoTextEventDescriptor( *this );
+}
+/* -----------------------------30.01.01 18:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const struct SvEventDescription aAutotextEvents[] =
+{
+ { SW_EVENT_START_INS_GLOSSARY, "OnInsertStart" },
+ { SW_EVENT_END_INS_GLOSSARY, "OnInsertDone" },
+ { 0, NULL }
+};
+
+/* -----------------------------30.01.01 18:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwAutoTextEventDescriptor::SwAutoTextEventDescriptor(
+ SwXAutoTextEntry& rAutoText ) :
+ SvBaseEventDescriptor(aAutotextEvents),
+ sSwAutoTextEventDescriptor(RTL_CONSTASCII_USTRINGPARAM(
+ "SwAutoTextEventDescriptor")),
+ rAutoTextEntry(rAutoText)
+{
+}
+/* -----------------------------30.01.01 18:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwAutoTextEventDescriptor::~SwAutoTextEventDescriptor()
+{
+}
+/* -----------------------------30.01.01 18:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwAutoTextEventDescriptor::getImplementationName()
+ throw( uno::RuntimeException )
+{
+ return sSwAutoTextEventDescriptor;
+}
+/* -----------------------------30.01.01 18:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwAutoTextEventDescriptor::replaceByName(
+ const USHORT nEvent,
+ const SvxMacro& rMacro)
+ throw(
+ lang::IllegalArgumentException,
+ container::NoSuchElementException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ DBG_ASSERT( NULL != rAutoTextEntry.GetGlossaries(),
+ "Strangely enough, the AutoText vanished!" );
+ DBG_ASSERT( (nEvent == SW_EVENT_END_INS_GLOSSARY) ||
+ (nEvent == SW_EVENT_START_INS_GLOSSARY) ,
+ "Unknown event ID" );
+
+ const SwGlossaries* pGlossaries = rAutoTextEntry.GetGlossaries();
+ SwTextBlocks* pBlocks =
+ pGlossaries->GetGroupDoc( rAutoTextEntry.GetGroupName() );
+ DBG_ASSERT( NULL != pBlocks,
+ "can't get autotext group; SwAutoTextEntry has illegal name?");
+
+ if( pBlocks && !pBlocks->GetError())
+ {
+ USHORT nIndex = pBlocks->GetIndex( rAutoTextEntry.GetEntryName() );
+ if( nIndex != USHRT_MAX )
+ {
+ SvxMacroTableDtor aMacroTable;
+ if( pBlocks->GetMacroTable( nIndex, aMacroTable ) )
+ {
+ SvxMacro* pNewMacro = new SvxMacro(rMacro);
+ aMacroTable.Replace( nEvent, pNewMacro );
+ pBlocks->SetMacroTable( nIndex, aMacroTable );
+ }
+ }
+
+ delete pBlocks;
+ }
+ // else: ignore
+}
+/* -----------------------------30.01.01 18:40--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwAutoTextEventDescriptor::getByName(
+ SvxMacro& rMacro,
+ const USHORT nEvent )
+ throw(
+ container::NoSuchElementException,
+ lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ DBG_ASSERT( NULL != rAutoTextEntry.GetGlossaries(), "no AutoText" );
+ DBG_ASSERT( (nEvent == SW_EVENT_END_INS_GLOSSARY) ||
+ (nEvent == SW_EVENT_START_INS_GLOSSARY) ,
+ "Unknown event ID" );
+
+ const SwGlossaries* pGlossaries = rAutoTextEntry.GetGlossaries();
+ SwTextBlocks* pBlocks =
+ pGlossaries->GetGroupDoc( rAutoTextEntry.GetGroupName() );
+ DBG_ASSERT( NULL != pBlocks,
+ "can't get autotext group; SwAutoTextEntry has illegal name?");
+
+ // return empty macro, unless macro is found
+ OUString sEmptyStr;
+ SvxMacro aEmptyMacro(sEmptyStr, sEmptyStr);
+ rMacro = aEmptyMacro;
+
+ if ( pBlocks && !pBlocks->GetError())
+ {
+ USHORT nIndex = pBlocks->GetIndex( rAutoTextEntry.GetEntryName() );
+ if( nIndex != USHRT_MAX )
+ {
+ SvxMacroTableDtor aMacroTable;
+ if( pBlocks->GetMacroTable( nIndex, aMacroTable ) )
+ {
+ SvxMacro *pMacro = aMacroTable.Get( nEvent );
+ if( pMacro )
+ rMacro = *pMacro;
+ }
+ }
+
+ delete pBlocks;
+ }
+}
+
+
+
+
diff --git a/sw/source/ui/uno/unodefaults.cxx b/sw/source/ui/uno/unodefaults.cxx
new file mode 100644
index 000000000000..87104a4fd4cb
--- /dev/null
+++ b/sw/source/ui/uno/unodefaults.cxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <unodefaults.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/unoprov.hxx>
+#include <doc.hxx>
+
+/* -----------------------------13.03.01 14:16--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwSvxUnoDrawPool::SwSvxUnoDrawPool( SwDoc* pDoc ) throw() :
+ SvxUnoDrawPool(pDoc->GetDrawModel(), SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER),
+ m_pDoc(pDoc)
+{
+}
+/* -----------------------------13.03.01 14:16--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwSvxUnoDrawPool::~SwSvxUnoDrawPool() throw()
+{
+}
+/* -----------------------------13.03.01 14:16--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SfxItemPool* SwSvxUnoDrawPool::getModelPool( sal_Bool /*bReadOnly*/ ) throw()
+{
+ if(m_pDoc)
+ {
+
+ // DVO, OD 01.10.2003 #i18732# - return item pool of writer document;
+ // it contains draw model item pool as secondary pool.
+ //SdrModel* pModel = m_pDoc->MakeDrawModel();
+ //return &pModel->GetItemPool();
+ // --> OD 2005-08-08 #i52858# - method name changed
+ m_pDoc->GetOrCreateDrawModel();
+ // <--
+ return &(m_pDoc->GetAttrPool());
+ }
+ return 0;
+}
+
+
+
diff --git a/sw/source/ui/uno/unodefaults.hxx b/sw/source/ui/uno/unodefaults.hxx
new file mode 100644
index 000000000000..eda851f1c8b5
--- /dev/null
+++ b/sw/source/ui/uno/unodefaults.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNODEFAULTS_HXX
+#define _UNODEFAULTS_HXX
+
+#include <svx/unopool.hxx>
+
+class SwDoc;
+
+class SwSvxUnoDrawPool : public SvxUnoDrawPool
+{
+ SwDoc* m_pDoc;
+public:
+ SwSvxUnoDrawPool( SwDoc* pDoc ) throw();
+ virtual ~SwSvxUnoDrawPool() throw();
+
+ virtual SfxItemPool* getModelPool( sal_Bool bReadOnly ) throw();
+
+ void Invalidate() {m_pDoc = 0;}
+};
+
+#endif
+
+
diff --git a/sw/source/ui/uno/unodispatch.cxx b/sw/source/ui/uno/unodispatch.cxx
new file mode 100644
index 000000000000..7f0347ac8bf7
--- /dev/null
+++ b/sw/source/ui/uno/unodispatch.cxx
@@ -0,0 +1,448 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <vcl/svapp.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+
+#include <unodispatch.hxx>
+#include <unobaseclass.hxx>
+#include <view.hxx>
+#include <cmdid.h>
+#include "wrtsh.hxx"
+#include "dbmgr.hxx"
+
+
+using namespace ::com::sun::star;
+using namespace rtl;
+using namespace vos;
+
+const char* cURLStart = ".uno:DataSourceBrowser/";
+const char* cURLFormLetter = ".uno:DataSourceBrowser/FormLetter";
+const char* cURLInsertContent = ".uno:DataSourceBrowser/InsertContent";//data into fields
+const char* cURLInsertColumns = ".uno:DataSourceBrowser/InsertColumns";//data into text
+const char* cURLDocumentDataSource = ".uno:DataSourceBrowser/DocumentDataSource";//current data source of the document
+const sal_Char* cInternalDBChangeNotification = ".uno::Writer/DataSourceChanged";
+/*-- 07.11.00 13:25:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDispatchProviderInterceptor::SwXDispatchProviderInterceptor(SwView& rVw) :
+ m_pView(&rVw)
+{
+ uno::Reference< frame::XFrame> xUnoFrame = m_pView->GetViewFrame()->GetFrame().GetFrameInterface();
+ m_xIntercepted = uno::Reference< frame::XDispatchProviderInterception>(xUnoFrame, uno::UNO_QUERY);
+ if(m_xIntercepted.is())
+ {
+ m_refCount++;
+ m_xIntercepted->registerDispatchProviderInterceptor((frame::XDispatchProviderInterceptor*)this);
+ // this should make us the top-level dispatch-provider for the component, via a call to our
+ // setDispatchProvider we should have got an fallback for requests we (i.e. our master) cannot fullfill
+ uno::Reference< lang::XComponent> xInterceptedComponent(m_xIntercepted, uno::UNO_QUERY);
+ if (xInterceptedComponent.is())
+ xInterceptedComponent->addEventListener((lang::XEventListener*)this);
+ m_refCount--;
+ }
+}
+/*-- 07.11.00 13:25:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDispatchProviderInterceptor::~SwXDispatchProviderInterceptor()
+{
+}
+/*-- 07.11.00 13:25:51---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< frame::XDispatch > SwXDispatchProviderInterceptor::queryDispatch(
+ const util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags )
+ throw(uno::RuntimeException)
+{
+ DispatchMutexLock_Impl aLock(*this);
+ uno::Reference< frame::XDispatch> xResult;
+ // create some dispatch ...
+ if(m_pView && !aURL.Complete.compareToAscii(cURLStart, 23))
+ {
+ if(!aURL.Complete.compareToAscii(cURLFormLetter) ||
+ !aURL.Complete.compareToAscii(cURLInsertContent) ||
+ !aURL.Complete.compareToAscii(cURLInsertColumns)||
+ !aURL.Complete.compareToAscii(cURLDocumentDataSource))
+ {
+ if(!m_xDispatch.is())
+ m_xDispatch = new SwXDispatch(*m_pView);
+ xResult = m_xDispatch;
+ }
+ }
+
+ // ask our slave provider
+ if (!xResult.is() && m_xSlaveDispatcher.is())
+ xResult = m_xSlaveDispatcher->queryDispatch(aURL, aTargetFrameName, nSearchFlags);
+
+ return xResult;
+}
+/*-- 07.11.00 13:25:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Sequence< uno::Reference< frame::XDispatch > > SwXDispatchProviderInterceptor::queryDispatches(
+ const uno::Sequence< frame::DispatchDescriptor >& aDescripts ) throw(uno::RuntimeException)
+{
+ DispatchMutexLock_Impl aLock(*this);
+ uno::Sequence< uno::Reference< frame::XDispatch> > aReturn(aDescripts.getLength());
+ uno::Reference< frame::XDispatch>* pReturn = aReturn.getArray();
+ const frame::DispatchDescriptor* pDescripts = aDescripts.getConstArray();
+ for (sal_Int16 i=0; i<aDescripts.getLength(); ++i, ++pReturn, ++pDescripts)
+ {
+ *pReturn = queryDispatch(pDescripts->FeatureURL,
+ pDescripts->FrameName, pDescripts->SearchFlags);
+ }
+ return aReturn;
+}
+/*-- 07.11.00 13:25:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< frame::XDispatchProvider > SwXDispatchProviderInterceptor::getSlaveDispatchProvider( )
+ throw(uno::RuntimeException)
+{
+ DispatchMutexLock_Impl aLock(*this);
+ return m_xSlaveDispatcher;
+}
+/*-- 07.11.00 13:25:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDispatchProviderInterceptor::setSlaveDispatchProvider(
+ const uno::Reference< frame::XDispatchProvider >& xNewDispatchProvider ) throw(uno::RuntimeException)
+{
+ DispatchMutexLock_Impl aLock(*this);
+ m_xSlaveDispatcher = xNewDispatchProvider;
+}
+/*-- 07.11.00 13:25:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< frame::XDispatchProvider > SwXDispatchProviderInterceptor::getMasterDispatchProvider( )
+ throw(uno::RuntimeException)
+{
+ DispatchMutexLock_Impl aLock(*this);
+ return m_xMasterDispatcher;
+}
+/*-- 07.11.00 13:25:52---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDispatchProviderInterceptor::setMasterDispatchProvider(
+ const uno::Reference< frame::XDispatchProvider >& xNewSupplier ) throw(uno::RuntimeException)
+{
+ DispatchMutexLock_Impl aLock(*this);
+ m_xMasterDispatcher = xNewSupplier;
+}
+/*-- 07.11.00 13:25:53---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDispatchProviderInterceptor::disposing( const lang::EventObject& )
+ throw(uno::RuntimeException)
+{
+ DispatchMutexLock_Impl aLock(*this);
+ if (m_xIntercepted.is())
+ {
+ m_xIntercepted->releaseDispatchProviderInterceptor((frame::XDispatchProviderInterceptor*)this);
+ uno::Reference< lang::XComponent> xInterceptedComponent(m_xIntercepted, uno::UNO_QUERY);
+ if (xInterceptedComponent.is())
+ xInterceptedComponent->removeEventListener((lang::XEventListener*)this);
+ m_xDispatch = 0;
+ }
+ m_xIntercepted = NULL;
+}
+/* -----------------------------01.10.2001 14:31------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXDispatchProviderInterceptor::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------01.10.2001 14:31------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SwXDispatchProviderInterceptor::getSomething(
+ const uno::Sequence< sal_Int8 >& aIdentifier )
+ throw(uno::RuntimeException)
+{
+ if( aIdentifier.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ aIdentifier.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ));
+ }
+ return 0;
+}
+/* -----------------------------01.10.2001 14:32------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXDispatchProviderInterceptor::Invalidate()
+{
+ DispatchMutexLock_Impl aLock(*this);
+ if (m_xIntercepted.is())
+ {
+ m_xIntercepted->releaseDispatchProviderInterceptor((frame::XDispatchProviderInterceptor*)this);
+ uno::Reference< lang::XComponent> xInterceptedComponent(m_xIntercepted, uno::UNO_QUERY);
+ if (xInterceptedComponent.is())
+ xInterceptedComponent->removeEventListener((lang::XEventListener*)this);
+ m_xDispatch = 0;
+ }
+ m_xIntercepted = NULL;
+ m_pView = 0;
+}
+/* -----------------------------07.11.00 14:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXDispatch::SwXDispatch(SwView& rVw) :
+ m_pView(&rVw),
+ m_bOldEnable(sal_False),
+ m_bListenerAdded(sal_False)
+{
+}
+/*-- 07.11.00 14:26:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXDispatch::~SwXDispatch()
+{
+ if(m_bListenerAdded && m_pView)
+ {
+ uno::Reference<view::XSelectionSupplier> xSupplier = m_pView->GetUNOObject();
+ uno::Reference<view::XSelectionChangeListener> xThis = this;
+ xSupplier->removeSelectionChangeListener(xThis);
+ }
+}
+/*-- 07.11.00 14:26:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDispatch::dispatch(
+ const util::URL& aURL, const uno::Sequence< beans::PropertyValue >& aArgs ) throw(uno::RuntimeException)
+{
+ if(!m_pView)
+ throw uno::RuntimeException();
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ SwNewDBMgr* pNewDBMgr = rSh.GetNewDBMgr();
+ if(!aURL.Complete.compareToAscii(cURLInsertContent))
+ {
+ ::svx::ODataAccessDescriptor aDescriptor(aArgs);
+ SwMergeDescriptor aMergeDesc( DBMGR_MERGE, rSh, aDescriptor );
+ pNewDBMgr->MergeNew(aMergeDesc);
+ }
+ else if(!aURL.Complete.compareToAscii(cURLInsertColumns))
+ {
+ pNewDBMgr->InsertText(rSh, aArgs);
+ }
+ else if(!aURL.Complete.compareToAscii(cURLFormLetter))
+ {
+ SfxUsrAnyItem aDBProperties(FN_PARAM_DATABASE_PROPERTIES, uno::makeAny(aArgs));
+ m_pView->GetViewFrame()->GetDispatcher()->Execute(
+ FN_MAILMERGE_WIZARD,
+ SFX_CALLMODE_ASYNCHRON,
+ &aDBProperties, 0L);
+// pNewDBMgr->ExecuteFormLetter(rSh, aArgs);
+ }
+ else if(!aURL.Complete.compareToAscii(cURLDocumentDataSource))
+ {
+ OSL_ENSURE(sal_False, "SwXDispatch::dispatch: this URL is not to be dispatched!");
+ }
+ else if(!aURL.Complete.compareToAscii(cInternalDBChangeNotification))
+ {
+ frame::FeatureStateEvent aEvent;
+ aEvent.IsEnabled = sal_True;
+ aEvent.Source = *(cppu::OWeakObject*)this;
+
+ const SwDBData& rData = m_pView->GetWrtShell().GetDBDesc();
+ ::svx::ODataAccessDescriptor aDescriptor;
+ aDescriptor.setDataSource(rData.sDataSource);
+ aDescriptor[::svx::daCommand] <<= rData.sCommand;
+ aDescriptor[::svx::daCommandType] <<= rData.nCommandType;
+
+ aEvent.State <<= aDescriptor.createPropertyValueSequence();
+ aEvent.IsEnabled = rData.sDataSource.getLength() > 0;
+
+ StatusListenerList::iterator aListIter = m_aListenerList.begin();
+ for(aListIter = m_aListenerList.begin(); aListIter != m_aListenerList.end(); ++aListIter)
+ {
+ StatusStruct_Impl aStatus = *aListIter;
+ if(!aStatus.aURL.Complete.compareToAscii(cURLDocumentDataSource))
+ {
+ aEvent.FeatureURL = aStatus.aURL;
+ aStatus.xListener->statusChanged( aEvent );
+ }
+ }
+ }
+ else
+ throw uno::RuntimeException();
+
+}
+/*-- 07.11.00 14:26:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDispatch::addStatusListener(
+ const uno::Reference< frame::XStatusListener >& xControl, const util::URL& aURL ) throw(uno::RuntimeException)
+{
+ if(!m_pView)
+ throw uno::RuntimeException();
+ ShellModes eMode = m_pView->GetShellMode();
+ sal_Bool bEnable = SHELL_MODE_TEXT == eMode ||
+ SHELL_MODE_LIST_TEXT == eMode ||
+ SHELL_MODE_TABLE_TEXT == eMode ||
+ SHELL_MODE_TABLE_LIST_TEXT == eMode;
+
+ m_bOldEnable = bEnable;
+ frame::FeatureStateEvent aEvent;
+ aEvent.IsEnabled = bEnable;
+ aEvent.Source = *(cppu::OWeakObject*)this;
+ aEvent.FeatureURL = aURL;
+
+ // one of the URLs requires a special state ....
+ if (!aURL.Complete.compareToAscii(cURLDocumentDataSource))
+ {
+ const SwDBData& rData = m_pView->GetWrtShell().GetDBDesc();
+
+ ::svx::ODataAccessDescriptor aDescriptor;
+ aDescriptor.setDataSource(rData.sDataSource);
+ aDescriptor[::svx::daCommand] <<= rData.sCommand;
+ aDescriptor[::svx::daCommandType] <<= rData.nCommandType;
+
+ aEvent.State <<= aDescriptor.createPropertyValueSequence();
+ aEvent.IsEnabled = rData.sDataSource.getLength() > 0;
+ }
+
+
+ xControl->statusChanged( aEvent );
+
+ StatusListenerList::iterator aListIter = m_aListenerList.begin();
+ StatusStruct_Impl aStatus;
+ aStatus.xListener = xControl;
+ aStatus.aURL = aURL;
+ m_aListenerList.insert(aListIter, aStatus);
+
+ if(!m_bListenerAdded)
+ {
+ uno::Reference<view::XSelectionSupplier> xSupplier = m_pView->GetUNOObject();
+ uno::Reference<view::XSelectionChangeListener> xThis = this;
+ xSupplier->addSelectionChangeListener(xThis);
+ m_bListenerAdded = sal_True;
+ }
+}
+/*-- 07.11.00 14:26:15---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXDispatch::removeStatusListener(
+ const uno::Reference< frame::XStatusListener >& xControl, const util::URL& ) throw(uno::RuntimeException)
+{
+ StatusListenerList::iterator aListIter = m_aListenerList.begin();
+ for(aListIter = m_aListenerList.begin(); aListIter != m_aListenerList.end(); ++aListIter)
+ {
+ StatusStruct_Impl aStatus = *aListIter;
+ if(aStatus.xListener.get() == xControl.get())
+ {
+ m_aListenerList.erase(aListIter);
+ break;
+ }
+ }
+ if(m_aListenerList.empty() && m_pView)
+ {
+ uno::Reference<view::XSelectionSupplier> xSupplier = m_pView->GetUNOObject();
+ uno::Reference<view::XSelectionChangeListener> xThis = this;
+ xSupplier->removeSelectionChangeListener(xThis);
+ m_bListenerAdded = sal_False;
+ }
+}
+/* -----------------------------07.03.01 10:27--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXDispatch::selectionChanged( const lang::EventObject& ) throw(uno::RuntimeException)
+{
+ ShellModes eMode = m_pView->GetShellMode();
+ sal_Bool bEnable = SHELL_MODE_TEXT == eMode ||
+ SHELL_MODE_LIST_TEXT == eMode ||
+ SHELL_MODE_TABLE_TEXT == eMode ||
+ SHELL_MODE_TABLE_LIST_TEXT == eMode;
+ if(bEnable != m_bOldEnable)
+ {
+ m_bOldEnable = bEnable;
+ frame::FeatureStateEvent aEvent;
+ aEvent.IsEnabled = bEnable;
+ aEvent.Source = *(cppu::OWeakObject*)this;
+
+ StatusListenerList::iterator aListIter = m_aListenerList.begin();
+ for(aListIter = m_aListenerList.begin(); aListIter != m_aListenerList.end(); ++aListIter)
+ {
+ StatusStruct_Impl aStatus = *aListIter;
+ aEvent.FeatureURL = aStatus.aURL;
+ if (0 != aStatus.aURL.Complete.compareToAscii(cURLDocumentDataSource))
+ // the document's data source does not depend on the selection, so it's state does not change here
+ aStatus.xListener->statusChanged( aEvent );
+ }
+ }
+}
+/* -----------------------------07.03.01 10:46--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXDispatch::disposing( const lang::EventObject& rSource ) throw(uno::RuntimeException)
+{
+ uno::Reference<view::XSelectionSupplier> xSupplier(rSource.Source, uno::UNO_QUERY);
+ uno::Reference<view::XSelectionChangeListener> xThis = this;
+ xSupplier->removeSelectionChangeListener(xThis);
+ m_bListenerAdded = sal_False;
+
+ lang::EventObject aObject;
+ aObject.Source = (cppu::OWeakObject*)this;
+ StatusListenerList::iterator aListIter = m_aListenerList.begin();
+ for(; aListIter != m_aListenerList.end(); ++aListIter)
+ {
+ StatusStruct_Impl aStatus = *aListIter;
+ aStatus.xListener->disposing(aObject);
+ }
+ m_pView = 0;
+}
+/* -----------------------------12.07.01 13:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const sal_Char* SwXDispatch::GetDBChangeURL()
+{
+ return cInternalDBChangeNotification;
+}
+/* -----------------------------09.09.2002 08:48------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXDispatchProviderInterceptor::DispatchMutexLock_Impl::DispatchMutexLock_Impl(
+ SwXDispatchProviderInterceptor& ) :
+// aGuard(rInterceptor.m_aMutex) #102295# solar mutex has to be used currently
+ aGuard(Application::GetSolarMutex())
+{
+}
+/* -----------------------------09.09.2002 08:48------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXDispatchProviderInterceptor::DispatchMutexLock_Impl::~DispatchMutexLock_Impl()
+{
+}
+
diff --git a/sw/source/ui/uno/unodoc.cxx b/sw/source/ui/uno/unodoc.cxx
new file mode 100644
index 000000000000..3558b5391a06
--- /dev/null
+++ b/sw/source/ui/uno/unodoc.cxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+// System - Includes -----------------------------------------------------
+
+#include <tools/string.hxx>
+#include <sfx2/docfac.hxx>
+#include <sfx2/sfxmodelfactory.hxx>
+#include "swdll.hxx"
+#include "docsh.hxx"
+#include "globdoc.hxx"
+#include "wdocsh.hxx"
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+
+//============================================================
+// com.sun.star.comp.Writer.TextDocument
+
+uno::Sequence< ::rtl::OUString > SAL_CALL SwTextDocument_getSupportedServiceNames() throw()
+{
+ // return only top level services here! All others must be
+ // resolved by rtti!
+ uno::Sequence< ::rtl::OUString > aRet ( 1 );
+ ::rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.TextDocument" ) );
+
+ return aRet;
+}
+
+::rtl::OUString SAL_CALL SwTextDocument_getImplementationName() throw()
+{
+ return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.TextDocument" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SwTextDocument_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory >&, const sal_uInt64 _nCreationFlags )
+ throw( uno::Exception )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SwDLL::Init();
+ SfxObjectShell* pShell = new SwDocShell( _nCreationFlags );
+ return uno::Reference< uno::XInterface >( pShell->GetModel() );
+}
+
+//============================================================
+// com.sun.star.comp.Writer.WebDocument
+
+uno::Sequence< ::rtl::OUString > SAL_CALL SwWebDocument_getSupportedServiceNames() throw()
+{
+ // return only top level services here! All others must be
+ // resolved by rtti!
+ uno::Sequence< ::rtl::OUString > aRet ( 1 );
+ ::rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.WebDocument" ) );
+
+ return aRet;
+}
+
+::rtl::OUString SAL_CALL SwWebDocument_getImplementationName() throw()
+{
+ return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.WebDocument" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SwWebDocument_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & )
+ throw( uno::Exception )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SwDLL::Init();
+ SfxObjectShell* pShell = new SwWebDocShell( SFX_CREATE_MODE_STANDARD );
+ return uno::Reference< uno::XInterface >( pShell->GetModel() );
+}
+
+//============================================================
+// com.sun.star.comp.Writer.GlobalDocument
+
+uno::Sequence< ::rtl::OUString > SAL_CALL SwGlobalDocument_getSupportedServiceNames() throw()
+{
+ uno::Sequence< ::rtl::OUString > aRet ( 1 );
+ ::rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.GlobalDocument" ) );
+
+ return aRet;
+}
+
+::rtl::OUString SAL_CALL SwGlobalDocument_getImplementationName() throw()
+{
+ return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.GlobalDocument" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SwGlobalDocument_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > &)
+ throw( uno::Exception )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SwDLL::Init();
+ SfxObjectShell* pShell = new SwGlobalDocShell( SFX_CREATE_MODE_STANDARD );
+ return uno::Reference< uno::XInterface >( pShell->GetModel() );
+}
+
diff --git a/sw/source/ui/uno/unofreg.cxx b/sw/source/ui/uno/unofreg.cxx
new file mode 100644
index 000000000000..a76aaa3cd0e5
--- /dev/null
+++ b/sw/source/ui/uno/unofreg.cxx
@@ -0,0 +1,383 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#include "SwXFilterOptions.hxx"
+#include "sal/types.h"
+#include <osl/diagnose.h>
+#include <uno/lbnames.h>
+#include <cppuhelper/factory.hxx>
+#include <sfx2/sfxmodelfactory.hxx>
+#ifndef INCLUDED_STRING_H
+#include <string.h>
+#define INCLUDED_STRING_H
+#endif
+
+using namespace rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+
+// module
+extern uno::Sequence< OUString > SAL_CALL SwUnoModule_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwUnoModule_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwUnoModule_createInstance( const uno::Reference< XMultiServiceFactory > &rSMgr ) throw( uno::Exception );
+
+// writer documents
+extern uno::Sequence< OUString > SAL_CALL SwTextDocument_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwTextDocument_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwTextDocument_createInstance( const uno::Reference< XMultiServiceFactory > &rSMgr, const sal_uInt64 _nCreationFlags ) throw( uno::Exception );
+extern uno::Sequence< OUString > SAL_CALL SwWebDocument_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwWebDocument_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwWebDocument_createInstance( const uno::Reference< XMultiServiceFactory > &rSMgr ) throw( uno::Exception );
+extern uno::Sequence< OUString > SAL_CALL SwGlobalDocument_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwGlobalDocument_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwGlobalDocument_createInstance( const uno::Reference< XMultiServiceFactory > &rSMgr ) throw( uno::Exception );
+
+// xml import
+extern uno::Sequence< OUString > SAL_CALL SwXMLImport_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLImport_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLImport_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+extern uno::Sequence< OUString > SAL_CALL SwXMLImportStyles_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLImportStyles_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLImportStyles_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+extern uno::Sequence< OUString > SAL_CALL SwXMLImportContent_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLImportContent_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLImportContent_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
+extern uno::Sequence< OUString > SAL_CALL SwXMLImportMeta_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLImportMeta_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLImportMeta_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
+extern uno::Sequence< OUString > SAL_CALL SwXMLImportSettings_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLImportSettings_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLImportSettings_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
+// xml export (OOo)
+extern uno::Sequence< OUString > SAL_CALL SwXMLExportOOO_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLExportOOO_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportOOO_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+extern uno::Sequence< OUString > SAL_CALL SwXMLExportContentOOO_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLExportContentOOO_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportContentOOO_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+extern uno::Sequence< OUString > SAL_CALL SwXMLExportStylesOOO_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLExportStylesOOO_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportStylesOOO_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+extern uno::Sequence< OUString > SAL_CALL SwXMLExportMetaOOO_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLExportMetaOOO_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportMetaOOO_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+extern uno::Sequence< OUString > SAL_CALL SwXMLExportSettingsOOO_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLExportSettingsOOO_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportSettingsOOO_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
+// xml export (OASIS)
+extern uno::Sequence< OUString > SAL_CALL SwXMLExport_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLExport_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExport_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+extern uno::Sequence< OUString > SAL_CALL SwXMLExportContent_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLExportContent_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportContent_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+extern uno::Sequence< OUString > SAL_CALL SwXMLExportStyles_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLExportStyles_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportStyles_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+extern uno::Sequence< OUString > SAL_CALL SwXMLExportMeta_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLExportMeta_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportMeta_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+extern uno::Sequence< OUString > SAL_CALL SwXMLExportSettings_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMLExportSettings_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportSettings_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
+//API objects
+extern uno::Sequence< OUString > SAL_CALL SwXAutoTextContainer_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXAutoTextContainer_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXAutoTextContainer_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
+extern uno::Sequence< OUString > SAL_CALL SwXModule_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXModule_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXModule_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
+extern uno::Sequence< OUString > SAL_CALL SwXMailMerge_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMailMerge_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMailMerge_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
+extern uno::Sequence< OUString > SAL_CALL SwXMailMerge_getSupportedServiceNames() throw();
+extern OUString SAL_CALL SwXMailMerge_getImplementationName() throw();
+extern uno::Reference< uno::XInterface > SAL_CALL SwXMailMerge_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
+
+// --> OD 2007-05-24 #i73788#
+#include "cppuhelper/implementationentry.hxx"
+namespace comp_FinalThreadManager {
+
+// component and service helper functions:
+::rtl::OUString SAL_CALL _getImplementationName();
+com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames();
+com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL _create(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context );
+
+}
+// <--
+
+//
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName,
+ uno_Environment ** /*ppEnv*/ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+static ::cppu::ImplementationEntry const entries[] = {
+ { &comp_FinalThreadManager::_create,
+ &comp_FinalThreadManager::_getImplementationName,
+ &comp_FinalThreadManager::_getSupportedServiceNames,
+ &::cppu::createSingleComponentFactory, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName,
+ void * pServiceManager,
+ void * pRegistryKey )
+{
+ void * pRet = 0;
+ if( pServiceManager )
+ {
+ uno::Reference< XMultiServiceFactory > xMSF(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
+
+ uno::Reference< XSingleServiceFactory > xFactory;
+
+ const sal_Int32 nImplNameLen = strlen( pImplName );
+ if( SwXMLImport_getImplementationName().equalsAsciiL( pImplName,
+ nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLImport_getImplementationName(),
+ SwXMLImport_createInstance,
+ SwXMLImport_getSupportedServiceNames() );
+ }
+ else if( SwXMLImportStyles_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLImportStyles_getImplementationName(),
+ SwXMLImportStyles_createInstance,
+ SwXMLImportStyles_getSupportedServiceNames() );
+ }
+ else if( SwXMLImportContent_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLImportContent_getImplementationName(),
+ SwXMLImportContent_createInstance,
+ SwXMLImportContent_getSupportedServiceNames() );
+ }
+ else if( SwXMLImportMeta_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLImportMeta_getImplementationName(),
+ SwXMLImportMeta_createInstance,
+ SwXMLImportMeta_getSupportedServiceNames() );
+ }
+ else if( SwXMLImportSettings_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLImportSettings_getImplementationName(),
+ SwXMLImportSettings_createInstance,
+ SwXMLImportSettings_getSupportedServiceNames() );
+ }
+ else if( SwXMLExportOOO_getImplementationName().equalsAsciiL( pImplName,
+ nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLExportOOO_getImplementationName(),
+ SwXMLExportOOO_createInstance,
+ SwXMLExportOOO_getSupportedServiceNames() );
+ }
+ else if( SwXMLExportStylesOOO_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLExportStylesOOO_getImplementationName(),
+ SwXMLExportStylesOOO_createInstance,
+ SwXMLExportStylesOOO_getSupportedServiceNames() );
+ }
+ else if( SwXMLExportContentOOO_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLExportContentOOO_getImplementationName(),
+ SwXMLExportContentOOO_createInstance,
+ SwXMLExportContentOOO_getSupportedServiceNames() );
+ }
+ else if( SwXMLExportMetaOOO_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLExportMetaOOO_getImplementationName(),
+ SwXMLExportMetaOOO_createInstance,
+ SwXMLExportMetaOOO_getSupportedServiceNames() );
+ }
+ else if( SwXMLExportSettingsOOO_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLExportSettingsOOO_getImplementationName(),
+ SwXMLExportSettingsOOO_createInstance,
+ SwXMLExportSettingsOOO_getSupportedServiceNames() );
+ }
+ else if( SwXMLExport_getImplementationName().equalsAsciiL( pImplName,
+ nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLExport_getImplementationName(),
+ SwXMLExport_createInstance,
+ SwXMLExport_getSupportedServiceNames() );
+ }
+ else if( SwXMLExportStyles_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLExportStyles_getImplementationName(),
+ SwXMLExportStyles_createInstance,
+ SwXMLExportStyles_getSupportedServiceNames() );
+ }
+ else if( SwXMLExportContent_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLExportContent_getImplementationName(),
+ SwXMLExportContent_createInstance,
+ SwXMLExportContent_getSupportedServiceNames() );
+ }
+ else if( SwXMLExportMeta_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLExportMeta_getImplementationName(),
+ SwXMLExportMeta_createInstance,
+ SwXMLExportMeta_getSupportedServiceNames() );
+ }
+ else if( SwXMLExportSettings_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMLExportSettings_getImplementationName(),
+ SwXMLExportSettings_createInstance,
+ SwXMLExportSettings_getSupportedServiceNames() );
+ }
+ else if( SwXAutoTextContainer_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXAutoTextContainer_getImplementationName(),
+ SwXAutoTextContainer_createInstance,
+ SwXAutoTextContainer_getSupportedServiceNames() );
+ }
+ else if( SwXModule_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXModule_getImplementationName(),
+ SwXModule_createInstance,
+ SwXModule_getSupportedServiceNames() );
+ }
+ else if( SwXMailMerge_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXMailMerge_getImplementationName(),
+ SwXMailMerge_createInstance,
+ SwXMailMerge_getSupportedServiceNames() );
+ }
+ else if( SwXFilterOptions::getImplementationName_Static().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwXFilterOptions::getImplementationName_Static(),
+ SwXFilterOptions_createInstance,
+ SwXFilterOptions::getSupportedServiceNames_Static() );
+ }
+ else if( SwTextDocument_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::sfx2::createSfxModelFactory( xMSF,
+ SwTextDocument_getImplementationName(),
+ SwTextDocument_createInstance,
+ SwTextDocument_getSupportedServiceNames() );
+ }
+ else if( SwWebDocument_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwWebDocument_getImplementationName(),
+ SwWebDocument_createInstance,
+ SwWebDocument_getSupportedServiceNames() );
+ }
+ else if( SwGlobalDocument_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwGlobalDocument_getImplementationName(),
+ SwGlobalDocument_createInstance,
+ SwGlobalDocument_getSupportedServiceNames() );
+ }
+ else if( SwUnoModule_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ xFactory = ::cppu::createSingleFactory( xMSF,
+ SwUnoModule_getImplementationName(),
+ SwUnoModule_createInstance,
+ SwUnoModule_getSupportedServiceNames() );
+ }
+ // --> OD 2007-05-24 #i73788#
+ else if( comp_FinalThreadManager::_getImplementationName().equalsAsciiL(
+ pImplName, nImplNameLen ) )
+ {
+ pRet = ::cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey, entries);
+ }
+ // <--
+
+ if( xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+ return pRet;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/sw/source/ui/uno/unomailmerge.cxx b/sw/source/ui/uno/unomailmerge.cxx
new file mode 100644
index 000000000000..7a9cc3bceaee
--- /dev/null
+++ b/sw/source/ui/uno/unomailmerge.cxx
@@ -0,0 +1,1253 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
+#include <svl/itemprop.hxx>
+#include <svl/urihelper.hxx>
+#include <svx/dataaccessdescriptor.hxx>
+#include <tools/shl.hxx> // GetAppData
+#include <tools/tempfile.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <comphelper/processfactory.hxx>
+#include <vcl/timer.hxx>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/text/MailMergeType.hpp>
+#include <com/sun/star/text/MailMergeEvent.hpp>
+#include <com/sun/star/text/XMailMergeListener.hpp>
+#include <com/sun/star/text/XMailMergeBroadcaster.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/sdbc/XResultSet.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+#ifndef _COM_SUN_STAR_UTIL_CloseVetoException_HPP_
+#include <com/sun/star/util/CloseVetoException.hpp>
+#endif
+#include <com/sun/star/sdbcx/XRowLocate.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include "com/sun/star/mail/XSmtpService.hpp"
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/event.hxx>
+#include <swevent.hxx>
+#include <unomailmerge.hxx>
+#include <swdll.hxx>
+#include <swmodule.hxx>
+#include <unoprnms.hxx>
+#include <unomap.hxx>
+#include <swunohelper.hxx>
+#include <docsh.hxx>
+#ifndef IDOCUMENTDEVICEACCESS_HXX_INCLUDED
+#include <IDocumentDeviceAccess.hxx>
+#endif
+#include <view.hxx>
+#include <dbmgr.hxx>
+#include <unotxdoc.hxx>
+#include <prtopt.hxx>
+#include <wrtsh.hxx>
+#include <shellio.hxx>
+#include <mmconfigitem.hxx>
+#include <mailmergehelper.hxx>
+#include <memory>
+
+#include <unomid.h>
+
+
+#define SN_MAIL_MERGE "com.sun.star.text.MailMerge"
+#define SN_DATA_ACCESS_DESCRIPTOR "com.sun.star.sdb.DataAccessDescriptor"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using ::rtl::OUString;
+using namespace SWUnoHelper;
+
+////////////////////////////////////////////////////////////
+
+typedef ::utl::SharedUNOComponent< XInterface > SharedComponent;
+
+////////////////////////////////////////////////////////////
+
+osl::Mutex & GetMailMergeMutex()
+{
+ static osl::Mutex aMutex;
+ return aMutex;
+}
+
+////////////////////////////////////////////////////////////
+
+enum CloseResult
+{
+ eSuccess, // successfully closed
+ eVetoed, // vetoed, ownership transfered to the vetoing instance
+ eFailed // failed for some unknown reason
+};
+static CloseResult CloseModelAndDocSh(
+ Reference< frame::XModel > &rxModel,
+ SfxObjectShellRef &rxDocSh )
+{
+ CloseResult eResult = eSuccess;
+
+ rxDocSh = 0;
+
+ //! models/documents should never be disposed (they may still be
+ //! used for printing which is called asynchronously for example)
+ //! instead call close
+ Reference< util::XCloseable > xClose( rxModel, UNO_QUERY );
+ if (xClose.is())
+ {
+ try
+ {
+ //! 'sal_True' -> transfer ownership to vetoing object if vetoed!
+ //! I.e. now that object is responsible for closing the model and doc shell.
+ xClose->close( sal_True );
+ }
+ catch (util::CloseVetoException &)
+ {
+ //! here we have the problem that the temporary file that is
+ //! currently being printed will never be deleted. :-(
+ eResult = eVetoed;
+ }
+ catch ( const uno::RuntimeException& )
+ {
+ eResult = eFailed;
+ }
+ }
+ return eResult;
+}
+
+////////////////////////////////////////////////////////////
+
+static BOOL LoadFromURL_impl(
+ Reference< frame::XModel > &rxModel,
+ SfxObjectShellRef &rxDocSh,
+ const String &rURL,
+ BOOL bClose )
+ throw (RuntimeException)
+{
+ // try to open the document readonly and hidden
+ Reference< frame::XModel > xTmpModel;
+ Sequence < PropertyValue > aArgs( 1 );
+ aArgs[0].Name = C2U("Hidden");
+ sal_Bool bVal = sal_True;
+ aArgs[0].Value <<= bVal;
+ try
+ {
+ Reference < XComponentLoader > xDesktop( ::comphelper::getProcessServiceFactory()->
+ createInstance( C2U("com.sun.star.frame.Desktop") ), UNO_QUERY );
+ xTmpModel = Reference < XModel >( xDesktop->loadComponentFromURL(
+ rURL, C2U("_blank"), 0, aArgs ), UNO_QUERY );
+ }
+ catch( Exception & )
+ {
+ return FALSE;
+ }
+
+ // try to get the DocShell
+ SwDocShell *pTmpDocShell = 0;
+ Reference < XUnoTunnel > xTunnel( xTmpModel, UNO_QUERY );
+ if (xTunnel.is())
+ {
+ SwXTextDocument* pTextDoc = reinterpret_cast<SwXTextDocument *>(
+ xTunnel->getSomething( SwXTextDocument::getUnoTunnelId() ));
+ pTmpDocShell = pTextDoc ? pTextDoc->GetDocShell() : 0;
+ }
+
+ BOOL bRes = FALSE;
+ if (xTmpModel.is() && pTmpDocShell) // everything available?
+ {
+ if (bClose)
+ CloseModelAndDocSh( rxModel, rxDocSh );
+ // set new stuff
+ rxModel = xTmpModel;
+ rxDocSh = pTmpDocShell;
+ bRes = TRUE;
+ }
+ else
+ {
+ // SfxObjectShellRef is ok here, since the document will be explicitly closed
+ SfxObjectShellRef xTmpDocSh = pTmpDocShell;
+ CloseModelAndDocSh( xTmpModel, xTmpDocSh );
+ }
+
+ return bRes;
+}
+
+//==========================================================
+namespace
+{
+ class DelayedFileDeletion : public ::cppu::WeakImplHelper1< util::XCloseListener >
+ {
+ protected:
+ ::osl::Mutex m_aMutex;
+ Reference< util::XCloseable > m_xDocument;
+ Timer m_aDeleteTimer;
+ String m_sTemporaryFile;
+ sal_Int32 m_nPendingDeleteAttempts;
+
+ public:
+ DelayedFileDeletion( const Reference< XModel >& _rxModel,
+ const String& _rTemporaryFile );
+
+ protected:
+ ~DelayedFileDeletion( );
+
+ // XCloseListener
+ virtual void SAL_CALL queryClosing( const EventObject& _rSource, sal_Bool _bGetsOwnership ) throw (util::CloseVetoException, RuntimeException);
+ virtual void SAL_CALL notifyClosing( const EventObject& _rSource ) throw (RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const EventObject& Source ) throw (RuntimeException);
+
+ private:
+ void implTakeOwnership( );
+ DECL_LINK( OnTryDeleteFile, void* );
+
+ private:
+ DelayedFileDeletion( const DelayedFileDeletion& ); // never implemented
+ DelayedFileDeletion& operator=( const DelayedFileDeletion& ); // never implemented
+ };
+
+ DBG_NAME( DelayedFileDeletion )
+ //------------------------------------------------------
+ DelayedFileDeletion::DelayedFileDeletion( const Reference< XModel >& _rxModel, const String& _rTemporaryFile )
+ :
+ m_xDocument( _rxModel, UNO_QUERY )
+ ,m_sTemporaryFile( _rTemporaryFile )
+ ,m_nPendingDeleteAttempts( 0 )
+ {
+ DBG_CTOR( DelayedFileDeletion, NULL );
+
+ osl_incrementInterlockedCount( &m_refCount );
+ try
+ {
+ if ( m_xDocument.is() )
+ {
+ m_xDocument->addCloseListener( this );
+ // successfully added -> keep ourself alive
+ acquire();
+ }
+ else {
+ DBG_ERROR( "DelayedFileDeletion::DelayedFileDeletion: model is no component!" );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "DelayedFileDeletion::DelayedFileDeletion: could not register as event listener at the model!" );
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+
+ //--------------------------------------------------------------------
+ IMPL_LINK( DelayedFileDeletion, OnTryDeleteFile, void*, EMPTYARG )
+ {
+ ::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ sal_Bool bSuccess = sal_False;
+ try
+ {
+ sal_Bool bDeliverOwnership = ( 0 == m_nPendingDeleteAttempts );
+ // if this is our last attemt, then anybody which vetoes this has to take the consequences
+ // (means take the ownership)
+ m_xDocument->close( bDeliverOwnership );
+ bSuccess = sal_True;
+ }
+ catch( const util::CloseVetoException& )
+ {
+ // somebody vetoed -> next try
+ if ( m_nPendingDeleteAttempts )
+ {
+ // next attempt
+ --m_nPendingDeleteAttempts;
+ m_aDeleteTimer.Start();
+ }
+ else
+ bSuccess = sal_True; // can't do anything here ...
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "DelayedFileDeletion::OnTryDeleteFile: caught a strange exception!" );
+ bSuccess = sal_True;
+ // can't do anything here ...
+ }
+
+ if ( bSuccess )
+ {
+ SWUnoHelper::UCB_DeleteFile( m_sTemporaryFile );
+ aGuard.clear();
+ release(); // this should be our last reference, we should be dead after this
+ }
+ return 0L;
+ }
+
+ //--------------------------------------------------------------------
+ void DelayedFileDeletion::implTakeOwnership( )
+ {
+ // revoke ourself as listener
+ try
+ {
+ m_xDocument->removeCloseListener( this );
+ }
+ catch( const Exception & )
+ {
+ DBG_ERROR( "DelayedFileDeletion::implTakeOwnership: could not revoke the listener!" );
+ }
+
+ m_aDeleteTimer.SetTimeout( 3000 ); // 3 seconds
+ m_aDeleteTimer.SetTimeoutHdl( LINK( this, DelayedFileDeletion, OnTryDeleteFile ) );
+ m_nPendingDeleteAttempts = 3; // try 3 times at most
+ m_aDeleteTimer.Start( );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL DelayedFileDeletion::queryClosing( const EventObject& , sal_Bool _bGetsOwnership ) throw (util::CloseVetoException, RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if ( _bGetsOwnership )
+ implTakeOwnership( );
+
+ // always veto: We want to take the ownership ourself, as this is the only chance to delete
+ // the temporary file which the model is based on
+ throw util::CloseVetoException( );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL DelayedFileDeletion::notifyClosing( const EventObject& ) throw (RuntimeException)
+ {
+ DBG_ERROR( "DelayedFileDeletion::notifyClosing: how this?" );
+ // this should not happen:
+ // Either, a foreign instance closes the document, then we should veto this, and take the ownership
+ // Or, we ourself close the document, then we should not be a listener anymore
+ }
+
+ //------------------------------------------------------
+ void SAL_CALL DelayedFileDeletion::disposing( const EventObject& ) throw (RuntimeException)
+ {
+ DBG_ERROR( "DelayedFileDeletion::disposing: how this?" );
+ // this should not happen:
+ // Either, a foreign instance closes the document, then we should veto this, and take the ownership
+ // Or, we ourself close the document, then we should not be a listener anymore
+ }
+
+ //------------------------------------------------------
+ DelayedFileDeletion::~DelayedFileDeletion( )
+ {
+ DBG_DTOR( DelayedFileDeletion, NULL );
+ }
+}
+
+////////////////////////////////////////////////////////////
+
+static BOOL DeleteTmpFile_Impl(
+ Reference< frame::XModel > &rxModel,
+ SfxObjectShellRef &rxDocSh,
+ const String &rTmpFileURL )
+{
+ BOOL bRes = FALSE;
+ if (rTmpFileURL.Len())
+ {
+ BOOL bDelete = TRUE;
+ if ( eVetoed == CloseModelAndDocSh( rxModel, rxDocSh ) )
+ {
+ // somebody vetoed the closing, and took the ownership of the document
+ // -> ensure that the temporary file is deleted later on
+ Reference< XEventListener > xEnsureDelete( new DelayedFileDeletion( rxModel, rTmpFileURL ) );
+ // note: as soon as #106931# is fixed, the whole DelayedFileDeletion is to be superseeded by
+ // a better solution
+ bDelete = FALSE;
+ }
+
+ rxModel = 0;
+ rxDocSh = 0; // destroy doc shell
+
+ if ( bDelete )
+ {
+ if ( !SWUnoHelper::UCB_DeleteFile( rTmpFileURL ) )
+ {
+ Reference< XEventListener > xEnsureDelete( new DelayedFileDeletion( rxModel, rTmpFileURL ) );
+ // same not as above: as soon as #106931#, ...
+ }
+ }
+ else
+ bRes = TRUE; // file will be deleted delayed
+ }
+ return bRes;
+}
+
+////////////////////////////////////////////////////////////
+
+SwXMailMerge::SwXMailMerge() :
+ aEvtListeners ( GetMailMergeMutex() ),
+ aMergeListeners ( GetMailMergeMutex() ),
+ aPropListeners ( GetMailMergeMutex() ),
+ pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_MAILMERGE ) ),
+ bSendAsHTML(sal_False),
+ bSendAsAttachment(sal_False),
+ bSaveAsSingleFile(sal_False)
+
+{
+ // create empty document
+ // like in: SwModule::InsertEnv (appenv.cxx)
+ SwDocShell *pDocShell = new SwDocShell( SFX_CREATE_MODE_STANDARD );
+ xDocSh = pDocShell;
+ xDocSh->DoInitNew( 0 );
+ SfxViewFrame *pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
+ SwView *pView = (SwView*) pFrame->GetViewShell();
+ pView->AttrChangedNotify( &pView->GetWrtShell() );//Damit SelectShell gerufen wird.
+
+ xModel = pDocShell->GetModel();
+
+ nDataCommandType = sdb::CommandType::TABLE;
+ nOutputType = MailMergeType::PRINTER;
+ bEscapeProcessing = sal_True; //!! allow to process properties like "Filter", "Order", ...
+ bSinglePrintJobs = sal_False;
+ bFileNameFromColumn = sal_False;
+
+ bDisposing = sal_False;
+}
+
+SwXMailMerge::~SwXMailMerge()
+{
+ if (aTmpFileName.Len())
+ DeleteTmpFile_Impl( xModel, xDocSh, aTmpFileName );
+ else // there was no temporary file in use
+ {
+ //! we still need to close the model and doc shell manually
+ //! because there is no automatism that will do that later.
+ //! #120086#
+ if ( eVetoed == CloseModelAndDocSh( xModel, xDocSh ) )
+ DBG_WARNING( "owner ship transfered to vetoing object!" );
+
+ xModel = 0;
+ xDocSh = 0; // destroy doc shell
+ }
+}
+
+uno::Any SAL_CALL SwXMailMerge::execute(
+ const uno::Sequence< beans::NamedValue >& rArguments )
+ throw (IllegalArgumentException, Exception, RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ //
+ // get property values to be used
+ // (use values from the service as default and override them with
+ // the values that are provided as arguments)
+ //
+ uno::Sequence< uno::Any > aCurSelection = aSelection;
+ uno::Reference< sdbc::XResultSet > xCurResultSet = xResultSet;
+ uno::Reference< sdbc::XConnection > xCurConnection = xConnection;
+ uno::Reference< frame::XModel > xCurModel = xModel;
+ OUString aCurDataSourceName = aDataSourceName;
+ OUString aCurDataCommand = aDataCommand;
+ OUString aCurFilter = aFilter;
+ OUString aCurDocumentURL = aDocumentURL;
+ OUString aCurOutputURL = aOutputURL;
+ OUString aCurFileNamePrefix = aFileNamePrefix;
+ sal_Int32 nCurDataCommandType = nDataCommandType;
+ sal_Int16 nCurOutputType = nOutputType;
+ sal_Bool bCurEscapeProcessing = bEscapeProcessing;
+ sal_Bool bCurSinglePrintJobs = bSinglePrintJobs;
+ sal_Bool bCurFileNameFromColumn = bFileNameFromColumn;
+ //
+ SfxObjectShellRef xCurDocSh = xDocSh; // the document
+ //
+ const beans::NamedValue *pArguments = rArguments.getConstArray();
+ sal_Int32 nArgs = rArguments.getLength();
+ for (sal_Int32 i = 0; i < nArgs; ++i)
+ {
+ const OUString &rName = pArguments[i].Name;
+ const Any &rValue = pArguments[i].Value;
+
+ BOOL bOK = TRUE;
+ if (rName.equalsAscii( GetPropName( UNO_NAME_SELECTION ) ))
+ bOK = rValue >>= aCurSelection;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_RESULT_SET ) ))
+ bOK = rValue >>= xCurResultSet;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_CONNECTION ) ))
+ bOK = rValue >>= xCurConnection;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_MODEL ) ))
+ throw PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rName, static_cast < cppu::OWeakObject * > ( this ) );
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_DATA_SOURCE_NAME ) ))
+ bOK = rValue >>= aCurDataSourceName;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_DAD_COMMAND ) ))
+ bOK = rValue >>= aCurDataCommand;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_FILTER ) ))
+ bOK = rValue >>= aCurFilter;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_DOCUMENT_URL ) ))
+ {
+ bOK = rValue >>= aCurDocumentURL;
+ if (aCurDocumentURL.getLength()
+ && !LoadFromURL_impl( xCurModel, xCurDocSh, aCurDocumentURL, FALSE ))
+ throw RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Failed to create document from URL: " ) ) + aCurDocumentURL, static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_OUTPUT_URL ) ))
+ {
+ bOK = rValue >>= aCurOutputURL;
+ if (aCurOutputURL.getLength())
+ {
+ if (!UCB_IsDirectory(aCurOutputURL))
+ throw IllegalArgumentException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "URL does not point to a directory: " ) ) + aCurOutputURL, static_cast < cppu::OWeakObject * > ( this ), 0 );
+ if (UCB_IsReadOnlyFileName(aCurOutputURL))
+ throw IllegalArgumentException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "URL is read-only: " ) ) + aCurOutputURL, static_cast < cppu::OWeakObject * > ( this ), 0 );
+ }
+ }
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_FILE_NAME_PREFIX ) ))
+ bOK = rValue >>= aCurFileNamePrefix;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_DAD_COMMAND_TYPE ) ))
+ bOK = rValue >>= nCurDataCommandType;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_OUTPUT_TYPE ) ))
+ bOK = rValue >>= nCurOutputType;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_ESCAPE_PROCESSING ) ))
+ bOK = rValue >>= bCurEscapeProcessing;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_SINGLE_PRINT_JOBS ) ))
+ bOK = rValue >>= bCurSinglePrintJobs;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_FILE_NAME_FROM_COLUMN ) ))
+ bOK = rValue >>= bCurFileNameFromColumn;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_SUBJECT ) ))
+ bOK = rValue >>= sSubject;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_ADDRESS_FROM_COLUMN ) ))
+ bOK = rValue >>= sAddressFromColumn;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_SEND_AS_HTML ) ))
+ bOK = rValue >>= bSendAsHTML;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_MAIL_BODY ) ))
+ bOK = rValue >>= sMailBody;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_ATTACHMENT_NAME ) ))
+ bOK = rValue >>= sAttachmentName;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_ATTACHMENT_FILTER ) ))
+ bOK = rValue >>= sAttachmentFilter;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_COPIES_TO ) ))
+ bOK = rValue >>= aCopiesTo;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_BLIND_COPIES_TO ) ))
+ bOK = rValue >>= aBlindCopiesTo;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_SEND_AS_ATTACHMENT ) ))
+ bOK = rValue >>= bSendAsAttachment;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_PRINT_OPTIONS ) ))
+ bOK = rValue >>= aPrintSettings;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_SAVE_AS_SINGLE_FILE ) ))
+ bOK = rValue >>= bSaveAsSingleFile;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_SAVE_FILTER ) ))
+ bOK = rValue >>= sSaveFilter;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_SAVE_FILTER_OPTIONS ) ))
+ bOK = rValue >>= sSaveFilterOptions;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_SAVE_FILTER_DATA ) ))
+ bOK = rValue >>= aSaveFilterData;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_IN_SERVER_PASSWORD ) ))
+ bOK = rValue >>= sInServerPassword;
+ else if (rName.equalsAscii( GetPropName( UNO_NAME_OUT_SERVER_PASSWORD ) ))
+ bOK = rValue >>= sOutServerPassword;
+ else
+ throw UnknownPropertyException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is unknown: " ) ) + rName, static_cast < cppu::OWeakObject * > ( this ) );
+
+ if (!bOK)
+ throw IllegalArgumentException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property type mismatch or property not set: " ) ) + rName, static_cast < cppu::OWeakObject * > ( this ), 0 );
+ }
+
+ // need to translate the selection: the API here requires a sequence of bookmarks, but the MergeNew
+ // method we will call below requires a sequence of indicies.
+ if ( aCurSelection.getLength() )
+ {
+ Sequence< Any > aTranslated( aCurSelection.getLength() );
+
+ sal_Bool bValid = sal_False;
+ Reference< sdbcx::XRowLocate > xRowLocate( xCurResultSet, UNO_QUERY );
+ if ( xRowLocate.is() )
+ {
+
+ const Any* pBookmarks = aCurSelection.getConstArray();
+ const Any* pBookmarksEnd = pBookmarks + aCurSelection.getLength();
+ Any* pTranslated = aTranslated.getArray();
+
+ try
+ {
+ sal_Bool bEverythingsFine = sal_True;
+ for ( ; ( pBookmarks != pBookmarksEnd ) && bEverythingsFine; ++pBookmarks )
+ {
+ if ( xRowLocate->moveToBookmark( *pBookmarks ) )
+ *pTranslated <<= xCurResultSet->getRow();
+ else
+ bEverythingsFine = sal_False;
+ }
+ if ( bEverythingsFine )
+ bValid = sal_True;
+ }
+ catch( const Exception& )
+ {
+ bValid = sal_False;
+ }
+ }
+
+ if ( !bValid )
+ {
+ throw IllegalArgumentException(
+ OUString ( RTL_CONSTASCII_USTRINGPARAM ( "The current 'Selection' does not describe a valid array of bookmarks, relative to the current 'ResultSet'." ) ),
+ static_cast < cppu::OWeakObject * > ( this ),
+ 0
+ );
+ }
+
+ aCurSelection = aTranslated;
+ }
+
+ SfxViewFrame* pFrame = SfxViewFrame::GetFirst( xCurDocSh, FALSE);
+ SwView *pView = PTR_CAST( SwView, pFrame->GetViewShell() );
+ if (!pView)
+ throw RuntimeException();
+ SwWrtShell &rSh = *pView->GetWrtShellPtr();
+
+ // avoid assertion in 'Update' from Sfx by supplying a shell
+ // and thus avoiding the SelectShell call in Writers GetState function
+ // while still in Update of Sfx.
+ // (GetSelection in Update is not allowed)
+ if (pView && aCurDocumentURL.getLength())
+ pView->AttrChangedNotify( &pView->GetWrtShell() );//Damit SelectShell gerufen wird.
+
+ SharedComponent aRowSetDisposeHelper;
+ if (!xCurResultSet.is())
+ {
+ if (!aCurDataSourceName.getLength() || !aCurDataCommand.getLength() )
+ {
+ DBG_ERROR("PropertyValues missing or unset");
+ throw IllegalArgumentException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Either the ResultSet or DataSourceName and DataCommand must be set." ) ), static_cast < cppu::OWeakObject * > ( this ), 0 );
+ }
+
+ //
+ // build ResultSet from DataSourceName, DataCommand and DataCommandType
+ //
+ Reference< XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() );
+ if (xMgr.is())
+ {
+ Reference< XInterface > xInstance = xMgr->createInstance(
+ C2U( "com.sun.star.sdb.RowSet" ));
+ aRowSetDisposeHelper.reset( xInstance, SharedComponent::TakeOwnership );
+ Reference< XPropertySet > xRowSetPropSet( xInstance, UNO_QUERY );
+ DBG_ASSERT( xRowSetPropSet.is(), "failed to get XPropertySet interface from RowSet" );
+ if (xRowSetPropSet.is())
+ {
+ if (xCurConnection.is())
+ xRowSetPropSet->setPropertyValue( C2U("ActiveConnection"), makeAny( xCurConnection ) );
+ xRowSetPropSet->setPropertyValue( C2U("DataSourceName"), makeAny( aCurDataSourceName ) );
+ xRowSetPropSet->setPropertyValue( C2U("Command"), makeAny( aCurDataCommand ) );
+ xRowSetPropSet->setPropertyValue( C2U("CommandType"), makeAny( nCurDataCommandType ) );
+ xRowSetPropSet->setPropertyValue( C2U("EscapeProcessing"), makeAny( bCurEscapeProcessing ) );
+ xRowSetPropSet->setPropertyValue( C2U("ApplyFilter"), makeAny( sal_True ) );
+ xRowSetPropSet->setPropertyValue( C2U("Filter"), makeAny( aCurFilter ) );
+
+ Reference< sdbc::XRowSet > xRowSet( xInstance, UNO_QUERY );
+ if (xRowSet.is())
+ xRowSet->execute(); // build ResultSet from properties
+ if( !xCurConnection.is() )
+ xCurConnection.set( xRowSetPropSet->getPropertyValue( C2U( "ActiveConnection" )), UNO_QUERY );
+ xCurResultSet = Reference< sdbc::XResultSet >( xRowSet, UNO_QUERY );
+ DBG_ASSERT( xCurResultSet.is(), "failed to build ResultSet" );
+ }
+ }
+ }
+
+ svx::ODataAccessDescriptor aDescriptor;
+ aDescriptor.setDataSource(aCurDataSourceName);
+ aDescriptor[ svx::daConnection ] <<= xCurConnection;
+ aDescriptor[ svx::daCommand ] <<= aCurDataCommand;
+ aDescriptor[ svx::daCommandType ] <<= nCurDataCommandType;
+ aDescriptor[ svx::daEscapeProcessing ] <<= bCurEscapeProcessing;
+ aDescriptor[ svx::daCursor ] <<= xCurResultSet;
+ // aDescriptor[ svx::daColumnName ] not used
+ // aDescriptor[ svx::daColumnObject ] not used
+ aDescriptor[ svx::daSelection ] <<= aCurSelection;
+
+ USHORT nMergeType;
+ switch (nCurOutputType)
+ {
+ case MailMergeType::PRINTER : nMergeType = DBMGR_MERGE_MAILMERGE; break;
+ case MailMergeType::FILE : nMergeType = DBMGR_MERGE_MAILFILES; break;
+ case MailMergeType::MAIL : nMergeType = DBMGR_MERGE_MAILING; break;
+ default:
+ throw IllegalArgumentException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Invalid value of property:" ) ) + C2U("OutputType"), static_cast < cppu::OWeakObject * > ( this ), 0 );
+ }
+
+ SwNewDBMgr* pMgr = rSh.GetNewDBMgr();
+ //force layout creation
+ rSh.CalcLayout();
+ DBG_ASSERT( pMgr, "database manager missing" );
+
+ SwMergeDescriptor aMergeDesc( nMergeType, rSh, aDescriptor );
+
+ std::auto_ptr< SwMailMergeConfigItem > pMMConfigItem;
+ uno::Reference< mail::XMailService > xInService;
+ if (MailMergeType::PRINTER == nCurOutputType)
+ {
+ IDocumentDeviceAccess* pIDDA = rSh.getIDocumentDeviceAccess();
+ SwPrintData aPrtData( pIDDA->getPrintData() );
+ aPrtData.SetPrintSingleJobs( bCurSinglePrintJobs );
+ pIDDA->setPrintData( aPrtData );
+ // #i25686# printing should not be done asynchronously to prevent dangling offices
+ // when mail merge is called as command line macro
+ aMergeDesc.bPrintAsync = sal_False;
+ aMergeDesc.aPrintOptions = aPrintSettings;
+ aMergeDesc.bCreateSingleFile = true;
+ }
+ else /* FILE and MAIL*/
+ {
+ INetURLObject aURLObj;
+ aURLObj.SetSmartProtocol( INET_PROT_FILE );
+
+ if (aCurDocumentURL.getLength())
+ {
+ // if OutputURL or FileNamePrefix are missing get
+ // them from DocumentURL
+ aURLObj.SetSmartURL( aCurDocumentURL );
+ if (!aCurFileNamePrefix.getLength())
+ aCurFileNamePrefix = aURLObj.GetBase(); // filename without extension
+ if (!aCurOutputURL.getLength())
+ {
+ //aCurOutputURL = aURLObj.GetURLPath();
+ aURLObj.removeSegment();
+ aCurOutputURL = aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI );
+ }
+ }
+ else // default empty document without URL
+ {
+ if (!aCurOutputURL.getLength())
+ throw RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "OutputURL is not set and can not be obtained." ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ }
+
+ aURLObj.SetSmartURL( aCurOutputURL );
+ String aPath = aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI );
+
+ String aDelim( INET_PATH_TOKEN );
+ if (aPath.Len() >= aDelim.Len() &&
+ aPath.Copy( aPath.Len()-aDelim.Len() ).CompareTo( aDelim ) != COMPARE_EQUAL)
+ aPath += aDelim;
+ if (bCurFileNameFromColumn)
+ pMgr->SetEMailColumn( aCurFileNamePrefix );
+ else
+ {
+ aPath += String( aCurFileNamePrefix );
+ pMgr->SetEMailColumn( String() );
+ }
+ pMgr->SetSubject( aPath );
+ if(MailMergeType::FILE == nCurOutputType)
+ {
+ aMergeDesc.sSaveToFilter = sSaveFilter;
+ aMergeDesc.sSaveToFilterOptions = sSaveFilterOptions;
+ aMergeDesc.aSaveToFilterData = aSaveFilterData;
+ aMergeDesc.bCreateSingleFile = bSaveAsSingleFile;
+ }
+ else /*if(MailMergeType::MAIL == nCurOutputType)*/
+ {
+ pMgr->SetEMailColumn( sAddressFromColumn );
+ if(!sAddressFromColumn.getLength())
+ throw RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Mail address column not set." ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ aMergeDesc.sSaveToFilter = sAttachmentFilter;
+ aMergeDesc.sSubject = sSubject;
+ aMergeDesc.sMailBody = sMailBody;
+ aMergeDesc.sAttachmentName = sAttachmentName;
+ aMergeDesc.aCopiesTo = aCopiesTo;
+ aMergeDesc.aBlindCopiesTo = aBlindCopiesTo;
+ aMergeDesc.bSendAsHTML = bSendAsHTML;
+ aMergeDesc.bSendAsAttachment = bSendAsAttachment;
+
+ aMergeDesc.bCreateSingleFile = sal_False;
+ pMMConfigItem = std::auto_ptr< SwMailMergeConfigItem >(new SwMailMergeConfigItem);
+ aMergeDesc.pMailMergeConfigItem = pMMConfigItem.get();
+ aMergeDesc.xSmtpServer = SwMailMergeHelper::ConnectToSmtpServer(
+ *pMMConfigItem,
+ xInService,
+ sInServerPassword, sOutServerPassword );
+ if( !aMergeDesc.xSmtpServer.is() || !aMergeDesc.xSmtpServer->isConnected())
+ throw RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Failed to connect to mail server." ) ), static_cast < cppu::OWeakObject * > ( this ) );
+ }
+ }
+
+
+ // save document with temporary filename
+ const SfxFilter *pSfxFlt = SwIoSystem::GetFilterOfFormat(
+ String::CreateFromAscii( FILTER_XML ),
+ SwDocShell::Factory().GetFilterContainer() );
+ String aExtension( pSfxFlt->GetDefaultExtension() );
+ aExtension.EraseLeadingChars( '*' );
+ TempFile aTempFile( C2U("SwMM"), &aExtension );
+ aTmpFileName = aTempFile.GetName();
+
+ Reference< XStorable > xStorable( xCurModel, UNO_QUERY );
+ sal_Bool bStoredAsTemporary = sal_False;
+ if ( xStorable.is() )
+ {
+ try
+ {
+ xStorable->storeAsURL( aTmpFileName, Sequence< PropertyValue >() );
+ bStoredAsTemporary = sal_True;
+ }
+ catch( const Exception& )
+ {
+ }
+ }
+ if ( !bStoredAsTemporary )
+ throw RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Failed to save temporary file." ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ pMgr->SetMergeSilent( TRUE ); // suppress dialogs, message boxes, etc.
+ const SwXMailMerge *pOldSrc = pMgr->GetMailMergeEvtSrc();
+ DBG_ASSERT( !pOldSrc || pOldSrc == this, "Ooops... different event source already set." );
+ pMgr->SetMailMergeEvtSrc( this ); // launch events for listeners
+
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE), xCurDocSh));
+ BOOL bSucc = pMgr->MergeNew( aMergeDesc );
+ SFX_APP()->NotifyEvent(SfxEventHint(SW_EVENT_MAIL_MERGE_END, SwDocShell::GetEventName(STR_SW_EVENT_MAIL_MERGE_END), xCurDocSh));
+
+ pMgr->SetMailMergeEvtSrc( pOldSrc );
+
+ if ( xCurModel.get() != xModel.get() )
+ { // in case it was a temporary model -> close it, and delete the file
+ DeleteTmpFile_Impl( xCurModel, xCurDocSh, aTmpFileName );
+ aTmpFileName.Erase();
+ }
+ // (in case it wasn't a temporary model, it will be closed in the dtor, at the latest)
+
+ if (!bSucc)
+ throw Exception( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Mail merge failed. Sorry, no further information available." ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ //de-initialize services
+ if(xInService.is() && xInService->isConnected())
+ xInService->disconnect();
+ if(aMergeDesc.xSmtpServer.is() && aMergeDesc.xSmtpServer->isConnected())
+ aMergeDesc.xSmtpServer->disconnect();
+
+ return makeAny( sal_True );
+}
+
+void SwXMailMerge::LaunchMailMergeEvent( const MailMergeEvent &rEvt ) const
+{
+ cppu::OInterfaceIteratorHelper aIt( ((SwXMailMerge *) this)->aMergeListeners );
+ while (aIt.hasMoreElements())
+ {
+ Reference< XMailMergeListener > xRef( aIt.next(), UNO_QUERY );
+ if (xRef.is())
+ xRef->notifyMailMergeEvent( rEvt );
+ }
+}
+
+void SwXMailMerge::launchEvent( const PropertyChangeEvent &rEvt ) const
+{
+ cppu::OInterfaceContainerHelper *pContainer =
+ aPropListeners.getContainer( rEvt.PropertyHandle );
+ if (pContainer)
+ {
+ cppu::OInterfaceIteratorHelper aIt( *pContainer );
+ while (aIt.hasMoreElements())
+ {
+ Reference< XPropertyChangeListener > xRef( aIt.next(), UNO_QUERY );
+ if (xRef.is())
+ xRef->propertyChange( rEvt );
+ }
+ }
+}
+
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXMailMerge::getPropertySetInfo( )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ static Reference< XPropertySetInfo > aRef = pPropSet->getPropertySetInfo();
+ return aRef;
+}
+
+void SAL_CALL SwXMailMerge::setPropertyValue(
+ const OUString& rPropertyName, const uno::Any& rValue )
+ throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ const SfxItemPropertySimpleEntry* pCur = pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if (!pCur)
+ throw UnknownPropertyException();
+ else if (pCur->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException();
+ else
+ {
+ void *pData = NULL;
+ const uno::Type* pType = pCur->pType;
+ switch (pCur->nWID)
+ {
+ case WID_SELECTION : pData = &aSelection; break;
+ case WID_RESULT_SET : pData = &xResultSet; break;
+ case WID_CONNECTION : pData = &xConnection; break;
+ case WID_MODEL : pData = &xModel; break;
+ case WID_DATA_SOURCE_NAME : pData = &aDataSourceName; break;
+ case WID_DATA_COMMAND : pData = &aDataCommand; break;
+ case WID_FILTER : pData = &aFilter; break;
+ case WID_DOCUMENT_URL : pData = &aDocumentURL; break;
+ case WID_OUTPUT_URL : pData = &aOutputURL; break;
+ case WID_DATA_COMMAND_TYPE : pData = &nDataCommandType; break;
+ case WID_OUTPUT_TYPE : pData = &nOutputType; break;
+ case WID_ESCAPE_PROCESSING : pData = &bEscapeProcessing; break;
+ case WID_SINGLE_PRINT_JOBS : pData = &bSinglePrintJobs; break;
+ case WID_FILE_NAME_FROM_COLUMN : pData = &bFileNameFromColumn; break;
+ case WID_FILE_NAME_PREFIX : pData = &aFileNamePrefix; break;
+ case WID_MAIL_SUBJECT: pData = &sSubject; break;
+ case WID_ADDRESS_FROM_COLUMN: pData = &sAddressFromColumn; break;
+ case WID_SEND_AS_HTML: pData = &bSendAsHTML; break;
+ case WID_SEND_AS_ATTACHMENT: pData = &bSendAsAttachment; break;
+ case WID_MAIL_BODY: pData = &sMailBody; break;
+ case WID_ATTACHMENT_NAME: pData = &sAttachmentName; break;
+ case WID_ATTACHMENT_FILTER: pData = &sAttachmentFilter;break;
+ case WID_PRINT_OPTIONS: pData = &aPrintSettings; break;
+ case WID_SAVE_AS_SINGLE_FILE: pData = &bSaveAsSingleFile; break;
+ case WID_SAVE_FILTER: pData = &sSaveFilter; break;
+ case WID_SAVE_FILTER_OPTIONS: pData = &sSaveFilterOptions; break;
+ case WID_SAVE_FILTER_DATA: pData = &aSaveFilterData; break;
+ case WID_COPIES_TO: pData = &aCopiesTo; break;
+ case WID_BLIND_COPIES_TO: pData = &aBlindCopiesTo;break;
+ case WID_IN_SERVER_PASSWORD: pData = &sInServerPassword; break;
+ case WID_OUT_SERVER_PASSWORD: pData = &sOutServerPassword; break;
+ default :
+ DBG_ERROR("unknown WID");
+ }
+ Any aOld( pData, *pType );
+
+ sal_Bool bChanged = sal_False;
+ sal_Bool bOK = sal_True;
+ if (aOld != rValue)
+ {
+ if (pData == &aSelection)
+ bOK = rValue >>= aSelection;
+ else if (pData == &xResultSet)
+ bOK = rValue >>= xResultSet;
+ else if (pData == &xConnection)
+ bOK = rValue >>= xConnection;
+ else if (pData == &xModel)
+ bOK = rValue >>= xModel;
+ else if (pData == &aDataSourceName)
+ bOK = rValue >>= aDataSourceName;
+ else if (pData == &aDataCommand)
+ bOK = rValue >>= aDataCommand;
+ else if (pData == &aFilter)
+ bOK = rValue >>= aFilter;
+ else if (pData == &aDocumentURL)
+ {
+ OUString aText;
+ bOK = rValue >>= aText;
+ if (aText.getLength()
+ && !LoadFromURL_impl( xModel, xDocSh, aText, TRUE ))
+ throw RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Failed to create document from URL: " ) ) + aText, static_cast < cppu::OWeakObject * > ( this ) );
+ aDocumentURL = aText;
+ }
+ else if (pData == &aOutputURL)
+ {
+ OUString aText;
+ bOK = rValue >>= aText;
+ if (aText.getLength())
+ {
+ if (!UCB_IsDirectory(aText))
+ throw IllegalArgumentException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "URL does not point to a directory: " ) ) + aText, static_cast < cppu::OWeakObject * > ( this ), 0 );
+ if (UCB_IsReadOnlyFileName(aText))
+ throw IllegalArgumentException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "URL is read-only: " ) ) + aText, static_cast < cppu::OWeakObject * > ( this ), 0 );
+ }
+ aOutputURL = aText;
+ }
+ else if (pData == &nDataCommandType)
+ bOK = rValue >>= nDataCommandType;
+ else if (pData == &nOutputType)
+ bOK = rValue >>= nOutputType;
+ else if (pData == &bEscapeProcessing)
+ bOK = rValue >>= bEscapeProcessing;
+ else if (pData == &bSinglePrintJobs)
+ bOK = rValue >>= bSinglePrintJobs;
+ else if (pData == &bFileNameFromColumn)
+ bOK = rValue >>= bFileNameFromColumn;
+ else if (pData == &aFileNamePrefix)
+ bOK = rValue >>= aFileNamePrefix;
+ else if (pData == &sSubject)
+ bOK = rValue >>= sSubject;
+ else if (pData == &sAddressFromColumn)
+ bOK = rValue >>= sAddressFromColumn;
+ else if (pData == &bSendAsHTML)
+ bOK = rValue >>= bSendAsHTML;
+ else if (pData == &bSendAsAttachment)
+ bOK = rValue >>= bSendAsAttachment;
+ else if (pData == &sMailBody)
+ bOK = rValue >>= sMailBody;
+ else if (pData == &sAttachmentName)
+ bOK = rValue >>= sAttachmentName;
+ else if (pData == &sAttachmentFilter)
+ bOK = rValue >>= sAttachmentFilter;
+ else if (pData == &aPrintSettings)
+ bOK = rValue >>= aPrintSettings;
+ else if (pData == &bSaveAsSingleFile)
+ bOK = rValue >>= bSaveAsSingleFile;
+ else if (pData == &sSaveFilter)
+ bOK = rValue >>= sSaveFilter;
+ else if (pData == &sSaveFilterOptions)
+ bOK = rValue >>= sSaveFilterOptions;
+ else if (pData == &aSaveFilterData)
+ bOK = rValue >>= aSaveFilterData;
+ else if (pData == &aCopiesTo)
+ bOK = rValue >>= aCopiesTo;
+ else if (pData == &aBlindCopiesTo)
+ bOK = rValue >>= aBlindCopiesTo;
+ else if(pData == &sInServerPassword)
+ bOK = rValue >>= sInServerPassword;
+ else if(pData == &sOutServerPassword)
+ bOK = rValue >>= sInServerPassword;
+ else {
+ DBG_ERROR( "invalid pointer" );
+ }
+ DBG_ASSERT( bOK, "set value failed" );
+ bChanged = sal_True;
+ }
+ if (!bOK)
+ throw IllegalArgumentException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property type mismatch or property not set: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ), 0 );
+
+ if (bChanged)
+ {
+ PropertyChangeEvent aChgEvt( (XPropertySet *) this, rPropertyName,
+ FALSE, pCur->nWID, aOld, rValue );
+ launchEvent( aChgEvt );
+ }
+ }
+}
+
+uno::Any SAL_CALL SwXMailMerge::getPropertyValue(
+ const OUString& rPropertyName )
+ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ Any aRet;
+
+ const SfxItemPropertySimpleEntry* pCur = pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if (!pCur)
+ throw UnknownPropertyException();
+ else
+ {
+ switch (pCur->nWID)
+ {
+ case WID_SELECTION : aRet <<= aSelection; break;
+ case WID_RESULT_SET : aRet <<= xResultSet; break;
+ case WID_CONNECTION : aRet <<= xConnection; break;
+ case WID_MODEL : aRet <<= xModel; break;
+ case WID_DATA_SOURCE_NAME : aRet <<= aDataSourceName; break;
+ case WID_DATA_COMMAND : aRet <<= aDataCommand; break;
+ case WID_FILTER : aRet <<= aFilter; break;
+ case WID_DOCUMENT_URL : aRet <<= aDocumentURL; break;
+ case WID_OUTPUT_URL : aRet <<= aOutputURL; break;
+ case WID_DATA_COMMAND_TYPE : aRet <<= nDataCommandType; break;
+ case WID_OUTPUT_TYPE : aRet <<= nOutputType; break;
+ case WID_ESCAPE_PROCESSING : aRet <<= bEscapeProcessing; break;
+ case WID_SINGLE_PRINT_JOBS : aRet <<= bSinglePrintJobs; break;
+ case WID_FILE_NAME_FROM_COLUMN : aRet <<= bFileNameFromColumn; break;
+ case WID_FILE_NAME_PREFIX : aRet <<= aFileNamePrefix; break;
+ case WID_MAIL_SUBJECT: aRet <<= sSubject; break;
+ case WID_ADDRESS_FROM_COLUMN: aRet <<= sAddressFromColumn; break;
+ case WID_SEND_AS_HTML: aRet <<= bSendAsHTML; break;
+ case WID_SEND_AS_ATTACHMENT: aRet <<= bSendAsAttachment; break;
+ case WID_MAIL_BODY: aRet <<= sMailBody; break;
+ case WID_ATTACHMENT_NAME: aRet <<= sAttachmentName; break;
+ case WID_ATTACHMENT_FILTER: aRet <<= sAttachmentFilter;break;
+ case WID_PRINT_OPTIONS: aRet <<= aPrintSettings; break;
+ case WID_SAVE_AS_SINGLE_FILE: aRet <<= bSaveAsSingleFile; break;
+ case WID_SAVE_FILTER: aRet <<= sSaveFilter; break;
+ case WID_SAVE_FILTER_OPTIONS: aRet <<= sSaveFilterOptions; break;
+ case WID_SAVE_FILTER_DATA: aRet <<= aSaveFilterData; break;
+ case WID_COPIES_TO: aRet <<= aCopiesTo; break;
+ case WID_BLIND_COPIES_TO: aRet <<= aBlindCopiesTo;break;
+ case WID_IN_SERVER_PASSWORD: aRet <<= sInServerPassword; break;
+ case WID_OUT_SERVER_PASSWORD: aRet <<= sOutServerPassword; break;
+ default :
+ DBG_ERROR("unknown WID");
+ }
+ }
+
+ return aRet;
+}
+
+void SAL_CALL SwXMailMerge::addPropertyChangeListener(
+ const OUString& rPropertyName,
+ const uno::Reference< beans::XPropertyChangeListener >& rListener )
+ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (!bDisposing && rListener.is())
+ {
+ const SfxItemPropertySimpleEntry* pCur = pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if (pCur)
+ aPropListeners.addInterface( pCur->nWID, rListener );
+ else
+ throw UnknownPropertyException();
+ }
+}
+
+void SAL_CALL SwXMailMerge::removePropertyChangeListener(
+ const OUString& rPropertyName,
+ const uno::Reference< beans::XPropertyChangeListener >& rListener )
+ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (!bDisposing && rListener.is())
+ {
+ const SfxItemPropertySimpleEntry* pCur = pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if (pCur)
+ aPropListeners.removeInterface( pCur->nWID, rListener );
+ else
+ throw UnknownPropertyException();
+ }
+}
+
+void SAL_CALL SwXMailMerge::addVetoableChangeListener(
+ const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*rListener*/ )
+ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ // no vetoable property, thus no support for vetoable change listeners
+ DBG_WARNING( "not implemented");
+}
+
+void SAL_CALL SwXMailMerge::removeVetoableChangeListener(
+ const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*rListener*/ )
+ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ // no vetoable property, thus no support for vetoable change listeners
+ DBG_WARNING( "not implemented");
+}
+
+
+void SAL_CALL SwXMailMerge::dispose()
+ throw(RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ if (!bDisposing)
+ {
+ bDisposing = sal_True;
+
+ EventObject aEvtObj( (XPropertySet *) this );
+ aEvtListeners.disposeAndClear( aEvtObj );
+ aMergeListeners.disposeAndClear( aEvtObj );
+ aPropListeners.disposeAndClear( aEvtObj );
+ }
+}
+
+void SAL_CALL SwXMailMerge::addEventListener(
+ const Reference< XEventListener >& rxListener )
+ throw(RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (!bDisposing && rxListener.is())
+ aEvtListeners.addInterface( rxListener );
+}
+
+void SAL_CALL SwXMailMerge::removeEventListener(
+ const Reference< XEventListener >& rxListener )
+ throw(RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (!bDisposing && rxListener.is())
+ aEvtListeners.removeInterface( rxListener );
+}
+
+void SAL_CALL SwXMailMerge::addMailMergeEventListener(
+ const uno::Reference< XMailMergeListener >& rxListener )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (!bDisposing && rxListener.is())
+ aMergeListeners.addInterface( rxListener );
+}
+
+void SAL_CALL SwXMailMerge::removeMailMergeEventListener(
+ const uno::Reference< XMailMergeListener >& rxListener )
+ throw (RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ if (!bDisposing && rxListener.is())
+ aMergeListeners.removeInterface( rxListener );
+}
+
+OUString SAL_CALL SwXMailMerge::getImplementationName()
+ throw(RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ return SwXMailMerge_getImplementationName();
+}
+
+sal_Bool SAL_CALL SwXMailMerge::supportsService( const OUString& rServiceName )
+ throw(RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ return C2U( SN_MAIL_MERGE ) == rServiceName ||
+ C2U( SN_DATA_ACCESS_DESCRIPTOR ) == rServiceName;
+}
+
+uno::Sequence< OUString > SAL_CALL SwXMailMerge::getSupportedServiceNames()
+ throw(RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ return SwXMailMerge_getSupportedServiceNames();
+}
+
+////////////////////////////////////////////////////////////
+
+uno::Sequence< OUString > SAL_CALL SwXMailMerge_getSupportedServiceNames()
+ throw()
+{
+ uno::Sequence< OUString > aNames(2);
+ OUString *pName = aNames.getArray();
+ pName[0] = C2U( SN_MAIL_MERGE );
+ pName[1] = C2U( SN_DATA_ACCESS_DESCRIPTOR );
+ return aNames;
+}
+
+OUString SAL_CALL SwXMailMerge_getImplementationName()
+ throw()
+{
+ return OUString( C2U( "SwXMailMerge" ) );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SwXMailMerge_createInstance(
+ const uno::Reference< XMultiServiceFactory > & /*rSMgr*/)
+ throw( uno::Exception )
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ //the module may not be loaded
+ SwDLL::Init();
+ uno::Reference< uno::XInterface > xRef = (cppu::OWeakObject *) new SwXMailMerge();
+ return xRef;
+}
+
diff --git a/sw/source/ui/uno/unomod.cxx b/sw/source/ui/uno/unomod.cxx
new file mode 100644
index 000000000000..42ef04634f6c
--- /dev/null
+++ b/sw/source/ui/uno/unomod.cxx
@@ -0,0 +1,1043 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <swtypes.hxx>
+#include <tools/debug.hxx>
+#include <unomod.hxx>
+#include <unomid.h>
+#include <unoprnms.hxx>
+#include <unomap.hxx>
+#include <prtopt.hxx>
+#include <tools/shl.hxx>
+#include <swmodule.hxx>
+#include <view.hxx>
+#include <docsh.hxx>
+#include <wrtsh.hxx>
+#include <viewopt.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/text/NotePrintMode.hpp>
+#include <doc.hxx>
+#include <comphelper/TypeGeneration.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/view/DocumentZoomType.hpp>
+#include <comphelper/ChainablePropertySetInfo.hxx>
+#include <edtwin.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <tools/urlobj.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::comphelper;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+enum SwViewSettingsPropertyHandles
+{
+ HANDLE_VIEWSET_ANNOTATIONS,
+ HANDLE_VIEWSET_BREAKS,
+ HANDLE_VIEWSET_DRAWINGS,
+ HANDLE_VIEWSET_FIELD_COMMANDS,
+ HANDLE_VIEWSET_FOOTNOTE_BACKGROUND,
+ HANDLE_VIEWSET_GRAPHICS,
+ HANDLE_VIEWSET_HIDDEN_CHARACTERS,
+ HANDLE_VIEWSET_HIDDEN_PARAGRAPHS,
+ HANDLE_VIEWSET_HIDDEN_TEXT,
+ HANDLE_VIEWSET_HRULER,
+ HANDLE_VIEWSET_HSCROLL,
+ HANDLE_VIEWSET_INDEX_MARK_BACKGROUND,
+ HANDLE_VIEWSET_NONPRINTING_CHARACTERS,
+ HANDLE_VIEWSET_ONLINE_LAYOUT,
+ HANDLE_VIEWSET_PARA_BREAKS,
+ HANDLE_VIEWSET_PROTECTED_SPACES,
+ HANDLE_VIEWSET_SOFT_HYPHENS,
+ HANDLE_VIEWSET_SPACES,
+ HANDLE_VIEWSET_TABLE_BOUNDARIES,
+ HANDLE_VIEWSET_TABLES,
+ HANDLE_VIEWSET_TABSTOPS,
+ HANDLE_VIEWSET_TEXT_BOUNDARIES,
+ HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND,
+ HANDLE_VIEWSET_VRULER,
+ HANDLE_VIEWSET_VSCROLL,
+ HANDLE_VIEWSET_SMOOTH_SCROLLING,
+ HANDLE_VIEWSET_SOLID_MARK_HANDLES,
+ HANDLE_VIEWSET_ZOOM_TYPE,
+ HANDLE_VIEWSET_ZOOM,
+ HANDLE_VIEWSET_PREVENT_TIPS,
+ HANDLE_VIEWSET_HELP_URL,
+ HANDLE_VIEWSET_VRULER_RIGHT,
+ HANDLE_VIEWSET_SHOW_RULER,
+ HANDLE_VIEWSET_IS_RASTER_VISIBLE,
+ HANDLE_VIEWSET_IS_SNAP_TO_RASTER,
+ HANDLE_VIEWSET_RASTER_RESOLUTION_X,
+ HANDLE_VIEWSET_RASTER_RESOLUTION_Y,
+ HANDLE_VIEWSET_RASTER_SUBDIVISION_X,
+ HANDLE_VIEWSET_RASTER_SUBDIVISION_Y,
+ HANDLE_VIEWSET_HORI_RULER_METRIC,
+ HANDLE_VIEWSET_VERT_RULER_METRIC
+};
+enum SwPrintSettingsPropertyHandles
+{
+ HANDLE_PRINTSET_ANNOTATION_MODE,
+ HANDLE_PRINTSET_BLACK_FONTS,
+ HANDLE_PRINTSET_CONTROLS,
+ HANDLE_PRINTSET_DRAWINGS,
+ HANDLE_PRINTSET_GRAPHICS,
+ HANDLE_PRINTSET_LEFT_PAGES,
+ HANDLE_PRINTSET_PAGE_BACKGROUND,
+ HANDLE_PRINTSET_PROSPECT,
+ HANDLE_PRINTSET_REVERSED,
+ HANDLE_PRINTSET_RIGHT_PAGES,
+ HANDLE_PRINTSET_FAX_NAME,
+ HANDLE_PRINTSET_PAPER_FROM_SETUP,
+ HANDLE_PRINTSET_TABLES,
+ HANDLE_PRINTSET_SINGLE_JOBS,
+ HANDLE_PRINTSET_EMPTY_PAGES,
+ HANDLE_PRINTSET_PROSPECT_RTL,
+ HANDLE_PRINTSET_PLACEHOLDER,
+ HANDLE_PRINTSET_HIDDEN_TEXT
+};
+
+static ChainablePropertySetInfo * lcl_createViewSettingsInfo()
+{
+ static PropertyInfo aViewSettingsMap_Impl[] =
+ {
+ { RTL_CONSTASCII_STRINGPARAM ( "HelpURL" ), HANDLE_VIEWSET_HELP_URL , CPPUTYPE_OUSTRING, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "HorizontalRulerMetric"),HANDLE_VIEWSET_HORI_RULER_METRIC , CPPUTYPE_INT32, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "IsRasterVisible"), HANDLE_VIEWSET_IS_RASTER_VISIBLE, CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "IsSnapToRaster"), HANDLE_VIEWSET_IS_SNAP_TO_RASTER, CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "IsVertRulerRightAligned"),HANDLE_VIEWSET_VRULER_RIGHT , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PreventHelpTips" ), HANDLE_VIEWSET_PREVENT_TIPS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "RasterResolutionX"), HANDLE_VIEWSET_RASTER_RESOLUTION_X, CPPUTYPE_INT32, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "RasterResolutionY"), HANDLE_VIEWSET_RASTER_RESOLUTION_Y, CPPUTYPE_INT32, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "RasterSubdivisionX"), HANDLE_VIEWSET_RASTER_SUBDIVISION_X, CPPUTYPE_INT32, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "RasterSubdivisionY"), HANDLE_VIEWSET_RASTER_SUBDIVISION_Y, CPPUTYPE_INT32, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowAnnotations" ), HANDLE_VIEWSET_ANNOTATIONS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowBreaks"), HANDLE_VIEWSET_BREAKS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowDrawings"), HANDLE_VIEWSET_DRAWINGS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowFieldCommands"), HANDLE_VIEWSET_FIELD_COMMANDS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowFootnoteBackground"),HANDLE_VIEWSET_FOOTNOTE_BACKGROUND , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowGraphics"), HANDLE_VIEWSET_GRAPHICS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowHiddenCharacters"), HANDLE_VIEWSET_HIDDEN_CHARACTERS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowHiddenParagraphs"), HANDLE_VIEWSET_HIDDEN_PARAGRAPHS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowHiddenText"), HANDLE_VIEWSET_HIDDEN_TEXT , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowHoriRuler"), HANDLE_VIEWSET_HRULER , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowHoriScrollBar"), HANDLE_VIEWSET_HSCROLL , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowIndexMarkBackground"),HANDLE_VIEWSET_INDEX_MARK_BACKGROUND, CPPUTYPE_BOOLEAN,PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowNonprintingCharacters"),HANDLE_VIEWSET_NONPRINTING_CHARACTERS, CPPUTYPE_BOOLEAN,PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowOnlineLayout"), HANDLE_VIEWSET_ONLINE_LAYOUT , CPPUTYPE_BOOLEAN, PropertyAttribute::MAYBEVOID, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowParaBreaks"), HANDLE_VIEWSET_PARA_BREAKS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowProtectedSpaces"), HANDLE_VIEWSET_PROTECTED_SPACES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowRulers"), HANDLE_VIEWSET_SHOW_RULER , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowSoftHyphens"), HANDLE_VIEWSET_SOFT_HYPHENS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowSpaces"), HANDLE_VIEWSET_SPACES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowTableBoundaries"), HANDLE_VIEWSET_TABLE_BOUNDARIES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowTables"), HANDLE_VIEWSET_TABLES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowTabstops"), HANDLE_VIEWSET_TABSTOPS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowTextBoundaries"), HANDLE_VIEWSET_TEXT_BOUNDARIES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowTextFieldBackground"),HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND, CPPUTYPE_BOOLEAN,PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowVertRuler"), HANDLE_VIEWSET_VRULER , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ShowVertScrollBar"), HANDLE_VIEWSET_VSCROLL , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "SmoothScrolling"), HANDLE_VIEWSET_SMOOTH_SCROLLING , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "SolidMarkHandles"), HANDLE_VIEWSET_SOLID_MARK_HANDLES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "VerticalRulerMetric"), HANDLE_VIEWSET_VERT_RULER_METRIC , CPPUTYPE_INT32, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ZoomType"), HANDLE_VIEWSET_ZOOM_TYPE , CPPUTYPE_INT16, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "ZoomValue"), HANDLE_VIEWSET_ZOOM , CPPUTYPE_INT16, PROPERTY_NONE, 0},
+ { 0, 0, 0, CPPUTYPE_UNKNOWN, 0, 0 }
+ };
+ return new ChainablePropertySetInfo ( aViewSettingsMap_Impl );
+}
+static ChainablePropertySetInfo * lcl_createPrintSettingsInfo()
+{
+ static PropertyInfo aPrintSettingsMap_Impl[] =
+ {
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintAnnotationMode" ), HANDLE_PRINTSET_ANNOTATION_MODE , CPPUTYPE_INT16, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintBlackFonts" ), HANDLE_PRINTSET_BLACK_FONTS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintControls" ), HANDLE_PRINTSET_CONTROLS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintDrawings" ), HANDLE_PRINTSET_DRAWINGS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintGraphics" ), HANDLE_PRINTSET_GRAPHICS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintHiddenText"), HANDLE_PRINTSET_HIDDEN_TEXT , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintLeftPages" ), HANDLE_PRINTSET_LEFT_PAGES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintPageBackground" ), HANDLE_PRINTSET_PAGE_BACKGROUND , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintProspect" ), HANDLE_PRINTSET_PROSPECT , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintProspectRTL" ), HANDLE_PRINTSET_PROSPECT_RTL , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintReversed" ), HANDLE_PRINTSET_REVERSED , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintRightPages" ), HANDLE_PRINTSET_RIGHT_PAGES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintFaxName" ), HANDLE_PRINTSET_FAX_NAME , CPPUTYPE_OUSTRING, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintPaperFromSetup" ), HANDLE_PRINTSET_PAPER_FROM_SETUP , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintTables" ), HANDLE_PRINTSET_TABLES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintTextPlaceholder"), HANDLE_PRINTSET_PLACEHOLDER , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintSingleJobs" ), HANDLE_PRINTSET_SINGLE_JOBS , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { RTL_CONSTASCII_STRINGPARAM ( "PrintEmptyPages" ), HANDLE_PRINTSET_EMPTY_PAGES , CPPUTYPE_BOOLEAN, PROPERTY_NONE, 0},
+ { 0, 0, 0, CPPUTYPE_UNKNOWN, 0, 0 }
+ };
+ return new ChainablePropertySetInfo ( aPrintSettingsMap_Impl );
+}
+
+/******************************************************************
+ * SwXModule
+ ******************************************************************/
+/* -----------------30.03.99 15:10-------------------
+ *
+ * --------------------------------------------------*/
+Reference< uno::XInterface > SAL_CALL SwXModule_createInstance(
+ const Reference< XMultiServiceFactory > & /*rSMgr*/) throw( Exception )
+{
+ static Reference< uno::XInterface > xModule = (cppu::OWeakObject*)new SwXModule();;
+ return xModule;
+}
+/* -----------------------------17.04.01 13:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SAL_CALL SwXModule_getSupportedServiceNames() throw()
+{
+ OUString sService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GlobalSettings"));
+ const Sequence< OUString > aSeq( &sService, 1 );
+ return aSeq;
+}
+/* -----------------------------17.04.01 13:11--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SAL_CALL SwXModule_getImplementationName() throw()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("SwXModule" ) );
+}
+/*-- 17.12.98 12:19:01---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXModule::SwXModule() :
+ pxViewSettings(0),
+ pxPrintSettings(0)
+{
+}
+/*-- 17.12.98 12:19:02---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXModule::~SwXModule()
+{
+ delete pxViewSettings;
+ delete pxPrintSettings;
+}
+/*-- 17.12.98 12:19:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySet > SwXModule::getViewSettings(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!pxViewSettings)
+ {
+ ((SwXModule*)this)->pxViewSettings = new Reference< XPropertySet > ;
+ DBG_ERROR("Web oder Text?");
+ *pxViewSettings = static_cast < HelperBaseNoState * > ( new SwXViewSettings( sal_False, 0 ) );
+ }
+ return *pxViewSettings;
+}
+/*-- 17.12.98 12:19:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySet > SwXModule::getPrintSettings(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!pxPrintSettings)
+ {
+ ((SwXModule*)this)->pxPrintSettings = new Reference< XPropertySet > ;
+ DBG_ERROR("Web oder Text?");
+ *pxPrintSettings = static_cast < HelperBaseNoState * > ( new SwXPrintSettings ( PRINT_SETTINGS_MODULE ) );
+ }
+ return *pxPrintSettings;
+}
+/* -----------------------------06.04.00 10:59--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXModule::getImplementationName(void) throw( RuntimeException )
+{
+ return SwXModule_getImplementationName();
+}
+/* -----------------------------06.04.00 10:59--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwXModule::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ const Sequence< OUString > aNames = SwXModule_getSupportedServiceNames();
+ for(sal_Int32 nService = 0; nService < aNames.getLength(); nService++)
+ {
+ if(aNames.getConstArray()[nService] == rServiceName)
+ return TRUE;
+ }
+ return FALSE;
+}
+/* -----------------------------06.04.00 10:59--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXModule::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ return SwXModule_getSupportedServiceNames();
+}
+
+/******************************************************************
+ * SwXPrintSettings
+ ******************************************************************/
+/*-- 17.12.98 12:54:04---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXPrintSettings::SwXPrintSettings(SwXPrintSettingsType eType, SwDoc* pDoc)
+: ChainableHelperNoState ( lcl_createPrintSettingsInfo (), &Application::GetSolarMutex() )
+, meType(eType)
+, mpPrtOpt ( NULL )
+, mpDoc ( pDoc )
+{
+}
+/*-- 17.12.98 12:54:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXPrintSettings::~SwXPrintSettings()
+ throw()
+{
+}
+
+void SwXPrintSettings::_preSetValues ()
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
+{
+ switch (meType)
+ {
+ case PRINT_SETTINGS_MODULE:
+ mpPrtOpt = SW_MOD()->GetPrtOptions( sal_False );
+ break;
+ case PRINT_SETTINGS_WEB:
+ mpPrtOpt = SW_MOD()->GetPrtOptions( sal_True );
+ break;
+ case PRINT_SETTINGS_DOCUMENT:
+ {
+ if (!mpDoc)
+ throw IllegalArgumentException ();
+ mpPrtOpt = const_cast< SwPrintData * >(&mpDoc->getPrintData());
+ }
+ break;
+ }
+}
+
+void SwXPrintSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, const uno::Any &rValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
+{
+ sal_Bool bVal;
+ if ( rInfo.mnHandle != HANDLE_PRINTSET_ANNOTATION_MODE &&
+ rInfo.mnHandle != HANDLE_PRINTSET_FAX_NAME )
+ bVal = *(sal_Bool*)rValue.getValue();
+
+ switch( rInfo.mnHandle )
+ {
+ case HANDLE_PRINTSET_LEFT_PAGES:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintLeftPage(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_RIGHT_PAGES:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintRightPage(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_REVERSED:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintReverse(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_PROSPECT:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintProspect(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_GRAPHICS:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintGraphic(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_TABLES:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintTable(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_DRAWINGS:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintDraw(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_CONTROLS:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintControl(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_PAGE_BACKGROUND:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintPageBackground(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_BLACK_FONTS:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintBlackFont(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_SINGLE_JOBS:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintSingleJobs(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_PAPER_FROM_SETUP:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPaperFromSetup(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_ANNOTATION_MODE:
+ {
+ sal_Int16 nVal = 0;
+ rValue >>= nVal;
+ if(nVal <= text::NotePrintMode_PAGE_END)
+ mpPrtOpt->SetPrintPostIts(nVal);
+ else
+ throw lang::IllegalArgumentException();
+ }
+ break;
+ case HANDLE_PRINTSET_EMPTY_PAGES:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintEmptyPages(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_FAX_NAME:
+ {
+ OUString sString;
+ if ( rValue >>= sString)
+ mpPrtOpt->SetFaxName(sString);
+ else
+ throw lang::IllegalArgumentException();
+ }
+ break;
+ case HANDLE_PRINTSET_PROSPECT_RTL:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintProspect_RTL(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_PLACEHOLDER:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintTextPlaceholder(bVal);
+ }
+ break;
+ case HANDLE_PRINTSET_HIDDEN_TEXT:
+ {
+ bVal = *(sal_Bool*)rValue.getValue();
+ mpPrtOpt->SetPrintHiddenText(bVal);
+ }
+ break;
+ default:
+ throw UnknownPropertyException();
+ }
+}
+void SwXPrintSettings::_postSetValues ()
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
+{
+ mpPrtOpt = NULL;
+}
+
+void SwXPrintSettings::_preGetValues ()
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
+{
+ switch (meType)
+ {
+ case PRINT_SETTINGS_MODULE:
+ mpPrtOpt = SW_MOD()->GetPrtOptions( sal_False );
+ break;
+ case PRINT_SETTINGS_WEB:
+ mpPrtOpt = SW_MOD()->GetPrtOptions( sal_True );
+ break;
+ case PRINT_SETTINGS_DOCUMENT:
+ {
+ if (!mpDoc)
+ throw IllegalArgumentException ();
+ mpPrtOpt = const_cast< SwPrintData * >(&mpDoc->getPrintData());
+ }
+ break;
+ }
+}
+void SwXPrintSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue )
+ throw(UnknownPropertyException, WrappedTargetException )
+{
+ switch( rInfo.mnHandle )
+ {
+ case HANDLE_PRINTSET_LEFT_PAGES:
+ rValue <<= mpPrtOpt->IsPrintLeftPage();
+ break;
+ case HANDLE_PRINTSET_RIGHT_PAGES:
+ rValue <<= mpPrtOpt->IsPrintRightPage();
+ break;
+ case HANDLE_PRINTSET_REVERSED:
+ rValue <<= mpPrtOpt->IsPrintReverse();
+ break;
+ case HANDLE_PRINTSET_PROSPECT:
+ rValue <<= mpPrtOpt->IsPrintProspect();
+ break;
+ case HANDLE_PRINTSET_GRAPHICS:
+ rValue <<= mpPrtOpt->IsPrintGraphic();
+ break;
+ case HANDLE_PRINTSET_TABLES:
+ rValue <<= mpPrtOpt->IsPrintTable();
+ break;
+ case HANDLE_PRINTSET_DRAWINGS:
+ rValue <<= mpPrtOpt->IsPrintDraw();
+ break;
+ case HANDLE_PRINTSET_CONTROLS:
+ rValue <<= mpPrtOpt->IsPrintControl();
+ break;
+ case HANDLE_PRINTSET_PAGE_BACKGROUND:
+ rValue <<= mpPrtOpt->IsPrintPageBackground();
+ break;
+ case HANDLE_PRINTSET_BLACK_FONTS:
+ rValue <<= mpPrtOpt->IsPrintBlackFont();
+ break;
+ case HANDLE_PRINTSET_SINGLE_JOBS:
+ rValue <<= mpPrtOpt->IsPrintSingleJobs();
+ break;
+ case HANDLE_PRINTSET_EMPTY_PAGES:
+ rValue <<= mpPrtOpt->IsPrintEmptyPages();
+ break;
+ case HANDLE_PRINTSET_PAPER_FROM_SETUP:
+ rValue <<= mpPrtOpt->IsPaperFromSetup();
+ break;
+ case HANDLE_PRINTSET_ANNOTATION_MODE:
+ {
+ rValue <<= static_cast < sal_Int16 > ( mpPrtOpt->GetPrintPostIts() );
+ }
+ break;
+ case HANDLE_PRINTSET_FAX_NAME :
+ {
+ rValue <<= mpPrtOpt->GetFaxName();
+ }
+ break;
+ case HANDLE_PRINTSET_PROSPECT_RTL:
+ {
+ rValue <<= mpPrtOpt->IsPrintProspectRTL();
+ }
+ break;
+ case HANDLE_PRINTSET_PLACEHOLDER:
+ {
+ rValue <<= mpPrtOpt->IsPrintTextPlaceholder();
+ }
+ break;
+ case HANDLE_PRINTSET_HIDDEN_TEXT:
+ {
+ rValue <<= mpPrtOpt->IsPrintHiddenText();
+ }
+ break;
+ default:
+ throw UnknownPropertyException();
+ }
+}
+void SwXPrintSettings::_postGetValues ()
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
+{
+ mpPrtOpt = NULL;
+}
+/* -----------------------------06.04.00 11:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXPrintSettings::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXPrintSettings");
+}
+/* -----------------------------06.04.00 11:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Bool SwXPrintSettings::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.PrintSettings") == rServiceName;
+}
+/* -----------------------------06.04.00 11:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXPrintSettings::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.PrintSettings");
+ return aRet;
+}
+
+
+/******************************************************************
+ *
+ ******************************************************************/
+/*-- 18.12.98 11:01:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXViewSettings::SwXViewSettings(sal_Bool bWebView, SwView* pVw)
+: ChainableHelperNoState( lcl_createViewSettingsInfo (), &Application::GetSolarMutex() )
+, pView(pVw)
+, mpViewOption ( NULL )
+, mpConstViewOption ( NULL )
+, bObjectValid(sal_True)
+, bWeb(bWebView)
+, eHRulerUnit( FUNIT_CM )
+, mbApplyHRulerMetric( sal_False )
+, eVRulerUnit( FUNIT_CM )
+, mbApplyVRulerMetric( sal_False )
+{
+ // This property only exists if we have a view (ie, not at the module )
+ if ( !pView )
+ mpInfo->remove ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "HelpURL" ) ) );
+
+}
+/*-- 18.12.98 11:01:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXViewSettings::~SwXViewSettings()
+ throw()
+{
+
+}
+void SwXViewSettings::_preSetValues ()
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
+{
+ const SwViewOption* pVOpt = 0;
+ if(pView)
+ {
+ if(!IsValid())
+ return;
+ pVOpt = pView->GetWrtShell().GetViewOptions();
+ }
+ else
+ pVOpt = SW_MOD()->GetViewOption(bWeb);
+
+ mpViewOption = new SwViewOption (*pVOpt);
+ mbApplyZoom = sal_False;
+ if(pView)
+ mpViewOption->SetStarOneSetting(sal_True);
+}
+void SwXViewSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, const uno::Any &rValue )
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
+{
+ sal_Bool bVal = HANDLE_VIEWSET_ZOOM != rInfo.mnHandle ?
+ *(sal_Bool*)rValue.getValue() : sal_False;
+ // the API flag should not be set to the application's view settings
+ switch( rInfo.mnHandle )
+ {
+ case HANDLE_VIEWSET_SHOW_RULER : mpViewOption->SetViewAnyRuler(bVal); break;
+ case HANDLE_VIEWSET_HRULER : mpViewOption->SetViewHRuler(bVal); break;
+ case HANDLE_VIEWSET_VRULER : mpViewOption->SetViewVRuler(bVal);break;
+ case HANDLE_VIEWSET_VRULER_RIGHT : mpViewOption->SetVRulerRight(bVal);break;
+ case HANDLE_VIEWSET_HSCROLL : mpViewOption->SetViewHScrollBar(bVal);break;
+ case HANDLE_VIEWSET_VSCROLL : mpViewOption->SetViewVScrollBar(bVal);break;
+ case HANDLE_VIEWSET_GRAPHICS : mpViewOption->SetGraphic(bVal);break;
+ case HANDLE_VIEWSET_TABLES : mpViewOption->SetTable(bVal); break;
+ case HANDLE_VIEWSET_DRAWINGS : mpViewOption->SetDraw(bVal); break;
+ case HANDLE_VIEWSET_FIELD_COMMANDS : mpViewOption->SetFldName(bVal); break;
+ case HANDLE_VIEWSET_ANNOTATIONS : mpViewOption->SetPostIts(bVal); break;
+ case HANDLE_VIEWSET_INDEX_MARK_BACKGROUND : mpViewOption->SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS, bVal, TRUE); break;
+ case HANDLE_VIEWSET_NONPRINTING_CHARACTERS: mpViewOption->SetViewMetaChars( bVal ); break;
+ case HANDLE_VIEWSET_FOOTNOTE_BACKGROUND : mpViewOption->SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS, bVal, TRUE); break;
+ case HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND : mpViewOption->SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS, bVal, TRUE); break;
+ case HANDLE_VIEWSET_PARA_BREAKS : mpViewOption->SetParagraph(bVal); break;
+ case HANDLE_VIEWSET_SOFT_HYPHENS : mpViewOption->SetSoftHyph(bVal); break;
+ case HANDLE_VIEWSET_SPACES : mpViewOption->SetBlank(bVal); break;
+ case HANDLE_VIEWSET_PROTECTED_SPACES : mpViewOption->SetHardBlank(bVal); break;
+ case HANDLE_VIEWSET_TABSTOPS : mpViewOption->SetTab(bVal); break;
+ case HANDLE_VIEWSET_BREAKS : mpViewOption->SetLineBreak(bVal); break;
+ case HANDLE_VIEWSET_HIDDEN_TEXT : mpViewOption->SetShowHiddenField(bVal); break;
+ case HANDLE_VIEWSET_HIDDEN_CHARACTERS : mpViewOption->SetShowHiddenChar(bVal); break;
+ case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : mpViewOption->SetShowHiddenPara(bVal); break;
+ case HANDLE_VIEWSET_TABLE_BOUNDARIES : mpViewOption->SetAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES, bVal, TRUE); break;
+ case HANDLE_VIEWSET_TEXT_BOUNDARIES : mpViewOption->SetDocBoundaries(bVal); break;
+ case HANDLE_VIEWSET_SMOOTH_SCROLLING : mpViewOption->SetSmoothScroll(bVal); break;
+ case HANDLE_VIEWSET_SOLID_MARK_HANDLES : mpViewOption->SetSolidMarkHdl(bVal); break;
+ case HANDLE_VIEWSET_PREVENT_TIPS : mpViewOption->SetPreventTips(bVal); break;
+ case HANDLE_VIEWSET_IS_RASTER_VISIBLE : mpViewOption->SetGridVisible(bVal); break;
+ case HANDLE_VIEWSET_IS_SNAP_TO_RASTER : mpViewOption->SetSnap(bVal); break;
+ case HANDLE_VIEWSET_RASTER_RESOLUTION_X :
+ {
+ sal_Int32 nTmp = 0;
+ if(!(rValue >>= nTmp) || nTmp < 10)
+ throw IllegalArgumentException();
+ Size aSize( mpViewOption->GetSnapSize() );
+ aSize.Width() = MM100_TO_TWIP( nTmp );
+ mpViewOption->SetSnapSize( aSize );
+ }
+ break;
+ case HANDLE_VIEWSET_RASTER_RESOLUTION_Y :
+ {
+ sal_Int32 nTmp = 0;
+ if(!(rValue >>= nTmp) || nTmp < 10)
+ throw IllegalArgumentException();
+ Size aSize( mpViewOption->GetSnapSize() );
+ aSize.Height() = MM100_TO_TWIP( nTmp );
+ mpViewOption->SetSnapSize( aSize );
+ }
+ break;
+ case HANDLE_VIEWSET_RASTER_SUBDIVISION_X :
+ {
+ sal_Int32 nTmp = 0;
+ if(!(rValue >>= nTmp) || !(0 <= nTmp && nTmp < 100))
+ throw IllegalArgumentException();
+ mpViewOption->SetDivisionX( (short) nTmp );
+ }
+ break;
+ case HANDLE_VIEWSET_RASTER_SUBDIVISION_Y :
+ {
+ sal_Int32 nTmp = 0;
+ if(!(rValue >>= nTmp) || !(0 <= nTmp && nTmp < 100))
+ throw IllegalArgumentException();
+ mpViewOption->SetDivisionY( (short) nTmp );
+ }
+ break;
+ case HANDLE_VIEWSET_ZOOM :
+ {
+ sal_Int16 nZoom = 0;
+ if(!(rValue >>= nZoom) || nZoom > 1000 || nZoom < 5)
+ throw lang::IllegalArgumentException();
+ mpViewOption->SetZoom((sal_uInt16)nZoom);
+ mbApplyZoom = sal_True;
+ }
+ break;
+ case HANDLE_VIEWSET_ZOOM_TYPE:
+ {
+ sal_Int16 nZoom = 0;
+ if(!(rValue >>= nZoom))
+ throw IllegalArgumentException();
+ SvxZoomType eZoom = (SvxZoomType)USHRT_MAX;
+ switch (nZoom)
+ {
+ case view::DocumentZoomType::OPTIMAL:
+ eZoom = SVX_ZOOM_OPTIMAL;
+ break;
+ case view::DocumentZoomType::PAGE_WIDTH:
+ eZoom = SVX_ZOOM_PAGEWIDTH;
+ break;
+ case view::DocumentZoomType::ENTIRE_PAGE:
+ eZoom = SVX_ZOOM_WHOLEPAGE;
+ break;
+ case view::DocumentZoomType::BY_VALUE:
+ eZoom = SVX_ZOOM_PERCENT;
+ break;
+ case view::DocumentZoomType::PAGE_WIDTH_EXACT:
+ eZoom = SVX_ZOOM_PAGEWIDTH_NOBORDER;
+ break;
+ default:
+ throw IllegalArgumentException(
+ ::rtl::OUString::createFromAscii(
+ "SwXViewSettings: invalid zoom type"), 0, 0);
+ break;
+ }
+ if(eZoom < USHRT_MAX)
+ {
+ mpViewOption->SetZoomType( eZoom );
+ mbApplyZoom = sal_True;
+ }
+ }
+ break;
+ case HANDLE_VIEWSET_ONLINE_LAYOUT :
+ {
+ if( pView && !bVal != !pView->GetWrtShell().getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE) )
+ pView->GetDocShell()->ToggleBrowserMode(bVal, pView );
+ }
+ break;
+ case HANDLE_VIEWSET_HELP_URL :
+ {
+ if ( pView )
+ {
+ OUString sHelpURL;
+ if ( ! ( rValue >>= sHelpURL ) )
+ throw IllegalArgumentException();
+
+ INetURLObject aHID( sHelpURL );
+ if ( aHID.GetProtocol() == INET_PROT_HID )
+ pView->GetEditWin().SetHelpId( rtl::OUStringToOString( aHID.GetURLPath(), RTL_TEXTENCODING_UTF8 ) );
+ else
+ throw IllegalArgumentException ();
+ }
+ else
+ throw UnknownPropertyException();
+ }
+ break;
+ case HANDLE_VIEWSET_HORI_RULER_METRIC:
+ case HANDLE_VIEWSET_VERT_RULER_METRIC:
+ {
+ sal_Int32 nUnit = -1;
+ if( rValue >>= nUnit )
+ switch( nUnit )
+ {
+ case FUNIT_MM:
+ case FUNIT_CM:
+ case FUNIT_POINT:
+ case FUNIT_PICA:
+ case FUNIT_INCH:
+ if( rInfo.mnHandle == HANDLE_VIEWSET_HORI_RULER_METRIC )
+ {
+ eHRulerUnit = nUnit;
+ mbApplyHRulerMetric = sal_True;
+ }
+ else
+ {
+ eVRulerUnit = nUnit;
+ mbApplyVRulerMetric = sal_True;
+ }
+ break;
+ default:
+ throw IllegalArgumentException();
+ }
+ }
+ break;
+ default:
+ throw UnknownPropertyException();
+ }
+}
+
+void SwXViewSettings::_postSetValues ()
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
+{
+ if( pView )
+ {
+ if(mbApplyZoom )
+ pView->SetZoom( (SvxZoomType)mpViewOption->GetZoomType(),
+ mpViewOption->GetZoom(), sal_True );
+ if(mbApplyHRulerMetric)
+ pView->ChangeTabMetric((FieldUnit)eHRulerUnit);
+ if(mbApplyVRulerMetric)
+ pView->ChangeVLinealMetric((FieldUnit)eVRulerUnit);
+
+ }
+ else
+ {
+ if(mbApplyHRulerMetric)
+ SW_MOD()->ApplyRulerMetric( (FieldUnit)eHRulerUnit, sal_True, bWeb );
+ if(mbApplyVRulerMetric)
+ SW_MOD()->ApplyRulerMetric( (FieldUnit)eVRulerUnit, sal_False, bWeb );
+ }
+
+
+ SW_MOD()->ApplyUsrPref( *mpViewOption, pView, pView ? VIEWOPT_DEST_VIEW_ONLY
+ : bWeb ? VIEWOPT_DEST_WEB
+ : VIEWOPT_DEST_TEXT );
+
+
+ delete mpViewOption;
+ mpViewOption = NULL;
+}
+
+void SwXViewSettings::_preGetValues ()
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
+{
+ if(pView)
+ {
+ if(!IsValid())
+ return;
+ mpConstViewOption = pView->GetWrtShell().GetViewOptions();
+ }
+ else
+ mpConstViewOption = SW_MOD()->GetViewOption(bWeb);
+}
+void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, uno::Any & rValue )
+ throw(UnknownPropertyException, WrappedTargetException )
+{
+ sal_Bool bBool = TRUE;
+ sal_Bool bBoolVal;
+ switch( rInfo.mnHandle )
+ {
+ case HANDLE_VIEWSET_SHOW_RULER: bBoolVal = mpConstViewOption->IsViewAnyRuler(); break;
+ case HANDLE_VIEWSET_HRULER : bBoolVal = mpConstViewOption->IsViewHRuler(TRUE); break;
+ case HANDLE_VIEWSET_VRULER : bBoolVal = mpConstViewOption->IsViewVRuler(TRUE);break;
+ case HANDLE_VIEWSET_VRULER_RIGHT : bBoolVal = mpConstViewOption->IsVRulerRight();break;
+ case HANDLE_VIEWSET_HSCROLL: bBoolVal = mpConstViewOption->IsViewHScrollBar();break;
+ case HANDLE_VIEWSET_VSCROLL: bBoolVal = mpConstViewOption->IsViewVScrollBar();break;
+ case HANDLE_VIEWSET_GRAPHICS : bBoolVal = mpConstViewOption->IsGraphic();break;
+ case HANDLE_VIEWSET_TABLES : bBoolVal = mpConstViewOption->IsTable(); break;
+ case HANDLE_VIEWSET_DRAWINGS : bBoolVal = mpConstViewOption->IsDraw(); break;
+ case HANDLE_VIEWSET_FIELD_COMMANDS : bBoolVal = mpConstViewOption->IsFldName(); break;
+ case HANDLE_VIEWSET_ANNOTATIONS : bBoolVal = mpConstViewOption->IsPostIts(); break;
+ case HANDLE_VIEWSET_INDEX_MARK_BACKGROUND : bBoolVal = SwViewOption::IsFieldShadings(); break;
+ case HANDLE_VIEWSET_NONPRINTING_CHARACTERS: bBoolVal = mpConstViewOption->IsViewMetaChars(); break;
+ case HANDLE_VIEWSET_FOOTNOTE_BACKGROUND : bBoolVal = SwViewOption::IsFieldShadings(); break;
+ case HANDLE_VIEWSET_TEXT_FIELD_BACKGROUND : bBoolVal = SwViewOption::IsFieldShadings(); break;
+ case HANDLE_VIEWSET_PARA_BREAKS : bBoolVal = mpConstViewOption->IsParagraph(sal_True); break;
+ case HANDLE_VIEWSET_SOFT_HYPHENS : bBoolVal = mpConstViewOption->IsSoftHyph(); break;
+ case HANDLE_VIEWSET_SPACES : bBoolVal = mpConstViewOption->IsBlank(sal_True); break;
+ case HANDLE_VIEWSET_PROTECTED_SPACES : bBoolVal = mpConstViewOption->IsHardBlank(); break;
+ case HANDLE_VIEWSET_TABSTOPS : bBoolVal = mpConstViewOption->IsTab(sal_True); break;
+ case HANDLE_VIEWSET_BREAKS : bBoolVal = mpConstViewOption->IsLineBreak(sal_True); break;
+ case HANDLE_VIEWSET_HIDDEN_TEXT : bBoolVal = mpConstViewOption->IsShowHiddenField(); break;
+ case HANDLE_VIEWSET_HIDDEN_CHARACTERS : bBoolVal = mpConstViewOption->IsShowHiddenChar(sal_True); break;
+ case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : bBoolVal = mpConstViewOption->IsShowHiddenPara(); break;
+ case HANDLE_VIEWSET_TABLE_BOUNDARIES : bBoolVal = SwViewOption::IsTableBoundaries(); break;
+ case HANDLE_VIEWSET_TEXT_BOUNDARIES : bBoolVal = SwViewOption::IsDocBoundaries(); break;
+ case HANDLE_VIEWSET_SMOOTH_SCROLLING : bBoolVal = mpConstViewOption->IsSmoothScroll(); break;
+ case HANDLE_VIEWSET_SOLID_MARK_HANDLES : bBoolVal = mpConstViewOption->IsSolidMarkHdl(); break;
+ case HANDLE_VIEWSET_PREVENT_TIPS : bBoolVal = mpConstViewOption->IsPreventTips(); break;
+ case HANDLE_VIEWSET_IS_RASTER_VISIBLE : bBoolVal = mpConstViewOption->IsGridVisible(); break;
+ case HANDLE_VIEWSET_IS_SNAP_TO_RASTER : bBoolVal = mpConstViewOption->IsSnap(); break;
+ case HANDLE_VIEWSET_RASTER_RESOLUTION_X :
+ bBool = FALSE;
+ rValue <<= (sal_Int32) TWIP_TO_MM100(mpConstViewOption->GetSnapSize().Width());
+ break;
+ case HANDLE_VIEWSET_RASTER_RESOLUTION_Y :
+ bBool = FALSE;
+ rValue <<= (sal_Int32) TWIP_TO_MM100(mpConstViewOption->GetSnapSize().Height());
+ break;
+ case HANDLE_VIEWSET_RASTER_SUBDIVISION_X :
+ bBool = FALSE;
+ rValue <<= (sal_Int32) mpConstViewOption->GetDivisionX();
+ break;
+ case HANDLE_VIEWSET_RASTER_SUBDIVISION_Y :
+ bBool = FALSE;
+ rValue <<= (sal_Int32) mpConstViewOption->GetDivisionY();
+ break;
+ case HANDLE_VIEWSET_ZOOM :
+ bBool = FALSE;
+ rValue <<= (sal_Int16)mpConstViewOption->GetZoom();
+ break;
+ case HANDLE_VIEWSET_ZOOM_TYPE:
+ {
+ bBool = FALSE;
+ sal_Int16 nRet(0);
+ switch (mpConstViewOption->GetZoomType())
+ {
+ case SVX_ZOOM_OPTIMAL:
+ nRet = view::DocumentZoomType::OPTIMAL;
+ break;
+ case SVX_ZOOM_PAGEWIDTH:
+ nRet = view::DocumentZoomType::PAGE_WIDTH;
+ break;
+ case SVX_ZOOM_WHOLEPAGE:
+ nRet = view::DocumentZoomType::ENTIRE_PAGE;
+ break;
+ case SVX_ZOOM_PERCENT:
+ nRet = view::DocumentZoomType::BY_VALUE;
+ break;
+ case SVX_ZOOM_PAGEWIDTH_NOBORDER:
+ nRet = view::DocumentZoomType::PAGE_WIDTH_EXACT;
+ break;
+ default:
+ OSL_ENSURE(false, "SwXViewSettings: invalid zoom type");
+ break;
+ }
+ rValue <<= nRet;
+ }
+ break;
+ case HANDLE_VIEWSET_ONLINE_LAYOUT:
+ if(pView)
+ bBoolVal = pView->GetWrtShell().getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE);
+ break;
+ case HANDLE_VIEWSET_HELP_URL :
+ {
+ if ( pView )
+ {
+ bBool = sal_False;
+ OUStringBuffer sHelpURL;
+ sHelpURL.appendAscii ( INET_HID_SCHEME );
+ SwEditWin &rEditWin = pView->GetEditWin();
+ sHelpURL.append( rtl::OStringToOUString( rEditWin.GetHelpId(), RTL_TEXTENCODING_UTF8 ) );
+ rValue <<= sHelpURL.makeStringAndClear();
+ }
+ else
+ throw UnknownPropertyException();
+ }
+ break;
+ case HANDLE_VIEWSET_HORI_RULER_METRIC:
+ {
+ if ( pView )
+ {
+ FieldUnit eUnit;
+ pView->GetHLinealMetric( eUnit );
+ rValue <<= (sal_Int32)eUnit;
+ }
+ else
+ {
+ const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( bWeb );
+ rValue <<= (sal_Int32)pUsrPref->GetHScrollMetric();
+ }
+ bBool = sal_False;
+ }
+ break;
+ case HANDLE_VIEWSET_VERT_RULER_METRIC:
+ {
+ if ( pView )
+ {
+ FieldUnit eUnit;
+ pView->GetVLinealMetric( eUnit );
+ rValue <<= (sal_Int32)eUnit;
+ }
+ else
+ {
+ const SwMasterUsrPref* pUsrPref = SW_MOD()->GetUsrPref( bWeb );
+ rValue <<= (sal_Int32)pUsrPref->GetVScrollMetric();
+ }
+ bBool = sal_False;
+ }
+ break;
+ default: DBG_ERROR("Diese Id gibt's nicht!");
+ }
+ if( bBool )
+ rValue.setValue(&bBoolVal, ::getBooleanCppuType());
+}
+void SwXViewSettings::_postGetValues ()
+ throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException )
+{
+ mpConstViewOption = NULL;
+}
+
+OUString SwXViewSettings::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXViewSettings");
+}
+
+sal_Bool SwXViewSettings::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.text.ViewSettings") == rServiceName;
+}
+
+Sequence< OUString > SwXViewSettings::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.ViewSettings");
+ return aRet;
+}
+
diff --git a/sw/source/ui/uno/unomodule.cxx b/sw/source/ui/uno/unomodule.cxx
new file mode 100644
index 000000000000..85ef0f10c1d7
--- /dev/null
+++ b/sw/source/ui/uno/unomodule.cxx
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+// System - Includes -----------------------------------------------------
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/DispatchResultState.hpp>
+
+#include "swmodule.hxx"
+#include "swdll.hxx"
+#include "unomodule.hxx"
+#include <sfx2/objface.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+
+::rtl::OUString SAL_CALL SwUnoModule_getImplementationName() throw( uno::RuntimeException )
+{
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Writer.WriterModule" ) );
+}
+
+uno::Sequence< rtl::OUString > SAL_CALL SwUnoModule_getSupportedServiceNames() throw( uno::RuntimeException )
+{
+ uno::Sequence< rtl::OUString > aSeq( 1 );
+ aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.ModuleDispatcher"));
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL SwUnoModule_createInstance(
+ const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ return uno::Reference< uno::XInterface >( dynamic_cast< frame::XDispatch * >(new SwUnoModule( rSMgr )), uno::UNO_QUERY );
+}
+
+ // XNotifyingDispatch
+void SAL_CALL SwUnoModule::dispatchWithNotification( const util::URL& aURL, const uno::Sequence< beans::PropertyValue >& aArgs, const uno::Reference< frame::XDispatchResultListener >& xListener ) throw (uno::RuntimeException)
+{
+ // there is no guarantee, that we are holded alive during this method!
+ // May the outside dispatch container will be updated by a CONTEXT_CHANGED
+ // asynchronous ...
+ uno::Reference< uno::XInterface > xThis(static_cast< frame::XNotifyingDispatch* >(this));
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SwDLL::Init();
+ const SfxSlot* pSlot = SW_MOD()->GetInterface()->GetSlot( aURL.Complete );
+
+ sal_Int16 aState = frame::DispatchResultState::DONTKNOW;
+ if ( !pSlot )
+ aState = frame::DispatchResultState::FAILURE;
+ else
+ {
+ SfxRequest aReq( pSlot, aArgs, SFX_CALLMODE_SYNCHRON, SW_MOD()->GetPool() );
+ const SfxPoolItem* pResult = SW_MOD()->ExecuteSlot( aReq );
+ if ( pResult )
+ aState = frame::DispatchResultState::SUCCESS;
+ else
+ aState = frame::DispatchResultState::FAILURE;
+ }
+
+ if ( xListener.is() )
+ {
+ xListener->dispatchFinished(
+ frame::DispatchResultEvent(
+ xThis, aState, uno::Any()));
+ }
+}
+
+ // XDispatch
+void SAL_CALL SwUnoModule::dispatch( const util::URL& aURL, const uno::Sequence< beans::PropertyValue >& aArgs ) throw( uno::RuntimeException )
+{
+ dispatchWithNotification(aURL, aArgs, uno::Reference< frame::XDispatchResultListener >());
+}
+
+void SAL_CALL SwUnoModule::addStatusListener(
+ const uno::Reference< frame::XStatusListener > & /*xControl*/,
+ const util::URL& /*aURL*/)
+ throw( uno::RuntimeException )
+{
+}
+
+void SAL_CALL SwUnoModule::removeStatusListener(
+ const uno::Reference< frame::XStatusListener > & /*xControl*/,
+ const util::URL& /*aURL*/) throw( uno::RuntimeException )
+{
+}
+
+SEQUENCE< REFERENCE< XDISPATCH > > SAL_CALL SwUnoModule::queryDispatches(
+ const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescripts ) throw( uno::RuntimeException )
+{
+ sal_Int32 nCount = seqDescripts.getLength();
+ SEQUENCE< REFERENCE< XDISPATCH > > lDispatcher( nCount );
+
+ for( sal_Int32 i=0; i<nCount; ++i )
+ {
+ lDispatcher[i] = queryDispatch( seqDescripts[i].FeatureURL ,
+ seqDescripts[i].FrameName ,
+ seqDescripts[i].SearchFlags );
+ }
+
+ return lDispatcher;
+}
+
+// XDispatchProvider
+REFERENCE< XDISPATCH > SAL_CALL SwUnoModule::queryDispatch(
+ const UNOURL& aURL, const OUSTRING& /*sTargetFrameName*/,
+ sal_Int32 /*eSearchFlags*/ ) throw( uno::RuntimeException )
+{
+ REFERENCE< XDISPATCH > xReturn;
+
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SwDLL::Init();
+ const SfxSlot* pSlot = SW_MOD()->GetInterface()->GetSlot( aURL.Complete );
+ if ( pSlot )
+ xReturn = REFERENCE< XDISPATCH >(static_cast< XDISPATCH* >(this), uno::UNO_QUERY);
+
+ return xReturn;
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL SwUnoModule::getImplementationName( ) throw(uno::RuntimeException)
+{
+ return SwUnoModule_getImplementationName();
+}
+
+sal_Bool SAL_CALL SwUnoModule::supportsService( const ::rtl::OUString& sServiceName ) throw(uno::RuntimeException)
+{
+ UNOSEQUENCE< UNOOUSTRING > seqServiceNames = getSupportedServiceNames();
+ const UNOOUSTRING* pArray = seqServiceNames.getConstArray();
+ for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ )
+ {
+ if ( pArray[nCounter] == sServiceName )
+ {
+ return sal_True ;
+ }
+ }
+ return sal_False ;
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL SwUnoModule::getSupportedServiceNames( ) throw(uno::RuntimeException)
+{
+ return SwUnoModule_getSupportedServiceNames();
+}
+
diff --git a/sw/source/ui/uno/unomodule.hxx b/sw/source/ui/uno/unomodule.hxx
new file mode 100644
index 000000000000..0fc02fc21562
--- /dev/null
+++ b/sw/source/ui/uno/unomodule.hxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SW_UNOMODULE_HXX
+#define _SW_UNOMODULE_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/frame/DispatchDescriptor.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <cppuhelper/implbase3.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace lang
+ {
+ class XMultiServiceFactory;
+ }
+ namespace beans
+ {
+ struct PropertyValue;
+ }
+ }
+ }
+}
+
+#define REFERENCE ::com::sun::star::uno::Reference
+#define SEQUENCE ::com::sun::star::uno::Sequence
+#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
+#define REFERENCE ::com::sun::star::uno::Reference
+#define SEQUENCE ::com::sun::star::uno::Sequence
+#define XDISPATCH ::com::sun::star::frame::XDispatch
+#define XNOTIFYINGDISPATCH ::com::sun::star::frame::XNotifyingDispatch
+#define OUSTRING ::rtl::OUString
+#define UNOURL ::com::sun::star::util::URL
+#define DISPATCHDESCRIPTOR ::com::sun::star::frame::DispatchDescriptor
+
+class SwUnoModule : public ::cppu::WeakImplHelper3< ::com::sun::star::frame::XDispatchProvider, ::com::sun::star::frame::XNotifyingDispatch, ::com::sun::star::lang::XServiceInfo >
+{
+ REFERENCE < ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+
+public:
+ SwUnoModule( const REFERENCE < ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
+ : m_xFactory( xFactory )
+ {}
+
+ // XNotifyingDispatch
+ virtual void SAL_CALL dispatchWithNotification( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XDispatch
+ virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL removeStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xControl, const ::com::sun::star::util::URL& aURL) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XDispatchProvider
+ virtual SEQUENCE< REFERENCE< XDISPATCH > > SAL_CALL queryDispatches( const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescriptor ) throw( RUNTIMEEXCEPTION ) ;
+ virtual REFERENCE< XDISPATCH > SAL_CALL queryDispatch( const UNOURL & aURL ,
+ const OUSTRING & sTargetFrameName,
+ sal_Int32 eSearchFlags ) throw( RUNTIMEEXCEPTION ) ;
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+#endif
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
new file mode 100644
index 000000000000..280ee131f958
--- /dev/null
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -0,0 +1,4171 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <vos/mutex.hxx>
+#include <vcl/image.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/print.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/sfxbasecontroller.hxx>
+#include <sfx2/docfile.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <cmdid.h>
+#include <swtypes.hxx>
+#include <wdocsh.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <pview.hxx>
+#include <srcview.hxx>
+#include <viewsh.hxx>
+#include <pvprtdat.hxx>
+#include <printdata.hxx>
+#include <svl/stritem.hxx>
+#include <unotxdoc.hxx>
+#include <svl/numuno.hxx>
+#include <fldbas.hxx>
+#include <unotextbodyhf.hxx>
+#include <unotextrange.hxx>
+#include <unotextcursor.hxx>
+#include <unosett.hxx>
+#include <unocoll.hxx>
+#include <unoredlines.hxx>
+#include <unosrch.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/request.hxx>
+#include <sfx2/objsh.hxx> // SfxObjectShellRef <-> SV_DECL_REF(SfxObjectShell)
+#include <unoprnms.hxx>
+#include <unostyle.hxx>
+#include <unodraw.hxx>
+#include <svl/eitem.hxx>
+#include <pagedesc.hxx>
+#include <svtools/txtcmp.hxx>
+#include <unocrsr.hxx>
+#include <unofield.hxx>
+#include <unoidx.hxx>
+#include <unoflatpara.hxx>
+#include <unotxvw.hxx>
+#include <poolfmt.hxx>
+#include <globdoc.hxx>
+#include <viewopt.hxx>
+#include <unochart.hxx>
+#include <doc.hxx>
+#include <charatr.hxx>
+#include <svx/xmleohlp.hxx>
+#include <globals.hrc>
+#include <unomid.h>
+#include <unotools/printwarningoptions.hxx>
+#include <com/sun/star/util/SearchOptions.hpp>
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <com/sun/star/document/RedlineDisplayType.hpp>
+#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+#include <com/sun/star/reflection/XIdlClassProvider.hpp>
+#include <sfx2/linkmgr.hxx>
+#include <svx/unofill.hxx>
+#include <editeng/unolingu.hxx>
+#include <sfx2/progress.hxx>
+#include <swmodule.hxx>
+#include <docstat.hxx>
+#include <modcfg.hxx>
+#include <ndtxt.hxx>
+#include <utlui.hrc>
+#include <swcont.hxx>
+#include <unodefaults.hxx>
+#include <SwXDocumentSettings.hxx>
+#include <doc.hxx>
+#include <editeng/forbiddencharacterstable.hxx>
+#include <svl/zforlist.hxx>
+#include <drawdoc.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <osl/file.hxx>
+#include <comphelper/storagehelper.hxx>
+
+
+// --> FME 2004-06-08 #i12836# enhanced pdf export
+#include <EnhancedPDFExportHelper.hxx>
+// <--
+#include <numrule.hxx>
+
+///////////////////////////Modified on Jun. 14th//////////////////////////
+///////////////////////for getDocumentLanguages///////////////////////////
+//-->
+#include <editeng/langitem.hxx>
+#include <doc.hxx>
+#include <docary.hxx> //SwCharFmts
+#include <i18npool/mslangid.hxx>
+
+#include <format.hxx>
+#include <charfmt.hxx> //SwCharFmt
+#include <fmtcol.hxx> //SwTxtFmtColl
+#include <unostyle.hxx> //SwAutoStyleFamily
+#include <istyleaccess.hxx> // handling of automatic styles
+
+#include <svl/stylepool.hxx>
+#include <swatrset.hxx>
+#include <view.hxx>
+#include <srcview.hxx>
+
+//#include <com/sun/star/i18n/ScriptType.hpp>
+#include <svtools/langtab.hxx>
+#include <map>
+#include <set>
+#include <vector>
+
+#include <editeng/eeitem.hxx>
+#include <editeng/editeng.hxx>
+#include <svx/svdoutl.hxx>
+#include <svl/languageoptions.hxx>
+#include <svx/svdview.hxx>
+
+//
+//<--
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::i18n;
+using ::rtl::OUString;
+using ::osl::FileBase;
+
+/* -----------------------------17.01.01 15:43--------------------------------
+
+ ---------------------------------------------------------------------------*/
+#define SW_CREATE_DASH_TABLE 0x01
+#define SW_CREATE_GRADIENT_TABLE 0x02
+#define SW_CREATE_HATCH_TABLE 0x03
+#define SW_CREATE_BITMAP_TABLE 0x04
+#define SW_CREATE_TRANSGRADIENT_TABLE 0x05
+#define SW_CREATE_MARKER_TABLE 0x06
+#define SW_CREATE_DRAW_DEFAULTS 0x07
+
+
+/******************************************************************************
+ *
+ ******************************************************************************/
+
+extern bool lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst );
+
+SwPrintUIOptions * lcl_GetPrintUIOptions(
+ SwDocShell * pDocShell,
+ const SfxViewShell * pView )
+{
+ if (!pDocShell)
+ return NULL;
+
+ const BOOL bWebDoc = NULL != dynamic_cast< const SwWebDocShell * >(pDocShell);
+ const bool bSwSrcView = NULL != dynamic_cast< const SwSrcView * >(pView);
+ const SwView * pSwView = dynamic_cast< const SwView * >(pView);
+ const bool bHasSelection = pSwView ? pSwView->HasSelection( sal_False ) : false; // check for any selection, not just text selection
+ const bool bHasPostIts = lcl_GetPostIts( pDocShell->GetDoc(), 0 );
+
+ // get default values to use in dialog from documents SwPrintData
+ const SwPrintData &rPrintData = pDocShell->GetDoc()->getPrintData();
+
+ return new SwPrintUIOptions( bWebDoc, bSwSrcView, bHasSelection, bHasPostIts, rPrintData );
+}
+
+////////////////////////////////////////////////////////////
+
+
+SwTxtFmtColl *lcl_GetParaStyle(const String& rCollName, SwDoc* pDoc)
+{
+ SwTxtFmtColl* pColl = pDoc->FindTxtFmtCollByName( rCollName );
+ if( !pColl )
+ {
+ sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rCollName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if( USHRT_MAX != nId )
+ pColl = pDoc->GetTxtCollFromPool( nId );
+ }
+ return pColl;
+}
+void lcl_DisposeView( SfxViewFrame* pToClose, SwDocShell* pDocShell )
+{
+ // check if the view frame still exists
+ SfxViewFrame* pFound = SfxViewFrame::GetFirst( pDocShell,
+ FALSE );
+ while(pFound)
+ {
+ if( pFound == pToClose)
+ {
+ pToClose->DoClose();
+ break;
+ }
+ pFound = SfxViewFrame::GetNext( *pFound,
+ pDocShell,
+ FALSE );
+ }
+}
+/* -----------------------------10.03.00 18:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const Sequence< sal_Int8 > & SwXTextDocument::getUnoTunnelId()
+{
+ static Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------10.03.00 18:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+sal_Int64 SAL_CALL SwXTextDocument::getSomething( const Sequence< sal_Int8 >& rId )
+ throw(RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ));
+ }
+
+ sal_Int64 nRet = SfxBaseModel::getSomething( rId );
+ if ( nRet )
+ return nRet;
+ else
+ {
+ GetNumberFormatter();
+ Any aNumTunnel = xNumFmtAgg->queryAggregation(::getCppuType((Reference<XUnoTunnel>*)0));
+ Reference<XUnoTunnel> xNumTunnel;
+ aNumTunnel >>= xNumTunnel;
+ if(xNumTunnel.is())
+ return xNumTunnel->getSomething(rId);
+ }
+
+ return SfxBaseModel::getSomething( rId );
+}
+/* -----------------------------16.03.00 14:12--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Any SAL_CALL SwXTextDocument::queryInterface( const uno::Type& rType ) throw(RuntimeException)
+{
+ Any aRet = SwXTextDocumentBaseClass::queryInterface(rType);
+ if ( !aRet.hasValue() )
+ aRet = SfxBaseModel::queryInterface(rType);
+ if ( !aRet.hasValue() &&
+ rType == ::getCppuType((Reference<lang::XMultiServiceFactory>*)0))
+ {
+ Reference<lang::XMultiServiceFactory> xTmp = this;
+ aRet <<= xTmp;
+ }
+
+ if ( !aRet.hasValue()
+ && rType != ::getCppuType((Reference< com::sun::star::document::XDocumentEventBroadcaster>*)0)
+ && rType != ::getCppuType((Reference< com::sun::star::frame::XController>*)0)
+ && rType != ::getCppuType((Reference< com::sun::star::frame::XFrame>*)0)
+ && rType != ::getCppuType((Reference< com::sun::star::script::XInvocation>*)0)
+ && rType != ::getCppuType((Reference< com::sun::star::reflection::XIdlClassProvider>*)0)
+ && rType != ::getCppuType((Reference< com::sun::star::beans::XFastPropertySet>*)0)
+ && rType != ::getCppuType((Reference< com::sun::star::awt::XWindow>*)0))
+ {
+ GetNumberFormatter();
+ if(xNumFmtAgg.is())
+ aRet = xNumFmtAgg->queryAggregation(rType);
+ }
+ return aRet;
+}
+/* -----------------------------16.03.00 14:12--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextDocument::acquire()throw()
+{
+ SfxBaseModel::acquire();
+}
+/* -----------------------------16.03.00 14:12--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextDocument::release()throw()
+{
+ SfxBaseModel::release();
+}
+/* -----------------------------07.12.00 11:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference< XAdapter > SwXTextDocument::queryAdapter( ) throw(RuntimeException)
+{
+ return SfxBaseModel::queryAdapter();
+}
+/* -----------------------------16.03.00 14:12--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes() throw(RuntimeException)
+{
+ Sequence< uno::Type > aBaseTypes = SfxBaseModel::getTypes();
+ Sequence< uno::Type > aTextTypes = SwXTextDocumentBaseClass::getTypes();
+
+ Sequence< uno::Type > aNumTypes;
+ GetNumberFormatter();
+ if(xNumFmtAgg.is())
+ {
+ const uno::Type& rProvType = ::getCppuType((Reference <XTypeProvider>*)0);
+ Any aNumProv = xNumFmtAgg->queryAggregation(rProvType);
+ Reference<XTypeProvider> xNumProv;
+ if(aNumProv >>= xNumProv)
+ {
+ aNumTypes = xNumProv->getTypes();
+ }
+ }
+ long nIndex = aBaseTypes.getLength();
+ // don't forget the lang::XMultiServiceFactory
+ aBaseTypes.realloc(aBaseTypes.getLength() + aTextTypes.getLength() + aNumTypes.getLength() + 1);
+ uno::Type* pBaseTypes = aBaseTypes.getArray();
+ const uno::Type* pTextTypes = aTextTypes.getConstArray();
+ long nPos;
+ for(nPos = 0; nPos < aTextTypes.getLength(); nPos++)
+ {
+ pBaseTypes[nIndex++] = pTextTypes[nPos];
+ }
+ const uno::Type* pNumTypes = aNumTypes.getConstArray();
+ for(nPos = 0; nPos < aNumTypes.getLength(); nPos++)
+ {
+ pBaseTypes[nIndex++] = pNumTypes[nPos];
+ }
+ pBaseTypes[nIndex++] = ::getCppuType((Reference<lang::XMultiServiceFactory>*)0);
+ return aBaseTypes;
+}
+/*-- 18.12.98 11:52:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextDocument::SwXTextDocument(SwDocShell* pShell) :
+ SfxBaseModel(pShell),
+
+ aRefreshCont ( static_cast < XTextDocument* > ( this ) ),
+
+ pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_DOCUMENT)),
+
+ pDocShell(pShell),
+
+ bObjectValid(pShell != 0),
+
+ pDrawPage(0),
+ pxXDrawPage(0),
+
+ pxXNumberingRules(0),
+ pxXFootnotes(0),
+ pxXFootnoteSettings(0),
+ pxXEndnotes(0),
+ pxXEndnoteSettings(0),
+ pxXReferenceMarks(0),
+ pxXTextFieldTypes(0),
+ pxXTextFieldMasters(0),
+ pxXTextSections(0),
+ pxXBookmarks(0),
+ pxXTextTables(0),
+ pxXTextFrames(0),
+ pxXGraphicObjects(0),
+ pxXEmbeddedObjects(0),
+ pxXStyleFamilies(0),
+ pxXAutoStyles(0),
+ pxXChapterNumbering(0),
+ pxXDocumentIndexes(0),
+
+ pxXLineNumberingProperties(0),
+ pxLinkTargetSupplier(0),
+ pxXRedlines(0),
+ m_pHiddenViewFrame(0),
+ m_pPrintUIOptions( NULL ),
+ m_pRenderData( NULL )
+{
+}
+/*-- 18.12.98 11:53:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextDocument::~SwXTextDocument()
+{
+ InitNewDoc();
+ if(xNumFmtAgg.is())
+ {
+ Reference< XInterface > x0;
+ xNumFmtAgg->setDelegator(x0);
+ xNumFmtAgg = 0;
+ }
+ delete m_pPrintUIOptions;
+ delete m_pRenderData;
+}
+
+
+/*-- 18.12.98 11:55:08---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+/* -----------------18.12.98 12:49-------------------
+ *
+ * --------------------------------------------------*/
+SwXDocumentPropertyHelper * SwXTextDocument::GetPropertyHelper ()
+{
+ if(!xPropertyHelper.is())
+ {
+ pPropertyHelper = new SwXDocumentPropertyHelper(*pDocShell->GetDoc());
+ xPropertyHelper = (cppu::OWeakObject*)pPropertyHelper;
+ }
+ return pPropertyHelper;
+}
+void SwXTextDocument::GetNumberFormatter()
+{
+ if(IsValid())
+ {
+ if(!xNumFmtAgg.is())
+ {
+ if ( pDocShell->GetDoc() )
+ {
+ SvNumberFormatsSupplierObj* pNumFmt = new SvNumberFormatsSupplierObj(
+ pDocShell->GetDoc()->GetNumberFormatter( sal_True ));
+ Reference< util::XNumberFormatsSupplier > xTmp = pNumFmt;
+ xNumFmtAgg = Reference< XAggregation >(xTmp, UNO_QUERY);
+ }
+ if(xNumFmtAgg.is())
+ xNumFmtAgg->setDelegator((cppu::OWeakObject*)(SwXTextDocumentBaseClass*)this);
+ }
+ else
+ {
+ const uno::Type& rTunnelType = ::getCppuType((Reference <XUnoTunnel>*)0);
+ Any aNumTunnel = xNumFmtAgg->queryAggregation(rTunnelType);
+ SvNumberFormatsSupplierObj* pNumFmt = 0;
+ Reference< XUnoTunnel > xNumTunnel;
+ if(aNumTunnel >>= xNumTunnel)
+ {
+ pNumFmt = reinterpret_cast<SvNumberFormatsSupplierObj*>(
+ xNumTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId()));
+
+ }
+ DBG_ASSERT(pNumFmt, "No number formatter available");
+ if(!pNumFmt->GetNumberFormatter())
+ pNumFmt->SetNumberFormatter(pDocShell->GetDoc()->GetNumberFormatter( sal_True ));
+ }
+ }
+}
+/*-- 18.12.98 11:55:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XText > SwXTextDocument::getText(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!xBodyText.is())
+ {
+ pBodyText = new SwXBodyText(pDocShell->GetDoc());
+ xBodyText = pBodyText;
+ }
+ return xBodyText;
+}
+/*-- 18.12.98 11:55:11---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::reformat(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+}
+/*-- 18.12.98 11:55:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::lockControllers(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(IsValid())
+ {
+ UnoActionContext* pContext = new UnoActionContext(pDocShell->GetDoc());
+ aActionArr.Insert(pContext, 0);
+ }
+ else
+ throw RuntimeException();
+}
+/*-- 18.12.98 11:55:16---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::unlockControllers(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(aActionArr.Count())
+ {
+ UnoActionContext* pContext = aActionArr.GetObject(0);
+ aActionArr.Remove(0);
+ delete pContext;
+ }
+ else
+ throw RuntimeException();
+}
+/*-- 18.12.98 11:55:17---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextDocument::hasControllersLocked(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ return aActionArr.Count() > 0;
+}
+/*-- 18.12.98 13:12:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< frame::XController > SwXTextDocument::getCurrentController(void) throw( RuntimeException )
+{
+ return SfxBaseModel::getCurrentController();
+}
+/*-- 18.12.98 13:12:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::setCurrentController(const Reference< frame::XController > & xController)
+ throw( NoSuchElementException, RuntimeException )
+{
+ SfxBaseModel::setCurrentController(xController);
+}
+/* -----------------27.01.99 11:48-------------------
+ *
+ * --------------------------------------------------*/
+Reference< XInterface > SwXTextDocument::getCurrentSelection() throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ Reference< XInterface > xRef;
+ if(IsValid())
+ {
+
+ const TypeId aTypeId = TYPE(SwView);
+ SwView* pView = (SwView*)SfxViewShell::GetFirst(&aTypeId);
+ while(pView && pView->GetObjectShell() != pDocShell)
+ {
+ pView = (SwView*)SfxViewShell::GetNext(*pView, &aTypeId);
+ }
+ if(pView)
+ {
+ Any aRef = pView->GetUNOObject()->getSelection();
+ aRef >>= xRef;
+ }
+ }
+ return xRef;
+}
+
+/*-- 18.12.98 13:12:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextDocument::attachResource(const OUString& aURL, const Sequence< beans::PropertyValue >& aArgs)
+ throw( RuntimeException )
+{
+ return SfxBaseModel::attachResource(aURL, aArgs);
+}
+/*-- 18.12.98 13:12:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXTextDocument::getURL(void) throw( RuntimeException )
+{
+ return SfxBaseModel::getURL();
+}
+/*-- 18.12.98 13:12:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< beans::PropertyValue > SwXTextDocument::getArgs(void) throw( RuntimeException )
+{
+ return SfxBaseModel::getArgs();
+}
+/*-- 18.12.98 13:12:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::connectController(const Reference< frame::XController > & xController) throw( RuntimeException )
+{
+ SfxBaseModel::connectController(xController);
+}
+/*-- 18.12.98 13:12:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::disconnectController(const Reference< frame::XController > & xController) throw( RuntimeException )
+{
+ SfxBaseModel::disconnectController(xController);
+}
+/*-- 18.12.98 13:12:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::dispose(void) throw( RuntimeException )
+{
+ SfxBaseModel::dispose();
+}
+/*-- 10.05.2005 14:14:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::close( sal_Bool bDeliverOwnership ) throw( util::CloseVetoException, RuntimeException )
+{
+ if(IsValid() && m_pHiddenViewFrame)
+ lcl_DisposeView( m_pHiddenViewFrame, pDocShell);
+ SfxBaseModel::close(bDeliverOwnership);
+}
+/*-- 18.12.98 13:12:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::addEventListener(const Reference< lang::XEventListener > & aListener) throw( RuntimeException )
+{
+ SfxBaseModel::addEventListener(aListener);
+}
+/*-- 18.12.98 13:12:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::removeEventListener(const Reference< lang::XEventListener > & aListener) throw( RuntimeException )
+{
+ SfxBaseModel::removeEventListener(aListener);
+}
+
+/*-- 18.12.98 11:55:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySet > SwXTextDocument::getLineNumberingProperties(void)
+ throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(IsValid())
+ {
+ if(!pxXLineNumberingProperties)
+ {
+ pxXLineNumberingProperties = new Reference<XPropertySet>;
+ (*pxXLineNumberingProperties) = new SwXLineNumberingProperties(pDocShell->GetDoc());
+ }
+ }
+ else
+ throw RuntimeException();
+ return *pxXLineNumberingProperties;
+}
+/*-- 18.12.98 11:55:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XIndexReplace > SwXTextDocument::getChapterNumberingRules(void)
+ throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXChapterNumbering)
+ {
+ pxXChapterNumbering = new Reference< XIndexReplace > ;
+ *pxXChapterNumbering = new SwXChapterNumbering(*pDocShell);
+ }
+ return *pxXChapterNumbering;
+}
+
+Reference< XIndexAccess > SwXTextDocument::getNumberingRules(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXNumberingRules )
+ {
+ ((SwXTextDocument*)this)->pxXNumberingRules = new Reference< XIndexAccess > ;
+ *pxXNumberingRules = new SwXNumberingRulesCollection( pDocShell->GetDoc() );
+ }
+ return *pxXNumberingRules;
+}
+
+/*-- 18.12.98 11:55:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XIndexAccess > SwXTextDocument::getFootnotes(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXFootnotes)
+ {
+ ((SwXTextDocument*)this)->pxXFootnotes = new Reference< XIndexAccess > ;
+ *pxXFootnotes = new SwXFootnotes(sal_False, pDocShell->GetDoc());
+ }
+ return *pxXFootnotes;
+}
+/*-- 18.12.98 11:55:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySet > SAL_CALL
+ SwXTextDocument::getFootnoteSettings(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXFootnoteSettings)
+ {
+ ((SwXTextDocument*)this)->pxXFootnoteSettings = new Reference< XPropertySet > ;
+ *pxXFootnoteSettings = new SwXFootnoteProperties(pDocShell->GetDoc());
+ }
+ return *pxXFootnoteSettings;
+}
+/*-- 18.12.98 11:55:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XIndexAccess > SwXTextDocument::getEndnotes(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXEndnotes)
+ {
+ ((SwXTextDocument*)this)->pxXEndnotes = new Reference< XIndexAccess > ;
+ *pxXEndnotes = new SwXFootnotes(sal_True, pDocShell->GetDoc());
+ }
+ return *pxXEndnotes;
+}
+/*-- 18.12.98 11:55:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySet > SwXTextDocument::getEndnoteSettings(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXEndnoteSettings)
+ {
+ ((SwXTextDocument*)this)->pxXEndnoteSettings = new Reference< XPropertySet > ;
+ *pxXEndnoteSettings = new SwXEndnoteProperties(pDocShell->GetDoc());
+ }
+ return *pxXEndnoteSettings;
+}
+/*-- 18.12.98 11:55:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< util::XReplaceDescriptor > SwXTextDocument::createReplaceDescriptor(void)
+ throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ Reference< util::XReplaceDescriptor > xRet = new SwXTextSearch;
+ return xRet;
+}
+/* -----------------26.02.99 15:52-------------------
+ *
+ * --------------------------------------------------*/
+SwUnoCrsr* SwXTextDocument::CreateCursorForSearch(Reference< XTextCursor > & xCrsr)
+{
+ getText();
+ XText *const pText = xBodyText.get();
+ SwXBodyText* pBText = (SwXBodyText*)pText;
+ SwXTextCursor *const pXTextCursor = pBText->CreateTextCursor(true);
+ xCrsr.set( static_cast<text::XWordCursor*>(pXTextCursor) );
+
+ SwUnoCrsr *const pUnoCrsr = pXTextCursor->GetCursor();
+ pUnoCrsr->SetRemainInSection(sal_False);
+ return pUnoCrsr;
+}
+
+/*-- 18.12.98 11:55:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor > & xDesc)
+ throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ Reference< XUnoTunnel > xDescTunnel(xDesc, UNO_QUERY);
+ if(!IsValid() || !xDescTunnel.is() || !xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId()))
+ throw RuntimeException();
+
+ Reference< XTextCursor > xCrsr;
+ SwUnoCrsr* pUnoCrsr = CreateCursorForSearch(xCrsr);
+
+ const SwXTextSearch* pSearch = reinterpret_cast<const SwXTextSearch*>(
+ xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId()));
+
+ int eRanges(FND_IN_BODY|FND_IN_SELALL);
+
+ util::SearchOptions aSearchOpt;
+ pSearch->FillSearchOptions( aSearchOpt );
+
+ SwDocPositions eStart = pSearch->bBack ? DOCPOS_END : DOCPOS_START;
+ SwDocPositions eEnd = pSearch->bBack ? DOCPOS_START : DOCPOS_END;
+
+ // Suche soll ueberall stattfinden
+ pUnoCrsr->SetRemainInSection(sal_False);
+ sal_uInt32 nResult;
+ UnoActionContext aContext(pDocShell->GetDoc());
+ //try attribute search first
+ if(pSearch->HasSearchAttributes()||pSearch->HasReplaceAttributes())
+ {
+ SfxItemSet aSearch(pDocShell->GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_PARATR_BEGIN, RES_PARATR_END-1,
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ 0);
+ SfxItemSet aReplace(pDocShell->GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_PARATR_BEGIN, RES_PARATR_END-1,
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ 0);
+ pSearch->FillSearchItemSet(aSearch);
+ pSearch->FillReplaceItemSet(aReplace);
+ BOOL bCancel;
+ nResult = (sal_Int32)pUnoCrsr->Find( aSearch, !pSearch->bStyles,
+ eStart, eEnd, bCancel,
+ (FindRanges)eRanges,
+ pSearch->sSearchText.Len() ? &aSearchOpt : 0,
+ &aReplace );
+ }
+ else if(pSearch->bStyles)
+ {
+ SwTxtFmtColl *pSearchColl = lcl_GetParaStyle(pSearch->sSearchText, pUnoCrsr->GetDoc());
+ SwTxtFmtColl *pReplaceColl = lcl_GetParaStyle(pSearch->sReplaceText, pUnoCrsr->GetDoc());;
+
+ BOOL bCancel;
+ nResult = pUnoCrsr->Find( *pSearchColl,
+ eStart, eEnd, bCancel,
+ (FindRanges)eRanges, pReplaceColl );
+
+ }
+ else
+ {
+ //todo/mba: assuming that notes should be omitted
+ BOOL bSearchInNotes = FALSE;
+ BOOL bCancel;
+ nResult = pUnoCrsr->Find( aSearchOpt, bSearchInNotes,
+ eStart, eEnd, bCancel,
+ (FindRanges)eRanges,
+ sal_True );
+ }
+ return (sal_Int32)nResult;
+
+}
+/*-- 18.12.98 11:55:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< util::XSearchDescriptor > SwXTextDocument::createSearchDescriptor(void)
+ throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ Reference< util::XSearchDescriptor > xRet = new SwXTextSearch;
+ return xRet;
+
+}
+/* -----------------26.02.99 16:08-------------------
+ * wird fuer findAll/First/Next verwendet
+ * --------------------------------------------------*/
+SwUnoCrsr* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor > & xDesc,
+ Reference< XTextCursor > & xCrsr, sal_Bool bAll,
+ sal_Int32& nResult,
+ Reference< XInterface > xLastResult)
+{
+ Reference< XUnoTunnel > xDescTunnel(xDesc, UNO_QUERY);
+ if(!IsValid() || !xDescTunnel.is() || !xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId()))
+ return 0;
+
+ SwUnoCrsr* pUnoCrsr = CreateCursorForSearch(xCrsr);
+ const SwXTextSearch* pSearch = reinterpret_cast<const SwXTextSearch*>(
+ xDescTunnel->getSomething(SwXTextSearch::getUnoTunnelId()));
+
+ sal_Bool bParentInExtra = sal_False;
+ if(xLastResult.is())
+ {
+ Reference<XUnoTunnel> xCursorTunnel( xLastResult, UNO_QUERY);
+ OTextCursorHelper* pPosCrsr = 0;
+ if(xCursorTunnel.is())
+ {
+ pPosCrsr = reinterpret_cast<OTextCursorHelper*>(xCursorTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId()));
+ }
+ SwPaM* pCrsr = pPosCrsr ? pPosCrsr->GetPaM() : 0;
+ if(pCrsr)
+ {
+ *pUnoCrsr->GetPoint() = *pCrsr->End();
+ pUnoCrsr->DeleteMark();
+ }
+ else
+ {
+ SwXTextRange* pRange = 0;
+ if(xCursorTunnel.is())
+ {
+ pRange = reinterpret_cast<SwXTextRange*>(xCursorTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId()));
+ }
+ if(!pRange)
+ return 0;
+ pRange->GetPositions(*pUnoCrsr);
+ if(pUnoCrsr->HasMark())
+ {
+ if(*pUnoCrsr->GetPoint() < *pUnoCrsr->GetMark())
+ pUnoCrsr->Exchange();
+ pUnoCrsr->DeleteMark();
+ }
+ }
+ const SwNode* pRangeNode = pUnoCrsr->GetNode();
+ bParentInExtra = pRangeNode->FindFlyStartNode() ||
+ pRangeNode->FindFootnoteStartNode() ||
+ pRangeNode->FindHeaderStartNode() ||
+ pRangeNode->FindFooterStartNode() ;
+ }
+
+ util::SearchOptions aSearchOpt;
+ pSearch->FillSearchOptions( aSearchOpt );
+
+/*
+ * folgende Kombinationen sind erlaubt:
+ * - suche einen im Body: -> FND_IN_BODY
+ * - suche alle im Body: -> FND_IN_BODYONLY | FND_IN_SELALL
+ * - suche in Selectionen: einen / alle -> FND_IN_SEL [ | FND_IN_SELALL ]
+ * - suche im nicht Body: einen / alle -> FND_IN_OTHER [ | FND_IN_SELALL ]
+ * - suche ueberall alle: -> FND_IN_SELALL
+ */
+ int eRanges(FND_IN_BODY);
+ if(bParentInExtra)
+ eRanges = FND_IN_OTHER;
+ if(bAll) //immer - ueberall?
+ eRanges = FND_IN_SELALL;
+ SwDocPositions eStart = !bAll ? DOCPOS_CURR : pSearch->bBack ? DOCPOS_END : DOCPOS_START;
+ SwDocPositions eEnd = pSearch->bBack ? DOCPOS_START : DOCPOS_END;
+
+ nResult = 0;
+ sal_uInt16 nSearchProc = 0;
+ while(nSearchProc < 2)
+ {
+ //try attribute search first
+ if(pSearch->HasSearchAttributes())
+ {
+ SfxItemSet aSearch(pDocShell->GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_PARATR_BEGIN, RES_PARATR_END-1,
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ RES_TXTATR_INETFMT, RES_TXTATR_CHARFMT,
+ 0);
+ pSearch->FillSearchItemSet(aSearch);
+ BOOL bCancel;
+ nResult = (sal_Int32)pUnoCrsr->Find( aSearch, !pSearch->bStyles,
+ eStart, eEnd, bCancel,
+ (FindRanges)eRanges,
+ pSearch->sSearchText.Len() ? &aSearchOpt : 0,
+ 0 );
+ }
+ else if(pSearch->bStyles)
+ {
+ SwTxtFmtColl *pSearchColl = lcl_GetParaStyle(pSearch->sSearchText, pUnoCrsr->GetDoc());
+ //pSearch->sReplaceText
+ SwTxtFmtColl *pReplaceColl = 0;
+ BOOL bCancel;
+ nResult = (sal_Int32)pUnoCrsr->Find( *pSearchColl,
+ eStart, eEnd, bCancel,
+ (FindRanges)eRanges, pReplaceColl );
+ }
+ else
+ {
+ //todo/mba: assuming that notes should be omitted
+ BOOL bSearchInNotes = FALSE;
+ BOOL bCancel;
+ nResult = (sal_Int32)pUnoCrsr->Find( aSearchOpt, bSearchInNotes,
+ eStart, eEnd, bCancel,
+ (FindRanges)eRanges,
+ /*int bReplace =*/sal_False );
+ }
+ nSearchProc++;
+ if(nResult || (eRanges&(FND_IN_SELALL|FND_IN_OTHER)))
+ break;
+ //second step - find in other
+ eRanges = FND_IN_OTHER;
+ }
+ return pUnoCrsr;
+}
+/*-- 18.12.98 11:55:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XIndexAccess >
+ SwXTextDocument::findAll(const Reference< util::XSearchDescriptor > & xDesc)
+ throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ Reference< XInterface > xTmp;
+ sal_Int32 nResult = 0;
+ Reference< XTextCursor > xCrsr;
+ SwUnoCrsr* pResultCrsr = FindAny(xDesc, xCrsr, sal_True, nResult, xTmp);
+ if(!pResultCrsr)
+ throw RuntimeException();
+ Reference< XIndexAccess > xRet;
+ xRet = new SwXTextRanges( (nResult) ? pResultCrsr : 0 );
+ delete pResultCrsr;
+ return xRet;
+}
+/*-- 18.12.98 11:55:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XInterface > SwXTextDocument::findFirst(const Reference< util::XSearchDescriptor > & xDesc)
+ throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ Reference< XInterface > xTmp;
+ sal_Int32 nResult = 0;
+ Reference< XTextCursor > xCrsr;
+ SwUnoCrsr* pResultCrsr = FindAny(xDesc, xCrsr, sal_False, nResult, xTmp);
+ if(!pResultCrsr)
+ throw RuntimeException();
+ Reference< XInterface > xRet;
+ if(nResult)
+ {
+ const uno::Reference< text::XText > xParent =
+ ::sw::CreateParentXText(*pDocShell->GetDoc(),
+ *pResultCrsr->GetPoint());
+ xRet = *new SwXTextCursor(xParent, *pResultCrsr);
+ delete pResultCrsr;
+ }
+ return xRet;
+}
+/*-- 18.12.98 11:55:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XInterface > SwXTextDocument::findNext(const Reference< XInterface > & xStartAt,
+ const Reference< util::XSearchDescriptor > & xDesc)
+ throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ Reference< XInterface > xTmp;
+ sal_Int32 nResult = 0;
+ Reference< XTextCursor > xCrsr;
+ if(!xStartAt.is())
+ throw RuntimeException();
+ SwUnoCrsr* pResultCrsr = FindAny(xDesc, xCrsr, sal_False, nResult, xStartAt);
+ if(!pResultCrsr)
+ throw RuntimeException();
+ Reference< XInterface > xRet;
+ if(nResult)
+ {
+ const uno::Reference< text::XText > xParent =
+ ::sw::CreateParentXText(*pDocShell->GetDoc(),
+ *pResultCrsr->GetPoint());
+
+ xRet = *new SwXTextCursor(xParent, *pResultCrsr);
+ delete pResultCrsr;
+ }
+ return xRet;
+}
+/*-- 18.12.98 11:55:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< beans::PropertyValue > SwXTextDocument::getPagePrintSettings(void)
+ throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ Sequence< beans::PropertyValue > aSeq(9);
+ if(IsValid())
+ {
+ beans::PropertyValue* pArray = aSeq.getArray();
+ SwPagePreViewPrtData aData;
+ const SwPagePreViewPrtData* pData = pDocShell->GetDoc()->GetPreViewPrtData();
+ if(pData)
+ aData = *pData;
+ Any aVal;
+ aVal <<= (sal_Int16)aData.GetRow();
+ pArray[0] = beans::PropertyValue(C2U("PageRows"), -1, aVal, PropertyState_DIRECT_VALUE);
+ aVal <<= (sal_Int16)aData.GetCol();
+ pArray[1] = beans::PropertyValue(C2U("PageColumns"), -1, aVal, PropertyState_DIRECT_VALUE);
+ aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetLeftSpace());
+ pArray[2] = beans::PropertyValue(C2U("LeftMargin"), -1, aVal, PropertyState_DIRECT_VALUE);
+ aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetRightSpace());
+ pArray[3] = beans::PropertyValue(C2U("RightMargin"), -1, aVal, PropertyState_DIRECT_VALUE);
+ aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetTopSpace());
+ pArray[4] = beans::PropertyValue(C2U("TopMargin"), -1, aVal, PropertyState_DIRECT_VALUE);
+ aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetBottomSpace());
+ pArray[5] = beans::PropertyValue(C2U("BottomMargin"), -1, aVal, PropertyState_DIRECT_VALUE);
+ aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetHorzSpace());
+ pArray[6] = beans::PropertyValue(C2U("HoriMargin"), -1, aVal, PropertyState_DIRECT_VALUE);
+ aVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(aData.GetVertSpace());
+ pArray[7] = beans::PropertyValue(C2U("VertMargin"), -1, aVal, PropertyState_DIRECT_VALUE);
+ BOOL bTemp = aData.GetLandscape();
+ aVal.setValue(&bTemp, ::getCppuBooleanType());
+ pArray[8] = beans::PropertyValue(C2U("IsLandscape"), -1, aVal, PropertyState_DIRECT_VALUE);
+ }
+ else
+ throw RuntimeException();
+ return aSeq;
+}
+/* -----------------24.02.99 10:57-------------------
+ *
+ * --------------------------------------------------*/
+sal_uInt32 lcl_Any_To_ULONG(const Any& rValue, sal_Bool& bException)
+{
+ bException = sal_False;
+ TypeClass eType = rValue.getValueType().getTypeClass();
+
+ sal_uInt32 nRet = 0;
+ if( eType == TypeClass_UNSIGNED_LONG )
+ rValue >>= nRet;
+ else
+ {
+ sal_Int32 nVal=0;
+ bException = !(rValue >>= nVal);
+ if( !bException )
+ nRet = (sal_uInt32)nVal;
+ }
+
+ return nRet;
+}
+/*-- 09.06.2004 12:18:10---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+String lcl_CreateOutlineString( USHORT nIndex,
+ const SwOutlineNodes& rOutlineNodes, const SwNumRule* pOutlRule)
+{
+ String sEntry;
+ const SwTxtNode * pTxtNd = rOutlineNodes[ nIndex ]->GetTxtNode();
+ SwNumberTree::tNumberVector aNumVector = pTxtNd->GetNumberVector();
+ if( pOutlRule && pTxtNd->GetNumRule())
+ for( sal_Int8 nLevel = 0;
+ nLevel <= pTxtNd->GetActualListLevel();
+ nLevel++ )
+ {
+ long nVal = aNumVector[nLevel];
+ nVal ++;
+ nVal -= pOutlRule->Get(nLevel).GetStart();
+ sEntry += String::CreateFromInt32( nVal );
+ sEntry += '.';
+ }
+ sEntry += rOutlineNodes[ nIndex ]->
+ GetTxtNode()->GetExpandTxt( 0, STRING_LEN, sal_False );
+ return sEntry;
+}
+/*-- 18.12.98 11:55:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::setPagePrintSettings(const Sequence< beans::PropertyValue >& aSettings)
+ throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(IsValid())
+ {
+ SwPagePreViewPrtData aData;
+ //falls nur einige Properties kommen, dann die akt. Einstellungen benutzen
+ const SwPagePreViewPrtData* pData = pDocShell->GetDoc()->GetPreViewPrtData();
+ if(pData)
+ aData = *pData;
+ const beans::PropertyValue* pProperties = aSettings.getConstArray();
+ int nCount = aSettings.getLength();
+ for(int i = 0; i < nCount; i++)
+ {
+ String sName = pProperties[i].Name;
+ const Any& rVal = pProperties[i].Value;
+ sal_Bool bException;
+ sal_uInt32 nVal = lcl_Any_To_ULONG(rVal, bException);
+ if( COMPARE_EQUAL == sName.CompareToAscii("PageRows" ) )
+ {
+ if(!nVal || nVal > 0xff)
+ throw RuntimeException();
+ aData.SetRow((BYTE)nVal);
+ }
+ else if(COMPARE_EQUAL == sName.CompareToAscii("PageColumns"))
+ {
+ if(!nVal || nVal > 0xff)
+ throw RuntimeException();
+ aData.SetCol((BYTE)nVal);
+ }
+ else if(COMPARE_EQUAL == sName.CompareToAscii("LeftMargin"))
+ {
+ aData.SetLeftSpace(MM100_TO_TWIP_UNSIGNED(nVal));
+ }
+ else if(COMPARE_EQUAL == sName.CompareToAscii("RightMargin"))
+ {
+ aData.SetRightSpace(MM100_TO_TWIP_UNSIGNED(nVal));
+ }
+ else if(COMPARE_EQUAL == sName.CompareToAscii("TopMargin"))
+ {
+ aData.SetTopSpace(MM100_TO_TWIP_UNSIGNED(nVal));
+ }
+ else if(COMPARE_EQUAL == sName.CompareToAscii("BottomMargin"))
+ {
+ aData.SetBottomSpace(MM100_TO_TWIP_UNSIGNED(nVal));
+ }
+ else if(COMPARE_EQUAL == sName.CompareToAscii("HoriMargin"))
+ {
+ aData.SetHorzSpace(MM100_TO_TWIP_UNSIGNED(nVal));
+ }
+ else if(COMPARE_EQUAL == sName.CompareToAscii("VertMargin"))
+ {
+ aData.SetVertSpace(MM100_TO_TWIP_UNSIGNED(nVal));
+ }
+ else if(COMPARE_EQUAL == sName.CompareToAscii("IsLandscape"))
+ {
+ bException = (::getBooleanCppuType() != rVal.getValueType());
+ aData.SetLandscape(*(sal_Bool*)rVal.getValue());
+ }
+ else
+ bException = sal_True;
+ if(bException)
+ throw RuntimeException();
+ }
+ pDocShell->GetDoc()->SetPreViewPrtData(&aData);
+ }
+ else
+ throw RuntimeException();
+}
+/*-- 18.12.98 11:55:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::printPages(const Sequence< beans::PropertyValue >& xOptions)
+ throw( IllegalArgumentException, RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(IsValid())
+ {
+ SfxViewFrame* pFrame = SfxViewFrame::LoadHiddenDocument( *pDocShell, 7 );
+ SfxRequest aReq(FN_PRINT_PAGEPREVIEW, SFX_CALLMODE_SYNCHRON,
+ pDocShell->GetDoc()->GetAttrPool());
+ aReq.AppendItem(SfxBoolItem(FN_PRINT_PAGEPREVIEW, sal_True));
+
+ OUString sFileName( C2U(SW_PROP_NAME_STR(UNO_NAME_FILE_NAME)));
+ OUString sCopyCount(C2U(SW_PROP_NAME_STR(UNO_NAME_COPY_COUNT)));
+ OUString sCollate(C2U(SW_PROP_NAME_STR(UNO_NAME_COLLATE)));
+ OUString sSort(C2U(SW_PROP_NAME_STR(UNO_NAME_SORT)));
+ OUString sPages(C2U(SW_PROP_NAME_STR(UNO_NAME_PAGES)));
+
+ for ( int n = 0; n < xOptions.getLength(); ++n )
+ {
+ // get Property-Value from options
+ const beans::PropertyValue &rProp = xOptions.getConstArray()[n];
+ Any aValue( rProp.Value );
+
+ // FileName-Property?
+ if ( rProp.Name == sFileName )
+ {
+ OUString sFileURL;
+ if ( (rProp.Value >>= sFileURL ) )
+ {
+ // Convert the File URL into a system dependant path, as the SalPrinter expects
+ OUString sSystemPath;
+ FileBase::getSystemPathFromFileURL ( sFileURL, sSystemPath );
+ aReq.AppendItem(SfxStringItem( SID_FILE_NAME, sSystemPath ) );
+ }
+ else if ( rProp.Value.getValueType() != ::getVoidCppuType() )
+ throw IllegalArgumentException();
+ }
+
+ // CopyCount-Property
+ else if ( rProp.Name == sCopyCount )
+ {
+ sal_Int32 nCopies = 0;
+ aValue >>= nCopies;
+ aReq.AppendItem(SfxInt16Item( SID_PRINT_COPIES, (sal_Int16)nCopies ) );
+ }
+
+ // Collate-Property
+ else if ( rProp.Name == sCollate )
+ {
+ if ( rProp.Value.getValueType() == ::getBooleanCppuType())
+
+ aReq.AppendItem(SfxBoolItem( SID_PRINT_COLLATE, *(sal_Bool*)rProp.Value.getValue() ) );
+ else
+ throw IllegalArgumentException();
+ }
+
+ // Sort-Property
+ else if ( rProp.Name == sSort )
+ {
+ if ( rProp.Value.getValueType() == ::getBooleanCppuType() )
+ aReq.AppendItem(SfxBoolItem( SID_PRINT_SORT, *(sal_Bool*)rProp.Value.getValue() ) );
+ else
+ throw IllegalArgumentException();
+ }
+
+ // Pages-Property
+ else if ( rProp.Name == sPages )
+ {
+ OUString sTmp;
+ if ( rProp.Value >>= sTmp )
+ aReq.AppendItem( SfxStringItem( SID_PRINT_PAGES, sTmp ) );
+ else
+ throw IllegalArgumentException();
+ }
+ }
+
+
+ pFrame->GetViewShell()->ExecuteSlot(aReq);
+ // Frame schliessen
+ pFrame->DoClose();
+
+ }
+ else
+ throw RuntimeException();
+}
+/*-- 18.12.98 11:55:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XNameAccess > SwXTextDocument::getReferenceMarks(void)
+ throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXReferenceMarks)
+ {
+ ((SwXTextDocument*)this)->pxXReferenceMarks = new Reference< XNameAccess > ;
+ *pxXReferenceMarks = new SwXReferenceMarks(pDocShell->GetDoc());
+ }
+ return *pxXReferenceMarks;
+}
+/* -----------------21.12.98 10:20-------------------
+ *
+ * --------------------------------------------------*/
+Reference< XEnumerationAccess > SwXTextDocument::getTextFields(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXTextFieldTypes)
+ {
+ ((SwXTextDocument*)this)->pxXTextFieldTypes = new Reference< XEnumerationAccess > ;
+ *pxXTextFieldTypes = new SwXTextFieldTypes(pDocShell->GetDoc());
+ }
+ return *pxXTextFieldTypes;
+}
+/*-- 21.12.98 10:21:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XNameAccess > SwXTextDocument::getTextFieldMasters(void)
+ throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXTextFieldMasters)
+ {
+ ((SwXTextDocument*)this)->pxXTextFieldMasters = new Reference< XNameAccess > ;
+ *pxXTextFieldMasters = new SwXTextFieldMasters(pDocShell->GetDoc());
+ }
+ return *pxXTextFieldMasters;
+}
+/*-- 21.12.98 10:21:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XNameAccess > SwXTextDocument::getEmbeddedObjects(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXEmbeddedObjects)
+ {
+ ((SwXTextDocument*)this)->pxXEmbeddedObjects = new Reference< XNameAccess > ;
+ *pxXEmbeddedObjects = new SwXTextEmbeddedObjects(pDocShell->GetDoc());
+ }
+ return *pxXEmbeddedObjects;
+}
+/*-- 21.12.98 10:21:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XNameAccess > SwXTextDocument::getBookmarks(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXBookmarks)
+ {
+ ((SwXTextDocument*)this)->pxXBookmarks = new Reference< XNameAccess > ;
+ *pxXBookmarks = new SwXBookmarks(pDocShell->GetDoc());
+ }
+ return *pxXBookmarks;
+}
+/*-- 21.12.98 10:21:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XNameAccess > SwXTextDocument::getTextSections(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXTextSections)
+ {
+ ((SwXTextDocument*)this)->pxXTextSections = new Reference< XNameAccess > ;
+ *pxXTextSections = new SwXTextSections(pDocShell->GetDoc());
+ }
+ return *pxXTextSections;
+}
+/*-- 21.12.98 10:21:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XNameAccess > SwXTextDocument::getTextTables(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXTextTables)
+ {
+ ((SwXTextDocument*)this)->pxXTextTables = new Reference< XNameAccess > ;
+ *pxXTextTables = new SwXTextTables(pDocShell->GetDoc());
+ }
+ return *pxXTextTables;
+}
+/*-- 21.12.98 10:21:13---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XNameAccess > SwXTextDocument::getGraphicObjects(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXGraphicObjects)
+ {
+ ((SwXTextDocument*)this)->pxXGraphicObjects = new Reference< XNameAccess > ;
+ *pxXGraphicObjects = new SwXTextGraphicObjects(pDocShell->GetDoc());
+ }
+ return *pxXGraphicObjects;
+}
+/*-- 21.12.98 10:21:14---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XNameAccess > SwXTextDocument::getTextFrames(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXTextFrames)
+ {
+ ((SwXTextDocument*)this)->pxXTextFrames = new Reference< XNameAccess > ;
+ *pxXTextFrames = new SwXTextFrames(pDocShell->GetDoc());
+ }
+ return *pxXTextFrames;
+}
+/* -----------------21.12.98 10:56-------------------
+ *
+ * --------------------------------------------------*/
+Reference< XNameAccess > SwXTextDocument::getStyleFamilies(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXStyleFamilies)
+ {
+ ((SwXTextDocument*)this)->pxXStyleFamilies = new Reference< XNameAccess > ;
+ *pxXStyleFamilies = new SwXStyleFamilies(*pDocShell);
+ }
+ return *pxXStyleFamilies;
+}
+/*-- 19.05.06 10:15:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< style::XAutoStyles > SwXTextDocument::getAutoStyles( )
+ throw (uno::RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXAutoStyles)
+ {
+ pxXAutoStyles = new Reference< style::XAutoStyles > ;
+ *pxXAutoStyles = new SwXAutoStyles(*pDocShell);
+ }
+ return *pxXAutoStyles;
+
+}
+/*-- 22.01.99 10:18:03---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< drawing::XDrawPage > SwXTextDocument::getDrawPage(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXDrawPage)
+ {
+ // simplified this creation, keeping original below as reference
+ // for the case that it did something by purpose
+ ((SwXTextDocument*)this)->pDrawPage = new SwXDrawPage(pDocShell->GetDoc());
+ ((SwXTextDocument*)this)->pxXDrawPage = new Reference< drawing::XDrawPage >(pDrawPage);
+
+ //((SwXTextDocument*)this)->pxXDrawPage = new Reference< drawing::XDrawPage > ;
+ //((SwXTextDocument*)this)->pDrawPage = new SwXDrawPage(pDocShell->GetDoc());
+ //Reference< drawing::XShapes > xTmp = pDrawPage;
+ //*pxXDrawPage = Reference< drawing::XDrawPage>(xTmp, UNO_QUERY);
+ }
+ return *pxXDrawPage;
+}
+/* -----------------07.04.99 10:11-------------------
+ *
+ * --------------------------------------------------*/
+SwXDrawPage* SwXTextDocument::GetDrawPage()
+{
+ if(!IsValid())
+ return 0;
+ if(!pDrawPage)
+ getDrawPage();
+ return pDrawPage;
+}
+/*-- 18.12.98 11:55:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::Invalidate()
+{
+ bObjectValid = sal_False;
+ if(xNumFmtAgg.is())
+ {
+ const uno::Type& rTunnelType = ::getCppuType((Reference <XUnoTunnel>*)0);
+ Any aNumTunnel = xNumFmtAgg->queryAggregation(rTunnelType);
+ SvNumberFormatsSupplierObj* pNumFmt = 0;
+ Reference< XUnoTunnel > xNumTunnel;
+ if(aNumTunnel >>= xNumTunnel)
+ {
+ pNumFmt = reinterpret_cast<SvNumberFormatsSupplierObj*>(
+ xNumTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId()));
+ pNumFmt->SetNumberFormatter(0);
+ }
+ DBG_ASSERT(pNumFmt, "No number formatter available");
+ }
+ InitNewDoc();
+ pDocShell = 0;
+ aRefreshCont.Disposing();
+}
+/* -----------------------------13.07.00 15:59--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextDocument::Reactivate(SwDocShell* pNewDocShell)
+{
+ if(pDocShell && pDocShell != pNewDocShell)
+ Invalidate();
+ pDocShell = pNewDocShell;
+ bObjectValid = TRUE;
+}
+/*-- 18.12.98 11:55:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::InitNewDoc()
+{
+ // zunaechst alle Collections invalidieren, dann Referenzen loeschen und Null setzen
+ if(pxXTextTables)
+ {
+ XNameAccess* pTbls = pxXTextTables->get();
+ ((SwXTextTables*)pTbls)->Invalidate();
+ delete pxXTextTables;
+ pxXTextTables = 0;
+ }
+
+ if(pxXTextFrames)
+ {
+ XNameAccess* pFrms = pxXTextFrames->get();
+ ((SwXTextFrames*)pFrms)->Invalidate();
+ delete pxXTextFrames;
+ pxXTextFrames = 0;
+ }
+
+ if(pxXGraphicObjects)
+ {
+ XNameAccess* pFrms = pxXGraphicObjects->get();
+ ((SwXTextGraphicObjects*)pFrms)->Invalidate();
+ delete pxXGraphicObjects;
+ pxXGraphicObjects = 0;
+ }
+
+ if(pxXEmbeddedObjects)
+ {
+ XNameAccess* pOLE = pxXEmbeddedObjects->get();
+ ((SwXTextEmbeddedObjects*)pOLE)->Invalidate();
+ delete pxXEmbeddedObjects;
+ pxXEmbeddedObjects = 0;
+ }
+
+ if(xBodyText.is())
+ {
+ xBodyText = 0;
+ pBodyText = 0;
+ }
+
+ if(xNumFmtAgg.is())
+ {
+ const uno::Type& rTunnelType = ::getCppuType((Reference <XUnoTunnel>*)0);
+ Any aNumTunnel = xNumFmtAgg->queryAggregation(rTunnelType);
+ SvNumberFormatsSupplierObj* pNumFmt = 0;
+ Reference< XUnoTunnel > xNumTunnel;
+ if(aNumTunnel >>= xNumTunnel)
+ {
+ pNumFmt = reinterpret_cast<SvNumberFormatsSupplierObj*>(
+ xNumTunnel->getSomething(SvNumberFormatsSupplierObj::getUnoTunnelId()));
+
+ }
+ DBG_ASSERT(pNumFmt, "No number formatter available");
+ pNumFmt->SetNumberFormatter(0);
+ }
+
+ if(pxXTextFieldTypes)
+ {
+ XEnumerationAccess* pT = pxXTextFieldTypes->get();
+ ((SwXTextFieldTypes*)pT)->Invalidate();
+ delete pxXTextFieldTypes;
+ pxXTextFieldTypes = 0;
+ }
+
+ if(pxXTextFieldMasters)
+ {
+ XNameAccess* pT = pxXTextFieldMasters->get();
+ ((SwXTextFieldMasters*)pT)->Invalidate();
+ delete pxXTextFieldMasters;
+ pxXTextFieldMasters = 0;
+ }
+
+ if(pxXTextSections)
+ {
+ XNameAccess* pSect = pxXTextSections->get();
+ ((SwXTextSections*)pSect)->Invalidate();
+ delete pxXTextSections;
+ pxXTextSections = 0;
+ }
+
+ if(pxXDrawPage)
+ {
+ // --> OD 2008-07-23 #i91798#, #i91895#
+ // dispose XDrawPage here. We are the owner and know that it is no longer in a valid condition.
+ uno::Reference<lang::XComponent> xComp( *pxXDrawPage, uno::UNO_QUERY );
+ xComp->dispose();
+ // <--
+ pDrawPage->InvalidateSwDoc();
+ delete pxXDrawPage;
+ pxXDrawPage = 0;
+ }
+
+ if ( pxXNumberingRules )
+ {
+ XIndexAccess* pNum = pxXNumberingRules->get();
+ ((SwXNumberingRulesCollection*)pNum)->Invalidate();
+ delete pxXNumberingRules;
+ pxXNumberingRules = 0;
+ }
+
+ if(pxXFootnotes)
+ {
+ XIndexAccess* pFtn = pxXFootnotes->get();
+ ((SwXFootnotes*)pFtn)->Invalidate();
+ delete pxXFootnotes;
+ pxXFootnotes = 0;
+ }
+
+ if(pxXEndnotes)
+ {
+ XIndexAccess* pFtn = pxXEndnotes->get();
+ ((SwXFootnotes*)pFtn)->Invalidate();
+ delete pxXEndnotes;
+ pxXEndnotes = 0;
+ }
+
+ if(pxXDocumentIndexes)
+ {
+ XIndexAccess* pIdxs = pxXDocumentIndexes->get();
+ ((SwXDocumentIndexes*)pIdxs)->Invalidate();
+ delete pxXDocumentIndexes;
+ pxXDocumentIndexes = 0;
+ }
+
+ if(pxXStyleFamilies)
+ {
+ XNameAccess* pStyles = pxXStyleFamilies->get();
+ ((SwXStyleFamilies*)pStyles)->Invalidate();
+ delete pxXStyleFamilies;
+ pxXStyleFamilies = 0;
+ }
+ if(pxXAutoStyles)
+ {
+ XNameAccess* pStyles = pxXAutoStyles->get();
+ ((SwXAutoStyles*)pStyles)->Invalidate();
+ delete pxXAutoStyles;
+ pxXAutoStyles = 0;
+ }
+
+ if(pxXBookmarks)
+ {
+ XNameAccess* pBm = pxXBookmarks->get();
+ ((SwXBookmarks*)pBm)->Invalidate();
+ delete pxXBookmarks;
+ pxXBookmarks = 0;
+ }
+
+ if(pxXChapterNumbering)
+ {
+ XIndexReplace* pCh = pxXChapterNumbering->get();
+ ((SwXChapterNumbering*)pCh)->Invalidate();
+ delete pxXChapterNumbering;
+ pxXChapterNumbering = 0;
+ }
+
+ if(pxXFootnoteSettings)
+ {
+ XPropertySet* pFntSet = pxXFootnoteSettings->get();
+ ((SwXFootnoteProperties*)pFntSet)->Invalidate();
+ delete pxXFootnoteSettings;
+ pxXFootnoteSettings = 0;
+ }
+
+ if(pxXEndnoteSettings)
+ {
+ XPropertySet* pEndSet = pxXEndnoteSettings->get();
+ ((SwXEndnoteProperties*)pEndSet)->Invalidate();
+ delete pxXEndnoteSettings;
+ pxXEndnoteSettings = 0;
+ }
+
+ if(pxXLineNumberingProperties)
+ {
+ XPropertySet* pLine = pxXLineNumberingProperties->get();
+ ((SwXLineNumberingProperties*)pLine)->Invalidate();
+ delete pxXLineNumberingProperties;
+ pxXLineNumberingProperties = 0;
+ }
+ if(pxXReferenceMarks)
+ {
+ XNameAccess* pMarks = pxXReferenceMarks->get();
+ ((SwXReferenceMarks*)pMarks)->Invalidate();
+ delete pxXReferenceMarks;
+ pxXReferenceMarks = 0;
+ }
+ if(pxLinkTargetSupplier)
+ {
+ XNameAccess* pAccess = (*pxLinkTargetSupplier).get();
+ ((SwXLinkTargetSupplier*)pAccess)->Invalidate();
+ delete pxLinkTargetSupplier;
+ pxLinkTargetSupplier = 0;
+ }
+ if(pxXRedlines)
+ {
+ XEnumerationAccess* pMarks = pxXRedlines->get();
+ ((SwXRedlines*)pMarks)->Invalidate();
+ delete pxXRedlines;
+ pxXRedlines = 0;
+ }
+ if(xPropertyHelper.is())
+ {
+ pPropertyHelper->Invalidate();
+ xPropertyHelper = 0;
+ pPropertyHelper = 0;
+ }
+}
+
+/*-- 11.03.99 11:51:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+#define COM_SUN_STAR__DRAWING_LENGTH 13
+Reference< XInterface > SwXTextDocument::createInstance(const OUString& rServiceName)
+ throw( Exception, RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ Reference< XInterface > xRet;
+ sal_uInt16 nType = SwXServiceProvider::GetProviderType(rServiceName);
+ if(nType != SW_SERVICE_INVALID)
+ {
+ xRet = SwXServiceProvider::MakeInstance(nType, pDocShell->GetDoc());
+ }
+ else
+ {
+ if( rServiceName.compareToAscii( "com.sun.star.", 13 ) == 0 )
+ {
+ sal_Int32 nIndex = COM_SUN_STAR__DRAWING_LENGTH;
+ OUString sCategory = rServiceName.getToken( 0, '.', nIndex );
+ sal_Bool bShape = sCategory == C2U("drawing");
+ if( bShape || sCategory == C2U("form"))
+ {
+ if(bShape)
+ {
+ short nTable = 0;
+ if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DashTable") ) )
+ nTable = SW_CREATE_DASH_TABLE;
+ else if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GradientTable") ) )
+ nTable = SW_CREATE_GRADIENT_TABLE;
+ else if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.HatchTable") ) )
+ nTable = SW_CREATE_HATCH_TABLE;
+ else if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.BitmapTable") ) )
+ nTable = SW_CREATE_BITMAP_TABLE;
+ else if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) )
+ nTable = SW_CREATE_TRANSGRADIENT_TABLE;
+ else if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MarkerTable") ) )
+ nTable = SW_CREATE_MARKER_TABLE;
+ else if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Defaults") ) )
+ nTable = SW_CREATE_DRAW_DEFAULTS;
+ if(nTable)
+ {
+ xRet = GetPropertyHelper()->GetDrawTable(nTable);
+ }
+ }
+ }
+ else if (sCategory == C2U ("document") )
+ {
+ if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.Settings") ) )
+ xRet = Reference < XInterface > ( *new SwXDocumentSettings ( this ) );
+ if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver") ) )
+ {
+ xRet = (::cppu::OWeakObject * )new SvXMLEmbeddedObjectHelper( *pDocShell, EMBEDDEDOBJECTHELPER_MODE_READ );
+ }
+ }
+ else if (sCategory == C2U ("text") )
+ {
+ if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.DocumentSettings") ) )
+ xRet = Reference < XInterface > ( *new SwXDocumentSettings ( this ) );
+ }
+ else if (sCategory == C2U ("chart2") )
+ {
+ if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.data.DataProvider") ) )
+ xRet = Reference < XInterface > ( dynamic_cast< chart2::data::XDataProvider * >(pDocShell->getIDocumentChartDataProviderAccess()->GetChartDataProvider()) );
+ }
+
+ if(!xRet.is())
+ {
+ //! we don't want to insert OLE2 Shapes (e.g. "com.sun.star.drawing.OLE2Shape", ...)
+ //! like this (by creating them with the documents factory and
+ //! adding the shapes to the draw page).
+ //! For inserting OLE objects the proper way is to use
+ //! "com.sun.star.text.TextEmbeddedObject"!
+ if (rServiceName.lastIndexOf( C2U(".OLE2Shape") ) == rServiceName.getLength() - 10)
+ throw ServiceNotRegisteredException(); // declare service to be not registered with this factory
+
+ // --> OD 2006-02-22 #b6382898#
+ // the XML import is allowed to create instances of com.sun.star.drawing.OLE2Shape.
+ // Thus, a temporary service name is introduced to make this possible.
+ OUString aTmpServiceName( rServiceName );
+ if ( bShape &&
+ rServiceName.compareToAscii( "com.sun.star.drawing.temporaryForXMLImportOLE2Shape" ) == 0 )
+ {
+ aTmpServiceName = OUString::createFromAscii( "com.sun.star.drawing.OLE2Shape" );
+ }
+ //hier den Draw - Service suchen
+ Reference< XInterface > xTmp = SvxFmMSFactory::createInstance(aTmpServiceName);
+ // <--
+ if(bShape)
+ {
+ nIndex = COM_SUN_STAR__DRAWING_LENGTH;
+ if( 0 == rServiceName.reverseCompareToAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.drawing.GroupShape" ) ) ||
+ 0 == rServiceName.reverseCompareToAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.drawing.Shape3DSceneObject" ) ) )
+ xRet = *new SwXGroupShape( xTmp );
+ else
+ xRet = *new SwXShape( xTmp );
+ }
+ else
+ xRet = xTmp;
+ }
+ }
+ else
+ throw ServiceNotRegisteredException();
+ }
+ return xRet;
+}
+/*-- 11.03.99 11:51:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XInterface > SwXTextDocument::createInstanceWithArguments(
+ const OUString& ServiceSpecifier,
+ const Sequence< Any >& /*Arguments*/)
+ throw( Exception, RuntimeException )
+{
+ Reference< XInterface > xInt = createInstance(ServiceSpecifier);
+ //die Any-Sequence dient zur Initialisierung von Objekten, die auf
+ //Parameter zwingend angewiesen sind - bis jetzt haben wir das nicht
+ return xInt;
+}
+/*-- 11.03.99 11:51:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< OUString > SwXTextDocument::getAvailableServiceNames(void)
+ throw( RuntimeException )
+{
+ static Sequence< OUString > aServices;
+ if ( aServices.getLength() == 0 )
+ {
+ Sequence< OUString > aRet = SvxFmMSFactory::getAvailableServiceNames();
+ OUString* pRet = aRet.getArray();
+ for ( sal_Int32 i = 0; i < aRet.getLength(); ++i )
+ {
+ if ( pRet[i].compareToAscii( "com.sun.star.drawing.OLE2Shape" ) == 0 )
+ {
+ pRet[i] = pRet[aRet.getLength() - 1];
+ aRet.realloc( aRet.getLength() - 1 ); // <pRet> no longer valid.
+ break;
+ }
+ }
+ Sequence< OUString > aOwn = SwXServiceProvider::GetAllServiceNames();
+ aServices = SvxFmMSFactory::concatServiceNames(aRet, aOwn);
+ }
+
+ return aServices;
+}
+/* -----------------18.03.99 11:36-------------------
+ *
+ * --------------------------------------------------*/
+OUString SwXTextDocument::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextDocument");
+}
+/* -----------------20.01.04 10:14-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXTextDocument::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ if (
+ (rServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.document.OfficeDocument" ))) ||
+ (rServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM ( "com.sun.star.text.GenericTextDocument")))
+ )
+ return sal_True;
+
+ BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell));
+ BOOL bGlobalDoc = (0 != PTR_CAST(SwGlobalDocShell, pDocShell));
+ BOOL bTextDoc = (!bWebDoc && !bGlobalDoc);
+
+ return (
+ (bWebDoc && rServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.WebDocument" ))) ||
+ (bGlobalDoc && rServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.GlobalDocument"))) ||
+ (bTextDoc && rServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextDocument" )))
+ );
+}
+/* -----------------20.01.04 10:17-------------------
+ *
+ * --------------------------------------------------*/
+Sequence< OUString > SwXTextDocument::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell));
+ BOOL bGlobalDoc = (0 != PTR_CAST(SwGlobalDocShell, pDocShell));
+ BOOL bTextDoc = (!bWebDoc && !bGlobalDoc);
+
+ Sequence< OUString > aRet (3);
+ OUString* pArray = aRet.getArray();
+
+ pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( ( "com.sun.star.document.OfficeDocument" ) ) );
+ pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( ( "com.sun.star.text.GenericTextDocument" ) ) );
+
+ if (bTextDoc)
+ pArray[2] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( ( "com.sun.star.text.TextDocument" ) ) );
+ else
+ if (bWebDoc)
+ pArray[2] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( ( "com.sun.star.text.WebDocument" ) ) );
+ else
+ if (bGlobalDoc)
+ pArray[2] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( ( "com.sun.star.text.GlobalDocument" ) ) );
+
+ return aRet;
+}
+/* -----------------05.05.99 12:10-------------------
+ *
+ * --------------------------------------------------*/
+Reference< XIndexAccess > SwXTextDocument::getDocumentIndexes(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ if(!pxXDocumentIndexes)
+ {
+ ((SwXTextDocument*)this)->pxXDocumentIndexes = new Reference< XIndexAccess > ;
+ *pxXDocumentIndexes = new SwXDocumentIndexes(pDocShell->GetDoc());
+ }
+ return *pxXDocumentIndexes;
+}
+
+/*-- 10.05.99 13:58:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySetInfo > SwXTextDocument::getPropertySetInfo(void) throw( RuntimeException )
+{
+ static Reference< XPropertySetInfo > xRet = pPropSet->getPropertySetInfo();
+ return xRet;
+}
+/*-- 10.05.99 13:58:58---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::setPropertyValue(const OUString& rPropertyName,
+ const Any& aValue)
+ throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException,
+ WrappedTargetException, RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName);
+
+ if(!pEntry)
+ throw UnknownPropertyException();
+ if(pEntry->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException();
+ switch(pEntry->nWID)
+ {
+ case WID_DOC_CHAR_COUNT :
+ case WID_DOC_PARA_COUNT :
+ case WID_DOC_WORD_COUNT :
+ throw RuntimeException();
+ case WID_DOC_WORD_SEPARATOR :
+ {
+ OUString sDelim;
+ aValue >>= sDelim;
+ SW_MOD()->GetModuleConfig()->SetWordDelimiter(sDelim);
+ }
+ break;
+ case WID_DOC_CHANGES_RECORD:
+ case WID_DOC_CHANGES_SHOW:
+ {
+ sal_Bool bSet = *(sal_Bool*)aValue.getValue();
+ sal_uInt16 eMode = pDocShell->GetDoc()->GetRedlineMode();
+ if(WID_DOC_CHANGES_SHOW == pEntry->nWID)
+ {
+ eMode &= ~(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE);
+ eMode |= nsRedlineMode_t::REDLINE_SHOW_INSERT;
+ if( bSet )
+ eMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE;
+ }
+ else if(WID_DOC_CHANGES_RECORD == pEntry->nWID)
+ {
+ eMode = bSet ? eMode|nsRedlineMode_t::REDLINE_ON : eMode&~nsRedlineMode_t::REDLINE_ON;
+ }
+ pDocShell->GetDoc()->SetRedlineMode( (RedlineMode_t)(eMode ));
+ }
+ break;
+ case WID_DOC_CHANGES_PASSWORD:
+ {
+ Sequence <sal_Int8> aNew;
+ if(aValue >>= aNew)
+ {
+ SwDoc* pDoc = pDocShell->GetDoc();
+ pDoc->SetRedlinePassword(aNew);
+ if(aNew.getLength())
+ {
+ sal_uInt16 eMode = pDoc->GetRedlineMode();
+ eMode = eMode|nsRedlineMode_t::REDLINE_ON;
+ pDoc->SetRedlineMode( (RedlineMode_t)(eMode ));
+ }
+ }
+ }
+ break;
+ case WID_DOC_AUTO_MARK_URL :
+ {
+ OUString sURL;
+ aValue >>= sURL;
+ pDocShell->GetDoc()->SetTOIAutoMarkURL(sURL);
+ }
+ break;
+ case WID_DOC_HIDE_TIPS :
+ SW_MOD()->GetModuleConfig()->SetHideFieldTips(*(sal_Bool*)aValue.getValue());
+ break;
+ case WID_DOC_REDLINE_DISPLAY:
+ {
+ sal_Int16 eRedMode = pDocShell->GetDoc()->GetRedlineMode();
+ eRedMode = eRedMode & (~nsRedlineMode_t::REDLINE_SHOW_MASK);
+ sal_Int16 nSet = 0;
+ aValue >>= nSet;
+ switch(nSet)
+ {
+ case RedlineDisplayType::NONE: break;
+ case RedlineDisplayType::INSERTED: eRedMode |= nsRedlineMode_t::REDLINE_SHOW_INSERT; break;
+ case RedlineDisplayType::REMOVED: eRedMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE; break;
+ case RedlineDisplayType::
+ INSERTED_AND_REMOVED: eRedMode |= nsRedlineMode_t::REDLINE_SHOW_INSERT|nsRedlineMode_t::REDLINE_SHOW_DELETE;
+ break;
+ default: throw IllegalArgumentException();
+ }
+ pDocShell->GetDoc()->SetRedlineMode(eRedMode);
+ }
+ break;
+ case WID_DOC_TWO_DIGIT_YEAR:
+ {
+ sal_Int16 nYear = 0;
+ aValue >>= nYear;
+ SfxRequest aRequest ( SID_ATTR_YEAR2000, SFX_CALLMODE_SLOT, pDocShell->GetDoc()->GetAttrPool());
+ aRequest.AppendItem(SfxUInt16Item( SID_ATTR_YEAR2000, static_cast < sal_uInt16 > ( nYear ) ) );
+ pDocShell->Execute ( aRequest );
+ }
+ break;
+ case WID_DOC_AUTOMATIC_CONTROL_FOCUS:
+ {
+ SwDrawDocument * pDrawDoc;
+ sal_Bool bAuto = *(sal_Bool*) aValue.getValue();
+
+ if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * >( pDocShell->GetDoc()->GetDrawModel() ) ) )
+ pDrawDoc->SetAutoControlFocus( bAuto );
+ else if (bAuto)
+ {
+ // if setting to true, and we don't have an
+ // SdrModel, then we are changing the default and
+ // must thus create an SdrModel, if we don't have an
+ // SdrModel and we are leaving the default at false,
+ // we don't need to make an SdrModel and can do nothing
+ // --> OD 2005-08-08 #i52858# - method name changed
+ pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetOrCreateDrawModel() );
+ // <--
+ pDrawDoc->SetAutoControlFocus ( bAuto );
+ }
+ }
+ break;
+ case WID_DOC_APPLY_FORM_DESIGN_MODE:
+ {
+ SwDrawDocument * pDrawDoc;
+ sal_Bool bMode = *(sal_Bool*)aValue.getValue();
+
+ if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetDrawModel() ) ) )
+ pDrawDoc->SetOpenInDesignMode( bMode );
+ else if (!bMode)
+ {
+ // if setting to false, and we don't have an
+ // SdrModel, then we are changing the default and
+ // must thus create an SdrModel, if we don't have an
+ // SdrModel and we are leaving the default at true,
+ // we don't need to make an SdrModel and can do
+ // nothing
+ // --> OD 2005-08-08 #i52858# - method name changed
+ pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetOrCreateDrawModel() );
+ // <--
+ pDrawDoc->SetOpenInDesignMode ( bMode );
+ }
+ }
+ break;
+ // --> FME 2005-02-25 #i42634# New property to set the bInReading
+ // flag at the document, used during binary import
+ case WID_DOC_LOCK_UPDATES :
+ {
+ SwDoc* pDoc = pDocShell->GetDoc();
+ bool bBool (false);
+ if( aValue >>= bBool )
+ pDoc->SetInReading( bBool );
+ }
+ break;
+ // <--
+ case WID_DOC_BUILDID:
+ aValue >>= maBuildId;
+ break;
+ // --> OD 2006-03-21 #b6375613#
+ case WID_APPLY_WORKAROUND_FOR_B6375613:
+ {
+ bool bApplyWorkaroundForB6375613( false );
+ aValue >>= bApplyWorkaroundForB6375613;
+ pDocShell->GetDoc()->SetApplyWorkaroundForB6375613( bApplyWorkaroundForB6375613 );
+ }
+ break;
+ // <--
+
+ default:
+ {
+ const SfxPoolItem& rItem = pDocShell->GetDoc()->GetDefault(pEntry->nWID);
+ SfxPoolItem* pNewItem = rItem.Clone();
+ pNewItem->PutValue(aValue, pEntry->nMemberId);
+ pDocShell->GetDoc()->SetDefault(*pNewItem);
+ delete pNewItem;
+ }
+ }
+}
+/*-- 10.05.99 13:58:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName);
+
+ if(!pEntry)
+ throw UnknownPropertyException();
+ Any aAny;
+ switch(pEntry->nWID)
+ {
+ case WID_DOC_CHAR_COUNT :
+ case WID_DOC_PARA_COUNT :
+ case WID_DOC_WORD_COUNT :
+ {
+ SwDocStat aStat(pDocShell->GetDoc()->GetDocStat());
+ if(aStat.bModified)
+ pDocShell->GetDoc()->UpdateDocStat( aStat );
+ sal_Int32 nValue;
+ switch(pEntry->nWID)
+ {
+ case WID_DOC_CHAR_COUNT :nValue = aStat.nChar;break;
+ case WID_DOC_PARA_COUNT :nValue = aStat.nPara;break;
+ case WID_DOC_WORD_COUNT :nValue = aStat.nWord;break;
+ }
+ aAny <<= nValue;
+ }
+ break;
+ case WID_DOC_WORD_SEPARATOR :
+ {
+ aAny <<= OUString(SW_MOD()->GetDocStatWordDelim());
+ }
+ break;
+ case WID_DOC_CHANGES_RECORD:
+ case WID_DOC_CHANGES_SHOW:
+ {
+ sal_uInt16 eMode = pDocShell->GetDoc()->GetRedlineMode();
+ sal_Bool bSet = sal_False;
+ if(WID_DOC_CHANGES_SHOW == pEntry->nWID)
+ {
+ sal_uInt16 nMask = nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE;
+ bSet = (eMode & nMask) == nMask;
+ }
+ else if(WID_DOC_CHANGES_RECORD == pEntry->nWID)
+ {
+ bSet = (eMode& nsRedlineMode_t::REDLINE_ON) != 0;
+ }
+ aAny.setValue(&bSet, ::getBooleanCppuType());
+ }
+ break;
+ case WID_DOC_CHANGES_PASSWORD:
+ {
+ SwDoc* pDoc = pDocShell->GetDoc();
+ aAny <<= pDoc->GetRedlinePassword();
+ }
+ break;
+ case WID_DOC_AUTO_MARK_URL :
+ aAny <<= OUString(pDocShell->GetDoc()->GetTOIAutoMarkURL());
+ break;
+ case WID_DOC_HIDE_TIPS :
+ {
+ BOOL bTemp = SW_MOD()->GetModuleConfig()->IsHideFieldTips();
+ aAny.setValue(&bTemp, ::getBooleanCppuType());
+ }
+ break;
+ case WID_DOC_REDLINE_DISPLAY:
+ {
+ sal_Int16 eRedMode = pDocShell->GetDoc()->GetRedlineMode();
+ eRedMode = eRedMode & nsRedlineMode_t::REDLINE_SHOW_MASK;
+ sal_Int16 nRet = RedlineDisplayType::NONE;
+ if(nsRedlineMode_t::REDLINE_SHOW_INSERT == eRedMode)
+ nRet = RedlineDisplayType::INSERTED;
+ else if(nsRedlineMode_t::REDLINE_SHOW_DELETE == eRedMode)
+ nRet = RedlineDisplayType::REMOVED;
+ else if(nsRedlineMode_t::REDLINE_SHOW_MASK == eRedMode)
+ nRet = RedlineDisplayType::INSERTED_AND_REMOVED;
+ aAny <<= nRet;
+ }
+ break;
+ case WID_DOC_FORBIDDEN_CHARS:
+ {
+ GetPropertyHelper();
+ Reference<XForbiddenCharacters> xRet(xPropertyHelper, UNO_QUERY);
+ aAny <<= xRet;
+ }
+ break;
+ case WID_DOC_TWO_DIGIT_YEAR:
+ {
+ aAny <<= static_cast < sal_Int16 > (pDocShell->GetDoc()->GetNumberFormatter ( TRUE )->GetYear2000());
+ }
+ break;
+ case WID_DOC_AUTOMATIC_CONTROL_FOCUS:
+ {
+ SwDrawDocument * pDrawDoc;
+ sal_Bool bAuto;
+ if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetDrawModel() ) ) )
+ bAuto = pDrawDoc->GetAutoControlFocus();
+ else
+ bAuto = sal_False;
+ aAny.setValue(&bAuto, ::getBooleanCppuType());
+ }
+ break;
+ case WID_DOC_APPLY_FORM_DESIGN_MODE:
+ {
+ SwDrawDocument * pDrawDoc;
+ sal_Bool bMode;
+ if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetDrawModel() ) ) )
+ bMode = pDrawDoc->GetOpenInDesignMode();
+ else
+ bMode = sal_True;
+ aAny.setValue(&bMode, ::getBooleanCppuType());
+ }
+ break;
+ case WID_DOC_BASIC_LIBRARIES:
+ aAny <<= pDocShell->GetBasicContainer();
+ break;
+ case WID_DOC_DIALOG_LIBRARIES:
+ aAny <<= pDocShell->GetDialogContainer();
+ break;
+ case WID_DOC_RUNTIME_UID:
+ aAny <<= getRuntimeUID();
+ break;
+ case WID_DOC_LOCK_UPDATES :
+ aAny <<= static_cast<bool>( pDocShell->GetDoc()->IsInReading() );
+ break;
+ case WID_DOC_BUILDID:
+ aAny <<= maBuildId;
+ break;
+ case WID_DOC_HAS_VALID_SIGNATURES:
+ aAny <<= hasValidSignatures();
+ break;
+ // --> OD 2006-03-21 #b6375613#
+ case WID_APPLY_WORKAROUND_FOR_B6375613:
+ {
+ aAny <<= pDocShell->GetDoc()->ApplyWorkaroundForB6375613();
+ }
+ break;
+ // <--
+
+ default:
+ {
+ const SfxPoolItem& rItem = pDocShell->GetDoc()->GetDefault(pEntry->nWID);
+ rItem.QueryValue(aAny, pEntry->nMemberId);
+ }
+ }
+ return aAny;
+}
+/*-- 10.05.99 13:58:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::addPropertyChangeListener(const OUString& /*PropertyName*/,
+ const Reference< XPropertyChangeListener > & /*aListener*/)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 10.05.99 13:58:59---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::removePropertyChangeListener(const OUString& /*PropertyName*/,
+ const Reference< XPropertyChangeListener > & /*aListener*/)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 10.05.99 13:59:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::addVetoableChangeListener(const OUString& /*PropertyName*/,
+ const Reference< XVetoableChangeListener > & /*aListener*/)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/*-- 10.05.99 13:59:00---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::removeVetoableChangeListener(const OUString& /*PropertyName*/,
+ const Reference< XVetoableChangeListener > & /*aListener*/)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ DBG_WARNING("not implemented");
+}
+/* -----------------25.10.99 10:42-------------------
+
+ --------------------------------------------------*/
+Reference< XNameAccess > SwXTextDocument::getLinks(void) throw( RuntimeException )
+{
+ if(!pxLinkTargetSupplier)
+ {
+ pxLinkTargetSupplier = new Reference< XNameAccess > ;
+ (*pxLinkTargetSupplier) = new SwXLinkTargetSupplier(*(SwXTextDocument*)this);
+ }
+ return (*pxLinkTargetSupplier);
+}
+/* -----------------------------11.01.01 15:01--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference< XEnumerationAccess > SwXTextDocument::getRedlines( ) throw(RuntimeException)
+{
+ if(!pxXRedlines)
+ {
+ pxXRedlines = new Reference< XEnumerationAccess > ;
+ (*pxXRedlines) = new SwXRedlines(pDocShell->GetDoc());
+ }
+ return *pxXRedlines;
+}
+/*-- 21.02.00 08:41:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::refresh(void) throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ SwWrtShell *pWrtShell = pDocShell->GetWrtShell();
+ notifyRefreshListeners();
+ if(pWrtShell)
+ pWrtShell->CalcLayout();
+}
+/*-- 21.02.00 08:41:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::addRefreshListener(const Reference< util::XRefreshListener > & l)
+ throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if ( !IsValid() )
+ throw RuntimeException();
+ aRefreshCont.AddListener ( reinterpret_cast < const Reference < lang::XEventListener > &> ( l ));
+}
+/*-- 21.02.00 08:41:07---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextDocument::removeRefreshListener(const Reference< util::XRefreshListener > & l)
+ throw( RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if ( !IsValid() || !aRefreshCont.RemoveListener ( reinterpret_cast < const Reference < lang::XEventListener > &> ( l ) ) )
+ throw RuntimeException();
+}
+/* -----------------------------26.02.01 12:22--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextDocument::updateLinks( ) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ SwDoc* pDoc = pDocShell->GetDoc();
+ sfx2::LinkManager& rLnkMan = pDoc->GetLinkManager();
+ if( rLnkMan.GetLinks().Count() )
+ {
+ UnoActionContext aAction(pDoc);
+ rLnkMan.UpdateAllLinks( FALSE, FALSE, TRUE );
+ }
+}
+//XPropertyState
+PropertyState SAL_CALL SwXTextDocument::getPropertyState( const OUString& rPropertyName )
+ throw (UnknownPropertyException, RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ PropertyState eRet = PropertyState_DIRECT_VALUE;
+ if(!IsValid())
+ throw RuntimeException();
+ const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName);
+
+ if(!pEntry)
+ throw UnknownPropertyException();
+ Any aAny;
+ switch(pEntry->nWID)
+ {
+ case 0:default:break;
+ }
+ return eRet;
+}
+Sequence< PropertyState > SAL_CALL SwXTextDocument::getPropertyStates( const Sequence< OUString >& rPropertyNames )
+ throw (UnknownPropertyException, RuntimeException)
+{
+ const sal_Int32 nCount = rPropertyNames.getLength();
+ const OUString * pNames = rPropertyNames.getConstArray();
+ Sequence < PropertyState > aRet ( nCount );
+ PropertyState *pState = aRet.getArray();
+
+ for ( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++)
+ pState[nIndex] = getPropertyState( pNames[nIndex] );
+
+ return aRet;
+}
+void SAL_CALL SwXTextDocument::setPropertyToDefault( const OUString& rPropertyName )
+ throw (UnknownPropertyException, RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName);
+ if(!pEntry)
+ throw UnknownPropertyException();
+ switch(pEntry->nWID)
+ {
+ case 0:default:break;
+ }
+}
+Any SAL_CALL SwXTextDocument::getPropertyDefault( const OUString& rPropertyName )
+ throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+ const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap()->getByName( rPropertyName);
+ if(!pEntry)
+ throw UnknownPropertyException();
+ Any aAny;
+ switch(pEntry->nWID)
+ {
+ case 0:default:break;
+ }
+ return aAny;
+}
+
+static OutputDevice * lcl_GetOutputDevice( const SwPrintUIOptions &rPrintUIOptions )
+{
+ OutputDevice *pOut = 0;
+
+ uno::Any aAny( rPrintUIOptions.getValue( C2U( "RenderDevice" ) ));
+ uno::Reference< awt::XDevice > xRenderDevice;
+ aAny >>= xRenderDevice;
+ if (xRenderDevice.is())
+ {
+ VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
+ pOut = pDevice ? pDevice->GetOutputDevice() : 0;
+ }
+
+ return pOut;
+}
+
+
+static bool lcl_SeqHasProperty(
+ const uno::Sequence< beans::PropertyValue >& rOptions,
+ const sal_Char *pPropName )
+{
+ bool bRes = false;
+ const sal_Int32 nLen = rOptions.getLength();
+ const beans::PropertyValue *pProps = rOptions.getConstArray();
+ for (sal_Int32 i = 0; i < nLen && !bRes; ++i)
+ {
+ if (pProps[i].Name.equalsAscii( pPropName ))
+ bRes = true;
+ }
+ return bRes;
+}
+
+
+SfxViewShell * SwXTextDocument::GetRenderView(
+ bool &rbIsSwSrcView,
+ const uno::Sequence< beans::PropertyValue >& rOptions,
+ bool bIsPDFExport )
+{
+ // get view shell to use
+ SfxViewShell *pView = 0;
+ if (bIsPDFExport)
+ pView = GuessViewShell( rbIsSwSrcView );
+ else
+ {
+ uno::Any aTmp;
+ const sal_Int32 nLen = rOptions.getLength();
+ const beans::PropertyValue *pProps = rOptions.getConstArray();
+ for (sal_Int32 i = 0; i < nLen; ++i)
+ {
+ if (pProps[i].Name.equalsAscii( "View" ))
+ {
+ aTmp = pProps[i].Value;
+ break;
+ }
+ }
+
+ uno::Reference< frame::XController > xController;
+ if (aTmp >>= xController)
+ {
+ DBG_ASSERT( xController.is(), "controller is empty!" );
+ pView = GuessViewShell( rbIsSwSrcView, xController );
+ }
+ }
+ return pView;
+}
+
+
+/*
+ * GetRenderDoc:
+ * returns the document to be rendered, usually this will be the 'regular'
+ * document but in case of PDF export of (multi-)selection it will
+ * be a temporary document that gets created if not already done.
+ * The rpView variable will be set (if not already done) to the used
+ * SfxViewShell.
+*/
+
+SwDoc * SwXTextDocument::GetRenderDoc(
+ SfxViewShell *&rpView,
+ const uno::Any& rSelection,
+ bool bIsPDFExport )
+{
+ SwDoc *pDoc = 0;
+
+ uno::Reference< frame::XModel > xModel;
+ rSelection >>= xModel;
+ if (xModel == pDocShell->GetModel())
+ pDoc = pDocShell->GetDoc();
+ else
+ {
+ DBG_ASSERT( !xModel.is(), "unexpected model found" );
+
+ if (rSelection.hasValue()) // is anything selected ?
+ {
+ // this part should only be called when a temporary document needs to be created,
+ // for example for PDF export or printing of (multi-)selection only.
+
+ bool bIsSwSrcView = false;
+ if (!rpView)
+ {
+ (void) bIsPDFExport;
+ // aside from maybe PDF export the view should always have been provided!
+ DBG_ASSERT( bIsPDFExport, "view is missing, guessing one..." );
+
+ rpView = GuessViewShell( bIsSwSrcView );
+ }
+ DBG_ASSERT( rpView, "ViewShell missing" );
+ // the view shell should be SwView for documents PDF export.
+ // for the page preview no selection should be possible
+ // (the export dialog does not allow for this option)
+ const TypeId aSwViewTypeId = TYPE(SwView);
+ if (rpView && rpView->IsA(aSwViewTypeId))
+ {
+ SfxObjectShellLock xDocSh(((SwView*)rpView)->GetOrCreateTmpSelectionDoc());
+ if (xDocSh.Is())
+ {
+ pDoc = ((SwDocShell*)&xDocSh)->GetDoc();
+ rpView = pDoc->GetDocShell()->GetView();
+ }
+ }
+ else
+ {
+ DBG_ERROR( "unexpected ViewShell" );
+ }
+ }
+ }
+ return pDoc;
+}
+
+/* -----------------------------23.08.02 16:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+static void lcl_SavePrintUIOptionsToDocumentPrintData(
+ SwDoc &rDoc,
+ const SwPrintUIOptions &rPrintUIOptions,
+ bool bIsPDFEXport )
+{
+ SwPrintData aDocPrintData( rDoc.getPrintData() );
+
+ aDocPrintData.SetPrintGraphic( rPrintUIOptions.IsPrintGraphics() );
+ aDocPrintData.SetPrintTable( rPrintUIOptions.IsPrintTables() );
+ aDocPrintData.SetPrintDraw( rPrintUIOptions.IsPrintDrawings() );
+ aDocPrintData.SetPrintControl( rPrintUIOptions.IsPrintFormControls() );
+ aDocPrintData.SetPrintLeftPage( rPrintUIOptions.IsPrintLeftPages() );
+ aDocPrintData.SetPrintRightPage( rPrintUIOptions.IsPrintRightPages() );
+ aDocPrintData.SetPrintReverse( rPrintUIOptions.IsPrintReverse() );
+ aDocPrintData.SetPaperFromSetup( rPrintUIOptions.IsPaperFromSetup() );
+ aDocPrintData.SetPrintEmptyPages( rPrintUIOptions.IsPrintEmptyPages( bIsPDFEXport ) );
+ aDocPrintData.SetPrintPostIts( rPrintUIOptions.GetPrintPostItsType() );
+ aDocPrintData.SetPrintProspect( rPrintUIOptions.IsPrintProspect() );
+ aDocPrintData.SetPrintProspect_RTL( rPrintUIOptions.IsPrintProspectRTL() );
+ aDocPrintData.SetPrintPageBackground( rPrintUIOptions.IsPrintPageBackground() );
+ aDocPrintData.SetPrintBlackFont( rPrintUIOptions.IsPrintWithBlackTextColor() );
+ // aDocPrintData.SetPrintSingleJobs( b ); handled by File/Print dialog itself
+ // arDocPrintData.SetFaxName( s ); n/a in File/Print dialog
+ aDocPrintData.SetPrintHiddenText( rPrintUIOptions.IsPrintHiddenText() );
+ aDocPrintData.SetPrintTextPlaceholder( rPrintUIOptions.IsPrintTextPlaceholders() );
+
+ rDoc.setPrintData( aDocPrintData );
+}
+
+
+sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
+ const uno::Any& rSelection,
+ const uno::Sequence< beans::PropertyValue >& rxOptions )
+ throw (IllegalArgumentException, RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+
+ const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" );
+ bool bIsSwSrcView = false;
+ SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport );
+
+ if (!bIsSwSrcView && !m_pRenderData)
+ m_pRenderData = new SwRenderData;
+ if (!m_pPrintUIOptions)
+ m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView );
+ bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions );
+ // const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport );
+
+ SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport );
+ DBG_ASSERT( pDoc && pView, "doc or view shell missing!" );
+ if (!pDoc || !pView)
+ return 0;
+
+ // save current UI options from the print dialog for the next call to that dialog
+ lcl_SavePrintUIOptionsToDocumentPrintData( *pDoc, *m_pPrintUIOptions, bIsPDFExport );
+
+ sal_Int32 nRet = 0;
+ if (bIsSwSrcView)
+ {
+ SwSrcView *pSwSrcView = dynamic_cast< SwSrcView * >(pView);
+ OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
+ nRet = pSwSrcView->PrintSource( pOutDev, 1 /* dummy */, true /* get page count only */ );
+ }
+ else
+ {
+ SwDocShell *pRenderDocShell = pDoc->GetDocShell();
+ SwWrtShell *pWrtShell = pRenderDocShell->GetWrtShell();
+ if (bFormat)
+ {
+ // #i38289
+ if(pDoc->get(IDocumentSettingAccess::BROWSE_MODE))
+ {
+ pRenderDocShell->ToggleBrowserMode(false,NULL);
+ }
+
+ if (!pWrtShell)
+ {
+ //create a hidden view to be able to export as PDF also in print preview
+ m_pHiddenViewFrame = SfxViewFrame::LoadHiddenDocument( *pRenderDocShell, 2 );
+ SwView* pSwView = (SwView*) m_pHiddenViewFrame->GetViewShell();
+ pWrtShell = pSwView->GetWrtShellPtr();
+ }
+
+ // reformating the document for printing will show the changes in the view
+ // which is likely to produce many unwanted and not nice to view actions.
+ // We don't want that! Thus we disable updating of the view.
+ pWrtShell->StartAction();
+
+ const TypeId aSwViewTypeId = TYPE(SwView);
+ if (pView->IsA(aSwViewTypeId))
+ {
+ if (m_pRenderData && m_pRenderData->NeedNewViewOptionAdjust( *pWrtShell ) )
+ m_pRenderData->ViewOptionAdjustStop();
+ if (m_pRenderData && !m_pRenderData->IsViewOptionAdjust())
+ m_pRenderData->ViewOptionAdjustStart( *pWrtShell, *pWrtShell->GetViewOptions() );
+ }
+
+ m_pRenderData->SetSwPrtOptions( new SwPrintData );
+ m_pRenderData->MakeSwPrtOptions( m_pRenderData->GetSwPrtOptionsRef(), pRenderDocShell,
+ m_pPrintUIOptions, m_pRenderData, bIsPDFExport );
+
+ if (pView->IsA(aSwViewTypeId))
+ {
+ // PDF export should not make use of the SwPrtOptions
+ const SwPrintData *pPrtOptions = (bIsPDFExport)
+ ? NULL : m_pRenderData->GetSwPrtOptions();
+ m_pRenderData->ViewOptionAdjust( pPrtOptions );
+ }
+
+ // since printing now also use the API for PDF export this option
+ // should be set for printing as well ...
+ pWrtShell->SetPDFExportOption( sal_True );
+ bool bOrigStatus = pRenderDocShell->IsEnableSetModified();
+ // check configuration: shall update of printing information in DocInfo set the document to "modified"?
+ bool bStateChanged = false;
+ if ( bOrigStatus && !SvtPrintWarningOptions().IsModifyDocumentOnPrintingAllowed() )
+ {
+ pRenderDocShell->EnableSetModified( sal_False );
+ bStateChanged = true;
+ }
+
+
+ // --> FME 2005-05-23 #122919# Force field update before PDF export:
+ pWrtShell->ViewShell::UpdateFlds(TRUE);
+ // <--
+ if( bStateChanged )
+ pRenderDocShell->EnableSetModified( sal_True );
+
+ // there is some redundancy between those two function calls, but right now
+ // there is no time to sort this out.
+ //TODO: check what exatly needs to be done and make just one function for that
+ pWrtShell->CalcLayout();
+ pWrtShell->CalcPagesForPrint( pDoc->GetPageCount() );
+
+ pWrtShell->SetPDFExportOption( sal_False );
+
+
+ // enable view again
+ pWrtShell->EndAction();
+ }
+
+ const sal_Int32 nPageCount = pDoc->GetPageCount();
+
+ //
+ // get number of pages to be rendered
+ //
+ const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false );
+ if (bPrintProspect)
+ {
+ pDoc->CalculatePagePairsForProspectPrinting( *m_pRenderData, *m_pPrintUIOptions, nPageCount );
+ nRet = m_pRenderData->GetPagePairsForProspectPrinting().size();
+ }
+ else
+ {
+ const sal_Int16 nPostItMode = (sal_Int16) m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", 0 );
+ if (nPostItMode != POSTITS_NONE)
+ {
+ OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
+ m_pRenderData->CreatePostItData( pDoc, pWrtShell->GetViewOptions(), pOutDev );
+ }
+
+ // get set of valid document pages (according to the current settings)
+ // and their start frames
+ pDoc->CalculatePagesForPrinting( *m_pRenderData, *m_pPrintUIOptions, bIsPDFExport, nPageCount );
+
+ if (nPostItMode != POSTITS_NONE)
+ {
+ pDoc->UpdatePagesForPrintingWithPostItData( *m_pRenderData,
+ *m_pPrintUIOptions, bIsPDFExport, nPageCount );
+ }
+
+ nRet = m_pRenderData->GetPagesToPrint().size();
+ }
+ }
+ DBG_ASSERT( nRet >= 0, "negative number of pages???" );
+
+ return nRet;
+}
+/* -----------------------------23.08.02 16:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
+ sal_Int32 nRenderer,
+ const uno::Any& rSelection,
+ const uno::Sequence< beans::PropertyValue >& rxOptions )
+ throw (IllegalArgumentException, RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+
+ const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" );
+ bool bIsSwSrcView = false;
+ SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport );
+
+ // m_pRenderData should NOT be created here!
+ // That should only be done in getRendererCount. If this function is called before
+ // getRendererCount was called then the caller will probably just retrieve the extra UI options
+ // and is not interested in getting valid information about the other data that would
+ // otherwise be provided here!
+// if( ! m_pRenderData )
+// m_pRenderData = new SwRenderData;
+ if (!m_pPrintUIOptions)
+ m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView );
+ m_pPrintUIOptions->processProperties( rxOptions );
+ const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false );
+ const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport );
+ const bool bPrintPaperFromSetup = m_pPrintUIOptions->getBoolValue( "PrintPaperFromSetup", false );
+
+ SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport );
+ DBG_ASSERT( pDoc && pView, "doc or view shell missing!" );
+ if (!pDoc || !pView)
+ return uno::Sequence< beans::PropertyValue >();
+
+ // due to #110067# (document page count changes sometimes during
+ // PDF export/printing) we can not check for the upper bound properly.
+ // Thus instead of throwing the exception we silently return.
+ if (0 > nRenderer)
+ throw IllegalArgumentException();
+ sal_Int32 nMaxRenderer = 0;
+ if (!bIsSwSrcView && m_pRenderData)
+ {
+ DBG_ASSERT( m_pRenderData, "m_pRenderData missing!!" );
+ nMaxRenderer = bPrintProspect?
+ m_pRenderData->GetPagePairsForProspectPrinting().size() - 1 :
+ m_pRenderData->GetPagesToPrint().size() - 1;
+ }
+ // since SwSrcView::PrintSource is a poor implementation to get the number of pages to print
+ // we obmit checking of the upper bound in this case.
+ if (!bIsSwSrcView && m_pRenderData && nRenderer > nMaxRenderer)
+ return uno::Sequence< beans::PropertyValue >();
+
+ uno::Sequence< beans::PropertyValue > aRenderer;
+ if (m_pRenderData)
+ {
+ // --> TL, OD 2010-09-07 #i114210#
+ // determine the correct page number from the renderer index
+ // --> OD 2010-10-01 #i114875
+ // consider brochure print
+ const USHORT nPage = bPrintProspect
+ ? nRenderer + 1
+ : m_pRenderData->GetPagesToPrint()[ nRenderer ];
+ // <--
+
+ // get paper tray to use ...
+ sal_Int32 nPrinterPaperTray = -1;
+ if (! bPrintPaperFromSetup)
+ {
+ // ... from individual page style (see the page tab in Format/Page dialog)
+ const std::map< sal_Int32, sal_Int32 > &rPaperTrays = m_pRenderData->GetPrinterPaperTrays();
+ std::map< sal_Int32, sal_Int32 >::const_iterator aIt( rPaperTrays.find( nPage ) );
+ if (aIt != rPaperTrays.end())
+ nPrinterPaperTray = aIt->second;
+ }
+
+ awt::Size aPageSize;
+ awt::Size aPreferredPageSize;
+ Size aTmpSize;
+ if (bIsSwSrcView || bPrintProspect)
+ {
+ // for printing of HTML source code and prospect printing we should use
+ // the printers paper size since
+ // a) HTML source view has no page size
+ // b) prospect printing has a different page size from the documents page
+ // since two document pages will get rendered on one printer page
+
+ // since PageIncludesNonprintableArea will be set to true we can return the
+ // printers paper size here.
+ // Sometimes 'getRenderer' is only called to get "ExtraPrintUIOptions", in this
+ // case we won't get an OutputDevice here, but then the caller also has no need
+ // for the correct PageSisze right now...
+ Printer *pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions ));
+ if (pPrinter)
+ {
+ // HTML source view and prospect adapt to the printer's paper size
+ aTmpSize = pPrinter->GetPaperSize();
+ aTmpSize = pPrinter->LogicToLogic( aTmpSize,
+ pPrinter->GetMapMode(), MapMode( MAP_100TH_MM ));
+ aPageSize = awt::Size( aTmpSize.Width(), aTmpSize.Height() );
+ if (bPrintProspect)
+ {
+ // we just state what output size we would need
+ // which may cause vcl to set that page size on the printer
+ // (if available and not overriden by the user)
+ aTmpSize = pDoc->GetPageSize( nPage, bIsSkipEmptyPages );
+ aPreferredPageSize = awt::Size ( TWIP_TO_MM100( 2 * aTmpSize.Width() ),
+ TWIP_TO_MM100( aTmpSize.Height() ));
+ }
+ }
+ }
+ else
+ {
+ aTmpSize = pDoc->GetPageSize( nPage, bIsSkipEmptyPages );
+ aPageSize = awt::Size ( TWIP_TO_MM100( aTmpSize.Width() ),
+ TWIP_TO_MM100( aTmpSize.Height() ));
+ }
+
+ sal_Int32 nLen = 2;
+ aRenderer.realloc(2);
+ aRenderer[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) );
+ aRenderer[0].Value <<= aPageSize;
+ aRenderer[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageIncludesNonprintableArea" ) );
+ aRenderer[1].Value <<= sal_True;
+ if (aPreferredPageSize.Width && aPreferredPageSize.Height)
+ {
+ ++nLen;
+ aRenderer.realloc( nLen );
+ aRenderer[ nLen - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PreferredPageSize" ) );
+ aRenderer[ nLen - 1 ].Value <<= aPreferredPageSize;
+ }
+ if (nPrinterPaperTray >= 0)
+ {
+ ++nLen;
+ aRenderer.realloc( nLen );
+ aRenderer[ nLen - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PrinterPaperTray" ) );
+ aRenderer[ nLen - 1 ].Value <<= nPrinterPaperTray;
+ }
+ }
+
+ m_pPrintUIOptions->appendPrintUIOptions( aRenderer );
+
+ return aRenderer;
+}
+/* -----------------------------28.10.02 16:00--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SfxViewShell * SwXTextDocument::GuessViewShell(
+ /* out */ bool &rbIsSwSrcView,
+ const uno::Reference< css::frame::XController > xController )
+{
+ // #130810# SfxViewShell::Current() / SfxViewShell::GetObjectShell()
+ // must not be used (see comment from MBA)
+ //
+ SfxViewShell *pView = 0;
+ SwView *pSwView = 0;
+ SwPagePreView *pSwPagePreView = 0;
+ SwSrcView *pSwSrcView = 0;
+ SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pDocShell, sal_False );
+
+ // look for the view shell with the same controller in use,
+ // otherwise look for a suitable view, preferably a SwView,
+ // if that one is not found use a SwPagePreView if found.
+ while (pFrame)
+ {
+ pView = pFrame->GetViewShell();
+ pSwView = dynamic_cast< SwView * >(pView);
+ pSwSrcView = dynamic_cast< SwSrcView * >(pView);
+ if (!pSwPagePreView)
+ pSwPagePreView = dynamic_cast< SwPagePreView * >(pView);
+ if (xController.is())
+ {
+ if (pView && pView->GetController() == xController)
+ break;
+ }
+ else if (pSwView || pSwSrcView)
+ break;
+ pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell, sal_False );
+ }
+
+ DBG_ASSERT( pSwView || pSwPagePreView || pSwSrcView, "failed to get view shell" );
+ if (pView)
+ rbIsSwSrcView = pSwSrcView != 0;
+ return pView;
+// return pSwView ? dynamic_cast< SfxViewShell * >(pSwView) :
+// (pSwSrcView ? dynamic_cast< SfxViewShell * >(pSwSrcView) :
+// dynamic_cast< SfxViewShell * >(pSwPagePreView) );
+}
+
+
+void SAL_CALL SwXTextDocument::render(
+ sal_Int32 nRenderer,
+ const uno::Any& rSelection,
+ const uno::Sequence< beans::PropertyValue >& rxOptions )
+ throw (IllegalArgumentException, RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+
+ // due to #110067# (document page count changes sometimes during
+ // PDF export/printing) we can not check for the upper bound properly.
+ // Thus instead of throwing the exception we silently return.
+ if (0 > nRenderer)
+ throw IllegalArgumentException();
+
+ const bool bIsPDFExport = !lcl_SeqHasProperty( rxOptions, "IsPrinter" );
+ bool bIsSwSrcView = false;
+ SfxViewShell *pView = GetRenderView( bIsSwSrcView, rxOptions, bIsPDFExport );
+
+ DBG_ASSERT( m_pRenderData, "data should have been created already in getRendererCount..." );
+ DBG_ASSERT( m_pPrintUIOptions, "data should have been created already in getRendererCount..." );
+ if (!bIsSwSrcView && !m_pRenderData)
+ m_pRenderData = new SwRenderData;
+ if (!m_pPrintUIOptions)
+ m_pPrintUIOptions = lcl_GetPrintUIOptions( pDocShell, pView );
+ m_pPrintUIOptions->processProperties( rxOptions );
+ const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false );
+ const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False );
+
+ SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport );
+ DBG_ASSERT( pDoc && pView, "doc or view shell missing!" );
+ if (pDoc && pView)
+ {
+ sal_Int32 nMaxRenderer = 0;
+ if (!bIsSwSrcView)
+ {
+ DBG_ASSERT( m_pRenderData, "m_pRenderData missing!!" );
+ nMaxRenderer = bPrintProspect?
+ m_pRenderData->GetPagePairsForProspectPrinting().size() - 1 :
+ m_pRenderData->GetPagesToPrint().size() - 1;
+ }
+ // since SwSrcView::PrintSource is a poor implementation to get the number of pages to print
+ // we obmit checking of the upper bound in this case.
+ if (bIsSwSrcView || nRenderer <= nMaxRenderer)
+ {
+ if (bIsSwSrcView)
+ {
+ SwSrcView *pSwSrcView = dynamic_cast< SwSrcView * >(pView);
+ OutputDevice *pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions );
+ pSwSrcView->PrintSource( pOutDev, nRenderer + 1, false );
+ }
+ else
+ {
+ // the view shell should be SwView for documents PDF export
+ // or SwPagePreView for PDF export of the page preview
+ //!! (check for SwView first as in GuessViewShell) !!
+ DBG_ASSERT( pView, "!! view missing !!" );
+ const TypeId aSwViewTypeId = TYPE(SwView);
+ ViewShell* pVwSh = 0;
+ if (pView)
+ {
+ pVwSh = pView->IsA(aSwViewTypeId) ?
+ ((SwView*)pView)->GetWrtShellPtr() :
+ ((SwPagePreView*)pView)->GetViewShell();
+ }
+
+ // get output device to use
+ OutputDevice * pOut = lcl_GetOutputDevice( *m_pPrintUIOptions );
+
+ if(pVwSh && pOut && m_pRenderData->HasSwPrtOptions())
+ {
+ const rtl::OUString aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() );
+ const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage", sal_False );
+ bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport );
+
+ DBG_ASSERT(( pView->IsA(aSwViewTypeId) && m_pRenderData->IsViewOptionAdjust())
+ || (!pView->IsA(aSwViewTypeId) && !m_pRenderData->IsViewOptionAdjust()),
+ "SwView / SwViewOptionAdjust_Impl availability mismatch" );
+
+ // since printing now also use the API for PDF export this option
+ // should be set for printing as well ...
+ pVwSh->SetPDFExportOption( sal_True );
+
+ // --> FME 2004-06-08 #i12836# enhanced pdf export
+ //
+ // First, we have to export hyperlinks, notes, and outline to pdf.
+ // During this process, additional information required for tagging
+ // the pdf file are collected, which are evaulated during painting.
+ //
+ SwWrtShell* pWrtShell = pView->IsA(aSwViewTypeId) ?
+ ((SwView*)pView)->GetWrtShellPtr() :
+ 0;
+
+ if (bIsPDFExport && bFirstPage && pWrtShell)
+ {
+ SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_False );
+ }
+ // <--
+
+ SwPrintData const& rSwPrtOptions =
+ *m_pRenderData->GetSwPrtOptions();
+ if (bPrintProspect)
+ pVwSh->PrintProspect( pOut, rSwPrtOptions, nRenderer );
+ else // normal printing and PDF export
+ pVwSh->PrintOrPDFExport( pOut, rSwPrtOptions, nRenderer );
+
+ // --> FME 2004-10-08 #i35176#
+ //
+ // After printing the last page, we take care for the links coming
+ // from the EditEngine. The links are generated during the painting
+ // process, but the destinations are still missing.
+ //
+ if (bIsPDFExport && bLastPage && pWrtShell)
+ {
+ SwEnhancedPDFExportHelper aHelper( *pWrtShell, *pOut, aPageRange, bIsSkipEmptyPages, sal_True );
+ }
+ // <--
+
+ pVwSh->SetPDFExportOption( sal_False );
+
+ // last page to be rendered? (not necessarily the last page of the document)
+ // -> do clean-up of data
+ if (bLastPage)
+ {
+ // #i96167# haggai: delete ViewOptionsAdjust here because it makes use
+ // of the shell, which might get destroyed in lcl_DisposeView!
+ if (m_pRenderData && m_pRenderData->IsViewOptionAdjust())
+ m_pRenderData->ViewOptionAdjustStop();
+
+ if (m_pRenderData && m_pRenderData->HasPostItData())
+ m_pRenderData->DeletePostItData();
+ if (m_pHiddenViewFrame)
+ {
+ lcl_DisposeView( m_pHiddenViewFrame, pDocShell );
+ m_pHiddenViewFrame = 0;
+
+ // prevent crash described in #i108805
+ SwDocShell *pRenderDocShell = pDoc->GetDocShell();
+ SfxItemSet *pSet = pRenderDocShell->GetMedium()->GetItemSet();
+ pSet->Put( SfxBoolItem( SID_HIDDEN, sal_False ) );
+
+ }
+ }
+ }
+ }
+ }
+ }
+ if( bLastPage )
+ {
+ delete m_pRenderData; m_pRenderData = NULL;
+ delete m_pPrintUIOptions; m_pPrintUIOptions = NULL;
+ }
+}
+/* -----------------------------03.10.04 -------------------------------------
+
+ ---------------------------------------------------------------------------*/
+ // xforms::XFormsSupplier
+Reference<XNameContainer> SAL_CALL SwXTextDocument::getXForms()
+ throw( RuntimeException )
+{
+ if ( !pDocShell )
+ throw DisposedException( ::rtl::OUString(), static_cast< XTextDocument* >( this ) );
+ SwDoc* pDoc = pDocShell->GetDoc();
+ return pDoc->getXForms();
+}
+
+/* -----------------------------25.09.07 -------------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Reference< text::XFlatParagraphIterator > SAL_CALL SwXTextDocument::getFlatParagraphIterator(::sal_Int32 nTextMarkupType, sal_Bool bAutomatic)
+ throw ( uno::RuntimeException )
+{
+ return new SwXFlatParagraphIterator( *pDocShell->GetDoc(), nTextMarkupType, bAutomatic );
+}
+/*-- 07.05.2009 09:21:12---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< util::XCloneable > SwXTextDocument::createClone( ) throw (uno::RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(!IsValid())
+ throw RuntimeException();
+
+ // create a new document - hidden - copy the storage and return it
+ // SfxObjectShellRef is used here, since the model should control object lifetime after creation
+ // and thus SfxObjectShellLock is not allowed here
+ // the model holds reference to the shell, so the shell will not destructed at the end of method
+ SfxObjectShellRef pShell = pDocShell->GetDoc()->CreateCopy(false);
+ uno::Reference< frame::XModel > xNewModel = pShell->GetModel();
+ uno::Reference< embed::XStorage > xNewStorage = ::comphelper::OStorageHelper::GetTemporaryStorage( );
+ uno::Sequence< beans::PropertyValue > aTempMediaDescriptor;
+ storeToStorage( xNewStorage, aTempMediaDescriptor );
+ uno::Reference< document::XStorageBasedDocument > xStorageDoc( xNewModel, uno::UNO_QUERY );
+ xStorageDoc->loadFromStorage( xNewStorage, aTempMediaDescriptor );
+ return uno::Reference< util::XCloneable >( xNewModel, UNO_QUERY );
+}
+/* -----------------------------20.06.00 09:54--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void * SAL_CALL SwXTextDocument::operator new( size_t t) throw()
+{
+ return SwXTextDocumentBaseClass::operator new(t);
+}
+/* -----------------------------20.06.00 09:54--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextDocument::operator delete( void * p) throw()
+{
+ SwXTextDocumentBaseClass::operator delete(p);
+}
+
+
+/*---------------------------------------------------
+retrieve languages already used in current document
+-----------------------------------------------------*/
+uno::Sequence< lang::Locale > SAL_CALL SwXTextDocument::getDocumentLanguages(
+ ::sal_Int16 nScriptTypes,
+ ::sal_Int16 nMaxCount )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+
+ // possible canonical values for nScriptTypes
+ // any bit wise combination is allowed
+ const sal_Int16 nLatin = 0x001;
+ const sal_Int16 nAsian = 0x002;
+ const sal_Int16 nComplex = 0x004;
+
+ // script types for which to get the languages
+ const bool bLatin = 0 != (nScriptTypes & nLatin);
+ const bool bAsian = 0 != (nScriptTypes & nAsian);
+ const bool bComplex = 0 != (nScriptTypes & nComplex);
+
+ if (nScriptTypes < nLatin || nScriptTypes > (nLatin | nAsian | nComplex))
+ throw IllegalArgumentException(::rtl::OUString::createFromAscii("nScriptTypes ranges from 1 to 7!"), Reference< XInterface >(), 1);
+ if (!pDocShell)
+ throw DisposedException();
+ SwDoc* pDoc = pDocShell->GetDoc();
+
+ // avoid duplicate values
+ std::set< LanguageType > aAllLangs;
+
+ //USER STYLES
+
+ const SwCharFmts *pFmts = pDoc->GetCharFmts();
+ for(USHORT i = 0; i < pFmts->Count(); ++i)
+ {
+ const SwAttrSet &rAttrSet = (*pFmts)[i]->GetAttrSet();
+ LanguageType nLang = LANGUAGE_DONTKNOW;
+ if (bLatin)
+ {
+ nLang = rAttrSet.GetLanguage( FALSE ).GetLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aAllLangs.insert( nLang );
+ }
+ if (bAsian)
+ {
+ nLang = rAttrSet.GetCJKLanguage( FALSE ).GetLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aAllLangs.insert( nLang );
+ }
+ if (bComplex)
+ {
+ nLang = rAttrSet.GetCTLLanguage( FALSE ).GetLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aAllLangs.insert( nLang );
+ }
+ }
+
+ const SwTxtFmtColls *pColls = pDoc->GetTxtFmtColls();
+ for (USHORT i = 0; i < pColls->Count(); ++i)
+ {
+ const SwAttrSet &rAttrSet = (*pColls)[i]->GetAttrSet();
+ LanguageType nLang = LANGUAGE_DONTKNOW;;
+ if (bLatin)
+ {
+ nLang = rAttrSet.GetLanguage( FALSE ).GetLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aAllLangs.insert( nLang );
+ }
+ if (bAsian)
+ {
+ nLang = rAttrSet.GetCJKLanguage( FALSE ).GetLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aAllLangs.insert( nLang );
+ }
+ if (bComplex)
+ {
+ nLang = rAttrSet.GetCTLLanguage( FALSE ).GetLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aAllLangs.insert( nLang );
+ }
+ }
+
+ //AUTO STYLES
+ const IStyleAccess::SwAutoStyleFamily aFam[2] =
+ {
+ IStyleAccess::AUTO_STYLE_CHAR,
+ IStyleAccess::AUTO_STYLE_PARA
+ };
+ for (sal_uInt16 i = 0; i < 2; ++i)
+ {
+ std::vector< SfxItemSet_Pointer_t > rStyles;
+ pDoc->GetIStyleAccess().getAllStyles(rStyles, aFam[i]);
+ while (!rStyles.empty())
+ {
+ SfxItemSet_Pointer_t pStyle = rStyles.back();
+ rStyles.pop_back();
+ const SfxItemSet *pSet = dynamic_cast< const SfxItemSet * >(pStyle.get());
+
+ LanguageType nLang = LANGUAGE_DONTKNOW;
+ if (bLatin)
+ {
+ nLang = dynamic_cast< const SvxLanguageItem & >(pSet->Get( RES_CHRATR_LANGUAGE, FALSE )).GetLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aAllLangs.insert( nLang );
+ }
+ if (bAsian)
+ {
+ nLang = dynamic_cast< const SvxLanguageItem & >(pSet->Get( RES_CHRATR_CJK_LANGUAGE, FALSE )).GetLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aAllLangs.insert( nLang );
+ }
+ if (bComplex)
+ {
+ nLang = dynamic_cast< const SvxLanguageItem & >(pSet->Get( RES_CHRATR_CTL_LANGUAGE, FALSE )).GetLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aAllLangs.insert( nLang );
+ }
+ }
+ }
+
+ //get languages from "drawobject"
+ SwWrtShell *pWrtSh = pDocShell->GetWrtShell();
+ SdrView *pSdrView = pWrtSh->GetDrawView();
+
+ if( pSdrView )
+ {
+ SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner();
+ if(pOutliner)
+ {
+ EditEngine& rEditEng = (EditEngine&)pOutliner->GetEditEngine();
+ ULONG nParCount = pOutliner->GetParagraphCount();
+ for (ULONG nPar=0; nPar<nParCount; nPar++)
+ {
+ //every paragraph
+ SvUShorts aPortions;
+ rEditEng.GetPortions( (USHORT)nPar, aPortions );
+
+ for ( USHORT nPos = aPortions.Count(); nPos; )
+ {
+ //every position
+ --nPos;
+ USHORT nEnd = aPortions.GetObject( nPos );
+ USHORT nStart = nPos ? aPortions.GetObject( nPos - 1 ) : 0;
+ ESelection aSelection( (USHORT)nPar, nStart, (USHORT)nPar, nEnd );
+ SfxItemSet aAttr = rEditEng.GetAttribs( aSelection );
+
+ LanguageType nLang = LANGUAGE_DONTKNOW;
+ if (bLatin)
+ {
+ nLang = dynamic_cast< const SvxLanguageItem & >(aAttr.Get( EE_CHAR_LANGUAGE, FALSE )).GetLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aAllLangs.insert( nLang );
+ }
+ if (bAsian)
+ {
+ nLang = dynamic_cast< const SvxLanguageItem & >(aAttr.Get( EE_CHAR_LANGUAGE_CJK, FALSE )).GetLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aAllLangs.insert( nLang );
+ }
+ if (bComplex)
+ {
+ nLang = dynamic_cast< const SvxLanguageItem & >(aAttr.Get( EE_CHAR_LANGUAGE_CTL, FALSE )).GetLanguage();
+ if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
+ aAllLangs.insert( nLang );
+ }
+ }
+ }
+ }
+ }
+ // less than nMaxCount languages
+ if (nMaxCount > static_cast< sal_Int16 >( aAllLangs.size() ))
+ nMaxCount = static_cast< sal_Int16 >( aAllLangs.size() );
+
+ // build return value
+ sal_Int32 nCount = 0;
+ uno::Sequence< lang::Locale > aLanguages( nMaxCount );
+ lang::Locale* pLanguage = aLanguages.getArray();
+ if (nMaxCount > 0)
+ {
+ const SvtLanguageTable aLangTab;
+ for (std::set< LanguageType >::const_iterator it = aAllLangs.begin(); it != aAllLangs.end(); ++it)
+ {
+ if (nCount >= nMaxCount)
+ break;
+ if (LANGUAGE_NONE != *it)
+ {
+ MsLangId::convertLanguageToLocale( *it, pLanguage[nCount] );
+ pLanguage[nCount].Language = aLangTab.GetString( *it );
+ nCount += 1;
+ }
+ }
+ }
+
+ return aLanguages;
+}
+
+/* -----------------25.10.99 11:06-------------------
+
+ --------------------------------------------------*/
+SwXLinkTargetSupplier::SwXLinkTargetSupplier(SwXTextDocument& rxDoc) :
+ pxDoc(&rxDoc)
+{
+ sTables = String(SW_RES(STR_CONTENT_TYPE_TABLE));
+ sFrames = String(SW_RES(STR_CONTENT_TYPE_FRAME));
+ sGraphics = String(SW_RES(STR_CONTENT_TYPE_GRAPHIC));
+ sOLEs = String(SW_RES(STR_CONTENT_TYPE_OLE));
+ sSections = String(SW_RES(STR_CONTENT_TYPE_REGION));
+ sOutlines = String(SW_RES(STR_CONTENT_TYPE_OUTLINE));
+ sBookmarks = String(SW_RES(STR_CONTENT_TYPE_BOOKMARK));
+}
+/* -----------------25.10.99 11:11-------------------
+
+ --------------------------------------------------*/
+SwXLinkTargetSupplier::~SwXLinkTargetSupplier()
+{
+}
+
+/*-- 25.10.99 11:12:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXLinkTargetSupplier::getByName(const OUString& rName)
+ throw( NoSuchElementException, WrappedTargetException, RuntimeException )
+{
+ Any aRet;
+ if(!pxDoc)
+ throw RuntimeException();
+ String sToCompare(rName);
+ String sSuffix('|');
+ if(sToCompare == sTables)
+ {
+ sSuffix += UniString::CreateFromAscii(pMarkToTable);
+
+ Reference< XNameAccess > xTbls = new SwXLinkNameAccessWrapper(
+ pxDoc->getTextTables(), sToCompare, sSuffix );
+ Reference< XPropertySet > xRet(xTbls, UNO_QUERY);
+ aRet.setValue(&xRet, ::getCppuType((Reference<XPropertySet>*)0));
+ }
+ else if(sToCompare == sFrames)
+ {
+ sSuffix += UniString::CreateFromAscii(pMarkToFrame);
+ Reference< XNameAccess > xTbls = new SwXLinkNameAccessWrapper(
+ pxDoc->getTextFrames(), sToCompare, sSuffix );
+ Reference< XPropertySet > xRet(xTbls, UNO_QUERY);
+ aRet.setValue(&xRet, ::getCppuType((Reference< XPropertySet>*)0));
+ }
+ else if(sToCompare == sSections)
+ {
+ sSuffix += UniString::CreateFromAscii(pMarkToRegion);
+ Reference< XNameAccess > xTbls = new SwXLinkNameAccessWrapper(
+ pxDoc->getTextSections(), sToCompare, sSuffix );
+ Reference< XPropertySet > xRet(xTbls, UNO_QUERY);
+ aRet.setValue(&xRet, ::getCppuType((Reference< XPropertySet>*)0));
+ }
+/* else if(sToCompare == )
+ {
+ sSuffix += UniString::CreateFromAscii(pMarkToText);
+ Reference< XNameAccess > xTbls = new SwXLinkNameAccessWrapper(
+ pxDoc->, sSuffix );
+ Reference< XPropertySet > xRet(xTbls, UNO_QUERY);
+ aRet.setValue(&xRet, ::getCppuType((const XPropertySet*)0));
+ }*/
+ else if(sToCompare == sGraphics)
+ {
+ sSuffix += UniString::CreateFromAscii(pMarkToGraphic);
+ Reference< XNameAccess > xTbls = new SwXLinkNameAccessWrapper(
+ pxDoc->getGraphicObjects(), sToCompare, sSuffix );
+ Reference< XPropertySet > xRet(xTbls, UNO_QUERY);
+ aRet.setValue(&xRet, ::getCppuType((Reference< XPropertySet>*)0));
+ }
+ else if(sToCompare == sOLEs)
+ {
+ sSuffix += UniString::CreateFromAscii(pMarkToOLE);
+ Reference< XNameAccess > xTbls = new SwXLinkNameAccessWrapper(
+ pxDoc->getEmbeddedObjects(), sToCompare, sSuffix );
+ Reference< XPropertySet > xRet(xTbls, UNO_QUERY);
+ aRet.setValue(&xRet, ::getCppuType((Reference< XPropertySet>*)0));
+ }
+ else if(sToCompare == sOutlines)
+ {
+ sSuffix += UniString::CreateFromAscii(pMarkToOutline);
+ Reference< XNameAccess > xTbls = new SwXLinkNameAccessWrapper(
+ *pxDoc, sToCompare, sSuffix );
+ Reference< XPropertySet > xRet(xTbls, UNO_QUERY);
+ aRet.setValue(&xRet, ::getCppuType((Reference< XPropertySet>*)0));
+ }
+ else if(sToCompare == sBookmarks)
+ {
+ sSuffix.Erase();
+ Reference< XNameAccess > xBkms = new SwXLinkNameAccessWrapper(
+ pxDoc->getBookmarks(), sToCompare, sSuffix );
+ Reference< XPropertySet > xRet(xBkms, UNO_QUERY);
+ aRet.setValue(&xRet, ::getCppuType((Reference< XPropertySet>*)0));
+ }
+ else
+ throw NoSuchElementException();
+ return aRet;
+}
+/*-- 25.10.99 11:12:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< OUString > SwXLinkTargetSupplier::getElementNames(void)
+ throw( RuntimeException )
+{
+ Sequence< OUString > aRet(7);
+ OUString* pNames = aRet.getArray();
+ pNames[0] = sTables;
+ pNames[1] = sFrames ;
+ pNames[2] = sGraphics;
+ pNames[3] = sOLEs ;
+ pNames[4] = sSections;
+ pNames[5] = sOutlines;
+ pNames[6] = sBookmarks;
+ return aRet;
+}
+/*-- 25.10.99 11:12:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXLinkTargetSupplier::hasByName(const OUString& rName)
+ throw( RuntimeException )
+{
+ String sToCompare(rName);
+ if( sToCompare == sTables ||
+ sToCompare == sFrames ||
+ sToCompare == sGraphics||
+ sToCompare == sOLEs ||
+ sToCompare == sSections ||
+ sToCompare == sOutlines ||
+ sToCompare == sBookmarks )
+ return sal_True;
+ return sal_False;
+}
+/*-- 25.10.99 11:12:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXLinkTargetSupplier::getElementType(void)
+ throw( RuntimeException )
+{
+ return ::getCppuType((Reference< XPropertySet>*)0);
+
+}
+/*-- 25.10.99 11:12:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXLinkTargetSupplier::hasElements(void) throw( RuntimeException )
+{
+ return 0 != pxDoc;
+}
+/*-- 25.10.99 11:12:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXLinkTargetSupplier::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXLinkTargetSupplier");
+}
+/*-- 25.10.99 11:12:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXLinkTargetSupplier::supportsService(const OUString& rServiceName)
+ throw( RuntimeException )
+{
+ return (rServiceName == C2U("com.sun.star.document.LinkTargets"));
+}
+/*-- 25.10.99 11:12:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< OUString > SwXLinkTargetSupplier::getSupportedServiceNames(void)
+ throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pNames = aRet.getArray();
+ pNames[0] = C2U("com.sun.star.document.LinkTargets");
+ return aRet;
+}
+
+/*-- 26.10.99 09:16:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXLinkNameAccessWrapper::SwXLinkNameAccessWrapper(
+ Reference< XNameAccess > xAccess, const String& rLinkDisplayName, String sSuffix ) :
+ xRealAccess(xAccess),
+ pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_LINK_TARGET)),
+ sLinkSuffix(sSuffix),
+ sLinkDisplayName(rLinkDisplayName),
+ pxDoc(0)
+{
+}
+/* -----------------26.10.99 14:17-------------------
+
+ --------------------------------------------------*/
+SwXLinkNameAccessWrapper::SwXLinkNameAccessWrapper(SwXTextDocument& rxDoc,
+ const String& rLinkDisplayName, String sSuffix) :
+ pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_LINK_TARGET)),
+ sLinkSuffix(sSuffix),
+ sLinkDisplayName(rLinkDisplayName),
+ xDoc(&rxDoc),
+ pxDoc(&rxDoc)
+{
+}
+/*-- 26.10.99 09:16:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXLinkNameAccessWrapper::~SwXLinkNameAccessWrapper()
+{
+}
+/*-- 26.10.99 09:16:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXLinkNameAccessWrapper::getByName(const OUString& rName)
+ throw( NoSuchElementException, WrappedTargetException, RuntimeException )
+{
+ Any aRet;
+ sal_Bool bFound = sal_False;
+ //cut link extension and call the real NameAccess
+ String sParam = rName;
+ String sSuffix(sLinkSuffix);
+ if(sParam.Len() > sSuffix.Len() )
+ {
+ String sCmp = sParam.Copy(sParam.Len() - sSuffix.Len(),
+ sSuffix.Len());
+ if(sCmp == sSuffix)
+ {
+ if(pxDoc)
+ {
+ sParam = sParam.Copy(0, sParam.Len() - sSuffix.Len());
+ if(!pxDoc->GetDocShell())
+ throw RuntimeException();
+ SwDoc* pDoc = pxDoc->GetDocShell()->GetDoc();
+ sal_uInt16 nOutlineCount = pDoc->GetNodes().GetOutLineNds().Count();
+
+ for (sal_uInt16 i = 0; i < nOutlineCount && !bFound; ++i)
+ {
+ const SwOutlineNodes& rOutlineNodes = pDoc->GetNodes().GetOutLineNds();
+ const SwNumRule* pOutlRule = pDoc->GetOutlineNumRule();
+ if(sParam ==
+ lcl_CreateOutlineString(i, rOutlineNodes, pOutlRule))
+ {
+ Reference< XPropertySet > xOutline = new SwXOutlineTarget(sParam);
+ aRet.setValue(&xOutline, ::getCppuType((Reference<XPropertySet>*)0));
+ bFound = sal_True;
+ }
+ }
+ }
+ else
+ {
+ aRet = xRealAccess->getByName(sParam.Copy(0, sParam.Len() - sSuffix.Len()));
+ Reference< XInterface > xInt;
+ if(!(aRet >>= xInt))
+ throw RuntimeException();
+ Reference< XPropertySet > xProp(xInt, UNO_QUERY);
+ aRet <<= xProp;
+ bFound = sal_True;
+ }
+ }
+ }
+ if(!bFound)
+ throw NoSuchElementException();
+ return aRet;
+}
+/*-- 26.10.99 09:16:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< OUString > SwXLinkNameAccessWrapper::getElementNames(void)
+ throw( RuntimeException )
+{
+ Sequence< OUString > aRet;
+ if(pxDoc)
+ {
+ if(!pxDoc->GetDocShell())
+ throw RuntimeException();
+
+ SwDoc* pDoc = pxDoc->GetDocShell()->GetDoc();
+ const SwOutlineNodes& rOutlineNodes = pDoc->GetNodes().GetOutLineNds();
+ sal_uInt16 nOutlineCount = rOutlineNodes.Count();
+ aRet.realloc(nOutlineCount);
+ OUString* pResArr = aRet.getArray();
+ String sSuffix('|');
+ sSuffix += UniString::CreateFromAscii(pMarkToOutline);
+ const SwNumRule* pOutlRule = pDoc->GetOutlineNumRule();
+ for (sal_uInt16 i = 0; i < nOutlineCount; ++i)
+ {
+ String sEntry = lcl_CreateOutlineString(i, rOutlineNodes, pOutlRule);
+ sEntry += sSuffix;
+ pResArr[i] = sEntry;
+ }
+ }
+ else
+ {
+ Sequence< OUString > aOrg = xRealAccess->getElementNames();
+ const OUString* pOrgArr = aOrg.getConstArray();
+ aRet.realloc(aOrg.getLength());
+ OUString* pResArr = aRet.getArray();
+ for(long i = 0; i < aOrg.getLength(); i++)
+ {
+ pResArr[i] = pOrgArr[i] + sLinkSuffix;
+ }
+ }
+ return aRet;
+}
+/*-- 26.10.99 09:16:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXLinkNameAccessWrapper::hasByName(const OUString& rName)
+ throw( RuntimeException )
+{
+ sal_Bool bRet = sal_False;
+ String sParam(rName);
+ if(sParam.Len() > sLinkSuffix.Len() )
+ {
+ String sCmp = sParam.Copy(sParam.Len() - sLinkSuffix.Len(),
+ sLinkSuffix.Len());
+ if(sCmp == sLinkSuffix)
+ {
+ sParam = sParam.Copy(0, sParam.Len() - sLinkSuffix.Len());
+ if(pxDoc)
+ {
+ if(!pxDoc->GetDocShell())
+ throw RuntimeException();
+ SwDoc* pDoc = pxDoc->GetDocShell()->GetDoc();
+ sal_uInt16 nOutlineCount = pDoc->GetNodes().GetOutLineNds().Count();
+
+ for (sal_uInt16 i = 0; i < nOutlineCount && !bRet; ++i)
+ {
+ const SwOutlineNodes& rOutlineNodes = pDoc->GetNodes().GetOutLineNds();
+ const SwNumRule* pOutlRule = pDoc->GetOutlineNumRule();
+ if(sParam ==
+ lcl_CreateOutlineString(i, rOutlineNodes, pOutlRule))
+ {
+ bRet = sal_True;
+ }
+ }
+ }
+ else
+ {
+ bRet = xRealAccess->hasByName(sParam);
+ }
+ }
+ }
+ return bRet;
+}
+/*-- 26.10.99 09:16:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Type SwXLinkNameAccessWrapper::getElementType(void)
+ throw( RuntimeException )
+{
+ return ::getCppuType((Reference<XPropertySet>*)0);
+}
+/*-- 26.10.99 09:16:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXLinkNameAccessWrapper::hasElements(void) throw( RuntimeException )
+{
+ sal_Bool bRet = sal_False;
+ if(pxDoc)
+ {
+ DBG_ERROR("not implemented");
+ }
+ else
+ {
+ bRet = xRealAccess->hasElements();
+ }
+ return bRet;
+}
+/*-- 26.10.99 09:16:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySetInfo > SwXLinkNameAccessWrapper::getPropertySetInfo(void)
+ throw( RuntimeException )
+{
+ static Reference< XPropertySetInfo > xRet = pPropSet->getPropertySetInfo();
+ return xRet;
+}
+/*-- 26.10.99 09:16:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXLinkNameAccessWrapper::setPropertyValue(
+ const OUString& , const Any& )
+ throw( UnknownPropertyException,
+ PropertyVetoException,
+ IllegalArgumentException,
+ WrappedTargetException,
+ RuntimeException)
+{
+ throw UnknownPropertyException();
+}
+/* -----------------------------08.12.99 11:10--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Any lcl_GetDisplayBitmap(String sLinkSuffix)
+{
+ Any aRet;
+ if(sLinkSuffix.Len())
+ sLinkSuffix.Erase(0, 1);
+ sal_uInt16 nImgId = USHRT_MAX;
+
+ if(COMPARE_EQUAL == sLinkSuffix.CompareToAscii(pMarkToOutline))
+ nImgId = CONTENT_TYPE_OUTLINE;
+ else if(COMPARE_EQUAL == sLinkSuffix.CompareToAscii(pMarkToTable))
+ nImgId = CONTENT_TYPE_TABLE;
+ else if(COMPARE_EQUAL == sLinkSuffix.CompareToAscii(pMarkToFrame))
+ nImgId = CONTENT_TYPE_FRAME;
+ else if(COMPARE_EQUAL == sLinkSuffix.CompareToAscii(pMarkToGraphic))
+ nImgId = CONTENT_TYPE_GRAPHIC;
+// else if(== sLinkSuffix)
+// nImgId = CONTENT_TYPE_BOOKMARK;
+ else if(COMPARE_EQUAL == sLinkSuffix.CompareToAscii(pMarkToRegion))
+ nImgId = CONTENT_TYPE_REGION;
+ else if(COMPARE_EQUAL == sLinkSuffix.CompareToAscii(pMarkToOLE))
+ nImgId = CONTENT_TYPE_OLE;
+ else if(!sLinkSuffix.Len())
+ nImgId = CONTENT_TYPE_BOOKMARK;
+ if(USHRT_MAX != nImgId)
+ {
+ nImgId += 20000;
+ BOOL bHighContrast = Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+ ImageList aEntryImages( SW_RES(bHighContrast ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP) );
+ const Image& rImage = aEntryImages.GetImage( nImgId );
+ Bitmap aBitmap( rImage.GetBitmapEx().GetBitmap() );
+ Reference<awt::XBitmap> xBmp = VCLUnoHelper::CreateBitmap( aBitmap );
+ aRet.setValue( &xBmp, ::getCppuType((Reference<awt::XBitmap>*)0) );
+ }
+ return aRet;
+}
+/*-- 26.10.99 09:16:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXLinkNameAccessWrapper::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ Any aRet;
+ if( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_LINK_DISPLAY_NAME)))
+ {
+ aRet <<= OUString(sLinkDisplayName);
+ }
+ else if( rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_LINK_DISPLAY_BITMAP)))
+ {
+ aRet = lcl_GetDisplayBitmap(sLinkSuffix);
+ }
+ else
+ throw UnknownPropertyException();
+ return aRet;
+}
+/*-- 26.10.99 09:16:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXLinkNameAccessWrapper::addPropertyChangeListener(
+ const OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{}
+/*-- 26.10.99 09:16:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXLinkNameAccessWrapper::removePropertyChangeListener(
+ const OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{}
+/*-- 26.10.99 09:16:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXLinkNameAccessWrapper::addVetoableChangeListener(
+ const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{}
+/*-- 26.10.99 09:16:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXLinkNameAccessWrapper::removeVetoableChangeListener(
+ const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{}
+/*-- 26.10.99 09:16:32---------------------------------------------------
+
+
+ -----------------------------------------------------------------------*/
+Reference< XNameAccess > SwXLinkNameAccessWrapper::getLinks(void)
+ throw( RuntimeException )
+{
+ return (SwXLinkNameAccessWrapper*)this;
+}
+
+/*-- 26.10.99 09:21:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+OUString SwXLinkNameAccessWrapper::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXLinkNameAccessWrapper");
+}
+/*-- 26.10.99 09:21:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXLinkNameAccessWrapper::supportsService(const OUString& rServiceName)
+ throw( RuntimeException )
+{
+ return (rServiceName == C2U("com.sun.star.document.LinkTargets"));
+}
+/*-- 26.10.99 09:21:48---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< OUString > SwXLinkNameAccessWrapper::getSupportedServiceNames(void)
+ throw( RuntimeException )
+{
+ Sequence< OUString > aRet(1);
+ OUString* pNames = aRet.getArray();
+ pNames[0] = C2U("com.sun.star.document.LinkTargets");
+ return aRet;
+}
+/* -----------------26.10.99 15:50-------------------
+
+ --------------------------------------------------*/
+SwXOutlineTarget::SwXOutlineTarget(const String& rOutlineText) :
+ pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_LINK_TARGET)),
+ sOutlineText(rOutlineText)
+{
+}
+/*-- 26.10.99 15:51:45---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXOutlineTarget::~SwXOutlineTarget()
+{
+}
+/*-- 26.10.99 15:51:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Reference< XPropertySetInfo > SwXOutlineTarget::getPropertySetInfo(void) throw( RuntimeException )
+{
+ static Reference< XPropertySetInfo > xRet = pPropSet->getPropertySetInfo();
+ return xRet;
+}
+/*-- 26.10.99 15:51:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXOutlineTarget::setPropertyValue(
+ const OUString& /*PropertyName*/, const Any& /*aValue*/)
+ throw( UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ throw UnknownPropertyException();
+}
+/*-- 26.10.99 15:51:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXOutlineTarget::getPropertyValue(const OUString& rPropertyName)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+ Any aRet;
+ if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_LINK_DISPLAY_NAME)))
+ aRet <<= OUString(sOutlineText);
+ else
+ throw UnknownPropertyException();
+ return aRet;
+}
+/*-- 26.10.99 15:51:46---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXOutlineTarget::addPropertyChangeListener(
+ const OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+}
+/*-- 26.10.99 15:51:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXOutlineTarget::removePropertyChangeListener(
+ const OUString& /*PropertyName*/, const Reference< XPropertyChangeListener > & /*aListener*/)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+}
+/*-- 26.10.99 15:51:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXOutlineTarget::addVetoableChangeListener(
+ const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+}
+/*-- 26.10.99 15:51:47---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXOutlineTarget::removeVetoableChangeListener(
+ const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener > & /*aListener*/)
+ throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
+{
+}
+/* -----------------03.05.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+OUString SwXOutlineTarget::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXOutlineTarget");
+}
+/* -----------------03.05.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+sal_Bool SwXOutlineTarget::supportsService(const OUString& ServiceName) throw( RuntimeException )
+{
+ return C2U("com.sun.star.document.LinkTarget") == ServiceName;
+}
+/* -----------------03.05.99 12:28-------------------
+ *
+ * --------------------------------------------------*/
+Sequence< OUString > SwXOutlineTarget::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence < OUString > aRet(1);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.document.LinkTarget");
+
+ return aRet;
+}
+/* -----------------------------17.01.01 16:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXDocumentPropertyHelper::SwXDocumentPropertyHelper(SwDoc& rDoc) :
+SvxUnoForbiddenCharsTable ( rDoc.getForbiddenCharacterTable() )
+,m_pDoc(&rDoc)
+{
+}
+/* -----------------------------17.01.01 16:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwXDocumentPropertyHelper::~SwXDocumentPropertyHelper()
+{
+}
+/* -----------------------------17.01.01 16:06--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Reference<XInterface> SwXDocumentPropertyHelper::GetDrawTable(short nWhich)
+{
+ Reference<XInterface> xRet;
+ if(m_pDoc)
+ {
+ switch(nWhich)
+ {
+ // --> OD 2005-08-08 #i52858#
+ // assure that Draw model is created, if it doesn't exist.
+ case SW_CREATE_DASH_TABLE :
+ if(!xDashTable.is())
+ xDashTable = SvxUnoDashTable_createInstance( m_pDoc->GetOrCreateDrawModel() );
+ xRet = xDashTable;
+ break;
+ case SW_CREATE_GRADIENT_TABLE :
+ if(!xGradientTable.is())
+ xGradientTable = SvxUnoGradientTable_createInstance( m_pDoc->GetOrCreateDrawModel() );
+ xRet = xGradientTable;
+ break;
+ case SW_CREATE_HATCH_TABLE :
+ if(!xHatchTable.is())
+ xHatchTable = SvxUnoHatchTable_createInstance( m_pDoc->GetOrCreateDrawModel() );
+ xRet = xHatchTable;
+ break;
+ case SW_CREATE_BITMAP_TABLE :
+ if(!xBitmapTable.is())
+ xBitmapTable = SvxUnoBitmapTable_createInstance( m_pDoc->GetOrCreateDrawModel() );
+ xRet = xBitmapTable;
+ break;
+ case SW_CREATE_TRANSGRADIENT_TABLE:
+ if(!xTransGradientTable.is())
+ xTransGradientTable = SvxUnoTransGradientTable_createInstance( m_pDoc->GetOrCreateDrawModel() );
+ xRet = xTransGradientTable;
+ break;
+ case SW_CREATE_MARKER_TABLE :
+ if(!xMarkerTable.is())
+ xMarkerTable = SvxUnoMarkerTable_createInstance( m_pDoc->GetOrCreateDrawModel() );
+ xRet = xMarkerTable;
+ break;
+ // <--
+ case SW_CREATE_DRAW_DEFAULTS:
+ if(!xDrawDefaults.is())
+ xDrawDefaults = (cppu::OWeakObject*)new SwSvxUnoDrawPool(m_pDoc);
+ xRet = xDrawDefaults;
+ break;
+#ifdef DBG_UTIL
+ default: DBG_ERROR("which table?");
+#endif
+ }
+ }
+ return xRet;
+}
+
+void SwXDocumentPropertyHelper::Invalidate()
+{
+ xDashTable = 0;
+ xGradientTable = 0;
+ xHatchTable = 0;
+ xBitmapTable = 0;
+ xTransGradientTable = 0;
+ xMarkerTable = 0;
+ xDrawDefaults = 0;
+ m_pDoc = 0;
+ SvxUnoForbiddenCharsTable::mxForbiddenChars.unbind();
+}
+/* -----------------13.08.2003 12:43-----------------
+
+ --------------------------------------------------*/
+void SwXDocumentPropertyHelper::onChange()
+{
+ if(m_pDoc)
+ m_pDoc->SetModified();
+}
+
+
+/*****************************************************************************/
+
+SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( SwWrtShell& rSh, const SwViewOption &rViewOptions ) :
+ m_rShell( rSh ),
+ m_aOldViewOptions( rViewOptions )
+{
+}
+
+
+SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl()
+{
+ m_rShell.ApplyViewOptions( m_aOldViewOptions );
+}
+
+
+void
+SwViewOptionAdjust_Impl::AdjustViewOptions(SwPrintData const*const pPrtOptions)
+{
+ // to avoid unnecessary reformatting the view options related to the content
+ // below should only change if necessary, that is if respective content is present
+ const bool bContainsHiddenChars = m_rShell.GetDoc()->ContainsHiddenChars();
+ const SwFieldType* pFldType = m_rShell.GetDoc()->GetSysFldType( RES_HIDDENTXTFLD );
+ const bool bContainsHiddenFields = pFldType && pFldType->GetDepends();
+ pFldType = m_rShell.GetDoc()->GetSysFldType( RES_HIDDENPARAFLD );
+ const bool bContainsHiddenParagraphs = pFldType && pFldType->GetDepends();
+ pFldType = m_rShell.GetDoc()->GetSysFldType( RES_JUMPEDITFLD );
+ const bool bContainsPlaceHolders = pFldType && pFldType->GetDepends();
+ const bool bContainsFields = m_rShell.IsAnyFieldInDoc();
+
+ SwViewOption aRenderViewOptions( m_aOldViewOptions );
+
+ // disable anything in the view that should not be printed (or exported to PDF) by default
+ // (see also dialog "Tools/Options - StarOffice Writer - Formatting Aids"
+ // in section "Display of ...")
+ aRenderViewOptions.SetParagraph( FALSE ); // paragraph end
+ aRenderViewOptions.SetSoftHyph( FALSE ); // aka custom hyphens
+ aRenderViewOptions.SetBlank( FALSE ); // spaces
+ aRenderViewOptions.SetHardBlank( FALSE ); // non-breaking spaces
+ aRenderViewOptions.SetTab( FALSE ); // tabs
+ aRenderViewOptions.SetLineBreak( FALSE ); // breaks (type 1)
+ aRenderViewOptions.SetPageBreak( FALSE ); // breaks (type 2)
+ aRenderViewOptions.SetColumnBreak( FALSE ); // breaks (type 3)
+ BOOL bVal = pPrtOptions? pPrtOptions->bPrintHiddenText : FALSE;
+ if (bContainsHiddenChars)
+ aRenderViewOptions.SetShowHiddenChar( bVal ); // hidden text
+ if (bContainsHiddenFields)
+ aRenderViewOptions.SetShowHiddenField( bVal );
+ if (bContainsHiddenParagraphs)
+ aRenderViewOptions.SetShowHiddenPara( bVal );
+
+ if (bContainsPlaceHolders)
+ {
+ // should always be printed in PDF export!
+ bVal = pPrtOptions ? pPrtOptions->bPrintTextPlaceholder : TRUE;
+ aRenderViewOptions.SetShowPlaceHolderFields( bVal );
+ }
+
+ if (bContainsFields)
+ aRenderViewOptions.SetFldName( FALSE );
+
+ // we need to set this flag in order to get to see the visible effect of
+ // some of the above settings (needed for correct rendering)
+ aRenderViewOptions.SetViewMetaChars( TRUE );
+
+ if (m_aOldViewOptions != aRenderViewOptions) // check if reformatting is necessary
+ {
+ aRenderViewOptions.SetPrinting( pPrtOptions != NULL );
+ m_rShell.ApplyViewOptions( aRenderViewOptions );
+ }
+}
+
+
+/*****************************************************************************/
+
+
diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx
new file mode 100644
index 000000000000..5f533bde3f22
--- /dev/null
+++ b/sw/source/ui/uno/unotxvw.cxx
@@ -0,0 +1,2209 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include "viscrs.hxx"
+#include <sfx2/frame.hxx>
+#include <sfx2/printer.hxx>
+#include <cmdid.h>
+#include <hintids.hxx>
+#include <docsh.hxx>
+#include <rubylist.hxx>
+#include <doc.hxx>
+#include <unotxvw.hxx>
+#include <unodispatch.hxx>
+#include <unomap.hxx>
+#include <unostyle.hxx>
+#include <unoprnms.hxx>
+#include <view.hxx>
+#include <viewopt.hxx>
+#include <unomod.hxx>
+#include <unoframe.hxx>
+#include <unocrsr.hxx>
+#include <wrtsh.hxx>
+#include <unotbl.hxx>
+#include <svx/fmshell.hxx>
+#include <svx/svdview.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdouno.hxx>
+#include <svx/svdogrp.hxx>
+#include <editeng/pbinitem.hxx>
+#include <pagedesc.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include <frmatr.hxx>
+#include <vos/mutex.hxx>
+#include <IMark.hxx>
+#include <unotxdoc.hxx>
+#include <unodraw.hxx>
+#include <svx/unoshcol.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/svdpagv.hxx>
+#include <swerror.h>
+#include <tools/cachestr.hxx>
+#include <shellio.hxx>
+#include <ndtxt.hxx>
+#include <SwStyleNameMapper.hxx>
+#include <crsskip.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <editeng/outliner.hxx>
+#include <editeng/editview.hxx>
+#include <unobookmark.hxx>
+#include <unoparagraph.hxx>
+#include <unocrsrhelper.hxx>
+#include <unotextrange.hxx>
+#include <sfx2/docfile.hxx>
+
+#include "swdtflvr.hxx"
+#include <vcl/svapp.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::view;
+using namespace ::com::sun::star::frame;
+using namespace rtl;
+
+using ::com::sun::star::util::URL;
+using comphelper::HelperBaseNoState;
+
+SV_IMPL_PTRARR( SelectionChangeListenerArr, XSelectionChangeListenerPtr );
+
+/* -----------------22.05.98 12:20-------------------
+ *
+ * --------------------------------------------------*/
+SwPaM* lcl_createPamCopy(const SwPaM& rPam)
+{
+ SwPaM *const pRet = new SwPaM(*rPam.GetPoint());
+ ::sw::DeepCopyPaM(rPam, *pRet);
+ return pRet;
+}
+/******************************************************************
+ * SwXTextView
+ ******************************************************************/
+/*-- 17.12.98 09:34:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextView::SwXTextView(SwView* pSwView) :
+ SfxBaseController(pSwView),
+ m_pView(pSwView),
+ m_pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_VIEW ) ),
+ pxViewSettings(0),
+ pxTextViewCursor(0)
+{
+
+}
+/*-- 17.12.98 09:34:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextView::~SwXTextView()
+{
+ Invalidate();
+}
+/* -----------------------------09.03.01 15:47--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextView::Invalidate()
+{
+ if(pxViewSettings)
+ {
+ HelperBaseNoState *pSettings = static_cast < HelperBaseNoState * > ( pxViewSettings->get() );
+ static_cast < SwXViewSettings* > ( pSettings )->Invalidate();
+ DELETEZ(pxViewSettings);
+ }
+ if(pxTextViewCursor)
+ {
+ text::XTextViewCursor* pCrsr = pxTextViewCursor->get();
+ ((SwXTextViewCursor*)pCrsr)->Invalidate();
+ DELETEZ(pxTextViewCursor);
+ }
+
+ m_refCount++; //prevent second d'tor call
+
+ sal_uInt16 nCount = aSelChangedListeners.Count();
+ if(nCount)
+ {
+ uno::Reference< uno::XInterface > xInt = (cppu::OWeakObject*)(SfxBaseController*)this;
+ lang::EventObject aEvent(xInt);
+ for ( sal_uInt16 i = nCount; i--; )
+ {
+ uno::Reference< view::XSelectionChangeListener > *pObj = aSelChangedListeners[i];
+ (*pObj)->disposing(aEvent);
+ }
+ }
+
+ // #i85580: now clean up any possibly remaining entries in the array...
+ // (i.e. listeners that did not call removeSelectionChangeListener in their disposing.)
+ while ((nCount = aSelChangedListeners.Count()) != 0)
+ {
+ removeSelectionChangeListener( *aSelChangedListeners[0] );
+ }
+
+ m_refCount--;
+ m_pView = 0;
+}
+
+/* -----------------------------18.05.00 10:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< uno::Type > SAL_CALL SwXTextView::getTypes( ) throw(uno::RuntimeException)
+{
+// uno::Sequence< uno::Type > aViewTypes = SwXTextViewBaseClass::getTypes();
+ uno::Sequence< uno::Type > aBaseTypes = SfxBaseController::getTypes();
+
+ long nIndex = aBaseTypes.getLength();
+ aBaseTypes.realloc(
+ aBaseTypes.getLength() + 8 );
+
+ uno::Type* pBaseTypes = aBaseTypes.getArray();
+ pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XSelectionSupplier >*)0);
+ pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XServiceInfo >*)0);
+ pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XFormLayerAccess >*)0);
+ pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XTextViewCursorSupplier>*)0);
+ pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XViewSettingsSupplier >*)0);
+ pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XRubySelection >*)0);
+ pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<XPropertySet >*)0);
+ pBaseTypes[nIndex++] = ::getCppuType((uno::Reference<datatransfer::XTransferableSupplier >*)0);
+ return aBaseTypes;
+}
+/* -----------------------------18.05.00 10:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< sal_Int8 > SAL_CALL SwXTextView::getImplementationId( ) throw(uno::RuntimeException)
+{
+ vos::OGuard aGuard(Application::GetSolarMutex());
+ static Sequence< sal_Int8 > aId( 16 );
+ static sal_Bool bInit = sal_False;
+ if(!bInit)
+ {
+ rtl_createUuid( (sal_uInt8 *)(aId.getArray() ), 0, sal_True );
+ bInit = sal_True;
+ }
+ return aId;
+}
+/* -----------------------------18.05.00 10:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextView::acquire( )throw()
+{
+ SfxBaseController::acquire();
+}
+/* -----------------------------18.05.00 10:18--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextView::release( )throw()
+{
+ SfxBaseController::release();
+}
+/* -----------------------------18.05.00 10:23--------------------------------
+
+ ---------------------------------------------------------------------------*/
+uno::Any SAL_CALL SwXTextView::queryInterface( const uno::Type& aType )
+ throw (RuntimeException)
+{
+ uno::Any aRet;
+ if(aType == ::getCppuType((uno::Reference<view::XSelectionSupplier >*)0))
+ {
+ uno::Reference<view::XSelectionSupplier> xRet = this;
+ aRet.setValue(&xRet, aType);
+ }
+ else if(aType == ::getCppuType((uno::Reference<lang::XServiceInfo >*)0))
+ {
+ uno::Reference<lang::XServiceInfo> xRet = this;
+ aRet.setValue(&xRet, aType);
+ }
+ else if(aType == ::getCppuType((uno::Reference<view::XControlAccess >*)0))
+ {
+ uno::Reference<view::XControlAccess> xRet = this;
+ aRet.setValue(&xRet, aType);
+ }
+ else if(aType == ::getCppuType((uno::Reference<view::XFormLayerAccess >*)0))
+ {
+ uno::Reference<view::XFormLayerAccess> xRet = this;
+ aRet.setValue(&xRet, aType);
+ }
+ else if(aType == ::getCppuType((uno::Reference<text::XTextViewCursorSupplier>*)0))
+ {
+ uno::Reference<text::XTextViewCursorSupplier> xRet = this;
+ aRet.setValue(&xRet, aType);
+ }
+ else if(aType == ::getCppuType((uno::Reference<view::XViewSettingsSupplier >*)0))
+ {
+ uno::Reference<view::XViewSettingsSupplier> xRet = this;
+ aRet.setValue(&xRet, aType);
+ }
+ else if(aType == ::getCppuType((uno::Reference<XRubySelection>*)0))
+ {
+ uno::Reference<XRubySelection> xRet = this;
+ aRet.setValue(&xRet, aType);
+ }
+ else if(aType == ::getCppuType((uno::Reference<XPropertySet>*)0))
+ {
+ uno::Reference<XPropertySet> xRet = this;
+ aRet.setValue(&xRet, aType);
+ }
+ else if(aType == ::getCppuType((uno::Reference<datatransfer::XTransferableSupplier >*)0))
+ {
+ uno::Reference<datatransfer::XTransferableSupplier> xRet = this;
+ aRet.setValue(&xRet, aType);
+ }
+ else
+ aRet = SfxBaseController::queryInterface(aType);
+ return aRet;
+}
+/*-- 17.12.98 09:34:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextView::select(const uno::Any& aInterface) throw( lang::IllegalArgumentException, uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< uno::XInterface > xInterface;
+ if(GetView() && (aInterface >>= xInterface))
+ {
+ SwWrtShell& rSh = GetView()->GetWrtShell();
+ SwDoc* pDoc = GetView()->GetDocShell()->GetDoc();
+ uno::Reference< lang::XUnoTunnel > xIfcTunnel(xInterface, uno::UNO_QUERY);
+ uno::Reference< text::XTextCursor > xCrsr(xInterface, uno::UNO_QUERY);
+ uno::Reference< container::XIndexAccess > xPosN(xInterface, uno::UNO_QUERY);
+ uno::Reference< text::XTextRange > xPos(xInterface, uno::UNO_QUERY);
+ SwXFrame* pFrame = xIfcTunnel.is() ? reinterpret_cast<SwXFrame*>(
+ xIfcTunnel->getSomething(SwXFrame::getUnoTunnelId())) : 0;
+
+ SwXCell* pCell = xIfcTunnel.is() ? reinterpret_cast<SwXCell*>(
+ xIfcTunnel->getSomething(SwXCell::getUnoTunnelId())) : 0;
+
+ SwPaM * pPam = 0;
+ SwXTextRanges* pPosN = 0;
+ if(xCrsr.is())
+ {
+ //
+ OTextCursorHelper* pCursor =
+ xIfcTunnel.is() ?
+ reinterpret_cast<OTextCursorHelper*>(xIfcTunnel->getSomething(OTextCursorHelper::getUnoTunnelId()))
+ : 0;
+
+ if(pCursor && pCursor->GetDoc() == GetView()->GetDocShell()->GetDoc())
+ {
+ pPam = lcl_createPamCopy(*pCursor->GetPaM());
+ }
+ }
+ else if(xPosN.is() &&
+ xIfcTunnel.is() &&
+ 0 != (pPosN = reinterpret_cast<SwXTextRanges*>(xIfcTunnel->getSomething(SwXTextRanges::getUnoTunnelId()))))
+ {
+ const SwUnoCrsr* pUnoCrsr = pPosN->GetCursor();
+ if(pUnoCrsr)
+ {
+ pPam = lcl_createPamCopy(*pUnoCrsr);
+ }
+ }
+ // prevent misinterpretation of text frames that provide a XTextRange interface, too
+ else if(!pFrame && !pCell && xPos.is())
+ {
+ SwUnoInternalPaM aPam(*pDoc);
+ if (::sw::XTextRangeToSwPaM(aPam, xPos))
+ {
+ pPam = lcl_createPamCopy(aPam);
+ }
+ }
+ if(pPam)
+ {
+ rSh.EnterStdMode();
+ rSh.SetSelection(*pPam);
+ while( pPam->GetNext() != pPam )
+ delete pPam->GetNext();
+ delete pPam;
+ return sal_True;
+ }
+ if(pFrame)
+ {
+
+ SwFrmFmt* pFrmFmt = pFrame->GetFrmFmt();
+ if(pFrmFmt && pFrmFmt->GetDoc() == pDoc)
+ {
+ sal_Bool bSuccess = rSh.GotoFly( pFrmFmt->GetName(), pFrame->GetFlyCntType());
+ if (bSuccess)
+ {
+ rSh.HideCrsr();
+ rSh.EnterSelFrmMode();
+ }
+ return sal_True;
+ }
+ }
+
+ uno::Reference< text::XTextTable > xTbl(xInterface, uno::UNO_QUERY);;
+
+ if(xTbl.is() && xIfcTunnel.is())
+ {
+ SwXTextTable* pTable = reinterpret_cast<SwXTextTable*>(
+ xIfcTunnel->getSomething(SwXTextTable::getUnoTunnelId()));
+
+ SwFrmFmt* pTblFrmFmt = pTable ? ((SwXTextTable*)pTable)->GetFrmFmt() : 0;
+ if(pTblFrmFmt &&pTblFrmFmt->GetDoc() == pDoc)
+ {
+ rSh.EnterStdMode();
+ rSh.GotoTable(pTblFrmFmt->GetName());
+ }
+ return sal_True;
+ }
+
+ if(pCell)
+ {
+ SwFrmFmt* pTblFrmFmt = pCell->GetFrmFmt();
+ if(pTblFrmFmt && pTblFrmFmt->GetDoc() == pDoc)
+ {
+ SwTableBox* pBox = pCell->GetTblBox();
+ SwTable* pTable = SwTable::FindTable( pTblFrmFmt );
+ pBox = pCell->FindBox(pTable, pBox);
+ if(pBox)
+ {
+ const SwStartNode* pSttNd = pBox->GetSttNd();
+ SwPosition aPos(*pSttNd);
+ SwPaM aPam(aPos);
+ aPam.Move(fnMoveForward, fnGoNode);
+ rSh.EnterStdMode();
+ rSh.SetSelection(aPam);
+ return sal_True;
+ }
+ }
+ }
+ SwXCellRange* pRange = xIfcTunnel.is() ? reinterpret_cast<SwXCellRange*>(
+ xIfcTunnel->getSomething(SwXCellRange::getUnoTunnelId())) : 0;
+ if(pRange)
+ {
+ const SwUnoCrsr* pUnoCrsr = pRange->GetTblCrsr();
+ if(pUnoCrsr)
+ {
+ UnoActionRemoveContext aContext(pDoc);
+ rSh.EnterStdMode();
+ rSh.SetSelection(*pUnoCrsr);
+ return sal_True;
+ }
+ }
+ uno::Reference< text::XTextContent > xBkm(xInterface, uno::UNO_QUERY);;
+
+ if(xBkm.is() && xIfcTunnel.is())
+ {
+ ::sw::mark::IMark const*const pMark(
+ SwXBookmark::GetBookmarkInDoc(pDoc, xIfcTunnel) );
+ if (pMark)
+ {
+ rSh.EnterStdMode();
+ rSh.GotoMark(pMark);
+ }
+ return sal_True;
+ }
+ // IndexMark, Index, TextField, Draw, Section, Footnote, Paragraph
+ //
+
+ // detect controls
+
+ uno::Reference< awt::XControlModel > xCtrlModel(xInterface, UNO_QUERY);
+ if(xCtrlModel.is())
+ {
+ uno::Reference<awt::XControl> XControl;
+ SdrObject* pObj = GetControl(xCtrlModel, XControl);
+ if(pObj)
+ {
+ SdrView* pDrawView = rSh.GetDrawView();
+ SdrPageView* pPV = pDrawView->GetSdrPageView();
+ if ( pPV && pObj->GetPage() == pPV->GetPage() )
+ {
+ pDrawView->SdrEndTextEdit();
+ pDrawView->UnmarkAll();
+ pDrawView->MarkObj( pObj, pPV );
+ }
+ return sal_True;
+ }
+ }
+
+ uno::Reference< drawing::XShapes > xShapeColl( xInterface, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xTmpProp(xInterface, uno::UNO_QUERY);
+ SwXShape* pSwXShape = 0;
+ if(xIfcTunnel.is())
+ pSwXShape = reinterpret_cast<SwXShape*>(xIfcTunnel->getSomething(SwXShape::getUnoTunnelId()));
+ SvxShape* pSvxShape = 0;
+ if(pSwXShape)
+ {
+ uno::Reference< uno::XAggregation > xAgg = pSwXShape->GetAggregationInterface();
+ if(xAgg.is())
+ {
+ pSvxShape = reinterpret_cast<SvxShape*>(xIfcTunnel->getSomething(SvxShape::getUnoTunnelId()));
+ }
+ }
+
+ if ( pSvxShape || xShapeColl.is() ) // Drawing drawing::Layer
+ {
+ SdrView* pDrawView = rSh.GetDrawView();
+ if (pDrawView)
+ {
+ pDrawView->SdrEndTextEdit();
+ pDrawView->UnmarkAll();
+
+ if (pSvxShape) // einzelnes Shape
+ {
+ SdrObject *pObj = pSvxShape->GetSdrObject();
+ if (pObj)
+ {
+// lcl_ShowObject( *m_pViewSh, *pDrawView, pObj );
+ SdrPageView* pPV = pDrawView->GetSdrPageView();
+ if ( pPV && pObj->GetPage() == pPV->GetPage() )
+ {
+ pDrawView->MarkObj( pObj, pPV );
+ return sal_True;
+ }
+ }
+ }
+ else // Shape Collection
+ {
+ sal_Bool bSelected = sal_False;
+ SdrPageView* pPV = NULL;
+ long nCount = xShapeColl->getCount();
+ for ( long i = 0; i < nCount; i++ )
+ {
+ uno::Reference< drawing::XShape > xShapeInt;
+ uno::Any aAny = xShapeColl->getByIndex(i);
+ aAny >>= xShapeInt;
+ if (xShapeInt.is())
+ {
+ uno::Reference< lang::XUnoTunnel> xShapeTunnel(xShapeInt, uno::UNO_QUERY);
+
+ SvxShape* pShape = xShapeTunnel.is() ?
+ reinterpret_cast<SvxShape*>(xShapeTunnel->getSomething(SvxShape::getUnoTunnelId())) : 0;
+
+ if (pShape)
+ {
+ SdrObject *pObj = pShape->GetSdrObject();
+ if (pObj)
+ {
+ if (!pPV) // erstes Objekt
+ {
+// lcl_ShowObject( *m_pViewSh, *pDrawView, pObj );
+ pPV = pDrawView->GetSdrPageView();
+ }
+ if ( pPV && pObj->GetPage() == pPV->GetPage() )
+ {
+ pDrawView->MarkObj( pObj, pPV );
+ bSelected = sal_True;
+ }
+ }
+ }
+ }
+ }
+ return bSelected;
+ }
+ }
+ }
+ }
+ return sal_False;
+
+}
+/*-- 17.12.98 09:34:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Any SwXTextView::getSelection(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< uno::XInterface > aRef;
+ if(GetView())
+ {
+ //force immediat shell update
+ m_pView->StopShellTimer();
+ // ein interface aus der aktuellen Selektion erzeugen
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ ShellModes eSelMode = m_pView->GetShellMode();
+ switch(eSelMode)
+ {
+ case SHELL_MODE_TABLE_TEXT :
+ {
+ if(rSh.GetTableCrsr())
+ {
+ DBG_ASSERT(rSh.GetTableFmt(), "kein Tabellenformat?");
+ uno::Reference< text::XTextTableCursor > xCrsr = new SwXTextTableCursor(*rSh.GetTableFmt(),
+ rSh.GetTableCrsr());
+ aRef = uno::Reference< uno::XInterface > (xCrsr, uno::UNO_QUERY);;
+ break;
+ }
+
+ }
+ // ohne Tabellenselektion wird der Text geliefert
+ //break;
+ case SHELL_MODE_LIST_TEXT :
+ case SHELL_MODE_TABLE_LIST_TEXT:
+ case SHELL_MODE_TEXT :
+ {
+ uno::Reference< container::XIndexAccess > xPos = new SwXTextRanges(rSh.GetCrsr());
+ aRef = uno::Reference< uno::XInterface >(xPos, uno::UNO_QUERY);
+ }
+ break;
+ case SHELL_MODE_FRAME :
+ case SHELL_MODE_GRAPHIC :
+ case SHELL_MODE_OBJECT :
+ {
+ //Get FlyFrameFormat; fuer UI Macro Anbindung an Flys
+ const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt();
+ if (pFmt)
+ {
+ SwXFrame* pxFrame = (SwXFrame*)SwClientIter((SwFrmFmt&)*pFmt).
+ First(TYPE(SwXFrame));
+
+ if(pxFrame) //das einzige gemeinsame interface fuer alle Frames
+ {
+ aRef = uno::Reference< uno::XInterface >((cppu::OWeakObject*)pxFrame, uno::UNO_QUERY);
+ }
+ else
+ {
+ if(SHELL_MODE_FRAME == eSelMode)
+ {
+ uno::Reference< text::XTextFrame > xFrm = new SwXTextFrame((SwFrmFmt&)*pFmt);
+ aRef = uno::Reference< uno::XInterface >(xFrm, uno::UNO_QUERY);
+ }
+ else if(SHELL_MODE_GRAPHIC == eSelMode)
+ {
+ uno::Reference< text::XTextContent > xFrm = new SwXTextGraphicObject((SwFrmFmt&)*pFmt);
+ aRef = xFrm;
+ }
+ else
+ {
+ uno::Reference< text::XTextContent > xFrm = new SwXTextEmbeddedObject((SwFrmFmt&)*pFmt);
+ aRef = xFrm;
+ }
+ }
+ }
+ }
+ break;
+ case SHELL_MODE_DRAW :
+ case SHELL_MODE_DRAW_CTRL :
+ case SHELL_MODE_DRAW_FORM :
+ case SHELL_MODE_DRAWTEXT :
+ case SHELL_MODE_BEZIER :
+ {
+ uno::Reference< drawing::XDrawPageSupplier > xPageSupp;
+ uno::Reference< frame::XModel > xModel = m_pView->GetDocShell()->GetBaseModel();
+ uno::Reference< lang::XUnoTunnel > xModelTunnel(xModel, uno::UNO_QUERY);
+ SwXTextDocument* pTextDoc = reinterpret_cast<SwXTextDocument*>(xModelTunnel->
+ getSomething(SwXTextDocument::getUnoTunnelId()));
+
+ SwFmDrawPage* pSvxDrawPage = pTextDoc->GetDrawPage()->GetSvxPage();
+ uno::Reference< drawing::XShapes > xShCol = new SvxShapeCollection();
+
+ const SdrMarkList& rMarkList = rSh.GetDrawView()->GetMarkedObjectList();
+ for(sal_uInt16 i = 0; i < rMarkList.GetMarkCount(); i++)
+ {
+ SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ uno::Reference< uno::XInterface > xInt = pSvxDrawPage->GetInterface( pObj );
+ uno::Reference< drawing::XShape > xShape(xInt, uno::UNO_QUERY);;
+ xShCol->add(xShape);
+ }
+ aRef = uno::Reference< uno::XInterface >(xShCol, uno::UNO_QUERY);
+ }
+ break;
+ default:;//prevent warning
+ }
+ }
+ uno::Any aRet(&aRef, ::getCppuType((uno::Reference<uno::XInterface>*)0));
+ return aRet;
+}
+/*-- 17.12.98 09:34:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextView::addSelectionChangeListener(
+ const uno::Reference< view::XSelectionChangeListener > & rxListener)
+ throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< view::XSelectionChangeListener > * pInsert = new uno::Reference< view::XSelectionChangeListener > ;
+ *pInsert = rxListener;
+ aSelChangedListeners.Insert(pInsert, aSelChangedListeners.Count());
+}
+/*-- 17.12.98 09:34:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextView::removeSelectionChangeListener(
+ const uno::Reference< view::XSelectionChangeListener > & rxListener)
+ throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ view::XSelectionChangeListener* pLeft = rxListener.get();
+ for(sal_uInt16 i = 0; i < aSelChangedListeners.Count(); i++)
+ {
+ uno::Reference< view::XSelectionChangeListener > * pElem = aSelChangedListeners.GetObject(i);
+ view::XSelectionChangeListener* pRight = pElem->get();
+ if(pLeft == pRight)
+ {
+ aSelChangedListeners.Remove(i);
+ delete pElem;
+ break;
+ }
+ }
+}
+/* -----------------------------01.06.01 14:41--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SdrObject* SwXTextView::GetControl(
+ const uno::Reference< awt::XControlModel > & xModel,
+ uno::Reference< awt::XControl >& xToFill )
+{
+ SwView* pView2 = GetView();
+ FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : NULL;
+ SdrView* pDrawView = pView2 ? pView2->GetDrawView() : NULL;
+ Window* pWindow = pView2 ? pView2->GetWrtShell().GetWin() : NULL;
+
+ DBG_ASSERT( pFormShell && pDrawView && pWindow, "SwXTextView::GetControl: how could I?" );
+
+ SdrObject* pControl = NULL;
+ if ( pFormShell && pDrawView && pWindow )
+ pControl = pFormShell->GetFormControl( xModel, *pDrawView, *pWindow, xToFill );
+ return pControl;
+}
+/*-- 17.12.98 09:34:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< awt::XControl > SwXTextView::getControl(const uno::Reference< awt::XControlModel > & xModel)
+ throw( container::NoSuchElementException, uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< awt::XControl > xRet;
+ GetControl(xModel, xRet);
+ return xRet;
+}
+
+/*-- 08.03.07 13:55------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< form::runtime::XFormController > SAL_CALL SwXTextView::getFormController( const uno::Reference< form::XForm >& _Form ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ SwView* pView2 = GetView();
+ FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : NULL;
+ SdrView* pDrawView = pView2 ? pView2->GetDrawView() : NULL;
+ Window* pWindow = pView2 ? pView2->GetWrtShell().GetWin() : NULL;
+ DBG_ASSERT( pFormShell && pDrawView && pWindow, "SwXTextView::getFormController: how could I?" );
+
+ uno::Reference< form::runtime::XFormController > xController;
+ if ( pFormShell && pDrawView && pWindow )
+ xController = pFormShell->GetFormController( _Form, *pDrawView, *pWindow );
+ return xController;
+}
+
+/*-- 08.03.07 13:55------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+::sal_Bool SAL_CALL SwXTextView::isFormDesignMode( ) throw (uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SwView* pView2 = GetView();
+ FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : NULL;
+ return pFormShell ? pFormShell->IsDesignMode() : sal_True;
+}
+
+/*-- 08.03.07 13:55------------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SAL_CALL SwXTextView::setFormDesignMode( ::sal_Bool _DesignMode ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SwView* pView2 = GetView();
+ FmFormShell* pFormShell = pView2 ? pView2->GetFormShell() : NULL;
+ if ( pFormShell )
+ pFormShell->SetDesignMode( _DesignMode );
+}
+
+/*-- 17.12.98 09:34:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextViewCursor > SwXTextView::getViewCursor(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(GetView())
+ {
+ if(!pxTextViewCursor)
+ {
+ ((SwXTextView*)this)->pxTextViewCursor = new uno::Reference< text::XTextViewCursor > ;
+ *pxTextViewCursor = new SwXTextViewCursor(GetView());
+ }
+ return *pxTextViewCursor;
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 17.12.98 09:34:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< beans::XPropertySet > SwXTextView::getViewSettings(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(m_pView)
+ {
+ if(!pxViewSettings)
+ {
+ ((SwXTextView*)this)->pxViewSettings = new uno::Reference< beans::XPropertySet > ;
+ *pxViewSettings = static_cast < HelperBaseNoState * > ( new SwXViewSettings( sal_False, m_pView ) );
+ }
+ }
+ else
+ throw uno::RuntimeException();
+ return *pxViewSettings;
+}
+/* -----------------------------30.01.01 15:01--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< Sequence< PropertyValue > > SwXTextView::getRubyList( sal_Bool /*bAutomatic*/ ) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!GetView())
+ throw RuntimeException();
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ ShellModes eSelMode = m_pView->GetShellMode();
+ if (eSelMode != SHELL_MODE_LIST_TEXT &&
+ eSelMode != SHELL_MODE_TABLE_LIST_TEXT &&
+ eSelMode != SHELL_MODE_TABLE_TEXT &&
+ eSelMode != SHELL_MODE_TEXT )
+ return Sequence< Sequence< PropertyValue > > ();
+
+ SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
+ SwRubyList aList;
+
+ USHORT nCount = pDoc->FillRubyList( *rSh.GetCrsr(), aList, 0 );
+ Sequence< Sequence< PropertyValue > > aRet(nCount);
+ Sequence< PropertyValue >* pRet = aRet.getArray();
+ String aString;
+ for(USHORT n = 0; n < nCount; n++)
+ {
+ const SwRubyListEntryPtr pEntry = aList[n];
+
+ const String& rEntryText = pEntry->GetText();
+ const SwFmtRuby& rAttr = pEntry->GetRubyAttr();
+
+ pRet[n].realloc(5);
+ PropertyValue* pValues = pRet[n].getArray();
+ pValues[0].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_BASE_TEXT));
+ pValues[0].Value <<= OUString(rEntryText);
+ pValues[1].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_TEXT));
+ pValues[1].Value <<= OUString(rAttr.GetText());
+ pValues[2].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_CHAR_STYLE_NAME));
+ SwStyleNameMapper::FillProgName(rAttr.GetCharFmtName(), aString, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True );
+ pValues[2].Value <<= OUString( aString );
+ pValues[3].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_ADJUST));
+ pValues[3].Value <<= (sal_Int16)rAttr.GetAdjustment();
+ pValues[4].Name = C2U(SW_PROP_NAME_STR(UNO_NAME_RUBY_IS_ABOVE));
+ sal_Bool bVal = !rAttr.GetPosition();
+ pValues[4].Value.setValue(&bVal, ::getBooleanCppuType());
+ }
+ return aRet;
+}
+/* -----------------------------30.01.01 15:02--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SAL_CALL SwXTextView::setRubyList(
+ const Sequence< Sequence< PropertyValue > >& rRubyList, sal_Bool /*bAutomatic*/ )
+ throw(RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+
+ if(!GetView() || !rRubyList.getLength())
+ throw RuntimeException();
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ ShellModes eSelMode = m_pView->GetShellMode();
+ if (eSelMode != SHELL_MODE_LIST_TEXT &&
+ eSelMode != SHELL_MODE_TABLE_LIST_TEXT &&
+ eSelMode != SHELL_MODE_TABLE_TEXT &&
+ eSelMode != SHELL_MODE_TEXT )
+ throw RuntimeException();
+
+ SwRubyList aList;
+
+ const Sequence<PropertyValue>* pRubyList = rRubyList.getConstArray();
+ for(sal_Int32 nPos = 0; nPos < rRubyList.getLength(); nPos++)
+ {
+ SwRubyListEntryPtr pEntry = new SwRubyListEntry;
+ const PropertyValue* pProperties = pRubyList[nPos].getConstArray();
+ OUString sTmp;
+ for(sal_Int32 nProp = 0; nProp < pRubyList[nPos].getLength(); nProp++)
+ {
+ if(pProperties[nProp].Name.equalsAsciiL(
+ SW_PROP_NAME(UNO_NAME_RUBY_BASE_TEXT)))
+ {
+ pProperties[nProp].Value >>= sTmp;
+ pEntry->SetText(sTmp);
+ }
+ else if(pProperties[nProp].Name.equalsAsciiL(
+ SW_PROP_NAME(UNO_NAME_RUBY_TEXT)))
+ {
+ pProperties[nProp].Value >>= sTmp;
+ pEntry->GetRubyAttr().SetText(sTmp);
+ }
+ else if(pProperties[nProp].Name.equalsAsciiL(
+ SW_PROP_NAME(UNO_NAME_RUBY_CHAR_STYLE_NAME)))
+ {
+ if((pProperties[nProp].Value >>= sTmp))
+ {
+ String sName;
+ SwStyleNameMapper::FillUIName(sTmp, sName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True );
+ sal_uInt16 nPoolId = sName.Len() ?
+ SwStyleNameMapper::GetPoolIdFromUIName( sName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ) : 0;
+
+ pEntry->GetRubyAttr().SetCharFmtName( sName );
+ pEntry->GetRubyAttr().SetCharFmtId( nPoolId );
+ }
+ }
+ else if(pProperties[nProp].Name.equalsAsciiL(
+ SW_PROP_NAME(UNO_NAME_RUBY_ADJUST)))
+ {
+ sal_Int16 nTmp = 0;
+ if((pProperties[nProp].Value >>= nTmp))
+ pEntry->GetRubyAttr().SetAdjustment(nTmp);
+ }
+ else if(pProperties[nProp].Name.equalsAsciiL(
+ SW_PROP_NAME(UNO_NAME_RUBY_IS_ABOVE)))
+ {
+ sal_Bool bValue = pProperties[nProp].Value.hasValue() ?
+ *(sal_Bool*)pProperties[nProp].Value.getValue() : sal_True;
+ pEntry->GetRubyAttr().SetPosition(bValue ? 0 : 1);
+ }
+ }
+ aList.Insert(pEntry, (USHORT)nPos);
+ }
+ SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
+ pDoc->SetRubyList( *rSh.GetCrsr(), aList, 0 );
+}
+/*-- 29.12.02 15:45:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SfxObjectShellLock SwXTextView::BuildTmpSelectionDoc()
+{
+ SwWrtShell& rOldSh = m_pView->GetWrtShell();
+ SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess()->getPrinter( false );
+ SwDocShell* pDocSh;
+ SfxObjectShellLock xDocSh( pDocSh = new SwDocShell( /*pPrtDoc, */SFX_CREATE_MODE_STANDARD ) );
+ xDocSh->DoInitNew( 0 );
+ SwDoc *const pTempDoc( pDocSh->GetDoc() );
+ // #i103634#, #i112425#: do not expand numbering and fields on PDF export
+ pTempDoc->SetClipBoard(true);
+ rOldSh.FillPrtDoc(pTempDoc, pPrt);
+ SfxViewFrame* pDocFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
+ SwView* pDocView = (SwView*) pDocFrame->GetViewShell();
+ pDocView->AttrChangedNotify( &pDocView->GetWrtShell() );//Damit SelectShell gerufen wird.
+ SwWrtShell* pSh = pDocView->GetWrtShellPtr();
+
+ IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess();
+ SfxPrinter* pTempPrinter = pIDDA->getPrinter( true );
+
+ const SwPageDesc& rCurPageDesc = rOldSh.GetPageDesc(rOldSh.GetCurPageDesc());
+
+ IDocumentDeviceAccess* pIDDA_old = rOldSh.getIDocumentDeviceAccess();
+
+ if( pIDDA_old->getPrinter( false ) )
+ {
+ pIDDA->setJobsetup( *pIDDA_old->getJobsetup() );
+ //#69563# if it isn't the same printer then the pointer has been invalidated!
+ pTempPrinter = pIDDA->getPrinter( true );
+ }
+
+ pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue());
+
+ return xDocSh;
+}
+
+/*-- 17.12.98 09:34:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextView::NotifySelChanged()
+{
+ DBG_ASSERT( m_pView, "view is missing" );
+
+ // destroy temporary document with selected text that is used
+ // in PDF export of (multi-)selections.
+ if (m_pView && m_pView->GetTmpSelectionDoc().Is())
+ {
+ m_pView->GetTmpSelectionDoc()->DoClose();
+ m_pView->GetTmpSelectionDoc() = 0;
+ }
+
+ uno::Reference< uno::XInterface > xInt = (cppu::OWeakObject*)(SfxBaseController*)this;
+
+ lang::EventObject aEvent(xInt);
+
+ sal_uInt16 nCount = aSelChangedListeners.Count();
+ for ( sal_uInt16 i = nCount; i--; )
+ {
+ uno::Reference< view::XSelectionChangeListener > *pObj = aSelChangedListeners[i];
+ (*pObj)->selectionChanged(aEvent);
+ }
+}
+/* -----------------------------12.07.01 13:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwXTextView::NotifyDBChanged()
+{
+ URL aURL;
+ aURL.Complete = C2U(SwXDispatch::GetDBChangeURL());
+
+ sal_uInt16 nCount = aSelChangedListeners.Count();
+ for ( sal_uInt16 i = nCount; i--; )
+ {
+ uno::Reference< view::XSelectionChangeListener > *pObj = aSelChangedListeners[i];
+ uno::Reference<XDispatch> xDispatch((*pObj), UNO_QUERY);
+ if(xDispatch.is())
+ xDispatch->dispatch(aURL, Sequence<PropertyValue>(0));
+ }
+}
+
+/* -----------------------------10.12.04 11:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXTextView::getPropertySetInfo( )
+ throw (uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ static uno::Reference< XPropertySetInfo > aRef = m_pPropSet->getPropertySetInfo();
+ return aRef;
+}
+
+
+void SAL_CALL SwXTextView::setPropertyValue(
+ const OUString& rPropertyName, const uno::Any& rValue )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if (!pEntry)
+ throw UnknownPropertyException();
+ else if (pEntry->nFlags & PropertyAttribute::READONLY)
+ throw PropertyVetoException();
+ else
+ {
+ switch (pEntry->nWID)
+ {
+ case WID_IS_HIDE_SPELL_MARKS :
+ // deprecated #i91949
+ break;
+ case WID_IS_CONSTANT_SPELLCHECK :
+ {
+ sal_Bool bVal = sal_False;
+ const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions();
+ if (!pOpt || !(rValue >>= bVal))
+ throw RuntimeException();
+ SwViewOption aNewOpt( *pOpt );
+ if (pEntry->nWID == WID_IS_CONSTANT_SPELLCHECK)
+ aNewOpt.SetOnlineSpell(bVal);
+ m_pView->GetWrtShell().ApplyViewOptions( aNewOpt );
+ }
+ break;
+ default :
+ DBG_ERROR("unknown WID");
+ }
+ }
+}
+
+
+uno::Any SAL_CALL SwXTextView::getPropertyValue(
+ const OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aGuard( Application::GetSolarMutex() );
+
+ Any aRet;
+
+ const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap()->getByName( rPropertyName );
+ if (!pEntry)
+ throw UnknownPropertyException();
+ else
+ {
+ sal_Int16 nWID = pEntry->nWID;
+ switch (nWID)
+ {
+ case WID_PAGE_COUNT :
+ case WID_LINE_COUNT :
+ {
+ // format document completely in order to get meaningful
+ // values for page count and line count
+ m_pView->GetWrtShell().CalcLayout();
+
+ sal_Int32 nCount = -1;
+ if (nWID == WID_PAGE_COUNT)
+ nCount = m_pView->GetDocShell()->GetDoc()->GetPageCount();
+ else // WID_LINE_COUNT
+ nCount = m_pView->GetWrtShell().GetLineCount( FALSE /*of whole document*/ );
+ aRet <<= nCount;
+ }
+ break;
+ case WID_IS_HIDE_SPELL_MARKS :
+ // deprecated #i91949
+ break;
+ case WID_IS_CONSTANT_SPELLCHECK :
+ {
+ const SwViewOption *pOpt = m_pView->GetWrtShell().GetViewOptions();
+ if (!pOpt)
+ throw RuntimeException();
+ UINT32 nFlag = VIEWOPT_1_ONLINESPELL;
+ sal_Bool bVal = 0 != (pOpt->GetCoreOptions() & nFlag);
+ aRet <<= bVal;
+ }
+ break;
+ default :
+ DBG_ERROR("unknown WID");
+ }
+ }
+
+ return aRet;
+}
+
+
+void SAL_CALL SwXTextView::addPropertyChangeListener(
+ const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*rxListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ DBG_WARNING("not implemented");
+}
+
+
+void SAL_CALL SwXTextView::removePropertyChangeListener(
+ const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XPropertyChangeListener >& /*rxListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ DBG_WARNING("not implemented");
+}
+
+
+void SAL_CALL SwXTextView::addVetoableChangeListener(
+ const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*rxListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ DBG_WARNING("not implemented");
+}
+
+
+void SAL_CALL SwXTextView::removeVetoableChangeListener(
+ const OUString& /*rPropertyName*/,
+ const uno::Reference< beans::XVetoableChangeListener >& /*rxListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ DBG_WARNING("not implemented");
+}
+
+/* -----------------------------06.04.00 11:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextView::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextView");
+}
+/* -----------------------------06.04.00 11:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextView::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return rServiceName.equalsAscii("com.sun.star.text.TextDocumentView") ||
+ rServiceName.equalsAscii("com.sun.star.view.OfficeDocumentView");
+}
+/* -----------------------------06.04.00 11:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXTextView::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(2);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextDocumentView");
+ pArray[1] = C2U("com.sun.star.view.OfficeDocumentView");
+ return aRet;
+}
+
+/******************************************************************
+ * SwXTextViewCursor
+ ******************************************************************/
+/*-- 17.12.98 09:36:23---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextViewCursor::SwXTextViewCursor(SwView* pVw) :
+ m_pView(pVw),
+ m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR))
+{
+}
+/*-- 17.12.98 09:36:24---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwXTextViewCursor::~SwXTextViewCursor()
+{
+}
+/*-- 06.10.04 09:36:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+
+// used to determine if there is a text selction or not.
+// If there is no text selection the functions that need a working
+// cursor will be disabled (throw RuntimeException). This will be the case
+// for the following interfaces:
+// - XViewCursor
+// - XTextCursor
+// - XTextRange
+// - XLineCursor
+
+sal_Bool SwXTextViewCursor::IsTextSelection( sal_Bool bAllowTables ) const
+{
+
+ sal_Bool bRes = sal_False;
+ DBG_ASSERT(m_pView, "m_pView is NULL ???");
+ if(m_pView)
+ {
+ //! m_pView->GetShellMode() will only work after the shell
+ //! has already changed and thus can not be used here!
+ SelectionType eSelType = m_pView->GetWrtShell().GetSelectionType();
+ bRes = ( (nsSelectionType::SEL_TXT & eSelType) ||
+ (nsSelectionType::SEL_NUM & eSelType) ) &&
+ (!(nsSelectionType::SEL_TBL_CELLS & eSelType) || bAllowTables);
+ }
+ return bRes;
+}
+
+/*-- 17.12.98 09:36:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::isVisible(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ DBG_WARNING("not implemented");
+ return sal_True;
+}
+/*-- 17.12.98 09:36:25---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextViewCursor::setVisible(sal_Bool /*bVisible*/) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ DBG_WARNING("not implemented");
+}
+/*-- 17.12.98 09:36:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+awt::Point SwXTextViewCursor::getPosition(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ awt::Point aRet;
+ if(m_pView)
+ {
+ const SwWrtShell& rSh = m_pView->GetWrtShell();
+ const SwRect aCharRect(rSh.GetCharRect());
+
+ const SwFrmFmt& rMaster = rSh.GetPageDesc( rSh.GetCurPageDesc() ).GetMaster();
+
+ const SvxULSpaceItem& rUL = rMaster.GetULSpace();
+ const long nY = aCharRect.Top() - (rUL.GetUpper() + DOCUMENTBORDER);
+ aRet.Y = TWIP_TO_MM100(nY);
+
+ const SvxLRSpaceItem& rLR = rMaster.GetLRSpace();
+ const long nX = aCharRect.Left() - (rLR.GetLeft() + DOCUMENTBORDER);
+ aRet.X = TWIP_TO_MM100(nX);
+ }
+ else
+ throw uno::RuntimeException();
+ return aRet;
+}
+/*-- 17.12.98 09:36:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextViewCursor::collapseToStart(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(m_pView)
+ {
+ if (!IsTextSelection())
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ if(rSh.HasSelection())
+ {
+ SwPaM* pShellCrsr = rSh.GetCrsr();
+ if(*pShellCrsr->GetPoint() > *pShellCrsr->GetMark())
+ pShellCrsr->Exchange();
+ pShellCrsr->DeleteMark();
+ rSh.EnterStdMode();
+ rSh.SetSelection(*pShellCrsr);
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 17.12.98 09:36:26---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextViewCursor::collapseToEnd(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(m_pView)
+ {
+ if (!IsTextSelection())
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ if(rSh.HasSelection())
+ {
+ SwPaM* pShellCrsr = rSh.GetCrsr();
+ if(*pShellCrsr->GetPoint() < *pShellCrsr->GetMark())
+ pShellCrsr->Exchange();
+ pShellCrsr->DeleteMark();
+ rSh.EnterStdMode();
+ rSh.SetSelection(*pShellCrsr);
+ }
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 17.12.98 09:36:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::isCollapsed(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ {
+ if (!IsTextSelection())
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ const SwWrtShell& rSh = m_pView->GetWrtShell();
+ bRet = !rSh.HasSelection();
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+
+}
+/*-- 17.12.98 09:36:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::goLeft(sal_Int16 nCount, sal_Bool bExpand) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ {
+ if (!IsTextSelection())
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ bRet = m_pView->GetWrtShell().Left( CRSR_SKIP_CHARS, bExpand, 1, sal_True );
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 17.12.98 09:36:27---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::goRight(sal_Int16 nCount, sal_Bool bExpand) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ {
+ if (!IsTextSelection())
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ bRet = m_pView->GetWrtShell().Right( CRSR_SKIP_CHARS, bExpand, 1, sal_True );
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+
+}
+/* -----------------08.03.99 11:18-------------------
+ *
+ * --------------------------------------------------*/
+void SwXTextViewCursor::gotoRange(
+ const uno::Reference< text::XTextRange > & xRange,
+ sal_Bool bExpand)
+ throw(RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(m_pView && xRange.is())
+ {
+ if (!IsTextSelection())
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ SwUnoInternalPaM rDestPam(*m_pView->GetDocShell()->GetDoc());
+ if (!::sw::XTextRangeToSwPaM(rDestPam, xRange))
+ {
+ throw uno::RuntimeException();
+ }
+
+ ShellModes eSelMode = m_pView->GetShellMode();
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ // call EnterStdMode in non-text selections only
+ if(!bExpand ||
+ (eSelMode != SHELL_MODE_TABLE_TEXT &&
+ eSelMode != SHELL_MODE_LIST_TEXT &&
+ eSelMode != SHELL_MODE_TABLE_LIST_TEXT &&
+ eSelMode != SHELL_MODE_TEXT ))
+ rSh.EnterStdMode();
+ SwPaM* pShellCrsr = rSh.GetCrsr();
+ SwPaM aOwnPaM(*pShellCrsr->GetPoint());
+ if(pShellCrsr->HasMark())
+ {
+ aOwnPaM.SetMark();
+ *aOwnPaM.GetMark() = *pShellCrsr->GetMark();
+ }
+
+ uno::Reference<lang::XUnoTunnel> xRangeTunnel( xRange, uno::UNO_QUERY);
+ SwXTextRange* pRange = 0;
+ SwXParagraph* pPara = 0;
+ OTextCursorHelper* pCursor = 0;
+ if(xRangeTunnel.is())
+ {
+ pRange = reinterpret_cast<SwXTextRange*>(xRangeTunnel->getSomething(
+ SwXTextRange::getUnoTunnelId()));
+ pCursor = reinterpret_cast<OTextCursorHelper*>(xRangeTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId()));
+ pPara = reinterpret_cast<SwXParagraph*>(xRangeTunnel->getSomething(
+ SwXParagraph::getUnoTunnelId()));
+ }
+
+ const sal_uInt16 nFrmType = rSh.GetFrmType(0,sal_True);
+
+ SwStartNodeType eSearchNodeType = SwNormalStartNode;
+ if(nFrmType & FRMTYPE_FLY_ANY)
+ eSearchNodeType = SwFlyStartNode;
+ else if(nFrmType &FRMTYPE_HEADER)
+ eSearchNodeType = SwHeaderStartNode;
+ else if(nFrmType & FRMTYPE_FOOTER)
+ eSearchNodeType = SwFooterStartNode;
+ else if(nFrmType & FRMTYPE_TABLE)
+ eSearchNodeType = SwTableBoxStartNode;
+ else if(nFrmType & FRMTYPE_FOOTNOTE)
+ eSearchNodeType = SwFootnoteStartNode;
+
+ const SwStartNode* pOwnStartNode = aOwnPaM.GetNode()->
+ FindSttNodeByType(eSearchNodeType);
+
+ const SwNode* pSrcNode = 0;
+ if(pCursor && pCursor->GetPaM())
+ {
+ pSrcNode = pCursor->GetPaM()->GetNode();
+ }
+ else if (pRange)
+ {
+ SwPaM aPam(pRange->GetDoc()->GetNodes());
+ if (pRange->GetPositions(aPam))
+ {
+ pSrcNode = aPam.GetNode();
+ }
+ }
+ else if (pPara && pPara->GetTxtNode())
+ {
+ pSrcNode = pPara->GetTxtNode();
+ }
+ const SwStartNode* pTmp = pSrcNode ? pSrcNode->FindSttNodeByType(eSearchNodeType) : 0;
+
+ //SectionNodes ueberspringen
+ while(pTmp && pTmp->IsSectionNode())
+ {
+ pTmp = pTmp->StartOfSectionNode();
+ }
+ while(pOwnStartNode && pOwnStartNode->IsSectionNode())
+ {
+ pOwnStartNode = pOwnStartNode->StartOfSectionNode();
+ }
+ //ohne Expand darf mit dem ViewCursor ueberall hingesprungen werden
+ //mit Expand nur in der gleichen Umgebung
+ if(bExpand &&
+ (pOwnStartNode != pTmp ||
+ (eSelMode != SHELL_MODE_TABLE_TEXT &&
+ eSelMode != SHELL_MODE_LIST_TEXT &&
+ eSelMode != SHELL_MODE_TABLE_LIST_TEXT &&
+ eSelMode != SHELL_MODE_TEXT)))
+ throw uno::RuntimeException();
+
+ //jetzt muss die Selektion erweitert werden
+ if(bExpand)
+ {
+ // der Cursor soll alles einschliessen, was bisher von ihm und dem uebergebenen
+ // Range eingeschlossen wurde
+ SwPosition aOwnLeft(*aOwnPaM.Start());
+ SwPosition aOwnRight(*aOwnPaM.End());
+ SwPosition* pParamLeft = rDestPam.Start();
+ SwPosition* pParamRight = rDestPam.End();
+ // jetzt sind vier SwPositions da, zwei davon werden gebraucht, also welche?
+ if(aOwnRight > *pParamRight)
+ *aOwnPaM.GetPoint() = aOwnRight;
+ else
+ *aOwnPaM.GetPoint() = *pParamRight;
+ aOwnPaM.SetMark();
+ if(aOwnLeft < *pParamLeft)
+ *aOwnPaM.GetMark() = aOwnLeft;
+ else
+ *aOwnPaM.GetMark() = *pParamLeft;
+ }
+ else
+ {
+ //der Cursor soll dem uebergebenen Range entsprechen
+ *aOwnPaM.GetPoint() = *rDestPam.GetPoint();
+ if(rDestPam.HasMark())
+ {
+ aOwnPaM.SetMark();
+ *aOwnPaM.GetMark() = *rDestPam.GetMark();
+ }
+ else
+ aOwnPaM.DeleteMark();
+ }
+ rSh.SetSelection(aOwnPaM);
+ }
+ else
+ throw uno::RuntimeException();
+
+}
+/*-- 17.12.98 09:36:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextViewCursor::gotoStart(sal_Bool bExpand) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(m_pView)
+ {
+ if (!IsTextSelection())
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ m_pView->GetWrtShell().SttDoc( bExpand );
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 17.12.98 09:36:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextViewCursor::gotoEnd(sal_Bool bExpand) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(m_pView)
+ {
+ if (!IsTextSelection())
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ m_pView->GetWrtShell().EndDoc( bExpand );
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 17.12.98 09:36:28---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::jumpToFirstPage(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ {
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ if (rSh.IsSelFrmMode())
+ {
+ rSh.UnSelectFrm();
+ rSh.LeaveSelFrmMode();
+ }
+ rSh.EnterStdMode();
+ bRet = rSh.SttEndDoc(TRUE);
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 17.12.98 09:36:29---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::jumpToLastPage(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ {
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ if (rSh.IsSelFrmMode())
+ {
+ rSh.UnSelectFrm();
+ rSh.LeaveSelFrmMode();
+ }
+ rSh.EnterStdMode();
+ bRet = rSh.SttEndDoc(FALSE);
+ rSh.SttPg();
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 17.12.98 09:36:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::jumpToPage(sal_Int16 nPage) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ bRet = m_pView->GetWrtShell().GotoPage(nPage, TRUE);
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 17.12.98 09:36:30---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::jumpToNextPage(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ bRet = m_pView->GetWrtShell().SttNxtPg();
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 17.12.98 09:36:31---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::jumpToPreviousPage(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ bRet = m_pView->GetWrtShell().EndPrvPg();
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 17.12.98 09:36:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::jumpToEndOfPage(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ bRet = m_pView->GetWrtShell().EndPg();
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 17.12.98 09:36:32---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::jumpToStartOfPage(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ bRet = m_pView->GetWrtShell().SttPg();
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/* -----------------04.10.99 14:21-------------------
+
+ --------------------------------------------------*/
+sal_Int16 SwXTextViewCursor::getPage(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ short nRet = 0;
+ if(m_pView)
+ {
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ SwPaM* pShellCrsr = rSh.GetCrsr();
+ nRet = (short)pShellCrsr->GetPageNum( TRUE, 0 );
+ }
+ else
+ throw uno::RuntimeException();
+ return nRet;
+}
+/*-- 17.12.98 09:36:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::screenDown(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ {
+ SfxRequest aReq(FN_PAGEDOWN, SFX_CALLMODE_SLOT, m_pView->GetPool());
+ m_pView->Execute(aReq);
+ const SfxPoolItem* pRet = aReq.GetReturnValue();
+ bRet = pRet && ((const SfxBoolItem*)pRet)->GetValue();
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 17.12.98 09:36:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::screenUp(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ {
+ SfxRequest aReq(FN_PAGEUP, SFX_CALLMODE_SLOT, m_pView->GetPool());
+ m_pView->Execute(aReq);
+ const SfxPoolItem* pRet = aReq.GetReturnValue();
+ bRet = pRet && ((const SfxBoolItem*)pRet)->GetValue();
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 17.12.98 11:59:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XText > SwXTextViewCursor::getText(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XText > xRet;
+ if(m_pView)
+ {
+ if (!IsTextSelection( sal_False ))
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ SwPaM* pShellCrsr = rSh.GetCrsr();
+ SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
+ xRet = ::sw::CreateParentXText(*pDoc, *pShellCrsr->Start());
+ }
+ else
+ throw uno::RuntimeException();
+ return xRet;
+}
+/*-- 17.12.98 11:59:05---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXTextViewCursor::getStart(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XTextRange > xRet;
+ if(m_pView)
+ {
+ if (!IsTextSelection())
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ SwPaM* pShellCrsr = rSh.GetCrsr();
+ SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
+ xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCrsr->Start(), 0);
+ }
+ else
+ throw uno::RuntimeException();
+ return xRet;
+}
+/*-- 17.12.98 11:59:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< text::XTextRange > SwXTextViewCursor::getEnd(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ uno::Reference< text::XTextRange > xRet;
+ if(m_pView)
+ {
+ if (!IsTextSelection())
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ SwPaM* pShellCrsr = rSh.GetCrsr();
+ SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
+ xRet = SwXTextRange::CreateXTextRange(*pDoc, *pShellCrsr->End(), 0);
+ }
+ else
+ throw uno::RuntimeException();
+ return xRet;
+}
+/* -----------------12.10.99 09:03-------------------
+
+ --------------------------------------------------*/
+OUString SwXTextViewCursor::getString(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ OUString uRet;
+ if(m_pView)
+ {
+ if (!IsTextSelection( sal_False ))
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ ShellModes eSelMode = m_pView->GetShellMode();
+ switch(eSelMode)
+ {
+ //! since setString for SEL_TABLE_TEXT (with possible
+ //! multi selection of cells) would not work properly we
+ //! will ignore this case for both
+ //! functions (setString AND getString) because of symmetrie.
+
+ case SHELL_MODE_LIST_TEXT :
+ case SHELL_MODE_TABLE_LIST_TEXT:
+ case SHELL_MODE_TEXT :
+ {
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ SwPaM* pShellCrsr = rSh.GetCrsr();
+ SwUnoCursorHelper::GetTextFromPam(*pShellCrsr, uRet);
+ }
+ default:;//prevent warning
+ }
+ }
+ return uRet;
+}
+/*-- 17.12.98 11:59:06---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextViewCursor::setString(const OUString& aString) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(m_pView)
+ {
+ if (!IsTextSelection( sal_False ))
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ ShellModes eSelMode = m_pView->GetShellMode();
+ switch(eSelMode)
+ {
+ //! since setString for SEL_TABLE_TEXT (with possible
+ //! multi selection of cells) would not work properly we
+ //! will ignore this case for both
+ //! functions (setString AND getString) because of symmetrie.
+
+ case SHELL_MODE_LIST_TEXT :
+ case SHELL_MODE_TABLE_LIST_TEXT :
+ case SHELL_MODE_TEXT :
+ {
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ SwCursor* pShellCrsr = rSh.GetSwCrsr();
+ SwUnoCursorHelper::SetString(*pShellCrsr, aString);
+ }
+ default:;//prevent warning
+ }
+ }
+}
+
+/*-- 29.06.00 17:33:38---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+uno::Reference< XPropertySetInfo > SwXTextViewCursor::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static uno::Reference< XPropertySetInfo > xRef = m_pPropSet->getPropertySetInfo();
+ return xRef;
+}
+/*-- 29.06.00 17:33:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextViewCursor::setPropertyValue( const OUString& rPropertyName, const Any& aValue )
+ throw(UnknownPropertyException, PropertyVetoException,
+ IllegalArgumentException, WrappedTargetException, RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(m_pView)
+ {
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ SwPaM* pShellCrsr = rSh.GetCrsr();
+ SwNode *pNode = pShellCrsr->GetNode();
+ if (pNode && pNode->IsTxtNode())
+ {
+ SwUnoCursorHelper::SetPropertyValue(
+ *pShellCrsr, *m_pPropSet, rPropertyName, aValue );
+ }
+ else
+ throw RuntimeException();
+ }
+ else
+ throw RuntimeException();
+}
+/*-- 29.06.00 17:33:39---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXTextViewCursor::getPropertyValue( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ Any aRet;
+ if(m_pView)
+ {
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ SwPaM* pShellCrsr = rSh.GetCrsr();
+ aRet = SwUnoCursorHelper::GetPropertyValue(
+ *pShellCrsr, *m_pPropSet, rPropertyName);
+ }
+ else
+ throw RuntimeException();
+ return aRet;
+}
+/*-- 29.06.00 17:33:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextViewCursor::addPropertyChangeListener(
+ const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*xListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/*-- 29.06.00 17:33:40---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextViewCursor::removePropertyChangeListener(
+ const OUString& /*aPropertyName*/, const uno::Reference< XPropertyChangeListener >& /*aListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/*-- 29.06.00 17:33:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextViewCursor::addVetoableChangeListener(
+ const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/*-- 29.06.00 17:33:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextViewCursor::removeVetoableChangeListener(
+ const OUString& /*PropertyName*/, const uno::Reference< XVetoableChangeListener >& /*aListener*/ ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+}
+/*-- 29.06.00 17:33:41---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+PropertyState SwXTextViewCursor::getPropertyState( const OUString& rPropertyName )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ PropertyState eState;
+ if(m_pView)
+ {
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ SwPaM* pShellCrsr = rSh.GetCrsr();
+ eState = SwUnoCursorHelper::GetPropertyState(
+ *pShellCrsr, *m_pPropSet, rPropertyName);
+ }
+ else
+ throw RuntimeException();
+ return eState;
+}
+/*-- 29.06.00 17:33:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Sequence< PropertyState > SwXTextViewCursor::getPropertyStates(
+ const Sequence< OUString >& rPropertyNames ) throw(UnknownPropertyException, RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ Sequence< PropertyState > aRet;
+ if(m_pView)
+ {
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ SwPaM* pShellCrsr = rSh.GetCrsr();
+ aRet = SwUnoCursorHelper::GetPropertyStates(
+ *pShellCrsr, *m_pPropSet, rPropertyNames);
+ }
+ return aRet;
+}
+/*-- 29.06.00 17:33:42---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextViewCursor::setPropertyToDefault( const OUString& rPropertyName )
+ throw(UnknownPropertyException, RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(m_pView)
+ {
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ SwPaM* pShellCrsr = rSh.GetCrsr();
+ SwUnoCursorHelper::SetPropertyToDefault(
+ *pShellCrsr, *m_pPropSet, rPropertyName);
+ }
+}
+/*-- 29.06.00 17:33:43---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+Any SwXTextViewCursor::getPropertyDefault( const OUString& rPropertyName )
+ throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
+{
+ Any aRet;
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(m_pView)
+ {
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ SwPaM* pShellCrsr = rSh.GetCrsr();
+ aRet = SwUnoCursorHelper::GetPropertyDefault(
+ *pShellCrsr, *m_pPropSet, rPropertyName);
+ }
+ return aRet;
+}
+/*-- 28.09.99 08:31:19---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::goDown(sal_Int16 nCount, sal_Bool bExpand) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ {
+ if (!IsTextSelection())
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ bRet = m_pView->GetWrtShell().Down( bExpand, 1, sal_True );
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 28.09.99 08:31:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::goUp(sal_Int16 nCount, sal_Bool bExpand) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ {
+ if (!IsTextSelection())
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ bRet = m_pView->GetWrtShell().Up( bExpand, 1, sal_True );
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 28.09.99 08:31:20---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::isAtStartOfLine(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ {
+ if (!IsTextSelection( sal_False ))
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ bRet = m_pView->GetWrtShell().IsAtLeftMargin();
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 28.09.99 08:31:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+sal_Bool SwXTextViewCursor::isAtEndOfLine(void) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ sal_Bool bRet = sal_False;
+ if(m_pView)
+ {
+ if (!IsTextSelection( sal_False ))
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ bRet = m_pView->GetWrtShell().IsAtRightMargin(sal_True);
+ }
+ else
+ throw uno::RuntimeException();
+ return bRet;
+}
+/*-- 28.09.99 08:31:21---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextViewCursor::gotoEndOfLine(sal_Bool bExpand) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(m_pView)
+ {
+ if (!IsTextSelection( sal_False ))
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ m_pView->GetWrtShell().RightMargin(bExpand, sal_True);
+ }
+ else
+ throw uno::RuntimeException();
+}
+/*-- 28.09.99 08:31:22---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwXTextViewCursor::gotoStartOfLine(sal_Bool bExpand) throw( uno::RuntimeException )
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ if(m_pView)
+ {
+ if (!IsTextSelection( sal_False ))
+ throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "no text selection" ) ), static_cast < cppu::OWeakObject * > ( this ) );
+
+ m_pView->GetWrtShell().LeftMargin(bExpand, sal_True);
+ }
+ else
+ throw uno::RuntimeException();
+}
+/* -----------------------------06.04.00 11:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+OUString SwXTextViewCursor::getImplementationName(void) throw( RuntimeException )
+{
+ return C2U("SwXTextViewCursor");
+}
+/* -----------------------------06.04.00 11:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwXTextViewCursor::supportsService(const OUString& rServiceName) throw( RuntimeException )
+{
+ return !rServiceName.compareToAscii("com.sun.star.text.TextViewCursor") ||
+ !rServiceName.compareToAscii("com.sun.star.style.CharacterProperties") ||
+ !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesAsian") ||
+ !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesComplex") ||
+ !rServiceName.compareToAscii("com.sun.star.style.ParagraphProperties") ||
+ !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesAsian") ||
+ !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesComplex");
+}
+/* -----------------------------06.04.00 11:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence< OUString > SwXTextViewCursor::getSupportedServiceNames(void) throw( RuntimeException )
+{
+ Sequence< OUString > aRet(7);
+ OUString* pArray = aRet.getArray();
+ pArray[0] = C2U("com.sun.star.text.TextViewCursor");
+ pArray[1] = C2U("com.sun.star.style.CharacterProperties");
+ pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian");
+ pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex");
+ pArray[4] = C2U("com.sun.star.style.ParagraphProperties");
+ pArray[5] = C2U("com.sun.star.style.ParagraphPropertiesAsian");
+ pArray[6] = C2U("com.sun.star.style.ParagraphPropertiesComplex");
+ return aRet;
+}
+/* -----------------------------03.03.03 11:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+const uno::Sequence< sal_Int8 > & SwXTextViewCursor::getUnoTunnelId()
+{
+ static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
+ return aSeq;
+}
+/* -----------------------------03.03.03 11:07--------------------------------
+
+ ---------------------------------------------------------------------------*/
+//XUnoTunnel
+sal_Int64 SAL_CALL SwXTextViewCursor::getSomething(
+ const uno::Sequence< sal_Int8 >& rId )
+ throw(uno::RuntimeException)
+{
+ if( rId.getLength() == 16
+ && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ));
+ }
+ return OTextCursorHelper::getSomething(rId);;
+}
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2(SwXTextViewCursor,SwXTextViewCursor_Base,OTextCursorHelper)
+const SwDoc* SwXTextViewCursor::GetDoc() const
+{
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ return rSh.GetCrsr() ? rSh.GetCrsr()->GetDoc() : 0;
+}
+// -----------------------------------------------------------------------------
+SwDoc* SwXTextViewCursor::GetDoc()
+{
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ return rSh.GetCrsr() ? rSh.GetCrsr()->GetDoc() : 0;
+}
+// -----------------------------------------------------------------------------
+const SwPaM* SwXTextViewCursor::GetPaM() const
+{
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ return rSh.GetCrsr();
+}
+// -----------------------------------------------------------------------------
+SwPaM* SwXTextViewCursor::GetPaM()
+{
+ SwWrtShell& rSh = m_pView->GetWrtShell();
+ return rSh.GetCrsr();
+}
+
+uno::Reference< datatransfer::XTransferable > SAL_CALL SwXTextView::getTransferable( ) throw (uno::RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+
+ //force immediat shell update
+ GetView()->StopShellTimer();
+ SwWrtShell& rSh = GetView()->GetWrtShell();
+ if ( GetView()->GetShellMode() == SHELL_MODE_DRAWTEXT )
+ {
+ SdrView *pSdrView = rSh.GetDrawView();
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ return pOLV->GetEditView().GetTransferable();
+ }
+ else
+ {
+ SwTransferable* pTransfer = new SwTransferable( rSh );
+ const BOOL bLockedView = rSh.IsViewLocked();
+ rSh.LockView( TRUE ); //lock visible section
+ pTransfer->PrepareForCopy();
+ rSh.LockView( bLockedView );
+ return uno::Reference< datatransfer::XTransferable >( pTransfer );
+ }
+}
+
+void SAL_CALL SwXTextView::insertTransferable( const uno::Reference< datatransfer::XTransferable >& xTrans ) throw (datatransfer::UnsupportedFlavorException, uno::RuntimeException)
+{
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+
+ //force immediat shell update
+ GetView()->StopShellTimer();
+ SwWrtShell& rSh = GetView()->GetWrtShell();
+ if ( GetView()->GetShellMode() == SHELL_MODE_DRAWTEXT )
+ {
+ SdrView *pSdrView = rSh.GetDrawView();
+ OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+ pOLV->GetEditView().InsertText( xTrans, GetView()->GetDocShell()->GetMedium()->GetBaseURL(), FALSE );
+ }
+ else
+ {
+ TransferableDataHelper aDataHelper( xTrans );
+ if ( SwTransferable::IsPaste( rSh, aDataHelper ) )
+ {
+ SwTransferable::Paste( rSh, aDataHelper );
+ if( rSh.IsFrmSelected() || rSh.IsObjSelected() )
+ rSh.EnterSelFrmMode();
+ GetView()->AttrChangedNotify( &rSh );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
diff --git a/sw/source/ui/utlui/attrdesc.cxx b/sw/source/ui/utlui/attrdesc.cxx
new file mode 100644
index 000000000000..418ea4a4559b
--- /dev/null
+++ b/sw/source/ui/utlui/attrdesc.cxx
@@ -0,0 +1,1350 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <svl/itemiter.hxx>
+#include <vcl/svapp.hxx>
+#include <editeng/itemtype.hxx>
+#include <svtools/grfmgr.hxx>
+#include <unotools/intlwrapper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <fmtanchr.hxx>
+#include <fmtfsize.hxx>
+#include <fmtinfmt.hxx>
+#include <fchrfmt.hxx>
+#include <fmtautofmt.hxx>
+#include <fmtsrnd.hxx>
+#include <fmtornt.hxx>
+#include <fmtlsplt.hxx>
+#include <fmtrowsplt.hxx>
+#include <fmtpdsc.hxx>
+#include <fmtclds.hxx>
+#include <fmteiro.hxx>
+#include <fmturl.hxx>
+#include <fmthdft.hxx>
+#include <fmtcnct.hxx>
+#include <fmtline.hxx>
+#include <tgrditem.hxx>
+#include <hfspacingitem.hxx>
+#include <fmtruby.hxx>
+#include <paratr.hxx>
+#include <grfatr.hxx>
+#include <pagedesc.hxx>
+#include <charfmt.hxx>
+#include <fmtcol.hxx>
+#include <tox.hxx>
+#ifndef _ATTRDESC_HRC
+#include <attrdesc.hrc>
+#endif
+#include <fmtftntx.hxx>
+#include <fmtfollowtextflow.hxx>
+
+
+using namespace com::sun::star;
+
+
+TYPEINIT2(SwFmtCharFmt,SfxPoolItem,SwClient);
+
+// erfrage die Attribut-Beschreibung
+void SwAttrSet::GetPresentation(
+ SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ String &rText ) const
+{
+static sal_Char __READONLY_DATA sKomma[] = ", ";
+
+ rText.Erase();
+ String aStr;
+ if( Count() )
+ {
+ SfxItemIter aIter( *this );
+ const IntlWrapper rInt( ::comphelper::getProcessServiceFactory(),
+ GetAppLanguage() );
+ while( TRUE )
+ {
+ aIter.GetCurItem()->GetPresentation( ePres, eCoreMetric,
+ ePresMetric, aStr,
+ &rInt );
+ if( rText.Len() && aStr.Len() )
+ rText += String::CreateFromAscii(sKomma);
+ rText += aStr;
+ if( aIter.IsAtEnd() )
+ break;
+ aIter.NextItem();
+ }
+ }
+}
+
+// ATT_CHARFMT *********************************************
+
+
+SfxItemPresentation SwFmtCharFmt::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit,
+ SfxMapUnit ePresUnit,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ const SwCharFmt *pCharFmt = GetCharFmt();
+ if ( pCharFmt )
+ {
+ String aStr;
+ rText = SW_RESSTR(STR_CHARFMT );
+ pCharFmt->GetPresentation( ePres, eCoreUnit, ePresUnit, aStr );
+ rText += '(';
+ rText += aStr;
+ rText += ')';
+ }
+ else
+ rText = SW_RESSTR( STR_NO_CHARFMT );
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+// ATT_AUTOFMT *********************************************
+
+
+SfxItemPresentation SwFmtAutoFmt::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ rText.Erase(); //TODO
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+// ATT_INETFMT *********************************************
+
+
+SfxItemPresentation SwFmtINetFmt::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ rText = GetValue();
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+SfxItemPresentation SwFmtRuby::GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/, SfxMapUnit /*ePresMetric*/,
+ String &rText, const IntlWrapper* /*pIntl*/ ) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ rText = aEmptyStr;
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+/*************************************************************************
+|* class SwFmtDrop
+*************************************************************************/
+
+
+SfxItemPresentation SwFmtDrop::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ rText.Erase();
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ if ( GetLines() > 1 )
+ {
+ if ( GetChars() > 1 )
+ {
+ rText = String::CreateFromInt32( GetChars() );
+ rText += ' ';
+ }
+ rText += SW_RESSTR( STR_DROP_OVER );
+ rText += ' ';
+ rText += String::CreateFromInt32( GetLines() );
+ rText += ' ';
+ rText += SW_RESSTR( STR_DROP_LINES );
+ }
+ else
+ rText = SW_RESSTR( STR_NO_DROP_LINES );
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+/*************************************************************************
+|* class SwRegisterItem
+*************************************************************************/
+
+
+SfxItemPresentation SwRegisterItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ USHORT nId = GetValue() ? STR_REGISTER_ON : STR_REGISTER_OFF;
+ rText = SW_RESSTR( nId );
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+/*************************************************************************
+|* class SwNumRuleItem
+*************************************************************************/
+
+
+SfxItemPresentation SwNumRuleItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ if( GetValue().Len() )
+ (((rText = SW_RESSTR( STR_NUMRULE_ON )) +=
+ '(' ) += GetValue() ) += ')';
+ else
+ rText = SW_RESSTR( STR_NUMRULE_OFF );
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+/*************************************************************************
+|* class SwParaConnectBorderItem
+*************************************************************************/
+
+SfxItemPresentation SwParaConnectBorderItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ XubString& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ USHORT nId = GetValue() ? STR_CONNECT_BORDER_ON : STR_CONNECT_BORDER_OFF;
+ rText = SW_RESSTR( nId );
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+
+
+/******************************************************************************
+ * Frame-Attribute:
+ ******************************************************************************/
+
+
+SfxItemPresentation SwFmtFrmSize::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit,
+ SfxMapUnit ePresUnit,
+ String& rText,
+ const IntlWrapper* pIntl
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ {
+ rText.Erase();
+ break;
+ }
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ rText = SW_RESSTR( STR_FRM_WIDTH );
+ rText += ' ';
+ if ( GetWidthPercent() )
+ {
+ rText += String::CreateFromInt32(GetWidthPercent());
+ rText += '%';
+ }
+ else
+ {
+ rText += ::GetMetricText( GetWidth(), eCoreUnit, ePresUnit, pIntl );
+ rText += ::GetSvxString( ::GetMetricId( ePresUnit ) );
+ }
+ if ( ATT_VAR_SIZE != GetHeightSizeType() )
+ {
+ rText += ',';
+ rText += ' ';
+ const USHORT nId = ATT_FIX_SIZE == eFrmHeightType ?
+ STR_FRM_FIXEDHEIGHT : STR_FRM_MINHEIGHT;
+ rText += SW_RESSTR( nId );
+ rText += ' ';
+ if ( GetHeightPercent() )
+ {
+ rText += String::CreateFromInt32(GetHeightPercent());
+ rText += '%';
+ }
+ else
+ {
+ rText += ::GetMetricText( GetHeight(), eCoreUnit, ePresUnit, pIntl );
+ rText += ::GetSvxString( ::GetMetricId( ePresUnit ) );
+ }
+ }
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//Kopfzeile, fuer Seitenformate
+//Client von FrmFmt das den Header beschreibt.
+
+
+SfxItemPresentation SwFmtHeader::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ const USHORT nId = GetHeaderFmt() ? STR_HEADER : STR_NO_HEADER;
+ rText = SW_RESSTR( nId );
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//Fusszeile, fuer Seitenformate
+//Client von FrmFmt das den Footer beschreibt.
+
+
+SfxItemPresentation SwFmtFooter::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ const USHORT nId = GetFooterFmt() ? STR_FOOTER : STR_NO_FOOTER;
+ rText = SW_RESSTR( nId );
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+
+SfxItemPresentation SwFmtSurround::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ USHORT nId = 0;
+ switch ( (SwSurround)GetValue() )
+ {
+ case SURROUND_NONE:
+ nId = STR_SURROUND_NONE;
+ break;
+ case SURROUND_THROUGHT:
+ nId = STR_SURROUND_THROUGHT;
+ break;
+ case SURROUND_PARALLEL:
+ nId = STR_SURROUND_PARALLEL;
+ break;
+ case SURROUND_IDEAL:
+ nId = STR_SURROUND_IDEAL;
+ break;
+ case SURROUND_LEFT:
+ nId = STR_SURROUND_LEFT;
+ break;
+ case SURROUND_RIGHT:
+ nId = STR_SURROUND_RIGHT;
+ break;
+ default:;//prevent warning
+ }
+ if ( nId )
+ rText = SW_RESSTR( nId );
+
+ if ( IsAnchorOnly() )
+ {
+ rText += ' ';
+ rText += SW_RESSTR( STR_SURROUND_ANCHORONLY );
+ }
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+
+//VertOrientation, wie und woran orientiert --
+// sich der FlyFrm in der Vertikalen -----------
+
+
+SfxItemPresentation SwFmtVertOrient::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit,
+ SfxMapUnit ePresUnit,
+ String& rText,
+ const IntlWrapper* pIntl
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ USHORT nId = 0;
+ switch ( GetVertOrient() )
+ {
+ case text::VertOrientation::NONE:
+ {
+ rText += SW_RESSTR( STR_POS_Y );
+ rText += ' ';
+ rText += ::GetMetricText( GetPos(), eCoreUnit, ePresUnit, pIntl );
+ rText += ::GetSvxString( ::GetMetricId( ePresUnit ) );
+ }
+ break;
+ case text::VertOrientation::TOP:
+ nId = STR_VERT_TOP;
+ break;
+ case text::VertOrientation::CENTER:
+ nId = STR_VERT_CENTER;
+ break;
+ case text::VertOrientation::BOTTOM:
+ nId = STR_VERT_BOTTOM;
+ break;
+ case text::VertOrientation::LINE_TOP:
+ nId = STR_LINE_TOP;
+ break;
+ case text::VertOrientation::LINE_CENTER:
+ nId = STR_LINE_CENTER;
+ break;
+ case text::VertOrientation::LINE_BOTTOM:
+ nId = STR_LINE_BOTTOM;
+ break;
+ default:;//prevent warning
+ }
+ if ( nId )
+ rText += SW_RESSTR( nId );
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//HoriOrientation, wie und woran orientiert --
+// sich der FlyFrm in der Hoizontalen ----------
+
+
+SfxItemPresentation SwFmtHoriOrient::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit,
+ SfxMapUnit ePresUnit,
+ String& rText,
+ const IntlWrapper* pIntl
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ USHORT nId = 0;
+ switch ( GetHoriOrient() )
+ {
+ case text::HoriOrientation::NONE:
+ {
+ rText += SW_RESSTR( STR_POS_X );
+ rText += ' ';
+ rText += ::GetMetricText( GetPos(), eCoreUnit, ePresUnit, pIntl );
+ rText += ::GetSvxString( ::GetMetricId( ePresUnit ) );
+ }
+ break;
+ case text::HoriOrientation::RIGHT:
+ nId = STR_HORI_RIGHT;
+ break;
+ case text::HoriOrientation::CENTER:
+ nId = STR_HORI_CENTER;
+ break;
+ case text::HoriOrientation::LEFT:
+ nId = STR_HORI_LEFT;
+ break;
+ case text::HoriOrientation::INSIDE:
+ nId = STR_HORI_INSIDE;
+ break;
+ case text::HoriOrientation::OUTSIDE:
+ nId = STR_HORI_OUTSIDE;
+ break;
+ case text::HoriOrientation::FULL:
+ nId = STR_HORI_FULL;
+ break;
+ default:;//prevent warning
+ }
+ if ( nId )
+ rText += SW_RESSTR( nId );
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//FlyAnchor, Anker des Freifliegenden Rahmen ----
+
+
+SfxItemPresentation SwFmtAnchor::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ USHORT nId = 0;
+ switch ( GetAnchorId() )
+ {
+ case FLY_AT_PARA:
+ nId = STR_FLY_AT_PARA;
+ break;
+ case FLY_AS_CHAR:
+ nId = STR_FLY_AS_CHAR;
+ break;
+ case FLY_AT_PAGE:
+ nId = STR_FLY_AT_PAGE;
+ break;
+ default:;//prevent warning
+ }
+ if ( nId )
+ rText += SW_RESSTR( nId );
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+
+SfxItemPresentation SwFmtPageDesc::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ const SwPageDesc *pPageDesc = GetPageDesc();
+ if ( pPageDesc )
+ rText = pPageDesc->GetName();
+ else
+ rText = SW_RESSTR( STR_NO_PAGEDESC );
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//Der ColumnDescriptor --------------------------
+
+
+SfxItemPresentation SwFmtCol::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* pIntl
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ USHORT nCnt = GetNumCols();
+ if ( nCnt > 1 )
+ {
+ rText = String::CreateFromInt32(nCnt);
+ rText += ' ';
+ rText += SW_RESSTR( STR_COLUMNS );
+ if ( COLADJ_NONE != GetLineAdj() )
+ {
+ USHORT nWdth = USHORT(GetLineWidth());
+ rText += ' ';
+ rText += SW_RESSTR( STR_LINE_WIDTH );
+ rText += ' ';
+ rText += ::GetMetricText( nWdth, eCoreUnit,
+ SFX_MAPUNIT_POINT, pIntl );
+ }
+ }
+ else
+ rText.Erase();
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+//URL's und Maps
+
+
+SfxItemPresentation SwFmtURL::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ rText.Erase();
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ if ( pMap )
+ rText.AppendAscii( RTL_CONSTASCII_STRINGPARAM("Client-Map"));
+ if ( sURL.Len() )
+ {
+ if ( pMap )
+ rText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" - "));
+ rText.AppendAscii( RTL_CONSTASCII_STRINGPARAM("URL: "));
+ rText += sURL;
+ if ( bIsServerMap )
+ rText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(" (Server-Map)"));
+ }
+ if ( sTargetFrameName.Len() )
+ {
+ rText.AppendAscii( RTL_CONSTASCII_STRINGPARAM(", Target: "));
+ rText += sTargetFrameName;
+ }
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+
+//SwFmtEditInReadonly
+
+
+SfxItemPresentation SwFmtEditInReadonly::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ rText.Erase();
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ break;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ if ( GetValue() )
+ rText = SW_RESSTR(STR_EDIT_IN_READONLY);
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+
+SfxItemPresentation SwFmtLayoutSplit::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ if ( GetValue() )
+ rText = SW_RESSTR(STR_LAYOUT_SPLIT);
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+SfxItemPresentation SwFmtRowSplit::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& /*rText*/,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+
+SfxItemPresentation SwFmtFtnEndAtTxtEnd::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ break;
+
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ switch( GetValue() )
+ {
+ case FTNEND_ATPGORDOCEND:
+// rText = SW_RESSTR( STR_LAYOUT_FTN );
+ break;
+
+ case FTNEND_ATTXTEND:
+ break;
+
+ case FTNEND_ATTXTEND_OWNNUMSEQ:
+ {
+// String sPrefix;
+// String sSuffix;
+// SvxNumberType aFmt;
+// USHORT nOffset;
+// rText +=
+ }
+ break;
+ }
+ }
+ break;
+
+ default:
+ ePres = SFX_ITEM_PRESENTATION_NONE;
+ break;
+ }
+ return ePres;
+}
+
+SfxItemPresentation SwFmtChain::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ if ( GetPrev() || GetNext() )
+ {
+ rText = SW_RESSTR(STR_CONNECT1);
+ if ( GetPrev() )
+ {
+ rText += GetPrev()->GetName();
+ if ( GetNext() )
+ rText += SW_RESSTR(STR_CONNECT2);
+ }
+ if ( GetNext() )
+ rText += GetNext()->GetName();
+ }
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+
+SfxItemPresentation SwFmtLineNumber::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ if ( IsCount() )
+ rText += SW_RESSTR(STR_LINECOUNT);
+ else
+ rText += SW_RESSTR(STR_DONTLINECOUNT);
+ if ( GetStartValue() )
+ {
+ rText += ' ';
+ rText += SW_RESSTR(STR_LINCOUNT_START);
+ rText += String::CreateFromInt32(GetStartValue());
+ }
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+SfxItemPresentation SwTextGridItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& rText,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ USHORT nId = 0;
+
+ switch ( GetGridType() )
+ {
+ case GRID_NONE :
+ nId = STR_GRID_NONE;
+ break;
+ case GRID_LINES_ONLY :
+ nId = STR_GRID_LINES_ONLY;
+ break;
+ case GRID_LINES_CHARS :
+ nId = STR_GRID_LINES_CHARS;
+ break;
+ }
+ if ( nId )
+ rText += SW_RESSTR( nId );
+ return ePres;
+ }
+ default:;//prevent warning
+ }
+
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+
+//SwHeaderAndFooterEatSpacingItem
+
+
+SfxItemPresentation SwHeaderAndFooterEatSpacingItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ SfxMapUnit /*eCoreUnit*/,
+ SfxMapUnit /*ePresUnit*/,
+ String& /*rText*/,
+ const IntlWrapper* /*pIntl*/
+) const
+{
+// rText.Erase();
+// switch ( ePres )
+// {
+// case SFX_ITEM_PRESENTATION_NONE:
+// rText.Erase();
+// break;
+// case SFX_ITEM_PRESENTATION_NAMELESS:
+// case SFX_ITEM_PRESENTATION_COMPLETE:
+// {
+// if ( GetValue() )
+// rText = SW_RESSTR(STR_EDIT_IN_READONLY);
+// return ePres;
+// }
+// }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+
+
+// ---------------------- Grafik-Attribute --------------------------
+
+SfxItemPresentation SwMirrorGrf::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
+ String& rText, const IntlWrapper* /*pIntl*/ ) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ USHORT nId;
+ switch( GetValue() )
+ {
+ case RES_MIRROR_GRAPH_DONT: nId = STR_NO_MIRROR; break;
+ case RES_MIRROR_GRAPH_VERT: nId = STR_VERT_MIRROR; break;
+ case RES_MIRROR_GRAPH_HOR: nId = STR_HORI_MIRROR; break;
+ case RES_MIRROR_GRAPH_BOTH: nId = STR_BOTH_MIRROR; break;
+ default: nId = 0; break;
+ }
+ if ( nId )
+ {
+ rText = SW_RESSTR( nId );
+ if (bGrfToggle)
+ rText += SW_RESSTR( STR_MIRROR_TOGGLE );
+ }
+ }
+ break;
+ default:
+ ePres = SFX_ITEM_PRESENTATION_NONE;
+ rText.Erase();
+ break;
+ }
+ return ePres;
+}
+
+
+SfxItemPresentation SwRotationGrf::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
+ String &rText, const IntlWrapper* /*pIntl*/) const
+{
+ switch( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
+ rText = SW_RESSTR( STR_ROTATION );
+ else if( rText.Len() )
+ rText.Erase();
+ ( rText += UniString::CreateFromInt32( GetValue() )) += '\xB0';
+ break;
+
+ default:
+ ePres = SFX_ITEM_PRESENTATION_NONE;
+ rText.Erase();
+ break;
+ }
+ return ePres;
+}
+
+SfxItemPresentation SwLuminanceGrf::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
+ String &rText, const IntlWrapper* /*pIntl*/) const
+{
+ switch( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
+ rText = SW_RESSTR( STR_LUMINANCE );
+ else if( rText.Len() )
+ rText.Erase();
+ ( rText += UniString::CreateFromInt32( GetValue() )) += '%';
+ break;
+
+ default:
+ ePres = SFX_ITEM_PRESENTATION_NONE;
+ rText.Erase();
+ break;
+ }
+ return ePres;
+}
+
+SfxItemPresentation SwContrastGrf::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
+ String &rText, const IntlWrapper* /*pIntl*/) const
+{
+ switch( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
+ rText = SW_RESSTR( STR_CONTRAST );
+ else if( rText.Len() )
+ rText.Erase();
+ ( rText += UniString::CreateFromInt32( GetValue() )) += '%';
+ break;
+
+ default:
+ ePres = SFX_ITEM_PRESENTATION_NONE;
+ rText.Erase();
+ break;
+ }
+ return ePres;
+}
+
+SfxItemPresentation SwChannelGrf::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
+ String &rText, const IntlWrapper* /*pIntl*/) const
+{
+ switch( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
+ {
+ USHORT nId;
+ switch ( Which() )
+ {
+ case RES_GRFATR_CHANNELR: nId = STR_CHANNELR; break;
+ case RES_GRFATR_CHANNELG: nId = STR_CHANNELG; break;
+ case RES_GRFATR_CHANNELB: nId = STR_CHANNELB; break;
+ default: nId = 0; break;
+ }
+ if( nId )
+ rText = SW_RESSTR( nId );
+ else if( rText.Len() )
+ rText.Erase();
+ }
+ else if( rText.Len() )
+ rText.Erase();
+ ( rText += UniString::CreateFromInt32( GetValue() )) += '%';
+ break;
+
+ default:
+ ePres = SFX_ITEM_PRESENTATION_NONE;
+ rText.Erase();
+ break;
+ }
+ return ePres;
+}
+
+SfxItemPresentation SwGammaGrf::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
+ String &rText, const IntlWrapper* /*pIntl*/) const
+{
+ switch( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
+ rText = SW_RESSTR( STR_GAMMA );
+ else if( rText.Len() )
+ rText.Erase();
+ ( rText += UniString::CreateFromDouble( GetValue() )) += '%';
+ break;
+
+ default:
+ ePres = SFX_ITEM_PRESENTATION_NONE;
+ rText.Erase();
+ break;
+ }
+ return ePres;
+}
+
+SfxItemPresentation SwInvertGrf::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
+ String &rText, const IntlWrapper* /*pIntl*/) const
+{
+ rText.Erase();
+ switch( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
+ {
+ USHORT nId = 0 != GetValue() ? STR_INVERT : STR_INVERT_NOT;
+ rText = SW_RESSTR( nId );
+ }
+ break;
+
+ default:
+ ePres = SFX_ITEM_PRESENTATION_NONE;
+ break;
+ }
+ return ePres;
+}
+
+SfxItemPresentation SwTransparencyGrf::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
+ String &rText, const IntlWrapper* /*pIntl*/) const
+{
+ switch( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
+ rText = SW_RESSTR( STR_TRANSPARENCY );
+ else if( rText.Len() )
+ rText.Erase();
+ ( rText += UniString::CreateFromInt32( GetValue() )) += '%';
+ break;
+
+ default:
+ ePres = SFX_ITEM_PRESENTATION_NONE;
+ rText.Erase();
+ break;
+ }
+ return ePres;
+}
+
+SfxItemPresentation SwDrawModeGrf::GetPresentation(
+ SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, SfxMapUnit /*ePresUnit*/,
+ String &rText, const IntlWrapper* /*pIntl*/) const
+{
+ rText.Erase();
+ switch( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ if( SFX_ITEM_PRESENTATION_COMPLETE == ePres )
+ {
+ USHORT nId;
+ switch ( GetValue() )
+ {
+
+ case GRAPHICDRAWMODE_GREYS: nId = STR_DRAWMODE_GREY; break;
+ case GRAPHICDRAWMODE_MONO: nId = STR_DRAWMODE_BLACKWHITE; break;
+ case GRAPHICDRAWMODE_WATERMARK: nId = STR_DRAWMODE_WATERMARK; break;
+ default: nId = STR_DRAWMODE_STD; break;
+ }
+ (rText = SW_RESSTR( STR_DRAWMODE ) ) += SW_RESSTR( nId );
+ }
+ break;
+
+ default:
+ ePres = SFX_ITEM_PRESENTATION_NONE;
+ break;
+ }
+ return ePres;
+}
+
+SfxItemPresentation SwFmtFollowTextFlow::GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit /*eCoreMetric*/,
+ SfxMapUnit /*ePresMetric*/,
+ String &rText,
+ const IntlWrapper* /*pIntl*/ ) const
+{
+ rText.Erase();
+ switch( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ break;
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ USHORT nId = GetValue() ? STR_FOLLOW_TEXT_FLOW : STR_DONT_FOLLOW_TEXT_FLOW;
+ rText = SW_RESSTR( nId );
+ }
+ break;
+
+ default:
+ ePres = SFX_ITEM_PRESENTATION_NONE;
+ break;
+ }
+ return ePres;
+}
+
diff --git a/sw/source/ui/utlui/attrdesc.hrc b/sw/source/ui/utlui/attrdesc.hrc
new file mode 100644
index 000000000000..1f2c5d34fa37
--- /dev/null
+++ b/sw/source/ui/utlui/attrdesc.hrc
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ATTRDESC_HRC
+#define _ATTRDESC_HRC
+
+#include "rcid.hrc"
+
+#define STR_DROP_OVER (RC_ATTR_BEGIN + 1)
+#define STR_DROP_LINES (RC_ATTR_BEGIN + 2)
+#define STR_NO_DROP_LINES (RC_ATTR_BEGIN + 3)
+#define STR_NO_PAGEDESC (RC_ATTR_BEGIN + 4)
+#define STR_NO_MIRROR (RC_ATTR_BEGIN + 5)
+#define STR_VERT_MIRROR (RC_ATTR_BEGIN + 6)
+#define STR_HORI_MIRROR (RC_ATTR_BEGIN + 7)
+#define STR_BOTH_MIRROR (RC_ATTR_BEGIN + 8)
+#define STR_CHARFMT (RC_ATTR_BEGIN + 9)
+#define STR_NO_CHARFMT (RC_ATTR_BEGIN + 10)
+#define STR_FOOTER (RC_ATTR_BEGIN + 11)
+#define STR_NO_FOOTER (RC_ATTR_BEGIN + 12)
+#define STR_HEADER (RC_ATTR_BEGIN + 13)
+#define STR_NO_HEADER (RC_ATTR_BEGIN + 14)
+#define STR_SURROUND_NONE (RC_ATTR_BEGIN + 15)
+#define STR_SURROUND_THROUGHT (RC_ATTR_BEGIN + 16)
+#define STR_SURROUND_PARALLEL (RC_ATTR_BEGIN + 17)
+#define STR_SURROUND_COLUMN (RC_ATTR_BEGIN + 18)
+#define STR_SURROUND_LEFT (RC_ATTR_BEGIN + 19)
+#define STR_SURROUND_RIGHT (RC_ATTR_BEGIN + 20)
+#define STR_SURROUND_INSIDE (RC_ATTR_BEGIN + 21)
+#define STR_SURROUND_OUTSIDE (RC_ATTR_BEGIN + 22)
+#define STR_FRM_WIDTH (RC_ATTR_BEGIN + 23)
+#define STR_FRM_FIXEDHEIGHT (RC_ATTR_BEGIN + 24)
+#define STR_FRM_MINHEIGHT (RC_ATTR_BEGIN + 25)
+#define STR_FLY_AT_PARA (RC_ATTR_BEGIN + 26)
+#define STR_FLY_AS_CHAR (RC_ATTR_BEGIN + 27)
+#define STR_FLY_AT_PAGE (RC_ATTR_BEGIN + 28)
+#define STR_POS_X (RC_ATTR_BEGIN + 29)
+#define STR_POS_Y (RC_ATTR_BEGIN + 30)
+#define STR_VERT_TOP (RC_ATTR_BEGIN + 31)
+#define STR_VERT_CENTER (RC_ATTR_BEGIN + 32)
+#define STR_VERT_BOTTOM (RC_ATTR_BEGIN + 33)
+#define STR_HORI_RIGHT (RC_ATTR_BEGIN + 34)
+#define STR_HORI_CENTER (RC_ATTR_BEGIN + 35)
+#define STR_HORI_LEFT (RC_ATTR_BEGIN + 36)
+#define STR_HORI_INSIDE (RC_ATTR_BEGIN + 37)
+#define STR_HORI_OUTSIDE (RC_ATTR_BEGIN + 38)
+#define STR_HORI_FULL (RC_ATTR_BEGIN + 39)
+#define STR_COLUMNS (RC_ATTR_BEGIN + 40)
+#define STR_LINE_WIDTH (RC_ATTR_BEGIN + 41)
+#define STR_MAX_FTN_HEIGHT (RC_ATTR_BEGIN + 42)
+#define STR_SURROUND_IDEAL (RC_ATTR_BEGIN + 43)
+#define STR_LINE_TOP (RC_ATTR_BEGIN + 44)
+#define STR_LINE_CENTER (RC_ATTR_BEGIN + 45)
+#define STR_LINE_BOTTOM (RC_ATTR_BEGIN + 46)
+#define STR_REGISTER_ON (RC_ATTR_BEGIN + 47)
+#define STR_REGISTER_OFF (RC_ATTR_BEGIN + 48)
+#define STR_SURROUND_ANCHORONLY (RC_ATTR_BEGIN + 49)
+#define STR_EDIT_IN_READONLY (RC_ATTR_BEGIN + 50)
+#define STR_LAYOUT_SPLIT (RC_ATTR_BEGIN + 51)
+#define STR_NUMRULE_ON (RC_ATTR_BEGIN + 52)
+#define STR_NUMRULE_OFF (RC_ATTR_BEGIN + 53)
+#define STR_CONNECT1 (RC_ATTR_BEGIN + 54)
+#define STR_CONNECT2 (RC_ATTR_BEGIN + 55)
+#define STR_MIRROR_TOGGLE (RC_ATTR_BEGIN + 56)
+#define STR_LINECOUNT (RC_ATTR_BEGIN + 57)
+#define STR_DONTLINECOUNT (RC_ATTR_BEGIN + 58)
+#define STR_LINCOUNT_START (RC_ATTR_BEGIN + 59)
+
+#define STR_LUMINANCE (RC_ATTR_BEGIN + 60)
+#define STR_CHANNELR (RC_ATTR_BEGIN + 61)
+#define STR_CHANNELG (RC_ATTR_BEGIN + 62)
+#define STR_CHANNELB (RC_ATTR_BEGIN + 63)
+#define STR_CONTRAST (RC_ATTR_BEGIN + 64)
+#define STR_GAMMA (RC_ATTR_BEGIN + 65)
+#define STR_TRANSPARENCY (RC_ATTR_BEGIN + 66)
+#define STR_INVERT (RC_ATTR_BEGIN + 67)
+#define STR_INVERT_NOT (RC_ATTR_BEGIN + 68)
+#define STR_DRAWMODE (RC_ATTR_BEGIN + 69)
+#define STR_DRAWMODE_STD (RC_ATTR_BEGIN + 70)
+#define STR_DRAWMODE_GREY (RC_ATTR_BEGIN + 71)
+#define STR_DRAWMODE_BLACKWHITE (RC_ATTR_BEGIN + 72)
+#define STR_DRAWMODE_WATERMARK (RC_ATTR_BEGIN + 73)
+#define STR_ROTATION (RC_ATTR_BEGIN + 74)
+#define STR_GRID_NONE (RC_ATTR_BEGIN + 75)
+#define STR_GRID_LINES_ONLY (RC_ATTR_BEGIN + 76)
+#define STR_GRID_LINES_CHARS (RC_ATTR_BEGIN + 77)
+#define STR_FOLLOW_TEXT_FLOW (RC_ATTR_BEGIN + 78)
+#define STR_DONT_FOLLOW_TEXT_FLOW (RC_ATTR_BEGIN + 79)
+#define STR_CONNECT_BORDER_ON (RC_ATTR_BEGIN + 80)
+#define STR_CONNECT_BORDER_OFF (RC_ATTR_BEGIN + 81)
+
+
+#define ATTR_ACT_END STR_CONNECT_BORDER_OFF
+
+#if ATTR_ACT_END > RC_ATTR_END
+#error Resource-Id Ueberlauf in #file, #line
+#endif
+
+#endif
diff --git a/sw/source/ui/utlui/attrdesc.src b/sw/source/ui/utlui/attrdesc.src
new file mode 100644
index 000000000000..809af110da6f
--- /dev/null
+++ b/sw/source/ui/utlui/attrdesc.src
@@ -0,0 +1,384 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "attrdesc.hrc"
+/*---------------------------------------------------------------------
+ Strings fuer textuelle Attribute
+ ---------------------------------------------------------------------*/
+String STR_DROP_OVER
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Initialen über : Initialen ³ber */
+ Text [ en-US ] = "Drop Caps over" ;
+};
+String STR_DROP_LINES
+{
+ Text [ en-US ] = "rows" ;
+};
+String STR_NO_DROP_LINES
+{
+ Text [ en-US ] = "No Drop Caps" ;
+};
+String STR_NO_PAGEDESC
+{
+ Text [ en-US ] = "No page break" ;
+};
+String STR_NO_MIRROR
+{
+ Text [ en-US ] = "Don't mirror" ;
+};
+String STR_VERT_MIRROR
+{
+ Text [ en-US ] = "Flip vertically" ;
+};
+String STR_HORI_MIRROR
+{
+ Text [ en-US ] = "Flip horizontal" ;
+};
+String STR_BOTH_MIRROR
+{
+ Text [ en-US ] = "Horizontal and Vertical Flip" ;
+};
+String STR_MIRROR_TOGGLE
+{
+ Text [ en-US ] = "+ mirror horizontal on even pages" ;
+};
+String STR_CHARFMT
+{
+ Text [ en-US ] = "Character Style" ;
+};
+String STR_NO_CHARFMT
+{
+ Text [ en-US ] = "No Character Style" ;
+};
+String STR_FOOTER
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Fußzeile : Fu˜zeile */
+ Text [ en-US ] = "Footer" ;
+};
+String STR_NO_FOOTER
+{
+ /* ### ACHTUNG: Neuer Text in Resource? keine Fußzeile : keine Fu˜zeile */
+ Text [ en-US ] = "No footer" ;
+};
+String STR_HEADER
+{
+ Text [ en-US ] = "Header" ;
+};
+String STR_NO_HEADER
+{
+ Text [ en-US ] = "No header" ;
+};
+String STR_SURROUND_IDEAL
+{
+ Text [ en-US ] = "Optimal wrap" ;
+};
+String STR_SURROUND_NONE
+{
+ Text [ en-US ] = "No wrap" ;
+};
+String STR_SURROUND_THROUGHT
+{
+ Text [ en-US ] = "Through" ;
+};
+String STR_SURROUND_PARALLEL
+{
+ Text [ en-US ] = "Parallel wrap" ;
+};
+String STR_SURROUND_COLUMN
+{
+ Text [ en-US ] = "Column Wrap" ;
+};
+String STR_SURROUND_LEFT
+{
+ Text [ en-US ] = "Left wrap" ;
+};
+String STR_SURROUND_RIGHT
+{
+ Text [ en-US ] = "Right wrap" ;
+};
+String STR_SURROUND_INSIDE
+{
+ Text [ en-US ] = "Inner wrap" ;
+};
+String STR_SURROUND_OUTSIDE
+{
+ /* ### ACHTUNG: Neuer Text in Resource? Umlauf außen : Umlauf au˜en */
+ Text [ en-US ] = "Outer wrap" ;
+};
+String STR_SURROUND_ANCHORONLY
+{
+ Text [ en-US ] = "(Anchor only)" ;
+};
+String STR_FRM_WIDTH
+{
+ Text [ en-US ] = "Width:" ;
+};
+String STR_FRM_FIXEDHEIGHT
+{
+ /* ### ACHTUNG: Neuer Text in Resource? feste Höhe: : feste H÷he: */
+ Text [ en-US ] = "Fixed height:" ;
+};
+String STR_FRM_MINHEIGHT
+{
+ /* ### ACHTUNG: Neuer Text in Resource? min. Höhe: : min. H÷he: */
+ Text [ en-US ] = "Min. height:" ;
+};
+String STR_FLY_AT_PARA
+{
+ Text [ en-US ] = "to paragraph" ;
+};
+String STR_FLY_AS_CHAR
+{
+ Text [ en-US ] = "to character" ;
+};
+String STR_FLY_AT_PAGE
+{
+ Text [ en-US ] = "to page" ;
+};
+String STR_POS_X
+{
+ Text [ en-US ] = "X Coordinate:" ;
+};
+String STR_POS_Y
+{
+ Text [ en-US ] = "Y Coordinate:" ;
+};
+String STR_VERT_TOP
+{
+ Text [ en-US ] = "at top" ;
+};
+String STR_VERT_CENTER
+{
+ Text [ en-US ] = "Centered vertically" ;
+};
+String STR_VERT_BOTTOM
+{
+ Text [ en-US ] = "at bottom" ;
+};
+String STR_LINE_TOP
+{
+ Text [ en-US ] = "Top of line" ;
+};
+String STR_LINE_CENTER
+{
+ Text [ en-US ] = "Line centered" ;
+};
+String STR_LINE_BOTTOM
+{
+ Text [ en-US ] = "Bottom of line" ;
+};
+String STR_REGISTER_ON
+{
+ Text [ en-US ] = "Register-true" ;
+};
+String STR_REGISTER_OFF
+{
+ Text [ en-US ] = "Not register-true" ;
+};
+String STR_HORI_RIGHT
+{
+ Text [ en-US ] = "at the right" ;
+};
+String STR_HORI_CENTER
+{
+ Text [ en-US ] = "Centered horizontally" ;
+};
+String STR_HORI_LEFT
+{
+ Text [ en-US ] = "at the left" ;
+};
+String STR_HORI_INSIDE
+{
+ Text [ en-US ] = "inside" ;
+};
+String STR_HORI_OUTSIDE
+{
+ /* ### ACHTUNG: Neuer Text in Resource? außen : au˜en */
+ Text [ en-US ] = "outside" ;
+};
+String STR_HORI_FULL
+{
+ Text [ en-US ] = "Full width" ;
+};
+String STR_COLUMNS
+{
+ Text [ en-US ] = "Columns" ;
+};
+String STR_LINE_WIDTH
+{
+ Text [ en-US ] = "Separator Width:" ;
+};
+String STR_MAX_FTN_HEIGHT
+{
+ /* ### ACHTUNG: Neuer Text in Resource? max. Fußnotenbereich: : max. Fu˜notenbereich: */
+ Text [ en-US ] = "Max. footnote area:" ;
+};
+String STR_EDIT_IN_READONLY
+{
+ /* ### ACHTUNG: Neuer Text in Resource? editierbar im schreibgeschütztem Dokument : editierbar im Schreibeschütztem Dokument */
+ /* ### ACHTUNG: Neuer Text in Resource? editierbar im schreibgeschütztem Dokument : editierbar im Schreibeschütztem Dokument */
+ /* ### ACHTUNG: Neuer Text in Resource? editierbar im schreibgeschütztem Dokument : editierbar im Schreibeschütztem Dokument */
+ /* ### ACHTUNG: Neuer Text in Resource? editierbar im schreibgeschütztem Dokument : editierbar im Schreibeschütztem Dokument */
+ /* ### ACHTUNG: Neuer Text in Resource? editierbar im schreibgeschütztem Dokument : editierbar im Schreibeschütztem Dokument */
+ /* ### ACHTUNG: Neuer Text in Resource? editierbar im schreibgeschütztem Dokument : editierbar im schreibgesch³tztem Dokument */
+ Text [ en-US ] = "Editable in read-only document" ;
+};
+String STR_LAYOUT_SPLIT
+{
+ Text [ en-US ] = "Split" ;
+};
+String STR_NUMRULE_ON
+{
+ Text [ en-US ] = "Numbering" ;
+};
+String STR_NUMRULE_OFF
+{
+ Text [ en-US ] = "no numbering" ;
+};
+String STR_CONNECT1
+{
+ Text [ en-US ] = "linked to " ;
+};
+String STR_CONNECT2
+{
+ Text [ en-US ] = "and " ;
+};
+String STR_LINECOUNT
+{
+ Text [ en-US ] = "Count lines" ;
+};
+String STR_DONTLINECOUNT
+{
+ Text [ en-US ] = "don't count lines" ;
+};
+String STR_LINCOUNT_START
+{
+ Text [ en-US ] = "restart line count with: " ;
+};
+
+String STR_LUMINANCE
+{
+ Text [ en-US ] = "Brightness: ";
+};
+
+String STR_CHANNELR
+{
+ Text [ en-US ] = "Red: ";
+};
+
+String STR_CHANNELG
+{
+ Text [ en-US ] = "Green: ";
+};
+
+String STR_CHANNELB
+{
+ Text [ en-US ] = "Blue: ";
+};
+
+String STR_CONTRAST
+{
+ Text [ en-US ] = "Contrast: ";
+};
+
+String STR_GAMMA
+{
+ Text [ en-US ] = "Gamma: ";
+};
+
+String STR_TRANSPARENCY
+{
+ Text [ en-US ] = "Transparency: ";
+};
+
+String STR_INVERT
+{
+ Text [ en-US ] = "Invert";
+};
+String STR_INVERT_NOT
+{
+ Text [ en-US ] = "do not invert";
+};
+
+String STR_DRAWMODE
+{
+ Text [ en-US ] = "Graphics mode: ";
+};
+
+String STR_DRAWMODE_STD
+{
+ Text [ en-US ] = "Standard";
+};
+String STR_DRAWMODE_GREY
+{
+ Text [ en-US ] = "Grayscales";
+};
+String STR_DRAWMODE_BLACKWHITE
+{
+ Text [ en-US ] = "Black & White";
+};
+String STR_DRAWMODE_WATERMARK
+{
+ Text [ en-US ] = "Watermark";
+};
+String STR_ROTATION
+{
+ Text [ en-US ] = "Rotation";
+};
+
+String STR_GRID_NONE
+{
+ Text [ en-US ] = "No grid";
+};
+
+String STR_GRID_LINES_ONLY
+{
+ Text [ en-US ] = "Grid (lines only)";
+};
+
+String STR_GRID_LINES_CHARS
+{
+ Text [ en-US ] = "Grid (lines and characters)";
+};
+String STR_FOLLOW_TEXT_FLOW
+{
+ Text [ en-US ] = "Follow text flow";
+};
+String STR_DONT_FOLLOW_TEXT_FLOW
+{
+ Text [ en-US ] = "Do not follow text flow";
+};
+String STR_CONNECT_BORDER_ON
+{
+ Text [ en-US ] = "Merge borders";
+};
+String STR_CONNECT_BORDER_OFF
+{
+ Text [ en-US ] = "Do not merge borders";
+};
+
diff --git a/sw/source/ui/utlui/bookctrl.cxx b/sw/source/ui/utlui/bookctrl.cxx
new file mode 100644
index 000000000000..3b2567673020
--- /dev/null
+++ b/sw/source/ui/utlui/bookctrl.cxx
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include "hintids.hxx"
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+#endif
+#include <svl/intitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/dispatch.hxx>
+#ifndef _EVENT_HXX //autogen
+#include <vcl/event.hxx>
+#endif
+#ifndef _STATUS_HXX //autogen
+#include <vcl/status.hxx>
+#endif
+#ifndef _MENU_HXX //autogen
+#include <vcl/menu.hxx>
+#endif
+#include "cmdid.h"
+#include "errhdl.hxx"
+#include "swmodule.hxx"
+#include "wrtsh.hxx"
+#include "IMark.hxx"
+#include "bookctrl.hxx"
+#include <map>
+
+SFX_IMPL_STATUSBAR_CONTROL( SwBookmarkControl, SfxStringItem );
+
+// class BookmarkPopup_Impl --------------------------------------------------
+
+class BookmarkPopup_Impl : public PopupMenu
+{
+public:
+ BookmarkPopup_Impl();
+
+ USHORT GetCurId() const { return nCurId; }
+
+private:
+ USHORT nCurId;
+
+ virtual void Select();
+};
+
+// -----------------------------------------------------------------------
+
+BookmarkPopup_Impl::BookmarkPopup_Impl() :
+ PopupMenu(),
+ nCurId(USHRT_MAX)
+{
+}
+
+// -----------------------------------------------------------------------
+
+void BookmarkPopup_Impl::Select()
+{
+ nCurId = GetCurItemId();
+}
+
+// class SvxZoomStatusBarControl ------------------------------------------
+
+SwBookmarkControl::SwBookmarkControl( USHORT _nSlotId,
+ USHORT _nId,
+ StatusBar& rStb ) :
+ SfxStatusBarControl( _nSlotId, _nId, rStb )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SwBookmarkControl::~SwBookmarkControl()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SwBookmarkControl::StateChanged(
+ USHORT /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
+{
+ if( eState != SFX_ITEM_AVAILABLE || pState->ISA( SfxVoidItem ) )
+ GetStatusBar().SetItemText( GetId(), String() );
+ else if ( pState->ISA( SfxStringItem ) )
+ {
+ sPageNumber = ((SfxStringItem*)pState)->GetValue();
+ GetStatusBar().SetItemText( GetId(), sPageNumber );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SwBookmarkControl::Paint( const UserDrawEvent& )
+{
+ GetStatusBar().SetItemText( GetId(), sPageNumber );
+}
+
+// -----------------------------------------------------------------------
+
+void SwBookmarkControl::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU &&
+ GetStatusBar().GetItemText( GetId() ).Len() )
+ {
+ CaptureMouse();
+ BookmarkPopup_Impl aPop;
+ SwWrtShell* pWrtShell = ::GetActiveWrtShell();
+ if( pWrtShell && pWrtShell->getIDocumentMarkAccess()->getMarksCount() > 0 )
+ {
+ IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess();
+ IDocumentMarkAccess::const_iterator_t ppBookmarkStart = pMarkAccess->getBookmarksBegin();
+ USHORT nPopupId = 1;
+ ::std::map<sal_Int32, USHORT> aBookmarkIdx;
+ for(IDocumentMarkAccess::const_iterator_t ppBookmark = ppBookmarkStart;
+ ppBookmark != pMarkAccess->getBookmarksEnd();
+ ppBookmark++)
+ {
+ if(IDocumentMarkAccess::BOOKMARK == IDocumentMarkAccess::GetType(**ppBookmark))
+ {
+ aPop.InsertItem( nPopupId, ppBookmark->get()->GetName() );
+ aBookmarkIdx[nPopupId] = static_cast<USHORT>(ppBookmark - ppBookmarkStart);
+ nPopupId++;
+ }
+ }
+ aPop.Execute( &GetStatusBar(), rCEvt.GetMousePosPixel());
+ USHORT nCurrId = aPop.GetCurId();
+ if( nCurrId != USHRT_MAX)
+ {
+ SfxUInt16Item aBookmark( FN_STAT_BOOKMARK, aBookmarkIdx[nCurrId] );
+ SfxViewFrame::Current()->GetDispatcher()->Execute( FN_STAT_BOOKMARK,
+ SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD,
+ &aBookmark, 0L );
+ }
+ }
+ ReleaseMouse();
+ }
+}
diff --git a/sw/source/ui/utlui/condedit.cxx b/sw/source/ui/utlui/condedit.cxx
new file mode 100644
index 000000000000..b534b538ca54
--- /dev/null
+++ b/sw/source/ui/utlui/condedit.cxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+// include ---------------------------------------------------------------
+
+
+#include <sot/formats.hxx>
+
+#ifndef _CONDEDIT_HXX
+#include <condedit.hxx>
+#endif
+#include <svx/dbaexchange.hxx>
+using namespace ::svx;
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+#define DB_DD_DELIM 0x0b
+
+// STATIC DATA -----------------------------------------------------------
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+ConditionEdit::ConditionEdit( Window* pParent, const ResId& rResId )
+ : Edit( pParent, rResId ),
+ DropTargetHelper( this ),
+ bBrackets( TRUE ), bEnableDrop( TRUE )
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Drop moeglich, bzw Format bekannt?
+ --------------------------------------------------------------------*/
+
+sal_Int8 ConditionEdit::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
+{
+ return OColumnTransferable::canExtractColumnDescriptor
+ ( GetDataFlavorExVector(),
+ CTF_COLUMN_DESCRIPTOR )
+ ? DND_ACTION_COPY
+ : DND_ACTION_NONE;
+}
+
+sal_Int8 ConditionEdit::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ sal_Int8 nRet = DND_ACTION_NONE;
+ if( bEnableDrop )
+ {
+ String sTxt;
+ TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
+
+ DataFlavorExVector& rVector = aData.GetDataFlavorExVector();
+ if(OColumnTransferable::canExtractColumnDescriptor(rVector, CTF_COLUMN_DESCRIPTOR))
+ {
+ ODataAccessDescriptor aColDesc = OColumnTransferable::extractColumnDescriptor(
+ aData);
+ String sDBName;
+ if (bBrackets)
+ sDBName += '[';
+ OUString sTmp;
+ sTmp = aColDesc.getDataSource();
+ sDBName += String(sTmp);
+ sDBName += '.';
+
+ aColDesc[daCommand] >>= sTmp;
+ sDBName += String(sTmp);
+ sDBName += '.';
+
+ aColDesc[daColumnName] >>= sTmp;
+ sDBName += String(sTmp);
+ if (bBrackets)
+ sDBName += ']';
+
+ SetText( sDBName );
+ nRet = DND_ACTION_COPY;
+ }
+ }
+ return nRet;
+}
+
+
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
new file mode 100644
index 000000000000..e3777e6a8feb
--- /dev/null
+++ b/sw/source/ui/utlui/content.cxx
@@ -0,0 +1,3250 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#endif
+#include <svl/urlbmk.hxx>
+#include <tools/urlobj.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/dispatch.hxx>
+#include <vcl/help.hxx>
+#include <sot/formats.hxx>
+#include <vcl/sound.hxx>
+#include <uiitems.hxx>
+#include <fmtinfmt.hxx>
+#include <txtinet.hxx>
+#include <fmtfld.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <errhdl.hxx>
+#include <docsh.hxx>
+#include <content.hxx>
+#include <frmfmt.hxx>
+#include <fldbas.hxx>
+#include <txtatr.hxx>
+#include <IMark.hxx>
+#include <section.hxx>
+#include <tox.hxx>
+#define NAVIPI_CXX
+#include <navipi.hxx>
+#include <navicont.hxx>
+#include <navicfg.hxx>
+#include <edtwin.hxx>
+#include <doc.hxx>
+#include <unotools.hxx>
+#include <crsskip.hxx>
+#include <cmdid.h>
+#include <helpid.h>
+#include <navipi.hrc>
+#include <utlui.hrc>
+#include <misc.hrc>
+#include <comcore.hrc>
+#include <com/sun/star/text/XTextSectionsSupplier.hpp>
+#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
+#include <com/sun/star/text/XDocumentIndex.hpp>
+#include <com/sun/star/text/XBookmarksSupplier.hpp>
+#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
+#include <com/sun/star/text/XTextFramesSupplier.hpp>
+#include <dcontact.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdview.hxx>
+#include <vcl/scrbar.hxx>
+#include <comcore.hrc>
+#include <SwRewriter.hxx>
+#include <hints.hxx>
+#include <numrule.hxx>
+#include <swundo.hxx>
+#include <ndtxt.hxx>
+#include <PostItMgr.hxx>
+#include <postithelper.hxx>
+#include <redline.hxx>
+#include <docary.hxx>
+
+#include "swabstdlg.hxx"
+#include "globals.hrc"
+#include <unomid.h>
+
+
+#define CTYPE_CNT 0
+#define CTYPE_CTT 1
+
+using namespace ::std;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+
+
+#define NAVI_BOOKMARK_DELIM (sal_Unicode)1
+
+/***************************************************************************
+
+***************************************************************************/
+
+typedef SwContent* SwContentPtr;
+SV_DECL_PTRARR_SORT_DEL( SwContentArr, SwContentPtr, 0,4)
+SV_IMPL_OP_PTRARR_SORT(SwContentArr, SwContentPtr)
+
+sal_Bool SwContentTree::bIsInDrag = sal_False;
+
+
+namespace
+{
+ static sal_Bool lcl_IsContent(SvLBoxEntry* pEntry)
+ {
+ return ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId() == CTYPE_CNT;
+ }
+
+
+ static sal_Bool lcl_IsContentType(SvLBoxEntry* pEntry)
+ {
+ return ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId() == CTYPE_CTT;
+ }
+
+
+ static sal_Bool lcl_FindShell(SwWrtShell* pShell)
+ {
+ sal_Bool bFound = sal_False;
+ SwView *pView = SwModule::GetFirstView();
+ while (pView)
+ {
+ if(pShell == &pView->GetWrtShell())
+ {
+ bFound = sal_True;
+ break;
+ }
+ pView = SwModule::GetNextView(pView);
+ }
+ return bFound;
+ }
+
+ static bool lcl_IsUiVisibleBookmark(const IDocumentMarkAccess::pMark_t& rpMark)
+ {
+ return IDocumentMarkAccess::GetType(*rpMark) == IDocumentMarkAccess::BOOKMARK;
+ }
+}
+
+/***************************************************************************
+ Beschreibung: Inhalt, enthaelt Namen und Verweis auf den Inhalstyp
+***************************************************************************/
+
+
+SwContent::SwContent(const SwContentType* pCnt, const String& rName, long nYPos) :
+ SwTypeNumber(CTYPE_CNT),
+ pParent(pCnt),
+ sContentName(rName),
+ nYPosition(nYPos),
+ bInvisible(sal_False)
+{
+}
+
+
+sal_uInt8 SwTypeNumber::GetTypeId()
+{
+ return nTypeId;
+}
+
+SwTypeNumber::~SwTypeNumber()
+{
+}
+
+sal_Bool SwContent::IsProtect() const
+{
+ return sal_False;
+}
+
+sal_Bool SwPostItContent::IsProtect() const
+{
+ if (mbPostIt)
+ return pFld->IsProtect();
+ else
+ return false;
+}
+
+sal_Bool SwURLFieldContent::IsProtect() const
+{
+ return pINetAttr->IsProtect();
+}
+
+SwGraphicContent::~SwGraphicContent()
+{
+}
+SwTOXBaseContent::~SwTOXBaseContent()
+{
+}
+
+/***************************************************************************
+ Beschreibung: Inhaltstyp, kennt seine Inhalte und die WrtShell
+***************************************************************************/
+
+
+SwContentType::SwContentType(SwWrtShell* pShell, sal_uInt16 nType, sal_uInt8 nLevel) :
+ SwTypeNumber(CTYPE_CTT),
+ pWrtShell(pShell),
+ pMember(0),
+ sContentTypeName(SW_RES(STR_CONTENT_TYPE_FIRST + nType)),
+ sSingleContentTypeName(SW_RES(STR_CONTENT_TYPE_SINGLE_FIRST + nType)),
+ nMemberCount(0),
+ nContentType(nType),
+ nOutlineLevel(nLevel),
+ bMemberFilled(sal_False),
+ bDataValid(sal_False),
+ bEdit(sal_False),
+ bDelete(sal_True)
+{
+ Init();
+}
+
+/***************************************************************************
+ Beschreibung: Initialisierung
+***************************************************************************/
+
+
+void SwContentType::Init(sal_Bool* pbInvalidateWindow)
+{
+ // wenn sich der MemberCount aendert ...
+ sal_uInt16 nOldMemberCount = nMemberCount;
+ nMemberCount = 0;
+ switch(nContentType)
+ {
+ case CONTENT_TYPE_OUTLINE :
+ {
+ sTypeToken = C2S(pMarkToOutline);
+ sal_uInt16 nOutlineCount = nMemberCount =
+ static_cast<sal_uInt16>(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNodesCount());
+ if(nOutlineLevel < MAXLEVEL)
+ {
+ for(sal_uInt16 j = 0; j < nOutlineCount; j++)
+ {
+ if(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineLevel(j) > nOutlineLevel )
+ nMemberCount --;
+ }
+ }
+ bDelete = sal_False;
+ }
+ break;
+
+ case CONTENT_TYPE_TABLE :
+ sTypeToken = C2S(pMarkToTable);
+ nMemberCount = pWrtShell->GetTblFrmFmtCount(sal_True);
+ bEdit = sal_True;
+ break;
+
+ case CONTENT_TYPE_FRAME :
+ case CONTENT_TYPE_GRAPHIC :
+ case CONTENT_TYPE_OLE :
+ {
+ FlyCntType eType = FLYCNTTYPE_FRM;
+ sTypeToken = C2S(pMarkToFrame);
+ if(nContentType == CONTENT_TYPE_OLE)
+ {
+ eType = FLYCNTTYPE_OLE;
+ sTypeToken = C2S(pMarkToOLE);
+ }
+ else if(nContentType == CONTENT_TYPE_GRAPHIC)
+ {
+ eType = FLYCNTTYPE_GRF;
+ sTypeToken = C2S(pMarkToGraphic);
+ }
+ nMemberCount = pWrtShell->GetFlyCount(eType);
+ bEdit = sal_True;
+ }
+ break;
+ case CONTENT_TYPE_BOOKMARK:
+ {
+ IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess();
+ nMemberCount = static_cast<USHORT>(count_if(
+ pMarkAccess->getBookmarksBegin(),
+ pMarkAccess->getBookmarksEnd(),
+ &lcl_IsUiVisibleBookmark));
+ sTypeToken = aEmptyStr;
+ bEdit = sal_True;
+ }
+ break;
+ case CONTENT_TYPE_REGION :
+ {
+ SwContentArr* pOldMember = 0;
+ sal_uInt16 nOldRegionCount = 0;
+ sal_Bool bInvalidate = sal_False;
+ if(!pMember)
+ pMember = new SwContentArr;
+ else if(pMember->Count())
+ {
+ pOldMember = pMember;
+ nOldRegionCount = pOldMember->Count();
+ pMember = new SwContentArr;
+ }
+ const Point aNullPt;
+ nMemberCount = pWrtShell->GetSectionFmtCount();
+ for(sal_uInt16 i = 0; i < nMemberCount; i++)
+ {
+ const SwSectionFmt* pFmt;
+ SectionType eTmpType;
+ if( (pFmt = &pWrtShell->GetSectionFmt(i))->IsInNodesArr() &&
+ (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
+ && TOX_HEADER_SECTION != eTmpType )
+ {
+ const String& rSectionName =
+ pFmt->GetSection()->GetSectionName();
+ BYTE nLevel = 0;
+ SwSectionFmt* pParentFmt = pFmt->GetParent();
+ while(pParentFmt)
+ {
+ nLevel++;
+ pParentFmt = pParentFmt->GetParent();
+ }
+
+ SwContent* pCnt = new SwRegionContent(this, rSectionName,
+ nLevel,
+ pFmt->FindLayoutRect( sal_False, &aNullPt ).Top());
+
+ SwPtrMsgPoolItem aAskItem( RES_CONTENT_VISIBLE, 0 );
+ if( !pFmt->GetInfo( aAskItem ) &&
+ !aAskItem.pObject ) // not visible
+ pCnt->SetInvisible();
+ pMember->Insert(pCnt);//, pMember->Count());
+
+ sal_uInt16 nPos = pMember->Count() - 1;
+ if(nOldRegionCount > nPos &&
+ (pOldMember->GetObject(nPos))->IsInvisible()
+ != pCnt->IsInvisible())
+ bInvalidate = sal_True;
+ }
+ }
+ nMemberCount = pMember->Count();
+ sTypeToken = C2S(pMarkToRegion);
+ bEdit = sal_True;
+ bDelete = sal_False;
+ if(pOldMember)
+ {
+ pOldMember->DeleteAndDestroy(0, pOldMember->Count());
+ delete pOldMember;
+ if(pbInvalidateWindow && bInvalidate)
+ *pbInvalidateWindow = sal_True;
+ }
+ }
+ break;
+ case CONTENT_TYPE_INDEX:
+ {
+ nMemberCount = pWrtShell->GetTOXCount();
+ bEdit = sal_True;
+ bDelete = sal_False;
+ }
+ break;
+ case CONTENT_TYPE_REFERENCE:
+ {
+ nMemberCount = pWrtShell->GetRefMarks( 0 );
+ bDelete = sal_False;
+ }
+ break;
+ case CONTENT_TYPE_URLFIELD:
+ {
+ nMemberCount = 0;
+ if(!pMember)
+ pMember = new SwContentArr;
+ else if(pMember->Count())
+ pMember->DeleteAndDestroy(0, pMember->Count());
+
+ SwGetINetAttrs aArr;
+ nMemberCount = pWrtShell->GetINetAttrs( aArr );
+ for( sal_uInt16 n = 0; n < nMemberCount; ++n )
+ {
+ SwGetINetAttr* p = aArr[ n ];
+ SwURLFieldContent* pCnt = new SwURLFieldContent(
+ this,
+ p->sText,
+ INetURLObject::decode(
+ p->rINetAttr.GetINetFmt().GetValue(),
+ INET_HEX_ESCAPE,
+ INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 ),
+ &p->rINetAttr,
+ n );
+ pMember->Insert( pCnt );//, n );
+ }
+ bEdit = sal_True;
+ nOldMemberCount = nMemberCount;
+ bDelete = sal_False;
+ }
+ break;
+ case CONTENT_TYPE_POSTIT:
+ {
+ nMemberCount = 0;
+ if(!pMember)
+ pMember = new SwContentArr;
+ else if(pMember->Count())
+ pMember->DeleteAndDestroy(0, pMember->Count());
+
+ SwPostItMgr* aMgr = pWrtShell->GetView().GetPostItMgr();
+ if (aMgr)
+ {
+ for(SwPostItMgr::const_iterator i = aMgr->begin(); i != aMgr->end(); ++i)
+ {
+ if ( (*i)->GetBroadCaster()->ISA(SwFmtFld)) // SwPostit
+ {
+ SwFmtFld* aFmtFld = static_cast<SwFmtFld*>((*i)->GetBroadCaster());
+ if (aFmtFld->GetTxtFld() && aFmtFld->IsFldInDoc() &&
+ (*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE )
+ {
+ String sEntry = aFmtFld->GetFld()->GetPar2();
+ RemoveNewline(sEntry);
+ SwPostItContent* pCnt = new SwPostItContent(
+ this,
+ sEntry,
+ (const SwFmtFld*)aFmtFld,
+ nMemberCount);
+ pMember->Insert(pCnt);
+ nMemberCount++;
+ }
+ }
+ /*
+ // this code can be used once we want redline comments in the margin
+ else // redcomment
+ {
+ SwRedline* pRedline = static_cast<SwRedline*>((*i)->GetBroadCaster());
+ if ( pRedline->GetComment() != String(::rtl::OUString::createFromAscii("")) )
+ {
+ String sEntry = pRedline->GetComment();
+ RemoveNewline(sEntry);
+ SwPostItContent* pCnt = new SwPostItContent(
+ this,
+ sEntry, // hier steht der Text
+ pRedline,
+ nMemberCount);
+ pMember->Insert(pCnt);
+ nMemberCount++;
+ }
+ }
+ */
+ }
+ }
+ //
+ sTypeToken = aEmptyStr;
+ bEdit = sal_True;
+ nOldMemberCount = nMemberCount;
+ }
+ break;
+ case CONTENT_TYPE_DRAWOBJECT:
+ {
+ sTypeToken = aEmptyStr;
+ nMemberCount = 0;
+ SdrModel* pModel = pWrtShell->getIDocumentDrawModelAccess()->GetDrawModel();
+ if(pModel)
+ {
+ SdrPage* pPage = pModel->GetPage(0);
+ sal_uInt32 nCount = pPage->GetObjCount();
+ for( sal_uInt32 i=0; i< nCount; i++ )
+ {
+ SdrObject* pTemp = pPage->GetObj(i);
+ // --> OD 2006-03-09 #i51726# - all drawing objects can be named now
+// if(pTemp->ISA(SdrObjGroup) && pTemp->GetName().Len())
+ if ( pTemp->GetName().Len() )
+ // <--
+ nMemberCount++;
+ }
+ }
+ }
+ break;
+ }
+ // ... dann koennen die Daten auch nicht mehr gueltig sein
+ // abgesehen von denen, die schon korrigiert wurden, dann ist
+ // nOldMemberCount doch nicht so old
+ if( nOldMemberCount != nMemberCount )
+ bDataValid = sal_False;
+}
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+
+SwContentType::~SwContentType()
+{
+ delete pMember;
+}
+
+/***************************************************************************
+ Beschreibung: Inhalt liefern, dazu gfs. die Liste fuellen
+***************************************************************************/
+
+
+const SwContent* SwContentType::GetMember(sal_uInt16 nIndex)
+{
+ if(!bDataValid || !pMember)
+ {
+ FillMemberList();
+ }
+ if(nIndex < pMember->Count())
+ return pMember->GetObject(nIndex);
+ else
+ return 0;
+
+}
+
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+
+void SwContentType::Invalidate()
+{
+ bDataValid = sal_False;
+}
+
+/***************************************************************************
+ Beschreibung: Liste der Inhalte fuellen
+***************************************************************************/
+
+
+void SwContentType::FillMemberList(sal_Bool* pbLevelOrVisibiblityChanged)
+{
+ SwContentArr* pOldMember = 0;
+ int nOldMemberCount = -1;
+ SwPtrMsgPoolItem aAskItem( RES_CONTENT_VISIBLE, 0 );
+ if(pMember && pbLevelOrVisibiblityChanged)
+ {
+ pOldMember = pMember;
+ nOldMemberCount = pOldMember->Count();
+ pMember = new SwContentArr;
+ *pbLevelOrVisibiblityChanged = sal_False;
+ }
+ else if(!pMember)
+ pMember = new SwContentArr;
+ else if(pMember->Count())
+ pMember->DeleteAndDestroy(0, pMember->Count());
+ switch(nContentType)
+ {
+ case CONTENT_TYPE_OUTLINE :
+ {
+ sal_uInt16 nOutlineCount = nMemberCount =
+ static_cast<sal_uInt16>(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNodesCount());
+
+ sal_uInt16 nPos = 0;
+ for (sal_uInt16 i = 0; i < nOutlineCount; ++i)
+ {
+ const sal_Int8 nLevel = (sal_Int8)pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineLevel(i);
+ if(nLevel >= nOutlineLevel )
+ nMemberCount--;
+ else
+ {
+ String aEntry(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(i));
+ aEntry.EraseLeadingChars();
+ SwNavigationPI::CleanEntry( aEntry );
+ SwOutlineContent* pCnt = new SwOutlineContent(this, aEntry, i, nLevel,
+ pWrtShell->IsOutlineMovable( i ), nPos );
+ pMember->Insert(pCnt);//, nPos);
+ // bei gleicher Anzahl und vorhandenem pOldMember wird die
+ // alte mit der neuen OutlinePos verglichen
+ // cast fuer Win16
+ if(nOldMemberCount > (int)nPos &&
+ ((SwOutlineContent*)pOldMember->GetObject(nPos))->GetOutlineLevel() != nLevel)
+ *pbLevelOrVisibiblityChanged = sal_True;
+
+ nPos++;
+ }
+ }
+
+ }
+ break;
+
+ case CONTENT_TYPE_TABLE :
+ {
+ DBG_ASSERT(nMemberCount ==
+ pWrtShell->GetTblFrmFmtCount(sal_True),
+ "MemberCount differiert");
+ Point aNullPt;
+ nMemberCount = pWrtShell->GetTblFrmFmtCount(sal_True);
+ for(sal_uInt16 i = 0; i < nMemberCount; i++)
+ {
+ const SwFrmFmt& rTblFmt = pWrtShell->GetTblFrmFmt(i, sal_True);
+ String sTblName( rTblFmt.GetName() );
+
+ SwContent* pCnt = new SwContent(this, sTblName,
+ rTblFmt.FindLayoutRect(sal_False, &aNullPt).Top() );
+ if( !rTblFmt.GetInfo( aAskItem ) &&
+ !aAskItem.pObject ) // not visible
+ pCnt->SetInvisible();
+
+ pMember->Insert(pCnt);//, i);
+
+ if(nOldMemberCount > (int)i &&
+ (pOldMember->GetObject(i))->IsInvisible() != pCnt->IsInvisible())
+ *pbLevelOrVisibiblityChanged = sal_True;
+ }
+ }
+ break;
+ case CONTENT_TYPE_OLE :
+ case CONTENT_TYPE_FRAME :
+ case CONTENT_TYPE_GRAPHIC :
+ {
+ FlyCntType eType = FLYCNTTYPE_FRM;
+ if(nContentType == CONTENT_TYPE_OLE)
+ eType = FLYCNTTYPE_OLE;
+ else if(nContentType == CONTENT_TYPE_GRAPHIC)
+ eType = FLYCNTTYPE_GRF;
+ DBG_ASSERT(nMemberCount == pWrtShell->GetFlyCount(eType),
+ "MemberCount differiert");
+ Point aNullPt;
+ nMemberCount = pWrtShell->GetFlyCount(eType);
+ for(sal_uInt16 i = 0; i < nMemberCount; i++)
+ {
+ const SwFrmFmt* pFrmFmt = pWrtShell->GetFlyNum(i,eType);
+ String sFrmName = pFrmFmt->GetName();
+
+ SwContent* pCnt;
+ if(CONTENT_TYPE_GRAPHIC == nContentType)
+ {
+ String sLink;
+ pWrtShell->GetGrfNms( &sLink, 0, (SwFlyFrmFmt*) pFrmFmt);
+ pCnt = new SwGraphicContent(this, sFrmName,
+ INetURLObject::decode( sLink, INET_HEX_ESCAPE,
+ INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 ),
+ pFrmFmt->FindLayoutRect(sal_False, &aNullPt).Top());
+ }
+ else
+ {
+ pCnt = new SwContent(this, sFrmName,
+ pFrmFmt->FindLayoutRect(sal_False, &aNullPt).Top() );
+ }
+ if( !pFrmFmt->GetInfo( aAskItem ) &&
+ !aAskItem.pObject ) // not visible
+ pCnt->SetInvisible();
+ pMember->Insert(pCnt);//, i);
+ if(nOldMemberCount > (int)i &&
+ (pOldMember->GetObject(i))->IsInvisible() != pCnt->IsInvisible())
+ *pbLevelOrVisibiblityChanged = sal_True;
+ }
+ }
+ break;
+ case CONTENT_TYPE_BOOKMARK:
+ {
+ IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess();
+ for(IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin();
+ ppBookmark != pMarkAccess->getBookmarksEnd();
+ ppBookmark++)
+ {
+ if(lcl_IsUiVisibleBookmark(*ppBookmark))
+ {
+ const String& rBkmName = ppBookmark->get()->GetName();
+ //nYPos von 0 -> text::Bookmarks werden nach Alphabet sortiert
+ SwContent* pCnt = new SwContent(this, rBkmName, 0);
+ pMember->Insert(pCnt);//, pMember->Count());
+ }
+ }
+ }
+ break;
+ case CONTENT_TYPE_REGION :
+ {
+ const Point aNullPt;
+ nMemberCount = pWrtShell->GetSectionFmtCount();
+ for(sal_uInt16 i = 0; i < nMemberCount; i++)
+ {
+ const SwSectionFmt* pFmt;
+ SectionType eTmpType;
+ if( (pFmt = &pWrtShell->GetSectionFmt(i))->IsInNodesArr() &&
+ (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
+ && TOX_HEADER_SECTION != eTmpType )
+ {
+ String sSectionName = pFmt->GetSection()->GetSectionName();
+
+ BYTE nLevel = 0;
+ SwSectionFmt* pParentFmt = pFmt->GetParent();
+ while(pParentFmt)
+ {
+ nLevel++;
+ pParentFmt = pParentFmt->GetParent();
+ }
+
+ SwContent* pCnt = new SwRegionContent(this, sSectionName,
+ nLevel,
+ pFmt->FindLayoutRect( sal_False, &aNullPt ).Top());
+ if( !pFmt->GetInfo( aAskItem ) &&
+ !aAskItem.pObject ) // not visible
+ pCnt->SetInvisible();
+ pMember->Insert(pCnt);//, pMember->Count());
+
+ sal_uInt16 nPos = pMember->Count() - 1;
+ if(nOldMemberCount > nPos &&
+ (pOldMember->GetObject(nPos))->IsInvisible()
+ != pCnt->IsInvisible())
+ *pbLevelOrVisibiblityChanged = sal_True;
+ }
+ }
+ nMemberCount = pMember->Count();
+ }
+ break;
+ case CONTENT_TYPE_REFERENCE:
+ {
+ SvStringsDtor aRefMarks;
+ nMemberCount = pWrtShell->GetRefMarks( &aRefMarks );
+
+ for(sal_uInt16 i=0; i<nMemberCount; i++)
+ {
+ //Referenzen nach Alphabet sortiert
+ SwContent* pCnt = new SwContent(
+ this, *aRefMarks.GetObject(i), 0);
+ pMember->Insert(pCnt);//, i);
+ }
+ }
+ break;
+ case CONTENT_TYPE_URLFIELD:
+ {
+ SwGetINetAttrs aArr;
+ nMemberCount = pWrtShell->GetINetAttrs( aArr );
+ for( sal_uInt16 n = 0; n < nMemberCount; ++n )
+ {
+ SwGetINetAttr* p = aArr[ n ];
+ SwURLFieldContent* pCnt = new SwURLFieldContent(
+ this,
+ p->sText,
+ INetURLObject::decode(
+ p->rINetAttr.GetINetFmt().GetValue(),
+ INET_HEX_ESCAPE,
+ INetURLObject::DECODE_UNAMBIGUOUS,
+ RTL_TEXTENCODING_UTF8 ),
+ &p->rINetAttr,
+ n );
+ pMember->Insert( pCnt );//, n );
+ }
+ }
+ break;
+ case CONTENT_TYPE_INDEX:
+ {
+
+ sal_uInt16 nCount = nMemberCount = pWrtShell->GetTOXCount();
+ for ( sal_uInt16 nTox = 0; nTox < nCount; nTox++ )
+ {
+ const SwTOXBase* pBase = pWrtShell->GetTOX( nTox );
+ String sTOXNm( pBase->GetTOXName() );
+
+ SwContent* pCnt = new SwTOXBaseContent(
+ this, sTOXNm, nTox, *pBase);
+
+ if( !pBase->GetInfo( aAskItem ) &&
+ !aAskItem.pObject ) // not visible
+ pCnt->SetInvisible();
+
+ pMember->Insert( pCnt );//, nTox );
+ sal_uInt16 nPos = pMember->Count() - 1;
+ if(nOldMemberCount > nPos &&
+ (pOldMember->GetObject(nPos))->IsInvisible()
+ != pCnt->IsInvisible())
+ *pbLevelOrVisibiblityChanged = sal_True;
+ }
+ }
+ break;
+ case CONTENT_TYPE_POSTIT:
+ {
+ nMemberCount = 0;
+ if(!pMember)
+ pMember = new SwContentArr;
+ else if(pMember->Count())
+ pMember->DeleteAndDestroy(0, pMember->Count());
+ SwPostItMgr* aMgr = pWrtShell->GetView().GetPostItMgr();
+ if (aMgr)
+ {
+ for(SwPostItMgr::const_iterator i = aMgr->begin(); i != aMgr->end(); ++i)
+ {
+ if ( (*i)->GetBroadCaster()->ISA(SwFmtFld)) // SwPostit
+ {
+ SwFmtFld* aFmtFld = static_cast<SwFmtFld*>((*i)->GetBroadCaster());
+ if (aFmtFld->GetTxtFld() && aFmtFld->IsFldInDoc() &&
+ (*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE )
+ {
+ String sEntry = aFmtFld->GetFld()->GetPar2();
+ RemoveNewline(sEntry);
+ SwPostItContent* pCnt = new SwPostItContent(
+ this,
+ sEntry,
+ (const SwFmtFld*)aFmtFld,
+ nMemberCount);
+ pMember->Insert(pCnt);
+ nMemberCount++;
+ }
+ }
+ /* this code can be used once we want redline comments in the margin
+ else // redcomment
+ {
+ SwRedline* pRedline = static_cast<SwRedline*>((*i)->GetBroadCaster());
+ if ( pRedline->GetComment() != String(::rtl::OUString::createFromAscii("")) )
+ {
+ String sEntry = pRedline->GetComment();
+ RemoveNewline(sEntry);
+ SwPostItContent* pCnt = new SwPostItContent(
+ this,
+ sEntry,
+ pRedline,
+ nMemberCount);
+ pMember->Insert(pCnt);
+ nMemberCount++;
+ }
+ }
+ */
+ }
+ }
+ //
+ }
+ break;
+ case CONTENT_TYPE_DRAWOBJECT:
+ {
+ nMemberCount = 0;
+ if(!pMember)
+ pMember = new SwContentArr;
+ else if(pMember->Count())
+ pMember->DeleteAndDestroy(0, pMember->Count());
+
+ IDocumentDrawModelAccess* pIDDMA = pWrtShell->getIDocumentDrawModelAccess();
+ SdrModel* pModel = pIDDMA->GetDrawModel();
+ if(pModel)
+ {
+ SdrPage* pPage = pModel->GetPage(0);
+ sal_uInt32 nCount = pPage->GetObjCount();
+ for( sal_uInt32 i=0; i< nCount; i++ )
+ {
+ SdrObject* pTemp = pPage->GetObj(i);
+ // --> OD 2006-03-09 #i51726# - all drawing objects can be named now
+// if(pTemp->ISA(SdrObjGroup) && pTemp->GetName().Len())
+ if ( pTemp->GetName().Len() )
+ // <--
+ {
+ SwContact* pContact = (SwContact*)pTemp->GetUserCall();
+ long nYPos = 0;
+ const Point aNullPt;
+ if(pContact && pContact->GetFmt())
+ nYPos = pContact->GetFmt()->FindLayoutRect(sal_False, &aNullPt).Top();
+ SwContent* pCnt = new SwContent(
+ this,
+ pTemp->GetName(),
+ nYPos);
+ if(!pIDDMA->IsVisibleLayerId(pTemp->GetLayer()))
+ pCnt->SetInvisible();
+ pMember->Insert(pCnt);
+ nMemberCount++;
+ if(nOldMemberCount > (int)i &&
+ (pOldMember->GetObject((USHORT)i))->IsInvisible() != pCnt->IsInvisible())
+ *pbLevelOrVisibiblityChanged = sal_True;
+ }
+ }
+ }
+ }
+ break;
+ }
+ bDataValid = sal_True;
+ if(pOldMember)
+ pOldMember->DeleteAndDestroy(0, pOldMember->Count());
+
+}
+
+/***************************************************************************
+ Beschreibung: TreeListBox fuer Inhaltsanzeige
+***************************************************************************/
+
+
+SwContentTree::SwContentTree(Window* pParent, const ResId& rResId) :
+ SvTreeListBox( pParent, rResId ),
+
+ sSpace(C2S(" ")),
+
+ sRemoveIdx(SW_RES(ST_REMOVE_INDEX)),
+ sUpdateIdx(SW_RES(ST_UPDATE)),
+ sUnprotTbl(SW_RES(ST_REMOVE_TBL_PROTECTION)),
+ sRename(SW_RES(ST_RENAME)),
+ sReadonlyIdx(SW_RES(ST_READONLY_IDX)),
+ sInvisible(SW_RES(ST_INVISIBLE)),
+
+ sPostItShow(SW_RES(ST_POSTIT_SHOW)),
+ sPostItHide(SW_RES(ST_POSTIT_HIDE)),
+ sPostItDelete(SW_RES(ST_POSTIT_DELETE)),
+
+ pHiddenShell(0),
+ pActiveShell(0),
+ pConfig(SW_MOD()->GetNavigationConfig()),
+
+ nActiveBlock(0),
+ nHiddenBlock(0),
+
+ nRootType(USHRT_MAX),
+ nLastSelType(USHRT_MAX),
+ nOutlineLevel(MAXLEVEL),
+
+ bIsActive(sal_True),
+ bIsConstant(sal_False),
+ bIsHidden(sal_False),
+ bDocChgdInDragging(sal_False),
+ bIsInternalDrag(sal_False),
+ bIsRoot(sal_False),
+ bIsIdleClear(sal_False),
+ bIsLastReadOnly(sal_False),
+ bIsOutlineMoveable(sal_True),
+ bViewHasChanged(sal_False),
+ bIsImageListInitialized(sal_False)
+{
+ sal_uInt16 i;
+
+ SetHelpId(HID_NAVIGATOR_TREELIST);
+
+ SetNodeDefaultImages();
+ SetDoubleClickHdl(LINK(this, SwContentTree, ContentDoubleClickHdl));
+ SetDragDropMode(SV_DRAGDROP_APP_COPY);
+ for( i = 0; i < CONTENT_TYPE_MAX; i++)
+ {
+ aActiveContentArr[i] = 0;
+ aHiddenContentArr[i] = 0;
+ }
+ for( i = 0; i < CONTEXT_COUNT; i++ )
+ {
+ aContextStrings[i] = SW_RESSTR(i+ST_CONTEXT_FIRST);
+ }
+ nActiveBlock = pConfig->GetActiveBlock();
+ aUpdTimer.SetTimeoutHdl(LINK(this, SwContentTree, TimerUpdate));
+ aUpdTimer.SetTimeout(1000);
+ Clear();
+ EnableContextMenuHandling();
+ SetStyle( GetStyle() | WB_QUICK_SEARCH );
+}
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+
+SwContentTree::~SwContentTree()
+{
+ Clear(); // vorher gfs. Inhaltstypen loeschen
+ bIsInDrag = sal_False;
+}
+
+/***************************************************************************
+ Drag&Drop methods
+***************************************************************************/
+
+void SwContentTree::StartDrag( sal_Int8 nAction, const Point& rPosPixel )
+{
+ if( !bIsRoot || nRootType != CONTENT_TYPE_OUTLINE )
+ {
+ ReleaseMouse();
+
+ TransferDataContainer* pContainer = new TransferDataContainer;
+ uno::Reference<
+ datatransfer::XTransferable > xRef( pContainer );
+
+ sal_Int8 nDragMode = DND_ACTION_COPYMOVE | DND_ACTION_LINK;
+ if( FillTransferData( *pContainer, nDragMode ))
+ {
+ SwContentTree::SetInDrag(sal_True);
+ pContainer->StartDrag( this, nDragMode, GetDragFinishedHdl() );
+ }
+ }
+ else
+ SvTreeListBox::StartDrag( nAction, rPosPixel );
+}
+
+void SwContentTree::DragFinished( sal_Int8 nAction )
+{
+ //to prevent the removing of the selected entry in external drag and drop
+ // the drag action mustn't be MOVE
+ SvTreeListBox::DragFinished( bIsInternalDrag ? nAction : DND_ACTION_COPY );
+ SwContentTree::SetInDrag(sal_False);
+ bIsInternalDrag = sal_False;
+}
+
+/***************************************************************************
+ Beschreibung: QueryDrop wird im Navigator ausgefuehrt
+***************************************************************************/
+sal_Int8 SwContentTree::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ sal_Int8 nRet = DND_ACTION_NONE;
+ if( bIsRoot )
+ {
+ if( bIsOutlineMoveable )
+ nRet = SvTreeListBox::AcceptDrop( rEvt );
+ }
+ else if( !bIsInDrag )
+ nRet = GetParentWindow()->AcceptDrop( rEvt );
+ return nRet;
+}
+
+/***************************************************************************
+ Beschreibung: Drop wird im Navigator ausgefuehrt
+***************************************************************************/
+sal_Int8 SwContentTree::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ if( bIsRoot )
+ return SvTreeListBox::ExecuteDrop( rEvt );
+ return bIsInDrag ? DND_ACTION_NONE : GetParentWindow()->ExecuteDrop(rEvt);
+}
+
+
+/***************************************************************************
+ Beschreibung: Handler fuer Dragging und ContextMenu
+***************************************************************************/
+PopupMenu* SwContentTree::CreateContextMenu( void )
+{
+ PopupMenu* pPop = new PopupMenu;
+ PopupMenu* pSubPop1 = new PopupMenu;
+ PopupMenu* pSubPop2 = new PopupMenu;
+ PopupMenu* pSubPop3 = new PopupMenu;
+ PopupMenu* pSubPop4 = new PopupMenu; // Edit
+
+ sal_uInt16 i;
+ for(i = 1; i <= MAXLEVEL; i++ )
+ {
+ pSubPop1->InsertItem( i + 100, String::CreateFromInt32(i));
+ }
+ pSubPop1->CheckItem(100 + nOutlineLevel);
+ for(i=0; i < 3; i++ )
+ {
+ pSubPop2->InsertItem( i + 201, aContextStrings[
+ ST_HYPERLINK - ST_CONTEXT_FIRST + i]);
+ }
+ pSubPop2->CheckItem( 201 +
+ GetParentWindow()->GetRegionDropMode());
+ //Liste der offenen Dateien einfuegen
+ sal_uInt16 nId = 301;
+ const SwView* pActiveView = ::GetActiveView();
+ SwView *pView = SwModule::GetFirstView();
+ while (pView)
+ {
+ String sInsert = pView->GetDocShell()->GetTitle();
+ if(pView == pActiveView)
+ {
+ sInsert += '(';
+ sInsert += aContextStrings[ ST_ACTIVE - ST_CONTEXT_FIRST];
+ sInsert += ')';
+ }
+ pSubPop3->InsertItem(nId, sInsert);
+ if(bIsConstant && pActiveShell == &pView->GetWrtShell())
+ pSubPop3->CheckItem(nId);
+ pView = SwModule::GetNextView(pView);
+ nId++;
+ }
+ pSubPop3->InsertItem(nId++, aContextStrings[ST_ACTIVE_VIEW - ST_CONTEXT_FIRST]);
+ if(pHiddenShell)
+ {
+ String sHiddenEntry = pHiddenShell->GetView().GetDocShell()->GetTitle();
+ sHiddenEntry += C2S(" ( ");
+ sHiddenEntry += aContextStrings[ ST_HIDDEN - ST_CONTEXT_FIRST];
+ sHiddenEntry += C2S(" )");
+ pSubPop3->InsertItem(nId, sHiddenEntry);
+ }
+
+ if(bIsActive)
+ pSubPop3->CheckItem( --nId );
+ else if(bIsHidden)
+ pSubPop3->CheckItem( nId );
+
+ pPop->InsertItem( 1, aContextStrings[ST_OUTLINE_LEVEL - ST_CONTEXT_FIRST]);
+ pPop->InsertItem(2, aContextStrings[ST_DRAGMODE - ST_CONTEXT_FIRST]);
+ pPop->InsertItem(3, aContextStrings[ST_DISPLAY - ST_CONTEXT_FIRST]);
+ //jetzt noch bearbeiten
+ SvLBoxEntry* pEntry = 0;
+ //Bearbeiten nur, wenn die angezeigten Inhalte aus der aktiven View kommen
+ if((bIsActive || pActiveShell == pActiveView->GetWrtShellPtr())
+ && 0 != (pEntry = FirstSelected()) && lcl_IsContent(pEntry))
+ {
+ const SwContentType* pContType = ((SwContent*)pEntry->GetUserData())->GetParent();
+ const sal_uInt16 nContentType = pContType->GetType();
+ sal_Bool bReadonly = pActiveShell->GetView().GetDocShell()->IsReadOnly();
+ sal_Bool bVisible = !((SwContent*)pEntry->GetUserData())->IsInvisible();
+ sal_Bool bProtected = ((SwContent*)pEntry->GetUserData())->IsProtect();
+ sal_Bool bEditable = pContType->IsEditable() &&
+ ((bVisible && !bProtected) ||CONTENT_TYPE_REGION == nContentType);
+ sal_Bool bDeletable = pContType->IsDeletable() &&
+ ((bVisible && !bProtected) ||CONTENT_TYPE_REGION == nContentType);
+ sal_Bool bRenamable = bEditable && !bReadonly &&
+ (CONTENT_TYPE_TABLE == nContentType ||
+ CONTENT_TYPE_FRAME == nContentType ||
+ CONTENT_TYPE_GRAPHIC == nContentType ||
+ CONTENT_TYPE_OLE == nContentType ||
+ CONTENT_TYPE_BOOKMARK == nContentType ||
+ CONTENT_TYPE_REGION == nContentType||
+ CONTENT_TYPE_INDEX == nContentType);
+
+ if(!bReadonly && (bEditable || bDeletable))
+ {
+ sal_Bool bSubPop4 = sal_False;
+ if(CONTENT_TYPE_INDEX == nContentType)
+ {
+ bSubPop4 = sal_True;
+ pSubPop4->InsertItem(401, sRemoveIdx);
+ pSubPop4->InsertItem(402, sUpdateIdx);
+
+ const SwTOXBase* pBase = ((SwTOXBaseContent*)pEntry->GetUserData())->GetTOXBase();
+ if(!pBase->IsTOXBaseInReadonly())
+ pSubPop4->InsertItem(403, aContextStrings[ST_EDIT_ENTRY - ST_CONTEXT_FIRST]);
+ pSubPop4->InsertItem(405, sReadonlyIdx);
+
+ pSubPop4->CheckItem( 405, pActiveShell->IsTOXBaseReadonly(*pBase));
+ pSubPop4->InsertItem(501, aContextStrings[ST_DELETE_ENTRY - ST_CONTEXT_FIRST]);
+ }
+ else if(CONTENT_TYPE_TABLE == nContentType && !bReadonly)
+ {
+ bSubPop4 = sal_True;
+ pSubPop4->InsertItem(403, aContextStrings[ST_EDIT_ENTRY - ST_CONTEXT_FIRST]);
+ pSubPop4->InsertItem(404, sUnprotTbl);
+ sal_Bool bFull = sal_False;
+ String sTblName = ((SwContent*)pEntry->GetUserData())->GetName();
+ sal_Bool bProt =pActiveShell->HasTblAnyProtection( &sTblName, &bFull );
+ pSubPop4->EnableItem(403, !bFull );
+ pSubPop4->EnableItem(404, bProt );
+ pSubPop4->InsertItem(501, aContextStrings[ST_DELETE_ENTRY - ST_CONTEXT_FIRST]);
+ }
+ else if(bEditable || bDeletable)
+ {
+
+ if(bEditable && bDeletable)
+ {
+ pSubPop4->InsertItem(403, aContextStrings[ST_EDIT_ENTRY - ST_CONTEXT_FIRST]);
+ pSubPop4->InsertItem(501, aContextStrings[ST_DELETE_ENTRY - ST_CONTEXT_FIRST]);
+ bSubPop4 = sal_True;
+ }
+ else if(bEditable)
+ pPop->InsertItem(403, aContextStrings[ST_EDIT_ENTRY - ST_CONTEXT_FIRST]);
+ else if(bDeletable)
+ {
+ pSubPop4->InsertItem(501, aContextStrings[ST_DELETE_ENTRY - ST_CONTEXT_FIRST]);
+ }
+ }
+ //Rename object
+ if(bRenamable)
+ {
+ if(bSubPop4)
+ pSubPop4->InsertItem(502, sRename);
+ else
+ pPop->InsertItem(502, sRename);
+ }
+
+ if(bSubPop4)
+ {
+ pPop->InsertItem(4, pContType->GetSingleName());
+ pPop->SetPopupMenu(4, pSubPop4);
+ }
+ }
+ }
+ else if( pEntry )
+ {
+ SwContentType* pType = (SwContentType*)pEntry->GetUserData();
+ if ( (pType->GetType() == CONTENT_TYPE_POSTIT) && (!pActiveShell->GetView().GetDocShell()->IsReadOnly()) && ( pType->GetMemberCount() > 0) )
+ {
+ pSubPop4->InsertItem(600, sPostItShow );
+ pSubPop4->InsertItem(601, sPostItHide );
+ pSubPop4->InsertItem(602, sPostItDelete );
+ /*
+ pSubPop4->InsertItem(603,rtl::OUString::createFromAscii("Sort"));
+ PopupMenu* pMenuSort = new PopupMenu;
+ pMenuSort->InsertItem(604,rtl::OUString::createFromAscii("By Position"));
+ pMenuSort->InsertItem(605,rtl::OUString::createFromAscii("By Author"));
+ pMenuSort->InsertItem(606,rtl::OUString::createFromAscii("By Date"));
+ pSubPop4->SetPopupMenu(603, pMenuSort);
+ */
+ pPop->InsertItem(4, pType->GetSingleName());
+ pPop->SetPopupMenu(4, pSubPop4);
+ }
+ }
+
+ pPop->SetPopupMenu( 1, pSubPop1 );
+ pPop->SetPopupMenu( 2, pSubPop2 );
+ pPop->SetPopupMenu( 3, pSubPop3 );
+ return pPop;
+
+}
+/***************************************************************************
+ Beschreibung: Einrueckung fuer outlines (und sections)
+***************************************************************************/
+
+
+long SwContentTree::GetTabPos( SvLBoxEntry* pEntry, SvLBoxTab* pTab)
+{
+ sal_uInt16 nLevel = 0;
+ if(lcl_IsContent(pEntry))
+ {
+ nLevel++;
+ SwContent* pCnt = (SwContent *) pEntry->GetUserData();
+ const SwContentType* pParent;
+ if(pCnt && 0 != (pParent = pCnt->GetParent()))
+ {
+ if(pParent->GetType() == CONTENT_TYPE_OUTLINE)
+ nLevel = nLevel + ((SwOutlineContent*)pCnt)->GetOutlineLevel();
+ else if(pParent->GetType() == CONTENT_TYPE_REGION)
+ nLevel = nLevel + ((SwRegionContent*)pCnt)->GetRegionLevel();
+ }
+ }
+ sal_uInt16 nBasis = bIsRoot ? 0 : 5;
+ return nLevel * 10 + nBasis + pTab->GetPos(); //empirisch ermittelt
+}
+
+/***************************************************************************
+ Beschreibung: Inhalte werden erst auf Anforderung in die Box eingefuegt
+***************************************************************************/
+
+
+void SwContentTree::RequestingChilds( SvLBoxEntry* pParent )
+{
+ // ist es ein Inhaltstyp?
+ if(lcl_IsContentType(pParent))
+ {
+ if(!pParent->HasChilds())
+ {
+ DBG_ASSERT(pParent->GetUserData(), "keine UserData?");
+ SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
+
+ sal_uInt16 nCount = pCntType->GetMemberCount();
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ {
+ const SwContent* pCnt = pCntType->GetMember(i);
+ if(pCnt)
+ {
+ String sEntry = pCnt->GetName();
+ if(!sEntry.Len())
+ sEntry = sSpace;
+ InsertEntry(sEntry, pParent,
+ sal_False, LIST_APPEND, (void*)pCnt);
+ }
+
+ }
+ }
+ }
+}
+/***************************************************************************
+ Beschreibung: Expand - Zustand fuer Inhaltstypen merken
+***************************************************************************/
+
+
+sal_Bool SwContentTree::Expand( SvLBoxEntry* pParent )
+{
+ if(!bIsRoot)
+ {
+ if(lcl_IsContentType(pParent))
+ {
+ SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
+ sal_uInt16 nOr = 1 << pCntType->GetType(); //linear -> Bitposition
+ if(bIsActive || bIsConstant)
+ {
+ nActiveBlock |= nOr;
+ pConfig->SetActiveBlock(nActiveBlock);
+ }
+ else
+ nHiddenBlock |= nOr;
+ }
+ }
+ return SvTreeListBox::Expand(pParent);
+}
+/***************************************************************************
+ Beschreibung: Collapse - Zustand fuer Inhaltstypen merken
+***************************************************************************/
+
+
+sal_Bool SwContentTree::Collapse( SvLBoxEntry* pParent )
+{
+ sal_Bool bRet;
+ if(!bIsRoot)
+ {
+ if(lcl_IsContentType(pParent))
+ {
+ SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
+ sal_uInt16 nAnd = 1 << pCntType->GetType();
+ nAnd = ~nAnd;
+ if(bIsActive || bIsConstant)
+ {
+ nActiveBlock &= nAnd;
+ pConfig->SetActiveBlock(nActiveBlock);
+ }
+ else
+ nHiddenBlock &= nAnd;
+ }
+ bRet = SvTreeListBox::Collapse(pParent);
+ }
+ else
+ bRet = sal_False;
+ return bRet;
+}
+
+
+/***************************************************************************
+ Beschreibung: Auch auf Doppelclick wird zunaechst nur aufgeklappt
+***************************************************************************/
+
+
+IMPL_LINK( SwContentTree, ContentDoubleClickHdl, SwContentTree *, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = GetCurEntry();
+ // ist es ein Inhaltstyp?
+ DBG_ASSERT(pEntry, "kein aktueller Eintrag!");
+ if(pEntry)
+ {
+ if(lcl_IsContentType(pEntry))
+ RequestingChilds(pEntry);
+ else if(bIsActive || bIsConstant)
+ {
+ if(bIsConstant)
+ {
+ pActiveShell->GetView().GetViewFrame()->GetWindow().ToTop();
+ }
+ //Inhaltstyp anspringen:
+ SwContent* pCnt = (SwContent*)pEntry->GetUserData();
+ DBG_ASSERT( pCnt, "keine UserData");
+ GotoContent(pCnt);
+ if(pCnt->GetParent()->GetType() == CONTENT_TYPE_FRAME)
+ pActiveShell->EnterStdMode();
+ }
+ }
+ return 0;
+}
+
+/***************************************************************************
+ Beschreibung: Anzeigen der Datei
+***************************************************************************/
+
+
+void SwContentTree::Display( sal_Bool bActive )
+{
+ if(!bIsImageListInitialized)
+ {
+ USHORT nResId = GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP;
+ aEntryImages = ImageList(SW_RES(nResId));
+ bIsImageListInitialized = sal_True;
+ }
+ // erst den selektierten Eintrag auslesen, um ihn spaeter evtl. wieder
+ // zu selektieren -> die UserDaten sind hier nicht mehr gueltig!
+ SvLBoxEntry* pOldSelEntry = FirstSelected();
+ String sEntryName; // Name des Eintrags
+ sal_uInt16 nEntryRelPos = 0; // rel. Pos zu seinem Parent
+ sal_uInt32 nOldEntryCount = GetEntryCount();
+ sal_Int32 nOldScrollPos = 0;
+ if(pOldSelEntry)
+ {
+ ScrollBar* pVScroll = GetVScroll();
+ if(pVScroll && pVScroll->IsVisible())
+ nOldScrollPos = pVScroll->GetThumbPos();
+
+ sEntryName = GetEntryText(pOldSelEntry);
+ if(GetParent(pOldSelEntry))
+ {
+ nEntryRelPos = (sal_uInt16)(GetModel()->GetAbsPos(pOldSelEntry) - GetModel()->GetAbsPos(GetParent(pOldSelEntry)));
+ }
+ }
+ Clear();
+ SetUpdateMode( sal_False );
+ if(bActive && !bIsConstant && !bIsActive)
+ bIsActive = bActive;
+ bIsHidden = !bActive;
+ SwWrtShell* pShell = GetWrtShell();
+ sal_Bool bReadOnly = pShell ? pShell->GetView().GetDocShell()->IsReadOnly() : sal_True;
+ if(bReadOnly != bIsLastReadOnly)
+ {
+ bIsLastReadOnly = bReadOnly;
+ sal_Bool bDisable = pShell == 0 || bReadOnly;
+ SwNavigationPI* pNavi = GetParentWindow();
+ pNavi->aContentToolBox.EnableItem(FN_ITEM_UP , !bDisable);
+ pNavi->aContentToolBox.EnableItem(FN_ITEM_DOWN, !bDisable);
+ pNavi->aContentToolBox.EnableItem(FN_ITEM_LEFT, !bDisable);
+ pNavi->aContentToolBox.EnableItem(FN_ITEM_RIGHT, !bDisable);
+ pNavi->aContentToolBox.EnableItem(FN_SELECT_SET_AUTO_BOOKMARK, !bDisable);
+ }
+ if(pShell)
+ {
+ SvLBoxEntry* pSelEntry = 0;
+ if(nRootType == USHRT_MAX)
+ {
+ for(sal_uInt16 nCntType = CONTENT_TYPE_OUTLINE;
+ nCntType <= CONTENT_TYPE_DRAWOBJECT; nCntType++ )
+ {
+ SwContentType** ppContentT = bActive ?
+ &aActiveContentArr[nCntType] :
+ &aHiddenContentArr[nCntType];
+ if(!*ppContentT)
+ (*ppContentT) = new SwContentType(pShell, nCntType, nOutlineLevel );
+
+
+ String sEntry = (*ppContentT)->GetName();
+ SvLBoxEntry* pEntry;
+ const Image& rImage = aEntryImages.GetImage(SID_SW_START + nCntType);
+ sal_Bool bChOnDemand = 0 != (*ppContentT)->GetMemberCount();
+ pEntry = InsertEntry(sEntry, rImage, rImage,
+ 0, bChOnDemand, LIST_APPEND, (*ppContentT));
+ if(nCntType == nLastSelType)
+ pSelEntry = pEntry;
+ sal_Int32 nExpandOptions = bIsActive || bIsConstant ?
+ nActiveBlock :
+ nHiddenBlock;
+ if(nExpandOptions & (1 << nCntType))
+ {
+ Expand(pEntry);
+ if(nEntryRelPos && nCntType == nLastSelType)
+ {
+ // jetzt vielleicht noch ein Child selektieren
+ SvLBoxEntry* pChild = pEntry;
+ SvLBoxEntry* pTemp = 0;
+ sal_uInt16 nPos = 1;
+ while(0 != (pChild = Next(pChild)))
+ {
+ // der alte Text wird leicht bevorzugt
+ if(sEntryName == GetEntryText(pChild) ||
+ nPos == nEntryRelPos )
+ {
+ pSelEntry = pChild;
+ break;
+ }
+ pTemp = pChild;
+ nPos++;
+ }
+ if(!pSelEntry || lcl_IsContentType(pSelEntry))
+ pSelEntry = pTemp;
+ }
+
+ }
+ }
+ if(pSelEntry)
+ {
+ MakeVisible(pSelEntry);
+ Select(pSelEntry);
+ }
+ else
+ nOldScrollPos = 0;
+ }
+ else
+ {
+ SwContentType** ppRootContentT = bActive ?
+ &aActiveContentArr[nRootType] :
+ &aHiddenContentArr[nRootType];
+ if(!(*ppRootContentT))
+ (*ppRootContentT) = new SwContentType(pShell, nRootType, nOutlineLevel );
+ const Image& rImage = aEntryImages.GetImage(20000 + nRootType);
+ SvLBoxEntry* pParent = InsertEntry(
+ (*ppRootContentT)->GetName(), rImage, rImage,
+ 0, sal_False, LIST_APPEND, *ppRootContentT);
+
+ for(sal_uInt16 i = 0; i < (*ppRootContentT)->GetMemberCount(); i++ )
+ {
+ const SwContent* pCnt = (*ppRootContentT)->GetMember(i);
+ if(pCnt)
+ {
+ String sEntry = pCnt->GetName();
+ if(!sEntry.Len())
+ sEntry = sSpace;
+ InsertEntry( sEntry, pParent,
+ sal_False, LIST_APPEND, (void*)pCnt);
+ }
+ }
+ Expand(pParent);
+ if( nRootType == CONTENT_TYPE_OUTLINE && bIsActive )
+ {
+ //feststellen, wo der Cursor steht
+ const sal_uInt16 nActPos = pShell->GetOutlinePos(MAXLEVEL);
+ SvLBoxEntry* pEntry = First();
+
+ while( 0 != (pEntry = Next(pEntry)) )
+ {
+ if(((SwOutlineContent*)pEntry->GetUserData())->GetPos() == nActPos)
+ {
+ MakeVisible(pEntry);
+ Select(pEntry);
+ }
+ }
+
+ }
+ else
+ {
+ // jetzt vielleicht noch ein Child selektieren
+ SvLBoxEntry* pChild = pParent;
+ SvLBoxEntry* pTemp = 0;
+ sal_uInt16 nPos = 1;
+ while(0 != (pChild = Next(pChild)))
+ {
+ // der alte Text wird leicht bevorzugt
+ if(sEntryName == GetEntryText(pChild) ||
+ nPos == nEntryRelPos )
+ {
+ pSelEntry = pChild;
+ break;
+ }
+ pTemp = pChild;
+ nPos++;
+ }
+ if(!pSelEntry)
+ pSelEntry = pTemp;
+ if(pSelEntry)
+ {
+ MakeVisible(pSelEntry);
+ Select(pSelEntry);
+ }
+ }
+ }
+ }
+ SetUpdateMode( sal_True );
+ ScrollBar* pVScroll = GetVScroll();
+ if(GetEntryCount() == nOldEntryCount &&
+ nOldScrollPos && pVScroll && pVScroll->IsVisible()
+ && pVScroll->GetThumbPos() != nOldScrollPos)
+ {
+ sal_Int32 nDelta = pVScroll->GetThumbPos() - nOldScrollPos;
+ ScrollOutputArea( (short)nDelta );
+ }
+
+}
+
+/***************************************************************************
+ Beschreibung: Im Clear muessen auch die ContentTypes geloescht werden
+***************************************************************************/
+
+
+void SwContentTree::Clear()
+{
+ SetUpdateMode(sal_False);
+ SvTreeListBox::Clear();
+ SetUpdateMode(sal_True);
+}
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+sal_Bool SwContentTree::FillTransferData( TransferDataContainer& rTransfer,
+ sal_Int8& rDragMode )
+{
+ SwWrtShell* pWrtShell = GetWrtShell();
+ DBG_ASSERT(pWrtShell, "keine Shell!");
+ SvLBoxEntry* pEntry = GetCurEntry();
+ if(!pEntry || lcl_IsContentType(pEntry) || !pWrtShell)
+ return sal_False;
+ String sEntry;
+ SwContent* pCnt = ((SwContent*)pEntry->GetUserData());
+
+ sal_uInt16 nActType = pCnt->GetParent()->GetType();
+ String sUrl;
+ sal_Bool bOutline = sal_False;
+ String sOutlineText;
+ switch( nActType )
+ {
+ case CONTENT_TYPE_OUTLINE:
+ {
+ sal_uInt16 nPos = ((SwOutlineContent*)pCnt)->GetPos();
+ DBG_ASSERT(nPos < pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNodesCount(),
+ "outlinecnt veraendert");
+
+ // #100738# make sure outline may actually be copied
+ if( pWrtShell->IsOutlineCopyable( nPos ) )
+ {
+ const SwNumRule* pOutlRule = pWrtShell->GetOutlineNumRule();
+ const SwTxtNode* pTxtNd =
+ pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNode(nPos);
+ if( pTxtNd && pOutlRule && pTxtNd->IsNumbered())
+ {
+ SwNumberTree::tNumberVector aNumVector =
+ pTxtNd->GetNumberVector();
+ for( sal_Int8 nLevel = 0;
+ nLevel <= pTxtNd->GetActualListLevel();
+ nLevel++ )
+ {
+ sal_uInt16 nVal = (sal_uInt16)aNumVector[nLevel];
+ nVal ++;
+ nVal = nVal - pOutlRule->Get(nLevel).GetStart();
+ sEntry += String::CreateFromInt32( nVal );
+ sEntry += '.';
+ }
+ }
+ sEntry += pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(nPos, false);
+ sOutlineText = pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(nPos, true);
+ bIsOutlineMoveable = ((SwOutlineContent*)pCnt)->IsMoveable();
+ bOutline = sal_True;
+ }
+ }
+ break;
+ case CONTENT_TYPE_POSTIT:
+ case CONTENT_TYPE_INDEX:
+ case CONTENT_TYPE_REFERENCE :
+ // koennen weder als URL noch als Bereich eingefuegt werden
+ break;
+ case CONTENT_TYPE_URLFIELD:
+ sUrl = ((SwURLFieldContent*)pCnt)->GetURL();
+ // kein break;
+ case CONTENT_TYPE_OLE:
+ case CONTENT_TYPE_GRAPHIC:
+ if(GetParentWindow()->GetRegionDropMode() != REGION_MODE_NONE)
+ break;
+ else
+ rDragMode &= ~( DND_ACTION_MOVE | DND_ACTION_LINK );
+ default:
+ sEntry = GetEntryText(pEntry);
+ }
+
+ sal_Bool bRet = sal_False;
+ if(sEntry.Len())
+ {
+ const SwDocShell* pDocShell = pWrtShell->GetView().GetDocShell();
+ if(!sUrl.Len())
+ {
+ if(pDocShell->HasName())
+ {
+ SfxMedium* pMedium = pDocShell->GetMedium();
+ sUrl = pMedium->GetURLObject().GetURLNoMark();
+ // nur, wenn primaer ein Link eingefuegt werden soll
+ bRet = sal_True;
+ }
+ else if( nActType == CONTENT_TYPE_REGION ||
+ nActType == CONTENT_TYPE_BOOKMARK )
+ {
+ // fuer Bereich und Textmarken ist ein Link auch ohne
+ // Dateiname ins eigene Dokument erlaubt
+ bRet = sal_True;
+ }
+ else if(bIsConstant &&
+ ( !::GetActiveView() ||
+ pActiveShell != ::GetActiveView()->GetWrtShellPtr()))
+ {
+ // Urls von inaktiven Views ohne Dateinamen koennen auch nicht
+ // gedraggt werden
+ bRet = sal_False;
+ }
+ else
+ {
+ bRet = GetParentWindow()->GetRegionDropMode() == REGION_MODE_NONE;
+ rDragMode = DND_ACTION_MOVE;
+ }
+
+ const String& rToken = pCnt->GetParent()->GetTypeToken();
+ sUrl += '#';
+ sUrl += sEntry;
+ if(rToken.Len())
+ {
+ sUrl += cMarkSeperator;
+ sUrl += rToken;
+ }
+ }
+ else
+ bRet = sal_True;
+
+ if( bRet )
+ {
+ //fuer Outlines muss in die Description der Ueberschrifttext mit der echten Nummer
+ if(bOutline)
+ sEntry = sOutlineText;
+
+ {
+ NaviContentBookmark aBmk( sUrl, sEntry,
+ GetParentWindow()->GetRegionDropMode(),
+ pDocShell);
+ aBmk.Copy( rTransfer );
+ }
+
+ // fuer fremde DocShells muss eine INetBookmark
+ // dazugeliefert werden
+ if( pDocShell->HasName() )
+ {
+ INetBookmark aBkmk( sUrl, sEntry );
+ rTransfer.CopyINetBookmark( aBkmk );
+ }
+ }
+ }
+ return bRet;
+}
+/***************************************************************************
+ Beschreibung: Umschalten der Anzeige auf Root
+***************************************************************************/
+
+
+sal_Bool SwContentTree::ToggleToRoot()
+{
+ if(!bIsRoot)
+ {
+ SvLBoxEntry* pEntry = GetCurEntry();
+ const SwContentType* pCntType;
+ if(pEntry)
+ {
+ if(lcl_IsContentType(pEntry))
+ pCntType = (SwContentType*)pEntry->GetUserData();
+ else
+ pCntType = ((SwContent*)pEntry->GetUserData())->GetParent();
+ nRootType = pCntType->GetType();
+ bIsRoot = sal_True;
+ Display(bIsActive || bIsConstant);
+ }
+ }
+ else
+ {
+ nRootType = USHRT_MAX;
+ bIsRoot = sal_False;
+ FindActiveTypeAndRemoveUserData();
+ Display(bIsActive || bIsConstant);
+ }
+ pConfig->SetRootType( nRootType );
+ GetParentWindow()->aContentToolBox.CheckItem(FN_SHOW_ROOT, bIsRoot);
+ return bIsRoot;
+}
+
+/***************************************************************************
+ Beschreibung: Angezeigten Inhalt auf Gueltigkeit pruefen
+***************************************************************************/
+
+
+sal_Bool SwContentTree::HasContentChanged()
+{
+/*
+ -Parallel durch das lokale Array und die Treelistbox laufen.
+ -Sind die Eintraege nicht expandiert, werden sie nur im Array verworfen
+ und der Contenttype wird als UserData neu gesetzt.
+ - ist der Root-Modus aktiv, wird nur dieser aktualisiert,
+ fuer die nicht angezeigten Inhaltstypen gilt:
+ die Memberliste wird geloescht und der Membercount aktualisiert
+ Wenn Inhalte ueberprueft werden, werden gleichzeitig die vorhanden
+ Memberlisten aufgefuellt. Sobald ein Unterschied auftritt wird nur noch
+ gefuellt und nicht mehr ueberprueft. Abschliessend wird die Box neu gefuellt.
+
+*/
+
+ sal_Bool bRepaint = sal_False;
+ sal_Bool bInvalidate = sal_False;
+
+ if(!bIsActive && ! bIsConstant)
+ {
+ for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++)
+ {
+ if(aActiveContentArr[i])
+ aActiveContentArr[i]->Invalidate();
+ }
+ }
+ else if(bIsRoot)
+ {
+ sal_Bool bOutline = sal_False;
+ SvLBoxEntry* pEntry = First();
+ if(!pEntry)
+ bRepaint = sal_True;
+ else
+ {
+ sal_uInt16 nType = ((SwContentType*)pEntry->GetUserData())->GetType();
+ bOutline = nRootType == CONTENT_TYPE_OUTLINE;
+ SwContentType* pArrType = aActiveContentArr[nType];
+ if(!pArrType)
+ bRepaint = sal_True;
+ else
+ {
+ sal_uInt16 nSelLevel = USHRT_MAX;
+
+ SvLBoxEntry* pFirstSel;
+ if(bOutline &&
+ 0 != ( pFirstSel = FirstSelected()) &&
+ lcl_IsContent(pFirstSel))
+ {
+ nSelLevel = ((SwOutlineContent*)pFirstSel->GetUserData())->GetOutlineLevel();
+ SwWrtShell* pSh = GetWrtShell();
+ sal_uInt16 nOutlinePos = pSh->GetOutlinePos(MAXLEVEL);
+ bRepaint |= nOutlinePos != USHRT_MAX &&
+ pSh->getIDocumentOutlineNodesAccess()->getOutlineLevel(nOutlinePos) != nSelLevel;
+ }
+
+ pArrType->Init(&bInvalidate);
+ pArrType->FillMemberList();
+ pEntry->SetUserData((void*)pArrType);
+ if(!bRepaint)
+ {
+ if(GetChildCount(pEntry) != pArrType->GetMemberCount())
+ bRepaint = sal_True;
+ else
+ {
+ sal_uInt16 nChildCount = (sal_uInt16)GetChildCount(pEntry);
+ for(sal_uInt16 j = 0; j < nChildCount; j++)
+ {
+ pEntry = Next(pEntry);
+ const SwContent* pCnt = pArrType->GetMember(j);
+ pEntry->SetUserData((void*)pCnt);
+ String sEntryText = GetEntryText(pEntry);
+ if( sEntryText != pCnt->GetName() &&
+ !(sEntryText == sSpace && !pCnt->GetName().Len()))
+ bRepaint = sal_True;
+ }
+ }
+ }
+ }
+ }
+ if( !bRepaint && bOutline )
+ {
+ //feststellen, wo der Cursor steht
+ const sal_uInt16 nActPos = GetWrtShell()->GetOutlinePos(MAXLEVEL);
+ SvLBoxEntry* pFirstEntry = First();
+
+ while( 0 != (pFirstEntry = Next(pFirstEntry)) )
+ {
+ if(((SwOutlineContent*)pFirstEntry->GetUserData())->GetPos() == nActPos)
+ {
+ if(FirstSelected() != pFirstEntry)
+ {
+ Select(pFirstEntry);
+ MakeVisible(pFirstEntry);
+ }
+ }
+ }
+
+ }
+
+ }
+ else
+ {
+ SvLBoxEntry* pEntry = First();
+ while ( pEntry )
+ {
+ sal_Bool bNext = sal_True; // mindestens ein Next muss sein
+ SwContentType* pTreeType = (SwContentType*)pEntry->GetUserData();
+ sal_uInt16 nType = pTreeType->GetType();
+ sal_uInt16 nTreeCount = pTreeType->GetMemberCount();
+ SwContentType* pArrType = aActiveContentArr[nType];
+ if(!pArrType)
+ bRepaint = sal_True;
+ else
+ {
+ pArrType->Init(&bInvalidate);
+ pEntry->SetUserData((void*)pArrType);
+ if(IsExpanded(pEntry))
+ {
+ sal_Bool bLevelOrVisibiblityChanged = sal_False;
+ // bLevelOrVisibiblityChanged is set if outlines have changed their level
+ // or if the visibility of objects (frames, sections, tables) has changed
+ // i.e. in header/footer
+ pArrType->FillMemberList(&bLevelOrVisibiblityChanged);
+ if(bLevelOrVisibiblityChanged)
+ bInvalidate = sal_True;
+ sal_uInt16 nChildCount = (sal_uInt16)GetChildCount(pEntry);
+ if(bLevelOrVisibiblityChanged)
+ bInvalidate = sal_True;
+
+ if(nChildCount != pArrType->GetMemberCount())
+ bRepaint = sal_True;
+ else
+ {
+ for(sal_uInt16 j = 0; j < nChildCount; j++)
+ {
+ pEntry = Next(pEntry);
+ bNext = sal_False;
+ const SwContent* pCnt = pArrType->GetMember(j);
+ pEntry->SetUserData((void*)pCnt);
+ String sEntryText = GetEntryText(pEntry);
+ if( sEntryText != pCnt->GetName() &&
+ !(sEntryText == sSpace && !pCnt->GetName().Len()))
+ bRepaint = sal_True;
+ }
+ }
+
+ }
+ else if(pEntry->HasChilds())
+ {
+ //war der Eintrag einmal aufgeklappt, dann muessen auch
+ // die unsichtbaren Eintraege geprueft werden.
+ // zumindest muessen die Userdaten aktualisiert werden
+ sal_Bool bLevelOrVisibiblityChanged = sal_False;
+ // bLevelOrVisibiblityChanged is set if outlines have changed their level
+ // or if the visibility of objects (frames, sections, tables) has changed
+ // i.e. in header/footer
+ pArrType->FillMemberList(&bLevelOrVisibiblityChanged);
+ sal_Bool bRemoveChildren = sal_False;
+ sal_uInt16 nChildCount = (sal_uInt16)GetChildCount(pEntry);
+ if( nChildCount != pArrType->GetMemberCount() )
+ {
+ bRemoveChildren = sal_True;
+ }
+ else
+ {
+ SvLBoxEntry* pChild = FirstChild(pEntry);
+ for(sal_uInt16 j = 0; j < nChildCount; j++)
+ {
+ const SwContent* pCnt = pArrType->GetMember(j);
+ pChild->SetUserData((void*)pCnt);
+ String sEntryText = GetEntryText(pChild);
+ if( sEntryText != pCnt->GetName() &&
+ !(sEntryText == sSpace && !pCnt->GetName().Len()))
+ bRemoveChildren = sal_True;
+ pChild = Next(pChild);
+ }
+ }
+ if(bRemoveChildren)
+ {
+ SvLBoxEntry* pChild = FirstChild(pEntry);
+ SvLBoxEntry* pRemove = pChild;
+ for(sal_uInt16 j = 0; j < nChildCount; j++)
+ {
+ pChild = Next(pRemove);
+ GetModel()->Remove(pRemove);
+ pRemove = pChild;
+ }
+ }
+ if(!nChildCount)
+ {
+ pEntry->EnableChildsOnDemand(sal_False);
+ InvalidateEntry(pEntry);
+ }
+
+ }
+ else if((nTreeCount != 0)
+ != (pArrType->GetMemberCount()!=0))
+ {
+ bRepaint = sal_True;
+ }
+ }
+ //hier muss noch der naechste Root-Entry gefunden werden
+ while( pEntry && (bNext || GetParent(pEntry ) ))
+ {
+ pEntry = Next(pEntry);
+ bNext = sal_False;
+ }
+ }
+ }
+ if(!bRepaint && bInvalidate)
+ Invalidate();
+ return bRepaint;
+}
+
+/***************************************************************************
+ Beschreibung: Bevor alle Daten geloescht werden, soll noch der letzte
+ * aktive Eintrag festgestellt werden. Dann werden die
+ * UserData geloescht
+***************************************************************************/
+void SwContentTree::FindActiveTypeAndRemoveUserData()
+{
+ SvLBoxEntry* pEntry = FirstSelected();
+ if(pEntry)
+ {
+ // wird Clear ueber TimerUpdate gerufen, kann nur fuer die Root
+ // die Gueltigkeit der UserData garantiert werden
+ SvLBoxEntry* pParent;
+ while(0 != (pParent = GetParent(pEntry)))
+ pEntry = pParent;
+ if(pEntry->GetUserData() && lcl_IsContentType(pEntry))
+ nLastSelType = ((SwContentType*)pEntry->GetUserData())->GetType();
+ }
+// else
+// nLastSelType = USHRT_MAX;
+ pEntry = First();
+ while(pEntry)
+ {
+ pEntry->SetUserData(0);
+ pEntry = Next(pEntry);
+ }
+}
+
+/***************************************************************************
+ Beschreibung: Nachdem ein File auf den Navigator gedroppt wurde,
+ wird die neue Shell gesetzt
+***************************************************************************/
+
+
+void SwContentTree::SetHiddenShell(SwWrtShell* pSh)
+{
+ pHiddenShell = pSh;
+ bIsHidden = sal_True;
+ bIsActive = bIsConstant = sal_False;
+ FindActiveTypeAndRemoveUserData();
+ for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++)
+ {
+ DELETEZ(aHiddenContentArr[i]);
+ }
+ Display(bIsActive);
+
+ GetParentWindow()->UpdateListBox();
+}
+/***************************************************************************
+ Beschreibung: Dokumentwechsel - neue Shell setzen
+***************************************************************************/
+
+
+void SwContentTree::SetActiveShell(SwWrtShell* pSh)
+{
+ if(bIsInternalDrag)
+ bDocChgdInDragging = sal_True;
+ sal_Bool bClear = pActiveShell != pSh;
+ if(bIsActive && bClear)
+ {
+ pActiveShell = pSh;
+ FindActiveTypeAndRemoveUserData();
+ Clear();
+ }
+ else if(bIsConstant)
+ {
+ if(!lcl_FindShell(pActiveShell))
+ {
+ pActiveShell = pSh;
+ bIsActive = sal_True;
+ bIsConstant = sal_False;
+ bClear = sal_True;
+ }
+ }
+ // nur wenn es die aktive View ist, wird das Array geloescht und
+ // die Anzeige neu gefuellt
+ if(bIsActive && bClear)
+ {
+ FindActiveTypeAndRemoveUserData();
+ for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++)
+ {
+ DELETEZ(aActiveContentArr[i]);
+ }
+ Display(sal_True);
+ }
+}
+
+/***************************************************************************
+ Beschreibung: Eine offene View als aktiv festlegen
+***************************************************************************/
+
+
+void SwContentTree::SetConstantShell(SwWrtShell* pSh)
+{
+ pActiveShell = pSh;
+ bIsActive = sal_False;
+ bIsConstant = sal_True;
+ FindActiveTypeAndRemoveUserData();
+ for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++)
+ {
+ DELETEZ(aActiveContentArr[i]);
+ }
+ Display(sal_True);
+}
+/***************************************************************************
+ Beschreibung: Kommandos des Navigators ausfuehren
+***************************************************************************/
+
+
+void SwContentTree::ExecCommand(sal_uInt16 nCmd, sal_Bool bModifier)
+{
+ sal_Bool nMove = sal_False;
+ switch( nCmd )
+ {
+ case FN_ITEM_DOWN:
+ case FN_ITEM_UP: nMove = sal_True;
+ case FN_ITEM_LEFT:
+ case FN_ITEM_RIGHT:
+ if( !GetWrtShell()->GetView().GetDocShell()->IsReadOnly() &&
+ (bIsActive ||
+ (bIsConstant && pActiveShell == GetParentWindow()->GetCreateView()->GetWrtShellPtr())))
+ {
+ SwWrtShell* pShell = GetWrtShell();
+ sal_Int8 nActOutlineLevel = nOutlineLevel;
+ sal_uInt16 nActPos = pShell->GetOutlinePos(nActOutlineLevel);
+ SvLBoxEntry* pFirstEntry = FirstSelected();
+ if (pFirstEntry && lcl_IsContent(pFirstEntry))
+ {
+ if((bIsRoot && nRootType == CONTENT_TYPE_OUTLINE) ||
+ ((SwContent*)pFirstEntry->GetUserData())->GetParent()->GetType()
+ == CONTENT_TYPE_OUTLINE)
+ {
+ nActPos = ((SwOutlineContent*)pFirstEntry->GetUserData())->GetPos();
+ }
+ }
+ if ( nActPos < USHRT_MAX &&
+ ( !nMove || pShell->IsOutlineMovable( nActPos )) )
+ {
+ pShell->StartAllAction();
+ pShell->GotoOutline( nActPos); // Falls Textselektion != BoxSelektion
+ pShell->Push();
+ pShell->MakeOutlineSel( nActPos, nActPos,
+ bModifier);
+ if( nMove )
+ {
+ short nDir = nCmd == FN_ITEM_UP ? -1 : 1;
+ if( !bModifier && ((nDir == -1 && nActPos > 0) ||
+ (nDir == 1 && nActPos < GetEntryCount() - 2 )) )
+ {
+ pShell->MoveOutlinePara( nDir );
+ //Cursor wieder an die aktuelle Position setzen
+ pShell->GotoOutline( nActPos + nDir);
+ }
+ else if(bModifier)
+ {
+ sal_uInt16 nActEndPos = nActPos;
+ SvLBoxEntry* pEntry = pFirstEntry;
+ sal_uInt16 nActLevel = ((SwOutlineContent*)
+ pFirstEntry->GetUserData())->GetOutlineLevel();
+ pEntry = Next(pEntry);
+ while( pEntry && CONTENT_TYPE_OUTLINE ==
+ ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId() )
+ {
+ if(nActLevel >= ((SwOutlineContent*)
+ pEntry->GetUserData())->GetOutlineLevel())
+ break;
+ pEntry = Next(pEntry);
+ nActEndPos++;
+ }
+ sal_uInt16 nDest;
+ if(nDir == 1)
+ {
+ //Wenn der letzte Eintrag bewegt werden soll
+ //ist Schluss
+ if(pEntry && CONTENT_TYPE_OUTLINE ==
+ ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId())
+ {
+ // pEntry zeigt jetzt auf den
+ // dem letzten sel. Eintrag folgenden E.
+ nDest = nActEndPos;
+ nDest++;
+ //hier muss der uebernaechste Eintrag
+ //gefunden werden. Die Selektion muss davor eingefuegt
+ //werden
+ while(pEntry )
+ {
+ pEntry = Next(pEntry);
+ // nDest++ darf nur ausgefuehrt werden,
+ // wenn pEntry != 0
+ if(pEntry && nDest++ &&
+ ( nActLevel >= ((SwOutlineContent*)pEntry->GetUserData())->GetOutlineLevel()||
+ CONTENT_TYPE_OUTLINE != ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId()))
+ {
+ nDest--;
+ break;
+ }
+ }
+ nDir = nDest - nActEndPos;
+ //wenn kein Eintrag gefunden wurde, der der Bedingung
+ //fuer das zuvor Einfuegen entspricht, muss etwas weniger
+ //geschoben werden
+ }
+ else
+ nDir = 0;
+ }
+ else
+ {
+ nDest = nActPos;
+ pEntry = pFirstEntry;
+ while(pEntry && nDest )
+ {
+ nDest--;
+ pEntry = Prev(pEntry);
+ if(pEntry &&
+ (nActLevel >= ((SwOutlineContent*)pEntry->GetUserData())->GetOutlineLevel()||
+ CONTENT_TYPE_OUTLINE !=
+ ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId()))
+ {
+ break;
+ }
+ }
+ nDir = nDest - nActPos;
+ }
+ if(nDir)
+ {
+ pShell->MoveOutlinePara( nDir );
+ //Cursor wieder an die aktuelle Position setzen
+ pShell->GotoOutline( nActPos + nDir);
+ }
+ }
+ }
+ else
+ {
+ if( pShell->IsProtectedOutlinePara() )
+ Sound::Beep(); //konnte nicht umgestuft werden
+ else
+ pShell->OutlineUpDown( nCmd == FN_ITEM_LEFT ? -1 : 1 );
+ }
+
+ pShell->ClearMark();
+ pShell->Pop(sal_False); //Cursor steht jetzt wieder an der akt. Ueberschrift
+ pShell->EndAllAction();
+ if(aActiveContentArr[CONTENT_TYPE_OUTLINE])
+ aActiveContentArr[CONTENT_TYPE_OUTLINE]->Invalidate();
+ Display(sal_True);
+ if(!bIsRoot)
+ {
+ const sal_uInt16 nCurrPos = pShell->GetOutlinePos(MAXLEVEL);
+ SvLBoxEntry* pFirst = First();
+
+ while( 0 != (pFirst = Next(pFirst)) && lcl_IsContent(pFirst))
+ {
+ if(((SwOutlineContent*)pFirst->GetUserData())->GetPos() == nCurrPos)
+ {
+ Select(pFirst);
+ MakeVisible(pFirst);
+ }
+ }
+ }
+ }
+ else
+ Sound::Beep(); //konnte nicht verschoben werden
+ }
+ }
+}
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+
+void SwContentTree::ShowTree()
+{
+ aUpdTimer.Start();
+ SvTreeListBox::Show();
+}
+
+/***************************************************************************
+ Beschreibung: zusammengefaltet wird nicht geidlet
+***************************************************************************/
+
+
+void SwContentTree::HideTree()
+{
+ aUpdTimer.Stop();
+ SvTreeListBox::Hide();
+}
+
+/***************************************************************************
+ Beschreibung: Kein Idle mit Focus oder waehrend des Dragging
+***************************************************************************/
+
+
+IMPL_LINK( SwContentTree, TimerUpdate, Timer*, EMPTYARG)
+{
+ // kein Update waehrend D&D
+ // Viewabfrage, da der Navigator zu spaet abgeraeumt wird
+ SwView* pView = GetParentWindow()->GetCreateView();
+ if( (!HasFocus() || bViewHasChanged) &&
+ !bIsInDrag && !bIsInternalDrag && pView &&
+ pView->GetWrtShellPtr() && !pView->GetWrtShellPtr()->ActionPend() )
+ {
+ bViewHasChanged = sal_False;
+ bIsIdleClear = sal_False;
+ SwWrtShell* pActShell = pView->GetWrtShellPtr();
+ if( bIsConstant && !lcl_FindShell( pActiveShell ) )
+ {
+ SetActiveShell(pActShell);
+ GetParentWindow()->UpdateListBox();
+ }
+
+ if(bIsActive && pActShell != GetWrtShell())
+ SetActiveShell(pActShell);
+ else if( (bIsActive || (bIsConstant && pActShell == GetWrtShell())) &&
+ HasContentChanged())
+ {
+ FindActiveTypeAndRemoveUserData();
+ Display(sal_True);
+ }
+ }
+ else if(!pView && bIsActive && !bIsIdleClear)
+ {
+ if(pActiveShell)
+ SetActiveShell(0);
+ Clear();
+ bIsIdleClear = sal_True;
+ }
+ return 0;
+}
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+
+DragDropMode SwContentTree::NotifyStartDrag(
+ TransferDataContainer& rContainer,
+ SvLBoxEntry* pEntry )
+{
+ DragDropMode eMode = (DragDropMode)0;
+ if( bIsActive && nRootType == CONTENT_TYPE_OUTLINE &&
+ GetModel()->GetAbsPos( pEntry ) > 0
+ && !GetWrtShell()->GetView().GetDocShell()->IsReadOnly())
+ eMode = GetDragDropMode();
+ else if(!bIsActive && GetWrtShell()->GetView().GetDocShell()->HasName())
+ eMode = SV_DRAGDROP_APP_COPY;
+
+ sal_Int8 nDragMode;
+ FillTransferData( rContainer, nDragMode );
+ bDocChgdInDragging = sal_False;
+ bIsInternalDrag = sal_True;
+ return eMode;
+}
+
+
+/***************************************************************************
+ Beschreibung : Nach dem Drag wird der aktuelle Absatz m i t
+ Childs verschoben
+***************************************************************************/
+
+
+sal_Bool SwContentTree::NotifyMoving( SvLBoxEntry* pTarget,
+ SvLBoxEntry* pEntry, SvLBoxEntry*& , ULONG& )
+{
+ if(!bDocChgdInDragging)
+ {
+ sal_uInt16 nTargetPos = 0;
+ sal_uInt16 nSourcePos = (( SwOutlineContent* )pEntry->GetUserData())->GetPos();
+ if(!lcl_IsContent(pTarget))
+ nTargetPos = USHRT_MAX;
+ else
+ nTargetPos = (( SwOutlineContent* )pTarget->GetUserData())->GetPos();
+ if( MAXLEVEL > nOutlineLevel && // werden nicht alle Ebenen angezeigt
+ nTargetPos != USHRT_MAX)
+ {
+ SvLBoxEntry* pNext = Next(pTarget);
+ if(pNext)
+ nTargetPos = (( SwOutlineContent* )pNext->GetUserData())->GetPos() -1;
+ else
+ nTargetPos = static_cast<sal_uInt16>(GetWrtShell()->getIDocumentOutlineNodesAccess()->getOutlineNodesCount())- 1;
+
+ }
+
+ DBG_ASSERT( pEntry &&
+ lcl_IsContent(pEntry),"Source == 0 oder Source hat keinen Content" );
+ GetParentWindow()->MoveOutline( nSourcePos,
+ nTargetPos,
+ sal_True);
+
+ aActiveContentArr[CONTENT_TYPE_OUTLINE]->Invalidate();
+ Display(sal_True);
+ }
+ //TreeListBox wird aus dem Dokument neu geladen
+ return sal_False;
+}
+/***************************************************************************
+ Beschreibung : Nach dem Drag wird der aktuelle Absatz o h n e
+ Childs verschoben
+***************************************************************************/
+
+
+sal_Bool SwContentTree::NotifyCopying( SvLBoxEntry* pTarget,
+ SvLBoxEntry* pEntry, SvLBoxEntry*& , ULONG& )
+{
+ if(!bDocChgdInDragging)
+ {
+ sal_uInt16 nTargetPos = 0;
+ sal_uInt16 nSourcePos = (( SwOutlineContent* )pEntry->GetUserData())->GetPos();
+ if(!lcl_IsContent(pTarget))
+ nTargetPos = USHRT_MAX;
+ else
+ nTargetPos = (( SwOutlineContent* )pTarget->GetUserData())->GetPos();
+
+ if( MAXLEVEL > nOutlineLevel && // werden nicht alle Ebenen angezeigt
+ nTargetPos != USHRT_MAX)
+ {
+ SvLBoxEntry* pNext = Next(pTarget);
+ if(pNext)
+ nTargetPos = (( SwOutlineContent* )pNext->GetUserData())->GetPos() - 1;
+ else
+ nTargetPos = static_cast<sal_uInt16>(GetWrtShell()->getIDocumentOutlineNodesAccess()->getOutlineNodesCount()) - 1;
+
+ }
+
+
+ DBG_ASSERT( pEntry &&
+ lcl_IsContent(pEntry),"Source == 0 oder Source hat keinen Content" );
+ GetParentWindow()->MoveOutline( nSourcePos, nTargetPos, sal_False);
+
+ //TreeListBox wird aus dem Dokument neu geladen
+ aActiveContentArr[CONTENT_TYPE_OUTLINE]->Invalidate();
+ Display(sal_True);
+ }
+ return sal_False;
+}
+
+/***************************************************************************
+ Beschreibung: Kein Drop vor den ersten Eintrag - es ist ein SwContentType
+***************************************************************************/
+
+sal_Bool SwContentTree::NotifyAcceptDrop( SvLBoxEntry* pEntry)
+{
+ return pEntry != 0;
+}
+
+
+/***************************************************************************
+ Beschreibung: Wird ein Ctrl+DoubleClick in einen freien Bereich ausgefuehrt,
+ * dann soll die Basisfunktion des Controls gerufen werden
+***************************************************************************/
+void SwContentTree::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ Point aPos( rMEvt.GetPosPixel());
+ SvLBoxEntry* pEntry = GetEntry( aPos, sal_True );
+ if( !pEntry && rMEvt.IsLeft() && rMEvt.IsMod1() && (rMEvt.GetClicks() % 2) == 0)
+ Control::MouseButtonDown( rMEvt );
+ else
+ SvTreeListBox::MouseButtonDown( rMEvt );
+}
+
+/***************************************************************************
+ Beschreibung: sofort aktualisieren
+***************************************************************************/
+
+
+void SwContentTree::GetFocus()
+{
+ SwView* pActView = GetParentWindow()->GetCreateView();
+ if(pActView)
+ {
+ SwWrtShell* pActShell = pActView->GetWrtShellPtr();
+ if(bIsConstant && !lcl_FindShell(pActiveShell))
+ {
+ SetActiveShell(pActShell);
+ }
+
+ if(bIsActive && pActShell != GetWrtShell())
+ SetActiveShell(pActShell);
+ else if( (bIsActive || (bIsConstant && pActShell == GetWrtShell())) &&
+ HasContentChanged())
+ {
+ Display(sal_True);
+ }
+ }
+ else if(bIsActive)
+ Clear();
+ SvTreeListBox::GetFocus();
+}
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+
+void SwContentTree::KeyInput(const KeyEvent& rEvent)
+{
+ const KeyCode aCode = rEvent.GetKeyCode();
+ if(aCode.GetCode() == KEY_RETURN)
+ {
+ SvLBoxEntry* pEntry = FirstSelected();
+ if ( pEntry )
+ {
+ switch(aCode.GetModifier())
+ {
+ case KEY_MOD2:
+ // Boxen umschalten
+ GetParentWindow()->ToggleTree();
+ break;
+ case KEY_MOD1:
+ // RootModus umschalten
+ ToggleToRoot();
+ break;
+ case 0:
+ if(lcl_IsContentType(pEntry))
+ {
+ IsExpanded(pEntry) ?
+ Collapse(pEntry) :
+ Expand(pEntry);
+ }
+ else
+ ContentDoubleClickHdl(0);
+ break;
+ }
+ }
+ }
+ else if(aCode.GetCode() == KEY_DELETE && 0 == aCode.GetModifier())
+ {
+ SvLBoxEntry* pEntry = FirstSelected();
+ if(pEntry &&
+ lcl_IsContent(pEntry) &&
+ ((SwContent*)pEntry->GetUserData())->GetParent()->IsDeletable() &&
+ !pActiveShell->GetView().GetDocShell()->IsReadOnly())
+ {
+ EditEntry(pEntry, EDIT_MODE_DELETE);
+ bViewHasChanged = TRUE;
+ GetParentWindow()->UpdateListBox();
+ TimerUpdate(&aUpdTimer);
+ GrabFocus();
+ }
+ }
+ else
+ SvTreeListBox::KeyInput(rEvent);
+
+}
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+
+void SwContentTree::RequestHelp( const HelpEvent& rHEvt )
+{
+ BOOL bCallBase = TRUE;
+ if( rHEvt.GetMode() & HELPMODE_QUICK )
+ {
+ Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
+ SvLBoxEntry* pEntry = GetEntry( aPos );
+ if( pEntry )
+ {
+ sal_uInt16 nType;
+ sal_Bool bBalloon = sal_False;
+ sal_Bool bContent = sal_False;
+ void* pUserData = pEntry->GetUserData();
+ if(lcl_IsContentType(pEntry))
+ nType = ((SwContentType*)pUserData)->GetType();
+ else
+ {
+ nType = ((SwContent*)pUserData)->GetParent()->GetType();
+ bContent = sal_True;
+ }
+ String sEntry;
+ sal_Bool bRet = sal_False;
+ if(bContent)
+ {
+ switch( nType )
+ {
+ case CONTENT_TYPE_URLFIELD:
+ sEntry = ((SwURLFieldContent*)pUserData)->GetURL();
+ bRet = sal_True;
+ break;
+
+ case CONTENT_TYPE_POSTIT:
+ sEntry = ((SwPostItContent*)pUserData)->GetName();
+ bRet = sal_True;
+ if(Help::IsBalloonHelpEnabled())
+ bBalloon = sal_True;
+ break;
+ case CONTENT_TYPE_OUTLINE:
+ sEntry = ((SwOutlineContent*)pUserData)->GetName();
+ bRet = sal_True;
+ break;
+ case CONTENT_TYPE_GRAPHIC:
+ sEntry = ((SwGraphicContent*)pUserData)->GetLink();
+#if OSL_DEBUG_LEVEL > 1
+ sEntry += ' ';
+ sEntry += String::CreateFromInt32(
+ ((SwGraphicContent*)pUserData)->GetYPos());
+#endif
+ bRet = sal_True;
+ break;
+#if OSL_DEBUG_LEVEL > 1
+ case CONTENT_TYPE_TABLE:
+ case CONTENT_TYPE_FRAME:
+ sEntry = String::CreateFromInt32(
+ ((SwContent*)pUserData)->GetYPos() );
+ bRet = sal_True;
+ break;
+#endif
+ }
+ if(((SwContent*)pUserData)->IsInvisible())
+ {
+ if(sEntry.Len())
+ sEntry += C2S(", ");
+ sEntry += sInvisible;
+ bRet = sal_True;
+ }
+ }
+ else
+ {
+ sal_uInt16 nMemberCount = ((SwContentType*)pUserData)->GetMemberCount();
+ sEntry = String::CreateFromInt32(nMemberCount);
+ sEntry += ' ';
+ sEntry += nMemberCount == 1
+ ? ((SwContentType*)pUserData)->GetSingleName()
+ : ((SwContentType*)pUserData)->GetName();
+ bRet = sal_True;
+ }
+ if(bRet)
+ {
+ SvLBoxTab* pTab;
+ SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab );
+ if( pItem && SV_ITEM_ID_LBOXSTRING == pItem->IsA())
+ {
+ aPos = GetEntryPosition( pEntry );
+
+ aPos.X() = GetTabPos( pEntry, pTab );
+ Size aSize( pItem->GetSize( this, pEntry ) );
+
+ if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
+ aSize.Width() = GetSizePixel().Width() - aPos.X();
+
+ aPos = OutputToScreenPixel(aPos);
+ Rectangle aItemRect( aPos, aSize );
+ if(bBalloon)
+ {
+ aPos.X() += aSize.Width();
+ Help::ShowBalloon( this, aPos, aItemRect, sEntry );
+ }
+ else
+ Help::ShowQuickHelp( this, aItemRect, sEntry,
+ QUICKHELP_LEFT|QUICKHELP_VCENTER );
+ bCallBase = FALSE;
+ }
+ }
+ else
+ {
+ Help::ShowQuickHelp( this, Rectangle(), aEmptyStr, 0 );
+ bCallBase = FALSE;
+ }
+ }
+ }
+ if( bCallBase )
+ Window::RequestHelp( rHEvt );
+}
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+
+void SwContentTree::ExcecuteContextMenuAction( USHORT nSelectedPopupEntry )
+{
+ SvLBoxEntry* pFirst = FirstSelected();
+ switch( nSelectedPopupEntry )
+ {
+ //Outlinelevel
+ case 101:
+ case 102:
+ case 103:
+ case 104:
+ case 105:
+ case 106:
+ case 107:
+ case 108:
+ case 109:
+ case 110:
+ nSelectedPopupEntry -= 100;
+ if(nOutlineLevel != nSelectedPopupEntry )
+ SetOutlineLevel((sal_Int8)nSelectedPopupEntry);
+ break;
+ case 201:
+ case 202:
+ case 203:
+ GetParentWindow()->SetRegionDropMode(nSelectedPopupEntry - 201);
+ break;
+ case 401:
+ case 402:
+ EditEntry(pFirst, nSelectedPopupEntry == 401 ? EDIT_MODE_RMV_IDX : EDIT_MODE_UPD_IDX);
+ break;
+ // Eintrag bearbeiten
+ case 403:
+ EditEntry(pFirst, EDIT_MODE_EDIT);
+ break;
+ case 404:
+ EditEntry(pFirst, EDIT_UNPROTECT_TABLE);
+ break;
+ case 405 :
+ {
+ const SwTOXBase* pBase = ((SwTOXBaseContent*)pFirst->GetUserData())
+ ->GetTOXBase();
+ pActiveShell->SetTOXBaseReadonly(*pBase, !pActiveShell->IsTOXBaseReadonly(*pBase));
+ }
+ break;
+ case 4:
+ break;
+ case 501:
+ EditEntry(pFirst, EDIT_MODE_DELETE);
+ break;
+ case 502 :
+ EditEntry(pFirst, EDIT_MODE_RENAME);
+ break;
+ case 600:
+ pActiveShell->GetView().GetPostItMgr()->Show();
+ break;
+ case 601:
+ pActiveShell->GetView().GetPostItMgr()->Hide();
+ break;
+ case 602:
+ {
+ pActiveShell->GetView().GetPostItMgr()->SetActiveSidebarWin(0);
+ pActiveShell->GetView().GetPostItMgr()->Delete();
+ break;
+ }
+ //Anzeige
+ default: // nSelectedPopupEntry > 300
+ if(nSelectedPopupEntry > 300 && nSelectedPopupEntry < 400)
+ {
+ nSelectedPopupEntry -= 300;
+ SwView *pView = SwModule::GetFirstView();
+ while (pView)
+ {
+ nSelectedPopupEntry --;
+ if(nSelectedPopupEntry == 0)
+ {
+ SetConstantShell(&pView->GetWrtShell());
+ break;
+ }
+ pView = SwModule::GetNextView(pView);
+ }
+ if(nSelectedPopupEntry)
+ {
+ bViewHasChanged = bIsActive = nSelectedPopupEntry == 1;
+ bIsConstant = sal_False;
+ Display(nSelectedPopupEntry == 1);
+ }
+ }
+ }
+ GetParentWindow()->UpdateListBox();
+}
+
+/***************************************************************************
+ Beschreibung:
+***************************************************************************/
+
+
+void SwContentTree::SetOutlineLevel(sal_uInt8 nSet)
+{
+ nOutlineLevel = nSet;
+ pConfig->SetOutlineLevel( nOutlineLevel );
+ SwContentType** ppContentT = bIsActive ?
+ &aActiveContentArr[CONTENT_TYPE_OUTLINE] :
+ &aHiddenContentArr[CONTENT_TYPE_OUTLINE];
+ if(*ppContentT)
+ {
+ (*ppContentT)->SetOutlineLevel(nOutlineLevel);
+ (*ppContentT)->Init();
+ }
+ Display(bIsActive);
+}
+
+/***************************************************************************
+ Beschreibung: Moduswechsel: gedropptes Doc anzeigen
+***************************************************************************/
+
+
+void SwContentTree::ShowHiddenShell()
+{
+ if(pHiddenShell)
+ {
+ bIsConstant = sal_False;
+ bIsActive = sal_False;
+ Display(sal_False);
+ }
+}
+
+/***************************************************************************
+ Beschreibung: Moduswechsel: aktive Sicht anzeigen
+***************************************************************************/
+
+
+void SwContentTree::ShowActualView()
+{
+ bIsActive = sal_True;
+ bIsConstant = sal_False;
+ Display(sal_True);
+ GetParentWindow()->UpdateListBox();
+}
+
+/*-----------------20.11.96 13.34-------------------
+ Beschreibung: Hier sollen die Buttons zum Verschieben von
+ Outlines en-/disabled werden
+--------------------------------------------------*/
+
+sal_Bool SwContentTree::Select( SvLBoxEntry* pEntry, sal_Bool bSelect )
+{
+ if(!pEntry)
+ return sal_False;
+ sal_Bool bEnable = sal_False;
+ SvLBoxEntry* pParentEntry = GetParent(pEntry);
+ if(!bIsLastReadOnly && (!IsVisible() ||
+ ((bIsRoot && nRootType == CONTENT_TYPE_OUTLINE && pParentEntry) ||
+ (lcl_IsContent(pEntry) && ((SwContentType*)pParentEntry->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE))))
+ bEnable = sal_True;
+ SwNavigationPI* pNavi = GetParentWindow();
+ pNavi->aContentToolBox.EnableItem(FN_ITEM_UP , bEnable);
+ pNavi->aContentToolBox.EnableItem(FN_ITEM_DOWN, bEnable);
+ pNavi->aContentToolBox.EnableItem(FN_ITEM_LEFT, bEnable);
+ pNavi->aContentToolBox.EnableItem(FN_ITEM_RIGHT,bEnable);
+
+ return SvTreeListBox::Select(pEntry, bSelect);
+}
+
+/*-----------------27.11.96 12.56-------------------
+
+--------------------------------------------------*/
+
+void SwContentTree::SetRootType(sal_uInt16 nType)
+{
+ nRootType = nType;
+ bIsRoot = sal_True;
+ pConfig->SetRootType( nRootType );
+}
+
+/*-----------------10.01.97 12.19-------------------
+
+--------------------------------------------------*/
+
+void SwContentType::RemoveNewline(String& rEntry)
+{
+ sal_Unicode* pStr = rEntry.GetBufferAccess();
+ for(xub_StrLen i = rEntry.Len(); i; --i, ++pStr )
+ {
+ if( *pStr == 10 || *pStr == 13 )
+ *pStr = 0x20;
+ }
+}
+
+/*-----------------14.01.97 16.38-------------------
+
+--------------------------------------------------*/
+
+void SwContentTree::EditEntry(SvLBoxEntry* pEntry, sal_uInt8 nMode)
+{
+ SwContent* pCnt = (SwContent*)pEntry->GetUserData();
+ GotoContent(pCnt);
+ sal_uInt16 nType = pCnt->GetParent()->GetType();
+ sal_uInt16 nSlot = 0;
+
+ uno::Reference< container::XNameAccess > xNameAccess, xSecond, xThird;
+ switch(nType)
+ {
+ case CONTENT_TYPE_TABLE :
+ if(nMode == EDIT_UNPROTECT_TABLE)
+ {
+ pActiveShell->GetView().GetDocShell()->
+ GetDoc()->UnProtectCells( pCnt->GetName());
+ }
+ else if(nMode == EDIT_MODE_DELETE)
+ {
+ pActiveShell->StartAction();
+ String sTable = SW_RES(STR_TABLE_NAME);
+ SwRewriter aRewriterTableName;
+ aRewriterTableName.AddRule(UNDO_ARG1, SW_RES(STR_START_QUOTE));
+ aRewriterTableName.AddRule(UNDO_ARG2, pCnt->GetName());
+ aRewriterTableName.AddRule(UNDO_ARG3, SW_RES(STR_END_QUOTE));
+ sTable = aRewriterTableName.Apply(sTable);
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, sTable);
+ pActiveShell->StartUndo(UNDO_DELETE, &aRewriter);
+ pActiveShell->GetView().GetViewFrame()->GetDispatcher()->Execute(FN_TABLE_SELECT_ALL);
+ pActiveShell->DeleteRow();
+ pActiveShell->EndUndo();
+ pActiveShell->EndAction();
+ }
+ else if(nMode == EDIT_MODE_RENAME)
+ {
+ uno::Reference< frame::XModel > xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel();
+ uno::Reference< text::XTextTablesSupplier > xTables(xModel, uno::UNO_QUERY);
+ xNameAccess = xTables->getTextTables();
+ }
+ else
+ nSlot = FN_FORMAT_TABLE_DLG;
+ break;
+
+ case CONTENT_TYPE_GRAPHIC :
+ if(nMode == EDIT_MODE_DELETE)
+ {
+ pActiveShell->DelRight();
+ }
+ else if(nMode == EDIT_MODE_RENAME)
+ {
+ uno::Reference< frame::XModel > xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel();
+ uno::Reference< text::XTextGraphicObjectsSupplier > xGraphics(xModel, uno::UNO_QUERY);
+ xNameAccess = xGraphics->getGraphicObjects();
+ uno::Reference< text::XTextFramesSupplier > xFrms(xModel, uno::UNO_QUERY);
+ xSecond = xFrms->getTextFrames();
+ uno::Reference< text::XTextEmbeddedObjectsSupplier > xObjs(xModel, uno::UNO_QUERY);
+ xThird = xObjs->getEmbeddedObjects();
+ }
+ else
+ nSlot = FN_FORMAT_GRAFIC_DLG;
+ break;
+
+ case CONTENT_TYPE_FRAME :
+ case CONTENT_TYPE_OLE :
+ if(nMode == EDIT_MODE_DELETE)
+ {
+ pActiveShell->DelRight();
+ }
+ else if(nMode == EDIT_MODE_RENAME)
+ {
+ uno::Reference< frame::XModel > xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel();
+ uno::Reference< text::XTextFramesSupplier > xFrms(xModel, uno::UNO_QUERY);
+ uno::Reference< text::XTextEmbeddedObjectsSupplier > xObjs(xModel, uno::UNO_QUERY);
+ if(CONTENT_TYPE_FRAME == nType)
+ {
+ xNameAccess = xFrms->getTextFrames();
+ xSecond = xObjs->getEmbeddedObjects();
+ }
+ else
+ {
+ xNameAccess = xObjs->getEmbeddedObjects();
+ xSecond = xFrms->getTextFrames();
+ }
+ uno::Reference< text::XTextGraphicObjectsSupplier > xGraphics(xModel, uno::UNO_QUERY);
+ xThird = xGraphics->getGraphicObjects();
+ }
+ else
+ nSlot = FN_FORMAT_FRAME_DLG;
+ break;
+ case CONTENT_TYPE_BOOKMARK :
+ if(nMode == EDIT_MODE_DELETE)
+ {
+ IDocumentMarkAccess* const pMarkAccess = pActiveShell->getIDocumentMarkAccess();
+ pMarkAccess->deleteMark( pMarkAccess->findMark(pCnt->GetName()) );
+ }
+ else if(nMode == EDIT_MODE_RENAME)
+ {
+ uno::Reference< frame::XModel > xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel();
+ uno::Reference< text::XBookmarksSupplier > xBkms(xModel, uno::UNO_QUERY);
+ xNameAccess = xBkms->getBookmarks();
+ }
+ else
+ nSlot = FN_INSERT_BOOKMARK;
+ break;
+
+ case CONTENT_TYPE_REGION :
+ if(nMode == EDIT_MODE_RENAME)
+ {
+ uno::Reference< frame::XModel > xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel();
+ uno::Reference< text::XTextSectionsSupplier > xSects(xModel, uno::UNO_QUERY);
+ xNameAccess = xSects->getTextSections();
+ }
+ else
+ nSlot = FN_EDIT_REGION;
+ break;
+
+ case CONTENT_TYPE_URLFIELD:
+ nSlot = FN_EDIT_HYPERLINK;
+ break;
+ case CONTENT_TYPE_REFERENCE:
+ nSlot = FN_EDIT_FIELD;
+ break;
+
+ case CONTENT_TYPE_POSTIT:
+ pActiveShell->GetView().GetPostItMgr()->AssureStdModeAtShell();
+ if(nMode == EDIT_MODE_DELETE)
+ {
+ if (((SwPostItContent*)pCnt)->IsPostIt())
+ {
+ pActiveShell->GetView().GetPostItMgr()->SetActiveSidebarWin(0);
+ pActiveShell->DelRight();
+ }
+ /*
+ // this code can be used once we want redline comments in the margin
+ else
+ {
+ SwMarginWin* pComment = pActiveShell->GetView().GetPostItMgr()->GetPostIt(((SwPostItContent*)pCnt)->GetRedline());
+ if (pComment)
+ pComment->Delete();
+ }
+ */
+ }
+ else
+ {
+ if (((SwPostItContent*)pCnt)->IsPostIt())
+ nSlot = FN_POSTIT;
+ else
+ nSlot = FN_REDLINE_COMMENT;
+ }
+ break;
+ case CONTENT_TYPE_INDEX:
+ {
+ const SwTOXBase* pBase = ((SwTOXBaseContent*)pCnt)->GetTOXBase();
+ switch(nMode)
+ {
+ case EDIT_MODE_EDIT:
+ if(pBase)
+ {
+ SwPtrItem aPtrItem( FN_INSERT_MULTI_TOX, (void*)pBase);
+ pActiveShell->GetView().GetViewFrame()->
+ GetDispatcher()->Execute(FN_INSERT_MULTI_TOX,
+ SFX_CALLMODE_ASYNCHRON, &aPtrItem, 0L);
+
+ }
+ break;
+ case EDIT_MODE_RMV_IDX:
+ case EDIT_MODE_DELETE:
+ {
+ if( pBase )
+ pActiveShell->DeleteTOX(*pBase, EDIT_MODE_DELETE == nMode);
+ }
+ break;
+ case EDIT_MODE_UPD_IDX:
+ case EDIT_MODE_RENAME:
+ {
+ Reference< frame::XModel > xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel();
+ Reference< XDocumentIndexesSupplier > xIndexes(xModel, UNO_QUERY);
+ Reference< XIndexAccess> xIdxAcc(xIndexes->getDocumentIndexes());
+ Reference< XNameAccess >xLocalNameAccess(xIdxAcc, UNO_QUERY);
+ if(EDIT_MODE_RENAME == nMode)
+ xNameAccess = xLocalNameAccess;
+ else if(xLocalNameAccess.is() && xLocalNameAccess->hasByName(pBase->GetTOXName()))
+ {
+ Any aIdx = xLocalNameAccess->getByName(pBase->GetTOXName());
+ Reference< XDocumentIndex> xIdx;
+ if(aIdx >>= xIdx)
+ xIdx->update();
+ }
+ }
+ break;
+ }
+ }
+ break;
+ case CONTENT_TYPE_DRAWOBJECT :
+ if(EDIT_MODE_DELETE == nMode)
+ nSlot = SID_DELETE;
+ break;
+ }
+ if(nSlot)
+ pActiveShell->GetView().GetViewFrame()->
+ GetDispatcher()->Execute(nSlot, SFX_CALLMODE_ASYNCHRON);
+ else if(xNameAccess.is())
+ {
+ uno::Any aObj = xNameAccess->getByName(pCnt->GetName());
+ uno::Reference< uno::XInterface > xTmp;
+ aObj >>= xTmp;
+ uno::Reference< container::XNamed > xNamed(xTmp, uno::UNO_QUERY);
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractSwRenameXNamedDlg* pDlg = pFact->CreateSwRenameXNamedDlg( this, xNamed, xNameAccess, DLG_RENAME_XNAMED );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if(xSecond.is())
+ pDlg->SetAlternativeAccess( xSecond, xThird);
+
+ String sForbiddenChars;
+ if(CONTENT_TYPE_BOOKMARK == nType)
+ {
+ sForbiddenChars = C2S("/\\@:*?\";,.#");
+ }
+ else if(CONTENT_TYPE_TABLE == nType)
+ {
+ sForbiddenChars = C2S(" .<>");
+ }
+ pDlg->SetForbiddenChars(sForbiddenChars);
+ pDlg->Execute();
+ delete pDlg;
+ }
+}
+
+/*-----------------14.01.97 16.53-------------------
+
+--------------------------------------------------*/
+
+void SwContentTree::GotoContent(SwContent* pCnt)
+{
+ pActiveShell->EnterStdMode();
+
+ sal_Bool bSel = sal_False;
+ sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
+ switch(nJumpType)
+ {
+ case CONTENT_TYPE_OUTLINE :
+ {
+ pActiveShell->GotoOutline(((SwOutlineContent*)pCnt)->GetPos());
+ }
+ break;
+ case CONTENT_TYPE_TABLE :
+ {
+ pActiveShell->GotoTable(pCnt->GetName());
+ }
+ break;
+ case CONTENT_TYPE_FRAME :
+ case CONTENT_TYPE_GRAPHIC :
+ case CONTENT_TYPE_OLE :
+ {
+ if(pActiveShell->GotoFly(pCnt->GetName()))
+ bSel = sal_True;
+ }
+ break;
+ case CONTENT_TYPE_BOOKMARK:
+ {
+ pActiveShell->GotoMark(pCnt->GetName());
+ }
+ break;
+ case CONTENT_TYPE_REGION :
+ {
+ pActiveShell->GotoRegion(pCnt->GetName());
+ }
+ break;
+ case CONTENT_TYPE_URLFIELD:
+ {
+ if(pActiveShell->GotoINetAttr(
+ *((SwURLFieldContent*)pCnt)->GetINetAttr() ))
+ {
+ pActiveShell->Right( CRSR_SKIP_CHARS, sal_True, 1, sal_False);
+ pActiveShell->SwCrsrShell::SelectTxtAttr( RES_TXTATR_INETFMT, sal_True );
+ }
+
+ }
+ break;
+ case CONTENT_TYPE_REFERENCE:
+ {
+ pActiveShell->GotoRefMark(pCnt->GetName());
+ }
+ break;
+ case CONTENT_TYPE_INDEX:
+ {
+ if (!pActiveShell->GotoNextTOXBase(&pCnt->GetName()))
+ pActiveShell->GotoPrevTOXBase(&pCnt->GetName());
+ }
+ break;
+ case CONTENT_TYPE_POSTIT:
+ pActiveShell->GetView().GetPostItMgr()->AssureStdModeAtShell();
+ if (((SwPostItContent*)pCnt)->IsPostIt())
+ pActiveShell->GotoFld(*((SwPostItContent*)pCnt)->GetPostIt());
+ else
+ pActiveShell->GetView().GetDocShell()->GetWrtShell()->GotoRedline(
+ pActiveShell->GetView().GetDocShell()->GetWrtShell()->FindRedlineOfData(((SwPostItContent*)pCnt)->GetRedline()->GetRedlineData()));
+
+ break;
+ case CONTENT_TYPE_DRAWOBJECT:
+ {
+ SdrView* pDrawView = pActiveShell->GetDrawView();
+ if (pDrawView)
+ {
+ pDrawView->SdrEndTextEdit();
+ pDrawView->UnmarkAll();
+ SdrModel* _pModel = pActiveShell->getIDocumentDrawModelAccess()->GetDrawModel();
+ SdrPage* pPage = _pModel->GetPage(0);
+ sal_uInt32 nCount = pPage->GetObjCount();
+ for( sal_uInt32 i=0; i< nCount; i++ )
+ {
+ SdrObject* pTemp = pPage->GetObj(i);
+ // --> OD 2006-03-09 #i51726# - all drawing objects can be named now
+// if(pTemp->ISA(SdrObjGroup) && pTemp->GetName() == pCnt->GetName())
+ if ( pTemp->GetName() == pCnt->GetName() )
+ // <--
+ {
+ SdrPageView* pPV = pDrawView->GetSdrPageView();
+ if( pPV )
+ {
+ pDrawView->MarkObj( pTemp, pPV );
+ }
+ }
+ }
+ }
+ }
+ break;
+ }
+ if(bSel)
+ {
+ pActiveShell->HideCrsr();
+ pActiveShell->EnterSelFrmMode();
+ }
+ SwView& rView = pActiveShell->GetView();
+ rView.StopShellTimer();
+ rView.GetPostItMgr()->SetActiveSidebarWin(0);
+ rView.GetEditWin().GrabFocus();
+}
+/*-----------------06.02.97 19.14-------------------
+ Jetzt nochtdie passende text::Bookmark
+--------------------------------------------------*/
+
+NaviContentBookmark::NaviContentBookmark()
+ :
+ nDocSh(0),
+ nDefDrag( REGION_MODE_NONE )
+{
+}
+
+/*-----------------06.02.97 20.12-------------------
+
+--------------------------------------------------*/
+
+NaviContentBookmark::NaviContentBookmark( const String &rUrl,
+ const String& rDesc,
+ sal_uInt16 nDragType,
+ const SwDocShell* pDocSh ) :
+ aUrl( rUrl ),
+ aDescr(rDesc),
+ nDocSh((long)pDocSh),
+ nDefDrag( nDragType )
+{
+}
+
+void NaviContentBookmark::Copy( TransferDataContainer& rData ) const
+{
+ rtl_TextEncoding eSysCSet = gsl_getSystemTextEncoding();
+
+ ByteString sStr( aUrl, eSysCSet );
+ sStr += static_cast< char >(NAVI_BOOKMARK_DELIM);
+ sStr += ByteString( aDescr, eSysCSet );
+ sStr += static_cast< char >(NAVI_BOOKMARK_DELIM);
+ sStr += ByteString::CreateFromInt32( nDefDrag );
+ sStr += static_cast< char >(NAVI_BOOKMARK_DELIM);
+ sStr += ByteString::CreateFromInt32( nDocSh );
+ rData.CopyByteString( SOT_FORMATSTR_ID_SONLK, sStr );
+}
+
+sal_Bool NaviContentBookmark::Paste( TransferableDataHelper& rData )
+{
+ String sStr;
+ sal_Bool bRet = rData.GetString( SOT_FORMATSTR_ID_SONLK, sStr );
+ if( bRet )
+ {
+ xub_StrLen nPos = 0;
+ aUrl = sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos );
+ aDescr = sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos );
+ nDefDrag= (USHORT)sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos ).ToInt32();
+ nDocSh = sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos ).ToInt32();
+ }
+ return bRet;
+}
+
+
+/* -----------------------------09.12.99 13:50--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwContentLBoxString : public SvLBoxString
+{
+public:
+ SwContentLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags,
+ const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr) {}
+
+ virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
+ SvLBoxEntry* pEntry);
+};
+
+/* -----------------------------09.12.99 13:49--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwContentTree::InitEntry(SvLBoxEntry* pEntry,
+ const XubString& rStr ,const Image& rImg1,const Image& rImg2,
+ SvLBoxButtonKind eButtonKind)
+{
+ sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2"
+ SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
+ SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite );
+ SwContentLBoxString* pStr = new SwContentLBoxString( pEntry, 0, pCol->GetText() );
+ pEntry->ReplaceItem( pStr, nColToHilite );
+}
+/* -----------------------------09.12.99 13:49--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwContentLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
+ SvLBoxEntry* pEntry )
+{
+ if(lcl_IsContent(pEntry) &&
+ ((SwContent *)pEntry->GetUserData())->IsInvisible())
+ {
+ //* pCont = (SwContent*)pEntry->GetUserData();
+ Font aOldFont( rDev.GetFont());
+ Font aFont(aOldFont);
+ Color aCol( COL_LIGHTGRAY );
+ aFont.SetColor( aCol );
+ rDev.SetFont( aFont );
+ rDev.DrawText( rPos, GetText() );
+ rDev.SetFont( aOldFont );
+ }
+ else
+ SvLBoxString::Paint( rPos, rDev, nFlags, pEntry);
+}
+/* -----------------------------06.05.2002 10:20------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwContentTree::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ USHORT nResId = GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP;
+ aEntryImages = ImageList(SW_RES(nResId));
+ FindActiveTypeAndRemoveUserData();
+ Display(sal_True);
+ }
+ SvTreeListBox::DataChanged( rDCEvt );
+}
+
+
diff --git a/sw/source/ui/utlui/glbltree.cxx b/sw/source/ui/utlui/glbltree.cxx
new file mode 100644
index 000000000000..d8849b48e10f
--- /dev/null
+++ b/sw/source/ui/utlui/glbltree.cxx
@@ -0,0 +1,1523 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifndef _SVSTDARR_HXX
+#define _SVSTDARR_STRINGSDTOR
+#include <svl/svstdarr.hxx>
+#endif
+#include <vcl/msgbox.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/urihelper.hxx>
+#include <sfx2/docfile.hxx>
+#include <vcl/help.hxx>
+#include <sot/filelist.hxx>
+#include <svl/eitem.hxx>
+#include <svl/urlbmk.hxx>
+#include <svtools/filter.hxx>
+#include <sfx2/docinsert.hxx>
+#include <sfx2/filedlghelper.hxx>
+
+#include <sfx2/app.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <errhdl.hxx>
+#include <docsh.hxx>
+#include <content.hxx>
+#include <edglbldc.hxx>
+#include <section.hxx>
+#include <tox.hxx>
+#include <cnttab.hxx>
+#define NAVIPI_CXX
+#include <navipi.hxx>
+#include <navicont.hxx>
+#include <edtwin.hxx>
+#include <uitool.hxx>
+
+#include <cmdid.h>
+#include <helpid.h>
+#ifndef _NAVIPI_HRC
+#include <navipi.hrc>
+#endif
+#ifndef _UTLUI_HRC
+#include <utlui.hrc>
+#endif
+#ifndef _COMCORE_HRC
+#include <comcore.hrc>
+#endif
+#include <globals.hrc>
+#include "swabstdlg.hxx"
+
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+
+// Kontextmenue fuer GlobalTree
+#define CTX_INSERT_ANY_INDEX 10
+//#define CTX_INSERT_CNTIDX 11
+//#define CTX_INSERT_USRIDX 12
+#define CTX_INSERT_FILE 11
+#define CTX_INSERT_NEW_FILE 12
+#define CTX_INSERT_TEXT 13
+
+#define CTX_UPDATE_SEL 20
+#define CTX_UPDATE_INDEX 21
+#define CTX_UPDATE_LINK 22
+#define CTX_UPDATE_ALL 23
+
+#define CTX_UPDATE 1
+#define CTX_INSERT 2
+#define CTX_EDIT 3
+#define CTX_DELETE 4
+#define CTX_EDIT_LINK 5
+
+#define GLOBAL_UPDATE_TIMEOUT 2000
+
+// Flags fuer PopupMenu-enable/disable
+#define ENABLE_INSERT_IDX 0x0001
+#define ENABLE_INSERT_FILE 0x0002
+#define ENABLE_INSERT_TEXT 0x0004
+#define ENABLE_EDIT 0x0008
+#define ENABLE_DELETE 0x0010
+#define ENABLE_UPDATE 0x0020
+#define ENABLE_UPDATE_SEL 0x0040
+#define ENABLE_EDIT_LINK 0x0080
+
+// TabPos nach links schieben
+#define GLBL_TABPOS_SUB 5
+
+const SfxObjectShell* SwGlobalTree::pShowShell = 0;
+static const char* __FAR_DATA aHelpForMenu[] =
+{
+ 0, //
+ HID_GLBLTREE_UPDATE, //CTX_UPDATE
+ HID_GLBLTREE_INSERT, //CTX_INSERT
+ HID_GLBLTREE_EDIT, //CTX_EDIT
+ HID_GLBLTREE_DEL, //CTX_DELETE
+ HID_GLBLTREE_EDIT_LINK, //CTX_EDIT_LINK
+ 0, //
+ 0, //
+ 0, //
+ 0, //
+ HID_GLBLTREE_INS_IDX, //CTX_INSERT_ANY_INDEX
+ HID_GLBLTREE_INS_FILE, //CTX_INSERT_FILE
+ HID_GLBLTREE_INS_NEW_FILE, //CTX_INSERT_NEW_FILE
+ HID_GLBLTREE_INS_TEXT, //CTX_INSERT_TEXT
+ 0, //
+ 0, //
+ 0, //
+ 0, //
+ 0, //
+ 0, //
+ HID_GLBLTREE_UPD_SEL, //CTX_UPDATE_SEL
+ HID_GLBLTREE_UPD_IDX, //CTX_UPDATE_INDEX
+ HID_GLBLTREE_UPD_LINK, //CTX_UPDATE_LINK
+ HID_GLBLTREEUPD_ALL //CTX_UPDATE_ALL
+};
+
+/************************************************************************/
+/* */
+/************************************************************************/
+/* -----------------------------24.08.00 12:04--------------------------------
+
+ ---------------------------------------------------------------------------*/
+class SwGlobalFrameListener_Impl : public SfxListener
+{
+ BOOL bValid;
+public:
+ SwGlobalFrameListener_Impl(SfxViewFrame& rFrame) :
+ bValid(TRUE)
+ {
+ StartListening(rFrame);
+ }
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ BOOL IsValid() const {return bValid;}
+};
+/* -----------------------------24.08.00 12:05--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwGlobalFrameListener_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+{
+ if( rHint.ISA(SfxSimpleHint) &&
+ (((SfxSimpleHint&) rHint).GetId() == SFX_HINT_DYING))
+ bValid = FALSE;
+}
+
+/*-----------------12.06.97 09:38-------------------
+
+--------------------------------------------------*/
+SwGlobalTree::SwGlobalTree(Window* pParent, const ResId& rResId) :
+
+ SvTreeListBox(pParent, rResId),
+
+ pActiveShell ( NULL ),
+ pEmphasisEntry ( NULL ),
+ pDDSource ( NULL ),
+ pSwGlblDocContents ( NULL ),
+ pDefParentWin ( NULL ),
+ pDocContent ( NULL ),
+ pDocInserter ( NULL ),
+
+ bIsInternalDrag ( FALSE ),
+ bLastEntryEmphasis ( FALSE ),
+ bIsImageListInitialized ( FALSE )
+
+{
+ SetDragDropMode(SV_DRAGDROP_APP_COPY |
+ SV_DRAGDROP_CTRL_MOVE |
+ SV_DRAGDROP_ENABLE_TOP );
+
+ aUpdateTimer.SetTimeout(GLOBAL_UPDATE_TIMEOUT);
+ aUpdateTimer.SetTimeoutHdl(LINK(this, SwGlobalTree, Timeout));
+ aUpdateTimer.Start();
+ for(USHORT i = 0; i < GLOBAL_CONTEXT_COUNT; i++)
+ {
+ aContextStrings[i] = SW_RESSTR(i+ ST_GLOBAL_CONTEXT_FIRST);
+ }
+ SetHelpId(HID_NAVIGATOR_GLOB_TREELIST);
+ SelectHdl();
+ SetDoubleClickHdl(LINK(this, SwGlobalTree, DoubleClickHdl));
+ EnableContextMenuHandling();
+}
+
+/*-----------------12.06.97 09:38-------------------
+
+--------------------------------------------------*/
+SwGlobalTree::~SwGlobalTree()
+{
+ delete pSwGlblDocContents;
+ delete pDocInserter;
+}
+
+/*-----------------12.06.97 09:38-------------------
+
+--------------------------------------------------*/
+sal_Int8 SwGlobalTree::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ sal_Int8 nRet = DND_ACTION_NONE;
+ SvLBoxEntry* pLast = (SvLBoxEntry*)LastVisible();
+ if(pEmphasisEntry)
+ {
+ ImplShowTargetEmphasis( Prev(pEmphasisEntry), FALSE );
+ pEmphasisEntry = 0;
+ }
+ else if(bLastEntryEmphasis && pLast)
+ {
+ ImplShowTargetEmphasis( pLast, FALSE);
+ }
+
+ SvLBoxEntry* pDropEntry = bLastEntryEmphasis ? 0 : GetEntry(rEvt.maPosPixel);
+ if( bIsInternalDrag )
+ {
+ SvLBoxEntry* pDummy = 0;
+ ULONG nInsertionPos = LIST_APPEND;
+ NotifyMoving( pDropEntry, pDDSource, pDummy, nInsertionPos );
+ }
+ else
+ {
+ TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
+
+ String sFileName;
+ const SwGlblDocContent* pCnt = pDropEntry ?
+ (const SwGlblDocContent*)pDropEntry->GetUserData() :
+ 0;
+ if( aData.HasFormat( FORMAT_FILE_LIST ))
+ {
+ nRet = rEvt.mnAction;
+ SwGlblDocContents* pTempContents = new SwGlblDocContents;
+ int nAbsContPos = pDropEntry ?
+ (int) GetModel()->GetAbsPos(pDropEntry):
+ - 1;
+ USHORT nEntryCount = (USHORT)GetEntryCount();
+
+ // Daten holen
+ FileList aFileList;
+ aData.GetFileList( FORMAT_FILE_LIST, aFileList );
+ for ( USHORT n = (USHORT)aFileList.Count(); n--; )
+ {
+ sFileName = aFileList.GetFile(n);
+ InsertRegion(pCnt, &sFileName);
+ // nach dem Einfuegen muss die Liste der Contents neu
+ // geholt werden, um nicht auf einem alten Content zu
+ // arbeiten
+ if(n)
+ {
+ pActiveShell->GetGlobalDocContent(*pTempContents);
+ // wenn das file erfolgreich eingefuegt wurde,
+ // dann muss auch der naechste Content geholt werden
+ if(nEntryCount < pTempContents->Count())
+ {
+ nEntryCount++;
+ nAbsContPos++;
+ pCnt = pTempContents->GetObject( static_cast< USHORT >(nAbsContPos) );
+ }
+ }
+ }
+ delete pTempContents;
+ }
+ else if( 0 != (sFileName =
+ SwNavigationPI::CreateDropFileName( aData )).Len())
+ {
+ INetURLObject aTemp(sFileName);
+ GraphicDescriptor aDesc(aTemp);
+ if( !aDesc.Detect() ) // keine Grafiken annehmen
+ {
+ nRet = rEvt.mnAction;
+ InsertRegion(pCnt, &sFileName);
+ }
+ }
+ }
+ bLastEntryEmphasis = FALSE;
+ return nRet;
+
+}
+/*-----------------12.06.97 09:38-------------------
+
+--------------------------------------------------*/
+sal_Int8 SwGlobalTree::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ sal_Int8 nRet = rEvt.mnAction;
+
+ //initiate scrolling
+ GetDropTarget( rEvt.maPosPixel );
+ SvLBoxEntry* pLast = (SvLBoxEntry*)LastVisible();
+ if( rEvt.mbLeaving )
+ {
+ if( pEmphasisEntry )
+ {
+ ImplShowTargetEmphasis( Prev(pEmphasisEntry), FALSE );
+ pEmphasisEntry = 0;
+ }
+ else if(bLastEntryEmphasis && pLast)
+ {
+ ImplShowTargetEmphasis( pLast, FALSE);
+ }
+ bLastEntryEmphasis = FALSE;
+ }
+ else
+ {
+ SvLBoxEntry* pDropEntry = GetEntry( rEvt.maPosPixel );
+ if(bIsInternalDrag)
+ {
+ if( pDDSource != pDropEntry )
+ nRet = rEvt.mnAction;
+ }
+ else if( IsDropFormatSupported( FORMAT_FILE ) ||
+ IsDropFormatSupported( FORMAT_STRING ) ||
+ IsDropFormatSupported( FORMAT_FILE_LIST ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_SOLK ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK )||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_FILECONTENT ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_FILENAME ))
+ nRet = DND_ACTION_LINK;
+
+ if(pEmphasisEntry && pEmphasisEntry != pDropEntry)
+ ImplShowTargetEmphasis( Prev(pEmphasisEntry), FALSE );
+ else if(pLast && bLastEntryEmphasis && pDropEntry)
+ {
+ ImplShowTargetEmphasis( pLast, FALSE);
+ bLastEntryEmphasis = FALSE;
+ }
+
+ if(pDropEntry)
+ ImplShowTargetEmphasis( Prev(pDropEntry), DND_ACTION_NONE != nRet );
+ else if(pLast)
+ {
+ ImplShowTargetEmphasis( pLast, DND_ACTION_NONE != nRet );
+ bLastEntryEmphasis = TRUE;
+ }
+ pEmphasisEntry = pDropEntry;
+ }
+ return nRet;
+}
+/*-----------------12.06.97 09:38-------------------
+
+--------------------------------------------------*/
+PopupMenu* SwGlobalTree::CreateContextMenu()
+{
+ PopupMenu* pPop = 0;
+ if(pActiveShell &&
+ !pActiveShell->GetView().GetDocShell()->IsReadOnly())
+ {
+ USHORT nEnableFlags = GetEnableFlags();
+ pPop = new PopupMenu;
+ PopupMenu* pSubPop1 = new PopupMenu;
+ PopupMenu* pSubPop2 = new PopupMenu;
+
+ for (USHORT i = CTX_UPDATE_SEL; i <= CTX_UPDATE_ALL; i++)
+ {
+ pSubPop2->InsertItem( i, aContextStrings[ST_UPDATE_SEL - ST_GLOBAL_CONTEXT_FIRST - CTX_UPDATE_SEL+ i] );
+ pSubPop2->SetHelpId(i, aHelpForMenu[i]);
+ }
+ pSubPop2->EnableItem(CTX_UPDATE_SEL, 0 != (nEnableFlags & ENABLE_UPDATE_SEL));
+
+ pSubPop1->InsertItem(CTX_INSERT_ANY_INDEX, aContextStrings[ST_INDEX - ST_GLOBAL_CONTEXT_FIRST]);
+ pSubPop1->SetHelpId(CTX_INSERT_ANY_INDEX, aHelpForMenu[CTX_INSERT_ANY_INDEX]);
+ pSubPop1->InsertItem(CTX_INSERT_FILE, aContextStrings[ST_FILE - ST_GLOBAL_CONTEXT_FIRST]);
+ pSubPop1->SetHelpId(CTX_INSERT_FILE, aHelpForMenu[CTX_INSERT_FILE]);
+ pSubPop1->InsertItem(CTX_INSERT_NEW_FILE, aContextStrings[ST_NEW_FILE - ST_GLOBAL_CONTEXT_FIRST]);
+ pSubPop1->SetHelpId(CTX_INSERT_NEW_FILE, aHelpForMenu[CTX_INSERT_NEW_FILE]);
+ pSubPop1->InsertItem(CTX_INSERT_TEXT, aContextStrings[ST_TEXT - ST_GLOBAL_CONTEXT_FIRST]);
+ pSubPop1->SetHelpId(CTX_INSERT_TEXT, aHelpForMenu[CTX_INSERT_TEXT]);
+
+
+ pPop->InsertItem(CTX_UPDATE, aContextStrings[ST_UPDATE - ST_GLOBAL_CONTEXT_FIRST]);
+ pPop->SetHelpId(CTX_UPDATE, aHelpForMenu[CTX_UPDATE]);
+ pPop->InsertItem(CTX_EDIT, aContextStrings[ST_EDIT_CONTENT - ST_GLOBAL_CONTEXT_FIRST]);
+ pPop->SetHelpId(CTX_EDIT, aHelpForMenu[CTX_EDIT]);
+ if(nEnableFlags&ENABLE_EDIT_LINK)
+ {
+ pPop->InsertItem(CTX_EDIT_LINK, aContextStrings[ST_EDIT_LINK - ST_GLOBAL_CONTEXT_FIRST]);
+ pPop->SetHelpId(CTX_EDIT_LINK, aHelpForMenu[CTX_EDIT_LINK]);
+ }
+ pPop->InsertItem(CTX_INSERT, aContextStrings[ST_INSERT - ST_GLOBAL_CONTEXT_FIRST]);
+ pPop->SetHelpId(CTX_INSERT, aHelpForMenu[CTX_INSERT]);
+ pPop->InsertSeparator() ;
+ pPop->InsertItem(CTX_DELETE, aContextStrings[ST_DELETE - ST_GLOBAL_CONTEXT_FIRST]);
+ pPop->SetHelpId(CTX_DELETE, aHelpForMenu[CTX_DELETE]);
+
+ //evtl. disablen
+ pSubPop1->EnableItem(CTX_INSERT_ANY_INDEX, 0 != (nEnableFlags & ENABLE_INSERT_IDX ));
+ pSubPop1->EnableItem(CTX_INSERT_TEXT, 0 != (nEnableFlags & ENABLE_INSERT_TEXT));
+ pSubPop1->EnableItem(CTX_INSERT_FILE, 0 != (nEnableFlags & ENABLE_INSERT_FILE));
+ pSubPop1->EnableItem(CTX_INSERT_NEW_FILE, 0 != (nEnableFlags & ENABLE_INSERT_FILE));
+
+ pPop->EnableItem(CTX_UPDATE, 0 != (nEnableFlags & ENABLE_UPDATE));
+ pPop->EnableItem(CTX_INSERT, 0 != (nEnableFlags & ENABLE_INSERT_IDX));
+ pPop->EnableItem(CTX_EDIT, 0 != (nEnableFlags & ENABLE_EDIT));
+ pPop->EnableItem(CTX_DELETE, 0 != (nEnableFlags & ENABLE_DELETE));
+
+
+ pPop->SetPopupMenu( CTX_INSERT, pSubPop1 );
+ pPop->SetPopupMenu( CTX_UPDATE, pSubPop2 );
+ }
+ return pPop;
+}
+/*-----------------16.06.97 10:41-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::TbxMenuHdl(USHORT nTbxId, ToolBox* pBox)
+{
+ USHORT nEnableFlags = GetEnableFlags();
+ if(FN_GLOBAL_OPEN == nTbxId)
+ {
+ PopupMenu *pMenu = new PopupMenu;
+ for (USHORT i = CTX_INSERT_ANY_INDEX; i <= CTX_INSERT_TEXT; i++)
+ {
+ pMenu->InsertItem( i, aContextStrings[ST_INDEX - ST_GLOBAL_CONTEXT_FIRST - CTX_INSERT_ANY_INDEX + i] );
+ pMenu->SetHelpId(i, aHelpForMenu[i] );
+ }
+ pMenu->EnableItem(CTX_INSERT_ANY_INDEX, 0 != (nEnableFlags & ENABLE_INSERT_IDX ));
+// pMenu->EnableItem(CTX_INSERT_CNTIDX, 0 != (nEnableFlags & ENABLE_INSERT_IDX ));
+// pMenu->EnableItem(CTX_INSERT_USRIDX, 0 != (nEnableFlags & ENABLE_INSERT_IDX ));
+ pMenu->EnableItem(CTX_INSERT_TEXT, 0 != (nEnableFlags & ENABLE_INSERT_TEXT));
+ pMenu->EnableItem(CTX_INSERT_FILE, 0 != (nEnableFlags & ENABLE_INSERT_FILE));
+ pMenu->EnableItem(CTX_INSERT_NEW_FILE, 0 != (nEnableFlags & ENABLE_INSERT_FILE));
+ pMenu->SetSelectHdl(LINK(this, SwGlobalTree, PopupHdl));
+ pMenu->Execute( pBox, pBox->GetItemRect(nTbxId).BottomLeft());
+ delete pMenu;
+ pBox->EndSelection();
+ pBox->Invalidate();
+ }
+ else if(FN_GLOBAL_UPDATE == nTbxId)
+ {
+ PopupMenu *pMenu = new PopupMenu;
+ for (USHORT i = CTX_UPDATE_SEL; i <= CTX_UPDATE_ALL; i++)
+ {
+ pMenu->InsertItem( i, aContextStrings[ST_UPDATE_SEL - ST_GLOBAL_CONTEXT_FIRST - CTX_UPDATE_SEL+ i] );
+ pMenu->SetHelpId(i, aHelpForMenu[i] );
+ }
+ pMenu->EnableItem(CTX_UPDATE_SEL, 0 != (nEnableFlags & ENABLE_UPDATE_SEL));
+ pMenu->SetSelectHdl(LINK(this, SwGlobalTree, PopupHdl));
+ pMenu->Execute( pBox, pBox->GetItemRect(nTbxId).BottomLeft());
+ delete pMenu;
+ pBox->EndSelection();
+ pBox->Invalidate();
+ }
+}
+/*-----------------16.06.97 11:02-------------------
+
+--------------------------------------------------*/
+USHORT SwGlobalTree::GetEnableFlags() const
+{
+ SvLBoxEntry* pEntry = FirstSelected();
+ USHORT nSelCount = (USHORT)GetSelectionCount();
+ USHORT nEntryCount = (USHORT)GetEntryCount();
+ SvLBoxEntry* pPrevEntry = pEntry ? Prev(pEntry) : 0;
+
+ USHORT nRet = 0;
+ if(nSelCount == 1 || !nEntryCount)
+ nRet |= ENABLE_INSERT_IDX|ENABLE_INSERT_FILE;
+ if(nSelCount == 1)
+ {
+ nRet |= ENABLE_EDIT;
+ if( ((SwGlblDocContent*)pEntry->GetUserData())->GetType() != GLBLDOC_UNKNOWN &&
+ (!pPrevEntry || ((SwGlblDocContent*)pPrevEntry->GetUserData())->GetType() != GLBLDOC_UNKNOWN))
+ nRet |= ENABLE_INSERT_TEXT;
+ if( GLBLDOC_SECTION == ((SwGlblDocContent*)pEntry->GetUserData())->GetType() )
+ nRet |= ENABLE_EDIT_LINK;
+ }
+ else if(!nEntryCount)
+ {
+ nRet |= ENABLE_INSERT_TEXT;
+ }
+ if(nEntryCount)
+ nRet |= ENABLE_UPDATE|ENABLE_DELETE;
+ if(nSelCount)
+ nRet |= ENABLE_UPDATE_SEL;
+ return nRet;
+}
+
+/*-----------------12.06.97 09:38-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::RequestHelp( const HelpEvent& rHEvt )
+{
+ BOOL bParent = TRUE;
+ Update(TRUE);
+ Display(TRUE);
+ if( rHEvt.GetMode() & HELPMODE_QUICK )
+ {
+ Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
+ SvLBoxEntry* pEntry = GetEntry( aPos );
+ const SwGlblDocContent* pCont = pEntry ?
+ (const SwGlblDocContent*)pEntry->GetUserData() : 0;
+ if( pCont && GLBLDOC_SECTION == pCont->GetType())
+ {
+ bParent = FALSE;
+ SvLBoxTab* pTab;
+ SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab );
+ if(pItem && SV_ITEM_ID_LBOXSTRING == pItem->IsA())
+ {
+ const SwSection* pSect = pCont->GetSection();
+ String sEntry = pSect->GetLinkFileName().GetToken(0, sfx2::cTokenSeperator);
+ if(!pSect->IsConnectFlag())
+ sEntry.Insert(aContextStrings[ST_BROKEN_LINK - ST_GLOBAL_CONTEXT_FIRST], 0 );
+ Point aEntryPos = GetEntryPosition( pEntry );
+
+ aEntryPos.X() = GetTabPos( pEntry, pTab );
+ Size aSize( pItem->GetSize( this, pEntry ) );
+
+ if((aEntryPos.X() + aSize.Width()) > GetSizePixel().Width())
+ aSize.Width() = GetSizePixel().Width() - aEntryPos.X();
+
+ aEntryPos = OutputToScreenPixel(aEntryPos);
+ Rectangle aItemRect( aEntryPos, aSize );
+ if(Help::IsBalloonHelpEnabled())
+ {
+ aEntryPos.X() += aSize.Width();
+ Help::ShowBalloon( this, aEntryPos, aItemRect, sEntry );
+ }
+ else
+ Help::ShowQuickHelp( this, aItemRect, sEntry,
+ QUICKHELP_LEFT|QUICKHELP_VCENTER );
+ }
+ }
+ }
+
+ if(bParent)
+ SvTreeListBox::RequestHelp(rHEvt);
+}
+/*-----------------16.06.97 16:15-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::SelectHdl()
+{
+
+ USHORT nSelCount = (USHORT)GetSelectionCount();
+ SvLBoxEntry* pSel = FirstSelected();
+ USHORT nAbsPos = pSel ? (USHORT)GetModel()->GetAbsPos(pSel) : 0;
+ SwNavigationPI* pNavi = GetParentWindow();
+ BOOL bReadonly = !pActiveShell ||
+ pActiveShell->GetView().GetDocShell()->IsReadOnly();
+ pNavi->aGlobalToolBox.EnableItem(FN_GLOBAL_EDIT, nSelCount == 1 && !bReadonly);
+ pNavi->aGlobalToolBox.EnableItem(FN_GLOBAL_OPEN, nSelCount <= 1 && !bReadonly);
+ pNavi->aGlobalToolBox.EnableItem(FN_GLOBAL_UPDATE, GetEntryCount() > 0 && !bReadonly);
+ pNavi->aGlobalToolBox.EnableItem(FN_ITEM_UP,
+ nSelCount == 1 && nAbsPos && !bReadonly);
+ pNavi->aGlobalToolBox.EnableItem(FN_ITEM_DOWN,
+ nSelCount == 1 && nAbsPos < ((USHORT)GetEntryCount()) - 1 && !bReadonly);
+
+}
+/*-----------------16.06.97 16:15-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::DeselectHdl()
+{
+ SelectHdl();
+}
+
+/*-----------------17.06.97 13:11-------------------
+
+--------------------------------------------------*/
+DragDropMode SwGlobalTree::NotifyStartDrag( TransferDataContainer& ,
+ SvLBoxEntry* pEntry )
+{
+ bIsInternalDrag = TRUE;
+ pDDSource = pEntry;
+ return SV_DRAGDROP_CTRL_MOVE;
+}
+
+/*-----------------21.06.97 12:44-------------------
+
+--------------------------------------------------*/
+long SwGlobalTree::GetTabPos( SvLBoxEntry*, SvLBoxTab* pTab)
+{
+ return pTab->GetPos() - GLBL_TABPOS_SUB;
+}
+
+/*-----------------12.06.97 09:38-------------------
+
+--------------------------------------------------*/
+BOOL SwGlobalTree::NotifyMoving( SvLBoxEntry* pTarget,
+ SvLBoxEntry* pSource,
+ SvLBoxEntry*&,
+ ULONG&
+ )
+{
+ SvTreeList* _pModel = GetModel();
+ USHORT nSource = (USHORT) _pModel->GetAbsPos(pSource);
+ USHORT nDest = pTarget ? (USHORT) _pModel->GetAbsPos(pTarget) : pSwGlblDocContents->Count();
+
+ if( pActiveShell->MoveGlobalDocContent(
+ *pSwGlblDocContents, nSource, nSource + 1, nDest ) &&
+ Update( FALSE ))
+ Display();
+ return FALSE;
+}
+/*-----------------12.06.97 09:39-------------------
+
+--------------------------------------------------*/
+BOOL SwGlobalTree::NotifyCopying( SvLBoxEntry* /*pTarget*/,
+ SvLBoxEntry* /*pEntry*/,
+ SvLBoxEntry*& /*rpNewParent*/,
+ ULONG& /*rNewChildPos*/
+ )
+{
+ return FALSE;
+}
+/*-----------------12.06.97 09:39-------------------
+
+--------------------------------------------------*/
+BOOL SwGlobalTree::NotifyAcceptDrop( SvLBoxEntry* pEntry)
+{
+ return pEntry != 0;
+}
+/*-----------------12.06.97 09:39-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::StartDrag( sal_Int8 nAction, const Point& rPt )
+{
+ if( 1 == GetSelectionCount() )
+ SvTreeListBox::StartDrag( nAction, rPt );
+}
+/*-----------------12.06.97 09:39-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::DragFinished( sal_Int8 nAction )
+{
+ SvTreeListBox::DragFinished( nAction );
+ bIsInternalDrag = FALSE;
+}
+
+/***************************************************************************
+ Beschreibung: Wird ein Ctrl+DoubleClick in einen freien Bereich ausgefuehrt,
+ * dann soll die Basisfunktion des Controls gerufen werden
+***************************************************************************/
+void SwGlobalTree::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ Point aPos( rMEvt.GetPosPixel());
+ SvLBoxEntry* pEntry = GetEntry( aPos, TRUE );
+ if( !pEntry && rMEvt.IsLeft() && rMEvt.IsMod1() && (rMEvt.GetClicks() % 2) == 0)
+ Control::MouseButtonDown( rMEvt );
+ else
+ SvTreeListBox::MouseButtonDown( rMEvt );
+}
+
+/*-----------------12.06.97 13:08-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::GetFocus()
+{
+ if(Update( FALSE ))
+ Display();
+ SvTreeListBox::GetFocus();
+}
+
+/*-----------------12.06.97 12:34-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::KeyInput(const KeyEvent& rKEvt)
+{
+ const KeyCode aCode = rKEvt.GetKeyCode();
+ if(aCode.GetCode() == KEY_RETURN)
+ {
+ switch(aCode.GetModifier())
+ {
+ case KEY_MOD2:
+ // Boxen umschalten
+ GetParentWindow()->ToggleTree();
+ break;
+ }
+ }
+ else
+ SvTreeListBox::KeyInput(rKEvt);
+}
+
+/*-----------------17.06.97 11:59-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::Clear()
+{
+ pEmphasisEntry = 0;
+ SvTreeListBox::Clear();
+}
+/*-----------------12.06.97 12:38-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::Display(BOOL bOnlyUpdateUserData)
+{
+ if(!bIsImageListInitialized)
+ {
+ USHORT nResId = GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP;
+ aEntryImages = ImageList(SW_RES(nResId));
+ bIsImageListInitialized = TRUE;
+ }
+ USHORT nCount = pSwGlblDocContents->Count();
+ if(bOnlyUpdateUserData && GetEntryCount() == pSwGlblDocContents->Count())
+ {
+ SvLBoxEntry* pEntry = First();
+ for( USHORT i = 0; i < nCount; i++)
+ {
+ SwGlblDocContentPtr pCont = pSwGlblDocContents->GetObject(i);
+ pEntry->SetUserData(pCont);
+ pEntry = Next(pEntry);
+ }
+ }
+ else
+ {
+ SetUpdateMode( FALSE );
+ SvLBoxEntry* pOldSelEntry = FirstSelected();
+ String sEntryName; // Name des Eintrags
+ USHORT nSelPos = USHRT_MAX;
+ if(pOldSelEntry)
+ {
+ sEntryName = GetEntryText(pOldSelEntry);
+ nSelPos = (USHORT)GetModel()->GetAbsPos(pOldSelEntry);
+ }
+ Clear();
+ if(!pSwGlblDocContents)
+ Update( FALSE );
+
+ SvLBoxEntry* pSelEntry = 0;
+ for( USHORT i = 0; i < nCount; i++)
+ {
+ SwGlblDocContentPtr pCont = pSwGlblDocContents->GetObject(i);
+ String sEntry;
+ Image aImage;
+ switch( pCont->GetType() )
+ {
+ case GLBLDOC_UNKNOWN:
+ {
+ sEntry = aContextStrings[ST_TEXT - ST_GLOBAL_CONTEXT_FIRST];
+ aImage = aEntryImages.GetImage(SID_SW_START + GLOBAL_CONTENT_TEXT);
+ }
+ break;
+ case GLBLDOC_TOXBASE:
+ {
+ const SwTOXBase* pBase = pCont->GetTOX();
+ sEntry = pBase->GetTitle();
+ aImage = aEntryImages.GetImage(SID_SW_START + CONTENT_TYPE_INDEX);
+ }
+ break;
+ case GLBLDOC_SECTION:
+ {
+ const SwSection* pSect = pCont->GetSection();
+ sEntry = pSect->GetSectionName();
+ aImage = aEntryImages.GetImage(SID_SW_START + CONTENT_TYPE_REGION);
+ }
+ break;
+ }
+ SvLBoxEntry* pEntry = InsertEntry(sEntry, aImage, aImage,
+ 0, FALSE, LIST_APPEND, pCont);
+ if(sEntry == sEntryName)
+ {
+ pSelEntry = pEntry;
+ }
+ }
+ if(pSelEntry)
+ {
+ Select(pSelEntry);
+ }
+ else if(nSelPos != USHRT_MAX && nSelPos < nCount)
+ {
+ Select(GetEntry(nSelPos));
+ }
+ else if(nCount)
+ Select(First());
+ else
+ SelectHdl();
+ SetUpdateMode( TRUE );
+ }
+}
+
+/*-----------------13.06.97 10:32-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::InsertRegion( const SwGlblDocContent* pCont, const String* pFileName )
+{
+ Sequence< OUString > aFileNames;
+ if ( !pFileName )
+ {
+ pDefParentWin = Application::GetDefDialogParent();
+ Application::SetDefDialogParent( this );
+ if ( pDocInserter )
+ delete pDocInserter;
+ pDocInserter = new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter"), true );
+ pDocInserter->StartExecuteModal( LINK( this, SwGlobalTree, DialogClosedHdl ) );
+ }
+ else if ( pFileName->Len() )
+ {
+ aFileNames.realloc(1);
+ INetURLObject aFileName;
+ aFileName.SetSmartURL( *pFileName );
+ aFileNames.getArray()[0] = aFileName.GetMainURL( INetURLObject::NO_DECODE );
+ InsertRegion( pCont, aFileNames );
+ }
+}
+
+/*-----------------18.06.97 12:42-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::EditContent(const SwGlblDocContent* pCont )
+{
+ USHORT nSlot = 0;
+ switch( pCont->GetType() )
+ {
+ case GLBLDOC_UNKNOWN:
+ pActiveShell->GetView().GetEditWin().GrabFocus();
+ break;
+ case GLBLDOC_TOXBASE:
+ {
+ const SwTOXBase* pBase = pCont->GetTOX();
+ if(pBase)
+ nSlot = FN_INSERT_MULTI_TOX;
+ }
+ break;
+ case GLBLDOC_SECTION:
+ {
+ OpenDoc(pCont);
+
+ nSlot = 0;
+ pCont = 0;
+ }
+ break;
+ }
+ if(pCont)
+ GotoContent(pCont);
+ if(nSlot)
+ {
+ pActiveShell->GetView().GetViewFrame()->GetDispatcher()->Execute(nSlot);
+ if(Update( FALSE ))
+ Display();
+ }
+}
+
+/*-----------------13.06.97 14:22-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwGlobalTree, PopupHdl, Menu* , pMenu)
+{
+ ExcecuteContextMenuAction( pMenu->GetCurItemId());
+ return TRUE;
+}
+/* -----------------26.08.2003 11:57-----------------
+
+ --------------------------------------------------*/
+void SwGlobalTree::ExcecuteContextMenuAction( USHORT nSelectedPopupEntry )
+//IMPL_LINK( SwGlobalTree, PopupHdl, Menu* , pMenu)
+{
+// USHORT nId = pMenu->GetCurItemId();
+ SvLBoxEntry* pEntry = FirstSelected();
+ SwGlblDocContent* pCont = pEntry ? (SwGlblDocContent*)pEntry->GetUserData() : 0;
+ // wird waehrend des Dialogs ein RequestHelp gerufen,
+ // dann geht der Content verloren. Deshalb wird hier eine
+ // Kopie angelegt, in der nur die DocPos richtig gesetzt ist.
+ SwGlblDocContent* pContCopy = 0;
+ if(pCont)
+ pContCopy = new SwGlblDocContent(pCont->GetDocPos());
+ SfxDispatcher& rDispatch = *pActiveShell->GetView().GetViewFrame()->GetDispatcher();
+ USHORT nSlot = 0;
+ bool bDeleteContentCopy = true;
+ switch( nSelectedPopupEntry )
+ {
+ case CTX_UPDATE_SEL:
+ {
+ // zwei Durchlaeufe: zuerst die Bereiche, dann die Verzeichnisse
+ // aktualisieren
+ SvLBoxEntry* pSelEntry = FirstSelected();
+ while( pSelEntry )
+ {
+ SwGlblDocContent* pContent = (SwGlblDocContent*)pSelEntry->GetUserData();
+ if(GLBLDOC_SECTION == pContent->GetType() &&
+ pContent->GetSection()->IsConnected())
+ {
+ ((SwSection*)pContent->GetSection())->UpdateNow();
+ }
+
+ pSelEntry = NextSelected(pSelEntry);
+ }
+ pSelEntry = FirstSelected();
+ while( pSelEntry )
+ {
+ SwGlblDocContent* pContent = (SwGlblDocContent*)pSelEntry->GetUserData();
+ if(GLBLDOC_TOXBASE == pContent->GetType())
+ pActiveShell->UpdateTableOf(*pContent->GetTOX());
+ pSelEntry = NextSelected(pSelEntry);
+ }
+
+ }
+ break;
+ case CTX_UPDATE_INDEX:
+ {
+ nSlot = FN_UPDATE_TOX;
+ }
+ break;
+ case CTX_UPDATE_LINK:
+ case CTX_UPDATE_ALL:
+ {
+ pActiveShell->GetLinkManager().UpdateAllLinks(TRUE);
+ if(CTX_UPDATE_ALL == nSelectedPopupEntry)
+ nSlot = FN_UPDATE_TOX;
+ pCont = 0;
+ }
+ break;
+ case CTX_EDIT:
+ {
+ DBG_ASSERT(pCont, "Edit ohne Entry ? " );
+ EditContent(pCont);
+ }
+ break;
+ case CTX_EDIT_LINK:
+ {
+ DBG_ASSERT(pCont, "Edit ohne Entry ? " );
+ SfxStringItem aName(FN_EDIT_REGION,
+ pCont->GetSection()->GetSectionName());
+ rDispatch.Execute(FN_EDIT_REGION, SFX_CALLMODE_ASYNCHRON, &aName, 0L);
+ }
+ break;
+ case CTX_DELETE:
+ {
+ // sind mehrere Eintraege selektiert, dann muss nach jedem delete
+ // das Array neu gefuellt werden. Damit man sich nichts merken muss,
+ // beginnt das Loeschen am Ende
+ SvLBoxEntry* pSelEntry = LastSelected();
+ SwGlblDocContents* pTempContents = 0;
+ pActiveShell->StartAction();
+ while(pSelEntry)
+ {
+ pActiveShell->DeleteGlobalDocContent(
+ pTempContents ? *pTempContents : *pSwGlblDocContents,
+ (USHORT)GetModel()->GetAbsPos(pSelEntry));
+ pSelEntry = PrevSelected(pSelEntry);
+ if(pSelEntry)
+ {
+ pTempContents = new SwGlblDocContents;
+ pActiveShell->GetGlobalDocContent(*pTempContents);
+ }
+ }
+ delete pTempContents;
+ pActiveShell->EndAction();
+ pCont = 0;
+ }
+ break;
+ case CTX_INSERT_ANY_INDEX:
+// case CTX_INSERT_CNTIDX:
+// case CTX_INSERT_USRIDX:
+ {
+ if(pContCopy)
+ {
+ SfxItemSet aSet(pActiveShell->GetView().GetPool(),
+ RES_COL, RES_COL,
+ RES_BACKGROUND, RES_BACKGROUND,
+ RES_FRM_SIZE, RES_FRM_SIZE,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ RES_LR_SPACE, RES_LR_SPACE,
+ FN_PARAM_TOX_TYPE, FN_PARAM_TOX_TYPE,
+ 0);
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractMultiTOXTabDialog* pDlg = pFact->CreateMultiTOXTabDialog( DLG_MULTI_TOX,
+ this, aSet,
+ *pActiveShell,
+ 0,
+ USHRT_MAX,
+ TRUE);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if(RET_OK == pDlg->Execute())
+ {
+ SwTOXDescription& rDesc = pDlg->GetTOXDescription(
+ pDlg->GetCurrentTOXType());
+ SwTOXMgr aMgr(pActiveShell);
+ SwTOXBase* pToInsert = 0;
+ if(aMgr.UpdateOrInsertTOX(rDesc, &pToInsert, pDlg->GetOutputItemSet()))
+ pActiveShell->InsertGlobalDocContent( *pContCopy, *pToInsert );
+ }
+ pCont = 0;
+ delete pDlg;
+ }
+ }
+ break;
+ case CTX_INSERT_FILE:
+ {
+ bDeleteContentCopy = false;
+ pDocContent = pContCopy;
+ InsertRegion( pContCopy );
+ pCont = NULL;
+ }
+ break;
+ case CTX_INSERT_NEW_FILE:
+ {
+ SfxViewFrame* pGlobFrm = pActiveShell->GetView().GetViewFrame();
+ SwGlobalFrameListener_Impl aFrmListener(*pGlobFrm);
+
+ ULONG nEntryPos = pEntry ? GetModel()->GetAbsPos(pEntry) : (ULONG)-1;
+ // neues Dok anlegen
+ SfxStringItem aFactory(SID_NEWDOCDIRECT,
+ SwDocShell::Factory().GetFilterContainer()->GetName());
+
+ const SfxFrameItem* pItem = (SfxFrameItem*)
+ rDispatch.Execute(SID_NEWDOCDIRECT,
+ SFX_CALLMODE_SYNCHRON, &aFactory, 0L);
+
+ // sichern unter
+ SfxFrame* pFrm = pItem ? pItem->GetFrame() : 0;
+ SfxViewFrame* pFrame = pFrm ? pFrm->GetCurrentViewFrame() : 0;
+ if( pFrame )
+ {
+ const SfxBoolItem* pBool = (const SfxBoolItem*)
+ pFrame->GetDispatcher()->Execute(
+ SID_SAVEASDOC, SFX_CALLMODE_SYNCHRON );
+ SfxObjectShell& rObj = *pFrame->GetObjectShell();
+ const SfxMedium* pMedium = rObj.GetMedium();
+ String sNewFile(pMedium->GetURLObject().GetMainURL(INetURLObject::DECODE_TO_IURI));
+ // Bereich mit dem Dok-Namen einfuegen
+ // eigenes Dok in den Vordergrund
+
+ if(aFrmListener.IsValid() && sNewFile.Len())
+ {
+ pGlobFrm->ToTop();
+ // durch das Update sind die Eintraege invalid
+ if(nEntryPos != (ULONG)-1)
+ {
+ Update( FALSE );
+ Display();
+ Select(GetModel()->GetEntryAtAbsPos(nEntryPos));
+ pEntry = FirstSelected();
+ pCont = pEntry ? (SwGlblDocContent*)pEntry->GetUserData() : 0;
+ }
+ else
+ {
+ pEntry = 0;
+ pCont = 0;
+ }
+ if(pBool->GetValue())
+ {
+ InsertRegion(pCont, &sNewFile);
+ pFrame->ToTop();
+ }
+ else
+ pFrame->GetDispatcher()->Execute(SID_CLOSEWIN,
+ SFX_CALLMODE_SYNCHRON);
+ }
+ else
+ {
+ pFrame->ToTop();
+ return;
+ }
+ }
+ }
+ break;
+ case CTX_INSERT_TEXT:
+ {
+ if(pCont)
+ pActiveShell->InsertGlobalDocContent(*pCont);
+ else
+ {
+ pActiveShell->SplitNode(); // leeres Dokument
+ pActiveShell->Up( FALSE, 1 );
+ }
+ pActiveShell->GetView().GetEditWin().GrabFocus();
+ }
+ break;
+ case CTX_UPDATE:
+ pCont = 0;
+ break;
+ default:;
+ // hier passiert nichts
+ }
+ if(pCont)
+ GotoContent(pCont);
+ if(nSlot)
+ rDispatch.Execute(nSlot);
+ if(Update( FALSE ))
+ Display();
+ if ( bDeleteContentCopy )
+ delete pContCopy;
+ else
+ bDeleteContentCopy = true;
+// return TRUE;
+}
+
+/*-----------------16.06.97 07:57-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwGlobalTree, Timeout, Timer*, EMPTYARG )
+{
+ if(!HasFocus() && Update( FALSE ))
+ Display();
+ return 0;
+}
+
+/*-----------------13.06.97 16:56-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::GotoContent(const SwGlblDocContent* pCont)
+{
+ pActiveShell->EnterStdMode();
+
+ switch( pCont->GetType() )
+ {
+ case GLBLDOC_UNKNOWN:
+ pActiveShell->GotoGlobalDocContent(*pCont);
+ break;
+ case GLBLDOC_TOXBASE:
+ {
+ String sName = pCont->GetTOX()->GetTOXName();
+ if (!pActiveShell->GotoNextTOXBase(&sName))
+ pActiveShell->GotoPrevTOXBase(&sName);
+ }
+ break;
+ case GLBLDOC_SECTION:
+ break;
+ }
+
+}
+/*-----------------16.06.97 07:42-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::ShowTree()
+{
+ aUpdateTimer.Start();
+ SvTreeListBox::Show();
+}
+/*-----------------16.06.97 07:42-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::HideTree()
+{
+ aUpdateTimer.Stop();
+ SvTreeListBox::Hide();
+}
+/*-----------------18.06.97 10:02-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::ExecCommand(USHORT nCmd)
+{
+ SvLBoxEntry* pEntry = FirstSelected();
+ DBG_ASSERT(pEntry, "gleich knallt's");
+ if(FN_GLOBAL_EDIT == nCmd)
+ {
+ const SwGlblDocContent* pCont = (const SwGlblDocContent*)
+ pEntry->GetUserData();
+ EditContent(pCont);
+ }
+ else
+ {
+ if(GetSelectionCount() == 1)
+ {
+ BOOL bMove = FALSE;
+ USHORT nSource = (USHORT)GetModel()->GetAbsPos(pEntry);
+ USHORT nDest = nSource;
+ switch(nCmd)
+ {
+ case FN_ITEM_DOWN:
+ {
+ USHORT nEntryCount = (USHORT)GetEntryCount();
+ bMove = nEntryCount > nSource + 1;
+ nDest+= 2;
+ }
+ break;
+ case FN_ITEM_UP:
+ {
+ if(nSource)
+ bMove = 0 != nSource;
+ nDest--;
+ }
+ break;
+ }
+ if( bMove && pActiveShell->MoveGlobalDocContent(
+ *pSwGlblDocContents, nSource, nSource + 1, nDest ) &&
+ Update( FALSE ))
+ Display();
+ }
+ }
+}
+
+/*-----------------16.06.97 07:43-------------------
+
+--------------------------------------------------*/
+BOOL SwGlobalTree::Update(BOOL bHard)
+{
+ SwView* pActView = GetParentWindow()->GetCreateView();
+ BOOL bRet = FALSE;
+ if(pActView && pActView->GetWrtShellPtr())
+ {
+ const SwWrtShell* pOldShell = pActiveShell;
+ pActiveShell = pActView->GetWrtShellPtr();
+ if(pActiveShell != pOldShell)
+ {
+ delete pSwGlblDocContents;
+ pSwGlblDocContents = 0;
+ }
+ if(!pSwGlblDocContents)
+ {
+ pSwGlblDocContents = new SwGlblDocContents;
+ bRet = TRUE;
+ pActiveShell->GetGlobalDocContent(*pSwGlblDocContents);
+ }
+ else
+ {
+ BOOL bCopy = FALSE;
+ SwGlblDocContents* pTempContents = new SwGlblDocContents;
+ pActiveShell->GetGlobalDocContent(*pTempContents);
+ if(pTempContents->Count() != pSwGlblDocContents->Count() ||
+ pTempContents->Count() != GetEntryCount())
+ {
+ bRet = TRUE;
+ bCopy = TRUE;
+ }
+ else
+ {
+ for(USHORT i = 0; i < pTempContents->Count() && !bCopy; i++)
+ {
+ SwGlblDocContent* pLeft = pTempContents->GetObject(i);
+ SwGlblDocContent* pRight = pSwGlblDocContents->GetObject(i);
+ GlobalDocContentType eType = pLeft->GetType();
+ SvLBoxEntry* pEntry = GetEntry(i);
+ String sTemp = GetEntryText(pEntry);
+ if (
+ eType != pRight->GetType() ||
+ (
+ eType == GLBLDOC_SECTION &&
+ pLeft->GetSection()->GetSectionName() != sTemp
+ ) ||
+ (
+ eType == GLBLDOC_TOXBASE &&
+ pLeft->GetTOX()->GetTitle() != sTemp
+ )
+ )
+ {
+ bCopy = bRet = TRUE;
+ }
+ }
+ }
+ if(bCopy || bHard)
+ {
+ USHORT i;
+
+ pSwGlblDocContents->DeleteAndDestroy(0, pSwGlblDocContents->Count());
+ for( i = 0; i < pTempContents->Count(); i++)
+ {
+ pSwGlblDocContents->Insert(pTempContents->GetObject(i));
+ }
+ for( i = pTempContents->Count(); i; i--)
+ pTempContents->Remove(i - 1);
+
+ }
+ delete pTempContents;
+ }
+
+ }
+ else
+ {
+ Clear();
+ if(pSwGlblDocContents)
+ pSwGlblDocContents->DeleteAndDestroy(0, pSwGlblDocContents->Count());
+ }
+ // hier muss noch eine Veraenderungspruefung rein!
+ return bRet;
+}
+
+/*-----------------25.06.97 16:20-------------------
+
+--------------------------------------------------*/
+void SwGlobalTree::OpenDoc(const SwGlblDocContent* pCont)
+{
+ String sFileName(pCont->GetSection()->GetLinkFileName().GetToken(0,
+ sfx2::cTokenSeperator));
+ BOOL bFound = FALSE;
+ const SfxObjectShell* pCurr = SfxObjectShell::GetFirst();
+ while( !bFound && pCurr )
+ {
+ if(pCurr->GetMedium() &&
+ String(pCurr->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DECODE_TO_IURI)) == sFileName)
+ {
+ bFound = TRUE;
+ SwGlobalTree::SetShowShell(pCurr);
+ Application::PostUserEvent( STATIC_LINK(
+ this, SwGlobalTree, ShowFrameHdl ) );
+ pCurr = 0;
+ }
+ else
+ pCurr = SfxObjectShell::GetNext(*pCurr);
+ }
+ if(!bFound)
+ {
+ SfxStringItem aURL(SID_FILE_NAME,
+ sFileName);
+ SfxBoolItem aReadOnly(SID_DOC_READONLY, FALSE);
+ SfxStringItem aTargetFrameName( SID_TARGETNAME, String::CreateFromAscii("_blank") );
+ SfxStringItem aReferer(SID_REFERER, pActiveShell->GetView().GetDocShell()->GetTitle());
+ pActiveShell->GetView().GetViewFrame()->GetDispatcher()->
+ Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON,
+ &aURL, &aReadOnly, &aReferer, &aTargetFrameName, 0L);
+ }
+}
+
+/*-----------------25.06.97 16:08-------------------
+
+--------------------------------------------------*/
+IMPL_LINK( SwGlobalTree, DoubleClickHdl, SwGlobalTree *, EMPTYARG )
+{
+ SvLBoxEntry* pEntry = GetCurEntry();
+ SwGlblDocContent* pCont = (SwGlblDocContent*)pEntry->GetUserData();
+ if(pCont->GetType() == GLBLDOC_SECTION)
+ OpenDoc(pCont);
+ else
+ {
+ GotoContent(pCont);
+ pActiveShell->GetView().GetEditWin().GrabFocus();
+ }
+ return 0;
+}
+
+/*-----------------07.10.97 08:09-------------------
+
+--------------------------------------------------*/
+IMPL_STATIC_LINK_NOINSTANCE(SwGlobalTree, ShowFrameHdl, SwGlobalTree*, EMPTYARG)
+{
+ if(SwGlobalTree::GetShowShell())
+ SfxViewFrame::GetFirst(SwGlobalTree::GetShowShell())->ToTop();
+ SwGlobalTree::SetShowShell(0);
+ return 0;
+}
+/* -----------------04.11.98 10:43-------------------
+ *
+ * --------------------------------------------------*/
+void SwGlobalTree::InitEntry(SvLBoxEntry* pEntry,
+ const XubString& rStr ,const Image& rImg1,const Image& rImg2,
+ SvLBoxButtonKind eButtonKind)
+{
+ USHORT nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2"
+ SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
+ SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite );
+ SwLBoxString* pStr = new SwLBoxString( pEntry, 0, pCol->GetText() );
+ pEntry->ReplaceItem( pStr, nColToHilite );
+}
+/* -----------------04.11.98 10:39-------------------
+ *
+ * --------------------------------------------------*/
+
+void SwLBoxString::Paint( const Point& rPos, SvLBox& rDev, USHORT nFlags,
+ SvLBoxEntry* pEntry )
+{
+ SwGlblDocContent* pCont = (SwGlblDocContent*)pEntry->GetUserData();
+ const SwSection* pSect;
+ if(pCont->GetType() == GLBLDOC_SECTION &&
+ !(pSect = pCont->GetSection())->IsConnectFlag() )
+ {
+ Font aOldFont( rDev.GetFont());
+ Font aFont(aOldFont);
+ Color aCol( COL_LIGHTRED );
+ aFont.SetColor( aCol );
+ rDev.SetFont( aFont );
+ rDev.DrawText( rPos, GetText() );
+ rDev.SetFont( aOldFont );
+ }
+ else
+ SvLBoxString::Paint( rPos, rDev, nFlags, pEntry);
+}
+/* -----------------------------06.05.2002 10:20------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwGlobalTree::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ USHORT nResId = GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP;
+ aEntryImages = ImageList(SW_RES(nResId));
+ Update(sal_True);
+ }
+ SvTreeListBox::DataChanged( rDCEvt );
+}
+
+void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequence< OUString >& _rFiles )
+{
+ sal_Int32 nFiles = _rFiles.getLength();
+ if ( nFiles )
+ {
+ BOOL bMove = FALSE;
+ if ( !_pContent )
+ {
+ SvLBoxEntry* pLast = (SvLBoxEntry*)LastVisible();
+ _pContent = (SwGlblDocContent*)pLast->GetUserData();
+ bMove = TRUE;
+ }
+ String sFilePassword;
+ USHORT nEntryCount = (USHORT)GetEntryCount();
+ const OUString* pFileNames = _rFiles.getConstArray();
+ SwWrtShell& rSh = GetParentWindow()->GetCreateView()->GetWrtShell();
+ rSh.StartAction();
+ // after insertion of the first new content the 'pCont' parameter becomes invalid
+ // find the index of the 'anchor' content to always use a current anchor content
+ USHORT nAnchorContent = pSwGlblDocContents->Count() - 1;
+ if ( !bMove )
+ {
+ for( USHORT nContent = 0; nContent < pSwGlblDocContents->Count(); ++nContent )
+ {
+ if( *_pContent == *pSwGlblDocContents->GetObject( nContent ) )
+ {
+ nAnchorContent = nContent;
+ break;
+ }
+ }
+ }
+ SwGlblDocContents aTempContents;
+ for ( sal_Int32 nFile = 0; nFile < nFiles; ++nFile )
+ {
+ //update the global document content after each inserted document
+ rSh.GetGlobalDocContent(aTempContents);
+ SwGlblDocContent* pAnchorContent = 0;
+ DBG_ASSERT(aTempContents.Count() > (nAnchorContent + nFile), "invalid anchor content -> last insertion failed");
+ if ( aTempContents.Count() > (nAnchorContent + nFile) )
+ pAnchorContent = aTempContents.GetObject(nAnchorContent + (USHORT)nFile);
+ else
+ pAnchorContent = aTempContents.GetObject(aTempContents.Count() - 1);
+ String sFileName(pFileNames[nFile]);
+ INetURLObject aFileUrl;
+ aFileUrl.SetSmartURL( sFileName );
+ String sSectionName(String(aFileUrl.GetLastName(
+ INetURLObject::DECODE_UNAMBIGUOUS)).GetToken(0,
+ sfx2::cTokenSeperator));
+ USHORT nSectCount = rSh.GetSectionFmtCount();
+ String sTempSectionName(sSectionName);
+ USHORT nAddNumber = 0;
+ USHORT nCount = 0;
+ // evtl : und Index anhaengen, wenn der Bereichsname schon vergeben ist
+ while ( nCount < nSectCount )
+ {
+ const SwSectionFmt& rFmt = rSh.GetSectionFmt(nCount);
+ if ((rFmt.GetSection()->GetSectionName() == sTempSectionName)
+ && rFmt.IsInNodesArr())
+ {
+ nCount = 0;
+ nAddNumber++;
+ sTempSectionName = sSectionName;
+ sTempSectionName += ':';
+ sTempSectionName += String::CreateFromInt32( nAddNumber );
+ }
+ else
+ nCount++;
+ }
+
+ if ( nAddNumber )
+ sSectionName = sTempSectionName;
+
+ SwSectionData aSectionData(CONTENT_SECTION, sSectionName);
+ aSectionData.SetProtectFlag(true);
+ aSectionData.SetHidden(false);
+
+ aSectionData.SetLinkFileName(sFileName);
+ aSectionData.SetType(FILE_LINK_SECTION);
+ aSectionData.SetLinkFilePassword( sFilePassword );
+
+ rSh.InsertGlobalDocContent( *pAnchorContent, aSectionData );
+ }
+ if ( bMove )
+ {
+ Update( FALSE );
+ rSh.MoveGlobalDocContent(
+ *pSwGlblDocContents, nEntryCount, nEntryCount + (USHORT)nFiles, nEntryCount - (USHORT)nFiles );
+ }
+ rSh.EndAction();
+ Update( FALSE );
+ Display();
+ }
+}
+
+IMPL_LINK( SwGlobalTree, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg )
+{
+ Application::SetDefDialogParent( pDefParentWin );
+ if ( ERRCODE_NONE == _pFileDlg->GetError() )
+ {
+ SfxMediumList* pMedList = pDocInserter->CreateMediumList();
+ if ( pMedList )
+ {
+ Sequence< OUString >aFileNames( pMedList->Count() );
+ OUString* pFileNames = aFileNames.getArray();
+ SfxMedium* pMed = pMedList->First();
+ sal_Int32 nPos = 0;
+ while ( pMed )
+ {
+ String sFileName = pMed->GetURLObject().GetMainURL( INetURLObject::NO_DECODE );
+ sFileName += sfx2::cTokenSeperator;
+ sFileName += pMed->GetFilter()->GetFilterName();
+ sFileName += sfx2::cTokenSeperator;
+ pFileNames[nPos++] = sFileName;
+ pMed = pMedList->Next();
+ }
+ delete pMedList;
+ InsertRegion( pDocContent, aFileNames );
+ DELETEZ( pDocContent );
+ }
+ }
+ return 0;
+}
+
diff --git a/sw/source/ui/utlui/gloslst.cxx b/sw/source/ui/utlui/gloslst.cxx
new file mode 100644
index 000000000000..5c3350346201
--- /dev/null
+++ b/sw/source/ui/utlui/gloslst.cxx
@@ -0,0 +1,514 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#define _SVSTDARR_STRINGSDTOR
+#define _SVSTDARR_STRINGSISORTDTOR
+#define _SVSTDARR_STRINGS
+#include <svl/svstdarr.hxx>
+#include <tools/urlobj.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/msgbox.hxx>
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+#ifndef SVTOOLS_FSTATHELPER_HXX
+#include <svl/fstathelper.hxx>
+#endif
+#include <unotools/pathoptions.hxx>
+#include <unotools/transliterationwrapper.hxx>
+#include <swtypes.hxx>
+#include <swmodule.hxx>
+#include <shellio.hxx>
+#include <initui.hxx>
+#include <glosdoc.hxx>
+#include <gloslst.hxx>
+#include <swunohelper.hxx>
+
+#ifndef _UTLUI_HRC
+#include <utlui.hrc>
+#endif
+#ifndef _GLOSLST_HRC
+#include <gloslst.hrc>
+#endif
+
+
+#define STRING_DELIM (char)0x0A
+#define GLOS_TIMEOUT 30000 // alle 30 s updaten
+#define FIND_MAX_GLOS 20
+
+
+struct TripleString
+{
+ String sGroup;
+ String sBlock;
+ String sShort;
+};
+
+typedef TripleString* TripleStringPtr;
+SV_DECL_PTRARR_DEL( TripleStrings, TripleStringPtr, 0, 4 )
+SV_IMPL_PTRARR( TripleStrings, TripleStringPtr )
+
+class SwGlossDecideDlg : public ModalDialog
+{
+ OKButton aOk;
+ CancelButton aCancel;
+ HelpButton aHelp;
+ ListBox aListLB;
+ FixedLine aFL;
+
+ DECL_LINK(DoubleClickHdl, ListBox*);
+ DECL_LINK(SelectHdl, ListBox*);
+
+ public:
+ SwGlossDecideDlg(Window* pParent);
+ ListBox& GetListBox() {return aListLB;}
+};
+
+/*-----------------21.01.97 13.25-------------------
+
+--------------------------------------------------*/
+
+SwGlossDecideDlg::SwGlossDecideDlg(Window* pParent) :
+ ModalDialog(pParent, SW_RES(DLG_GLOSSARY_DECIDE_DLG)),
+ aOk(this, SW_RES(PB_OK)),
+ aCancel(this, SW_RES(PB_CANCEL)),
+ aHelp(this, SW_RES(PB_HELP)),
+ aListLB(this, SW_RES(LB_LIST)),
+ aFL(this, SW_RES(FL_GLOSS))
+{
+ FreeResource();
+ aListLB.SetDoubleClickHdl(LINK(this, SwGlossDecideDlg, DoubleClickHdl));
+ aListLB.SetSelectHdl(LINK(this, SwGlossDecideDlg, SelectHdl));
+}
+
+/*-----------------21.01.97 13.25-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK(SwGlossDecideDlg, DoubleClickHdl, ListBox*, EMPTYARG)
+{
+ EndDialog(RET_OK);
+ return 0;
+}
+/*-----------------21.01.97 13.29-------------------
+
+--------------------------------------------------*/
+
+IMPL_LINK(SwGlossDecideDlg, SelectHdl, ListBox*, EMPTYARG)
+{
+ aOk.Enable(LISTBOX_ENTRY_NOTFOUND != aListLB.GetSelectEntryPos());
+ return 0;
+}
+
+/********************************************************************
+
+********************************************************************/
+
+
+SwGlossaryList::SwGlossaryList() :
+ bFilled(FALSE)
+{
+ SvtPathOptions aPathOpt;
+ sPath = aPathOpt.GetAutoTextPath();
+ SetTimeout(GLOS_TIMEOUT);
+}
+
+/********************************************************************
+
+********************************************************************/
+
+
+SwGlossaryList::~SwGlossaryList()
+{
+ ClearGroups();
+}
+
+/********************************************************************
+ * Wenn der GroupName bereits bekannt ist, dann wird nur
+ * rShortName gefuellt, sonst wird rGroupName ebenfals gesetzt und
+ * bei Bedarf nach der richtigen Gruppe gefragt
+********************************************************************/
+
+
+BOOL SwGlossaryList::GetShortName(const String& rLongName,
+ String& rShortName, String& rGroupName )
+{
+ if(!bFilled)
+ Update();
+
+ TripleStrings aTripleStrings;
+
+ USHORT nCount = aGroupArr.Count();
+ USHORT nFound = 0;
+ for(USHORT i = 0; i < nCount; i++ )
+ {
+ AutoTextGroup* pGroup = aGroupArr.GetObject(i);
+ if(!rGroupName.Len() || rGroupName == pGroup->sName)
+ for(USHORT j = 0; j < pGroup->nCount; j++)
+ {
+ String sLong = pGroup->sLongNames.GetToken(j, STRING_DELIM);
+ if((rLongName == sLong))
+ {
+ TripleString* pTriple = new TripleString;
+ pTriple->sGroup = pGroup->sName;
+ pTriple->sBlock = sLong;
+ pTriple->sShort = pGroup->sShortNames.GetToken(j, STRING_DELIM);
+ aTripleStrings.Insert(pTriple, nFound++);
+ }
+ }
+ }
+
+ BOOL bRet = FALSE;
+ nCount = aTripleStrings.Count();
+ if(1 == nCount )
+ {
+ TripleString* pTriple = aTripleStrings[0];
+ rShortName = pTriple->sShort;
+ rGroupName = pTriple->sGroup;
+ bRet = TRUE;
+ }
+ else if(1 < nCount)
+ {
+ SwGlossDecideDlg aDlg(0);
+ String sTitle = aDlg.GetText();
+ sTitle += ' ';
+ sTitle += aTripleStrings[0]->sBlock;
+ aDlg.SetText(sTitle);
+
+ ListBox& rLB = aDlg.GetListBox();
+ for(USHORT i = 0; i < nCount; i++ )
+ rLB.InsertEntry(aTripleStrings[i]->sGroup.GetToken(0, GLOS_DELIM));
+
+ rLB.SelectEntryPos(0);
+ if(RET_OK == aDlg.Execute() &&
+ LISTBOX_ENTRY_NOTFOUND != rLB.GetSelectEntryPos())
+ {
+ TripleString* pTriple = aTripleStrings[rLB.GetSelectEntryPos()];
+ rShortName = pTriple->sShort;
+ rGroupName = pTriple->sGroup;
+ bRet = TRUE;
+ }
+ else
+ bRet = FALSE;
+ }
+ return bRet;
+}
+
+/********************************************************************
+
+********************************************************************/
+
+
+USHORT SwGlossaryList::GetGroupCount()
+{
+ if(!bFilled)
+ Update();
+ return aGroupArr.Count();
+}
+
+/********************************************************************
+
+********************************************************************/
+
+
+String SwGlossaryList::GetGroupName(USHORT nPos, BOOL bNoPath, String* pTitle)
+{
+ DBG_ASSERT(aGroupArr.Count() > nPos, "Gruppe nicht vorhanden");
+ String sRet(aEmptyStr);
+ if(nPos < aGroupArr.Count())
+ {
+ AutoTextGroup* pGroup = aGroupArr.GetObject(nPos);
+ sRet = pGroup->sName;
+ if(bNoPath)
+ sRet = sRet.GetToken(0, GLOS_DELIM);
+ if(pTitle)
+ *pTitle = pGroup->sTitle;
+ }
+ return sRet;
+
+}
+
+/********************************************************************
+
+********************************************************************/
+
+
+USHORT SwGlossaryList::GetBlockCount(USHORT nGroup)
+{
+ DBG_ASSERT(aGroupArr.Count() > nGroup, "Gruppe nicht vorhanden");
+ if(nGroup < aGroupArr.Count())
+ {
+ AutoTextGroup* pGroup = aGroupArr.GetObject(nGroup);
+ return pGroup->nCount;
+ }
+ return 0;
+}
+
+/********************************************************************
+
+********************************************************************/
+
+
+String SwGlossaryList::GetBlockName(USHORT nGroup, USHORT nBlock, String& rShortName)
+{
+ DBG_ASSERT(aGroupArr.Count() > nGroup, "Gruppe nicht vorhanden");
+ if(nGroup < aGroupArr.Count())
+ {
+ AutoTextGroup* pGroup = aGroupArr.GetObject(nGroup);
+ rShortName = pGroup->sShortNames.GetToken(nBlock, STRING_DELIM);
+ return pGroup->sLongNames.GetToken(nBlock, STRING_DELIM);
+ }
+ return aEmptyStr;
+}
+
+/********************************************************************
+
+********************************************************************/
+
+
+void SwGlossaryList::Update()
+{
+ if(!IsActive())
+ Start();
+
+ SvtPathOptions aPathOpt;
+ String sTemp( aPathOpt.GetAutoTextPath() );
+ if(sTemp != sPath)
+ {
+ sPath = sTemp;
+ bFilled = FALSE;
+ ClearGroups();
+ }
+ SwGlossaries* pGlossaries = ::GetGlossaries();
+ const SvStrings* pPathArr = pGlossaries->GetPathArray();
+ String sExt( SwGlossaries::GetExtension() );
+ if(!bFilled)
+ {
+ USHORT nGroupCount = pGlossaries->GetGroupCnt();
+ for(USHORT i = 0; i < nGroupCount; i++)
+ {
+ String sGrpName = pGlossaries->GetGroupName(i);
+ USHORT nPath = (USHORT)sGrpName.GetToken(1, GLOS_DELIM).ToInt32();
+ if(nPath < pPathArr->Count())
+ {
+ AutoTextGroup* pGroup = new AutoTextGroup;
+ pGroup->sName = sGrpName;
+
+ FillGroup(pGroup, pGlossaries);
+ String sName = *(*pPathArr)[nPath];
+ sName += INET_PATH_TOKEN;
+ sName += pGroup->sName.GetToken(0, GLOS_DELIM);
+ sName += sExt;
+
+ FStatHelper::GetModifiedDateTimeOfFile( sName,
+ &pGroup->aDateModified,
+ &pGroup->aDateModified );
+
+ aGroupArr.Insert( pGroup, i );
+ }
+ }
+ bFilled = TRUE;
+ }
+ else
+ {
+ for(USHORT nPath = 0; nPath < pPathArr->Count(); nPath++)
+ {
+ SvStringsDtor aFoundGroupNames;
+ SvStrings aFiles( 16, 16 );
+ SvPtrarr aDateTimeArr( 16, 16 );
+
+ SWUnoHelper::UCB_GetFileListOfFolder( *(*pPathArr)[nPath], aFiles,
+ &sExt, &aDateTimeArr );
+ for( USHORT nFiles = 0, nFEnd = aFiles.Count();
+ nFiles < nFEnd; ++nFiles )
+ {
+ String* pTitle = aFiles[ nFiles ];
+ ::DateTime* pDT = (::DateTime*) aDateTimeArr[ nFiles ];
+
+ String sName( pTitle->Copy( 0, pTitle->Len() - sExt.Len() ));
+
+ aFoundGroupNames.Insert( new String(sName),
+ aFoundGroupNames.Count());
+ sName += GLOS_DELIM;
+ sName += String::CreateFromInt32( nPath );
+ AutoTextGroup* pFound = FindGroup( sName );
+ if( !pFound )
+ {
+ pFound = new AutoTextGroup;
+ pFound->sName = sName;
+ FillGroup( pFound, pGlossaries );
+ pFound->aDateModified = *pDT;
+
+ aGroupArr.Insert(pFound, aGroupArr.Count());
+ }
+ else if( pFound->aDateModified < *pDT )
+ {
+ FillGroup(pFound, pGlossaries);
+ pFound->aDateModified = *pDT;
+ }
+
+ // don't need any more these pointers
+ delete pTitle;
+ delete pDT;
+ }
+
+ USHORT nArrCount = aGroupArr.Count();
+ for( USHORT i = nArrCount; i; --i)
+ {
+ // evtl. geloeschte Gruppen entfernen
+ AutoTextGroup* pGroup = aGroupArr.GetObject(i - 1);
+ USHORT nGroupPath = (USHORT)pGroup->sName.GetToken( 1,
+ GLOS_DELIM).ToInt32();
+ // nur die Gruppen werden geprueft, die fuer den
+ // aktuellen Teilpfad registriert sind
+ if(nGroupPath == nPath)
+ {
+ BOOL bFound = FALSE;
+ String sCompareGroup = pGroup->sName.GetToken(0, GLOS_DELIM);
+ for( USHORT j = 0; j < aFoundGroupNames.Count() && !bFound; ++j)
+ {
+ bFound = sCompareGroup == *aFoundGroupNames[j];
+ }
+ if(!bFound)
+ {
+ aGroupArr.Remove(i - 1);
+ delete pGroup;
+ }
+ }
+ }
+ }
+ }
+}
+
+/********************************************************************
+
+********************************************************************/
+
+
+void SwGlossaryList::Timeout()
+{
+ // nur, wenn eine SwView den Fokus hat, wird automatisch upgedated
+ if(::GetActiveView())
+ Update();
+}
+
+/********************************************************************
+
+********************************************************************/
+
+
+AutoTextGroup* SwGlossaryList::FindGroup(const String& rGroupName)
+{
+ for(USHORT i = 0; i < aGroupArr.Count(); i++)
+ {
+ AutoTextGroup* pRet = aGroupArr.GetObject(i);
+ if(pRet->sName == rGroupName)
+ return pRet;
+ }
+ return 0;
+}
+
+/********************************************************************
+
+********************************************************************/
+
+
+void SwGlossaryList::FillGroup(AutoTextGroup* pGroup, SwGlossaries* pGlossaries)
+{
+ SwTextBlocks* pBlock = pGlossaries->GetGroupDoc(pGroup->sName);
+ pGroup->nCount = pBlock ? pBlock->GetCount() : 0;
+ pGroup->sLongNames = pGroup->sShortNames = aEmptyStr;
+ if(pBlock)
+ pGroup->sTitle = pBlock->GetName();
+
+ for(USHORT j = 0; j < pGroup->nCount; j++)
+ {
+ pGroup->sLongNames += pBlock->GetLongName(j);
+ pGroup->sLongNames += STRING_DELIM;
+ pGroup->sShortNames += pBlock->GetShortName(j);
+ pGroup->sShortNames += STRING_DELIM;
+ }
+ pGlossaries->PutGroupDoc(pBlock);
+}
+
+/********************************************************************
+ Alle (nicht mehr als FIND_MAX_GLOS) gefunden Bausteine mit
+ passendem Anfang zurueckgeben
+********************************************************************/
+
+BOOL SwGlossaryList::HasLongName(const String& rBegin, SvStringsISortDtor* pLongNames )
+{
+ if(!bFilled)
+ Update();
+ USHORT nFound = 0;
+ USHORT nCount = aGroupArr.Count();
+ USHORT nBeginLen = rBegin.Len();
+ const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore();
+
+ for(USHORT i = 0; i < nCount; i++ )
+ {
+ AutoTextGroup* pGroup = aGroupArr.GetObject(i);
+ for(USHORT j = 0; j < pGroup->nCount; j++)
+ {
+ String sBlock = pGroup->sLongNames.GetToken(j, STRING_DELIM);
+ if( rSCmp.isEqual( sBlock.Copy(0, nBeginLen), rBegin ) &&
+ nBeginLen + 1 < sBlock.Len())
+ {
+ String* pBlock = new String(sBlock);
+ pLongNames->Insert(pBlock);
+ nFound++;
+ if(FIND_MAX_GLOS == nFound)
+ break;
+ }
+ }
+ }
+ return nFound > 0;
+}
+
+/********************************************************************
+
+********************************************************************/
+void SwGlossaryList::ClearGroups()
+{
+ USHORT nCount = aGroupArr.Count();
+ for( USHORT i = 0; i < nCount; ++i )
+ delete aGroupArr.GetObject( i );
+
+ aGroupArr.Remove( 0, nCount );
+ bFilled = FALSE;
+}
+
+
diff --git a/sw/source/ui/utlui/gloslst.hrc b/sw/source/ui/utlui/gloslst.hrc
new file mode 100644
index 000000000000..6c89f1c5ac9c
--- /dev/null
+++ b/sw/source/ui/utlui/gloslst.hrc
@@ -0,0 +1,38 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _INITUI_HRC
+#define _INITUI_HRC
+
+#define FL_GLOSS 1
+#define PB_OK 2
+#define PB_HELP 3
+#define PB_CANCEL 4
+#define LB_LIST 5
+
+#endif
+
diff --git a/sw/source/ui/utlui/gloslst.src b/sw/source/ui/utlui/gloslst.src
new file mode 100644
index 000000000000..d4140fc64d80
--- /dev/null
+++ b/sw/source/ui/utlui/gloslst.src
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "utlui.hrc"
+#include "helpid.h"
+#include "gloslst.hrc"
+
+ModalDialog DLG_GLOSSARY_DECIDE_DLG
+{
+ HelpID = HID_DLG_GLOSS_DECIDE ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 161 , 67 ) ;
+ Text [ en-US ] = "Select AutoText:" ;
+ Moveable = TRUE ;
+ FixedLine FL_GLOSS
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 93 , 8 ) ;
+ Text [ en-US ] = "AutoText - Group" ;
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 105 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 105 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 105 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ ListBox LB_LIST
+ {
+ HelpID = "sw:ListBox:DLG_GLOSSARY_DECIDE_DLG:LB_LIST";
+ Pos = MAP_APPFONT ( 12 , 15 ) ;
+ Size = MAP_APPFONT ( 81 , 40 ) ;
+ TabStop = TRUE ;
+ Border = TRUE ;
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/utlui/initui.cxx b/sw/source/ui/utlui/initui.cxx
new file mode 100644
index 000000000000..75e412a27eb6
--- /dev/null
+++ b/sw/source/ui/utlui/initui.cxx
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <unotools/localedatawrapper.hxx>
+#include <viewsh.hxx>
+#include <initui.hxx>
+#include <edtwin.hxx>
+#include <shellres.hxx>
+#include <fldbas.hxx>
+#include <glosdoc.hxx>
+#include <gloslst.hxx>
+
+#ifndef _UTLUI_HRC
+#include <utlui.hrc>
+#endif
+#ifndef _INITUI_HRC
+#include <initui.hrc>
+#endif
+#ifndef _COMCORE_HRC
+#include <comcore.hrc>
+#endif
+#include <authfld.hxx>
+#ifndef _DBMGR_HXX
+#include <dbmgr.hxx>
+#endif
+#include <unotools/syslocale.hxx>
+
+#include <unomid.h>
+
+/*--------------------------------------------------------------------
+ Beschreibung: globale Pointer
+ --------------------------------------------------------------------*/
+
+SwGlossaries* pGlossaries = 0;
+
+// Liefert alle benoetigten Pfade. Wird durch UI initialisiert
+SwGlossaryList* pGlossaryList = 0;
+
+String* pOldGrfCat = 0;
+String* pOldTabCat = 0;
+String* pOldFrmCat = 0;
+String* pOldDrwCat = 0;
+String* pCurrGlosGroup = 0;
+
+String* GetOldGrfCat()
+{
+ return pOldGrfCat;
+}
+String* GetOldTabCat()
+{
+ return pOldTabCat;
+}
+String* GetOldFrmCat()
+{
+ return pOldFrmCat;
+}
+String* GetOldDrwCat()
+{
+ return pOldDrwCat;
+}
+String* GetCurrGlosGroup()
+{
+ return pCurrGlosGroup;
+}
+void SetCurrGlosGroup(String* pStr)
+{
+ pCurrGlosGroup = pStr;
+}
+
+SvStringsDtor* pDBNameList = 0;
+
+SvStringsDtor* pAuthFieldNameList = 0;
+SvStringsDtor* pAuthFieldTypeList = 0;
+
+/*--------------------------------------------------------------------
+ Beschreibung: UI beenden
+ --------------------------------------------------------------------*/
+
+void _FinitUI()
+{
+ SwNewDBMgr::RemoveDbtoolsClient();
+ delete ViewShell::GetShellRes();
+ ViewShell::SetShellRes( 0 );
+
+ SwEditWin::_FinitStaticData();
+
+ DELETEZ(pGlossaries);
+
+ delete SwFieldType::pFldNames;
+
+ delete pOldGrfCat;
+ delete pOldTabCat;
+ delete pOldFrmCat;
+ delete pOldDrwCat;
+ delete pCurrGlosGroup;
+ delete pDBNameList;
+ delete pGlossaryList;
+ delete pAuthFieldNameList;
+ delete pAuthFieldTypeList;
+
+
+}
+/*--------------------------------------------------------------------
+ Beschreibung: Initialisierung
+ --------------------------------------------------------------------*/
+
+
+void _InitUI()
+{
+ // ShellResource gibt der CORE die Moeglichkeit mit Resourcen zu arbeiten
+ ViewShell::SetShellRes( new ShellResource );
+ pDBNameList = new SvStringsDtor( 5, 5 );
+ SwEditWin::_InitStaticData();
+}
+
+
+ShellResource::ShellResource()
+ : Resource( SW_RES(RID_SW_SHELLRES) ),
+ aPostItAuthor( SW_RES( STR_POSTIT_AUTHOR ) ),
+ aPostItPage( SW_RES( STR_POSTIT_PAGE ) ),
+ aPostItLine( SW_RES( STR_POSTIT_LINE ) ),
+
+ aCalc_Syntax( SW_RES( STR_CALC_SYNTAX ) ),
+ aCalc_ZeroDiv( SW_RES( STR_CALC_ZERODIV ) ),
+ aCalc_Brack( SW_RES( STR_CALC_BRACK ) ),
+ aCalc_Pow( SW_RES( STR_CALC_POW ) ),
+ aCalc_VarNFnd( SW_RES( STR_CALC_VARNFND ) ),
+ aCalc_Overflow( SW_RES( STR_CALC_OVERFLOW ) ),
+ aCalc_WrongTime( SW_RES( STR_CALC_WRONGTIME ) ),
+ aCalc_Default( SW_RES( STR_CALC_DEFAULT ) ),
+ aCalc_Error( SW_RES( STR_CALC_ERROR ) ),
+
+ aGetRefFld_Up( SW_RES( STR_GETREFFLD_UP ) ),
+ aGetRefFld_Down( SW_RES( STR_GETREFFLD_DOWN ) ),
+ // --> OD 2007-09-13 #i81002#
+ aGetRefFld_RefItemNotFound( SW_RES( STR_GETREFFLD_REFITEMNOTFOUND ) ),
+ // <--
+ aStrAllPageHeadFoot( SW_RES( STR_ALLPAGE_HEADFOOT ) ),
+ aStrNone( SW_RES( STR_TEMPLATE_NONE )),
+ aFixedStr( SW_RES( STR_FIELD_FIXED )),
+ sDurationFormat( SW_RES( STR_DURATION_FORMAT )),
+
+ aTOXIndexName( SW_RES(STR_TOI)),
+ aTOXUserName( SW_RES(STR_TOU)),
+ aTOXContentName( SW_RES(STR_TOC)),
+ aTOXIllustrationsName( SW_RES(STR_TOX_ILL)),
+ aTOXObjectsName( SW_RES(STR_TOX_OBJ)),
+ aTOXTablesName( SW_RES(STR_TOX_TBL)),
+ aTOXAuthoritiesName( SW_RES(STR_TOX_AUTH)),
+ aHyperlinkClick( SW_RES( STR_HYPERLINK_CLICK)),
+ pAutoFmtNameLst(0),
+ sPageDescFirstName( SW_RES(STR_PAGEDESC_FIRSTNAME)),
+ sPageDescFollowName( SW_RES(STR_PAGEDESC_FOLLOWNAME)),
+ sPageDescName( SW_RES(STR_PAGEDESC_NAME))
+{
+ const USHORT nCount = FLD_DOCINFO_END - FLD_DOCINFO_BEGIN;
+
+ KeyCode aCode( KEY_SPACE );
+ KeyCode aModifiedCode( KEY_SPACE, KEY_MOD1 );
+ String aModStr( aModifiedCode.GetName() );
+ aModStr.SearchAndReplace( aCode.GetName(), String() );
+ aModStr.SearchAndReplaceAllAscii( "+", String() );
+ aHyperlinkClick.SearchAndReplaceAllAscii( "%s", aModStr );
+
+ for(USHORT i = 0; i < nCount; ++i)
+ {
+ String* pNew = new SW_RESSTR(FLD_DOCINFO_BEGIN + i);
+ aDocInfoLst.Insert(pNew, aDocInfoLst.Count());
+ }
+
+ FreeResource();
+}
+
+ShellResource::~ShellResource()
+{
+ if( pAutoFmtNameLst )
+ delete pAutoFmtNameLst, pAutoFmtNameLst = 0;
+}
+
+String ShellResource::GetPageDescName( USHORT nNo, BOOL bIsFirst, BOOL bFollow )
+{
+ String sRet( bIsFirst ? sPageDescFirstName
+ : bFollow ? sPageDescFollowName
+ : sPageDescName );
+ sRet.SearchAndReplaceAscii( "$(ARG1)", String::CreateFromInt32( nNo ));
+ return sRet;
+}
+
+
+SwGlossaries* GetGlossaries()
+{
+ if (!pGlossaries)
+ pGlossaries = new SwGlossaries;
+ return (pGlossaries);
+}
+
+BOOL HasGlossaryList()
+{
+ return pGlossaryList != 0;
+}
+
+SwGlossaryList* GetGlossaryList()
+{
+ if(!pGlossaryList)
+ pGlossaryList = new SwGlossaryList();
+
+ return pGlossaryList;
+}
+
+struct ImpAutoFmtNameListLoader : public Resource
+{
+ ImpAutoFmtNameListLoader( SvStringsDtor& rLst );
+};
+
+void ShellResource::_GetAutoFmtNameLst() const
+{
+ SvStringsDtor** ppLst = (SvStringsDtor**)&pAutoFmtNameLst;
+ *ppLst = new SvStringsDtor( STR_AUTOFMTREDL_END );
+ ImpAutoFmtNameListLoader aTmp( **ppLst );
+}
+
+ImpAutoFmtNameListLoader::ImpAutoFmtNameListLoader( SvStringsDtor& rLst )
+ : Resource( ResId(RID_SHELLRES_AUTOFMTSTRS, *pSwResMgr) )
+{
+ for( USHORT n = 0; n < STR_AUTOFMTREDL_END; ++n )
+ {
+ String* p = new String( ResId( n + 1, *pSwResMgr) );
+ if(STR_AUTOFMTREDL_TYPO == n)
+ {
+#ifdef WNT
+ //fuer Windows Sonderbehandlung, da MS hier ein paar Zeichen im Dialogfont vergessen hat
+ p->SearchAndReplace(C2S("%1"), C2S(",,"));
+ p->SearchAndReplace(C2S("%2"), C2S("''"));
+#else
+ const SvtSysLocale aSysLocale;
+ const LocaleDataWrapper& rLclD = aSysLocale.GetLocaleData();
+ //unter richtigen Betriebssystemen funktioniert es auch so
+ p->SearchAndReplace(C2S("%1"), rLclD.getDoubleQuotationMarkStart());
+ p->SearchAndReplace(C2S("%2"), rLclD.getDoubleQuotationMarkEnd());
+#endif
+ }
+ rLst.Insert( p, n );
+ }
+ FreeResource();
+}
+/* -----------------16.09.99 12:28-------------------
+
+ --------------------------------------------------*/
+const String& SwAuthorityFieldType::GetAuthFieldName(ToxAuthorityField eType)
+{
+ if(!pAuthFieldNameList)
+ {
+ pAuthFieldNameList = new SvStringsDtor(AUTH_FIELD_END, 1);
+ for(USHORT i = 0; i < AUTH_FIELD_END; i++)
+ {
+ String* pTmp = new String(SW_RES(STR_AUTH_FIELD_START + i));
+ pAuthFieldNameList->Insert(pTmp, pAuthFieldNameList->Count());
+ }
+ }
+ return *pAuthFieldNameList->GetObject( static_cast< USHORT >(eType) );
+}
+/* -----------------16.09.99 12:29-------------------
+
+ --------------------------------------------------*/
+const String& SwAuthorityFieldType::GetAuthTypeName(ToxAuthorityType eType)
+{
+ if(!pAuthFieldTypeList)
+ {
+ pAuthFieldTypeList = new SvStringsDtor(AUTH_TYPE_END, 1);
+ for(USHORT i = 0; i < AUTH_TYPE_END; i++)
+ pAuthFieldTypeList->Insert(
+ new String(SW_RES(STR_AUTH_TYPE_START + i)),
+ pAuthFieldTypeList->Count());
+ }
+ return *pAuthFieldTypeList->GetObject( static_cast< USHORT >(eType) );
+}
+
+
+
diff --git a/sw/source/ui/utlui/initui.hrc b/sw/source/ui/utlui/initui.hrc
new file mode 100644
index 000000000000..367091fbd443
--- /dev/null
+++ b/sw/source/ui/utlui/initui.hrc
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _INITUI_HRC
+#define _INITUI_HRC
+
+#define BMP_FRAME_ANCHOR 1
+#define BMP_FRAME_DRAG_ANCHOR 2
+
+// lokale Resourcen fuer die Shells:
+#define STR_POSTIT_PAGE 1
+#define STR_POSTIT_AUTHOR 2
+#define STR_CALC_SYNTAX 3
+#define STR_CALC_ZERODIV 4
+#define STR_CALC_BRACK 5
+#define STR_CALC_POW 6
+#define STR_CALC_VARNFND 7
+#define STR_CALC_OVERFLOW 8
+#define STR_CALC_WRONGTIME 9
+#define STR_CALC_DEFAULT 10
+#define STR_CALC_ERROR 11
+#define STR_GETREFFLD_UP 12
+#define STR_GETREFFLD_DOWN 13
+#define STR_ALLPAGE_HEADFOOT 14
+#define STR_TEMPLATE_NONE 15
+#define STR_POSTIT_LINE 16
+#define STR_FIELD_FIXED 17
+#define STR_TOI 18
+#define STR_TOU 19
+#define STR_TOC 20
+#define STR_TOX_ILL 21
+#define STR_TOX_OBJ 22
+#define STR_TOX_TBL 23
+#define STR_TOX_AUTH 24
+#define STR_PAGEDESC_NAME 25
+#define STR_PAGEDESC_FIRSTNAME 26
+#define STR_PAGEDESC_FOLLOWNAME 27
+#define STR_HYPERLINK_CLICK 28
+#define STR_GETREFFLD_REFITEMNOTFOUND 29
+#define STR_DURATION_FORMAT 30
+#endif
+
diff --git a/sw/source/ui/utlui/initui.src b/sw/source/ui/utlui/initui.src
new file mode 100644
index 000000000000..3b08e771a309
--- /dev/null
+++ b/sw/source/ui/utlui/initui.src
@@ -0,0 +1,519 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "utlui.hrc"
+#include "helpid.h"
+#include "initui.hrc"
+
+/*---------------------------------------------------------------------
+ Fehler Calculator
+ ---------------------------------------------------------------------*/
+Resource RID_SW_SHELLRES
+{
+ String STR_POSTIT_PAGE
+ {
+ Text [ en-US ] = "Page" ;
+ };
+ String STR_POSTIT_LINE
+ {
+ Text [ en-US ] = "Line" ;
+ };
+ String STR_POSTIT_AUTHOR
+ {
+ Text [ en-US ] = "Author" ;
+ };
+ String STR_CALC_SYNTAX
+ {
+ Text [ en-US ] = "** Syntax Error **" ;
+ };
+ String STR_CALC_ZERODIV
+ {
+ Text [ en-US ] = "** Division by zero **" ;
+ };
+ String STR_CALC_BRACK
+ {
+ Text [ en-US ] = "** Wrong use of brackets **" ;
+ };
+ String STR_CALC_POW
+ {
+ Text [ en-US ] = "** Square function overflow **" ;
+ /* ### ACHTUNG: Neuer Text in Resource? ** Überlauf in Quadratfunktion ** : ** šberlauf in Quadratfunktion ** */
+ };
+ String STR_CALC_VARNFND
+ {
+ Text [ en-US ] = "** Variable not found **" ;
+ };
+ String STR_CALC_OVERFLOW
+ {
+ Text [ en-US ] = "** Overflow **" ;
+ /* ### ACHTUNG: Neuer Text in Resource? ** Überlauf ** : ** šberlauf ** */
+ };
+ String STR_CALC_WRONGTIME
+ {
+ Text [ en-US ] = "** Wrong time format **" ;
+ };
+ String STR_CALC_DEFAULT
+ {
+ Text [ en-US ] = "** Error **" ;
+ };
+ String STR_CALC_ERROR
+ {
+ Text [ en-US ] = "** Expression is faulty **" ;
+ };
+ String STR_GETREFFLD_UP
+ {
+ Text [ en-US ] = "above" ;
+ };
+ String STR_GETREFFLD_DOWN
+ {
+ Text [ en-US ] = "below" ;
+ };
+ String STR_GETREFFLD_REFITEMNOTFOUND
+ {
+ Text [ en-US ] = "Error: Reference source not found" ;
+ };
+ String STR_ALLPAGE_HEADFOOT
+ {
+ Text [ en-US ] = "All" ;
+ };
+ String STR_TEMPLATE_NONE
+ {
+ Text [ en-US ] = "None" ;
+ };
+ String STR_FIELD_FIXED
+ {
+ Text [ en-US ] = "(fixed)" ;
+ };
+ String STR_DURATION_FORMAT
+ {
+ Text [en-US] = " Y: %1 M: %2 D: %3 H: %4 M: %5 S: %6";
+ };
+ String STR_TOI
+ {
+ Text [ en-US ] = "Alphabetical Index" ;
+ };
+
+ String STR_TOU
+ {
+ Text [ en-US ] = "User-Defined" ;
+ };
+
+ String STR_TOC
+ {
+ Text [ en-US ] = "Table of Contents" ;
+ };
+
+ String STR_TOX_AUTH
+ {
+ Text [ en-US ] = "Bibliography";
+ };
+ String STR_TOX_TBL
+ {
+ Text [ en-US ] = "Index of Tables";
+ };
+ String STR_TOX_OBJ
+ {
+ Text [ en-US ] = "Table of Objects";
+ };
+ String STR_TOX_ILL
+ {
+ Text [ en-US ] = "Illustration Index";
+ };
+ String STR_HYPERLINK_CLICK
+ {
+ Text [ en-US ] = "%s-click to open hyperlink";
+ };
+
+
+ // SubType DocInfo
+ //
+ String FLD_DOCINFO_TITEL
+ {
+ Text [ en-US ] = "Title" ;
+ };
+ String FLD_DOCINFO_THEMA
+ {
+ Text [ en-US ] = "Subject" ;
+ };
+ String FLD_DOCINFO_KEYS
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Schlüsselwörter : Schl³sselw÷rter */
+ Text [ en-US ] = "Keywords" ;
+ };
+ String FLD_DOCINFO_COMMENT
+ {
+ Text [ en-US ] = "Comments" ;
+ };
+ String FLD_DOCINFO_CREATE
+ {
+ Text [ en-US ] = "Created" ;
+ };
+ String FLD_DOCINFO_CHANGE
+ {
+ Text [ en-US ] = "Modified" ;
+ };
+ String FLD_DOCINFO_PRINT
+ {
+ Text [ en-US ] = "Last printed" ;
+ };
+ String FLD_DOCINFO_DOCNO
+ {
+ Text [ en-US ] = "Revision number" ;
+ };
+ String FLD_DOCINFO_EDIT
+ {
+ Text [ en-US ] = "Total editing time" ;
+ };
+ BITMAP BMP_FRAME_ANCHOR { FILE = "anchor.bmp" ; };
+ BITMAP BMP_FRAME_DRAG_ANCHOR { FILE = "danchor.bmp" ; };
+
+ String STR_PAGEDESC_NAME
+ {
+ Text [ en-US ] = "Convert $(ARG1)";
+ };
+ String STR_PAGEDESC_FIRSTNAME
+ {
+ Text [ en-US ] = "First convert $(ARG1)";
+ };
+ String STR_PAGEDESC_FOLLOWNAME
+ {
+ Text [ en-US ] = "Next convert $(ARG1)";
+ };
+};
+
+String STR_AUTH_TYPE_ARTICLE
+{
+ Text [ en-US ] = "Article";
+};
+String STR_AUTH_TYPE_BOOK
+{
+ Text [ en-US ] = "Book";
+};
+String STR_AUTH_TYPE_BOOKLET
+{
+ Text [ en-US ] = "Brochures";
+};
+String STR_AUTH_TYPE_CONFERENCE
+{
+ Text [ en-US ] = "Conference proceedings";
+};
+String STR_AUTH_TYPE_INBOOK
+{
+ Text [ en-US ] = "Book excerpt";
+};
+String STR_AUTH_TYPE_INCOLLECTION
+{
+ Text [ en-US ] = "Book excerpt with title";
+};
+String STR_AUTH_TYPE_INPROCEEDINGS
+{
+ Text [ en-US ] = "Conference proceedings";
+};
+String STR_AUTH_TYPE_JOURNAL
+{
+ Text [ en-US ] = "Journal";
+};
+String STR_AUTH_TYPE_MANUAL
+{
+ Text [ en-US ] = "Techn. documentation";
+};
+String STR_AUTH_TYPE_MASTERSTHESIS
+{
+ Text [ en-US ] = "Thesis";
+};
+String STR_AUTH_TYPE_MISC
+{
+ Text [ en-US ] = "Miscellaneous";
+};
+String STR_AUTH_TYPE_PHDTHESIS
+{
+ Text [ en-US ] = "Dissertation";
+};
+String STR_AUTH_TYPE_PROCEEDINGS
+{
+ Text [ en-US ] = "Conference proceedings";
+};
+String STR_AUTH_TYPE_TECHREPORT
+{
+ Text [ en-US ] = "Research report";
+};
+String STR_AUTH_TYPE_UNPUBLISHED
+{
+ Text [ en-US ] = "Unpublished";
+};
+String STR_AUTH_TYPE_EMAIL
+{
+ Text [ en-US ] = "e-mail";
+};
+String STR_AUTH_TYPE_WWW
+{
+ Text [ en-US ] = "WWW document";
+};
+String STR_AUTH_TYPE_CUSTOM1
+{
+ Text [ en-US ] = "User-defined1";
+};
+String STR_AUTH_TYPE_CUSTOM2
+{
+ Text [ en-US ] = "User-defined2";
+};
+String STR_AUTH_TYPE_CUSTOM3
+{
+ Text [ en-US ] = "User-defined3";
+};
+String STR_AUTH_TYPE_CUSTOM4
+{
+ Text [ en-US ] = "User-defined4";
+};
+String STR_AUTH_TYPE_CUSTOM5
+{
+ Text [ en-US ] = "User-defined5";
+};
+
+String STR_AUTH_FIELD_IDENTIFIER
+{
+ Text [ en-US ] = "Short name";
+};
+String STR_AUTH_FIELD_AUTHORITY_TYPE
+{
+ Text [ en-US ] = "Type";
+};
+String STR_AUTH_FIELD_ADDRESS
+{
+ Text [ en-US ] = "Address";
+};
+String STR_AUTH_FIELD_ANNOTE
+{
+ Text [ en-US ] = "Annotation";
+};
+String STR_AUTH_FIELD_AUTHOR
+{
+ Text [ en-US ] = "Author(s)";
+};
+String STR_AUTH_FIELD_BOOKTITLE
+{
+ Text [ en-US ] = "Book title";
+};
+String STR_AUTH_FIELD_CHAPTER
+{
+ Text [ en-US ] = "Chapter";
+};
+String STR_AUTH_FIELD_EDITION
+{
+ Text [ en-US ] = "Edition";
+};
+String STR_AUTH_FIELD_EDITOR
+{
+ Text [ en-US ] = "Editor";
+};
+String STR_AUTH_FIELD_HOWPUBLISHED
+{
+ Text [ en-US ] = "Publication type";
+};
+String STR_AUTH_FIELD_INSTITUTION
+{
+ Text [ en-US ] = "Institution";
+};
+String STR_AUTH_FIELD_JOURNAL
+{
+ Text [ en-US ] = "Journal";
+};
+String STR_AUTH_FIELD_MONTH
+{
+ Text [ en-US ] = "Month";
+};
+String STR_AUTH_FIELD_NOTE
+{
+ Text [ en-US ] = "Note";
+};
+String STR_AUTH_FIELD_NUMBER
+{
+ Text [ en-US ] = "Number";
+};
+String STR_AUTH_FIELD_ORGANIZATIONS
+{
+ Text [ en-US ] = "Organization";
+};
+String STR_AUTH_FIELD_PAGES
+{
+ Text [ en-US ] = "Page(s)";
+};
+String STR_AUTH_FIELD_PUBLISHER
+{
+ Text [ en-US ] = "Publisher";
+};
+String STR_AUTH_FIELD_SCHOOL
+{
+ Text [ en-US ] = "University";
+};
+String STR_AUTH_FIELD_SERIES
+{
+ Text [ en-US ] = "Series";
+};
+String STR_AUTH_FIELD_TITLE
+{
+ Text [ en-US ] = "Title";
+};
+String STR_AUTH_FIELD_TYPE
+{
+ Text [ en-US ] = "Type of report";
+};
+String STR_AUTH_FIELD_VOLUME
+{
+ Text [ en-US ] = "Volume";
+};
+String STR_AUTH_FIELD_YEAR
+{
+ Text [ en-US ] = "Year";
+};
+String STR_AUTH_FIELD_URL
+{
+ Text [ en-US ] = "URL";
+};
+String STR_AUTH_FIELD_CUSTOM1
+{
+ Text [ en-US ] = "User-defined1";
+};
+String STR_AUTH_FIELD_CUSTOM2
+{
+ Text [ en-US ] = "User-defined2";
+};
+String STR_AUTH_FIELD_CUSTOM3
+{
+ Text [ en-US ] = "User-defined3";
+};
+String STR_AUTH_FIELD_CUSTOM4
+{
+ Text [ en-US ] = "User-defined4";
+};
+String STR_AUTH_FIELD_CUSTOM5
+{
+ Text [ en-US ] = "User-defined5";
+};
+String STR_AUTH_FIELD_ISBN
+{
+ Text [ en-US ] = "ISBN";
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/utlui/navicfg.cxx b/sw/source/ui/utlui/navicfg.cxx
new file mode 100644
index 000000000000..435f5583cd30
--- /dev/null
+++ b/sw/source/ui/utlui/navicfg.cxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <swtypes.hxx> // fuer Pathfinder
+#include <navicfg.hxx>
+#include <swcont.hxx>
+#include <tools/debug.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <unomid.h>
+
+using namespace ::utl;
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+
+/* -----------------------------08.09.00 16:30--------------------------------
+
+ ---------------------------------------------------------------------------*/
+Sequence<OUString> SwNavigationConfig::GetPropertyNames()
+{
+ static const char* aPropNames[] =
+ {
+ "RootType", //0
+ "SelectedPosition", //1
+ "OutlineLevel", //2
+ "InsertMode", //3
+ "ActiveBlock", //4
+ "ShowListBox", //5
+ "GlobalDocMode" //6
+ };
+ const int nCount = 7;
+ Sequence<OUString> aNames(nCount);
+ OUString* pNames = aNames.getArray();
+ for(int i = 0; i < nCount; i++)
+ {
+ pNames[i] = OUString::createFromAscii(aPropNames[i]);
+ }
+ return aNames;
+}
+/*-----------------13.11.96 11.03-------------------
+
+--------------------------------------------------*/
+
+SwNavigationConfig::SwNavigationConfig() :
+ utl::ConfigItem(C2U("Office.Writer/Navigator")),
+ nRootType(0xffff),
+ nSelectedPos(0),
+ nOutlineLevel(MAXLEVEL),
+ nRegionMode(REGION_MODE_NONE),
+ nActiveBlock(0),
+ bIsSmall(FALSE),
+ bIsGlobalActive(TRUE)
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues = GetProperties(aNames);
+// EnableNotification(aNames);
+ const Any* pValues = aValues.getConstArray();
+ DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
+ if(aValues.getLength() == aNames.getLength())
+ {
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ if(pValues[nProp].hasValue())
+ {
+ switch(nProp)
+ {
+ case 0: pValues[nProp] >>= nRootType; break;
+ case 1: pValues[nProp] >>= nSelectedPos; break;
+ case 2: pValues[nProp] >>= nOutlineLevel; break;
+ case 3: pValues[nProp] >>= nRegionMode; break;
+ case 4: pValues[nProp] >>= nActiveBlock; break;
+ case 5: bIsSmall = *(sal_Bool*)pValues[nProp].getValue(); break;
+ case 6: bIsGlobalActive = *(sal_Bool*)pValues[nProp].getValue(); break;
+ }
+ }
+ }
+ }
+}
+/* -----------------------------08.09.00 16:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwNavigationConfig::~SwNavigationConfig()
+{}
+/* -----------------------------08.09.00 16:35--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNavigationConfig::Commit()
+{
+ Sequence<OUString> aNames = GetPropertyNames();
+ Sequence<Any> aValues(aNames.getLength());
+ Any* pValues = aValues.getArray();
+ const Type& rType = ::getBooleanCppuType();
+
+ for(int nProp = 0; nProp < aNames.getLength(); nProp++)
+ {
+ switch(nProp)
+ {
+ case 0: pValues[nProp] <<= nRootType; break;
+ case 1: pValues[nProp] <<= nSelectedPos; break;
+ case 2: pValues[nProp] <<= nOutlineLevel; break;
+ case 3: pValues[nProp] <<= nRegionMode; break;
+ case 4: pValues[nProp] <<= nActiveBlock; break;
+ case 5: pValues[nProp].setValue(&bIsSmall, rType); break;
+ case 6: pValues[nProp].setValue(&bIsGlobalActive, rType); break;
+ }
+ }
+ PutProperties(aNames, aValues);
+}
+
+void SwNavigationConfig::Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& ) {}
+
+
diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx
new file mode 100644
index 000000000000..25633a7b691f
--- /dev/null
+++ b/sw/source/ui/utlui/navipi.cxx
@@ -0,0 +1,1552 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#define NAVIPI_CXX
+
+#include <string> // HACK: prevent conflict between STLPORT and Workshop headers
+#include <tools/list.hxx>
+#include <svl/urlbmk.hxx>
+#include <svl/stritem.hxx>
+#include <svtools/filter.hxx>
+#include <svl/urihelper.hxx>
+#include <sot/formats.hxx>
+#include <sot/filelist.hxx>
+#include <sfx2/event.hxx>
+#include <sfx2/imgmgr.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/dockwin.hxx>
+#include <vcl/toolbox.hxx>
+#include <swtypes.hxx> // fuer Pathfinder
+#include <errhdl.hxx>
+#include <swmodule.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <navicfg.hxx>
+#include <wrtsh.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <actctrl.hxx>
+#include <IMark.hxx>
+#include <navipi.hxx>
+#include <content.hxx>
+#include <workctrl.hxx>
+#include <section.hxx>
+#include <edtwin.hxx>
+#include <sfx2/app.hxx>
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _HELPID_H
+#include <helpid.h>
+#endif
+#ifndef _RIBBAR_HRC
+#include <ribbar.hrc>
+#endif
+#ifndef _NAVIPI_HRC
+#include <navipi.hrc>
+#endif
+#ifndef _UTLUI_HRC
+#include <utlui.hrc>
+#endif
+
+#include <unomid.h>
+
+
+#define PAGE_CHANGE_TIMEOUT 1000 //Timeout fuer Seitenwechsel
+
+#define JUMP_TYPE_TBL 0
+#define JUMP_TYPE_FRM 1
+#define JUMP_TYPE_GRF 2
+#define JUMP_TYPE_REG 3
+#define JUMP_TYPE_BKM 4
+
+// Version fuer Konfiguration
+
+#define NAVI_VERSION0 0
+#define NAVI_VERSION1 1
+#define NAVI_VERSION2 2 // bIsGlobalActive
+
+#define NAVI_CONFIG_VERSION NAVI_VERSION2
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
+
+SFX_IMPL_CHILDWINDOW_CONTEXT( SwNavigationChild, SID_NAVIGATOR, SwView )
+
+/*------------------------------------------------------------------------
+ Bechreibung: Steuerzeichen aus dem Outline-Entry filtern
+------------------------------------------------------------------------*/
+
+void SwNavigationPI::CleanEntry( String& rEntry )
+{
+ USHORT i = rEntry.Len();
+ if( i )
+ for( sal_Unicode* pStr = rEntry.GetBufferAccess(); i; --i, ++pStr )
+ if( *pStr == 10 || *pStr == 9 )
+ *pStr = 0x20;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Ausfuehrung der Drag-Operation
+ mit und ohne Childs
+------------------------------------------------------------------------*/
+
+void SwNavigationPI::MoveOutline(USHORT nSource, USHORT nTarget,
+ BOOL bWithChilds)
+{
+ SwView *pView = GetCreateView();
+ SwWrtShell &rSh = pView->GetWrtShell();
+ if(nTarget < nSource || nTarget == USHRT_MAX)
+ nTarget ++;
+ if ( rSh.IsOutlineMovable( nSource ))
+ {
+
+ short nMove = nTarget-nSource; //( nDir<0 ) ? 1 : 0 ;
+ rSh.GotoOutline(nSource);
+ if (bWithChilds)
+ rSh.MakeOutlineSel(nSource, nSource, TRUE);
+ // Die selektierten Children zaehlen bei der Bewegung vorwaerts nicht mit
+ USHORT nLastOutlinePos = rSh.GetOutlinePos(MAXLEVEL);
+ if(bWithChilds && nMove > 1 &&
+ nLastOutlinePos < nTarget)
+ {
+ if(!rSh.IsCrsrPtAtEnd())
+ rSh.SwapPam();
+ nMove -= nLastOutlinePos - nSource;
+ }
+ if(!bWithChilds || nMove < 1 || nLastOutlinePos < nTarget )
+ rSh.MoveOutlinePara( nMove );
+ rSh.ClearMark();
+ rSh.GotoOutline( nSource + nMove);
+ FillBox();
+ }
+
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: Nach Goto einen Status Rahmenselektion aufheben
+------------------------------------------------------------------------*/
+
+
+void lcl_UnSelectFrm(SwWrtShell *pSh)
+{
+ if (pSh->IsFrmSelected())
+ {
+ pSh->UnSelectFrm();
+ pSh->LeaveSelFrmMode();
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Select der Documentanzeige
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwNavigationPI, DocListBoxSelectHdl, ListBox *, pBox )
+{
+ int nEntryIdx = pBox->GetSelectEntryPos();
+ SwView *pView ;
+ pView = SwModule::GetFirstView();
+ while (nEntryIdx-- && pView)
+ {
+ pView = SwModule::GetNextView(pView);
+ }
+ if(!pView)
+ {
+ nEntryIdx == 0 ?
+ aContentTree.ShowHiddenShell():
+ aContentTree.ShowActualView();
+
+
+ }
+ else
+ {
+ aContentTree.SetConstantShell(pView->GetWrtShellPtr());
+ }
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Fuellen der ListBox fuer Outline Sicht oder Dokumente
+ Der PI wird auf volle Groesse gesetzt
+------------------------------------------------------------------------*/
+
+
+void SwNavigationPI::FillBox()
+{
+ if(pContentWrtShell)
+ {
+ aContentTree.SetHiddenShell( pContentWrtShell );
+ aContentTree.Display( FALSE );
+ }
+ else
+ {
+ SwView *pView = GetCreateView();
+ if(!pView)
+ {
+ aContentTree.SetActiveShell(0);
+ }
+ else if( pView != pActContView)
+ {
+ SwWrtShell* pWrtShell = pView->GetWrtShellPtr();
+ aContentTree.SetActiveShell(pWrtShell);
+ }
+ else
+ aContentTree.Display( TRUE );
+ pActContView = pView;
+ }
+}
+
+
+void SwNavigationPI::UsePage(SwWrtShell *pSh)
+{
+ if (!pSh)
+ {
+ SwView *pView = GetCreateView();
+ pSh = pView ? &pView->GetWrtShell() : 0;
+ GetPageEdit().SetValue(1);
+ }
+ if (pSh)
+ {
+ const USHORT nPageCnt = pSh->GetPageCnt();
+ USHORT nPhyPage, nVirPage;
+ pSh->GetPageNum(nPhyPage, nVirPage);
+
+ GetPageEdit().SetMax(nPageCnt);
+ GetPageEdit().SetLast(nPageCnt);
+ GetPageEdit().SetValue(nPhyPage);
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: SelectHandler der Toolboxen
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox )
+{
+ const USHORT nCurrItemId = pBox->GetCurItemId();
+ SwView *pView = GetCreateView();
+ if (!pView)
+ return 1;
+ SwWrtShell &rSh = pView->GetWrtShell();
+ //MouseModifier fuer Outline-Move besorgen
+
+ //Standard: Unterebenen werden mitgenommen
+ // mit Ctrl Unterebenen nicht mitnehmen
+ BOOL bOutlineWithChilds = ( KEY_MOD1 != pBox->GetModifier());
+ int nFuncId = 0;
+ BOOL bFocusToDoc = FALSE;
+ switch (nCurrItemId)
+ {
+ case FN_UP:
+ case FN_DOWN:
+ {
+ // #i75416# move the execution of the search to an asynchronously called static link
+ bool* pbNext = new bool( FN_DOWN == nCurrItemId );
+ Application::PostUserEvent( STATIC_LINK(pView, SwView, MoveNavigationHdl), pbNext );
+ }
+ break;
+ case FN_SHOW_ROOT:
+ {
+ aContentTree.ToggleToRoot();
+ }
+ break;
+ case FN_SHOW_CONTENT_BOX:
+ case FN_SELECT_CONTENT:
+ if(pContextWin->GetFloatingWindow())
+ {
+ if(_IsZoomedIn() )
+ {
+ _ZoomOut();
+ }
+ else
+ {
+ _ZoomIn();
+ }
+ }
+ return TRUE;
+ //break;
+ // Funktionen, die eine direkte Aktion ausloesen
+
+ case FN_SELECT_FOOTER:
+ {
+ rSh.MoveCrsr();
+ const USHORT eType = rSh.GetFrmType(0,FALSE);
+ if (eType & FRMTYPE_FOOTER)
+ {
+ if (rSh.EndPg())
+ nFuncId = FN_END_OF_PAGE;
+ }
+ else if (rSh.GotoFooterTxt())
+ nFuncId = FN_TO_FOOTER;
+ bFocusToDoc = TRUE;
+ }
+ break;
+ case FN_SELECT_HEADER:
+ {
+ rSh.MoveCrsr();
+ const USHORT eType = rSh.GetFrmType(0,FALSE);
+ if (eType & FRMTYPE_HEADER)
+ {
+ if (rSh.SttPg())
+ nFuncId = FN_START_OF_PAGE;
+ }
+ else if (rSh.GotoHeaderTxt())
+ nFuncId = FN_TO_HEADER;
+ bFocusToDoc = TRUE;
+ }
+ break;
+ case FN_SELECT_FOOTNOTE:
+ {
+ rSh.MoveCrsr();
+ const USHORT eFrmType = rSh.GetFrmType(0,FALSE);
+ // aus Fussnote zum Anker springen
+ if (eFrmType & FRMTYPE_FOOTNOTE)
+ {
+ if (rSh.GotoFtnAnchor())
+ nFuncId = FN_FOOTNOTE_TO_ANCHOR;
+ }
+ // andernfalls zuerst zum Fussnotentext springen; geht
+ // dies nicht, zur naechten Fussnote; geht auch dies
+ // nicht, zur vorhergehenden Fussnote
+ else
+ {
+ if (rSh.GotoFtnTxt())
+ nFuncId = FN_FOOTNOTE_TO_ANCHOR;
+ else if (rSh.GotoNextFtnAnchor())
+ nFuncId = FN_NEXT_FOOTNOTE;
+ else if (rSh.GotoPrevFtnAnchor())
+ nFuncId = FN_PREV_FOOTNOTE;
+ }
+ bFocusToDoc = TRUE;
+ }
+ break;
+
+ case FN_SELECT_SET_AUTO_BOOKMARK:
+ MakeMark();
+ break;
+ case FN_ITEM_DOWN:
+ case FN_ITEM_UP:
+ case FN_ITEM_LEFT:
+ case FN_ITEM_RIGHT:
+ case FN_GLOBAL_EDIT:
+ {
+ if(IsGlobalMode())
+ aGlobalTree.ExecCommand(nCurrItemId);
+ else
+ aContentTree.ExecCommand(nCurrItemId, bOutlineWithChilds);
+ }
+ break;
+ case FN_GLOBAL_SWITCH:
+ {
+ ToggleTree();
+ pConfig->SetGlobalActive(IsGlobalMode());
+ }
+ break;
+ case FN_GLOBAL_SAVE_CONTENT:
+ {
+ BOOL bSave = rSh.IsGlblDocSaveLinks();
+ rSh.SetGlblDocSaveLinks( !bSave );
+ pBox->CheckItem(FN_GLOBAL_SAVE_CONTENT, !bSave );
+ }
+ break;
+ }
+
+ if (nFuncId)
+ {
+ lcl_UnSelectFrm(&rSh);
+ }
+ if(bFocusToDoc)
+ pView->GetEditWin().GrabFocus();
+ return TRUE;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: ClickHandler der Toolboxen
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwNavigationPI, ToolBoxClickHdl, ToolBox *, pBox )
+{
+ const USHORT nCurrItemId = pBox->GetCurItemId();
+ switch (nCurrItemId)
+ {
+ case FN_GLOBAL_UPDATE:
+ case FN_GLOBAL_OPEN:
+ {
+ aGlobalTree.TbxMenuHdl(nCurrItemId, pBox);
+ }
+ break;
+ }
+
+ return TRUE;
+}
+
+/*-----------------13.07.04 -------------------
+ ----------------------------------------------*/
+
+IMPL_LINK( SwNavigationPI, ToolBoxDropdownClickHdl, ToolBox*, pBox )
+{
+ const USHORT nCurrItemId = pBox->GetCurItemId();
+ switch (nCurrItemId)
+ {
+ case FN_CREATE_NAVIGATION:
+ {
+ CreateNavigationTool(pBox->GetItemRect(FN_CREATE_NAVIGATION), TRUE);
+ }
+ break;
+
+ case FN_DROP_REGION:
+ {
+ static const char* aHIDs[] =
+ {
+ HID_NAVI_DRAG_HYP,
+ HID_NAVI_DRAG_LINK,
+ HID_NAVI_DRAG_COPY,
+ };
+ PopupMenu *pMenu = new PopupMenu;
+ for (USHORT i = 0; i <= REGION_MODE_EMBEDDED; i++)
+ {
+ pMenu->InsertItem( i + 1, aContextArr[i] );
+ pMenu->SetHelpId(i + 1, aHIDs[i]);
+ }
+ pMenu->CheckItem( nRegionMode + 1 );
+ pMenu->SetSelectHdl(LINK(this, SwNavigationPI, MenuSelectHdl));
+ pBox->SetItemDown( nCurrItemId, TRUE );
+ pMenu->Execute( pBox,
+ pBox->GetItemRect(FN_DROP_REGION),
+ POPUPMENU_EXECUTE_DOWN );
+ pBox->SetItemDown( nCurrItemId, FALSE );
+ pBox->EndSelection();
+ delete pMenu;
+ pBox->Invalidate();
+ }
+ break;
+ case FN_OUTLINE_LEVEL:
+ {
+ PopupMenu *pMenu = new PopupMenu;
+ for (USHORT i = 101; i <= 100 + MAXLEVEL; i++)
+ {
+ pMenu->InsertItem( i, String::CreateFromInt32(i - 100) );
+ pMenu->SetHelpId( i, HID_NAVI_OUTLINES );
+ }
+ pMenu->CheckItem( aContentTree.GetOutlineLevel() + 100 );
+ pMenu->SetSelectHdl(LINK(this, SwNavigationPI, MenuSelectHdl));
+ pBox->SetItemDown( nCurrItemId, TRUE );
+ pMenu->Execute( pBox,
+ pBox->GetItemRect(FN_OUTLINE_LEVEL),
+ POPUPMENU_EXECUTE_DOWN );
+ pBox->SetItemDown( nCurrItemId, FALSE );
+ delete pMenu;
+ pBox->EndSelection();
+ pBox->Invalidate();
+ }
+ break;
+ }
+ return TRUE;
+}
+
+/*-----------------13.07.04 -------------------
+--------------------------------------------------*/
+
+SwNavHelpToolBox::SwNavHelpToolBox(SwNavigationPI* pParent, const ResId &rResId) :
+ SwHelpToolBox(pParent, rResId)
+{}
+/*-----------------19.06.97 09:09-------------------
+
+--------------------------------------------------*/
+void SwNavHelpToolBox::MouseButtonDown(const MouseEvent &rEvt)
+{
+ if(rEvt.GetButtons() == MOUSE_LEFT &&
+ FN_CREATE_NAVIGATION == GetItemId(rEvt.GetPosPixel()))
+ {
+ ((SwNavigationPI*)GetParent())->CreateNavigationTool(GetItemRect(FN_CREATE_NAVIGATION), FALSE);
+ }
+ else
+ SwHelpToolBox::MouseButtonDown(rEvt);
+}
+/* -----------------------------12.03.2002 16:55------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNavigationPI::CreateNavigationTool(const Rectangle& rRect, BOOL bSetFocus)
+{
+// SfxBindings& rBind = GetCreateView()->GetViewFrame()->GetBindings();
+// rBind.ENTERREGISTRATIONS();
+ Reference< XFrame > xFrame = GetCreateView()->GetViewFrame()->GetFrame().GetFrameInterface();
+ SwScrollNaviPopup* pPopup = new
+ SwScrollNaviPopup(FN_SCROLL_NAVIGATION,
+ xFrame );
+// rBind.LEAVEREGISTRATIONS();
+
+ Rectangle aRect(rRect);
+ Point aT1 = aRect.TopLeft();
+ aT1 = pPopup->GetParent()->OutputToScreenPixel(pPopup->GetParent()->AbsoluteScreenToOutputPixel(aContentToolBox.OutputToAbsoluteScreenPixel(aT1)));
+ aRect.SetPos(aT1);
+ pPopup->StartPopupMode(aRect, FLOATWIN_POPUPMODE_RIGHT|FLOATWIN_POPUPMODE_ALLOWTEAROFF);
+ SetPopupWindow( pPopup );
+ if(bSetFocus)
+ {
+ pPopup->EndPopupMode(FLOATWIN_POPUPMODEEND_TEAROFF);
+ pPopup->GrabFocus();
+ }
+}
+
+/*-----------------19.06.97 10:12-------------------
+
+--------------------------------------------------*/
+void SwNavHelpToolBox::RequestHelp( const HelpEvent& rHEvt )
+{
+ USHORT nItemId = GetItemId(ScreenToOutputPixel(rHEvt.GetMousePosPixel()));
+ if( FN_UP == nItemId || FN_DOWN == nItemId )
+ {
+ SetItemText(nItemId, SwScrollNaviPopup::GetQuickHelpText((FN_DOWN == nItemId)));
+ }
+ SwHelpToolBox::RequestHelp(rHEvt);
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Action-Handler Edit; wechselt auf die Seite, wenn
+ nicht Gliederungssicht angeschaltet ist.
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwNavigationPI, EditAction, NumEditAction *, pEdit )
+{
+ SwView *pView = GetCreateView();
+ if (pView)
+ {
+ if(aPageChgTimer.IsActive())
+ aPageChgTimer.Stop();
+ pCreateView->GetWrtShell().GotoPage((USHORT)pEdit->GetValue(), TRUE);
+ pCreateView->GetEditWin().GrabFocus();
+ pCreateView->GetViewFrame()->GetBindings().Invalidate(FN_STAT_PAGE);
+ }
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Falls die Seite eingestellt werden kann, wird hier
+ das Maximum gesetzt.
+------------------------------------------------------------------------*/
+
+
+IMPL_LINK( SwNavigationPI, EditGetFocus, NumEditAction *, pEdit )
+{
+ SwView *pView = GetCreateView();
+ if (!pView)
+ return 0;
+ SwWrtShell &rSh = pView->GetWrtShell();
+
+ const USHORT nPageCnt = rSh.GetPageCnt();
+ pEdit->SetMax(nPageCnt);
+ pEdit->SetLast(nPageCnt);
+ return 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+BOOL SwNavigationPI::Close()
+{
+ SfxViewFrame* pVFrame = pCreateView->GetViewFrame();
+ pVFrame->GetBindings().Invalidate(SID_NAVIGATOR);
+ pVFrame->GetDispatcher()->Execute(SID_NAVIGATOR);
+ return TRUE;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Setzen einer automatischen Marke
+------------------------------------------------------------------------*/
+
+
+void SwNavigationPI::MakeMark()
+{
+ SwView *pView = GetCreateView();
+ if (!pView) return;
+ SwWrtShell &rSh = pView->GetWrtShell();
+ IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
+
+ // collect and sort navigator reminder names
+ ::std::vector< ::rtl::OUString > vNavMarkNames;
+ for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
+ ppMark != pMarkAccess->getMarksEnd();
+ ppMark++)
+ if( IDocumentMarkAccess::GetType(**ppMark) == IDocumentMarkAccess::NAVIGATOR_REMINDER )
+ vNavMarkNames.push_back(ppMark->get()->GetName());
+ ::std::sort(vNavMarkNames.begin(), vNavMarkNames.end());
+
+ // we are maxed out and delete one
+ // nAutoMarkIdx rotates through the available MarkNames
+ // this assumes that IDocumentMarkAccess generates Names in ascending order
+ if(vNavMarkNames.size() == MAX_MARKS)
+ pMarkAccess->deleteMark(pMarkAccess->findMark(vNavMarkNames[nAutoMarkIdx]));
+
+ rSh.SetBookmark(KeyCode(), ::rtl::OUString(), ::rtl::OUString(), IDocumentMarkAccess::NAVIGATOR_REMINDER);
+ SwView::SetActMark( nAutoMarkIdx );
+
+ if(++nAutoMarkIdx == MAX_MARKS)
+ nAutoMarkIdx = 0;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwNavigationPI::GotoPage()
+{
+ if ( pContextWin->GetFloatingWindow() && pContextWin->GetFloatingWindow()->IsRollUp())
+ _ZoomIn();
+ if(IsGlobalMode())
+ ToggleTree();
+ UsePage(0);
+ GetPageEdit().GrabFocus();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwNavigationPI::_ZoomOut()
+{
+ if (_IsZoomedIn())
+ {
+ FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
+ bIsZoomedIn = FALSE;
+ Size aSz(GetOutputSizePixel());
+ aSz.Height() = nZoomOut;
+ Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
+ ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
+ aMinOutSizePixel.Width(),nZoomOutInit));
+ pFloat->SetOutputSizePixel(aSz);
+ FillBox();
+ if(IsGlobalMode())
+ {
+ aGlobalTree.ShowTree();
+ }
+ else
+ {
+ aContentTree.ShowTree();
+ aDocListBox.Show();
+ }
+ SvLBoxEntry* pFirst = aContentTree.FirstSelected();
+ if(pFirst)
+ aContentTree.Select(pFirst, TRUE); // toolbox enablen
+ pConfig->SetSmall( FALSE );
+ aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX);
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwNavigationPI::_ZoomIn()
+{
+ FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
+ if (pFloat &&
+ (!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp())))
+ {
+ aContentTree.HideTree();
+ aDocListBox.Hide();
+ aGlobalTree.HideTree();
+ bIsZoomedIn = TRUE;
+ Size aSz(GetOutputSizePixel());
+ if( aSz.Height() > nZoomIn )
+ nZoomOut = ( short ) aSz.Height();
+
+ aSz.Height() = nZoomIn;
+ Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
+ ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
+ aMinOutSizePixel.Width(), aSz.Height()));
+ pFloat->SetOutputSizePixel(aSz);
+ SvLBoxEntry* pFirst = aContentTree.FirstSelected();
+ if(pFirst)
+ aContentTree.Select(pFirst, TRUE); // toolbox enablen
+ pConfig->SetSmall( TRUE );
+ aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, FALSE);
+ }
+}
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwNavigationPI::Resize()
+{
+ Window* pParent = GetParent();
+ FloatingWindow* pFloat = ((DockingWindow*)pParent)->GetFloatingWindow();
+ Size aNewSize;
+ if( !_IsZoomedIn() )
+ {
+ //change the minimum width depending on the dock status
+ Size aMinOutSizePixel = ((SfxDockingWindow*)pParent)->GetMinOutputSizePixel();
+ if( pFloat)
+ {
+ aNewSize = pFloat->GetOutputSizePixel();
+ aMinOutSizePixel.Width() = nWishWidth;
+ aMinOutSizePixel.Height() = _IsZoomedIn() ? nZoomIn : nZoomOutInit;
+ }
+ else
+ {
+ aNewSize = pParent->GetOutputSizePixel();
+ aMinOutSizePixel.Width() = 0;
+ aMinOutSizePixel.Height() = 0;
+ }
+ ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(aMinOutSizePixel);
+
+ const Point aPos = aContentTree.GetPosPixel();
+ Point aLBPos = aDocListBox.GetPosPixel();
+ long nDist = aPos.X();
+ aNewSize.Height() -= (aPos.Y() + aPos.X() + nDocLBIniHeight + nDist);
+ aNewSize.Width() -= 2 * nDist;
+ aLBPos.Y() = aPos.Y() + aNewSize.Height() + nDist;
+ aDocListBox.Show(!aGlobalTree.IsVisible() && aLBPos.Y() > aPos.Y() );
+
+ Size aDocLBSz = aDocListBox.GetSizePixel();
+ aDocLBSz.Width() = aNewSize.Width();
+ if(aNewSize.Height() < 0)
+ aDocLBSz.Height() = 0;
+ else
+ aDocLBSz.Height() = nDocLBIniHeight;
+ aContentTree.SetSizePixel(aNewSize);
+ // GlobalTree faengt weiter oben an und reicht bis ganz unten
+ aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree.GetPosPixel().Y());
+ aGlobalTree.SetSizePixel(aNewSize);
+ aDocListBox.SetPosSizePixel( aLBPos.X(), aLBPos.Y(),
+ aDocLBSz.Width(), aDocLBSz.Height(),
+ WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH);
+
+ }
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings,
+ SfxChildWindowContext* pCw,
+ Window* pParent) :
+
+ Window( pParent, SW_RES(DLG_NAVIGATION_PI)),
+ SfxControllerItem( SID_DOCFULLNAME, *_pBindings ),
+
+ aContentToolBox(this, SW_RES(TB_CONTENT)),
+ aGlobalToolBox(this, SW_RES(TB_GLOBAL)),
+ aContentImageList(SW_RES(IL_CONTENT)),
+ aContentImageListH(SW_RES(ILH_CONTENT)),
+ aContentTree(this, SW_RES(TL_CONTENT)),
+ aGlobalTree(this, SW_RES(TL_GLOBAL)),
+ aDocListBox(this, SW_RES(LB_DOCS)),
+
+ pxObjectShell(0),
+ pContentView(0),
+ pContentWrtShell(0),
+ pActContView(0),
+ pCreateView(0),
+ pPopupWindow(0),
+ pFloatingWindow(0),
+
+ pContextWin(pCw),
+
+ pConfig(SW_MOD()->GetNavigationConfig()),
+ rBindings(*_pBindings),
+
+ nWishWidth(0),
+ nAutoMarkIdx(1),
+ nRegionMode(REGION_MODE_NONE),
+
+ bSmallMode(FALSE),
+ bIsZoomedIn(FALSE),
+ bPageCtrlsVisible(FALSE),
+ bGlobalMode(FALSE)
+{
+ GetCreateView();
+ InitImageList();
+
+ aContentToolBox.SetHelpId(HID_NAVIGATOR_TOOLBOX );
+ aGlobalToolBox.SetHelpId(HID_NAVIGATOR_GLOBAL_TOOLBOX);
+ aDocListBox.SetHelpId(HID_NAVIGATOR_LISTBOX );
+
+ nDocLBIniHeight = aDocListBox.GetSizePixel().Height();
+ nZoomOutInit = nZoomOut = Resource::ReadShortRes();
+
+ //NumericField in die Toolbox einfuegen
+ NumEditAction* pEdit = new NumEditAction(
+ &aContentToolBox, SW_RES(NF_PAGE ));
+ pEdit->SetActionHdl(LINK(this, SwNavigationPI, EditAction));
+ pEdit->SetGetFocusHdl(LINK(this, SwNavigationPI, EditGetFocus));
+ pEdit->SetModifyHdl(LINK(this, SwNavigationPI, PageEditModifyHdl));
+
+ bPageCtrlsVisible = TRUE;
+
+// Rectangle aFirstRect = aContentToolBox.GetItemRect(FN_SHOW_ROOT);
+// USHORT nWidth = 2 * (USHORT)aFirstRect.Left();
+ //doppelte Separatoren sind nicht erlaubt, also muss
+ //die passende Groesse anders ermittelt werden
+ Rectangle aFirstRect = aContentToolBox.GetItemRect(FN_SELECT_FOOTNOTE);
+ Rectangle aSecondRect = aContentToolBox.GetItemRect(FN_SELECT_HEADER);
+ USHORT nWidth = USHORT(aFirstRect.Left() - aSecondRect.Left());
+
+ Size aItemWinSize( nWidth , aFirstRect.Bottom() - aFirstRect.Top() );
+ pEdit->SetSizePixel(aItemWinSize);
+ aContentToolBox.InsertSeparator(4);
+ aContentToolBox.InsertWindow( FN_PAGENUMBER, pEdit, 0, 4);
+ aContentToolBox.InsertSeparator(4);
+ aContentToolBox.SetHelpId(FN_PAGENUMBER, HID_NAVI_TBX16);
+ aContentToolBox.ShowItem( FN_PAGENUMBER );
+
+ for( USHORT i = 0; i <= REGION_MODE_EMBEDDED; i++ )
+ {
+ aContextArr[i] = SW_RESSTR(ST_HYPERLINK + i);
+ aStatusArr[i] = SW_RESSTR(ST_STATUS_FIRST + i);
+ }
+ aStatusArr[3] = SW_RESSTR(ST_ACTIVE_VIEW);
+ FreeResource();
+
+
+ const Size& rOutSize = GetOutputSizePixel();
+
+ nZoomIn = (short)rOutSize.Height();
+
+ // Make sure the toolbox has a size that fits all its contents
+ Size aContentToolboxSize( aContentToolBox.CalcWindowSizePixel() );
+ aContentToolBox.SetOutputSizePixel( aContentToolboxSize );
+
+ // position listbox below toolbar and add some space
+ long nListboxYPos = aContentToolBox.GetPosPixel().Y() + aContentToolboxSize.Height() + 4;
+
+ //Der linke und rechte Rand um die Toolboxen soll gleich sein
+ nWishWidth = aContentToolboxSize.Width();
+ nWishWidth += 2 * aContentToolBox.GetPosPixel().X();
+
+ FloatingWindow* pFloat = ((DockingWindow*)pParent)->GetFloatingWindow();
+ Size aMinSize(pFloat ? nWishWidth : 0, pFloat ? nZoomOutInit : 0);
+ ((SfxDockingWindow*)pParent)->SetMinOutputSizePixel(aMinSize);
+ SetOutputSizePixel( Size( nWishWidth, nZoomOutInit));
+ Size aTmpParentSize(((SfxDockingWindow*)pParent)->GetSizePixel());
+ if(
+ (
+ aTmpParentSize.Width() < aMinSize.Width() ||
+ aTmpParentSize.Height() < aMinSize.Height()
+ )
+ &&
+ ((SfxDockingWindow*)pParent)->GetFloatingWindow() &&
+ !((SfxDockingWindow*)pParent)->GetFloatingWindow()->IsRollUp()
+ )
+ ((SfxDockingWindow*)pParent)->SetOutputSizePixel(aMinSize);
+
+ aContentTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
+ aContentTree.SetStyle( aContentTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|
+ WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE );
+ aContentTree.SetSpaceBetweenEntries(3);
+ aContentTree.SetSelectionMode( SINGLE_SELECTION );
+ aContentTree.SetDragDropMode( SV_DRAGDROP_CTRL_MOVE |
+ SV_DRAGDROP_CTRL_COPY |
+ SV_DRAGDROP_ENABLE_TOP );
+ aContentTree.EnableAsyncDrag(TRUE);
+ aContentTree.ShowTree();
+ aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, TRUE);
+
+// TreeListBox fuer Globaldokument
+ aGlobalTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
+ aGlobalTree.SetSelectionMode( MULTIPLE_SELECTION );
+ aGlobalTree.SetStyle( aGlobalTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|
+ WB_CLIPCHILDREN|WB_HSCROLL );
+ Size aGlblSize(aGlobalToolBox.CalcWindowSizePixel());
+ aGlobalToolBox.SetSizePixel(aGlblSize);
+
+// Handler
+
+ Link aLk = LINK(this, SwNavigationPI, ToolBoxSelectHdl);
+ aContentToolBox.SetSelectHdl( aLk );
+ aGlobalToolBox.SetSelectHdl( aLk );
+ aDocListBox.SetSelectHdl(LINK(this, SwNavigationPI,
+ DocListBoxSelectHdl));
+ aContentToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) );
+ aContentToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) );
+ aGlobalToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) );
+ aGlobalToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) );
+ aGlobalToolBox.CheckItem(FN_GLOBAL_SWITCH, TRUE);
+
+ Font aFont(GetFont());
+ aFont.SetWeight(WEIGHT_NORMAL);
+ GetPageEdit().SetFont(aFont);
+ aFont = aContentTree.GetFont();
+ aFont.SetWeight(WEIGHT_NORMAL);
+ aContentTree.SetFont(aFont);
+ aGlobalTree.SetFont(aFont);
+
+ StartListening(*SFX_APP());
+ if ( pCreateView )
+ StartListening(*pCreateView);
+ SfxImageManager* pImgMan = SfxImageManager::GetImageManager( SW_MOD() );
+ pImgMan->RegisterToolBox(&aContentToolBox, SFX_TOOLBOX_CHANGEOUTSTYLE);
+ pImgMan->RegisterToolBox(&aGlobalToolBox, SFX_TOOLBOX_CHANGEOUTSTYLE);
+
+ aContentToolBox.SetItemBits( FN_CREATE_NAVIGATION, aContentToolBox.GetItemBits( FN_CREATE_NAVIGATION ) | TIB_DROPDOWNONLY );
+ aContentToolBox.SetItemBits( FN_DROP_REGION, aContentToolBox.GetItemBits( FN_DROP_REGION ) | TIB_DROPDOWNONLY );
+ aContentToolBox.SetItemBits( FN_OUTLINE_LEVEL, aContentToolBox.GetItemBits( FN_OUTLINE_LEVEL ) | TIB_DROPDOWNONLY );
+
+ if(IsGlobalDoc())
+ {
+ SwView *pActView = GetCreateView();
+ aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT,
+ pActView->GetWrtShellPtr()->IsGlblDocSaveLinks());
+ if(pConfig->IsGlobalActive())
+ ToggleTree();
+ aGlobalTree.GrabFocus();
+ }
+ else
+ aContentTree.GrabFocus();
+ UsePage(0);
+ aPageChgTimer.SetTimeoutHdl(LINK(this, SwNavigationPI, ChangePageHdl));
+ aPageChgTimer.SetTimeout(PAGE_CHANGE_TIMEOUT);
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwNavigationPI::~SwNavigationPI()
+{
+ if(IsGlobalDoc() && !IsGlobalMode())
+ {
+ SwView *pView = GetCreateView();
+ SwWrtShell &rSh = pView->GetWrtShell();
+ if( !rSh.IsAllProtect() )
+ pView->GetDocShell()->SetReadOnlyUI(FALSE);
+ }
+
+ EndListening(*SFX_APP());
+
+ SfxImageManager* pImgMan = SfxImageManager::GetImageManager( SW_MOD() );
+ pImgMan->ReleaseToolBox(&aContentToolBox);
+ pImgMan->ReleaseToolBox(&aGlobalToolBox);
+ delete aContentToolBox.GetItemWindow(FN_PAGENUMBER);
+ aContentToolBox.Clear();
+ if(pxObjectShell)
+ {
+ if(pxObjectShell->Is())
+ (*pxObjectShell)->DoClose();
+ delete pxObjectShell;
+ }
+ delete pPopupWindow;
+ delete pFloatingWindow;
+
+ if ( IsBound() )
+ rBindings.Release(*this);
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwNavigationPI::SetPopupWindow( SfxPopupWindow* pWindow )
+{
+ pPopupWindow = pWindow;
+ pPopupWindow->SetPopupModeEndHdl( LINK( this, SwNavigationPI, PopupModeEndHdl ));
+ pPopupWindow->SetDeleteLink_Impl( LINK( this, SwNavigationPI, ClosePopupWindow ));
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwNavigationPI, PopupModeEndHdl, void *, EMPTYARG )
+{
+ if ( pPopupWindow->IsVisible() )
+ {
+ // Replace floating window with popup window and destroy
+ // floating window instance.
+ delete pFloatingWindow;
+ pFloatingWindow = pPopupWindow;
+ pPopupWindow = 0;
+ }
+ else
+ {
+ // Popup window has been closed by the user. No replacement, instance
+ // will destroy itself.
+ pPopupWindow = 0;
+ }
+
+ return 1;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK( SwNavigationPI, ClosePopupWindow, SfxPopupWindow *, pWindow )
+{
+ if ( pWindow == pFloatingWindow )
+ pFloatingWindow = 0;
+ else
+ pPopupWindow = 0;
+
+ return 1;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwNavigationPI::StateChanged( USHORT nSID, SfxItemState /*eState*/,
+ const SfxPoolItem* /*pState*/ )
+{
+ if(nSID == SID_DOCFULLNAME)
+ {
+ SwView *pActView = GetCreateView();
+ if(pActView)
+ {
+ SwWrtShell* pWrtShell = pActView->GetWrtShellPtr();
+ aContentTree.SetActiveShell(pWrtShell);
+ BOOL bGlobal = IsGlobalDoc();
+ aContentToolBox.EnableItem(FN_GLOBAL_SWITCH, bGlobal);
+ if( (!bGlobal && IsGlobalMode()) ||
+ (!IsGlobalMode() && pConfig->IsGlobalActive()) )
+ {
+ ToggleTree();
+ }
+ if(bGlobal)
+ {
+ aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT, pWrtShell->IsGlblDocSaveLinks());
+ }
+ }
+ else
+ {
+ aContentTree.SetActiveShell(0);
+ }
+ UpdateListBox();
+ }
+}
+
+/*------------------------------------------------------------------------
+ Bechreibung: NumericField aus der Toolbox holen
+------------------------------------------------------------------------*/
+
+NumEditAction& SwNavigationPI::GetPageEdit()
+{
+ return *(NumEditAction*)aContentToolBox.GetItemWindow(FN_PAGENUMBER);
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SfxChildAlignment SwNavigationPI::CheckAlignment
+ (
+ SfxChildAlignment eActAlign,
+ SfxChildAlignment eAlign
+ )
+{
+SfxChildAlignment eRetAlign;
+
+ if(_IsZoomedIn())
+ eRetAlign = SFX_ALIGN_NOALIGNMENT;
+ else
+ switch (eAlign)
+ {
+ case SFX_ALIGN_BOTTOM:
+ case SFX_ALIGN_LOWESTBOTTOM:
+ case SFX_ALIGN_HIGHESTBOTTOM:
+ eRetAlign = eActAlign;
+ break;
+
+ case SFX_ALIGN_TOP:
+ case SFX_ALIGN_HIGHESTTOP:
+ case SFX_ALIGN_LOWESTTOP:
+ case SFX_ALIGN_LEFT:
+ case SFX_ALIGN_RIGHT:
+ case SFX_ALIGN_FIRSTLEFT:
+ case SFX_ALIGN_LASTLEFT:
+ case SFX_ALIGN_FIRSTRIGHT:
+ case SFX_ALIGN_LASTRIGHT:
+ eRetAlign = eAlign;
+ break;
+
+ default:
+ eRetAlign = eAlign;
+ break;
+ }
+ return eRetAlign;
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Benachrichtigung bei geaenderter DocInfo
+ --------------------------------------------------------------------*/
+
+void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint )
+{
+ if(&rBrdc == pCreateView)
+ {
+ if(rHint.ISA(SfxSimpleHint) && ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING)
+ {
+ pCreateView = 0;
+ }
+ }
+ else
+ {
+ if(rHint.ISA(SfxEventHint))
+ {
+ if( pxObjectShell &&
+ ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_CLOSEAPP)
+ {
+ DELETEZ(pxObjectShell);
+ }
+ else if(((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_OPENDOC)
+ {
+
+ SwView *pActView = GetCreateView();
+ if(pActView)
+ {
+ SwWrtShell* pWrtShell = pActView->GetWrtShellPtr();
+ aContentTree.SetActiveShell(pWrtShell);
+ if(aGlobalTree.IsVisible())
+ {
+ if(aGlobalTree.Update( FALSE ))
+ aGlobalTree.Display();
+ else
+ // wenn kein Update notwendig, dann zumindest painten
+ // wg. der roten Eintraege fuer broken links
+ aGlobalTree.Invalidate();
+ }
+ }
+ }
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( SwNavigationPI, MenuSelectHdl, Menu *, pMenu )
+{
+ USHORT nMenuId = pMenu->GetCurItemId();
+ if(nMenuId != USHRT_MAX)
+ {
+ if(nMenuId < 100)
+ SetRegionDropMode( --nMenuId);
+ else
+ aContentTree.SetOutlineLevel( static_cast< BYTE >(nMenuId - 100) );
+ }
+ return 0;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void SwNavigationPI::UpdateListBox()
+{
+ aDocListBox.SetUpdateMode(FALSE);
+ aDocListBox.Clear();
+ SwView *pActView = GetCreateView();
+ BOOL bDisable = pActView == 0;
+ SwView *pView = SwModule::GetFirstView();
+ USHORT nCount = 0;
+ USHORT nAct = 0;
+ USHORT nConstPos = 0;
+ const SwView* pConstView = aContentTree.IsConstantView() &&
+ aContentTree.GetActiveWrtShell() ?
+ &aContentTree.GetActiveWrtShell()->GetView():
+ 0;
+ while (pView)
+ {
+ SfxObjectShell* pDoc = pView->GetDocShell();
+ // pb: #i53333# don't show help pages here
+ if ( !pDoc->IsHelpDocument() )
+ {
+ String sEntry = pDoc->GetTitle();
+ sEntry += C2S(" (");
+ if (pView == pActView)
+ {
+ nAct = nCount;
+ sEntry += aStatusArr[ST_ACTIVE - ST_STATUS_FIRST];
+ }
+ else
+ sEntry += aStatusArr[ST_INACTIVE - ST_STATUS_FIRST];
+ sEntry += ')';
+ aDocListBox.InsertEntry(sEntry);
+
+
+ if (pConstView && pView == pConstView)
+ nConstPos = nCount;
+
+ nCount++;
+ }
+ pView = SwModule::GetNextView(pView);
+ }
+ aDocListBox.InsertEntry(aStatusArr[3]); //"Aktives Fenster"
+ nCount++;
+
+ if(aContentTree.GetHiddenWrtShell())
+ {
+ String sEntry = aContentTree.GetHiddenWrtShell()->GetView().
+ GetDocShell()->GetTitle();
+ sEntry += C2S(" (");
+ sEntry += aStatusArr[ST_HIDDEN - ST_STATUS_FIRST];
+ sEntry += ')';
+ aDocListBox.InsertEntry(sEntry);
+ bDisable = FALSE;
+ }
+ if(aContentTree.IsActiveView())
+ {
+ //entweder den Namen des akt. Docs oder "Aktives Dokument"
+ USHORT nTmp = pActView ? nAct : --nCount;
+ aDocListBox.SelectEntryPos( nTmp );
+ }
+ else if(aContentTree.IsHiddenView())
+ {
+ aDocListBox.SelectEntryPos(nCount);
+ }
+ else
+ aDocListBox.SelectEntryPos(nConstPos);
+
+ aDocListBox.Enable( !bDisable );
+ aDocListBox.SetUpdateMode(TRUE);
+}
+
+/*-----------------16.06.97 15:05-------------------
+
+--------------------------------------------------*/
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem *, pItem)
+{
+ const SfxViewFrameItem* pFrameItem = PTR_CAST(SfxViewFrameItem, pItem );
+ if( pFrameItem )
+ {
+ SfxViewFrame* pFrame = pFrameItem->GetFrame();
+ if(pFrame)
+ {
+ aContentTree.Clear();
+ pContentView = PTR_CAST(SwView, pFrame->GetViewShell());
+ DBG_ASSERT(pContentView, "keine SwView");
+ if(pContentView)
+ pContentWrtShell = pContentView->GetWrtShellPtr();
+ else
+ pContentWrtShell = 0;
+ pxObjectShell = new SfxObjectShellLock(pFrame->GetObjectShell());
+ FillBox();
+ aContentTree.Update();
+ }
+ }
+ return 0;
+}
+
+String SwNavigationPI::CreateDropFileName( TransferableDataHelper& rData )
+{
+ String sFileName;
+ ULONG nFmt;
+ if( rData.HasFormat( nFmt = FORMAT_FILE_LIST ))
+ {
+ FileList aFileList;
+ rData.GetFileList( nFmt, aFileList );
+ sFileName = aFileList.GetFile( 0 );
+ }
+ else if( rData.HasFormat( nFmt = FORMAT_STRING ) ||
+ rData.HasFormat( nFmt = FORMAT_FILE ) ||
+ rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILENAME ))
+ rData.GetString( nFmt, sFileName );
+ else if( rData.HasFormat( nFmt = SOT_FORMATSTR_ID_SOLK ) ||
+ rData.HasFormat( nFmt = SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK )||
+ rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILECONTENT ) ||
+ rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) ||
+ rData.HasFormat( nFmt = SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ))
+ {
+ INetBookmark aBkmk( aEmptyStr, aEmptyStr );
+ rData.GetINetBookmark( nFmt, aBkmk );
+ sFileName = aBkmk.GetURL();
+ }
+ if( sFileName.Len() )
+ {
+ sFileName = INetURLObject( sFileName ).GetMainURL( INetURLObject::NO_DECODE );
+ }
+ return sFileName;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+sal_Int8 SwNavigationPI::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
+{
+ return ( !aContentTree.IsInDrag() &&
+ ( aContentTree.IsDropFormatSupported( FORMAT_FILE ) ||
+ aContentTree.IsDropFormatSupported( FORMAT_STRING ) ||
+ aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_SOLK ) ||
+ aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK )||
+ aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILECONTENT ) ||
+ aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) ||
+ aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) ||
+ aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILENAME )))
+ ? DND_ACTION_COPY
+ : DND_ACTION_NONE;
+}
+
+sal_Int8 SwNavigationPI::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
+ sal_Int8 nRet = DND_ACTION_NONE;
+ String sFileName;
+ if( !aContentTree.IsInDrag() &&
+ 0 != (sFileName = SwNavigationPI::CreateDropFileName( aData )).Len() )
+ {
+ INetURLObject aTemp( sFileName );
+ GraphicDescriptor aDesc( aTemp );
+ if( !aDesc.Detect() ) // keine Grafiken annehmen
+ {
+ if( STRING_NOTFOUND == sFileName.Search('#')
+ && (!sContentFileName.Len() || sContentFileName != sFileName ))
+ {
+ nRet = rEvt.mnAction;
+ sFileName.EraseTrailingChars( char(0) );
+ sContentFileName = sFileName;
+ if(pxObjectShell)
+ {
+ aContentTree.SetHiddenShell( 0 );
+ (*pxObjectShell)->DoClose();
+ DELETEZ( pxObjectShell);
+ }
+ SfxStringItem aFileItem(SID_FILE_NAME, sFileName );
+ String sOptions = C2S("HRC");
+ SfxStringItem aOptionsItem( SID_OPTIONS, sOptions );
+ SfxLinkItem aLink( SID_DONELINK,
+ LINK( this, SwNavigationPI, DoneLink ) );
+ GetActiveView()->GetViewFrame()->GetDispatcher()->Execute(
+ SID_OPENDOC, SFX_CALLMODE_ASYNCHRON,
+ &aFileItem, &aOptionsItem, &aLink, 0L );
+ }
+ }
+ }
+ return nRet;
+}
+
+/*-----------------27.11.96 13.00-------------------
+
+--------------------------------------------------*/
+
+void SwNavigationPI::SetRegionDropMode(USHORT nNewMode)
+{
+ nRegionMode = nNewMode;
+ pConfig->SetRegionMode( nRegionMode );
+
+ USHORT nDropId = FN_DROP_REGION;
+ if(nRegionMode == REGION_MODE_LINK)
+ nDropId = FN_DROP_REGION_LINK;
+ else if(nRegionMode == REGION_MODE_EMBEDDED)
+ nDropId = FN_DROP_REGION_COPY;
+
+ ImageList& rImgLst = aContentToolBox.GetSettings().GetStyleSettings().GetHighContrastMode()
+ ? aContentImageListH : aContentImageList;
+
+ aContentToolBox.SetItemImage( FN_DROP_REGION,
+ rImgLst.GetImage(nDropId));
+}
+
+
+/*-----------------12.06.97 09:47-------------------
+
+--------------------------------------------------*/
+
+BOOL SwNavigationPI::ToggleTree()
+{
+ BOOL bRet = TRUE;
+ BOOL bGlobalDoc = IsGlobalDoc();
+ if(!IsGlobalMode() && bGlobalDoc)
+ {
+ SetUpdateMode(FALSE);
+ if(_IsZoomedIn())
+ _ZoomOut();
+ aGlobalTree.ShowTree();
+ aGlobalToolBox.Show();
+ aContentTree.HideTree();
+ aContentToolBox.Hide();
+ aDocListBox.Hide();
+ SetGlobalMode(TRUE);
+ SetUpdateMode(TRUE);
+ }
+ else
+ {
+ aGlobalTree.HideTree();
+ aGlobalToolBox.Hide();
+ if(!_IsZoomedIn())
+ {
+ aContentTree.ShowTree();
+ aContentToolBox.Show();
+ aDocListBox.Show();
+ }
+ bRet = FALSE;
+ SetGlobalMode(FALSE);
+ }
+ return bRet;
+}
+
+/*-----------------13.06.97 09:42-------------------
+
+--------------------------------------------------*/
+BOOL SwNavigationPI::IsGlobalDoc() const
+{
+ BOOL bRet = FALSE;
+ SwView *pView = GetCreateView();
+ if(pView)
+ {
+ SwWrtShell &rSh = pView->GetWrtShell();
+ bRet = rSh.IsGlobalDoc();
+ }
+ return bRet;
+}
+/* -----------------26.10.98 08:10-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwNavigationPI, ChangePageHdl, Timer*, EMPTYARG )
+{
+ EditAction(&GetPageEdit());
+ GetPageEdit().GrabFocus();
+ return 0;
+}
+/* -----------------26.10.98 08:14-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK( SwNavigationPI, PageEditModifyHdl, Edit*, EMPTYARG )
+{
+ if(aPageChgTimer.IsActive())
+ aPageChgTimer.Stop();
+ aPageChgTimer.Start();
+ return 0;
+}
+
+/* -----------------------------23.04.01 07:34--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwView* SwNavigationPI::GetCreateView() const
+{
+ if(!pCreateView)
+ {
+ SwView* pView = SwModule::GetFirstView();
+ while(pView)
+ {
+ if(&pView->GetViewFrame()->GetBindings() == &rBindings)
+ {
+ ((SwNavigationPI*)this)->pCreateView = pView;
+ ((SwNavigationPI*)this)->StartListening(*pCreateView);
+ break;
+ }
+ pView = SwModule::GetNextView(pView);
+ }
+ }
+ return pCreateView;
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+SwNavigationChild::SwNavigationChild( Window* pParent,
+ USHORT nId,
+ SfxBindings* _pBindings,
+ SfxChildWinInfo* pInfo )
+ : SfxChildWindowContext( nId )
+{
+ SwNavigationPI* pNavi = new SwNavigationPI( _pBindings, this, pParent );
+ SetWindow( pNavi );
+ _pBindings->Invalidate(SID_NAVIGATOR);
+ String sExtra = pInfo->aExtraString;
+
+ SwNavigationConfig* pNaviConfig = SW_MOD()->GetNavigationConfig();
+
+ USHORT nRootType = static_cast< USHORT >( pNaviConfig->GetRootType() );
+ if( nRootType < CONTENT_TYPE_MAX )
+ {
+ pNavi->aContentTree.SetRootType(nRootType);
+ pNavi->aContentToolBox.CheckItem(FN_SHOW_ROOT, TRUE);
+ }
+ pNavi->aContentTree.SetOutlineLevel( static_cast< BYTE >( pNaviConfig->GetOutlineLevel() ) );
+ pNavi->SetRegionDropMode( static_cast< USHORT >( pNaviConfig->GetRegionMode() ) );
+
+ if(GetFloatingWindow() && pNaviConfig->IsSmall())
+ {
+ pNavi->_ZoomIn();
+ }
+}
+/* -----------------------------06.05.2002 10:06------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNavigationPI::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ Window::DataChanged( rDCEvt );
+ if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+ (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ InitImageList();
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ Color aBgColor = rStyleSettings.GetFaceColor();
+ Wallpaper aBack( aBgColor );
+ SetBackground( aBack );
+ }
+}
+/* -----------------------------06.05.2002 10:07------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwNavigationPI::InitImageList()
+{
+ USHORT k;
+
+ ImageList& rImgLst = aContentToolBox.GetSettings().GetStyleSettings().GetHighContrastMode() ?
+ aContentImageListH : aContentImageList;
+ for( k = 0; k < aContentToolBox.GetItemCount(); k++)
+ aContentToolBox.SetItemImage(aContentToolBox.GetItemId(k),
+ rImgLst.GetImage(aContentToolBox.GetItemId(k)));
+
+ for( k = 0; k < aGlobalToolBox.GetItemCount(); k++)
+ aGlobalToolBox.SetItemImage(aGlobalToolBox.GetItemId(k),
+ rImgLst.GetImage(aGlobalToolBox.GetItemId(k)));
+
+ USHORT nDropId = FN_DROP_REGION;
+ if(nRegionMode == REGION_MODE_LINK)
+ nDropId = FN_DROP_REGION_LINK;
+ else if(nRegionMode == REGION_MODE_EMBEDDED)
+ nDropId = FN_DROP_REGION_COPY;
+ aContentToolBox.SetItemImage( FN_DROP_REGION,
+ rImgLst.GetImage(nDropId));
+}
+
diff --git a/sw/source/ui/utlui/navipi.hrc b/sw/source/ui/utlui/navipi.hrc
new file mode 100644
index 000000000000..8254e2dc92a9
--- /dev/null
+++ b/sw/source/ui/utlui/navipi.hrc
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#define TB_1 1
+#define TB_2 2
+#define TB_3 3
+#define TB_4 4
+#define BT_UP 5
+#define BT_DOWN 6
+#define IL_CONTENT 7
+#define ILH_CONTENT 8
+#define FT_PAGE 10
+#define ED_PAGE 11
+#define LB_SELECT 22
+#define TL_SELECT 23
+#define TB_PAGE_TEXT 41
+#define TB_PAGE_COUNT 42
+#define TB_CONTENT 50
+#define TL_CONTENT 51
+#define LB_DOCS 53
+#define NF_PAGE 54
+#define TL_GLOBAL 55
+#define TB_GLOBAL 56
+
+//-------------------------------------------------------------------
+// Strings fuer Kontextmenue des ContentTree
+#define ST_CONTEXT_FIRST 60
+#define ST_OUTLINE_LEVEL ST_CONTEXT_FIRST
+#define ST_DRAGMODE (ST_CONTEXT_FIRST + 1)
+#define ST_HYPERLINK (ST_CONTEXT_FIRST + 2)
+#define ST_LINK_REGION (ST_CONTEXT_FIRST + 3)
+#define ST_COPY_REGION (ST_CONTEXT_FIRST + 4)
+#define ST_DISPLAY (ST_CONTEXT_FIRST + 5)
+#define ST_ACTIVE_VIEW (ST_CONTEXT_FIRST + 6)
+#define ST_STATUS_FIRST 67
+#define ST_HIDDEN (ST_STATUS_FIRST )
+#define ST_ACTIVE (ST_STATUS_FIRST + 1)
+#define ST_INACTIVE (ST_STATUS_FIRST + 2)
+#define ST_MISC 70
+#define ST_EDIT_ENTRY ST_MISC
+#define ST_DELETE_ENTRY (ST_MISC + 1)
+
+#define ST_GLOBAL_CONTEXT_FIRST (ST_DELETE_ENTRY + 1)
+#define ST_UPDATE (ST_GLOBAL_CONTEXT_FIRST )
+#define ST_EDIT_CONTENT (ST_GLOBAL_CONTEXT_FIRST + 1)
+#define ST_INSERT (ST_GLOBAL_CONTEXT_FIRST + 2)
+#define ST_INDEX (ST_GLOBAL_CONTEXT_FIRST + 3)
+#define ST_FILE (ST_GLOBAL_CONTEXT_FIRST + 4)
+#define ST_NEW_FILE (ST_GLOBAL_CONTEXT_FIRST + 5)
+#define ST_TEXT (ST_GLOBAL_CONTEXT_FIRST + 6)
+#define ST_DELETE (ST_GLOBAL_CONTEXT_FIRST + 7)
+#define ST_UPDATE_SEL (ST_GLOBAL_CONTEXT_FIRST + 8)
+#define ST_UPDATE_INDEX (ST_GLOBAL_CONTEXT_FIRST + 9)
+#define ST_UPDATE_LINK (ST_GLOBAL_CONTEXT_FIRST +10)
+#define ST_UPDATE_ALL (ST_GLOBAL_CONTEXT_FIRST +11)
+#define ST_BROKEN_LINK (ST_GLOBAL_CONTEXT_FIRST +12)
+#define ST_EDIT_LINK (ST_GLOBAL_CONTEXT_FIRST +13)
+
+#define ST_REMOVE_INDEX (ST_GLOBAL_CONTEXT_FIRST +30)
+#define ST_REMOVE_TBL_PROTECTION (ST_GLOBAL_CONTEXT_FIRST +31)
+#define ST_RENAME (ST_GLOBAL_CONTEXT_FIRST +32)
+#define ST_READONLY_IDX (ST_GLOBAL_CONTEXT_FIRST +33)
+#define ST_INVISIBLE (ST_GLOBAL_CONTEXT_FIRST +34)
+
+#define ST_POSTIT_SHOW (ST_GLOBAL_CONTEXT_FIRST +35)
+#define ST_POSTIT_HIDE (ST_GLOBAL_CONTEXT_FIRST +36)
+#define ST_POSTIT_DELETE (ST_GLOBAL_CONTEXT_FIRST +37)
+
diff --git a/sw/source/ui/utlui/navipi.src b/sw/source/ui/utlui/navipi.src
new file mode 100644
index 000000000000..0c45e3203df0
--- /dev/null
+++ b/sw/source/ui/utlui/navipi.src
@@ -0,0 +1,536 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "cmdid.h"
+#include "utlui.hrc"
+#include "navipi.hrc"
+#include "helpid.h"
+
+Window DLG_NAVIGATION_PI
+{
+ HelpID = HID_NAVIGATION_PI ;
+ OutputSize = TRUE ;
+ DialogControl = TRUE ;
+ SVLook = TRUE ;
+ // Size = MAP_PIXEL( 235, 195 );
+ // ZoomInOutputSize = MAP_PIXEL(235, 56);
+ Size = MAP_PIXEL ( 282 , 59 ) ;
+ // Closeable = TRUE ;
+ // Zoomable = TRUE ;
+ // Moveable = TRUE ;
+ // ZoomIn = FALSE;
+ Hide = TRUE ;
+ // HideWhenDeactivate = TRUE ;
+ // Sizeable = TRUE ;
+ // EnableResizing = TRUE ;
+ // Dockable = TRUE ;
+ // Sizeable = TRUE ;
+ Text [ en-US ] = "Navigator" ;
+ ExtraData =
+ {
+ 198;
+ };
+ /************************************************************************************
+ Toolbox ab 323 x
+************************************************************************************/
+#define NAVI_IDLIST \
+ IdList = \
+ { \
+ FN_UP ; \
+ FN_DOWN ; \
+ FN_SELECT_HEADER ; \
+ FN_SELECT_FOOTER ; \
+ FN_SELECT_FOOTNOTE ; \
+ FN_SHOW_CONTENT_BOX ; \
+ FN_SHOW_ROOT ; \
+ FN_ITEM_UP ; \
+ FN_ITEM_DOWN ; \
+ FN_ITEM_LEFT ; \
+ FN_ITEM_RIGHT ; \
+ FN_DROP_REGION ; \
+ FN_OUTLINE_LEVEL ; \
+ FN_SELECT_SET_AUTO_BOOKMARK ; \
+ FN_DROP_REGION_LINK ; \
+ FN_DROP_REGION_COPY ; \
+ FN_GLOBAL_SWITCH ; \
+ FN_GLOBAL_EDIT ; \
+ FN_GLOBAL_UPDATE ; \
+ FN_GLOBAL_OPEN ; \
+ FN_GLOBAL_SAVE_CONTENT ; \
+ FN_CREATE_NAVIGATION ; \
+ }; \
+ IdCount = { 21 ; };
+
+ ImageList IL_CONTENT
+ {
+ Prefix = "sc";
+ MaskColor = IMAGE_MASK_COLOR ;
+ NAVI_IDLIST
+ };
+ ImageList ILH_CONTENT
+ {
+ Prefix = "sch";
+ MaskColor = IMAGE_MASK_COLOR ;
+ NAVI_IDLIST
+ };
+ Toolbox TB_CONTENT
+ {
+ Pos = MAP_PIXEL ( 5 , 5 ) ;
+ Size = MAP_PIXEL ( 300 , 47 ) ;
+ LineCount = 2 ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = FN_GLOBAL_SWITCH ;
+ HelpID = HID_NAVI_TBX17 ;
+ Text [ en-US ] = "Toggle" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_CREATE_NAVIGATION ;
+ HelpID = HID_NAVI_TBX24 ;
+ Text [ en-US ] = "Navigation" ;
+ DropDown = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_UP ;
+ // ItemBitmap = Bitmap { File = "navup.bmp"; };
+ HelpID = HID_NAVI_TBX2 ;
+ /* ### ACHTUNG: Neuer Text in Resource? Rückwärts : R³ckwõrts */
+ Text [ en-US ] = "Back" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_DOWN ;
+ // ItemBitmap = Bitmap { File = "navdn.bmp"; };
+ HelpID = HID_NAVI_TBX3 ;
+ /* ### ACHTUNG: Neuer Text in Resource? Vorwärts : Vorwõrts */
+ Text [ en-US ] = "Forward" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_DROP_REGION ;
+ HelpID = HID_NAVI_TBX4 ;
+ /* ### ACHTUNG: Neuer Text in Resource? Modus für Drag & Drop auswählen : Modus f³r Drag & Drop auswõhlen */
+ DropDown = TRUE ;
+ Text [ en-US ] = "Drag Mode" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_ITEM_UP ;
+ // ItemBitmap = Bitmap { File = "navchup.bmp"; };
+ HelpID = HID_NAVI_TBX5 ;
+ Text [ en-US ] = "Promote Chapter" ;
+ //HelpText[english_us-wrong] = "Move chapter down";//"Move chapter up"
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_ITEM_DOWN ;
+ // ItemBitmap = Bitmap { File = "navchdn.bmp"; };
+ HelpID = HID_NAVI_TBX6 ;
+ Text [ en-US ] = "Demote Chapter" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_BREAK ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_SHOW_CONTENT_BOX ;
+ HelpID = HID_NAVI_TBX7 ;
+ Text [ en-US ] = "List Box On/Off" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_SHOW_ROOT ;
+ HelpID = HID_NAVI_TBX8 ;
+ Text [ en-US ] = "Content View" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_SELECT_SET_AUTO_BOOKMARK ;
+ HelpID = HID_NAVI_TBX9 ;
+ // ItemBitmap = Bitmap { File = "navstmp.bmp"; };
+ Text [ en-US ] = "Set Reminder" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_SELECT_HEADER ;
+ // ItemBitmap = Bitmap { File = "navhead.bmp"; };
+ HelpID = HID_NAVI_TBX10 ;
+ Text [ en-US ] = "Header" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_SELECT_FOOTER ;
+ // ItemBitmap = Bitmap { File = "navfoot.bmp"; };
+ HelpID = HID_NAVI_TBX11 ;
+ /* ### ACHTUNG: Neuer Text in Resource? Fußzeile : Fu˜zeile */
+ Text [ en-US ] = "Footer" ;
+ /* ### ACHTUNG: Neuer Text in Resource? Springen zur Fußzeile : Springen zur Fu˜zeile */
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_SELECT_FOOTNOTE ;
+ // ItemBitmap = Bitmap { File = "navnote.bmp"; };
+ HelpID = HID_NAVI_TBX12 ;
+ Text [ en-US ] = "Anchor<->Text" ;
+ /* ### ACHTUNG: Neuer Text in Resource? Springen zwischen Fußnotenankern und dem Fußnotentext : Springen zwischen Fu˜notenankern und dem Fu˜notentext */
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_OUTLINE_LEVEL ;
+ HelpID = HID_NAVI_TBX13 ;
+ /* ### ACHTUNG: Neuer Text in Resource? Angezeigte Überschriftenebenen : Angezeigte šberschriftenebenen */
+ Text [ en-US ] = "Heading Levels Shown" ;
+ DropDown = TRUE ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_ITEM_LEFT ;
+ HelpID = HID_NAVI_TBX14 ;
+ // ItemBitmap = Bitmap { File = "navchlf.bmp"; };
+ Text [ en-US ] = "Promote Level" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_ITEM_RIGHT ;
+ // ItemBitmap = Bitmap { File = "navchrg.bmp"; };
+ HelpID = HID_NAVI_TBX15 ;
+ Text [ en-US ] = "Demote Level" ;
+ };
+ };
+ };
+ ToolBox TB_GLOBAL
+ {
+ Pos = MAP_PIXEL ( 5 , 5 ) ;
+ Size = MAP_PIXEL ( 300 , 47 ) ;
+ LineCount = 1 ;
+ Hide = TRUE ;
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = FN_GLOBAL_SWITCH ;
+ HelpID = HID_NAVI_TBX17 ;
+ Text [ en-US ] = "Toggle" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_GLOBAL_EDIT ;
+ HelpID = HID_NAVI_TBX18 ;
+ Text [ en-US ] = "Edit" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_GLOBAL_UPDATE ;
+ HelpID = HID_NAVI_TBX19 ;
+ Text [ en-US ] = "Update" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_GLOBAL_OPEN ;
+ HelpID = HID_NAVI_TBX20 ;
+ /* ### ACHTUNG: Neuer Text in Resource? Einfügen : Einf³gen */
+ Text [ en-US ] = "Insert" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_GLOBAL_SAVE_CONTENT ;
+ HelpID = HID_NAVI_TBX21 ;
+ Text [ en-US ] = "Save Contents as well" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_ITEM_UP ;
+ HelpID = HID_NAVI_TBX22 ;
+ /* ### ACHTUNG: Neuer Text in Resource? Nach oben verschieben : Nach unten verschieben */
+ Text [ en-US ] = "Move Up" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = FN_ITEM_DOWN ;
+ HelpID = HID_NAVI_TBX23 ;
+ /* ### ACHTUNG: Neuer Text in Resource? Nach unten verschieben : Nach oben verschieben */
+ Text [ en-US ] = "Move Down" ;
+ };
+ };
+ };
+ /* TreeListBox */
+ Control TL_CONTENT
+ {
+ HelpID = HID_NAVI_CONTENT ;
+ Border = TRUE ;
+ Pos = MAP_PIXEL ( 5 , 62 ) ;
+ Size = MAP_PIXEL ( 274 , 112 ) ;
+ TabStop = TRUE ;
+ ClipChildren = TRUE ;
+ Hide = TRUE ;
+ };
+ Control TL_GLOBAL
+ {
+ HelpID = HID_NAVI_GLOBAL ;
+ Border = TRUE ;
+ Pos = MAP_PIXEL ( 5 , 34 ) ;
+ Size = MAP_PIXEL ( 274 , 112 ) ;
+ TabStop = TRUE ;
+ ClipChildren = TRUE ;
+ Hide = TRUE ;
+ };
+ ListBox LB_DOCS
+ {
+ Border = TRUE ;
+ Pos = MAP_PIXEL ( 5 , 115 ) ;
+ Size = MAP_APPFONT ( 150 , 50 ) ;
+ DropDown = TRUE ;
+ };
+ NumericField NF_PAGE
+ {
+ Border = TRUE ;
+ Pos = MAP_PIXEL ( 50 , 29 ) ;
+ Size = MAP_PIXEL ( 34 , 20 ) ;
+ TabStop = TRUE ;
+ Left = TRUE ;
+ Repeat = TRUE ;
+ Spin = TRUE ;
+ Minimum = 1 ;
+ First = 1 ;
+ // Outline als Default
+ Maximum = 5 ;
+ Last = 5 ;
+ Value = 5 ;
+ };
+ String ST_OUTLINE_LEVEL
+ {
+ Text [ en-US ] = "Outline Level" ;
+ };
+ String ST_DRAGMODE
+ {
+ Text [ en-US ] = "Drag Mode" ;
+ };
+ String ST_HYPERLINK
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Als Hyperlink einfügen : Als Hyperlink einf³gen */
+ Text [ en-US ] = "Insert as Hyperlink" ;
+ };
+ String ST_LINK_REGION
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Als Verknüpfung einfügen : Als Verkn³pfung einf³gen */
+ Text [ en-US ] = "Insert as Link" ;
+ };
+ String ST_COPY_REGION
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Als Kopie einfügen : Als Kopie einf³gen */
+ Text [ en-US ] = "Insert as Copy" ;
+ };
+ String ST_DISPLAY
+ {
+ Text [ en-US ] = "Display" ;
+ };
+ String ST_ACTIVE_VIEW
+ {
+ Text [ en-US ] = "Active Window" ;
+ };
+ String ST_HIDDEN
+ {
+ Text [ en-US ] = "hidden" ;
+ };
+ String ST_ACTIVE
+ {
+ Text [ en-US ] = "active" ;
+ };
+ String ST_INACTIVE
+ {
+ Text [ en-US ] = "inactive" ;
+ };
+ String ST_EDIT_ENTRY
+ {
+ Text [ en-US ] = "Edit..." ;
+ };
+ String ST_UPDATE
+ {
+ Text [ en-US ] = "~Update" ;
+ };
+ String ST_EDIT_CONTENT
+ {
+ Text [ en-US ] = "Edit" ;
+ };
+ String ST_EDIT_LINK
+ {
+ Text [ en-US ] = "Edit link";
+ };
+ String ST_INSERT
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Einfügen : Einf³gen */
+ Text [ en-US ] = "Insert" ;
+ };
+ String ST_INDEX
+ {
+ Text [ en-US ] = "~Index";
+ };
+ String ST_FILE
+ {
+ Text [ en-US ] = "File" ;
+ };
+ String ST_NEW_FILE
+ {
+ Text [ en-US ] = "New Document" ;
+ };
+ String ST_TEXT
+ {
+ Text [ en-US ] = "Text" ;
+ };
+ String ST_DELETE
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Löschen : L÷schen */
+ Text [ en-US ] = "Delete" ;
+ };
+ String ST_DELETE_ENTRY
+ {
+ Text [ en-US ] = "~Delete" ;
+ };
+ String ST_UPDATE_SEL
+ {
+ Text [ en-US ] = "Selection" ;
+ };
+ String ST_UPDATE_INDEX
+ {
+ Text [ en-US ] = "Indexes" ;
+ };
+ String ST_UPDATE_LINK
+ {
+ /* ### ACHTUNG: Neuer Text in Resource? Verknüpfungen : Verkn³pfungen */
+ Text [ en-US ] = "Links" ;
+ };
+ String ST_UPDATE_ALL
+ {
+ Text [ en-US ] = "All" ;
+ };
+ String ST_REMOVE_INDEX
+ {
+ Text [ en-US ] = "~Remove Index" ;
+ };
+ String ST_REMOVE_TBL_PROTECTION
+ {
+ Text [ en-US ] = "~Unprotect" ;
+ };
+ String ST_INVISIBLE
+ {
+ Text [ en-US ] = "hidden";
+ };
+ String ST_BROKEN_LINK
+ {
+ Text [ en-US ] = "File not found: ";
+ };
+ String ST_RENAME
+ {
+ Text [ en-US ] = "~Rename";
+ };
+ String ST_READONLY_IDX
+ {
+ Text [ en-US ] = "Read-~only";
+ };
+ String ST_POSTIT_SHOW
+ {
+ Text [ en-US ] = "Show All";
+ };
+ String ST_POSTIT_HIDE
+ {
+ Text [ en-US ] = "Hide All";
+ };
+ String ST_POSTIT_DELETE
+ {
+ Text [ en-US ] = "Delete All";
+ };
+};
+#define NAVI_ENTRY_IDS \
+ IdList = \
+ { \
+ 20000 ; \
+ 20001 ; \
+ 20002 ; \
+ 20003 ; \
+ 20004 ; \
+ 20005 ; \
+ 20006 ; \
+ 20007 ; \
+ 20008 ; \
+ 20009 ; \
+ 20010 ; \
+ 20011 ; \
+ }; \
+ IdCount = { 12 ; };
+
+
+
+ImageList IMG_NAVI_ENTRYBMP
+{
+ Prefix = "nc";
+ MaskColor = IMAGE_MASK_COLOR ;
+ NAVI_ENTRY_IDS
+};
+
+ImageList IMG_NAVI_ENTRYBMPH
+{
+ Prefix = "nch";
+ MaskColor = IMAGE_MASK_COLOR ;
+ NAVI_ENTRY_IDS
+};
diff --git a/sw/source/ui/utlui/numfmtlb.cxx b/sw/source/ui/utlui/numfmtlb.cxx
new file mode 100644
index 000000000000..b059c12a4a50
--- /dev/null
+++ b/sw/source/ui/utlui/numfmtlb.cxx
@@ -0,0 +1,549 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <editeng/unolingu.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <i18npool/lang.h>
+#ifndef _ZFORMAT_HXX //autogen
+#define _ZFORLIST_DECLARE_TABLE
+#include <svl/zformat.hxx>
+#endif
+#include <svl/eitem.hxx>
+#include <svx/svxids.hrc>
+#include <svx/numinf.hxx>
+#include <vcl/msgbox.hxx>
+#include <svx/flagsdef.hxx>
+#include <svl/itemset.hxx>
+#include <docsh.hxx>
+#include <swtypes.hxx>
+#include <swmodule.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <numfmtlb.hxx>
+#include <utlui.hrc>
+#include "swabstdlg.hxx"
+#include "dialog.hrc"
+#include <unomid.h>
+#include <sfx2/viewfrm.hxx>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+
+
+// STATIC DATA -----------------------------------------------------------
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ nFormatType: Formate dieses Typs anzeigen
+ nDefFmt: Dieses Format selektieren und ggf vorher
+ einfuegen
+ --------------------------------------------------------------------*/
+
+NumFormatListBox::NumFormatListBox( Window* pWin, const ResId& rResId,
+ short nFormatType, ULONG nDefFmt,
+ BOOL bUsrFmts ) :
+ ListBox ( pWin, rResId ),
+ nCurrFormatType (-1),
+ nStdEntry (0),
+ bOneArea (FALSE),
+ nDefFormat (nDefFmt),
+ pVw (0),
+ pOwnFormatter (0),
+ bShowLanguageControl(FALSE),
+ bUseAutomaticLanguage(TRUE)
+{
+ Init(nFormatType, bUsrFmts);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+NumFormatListBox::NumFormatListBox( Window* pWin, SwView* pView,
+ const ResId& rResId, short nFormatType,
+ ULONG nDefFmt, BOOL bUsrFmts ) :
+ ListBox ( pWin, rResId ),
+ nCurrFormatType (-1),
+ nStdEntry (0),
+ bOneArea (FALSE),
+ nDefFormat (nDefFmt),
+ pVw (pView),
+ pOwnFormatter (0),
+ bShowLanguageControl(FALSE),
+ bUseAutomaticLanguage(TRUE)
+{
+ Init(nFormatType, bUsrFmts);
+}
+
+/* -----------------15.06.98 11:29-------------------
+ *
+ * --------------------------------------------------*/
+
+void NumFormatListBox::Init(short nFormatType, BOOL bUsrFmts)
+{
+ SwView *pView = GetView();
+
+ if (pView)
+ eCurLanguage = pView->GetWrtShell().GetCurLang();
+ else
+ eCurLanguage = SvxLocaleToLanguage( SvtSysLocale().GetLocaleData().getLocale() );
+
+ if (bUsrFmts == FALSE)
+ {
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ pOwnFormatter = new SvNumberFormatter(xMSF, eCurLanguage);
+ }
+
+ SetFormatType(nFormatType);
+ SetDefFormat(nDefFormat);
+
+ SetSelectHdl(LINK(this, NumFormatListBox, SelectHdl));
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+NumFormatListBox::~NumFormatListBox()
+{
+ if (pOwnFormatter)
+ delete pOwnFormatter;
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwView* NumFormatListBox::GetView()
+{
+ if( pVw )
+ return pVw;
+ return ::GetActiveView();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void NumFormatListBox::SetFormatType(const short nFormatType)
+{
+ if (nCurrFormatType == -1 ||
+ (nCurrFormatType & nFormatType) == 0) // Es gibt Mischformate, wie z.B. DateTime
+ {
+ SvNumberFormatter* pFormatter;
+
+ if( pOwnFormatter )
+ pFormatter = pOwnFormatter;
+ else
+ {
+ SwView *pView = GetView();
+ DBG_ASSERT(pView, "no view found");
+ if(!pView)
+ return;
+ SwWrtShell &rSh = pView->GetWrtShell();
+ pFormatter = rSh.GetNumberFormatter();
+ }
+
+ Clear(); // Alle Eintraege in der Listbox entfernen
+
+ NfIndexTableOffset eOffsetStart = NF_NUMBER_START;
+ NfIndexTableOffset eOffsetEnd = NF_NUMBER_START;
+
+ switch( nFormatType )
+ {
+ case NUMBERFORMAT_NUMBER:
+ eOffsetStart=NF_NUMBER_START;
+ eOffsetEnd=NF_NUMBER_END;
+ break;
+
+ case NUMBERFORMAT_PERCENT:
+ eOffsetStart=NF_PERCENT_START;
+ eOffsetEnd=NF_PERCENT_END;
+ break;
+
+ case NUMBERFORMAT_CURRENCY:
+ eOffsetStart=NF_CURRENCY_START;
+ eOffsetEnd=NF_CURRENCY_END;
+ break;
+
+ case NUMBERFORMAT_DATETIME:
+ eOffsetStart=NF_DATE_START;
+ eOffsetEnd=NF_TIME_END;
+ break;
+
+ case NUMBERFORMAT_DATE:
+ eOffsetStart=NF_DATE_START;
+ eOffsetEnd=NF_DATE_END;
+ break;
+
+ case NUMBERFORMAT_TIME:
+ eOffsetStart=NF_TIME_START;
+ eOffsetEnd=NF_TIME_END;
+ break;
+
+ case NUMBERFORMAT_SCIENTIFIC:
+ eOffsetStart=NF_SCIENTIFIC_START;
+ eOffsetEnd=NF_SCIENTIFIC_END;
+ break;
+
+ case NUMBERFORMAT_FRACTION:
+ eOffsetStart=NF_FRACTION_START;
+ eOffsetEnd=NF_FRACTION_END;
+ break;
+
+ case NUMBERFORMAT_LOGICAL:
+ eOffsetStart=NF_BOOLEAN;
+ eOffsetEnd=NF_BOOLEAN;
+ break;
+
+ case NUMBERFORMAT_TEXT:
+ eOffsetStart=NF_TEXT;
+ eOffsetEnd=NF_TEXT;
+ break;
+
+ case NUMBERFORMAT_ALL:
+ eOffsetStart=NF_NUMERIC_START;
+ eOffsetEnd = NfIndexTableOffset( NF_INDEX_TABLE_ENTRIES - 1 );
+ break;
+
+ default:
+ DBG_ERROR("what a format?");
+ break;
+ }
+
+ const SvNumberformat* pFmt;
+ USHORT nPos, i = 0;
+ ULONG nFormat;
+ Color* pCol;
+ double fVal = GetDefValue( nFormatType );
+ String sValue;
+
+ ULONG nSysNumFmt = pFormatter->GetFormatIndex(
+ NF_NUMBER_SYSTEM, eCurLanguage );
+ ULONG nSysShortDateFmt = pFormatter->GetFormatIndex(
+ NF_DATE_SYSTEM_SHORT, eCurLanguage );
+ ULONG nSysLongDateFmt = pFormatter->GetFormatIndex(
+ NF_DATE_SYSTEM_LONG, eCurLanguage );
+
+ for( long nIndex = eOffsetStart; nIndex <= eOffsetEnd; ++nIndex )
+ {
+ nFormat = pFormatter->GetFormatIndex(
+ (NfIndexTableOffset)nIndex, eCurLanguage );
+ pFmt = pFormatter->GetEntry( nFormat );
+
+ if( nFormat == pFormatter->GetFormatIndex( NF_NUMBER_STANDARD,
+ eCurLanguage )
+ || ((SvNumberformat*)pFmt)->GetOutputString( fVal, sValue, &pCol )
+ || nFormatType == NUMBERFORMAT_UNDEFINED )
+ sValue = pFmt->GetFormatstring();
+ else if( nFormatType == NUMBERFORMAT_TEXT )
+ {
+ String sTxt(C2S("\"ABC\""));
+ pFormatter->GetOutputString( sTxt, nFormat, sValue, &pCol);
+ }
+
+ if (nFormat != nSysNumFmt &&
+ nFormat != nSysShortDateFmt &&
+ nFormat != nSysLongDateFmt)
+ {
+ nPos = InsertEntry( sValue );
+ SetEntryData( nPos, (void*)nFormat );
+
+ if( nFormat == pFormatter->GetStandardFormat(
+ nFormatType, eCurLanguage ) )
+ nStdEntry = i;
+ ++i;
+ }
+ }
+
+ if (!pOwnFormatter)
+ {
+ nPos = InsertEntry(SW_RESSTR( STR_DEFINE_NUMBERFORMAT ));
+ SetEntryData( nPos, NULL );
+ }
+
+ SelectEntryPos( nStdEntry );
+
+ nCurrFormatType = nFormatType;
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void NumFormatListBox::SetDefFormat(const ULONG nDefFmt)
+{
+ if (nDefFmt == ULONG_MAX)
+ {
+ nDefFormat = nDefFmt;
+ return;
+ }
+
+ SvNumberFormatter* pFormatter;
+ if (pOwnFormatter)
+ pFormatter = pOwnFormatter;
+ else
+ {
+ SwView *pView = GetView();
+ DBG_ASSERT(pView, "no view found");
+ if(!pView)
+ return;
+ SwWrtShell &rSh = pView->GetWrtShell();
+ pFormatter = rSh.GetNumberFormatter();
+ }
+
+ short nType = pFormatter->GetType(nDefFmt);
+
+ SetFormatType(nType);
+
+ ULONG nFormat = pFormatter->GetFormatForLanguageIfBuiltIn(nDefFmt, eCurLanguage);
+
+ for (USHORT i = 0; i < GetEntryCount(); i++)
+ {
+ if (nFormat == (ULONG)GetEntryData(i))
+ {
+ SelectEntryPos(i);
+ nStdEntry = i;
+ nDefFormat = GetFormat();
+ return;
+ }
+ }
+
+ // Kein Eintrag gefunden:
+ double fValue = GetDefValue(nType);
+ String sValue;
+ Color* pCol = 0;
+
+ if (nType == NUMBERFORMAT_TEXT)
+ {
+ String sTxt(C2S("\"ABC\""));
+ pFormatter->GetOutputString(sTxt, nDefFmt, sValue, &pCol);
+ }
+ else
+ pFormatter->GetOutputString(fValue, nDefFmt, sValue, &pCol);
+
+ USHORT nPos = 0;
+ while ((ULONG)GetEntryData(nPos) == ULONG_MAX)
+ nPos++;
+
+//
+ ULONG nSysNumFmt = pFormatter->GetFormatIndex( NF_NUMBER_SYSTEM, eCurLanguage);
+ ULONG nSysShortDateFmt = pFormatter->GetFormatIndex( NF_DATE_SYSTEM_SHORT, eCurLanguage);
+ ULONG nSysLongDateFmt = pFormatter->GetFormatIndex( NF_DATE_SYSTEM_LONG, eCurLanguage);
+ BOOL bSysLang = FALSE;
+ if( eCurLanguage == GetAppLanguage() )
+ bSysLang = TRUE;
+ ULONG nNumFormatForLanguage = pFormatter->GetFormatForLanguageIfBuiltIn(nSysNumFmt, LANGUAGE_SYSTEM );
+ ULONG nShortDateFormatForLanguage = pFormatter->GetFormatForLanguageIfBuiltIn(nSysShortDateFmt, LANGUAGE_SYSTEM );
+ ULONG nLongDateFormatForLanguage = pFormatter->GetFormatForLanguageIfBuiltIn(nSysLongDateFmt, LANGUAGE_SYSTEM );
+
+ if (
+ nDefFmt == nSysNumFmt ||
+ nDefFmt == nSysShortDateFmt ||
+ nDefFmt == nSysLongDateFmt ||
+ (
+ bSysLang &&
+ (
+ nDefFmt == nNumFormatForLanguage ||
+ nDefFmt == nShortDateFormatForLanguage ||
+ nDefFmt == nLongDateFormatForLanguage
+ )
+ )
+ )
+ {
+ sValue += String(SW_RES(RID_STR_SYSTEM));
+ }
+
+ nPos = InsertEntry(sValue, nPos); // Als ersten numerischen Eintrag einfuegen
+ SetEntryData(nPos, (void*)nDefFmt);
+ SelectEntryPos(nPos);
+ nDefFormat = GetFormat();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+ULONG NumFormatListBox::GetFormat() const
+{
+ USHORT nPos = GetSelectEntryPos();
+
+ return (ULONG)GetEntryData(nPos);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+IMPL_LINK( NumFormatListBox, SelectHdl, ListBox *, pBox )
+{
+ USHORT nPos = pBox->GetSelectEntryPos();
+ String sDefine(SW_RES( STR_DEFINE_NUMBERFORMAT ));
+ SwView *pView = GetView();
+
+ if( pView && nPos == pBox->GetEntryCount() - 1 &&
+ pBox->GetEntry( nPos ) == sDefine )
+ {
+ SwWrtShell &rSh = pView->GetWrtShell();
+ SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
+
+ SfxItemSet aCoreSet( rSh.GetAttrPool(),
+ SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_VALUE,
+ SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO,
+ SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA,
+ SID_ATTR_NUMBERFORMAT_NOLANGUAGE, SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
+ SID_ATTR_NUMBERFORMAT_ADD_AUTO, SID_ATTR_NUMBERFORMAT_ADD_AUTO,
+ 0 );
+
+ double fValue = GetDefValue( nCurrFormatType);
+
+ ULONG nFormat = pFormatter->GetStandardFormat( nCurrFormatType, eCurLanguage);
+ aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, nFormat ));
+
+ aCoreSet.Put( SvxNumberInfoItem( pFormatter, fValue,
+ SID_ATTR_NUMBERFORMAT_INFO ) );
+
+ if( (NUMBERFORMAT_DATE | NUMBERFORMAT_TIME) & nCurrFormatType )
+ aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, bOneArea));
+
+ aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_NOLANGUAGE, !bShowLanguageControl));
+ aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ADD_AUTO, bUseAutomaticLanguage));
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( this, aCoreSet,
+ GetView()->GetViewFrame()->GetFrame().GetFrameInterface(),
+ RC_DLG_SWNUMFMTDLG );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+
+ if (RET_OK == pDlg->Execute())
+ {
+ const SfxPoolItem* pItem = pView->GetDocShell()->
+ GetItem( SID_ATTR_NUMBERFORMAT_INFO );
+
+ if( pItem && 0 != ((SvxNumberInfoItem*)pItem)->GetDelCount() )
+ {
+ const sal_uInt32* pDelArr = ((SvxNumberInfoItem*)pItem)->GetDelArray();
+
+ for ( USHORT i = 0; i < ((SvxNumberInfoItem*)pItem)->GetDelCount(); i++ )
+ pFormatter->DeleteEntry( pDelArr[i] );
+ }
+
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ if( SFX_ITEM_SET == pOutSet->GetItemState(
+ SID_ATTR_NUMBERFORMAT_VALUE, FALSE, &pItem ))
+ {
+ UINT32 nNumberFormat = ((SfxUInt32Item*)pItem)->GetValue();
+ // oj #105473# change order of calls
+ const SvNumberformat* pFmt = pFormatter->GetEntry(nNumberFormat);
+ if( pFmt )
+ eCurLanguage = pFmt->GetLanguage();
+ // SetDefFormat uses eCurLanguage to look for if this format already in the list
+ SetDefFormat(nNumberFormat);
+ }
+ if( bShowLanguageControl && SFX_ITEM_SET == pOutSet->GetItemState(
+ SID_ATTR_NUMBERFORMAT_ADD_AUTO, FALSE, &pItem ))
+ {
+ bUseAutomaticLanguage = ((const SfxBoolItem*)pItem)->GetValue();
+ }
+ }
+ else
+ SetDefFormat(nFormat);
+
+ delete pDlg;
+ }
+ return 0;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+double NumFormatListBox::GetDefValue(const short nFormatType) const
+{
+ double fDefValue = 0.0;
+
+ switch (nFormatType)
+ {
+ case NUMBERFORMAT_DATE:
+ case NUMBERFORMAT_DATE|NUMBERFORMAT_TIME:
+ fDefValue = SVX_NUMVAL_DATE;
+ break;
+
+ case NUMBERFORMAT_TIME:
+ fDefValue = SVX_NUMVAL_TIME;
+ break;
+/* {
+ String sValue("31.8.1997 16:57:34");
+ ULONG nFormat = pFormatter->GetStandardFormat(nFormatType, LANGUAGE_GERMAN);
+ pFormatter->IsNumberFormat( sValue, nFormat, fDefValue );
+ }
+ break;*/
+
+ case NUMBERFORMAT_TEXT:
+ case NUMBERFORMAT_UNDEFINED:
+ fDefValue = 0;
+ break;
+
+ case NUMBERFORMAT_CURRENCY:
+ fDefValue = SVX_NUMVAL_CURRENCY;
+ break;
+
+ case NUMBERFORMAT_PERCENT:
+ fDefValue = SVX_NUMVAL_PERCENT;
+ break;
+
+ case NUMBERFORMAT_LOGICAL:
+ fDefValue = SVX_NUMVAL_BOOLEAN;
+ break;
+
+ default:
+ fDefValue = SVX_NUMVAL_STANDARD;
+ break;
+ }
+
+ return fDefValue;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void NumFormatListBox::Clear()
+{
+ ListBox::Clear();
+ nCurrFormatType = -1;
+}
+
diff --git a/sw/source/ui/utlui/poolfmt.src b/sw/source/ui/utlui/poolfmt.src
new file mode 100644
index 000000000000..de3f74fb857d
--- /dev/null
+++ b/sw/source/ui/utlui/poolfmt.src
@@ -0,0 +1,745 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "poolfmt.hrc"
+
+ // -----------------
+ // Format-Namen
+ // -----------------
+String STR_POOLCHR_FOOTNOTE
+{
+ Text [ en-US ] = "Footnote Characters" ;
+};
+String STR_POOLCHR_PAGENO
+{
+ Text [ en-US ] = "Page Number" ;
+};
+String STR_POOLCHR_LABEL
+{
+ Text [ en-US ] = "Caption Characters" ;
+};
+String STR_POOLCHR_DROPCAPS
+{
+ Text [ en-US ] = "Drop Caps" ;
+};
+String STR_POOLCHR_NUM_LEVEL
+{
+ Text [ en-US ] = "Numbering Symbols" ;
+};
+String STR_POOLCHR_BUL_LEVEL
+{
+ Text [ en-US ] = "Bullets" ;
+};
+String STR_POOLCHR_INET_NORMAL
+{
+ Text [ en-US ] = "Internet Link" ;
+};
+String STR_POOLCHR_INET_VISIT
+{
+ Text [ en-US ] = "Visited Internet Link" ;
+};
+String STR_POOLCHR_JUMPEDIT
+{
+ Text [ en-US ] = "Placeholder" ;
+};
+String STR_POOLCHR_TOXJUMP
+{
+ Text [ en-US ] = "Index Link" ;
+};
+String STR_POOLCHR_ENDNOTE
+{
+ Text [ en-US ] = "Endnote Characters" ;
+};
+String STR_POOLPAGE_LANDSCAPE
+{
+ Text [ en-US ] = "Landscape" ;
+};
+String STR_POOLCHR_LINENUM
+{
+ Text [ en-US ] = "Line numbering" ;
+};
+String STR_POOLCHR_IDX_MAIN_ENTRY
+{
+ Text [ en-US ] = "Main index entry";
+};
+String STR_POOLCHR_FOOTNOTE_ANCHOR
+{
+ Text [ en-US ] = "Footnote anchor";
+};
+String STR_POOLCHR_ENDNOTE_ANCHOR
+{
+ Text [ en-US ] = "Endnote anchor";
+};
+
+ // Zeichenvorlagen fuer HTML
+String STR_POOLCHR_HTML_EMPHASIS
+{
+ Text [ en-US ] = "Emphasis" ;
+};
+String STR_POOLCHR_HTML_CITIATION
+{
+ Text [ en-US ] = "Quotation" ;
+};
+String STR_POOLCHR_HTML_STRONG
+{
+ Text [ en-US ] = "Strong Emphasis" ;
+};
+String STR_POOLCHR_HTML_CODE
+{
+ Text [ en-US ] = "Source Text" ;
+};
+String STR_POOLCHR_HTML_SAMPLE
+{
+ Text [ en-US ] = "Example" ;
+};
+String STR_POOLCHR_HTML_KEYBOARD
+{
+ Text [ en-US ] = "User Entry" ;
+};
+String STR_POOLCHR_HTML_VARIABLE
+{
+ Text [ en-US ] = "Variable" ;
+};
+String STR_POOLCHR_HTML_DEFINSTANCE
+{
+ Text [ en-US ] = "Definition" ;
+};
+String STR_POOLCHR_HTML_TELETYPE
+{
+ Text [ en-US ] = "Teletype" ;
+};
+
+// Rahmenvorlagen
+String STR_POOLFRM_FRAME
+{
+ Text [ en-US ] = "Frame" ;
+};
+String STR_POOLFRM_GRAPHIC
+{
+ Text [ en-US ] = "Graphics" ;
+};
+String STR_POOLFRM_OLE
+{
+ Text [ en-US ] = "OLE" ;
+};
+String STR_POOLFRM_FORMEL
+{
+ Text [ en-US ] = "Formula" ;
+};
+String STR_POOLFRM_MARGINAL
+{
+ Text [ en-US ] = "Marginalia" ;
+};
+String STR_POOLFRM_WATERSIGN
+{
+ Text [ en-US ] = "Watermark" ;
+};
+String STR_POOLFRM_LABEL
+{
+ Text [ en-US ] = "Labels" ;
+};
+ // -----------------
+ // Vorlagen-Namen
+ // -----------------
+String STR_POOLCOLL_STANDARD
+{
+ Text [ en-US ] = "Default" ;
+};
+String STR_POOLCOLL_TEXT
+{
+ Text [ en-US ] = "Text body" ;
+};
+String STR_POOLCOLL_TEXT_IDENT
+{
+ Text [ en-US ] = "First line indent" ;
+};
+String STR_POOLCOLL_TEXT_NEGIDENT
+{
+ Text [ en-US ] = "Hanging indent" ;
+};
+String STR_POOLCOLL_TEXT_MOVE
+{
+ Text [ en-US ] = "Text body indent" ;
+};
+String STR_POOLCOLL_GREETING
+{
+ Text [ en-US ] = "Complimentary close" ;
+};
+String STR_POOLCOLL_SIGNATURE
+{
+ Text [ en-US ] = "Signature" ;
+};
+String STR_POOLCOLL_HEADLINE_BASE
+{
+ Text [ en-US ] = "Heading" ;
+};
+String STR_POOLCOLL_NUMBUL_BASE
+{
+ Text [ en-US ] = "List" ;
+};
+String STR_POOLCOLL_REGISTER_BASE
+{
+ Text [ en-US ] = "Index" ;
+};
+String STR_POOLCOLL_CONFRONTATION
+{
+ Text [ en-US ] = "List Indent" ;
+};
+String STR_POOLCOLL_MARGINAL
+{
+ Text [ en-US ] = "Marginalia" ;
+};
+String STR_POOLCOLL_HEADLINE1
+{
+ Text [ en-US ] = "Heading 1" ;
+};
+String STR_POOLCOLL_HEADLINE2
+{
+ Text [ en-US ] = "Heading 2" ;
+};
+String STR_POOLCOLL_HEADLINE3
+{
+ Text [ en-US ] = "Heading 3" ;
+};
+String STR_POOLCOLL_HEADLINE4
+{
+ Text [ en-US ] = "Heading 4" ;
+};
+String STR_POOLCOLL_HEADLINE5
+{
+ Text [ en-US ] = "Heading 5" ;
+};
+String STR_POOLCOLL_HEADLINE6
+{
+ Text [ en-US ] = "Heading 6" ;
+};
+String STR_POOLCOLL_HEADLINE7
+{
+ Text [ en-US ] = "Heading 7" ;
+};
+String STR_POOLCOLL_HEADLINE8
+{
+ Text [ en-US ] = "Heading 8" ;
+};
+String STR_POOLCOLL_HEADLINE9
+{
+ Text [ en-US ] = "Heading 9" ;
+};
+String STR_POOLCOLL_HEADLINE10
+{
+ Text [ en-US ] = "Heading 10" ;
+};
+String STR_POOLCOLL_NUM_LEVEL1S
+{
+ Text [ en-US ] = "Numbering 1 Start" ;
+};
+String STR_POOLCOLL_NUM_LEVEL1
+{
+ Text [ en-US ] = "Numbering 1" ;
+};
+String STR_POOLCOLL_NUM_LEVEL1E
+{
+ Text [ en-US ] = "Numbering 1 End" ;
+};
+String STR_POOLCOLL_NUM_NONUM1
+{
+ Text [ en-US ] = "Numbering 1 Cont." ;
+};
+String STR_POOLCOLL_NUM_LEVEL2S
+{
+ Text [ en-US ] = "Numbering 2 Start" ;
+};
+String STR_POOLCOLL_NUM_LEVEL2
+{
+ Text [ en-US ] = "Numbering 2" ;
+};
+String STR_POOLCOLL_NUM_LEVEL2E
+{
+ Text [ en-US ] = "Numbering 2 End" ;
+};
+String STR_POOLCOLL_NUM_NONUM2
+{
+ Text [ en-US ] = "Numbering 2 Cont." ;
+};
+String STR_POOLCOLL_NUM_LEVEL3S
+{
+ Text [ en-US ] = "Numbering 3 Start" ;
+};
+String STR_POOLCOLL_NUM_LEVEL3
+{
+ Text [ en-US ] = "Numbering 3" ;
+};
+String STR_POOLCOLL_NUM_LEVEL3E
+{
+ Text [ en-US ] = "Numbering 3 End" ;
+};
+String STR_POOLCOLL_NUM_NONUM3
+{
+ Text [ en-US ] = "Numbering 3 Cont." ;
+};
+String STR_POOLCOLL_NUM_LEVEL4S
+{
+ Text [ en-US ] = "Numbering 4 Start" ;
+};
+String STR_POOLCOLL_NUM_LEVEL4
+{
+ Text [ en-US ] = "Numbering 4" ;
+};
+String STR_POOLCOLL_NUM_LEVEL4E
+{
+ Text [ en-US ] = "Numbering 4 End" ;
+};
+String STR_POOLCOLL_NUM_NONUM4
+{
+ Text [ en-US ] = "Numbering 4 Cont." ;
+};
+String STR_POOLCOLL_NUM_LEVEL5S
+{
+ Text [ en-US ] = "Numbering 5 Start" ;
+};
+String STR_POOLCOLL_NUM_LEVEL5
+{
+ Text [ en-US ] = "Numbering 5" ;
+};
+String STR_POOLCOLL_NUM_LEVEL5E
+{
+ Text [ en-US ] = "Numbering 5 End" ;
+};
+String STR_POOLCOLL_NUM_NONUM5
+{
+ Text [ en-US ] = "Numbering 5 Cont." ;
+};
+String STR_POOLCOLL_BUL_LEVEL1S
+{
+ Text [ en-US ] = "List 1 Start" ;
+};
+String STR_POOLCOLL_BUL_LEVEL1
+{
+ Text [ en-US ] = "List 1" ;
+};
+String STR_POOLCOLL_BUL_LEVEL1E
+{
+ Text [ en-US ] = "List 1 End" ;
+};
+String STR_POOLCOLL_BUL_NONUM1
+{
+ Text [ en-US ] = "List 1 Cont." ;
+};
+String STR_POOLCOLL_BUL_LEVEL2S
+{
+ Text [ en-US ] = "List 2 Start" ;
+};
+String STR_POOLCOLL_BUL_LEVEL2
+{
+ Text [ en-US ] = "List 2" ;
+};
+String STR_POOLCOLL_BUL_LEVEL2E
+{
+ Text [ en-US ] = "List 2 End" ;
+};
+String STR_POOLCOLL_BUL_NONUM2
+{
+ Text [ en-US ] = "List 2 Cont." ;
+};
+String STR_POOLCOLL_BUL_LEVEL3S
+{
+ Text [ en-US ] = "List 3 Start" ;
+};
+String STR_POOLCOLL_BUL_LEVEL3
+{
+ Text [ en-US ] = "List 3" ;
+};
+String STR_POOLCOLL_BUL_LEVEL3E
+{
+ Text [ en-US ] = "List 3 End" ;
+};
+String STR_POOLCOLL_BUL_NONUM3
+{
+ Text [ en-US ] = "List 3 Cont." ;
+};
+String STR_POOLCOLL_BUL_LEVEL4S
+{
+ Text [ en-US ] = "List 4 Start" ;
+};
+String STR_POOLCOLL_BUL_LEVEL4
+{
+ Text [ en-US ] = "List 4" ;
+};
+String STR_POOLCOLL_BUL_LEVEL4E
+{
+ Text [ en-US ] = "List 4 End" ;
+};
+String STR_POOLCOLL_BUL_NONUM4
+{
+ Text [ en-US ] = "List 4 Cont." ;
+};
+String STR_POOLCOLL_BUL_LEVEL5S
+{
+ Text [ en-US ] = "List 5 Start" ;
+};
+String STR_POOLCOLL_BUL_LEVEL5
+{
+ Text [ en-US ] = "List 5" ;
+};
+String STR_POOLCOLL_BUL_LEVEL5E
+{
+ Text [ en-US ] = "List 5 End" ;
+};
+String STR_POOLCOLL_BUL_NONUM5
+{
+ Text [ en-US ] = "List 5 Cont." ;
+};
+String STR_POOLCOLL_HEADER
+{
+ Text [ en-US ] = "Header" ;
+};
+String STR_POOLCOLL_HEADERL
+{
+ Text [ en-US ] = "Header left" ;
+};
+String STR_POOLCOLL_HEADERR
+{
+ Text [ en-US ] = "Header right" ;
+};
+String STR_POOLCOLL_FOOTER
+{
+ Text [ en-US ] = "Footer" ;
+};
+String STR_POOLCOLL_FOOTERL
+{
+ Text [ en-US ] = "Footer left" ;
+};
+String STR_POOLCOLL_FOOTERR
+{
+ Text [ en-US ] = "Footer right" ;
+};
+String STR_POOLCOLL_TABLE
+{
+ Text [ en-US ] = "Table Contents" ;
+};
+String STR_POOLCOLL_TABLE_HDLN
+{
+ Text [ en-US ] = "Table Heading" ;
+};
+String STR_POOLCOLL_FRAME
+{
+ Text [ en-US ] = "Frame contents" ;
+};
+String STR_POOLCOLL_FOOTNOTE
+{
+ Text [ en-US ] = "Footnote" ;
+};
+String STR_POOLCOLL_ENDNOTE
+{
+ Text [ en-US ] = "Endnote" ;
+};
+String STR_POOLCOLL_LABEL
+{
+ Text [ en-US ] = "Caption" ;
+};
+String STR_POOLCOLL_LABEL_ABB
+{
+ Text [ en-US ] = "Illustration" ;
+};
+String STR_POOLCOLL_LABEL_TABLE
+{
+ Text [ en-US ] = "Table" ;
+};
+String STR_POOLCOLL_LABEL_FRAME
+{
+ Text [ en-US ] = "Text" ;
+};
+String STR_POOLCOLL_LABEL_DRAWING
+{
+ Text [ en-US ] = "Drawing";
+};
+String STR_POOLCOLL_JAKETADRESS
+{
+ Text [ en-US ] = "Addressee" ;
+};
+String STR_POOLCOLL_SENDADRESS
+{
+ Text [ en-US ] = "Sender" ;
+};
+String STR_POOLCOLL_TOX_IDXH
+{
+ Text [ en-US ] = "Index Heading" ;
+};
+String STR_POOLCOLL_TOX_IDX1
+{
+ Text [ en-US ] = "Index 1" ;
+};
+String STR_POOLCOLL_TOX_IDX2
+{
+ Text [ en-US ] = "Index 2" ;
+};
+String STR_POOLCOLL_TOX_IDX3
+{
+ Text [ en-US ] = "Index 3" ;
+};
+String STR_POOLCOLL_TOX_IDXBREAK
+{
+ Text [ en-US ] = "Index Separator" ;
+};
+String STR_POOLCOLL_TOX_CNTNTH
+{
+ Text [ en-US ] = "Contents Heading" ;
+};
+String STR_POOLCOLL_TOX_CNTNT1
+{
+ Text [ en-US ] = "Contents 1" ;
+};
+String STR_POOLCOLL_TOX_CNTNT2
+{
+ Text [ en-US ] = "Contents 2" ;
+};
+String STR_POOLCOLL_TOX_CNTNT3
+{
+ Text [ en-US ] = "Contents 3" ;
+};
+String STR_POOLCOLL_TOX_CNTNT4
+{
+ Text [ en-US ] = "Contents 4" ;
+};
+String STR_POOLCOLL_TOX_CNTNT5
+{
+ Text [ en-US ] = "Contents 5" ;
+};
+String STR_POOLCOLL_TOX_CNTNT6
+{
+ Text [ en-US ] = "Contents 6" ;
+};
+String STR_POOLCOLL_TOX_CNTNT7
+{
+ Text [ en-US ] = "Contents 7" ;
+};
+String STR_POOLCOLL_TOX_CNTNT8
+{
+ Text [ en-US ] = "Contents 8" ;
+};
+String STR_POOLCOLL_TOX_CNTNT9
+{
+ Text [ en-US ] = "Contents 9" ;
+};
+String STR_POOLCOLL_TOX_CNTNT10
+{
+ Text [ en-US ] = "Contents 10" ;
+};
+String STR_POOLCOLL_TOX_USERH
+{
+ Text [ en-US ] = "User Index Heading" ;
+};
+String STR_POOLCOLL_TOX_USER1
+{
+ Text [ en-US ] = "User Index 1" ;
+};
+String STR_POOLCOLL_TOX_USER2
+{
+ Text [ en-US ] = "User Index 2" ;
+};
+String STR_POOLCOLL_TOX_USER3
+{
+ Text [ en-US ] = "User Index 3" ;
+};
+String STR_POOLCOLL_TOX_USER4
+{
+ Text [ en-US ] = "User Index 4" ;
+};
+String STR_POOLCOLL_TOX_USER5
+{
+ Text [ en-US ] = "User Index 5" ;
+};
+String STR_POOLCOLL_TOX_USER6
+{
+ Text [ en-US ] = "User Index 6" ;
+};
+String STR_POOLCOLL_TOX_USER7
+{
+ Text [ en-US ] = "User Index 7" ;
+};
+String STR_POOLCOLL_TOX_USER8
+{
+ Text [ en-US ] = "User Index 8" ;
+};
+String STR_POOLCOLL_TOX_USER9
+{
+ Text [ en-US ] = "User Index 9" ;
+};
+String STR_POOLCOLL_TOX_USER10
+{
+ Text [ en-US ] = "User Index 10" ;
+};
+String STR_POOLCOLL_TOX_ILLUSH
+{
+ Text [ en-US ] = "Illustration Index Heading";
+};
+String STR_POOLCOLL_TOX_ILLUS1
+{
+ Text [ en-US ] = "Illustration Index 1";
+};
+String STR_POOLCOLL_TOX_OBJECTH
+{
+ Text [ en-US ] = "Object index heading";
+};
+String STR_POOLCOLL_TOX_OBJECT1
+{
+ Text [ en-US ] = "Object index 1";
+};
+String STR_POOLCOLL_TOX_TABLESH
+{
+ Text [ en-US ] = "Table index heading";
+};
+String STR_POOLCOLL_TOX_TABLES1
+{
+ Text [ en-US ] = "Table index 1";
+};
+String STR_POOLCOLL_TOX_AUTHORITIESH
+{
+ Text [ en-US ] = "Bibliography Heading";
+};
+String STR_POOLCOLL_TOX_AUTHORITIES1
+{
+ Text [ en-US ] = "Bibliography 1";
+};
+
+String STR_POOLCOLL_DOC_TITEL
+{
+ Text [ en-US ] = "Title" ;
+};
+String STR_POOLCOLL_DOC_SUBTITEL
+{
+ Text [ en-US ] = "Subtitle" ;
+};
+String STR_POOLCOLL_HTML_BLOCKQUOTE
+{
+ Text [ en-US ] = "Quotations" ;
+};
+String STR_POOLCOLL_HTML_PRE
+{
+ Text [ en-US ] = "Preformatted Text" ;
+};
+String STR_POOLCOLL_HTML_HR
+{
+ Text [ en-US ] = "Horizontal Line" ;
+};
+String STR_POOLCOLL_HTML_DD
+{
+ Text [ en-US ] = "List Contents" ;
+};
+String STR_POOLCOLL_HTML_DT
+{
+ Text [ en-US ] = "List Heading" ;
+};
+//page style names
+String STR_POOLPAGE_STANDARD
+{
+ Text [ en-US ] = "Default" ;
+};
+String STR_POOLPAGE_FIRST
+{
+ Text [ en-US ] = "First Page" ;
+};
+String STR_POOLPAGE_LEFT
+{
+ Text [ en-US ] = "Left Page" ;
+};
+String STR_POOLPAGE_RIGHT
+{
+ Text [ en-US ] = "Right Page" ;
+};
+String STR_POOLPAGE_JAKET
+{
+ Text [ en-US ] = "Envelope" ;
+};
+String STR_POOLPAGE_REGISTER
+{
+ Text [ en-US ] = "Index" ;
+};
+String STR_POOLPAGE_HTML
+{
+ Text [ en-US ] = "HTML" ;
+};
+String STR_POOLPAGE_FOOTNOTE
+{
+ Text [ en-US ] = "Footnote" ;
+};
+String STR_POOLPAGE_ENDNOTE
+{
+ Text [ en-US ] = "Endnote" ;
+};
+/*
+ Numerierungs Regeln
+*/
+String STR_POOLNUMRULE_NUM1
+{
+ Text [ en-US ] = "Numbering 1" ;
+};
+String STR_POOLNUMRULE_NUM2
+{
+ Text [ en-US ] = "Numbering 2" ;
+};
+String STR_POOLNUMRULE_NUM3
+{
+ Text [ en-US ] = "Numbering 3" ;
+};
+String STR_POOLNUMRULE_NUM4
+{
+ Text [ en-US ] = "Numbering 4" ;
+};
+String STR_POOLNUMRULE_NUM5
+{
+ Text [ en-US ] = "Numbering 5" ;
+};
+String STR_POOLNUMRULE_BUL1
+{
+ Text [ en-US ] = "List 1" ;
+};
+String STR_POOLNUMRULE_BUL2
+{
+ Text [ en-US ] = "List 2" ;
+};
+String STR_POOLNUMRULE_BUL3
+{
+ Text [ en-US ] = "List 3" ;
+};
+String STR_POOLNUMRULE_BUL4
+{
+ Text [ en-US ] = "List 4" ;
+};
+String STR_POOLNUMRULE_BUL5
+{
+ Text [ en-US ] = "List 5" ;
+};
+
+String STR_POOLCHR_RUBYTEXT
+{
+ Text [ en-US ] = "Rubies";
+};
+
+String STR_POOLCHR_VERT_NUM
+{
+ Text [ en-US ] = "Vertical Numbering Symbols";
+};
diff --git a/sw/source/ui/utlui/prcntfld.cxx b/sw/source/ui/utlui/prcntfld.cxx
new file mode 100644
index 000000000000..9ab9d9f47b34
--- /dev/null
+++ b/sw/source/ui/utlui/prcntfld.cxx
@@ -0,0 +1,370 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+// include ---------------------------------------------------------------
+
+
+#include "prcntfld.hxx"
+
+// STATIC DATA -----------------------------------------------------------
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+PercentField::PercentField( Window* pWin, const ResId& rResId ) :
+ MetricField ( pWin, rResId ),
+
+ nOldMax (0),
+ nOldMin (0),
+ nLastPercent(-1),
+ nLastValue (-1),
+ eOldUnit (FUNIT_NONE),
+ bLockAutoCalculation(sal_False)
+{
+
+ nOldSpinSize = GetSpinSize();
+ nRefValue = DenormalizePercent(MetricField::GetMax(FUNIT_TWIP));
+ nOldDigits = GetDecimalDigits();
+ SetCustomUnitText('%');
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void PercentField::SetRefValue(sal_Int64 nValue)
+{
+ sal_Int64 nRealValue = GetRealValue(eOldUnit);
+
+ nRefValue = nValue;
+
+ if (!bLockAutoCalculation && (GetUnit() == FUNIT_CUSTOM))
+ SetPrcntValue(nRealValue, eOldUnit);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void PercentField::ShowPercent(BOOL bPercent)
+{
+ if ((bPercent && GetUnit() == FUNIT_CUSTOM) ||
+ (!bPercent && GetUnit() != FUNIT_CUSTOM))
+ return;
+
+ sal_Int64 nOldValue;
+
+ if (bPercent)
+ {
+ sal_Int64 nAktWidth, nPercent;
+
+ nOldValue = GetValue();
+
+ eOldUnit = GetUnit();
+ nOldDigits = GetDecimalDigits();
+ nOldMin = GetMin();
+ nOldMax = GetMax();
+ nOldSpinSize = GetSpinSize();
+ nOldBaseValue = GetBaseValue();
+ SetUnit(FUNIT_CUSTOM);
+ SetDecimalDigits( 0 );
+
+ nAktWidth = ConvertValue(nOldMin, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
+ // Um 0.5 Prozent aufrunden
+ nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
+
+ MetricField::SetMin(Max(static_cast< sal_Int64 >(1), nPercent));
+ MetricField::SetMax(100);
+ SetSpinSize(5);
+ MetricField::SetBaseValue(0);
+ if (nOldValue != nLastValue)
+ {
+ nAktWidth = ConvertValue(nOldValue, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
+ nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
+ MetricFormatter::SetValue(nPercent);
+ nLastPercent = nPercent;
+ nLastValue = nOldValue;
+ }
+ else
+ MetricFormatter::SetValue(nLastPercent);
+// SetValue(100, FUNIT_CUSTOM);
+ }
+ else
+ {
+ sal_Int64 nOldPercent = GetValue(FUNIT_CUSTOM);
+
+ nOldValue = Convert(GetValue(), GetUnit(), eOldUnit);
+
+ SetUnit(eOldUnit);
+ SetDecimalDigits(nOldDigits);
+ MetricField::SetMin(nOldMin);
+ MetricField::SetMax(nOldMax);
+ SetSpinSize(nOldSpinSize);
+ MetricField::SetBaseValue(nOldBaseValue);
+
+ if (nOldPercent != nLastPercent)
+ {
+ SetPrcntValue(nOldValue, eOldUnit);
+ nLastPercent = nOldPercent;
+ nLastValue = nOldValue;
+ }
+ else
+ SetPrcntValue(nLastValue, eOldUnit);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+void PercentField::SetValue(sal_Int64 nNewValue, FieldUnit eInUnit)
+{
+ MetricFormatter::SetValue(nNewValue, eInUnit);
+}
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+void PercentField::SetPrcntValue(sal_Int64 nNewValue, FieldUnit eInUnit)
+{
+ if (GetUnit() != FUNIT_CUSTOM || eInUnit == FUNIT_CUSTOM)
+ MetricFormatter::SetValue(Convert(nNewValue, eInUnit, GetUnit()));
+
+ else
+ {
+ // Ausgangswert ueberschreiben, nicht spaeter restaurieren
+ sal_Int64 nPercent, nAktWidth;
+ if(eInUnit == FUNIT_TWIP)
+ {
+ nAktWidth = ConvertValue(nNewValue, 0, nOldDigits, FUNIT_TWIP, FUNIT_TWIP);
+ }
+ else
+ {
+ sal_Int64 nValue = Convert(nNewValue, eInUnit, eOldUnit);
+ nAktWidth = ConvertValue(nValue, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
+ }
+ nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
+ MetricFormatter::SetValue(nPercent);
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void PercentField::SetUserValue( sal_Int64 nNewValue, FieldUnit eInUnit )
+{
+ if (GetUnit() != FUNIT_CUSTOM || eInUnit == FUNIT_CUSTOM)
+ MetricField::SetUserValue(Convert(nNewValue, eInUnit, GetUnit()),FUNIT_NONE);
+
+ else
+ {
+ // Ausgangswert ueberschreiben, nicht spaeter restaurieren
+ sal_Int64 nPercent, nAktWidth;
+ if(eInUnit == FUNIT_TWIP)
+ {
+ nAktWidth = ConvertValue(nNewValue, 0, nOldDigits, FUNIT_TWIP, FUNIT_TWIP);
+ }
+ else
+ {
+ sal_Int64 nValue = Convert(nNewValue, eInUnit, eOldUnit);
+ nAktWidth = ConvertValue(nValue, 0, nOldDigits, eOldUnit, FUNIT_TWIP);
+ }
+ nPercent = ((nAktWidth * 10) / nRefValue + 5) / 10;
+ MetricField::SetUserValue(nPercent,FUNIT_NONE);
+ }
+
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void PercentField::SetBaseValue(sal_Int64 nNewValue, FieldUnit eInUnit)
+{
+ if (GetUnit() == FUNIT_CUSTOM)
+ nOldBaseValue = ConvertValue(nNewValue, 0, nOldDigits, eInUnit, eOldUnit);
+ else
+ MetricField::SetBaseValue(nNewValue, eInUnit);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Int64 PercentField::GetValue( FieldUnit eOutUnit )
+{
+ return Convert(MetricField::GetValue(), GetUnit(), eOutUnit);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void PercentField::SetMin(sal_Int64 nNewMin, FieldUnit eInUnit)
+{
+ if (GetUnit() != FUNIT_CUSTOM)
+ MetricField::SetMin(nNewMin, eInUnit);
+ else
+ {
+ if (eInUnit == FUNIT_NONE)
+ eInUnit = eOldUnit;
+ nOldMin = Convert(nNewMin, eInUnit, eOldUnit);
+
+ sal_Int64 nPercent = Convert(nNewMin, eInUnit, FUNIT_CUSTOM);
+ MetricField::SetMin(Max( static_cast< sal_Int64 >(1), nPercent));
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+void PercentField::SetMax(sal_Int64 nNewMax, FieldUnit eInUnit)
+{
+ if (GetUnit() != FUNIT_CUSTOM)
+ MetricField::SetMax(nNewMax, eInUnit);
+ else
+ {
+ if (eInUnit == FUNIT_NONE)
+ eInUnit = eOldUnit;
+// SetRefValue(Convert(nNewMax, eInUnit, FUNIT_TWIP));
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Int64 PercentField::NormalizePercent(sal_Int64 nValue)
+{
+ if (GetUnit() != FUNIT_CUSTOM)
+ nValue = MetricField::Normalize(nValue);
+ else
+ nValue = nValue * ImpPower10(nOldDigits);
+
+ return nValue;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Int64 PercentField::DenormalizePercent(sal_Int64 nValue)
+{
+ if (GetUnit() != FUNIT_CUSTOM)
+ nValue = MetricField::Denormalize(nValue);
+ else
+ {
+ sal_Int64 nFactor = ImpPower10(nOldDigits);
+ nValue = ((nValue+(nFactor/2)) / nFactor);
+ }
+
+ return nValue;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+BOOL PercentField::IsValueModified()
+{
+ if (GetUnit() == FUNIT_CUSTOM)
+ return TRUE;
+ else
+ return MetricField::IsValueModified();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Int64 PercentField::ImpPower10( USHORT n )
+{
+ USHORT i;
+ sal_Int64 nValue = 1;
+
+ for ( i=0; i < n; i++ )
+ nValue *= 10;
+
+ return nValue;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Int64 PercentField::GetRealValue(FieldUnit eOutUnit)
+{
+ if (GetUnit() != FUNIT_CUSTOM)
+ return GetValue(eOutUnit);
+ else
+ return Convert(GetValue(), GetUnit(), eOutUnit);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+sal_Int64 PercentField::Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit eOutUnit)
+{
+ if (eInUnit == eOutUnit ||
+ (eInUnit == FUNIT_NONE && eOutUnit == GetUnit()) ||
+ (eOutUnit == FUNIT_NONE && eInUnit == GetUnit()))
+ return nValue;
+
+ if (eInUnit == FUNIT_CUSTOM)
+ {
+ // Umrechnen in Metrik
+ sal_Int64 nTwipValue = (nRefValue * nValue + 50) / 100;
+
+ if (eOutUnit == FUNIT_TWIP) // Nur wandeln, wenn unbedingt notwendig
+ return NormalizePercent(nTwipValue);
+ else
+ return ConvertValue(NormalizePercent(nTwipValue), 0, nOldDigits, FUNIT_TWIP, eOutUnit);
+ }
+
+ if (eOutUnit == FUNIT_CUSTOM)
+ {
+ // Umrechnen in Prozent
+ sal_Int64 nAktWidth;
+ nValue = DenormalizePercent(nValue);
+
+ if (eInUnit == FUNIT_TWIP) // Nur wandeln, wenn unbedingt notwendig
+ nAktWidth = nValue;
+ else
+ nAktWidth = ConvertValue(nValue, 0, nOldDigits, eInUnit, FUNIT_TWIP);
+ // Um 0.5 Prozent runden
+ return ((nAktWidth * 1000) / nRefValue + 5) / 10;
+ }
+
+ return ConvertValue(nValue, 0, nOldDigits, eInUnit, eOutUnit);
+}
+
+
diff --git a/sw/source/ui/utlui/shdwcrsr.cxx b/sw/source/ui/utlui/shdwcrsr.cxx
new file mode 100644
index 000000000000..a5c2e6dfe419
--- /dev/null
+++ b/sw/source/ui/utlui/shdwcrsr.cxx
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <vcl/window.hxx>
+
+#include "swtypes.hxx"
+#include "shdwcrsr.hxx"
+
+using namespace ::com::sun::star;
+
+
+SwShadowCursor::~SwShadowCursor()
+{
+ if( USHRT_MAX != nOldMode )
+ DrawCrsr( aOldPt, nOldHeight, nOldMode );
+}
+
+void SwShadowCursor::SetPos( const Point& rPt, long nHeight, USHORT nMode )
+{
+ Point aPt( pWin->LogicToPixel( rPt ));
+ nHeight = pWin->LogicToPixel( Size( 0, nHeight )).Height();
+ if( aOldPt != aPt || nOldHeight != nHeight || nOldMode != nMode )
+ {
+ if( USHRT_MAX != nOldMode )
+ DrawCrsr( aOldPt, nOldHeight, nOldMode );
+
+ DrawCrsr( aPt, nHeight, nMode );
+ nOldMode = nMode;
+ nOldHeight = nHeight;
+ aOldPt = aPt;
+ }
+}
+
+void SwShadowCursor::DrawTri( const Point& rPt, long nHeight, BOOL bLeft )
+{
+ long nLineDiff = ( nHeight / 2 );
+ long nLineDiffHalf = nLineDiff / 2;
+
+ // Punkt oben
+ Point aPt1( (bLeft ? rPt.X() - 3 : rPt.X() + 3),
+ rPt.Y() + nLineDiffHalf );
+ // Punkt unten
+ Point aPt2( aPt1.X(), aPt1.Y() + nHeight - nLineDiff - 1 );
+ long nDiff = bLeft ? -1 : 1;
+ while( aPt1.Y() <= aPt2.Y() )
+ {
+ pWin->DrawLine( aPt1, aPt2 );
+ aPt1.Y()++, aPt2.Y()--;
+ aPt2.X() = aPt1.X() += nDiff;
+ }
+}
+
+void SwShadowCursor::DrawCrsr( const Point& rPt, long nHeight, USHORT nMode )
+{
+ nHeight = (((nHeight / 4)+1) * 4) + 1;
+
+ pWin->Push();
+
+ pWin->SetMapMode( MAP_PIXEL );
+ pWin->SetRasterOp( ROP_XOR );
+
+ pWin->SetLineColor( Color( aCol.GetColor() ^ COL_WHITE ) );
+
+ // 1. der Strich:
+ pWin->DrawLine( Point( rPt.X(), rPt.Y() + 1),
+ Point( rPt.X(), rPt.Y() - 2 + nHeight ));
+
+ // 2. das Dreieck
+ if( text::HoriOrientation::LEFT == nMode || text::HoriOrientation::CENTER == nMode ) // Pfeil nach rechts
+ DrawTri( rPt, nHeight, FALSE );
+ if( text::HoriOrientation::RIGHT == nMode || text::HoriOrientation::CENTER == nMode ) // Pfeil nach links
+ DrawTri( rPt, nHeight, TRUE );
+
+ pWin->Pop();
+}
+
+void SwShadowCursor::Paint()
+{
+ if( USHRT_MAX != nOldMode )
+ DrawCrsr( aOldPt, nOldHeight, nOldMode );
+}
+
+Rectangle SwShadowCursor::GetRect() const
+{
+ long nH = nOldHeight;
+ Point aPt( aOldPt );
+
+ nH = (((nH / 4)+1) * 4) + 1;
+ long nWidth = nH / 4 + 3 + 1;
+
+ Size aSz( nWidth, nH );
+
+ if( text::HoriOrientation::RIGHT == nOldMode )
+ aPt.X() -= aSz.Width();
+ else if( text::HoriOrientation::CENTER == nOldMode )
+ {
+ aPt.X() -= aSz.Width();
+ aSz.Width() *= 2;
+ }
+
+ return pWin->PixelToLogic( Rectangle( aPt, aSz ) );
+}
+
+
+
+
diff --git a/sw/source/ui/utlui/swrenamexnameddlg.cxx b/sw/source/ui/utlui/swrenamexnameddlg.cxx
new file mode 100644
index 000000000000..27b861991e0f
--- /dev/null
+++ b/sw/source/ui/utlui/swrenamexnameddlg.cxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+
+
+#include <swtypes.hxx>
+#include <globals.hrc>
+#include <misc.hrc>
+
+#include <utlui.hrc>
+#include <unotools.hrc>
+#include <unoprnms.hxx>
+#include <tools/debug.hxx>
+#include <vcl/msgbox.hxx>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/view/XScreenCursor.hpp>
+#include <com/sun/star/view/DocumentZoomType.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/view/XViewSettingsSupplier.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/stritem.hxx>
+#include <shellio.hxx>
+#include <docsh.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <swmodule.hxx>
+#include <unocrsr.hxx>
+
+#include "swrenamexnameddlg.hxx"
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+SwRenameXNamedDlg::SwRenameXNamedDlg( Window* pWin,
+ uno::Reference< container::XNamed > & xN,
+ uno::Reference< container::XNameAccess > & xNA ) :
+ ModalDialog(pWin, SW_RES(DLG_RENAME_XNAMED)),
+ aNewNameFT(this, SW_RES(FT_NEW_NAME)),
+ aNewNameED(this, SW_RES(ED_NEW_NAME)),
+ aNameFL(this, SW_RES(FL_NAME)),
+ aOk(this, SW_RES(PB_OK)),
+ aCancel(this, SW_RES(PB_CANCEL)),
+ aHelp(this, SW_RES(PB_HELP)),
+ xNamed(xN),
+ xNameAccess(xNA)
+{
+ FreeResource();
+ sRemoveWarning = String(SW_RES(STR_REMOVE_WARNING));
+
+ String sTmp(GetText());
+ aNewNameED.SetText(xNamed->getName());
+ aNewNameED.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
+ sTmp += String(xNamed->getName());
+ SetText(sTmp);
+
+ aOk.SetClickHdl(LINK(this, SwRenameXNamedDlg, OkHdl));
+ aNewNameED.SetModifyHdl(LINK(this, SwRenameXNamedDlg, ModifyHdl));
+ aOk.Enable(sal_False);
+}
+/* -----------------09.06.99 15:34-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK(SwRenameXNamedDlg, OkHdl, OKButton*, EMPTYARG)
+{
+ try
+ {
+ xNamed->setName(aNewNameED.GetText());
+ }
+ catch(uno::RuntimeException&)
+ {
+ DBG_ERROR("Name wurde nicht geaendert");
+ }
+ EndDialog(RET_OK);
+ return 0;
+}
+/* -----------------09.06.99 15:48-------------------
+ *
+ * --------------------------------------------------*/
+IMPL_LINK(SwRenameXNamedDlg, ModifyHdl, NoSpaceEdit*, pEdit)
+{
+ String sTmp(pEdit->GetText());
+
+ // prevent from pasting illegal characters
+ sal_uInt16 nLen = sTmp.Len();
+ String sMsg;
+ for(sal_uInt16 i = 0; i < pEdit->GetForbiddenChars().Len(); i++)
+ {
+ sal_uInt16 nTmpLen = sTmp.Len();
+ sTmp.EraseAllChars(pEdit->GetForbiddenChars().GetChar(i));
+ if(sTmp.Len() != nTmpLen)
+ sMsg += pEdit->GetForbiddenChars().GetChar(i);
+ }
+ if(sTmp.Len() != nLen)
+ {
+ pEdit->SetText(sTmp);
+ String sWarning(sRemoveWarning);
+ sWarning += sMsg;
+ InfoBox(this, sWarning).Execute();
+ }
+
+ aOk.Enable(sTmp.Len() && !xNameAccess->hasByName(sTmp)
+ && (!xSecondAccess.is() || !xSecondAccess->hasByName(sTmp))
+ && (!xThirdAccess.is() || !xThirdAccess->hasByName(sTmp))
+ );
+ return 0;
+}
diff --git a/sw/source/ui/utlui/textcontrolcombo.cxx b/sw/source/ui/utlui/textcontrolcombo.cxx
new file mode 100644
index 000000000000..c5325b554548
--- /dev/null
+++ b/sw/source/ui/utlui/textcontrolcombo.cxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include "textcontrolcombo.hxx"
+
+
+TextControlCombo::TextControlCombo( Window* _pParent, const ResId& _rResId,
+ Control& _rCtrl, FixedText& _rFTbefore, FixedText& _rFTafter )
+ :Window ( _pParent, _rResId )
+ ,mrCtrl ( _rCtrl )
+ ,mrFTbefore ( _rFTbefore )
+ ,mrFTafter ( _rFTafter )
+{
+}
+
+TextControlCombo::~TextControlCombo()
+{
+}
+
+void TextControlCombo::Arrange( FixedText& _rFTcomplete, BOOL /*bShow*/ )
+{
+ Point aBasePos( GetPosPixel() );
+ Size aMetricVals( GetSizePixel() );
+
+ long nTextHeight = _rFTcomplete.GetSizePixel().Height();
+ long nCtrlHeight = mrCtrl.GetSizePixel().Height();
+
+ // calc y positions / center vertical
+ long nYFT = aBasePos.Y();
+ long nYCtrl = nYFT;
+ if( nCtrlHeight > nTextHeight )
+ nYFT += aMetricVals.Height();
+ else
+ nYCtrl += aMetricVals.Height();
+
+ // separate text parts
+ const String aReplStr( RTL_CONSTASCII_STRINGPARAM( "%POSITION_OF_CONTROL" ) );
+ String aTxtBefore( _rFTcomplete.GetText() );
+ String aTxtAfter;
+ xub_StrLen nReplPos = aTxtBefore.Search( aReplStr );
+ if( nReplPos != STRING_NOTFOUND )
+ {
+ xub_StrLen nStrStartAfter = nReplPos + aReplStr.Len();
+ aTxtAfter = String( aTxtBefore, nStrStartAfter, aTxtBefore.Len() - nStrStartAfter );
+ aTxtBefore.Erase( nReplPos );
+ }
+
+ // arrange and fill Fixed Texts
+ long nX = aBasePos.X();
+ long nWidth = GetTextWidth( aTxtBefore );
+
+ mrFTbefore.SetText( aTxtBefore );
+ mrFTbefore.SetPosSizePixel( nX, nYFT, nWidth, nTextHeight );
+
+ nX += nWidth;
+ nX += aMetricVals.Width();
+ mrCtrl.SetPosPixel( Point( nX, nYCtrl ) );
+
+ nX += mrCtrl.GetSizePixel().Width();
+ nX += aMetricVals.Width();
+ mrFTafter.SetText( aTxtAfter );
+ mrFTafter.SetPosSizePixel( nX, nYFT, GetTextWidth( aTxtAfter ), nTextHeight );
+
+ _rFTcomplete.Hide();
+
+ Show();
+
+ Window::Hide();
+}
+
+void TextControlCombo::Show( BOOL _bVisible, USHORT _nFlags )
+{
+ mrCtrl.Show( _bVisible, _nFlags );
+ mrFTbefore.Show( _bVisible, _nFlags );
+ mrFTafter.Show( _bVisible, _nFlags );
+}
+
+void TextControlCombo::Enable( BOOL _bEnable, BOOL _bChild )
+{
+ mrCtrl.Enable( _bEnable, _bChild );
+ mrFTbefore.Enable( _bEnable, _bChild );
+ mrFTafter.Enable( _bEnable, _bChild );
+}
+
+
diff --git a/sw/source/ui/utlui/tmplctrl.cxx b/sw/source/ui/utlui/tmplctrl.cxx
new file mode 100644
index 000000000000..df78a355d8c8
--- /dev/null
+++ b/sw/source/ui/utlui/tmplctrl.cxx
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+// include ---------------------------------------------------------------
+
+
+#include <svl/style.hxx>
+#ifndef _MENU_HXX //autogen
+#include <vcl/menu.hxx>
+#endif
+#include <svl/stritem.hxx>
+#include <sfx2/dispatch.hxx>
+#ifndef _STATUS_HXX //autogen
+#include <vcl/status.hxx>
+#endif
+
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "swmodule.hxx"
+#include "cmdid.h"
+#include "docsh.hxx"
+#include "tmplctrl.hxx"
+
+
+// STATIC DATA -----------------------------------------------------------
+
+
+SFX_IMPL_STATUSBAR_CONTROL( SwTemplateControl, SfxStringItem );
+
+// class TemplatePopup_Impl --------------------------------------------------
+
+class TemplatePopup_Impl : public PopupMenu
+{
+public:
+ TemplatePopup_Impl();
+
+ USHORT GetCurId() const { return nCurId; }
+
+private:
+ USHORT nCurId;
+
+ virtual void Select();
+};
+
+// -----------------------------------------------------------------------
+
+TemplatePopup_Impl::TemplatePopup_Impl() :
+ PopupMenu(),
+ nCurId(USHRT_MAX)
+{
+}
+
+// -----------------------------------------------------------------------
+
+void TemplatePopup_Impl::Select()
+{
+ nCurId = GetCurItemId();
+}
+
+// class SvxZoomStatusBarControl ------------------------------------------
+
+SwTemplateControl::SwTemplateControl( USHORT _nSlotId,
+ USHORT _nId,
+ StatusBar& rStb ) :
+ SfxStatusBarControl( _nSlotId, _nId, rStb )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SwTemplateControl::~SwTemplateControl()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SwTemplateControl::StateChanged(
+ USHORT /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
+{
+ if( eState != SFX_ITEM_AVAILABLE || pState->ISA( SfxVoidItem ) )
+ GetStatusBar().SetItemText( GetId(), String() );
+ else if ( pState->ISA( SfxStringItem ) )
+ {
+ sTemplate = ((SfxStringItem*)pState)->GetValue();
+ GetStatusBar().SetItemText( GetId(), sTemplate );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SwTemplateControl::Paint( const UserDrawEvent& )
+{
+ GetStatusBar().SetItemText( GetId(), sTemplate );
+}
+
+// -----------------------------------------------------------------------
+
+void SwTemplateControl::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU &&
+ GetStatusBar().GetItemText( GetId() ).Len() )
+ {
+ CaptureMouse();
+ TemplatePopup_Impl aPop;
+ {
+ SwView* pView = ::GetActiveView();
+ SwWrtShell* pWrtShell;
+ if( pView && 0 != (pWrtShell = pView->GetWrtShellPtr()) &&
+ !pWrtShell->SwCrsrShell::HasSelection()&&
+ !pWrtShell->IsSelFrmMode() &&
+ !pWrtShell->IsObjSelected())
+ {
+ SfxStyleSheetBasePool* pPool = pView->GetDocShell()->
+ GetStyleSheetPool();
+ pPool->SetSearchMask(SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_ALL);
+ if( pPool->Count() > 1 )
+ {
+ USHORT nCount = 0;
+ SfxStyleSheetBase* pStyle = pPool->First();
+ while( pStyle )
+ {
+ nCount++;
+ aPop.InsertItem( nCount, pStyle->GetName() );
+ pStyle = pPool->Next();
+ }
+
+ aPop.Execute( &GetStatusBar(), rCEvt.GetMousePosPixel());
+ USHORT nCurrId = aPop.GetCurId();
+ if( nCurrId != USHRT_MAX)
+ {
+ // sieht etwas umstaendlich aus, anders geht's aber nicht
+ pStyle = pPool->operator[]( nCurrId - 1 );
+ SfxStringItem aStyle( FN_SET_PAGE_STYLE, pStyle->GetName() );
+ pWrtShell->GetView().GetViewFrame()->GetDispatcher()->Execute(
+ FN_SET_PAGE_STYLE,
+ SFX_CALLMODE_SLOT|SFX_CALLMODE_RECORD,
+ &aStyle, 0L );
+ }
+ }
+ }
+ }
+ ReleaseMouse();
+ }
+}
+
+
+
diff --git a/sw/source/ui/utlui/uiitems.cxx b/sw/source/ui/utlui/uiitems.cxx
new file mode 100644
index 000000000000..baaff628fe5b
--- /dev/null
+++ b/sw/source/ui/utlui/uiitems.cxx
@@ -0,0 +1,324 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <editeng/itemtype.hxx>
+#include <unosett.hxx>
+
+#include "swtypes.hxx"
+#include "cmdid.h"
+#include "uiitems.hxx"
+
+#include "utlui.hrc"
+#include "attrdesc.hrc"
+#ifndef _UNOMID_H
+#include <unomid.h>
+#endif
+#include <numrule.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+// Breitenangaben der Fussnotenlinien, mit TabPage abstimmen
+static const USHORT __FAR_DATA nFtnLines[] = {
+ 0,
+ 10,
+ 50,
+ 80,
+ 100,
+ 150
+};
+
+#define FTN_LINE_STYLE_COUNT 5
+
+
+SwPageFtnInfoItem::SwPageFtnInfoItem( const USHORT nId, SwPageFtnInfo& rInfo) :
+ SfxPoolItem( nId ),
+ aFtnInfo(rInfo)
+{
+}
+
+
+SwPageFtnInfoItem::SwPageFtnInfoItem( const SwPageFtnInfoItem& rItem ) :
+ SfxPoolItem( rItem ),
+ aFtnInfo(rItem.GetPageFtnInfo())
+{
+}
+
+
+ SwPageFtnInfoItem::~SwPageFtnInfoItem()
+{
+}
+
+
+SfxPoolItem* SwPageFtnInfoItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ return new SwPageFtnInfoItem( *this );
+}
+
+
+int SwPageFtnInfoItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( Which() == rAttr.Which(), "keine gleichen Attribute" );
+ return ( aFtnInfo == ((SwPageFtnInfoItem&)rAttr).GetPageFtnInfo());
+}
+
+
+SfxItemPresentation SwPageFtnInfoItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit,
+ SfxMapUnit ePresUnit,
+ String& rText,
+ const IntlWrapper* pIntl
+) const
+{
+ switch ( ePres )
+ {
+ case SFX_ITEM_PRESENTATION_NONE:
+ rText.Erase();
+ return SFX_ITEM_PRESENTATION_NONE;
+ case SFX_ITEM_PRESENTATION_NAMELESS:
+ case SFX_ITEM_PRESENTATION_COMPLETE:
+ {
+ USHORT nHght = (USHORT) GetPageFtnInfo().GetHeight();
+ if ( nHght )
+ {
+ rText = SW_RESSTR( STR_MAX_FTN_HEIGHT );
+ rText += ' ';
+ rText += ::GetMetricText( nHght, eCoreUnit, ePresUnit, pIntl );
+ rText += ::GetSvxString( ::GetMetricId( ePresUnit ) );
+ }
+ return ePres;
+ }
+ default:; //prevent warning
+ }
+ return SFX_ITEM_PRESENTATION_NONE;
+}
+/* -----------------------------26.04.01 12:25--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwPageFtnInfoItem::QueryValue( Any& rVal, BYTE nMemberId ) const
+{
+ sal_Bool bRet = sal_True;
+ switch(nMemberId & ~CONVERT_TWIPS)
+ {
+ case MID_FTN_HEIGHT : rVal <<= (sal_Int32)TWIP_TO_MM100(aFtnInfo.GetHeight());break;
+ case MID_LINE_WEIGHT : rVal <<= (sal_Int16)TWIP_TO_MM100_UNSIGNED(aFtnInfo.GetLineWidth());break;
+ case MID_LINE_COLOR : rVal <<= (sal_Int32)aFtnInfo.GetLineColor().GetColor();break;
+ case MID_LINE_RELWIDTH :
+ {
+ Fraction aTmp( 100, 1 );
+ aTmp *= aFtnInfo.GetWidth();
+ rVal <<= (sal_Int8)(long)aTmp;
+ }
+ break;
+ case MID_LINE_ADJUST : rVal <<= (sal_Int16)aFtnInfo.GetAdj();break;//text::HorizontalAdjust
+ case MID_LINE_TEXT_DIST : rVal <<= (sal_Int32)TWIP_TO_MM100(aFtnInfo.GetTopDist());break;
+ case MID_LINE_FOOTNOTE_DIST: rVal <<= (sal_Int32)TWIP_TO_MM100(aFtnInfo.GetBottomDist());break;
+ default:
+ bRet = sal_False;
+ }
+ return bRet;
+}
+/* -----------------------------26.04.01 12:26--------------------------------
+
+ ---------------------------------------------------------------------------*/
+BOOL SwPageFtnInfoItem::PutValue(const Any& rVal, BYTE nMemberId)
+{
+ sal_Int32 nSet32 = 0;
+ sal_Bool bRet = sal_True;
+ switch(nMemberId & ~CONVERT_TWIPS)
+ {
+ case MID_LINE_COLOR :
+ rVal >>= nSet32;
+ aFtnInfo.SetLineColor(nSet32);
+ break;
+ case MID_FTN_HEIGHT:
+ case MID_LINE_TEXT_DIST :
+ case MID_LINE_FOOTNOTE_DIST:
+ rVal >>= nSet32;
+ if(nSet32 < 0)
+ bRet = sal_False;
+ else
+ {
+ nSet32 = MM100_TO_TWIP(nSet32);
+ switch(nMemberId & ~CONVERT_TWIPS)
+ {
+ case MID_FTN_HEIGHT: aFtnInfo.SetHeight(nSet32); break;
+ case MID_LINE_TEXT_DIST: aFtnInfo.SetTopDist(nSet32);break;
+ case MID_LINE_FOOTNOTE_DIST: aFtnInfo.SetBottomDist(nSet32);break;
+ }
+ }
+ break;
+ case MID_LINE_WEIGHT :
+ {
+ sal_Int16 nSet = 0;
+ rVal >>= nSet;
+ if(nSet >= 0)
+ aFtnInfo.SetLineWidth(MM100_TO_TWIP(nSet));
+ else
+ bRet = sal_False;
+ }
+ break;
+ case MID_LINE_RELWIDTH :
+ {
+ sal_Int8 nSet = 0;
+ rVal >>= nSet;
+ if(nSet < 0)
+ bRet = sal_False;
+ else
+ aFtnInfo.SetWidth(Fraction(nSet, 100));
+ }
+ break;
+ case MID_LINE_ADJUST :
+ {
+ sal_Int16 nSet = 0;
+ rVal >>= nSet;
+ if(nSet >= 0 && nSet < 3) //text::HorizontalAdjust
+ aFtnInfo.SetAdj((SwFtnAdj)nSet);
+ else
+ bRet = sal_False;
+ }
+ break;
+ default:
+ bRet = sal_False;
+ }
+ return bRet;
+}
+
+SwPtrItem::SwPtrItem( const USHORT nId, void* pPtr ) :
+ SfxPoolItem( nId ),
+ pMisc(pPtr)
+{
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Copy-Konstruktor
+ --------------------------------------------------------------------*/
+
+
+SwPtrItem::SwPtrItem( const SwPtrItem& rItem ) : SfxPoolItem( rItem )
+{
+ pMisc = rItem.pMisc;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Clonen
+ --------------------------------------------------------------------*/
+
+
+SfxPoolItem* SwPtrItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ return new SwPtrItem( *this );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+int SwPtrItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+ const SwPtrItem& rItem = (SwPtrItem&)rAttr;
+ return ( pMisc == rItem.pMisc );
+}
+
+
+/*-----------------12.11.97 12:55-------------------------------
+ SwUINumRuleItem fuer die NumTabPages der FormatNumRule/Stylisten
+---------------------------------------------------------------*/
+SwUINumRuleItem::SwUINumRuleItem( const SwNumRule& rRul, const USHORT nId )
+ : SfxPoolItem( nId ), pRule( new SwNumRule( rRul ) )
+{
+}
+
+SwUINumRuleItem::SwUINumRuleItem( const SwUINumRuleItem& rItem )
+ : SfxPoolItem( rItem ),
+ pRule( new SwNumRule( *rItem.pRule ))
+{
+}
+
+ SwUINumRuleItem::~SwUINumRuleItem()
+{
+ delete pRule;
+}
+
+
+SfxPoolItem* SwUINumRuleItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ return new SwUINumRuleItem( *this );
+}
+
+int SwUINumRuleItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
+ return *pRule == *((SwUINumRuleItem&)rAttr).pRule;
+}
+
+BOOL SwUINumRuleItem::QueryValue( uno::Any& rVal, BYTE /*nMemberId*/ ) const
+{
+ uno::Reference< container::XIndexReplace >xRules = new SwXNumberingRules(*pRule);
+ rVal.setValue(&xRules, ::getCppuType((uno::Reference< container::XIndexReplace>*)0));
+ return TRUE;
+}
+BOOL SwUINumRuleItem::PutValue( const uno::Any& rVal, BYTE /*nMemberId*/ )
+{
+ uno::Reference< container::XIndexReplace> xRulesRef;
+ if(rVal >>= xRulesRef)
+ {
+ uno::Reference< lang::XUnoTunnel > xTunnel(xRulesRef, uno::UNO_QUERY);
+ SwXNumberingRules* pSwXRules = xTunnel.is() ? reinterpret_cast<SwXNumberingRules*>(
+ xTunnel->getSomething(SwXNumberingRules::getUnoTunnelId())) : 0;
+ if(pSwXRules)
+ {
+ *pRule = *pSwXRules->GetNumRule();
+ }
+ }
+ return TRUE;
+}
+/* -----------------17.06.98 17:43-------------------
+ *
+ * --------------------------------------------------*/
+SwBackgroundDestinationItem::SwBackgroundDestinationItem(USHORT _nWhich, USHORT nValue) :
+ SfxUInt16Item(_nWhich, nValue)
+{
+}
+/* -----------------17.06.98 17:44-------------------
+ *
+ * --------------------------------------------------*/
+SfxPoolItem* SwBackgroundDestinationItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ return new SwBackgroundDestinationItem(Which(), GetValue());
+}
+
+
+
diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx
new file mode 100644
index 000000000000..32c355313d7f
--- /dev/null
+++ b/sw/source/ui/utlui/uitool.cxx
@@ -0,0 +1,775 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <hintids.hxx>
+
+#include <tools/datetime.hxx>
+#include <vcl/svapp.hxx>
+#include <unotools/collatorwrapper.hxx>
+#include <svl/urihelper.hxx>
+#include <svl/stritem.hxx>
+#include <unotools/syslocale.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/docfilt.hxx>
+#include <editeng/pmdlitem.hxx>
+#ifndef _SVX_TSTPITEM_HXX //autogen
+#include <editeng/tstpitem.hxx>
+#endif
+#include <editeng/boxitem.hxx>
+#include <editeng/sizeitem.hxx>
+#include <svx/pageitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <svl/style.hxx>
+#ifndef _VCL_LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+#include <unotools/localedatawrapper.hxx>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/util/XURLTransformer.hpp>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <fmtornt.hxx>
+#include <tabcol.hxx>
+#include <edtwin.hxx>
+#include <fmtfsize.hxx>
+#include <fmthdft.hxx>
+#include <fmtpdsc.hxx>
+#include <wview.hxx>
+#include <uiitems.hxx>
+#ifndef _DOCSH_HXX
+#include <docsh.hxx>
+#endif
+#include <wrtsh.hxx>
+#include <swmodule.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <uitool.hxx>
+#include <frmatr.hxx>
+#include <paratr.hxx>
+#include <fmtcol.hxx>
+#include <poolfmt.hxx>
+#include "usrpref.hxx"
+
+#ifndef _ERROR_H
+#include <error.h>
+#endif
+#ifndef _CMDID_H
+#include <cmdid.h>
+#endif
+#ifndef _GLOBALS_HRC
+#include <globals.hrc>
+#endif
+#ifndef _UTLUI_HRC
+#include <utlui.hrc>
+#endif
+#include <doc.hxx>
+#include <docary.hxx>
+#include <charfmt.hxx>
+#include <SwStyleNameMapper.hxx>
+// 50 cm 28350
+//
+#define MAXHEIGHT 28350
+#define MAXWIDTH 28350
+
+using namespace ::com::sun::star;
+/*--------------------------------------------------------------------
+ Beschreibung: Allgemeine List von StringPointern
+ --------------------------------------------------------------------*/
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Metric umschalten
+ --------------------------------------------------------------------*/
+
+
+void SetMetric(MetricFormatter& rCtrl, FieldUnit eUnit)
+{
+ SwTwips nMin = static_cast< SwTwips >(rCtrl.GetMin(FUNIT_TWIP));
+ SwTwips nMax = static_cast< SwTwips >(rCtrl.GetMax(FUNIT_TWIP));
+
+ rCtrl.SetUnit(eUnit);
+
+ rCtrl.SetMin(nMin, FUNIT_TWIP);
+ rCtrl.SetMax(nMax, FUNIT_TWIP);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Boxinfo-Attribut setzen
+ --------------------------------------------------------------------*/
+
+
+void PrepareBoxInfo(SfxItemSet& rSet, const SwWrtShell& rSh)
+{
+ SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+ const SfxPoolItem *pBoxInfo;
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER,
+ TRUE, &pBoxInfo))
+ aBoxInfo = *(SvxBoxInfoItem*)pBoxInfo;
+
+ // Tabellenvariante, wenn mehrere Tabellenzellen selektiert
+ rSh.GetCrsr(); //Damit GetCrsrCnt() auch das Richtige liefert
+ aBoxInfo.SetTable (rSh.IsTableMode() && rSh.GetCrsrCnt() > 1);
+ // Abstandsfeld immer anzeigen
+ aBoxInfo.SetDist ((BOOL) TRUE);
+ // Minimalgroesse in Tabellen und Absaetzen setzen
+ aBoxInfo.SetMinDist (rSh.IsTableMode() || rSh.GetSelectionType() & (nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL));
+ // Default-Abstand immer setzen
+ aBoxInfo.SetDefDist (MIN_BORDER_DIST);
+ // Einzelne Linien koennen nur in Tabellen DontCare-Status haben
+ aBoxInfo.SetValid(VALID_DISABLE, !rSh.IsTableMode());
+
+ rSet.Put(aBoxInfo);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Header Footer fuellen
+ --------------------------------------------------------------------*/
+
+
+void FillHdFt(SwFrmFmt* pFmt, const SfxItemSet& rSet)
+{
+ SwAttrSet aSet(pFmt->GetAttrSet());
+ aSet.Put(rSet);
+
+ const SvxSizeItem& rSize = (const SvxSizeItem&)rSet.Get(SID_ATTR_PAGE_SIZE);
+ const SfxBoolItem& rDynamic = (const SfxBoolItem&)rSet.Get(SID_ATTR_PAGE_DYNAMIC);
+
+ // Groesse umsetzen
+ //
+ SwFmtFrmSize aFrmSize(rDynamic.GetValue() ? ATT_MIN_SIZE : ATT_FIX_SIZE,
+ rSize.GetSize().Width(),
+ rSize.GetSize().Height());
+ aSet.Put(aFrmSize);
+ pFmt->SetFmtAttr(aSet);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: PageDesc <-> in Sets wandeln und zurueck
+ --------------------------------------------------------------------*/
+
+
+void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc )
+{
+ SwFrmFmt& rMaster = rPageDesc.GetMaster();
+
+ // alle allgemeinen Rahmen-Attribute uebertragen
+ //
+ rMaster.SetFmtAttr(rSet);
+
+ // PageData
+ //
+ if(rSet.GetItemState(SID_ATTR_PAGE) == SFX_ITEM_SET)
+ {
+ const SvxPageItem& rPageItem = (const SvxPageItem&)rSet.Get(SID_ATTR_PAGE);
+
+ USHORT nUse = (USHORT)rPageItem.GetPageUsage();
+ if(nUse & 0x04)
+ nUse |= 0x03;
+ if(nUse)
+ rPageDesc.SetUseOn( (UseOnPage) nUse );
+ rPageDesc.SetLandscape(rPageItem.IsLandscape());
+ SvxNumberType aNumType;
+ aNumType.SetNumberingType( static_cast< sal_Int16 >(rPageItem.GetNumType()) );
+ rPageDesc.SetNumType(aNumType);
+ }
+ // Groesse
+ //
+ if(rSet.GetItemState(SID_ATTR_PAGE_SIZE) == SFX_ITEM_SET)
+ {
+ const SvxSizeItem& rSizeItem = (const SvxSizeItem&)rSet.Get(SID_ATTR_PAGE_SIZE);
+ SwFmtFrmSize aSize(ATT_FIX_SIZE);
+ aSize.SetSize(rSizeItem.GetSize());
+ rMaster.SetFmtAttr(aSize);
+ }
+ // Kopzeilen-Attribute auswerten
+ //
+ const SfxPoolItem* pItem;
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_PAGE_HEADERSET,
+ FALSE, &pItem ) )
+ {
+ const SfxItemSet& rHeaderSet = ((SvxSetItem*)pItem)->GetItemSet();
+ const SfxBoolItem& rHeaderOn = (const SfxBoolItem&)rHeaderSet.Get(SID_ATTR_PAGE_ON);
+
+ if(rHeaderOn.GetValue())
+ {
+ // Werte uebernehmen
+ if(!rMaster.GetHeader().IsActive())
+ rMaster.SetFmtAttr(SwFmtHeader(TRUE));
+
+ // Das Headerformat rausholen und anpassen
+ //
+ SwFmtHeader aHeaderFmt(rMaster.GetHeader());
+ SwFrmFmt *pHeaderFmt = aHeaderFmt.GetHeaderFmt();
+ ASSERT(pHeaderFmt != 0, "kein HeaderFormat");
+
+ ::FillHdFt(pHeaderFmt, rHeaderSet);
+
+ rPageDesc.ChgHeaderShare(((const SfxBoolItem&)
+ rHeaderSet.Get(SID_ATTR_PAGE_SHARED)).GetValue());
+ }
+ else
+ { // Header ausschalten
+ //
+ if(rMaster.GetHeader().IsActive())
+ {
+ rMaster.SetFmtAttr(SwFmtHeader(BOOL(FALSE)));
+ rPageDesc.ChgHeaderShare(FALSE);
+ }
+ }
+ }
+
+ // Fusszeilen-Attribute auswerten
+ //
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_PAGE_FOOTERSET,
+ FALSE, &pItem ) )
+ {
+ const SfxItemSet& rFooterSet = ((SvxSetItem*)pItem)->GetItemSet();
+ const SfxBoolItem& rFooterOn = (const SfxBoolItem&)rFooterSet.Get(SID_ATTR_PAGE_ON);
+
+ if(rFooterOn.GetValue())
+ {
+ // Werte uebernehmen
+ if(!rMaster.GetFooter().IsActive())
+ rMaster.SetFmtAttr(SwFmtFooter(TRUE));
+
+ // Das Footerformat rausholen und anpassen
+ //
+ SwFmtFooter aFooterFmt(rMaster.GetFooter());
+ SwFrmFmt *pFooterFmt = aFooterFmt.GetFooterFmt();
+ ASSERT(pFooterFmt != 0, "kein FooterFormat");
+
+ ::FillHdFt(pFooterFmt, rFooterSet);
+
+ rPageDesc.ChgFooterShare(((const SfxBoolItem&)
+ rFooterSet.Get(SID_ATTR_PAGE_SHARED)).GetValue());
+ }
+ else
+ { // Footer ausschalten
+ //
+ if(rMaster.GetFooter().IsActive())
+ {
+ rMaster.SetFmtAttr(SwFmtFooter(BOOL(FALSE)));
+ rPageDesc.ChgFooterShare(FALSE);
+ }
+ }
+ }
+
+ // Fussnoten
+ //
+ if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_FTN_INFO,
+ FALSE, &pItem ) )
+ rPageDesc.SetFtnInfo( ((SwPageFtnInfoItem*)pItem)->GetPageFtnInfo() );
+
+
+ //
+ // Columns
+ //
+
+ // Registerhaltigkeit
+
+ if(SFX_ITEM_SET == rSet.GetItemState(
+ SID_SWREGISTER_MODE, FALSE, &pItem))
+ {
+ BOOL bSet = ((const SfxBoolItem*)pItem)->GetValue();
+ if(!bSet)
+ rPageDesc.SetRegisterFmtColl(0);
+ else if(SFX_ITEM_SET == rSet.GetItemState(
+ SID_SWREGISTER_COLLECTION, FALSE, &pItem))
+ {
+ const String& rColl = ((const SfxStringItem*)pItem)->GetValue();
+ SwDoc& rDoc = *rMaster.GetDoc();
+ SwTxtFmtColl* pColl = rDoc.FindTxtFmtCollByName( rColl );
+ if( !pColl )
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName( rColl, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if( USHRT_MAX != nId )
+ pColl = rDoc.GetTxtCollFromPool( nId );
+ else
+ pColl = rDoc.MakeTxtFmtColl( rColl,
+ (SwTxtFmtColl*)rDoc.GetDfltTxtFmtColl() );
+ }
+ if( pColl )
+ pColl->SetFmtAttr( SwRegisterItem ( TRUE ));
+ rPageDesc.SetRegisterFmtColl( pColl );
+ }
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet)
+{
+ const SwFrmFmt& rMaster = rPageDesc.GetMaster();
+
+ // Seitendaten
+ //
+ SvxPageItem aPageItem(SID_ATTR_PAGE);
+ aPageItem.SetDescName(rPageDesc.GetName());
+ aPageItem.SetPageUsage(rPageDesc.GetUseOn());
+ aPageItem.SetLandscape(rPageDesc.GetLandscape());
+ aPageItem.SetNumType((SvxNumType)rPageDesc.GetNumType().GetNumberingType());
+ rSet.Put(aPageItem);
+
+ // Groesse
+ SvxSizeItem aSizeItem(SID_ATTR_PAGE_SIZE, rMaster.GetFrmSize().GetSize());
+ rSet.Put(aSizeItem);
+
+ // Maximale Groesse
+ SvxSizeItem aMaxSizeItem(SID_ATTR_PAGE_MAXSIZE, Size(MAXWIDTH, MAXHEIGHT));
+ rSet.Put(aMaxSizeItem);
+
+ // Raender, Umrandung und das andere Zeug
+ //
+ rSet.Put(rMaster.GetAttrSet());
+
+ SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
+ const SfxPoolItem *pBoxInfo;
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER,
+ TRUE, &pBoxInfo) )
+ aBoxInfo = *(SvxBoxInfoItem*)pBoxInfo;
+
+ aBoxInfo.SetTable( FALSE );
+ // Abstandsfeld immer anzeigen
+ aBoxInfo.SetDist( TRUE);
+ // Minimalgroesse in Tabellen und Absaetzen setzen
+ aBoxInfo.SetMinDist( FALSE );
+ // Default-Abstand immer setzen
+ aBoxInfo.SetDefDist( MIN_BORDER_DIST );
+ // Einzelne Linien koennen nur in Tabellen DontCare-Status haben
+ aBoxInfo.SetValid( VALID_DISABLE );
+ rSet.Put( aBoxInfo );
+
+
+ SfxStringItem aFollow(SID_ATTR_PAGE_EXT1, aEmptyStr);
+ if(rPageDesc.GetFollow())
+ aFollow.SetValue(rPageDesc.GetFollow()->GetName());
+ rSet.Put(aFollow);
+
+ // Header
+ //
+ if(rMaster.GetHeader().IsActive())
+ {
+ const SwFmtHeader &rHeaderFmt = rMaster.GetHeader();
+ const SwFrmFmt *pHeaderFmt = rHeaderFmt.GetHeaderFmt();
+ ASSERT(pHeaderFmt != 0, kein HeaderFormat.);
+
+ // HeaderInfo, Raender, Hintergrund, Umrandung
+ //
+ SfxItemSet aHeaderSet( *rSet.GetPool(),
+ SID_ATTR_PAGE_ON, SID_ATTR_PAGE_SHARED,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ 0);
+
+ // dynamische oder feste Hoehe
+ //
+ SfxBoolItem aOn(SID_ATTR_PAGE_ON, TRUE);
+ aHeaderSet.Put(aOn);
+
+ const SwFmtFrmSize &rFrmSize = pHeaderFmt->GetFrmSize();
+ const SwFrmSize eSizeType = rFrmSize.GetHeightSizeType();
+ SfxBoolItem aDynamic(SID_ATTR_PAGE_DYNAMIC, eSizeType != ATT_FIX_SIZE);
+ aHeaderSet.Put(aDynamic);
+
+ // Links gleich rechts
+ //
+ SfxBoolItem aShared(SID_ATTR_PAGE_SHARED, rPageDesc.IsHeaderShared());
+ aHeaderSet.Put(aShared);
+
+ // Groesse
+ SvxSizeItem aSize(SID_ATTR_PAGE_SIZE, Size(rFrmSize.GetSize()));
+ aHeaderSet.Put(aSize);
+
+ // Rahmen-Attribute umschaufeln
+ //
+ aHeaderSet.Put(pHeaderFmt->GetAttrSet());
+ aHeaderSet.Put( aBoxInfo );
+
+ // SetItem erzeugen
+ //
+ SvxSetItem aSetItem(SID_ATTR_PAGE_HEADERSET, aHeaderSet);
+ rSet.Put(aSetItem);
+ }
+
+ // Footer
+ if(rMaster.GetFooter().IsActive())
+ {
+ const SwFmtFooter &rFooterFmt = rMaster.GetFooter();
+ const SwFrmFmt *pFooterFmt = rFooterFmt.GetFooterFmt();
+ ASSERT(pFooterFmt != 0, kein FooterFormat.);
+
+ // FooterInfo, Raender, Hintergrund, Umrandung
+ //
+ SfxItemSet aFooterSet( *rSet.GetPool(),
+ SID_ATTR_PAGE_ON, SID_ATTR_PAGE_SHARED,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ RES_FRMATR_BEGIN, RES_FRMATR_END-1,
+ 0);
+
+ // dynamische oder feste Hoehe
+ //
+ SfxBoolItem aOn(SID_ATTR_PAGE_ON, TRUE);
+ aFooterSet.Put(aOn);
+
+ const SwFmtFrmSize &rFrmSize = pFooterFmt->GetFrmSize();
+ const SwFrmSize eSizeType = rFrmSize.GetHeightSizeType();
+ SfxBoolItem aDynamic(SID_ATTR_PAGE_DYNAMIC, eSizeType != ATT_FIX_SIZE);
+ aFooterSet.Put(aDynamic);
+
+ // Links gleich rechts
+ //
+ SfxBoolItem aShared(SID_ATTR_PAGE_SHARED, rPageDesc.IsFooterShared());
+ aFooterSet.Put(aShared);
+
+ // Groesse
+ SvxSizeItem aSize(SID_ATTR_PAGE_SIZE, Size(rFrmSize.GetSize()));
+ aFooterSet.Put(aSize);
+
+ // Rahmen-Attribute umschaufeln
+ //
+ aFooterSet.Put(pFooterFmt->GetAttrSet());
+ aFooterSet.Put( aBoxInfo );
+
+ // SetItem erzeugen
+ //
+ SvxSetItem aSetItem(SID_ATTR_PAGE_FOOTERSET, aFooterSet);
+ rSet.Put(aSetItem);
+ }
+
+ // Fussnoten einbauen
+ //
+ SwPageFtnInfo& rInfo = (SwPageFtnInfo&)rPageDesc.GetFtnInfo();
+ SwPageFtnInfoItem aFtnItem(FN_PARAM_FTN_INFO, rInfo);
+ rSet.Put(aFtnItem);
+
+ // Registerhaltigkeit
+
+ const SwTxtFmtColl* pCol = rPageDesc.GetRegisterFmtColl();
+ SwRegisterItem aReg(pCol != 0);
+ aReg.SetWhich(SID_SWREGISTER_MODE);
+ rSet.Put(aReg);
+ if(pCol)
+ rSet.Put(SfxStringItem(SID_SWREGISTER_COLLECTION, pCol->GetName()));
+
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: DefaultTabs setzen
+ --------------------------------------------------------------------*/
+
+
+void MakeDefTabs(SwTwips nDefDist, SvxTabStopItem& rTabs)
+{
+ if( rTabs.Count() )
+ return;
+ {
+ SvxTabStop aSwTabStop( nDefDist, SVX_TAB_ADJUST_DEFAULT );
+ rTabs.Insert( aSwTabStop );
+ }
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Abstand zwischen zwei Tabs
+ --------------------------------------------------------------------*/
+
+
+USHORT GetTabDist(const SvxTabStopItem& rTabs)
+{
+ USHORT nDefDist;
+ if( rTabs.Count() )
+ nDefDist = (USHORT)( rTabs[0].GetTabPos() );
+ else
+ nDefDist = 1134; // 2cm
+ return nDefDist;
+}
+
+
+// erfrage ob im Set eine Sfx-PageDesc-Kombination vorliegt und returne diese
+void SfxToSwPageDescAttr( const SwWrtShell& rShell, SfxItemSet& rSet )
+{
+ const SfxPoolItem* pItem;
+ SwFmtPageDesc aPgDesc;
+
+ BOOL bChanged = FALSE;
+ // Seitennummer
+ if(SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_PARA_PAGENUM, FALSE, &pItem))
+ {
+ aPgDesc.SetNumOffset(((SfxUInt16Item*)pItem)->GetValue());
+ bChanged = TRUE;
+ }
+ if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_PARA_MODEL, FALSE, &pItem ))
+ {
+ const String& rDescName = ((SvxPageModelItem*)pItem)->GetValue();
+ if( rDescName.Len() ) // kein Name -> PageDesc ausschalten!
+ {
+ // nur loeschen, wenn PageDesc eingschaltet wird!
+ rSet.ClearItem( RES_BREAK );
+ SwPageDesc* pDesc = ((SwWrtShell&)rShell).FindPageDescByName(
+ rDescName, TRUE );
+ if( pDesc )
+ pDesc->Add( &aPgDesc );
+ }
+ rSet.ClearItem( SID_ATTR_PARA_MODEL );
+ bChanged = TRUE;
+ }
+ else
+ {
+ SfxItemSet aCoreSet(rShell.GetView().GetPool(), RES_PAGEDESC, RES_PAGEDESC );
+ rShell.GetCurAttr( aCoreSet );
+ if(SFX_ITEM_SET == aCoreSet.GetItemState( RES_PAGEDESC, TRUE, &pItem ) )
+ {
+ if( ((SwFmtPageDesc*)pItem)->GetPageDesc() )
+ {
+ ((SwFmtPageDesc*)pItem)->GetPageDesc()->Add(&aPgDesc);
+ }
+ }
+ }
+
+
+ if(bChanged)
+ rSet.Put( aPgDesc );
+}
+
+
+// erfrage ob im Set eine Sfx-PageDesc-Kombination vorliegt und returne diese
+void SwToSfxPageDescAttr( SfxItemSet& rCoreSet )
+{
+ const SfxPoolItem* pItem = 0;
+ String aName;
+ USHORT nPageNum = 0;
+ BOOL bPut = TRUE;
+ switch( rCoreSet.GetItemState( RES_PAGEDESC, TRUE, &pItem ) )
+ {
+ case SFX_ITEM_SET:
+ {
+ if( ((SwFmtPageDesc*)pItem)->GetPageDesc() )
+ {
+ aName = ((SwFmtPageDesc*)pItem)->GetPageDesc()->GetName();
+ nPageNum = ((SwFmtPageDesc*)pItem)->GetNumOffset();
+ }
+ rCoreSet.ClearItem( RES_PAGEDESC );
+ // Seitennummer
+ }
+ break;
+
+ case SFX_ITEM_AVAILABLE:
+ break;
+
+ default:
+ bPut = FALSE;
+ }
+ SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM, nPageNum );
+ rCoreSet.Put( aPageNum );
+
+ if(bPut)
+ rCoreSet.Put( SvxPageModelItem( aName, TRUE, SID_ATTR_PARA_MODEL ) );
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Metric ermitteln
+ --------------------------------------------------------------------*/
+
+
+FieldUnit GetDfltMetric(BOOL bWeb)
+{
+ return SW_MOD()->GetUsrPref(bWeb)->GetMetric();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Metric ermitteln
+ --------------------------------------------------------------------*/
+
+
+void SetDfltMetric( FieldUnit eMetric, BOOL bWeb )
+{
+ SW_MOD()->ApplyUserMetric(eMetric, bWeb);
+}
+
+/*-----------------09.04.98 16:58-------------------
+
+--------------------------------------------------*/
+USHORT InsertStringSorted(const String& rEntry, ListBox& rToFill, USHORT nOffset )
+{
+ USHORT i = nOffset;
+ CollatorWrapper& rCaseColl = ::GetAppCaseCollator();
+
+ for( ; i < rToFill.GetEntryCount(); i++ )
+ {
+ if( 0 < rCaseColl.compareString( rToFill.GetEntry(i), rEntry ))
+ break;
+ }
+ return rToFill.InsertEntry(rEntry, i);
+}
+void FillCharStyleListBox(ListBox& rToFill, SwDocShell* pDocSh, BOOL bSorted, BOOL bWithDefault)
+{
+ BOOL bHasOffset = rToFill.GetEntryCount() > 0;
+ SfxStyleSheetBasePool* pPool = pDocSh->GetStyleSheetPool();
+ pPool->SetSearchMask(SFX_STYLE_FAMILY_CHAR, SFXSTYLEBIT_ALL);
+ SwDoc* pDoc = pDocSh->GetDoc();
+ const SfxStyleSheetBase* pBase = pPool->First();
+ String sStandard;
+ SwStyleNameMapper::FillUIName( RES_POOLCOLL_STANDARD, sStandard );
+ while(pBase)
+ {
+ if(bWithDefault || pBase->GetName() != sStandard)
+ {
+ USHORT nPos;
+ if(bSorted)
+ nPos = InsertStringSorted(pBase->GetName(), rToFill, bHasOffset );
+ else
+ nPos = rToFill.InsertEntry(pBase->GetName());
+ long nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( pBase->GetName(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+ rToFill.SetEntryData( nPos, (void*) (nPoolId));
+ }
+ pBase = pPool->Next();
+ }
+ // non-pool styles
+ const SwCharFmts* pFmts = pDoc->GetCharFmts();
+ for(USHORT i = 0; i < pFmts->Count(); i++)
+ {
+ const SwCharFmt* pFmt = (*pFmts)[i];
+ if(pFmt->IsDefault())
+ continue;
+ const String& rName = pFmt->GetName();
+ if(rToFill.GetEntryPos(rName) == LISTBOX_ENTRY_NOTFOUND)
+ {
+ USHORT nPos;
+ if(bSorted)
+ nPos = InsertStringSorted(rName, rToFill, bHasOffset );
+ else
+ nPos = rToFill.InsertEntry(rName);
+ long nPoolId = USHRT_MAX;
+ rToFill.SetEntryData( nPos, (void*) (nPoolId));
+ }
+ }
+};
+
+/* -----------------27.04.98 08:26-------------------
+ *
+ * --------------------------------------------------*/
+SwTwips GetTableWidth( SwFrmFmt* pFmt, SwTabCols& rCols, USHORT *pPercent,
+ SwWrtShell* pSh )
+{
+ //Die Breite zu besorgen ist etwas komplizierter.
+ SwTwips nWidth = 0;
+ const sal_Int16 eOri = pFmt->GetHoriOrient().GetHoriOrient();
+ switch(eOri)
+ {
+ case text::HoriOrientation::FULL: nWidth = rCols.GetRight(); break;
+ case text::HoriOrientation::LEFT_AND_WIDTH:
+ case text::HoriOrientation::LEFT:
+ case text::HoriOrientation::RIGHT:
+ case text::HoriOrientation::CENTER:
+ nWidth = pFmt->GetFrmSize().GetWidth();
+ break;
+ default:
+ {
+ if(pSh)
+ {
+ const SwFrmFmt *pFlyFmt;
+ if ( 0 == (pFlyFmt = pSh->GetFlyFrmFmt()) )
+ {
+ nWidth = pSh->GetAnyCurRect(RECT_PAGE_PRT).Width();
+ }
+ else
+ {
+ nWidth = pSh->GetAnyCurRect(RECT_FLY_PRT_EMBEDDED).Width();
+ }
+ }
+ else
+ {
+ DBG_ERROR("wo soll die Breite denn herkommen?");
+ }
+ const SvxLRSpaceItem& rLRSpace = pFmt->GetLRSpace();
+ nWidth -= (rLRSpace.GetRight() + rLRSpace.GetLeft());
+ }
+ }
+ if (pPercent)
+ *pPercent = pFmt->GetFrmSize().GetWidthPercent();
+ return nWidth;
+}
+
+/*------------------------------------------------------------------------*/
+
+String GetAppLangDateTimeString( const DateTime& rDT )
+{
+ const SvtSysLocale aSysLocale;
+ const LocaleDataWrapper& rAppLclData = aSysLocale.GetLocaleData();
+ String sRet( rAppLclData.getDate( rDT ));
+ ( sRet += ' ' ) += rAppLclData.getTime( rDT, FALSE, FALSE );
+ return sRet;
+}
+
+/*-- 26.01.2006 08:06:33---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+bool ExecuteMenuCommand( PopupMenu& rMenu, SfxViewFrame& rViewFrame, USHORT nId )
+{
+ bool bRet = false;
+ USHORT nItemCount = rMenu.GetItemCount();
+ String sCommand;
+ for( USHORT nItem = 0; nItem < nItemCount; ++nItem)
+ {
+ PopupMenu* pPopup = rMenu.GetPopupMenu( rMenu.GetItemId( nItem ) );
+ if(pPopup)
+ {
+ sCommand = pPopup->GetItemCommand(nId);
+ if(sCommand.Len())
+ break;
+ }
+ }
+ if(sCommand.Len())
+ {
+ uno::Reference< frame::XFrame > xFrame = rViewFrame.GetFrame().GetFrameInterface();
+ uno::Reference < frame::XDispatchProvider > xProv( xFrame, uno::UNO_QUERY );
+ util::URL aURL;
+ aURL.Complete = sCommand;
+ uno::Reference < util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), uno::UNO_QUERY );
+ xTrans->parseStrict( aURL );
+ uno::Reference< frame::XDispatch > xDisp = xProv->queryDispatch( aURL, ::rtl::OUString(), 0 );
+ if( xDisp.is() )
+ {
+ uno::Sequence< beans::PropertyValue > aSeq;
+ xDisp->dispatch( aURL, aSeq );
+ bRet = true;
+ }
+ }
+ return bRet;
+}
diff --git a/sw/source/ui/utlui/unotools.cxx b/sw/source/ui/utlui/unotools.cxx
new file mode 100644
index 000000000000..e944c3b383cf
--- /dev/null
+++ b/sw/source/ui/utlui/unotools.cxx
@@ -0,0 +1,522 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <swtypes.hxx>
+#include <globals.hrc>
+#include <misc.hrc>
+
+#include <utlui.hrc>
+#include <unotools.hrc>
+#include <unotools.hxx>
+#include <unoprnms.hxx>
+#include <tools/debug.hxx>
+#include <vcl/msgbox.hxx>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/view/XScreenCursor.hpp>
+#include <com/sun/star/view/DocumentZoomType.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/view/XViewSettingsSupplier.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <comphelper/processfactory.hxx>
+#include <sfx2/dispatch.hxx>
+#include <svl/stritem.hxx>
+#include <shellio.hxx>
+#include <docsh.hxx>
+#include <view.hxx>
+#include <wrtsh.hxx>
+#include <swmodule.hxx>
+#include <TextCursorHelper.hxx>
+#include <unocrsr.hxx>
+#include <doc.hxx>
+
+#include <unomid.h>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+const sal_Char cFrameControl[] = "com.sun.star.frame.FrameControl";
+const sal_Char cFactory[] = "private:factory/swriter";
+/************************************************************************
+
+************************************************************************/
+
+sal_Bool SwOneExampleFrame::bShowServiceNotAvailableMessage = sal_True;
+
+/* -----------------27.07.99 15:26-------------------
+
+ --------------------------------------------------*/
+SwOneExampleFrame::SwOneExampleFrame( Window& rWin,
+ sal_uInt32 nFlags,
+ const Link* pInitializedLink,
+ String* pURL ) :
+ aTopWindow( rWin.GetParent(), 0, this ),
+ rWindow(rWin),
+ aMenuRes(SW_RES(RES_FRMEX_MENU)),
+
+ pModuleView(SW_MOD()->GetView()),
+
+ nStyleFlags(nFlags),
+ bIsInitialized(sal_False),
+ bServiceAvailable(sal_False)
+{
+ if(pURL && pURL->Len())
+ sArgumentURL = *pURL;
+
+ aTopWindow.SetPaintTransparent(sal_True);
+ aTopWindow.SetPosSizePixel(rWin.GetPosPixel(), rWin.GetSizePixel());
+ aTopWindow.SetZOrder( &rWin, WINDOW_ZORDER_FIRST );
+
+ if( pInitializedLink )
+ aInitializedLink = *pInitializedLink;
+
+ // the controller is asynchronously set
+ aLoadedTimer.SetTimeoutHdl(LINK(this, SwOneExampleFrame, TimeoutHdl));
+// aLoadedTimer.SetTimeout(500);
+ aLoadedTimer.SetTimeout(200);
+
+ rWin.Enable(sal_False);
+ CreateControl();
+
+ aTopWindow.Show();
+}
+
+/* -----------------------------08.12.99 13:44--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwOneExampleFrame::CreateErrorMessage(Window* pParent)
+{
+ if(SwOneExampleFrame::bShowServiceNotAvailableMessage)
+ {
+ String sInfo(SW_RES(STR_SERVICE_UNAVAILABLE));
+ sInfo += C2S(cFrameControl);
+ InfoBox(pParent, sInfo).Execute();
+ SwOneExampleFrame::bShowServiceNotAvailableMessage = sal_False;
+ }
+}
+/* -----------------27.07.99 15:26-------------------
+
+ --------------------------------------------------*/
+SwOneExampleFrame::~SwOneExampleFrame()
+{
+ DisposeControl();
+}
+/* -----------------------------21.12.00 10:16--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwOneExampleFrame::CreateControl()
+{
+ if(_xControl.is())
+ return ;
+ uno::Reference< lang::XMultiServiceFactory >
+ xMgr = comphelper::getProcessServiceFactory();
+ uno::Reference< uno::XInterface > xInst = xMgr->createInstance( C2U("com.sun.star.frame.FrameControl") );
+ _xControl = uno::Reference< awt::XControl >(xInst, uno::UNO_QUERY);
+ if(_xControl.is())
+ {
+ uno::Reference< awt::XWindowPeer > xParent( rWindow.GetComponentInterface() );
+
+ uno::Reference< awt::XToolkit > xToolkit( xMgr->createInstance( C2U("com.sun.star.awt.Toolkit") ), uno::UNO_QUERY );
+ if(xToolkit.is())
+ {
+ _xControl->createPeer( xToolkit, xParent );
+
+ uno::Reference< awt::XWindow > xWin( _xControl, uno::UNO_QUERY );
+ xWin->setVisible( sal_False );
+ Size aWinSize(rWindow.GetOutputSizePixel());
+ xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE );
+
+ uno::Reference< beans::XPropertySet > xPrSet(xInst, uno::UNO_QUERY);
+ uno::Any aURL;
+ //
+ // create new doc
+ String sTempURL = C2S(cFactory);
+ if(sArgumentURL.Len())
+ sTempURL = sArgumentURL;
+ aURL <<= OUString(sTempURL);
+
+ uno::Sequence<beans::PropertyValue> aSeq(3);
+ beans::PropertyValue* pValues = aSeq.getArray();
+ pValues[0].Name = C2U("ReadOnly");
+ BOOL bTrue = sal_True;
+ pValues[0].Value.setValue(&bTrue, ::getBooleanCppuType());
+ pValues[1].Name = C2U("OpenFlags");
+ pValues[1].Value <<= C2U("-RB");
+ pValues[2].Name = C2U("Referer");
+ pValues[2].Value <<= C2U("private:user");
+ uno::Any aArgs;
+ aArgs.setValue(&aSeq, ::getCppuType((uno::Sequence<beans::PropertyValue>*)0));
+
+ xPrSet->setPropertyValue( C2U("LoaderArguments"), aArgs );
+ //save and set readonly???
+
+ xPrSet->setPropertyValue(C2U("ComponentURL"), aURL);
+
+ aLoadedTimer.Start();
+ bServiceAvailable = sal_True;
+ }
+ }
+}
+
+
+/* -----------------------------21.12.00 10:16--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwOneExampleFrame::DisposeControl()
+{
+ _xCursor = 0;
+ if(_xControl.is())
+ _xControl->dispose();
+ _xControl = 0;
+ _xModel = 0;
+ _xController = 0;
+}
+/* -----------------27.07.99 15:26-------------------
+
+ --------------------------------------------------*/
+IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer )
+{
+ if(!_xControl.is())
+ return 0;
+
+ // now get the model
+ uno::Reference< beans::XPropertySet > xPrSet(_xControl, uno::UNO_QUERY);
+ uno::Any aFrame = xPrSet->getPropertyValue(C2U("Frame"));
+ uno::Reference< frame::XFrame > xFrm;
+ aFrame >>= xFrm;
+
+ uno::Reference< beans::XPropertySet > xPropSet( xFrm, uno::UNO_QUERY );
+ if ( xPropSet.is() )
+ {
+ try
+ {
+ uno::Reference< frame::XLayoutManager > xLayoutManager;
+ uno::Any aValue = xPropSet->getPropertyValue(C2U("LayoutManager"));
+ aValue >>= xLayoutManager;
+ if ( xLayoutManager.is() )
+ xLayoutManager->setVisible( sal_False );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+
+ _xController = xFrm->getController();
+ if(_xController.is())
+ {
+ _xModel = _xController->getModel();
+ //now the ViewOptions should be set properly
+ uno::Reference< view::XViewSettingsSupplier > xSettings(_xController, uno::UNO_QUERY);
+ uno::Reference< beans::XPropertySet > xViewProps = xSettings->getViewSettings();
+
+ sal_Bool bTrue = sal_True;
+ sal_Bool bFalse = sal_False;
+ uno::Any aTrueSet( &bTrue, ::getBooleanCppuType() );
+ uno::Any aFalseSet( &bFalse, ::getBooleanCppuType() );
+
+ if( !bIsInitialized )
+ {
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_BREAKS )), aFalseSet);
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_DRAWINGS )), aTrueSet);
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_FIELD_COMMANDS )), aFalseSet);
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_GRAPHICS )), aTrueSet);
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_HIDDEN_PARAGRAPHS )), aFalseSet);
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_HIDDEN_TEXT )), aFalseSet);
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_HORI_RULER )), aFalseSet);
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_PARA_BREAKS )), aFalseSet);
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_PROTECTED_SPACES )), aFalseSet);
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_SOFT_HYPHENS )), aFalseSet);
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_SPACES )), aFalseSet);
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_TABLES )), aTrueSet);
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_TABSTOPS )), aFalseSet);
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_VERT_RULER )), aFalseSet);
+
+ if(0 ==(nStyleFlags&EX_SHOW_ONLINE_LAYOUT))
+ {
+ uno::Any aZoom;
+ aZoom <<= (sal_Int16)view::DocumentZoomType::PAGE_WIDTH_EXACT;
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_TYPE)), aZoom);
+ }
+ else
+ {
+ uno::Any aZoom;
+ aZoom <<= (sal_Int16)view::DocumentZoomType::BY_VALUE;
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_TYPE)), aZoom);
+
+ sal_Int16 nZoomValue = 50;
+ if(EX_SHOW_BUSINESS_CARDS == nStyleFlags)
+ {
+ nZoomValue = 80;
+ }
+ aZoom <<= nZoomValue;
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_VALUE)), aZoom);
+ }
+ // set onlinelayout property behind setting the zoom
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_ONLINE_LAYOUT)),
+ (nStyleFlags&EX_SHOW_ONLINE_LAYOUT) ? aTrueSet : aFalseSet );
+ bIsInitialized = sal_True;
+ }
+
+ uno::Reference< text::XTextDocument > xDoc(_xModel, uno::UNO_QUERY);
+ uno::Reference< text::XText > xText = xDoc->getText();
+ _xCursor = xText->createTextCursor();
+ uno::Reference< beans::XPropertySet > xCrsrProp(_xCursor, uno::UNO_QUERY);
+ uno::Any aPageStyle = xCrsrProp->getPropertyValue(
+ C2U(SW_PROP_NAME_STR(UNO_NAME_PAGE_STYLE_NAME)));
+ OUString sPageStyle;
+ aPageStyle >>= sPageStyle;
+
+ uno::Reference< style::XStyleFamiliesSupplier > xSSupp( xDoc, uno::UNO_QUERY);
+ uno::Reference< container::XNameAccess > xStyles = xSSupp->getStyleFamilies();
+ uno::Any aPFamily = xStyles->getByName( C2U("PageStyles" ) );
+ uno::Reference< container::XNameContainer > xPFamily;
+
+ if( 0 == (EX_SHOW_DEFAULT_PAGE == nStyleFlags)
+ && (aPFamily >>= xPFamily) && sPageStyle.getLength() )
+ {
+ uno::Any aPStyle = xPFamily->getByName( sPageStyle );
+ uno::Reference< style::XStyle > xPStyle;
+ aPStyle >>= xPStyle;
+ uno::Reference< beans::XPropertySet > xPProp(xPStyle, uno::UNO_QUERY);
+ uno::Any aSize = xPProp->getPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SIZE)));
+ awt::Size aPSize;
+ aSize >>= aPSize;
+ //TODO: set page width to card width
+ aPSize.Width = 10000;
+ aSize.setValue(&aPSize, ::getCppuType((awt::Size*)0));
+ xPProp->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SIZE)), aSize);
+
+ uno::Any aZero; aZero <<= (sal_Int32)0;
+ xPProp->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_LEFT_MARGIN)), aZero);
+ xPProp->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_RIGHT_MARGIN)), aZero);
+ }
+
+ // can only be done here - the SFX changes the ScrollBar values
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_HORI_SCROLL_BAR )), aFalseSet);
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_SHOW_VERT_SCROLL_BAR )), aFalseSet);
+
+ if( aInitializedLink.IsSet() )
+ {
+ rWindow.Enable(sal_False, sal_True);
+ //rWindow.Enable(sal_True, sal_False);
+ aInitializedLink.Call(this);
+ }
+
+ uno::Reference< text::XTextViewCursorSupplier > xCrsrSupp(_xController, uno::UNO_QUERY);
+ uno::Reference< view::XScreenCursor > xScrCrsr(xCrsrSupp->getViewCursor(), uno::UNO_QUERY);
+ if(xScrCrsr.is())
+ xScrCrsr->screenUp();
+
+ uno::Reference< awt::XWindow > xWin( _xControl, uno::UNO_QUERY );
+ xWin->setVisible( sal_True );
+ rWindow.Show();
+
+ uno::Reference< lang::XUnoTunnel> xTunnel( _xCursor, uno::UNO_QUERY);
+ if( xTunnel.is() )
+ {
+ OTextCursorHelper* pCrsr = reinterpret_cast<OTextCursorHelper*>( xTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId() ));
+ if( pCrsr )
+ {
+ SwEditShell* pSh = pCrsr->GetDoc()->GetEditShell();
+ if( pSh->ActionCount() )
+ {
+ pSh->EndAllAction();
+ pSh->UnlockPaint();
+ }
+ }
+ }
+
+ SW_MOD()->SetView(pModuleView);
+ }
+ else
+ pTimer->Start();
+ return 0;
+}
+/* -----------------------------27.12.99 09:59--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwOneExampleFrame::ClearDocument( BOOL bStartUpdateTimer )
+{
+ uno::Reference< lang::XUnoTunnel> xTunnel( _xCursor, uno::UNO_QUERY);
+ if( xTunnel.is() )
+ {
+ OTextCursorHelper* pCrsr = reinterpret_cast<OTextCursorHelper*>(xTunnel->getSomething(
+ OTextCursorHelper::getUnoTunnelId()) );
+ if( pCrsr )
+ {
+ SwDoc* pDoc = pCrsr->GetDoc();
+ SwEditShell* pSh = pDoc->GetEditShell();
+ pSh->LockPaint();
+ pSh->StartAllAction();
+ pDoc->ClearDoc();
+
+ if( aLoadedTimer.IsActive() || !bStartUpdateTimer )
+ {
+ pSh->EndAllAction();
+ pSh->UnlockPaint();
+ }
+ if( bStartUpdateTimer )
+ aLoadedTimer.Start();
+ }
+ else
+ {
+ _xCursor->gotoStart(FALSE);
+ _xCursor->gotoEnd(TRUE);
+ _xCursor->setString(OUString());
+ }
+ }
+}
+/* -----------------------------15.12.99 11:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+static const sal_Int16 nZoomValues[] =
+{
+ 20,
+ 40,
+ 50,
+ 75,
+ 100
+};
+//---------------------------------------------------------------------------
+#define ITEM_UP 100
+#define ITEM_DOWN 200
+#define ITEM_ZOOM 300
+
+void SwOneExampleFrame::CreatePopup(const Point& rPt)
+{
+ PopupMenu aPop;
+ PopupMenu aSubPop1;
+ ResStringArray& rArr = aMenuRes.GetMenuArray();
+
+ aPop.InsertItem(ITEM_UP, rArr.GetString(rArr.FindIndex(ST_MENU_UP )));
+ aPop.InsertItem(ITEM_DOWN, rArr.GetString(rArr.FindIndex(ST_MENU_DOWN )));
+
+ Link aSelLk = LINK(this, SwOneExampleFrame, PopupHdl );
+ aPop.SetSelectHdl(aSelLk);
+ if(EX_SHOW_ONLINE_LAYOUT == nStyleFlags)
+ {
+ aPop.InsertItem(ITEM_ZOOM, rArr.GetString(rArr.FindIndex(ST_MENU_ZOOM )));
+
+ uno::Reference< view::XViewSettingsSupplier > xSettings(_xController, uno::UNO_QUERY);
+ uno::Reference< beans::XPropertySet > xViewProps = xSettings->getViewSettings();
+
+ uno::Any aZoom = xViewProps->getPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_VALUE)));
+ sal_Int16 nZoom = 0;
+ aZoom >>= nZoom;
+
+ for(sal_uInt16 i = 0; i < 5; i++ )
+ {
+ String sTemp;
+ sTemp = String::CreateFromInt32(nZoomValues[i]);
+ sTemp += String::CreateFromAscii(" %");
+ aSubPop1.InsertItem( ITEM_ZOOM + i + 1, sTemp);
+ if(nZoom == nZoomValues[i])
+ aSubPop1.CheckItem(ITEM_ZOOM + i + 1);
+ }
+ aPop.SetPopupMenu( ITEM_ZOOM, &aSubPop1 );
+ aSubPop1.SetSelectHdl(aSelLk);
+ }
+ aPop.Execute( &aTopWindow, rPt );
+
+}
+/* -----------------------------15.12.99 11:09--------------------------------
+
+ ---------------------------------------------------------------------------*/
+IMPL_LINK(SwOneExampleFrame, PopupHdl, Menu*, pMenu )
+{
+ sal_uInt16 nId = pMenu->GetCurItemId();
+ if( nId > ITEM_ZOOM && nId < ITEM_ZOOM + 100 )
+ {
+ sal_Int16 nZoom = nZoomValues[nId - ITEM_ZOOM - 1];
+ uno::Reference< view::XViewSettingsSupplier > xSettings(_xController, uno::UNO_QUERY);
+ uno::Reference< beans::XPropertySet > xViewProps = xSettings->getViewSettings();
+
+ uno::Any aZoom;
+ aZoom <<= nZoom;
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_VALUE)), aZoom);
+ aZoom <<= (sal_Int16)view::DocumentZoomType::BY_VALUE;
+ xViewProps->setPropertyValue(C2U(SW_PROP_NAME_STR(UNO_NAME_ZOOM_TYPE)), aZoom);
+ }
+ else if(ITEM_UP == nId || ITEM_DOWN == nId)
+ {
+ uno::Reference< text::XTextViewCursorSupplier > xCrsrSupp(_xController, uno::UNO_QUERY);
+ uno::Reference< view::XScreenCursor > xScrCrsr(xCrsrSupp->getViewCursor(), uno::UNO_QUERY);
+ if(ITEM_UP == nId)
+ xScrCrsr->screenUp();
+ else
+ xScrCrsr->screenDown();
+ }
+ return 0;
+};
+/* -----------------------------15.12.99 10:37--------------------------------
+
+ ---------------------------------------------------------------------------*/
+SwFrmCtrlWindow::SwFrmCtrlWindow(Window* pParent, WinBits nBits,
+ SwOneExampleFrame* pFrame) :
+ Window(pParent, nBits),
+ pExampleFrame(pFrame)
+{
+}
+/* -----------------------------15.12.99 09:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+void SwFrmCtrlWindow::Command( const CommandEvent& rCEvt )
+{
+ switch ( rCEvt.GetCommand() )
+ {
+ case COMMAND_CONTEXTMENU:
+ {
+ //#125881# quickly clicking crashes because the control is not fully initialized
+ if(pExampleFrame->GetController().is())
+ pExampleFrame->CreatePopup(rCEvt.GetMousePosPixel());
+ }
+ break;
+ case COMMAND_WHEEL:
+ case COMMAND_STARTAUTOSCROLL:
+ case COMMAND_AUTOSCROLL:
+ break;
+ default:;
+ }
+}
+/* -----------------------------15.12.99 12:57--------------------------------
+
+ ---------------------------------------------------------------------------*/
+MenuResource::MenuResource(const ResId& rResId) :
+ Resource(rResId),
+ aMenuArray(ResId(1,*rResId.GetResMgr()))
+{
+ FreeResource();
+}
+
diff --git a/sw/source/ui/utlui/unotools.hrc b/sw/source/ui/utlui/unotools.hrc
new file mode 100644
index 000000000000..d68577036830
--- /dev/null
+++ b/sw/source/ui/utlui/unotools.hrc
@@ -0,0 +1,41 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _UNOTOOLS_HRC
+#define _UNOTOOLS_HRC
+
+#define FT_NEW_NAME 1
+#define ED_NEW_NAME 2
+#define FL_NAME 3
+#define PB_OK 4
+#define PB_HELP 5
+#define PB_CANCEL 6
+
+#define ST_MENU_ZOOM 1
+#define ST_MENU_UP 2
+#define ST_MENU_DOWN 3
+
+#endif
diff --git a/sw/source/ui/utlui/unotools.src b/sw/source/ui/utlui/unotools.src
new file mode 100644
index 000000000000..ac203d035cd6
--- /dev/null
+++ b/sw/source/ui/utlui/unotools.src
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <unotools.hrc>
+#include <utlui.hrc>
+#include <globals.hrc>
+#include <helpid.h>
+
+ModalDialog DLG_RENAME_XNAMED
+{
+ HelpID = HID_RENAME_XNAMED ;
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 220 , 60 ) ;
+ Moveable = TRUE ;
+ FixedText FT_NEW_NAME
+ {
+ Pos = MAP_APPFONT ( 12 , 15 ) ;
+ Size = MAP_APPFONT ( 50 , 10 ) ;
+ Text [ en-US ] = "New name";
+ };
+ Edit ED_NEW_NAME
+ {
+ HelpID = "sw:Edit:DLG_RENAME_XNAMED:ED_NEW_NAME";
+ Pos = MAP_APPFONT ( 65 , 13 ) ;
+ Size = MAP_APPFONT ( 87 , 12 ) ;
+ Border = TRUE;
+ };
+ FixedLine FL_NAME
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 152 , 8 ) ;
+ Text [ en-US ] = "Change name";
+ };
+ OKButton PB_OK
+ {
+ Pos = MAP_APPFONT ( 164 , 6 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ DefButton = TRUE ;
+ };
+ CancelButton PB_CANCEL
+ {
+ Pos = MAP_APPFONT ( 164 , 23 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ HelpButton PB_HELP
+ {
+ Pos = MAP_APPFONT ( 164 , 43 ) ;
+ Size = MAP_APPFONT ( 50 , 14 ) ;
+ TabStop = TRUE ;
+ Group = TRUE ;
+ };
+ Text [ en-US ] = "Rename object: ";
+};
+String STR_SERVICE_UNAVAILABLE
+{
+ Text [ en-US ] = "The following service is not available: ";
+};
+Resource RES_FRMEX_MENU
+{
+ StringArray 1
+ {
+ ItemList [ en-US ] =
+ {
+ < "~Zoom" ; ST_MENU_ZOOM; > ;
+ < "~Upwards" ; ST_MENU_UP; > ;
+ < "Do~wnwards" ; ST_MENU_DOWN; > ;
+ };
+ };
+};
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/source/ui/utlui/utlui.src b/sw/source/ui/utlui/utlui.src
new file mode 100644
index 000000000000..dfa3e07f9053
--- /dev/null
+++ b/sw/source/ui/utlui/utlui.src
@@ -0,0 +1,478 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "globals.hrc"
+#include "utlui.hrc"
+#include "helpid.h"
+#include "comcore.hrc"
+
+
+Resource RID_SHELLRES_AUTOFMTSTRS
+{
+ String STR_AUTOFMTREDL_DEL_EMPTY_PARA+1
+ {
+ Text [ en-US ] = "Remove empty paragraphs" ;
+ };
+ String STR_AUTOFMTREDL_USE_REPLACE+1
+ {
+ Text [ en-US ] = "Use replacement table" ;
+ };
+ String STR_AUTOFMTREDL_CPTL_STT_WORD+1
+ {
+ Text [ en-US ] = "Correct TWo INitial CApitals" ;
+ };
+ String STR_AUTOFMTREDL_CPTL_STT_SENT+1
+ {
+ Text [ en-US ] = "Capitalize first letter of sentences" ;
+ };
+ String STR_AUTOFMTREDL_TYPO+1
+ {
+ Text [ en-US ] = "Replace \"standard\" quotes with %1 \bcustom%2 quotes" ;
+ };
+ String STR_AUTOFMTREDL_USER_STYLE+1
+ {
+ Text [ en-US ] = "Replace Custom Styles" ;
+ };
+ String STR_AUTOFMTREDL_BULLET+1
+ {
+ Text [ en-US ] = "Bullets replaced";
+ };
+ String STR_AUTOFMTREDL_UNDER+1
+ {
+ Text [ en-US ] = "Automatic _underline_";
+ };
+ String STR_AUTOFMTREDL_BOLD+1
+ {
+ Text [ en-US ] = "Automatic *bold*";
+ };
+ String STR_AUTOFMTREDL_FRACTION+1
+ {
+ Text [ en-US ] = "Replace 1/2 ... with ½ ..." ;
+ };
+ String STR_AUTOFMTREDL_DETECT_URL+1
+ {
+ Text [ en-US ] = "URL recognition" ;
+ };
+ String STR_AUTOFMTREDL_DASH+1
+ {
+ Text [ en-US ] = "Replace dashes" ;
+ };
+ String STR_AUTOFMTREDL_ORDINAL+1
+ {
+ Text [ en-US ] = "Replace 1st... with 1^st..." ;
+ };
+ String STR_AUTOFMTREDL_RIGHT_MARGIN+1
+ {
+ Text [ en-US ] = "Combine single line paragraphs";
+ };
+
+ String STR_AUTOFMTREDL_SET_TMPL_TEXT +1
+ {
+ Text [ en-US ] = "Set \"Text body\" Style";
+ };
+ String STR_AUTOFMTREDL_SET_TMPL_INDENT +1
+ {
+ Text [ en-US ] = "Set \"Text body indent\" Style";
+ };
+ String STR_AUTOFMTREDL_SET_TMPL_NEG_INDENT +1
+ {
+ Text [ en-US ] = "Set \"Hanging indent\" Style";
+ };
+ String STR_AUTOFMTREDL_SET_TMPL_TEXT_INDENT +1
+ {
+ Text [ en-US ] = "Set \"Text body indent\" Style";
+ };
+ String STR_AUTOFMTREDL_SET_TMPL_HEADLINE +1
+ {
+ Text [ en-US ] = "Set \"Heading $(ARG1)\" Style";
+ };
+ String STR_AUTOFMTREDL_SET_NUMBULET +1
+ {
+ Text [ en-US ] = "Set \"Bullet\" or \"Numbering\" Style";
+ };
+
+ String STR_AUTOFMTREDL_DEL_MORELINES +1
+ {
+ Text [ en-US ] = "Combine paragraphs";
+ };
+ String STR_AUTOFMTREDL_NON_BREAK_SPACE +1
+ {
+ Text [ en-US ] = "Add non breaking space";
+ };
+
+};
+
+/*---------------------------------------------------------------------
+ Diverses
+ ---------------------------------------------------------------------*/
+String STR_EVENT_OBJECT_SELECT
+{
+ Text [ en-US ] = "Click object" ;
+};
+String STR_EVENT_START_INS_GLOSSARY
+{
+ Text [ en-US ] = "Before inserting AutoText";
+};
+String STR_EVENT_END_INS_GLOSSARY
+{
+ Text [ en-US ] = "After inserting AutoText";
+};
+String STR_EVENT_MOUSEOVER_OBJECT
+{
+ Text [ en-US ] = "Mouse over object" ;
+};
+String STR_EVENT_MOUSECLICK_OBJECT
+{
+ Text [ en-US ] = "Trigger hyperlink" ;
+};
+String STR_EVENT_MOUSEOUT_OBJECT
+{
+ Text [ en-US ] = "Mouse leaves object" ;
+};
+String STR_EVENT_IMAGE_LOAD
+{
+ Text [ en-US ] = "Graphics load successful" ;
+};
+String STR_EVENT_IMAGE_ABORT
+{
+ Text [ en-US ] = "Graphics load terminated" ;
+};
+String STR_EVENT_IMAGE_ERROR
+{
+ Text [ en-US ] = "Graphics load faulty" ;
+};
+String STR_EVENT_FRM_KEYINPUT_A
+{
+ Text [ en-US ] = "Input of alphanumeric characters" ;
+};
+String STR_EVENT_FRM_KEYINPUT_NOA
+{
+ Text [ en-US ] = "Input of non-alphanumeric characters" ;
+};
+String STR_EVENT_FRM_RESIZE
+{
+ Text [ en-US ] = "Resize frame" ;
+};
+String STR_EVENT_FRM_MOVE
+{
+ Text [ en-US ] = "Move frame" ;
+};
+String STR_CONTENT_TYPE_OUTLINE
+{
+ Text [ en-US ] = "Headings" ;
+};
+String STR_CONTENT_TYPE_TABLE
+{
+ Text [ en-US ] = "Tables" ;
+};
+String STR_CONTENT_TYPE_FRAME
+{
+ Text [ en-US ] = "Text frames" ;
+};
+String STR_CONTENT_TYPE_GRAPHIC
+{
+ Text [ en-US ] = "Graphics" ;
+};
+String STR_CONTENT_TYPE_OLE
+{
+ Text [ en-US ] = "OLE objects" ;
+};
+String STR_CONTENT_TYPE_BOOKMARK
+{
+ Text [ en-US ] = "Bookmarks" ;
+};
+String STR_CONTENT_TYPE_REGION
+{
+ Text [ en-US ] = "Sections" ;
+};
+String STR_CONTENT_TYPE_URLFIELD
+{
+ Text [ en-US ] = "Hyperlinks" ;
+};
+String STR_CONTENT_TYPE_REFERENCE
+{
+ Text [ en-US ] = "References" ;
+};
+String STR_CONTENT_TYPE_INDEX
+{
+ Text [ en-US ] = "Indexes" ;
+};
+String STR_CONTENT_TYPE_DRAWOBJECT
+{
+ Text [ en-US ] = "Draw objects" ;
+};
+String STR_CONTENT_TYPE_POSTIT
+{
+ Text [ en-US ] = "Comments" ;
+};
+String STR_CONTENT_TYPE_SINGLE_OUTLINE
+{
+ Text [ en-US ] = "Heading" ;
+};
+String STR_CONTENT_TYPE_SINGLE_TABLE
+{
+ Text [ en-US ] = "Table" ;
+};
+String STR_CONTENT_TYPE_SINGLE_FRAME
+{
+ Text [ en-US ] = "Text frame" ;
+};
+String STR_CONTENT_TYPE_SINGLE_GRAPHIC
+{
+ Text [ en-US ] = "Graphics" ;
+};
+String STR_CONTENT_TYPE_SINGLE_OLE
+{
+ Text [ en-US ] = "OLE object" ;
+};
+String STR_CONTENT_TYPE_SINGLE_BOOKMARK
+{
+ Text [ en-US ] = "Bookmark" ;
+};
+String STR_CONTENT_TYPE_SINGLE_REGION
+{
+ Text [ en-US ] = "Section" ;
+};
+String STR_CONTENT_TYPE_SINGLE_URLFIELD
+{
+ Text [ en-US ] = "Hyperlink" ;
+};
+String STR_CONTENT_TYPE_SINGLE_REFERENCE
+{
+ Text [ en-US ] = "Reference" ;
+};
+String STR_CONTENT_TYPE_SINGLE_INDEX
+{
+ Text [ en-US ] = "Index" ;
+};
+String STR_CONTENT_TYPE_SINGLE_POSTIT
+{
+ Text [ en-US ] = "Comment" ;
+};
+String STR_CONTENT_TYPE_SINGLE_DRAWOBJECT
+{
+ Text [ en-US ] = "Draw object" ;
+};
+String STR_DEFINE_NUMBERFORMAT
+{
+ Text [ en-US ] = "Additional formats..." ;
+};
+String RID_STR_SYSTEM
+{
+ Text [ en-US ] = "[System]";
+};
+String STR_MULT_INTERACT_SPELL_WARN
+{
+ Text [ en-US ] = "The interactive spellcheck is already active\nin a different document";
+};
+String STR_MULT_INTERACT_HYPH_WARN
+{
+ Text [ en-US ] = "The interactive hyphenation is already active\nin a different document";
+};
+String STR_SPELL_TITLE
+{
+ Text [ en-US ] = "Spellcheck";
+};
+String STR_HYPH_TITLE
+{
+ Text [ en-US ] = "Hyphenation";
+};
+
+#define IMGLIST_IDS\
+ IdList = \
+ { \
+ IMG_COLLAPSE;\
+ IMG_EXPAND ;\
+ IMG_DB ;\
+ IMG_DBTABLE ;\
+ IMG_DBQUERY ;\
+ }; \
+ IdCount = 5
+
+ImageList ILIST_DB_DLG
+{
+ Prefix = "sx";
+ MaskColor = IMAGE_MASK_COLOR;
+ IMGLIST_IDS;
+};
+
+ImageList ILIST_DB_DLG_HC
+{
+ Prefix = "sxh";
+ MaskColor = IMAGE_MASK_COLOR ;
+ IMGLIST_IDS;
+};
+
+Image IMG_ONE_LEFT_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "one_left_h.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR ;
+};
+
+Image IMG_ONE_RIGHT_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "one_right_h.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR ;
+};
+
+Image IMG_ALL_LEFT_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "all_left_h.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR ;
+};
+
+Image IMG_ALL_RIGHT_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "all_right_h.bmp" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR ;
+};
+
+
+Image IMG_VIEWLAYOUT_AUTOMATIC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "twopages_11x25.png" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR;
+};
+Image IMG_VIEWLAYOUT_AUTOMATIC_ACTIVE
+{
+ ImageBitmap = Bitmap
+ {
+ File = "twopages_a_11x25.png" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR;
+};
+
+Image IMG_VIEWLAYOUT_BOOKMODE
+{
+ ImageBitmap = Bitmap
+ {
+ File = "doublepage_11x23.png" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR;
+};
+Image IMG_VIEWLAYOUT_BOOKMODE_ACTIVE
+{
+ ImageBitmap = Bitmap
+ {
+ File = "doublepage_a_11x23.png" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR;
+};
+
+Image IMG_VIEWLAYOUT_SINGLECOLUMN
+{
+ ImageBitmap = Bitmap
+ {
+ File = "emptypage_11x15.png" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR;
+};
+Image IMG_VIEWLAYOUT_SINGLECOLUMN_ACTIVE
+{
+ ImageBitmap = Bitmap
+ {
+ File = "emptypage_a_11x15.png" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR;
+};
+
+Image IMG_VIEWLAYOUT_AUTOMATIC_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "twopages_11x25_h.png" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR;
+};
+Image IMG_VIEWLAYOUT_AUTOMATIC_ACTIVE_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "twopages_a_11x25_h.png" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR;
+};
+
+Image IMG_VIEWLAYOUT_BOOKMODE_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "doublepage_11x23_h.png" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR;
+};
+Image IMG_VIEWLAYOUT_BOOKMODE_ACTIVE_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "doublepage_a_11x23_h.png" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR;
+};
+Image IMG_VIEWLAYOUT_SINGLECOLUMN_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "emptypage_11x15_h.png" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR;
+};
+Image IMG_VIEWLAYOUT_SINGLECOLUMN_ACTIVE_HC
+{
+ ImageBitmap = Bitmap
+ {
+ File = "emptypage_a_11x15_h.png" ;
+ };
+ MaskColor = IMAGE_MASK_COLOR;
+};
+
+
+
+String STR_HYPERCTRL_SEL
+{
+ Text [ en-US ] = "SEL";
+};
+String STR_HYPERCTRL_HYP
+{
+ Text [ en-US ] = "HYP";
+};
+
diff --git a/sw/source/ui/utlui/viewlayoutctrl.cxx b/sw/source/ui/utlui/viewlayoutctrl.cxx
new file mode 100644
index 000000000000..dbee2286731a
--- /dev/null
+++ b/sw/source/ui/utlui/viewlayoutctrl.cxx
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+// include ---------------------------------------------------------------
+#include <viewlayoutctrl.hxx>
+
+#ifndef _STATUS_HXX //autogen
+#include <vcl/status.hxx>
+#endif
+#include <vcl/image.hxx>
+#include <svl/eitem.hxx>
+#include <svx/viewlayoutitem.hxx>
+#ifndef _UTLUI_HRC
+#include <utlui.hrc>
+#endif
+#include <swtypes.hxx> // fuer Pathfinder
+
+// STATIC DATA -----------------------------------------------------------
+
+SFX_IMPL_STATUSBAR_CONTROL( SwViewLayoutControl, SvxViewLayoutItem );
+
+// -----------------------------------------------------------------------
+
+const long nImageWidthSingle = 15;
+const long nImageWidthAuto = 25;
+const long nImageWidthBook = 23;
+const long nImageWidthSum = 63;
+const long nImageHeight = 11;
+
+// -----------------------------------------------------------------------
+
+struct SwViewLayoutControl::SwViewLayoutControl_Impl
+{
+ USHORT mnState; // 0 = single, 1 = auto, 2 = book, 3 = none
+ Image maImageSingleColumn;
+ Image maImageSingleColumn_Active;
+ Image maImageAutomatic;
+ Image maImageAutomatic_Active;
+ Image maImageBookMode;
+ Image maImageBookMode_Active;
+};
+
+// class SwViewLayoutControl ------------------------------------------
+
+SwViewLayoutControl::SwViewLayoutControl( USHORT _nSlotId, USHORT _nId, StatusBar& rStb ) :
+ SfxStatusBarControl( _nSlotId, _nId, rStb ),
+ mpImpl( new SwViewLayoutControl_Impl )
+{
+ mpImpl->mnState = 0;
+
+ const sal_Bool bHC = GetStatusBar().GetSettings().GetStyleSettings().GetHighContrastMode();
+ mpImpl->maImageSingleColumn = Image( bHC ? SW_RES(IMG_VIEWLAYOUT_SINGLECOLUMN_HC) : SW_RES(IMG_VIEWLAYOUT_SINGLECOLUMN) );
+ mpImpl->maImageSingleColumn_Active = Image( bHC ? SW_RES(IMG_VIEWLAYOUT_SINGLECOLUMN_ACTIVE_HC) : SW_RES(IMG_VIEWLAYOUT_SINGLECOLUMN_ACTIVE) );
+ mpImpl->maImageAutomatic = Image( bHC ? SW_RES(IMG_VIEWLAYOUT_AUTOMATIC_HC) : SW_RES(IMG_VIEWLAYOUT_AUTOMATIC) );
+ mpImpl->maImageAutomatic_Active = Image( bHC ? SW_RES(IMG_VIEWLAYOUT_AUTOMATIC_ACTIVE_HC) : SW_RES(IMG_VIEWLAYOUT_AUTOMATIC_ACTIVE) );
+ mpImpl->maImageBookMode = Image( bHC ? SW_RES(IMG_VIEWLAYOUT_BOOKMODE_HC) : SW_RES(IMG_VIEWLAYOUT_BOOKMODE) );
+ mpImpl->maImageBookMode_Active = Image( bHC ? SW_RES(IMG_VIEWLAYOUT_BOOKMODE_ACTIVE_HC) : SW_RES(IMG_VIEWLAYOUT_BOOKMODE_ACTIVE) );
+}
+
+// -----------------------------------------------------------------------
+
+SwViewLayoutControl::~SwViewLayoutControl()
+{
+ delete mpImpl;
+}
+
+// -----------------------------------------------------------------------
+
+void SwViewLayoutControl::StateChanged( USHORT /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
+{
+ if ( SFX_ITEM_AVAILABLE != eState || pState->ISA( SfxVoidItem ) )
+ GetStatusBar().SetItemText( GetId(), String() );
+ else
+ {
+ DBG_ASSERT( pState->ISA( SvxViewLayoutItem ), "invalid item type" );
+ const USHORT nColumns = static_cast<const SvxViewLayoutItem*>( pState )->GetValue();
+ const bool bBookMode = static_cast<const SvxViewLayoutItem*>( pState )->IsBookMode();
+
+ // SingleColumn Mode
+ if ( 1 == nColumns )
+ mpImpl->mnState = 0;
+ // Automatic Mode
+ else if ( 0 == nColumns )
+ mpImpl->mnState = 1;
+ // Book Mode
+ else if ( bBookMode && 2 == nColumns )
+ mpImpl->mnState = 2;
+ else
+ mpImpl->mnState = 3;
+ }
+
+ if ( GetStatusBar().AreItemsVisible() )
+ GetStatusBar().SetItemData( GetId(), 0 ); // force repaint
+}
+
+// -----------------------------------------------------------------------
+
+void SwViewLayoutControl::Paint( const UserDrawEvent& rUsrEvt )
+{
+ OutputDevice* pDev = rUsrEvt.GetDevice();
+ Rectangle aRect = rUsrEvt.GetRect();
+ Color aOldLineColor = pDev->GetLineColor();
+ Color aOldFillColor = pDev->GetFillColor();
+
+ //pDev->SetLineColor();
+ //pDev->SetFillColor( pDev->GetBackground().GetColor() );
+
+ const bool bSingleColumn = 0 == mpImpl->mnState;
+ const bool bAutomatic = 1 == mpImpl->mnState;
+ const bool bBookMode = 2 == mpImpl->mnState;
+
+ const long nXOffset = (aRect.GetWidth() - nImageWidthSum)/2;
+ const long nYOffset = (aRect.GetHeight() - nImageHeight)/2;
+
+ aRect.Left() = aRect.Left() + nXOffset;
+ aRect.Top() = aRect.Top() + nYOffset;
+
+ // draw single column image:
+ pDev->DrawImage( aRect.TopLeft(), bSingleColumn ? mpImpl->maImageSingleColumn_Active : mpImpl->maImageSingleColumn );
+
+ // draw automatic image:
+ aRect.Left() += nImageWidthSingle;
+ pDev->DrawImage( aRect.TopLeft(), bAutomatic ? mpImpl->maImageAutomatic_Active : mpImpl->maImageAutomatic );
+
+ // draw bookmode image:
+ aRect.Left() += nImageWidthAuto;
+ pDev->DrawImage( aRect.TopLeft(), bBookMode ? mpImpl->maImageBookMode_Active : mpImpl->maImageBookMode );
+
+ // draw separators
+ //aRect = rUsrEvt.GetRect();
+ //aRect.Left() += nImageWidth;
+ //aRect.setWidth( 1 );
+ //pDev->DrawRect( aRect );
+ //aRect.Left() += nImageWidth;
+ //pDev->DrawRect( aRect );
+
+ //pDev->SetLineColor( aOldLineColor );
+ //pDev->SetFillColor( aOldFillColor );
+}
+
+BOOL SwViewLayoutControl::MouseButtonDown( const MouseEvent & rEvt )
+{
+ const Rectangle aRect = getControlRect();
+ const Point aPoint = rEvt.GetPosPixel();
+ const long nXDiff = aPoint.X() - aRect.Left();
+
+ USHORT nColumns = 1;
+ bool bBookMode = false;
+
+ const long nXOffset = (aRect.GetWidth() - nImageWidthSum)/2;
+
+ if ( nXDiff < nXOffset + nImageWidthSingle )
+ {
+ mpImpl->mnState = 0; // single
+ nColumns = 1;
+ }
+ else if ( nXDiff < nXOffset + nImageWidthSingle + nImageWidthAuto )
+ {
+ mpImpl->mnState = 1; // auto
+ nColumns = 0;
+ }
+ else
+ {
+ mpImpl->mnState = 2; // book
+ nColumns = 2;
+ bBookMode = true;
+ }
+
+ // commit state change
+ SvxViewLayoutItem aViewLayout( nColumns, bBookMode );
+
+ ::com::sun::star::uno::Any a;
+ aViewLayout.QueryValue( a );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
+ aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ViewLayout" ));
+ aArgs[0].Value = a;
+
+ execute( aArgs );
+
+ return TRUE;
+}
diff --git a/sw/source/ui/utlui/zoomctrl.cxx b/sw/source/ui/utlui/zoomctrl.cxx
new file mode 100644
index 000000000000..48cf53b6263a
--- /dev/null
+++ b/sw/source/ui/utlui/zoomctrl.cxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include "hintids.hxx"
+
+#ifndef _STATUS_HXX //autogen
+#include <vcl/status.hxx>
+#endif
+#include <sfx2/app.hxx>
+#include <svl/stritem.hxx>
+#include <svx/zoomitem.hxx>
+
+#include "swtypes.hxx"
+#include "zoomctrl.hxx"
+
+
+SFX_IMPL_STATUSBAR_CONTROL( SwZoomControl, SvxZoomItem );
+
+
+SwZoomControl::SwZoomControl( USHORT _nSlotId,
+ USHORT _nId,
+ StatusBar& rStb ) :
+ SvxZoomStatusBarControl( _nSlotId, _nId, rStb )
+{
+}
+
+// -----------------------------------------------------------------------
+
+SwZoomControl::~SwZoomControl()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void SwZoomControl::StateChanged( USHORT nSID, SfxItemState eState,
+ const SfxPoolItem* pState )
+{
+ if(SFX_ITEM_AVAILABLE == eState && pState->ISA( SfxStringItem ))
+ {
+ sPreviewZoom = ((const SfxStringItem*)pState)->GetValue();
+ GetStatusBar().SetItemText( GetId(), sPreviewZoom );
+ }
+ else
+ {
+ sPreviewZoom = aEmptyStr;
+ SvxZoomStatusBarControl::StateChanged(nSID, eState, pState);
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SwZoomControl::Paint( const UserDrawEvent& rUsrEvt )
+{
+ if(!sPreviewZoom.Len())
+ SvxZoomStatusBarControl::Paint(rUsrEvt);
+ else
+ GetStatusBar().SetItemText( GetId(), sPreviewZoom );
+}
+
+// -----------------------------------------------------------------------
+
+void SwZoomControl::Command( const CommandEvent& rCEvt )
+{
+ if(!sPreviewZoom.Len())
+ SvxZoomStatusBarControl::Command(rCEvt);
+}
+
+
+
+
diff --git a/sw/source/ui/vba/service.cxx b/sw/source/ui/vba/service.cxx
new file mode 100644
index 000000000000..bff007751562
--- /dev/null
+++ b/sw/source/ui/vba/service.cxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "cppuhelper/implementationentry.hxx"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/registry/XRegistryKey.hpp"
+#include "comphelper/servicedecl.hxx"
+
+// =============================================================================
+// component exports
+// =============================================================================
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+namespace sdecl = comphelper::service_decl;
+
+namespace globals
+{
+extern sdecl::ServiceDecl const serviceDecl;
+}
+
+namespace document
+{
+extern sdecl::ServiceDecl const serviceDecl;
+}
+
+namespace wrapformat
+{
+extern sdecl::ServiceDecl const serviceDecl;
+}
+
+namespace vbaeventshelper
+{
+extern sdecl::ServiceDecl const serviceDecl;
+}
+
+extern "C"
+{
+ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
+ {
+ OSL_TRACE("In component_getImplementationEnv");
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+ }
+
+ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
+ registry::XRegistryKey * pRegistryKey )
+ {
+ OSL_TRACE("In component_getFactory for %s", pImplName );
+ void* pRet = component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl, vbaeventshelper::serviceDecl );
+ OSL_TRACE("Ret is 0x%x", pRet);
+ return pRet;
+ }
+}
+
diff --git a/sw/source/ui/vba/vbaaddin.cxx b/sw/source/ui/vba/vbaaddin.cxx
new file mode 100644
index 000000000000..8929ae96a914
--- /dev/null
+++ b/sw/source/ui/vba/vbaaddin.cxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbaaddin.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/urlobj.hxx>
+#include <osl/file.hxx>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaAddin::SwVbaAddin( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const rtl::OUString& rFileURL, sal_Bool bAutoload ) throw ( uno::RuntimeException ) :
+ SwVbaAddin_BASE( rParent, rContext ), msFileURL( rFileURL ), mbAutoload( bAutoload ), mbInstalled( bAutoload )
+{
+}
+
+SwVbaAddin::~SwVbaAddin()
+{
+}
+
+::rtl::OUString SAL_CALL SwVbaAddin::getName() throw (uno::RuntimeException)
+{
+ rtl::OUString sName;
+ INetURLObject aURL( msFileURL );
+ ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName );
+ return sName;
+}
+
+void SAL_CALL
+SwVbaAddin::setName( const rtl::OUString& ) throw ( css::uno::RuntimeException )
+{
+ throw uno::RuntimeException( rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(" Fail to set name")), uno::Reference< uno::XInterface >() );
+}
+
+::rtl::OUString SAL_CALL SwVbaAddin::getPath() throw (uno::RuntimeException)
+{
+ INetURLObject aURL( msFileURL );
+ aURL.CutLastName();
+ return aURL.GetURLPath();
+}
+
+::sal_Bool SAL_CALL SwVbaAddin::getAutoload() throw (uno::RuntimeException)
+{
+ return mbAutoload;
+}
+
+::sal_Bool SAL_CALL SwVbaAddin::getInstalled() throw (uno::RuntimeException)
+{
+ return mbInstalled;
+}
+
+void SAL_CALL SwVbaAddin::setInstalled( ::sal_Bool _installed ) throw (uno::RuntimeException)
+{
+ if( _installed != mbInstalled )
+ {
+ mbInstalled = _installed;
+ // TODO: should call AutoExec and AutoExit etc.
+ }
+}
+
+rtl::OUString&
+SwVbaAddin::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAddin") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaAddin::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Addin" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbaaddin.hxx b/sw/source/ui/vba/vbaaddin.hxx
new file mode 100644
index 000000000000..090f5bcc580f
--- /dev/null
+++ b/sw/source/ui/vba/vbaaddin.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_ADDIN_HXX
+#define SW_VBA_ADDIN_HXX
+
+#include <ooo/vba/word/XAddin.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XAddin > SwVbaAddin_BASE;
+
+class SwVbaAddin : public SwVbaAddin_BASE
+{
+private:
+ rtl::OUString msFileURL;
+ sal_Bool mbAutoload;
+ sal_Bool mbInstalled;
+
+public:
+ SwVbaAddin( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const rtl::OUString& rFileURL, sal_Bool bAutoload ) throw ( css::uno::RuntimeException );
+ virtual ~SwVbaAddin();
+
+ // Attributes
+ virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getAutoload() throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getInstalled() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setInstalled( ::sal_Bool _installed ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_ADDIN_HXX */
diff --git a/sw/source/ui/vba/vbaaddins.cxx b/sw/source/ui/vba/vbaaddins.cxx
new file mode 100644
index 000000000000..f51e11e359b0
--- /dev/null
+++ b/sw/source/ui/vba/vbaaddins.cxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbaaddins.hxx"
+#include "vbaaddin.hxx"
+#include <cppuhelper/implbase3.hxx>
+#include <unotools/pathoptions.hxx>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+uno::Reference< container::XIndexAccess > lcl_getAddinCollection( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext )
+{
+ XNamedObjectCollectionHelper< word::XAddin >::XNamedVec maAddins;
+
+ // first get the autoload addins in the directory STARTUP
+ uno::Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager(), uno::UNO_QUERY_THROW );
+ uno::Reference< ucb::XSimpleFileAccess > xSFA( xMCF->createInstanceWithContext( rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), xContext), uno::UNO_QUERY_THROW );
+ SvtPathOptions aPathOpt;
+ // FIXME: temporary the STARTUP path is located in $OO/basic3.1/program/addin
+ String aAddinPath = aPathOpt.GetAddinPath();
+ OSL_TRACE("lcl_getAddinCollection: %s", rtl::OUStringToOString( aAddinPath, RTL_TEXTENCODING_UTF8 ).getStr() );
+ if( xSFA->isFolder( aAddinPath ) )
+ {
+ uno::Sequence< rtl::OUString > sEntries = xSFA->getFolderContents( aAddinPath, sal_False );
+ sal_Int32 nEntry = sEntries.getLength();
+ for( sal_Int32 index = 0; index < nEntry; ++index )
+ {
+ rtl::OUString sUrl = sEntries[ index ];
+ if( !xSFA->isFolder( sUrl ) && sUrl.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) )
+ {
+ maAddins.push_back( uno::Reference< word::XAddin >( new SwVbaAddin( xParent, xContext, sUrl, sal_True ) ) );
+ }
+ }
+ }
+
+ // TODO: second get the customize addins in the org.openoffice.Office.Writer/GlobalTemplateList
+
+ uno::Reference< container::XIndexAccess > xAddinsAccess( new XNamedObjectCollectionHelper< word::XAddin >( maAddins ) );
+ return xAddinsAccess;
+}
+
+SwVbaAddins::SwVbaAddins( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext ) throw (uno::RuntimeException): SwVbaAddins_BASE( xParent, xContext, lcl_getAddinCollection( xParent,xContext ) )
+{
+}
+// XEnumerationAccess
+uno::Type
+SwVbaAddins::getElementType() throw (uno::RuntimeException)
+{
+ return word::XAddin::static_type(0);
+}
+uno::Reference< container::XEnumeration >
+SwVbaAddins::createEnumeration() throw (uno::RuntimeException)
+{
+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
+ return xEnumerationAccess->createEnumeration();
+}
+
+uno::Any
+SwVbaAddins::createCollectionObject( const css::uno::Any& aSource )
+{
+ return aSource;
+}
+
+rtl::OUString&
+SwVbaAddins::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAddins") );
+ return sImplName;
+}
+
+css::uno::Sequence<rtl::OUString>
+SwVbaAddins::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > sNames;
+ if ( sNames.getLength() == 0 )
+ {
+ sNames.realloc( 1 );
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Addins") );
+ }
+ return sNames;
+}
diff --git a/sw/source/ui/vba/vbaaddins.hxx b/sw/source/ui/vba/vbaaddins.hxx
new file mode 100644
index 000000000000..6d160f78e27b
--- /dev/null
+++ b/sw/source/ui/vba/vbaaddins.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_ADDINS_HXX
+#define SW_VBA_ADDINS_HXX
+
+#include <vbahelper/vbacollectionimpl.hxx>
+#include <ooo/vba/word/XAddins.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+
+typedef CollTestImplHelper< ooo::vba::word::XAddins > SwVbaAddins_BASE;
+
+class SwVbaAddins : public SwVbaAddins_BASE
+{
+public:
+ SwVbaAddins( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext ) throw (css::uno::RuntimeException);
+ virtual ~SwVbaAddins() {}
+
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+
+ // SwVbaAddins_BASE
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif /* SW_VBA_ADDINS_HXX */
diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx
new file mode 100644
index 000000000000..8056f9ae3deb
--- /dev/null
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <stdio.h>
+#include "vbaapplication.hxx"
+#include "vbadocument.hxx"
+#include <osl/file.hxx>
+#include <vbahelper/vbahelper.hxx>
+#include "vbawindow.hxx"
+#include "vbasystem.hxx"
+#include "vbaoptions.hxx"
+#include "vbaselection.hxx"
+#include "vbadocuments.hxx"
+#include "vbaaddins.hxx"
+#include "vbadialogs.hxx"
+#include <ooo/vba/word/WdEnableCancelKey.hpp>
+#include <editeng/acorrcfg.hxx>
+#include "wordvbahelper.hxx"
+#include <docsh.hxx>
+
+using namespace ::ooo;
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::rtl::OUString;
+
+// Enable our own join detection for Intersection and Union
+// should be more efficient than using ScRangeList::Join ( because
+// we already are testing the same things )
+
+#define OWN_JOIN 1
+
+// #TODO is this defined somewhere else?
+#if ( defined UNX ) || ( defined OS2 ) //unix
+#define FILE_PATH_SEPERATOR "/"
+#else // windows
+#define FILE_PATH_SEPERATOR "\\"
+#endif
+
+#define EXCELVERSION "11.0"
+
+uno::Any sbxToUnoValue( SbxVariable* pVar );
+
+SwVbaApplication::SwVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): SwVbaApplication_BASE( xContext )
+{
+}
+
+SwVbaApplication::~SwVbaApplication()
+{
+}
+
+SfxObjectShell* SwVbaApplication::GetDocShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
+{
+ return static_cast< SfxObjectShell* >( word::getDocShell( xModel ) );
+}
+
+rtl::OUString SAL_CALL
+SwVbaApplication::getName() throw (uno::RuntimeException)
+{
+ static rtl::OUString appName( RTL_CONSTASCII_USTRINGPARAM("Microsoft Word" ) );
+ return appName;
+}
+
+uno::Reference< word::XDocument > SAL_CALL
+SwVbaApplication::getActiveDocument() throw (uno::RuntimeException)
+{
+ return new SwVbaDocument( this, mxContext, getCurrentDocument() );
+}
+
+uno::Reference< word::XWindow > SAL_CALL
+SwVbaApplication::getActiveWindow() throw (uno::RuntimeException)
+{
+ // #FIXME sofar can't determine Parent
+ return new SwVbaWindow( uno::Reference< XHelperInterface >(), mxContext, getCurrentDocument() );
+}
+
+uno::Reference<word::XSystem > SAL_CALL
+SwVbaApplication::getSystem() throw (uno::RuntimeException)
+{
+ return uno::Reference< word::XSystem >( new SwVbaSystem( mxContext ) );
+}
+
+uno::Reference<word::XOptions > SAL_CALL
+SwVbaApplication::getOptions() throw (uno::RuntimeException)
+{
+ return uno::Reference< word::XOptions >( new SwVbaOptions( mxContext ) );
+}
+
+uno::Any SAL_CALL
+SwVbaApplication::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
+{
+ return VbaApplicationBase::CommandBars( aIndex );
+}
+
+uno::Reference< word::XSelection > SAL_CALL
+SwVbaApplication::getSelection() throw (uno::RuntimeException)
+{
+ return new SwVbaSelection( this, mxContext, getCurrentDocument() );
+}
+
+uno::Any SAL_CALL
+SwVbaApplication::Documents( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ uno::Reference< XCollection > xCol( new SwVbaDocuments( this, mxContext ) );
+ if ( index.hasValue() )
+ return xCol->Item( index, uno::Any() );
+ return uno::makeAny( xCol );
+}
+
+uno::Any SAL_CALL
+SwVbaApplication::Addins( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ static uno::Reference< XCollection > xCol( new SwVbaAddins( this, mxContext ) );
+ if ( index.hasValue() )
+ return xCol->Item( index, uno::Any() );
+ return uno::makeAny( xCol );
+}
+
+uno::Any SAL_CALL
+SwVbaApplication::Dialogs( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ uno::Reference< word::XDialogs > xCol( new SwVbaDialogs( this, mxContext, getCurrentDocument() ));
+ if ( index.hasValue() )
+ return xCol->Item( index );
+ return uno::makeAny( xCol );
+}
+
+sal_Bool SAL_CALL SwVbaApplication::getDisplayAutoCompleteTips() throw (css::uno::RuntimeException)
+{
+ return SvxAutoCorrCfg::Get()->IsAutoTextTip();
+}
+
+void SAL_CALL SwVbaApplication::setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) throw (css::uno::RuntimeException)
+{
+ SvxAutoCorrCfg::Get()->SetAutoTextTip( _displayAutoCompleteTips );
+}
+
+sal_Int32 SAL_CALL SwVbaApplication::getEnableCancelKey() throw (css::uno::RuntimeException)
+{
+ // the default value is wdCancelInterrupt in Word
+ return word::WdEnableCancelKey::wdCancelInterrupt;
+}
+
+void SAL_CALL SwVbaApplication::setEnableCancelKey( sal_Int32/* _enableCancelKey */) throw (css::uno::RuntimeException)
+{
+ // seems not supported in Writer
+}
+
+float SAL_CALL SwVbaApplication::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException)
+{
+ return VbaApplicationBase::CentimetersToPoints( _Centimeters );
+}
+
+uno::Reference< frame::XModel >
+SwVbaApplication::getCurrentDocument() throw (css::uno::RuntimeException)
+{
+ return getCurrentWordDoc( mxContext );
+}
+
+rtl::OUString&
+SwVbaApplication::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaApplication") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaApplication::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Application" ) );
+ }
+ return aServiceNames;
+}
diff --git a/sw/source/ui/vba/vbaapplication.hxx b/sw/source/ui/vba/vbaapplication.hxx
new file mode 100644
index 000000000000..1261590d7c56
--- /dev/null
+++ b/sw/source/ui/vba/vbaapplication.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_APPLICATION_HXX
+#define SW_VBA_APPLICATION_HXX
+
+#include <ooo/vba/word/XApplication.hpp>
+#include <ooo/vba/word/XDocument.hpp>
+#include <ooo/vba/word/XWindow.hpp>
+#include <ooo/vba/word/XSystem.hpp>
+#include <ooo/vba/word/XOptions.hpp>
+#include <ooo/vba/word/XSelection.hpp>
+#include <ooo/vba/word/XAddins.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <vbahelper/vbaapplicationbase.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+//typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XApplication > SwVbaApplication_BASE;
+typedef cppu::ImplInheritanceHelper1< VbaApplicationBase, ooo::vba::word::XApplication > SwVbaApplication_BASE;
+
+class SwVbaApplication : public SwVbaApplication_BASE
+{
+public:
+ SwVbaApplication( css::uno::Reference< css::uno::XComponentContext >& m_xContext );
+ virtual ~SwVbaApplication();
+
+ virtual SfxObjectShell* GetDocShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
+
+ // XApplication
+ virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL getSystem() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::word::XDocument > SAL_CALL getActiveDocument() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::word::XWindow > SAL_CALL getActiveWindow() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getDisplayAutoCompleteTips() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getEnableCancelKey() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setEnableCancelKey( sal_Int32 _enableCancelKey ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+protected:
+ virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException);
+};
+#endif /* SW_VBA_APPLICATION_HXX */
diff --git a/sw/source/ui/vba/vbaautotextentry.cxx b/sw/source/ui/vba/vbaautotextentry.cxx
new file mode 100644
index 000000000000..d4c153913553
--- /dev/null
+++ b/sw/source/ui/vba/vbaautotextentry.cxx
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbaautotextentry.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <tools/diagnose_ex.h>
+#include "vbarange.hxx"
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaAutoTextEntry::SwVbaAutoTextEntry( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XAutoTextEntry >& xEntry ) throw ( uno::RuntimeException ) :
+ SwVbaAutoTextEntry_BASE( rParent, rContext ), mxEntry( xEntry )
+{
+}
+
+SwVbaAutoTextEntry::~SwVbaAutoTextEntry()
+{
+}
+
+uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::Reference< word::XRange >& _where, const uno::Any& /*_richtext*/ ) throw ( uno::RuntimeException )
+{
+ SwVbaRange* pWhere = dynamic_cast<SwVbaRange*>( _where.get() );
+ if( pWhere )
+ {
+ uno::Reference< text::XTextRange > xTextRange = pWhere->getXTextRange();
+ xTextRange->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("x") ) ); // set marker
+ uno::Reference< text::XTextRange > xEndMarker = xTextRange->getEnd();
+ xEndMarker->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("x") ) ); // set marker
+ uno::Reference< text::XText > xText = pWhere->getXText();
+ mxEntry->applyTo( xEndMarker->getStart() );
+ uno::Reference< text::XTextCursor > xTC = xText->createTextCursorByRange( xTextRange->getStart() );
+ xTC->goRight( 1, sal_True );
+ xTC->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker
+ xEndMarker->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker
+ xTC->gotoRange( xEndMarker, sal_True );
+ pWhere->setXTextCursor( xTC );
+ }
+ return uno::Reference< word::XRange >( pWhere );
+}
+
+rtl::OUString&
+SwVbaAutoTextEntry::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAutoTextEntry") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaAutoTextEntry::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.AutoTextEntry" ) );
+ }
+ return aServiceNames;
+}
+
+
+SwVbaAutoTextEntries::SwVbaAutoTextEntries( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ) throw (uno::RuntimeException) : SwVbaAutoTextEntries_BASE( xParent, xContext, xIndexAccess ), mxAutoTextEntryAccess( xIndexAccess )
+{
+}
+
+// XEnumerationAccess
+uno::Type
+SwVbaAutoTextEntries::getElementType() throw (uno::RuntimeException)
+{
+ return word::XAutoTextEntry::static_type(0);
+}
+uno::Reference< container::XEnumeration >
+SwVbaAutoTextEntries::createEnumeration() throw (uno::RuntimeException)
+{
+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
+ return xEnumerationAccess->createEnumeration();
+}
+
+uno::Any
+SwVbaAutoTextEntries::createCollectionObject( const css::uno::Any& aSource )
+{
+ uno::Reference< text::XAutoTextEntry > xEntry( aSource, uno::UNO_QUERY_THROW );
+ return uno::makeAny( uno::Reference< word::XAutoTextEntry >( new SwVbaAutoTextEntry( this, mxContext, xEntry ) ) );
+}
+
+rtl::OUString&
+SwVbaAutoTextEntries::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAutoTextEntries") );
+ return sImplName;
+}
+
+css::uno::Sequence<rtl::OUString>
+SwVbaAutoTextEntries::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > sNames;
+ if ( sNames.getLength() == 0 )
+ {
+ sNames.realloc( 1 );
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.AutoTextEntries") );
+ }
+ return sNames;
+}
diff --git a/sw/source/ui/vba/vbaautotextentry.hxx b/sw/source/ui/vba/vbaautotextentry.hxx
new file mode 100644
index 000000000000..4ec2d986a877
--- /dev/null
+++ b/sw/source/ui/vba/vbaautotextentry.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_AUTOTEXTENTRY_HXX
+#define SW_VBA_AUTOTEXTENTRY_HXX
+
+#include <vbahelper/vbacollectionimpl.hxx>
+#include <ooo/vba/word/XAutoTextEntries.hpp>
+#include <ooo/vba/word/XAutoTextEntry.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <ooo/vba/word/XRange.hpp>
+#include <com/sun/star/text/XAutoTextEntry.hpp>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XAutoTextEntry > SwVbaAutoTextEntry_BASE;
+
+class SwVbaAutoTextEntry : public SwVbaAutoTextEntry_BASE
+{
+private:
+ css::uno::Reference< css::text::XAutoTextEntry > mxEntry;
+
+public:
+ SwVbaAutoTextEntry( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XAutoTextEntry >& xEntry ) throw ( css::uno::RuntimeException );
+ virtual ~SwVbaAutoTextEntry();
+
+ // XAutoTextEntry
+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL Insert( const css::uno::Reference< ooo::vba::word::XRange >& _where, const css::uno::Any& _richtext ) throw ( css::uno::RuntimeException );
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+
+/* class SwVbaAutoTextEntries */
+typedef CollTestImplHelper< ooo::vba::word::XAutoTextEntries > SwVbaAutoTextEntries_BASE;
+
+class SwVbaAutoTextEntries : public SwVbaAutoTextEntries_BASE
+{
+private:
+ css::uno::Reference< css::container::XIndexAccess > mxAutoTextEntryAccess;
+
+public:
+ SwVbaAutoTextEntries( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw (css::uno::RuntimeException);
+ virtual ~SwVbaAutoTextEntries() {}
+
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+
+ // SwVbaAutoTextEntries_BASE
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif /* SW_VBA_AUTOTEXTENTRY_HXX */
diff --git a/sw/source/ui/vba/vbabookmark.cxx b/sw/source/ui/vba/vbabookmark.cxx
new file mode 100644
index 000000000000..a710682c5194
--- /dev/null
+++ b/sw/source/ui/vba/vbabookmark.cxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbabookmark.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <tools/diagnose_ex.h>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextViewCursor.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include "vbarange.hxx"
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaBookmark::SwVbaBookmark( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
+ const css::uno::Reference< frame::XModel >& rModel, const rtl::OUString& rName ) throw ( css::uno::RuntimeException ) :
+ SwVbaBookmark_BASE( rParent, rContext ), mxModel( rModel ), maName( rName ), mbValid( sal_True )
+{
+ uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( mxModel, uno::UNO_QUERY_THROW );
+ mxBookmark.set( xBookmarksSupplier->getBookmarks()->getByName( maName ), uno::UNO_QUERY_THROW );
+}
+
+SwVbaBookmark::~SwVbaBookmark()
+{
+}
+
+void SwVbaBookmark::checkVality() throw ( uno::RuntimeException )
+{
+ if( !mbValid )
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The bookmark is not valid" ) ), uno::Reference< uno::XInterface >() );
+}
+
+void SAL_CALL SwVbaBookmark::Delete() throw ( uno::RuntimeException )
+{
+ checkVality();
+ uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
+ xTextDocument->getText()->removeTextContent( mxBookmark );
+ mbValid = sal_False;
+}
+
+void SAL_CALL SwVbaBookmark::Select() throw ( uno::RuntimeException )
+{
+ checkVality();
+ uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
+ xViewCursorSupplier->getViewCursor()->gotoRange( mxBookmark->getAnchor(),sal_False );
+}
+
+rtl::OUString SAL_CALL SwVbaBookmark::getName() throw ( uno::RuntimeException )
+{
+ return maName;
+}
+
+void SAL_CALL SwVbaBookmark::setName( const rtl::OUString& _name ) throw ( uno::RuntimeException )
+{
+ uno::Reference< container::XNamed > xNamed( mxBookmark, uno::UNO_QUERY_THROW );
+ xNamed->setName( _name );
+}
+
+uno::Any SAL_CALL SwVbaBookmark::Range() throw ( uno::RuntimeException )
+{
+ uno::Reference< text::XTextContent > xTextContent( mxBookmark, uno::UNO_QUERY_THROW );
+ uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< text::XTextRange > xTextRange( xTextContent->getAnchor(), uno::UNO_QUERY_THROW );
+ return uno::makeAny( uno::Reference< word::XRange>( new SwVbaRange( this, mxContext, xTextDocument, xTextRange->getStart(), xTextRange->getEnd(), xTextRange->getText() ) ) );
+}
+
+rtl::OUString&
+SwVbaBookmark::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBookmark") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaBookmark::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Bookmark" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbabookmark.hxx b/sw/source/ui/vba/vbabookmark.hxx
new file mode 100644
index 000000000000..632046c935d8
--- /dev/null
+++ b/sw/source/ui/vba/vbabookmark.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_BOOKMARK_HXX
+#define SW_VBA_BOOKMARK_HXX
+
+#include <ooo/vba/word/XBookmark.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/text/XBookmarksSupplier.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XBookmark > SwVbaBookmark_BASE;
+
+class SwVbaBookmark : public SwVbaBookmark_BASE
+{
+private:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::text::XTextContent > mxBookmark;
+ rtl::OUString maName;
+ sal_Bool mbValid;
+
+private:
+ void checkVality() throw ( css::uno::RuntimeException );
+
+public:
+ SwVbaBookmark( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
+ const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rName ) throw ( css::uno::RuntimeException );
+ virtual ~SwVbaBookmark();
+
+ // Methods
+ virtual rtl::OUString SAL_CALL getName() throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL setName( const rtl::OUString& ) throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL Delete() throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL Select() throw ( css::uno::RuntimeException );
+ virtual css::uno::Any SAL_CALL Range() throw ( css::uno::RuntimeException );
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_BOOKMARK_HXX */
diff --git a/sw/source/ui/vba/vbabookmarks.cxx b/sw/source/ui/vba/vbabookmarks.cxx
new file mode 100644
index 000000000000..609b8f9df767
--- /dev/null
+++ b/sw/source/ui/vba/vbabookmarks.cxx
@@ -0,0 +1,236 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbabookmarks.hxx"
+#include "vbabookmark.hxx"
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextViewCursor.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <ooo/vba/word/WdBookmarkSortBy.hpp>
+#include "vbarange.hxx"
+#include "wordvbahelper.hxx"
+#include <cppuhelper/implbase2.hxx>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+class BookmarksEnumeration : public EnumerationHelperImpl
+{
+ uno::Reference< frame::XModel > mxModel;
+public:
+ BookmarksEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ), mxModel( xModel ) {}
+
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ uno::Reference< container::XNamed > xNamed( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
+ rtl::OUString aName = xNamed->getName();
+ return uno::makeAny( uno::Reference< word::XBookmark > ( new SwVbaBookmark( m_xParent, m_xContext, mxModel, aName ) ) );
+ }
+
+};
+
+// Bookmarks use case-insensitive name lookup in MS Word.
+typedef ::cppu::WeakImplHelper2< container::XNameAccess, container::XIndexAccess > BookmarkCollectionHelper_BASE;
+class BookmarkCollectionHelper : public BookmarkCollectionHelper_BASE
+{
+private:
+ uno::Reference< container::XNameAccess > mxNameAccess;
+ uno::Reference< container::XIndexAccess > mxIndexAccess;
+ uno::Any cachePos;
+public:
+ BookmarkCollectionHelper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) throw (uno::RuntimeException) : mxIndexAccess( xIndexAccess )
+ {
+ mxNameAccess.set( mxIndexAccess, uno::UNO_QUERY_THROW );
+ }
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return mxIndexAccess->getElementType(); }
+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return mxIndexAccess->hasElements(); }
+ // XNameAcess
+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ if ( !hasByName(aName) )
+ throw container::NoSuchElementException();
+ return cachePos;
+ }
+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
+ {
+ return mxNameAccess->getElementNames();
+ }
+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
+ {
+ if( mxNameAccess->hasByName( aName ) )
+ {
+ cachePos = mxNameAccess->getByName( aName );
+ return sal_True;
+ }
+ else
+ {
+ for( sal_Int32 nIndex = 0; nIndex < mxIndexAccess->getCount(); nIndex++ )
+ {
+ uno::Reference< container::XNamed > xNamed( mxIndexAccess->getByIndex( nIndex ), uno::UNO_QUERY_THROW );
+ rtl::OUString aBookmarkName = xNamed->getName();
+ if( aName.equalsIgnoreAsciiCase( aBookmarkName ) )
+ {
+ cachePos <<= xNamed;
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+ }
+ // XIndexAccess
+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
+ {
+ return mxIndexAccess->getCount();
+ }
+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
+ {
+ return mxIndexAccess->getByIndex( Index );
+ }
+};
+
+SwVbaBookmarks::SwVbaBookmarks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xBookmarks, const uno::Reference< frame::XModel >& xModel ): SwVbaBookmarks_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new BookmarkCollectionHelper( xBookmarks ) ) ), mxModel( xModel )
+{
+ mxBookmarksSupplier.set( mxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
+ // use view cursor to insert bookmark, or it will fail if insert bookmark in table
+ // mxText = xDocument->getText();
+ mxText = word::getXTextViewCursor( mxModel )->getText();
+}
+// XEnumerationAccess
+uno::Type
+SwVbaBookmarks::getElementType() throw (uno::RuntimeException)
+{
+ return word::XBookmark::static_type(0);
+}
+uno::Reference< container::XEnumeration >
+SwVbaBookmarks::createEnumeration() throw (uno::RuntimeException)
+{
+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
+ return new BookmarksEnumeration( getParent(), mxContext,xEnumAccess->createEnumeration(), mxModel );
+}
+
+uno::Any
+SwVbaBookmarks::createCollectionObject( const css::uno::Any& aSource )
+{
+ uno::Reference< container::XNamed > xNamed( aSource, uno::UNO_QUERY_THROW );
+ rtl::OUString aName = xNamed->getName();
+ return uno::makeAny( uno::Reference< word::XBookmark > ( new SwVbaBookmark( getParent(), mxContext, mxModel, aName ) ) );
+}
+
+void SwVbaBookmarks::removeBookmarkByName( const rtl::OUString& rName ) throw (uno::RuntimeException)
+{
+ uno::Reference< text::XTextContent > xBookmark( m_xNameAccess->getByName( rName ), uno::UNO_QUERY_THROW );
+ mxText->removeTextContent( xBookmark );
+}
+
+void SwVbaBookmarks::addBookmarkByName( const rtl::OUString& rName, const uno::Reference< text::XTextRange >& rTextRange ) throw (uno::RuntimeException)
+{
+ uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< text::XTextContent > xBookmark( xDocMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Bookmark")) ), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XNamed > xNamed( xBookmark, uno::UNO_QUERY_THROW );
+ xNamed->setName( rName );
+ mxText->insertTextContent( rTextRange, xBookmark, sal_False );
+}
+
+uno::Any SAL_CALL
+SwVbaBookmarks::Add( const rtl::OUString& rName, const uno::Any& rRange ) throw (uno::RuntimeException)
+{
+ uno::Reference< text::XTextRange > xTextRange;
+ uno::Reference< word::XRange > xRange;
+ if( rRange >>= xRange )
+ {
+ SwVbaRange* pRange = dynamic_cast< SwVbaRange* >( xRange.get() );
+ if( pRange )
+ xTextRange = pRange->getXTextRange();
+ }
+ else
+ {
+ // FIXME: insert the bookmark into current view cursor
+ xTextRange.set( word::getXTextViewCursor( mxModel ), uno::UNO_QUERY_THROW );
+ }
+
+ // remove the exist bookmark
+ // rtl::OUString aName = rName.toAsciiLowerCase();
+ rtl::OUString aName = rName;
+ if( m_xNameAccess->hasByName( aName ) )
+ removeBookmarkByName( aName );
+
+ addBookmarkByName( aName, xTextRange );
+
+ return uno::makeAny( uno::Reference< word::XBookmark >( new SwVbaBookmark( getParent(), mxContext, mxModel, aName ) ) );
+}
+
+sal_Int32 SAL_CALL
+SwVbaBookmarks::getDefaultSorting() throw (css::uno::RuntimeException)
+{
+ return word::WdBookmarkSortBy::wdSortByName;
+}
+
+void SAL_CALL
+SwVbaBookmarks::setDefaultSorting( sal_Int32/* _type*/ ) throw (css::uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+sal_Bool SAL_CALL
+SwVbaBookmarks::getShowHidden() throw (css::uno::RuntimeException)
+{
+ return sal_True;
+}
+
+void SAL_CALL
+SwVbaBookmarks::setShowHidden( sal_Bool /*_hidden*/ ) throw (css::uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+sal_Bool SAL_CALL
+SwVbaBookmarks::Exists( const rtl::OUString& rName ) throw (css::uno::RuntimeException)
+{
+ sal_Bool bExist = m_xNameAccess->hasByName( rName );
+ return bExist;
+}
+
+rtl::OUString&
+SwVbaBookmarks::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBookmarks") );
+ return sImplName;
+}
+
+css::uno::Sequence<rtl::OUString>
+SwVbaBookmarks::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > sNames;
+ if ( sNames.getLength() == 0 )
+ {
+ sNames.realloc( 1 );
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Bookmarks") );
+ }
+ return sNames;
+}
diff --git a/sw/source/ui/vba/vbabookmarks.hxx b/sw/source/ui/vba/vbabookmarks.hxx
new file mode 100644
index 000000000000..d9047b33d49c
--- /dev/null
+++ b/sw/source/ui/vba/vbabookmarks.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_BOOKMARKS_HXX
+#define SW_VBA_BOOKMARKS_HXX
+
+#include <vbahelper/vbacollectionimpl.hxx>
+#include <ooo/vba/word/XBookmarks.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <com/sun/star/text/XBookmarksSupplier.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XText.hpp>
+
+typedef CollTestImplHelper< ooo::vba::word::XBookmarks > SwVbaBookmarks_BASE;
+
+class SwVbaBookmarks : public SwVbaBookmarks_BASE
+{
+private:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::text::XBookmarksSupplier > mxBookmarksSupplier;
+ css::uno::Reference< css::text::XText > mxText;
+
+private:
+ void removeBookmarkByName( const rtl::OUString& rName ) throw (css::uno::RuntimeException);
+ void addBookmarkByName( const rtl::OUString& rName, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw (css::uno::RuntimeException);
+
+public:
+ SwVbaBookmarks( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xBookmarks, const css::uno::Reference< css::frame::XModel >& xModel );
+ virtual ~SwVbaBookmarks() {}
+
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+
+ // SwVbaBookmarks_BASE
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+
+ // XBookmarks
+ virtual sal_Int32 SAL_CALL getDefaultSorting() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultSorting( sal_Int32 _type ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getShowHidden() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setShowHidden( sal_Bool _hidden ) throw (css::uno::RuntimeException);
+
+ virtual css::uno::Any SAL_CALL Add( const rtl::OUString& rName, const css::uno::Any& rRange ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL Exists( const rtl::OUString& rName ) throw (css::uno::RuntimeException);
+};
+
+#endif /* SW_VBA_BOOKMARKS_HXX */
diff --git a/sw/source/ui/vba/vbaborders.cxx b/sw/source/ui/vba/vbaborders.cxx
new file mode 100644
index 000000000000..184f406c49ac
--- /dev/null
+++ b/sw/source/ui/vba/vbaborders.cxx
@@ -0,0 +1,378 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbaborders.hxx"
+#include <ooo/vba/word/XBorder.hpp>
+#include <ooo/vba/word/WdBorderType.hpp>
+#include <ooo/vba/word/WdLineStyle.hpp>
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/table/TableBorder.hpp>
+#include <com/sun/star/table/ShadowFormat.hpp>
+#include <com/sun/star/table/ShadowLocation.hpp>
+#include "vbapalette.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::ooo::vba;
+
+
+typedef ::cppu::WeakImplHelper1<container::XIndexAccess > RangeBorders_Base;
+typedef InheritedHelperInterfaceImpl1<word::XBorder > SwVbaBorder_Base;
+
+// #TODO sort these indexes to match the order in which Word iterates over the
+// borders, the enumeration will match the order in this list
+static const sal_Int16 supportedIndexTable[] = { word::WdBorderType::wdBorderBottom, word::WdBorderType::wdBorderDiagonalDown, word::WdBorderType::wdBorderDiagonalUp, word::WdBorderType::wdBorderHorizontal, word::WdBorderType::wdBorderLeft, word::WdBorderType::wdBorderRight, word::WdBorderType::wdBorderTop, word::WdBorderType::wdBorderVertical };
+
+const static rtl::OUString sTableBorder( RTL_CONSTASCII_USTRINGPARAM("TableBorder") );
+
+// Equiv widths in in 1/100 mm
+const static sal_Int32 OOLineThin = 35;
+const static sal_Int32 OOLineMedium = 88;
+const static sal_Int32 OOLineThick = 141;
+const static sal_Int32 OOLineHairline = 2;
+
+class SwVbaBorder : public SwVbaBorder_Base
+{
+private:
+ uno::Reference< beans::XPropertySet > m_xProps;
+ sal_Int32 m_LineType;
+ VbaPalette m_Palette;
+ bool setBorderLine( table::BorderLine& rBorderLine )
+ {
+ table::TableBorder aTableBorder;
+ m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder;
+
+ switch ( m_LineType )
+ {
+ case word::WdBorderType::wdBorderLeft:
+ aTableBorder.IsLeftLineValid = sal_True;
+ aTableBorder.LeftLine= rBorderLine;
+ break;
+ case word::WdBorderType::wdBorderTop:
+ aTableBorder.IsTopLineValid = sal_True;
+ aTableBorder.TopLine = rBorderLine;
+ break;
+
+ case word::WdBorderType::wdBorderBottom:
+ aTableBorder.IsBottomLineValid = sal_True;
+ aTableBorder.BottomLine = rBorderLine;
+ break;
+ case word::WdBorderType::wdBorderRight:
+ aTableBorder.IsRightLineValid = sal_True;
+ aTableBorder.RightLine = rBorderLine;
+ break;
+ case word::WdBorderType::wdBorderVertical:
+ aTableBorder.IsVerticalLineValid = sal_True;
+ aTableBorder.VerticalLine = rBorderLine;
+ break;
+ case word::WdBorderType::wdBorderHorizontal:
+ aTableBorder.IsHorizontalLineValid = sal_True;
+ aTableBorder.HorizontalLine = rBorderLine;
+ break;
+ case word::WdBorderType::wdBorderDiagonalDown:
+ case word::WdBorderType::wdBorderDiagonalUp:
+ // #TODO have to ignore at the momement, would be
+ // nice to investigate what we can do here
+ break;
+ default:
+ return false;
+ }
+ m_xProps->setPropertyValue( sTableBorder, uno::makeAny(aTableBorder) );
+ return true;
+ }
+
+ bool getBorderLine( table::BorderLine& rBorderLine )
+ {
+ table::TableBorder aTableBorder;
+ m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder;
+ switch ( m_LineType )
+ {
+ case word::WdBorderType::wdBorderLeft:
+ if ( aTableBorder.IsLeftLineValid )
+ rBorderLine = aTableBorder.LeftLine;
+ break;
+ case word::WdBorderType::wdBorderTop:
+ if ( aTableBorder.IsTopLineValid )
+ rBorderLine = aTableBorder.TopLine;
+ break;
+ case word::WdBorderType::wdBorderBottom:
+ if ( aTableBorder.IsBottomLineValid )
+ rBorderLine = aTableBorder.BottomLine;
+ break;
+ case word::WdBorderType::wdBorderRight:
+ if ( aTableBorder.IsRightLineValid )
+ rBorderLine = aTableBorder.RightLine;
+ break;
+ case word::WdBorderType::wdBorderVertical:
+ if ( aTableBorder.IsVerticalLineValid )
+ rBorderLine = aTableBorder.VerticalLine;
+ break;
+ case word::WdBorderType::wdBorderHorizontal:
+ if ( aTableBorder.IsHorizontalLineValid )
+ rBorderLine = aTableBorder.HorizontalLine;
+ break;
+
+ case word::WdBorderType::wdBorderDiagonalDown:
+ case word::WdBorderType::wdBorderDiagonalUp:
+ // #TODO have to ignore at the momement, would be
+ // nice to investigate what we can do here
+ break;
+ default:
+ return false;
+ }
+ return true;
+ }
+ SwVbaBorder(); // no impl
+protected:
+ virtual rtl::OUString& getServiceImplName()
+ {
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBorder") );
+ return sImplName;
+ }
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames()
+ {
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Border" ) );
+ }
+ return aServiceNames;
+ }
+public:
+ SwVbaBorder( const uno::Reference< beans::XPropertySet > & xProps, const uno::Reference< uno::XComponentContext >& xContext, sal_Int32 lineType, VbaPalette& rPalette) : SwVbaBorder_Base( uno::Reference< XHelperInterface >( xProps, uno::UNO_QUERY ), xContext ), m_xProps( xProps ), m_LineType( lineType ), m_Palette( rPalette ) {}
+
+ uno::Any SAL_CALL getLineStyle() throw (uno::RuntimeException)
+ {
+ sal_Int32 nLineStyle = word::WdLineStyle::wdLineStyleNone;
+ table::BorderLine aBorderLine;
+ if ( getBorderLine( aBorderLine ) )
+ {
+ if( aBorderLine.InnerLineWidth !=0 && aBorderLine.OuterLineWidth !=0 )
+ {
+ nLineStyle = word::WdLineStyle::wdLineStyleDouble;
+ }
+ else if( aBorderLine.InnerLineWidth !=0 || aBorderLine.OuterLineWidth !=0 )
+ {
+ nLineStyle = word::WdLineStyle::wdLineStyleSingle;
+ }
+ else
+ {
+ nLineStyle = word::WdLineStyle::wdLineStyleNone;
+ }
+ }
+ return uno::makeAny( nLineStyle );
+ }
+ void SAL_CALL setLineStyle( const uno::Any& _linestyle ) throw (uno::RuntimeException)
+ {
+ // Urk no choice but to silently ignore we don't support this attribute
+ // #TODO would be nice to support the word line styles
+ sal_Int32 nLineStyle = 0;
+ _linestyle >>= nLineStyle;
+ table::BorderLine aBorderLine;
+ if ( getBorderLine( aBorderLine ) )
+ {
+ switch ( nLineStyle )
+ {
+ case word::WdLineStyle::wdLineStyleNone:
+ {
+ aBorderLine.InnerLineWidth = 0;
+ aBorderLine.OuterLineWidth = 0;
+ break;
+ }
+ case word::WdLineStyle::wdLineStyleDashDot:
+ case word::WdLineStyle::wdLineStyleDashDotDot:
+ case word::WdLineStyle::wdLineStyleDashDotStroked:
+ case word::WdLineStyle::wdLineStyleDashLargeGap:
+ case word::WdLineStyle::wdLineStyleDashSmallGap:
+ case word::WdLineStyle::wdLineStyleDot:
+ case word::WdLineStyle::wdLineStyleDouble:
+ case word::WdLineStyle::wdLineStyleDoubleWavy:
+ case word::WdLineStyle::wdLineStyleEmboss3D:
+ case word::WdLineStyle::wdLineStyleEngrave3D:
+ case word::WdLineStyle::wdLineStyleInset:
+ case word::WdLineStyle::wdLineStyleOutset:
+ case word::WdLineStyle::wdLineStyleSingle:
+ case word::WdLineStyle::wdLineStyleSingleWavy:
+ case word::WdLineStyle::wdLineStyleThickThinLargeGap:
+ case word::WdLineStyle::wdLineStyleThickThinMedGap:
+ case word::WdLineStyle::wdLineStyleThickThinSmallGap:
+ case word::WdLineStyle::wdLineStyleThinThickLargeGap:
+ case word::WdLineStyle::wdLineStyleThinThickMedGap:
+ case word::WdLineStyle::wdLineStyleThinThickSmallGap:
+ case word::WdLineStyle::wdLineStyleThinThickThinLargeGap:
+ case word::WdLineStyle::wdLineStyleThinThickThinMedGap:
+ case word::WdLineStyle::wdLineStyleThinThickThinSmallGap:
+ case word::WdLineStyle::wdLineStyleTriple:
+ {
+ aBorderLine.InnerLineWidth = 0;
+ aBorderLine.OuterLineWidth = OOLineHairline;
+ break;
+ }
+ default:
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Bad param" ) ), uno::Reference< uno::XInterface >() );
+ }
+ setBorderLine( aBorderLine );
+ }
+ else
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Method failed" ) ), uno::Reference< uno::XInterface >() );
+ }
+};
+
+class RangeBorders : public RangeBorders_Base
+{
+private:
+ uno::Reference< table::XCellRange > m_xRange;
+ uno::Reference< uno::XComponentContext > m_xContext;
+ VbaPalette m_Palette;
+ sal_Int32 getTableIndex( sal_Int32 nConst )
+ {
+ // hokay return position of the index in the table
+ sal_Int32 nIndexes = getCount();
+ sal_Int32 realIndex = 0;
+ const sal_Int16* pTableEntry = supportedIndexTable;
+ for ( ; realIndex < nIndexes; ++realIndex, ++pTableEntry )
+ {
+ if ( *pTableEntry == nConst )
+ return realIndex;
+ }
+ return getCount(); // error condition
+ }
+public:
+ RangeBorders( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, VbaPalette& rPalette ) : m_xRange( xRange ), m_xContext( xContext ), m_Palette( rPalette )
+ {
+ }
+ // XIndexAccess
+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
+ {
+ return sizeof( supportedIndexTable ) / sizeof( supportedIndexTable[0] );
+ }
+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+
+ sal_Int32 nIndex = getTableIndex( Index );
+ if ( nIndex >= 0 && nIndex < getCount() )
+ {
+ uno::Reference< beans::XPropertySet > xProps( m_xRange, uno::UNO_QUERY_THROW );
+ return uno::makeAny( uno::Reference< word::XBorder >( new SwVbaBorder( xProps, m_xContext, supportedIndexTable[ nIndex ], m_Palette )) );
+ }
+ throw lang::IndexOutOfBoundsException();
+ }
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
+ {
+ return word::XBorder::static_type(0);
+ }
+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
+ {
+ return sal_True;
+ }
+};
+
+uno::Reference< container::XIndexAccess >
+rangeToBorderIndexAccess( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, VbaPalette& rPalette )
+{
+ return new RangeBorders( xRange, xContext, rPalette );
+}
+
+class RangeBorderEnumWrapper : public EnumerationHelper_BASE
+{
+ uno::Reference<container::XIndexAccess > m_xIndexAccess;
+ sal_Int32 nIndex;
+public:
+ RangeBorderEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {}
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
+ {
+ return ( nIndex < m_xIndexAccess->getCount() );
+ }
+
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ if ( nIndex < m_xIndexAccess->getCount() )
+ return m_xIndexAccess->getByIndex( nIndex++ );
+ throw container::NoSuchElementException();
+ }
+};
+
+// for Table borders
+SwVbaBorders::SwVbaBorders( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< table::XCellRange >& xRange, VbaPalette& rPalette ): SwVbaBorders_BASE( xParent, xContext, rangeToBorderIndexAccess( xRange ,xContext, rPalette ) )
+{
+ m_xProps.set( xRange, uno::UNO_QUERY_THROW );
+}
+
+uno::Reference< container::XEnumeration >
+SwVbaBorders::createEnumeration() throw (uno::RuntimeException)
+{
+ return new RangeBorderEnumWrapper( m_xIndexAccess );
+}
+
+uno::Any
+SwVbaBorders::createCollectionObject( const css::uno::Any& aSource )
+{
+ return aSource; // its already a Border object
+}
+
+uno::Type
+SwVbaBorders::getElementType() throw (uno::RuntimeException)
+{
+ return word::XBorders::static_type(0);
+}
+
+uno::Any
+SwVbaBorders::getItemByIntIndex( const sal_Int32 nIndex ) throw (uno::RuntimeException)
+{
+ return createCollectionObject( m_xIndexAccess->getByIndex( nIndex ) );
+}
+
+sal_Bool SAL_CALL SwVbaBorders::getShadow() throw (uno::RuntimeException)
+{
+ table::ShadowFormat aShadowFormat;
+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShadowFormat") ) ) >>= aShadowFormat;
+ return ( aShadowFormat.Location != table::ShadowLocation_NONE );
+}
+
+void SAL_CALL SwVbaBorders::setShadow( sal_Bool /*_shadow*/ ) throw (uno::RuntimeException)
+{
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+}
+
+rtl::OUString&
+SwVbaBorders::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBorders") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaBorders::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Borders" ) );
+ }
+ return aServiceNames;
+}
diff --git a/sw/source/ui/vba/vbaborders.hxx b/sw/source/ui/vba/vbaborders.hxx
new file mode 100644
index 000000000000..e8a5ff487b98
--- /dev/null
+++ b/sw/source/ui/vba/vbaborders.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_BORDERS_HXX
+#define SW_VBA_BORDERS_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <ooo/vba/word/XBorders.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <vbahelper/vbacollectionimpl.hxx>
+
+typedef CollTestImplHelper< ov::word::XBorders > SwVbaBorders_BASE;
+class VbaPalette;
+class SwVbaBorders : public SwVbaBorders_BASE
+{
+ // XEnumerationAccess
+ virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex ) throw (css::uno::RuntimeException);
+ css::uno::Reference< css::beans::XPropertySet > m_xProps;
+public:
+ SwVbaBorders( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::table::XCellRange >& xRange, VbaPalette& rPalette );
+ virtual ~SwVbaBorders() {}
+
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+
+ // SwVbaCollectionBaseImpl
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+
+ virtual sal_Bool SAL_CALL getShadow() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setShadow( sal_Bool _shadow ) throw (css::uno::RuntimeException);
+
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif //SW_VBA_BORDERS_HXX
+
diff --git a/sw/source/ui/vba/vbadialog.cxx b/sw/source/ui/vba/vbadialog.cxx
new file mode 100644
index 000000000000..a62fd289ca5d
--- /dev/null
+++ b/sw/source/ui/vba/vbadialog.cxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbadialog.hxx"
+#include <ooo/vba/word/WdWordDialog.hpp>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+struct WordDialogTable
+{
+ sal_Int32 wdDialog;
+ const sal_Char* ooDialog;
+};
+
+static const WordDialogTable aWordDialogTable[] =
+{
+ { word::WdWordDialog::wdDialogFileNew, ".uno:NewDoc" },
+ { word::WdWordDialog::wdDialogFileOpen, ".uno:Open" },
+ { word::WdWordDialog::wdDialogFilePrint, ".uno:Print" },
+ { word::WdWordDialog::wdDialogFileSaveAs, ".uno:SaveAs" },
+ { 0, 0 }
+};
+
+rtl::OUString
+SwVbaDialog::mapIndexToName( sal_Int32 nIndex )
+{
+ for( const WordDialogTable* pTable = aWordDialogTable; pTable != NULL; pTable++ )
+ {
+ if( nIndex == pTable->wdDialog )
+ {
+ return rtl::OUString::createFromAscii( pTable->ooDialog );
+ }
+ }
+ return rtl::OUString();
+}
+
+rtl::OUString&
+SwVbaDialog::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDialog") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaDialog::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Dialog" ) );
+ }
+ return aServiceNames;
+}
diff --git a/sw/source/ui/vba/vbadialog.hxx b/sw/source/ui/vba/vbadialog.hxx
new file mode 100644
index 000000000000..591c77bdb41c
--- /dev/null
+++ b/sw/source/ui/vba/vbadialog.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_DIALOG_HXX
+#define SW_VBA_DIALOG_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <ooo/vba/word/XDialog.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <vbahelper/vbadialogbase.hxx>
+
+typedef cppu::ImplInheritanceHelper1< VbaDialogBase, ov::word::XDialog > SwVbaDialog_BASE;
+
+class SwVbaDialog : public SwVbaDialog_BASE
+{
+public:
+ SwVbaDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::frame::XModel >& xModel, sal_Int32 nIndex ):SwVbaDialog_BASE( xParent, xContext, xModel, nIndex ) {}
+ virtual ~SwVbaDialog() {}
+
+ // Methods
+ virtual rtl::OUString mapIndexToName( sal_Int32 nIndex );
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif /* SW_VBA_DIALOG_HXX */
diff --git a/sw/source/ui/vba/vbadialogs.cxx b/sw/source/ui/vba/vbadialogs.cxx
new file mode 100644
index 000000000000..f81e66dd5488
--- /dev/null
+++ b/sw/source/ui/vba/vbadialogs.cxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <ooo/vba/word/XDialog.hpp>
+#include "vbadialogs.hxx"
+#include "vbadialog.hxx"
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+uno::Any
+SwVbaDialogs::Item( const uno::Any &aItem ) throw (uno::RuntimeException)
+{
+ sal_Int32 nIndex = 0;
+ aItem >>= nIndex;
+ uno::Reference< word::XDialog > aDialog( new SwVbaDialog( uno::Reference< XHelperInterface >( Application(),uno::UNO_QUERY_THROW ), mxContext, m_xModel, nIndex ) );
+ return uno::Any( aDialog );
+}
+
+rtl::OUString&
+SwVbaDialogs::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDialogs") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaDialogs::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Dialogs" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbadialogs.hxx b/sw/source/ui/vba/vbadialogs.hxx
new file mode 100644
index 000000000000..075849c18a98
--- /dev/null
+++ b/sw/source/ui/vba/vbadialogs.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_DIALOGS_HXX
+#define SW_VBA_DIALOGS_HXX
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <ooo/vba/word/XDialogs.hpp>
+#include <ooo/vba/XCollection.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <vbahelper/vbadialogsbase.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+typedef cppu::ImplInheritanceHelper1< VbaDialogsBase, ov::word::XDialogs > SwVbaDialogs_BASE;
+
+class SwVbaDialogs : public SwVbaDialogs_BASE
+{
+public:
+ SwVbaDialogs( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::frame::XModel >& xModel ): SwVbaDialogs_BASE( xParent, xContext, xModel ) {}
+ virtual ~SwVbaDialogs() {}
+
+ // XCollection
+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif /* SW_VBA_DIALOGS_HXX */
diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx
new file mode 100644
index 000000000000..cef47c7e32dc
--- /dev/null
+++ b/sw/source/ui/vba/vbadocument.cxx
@@ -0,0 +1,381 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbadocument.hxx"
+#include "vbarange.hxx"
+#include "vbarangehelper.hxx"
+#include "vbadocumentproperties.hxx"
+#include "vbabookmarks.hxx"
+#include "vbavariables.hxx"
+#include <com/sun/star/text/XBookmarksSupplier.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/form/XFormsSupplier.hpp>
+#include <ooo/vba/XControlProvider.hpp>
+
+#include <vbahelper/helperdecl.hxx>
+#include <wordvbahelper.hxx>
+#include <docsh.hxx>
+#include "vbatemplate.hxx"
+#include "vbaparagraph.hxx"
+#include "vbastyles.hxx"
+#include "vbatables.hxx"
+#include "vbafield.hxx"
+#include "vbapagesetup.hxx"
+#include "vbasections.hxx"
+#include <vbahelper/vbashapes.hxx>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaDocument::SwVbaDocument( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< frame::XModel > xModel ): SwVbaDocument_BASE( xParent, xContext, xModel )
+{
+ Initialize();
+}
+SwVbaDocument::SwVbaDocument( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) : SwVbaDocument_BASE( aArgs, xContext )
+{
+ Initialize();
+}
+
+SwVbaDocument::~SwVbaDocument()
+{
+}
+
+void SwVbaDocument::Initialize()
+{
+ mxTextDocument.set( getModel(), uno::UNO_QUERY_THROW );
+}
+
+uno::Reference< word::XRange > SAL_CALL
+SwVbaDocument::getContent() throw ( uno::RuntimeException )
+{
+ uno::Reference< text::XTextRange > xStart = mxTextDocument->getText()->getStart();
+ uno::Reference< text::XTextRange > xEnd;
+ return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, xStart, xEnd, sal_True ) );
+}
+
+uno::Reference< word::XRange > SAL_CALL
+SwVbaDocument::Range( const uno::Any& rStart, const uno::Any& rEnd ) throw ( uno::RuntimeException )
+{
+ if( !rStart.hasValue() && !rEnd.hasValue() )
+ return getContent();
+
+ sal_Int32 nStart = 0;
+ sal_Int32 nEnd = 0;
+ rStart >>= nStart;
+ rEnd >>= nEnd;
+ nStart--;
+ nEnd--;
+
+ uno::Reference< text::XTextRange > xStart;
+ uno::Reference< text::XTextRange > xEnd;
+ if( nStart != -1 || nEnd != -1 )
+ {
+ if( nStart == -1 )
+ xStart = mxTextDocument->getText()->getStart();
+ else
+ xStart = SwVbaRangeHelper::getRangeByPosition( mxTextDocument->getText(), nStart );
+
+ if( nEnd == -1 )
+ xEnd = mxTextDocument->getText()->getEnd();
+ else
+ xEnd = SwVbaRangeHelper::getRangeByPosition( mxTextDocument->getText(), nEnd );
+ }
+
+ if( !xStart.is() && !xEnd.is() )
+ {
+ try
+ {
+ // FIXME
+ xStart = mxTextDocument->getText()->getStart();
+ xEnd = mxTextDocument->getText()->getEnd();
+ }
+ catch( uno::Exception )
+ {
+ DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
+ }
+ }
+ return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, xStart, xEnd ) );
+}
+
+uno::Any SAL_CALL
+SwVbaDocument::BuiltInDocumentProperties( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ uno::Reference< XCollection > xCol( new SwVbaBuiltinDocumentProperties( mxParent, mxContext, getModel() ) );
+ if ( index.hasValue() )
+ return xCol->Item( index, uno::Any() );
+ return uno::makeAny( xCol );
+}
+
+uno::Any SAL_CALL
+SwVbaDocument::CustomDocumentProperties( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ uno::Reference< XCollection > xCol( new SwVbaCustomDocumentProperties( mxParent, mxContext, getModel() ) );
+ if ( index.hasValue() )
+ return xCol->Item( index, uno::Any() );
+ return uno::makeAny( xCol );
+}
+
+uno::Any SAL_CALL
+SwVbaDocument::Bookmarks( const uno::Any& rIndex ) throw ( uno::RuntimeException )
+{
+ uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( getModel(),uno::UNO_QUERY_THROW );
+ uno::Reference<container::XIndexAccess > xBookmarks( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
+ uno::Reference< XCollection > xBookmarksVba( new SwVbaBookmarks( this, mxContext, xBookmarks, getModel() ) );
+ if ( rIndex.getValueTypeClass() == uno::TypeClass_VOID )
+ return uno::makeAny( xBookmarksVba );
+
+ return uno::Any( xBookmarksVba->Item( rIndex, uno::Any() ) );
+}
+
+uno::Any SAL_CALL
+SwVbaDocument::Variables( const uno::Any& rIndex ) throw ( uno::RuntimeException )
+{
+ uno::Reference< document::XDocumentPropertiesSupplier > xDocumentPropertiesSupplier( getModel(),uno::UNO_QUERY_THROW );
+ uno::Reference< document::XDocumentProperties > xDocumentProperties = xDocumentPropertiesSupplier->getDocumentProperties();
+ uno::Reference< beans::XPropertyAccess > xUserDefined( xDocumentProperties->getUserDefinedProperties(), uno::UNO_QUERY_THROW );
+
+ uno::Reference< XCollection > xVariables( new SwVbaVariables( this, mxContext, xUserDefined ) );
+ if ( rIndex.getValueTypeClass() == uno::TypeClass_VOID )
+ return uno::makeAny( xVariables );
+
+ return uno::Any( xVariables->Item( rIndex, uno::Any() ) );
+}
+
+uno::Any SAL_CALL
+SwVbaDocument::Paragraphs( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ uno::Reference< XCollection > xCol( new SwVbaParagraphs( mxParent, mxContext, mxTextDocument ) );
+ if ( index.hasValue() )
+ return xCol->Item( index, uno::Any() );
+ return uno::makeAny( xCol );
+}
+
+uno::Any SAL_CALL
+SwVbaDocument::Styles( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ uno::Reference< XCollection > xCol( new SwVbaStyles( mxParent, mxContext, getModel() ) );
+ if ( index.hasValue() )
+ return xCol->Item( index, uno::Any() );
+ return uno::makeAny( xCol );
+}
+
+uno::Any SAL_CALL
+SwVbaDocument::Fields( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, getModel() ) );
+ if ( index.hasValue() )
+ return xCol->Item( index, uno::Any() );
+ return uno::makeAny( xCol );
+}
+
+uno::Any SAL_CALL
+SwVbaDocument::Shapes( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( getModel(), uno::UNO_QUERY_THROW );
+ //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
+ uno::Reference< XCollection > xCol( new ScVbaShapes( this, mxContext, xIndexAccess, xModel ) );
+
+ if ( index.hasValue() )
+ return xCol->Item( index, uno::Any() );
+ return uno::makeAny( xCol );
+}
+
+uno::Any SAL_CALL
+SwVbaDocument::Sections( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ uno::Reference< XCollection > xCol( new SwVbaSections( mxParent, mxContext, getModel() ) );
+ if ( index.hasValue() )
+ return xCol->Item( index, uno::Any() );
+ return uno::makeAny( xCol );
+}
+
+uno::Any SAL_CALL
+SwVbaDocument::PageSetup( ) throw (uno::RuntimeException)
+{
+ uno::Reference< beans::XPropertySet > xPageProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
+ return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, mxModel, xPageProps ) ) );
+}
+
+rtl::OUString&
+SwVbaDocument::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDocument") );
+ return sImplName;
+}
+uno::Any SAL_CALL
+SwVbaDocument::getAttachedTemplate() throw (uno::RuntimeException)
+{
+ uno::Reference< word::XTemplate > xTemplate;
+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( getModel(), uno::UNO_QUERY_THROW );
+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
+ rtl::OUString sTemplateName = xDocProps->getTemplateName();
+
+ xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateName );
+ return uno::makeAny( xTemplate );
+}
+
+void SAL_CALL
+SwVbaDocument::setAttachedTemplate( const css::uno::Any& /*_attachedtemplate*/ ) throw (uno::RuntimeException)
+{
+ throw uno::RuntimeException();
+}
+
+uno::Any SAL_CALL
+SwVbaDocument::Tables( const css::uno::Any& aIndex ) throw (uno::RuntimeException)
+{
+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
+ uno::Reference< XCollection > xColl( new SwVbaTables( mxParent, mxContext, xModel ) );
+
+ if ( aIndex.hasValue() )
+ return xColl->Item( aIndex, uno::Any() );
+ return uno::makeAny( xColl );
+}
+
+void SAL_CALL SwVbaDocument::Activate() throw (uno::RuntimeException)
+{
+ VbaDocumentBase::Activate();
+}
+
+uno::Any
+SwVbaDocument::getControlShape( const ::rtl::OUString& sName )
+{
+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
+ uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
+
+ sal_Int32 nCount = xIndexAccess->getCount();
+ for( int index = 0; index < nCount; index++ )
+ {
+ uno::Any aUnoObj = xIndexAccess->getByIndex( index );
+ // It seems there are some drawing objects that can not query into Control shapes?
+ uno::Reference< drawing::XControlShape > xControlShape( aUnoObj, uno::UNO_QUERY );
+ if( xControlShape.is() )
+ {
+ uno::Reference< container::XNamed > xNamed( xControlShape->getControl(), uno::UNO_QUERY_THROW );
+ if( sName.equals( xNamed->getName() ))
+ {
+ return aUnoObj;
+ }
+ }
+ }
+ return uno::Any();
+}
+
+uno::Reference< beans::XIntrospectionAccess > SAL_CALL
+SwVbaDocument::getIntrospection( ) throw (uno::RuntimeException)
+{
+ return uno::Reference< beans::XIntrospectionAccess >();
+}
+
+uno::Any SAL_CALL
+SwVbaDocument::invoke( const ::rtl::OUString& aFunctionName, const uno::Sequence< uno::Any >& /*aParams*/, uno::Sequence< ::sal_Int16 >& /*aOutParamIndex*/, uno::Sequence< uno::Any >& /*aOutParam*/ ) throw (lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
+{
+ OSL_TRACE("** SwVbaDocument::invoke( %s ), will barf",
+ rtl::OUStringToOString( aFunctionName, RTL_TEXTENCODING_UTF8 ).getStr() );
+
+ throw uno::RuntimeException(); // unsupported operation
+}
+
+void SAL_CALL
+SwVbaDocument::setValue( const ::rtl::OUString& /*aPropertyName*/, const uno::Any& /*aValue*/ ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
+{
+ throw uno::RuntimeException(); // unsupported operation
+}
+uno::Any SAL_CALL
+SwVbaDocument::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ uno::Reference< drawing::XControlShape > xControlShape( getControlShape( aPropertyName ), uno::UNO_QUERY_THROW );
+
+ uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
+ uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), mxContext ), uno::UNO_QUERY_THROW );
+ uno::Reference< msforms::XControl > xControl( xControlProvider->createControl( xControlShape, getModel() ) );
+ return uno::makeAny( xControl );
+}
+
+::sal_Bool SAL_CALL
+SwVbaDocument::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+::sal_Bool SAL_CALL
+SwVbaDocument::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
+{
+ uno::Reference< container::XNameAccess > xFormControls( getFormControls() );
+ if ( xFormControls.is() )
+ return xFormControls->hasByName( aName );
+ return sal_False;
+}
+
+uno::Reference< container::XNameAccess >
+SwVbaDocument::getFormControls()
+{
+ uno::Reference< container::XNameAccess > xFormControls;
+ try
+ {
+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
+ uno::Reference< form::XFormsSupplier > xFormSupplier( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XIndexAccess > xIndexAccess( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
+ // get the www-standard container ( maybe we should access the
+ // 'www-standard' by name rather than index, this seems an
+ // implementation detail
+ xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ return xFormControls;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaDocument::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Document" ) );
+ }
+ return aServiceNames;
+}
+
+namespace document
+{
+namespace sdecl = comphelper::service_decl;
+sdecl::vba_service_class_<SwVbaDocument, sdecl::with_args<true> > serviceImpl;
+extern sdecl::ServiceDecl const serviceDecl(
+ serviceImpl,
+ "SwVbaDocument",
+ "ooo.vba.word.Document" );
+}
+
diff --git a/sw/source/ui/vba/vbadocument.hxx b/sw/source/ui/vba/vbadocument.hxx
new file mode 100644
index 000000000000..ab87798a8ded
--- /dev/null
+++ b/sw/source/ui/vba/vbadocument.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_DOCUMENT_HXX
+#define SW_VBA_DOCUMENT_HXX
+
+#include <ooo/vba/word/XDocument.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <vbahelper/vbadocumentbase.hxx>
+#include <com/sun/star/text/XTextDocument.hpp>
+
+typedef cppu::ImplInheritanceHelper1< VbaDocumentBase, ooo::vba::word::XDocument > SwVbaDocument_BASE;
+
+class SwVbaDocument : public SwVbaDocument_BASE
+{
+private:
+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
+
+ void Initialize();
+ css::uno::Any getControlShape( const rtl::OUString& sName );
+ css::uno::Reference< css::container::XNameAccess > getFormControls();
+
+public:
+ SwVbaDocument( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& m_xContext, css::uno::Reference< css::frame::XModel > xModel );
+ SwVbaDocument( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
+ virtual ~SwVbaDocument();
+
+ // XDocument
+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getContent() throw ( css::uno::RuntimeException );
+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL Range( const css::uno::Any& rStart, const css::uno::Any& rEnd ) throw ( css::uno::RuntimeException );
+ virtual css::uno::Any SAL_CALL BuiltInDocumentProperties( const css::uno::Any& index ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL CustomDocumentProperties( const css::uno::Any& index ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Bookmarks( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
+ virtual css::uno::Any SAL_CALL Variables( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
+ virtual css::uno::Any SAL_CALL getAttachedTemplate() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAttachedTemplate( const css::uno::Any& _attachedtemplate ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Paragraphs( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
+ virtual css::uno::Any SAL_CALL Styles( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException );
+ virtual css::uno::Any SAL_CALL Tables( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Fields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Shapes( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Sections( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL PageSetup() throw (css::uno::RuntimeException);
+ // XInvocation
+ virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
+ virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw (css::beans::UnknownPropertyException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_DOCUMENT_HXX */
diff --git a/sw/source/ui/vba/vbadocumentproperties.cxx b/sw/source/ui/vba/vbadocumentproperties.cxx
new file mode 100644
index 000000000000..50ab62dd904f
--- /dev/null
+++ b/sw/source/ui/vba/vbadocumentproperties.cxx
@@ -0,0 +1,764 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbadocumentproperties.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <ooo/vba/word/WdBuiltInProperty.hpp>
+#include <ooo/vba/office/MsoDocProperties.hpp>
+#include <memory>
+#include <boost/shared_ptr.hpp>
+#include "wordvbahelper.hxx"
+#include "fesh.hxx"
+#include "docsh.hxx"
+using namespace ::ooo::vba;
+using namespace css;
+
+sal_Int8 lcl_toMSOPropType( const uno::Type& aType ) throw ( lang::IllegalArgumentException )
+{
+ sal_Int16 msoType = office::MsoDocProperties::msoPropertyTypeString;
+
+ switch ( aType.getTypeClass() )
+ {
+ case uno::TypeClass_BOOLEAN:
+ msoType = office::MsoDocProperties::msoPropertyTypeBoolean;
+ break;
+ case uno::TypeClass_FLOAT:
+ msoType = office::MsoDocProperties::msoPropertyTypeFloat;
+ break;
+ case uno::TypeClass_STRUCT: // Assume date
+ msoType = office::MsoDocProperties::msoPropertyTypeDate;
+ break;
+ case uno::TypeClass_BYTE:
+ case uno::TypeClass_SHORT:
+ case uno::TypeClass_LONG:
+ case uno::TypeClass_HYPER:
+ msoType = office::MsoDocProperties::msoPropertyTypeNumber;
+ break;
+ default:
+ throw lang::IllegalArgumentException();
+ }
+ return msoType;
+}
+
+class PropertGetSetHelper
+{
+protected:
+ uno::Reference< frame::XModel > m_xModel;
+ uno::Reference< beans::XPropertySet > mxProps;
+public:
+ PropertGetSetHelper( const uno::Reference< frame::XModel >& xModel ):m_xModel( xModel )
+ {
+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( m_xModel, uno::UNO_QUERY_THROW );
+ mxProps.set( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
+ }
+ virtual ~PropertGetSetHelper() {}
+ virtual uno::Any getPropertyValue( const rtl::OUString& rPropName ) = 0;
+ virtual void setPropertyValue( const rtl::OUString& rPropName, const uno::Any& aValue ) = 0;
+ virtual uno::Reference< beans::XPropertySet > getUnoProperties() { return mxProps; }
+
+};
+
+class BuiltinPropertyGetSetHelper : public PropertGetSetHelper
+{
+public:
+ BuiltinPropertyGetSetHelper( const uno::Reference< frame::XModel >& xModel ) :PropertGetSetHelper( xModel )
+ {
+ }
+ virtual uno::Any getPropertyValue( const rtl::OUString& rPropName )
+ {
+ if ( rPropName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("EditingDuration" ) ) ) )
+ {
+ sal_Int32 nSecs = 0;
+ mxProps->getPropertyValue( rPropName ) >>= nSecs;
+ return uno::makeAny( nSecs/60 ); // minutes
+ }
+ return mxProps->getPropertyValue( rPropName );
+ }
+ virtual void setPropertyValue( const rtl::OUString& rPropName, const uno::Any& aValue )
+ {
+ mxProps->setPropertyValue( rPropName, aValue );
+ }
+};
+
+class CustomPropertyGetSetHelper : public BuiltinPropertyGetSetHelper
+{
+public:
+ CustomPropertyGetSetHelper( const uno::Reference< frame::XModel >& xModel ) :BuiltinPropertyGetSetHelper( xModel )
+ {
+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( mxProps, uno::UNO_QUERY_THROW );
+ uno::Reference< document::XDocumentProperties > xDocProp( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
+ mxProps.set( xDocProp->getUserDefinedProperties(), uno::UNO_QUERY_THROW );
+ }
+};
+class StatisticPropertyGetSetHelper : public PropertGetSetHelper
+{
+ SwDocShell* mpDocShell;
+ uno::Reference< beans::XPropertySet > mxModelProps;
+public:
+ StatisticPropertyGetSetHelper( const uno::Reference< frame::XModel >& xModel ) :PropertGetSetHelper( xModel ) , mpDocShell( NULL )
+ {
+ mxModelProps.set( m_xModel, uno::UNO_QUERY_THROW );
+ mpDocShell = word::getDocShell( xModel );
+ }
+ virtual uno::Any getPropertyValue( const rtl::OUString& rPropName )
+ {
+ uno::Sequence< beans::NamedValue > stats;
+ try
+ {
+ // Characters, ParagraphCount & WordCount are available from
+ // the model ( and addtionally these also update the statics object )
+ //return mxProps->getPropertyValue( rPropName );
+ return mxModelProps->getPropertyValue( rPropName );
+ }
+ catch( uno::Exception& )
+ {
+ OSL_TRACE("Got exception");
+ }
+ uno::Any aReturn;
+ if ( rPropName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount")) ) ) // special processing needed
+ {
+ if ( mpDocShell )
+ {
+ SwFEShell* pFEShell = mpDocShell->GetFEShell();
+ if(pFEShell)
+ {
+ aReturn <<= pFEShell->GetLineCount(FALSE);
+ }
+ }
+ }
+ else
+ {
+ mxModelProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphCount") ) ) >>= stats;
+ mxProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DocumentStatistic") ) ) >>= stats;
+
+ sal_Int32 nLen = stats.getLength();
+ bool bFound = false;
+ for ( sal_Int32 index = 0; index < nLen && !bFound ; ++index )
+ {
+ if ( rPropName.equals( stats[ index ].Name ) )
+ {
+ aReturn = stats[ index ].Value;
+ bFound = true;
+ }
+ }
+ if ( !bFound )
+ throw uno::RuntimeException(); // bad Property
+ }
+ return aReturn;
+ }
+
+ virtual void setPropertyValue( const rtl::OUString& rPropName, const uno::Any& aValue )
+ {
+
+ uno::Sequence< beans::NamedValue > stats;
+ mxProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DocumentStatistic") ) ) >>= stats;
+
+ sal_Int32 nLen = stats.getLength();
+ for ( sal_Int32 index = 0; index < nLen; ++index )
+ {
+ if ( rPropName.equals( stats[ index ].Name ) )
+ {
+ stats[ index ].Value = aValue;
+ mxProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DocumentStatistic") ), uno::makeAny( stats ) );
+ break;
+ }
+ }
+ }
+};
+
+class DocPropInfo
+{
+public:
+ rtl::OUString msMSODesc;
+ rtl::OUString msOOOPropName;
+ boost::shared_ptr< PropertGetSetHelper > mpPropGetSetHelper;
+
+ static DocPropInfo createDocPropInfo( const rtl::OUString& sDesc, const rtl::OUString& sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
+ {
+ return createDocPropInfo( rtl::OUStringToOString( sDesc, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sPropName, RTL_TEXTENCODING_UTF8 ).getStr(), rHelper );
+ }
+
+ static DocPropInfo createDocPropInfo( const sal_Char* sDesc, const sal_Char* sPropName, boost::shared_ptr< PropertGetSetHelper >& rHelper )
+ {
+ DocPropInfo aItem;
+ aItem.msMSODesc = rtl::OUString::createFromAscii( sDesc );
+ aItem.msOOOPropName = rtl::OUString::createFromAscii( sPropName );
+ aItem.mpPropGetSetHelper = rHelper;
+ return aItem;
+ }
+ uno::Any getValue()
+ {
+ if ( mpPropGetSetHelper.get() )
+ return mpPropGetSetHelper->getPropertyValue( msOOOPropName );
+ return uno::Any();
+ }
+ void setValue( const uno::Any& rValue )
+ {
+ if ( mpPropGetSetHelper.get() )
+ mpPropGetSetHelper->setPropertyValue( msOOOPropName, rValue );
+ }
+ uno::Reference< beans::XPropertySet > getUnoProperties()
+ {
+
+ uno::Reference< beans::XPropertySet > xProps;
+ if ( mpPropGetSetHelper.get() )
+ return mpPropGetSetHelper->getUnoProperties();
+ return xProps;
+ }
+};
+
+
+typedef std::hash_map< sal_Int32, DocPropInfo > MSOIndexToOODocPropInfo;
+
+class BuiltInIndexHelper
+{
+ MSOIndexToOODocPropInfo m_docPropInfoMap;
+ BuiltInIndexHelper();
+public:
+ BuiltInIndexHelper( const uno::Reference< frame::XModel >& xModel )
+ {
+ boost::shared_ptr< PropertGetSetHelper > aStandardHelper( new BuiltinPropertyGetSetHelper( xModel ) );
+ boost::shared_ptr< PropertGetSetHelper > aUsingStatsHelper( new StatisticPropertyGetSetHelper( xModel ) );
+
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTitle ] = DocPropInfo::createDocPropInfo( "Title", "Title", aStandardHelper );
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySubject ] = DocPropInfo::createDocPropInfo( "Subject", "Subject", aStandardHelper );
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAuthor ] = DocPropInfo::createDocPropInfo( "Author", "Author", aStandardHelper );
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyKeywords ] = DocPropInfo::createDocPropInfo( "Keywords", "Keywords", aStandardHelper );
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyComments ] = DocPropInfo::createDocPropInfo( "Comments", "Description", aStandardHelper );
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTemplate ] = DocPropInfo::createDocPropInfo( "Template", "Template", aStandardHelper );
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLastAuthor ] = DocPropInfo::createDocPropInfo( "Last author", "ModifiedBy", aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyRevision ] = DocPropInfo::createDocPropInfo( "Revision number", "EditingCycles", aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAppName ] = DocPropInfo::createDocPropInfo( "Application name", "Generator", aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastPrinted ] = DocPropInfo::createDocPropInfo( "Last print date", "PrintDate", aStandardHelper ); // doesn't seem to exist - throw or return nothing ?
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeCreated ] = DocPropInfo::createDocPropInfo( "Creation date", "CreationDate", aStandardHelper );
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastSaved ] = DocPropInfo::createDocPropInfo( "Last save time", "ModifyDate", aStandardHelper );
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyVBATotalEdit ] = DocPropInfo::createDocPropInfo( "Total editing time", "EditingDuration", aStandardHelper ); // Not sure if this is correct
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyPages ] = DocPropInfo::createDocPropInfo( "Number of pages", "PageCount", aUsingStatsHelper ); // special handling required ?
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyWords ] = DocPropInfo::createDocPropInfo( "Number of words", "WordCount", aUsingStatsHelper ); // special handling require ?
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharacters ] = DocPropInfo::createDocPropInfo( "Number of characters", "CharacterCount", aUsingStatsHelper ); // special handling required ?
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySecurity ] = DocPropInfo::createDocPropInfo( "Security", "", aStandardHelper ); // doesn't seem to exist
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCategory ] = DocPropInfo::createDocPropInfo( "Category", "Category", aStandardHelper ); // hacked in
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyFormat ] = DocPropInfo::createDocPropInfo( "Format", "", aStandardHelper ); // doesn't seem to exist
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyManager ] = DocPropInfo::createDocPropInfo( "Manager", "Manager", aStandardHelper ); // hacked in
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCompany ] = DocPropInfo::createDocPropInfo( "Company", "Company", aStandardHelper ); // hacked in
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyBytes ] = DocPropInfo::createDocPropInfo( "Number of bytes", "", aStandardHelper ); // doesn't seem to exist - size on disk exists ( for an already saved document ) perhaps it will do ( or we need something else )
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLines ] = DocPropInfo::createDocPropInfo( "Number of lines", "LineCount", aUsingStatsHelper ); // special handling
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyParas ] = DocPropInfo::createDocPropInfo( "Number of paragraphs", "ParagraphCount", aUsingStatsHelper ); // special handling
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySlides ] = DocPropInfo::createDocPropInfo( "Number of slides", "" , aStandardHelper ); // doesn't seem to exist
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyNotes ] = DocPropInfo::createDocPropInfo( "Number of notes", "", aStandardHelper ); // doesn't seem to exist
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHiddenSlides ] = DocPropInfo::createDocPropInfo("Number of hidden Slides", "", aStandardHelper ); // doesn't seem to exist
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyMMClips ] = DocPropInfo::createDocPropInfo( "Number of multimedia clips", "", aStandardHelper ); // doesn't seem to exist
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHyperlinkBase ] = DocPropInfo::createDocPropInfo( "Hyperlink base", "AutoloadURL", aStandardHelper );
+ m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharsWSpaces ] = DocPropInfo::createDocPropInfo( "Number of characters (with spaces)", "", aStandardHelper ); // doesn't seem to be supported
+ }
+
+ MSOIndexToOODocPropInfo& getDocPropInfoMap() { return m_docPropInfoMap; }
+};
+
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::XDocumentProperty > SwVbaDocumentProperty_BASE;
+
+class SwVbaBuiltInDocumentProperty : public SwVbaDocumentProperty_BASE
+{
+protected:
+ DocPropInfo mPropInfo;
+public:
+ SwVbaBuiltInDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo );
+ // XDocumentProperty
+ virtual void SAL_CALL Delete( ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getName( ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& Name ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual ::sal_Int8 SAL_CALL getType( ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual void SAL_CALL setType( ::sal_Int8 Type ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual void SAL_CALL setLinkToContent( ::sal_Bool LinkToContent ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual uno::Any SAL_CALL getValue( ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual void SAL_CALL setValue( const uno::Any& Value ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual rtl::OUString SAL_CALL getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual void SAL_CALL setLinkSource( const rtl::OUString& LinkSource ) throw (script::BasicErrorException, uno::RuntimeException);
+ //XDefaultProperty
+ virtual ::rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (uno::RuntimeException) { return rtl::OUString::createFromAscii("Value"); }
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+class SwVbaCustomDocumentProperty : public SwVbaBuiltInDocumentProperty
+{
+public:
+
+ SwVbaCustomDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo );
+
+ virtual ::sal_Bool SAL_CALL getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual void SAL_CALL setLinkToContent( ::sal_Bool LinkToContent ) throw (script::BasicErrorException, uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual void SAL_CALL setLinkSource( const rtl::OUString& LinkSource ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual void SAL_CALL Delete( ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& Name ) throw (script::BasicErrorException, uno::RuntimeException);
+ virtual void SAL_CALL setType( ::sal_Int8 Type ) throw (script::BasicErrorException, uno::RuntimeException);
+
+};
+
+
+SwVbaCustomDocumentProperty::SwVbaCustomDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo ) : SwVbaBuiltInDocumentProperty( xParent, xContext, rInfo )
+{
+}
+
+sal_Bool
+SwVbaCustomDocumentProperty::getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ // #FIXME we need to store the link content somewhere
+ return sal_False;
+}
+
+void
+SwVbaCustomDocumentProperty::setLinkToContent( sal_Bool /*bLinkContent*/ ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+}
+
+rtl::OUString
+SwVbaCustomDocumentProperty::getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ // #FIXME we need to store the link content somewhere
+ return rtl::OUString();;
+}
+
+void
+SwVbaCustomDocumentProperty::setLinkSource( const rtl::OUString& /*rsLinkContent*/ ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ // #FIXME we need to store the link source somewhere
+}
+
+void SAL_CALL
+SwVbaCustomDocumentProperty::setName( const ::rtl::OUString& /*Name*/ ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ // setName on existing property ?
+ // #FIXME
+ // do we need to delete existing property and create a new one?
+}
+
+void SAL_CALL
+SwVbaCustomDocumentProperty::setType( ::sal_Int8 /*Type*/ ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ // setType, do we need to do a conversion?
+ // #FIXME the underlying value needs to be changed to the new type
+}
+
+void SAL_CALL
+SwVbaCustomDocumentProperty::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ uno::Reference< beans::XPropertyContainer > xContainer( mPropInfo.getUnoProperties(), uno::UNO_QUERY_THROW );
+ xContainer->removeProperty( getName() );
+}
+
+SwVbaBuiltInDocumentProperty::SwVbaBuiltInDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo ) : SwVbaDocumentProperty_BASE( xParent, xContext ), mPropInfo( rInfo )
+{
+}
+
+void SAL_CALL
+SwVbaBuiltInDocumentProperty::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ // not valid for Builtin
+ throw uno::RuntimeException();
+}
+
+::rtl::OUString SAL_CALL
+SwVbaBuiltInDocumentProperty::getName( ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ return mPropInfo.msMSODesc;
+}
+
+void SAL_CALL
+SwVbaBuiltInDocumentProperty::setName( const rtl::OUString& ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ // not valid for Builtin
+ throw uno::RuntimeException();
+}
+
+::sal_Int8 SAL_CALL
+SwVbaBuiltInDocumentProperty::getType( ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ return lcl_toMSOPropType( getValue().getValueType() );
+}
+
+void SAL_CALL
+SwVbaBuiltInDocumentProperty::setType( ::sal_Int8 /*Type*/ ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ // not valid for Builtin
+ throw uno::RuntimeException();
+}
+
+::sal_Bool SAL_CALL
+SwVbaBuiltInDocumentProperty::getLinkToContent( ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ return sal_False; // built-in always false
+}
+
+void SAL_CALL
+SwVbaBuiltInDocumentProperty::setLinkToContent( ::sal_Bool /*LinkToContent*/ ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ // not valid for Builtin
+ throw uno::RuntimeException();
+}
+
+uno::Any SAL_CALL
+SwVbaBuiltInDocumentProperty::getValue( ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ uno::Any aRet = mPropInfo.getValue();
+ if ( !aRet.hasValue() )
+ throw uno::RuntimeException();
+ return aRet;
+}
+
+void SAL_CALL
+SwVbaBuiltInDocumentProperty::setValue( const uno::Any& Value ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ mPropInfo.setValue( Value );
+}
+
+rtl::OUString SAL_CALL
+SwVbaBuiltInDocumentProperty::getLinkSource( ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ // not valid for Builtin
+ throw uno::RuntimeException();
+}
+
+void SAL_CALL
+SwVbaBuiltInDocumentProperty::setLinkSource( const rtl::OUString& /*LinkSource*/ ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ // not valid for Builtin
+ throw uno::RuntimeException();
+}
+
+rtl::OUString&
+SwVbaBuiltInDocumentProperty::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBuiltinDocumentProperty") );
+ return sImplName;
+}
+
+uno::Sequence<rtl::OUString>
+SwVbaBuiltInDocumentProperty::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.DocumentProperty" ) );
+ }
+ return aServiceNames;
+}
+typedef ::cppu::WeakImplHelper3< com::sun::star::container::XIndexAccess
+ ,com::sun::star::container::XNameAccess
+ ,com::sun::star::container::XEnumerationAccess
+ > PropertiesImpl_BASE;
+
+typedef std::hash_map< sal_Int32, uno::Reference< XDocumentProperty > > DocProps;
+
+typedef ::cppu::WeakImplHelper1< com::sun::star::container::XEnumeration > DocPropEnumeration_BASE;
+class DocPropEnumeration : public DocPropEnumeration_BASE
+{
+ DocProps mDocProps;
+ DocProps::iterator mIt;
+public:
+
+ DocPropEnumeration( const DocProps& rProps ) : mDocProps( rProps ), mIt( mDocProps.begin() ) {}
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
+ {
+ return mIt != mDocProps.end();
+ }
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ if ( !hasMoreElements() )
+ throw container::NoSuchElementException();
+ return uno::makeAny( mIt++->second );
+ }
+};
+
+typedef std::hash_map< rtl::OUString, uno::Reference< XDocumentProperty >, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > DocPropsByName;
+
+class BuiltInPropertiesImpl : public PropertiesImpl_BASE
+{
+protected:
+
+ uno::Reference< XHelperInterface > m_xParent;
+ uno::Reference< uno::XComponentContext > m_xContext;
+ uno::Reference< frame::XModel > m_xModel;
+ uno::Reference< document::XDocumentInfo > m_xOOOBuiltIns;
+
+ DocProps mDocProps;
+ DocPropsByName mNamedDocProps;
+
+ public:
+ BuiltInPropertiesImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : m_xParent( xParent ), m_xContext( xContext ), m_xModel( xModel )
+ {
+ BuiltInIndexHelper builtIns( m_xModel );
+ for ( sal_Int32 index = word::WdBuiltInProperty::wdPropertyTitle; index <= word::WdBuiltInProperty::wdPropertyCharsWSpaces; ++index )
+ {
+ mDocProps[ index ] = new SwVbaBuiltInDocumentProperty( xParent, xContext, builtIns.getDocPropInfoMap()[ index ] );
+ mNamedDocProps[ mDocProps[ index ]->getName() ] = mDocProps[ index ];
+ }
+ }
+// XIndexAccess
+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
+ {
+ return mDocProps.size();
+ }
+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException )
+ {
+ // correct the correct by the base class for 1 based indices
+ DocProps::iterator it = mDocProps.find( ++Index );
+ if ( it == mDocProps.end() )
+ throw lang::IndexOutOfBoundsException();
+ return uno::makeAny( it->second );
+ }
+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ if ( !hasByName( aName ) )
+ throw container::NoSuchElementException();
+ DocPropsByName::iterator it = mNamedDocProps.find( aName );
+ return uno::Any( it->second );
+
+ }
+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
+ {
+ uno::Sequence< rtl::OUString > aNames( getCount() );
+ rtl::OUString* pName = aNames.getArray();
+ DocPropsByName::iterator it_end = mNamedDocProps.end();
+ for( DocPropsByName::iterator it = mNamedDocProps.begin(); it != it_end; ++it, ++pName )
+ *pName = it->first;
+ return aNames;
+ }
+
+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
+ {
+ DocPropsByName::iterator it = mNamedDocProps.find( aName );
+ if ( it == mNamedDocProps.end() )
+ return sal_False;
+ return sal_True;
+ }
+// XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
+ {
+ return XDocumentProperty::static_type(0);
+ }
+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
+ {
+ return mDocProps.size() > 0;
+ }
+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
+ {
+ return new DocPropEnumeration( mDocProps );
+ }
+};
+
+SwVbaBuiltinDocumentProperties::SwVbaBuiltinDocumentProperties( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaDocumentproperties_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new BuiltInPropertiesImpl( xParent, xContext, xModel ) ) ), m_xModel( xModel )
+{
+}
+
+uno::Reference< XDocumentProperty > SAL_CALL
+SwVbaBuiltinDocumentProperties::Add( const ::rtl::OUString& /*Name*/, ::sal_Bool /*LinkToContent*/, ::sal_Int8 /*Type*/, const uno::Any& /*value*/, const uno::Any& /*LinkSource*/ ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ throw uno::RuntimeException(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("not supported for Builtin properties") ), uno::Reference< uno::XInterface >() );
+}
+
+// XEnumerationAccess
+uno::Type SAL_CALL
+SwVbaBuiltinDocumentProperties::getElementType() throw (uno::RuntimeException)
+{
+ return XDocumentProperty::static_type(0);
+}
+
+uno::Reference< container::XEnumeration > SAL_CALL
+SwVbaBuiltinDocumentProperties::createEnumeration() throw (uno::RuntimeException)
+{
+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
+ return xEnumAccess->createEnumeration();
+}
+
+// ScVbaCollectionBaseImpl
+uno::Any
+SwVbaBuiltinDocumentProperties::createCollectionObject( const uno::Any& aSource )
+{
+ // pass through
+ return aSource;
+}
+
+// XHelperInterface
+rtl::OUString&
+SwVbaBuiltinDocumentProperties::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBuiltinDocumentProperties") );
+ return sImplName;
+}
+
+uno::Sequence<rtl::OUString>
+SwVbaBuiltinDocumentProperties::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.DocumentProperties" ) );
+ }
+ return aServiceNames;
+}
+
+class CustomPropertiesImpl : public PropertiesImpl_BASE
+{
+ uno::Reference< XHelperInterface > m_xParent;
+ uno::Reference< uno::XComponentContext > m_xContext;
+ uno::Reference< frame::XModel > m_xModel;
+ uno::Reference< beans::XPropertySet > mxUserDefinedProp;
+ boost::shared_ptr< PropertGetSetHelper > mpPropGetSetHelper;
+public:
+ CustomPropertiesImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : m_xParent( xParent ), m_xContext( xContext ), m_xModel( xModel )
+ {
+ // suck in the document( custom ) properties
+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( m_xModel, uno::UNO_QUERY_THROW );
+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
+ uno::Reference< document::XDocumentProperties > xDocProp( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
+ mxUserDefinedProp.set( xDocProp->getUserDefinedProperties(), uno::UNO_QUERY_THROW );
+ mpPropGetSetHelper.reset( new CustomPropertyGetSetHelper( m_xModel ) );
+ };
+ // XIndexAccess
+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
+ {
+ return mxUserDefinedProp->getPropertySetInfo()->getProperties().getLength();
+ }
+
+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException )
+ {
+ uno::Sequence< beans::Property > aProps = mxUserDefinedProp->getPropertySetInfo()->getProperties();
+ if ( Index >= aProps.getLength() )
+ throw lang::IndexOutOfBoundsException();
+ // How to determine type e.g Date? ( com.sun.star.util.DateTime )
+ DocPropInfo aPropInfo = DocPropInfo::createDocPropInfo( aProps[ Index ].Name, aProps[ Index ].Name, mpPropGetSetHelper );
+ return uno::makeAny( uno::Reference< XDocumentProperty >( new SwVbaCustomDocumentProperty( m_xParent, m_xContext, aPropInfo ) ) );
+ }
+
+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ if ( !hasByName( aName ) )
+ throw container::NoSuchElementException();
+
+ DocPropInfo aPropInfo = DocPropInfo::createDocPropInfo( aName, aName, mpPropGetSetHelper );
+ return uno::makeAny( uno::Reference< XDocumentProperty >( new SwVbaCustomDocumentProperty( m_xParent, m_xContext, aPropInfo ) ) );
+ }
+
+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
+ {
+ uno::Sequence< beans::Property > aProps = mxUserDefinedProp->getPropertySetInfo()->getProperties();
+ uno::Sequence< rtl::OUString > aNames( aProps.getLength() );
+ rtl::OUString* pString = aNames.getArray();
+ rtl::OUString* pEnd = ( pString + aNames.getLength() );
+ beans::Property* pProp = aProps.getArray();
+ for ( ; pString != pEnd; ++pString, ++pProp )
+ *pString = pProp->Name;
+ return aNames;
+ }
+
+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
+ {
+ OSL_TRACE("hasByName(%s) returns %d", rtl::OUStringToOString( aName, RTL_TEXTENCODING_UTF8 ).getStr(), mxUserDefinedProp->getPropertySetInfo()->hasPropertyByName( aName ) );
+ return mxUserDefinedProp->getPropertySetInfo()->hasPropertyByName( aName );
+ }
+
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
+ {
+ return XDocumentProperty::static_type(0);
+ }
+
+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
+ {
+ return getCount() > 0;
+ }
+
+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
+ {
+ // create a map of properties ( the key doesn't matter )
+ OSL_TRACE("Creating an enumeration");
+ sal_Int32 key = 0;
+ sal_Int32 nElem = getCount();
+ DocProps simpleDocPropSnapShot;
+ for ( ; key < nElem; ++key )
+ simpleDocPropSnapShot[ key ].set( getByIndex( key ), uno::UNO_QUERY_THROW );
+ OSL_TRACE("After creating the enumeration");
+ return new DocPropEnumeration( simpleDocPropSnapShot );
+ }
+
+ void addProp( const ::rtl::OUString& Name, ::sal_Int8 /*Type*/, const uno::Any& Value )
+ {
+ sal_Int16 attributes = 128;
+ uno::Reference< beans::XPropertyContainer > xContainer( mxUserDefinedProp, uno::UNO_QUERY_THROW );
+ // TODO fixme, perform the necessary Type Value conversions
+ xContainer->addProperty( Name, attributes, Value );
+ }
+
+};
+
+
+SwVbaCustomDocumentProperties::SwVbaCustomDocumentProperties( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaBuiltinDocumentProperties( xParent, xContext, xModel )
+{
+ // replace the m_xIndexAccess implementation ( we need a virtual init )
+ m_xIndexAccess.set( new CustomPropertiesImpl( xParent, xContext, xModel ) );
+ m_xNameAccess.set( m_xIndexAccess, uno::UNO_QUERY_THROW );
+}
+
+uno::Reference< XDocumentProperty > SAL_CALL
+SwVbaCustomDocumentProperties::Add( const ::rtl::OUString& Name, ::sal_Bool LinkToContent, ::sal_Int8 Type, const uno::Any& Value, const uno::Any& LinkSource ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ CustomPropertiesImpl* pCustomProps = dynamic_cast< CustomPropertiesImpl* > ( m_xIndexAccess.get() );
+ uno::Reference< XDocumentProperty > xDocProp;
+ if ( pCustomProps )
+ {
+ rtl::OUString sLinkSource;
+ pCustomProps->addProp( Name, Type, Value );
+
+ xDocProp.set( m_xNameAccess->getByName( Name ), uno::UNO_QUERY_THROW );
+ xDocProp->setLinkToContent( LinkToContent );
+
+ if ( LinkSource >>= sLinkSource )
+ xDocProp->setLinkSource( sLinkSource );
+ }
+ return xDocProp;
+}
+
+// XHelperInterface
+rtl::OUString&
+SwVbaCustomDocumentProperties::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaCustomDocumentProperties") );
+ return sImplName;
+}
diff --git a/sw/source/ui/vba/vbadocumentproperties.hxx b/sw/source/ui/vba/vbadocumentproperties.hxx
new file mode 100644
index 000000000000..5159ea580601
--- /dev/null
+++ b/sw/source/ui/vba/vbadocumentproperties.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_DOCUMENTPROPERTIES_HXX
+#define SW_VBA_DOCUMENTPROPERTIES_HXX
+
+#include <ooo/vba/XDocumentProperties.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <vbahelper/vbacollectionimpl.hxx>
+#include <hash_map>
+
+typedef CollTestImplHelper< ov::XDocumentProperties > SwVbaDocumentproperties_BASE;
+
+class SwVbaBuiltinDocumentProperties : public SwVbaDocumentproperties_BASE
+{
+protected:
+ css::uno::Reference< css::frame::XModel > m_xModel;
+public:
+ SwVbaBuiltinDocumentProperties( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xDocument );
+
+ // XDocumentProperties
+ virtual css::uno::Reference< ::ooo::vba::XDocumentProperty > SAL_CALL Add( const ::rtl::OUString& Name, ::sal_Bool LinkToContent, ::sal_Int8 Type, const css::uno::Any& Value, const css::uno::Any& LinkSource ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+ // ScVbaCollectionBaseImpl
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+class SwVbaCustomDocumentProperties : public SwVbaBuiltinDocumentProperties
+{
+public:
+ SwVbaCustomDocumentProperties( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xDocument );
+// XDocumentProperties
+ virtual css::uno::Reference< ::ooo::vba::XDocumentProperty > SAL_CALL Add( const ::rtl::OUString& Name, ::sal_Bool LinkToContent, ::sal_Int8 Type, const css::uno::Any& Value, const css::uno::Any& LinkSource ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+};
+
+#endif /* SW_VBA_DOCUMENTPROPERTY_HXX */
diff --git a/sw/source/ui/vba/vbadocuments.cxx b/sw/source/ui/vba/vbadocuments.cxx
new file mode 100644
index 000000000000..195adb2ffca4
--- /dev/null
+++ b/sw/source/ui/vba/vbadocuments.cxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <comphelper/processfactory.hxx>
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase3.hxx>
+
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/beans/PropertyVetoException.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/document/XTypeDetection.hpp>
+#include <com/sun/star/uri/XUriReference.hpp>
+#include <com/sun/star/uri/XUriReferenceFactory.hpp>
+
+#include <sfx2/objsh.hxx>
+#include <tools/urlobj.hxx>
+
+#include "vbaglobals.hxx"
+#include "vbadocument.hxx"
+#include "vbadocuments.hxx"
+#include <vbahelper/vbahelper.hxx>
+
+#include <hash_map>
+#include <osl/file.hxx>
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+static uno::Any
+getDocument( uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< text::XTextDocument > &xDoc, const uno::Any& aApplication )
+{
+ // FIXME: fine as long as SwVbaDocument is stateless ...
+ uno::Reference< frame::XModel > xModel( xDoc, uno::UNO_QUERY );
+ if( !xModel.is() )
+ return uno::Any();
+
+ SwVbaDocument *pWb = new SwVbaDocument( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xModel );
+ return uno::Any( uno::Reference< word::XDocument > (pWb) );
+}
+
+class DocumentEnumImpl : public EnumerationHelperImpl
+{
+ uno::Any m_aApplication;
+public:
+ DocumentEnumImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Any& aApplication ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ), m_aApplication( aApplication ) {}
+
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ uno::Reference< text::XTextDocument > xDoc( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
+ return getDocument( m_xContext, xDoc, m_aApplication );
+ }
+};
+
+SwVbaDocuments::SwVbaDocuments( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : SwVbaDocuments_BASE( xParent, xContext, VbaDocumentsBase::WORD_DOCUMENT )
+{
+}
+// XEnumerationAccess
+uno::Type
+SwVbaDocuments::getElementType() throw (uno::RuntimeException)
+{
+ return word::XDocument::static_type(0);
+}
+uno::Reference< container::XEnumeration >
+SwVbaDocuments::createEnumeration() throw (uno::RuntimeException)
+{
+ // #FIXME its possible the DocumentEnumImpl here doens't reflect
+ // the state of this object ( although it should ) would be
+ // safer to create an enumeration based on this objects state
+ // rather than one effectively based of the desktop component
+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
+ return new DocumentEnumImpl( mxParent, mxContext, xEnumerationAccess->createEnumeration(), Application() );
+}
+
+uno::Any
+SwVbaDocuments::createCollectionObject( const uno::Any& aSource )
+{
+ uno::Reference< text::XTextDocument > xDoc( aSource, uno::UNO_QUERY_THROW );
+ return getDocument( mxContext, xDoc, Application() );
+}
+
+uno::Any SAL_CALL
+SwVbaDocuments::Add( const uno::Any& Template, const uno::Any& /*NewTemplate*/, const uno::Any& /*DocumentType*/, const uno::Any& /*Visible*/ ) throw (uno::RuntimeException)
+{
+ rtl::OUString sFileName;
+ if( Template.hasValue() && ( Template >>= sFileName ) )
+ {
+ return Open( sFileName, uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any());
+ }
+ uno::Reference <text::XTextDocument> xTextDoc( createDocument() , uno::UNO_QUERY_THROW );
+
+ if( xTextDoc.is() )
+ return getDocument( mxContext, xTextDoc, Application() );
+ return uno::Any();
+}
+
+// #TODO# #FIXME# can any of the unused params below be used?
+void SAL_CALL
+SwVbaDocuments::Close( const uno::Any& /*SaveChanges*/, const uno::Any& /*OriginalFormat*/, const uno::Any& /*RouteDocument*/ ) throw (uno::RuntimeException)
+{
+ closeDocuments();
+}
+
+// #TODO# #FIXME# can any of the unused params below be used?
+uno::Any SAL_CALL
+SwVbaDocuments::Open( const ::rtl::OUString& Filename, const uno::Any& /*ConfirmConversions*/, const uno::Any& ReadOnly, const uno::Any& /*AddToRecentFiles*/, const uno::Any& /*PasswordDocument*/, const uno::Any& /*PasswordTemplate*/, const uno::Any& /*Revert*/, const uno::Any& /*WritePasswordDocument*/, const uno::Any& /*WritePasswordTemplate*/, const uno::Any& /*Format*/, const uno::Any& /*Encoding*/, const uno::Any& /*Visible*/, const uno::Any& /*OpenAndRepair*/, const uno::Any& /*DocumentDirection*/, const uno::Any& /*NoEncodingDialog*/, const uno::Any& /*XMLTransform*/ ) throw (uno::RuntimeException)
+{
+ // we need to detect if this is a URL, if not then assume its a file path
+ rtl::OUString aURL;
+ INetURLObject aObj;
+ aObj.SetURL( Filename );
+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
+ if ( bIsURL )
+ aURL = Filename;
+ else
+ osl::FileBase::getFileURLFromSystemPath( Filename, aURL );
+
+ uno::Sequence< beans::PropertyValue > sProps(0);
+
+ uno::Reference <text::XTextDocument> xSpreadDoc( openDocument( Filename, ReadOnly, sProps ), uno::UNO_QUERY_THROW );
+ uno::Any aRet = getDocument( mxContext, xSpreadDoc, Application() );
+ uno::Reference< word::XDocument > xDocument( aRet, uno::UNO_QUERY );
+ if ( xDocument.is() )
+ xDocument->Activate();
+ return aRet;
+}
+
+rtl::OUString&
+SwVbaDocuments::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDocuments") );
+ return sImplName;
+}
+
+uno::Sequence<rtl::OUString>
+SwVbaDocuments::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > sNames;
+ if ( sNames.getLength() == 0 )
+ {
+ sNames.realloc( 1 );
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Documents") );
+ }
+ return sNames;
+}
diff --git a/sw/source/ui/vba/vbadocuments.hxx b/sw/source/ui/vba/vbadocuments.hxx
new file mode 100644
index 000000000000..dc0f75543979
--- /dev/null
+++ b/sw/source/ui/vba/vbadocuments.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_DOCUMENTS_HXX
+#define SW_VBA_DOCUMENTS_HXX
+
+
+#include <vbahelper/vbacollectionimpl.hxx>
+#include <ooo/vba/word/XDocuments.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <vbahelper/vbadocumentsbase.hxx>
+#include "wordvbahelper.hxx"
+
+
+typedef cppu::ImplInheritanceHelper1< VbaDocumentsBase, ov::word::XDocuments > SwVbaDocuments_BASE;
+
+class SwVbaDocuments : public SwVbaDocuments_BASE
+{
+public:
+ SwVbaDocuments( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext );
+ virtual ~SwVbaDocuments() {}
+
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+
+ // SwVbaDocuments_BASE
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+
+ // Methods
+ virtual css::uno::Any SAL_CALL Add( const css::uno::Any& Template, const css::uno::Any& NewTemplate, const css::uno::Any& DocumentType, const css::uno::Any& Visible ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& ConfirmConversions, const css::uno::Any& ReadOnly, const css::uno::Any& AddToRecentFiles, const css::uno::Any& PasswordDocument, const css::uno::Any& PasswordTemplate, const css::uno::Any& Revert, const css::uno::Any& WritePasswordDocument, const css::uno::Any& WritePasswordTemplate, const css::uno::Any& Format, const css::uno::Any& Encoding, const css::uno::Any& Visible, const css::uno::Any& OpenAndRepair, const css::uno::Any& DocumentDirection, const css::uno::Any& NoEncodingDialog, const css::uno::Any& XMLTransform ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const css::uno::Any& OriginalFormat, const css::uno::Any& RouteDocument ) throw (css::uno::RuntimeException);
+};
+
+#endif /* SW_VBA_DOCUMENTS_HXX */
diff --git a/sw/source/ui/vba/vbaeventshelper.cxx b/sw/source/ui/vba/vbaeventshelper.cxx
new file mode 100755
index 000000000000..b2270b009ca9
--- /dev/null
+++ b/sw/source/ui/vba/vbaeventshelper.cxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "vbaeventshelper.hxx"
+#include <com/sun/star/script/vba/VBAEventId.hpp>
+#include <vbahelper/helperdecl.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::script::vba::VBAEventId;
+using namespace ::ooo::vba;
+
+// ============================================================================
+
+SwVbaEventsHelper::SwVbaEventsHelper( uno::Sequence< css::uno::Any > const& aArgs, uno::Reference< uno::XComponentContext > const& xContext ) :
+ VbaEventsHelperBase( aArgs, xContext )
+{
+ registerEventHandler( DOCUMENT_NEW, "Document_New", EVENTHANDLER_DOCUMENT );
+ registerEventHandler( AUTO_NEW, "AutoNew", EVENTHANDLER_GLOBAL );
+ registerEventHandler( DOCUMENT_OPEN, "Document_Open", EVENTHANDLER_DOCUMENT );
+ registerEventHandler( AUTO_OPEN, "AutoOpen", EVENTHANDLER_GLOBAL );
+ registerEventHandler( DOCUMENT_CLOSE, "Document_Close", EVENTHANDLER_DOCUMENT );
+ registerEventHandler( AUTO_CLOSE, "AutoClose", EVENTHANDLER_GLOBAL );
+}
+
+SwVbaEventsHelper::~SwVbaEventsHelper()
+{
+}
+
+bool SwVbaEventsHelper::implPrepareEvent( EventQueue& rEventQueue,
+ const EventHandlerInfo& rInfo, const uno::Sequence< uno::Any >& /*rArgs*/ ) throw (uno::RuntimeException)
+{
+ switch( rInfo.mnEventId )
+ {
+ case DOCUMENT_NEW:
+ rEventQueue.push_back( AUTO_NEW );
+ break;
+ case DOCUMENT_OPEN:
+ rEventQueue.push_back( AUTO_OPEN );
+ break;
+ case DOCUMENT_CLOSE:
+ rEventQueue.push_back( AUTO_CLOSE );
+ break;
+ }
+ return true;
+}
+
+uno::Sequence< uno::Any > SwVbaEventsHelper::implBuildArgumentList( const EventHandlerInfo& /*rInfo*/,
+ const uno::Sequence< uno::Any >& /*rArgs*/ ) throw (lang::IllegalArgumentException)
+{
+ // no event handler expects any arguments
+ return uno::Sequence< uno::Any >();
+}
+
+void SwVbaEventsHelper::implPostProcessEvent( EventQueue& /*rEventQueue*/,
+ const EventHandlerInfo& /*rInfo*/, bool /*bSuccess*/, bool /*bCancel*/ ) throw (uno::RuntimeException)
+{
+ // nothing to do after any event
+}
+
+::rtl::OUString SwVbaEventsHelper::implGetDocumentModuleName( const EventHandlerInfo& /*rInfo*/,
+ const uno::Sequence< uno::Any >& /*rArgs*/ ) const throw (lang::IllegalArgumentException)
+{
+ // TODO: get actual codename from document
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ThisDocument" ) );
+}
+
+// ============================================================================
+
+namespace vbaeventshelper
+{
+namespace sdecl = comphelper::service_decl;
+sdecl::class_<SwVbaEventsHelper, sdecl::with_args<true> > serviceImpl;
+extern sdecl::ServiceDecl const serviceDecl(
+ serviceImpl,
+ "SwVbaEventsHelper",
+ "com.sun.star.document.vba.VBATextEventProcessor" );
+}
+
+// ============================================================================
diff --git a/sw/source/ui/vba/vbaeventshelper.hxx b/sw/source/ui/vba/vbaeventshelper.hxx
new file mode 100755
index 000000000000..7f951bdaa452
--- /dev/null
+++ b/sw/source/ui/vba/vbaeventshelper.hxx
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_VBAEVENTS_HXX
+#define SW_VBAEVENTS_HXX
+
+#include <vbahelper/vbaeventshelperbase.hxx>
+
+// ============================================================================
+
+class SwVbaEventsHelper : public VbaEventsHelperBase
+{
+public:
+ SwVbaEventsHelper(
+ const css::uno::Sequence< css::uno::Any >& rArgs,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext );
+ virtual ~SwVbaEventsHelper();
+
+protected:
+ virtual bool implPrepareEvent( EventQueue& rEventQueue, const EventHandlerInfo& rInfo, const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::uno::RuntimeException);
+ virtual css::uno::Sequence< css::uno::Any > implBuildArgumentList( const EventHandlerInfo& rInfo, const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException);
+ virtual void implPostProcessEvent( EventQueue& rEventQueue, const EventHandlerInfo& rInfo, bool bSuccess, bool bCancel ) throw (css::uno::RuntimeException);
+ virtual ::rtl::OUString implGetDocumentModuleName( const EventHandlerInfo& rInfo, const css::uno::Sequence< css::uno::Any >& rArgs ) const throw (css::lang::IllegalArgumentException);
+};
+
+// ============================================================================
+
+#endif
+
diff --git a/sw/source/ui/vba/vbafield.cxx b/sw/source/ui/vba/vbafield.cxx
new file mode 100644
index 000000000000..a33b3c208c8f
--- /dev/null
+++ b/sw/source/ui/vba/vbafield.cxx
@@ -0,0 +1,478 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbafield.hxx"
+#include "vbarange.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <ooo/vba/word/WdFieldType.hpp>
+#include <com/sun/star/text/FilenameDisplayFormat.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+#include <swtypes.hxx>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+// *** SwVbaField ***********************************************
+
+SwVbaField::SwVbaField( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const uno::Reference< css::text::XTextField >& xTextField) throw ( uno::RuntimeException ) : SwVbaField_BASE( rParent, rContext ), mxTextDocument( rDocument )
+{
+ mxTextField.set( xTextField, uno::UNO_QUERY_THROW );
+}
+
+// XHelperInterface
+rtl::OUString&
+SwVbaField::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaField") );
+ return sImplName;
+}
+
+uno::Sequence<rtl::OUString>
+SwVbaField::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Field" ) );
+ }
+ return aServiceNames;
+}
+
+// *** _ReadFieldParams ***********************************************
+// the codes are copied from ww8par5.cxx
+class _ReadFieldParams
+{
+private:
+ String aData;
+ xub_StrLen nLen, nFnd, nNext, nSavPtr;
+ String aFieldName;
+public:
+ _ReadFieldParams( const String& rData );
+ ~_ReadFieldParams();
+
+ xub_StrLen GoToTokenParam();
+ long SkipToNextToken();
+ xub_StrLen GetTokenSttPtr() const { return nFnd; }
+
+ xub_StrLen FindNextStringPiece( xub_StrLen _nStart = STRING_NOTFOUND );
+ bool GetTokenSttFromTo(xub_StrLen* _pFrom, xub_StrLen* _pTo,
+ xub_StrLen _nMax);
+
+ String GetResult() const;
+ String GetFieldName()const { return aFieldName; }
+};
+
+
+_ReadFieldParams::_ReadFieldParams( const String& _rData )
+ : aData( _rData ), nLen( _rData.Len() ), nNext( 0 )
+{
+ /*
+ erstmal nach einer oeffnenden Klammer oder einer Leerstelle oder einem
+ Anfuehrungszeichen oder einem Backslash suchen, damit der Feldbefehl
+ (also INCLUDEPICTURE bzw EINFUeGENGRAFIK bzw ...) ueberlesen wird
+ */
+ while( (nLen > nNext) && (aData.GetChar( nNext ) == ' ') )
+ ++nNext;
+
+ sal_Unicode c;
+ while( nLen > nNext
+ && (c = aData.GetChar( nNext )) != ' '
+ && c != '"'
+ && c != '\\'
+ && c != 132
+ && c != 0x201c )
+ ++nNext;
+
+ nFnd = nNext;
+ nSavPtr = nNext;
+ aFieldName = aData.Copy( 0, nFnd );
+// cLastChar = aData.GetChar( nSavPtr );
+}
+
+
+_ReadFieldParams::~_ReadFieldParams()
+{
+// aData.SetChar( nSavPtr, cLastChar );
+}
+
+
+String _ReadFieldParams::GetResult() const
+{
+ return (STRING_NOTFOUND == nFnd)
+ ? aEmptyStr
+ : aData.Copy( nFnd, (nSavPtr - nFnd) );
+}
+
+
+xub_StrLen _ReadFieldParams::GoToTokenParam()
+{
+ xub_StrLen nOld = nNext;
+ if( -2 == SkipToNextToken() )
+ return GetTokenSttPtr();
+ nNext = nOld;
+ return STRING_NOTFOUND;
+}
+
+// ret: -2: NOT a '\' parameter but normal Text
+long _ReadFieldParams::SkipToNextToken()
+{
+ long nRet = -1; // Ende
+ if (
+ (STRING_NOTFOUND != nNext) && (nLen > nNext) &&
+ STRING_NOTFOUND != (nFnd = FindNextStringPiece(nNext))
+ )
+ {
+ nSavPtr = nNext;
+
+ if ('\\' == aData.GetChar(nFnd) && '\\' != aData.GetChar(nFnd + 1))
+ {
+ nRet = aData.GetChar(++nFnd);
+ nNext = ++nFnd; // und dahinter setzen
+ }
+ else
+ {
+ nRet = -2;
+ if (
+ (STRING_NOTFOUND != nSavPtr ) &&
+ (
+ ('"' == aData.GetChar(nSavPtr - 1)) ||
+ (0x201d == aData.GetChar(nSavPtr - 1))
+ )
+ )
+ {
+ --nSavPtr;
+ }
+ }
+ }
+ return nRet;
+}
+
+// FindNextPara sucht naechsten Backslash-Parameter oder naechste Zeichenkette
+// bis zum Blank oder naechsten "\" oder zum schliessenden Anfuehrungszeichen
+// oder zum String-Ende von pStr.
+//
+// Ausgabe ppNext (falls ppNext != 0) Suchbeginn fuer naechsten Parameter bzw. 0
+//
+// Returnwert: 0 falls String-Ende erreicht,
+// ansonsten Anfang des Paramters bzw. der Zeichenkette
+//
+xub_StrLen _ReadFieldParams::FindNextStringPiece(const xub_StrLen nStart)
+{
+ xub_StrLen n = ( STRING_NOTFOUND == nStart ) ? nFnd : nStart; // Anfang
+ xub_StrLen n2; // Ende
+
+ nNext = STRING_NOTFOUND; // Default fuer nicht gefunden
+
+ while( (nLen > n) && (aData.GetChar( n ) == ' ') )
+ ++n;
+
+ if( nLen == n )
+ return STRING_NOTFOUND; // String End reached!
+
+ if( (aData.GetChar( n ) == '"') // Anfuehrungszeichen vor Para?
+ || (aData.GetChar( n ) == 0x201c)
+ || (aData.GetChar( n ) == 132) )
+ {
+ n++; // Anfuehrungszeichen ueberlesen
+ n2 = n; // ab hier nach Ende suchen
+ while( (nLen > n2)
+ && (aData.GetChar( n2 ) != '"')
+ && (aData.GetChar( n2 ) != 0x201d)
+ && (aData.GetChar( n2 ) != 147) )
+ n2++; // Ende d. Paras suchen
+ }
+ else // keine Anfuehrungszeichen
+ {
+ n2 = n; // ab hier nach Ende suchen
+ while( (nLen > n2) && (aData.GetChar( n2 ) != ' ') ) // Ende d. Paras suchen
+ {
+ if( aData.GetChar( n2 ) == '\\' )
+ {
+ if( aData.GetChar( n2+1 ) == '\\' )
+ n2 += 2; // Doppel-Backslash -> OK
+ else
+ {
+ if( n2 > n )
+ n2--;
+ break; // einfach-Backslash -> Ende
+ }
+ }
+ else
+ n2++; // kein Backslash -> OK
+ }
+ }
+ if( nLen > n2 )
+ {
+ if(aData.GetChar( n2 ) != ' ') n2++;
+ nNext = n2;
+ }
+ return n;
+}
+
+
+
+// read parameters "1-3" or 1-3 with both values between 1 and nMax
+bool _ReadFieldParams::GetTokenSttFromTo(USHORT* pFrom, USHORT* pTo, USHORT nMax)
+{
+ USHORT nStart = 0;
+ USHORT nEnd = 0;
+ xub_StrLen n = GoToTokenParam();
+ if( STRING_NOTFOUND != n )
+ {
+
+ String sParams( GetResult() );
+
+ xub_StrLen nIndex = 0;
+ String sStart( sParams.GetToken(0, '-', nIndex) );
+ if( STRING_NOTFOUND != nIndex )
+ {
+ nStart = static_cast<USHORT>(sStart.ToInt32());
+ nEnd = static_cast<USHORT>(sParams.Copy(nIndex).ToInt32());
+ }
+ }
+ if( pFrom ) *pFrom = nStart;
+ if( pTo ) *pTo = nEnd;
+
+ return nStart && nEnd && (nMax >= nStart) && (nMax >= nEnd);
+}
+
+// *** SwVbaFields ***********************************************
+
+uno::Any lcl_createField( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel, const uno::Any& aSource )
+{
+ uno::Reference< text::XTextField > xTextField( aSource, uno::UNO_QUERY_THROW );
+ uno::Reference< text::XTextDocument > xTextDocument( xModel, uno::UNO_QUERY_THROW );
+ uno::Reference< word::XField > xField( new SwVbaField( xParent, xContext, xTextDocument, xTextField ) );
+ return uno::makeAny( xField );
+}
+
+typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > FieldEnumeration_BASE;
+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > FieldCollectionHelper_BASE;
+
+class FieldEnumeration : public FieldEnumeration_BASE
+{
+ uno::Reference< XHelperInterface > mxParent;
+ uno::Reference< uno::XComponentContext > mxContext;
+ uno::Reference< frame::XModel > mxModel;
+ uno::Reference< container::XEnumeration > mxEnumeration;
+public:
+ FieldEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< container::XEnumeration >& xEnumeration ) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ), mxEnumeration( xEnumeration )
+ {
+ }
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
+ {
+ return mxEnumeration->hasMoreElements();
+ }
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ if ( !hasMoreElements() )
+ throw container::NoSuchElementException();
+ return lcl_createField( mxParent, mxContext, mxModel, mxEnumeration->nextElement() );
+ }
+};
+
+class FieldCollectionHelper : public FieldCollectionHelper_BASE
+{
+ uno::Reference< XHelperInterface > mxParent;
+ uno::Reference< uno::XComponentContext > mxContext;
+ uno::Reference< frame::XModel > mxModel;
+ uno::Reference< container::XEnumerationAccess > mxEnumerationAccess;
+public:
+ FieldCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) throw (css::uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel )
+ {
+ uno::Reference< text::XTextFieldsSupplier > xSupp( xModel, uno::UNO_QUERY_THROW );
+ mxEnumerationAccess.set( xSupp->getTextFields(), uno::UNO_QUERY_THROW );
+ }
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return mxEnumerationAccess->getElementType(); }
+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return mxEnumerationAccess->hasElements(); }
+ // XIndexAccess
+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
+ {
+ uno::Reference< container::XEnumeration > xEnumeration = mxEnumerationAccess->createEnumeration();
+ sal_Int32 nCount = 0;
+ while( xEnumeration->hasMoreElements() )
+ {
+ ++nCount;
+ xEnumeration->nextElement();
+ }
+ return nCount;
+ }
+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
+ {
+ if( Index < 0 || Index >= getCount() )
+ throw lang::IndexOutOfBoundsException();
+
+ uno::Reference< container::XEnumeration > xEnumeration = mxEnumerationAccess->createEnumeration();
+ sal_Int32 nCount = 0;
+ while( xEnumeration->hasMoreElements() )
+ {
+ if( nCount == Index )
+ {
+ return xEnumeration->nextElement();
+ }
+ ++nCount;
+ }
+ throw lang::IndexOutOfBoundsException();
+ }
+ // XEnumerationAccess
+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
+ {
+ uno::Reference< container::XEnumeration > xEnumeration = mxEnumerationAccess->createEnumeration();
+ return uno::Reference< container::XEnumeration >( new FieldEnumeration( mxParent, mxContext, mxModel, xEnumeration ) );
+ }
+};
+
+SwVbaFields::SwVbaFields( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaFields_BASE( xParent, xContext , uno::Reference< container::XIndexAccess >( new FieldCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel )
+{
+ mxMSF.set( mxModel, uno::UNO_QUERY_THROW );
+}
+
+uno::Reference< word::XField > SAL_CALL
+SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& Type, const css::uno::Any& Text, const css::uno::Any& /*PreserveFormatting*/ ) throw (css::uno::RuntimeException)
+{
+ sal_Int32 nType = word::WdFieldType::wdFieldEmpty;
+ Type >>= nType;
+ rtl::OUString sText;
+ Text >>= sText;
+
+ String sFieldName;
+ if( ( nType == word::WdFieldType::wdFieldEmpty ) && ( sText.getLength() > 0 ) )
+ {
+ _ReadFieldParams aReadParam(sText);
+ sFieldName = aReadParam.GetFieldName();
+ }
+
+ uno::Reference< text::XTextContent > xTextField;
+ if( nType == word::WdFieldType::wdFieldFileName || sFieldName.EqualsIgnoreCaseAscii("FILENAME") )
+ {
+ xTextField.set( Create_Field_FileName( sText ), uno::UNO_QUERY_THROW );
+ }
+ else
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+ }
+
+ SwVbaRange* pVbaRange = dynamic_cast< SwVbaRange* >( Range.get() );
+ uno::Reference< text::XTextRange > xTextRange = pVbaRange->getXTextRange();
+ uno::Reference< text::XText > xText = xTextRange->getText();
+ xText->insertTextContent( xTextRange, xTextField, true );
+ return uno::Reference< word::XField >( new SwVbaField( mxParent, mxContext, uno::Reference< text::XTextDocument >( mxModel, uno::UNO_QUERY_THROW ), uno::Reference< text::XTextField >( xTextField, uno::UNO_QUERY_THROW ) ) );
+}
+
+uno::Reference< text::XTextField > SwVbaFields::Create_Field_FileName( const rtl::OUString _text ) throw (uno::RuntimeException)
+{
+ uno::Reference< text::XTextField > xTextField( mxMSF->createInstance( rtl::OUString::createFromAscii("com.sun.star.text.TextField.FileName") ), uno::UNO_QUERY_THROW );
+ sal_Int16 nFileFormat = text::FilenameDisplayFormat::NAME_AND_EXT;
+ if( _text.getLength() > 0 )
+ {
+ long nRet;
+ _ReadFieldParams aReadParam( _text );
+ while (-1 != (nRet = aReadParam.SkipToNextToken()))
+ {
+ switch (nRet)
+ {
+ case 'p':
+ nFileFormat = text::FilenameDisplayFormat::FULL;
+ break;
+ case '*':
+ //Skip over MERGEFORMAT
+ aReadParam.SkipToNextToken();
+ break;
+ default:
+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
+ break;
+ }
+ }
+ }
+
+ uno::Reference< beans::XPropertySet > xProps( xTextField, uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FileFormat") ), uno::makeAny( nFileFormat ) );
+
+ return xTextField;
+}
+
+uno::Reference< container::XEnumeration > SAL_CALL
+SwVbaFields::createEnumeration() throw (uno::RuntimeException)
+{
+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
+ return xEnumerationAccess->createEnumeration();
+}
+
+// ScVbaCollectionBaseImpl
+uno::Any
+SwVbaFields::createCollectionObject( const uno::Any& aSource )
+{
+ return lcl_createField( mxParent, mxContext, mxModel, aSource );
+}
+
+sal_Int32 SAL_CALL SwVbaFields::Update() throw (uno::RuntimeException)
+{
+ sal_Int32 nUpdate = 1;
+ try
+ {
+ uno::Reference< text::XTextFieldsSupplier > xSupp( mxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< util::XRefreshable > xRef( xSupp->getTextFields(), uno::UNO_QUERY_THROW );
+ xRef->refresh();
+ nUpdate = 0;
+ }catch( uno::Exception )
+ {
+ nUpdate = 1;
+ }
+ return nUpdate;
+}
+
+// XHelperInterface
+rtl::OUString&
+SwVbaFields::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFields") );
+ return sImplName;
+}
+
+// XEnumerationAccess
+uno::Type SAL_CALL
+SwVbaFields::getElementType() throw (uno::RuntimeException)
+{
+ return word::XField::static_type(0);
+}
+
+uno::Sequence<rtl::OUString>
+SwVbaFields::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Fields" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbafield.hxx b/sw/source/ui/vba/vbafield.hxx
new file mode 100644
index 000000000000..3c55acf73e9d
--- /dev/null
+++ b/sw/source/ui/vba/vbafield.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_FIELD_HXX
+#define SW_VBA_FIELD_HXX
+#include <vbahelper/vbahelperinterface.hxx>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <ooo/vba/word/XField.hpp>
+#include <ooo/vba/word/XFields.hpp>
+#include <vbahelper/vbacollectionimpl.hxx>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XField > SwVbaField_BASE;
+
+class SwVbaField : public SwVbaField_BASE
+{
+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
+ css::uno::Reference< css::text::XTextField > mxTextField;
+public:
+ SwVbaField( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const css::uno::Reference< css::text::XTextField >& xTextField) throw ( css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+// *** SwVbaFields ***********************************************
+
+typedef CollTestImplHelper< ov::word::XFields > SwVbaFields_BASE;
+
+class SwVbaFields : public SwVbaFields_BASE
+{
+ css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
+private:
+ css::uno::Reference< css::text::XTextField > Create_Field_FileName( const rtl::OUString _text ) throw (css::uno::RuntimeException);
+
+public:
+ SwVbaFields( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
+ // XFields
+ virtual css::uno::Reference< ::ooo::vba::word::XField > SAL_CALL Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& Type, const css::uno::Any& Text, const css::uno::Any& PreserveFormatting ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL Update() throw (css::uno::RuntimeException);
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+ // ScVbaCollectionBaseImpl
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif
diff --git a/sw/source/ui/vba/vbafind.cxx b/sw/source/ui/vba/vbafind.cxx
new file mode 100644
index 000000000000..fccf04181993
--- /dev/null
+++ b/sw/source/ui/vba/vbafind.cxx
@@ -0,0 +1,428 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbafind.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <tools/diagnose_ex.h>
+#include "vbareplacement.hxx"
+#include <ooo/vba/word/WdFindWrap.hpp>
+#include <ooo/vba/word/WdReplace.hpp>
+#include <com/sun/star/text/XTextRangeCompare.hpp>
+#include "wordvbahelper.hxx"
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaFind::SwVbaFind( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw ( uno::RuntimeException ) :
+ SwVbaFind_BASE( rParent, rContext ), mxModel( xModel ), mxTextRange( xTextRange ), mbReplace( sal_False ), mnReplaceType( word::WdReplace::wdReplaceOne ), mnWrap( word::WdFindWrap::wdFindStop )
+{
+ mxReplaceable.set( mxModel, uno::UNO_QUERY_THROW );
+ mxPropertyReplace.set( mxReplaceable->createReplaceDescriptor(), uno::UNO_QUERY_THROW );
+ mxTVC = word::getXTextViewCursor( mxModel );
+ mxSelSupp.set( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
+}
+
+SwVbaFind::~SwVbaFind()
+{
+}
+
+sal_Bool SwVbaFind::InRange( const uno::Reference< text::XTextRange >& xCurrentRange ) throw ( uno::RuntimeException )
+{
+ uno::Reference< text::XTextRangeCompare > xTRC( mxTextRange->getText(), uno::UNO_QUERY_THROW );
+ if( xTRC->compareRegionStarts( mxTextRange, xCurrentRange ) >= 0 && xTRC->compareRegionEnds( mxTextRange, xCurrentRange ) <= 0 )
+ return sal_True;
+ return sal_False;
+}
+
+sal_Bool SwVbaFind::InEqualRange( const uno::Reference< text::XTextRange >& xCurrentRange ) throw ( uno::RuntimeException )
+{
+ uno::Reference< text::XTextRangeCompare > xTRC( mxTextRange->getText(), uno::UNO_QUERY_THROW );
+ if( xTRC->compareRegionStarts( mxTextRange, xCurrentRange ) == 0 && xTRC->compareRegionEnds( mxTextRange, xCurrentRange ) == 0 )
+ return sal_True;
+ return sal_False;
+}
+
+void SwVbaFind::SetReplaceWith( const rtl::OUString& rText ) throw (uno::RuntimeException)
+{
+ mxPropertyReplace->setReplaceString( rText );
+ mbReplace = sal_True;
+}
+
+rtl::OUString SwVbaFind::GetReplaceWith() throw (uno::RuntimeException)
+{
+ return mxPropertyReplace->getReplaceString();
+}
+void SwVbaFind::SetReplace( sal_Int32 type )
+{
+ mnReplaceType = type;
+ mbReplace = sal_True;
+}
+#ifdef TOMORROW
+rtl::OUString SwVbaFind::ReplaceWildcards( const rtl::OUString& /*rText*/ ) throw ( uno::RuntimeException )
+{
+ // TODO:
+ return rtl::OUString();
+}
+#endif
+uno::Reference< text::XTextRange > SwVbaFind::FindOneElement() throw ( uno::RuntimeException )
+{
+ uno::Reference< text::XTextRange > xFoundOne;
+ if( mxTVC->getString().getLength() > 0 )
+ {
+ if( getForward() )
+ {
+ xFoundOne.set( mxReplaceable->findNext( mxTextRange->getStart(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY );
+ }
+ else
+ {
+ xFoundOne.set( mxReplaceable->findNext( mxTextRange->getEnd(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY );
+ }
+
+ if( xFoundOne.is() && InEqualRange( xFoundOne ) )
+ {
+ xFoundOne.set( mxReplaceable->findNext( xFoundOne, uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY );
+ }
+ else if( xFoundOne.is() && !InRange( xFoundOne ) )
+ {
+ xFoundOne = uno::Reference< text::XTextRange >();
+ }
+ }
+ else
+ {
+ xFoundOne.set( mxReplaceable->findNext( mxTextRange, uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY );
+ }
+
+ if( !xFoundOne.is() && ( getWrap() == word::WdFindWrap::wdFindContinue || getWrap() == word::WdFindWrap::wdFindAsk ) )
+ {
+ if( getForward() )
+ {
+ mxTVC->gotoStart(sal_False);
+ xFoundOne.set( mxReplaceable->findNext( mxTextRange->getStart(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY );
+ }
+ else
+ {
+ mxTVC->gotoEnd( sal_False );
+ xFoundOne.set( mxReplaceable->findNext( mxTextRange->getEnd(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY );
+
+ }
+ }
+ return xFoundOne;
+}
+
+sal_Bool SwVbaFind::SearchReplace() throw (uno::RuntimeException)
+{
+ sal_Bool result = sal_False;
+
+ // TODO: map wildcards in area to OOo wildcards
+
+ if( mbReplace )
+ {
+ switch( mnReplaceType )
+ {
+ case word::WdReplace::wdReplaceNone:
+ {
+ result = sal_True;
+ break;
+ }
+ case word::WdReplace::wdReplaceOne:
+ {
+ uno::Reference< text::XTextRange > xFindOne = FindOneElement();
+ if( xFindOne.is() )
+ {
+ xFindOne->setString( GetReplaceWith() );
+ result = mxSelSupp->select( uno::makeAny( xFindOne ) );
+ }
+ break;
+ }
+ case word::WdReplace::wdReplaceAll:
+ {
+ uno::Reference< container::XIndexAccess > xIndexAccess = mxReplaceable->findAll( uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) );
+ if( xIndexAccess->getCount() > 0 )
+ {
+ for( sal_Int32 i = 0; i < xIndexAccess->getCount(); i++ )
+ {
+ uno::Reference< text::XTextRange > xTextRange( xIndexAccess->getByIndex( i ), uno::UNO_QUERY_THROW );
+ if( mnWrap == word::WdFindWrap::wdFindContinue || mnWrap == word::WdFindWrap::wdFindAsk || InRange( xTextRange ) )
+ {
+ xTextRange->setString( GetReplaceWith() );
+ result = sal_True;
+ }
+ }
+ }
+ break;
+ }
+ default:
+ {
+ result = sal_False;
+ }
+ }
+ }
+ else
+ {
+ uno::Reference< text::XTextRange > xFindOne = FindOneElement();
+ if( xFindOne.is() )
+ result = mxSelSupp->select( uno::makeAny( xFindOne ) );
+ }
+
+ return result;
+}
+
+::rtl::OUString SAL_CALL SwVbaFind::getText() throw (uno::RuntimeException)
+{
+ return mxPropertyReplace->getSearchString();
+}
+
+void SAL_CALL SwVbaFind::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
+{
+ mxPropertyReplace->setSearchString( _text );
+}
+
+uno::Any SAL_CALL SwVbaFind::getReplacement() throw (uno::RuntimeException)
+{
+ return uno::makeAny( uno::Reference< word::XReplacement >( new SwVbaReplacement( this, mxContext, mxPropertyReplace ) ) );
+}
+
+void SAL_CALL SwVbaFind::setReplacement( const uno::Any& /*_replacement */ ) throw (uno::RuntimeException)
+{
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+}
+
+::sal_Bool SAL_CALL SwVbaFind::getForward() throw (uno::RuntimeException)
+{
+ sal_Bool bBackward = sal_False;
+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchBackwards") ) ) >>= bBackward;
+ return !bBackward;
+}
+
+void SAL_CALL SwVbaFind::setForward( ::sal_Bool _forward ) throw (uno::RuntimeException)
+{
+ sal_Bool bBackward = !_forward;
+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchBackwards") ), uno::makeAny( bBackward ) );
+}
+
+::sal_Int32 SAL_CALL SwVbaFind::getWrap() throw (uno::RuntimeException)
+{
+ // seems not supported in Writer
+ return mnWrap;
+}
+
+void SAL_CALL SwVbaFind::setWrap( ::sal_Int32 _wrap ) throw (uno::RuntimeException)
+{
+ // seems not supported in Writer
+ mnWrap = _wrap;
+}
+
+::sal_Bool SAL_CALL SwVbaFind::getFormat() throw (uno::RuntimeException)
+{
+ return mxPropertyReplace->getValueSearch();
+}
+
+void SAL_CALL SwVbaFind::setFormat( ::sal_Bool _format ) throw (uno::RuntimeException)
+{
+ mxPropertyReplace->setValueSearch( _format );
+}
+
+::sal_Bool SAL_CALL SwVbaFind::getMatchCase() throw (uno::RuntimeException)
+{
+ sal_Bool value = sal_False;
+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchCaseSensitive") ) ) >>= value;
+ return value;
+}
+
+void SAL_CALL SwVbaFind::setMatchCase( ::sal_Bool _matchcase ) throw (uno::RuntimeException)
+{
+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchCaseSensitive") ), uno::makeAny( _matchcase ) );
+}
+
+::sal_Bool SAL_CALL SwVbaFind::getMatchWholeWord() throw (uno::RuntimeException)
+{
+ sal_Bool value = sal_False;
+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchWords") ) ) >>= value;
+ return value;
+}
+
+void SAL_CALL SwVbaFind::setMatchWholeWord( ::sal_Bool _matchwholeword ) throw (uno::RuntimeException)
+{
+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchWords") ), uno::makeAny( _matchwholeword ) );
+}
+
+::sal_Bool SAL_CALL SwVbaFind::getMatchWildcards() throw (uno::RuntimeException)
+{
+ sal_Bool value = sal_False;
+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchRegularExpression") ) ) >>= value;
+ return value;
+}
+
+void SAL_CALL SwVbaFind::setMatchWildcards( ::sal_Bool _matchwildcards ) throw (uno::RuntimeException)
+{
+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchRegularExpression") ), uno::makeAny( _matchwildcards ) );
+}
+
+::sal_Bool SAL_CALL SwVbaFind::getMatchSoundsLike() throw (uno::RuntimeException)
+{
+ sal_Bool value = sal_False;
+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ) ) >>= value;
+ return value;
+}
+
+void SAL_CALL SwVbaFind::setMatchSoundsLike( ::sal_Bool _matchsoundslike ) throw (uno::RuntimeException)
+{
+ // seems not accurate
+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ), uno::makeAny( _matchsoundslike ) );
+}
+
+::sal_Bool SAL_CALL SwVbaFind::getMatchAllWordForms() throw (uno::RuntimeException)
+{
+ sal_Bool value = sal_False;
+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ) ) >>= value;
+ if( value )
+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarityRelax") ) ) >>= value;
+ return value;
+}
+
+void SAL_CALL SwVbaFind::setMatchAllWordForms( ::sal_Bool _matchallwordforms ) throw (uno::RuntimeException)
+{
+ // seems not accurate
+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ), uno::makeAny( _matchallwordforms ) );
+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarityRelax") ), uno::makeAny( _matchallwordforms ) );
+}
+
+uno::Any SAL_CALL SwVbaFind::getStyle() throw (uno::RuntimeException)
+{
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+}
+
+void SAL_CALL SwVbaFind::setStyle( const uno::Any& /*_style */ ) throw (uno::RuntimeException)
+{
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+}
+
+sal_Bool SAL_CALL
+SwVbaFind::Execute( const uno::Any& FindText, const uno::Any& MatchCase, const uno::Any& MatchWholeWord, const uno::Any& MatchWildcards, const uno::Any& MatchSoundsLike, const uno::Any& MatchAllWordForms, const uno::Any& Forward, const uno::Any& Wrap, const uno::Any& Format, const uno::Any& ReplaceWith, const uno::Any& Replace, const uno::Any& /*MatchKashida*/, const uno::Any& /*MatchDiacritics*/, const uno::Any& /*MatchAlefHamza*/, const uno::Any& /*MatchControl*/, const uno::Any& /*MatchPrefix*/, const uno::Any& /*MatchSuffix*/, const uno::Any& /*MatchPhrase*/, const uno::Any& /*IgnoreSpace*/, const uno::Any& /*IgnorePunct*/ ) throw (uno::RuntimeException)
+{
+ sal_Bool result = sal_False;
+ if( FindText.hasValue() )
+ {
+ rtl::OUString sText;
+ FindText >>= sText;
+ setText( sText );
+ }
+
+ sal_Bool bValue = sal_False;
+ if( MatchCase.hasValue() )
+ {
+ MatchCase >>= bValue;
+ setMatchCase( bValue );
+ }
+
+ if( MatchWholeWord.hasValue() )
+ {
+ MatchWholeWord >>= bValue;
+ setMatchWholeWord( bValue );
+ }
+
+ if( MatchWildcards.hasValue() )
+ {
+ MatchWildcards >>= bValue;
+ setMatchWildcards( bValue );
+ }
+
+ if( MatchSoundsLike.hasValue() )
+ {
+ MatchSoundsLike >>= bValue;
+ setMatchSoundsLike( bValue );
+ }
+
+ if( MatchAllWordForms.hasValue() )
+ {
+ MatchAllWordForms >>= bValue;
+ setMatchAllWordForms( bValue );
+ }
+
+ if( Forward.hasValue() )
+ {
+ Forward >>= bValue;
+ setForward( bValue );
+ }
+
+ if( Wrap.hasValue() )
+ {
+ sal_Int32 nWrapType = 0;
+ Wrap >>= nWrapType;
+ setWrap( nWrapType );
+ }
+
+ if( Format.hasValue() )
+ {
+ Format >>= bValue;
+ setFormat( bValue );
+ }
+
+ if( ReplaceWith.hasValue() )
+ {
+ rtl::OUString sValue;
+ ReplaceWith >>= sValue;
+ SetReplaceWith( sValue );
+ }
+
+ if( Replace.hasValue() )
+ {
+ sal_Int32 nValue(0);
+ Replace >>= nValue;
+ SetReplace( nValue );
+ }
+
+ result = SearchReplace();
+
+ return result;
+}
+
+void SAL_CALL
+SwVbaFind::ClearFormatting( ) throw (uno::RuntimeException)
+{
+ uno::Sequence< beans::PropertyValue > aSearchAttribs;
+ mxPropertyReplace->setSearchAttributes( aSearchAttribs );
+}
+
+rtl::OUString&
+SwVbaFind::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFind") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaFind::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Find" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbafind.hxx b/sw/source/ui/vba/vbafind.hxx
new file mode 100644
index 000000000000..ef971866500d
--- /dev/null
+++ b/sw/source/ui/vba/vbafind.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_FIND_HXX
+#define SW_VBA_FIND_HXX
+
+#include <ooo/vba/word/XFind.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/util/XReplaceable.hpp>
+#include <com/sun/star/util/XPropertyReplace.hpp>
+#include <com/sun/star/text/XTextViewCursor.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XFind > SwVbaFind_BASE;
+
+class SwVbaFind : public SwVbaFind_BASE
+{
+private:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::text::XTextRange > mxTextRange;
+ css::uno::Reference< css::util::XReplaceable > mxReplaceable;
+ css::uno::Reference< css::util::XPropertyReplace> mxPropertyReplace;
+ css::uno::Reference< css::text::XTextViewCursor> mxTVC;
+ css::uno::Reference< css::view::XSelectionSupplier> mxSelSupp;
+ sal_Bool mbReplace;
+ sal_Int32 mnReplaceType;
+ sal_Int32 mnWrap;
+
+private:
+ sal_Bool InRange( const css::uno::Reference< css::text::XTextRange >& xCurrentRange ) throw ( css::uno::RuntimeException );
+ sal_Bool InEqualRange( const css::uno::Reference< css::text::XTextRange >& xCurrentRange ) throw ( css::uno::RuntimeException );
+ void SetReplace( sal_Int32 type );
+ void SetReplaceWith( const rtl::OUString& rText ) throw ( css::uno::RuntimeException );
+ rtl::OUString GetReplaceWith() throw ( css::uno::RuntimeException );
+#ifdef TOMORROW
+ rtl::OUString ReplaceWildcards( const rtl::OUString& rText ) throw ( css::uno::RuntimeException );
+#endif
+ css::uno::Reference< css::text::XTextRange > FindOneElement() throw ( css::uno::RuntimeException );
+ sal_Bool SearchReplace() throw ( css::uno::RuntimeException );
+
+public:
+ SwVbaFind( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException );
+ virtual ~SwVbaFind();
+
+ // Attributes
+ virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getReplacement() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setReplacement( const css::uno::Any& _replacement ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getForward() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setForward( ::sal_Bool _forward ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getWrap() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setWrap( ::sal_Int32 _wrap ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getFormat() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setFormat( ::sal_Bool _format ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getMatchCase() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setMatchCase( ::sal_Bool _matchcase ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getMatchWholeWord() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setMatchWholeWord( ::sal_Bool _matchwholeword ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getMatchWildcards() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setMatchWildcards( ::sal_Bool _matchwildcards ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getMatchSoundsLike() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setMatchSoundsLike( ::sal_Bool _matchsoundslike ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getMatchAllWordForms() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setMatchAllWordForms( ::sal_Bool _matchallwordforms ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getStyle() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setStyle( const css::uno::Any& _style ) throw (css::uno::RuntimeException);
+
+ // Methods
+ virtual ::sal_Bool SAL_CALL Execute( const css::uno::Any& FindText, const css::uno::Any& MatchCase, const css::uno::Any& MatchWholeWord, const css::uno::Any& MatchWildcards, const css::uno::Any& MatchSoundsLike, const css::uno::Any& MatchAllWordForms, const css::uno::Any& Forward, const css::uno::Any& Wrap, const css::uno::Any& Format, const css::uno::Any& ReplaceWith, const css::uno::Any& Replace, const css::uno::Any& MatchKashida, const css::uno::Any& MatchDiacritics, const css::uno::Any& MatchAlefHamza, const css::uno::Any& MatchControl, const css::uno::Any& MatchPrefix, const css::uno::Any& MatchSuffix, const css::uno::Any& MatchPhrase, const css::uno::Any& IgnoreSpace, const css::uno::Any& IgnorePunct ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL ClearFormatting( ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_FIND_HXX */
diff --git a/sw/source/ui/vba/vbafont.cxx b/sw/source/ui/vba/vbafont.cxx
new file mode 100644
index 000000000000..47f39bcbefda
--- /dev/null
+++ b/sw/source/ui/vba/vbafont.cxx
@@ -0,0 +1,216 @@
+#include "vbafont.hxx"
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <ooo/vba/word/WdUnderline.hpp>
+#include <hash_map>
+#include <ooo/vba/word/WdColorIndex.hpp>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+const uno::Any aLongAnyTrue( sal_Int16(-1) );
+const uno::Any aLongAnyFalse( sal_Int16( 0 ) );
+
+struct MapPair
+{
+ sal_Int32 nMSOConst;
+ sal_Int32 nOOOConst;
+};
+
+static MapPair UnderLineTable[] = {
+ { word::WdUnderline::wdUnderlineNone, com::sun::star::awt::FontUnderline::NONE },
+ { word::WdUnderline::wdUnderlineSingle, com::sun::star::awt::FontUnderline::SINGLE },
+ { word::WdUnderline::wdUnderlineWords, com::sun::star::awt::FontUnderline::SINGLE },
+ { word::WdUnderline::wdUnderlineDouble, com::sun::star::awt::FontUnderline::DOUBLE },
+ { word::WdUnderline::wdUnderlineDotted, com::sun::star::awt::FontUnderline::DOTTED },
+ { word::WdUnderline::wdUnderlineThick, com::sun::star::awt::FontUnderline::BOLDDASH },
+ { word::WdUnderline::wdUnderlineDash, com::sun::star::awt::FontUnderline::DASH },
+ { word::WdUnderline::wdUnderlineDotDash, com::sun::star::awt::FontUnderline::DASHDOT },
+ { word::WdUnderline::wdUnderlineDotDotDash, com::sun::star::awt::FontUnderline::DASHDOTDOT },
+ { word::WdUnderline::wdUnderlineWavy, com::sun::star::awt::FontUnderline::WAVE },
+ { word::WdUnderline::wdUnderlineDottedHeavy, com::sun::star::awt::FontUnderline::BOLDDOTTED },
+ { word::WdUnderline::wdUnderlineDashHeavy, com::sun::star::awt::FontUnderline::BOLDDASH },
+ { word::WdUnderline::wdUnderlineDotDashHeavy, com::sun::star::awt::FontUnderline::BOLDDASHDOT },
+ { word::WdUnderline::wdUnderlineDotDotDashHeavy, com::sun::star::awt::FontUnderline::BOLDDASHDOTDOT },
+ { word::WdUnderline::wdUnderlineWavyHeavy, com::sun::star::awt::FontUnderline::BOLDWAVE },
+ { word::WdUnderline::wdUnderlineDashLong, com::sun::star::awt::FontUnderline::LONGDASH },
+ { word::WdUnderline::wdUnderlineWavyDouble, com::sun::star::awt::FontUnderline::DOUBLEWAVE },
+ { word::WdUnderline::wdUnderlineDashLongHeavy, com::sun::star::awt::FontUnderline::BOLDLONGDASH },
+};
+
+typedef std::hash_map< sal_Int32, sal_Int32 > ConstToConst;
+class UnderLineMapper
+{
+ ConstToConst MSO2OOO;
+ ConstToConst OOO2MSO;
+private:
+ UnderLineMapper()
+ {
+ sal_Int32 nLen = sizeof( UnderLineTable )/ sizeof( UnderLineTable[0] );
+
+ for ( sal_Int32 index=0; index<nLen; ++index )
+ {
+ MSO2OOO[ UnderLineTable[ index ].nMSOConst ] = UnderLineTable[ index ].nOOOConst;
+ OOO2MSO[ UnderLineTable[ index ].nOOOConst ] = UnderLineTable[ index ].nMSOConst;
+ }
+ }
+public:
+ static rtl::OUString propName()
+ {
+ static rtl::OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("CharUnderline") );
+ return sPropName;
+ }
+
+ static UnderLineMapper& instance()
+ {
+ static UnderLineMapper theMapper;
+ return theMapper;
+ }
+
+ sal_Int32 getOOOFromMSO( sal_Int32 nMSOConst ) throw( lang::IllegalArgumentException )
+ {
+ ConstToConst::iterator it = MSO2OOO.find( nMSOConst );
+ if ( it == MSO2OOO.end() )
+ throw lang::IllegalArgumentException();
+ return it->second;
+ }
+ sal_Int32 getMSOFromOOO( sal_Int32 nOOOConst ) throw( lang::IllegalArgumentException )
+ {
+ ConstToConst::iterator it = OOO2MSO.find( nOOOConst );
+ if ( it == OOO2MSO.end() )
+ throw lang::IllegalArgumentException();
+ return it->second;
+ }
+};
+
+SwVbaFont::SwVbaFont( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xPalette, uno::Reference< css::beans::XPropertySet > xPropertySet ) throw ( css::uno::RuntimeException ) : SwVbaFont_BASE( xParent, xContext, xPalette, xPropertySet )
+{
+}
+
+uno::Any SAL_CALL
+SwVbaFont::getUnderline() throw (uno::RuntimeException)
+{
+ sal_Int32 nOOVal = 0;
+ mxFont->getPropertyValue( UnderLineMapper::propName() ) >>= nOOVal;
+ return uno::makeAny( UnderLineMapper::instance().getMSOFromOOO( nOOVal ) );
+}
+
+void SAL_CALL
+SwVbaFont::setUnderline( const uno::Any& _underline ) throw (uno::RuntimeException)
+{
+ sal_Int32 nMSOVal = 0;
+
+ if ( _underline >>= nMSOVal )
+ {
+ sal_Int32 nOOVal = UnderLineMapper::instance().getOOOFromMSO( nMSOVal );
+ mxFont->setPropertyValue( UnderLineMapper::propName(), uno::makeAny( nOOVal ) );
+ }
+}
+
+rtl::OUString&
+SwVbaFont::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFont") );
+ return sImplName;
+}
+
+void SAL_CALL
+SwVbaFont::setColorIndex( const uno::Any& _colorindex ) throw( uno::RuntimeException )
+{
+ sal_Int32 nIndex = 0;
+ _colorindex >>= nIndex;
+ return setColor( OORGBToXLRGB(mxPalette->getByIndex( nIndex )) );
+}
+
+uno::Any SAL_CALL
+SwVbaFont::getColorIndex() throw ( uno::RuntimeException )
+{
+ sal_Int32 nColor = 0;
+
+ XLRGBToOORGB( getColor() ) >>= nColor;
+ sal_Int32 nElems = mxPalette->getCount();
+ sal_Int32 nIndex = 0;
+ for ( sal_Int32 count=0; count<nElems; ++count )
+ {
+ sal_Int32 nPaletteColor = 0;
+ mxPalette->getByIndex( count ) >>= nPaletteColor;
+ if ( nPaletteColor == nColor )
+ {
+ nIndex = count;
+ break;
+ }
+ }
+ return uno::makeAny( nIndex );
+}
+uno::Any SAL_CALL
+SwVbaFont::getSubscript() throw ( uno::RuntimeException )
+{
+ sal_Bool bRes = sal_False;
+ SwVbaFont_BASE::getSubscript() >>= bRes;
+ if ( bRes )
+ return aLongAnyTrue;
+ return aLongAnyFalse;
+}
+
+uno::Any SAL_CALL
+SwVbaFont::getSuperscript() throw ( uno::RuntimeException )
+{
+ sal_Bool bRes = sal_False;
+ SwVbaFont_BASE::getSuperscript() >>= bRes;
+ if ( bRes )
+ return aLongAnyTrue;
+ return aLongAnyFalse;
+}
+
+uno::Any SAL_CALL
+SwVbaFont::getBold() throw (uno::RuntimeException)
+{
+ sal_Bool bRes = sal_False;
+ SwVbaFont_BASE::getBold() >>= bRes;
+ if ( bRes )
+ return aLongAnyTrue;
+ return aLongAnyFalse;
+}
+
+uno::Any SAL_CALL
+SwVbaFont::getItalic() throw (uno::RuntimeException)
+{
+ sal_Bool bRes = sal_False;
+ SwVbaFont_BASE::getItalic() >>= bRes;
+ if ( bRes )
+ return aLongAnyTrue;
+ return aLongAnyFalse;
+}
+
+uno::Any SAL_CALL
+SwVbaFont::getStrikethrough() throw (css::uno::RuntimeException)
+{
+ sal_Bool bRes = sal_False;
+ SwVbaFont_BASE::getStrikethrough() >>= bRes;
+ if ( bRes )
+ return aLongAnyTrue;
+ return aLongAnyFalse;
+}
+
+uno::Any SAL_CALL
+SwVbaFont::getShadow() throw (uno::RuntimeException)
+{
+ sal_Bool bRes = sal_False;
+ SwVbaFont_BASE::getShadow() >>= bRes;
+ if ( bRes )
+ return aLongAnyTrue;
+ return aLongAnyFalse;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaFont::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Font" ) );
+ }
+ return aServiceNames;
+}
+
+
diff --git a/sw/source/ui/vba/vbafont.hxx b/sw/source/ui/vba/vbafont.hxx
new file mode 100644
index 000000000000..1500c2a314dd
--- /dev/null
+++ b/sw/source/ui/vba/vbafont.hxx
@@ -0,0 +1,31 @@
+#ifndef VBA_FONT_HXX
+#define VBA_FONT_HXX
+
+#include <vbahelper/vbafontbase.hxx>
+#include <ooo/vba/word/XFont.hpp>
+
+typedef cppu::ImplInheritanceHelper1< VbaFontBase, ov::word::XFont > SwVbaFont_BASE;
+
+class SwVbaFont : public SwVbaFont_BASE
+{
+public:
+ SwVbaFont( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPalette, css::uno::Reference< css::beans::XPropertySet > xPropertySet ) throw ( css::uno::RuntimeException );
+ virtual ~SwVbaFont(){}
+
+ // Attributes
+ virtual void SAL_CALL setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getColorIndex() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getUnderline() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setUnderline( const css::uno::Any& _underline ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getSubscript() throw ( css::uno::RuntimeException );
+ virtual css::uno::Any SAL_CALL getSuperscript() throw ( css::uno::RuntimeException );
+
+ virtual css::uno::Any SAL_CALL getBold() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getItalic() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getStrikethrough() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getShadow() throw (css::uno::RuntimeException);
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif
diff --git a/sw/source/ui/vba/vbaglobals.cxx b/sw/source/ui/vba/vbaglobals.cxx
new file mode 100644
index 000000000000..b95c5e5c9e3d
--- /dev/null
+++ b/sw/source/ui/vba/vbaglobals.cxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <vbahelper/helperdecl.hxx>
+#include "vbaglobals.hxx"
+
+#include <comphelper/unwrapargs.hxx>
+
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <cppuhelper/bootstrap.hxx>
+#include "vbaapplication.hxx"
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::ooo::vba;
+
+
+rtl::OUString sDocCtxName( RTL_CONSTASCII_USTRINGPARAM("WordDocumentContext") );
+
+// =============================================================================
+// SwVbaGlobals
+// =============================================================================
+
+SwVbaGlobals::SwVbaGlobals( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& rxContext ) : SwVbaGlobals_BASE( uno::Reference< XHelperInterface >(), rxContext, sDocCtxName )
+{
+ OSL_TRACE("SwVbaGlobals::SwVbaGlobals()");
+ uno::Sequence< beans::PropertyValue > aInitArgs( 2 );
+ aInitArgs[ 0 ].Name = rtl::OUString::createFromAscii("Application");
+ aInitArgs[ 0 ].Value = uno::makeAny( getApplication() );
+ aInitArgs[ 1 ].Name = sDocCtxName;
+ aInitArgs[ 1 ].Value = uno::makeAny( getXSomethingFromArgs< frame::XModel >( aArgs, 0 ) );
+
+ init( aInitArgs );
+}
+
+SwVbaGlobals::~SwVbaGlobals()
+{
+ OSL_TRACE("SwVbaGlobals::~SwVbaGlobals");
+}
+
+// =============================================================================
+// XGlobals
+// =============================================================================
+uno::Reference<word::XApplication >
+SwVbaGlobals::getApplication() throw (uno::RuntimeException)
+{
+ OSL_TRACE("In SwVbaGlobals::getApplication");
+ if ( !mxApplication.is() )
+ mxApplication.set( new SwVbaApplication( mxContext) );
+
+ return mxApplication;
+}
+
+uno::Reference<word::XSystem > SAL_CALL
+SwVbaGlobals::getSystem() throw (uno::RuntimeException)
+{
+ return getApplication()->getSystem();
+}
+
+uno::Reference< word::XDocument > SAL_CALL
+SwVbaGlobals::getActiveDocument() throw (uno::RuntimeException)
+{
+ return getApplication()->getActiveDocument();
+}
+
+uno::Reference< word::XWindow > SAL_CALL
+SwVbaGlobals::getActiveWindow() throw (uno::RuntimeException)
+{
+ return getApplication()->getActiveWindow();
+}
+
+rtl::OUString SAL_CALL
+SwVbaGlobals::getName() throw (uno::RuntimeException)
+{
+ return getApplication()->getName();
+}
+
+uno::Reference<word::XOptions > SAL_CALL
+SwVbaGlobals::getOptions() throw (uno::RuntimeException)
+{
+ return getApplication()->getOptions();
+}
+
+uno::Any SAL_CALL
+SwVbaGlobals::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
+{
+ return getApplication()->CommandBars( aIndex );
+}
+
+uno::Any SAL_CALL
+SwVbaGlobals::Documents( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ return getApplication()->Documents( index );
+}
+
+uno::Any SAL_CALL
+SwVbaGlobals::Addins( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ return getApplication()->Addins( index );
+}
+
+uno::Any SAL_CALL
+SwVbaGlobals::Dialogs( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ return getApplication()->Dialogs( index );
+}
+
+uno::Reference<word::XSelection > SAL_CALL
+SwVbaGlobals::getSelection() throw (uno::RuntimeException)
+{
+ return getApplication()->getSelection();
+}
+
+float SAL_CALL SwVbaGlobals::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException)
+{
+ return getApplication()->CentimetersToPoints( _Centimeters );
+}
+
+rtl::OUString&
+SwVbaGlobals::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaGlobals") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaGlobals::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Globals" ) );
+ }
+ return aServiceNames;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaGlobals::getAvailableServiceNames( ) throw (uno::RuntimeException)
+{
+ static bool bInit = false;
+ static uno::Sequence< rtl::OUString > serviceNames( SwVbaGlobals_BASE::getAvailableServiceNames() );
+ if ( !bInit )
+ {
+ rtl::OUString names[] = {
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.word.Document" ) ),
+// #FIXME #TODO make Application a proper service
+// ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "ooo.vba.word.Application" ) ),
+ };
+ sal_Int32 nWordServices = ( sizeof( names )/ sizeof( names[0] ) );
+ sal_Int32 startIndex = serviceNames.getLength();
+ serviceNames.realloc( serviceNames.getLength() + nWordServices );
+ for ( sal_Int32 index = 0; index < nWordServices; ++index )
+ serviceNames[ startIndex + index ] = names[ index ];
+ bInit = true;
+ }
+ return serviceNames;
+}
+
+namespace globals
+{
+namespace sdecl = comphelper::service_decl;
+sdecl::vba_service_class_<SwVbaGlobals, sdecl::with_args<true> > serviceImpl;
+extern sdecl::ServiceDecl const serviceDecl(
+ serviceImpl,
+ "SwVbaGlobals",
+ "ooo.vba.word.Globals" );
+}
+
diff --git a/sw/source/ui/vba/vbaglobals.hxx b/sw/source/ui/vba/vbaglobals.hxx
new file mode 100644
index 000000000000..9bb2e8fa606d
--- /dev/null
+++ b/sw/source/ui/vba/vbaglobals.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_GLOBALS_HXX
+#define SW_VBA_GLOBALS_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <ooo/vba/word/XGlobals.hpp>
+#include <ooo/vba/word/XApplication.hpp>
+#include <ooo/vba/word/XSystem.hpp>
+#include <ooo/vba/word/XOptions.hpp>
+#include <ooo/vba/word/XSelection.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbaglobalbase.hxx>
+
+// =============================================================================
+// class SwVbaGlobals
+// =============================================================================
+
+
+typedef ::cppu::ImplInheritanceHelper1< VbaGlobalsBase, ov::word::XGlobals > SwVbaGlobals_BASE;
+
+class SwVbaGlobals : public SwVbaGlobals_BASE
+{
+private:
+ css::uno::Reference< ooo::vba::word::XApplication > mxApplication;
+
+ virtual css::uno::Reference< ooo::vba::word::XApplication > getApplication() throw (css::uno::RuntimeException);
+
+public:
+
+ SwVbaGlobals( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& rxContext );
+ virtual ~SwVbaGlobals();
+
+ // XGlobals
+ virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL getSystem() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::word::XDocument > SAL_CALL getActiveDocument() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::word::XWindow > SAL_CALL getActiveWindow() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
+ // XMultiServiceFactory
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_GLOBALS_HXX */
diff --git a/sw/source/ui/vba/vbaheaderfooter.cxx b/sw/source/ui/vba/vbaheaderfooter.cxx
new file mode 100644
index 000000000000..6fb7061c573f
--- /dev/null
+++ b/sw/source/ui/vba/vbaheaderfooter.cxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbaheaderfooter.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <tools/diagnose_ex.h>
+#include <ooo/vba/word/WdHeaderFooterIndex.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include "vbarange.hxx"
+#include <vbahelper/vbashapes.hxx>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaHeaderFooter::SwVbaHeaderFooter( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& rProps, sal_Bool isHeader, sal_Int32 index ) throw ( uno::RuntimeException ) : SwVbaHeaderFooter_BASE( rParent, rContext ), mxModel( xModel ), mxPageStyleProps( rProps ), mbHeader( isHeader ), mnIndex( index )
+{
+}
+
+sal_Bool SAL_CALL SwVbaHeaderFooter::getIsHeader() throw (uno::RuntimeException)
+{
+ return mbHeader;
+}
+
+sal_Bool SAL_CALL SwVbaHeaderFooter::getLinkToPrevious() throw (uno::RuntimeException)
+{
+ // seems always false
+ return sal_False;
+}
+
+void SAL_CALL SwVbaHeaderFooter::setLinkToPrevious( ::sal_Bool /*_linktoprevious*/ ) throw (uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+uno::Reference< word::XRange > SAL_CALL SwVbaHeaderFooter::getRange() throw (uno::RuntimeException)
+{
+ rtl::OUString sPropsNameText;
+ if( mbHeader )
+ {
+ sPropsNameText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
+ }
+ else
+ {
+ sPropsNameText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
+ }
+ if( mnIndex == word::WdHeaderFooterIndex::wdHeaderFooterEvenPages )
+ {
+ sPropsNameText.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left") ) );
+ }
+
+ uno::Reference< text::XText > xText( mxPageStyleProps->getPropertyValue( sPropsNameText ), uno::UNO_QUERY_THROW );
+ uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
+ return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, xDocument, xText->getStart(), xText->getEnd(), xText ) );
+}
+
+uno::Any SAL_CALL
+SwVbaHeaderFooter::Shapes( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
+ //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
+ uno::Reference< XCollection > xCol( new ScVbaShapes( this, mxContext, xIndexAccess, mxModel ) );
+ if ( index.hasValue() )
+ return xCol->Item( index, uno::Any() );
+ return uno::makeAny( xCol );
+}
+
+rtl::OUString&
+SwVbaHeaderFooter::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaHeaderFooter") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaHeaderFooter::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Pane" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbaheaderfooter.hxx b/sw/source/ui/vba/vbaheaderfooter.hxx
new file mode 100644
index 000000000000..dba10ff767d8
--- /dev/null
+++ b/sw/source/ui/vba/vbaheaderfooter.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_HEADERFOOTER_HXX
+#define SW_VBA_HEADERFOOTER_HXX
+
+#include <ooo/vba/word/XHeaderFooter.hpp>
+#include <ooo/vba/word/XRange.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XHeaderFooter > SwVbaHeaderFooter_BASE;
+
+class SwVbaHeaderFooter : public SwVbaHeaderFooter_BASE
+{
+private:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::beans::XPropertySet > mxPageStyleProps;
+ sal_Bool mbHeader;
+ sal_Int32 mnIndex;
+
+public:
+ SwVbaHeaderFooter( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps, sal_Bool isHeader, sal_Int32 index ) throw ( css::uno::RuntimeException );
+ virtual ~SwVbaHeaderFooter(){}
+
+ // Attributes
+ virtual ::sal_Bool SAL_CALL getIsHeader() throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getLinkToPrevious() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setLinkToPrevious( ::sal_Bool _linktoprevious ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL getRange() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Shapes( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_HEADERFOOTER_HXX */
diff --git a/sw/source/ui/vba/vbaheaderfooterhelper.cxx b/sw/source/ui/vba/vbaheaderfooterhelper.cxx
new file mode 100644
index 000000000000..604cc1e11d8c
--- /dev/null
+++ b/sw/source/ui/vba/vbaheaderfooterhelper.cxx
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbaheaderfooterhelper.hxx"
+#include "wordvbahelper.hxx"
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::ooo::vba;
+
+#define FIRST_PAGE 1;
+
+// Class HeaderFooterHelper
+
+sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
+{
+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
+
+ sal_Bool isOn = sal_False;
+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isOn;
+ if( !isOn )
+ return sal_False;
+
+ sal_Bool isShared = sal_False;
+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared;
+
+ rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
+ if( !isShared )
+ {
+ if( 0 == xPageCursor->getPage() % 2 )
+ {
+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextLeft") );
+ }
+ else
+ {
+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextRight") );
+ }
+ }
+
+ uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
+ //FIXME: can not compare in this way?
+ return ( xText == xCurrentText );
+}
+
+sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
+{
+ if( isHeader( xModel, xCurrentText ) )
+ {
+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
+ // FIXME: getPage allways returns 1
+ sal_Int32 nPage = xPageCursor->getPage();
+ return nPage == FIRST_PAGE;
+ }
+ return sal_False;
+}
+
+sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
+{
+ if( isHeader( xModel, xCurrentText ) )
+ {
+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
+ sal_Bool isShared = sal_False;
+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared;
+ if( !isShared )
+ {
+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
+ return ( 0 == xPageCursor->getPage() % 2 );
+ }
+ }
+ return sal_False;
+}
+
+sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
+{
+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
+
+ sal_Bool isOn = sal_False;
+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isOn;
+ if( !isOn )
+ return sal_False;
+
+ sal_Bool isShared = sal_False;
+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
+
+ rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
+ if( !isShared )
+ {
+ if( 0 == xPageCursor->getPage() % 2 )
+ {
+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextLeft") );
+ }
+ else
+ {
+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextRight") );
+ }
+ }
+
+ uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
+
+ return ( xText == xCurrentText );
+}
+
+sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
+{
+ if( isFooter( xModel, xCurrentText ) )
+ {
+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
+ sal_Int32 nPage = xPageCursor->getPage();
+ return nPage == FIRST_PAGE;
+ }
+ return sal_False;
+}
+
+sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
+{
+ if( isFooter( xModel, xCurrentText ) )
+ {
+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
+ sal_Bool isShared = sal_False;
+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared;
+ if( !isShared )
+ {
+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
+ return ( 0 == xPageCursor->getPage() % 2 );
+ }
+ }
+ return sal_False;
+}
+#ifdef TOMORROW
+sal_Bool HeaderFooterHelper::isPrimaryHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
+{
+ if( isHeader( xModel, xCurrentText ) )
+ {
+ return( !( isFirstPageHeader( xModel, xCurrentText ) && isEvenPagesHeader( xModel, xCurrentText ) ) );
+ }
+ return sal_False;
+}
+
+sal_Bool HeaderFooterHelper::isPrimaryFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException)
+{
+ if( isHeader( xModel, xCurrentText ) )
+ {
+ return( !( isFirstPageFooter( xModel, xCurrentText ) && isEvenPagesFooter( xModel, xCurrentText ) ) );
+ }
+ return sal_False;
+}
+#endif
diff --git a/sw/source/ui/vba/vbaheaderfooterhelper.hxx b/sw/source/ui/vba/vbaheaderfooterhelper.hxx
new file mode 100644
index 000000000000..fd29a16015ab
--- /dev/null
+++ b/sw/source/ui/vba/vbaheaderfooterhelper.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_WORD_VBA_HEADERFOOTERHELPER_HXX
+#define SW_WORD_VBA_HEADERFOOTERHELPER_HXX
+
+#include <vbahelper/vbahelper.hxx>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextViewCursor.hpp>
+#include <com/sun/star/text/XPageCursor.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+
+class HeaderFooterHelper
+{
+public:
+ static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
+ static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
+ static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
+ static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
+ static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
+ static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
+#ifdef TOMORROW
+ static sal_Bool isPrimaryHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
+ static sal_Bool isPrimaryFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException);
+#endif
+};
+
+#endif
diff --git a/sw/source/ui/vba/vbainformationhelper.cxx b/sw/source/ui/vba/vbainformationhelper.cxx
new file mode 100644
index 000000000000..6fdf8f9f9449
--- /dev/null
+++ b/sw/source/ui/vba/vbainformationhelper.cxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbainformationhelper.hxx"
+#include <com/sun/star/text/XPageCursor.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "wordvbahelper.hxx"
+#include <docsh.hxx>
+#include <doc.hxx>
+#include <vbahelper/vbahelper.hxx>
+#include <swtypes.hxx>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+static const sal_Int32 DEFAULT_PAGE_DISTANCE = 500;
+
+sal_Int32 SwVbaInformationHelper::handleWdActiveEndPageNumber( const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException )
+{
+ uno::Reference< text::XPageCursor > xPageCursor( xTVCursor, uno::UNO_QUERY_THROW );
+ return xPageCursor->getPage();
+}
+
+sal_Int32 SwVbaInformationHelper::handleWdNumberOfPagesInDocument( const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException )
+{
+ return word::getPageCount( xModel );
+}
+
+double SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException )
+{
+ xTVCursor->collapseToStart();
+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW );
+ sal_Int32 nTopMargin = 0;
+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ) ) >>= nTopMargin;
+ sal_Int32 nCurrentPos = xTVCursor->getPosition().Y;
+
+ sal_Int32 nCurrentPage = handleWdActiveEndPageNumber( xTVCursor );
+ sal_Int32 nPageHeight = word::getDocShell( xModel )->GetDoc()->GetPageSize( nCurrentPage, sal_False ).Height();
+ // FIXME: handle multipul page style
+ // it is very strange that the curros position is incorrect when open Word file.
+ // e.g. if current cursor in the top left of the text body of the first page without header,
+ // the top value of current position should be 0, but is 201 when open a Word file.
+ nCurrentPos = nCurrentPos + nTopMargin - ( DEFAULT_PAGE_DISTANCE + TWIP_TO_MM100( nPageHeight ) ) * ( nCurrentPage - 1 );
+ return Millimeter::getInPoints( nCurrentPos );
+}
diff --git a/sw/source/ui/vba/vbainformationhelper.hxx b/sw/source/ui/vba/vbainformationhelper.hxx
new file mode 100644
index 000000000000..6aeb8439812b
--- /dev/null
+++ b/sw/source/ui/vba/vbainformationhelper.hxx
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_INFORMATIONHELPER_HXX
+#define SW_VBA_INFORMATIONHELPER_HXX
+
+#include <vbahelper/vbahelperinterface.hxx>
+#include <com/sun/star/text/XTextViewCursor.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+class SwVbaInformationHelper
+{
+public:
+ static sal_Int32 handleWdActiveEndPageNumber( const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException );
+ static sal_Int32 handleWdNumberOfPagesInDocument( const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException );
+ static double handleWdVerticalPositionRelativeToPage( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException );
+ //static double verticalPositionRelativeToPageBoundary( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor, const css::uno::Reference< css::beans::XPropertySet >& xStyleProps ) throw( css::uno::RuntimeException );
+
+};
+#endif /* SW_VBA_INFORMATIONHELPER_HXX */
diff --git a/sw/source/ui/vba/vbaoptions.cxx b/sw/source/ui/vba/vbaoptions.cxx
new file mode 100644
index 000000000000..d59d0326cf5e
--- /dev/null
+++ b/sw/source/ui/vba/vbaoptions.cxx
@@ -0,0 +1,284 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbaoptions.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <ooo/vba/word/WdDefaultFilePath.hpp>
+#include <ooo/vba/word/WdLineStyle.hpp>
+#include <ooo/vba/word/WdLineWidth.hpp>
+#include <ooo/vba/word/WdColorIndex.hpp>
+#include <com/sun/star/util/XStringSubstitution.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <osl/file.hxx>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaOptions::SwVbaOptions( uno::Reference<uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) : SwVbaOptions_BASE( uno::Reference< XHelperInterface >(), xContext )
+{
+ mxFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
+}
+
+SwVbaOptions::~SwVbaOptions()
+{
+}
+
+uno::Any SAL_CALL
+SwVbaOptions::DefaultFilePath( sal_Int32 _path ) throw ( uno::RuntimeException )
+{
+ switch( _path )
+ {
+ case word::WdDefaultFilePath::wdDocumentsPath:
+ {
+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Work") );
+ break;
+ }
+ case word::WdDefaultFilePath::wdPicturesPath:
+ {
+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Gallery") );
+ break;
+ }
+ case word::WdDefaultFilePath::wdUserTemplatesPath:
+ case word::WdDefaultFilePath::wdWorkgroupTemplatesPath:
+ {
+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Template") );
+ break;
+ }
+ case word::WdDefaultFilePath::wdStartupPath:
+ {
+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Addin") );
+ break;
+ }
+ case word::WdDefaultFilePath::wdUserOptionsPath:
+ {
+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserConfig") );
+ break;
+ }
+ case word::WdDefaultFilePath::wdToolsPath:
+ case word::WdDefaultFilePath::wdProgramPath:
+ {
+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Module") );
+ break;
+ }
+ case word::WdDefaultFilePath::wdTempFilePath:
+ {
+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Temp") );
+ break;
+ }
+ default:
+ {
+ DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() );
+ break;
+ }
+ }
+ return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( this ) ) );
+}
+
+void SwVbaOptions::setValueEvent( const uno::Any& value )
+{
+ rtl::OUString sNewPath;
+ value >>= sNewPath;
+ rtl::OUString sNewPathUrl;
+ ::osl::File::getFileURLFromSystemPath( sNewPath, sNewPathUrl );
+ uno::Reference< beans::XPropertySet > xPathSettings( mxFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.PathSettings") ), uno::UNO_QUERY_THROW );
+ rtl::OUString sOldPathUrl;
+ xPathSettings->getPropertyValue( msDefaultFilePath ) >>= sOldPathUrl;
+ // path could be a multipath, Microsoft doesn't support this feature in Word currently
+ // only the last path is from interest.
+ sal_Int32 nIndex = sOldPathUrl.lastIndexOf( sal_Unicode(';') );
+ if( nIndex != -1 )
+ {
+ sNewPathUrl = sOldPathUrl.copy( 0, nIndex + 1 ).concat( sNewPathUrl );
+ }
+ xPathSettings->setPropertyValue( msDefaultFilePath, uno::makeAny( sNewPathUrl ) );
+}
+
+uno::Any SwVbaOptions::getValueEvent()
+{
+ uno::Reference< beans::XPropertySet > xPathSettings( mxFactory->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.PathSettings") ), uno::UNO_QUERY_THROW );
+ rtl::OUString sPathUrl;
+ xPathSettings->getPropertyValue( msDefaultFilePath ) >>= sPathUrl;
+ // path could be a multipath, Microsoft doesn't support this feature in Word currently
+ // only the last path is from interest.
+ sal_Int32 nIndex = sPathUrl.lastIndexOf( sal_Unicode(';') );
+ if( nIndex != -1 )
+ {
+ sPathUrl = sPathUrl.copy( nIndex + 1 );
+ }
+ rtl::OUString sPath;
+ ::osl::File::getSystemPathFromFileURL( sPathUrl, sPath );
+ return uno::makeAny( sPath );
+}
+
+sal_Int32 SAL_CALL SwVbaOptions::getDefaultBorderLineStyle() throw (uno::RuntimeException)
+{
+ return word::WdLineStyle::wdLineStyleSingle;
+}
+
+void SAL_CALL SwVbaOptions::setDefaultBorderLineStyle( ::sal_Int32 /*_defaultborderlinestyle*/ ) throw (uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+sal_Int32 SAL_CALL SwVbaOptions::getDefaultBorderLineWidth() throw (uno::RuntimeException)
+{
+ return word::WdLineWidth::wdLineWidth050pt;
+}
+
+void SAL_CALL SwVbaOptions::setDefaultBorderLineWidth( ::sal_Int32 /*_defaultborderlinewidth*/ ) throw (uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+sal_Int32 SAL_CALL SwVbaOptions::getDefaultBorderColorIndex() throw (uno::RuntimeException)
+{
+ return word::WdColorIndex::wdAuto;
+}
+
+void SAL_CALL SwVbaOptions::setDefaultBorderColorIndex( ::sal_Int32 /*_defaultbordercolorindex*/ ) throw (uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+::sal_Bool SAL_CALL SwVbaOptions::getReplaceSelection() throw (uno::RuntimeException)
+{
+ return sal_True;
+}
+
+void SAL_CALL SwVbaOptions::setReplaceSelection( ::sal_Bool /*_replaceselection*/ ) throw (uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+::sal_Bool SAL_CALL SwVbaOptions::getMapPaperSize() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL SwVbaOptions::setMapPaperSize( ::sal_Bool /*_mappapersize*/ ) throw (uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeApplyHeadings() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeApplyHeadings( ::sal_Bool /*_autoformatasyoutypeapplyheadings*/ ) throw (uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeApplyBulletedLists() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeApplyBulletedLists( ::sal_Bool /*_autoformatasyoutypeapplybulletedlists*/ ) throw (uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeApplyNumberedLists() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeApplyNumberedLists( ::sal_Bool /*_autoformatasyoutypeapplynumberedlists*/ ) throw (uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeFormatListItemBeginning() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeFormatListItemBeginning( ::sal_Bool /*_autoformatasyoutypeformatlistitembeginning*/ ) throw (uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeDefineStyles() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeDefineStyles( ::sal_Bool /*_autoformatasyoutypedefinestyles*/ ) throw (uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatApplyHeadings() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL SwVbaOptions::setAutoFormatApplyHeadings( ::sal_Bool /*_autoformatapplyheadings*/ ) throw (uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatApplyLists() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL SwVbaOptions::setAutoFormatApplyLists( ::sal_Bool /*_autoformatapplylists*/ ) throw (uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatApplyBulletedLists() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL SwVbaOptions::setAutoFormatApplyBulletedLists( ::sal_Bool /*_autoformatapplybulletedlists*/ ) throw (uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+
+rtl::OUString&
+SwVbaOptions::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaOptions") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaOptions::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Options" ) );
+ }
+ return aServiceNames;
+}
diff --git a/sw/source/ui/vba/vbaoptions.hxx b/sw/source/ui/vba/vbaoptions.hxx
new file mode 100644
index 000000000000..ec1f70068e48
--- /dev/null
+++ b/sw/source/ui/vba/vbaoptions.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_OPTIONS_HXX
+#define SW_VBA_OPTIONS_HXX
+
+#include <ooo/vba/word/XOptions.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <vbahelper/vbapropvalue.hxx>
+#include <comphelper/processfactory.hxx>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XOptions > SwVbaOptions_BASE;
+
+class SwVbaOptions : public SwVbaOptions_BASE,
+ public PropListener
+{
+private:
+ rtl::OUString msDefaultFilePath;
+ css::uno::Reference< css::lang::XMultiServiceFactory > mxFactory;
+public:
+ SwVbaOptions( css::uno::Reference< css::uno::XComponentContext >& m_xContext ) throw ( css::uno::RuntimeException );
+ virtual ~SwVbaOptions();
+
+ // Attributes
+ virtual ::sal_Int32 SAL_CALL getDefaultBorderLineStyle() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultBorderLineStyle( ::sal_Int32 _defaultborderlinestyle ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDefaultBorderLineWidth() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultBorderLineWidth( ::sal_Int32 _defaultborderlinewidth ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDefaultBorderColorIndex() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultBorderColorIndex( ::sal_Int32 _defaultbordercolorindex ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getReplaceSelection() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setReplaceSelection( ::sal_Bool _replaceselection ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getMapPaperSize() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setMapPaperSize( ::sal_Bool _mappapersize ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeApplyHeadings() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAutoFormatAsYouTypeApplyHeadings( ::sal_Bool _autoformatasyoutypeapplyheadings ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeApplyBulletedLists() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAutoFormatAsYouTypeApplyBulletedLists( ::sal_Bool _autoformatasyoutypeapplybulletedlists ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeApplyNumberedLists() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAutoFormatAsYouTypeApplyNumberedLists( ::sal_Bool _autoformatasyoutypeapplynumberedlists ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeFormatListItemBeginning() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAutoFormatAsYouTypeFormatListItemBeginning( ::sal_Bool _autoformatasyoutypeformatlistitembeginning ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeDefineStyles() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAutoFormatAsYouTypeDefineStyles( ::sal_Bool _autoformatasyoutypedefinestyles ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getAutoFormatApplyHeadings() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAutoFormatApplyHeadings( ::sal_Bool _autoformatapplyheadings ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getAutoFormatApplyLists() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAutoFormatApplyLists( ::sal_Bool _autoformatapplylists ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getAutoFormatApplyBulletedLists() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAutoFormatApplyBulletedLists( ::sal_Bool _autoformatapplybulletedlists ) throw (css::uno::RuntimeException);
+
+ // Methods
+ virtual css::uno::Any SAL_CALL DefaultFilePath( sal_Int32 _path ) throw ( css::uno::RuntimeException );
+
+ //PropListener
+ virtual void setValueEvent( const css::uno::Any& value );
+ virtual css::uno::Any getValueEvent();
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_OPTIONS_HXX */
diff --git a/sw/source/ui/vba/vbapagesetup.cxx b/sw/source/ui/vba/vbapagesetup.cxx
new file mode 100644
index 000000000000..1cdda8152207
--- /dev/null
+++ b/sw/source/ui/vba/vbapagesetup.cxx
@@ -0,0 +1,272 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbapagesetup.hxx"
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XPageCursor.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <ooo/vba/word/WdSectionStart.hpp>
+#include <ooo/vba/word/WdOrientation.hpp>
+#include "wordvbahelper.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::ooo::vba;
+
+SwVbaPageSetup::SwVbaPageSetup(const uno::Reference< XHelperInterface >& xParent,
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const uno::Reference< frame::XModel >& xModel,
+ const uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException):
+ SwVbaPageSetup_BASE( xParent, xContext )
+{
+ mxModel.set( xModel, uno::UNO_QUERY_THROW );
+ mxPageProps.set( xProps, uno::UNO_QUERY_THROW );
+ mnOrientPortrait = word::WdOrientation::wdOrientPortrait;
+ mnOrientLandscape = word::WdOrientation::wdOrientLandscape;
+}
+
+double SAL_CALL SwVbaPageSetup::getGutter() throw (uno::RuntimeException)
+{
+ // not support in Writer
+ return 0;
+}
+
+void SAL_CALL SwVbaPageSetup::setGutter( double _gutter ) throw (uno::RuntimeException)
+{
+ // default add gutter into left margin
+ if( _gutter != 0 )
+ {
+ double margin = VbaPageSetupBase::getLeftMargin() + _gutter;
+ VbaPageSetupBase::setLeftMargin( margin );
+ }
+}
+
+double SAL_CALL SwVbaPageSetup::getHeaderDistance() throw (uno::RuntimeException)
+{
+ sal_Bool isHeaderOn = sal_False;
+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn;
+ if( !isHeaderOn )
+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_True ) );
+ return VbaPageSetupBase::getHeaderMargin();
+}
+
+ /**
+ * changes the value of TopMargin to the value of new MS-Word-HeaderDistance. Subtracts the difference
+ * between old TopMargin and the new headerDistance from the value of HeaderSpacing (which defines the
+ * space between the header and the body of the text). calculates the new HeaderHeight (= height of the
+ * header + headerBodyDistance).
+ *
+ * @param: headerDistance is the value that is set in MS Word for the distance from the top of the page
+ * to the header
+ */
+void SAL_CALL SwVbaPageSetup::setHeaderDistance( double _headerdistance ) throw (uno::RuntimeException)
+{
+ sal_Int32 newHeaderDistance = Millimeter::getInHundredthsOfOneMillimeter( _headerdistance );
+ sal_Bool isHeaderOn = sal_False;
+ sal_Int32 aktTopMargin = 0;
+ sal_Int32 aktSpacing = 0;
+ sal_Int32 aktHeaderHeight = 0;
+
+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn;
+ if( !isHeaderOn )
+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_True ) );
+
+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))) >>= aktTopMargin;
+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance"))) >>= aktSpacing;
+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))) >>= aktHeaderHeight;
+
+ sal_Int32 newSpacing = aktSpacing - ( newHeaderDistance - aktTopMargin );
+ sal_Int32 height = aktHeaderHeight - aktSpacing;
+ sal_Int32 newHeaderHeight = newSpacing + height;
+
+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), uno::makeAny( newHeaderDistance ) );
+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance")), uno::makeAny( newSpacing ) );
+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight")), uno::makeAny( newHeaderHeight ) );
+}
+
+double SAL_CALL SwVbaPageSetup::getFooterDistance() throw (uno::RuntimeException)
+{
+ sal_Bool isFooterOn = sal_False;
+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isFooterOn;
+ if( !isFooterOn )
+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_True ) );
+ return VbaPageSetupBase::getFooterMargin();
+}
+
+void SAL_CALL SwVbaPageSetup::setFooterDistance( double _footerdistance ) throw (uno::RuntimeException)
+{
+ sal_Int32 newFooterDistance = Millimeter::getInHundredthsOfOneMillimeter( _footerdistance );
+ sal_Bool isFooterOn = sal_False;
+ sal_Int32 aktBottomMargin = 0;
+ sal_Int32 aktSpacing = 0;
+ sal_Int32 aktFooterHeight = 0;
+
+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isFooterOn;
+ if( !isFooterOn )
+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_True ) );
+
+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))) >>= aktBottomMargin;
+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance"))) >>= aktSpacing;
+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))) >>= aktFooterHeight;
+
+ sal_Int32 newSpacing = aktSpacing - ( newFooterDistance - aktBottomMargin );
+ sal_Int32 height = aktFooterHeight - aktSpacing;
+ sal_Int32 newFooterHeight = newSpacing + height;
+
+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), uno::makeAny( newFooterDistance ) );
+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance")), uno::makeAny( newSpacing ) );
+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight")), uno::makeAny( newFooterHeight ) );
+}
+
+sal_Bool SAL_CALL SwVbaPageSetup::getDifferentFirstPageHeaderFooter() throw (uno::RuntimeException)
+{
+ rtl::OUString pageStyle = getStyleOfFirstPage();
+ if( pageStyle.equalsAscii( "First Page" ) )
+ return sal_True;
+
+ return sal_False;
+}
+
+void SAL_CALL SwVbaPageSetup::setDifferentFirstPageHeaderFooter( sal_Bool status ) throw (uno::RuntimeException)
+{
+ if( status == getDifferentFirstPageHeaderFooter() )
+ return;
+
+ rtl::OUString newStyle;
+ if( status )
+ newStyle = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("First Page") );
+ else
+ newStyle = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") );
+
+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
+ sal_Int32 nTopMargin = 0;
+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))) >>= nTopMargin;
+ sal_Int32 nBottomMargin = 0;
+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))) >>= nBottomMargin;
+ sal_Int32 nLeftMargin = 0;
+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin"))) >>= nLeftMargin;
+ sal_Int32 nRightMargin = 0;
+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin"))) >>= nRightMargin;
+ sal_Int32 nHeaderHeight = 0;
+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))) >>= nHeaderHeight;
+ sal_Int32 nFooterHeight = 0;
+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))) >>= nFooterHeight;
+
+ sal_Bool isHeaderOn = sal_False;
+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn;
+ if( isHeaderOn )
+ {
+ nTopMargin += nHeaderHeight;
+ nBottomMargin += nFooterHeight;
+ xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_False ) );
+ xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_False ) );
+ }
+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( mxModel ), uno::UNO_QUERY_THROW );
+ if( xPageCursor->getPage() != 1 )
+ {
+ xPageCursor->jumpToFirstPage();
+ }
+
+ uno::Reference< beans::XPropertySet > xCursorProps( xPageCursor, uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xTableProps( xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ), uno::UNO_QUERY );
+ if( xTableProps.is() )
+ {
+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ), uno::makeAny( newStyle ) );
+ }
+ else
+ {
+ xCursorProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ), uno::makeAny( newStyle ) );
+ }
+
+ uno::Reference< beans::XPropertySet > xFirstPageProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
+ xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ), uno::makeAny( nTopMargin ) );
+ xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin") ), uno::makeAny( nBottomMargin ) );
+ xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ), uno::makeAny( nLeftMargin ) );
+ xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin") ), uno::makeAny( nRightMargin ) );
+}
+
+rtl::OUString SwVbaPageSetup::getStyleOfFirstPage() throw (uno::RuntimeException)
+{
+ rtl::OUString styleFirstPage;
+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( mxModel ), uno::UNO_QUERY_THROW );
+ if( xPageCursor->getPage() != 1 )
+ {
+ xPageCursor->jumpToFirstPage();
+ }
+
+ uno::Reference< beans::XPropertySet > xCursorProps( xPageCursor, uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xTableProps( xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ), uno::UNO_QUERY );
+ if( xTableProps.is() )
+ {
+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ) ) >>= styleFirstPage;
+ }
+ else
+ {
+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ) ) >>= styleFirstPage;
+ }
+ return styleFirstPage;
+}
+
+::sal_Int32 SAL_CALL SwVbaPageSetup::getSectionStart() throw (uno::RuntimeException)
+{
+ // FIXME:
+ sal_Int32 wdSectionStart = word::WdSectionStart::wdSectionNewPage;
+ uno::Reference< container::XNamed > xNamed( mxPageProps, uno::UNO_QUERY_THROW );
+ rtl::OUString sStyleName = xNamed->getName();
+ //mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sStyleName;
+ if( sStyleName.equalsAscii("Left Page") )
+ wdSectionStart = word::WdSectionStart::wdSectionEvenPage;
+ else if( sStyleName.equalsAscii("Right Page") )
+ wdSectionStart = word::WdSectionStart::wdSectionOddPage;
+ else
+ wdSectionStart = word::WdSectionStart::wdSectionNewPage;
+ return wdSectionStart;
+}
+
+void SAL_CALL SwVbaPageSetup::setSectionStart( ::sal_Int32 /*_sectionstart*/ ) throw (uno::RuntimeException)
+{
+ // fail to find corresponding feature in Writer
+ // #FIXME:
+}
+
+rtl::OUString&
+SwVbaPageSetup::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaPageSetup") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaPageSetup::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.PageSetup" ) );
+ }
+ return aServiceNames;
+}
diff --git a/sw/source/ui/vba/vbapagesetup.hxx b/sw/source/ui/vba/vbapagesetup.hxx
new file mode 100644
index 000000000000..df7c59a728ce
--- /dev/null
+++ b/sw/source/ui/vba/vbapagesetup.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_PAGESETUP_HXX
+#define SW_VBA_PAGESETUP_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <ooo/vba/word/XPageSetup.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <vbahelper/vbapagesetupbase.hxx>
+
+typedef cppu::ImplInheritanceHelper1< VbaPageSetupBase, ooo::vba::word::XPageSetup > SwVbaPageSetup_BASE;
+
+class SwVbaPageSetup : public SwVbaPageSetup_BASE
+{
+private:
+ rtl::OUString getStyleOfFirstPage() throw (css::uno::RuntimeException);
+
+public:
+ SwVbaPageSetup( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::frame::XModel >& xModel,
+ const css::uno::Reference< css::beans::XPropertySet >& xProps ) throw (css::uno::RuntimeException);
+ virtual ~SwVbaPageSetup(){}
+
+ // Attributes
+ virtual double SAL_CALL getGutter() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setGutter( double _gutter ) throw (css::uno::RuntimeException);
+ virtual double SAL_CALL getHeaderDistance() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setHeaderDistance( double _headerdistance ) throw (css::uno::RuntimeException);
+ virtual double SAL_CALL getFooterDistance() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setFooterDistance( double _footerdistance ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getDifferentFirstPageHeaderFooter() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDifferentFirstPageHeaderFooter( sal_Bool status ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getSectionStart() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSectionStart( ::sal_Int32 _sectionstart ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif
diff --git a/sw/source/ui/vba/vbapalette.cxx b/sw/source/ui/vba/vbapalette.cxx
new file mode 100644
index 000000000000..12554e792e5e
--- /dev/null
+++ b/sw/source/ui/vba/vbapalette.cxx
@@ -0,0 +1,75 @@
+#include "vbapalette.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <ooo/vba/word/WdColor.hpp>
+#include <ooo/vba/word/WdColorIndex.hpp>
+
+using namespace ::ooo::vba;
+using namespace ::ooo::vba::word;
+using namespace ::com::sun::star;
+
+static const sal_Int32 ColorTable[] =
+{
+WdColor::wdColorAutomatic, // 0
+WdColor::wdColorBlack, // 1
+WdColor::wdColorBlue, // 2
+WdColor::wdColorTurquoise, // 3
+WdColor::wdColorBrightGreen, // 4
+WdColor::wdColorPink, // 5
+WdColor::wdColorRed, // 6
+WdColor::wdColorYellow, // 7
+WdColor::wdColorWhite, // 8
+WdColor::wdColorDarkBlue, // 9
+WdColor::wdColorTeal, // 10
+WdColor::wdColorGreen, // 11
+WdColor::wdColorViolet, // 12
+WdColor::wdColorDarkRed, // 13
+WdColor::wdColorDarkYellow, // 14
+WdColor::wdColorGray50, // 15
+WdColor::wdColorGray25, // 16
+};
+
+typedef ::cppu::WeakImplHelper1< container::XIndexAccess > XIndexAccess_BASE;
+
+class DefaultPalette : public XIndexAccess_BASE
+{
+public:
+ DefaultPalette(){}
+
+ // Methods XIndexAccess
+ virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException)
+ {
+ return sizeof(ColorTable) / sizeof(ColorTable[0]);
+ }
+
+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ if ( Index < 0 || Index >= getCount() )
+ throw lang::IndexOutOfBoundsException();
+ return uno::makeAny( sal_Int32( ColorTable[ Index ] ) );
+ }
+
+ // Methods XElementAcess
+ virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException)
+ {
+ return ::getCppuType( (sal_Int32*)0 );
+ }
+ virtual ::sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException)
+ {
+ return sal_True;
+ }
+
+};
+
+VbaPalette::VbaPalette()
+{
+ mxPalette = new DefaultPalette();
+}
+
+uno::Reference< container::XIndexAccess >
+VbaPalette::getPalette() const
+{
+
+ return mxPalette;
+}
+
diff --git a/sw/source/ui/vba/vbapalette.hxx b/sw/source/ui/vba/vbapalette.hxx
new file mode 100644
index 000000000000..6179f1723c0b
--- /dev/null
+++ b/sw/source/ui/vba/vbapalette.hxx
@@ -0,0 +1,15 @@
+#ifndef VBAPALETTE_HXX
+#define VBAPALETTE_HXX
+#include <vbahelper/vbahelper.hxx>
+
+class VbaPalette
+{
+ css::uno::Reference< css::container::XIndexAccess > mxPalette;
+public:
+ VbaPalette();
+ // if no palette available e.g. because the document doesn't have a
+ // palette defined then a default palette will be returned.
+ css::uno::Reference< css::container::XIndexAccess > getPalette() const;
+};
+
+#endif
diff --git a/sw/source/ui/vba/vbapane.cxx b/sw/source/ui/vba/vbapane.cxx
new file mode 100644
index 000000000000..dc5d5ccff882
--- /dev/null
+++ b/sw/source/ui/vba/vbapane.cxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbapane.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <tools/diagnose_ex.h>
+#include "vbaview.hxx"
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaPane::SwVbaPane( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
+ const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) :
+ SwVbaPane_BASE( rParent, rContext ), mxModel( xModel )
+{
+}
+
+SwVbaPane::~SwVbaPane()
+{
+}
+
+uno::Any SAL_CALL
+SwVbaPane::View() throw ( css::uno::RuntimeException )
+{
+ return uno::makeAny( uno::Reference< word::XView >( new SwVbaView( this, mxContext, mxModel ) ) );
+}
+
+void SAL_CALL
+SwVbaPane::Close( ) throw ( css::uno::RuntimeException )
+{
+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseWin"));
+ dispatchRequests( mxModel,url );
+}
+
+rtl::OUString&
+SwVbaPane::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaPane") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaPane::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Pane" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbapane.hxx b/sw/source/ui/vba/vbapane.hxx
new file mode 100644
index 000000000000..b8a6fff38da3
--- /dev/null
+++ b/sw/source/ui/vba/vbapane.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_PANE_HXX
+#define SW_VBA_PANE_HXX
+
+#include <ooo/vba/word/XPane.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XPane > SwVbaPane_BASE;
+
+class SwVbaPane : public SwVbaPane_BASE
+{
+private:
+ css::uno::Reference< css::frame::XModel > mxModel;
+
+public:
+ SwVbaPane( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
+ const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::uno::RuntimeException );
+ virtual ~SwVbaPane();
+
+ // Methods
+ virtual css::uno::Any SAL_CALL View( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_PANE_HXX */
diff --git a/sw/source/ui/vba/vbapanes.cxx b/sw/source/ui/vba/vbapanes.cxx
new file mode 100644
index 000000000000..b536c800a854
--- /dev/null
+++ b/sw/source/ui/vba/vbapanes.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbapanes.hxx"
+#include "vbapane.hxx"
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+// I assume there is only one pane in Writer
+typedef ::cppu::WeakImplHelper1<container::XIndexAccess > PanesIndexAccess_Base;
+class PanesIndexAccess : public PanesIndexAccess_Base
+{
+private:
+ uno::Reference< XHelperInterface > mxParent;
+ uno::Reference< uno::XComponentContext > mxContext;
+ uno::Reference< frame::XModel > mxModel;
+
+public:
+ PanesIndexAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ) {}
+ ~PanesIndexAccess(){}
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
+ {
+ return 1;
+ }
+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ if( Index != 1 )
+ throw container::NoSuchElementException();
+ return uno::makeAny( uno::Reference< word::XPane >( new SwVbaPane( mxParent, mxContext, mxModel ) ) );
+ }
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
+ {
+ return word::XPane::static_type(0);
+ }
+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
+ {
+ return sal_True;
+ }
+};
+
+class PanesEnumWrapper : public EnumerationHelper_BASE
+{
+ uno::Reference<container::XIndexAccess > m_xIndexAccess;
+ sal_Int32 nIndex;
+public:
+ PanesEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {}
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
+ {
+ return ( nIndex < m_xIndexAccess->getCount() );
+ }
+
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ if ( nIndex < m_xIndexAccess->getCount() )
+ return m_xIndexAccess->getByIndex( nIndex++ );
+ throw container::NoSuchElementException();
+ }
+};
+
+SwVbaPanes::SwVbaPanes( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaPanes_BASE( xParent, xContext, new PanesIndexAccess( xParent, xContext, xModel ) ), mxModel( xModel )
+{
+}
+// XEnumerationAccess
+uno::Type
+SwVbaPanes::getElementType() throw (uno::RuntimeException)
+{
+ return word::XPane::static_type(0);
+}
+uno::Reference< container::XEnumeration >
+SwVbaPanes::createEnumeration() throw (uno::RuntimeException)
+{
+ return new PanesEnumWrapper( m_xIndexAccess );
+}
+
+uno::Any
+SwVbaPanes::createCollectionObject( const css::uno::Any& aSource )
+{
+ return aSource;
+}
+
+rtl::OUString&
+SwVbaPanes::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaPanes") );
+ return sImplName;
+}
+
+css::uno::Sequence<rtl::OUString>
+SwVbaPanes::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > sNames;
+ if ( sNames.getLength() == 0 )
+ {
+ sNames.realloc( 1 );
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Panes") );
+ }
+ return sNames;
+}
diff --git a/sw/source/ui/vba/vbapanes.hxx b/sw/source/ui/vba/vbapanes.hxx
new file mode 100644
index 000000000000..76c24166cfa7
--- /dev/null
+++ b/sw/source/ui/vba/vbapanes.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_PANES_HXX
+#define SW_VBA_PANES_HXX
+
+#include <vbahelper/vbacollectionimpl.hxx>
+#include <ooo/vba/word/XPanes.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+
+typedef CollTestImplHelper< ooo::vba::word::XPanes > SwVbaPanes_BASE;
+
+class SwVbaPanes : public SwVbaPanes_BASE
+{
+private:
+ css::uno::Reference< css::frame::XModel > mxModel;
+
+public:
+ SwVbaPanes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
+ virtual ~SwVbaPanes() {}
+
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+
+ // SwVbaPanes_BASE
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif /* SW_VBA_PANES_HXX */
diff --git a/sw/source/ui/vba/vbaparagraph.cxx b/sw/source/ui/vba/vbaparagraph.cxx
new file mode 100644
index 000000000000..333fd4ca9a98
--- /dev/null
+++ b/sw/source/ui/vba/vbaparagraph.cxx
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbaparagraph.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <tools/diagnose_ex.h>
+#include "vbarange.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaParagraph::SwVbaParagraph( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xDocument, const uno::Reference< text::XTextRange >& xTextRange ) throw ( uno::RuntimeException ) :
+ SwVbaParagraph_BASE( rParent, rContext ), mxTextDocument( xDocument ), mxTextRange( xTextRange )
+{
+}
+
+SwVbaParagraph::~SwVbaParagraph()
+{
+}
+
+uno::Reference< word::XRange > SAL_CALL
+SwVbaParagraph::getRange( ) throw ( uno::RuntimeException )
+{
+ return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, mxTextRange->getStart(), mxTextRange->getEnd(), mxTextRange->getText(), sal_True ) );
+}
+
+rtl::OUString&
+SwVbaParagraph::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraph") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaParagraph::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Paragraph" ) );
+ }
+ return aServiceNames;
+}
+
+
+//typedef ::cppu::WeakImplHelper1< container::XEnumeration > ParagraphEnumeration_BASE;
+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > ParagraphCollectionHelper_BASE;
+
+class ParagraphCollectionHelper : public ParagraphCollectionHelper_BASE
+{
+private:
+ uno::Reference< text::XTextDocument > mxTextDocument;
+
+ uno::Reference< container::XEnumeration > getEnumeration() throw (uno::RuntimeException)
+ {
+ uno::Reference< container::XEnumerationAccess > xParEnumAccess( mxTextDocument->getText(), uno::UNO_QUERY_THROW );
+ return xParEnumAccess->createEnumeration();
+ }
+
+public:
+ ParagraphCollectionHelper( const uno::Reference< text::XTextDocument >& xDocument ) throw (uno::RuntimeException): mxTextDocument( xDocument )
+ {
+ }
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return text::XTextRange::static_type(0); }
+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return sal_True; }
+ // XIndexAccess
+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
+ {
+ sal_Int32 nCount = 0;
+ uno::Reference< container::XEnumeration > xParEnum = getEnumeration();
+ while( xParEnum->hasMoreElements() )
+ {
+ uno::Reference< lang::XServiceInfo > xServiceInfo( xParEnum->nextElement(), uno::UNO_QUERY_THROW );
+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph") ) ) )
+ {
+ nCount++;
+ }
+ }
+ return nCount;
+ }
+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
+ {
+ if( Index < getCount() )
+ {
+ sal_Int32 nCount = 0;
+ uno::Reference< container::XEnumeration > xParEnum = getEnumeration();
+ while( xParEnum->hasMoreElements() )
+ {
+ uno::Reference< lang::XServiceInfo > xServiceInfo( xParEnum->nextElement(), uno::UNO_QUERY_THROW );
+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph") ) ) )
+ {
+ if( Index == nCount )
+ return uno::makeAny( xServiceInfo );
+ nCount++;
+ }
+ }
+ }
+ throw lang::IndexOutOfBoundsException();
+ }
+ // XEnumerationAccess
+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
+ {
+ return getEnumeration();
+ }
+};
+
+SwVbaParagraphs::SwVbaParagraphs( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDocument ) throw (uno::RuntimeException) : SwVbaParagraphs_BASE( xParent, xContext, new ParagraphCollectionHelper( xDocument ) ), mxTextDocument( xDocument )
+{
+}
+
+// XEnumerationAccess
+uno::Type
+SwVbaParagraphs::getElementType() throw (uno::RuntimeException)
+{
+ return word::XParagraph::static_type(0);
+}
+uno::Reference< container::XEnumeration >
+SwVbaParagraphs::createEnumeration() throw (uno::RuntimeException)
+{
+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
+ return xEnumerationAccess->createEnumeration();
+}
+
+uno::Any
+SwVbaParagraphs::createCollectionObject( const css::uno::Any& aSource )
+{
+ uno::Reference< text::XTextRange > xTextRange( aSource, uno::UNO_QUERY_THROW );
+ return uno::makeAny( uno::Reference< word::XParagraph >( new SwVbaParagraph( this, mxContext, mxTextDocument, xTextRange ) ) );
+}
+
+rtl::OUString&
+SwVbaParagraphs::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraphs") );
+ return sImplName;
+}
+
+css::uno::Sequence<rtl::OUString>
+SwVbaParagraphs::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > sNames;
+ if ( sNames.getLength() == 0 )
+ {
+ sNames.realloc( 1 );
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Paragraphs") );
+ }
+ return sNames;
+}
diff --git a/sw/source/ui/vba/vbaparagraph.hxx b/sw/source/ui/vba/vbaparagraph.hxx
new file mode 100644
index 000000000000..894ac61cc7e6
--- /dev/null
+++ b/sw/source/ui/vba/vbaparagraph.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_PARAGRAPH_HXX
+#define SW_VBA_PARAGRAPH_HXX
+
+#include <vbahelper/vbacollectionimpl.hxx>
+#include <ooo/vba/word/XParagraphs.hpp>
+#include <ooo/vba/word/XParagraph.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XParagraph > SwVbaParagraph_BASE;
+
+class SwVbaParagraph : public SwVbaParagraph_BASE
+{
+private:
+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
+ css::uno::Reference< css::text::XTextRange > mxTextRange;
+
+public:
+ SwVbaParagraph( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xDocument, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException );
+ virtual ~SwVbaParagraph();
+
+ // XParagraph
+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getRange() throw ( css::uno::RuntimeException );
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+
+/* class SwVbaParagraphs */
+typedef CollTestImplHelper< ooo::vba::word::XParagraphs > SwVbaParagraphs_BASE;
+
+class SwVbaParagraphs : public SwVbaParagraphs_BASE
+{
+private:
+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
+public:
+ SwVbaParagraphs( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xDocument ) throw (css::uno::RuntimeException);
+ virtual ~SwVbaParagraphs() {}
+
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+
+ // SwVbaParagraphs_BASE
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif /* SW_VBA_PARAGRAPH_HXX */
diff --git a/sw/source/ui/vba/vbaparagraphformat.cxx b/sw/source/ui/vba/vbaparagraphformat.cxx
new file mode 100644
index 000000000000..07a822ad5752
--- /dev/null
+++ b/sw/source/ui/vba/vbaparagraphformat.cxx
@@ -0,0 +1,573 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbaparagraphformat.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <tools/diagnose_ex.h>
+#include "wordvbahelper.hxx"
+#include <com/sun/star/style/LineSpacingMode.hpp>
+#include <ooo/vba/word/WdLineSpacing.hpp>
+#include <ooo/vba/word/WdParagraphAlignment.hpp>
+#include <ooo/vba/word/WdOutlineLevel.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/style/BreakType.hpp>
+
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+static const sal_Int16 CHARACTER_INDENT_FACTOR = 12;
+static const sal_Int16 PERCENT100 = 100;
+static const sal_Int16 PERCENT150 = 150;
+static const sal_Int16 PERCENT200 = 200;
+
+SwVbaParagraphFormat::SwVbaParagraphFormat( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< beans::XPropertySet >& rParaProps ) : SwVbaParagraphFormat_BASE( rParent, rContext ), mxTextDocument( rTextDocument ), mxParaProps( rParaProps )
+{
+}
+
+SwVbaParagraphFormat::~SwVbaParagraphFormat()
+{
+}
+
+sal_Int32 SAL_CALL SwVbaParagraphFormat::getAlignment() throw (uno::RuntimeException)
+{
+ style::ParagraphAdjust aParaAdjust = style::ParagraphAdjust_LEFT;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaAdjust") ) ) >>= aParaAdjust;
+ return getMSWordAlignment( aParaAdjust );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setAlignment( sal_Int32 _alignment ) throw (uno::RuntimeException)
+{
+ style::ParagraphAdjust aParaAdjust = ( style::ParagraphAdjust ) getOOoAlignment( _alignment );
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaAdjust") ), uno::makeAny( aParaAdjust ) );
+}
+
+float SAL_CALL SwVbaParagraphFormat::getFirstLineIndent() throw (uno::RuntimeException)
+{
+ sal_Int32 indent = 0;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaFirstLineIndent") ) ) >>= indent;
+ return (float)( Millimeter::getInPoints( indent ) );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setFirstLineIndent( float _firstlineindent ) throw (uno::RuntimeException)
+{
+ sal_Int32 indent = Millimeter::getInHundredthsOfOneMillimeter( _firstlineindent );
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaFirstLineIndent") ), uno::makeAny( indent ) );
+}
+
+uno::Any SAL_CALL SwVbaParagraphFormat::getKeepTogether() throw (uno::RuntimeException)
+{
+ sal_Bool bKeep = sal_False;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaKeepTogether") ) ) >>= bKeep;
+ return uno::makeAny ( bKeep );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setKeepTogether( const uno::Any& _keeptogether ) throw (uno::RuntimeException)
+{
+ sal_Bool bKeep = sal_False;
+ if( _keeptogether >>= bKeep )
+ {
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaKeepTogether") ), uno::makeAny( bKeep ) );
+ }
+ else
+ {
+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
+ }
+}
+
+uno::Any SAL_CALL SwVbaParagraphFormat::getKeepWithNext() throw (uno::RuntimeException)
+{
+ sal_Bool bKeep = sal_False;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaSplit") ) ) >>= bKeep;
+ return uno::makeAny ( bKeep );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setKeepWithNext( const uno::Any& _keepwithnext ) throw (uno::RuntimeException)
+{
+ sal_Bool bKeep = sal_False;
+ if( _keepwithnext >>= bKeep )
+ {
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaSplit") ), uno::makeAny( bKeep ) );
+ }
+ else
+ {
+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
+ }
+}
+
+uno::Any SAL_CALL SwVbaParagraphFormat::getHyphenation() throw (uno::RuntimeException)
+{
+ sal_Bool bHypn = sal_False;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation") ) ) >>= bHypn;
+ return uno::makeAny ( bHypn );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setHyphenation( const uno::Any& _hyphenation ) throw (uno::RuntimeException)
+{
+ sal_Bool bHypn = sal_False;
+ if( _hyphenation >>= bHypn )
+ {
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation") ), uno::makeAny( bHypn ) );
+ }
+ else
+ {
+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
+ }
+}
+
+float SAL_CALL SwVbaParagraphFormat::getLineSpacing() throw (uno::RuntimeException)
+{
+ style::LineSpacing aLineSpacing;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing;
+ return getMSWordLineSpacing( aLineSpacing );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setLineSpacing( float _linespacing ) throw (uno::RuntimeException)
+{
+ style::LineSpacing aLineSpacing;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing;
+ aLineSpacing = getOOoLineSpacing( _linespacing, aLineSpacing.Mode );
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ), uno::makeAny( aLineSpacing ) );
+}
+
+sal_Int32 SAL_CALL SwVbaParagraphFormat::getLineSpacingRule() throw (uno::RuntimeException)
+{
+ style::LineSpacing aLineSpacing;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing;
+ return getMSWordLineSpacingRule( aLineSpacing );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setLineSpacingRule( sal_Int32 _linespacingrule ) throw (uno::RuntimeException)
+{
+ style::LineSpacing aLineSpacing = getOOoLineSpacingFromRule( _linespacingrule );
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ), uno::makeAny( aLineSpacing ) );
+}
+
+uno::Any SAL_CALL SwVbaParagraphFormat::getNoLineNumber() throw (uno::RuntimeException)
+{
+ sal_Bool noLineNum = sal_False;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineNumberCount") ) ) >>= noLineNum;
+ return uno::makeAny ( noLineNum );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setNoLineNumber( const uno::Any& _nolinenumber ) throw (uno::RuntimeException)
+{
+ sal_Bool noLineNum = sal_False;
+ if( _nolinenumber >>= noLineNum )
+ {
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineNumberCount") ), uno::makeAny( noLineNum ) );
+ }
+ else
+ {
+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
+ }
+}
+
+sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel() throw (uno::RuntimeException)
+{
+ sal_Int32 nLevel = word::WdOutlineLevel::wdOutlineLevelBodyText;
+ rtl::OUString aHeading;
+ const rtl::OUString HEADING = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Heading") );
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ) ) >>= aHeading;
+ if( aHeading.indexOf( HEADING ) == 0 )
+ {
+ // get the sub string after "Heading"
+ nLevel = aHeading.copy( HEADING.getLength() ).toInt32();
+ }
+ return nLevel;
+}
+
+void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 /*_outlinelevel*/ ) throw (uno::RuntimeException)
+{
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+}
+
+uno::Any SAL_CALL SwVbaParagraphFormat::getPageBreakBefore() throw (uno::RuntimeException)
+{
+ style::BreakType aBreakType;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ) ) >>= aBreakType;
+ sal_Bool bBreakBefore = ( aBreakType == style::BreakType_PAGE_BEFORE || aBreakType == style::BreakType_PAGE_BOTH );
+ return uno::makeAny( bBreakBefore );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setPageBreakBefore( const uno::Any& _breakbefore ) throw (uno::RuntimeException)
+{
+ sal_Bool bBreakBefore = sal_False;
+ if( _breakbefore >>= bBreakBefore )
+ {
+ style::BreakType aBreakType;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ) ) >>= aBreakType;
+ if( bBreakBefore )
+ {
+ if( aBreakType == style::BreakType_NONE )
+ aBreakType = style::BreakType_PAGE_BEFORE;
+ else if ( aBreakType == style::BreakType_PAGE_AFTER )
+ aBreakType = style::BreakType_PAGE_BOTH;
+ }
+ else
+ {
+ if( aBreakType == style::BreakType_PAGE_BOTH )
+ aBreakType = style::BreakType_PAGE_AFTER;
+ else if ( aBreakType == style::BreakType_PAGE_BEFORE )
+ aBreakType = style::BreakType_PAGE_AFTER;
+ }
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ), uno::makeAny( aBreakType ) );
+ }
+ else
+ {
+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
+ }
+}
+
+float SAL_CALL SwVbaParagraphFormat::getSpaceBefore() throw (uno::RuntimeException)
+{
+ sal_Int32 nSpace = 0;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTopMargin") ) ) >>= nSpace;
+ return (float)( Millimeter::getInPoints( nSpace ) );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setSpaceBefore( float _space ) throw (uno::RuntimeException)
+{
+ sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _space );
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTopMargin") ), uno::makeAny( nSpace ) );
+}
+
+float SAL_CALL SwVbaParagraphFormat::getSpaceAfter() throw (uno::RuntimeException)
+{
+ sal_Int32 nSpace = 0;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaBottomMargin") ) ) >>= nSpace;
+ return (float)( Millimeter::getInPoints( nSpace ) );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setSpaceAfter( float _space ) throw (uno::RuntimeException)
+{
+ sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _space );
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaBottomMargin") ), uno::makeAny( nSpace ) );
+}
+
+float SAL_CALL SwVbaParagraphFormat::getLeftIndent() throw (uno::RuntimeException)
+{
+ sal_Int32 nIndent = 0;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLeftMargin") ) ) >>= nIndent;
+ return (float)( Millimeter::getInPoints( nIndent ) );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setLeftIndent( float _leftindent ) throw (uno::RuntimeException)
+{
+ sal_Int32 nIndent = Millimeter::getInHundredthsOfOneMillimeter( _leftindent );
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLeftMargin") ), uno::makeAny( nIndent ) );
+}
+
+float SAL_CALL SwVbaParagraphFormat::getRightIndent() throw (uno::RuntimeException)
+{
+ sal_Int32 nIndent = 0;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaRightMargin") ) ) >>= nIndent;
+ return (float)( Millimeter::getInPoints( nIndent ) );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setRightIndent( float _rightindent ) throw (uno::RuntimeException)
+{
+ sal_Int32 nIndent = Millimeter::getInHundredthsOfOneMillimeter( _rightindent );
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaRightMargin") ), uno::makeAny( nIndent ) );
+}
+
+uno::Any SAL_CALL SwVbaParagraphFormat::getTabStops() throw (uno::RuntimeException)
+{
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setTabStops( const uno::Any& /*_tabstops*/ ) throw (uno::RuntimeException)
+{
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+}
+
+uno::Any SAL_CALL SwVbaParagraphFormat::getWidowControl() throw (uno::RuntimeException)
+{
+ sal_Bool bWidow = sal_False;
+ sal_Int8 nWidow = 0;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaWidows") ) ) >>= nWidow;
+ sal_Int8 nOrphan = 0;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaOrphans") ) ) >>= nOrphan;
+ // if the amount of single lines on one page > 1 and the same of start and end of the paragraph,
+ // true is retured.
+ bWidow = ( nWidow > 1 && nOrphan == nWidow );
+ return uno::makeAny( bWidow );
+}
+
+void SAL_CALL SwVbaParagraphFormat::setWidowControl( const uno::Any& _widowcontrol ) throw (uno::RuntimeException)
+{
+ // if we get true, the part of the paragraph on one page has to be
+ // at least two lines
+ sal_Bool bWidow = sal_False;
+ if( _widowcontrol >>= bWidow )
+ {
+ sal_Int8 nControl = bWidow? 2:1;
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaWidows") ), uno::makeAny( nControl ) );
+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaOrphans") ), uno::makeAny( nControl ) );
+ }
+ else
+ {
+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
+ }
+}
+
+style::LineSpacing SwVbaParagraphFormat::getOOoLineSpacing( float _lineSpace, sal_Int16 mode )
+{
+ style::LineSpacing aLineSpacing;
+ if( mode != style::LineSpacingMode::MINIMUM && mode != style::LineSpacingMode::FIX )
+ {
+ // special behaviour of word: if the space is set to these values, the rule and
+ // the height are changed accordingly
+ if( _lineSpace == CHARACTER_INDENT_FACTOR )
+ {
+ aLineSpacing.Mode = style::LineSpacingMode::PROP;
+ aLineSpacing.Height = PERCENT100;
+ }
+ else if( _lineSpace == ( sal_Int16 )( CHARACTER_INDENT_FACTOR * 1.5 ) )
+ {
+ aLineSpacing.Mode = style::LineSpacingMode::PROP;
+ aLineSpacing.Height = PERCENT150;
+ }
+ else if( _lineSpace == ( sal_Int16 )( ( CHARACTER_INDENT_FACTOR ) * 2 ) )
+ {
+ aLineSpacing.Mode = style::LineSpacingMode::PROP;
+ aLineSpacing.Height = PERCENT200;
+ }
+ else
+ {
+ aLineSpacing.Mode = style::LineSpacingMode::FIX;
+ aLineSpacing.Height = ( sal_Int16 )( Millimeter::getInHundredthsOfOneMillimeter( _lineSpace ) );
+ }
+ }
+ else
+ {
+ aLineSpacing.Mode = mode;
+ aLineSpacing.Height = ( sal_Int16 )( Millimeter::getInHundredthsOfOneMillimeter( _lineSpace ) );
+ }
+ return aLineSpacing;
+}
+
+style::LineSpacing SwVbaParagraphFormat::getOOoLineSpacingFromRule( sal_Int32 _linespacingrule )
+{
+ style::LineSpacing aLineSpacing;
+ switch( _linespacingrule )
+ {
+ case word::WdLineSpacing::wdLineSpace1pt5:
+ {
+ aLineSpacing.Mode = style::LineSpacingMode::PROP;
+ aLineSpacing.Height = PERCENT150;
+ break;
+ }
+ case word::WdLineSpacing::wdLineSpaceAtLeast:
+ {
+ aLineSpacing.Mode = style::LineSpacingMode::MINIMUM;
+ aLineSpacing.Height = getCharHeight();
+ break;
+ }
+ case word::WdLineSpacing::wdLineSpaceDouble:
+ {
+ aLineSpacing.Mode = style::LineSpacingMode::PROP;
+ aLineSpacing.Height = getCharHeight();
+ break;
+ }
+ case word::WdLineSpacing::wdLineSpaceExactly:
+ case word::WdLineSpacing::wdLineSpaceMultiple:
+ {
+ aLineSpacing.Mode = style::LineSpacingMode::FIX;
+ aLineSpacing.Height = getCharHeight();
+ break;
+ }
+ case word::WdLineSpacing::wdLineSpaceSingle:
+ {
+ aLineSpacing.Mode = style::LineSpacingMode::PROP;
+ aLineSpacing.Height = PERCENT100;
+ break;
+ }
+ default:
+ {
+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
+ break;
+ }
+ }
+ return aLineSpacing;
+}
+
+float SwVbaParagraphFormat::getMSWordLineSpacing( style::LineSpacing& rLineSpacing )
+{
+ float wdLineSpacing = 0;
+ if( rLineSpacing.Mode != style::LineSpacingMode::PROP )
+ {
+ wdLineSpacing = (float)( Millimeter::getInPoints( rLineSpacing.Height ) );
+ }
+ else
+ {
+ wdLineSpacing = (float)( CHARACTER_INDENT_FACTOR * rLineSpacing.Height ) / PERCENT100;
+ }
+ return wdLineSpacing;
+}
+
+sal_Int32 SwVbaParagraphFormat::getMSWordLineSpacingRule( style::LineSpacing& rLineSpacing )
+{
+ sal_Int32 wdLineSpacing = word::WdLineSpacing::wdLineSpaceSingle;
+ switch( rLineSpacing.Mode )
+ {
+ case style::LineSpacingMode::PROP:
+ {
+ switch( rLineSpacing.Height )
+ {
+ case PERCENT100:
+ {
+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceSingle;
+ break;
+ }
+ case PERCENT150:
+ {
+ wdLineSpacing = word::WdLineSpacing::wdLineSpace1pt5;
+ break;
+ }
+ case PERCENT200:
+ {
+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceDouble;
+ break;
+ }
+ default:
+ {
+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceMultiple;
+ }
+ }
+ break;
+ }
+ case style::LineSpacingMode::MINIMUM:
+ {
+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceAtLeast;
+ break;
+ }
+ case style::LineSpacingMode::FIX:
+ case style::LineSpacingMode::LEADING:
+ {
+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceExactly;
+ break;
+ }
+ default:
+ {
+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
+ }
+ }
+ return wdLineSpacing;
+}
+
+sal_Int16 SwVbaParagraphFormat::getCharHeight() throw (uno::RuntimeException)
+{
+ float fCharHeight = 0.0;
+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharHeight") ) ) >>= fCharHeight;
+ return (sal_Int16)( Millimeter::getInHundredthsOfOneMillimeter( fCharHeight ) );
+}
+
+sal_Int32 SwVbaParagraphFormat::getOOoAlignment( sal_Int32 _alignment )
+{
+ sal_Int32 nParaAjust = style::ParagraphAdjust_LEFT;
+ switch( _alignment )
+ {
+ case word::WdParagraphAlignment::wdAlignParagraphCenter:
+ {
+ nParaAjust = style::ParagraphAdjust_CENTER;
+ break;
+ }
+ case word::WdParagraphAlignment::wdAlignParagraphJustify:
+ {
+ nParaAjust = style::ParagraphAdjust_BLOCK;
+ break;
+ }
+ case word::WdParagraphAlignment::wdAlignParagraphLeft:
+ {
+ nParaAjust = style::ParagraphAdjust_LEFT;
+ break;
+ }
+ case word::WdParagraphAlignment::wdAlignParagraphRight:
+ {
+ nParaAjust = style::ParagraphAdjust_RIGHT;
+ break;
+ }
+ default:
+ {
+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
+ }
+ }
+ return nParaAjust;
+}
+
+sal_Int32 SwVbaParagraphFormat::getMSWordAlignment( sal_Int32 _alignment )
+{
+ sal_Int32 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphLeft;
+ switch( _alignment )
+ {
+ case style::ParagraphAdjust_CENTER:
+ {
+ wdAlignment = word::WdParagraphAlignment::wdAlignParagraphCenter;
+ break;
+ }
+ case style::ParagraphAdjust_LEFT:
+ {
+ wdAlignment = word::WdParagraphAlignment::wdAlignParagraphLeft;
+ break;
+ }
+ case style::ParagraphAdjust_BLOCK:
+ {
+ wdAlignment = word::WdParagraphAlignment::wdAlignParagraphJustify;
+ break;
+ }
+ case style::ParagraphAdjust_RIGHT:
+ {
+ wdAlignment = word::WdParagraphAlignment::wdAlignParagraphRight;
+ break;
+ }
+ default:
+ {
+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
+ }
+ }
+ return wdAlignment;
+}
+
+rtl::OUString&
+SwVbaParagraphFormat::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraphFormat") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaParagraphFormat::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ParagraphFormat" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbaparagraphformat.hxx b/sw/source/ui/vba/vbaparagraphformat.hxx
new file mode 100644
index 000000000000..684390820e13
--- /dev/null
+++ b/sw/source/ui/vba/vbaparagraphformat.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_PARAGRAPHFORMAT_HXX
+#define SW_VBA_PARAGRAPHFORMAT_HXX
+
+#include <ooo/vba/word/XParagraphFormat.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XParagraphFormat > SwVbaParagraphFormat_BASE;
+
+class SwVbaParagraphFormat : public SwVbaParagraphFormat_BASE
+{
+private:
+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
+ css::uno::Reference< css::beans::XPropertySet > mxParaProps;
+
+private:
+ css::style::LineSpacing getOOoLineSpacing( float _lineSpace, sal_Int16 mode );
+ css::style::LineSpacing getOOoLineSpacingFromRule( sal_Int32 _linespacingrule );
+ float getMSWordLineSpacing( css::style::LineSpacing& rLineSpacing );
+ sal_Int32 getMSWordLineSpacingRule( css::style::LineSpacing& rLineSpacing );
+ sal_Int16 getCharHeight() throw (css::uno::RuntimeException);
+ sal_Int32 getOOoAlignment( sal_Int32 _alignment );
+ sal_Int32 getMSWordAlignment( sal_Int32 _alignment );
+
+public:
+ SwVbaParagraphFormat( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::beans::XPropertySet >& rParaProps );
+ virtual ~SwVbaParagraphFormat();
+
+ // Attributes
+ virtual ::sal_Int32 SAL_CALL getAlignment() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAlignment( ::sal_Int32 _alignment ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL getFirstLineIndent() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setFirstLineIndent( float _firstlineindent ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getKeepTogether() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setKeepTogether( const css::uno::Any& _keeptogether ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getKeepWithNext() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setKeepWithNext( const css::uno::Any& _keepwithnext ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getHyphenation() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setHyphenation( const css::uno::Any& _hyphenation ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL getLineSpacing() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setLineSpacing( float _linespacing ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getLineSpacingRule() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setLineSpacingRule( ::sal_Int32 _linespacingrule ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getNoLineNumber() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setNoLineNumber( const css::uno::Any& _nolinenumber ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getOutlineLevel() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setOutlineLevel( ::sal_Int32 _outlinelevel ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getPageBreakBefore() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setPageBreakBefore( const css::uno::Any& _pagebreakbefore ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL getSpaceBefore() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSpaceBefore( float _spacebefore ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL getSpaceAfter() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSpaceAfter( float _spaceafter ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL getLeftIndent() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setLeftIndent( float _leftindent ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL getRightIndent() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setRightIndent( float _rightindent ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getTabStops() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setTabStops( const css::uno::Any& _tabstops ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getWidowControl() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setWidowControl( const css::uno::Any& _widowcontrol ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_PARAGRAPHFORMAT_HXX */
diff --git a/sw/source/ui/vba/vbarange.cxx b/sw/source/ui/vba/vbarange.cxx
new file mode 100644
index 000000000000..647aedb34791
--- /dev/null
+++ b/sw/source/ui/vba/vbarange.cxx
@@ -0,0 +1,345 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbarange.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <tools/diagnose_ex.h>
+#include "vbarangehelper.hxx"
+#include <ooo/vba/word/WdBreakType.hpp>
+#include <com/sun/star/style/BreakType.hpp>
+#include <com/sun/star/text/ControlCharacter.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include "wordvbahelper.hxx"
+#include "vbaparagraphformat.hxx"
+#include "vbastyle.hxx"
+#include "vbafont.hxx"
+#include "vbapalette.hxx"
+#include "vbapagesetup.hxx"
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, sal_Bool _bMaySpanEndOfDocument ) throw (uno::RuntimeException) : SwVbaRange_BASE( rParent, rContext ), mxTextDocument( rTextDocument ), mbMaySpanEndOfDocument( _bMaySpanEndOfDocument )
+{
+ uno::Reference< text::XTextRange > xEnd;
+ initialize( rStart, xEnd );
+}
+
+SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument ) throw (uno::RuntimeException) : SwVbaRange_BASE( rParent, rContext ), mxTextDocument( rTextDocument ), mbMaySpanEndOfDocument( _bMaySpanEndOfDocument )
+{
+ initialize( rStart, rEnd );
+}
+
+SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd, const uno::Reference< text::XText >& rText, sal_Bool _bMaySpanEndOfDocument ) throw (uno::RuntimeException) : SwVbaRange_BASE( rParent, rContext ),mxTextDocument( rTextDocument ), mxText( rText ), mbMaySpanEndOfDocument( _bMaySpanEndOfDocument )
+{
+ initialize( rStart, rEnd );
+}
+
+SwVbaRange::~SwVbaRange()
+{
+}
+
+void SwVbaRange::initialize( const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd ) throw (uno::RuntimeException)
+{
+ if( !mxText.is() )
+ {
+ mxText = mxTextDocument->getText();
+ }
+
+ mxTextCursor = SwVbaRangeHelper::initCursor( rStart, mxText );
+ mxTextCursor->collapseToStart();
+
+ if( rEnd.is() )
+ mxTextCursor->gotoRange( rEnd, sal_True );
+ else
+ mxTextCursor->gotoEnd( sal_True );
+}
+
+uno::Reference< text::XTextRange > SAL_CALL
+SwVbaRange::getXTextRange() throw (uno::RuntimeException)
+{
+ uno::Reference< text::XTextRange > xTextRange( mxTextCursor, uno::UNO_QUERY_THROW );
+ return xTextRange;
+}
+#ifdef TOMORROW
+void SwVbaRange::setXTextRange( const uno::Reference< text::XTextRange >& xRange ) throw (uno::RuntimeException)
+{
+ mxTextCursor->gotoRange( xRange->getStart(), sal_False );
+ mxTextCursor->gotoRange( xRange->getEnd(), sal_True );
+}
+#endif
+/**
+* The complexity in this method is because we need to workaround
+* an issue that the last paragraph in a document does not have a trailing CRLF.
+* @return
+*/
+rtl::OUString SAL_CALL
+SwVbaRange::getText() throw ( uno::RuntimeException )
+{
+ rtl::OUString aText = mxTextCursor->getString();
+ sal_Int32 nLen = aText.getLength();
+
+ // FIXME: should add a line separator if the range includes the last paragraph
+ if( nLen == 0 )
+ {
+ if( mxTextCursor->isCollapsed() )
+ {
+ mxTextCursor->goRight( 1, sal_True );
+ aText = mxTextCursor->getString();
+ mxTextCursor->collapseToStart();
+ }
+ else
+ {
+ uno::Reference< text::XTextRange > xStart = mxTextCursor->getStart();
+ uno::Reference< text::XTextRange > xEnd = mxTextCursor->getEnd();
+ mxTextCursor->collapseToEnd();
+ mxTextCursor->goRight( 1, sal_True );
+ mxTextCursor->gotoRange( xStart, sal_False );
+ mxTextCursor->gotoRange( xEnd, sal_True );
+ }
+ }
+
+ return aText;
+}
+
+void SAL_CALL
+SwVbaRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
+{
+ if( rText.indexOf( '\n' ) != -1 )
+ {
+ mxTextCursor->setString( rtl::OUString() );
+ // process CR in strings
+ uno::Reference< text::XTextRange > xRange( mxTextCursor, uno::UNO_QUERY_THROW );
+ SwVbaRangeHelper::insertString( xRange, mxText, rText, sal_True );
+ }
+ else
+ {
+ mxTextCursor->setString( rText );
+ }
+}
+
+// FIXME: test is not pass
+void SAL_CALL SwVbaRange::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException)
+{
+ // default type is wdPageBreak;
+ sal_Int32 nBreakType = word::WdBreakType::wdPageBreak;
+ if( _breakType.hasValue() )
+ _breakType >>= nBreakType;
+
+ style::BreakType eBreakType = style::BreakType_NONE;
+ switch( nBreakType )
+ {
+ case word::WdBreakType::wdPageBreak:
+ eBreakType = style::BreakType_PAGE_BEFORE;
+ break;
+ case word::WdBreakType::wdColumnBreak:
+ eBreakType = style::BreakType_COLUMN_AFTER;
+ break;
+ case word::WdBreakType::wdLineBreak:
+ case word::WdBreakType::wdLineBreakClearLeft:
+ case word::WdBreakType::wdLineBreakClearRight:
+ case word::WdBreakType::wdSectionBreakContinuous:
+ case word::WdBreakType::wdSectionBreakEvenPage:
+ case word::WdBreakType::wdSectionBreakNextPage:
+ case word::WdBreakType::wdSectionBreakOddPage:
+ case word::WdBreakType::wdTextWrappingBreak:
+ DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() );
+ break;
+ default:
+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() );
+ }
+
+ if( eBreakType != style::BreakType_NONE )
+ {
+ if( !mxTextCursor->isCollapsed() )
+ {
+ mxTextCursor->setString( rtl::OUString() );
+ mxTextCursor->collapseToStart();
+ }
+
+ uno::Reference< beans::XPropertySet > xProp( mxTextCursor, uno::UNO_QUERY_THROW );
+ xProp->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ), uno::makeAny( eBreakType ) );
+ }
+}
+
+void SAL_CALL
+SwVbaRange::Select() throw ( uno::RuntimeException )
+{
+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
+ uno::Reference< text::XTextViewCursor > xTextViewCursor = word::getXTextViewCursor( xModel );
+ xTextViewCursor->gotoRange( mxTextCursor->getStart(), sal_False );
+ xTextViewCursor->gotoRange( mxTextCursor->getEnd(), sal_True );
+}
+
+void SAL_CALL
+SwVbaRange::InsertParagraph() throw ( uno::RuntimeException )
+{
+ mxTextCursor->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) );
+ InsertParagraphBefore();
+}
+
+void SAL_CALL
+SwVbaRange::InsertParagraphBefore() throw ( uno::RuntimeException )
+{
+ uno::Reference< text::XTextRange > xTextRange = mxTextCursor->getStart();
+ mxText->insertControlCharacter( xTextRange, text::ControlCharacter::PARAGRAPH_BREAK, sal_True );
+ mxTextCursor->gotoRange( xTextRange, sal_True );
+}
+
+void SAL_CALL
+SwVbaRange::InsertParagraphAfter() throw ( uno::RuntimeException )
+{
+ uno::Reference< text::XTextRange > xTextRange = mxTextCursor->getEnd();
+ mxText->insertControlCharacter( xTextRange, text::ControlCharacter::PARAGRAPH_BREAK, sal_True );
+}
+
+uno::Reference< word::XParagraphFormat > SAL_CALL
+SwVbaRange::getParagraphFormat() throw ( uno::RuntimeException )
+{
+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
+ return uno::Reference< word::XParagraphFormat >( new SwVbaParagraphFormat( this, mxContext, mxTextDocument, xParaProps ) );
+}
+
+void SAL_CALL
+SwVbaRange::setParagraphFormat( const uno::Reference< word::XParagraphFormat >& /*rParagraphFormat*/ ) throw ( uno::RuntimeException )
+{
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+}
+
+uno::Reference< word::XStyle > SAL_CALL
+SwVbaRange::getStyle() throw ( uno::RuntimeException )
+{
+ rtl::OUString aStyleName;
+ rtl::OUString aStyleType;
+ uno::Reference< beans::XPropertySet > xProp( mxTextCursor, uno::UNO_QUERY_THROW );
+ if( ( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharStyleName") ) ) >>= aStyleName ) && aStyleName.getLength() )
+ {
+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") );
+ }
+ else if( ( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ) ) >>= aStyleName ) && aStyleName.getLength() )
+ {
+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") );
+ }
+ if( aStyleType.getLength() == 0 )
+ {
+ DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
+ }
+ uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxTextDocument, uno::UNO_QUERY_THROW);
+ uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW );
+ return uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) );
+}
+
+void SAL_CALL
+SwVbaRange::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
+{
+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
+ SwVbaStyle::setStyle( xParaProps, rStyle );
+}
+
+uno::Reference< word::XFont > SAL_CALL
+SwVbaRange::getFont() throw ( uno::RuntimeException )
+{
+ VbaPalette aColors;
+ return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), uno::Reference< beans::XPropertySet >( getXTextRange(), uno::UNO_QUERY_THROW ) );
+}
+
+::sal_Int32 SAL_CALL SwVbaRange::getLanguageID() throw (uno::RuntimeException)
+{
+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
+ return SwVbaStyle::getLanguageID( xParaProps );
+}
+
+void SAL_CALL SwVbaRange::setLanguageID( ::sal_Int32 _languageid ) throw (uno::RuntimeException)
+{
+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
+ SwVbaStyle::setLanguageID( xParaProps, _languageid );
+}
+
+uno::Any SAL_CALL
+SwVbaRange::PageSetup( ) throw (uno::RuntimeException)
+{
+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
+ rtl::OUString aPageStyleName;
+ xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
+ uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW );
+ uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XNameAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xPageProps( xPageStyles->getByName( aPageStyleName ), uno::UNO_QUERY_THROW );
+ return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, xModel, xPageProps ) ) );
+}
+
+::sal_Int32 SAL_CALL SwVbaRange::getStart() throw (uno::RuntimeException)
+{
+ uno::Reference< text::XText > xText = mxTextDocument->getText();
+ return SwVbaRangeHelper::getPosition( xText, mxTextCursor->getStart() );
+}
+
+void SAL_CALL SwVbaRange::setStart( ::sal_Int32 _start ) throw (uno::RuntimeException)
+{
+ uno::Reference< text::XText > xText = mxTextDocument->getText();
+ uno::Reference< text::XTextRange > xStart = SwVbaRangeHelper::getRangeByPosition( xText, _start );
+ uno::Reference< text::XTextRange > xEnd = mxTextCursor->getEnd();
+
+ mxTextCursor->gotoRange( xStart, sal_False );
+ mxTextCursor->gotoRange( xEnd, sal_True );
+}
+
+::sal_Int32 SAL_CALL SwVbaRange::getEnd() throw (uno::RuntimeException)
+{
+ uno::Reference< text::XText > xText = mxTextDocument->getText();
+ return SwVbaRangeHelper::getPosition( xText, mxTextCursor->getEnd() );
+}
+
+void SAL_CALL SwVbaRange::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeException)
+{
+ uno::Reference< text::XText > xText = mxTextDocument->getText();
+ uno::Reference< text::XTextRange > xEnd = SwVbaRangeHelper::getRangeByPosition( xText, _end );
+
+ mxTextCursor->collapseToStart();
+ mxTextCursor->gotoRange( xEnd, sal_True );
+}
+
+rtl::OUString&
+SwVbaRange::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaRange") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaRange::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Range" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbarange.hxx b/sw/source/ui/vba/vbarange.hxx
new file mode 100644
index 000000000000..1f1b3a3bbc8b
--- /dev/null
+++ b/sw/source/ui/vba/vbarange.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_RANGE_HXX
+#define SW_VBA_RANGE_HXX
+
+#include <ooo/vba/word/XRange.hpp>
+#include <ooo/vba/word/XParagraphFormat.hpp>
+#include <ooo/vba/word/XFont.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <ooo/vba/word/XStyle.hpp>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaRange_BASE;
+
+class SwVbaRange : public SwVbaRange_BASE
+{
+private:
+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
+ css::uno::Reference< css::text::XTextCursor > mxTextCursor;
+ css::uno::Reference< css::text::XText > mxText;
+ sal_Bool mbMaySpanEndOfDocument;
+
+private:
+ void initialize( const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd ) throw (css::uno::RuntimeException);
+public:
+ SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException);
+ SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException);
+ SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, const css::uno::Reference< css::text::XText >& rText, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException);
+ virtual ~SwVbaRange();
+ css::uno::Reference< css::text::XTextDocument > getDocument() { return mxTextDocument; }
+
+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getXTextRange() throw (css::uno::RuntimeException);
+#ifdef TOMORROW
+ void setXTextRange( const css::uno::Reference< css::text::XTextRange >& xRange ) throw (css::uno::RuntimeException);
+#endif
+ css::uno::Reference< css::text::XText > getXText() { return mxText; }
+ void setXTextCursor( const css::uno::Reference< css::text::XTextCursor >& xTextCursor ) { mxTextCursor = xTextCursor; }
+
+ // Attribute
+ virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
+ // Methods
+ virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Select() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL InsertParagraph() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL InsertParagraphBefore() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL InsertParagraphAfter() throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getLanguageID() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL PageSetup() throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getStart() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_RANGE_HXX */
diff --git a/sw/source/ui/vba/vbarangehelper.cxx b/sw/source/ui/vba/vbarangehelper.cxx
new file mode 100644
index 000000000000..4fd9e5f143f1
--- /dev/null
+++ b/sw/source/ui/vba/vbarangehelper.cxx
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbarangehelper.hxx"
+#include <com/sun/star/text/ControlCharacter.hpp>
+#include <com/sun/star/text/XTextRangeCompare.hpp>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+/**
+ * get a range in a xText by creating
+ * a cursor that iterates over the text. If the iterating cursor is
+ * equal to the desired position, the range equivalent is returned.
+ * Some special cases are tables that are inside of the text, because the
+ * position has to be adjusted.
+ * @param xText a text where a range position is searched
+ * @param position a position inside o the text
+ * @return a range for the postion; null is returned if no range can be
+ * constructed.
+ */
+uno::Reference< text::XTextRange > SwVbaRangeHelper::getRangeByPosition( const uno::Reference< text::XText >& rText, sal_Int32 _position ) throw ( uno::RuntimeException )
+{
+ uno::Reference< text::XTextRange > xRange;
+ if( rText.is() )
+ {
+ sal_Int32 nPos = 0;
+ uno::Reference< text::XTextCursor > xCursor = rText->createTextCursor();
+ xCursor->collapseToStart();
+ sal_Bool bCanGo = sal_True;
+ while( !xRange.is() && bCanGo )
+ {
+ if( _position == nPos )
+ {
+ xRange = xCursor->getStart();
+ }
+ else
+ {
+ bCanGo = xCursor->goRight( 1, sal_False );
+ nPos++;
+ }
+ }
+ }
+ return xRange;
+}
+
+
+void SwVbaRangeHelper::insertString( uno::Reference< text::XTextRange >& rTextRange, uno::Reference< text::XText >& rText, const rtl::OUString& rStr, sal_Bool _bAbsorb ) throw ( uno::RuntimeException )
+{
+ sal_Int32 nlastIndex = 0;
+ sal_Int32 nIndex = 0;
+ uno::Reference< text::XTextRange > xRange = rTextRange;
+
+ while(( nIndex = rStr.indexOf('\n', nlastIndex)) >= 0 )
+ {
+ xRange = xRange->getEnd();
+ if( nlastIndex < ( nIndex - 1 ) )
+ {
+ rText->insertString( xRange, rStr.copy( nlastIndex, ( nIndex - 1 - nlastIndex ) ), _bAbsorb );
+ xRange = xRange->getEnd();
+ }
+
+ rText->insertControlCharacter( xRange, text::ControlCharacter::PARAGRAPH_BREAK, _bAbsorb );
+ nlastIndex = nIndex + 1;
+ }
+
+ if( nlastIndex < rStr.getLength() )
+ {
+ xRange = xRange->getEnd();
+
+ rtl::OUString aWatt = rStr.copy( nlastIndex );
+ rText->insertString( xRange, aWatt, _bAbsorb );
+ }
+}
+
+uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Reference< text::XTextRange >& rTextRange, const uno::Reference< text::XText >& rText ) throw ( uno::RuntimeException )
+{
+ uno::Reference< text::XTextCursor > xTextCursor;
+ sal_Bool bGotTextCursor = sal_False;
+
+ try
+ {
+ xTextCursor = rText->createTextCursorByRange( rTextRange );
+ bGotTextCursor = sal_True;
+ }
+ catch (uno::Exception& e)
+ {
+ DebugHelper::exception(e);
+ }
+
+ if( !bGotTextCursor )
+ {
+ try
+ {
+ uno::Reference< text::XText > xText = rTextRange->getText();
+ xTextCursor = xText->createTextCursor();
+ bGotTextCursor = sal_True;
+ }
+ catch( uno::Exception& e )
+ {
+ DebugHelper::exception(e);
+ }
+ }
+
+ if( !bGotTextCursor )
+ {
+ try
+ {
+ xTextCursor = rText->createTextCursor();
+ bGotTextCursor = sal_True;
+ }
+ catch( uno::Exception& e )
+ {
+ DebugHelper::exception(e);
+ }
+ }
+ return xTextCursor;
+}
+
+sal_Int32 SwVbaRangeHelper::getPosition( const uno::Reference< text::XText >& rText, const uno::Reference< text::XTextRange >& rTextRange ) throw ( uno::RuntimeException )
+{
+ sal_Int32 nPosition = -1;
+ if( rText.is() && rTextRange.is() )
+ {
+ nPosition = 0;
+ uno::Reference< text::XTextCursor > xCursor = rText->createTextCursor();
+ xCursor->collapseToStart();
+ uno::Reference< text::XTextRangeCompare > xCompare( rText, uno::UNO_QUERY_THROW );
+ // compareValue is 0 if the ranges are equal
+ sal_Int32 nCompareValue = xCompare->compareRegionStarts( xCursor->getStart(), rTextRange );
+ sal_Bool canGo = sal_True;
+
+ while( nCompareValue !=0 && canGo )
+ {
+ canGo = xCursor->goRight( 1, sal_False );
+ nCompareValue = xCompare->compareRegionStarts( xCursor->getStart(), rTextRange );
+ nPosition++;
+ }
+
+ // check fails: no correct position found
+ if( !canGo && nCompareValue != 0 )
+ {
+ nPosition = -1;
+ }
+ }
+
+ return nPosition;
+}
diff --git a/sw/source/ui/vba/vbarangehelper.hxx b/sw/source/ui/vba/vbarangehelper.hxx
new file mode 100644
index 000000000000..71bdf20f94a2
--- /dev/null
+++ b/sw/source/ui/vba/vbarangehelper.hxx
@@ -0,0 +1,43 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_RANGEHELPER_HXX
+#define SW_VBA_RANGEHELPER_HXX
+
+#include <vbahelper/vbahelperinterface.hxx>
+#include <com/sun/star/text/XTextViewCursor.hpp>
+#include <com/sun/star/text/XText.hpp>
+
+class SwVbaRangeHelper
+{
+public:
+ static css::uno::Reference< css::text::XTextRange > getRangeByPosition( const css::uno::Reference< css::text::XText >& rText, sal_Int32 _position )throw ( css::uno::RuntimeException );
+ static void insertString( css::uno::Reference< css::text::XTextRange >& rTextRange, css::uno::Reference< css::text::XText >& rText, const rtl::OUString& rStr, sal_Bool _bAbsorb ) throw ( css::uno::RuntimeException );
+ static css::uno::Reference< css::text::XTextCursor > initCursor( const css::uno::Reference< css::text::XTextRange >& rTextRange, const css::uno::Reference< css::text::XText >& rText ) throw ( css::uno::RuntimeException );
+ static sal_Int32 getPosition( const css::uno::Reference< css::text::XText >& rText, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw ( css::uno::RuntimeException );
+
+};
+#endif /* SW_VBA_RANGEHELPER_HXX */
diff --git a/sw/source/ui/vba/vbareplacement.cxx b/sw/source/ui/vba/vbareplacement.cxx
new file mode 100644
index 000000000000..81f2bb193412
--- /dev/null
+++ b/sw/source/ui/vba/vbareplacement.cxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbareplacement.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <tools/diagnose_ex.h>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaReplacement::SwVbaReplacement( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< util::XPropertyReplace >& xPropertyReplace ) throw ( uno::RuntimeException ) :
+ SwVbaReplacement_BASE( rParent, rContext ), mxPropertyReplace( xPropertyReplace )
+{
+}
+
+SwVbaReplacement::~SwVbaReplacement()
+{
+}
+
+::rtl::OUString SAL_CALL SwVbaReplacement::getText() throw (uno::RuntimeException)
+{
+ return mxPropertyReplace->getReplaceString();
+}
+
+void SAL_CALL SwVbaReplacement::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
+{
+ mxPropertyReplace->setReplaceString( _text );
+}
+
+rtl::OUString&
+SwVbaReplacement::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaReplacement") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaReplacement::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Replacement" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbareplacement.hxx b/sw/source/ui/vba/vbareplacement.hxx
new file mode 100644
index 000000000000..b257fb7a3abc
--- /dev/null
+++ b/sw/source/ui/vba/vbareplacement.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_REPLACEMENT_HXX
+#define SW_VBA_REPLACEMENT_HXX
+
+#include <ooo/vba/word/XReplacement.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/util/XPropertyReplace.hpp>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XReplacement > SwVbaReplacement_BASE;
+
+class SwVbaReplacement : public SwVbaReplacement_BASE
+{
+private:
+ css::uno::Reference< css::util::XPropertyReplace> mxPropertyReplace;
+
+public:
+ SwVbaReplacement( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::util::XPropertyReplace >& xPropertyReplace ) throw ( css::uno::RuntimeException );
+ virtual ~SwVbaReplacement();
+
+ // Attributes
+ virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_REPLACEMENT_HXX */
diff --git a/sw/source/ui/vba/vbasection.cxx b/sw/source/ui/vba/vbasection.cxx
new file mode 100644
index 000000000000..2e685fbb1676
--- /dev/null
+++ b/sw/source/ui/vba/vbasection.cxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbasection.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <tools/diagnose_ex.h>
+#include "vbapagesetup.hxx"
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaSection::SwVbaSection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xProps ) throw ( uno::RuntimeException ) :
+ SwVbaSection_BASE( rParent, rContext ), mxModel( xModel ), mxPageProps( xProps )
+{
+}
+
+SwVbaSection::~SwVbaSection()
+{
+}
+
+::sal_Bool SAL_CALL SwVbaSection::getProtectedForForms() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL SwVbaSection::setProtectedForForms( ::sal_Bool /*_protectedforforms*/ ) throw (uno::RuntimeException)
+{
+}
+
+uno::Any SAL_CALL SwVbaSection::Headers( ) throw (uno::RuntimeException)
+{
+ return uno::Any();
+}
+
+uno::Any SAL_CALL SwVbaSection::Footers( ) throw (uno::RuntimeException)
+{
+ return uno::Any();
+}
+
+uno::Any SAL_CALL
+SwVbaSection::PageSetup( ) throw (uno::RuntimeException)
+{
+ return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, mxModel, mxPageProps ) ) );
+}
+
+rtl::OUString&
+SwVbaSection::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSection") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaSection::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Section" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbasection.hxx b/sw/source/ui/vba/vbasection.hxx
new file mode 100644
index 000000000000..90a2972c2f52
--- /dev/null
+++ b/sw/source/ui/vba/vbasection.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_SECTION_HXX
+#define SW_VBA_SECTION_HXX
+
+#include <ooo/vba/word/XSection.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSection > SwVbaSection_BASE;
+
+class SwVbaSection : public SwVbaSection_BASE
+{
+private:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::beans::XPropertySet > mxPageProps;
+
+public:
+ SwVbaSection( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps ) throw ( css::uno::RuntimeException );
+ virtual ~SwVbaSection();
+
+ // Attributes
+ virtual ::sal_Bool SAL_CALL getProtectedForForms() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setProtectedForForms( ::sal_Bool _protectedforforms ) throw (css::uno::RuntimeException);
+
+ // Methods
+ virtual css::uno::Any SAL_CALL Headers( ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Footers( ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL PageSetup( ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_SECTION_HXX */
diff --git a/sw/source/ui/vba/vbasections.cxx b/sw/source/ui/vba/vbasections.cxx
new file mode 100644
index 000000000000..c0f887f0f249
--- /dev/null
+++ b/sw/source/ui/vba/vbasections.cxx
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbasections.hxx"
+#include "vbasection.hxx"
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <docsh.hxx>
+#include <doc.hxx>
+#include "wordvbahelper.hxx"
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+typedef ::cppu::WeakImplHelper1< container::XEnumeration > SectionEnumeration_BASE;
+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > SectionCollectionHelper_Base;
+typedef std::vector< uno::Reference< beans::XPropertySet > > XSectionVec;
+
+class SectionEnumeration : public SectionEnumeration_BASE
+{
+ XSectionVec mxSections;
+ XSectionVec::iterator mIt;
+
+public:
+ SectionEnumeration( const XSectionVec& rVec ) : mxSections( rVec ), mIt( mxSections.begin() ) {}
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
+ {
+ return ( mIt != mxSections.end() );
+ }
+
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ if ( hasMoreElements() )
+ return uno::makeAny( *mIt++ );
+ throw container::NoSuchElementException();
+ }
+};
+
+// here I regard pagestyle as section
+class SectionCollectionHelper : public SectionCollectionHelper_Base
+{
+private:
+ uno::Reference< XHelperInterface > mxParent;
+ uno::Reference< uno::XComponentContext > mxContext;
+ uno::Reference< frame::XModel > mxModel;
+ XSectionVec mxSections;
+
+public:
+ SectionCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel )
+ {
+ uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( mxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XIndexAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW );
+ sal_Int32 nCount = xPageStyles->getCount();
+ for( sal_Int32 index = 0; index < nCount; ++index )
+ {
+ uno::Reference< style::XStyle > xStyle( xPageStyles->getByIndex( index ), uno::UNO_QUERY_THROW );
+ // only the pagestyles in using are considered
+ if( xStyle->isInUse( ) )
+ {
+ uno::Reference< beans::XPropertySet > xPageProps( xStyle, uno::UNO_QUERY_THROW );
+ mxSections.push_back( xPageProps );
+ }
+ }
+ }
+
+ ~SectionCollectionHelper(){}
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
+ {
+ return mxSections.size();
+ }
+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ if ( Index < 0 || Index >= getCount() )
+ throw css::lang::IndexOutOfBoundsException();
+
+ uno::Reference< beans::XPropertySet > xPageProps( mxSections[ Index ], uno::UNO_QUERY_THROW );
+ return uno::makeAny( uno::Reference< word::XSection >( new SwVbaSection( mxParent, mxContext, mxModel, xPageProps ) ) );
+ }
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException)
+ {
+ return word::XSection::static_type(0);
+ }
+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException)
+ {
+ return sal_True;
+ }
+ // XEnumerationAccess
+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
+ {
+ return new SectionEnumeration( mxSections );
+ }
+};
+
+class SectionsEnumWrapper : public EnumerationHelperImpl
+{
+ uno::Reference< frame::XModel > mxModel;
+public:
+ SectionsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ), mxModel( xModel ){}
+
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ uno::Reference< beans::XPropertySet > xPageProps( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW );
+ return uno::makeAny( uno::Reference< word::XSection > ( new SwVbaSection( m_xParent, m_xContext, mxModel, xPageProps ) ) );
+ }
+};
+
+SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaSections_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new SectionCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel )
+{
+}
+
+uno::Any SAL_CALL
+SwVbaSections::PageSetup( ) throw (uno::RuntimeException)
+{
+ if( m_xIndexAccess->getCount() )
+ {
+ // check if the first section is our want
+ uno::Reference< word::XSection > xSection( m_xIndexAccess->getByIndex( 0 ), uno::UNO_QUERY_THROW );
+ return xSection->PageSetup();
+ }
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("There is no section") ), uno::Reference< uno::XInterface >() );
+}
+
+// XEnumerationAccess
+uno::Type SAL_CALL
+SwVbaSections::getElementType() throw (uno::RuntimeException)
+{
+ return word::XSection::static_type(0);
+}
+
+uno::Reference< container::XEnumeration > SAL_CALL
+SwVbaSections::createEnumeration() throw (uno::RuntimeException)
+{
+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
+ return new SectionsEnumWrapper( this, mxContext, xEnumAccess->createEnumeration(), mxModel );
+}
+
+uno::Any
+SwVbaSections::createCollectionObject( const css::uno::Any& aSource )
+{
+ return aSource;
+}
+
+rtl::OUString&
+SwVbaSections::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSections") );
+ return sImplName;
+}
+
+css::uno::Sequence<rtl::OUString>
+SwVbaSections::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > sNames;
+ if ( sNames.getLength() == 0 )
+ {
+ sNames.realloc( 1 );
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Sections") );
+ }
+ return sNames;
+}
diff --git a/sw/source/ui/vba/vbasections.hxx b/sw/source/ui/vba/vbasections.hxx
new file mode 100644
index 000000000000..3204689af5d8
--- /dev/null
+++ b/sw/source/ui/vba/vbasections.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_SECTIONS_HXX
+#define SW_VBA_SECTIONS_HXX
+
+#include <vbahelper/vbacollectionimpl.hxx>
+#include <ooo/vba/word/XSections.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+
+typedef CollTestImplHelper< ooo::vba::word::XSections > SwVbaSections_BASE;
+
+class SwVbaSections : public SwVbaSections_BASE
+{
+private:
+ css::uno::Reference< css::frame::XModel > mxModel;
+
+public:
+ SwVbaSections( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel );
+ virtual ~SwVbaSections() {}
+
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+
+ virtual css::uno::Any SAL_CALL PageSetup( ) throw (css::uno::RuntimeException);
+
+ // SwVbaSections_BASE
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif /* SW_VBA_SECTIONS_HXX */
diff --git a/sw/source/ui/vba/vbaselection.cxx b/sw/source/ui/vba/vbaselection.cxx
new file mode 100644
index 000000000000..620e44fa413b
--- /dev/null
+++ b/sw/source/ui/vba/vbaselection.cxx
@@ -0,0 +1,679 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbaselection.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <tools/diagnose_ex.h>
+#include "vbarange.hxx"
+#include "vbafind.hxx"
+#include "wordvbahelper.hxx"
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XTextTableCursor.hpp>
+#include <com/sun/star/text/ControlCharacter.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <ooo/vba/word/WdUnits.hpp>
+#include <ooo/vba/word/WdMovementType.hpp>
+#include <ooo/vba/word/WdGoToItem.hpp>
+#include <ooo/vba/word/WdGoToDirection.hpp>
+#include <ooo/vba/word/XBookmark.hpp>
+#include <ooo/vba/word/XApplication.hpp>
+#include <com/sun/star/text/XPageCursor.hpp>
+#include "unotbl.hxx"
+#include "unocoll.hxx"
+#include "vbatable.hxx"
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/view/XViewCursor.hpp>
+#include <ooo/vba/word/WdInformation.hpp>
+#include <ooo/vba/word/WdHeaderFooterIndex.hpp>
+#include "vbainformationhelper.hxx"
+#include "vbafield.hxx"
+#include "vbaheaderfooter.hxx"
+#include "vbaheaderfooterhelper.hxx"
+#include <vbahelper/vbashaperange.hxx>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaSelection::SwVbaSelection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel ) throw ( uno::RuntimeException ) : SwVbaSelection_BASE( rParent, rContext ), mxModel( rModel )
+{
+ mxTextViewCursor = word::getXTextViewCursor( mxModel );
+}
+
+SwVbaSelection::~SwVbaSelection()
+{
+}
+
+uno::Reference< text::XTextRange > SwVbaSelection::GetSelectedRange() throw ( uno::RuntimeException )
+{
+ uno::Reference< text::XTextRange > xTextRange;
+ uno::Reference< lang::XServiceInfo > xServiceInfo( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW );
+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextRanges") ) ) )
+ {
+ uno::Reference< container::XIndexAccess > xTextRanges( xServiceInfo, uno::UNO_QUERY_THROW );
+ if( xTextRanges->getCount() > 0 )
+ {
+ // if there are multipul selection, just return the last selected Range.
+ xTextRange.set( xTextRanges->getByIndex( xTextRanges->getCount()-1 ), uno::UNO_QUERY_THROW );
+ }
+ }
+ else
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+ }
+ return xTextRange;
+}
+
+uno::Reference< word::XRange > SAL_CALL
+SwVbaSelection::getRange() throw ( uno::RuntimeException )
+{
+ uno::Reference< text::XTextRange > xTextRange = GetSelectedRange();
+ uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
+ return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, xDocument, xTextRange->getStart(), xTextRange->getEnd(), mxTextViewCursor->getText() ) );
+}
+
+rtl::OUString SAL_CALL
+SwVbaSelection::getText() throw ( uno::RuntimeException )
+{
+ return getRange()->getText();
+}
+
+void SAL_CALL
+SwVbaSelection::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
+{
+ getRange()->setText( rText );
+}
+
+void SAL_CALL
+SwVbaSelection::TypeText( const rtl::OUString& rText ) throw ( uno::RuntimeException )
+{
+ // FIXME: handle the property Options.ReplaceSelection, the default value is TRUE
+ setText( rText );
+}
+
+void SAL_CALL
+SwVbaSelection::HomeKey( const uno::Any& _unit, const uno::Any& _extend ) throw ( uno::RuntimeException )
+{
+ sal_Int32 nUnit = word::WdUnits::wdLine;
+ sal_Int32 nExtend = word::WdMovementType::wdMove;
+ _unit >>= nUnit;
+ _extend >>= nExtend;
+
+ switch( nUnit )
+ {
+ case word::WdUnits::wdStory:
+ {
+ // go to the begin of the document
+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfDoc"));
+ dispatchRequests( mxModel,url );
+ // If something is selected, it needs to go twice
+ dispatchRequests( mxModel,url );
+ break;
+ }
+ case word::WdUnits::wdLine:
+ {
+ // go to the begin of the Line
+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfLine"));
+ dispatchRequests( mxModel,url );
+ break;
+ }
+ default:
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+ break;
+ }
+ }
+}
+
+void SAL_CALL
+SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw ( uno::RuntimeException )
+{
+ sal_Int32 nUnit = word::WdUnits::wdLine;
+ sal_Int32 nExtend = word::WdMovementType::wdMove;
+ _unit >>= nUnit;
+ _extend >>= nExtend;
+
+ switch( nUnit )
+ {
+ case word::WdUnits::wdStory:
+ {
+ // go to the end of the document
+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfDoc"));
+ dispatchRequests( mxModel,url );
+ // If something is selected, it needs to go twice
+ dispatchRequests( mxModel,url );
+ break;
+ }
+ case word::WdUnits::wdLine:
+ {
+ // go to the end of the Line
+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfLine"));
+ dispatchRequests( mxModel,url );
+ break;
+ }
+ default:
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+ break;
+ }
+ }
+}
+
+void SAL_CALL
+SwVbaSelection::Delete( const uno::Any& /*_unit*/, const uno::Any& /*_count*/ ) throw ( uno::RuntimeException )
+{
+ // FIXME: handle the arguments: _unit and _count
+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Delete"));
+ dispatchRequests( mxModel,url );
+}
+
+void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( uno::RuntimeException )
+{
+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW );
+ uno::Reference< text::XTextTable > xTextTable;
+ uno::Reference< table::XCell > xCell;
+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable;
+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cell") ) ) >>= xCell;
+ if( !xTextTable.is() || !xCell.is() )
+ {
+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
+ return;
+ }
+ uno::Reference< beans::XPropertySet > xCellProps( xCell, uno::UNO_QUERY_THROW );
+ rtl::OUString aCellName;
+ xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellName") ) ) >>= aCellName;
+ uno::Reference< text::XTextTableCursor > xTextTableCursor = xTextTable->createCursorByCellName( aCellName );
+ // move the table cursor
+ switch( eDirection )
+ {
+ case MOVE_LEFT:
+ {
+ xTextTableCursor->goLeft( nCount, sal_False );
+ break;
+ }
+ case MOVE_RIGHT:
+ {
+ xTextTableCursor->goRight( nCount, sal_False );
+ break;
+ }
+ case MOVE_UP:
+ {
+ xTextTableCursor->goUp( nCount, sal_False );
+ break;
+ }
+ case MOVE_DOWN:
+ {
+ xTextTableCursor->goDown( nCount, sal_False );
+ break;
+ }
+ default:
+ {
+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
+ return;
+ }
+ }
+ // move the view cursor
+ xCell = xTextTable->getCellByName( xTextTableCursor->getRangeName() );
+ mxTextViewCursor->gotoRange( uno::Reference< text::XTextRange >( xCell, uno::UNO_QUERY_THROW ), sal_False );
+}
+
+void SAL_CALL
+SwVbaSelection::MoveRight( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
+{
+ sal_Int32 nUnit = word::WdUnits::wdCharacter;
+ sal_Int32 nCount = 1;
+ sal_Int32 nExtend = word::WdMovementType::wdMove;
+
+ if( _unit.hasValue() )
+ _unit >>= nUnit;
+ if( _count.hasValue() )
+ _count >>= nCount;
+ if( _extend.hasValue() )
+ _extend >>= nExtend;
+
+ if( nCount == 0 )
+ return;
+
+ if( nCount < 0 )
+ {
+ // TODO: call MoveLeft;
+ MoveLeft( _unit, uno::makeAny( -nCount ), _extend );
+ return;
+ }
+
+ switch( nUnit )
+ {
+ case word::WdUnits::wdCell:
+ {
+ if( nExtend == word::WdMovementType::wdExtend )
+ {
+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
+ return;
+ }
+ NextCell( nCount, MOVE_RIGHT );
+ break;
+ }
+ default:
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+ break;
+ }
+ }
+
+}
+
+void SAL_CALL
+SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
+{
+ sal_Int32 nUnit = word::WdUnits::wdCharacter;
+ sal_Int32 nCount = 1;
+ sal_Int32 nExtend = word::WdMovementType::wdMove;
+
+ if( _unit.hasValue() )
+ _unit >>= nUnit;
+ if( _count.hasValue() )
+ _count >>= nCount;
+ if( _extend.hasValue() )
+ _extend >>= nExtend;
+
+ if( nCount == 0 )
+ return;
+
+ if( nCount < 0 )
+ {
+ MoveRight( _unit, uno::makeAny( -nCount ), _extend );
+ return;
+ }
+
+ switch( nUnit )
+ {
+ case word::WdUnits::wdCell:
+ {
+ if( nExtend == word::WdMovementType::wdExtend )
+ {
+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
+ return;
+ }
+ NextCell( nCount, MOVE_LEFT );
+ break;
+ }
+ default:
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+ break;
+ }
+ }
+
+}
+
+void SAL_CALL
+SwVbaSelection::MoveDown( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException )
+{
+ sal_Int32 nUnit = word::WdUnits::wdCharacter;
+ sal_Int32 nCount = 1;
+ sal_Int32 nExtend = word::WdMovementType::wdMove;
+
+ if( _unit.hasValue() )
+ _unit >>= nUnit;
+ if( _count.hasValue() )
+ _count >>= nCount;
+ if( _extend.hasValue() )
+ _extend >>= nExtend;
+
+ if( nCount == 0 )
+ return;
+
+ if( nCount < 0 )
+ {
+ // TODO: call MoveLeft;
+ //MoveUp( _unit, uno::makeAny( -nCount ), _extend );
+ return;
+ }
+
+ switch( nUnit )
+ {
+ case word::WdUnits::wdLine:
+ {
+ uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
+ sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True;
+ xViewCursor->goDown( nCount, bExpand );
+ break;
+ }
+ default:
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+ break;
+ }
+ }
+
+}
+
+void SAL_CALL
+SwVbaSelection::TypeParagraph() throw ( uno::RuntimeException )
+{
+ // #FIXME: if the selection is an entire paragraph, it's replaced
+ // by the new paragraph
+ sal_Bool isCollapsed = mxTextViewCursor->isCollapsed();
+ InsertParagraph();
+ if( isCollapsed )
+ mxTextViewCursor->collapseToStart();
+}
+
+void SAL_CALL
+SwVbaSelection::InsertParagraph() throw ( uno::RuntimeException )
+{
+ // #FIME: the selection should include the new paragraph.
+ getRange()->InsertParagraph();
+}
+
+void SAL_CALL
+SwVbaSelection::InsertParagraphBefore() throw ( uno::RuntimeException )
+{
+ getRange()->InsertParagraphBefore();
+}
+
+void SAL_CALL
+SwVbaSelection::InsertParagraphAfter() throw ( uno::RuntimeException )
+{
+ getRange()->InsertParagraphAfter();
+}
+
+uno::Reference< word::XParagraphFormat > SAL_CALL
+SwVbaSelection::getParagraphFormat() throw ( uno::RuntimeException )
+{
+ return getRange()->getParagraphFormat();
+}
+
+void SAL_CALL
+SwVbaSelection::setParagraphFormat( const uno::Reference< word::XParagraphFormat >& rParagraphFormat ) throw ( uno::RuntimeException )
+{
+ return getRange()->setParagraphFormat( rParagraphFormat );
+}
+
+uno::Reference< word::XFind > SAL_CALL
+SwVbaSelection::getFind() throw ( uno::RuntimeException )
+{
+ uno::Reference< text::XTextRange > xTextRange = GetSelectedRange();
+ return uno::Reference< word::XFind >( new SwVbaFind( this, mxContext, mxModel, xTextRange ) );
+}
+
+uno::Reference< word::XStyle > SAL_CALL
+SwVbaSelection::getStyle() throw ( uno::RuntimeException )
+{
+ return getRange()->getStyle();
+}
+
+void SAL_CALL
+SwVbaSelection::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException )
+{
+ return getRange()->setStyle( rStyle );
+}
+
+uno::Reference< word::XFont > SAL_CALL
+SwVbaSelection::getFont() throw ( uno::RuntimeException )
+{
+ return getRange()->getFont();
+}
+
+void SAL_CALL
+SwVbaSelection::TypeBackspace() throw ( uno::RuntimeException )
+{
+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SwBackspace"));
+ dispatchRequests( mxModel,url );
+}
+
+uno::Reference< word::XRange > SAL_CALL SwVbaSelection::GoTo( const uno::Any& _what, const uno::Any& _which, const uno::Any& _count, const uno::Any& _name ) throw (uno::RuntimeException)
+{
+ sal_Int32 nWhat = 0;
+ if( ( _what >>= nWhat ) != sal_True )
+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
+ switch( nWhat )
+ {
+ case word::WdGoToItem::wdGoToBookmark:
+ {
+ rtl::OUString sName;
+ uno::Reference< word::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW );
+ uno::Reference< word::XBookmark > xBookmark( xApplication->getActiveDocument()->Bookmarks(_name), uno::UNO_QUERY_THROW );
+ xBookmark->Select();
+ //return uno::Reference< word::XRange >( xBookmark->Range(), uno::UNO_QUERY_THROW );
+ break;
+ }
+ case word::WdGoToItem::wdGoToPage:
+ {
+ uno::Reference< text::XPageCursor > xPageCursor( mxTextViewCursor, uno::UNO_QUERY_THROW );
+ sal_Int32 nCurrPage = xPageCursor->getPage();
+ sal_Int32 nLastPage = word::getPageCount( mxModel );
+ sal_Int32 nCount = 0;
+ if( _count.hasValue() )
+ _count >>= nCount;
+ sal_Int32 nWhich = 0;
+ if( _which.hasValue() )
+ _which >>= nWhich;
+ sal_Int32 nPage = 0;
+ switch( nWhich )
+ {
+ case word::WdGoToDirection::wdGoToLast:
+ {
+ nPage = nLastPage;
+ break;
+ }
+ case word::WdGoToDirection::wdGoToNext:
+ {
+ nPage = nCurrPage + 1;
+ break;
+ }
+ case word::WdGoToDirection::wdGoToPrevious:
+ {
+ nPage = nCurrPage - 1;
+ break;
+ }
+ default:
+ {
+ nPage = nCount;
+ }
+ }
+ if( nPage <= 0 )
+ nPage = 1;
+ if( nPage > nLastPage )
+ nPage = nLastPage;
+ xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) );
+ break;
+ }
+ case word::WdGoToItem::wdGoToSection:
+ {
+ // TODO: implement Section object
+ }
+ default:
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+ }
+ return getRange();
+}
+
+::sal_Int32 SAL_CALL SwVbaSelection::getLanguageID() throw (uno::RuntimeException)
+{
+ return getRange()->getLanguageID();
+}
+
+void SAL_CALL SwVbaSelection::setLanguageID( ::sal_Int32 _languageid ) throw (uno::RuntimeException)
+{
+ getRange()->setLanguageID( _languageid );
+}
+
+uno::Any SAL_CALL SwVbaSelection::Information( sal_Int32 _type ) throw (uno::RuntimeException)
+{
+ uno::Any result;
+ //uno::Reference< view::XSelectionSupplier > xSel( mxModel->getCurrentController(), uno::UNO_QUERY_THROW );
+ //uno::Any aSelectedObject = xSel->getSelection();
+ switch( _type )
+ {
+ case word::WdInformation::wdActiveEndPageNumber:
+ {
+ result = uno::makeAny( SwVbaInformationHelper::handleWdActiveEndPageNumber( mxTextViewCursor ) );
+ break;
+ }
+ case word::WdInformation::wdNumberOfPagesInDocument:
+ {
+ result = uno::makeAny( SwVbaInformationHelper::handleWdNumberOfPagesInDocument( mxModel ) );
+ break;
+ }
+ case word::WdInformation::wdVerticalPositionRelativeToPage:
+ {
+ result = uno::makeAny( SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( mxModel, mxTextViewCursor ) );
+ break;
+ }
+ default:
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+ }
+ // This method fails to restore the previouse selection
+ //xSel->select( aSelectedObject );
+ return result;
+}
+
+void SAL_CALL SwVbaSelection::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException)
+{
+ getRange()->InsertBreak( _breakType );
+}
+
+uno::Any SAL_CALL
+SwVbaSelection::Tables( const uno::Any& aIndex ) throw (uno::RuntimeException)
+{
+ // Hacky implementation due to missing api ( and lack of knowledge )
+ // we can only support a selection that is a single table
+ if ( !aIndex.hasValue() ) // currently we can't support multiple tables in a selection
+ throw uno::RuntimeException();
+ // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw
+ uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY );
+
+ if ( !xTextTableCursor.is() )
+ throw uno::RuntimeException();
+
+ sal_Int32 nIndex = 0;
+ aIndex >>= nIndex;
+
+ uno::Any aRet;
+
+ if ( nIndex != 1 )
+ throw uno::RuntimeException();
+ SwXTextTableCursor* pTTCursor = dynamic_cast< SwXTextTableCursor* >( xTextTableCursor.get() );
+ if ( pTTCursor )
+ {
+ SwFrmFmt* pFmt = pTTCursor->GetFrmFmt();
+ rtl::OUString sTableName;
+ if ( pFmt )
+ {
+ uno::Reference< text::XTextTable > xTbl = SwXTextTables::GetObject(*pFmt);
+ uno::Reference< css::text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< word::XTable > xVBATbl = new SwVbaTable( mxParent, mxContext, xTextDoc, xTbl );
+ aRet <<= xVBATbl;
+ }
+ }
+ return aRet;
+
+}
+
+uno::Any SAL_CALL
+SwVbaSelection::Fields( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, mxModel ) );
+ if ( index.hasValue() )
+ return xCol->Item( index, uno::Any() );
+ return uno::makeAny( xCol );
+}
+
+uno::Reference< word::XHeaderFooter > SAL_CALL
+SwVbaSelection::getHeaderFooter() throw ( uno::RuntimeException )
+{
+ uno::Reference< text::XText > xCurrentText = word::getXTextViewCursor( mxModel )->getText();
+ if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFooter( mxModel, xCurrentText ) )
+ {
+ uno::Reference< beans::XPropertySet > xPageStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
+ sal_Int32 nIndex = word::WdHeaderFooterIndex::wdHeaderFooterPrimary;
+ sal_Bool isHeader = HeaderFooterHelper::isHeader( mxModel, xCurrentText );
+ if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
+ nIndex = word::WdHeaderFooterIndex::wdHeaderFooterEvenPages;
+ else if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
+ nIndex = word::WdHeaderFooterIndex::wdHeaderFooterFirstPage;
+
+ return uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this, mxContext, mxModel, xPageStyleProps, isHeader, nIndex ) );
+
+ }
+ return uno::Reference< word::XHeaderFooter >();
+}
+
+uno::Any SAL_CALL
+SwVbaSelection::ShapeRange( ) throw (uno::RuntimeException)
+{
+ uno::Reference< drawing::XShapes > xShapes( mxModel->getCurrentSelection(), uno::UNO_QUERY );
+
+ if ( !xShapes.is() )
+ throw uno::RuntimeException();
+
+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< drawing::XDrawPage > xDrawPage = xDrawPageSupplier->getDrawPage();
+ uno::Reference< container::XIndexAccess > xShapesAccess( xShapes, uno::UNO_QUERY_THROW );
+ return uno::makeAny( uno::Reference< msforms::XShapeRange >( new ScVbaShapeRange( this, mxContext, xShapesAccess, xDrawPage, mxModel ) ) );
+}
+
+::sal_Int32 SAL_CALL SwVbaSelection::getStart() throw (uno::RuntimeException)
+{
+ return getRange()->getStart();
+}
+
+void SAL_CALL SwVbaSelection::setStart( ::sal_Int32 _start ) throw (uno::RuntimeException)
+{
+ getRange()->setStart( _start );
+}
+::sal_Int32 SAL_CALL SwVbaSelection::getEnd() throw (uno::RuntimeException)
+{
+ return getRange()->getEnd();
+}
+
+void SAL_CALL SwVbaSelection::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeException)
+{
+ getRange()->setEnd( _end );
+}
+
+rtl::OUString&
+SwVbaSelection::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSelection") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaSelection::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Selection" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbaselection.hxx b/sw/source/ui/vba/vbaselection.hxx
new file mode 100644
index 000000000000..a5079340ee19
--- /dev/null
+++ b/sw/source/ui/vba/vbaselection.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_SELECTION_HXX
+#define SW_VBA_SELECTION_HXX
+
+#include <ooo/vba/word/XSelection.hpp>
+#include <ooo/vba/word/XRange.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <com/sun/star/text/XTextViewCursor.hpp>
+#include <ooo/vba/word/XParagraphFormat.hpp>
+#include <ooo/vba/word/XFind.hpp>
+#include <ooo/vba/word/XStyle.hpp>
+#include <ooo/vba/word/XFont.hpp>
+#include <ooo/vba/word/XHeaderFooter.hpp>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSelection > SwVbaSelection_BASE;
+
+class SwVbaSelection : public SwVbaSelection_BASE
+{
+private:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::text::XTextViewCursor > mxTextViewCursor;
+ css::uno::Reference< ooo::vba::word::XRange > mxRange;
+
+ enum E_DIRECTION
+ {
+ MOVE_LEFT = 1,
+ MOVE_RIGHT,
+ MOVE_UP,
+ MOVE_DOWN
+ };
+
+private:
+ void NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( css::uno::RuntimeException );
+ css::uno::Reference< css::text::XTextRange > GetSelectedRange() throw ( css::uno::RuntimeException );
+
+public:
+ SwVbaSelection( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException );
+ virtual ~SwVbaSelection();
+
+ // Attribute
+ virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getRange() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL HomeKey( const css::uno::Any& _unit, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL EndKey( const css::uno::Any& _unit, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL TypeText( const rtl::OUString& rText ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Delete( const css::uno::Any& _unit, const css::uno::Any& _count ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL MoveRight( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL MoveLeft( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL MoveDown( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL TypeParagraph() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL InsertParagraph() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL InsertParagraphBefore() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL InsertParagraphAfter() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XFind > SAL_CALL getFind() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL TypeBackspace() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL GoTo( const css::uno::Any& _what, const css::uno::Any& _which, const css::uno::Any& _count, const css::uno::Any& _name ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getLanguageID( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Information( sal_Int32 _type ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Tables( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Fields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XHeaderFooter > SAL_CALL getHeaderFooter() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL ShapeRange( ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getStart() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_SELECTION_HXX */
diff --git a/sw/source/ui/vba/vbastyle.cxx b/sw/source/ui/vba/vbastyle.cxx
new file mode 100644
index 000000000000..cf49da020284
--- /dev/null
+++ b/sw/source/ui/vba/vbastyle.cxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "vbastyle.hxx"
+#include <ooo/vba/word/WdStyleType.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <i18npool/mslangid.hxx>
+#include "vbafont.hxx"
+#include "vbapalette.hxx"
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+
+SwVbaStyle::SwVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet ) throw ( script::BasicErrorException, uno::RuntimeException ) : SwVbaStyle_BASE( xParent, xContext ) , mxStyleProps( _xPropertySet )
+{
+ mxStyle.set( _xPropertySet, uno::UNO_QUERY_THROW );
+}
+
+void SAL_CALL
+SwVbaStyle::setName( const ::rtl::OUString& Name ) throw (uno::RuntimeException)
+{
+ mxStyle->setName(Name);
+}
+
+::rtl::OUString SAL_CALL
+SwVbaStyle::getName() throw (uno::RuntimeException)
+{
+ return mxStyle->getName();
+}
+
+sal_Int32 SwVbaStyle::getLanguageID( const uno::Reference< beans::XPropertySet >& xTCProps ) throw (uno::RuntimeException)
+{
+ lang::Locale aLocale;
+ xTCProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharLocale") ) ) >>= aLocale;
+ return MsLangId::convertLocaleToLanguage( aLocale );
+}
+
+void SwVbaStyle::setLanguageID( const uno::Reference< beans::XPropertySet >& xTCProps, sal_Int32 _languageid ) throw (uno::RuntimeException)
+{
+ lang::Locale aLocale = MsLangId::convertLanguageToLocale( static_cast<LanguageType>(_languageid) );
+ xTCProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharLocale") ), uno::makeAny( aLocale ) ) ;
+}
+
+::sal_Int32 SAL_CALL SwVbaStyle::getLanguageID() throw (uno::RuntimeException)
+{
+ return getLanguageID( mxStyleProps );
+}
+
+void SAL_CALL SwVbaStyle::setLanguageID( ::sal_Int32 _languageid ) throw (uno::RuntimeException)
+{
+ setLanguageID( mxStyleProps, _languageid );
+}
+
+::sal_Int32 SAL_CALL SwVbaStyle::getType() throw (uno::RuntimeException)
+{
+ sal_Int32 nType = word::WdStyleType::wdStyleTypeParagraph;
+ uno::Reference< lang::XServiceInfo > xServiceInfo( mxStyle, uno::UNO_QUERY_THROW );
+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.ParagraphStyle") ) ) )
+ nType = word::WdStyleType::wdStyleTypeParagraph;
+ else if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.CharacterStyle") ) ) )
+ nType = word::WdStyleType::wdStyleTypeCharacter;
+ else // if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingStyle") ) ) )
+ nType = word::WdStyleType::wdStyleTypeList;
+ return nType;
+}
+
+uno::Reference< word::XFont > SAL_CALL
+SwVbaStyle::getFont() throw ( uno::RuntimeException )
+{
+ VbaPalette aColors;
+ return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), mxStyleProps );
+}
+
+void SwVbaStyle::setStyle( const uno::Reference< beans::XPropertySet >& xTCProps, const uno::Reference< ooo::vba::word::XStyle >& xStyle )throw (uno::RuntimeException)
+{
+ rtl::OUString aStyleType = getOOoStyleTypeFromMSWord( xStyle->getType() );
+ xTCProps->setPropertyValue( aStyleType, uno::makeAny( xStyle->getName() ) );
+}
+
+rtl::OUString SwVbaStyle::getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType )
+{
+ rtl::OUString aStyleType;
+ switch( _wdStyleType )
+ {
+ case word::WdStyleType::wdStyleTypeParagraph:
+ case word::WdStyleType::wdStyleTypeTable:
+ {
+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") );
+ break;
+ }
+ case word::WdStyleType::wdStyleTypeCharacter:
+ {
+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharStyleName") );
+ break;
+ }
+ case word::WdStyleType::wdStyleTypeList:
+ {
+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName") );
+ break;
+ }
+ default:
+ DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
+ }
+ return aStyleType;
+}
+
+rtl::OUString&
+SwVbaStyle::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaStyle") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaStyle::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.XStyle" ) );
+ }
+ return aServiceNames;
+}
diff --git a/sw/source/ui/vba/vbastyle.hxx b/sw/source/ui/vba/vbastyle.hxx
new file mode 100644
index 000000000000..401baa5337a1
--- /dev/null
+++ b/sw/source/ui/vba/vbastyle.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_STYLE_HXX
+#define SW_VBA_STYLE_HXX
+#include <ooo/vba/word/XStyle.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <ooo/vba/word/XFont.hpp>
+
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XStyle > SwVbaStyle_BASE;
+
+class SwVbaStyle : public SwVbaStyle_BASE
+{
+private:
+ css::uno::Reference< css::beans::XPropertySet > mxStyleProps;
+ css::uno::Reference< css::style::XStyle > mxStyle;
+public:
+ SwVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet ) throw ( css::script::BasicErrorException, css::uno::RuntimeException );
+ virtual ~SwVbaStyle(){}
+
+ static void setStyle( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, const css::uno::Reference< ooo::vba::word::XStyle >& xStyle ) throw (css::uno::RuntimeException);
+ static rtl::OUString getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType );
+ static sal_Int32 getLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps ) throw (css::uno::RuntimeException);
+ static void setLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, sal_Int32 _languageid ) throw (css::uno::RuntimeException);
+
+ // Attributes
+ virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setName( const rtl::OUString& Name ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getLanguageID( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif //SW_VBA_AXIS_HXX
diff --git a/sw/source/ui/vba/vbastyles.cxx b/sw/source/ui/vba/vbastyles.cxx
new file mode 100644
index 000000000000..371c1225cafa
--- /dev/null
+++ b/sw/source/ui/vba/vbastyles.cxx
@@ -0,0 +1,377 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbastyles.hxx"
+#include "vbastyle.hxx"
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <ooo/vba/word/WdBuiltinStyle.hpp>
+#include <ooo/vba/word/WdStyleType.hpp>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+struct BuiltinStyleTable
+{
+ sal_Int32 wdBuiltinStyle;
+ const sal_Char* pOOoStyleName;
+ sal_Int32 wdStyleType;
+};
+
+const BuiltinStyleTable aBuiltinStyleTable[] =
+{
+ { word::WdBuiltinStyle::wdStyleBlockQuotation, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleBodyText, "Text body", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleBodyText2, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleBodyText3, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleBodyTextFirstIndent, "First line indent", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleBodyTextFirstIndent2, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleBodyTextIndent, "Text body indent", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleBodyTextIndent2, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleBodyTextIndent3, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleCaption, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleClosing, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleCommentReference, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleCommentText, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleDate, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleDefaultParagraphFont, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleEmphasis, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleEndnoteReference, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleEndnoteText, "Endnote", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleEnvelopeAddress, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleEnvelopeReturn, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleFooter, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleFootnoteReference, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleFootnoteText, "Footnote", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHeader, "Header", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHeading1, "Heading 1", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHeading2, "Heading 2", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHeading3, "Heading 3", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHeading4, "Heading 4", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHeading5, "Heading 5", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHeading6, "Heading 6", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHeading7, "Heading 7", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHeading8, "Heading 8", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHeading9, "Heading 9", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHtmlAcronym, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHtmlAddress, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHtmlCite, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHtmlCode, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHtmlDfn, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHtmlKbd, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHtmlNormal, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHtmlPre, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHtmlSamp, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHtmlTt, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHtmlVar, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHyperlink, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleHyperlinkFollowed, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleIndex1, "Index 1", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleIndex2, "Index 2", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleIndex3, "Index 3", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleIndex4, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleIndex5, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleIndex6, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleIndex7, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleIndex8, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleIndex9, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleIndexHeading, "Index Heading", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleLineNumber, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleList, "List", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleList2, "List 2", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleList3, "List 3", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleList4, "List 4", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleList5, "List 5", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleListBullet, "List 1", word::WdStyleType::wdStyleTypeList },
+ { word::WdBuiltinStyle::wdStyleListBullet2, "List 2", word::WdStyleType::wdStyleTypeList },
+ { word::WdBuiltinStyle::wdStyleListBullet3, "List 3", word::WdStyleType::wdStyleTypeList },
+ { word::WdBuiltinStyle::wdStyleListBullet4, "List 4", word::WdStyleType::wdStyleTypeList },
+ { word::WdBuiltinStyle::wdStyleListBullet5, "List 5", word::WdStyleType::wdStyleTypeList },
+ { word::WdBuiltinStyle::wdStyleListContinue, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleListContinue2, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleListContinue3, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleListContinue4, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleListContinue5, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleListNumber, "Numbering 1", word::WdStyleType::wdStyleTypeList },
+ { word::WdBuiltinStyle::wdStyleListNumber2, "Numbering 2", word::WdStyleType::wdStyleTypeList },
+ { word::WdBuiltinStyle::wdStyleListNumber3, "Numbering 3", word::WdStyleType::wdStyleTypeList },
+ { word::WdBuiltinStyle::wdStyleListNumber4, "Numbering 4", word::WdStyleType::wdStyleTypeList },
+ { word::WdBuiltinStyle::wdStyleListNumber5, "Numbering 5", word::WdStyleType::wdStyleTypeList },
+ { word::WdBuiltinStyle::wdStyleMacroText, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleMessageHeader, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleNavPane, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleNormal, "Default", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleNormalIndent, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleNormalTable, "Table", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleNoteHeading, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStylePageNumber, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStylePlainText, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleSalutation, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleSignature, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleStrong, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleSubtitle, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleTableOfAuthorities, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleTableOfFigures, "", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleTitle, "Title", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleTOAHeading, "Contents Heading", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleTOC1, "Contents 1", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleTOC2, "Contents 2", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleTOC3, "Contents 3", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleTOC4, "Contents 4", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleTOC5, "Contents 5", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleTOC6, "Contents 6", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleTOC7, "Contents 7", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleTOC8, "Contents 8", word::WdStyleType::wdStyleTypeParagraph },
+ { word::WdBuiltinStyle::wdStyleTOC9, "Contents 9", word::WdStyleType::wdStyleTypeParagraph },
+ { 0, 0, 0 }
+};
+
+
+static uno::Sequence< rtl::OUString > getStyleTypes()
+{
+ uno::Sequence< rtl::OUString > aRet(3);
+ rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") );
+ pArray[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") );
+ pArray[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") );
+ return aRet;
+}
+
+typedef ::cppu::WeakImplHelper1< container::XEnumeration > StyleEnumeration_BASE;
+typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > StyleCollectionHelper_BASE;
+/*
+class StylesEnumeration : public StyleEnumeration_BASE
+{
+public:
+ StylesEnumeration( const SheetMap& sMap ) : mSheetMap( sMap ), mIt( mSheetMap.begin() ) {}
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
+ {
+ return ( mIt != mSheetMap.end() );
+ }
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ if ( !hasMoreElements() )
+ throw container::NoSuchElementException();
+ uno::Reference< sheet::XSpreadsheet > xSheet( *mIt++ );
+ return uno::makeAny( xSheet ) ;
+ }
+};
+*/
+class StyleCollectionHelper : public StyleCollectionHelper_BASE
+{
+private:
+ uno::Reference< frame::XModel > mxModel;
+ uno::Reference< container::XNameAccess > mxStyleFamilies;
+ uno::Reference< container::XNameContainer > mxCurrentStyleFamily;
+ uno::Any cachePos;
+public:
+ StyleCollectionHelper( const uno::Reference< frame::XModel >& _xModel ) : mxModel( _xModel )
+ {
+ uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( _xModel, uno::UNO_QUERY_THROW);
+ mxStyleFamilies = xStyleSupplier->getStyleFamilies();
+ }
+ uno::Reference< container::XNameContainer > getCurrentStyleFamily(){ return mxCurrentStyleFamily; }
+ // XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return style::XStyle::static_type(0); }
+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return getCount() > 0; }
+ // XNameAcess
+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ if ( !hasByName(aName) )
+ throw container::NoSuchElementException();
+ return cachePos;
+ }
+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException)
+ {
+ uno::Sequence< rtl::OUString > sNames( getCount() );
+ rtl::OUString* pString = sNames.getArray();
+ uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
+ sal_Int32 nCount = 0;
+ for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
+ {
+ uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
+ uno::Sequence< rtl::OUString > sElementNames = xNameAccess->getElementNames();
+ for( sal_Int32 j = 0; j < sElementNames.getLength(); j++ )
+ {
+ pString[nCount++] = sElementNames[j];
+ }
+ }
+ return sNames;
+ }
+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
+ {
+ uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
+ for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
+ {
+ uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
+ if( xNameAccess->hasByName( aName ) )
+ {
+ cachePos = xNameAccess->getByName( aName );
+ mxCurrentStyleFamily.set( xNameAccess, uno::UNO_QUERY_THROW );
+ return sal_True;
+ }
+ }
+ return sal_False;
+ }
+
+ // XIndexAccess
+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException)
+ {
+ uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
+ sal_Int32 nCount = 0;
+ for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
+ {
+ uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
+ nCount += xIndexAccess->getCount();
+ }
+ return nCount;
+ }
+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
+ {
+ if ( Index < 0 || Index >= getCount() )
+ throw lang::IndexOutOfBoundsException();
+
+ // FIXME: need to make a alphabetically sorted list of style names
+ uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes();
+ for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ )
+ {
+ uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW );
+ sal_Int32 nCount = xIndexAccess->getCount();
+ if( Index >= nCount )
+ Index -= nCount;
+ else
+ {
+ mxCurrentStyleFamily.set( xIndexAccess, uno::UNO_QUERY_THROW );
+ return xIndexAccess->getByIndex( Index );
+ }
+ }
+ throw lang::IndexOutOfBoundsException();
+ }
+ // XEnumerationAccess
+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException)
+ {
+ // FIXME:
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+ }
+};
+
+SwVbaStyles::SwVbaStyles( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) throw ( script::BasicErrorException ) : SwVbaStyles_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new StyleCollectionHelper( xModel ) ) ), mxModel( xModel )
+{
+ mxMSF.set( mxModel, uno::UNO_QUERY_THROW );
+}
+
+uno::Any
+SwVbaStyles::createCollectionObject(const uno::Any& aObject)
+{
+ uno::Reference< beans::XPropertySet > xStyleProp( aObject, uno::UNO_QUERY_THROW );
+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProp ) ) );
+}
+
+uno::Type SAL_CALL
+SwVbaStyles::getElementType() throw (uno::RuntimeException)
+{
+ return word::XStyle::static_type(0);
+}
+
+uno::Reference< container::XEnumeration > SAL_CALL
+SwVbaStyles::createEnumeration() throw (uno::RuntimeException)
+{
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+}
+
+uno::Any SAL_CALL
+SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::RuntimeException)
+{
+ //handle WdBuiltinStyle
+ sal_Int32 nIndex = 0;
+ if( ( Index1 >>= nIndex ) && ( nIndex < 0 ) )
+ {
+ for( const BuiltinStyleTable* pTable = aBuiltinStyleTable; pTable != NULL; pTable++ )
+ {
+ if( nIndex == pTable->wdBuiltinStyle )
+ {
+ rtl::OUString aStyleName = rtl::OUString::createFromAscii( pTable->pOOoStyleName );
+ if( aStyleName.getLength() > 0 )
+ {
+ rtl::OUString aStyleType = SwVbaStyle::getOOoStyleTypeFromMSWord( pTable->wdStyleType );
+ switch( pTable->wdStyleType )
+ {
+ case word::WdStyleType::wdStyleTypeParagraph:
+ case word::WdStyleType::wdStyleTypeTable:
+ {
+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") );
+ break;
+ }
+ case word::WdStyleType::wdStyleTypeCharacter:
+ {
+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") );
+ break;
+ }
+ case word::WdStyleType::wdStyleTypeList:
+ {
+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") );
+ break;
+ }
+ default:
+ DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
+ }
+ uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxModel, uno::UNO_QUERY_THROW);
+ uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW );
+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) ) );
+ }
+ else
+ {
+ OSL_TRACE("SwVbaStyles::Item: the builtin style type is not implemented");
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+ }
+ }
+ }
+ }
+ return SwVbaStyles_BASE::Item( Index1, Index2 );
+}
+
+rtl::OUString&
+SwVbaStyles::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaStyles") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaStyles::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.XStyles" ) );
+ }
+ return aServiceNames;
+}
diff --git a/sw/source/ui/vba/vbastyles.hxx b/sw/source/ui/vba/vbastyles.hxx
new file mode 100644
index 000000000000..9cd2e2ff5b1a
--- /dev/null
+++ b/sw/source/ui/vba/vbastyles.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_STYLES_HXX
+#define SW_VBA_STYLES_HXX
+
+#include <ooo/vba/word/XStyles.hpp>
+#include <vbahelper/vbacollectionimpl.hxx>
+
+typedef CollTestImplHelper< ooo::vba::word::XStyles > SwVbaStyles_BASE;
+class SwVbaStyles: public SwVbaStyles_BASE
+{
+ css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
+public:
+ SwVbaStyles( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::script::BasicErrorException );
+
+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& Index2 ) throw (css::uno::RuntimeException);
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+ virtual css::uno::Any createCollectionObject(const css::uno::Any&);
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif
diff --git a/sw/source/ui/vba/vbasystem.cxx b/sw/source/ui/vba/vbasystem.cxx
new file mode 100644
index 000000000000..42d1c09ccbac
--- /dev/null
+++ b/sw/source/ui/vba/vbasystem.cxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbasystem.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <ooo/vba/word/WdCursorType.hpp>
+#include <tools/diagnose_ex.h>
+#include <tools/config.hxx>
+#include <tools/string.hxx>
+#include <osl/file.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/string.hxx>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+PrivateProfileStringListener::~PrivateProfileStringListener()
+{
+}
+
+void PrivateProfileStringListener::Initialize( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey )
+{
+ maFileName = rFileName;
+ maGroupName = rGroupName;
+ maKey = rKey;
+}
+
+uno::Any PrivateProfileStringListener::getValueEvent()
+{
+ // get the private profile string
+ Config aCfg( maFileName );
+ aCfg.SetGroup( maGroupName );
+ rtl::OUString sValue = String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_DONTKNOW );
+
+ return uno::makeAny( sValue );
+}
+
+void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value )
+{
+ // set the private profile string
+ Config aCfg( maFileName );
+ aCfg.SetGroup( maGroupName );
+
+ rtl::OUString aValue;
+ value >>= aValue;
+ aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_DONTKNOW ) );
+}
+
+SwVbaSystem::SwVbaSystem( uno::Reference<uno::XComponentContext >& xContext ): SwVbaSystem_BASE( uno::Reference< XHelperInterface >(), xContext )
+{
+}
+
+SwVbaSystem::~SwVbaSystem()
+{
+}
+
+sal_Int32 SAL_CALL
+SwVbaSystem::getCursor() throw (uno::RuntimeException)
+{
+ sal_Int32 nPointerStyle = getPointerStyle( getCurrentWordDoc(mxContext) );
+
+ switch( nPointerStyle )
+ {
+ case POINTER_ARROW:
+ return word::WdCursorType::wdCursorNorthwestArrow;
+ case POINTER_NULL:
+ return word::WdCursorType::wdCursorNormal;
+ case POINTER_WAIT:
+ return word::WdCursorType::wdCursorWait;
+ case POINTER_TEXT:
+ return word::WdCursorType::wdCursorIBeam;
+ default:
+ return word::WdCursorType::wdCursorNormal;
+ }
+}
+
+void SAL_CALL
+SwVbaSystem::setCursor( sal_Int32 _cursor ) throw (uno::RuntimeException)
+{
+ try
+ {
+ switch( _cursor )
+ {
+ case word::WdCursorType::wdCursorNorthwestArrow:
+ {
+ const Pointer& rPointer( POINTER_ARROW );
+ setCursorHelper( getCurrentWordDoc(mxContext), rPointer, sal_False );
+ break;
+ }
+ case word::WdCursorType::wdCursorWait:
+ {
+ const Pointer& rPointer( static_cast< PointerStyle >( POINTER_WAIT ) );
+ //It will set the edit window, toobar and statusbar's mouse pointer.
+ setCursorHelper( getCurrentWordDoc(mxContext), rPointer, sal_True );
+ break;
+ }
+ case word::WdCursorType::wdCursorIBeam:
+ {
+ const Pointer& rPointer( static_cast< PointerStyle >( POINTER_TEXT ) );
+ //It will set the edit window, toobar and statusbar's mouse pointer.
+ setCursorHelper( getCurrentWordDoc( mxContext ), rPointer, sal_True );
+ break;
+ }
+ case word::WdCursorType::wdCursorNormal:
+ {
+ const Pointer& rPointer( POINTER_NULL );
+ setCursorHelper( getCurrentWordDoc( mxContext ), rPointer, sal_False );
+ break;
+ }
+ default:
+ throw uno::RuntimeException( rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("Unknown value for Cursor pointer")), uno::Reference< uno::XInterface >() );
+ // TODO: isn't this a flaw in the API? It should be allowed to throw an
+ // IllegalArgumentException, or so
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+uno::Any SAL_CALL
+SwVbaSystem::PrivateProfileString( const rtl::OUString& rFilename, const rtl::OUString& rSection, const rtl::OUString& rKey ) throw ( uno::RuntimeException )
+{
+ if( rFilename.getLength() == 0 )
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access document from shell" ) ), uno::Reference< uno::XInterface >() );
+
+ // FIXME: need to detect whether it is a relative file path
+ // we need to detect if this is a URL, if not then assume its a file path
+ rtl::OUString sFileUrl;
+ INetURLObject aObj;
+ aObj.SetURL( rFilename );
+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
+ if ( bIsURL )
+ sFileUrl = rFilename;
+ else
+ osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl);
+
+ ByteString aGroupName = ByteString( rSection.getStr(), RTL_TEXTENCODING_DONTKNOW);
+ ByteString aKey = ByteString( rKey.getStr(), RTL_TEXTENCODING_DONTKNOW);
+ maPrivateProfileStringListener.Initialize( sFileUrl, aGroupName, aKey );
+
+ return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( &maPrivateProfileStringListener ) ) );
+}
+
+rtl::OUString&
+SwVbaSystem::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSystem") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaSystem::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.System" ) );
+ }
+ return aServiceNames;
+}
diff --git a/sw/source/ui/vba/vbasystem.hxx b/sw/source/ui/vba/vbasystem.hxx
new file mode 100644
index 000000000000..deeb6f00fdf4
--- /dev/null
+++ b/sw/source/ui/vba/vbasystem.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_SYSTEM_HXX
+#define SW_VBA_SYSTEM_HXX
+
+#include <ooo/vba/word/XSystem.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <vbahelper/vbapropvalue.hxx>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSystem > SwVbaSystem_BASE;
+
+class PrivateProfileStringListener : public PropListener
+{
+private:
+ rtl::OUString maFileName;
+ ByteString maGroupName;
+ ByteString maKey;
+public:
+ PrivateProfileStringListener(){};
+ virtual ~PrivateProfileStringListener();
+ void Initialize( const rtl::OUString& rFileName, const ByteString& rGroupName, const ByteString& rKey );
+
+ //PropListener
+ virtual void setValueEvent( const css::uno::Any& value );
+ virtual css::uno::Any getValueEvent();
+};
+
+class SwVbaSystem : public SwVbaSystem_BASE
+{
+private:
+ PrivateProfileStringListener maPrivateProfileStringListener;
+
+public:
+ SwVbaSystem( css::uno::Reference< css::uno::XComponentContext >& m_xContext );
+ virtual ~SwVbaSystem();
+
+ // XSystem
+ virtual sal_Int32 SAL_CALL getCursor() throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL setCursor( sal_Int32 _cursor ) throw ( css::uno::RuntimeException );
+ virtual css::uno::Any SAL_CALL PrivateProfileString( const rtl::OUString& rFilename, const rtl::OUString& rSection, const rtl::OUString& rKey ) throw ( css::uno::RuntimeException );
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_SYSTEM_HXX */
diff --git a/sw/source/ui/vba/vbatable.cxx b/sw/source/ui/vba/vbatable.cxx
new file mode 100644
index 000000000000..11969d6717a0
--- /dev/null
+++ b/sw/source/ui/vba/vbatable.cxx
@@ -0,0 +1,97 @@
+#include "vbatable.hxx"
+#include "vbarange.hxx"
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <com/sun/star/table/XTableRows.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include "vbaborders.hxx"
+#include "vbapalette.hxx"
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaTable::SwVbaTable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const uno::Reference< css::text::XTextTable >& xTextTable) throw ( uno::RuntimeException ) : SwVbaTable_BASE( rParent, rContext ), mxTextDocument( rDocument )
+{
+ mxTextTable.set( xTextTable, uno::UNO_QUERY_THROW );
+}
+
+uno::Reference< word::XRange > SAL_CALL
+SwVbaTable::Range( ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ return new SwVbaRange( mxParent, mxContext, mxTextDocument, mxTextTable->getAnchor() );
+}
+
+void SAL_CALL
+SwVbaTable::Select( ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XController > xController = xModel->getCurrentController();
+
+ uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( xController, uno::UNO_QUERY_THROW );
+ uno::Reference< view::XSelectionSupplier > xSelectionSupplier( xController, uno::UNO_QUERY_THROW );
+
+ // set the view cursor to the start of the table.
+ xSelectionSupplier->select( uno::makeAny( mxTextTable ) );
+
+ // go to the end of the table and span the view
+ uno::Reference< text::XTextViewCursor > xCursor = xViewCursorSupplier->getViewCursor();
+ xCursor->gotoEnd(sal_True);
+
+}
+
+void SAL_CALL
+SwVbaTable::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ uno::Reference< table::XTableRows > xRows( mxTextTable->getRows() );
+ xRows->removeByIndex( 0, xRows->getCount() );
+}
+
+uno::Reference< word::XRange > SAL_CALL
+SwVbaTable::ConvertToText( const uno::Any& /*Separator*/, const uno::Any& /*NestedTables*/ ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ // #FIXME the helper api uses the dreaded dispatch mechanism, holding off
+ // implementation while I look for alternative solution
+ throw uno::RuntimeException();
+}
+
+rtl::OUString SAL_CALL
+SwVbaTable::getName() throw (uno::RuntimeException)
+{
+ uno::Reference< container::XNamed > xNamed( mxTextTable, uno::UNO_QUERY_THROW );
+ return xNamed->getName();
+}
+
+uno::Any SAL_CALL
+SwVbaTable::Borders( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ uno::Reference< table::XCellRange > aCellRange( mxTextTable, uno::UNO_QUERY_THROW );
+ VbaPalette aPalette;
+ uno::Reference< XCollection > xCol( new SwVbaBorders( this, mxContext, aCellRange, aPalette ) );
+ if ( index.hasValue() )
+ return xCol->Item( index, uno::Any() );
+ return uno::makeAny( xCol );
+}
+
+// XHelperInterface
+rtl::OUString&
+SwVbaTable::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTable") );
+ return sImplName;
+}
+
+uno::Sequence<rtl::OUString>
+SwVbaTable::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Table" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbatable.hxx b/sw/source/ui/vba/vbatable.hxx
new file mode 100644
index 000000000000..7d913d718895
--- /dev/null
+++ b/sw/source/ui/vba/vbatable.hxx
@@ -0,0 +1,28 @@
+#ifndef SW_VBA_TABLE_HXX
+#define SW_VBA_TABLE_HXX
+#include <vbahelper/vbahelperinterface.hxx>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <ooo/vba/word/XRange.hpp>
+#include <ooo/vba/word/XTable.hpp>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTable > SwVbaTable_BASE;
+
+class SwVbaTable : public SwVbaTable_BASE
+{
+ css::uno::Reference< css::text::XTextDocument > mxTextDocument;
+ css::uno::Reference< css::text::XTextTable > mxTextTable;
+public:
+ SwVbaTable( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const css::uno::Reference< css::text::XTextTable >& xTextTable) throw ( css::uno::RuntimeException);
+ css::uno::Reference< css::text::XTextDocument > getDocument() { return mxTextDocument; };
+ virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL Range( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ virtual void SAL_CALL Select( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL ConvertToText( const css::uno::Any& Separator, const css::uno::Any& NestedTables ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ virtual rtl::OUString SAL_CALL getName( ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif
diff --git a/sw/source/ui/vba/vbatables.cxx b/sw/source/ui/vba/vbatables.cxx
new file mode 100644
index 000000000000..9a10622400d3
--- /dev/null
+++ b/sw/source/ui/vba/vbatables.cxx
@@ -0,0 +1,131 @@
+#include "vbatables.hxx"
+#include "vbatable.hxx"
+#include "vbarange.hxx"
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <comphelper/componentcontext.hxx>
+
+using namespace ::ooo::vba;
+using namespace css;
+
+uno::Reference< container::XIndexAccess > lcl_getTables( const uno::Reference< frame::XModel >& xDoc )
+{
+ uno::Reference< container::XIndexAccess > xTables;
+ uno::Reference< text::XTextTablesSupplier > xSupp( xDoc, uno::UNO_QUERY );
+ if ( xSupp.is() )
+ xTables.set( xSupp->getTextTables(), uno::UNO_QUERY_THROW );
+ return xTables;
+}
+
+uno::Any lcl_createTable( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xDocument, const uno::Any& aSource )
+{
+ uno::Reference< text::XTextTable > xTextTable( aSource, uno::UNO_QUERY_THROW );
+ uno::Reference< text::XTextDocument > xTextDocument( xDocument, uno::UNO_QUERY_THROW );
+ uno::Reference< word::XTable > xTable( new SwVbaTable( xParent, xContext, xTextDocument, xTextTable ) );
+ return uno::makeAny( xTable );
+}
+
+typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumBase;
+
+class TableEnumerationImpl : public EnumBase
+{
+ uno::Reference< XHelperInterface > mxParent;
+ uno::Reference< uno::XComponentContext > mxContext;
+ uno::Reference< frame::XModel > mxDocument;
+ uno::Reference< container::XIndexAccess > mxIndexAccess;
+ sal_Int32 mnCurIndex;
+public:
+ TableEnumerationImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxParent( xParent ), mxContext( xContext ), mxDocument( xDocument ), mxIndexAccess( xIndexAccess ), mnCurIndex(0)
+ {
+ }
+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
+ {
+ return ( mnCurIndex < mxIndexAccess->getCount() );
+ }
+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ if ( !hasMoreElements() )
+ throw container::NoSuchElementException();
+ return lcl_createTable( mxParent, mxContext, mxDocument, mxIndexAccess->getByIndex( mnCurIndex++ ) );
+ }
+
+};
+
+SwVbaTables::SwVbaTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument ) : SwVbaTables_BASE( xParent, xContext , lcl_getTables( xDocument ) ), mxDocument( xDocument )
+{
+}
+
+
+uno::Reference< word::XTable > SAL_CALL
+SwVbaTables::Add( const uno::Reference< word::XRange >& Range, const uno::Any& NumRows, const uno::Any& NumColumns, const uno::Any& /*DefaultTableBehavior*/, const uno::Any& /*AutoFitBehavior*/ ) throw (script::BasicErrorException, uno::RuntimeException)
+{
+ sal_Int32 nCols = 0;
+ sal_Int32 nRows = 0;
+ SwVbaRange* pVbaRange = dynamic_cast< SwVbaRange* >( Range.get() );
+ // Preconditions
+ if ( !( pVbaRange && ( NumRows >>= nRows ) && ( NumColumns >>= nCols ) ) )
+ throw uno::RuntimeException(); // #FIXME better exception??
+ if ( nCols <= 0 || nRows <= 0 )
+ throw uno::RuntimeException(); // #FIXME better exception??
+
+ uno::Reference< frame::XModel > xModel( pVbaRange->getDocument(), uno::UNO_QUERY_THROW );
+ uno::Reference< lang::XMultiServiceFactory > xMsf( xModel, uno::UNO_QUERY_THROW );
+ uno::Reference< text::XTextRange > xTextRange = pVbaRange->getXTextRange();
+
+ uno::Reference< text::XTextTable > xTable;
+ xTable.set( xMsf->createInstance( rtl::OUString::createFromAscii("com.sun.star.text.TextTable") ), uno::UNO_QUERY_THROW );
+/*
+ comphelper::ComponentContext aCtx( xMsf );
+ if ( !aCtx.createComponent( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ), xTable ) );
+ throw uno::RuntimeException(); // #FIXME better exception??
+*/
+ xTable->initialize( nRows, nCols );
+ uno::Reference< text::XText > xText = xTextRange->getText();
+ uno::Reference< text::XTextContent > xContext( xTable, uno::UNO_QUERY_THROW );
+
+ xText->insertTextContent( xTextRange, xContext, true );
+ uno::Reference< word::XTable > xVBATable( new SwVbaTable( mxParent, mxContext, pVbaRange->getDocument(), xTable ) );
+ return xVBATable;
+}
+
+uno::Reference< container::XEnumeration > SAL_CALL
+SwVbaTables::createEnumeration() throw (uno::RuntimeException)
+{
+ return new TableEnumerationImpl( mxParent, mxContext, mxDocument, m_xIndexAccess );
+}
+
+// ScVbaCollectionBaseImpl
+uno::Any
+SwVbaTables::createCollectionObject( const uno::Any& aSource )
+{
+ return lcl_createTable( mxParent, mxContext, mxDocument, aSource );
+}
+
+// XHelperInterface
+rtl::OUString&
+SwVbaTables::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTables") );
+ return sImplName;
+}
+
+// XEnumerationAccess
+uno::Type SAL_CALL
+SwVbaTables::getElementType() throw (uno::RuntimeException)
+{
+ return word::XTable::static_type(0);
+}
+
+uno::Sequence<rtl::OUString>
+SwVbaTables::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Tables" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbatables.hxx b/sw/source/ui/vba/vbatables.hxx
new file mode 100644
index 000000000000..a789337a2839
--- /dev/null
+++ b/sw/source/ui/vba/vbatables.hxx
@@ -0,0 +1,28 @@
+#ifndef SW_VBA_TABLES_HXX
+#define SW_VBA_TABLES_HXX
+
+#include <ooo/vba/word/XTables.hpp>
+#include <vbahelper/vbacollectionimpl.hxx>
+
+
+typedef CollTestImplHelper< ov::word::XTables > SwVbaTables_BASE;
+
+class SwVbaTables : public SwVbaTables_BASE
+{
+ css::uno::Reference< css::frame::XModel > mxDocument;
+public:
+ SwVbaTables( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xDocument );
+ // XTables
+ virtual css::uno::Reference< ov::word::XTable > SAL_CALL Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& NumRows, const css::uno::Any& NumColumns, const css::uno::Any& DefaultTableBehavior, const css::uno::Any& AutoFitBehavior ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+ // ScVbaCollectionBaseImpl
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif
diff --git a/sw/source/ui/vba/vbatemplate.cxx b/sw/source/ui/vba/vbatemplate.cxx
new file mode 100644
index 000000000000..68476b301a17
--- /dev/null
+++ b/sw/source/ui/vba/vbatemplate.cxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbatemplate.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include "wordvbahelper.hxx"
+#include "vbaautotextentry.hxx"
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/text/XAutoTextContainer.hpp>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaTemplate::SwVbaTemplate( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& rName )
+ : SwVbaTemplate_BASE( rParent, rContext ), mxModel( rModel ), msName( rName )
+{
+}
+
+
+SwVbaTemplate::~SwVbaTemplate()
+{
+}
+
+rtl::OUString
+SwVbaTemplate::getName() throw ( css::uno::RuntimeException )
+{
+ return msName;
+}
+
+uno::Any SAL_CALL
+SwVbaTemplate::AutoTextEntries( const uno::Any& index ) throw (uno::RuntimeException)
+{
+ uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
+ uno::Reference< text::XAutoTextContainer > xAutoTextContainer( xMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.AutoTextContainer") ) ), uno::UNO_QUERY_THROW );
+
+ // the default template is "Normal.dot" in Word.
+ rtl::OUString sGroup( RTL_CONSTASCII_USTRINGPARAM("Normal") );
+ sal_Int32 nIndex = msName.lastIndexOf( sal_Unicode('.') );
+ if( nIndex > 0 )
+ {
+ sGroup = msName.copy( 0, msName.lastIndexOf( sal_Unicode('.') ) );
+ // OSL_TRACE("SwVbaTemplate::AutoTextEntries: %s", rtl::OUStringToOString( sGroup, RTL_TEXTENCODING_UTF8 ).getStr() );
+ }
+
+ uno::Reference< container::XIndexAccess > xGroup;
+ if( xAutoTextContainer->hasByName( sGroup ) )
+ {
+ xGroup.set( xAutoTextContainer->getByName( sGroup ), uno::UNO_QUERY_THROW );
+ }
+ else
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Auto Text Entry doesn't exist") ), uno::Reference< uno::XInterface >() );
+ //xGroup.set( xAutoTextContainer->insertNewByName( sGroup ), uno::UNO_QUERY_THROW );
+ }
+
+ uno::Reference< XCollection > xCol( new SwVbaAutoTextEntries( this, mxContext, xGroup ) );
+ if( index.hasValue() )
+ return xCol->Item( index, uno::Any() );
+ return uno::makeAny( xCol );
+}
+
+rtl::OUString&
+SwVbaTemplate::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTemplate") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaTemplate::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Template" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbatemplate.hxx b/sw/source/ui/vba/vbatemplate.hxx
new file mode 100644
index 000000000000..073e5cc5db1e
--- /dev/null
+++ b/sw/source/ui/vba/vbatemplate.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_TEMPLATE_HXX
+#define SW_VBA_TEMPLATE_HXX
+
+#include <ooo/vba/word/XTemplate.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTemplate > SwVbaTemplate_BASE;
+
+class SwVbaTemplate : public SwVbaTemplate_BASE
+{
+private:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ rtl::OUString msName;
+public:
+ SwVbaTemplate( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
+ const css::uno::Reference< css::frame::XModel >& rModel, const rtl::OUString& );
+ virtual ~SwVbaTemplate();
+
+ // XTemplate
+ virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL AutoTextEntries( const css::uno::Any& index ) throw (css::uno::RuntimeException);
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_TEMPLATE_HXX */
diff --git a/sw/source/ui/vba/vbavariable.cxx b/sw/source/ui/vba/vbavariable.cxx
new file mode 100644
index 000000000000..b62dc5642114
--- /dev/null
+++ b/sw/source/ui/vba/vbavariable.cxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbavariable.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <tools/diagnose_ex.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+SwVbaVariable::SwVbaVariable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
+ const uno::Reference< beans::XPropertyAccess >& rUserDefined, const rtl::OUString& rName ) throw ( uno::RuntimeException ) :
+ SwVbaVariable_BASE( rParent, rContext ), mxUserDefined( rUserDefined ), maName( rName )
+{
+}
+
+SwVbaVariable::~SwVbaVariable()
+{
+}
+
+rtl::OUString SAL_CALL
+SwVbaVariable::getName() throw ( css::uno::RuntimeException )
+{
+ return maName;
+}
+
+void SAL_CALL
+SwVbaVariable::setName( const rtl::OUString& ) throw ( css::uno::RuntimeException )
+{
+ throw uno::RuntimeException( rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(" Fail to set name")), uno::Reference< uno::XInterface >() );
+}
+
+uno::Any SAL_CALL
+SwVbaVariable::getValue() throw ( css::uno::RuntimeException )
+{
+ uno::Reference< beans::XPropertySet > xProp( mxUserDefined, uno::UNO_QUERY_THROW );
+ return xProp->getPropertyValue( maName );
+}
+
+void SAL_CALL
+SwVbaVariable::setValue( const uno::Any& rValue ) throw ( css::uno::RuntimeException )
+{
+ // FIXME: fail to set the value if the new type of vaue is differenct from the original one.
+ uno::Reference< beans::XPropertySet > xProp( mxUserDefined, uno::UNO_QUERY_THROW );
+ xProp->setPropertyValue( maName, rValue );
+}
+
+sal_Int32 SAL_CALL
+SwVbaVariable::getIndex() throw ( css::uno::RuntimeException )
+{
+ const uno::Sequence< beans::PropertyValue > props = mxUserDefined->getPropertyValues();
+ for (sal_Int32 i = 0; i < props.getLength(); ++i)
+ {
+ if( maName.equals( props[i].Name ) )
+ return i+1;
+ }
+
+ return 0;
+}
+
+rtl::OUString&
+SwVbaVariable::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaVariable") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaVariable::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Variable" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbavariable.hxx b/sw/source/ui/vba/vbavariable.hxx
new file mode 100644
index 000000000000..af076804ef17
--- /dev/null
+++ b/sw/source/ui/vba/vbavariable.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_VARIABLE_HXX
+#define SW_VBA_VARIABLE_HXX
+
+#include <ooo/vba/word/XVariable.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XVariable > SwVbaVariable_BASE;
+
+class SwVbaVariable : public SwVbaVariable_BASE
+{
+private:
+ css::uno::Reference< css::beans::XPropertyAccess > mxUserDefined;
+ rtl::OUString maName;
+
+public:
+ SwVbaVariable( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
+ const css::uno::Reference< css::beans::XPropertyAccess >& rUserDefined, const rtl::OUString& rName ) throw ( css::uno::RuntimeException );
+ virtual ~SwVbaVariable();
+
+ // XVariable
+ virtual rtl::OUString SAL_CALL getName() throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL setName( const rtl::OUString& ) throw ( css::uno::RuntimeException );
+ virtual css::uno::Any SAL_CALL getValue() throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL setValue( const css::uno::Any& rValue ) throw ( css::uno::RuntimeException );
+ virtual sal_Int32 SAL_CALL getIndex() throw ( css::uno::RuntimeException );
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_VARIABLE_HXX */
diff --git a/sw/source/ui/vba/vbavariables.cxx b/sw/source/ui/vba/vbavariables.cxx
new file mode 100644
index 000000000000..6aa662702a12
--- /dev/null
+++ b/sw/source/ui/vba/vbavariables.cxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbavariables.hxx"
+#include "vbavariable.hxx"
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+uno::Reference< container::XIndexAccess > createVariablesAccess( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< beans::XPropertyAccess >& xUserDefined ) throw ( uno::RuntimeException )
+{
+ // FIXME: the performance is poor?
+ XNamedObjectCollectionHelper< word::XVariable >::XNamedVec mVariables;
+ const uno::Sequence< beans::PropertyValue > props = xUserDefined->getPropertyValues();
+ sal_Int32 nCount = props.getLength();
+ mVariables.reserve( nCount );
+ for( sal_Int32 i=0; i < nCount; i++ )
+ mVariables.push_back( uno::Reference< word::XVariable > ( new SwVbaVariable( xParent, xContext, xUserDefined, props[i].Name ) ) );
+
+ uno::Reference< container::XIndexAccess > xVariables( new XNamedObjectCollectionHelper< word::XVariable >( mVariables ) );
+ return xVariables;
+}
+
+SwVbaVariables::SwVbaVariables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertyAccess >& rUserDefined ): SwVbaVariables_BASE( xParent, xContext, createVariablesAccess( xParent, xContext, rUserDefined ) ), mxUserDefined( rUserDefined )
+{
+}
+// XEnumerationAccess
+uno::Type
+SwVbaVariables::getElementType() throw (uno::RuntimeException)
+{
+ return word::XVariable::static_type(0);
+}
+uno::Reference< container::XEnumeration >
+SwVbaVariables::createEnumeration() throw (uno::RuntimeException)
+{
+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
+ return xEnumerationAccess->createEnumeration();
+}
+
+uno::Any
+SwVbaVariables::createCollectionObject( const css::uno::Any& aSource )
+{
+ return aSource;
+}
+
+uno::Any SAL_CALL
+SwVbaVariables::Add( const rtl::OUString& rName, const uno::Any& rValue ) throw (uno::RuntimeException)
+{
+ uno::Any aValue;
+ if( rValue.hasValue() )
+ aValue = rValue;
+ else
+ aValue <<= rtl::OUString();
+ uno::Reference< beans::XPropertyContainer > xPropertyContainer( mxUserDefined, uno::UNO_QUERY_THROW );
+ xPropertyContainer->addProperty( rName, beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::REMOVEABLE, aValue );
+
+ return uno::makeAny( uno::Reference< word::XVariable >( new SwVbaVariable( getParent(), mxContext, mxUserDefined, rName ) ) );
+}
+
+rtl::OUString&
+SwVbaVariables::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaVariables") );
+ return sImplName;
+}
+
+css::uno::Sequence<rtl::OUString>
+SwVbaVariables::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > sNames;
+ if ( sNames.getLength() == 0 )
+ {
+ sNames.realloc( 1 );
+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Variables") );
+ }
+ return sNames;
+}
diff --git a/sw/source/ui/vba/vbavariables.hxx b/sw/source/ui/vba/vbavariables.hxx
new file mode 100644
index 000000000000..4933ef6e75a4
--- /dev/null
+++ b/sw/source/ui/vba/vbavariables.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_VARIABLES_HXX
+#define SW_VBA_VARIABLES_HXX
+
+#include <vbahelper/vbacollectionimpl.hxx>
+#include <ooo/vba/word/XVariables.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+
+typedef CollTestImplHelper< ooo::vba::word::XVariables > SwVbaVariables_BASE;
+
+class SwVbaVariables : public SwVbaVariables_BASE
+{
+private:
+ css::uno::Reference< css::beans::XPropertyAccess > mxUserDefined;
+
+public:
+ SwVbaVariables( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertyAccess >& rUserDefined );
+ virtual ~SwVbaVariables() {}
+
+ // XEnumerationAccess
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+
+ // SwVbaVariables_BASE
+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+
+ // XVariables
+ virtual css::uno::Any SAL_CALL Add( const rtl::OUString& rName, const css::uno::Any& rValue ) throw (css::uno::RuntimeException);
+};
+
+#endif /* SW_VBA_VARIABLES_HXX */
diff --git a/sw/source/ui/vba/vbaview.cxx b/sw/source/ui/vba/vbaview.cxx
new file mode 100644
index 000000000000..9cb8bf1490ce
--- /dev/null
+++ b/sw/source/ui/vba/vbaview.cxx
@@ -0,0 +1,422 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbaview.hxx"
+#include <vbahelper/vbahelper.hxx>
+#include <tools/diagnose_ex.h>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/view/XViewSettingsSupplier.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XFootnotesSupplier.hpp>
+#include <com/sun/star/text/XEndnotesSupplier.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <ooo/vba/word/WdSpecialPane.hpp>
+#include <ooo/vba/word/WdViewType.hpp>
+#include <ooo/vba/word/WdSeekView.hpp>
+
+#include "wordvbahelper.hxx"
+#include "vbaheaderfooterhelper.hxx"
+#include <view.hxx>
+
+using namespace ::ooo::vba;
+using namespace ::com::sun::star;
+
+static const sal_Int32 DEFAULT_BODY_DISTANCE = 500;
+
+SwVbaView::SwVbaView( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,
+ const uno::Reference< frame::XModel >& rModel ) throw ( uno::RuntimeException ) :
+ SwVbaView_BASE( rParent, rContext ), mxModel( rModel )
+{
+ uno::Reference< frame::XController > xController = mxModel->getCurrentController();
+
+ uno::Reference< text::XTextViewCursorSupplier > xTextViewCursorSupp( xController, uno::UNO_QUERY_THROW );
+ mxViewCursor = xTextViewCursorSupp->getViewCursor();
+
+ uno::Reference< view::XViewSettingsSupplier > xViewSettingSupp( xController, uno::UNO_QUERY_THROW );
+ mxViewSettings.set( xViewSettingSupp->getViewSettings(), uno::UNO_QUERY_THROW );
+}
+
+SwVbaView::~SwVbaView()
+{
+}
+
+::sal_Int32 SAL_CALL
+SwVbaView::getSeekView() throw (css::uno::RuntimeException)
+{
+ // FIXME: if the view cursor is in table, field, section and frame
+ // handle if the cursor is in table
+ uno::Reference< text::XText > xCurrentText = mxViewCursor->getText();
+ uno::Reference< beans::XPropertySet > xCursorProps( mxViewCursor, uno::UNO_QUERY_THROW );
+ uno::Reference< text::XTextContent > xTextContent;
+ while( xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextContent )
+ {
+ xCurrentText = xTextContent->getAnchor()->getText();
+ xCursorProps.set( xCurrentText->createTextCursor(), uno::UNO_QUERY_THROW );
+ }
+ uno::Reference< lang::XServiceInfo > xServiceInfo( xCurrentText, uno::UNO_QUERY_THROW );
+ rtl::OUString aImplName = xServiceInfo->getImplementationName();
+ if( aImplName.equalsAscii("SwXBodyText") )
+ {
+ return word::WdSeekView::wdSeekMainDocument;
+ }
+ else if( aImplName.equalsAscii("SwXHeadFootText") )
+ {
+ if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) )
+ {
+ if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) )
+ return word::WdSeekView::wdSeekFirstPageHeader;
+ else if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) )
+ return word::WdSeekView::wdSeekEvenPagesHeader;
+ else
+ return word::WdSeekView::wdSeekPrimaryHeader;
+ }
+ else
+ {
+ if( HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) )
+ return word::WdSeekView::wdSeekFirstPageFooter;
+ else if( HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) )
+ return word::WdSeekView::wdSeekEvenPagesFooter;
+ else
+ return word::WdSeekView::wdSeekPrimaryFooter;
+ }
+ }
+ else if( aImplName.equalsAscii("SwXFootnote") )
+ {
+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Endnote") ) ) )
+ return word::WdSeekView::wdSeekEndnotes;
+ else
+ return word::WdSeekView::wdSeekFootnotes;
+ }
+
+ return word::WdSeekView::wdSeekMainDocument;
+}
+
+void SAL_CALL
+SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeException)
+{
+ // FIXME: save the current cursor position, if the cursor is in the main
+ // document, so we can jump back to this position, if the macro sets
+ // the ViewMode back to wdSeekMainDocument
+
+ // if( _seekview == getSeekView() )
+ // return;
+
+ switch( _seekview )
+ {
+ case word::WdSeekView::wdSeekFirstPageFooter:
+ case word::WdSeekView::wdSeekFirstPageHeader:
+ case word::WdSeekView::wdSeekCurrentPageFooter:
+ case word::WdSeekView::wdSeekCurrentPageHeader:
+ case word::WdSeekView::wdSeekPrimaryFooter:
+ case word::WdSeekView::wdSeekPrimaryHeader:
+ case word::WdSeekView::wdSeekEvenPagesFooter:
+ case word::WdSeekView::wdSeekEvenPagesHeader:
+ {
+ // need to test
+ mxViewCursor->gotoRange( getHFTextRange( _seekview ), sal_False );
+ break;
+ }
+ case word::WdSeekView::wdSeekFootnotes:
+ {
+ uno::Reference< text::XFootnotesSupplier > xFootnotesSupp( mxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< container::XIndexAccess > xFootnotes( xFootnotesSupp->getFootnotes(), uno::UNO_QUERY_THROW );
+ if( xFootnotes->getCount() > 0 )
+ {
+ uno::Reference< text::XText > xText( xFootnotes->getByIndex(0), uno::UNO_QUERY_THROW );
+ mxViewCursor->gotoRange( xText->getStart(), sal_False );
+ }
+ else
+ {
+ DebugHelper::exception( SbERR_NO_ACTIVE_OBJECT, rtl::OUString() );
+ }
+ break;
+ }
+ case word::WdSeekView::wdSeekEndnotes:
+ {
+ uno::Reference< text::XEndnotesSupplier > xEndnotesSupp( mxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< container::XIndexAccess > xEndnotes( xEndnotesSupp->getEndnotes(), uno::UNO_QUERY_THROW );
+ if( xEndnotes->getCount() > 0 )
+ {
+ uno::Reference< text::XText > xText( xEndnotes->getByIndex(0), uno::UNO_QUERY_THROW );
+ mxViewCursor->gotoRange( xText->getStart(), sal_False );
+ }
+ else
+ {
+ DebugHelper::exception( SbERR_NO_ACTIVE_OBJECT, rtl::OUString() );
+ }
+ break;
+ }
+ case word::WdSeekView::wdSeekMainDocument:
+ {
+ uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< text::XText > xText = xTextDocument->getText();
+ mxViewCursor->gotoRange( getFirstObjectPosition( xText ), sal_False );
+ break;
+ }
+ }
+}
+
+::sal_Int32 SAL_CALL
+SwVbaView::getSplitSpecial() throw (css::uno::RuntimeException)
+{
+ return word::WdSpecialPane::wdPaneNone;
+}
+
+void SAL_CALL
+SwVbaView::setSplitSpecial( ::sal_Int32/* _splitspecial */) throw (css::uno::RuntimeException)
+{
+ // not support in Writer
+}
+
+::sal_Bool SAL_CALL
+SwVbaView::getTableGridLines() throw (css::uno::RuntimeException)
+{
+ sal_Bool bShowTableGridLine = sal_False;
+ mxViewSettings->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowTableBoundaries"))) >>= bShowTableGridLine;
+ return bShowTableGridLine;
+}
+
+void SAL_CALL
+SwVbaView::setTableGridLines( ::sal_Bool _tablegridlines ) throw (css::uno::RuntimeException)
+{
+ mxViewSettings->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowTableBoundaries")), uno::makeAny( _tablegridlines ) );
+}
+
+::sal_Int32 SAL_CALL
+SwVbaView::getType() throw (css::uno::RuntimeException)
+{
+ // FIXME: handle wdPrintPreview type
+ sal_Bool bOnlineLayout = sal_False;
+ mxViewSettings->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout"))) >>= bOnlineLayout;
+ return bOnlineLayout ? word::WdViewType::wdWebView : word::WdViewType::wdPrintView;
+}
+
+void SAL_CALL
+SwVbaView::setType( ::sal_Int32 _type ) throw (css::uno::RuntimeException)
+{
+ // FIXME: handle wdPrintPreview type
+ switch( _type )
+ {
+ case word::WdViewType::wdPrintView:
+ case word::WdViewType::wdNormalView:
+ {
+ mxViewSettings->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout")), uno::makeAny( sal_False ) );
+ break;
+ }
+ case word::WdViewType::wdWebView:
+ {
+ mxViewSettings->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout")), uno::makeAny( sal_True ) );
+ break;
+ }
+ case word::WdViewType::wdPrintPreview:
+ {
+ PrintPreviewHelper( uno::Any(),word::getView( mxModel ) );
+ break;
+ }
+ default:
+ DebugHelper::exception( SbERR_NOT_IMPLEMENTED, rtl::OUString() );
+
+ }
+}
+
+uno::Reference< text::XTextRange > SwVbaView::getHFTextRange( sal_Int32 nType ) throw (uno::RuntimeException)
+{
+ mxModel->lockControllers();
+
+ rtl::OUString aPropIsOn;
+ rtl::OUString aPropIsShared;
+ rtl::OUString aPropBodyDistance;
+ rtl::OUString aPropText;
+
+ switch( nType )
+ {
+ case word::WdSeekView::wdSeekCurrentPageFooter:
+ case word::WdSeekView::wdSeekFirstPageFooter:
+ case word::WdSeekView::wdSeekPrimaryFooter:
+ case word::WdSeekView::wdSeekEvenPagesFooter:
+ {
+ aPropIsOn = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn") );
+ aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared") );
+ aPropBodyDistance = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance") );
+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
+ break;
+ }
+ case word::WdSeekView::wdSeekCurrentPageHeader:
+ case word::WdSeekView::wdSeekFirstPageHeader:
+ case word::WdSeekView::wdSeekPrimaryHeader:
+ case word::WdSeekView::wdSeekEvenPagesHeader:
+ {
+ aPropIsOn = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn") );
+ aPropIsShared = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared") );
+ aPropBodyDistance = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance") );
+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
+ break;
+ }
+ }
+
+ uno::Reference< text::XPageCursor > xPageCursor( mxViewCursor, uno::UNO_QUERY_THROW );
+
+ if( nType == word::WdSeekView::wdSeekFirstPageFooter
+ || nType == word::WdSeekView::wdSeekFirstPageHeader )
+ {
+ xPageCursor->jumpToFirstPage();
+ }
+
+ uno::Reference< style::XStyle > xStyle;
+ uno::Reference< text::XText > xText;
+ switch( nType )
+ {
+ case word::WdSeekView::wdSeekPrimaryFooter:
+ case word::WdSeekView::wdSeekPrimaryHeader:
+ case word::WdSeekView::wdSeekEvenPagesFooter:
+ case word::WdSeekView::wdSeekEvenPagesHeader:
+ {
+ // The primary header is the first header of the section.
+ // If the header is not shared between odd and even pages
+ // the odd page's header is the primary header. If the
+ // first page's header is different from the rest of the
+ // document, it is NOT the primary header ( the next primary
+ // header would be on page 3 )
+ // The even pages' header is only available if the header is
+ // not shared and the current style is applied to a page with
+ // an even page number
+ uno::Reference< beans::XPropertySet > xCursorProps( mxViewCursor, uno::UNO_QUERY_THROW );
+ rtl::OUString aPageStyleName;
+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
+ if( aPageStyleName.equalsAscii("First Page") )
+ {
+ // go to the beginning of where the next style is used
+ sal_Bool hasNextPage = sal_False;
+ xStyle = word::getCurrentPageStyle( mxModel );
+ do
+ {
+ hasNextPage = xPageCursor->jumpToNextPage();
+ }
+ while( hasNextPage && ( xStyle == word::getCurrentPageStyle( mxModel ) ) );
+
+ if( !hasNextPage )
+ DebugHelper::exception( SbERR_BAD_ACTION, rtl::OUString() );
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ xStyle = word::getCurrentPageStyle( mxModel );
+ uno::Reference< beans::XPropertySet > xPageProps( xStyle, uno::UNO_QUERY_THROW );
+ sal_Bool isOn = sal_False;
+ xPageProps->getPropertyValue( aPropIsOn ) >>= isOn;
+ sal_Bool isShared = sal_False;
+ xPageProps->getPropertyValue( aPropIsShared ) >>= isShared;
+ if( !isOn )
+ {
+ xPageProps->setPropertyValue( aPropIsOn, uno::makeAny( sal_True ) );
+ xPageProps->setPropertyValue( aPropBodyDistance, uno::makeAny( DEFAULT_BODY_DISTANCE ) );
+ }
+ if( !isShared )
+ {
+ rtl::OUString aTempPropText = aPropText;
+ if( nType == word::WdSeekView::wdSeekEvenPagesFooter
+ || nType == word::WdSeekView::wdSeekEvenPagesHeader )
+ {
+ aTempPropText += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left") );
+ }
+ else
+ {
+ aTempPropText += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Right") );
+ }
+ xText.set( xPageProps->getPropertyValue( aTempPropText), uno::UNO_QUERY_THROW );
+ }
+ else
+ {
+ if( nType == word::WdSeekView::wdSeekEvenPagesFooter
+ || nType == word::WdSeekView::wdSeekEvenPagesHeader )
+ {
+ DebugHelper::exception( SbERR_BAD_ACTION, rtl::OUString() );
+ }
+ xText.set( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW );
+ }
+
+ mxModel->unlockControllers();
+ if( !xText.is() )
+ {
+ DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() );
+ }
+ uno::Reference< text::XTextRange > xTextRange = getFirstObjectPosition( xText );
+ return xTextRange;
+}
+
+uno::Reference< text::XTextRange > SwVbaView::getFirstObjectPosition( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException)
+{
+ // if the first object is table, get the position of first cell
+ uno::Reference< text::XTextRange > xTextRange;
+ uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW );
+ uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration();
+ if( xParaEnum->hasMoreElements() )
+ {
+ uno::Reference< lang::XServiceInfo > xServiceInfo( xParaEnum->nextElement(), uno::UNO_QUERY_THROW );
+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ) ) )
+ {
+ uno::Reference< table::XCellRange > xCellRange( xServiceInfo, uno::UNO_QUERY_THROW );
+ uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW );
+ xTextRange = xFirstCellText->getStart();
+ }
+ }
+ if( !xTextRange.is() )
+ xTextRange = xText->getStart();
+ return xTextRange;
+}
+
+rtl::OUString&
+SwVbaView::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaView") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaView::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.View" ) );
+ }
+ return aServiceNames;
+}
+
diff --git a/sw/source/ui/vba/vbaview.hxx b/sw/source/ui/vba/vbaview.hxx
new file mode 100644
index 000000000000..03e183ec38a3
--- /dev/null
+++ b/sw/source/ui/vba/vbaview.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_VIEW_HXX
+#define SW_VBA_VIEW_HXX
+
+#include <ooo/vba/word/XView.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+#include <com/sun/star/text/XTextViewCursor.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XView > SwVbaView_BASE;
+
+class SwVbaView : public SwVbaView_BASE
+{
+private:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ css::uno::Reference< css::text::XTextViewCursor > mxViewCursor;
+ css::uno::Reference< css::beans::XPropertySet > mxViewSettings;
+
+ css::uno::Reference< css::text::XTextRange > getHFTextRange( sal_Int32 nType ) throw (css::uno::RuntimeException);
+ css::uno::Reference< css::text::XTextRange > getFirstObjectPosition( const css::uno::Reference< css::text::XText >& xText ) throw (css::uno::RuntimeException);
+
+public:
+ SwVbaView( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext,
+ const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException );
+ virtual ~SwVbaView();
+
+ // XView
+ virtual ::sal_Int32 SAL_CALL getSeekView() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getSplitSpecial() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSplitSpecial( ::sal_Int32 _splitspecial ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getTableGridLines() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setTableGridLines( ::sal_Bool _tablegridlines ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setType( ::sal_Int32 _type ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+#endif /* SW_VBA_VIEW_HXX */
diff --git a/sw/source/ui/vba/vbawindow.cxx b/sw/source/ui/vba/vbawindow.cxx
new file mode 100644
index 000000000000..e3d9bddbc7aa
--- /dev/null
+++ b/sw/source/ui/vba/vbawindow.cxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <vbahelper/helperdecl.hxx>
+#include "vbawindow.hxx"
+#include "vbaglobals.hxx"
+#include "vbadocument.hxx"
+#include "vbaview.hxx"
+#include "vbapanes.hxx"
+#include "vbapane.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::ooo::vba;
+
+SwVbaWindow::SwVbaWindow( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : WindowImpl_BASE( xParent, xContext, xModel )
+{
+}
+
+void
+SwVbaWindow::Activate() throw (css::uno::RuntimeException)
+{
+ SwVbaDocument document( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
+
+ document.Activate();
+}
+
+void
+SwVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& RouteDocument ) throw (uno::RuntimeException)
+{
+ // FIXME: it is incorrect when there are more than 1 windows
+ SwVbaDocument document( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel );
+ uno::Any FileName;
+ document.Close(SaveChanges, FileName, RouteDocument );
+}
+
+uno::Any SAL_CALL
+SwVbaWindow::getView() throw (uno::RuntimeException)
+{
+ return uno::makeAny( uno::Reference< word::XView >( new SwVbaView( this, mxContext, m_xModel ) ) );
+}
+
+void SAL_CALL SwVbaWindow::setView( const uno::Any& _view ) throw (uno::RuntimeException)
+{
+ sal_Int32 nType = 0;
+ if( _view >>= nType )
+ {
+ SwVbaView view( this, mxContext, m_xModel );
+ view.setType( nType );
+ }
+}
+
+uno::Any SAL_CALL
+SwVbaWindow::Panes( const uno::Any& aIndex ) throw (uno::RuntimeException)
+{
+ uno::Reference< XCollection > xPanes( new SwVbaPanes( this, mxContext, m_xModel ) );
+ if( aIndex.getValueTypeClass() == uno::TypeClass_VOID )
+ return uno::makeAny( xPanes );
+
+ return uno::Any( xPanes->Item( aIndex, uno::Any() ) );
+}
+
+uno::Any SAL_CALL
+SwVbaWindow::ActivePane() throw (uno::RuntimeException)
+{
+ return uno::makeAny( uno::Reference< word::XPane >( new SwVbaPane( this, mxContext, m_xModel ) ) );
+}
+
+rtl::OUString&
+SwVbaWindow::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaWindow") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaWindow::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Window" ) );
+ }
+ return aServiceNames;
+}
diff --git a/sw/source/ui/vba/vbawindow.hxx b/sw/source/ui/vba/vbawindow.hxx
new file mode 100644
index 000000000000..0809d2b73685
--- /dev/null
+++ b/sw/source/ui/vba/vbawindow.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_WINDOW_HXX
+#define SW_VBA_WINDOW_HXX
+#include <cppuhelper/implbase1.hxx>
+#include <ooo/vba/word/XWindow.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <vbahelper/vbahelperinterface.hxx>
+#include <vbahelper/vbawindowbase.hxx>
+
+typedef cppu::ImplInheritanceHelper1< VbaWindowBase, ov::word::XWindow > WindowImpl_BASE;
+
+class SwVbaWindow : public WindowImpl_BASE
+{
+public:
+ SwVbaWindow( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::frame::XModel >& xModel );
+
+
+ // Attributes
+ virtual css::uno::Any SAL_CALL getView() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setView( const css::uno::Any& _view ) throw (css::uno::RuntimeException);
+ // Methods
+ virtual void SAL_CALL Activate( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const css::uno::Any& RouteDocument ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Panes( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL ActivePane() throw (css::uno::RuntimeException);
+ // XHelperInterface
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif //SW_VBA_WINDOW_HXX
diff --git a/sw/source/ui/vba/vbawrapformat.cxx b/sw/source/ui/vba/vbawrapformat.cxx
new file mode 100644
index 000000000000..4125cc00aaa0
--- /dev/null
+++ b/sw/source/ui/vba/vbawrapformat.cxx
@@ -0,0 +1,252 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "vbawrapformat.hxx"
+#include <ooo/vba/word/WdWrapSideType.hpp>
+#include <ooo/vba/word/WdWrapType.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
+#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/helperdecl.hxx>
+
+using namespace ooo::vba;
+using namespace com::sun::star;
+
+SwVbaWrapFormat::SwVbaWrapFormat( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) : SwVbaWrapFormat_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext ), m_xShape( getXSomethingFromArgs< drawing::XShape >( aArgs, 1, false ) ), mnWrapFormatType( 0 ), mnSide( word::WdWrapSideType::wdWrapBoth )
+{
+ m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW );
+}
+
+void SwVbaWrapFormat::makeWrap() throw (uno::RuntimeException)
+{
+ text::WrapTextMode eTextMode = text::WrapTextMode_NONE;
+ if( mnSide == word::WdWrapSideType::wdWrapLeft )
+ {
+ eTextMode = text::WrapTextMode_LEFT;
+ }
+ else if( mnSide == word::WdWrapSideType::wdWrapRight )
+ {
+ eTextMode = text::WrapTextMode_RIGHT;
+ }
+ else if( mnSide == word::WdWrapSideType::wdWrapBoth ||
+ mnSide == word::WdWrapSideType::wdWrapLargest )
+ {
+ switch( mnWrapFormatType )
+ {
+ case word::WdWrapType::wdWrapNone:
+ case word::WdWrapType::wdWrapThrough:
+ {
+ eTextMode = text::WrapTextMode_THROUGHT;
+ break;
+ }
+ case word::WdWrapType::wdWrapInline:
+ case word::WdWrapType::wdWrapTopBottom:
+ {
+ eTextMode = text::WrapTextMode_NONE;
+ break;
+ }
+ case word::WdWrapType::wdWrapSquare:
+ {
+ eTextMode = text::WrapTextMode_PARALLEL;
+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SurroundContour") ), uno::makeAny( sal_False ) );
+ break;
+ }
+ case word::WdWrapType::wdWrapTight:
+ {
+ eTextMode = text::WrapTextMode_PARALLEL;
+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SurroundContour") ), uno::makeAny( sal_True ) );
+ break;
+ }
+ default:
+ {
+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
+ }
+ }
+ }
+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextWrap") ), uno::makeAny( eTextMode ) );
+}
+
+::sal_Int32 SAL_CALL SwVbaWrapFormat::getType() throw (uno::RuntimeException)
+{
+ sal_Int32 nType = word::WdWrapType::wdWrapSquare;
+ text::WrapTextMode eTextMode;
+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextWrap") )) >>= eTextMode;
+ switch( eTextMode )
+ {
+ case text::WrapTextMode_NONE:
+ {
+ nType = word::WdWrapType::wdWrapTopBottom;
+ break;
+ }
+ case text::WrapTextMode_THROUGHT:
+ {
+ nType = word::WdWrapType::wdWrapNone;
+ break;
+ }
+ case text::WrapTextMode_PARALLEL:
+ {
+ sal_Bool bContour = sal_False;
+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SurroundContour") )) >>= bContour;
+ if( bContour )
+ nType = word::WdWrapType::wdWrapTight;
+ else
+ nType = word::WdWrapType::wdWrapSquare;
+ break;
+ }
+ case text::WrapTextMode_DYNAMIC:
+ case text::WrapTextMode_LEFT:
+ case text::WrapTextMode_RIGHT:
+ {
+ nType = word::WdWrapType::wdWrapThrough;
+ break;
+ }
+ default:
+ {
+ nType = word::WdWrapType::wdWrapSquare;
+ }
+ }
+ return nType;
+}
+
+void SAL_CALL SwVbaWrapFormat::setType( ::sal_Int32 _type ) throw (uno::RuntimeException)
+{
+ mnWrapFormatType = _type;
+ makeWrap();
+}
+
+::sal_Int32 SAL_CALL SwVbaWrapFormat::getSide() throw (uno::RuntimeException)
+{
+ sal_Int32 nSide = word::WdWrapSideType::wdWrapBoth;
+ text::WrapTextMode eTextMode;
+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextWrap") )) >>= eTextMode;
+ switch( eTextMode )
+ {
+ case text::WrapTextMode_LEFT:
+ {
+ nSide = word::WdWrapSideType::wdWrapLeft;
+ break;
+ }
+ case text::WrapTextMode_RIGHT:
+ {
+ nSide = word::WdWrapSideType::wdWrapRight;
+ break;
+ }
+ default:
+ {
+ nSide = word::WdWrapSideType::wdWrapBoth;
+ }
+ }
+ return nSide;
+}
+
+void SAL_CALL SwVbaWrapFormat::setSide( ::sal_Int32 _side ) throw (uno::RuntimeException)
+{
+ mnSide = _side;
+ makeWrap();
+}
+
+float SwVbaWrapFormat::getDistance( const rtl::OUString& sName ) throw (uno::RuntimeException)
+{
+ sal_Int32 nDistance = 0;
+ m_xPropertySet->getPropertyValue( sName ) >>= nDistance;
+ return static_cast< float >( Millimeter::getInPoints( nDistance ) );
+}
+
+void SwVbaWrapFormat::setDistance( const rtl::OUString& sName, float _distance ) throw (uno::RuntimeException)
+{
+ sal_Int32 nDistance = Millimeter::getInHundredthsOfOneMillimeter( _distance );
+ m_xPropertySet->setPropertyValue( sName, uno::makeAny( nDistance ) );
+}
+
+float SAL_CALL SwVbaWrapFormat::getDistanceTop() throw (uno::RuntimeException)
+{
+ return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ) );
+}
+
+void SAL_CALL SwVbaWrapFormat::setDistanceTop( float _distancetop ) throw (uno::RuntimeException)
+{
+ setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ), _distancetop );
+}
+
+float SAL_CALL SwVbaWrapFormat::getDistanceBottom() throw (uno::RuntimeException)
+{
+ return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin") ) );
+}
+
+void SAL_CALL SwVbaWrapFormat::setDistanceBottom( float _distancebottom ) throw (uno::RuntimeException)
+{
+ setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin") ), _distancebottom );
+}
+
+float SAL_CALL SwVbaWrapFormat::getDistanceLeft() throw (uno::RuntimeException)
+{
+ return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ) );
+}
+
+void SAL_CALL SwVbaWrapFormat::setDistanceLeft( float _distanceleft ) throw (uno::RuntimeException)
+{
+ setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ), _distanceleft );
+}
+
+float SAL_CALL SwVbaWrapFormat::getDistanceRight() throw (uno::RuntimeException)
+{
+ return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin") ) );
+}
+
+void SAL_CALL SwVbaWrapFormat::setDistanceRight( float _distanceright ) throw (uno::RuntimeException)
+{
+ setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin") ), _distanceright );
+}
+
+rtl::OUString&
+SwVbaWrapFormat::getServiceImplName()
+{
+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaWrapFormat") );
+ return sImplName;
+}
+
+uno::Sequence< rtl::OUString >
+SwVbaWrapFormat::getServiceNames()
+{
+ static uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.WrapFormat" ) );
+ }
+ return aServiceNames;
+}
+
+namespace wrapformat
+{
+namespace sdecl = comphelper::service_decl;
+sdecl::vba_service_class_<SwVbaWrapFormat, sdecl::with_args<true> > serviceImpl;
+extern sdecl::ServiceDecl const serviceDecl(
+ serviceImpl,
+ "SwVbaWrapFormat",
+ "ooo.vba.word.WrapFormat" );
+}
+
+
diff --git a/sw/source/ui/vba/vbawrapformat.hxx b/sw/source/ui/vba/vbawrapformat.hxx
new file mode 100644
index 000000000000..71520d78aaae
--- /dev/null
+++ b/sw/source/ui/vba/vbawrapformat.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_VBA_XWRAPFORMAT_HXX
+#define SW_VBA_XWRAPFORMAT_HXX
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <ooo/vba/word/XWrapFormat.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+
+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XWrapFormat > SwVbaWrapFormat_BASE;
+
+class SwVbaWrapFormat : public SwVbaWrapFormat_BASE
+{
+private:
+ css::uno::Reference< css::drawing::XShape > m_xShape;
+ css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
+ sal_Int32 mnWrapFormatType;
+ sal_Int32 mnSide;
+
+private:
+ void makeWrap() throw (css::uno::RuntimeException);
+ float getDistance( const rtl::OUString& sName ) throw (css::uno::RuntimeException);
+ void setDistance( const rtl::OUString& sName, float _distance ) throw (css::uno::RuntimeException);
+
+public:
+ SwVbaWrapFormat( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext );
+
+ virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setType( ::sal_Int32 _type ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getSide() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSide( ::sal_Int32 _side ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL getDistanceTop() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDistanceTop( float _distancetop ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL getDistanceBottom() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDistanceBottom( float _distancebottom ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL getDistanceLeft() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDistanceLeft( float _distanceleft ) throw (css::uno::RuntimeException);
+ virtual float SAL_CALL getDistanceRight() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDistanceRight( float _distanceright ) throw (css::uno::RuntimeException);
+
+ virtual rtl::OUString& getServiceImplName();
+ virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+};
+
+#endif//SW_VBA_XWRAPFORMAT_HXX
diff --git a/sw/source/ui/vba/wordvbahelper.cxx b/sw/source/ui/vba/wordvbahelper.cxx
new file mode 100644
index 000000000000..82dfacf4f18d
--- /dev/null
+++ b/sw/source/ui/vba/wordvbahelper.cxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include <docsh.hxx>
+#include "wordvbahelper.hxx"
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <unotxdoc.hxx>
+#include <doc.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::ooo::vba;
+
+#define FIRST_PAGE 1;
+
+namespace ooo
+{
+namespace vba
+{
+namespace word
+{
+
+SwDocShell* getDocShell( const uno::Reference< frame::XModel>& xModel )
+{
+ uno::Reference< lang::XUnoTunnel > xTunnel( xModel, uno::UNO_QUERY_THROW );
+ SwXTextDocument* pXDoc = reinterpret_cast< SwXTextDocument * >( sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextDocument::getUnoTunnelId())));
+ return pXDoc ? pXDoc->GetDocShell() : 0;
+}
+
+SwView* getView( const uno::Reference< frame::XModel>& xModel )
+{
+ SwDocShell* pDocShell = getDocShell( xModel );
+ return pDocShell? pDocShell->GetView() : 0;
+}
+
+uno::Reference< text::XTextViewCursor > getXTextViewCursor( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
+{
+ uno::Reference< frame::XController > xController = xModel->getCurrentController();
+ uno::Reference< text::XTextViewCursorSupplier > xTextViewCursorSupp( xController, uno::UNO_QUERY_THROW );
+ uno::Reference< text::XTextViewCursor > xTextViewCursor = xTextViewCursorSupp->getViewCursor();
+ return xTextViewCursor;
+}
+
+uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
+{
+ uno::Reference< beans::XPropertySet > xCursorProps( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW );
+ rtl::OUString aPageStyleName;
+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName;
+ uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW );
+ uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XNameAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< style::XStyle > xStyle( xPageStyles->getByName( aPageStyleName ), uno::UNO_QUERY_THROW );
+
+ return xStyle;
+}
+
+sal_Int32 getPageCount( const uno::Reference< frame::XModel>& xModel ) throw (uno::RuntimeException)
+{
+ SwDocShell* pDocShell = getDocShell( xModel );
+ return pDocShell ? pDocShell->GetDoc()->GetPageCount() : 0;
+}
+
+} // word
+} //
+} //
diff --git a/sw/source/ui/vba/wordvbahelper.hxx b/sw/source/ui/vba/wordvbahelper.hxx
new file mode 100644
index 000000000000..0629d613a724
--- /dev/null
+++ b/sw/source/ui/vba/wordvbahelper.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_WORD_VBA_HELPER_HXX
+#define SW_WORD_VBA_HELPER_HXX
+
+#include <vbahelper/vbahelper.hxx>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextViewCursor.hpp>
+#include <com/sun/star/text/XPageCursor.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+
+class SwDocShell;
+class SwView;
+namespace ooo
+{
+ namespace vba
+ {
+ namespace word
+ {
+ //css::uno::Reference< css::frame::XModel > getCurrentDocument() throw (css::uno::RuntimeException);
+ SwDocShell* getDocShell( const css::uno::Reference< css::frame::XModel>& xModel );
+ SwView* getView( const css::uno::Reference< css::frame::XModel>& xModel );
+ css::uno::Reference< css::text::XTextViewCursor > getXTextViewCursor( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
+ css::uno::Reference< css::style::XStyle > getCurrentPageStyle( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
+ sal_Int32 getPageCount( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException);
+
+} // word
+} // vba
+} // ooo
+#endif
diff --git a/sw/source/ui/web/wdocsh.cxx b/sw/source/ui/web/wdocsh.cxx
new file mode 100644
index 000000000000..4953e715fe45
--- /dev/null
+++ b/sw/source/ui/web/wdocsh.cxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+
+#include <svl/srchitem.hxx>
+#include <sfx2/app.hxx>
+#ifndef _SVX_SVXIDS_HRC //autogen
+#include <svx/svxids.hrc>
+#endif
+
+#include <sot/clsids.hxx>
+#include <sfx2/objface.hxx>
+
+#include <sfx2/msg.hxx>
+#include "cfgid.h"
+#include "cmdid.h"
+#include "swtypes.hxx"
+
+#include "shellio.hxx"
+// nur wegen des Itemtypes
+#include "wdocsh.hxx"
+#include "web.hrc"
+
+#define SwWebDocShell
+#include "swslots.hxx"
+
+#include <unomid.h>
+
+
+SFX_IMPL_INTERFACE( SwWebDocShell, SfxObjectShell, SW_RES(0) )
+{
+}
+
+TYPEINIT1(SwWebDocShell, SwDocShell);
+
+SFX_IMPL_OBJECTFACTORY(SwWebDocShell, SvGlobalName(SO3_SWWEB_CLASSID), SFXOBJECTSHELL_STD_NORMAL|SFXOBJECTSHELL_HASMENU, "swriter/web" )
+
+/*-----------------22.01.97 09.29-------------------
+
+--------------------------------------------------*/
+
+SwWebDocShell::SwWebDocShell(SfxObjectCreateMode eMode ) :
+ SwDocShell(eMode),
+ nSourcePara(0)
+{
+}
+
+/*-----------------22.01.97 09.29-------------------
+
+--------------------------------------------------*/
+
+SwWebDocShell::~SwWebDocShell()
+{
+}
+
+
+
+void SwWebDocShell::FillClass( SvGlobalName * pClassName,
+ sal_uInt32 * pClipFormat,
+ String * /*pAppName*/,
+ String * pLongUserName,
+ String * pUserName,
+ sal_Int32 nVersion,
+ sal_Bool bTemplate /* = sal_False */) const
+{
+ (void)bTemplate;
+ DBG_ASSERT( bTemplate == sal_False, "No template for Writer Web" );
+
+ if (nVersion == SOFFICE_FILEFORMAT_60)
+ {
+ *pClassName = SvGlobalName( SO3_SWWEB_CLASSID_60 );
+ *pClipFormat = SOT_FORMATSTR_ID_STARWRITERWEB_60;
+ *pLongUserName = SW_RESSTR(STR_WRITER_WEBDOC_FULLTYPE);
+ }
+ else if (nVersion == SOFFICE_FILEFORMAT_8)
+ {
+ *pClassName = SvGlobalName( SO3_SWWEB_CLASSID_60 );
+ *pClipFormat = SOT_FORMATSTR_ID_STARWRITERWEB_8;
+ *pLongUserName = SW_RESSTR(STR_WRITER_WEBDOC_FULLTYPE);
+ }
+ *pUserName = SW_RESSTR(STR_HUMAN_SWWEBDOC_NAME);
+}
+
+
+
diff --git a/sw/source/ui/web/web.src b/sw/source/ui/web/web.src
new file mode 100644
index 000000000000..9907982a6bca
--- /dev/null
+++ b/sw/source/ui/web/web.src
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include <svx/svxids.hrc>
+#include "globals.hrc"
+#include "cmdid.h"
+#include "web.hrc"
+#include "helpid.h"
+#include "cfgid.h"
+
+String STR_HUMAN_SWWEBDOC_NAME
+{
+ Text [ en-US ] = "HTML" ;
+};
+String STR_WRITER_WEBDOC_FULLTYPE_40
+{
+ Text [ en-US ] = "%PRODUCTNAME 4.0 HTML" ;
+};
+String STR_WRITER_WEBDOC_FULLTYPE_50
+{
+ Text [ en-US ] = "%PRODUCTNAME 5.0 HTML" ;
+};
+String STR_WRITER_WEBDOC_FULLTYPE
+{
+ Text [ en-US ] = "%PRODUCTNAME %PRODUCTVERSION HTML Document";
+};
+String STR_SHELLNAME_WEBTEXT
+{
+ Text [ en-US ] = "Text/Web" ;
+};
+String STR_SHELLNAME_WEBFRAME
+{
+ Text [ en-US ] = "Frame/Web" ;
+};
+String RID_WEBTOOLS_TOOLBOX
+{
+ Text [ en-US ] = "Main Toolbar/Web" ;
+};
+/*************************************************************************
+ Textleiste
+*************************************************************************/
+String RID_WEBTEXT_TOOLBOX
+{
+ Text [ en-US ] = "Text Object Bar/Web" ;
+};
+String RID_WEBFRAME_TOOLBOX
+{
+ Text [ en-US ] = "Frame Object Bar/Web" ;
+};
+String RID_WEBGRAPHIC_TOOLBOX
+{
+ Text [ en-US ] = "Graphics Object Bar/Web" ;
+};
+String RID_WEBOLE_TOOLBOX
+{
+ Text [ en-US ] = "Object/Web" ;
+};
+
+
diff --git a/sw/source/ui/web/wformsh.cxx b/sw/source/ui/web/wformsh.cxx
new file mode 100644
index 000000000000..0ce34812216f
--- /dev/null
+++ b/sw/source/ui/web/wformsh.cxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include <sfx2/msg.hxx>
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+#include <svl/srchitem.hxx>
+#include <sfx2/objface.hxx>
+#include <tools/globname.hxx>
+#include <sfx2/app.hxx>
+
+#include "swtypes.hxx"
+#include "cmdid.h"
+#include "wformsh.hxx"
+#include "globals.hrc"
+#include "web.hrc"
+#include "popup.hrc"
+#include "shells.hrc"
+
+#define SwWebDrawFormShell
+#include "swslots.hxx"
+
+SFX_IMPL_INTERFACE(SwWebDrawFormShell, SwDrawFormShell, SW_RES(0))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_DRAWFORM_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TEXT_TOOLBOX));
+}
+
+TYPEINIT1(SwWebDrawFormShell, SwDrawFormShell)
+
+SwWebDrawFormShell::SwWebDrawFormShell(SwView& rVw) :
+ SwDrawFormShell(rVw)
+{
+}
+
+__EXPORT SwWebDrawFormShell::~SwWebDrawFormShell()
+{
+}
+
+
diff --git a/sw/source/ui/web/wfrmsh.cxx b/sw/source/ui/web/wfrmsh.cxx
new file mode 100644
index 000000000000..df391080d467
--- /dev/null
+++ b/sw/source/ui/web/wfrmsh.cxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include "hintids.hxx"
+#include <sfx2/app.hxx>
+#include <sfx2/objface.hxx>
+#include <svl/srchitem.hxx> //***
+
+#include "swtypes.hxx"
+#include "cmdid.h"
+#include "view.hxx"
+#include "wfrmsh.hxx"
+#include "globals.hrc"
+#include "popup.hrc"
+#include "shells.hrc"
+#include "web.hrc"
+
+
+// STATIC DATA -----------------------------------------------------------
+#define SwWebFrameShell
+#include <sfx2/msg.hxx>
+#include "swslots.hxx"
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SFX_IMPL_INTERFACE(SwWebFrameShell, SwFrameShell, SW_RES(STR_SHELLNAME_WEBFRAME))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_FRM_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_WEBFRAME_TOOLBOX));
+}
+
+
+
+TYPEINIT1(SwWebFrameShell, SwFrameShell)
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+SwWebFrameShell::SwWebFrameShell(SwView &_rView) :
+ SwFrameShell(_rView)
+{
+ SetHelpId(SW_WEBFRAMESHELL);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+
+SwWebFrameShell::~SwWebFrameShell()
+{
+}
+
+
+
+
+
+
+
diff --git a/sw/source/ui/web/wgrfsh.cxx b/sw/source/ui/web/wgrfsh.cxx
new file mode 100644
index 000000000000..a8c85f5b0627
--- /dev/null
+++ b/sw/source/ui/web/wgrfsh.cxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/msg.hxx>
+#include <svl/srchitem.hxx>
+#include <sfx2/app.hxx>
+
+#include <sfx2/objface.hxx>
+
+#include "cmdid.h"
+#include "view.hxx"
+#include "wrtsh.hxx"
+#include "swmodule.hxx"
+#include "uitool.hxx"
+#include "docsh.hxx"
+#include "shells.hrc"
+#include "popup.hrc"
+#include "globals.hrc"
+#include "web.hrc"
+#include "wgrfsh.hxx"
+
+#define SwWebGrfShell
+#include "swslots.hxx"
+
+SFX_IMPL_INTERFACE(SwWebGrfShell, SwGrfShell, SW_RES(STR_SHELLNAME_GRAPHIC))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_GRF_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_WEBGRAPHIC_TOOLBOX));
+}
+
+TYPEINIT1(SwWebGrfShell,SwGrfShell)
+
+SwWebGrfShell::SwWebGrfShell(SwView &_rView) :
+ SwGrfShell(_rView)
+
+{
+ SetName(String::CreateFromAscii("Graphic"));
+ SetHelpId(SW_GRFSHELL);
+}
+
+SwWebGrfShell::~SwWebGrfShell()
+{
+}
+
+
+
diff --git a/sw/source/ui/web/wlistsh.cxx b/sw/source/ui/web/wlistsh.cxx
new file mode 100644
index 000000000000..3c2c578ea628
--- /dev/null
+++ b/sw/source/ui/web/wlistsh.cxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/msg.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objface.hxx>
+#include <svl/srchitem.hxx>
+#include <svx/imapdlg.hxx>
+
+#include "cmdid.h"
+#include "wrtsh.hxx"
+#include "swmodule.hxx"
+#include "globals.hrc"
+#include "shells.hrc"
+#include "uinums.hxx"
+#include "wlistsh.hxx"
+
+#define SwWebListShell
+#include "swslots.hxx"
+
+SFX_IMPL_INTERFACE(SwWebListShell, SwListShell, SW_RES(STR_SHELLNAME_LIST))
+{
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_NUM_TOOLBOX));
+}
+
+TYPEINIT1(SwWebListShell,SwListShell)
+
+SwWebListShell::SwWebListShell(SwView &_rView) :
+ SwListShell(_rView)
+{
+ SetName(String::CreateFromAscii("List"));
+ SetHelpId(SW_LISTSHELL);
+}
+
+__EXPORT SwWebListShell::~SwWebListShell()
+{
+}
+
+
diff --git a/sw/source/ui/web/wolesh.cxx b/sw/source/ui/web/wolesh.cxx
new file mode 100644
index 000000000000..db23229adb36
--- /dev/null
+++ b/sw/source/ui/web/wolesh.cxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/msg.hxx>
+#include <sfx2/app.hxx>
+#include <sfx2/objface.hxx>
+#include <svl/srchitem.hxx>
+
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "helpid.h"
+#include "globals.hrc"
+#include "web.hrc"
+#include "popup.hrc"
+#include "shells.hrc"
+#include "wolesh.hxx"
+#include "cmdid.h"
+
+#define SwWebOleShell
+#include "swslots.hxx"
+
+SFX_IMPL_INTERFACE(SwWebOleShell, SwOleShell, SW_RES(STR_SHELLNAME_OBJECT))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_OLE_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_WEBOLE_TOOLBOX));
+}
+
+SwWebOleShell::SwWebOleShell(SwView &_rView) :
+ SwOleShell(_rView)
+
+{
+ SetName(String::CreateFromAscii("Object"));
+ SetHelpId(SW_OLESHELL);
+}
+
+__EXPORT SwWebOleShell::~SwWebOleShell()
+{
+}
+
+
diff --git a/sw/source/ui/web/wtabsh.cxx b/sw/source/ui/web/wtabsh.cxx
new file mode 100644
index 000000000000..ebf8d18a5dd7
--- /dev/null
+++ b/sw/source/ui/web/wtabsh.cxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include "hintids.hxx"
+#include <sfx2/app.hxx>
+#include <tools/globname.hxx>
+#include <sfx2/objface.hxx>
+#include <svl/srchitem.hxx>
+
+
+#include "cmdid.h"
+#include "globals.hrc"
+#include "uitool.hxx"
+#include "helpid.h"
+#include "popup.hrc"
+#include "shells.hrc"
+#include "table.hrc"
+#include "wrtsh.hxx"
+#include "wtabsh.hxx"
+
+#define SwWebTableShell
+#include <sfx2/msg.hxx>
+#include "svx/svxids.hrc"
+#include "swslots.hxx"
+
+SFX_IMPL_INTERFACE(SwWebTableShell, SwTableShell, SW_RES(STR_SHELLNAME_TABLE))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_TAB_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TABLE_TOOLBOX));
+}
+
+TYPEINIT1(SwWebTableShell,SwTableShell)
+
+SwWebTableShell::SwWebTableShell(SwView &_rView) :
+ SwTableShell(_rView)
+{
+ GetShell().UpdateTable();
+ SetName(String::CreateFromAscii("Table"));
+ SetHelpId(SW_TABSHELL);
+}
+
+__EXPORT SwWebTableShell::~SwWebTableShell()
+{
+}
+
+
+
diff --git a/sw/source/ui/web/wtextsh.cxx b/sw/source/ui/web/wtextsh.cxx
new file mode 100644
index 000000000000..6a77edb155b8
--- /dev/null
+++ b/sw/source/ui/web/wtextsh.cxx
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#include "hintids.hxx"
+#include <sfx2/objface.hxx>
+#include <sfx2/app.hxx>
+#include <svl/srchitem.hxx> //***
+#include <basic/sbxvar.hxx>
+#ifndef _SVX_SVXIDS_HRC //autogen
+#include <svx/svxids.hrc>
+#endif
+
+#include "swtypes.hxx"
+#include "cmdid.h"
+#include "view.hxx"
+#include "wtextsh.hxx"
+#include "basesh.hxx"
+#include "globals.hrc"
+#include "popup.hrc"
+#include "shells.hrc"
+#include "web.hrc"
+
+#include <unomid.h>
+
+
+// STATIC DATA -----------------------------------------------------------
+#define SwWebTextShell
+#define Paragraph
+#define HyphenZone
+#define TextFont
+#define DropCap
+#include <sfx2/msg.hxx>
+#include "swslots.hxx"
+
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SFX_IMPL_INTERFACE(SwWebTextShell, SwBaseShell, SW_RES(STR_SHELLNAME_WEBTEXT))
+{
+ SFX_POPUPMENU_REGISTRATION(SW_RES(MN_TEXT_POPUPMENU));
+ SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TEXT_TOOLBOX));
+ SFX_CHILDWINDOW_REGISTRATION(FN_EDIT_FORMULA);
+ SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_FIELD);
+}
+
+TYPEINIT1(SwWebTextShell, SwTextShell)
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+SwWebTextShell::SwWebTextShell(SwView &_rView) :
+ SwTextShell(_rView)
+{
+ SetHelpId(SW_WEBTEXTSHELL);
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+
+
+SwWebTextShell::~SwWebTextShell()
+{
+}
+
+
+
diff --git a/sw/source/ui/web/wview.cxx b/sw/source/ui/web/wview.cxx
new file mode 100644
index 000000000000..d1e7fe672a38
--- /dev/null
+++ b/sw/source/ui/web/wview.cxx
@@ -0,0 +1,336 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/msg.hxx>
+#include <svl/srchitem.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/templdlg.hxx>
+#include <svx/srchdlg.hxx>
+#include <basic/sbxobj.hxx>
+#include <uivwimp.hxx>
+#include <svx/fmshell.hxx>
+#include <svx/extrusionbar.hxx>
+#include <svx/fontworkbar.hxx>
+
+#include <sfx2/objface.hxx>
+#include <swmodule.hxx>
+#include <unotxvw.hxx>
+#include <swtypes.hxx>
+#include <cmdid.h>
+#include <globals.hrc>
+#include <wrtsh.hxx>
+#include <edtwin.hxx>
+#include <wgrfsh.hxx>
+#include <wfrmsh.hxx>
+#include <wolesh.hxx>
+#include <wtabsh.hxx>
+#include <wlistsh.hxx>
+#include <wformsh.hxx>
+#include <wtextsh.hxx>
+#include <barcfg.hxx>
+#include <doc.hxx>
+
+// EIGENTLICH nicht moeglich !!
+#include <beziersh.hxx>
+#include <drawsh.hxx>
+#include <drwtxtsh.hxx>
+#include <annotsh.hxx>
+
+#include <wview.hxx>
+#include <wdocsh.hxx>
+#include <web.hrc>
+#include <shells.hrc>
+
+#define SwWebView
+#define SearchAttributes
+#define ReplaceAttributes
+#define SearchSettings
+#define _ExecSearch ExecSearch
+#define _StateSearch StateSearch
+#define Frames
+#define Graphics
+#define OLEObjects
+#define Controls
+#define Text
+#define Frame
+#define Graphic
+#define Object
+#define Draw
+#define DrawText
+#define TextInTable
+#define ListInText
+#define ListInTable
+#define Page
+#include <svx/svxslots.hxx>
+#include <swslots.hxx>
+
+
+SFX_IMPL_NAMED_VIEWFACTORY(SwWebView, "Default")
+{
+ SFX_VIEW_REGISTRATION(SwWebDocShell);
+}
+
+SFX_IMPL_INTERFACE( SwWebView, SwView, SW_RES(RID_WEBTOOLS_TOOLBOX) )
+{
+ SFX_CHILDWINDOW_REGISTRATION(SfxTemplateDialogWrapper::GetChildWindowId());
+ SFX_CHILDWINDOW_REGISTRATION(SvxSearchDialogWrapper::GetChildWindowId());
+ SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_TOOLS|
+ SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_SERVER,
+ SW_RES(RID_WEBTOOLS_TOOLBOX) );
+}
+
+TYPEINIT1(SwWebView,SwView)
+
+/*-----------------22.01.97 14.27-------------------
+
+--------------------------------------------------*/
+
+
+SwWebView::SwWebView(SfxViewFrame* _pFrame, SfxViewShell* _pShell) :
+ SwView(_pFrame, _pShell)
+{
+}
+
+/*-----------------22.01.97 14.27-------------------
+
+--------------------------------------------------*/
+
+
+SwWebView::~SwWebView()
+{
+}
+
+/*-----------------23.01.97 09.01-------------------
+
+--------------------------------------------------*/
+
+
+void SwWebView::SelectShell()
+{
+ // Entscheidung, ob UpdateTable gerufen werden muss
+ BOOL bUpdateTable = FALSE;
+ const SwFrmFmt* pCurTableFmt = GetWrtShell().GetTableFmt();
+ if(pCurTableFmt && pCurTableFmt != GetLastTblFrmFmt())
+ {
+ bUpdateTable = TRUE; // kann erst spaeter ausgefuehrt werden
+ }
+ SetLastTblFrmFmt(pCurTableFmt);
+ //SEL_TBL und SEL_TBL_CELLS koennen verodert sein!
+ int nNewSelectionType = (GetWrtShell().GetSelectionType()
+ & ~nsSelectionType::SEL_TBL_CELLS);
+
+ int _nSelectionType = GetSelectionType();
+ if ( nNewSelectionType == _nSelectionType )
+ {
+ GetViewFrame()->GetBindings().InvalidateAll( FALSE );
+ if ( _nSelectionType & nsSelectionType::SEL_OLE ||
+ _nSelectionType & nsSelectionType::SEL_GRF )
+ //Fuer Grafiken und OLE kann sich natuerlich das Verb aendern!
+ ImpSetVerb( nNewSelectionType );
+ }
+ else
+ {
+
+ // DELETEZ(pxSelectionObj); //Selektionsobjekt loeschen
+ SfxDispatcher &rDispatcher = *GetViewFrame()->GetDispatcher();
+ SwToolbarConfigItem *pBarCfg = SW_MOD()->GetWebToolbarConfig();
+
+ if( GetCurShell() )
+ {
+ rDispatcher.Flush(); // alle gecachten Shells wirklich loeschen
+
+ //Zur alten Selektion merken welche Toolbar sichtbar war
+ sal_Int32 nId = rDispatcher.GetObjectBarId( SFX_OBJECTBAR_OBJECT );
+ if ( nId )
+ pBarCfg->SetTopToolbar( _nSelectionType, nId );
+
+ SfxShell *pSfxShell;
+ USHORT i;
+ for ( i = 0; TRUE; ++i )
+ {
+ pSfxShell = rDispatcher.GetShell( i );
+ if ( !( pSfxShell->ISA( SwBaseShell ) ||
+ pSfxShell->ISA( SwDrawTextShell ) || pSfxShell->ISA( SwAnnotationShell ) ) )
+ break;
+ }
+ pSfxShell = rDispatcher.GetShell( --i );
+ ASSERT( pSfxShell, "My Shell ist lost in space" );
+ rDispatcher.Pop( *pSfxShell, SFX_SHELL_POP_UNTIL | SFX_SHELL_POP_DELETE);
+ }
+
+ BOOL bInitFormShell = FALSE;
+ if( !GetFormShell() )
+ {
+ bInitFormShell = TRUE;
+ SetFormShell( new FmFormShell( this ) );
+ rDispatcher.Push( *GetFormShell() );
+ }
+
+ BOOL bSetExtInpCntxt = FALSE;
+ _nSelectionType = nNewSelectionType;
+ SetSelectionType( _nSelectionType );
+ ShellModes eShellMode;
+
+ if ( _nSelectionType & nsSelectionType::SEL_OLE )
+ {
+ eShellMode = SHELL_MODE_OBJECT;
+ SetShell( new SwWebOleShell( *this ));
+ rDispatcher.Push( *GetCurShell() );
+ }
+ else if ( _nSelectionType & nsSelectionType::SEL_FRM
+ || _nSelectionType & nsSelectionType::SEL_GRF)
+ {
+ eShellMode = SHELL_MODE_FRAME;
+ SetShell( new SwWebFrameShell( *this ));
+ rDispatcher.Push( *GetCurShell() );
+ if(_nSelectionType & nsSelectionType::SEL_GRF )
+ {
+ eShellMode = SHELL_MODE_GRAPHIC;
+ SetShell( new SwWebGrfShell( *this ));
+ rDispatcher.Push( *GetCurShell() );
+ }
+ }
+ else if ( _nSelectionType & nsSelectionType::SEL_FRM )
+ {
+ eShellMode = SHELL_MODE_FRAME;
+ SetShell( new SwWebFrameShell( *this ));
+ rDispatcher.Push( *GetCurShell() );
+ }
+ else if ( _nSelectionType & nsSelectionType::SEL_DRW )
+ {
+ eShellMode = SHELL_MODE_DRAW;
+ SetShell( new svx::ExtrusionBar( this ) );
+ rDispatcher.Push( *GetCurShell() );
+
+ eShellMode = SHELL_MODE_DRAW;
+ SetShell( new svx::FontworkBar( this ) );
+ rDispatcher.Push( *GetCurShell() );
+
+ SetShell( new SwDrawShell( *this ));
+ rDispatcher.Push( *GetCurShell() );
+ if ( _nSelectionType & nsSelectionType::SEL_BEZ )
+ {
+ eShellMode = SHELL_MODE_BEZIER;
+ SetShell( new SwBezierShell( *this ));
+ rDispatcher.Push( *GetCurShell() );
+ }
+
+ }
+ else if ( _nSelectionType & nsSelectionType::SEL_DRW_FORM )
+ {
+ eShellMode = SHELL_MODE_DRAW_FORM;
+ SetShell( new SwWebDrawFormShell( *this ));
+
+ rDispatcher.Push( *GetCurShell() );
+ }
+ else if ( _nSelectionType & nsSelectionType::SEL_DRW_TXT )
+ {
+ eShellMode = SHELL_MODE_DRAWTEXT;
+ rDispatcher.Push( *(new SwBaseShell( *this )) );
+ SetShell( new SwDrawTextShell( *this ));
+ rDispatcher.Push( *GetCurShell() );
+ }
+ else if ( _nSelectionType & nsSelectionType::SEL_POSTIT )
+ {
+ eShellMode = SHELL_MODE_POSTIT;
+ SetShell( new SwAnnotationShell( *this ) );
+ rDispatcher.Push( *GetCurShell() );
+ }
+ else
+ {
+ bSetExtInpCntxt = TRUE;
+ eShellMode = SHELL_MODE_TEXT;
+ if ( _nSelectionType & nsSelectionType::SEL_NUM )
+ {
+ eShellMode = SHELL_MODE_LIST_TEXT;
+ SetShell( new SwWebListShell( *this ));
+ rDispatcher.Push( *GetCurShell() );
+ }
+ SetShell( new SwWebTextShell(*this));
+ rDispatcher.Push( *GetCurShell() );
+ if ( _nSelectionType & nsSelectionType::SEL_TBL )
+ {
+ eShellMode = eShellMode == SHELL_MODE_LIST_TEXT ? SHELL_MODE_TABLE_LIST_TEXT
+ : SHELL_MODE_TABLE_TEXT;
+ SetShell( new SwWebTableShell( *this ));
+ rDispatcher.Push( *GetCurShell() );
+ }
+ }
+ ImpSetVerb( _nSelectionType );
+ GetViewImpl()->SetShellMode(eShellMode);
+
+ if( !GetDocShell()->IsReadOnly() )
+ {
+ if( bSetExtInpCntxt && GetWrtShell().HasReadonlySel() )
+ bSetExtInpCntxt = FALSE;
+
+ InputContext aCntxt( GetEditWin().GetInputContext() );
+ aCntxt.SetOptions( bSetExtInpCntxt
+ ? (aCntxt.GetOptions() |
+ ( INPUTCONTEXT_TEXT |
+ INPUTCONTEXT_EXTTEXTINPUT ))
+ : (aCntxt.GetOptions() & ~
+ ( INPUTCONTEXT_TEXT |
+ INPUTCONTEXT_EXTTEXTINPUT )) );
+ GetEditWin().SetInputContext( aCntxt );
+ }
+
+ //Zur neuen Selektion die Toolbar aktivieren, die auch beim letzten Mal
+ //aktiviert war
+ //Vorher muss ein Flush() sein, betrifft aber lt. MBA nicht das UI und ist
+ //kein Performance-Problem
+ // TODO/LATER: maybe now the Flush() command is superfluous?!
+ rDispatcher.Flush();
+
+ Point aPnt = GetEditWin().GetPointerPosPixel();
+ aPnt = GetEditWin().PixelToLogic(aPnt);
+ GetEditWin().UpdatePointer(aPnt);
+
+ if ( bInitFormShell && GetWrtShell().GetDrawView() )
+ GetFormShell()->SetView( PTR_CAST( FmFormView,
+ GetWrtShell().GetDrawView()));
+
+
+ }
+ GetViewImpl()->GetUNOObject_Impl()->NotifySelChanged();
+
+ //Guenstiger Zeitpunkt fuer die Kommunikation mit OLE-Objekten?
+ if ( GetDocShell()->GetDoc()->IsOLEPrtNotifyPending() )
+ GetDocShell()->GetDoc()->PrtOLENotify( FALSE );
+
+ //jetzt das Tabellen-Update
+ if(bUpdateTable)
+ GetWrtShell().UpdateTable();
+}
+
+
+
+
diff --git a/sw/source/ui/wrtsh/delete.cxx b/sw/source/ui/wrtsh/delete.cxx
new file mode 100644
index 000000000000..182fb5e37854
--- /dev/null
+++ b/sw/source/ui/wrtsh/delete.cxx
@@ -0,0 +1,570 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <wrtsh.hxx>
+#include <crsskip.hxx>
+#include <swcrsr.hxx>
+#include <editeng/lrspitem.hxx> // #i23725#
+// --> OD 2006-07-10 #134369#
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#ifndef _DRAWBASE_HXX
+#include <drawbase.hxx>
+#endif
+// <--
+
+inline void SwWrtShell::OpenMark()
+{
+ StartAllAction();
+ ResetCursorStack();
+ KillPams();
+ SetMark();
+}
+
+inline void SwWrtShell::CloseMark( BOOL bOkFlag )
+{
+ if( bOkFlag )
+ UpdateAttr();
+ else
+ SwapPam();
+
+ ClearMark();
+ EndAllAction();
+}
+
+// #i23725#
+BOOL SwWrtShell::TryRemoveIndent()
+{
+ BOOL bResult = FALSE;
+
+ SfxItemSet aAttrSet(GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE);
+ GetCurAttr(aAttrSet);
+
+ SvxLRSpaceItem aItem = (const SvxLRSpaceItem &)aAttrSet.Get(RES_LR_SPACE);
+ short aOldFirstLineOfst = aItem.GetTxtFirstLineOfst();
+
+ if (aOldFirstLineOfst > 0)
+ {
+ aItem.SetTxtFirstLineOfst(0);
+ bResult = TRUE;
+ }
+ else if (aOldFirstLineOfst < 0)
+ {
+ aItem.SetTxtFirstLineOfst(0);
+ aItem.SetLeft(aItem.GetLeft() + aOldFirstLineOfst);
+
+ bResult = TRUE;
+ }
+ else if (aItem.GetLeft() != 0)
+ {
+ aItem.SetLeft(0);
+ bResult = TRUE;
+ }
+
+ if (bResult)
+ {
+ aAttrSet.Put(aItem);
+ SetAttr(aAttrSet);
+ }
+
+ return bResult;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Zeile loeschen
+------------------------------------------------------------------------*/
+
+
+
+long SwWrtShell::DelLine()
+{
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ // alten Cursor merken
+ Push();
+ ClearMark();
+ SwCrsrShell::LeftMargin();
+ SetMark();
+ SwCrsrShell::RightMargin();
+//Warum soll hier noch ein Zeichen in der naechsten Zeile geloescht werden?
+// if(!IsEndOfPara())
+// SwCrsrShell::Right();
+ long nRet = Delete();
+ Pop(FALSE);
+ if( nRet )
+ UpdateAttr();
+ return nRet;
+}
+
+
+
+long SwWrtShell::DelToStartOfLine()
+{
+ OpenMark();
+ SwCrsrShell::LeftMargin();
+ long nRet = Delete();
+ CloseMark( 0 != nRet );
+ return nRet;
+}
+
+
+
+long SwWrtShell::DelToEndOfLine()
+{
+ OpenMark();
+ SwCrsrShell::RightMargin();
+ long nRet = Delete();
+ CloseMark( 0 != nRet );
+ return 1;
+}
+
+long SwWrtShell::DelLeft()
+{
+ // wenns denn ein Fly ist, wech damit
+ int nSelType = GetSelectionType();
+ const int nCmp = nsSelectionType::SEL_FRM | nsSelectionType::SEL_GRF | nsSelectionType::SEL_OLE | nsSelectionType::SEL_DRW;
+ if( nCmp & nSelType )
+ {
+ /* #108205# Remember object's position. */
+ Point aTmpPt = GetObjRect().TopLeft();
+
+ DelSelectedObj();
+
+ /* #108205# Set cursor to remembered position. */
+ SetCrsr(&aTmpPt);
+
+ LeaveSelFrmMode();
+ UnSelectFrm();
+
+ nSelType = GetSelectionType();
+ if ( nCmp & nSelType )
+ {
+ EnterSelFrmMode();
+ GotoNextFly();
+ }
+
+ return 1L;
+ }
+
+ // wenn eine Selektion existiert, diese loeschen.
+ if ( IsSelection() )
+ {
+ if( !IsBlockMode() || HasSelection() )
+ {
+ //OS: wieder einmal Basic: ACT_KONTEXT muss vor
+ //EnterStdMode verlassen werden!
+ {
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ Delete();
+ UpdateAttr();
+ }
+ if( IsBlockMode() )
+ {
+ NormalizePam();
+ ClearMark();
+ EnterBlockMode();
+ }
+ else
+ EnterStdMode();
+ return 1L;
+ }
+ else
+ EnterStdMode();
+ }
+
+ // JP 29.06.95: nie eine davor stehende Tabelle loeschen.
+ BOOL bSwap = FALSE;
+ const SwTableNode * pWasInTblNd = SwCrsrShell::IsCrsrInTbl();
+
+ if( SwCrsrShell::IsSttPara())
+ {
+ // --> FME 2007-02-15 #i4032# Don't actually call a 'delete' if we
+ // changed the table cell, compare DelRight().
+ const SwStartNode * pSNdOld = pWasInTblNd ?
+ GetSwCrsr()->GetNode()->FindTableBoxStartNode() :
+ 0;
+ // <--
+
+ /* If the cursor is at the beginning of a paragraph, try to step
+ backwards. On failure we are done. */
+ if( !SwCrsrShell::Left(1,CRSR_SKIP_CHARS) )
+ return 0;
+
+ /* If the cursor entered or left a table (or both) we are done. No step
+ back. */
+ const SwTableNode* pIsInTblNd = SwCrsrShell::IsCrsrInTbl();
+ if( pIsInTblNd != pWasInTblNd )
+ return 0;
+
+ const SwStartNode* pSNdNew = pIsInTblNd ?
+ GetSwCrsr()->GetNode()->FindTableBoxStartNode() :
+ 0;
+
+ // --> FME 2007-02-15 #i4032# Don't actually call a 'delete' if we
+ // changed the table cell, compare DelRight().
+ if ( pSNdOld != pSNdNew )
+ return 0;
+ // <--
+
+ OpenMark();
+ SwCrsrShell::Right(1,CRSR_SKIP_CHARS);
+ SwCrsrShell::SwapPam();
+ bSwap = TRUE;
+ }
+ else
+ {
+ OpenMark();
+ SwCrsrShell::Left(1,CRSR_SKIP_CHARS);
+ }
+ long nRet = Delete();
+ if( !nRet && bSwap )
+ SwCrsrShell::SwapPam();
+ CloseMark( 0 != nRet );
+ return nRet;
+}
+
+long SwWrtShell::DelRight()
+{
+ // werden verodert, wenn Tabellenselektion vorliegt;
+ // wird hier auf nsSelectionType::SEL_TBL umgesetzt.
+ long nRet = 0;
+ int nSelection = GetSelectionType();
+ if(nSelection & nsSelectionType::SEL_TBL_CELLS)
+ nSelection = nsSelectionType::SEL_TBL;
+ if(nSelection & nsSelectionType::SEL_TXT)
+ nSelection = nsSelectionType::SEL_TXT;
+
+ const SwTableNode * pWasInTblNd = NULL;
+
+ switch( nSelection & ~(nsSelectionType::SEL_BEZ) )
+ {
+ case nsSelectionType::SEL_POSTIT:
+ case nsSelectionType::SEL_TXT:
+ case nsSelectionType::SEL_TBL:
+ case nsSelectionType::SEL_NUM:
+ // wenn eine Selektion existiert, diese loeschen.
+ if( IsSelection() )
+ {
+ if( !IsBlockMode() || HasSelection() )
+ {
+ //OS: wieder einmal Basic: ACT_KONTEXT muss vor
+ //EnterStdMode verlassen werden!
+ {
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ Delete();
+ UpdateAttr();
+ }
+ if( IsBlockMode() )
+ {
+ NormalizePam();
+ ClearMark();
+ EnterBlockMode();
+ }
+ else
+ EnterStdMode();
+ nRet = 1L;
+ break;
+ }
+ else
+ EnterStdMode();
+ }
+
+ pWasInTblNd = IsCrsrInTbl();
+
+ if( nsSelectionType::SEL_TXT & nSelection && SwCrsrShell::IsSttPara() &&
+ SwCrsrShell::IsEndPara() )
+ {
+ // save cursor
+ SwCrsrShell::Push();
+
+ bool bDelFull = false;
+ if ( SwCrsrShell::Right(1,CRSR_SKIP_CHARS) )
+ {
+ const SwTableNode * pCurrTblNd = IsCrsrInTbl();
+ bDelFull = pCurrTblNd && pCurrTblNd != pWasInTblNd;
+ }
+
+ // restore cursor
+ SwCrsrShell::Pop( FALSE );
+
+ if( bDelFull )
+ {
+ DelFullPara();
+ UpdateAttr();
+ break;
+ }
+ }
+
+ {
+ /* #108049# Save the startnode of the current cell */
+ const SwStartNode * pSNdOld;
+ pSNdOld = GetSwCrsr()->GetNode()->
+ FindTableBoxStartNode();
+
+ if ( SwCrsrShell::IsEndPara() )
+ {
+ // --> FME 2005-01-28 #i41424# Introduced a couple of
+ // Push()-Pop() pairs here. The reason for this is that a
+ // Right()-Left() combination does not make sure, that
+ // the cursor will be in its initial state, because there
+ // may be a numbering in front of the next paragraph.
+ SwCrsrShell::Push();
+ // <--
+
+ if ( SwCrsrShell::Right(1, CRSR_SKIP_CHARS) )
+ {
+ if (IsCrsrInTbl() || (pWasInTblNd != IsCrsrInTbl()))
+ {
+ /* #108049# Save the startnode of the current
+ cell. May be different to pSNdOld as we have
+ moved. */
+ const SwStartNode * pSNdNew = GetSwCrsr()
+ ->GetNode()->FindTableBoxStartNode();
+
+ /* #108049# Only move instead of deleting if we
+ have moved to a different cell */
+ if (pSNdOld != pSNdNew)
+ {
+ SwCrsrShell::Pop( TRUE );
+ break;
+ }
+ }
+ }
+
+ // restore cursor
+ SwCrsrShell::Pop( FALSE );
+ }
+ }
+
+ OpenMark();
+ SwCrsrShell::Right(1,CRSR_SKIP_CELLS);
+ nRet = Delete();
+ CloseMark( 0 != nRet );
+ break;
+
+ case nsSelectionType::SEL_FRM:
+ case nsSelectionType::SEL_GRF:
+ case nsSelectionType::SEL_OLE:
+ case nsSelectionType::SEL_DRW:
+ case nsSelectionType::SEL_DRW_TXT:
+ case nsSelectionType::SEL_DRW_FORM:
+ {
+ /* #108205# Remember object's position. */
+ Point aTmpPt = GetObjRect().TopLeft();
+
+ DelSelectedObj();
+
+ /* #108205# Set cursor to remembered position. */
+ SetCrsr(&aTmpPt);
+
+ LeaveSelFrmMode();
+ UnSelectFrm();
+ // --> OD 2006-07-06 #134369#
+ ASSERT( !IsFrmSelected(),
+ "<SwWrtShell::DelRight(..)> - <SwWrtShell::UnSelectFrm()> should unmark all objects" )
+ // <--
+ // --> OD 2006-07-10 #134369#
+ // leave draw mode, if necessary.
+ {
+ if (GetView().GetDrawFuncPtr())
+ {
+ GetView().GetDrawFuncPtr()->Deactivate();
+ GetView().SetDrawFuncPtr(NULL);
+ }
+ if ( GetView().IsDrawMode() )
+ {
+ GetView().LeaveDrawCreate();
+ }
+ }
+ // <--
+ }
+
+ // --> OD 2006-07-07 #134369#
+ // <IsFrmSelected()> can't be true - see above.
+ // <--
+ {
+ nSelection = GetSelectionType();
+ if ( nsSelectionType::SEL_FRM & nSelection ||
+ nsSelectionType::SEL_GRF & nSelection ||
+ nsSelectionType::SEL_OLE & nSelection ||
+ nsSelectionType::SEL_DRW & nSelection )
+ {
+ EnterSelFrmMode();
+ GotoNextFly();
+ }
+ }
+ nRet = 1;
+ break;
+ }
+ return nRet;
+}
+
+
+
+long SwWrtShell::DelToEndOfPara()
+{
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ Push();
+ SetMark();
+ if( !MovePara(fnParaCurr,fnParaEnd))
+ {
+ Pop(FALSE);
+ return 0;
+ }
+ long nRet = Delete();
+ Pop(FALSE);
+ if( nRet )
+ UpdateAttr();
+ return nRet;
+}
+
+
+
+long SwWrtShell::DelToStartOfPara()
+{
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ Push();
+ SetMark();
+ if( !MovePara(fnParaCurr,fnParaStart))
+ {
+ Pop(FALSE);
+ return 0;
+ }
+ long nRet = Delete();
+ Pop(FALSE);
+ if( nRet )
+ UpdateAttr();
+ return nRet;
+}
+/*
+ * alle Loeschoperationen sollten mit Find statt mit
+ * Nxt-/PrvDelim arbeiten, da letzteren mit Wrap Around arbeiten
+ * -- das ist wohl nicht gewuenscht.
+ */
+
+
+
+long SwWrtShell::DelToStartOfSentence()
+{
+ if(IsStartOfDoc())
+ return 0;
+ OpenMark();
+ long nRet = _BwdSentence() ? Delete() : 0;
+ CloseMark( 0 != nRet );
+ return nRet;
+}
+
+
+
+long SwWrtShell::DelToEndOfSentence()
+{
+ if(IsEndOfDoc())
+ return 0;
+ OpenMark();
+ long nRet = _FwdSentence() ? Delete() : 0;
+ CloseMark( 0 != nRet );
+ return nRet;
+}
+
+
+
+long SwWrtShell::DelNxtWord()
+{
+ if(IsEndOfDoc())
+ return 0;
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ EnterStdMode();
+ SetMark();
+ if(IsEndWrd() && !IsSttWrd())
+ _NxtWrdForDelete(); // --> OD 2008-08-06 #i92468#
+ if(IsSttWrd() || IsEndPara())
+ _NxtWrdForDelete(); // --> OD 2008-08-06 #i92468#
+ else
+ _EndWrd();
+
+ long nRet = Delete();
+ if( nRet )
+ UpdateAttr();
+ else
+ SwapPam();
+ ClearMark();
+ return nRet;
+}
+
+
+
+long SwWrtShell::DelPrvWord()
+{
+ if(IsStartOfDoc())
+ return 0;
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ EnterStdMode();
+ SetMark();
+ if ( !IsSttWrd() ||
+ !_PrvWrdForDelete() ) // --> OD 2008-08-06 #i92468#
+ {
+ if( IsEndWrd() )
+ {
+ if ( _PrvWrdForDelete() ) // --> OD 2008-08-06 #i92468#
+ {
+ // skip over all-1 spaces
+ short n = -1;
+ while( ' ' == GetChar( FALSE, n ))
+ --n;
+
+ if( ++n )
+ ExtendSelection( FALSE, -n );
+ }
+ }
+ else if( IsSttPara())
+ _PrvWrdForDelete(); // --> OD 2008-08-06 #i92468#
+ else
+ _SttWrd();
+ }
+ long nRet = Delete();
+ if( nRet )
+ UpdateAttr();
+ else
+ SwapPam();
+ ClearMark();
+ return nRet;
+}
+
+
+
+
diff --git a/sw/source/ui/wrtsh/move.cxx b/sw/source/ui/wrtsh/move.cxx
new file mode 100644
index 000000000000..dc196de9d9da
--- /dev/null
+++ b/sw/source/ui/wrtsh/move.cxx
@@ -0,0 +1,691 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <sfx2/bindings.hxx>
+#include <wrtsh.hxx>
+#ifndef _VIEW_HXX
+#include <view.hxx>
+#endif
+#include <viewopt.hxx>
+#include <crsskip.hxx>
+
+/* Immer:
+ - Zuruecksetzen des Cursorstacks
+ - Timer nachtriggern
+ - gfs. GCAttr
+
+ bei Selektion
+ - SttSelect()
+
+ sonst
+ - EndSelect()
+ */
+
+const long nReadOnlyScrollOfst = 10;
+
+class ShellMoveCrsr
+{
+ SwWrtShell* pSh;
+ BOOL bAct;
+public:
+ inline ShellMoveCrsr( SwWrtShell* pWrtSh, BOOL bSel )
+ {
+ bAct = !pWrtSh->ActionPend() && (pWrtSh->GetFrmType(0,FALSE) & FRMTYPE_FLY_ANY);
+ ( pSh = pWrtSh )->MoveCrsr( BOOL(bSel) );
+ pWrtSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_HYPERLINK_GETLINK);
+ }
+ inline ~ShellMoveCrsr()
+ {
+ if( bAct )
+ {
+ //Die Action wird fuer das Scrollen in "einabsaetzigen" Rahmen mit
+ //fester Hoehe gebraucht.
+ pSh->StartAllAction();
+ pSh->EndAllAction();
+ }
+ }
+};
+
+void SwWrtShell::MoveCrsr( BOOL bWithSelect )
+{
+ ResetCursorStack();
+ if ( IsGCAttr() )
+ {
+ GCAttr();
+ ClearGCAttr();
+ }
+ if ( bWithSelect )
+ SttSelect();
+ else
+ {
+ EndSelect();
+ (this->*fnKillSel)( 0, FALSE );
+ }
+}
+
+BOOL SwWrtShell::SimpleMove( FNSimpleMove FnSimpleMove, BOOL bSelect )
+{
+ BOOL nRet;
+ if( bSelect )
+ {
+ SttCrsrMove();
+ MoveCrsr( TRUE );
+ nRet = (this->*FnSimpleMove)();
+ EndCrsrMove();
+ }
+ else if( 0 != ( nRet = (this->*FnSimpleMove)() ) )
+ MoveCrsr( FALSE );
+ return nRet;
+}
+
+
+BOOL SwWrtShell::Left( USHORT nMode, BOOL bSelect,
+ USHORT nCount, BOOL bBasicCall, BOOL bVisual )
+{
+ if ( !bSelect && !bBasicCall && IsCrsrReadonly() && !GetViewOptions()->IsSelectionInReadonly())
+ {
+ Point aTmp( VisArea().Pos() );
+ aTmp.X() -= VisArea().Width() * nReadOnlyScrollOfst / 100;
+ rView.SetVisArea( aTmp );
+ return TRUE;
+ }
+ else
+ {
+ ShellMoveCrsr aTmp( this, bSelect );
+ return SwCrsrShell::Left( nCount, nMode, bVisual );
+ }
+}
+
+
+
+BOOL SwWrtShell::Right( USHORT nMode, BOOL bSelect,
+ USHORT nCount, BOOL bBasicCall, BOOL bVisual )
+{
+ if ( !bSelect && !bBasicCall && IsCrsrReadonly() && !GetViewOptions()->IsSelectionInReadonly() )
+ {
+ Point aTmp( VisArea().Pos() );
+ aTmp.X() += VisArea().Width() * nReadOnlyScrollOfst / 100;
+ aTmp.X() = rView.SetHScrollMax( aTmp.X() );
+ rView.SetVisArea( aTmp );
+ return TRUE;
+ }
+ else
+ {
+ ShellMoveCrsr aTmp( this, bSelect );
+ return SwCrsrShell::Right( nCount, nMode, bVisual );
+ }
+}
+
+
+
+BOOL SwWrtShell::Up( BOOL bSelect, USHORT nCount, BOOL bBasicCall )
+{
+ if ( !bSelect && !bBasicCall && IsCrsrReadonly() && !GetViewOptions()->IsSelectionInReadonly())
+ {
+ Point aTmp( VisArea().Pos() );
+ aTmp.Y() -= VisArea().Height() * nReadOnlyScrollOfst / 100;
+ rView.SetVisArea( aTmp );
+ return TRUE;
+ }
+ else
+ {
+ ShellMoveCrsr aTmp( this, bSelect );
+ return SwCrsrShell::Up( nCount );
+ }
+}
+
+
+
+BOOL SwWrtShell::Down( BOOL bSelect, USHORT nCount, BOOL bBasicCall )
+{
+ if ( !bSelect && !bBasicCall && IsCrsrReadonly() && !GetViewOptions()->IsSelectionInReadonly())
+ {
+ Point aTmp( VisArea().Pos() );
+ aTmp.Y() += VisArea().Height() * nReadOnlyScrollOfst / 100;
+ aTmp.Y() = rView.SetVScrollMax( aTmp.Y() );
+ rView.SetVisArea( aTmp );
+ return TRUE;
+ }
+ else
+ {
+ ShellMoveCrsr aTmp( this, bSelect );
+ return SwCrsrShell::Down( nCount );
+ }
+}
+
+
+
+BOOL SwWrtShell::LeftMargin( BOOL bSelect, BOOL bBasicCall )
+{
+ if ( !bSelect && !bBasicCall && IsCrsrReadonly() )
+ {
+ Point aTmp( VisArea().Pos() );
+ aTmp.X() = DOCUMENTBORDER;
+ rView.SetVisArea( aTmp );
+ return TRUE;
+ }
+ else
+ {
+ ShellMoveCrsr aTmp( this, bSelect );
+ return SwCrsrShell::LeftMargin();
+ }
+}
+
+
+
+BOOL SwWrtShell::RightMargin( BOOL bSelect, BOOL bBasicCall )
+{
+ if ( !bSelect && !bBasicCall && IsCrsrReadonly() )
+ {
+ Point aTmp( VisArea().Pos() );
+ aTmp.X() = GetDocSize().Width() - VisArea().Width() + DOCUMENTBORDER;
+ if( DOCUMENTBORDER > aTmp.X() )
+ aTmp.X() = DOCUMENTBORDER;
+ rView.SetVisArea( aTmp );
+ return TRUE;
+ }
+ else
+ {
+ ShellMoveCrsr aTmp( this, bSelect );
+ return SwCrsrShell::RightMargin(bBasicCall);
+ }
+}
+
+
+
+BOOL SwWrtShell::GoStart( BOOL bKeepArea, BOOL *pMoveTable,
+ BOOL bSelect, BOOL bDontMoveRegion )
+{
+ if ( IsCrsrInTbl() )
+ {
+ const BOOL bBoxSelection = HasBoxSelection();
+ if( !bBlockMode )
+ {
+ if ( !bSelect )
+ EnterStdMode();
+ else
+ SttSelect();
+ }
+ // Tabellenzelle?
+ if ( !bBoxSelection && (MoveSection( fnSectionCurr, fnSectionStart)
+ || bDontMoveRegion))
+ {
+ if ( pMoveTable )
+ *pMoveTable = FALSE;
+ return TRUE;
+ }
+ if( MoveTable( fnTableCurr, fnTableStart ) || bDontMoveRegion )
+ {
+ if ( pMoveTable )
+ *pMoveTable = TRUE;
+ return TRUE;
+ }
+ else if( bBoxSelection && pMoveTable )
+ {
+ // JP 09.01.96: wir haben eine Boxselektion (oder leere Zelle)
+ // und wollen selektieren (pMoveTable wird im
+ // SelAll gesetzt). Dann darf die Tabelle nicht
+ // verlassen werden; sonst ist keine Selektion der
+ // gesamten Tabelle moeglich!
+ *pMoveTable = TRUE;
+ return TRUE;
+ }
+ }
+
+ if( !bBlockMode )
+ {
+ if ( !bSelect )
+ EnterStdMode();
+ else
+ SttSelect();
+ }
+ const USHORT nFrmType = GetFrmType(0,FALSE);
+ if ( FRMTYPE_FLY_ANY & nFrmType )
+ {
+ if( MoveSection( fnSectionCurr, fnSectionStart ) )
+ return TRUE;
+ else if ( FRMTYPE_FLY_FREE & nFrmType || bDontMoveRegion )
+ return FALSE;
+ }
+ if(( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE ) & nFrmType )
+ {
+ if ( MoveSection( fnSectionCurr, fnSectionStart ) )
+ return TRUE;
+ else if ( bKeepArea )
+ return TRUE;
+ }
+ // Bereiche ???
+ return SwCrsrShell::MoveRegion( fnRegionCurrAndSkip, fnRegionStart ) ||
+ SwCrsrShell::SttEndDoc(TRUE);
+}
+
+
+
+BOOL SwWrtShell::GoEnd(BOOL bKeepArea, BOOL *pMoveTable)
+{
+ if ( pMoveTable && *pMoveTable )
+ return MoveTable( fnTableCurr, fnTableEnd );
+
+ if ( IsCrsrInTbl() )
+ {
+ if ( MoveSection( fnSectionCurr, fnSectionEnd ) ||
+ MoveTable( fnTableCurr, fnTableEnd ) )
+ return TRUE;
+ }
+ else
+ {
+ const USHORT nFrmType = GetFrmType(0,FALSE);
+ if ( FRMTYPE_FLY_ANY & nFrmType )
+ {
+ if ( MoveSection( fnSectionCurr, fnSectionEnd ) )
+ return TRUE;
+ else if ( FRMTYPE_FLY_FREE & nFrmType )
+ return FALSE;
+ }
+ if(( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE ) & nFrmType )
+ {
+ if ( MoveSection( fnSectionCurr, fnSectionEnd) )
+ return TRUE;
+ else if ( bKeepArea )
+ return TRUE;
+ }
+ }
+ // Bereiche ???
+ return SwCrsrShell::MoveRegion( fnRegionCurrAndSkip, fnRegionEnd ) ||
+ SwCrsrShell::SttEndDoc(FALSE);
+}
+
+
+
+BOOL SwWrtShell::SttDoc( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return GoStart(FALSE, 0, bSelect );
+}
+
+
+
+BOOL SwWrtShell::EndDoc( BOOL bSelect)
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return GoEnd();
+}
+
+
+BOOL SwWrtShell::SttNxtPg( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePage( fnPageNext, fnPageStart );
+}
+
+
+
+BOOL SwWrtShell::SttPrvPg( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePage( fnPagePrev, fnPageStart );
+}
+
+
+
+BOOL SwWrtShell::EndNxtPg( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePage( fnPageNext, fnPageEnd );
+}
+
+
+
+BOOL SwWrtShell::EndPrvPg( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePage( fnPagePrev, fnPageEnd );
+}
+
+
+
+BOOL SwWrtShell::SttPg( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePage( fnPageCurr, fnPageStart );
+}
+
+
+
+BOOL SwWrtShell::EndPg( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePage( fnPageCurr, fnPageEnd );
+}
+
+
+
+BOOL SwWrtShell::SttPara( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePara( fnParaCurr, fnParaStart );
+}
+
+
+
+BOOL SwWrtShell::EndPara( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return MovePara(fnParaCurr,fnParaEnd);
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: Spaltenweises Springen
+ Parameter: mit oder ohne SSelection
+ Return: Erfolg oder Misserfolg
+------------------------------------------------------------------------*/
+
+
+
+BOOL SwWrtShell::StartOfColumn( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect);
+ return MoveColumn(fnColumnCurr, fnColumnStart);
+}
+
+
+
+BOOL SwWrtShell::EndOfColumn( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect);
+ return MoveColumn(fnColumnCurr, fnColumnEnd);
+}
+
+
+
+BOOL SwWrtShell::StartOfNextColumn( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect);
+ return MoveColumn( fnColumnNext, fnColumnStart);
+}
+
+
+
+BOOL SwWrtShell::EndOfNextColumn( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect);
+ return MoveColumn(fnColumnNext, fnColumnEnd);
+}
+
+
+
+BOOL SwWrtShell::StartOfPrevColumn( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect);
+ return MoveColumn(fnColumnPrev, fnColumnStart);
+}
+
+
+
+BOOL SwWrtShell::EndOfPrevColumn( BOOL bSelect )
+{
+ ShellMoveCrsr aTmp( this, bSelect);
+ return MoveColumn(fnColumnPrev, fnColumnEnd);
+}
+
+
+
+BOOL SwWrtShell::PushCrsr(SwTwips lOffset, BOOL bSelect)
+{
+ BOOL bDiff = FALSE;
+ SwRect aOldRect( GetCharRect() ), aTmpArea( VisArea() );
+
+ //bDestOnStack besagt, ob ich den Cursor nicht an die aktuelle Position
+ //setzen konnte, da in diesem Bereich kein Inhalt vorhanden ist.
+ if( !bDestOnStack )
+ {
+ Point aPt( aOldRect.Center() );
+
+ if( !IsCrsrVisible() )
+ // set CrsrPos to top-/bottom left pos. So the pagescroll is not
+ // be dependent on the current cursor, but on the visarea.
+ aPt.Y() = aTmpArea.Top() + aTmpArea.Height() / 2;
+
+ aPt.Y() += lOffset;
+ aDest = GetCntntPos(aPt,lOffset > 0);
+ aDest.X() = aPt.X();
+ bDestOnStack = TRUE;
+ }
+
+ //falls wir eine Rahmenselektion hatten, muss diese nach dem
+ //fnSetCrsr entfernt werden und damit wir da wieder hinkommen
+ //auf dem Stack gemerkt werden.
+ BOOL bIsFrmSel = FALSE;
+
+ BOOL bIsObjSel = FALSE;
+
+ //Zielposition liegt jetzt innerhalb des sichtbaren Bereiches -->
+ //Cursor an die Zielposition setzen; merken, dass keine Ziel-
+ //position mehr auf dem Stack steht.
+ //Der neue sichtbare Bereich wird zuvor ermittelt.
+ aTmpArea.Pos().Y() += lOffset;
+ if( aTmpArea.IsInside(aDest) )
+ {
+ if( bSelect )
+ SttSelect();
+ else
+ EndSelect();
+
+ bIsFrmSel = IsFrmSelected();
+ bIsObjSel = 0 != IsObjSelected();
+
+ // Rahmenselektion aufheben
+ if( bIsFrmSel || bIsObjSel )
+ {
+ UnSelectFrm();
+ LeaveSelFrmMode();
+ if ( bIsObjSel )
+ {
+ GetView().SetDrawFuncPtr( NULL );
+ GetView().LeaveDrawCreate();
+ }
+
+ CallChgLnk();
+ }
+
+ (this->*fnSetCrsr)( &aDest, TRUE );
+
+ bDiff = aOldRect != GetCharRect();
+
+ if( bIsFrmSel )
+ {
+// CallChgLnk();
+ // bei Frames immer nur die obere Ecke nehmen, damit dieser
+ // wieder selektiert werden kann
+ aOldRect.SSize( 5, 5 );
+ }
+
+ // Zuruecksetzen des Dest. SPoint Flags
+ bDestOnStack = FALSE;
+ }
+
+ // Position auf den Stack; bDiff besagt, ob ein Unterschied zwischen
+ // der alten und der neuen Cursorposition besteht.
+ pCrsrStack = new CrsrStack( bDiff, bIsFrmSel, aOldRect.Center(),
+ lOffset, pCrsrStack );
+ return !bDestOnStack && bDiff;
+}
+
+
+
+BOOL SwWrtShell::PopCrsr(BOOL bUpdate, BOOL bSelect)
+{
+ if( 0 == pCrsrStack)
+ return FALSE;
+
+ const BOOL bValidPos = pCrsrStack->bValidCurPos;
+ if( bUpdate && bValidPos )
+ {
+ // falls ein Vorgaenger auf dem Stack steht, dessen Flag fuer eine
+ // gueltige Position verwenden.
+ SwRect aTmpArea(VisArea());
+ aTmpArea.Pos().Y() -= pCrsrStack->lOffset;
+ if( aTmpArea.IsInside( pCrsrStack->aDocPos ) )
+ {
+ if( bSelect )
+ SttSelect();
+ else
+ EndSelect();
+
+ (this->*fnSetCrsr)(&pCrsrStack->aDocPos, !pCrsrStack->bIsFrmSel);
+ if( pCrsrStack->bIsFrmSel && IsObjSelectable(pCrsrStack->aDocPos))
+ {
+ HideCrsr();
+ SelectObj( pCrsrStack->aDocPos );
+ EnterSelFrmMode( &pCrsrStack->aDocPos );
+ }
+ }
+ // Falls eine Verschiebung zwischen dem sichtbaren Bereich
+ // und der gemerkten Cursorpositionen auftritt, werden
+ // alle gemerkten Positionen weggeschmissen
+ else
+ {
+ _ResetCursorStack();
+ return FALSE;
+ }
+ }
+ CrsrStack *pTmp = pCrsrStack;
+ pCrsrStack = pCrsrStack->pNext;
+ delete pTmp;
+ if( 0 == pCrsrStack )
+ {
+ ePageMove = MV_NO;
+ bDestOnStack = FALSE;
+ }
+ return bValidPos;
+}
+
+/*
+ * Zuruecksetzen aller gepushten Cursorpositionen; dieser werden nicht
+ * zur Anzeige gebracht ( --> Kein Start-/EndAction!!)
+ */
+
+
+
+void SwWrtShell::_ResetCursorStack()
+{
+ CrsrStack *pTmp = pCrsrStack;
+ while(pCrsrStack)
+ {
+ pTmp = pCrsrStack->pNext;
+ delete pCrsrStack;
+ pCrsrStack = pTmp;
+ }
+ ePageMove = MV_NO;
+ bDestOnStack = FALSE;
+}
+/**************
+
+ falls kein Stack existiert --> Selektionen aufheben
+ falls Stack && Richtungswechsel
+ --> Cursor poppen und return
+ sonst
+ --> Cursor pushen
+ Cursor umsetzen
+
+***************/
+
+
+
+BOOL SwWrtShell::PageCrsr(SwTwips lOffset, BOOL bSelect)
+{
+ // nichts tun, wenn ein Offset von 0 angegeben wurde
+ if(!lOffset) return FALSE;
+ // Diente mal dazu, eine Neuformatierung fuer das Layout
+ // zu erzwingen.
+ // Hat so nicht funktioniert, da der Cursor nicht gesetzt
+ // wurde, da dies innerhalb einer Start- / EndActionklammerung
+ // nicht geschieht.
+ // Da am Ende nur ViewShell::EndAction() gerufen wird,
+ // findet auch hier keine Aktualisierung der Anzeige
+ // der Cursorposition statt.
+ // Die CrsrShell- Actionklammerung kann nicht verwendet werden,
+ // da sie immer zu einer Anzeige des Cursors fuehrt, also auch,
+ // wenn nach dem Blaettern in einen Bereich ohne gueltige Position
+ // geblaettert wurde.
+ // ViewShell::StartAction();
+ PageMove eDir = lOffset > 0? MV_PAGE_DOWN: MV_PAGE_UP;
+ // Richtungswechsel und Stack vorhanden
+ if( eDir != ePageMove && ePageMove != MV_NO && PopCrsr( TRUE, bSelect ))
+ return TRUE;
+
+ const BOOL bRet = PushCrsr(lOffset, bSelect);
+ ePageMove = eDir;
+ return bRet;
+}
+
+
+
+BOOL SwWrtShell::GotoPage(USHORT nPage, BOOL bRecord)
+{
+ ShellMoveCrsr aTmp( this, FALSE);
+ if( SwCrsrShell::GotoPage(nPage) && bRecord)
+ {
+ if(IsSelFrmMode())
+ {
+ UnSelectFrm();
+ LeaveSelFrmMode();
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+
+BOOL SwWrtShell::GotoMark( const ::sw::mark::IMark* const pMark, BOOL bSelect, BOOL bStart )
+{
+ ShellMoveCrsr aTmp( this, bSelect );
+ return SwCrsrShell::GotoMark( pMark, bStart );
+}
+
+
+
+BOOL SwWrtShell::SelectTxtAttr( USHORT nWhich, const SwTxtAttr* pAttr )
+{
+ BOOL bRet;
+ {
+ MV_KONTEXT(this);
+ SttSelect();
+ bRet = SwCrsrShell::SelectTxtAttr( nWhich, FALSE, pAttr );
+ }
+ EndSelect();
+ return bRet;
+}
+
+
+
diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx
new file mode 100644
index 000000000000..8deacd017970
--- /dev/null
+++ b/sw/source/ui/wrtsh/select.cxx
@@ -0,0 +1,1072 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <limits.h>
+#include <hintids.hxx>
+#include <sfx2/bindings.hxx>
+#include <svl/eitem.hxx>
+#include <svl/macitem.hxx>
+#include <unotools/charclass.hxx>
+#include <editeng/scripttypeitem.hxx>
+#include <cmdid.h>
+#include <view.hxx>
+#include <basesh.hxx>
+#include <wrtsh.hxx>
+#include <frmatr.hxx>
+#include <initui.hxx>
+#include <mdiexp.hxx>
+#include <fmtcol.hxx>
+#include <frmfmt.hxx>
+#include <swundo.hxx> // fuer Undo-Ids
+#include <swevent.hxx>
+#include <swdtflvr.hxx>
+#include <crsskip.hxx>
+
+#if OSL_DEBUG_LEVEL > 1
+#include <pam.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace util {
+ struct SearchOptions;
+} } } }
+
+using namespace ::com::sun::star::util;
+
+
+static long nStartDragX = 0, nStartDragY = 0;
+static BOOL bStartDrag = FALSE;
+
+void SwWrtShell::Invalidate()
+{
+ // to avoid making the slot volatile, invalidate it everytime if something could have been changed
+ // this is still much cheaper than asking for the state every 200 ms (and avoid background processing)
+ GetView().GetViewFrame()->GetBindings().Invalidate( FN_STAT_SELMODE );
+}
+
+BOOL SwWrtShell::SelNearestWrd()
+{
+ MV_KONTEXT(this);
+ if( !IsInWrd() && !IsEndWrd() && !IsSttWrd() )
+ PrvWrd();
+ if( IsEndWrd() )
+ Left(CRSR_SKIP_CELLS, FALSE, 1, FALSE );
+ return SelWrd();
+}
+
+
+
+BOOL SwWrtShell::SelWrd(const Point *pPt, BOOL )
+{
+ BOOL bRet;
+ {
+ MV_KONTEXT(this);
+ SttSelect();
+ bRet = SwCrsrShell::SelectWord( pPt );
+ }
+ EndSelect();
+ if( bRet )
+ {
+ bSelWrd = TRUE;
+ if(pPt)
+ aStart = *pPt;
+ }
+ return bRet;
+}
+
+void SwWrtShell::SelSentence(const Point *pPt, BOOL )
+{
+ {
+ MV_KONTEXT(this);
+ ClearMark();
+ SwCrsrShell::GoStartSentence();
+ SttSelect();
+ SwCrsrShell::GoEndSentence();
+ }
+ EndSelect();
+ if(pPt)
+ aStart = *pPt;
+ bSelLn = TRUE;
+ bSelWrd = FALSE; // SelWord abschalten, sonst geht kein SelLine weiter
+}
+
+void SwWrtShell::SelPara(const Point *pPt, BOOL )
+{
+ {
+ MV_KONTEXT(this);
+ ClearMark();
+ SwCrsrShell::MovePara( fnParaCurr, fnParaStart );
+ SttSelect();
+ SwCrsrShell::MovePara( fnParaCurr, fnParaEnd );
+ }
+ EndSelect();
+ if(pPt)
+ aStart = *pPt;
+ bSelLn = FALSE;
+ bSelWrd = FALSE; // SelWord abschalten, sonst geht kein SelLine weiter
+}
+
+
+long SwWrtShell::SelAll()
+{
+ const BOOL bLockedView = IsViewLocked();
+ LockView( TRUE );
+ {
+ if(bBlockMode)
+ LeaveBlockMode();
+ MV_KONTEXT(this);
+ BOOL bMoveTable = FALSE;
+ SwPosition *pStartPos = 0;
+ SwPosition *pEndPos = 0;
+ SwShellCrsr* pTmpCrsr = 0;
+ if( !HasWholeTabSelection() )
+ {
+ if ( IsSelection() && IsCrsrPtAtEnd() )
+ SwapPam();
+ pTmpCrsr = getShellCrsr( false );
+ if( pTmpCrsr )
+ {
+ pStartPos = new SwPosition( *pTmpCrsr->GetPoint() );
+ pEndPos = new SwPosition( *pTmpCrsr->GetMark() );
+ }
+ Push();
+ BOOL bIsFullSel = !MoveSection( fnSectionCurr, fnSectionStart);
+ SwapPam();
+ bIsFullSel &= !MoveSection( fnSectionCurr, fnSectionEnd);
+ Pop(FALSE);
+ GoStart(TRUE, &bMoveTable, FALSE, !bIsFullSel);
+ }
+ else
+ {
+ EnterStdMode();
+ SttEndDoc(TRUE);
+ }
+ SttSelect();
+ GoEnd(TRUE, &bMoveTable);
+ if( pStartPos )
+ {
+ pTmpCrsr = getShellCrsr( false );
+ if( pTmpCrsr )
+ {
+ // Some special handling for sections (e.g. TOC) at the beginning of the document body
+ // to avoid the selection of the first section
+ // if the last selection was behind the first section or
+ // if the last selection was already the first section
+ // In this both cases we select to the end of document
+ if( *pTmpCrsr->GetPoint() < *pEndPos ||
+ ( *pStartPos == *pTmpCrsr->GetMark() &&
+ *pEndPos == *pTmpCrsr->GetPoint() ) )
+ SwCrsrShell::SttEndDoc(FALSE);
+ }
+ delete pStartPos;
+ delete pEndPos;
+ }
+ }
+ EndSelect();
+ LockView( bLockedView );
+ return 1;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Textsuche
+------------------------------------------------------------------------*/
+
+
+ULONG SwWrtShell::SearchPattern( const SearchOptions& rSearchOpt, BOOL bSearchInNotes,
+ SwDocPositions eStt, SwDocPositions eEnd,
+ FindRanges eFlags, int bReplace )
+{
+ // keine Erweiterung bestehender Selektionen
+ if(!(eFlags & FND_IN_SEL))
+ ClearMark();
+ BOOL bCancel = FALSE;
+ ULONG nRet = Find( rSearchOpt, bSearchInNotes, eStt, eEnd, bCancel, eFlags, bReplace );
+ if(bCancel)
+ {
+ Undo(1);
+ nRet = ULONG_MAX;
+ }
+ return nRet;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Suche nach Vorlagen
+------------------------------------------------------------------------*/
+
+
+
+ULONG SwWrtShell::SearchTempl( const String &rTempl,
+ SwDocPositions eStt, SwDocPositions eEnd,
+ FindRanges eFlags, const String* pReplTempl )
+{
+ // keine Erweiterung bestehender Selektionen
+ if(!(eFlags & FND_IN_SEL))
+ ClearMark();
+ SwTxtFmtColl *pColl = GetParaStyle(rTempl, SwWrtShell::GETSTYLE_CREATESOME);
+ SwTxtFmtColl *pReplaceColl = 0;
+ if( pReplTempl )
+ pReplaceColl = GetParaStyle(*pReplTempl, SwWrtShell::GETSTYLE_CREATESOME );
+
+ BOOL bCancel = FALSE;
+ ULONG nRet = Find(pColl? *pColl: GetDfltTxtFmtColl(),
+ eStt,eEnd, bCancel, eFlags, pReplaceColl);
+ if(bCancel)
+ {
+ Undo(1);
+ nRet = ULONG_MAX;
+ }
+ return nRet;
+}
+
+// Suche nach Attributen ----------------------------------------------------
+
+
+
+ULONG SwWrtShell::SearchAttr( const SfxItemSet& rFindSet, BOOL bNoColls,
+ SwDocPositions eStart, SwDocPositions eEnde,
+ FindRanges eFlags, const SearchOptions* pSearchOpt,
+ const SfxItemSet* pReplaceSet )
+{
+ // Keine Erweiterung bestehender Selektionen
+ if (!(eFlags & FND_IN_SEL))
+ ClearMark();
+
+ // Suchen
+ BOOL bCancel = FALSE;
+ ULONG nRet = Find( rFindSet, bNoColls, eStart, eEnde, bCancel, eFlags, pSearchOpt, pReplaceSet);
+
+ if(bCancel)
+ {
+ Undo(1);
+ nRet = ULONG_MAX;
+ }
+ return nRet;
+}
+
+// ---------- Selektionsmodi ----------
+
+
+
+void SwWrtShell::PushMode()
+{
+ pModeStack = new ModeStack( pModeStack, bIns, bExtMode, bAddMode, bBlockMode );
+}
+
+
+
+void SwWrtShell::PopMode()
+{
+ if ( 0 == pModeStack )
+ return;
+
+ if ( bExtMode && !pModeStack->bExt )
+ LeaveExtMode();
+ if ( bAddMode && !pModeStack->bAdd )
+ LeaveAddMode();
+ if ( bBlockMode && !pModeStack->bBlock )
+ LeaveBlockMode();
+ bIns = pModeStack->bIns;
+
+ ModeStack *pTmp = pModeStack->pNext;
+ delete pModeStack;
+ pModeStack = pTmp;
+}
+
+/*
+ * Zwei Methoden fuer das Cursorsetzen; die erste mappt auf die
+ * gleichnamige Methoden an der CursorShell, die zweite hebt
+ * zuerst alle Selektionen auf.
+ */
+
+
+
+long SwWrtShell::SetCrsr(const Point *pPt, BOOL bTextOnly)
+{
+ /*
+ * eine gfs. bestehende Selektion an der Position des
+ * Mausklicks aufheben
+ */
+ if(!IsInSelect() && ChgCurrPam(*pPt)) {
+ ClearMark();
+ }
+
+ return SwCrsrShell::SetCrsr(*pPt, bTextOnly);
+}
+
+
+long SwWrtShell::SetCrsrKillSel(const Point *pPt, BOOL bTextOnly )
+{
+ ACT_KONTEXT(this);
+ ResetSelect(pPt,FALSE);
+ return SwCrsrShell::SetCrsr(*pPt, bTextOnly);
+}
+
+
+
+void SwWrtShell::UnSelectFrm()
+{
+ // Rahmenselektion aufheben mit garantiert ungueltiger Position
+ Point aPt(LONG_MIN, LONG_MIN);
+ SelectObj(aPt, 0);
+ SwTransferable::ClearSelection( *this );
+}
+
+/*
+ * Aufheben aller Selektionen
+ */
+
+
+
+long SwWrtShell::ResetSelect(const Point *,BOOL)
+{
+ if(IsSelFrmMode())
+ {
+ UnSelectFrm();
+ LeaveSelFrmMode();
+ }
+ else
+ {
+ /* ACT_KONTEXT() macht eine Action auf -
+ um im Basicablauf keine Probleme mit der
+ Shellumschaltung zu bekommen, darf
+ GetChgLnk().Call() erst nach
+ EndAction() gerufen werden.
+ */
+ {
+ ACT_KONTEXT(this);
+ bSelWrd = bSelLn = FALSE;
+ KillPams();
+ ClearMark();
+ fnKillSel = &SwWrtShell::Ignore;
+ fnSetCrsr = &SwWrtShell::SetCrsr;
+ }
+ /*
+ * nach dem Aufheben aller Selektionen koennte ein Update der
+ * Attr-Controls notwendig sein.
+ */
+ GetChgLnk().Call(this);
+ }
+ Invalidate();
+ SwTransferable::ClearSelection( *this );
+ return 1;
+}
+
+
+
+/*
+ * tue nichts
+ */
+long SwWrtShell::Ignore(const Point *, BOOL ) {
+ return 1;
+}
+
+/*
+ * Start eines Selektionsvorganges.
+ */
+
+
+
+void SwWrtShell::SttSelect()
+{
+ if(bInSelect)
+ return;
+ if(!HasMark())
+ SetMark();
+ if( bBlockMode )
+ {
+ SwShellCrsr* pTmp = getShellCrsr( true );
+ if( !pTmp->HasMark() )
+ pTmp->SetMark();
+ }
+ fnKillSel = &SwWrtShell::Ignore;
+ fnSetCrsr = &SwWrtShell::SetCrsr;
+ bInSelect = TRUE;
+ Invalidate();
+ SwTransferable::CreateSelection( *this );
+}
+/*
+ * Ende eines Selektionsvorganges.
+ */
+
+
+
+void SwWrtShell::EndSelect()
+{
+ if(!bInSelect || bExtMode)
+ return;
+ bInSelect = FALSE;
+ (this->*fnLeaveSelect)(0,FALSE);
+ if(!bAddMode) {
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ fnKillSel = &SwWrtShell::ResetSelect;
+ }
+}
+/* Methode, um eine bestehende wortweise oder zeilenweise Selektion
+ * zu erweitern.
+ */
+
+inline BOOL operator<(const Point &rP1,const Point &rP2)
+{
+ return rP1.Y() < rP2.Y() || (rP1.Y() == rP2.Y() && rP1.X() < rP2.X());
+}
+
+
+
+long SwWrtShell::ExtSelWrd(const Point *pPt, BOOL )
+{
+ MV_KONTEXT(this);
+ if( IsTableMode() )
+ return 1;
+
+ // Bug 66823: actual crsr has in additional mode no selection?
+ // Then destroy the actual an go to prev, this will be expand
+ if( !HasMark() && GoPrevCrsr() )
+ {
+ BOOL bHasMark = HasMark(); // thats wrong!
+ GoNextCrsr();
+ if( bHasMark )
+ {
+ DestroyCrsr();
+ GoPrevCrsr();
+ }
+ }
+
+ // check the direction of the selection with the new point
+ BOOL bRet = FALSE, bMoveCrsr = TRUE, bToTop = FALSE;
+ SwCrsrShell::SelectWord( &aStart ); // select the startword
+ SwCrsrShell::Push(); // save the cursor
+ SwCrsrShell::SetCrsr( *pPt ); // and check the direction
+
+ switch( SwCrsrShell::CompareCursor( StackMkCurrPt ))
+ {
+ case -1: bToTop = FALSE; break;
+ case 1: bToTop = TRUE; break;
+ default: bMoveCrsr = FALSE; break;
+ }
+
+ SwCrsrShell::Pop( FALSE ); // retore the saved cursor
+
+ if( bMoveCrsr )
+ {
+ // select to Top but cursor select to Bottom? or
+ // select to Bottom but cursor select to Top? --> swap the cursor
+ if( bToTop )
+ SwapPam();
+
+ SwCrsrShell::Push(); // save cur cursor
+ if( SwCrsrShell::SelectWord( pPt )) // select the current word
+ {
+ if( bToTop )
+ SwapPam();
+ Combine();
+ bRet = TRUE;
+ }
+ else
+ {
+ SwCrsrShell::Pop( FALSE );
+ if( bToTop )
+ SwapPam();
+ }
+ }
+ else
+ bRet = TRUE;
+ return bRet;
+}
+
+
+long SwWrtShell::ExtSelLn(const Point *pPt, BOOL )
+{
+ MV_KONTEXT(this);
+ SwCrsrShell::SetCrsr(*pPt);
+ if( IsTableMode() )
+ return 1;
+
+ // Bug 66823: actual crsr has in additional mode no selection?
+ // Then destroy the actual an go to prev, this will be expand
+ if( !HasMark() && GoPrevCrsr() )
+ {
+ BOOL bHasMark = HasMark(); // thats wrong!
+ GoNextCrsr();
+ if( bHasMark )
+ {
+ DestroyCrsr();
+ GoPrevCrsr();
+ }
+ }
+
+ // ggfs. den Mark der Selektion anpassen
+ BOOL bToTop = !IsCrsrPtAtEnd();
+ SwapPam();
+
+ // der "Mark" muss am Zeilenende/-anfang stehen
+ if( bToTop ? !IsEndSentence() : !IsStartSentence() )
+ {
+ if( bToTop )
+ {
+ if( !IsEndPara() )
+ SwCrsrShell::Right(1,CRSR_SKIP_CHARS);
+ SwCrsrShell::GoEndSentence();
+ }
+ else
+ SwCrsrShell::GoStartSentence();
+ }
+ SwapPam();
+
+ return bToTop ? SwCrsrShell::GoStartSentence() : SwCrsrShell::GoEndSentence();
+}
+
+
+/*
+ * zurueck in den Standard Mode: kein Mode, keine Selektionen.
+ */
+
+void SwWrtShell::EnterStdMode()
+{
+ if(bAddMode)
+ LeaveAddMode();
+ if(bBlockMode)
+ LeaveBlockMode();
+ bBlockMode = FALSE;
+ bExtMode = FALSE;
+ bInSelect = FALSE;
+ if(IsSelFrmMode())
+ {
+ UnSelectFrm();
+ LeaveSelFrmMode();
+ }
+ else
+ {
+ /* ACT_KONTEXT() opens and action which has to be
+ closed prior to the call of
+ GetChgLnk().Call()
+ */
+ {
+ ACT_KONTEXT(this);
+ bSelWrd = bSelLn = FALSE;
+ if( !IsRetainSelection() )
+ KillPams();
+ ClearMark();
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ fnKillSel = &SwWrtShell::ResetSelect;
+ }
+ }
+ Invalidate();
+ SwTransferable::ClearSelection( *this );
+}
+
+/*
+ * Extended Mode
+ */
+
+
+
+void SwWrtShell::EnterExtMode()
+{
+ if(bBlockMode)
+ {
+ LeaveBlockMode();
+ KillPams();
+ ClearMark();
+ }
+ bExtMode = TRUE;
+ bAddMode = FALSE;
+ bBlockMode = FALSE;
+ SttSelect();
+}
+
+
+
+void SwWrtShell::LeaveExtMode()
+{
+ bExtMode = FALSE;
+ EndSelect();
+}
+/*
+ * Ende einer Selektion; falls die Selektion leer ist,
+ * ClearMark().
+ */
+
+
+
+long SwWrtShell::SttLeaveSelect(const Point *, BOOL )
+{
+ if(SwCrsrShell::HasSelection() && !IsSelTblCells() && bClearMark) {
+ return 0;
+ }
+// if( IsSelTblCells() ) aSelTblLink.Call(this);
+ ClearMark();
+ return 1;
+}
+/*
+ * Verlassen des Selektionsmodus in Additional Mode
+ */
+
+
+
+long SwWrtShell::AddLeaveSelect(const Point *, BOOL )
+{
+ if(IsTableMode()) LeaveAddMode();
+ else if(SwCrsrShell::HasSelection())
+ CreateCrsr();
+ return 1;
+}
+/*
+ * Additional Mode
+ */
+
+
+
+void SwWrtShell::EnterAddMode()
+{
+ if(IsTableMode()) return;
+ if(bBlockMode)
+ LeaveBlockMode();
+ fnLeaveSelect = &SwWrtShell::AddLeaveSelect;
+ fnKillSel = &SwWrtShell::Ignore;
+ fnSetCrsr = &SwWrtShell::SetCrsr;
+ bAddMode = TRUE;
+ bBlockMode = FALSE;
+ bExtMode = FALSE;
+ if(SwCrsrShell::HasSelection())
+ CreateCrsr();
+ Invalidate();
+}
+
+
+
+void SwWrtShell::LeaveAddMode()
+{
+ fnLeaveSelect = &SwWrtShell::SttLeaveSelect;
+ fnKillSel = &SwWrtShell::ResetSelect;
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ bAddMode = FALSE;
+ Invalidate();
+}
+
+/*
+ * Block Mode
+ */
+
+void SwWrtShell::EnterBlockMode()
+{
+ bBlockMode = FALSE;
+ EnterStdMode();
+ bBlockMode = TRUE;
+ CrsrToBlockCrsr();
+ Invalidate();
+}
+
+
+
+void SwWrtShell::LeaveBlockMode()
+{
+ bBlockMode = FALSE;
+ BlockCrsrToCrsr();
+ EndSelect();
+ Invalidate();
+}
+
+// Einfuegemodus
+
+
+
+void SwWrtShell::SetInsMode( BOOL bOn )
+{
+ bIns = bOn;
+ SwCrsrShell::SetOverwriteCrsr( !bIns );
+ const SfxBoolItem aTmp( SID_ATTR_INSERT, bIns );
+ GetView().GetViewFrame()->GetBindings().SetState( aTmp );
+ StartAction();
+ EndAction();
+ Invalidate();
+}
+//Overwrite mode is incompatible with red-lining
+void SwWrtShell::SetRedlineModeAndCheckInsMode( USHORT eMode )
+{
+ SetRedlineMode( eMode );
+ if (IsRedlineOn())
+ SetInsMode( true );
+}
+
+/*
+ * Rahmen bearbeiten
+ */
+
+
+long SwWrtShell::BeginFrmDrag(const Point *pPt, BOOL)
+{
+ fnDrag = &SwFEShell::Drag;
+ if(bStartDrag)
+ {
+ Point aTmp( nStartDragX, nStartDragY );
+ SwFEShell::BeginDrag( &aTmp, FALSE );
+ }
+ else
+ SwFEShell::BeginDrag( pPt, FALSE );
+ return 1;
+}
+
+
+
+void SwWrtShell::EnterSelFrmMode(const Point *pPos)
+{
+ if(pPos)
+ {
+ nStartDragX = pPos->X();
+ nStartDragY = pPos->Y();
+ bStartDrag = TRUE;
+ }
+ bNoEdit = bLayoutMode = TRUE;
+ HideCrsr();
+
+ // gleicher Aufruf von BeginDrag an der SwFEShell
+ fnDrag = &SwWrtShell::BeginFrmDrag;
+ fnEndDrag = &SwWrtShell::UpdateLayoutFrm;
+ SwBaseShell::SetFrmMode( FLY_DRAG_START, this );
+ Invalidate();
+}
+
+
+
+void SwWrtShell::LeaveSelFrmMode()
+{
+ fnDrag = &SwWrtShell::BeginDrag;
+ fnEndDrag = &SwWrtShell::EndDrag;
+ bLayoutMode = FALSE;
+ bStartDrag = FALSE;
+ Edit();
+ SwBaseShell::SetFrmMode( FLY_DRAG_END, this );
+ Invalidate();
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Rahmengebundenes Macro ausfuehren
+------------------------------------------------------------------------*/
+
+
+
+IMPL_LINK( SwWrtShell, ExecFlyMac, void *, pFlyFmt )
+{
+ const SwFrmFmt *pFmt = pFlyFmt ? (SwFrmFmt*)pFlyFmt : GetFlyFrmFmt();
+ ASSERT(pFmt, kein FrameFormat.);
+ const SvxMacroItem &rFmtMac = pFmt->GetMacro();
+
+ if(rFmtMac.HasMacro(SW_EVENT_OBJECT_SELECT))
+ {
+ const SvxMacro &rMac = rFmtMac.GetMacro(SW_EVENT_OBJECT_SELECT);
+ if( IsFrmSelected() )
+ bLayoutMode = TRUE;
+ CallChgLnk();
+ ExecMacro( rMac );
+ }
+ return 0;
+}
+
+
+
+long SwWrtShell::UpdateLayoutFrm(const Point *pPt, BOOL )
+{
+ // voerst Dummy
+ SwFEShell::EndDrag( pPt, FALSE );
+ fnDrag = &SwWrtShell::BeginFrmDrag;
+ return 1;
+}
+
+/*
+ * Handler fuer das Togglen der Modi. Liefern alten Mode zurueck.
+ */
+
+
+
+long SwWrtShell::ToggleAddMode()
+{
+ bAddMode ? LeaveAddMode(): EnterAddMode();
+ Invalidate();
+ return !bAddMode;
+}
+
+
+long SwWrtShell::ToggleBlockMode()
+{
+ bBlockMode ? LeaveBlockMode(): EnterBlockMode();
+ Invalidate();
+ return !bBlockMode;
+}
+
+
+long SwWrtShell::ToggleExtMode()
+{
+ bExtMode ? LeaveExtMode() : EnterExtMode();
+ Invalidate();
+ return !bExtMode;
+}
+/*
+ * Draggen im Standard Modus (Selektieren von Inhalt)
+ */
+
+
+
+long SwWrtShell::BeginDrag(const Point * /*pPt*/, BOOL )
+{
+ if(bSelWrd)
+ {
+ bInSelect = TRUE;
+ if( !IsCrsrPtAtEnd() )
+ SwapPam();
+
+ fnDrag = &SwWrtShell::ExtSelWrd;
+ fnSetCrsr = &SwWrtShell::Ignore;
+ }
+ else if(bSelLn)
+ {
+ bInSelect = TRUE;
+ fnDrag = &SwWrtShell::ExtSelLn;
+ fnSetCrsr = &SwWrtShell::Ignore;
+ }
+ else
+ {
+ fnDrag = &SwWrtShell::Drag;
+ SttSelect();
+ }
+
+ return 1;
+}
+
+
+
+long SwWrtShell::Drag(const Point *, BOOL )
+{
+ if( IsSelTblCells() )
+ aSelTblLink.Call(this);
+
+ return 1;
+}
+
+
+
+long SwWrtShell::EndDrag(const Point * /*pPt*/, BOOL )
+{
+ fnDrag = &SwWrtShell::BeginDrag;
+ if( IsExtSel() )
+ LeaveExtSel();
+
+ if( IsSelTblCells() )
+ aSelTblLink.Call(this);
+ EndSelect();
+ return 1;
+}
+
+// --> FME 2004-07-30 #i32329# Enhanced table selection
+BOOL SwWrtShell::SelectTableRowCol( const Point& rPt, const Point* pEnd, bool bRowDrag )
+{
+ MV_KONTEXT(this);
+ SttSelect();
+ if(SelTblRowCol( rPt, pEnd, bRowDrag ))
+ {
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ fnKillSel = &SwWrtShell::ResetSelect;
+ return TRUE;
+ }
+ return FALSE;
+}
+// <--
+
+/*------------------------------------------------------------------------
+ Beschreibung: Selektion einer Tabellenzeile / Spalte
+------------------------------------------------------------------------*/
+
+BOOL SwWrtShell::SelectTableRow()
+{
+ if ( SelTblRow() )
+ {
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ fnKillSel = &SwWrtShell::ResetSelect;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
+
+BOOL SwWrtShell::SelectTableCol()
+{
+ if ( SelTblCol() )
+ {
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ fnKillSel = &SwWrtShell::ResetSelect;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL SwWrtShell::SelectTableCell()
+{
+ if ( SelTblBox() )
+ {
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ fnKillSel = &SwWrtShell::ResetSelect;
+ return TRUE;
+ }
+ return FALSE;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Prueft, ob eine Wortselektion vorliegt.
+ Gemaess den Regeln fuer intelligentes Cut / Paste
+ werden umgebende Spaces rausgeschnitten.
+ Return: Liefert Art der Wortselektion zurueck.
+------------------------------------------------------------------------*/
+
+
+
+int SwWrtShell::IntelligentCut(int nSelection, BOOL bCut)
+{
+ // kein intelligentes Drag and Drop bei Mehrfachselektion
+ // es existieren mehrere Cursor, da ein zweiter bereits
+ // an die Zielposition gesetzt wurde
+ if( IsAddMode() || !(nSelection & nsSelectionType::SEL_TXT) )
+ return FALSE;
+
+ String sTxt;
+ CharClass& rCC = GetAppCharClass();
+
+ // wenn das erste und das letzte Zeichen kein Wortzeichen ist,
+ // ist kein Wort selektiert.
+ sal_Unicode cPrev = GetChar(FALSE);
+ sal_Unicode cNext = GetChar(TRUE, -1);
+ if( !cPrev || !cNext ||
+ !rCC.isLetterNumeric( ( sTxt = cPrev), 0 ) ||
+ !rCC.isLetterNumeric( ( sTxt = cNext), 0 ) )
+ return NO_WORD;
+
+ cPrev = GetChar(FALSE, -1);
+ cNext = GetChar(TRUE);
+
+ int cWord = NO_WORD;
+ // ist ein Wort selektiert?
+ if(!cWord && cPrev && cNext &&
+ CH_TXTATR_BREAKWORD != cPrev && CH_TXTATR_INWORD != cPrev &&
+ CH_TXTATR_BREAKWORD != cNext && CH_TXTATR_INWORD != cNext &&
+ !rCC.isLetterNumeric( ( sTxt = cPrev), 0 ) &&
+ !rCC.isLetterNumeric( ( sTxt = cNext), 0 ) )
+ cWord = WORD_NO_SPACE;
+
+ if(cWord == WORD_NO_SPACE && ' ' == cPrev )
+ {
+ cWord = WORD_SPACE_BEFORE;
+ // Space davor loeschen
+ if(bCut)
+ {
+ Push();
+ if(IsCrsrPtAtEnd())
+ SwapPam();
+ ClearMark();
+ SetMark();
+ SwCrsrShell::Left(1,CRSR_SKIP_CHARS);
+ SwFEShell::Delete();
+ Pop( FALSE );
+ }
+ }
+ else if(cWord == WORD_NO_SPACE && cNext == ' ')
+ {
+ cWord = WORD_SPACE_AFTER;
+ // Space dahinter loeschen
+ if(bCut) {
+ Push();
+ if(!IsCrsrPtAtEnd()) SwapPam();
+ ClearMark();
+ SetMark();
+ SwCrsrShell::Right(1,CRSR_SKIP_CHARS);
+ SwFEShell::Delete();
+ Pop( FALSE );
+ }
+ }
+ return cWord;
+}
+
+
+
+ // jump to the next / previous hyperlink - inside text and also
+ // on graphics
+BOOL SwWrtShell::SelectNextPrevHyperlink( BOOL bNext )
+{
+ StartAction();
+ BOOL bRet = SwCrsrShell::SelectNxtPrvHyperlink( bNext );
+ if( !bRet )
+ {
+ // will we have this feature?
+ EnterStdMode();
+ if( bNext )
+ SttEndDoc(TRUE);
+ else
+ SttEndDoc(FALSE);
+ bRet = SwCrsrShell::SelectNxtPrvHyperlink( bNext );
+ }
+ EndAction();
+
+ BOOL bCreateXSelection = FALSE;
+ const BOOL bFrmSelected = IsFrmSelected() || IsObjSelected();
+ if( IsSelection() )
+ {
+ if ( bFrmSelected )
+ UnSelectFrm();
+
+ // Funktionspointer fuer das Aufheben der Selektion setzen
+ // bei Cursor setzen
+ fnKillSel = &SwWrtShell::ResetSelect;
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ bCreateXSelection = TRUE;
+ }
+ else if( bFrmSelected )
+ {
+ EnterSelFrmMode();
+ bCreateXSelection = TRUE;
+ }
+ else if( (CNT_GRF | CNT_OLE ) & GetCntType() )
+ {
+ SelectObj( GetCharRect().Pos() );
+ EnterSelFrmMode();
+ bCreateXSelection = TRUE;
+ }
+
+ if( bCreateXSelection )
+ SwTransferable::CreateSelection( *this );
+
+ return bRet;
+}
+
+
+/* fuer den Erhalt der Selektion wird nach SetMark() der Cursor
+ * nach links bewegt, damit er durch das Einfuegen von Text nicht
+ * verschoben wird. Da auf der CORE-Seite am aktuellen Cursor
+ * eine bestehende Selektion aufgehoben wird, wird der Cursor auf
+ * den Stack gepushed. Nach dem Verschieben werden sie wieder
+ * zusammengefasst. */
+
+
+
+
diff --git a/sw/source/ui/wrtsh/wrtsh.hrc b/sw/source/ui/wrtsh/wrtsh.hrc
new file mode 100644
index 000000000000..a82a4c3c1b48
--- /dev/null
+++ b/sw/source/ui/wrtsh/wrtsh.hrc
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _WRTSH_HRC
+#define _WRTSH_HRC
+
+#include "rcid.hrc"
+
+#define DLG_GOTO (RC_WRTSH_BEGIN + 1)
+
+
+#define STR_DDEERROR_APP1 (RC_WRTSH_BEGIN + 2)
+#define STR_DDEERROR_APP2 (RC_WRTSH_BEGIN + 3)
+#define STR_DDEERROR_DATA1 (RC_WRTSH_BEGIN + 4)
+#define STR_DDEERROR_DATA2 (RC_WRTSH_BEGIN + 5)
+#define STR_DDEERROR_LINK1 (RC_WRTSH_BEGIN + 6)
+#define STR_DDEERROR_LINK2 (RC_WRTSH_BEGIN + 7)
+
+#define WRTSH_ACT_END STR_DDEERROR_LINK2
+
+#if WRTSH_ACT_END > RC_WRTSH_END
+#error Resource-Id Ueberlauf
+#endif
+
+#endif
diff --git a/sw/source/ui/wrtsh/wrtsh.src b/sw/source/ui/wrtsh/wrtsh.src
new file mode 100644
index 000000000000..21547d107758
--- /dev/null
+++ b/sw/source/ui/wrtsh/wrtsh.src
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "wrtsh.hrc"
+
+String STR_DDEERROR_APP1
+{
+ Text[ en-US ] = "Application [" ;
+};
+String STR_DDEERROR_APP2
+{
+ Text[ en-US ] = "] is not responding." ;
+};
+String STR_DDEERROR_DATA1
+{
+ Text[ en-US ] = "Data for [" ;
+};
+String STR_DDEERROR_DATA2
+{
+ Text[ en-US ] = "] cannot be obtained" ;
+};
+String STR_DDEERROR_LINK1
+{
+ Text[ en-US ] = "Link to [" ;
+};
+String STR_DDEERROR_LINK2
+{
+ Text[ en-US ] = "] cannot be established" ;
+};
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
new file mode 100644
index 000000000000..60b9821c15ba
--- /dev/null
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -0,0 +1,1897 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/embed/XVisualObject.hpp>
+#include <com/sun/star/embed/EmbedMisc.hpp>
+#include <com/sun/star/embed/EmbedStates.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
+
+#if STLPORT_VERSION>=321
+#include <math.h> // prevent conflict between exception and std::exception
+#endif
+#include <hintids.hxx>
+#include <svx/svdview.hxx>
+#include <sot/factory.hxx>
+#include <svl/itemiter.hxx>
+#include <vcl/sound.hxx>
+#include <tools/bigint.hxx>
+#include <sot/storage.hxx>
+#include <svtools/insdlg.hxx>
+#include <sfx2/frmdescr.hxx>
+#include <sfx2/ipclient.hxx>
+#include <svtools/ehdl.hxx>
+#include <svtools/soerr.hxx>
+#include <tools/cachestr.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <editeng/sizeitem.hxx>
+#include <editeng/brkitem.hxx>
+#include <editeng/svxacorr.hxx>
+#include <vcl/graph.hxx>
+#include <sfx2/printer.hxx>
+#include <unotools/charclass.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <svx/svxdlg.hxx>
+#include <svx/extrusionbar.hxx>
+#include <svx/fontworkbar.hxx>
+#include <frmfmt.hxx>
+#include <fmtftn.hxx>
+#include <fmtpdsc.hxx>
+#include <wdocsh.hxx>
+#include <basesh.hxx>
+#include <swmodule.hxx>
+#include <wrtsh.hxx>
+#include <view.hxx>
+#include <uitool.hxx>
+#include <cmdid.h>
+#include <cfgitems.hxx>
+#include <pagedesc.hxx>
+#include <frmmgr.hxx>
+#include <shellio.hxx>
+#include <uinums.hxx> // fuer Anwenden einer
+#include <swundo.hxx> // fuer Undo-Ids
+#include <swcli.hxx>
+#include <poolfmt.hxx>
+#include <wview.hxx>
+#include <edtwin.hxx>
+#include <fmtcol.hxx>
+#include <swtable.hxx>
+#include <caption.hxx>
+#include <viscrs.hxx>
+#include <swdtflvr.hxx>
+#include <crsskip.hxx>
+#include <doc.hxx>
+#include <wrtsh.hrc>
+#include <SwStyleNameMapper.hxx>
+#include <sfx2/request.hxx>
+#include <paratr.hxx>
+#include <ndtxt.hxx>
+#include <editeng/acorrcfg.hxx>
+#include <IMark.hxx>
+
+// -> #111827#
+#include <SwRewriter.hxx>
+#include <comcore.hrc>
+// <- #111827#
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <sfx2/viewfrm.hxx>
+
+#include <editeng/acorrcfg.hxx>
+
+#include "PostItMgr.hxx"
+#include <sfx2/msgpool.hxx>
+
+using namespace sw::mark;
+using namespace com::sun::star;
+
+#define COMMON_INI_LIST \
+ fnDrag(&SwWrtShell::BeginDrag),\
+ fnSetCrsr(&SwWrtShell::SetCrsr),\
+ fnEndDrag(&SwWrtShell::EndDrag),\
+ fnKillSel(&SwWrtShell::Ignore),\
+ pModeStack(0), \
+ ePageMove(MV_NO),\
+ pCrsrStack(0), \
+ rView(rShell),\
+ bDestOnStack(FALSE), \
+ fnLeaveSelect(&SwWrtShell::SttLeaveSelect)
+
+#define BITFLD_INI_LIST \
+ bClearMark = \
+ bIns = TRUE;\
+ bAddMode = \
+ bBlockMode = \
+ bExtMode = \
+ bInSelect = \
+ bCopy = \
+ bLayoutMode = \
+ bNoEdit = \
+ bSelWrd = \
+ bSelLn = \
+ bIsInClickToEdit = \
+ mbRetainSelection = FALSE;
+
+
+SvxAutoCorrect* lcl_IsAutoCorr()
+{
+ SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get()->GetAutoCorrect();
+ if( pACorr && !pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd |
+ AddNonBrkSpace | ChgOrdinalNumber |
+ ChgToEnEmDash | SetINetAttr | Autocorrect ))
+ pACorr = 0;
+ return pACorr;
+}
+
+void SwWrtShell::NoEdit(BOOL bHideCrsr)
+{
+ if(bHideCrsr)
+ HideCrsr();
+ bNoEdit = TRUE;
+}
+
+
+
+void SwWrtShell::Edit()
+{
+ if (CanInsert())
+ {
+ ShowCrsr();
+ bNoEdit = FALSE;
+ }
+}
+
+
+
+BOOL SwWrtShell::IsEndWrd()
+{
+ MV_KONTEXT(this);
+ if(IsEndPara() && !IsSttPara())
+ return TRUE;
+
+ return IsEndWord();
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: Abfrage, ob Einfuegen moeglich ist; gfs. Beep
+------------------------------------------------------------------------*/
+
+
+
+BOOL SwWrtShell::_CanInsert()
+{
+ if(!CanInsert())
+ {
+ Sound::Beep();
+ return FALSE;
+ }
+ return TRUE;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: String einfuegen
+------------------------------------------------------------------------*/
+
+void SwWrtShell::InsertByWord( const String & rStr)
+{
+ if( rStr.Len() )
+ {
+ BOOL bDelim = GetAppCharClass().isLetterNumeric( rStr, 0 );
+ xub_StrLen nPos = 0, nStt = 0;
+ for( ; nPos < rStr.Len(); nPos++ )
+ {
+ BOOL bTmpDelim = GetAppCharClass().isLetterNumeric( rStr, nPos );
+ if( bTmpDelim != bDelim )
+ {
+ Insert( rStr.Copy( nStt, nPos - nStt ));
+ nStt = nPos;
+ }
+ }
+ if( nStt != nPos )
+ Insert( rStr.Copy( nStt, nPos - nStt ));
+ }
+}
+
+
+void SwWrtShell::Insert( const String &rStr )
+{
+ ResetCursorStack();
+ if( !_CanInsert() )
+ return;
+
+ BOOL bStarted = FALSE, bHasSel = HasSelection(),
+ bCallIns = bIns /*|| bHasSel*/;
+ bool bDeleted = false;
+
+ if( bHasSel || ( !bIns && SelectHiddenRange() ) )
+ {
+ // nur hier klammern, da das normale Insert schon an der
+ // Editshell geklammert ist
+ StartAllAction();
+
+ // #111827#
+ SwRewriter aRewriter;
+
+ aRewriter.AddRule(UNDO_ARG1, GetCrsrDescr());
+ aRewriter.AddRule(UNDO_ARG2, String(SW_RES(STR_YIELDS)));
+ {
+ String aTmpStr;
+ aTmpStr += String(SW_RES(STR_START_QUOTE));
+ aTmpStr += rStr;
+ aTmpStr += String(SW_RES(STR_END_QUOTE));
+
+ aRewriter.AddRule(UNDO_ARG3, rStr);
+ }
+
+ StartUndo(UNDO_REPLACE, &aRewriter);
+ bStarted = TRUE;
+ bDeleted = DelRight() != 0;
+ }
+
+ /*
+JP 21.01.98: Ueberschreiben ueberschreibt nur die Selektion, nicht das
+ naechste Zeichen.
+ if( bHasSel && !bIns && 1 < rStr.Len() )
+ {
+ // falls mehrere Zeichen anstehen, nur das erste einfuegen,
+ // der Rest muss dann aber Ueberschrieben werden.
+ SwEditShell::Insert( rStr.GetChar( 0 ) );
+ SwEditShell::Overwrite( rStr.Copy( 1 ) );
+ }
+ else
+*/
+ bCallIns ?
+ SwEditShell::Insert2( rStr, bDeleted ) : SwEditShell::Overwrite( rStr );
+
+
+ if( bStarted )
+ {
+ EndAllAction();
+ EndUndo();
+ }
+// delete pChgFlg;
+}
+
+/* Begrenzung auf maximale Hoehe geht nicht, da die maximale Hoehe
+ * des aktuellen Frames nicht erfragt werden kann. */
+
+
+
+void SwWrtShell::Insert( const String &rPath, const String &rFilter,
+ const Graphic &rGrf, SwFlyFrmAttrMgr *pFrmMgr,
+ BOOL bRule )
+{
+ ResetCursorStack();
+ if ( !_CanInsert() )
+ return;
+
+ StartAllAction();
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_GRAPHIC));
+
+ StartUndo(UNDO_INSERT, &aRewriter);
+
+ if ( HasSelection() )
+ DelRight();
+ // eingefuegte Grafik in eigenen Absatz, falls am Ende
+ // eines nichtleeren Absatzes
+ if ( IsEndPara() && !IsSttPara() )
+ SwFEShell::SplitNode();
+
+ EnterSelFrmMode();
+
+ BOOL bSetGrfSize = TRUE;
+ BOOL bOwnMgr = FALSE;
+
+ if ( !pFrmMgr )
+ {
+ bOwnMgr = TRUE;
+ pFrmMgr = new SwFlyFrmAttrMgr( TRUE, this, FRMMGR_TYPE_GRF );
+
+ // VORSICHT
+ // GetAttrSet nimmt einen Abgleich vor
+ // Beim Einfuegen ist eine SwFrmSize vorhanden wegen der
+ // DEF-Rahmengroesse
+ // Diese muss fuer die optimale Groesse explizit entfernt werden
+ pFrmMgr->DelAttr(RES_FRM_SIZE);
+ }
+ else
+ {
+ Size aSz( pFrmMgr->GetSize() );
+ if ( !aSz.Width() || !aSz.Height() )
+ {
+ aSz.Width() = aSz.Height() = 567;
+ pFrmMgr->SetSize( aSz );
+ }
+ else if ( aSz.Width() != DFLT_WIDTH && aSz.Height() != DFLT_HEIGHT )
+ bSetGrfSize = FALSE;
+
+ pFrmMgr->SetHeightSizeType(ATT_FIX_SIZE);
+
+ }
+
+ // Einfuegen der Grafik
+ SwFEShell::Insert(rPath, rFilter, &rGrf, &pFrmMgr->GetAttrSet());
+ if ( bOwnMgr )
+ pFrmMgr->UpdateAttrMgr();
+
+ if( bSetGrfSize && !bRule )
+ {
+ Size aGrfSize, aBound = GetGraphicDefaultSize();
+ GetGrfSize( aGrfSize );
+
+ //Die GrafikSize noch um die Randattribute vergroessern, denn die
+ //Zaehlen beim Rahmen mit.
+ aGrfSize.Width() += pFrmMgr->CalcWidthBorder();
+ aGrfSize.Height()+= pFrmMgr->CalcHeightBorder();
+
+ const BigInt aTempWidth( aGrfSize.Width() );
+ const BigInt aTempHeight( aGrfSize.Height());
+
+ // ggf. Breite anpassen, Hoehe dann proportional verkleinern
+ if( aGrfSize.Width() > aBound.Width() )
+ {
+ aGrfSize.Width() = aBound.Width();
+ aGrfSize.Height() = ((BigInt)aBound.Width()) * aTempHeight / aTempWidth;
+ }
+ // ggf. Hoehe anpassen, Breite dann proportional verkleinern
+ if( aGrfSize.Height() > aBound.Height() )
+ {
+ aGrfSize.Height() = aBound.Height();
+ aGrfSize.Width() = ((BigInt)aBound.Height()) * aTempWidth / aTempHeight;
+ }
+ pFrmMgr->SetSize( aGrfSize );
+ pFrmMgr->UpdateFlyFrm();
+ }
+ if ( bOwnMgr )
+ delete pFrmMgr;
+
+ EndUndo();
+ EndAllAction();
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: Fuegt ein OLE-Objekt in die CORE ein.
+ Wenn kein Object uebergeben wird, so wird eins erzeugt.
+------------------------------------------------------------------------*/
+
+
+void SwWrtShell::InsertObject( const svt::EmbeddedObjectRef& xRef, SvGlobalName *pName,
+ BOOL bActivate, USHORT nSlotId )
+{
+ ResetCursorStack();
+ if( !_CanInsert() )
+ return;
+
+ if( !xRef.is() )
+ {
+ // temporary storage
+ svt::EmbeddedObjectRef xObj;
+ uno::Reference < embed::XStorage > xStor = comphelper::OStorageHelper::GetTemporaryStorage();
+ BOOL bDoVerb = TRUE;
+ if ( pName )
+ {
+ comphelper::EmbeddedObjectContainer aCnt( xStor );
+ ::rtl::OUString aName;
+ // TODO/LATER: get aspect?
+ xObj.Assign( aCnt.CreateEmbeddedObject( pName->GetByteSequence(), aName ), embed::Aspects::MSOLE_CONTENT );
+ }
+ else
+ {
+ SvObjectServerList aServerList;
+ switch (nSlotId)
+ {
+ case SID_INSERT_OBJECT:
+ {
+ aServerList.FillInsertObjects();
+ aServerList.Remove( SwDocShell::Factory().GetClassId() );
+ // Intentionally no break!
+ }
+
+ // TODO/LATER: recording! Convert properties to items
+ case SID_INSERT_PLUGIN:
+ /*
+ if(pReq)
+ {
+ INetURLObject* pURL = aDlg.GetURL();
+ if(pURL)
+ pReq->AppendItem(SfxStringItem(FN_PARAM_2, pURL->GetMainURL(INetURLObject::NO_DECODE)));
+ pReq->AppendItem(SfxStringItem(FN_PARAM_3 , aDlg.GetCommands()));
+ } */
+ case SID_INSERT_FLOATINGFRAME:
+ /*
+ if(pReq && xFloatingFrame.Is())
+ {
+ const SfxFrameDescriptor* pDescriptor = xFloatingFrame->GetFrameDescriptor();
+ pReq->AppendItem(SfxStringItem(FN_PARAM_1, pDescriptor->GetName()));
+ pReq->AppendItem(
+ SfxStringItem( FN_PARAM_2,
+ pDescriptor->GetURL().GetMainURL(INetURLObject::NO_DECODE)));
+ pReq->AppendItem(SvxSizeItem(FN_PARAM_3, pDescriptor->GetMargin()));
+ pReq->AppendItem(SfxByteItem(FN_PARAM_4, pDescriptor->GetScrollingMode()));
+ pReq->AppendItem(SfxBoolItem(FN_PARAM_5, pDescriptor->HasFrameBorder()));
+ }*/
+ {
+ SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool();
+ const SfxSlot* pSlot = pSlotPool->GetSlot(nSlotId);
+ rtl::OString aCmd(".uno:");
+ aCmd += pSlot->GetUnoName();
+ SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
+ SfxAbstractInsertObjectDialog* pDlg =
+ pFact->CreateInsertObjectDialog( GetWin(), rtl::OUString( aCmd, aCmd.getLength(), RTL_TEXTENCODING_UTF8 ), xStor, &aServerList );
+ if ( pDlg )
+ {
+ pDlg->Execute();
+ bDoVerb = pDlg->IsCreateNew();
+ ::rtl::OUString aIconMediaType;
+ uno::Reference< io::XInputStream > xIconMetaFile = pDlg->GetIconIfIconified( &aIconMediaType );
+ xObj.Assign( pDlg->GetObject(),
+ xIconMetaFile.is() ? embed::Aspects::MSOLE_ICON : embed::Aspects::MSOLE_CONTENT );
+ if ( xIconMetaFile.is() )
+ xObj.SetGraphicStream( xIconMetaFile, aIconMediaType );
+
+ DELETEZ( pDlg );
+ }
+
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ if ( xObj.is() )
+ {
+ if( InsertOleObject( xObj ) && bActivate && bDoVerb )
+ {
+ SfxInPlaceClient* pClient = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin() );
+ if ( !pClient )
+ {
+ pClient = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
+ SetCheckForOLEInCaption( TRUE );
+ }
+
+ if ( xObj.GetViewAspect() == embed::Aspects::MSOLE_ICON )
+ {
+ SwRect aArea = GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() );
+ aArea.Pos() += GetAnyCurRect( RECT_FLY_EMBEDDED, 0, xObj.GetObject() ).Pos();
+ MapMode aMapMode( MAP_TWIP );
+ Size aSize = xObj.GetSize( &aMapMode );
+ aArea.Width( aSize.Width() );
+ aArea.Height( aSize.Height() );
+ RequestObjectResize( aArea, xObj.GetObject() );
+ }
+ else
+ CalcAndSetScale( xObj );
+
+ //#50270# Error brauchen wir nicht handeln, das erledigt das
+ //DoVerb in der SfxViewShell
+ pClient->DoVerb( SVVERB_SHOW );
+
+ // TODO/LATER: set document name - should be done in Client
+ //if ( !ERRCODE_TOERROR( nErr ) )
+ // xIPObj->SetDocumentName( GetView().GetDocShell()->GetTitle() );
+ }
+ }
+ }
+ else
+ {
+ if( HasSelection() )
+ DelRight();
+ InsertOleObject( xRef );
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Object in die Core einfuegen.
+ Vom ClipBoard oder Insert
+------------------------------------------------------------------------*/
+
+BOOL SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrmFmt **pFlyFrmFmt )
+{
+ ResetCursorStack();
+ StartAllAction();
+
+ StartUndo(UNDO_INSERT);
+
+ //Some differences between StarMath and any other objects:
+ //1. Selections should be deleted. For StarMath the Text should be
+ // passed to the Object
+ //2. If the cursor is at the end of an non empty paragraph a paragraph
+ // break should be insertet. StarMath objects are character bound and
+ // no break should be inserted.
+ //3. If an selektion is passed to a StarMath object, this object should
+ // not be activated. FALSE should be returned then.
+ BOOL bStarMath = TRUE;
+ BOOL bActivate = TRUE;
+
+ // set parent to get correct VisArea(in case of object needing parent printer)
+ uno::Reference < container::XChild > xChild( xRef.GetObject(), uno::UNO_QUERY );
+ if ( xChild.is() )
+ xChild->setParent( pDoc->GetDocShell()->GetModel() );
+
+ SvGlobalName aCLSID( xRef->getClassID() );
+ bStarMath = ( SotExchange::IsMath( aCLSID ) != 0 );
+ if( IsSelection() )
+ {
+ if( bStarMath )
+ {
+ String aMathData;
+ GetSelectedText( aMathData, GETSELTXT_PARABRK_TO_ONLYCR );
+
+ if( aMathData.Len() && svt::EmbeddedObjectRef::TryRunningState( xRef.GetObject() ) )
+ {
+ uno::Reference < beans::XPropertySet > xSet( xRef->getComponent(), uno::UNO_QUERY );
+ if ( xSet.is() )
+ {
+ try
+ {
+ xSet->setPropertyValue( ::rtl::OUString::createFromAscii("Formula"), uno::makeAny( ::rtl::OUString( aMathData ) ) );
+ bActivate = FALSE;
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+ }
+ }
+ DelRight();
+ }
+
+ if ( !bStarMath )
+ SwFEShell::SplitNode( FALSE, FALSE );
+
+ EnterSelFrmMode();
+
+ SwFlyFrmAttrMgr aFrmMgr( TRUE, this, FRMMGR_TYPE_OLE );
+ aFrmMgr.SetHeightSizeType(ATT_FIX_SIZE);
+
+ SwRect aBound;
+ CalcBoundRect( aBound, aFrmMgr.GetAnchor() );
+
+ //The Size should be suggested by the OLE server
+ MapMode aMapMode( MAP_TWIP );
+ Size aSz = xRef.GetSize( &aMapMode );
+
+ //Object size can be limited
+ if ( aSz.Width() > aBound.Width() )
+ {
+ //Immer proportional begrenzen.
+ aSz.Height() = aSz.Height() * aBound.Width() / aSz.Width();
+ aSz.Width() = aBound.Width();
+ }
+ aFrmMgr.SetSize( aSz );
+ SwFlyFrmFmt *pFmt = SwFEShell::InsertObject( xRef, &aFrmMgr.GetAttrSet() );
+
+ // --> #i972#
+ if ( bStarMath && pDoc->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) )
+ AlignFormulaToBaseline( xRef.GetObject() );
+ // <--
+
+ if (pFlyFrmFmt)
+ *pFlyFrmFmt = pFmt;
+
+ if ( SotExchange::IsChart( aCLSID ) )
+ {
+ uno::Reference< embed::XEmbeddedObject > xEmbeddedObj( xRef.GetObject(), uno::UNO_QUERY );
+ if ( xEmbeddedObj.is() )
+ {
+ bool bDisableDataTableDialog = false;
+ svt::EmbeddedObjectRef::TryRunningState( xEmbeddedObj );
+ uno::Reference< beans::XPropertySet > xProps( xEmbeddedObj->getComponent(), uno::UNO_QUERY );
+ if ( xProps.is() &&
+ ( xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ) ) >>= bDisableDataTableDialog ) &&
+ bDisableDataTableDialog )
+ {
+ xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ),
+ uno::makeAny( sal_False ) );
+ xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableComplexChartTypes" ) ),
+ uno::makeAny( sal_False ) );
+ uno::Reference< util::XModifiable > xModifiable( xProps, uno::UNO_QUERY );
+ if ( xModifiable.is() )
+ {
+ xModifiable->setModified( sal_True );
+ }
+ }
+ }
+ }
+
+ EndAllAction();
+ GetView().AutoCaption(OLE_CAP, &aCLSID);
+
+ SwRewriter aRewriter;
+
+ if ( bStarMath )
+ aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_MATH_FORMULA));
+ else if ( SotExchange::IsChart( aCLSID ) )
+ aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_CHART));
+ else
+ aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_OLE));
+
+ EndUndo(UNDO_INSERT, &aRewriter);
+
+ return bActivate;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Das aktuelle selektierte OLE-Objekt wird mit dem
+ Verb in den Server geladen.
+------------------------------------------------------------------------*/
+
+
+
+void SwWrtShell::LaunchOLEObj( long nVerb )
+{
+ if ( GetCntType() == CNT_OLE &&
+ !GetView().GetViewFrame()->GetFrame().IsInPlace() )
+ {
+ svt::EmbeddedObjectRef& xRef = GetOLEObject();
+ ASSERT( xRef.is(), "OLE not found" );
+ SfxInPlaceClient* pCli=0;
+
+ pCli = GetView().FindIPClient( xRef.GetObject(), &GetView().GetEditWin() );
+ if ( !pCli )
+ pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xRef );
+
+ ((SwOleClient*)pCli)->SetInDoVerb( TRUE );
+
+ CalcAndSetScale( xRef );
+ pCli->DoVerb( nVerb );
+
+ ((SwOleClient*)pCli)->SetInDoVerb( FALSE );
+ CalcAndSetScale( xRef );
+ }
+}
+
+void SwWrtShell::MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset )
+{
+ try
+ {
+ sal_Int32 nState = xObj->getCurrentState();
+ if ( nState == ::com::sun::star::embed::EmbedStates::INPLACE_ACTIVE
+ || nState == ::com::sun::star::embed::EmbedStates::UI_ACTIVE )
+ {
+ SfxInPlaceClient* pCli =
+ GetView().FindIPClient( xObj.GetObject(), &(GetView().GetEditWin()) );
+ if ( pCli )
+ {
+ Rectangle aArea = pCli->GetObjArea();
+ aArea += rOffset;
+ pCli->SetObjArea( aArea );
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {}
+}
+
+
+void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj,
+ const SwRect *pFlyPrtRect,
+ const SwRect *pFlyFrmRect )
+{
+ //Einstellen der Skalierung am Client. Diese ergibt sich aus der Differenz
+ //zwischen der VisArea des Objektes und der ObjArea.
+ ASSERT( xObj.is(), "ObjectRef not valid" );
+
+ sal_Int64 nAspect = xObj.GetViewAspect();
+ if ( nAspect == embed::Aspects::MSOLE_ICON )
+ return; // the replacement image is completely controlled by container in this case
+
+ sal_Int64 nMisc = 0;
+ sal_Bool bLinkingChart = sal_False;
+
+ try
+ {
+ nMisc = xObj->getStatus( nAspect );
+
+ //Das kann ja wohl nur ein nicht aktives Objekt sein. Diese bekommen
+ //auf Wunsch die neue Groesse als VisArea gesetzt (StarChart)
+ if( embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE & nMisc )
+ {
+ // TODO/MBA: testing
+ SwRect aRect( pFlyPrtRect ? *pFlyPrtRect
+ : GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() ));
+ if( !aRect.IsEmpty() )
+ {
+ // TODO/LEAN: getMapUnit can switch object to running state
+ // xObj.TryRunningState();
+
+ MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
+
+ // TODO/LATER: needs complete VisArea?!
+ Size aSize( OutputDevice::LogicToLogic( aRect.SVRect(), MAP_TWIP, aUnit ).GetSize() );
+ awt::Size aSz;
+ aSz.Width = aSize.Width();
+ aSz.Height = aSize.Height();
+ xObj->setVisualAreaSize( nAspect, aSz );
+ // --> OD 2005-05-02 #i48419# - action 'UpdateReplacement' doesn't
+ // have to change the modified state of the document.
+ // This is only a workaround for the defect, that this action
+ // modifies a document after load, because unnecessarily the
+ // replacement graphic is updated, in spite of the fact that
+ // nothing has been changed.
+ // If the replacement graphic changes by this action, the document
+ // will be already modified via other mechanisms.
+ {
+ bool bResetEnableSetModified(false);
+ if ( GetDoc()->GetDocShell()->IsEnableSetModified() )
+ {
+ GetDoc()->GetDocShell()->EnableSetModified( FALSE );
+ bResetEnableSetModified = true;
+ }
+
+ //#i79576# don't destroy chart replacement images on load
+ //#i79578# don't request a new replacement image for charts to often
+ //a chart sends a modified call to the framework if it was changed
+ //thus the replacement update is already handled elsewhere
+ if ( !SotExchange::IsChart( xObj->getClassID() ) )
+ xObj.UpdateReplacement();
+
+ if ( bResetEnableSetModified )
+ {
+ GetDoc()->GetDocShell()->EnableSetModified( TRUE );
+ }
+ }
+ // <--
+ }
+
+ // TODO/LATER: this is only a workaround,
+ uno::Reference< chart2::XChartDocument > xChartDocument( xObj->getComponent(), uno::UNO_QUERY );
+ bLinkingChart = ( xChartDocument.is() && !xChartDocument->hasInternalDataProvider() );
+ }
+ }
+ catch ( uno::Exception& )
+ {
+ // TODO/LATER: handle the error
+ return;
+ }
+
+ SfxInPlaceClient* pCli = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin() );
+ if ( !pCli )
+ {
+ if ( (embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY & nMisc) || bLinkingChart
+ // TODO/LATER: ResizeOnPrinterChange
+ //|| SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xObj->GetMiscStatus()
+ || nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE // non-resizable objects need to be
+ // set the size back by this method
+ )
+ {
+ pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
+ }
+ else
+ return;
+ }
+
+ // TODO/LEAN: getMapUnit can switch object to running state
+ // xObj.TryRunningState();
+
+ awt::Size aSize;
+ try
+ {
+ aSize = xObj->getVisualAreaSize( nAspect );
+ }
+ catch( embed::NoVisualAreaSizeException& )
+ {
+ DBG_ERROR( "Can't get visual area size!\n" );
+ // the scaling will not be done
+ }
+ catch( uno::Exception& )
+ {
+ // TODO/LATER: handle the error
+ DBG_ERROR( "Can't get visual area size!\n" );
+ return;
+ }
+
+ Size _aVisArea( aSize.Width, aSize.Height );
+
+ Fraction aScaleWidth( 1, 1 );
+ Fraction aScaleHeight( 1, 1 );
+
+ sal_Bool bUseObjectSize = sal_False;
+
+ // solange keine vernuenftige Size vom Object kommt, kann nichts
+ // skaliert werden
+ if( _aVisArea.Width() && _aVisArea.Height() )
+ {
+ const MapMode aTmp( MAP_TWIP );
+ MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
+ _aVisArea = OutputDevice::LogicToLogic( _aVisArea, aUnit, aTmp);
+ Size aObjArea;
+ if ( pFlyPrtRect )
+ aObjArea = pFlyPrtRect->SSize();
+ else
+ aObjArea = GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() ).SSize();
+
+ // differ the aObjArea and _aVisArea by 1 Pixel then set new VisArea
+ long nX, nY;
+ SwSelPaintRects::Get1PixelInLogic( *this, &nX, &nY );
+ if( !( _aVisArea.Width() - nX <= aObjArea.Width() &&
+ _aVisArea.Width() + nX >= aObjArea.Width() &&
+ _aVisArea.Height()- nY <= aObjArea.Height()&&
+ _aVisArea.Height()+ nY >= aObjArea.Height() ))
+ {
+ // TODO/LATER: MISCSTATUS_RESIZEONPRINTERCHANGE
+ /*
+ if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & nMisc )
+ {
+ //This type of objects should never be resized.
+ //If this request comes from the Writer core (inaktive Object
+ //ist resized), the Object should be resized too.
+ //If this request comes from the Object itself, the Frame
+ //in the Writer core should be resized.
+ if ( pFlyPrtRect ) //Request from core?
+ {
+ xObj->SetVisArea( OutputDevice::LogicToLogic(
+ pFlyPrtRect->SVRect(), MAP_TWIP, xObj->GetMapUnit() ));
+ }
+ else
+ {
+ SwRect aTmp( Point( LONG_MIN, LONG_MIN ), _aVisArea );
+ RequestObjectResize( aTmp, xObj );
+ }
+ //Der Rest erledigt sich, weil wir eh wiederkommen sollten, evtl.
+ //sogar rekursiv.
+ return;
+ }
+ else*/
+
+ if ( nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE )
+ {
+ // the object must not be scaled, the size stored in object must be used for restoring
+ bUseObjectSize = sal_True;
+ }
+ else
+ {
+ aScaleWidth = Fraction( aObjArea.Width(), _aVisArea.Width() );
+ aScaleHeight = Fraction( aObjArea.Height(), _aVisArea.Height());
+ }
+ }
+ }
+
+ //Jetzt ist auch der guenstige Zeitpunkt die ObjArea einzustellen.
+ //Die Scalierung muss beruecksichtigt werden.
+ SwRect aArea;
+ if ( pFlyPrtRect )
+ {
+ aArea = *pFlyPrtRect;
+ aArea += pFlyFrmRect->Pos();
+ }
+ else
+ {
+ aArea = GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() );
+ aArea.Pos() += GetAnyCurRect( RECT_FLY_EMBEDDED, 0, xObj.GetObject() ).Pos();
+ }
+
+ if ( bUseObjectSize )
+ {
+ // --> this moves non-resizable object so that when adding borders the baseline remains the same
+ const SwFlyFrmFmt *pFlyFrmFmt = dynamic_cast< const SwFlyFrmFmt * >( GetFlyFrmFmt() );
+ ASSERT( pFlyFrmFmt, "Could not find fly frame." );
+ if ( pFlyFrmFmt )
+ {
+ const Point &rPoint = pFlyFrmFmt->GetLastFlyFrmPrtRectPos();
+ SwRect aRect( pFlyPrtRect ? *pFlyPrtRect
+ : GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() ));
+ aArea += rPoint - aRect.Pos(); // adjust area by diff of printing area position in order to keep baseline alignment correct.
+ }
+ // <--
+ aArea.Width ( _aVisArea.Width() );
+ aArea.Height( _aVisArea.Height() );
+ RequestObjectResize( aArea, xObj.GetObject() );
+ }
+ else
+ {
+ aArea.Width ( Fraction( aArea.Width() ) / pCli->GetScaleWidth() );
+ aArea.Height( Fraction( aArea.Height() ) / pCli->GetScaleHeight());
+ }
+
+ pCli->SetObjAreaAndScale( aArea.SVRect(), aScaleWidth, aScaleHeight );
+}
+
+
+
+void SwWrtShell::ConnectObj( svt::EmbeddedObjectRef& xObj, const SwRect &rPrt,
+ const SwRect &rFrm )
+{
+ SfxInPlaceClient* pCli = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin());
+ if ( !pCli )
+ pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
+ CalcAndSetScale( xObj, &rPrt, &rFrm );
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Einfuegen harter Seitenumbruch;
+ Selektionen werden ueberschrieben
+------------------------------------------------------------------------*/
+
+
+
+void SwWrtShell::InsertPageBreak(const String *pPageDesc, USHORT nPgNum )
+{
+ ResetCursorStack();
+ if( _CanInsert() )
+ {
+ ACT_KONTEXT(this);
+ StartUndo(UNDO_UI_INSERT_PAGE_BREAK);
+
+ if ( !IsCrsrInTbl() )
+ {
+ if(HasSelection())
+ DelRight();
+ SwFEShell::SplitNode();
+ }
+
+ const SwPageDesc *pDesc = pPageDesc
+ ? FindPageDescByName( *pPageDesc, TRUE ) : 0;
+ if( pDesc )
+ {
+ SwFmtPageDesc aDesc( pDesc );
+ aDesc.SetNumOffset( nPgNum );
+ SetAttr( aDesc );
+ }
+ else
+ SetAttr( SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK) );
+ EndUndo(UNDO_UI_INSERT_PAGE_BREAK);
+ }
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Einfuegen harter Zeilenumbruch;
+ Selektionen werden ueberschrieben
+------------------------------------------------------------------------*/
+
+
+void SwWrtShell::InsertLineBreak()
+{
+ ResetCursorStack();
+ if( _CanInsert() )
+ {
+ if(HasSelection())
+ DelRight();
+
+ const sal_Unicode cIns = 0x0A;
+ SvxAutoCorrect* pACorr = lcl_IsAutoCorr();
+ if( pACorr )
+ AutoCorrect( *pACorr, cIns );
+ else
+ SwWrtShell::Insert( String( cIns ) );
+ }
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Einfuegen harter Spaltenumbruch;
+ Selektionen werden ueberschrieben
+------------------------------------------------------------------------*/
+
+
+void SwWrtShell::InsertColumnBreak()
+{
+ ACT_KONTEXT(this);
+ ResetCursorStack();
+ if( _CanInsert() )
+ {
+ StartUndo(UNDO_UI_INSERT_COLUMN_BREAK);
+
+ if ( !IsCrsrInTbl() )
+ {
+ if(HasSelection())
+ DelRight();
+ SwFEShell::SplitNode( FALSE, FALSE );
+ }
+ SetAttr(SvxFmtBreakItem(SVX_BREAK_COLUMN_BEFORE, RES_BREAK));
+
+ EndUndo(UNDO_UI_INSERT_COLUMN_BREAK);
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Einfuegen Fussnote
+ Parameter: rStr -- optionales Fussnotenzeichen
+------------------------------------------------------------------------*/
+
+
+void SwWrtShell::InsertFootnote(const String &rStr, BOOL bEndNote, BOOL bEdit )
+{
+ ResetCursorStack();
+ if( _CanInsert() )
+ {
+ if(HasSelection())
+ {
+ //collapse cursor to the end
+ if(!IsCrsrPtAtEnd())
+ SwapPam();
+ ClearMark();
+ }
+
+ SwFmtFtn aFootNote( bEndNote );
+ if(rStr.Len())
+ aFootNote.SetNumStr( rStr );
+
+ SetAttr(aFootNote);
+
+ if( bEdit )
+ {
+ // zur Bearbeiung des Fussnotentextes
+ Left(CRSR_SKIP_CHARS, FALSE, 1, FALSE );
+ GotoFtnTxt();
+ }
+ }
+}
+/*------------------------------------------------------------------------
+ Beschreibung: SplitNode; hier auch, da
+ - selektierter Inhalt geloescht wird;
+ - der Cursorstack gfs. zurueckgesetzt wird.
+------------------------------------------------------------------------*/
+
+
+void SwWrtShell::SplitNode( BOOL bAutoFmt, BOOL bCheckTableStart )
+{
+ ResetCursorStack();
+ if( _CanInsert() )
+ {
+ ACT_KONTEXT(this);
+
+ rView.GetEditWin().FlushInBuffer();
+ BOOL bHasSel = HasSelection();
+ if( bHasSel )
+ {
+ StartUndo( UNDO_INSERT );
+ DelRight();
+ }
+
+ SwFEShell::SplitNode( bAutoFmt, bCheckTableStart );
+ if( bHasSel )
+ EndUndo( UNDO_INSERT );
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Numerierung anschalten
+ Parameter: Optionale Angabe eines Namens fuer die benannte Liste;
+ dieser bezeichnet eine Position, wenn er in eine
+ Zahl konvertierbar ist und kleiner ist als nMaxRules.
+-------------------------------------------------------------------------*/
+
+
+// zum Testen der CharFormate an der Numerierung
+// extern void SetNumChrFmt( SwWrtShell*, SwNumRules& );
+
+// -> #i40041#
+// --> OD 2005-10-25 #b6340308#
+// Preconditions (as far as OD has figured out):
+// - <SwEditShell::HasNumber()> is FALSE, if <bNum> is TRUE
+// - <SwEditShell::HasBullet()> is FALSE, if <bNum> is FALSE
+// Behavior of method is determined by the current situation at the current
+// cursor position in the document.
+void SwWrtShell::NumOrBulletOn(BOOL bNum)
+{
+ // determine numbering rule found at current cursor position in the docment.
+ const SwNumRule* pCurRule = GetCurNumRule();
+
+ StartUndo(UNDO_NUMORNONUM);
+
+ const SwNumRule * pNumRule = pCurRule;
+
+ // --> OD 2005-10-25 #b6340308#
+ // - activate outline rule respectively turning on outline rule for
+ // current text node. But, only for turning on a numbering (<bNum> == TRUE).
+ // - overwrite found numbering rule at current cursor position, if
+ // no numbering rule can be retrieved from the paragraph style.
+ bool bContinueFoundNumRule( false );
+ bool bActivateOutlineRule( false );
+ int nActivateOutlineLvl( MAXLEVEL ); // only relevant, if <bActivateOutlineRule> == TRUE
+ SwTxtFmtColl * pColl = GetCurTxtFmtColl();
+ if ( pColl )
+ {
+ // --> OD 2005-10-25 #b6340308# - retrieve numbering rule at paragraph
+ // style, which is found at current cursor position in the document.
+ SwNumRule* pCollRule = pDoc->FindNumRulePtr(pColl->GetNumRule().GetValue());
+ // --> OD 2005-10-25 #125993# - The outline numbering rule isn't allowed
+ // to be derived from a parent paragraph style to a derived one.
+ // Thus check, if the found outline numbering rule is directly
+ // set at the paragraph style <pColl>. If not, set <pCollRule> to NULL
+ if ( pCollRule && pCollRule == GetDoc()->GetOutlineNumRule() )
+ {
+ const SwNumRule* pDirectCollRule =
+ pDoc->FindNumRulePtr(pColl->GetNumRule( FALSE ).GetValue());
+ if ( !pDirectCollRule )
+ {
+ pCollRule = 0;
+ }
+ }
+ // --> OD 2006-11-20 #i71764#
+ // Document setting OUTLINE_LEVEL_YIELDS_OUTLINE_RULE has no influence
+ // any more.
+// if ( pCollRule == NULL &&
+// NO_NUMBERING != pColl->GetOutlineLevel() &&
+// GetDoc()->get(IDocumentSettingAccess::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE) )
+// {
+// pCollRule = GetDoc()->GetOutlineNumRule();
+// }
+ // <--
+
+ // <--
+ // --> OD 2005-10-25 #b6340308#
+ if ( !pCollRule )
+ {
+ pNumRule = pCollRule;
+ }
+ // --> OD 2006-06-12 #b6435904#
+ // no activation or continuation of outline numbering in Writer/Web document
+ else if ( bNum &&
+ !dynamic_cast<SwWebDocShell*>(GetDoc()->GetDocShell()) &&
+ pCollRule == GetDoc()->GetOutlineNumRule() )
+ // <--
+ {
+ if ( pNumRule == pCollRule )
+ {
+ // check, if text node at current cursor positioned is counted.
+ // If not, let it been counted. Then it has to be checked,
+ // of the outline numbering has to be activated or continued.
+ SwTxtNode* pTxtNode =
+ GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+ if ( pTxtNode && !pTxtNode->IsCountedInList() )
+ {
+ // check, if numbering of the outline level of the pararaph
+ // style is active. If not, activate this outline level.
+ nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
+ ASSERT( pColl->IsAssignedToListLevelOfOutlineStyle(), //<-end,zhaojianwei
+ "<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
+ if ( pColl->IsAssignedToListLevelOfOutlineStyle() && //<-end,zhaojianwei
+ pCollRule->Get( static_cast<USHORT>(nActivateOutlineLvl) ).GetNumberingType()
+ == SVX_NUM_NUMBER_NONE )
+ {
+ // activate outline numbering
+ bActivateOutlineRule = true;
+ }
+ else
+ {
+ // turning on outline numbering at current cursor position
+ bContinueFoundNumRule = true;
+ }
+ }
+ else
+ {
+ // --> OD 2009-08-27 #i101234#
+ // activate outline numbering, because from the precondition
+ // it's known, that <SwEdit::HasNumber()> == FALSE
+ bActivateOutlineRule = true;
+ nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//<-end,zhaojianwei
+ }
+ }
+ else if ( !pNumRule )
+ {
+ // --> OD 2009-08-27 #i101234#
+ // Check, if corresponding list level of the outline numbering
+ // has already a numbering format set.
+ nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//<-end,zhaojianwei,need further consideration
+ if ( pCollRule->Get( static_cast<USHORT>(nActivateOutlineLvl) ).GetNumberingType()
+ == SVX_NUM_NUMBER_NONE )
+ {
+ // activate outline numbering, because from the precondition
+ // it's known, that <SwEdit::HasNumber()> == FALSE
+ bActivateOutlineRule = true;
+ }
+ else
+ {
+ // turning on outline numbering at current cursor position
+ bContinueFoundNumRule = true;
+ }
+ // <--
+ }
+ else
+ {
+ // check, if numbering of the outline level of the pararaph
+ // style is active. If not, activate this outline level.
+ nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//#outline level,zhaojianwei
+ ASSERT( pColl->IsAssignedToListLevelOfOutlineStyle(),//#outline level,zhaojianwei
+ "<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
+ if ( pColl->IsAssignedToListLevelOfOutlineStyle() &&//#outline level,zhaojianwei
+ pCollRule->Get( static_cast<USHORT>(nActivateOutlineLvl) ).GetNumberingType()
+ == SVX_NUM_NUMBER_NONE )
+ {
+ // activate outline numbering
+ bActivateOutlineRule = true;
+ }
+ else
+ {
+ // turning on outline numbering at current cursor position
+ bContinueFoundNumRule = true;
+ }
+ }
+ pNumRule = pCollRule;
+ }
+ }
+
+ // --> OD 2005-10-25 #b6340308#
+ // Only automatic numbering/bullet rules should be changed.
+ // Note: The outline numbering rule is also an automatic one. It's only
+ // changed, if it has to be activated.
+ if ( pNumRule )
+ {
+ if ( !pNumRule->IsAutoRule() )
+ {
+ pNumRule = 0;
+ }
+ else if ( pNumRule == GetDoc()->GetOutlineNumRule() &&
+ !bActivateOutlineRule && !bContinueFoundNumRule )
+ {
+ pNumRule = 0;
+ }
+ }
+ // <--
+
+ // --> OD 2005-10-25 #b6340308#
+ // Search for a previous numbering/bullet rule to continue it.
+ // --> OD 2008-03-18 #refactorlists#
+ String sContinuedListId;
+ if ( !pNumRule )
+ {
+ pNumRule = GetDoc()->SearchNumRule( *GetCrsr()->GetPoint(),
+ false, bNum, false, 0,
+ sContinuedListId );
+ bContinueFoundNumRule = pNumRule != 0;
+ }
+ // <--
+
+ if (pNumRule)
+ {
+ SwNumRule aNumRule(*pNumRule);
+
+ // --> OD 2005-10-25 #b6340308#
+ // do not change found numbering/bullet rule, if it should only be continued.
+ if ( !bContinueFoundNumRule )
+ {
+ SwTxtNode * pTxtNode = GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+
+ if (pTxtNode)
+ {
+ // --> OD 2005-10-26 #b6340308# - use above retrieve outline
+ // level, if outline numbering has to be activated.
+ int nLevel = bActivateOutlineRule ////#outline level,zhaojianwei,need more consideration
+ ? nActivateOutlineLvl
+ : pTxtNode->GetActualListLevel();
+ // <--
+
+ if (nLevel < 0)
+ nLevel = 0;
+
+ if (nLevel >= MAXLEVEL)
+ nLevel = MAXLEVEL - 1;
+
+ SwNumFmt aFmt(aNumRule.Get(static_cast<USHORT>(nLevel)));
+
+ if (bNum)
+ aFmt.SetNumberingType(SVX_NUM_ARABIC);
+ else
+ {
+ // --> OD 2008-06-03 #i63395#
+ // Only apply user defined default bullet font
+ if ( numfunc::IsDefBulletFontUserDefined() )
+ {
+ const Font* pFnt = &numfunc::GetDefBulletFont();
+ aFmt.SetBulletFont( pFnt );
+ }
+ // <--
+ aFmt.SetBulletChar( numfunc::GetBulletChar(static_cast<BYTE>(nLevel)));
+ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ }
+ aNumRule.Set(static_cast<USHORT>(nLevel), aFmt);
+ }
+ }
+ // <--
+
+ // --> OD 2008-02-08 #newlistlevelattrs#
+ // reset indent attribute on applying list style
+ // --> OD 2008-03-27 #refactorlists#
+ SetCurNumRule( aNumRule, false, sContinuedListId, true );
+ // <--
+ }
+ else
+ {
+ // --> OD 2009-08-27 #i95907#
+ const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
+ numfunc::GetDefaultPositionAndSpaceMode() );
+ // --> OD 2008-02-11 #newlistlevelattrs#
+ SwNumRule aNumRule( GetUniqueNumRuleName(), ePosAndSpaceMode );
+ // <--
+ // <--
+ // Zeichenvorlage an die Numerierung haengen
+ SwCharFmt* pChrFmt;
+ SwDocShell* pDocSh = GetView().GetDocShell();
+ // --> OD 2008-06-03 #i63395#
+ // Only apply user defined default bullet font
+ const Font* pFnt = numfunc::IsDefBulletFontUserDefined()
+ ? &numfunc::GetDefBulletFont()
+ : 0;
+ // <--
+
+ if (bNum)
+ {
+ pChrFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
+ }
+ else
+ {
+ pChrFmt = GetCharFmtFromPool( RES_POOLCHR_BUL_LEVEL );
+ }
+
+ const SwTxtNode* pTxtNode = GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+ const SwTwips nWidthOfTabs = pTxtNode
+ ? pTxtNode->GetWidthOfLeadingTabs()
+ : 0;
+ GetDoc()->RemoveLeadingWhiteSpace( *GetCrsr()->GetPoint() );
+
+ const bool bHtml = 0 != PTR_CAST(SwWebDocShell, pDocSh);
+ const bool bRightToLeft = IsInRightToLeftText();
+ for( BYTE nLvl = 0; nLvl < MAXLEVEL; ++nLvl )
+ {
+ SwNumFmt aFmt( aNumRule.Get( nLvl ) );
+ aFmt.SetCharFmt( pChrFmt );
+
+ if (! bNum)
+ {
+ // --> OD 2008-06-03 #i63395#
+ // Only apply user defined default bullet font
+ if ( pFnt )
+ {
+ aFmt.SetBulletFont( pFnt );
+ }
+ aFmt.SetBulletChar( numfunc::GetBulletChar(nLvl) );
+ aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
+ }
+
+ // --> OD 2009-08-26 #i95907#
+ if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
+ {
+ if(bHtml && nLvl)
+ {
+ // 1/2" fuer HTML
+ aFmt.SetLSpace(720);
+ aFmt.SetAbsLSpace(nLvl * 720);
+ }
+ else if ( nWidthOfTabs > 0 )
+ {
+ aFmt.SetAbsLSpace(nWidthOfTabs + nLvl * 720);
+ }
+ }
+ // <--
+
+ // --> FME 2005-01-21 #i38904# Default alignment for
+ // numbering/bullet should be rtl in rtl paragraph:
+ if ( bRightToLeft )
+ {
+ aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
+ }
+ // <--
+
+ aNumRule.Set( nLvl, aFmt );
+ }
+
+ // --> OD 2009-08-26 #i95907#
+ if ( pTxtNode &&
+ ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ // --> OD 2010-01-05 #b6884103#
+// short nTxtNodeFirstLineOffset( 0 );
+// pTxtNode->GetFirstLineOfsWithNum( nTxtNodeFirstLineOffset );
+// const SwTwips nTxtNodeIndent = pTxtNode->GetLeftMarginForTabCalculation() +
+// nTxtNodeFirstLineOffset;
+ const SwTwips nTxtNodeIndent = pTxtNode->GetAdditionalIndentForStartingNewList();
+ // <--
+ if ( ( nTxtNodeIndent + nWidthOfTabs ) != 0 )
+ {
+ // --> OD 2010-05-05 #i111172#
+ // If text node is already inside a list, assure that the indents
+ // are the same. Thus, adjust the indent change value by subtracting
+ // indents of to be applied list style.
+ SwTwips nIndentChange = nTxtNodeIndent + nWidthOfTabs;
+ if ( pTxtNode->GetNumRule() )
+ {
+ const SwNumFmt aFmt( aNumRule.Get( 0 ) );
+ if ( aFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
+ {
+ nIndentChange -= aFmt.GetIndentAt() + aFmt.GetFirstLineIndent();
+ }
+ }
+ // <--
+ aNumRule.ChangeIndent( nIndentChange );
+ }
+ }
+ // <--
+ // --> OD 2008-02-08 #newlistlevelattrs#
+ // reset indent attribute on applying list style
+ // --> OD 2008-03-17 #refactorlists#
+ // start new list
+ SetCurNumRule( aNumRule, true, String(), true );
+ // <--
+ }
+
+ EndUndo(UNDO_NUMORNONUM);
+}
+// <- #i40041#
+
+void SwWrtShell::NumOn()
+{
+ NumOrBulletOn(TRUE);
+}
+
+void SwWrtShell::NumOrBulletOff()
+{
+ const SwNumRule * pCurNumRule = GetCurNumRule();
+
+ if (pCurNumRule)
+ {
+ if (pCurNumRule->IsOutlineRule())
+ {
+ SwNumRule aNumRule(*pCurNumRule);
+
+ SwTxtNode * pTxtNode =
+ GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+
+ if (pTxtNode)
+ {
+ sal_uInt16 nLevel = sal::static_int_cast<sal_uInt16, sal_Int32>(pTxtNode->GetActualListLevel());
+ SwNumFmt aFmt(aNumRule.Get(nLevel));
+
+ aFmt.SetNumberingType(SVX_NUM_NUMBER_NONE);
+ aNumRule.Set(nLevel, aFmt);
+
+ // --> OD 2008-03-17 #refactorlists#
+ // no start or continuation of a list - the outline style is only changed.
+ SetCurNumRule( aNumRule, false );
+ // <--
+ }
+ }
+ else
+ {
+ DelNumRules();
+ }
+
+ // --> OD 2005-10-24 #126346# - Cursor can not be anymore in front of
+ // a label, because numbering/bullet is switched off.
+ SetInFrontOfLabel( FALSE );
+ // <--
+ }
+}
+// <- #i29560#
+
+/*------------------------------------------------------------------------
+ Beschreibung: Default-Bulletliste erfragen
+------------------------------------------------------------------------*/
+
+void SwWrtShell::BulletOn()
+{
+ NumOrBulletOn(FALSE);
+}
+
+
+/*--------------------------------------------------
+
+--------------------------------------------------*/
+SelectionType SwWrtShell::GetSelectionType() const
+{
+ // ContentType kann nicht ermittelt werden innerhalb einer
+ // Start-/Endactionklammerung.
+ // Da es keinen ungueltigen Wert gibt, wird TEXT geliefert.
+ // Der Wert ist egal, da in EndAction ohnehin aktualisiert wird.
+
+ if ( BasicActionPend() )
+ return IsSelFrmMode() ? nsSelectionType::SEL_FRM : nsSelectionType::SEL_TXT;
+
+// if ( IsTableMode() )
+// return nsSelectionType::SEL_TBL | nsSelectionType::SEL_TBL_CELLS;
+
+ SwView &_rView = ((SwView&)GetView());
+ if (_rView.GetPostItMgr() && _rView.GetPostItMgr()->HasActiveSidebarWin() )
+ return nsSelectionType::SEL_POSTIT;
+ int nCnt;
+
+ // Rahmen einfuegen ist kein DrawMode
+ if ( !_rView.GetEditWin().IsFrmAction() &&
+ (IsObjSelected() || (_rView.IsDrawMode() && !IsFrmSelected()) ))
+ {
+ if (GetDrawView()->IsTextEdit())
+ nCnt = nsSelectionType::SEL_DRW_TXT;
+ else
+ {
+ if (GetView().IsFormMode()) // Nur Forms selektiert
+ nCnt = nsSelectionType::SEL_DRW_FORM;
+ else
+ nCnt = nsSelectionType::SEL_DRW; // Irgendein Draw-Objekt
+
+ if (_rView.IsBezierEditMode())
+ nCnt |= nsSelectionType::SEL_BEZ;
+ else if( GetDrawView()->GetContext() == SDRCONTEXT_MEDIA )
+ nCnt |= nsSelectionType::SEL_MEDIA;
+
+ if (svx::checkForSelectedCustomShapes(
+ const_cast<SdrView *>(GetDrawView()),
+ true /* bOnlyExtruded */ ))
+ {
+ nCnt |= nsSelectionType::SEL_EXTRUDED_CUSTOMSHAPE;
+ }
+ sal_uInt32 nCheckStatus = 0;
+ if (svx::checkForSelectedFontWork(
+ const_cast<SdrView *>(GetDrawView()), nCheckStatus ))
+ {
+ nCnt |= nsSelectionType::SEL_FONTWORK;
+ }
+ }
+
+ return nCnt;
+ }
+
+ nCnt = GetCntType();
+
+ if ( IsFrmSelected() )
+ {
+ if (_rView.IsDrawMode())
+ _rView.LeaveDrawCreate(); // Aufraeumen (Bug #45639)
+ if ( !(nCnt & (CNT_GRF | CNT_OLE)) )
+ return nsSelectionType::SEL_FRM;
+ }
+
+ if ( IsCrsrInTbl() )
+ nCnt |= nsSelectionType::SEL_TBL;
+
+ if ( IsTableMode() )
+ nCnt |= (nsSelectionType::SEL_TBL | nsSelectionType::SEL_TBL_CELLS);
+
+ // --> FME 2005-01-12 #i39855#
+ // Do not pop up numbering toolbar, if the text node has a numbering
+ // of type SVX_NUM_NUMBER_NONE.
+ const SwNumRule* pNumRule = GetCurNumRule();
+ if ( pNumRule )
+ {
+ const SwTxtNode* pTxtNd =
+ GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode();
+
+ // --> OD 2008-03-19 #refactorlists#
+ if ( pTxtNd && pTxtNd->IsInList() )
+ // <--
+ {
+ const SwNumFmt& rFmt = pNumRule->Get(sal::static_int_cast< sal_uInt8, sal_Int32>(pTxtNd->GetActualListLevel()));
+ if ( SVX_NUM_NUMBER_NONE != rFmt.GetNumberingType() )
+ nCnt |= nsSelectionType::SEL_NUM;
+ }
+ }
+ // <--
+
+ return nCnt;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Finden der TextCollection mit dem Name rCollname
+ Return: Pointer auf die Collection oder 0, wenn keine
+ TextCollection mit diesem Namen existiert oder
+ diese eine Defaultvorlage ist.
+------------------------------------------------------------------------*/
+
+
+SwTxtFmtColl *SwWrtShell::GetParaStyle(const String &rCollName, GetStyle eCreate )
+{
+ SwTxtFmtColl* pColl = FindTxtFmtCollByName( rCollName );
+ if( !pColl && GETSTYLE_NOCREATE != eCreate )
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName( rCollName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL );
+ if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate )
+ pColl = GetTxtCollFromPool( nId );
+ }
+ return pColl;
+}
+/*------------------------------------------------------------------------
+ Beschreibung: Finden der Zeichenvorlage mit dem Name rCollname
+ Return: Pointer auf die Collection oder 0, wenn keine
+ Zeichenvorlage mit diesem Namen existiert oder
+ diese eine Defaultvorlage oder automatische Vorlage ist.
+------------------------------------------------------------------------*/
+
+
+
+SwCharFmt *SwWrtShell::GetCharStyle(const String &rFmtName, GetStyle eCreate )
+{
+ SwCharFmt* pFmt = FindCharFmtByName( rFmtName );
+ if( !pFmt && GETSTYLE_NOCREATE != eCreate )
+ {
+ USHORT nId = SwStyleNameMapper::GetPoolIdFromUIName( rFmtName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
+ if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate )
+ pFmt = (SwCharFmt*)GetFmtFromPool( nId );
+ }
+ return pFmt;
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Finden des Tabellenformates mit dem Name rFmtname
+ Return: Pointer auf das Format oder 0, wenn kein
+ Rahmenformat mit diesem Namen existiert oder
+ dieses eine Defaultformat oder automatisches Format ist.
+------------------------------------------------------------------------*/
+
+
+
+SwFrmFmt *SwWrtShell::GetTblStyle(const String &rFmtName)
+{
+ SwFrmFmt *pFmt = 0;
+ for( USHORT i = GetTblFrmFmtCount(); i; )
+ if( !( pFmt = &GetTblFrmFmt( --i ) )->IsDefault() &&
+ pFmt->GetName() == rFmtName && IsUsed( *pFmt ) )
+ return pFmt;
+ return 0;
+}
+
+
+/*------------------------------------------------------------------------
+ Beschreibung: Anwenden der Vorlagen
+------------------------------------------------------------------------*/
+
+
+
+void SwWrtShell::SetPageStyle(const String &rCollName)
+{
+ if( !SwCrsrShell::HasSelection() && !IsSelFrmMode() && !IsObjSelected() )
+ {
+ SwPageDesc* pDesc = FindPageDescByName( rCollName, TRUE );
+ if( pDesc )
+ ChgCurPageDesc( *pDesc );
+ }
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Zugriff Vorlagen
+------------------------------------------------------------------------*/
+
+
+
+String SwWrtShell::GetCurPageStyle( const BOOL bCalcFrm ) const
+{
+ return GetPageDesc(GetCurPageDesc( bCalcFrm )).GetName();
+}
+
+/*------------------------------------------------------------------------
+ Beschreibung: Aktuelle Vorlage anhand der geltenden Attribute aendern
+------------------------------------------------------------------------*/
+
+
+void SwWrtShell::QuickUpdateStyle()
+{
+ SwTxtFmtColl *pColl = GetCurTxtFmtColl();
+
+ // Standard kann nicht geaendert werden
+ if(pColl && !pColl->IsDefault())
+ {
+ FillByEx(pColl);
+ // Vorlage auch anwenden, um harte Attributierung
+ // zu entfernen
+ SetTxtFmtColl(pColl);
+ }
+}
+
+
+void SwWrtShell::AutoUpdatePara(SwTxtFmtColl* pColl, const SfxItemSet& rStyleSet)
+{
+ SfxItemSet aCoreSet( GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END - 1,
+ RES_PARATR_BEGIN, RES_PARATR_END - 1,
+ RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
+ SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS,
+ SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS,
+ SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
+ SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
+ SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
+ SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
+ 0 );
+ GetCurAttr( aCoreSet );
+ BOOL bReset = FALSE;
+ SfxItemIter aParaIter( aCoreSet );
+ const SfxPoolItem* pParaItem = aParaIter.FirstItem();
+ while( pParaItem )
+ {
+ if(!IsInvalidItem(pParaItem))
+ {
+ USHORT nWhich = pParaItem->Which();
+ if(SFX_ITEM_SET == aCoreSet.GetItemState(nWhich) &&
+ SFX_ITEM_SET == rStyleSet.GetItemState(nWhich))
+ {
+ aCoreSet.ClearItem(nWhich);
+ bReset = TRUE;
+ }
+ }
+ pParaItem = aParaIter.NextItem();
+ }
+ StartAction();
+ if(bReset)
+ {
+ ResetAttr();
+ SetAttr(aCoreSet);
+ }
+ pDoc->ChgFmt(*pColl, rStyleSet );
+ EndAction();
+}
+
+/*-----------------12.03.97 12.24-------------------
+
+--------------------------------------------------*/
+
+void SwWrtShell::AutoUpdateFrame( SwFrmFmt* pFmt, const SfxItemSet& rStyleSet )
+{
+ StartAction();
+
+ ResetFlyFrmAttr( 0, &rStyleSet );
+ pFmt->SetFmtAttr( rStyleSet );
+
+ EndAction();
+}
+
+
+void SwWrtShell::AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar )
+{
+ ResetCursorStack();
+ if(_CanInsert())
+ {
+ BOOL bStarted = FALSE;
+ if(HasSelection())
+ {
+ // nur hier klammern, da das normale Insert schon an der
+ // Editshell geklammert ist
+ StartAllAction();
+ StartUndo(UNDO_INSERT);
+ bStarted = TRUE;
+ DelRight();
+ }
+ SwEditShell::AutoCorrect( rACorr, IsInsMode(), cChar );
+
+ if(bStarted)
+ {
+ EndAllAction();
+ EndUndo(UNDO_INSERT);
+ }
+ }
+}
+
+
+/*
+ * eine Art kontrollierter copy ctor
+ */
+
+SwWrtShell::SwWrtShell( SwWrtShell& rSh, Window *_pWin, SwView &rShell )
+ : SwFEShell( rSh, _pWin ),
+ COMMON_INI_LIST
+{
+ BITFLD_INI_LIST
+ SET_CURR_SHELL( this );
+
+ SetSfxViewShell( (SfxViewShell *)&rShell );
+ SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) );
+
+ // place the cursor on the first field...
+ IFieldmark *pBM = NULL;
+ if ( IsFormProtected() && ( pBM = GetFieldmarkAfter( ) ) !=NULL ) {
+ GotoFieldmark(pBM);
+ }
+}
+
+
+SwWrtShell::SwWrtShell( SwDoc& rDoc, Window *_pWin, SwView &rShell,
+ const SwViewOption *pViewOpt )
+ : SwFEShell( rDoc, _pWin, pViewOpt),
+ COMMON_INI_LIST
+{
+ BITFLD_INI_LIST
+ SET_CURR_SHELL( this );
+ SetSfxViewShell( (SfxViewShell *)&rShell );
+ SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) );
+}
+
+/*
+ * ctor
+ */
+
+
+
+SwWrtShell::~SwWrtShell()
+{
+ SET_CURR_SHELL( this );
+ while(IsModePushed())
+ PopMode();
+ while(PopCrsr(FALSE))
+ ;
+ SwTransferable::ClearSelection( *this );
+}
+
+BOOL SwWrtShell::Pop( BOOL bOldCrsr )
+{
+ BOOL bRet = SwCrsrShell::Pop( bOldCrsr );
+ if( bRet && IsSelection() )
+ {
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ fnKillSel = &SwWrtShell::ResetSelect;
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+BOOL SwWrtShell::CanInsert()
+{
+ return (!(IsSelFrmMode() | IsObjSelected() | (GetView().GetDrawFuncPtr() != NULL) | (GetView().GetPostItMgr()->GetActiveSidebarWin()!= NULL)));
+}
+
+// die Core erzeugt eine Selektion, das SttSelect muss gerufen werden
+void SwWrtShell::NewCoreSelection()
+{
+ SttSelect();
+}
+
+// --------------
+void SwWrtShell::ChgDBData(const SwDBData& aDBData)
+{
+ SwEditShell::ChgDBData(aDBData);
+ //notify the db-beamer if available
+ GetView().NotifyDBChanged();
+}
+
+String SwWrtShell::GetSelDescr() const
+{
+ String aResult;
+
+ int nSelType = GetSelectionType();
+ switch (nSelType)
+ {
+ case nsSelectionType::SEL_GRF:
+ aResult = SW_RES(STR_GRAPHIC);
+
+ break;
+ case nsSelectionType::SEL_FRM:
+ {
+ const SwFrmFmt * pFrmFmt = GetCurFrmFmt();
+
+ if (pFrmFmt)
+ aResult = pFrmFmt->GetDescription();
+ }
+ break;
+ case nsSelectionType::SEL_DRW:
+ {
+ aResult = SW_RES(STR_DRAWING_OBJECTS);
+ }
+ break;
+ default:
+ if (0 != pDoc)
+ aResult = GetCrsrDescr();
+ }
+
+ return aResult;
+}
+
diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx
new file mode 100644
index 000000000000..7aa0c49087d2
--- /dev/null
+++ b/sw/source/ui/wrtsh/wrtsh2.cxx
@@ -0,0 +1,498 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <hintids.hxx> // define ITEMIDs
+#include <svl/macitem.hxx>
+#include <sfx2/frame.hxx>
+#include <vcl/msgbox.hxx>
+#include <svl/urihelper.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/fcontnr.hxx>
+#include <sfx2/dispatch.hxx>
+#include <sfx2/linkmgr.hxx>
+#include <fmtinfmt.hxx>
+#include <frmatr.hxx>
+#include <swtypes.hxx> // SET_CURR_SHELL
+#include <wrtsh.hxx>
+#include <docsh.hxx>
+#include <fldbas.hxx> // Felder
+#include <expfld.hxx>
+#include <ddefld.hxx>
+#include <docufld.hxx>
+#include <reffld.hxx>
+#include <swundo.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <viewopt.hxx> // SwViewOptions
+#include <frmfmt.hxx> // fuer UpdateTable
+#include <swtable.hxx> // fuer UpdateTable
+#include <mdiexp.hxx>
+#include <view.hxx>
+#include <swevent.hxx>
+#include <poolfmt.hxx>
+#include <section.hxx>
+#include <navicont.hxx>
+#include <navipi.hxx>
+#include <crsskip.hxx>
+#include <txtinet.hxx>
+#include <cmdid.h>
+#include <wrtsh.hrc>
+#include "swabstdlg.hxx"
+#include "fldui.hrc"
+#include <SwRewriter.hxx>
+
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+
+
+/*------------------------------------------------------------------------
+ Beschreibung:
+------------------------------------------------------------------------*/
+
+void SwWrtShell::Insert(SwField &rFld)
+{
+ ResetCursorStack();
+ if(!_CanInsert())
+ return;
+ StartAllAction();
+
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UNDO_ARG1, rFld.GetDescription());
+
+ StartUndo(UNDO_INSERT, &aRewriter);
+
+ bool bDeleted = false;
+ if( HasSelection() )
+ {
+ bDeleted = DelRight() != 0;
+ }
+
+ SwEditShell::Insert2(rFld, bDeleted);
+ EndUndo();
+ EndAllAction();
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Felder Update anschmeissen
+ --------------------------------------------------------------------*/
+
+
+
+void SwWrtShell::UpdateInputFlds( SwInputFieldList* pLst, BOOL bOnlyInSel )
+{
+ // ueber die Liste der Eingabefelder gehen und Updaten
+ SwInputFieldList* pTmp = pLst;
+ if( !pTmp )
+ pTmp = new SwInputFieldList( this );
+
+ if (bOnlyInSel)
+ pTmp->RemoveUnselectedFlds();
+
+ const USHORT nCnt = pTmp->Count();
+ if(nCnt)
+ {
+ pTmp->PushCrsr();
+
+ BOOL bCancel = FALSE;
+ ByteString aDlgPos;
+ for( USHORT i = 0; i < nCnt && !bCancel; ++i )
+ {
+ pTmp->GotoFieldPos( i );
+ SwField* pField = pTmp->GetField( i );
+ if(pField->GetTyp()->Which() == RES_DROPDOWN)
+ bCancel = StartDropDownFldDlg( pField, TRUE, &aDlgPos );
+ else
+ bCancel = StartInputFldDlg( pField, TRUE, 0, &aDlgPos);
+
+ // Sonst Updatefehler bei Multiselektion:
+ pTmp->GetField( i )->GetTyp()->UpdateFlds();
+ }
+ pTmp->PopCrsr();
+ }
+
+ if( !pLst )
+ delete pTmp;
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: EingabeDialog fuer ein bestimmtes Feld starten
+ --------------------------------------------------------------------*/
+
+
+
+BOOL SwWrtShell::StartInputFldDlg( SwField* pFld, BOOL bNextButton,
+ Window* pParentWin, ByteString* pWindowState )
+{
+//JP 14.08.96: Bug 30332 - nach Umbau der modularietaet im SFX, muss jetzt
+// das TopWindow der Application benutzt werden.
+// SwFldInputDlg* pDlg = new SwFldInputDlg( GetWin(), *this, pFld );
+
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "Dialogdiet fail!");
+ AbstractFldInputDlg* pDlg = pFact->CreateFldInputDlg( DLG_FLD_INPUT,
+ pParentWin, *this, pFld, bNextButton);
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if(pWindowState && pWindowState->Len())
+ pDlg->SetWindowState(*pWindowState);
+ BOOL bRet = RET_CANCEL == pDlg->Execute();
+ if(pWindowState)
+ *pWindowState = pDlg->GetWindowState();
+
+ delete pDlg;
+ GetWin()->Update();
+ return bRet;
+}
+/* -----------------17.06.2003 10:18-----------------
+
+ --------------------------------------------------*/
+BOOL SwWrtShell::StartDropDownFldDlg(SwField* pFld, BOOL bNextButton, ByteString* pWindowState)
+{
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
+
+ AbstractDropDownFieldDialog* pDlg = pFact->CreateDropDownFieldDialog( NULL, *this, pFld, DLG_FLD_DROPDOWN ,bNextButton );
+ DBG_ASSERT(pDlg, "Dialogdiet fail!");
+ if(pWindowState && pWindowState->Len())
+ pDlg->SetWindowState(*pWindowState);
+ USHORT nRet = pDlg->Execute();
+ if(pWindowState)
+ *pWindowState = pDlg->GetWindowState();
+ delete pDlg;
+ BOOL bRet = RET_CANCEL == nRet;
+ GetWin()->Update();
+ if(RET_YES == nRet)
+ {
+ GetView().GetViewFrame()->GetDispatcher()->Execute(FN_EDIT_FIELD, SFX_CALLMODE_SYNCHRON);
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnis einfuegen Selektion loeschen
+ --------------------------------------------------------------------*/
+
+
+
+void SwWrtShell::InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
+{
+ if(!_CanInsert())
+ return;
+
+ if(HasSelection())
+ DelRight();
+
+ SwEditShell::InsertTableOf(rTOX, pSet);
+}
+
+
+/*--------------------------------------------------------------------
+ Beschreibung: Verzeichnis Updaten Selektion loeschen
+ --------------------------------------------------------------------*/
+
+BOOL SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet)
+{
+ BOOL bResult = FALSE;
+
+ if(_CanInsert())
+ {
+ bResult = SwEditShell::UpdateTableOf(rTOX, pSet);
+
+ if (pSet == NULL)
+ {
+ SwDoc *const pDoc_ = GetDoc();
+ if (pDoc_)
+ {
+ pDoc_->GetIDocumentUndoRedo().DelAllUndoObj();
+ }
+ }
+ }
+
+ return bResult;
+}
+
+// handler for click on the field given as parameter.
+// the cursor is positioned on the field.
+
+
+void SwWrtShell::ClickToField( const SwField& rFld )
+{
+ bIsInClickToEdit = TRUE;
+ switch( rFld.GetTyp()->Which() )
+ {
+ case RES_JUMPEDITFLD:
+ {
+ USHORT nSlotId = 0;
+ switch( rFld.GetFormat() )
+ {
+ case JE_FMT_TABLE:
+ nSlotId = FN_INSERT_TABLE;
+ break;
+
+ case JE_FMT_FRAME:
+ nSlotId = FN_INSERT_FRAME;
+ break;
+
+ case JE_FMT_GRAPHIC: nSlotId = SID_INSERT_GRAPHIC; break;
+ case JE_FMT_OLE: nSlotId = SID_INSERT_OBJECT; break;
+
+// case JE_FMT_TEXT:
+ }
+
+ Right( CRSR_SKIP_CHARS, TRUE, 1, FALSE ); // Feld selektieren
+
+ if( nSlotId )
+ {
+ StartUndo( UNDO_START );
+ //#97295# immediately select the right shell
+ GetView().StopShellTimer();
+ GetView().GetViewFrame()->GetDispatcher()->Execute( nSlotId,
+ SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD );
+ EndUndo( UNDO_END );
+ }
+ }
+ break;
+
+ case RES_MACROFLD:
+ {
+ const SwMacroField *pFld = (const SwMacroField*)&rFld;
+ String sText( rFld.GetPar2() );
+ String sRet( sText );
+ ExecMacro( pFld->GetSvxMacro(), &sRet );
+
+ // return Wert veraendert?
+ if( sRet != sText )
+ {
+ StartAllAction();
+ ((SwField&)rFld).SetPar2( sRet );
+ ((SwField&)rFld).GetTyp()->UpdateFlds();
+ EndAllAction();
+ }
+ }
+ break;
+
+ case RES_GETREFFLD:
+ StartAllAction();
+ SwCrsrShell::GotoRefMark( ((SwGetRefField&)rFld).GetSetRefName(),
+ ((SwGetRefField&)rFld).GetSubType(),
+ ((SwGetRefField&)rFld).GetSeqNo() );
+ EndAllAction();
+ break;
+
+ case RES_INPUTFLD:
+ StartInputFldDlg( (SwField*)&rFld, FALSE );
+ break;
+
+ case RES_SETEXPFLD:
+ if( ((SwSetExpField&)rFld).GetInputFlag() )
+ StartInputFldDlg( (SwField*)&rFld, FALSE );
+ break;
+ case RES_DROPDOWN :
+ StartDropDownFldDlg( (SwField*)&rFld, FALSE );
+ break;
+ }
+
+ bIsInClickToEdit = FALSE;
+}
+
+
+
+void SwWrtShell::ClickToINetAttr( const SwFmtINetFmt& rItem, USHORT nFilter )
+{
+ if( !rItem.GetValue().Len() )
+ return ;
+
+ bIsInClickToEdit = TRUE;
+
+ // erstmal das evt. gesetzte ObjectSelect Macro ausfuehren
+ const SvxMacro* pMac = rItem.GetMacro( SFX_EVENT_MOUSECLICK_OBJECT );
+ if( pMac )
+ {
+ SwCallMouseEvent aCallEvent;
+ aCallEvent.Set( &rItem );
+ GetDoc()->CallEvent( SFX_EVENT_MOUSECLICK_OBJECT, aCallEvent, FALSE );
+ }
+
+ // damit die Vorlagenumsetzung sofort angezeigt wird
+ ::LoadURL( rItem.GetValue(), this, nFilter, &rItem.GetTargetFrame() );
+ const SwTxtINetFmt* pTxtAttr = rItem.GetTxtINetFmt();
+ if( pTxtAttr )
+ {
+ const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisited( true );
+ const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid( true );
+ }
+
+ bIsInClickToEdit = FALSE;
+}
+
+
+
+BOOL SwWrtShell::ClickToINetGrf( const Point& rDocPt, USHORT nFilter )
+{
+ BOOL bRet = FALSE;
+ String sURL;
+ String sTargetFrameName;
+ const SwFrmFmt* pFnd = IsURLGrfAtPos( rDocPt, &sURL, &sTargetFrameName );
+ if( pFnd && sURL.Len() )
+ {
+ bRet = TRUE;
+ // erstmal das evt. gesetzte ObjectSelect Macro ausfuehren
+ const SvxMacro* pMac = &pFnd->GetMacro().GetMacro( SFX_EVENT_MOUSECLICK_OBJECT );
+ if( pMac )
+ {
+ SwCallMouseEvent aCallEvent;
+ aCallEvent.Set( EVENT_OBJECT_URLITEM, pFnd );
+ GetDoc()->CallEvent( SFX_EVENT_MOUSECLICK_OBJECT, aCallEvent, FALSE );
+ }
+
+ ::LoadURL( sURL, this, nFilter, &sTargetFrameName);
+ }
+ return bRet;
+}
+
+
+void LoadURL( const String& rURL, ViewShell* pVSh, USHORT nFilter,
+ const String *pTargetFrameName )
+{
+ ASSERT( rURL.Len() && pVSh, "was soll hier geladen werden?" );
+ if( !rURL.Len() || !pVSh )
+ return ;
+
+ // die Shell kann auch 0 sein !!!!!
+ SwWrtShell *pSh = 0;
+ if ( pVSh && pVSh->ISA(SwCrsrShell) )
+ {
+ //Eine CrsrShell ist auch immer eine WrtShell
+ pSh = (SwWrtShell*)pVSh;
+ }
+ else
+ return;
+
+ SwDocShell* pDShell = pSh->GetView().GetDocShell();
+ DBG_ASSERT( pDShell, "No DocShell?!");
+ String sTargetFrame;
+ if( pTargetFrameName && pTargetFrameName->Len() )
+ sTargetFrame = *pTargetFrameName;
+ else if( pDShell ) {
+ using namespace ::com::sun::star;
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+ pDShell->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<document::XDocumentProperties> xDocProps
+ = xDPS->getDocumentProperties();
+ sTargetFrame = xDocProps->getDefaultTarget();
+ }
+
+ String sReferer;
+ if( pDShell && pDShell->GetMedium() )
+ sReferer = pDShell->GetMedium()->GetName();
+ SfxViewFrame* pViewFrm = pSh->GetView().GetViewFrame();
+ SfxFrameItem aView( SID_DOCFRAME, pViewFrm );
+ SfxStringItem aName( SID_FILE_NAME, rURL );
+ SfxStringItem aTargetFrameName( SID_TARGETNAME, sTargetFrame );
+ SfxStringItem aReferer( SID_REFERER, sReferer );
+
+ SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, FALSE );
+ //#39076# Silent kann lt. SFX entfernt werden.
+// SfxBoolItem aSilent( SID_SILENT, TRUE );
+ SfxBoolItem aBrowse( SID_BROWSE, TRUE );
+
+ if( nFilter & URLLOAD_NEWVIEW )
+ aTargetFrameName.SetValue( String::CreateFromAscii("_blank") );
+
+ const SfxPoolItem* aArr[] = {
+ &aName,
+ &aNewView, /*&aSilent,*/
+ &aReferer,
+ &aView, &aTargetFrameName,
+ &aBrowse,
+ 0L
+ };
+
+ pViewFrm->GetDispatcher()->GetBindings()->Execute( SID_OPENDOC, aArr,
+ SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD );
+}
+
+void SwWrtShell::NavigatorPaste( const NaviContentBookmark& rBkmk,
+ const USHORT nAction )
+{
+ if( EXCHG_IN_ACTION_COPY == nAction )
+ {
+ // Einfuegen
+ String sURL = rBkmk.GetURL();
+ //handelt es sich um ein Sprung innerhalb des akt. Docs?
+ const SwDocShell* pDocShell = GetView().GetDocShell();
+ if(pDocShell->HasName())
+ {
+ const String rName = pDocShell->GetMedium()->GetURLObject().GetURLNoMark();
+
+ if(COMPARE_EQUAL == sURL.CompareTo(rName, rName.Len()))
+ sURL.Erase(0, rName.Len());
+ }
+ SwFmtINetFmt aFmt( sURL, aEmptyStr );
+ InsertURL( aFmt, rBkmk.GetDescription() );
+ }
+ else
+ {
+ SwSectionData aSection( FILE_LINK_SECTION, GetUniqueSectionName( 0 ) );
+ String aLinkFile( rBkmk.GetURL().GetToken(0, '#') );
+ aLinkFile += sfx2::cTokenSeperator;
+ aLinkFile += sfx2::cTokenSeperator;
+ aLinkFile += rBkmk.GetURL().GetToken(1, '#');
+ aSection.SetLinkFileName( aLinkFile );
+ aSection.SetProtectFlag( true );
+ const SwSection* pIns = InsertSection( aSection );
+ if( EXCHG_IN_ACTION_MOVE == nAction && pIns )
+ {
+ aSection = SwSectionData(*pIns);
+ aSection.SetLinkFileName( aEmptyStr );
+ aSection.SetType( CONTENT_SECTION );
+ aSection.SetProtectFlag( false );
+
+ // the update of content from linked section at time delete
+ // the undostack. Then the change of the section dont create
+ // any undoobject. - BUG 69145
+ BOOL bDoesUndo = DoesUndo();
+ SwUndoId nLastUndoId(UNDO_EMPTY);
+ if (GetLastUndoInfo(0, & nLastUndoId))
+ {
+ if (UNDO_INSSECTION != nLastUndoId)
+ {
+ DoUndo(false);
+ }
+ }
+ UpdateSection( GetSectionFmtPos( *pIns->GetFmt() ), aSection );
+ DoUndo( bDoesUndo );
+ }
+ }
+}
+
+
diff --git a/sw/source/ui/wrtsh/wrtsh3.cxx b/sw/source/ui/wrtsh/wrtsh3.cxx
new file mode 100644
index 000000000000..460d89a07a1c
--- /dev/null
+++ b/sw/source/ui/wrtsh/wrtsh3.cxx
@@ -0,0 +1,247 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#ifndef _SVX_SVXIDS_HRC //autogen
+#include <svx/svxids.hrc>
+#endif
+#include <sfx2/app.hxx>
+#include <sfx2/childwin.hxx>
+#include <sfx2/bindings.hxx>
+#include <svx/svdmark.hxx>
+#include <svx/svdview.hxx>
+#include <svx/fmglob.hxx>
+#include <svx/svdouno.hxx>
+#include <com/sun/star/form/FormButtonType.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <svx/htmlmode.hxx>
+#include <tools/urlobj.hxx>
+#include "wrtsh.hxx"
+#include "view.hxx"
+#include "IMark.hxx"
+#include "doc.hxx"
+#include "wrtsh.hrc"
+
+#include <unomid.h>
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+extern sal_Bool bNoInterrupt; // in mainwn.cxx
+
+BOOL SwWrtShell::MoveBookMark( BookMarkMove eFuncId, const ::sw::mark::IMark* const pMark)
+{
+//JP 08.03.96: die Wizards brauchen die Selektion !!
+// EndSelect();
+ (this->*fnKillSel)( 0, sal_False );
+
+ BOOL bRet = sal_True;
+ switch(eFuncId)
+ {
+ case BOOKMARK_INDEX:bRet = SwCrsrShell::GotoMark( pMark );break;
+ case BOOKMARK_NEXT: bRet = SwCrsrShell::GoNextBookmark();break;
+ case BOOKMARK_PREV: bRet = SwCrsrShell::GoPrevBookmark();break;
+ default:;//prevent warning
+ }
+
+ if( bRet && IsSelFrmMode() )
+ {
+ UnSelectFrm();
+ LeaveSelFrmMode();
+ }
+ if( IsSelection() )
+ {
+ fnKillSel = &SwWrtShell::ResetSelect;
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ }
+ return bRet;
+}
+
+BOOL SwWrtShell::GotoField( const SwFmtFld& rFld )
+{
+ (this->*fnKillSel)( 0, sal_False );
+
+ BOOL bRet = SwCrsrShell::GotoFld( rFld );
+ if( bRet && IsSelFrmMode() )
+ {
+ UnSelectFrm();
+ LeaveSelFrmMode();
+ }
+
+ if( IsSelection() )
+ {
+ fnKillSel = &SwWrtShell::ResetSelect;
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ }
+
+ return bRet;
+}
+
+bool SwWrtShell::GotoFieldmark(::sw::mark::IFieldmark const * const pMark)
+{
+ (this->*fnKillSel)( 0, sal_False );
+ bool bRet = SwCrsrShell::GotoFieldmark(pMark);
+ if( bRet && IsSelFrmMode() )
+ {
+ UnSelectFrm();
+ LeaveSelFrmMode();
+ }
+ if( IsSelection() )
+ {
+ fnKillSel = &SwWrtShell::ResetSelect;
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ }
+ return bRet;
+}
+
+/*--------------------------------------------------------------------
+ Beschreibung: FontWork-Slots invalidieren
+ --------------------------------------------------------------------*/
+
+
+void SwWrtShell::DrawSelChanged( )
+{
+ static sal_uInt16 __READONLY_DATA aInval[] =
+ {
+ SID_ATTR_FILL_STYLE, SID_ATTR_FILL_COLOR, SID_ATTR_LINE_STYLE,
+ SID_ATTR_LINE_WIDTH, SID_ATTR_LINE_COLOR, 0
+ };
+
+ GetView().GetViewFrame()->GetBindings().Invalidate(aInval);
+
+ sal_Bool bOldVal = bNoInterrupt;
+ bNoInterrupt = sal_True; // Trick, um AttrChangedNotify ueber Timer auszufuehren
+ GetView().AttrChangedNotify(this);
+ bNoInterrupt = bOldVal;
+}
+
+BOOL SwWrtShell::GotoMark( const ::rtl::OUString& rName )
+{
+ IDocumentMarkAccess::const_iterator_t ppMark = getIDocumentMarkAccess()->findMark( rName );
+ if(ppMark == getIDocumentMarkAccess()->getMarksEnd()) return false;
+ return MoveBookMark( BOOKMARK_INDEX, ppMark->get() );
+}
+
+
+BOOL SwWrtShell::GotoMark( const ::sw::mark::IMark* const pMark )
+{
+ return MoveBookMark( BOOKMARK_INDEX, pMark );
+}
+
+
+BOOL SwWrtShell::GoNextBookmark()
+{
+ return MoveBookMark( BOOKMARK_NEXT );
+}
+
+
+BOOL SwWrtShell::GoPrevBookmark()
+{
+ return MoveBookMark( BOOKMARK_PREV );
+}
+
+
+void SwWrtShell::ExecMacro( const SvxMacro& rMacro, String* pRet, SbxArray* pArgs )
+{
+ // OD 11.02.2003 #100556# - execute macro, if it is allowed.
+ if ( IsMacroExecAllowed() )
+ {
+ GetDoc()->ExecMacro( rMacro, pRet, pArgs );
+ }
+}
+
+
+sal_uInt16 SwWrtShell::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEvent,
+ sal_Bool bChkPtr, SbxArray* pArgs,
+ const Link* pCallBack )
+{
+ return GetDoc()->CallEvent( nEvent, rCallEvent, bChkPtr, pArgs, pCallBack );
+}
+
+
+ // fall ein util::URL-Button selektiert ist, dessen util::URL returnen, ansonsten
+ // einen LeerString
+sal_Bool SwWrtShell::GetURLFromButton( String& rURL, String& rDescr ) const
+{
+ sal_Bool bRet = sal_False;
+ const SdrView *pDView = GetDrawView();
+ if( pDView )
+ {
+ // Ein Fly ist genau dann erreichbar, wenn er selektiert ist.
+ const SdrMarkList &rMarkList = pDView->GetMarkedObjectList();
+
+ if (rMarkList.GetMark(0))
+ {
+ SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj());
+ if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor())
+ {
+ uno::Reference< awt::XControlModel > xControlModel = pUnoCtrl->GetUnoControlModel();
+
+ ASSERT( xControlModel.is(), "UNO-Control ohne Model" );
+ if( !xControlModel.is() )
+ return bRet;
+
+ uno::Reference< beans::XPropertySet > xPropSet(xControlModel, uno::UNO_QUERY);
+
+ uno::Any aTmp;
+
+ form::FormButtonType eButtonType = form::FormButtonType_URL;
+ uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo();
+ if(xInfo->hasPropertyByName( C2U("ButtonType") ))
+ {
+ aTmp = xPropSet->getPropertyValue( C2U("ButtonType") );
+ form::FormButtonType eTmpButtonType;
+ aTmp >>= eTmpButtonType;
+ if( eButtonType == eTmpButtonType)
+ {
+ // Label
+ aTmp = xPropSet->getPropertyValue( C2U("Label") );
+ OUString uTmp;
+ if( (aTmp >>= uTmp) && uTmp.getLength())
+ {
+ rDescr = String(uTmp);
+ }
+
+ // util::URL
+ aTmp = xPropSet->getPropertyValue( C2U("TargetURL") );
+ if( (aTmp >>= uTmp) && uTmp.getLength())
+ {
+ rURL = String(uTmp);
+ }
+ bRet = sal_True;
+ }
+ }
+ }
+ }
+ }
+
+ return bRet;
+}
diff --git a/sw/source/ui/wrtsh/wrtsh4.cxx b/sw/source/ui/wrtsh/wrtsh4.cxx
new file mode 100644
index 000000000000..541674e912a3
--- /dev/null
+++ b/sw/source/ui/wrtsh/wrtsh4.cxx
@@ -0,0 +1,300 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <wrtsh.hxx>
+#include <crsskip.hxx>
+
+
+/*
+* private Methoden, die den Cursor ueber Suchen bewegen. Das
+* Aufheben der Selektion muss auf der Ebene darueber erfolgen.
+*/
+
+/*
+* Der Anfang eines Wortes ist das Folgen eines nicht-
+* Trennzeichens auf Trennzeichen. Ferner das Folgen von
+* nicht-Satztrennern auf Satztrenner. Der Absatzanfang ist
+* ebenfalls Wortanfang.
+*/
+
+
+BOOL SwWrtShell::_SttWrd()
+{
+ if ( IsSttPara() )
+ return 1;
+ /*
+ * temporaeren Cursor ohne Selektion erzeugen
+ */
+ Push();
+ ClearMark();
+ if( !GoStartWord() )
+ // nicht gefunden --> an den Absatzanfang
+ SwCrsrShell::MovePara( fnParaCurr, fnParaStart );
+ ClearMark();
+ // falls vorher Mark gesetzt war, zusammenfassen
+ Combine();
+ return 1;
+}
+/*
+ * Das Ende eines Wortes ist das Folgen von Trennzeichen auf
+ * nicht-Trennzeichen. Unter dem Ende eines Wortes wird
+ * ebenfalls die Folge von Worttrennzeichen auf Interpunktions-
+ * zeichen verstanden. Das Absatzende ist ebenfalls Wortende.
+ */
+
+
+
+BOOL SwWrtShell::_EndWrd()
+{
+ if ( IsEndWrd() )
+ return 1;
+ // temporaeren Cursor ohne Selektion erzeugen
+ Push();
+ ClearMark();
+ if( !GoEndWord() )
+ // nicht gefunden --> an das Absatz Ende
+ SwCrsrShell::MovePara(fnParaCurr, fnParaEnd);
+ ClearMark();
+ // falls vorher Mark gesetzt war, zusammenfassen
+ Combine();
+ return 1;
+}
+
+
+
+BOOL SwWrtShell::_NxtWrd()
+{
+ BOOL bRet = FALSE;
+ while( IsEndPara() ) // wenn schon am Ende, dann naechsten ???
+ {
+ if(!SwCrsrShell::Right(1,CRSR_SKIP_CHARS)) // Document - Ende ??
+ {
+ Pop( FALSE );
+ return bRet;
+ }
+ bRet = IsStartWord();
+ }
+ Push();
+ ClearMark();
+ while( !bRet )
+ {
+ if( !GoNextWord() )
+ {
+ if( (!IsEndPara() && !SwCrsrShell::MovePara( fnParaCurr, fnParaEnd ) )
+ || !SwCrsrShell::Right(1,CRSR_SKIP_CHARS) )
+ break;
+ bRet = IsStartWord();
+ }
+ else
+ bRet = TRUE;
+ }
+ ClearMark();
+ Combine();
+ return bRet;
+}
+
+BOOL SwWrtShell::_PrvWrd()
+{
+ BOOL bRet = FALSE;
+ while( IsSttPara() )
+ { // wenn schon am Anfang, dann naechsten ???
+ if(!SwCrsrShell::Left(1,CRSR_SKIP_CHARS))
+ { // Document - Anfang ??
+ Pop( FALSE );
+ return bRet;
+ }
+ bRet = IsStartWord();
+ }
+ Push();
+ ClearMark();
+ while( !bRet )
+ {
+ if( !GoPrevWord() )
+ {
+ if( (!IsSttPara() && !SwCrsrShell::MovePara( fnParaCurr, fnParaStart ) )
+ || !SwCrsrShell::Left(1,CRSR_SKIP_CHARS) )
+ break;
+ bRet = IsStartWord();
+ }
+ else
+ bRet = TRUE;
+ }
+ ClearMark();
+ Combine();
+ return bRet;
+}
+
+// --> OD 2008-08-06 #i92468#
+// method code of <SwWrtShell::_NxtWrd()> before fix for issue i72162
+BOOL SwWrtShell::_NxtWrdForDelete()
+{
+ if ( IsEndPara() )
+ {
+ if ( !SwCrsrShell::Right(1,CRSR_SKIP_CHARS) )
+ {
+ Pop( FALSE );
+ return FALSE;
+ }
+ return TRUE;
+ }
+ Push();
+ ClearMark();
+ if ( !GoNextWord() )
+ {
+ SwCrsrShell::MovePara( fnParaCurr, fnParaEnd );
+ }
+ ClearMark();
+ Combine();
+ return TRUE;
+}
+
+// method code of <SwWrtShell::_PrvWrd()> before fix for issue i72162
+BOOL SwWrtShell::_PrvWrdForDelete()
+{
+ if ( IsSttPara() )
+ {
+ if ( !SwCrsrShell::Left(1,CRSR_SKIP_CHARS) )
+ {
+ Pop( FALSE );
+ return FALSE;
+ }
+ return TRUE;
+ }
+ Push();
+ ClearMark();
+ if( !GoPrevWord() )
+ {
+ SwCrsrShell::MovePara( fnParaCurr, fnParaStart );
+ }
+ ClearMark();
+ Combine();
+ return TRUE;
+}
+// <--
+
+
+BOOL SwWrtShell::_FwdSentence()
+{
+ Push();
+ ClearMark();
+ if(!SwCrsrShell::Right(1,CRSR_SKIP_CHARS))
+ {
+ Pop(FALSE);
+ return 0;
+ }
+ if( !GoNextSentence() && !IsEndPara() )
+ SwCrsrShell::MovePara(fnParaCurr, fnParaEnd);
+
+ ClearMark();
+ Combine();
+ return 1;
+}
+
+
+
+BOOL SwWrtShell::_BwdSentence()
+{
+ Push();
+ ClearMark();
+ if(!SwCrsrShell::Left(1,CRSR_SKIP_CHARS))
+ {
+ Pop(FALSE);
+ return 0;
+ }
+ if(IsSttPara())
+ {
+ Pop();
+ return 1;
+ }
+ if( !GoPrevSentence() && !IsSttPara() )
+ // nicht gefunden --> an den Absatz Anfang
+ SwCrsrShell::MovePara( fnParaCurr, fnParaStart );
+ ClearMark();
+ Combine();
+ return 1;
+}
+
+
+BOOL SwWrtShell::_FwdPara()
+{
+ Push();
+ ClearMark();
+ // --> OD 2009-01-06 #i81824#
+ // going right and back again left not needed and causes too much
+ // accessibility events due to the cursor movements.
+// if(!SwCrsrShell::Right(1,CRSR_SKIP_CHARS))
+// {
+// Pop(FALSE);
+// return 0;
+// }
+// SwCrsrShell::Left(1,CRSR_SKIP_CHARS);
+ // <--
+ BOOL bRet = SwCrsrShell::MovePara(fnParaNext, fnParaStart);
+
+ ClearMark();
+ Combine();
+ return bRet;
+}
+
+
+BOOL SwWrtShell::_BwdPara()
+{
+ Push();
+ ClearMark();
+ // --> OD 2009-01-06 #i81824#
+ // going left and back again right not needed and causes too much
+ // accessibility events due to the cursor movements.
+// if(!SwCrsrShell::Left(1,CRSR_SKIP_CHARS))
+// {
+// Pop(FALSE);
+// return 0;
+// }
+// SwCrsrShell::Right(1,CRSR_SKIP_CHARS);
+ // <--
+ // --> OD 2009-01-06 #i81824#
+ // going to start of paragraph only needed, if move to previous paragraph
+ // does not happen. Otherwise, useless accessibility events are triggered
+ // due to cursor movements.
+// if(!IsSttOfPara())
+// SttPara();
+ BOOL bRet = SwCrsrShell::MovePara(fnParaPrev, fnParaStart);
+ if ( !bRet && !IsSttOfPara() )
+ {
+ SttPara();
+ }
+ // <--
+
+ ClearMark();
+ Combine();
+ return bRet;
+}
+
+
diff --git a/sw/source/ui/wrtsh/wrtundo.cxx b/sw/source/ui/wrtsh/wrtundo.cxx
new file mode 100644
index 000000000000..b721b0500a29
--- /dev/null
+++ b/sw/source/ui/wrtsh/wrtundo.cxx
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+
+#define _SVSTDARR_STRINGSDTOR
+#include <tools/resid.hxx>
+#include <sfx2/app.hxx>
+#include <svl/slstitm.hxx>
+#include <wrtsh.hxx>
+#include <swundo.hxx> // fuer Undo-Ids
+#include <IDocumentUndoRedo.hxx>
+#include <swdtflvr.hxx>
+#include <svtools/svtdata.hxx>
+#include <svtools/svtools.hrc>
+#include <svtools/svtdata.hxx>
+#include <wrtsh.hrc>
+#include <sfx2/sfx.hrc>
+
+
+// Undo beendet alle Modi. Falls eine Selektion durch das Undo entstanden
+// ist, muss die fuer die weiteren Aktionen beruecksichtigt werden.
+
+
+void SwWrtShell::Do( DoType eDoType, USHORT nCnt )
+{
+ // #105332# save current state of DoesUndo()
+ sal_Bool bSaveDoesUndo = DoesUndo();
+
+ StartAllAction();
+ switch( eDoType )
+ {
+ case UNDO:
+ DoUndo(sal_False); // #i21739#
+ // Modi zuruecksetzen
+ EnterStdMode();
+ SwEditShell::Undo(nCnt);
+ break;
+ case REDO:
+ DoUndo(sal_False); // #i21739#
+ // Modi zuruecksetzen
+ EnterStdMode();
+ SwEditShell::Redo( nCnt );
+ break;
+ case REPEAT:
+ // #i21739# do not touch undo flag here !!!
+ SwEditShell::Repeat( nCnt );
+ break;
+ }
+ EndAllAction();
+ // #105332# restore undo state
+ DoUndo(bSaveDoesUndo);
+
+ BOOL bCreateXSelection = FALSE;
+ const BOOL bFrmSelected = IsFrmSelected() || IsObjSelected();
+ if ( IsSelection() )
+ {
+ if ( bFrmSelected )
+ UnSelectFrm();
+
+ // Funktionspointer fuer das Aufheben der Selektion setzen
+ // bei Cursor setzen
+ fnKillSel = &SwWrtShell::ResetSelect;
+ fnSetCrsr = &SwWrtShell::SetCrsrKillSel;
+ bCreateXSelection = TRUE;
+ }
+ else if ( bFrmSelected )
+ {
+ EnterSelFrmMode();
+ bCreateXSelection = TRUE;
+ }
+ else if( (CNT_GRF | CNT_OLE ) & GetCntType() )
+ {
+ SelectObj( GetCharRect().Pos() );
+ EnterSelFrmMode();
+ bCreateXSelection = TRUE;
+ }
+
+ if( bCreateXSelection )
+ SwTransferable::CreateSelection( *this );
+
+ // Bug 32918: nach loeschen der Numerierung bleibt die Obj. Leiste stehen
+ // Warum wird hier nicht immer ein CallChgLink gerufen?
+ CallChgLnk();
+}
+
+
+String SwWrtShell::GetDoString( DoType eDoType ) const
+{
+ ::rtl::OUString aUndoStr;
+ USHORT nResStr = STR_UNDO;
+ switch( eDoType )
+ {
+ case UNDO:
+ nResStr = STR_UNDO;
+ GetLastUndoInfo(& aUndoStr, 0);
+ break;
+ case REDO:
+ nResStr = STR_REDO;
+ GetFirstRedoInfo(& aUndoStr);
+ break;
+ default:;//prevent warning
+ }
+
+ ::rtl::OUStringBuffer buf = ::rtl::OUStringBuffer( String( SvtResId( nResStr ) ) );
+ buf.append(aUndoStr);
+
+ return buf.makeStringAndClear();
+}
+
+USHORT SwWrtShell::GetDoStrings( DoType eDoType, SfxStringListItem& rStrs ) const
+{
+ SwUndoComments_t comments;
+ switch( eDoType )
+ {
+ case UNDO:
+ comments = GetIDocumentUndoRedo().GetUndoComments();
+ break;
+ case REDO:
+ comments = GetIDocumentUndoRedo().GetRedoComments();
+ break;
+ default:;//prevent warning
+ }
+
+ ::rtl::OUStringBuffer buf;
+ for (size_t i = 0; i < comments.size(); ++i)
+ {
+ OSL_ENSURE(comments[i].getLength(), "no Undo/Redo Text set");
+ buf.append(comments[i]);
+ buf.append(sal_Unicode('\n'));
+ }
+ rStrs.SetString(buf.makeStringAndClear());
+ return static_cast<sal_uInt16>(comments.size());
+}
+
+
+String SwWrtShell::GetRepeatString() const
+{
+ ::rtl::OUString str;
+ GetRepeatInfo(& str);
+
+ if (str.getLength() == 0)
+ {
+ return str;
+ }
+
+ ::rtl::OUStringBuffer buf( String(SvtResId(STR_REPEAT)) );
+ buf.append(str);
+ return buf.makeStringAndClear();
+}
+
+